lumiverse-spindle-types 0.4.73 → 0.4.75

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lumiverse-spindle-types",
3
- "version": "0.4.73",
3
+ "version": "0.4.75",
4
4
  "types": "./src/index.ts",
5
5
  "keywords": [
6
6
  "lumiverse",
package/src/api.ts CHANGED
@@ -627,6 +627,108 @@ export interface ChatChangedPayloadDTO {
627
627
  changedFields?: string[];
628
628
  }
629
629
 
630
+ // ─── User Preset DTOs ───────────────────────────────────────────────────
631
+
632
+ export type PromptVariableDefDTO =
633
+ | {
634
+ id: string;
635
+ name: string;
636
+ label: string;
637
+ type: "text";
638
+ defaultValue: string;
639
+ description?: string;
640
+ }
641
+ | {
642
+ id: string;
643
+ name: string;
644
+ label: string;
645
+ type: "textarea";
646
+ defaultValue: string;
647
+ rows?: number;
648
+ description?: string;
649
+ }
650
+ | {
651
+ id: string;
652
+ name: string;
653
+ label: string;
654
+ type: "number";
655
+ defaultValue: number;
656
+ min?: number;
657
+ max?: number;
658
+ step?: number;
659
+ description?: string;
660
+ }
661
+ | {
662
+ id: string;
663
+ name: string;
664
+ label: string;
665
+ type: "slider";
666
+ defaultValue: number;
667
+ min: number;
668
+ max: number;
669
+ step?: number;
670
+ description?: string;
671
+ };
672
+
673
+ export type PromptVariableValueDTO = string | number;
674
+ export type PromptVariableValuesDTO = Record<string, Record<string, PromptVariableValueDTO>>;
675
+ export type PromptBlockRoleDTO = "system" | "user" | "assistant" | "user_append" | "assistant_append";
676
+ export type PromptBlockPositionDTO = "pre_history" | "post_history" | "in_history";
677
+ export type PromptBlockCategoryModeDTO = "radio" | "checkbox" | null;
678
+
679
+ export interface PromptBlockDTO {
680
+ id: string;
681
+ name: string;
682
+ content: string;
683
+ role: PromptBlockRoleDTO;
684
+ enabled: boolean;
685
+ position: PromptBlockPositionDTO;
686
+ depth: number;
687
+ /** `"category"` marks a structural category header; other strings are structural insertion markers. */
688
+ marker: string | null;
689
+ isLocked: boolean;
690
+ color: string | null;
691
+ injectionTrigger: string[];
692
+ group: string | null;
693
+ /** Only meaningful when `marker === "category"`. Radio categories allow one enabled child; checkbox categories allow many. */
694
+ categoryMode?: PromptBlockCategoryModeDTO;
695
+ variables?: PromptVariableDefDTO[];
696
+ }
697
+
698
+ export interface PromptBlockCategoryGroupDTO {
699
+ /** The category header block, or null for uncategorized leading blocks. */
700
+ categoryBlock: PromptBlockDTO | null;
701
+ /** Non-category blocks after the header until the next category header. */
702
+ children: PromptBlockDTO[];
703
+ }
704
+
705
+ export interface UserPresetDTO {
706
+ id: string;
707
+ name: string;
708
+ provider: string;
709
+ engine: string;
710
+ parameters: Record<string, unknown>;
711
+ prompt_order: PromptBlockDTO[];
712
+ prompts: Record<string, unknown>;
713
+ metadata: Record<string, unknown>;
714
+ created_at: number;
715
+ updated_at: number;
716
+ }
717
+
718
+ export interface UserPresetCreateDTO {
719
+ name: string;
720
+ provider: string;
721
+ engine?: string;
722
+ parameters?: Record<string, unknown>;
723
+ prompt_order?: PromptBlockDTO[];
724
+ prompts?: Record<string, unknown>;
725
+ metadata?: Record<string, unknown>;
726
+ }
727
+
728
+ export type UserPresetUpdateDTO = Partial<UserPresetCreateDTO>;
729
+ export type PromptBlockCreateDTO = Partial<PromptBlockDTO>;
730
+ export type PromptBlockUpdateDTO = Partial<Omit<PromptBlockDTO, "id">>;
731
+
630
732
  // ─── World Book DTOs ─────────────────────────────────────────────────────
631
733
 
632
734
  /**
@@ -2114,6 +2216,18 @@ export type WorkerToHost =
2114
2216
  | { type: "chats_get_active"; requestId: string; userId?: string }
2115
2217
  | { type: "chats_update"; requestId: string; chatId: string; input: ChatUpdateDTO; userId?: string }
2116
2218
  | { type: "chats_delete"; requestId: string; chatId: string; userId?: string }
2219
+ // ─── User Presets (gated: "presets") ────────────────────────────────
2220
+ | { type: "presets_list"; requestId: string; limit?: number; offset?: number; userId?: string }
2221
+ | { type: "presets_get"; requestId: string; presetId: string; userId?: string }
2222
+ | { type: "presets_create"; requestId: string; input: UserPresetCreateDTO; userId?: string }
2223
+ | { type: "presets_update"; requestId: string; presetId: string; input: UserPresetUpdateDTO; userId?: string }
2224
+ | { type: "presets_delete"; requestId: string; presetId: string; userId?: string }
2225
+ | { type: "preset_blocks_list"; requestId: string; presetId: string; userId?: string }
2226
+ | { type: "preset_blocks_get"; requestId: string; presetId: string; blockId: string; userId?: string }
2227
+ | { type: "preset_blocks_create"; requestId: string; presetId: string; input: PromptBlockCreateDTO; index?: number; userId?: string }
2228
+ | { type: "preset_blocks_update"; requestId: string; presetId: string; blockId: string; input: PromptBlockUpdateDTO; userId?: string }
2229
+ | { type: "preset_blocks_delete"; requestId: string; presetId: string; blockId: string; userId?: string }
2230
+ | { type: "preset_categories_list"; requestId: string; presetId: string; userId?: string }
2117
2231
  // ─── World Books (gated: "world_books") ──────────────────────────────
2118
2232
  | { type: "world_books_list"; requestId: string; limit?: number; offset?: number; userId?: string }
2119
2233
  | { type: "world_books_get"; requestId: string; worldBookId: string; userId?: string }
package/src/dom.ts CHANGED
@@ -132,7 +132,7 @@ export interface SpindleDockPanelHandle {
132
132
 
133
133
  export interface SpindleAppMountOptions {
134
134
  className?: string;
135
- position?: "start" | "end";
135
+ position?: "start" | "end" | "app-overlay";
136
136
  }
137
137
 
138
138
  export interface SpindleAppMountHandle {
package/src/index.ts CHANGED
@@ -36,11 +36,24 @@ export type {
36
36
  CharacterCreateDTO,
37
37
  CharacterAvatarUploadDTO,
38
38
  CharacterUpdateDTO,
39
- ChatDTO,
40
- ChatUpdateDTO,
41
- ChatSwitchedPayloadDTO,
42
- ChatChangedPayloadDTO,
43
- WorldBookDTO,
39
+ ChatDTO,
40
+ ChatUpdateDTO,
41
+ ChatSwitchedPayloadDTO,
42
+ ChatChangedPayloadDTO,
43
+ PromptVariableDefDTO,
44
+ PromptVariableValueDTO,
45
+ PromptVariableValuesDTO,
46
+ PromptBlockRoleDTO,
47
+ PromptBlockPositionDTO,
48
+ PromptBlockCategoryModeDTO,
49
+ PromptBlockDTO,
50
+ PromptBlockCreateDTO,
51
+ PromptBlockUpdateDTO,
52
+ PromptBlockCategoryGroupDTO,
53
+ UserPresetDTO,
54
+ UserPresetCreateDTO,
55
+ UserPresetUpdateDTO,
56
+ WorldBookDTO,
44
57
  WorldBookCreateDTO,
45
58
  WorldBookUpdateDTO,
46
59
  WorldBookEntryDTO,
@@ -12,6 +12,7 @@
12
12
  * - "generation_parameters" — inject parameters into in-flight generations via interceptors
13
13
  * - "characters" — CRUD on character cards
14
14
  * - "chats" — CRUD on chat sessions
15
+ * - "presets" — CRUD on user presets and prompt blocks
15
16
  * - "personas" — CRUD on personas
16
17
  * - "databanks" — CRUD on databanks and their documents
17
18
  * - "macro_interceptor" — transform raw templates before macro parsing/dispatch
@@ -30,6 +31,7 @@ export type SpindlePermission =
30
31
  | "oauth"
31
32
  | "characters"
32
33
  | "chats"
34
+ | "presets"
33
35
  | "world_books"
34
36
  | "regex_scripts"
35
37
  | "databanks"
@@ -54,6 +56,7 @@ export const ALL_PERMISSIONS: readonly SpindlePermission[] = [
54
56
  "oauth",
55
57
  "characters",
56
58
  "chats",
59
+ "presets",
57
60
  "world_books",
58
61
  "regex_scripts",
59
62
  "databanks",
@@ -22,6 +22,13 @@ import type {
22
22
  CharacterUpdateDTO,
23
23
  ChatDTO,
24
24
  ChatUpdateDTO,
25
+ UserPresetDTO,
26
+ UserPresetCreateDTO,
27
+ UserPresetUpdateDTO,
28
+ PromptBlockDTO,
29
+ PromptBlockCreateDTO,
30
+ PromptBlockUpdateDTO,
31
+ PromptBlockCategoryGroupDTO,
25
32
  WorldBookDTO,
26
33
  WorldBookCreateDTO,
27
34
  WorldBookUpdateDTO,
@@ -730,6 +737,34 @@ export interface SpindleAPI {
730
737
  getMemories(chatId: string, options?: { topK?: number; userId?: string }): Promise<ChatMemoryResultDTO>;
731
738
  };
732
739
 
740
+ /**
741
+ * User Presets CRUD (permission: "presets").
742
+ * Preset categories are structural prompt blocks where `marker === "category"`;
743
+ * their children are the following non-category prompt blocks until the next
744
+ * category marker. Use `categories.list()` for the host-derived grouping, and
745
+ * use block CRUD to create/update/delete both normal prompt blocks and category
746
+ * marker blocks.
747
+ * For user-scoped extensions, userId is inferred from the extension owner.
748
+ * For operator-scoped extensions, pass userId to scope to a specific user.
749
+ */
750
+ presets: {
751
+ list(options?: { limit?: number; offset?: number; userId?: string }): Promise<{ data: UserPresetDTO[]; total: number }>;
752
+ get(presetId: string, userId?: string): Promise<UserPresetDTO | null>;
753
+ create(input: UserPresetCreateDTO, userId?: string): Promise<UserPresetDTO>;
754
+ update(presetId: string, input: UserPresetUpdateDTO, userId?: string): Promise<UserPresetDTO>;
755
+ delete(presetId: string, userId?: string): Promise<boolean>;
756
+ blocks: {
757
+ list(presetId: string, userId?: string): Promise<PromptBlockDTO[]>;
758
+ get(presetId: string, blockId: string, userId?: string): Promise<PromptBlockDTO | null>;
759
+ create(presetId: string, input: PromptBlockCreateDTO, options?: { index?: number; userId?: string }): Promise<PromptBlockDTO>;
760
+ update(presetId: string, blockId: string, input: PromptBlockUpdateDTO, userId?: string): Promise<PromptBlockDTO>;
761
+ delete(presetId: string, blockId: string, userId?: string): Promise<boolean>;
762
+ };
763
+ categories: {
764
+ list(presetId: string, userId?: string): Promise<PromptBlockCategoryGroupDTO[]>;
765
+ };
766
+ };
767
+
733
768
  /**
734
769
  * World Books CRUD (permission: "world_books").
735
770
  * Full access to world books and their entries.