lumiverse-spindle-types 0.5.31 → 0.6.1

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,7 +1,6 @@
1
1
  {
2
2
  "name": "lumiverse-spindle-types",
3
-
4
- "version": "0.5.31",
3
+ "version": "0.6.1",
5
4
  "types": "./src/index.ts",
6
5
  "keywords": [
7
6
  "lumiverse",
package/src/api.ts CHANGED
@@ -1086,6 +1086,8 @@ export interface PromptBlockDTO {
1086
1086
  isLocked: boolean;
1087
1087
  color: string | null;
1088
1088
  injectionTrigger: string[];
1089
+ /** Optional character-tag filter. The block is included when the focused character matches. */
1090
+ characterTagTrigger?: string[];
1089
1091
  group: string | null;
1090
1092
  /** Only meaningful when `marker === "category"`. Radio categories allow one enabled child; checkbox categories allow many. */
1091
1093
  categoryMode?: PromptBlockCategoryModeDTO;
@@ -1479,6 +1481,70 @@ export interface LumiaItemDTO {
1479
1481
  updated_at: number;
1480
1482
  }
1481
1483
 
1484
+ /** A Loom item category included in a Lumia DLC pack. */
1485
+ export type LoomItemCategoryDTO = "narrative_style" | "loom_utility" | "retrofit";
1486
+
1487
+ /** A narrative style, utility, or retrofit included in a Lumia DLC pack. */
1488
+ export interface LoomItemDTO {
1489
+ id: string;
1490
+ pack_id: string;
1491
+ name: string;
1492
+ content: string;
1493
+ category: LoomItemCategoryDTO;
1494
+ author_name: string;
1495
+ version: string;
1496
+ sort_order: number;
1497
+ created_at: number;
1498
+ updated_at: number;
1499
+ }
1500
+
1501
+ /** A tool included in a Lumia DLC pack. */
1502
+ export interface LoomToolDTO {
1503
+ id: string;
1504
+ pack_id: string;
1505
+ tool_name: string;
1506
+ display_name: string;
1507
+ description: string;
1508
+ prompt: string;
1509
+ input_schema: Record<string, unknown>;
1510
+ result_variable: string;
1511
+ store_in_deliberation: boolean;
1512
+ author_name: string;
1513
+ version: string;
1514
+ sort_order: number;
1515
+ created_at: number;
1516
+ updated_at: number;
1517
+ }
1518
+
1519
+ /**
1520
+ * Extension-safe metadata for a pack in the user's Lumia DLC catalog.
1521
+ * Ownership and the arbitrary pack `extras` blob are intentionally omitted.
1522
+ */
1523
+ export interface LumiaDlcPackDTO {
1524
+ id: string;
1525
+ name: string;
1526
+ author: string;
1527
+ cover_url: string | null;
1528
+ version: string;
1529
+ is_custom: boolean;
1530
+ source_url: string | null;
1531
+ created_at: number;
1532
+ updated_at: number;
1533
+ }
1534
+
1535
+ /**
1536
+ * All Lumia DLC content currently available to one user. Item `pack_id`
1537
+ * values refer to an entry in `packs`.
1538
+ */
1539
+ export interface LumiaDlcCatalogDTO {
1540
+ packs: LumiaDlcPackDTO[];
1541
+ lumiaItems: LumiaItemDTO[];
1542
+ narrativeStyles: LoomItemDTO[];
1543
+ utilities: LoomItemDTO[];
1544
+ retrofits: LoomItemDTO[];
1545
+ tools: LoomToolDTO[];
1546
+ }
1547
+
1482
1548
  export interface PersonaDTO {
1483
1549
  id: string;
1484
1550
  name: string;
@@ -1650,6 +1716,32 @@ export interface DryRunResultDTO {
1650
1716
  memoryStats?: MemoryStatsDTO;
1651
1717
  }
1652
1718
 
1719
+ // ─── Assembly-only DTOs ────────────────────────────────────────────────
1720
+
1721
+ /**
1722
+ * Assemble an extension-supplied Loom block graph against a real chat context
1723
+ * without invoking the pre-generation context/interceptor pipeline or an LLM.
1724
+ */
1725
+ export interface AssembleRequestDTO {
1726
+ /** Native Loom prompt blocks to assemble. These replace the saved preset's block graph. */
1727
+ blocks: PromptBlockDTO[];
1728
+ /** Chat supplying history, character, world-info, and macro context. */
1729
+ chatId: string;
1730
+ connectionId?: string;
1731
+ personaId?: string;
1732
+ /** Defaults to `"normal"`. */
1733
+ generationType?: string;
1734
+ /** Per-block prompt-variable values, keyed by block id then variable name. */
1735
+ promptVariables?: PromptVariableValuesDTO;
1736
+ /** Cancel an in-flight assembly. Consumed in the extension worker and not cloned over RPC. */
1737
+ signal?: AbortSignal;
1738
+ }
1739
+
1740
+ export interface AssembleResultDTO {
1741
+ messages: LlmMessageDTO[];
1742
+ breakdown: AssemblyBreakdownEntryDTO[];
1743
+ }
1744
+
1653
1745
  // ─── Chat Memory DTOs ──────────────────────────────────────────────────
1654
1746
 
1655
1747
  export interface ChatMemoryChunkDTO {
@@ -2546,6 +2638,12 @@ export type WorkerToHost =
2546
2638
  parameters?: Record<string, unknown>;
2547
2639
  breakdown?: InterceptorBreakdownEntryDTO[];
2548
2640
  }
2641
+ | {
2642
+ type: "assemble_prompt";
2643
+ requestId: string;
2644
+ input: Omit<AssembleRequestDTO, "signal">;
2645
+ userId?: string;
2646
+ }
2549
2647
  | { type: "register_tool"; tool: ToolRegistrationDTO }
2550
2648
  | { type: "unregister_tool"; name: string }
2551
2649
  | { type: "request_generation"; requestId: string; input: GenerationRequestDTO }
@@ -2875,6 +2973,8 @@ export type WorkerToHost =
2875
2973
  | { type: "council_get_settings"; requestId: string; userId?: string }
2876
2974
  | { type: "council_get_members"; requestId: string; userId?: string }
2877
2975
  | { type: "council_get_available_lumia_items"; requestId: string; userId?: string }
2976
+ // ─── Lumia DLC (free tier, read-only) ──────────────────────────────
2977
+ | { type: "dlc_get_catalog"; requestId: string; userId?: string }
2878
2978
  // ─── Activated World Info (gated: "world_books") ───────────────────
2879
2979
  | { type: "world_books_get_activated"; requestId: string; chatId: string; userId?: string }
2880
2980
  // ─── Global World Books (gated: "world_books") ───────────────────────
package/src/dom.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { RequestInitDTO } from "./api";
1
+ import type { PromptBlockDTO, RequestInitDTO } from "./api";
2
2
  import type { SpindleComponentsHelper } from "./components";
3
3
 
4
4
  /** A chat-message DOM element paired with its stable message id. */
@@ -202,6 +202,65 @@ export interface SpindleCharacterEditorHelper {
202
202
  flush(): Promise<void>;
203
203
  }
204
204
 
205
+ // ── Preset Editor Tab ──
206
+
207
+ export interface SpindlePresetEditorTabOptions {
208
+ /** Unique tab identifier within the current extension. */
209
+ id: string;
210
+ /** Label shown in the Loom preset editor tab bar. */
211
+ title: string;
212
+ }
213
+
214
+ export interface SpindlePresetEditorTabHandle {
215
+ root: HTMLElement;
216
+ tabId: string;
217
+ setTitle(title: string): void;
218
+ activate(): void;
219
+ destroy(): void;
220
+ /** Register a callback fired when the active preset-editor tab switches to this tab. */
221
+ onActivate(handler: () => void): () => void;
222
+ }
223
+
224
+ /** Mutable, editor-native snapshot of the current Loom preset draft. */
225
+ export interface SpindlePresetEditorDraft {
226
+ id: string;
227
+ name: string;
228
+ blocks: PromptBlockDTO[];
229
+ parameters: Record<string, unknown>;
230
+ prompts: Record<string, unknown>;
231
+ metadata: Record<string, unknown>;
232
+ createdAt: number;
233
+ updatedAt: number;
234
+ }
235
+
236
+ export interface SpindlePresetEditorState {
237
+ /** Whether a Loom preset editor instance is currently mounted. */
238
+ open: boolean;
239
+ /** Preset currently being edited, or `null` when none is selected. */
240
+ presetId: string | null;
241
+ /** Active built-in or extension tab id inside the preset editor. */
242
+ activeTabId: string | null;
243
+ /** Current draft. Callers receive a structured clone. */
244
+ preset: SpindlePresetEditorDraft | null;
245
+ }
246
+
247
+ export interface SpindlePresetEditorSaveOptions {
248
+ /** Persist immediately instead of using the host's debounced save path. */
249
+ immediate?: boolean;
250
+ }
251
+
252
+ export interface SpindlePresetEditorHelper {
253
+ getState(): SpindlePresetEditorState;
254
+ onChange(handler: (state: SpindlePresetEditorState) => void): () => void;
255
+ /** Atomically derive the next editor draft from the latest pending draft. */
256
+ updatePreset(
257
+ mutator: (preset: SpindlePresetEditorDraft) => SpindlePresetEditorDraft,
258
+ options?: SpindlePresetEditorSaveOptions,
259
+ ): void;
260
+ /** Immediately persist and await any pending draft changes. */
261
+ flush(): Promise<void>;
262
+ }
263
+
205
264
  // ── Float Widget ──
206
265
 
207
266
  export interface SpindleFloatWidgetOptions {
@@ -764,6 +823,8 @@ export interface SpindleFrontendContext {
764
823
  registerDrawerTab(options: SpindleDrawerTabOptions): SpindleDrawerTabHandle;
765
824
  registerCharacterEditorTab(options: SpindleCharacterEditorTabOptions): SpindleCharacterEditorTabHandle;
766
825
  characterEditor: SpindleCharacterEditorHelper;
826
+ registerPresetEditorTab(options: SpindlePresetEditorTabOptions): SpindlePresetEditorTabHandle;
827
+ presetEditor: SpindlePresetEditorHelper;
767
828
  createFloatWidget(options?: SpindleFloatWidgetOptions): SpindleFloatWidgetHandle;
768
829
  requestDockPanel(options: SpindleDockPanelOptions): SpindleDockPanelHandle;
769
830
  mountApp(options?: SpindleAppMountOptions): SpindleAppMountHandle;
package/src/index.ts CHANGED
@@ -97,6 +97,11 @@ export type {
97
97
  GlobalAddonDTO,
98
98
  GlobalAddonUpdateDTO,
99
99
  LumiaItemDTO,
100
+ LoomItemCategoryDTO,
101
+ LoomItemDTO,
102
+ LoomToolDTO,
103
+ LumiaDlcPackDTO,
104
+ LumiaDlcCatalogDTO,
100
105
  PersonaCreateDTO,
101
106
  PersonaUpdateDTO,
102
107
  ActivatedWorldInfoEntryDTO,
@@ -104,6 +109,8 @@ export type {
104
109
  WorldInfoActivatedEventDTO,
105
110
  DryRunRequestDTO,
106
111
  DryRunResultDTO,
112
+ AssembleRequestDTO,
113
+ AssembleResultDTO,
107
114
  AssemblyBreakdownEntryDTO,
108
115
  ActivationStatsDTO,
109
116
  MemoryStatsDTO,
@@ -215,6 +222,12 @@ export type {
215
222
  SpindleCharacterEditorState,
216
223
  SpindleCharacterEditorSaveOptions,
217
224
  SpindleCharacterEditorHelper,
225
+ SpindlePresetEditorTabOptions,
226
+ SpindlePresetEditorTabHandle,
227
+ SpindlePresetEditorDraft,
228
+ SpindlePresetEditorState,
229
+ SpindlePresetEditorSaveOptions,
230
+ SpindlePresetEditorHelper,
218
231
  SpindleFloatWidgetOptions,
219
232
  SpindleFloatWidgetHandle,
220
233
  SpindleDockEdge,
@@ -50,11 +50,14 @@ import type {
50
50
  GlobalAddonDTO,
51
51
  GlobalAddonUpdateDTO,
52
52
  LumiaItemDTO,
53
+ LumiaDlcCatalogDTO,
53
54
  PersonaCreateDTO,
54
55
  PersonaUpdateDTO,
55
56
  ActivatedWorldInfoEntryDTO,
56
57
  DryRunRequestDTO,
57
58
  DryRunResultDTO,
59
+ AssembleRequestDTO,
60
+ AssembleResultDTO,
58
61
  ChatMemoryResultDTO,
59
62
  ImageGenRequestDTO,
60
63
  ImageGenResultDTO,
@@ -318,6 +321,13 @@ export interface SpindleAPI {
318
321
  priority?: number
319
322
  ): void;
320
323
 
324
+ /**
325
+ * Assemble an arbitrary Loom block graph against a chat without calling an
326
+ * LLM or re-entering the pre-generation context/interceptor pipeline.
327
+ * Requires the `generation` permission.
328
+ */
329
+ assemble(input: AssembleRequestDTO, userId?: string): Promise<AssembleResultDTO>;
330
+
321
331
  /**
322
332
  * Declare the chats whose `target:prompt` regex this extension applies itself; the
323
333
  * host skips its own pass for them.
@@ -1187,6 +1197,15 @@ export interface SpindleAPI {
1187
1197
  getAvailableLumiaItems(options?: { userId?: string }): Promise<LumiaItemDTO[]>;
1188
1198
  };
1189
1199
 
1200
+ /**
1201
+ * Read-only Lumia DLC catalog (no permission declaration required).
1202
+ * Includes pack metadata, Lumias, narrative styles, Loom utilities,
1203
+ * retrofits, and Loom tools available to the effective user.
1204
+ */
1205
+ dlc: {
1206
+ getCatalog(options?: { userId?: string }): Promise<LumiaDlcCatalogDTO>;
1207
+ };
1208
+
1190
1209
  personas: {
1191
1210
  list(options?: { limit?: number; offset?: number; userId?: string }): Promise<{ data: PersonaDTO[]; total: number }>;
1192
1211
  get(personaId: string, userId?: string): Promise<PersonaDTO | null>;