@quilltap/plugin-utils 2.0.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 -120
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -115
- package/dist/index.mjs.map +1 -1
- package/dist/roleplay-templates/index.d.mts +6 -1
- package/dist/roleplay-templates/index.d.ts +6 -1
- package/dist/roleplay-templates/index.js +20 -1
- package/dist/roleplay-templates/index.js.map +1 -1
- package/dist/roleplay-templates/index.mjs +20 -1
- package/dist/roleplay-templates/index.mjs.map +1 -1
- package/package.json +6 -11
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,116 +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
|
-
version,
|
|
733
|
-
initialize,
|
|
734
|
-
enableLogging
|
|
735
|
-
} = options;
|
|
736
|
-
return createRoleplayTemplatePlugin({
|
|
737
|
-
metadata: {
|
|
738
|
-
templateId,
|
|
739
|
-
displayName,
|
|
740
|
-
description,
|
|
741
|
-
author,
|
|
742
|
-
tags,
|
|
743
|
-
version
|
|
744
|
-
},
|
|
745
|
-
templates: {
|
|
746
|
-
name: displayName,
|
|
747
|
-
description,
|
|
748
|
-
systemPrompt,
|
|
749
|
-
tags
|
|
750
|
-
},
|
|
751
|
-
initialize,
|
|
752
|
-
enableLogging
|
|
753
|
-
});
|
|
754
|
-
}
|
|
755
|
-
function validateTemplateConfig(template) {
|
|
756
|
-
if (!template.name || template.name.trim() === "") {
|
|
757
|
-
throw new Error("Template name is required");
|
|
758
|
-
}
|
|
759
|
-
if (template.name.length > 100) {
|
|
760
|
-
throw new Error("Template name must be 100 characters or less");
|
|
761
|
-
}
|
|
762
|
-
if (!template.systemPrompt || template.systemPrompt.trim() === "") {
|
|
763
|
-
throw new Error("Template systemPrompt is required");
|
|
764
|
-
}
|
|
765
|
-
if (template.description && template.description.length > 500) {
|
|
766
|
-
throw new Error("Template description must be 500 characters or less");
|
|
767
|
-
}
|
|
768
|
-
if (template.tags) {
|
|
769
|
-
if (!Array.isArray(template.tags)) {
|
|
770
|
-
throw new Error("Template tags must be an array");
|
|
771
|
-
}
|
|
772
|
-
for (const tag of template.tags) {
|
|
773
|
-
if (typeof tag !== "string") {
|
|
774
|
-
throw new Error("All tags must be strings");
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
return true;
|
|
779
|
-
}
|
|
780
|
-
function validateRoleplayTemplatePlugin(plugin) {
|
|
781
|
-
if (!plugin.metadata) {
|
|
782
|
-
throw new Error("Plugin metadata is required");
|
|
783
|
-
}
|
|
784
|
-
if (!plugin.metadata.templateId || plugin.metadata.templateId.trim() === "") {
|
|
785
|
-
throw new Error("Plugin metadata.templateId is required");
|
|
786
|
-
}
|
|
787
|
-
if (!/^[a-z0-9-]+$/.test(plugin.metadata.templateId)) {
|
|
788
|
-
throw new Error("Plugin templateId must be lowercase alphanumeric with hyphens only");
|
|
789
|
-
}
|
|
790
|
-
if (!plugin.metadata.displayName || plugin.metadata.displayName.trim() === "") {
|
|
791
|
-
throw new Error("Plugin metadata.displayName is required");
|
|
792
|
-
}
|
|
793
|
-
if (!plugin.templates || !Array.isArray(plugin.templates) || plugin.templates.length === 0) {
|
|
794
|
-
throw new Error("Plugin must have at least one template");
|
|
795
|
-
}
|
|
796
|
-
for (const template of plugin.templates) {
|
|
797
|
-
validateTemplateConfig(template);
|
|
798
|
-
}
|
|
799
|
-
return true;
|
|
800
|
-
}
|
|
801
|
-
|
|
802
688
|
// src/system-prompts/builder.ts
|
|
803
689
|
function createSystemPromptPlugin(options) {
|
|
804
690
|
const { metadata, prompts, initialize } = options;
|
|
@@ -1043,8 +929,6 @@ var PLUGIN_UTILS_VERSION = "1.7.0";
|
|
|
1043
929
|
createConsoleLogger,
|
|
1044
930
|
createNoopLogger,
|
|
1045
931
|
createPluginLogger,
|
|
1046
|
-
createRoleplayTemplatePlugin,
|
|
1047
|
-
createSingleTemplatePlugin,
|
|
1048
932
|
createSystemPromptPlugin,
|
|
1049
933
|
detectToolCallFormat,
|
|
1050
934
|
getBuiltinToolNames,
|
|
@@ -1060,8 +944,6 @@ var PLUGIN_UTILS_VERSION = "1.7.0";
|
|
|
1060
944
|
parseToolCalls,
|
|
1061
945
|
resolveHostGateway,
|
|
1062
946
|
rewriteLocalhostUrl,
|
|
1063
|
-
|
|
1064
|
-
validateSystemPromptPlugin,
|
|
1065
|
-
validateTemplateConfig
|
|
947
|
+
validateSystemPromptPlugin
|
|
1066
948
|
});
|
|
1067
949
|
//# sourceMappingURL=index.js.map
|