lumiverse-spindle-types 0.5.16 → 0.5.18

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.5.16",
3
+ "version": "0.5.18",
4
4
  "types": "./src/index.ts",
5
5
  "keywords": [
6
6
  "lumiverse",
package/src/api.ts CHANGED
@@ -774,6 +774,26 @@ export interface ChatChangedPayloadDTO {
774
774
  changedFields?: string[];
775
775
  }
776
776
 
777
+ /**
778
+ * Payload for `CHAT_FORKED` events. Emitted when a chat is forked (branched)
779
+ * from a specific message — the messages up to and including the fork point are
780
+ * copied into a brand-new chat that shares the source chat's character.
781
+ */
782
+ export interface ChatForkedPayloadDTO {
783
+ /** Id of the source chat that was forked. */
784
+ sourceChatId: string;
785
+ /** Id of the newly created forked chat. Equal to `chat.id`. */
786
+ forkedChatId: string;
787
+ /** The new forked chat row, including its `metadata` (carries `branched_from` and `branch_at_message`). */
788
+ chat: { id: string; [key: string]: unknown };
789
+ /** The `branch_id` assigned to every message copied into the forked chat. */
790
+ branchId: string;
791
+ /** Id of the message in the source chat the fork was taken at. Messages up to and including this one were copied into the forked chat. */
792
+ forkedAtMessageId: string;
793
+ /** Zero-based index of the fork-point message within the source chat. */
794
+ forkedAtMessageIndex: number;
795
+ }
796
+
777
797
  // ─── User Preset DTOs ───────────────────────────────────────────────────
778
798
 
779
799
  /** Option entry for `select` and `multiselect` prompt variables. */
@@ -1356,8 +1376,19 @@ export interface MemoryStatsDTO {
1356
1376
  chunksAvailable: number;
1357
1377
  chunksPending: number;
1358
1378
  injectionMethod: "macro" | "fallback" | "disabled";
1379
+ /**
1380
+ * How the chunks were retrieved: a real vector/hybrid search ("vector") or
1381
+ * the recency fallback ("recency", e.g. when the query embedding failed).
1382
+ * Absent until the chat-memory cache has been populated.
1383
+ */
1384
+ retrievalMode?: "vector" | "recency" | "empty" | "disabled";
1359
1385
  retrievedChunks: Array<{
1360
- score: number;
1386
+ /**
1387
+ * Vector distance (lower = more similar). `null` for keyword-only or
1388
+ * recency-fallback hits, which have no vector distance — do not treat a
1389
+ * missing score as a perfect (zero-distance) match.
1390
+ */
1391
+ score: number | null;
1361
1392
  tokenEstimate: number;
1362
1393
  messageRange: [number, number];
1363
1394
  preview: string;
@@ -1395,7 +1426,12 @@ export interface DryRunResultDTO {
1395
1426
 
1396
1427
  export interface ChatMemoryChunkDTO {
1397
1428
  content: string;
1398
- score: number;
1429
+ /**
1430
+ * Vector distance (lower = more similar). `null` for keyword-only or
1431
+ * recency-fallback hits, which have no vector distance — do not treat a
1432
+ * missing score as a perfect (zero-distance) match.
1433
+ */
1434
+ score: number | null;
1399
1435
  metadata: Record<string, unknown>;
1400
1436
  }
1401
1437
 
@@ -1408,6 +1444,8 @@ export interface ChatMemoryResultDTO {
1408
1444
  settingsSource: "global" | "per_chat";
1409
1445
  chunksAvailable: number;
1410
1446
  chunksPending: number;
1447
+ /** How chunks were retrieved (real vector search vs. recency fallback). */
1448
+ retrievalMode?: "vector" | "recency" | "empty" | "disabled";
1411
1449
  }
1412
1450
 
1413
1451
  /**
package/src/events.ts CHANGED
@@ -14,6 +14,7 @@ export enum CoreEventType {
14
14
  CONNECTED = "CONNECTED",
15
15
  CHAT_CHANGED = "CHAT_CHANGED",
16
16
  CHAT_SWITCHED = "CHAT_SWITCHED",
17
+ CHAT_FORKED = "CHAT_FORKED",
17
18
  MESSAGE_SENT = "MESSAGE_SENT",
18
19
  MESSAGE_EDITED = "MESSAGE_EDITED",
19
20
  MESSAGE_DELETED = "MESSAGE_DELETED",
package/src/index.ts CHANGED
@@ -49,6 +49,7 @@ export type {
49
49
  ChatUpdateDTO,
50
50
  ChatSwitchedPayloadDTO,
51
51
  ChatChangedPayloadDTO,
52
+ ChatForkedPayloadDTO,
52
53
  PromptVariableOptionDTO,
53
54
  PromptVariableDefDTO,
54
55
  PromptVariableTypeDTO,
@@ -85,6 +85,7 @@ import type {
85
85
  BackendProcessLifecycleEventDTO,
86
86
  BackendProcessStopOptionsDTO,
87
87
  ChatChangedPayloadDTO,
88
+ ChatForkedPayloadDTO,
88
89
  ChatMessageDTO,
89
90
  GenerationStartedPayloadDTO,
90
91
  StreamTokenPayloadDTO,
@@ -220,6 +221,8 @@ export interface SpindleAPI {
220
221
  on(event: "GENERATION_STOPPED", handler: (payload: GenerationStoppedPayloadDTO, userId?: string) => void): () => void;
221
222
  /** Subscribe to `CHAT_CHANGED` events. `changedFields` lists the dot-paths that differed when emitted by the standard `updateChat` path; absent on emits from other sources. */
222
223
  on(event: "CHAT_CHANGED", handler: (payload: ChatChangedPayloadDTO, userId?: string) => void): () => void;
224
+ /** Subscribe to `CHAT_FORKED` events. Emitted when a chat is forked (branched) from a message into a new chat. The payload carries the source/forked chat ids, the full forked chat row, and the fork point. */
225
+ on(event: "CHAT_FORKED", handler: (payload: ChatForkedPayloadDTO, userId?: string) => void): () => void;
223
226
  /**
224
227
  * Subscribe to swipe lifecycle events. The payload's `action` discriminator
225
228
  * tells you whether a swipe was added, updated, deleted, or navigated, and