lumiverse-spindle-types 0.2.1 → 0.2.2
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 +4 -1
- package/src/permissions.ts +3 -1
- package/src/spindle-api.ts +26 -0
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -637,7 +637,10 @@ export type WorkerToHost =
|
|
|
637
637
|
// ─── Chat Memories (gated: "chats") ───────────────────────────────
|
|
638
638
|
| { type: "chats_get_memories"; requestId: string; chatId: string; topK?: number; userId?: string }
|
|
639
639
|
// ─── Toast (free tier) ───────────────────────────────────────────────
|
|
640
|
-
| { type: "toast_show"; toastType: "success" | "warning" | "error" | "info"; message: string; title?: string; duration?: number }
|
|
640
|
+
| { type: "toast_show"; toastType: "success" | "warning" | "error" | "info"; message: string; title?: string; duration?: number }
|
|
641
|
+
// ─── Push Notifications (gated: "push_notification") ────────────────
|
|
642
|
+
| { type: "push_send"; requestId: string; title: string; body: string; tag?: string; url?: string; userId?: string }
|
|
643
|
+
| { type: "push_get_status"; requestId: string; userId?: string };
|
|
641
644
|
|
|
642
645
|
// ─── Host → Worker messages ──────────────────────────────────────────────
|
|
643
646
|
|
package/src/permissions.ts
CHANGED
|
@@ -28,7 +28,8 @@ export type SpindlePermission =
|
|
|
28
28
|
| "characters"
|
|
29
29
|
| "chats"
|
|
30
30
|
| "world_books"
|
|
31
|
-
| "personas"
|
|
31
|
+
| "personas"
|
|
32
|
+
| "push_notification";
|
|
32
33
|
|
|
33
34
|
export const ALL_PERMISSIONS: readonly SpindlePermission[] = [
|
|
34
35
|
"generation",
|
|
@@ -46,6 +47,7 @@ export const ALL_PERMISSIONS: readonly SpindlePermission[] = [
|
|
|
46
47
|
"chats",
|
|
47
48
|
"world_books",
|
|
48
49
|
"personas",
|
|
50
|
+
"push_notification",
|
|
49
51
|
] as const;
|
|
50
52
|
|
|
51
53
|
export function isValidPermission(p: string): p is SpindlePermission {
|
package/src/spindle-api.ts
CHANGED
|
@@ -376,6 +376,32 @@ export interface SpindleAPI {
|
|
|
376
376
|
error(msg: string): void;
|
|
377
377
|
};
|
|
378
378
|
|
|
379
|
+
/**
|
|
380
|
+
* Push notifications (permission: "push_notification").
|
|
381
|
+
* Send OS-level push notifications to users and check push status.
|
|
382
|
+
* Notifications are attributed to your extension name.
|
|
383
|
+
*/
|
|
384
|
+
push: {
|
|
385
|
+
/**
|
|
386
|
+
* Send a push notification to a user's registered devices.
|
|
387
|
+
* Only delivered when the app is not focused (avoids double-notification).
|
|
388
|
+
*/
|
|
389
|
+
send(input: {
|
|
390
|
+
title: string;
|
|
391
|
+
body: string;
|
|
392
|
+
tag?: string;
|
|
393
|
+
url?: string;
|
|
394
|
+
}, userId?: string): Promise<{ sent: number }>;
|
|
395
|
+
/**
|
|
396
|
+
* Check if push notifications are available for a user.
|
|
397
|
+
* Returns subscription count and whether the push system is active.
|
|
398
|
+
*/
|
|
399
|
+
getStatus(userId?: string): Promise<{
|
|
400
|
+
available: boolean;
|
|
401
|
+
subscriptionCount: number;
|
|
402
|
+
}>;
|
|
403
|
+
};
|
|
404
|
+
|
|
379
405
|
/** Show toast notifications in the frontend UI (free tier — no permission needed) */
|
|
380
406
|
toast: {
|
|
381
407
|
success(message: string, options?: { title?: string; duration?: number }): void;
|