lumiverse-spindle-types 0.4.61 → 0.4.64

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.61",
3
+ "version": "0.4.64",
4
4
  "types": "./src/index.ts",
5
5
  "keywords": [
6
6
  "lumiverse",
package/src/api.ts CHANGED
@@ -44,6 +44,8 @@ export interface MacroDefinitionDTO {
44
44
  returnType?: "string" | "integer" | "number" | "boolean";
45
45
  args?: { name: string; description?: string; required?: boolean }[];
46
46
  handler: string; // serialized function body (executed in worker context)
47
+ /** Set true when the macro returns different output across calls with the same args (time, randomness, idle duration). The display-regex cache will not store resolutions that include this macro. */
48
+ volatile?: boolean;
47
49
  }
48
50
 
49
51
  /** Minimal shape exposed to extension macro handlers. Additional fields may be present. */
@@ -288,6 +290,8 @@ export interface RequestInitDTO {
288
290
  /** When `"arraybuffer"`, the response body is returned as a base64-encoded string
289
291
  * with `encoding: "base64"`. Used by the sandboxed-widget transparent proxy. */
290
292
  responseType?: "text" | "arraybuffer";
293
+ /** Restricts transparent binary proxy responses to a browser-renderable media class. */
294
+ mediaType?: "image" | "audio";
291
295
  }
292
296
 
293
297
  /**
@@ -570,6 +574,14 @@ export interface ChatSwitchedPayloadDTO {
570
574
  chatId: string | null;
571
575
  }
572
576
 
577
+ /** Payload for `CHAT_CHANGED` events. */
578
+ export interface ChatChangedPayloadDTO {
579
+ /** The chat after the change. */
580
+ chat: { id: string; [key: string]: unknown };
581
+ /** Optional. Dot-paths of fields that differed between the prior and new chat (e.g. `metadata.macro_variables.local.foo`, `name`, `metadata.last_message_id`). Absent on events emitted by sources that don't compute the diff. */
582
+ changedFields?: string[];
583
+ }
584
+
573
585
  // ─── World Book DTOs ─────────────────────────────────────────────────────
574
586
 
575
587
  /**
@@ -679,7 +691,7 @@ export type WorldBookEntryUpdateDTO = WorldBookEntryCreateDTO;
679
691
  export type RegexPlacementDTO = "user_input" | "ai_output" | "world_info" | "reasoning";
680
692
  export type RegexScopeDTO = "global" | "character" | "chat";
681
693
  export type RegexTargetDTO = "prompt" | "response" | "display";
682
- export type RegexMacroModeDTO = "none" | "raw" | "escaped";
694
+ export type RegexMacroModeDTO = "none" | "raw" | "escaped" | "after";
683
695
 
684
696
  export interface RegexScriptDTO {
685
697
  id: string;
package/src/dom.ts CHANGED
@@ -190,6 +190,37 @@ export interface SpindleSandboxFrameHandle {
190
190
  destroy(): void;
191
191
  }
192
192
 
193
+ export interface SpindleSandboxMediaResource {
194
+ /** Object URL that can be assigned to sandbox-local media elements. */
195
+ url: string;
196
+ /** Response media type without parameters, e.g. `audio/mpeg`. */
197
+ contentType: string;
198
+ /** Downloaded media size in bytes. */
199
+ sizeBytes: number;
200
+ /** Revoke the object URL when it is no longer needed. */
201
+ revoke(): void;
202
+ }
203
+
204
+ export interface SpindleSandboxAudioOptions {
205
+ /** Request options passed to the permission-gated CORS proxy. */
206
+ request?: RequestInitDTO;
207
+ controls?: boolean;
208
+ loop?: boolean;
209
+ muted?: boolean;
210
+ preload?: "none" | "metadata" | "auto";
211
+ /** Clamped to the browser audio range `[0, 1]`. */
212
+ volume?: number;
213
+ }
214
+
215
+ export interface SpindleSandboxAudioHandle extends SpindleSandboxMediaResource {
216
+ /** Sandbox-local audio element backed by the fetched blob URL. */
217
+ element: HTMLAudioElement;
218
+ play(): Promise<void>;
219
+ pause(): void;
220
+ /** Pause playback, detach the element, and revoke the object URL. */
221
+ destroy(): void;
222
+ }
223
+
193
224
  /** API exposed inside the sandboxed iframe as `window.spindleSandbox`. */
194
225
  export interface SpindleSandboxAPI {
195
226
  postMessage(payload: unknown): void;
@@ -197,6 +228,10 @@ export interface SpindleSandboxAPI {
197
228
  requestResize(height?: number): void;
198
229
  /** Fetch a URL through the extension's CORS proxy. Requires the `cors_proxy` permission. */
199
230
  corsProxy(url: string, options?: RequestInitDTO): Promise<unknown>;
231
+ /** Fetch remote audio through the permission-gated proxy and expose it as a blob URL. */
232
+ fetchAudio(url: string, options?: RequestInitDTO): Promise<SpindleSandboxMediaResource>;
233
+ /** Fetch remote audio through the proxy and create a sandbox-local audio element. */
234
+ createAudio(url: string, options?: SpindleSandboxAudioOptions): Promise<SpindleSandboxAudioHandle>;
200
235
  }
201
236
 
202
237
  export interface SpindleUploadFile {
package/src/index.ts CHANGED
@@ -36,6 +36,7 @@ export type {
36
36
  ChatDTO,
37
37
  ChatUpdateDTO,
38
38
  ChatSwitchedPayloadDTO,
39
+ ChatChangedPayloadDTO,
39
40
  WorldBookDTO,
40
41
  WorldBookCreateDTO,
41
42
  WorldBookUpdateDTO,
@@ -161,9 +162,12 @@ export type {
161
162
  SpindleAppMountHandle,
162
163
  SpindleInputBarActionOptions,
163
164
  SpindleInputBarActionHandle,
164
- SpindleSandboxFrameOptions,
165
- SpindleSandboxFrameHandle,
166
- SpindleSandboxAPI,
165
+ SpindleSandboxFrameOptions,
166
+ SpindleSandboxFrameHandle,
167
+ SpindleSandboxMediaResource,
168
+ SpindleSandboxAudioOptions,
169
+ SpindleSandboxAudioHandle,
170
+ SpindleSandboxAPI,
167
171
  SpindleContextMenuOptions,
168
172
  SpindleContextMenuItemDef,
169
173
  SpindleContextMenuResult,
@@ -73,6 +73,7 @@ import type {
73
73
  BackendProcessInfoDTO,
74
74
  BackendProcessLifecycleEventDTO,
75
75
  BackendProcessStopOptionsDTO,
76
+ ChatChangedPayloadDTO,
76
77
  GenerationStartedPayloadDTO,
77
78
  StreamTokenPayloadDTO,
78
79
  GenerationEndedPayloadDTO,
@@ -176,6 +177,8 @@ export interface SpindleAPI {
176
177
  on(event: "GENERATION_ENDED", handler: (payload: GenerationEndedPayloadDTO, userId?: string) => void): () => void;
177
178
  /** Subscribe to generation-stopped events (requires `generation` permission). The optional `userId` identifies which user triggered the event. */
178
179
  on(event: "GENERATION_STOPPED", handler: (payload: GenerationStoppedPayloadDTO, userId?: string) => void): () => void;
180
+ /** Subscribe to `CHAT_CHANGED` events. `changedFields` lists the dot-paths that differed when emitted by the standard `updateChat` path; absent on emits from other sources. */
181
+ on(event: "CHAT_CHANGED", handler: (payload: ChatChangedPayloadDTO, userId?: string) => void): () => void;
179
182
  /**
180
183
  * Subscribe to swipe lifecycle events. The payload's `action` discriminator
181
184
  * tells you whether a swipe was added, updated, deleted, or navigated, and