lumiverse-spindle-types 0.4.18 → 0.4.19

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.18",
3
+ "version": "0.4.19",
4
4
  "types": "./src/index.ts",
5
5
  "keywords": [
6
6
  "lumiverse",
package/src/api.ts CHANGED
@@ -1077,7 +1077,7 @@ export type WorkerToHost =
1077
1077
  result?: string;
1078
1078
  error?: string;
1079
1079
  }
1080
- | { type: "frontend_message"; payload: unknown }
1080
+ | { type: "frontend_message"; payload: unknown; userId?: string }
1081
1081
  | { type: "user_storage_read"; requestId: string; path: string; userId?: string }
1082
1082
  | { type: "user_storage_write"; requestId: string; path: string; data: string; userId?: string }
1083
1083
  | { type: "user_storage_delete"; requestId: string; path: string; userId?: string }
@@ -515,8 +515,21 @@ export interface SpindleAPI {
515
515
  priority?: number
516
516
  ): void;
517
517
 
518
- /** Send a message to the frontend module */
519
- sendToFrontend(payload: unknown): void;
518
+ /**
519
+ * Send a message to the frontend module.
520
+ *
521
+ * @param payload Arbitrary JSON-serializable data delivered to the
522
+ * extension's frontend module via the `SPINDLE_FRONTEND_MSG`
523
+ * WebSocket event.
524
+ * @param userId Optional target user. When omitted on operator-scoped
525
+ * extensions the message is broadcast to **every connected
526
+ * user**, which is rarely what you want — pass the userId
527
+ * from the original `onFrontendMessage` handler (or any
528
+ * other API call site that surfaced one) to route the reply
529
+ * only to that user. User-scoped extensions always deliver
530
+ * to their installer regardless of this argument.
531
+ */
532
+ sendToFrontend(payload: unknown, userId?: string): void;
520
533
  /** Receive messages from the frontend module (userId is the sender) */
521
534
  onFrontendMessage(handler: (payload: unknown, userId: string) => void): () => void;
522
535