@quilltap/plugin-types 1.0.3 → 1.1.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 CHANGED
@@ -5,6 +5,21 @@ 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.1.0] - 2025-12-31
9
+
10
+ ### Added
11
+
12
+ - Theme plugin types for self-contained theme plugins:
13
+ - `ThemePlugin` main interface for theme plugins
14
+ - `ThemeMetadata` for theme identification and display
15
+ - `ThemeTokens` complete theme token structure
16
+ - `ColorPalette` for light and dark mode colors
17
+ - `Typography`, `Spacing`, `Effects` for design tokens
18
+ - `FontDefinition` for font loading configuration
19
+ - `EmbeddedFont` for self-contained font embedding
20
+ - `ThemePluginExport` standard export type
21
+ - Exported theme types via `@quilltap/plugin-types/plugins`
22
+
8
23
  ## [1.0.3] - 2025-12-30
9
24
 
10
25
  ### Added
@@ -493,4 +493,342 @@ interface InstalledPluginInfo extends PluginManifest {
493
493
  installPath?: string;
494
494
  }
495
495
 
496
- export type { AttachmentSupport as A, CheapModelConfig as C, EmbeddingModelInfo as E, ImageGenerationModelInfo as I, LLMProviderPlugin as L, ModelInfo as M, ProviderMetadata as P, ToolFormatType as T, ProviderConfigRequirements as a, ProviderCapabilities as b, ImageProviderConstraints as c, IconProps as d, ProviderPluginExport as e, MessageFormatSupport as f, PluginCapability as g, PluginCategory as h, PluginStatus as i, PluginAuthor as j, PluginCompatibility as k, ProviderConfig as l, PluginPermissions as m, PluginManifest as n, InstalledPluginInfo as o };
496
+ /**
497
+ * Theme Plugin Interface types for Quilltap plugin development
498
+ *
499
+ * @module @quilltap/plugin-types/plugins/theme
500
+ */
501
+ /**
502
+ * Color palette for a single color mode (light or dark)
503
+ *
504
+ * Colors can be specified as:
505
+ * - HSL values: "222.2 84% 4.9%" (without hsl() wrapper)
506
+ * - Full HSL: "hsl(222.2 84% 4.9%)"
507
+ * - Hex: "#1a1a2e"
508
+ * - Other valid CSS color values: rgb(), oklch(), etc.
509
+ */
510
+ interface ColorPalette {
511
+ /** Main background color */
512
+ background: string;
513
+ /** Main text color */
514
+ foreground: string;
515
+ /** Primary brand/action color */
516
+ primary: string;
517
+ /** Text on primary color */
518
+ primaryForeground: string;
519
+ /** Secondary background color */
520
+ secondary: string;
521
+ /** Text on secondary color */
522
+ secondaryForeground: string;
523
+ /** Muted background for less prominent elements */
524
+ muted: string;
525
+ /** Muted text color */
526
+ mutedForeground: string;
527
+ /** Accent color for highlights */
528
+ accent: string;
529
+ /** Text on accent color */
530
+ accentForeground: string;
531
+ /** Error/destructive action color */
532
+ destructive: string;
533
+ /** Text on destructive color */
534
+ destructiveForeground: string;
535
+ /** Card background color */
536
+ card: string;
537
+ /** Card text color */
538
+ cardForeground: string;
539
+ /** Popover/dropdown background */
540
+ popover: string;
541
+ /** Popover text color */
542
+ popoverForeground: string;
543
+ /** Default border color */
544
+ border: string;
545
+ /** Input field border color */
546
+ input: string;
547
+ /** Focus ring color */
548
+ ring: string;
549
+ /** Success state color */
550
+ success?: string;
551
+ /** Text on success color */
552
+ successForeground?: string;
553
+ /** Warning state color */
554
+ warning?: string;
555
+ /** Text on warning color */
556
+ warningForeground?: string;
557
+ /** Info state color */
558
+ info?: string;
559
+ /** Text on info color */
560
+ infoForeground?: string;
561
+ /** User message bubble background */
562
+ chatUser?: string;
563
+ /** User message bubble text */
564
+ chatUserForeground?: string;
565
+ }
566
+ /**
567
+ * Typography token configuration
568
+ */
569
+ interface Typography {
570
+ /** Sans-serif font stack (default: "Inter, system-ui, sans-serif") */
571
+ fontSans?: string;
572
+ /** Serif font stack (default: "Georgia, serif") */
573
+ fontSerif?: string;
574
+ /** Monospace font stack (default: "ui-monospace, SFMono-Regular, monospace") */
575
+ fontMono?: string;
576
+ /** Extra small text - 12px (default: "0.75rem") */
577
+ fontSizeXs?: string;
578
+ /** Small text - 14px (default: "0.875rem") */
579
+ fontSizeSm?: string;
580
+ /** Base text size - 16px (default: "1rem") */
581
+ fontSizeBase?: string;
582
+ /** Large text - 18px (default: "1.125rem") */
583
+ fontSizeLg?: string;
584
+ /** Extra large text - 20px (default: "1.25rem") */
585
+ fontSizeXl?: string;
586
+ /** 2XL text - 24px (default: "1.5rem") */
587
+ fontSize2xl?: string;
588
+ /** 3XL text - 30px (default: "1.875rem") */
589
+ fontSize3xl?: string;
590
+ /** 4XL text - 36px (default: "2.25rem") */
591
+ fontSize4xl?: string;
592
+ /** Tight line height (default: "1.25") */
593
+ lineHeightTight?: string;
594
+ /** Normal line height (default: "1.5") */
595
+ lineHeightNormal?: string;
596
+ /** Relaxed line height (default: "1.75") */
597
+ lineHeightRelaxed?: string;
598
+ /** Normal font weight (default: "400") */
599
+ fontWeightNormal?: string;
600
+ /** Medium font weight (default: "500") */
601
+ fontWeightMedium?: string;
602
+ /** Semibold font weight (default: "600") */
603
+ fontWeightSemibold?: string;
604
+ /** Bold font weight (default: "700") */
605
+ fontWeightBold?: string;
606
+ /** Tight letter spacing (default: "-0.025em") */
607
+ letterSpacingTight?: string;
608
+ /** Normal letter spacing (default: "0") */
609
+ letterSpacingNormal?: string;
610
+ /** Wide letter spacing (default: "0.025em") */
611
+ letterSpacingWide?: string;
612
+ }
613
+ /**
614
+ * Spacing and layout token configuration
615
+ */
616
+ interface Spacing {
617
+ /** Small border radius (default: "calc(0.5rem - 4px)") */
618
+ radiusSm?: string;
619
+ /** Medium border radius (default: "calc(0.5rem - 2px)") */
620
+ radiusMd?: string;
621
+ /** Large border radius (default: "0.5rem") */
622
+ radiusLg?: string;
623
+ /** Extra large border radius (default: "0.75rem") */
624
+ radiusXl?: string;
625
+ /** Full/pill border radius (default: "9999px") */
626
+ radiusFull?: string;
627
+ /** 4px spacing (default: "0.25rem") */
628
+ spacing1?: string;
629
+ /** 8px spacing (default: "0.5rem") */
630
+ spacing2?: string;
631
+ /** 12px spacing (default: "0.75rem") */
632
+ spacing3?: string;
633
+ /** 16px spacing (default: "1rem") */
634
+ spacing4?: string;
635
+ /** 20px spacing (default: "1.25rem") */
636
+ spacing5?: string;
637
+ /** 24px spacing (default: "1.5rem") */
638
+ spacing6?: string;
639
+ /** 32px spacing (default: "2rem") */
640
+ spacing8?: string;
641
+ /** 40px spacing (default: "2.5rem") */
642
+ spacing10?: string;
643
+ /** 48px spacing (default: "3rem") */
644
+ spacing12?: string;
645
+ /** 64px spacing (default: "4rem") */
646
+ spacing16?: string;
647
+ }
648
+ /**
649
+ * Visual effects token configuration
650
+ */
651
+ interface Effects {
652
+ /** Small shadow (default: "0 1px 2px 0 rgb(0 0 0 / 0.05)") */
653
+ shadowSm?: string;
654
+ /** Medium shadow (default: "0 4px 6px -1px rgb(0 0 0 / 0.1)") */
655
+ shadowMd?: string;
656
+ /** Large shadow (default: "0 10px 15px -3px rgb(0 0 0 / 0.1)") */
657
+ shadowLg?: string;
658
+ /** Extra large shadow (default: "0 20px 25px -5px rgb(0 0 0 / 0.1)") */
659
+ shadowXl?: string;
660
+ /** Fast transition duration (default: "150ms") */
661
+ transitionFast?: string;
662
+ /** Normal transition duration (default: "200ms") */
663
+ transitionNormal?: string;
664
+ /** Slow transition duration (default: "300ms") */
665
+ transitionSlow?: string;
666
+ /** Default easing function (default: "cubic-bezier(0.4, 0, 0.2, 1)") */
667
+ transitionEasing?: string;
668
+ /** Focus ring width (default: "2px") */
669
+ focusRingWidth?: string;
670
+ /** Focus ring offset (default: "2px") */
671
+ focusRingOffset?: string;
672
+ }
673
+ /**
674
+ * Complete theme tokens structure
675
+ *
676
+ * Contains all customizable values for a theme:
677
+ * - colors: Required light and dark mode color palettes
678
+ * - typography: Optional font customization
679
+ * - spacing: Optional spacing/radius customization
680
+ * - effects: Optional shadows/transitions customization
681
+ */
682
+ interface ThemeTokens {
683
+ /** Light and dark mode color palettes (required) */
684
+ colors: {
685
+ /** Light mode color palette */
686
+ light: ColorPalette;
687
+ /** Dark mode color palette */
688
+ dark: ColorPalette;
689
+ };
690
+ /** Typography customization (optional) */
691
+ typography?: Typography;
692
+ /** Spacing and radius customization (optional) */
693
+ spacing?: Spacing;
694
+ /** Shadow and transition customization (optional) */
695
+ effects?: Effects;
696
+ }
697
+ /**
698
+ * Custom font definition for themes that include custom fonts
699
+ */
700
+ interface FontDefinition {
701
+ /** Font family name */
702
+ family: string;
703
+ /** Font source URL or relative path */
704
+ src: string;
705
+ /** Font weight (e.g., "400", "700", "400 700") */
706
+ weight?: string;
707
+ /** Font style (e.g., "normal", "italic") */
708
+ style?: string;
709
+ /** Font display strategy */
710
+ display?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional';
711
+ }
712
+ /**
713
+ * Loaded font with binary data (for self-contained themes)
714
+ */
715
+ interface EmbeddedFont {
716
+ /** Font family name */
717
+ family: string;
718
+ /** Font weight */
719
+ weight: string;
720
+ /** Font style */
721
+ style?: string;
722
+ /** Base64-encoded font data or data URL */
723
+ data: string;
724
+ /** MIME type of the font */
725
+ mimeType?: string;
726
+ }
727
+ /**
728
+ * Theme plugin metadata for UI display and identification
729
+ */
730
+ interface ThemeMetadata {
731
+ /** Unique theme identifier (lowercase, hyphens allowed) */
732
+ themeId: string;
733
+ /** Human-readable display name */
734
+ displayName: string;
735
+ /** Theme description */
736
+ description?: string;
737
+ /** Theme author */
738
+ author?: string | {
739
+ name: string;
740
+ email?: string;
741
+ url?: string;
742
+ };
743
+ /** Whether this theme provides dark mode support */
744
+ supportsDarkMode: boolean;
745
+ /** Theme tags for categorization */
746
+ tags?: string[];
747
+ /** Base64-encoded preview image or path */
748
+ previewImage?: string;
749
+ }
750
+ /**
751
+ * Main Theme Plugin Interface
752
+ *
753
+ * Plugins implementing this interface can be dynamically loaded
754
+ * by Quilltap to provide custom theming.
755
+ *
756
+ * Self-contained themes export all data directly in the plugin object,
757
+ * with no file system dependencies after module load.
758
+ *
759
+ * @example
760
+ * ```typescript
761
+ * import type { ThemePlugin } from '@quilltap/plugin-types';
762
+ *
763
+ * export const plugin: ThemePlugin = {
764
+ * metadata: {
765
+ * themeId: 'my-theme',
766
+ * displayName: 'My Custom Theme',
767
+ * description: 'A beautiful custom theme',
768
+ * supportsDarkMode: true,
769
+ * tags: ['dark', 'minimal'],
770
+ * },
771
+ * tokens: {
772
+ * colors: {
773
+ * light: {
774
+ * background: 'hsl(0 0% 100%)',
775
+ * foreground: 'hsl(222.2 84% 4.9%)',
776
+ * // ... all required colors
777
+ * },
778
+ * dark: {
779
+ * background: 'hsl(222.2 84% 4.9%)',
780
+ * foreground: 'hsl(210 40% 98%)',
781
+ * // ... all required colors
782
+ * },
783
+ * },
784
+ * typography: {
785
+ * fontSans: '"Custom Font", system-ui, sans-serif',
786
+ * },
787
+ * },
788
+ * cssOverrides: `
789
+ * .qt-button-primary {
790
+ * border-radius: 9999px;
791
+ * }
792
+ * `,
793
+ * fonts: [
794
+ * { family: 'Custom Font', weight: '400', data: 'base64...' },
795
+ * ],
796
+ * };
797
+ * ```
798
+ */
799
+ interface ThemePlugin {
800
+ /** Theme metadata for UI display and identification */
801
+ metadata: ThemeMetadata;
802
+ /** Theme design tokens (colors, typography, spacing, effects) */
803
+ tokens: ThemeTokens;
804
+ /**
805
+ * Optional CSS overrides for component-level customization (Tier 3)
806
+ * This CSS is injected when the theme is active
807
+ */
808
+ cssOverrides?: string;
809
+ /**
810
+ * Optional embedded fonts
811
+ * Base64-encoded font data for fully self-contained themes
812
+ */
813
+ fonts?: EmbeddedFont[];
814
+ /**
815
+ * Optional method for dynamic token generation
816
+ * Called when color mode changes, allows computed theme values
817
+ * @param mode Current color mode ('light' | 'dark')
818
+ */
819
+ getTokensForMode?: (mode: 'light' | 'dark') => ThemeTokens;
820
+ /**
821
+ * Optional initialization function
822
+ * Called when the theme is loaded
823
+ */
824
+ initialize?: () => void | Promise<void>;
825
+ }
826
+ /**
827
+ * Standard export type for theme plugins
828
+ */
829
+ interface ThemePluginExport {
830
+ /** The theme plugin instance */
831
+ plugin: ThemePlugin;
832
+ }
833
+
834
+ export type { AttachmentSupport as A, CheapModelConfig as C, EmbeddingModelInfo as E, FontDefinition as F, ImageGenerationModelInfo as I, LLMProviderPlugin as L, ModelInfo as M, ProviderMetadata as P, Spacing as S, ToolFormatType as T, ProviderConfigRequirements as a, ProviderCapabilities as b, ImageProviderConstraints as c, IconProps as d, ProviderPluginExport as e, MessageFormatSupport as f, PluginCapability as g, PluginCategory as h, PluginStatus as i, PluginAuthor as j, PluginCompatibility as k, ProviderConfig as l, PluginPermissions as m, PluginManifest as n, InstalledPluginInfo as o, ColorPalette as p, Typography as q, Effects as r, ThemeTokens as s, EmbeddedFont as t, ThemeMetadata as u, ThemePlugin as v, ThemePluginExport as w };
@@ -493,4 +493,342 @@ interface InstalledPluginInfo extends PluginManifest {
493
493
  installPath?: string;
494
494
  }
495
495
 
496
- export type { AttachmentSupport as A, CheapModelConfig as C, EmbeddingModelInfo as E, ImageGenerationModelInfo as I, LLMProviderPlugin as L, ModelInfo as M, ProviderMetadata as P, ToolFormatType as T, ProviderConfigRequirements as a, ProviderCapabilities as b, ImageProviderConstraints as c, IconProps as d, ProviderPluginExport as e, MessageFormatSupport as f, PluginCapability as g, PluginCategory as h, PluginStatus as i, PluginAuthor as j, PluginCompatibility as k, ProviderConfig as l, PluginPermissions as m, PluginManifest as n, InstalledPluginInfo as o };
496
+ /**
497
+ * Theme Plugin Interface types for Quilltap plugin development
498
+ *
499
+ * @module @quilltap/plugin-types/plugins/theme
500
+ */
501
+ /**
502
+ * Color palette for a single color mode (light or dark)
503
+ *
504
+ * Colors can be specified as:
505
+ * - HSL values: "222.2 84% 4.9%" (without hsl() wrapper)
506
+ * - Full HSL: "hsl(222.2 84% 4.9%)"
507
+ * - Hex: "#1a1a2e"
508
+ * - Other valid CSS color values: rgb(), oklch(), etc.
509
+ */
510
+ interface ColorPalette {
511
+ /** Main background color */
512
+ background: string;
513
+ /** Main text color */
514
+ foreground: string;
515
+ /** Primary brand/action color */
516
+ primary: string;
517
+ /** Text on primary color */
518
+ primaryForeground: string;
519
+ /** Secondary background color */
520
+ secondary: string;
521
+ /** Text on secondary color */
522
+ secondaryForeground: string;
523
+ /** Muted background for less prominent elements */
524
+ muted: string;
525
+ /** Muted text color */
526
+ mutedForeground: string;
527
+ /** Accent color for highlights */
528
+ accent: string;
529
+ /** Text on accent color */
530
+ accentForeground: string;
531
+ /** Error/destructive action color */
532
+ destructive: string;
533
+ /** Text on destructive color */
534
+ destructiveForeground: string;
535
+ /** Card background color */
536
+ card: string;
537
+ /** Card text color */
538
+ cardForeground: string;
539
+ /** Popover/dropdown background */
540
+ popover: string;
541
+ /** Popover text color */
542
+ popoverForeground: string;
543
+ /** Default border color */
544
+ border: string;
545
+ /** Input field border color */
546
+ input: string;
547
+ /** Focus ring color */
548
+ ring: string;
549
+ /** Success state color */
550
+ success?: string;
551
+ /** Text on success color */
552
+ successForeground?: string;
553
+ /** Warning state color */
554
+ warning?: string;
555
+ /** Text on warning color */
556
+ warningForeground?: string;
557
+ /** Info state color */
558
+ info?: string;
559
+ /** Text on info color */
560
+ infoForeground?: string;
561
+ /** User message bubble background */
562
+ chatUser?: string;
563
+ /** User message bubble text */
564
+ chatUserForeground?: string;
565
+ }
566
+ /**
567
+ * Typography token configuration
568
+ */
569
+ interface Typography {
570
+ /** Sans-serif font stack (default: "Inter, system-ui, sans-serif") */
571
+ fontSans?: string;
572
+ /** Serif font stack (default: "Georgia, serif") */
573
+ fontSerif?: string;
574
+ /** Monospace font stack (default: "ui-monospace, SFMono-Regular, monospace") */
575
+ fontMono?: string;
576
+ /** Extra small text - 12px (default: "0.75rem") */
577
+ fontSizeXs?: string;
578
+ /** Small text - 14px (default: "0.875rem") */
579
+ fontSizeSm?: string;
580
+ /** Base text size - 16px (default: "1rem") */
581
+ fontSizeBase?: string;
582
+ /** Large text - 18px (default: "1.125rem") */
583
+ fontSizeLg?: string;
584
+ /** Extra large text - 20px (default: "1.25rem") */
585
+ fontSizeXl?: string;
586
+ /** 2XL text - 24px (default: "1.5rem") */
587
+ fontSize2xl?: string;
588
+ /** 3XL text - 30px (default: "1.875rem") */
589
+ fontSize3xl?: string;
590
+ /** 4XL text - 36px (default: "2.25rem") */
591
+ fontSize4xl?: string;
592
+ /** Tight line height (default: "1.25") */
593
+ lineHeightTight?: string;
594
+ /** Normal line height (default: "1.5") */
595
+ lineHeightNormal?: string;
596
+ /** Relaxed line height (default: "1.75") */
597
+ lineHeightRelaxed?: string;
598
+ /** Normal font weight (default: "400") */
599
+ fontWeightNormal?: string;
600
+ /** Medium font weight (default: "500") */
601
+ fontWeightMedium?: string;
602
+ /** Semibold font weight (default: "600") */
603
+ fontWeightSemibold?: string;
604
+ /** Bold font weight (default: "700") */
605
+ fontWeightBold?: string;
606
+ /** Tight letter spacing (default: "-0.025em") */
607
+ letterSpacingTight?: string;
608
+ /** Normal letter spacing (default: "0") */
609
+ letterSpacingNormal?: string;
610
+ /** Wide letter spacing (default: "0.025em") */
611
+ letterSpacingWide?: string;
612
+ }
613
+ /**
614
+ * Spacing and layout token configuration
615
+ */
616
+ interface Spacing {
617
+ /** Small border radius (default: "calc(0.5rem - 4px)") */
618
+ radiusSm?: string;
619
+ /** Medium border radius (default: "calc(0.5rem - 2px)") */
620
+ radiusMd?: string;
621
+ /** Large border radius (default: "0.5rem") */
622
+ radiusLg?: string;
623
+ /** Extra large border radius (default: "0.75rem") */
624
+ radiusXl?: string;
625
+ /** Full/pill border radius (default: "9999px") */
626
+ radiusFull?: string;
627
+ /** 4px spacing (default: "0.25rem") */
628
+ spacing1?: string;
629
+ /** 8px spacing (default: "0.5rem") */
630
+ spacing2?: string;
631
+ /** 12px spacing (default: "0.75rem") */
632
+ spacing3?: string;
633
+ /** 16px spacing (default: "1rem") */
634
+ spacing4?: string;
635
+ /** 20px spacing (default: "1.25rem") */
636
+ spacing5?: string;
637
+ /** 24px spacing (default: "1.5rem") */
638
+ spacing6?: string;
639
+ /** 32px spacing (default: "2rem") */
640
+ spacing8?: string;
641
+ /** 40px spacing (default: "2.5rem") */
642
+ spacing10?: string;
643
+ /** 48px spacing (default: "3rem") */
644
+ spacing12?: string;
645
+ /** 64px spacing (default: "4rem") */
646
+ spacing16?: string;
647
+ }
648
+ /**
649
+ * Visual effects token configuration
650
+ */
651
+ interface Effects {
652
+ /** Small shadow (default: "0 1px 2px 0 rgb(0 0 0 / 0.05)") */
653
+ shadowSm?: string;
654
+ /** Medium shadow (default: "0 4px 6px -1px rgb(0 0 0 / 0.1)") */
655
+ shadowMd?: string;
656
+ /** Large shadow (default: "0 10px 15px -3px rgb(0 0 0 / 0.1)") */
657
+ shadowLg?: string;
658
+ /** Extra large shadow (default: "0 20px 25px -5px rgb(0 0 0 / 0.1)") */
659
+ shadowXl?: string;
660
+ /** Fast transition duration (default: "150ms") */
661
+ transitionFast?: string;
662
+ /** Normal transition duration (default: "200ms") */
663
+ transitionNormal?: string;
664
+ /** Slow transition duration (default: "300ms") */
665
+ transitionSlow?: string;
666
+ /** Default easing function (default: "cubic-bezier(0.4, 0, 0.2, 1)") */
667
+ transitionEasing?: string;
668
+ /** Focus ring width (default: "2px") */
669
+ focusRingWidth?: string;
670
+ /** Focus ring offset (default: "2px") */
671
+ focusRingOffset?: string;
672
+ }
673
+ /**
674
+ * Complete theme tokens structure
675
+ *
676
+ * Contains all customizable values for a theme:
677
+ * - colors: Required light and dark mode color palettes
678
+ * - typography: Optional font customization
679
+ * - spacing: Optional spacing/radius customization
680
+ * - effects: Optional shadows/transitions customization
681
+ */
682
+ interface ThemeTokens {
683
+ /** Light and dark mode color palettes (required) */
684
+ colors: {
685
+ /** Light mode color palette */
686
+ light: ColorPalette;
687
+ /** Dark mode color palette */
688
+ dark: ColorPalette;
689
+ };
690
+ /** Typography customization (optional) */
691
+ typography?: Typography;
692
+ /** Spacing and radius customization (optional) */
693
+ spacing?: Spacing;
694
+ /** Shadow and transition customization (optional) */
695
+ effects?: Effects;
696
+ }
697
+ /**
698
+ * Custom font definition for themes that include custom fonts
699
+ */
700
+ interface FontDefinition {
701
+ /** Font family name */
702
+ family: string;
703
+ /** Font source URL or relative path */
704
+ src: string;
705
+ /** Font weight (e.g., "400", "700", "400 700") */
706
+ weight?: string;
707
+ /** Font style (e.g., "normal", "italic") */
708
+ style?: string;
709
+ /** Font display strategy */
710
+ display?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional';
711
+ }
712
+ /**
713
+ * Loaded font with binary data (for self-contained themes)
714
+ */
715
+ interface EmbeddedFont {
716
+ /** Font family name */
717
+ family: string;
718
+ /** Font weight */
719
+ weight: string;
720
+ /** Font style */
721
+ style?: string;
722
+ /** Base64-encoded font data or data URL */
723
+ data: string;
724
+ /** MIME type of the font */
725
+ mimeType?: string;
726
+ }
727
+ /**
728
+ * Theme plugin metadata for UI display and identification
729
+ */
730
+ interface ThemeMetadata {
731
+ /** Unique theme identifier (lowercase, hyphens allowed) */
732
+ themeId: string;
733
+ /** Human-readable display name */
734
+ displayName: string;
735
+ /** Theme description */
736
+ description?: string;
737
+ /** Theme author */
738
+ author?: string | {
739
+ name: string;
740
+ email?: string;
741
+ url?: string;
742
+ };
743
+ /** Whether this theme provides dark mode support */
744
+ supportsDarkMode: boolean;
745
+ /** Theme tags for categorization */
746
+ tags?: string[];
747
+ /** Base64-encoded preview image or path */
748
+ previewImage?: string;
749
+ }
750
+ /**
751
+ * Main Theme Plugin Interface
752
+ *
753
+ * Plugins implementing this interface can be dynamically loaded
754
+ * by Quilltap to provide custom theming.
755
+ *
756
+ * Self-contained themes export all data directly in the plugin object,
757
+ * with no file system dependencies after module load.
758
+ *
759
+ * @example
760
+ * ```typescript
761
+ * import type { ThemePlugin } from '@quilltap/plugin-types';
762
+ *
763
+ * export const plugin: ThemePlugin = {
764
+ * metadata: {
765
+ * themeId: 'my-theme',
766
+ * displayName: 'My Custom Theme',
767
+ * description: 'A beautiful custom theme',
768
+ * supportsDarkMode: true,
769
+ * tags: ['dark', 'minimal'],
770
+ * },
771
+ * tokens: {
772
+ * colors: {
773
+ * light: {
774
+ * background: 'hsl(0 0% 100%)',
775
+ * foreground: 'hsl(222.2 84% 4.9%)',
776
+ * // ... all required colors
777
+ * },
778
+ * dark: {
779
+ * background: 'hsl(222.2 84% 4.9%)',
780
+ * foreground: 'hsl(210 40% 98%)',
781
+ * // ... all required colors
782
+ * },
783
+ * },
784
+ * typography: {
785
+ * fontSans: '"Custom Font", system-ui, sans-serif',
786
+ * },
787
+ * },
788
+ * cssOverrides: `
789
+ * .qt-button-primary {
790
+ * border-radius: 9999px;
791
+ * }
792
+ * `,
793
+ * fonts: [
794
+ * { family: 'Custom Font', weight: '400', data: 'base64...' },
795
+ * ],
796
+ * };
797
+ * ```
798
+ */
799
+ interface ThemePlugin {
800
+ /** Theme metadata for UI display and identification */
801
+ metadata: ThemeMetadata;
802
+ /** Theme design tokens (colors, typography, spacing, effects) */
803
+ tokens: ThemeTokens;
804
+ /**
805
+ * Optional CSS overrides for component-level customization (Tier 3)
806
+ * This CSS is injected when the theme is active
807
+ */
808
+ cssOverrides?: string;
809
+ /**
810
+ * Optional embedded fonts
811
+ * Base64-encoded font data for fully self-contained themes
812
+ */
813
+ fonts?: EmbeddedFont[];
814
+ /**
815
+ * Optional method for dynamic token generation
816
+ * Called when color mode changes, allows computed theme values
817
+ * @param mode Current color mode ('light' | 'dark')
818
+ */
819
+ getTokensForMode?: (mode: 'light' | 'dark') => ThemeTokens;
820
+ /**
821
+ * Optional initialization function
822
+ * Called when the theme is loaded
823
+ */
824
+ initialize?: () => void | Promise<void>;
825
+ }
826
+ /**
827
+ * Standard export type for theme plugins
828
+ */
829
+ interface ThemePluginExport {
830
+ /** The theme plugin instance */
831
+ plugin: ThemePlugin;
832
+ }
833
+
834
+ export type { AttachmentSupport as A, CheapModelConfig as C, EmbeddingModelInfo as E, FontDefinition as F, ImageGenerationModelInfo as I, LLMProviderPlugin as L, ModelInfo as M, ProviderMetadata as P, Spacing as S, ToolFormatType as T, ProviderConfigRequirements as a, ProviderCapabilities as b, ImageProviderConstraints as c, IconProps as d, ProviderPluginExport as e, MessageFormatSupport as f, PluginCapability as g, PluginCategory as h, PluginStatus as i, PluginAuthor as j, PluginCompatibility as k, ProviderConfig as l, PluginPermissions as m, PluginManifest as n, InstalledPluginInfo as o, ColorPalette as p, Typography as q, Effects as r, ThemeTokens as s, EmbeddedFont as t, ThemeMetadata as u, ThemePlugin as v, ThemePluginExport as w };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
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 { A as AttachmentSupport, C as CheapModelConfig, E as EmbeddingModelInfo, d as IconProps, I as ImageGenerationModelInfo, c as ImageProviderConstraints, o as InstalledPluginInfo, L as LLMProviderPlugin, f as MessageFormatSupport, M as ModelInfo, j as PluginAuthor, g as PluginCapability, h as PluginCategory, k as PluginCompatibility, n as PluginManifest, m as PluginPermissions, i as PluginStatus, b as ProviderCapabilities, l as ProviderConfig, a as ProviderConfigRequirements, P as ProviderMetadata, e as ProviderPluginExport, T as ToolFormatType } from './index-BJ_sGB3K.mjs';
2
+ export { A as AttachmentSupport, C as CheapModelConfig, p as ColorPalette, r as Effects, t as EmbeddedFont, E as EmbeddingModelInfo, F as FontDefinition, d as IconProps, I as ImageGenerationModelInfo, c as ImageProviderConstraints, o as InstalledPluginInfo, L as LLMProviderPlugin, f as MessageFormatSupport, M as ModelInfo, j as PluginAuthor, g as PluginCapability, h as PluginCategory, k as PluginCompatibility, n as PluginManifest, m as PluginPermissions, i as PluginStatus, b as ProviderCapabilities, l as ProviderConfig, a as ProviderConfigRequirements, P as ProviderMetadata, e as ProviderPluginExport, S as Spacing, u as ThemeMetadata, v as ThemePlugin, w as ThemePluginExport, s as ThemeTokens, T as ToolFormatType, q as Typography } from './index-BJhI-WMr.mjs';
3
3
  export { ApiKeyError, AttachmentError, ConfigurationError, LogContext, LogLevel, ModelNotFoundError, PluginError, PluginLogger, ProviderApiError, RateLimitError, ToolExecutionError, createConsoleLogger, createNoopLogger } from './common/index.mjs';
4
4
  import 'react';
5
5
 
@@ -20,6 +20,6 @@ import 'react';
20
20
  * Version of the plugin-types package.
21
21
  * Can be used at runtime to check compatibility.
22
22
  */
23
- declare const PLUGIN_TYPES_VERSION = "1.0.3";
23
+ declare const PLUGIN_TYPES_VERSION = "1.1.0";
24
24
 
25
25
  export { PLUGIN_TYPES_VERSION };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
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 { A as AttachmentSupport, C as CheapModelConfig, E as EmbeddingModelInfo, d as IconProps, I as ImageGenerationModelInfo, c as ImageProviderConstraints, o as InstalledPluginInfo, L as LLMProviderPlugin, f as MessageFormatSupport, M as ModelInfo, j as PluginAuthor, g as PluginCapability, h as PluginCategory, k as PluginCompatibility, n as PluginManifest, m as PluginPermissions, i as PluginStatus, b as ProviderCapabilities, l as ProviderConfig, a as ProviderConfigRequirements, P as ProviderMetadata, e as ProviderPluginExport, T as ToolFormatType } from './index-yK-qJDls.js';
2
+ export { A as AttachmentSupport, C as CheapModelConfig, p as ColorPalette, r as Effects, t as EmbeddedFont, E as EmbeddingModelInfo, F as FontDefinition, d as IconProps, I as ImageGenerationModelInfo, c as ImageProviderConstraints, o as InstalledPluginInfo, L as LLMProviderPlugin, f as MessageFormatSupport, M as ModelInfo, j as PluginAuthor, g as PluginCapability, h as PluginCategory, k as PluginCompatibility, n as PluginManifest, m as PluginPermissions, i as PluginStatus, b as ProviderCapabilities, l as ProviderConfig, a as ProviderConfigRequirements, P as ProviderMetadata, e as ProviderPluginExport, S as Spacing, u as ThemeMetadata, v as ThemePlugin, w as ThemePluginExport, s as ThemeTokens, T as ToolFormatType, q as Typography } from './index-DFk3JW7G.js';
3
3
  export { ApiKeyError, AttachmentError, ConfigurationError, LogContext, LogLevel, ModelNotFoundError, PluginError, PluginLogger, ProviderApiError, RateLimitError, ToolExecutionError, createConsoleLogger, createNoopLogger } from './common/index.js';
4
4
  import 'react';
5
5
 
@@ -20,6 +20,6 @@ import 'react';
20
20
  * Version of the plugin-types package.
21
21
  * Can be used at runtime to check compatibility.
22
22
  */
23
- declare const PLUGIN_TYPES_VERSION = "1.0.3";
23
+ declare const PLUGIN_TYPES_VERSION = "1.1.0";
24
24
 
25
25
  export { PLUGIN_TYPES_VERSION };
package/dist/index.js CHANGED
@@ -107,7 +107,7 @@ function createNoopLogger() {
107
107
  }
108
108
 
109
109
  // src/index.ts
110
- var PLUGIN_TYPES_VERSION = "1.0.3";
110
+ var PLUGIN_TYPES_VERSION = "1.1.0";
111
111
 
112
112
  exports.ApiKeyError = ApiKeyError;
113
113
  exports.AttachmentError = AttachmentError;
package/dist/index.js.map CHANGED
@@ -1 +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,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AAGhB,IAAA,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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;;;ACRO,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 // Runtime configuration types\n MessageFormatSupport,\n CheapModelConfig,\n ToolFormatType,\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.3';\n"]}
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,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AAGhB,IAAA,IAAA,CAAK,IAAA,GAAO,aAAA;AAAA,EACd;AACF;AAOO,IAAM,WAAA,GAAN,cAA0B,WAAA,CAAY;AAAA,EAC3C,WAAA,CAAY,SAAiB,UAAA,EAAqB;AAChD,IAAA,KAAA,CAAM,OAAA,EAAS,iBAAiB,UAAU,CAAA;AAC1C,IAAA,IAAA,CAAK,IAAA,GAAO,aAAA;AAAA,EACd;AACF;AAOO,IAAM,gBAAA,GAAN,cAA+B,WAAA,CAAY;AAAA,EAChD,WAAA,CACE,OAAA,EACgB,UAAA,EACA,QAAA,EAChB,UAAA,EACA;AACA,IAAA,KAAA,CAAM,OAAA,EAAS,sBAAsB,UAAU,CAAA;AAJ/B,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AACA,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA;AAIhB,IAAA,IAAA,CAAK,IAAA,GAAO,kBAAA;AAAA,EACd;AACF;AAOO,IAAM,cAAA,GAAN,cAA6B,gBAAA,CAAiB;AAAA,EAGnD,WAAA,CACE,OAAA,EACgB,UAAA,EAChB,UAAA,EACA;AACA,IAAA,KAAA,CAAM,OAAA,EAAS,GAAA,EAAK,MAAA,EAAW,UAAU,CAAA;AAHzB,IAAA,IAAA,CAAA,UAAA,GAAA,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AAA,KAA+B;AACrD,MAAA,IAAI,SAAA,CAAU,MAAM,CAAA,EAAG;AACrB,QAAA,OAAA,CAAQ,IAAA,CAAK,IAAI,MAAM,CAAA,EAAA,EAAK,OAAO,CAAA,EAAG,aAAA,CAAc,OAAO,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;;;ACMO,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 // Runtime configuration types\n MessageFormatSupport,\n CheapModelConfig,\n ToolFormatType,\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\nexport type {\n // Theme plugin types\n ColorPalette,\n Typography,\n Spacing,\n Effects,\n ThemeTokens,\n FontDefinition,\n EmbeddedFont,\n ThemeMetadata,\n ThemePlugin,\n ThemePluginExport,\n} from './plugins/theme';\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.1.0';\n"]}
package/dist/index.mjs CHANGED
@@ -105,7 +105,7 @@ function createNoopLogger() {
105
105
  }
106
106
 
107
107
  // src/index.ts
108
- var PLUGIN_TYPES_VERSION = "1.0.3";
108
+ var PLUGIN_TYPES_VERSION = "1.1.0";
109
109
 
110
110
  export { ApiKeyError, AttachmentError, ConfigurationError, ModelNotFoundError, PLUGIN_TYPES_VERSION, PluginError, ProviderApiError, RateLimitError, ToolExecutionError, createConsoleLogger, createNoopLogger };
111
111
  //# sourceMappingURL=index.mjs.map
@@ -1 +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,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AA,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;;;ACRO,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 // Runtime configuration types\n MessageFormatSupport,\n CheapModelConfig,\n ToolFormatType,\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.3';\n"]}
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,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AAGhB,IAAA,IAAA,CAAK,IAAA,GAAO,aAAA;AAAA,EACd;AACF;AAOO,IAAM,WAAA,GAAN,cAA0B,WAAA,CAAY;AAAA,EAC3C,WAAA,CAAY,SAAiB,UAAA,EAAqB;AAChD,IAAA,KAAA,CAAM,OAAA,EAAS,iBAAiB,UAAU,CAAA;AAC1C,IAAA,IAAA,CAAK,IAAA,GAAO,aAAA;AAAA,EACd;AACF;AAOO,IAAM,gBAAA,GAAN,cAA+B,WAAA,CAAY;AAAA,EAChD,WAAA,CACE,OAAA,EACgB,UAAA,EACA,QAAA,EAChB,UAAA,EACA;AACA,IAAA,KAAA,CAAM,OAAA,EAAS,sBAAsB,UAAU,CAAA;AAJ/B,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AACA,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA;AAIhB,IAAA,IAAA,CAAK,IAAA,GAAO,kBAAA;AAAA,EACd;AACF;AAOO,IAAM,cAAA,GAAN,cAA6B,gBAAA,CAAiB;AAAA,EAGnD,WAAA,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A,EAAA,EAAK,OAAO,CAAA,EAAG,aAAA,CAAc,OAAO,CAAC,CAAA,CAAE,CAAA;AAAA,MAChE;AAAA,IACF,CAAA;AAAA,IAEA,IAAA,EAAM,CAAC,OAAA,EAAiB,OAAA,KAA+B;AACrD,MAAA,IAAI,SAAA,CAAU,MAAM,CAAA,EAAG;AACrB,QAAA,OAAA,CAAQ,IAAA,CAAK,IAAI,MAAM,CAAA,EAAA,EAAK,OAAO,CAAA,EAAG,aAAA,CAAc,OAAO,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;;;ACMO,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 // Runtime configuration types\n MessageFormatSupport,\n CheapModelConfig,\n ToolFormatType,\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\nexport type {\n // Theme plugin types\n ColorPalette,\n Typography,\n Spacing,\n Effects,\n ThemeTokens,\n FontDefinition,\n EmbeddedFont,\n ThemeMetadata,\n ThemePlugin,\n ThemePluginExport,\n} from './plugins/theme';\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.1.0';\n"]}
@@ -1,3 +1,3 @@
1
- export { A as AttachmentSupport, E as EmbeddingModelInfo, d as IconProps, I as ImageGenerationModelInfo, c as ImageProviderConstraints, o as InstalledPluginInfo, L as LLMProviderPlugin, M as ModelInfo, j as PluginAuthor, g as PluginCapability, h as PluginCategory, k as PluginCompatibility, n as PluginManifest, m as PluginPermissions, i as PluginStatus, b as ProviderCapabilities, l as ProviderConfig, a as ProviderConfigRequirements, P as ProviderMetadata, e as ProviderPluginExport } from '../index-BJ_sGB3K.mjs';
1
+ export { A as AttachmentSupport, p as ColorPalette, r as Effects, t as EmbeddedFont, E as EmbeddingModelInfo, F as FontDefinition, d as IconProps, I as ImageGenerationModelInfo, c as ImageProviderConstraints, o as InstalledPluginInfo, L as LLMProviderPlugin, M as ModelInfo, j as PluginAuthor, g as PluginCapability, h as PluginCategory, k as PluginCompatibility, n as PluginManifest, m as PluginPermissions, i as PluginStatus, b as ProviderCapabilities, l as ProviderConfig, a as ProviderConfigRequirements, P as ProviderMetadata, e as ProviderPluginExport, S as Spacing, u as ThemeMetadata, v as ThemePlugin, w as ThemePluginExport, s as ThemeTokens, q as Typography } from '../index-BJhI-WMr.mjs';
2
2
  import 'react';
3
3
  import '../llm/index.mjs';
@@ -1,3 +1,3 @@
1
- export { A as AttachmentSupport, E as EmbeddingModelInfo, d as IconProps, I as ImageGenerationModelInfo, c as ImageProviderConstraints, o as InstalledPluginInfo, L as LLMProviderPlugin, M as ModelInfo, j as PluginAuthor, g as PluginCapability, h as PluginCategory, k as PluginCompatibility, n as PluginManifest, m as PluginPermissions, i as PluginStatus, b as ProviderCapabilities, l as ProviderConfig, a as ProviderConfigRequirements, P as ProviderMetadata, e as ProviderPluginExport } from '../index-yK-qJDls.js';
1
+ export { A as AttachmentSupport, p as ColorPalette, r as Effects, t as EmbeddedFont, E as EmbeddingModelInfo, F as FontDefinition, d as IconProps, I as ImageGenerationModelInfo, c as ImageProviderConstraints, o as InstalledPluginInfo, L as LLMProviderPlugin, M as ModelInfo, j as PluginAuthor, g as PluginCapability, h as PluginCategory, k as PluginCompatibility, n as PluginManifest, m as PluginPermissions, i as PluginStatus, b as ProviderCapabilities, l as ProviderConfig, a as ProviderConfigRequirements, P as ProviderMetadata, e as ProviderPluginExport, S as Spacing, u as ThemeMetadata, v as ThemePlugin, w as ThemePluginExport, s as ThemeTokens, q as Typography } from '../index-DFk3JW7G.js';
2
2
  import 'react';
3
3
  import '../llm/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quilltap/plugin-types",
3
- "version": "1.0.3",
3
+ "version": "1.1.0",
4
4
  "description": "Type definitions for Quilltap plugin development",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",