lumiverse-spindle-types 0.5.30 → 0.6.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/package.json +1 -2
- package/src/api.ts +34 -0
- package/src/dom.ts +62 -1
- package/src/index.ts +8 -0
- package/src/spindle-api.ts +14 -0
package/package.json
CHANGED
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;
|
|
@@ -1650,6 +1652,32 @@ export interface DryRunResultDTO {
|
|
|
1650
1652
|
memoryStats?: MemoryStatsDTO;
|
|
1651
1653
|
}
|
|
1652
1654
|
|
|
1655
|
+
// ─── Assembly-only DTOs ────────────────────────────────────────────────
|
|
1656
|
+
|
|
1657
|
+
/**
|
|
1658
|
+
* Assemble an extension-supplied Loom block graph against a real chat context
|
|
1659
|
+
* without invoking the pre-generation context/interceptor pipeline or an LLM.
|
|
1660
|
+
*/
|
|
1661
|
+
export interface AssembleRequestDTO {
|
|
1662
|
+
/** Native Loom prompt blocks to assemble. These replace the saved preset's block graph. */
|
|
1663
|
+
blocks: PromptBlockDTO[];
|
|
1664
|
+
/** Chat supplying history, character, world-info, and macro context. */
|
|
1665
|
+
chatId: string;
|
|
1666
|
+
connectionId?: string;
|
|
1667
|
+
personaId?: string;
|
|
1668
|
+
/** Defaults to `"normal"`. */
|
|
1669
|
+
generationType?: string;
|
|
1670
|
+
/** Per-block prompt-variable values, keyed by block id then variable name. */
|
|
1671
|
+
promptVariables?: PromptVariableValuesDTO;
|
|
1672
|
+
/** Cancel an in-flight assembly. Consumed in the extension worker and not cloned over RPC. */
|
|
1673
|
+
signal?: AbortSignal;
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
export interface AssembleResultDTO {
|
|
1677
|
+
messages: LlmMessageDTO[];
|
|
1678
|
+
breakdown: AssemblyBreakdownEntryDTO[];
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1653
1681
|
// ─── Chat Memory DTOs ──────────────────────────────────────────────────
|
|
1654
1682
|
|
|
1655
1683
|
export interface ChatMemoryChunkDTO {
|
|
@@ -2546,6 +2574,12 @@ export type WorkerToHost =
|
|
|
2546
2574
|
parameters?: Record<string, unknown>;
|
|
2547
2575
|
breakdown?: InterceptorBreakdownEntryDTO[];
|
|
2548
2576
|
}
|
|
2577
|
+
| {
|
|
2578
|
+
type: "assemble_prompt";
|
|
2579
|
+
requestId: string;
|
|
2580
|
+
input: Omit<AssembleRequestDTO, "signal">;
|
|
2581
|
+
userId?: string;
|
|
2582
|
+
}
|
|
2549
2583
|
| { type: "register_tool"; tool: ToolRegistrationDTO }
|
|
2550
2584
|
| { type: "unregister_tool"; name: string }
|
|
2551
2585
|
| { type: "request_generation"; requestId: string; input: GenerationRequestDTO }
|
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
|
@@ -104,6 +104,8 @@ export type {
|
|
|
104
104
|
WorldInfoActivatedEventDTO,
|
|
105
105
|
DryRunRequestDTO,
|
|
106
106
|
DryRunResultDTO,
|
|
107
|
+
AssembleRequestDTO,
|
|
108
|
+
AssembleResultDTO,
|
|
107
109
|
AssemblyBreakdownEntryDTO,
|
|
108
110
|
ActivationStatsDTO,
|
|
109
111
|
MemoryStatsDTO,
|
|
@@ -215,6 +217,12 @@ export type {
|
|
|
215
217
|
SpindleCharacterEditorState,
|
|
216
218
|
SpindleCharacterEditorSaveOptions,
|
|
217
219
|
SpindleCharacterEditorHelper,
|
|
220
|
+
SpindlePresetEditorTabOptions,
|
|
221
|
+
SpindlePresetEditorTabHandle,
|
|
222
|
+
SpindlePresetEditorDraft,
|
|
223
|
+
SpindlePresetEditorState,
|
|
224
|
+
SpindlePresetEditorSaveOptions,
|
|
225
|
+
SpindlePresetEditorHelper,
|
|
218
226
|
SpindleFloatWidgetOptions,
|
|
219
227
|
SpindleFloatWidgetHandle,
|
|
220
228
|
SpindleDockEdge,
|
package/src/spindle-api.ts
CHANGED
|
@@ -55,6 +55,8 @@ import type {
|
|
|
55
55
|
ActivatedWorldInfoEntryDTO,
|
|
56
56
|
DryRunRequestDTO,
|
|
57
57
|
DryRunResultDTO,
|
|
58
|
+
AssembleRequestDTO,
|
|
59
|
+
AssembleResultDTO,
|
|
58
60
|
ChatMemoryResultDTO,
|
|
59
61
|
ImageGenRequestDTO,
|
|
60
62
|
ImageGenResultDTO,
|
|
@@ -318,6 +320,13 @@ export interface SpindleAPI {
|
|
|
318
320
|
priority?: number
|
|
319
321
|
): void;
|
|
320
322
|
|
|
323
|
+
/**
|
|
324
|
+
* Assemble an arbitrary Loom block graph against a chat without calling an
|
|
325
|
+
* LLM or re-entering the pre-generation context/interceptor pipeline.
|
|
326
|
+
* Requires the `generation` permission.
|
|
327
|
+
*/
|
|
328
|
+
assemble(input: AssembleRequestDTO, userId?: string): Promise<AssembleResultDTO>;
|
|
329
|
+
|
|
321
330
|
/**
|
|
322
331
|
* Declare the chats whose `target:prompt` regex this extension applies itself; the
|
|
323
332
|
* host skips its own pass for them.
|
|
@@ -790,6 +799,11 @@ export interface SpindleAPI {
|
|
|
790
799
|
uploadFromDataUrl(dataUrl: string, originalFilename?: string, userId?: string): Promise<ImageDTO>;
|
|
791
800
|
uploadFromDataUrl(dataUrl: string, options?: ImageUploadFromDataUrlOptionsDTO): Promise<ImageDTO>;
|
|
792
801
|
delete(imageId: string, userId?: string): Promise<boolean>;
|
|
802
|
+
/**
|
|
803
|
+
* Bulk delete: chunked DB deletes with file unlinks deferred to a background
|
|
804
|
+
* task, no per-image IMAGE_DELETED events. Returns the number of rows deleted.
|
|
805
|
+
*/
|
|
806
|
+
deleteMany(imageIds: string[], options?: { userId?: string }): Promise<number>;
|
|
793
807
|
};
|
|
794
808
|
|
|
795
809
|
/**
|