lumiverse-spindle-types 0.4.33 → 0.4.35
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 +11 -1
- package/src/spindle-api.ts +21 -9
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -1280,10 +1280,20 @@ export type WorkerToHost =
|
|
|
1280
1280
|
| { type: "frontend_message"; payload: unknown; userId?: string }
|
|
1281
1281
|
| { type: "user_storage_read"; requestId: string; path: string; userId?: string }
|
|
1282
1282
|
| { type: "user_storage_write"; requestId: string; path: string; data: string; userId?: string }
|
|
1283
|
+
| { type: "user_storage_read_binary"; requestId: string; path: string; userId?: string }
|
|
1284
|
+
| {
|
|
1285
|
+
type: "user_storage_write_binary";
|
|
1286
|
+
requestId: string;
|
|
1287
|
+
path: string;
|
|
1288
|
+
data: Uint8Array;
|
|
1289
|
+
userId?: string;
|
|
1290
|
+
}
|
|
1283
1291
|
| { type: "user_storage_delete"; requestId: string; path: string; userId?: string }
|
|
1284
1292
|
| { type: "user_storage_list"; requestId: string; prefix?: string; userId?: string }
|
|
1285
1293
|
| { type: "user_storage_exists"; requestId: string; path: string; userId?: string }
|
|
1286
1294
|
| { type: "user_storage_mkdir"; requestId: string; path: string; userId?: string }
|
|
1295
|
+
| { type: "user_storage_move"; requestId: string; from: string; to: string; userId?: string }
|
|
1296
|
+
| { type: "user_storage_stat"; requestId: string; path: string; userId?: string }
|
|
1287
1297
|
| { type: "enclave_put"; requestId: string; key: string; value: string; userId?: string }
|
|
1288
1298
|
| { type: "enclave_get"; requestId: string; key: string; userId?: string }
|
|
1289
1299
|
| { type: "enclave_delete"; requestId: string; key: string; userId?: string }
|
|
@@ -1356,7 +1366,7 @@ export type WorkerToHost =
|
|
|
1356
1366
|
// ─── Chat Memories (gated: "chats") ───────────────────────────────
|
|
1357
1367
|
| { type: "chats_get_memories"; requestId: string; chatId: string; topK?: number; userId?: string }
|
|
1358
1368
|
// ─── Toast (free tier) ───────────────────────────────────────────────
|
|
1359
|
-
| { type: "toast_show"; toastType: "success" | "warning" | "error" | "info"; message: string; title?: string; duration?: number }
|
|
1369
|
+
| { type: "toast_show"; toastType: "success" | "warning" | "error" | "info"; message: string; title?: string; duration?: number; userId?: string }
|
|
1360
1370
|
// ─── Push Notifications (gated: "push_notification") ────────────────
|
|
1361
1371
|
| { type: "push_send"; requestId: string; title: string; body: string; tag?: string; url?: string; userId?: string; icon?: string; rawTitle?: boolean; image?: string }
|
|
1362
1372
|
| { type: "push_get_status"; requestId: string; userId?: string }
|
package/src/spindle-api.ts
CHANGED
|
@@ -57,13 +57,13 @@ import type {
|
|
|
57
57
|
|
|
58
58
|
/** The global `spindle` object available in backend extension workers */
|
|
59
59
|
export interface SpindleAPI {
|
|
60
|
-
/** Subscribe to generation-started events (requires `generation` permission). */
|
|
60
|
+
/** Subscribe to generation-started events (requires `generation` permission). The optional `userId` identifies which user triggered the event. */
|
|
61
61
|
on(event: "GENERATION_STARTED", handler: (payload: GenerationStartedPayloadDTO, userId?: string) => void): () => void;
|
|
62
|
-
/** Subscribe to streamed token events (requires `generation` permission). */
|
|
62
|
+
/** Subscribe to streamed token events (requires `generation` permission). The optional `userId` identifies which user triggered the event. */
|
|
63
63
|
on(event: "STREAM_TOKEN_RECEIVED", handler: (payload: StreamTokenPayloadDTO, userId?: string) => void): () => void;
|
|
64
|
-
/** Subscribe to generation-ended events (requires `generation` permission). */
|
|
64
|
+
/** Subscribe to generation-ended events (requires `generation` permission). The optional `userId` identifies which user triggered the event. */
|
|
65
65
|
on(event: "GENERATION_ENDED", handler: (payload: GenerationEndedPayloadDTO, userId?: string) => void): () => void;
|
|
66
|
-
/** Subscribe to generation-stopped events (requires `generation` permission). */
|
|
66
|
+
/** Subscribe to generation-stopped events (requires `generation` permission). The optional `userId` identifies which user triggered the event. */
|
|
67
67
|
on(event: "GENERATION_STOPPED", handler: (payload: GenerationStoppedPayloadDTO, userId?: string) => void): () => void;
|
|
68
68
|
/**
|
|
69
69
|
* Subscribe to swipe lifecycle events. The payload's `action` discriminator
|
|
@@ -95,7 +95,7 @@ export interface SpindleAPI {
|
|
|
95
95
|
event: "TOOL_INVOCATION",
|
|
96
96
|
handler: (payload: ToolInvocationPayloadDTO) => string | Promise<string> | void | Promise<void>
|
|
97
97
|
): () => void;
|
|
98
|
-
/** Subscribe to a Lumiverse event. */
|
|
98
|
+
/** Subscribe to a Lumiverse event. Multi-user extensions should use the optional `userId` to keep per-user state and notifications isolated. */
|
|
99
99
|
on(event: string, handler: (payload: unknown, userId?: string) => void): () => void;
|
|
100
100
|
|
|
101
101
|
/** Register a macro. Handler contexts expose `commit === false` during dry resolves. */
|
|
@@ -255,10 +255,20 @@ export interface SpindleAPI {
|
|
|
255
255
|
userStorage: {
|
|
256
256
|
read(path: string, userId?: string): Promise<string>;
|
|
257
257
|
write(path: string, data: string, userId?: string): Promise<void>;
|
|
258
|
+
readBinary(path: string, userId?: string): Promise<Uint8Array>;
|
|
259
|
+
writeBinary(path: string, data: Uint8Array, userId?: string): Promise<void>;
|
|
258
260
|
delete(path: string, userId?: string): Promise<void>;
|
|
259
261
|
list(prefix?: string, userId?: string): Promise<string[]>;
|
|
260
262
|
exists(path: string, userId?: string): Promise<boolean>;
|
|
261
263
|
mkdir(path: string, userId?: string): Promise<void>;
|
|
264
|
+
move(from: string, to: string, userId?: string): Promise<void>;
|
|
265
|
+
stat(path: string, userId?: string): Promise<{
|
|
266
|
+
exists: boolean;
|
|
267
|
+
isFile: boolean;
|
|
268
|
+
isDirectory: boolean;
|
|
269
|
+
sizeBytes: number;
|
|
270
|
+
modifiedAt: string;
|
|
271
|
+
}>;
|
|
262
272
|
getJson<T>(path: string, options?: { fallback?: T; userId?: string }): Promise<T>;
|
|
263
273
|
setJson(path: string, value: unknown, options?: { indent?: number; userId?: string }): Promise<void>;
|
|
264
274
|
};
|
|
@@ -698,6 +708,8 @@ export interface SpindleAPI {
|
|
|
698
708
|
/**
|
|
699
709
|
* Send a push notification to a user's registered devices.
|
|
700
710
|
* Only delivered when the app is not focused (avoids double-notification).
|
|
711
|
+
* Operator-scoped extensions should pass the `userId` from the triggering
|
|
712
|
+
* frontend message or event handler to avoid cross-user delivery.
|
|
701
713
|
*/
|
|
702
714
|
send(input: {
|
|
703
715
|
title: string;
|
|
@@ -800,10 +812,10 @@ export interface SpindleAPI {
|
|
|
800
812
|
|
|
801
813
|
/** Show toast notifications in the frontend UI (free tier — no permission needed) */
|
|
802
814
|
toast: {
|
|
803
|
-
success(message: string, options?: { title?: string; duration?: number }): void;
|
|
804
|
-
warning(message: string, options?: { title?: string; duration?: number }): void;
|
|
805
|
-
error(message: string, options?: { title?: string; duration?: number }): void;
|
|
806
|
-
info(message: string, options?: { title?: string; duration?: number }): void;
|
|
815
|
+
success(message: string, options?: { title?: string; duration?: number; /** For operator-scoped extensions only. */ userId?: string }): void;
|
|
816
|
+
warning(message: string, options?: { title?: string; duration?: number; /** For operator-scoped extensions only. */ userId?: string }): void;
|
|
817
|
+
error(message: string, options?: { title?: string; duration?: number; /** For operator-scoped extensions only. */ userId?: string }): void;
|
|
818
|
+
info(message: string, options?: { title?: string; duration?: number; /** For operator-scoped extensions only. */ userId?: string }): void;
|
|
807
819
|
};
|
|
808
820
|
|
|
809
821
|
/** OAuth callback handling (permission: "oauth") */
|