lumiverse-spindle-types 0.4.30 → 0.4.32
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 +32 -1
- package/src/index.ts +4 -0
- package/src/spindle-api.ts +9 -11
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -29,6 +29,27 @@ export interface MacroDefinitionDTO {
|
|
|
29
29
|
handler: string; // serialized function body (executed in worker context)
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
/** Minimal shape exposed to extension macro handlers. Additional fields may be present. */
|
|
33
|
+
export interface MacroInvocationContextDTO {
|
|
34
|
+
/** False when the host is performing a dry / non-committing resolve. */
|
|
35
|
+
commit: boolean;
|
|
36
|
+
[key: string]: unknown;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface MacroResolveOptionsDTO {
|
|
40
|
+
chatId?: string;
|
|
41
|
+
characterId?: string;
|
|
42
|
+
/** For operator-scoped extensions only. */
|
|
43
|
+
userId?: string;
|
|
44
|
+
/** Defaults to true. Set false to request a dry / non-committing resolve. */
|
|
45
|
+
commit?: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface MacroResolveResultDTO {
|
|
49
|
+
text: string;
|
|
50
|
+
diagnostics: Array<{ message: string; offset: number; length: number }>;
|
|
51
|
+
}
|
|
52
|
+
|
|
32
53
|
export interface ToolRegistrationDTO {
|
|
33
54
|
name: string;
|
|
34
55
|
display_name: string;
|
|
@@ -293,6 +314,15 @@ export interface CharacterUpdateDTO {
|
|
|
293
314
|
world_book_ids?: string[];
|
|
294
315
|
}
|
|
295
316
|
|
|
317
|
+
export interface CharacterAvatarUploadDTO {
|
|
318
|
+
/** Raw avatar bytes. Extensions can source these from fetch(), storage, etc. */
|
|
319
|
+
data: Uint8Array;
|
|
320
|
+
/** Optional filename used to preserve the extension/MIME when storing the image. */
|
|
321
|
+
filename?: string;
|
|
322
|
+
/** Optional content type for the uploaded avatar. Defaults to image/png. */
|
|
323
|
+
mime_type?: string;
|
|
324
|
+
}
|
|
325
|
+
|
|
296
326
|
// ─── Chat DTOs ──────────────────────────────────────────────────────────
|
|
297
327
|
|
|
298
328
|
/**
|
|
@@ -1288,6 +1318,7 @@ export type WorkerToHost =
|
|
|
1288
1318
|
| { type: "characters_list"; requestId: string; limit?: number; offset?: number; userId?: string }
|
|
1289
1319
|
| { type: "characters_get"; requestId: string; characterId: string; userId?: string }
|
|
1290
1320
|
| { type: "characters_create"; requestId: string; input: CharacterCreateDTO; userId?: string }
|
|
1321
|
+
| { type: "characters_set_avatar"; requestId: string; characterId: string; avatar: CharacterAvatarUploadDTO; userId?: string }
|
|
1291
1322
|
| { type: "characters_update"; requestId: string; characterId: string; input: CharacterUpdateDTO; userId?: string }
|
|
1292
1323
|
| { type: "characters_delete"; requestId: string; characterId: string; userId?: string }
|
|
1293
1324
|
// ─── Chats (gated: "chats") ────────────────────────────────────────
|
|
@@ -1339,7 +1370,7 @@ export type WorkerToHost =
|
|
|
1339
1370
|
| { type: "confirm_open"; requestId: string; title: string; message: string; variant?: "info" | "warning" | "danger" | "success"; confirmLabel?: string; cancelLabel?: string; userId?: string }
|
|
1340
1371
|
| { type: "input_prompt_open"; requestId: string; title: string; message?: string; placeholder?: string; defaultValue?: string; submitLabel?: string; cancelLabel?: string; multiline?: boolean; userId?: string }
|
|
1341
1372
|
// ─── Macro Resolution (free tier) ──────────────────────────────────
|
|
1342
|
-
| { type: "macros_resolve"; requestId: string; template: string; chatId?: string; characterId?: string; userId?: string }
|
|
1373
|
+
| { type: "macros_resolve"; requestId: string; template: string; chatId?: string; characterId?: string; userId?: string; commit?: boolean }
|
|
1343
1374
|
// ─── Image Generation (gated: "image_gen") ──────────────────────────
|
|
1344
1375
|
| { type: "image_gen_generate"; requestId: string; input: ImageGenRequestDTO }
|
|
1345
1376
|
| { type: "image_gen_providers"; requestId: string; userId?: string }
|
package/src/index.ts
CHANGED
|
@@ -16,6 +16,9 @@ export type {
|
|
|
16
16
|
LlmMessageDTO,
|
|
17
17
|
InterceptorResultDTO,
|
|
18
18
|
MacroDefinitionDTO,
|
|
19
|
+
MacroInvocationContextDTO,
|
|
20
|
+
MacroResolveOptionsDTO,
|
|
21
|
+
MacroResolveResultDTO,
|
|
19
22
|
ToolRegistrationDTO,
|
|
20
23
|
ToolSchemaDTO,
|
|
21
24
|
ToolCallDTO,
|
|
@@ -27,6 +30,7 @@ export type {
|
|
|
27
30
|
PermissionChangedDetail,
|
|
28
31
|
CharacterDTO,
|
|
29
32
|
CharacterCreateDTO,
|
|
33
|
+
CharacterAvatarUploadDTO,
|
|
30
34
|
CharacterUpdateDTO,
|
|
31
35
|
ChatDTO,
|
|
32
36
|
ChatUpdateDTO,
|
package/src/spindle-api.ts
CHANGED
|
@@ -3,6 +3,8 @@ import type {
|
|
|
3
3
|
LlmMessageDTO,
|
|
4
4
|
InterceptorResultDTO,
|
|
5
5
|
MacroDefinitionDTO,
|
|
6
|
+
MacroResolveOptionsDTO,
|
|
7
|
+
MacroResolveResultDTO,
|
|
6
8
|
ToolRegistrationDTO,
|
|
7
9
|
GenerationRequestDTO,
|
|
8
10
|
RequestInitDTO,
|
|
@@ -11,6 +13,7 @@ import type {
|
|
|
11
13
|
PermissionChangedDetail,
|
|
12
14
|
CharacterDTO,
|
|
13
15
|
CharacterCreateDTO,
|
|
16
|
+
CharacterAvatarUploadDTO,
|
|
14
17
|
CharacterUpdateDTO,
|
|
15
18
|
ChatDTO,
|
|
16
19
|
ChatUpdateDTO,
|
|
@@ -95,7 +98,7 @@ export interface SpindleAPI {
|
|
|
95
98
|
/** Subscribe to a Lumiverse event. */
|
|
96
99
|
on(event: string, handler: (payload: unknown, userId?: string) => void): () => void;
|
|
97
100
|
|
|
98
|
-
/** Register a macro */
|
|
101
|
+
/** Register a macro. Handler contexts expose `commit === false` during dry resolves. */
|
|
99
102
|
registerMacro(def: MacroDefinitionDTO): void;
|
|
100
103
|
/** Unregister a macro */
|
|
101
104
|
unregisterMacro(name: string): void;
|
|
@@ -561,6 +564,7 @@ export interface SpindleAPI {
|
|
|
561
564
|
list(options?: { limit?: number; offset?: number; userId?: string }): Promise<{ data: CharacterDTO[]; total: number }>;
|
|
562
565
|
get(characterId: string, userId?: string): Promise<CharacterDTO | null>;
|
|
563
566
|
create(input: CharacterCreateDTO, userId?: string): Promise<CharacterDTO>;
|
|
567
|
+
setAvatar(characterId: string, avatar: CharacterAvatarUploadDTO, userId?: string): Promise<CharacterDTO>;
|
|
564
568
|
update(characterId: string, input: CharacterUpdateDTO, userId?: string): Promise<CharacterDTO>;
|
|
565
569
|
delete(characterId: string, userId?: string): Promise<boolean>;
|
|
566
570
|
};
|
|
@@ -761,6 +765,8 @@ export interface SpindleAPI {
|
|
|
761
765
|
* Resolve all macros in the given template string.
|
|
762
766
|
* Provide `chatId` and/or `characterId` for full context resolution.
|
|
763
767
|
* Without them, only context-free macros (time, random, etc.) resolve.
|
|
768
|
+
* Set `commit: false` for a dry / non-committing resolve; extension macro
|
|
769
|
+
* handlers will receive `ctx.commit === false`.
|
|
764
770
|
*
|
|
765
771
|
* @example
|
|
766
772
|
* ```ts
|
|
@@ -772,16 +778,8 @@ export interface SpindleAPI {
|
|
|
772
778
|
*/
|
|
773
779
|
resolve(
|
|
774
780
|
template: string,
|
|
775
|
-
options?:
|
|
776
|
-
|
|
777
|
-
characterId?: string;
|
|
778
|
-
/** For operator-scoped extensions only. */
|
|
779
|
-
userId?: string;
|
|
780
|
-
},
|
|
781
|
-
): Promise<{
|
|
782
|
-
text: string;
|
|
783
|
-
diagnostics: Array<{ message: string; offset: number; length: number }>;
|
|
784
|
-
}>;
|
|
781
|
+
options?: MacroResolveOptionsDTO,
|
|
782
|
+
): Promise<MacroResolveResultDTO>;
|
|
785
783
|
};
|
|
786
784
|
|
|
787
785
|
/**
|