lumiverse-spindle-types 0.4.65 → 0.4.68

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.65",
3
+ "version": "0.4.68",
4
4
  "types": "./src/index.ts",
5
5
  "keywords": [
6
6
  "lumiverse",
package/src/api.ts CHANGED
@@ -9,6 +9,8 @@ export interface LlmMessageDTO {
9
9
  name?: string;
10
10
  }
11
11
 
12
+ export type SpindleUserRoleDTO = "operator" | "admin" | "user";
13
+
12
14
  /**
13
15
  * Optional metadata returned by an interceptor so Lumiverse can surface
14
16
  * extension-injected prompt messages as first-class items in Prompt Breakdown.
@@ -255,6 +257,29 @@ export interface GenerationRequestDTO {
255
257
  signal?: AbortSignal;
256
258
  }
257
259
 
260
+ /** Options passed to chat generation when `spindle.chat.appendMessage()` starts a normal reply. */
261
+ export interface ChatAppendGenerationOptionsDTO {
262
+ /** Omit to use the user's default connection profile. */
263
+ connection_id?: string;
264
+ /** Omit to use the user's active persona setting. */
265
+ persona_id?: string;
266
+ persona_addon_states?: Record<string, boolean>;
267
+ /** Omit to use the user's active Loom preset; if unset, the connection preset is used. */
268
+ preset_id?: string;
269
+ force_preset_id?: boolean;
270
+ parameters?: Record<string, unknown>;
271
+ target_character_id?: string;
272
+ retain_council?: boolean;
273
+ }
274
+
275
+ /** Optional third argument for `spindle.chat.appendMessage()`. */
276
+ export type ChatAppendMessageOptionsDTO =
277
+ | boolean
278
+ | {
279
+ triggerGeneration?: boolean;
280
+ generation?: ChatAppendGenerationOptionsDTO;
281
+ };
282
+
258
283
  /**
259
284
  * Streamed chunk yielded by `spindle.generate.rawStream()` and
260
285
  * `spindle.generate.quietStream()`.
@@ -1884,6 +1909,7 @@ export type WorkerToHost =
1884
1909
  content: string;
1885
1910
  metadata?: Record<string, unknown>;
1886
1911
  };
1912
+ options?: ChatAppendMessageOptionsDTO;
1887
1913
  }
1888
1914
  | {
1889
1915
  type: "chat_update_message";
@@ -2118,8 +2144,9 @@ export type WorkerToHost =
2118
2144
  // ─── Push Notifications (gated: "push_notification") ────────────────
2119
2145
  | { type: "push_send"; requestId: string; title: string; body: string; tag?: string; url?: string; userId?: string; icon?: string; rawTitle?: boolean; image?: string }
2120
2146
  | { type: "push_get_status"; requestId: string; userId?: string }
2121
- // ─── User Visibility (free tier) ───────────────────────────────────
2147
+ // ─── User Context (free tier) ──────────────────────────────────────
2122
2148
  | { type: "user_is_visible"; requestId: string; userId?: string }
2149
+ | { type: "user_get_role"; requestId: string; userId?: string }
2123
2150
  // ─── Text Editor (free tier) ───────────────────────────────────────
2124
2151
  | { type: "text_editor_open"; requestId: string; title?: string; value?: string; placeholder?: string; userId?: string }
2125
2152
  // ─── Modal (free tier) ────────────────────────────────────────────
package/src/index.ts CHANGED
@@ -14,6 +14,7 @@ export { SpindleEvent, CoreEventType } from "./events";
14
14
 
15
15
  export type {
16
16
  LlmMessageDTO,
17
+ SpindleUserRoleDTO,
17
18
  InterceptorBreakdownEntryDTO,
18
19
  InterceptorResultDTO,
19
20
  MacroDefinitionDTO,
@@ -24,6 +25,8 @@ export type {
24
25
  ToolSchemaDTO,
25
26
  ToolCallDTO,
26
27
  GenerationRequestDTO,
28
+ ChatAppendGenerationOptionsDTO,
29
+ ChatAppendMessageOptionsDTO,
27
30
  StreamChunkDTO,
28
31
  RequestInitDTO,
29
32
  ConnectionProfileDTO,
@@ -11,6 +11,7 @@ import type {
11
11
  MacroResolveResultDTO,
12
12
  ToolRegistrationDTO,
13
13
  GenerationRequestDTO,
14
+ ChatAppendMessageOptionsDTO,
14
15
  RequestInitDTO,
15
16
  ConnectionProfileDTO,
16
17
  PermissionDeniedDetail,
@@ -60,6 +61,7 @@ import type {
60
61
  ThemePaletteConfigDTO,
61
62
  ThemeVariablesConfigDTO,
62
63
  ColorExtractionResult,
64
+ SpindleUserRoleDTO,
63
65
  SpindleModalItemDTO,
64
66
  SpindleCommandDTO,
65
67
  SpindleCommandContextDTO,
@@ -472,8 +474,9 @@ export interface SpindleAPI {
472
474
  role: "system" | "user" | "assistant";
473
475
  content: string;
474
476
  metadata?: Record<string, unknown>;
475
- }
476
- ): Promise<{ id: string }>;
477
+ },
478
+ options?: ChatAppendMessageOptionsDTO
479
+ ): Promise<{ id: string; generationId?: string }>;
477
480
  /**
478
481
  * Patch an existing message. All fields are optional; `undefined` leaves
479
482
  * the field untouched. Precedence rules:
@@ -1183,11 +1186,7 @@ export interface SpindleAPI {
1183
1186
  ): Promise<MacroResolveResultDTO>;
1184
1187
  };
1185
1188
 
1186
- /**
1187
- * User presence queries (free tier — no permission needed).
1188
- * Check whether a user currently has the Lumiverse app visible/focused
1189
- * in at least one browser tab or PWA window.
1190
- */
1189
+ /** User context queries (free tier — no permission needed). */
1191
1190
  users: {
1192
1191
  /**
1193
1192
  * Returns true if the user has the app visible in at least one session.
@@ -1197,6 +1196,14 @@ export interface SpindleAPI {
1197
1196
  * For operator-scoped extensions, pass userId explicitly.
1198
1197
  */
1199
1198
  isVisible(userId?: string): Promise<boolean>;
1199
+ /**
1200
+ * Return the user's Lumiverse role as exposed to extensions.
1201
+ * Internal owners are reported as `operator`; admins remain `admin`;
1202
+ * everyone else is `user`.
1203
+ * For user-scoped extensions, userId is inferred from the extension owner.
1204
+ * For operator-scoped extensions, pass userId explicitly.
1205
+ */
1206
+ getRole(userId?: string): Promise<SpindleUserRoleDTO>;
1200
1207
  };
1201
1208
 
1202
1209
  /** Show toast notifications in the frontend UI (free tier — no permission needed) */