lumiverse-spindle-types 0.2.2 → 0.2.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/spindle-api.ts +50 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lumiverse-spindle-types",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "types": "./src/index.ts",
5
5
  "keywords": [
6
6
  "lumiverse",
@@ -402,6 +402,56 @@ export interface SpindleAPI {
402
402
  }>;
403
403
  };
404
404
 
405
+ /**
406
+ * Macro resolution (free tier — no permission needed).
407
+ * Resolve `{{macro}}` placeholders in arbitrary text using
408
+ * the full Lumiverse macro engine (character fields, chat context,
409
+ * variables, time/date, random, etc.).
410
+ */
411
+ macros: {
412
+ /**
413
+ * Resolve all macros in the given template string.
414
+ * Provide `chatId` and/or `characterId` for full context resolution.
415
+ * Without them, only context-free macros (time, random, etc.) resolve.
416
+ *
417
+ * @example
418
+ * ```ts
419
+ * const { text } = await spindle.macros.resolve(
420
+ * 'Hello {{user}}, I am {{char}}!',
421
+ * { chatId: 'abc', characterId: 'xyz' },
422
+ * )
423
+ * ```
424
+ */
425
+ resolve(
426
+ template: string,
427
+ options?: {
428
+ chatId?: string;
429
+ characterId?: string;
430
+ /** For operator-scoped extensions only. */
431
+ userId?: string;
432
+ },
433
+ ): Promise<{
434
+ text: string;
435
+ diagnostics: Array<{ message: string; offset: number; length: number }>;
436
+ }>;
437
+ };
438
+
439
+ /**
440
+ * User presence queries (free tier — no permission needed).
441
+ * Check whether a user currently has the Lumiverse app visible/focused
442
+ * in at least one browser tab or PWA window.
443
+ */
444
+ users: {
445
+ /**
446
+ * Returns true if the user has the app visible in at least one session.
447
+ * Returns false if all sessions are hidden/backgrounded or the user has no
448
+ * active WebSocket connections.
449
+ * For user-scoped extensions, userId is inferred from the extension owner.
450
+ * For operator-scoped extensions, pass userId explicitly.
451
+ */
452
+ isVisible(userId?: string): Promise<boolean>;
453
+ };
454
+
405
455
  /** Show toast notifications in the frontend UI (free tier — no permission needed) */
406
456
  toast: {
407
457
  success(message: string, options?: { title?: string; duration?: number }): void;