lumiverse-spindle-types 0.4.29 → 0.4.31
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 -1
- package/src/api.ts +24 -5
- package/src/index.ts +1 -0
- package/src/spindle-api.ts +5 -3
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -293,6 +293,15 @@ export interface CharacterUpdateDTO {
|
|
|
293
293
|
world_book_ids?: string[];
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
+
export interface CharacterAvatarUploadDTO {
|
|
297
|
+
/** Raw avatar bytes. Extensions can source these from fetch(), storage, etc. */
|
|
298
|
+
data: Uint8Array;
|
|
299
|
+
/** Optional filename used to preserve the extension/MIME when storing the image. */
|
|
300
|
+
filename?: string;
|
|
301
|
+
/** Optional content type for the uploaded avatar. Defaults to image/png. */
|
|
302
|
+
mime_type?: string;
|
|
303
|
+
}
|
|
304
|
+
|
|
296
305
|
// ─── Chat DTOs ──────────────────────────────────────────────────────────
|
|
297
306
|
|
|
298
307
|
/**
|
|
@@ -1031,16 +1040,22 @@ export interface GenerationObserver {
|
|
|
1031
1040
|
|
|
1032
1041
|
// ─── Token Count DTOs ───────────────────────────────────────────────────
|
|
1033
1042
|
|
|
1034
|
-
/**
|
|
1035
|
-
export type TokenModelSourceDTO = "main" | "sidecar";
|
|
1043
|
+
/** Where the model used for server-side token counting came from. */
|
|
1044
|
+
export type TokenModelSourceDTO = "main" | "sidecar" | "explicit";
|
|
1036
1045
|
|
|
1037
1046
|
/** Optional settings for Spindle token count helpers. */
|
|
1038
1047
|
export interface TokenCountOptionsDTO {
|
|
1048
|
+
/**
|
|
1049
|
+
* Explicit model ID to resolve the tokenizer against.
|
|
1050
|
+
*
|
|
1051
|
+
* When provided, this takes precedence over `modelSource`.
|
|
1052
|
+
*/
|
|
1053
|
+
model?: string;
|
|
1039
1054
|
/**
|
|
1040
1055
|
* Which configured model to use when resolving the tokenizer.
|
|
1041
1056
|
*
|
|
1042
|
-
|
|
1043
|
-
|
|
1057
|
+
* - `"main"` → the user's default main connection profile model
|
|
1058
|
+
* - `"sidecar"` → the user's selected sidecar model (or its backing connection model)
|
|
1044
1059
|
*
|
|
1045
1060
|
* Defaults to `"main"`.
|
|
1046
1061
|
*/
|
|
@@ -1054,7 +1069,7 @@ export interface TokenCountResultDTO {
|
|
|
1054
1069
|
total_tokens: number;
|
|
1055
1070
|
/** Model ID that was actually used to resolve the tokenizer. */
|
|
1056
1071
|
model: string;
|
|
1057
|
-
/** Whether the model came from the main connection or
|
|
1072
|
+
/** Whether the model came from the main connection, sidecar selection, or an explicit override. */
|
|
1058
1073
|
modelSource: TokenModelSourceDTO;
|
|
1059
1074
|
/** Null when no exact tokenizer match was found and an approximate fallback was used. */
|
|
1060
1075
|
tokenizer_id: string | null;
|
|
@@ -1282,6 +1297,7 @@ export type WorkerToHost =
|
|
|
1282
1297
|
| { type: "characters_list"; requestId: string; limit?: number; offset?: number; userId?: string }
|
|
1283
1298
|
| { type: "characters_get"; requestId: string; characterId: string; userId?: string }
|
|
1284
1299
|
| { type: "characters_create"; requestId: string; input: CharacterCreateDTO; userId?: string }
|
|
1300
|
+
| { type: "characters_set_avatar"; requestId: string; characterId: string; avatar: CharacterAvatarUploadDTO; userId?: string }
|
|
1285
1301
|
| { type: "characters_update"; requestId: string; characterId: string; input: CharacterUpdateDTO; userId?: string }
|
|
1286
1302
|
| { type: "characters_delete"; requestId: string; characterId: string; userId?: string }
|
|
1287
1303
|
// ─── Chats (gated: "chats") ────────────────────────────────────────
|
|
@@ -1360,6 +1376,7 @@ export type WorkerToHost =
|
|
|
1360
1376
|
type: "tokens_count_text";
|
|
1361
1377
|
requestId: string;
|
|
1362
1378
|
text: string;
|
|
1379
|
+
model?: string;
|
|
1363
1380
|
modelSource?: TokenModelSourceDTO;
|
|
1364
1381
|
userId?: string;
|
|
1365
1382
|
}
|
|
@@ -1367,6 +1384,7 @@ export type WorkerToHost =
|
|
|
1367
1384
|
type: "tokens_count_messages";
|
|
1368
1385
|
requestId: string;
|
|
1369
1386
|
messages: Array<Pick<LlmMessageDTO, "role" | "content">>;
|
|
1387
|
+
model?: string;
|
|
1370
1388
|
modelSource?: TokenModelSourceDTO;
|
|
1371
1389
|
userId?: string;
|
|
1372
1390
|
}
|
|
@@ -1374,6 +1392,7 @@ export type WorkerToHost =
|
|
|
1374
1392
|
type: "tokens_count_chat";
|
|
1375
1393
|
requestId: string;
|
|
1376
1394
|
chatId: string;
|
|
1395
|
+
model?: string;
|
|
1377
1396
|
modelSource?: TokenModelSourceDTO;
|
|
1378
1397
|
userId?: string;
|
|
1379
1398
|
};
|
package/src/index.ts
CHANGED
package/src/spindle-api.ts
CHANGED
|
@@ -11,6 +11,7 @@ import type {
|
|
|
11
11
|
PermissionChangedDetail,
|
|
12
12
|
CharacterDTO,
|
|
13
13
|
CharacterCreateDTO,
|
|
14
|
+
CharacterAvatarUploadDTO,
|
|
14
15
|
CharacterUpdateDTO,
|
|
15
16
|
ChatDTO,
|
|
16
17
|
ChatUpdateDTO,
|
|
@@ -469,20 +470,20 @@ export interface SpindleAPI {
|
|
|
469
470
|
|
|
470
471
|
/** Server-side token counting helpers (free tier). */
|
|
471
472
|
tokens: {
|
|
472
|
-
/** Count tokens for an arbitrary text string. */
|
|
473
|
+
/** Count tokens for an arbitrary text string. `options.model` overrides `options.modelSource`. */
|
|
473
474
|
countText(text: string, options?: TokenCountOptionsDTO): Promise<TokenCountResultDTO>;
|
|
474
475
|
/**
|
|
475
476
|
* Count tokens for an array of chat-style messages.
|
|
476
477
|
*
|
|
477
478
|
* This accepts any array whose items expose `{ role, content }`, so the
|
|
478
479
|
* normalized output of `spindle.chat.getMessages(chatId)` can be passed
|
|
479
|
-
* directly without reshaping.
|
|
480
|
+
* directly without reshaping. `options.model` overrides `options.modelSource`.
|
|
480
481
|
*/
|
|
481
482
|
countMessages(
|
|
482
483
|
messages: Array<Pick<LlmMessageDTO, "role" | "content">>,
|
|
483
484
|
options?: TokenCountOptionsDTO
|
|
484
485
|
): Promise<TokenCountResultDTO>;
|
|
485
|
-
/** Count tokens for a live stored chat by ID. */
|
|
486
|
+
/** Count tokens for a live stored chat by ID. `options.model` overrides `options.modelSource`. */
|
|
486
487
|
countChat(chatId: string, options?: TokenCountOptionsDTO): Promise<TokenCountResultDTO>;
|
|
487
488
|
};
|
|
488
489
|
|
|
@@ -561,6 +562,7 @@ export interface SpindleAPI {
|
|
|
561
562
|
list(options?: { limit?: number; offset?: number; userId?: string }): Promise<{ data: CharacterDTO[]; total: number }>;
|
|
562
563
|
get(characterId: string, userId?: string): Promise<CharacterDTO | null>;
|
|
563
564
|
create(input: CharacterCreateDTO, userId?: string): Promise<CharacterDTO>;
|
|
565
|
+
setAvatar(characterId: string, avatar: CharacterAvatarUploadDTO, userId?: string): Promise<CharacterDTO>;
|
|
564
566
|
update(characterId: string, input: CharacterUpdateDTO, userId?: string): Promise<CharacterDTO>;
|
|
565
567
|
delete(characterId: string, userId?: string): Promise<boolean>;
|
|
566
568
|
};
|