lumiverse-spindle-types 0.4.34 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lumiverse-spindle-types",
3
- "version": "0.4.34",
3
+ "version": "0.4.35",
4
4
  "types": "./src/index.ts",
5
5
  "keywords": [
6
6
  "lumiverse",
package/src/api.ts CHANGED
@@ -1366,7 +1366,7 @@ export type WorkerToHost =
1366
1366
  // ─── Chat Memories (gated: "chats") ───────────────────────────────
1367
1367
  | { type: "chats_get_memories"; requestId: string; chatId: string; topK?: number; userId?: string }
1368
1368
  // ─── Toast (free tier) ───────────────────────────────────────────────
1369
- | { 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 }
1370
1370
  // ─── Push Notifications (gated: "push_notification") ────────────────
1371
1371
  | { type: "push_send"; requestId: string; title: string; body: string; tag?: string; url?: string; userId?: string; icon?: string; rawTitle?: boolean; image?: string }
1372
1372
  | { type: "push_get_status"; requestId: string; userId?: string }
@@ -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. */
@@ -708,6 +708,8 @@ export interface SpindleAPI {
708
708
  /**
709
709
  * Send a push notification to a user's registered devices.
710
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.
711
713
  */
712
714
  send(input: {
713
715
  title: string;
@@ -810,10 +812,10 @@ export interface SpindleAPI {
810
812
 
811
813
  /** Show toast notifications in the frontend UI (free tier — no permission needed) */
812
814
  toast: {
813
- success(message: string, options?: { title?: string; duration?: number }): void;
814
- warning(message: string, options?: { title?: string; duration?: number }): void;
815
- error(message: string, options?: { title?: string; duration?: number }): void;
816
- 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;
817
819
  };
818
820
 
819
821
  /** OAuth callback handling (permission: "oauth") */