@quilltap/plugin-types 2.0.1 → 2.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.
- package/CHANGELOG.md +8 -0
- package/README.md +1 -4
- package/dist/{index-DtW7izgw.d.mts → index-BiFtkKWr.d.mts} +2 -244
- package/dist/{index-BXJLgAuZ.d.ts → index-DNgmDKd5.d.ts} +2 -244
- package/dist/index.d.mts +283 -2
- package/dist/index.d.ts +283 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/index.d.mts +1 -1
- package/dist/plugins/index.d.ts +1 -1
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,290 @@
|
|
|
1
1
|
import { UniversalTool } from './llm/index.mjs';
|
|
2
2
|
export { AnthropicToolDefinition, AttachmentResults, CacheUsage, EmbeddingOptions, EmbeddingProvider, EmbeddingResult, FileAttachment, GeneratedImage, GoogleToolDefinition, ImageGenParams, ImageGenProvider, ImageGenResponse, ImageGenProvider as ImageProvider, JSONSchemaDefinition, LLMMessage, LLMParams, LLMProvider, LLMResponse, LocalEmbeddingProvider, LocalEmbeddingProviderState, ModelMetadata, ModelWarning, ModelWarningLevel, OpenAIToolDefinition, ResponseFormat, StreamChunk, LLMProvider as TextProvider, TokenUsage, ToolCall, ToolCallRequest, ToolFormatOptions, ToolResult, isLocalEmbeddingProvider } from './llm/index.mjs';
|
|
3
3
|
export { CategoryScore, ScoringInput, ScoringProvider, ScoringResult, ScoringTask } from './providers/index.mjs';
|
|
4
|
-
export { A as AttachmentSupport, C as CheapModelConfig, a as ColorPalette, E as Effects, b as EmbeddedFont, c as EmbeddingModelInfo, F as FontDefinition, I as IconProps, d as ImageGenerationModelInfo, e as ImageProviderConstraints, f as ImageStyleInfo, g as InstalledPluginInfo, L as LLMProviderPlugin, M as MessageFormatSupport, h as ModelInfo, i as ModerationCategoryResult, j as ModerationProviderConfigRequirements, k as ModerationProviderMetadata, l as ModerationProviderPlugin, m as ModerationProviderPluginExport, n as ModerationResult, P as PluginAuthor, o as PluginCapability, p as PluginCategory, q as PluginCompatibility, r as PluginIconData, s as PluginManifest, t as PluginPermissions, u as PluginStatus, v as ProviderCapabilities, w as ProviderConfig, x as ProviderConfigRequirements, y as ProviderMetadata, z as ProviderPluginExport,
|
|
4
|
+
export { A as AttachmentSupport, C as CheapModelConfig, a as ColorPalette, E as Effects, b as EmbeddedFont, c as EmbeddingModelInfo, F as FontDefinition, I as IconProps, d as ImageGenerationModelInfo, e as ImageProviderConstraints, f as ImageStyleInfo, g as InstalledPluginInfo, L as LLMProviderPlugin, M as MessageFormatSupport, h as ModelInfo, i as ModerationCategoryResult, j as ModerationProviderConfigRequirements, k as ModerationProviderMetadata, l as ModerationProviderPlugin, m as ModerationProviderPluginExport, n as ModerationResult, P as PluginAuthor, o as PluginCapability, p as PluginCategory, q as PluginCompatibility, r as PluginIconData, s as PluginManifest, t as PluginPermissions, u as PluginStatus, v as ProviderCapabilities, w as ProviderConfig, x as ProviderConfigRequirements, y as ProviderMetadata, z as ProviderPluginExport, S as ScoringProviderConfigRequirements, B as ScoringProviderMetadata, D as ScoringProviderPlugin, G as ScoringProviderPluginExport, H as SearchOutput, J as SearchProviderConfig, K as SearchProviderConfigRequirements, N as SearchProviderMetadata, O as SearchProviderPlugin, Q as SearchProviderPluginExport, R as SearchResult, T as Spacing, U as SubsystemOverrides, V as TextProviderPlugin, W as ThemeMetadata, X as ThemePlugin, Y as ThemePluginExport, Z as ThemeTokens, _ as ToolFormatType, $ as Typography } from './index-BiFtkKWr.mjs';
|
|
5
5
|
export { ApiKeyError, AttachmentError, ConfigurationError, LogContext, LogLevel, ModelNotFoundError, PluginError, PluginLogger, ProviderApiError, RateLimitError, ToolExecutionError, createConsoleLogger, createNoopLogger } from './common/index.mjs';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Roleplay Template Plugin Interface types for Quilltap plugin development
|
|
9
|
+
*
|
|
10
|
+
* @deprecated The ROLEPLAY_TEMPLATE plugin capability was removed in Quilltap v4.2.0.
|
|
11
|
+
* Roleplay templates are now native first-class entities managed through the Settings UI.
|
|
12
|
+
* These types are preserved for backward compatibility with existing third-party plugins
|
|
13
|
+
* but will be removed in a future major version.
|
|
14
|
+
*
|
|
15
|
+
* @module @quilltap/plugin-types/plugins/roleplay-template
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Configuration for an annotation button in the formatting toolbar.
|
|
19
|
+
*
|
|
20
|
+
* Annotation buttons allow users to insert roleplay formatting
|
|
21
|
+
* (e.g., narration brackets, OOC markers) with a single click.
|
|
22
|
+
*/
|
|
23
|
+
interface AnnotationButton {
|
|
24
|
+
/** Full name displayed in tooltip (e.g., "Narration", "Internal Monologue") */
|
|
25
|
+
label: string;
|
|
26
|
+
/** Abbreviated label displayed on button (e.g., "Nar", "Int", "OOC") */
|
|
27
|
+
abbrev: string;
|
|
28
|
+
/** Opening delimiter (e.g., "[", "*", "{{") */
|
|
29
|
+
prefix: string;
|
|
30
|
+
/** Closing delimiter (e.g., "]", "*", "}}") - empty string for line-end delimiters */
|
|
31
|
+
suffix: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A pattern for styling roleplay text in message content.
|
|
35
|
+
*
|
|
36
|
+
* Rendering patterns define how to match and style specific text patterns
|
|
37
|
+
* in AI responses (e.g., narration, OOC comments, internal monologue).
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* // Match *narration* with single asterisks
|
|
42
|
+
* { pattern: '(?<!\\*)\\*[^*]+\\*(?!\\*)', className: 'qt-chat-narration' }
|
|
43
|
+
*
|
|
44
|
+
* // Match ((OOC comments)) with double parentheses
|
|
45
|
+
* { pattern: '\\(\\([^)]+\\)\\)', className: 'qt-chat-ooc' }
|
|
46
|
+
*
|
|
47
|
+
* // Match // OOC at start of line (multiline mode)
|
|
48
|
+
* { pattern: '^// .+$', className: 'qt-chat-ooc', flags: 'm' }
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
interface RenderingPattern {
|
|
52
|
+
/** Regex pattern as a string (converted to RegExp at runtime) */
|
|
53
|
+
pattern: string;
|
|
54
|
+
/**
|
|
55
|
+
* CSS class to apply to matched text.
|
|
56
|
+
* Standard classes: qt-chat-dialogue, qt-chat-narration, qt-chat-ooc, qt-chat-inner-monologue
|
|
57
|
+
*/
|
|
58
|
+
className: string;
|
|
59
|
+
/** Optional regex flags (e.g., 'm' for multiline). Default: none */
|
|
60
|
+
flags?: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Configuration for detecting dialogue at the paragraph level.
|
|
64
|
+
*
|
|
65
|
+
* When dialogue contains markdown formatting (like **bold**), the text gets split
|
|
66
|
+
* into multiple children and inline regex patterns can't match. Paragraph-level
|
|
67
|
+
* detection checks if the entire paragraph starts and ends with quote characters.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* // Standard dialogue with straight and curly quotes
|
|
72
|
+
* {
|
|
73
|
+
* openingChars: ['"', '"'],
|
|
74
|
+
* closingChars: ['"', '"'],
|
|
75
|
+
* className: 'qt-chat-dialogue'
|
|
76
|
+
* }
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
interface DialogueDetection {
|
|
80
|
+
/** Opening quote characters to detect (e.g., ['"', '"']) */
|
|
81
|
+
openingChars: string[];
|
|
82
|
+
/** Closing quote characters to detect (e.g., ['"', '"']) */
|
|
83
|
+
closingChars: string[];
|
|
84
|
+
/** CSS class to apply to dialogue paragraphs */
|
|
85
|
+
className: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Narration delimiters define how narration/action text is marked in roleplay output.
|
|
89
|
+
* Required for all roleplay templates.
|
|
90
|
+
*
|
|
91
|
+
* - A single string means the same character is used for opening and closing (e.g., '*')
|
|
92
|
+
* - A tuple of two strings means different opening and closing delimiters (e.g., ['[', ']'])
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```typescript
|
|
96
|
+
* // Single asterisk for both open and close
|
|
97
|
+
* narrationDelimiters: '*'
|
|
98
|
+
*
|
|
99
|
+
* // Square brackets with different open/close
|
|
100
|
+
* narrationDelimiters: ['[', ']']
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
type NarrationDelimiters = string | [string, string];
|
|
104
|
+
/**
|
|
105
|
+
* Configuration for a single roleplay template
|
|
106
|
+
*
|
|
107
|
+
* A roleplay template defines a formatting protocol for AI responses,
|
|
108
|
+
* such as how dialogue, actions, thoughts, and OOC comments should be formatted.
|
|
109
|
+
*/
|
|
110
|
+
interface RoleplayTemplateConfig {
|
|
111
|
+
/** Display name for the template */
|
|
112
|
+
name: string;
|
|
113
|
+
/** Optional description explaining the template's formatting style */
|
|
114
|
+
description?: string;
|
|
115
|
+
/**
|
|
116
|
+
* The system prompt that defines the formatting rules.
|
|
117
|
+
* This is prepended to character system prompts when the template is active.
|
|
118
|
+
*/
|
|
119
|
+
systemPrompt: string;
|
|
120
|
+
/** Tags for categorization and searchability */
|
|
121
|
+
tags?: string[];
|
|
122
|
+
/**
|
|
123
|
+
* Annotation buttons for the formatting toolbar.
|
|
124
|
+
* Defines which formatting options are available when document editing mode is enabled.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* annotationButtons: [
|
|
129
|
+
* { label: 'Narration', abbrev: 'Nar', prefix: '[', suffix: ']' },
|
|
130
|
+
* { label: 'Internal Monologue', abbrev: 'Int', prefix: '{', suffix: '}' },
|
|
131
|
+
* { label: 'Out of Character', abbrev: 'OOC', prefix: '// ', suffix: '' },
|
|
132
|
+
* ]
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
annotationButtons?: AnnotationButton[];
|
|
136
|
+
/**
|
|
137
|
+
* Patterns for styling roleplay text in message content.
|
|
138
|
+
* These patterns are matched against text nodes and wrapped in styled spans.
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```typescript
|
|
142
|
+
* renderingPatterns: [
|
|
143
|
+
* // Match *narration* with single asterisks
|
|
144
|
+
* { pattern: '(?<!\\*)\\*[^*]+\\*(?!\\*)', className: 'qt-chat-narration' },
|
|
145
|
+
* // Match ((OOC)) with double parentheses
|
|
146
|
+
* { pattern: '\\(\\([^)]+\\)\\)', className: 'qt-chat-ooc' },
|
|
147
|
+
* ]
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
renderingPatterns?: RenderingPattern[];
|
|
151
|
+
/**
|
|
152
|
+
* Optional dialogue detection for paragraph-level styling.
|
|
153
|
+
* When dialogue contains markdown formatting, inline patterns can't match.
|
|
154
|
+
* This detects paragraphs that start/end with quote characters.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```typescript
|
|
158
|
+
* dialogueDetection: {
|
|
159
|
+
* openingChars: ['"', '"'],
|
|
160
|
+
* closingChars: ['"', '"'],
|
|
161
|
+
* className: 'qt-chat-dialogue'
|
|
162
|
+
* }
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
dialogueDetection?: DialogueDetection;
|
|
166
|
+
/**
|
|
167
|
+
* Narration delimiters — required for all templates.
|
|
168
|
+
* Defines how narration/action text is delimited in the template's formatting.
|
|
169
|
+
*
|
|
170
|
+
* A single string means the same delimiter is used for opening and closing (e.g., '*').
|
|
171
|
+
* A tuple of two strings means different opening and closing delimiters (e.g., ['[', ']']).
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```typescript
|
|
175
|
+
* // Standard: *narration*
|
|
176
|
+
* narrationDelimiters: '*'
|
|
177
|
+
*
|
|
178
|
+
* // Quilltap RP: [narration]
|
|
179
|
+
* narrationDelimiters: ['[', ']']
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
narrationDelimiters: NarrationDelimiters;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Metadata for a roleplay template plugin
|
|
186
|
+
*/
|
|
187
|
+
interface RoleplayTemplateMetadata {
|
|
188
|
+
/**
|
|
189
|
+
* Unique template identifier (lowercase, hyphens allowed)
|
|
190
|
+
* This is typically derived from the plugin name
|
|
191
|
+
*/
|
|
192
|
+
templateId: string;
|
|
193
|
+
/** Human-readable display name */
|
|
194
|
+
displayName: string;
|
|
195
|
+
/** Template description */
|
|
196
|
+
description?: string;
|
|
197
|
+
/** Template author */
|
|
198
|
+
author?: string | {
|
|
199
|
+
name: string;
|
|
200
|
+
email?: string;
|
|
201
|
+
url?: string;
|
|
202
|
+
};
|
|
203
|
+
/** Template tags for categorization */
|
|
204
|
+
tags?: string[];
|
|
205
|
+
/** Template version */
|
|
206
|
+
version?: string;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Main Roleplay Template Plugin Interface
|
|
210
|
+
*
|
|
211
|
+
* Plugins implementing this interface can be dynamically loaded
|
|
212
|
+
* by Quilltap to provide custom roleplay formatting templates.
|
|
213
|
+
*
|
|
214
|
+
* A plugin can provide one or more templates. Each template defines
|
|
215
|
+
* a unique formatting protocol for AI responses.
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```typescript
|
|
219
|
+
* import type { RoleplayTemplatePlugin } from '@quilltap/plugin-types';
|
|
220
|
+
*
|
|
221
|
+
* export const plugin: RoleplayTemplatePlugin = {
|
|
222
|
+
* metadata: {
|
|
223
|
+
* templateId: 'my-rp-format',
|
|
224
|
+
* displayName: 'My RP Format',
|
|
225
|
+
* description: 'A custom roleplay formatting style',
|
|
226
|
+
* tags: ['custom', 'roleplay'],
|
|
227
|
+
* },
|
|
228
|
+
* templates: [
|
|
229
|
+
* {
|
|
230
|
+
* name: 'My RP Format',
|
|
231
|
+
* description: 'Custom formatting with specific syntax',
|
|
232
|
+
* systemPrompt: `[FORMATTING INSTRUCTIONS]
|
|
233
|
+
* 1. Dialogue: Use quotation marks
|
|
234
|
+
* 2. Actions: Use asterisks *like this*
|
|
235
|
+
* ...`,
|
|
236
|
+
* tags: ['custom'],
|
|
237
|
+
* },
|
|
238
|
+
* ],
|
|
239
|
+
* };
|
|
240
|
+
* ```
|
|
241
|
+
*
|
|
242
|
+
* @example
|
|
243
|
+
* ```typescript
|
|
244
|
+
* // Plugin with multiple templates
|
|
245
|
+
* import type { RoleplayTemplatePlugin } from '@quilltap/plugin-types';
|
|
246
|
+
*
|
|
247
|
+
* export const plugin: RoleplayTemplatePlugin = {
|
|
248
|
+
* metadata: {
|
|
249
|
+
* templateId: 'format-pack',
|
|
250
|
+
* displayName: 'RP Format Pack',
|
|
251
|
+
* description: 'A collection of roleplay formats',
|
|
252
|
+
* },
|
|
253
|
+
* templates: [
|
|
254
|
+
* {
|
|
255
|
+
* name: 'Screenplay',
|
|
256
|
+
* systemPrompt: '...',
|
|
257
|
+
* },
|
|
258
|
+
* {
|
|
259
|
+
* name: 'Novel',
|
|
260
|
+
* systemPrompt: '...',
|
|
261
|
+
* },
|
|
262
|
+
* ],
|
|
263
|
+
* };
|
|
264
|
+
* ```
|
|
265
|
+
*/
|
|
266
|
+
interface RoleplayTemplatePlugin {
|
|
267
|
+
/** Plugin metadata for UI display and identification */
|
|
268
|
+
metadata: RoleplayTemplateMetadata;
|
|
269
|
+
/**
|
|
270
|
+
* One or more roleplay templates provided by this plugin.
|
|
271
|
+
* Each template has its own name, description, and system prompt.
|
|
272
|
+
*/
|
|
273
|
+
templates: RoleplayTemplateConfig[];
|
|
274
|
+
/**
|
|
275
|
+
* Optional initialization function
|
|
276
|
+
* Called when the plugin is loaded
|
|
277
|
+
*/
|
|
278
|
+
initialize?: () => void | Promise<void>;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Standard export type for roleplay template plugins
|
|
282
|
+
*/
|
|
283
|
+
interface RoleplayTemplatePluginExport {
|
|
284
|
+
/** The roleplay template plugin instance */
|
|
285
|
+
plugin: RoleplayTemplatePlugin;
|
|
286
|
+
}
|
|
287
|
+
|
|
7
288
|
/**
|
|
8
289
|
* System Prompt Plugin Interface types for Quilltap plugin development
|
|
9
290
|
*
|
|
@@ -373,4 +654,4 @@ interface ToolPluginExport {
|
|
|
373
654
|
*/
|
|
374
655
|
declare const PLUGIN_TYPES_VERSION = "2.0.0";
|
|
375
656
|
|
|
376
|
-
export { PLUGIN_TYPES_VERSION, type SystemPromptData, type SystemPromptMetadata, type SystemPromptPlugin, type SystemPromptPluginExport, type ToolExecutionContext, type ToolExecutionResult, type ToolHierarchyInfo, type ToolMetadata, type ToolPlugin, type ToolPluginExport, UniversalTool };
|
|
657
|
+
export { type NarrationDelimiters, PLUGIN_TYPES_VERSION, type RoleplayTemplateConfig, type RoleplayTemplateMetadata, type RoleplayTemplatePlugin, type RoleplayTemplatePluginExport, type SystemPromptData, type SystemPromptMetadata, type SystemPromptPlugin, type SystemPromptPluginExport, type ToolExecutionContext, type ToolExecutionResult, type ToolHierarchyInfo, type ToolMetadata, type ToolPlugin, type ToolPluginExport, UniversalTool };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,290 @@
|
|
|
1
1
|
import { UniversalTool } from './llm/index.js';
|
|
2
2
|
export { AnthropicToolDefinition, AttachmentResults, CacheUsage, EmbeddingOptions, EmbeddingProvider, EmbeddingResult, FileAttachment, GeneratedImage, GoogleToolDefinition, ImageGenParams, ImageGenProvider, ImageGenResponse, ImageGenProvider as ImageProvider, JSONSchemaDefinition, LLMMessage, LLMParams, LLMProvider, LLMResponse, LocalEmbeddingProvider, LocalEmbeddingProviderState, ModelMetadata, ModelWarning, ModelWarningLevel, OpenAIToolDefinition, ResponseFormat, StreamChunk, LLMProvider as TextProvider, TokenUsage, ToolCall, ToolCallRequest, ToolFormatOptions, ToolResult, isLocalEmbeddingProvider } from './llm/index.js';
|
|
3
3
|
export { CategoryScore, ScoringInput, ScoringProvider, ScoringResult, ScoringTask } from './providers/index.js';
|
|
4
|
-
export { A as AttachmentSupport, C as CheapModelConfig, a as ColorPalette, E as Effects, b as EmbeddedFont, c as EmbeddingModelInfo, F as FontDefinition, I as IconProps, d as ImageGenerationModelInfo, e as ImageProviderConstraints, f as ImageStyleInfo, g as InstalledPluginInfo, L as LLMProviderPlugin, M as MessageFormatSupport, h as ModelInfo, i as ModerationCategoryResult, j as ModerationProviderConfigRequirements, k as ModerationProviderMetadata, l as ModerationProviderPlugin, m as ModerationProviderPluginExport, n as ModerationResult, P as PluginAuthor, o as PluginCapability, p as PluginCategory, q as PluginCompatibility, r as PluginIconData, s as PluginManifest, t as PluginPermissions, u as PluginStatus, v as ProviderCapabilities, w as ProviderConfig, x as ProviderConfigRequirements, y as ProviderMetadata, z as ProviderPluginExport,
|
|
4
|
+
export { A as AttachmentSupport, C as CheapModelConfig, a as ColorPalette, E as Effects, b as EmbeddedFont, c as EmbeddingModelInfo, F as FontDefinition, I as IconProps, d as ImageGenerationModelInfo, e as ImageProviderConstraints, f as ImageStyleInfo, g as InstalledPluginInfo, L as LLMProviderPlugin, M as MessageFormatSupport, h as ModelInfo, i as ModerationCategoryResult, j as ModerationProviderConfigRequirements, k as ModerationProviderMetadata, l as ModerationProviderPlugin, m as ModerationProviderPluginExport, n as ModerationResult, P as PluginAuthor, o as PluginCapability, p as PluginCategory, q as PluginCompatibility, r as PluginIconData, s as PluginManifest, t as PluginPermissions, u as PluginStatus, v as ProviderCapabilities, w as ProviderConfig, x as ProviderConfigRequirements, y as ProviderMetadata, z as ProviderPluginExport, S as ScoringProviderConfigRequirements, B as ScoringProviderMetadata, D as ScoringProviderPlugin, G as ScoringProviderPluginExport, H as SearchOutput, J as SearchProviderConfig, K as SearchProviderConfigRequirements, N as SearchProviderMetadata, O as SearchProviderPlugin, Q as SearchProviderPluginExport, R as SearchResult, T as Spacing, U as SubsystemOverrides, V as TextProviderPlugin, W as ThemeMetadata, X as ThemePlugin, Y as ThemePluginExport, Z as ThemeTokens, _ as ToolFormatType, $ as Typography } from './index-DNgmDKd5.js';
|
|
5
5
|
export { ApiKeyError, AttachmentError, ConfigurationError, LogContext, LogLevel, ModelNotFoundError, PluginError, PluginLogger, ProviderApiError, RateLimitError, ToolExecutionError, createConsoleLogger, createNoopLogger } from './common/index.js';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Roleplay Template Plugin Interface types for Quilltap plugin development
|
|
9
|
+
*
|
|
10
|
+
* @deprecated The ROLEPLAY_TEMPLATE plugin capability was removed in Quilltap v4.2.0.
|
|
11
|
+
* Roleplay templates are now native first-class entities managed through the Settings UI.
|
|
12
|
+
* These types are preserved for backward compatibility with existing third-party plugins
|
|
13
|
+
* but will be removed in a future major version.
|
|
14
|
+
*
|
|
15
|
+
* @module @quilltap/plugin-types/plugins/roleplay-template
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Configuration for an annotation button in the formatting toolbar.
|
|
19
|
+
*
|
|
20
|
+
* Annotation buttons allow users to insert roleplay formatting
|
|
21
|
+
* (e.g., narration brackets, OOC markers) with a single click.
|
|
22
|
+
*/
|
|
23
|
+
interface AnnotationButton {
|
|
24
|
+
/** Full name displayed in tooltip (e.g., "Narration", "Internal Monologue") */
|
|
25
|
+
label: string;
|
|
26
|
+
/** Abbreviated label displayed on button (e.g., "Nar", "Int", "OOC") */
|
|
27
|
+
abbrev: string;
|
|
28
|
+
/** Opening delimiter (e.g., "[", "*", "{{") */
|
|
29
|
+
prefix: string;
|
|
30
|
+
/** Closing delimiter (e.g., "]", "*", "}}") - empty string for line-end delimiters */
|
|
31
|
+
suffix: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A pattern for styling roleplay text in message content.
|
|
35
|
+
*
|
|
36
|
+
* Rendering patterns define how to match and style specific text patterns
|
|
37
|
+
* in AI responses (e.g., narration, OOC comments, internal monologue).
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* // Match *narration* with single asterisks
|
|
42
|
+
* { pattern: '(?<!\\*)\\*[^*]+\\*(?!\\*)', className: 'qt-chat-narration' }
|
|
43
|
+
*
|
|
44
|
+
* // Match ((OOC comments)) with double parentheses
|
|
45
|
+
* { pattern: '\\(\\([^)]+\\)\\)', className: 'qt-chat-ooc' }
|
|
46
|
+
*
|
|
47
|
+
* // Match // OOC at start of line (multiline mode)
|
|
48
|
+
* { pattern: '^// .+$', className: 'qt-chat-ooc', flags: 'm' }
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
interface RenderingPattern {
|
|
52
|
+
/** Regex pattern as a string (converted to RegExp at runtime) */
|
|
53
|
+
pattern: string;
|
|
54
|
+
/**
|
|
55
|
+
* CSS class to apply to matched text.
|
|
56
|
+
* Standard classes: qt-chat-dialogue, qt-chat-narration, qt-chat-ooc, qt-chat-inner-monologue
|
|
57
|
+
*/
|
|
58
|
+
className: string;
|
|
59
|
+
/** Optional regex flags (e.g., 'm' for multiline). Default: none */
|
|
60
|
+
flags?: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Configuration for detecting dialogue at the paragraph level.
|
|
64
|
+
*
|
|
65
|
+
* When dialogue contains markdown formatting (like **bold**), the text gets split
|
|
66
|
+
* into multiple children and inline regex patterns can't match. Paragraph-level
|
|
67
|
+
* detection checks if the entire paragraph starts and ends with quote characters.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* // Standard dialogue with straight and curly quotes
|
|
72
|
+
* {
|
|
73
|
+
* openingChars: ['"', '"'],
|
|
74
|
+
* closingChars: ['"', '"'],
|
|
75
|
+
* className: 'qt-chat-dialogue'
|
|
76
|
+
* }
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
interface DialogueDetection {
|
|
80
|
+
/** Opening quote characters to detect (e.g., ['"', '"']) */
|
|
81
|
+
openingChars: string[];
|
|
82
|
+
/** Closing quote characters to detect (e.g., ['"', '"']) */
|
|
83
|
+
closingChars: string[];
|
|
84
|
+
/** CSS class to apply to dialogue paragraphs */
|
|
85
|
+
className: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Narration delimiters define how narration/action text is marked in roleplay output.
|
|
89
|
+
* Required for all roleplay templates.
|
|
90
|
+
*
|
|
91
|
+
* - A single string means the same character is used for opening and closing (e.g., '*')
|
|
92
|
+
* - A tuple of two strings means different opening and closing delimiters (e.g., ['[', ']'])
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```typescript
|
|
96
|
+
* // Single asterisk for both open and close
|
|
97
|
+
* narrationDelimiters: '*'
|
|
98
|
+
*
|
|
99
|
+
* // Square brackets with different open/close
|
|
100
|
+
* narrationDelimiters: ['[', ']']
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
type NarrationDelimiters = string | [string, string];
|
|
104
|
+
/**
|
|
105
|
+
* Configuration for a single roleplay template
|
|
106
|
+
*
|
|
107
|
+
* A roleplay template defines a formatting protocol for AI responses,
|
|
108
|
+
* such as how dialogue, actions, thoughts, and OOC comments should be formatted.
|
|
109
|
+
*/
|
|
110
|
+
interface RoleplayTemplateConfig {
|
|
111
|
+
/** Display name for the template */
|
|
112
|
+
name: string;
|
|
113
|
+
/** Optional description explaining the template's formatting style */
|
|
114
|
+
description?: string;
|
|
115
|
+
/**
|
|
116
|
+
* The system prompt that defines the formatting rules.
|
|
117
|
+
* This is prepended to character system prompts when the template is active.
|
|
118
|
+
*/
|
|
119
|
+
systemPrompt: string;
|
|
120
|
+
/** Tags for categorization and searchability */
|
|
121
|
+
tags?: string[];
|
|
122
|
+
/**
|
|
123
|
+
* Annotation buttons for the formatting toolbar.
|
|
124
|
+
* Defines which formatting options are available when document editing mode is enabled.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* annotationButtons: [
|
|
129
|
+
* { label: 'Narration', abbrev: 'Nar', prefix: '[', suffix: ']' },
|
|
130
|
+
* { label: 'Internal Monologue', abbrev: 'Int', prefix: '{', suffix: '}' },
|
|
131
|
+
* { label: 'Out of Character', abbrev: 'OOC', prefix: '// ', suffix: '' },
|
|
132
|
+
* ]
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
annotationButtons?: AnnotationButton[];
|
|
136
|
+
/**
|
|
137
|
+
* Patterns for styling roleplay text in message content.
|
|
138
|
+
* These patterns are matched against text nodes and wrapped in styled spans.
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```typescript
|
|
142
|
+
* renderingPatterns: [
|
|
143
|
+
* // Match *narration* with single asterisks
|
|
144
|
+
* { pattern: '(?<!\\*)\\*[^*]+\\*(?!\\*)', className: 'qt-chat-narration' },
|
|
145
|
+
* // Match ((OOC)) with double parentheses
|
|
146
|
+
* { pattern: '\\(\\([^)]+\\)\\)', className: 'qt-chat-ooc' },
|
|
147
|
+
* ]
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
renderingPatterns?: RenderingPattern[];
|
|
151
|
+
/**
|
|
152
|
+
* Optional dialogue detection for paragraph-level styling.
|
|
153
|
+
* When dialogue contains markdown formatting, inline patterns can't match.
|
|
154
|
+
* This detects paragraphs that start/end with quote characters.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```typescript
|
|
158
|
+
* dialogueDetection: {
|
|
159
|
+
* openingChars: ['"', '"'],
|
|
160
|
+
* closingChars: ['"', '"'],
|
|
161
|
+
* className: 'qt-chat-dialogue'
|
|
162
|
+
* }
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
dialogueDetection?: DialogueDetection;
|
|
166
|
+
/**
|
|
167
|
+
* Narration delimiters — required for all templates.
|
|
168
|
+
* Defines how narration/action text is delimited in the template's formatting.
|
|
169
|
+
*
|
|
170
|
+
* A single string means the same delimiter is used for opening and closing (e.g., '*').
|
|
171
|
+
* A tuple of two strings means different opening and closing delimiters (e.g., ['[', ']']).
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```typescript
|
|
175
|
+
* // Standard: *narration*
|
|
176
|
+
* narrationDelimiters: '*'
|
|
177
|
+
*
|
|
178
|
+
* // Quilltap RP: [narration]
|
|
179
|
+
* narrationDelimiters: ['[', ']']
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
narrationDelimiters: NarrationDelimiters;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Metadata for a roleplay template plugin
|
|
186
|
+
*/
|
|
187
|
+
interface RoleplayTemplateMetadata {
|
|
188
|
+
/**
|
|
189
|
+
* Unique template identifier (lowercase, hyphens allowed)
|
|
190
|
+
* This is typically derived from the plugin name
|
|
191
|
+
*/
|
|
192
|
+
templateId: string;
|
|
193
|
+
/** Human-readable display name */
|
|
194
|
+
displayName: string;
|
|
195
|
+
/** Template description */
|
|
196
|
+
description?: string;
|
|
197
|
+
/** Template author */
|
|
198
|
+
author?: string | {
|
|
199
|
+
name: string;
|
|
200
|
+
email?: string;
|
|
201
|
+
url?: string;
|
|
202
|
+
};
|
|
203
|
+
/** Template tags for categorization */
|
|
204
|
+
tags?: string[];
|
|
205
|
+
/** Template version */
|
|
206
|
+
version?: string;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Main Roleplay Template Plugin Interface
|
|
210
|
+
*
|
|
211
|
+
* Plugins implementing this interface can be dynamically loaded
|
|
212
|
+
* by Quilltap to provide custom roleplay formatting templates.
|
|
213
|
+
*
|
|
214
|
+
* A plugin can provide one or more templates. Each template defines
|
|
215
|
+
* a unique formatting protocol for AI responses.
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```typescript
|
|
219
|
+
* import type { RoleplayTemplatePlugin } from '@quilltap/plugin-types';
|
|
220
|
+
*
|
|
221
|
+
* export const plugin: RoleplayTemplatePlugin = {
|
|
222
|
+
* metadata: {
|
|
223
|
+
* templateId: 'my-rp-format',
|
|
224
|
+
* displayName: 'My RP Format',
|
|
225
|
+
* description: 'A custom roleplay formatting style',
|
|
226
|
+
* tags: ['custom', 'roleplay'],
|
|
227
|
+
* },
|
|
228
|
+
* templates: [
|
|
229
|
+
* {
|
|
230
|
+
* name: 'My RP Format',
|
|
231
|
+
* description: 'Custom formatting with specific syntax',
|
|
232
|
+
* systemPrompt: `[FORMATTING INSTRUCTIONS]
|
|
233
|
+
* 1. Dialogue: Use quotation marks
|
|
234
|
+
* 2. Actions: Use asterisks *like this*
|
|
235
|
+
* ...`,
|
|
236
|
+
* tags: ['custom'],
|
|
237
|
+
* },
|
|
238
|
+
* ],
|
|
239
|
+
* };
|
|
240
|
+
* ```
|
|
241
|
+
*
|
|
242
|
+
* @example
|
|
243
|
+
* ```typescript
|
|
244
|
+
* // Plugin with multiple templates
|
|
245
|
+
* import type { RoleplayTemplatePlugin } from '@quilltap/plugin-types';
|
|
246
|
+
*
|
|
247
|
+
* export const plugin: RoleplayTemplatePlugin = {
|
|
248
|
+
* metadata: {
|
|
249
|
+
* templateId: 'format-pack',
|
|
250
|
+
* displayName: 'RP Format Pack',
|
|
251
|
+
* description: 'A collection of roleplay formats',
|
|
252
|
+
* },
|
|
253
|
+
* templates: [
|
|
254
|
+
* {
|
|
255
|
+
* name: 'Screenplay',
|
|
256
|
+
* systemPrompt: '...',
|
|
257
|
+
* },
|
|
258
|
+
* {
|
|
259
|
+
* name: 'Novel',
|
|
260
|
+
* systemPrompt: '...',
|
|
261
|
+
* },
|
|
262
|
+
* ],
|
|
263
|
+
* };
|
|
264
|
+
* ```
|
|
265
|
+
*/
|
|
266
|
+
interface RoleplayTemplatePlugin {
|
|
267
|
+
/** Plugin metadata for UI display and identification */
|
|
268
|
+
metadata: RoleplayTemplateMetadata;
|
|
269
|
+
/**
|
|
270
|
+
* One or more roleplay templates provided by this plugin.
|
|
271
|
+
* Each template has its own name, description, and system prompt.
|
|
272
|
+
*/
|
|
273
|
+
templates: RoleplayTemplateConfig[];
|
|
274
|
+
/**
|
|
275
|
+
* Optional initialization function
|
|
276
|
+
* Called when the plugin is loaded
|
|
277
|
+
*/
|
|
278
|
+
initialize?: () => void | Promise<void>;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Standard export type for roleplay template plugins
|
|
282
|
+
*/
|
|
283
|
+
interface RoleplayTemplatePluginExport {
|
|
284
|
+
/** The roleplay template plugin instance */
|
|
285
|
+
plugin: RoleplayTemplatePlugin;
|
|
286
|
+
}
|
|
287
|
+
|
|
7
288
|
/**
|
|
8
289
|
* System Prompt Plugin Interface types for Quilltap plugin development
|
|
9
290
|
*
|
|
@@ -373,4 +654,4 @@ interface ToolPluginExport {
|
|
|
373
654
|
*/
|
|
374
655
|
declare const PLUGIN_TYPES_VERSION = "2.0.0";
|
|
375
656
|
|
|
376
|
-
export { PLUGIN_TYPES_VERSION, type SystemPromptData, type SystemPromptMetadata, type SystemPromptPlugin, type SystemPromptPluginExport, type ToolExecutionContext, type ToolExecutionResult, type ToolHierarchyInfo, type ToolMetadata, type ToolPlugin, type ToolPluginExport, UniversalTool };
|
|
657
|
+
export { type NarrationDelimiters, PLUGIN_TYPES_VERSION, type RoleplayTemplateConfig, type RoleplayTemplateMetadata, type RoleplayTemplatePlugin, type RoleplayTemplatePluginExport, type SystemPromptData, type SystemPromptMetadata, type SystemPromptPlugin, type SystemPromptPluginExport, type ToolExecutionContext, type ToolExecutionResult, type ToolHierarchyInfo, type ToolMetadata, type ToolPlugin, type ToolPluginExport, UniversalTool };
|