@quilltap/plugin-types 1.15.0 → 1.16.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/dist/{index-BmwJBg_D.d.mts → index-BGXq7dpd.d.mts} +169 -5
- package/dist/{index-XZ8WkWjp.d.ts → index-CeYb2BY9.d.ts} +169 -5
- package/dist/index.d.mts +3 -313
- package/dist/index.d.ts +3 -313
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +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 +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.15.1] - 2026-02-23
|
|
9
|
+
|
|
10
|
+
### Removed
|
|
11
|
+
|
|
12
|
+
- **Breaking:** Removed `FILE_BACKEND` / `STORAGE_BACKEND` plugin capability and `STORAGE` plugin category
|
|
13
|
+
- Removed all file-storage plugin types: `FileBackendCapabilities`, `FileBackendMetadata`, `FileMetadata`, `FileStorageBackend`, `FileStorageConfigField`, `FileStorageProviderPlugin`, `FileStoragePluginExport`
|
|
14
|
+
- Removed `FILE_BACKEND` from the `requiresRestart` inference list in `PluginManifest`
|
|
15
|
+
|
|
8
16
|
## [1.14.0] - 2026-02-10
|
|
9
17
|
|
|
10
18
|
### Added
|
|
@@ -459,11 +459,11 @@ interface ProviderPluginExport {
|
|
|
459
459
|
/**
|
|
460
460
|
* Plugin capability types
|
|
461
461
|
*/
|
|
462
|
-
type PluginCapability = 'LLM_PROVIDER' | 'AUTH_PROVIDER' | '
|
|
462
|
+
type PluginCapability = 'LLM_PROVIDER' | 'AUTH_PROVIDER' | 'THEME' | 'ROLEPLAY_TEMPLATE' | 'TOOL_PROVIDER' | 'SEARCH_PROVIDER' | 'MODERATION_PROVIDER' | 'UTILITY';
|
|
463
463
|
/**
|
|
464
464
|
* Plugin category
|
|
465
465
|
*/
|
|
466
|
-
type PluginCategory = 'PROVIDER' | 'AUTH' | '
|
|
466
|
+
type PluginCategory = 'PROVIDER' | 'AUTH' | 'UI' | 'TEMPLATE' | 'TOOLS' | 'UTILITY';
|
|
467
467
|
/**
|
|
468
468
|
* Plugin status
|
|
469
469
|
*/
|
|
@@ -532,6 +532,33 @@ interface ProviderConfig {
|
|
|
532
532
|
description: string;
|
|
533
533
|
};
|
|
534
534
|
}
|
|
535
|
+
/**
|
|
536
|
+
* Moderation provider-specific configuration (for MODERATION_PROVIDER plugins)
|
|
537
|
+
*/
|
|
538
|
+
interface ModerationProviderConfig {
|
|
539
|
+
/** Internal provider name (e.g., 'OPENAI') */
|
|
540
|
+
providerName: string;
|
|
541
|
+
/** Human-readable display name */
|
|
542
|
+
displayName: string;
|
|
543
|
+
/** Provider description */
|
|
544
|
+
description: string;
|
|
545
|
+
/** Short abbreviation (2-4 chars) */
|
|
546
|
+
abbreviation: string;
|
|
547
|
+
/** UI color configuration */
|
|
548
|
+
colors: {
|
|
549
|
+
bg: string;
|
|
550
|
+
text: string;
|
|
551
|
+
icon: string;
|
|
552
|
+
};
|
|
553
|
+
/** Whether the provider requires an API key */
|
|
554
|
+
requiresApiKey: boolean;
|
|
555
|
+
/** Label for API key input */
|
|
556
|
+
apiKeyLabel?: string;
|
|
557
|
+
/** Whether the provider requires a base URL */
|
|
558
|
+
requiresBaseUrl: boolean;
|
|
559
|
+
/** Default base URL */
|
|
560
|
+
baseUrlDefault?: string;
|
|
561
|
+
}
|
|
535
562
|
/**
|
|
536
563
|
* Search provider-specific configuration (for SEARCH_PROVIDER plugins)
|
|
537
564
|
*/
|
|
@@ -617,6 +644,8 @@ interface PluginManifest {
|
|
|
617
644
|
providerConfig?: ProviderConfig;
|
|
618
645
|
/** Search provider configuration (for SEARCH_PROVIDER plugins) */
|
|
619
646
|
searchProviderConfig?: SearchProviderConfig;
|
|
647
|
+
/** Moderation provider configuration (for MODERATION_PROVIDER plugins) */
|
|
648
|
+
moderationProviderConfig?: ModerationProviderConfig;
|
|
620
649
|
/** Required permissions */
|
|
621
650
|
permissions?: PluginPermissions;
|
|
622
651
|
/** Repository URL */
|
|
@@ -636,7 +665,7 @@ interface PluginManifest {
|
|
|
636
665
|
* Whether this plugin requires a server restart to activate.
|
|
637
666
|
*
|
|
638
667
|
* If not specified, this is inferred from capabilities:
|
|
639
|
-
* - AUTH_METHODS, DATABASE_BACKEND,
|
|
668
|
+
* - AUTH_METHODS, DATABASE_BACKEND, UPGRADE_MIGRATION → requires restart
|
|
640
669
|
*
|
|
641
670
|
* Set explicitly to override the inferred value.
|
|
642
671
|
*/
|
|
@@ -1005,7 +1034,7 @@ interface ThemePlugin {
|
|
|
1005
1034
|
* Allows a theme to rename, re-describe, or re-image any of the
|
|
1006
1035
|
* Foundry subsystem pages. Keys are subsystem IDs:
|
|
1007
1036
|
* 'foundry' | 'aurora' | 'forge' | 'salon' | 'commonplace-book' |
|
|
1008
|
-
* 'prospero' | 'dangermouse' | 'calliope' | 'lantern'
|
|
1037
|
+
* 'prospero' | 'dangermouse' | 'calliope' | 'lantern' | 'pascal' | 'saquel'
|
|
1009
1038
|
*/
|
|
1010
1039
|
subsystems?: Partial<Record<string, SubsystemOverrides>>;
|
|
1011
1040
|
/**
|
|
@@ -1429,4 +1458,139 @@ interface SearchProviderPluginExport {
|
|
|
1429
1458
|
plugin: SearchProviderPlugin;
|
|
1430
1459
|
}
|
|
1431
1460
|
|
|
1432
|
-
|
|
1461
|
+
/**
|
|
1462
|
+
* Moderation Provider Plugin types for Quilltap plugin development
|
|
1463
|
+
*
|
|
1464
|
+
* Defines the interfaces and types needed to create pluggable content
|
|
1465
|
+
* moderation backends as Quilltap plugins (e.g., OpenAI moderation endpoint).
|
|
1466
|
+
*
|
|
1467
|
+
* @module @quilltap/plugin-types/plugins/moderation-provider
|
|
1468
|
+
*/
|
|
1469
|
+
/**
|
|
1470
|
+
* Moderation provider metadata for UI display and identification
|
|
1471
|
+
*/
|
|
1472
|
+
interface ModerationProviderMetadata {
|
|
1473
|
+
/** Internal identifier for the moderation provider (e.g., 'OPENAI') */
|
|
1474
|
+
providerName: string;
|
|
1475
|
+
/** Human-readable display name for UI (e.g., 'OpenAI Moderation') */
|
|
1476
|
+
displayName: string;
|
|
1477
|
+
/** Short description of the moderation provider */
|
|
1478
|
+
description: string;
|
|
1479
|
+
/** Short abbreviation for icon display (e.g., 'OAI') */
|
|
1480
|
+
abbreviation: string;
|
|
1481
|
+
/** Tailwind CSS color classes for UI styling */
|
|
1482
|
+
colors: {
|
|
1483
|
+
/** Background color class (e.g., 'bg-green-100') */
|
|
1484
|
+
bg: string;
|
|
1485
|
+
/** Text color class (e.g., 'text-green-800') */
|
|
1486
|
+
text: string;
|
|
1487
|
+
/** Icon color class (e.g., 'text-green-600') */
|
|
1488
|
+
icon: string;
|
|
1489
|
+
};
|
|
1490
|
+
}
|
|
1491
|
+
/**
|
|
1492
|
+
* Configuration requirements for a moderation provider
|
|
1493
|
+
*/
|
|
1494
|
+
interface ModerationProviderConfigRequirements {
|
|
1495
|
+
/** Whether this moderation provider requires an API key */
|
|
1496
|
+
requiresApiKey: boolean;
|
|
1497
|
+
/** Label text for API key input field */
|
|
1498
|
+
apiKeyLabel?: string;
|
|
1499
|
+
/** Whether this moderation provider requires a custom base URL */
|
|
1500
|
+
requiresBaseUrl: boolean;
|
|
1501
|
+
/** Default value for base URL (if applicable) */
|
|
1502
|
+
baseUrlDefault?: string;
|
|
1503
|
+
}
|
|
1504
|
+
/**
|
|
1505
|
+
* A single moderation category result
|
|
1506
|
+
*
|
|
1507
|
+
* Categories are provider-specific (e.g., OpenAI returns 'hate', 'sexual',
|
|
1508
|
+
* 'violence', etc.; other providers may return different categories).
|
|
1509
|
+
*/
|
|
1510
|
+
interface ModerationCategoryResult {
|
|
1511
|
+
/** Category name as returned by the provider (e.g., 'sexual', 'violence', 'hate') */
|
|
1512
|
+
category: string;
|
|
1513
|
+
/** Whether this specific category was flagged */
|
|
1514
|
+
flagged: boolean;
|
|
1515
|
+
/** Confidence score for this category (0-1) */
|
|
1516
|
+
score: number;
|
|
1517
|
+
}
|
|
1518
|
+
/**
|
|
1519
|
+
* Result from a moderation provider's content classification
|
|
1520
|
+
*
|
|
1521
|
+
* This is the generic result type returned by all moderation providers.
|
|
1522
|
+
* The categories array contains provider-specific category names and scores.
|
|
1523
|
+
* The consuming system (Dangermouse) maps these to its own category structure.
|
|
1524
|
+
*/
|
|
1525
|
+
interface ModerationResult {
|
|
1526
|
+
/** Whether the content was flagged by the moderation provider */
|
|
1527
|
+
flagged: boolean;
|
|
1528
|
+
/** Per-category breakdown with provider-specific category names */
|
|
1529
|
+
categories: ModerationCategoryResult[];
|
|
1530
|
+
}
|
|
1531
|
+
/**
|
|
1532
|
+
* Main Moderation Provider Plugin Interface
|
|
1533
|
+
*
|
|
1534
|
+
* Plugins implementing this interface provide content moderation backends
|
|
1535
|
+
* for Quilltap's Dangermouse system. The moderation provider is used
|
|
1536
|
+
* as an alternative to the Cheap LLM classification approach.
|
|
1537
|
+
*
|
|
1538
|
+
* @example
|
|
1539
|
+
* ```typescript
|
|
1540
|
+
* import type { ModerationProviderPlugin } from '@quilltap/plugin-types';
|
|
1541
|
+
*
|
|
1542
|
+
* export const moderationPlugin: ModerationProviderPlugin = {
|
|
1543
|
+
* metadata: {
|
|
1544
|
+
* providerName: 'OPENAI',
|
|
1545
|
+
* displayName: 'OpenAI Moderation',
|
|
1546
|
+
* description: 'Free content moderation via OpenAI moderation endpoint',
|
|
1547
|
+
* abbreviation: 'OAI',
|
|
1548
|
+
* colors: { bg: 'bg-green-100', text: 'text-green-800', icon: 'text-green-600' },
|
|
1549
|
+
* },
|
|
1550
|
+
* config: {
|
|
1551
|
+
* requiresApiKey: true,
|
|
1552
|
+
* apiKeyLabel: 'OpenAI API Key',
|
|
1553
|
+
* requiresBaseUrl: false,
|
|
1554
|
+
* },
|
|
1555
|
+
* moderate: async (content, apiKey) => {
|
|
1556
|
+
* // ... call moderation API ...
|
|
1557
|
+
* return { flagged: false, categories: [] };
|
|
1558
|
+
* },
|
|
1559
|
+
* };
|
|
1560
|
+
* ```
|
|
1561
|
+
*/
|
|
1562
|
+
interface ModerationProviderPlugin {
|
|
1563
|
+
/** Moderation provider metadata for UI display and identification */
|
|
1564
|
+
metadata: ModerationProviderMetadata;
|
|
1565
|
+
/** Configuration requirements for this moderation provider */
|
|
1566
|
+
config: ModerationProviderConfigRequirements;
|
|
1567
|
+
/**
|
|
1568
|
+
* Classify content for moderation
|
|
1569
|
+
*
|
|
1570
|
+
* @param content The text content to classify
|
|
1571
|
+
* @param apiKey The API key for authentication
|
|
1572
|
+
* @param baseUrl Optional base URL for the moderation API
|
|
1573
|
+
* @returns Promise resolving to moderation result with flagged status and categories
|
|
1574
|
+
*/
|
|
1575
|
+
moderate: (content: string, apiKey: string, baseUrl?: string) => Promise<ModerationResult>;
|
|
1576
|
+
/**
|
|
1577
|
+
* Validate an API key for this moderation provider (optional)
|
|
1578
|
+
*
|
|
1579
|
+
* Should test the API key by making a minimal API call to verify
|
|
1580
|
+
* that it is valid and has proper permissions.
|
|
1581
|
+
*
|
|
1582
|
+
* @param apiKey The API key to validate
|
|
1583
|
+
* @param baseUrl Optional base URL for the moderation API
|
|
1584
|
+
* @returns Promise resolving to true if valid, false otherwise
|
|
1585
|
+
*/
|
|
1586
|
+
validateApiKey?: (apiKey: string, baseUrl?: string) => Promise<boolean>;
|
|
1587
|
+
}
|
|
1588
|
+
/**
|
|
1589
|
+
* Standard export type for moderation provider plugins
|
|
1590
|
+
*/
|
|
1591
|
+
interface ModerationProviderPluginExport {
|
|
1592
|
+
/** The moderation provider plugin instance */
|
|
1593
|
+
moderationPlugin: ModerationProviderPlugin;
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
export type { AnnotationButton as $, AttachmentSupport as A, RoleplayTemplateMetadata as B, CheapModelConfig as C, RoleplayTemplatePlugin as D, Effects as E, FontDefinition as F, RoleplayTemplatePluginExport as G, SearchProviderConfig as H, IconProps as I, SearchProviderConfigRequirements as J, SearchProviderMetadata as K, LLMProviderPlugin as L, MessageFormatSupport as M, SearchProviderPlugin as N, SearchProviderPluginExport as O, PluginAuthor as P, SearchResult as Q, RoleplayTemplateConfig as R, SearchOutput as S, Spacing as T, SubsystemOverrides as U, ThemeMetadata as V, ThemePlugin as W, ThemePluginExport as X, ThemeTokens as Y, ToolFormatType as Z, Typography as _, ColorPalette as a, DialogueDetection as a0, ModerationProviderConfig as a1, RenderingPattern as a2, EmbeddedFont as b, EmbeddingModelInfo as c, ImageGenerationModelInfo as d, ImageProviderConstraints as e, ImageStyleInfo as f, InstalledPluginInfo as g, ModelInfo as h, ModerationCategoryResult as i, ModerationProviderConfigRequirements as j, ModerationProviderMetadata as k, ModerationProviderPlugin as l, ModerationProviderPluginExport as m, ModerationResult as n, PluginCapability as o, PluginCategory as p, PluginCompatibility as q, PluginIconData as r, PluginManifest as s, PluginPermissions as t, PluginStatus as u, ProviderCapabilities as v, ProviderConfig as w, ProviderConfigRequirements as x, ProviderMetadata as y, ProviderPluginExport as z };
|
|
@@ -459,11 +459,11 @@ interface ProviderPluginExport {
|
|
|
459
459
|
/**
|
|
460
460
|
* Plugin capability types
|
|
461
461
|
*/
|
|
462
|
-
type PluginCapability = 'LLM_PROVIDER' | 'AUTH_PROVIDER' | '
|
|
462
|
+
type PluginCapability = 'LLM_PROVIDER' | 'AUTH_PROVIDER' | 'THEME' | 'ROLEPLAY_TEMPLATE' | 'TOOL_PROVIDER' | 'SEARCH_PROVIDER' | 'MODERATION_PROVIDER' | 'UTILITY';
|
|
463
463
|
/**
|
|
464
464
|
* Plugin category
|
|
465
465
|
*/
|
|
466
|
-
type PluginCategory = 'PROVIDER' | 'AUTH' | '
|
|
466
|
+
type PluginCategory = 'PROVIDER' | 'AUTH' | 'UI' | 'TEMPLATE' | 'TOOLS' | 'UTILITY';
|
|
467
467
|
/**
|
|
468
468
|
* Plugin status
|
|
469
469
|
*/
|
|
@@ -532,6 +532,33 @@ interface ProviderConfig {
|
|
|
532
532
|
description: string;
|
|
533
533
|
};
|
|
534
534
|
}
|
|
535
|
+
/**
|
|
536
|
+
* Moderation provider-specific configuration (for MODERATION_PROVIDER plugins)
|
|
537
|
+
*/
|
|
538
|
+
interface ModerationProviderConfig {
|
|
539
|
+
/** Internal provider name (e.g., 'OPENAI') */
|
|
540
|
+
providerName: string;
|
|
541
|
+
/** Human-readable display name */
|
|
542
|
+
displayName: string;
|
|
543
|
+
/** Provider description */
|
|
544
|
+
description: string;
|
|
545
|
+
/** Short abbreviation (2-4 chars) */
|
|
546
|
+
abbreviation: string;
|
|
547
|
+
/** UI color configuration */
|
|
548
|
+
colors: {
|
|
549
|
+
bg: string;
|
|
550
|
+
text: string;
|
|
551
|
+
icon: string;
|
|
552
|
+
};
|
|
553
|
+
/** Whether the provider requires an API key */
|
|
554
|
+
requiresApiKey: boolean;
|
|
555
|
+
/** Label for API key input */
|
|
556
|
+
apiKeyLabel?: string;
|
|
557
|
+
/** Whether the provider requires a base URL */
|
|
558
|
+
requiresBaseUrl: boolean;
|
|
559
|
+
/** Default base URL */
|
|
560
|
+
baseUrlDefault?: string;
|
|
561
|
+
}
|
|
535
562
|
/**
|
|
536
563
|
* Search provider-specific configuration (for SEARCH_PROVIDER plugins)
|
|
537
564
|
*/
|
|
@@ -617,6 +644,8 @@ interface PluginManifest {
|
|
|
617
644
|
providerConfig?: ProviderConfig;
|
|
618
645
|
/** Search provider configuration (for SEARCH_PROVIDER plugins) */
|
|
619
646
|
searchProviderConfig?: SearchProviderConfig;
|
|
647
|
+
/** Moderation provider configuration (for MODERATION_PROVIDER plugins) */
|
|
648
|
+
moderationProviderConfig?: ModerationProviderConfig;
|
|
620
649
|
/** Required permissions */
|
|
621
650
|
permissions?: PluginPermissions;
|
|
622
651
|
/** Repository URL */
|
|
@@ -636,7 +665,7 @@ interface PluginManifest {
|
|
|
636
665
|
* Whether this plugin requires a server restart to activate.
|
|
637
666
|
*
|
|
638
667
|
* If not specified, this is inferred from capabilities:
|
|
639
|
-
* - AUTH_METHODS, DATABASE_BACKEND,
|
|
668
|
+
* - AUTH_METHODS, DATABASE_BACKEND, UPGRADE_MIGRATION → requires restart
|
|
640
669
|
*
|
|
641
670
|
* Set explicitly to override the inferred value.
|
|
642
671
|
*/
|
|
@@ -1005,7 +1034,7 @@ interface ThemePlugin {
|
|
|
1005
1034
|
* Allows a theme to rename, re-describe, or re-image any of the
|
|
1006
1035
|
* Foundry subsystem pages. Keys are subsystem IDs:
|
|
1007
1036
|
* 'foundry' | 'aurora' | 'forge' | 'salon' | 'commonplace-book' |
|
|
1008
|
-
* 'prospero' | 'dangermouse' | 'calliope' | 'lantern'
|
|
1037
|
+
* 'prospero' | 'dangermouse' | 'calliope' | 'lantern' | 'pascal' | 'saquel'
|
|
1009
1038
|
*/
|
|
1010
1039
|
subsystems?: Partial<Record<string, SubsystemOverrides>>;
|
|
1011
1040
|
/**
|
|
@@ -1429,4 +1458,139 @@ interface SearchProviderPluginExport {
|
|
|
1429
1458
|
plugin: SearchProviderPlugin;
|
|
1430
1459
|
}
|
|
1431
1460
|
|
|
1432
|
-
|
|
1461
|
+
/**
|
|
1462
|
+
* Moderation Provider Plugin types for Quilltap plugin development
|
|
1463
|
+
*
|
|
1464
|
+
* Defines the interfaces and types needed to create pluggable content
|
|
1465
|
+
* moderation backends as Quilltap plugins (e.g., OpenAI moderation endpoint).
|
|
1466
|
+
*
|
|
1467
|
+
* @module @quilltap/plugin-types/plugins/moderation-provider
|
|
1468
|
+
*/
|
|
1469
|
+
/**
|
|
1470
|
+
* Moderation provider metadata for UI display and identification
|
|
1471
|
+
*/
|
|
1472
|
+
interface ModerationProviderMetadata {
|
|
1473
|
+
/** Internal identifier for the moderation provider (e.g., 'OPENAI') */
|
|
1474
|
+
providerName: string;
|
|
1475
|
+
/** Human-readable display name for UI (e.g., 'OpenAI Moderation') */
|
|
1476
|
+
displayName: string;
|
|
1477
|
+
/** Short description of the moderation provider */
|
|
1478
|
+
description: string;
|
|
1479
|
+
/** Short abbreviation for icon display (e.g., 'OAI') */
|
|
1480
|
+
abbreviation: string;
|
|
1481
|
+
/** Tailwind CSS color classes for UI styling */
|
|
1482
|
+
colors: {
|
|
1483
|
+
/** Background color class (e.g., 'bg-green-100') */
|
|
1484
|
+
bg: string;
|
|
1485
|
+
/** Text color class (e.g., 'text-green-800') */
|
|
1486
|
+
text: string;
|
|
1487
|
+
/** Icon color class (e.g., 'text-green-600') */
|
|
1488
|
+
icon: string;
|
|
1489
|
+
};
|
|
1490
|
+
}
|
|
1491
|
+
/**
|
|
1492
|
+
* Configuration requirements for a moderation provider
|
|
1493
|
+
*/
|
|
1494
|
+
interface ModerationProviderConfigRequirements {
|
|
1495
|
+
/** Whether this moderation provider requires an API key */
|
|
1496
|
+
requiresApiKey: boolean;
|
|
1497
|
+
/** Label text for API key input field */
|
|
1498
|
+
apiKeyLabel?: string;
|
|
1499
|
+
/** Whether this moderation provider requires a custom base URL */
|
|
1500
|
+
requiresBaseUrl: boolean;
|
|
1501
|
+
/** Default value for base URL (if applicable) */
|
|
1502
|
+
baseUrlDefault?: string;
|
|
1503
|
+
}
|
|
1504
|
+
/**
|
|
1505
|
+
* A single moderation category result
|
|
1506
|
+
*
|
|
1507
|
+
* Categories are provider-specific (e.g., OpenAI returns 'hate', 'sexual',
|
|
1508
|
+
* 'violence', etc.; other providers may return different categories).
|
|
1509
|
+
*/
|
|
1510
|
+
interface ModerationCategoryResult {
|
|
1511
|
+
/** Category name as returned by the provider (e.g., 'sexual', 'violence', 'hate') */
|
|
1512
|
+
category: string;
|
|
1513
|
+
/** Whether this specific category was flagged */
|
|
1514
|
+
flagged: boolean;
|
|
1515
|
+
/** Confidence score for this category (0-1) */
|
|
1516
|
+
score: number;
|
|
1517
|
+
}
|
|
1518
|
+
/**
|
|
1519
|
+
* Result from a moderation provider's content classification
|
|
1520
|
+
*
|
|
1521
|
+
* This is the generic result type returned by all moderation providers.
|
|
1522
|
+
* The categories array contains provider-specific category names and scores.
|
|
1523
|
+
* The consuming system (Dangermouse) maps these to its own category structure.
|
|
1524
|
+
*/
|
|
1525
|
+
interface ModerationResult {
|
|
1526
|
+
/** Whether the content was flagged by the moderation provider */
|
|
1527
|
+
flagged: boolean;
|
|
1528
|
+
/** Per-category breakdown with provider-specific category names */
|
|
1529
|
+
categories: ModerationCategoryResult[];
|
|
1530
|
+
}
|
|
1531
|
+
/**
|
|
1532
|
+
* Main Moderation Provider Plugin Interface
|
|
1533
|
+
*
|
|
1534
|
+
* Plugins implementing this interface provide content moderation backends
|
|
1535
|
+
* for Quilltap's Dangermouse system. The moderation provider is used
|
|
1536
|
+
* as an alternative to the Cheap LLM classification approach.
|
|
1537
|
+
*
|
|
1538
|
+
* @example
|
|
1539
|
+
* ```typescript
|
|
1540
|
+
* import type { ModerationProviderPlugin } from '@quilltap/plugin-types';
|
|
1541
|
+
*
|
|
1542
|
+
* export const moderationPlugin: ModerationProviderPlugin = {
|
|
1543
|
+
* metadata: {
|
|
1544
|
+
* providerName: 'OPENAI',
|
|
1545
|
+
* displayName: 'OpenAI Moderation',
|
|
1546
|
+
* description: 'Free content moderation via OpenAI moderation endpoint',
|
|
1547
|
+
* abbreviation: 'OAI',
|
|
1548
|
+
* colors: { bg: 'bg-green-100', text: 'text-green-800', icon: 'text-green-600' },
|
|
1549
|
+
* },
|
|
1550
|
+
* config: {
|
|
1551
|
+
* requiresApiKey: true,
|
|
1552
|
+
* apiKeyLabel: 'OpenAI API Key',
|
|
1553
|
+
* requiresBaseUrl: false,
|
|
1554
|
+
* },
|
|
1555
|
+
* moderate: async (content, apiKey) => {
|
|
1556
|
+
* // ... call moderation API ...
|
|
1557
|
+
* return { flagged: false, categories: [] };
|
|
1558
|
+
* },
|
|
1559
|
+
* };
|
|
1560
|
+
* ```
|
|
1561
|
+
*/
|
|
1562
|
+
interface ModerationProviderPlugin {
|
|
1563
|
+
/** Moderation provider metadata for UI display and identification */
|
|
1564
|
+
metadata: ModerationProviderMetadata;
|
|
1565
|
+
/** Configuration requirements for this moderation provider */
|
|
1566
|
+
config: ModerationProviderConfigRequirements;
|
|
1567
|
+
/**
|
|
1568
|
+
* Classify content for moderation
|
|
1569
|
+
*
|
|
1570
|
+
* @param content The text content to classify
|
|
1571
|
+
* @param apiKey The API key for authentication
|
|
1572
|
+
* @param baseUrl Optional base URL for the moderation API
|
|
1573
|
+
* @returns Promise resolving to moderation result with flagged status and categories
|
|
1574
|
+
*/
|
|
1575
|
+
moderate: (content: string, apiKey: string, baseUrl?: string) => Promise<ModerationResult>;
|
|
1576
|
+
/**
|
|
1577
|
+
* Validate an API key for this moderation provider (optional)
|
|
1578
|
+
*
|
|
1579
|
+
* Should test the API key by making a minimal API call to verify
|
|
1580
|
+
* that it is valid and has proper permissions.
|
|
1581
|
+
*
|
|
1582
|
+
* @param apiKey The API key to validate
|
|
1583
|
+
* @param baseUrl Optional base URL for the moderation API
|
|
1584
|
+
* @returns Promise resolving to true if valid, false otherwise
|
|
1585
|
+
*/
|
|
1586
|
+
validateApiKey?: (apiKey: string, baseUrl?: string) => Promise<boolean>;
|
|
1587
|
+
}
|
|
1588
|
+
/**
|
|
1589
|
+
* Standard export type for moderation provider plugins
|
|
1590
|
+
*/
|
|
1591
|
+
interface ModerationProviderPluginExport {
|
|
1592
|
+
/** The moderation provider plugin instance */
|
|
1593
|
+
moderationPlugin: ModerationProviderPlugin;
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
export type { AnnotationButton as $, AttachmentSupport as A, RoleplayTemplateMetadata as B, CheapModelConfig as C, RoleplayTemplatePlugin as D, Effects as E, FontDefinition as F, RoleplayTemplatePluginExport as G, SearchProviderConfig as H, IconProps as I, SearchProviderConfigRequirements as J, SearchProviderMetadata as K, LLMProviderPlugin as L, MessageFormatSupport as M, SearchProviderPlugin as N, SearchProviderPluginExport as O, PluginAuthor as P, SearchResult as Q, RoleplayTemplateConfig as R, SearchOutput as S, Spacing as T, SubsystemOverrides as U, ThemeMetadata as V, ThemePlugin as W, ThemePluginExport as X, ThemeTokens as Y, ToolFormatType as Z, Typography as _, ColorPalette as a, DialogueDetection as a0, ModerationProviderConfig as a1, RenderingPattern as a2, EmbeddedFont as b, EmbeddingModelInfo as c, ImageGenerationModelInfo as d, ImageProviderConstraints as e, ImageStyleInfo as f, InstalledPluginInfo as g, ModelInfo as h, ModerationCategoryResult as i, ModerationProviderConfigRequirements as j, ModerationProviderMetadata as k, ModerationProviderPlugin as l, ModerationProviderPluginExport as m, ModerationResult as n, PluginCapability as o, PluginCategory as p, PluginCompatibility as q, PluginIconData as r, PluginManifest as s, PluginPermissions as t, PluginStatus as u, ProviderCapabilities as v, ProviderConfig as w, ProviderConfigRequirements as x, ProviderMetadata as y, ProviderPluginExport as z };
|