@quilltap/plugin-utils 2.1.0 → 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 +9 -0
- package/README.md +0 -55
- package/dist/index.d.mts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +2 -139
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -134
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to @quilltap/plugin-utils will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [2.2.0] - 2026-04-09
|
|
6
|
+
|
|
7
|
+
### Removed
|
|
8
|
+
|
|
9
|
+
- **Breaking:** Removed roleplay template utilities from main exports — `createRoleplayTemplatePlugin`, `createSingleTemplatePlugin`, `validateTemplateConfig`, `validateRoleplayTemplatePlugin` are no longer exported
|
|
10
|
+
- Removed `./roleplay-templates` export path from package.json
|
|
11
|
+
- Roleplay templates are now native first-class entities in Quilltap v4.2.0, no plugin needed
|
|
12
|
+
- Updated `@quilltap/plugin-types` dependency to `^2.2.0`
|
|
13
|
+
|
|
5
14
|
## [1.4.0] - 2026-02-25
|
|
6
15
|
|
|
7
16
|
### Added
|
package/README.md
CHANGED
|
@@ -150,61 +150,6 @@ This gives you a complete `LLMProvider` implementation with:
|
|
|
150
150
|
npm install openai
|
|
151
151
|
```
|
|
152
152
|
|
|
153
|
-
### Roleplay Template Plugin Utilities
|
|
154
|
-
|
|
155
|
-
Create roleplay template plugins with built-in validation and logging:
|
|
156
|
-
|
|
157
|
-
```typescript
|
|
158
|
-
import { createSingleTemplatePlugin } from '@quilltap/plugin-utils';
|
|
159
|
-
|
|
160
|
-
// Simple single-template plugin
|
|
161
|
-
export const plugin = createSingleTemplatePlugin({
|
|
162
|
-
templateId: 'my-rp-format',
|
|
163
|
-
displayName: 'My RP Format',
|
|
164
|
-
description: 'A custom roleplay formatting style',
|
|
165
|
-
systemPrompt: `[FORMATTING INSTRUCTIONS]
|
|
166
|
-
1. DIALOGUE: Use quotation marks
|
|
167
|
-
2. ACTIONS: Use asterisks *like this*
|
|
168
|
-
3. THOUGHTS: Use angle brackets <like this>`,
|
|
169
|
-
tags: ['custom', 'roleplay'],
|
|
170
|
-
enableLogging: true,
|
|
171
|
-
});
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
For plugins providing multiple templates:
|
|
175
|
-
|
|
176
|
-
```typescript
|
|
177
|
-
import { createRoleplayTemplatePlugin } from '@quilltap/plugin-utils';
|
|
178
|
-
|
|
179
|
-
export const plugin = createRoleplayTemplatePlugin({
|
|
180
|
-
metadata: {
|
|
181
|
-
templateId: 'rp-format-pack',
|
|
182
|
-
displayName: 'RP Format Pack',
|
|
183
|
-
description: 'A collection of roleplay formats',
|
|
184
|
-
},
|
|
185
|
-
templates: [
|
|
186
|
-
{
|
|
187
|
-
name: 'Screenplay',
|
|
188
|
-
description: 'Screenplay-style formatting',
|
|
189
|
-
systemPrompt: '...',
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
name: 'Novel',
|
|
193
|
-
description: 'Novel-style prose',
|
|
194
|
-
systemPrompt: '...',
|
|
195
|
-
},
|
|
196
|
-
],
|
|
197
|
-
enableLogging: true,
|
|
198
|
-
});
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
| Function | Description |
|
|
202
|
-
|----------|-------------|
|
|
203
|
-
| `createRoleplayTemplatePlugin(options)` | Create a plugin with full control over metadata and templates |
|
|
204
|
-
| `createSingleTemplatePlugin(options)` | Simplified helper for plugins with a single template |
|
|
205
|
-
| `validateTemplateConfig(template)` | Validate an individual template configuration |
|
|
206
|
-
| `validateRoleplayTemplatePlugin(plugin)` | Validate a complete roleplay template plugin |
|
|
207
|
-
|
|
208
153
|
### System Prompt Plugin Utilities
|
|
209
154
|
|
|
210
155
|
Create system prompt plugins that provide character prompt templates from `.md` files:
|
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,6 @@ export { AnthropicToolDefinition, GoogleToolDefinition, LogContext, LogLevel, Op
|
|
|
2
2
|
export { T as ToolCallFormat, a as ToolConvertTarget, b as applyDescriptionLimit, c as convertFromAnthropicFormat, d as convertFromGoogleFormat, e as convertOpenAIToAnthropicFormat, f as convertOpenAIToGoogleFormat, g as convertToAnthropicFormat, h as convertToGoogleFormat, i as convertToolTo, j as convertToolsTo, k as detectToolCallFormat, l as hasToolCalls, p as parseAnthropicToolCalls, m as parseGoogleToolCalls, n as parseOpenAIToolCalls, o as parseToolCalls } from './converters-BPYo8xdH.mjs';
|
|
3
3
|
export { PluginLoggerWithChild, __clearCoreLoggerFactory, __injectCoreLoggerFactory, createPluginLogger, getLogLevelFromEnv, hasCoreLogger } from './logging/index.mjs';
|
|
4
4
|
export { OpenAICompatibleProvider, OpenAICompatibleProviderConfig } from './providers/index.mjs';
|
|
5
|
-
export { CreateRoleplayTemplatePluginOptions, CreateSingleTemplatePluginOptions, createRoleplayTemplatePlugin, createSingleTemplatePlugin, validateRoleplayTemplatePlugin, validateTemplateConfig } from './roleplay-templates/index.mjs';
|
|
6
5
|
export { CreateSystemPromptPluginOptions, createSystemPromptPlugin, validateSystemPromptPlugin } from './system-prompts/index.mjs';
|
|
7
6
|
export { isVMEnvironment, resolveHostGateway, rewriteLocalhostUrl } from './host-rewrite.mjs';
|
|
8
7
|
import 'openai';
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export { AnthropicToolDefinition, GoogleToolDefinition, LogContext, LogLevel, Op
|
|
|
2
2
|
export { T as ToolCallFormat, a as ToolConvertTarget, b as applyDescriptionLimit, c as convertFromAnthropicFormat, d as convertFromGoogleFormat, e as convertOpenAIToAnthropicFormat, f as convertOpenAIToGoogleFormat, g as convertToAnthropicFormat, h as convertToGoogleFormat, i as convertToolTo, j as convertToolsTo, k as detectToolCallFormat, l as hasToolCalls, p as parseAnthropicToolCalls, m as parseGoogleToolCalls, n as parseOpenAIToolCalls, o as parseToolCalls } from './converters-BPYo8xdH.js';
|
|
3
3
|
export { PluginLoggerWithChild, __clearCoreLoggerFactory, __injectCoreLoggerFactory, createPluginLogger, getLogLevelFromEnv, hasCoreLogger } from './logging/index.js';
|
|
4
4
|
export { OpenAICompatibleProvider, OpenAICompatibleProviderConfig } from './providers/index.js';
|
|
5
|
-
export { CreateRoleplayTemplatePluginOptions, CreateSingleTemplatePluginOptions, createRoleplayTemplatePlugin, createSingleTemplatePlugin, validateRoleplayTemplatePlugin, validateTemplateConfig } from './roleplay-templates/index.js';
|
|
6
5
|
export { CreateSystemPromptPluginOptions, createSystemPromptPlugin, validateSystemPromptPlugin } from './system-prompts/index.js';
|
|
7
6
|
export { isVMEnvironment, resolveHostGateway, rewriteLocalhostUrl } from './host-rewrite.js';
|
|
8
7
|
import 'openai';
|
package/dist/index.js
CHANGED
|
@@ -49,8 +49,6 @@ __export(src_exports, {
|
|
|
49
49
|
createConsoleLogger: () => import_plugin_types.createConsoleLogger,
|
|
50
50
|
createNoopLogger: () => import_plugin_types.createNoopLogger,
|
|
51
51
|
createPluginLogger: () => createPluginLogger,
|
|
52
|
-
createRoleplayTemplatePlugin: () => createRoleplayTemplatePlugin,
|
|
53
|
-
createSingleTemplatePlugin: () => createSingleTemplatePlugin,
|
|
54
52
|
createSystemPromptPlugin: () => createSystemPromptPlugin,
|
|
55
53
|
detectToolCallFormat: () => detectToolCallFormat,
|
|
56
54
|
getBuiltinToolNames: () => getBuiltinToolNames,
|
|
@@ -66,9 +64,7 @@ __export(src_exports, {
|
|
|
66
64
|
parseToolCalls: () => parseToolCalls,
|
|
67
65
|
resolveHostGateway: () => resolveHostGateway,
|
|
68
66
|
rewriteLocalhostUrl: () => rewriteLocalhostUrl,
|
|
69
|
-
|
|
70
|
-
validateSystemPromptPlugin: () => validateSystemPromptPlugin,
|
|
71
|
-
validateTemplateConfig: () => validateTemplateConfig
|
|
67
|
+
validateSystemPromptPlugin: () => validateSystemPromptPlugin
|
|
72
68
|
});
|
|
73
69
|
module.exports = __toCommonJS(src_exports);
|
|
74
70
|
|
|
@@ -689,135 +685,6 @@ var OpenAICompatibleProvider = class {
|
|
|
689
685
|
}
|
|
690
686
|
};
|
|
691
687
|
|
|
692
|
-
// src/roleplay-templates/builder.ts
|
|
693
|
-
function createRoleplayTemplatePlugin(options) {
|
|
694
|
-
const { metadata, templates, initialize, enableLogging: _enableLogging = false } = options;
|
|
695
|
-
const templateArray = Array.isArray(templates) ? templates : [templates];
|
|
696
|
-
if (templateArray.length === 0) {
|
|
697
|
-
throw new Error("At least one template is required");
|
|
698
|
-
}
|
|
699
|
-
for (const template of templateArray) {
|
|
700
|
-
if (!template.name || template.name.trim() === "") {
|
|
701
|
-
throw new Error("Template name is required");
|
|
702
|
-
}
|
|
703
|
-
if (!template.systemPrompt || template.systemPrompt.trim() === "") {
|
|
704
|
-
throw new Error(`Template "${template.name}" requires a systemPrompt`);
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
const plugin = {
|
|
708
|
-
metadata: {
|
|
709
|
-
...metadata,
|
|
710
|
-
// Ensure tags from templates are included in metadata if not already set
|
|
711
|
-
tags: metadata.tags ?? Array.from(
|
|
712
|
-
new Set(templateArray.flatMap((t) => t.tags ?? []))
|
|
713
|
-
)
|
|
714
|
-
},
|
|
715
|
-
templates: templateArray
|
|
716
|
-
};
|
|
717
|
-
if (initialize) {
|
|
718
|
-
plugin.initialize = async () => {
|
|
719
|
-
await initialize();
|
|
720
|
-
};
|
|
721
|
-
}
|
|
722
|
-
return plugin;
|
|
723
|
-
}
|
|
724
|
-
function createSingleTemplatePlugin(options) {
|
|
725
|
-
const {
|
|
726
|
-
templateId,
|
|
727
|
-
displayName,
|
|
728
|
-
description,
|
|
729
|
-
systemPrompt,
|
|
730
|
-
author,
|
|
731
|
-
tags,
|
|
732
|
-
narrationDelimiters,
|
|
733
|
-
version,
|
|
734
|
-
initialize,
|
|
735
|
-
enableLogging
|
|
736
|
-
} = options;
|
|
737
|
-
return createRoleplayTemplatePlugin({
|
|
738
|
-
metadata: {
|
|
739
|
-
templateId,
|
|
740
|
-
displayName,
|
|
741
|
-
description,
|
|
742
|
-
author,
|
|
743
|
-
tags,
|
|
744
|
-
version
|
|
745
|
-
},
|
|
746
|
-
templates: {
|
|
747
|
-
name: displayName,
|
|
748
|
-
description,
|
|
749
|
-
systemPrompt,
|
|
750
|
-
tags,
|
|
751
|
-
narrationDelimiters
|
|
752
|
-
},
|
|
753
|
-
initialize,
|
|
754
|
-
enableLogging
|
|
755
|
-
});
|
|
756
|
-
}
|
|
757
|
-
function validateTemplateConfig(template) {
|
|
758
|
-
if (!template.name || template.name.trim() === "") {
|
|
759
|
-
throw new Error("Template name is required");
|
|
760
|
-
}
|
|
761
|
-
if (template.name.length > 100) {
|
|
762
|
-
throw new Error("Template name must be 100 characters or less");
|
|
763
|
-
}
|
|
764
|
-
if (!template.systemPrompt || template.systemPrompt.trim() === "") {
|
|
765
|
-
throw new Error("Template systemPrompt is required");
|
|
766
|
-
}
|
|
767
|
-
if (template.description && template.description.length > 500) {
|
|
768
|
-
throw new Error("Template description must be 500 characters or less");
|
|
769
|
-
}
|
|
770
|
-
if (template.tags) {
|
|
771
|
-
if (!Array.isArray(template.tags)) {
|
|
772
|
-
throw new Error("Template tags must be an array");
|
|
773
|
-
}
|
|
774
|
-
for (const tag of template.tags) {
|
|
775
|
-
if (typeof tag !== "string") {
|
|
776
|
-
throw new Error("All tags must be strings");
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
if (!template.narrationDelimiters) {
|
|
781
|
-
throw new Error("Template narrationDelimiters is required");
|
|
782
|
-
}
|
|
783
|
-
if (typeof template.narrationDelimiters === "string") {
|
|
784
|
-
if (template.narrationDelimiters.length === 0) {
|
|
785
|
-
throw new Error("Template narrationDelimiters string must not be empty");
|
|
786
|
-
}
|
|
787
|
-
} else if (Array.isArray(template.narrationDelimiters)) {
|
|
788
|
-
if (template.narrationDelimiters.length !== 2) {
|
|
789
|
-
throw new Error("Template narrationDelimiters array must have exactly 2 elements [open, close]");
|
|
790
|
-
}
|
|
791
|
-
if (!template.narrationDelimiters[0] || !template.narrationDelimiters[1]) {
|
|
792
|
-
throw new Error("Template narrationDelimiters array elements must not be empty");
|
|
793
|
-
}
|
|
794
|
-
} else {
|
|
795
|
-
throw new Error("Template narrationDelimiters must be a string or [string, string] tuple");
|
|
796
|
-
}
|
|
797
|
-
return true;
|
|
798
|
-
}
|
|
799
|
-
function validateRoleplayTemplatePlugin(plugin) {
|
|
800
|
-
if (!plugin.metadata) {
|
|
801
|
-
throw new Error("Plugin metadata is required");
|
|
802
|
-
}
|
|
803
|
-
if (!plugin.metadata.templateId || plugin.metadata.templateId.trim() === "") {
|
|
804
|
-
throw new Error("Plugin metadata.templateId is required");
|
|
805
|
-
}
|
|
806
|
-
if (!/^[a-z0-9-]+$/.test(plugin.metadata.templateId)) {
|
|
807
|
-
throw new Error("Plugin templateId must be lowercase alphanumeric with hyphens only");
|
|
808
|
-
}
|
|
809
|
-
if (!plugin.metadata.displayName || plugin.metadata.displayName.trim() === "") {
|
|
810
|
-
throw new Error("Plugin metadata.displayName is required");
|
|
811
|
-
}
|
|
812
|
-
if (!plugin.templates || !Array.isArray(plugin.templates) || plugin.templates.length === 0) {
|
|
813
|
-
throw new Error("Plugin must have at least one template");
|
|
814
|
-
}
|
|
815
|
-
for (const template of plugin.templates) {
|
|
816
|
-
validateTemplateConfig(template);
|
|
817
|
-
}
|
|
818
|
-
return true;
|
|
819
|
-
}
|
|
820
|
-
|
|
821
688
|
// src/system-prompts/builder.ts
|
|
822
689
|
function createSystemPromptPlugin(options) {
|
|
823
690
|
const { metadata, prompts, initialize } = options;
|
|
@@ -1062,8 +929,6 @@ var PLUGIN_UTILS_VERSION = "1.7.0";
|
|
|
1062
929
|
createConsoleLogger,
|
|
1063
930
|
createNoopLogger,
|
|
1064
931
|
createPluginLogger,
|
|
1065
|
-
createRoleplayTemplatePlugin,
|
|
1066
|
-
createSingleTemplatePlugin,
|
|
1067
932
|
createSystemPromptPlugin,
|
|
1068
933
|
detectToolCallFormat,
|
|
1069
934
|
getBuiltinToolNames,
|
|
@@ -1079,8 +944,6 @@ var PLUGIN_UTILS_VERSION = "1.7.0";
|
|
|
1079
944
|
parseToolCalls,
|
|
1080
945
|
resolveHostGateway,
|
|
1081
946
|
rewriteLocalhostUrl,
|
|
1082
|
-
|
|
1083
|
-
validateSystemPromptPlugin,
|
|
1084
|
-
validateTemplateConfig
|
|
947
|
+
validateSystemPromptPlugin
|
|
1085
948
|
});
|
|
1086
949
|
//# sourceMappingURL=index.js.map
|