lumiverse-spindle-types 0.4.42 → 0.4.44

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.42",
3
+ "version": "0.4.44",
4
4
  "types": "./src/index.ts",
5
5
  "keywords": [
6
6
  "lumiverse",
package/src/api.ts CHANGED
@@ -579,6 +579,71 @@ export interface WorldBookEntryCreateDTO {
579
579
 
580
580
  export type WorldBookEntryUpdateDTO = WorldBookEntryCreateDTO;
581
581
 
582
+ // ─── Databank DTOs ───────────────────────────────────────────────────────
583
+
584
+ export type DatabankScopeDTO = "global" | "character" | "chat";
585
+ export type DatabankDocumentStatusDTO = "pending" | "processing" | "ready" | "error";
586
+
587
+ /** Safe representation of a databank exposed to extensions. */
588
+ export interface DatabankDTO {
589
+ id: string;
590
+ name: string;
591
+ description: string;
592
+ scope: DatabankScopeDTO;
593
+ scope_id: string | null;
594
+ enabled: boolean;
595
+ metadata: Record<string, unknown>;
596
+ document_count?: number;
597
+ created_at: number;
598
+ updated_at: number;
599
+ }
600
+
601
+ export interface DatabankCreateDTO {
602
+ name: string;
603
+ description?: string;
604
+ scope: DatabankScopeDTO;
605
+ scope_id?: string | null;
606
+ }
607
+
608
+ export interface DatabankUpdateDTO {
609
+ name?: string;
610
+ description?: string;
611
+ enabled?: boolean;
612
+ }
613
+
614
+ /** Safe representation of a databank document exposed to extensions. */
615
+ export interface DatabankDocumentDTO {
616
+ id: string;
617
+ databank_id: string;
618
+ name: string;
619
+ slug: string;
620
+ mime_type: string;
621
+ file_size: number;
622
+ content_hash: string;
623
+ total_chunks: number;
624
+ status: DatabankDocumentStatusDTO;
625
+ error_message: string | null;
626
+ metadata: Record<string, unknown>;
627
+ created_at: number;
628
+ updated_at: number;
629
+ }
630
+
631
+ export interface DatabankDocumentCreateDTO {
632
+ /** Raw file bytes. */
633
+ data: Uint8Array;
634
+ /** Original filename including extension. */
635
+ filename: string;
636
+ /** Optional MIME type recorded on the document. */
637
+ mime_type?: string;
638
+ /** Optional display name override. Defaults to the filename without extension. */
639
+ name?: string;
640
+ }
641
+
642
+ export interface DatabankDocumentUpdateDTO {
643
+ /** Renames the document display name (and derived slug). */
644
+ name: string;
645
+ }
646
+
582
647
  // ─── Persona DTOs ──────────────────────────────────────────────────────
583
648
 
584
649
  /**
@@ -943,7 +1008,8 @@ export interface ThemeVariablesConfigDTO {
943
1008
  * This is the safe, presentation-owned path for live extension theming.
944
1009
  * Extensions provide palette intent only; Lumiverse preserves the user's
945
1010
  * radius, glass, font, and UI-scale settings and generates the final
946
- * mode-aware variable maps itself.
1011
+ * mode-aware variable maps itself. Pass `null` to clear a previously applied
1012
+ * palette override when no valid color data is available.
947
1013
  */
948
1014
  export interface ThemePaletteConfigDTO {
949
1015
  /** Primary accent color in HSL. */
@@ -1016,6 +1082,93 @@ export interface SpindleCommandContextDTO {
1016
1082
  isGroupChat?: boolean;
1017
1083
  }
1018
1084
 
1085
+ // ─── Frontend Process Lifecycle DTOs ────────────────────────────────────
1086
+
1087
+ /** High-level lifecycle state for a frontend process tracked by the backend host. */
1088
+ export type FrontendProcessStateDTO =
1089
+ | "starting"
1090
+ | "running"
1091
+ | "stopping"
1092
+ | "stopped"
1093
+ | "completed"
1094
+ | "failed"
1095
+ | "timed_out";
1096
+
1097
+ /** Terminal reason attached to lifecycle events and snapshots when available. */
1098
+ export type FrontendProcessExitReasonDTO =
1099
+ | "completed"
1100
+ | "failed"
1101
+ | "stopped"
1102
+ | "timed_out"
1103
+ | "frontend_unloaded"
1104
+ | "backend_unloaded"
1105
+ | "replaced";
1106
+
1107
+ /** Options used when spawning a tracked frontend process from the backend worker. */
1108
+ export interface FrontendProcessSpawnOptionsDTO {
1109
+ /** Frontend handler key registered via `ctx.processes.register(kind, ...)`. */
1110
+ kind: string;
1111
+ /** Optional extension-defined stable key used for dedupe / replacement semantics. */
1112
+ key?: string;
1113
+ /** Optional process-scoped startup payload delivered to the frontend handler. */
1114
+ payload?: unknown;
1115
+ /** Arbitrary metadata stored alongside the process snapshot for backend bookkeeping. */
1116
+ metadata?: Record<string, unknown>;
1117
+ /** For operator-scoped extensions only. */
1118
+ userId?: string;
1119
+ /** Reject spawn if the frontend does not call `process.ready()` within this window. */
1120
+ startupTimeoutMs?: number;
1121
+ /** Mark the process timed out if the frontend stops heartbeating for this long after ready. */
1122
+ heartbeatTimeoutMs?: number;
1123
+ /** Replace any existing process with the same `key` for the target user. */
1124
+ replaceExisting?: boolean;
1125
+ }
1126
+
1127
+ /** Filter used for controller list queries. */
1128
+ export interface FrontendProcessListOptionsDTO {
1129
+ userId?: string;
1130
+ kind?: string;
1131
+ key?: string;
1132
+ state?: FrontendProcessStateDTO;
1133
+ }
1134
+
1135
+ /** Current host-tracked snapshot of a frontend process. */
1136
+ export interface FrontendProcessInfoDTO {
1137
+ processId: string;
1138
+ kind: string;
1139
+ key?: string;
1140
+ state: FrontendProcessStateDTO;
1141
+ userId?: string;
1142
+ metadata?: Record<string, unknown>;
1143
+ startedAt: string;
1144
+ readyAt?: string;
1145
+ lastHeartbeatAt?: string;
1146
+ endedAt?: string;
1147
+ exitReason?: FrontendProcessExitReasonDTO;
1148
+ error?: string;
1149
+ }
1150
+
1151
+ /** Lifecycle event emitted to backend workers for tracked frontend processes. */
1152
+ export interface FrontendProcessLifecycleEventDTO {
1153
+ processId: string;
1154
+ kind: string;
1155
+ key?: string;
1156
+ userId?: string;
1157
+ state: FrontendProcessStateDTO;
1158
+ previousState?: FrontendProcessStateDTO;
1159
+ at: string;
1160
+ exitReason?: FrontendProcessExitReasonDTO;
1161
+ error?: string;
1162
+ metadata?: Record<string, unknown>;
1163
+ }
1164
+
1165
+ /** Options for graceful process termination. */
1166
+ export interface FrontendProcessStopOptionsDTO {
1167
+ userId?: string;
1168
+ /** Optional reason surfaced to the frontend process' stop handler. */
1169
+ reason?: string;
1170
+ }
1171
+
1019
1172
  // ─── Generation Event Payload DTOs ──────────────────────────────────────
1020
1173
 
1021
1174
  /** Payload for `GENERATION_STARTED` events. */
@@ -1528,6 +1681,20 @@ export type WorkerToHost =
1528
1681
  | { type: "world_book_entries_create"; requestId: string; worldBookId: string; input: WorldBookEntryCreateDTO; userId?: string }
1529
1682
  | { type: "world_book_entries_update"; requestId: string; entryId: string; input: WorldBookEntryUpdateDTO; userId?: string }
1530
1683
  | { type: "world_book_entries_delete"; requestId: string; entryId: string; userId?: string }
1684
+ // ─── Databanks (gated: "databanks") ───────────────────────────────────
1685
+ | { type: "databanks_list"; requestId: string; limit?: number; offset?: number; scope?: DatabankScopeDTO; scopeId?: string | null; userId?: string }
1686
+ | { type: "databanks_get"; requestId: string; databankId: string; userId?: string }
1687
+ | { type: "databanks_create"; requestId: string; input: DatabankCreateDTO; userId?: string }
1688
+ | { type: "databanks_update"; requestId: string; databankId: string; input: DatabankUpdateDTO; userId?: string }
1689
+ | { type: "databanks_delete"; requestId: string; databankId: string; userId?: string }
1690
+ // ─── Databank Documents (gated: "databanks") ─────────────────────────
1691
+ | { type: "databank_documents_list"; requestId: string; databankId: string; limit?: number; offset?: number; userId?: string }
1692
+ | { type: "databank_documents_get"; requestId: string; documentId: string; userId?: string }
1693
+ | { type: "databank_documents_create"; requestId: string; databankId: string; input: DatabankDocumentCreateDTO; userId?: string }
1694
+ | { type: "databank_documents_update"; requestId: string; documentId: string; input: DatabankDocumentUpdateDTO; userId?: string }
1695
+ | { type: "databank_documents_delete"; requestId: string; documentId: string; userId?: string }
1696
+ | { type: "databank_documents_get_content"; requestId: string; documentId: string; userId?: string }
1697
+ | { type: "databank_documents_reprocess"; requestId: string; documentId: string; userId?: string }
1531
1698
  // ─── Personas (gated: "personas") ────────────────────────────────────
1532
1699
  | { type: "personas_list"; requestId: string; limit?: number; offset?: number; userId?: string }
1533
1700
  | { type: "personas_get"; requestId: string; personaId: string; userId?: string }
@@ -1562,6 +1729,12 @@ export type WorkerToHost =
1562
1729
  | { type: "modal_close"; requestId: string; openRequestId: string; userId?: string }
1563
1730
  | { type: "confirm_open"; requestId: string; title: string; message: string; variant?: "info" | "warning" | "danger" | "success"; confirmLabel?: string; cancelLabel?: string; userId?: string }
1564
1731
  | { type: "input_prompt_open"; requestId: string; title: string; message?: string; placeholder?: string; defaultValue?: string; submitLabel?: string; cancelLabel?: string; multiline?: boolean; userId?: string }
1732
+ // ─── Frontend Process Lifecycle (free tier) ───────────────────────────
1733
+ | { type: "frontend_process_spawn"; requestId: string; options: FrontendProcessSpawnOptionsDTO }
1734
+ | { type: "frontend_process_list"; requestId: string; filter?: FrontendProcessListOptionsDTO }
1735
+ | { type: "frontend_process_get"; requestId: string; processId: string }
1736
+ | { type: "frontend_process_stop"; requestId: string; processId: string; options?: FrontendProcessStopOptionsDTO }
1737
+ | { type: "frontend_process_send"; processId: string; payload: unknown; userId?: string }
1565
1738
  // ─── Macro Resolution (free tier) ──────────────────────────────────
1566
1739
  | { type: "macros_resolve"; requestId: string; template: string; chatId?: string; characterId?: string; userId?: string; commit?: boolean }
1567
1740
  // ─── Image Generation (gated: "image_gen") ──────────────────────────
@@ -1572,7 +1745,7 @@ export type WorkerToHost =
1572
1745
  | { type: "image_gen_models"; requestId: string; connectionId: string; userId?: string }
1573
1746
  // ─── Theme (gated: "app_manipulation") ──────────────────────────────────
1574
1747
  | { type: "theme_apply"; requestId: string; overrides: ThemeOverrideDTO; userId?: string }
1575
- | { type: "theme_apply_palette"; requestId: string; palette: ThemePaletteConfigDTO; userId?: string }
1748
+ | { type: "theme_apply_palette"; requestId: string; palette: ThemePaletteConfigDTO | null; userId?: string }
1576
1749
  | { type: "theme_clear"; requestId: string; userId?: string }
1577
1750
  | { type: "theme_get_current"; requestId: string; userId?: string }
1578
1751
  // ─── Color Extraction (gated: "app_manipulation") ─────────────────────
@@ -1678,6 +1851,8 @@ export type HostToWorker =
1678
1851
  }
1679
1852
  | { type: "shutdown" }
1680
1853
  | { type: "frontend_message"; payload: unknown; userId: string }
1854
+ | { type: "frontend_process_lifecycle"; event: FrontendProcessLifecycleEventDTO }
1855
+ | { type: "frontend_process_message"; processId: string; payload: unknown; userId: string }
1681
1856
  | {
1682
1857
  type: "oauth_callback";
1683
1858
  requestId: string;
package/src/dom.ts CHANGED
@@ -326,6 +326,53 @@ export interface SpindleConfirmResult {
326
326
  confirmed: boolean;
327
327
  }
328
328
 
329
+ // ── Frontend Process Lifecycle ──
330
+
331
+ /** Controller passed to a frontend process instance spawned by the backend runtime. */
332
+ export interface SpindleFrontendProcessContext {
333
+ /** Host-assigned ID unique within the extension runtime. */
334
+ processId: string;
335
+ /** Frontend handler key used when the backend called `spindle.frontendProcesses.spawn()`. */
336
+ kind: string;
337
+ /** Optional extension-defined stable key passed at spawn time. */
338
+ key?: string;
339
+ /** Arbitrary spawn payload provided by the backend. */
340
+ payload: unknown;
341
+ /** Optional backend-side bookkeeping metadata snapshot. */
342
+ metadata?: Record<string, unknown>;
343
+ /** Signal that startup completed successfully. Required for startup watchdogs. */
344
+ ready(): void;
345
+ /** Refresh the host-side heartbeat timer for long-lived loops. */
346
+ heartbeat(): void;
347
+ /** Send a process-scoped message back to the backend runtime. */
348
+ send(payload: unknown): void;
349
+ /** Subscribe to process-scoped messages from the backend runtime. */
350
+ onMessage(handler: (payload: unknown) => void): () => void;
351
+ /** Mark the process as completed and release host tracking. */
352
+ complete(result?: unknown): void;
353
+ /** Mark the process as failed. */
354
+ fail(error: string): void;
355
+ /** Called when the backend requests graceful termination. */
356
+ onStop(handler: (detail: { reason?: string }) => void): () => void;
357
+ }
358
+
359
+ /** Registry exposed to frontend modules for backend-spawned frontend processes. */
360
+ export interface SpindleFrontendProcessRegistry {
361
+ /**
362
+ * Register a process handler for the given `kind`.
363
+ *
364
+ * The returned cleanup function unregisters the handler. If the handler
365
+ * itself returns a cleanup function, the host should call it when the
366
+ * process is stopped, replaced, or the extension is unloaded.
367
+ */
368
+ register(
369
+ kind: string,
370
+ handler: (
371
+ process: SpindleFrontendProcessContext,
372
+ ) => void | (() => void) | Promise<void | (() => void)>,
373
+ ): () => void;
374
+ }
375
+
329
376
  /** Context object provided to frontend extension modules */
330
377
  export interface SpindleFrontendContext {
331
378
  dom: SpindleDOMHelper;
@@ -416,6 +463,8 @@ export interface SpindleFrontendContext {
416
463
  getActiveChat(): { chatId: string | null; characterId: string | null };
417
464
  sendToBackend(payload: unknown): void;
418
465
  onBackendMessage(handler: (payload: unknown) => void): () => void;
466
+ /** Structured lifecycle hooks for backend-spawned frontend processes. */
467
+ processes: SpindleFrontendProcessRegistry;
419
468
  messages: {
420
469
  registerTagInterceptor(
421
470
  options: SpindleMessageTagInterceptorOptions,
package/src/index.ts CHANGED
@@ -41,6 +41,14 @@ export type {
41
41
  WorldBookEntryDTO,
42
42
  WorldBookEntryCreateDTO,
43
43
  WorldBookEntryUpdateDTO,
44
+ DatabankScopeDTO,
45
+ DatabankDocumentStatusDTO,
46
+ DatabankDTO,
47
+ DatabankCreateDTO,
48
+ DatabankUpdateDTO,
49
+ DatabankDocumentDTO,
50
+ DatabankDocumentCreateDTO,
51
+ DatabankDocumentUpdateDTO,
44
52
  PersonaDTO,
45
53
  LumiaItemDTO,
46
54
  PersonaCreateDTO,
@@ -67,9 +75,16 @@ export type {
67
75
  ColorRGB,
68
76
  ColorHSL,
69
77
  SpindleModalItemDTO,
70
- SpindleCommandDTO,
71
- SpindleCommandContextDTO,
72
- GenerationStartedPayloadDTO,
78
+ SpindleCommandDTO,
79
+ SpindleCommandContextDTO,
80
+ FrontendProcessStateDTO,
81
+ FrontendProcessExitReasonDTO,
82
+ FrontendProcessSpawnOptionsDTO,
83
+ FrontendProcessListOptionsDTO,
84
+ FrontendProcessInfoDTO,
85
+ FrontendProcessLifecycleEventDTO,
86
+ FrontendProcessStopOptionsDTO,
87
+ GenerationStartedPayloadDTO,
73
88
  StreamTokenPayloadDTO,
74
89
  GenerationEndedPayloadDTO,
75
90
  GenerationStoppedPayloadDTO,
@@ -121,14 +136,16 @@ export type {
121
136
  SpindleContextMenuResult,
122
137
  SpindleModalOptions,
123
138
  SpindleModalHandle,
124
- SpindleConfirmVariant,
125
- SpindleConfirmOptions,
126
- SpindleConfirmResult,
139
+ SpindleConfirmVariant,
140
+ SpindleConfirmOptions,
141
+ SpindleConfirmResult,
142
+ SpindleFrontendProcessContext,
143
+ SpindleFrontendProcessRegistry,
127
144
  } from "./dom";
128
145
 
129
146
  export type { ExtensionInfo } from "./extension-info";
130
147
 
131
- export type { SpindleAPI } from "./spindle-api";
148
+ export type { SpindleAPI, FrontendProcessHandle } from "./spindle-api";
132
149
 
133
150
  export type {
134
151
  CouncilMember,
@@ -13,6 +13,7 @@
13
13
  * - "characters" — CRUD on character cards
14
14
  * - "chats" — CRUD on chat sessions
15
15
  * - "personas" — CRUD on personas
16
+ * - "databanks" — CRUD on databanks and their documents
16
17
  * - "macro_interceptor" — transform raw templates before macro parsing/dispatch
17
18
  */
18
19
  export type SpindlePermission =
@@ -30,6 +31,7 @@ export type SpindlePermission =
30
31
  | "characters"
31
32
  | "chats"
32
33
  | "world_books"
34
+ | "databanks"
33
35
  | "personas"
34
36
  | "push_notification"
35
37
  | "image_gen"
@@ -51,6 +53,7 @@ export const ALL_PERMISSIONS: readonly SpindlePermission[] = [
51
53
  "characters",
52
54
  "chats",
53
55
  "world_books",
56
+ "databanks",
54
57
  "personas",
55
58
  "push_notification",
56
59
  "image_gen",
@@ -27,6 +27,12 @@ import type {
27
27
  WorldBookEntryDTO,
28
28
  WorldBookEntryCreateDTO,
29
29
  WorldBookEntryUpdateDTO,
30
+ DatabankDTO,
31
+ DatabankCreateDTO,
32
+ DatabankUpdateDTO,
33
+ DatabankDocumentDTO,
34
+ DatabankDocumentCreateDTO,
35
+ DatabankDocumentUpdateDTO,
30
36
  PersonaDTO,
31
37
  LumiaItemDTO,
32
38
  PersonaCreateDTO,
@@ -47,6 +53,11 @@ import type {
47
53
  SpindleModalItemDTO,
48
54
  SpindleCommandDTO,
49
55
  SpindleCommandContextDTO,
56
+ FrontendProcessSpawnOptionsDTO,
57
+ FrontendProcessListOptionsDTO,
58
+ FrontendProcessInfoDTO,
59
+ FrontendProcessLifecycleEventDTO,
60
+ FrontendProcessStopOptionsDTO,
50
61
  GenerationStartedPayloadDTO,
51
62
  StreamTokenPayloadDTO,
52
63
  GenerationEndedPayloadDTO,
@@ -64,6 +75,23 @@ import type {
64
75
  MessageContentProcessorResultDTO,
65
76
  } from "./api";
66
77
 
78
+ export interface FrontendProcessHandle {
79
+ /** Host-assigned process ID unique within the extension runtime. */
80
+ readonly processId: string;
81
+ /** Frontend handler key the process was spawned against. */
82
+ readonly kind: string;
83
+ /** Optional extension-defined stable key. */
84
+ readonly key?: string;
85
+ /** Current known snapshot at the time the handle was created or last refreshed. */
86
+ readonly info: FrontendProcessInfoDTO;
87
+ /** Send a process-scoped message to the frontend instance. */
88
+ send(payload: unknown): void;
89
+ /** Request graceful termination. */
90
+ stop(options?: FrontendProcessStopOptionsDTO): Promise<void>;
91
+ /** Fetch the latest authoritative snapshot from the host. */
92
+ refresh(): Promise<FrontendProcessInfoDTO | null>;
93
+ }
94
+
67
95
  /** The global `spindle` object available in backend extension workers */
68
96
  export interface SpindleAPI {
69
97
  /** Subscribe to generation-started events (requires `generation` permission). The optional `userId` identifies which user triggered the event. */
@@ -630,6 +658,27 @@ export interface SpindleAPI {
630
658
  getActivated(chatId: string, userId?: string): Promise<ActivatedWorldInfoEntryDTO[]>;
631
659
  };
632
660
 
661
+ /**
662
+ * Databank CRUD (permission: "databanks").
663
+ * Manage databanks plus the documents they contain.
664
+ */
665
+ databanks: {
666
+ list(options?: { limit?: number; offset?: number; scope?: "global" | "character" | "chat"; scopeId?: string | null; userId?: string }): Promise<{ data: DatabankDTO[]; total: number }>;
667
+ get(databankId: string, userId?: string): Promise<DatabankDTO | null>;
668
+ create(input: DatabankCreateDTO, userId?: string): Promise<DatabankDTO>;
669
+ update(databankId: string, input: DatabankUpdateDTO, userId?: string): Promise<DatabankDTO>;
670
+ delete(databankId: string, userId?: string): Promise<boolean>;
671
+ documents: {
672
+ list(databankId: string, options?: { limit?: number; offset?: number; userId?: string }): Promise<{ data: DatabankDocumentDTO[]; total: number }>;
673
+ get(documentId: string, userId?: string): Promise<DatabankDocumentDTO | null>;
674
+ create(databankId: string, input: DatabankDocumentCreateDTO, userId?: string): Promise<DatabankDocumentDTO>;
675
+ update(documentId: string, input: DatabankDocumentUpdateDTO, userId?: string): Promise<DatabankDocumentDTO>;
676
+ delete(documentId: string, userId?: string): Promise<boolean>;
677
+ getContent(documentId: string, userId?: string): Promise<{ content: string } | null>;
678
+ reprocess(documentId: string, userId?: string): Promise<{ success: true; status: "processing" }>;
679
+ };
680
+ };
681
+
633
682
  /**
634
683
  * Personas CRUD (permission: "personas").
635
684
  * Manage user personas (identity profiles).
@@ -788,6 +837,39 @@ export interface SpindleAPI {
788
837
  /** Receive messages from the frontend module (userId is the sender) */
789
838
  onFrontendMessage(handler: (payload: unknown, userId: string) => void): () => void;
790
839
 
840
+ /**
841
+ * Backend-owned lifecycle controller for tracked frontend processes.
842
+ *
843
+ * Use this when the frontend needs to run one or more long-lived loops,
844
+ * workers, or UI-adjacent controllers whose liveness must be observable from
845
+ * the backend runtime. The frontend side registers handlers by `kind` via
846
+ * `ctx.processes.register(kind, handler)`.
847
+ *
848
+ * This is layered on top of the existing backend/frontend messaging model,
849
+ * but adds startup acknowledgement, heartbeat timeouts, process-scoped
850
+ * messaging, and structured lifecycle events.
851
+ */
852
+ frontendProcesses: {
853
+ /**
854
+ * Spawn a frontend process and wait for the frontend handler to call
855
+ * `process.ready()`. If `startupTimeoutMs` elapses first, the promise
856
+ * rejects and the process transitions to `timed_out`.
857
+ */
858
+ spawn(options: FrontendProcessSpawnOptionsDTO): Promise<FrontendProcessHandle>;
859
+ /** List tracked frontend processes visible to this extension runtime. */
860
+ list(filter?: FrontendProcessListOptionsDTO): Promise<FrontendProcessInfoDTO[]>;
861
+ /** Get a single tracked process by ID. Returns `null` if it no longer exists. */
862
+ get(processId: string): Promise<FrontendProcessInfoDTO | null>;
863
+ /** Request graceful termination of a tracked process. */
864
+ stop(processId: string, options?: FrontendProcessStopOptionsDTO): Promise<void>;
865
+ /** Subscribe to lifecycle transitions (`starting`, `running`, `timed_out`, etc.). */
866
+ onLifecycle(handler: (event: FrontendProcessLifecycleEventDTO) => void): () => void;
867
+ /** Receive process-scoped messages sent from the frontend side. */
868
+ onMessage(
869
+ handler: (event: { processId: string; payload: unknown; userId: string }) => void,
870
+ ): () => void;
871
+ };
872
+
791
873
  /** Logging */
792
874
  log: {
793
875
  info(msg: string): void;
@@ -978,14 +1060,15 @@ export interface SpindleAPI {
978
1060
  * Unlike `apply()`, this method does not let extensions push raw CSS
979
1061
  * variables. Lumiverse derives the full light/dark variable maps from the
980
1062
  * provided accent and preserves the user's glass, radius, font, and UI
981
- * scale settings.
1063
+ * scale settings. Pass `null` to clear the extension's active palette
1064
+ * override when no valid color data is available.
982
1065
  */
983
- applyPalette(palette: ThemePaletteConfigDTO, userId?: string): Promise<void>;
1066
+ applyPalette(palette: ThemePaletteConfigDTO | null, userId?: string): Promise<void>;
984
1067
  /**
985
1068
  * Remove all CSS variable overrides previously applied by this extension.
986
1069
  * The UI reverts to the user's base theme.
987
1070
  */
988
- clear(): Promise<void>;
1071
+ clear(userId?: string): Promise<void>;
989
1072
  /**
990
1073
  * Get a read-only snapshot of the user's current theme configuration.
991
1074
  * Returns the base theme info (not including any extension overrides).