lumiverse-spindle-types 0.6.36 → 0.6.38

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/dist/api.d.ts CHANGED
@@ -3,6 +3,14 @@ import type { SpindleHostDescriptorV1 } from "./host.js";
3
3
  import type { CouncilMemberContext } from "./council.js";
4
4
  import type { ChatLinkAttachDTO, CortexQueryDTO, MemoryCortexConfigDTO, MemoryEntityStatusUpdateDTO, MemoryEntityUpsertDTO, MemoryRelationUpsertDTO, VaultCreateDTO } from "./memories.js";
5
5
  export type LlmMessagePartDTO = {
6
+ type: "video";
7
+ data: string;
8
+ mime_type: string;
9
+ cache_control?: Record<string, unknown>;
10
+ } | {
11
+ type: "desktop_capture";
12
+ asset_id: string;
13
+ } | {
6
14
  type: "text";
7
15
  text: string;
8
16
  cache_control?: Record<string, unknown>;
@@ -87,32 +95,61 @@ export interface InterceptorMatchDTO {
87
95
  generationTypes?: InterceptorGenerationType[];
88
96
  /** Terminal callbacks are never invoked for dry runs. */
89
97
  isDryRun?: boolean;
98
+ /**
99
+ * Filter on this extension's own preset metadata namespace, the same value
100
+ * the callback receives as `InterceptorContextDTO.presetMetadata`
101
+ * (`preset.metadata[<manifest identifier>]` of the generation's preset).
102
+ * Another extension's or Loom's metadata is never visible to the filter.
103
+ */
90
104
  presetField?: {
105
+ /**
106
+ * Object keys walked from the namespace; an empty path tests the namespace
107
+ * itself. A missing key, an array, or a non-object along the way reads as
108
+ * `undefined`, as does a generation without a preset.
109
+ */
91
110
  path: string[];
111
+ /** `true` requires a value at `path` (`null` counts as a value); `false` requires none. */
92
112
  exists?: boolean;
113
+ /** The value at `path` must be `Object.is`-equal to one of these scalars. */
93
114
  oneOf?: InterceptorMatchScalar[];
115
+ /** The value at `path` must not be `Object.is`-equal to any of these scalars. */
94
116
  notIn?: InterceptorMatchScalar[];
95
117
  };
96
118
  }
97
119
  export interface InterceptorRegistrationMatchOptions {
98
120
  match?: InterceptorMatchDTO;
121
+ /** Stop generation on failure instead of continuing with the previous prompt. */
122
+ required?: boolean;
99
123
  }
100
124
  export interface InterceptorRegistrationOptions {
101
125
  priority?: number;
102
126
  match?: InterceptorMatchDTO;
127
+ required?: boolean;
103
128
  }
104
129
  /**
105
130
  * Host-owned, immutable context for one bound interceptor callback.
106
131
  * `signal` is local to the worker invocation and is never serialized.
107
132
  */
108
133
  export interface InterceptorContextDTO {
134
+ /** Host-selected execution document, pinned for this generation. Absent when no main frontend is connected. */
135
+ readonly frontendSessionId?: string;
109
136
  readonly userId: string;
110
137
  readonly chatId: string;
111
138
  readonly generationId: string;
112
139
  readonly generationType: InterceptorGenerationType;
113
140
  readonly isDryRun: boolean;
141
+ /**
142
+ * Preset that prompt assembly resolved for this generation, after request,
143
+ * profile, and binding resolution. `null` when the generation has no preset
144
+ * or skips assembly (an explicit `messages` request).
145
+ */
114
146
  readonly presetId: string | null;
115
- /** Deep clone of only this extension's own preset metadata namespace. */
147
+ /**
148
+ * Deep clone of only this extension's own preset metadata namespace:
149
+ * `preset.metadata[<manifest identifier>]` of the preset in `presetId`, the
150
+ * key the preset editor's extension helper writes. `undefined` when that key
151
+ * is absent or there is no preset. Mutating it does not change the preset.
152
+ */
116
153
  readonly presetMetadata: unknown;
117
154
  readonly personaId: string | null;
118
155
  readonly characterId: string | null;
@@ -278,6 +315,10 @@ export interface MacroInterceptorCtxDTO {
278
315
  readonly commit: boolean;
279
316
  readonly phase: MacroInterceptorPhase;
280
317
  readonly sourceHint?: string;
318
+ /** Present when this extension is the opted-in evaluator for the complete source. */
319
+ readonly sourceOwner?: {
320
+ readonly extensionIdentifier: string;
321
+ };
281
322
  /**
282
323
  * User ID that initiated the macro resolution (when available). Relevant
283
324
  * for operator-scoped extensions that need to route work through other
@@ -763,6 +804,43 @@ export type ImageGenCharacterLoraSelectionDTO = {
763
804
  lora: ImageGenLoraEntryDTO;
764
805
  base_tags?: string;
765
806
  };
807
+ /** Saved native image prompt preset. Legacy entries without a kind are Main Presets. */
808
+ export interface ImageGenPromptPresetDTO {
809
+ id: string;
810
+ name: string;
811
+ mode: "custom" | "parsed_custom";
812
+ prompt: string;
813
+ negativePrompt?: string;
814
+ parserConnectionId?: string | null;
815
+ parserModel?: string;
816
+ parserParameters?: Record<string, unknown>;
817
+ kind?: "main" | "character" | "persona" | "captioning";
818
+ }
819
+ /** Read-only snapshot; discovery does not reconcile or change saved selections. */
820
+ export interface ImageGenPromptPresetsResultDTO {
821
+ activeId: string | null;
822
+ activeConnectionId: string | null;
823
+ /** Main Presets only, including legacy presets without a kind. */
824
+ presets: ImageGenPromptPresetDTO[];
825
+ }
826
+ /** Request-local ComfyUI mapped field values; unmapped node fields are ignored. */
827
+ export interface ImageGenComfyUIFieldValuesDTO extends Record<string, unknown> {
828
+ /** Custom field values keyed by `<nodeId>:<fieldName>`. */
829
+ custom?: Record<string, unknown>;
830
+ /**
831
+ * Primitive overrides keyed by `<nodeId>:<fieldName>`. Prompt and source-image
832
+ * injection take precedence. Mapped seed values of -1 are randomized per run.
833
+ */
834
+ node_fields?: Record<string, string | number | boolean>;
835
+ }
836
+ /** Opt-in validation helper for native provider parameters and saved ComfyUI controls. */
837
+ export interface ImageGenNativeParametersDTO extends Record<string, unknown> {
838
+ /** Select a saved workflow for this request without changing the active workflow. */
839
+ workflow_id?: string;
840
+ /** Alias for workflow_id. */
841
+ workflowId?: string;
842
+ comfyui_field_values?: ImageGenComfyUIFieldValuesDTO;
843
+ }
766
844
  /**
767
845
  * Input for `spindle.imageGen.generateNative()`.
768
846
  *
@@ -773,10 +851,19 @@ export type ImageGenCharacterLoraSelectionDTO = {
773
851
  export interface ImageGenNativeRequestDTO {
774
852
  /** Chat used for prompt/macro context and native generation lifecycle. */
775
853
  chat_id: string;
854
+ /** Request-local connection override; does not change the user's active connection. */
855
+ connection_id?: string;
856
+ /** Persisted image owned by the user. ComfyUI workflows must map init_image. */
857
+ source_image_id?: string;
858
+ /** Video output selection requires a ComfyUI connection. Omit for legacy selection. */
859
+ output_media_type?: "image" | "video";
860
+ /** Select the ComfyUI output node for this request. */
861
+ output_node_id?: string;
776
862
  /** Inline prompt. Optional when native settings/preset supply one. */
777
863
  prompt?: string;
778
864
  negativePrompt?: string;
779
865
  promptMode?: "scene" | "custom" | "parsed_custom";
866
+ /** Use this preset's mode/parser configuration; a missing explicit preset is rejected. */
780
867
  promptPresetId?: string | null;
781
868
  /** Skip parser/scene rewriting and use the resolved prompt directly. */
782
869
  skipParse?: boolean;
@@ -792,16 +879,35 @@ export interface ImageGenNativeRequestDTO {
792
879
  extraBaseTags?: string;
793
880
  /** Scale applied to the complete assembled LoRA stack. */
794
881
  loraStrengthScale?: number;
795
- /** Provider parameters merged over the active native connection defaults. */
882
+ /**
883
+ * Provider parameters merged over the active native connection defaults.
884
+ * Use `satisfies ImageGenNativeParametersDTO` for opt-in ComfyUI validation.
885
+ */
796
886
  parameters?: Record<string, unknown>;
797
887
  /** Omit the base64 payload while retaining persisted IDs/URL. */
798
888
  includeDataUrl?: boolean;
889
+ /** Caller-chosen ID used to correlate progress and cancel an in-flight native job. */
799
890
  clientJobId?: string;
800
891
  promptGenerationTimeoutSeconds?: number;
801
892
  generationTimeoutSeconds?: number;
802
893
  /** For operator-scoped extensions. */
803
894
  userId?: string;
804
895
  }
896
+ /**
897
+ * Additional native image controls supported by QuickGen-capable hosts.
898
+ * Compose with WorkerToHost explicitly so existing exhaustive handlers remain valid.
899
+ * Both messages require image_gen permission and account scope.
900
+ */
901
+ export type ImageGenNativeControlWorkerMessage = {
902
+ type: "image_gen_prompt_presets";
903
+ requestId: string;
904
+ userId?: string;
905
+ } | {
906
+ type: "image_gen_cancel_native";
907
+ requestId: string;
908
+ jobId: string;
909
+ userId?: string;
910
+ };
805
911
  /** Result from `spindle.imageGen.generateNative()`. */
806
912
  export interface ImageGenNativeResultDTO {
807
913
  generated: boolean;
@@ -812,6 +918,10 @@ export interface ImageGenNativeResultDTO {
812
918
  imageDataUrl?: string;
813
919
  imageId?: string;
814
920
  imageUrl?: string;
921
+ mediaType?: "image" | "video";
922
+ mimeType?: string;
923
+ /** Authenticated media URL; imageId/imageUrl remain available for compatibility. */
924
+ mediaUrl?: string;
815
925
  jobId?: string;
816
926
  }
817
927
  /** Result from `spindle.imageGen.generate()` */
@@ -3134,7 +3244,7 @@ export interface ProviderManager {
3134
3244
  key: ProviderKeyDTO;
3135
3245
  }) => void): () => void;
3136
3246
  }
3137
- export type WorkerToHost = {
3247
+ export type WorkerToHost = import("./desktop-capture.js").DesktopCaptureWorkerMessage | {
3138
3248
  type: "subscribe_event";
3139
3249
  event: string;
3140
3250
  } | {
@@ -3161,6 +3271,7 @@ export type WorkerToHost = {
3161
3271
  registrationId: string;
3162
3272
  priority?: number;
3163
3273
  match?: InterceptorMatchDTO;
3274
+ required?: boolean;
3164
3275
  } | {
3165
3276
  type: "unregister_interceptor";
3166
3277
  registrationId: string;
@@ -3507,13 +3618,16 @@ export type WorkerToHost = {
3507
3618
  type: "register_context_handler";
3508
3619
  priority?: number;
3509
3620
  timeoutMs?: number;
3621
+ required?: boolean;
3510
3622
  } | {
3511
3623
  type: "context_handler_result";
3512
3624
  requestId: string;
3513
3625
  context: unknown;
3626
+ error?: string;
3514
3627
  } | {
3515
3628
  type: "register_macro_interceptor";
3516
3629
  priority?: number;
3630
+ handlesOwnedSources?: boolean;
3517
3631
  } | {
3518
3632
  type: "macro_interceptor_result";
3519
3633
  requestId: string;
@@ -3541,6 +3655,20 @@ export type WorkerToHost = {
3541
3655
  type: "frontend_message";
3542
3656
  payload: unknown;
3543
3657
  userId?: string;
3658
+ frontendSessionId?: string;
3659
+ } | {
3660
+ type: "runtime_state_read";
3661
+ requestId: string;
3662
+ chatId: string;
3663
+ characterId: string;
3664
+ userId?: string;
3665
+ } | {
3666
+ type: "runtime_state_write";
3667
+ requestId: string;
3668
+ chatId: string;
3669
+ command: import("./runtime-state.js").RuntimeStateCommandDTO;
3670
+ userId?: string;
3671
+ mutationId?: string;
3544
3672
  } | {
3545
3673
  type: "user_storage_read";
3546
3674
  requestId: string;
@@ -4695,6 +4823,10 @@ export type HostToWorker = {
4695
4823
  type: "context_handler_request";
4696
4824
  requestId: string;
4697
4825
  context: unknown;
4826
+ } | {
4827
+ type: "context_handler_abort";
4828
+ requestId: string;
4829
+ reason: string;
4698
4830
  } | {
4699
4831
  type: "macro_interceptor_request";
4700
4832
  requestId: string;
@@ -4757,6 +4889,7 @@ export type HostToWorker = {
4757
4889
  type: "frontend_message";
4758
4890
  payload: unknown;
4759
4891
  userId: string;
4892
+ frontendSessionId?: string;
4760
4893
  } | {
4761
4894
  type: "frontend_process_lifecycle";
4762
4895
  event: FrontendProcessLifecycleEventDTO;
@@ -0,0 +1,100 @@
1
+ export type DesktopCaptureKind = "image" | "video";
2
+ export interface DesktopCaptureDevice {
3
+ id: string;
4
+ name: string;
5
+ platform: "linux" | "macos" | "windows";
6
+ capabilities: {
7
+ image: boolean;
8
+ video: boolean;
9
+ replay: boolean;
10
+ };
11
+ expiresAt: number;
12
+ }
13
+ export type DesktopCaptureRequest = {
14
+ deviceId: string;
15
+ connectionId: string;
16
+ purpose: string;
17
+ userId?: string;
18
+ } & ({
19
+ kind: "image";
20
+ } | {
21
+ kind: "video";
22
+ mode: "record" | "replay";
23
+ durationSeconds: number;
24
+ });
25
+ export interface CapturedMediaRef {
26
+ assetId: string;
27
+ kind: DesktopCaptureKind;
28
+ mimeType: string;
29
+ width: number;
30
+ height: number;
31
+ durationSeconds?: number;
32
+ connectionId: string;
33
+ expiresAt: number;
34
+ }
35
+ export interface SpindleDesktopAPI {
36
+ capture: {
37
+ listDevices(options?: {
38
+ userId?: string;
39
+ }): Promise<DesktopCaptureDevice[]>;
40
+ request(input: DesktopCaptureRequest): Promise<CapturedMediaRef>;
41
+ release(assetId: string, options?: {
42
+ userId?: string;
43
+ }): Promise<void>;
44
+ };
45
+ }
46
+ export type DesktopCaptureWorkerMessage = {
47
+ type: "desktop_capture_devices";
48
+ requestId: string;
49
+ userId?: string;
50
+ } | {
51
+ type: "desktop_capture_request";
52
+ requestId: string;
53
+ input: DesktopCaptureRequest;
54
+ } | {
55
+ type: "desktop_capture_release";
56
+ requestId: string;
57
+ assetId: string;
58
+ userId?: string;
59
+ };
60
+ export interface DesktopCaptureDestination {
61
+ connectionId: string;
62
+ revision: string;
63
+ provider: string;
64
+ model: string;
65
+ endpointOrigin: string;
66
+ }
67
+ export type DesktopCaptureCommand = {
68
+ type: "capture";
69
+ requestId: string;
70
+ extension: {
71
+ id: string;
72
+ identifier: string;
73
+ name: string;
74
+ };
75
+ purpose: string;
76
+ kind: DesktopCaptureKind;
77
+ mode?: "record" | "replay";
78
+ durationSeconds?: number;
79
+ destination: Omit<DesktopCaptureDestination, "revision">;
80
+ maxBytes: number;
81
+ maxPixels: number;
82
+ expiresAt: number;
83
+ } | {
84
+ type: "cancel";
85
+ requestId: string;
86
+ };
87
+ export type DesktopCaptureReply = {
88
+ requestId: string;
89
+ outcome: "approved";
90
+ media: {
91
+ mimeType: string;
92
+ data: string;
93
+ width: number;
94
+ height: number;
95
+ durationSeconds?: number;
96
+ };
97
+ } | {
98
+ requestId: string;
99
+ outcome: "denied" | "cancelled" | "unsupported" | "failed";
100
+ };
@@ -0,0 +1 @@
1
+ export {};
package/dist/dom.d.ts CHANGED
@@ -734,6 +734,8 @@ export interface SpindleDisplayContext {
734
734
  }
735
735
  export interface SpindleDisplayResolveResult {
736
736
  content: string;
737
+ /** Opaque local state carried from resolveBody to applyScripts with this content, including cache hits. */
738
+ processingState?: string;
737
739
  touchedVars?: string[];
738
740
  cacheable?: boolean;
739
741
  }
@@ -752,6 +754,8 @@ export interface SpindleDisplayTemplatesArgs {
752
754
  }
753
755
  export interface SpindleDisplayScriptsArgs {
754
756
  content: string;
757
+ /** The processingState returned by resolveBody for this content. Never sent to the backend. */
758
+ processingState?: string;
755
759
  scripts: unknown[];
756
760
  context: SpindleDisplayContext;
757
761
  resolvedFindPatterns?: Record<string, string>;
@@ -765,6 +769,10 @@ export interface SpindleDisplayScriptsArgs {
765
769
  * not ready for the chat, throws, or returns `null`.
766
770
  */
767
771
  export interface SpindleDisplayResolver {
772
+ /** Skip automatic formatting repairs in owned chat message bodies. Defaults to false; HTML sanitization still applies. */
773
+ skipFormattingHealing?: boolean;
774
+ /** Opt into finalization when no display scripts are active. Defaults to false. */
775
+ finalizeWithoutScripts?: boolean;
768
776
  ready(chatId: string): boolean;
769
777
  resolveBody(args: SpindleDisplayBodyArgs): Promise<SpindleDisplayResolveResult | null>;
770
778
  resolveTemplates(args: SpindleDisplayTemplatesArgs): Promise<SpindleDisplayTemplatesResult | null>;
@@ -1025,6 +1033,8 @@ export interface SpindleRecentChatsPage<TRow = SpindleRecentChat> {
1025
1033
  }
1026
1034
  /** Context object provided to frontend extension modules */
1027
1035
  export interface SpindleFrontendContext {
1036
+ /** Per-document routing identity, available with frontend-session-origin-v1. */
1037
+ readonly frontendSessionId?: string;
1028
1038
  /** Immutable host compatibility descriptor for this extension runtime. */
1029
1039
  readonly host: SpindleHostDescriptorV1 & {
1030
1040
  readonly surfaces?: SpindleHostSurfaceAPI;
@@ -1035,7 +1045,7 @@ export interface SpindleFrontendContext {
1035
1045
  readonly theme: SpindleThemeAuthoringAPI;
1036
1046
  dom: SpindleDOMHelper;
1037
1047
  events: {
1038
- on(event: string, handler: (payload: unknown) => void): () => void;
1048
+ on(event: string, handler: (payload: unknown, metadata?: import("./runtime-state.js").RuntimeEventMetadataDTO) => void): () => void;
1039
1049
  emit(event: string, payload: unknown): void;
1040
1050
  };
1041
1051
  ui: {
package/dist/events.d.ts CHANGED
@@ -11,6 +11,7 @@ export declare enum SpindleEvent {
11
11
  */
12
12
  export declare enum CoreEventType {
13
13
  CONNECTED = "CONNECTED",
14
+ FRONTEND_SESSION_CLOSED = "FRONTEND_SESSION_CLOSED",
14
15
  CHAT_CHANGED = "CHAT_CHANGED",
15
16
  CHAT_SWITCHED = "CHAT_SWITCHED",
16
17
  CHAT_FORKED = "CHAT_FORKED",
package/dist/events.js CHANGED
@@ -13,6 +13,7 @@ export var SpindleEvent;
13
13
  export var CoreEventType;
14
14
  (function (CoreEventType) {
15
15
  CoreEventType["CONNECTED"] = "CONNECTED";
16
+ CoreEventType["FRONTEND_SESSION_CLOSED"] = "FRONTEND_SESSION_CLOSED";
16
17
  CoreEventType["CHAT_CHANGED"] = "CHAT_CHANGED";
17
18
  CoreEventType["CHAT_SWITCHED"] = "CHAT_SWITCHED";
18
19
  CoreEventType["CHAT_FORKED"] = "CHAT_FORKED";
package/dist/index.d.ts CHANGED
@@ -5,13 +5,15 @@ export { SPINDLE_HOST_CAPABILITIES, SPINDLE_COMPATIBILITY_ERROR_CODE, } from "./
5
5
  export type { SpindleThemeAsset, SpindleThemeAssetUploadOptions, SpindleThemeAssetUpdate, SpindleThemePackComponentDraft, SpindleThemePackDraft, SpindleThemePackImportResult, SpindleThemePackInstallOptions, SpindleThemePackInstallResult, SpindleThemeComponentCatalogEntry, SpindleThemeVariableCatalogEntry, SpindleThemeEditorTarget, SpindleThemeEditorOptions, SpindleThemeAuthoringAPI, } from "./theme.js";
6
6
  export { SPINDLE_THEME_AUTHORING_HOST_CAPABILITIES } from "./theme.js";
7
7
  export type { SpindlePermission as SpindlePermissionType } from "./permissions.js";
8
+ export type { DesktopCaptureKind, DesktopCaptureDevice, DesktopCaptureRequest, CapturedMediaRef, SpindleDesktopAPI, DesktopCaptureWorkerMessage, DesktopCaptureDestination, DesktopCaptureCommand, DesktopCaptureReply, } from "./desktop-capture.js";
8
9
  export { ALL_PERMISSIONS, isValidPermission } from "./permissions.js";
9
10
  export type { SpindleCapability as SpindleCapabilityType } from "./capabilities.js";
10
11
  export { ALL_CAPABILITIES, isValidCapability } from "./capabilities.js";
11
12
  export { SpindleEvent, CoreEventType } from "./events.js";
13
+ export type { RuntimeStateRevisionDTO, RuntimeEventMetadataDTO, RuntimeCharacterDTO, RuntimeChatDTO, RuntimeMessageDTO, RuntimeStateSnapshotDTO, RuntimeStateCommandDTO, RuntimeStateAcknowledgementDTO, SpindleRuntimeStateAPI, } from "./runtime-state.js";
12
14
  export type { SpindleFrontendRuntimeCapability } from "./frontend-capabilities.js";
13
15
  export { ALL_FRONTEND_RUNTIME_CAPABILITIES, isValidFrontendRuntimeCapability, } from "./frontend-capabilities.js";
14
- export type { LlmMessagePartDTO, LlmMessageDTO, LlmThinkingBlockDTO, SpindleUserRoleDTO, InterceptorGenerationType, InterceptorMatchScalar, InterceptorMatchDTO, InterceptorRegistrationMatchOptions, InterceptorRegistrationOptions, InterceptorContextDTO, InterceptorDisposer, InterceptorHandler, DeferredGuidanceDTO, InterceptorBreakdownEntryDTO, FinalResponseDTO, InterceptorResultDTO, MacroDefinitionDTO, MacroInvocationContextDTO, MacroResolveOptionsDTO, MacroResolveResultDTO, ToolRegistrationDTO, ToolSchemaDTO, ToolCallDTO, ToolDefinitionDTO, GenerationUsageDTO, GenerationResponseDTO, GenerationDispatchSourceDTO, ConnectionDispatchDescriptorDTO, GenerationRequestDTO, GenerationReasoningOverrideDTO, ReasoningEffortDTO, ReasoningSettingsDTO, ThinkingDisplayDTO, ConnectionReasoningBindingsDTO, ChatAppendGenerationOptionsDTO, ChatAppendMessageOptionsDTO, StreamChunkDTO, RequestInitDTO, ConnectionProfileDTO, PermissionDeniedDetail, PermissionChangedDetail, McpTransportTypeDTO, McpServerDTO, McpServerCreateDTO, McpToolDTO, McpServerStatusDTO, McpToolCallOptionsDTO, CharacterDTO, CharacterCreateDTO, CharacterAvatarUploadDTO, CharacterUpdateDTO, ChatDTO, ChatUpdateDTO, ChatSwitchedPayloadDTO, ChatChangedPayloadDTO, ChatForkedPayloadDTO, PromptVariableOptionDTO, PromptVariableDefDTO, PromptVariableTypeDTO, PromptVariableValueDTO, PromptVariableValuesDTO, PromptBlockRoleDTO, PromptBlockPositionDTO, PromptBlockCategoryModeDTO, PromptBlockPlacementDTO, PromptBlockPlacementBindingDTO, PromptBlockDTO, PromptBlockSnapshotDTO, PromptBlockCreateDTO, PromptBlockUpdateDTO, PromptBlockCategoryGroupDTO, HostResponseErrorDTO, UserPresetDTO, UserPresetCreateDTO, UserPresetUpdateDTO, WorldBookDTO, WorldBookCreateDTO, WorldBookUpdateDTO, WorldBookEntryDTO, WorldBookEntryCreateDTO, WorldBookEntryUpdateDTO, RegexPlacementDTO, RegexScopeDTO, RegexTargetDTO, RegexMacroModeDTO, RegexScriptDTO, RegexScriptCreateDTO, RegexScriptUpdateDTO, RegexScriptListOptionsDTO, RegexScriptActiveOptionsDTO, WorldInfoInterceptorEntryDTO, WorldInfoInterceptorMessageDTO, WorldInfoActivationSettingsDTO, WorldInfoActivationOverridesDTO, WorldInfoInterceptorRoleDTO, WorldInfoInterceptorPlacementDTO, WorldInfoInterceptorCtxDTO, WorldInfoInterceptorMutationDTO, WorldInfoInterceptorResultDTO, DatabankScopeDTO, DatabankDocumentStatusDTO, DatabankDTO, DatabankCreateDTO, DatabankUpdateDTO, DatabankDocumentDTO, DatabankDocumentCreateDTO, DatabankDocumentUpdateDTO, PersonaDTO, GlobalAddonDTO, GlobalAddonUpdateDTO, LumiaItemDTO, LoomItemCategoryDTO, LoomItemDTO, LoomToolDTO, LumiaDlcPackDTO, LumiaDlcCatalogDTO, PersonaCreateDTO, PersonaUpdateDTO, ActivatedWorldInfoEntryDTO, WorldBookSourceDTO, WorldInfoActivatedEventDTO, DryRunRequestDTO, DryRunResultDTO, AssembleRequestDTO, AssembleResultDTO, BoundPrefillAttachmentDTO, BoundAssembleRequestDTO, BoundAssemblySuccessDTO, BoundAssemblyFailureDTO, BoundAssemblyOutcomeDTO, QuietTrackedRequestDTO, QuietDispatchReceiptDTO, QuietTrackedResultDTO, AssemblyBreakdownEntryDTO, ActivationStatsDTO, MemoryStatsDTO, DryRunTokenCountDTO, ChatMemoryChunkDTO, ChatMemoryResultDTO, ImageGenConnectionDTO, ImageGenParameterSchemaDTO, ImageGenProviderDTO, ImageGenRequestDTO, ImageGenResultDTO, ImageGenLoraEntryDTO, ImageGenCharacterLoraSelectionDTO, ImageGenNativeRequestDTO, ImageGenNativeResultDTO, ImageGenStreamRequestDTO, ImageGenStreamStatusDTO, ImageGenStreamPreviewDTO, ImageGenStreamDoneDTO, ImageGenStreamEventDTO, ImageGetOptionsDTO, ImageDTO, ImageListOptionsDTO, ImageSpecificityDTO, ImageVideoCodecDTO, ImageUploadDTO, ImageUploadFromDataUrlOptionsDTO, MediaSourceDTO, MediaAudioFormatDTO, MediaVideoFormatDTO, MediaVideoCodecDTO, MediaAudioCodecDTO, MediaFitModeDTO, MediaTransformResultDTO, MediaConvertAudioRequestDTO, MediaConvertVideoRequestDTO, MediaTranscodeVideoRequestDTO, MediaRemoveAudioFromVideoRequestDTO, MediaAddAudioToVideoRequestDTO, MediaCreateVideoFromImageAndAudioRequestDTO, ThemeOverrideDTO, ThemeInfoDTO, ThemePaletteConfigDTO, ThemeVariablesConfigDTO, ColorExtractionResult, ColorRGB, ColorHSL, SpindleModalItemDTO, SpindleCommandDTO, SpindleCommandContextDTO, SpindleUIDrawerTabDTO, SpindleUISettingsTabDTO, FrontendProcessStateDTO, FrontendProcessExitReasonDTO, FrontendProcessSpawnOptionsDTO, FrontendProcessListOptionsDTO, FrontendProcessInfoDTO, FrontendProcessLifecycleEventDTO, FrontendProcessStopOptionsDTO, BackendProcessStateDTO, BackendProcessExitReasonDTO, BackendProcessSpawnOptionsDTO, BackendProcessListOptionsDTO, BackendProcessInfoDTO, BackendProcessLifecycleEventDTO, BackendProcessStopOptionsDTO, GenerationStartedPayloadDTO, StreamTokenPayloadDTO, GenerationEndedPayloadDTO, GenerationStoppedPayloadDTO, GenerationObserver, ChatMessageDTO, MessageSwipeAction, MessageSwipedPayloadDTO, SwipeEditedPayloadDTO, ToolInvocationPayloadDTO, TokenModelSourceDTO, TokenCountOptionsDTO, TokenCountResultDTO, SpindleUploadDTO, SharedRpcRequestContextDTO, SharedRpcEndpointPolicyDTO, MacroInterceptorPhase, MacroInterceptorCharacterEnvDTO, MacroInterceptorChatEnvDTO, MacroInterceptorEnvDTO, MacroInterceptorCtxDTO, MacroInterceptorResultDTO, MacroInterceptorRichResultDTO, MessageContentProcessorOrigin, MessageContentProcessorCtxDTO, MessageContentProcessorResultDTO, WebSearchProviderDTO, WebSearchSettingsDTO, WebSearchResultDTO, WebSearchDocumentDTO, WebSearchRequestDTO, WebSearchResponseDTO, WorkerToHost, HostToWorker, ProviderKind, ProviderDescriptor, ProviderBrokerSpec, ProviderKeyDTO, WorkerToHostProviderMessage, HostToWorkerProviderMessage, ProviderRuntimeMessage, BrokerRequest, BrokerResponse, ProviderManager, } from "./api.js";
16
+ export type { LlmMessagePartDTO, LlmMessageDTO, LlmThinkingBlockDTO, SpindleUserRoleDTO, InterceptorGenerationType, InterceptorMatchScalar, InterceptorMatchDTO, InterceptorRegistrationMatchOptions, InterceptorRegistrationOptions, InterceptorContextDTO, InterceptorDisposer, InterceptorHandler, DeferredGuidanceDTO, InterceptorBreakdownEntryDTO, FinalResponseDTO, InterceptorResultDTO, MacroDefinitionDTO, MacroInvocationContextDTO, MacroResolveOptionsDTO, MacroResolveResultDTO, ToolRegistrationDTO, ToolSchemaDTO, ToolCallDTO, ToolDefinitionDTO, GenerationUsageDTO, GenerationResponseDTO, GenerationDispatchSourceDTO, ConnectionDispatchDescriptorDTO, GenerationRequestDTO, GenerationReasoningOverrideDTO, ReasoningEffortDTO, ReasoningSettingsDTO, ThinkingDisplayDTO, ConnectionReasoningBindingsDTO, ChatAppendGenerationOptionsDTO, ChatAppendMessageOptionsDTO, StreamChunkDTO, RequestInitDTO, ConnectionProfileDTO, PermissionDeniedDetail, PermissionChangedDetail, McpTransportTypeDTO, McpServerDTO, McpServerCreateDTO, McpToolDTO, McpServerStatusDTO, McpToolCallOptionsDTO, CharacterDTO, CharacterCreateDTO, CharacterAvatarUploadDTO, CharacterUpdateDTO, ChatDTO, ChatUpdateDTO, ChatSwitchedPayloadDTO, ChatChangedPayloadDTO, ChatForkedPayloadDTO, PromptVariableOptionDTO, PromptVariableDefDTO, PromptVariableTypeDTO, PromptVariableValueDTO, PromptVariableValuesDTO, PromptBlockRoleDTO, PromptBlockPositionDTO, PromptBlockCategoryModeDTO, PromptBlockPlacementDTO, PromptBlockPlacementBindingDTO, PromptBlockDTO, PromptBlockSnapshotDTO, PromptBlockCreateDTO, PromptBlockUpdateDTO, PromptBlockCategoryGroupDTO, HostResponseErrorDTO, UserPresetDTO, UserPresetCreateDTO, UserPresetUpdateDTO, WorldBookDTO, WorldBookCreateDTO, WorldBookUpdateDTO, WorldBookEntryDTO, WorldBookEntryCreateDTO, WorldBookEntryUpdateDTO, RegexPlacementDTO, RegexScopeDTO, RegexTargetDTO, RegexMacroModeDTO, RegexScriptDTO, RegexScriptCreateDTO, RegexScriptUpdateDTO, RegexScriptListOptionsDTO, RegexScriptActiveOptionsDTO, WorldInfoInterceptorEntryDTO, WorldInfoInterceptorMessageDTO, WorldInfoActivationSettingsDTO, WorldInfoActivationOverridesDTO, WorldInfoInterceptorRoleDTO, WorldInfoInterceptorPlacementDTO, WorldInfoInterceptorCtxDTO, WorldInfoInterceptorMutationDTO, WorldInfoInterceptorResultDTO, DatabankScopeDTO, DatabankDocumentStatusDTO, DatabankDTO, DatabankCreateDTO, DatabankUpdateDTO, DatabankDocumentDTO, DatabankDocumentCreateDTO, DatabankDocumentUpdateDTO, PersonaDTO, GlobalAddonDTO, GlobalAddonUpdateDTO, LumiaItemDTO, LoomItemCategoryDTO, LoomItemDTO, LoomToolDTO, LumiaDlcPackDTO, LumiaDlcCatalogDTO, PersonaCreateDTO, PersonaUpdateDTO, ActivatedWorldInfoEntryDTO, WorldBookSourceDTO, WorldInfoActivatedEventDTO, DryRunRequestDTO, DryRunResultDTO, AssembleRequestDTO, AssembleResultDTO, BoundPrefillAttachmentDTO, BoundAssembleRequestDTO, BoundAssemblySuccessDTO, BoundAssemblyFailureDTO, BoundAssemblyOutcomeDTO, QuietTrackedRequestDTO, QuietDispatchReceiptDTO, QuietTrackedResultDTO, AssemblyBreakdownEntryDTO, ActivationStatsDTO, MemoryStatsDTO, DryRunTokenCountDTO, ChatMemoryChunkDTO, ChatMemoryResultDTO, ImageGenConnectionDTO, ImageGenParameterSchemaDTO, ImageGenProviderDTO, ImageGenRequestDTO, ImageGenResultDTO, ImageGenLoraEntryDTO, ImageGenCharacterLoraSelectionDTO, ImageGenNativeRequestDTO, ImageGenNativeResultDTO, ImageGenPromptPresetDTO, ImageGenPromptPresetsResultDTO, ImageGenComfyUIFieldValuesDTO, ImageGenNativeParametersDTO, ImageGenNativeControlWorkerMessage, ImageGenStreamRequestDTO, ImageGenStreamStatusDTO, ImageGenStreamPreviewDTO, ImageGenStreamDoneDTO, ImageGenStreamEventDTO, ImageGetOptionsDTO, ImageDTO, ImageListOptionsDTO, ImageSpecificityDTO, ImageVideoCodecDTO, ImageUploadDTO, ImageUploadFromDataUrlOptionsDTO, MediaSourceDTO, MediaAudioFormatDTO, MediaVideoFormatDTO, MediaVideoCodecDTO, MediaAudioCodecDTO, MediaFitModeDTO, MediaTransformResultDTO, MediaConvertAudioRequestDTO, MediaConvertVideoRequestDTO, MediaTranscodeVideoRequestDTO, MediaRemoveAudioFromVideoRequestDTO, MediaAddAudioToVideoRequestDTO, MediaCreateVideoFromImageAndAudioRequestDTO, ThemeOverrideDTO, ThemeInfoDTO, ThemePaletteConfigDTO, ThemeVariablesConfigDTO, ColorExtractionResult, ColorRGB, ColorHSL, SpindleModalItemDTO, SpindleCommandDTO, SpindleCommandContextDTO, SpindleUIDrawerTabDTO, SpindleUISettingsTabDTO, FrontendProcessStateDTO, FrontendProcessExitReasonDTO, FrontendProcessSpawnOptionsDTO, FrontendProcessListOptionsDTO, FrontendProcessInfoDTO, FrontendProcessLifecycleEventDTO, FrontendProcessStopOptionsDTO, BackendProcessStateDTO, BackendProcessExitReasonDTO, BackendProcessSpawnOptionsDTO, BackendProcessListOptionsDTO, BackendProcessInfoDTO, BackendProcessLifecycleEventDTO, BackendProcessStopOptionsDTO, GenerationStartedPayloadDTO, StreamTokenPayloadDTO, GenerationEndedPayloadDTO, GenerationStoppedPayloadDTO, GenerationObserver, ChatMessageDTO, MessageSwipeAction, MessageSwipedPayloadDTO, SwipeEditedPayloadDTO, ToolInvocationPayloadDTO, TokenModelSourceDTO, TokenCountOptionsDTO, TokenCountResultDTO, SpindleUploadDTO, SharedRpcRequestContextDTO, SharedRpcEndpointPolicyDTO, MacroInterceptorPhase, MacroInterceptorCharacterEnvDTO, MacroInterceptorChatEnvDTO, MacroInterceptorEnvDTO, MacroInterceptorCtxDTO, MacroInterceptorResultDTO, MacroInterceptorRichResultDTO, MessageContentProcessorOrigin, MessageContentProcessorCtxDTO, MessageContentProcessorResultDTO, WebSearchProviderDTO, WebSearchSettingsDTO, WebSearchResultDTO, WebSearchDocumentDTO, WebSearchRequestDTO, WebSearchResponseDTO, WorkerToHost, HostToWorker, ProviderKind, ProviderDescriptor, ProviderBrokerSpec, ProviderKeyDTO, WorkerToHostProviderMessage, HostToWorkerProviderMessage, ProviderRuntimeMessage, BrokerRequest, BrokerResponse, ProviderManager, } from "./api.js";
15
17
  export { PERMISSION_DENIED_PREFIX } from "./api.js";
16
18
  export type { ToolRegistration, JSONSchema } from "./tools.js";
17
19
  export type { SpindleMessageElement, SpindleTextEditorOptions, SpindleTextEditorResult, SpindleDOMHelper, SpindleMountPoint, SpindleUploadFile, SpindleMessageTagIntercept, SpindleMessageTagInterceptorOptions, SpindleMessageWidgetOptions, PermissionRequestOptions, SpindleFrontendContext, SpindleFrontendContextV2, SpindleSettingsAPI, SpindleSettingsTabOptions, SpindleSettingsTabSection, SpindleSettingsTabHandle, SpindleStateSelectors, SpindleResizeController, SpindleGeometryAPI, SpindleHostSurfaceKind, SpindleHostSurfaceRef, SpindleHostActionJsonValue, SpindleHostActionParams, SpindleHostSurfaceInfo, SpindleHostSurfaceTarget, SpindleHostSurfaceTargetHandler, SpindleHostSurfaceAPI, SpindleComponentOverrideOptions, SpindleComponentOverrideHandle, SpindleDomDecoratorOptions, SpindleDomDecoratorHandle, SpindleMessageActionOptions, SpindleMessageActionHandle, SpindleFrontendWorldBooksAPI, SpindleFrontendTokensAPI, SpindleFrontendConnectionsAPI, SpindleFrontendChatsAPI, SpindleFrontendMessagesAPI, SpindleRecentChatsQuery, SpindleRecentChat, SpindleGroupedRecentChat, SpindleRecentChatsPage, SpindleFrontendModule, SpindleFrontendWidgetTarget, SpindleWidgetFrontendModule, SpindleFrontendTeardown, SpindleGuideDefinition, SpindleDrawerTabOptions, SpindleDrawerTabHandle, SpindleCharacterEditorTabOptions, SpindleCharacterEditorTabHandle, SpindleCharacterEditorState, SpindleCharacterEditorSaveOptions, SpindleCharacterEditorHelper, SpindlePresetEditorTabOptions, SpindlePresetEditorTabHandle, SpindlePresetEditorToolbarItemOptions, SpindlePresetEditorToolbarItemHandle, SpindlePresetEditorDraft, SpindlePresetEditorState, SpindlePresetEditorSaveOptions, SpindlePresetEditorHelper, SpindlePresetEditorBuiltinTabId, SpindlePresetEditorExtensionState, SpindlePresetEditorScopedHelper, SpindleFloatWidgetOptions, SpindleFloatWidgetHandle, SpindleDockEdge, SpindleDockPanelOptions, SpindleDockPanelHandle, SpindleAppMountOptions, SpindleAppMountHandle, SpindleInputBarActionOptions, SpindleInputBarActionHandle, SpindleSandboxFrameOptions, SpindleSandboxFrameHandle, SpindleSandboxMediaResource, SpindleSandboxAudioOptions, SpindleSandboxAudioHandle, SpindleSandboxAPI, SpindleContextMenuOptions, SpindleContextMenuItemDef, SpindleContextMenuResult, SpindleModalOptions, SpindleModalHandle, SpindleConfirmVariant, SpindleConfirmOptions, SpindleConfirmResult, SpindleUIDomActionEventType, SpindleUIKeyboardState, SpindleUIDrawerState, SpindleUISettingsState, SpindleUIDomActionDetail, SpindleUIDomActionBindingOptions, SpindleUIEventsHelper, SpindleFrontendProcessContext, SpindleFrontendProcessRegistry, SpindleDisplayResolver, SpindleDisplayResolverRegistry, SpindleDisplayContext, SpindleDisplayBodyArgs, SpindleDisplayTemplatesArgs, SpindleDisplayScriptsArgs, SpindleDisplayResolveResult, SpindleDisplayTemplatesResult, SpindleTabLocation, } from "./dom.js";
@@ -37,6 +37,6 @@
37
37
  * - "mcp_servers" — inspect/connect user MCP servers and invoke advertised tools
38
38
  * - "mcp_servers.create" — add MCP server profiles for a user
39
39
  */
40
- export type SpindlePermission = "generation" | "interceptor" | "tools" | "cors_proxy" | "context_handler" | "ephemeral_storage" | "chat_mutation" | "event_tracking" | "ui_panels" | "app_manipulation" | "oauth" | "characters" | "chats" | "presets" | "world_books" | "regex_scripts" | "regex_scripts_unrestricted" | "databanks" | "memories" | "media" | "personas" | "push_notification" | "image_gen" | "images" | "generation_parameters" | "macro_interceptor" | "web_search" | "unsafe_eval" | "final_response" | "providers.embedding.register" | "providers.tts.register" | "providers.stt.register" | "providers.sidecar.register" | "mcp_servers" | "mcp_servers.create";
40
+ export type SpindlePermission = "screen_capture" | "screen_recording" | "generation" | "interceptor" | "tools" | "cors_proxy" | "context_handler" | "ephemeral_storage" | "chat_mutation" | "event_tracking" | "ui_panels" | "app_manipulation" | "oauth" | "characters" | "chats" | "presets" | "world_books" | "regex_scripts" | "regex_scripts_unrestricted" | "databanks" | "memories" | "media" | "personas" | "push_notification" | "image_gen" | "images" | "generation_parameters" | "macro_interceptor" | "web_search" | "unsafe_eval" | "final_response" | "providers.embedding.register" | "providers.tts.register" | "providers.stt.register" | "providers.sidecar.register" | "mcp_servers" | "mcp_servers.create";
41
41
  export declare const ALL_PERMISSIONS: readonly SpindlePermission[];
42
42
  export declare function isValidPermission(p: string): p is SpindlePermission;
@@ -1,4 +1,6 @@
1
1
  export const ALL_PERMISSIONS = [
2
+ "screen_capture",
3
+ "screen_recording",
2
4
  "generation",
3
5
  "interceptor",
4
6
  "tools",
@@ -0,0 +1,99 @@
1
+ import type { CharacterDTO, ChatDTO, PersonaDTO, WorldBookEntryDTO } from "./api.js";
2
+ export interface RuntimeStateRevisionDTO {
3
+ epoch: string;
4
+ sequence: number;
5
+ }
6
+ export interface RuntimeEventMetadataDTO {
7
+ stateRevision?: RuntimeStateRevisionDTO;
8
+ runtimeMutationId?: string;
9
+ }
10
+ export type RuntimeCharacterDTO = Omit<CharacterDTO, "extensions">;
11
+ export type RuntimeChatDTO = Omit<ChatDTO, "character_id"> & {
12
+ character_id: string | null;
13
+ };
14
+ export interface RuntimeMessageDTO {
15
+ id: string;
16
+ content: string;
17
+ role: "user" | "assistant" | "system";
18
+ name: string;
19
+ index_in_chat: number;
20
+ created_at: number;
21
+ send_date: number;
22
+ extra: {
23
+ greeting_index?: unknown;
24
+ };
25
+ }
26
+ export interface RuntimeStateSnapshotDTO {
27
+ revision: RuntimeStateRevisionDTO;
28
+ chat: RuntimeChatDTO;
29
+ character: RuntimeCharacterDTO;
30
+ persona: PersonaDTO | null;
31
+ messages: RuntimeMessageDTO[];
32
+ lore: WorldBookEntryDTO[];
33
+ globalVariables: unknown;
34
+ }
35
+ export type RuntimeStateCommandDTO = {
36
+ kind: "chat.metadata";
37
+ key: string;
38
+ value: unknown;
39
+ } | {
40
+ kind: "chat.variables";
41
+ values: Record<string, string | null>;
42
+ } | {
43
+ kind: "message.edit";
44
+ id: string;
45
+ content: string;
46
+ } | {
47
+ kind: "message.delete";
48
+ id: string;
49
+ } | {
50
+ kind: "message.create";
51
+ id: string;
52
+ content: string;
53
+ role: "user" | "assistant" | "system";
54
+ } | {
55
+ kind: "character.update";
56
+ id: string;
57
+ patch: {
58
+ name?: string;
59
+ description?: string;
60
+ first_mes?: string;
61
+ };
62
+ } | {
63
+ kind: "persona.update";
64
+ id: string;
65
+ patch: {
66
+ name?: string;
67
+ description?: string;
68
+ };
69
+ } | {
70
+ kind: "lore.create";
71
+ bookId: string;
72
+ patch: Record<string, unknown>;
73
+ } | {
74
+ kind: "lore.update";
75
+ id: string;
76
+ patch: Record<string, unknown>;
77
+ } | {
78
+ kind: "lore.delete";
79
+ id: string;
80
+ };
81
+ export interface RuntimeStateAcknowledgementDTO {
82
+ revision: RuntimeStateRevisionDTO;
83
+ value: unknown;
84
+ patch: {
85
+ chat?: RuntimeChatDTO;
86
+ character?: RuntimeCharacterDTO;
87
+ persona?: PersonaDTO;
88
+ message?: RuntimeMessageDTO;
89
+ deletedMessageId?: string;
90
+ loreEntry?: WorldBookEntryDTO;
91
+ deletedLoreId?: string;
92
+ };
93
+ }
94
+ export interface SpindleRuntimeStateAPI {
95
+ /** Requires characters, chats, chat_mutation, personas, and world_books permissions. */
96
+ read(chatId: string, characterId: string, userId?: string): Promise<RuntimeStateSnapshotDTO>;
97
+ /** Mutation IDs correlate events with acknowledgements; they do not provide idempotency. */
98
+ write(chatId: string, command: RuntimeStateCommandDTO, userId?: string, mutationId?: string): Promise<RuntimeStateAcknowledgementDTO>;
99
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,8 +1,9 @@
1
1
  import type { SpindleManifest } from "./manifest.js";
2
2
  import type { SpindleHostDescriptorV1 } from "./host.js";
3
+ import type { SpindleDesktopAPI } from "./desktop-capture.js";
3
4
  import type { SpindleTextEditorOptions, SpindleTextEditorResult } from "./dom.js";
4
5
  import type { CouncilMemberContext, CouncilSettings } from "./council.js";
5
- import type { LlmMessageDTO, InterceptorDisposer, InterceptorHandler, InterceptorRegistrationMatchOptions, InterceptorRegistrationOptions, MacroDefinitionDTO, MacroResolveOptionsDTO, MacroResolveResultDTO, ToolRegistrationDTO, GenerationRequestDTO, ChatAppendMessageOptionsDTO, RequestInitDTO, ConnectionProfileDTO, ConnectionDispatchDescriptorDTO, PermissionDeniedDetail, PermissionChangedDetail, CharacterDTO, CharacterCreateDTO, CharacterAvatarUploadDTO, CharacterUpdateDTO, ChatDTO, ChatUpdateDTO, UserPresetDTO, UserPresetCreateDTO, UserPresetUpdateDTO, PromptBlockSnapshotDTO, PromptBlockCreateDTO, PromptBlockUpdateDTO, PromptBlockCategoryGroupDTO, WorldBookDTO, WorldBookCreateDTO, WorldBookUpdateDTO, WorldBookEntryDTO, WorldBookEntryCreateDTO, WorldBookEntryUpdateDTO, RegexScriptDTO, RegexScriptCreateDTO, RegexScriptUpdateDTO, RegexScriptListOptionsDTO, RegexScriptActiveOptionsDTO, DatabankDTO, DatabankCreateDTO, DatabankUpdateDTO, DatabankDocumentDTO, DatabankDocumentCreateDTO, DatabankDocumentUpdateDTO, PersonaDTO, GlobalAddonDTO, GlobalAddonUpdateDTO, LumiaItemDTO, LumiaDlcCatalogDTO, PersonaCreateDTO, PersonaUpdateDTO, ActivatedWorldInfoEntryDTO, DryRunRequestDTO, DryRunResultDTO, AssembleRequestDTO, AssembleResultDTO, BoundAssembleRequestDTO, BoundAssemblyOutcomeDTO, QuietTrackedRequestDTO, QuietTrackedResultDTO, BrokerRequest, BrokerResponse, ChatMemoryResultDTO, ProviderManager, ImageGenRequestDTO, ImageGenResultDTO, ImageGenNativeRequestDTO, ImageGenNativeResultDTO, ImageGenStreamRequestDTO, ImageGenStreamEventDTO, ImageGenConnectionDTO, ImageGenProviderDTO, ImageGetOptionsDTO, ImageDTO, ImageListOptionsDTO, ImageUploadDTO, ImageUploadFromDataUrlOptionsDTO, MediaConvertAudioRequestDTO, MediaConvertVideoRequestDTO, MediaTranscodeVideoRequestDTO, MediaRemoveAudioFromVideoRequestDTO, MediaAddAudioToVideoRequestDTO, MediaCreateVideoFromImageAndAudioRequestDTO, MediaTransformResultDTO, ThemeOverrideDTO, ThemeInfoDTO, ThemePaletteConfigDTO, ThemeVariablesConfigDTO, ColorExtractionResult, SpindleUserRoleDTO, SpindleModalItemDTO, SpindleCommandDTO, SpindleCommandContextDTO, SpindleUIDrawerTabDTO, SpindleUISettingsTabDTO, FrontendProcessSpawnOptionsDTO, FrontendProcessListOptionsDTO, FrontendProcessInfoDTO, FrontendProcessLifecycleEventDTO, FrontendProcessStopOptionsDTO, BackendProcessSpawnOptionsDTO, BackendProcessListOptionsDTO, BackendProcessInfoDTO, BackendProcessLifecycleEventDTO, BackendProcessStopOptionsDTO, ChatChangedPayloadDTO, ChatForkedPayloadDTO, ChatMessageDTO, GenerationStartedPayloadDTO, StreamTokenPayloadDTO, GenerationEndedPayloadDTO, GenerationStoppedPayloadDTO, GenerationObserver, MessageSwipedPayloadDTO, SwipeEditedPayloadDTO, ToolInvocationPayloadDTO, StreamChunkDTO, TokenCountOptionsDTO, TokenCountResultDTO, SpindleUploadDTO, MacroInterceptorCtxDTO, MacroInterceptorResultDTO, WorldInfoInterceptorCtxDTO, WorldInfoInterceptorResultDTO, MessageContentProcessorCtxDTO, MessageContentProcessorResultDTO, SharedRpcRequestContextDTO, SharedRpcEndpointPolicyDTO, WebSearchRequestDTO, WebSearchResponseDTO, WebSearchSettingsDTO, McpServerDTO, McpServerCreateDTO, McpServerStatusDTO, McpToolDTO, McpToolCallOptionsDTO } from "./api.js";
6
+ import type { LlmMessageDTO, InterceptorDisposer, InterceptorHandler, InterceptorRegistrationMatchOptions, InterceptorRegistrationOptions, MacroDefinitionDTO, MacroResolveOptionsDTO, MacroResolveResultDTO, ToolRegistrationDTO, GenerationRequestDTO, ChatAppendMessageOptionsDTO, RequestInitDTO, ConnectionProfileDTO, ConnectionDispatchDescriptorDTO, PermissionDeniedDetail, PermissionChangedDetail, CharacterDTO, CharacterCreateDTO, CharacterAvatarUploadDTO, CharacterUpdateDTO, ChatDTO, ChatUpdateDTO, UserPresetDTO, UserPresetCreateDTO, UserPresetUpdateDTO, PromptBlockSnapshotDTO, PromptBlockCreateDTO, PromptBlockUpdateDTO, PromptBlockCategoryGroupDTO, WorldBookDTO, WorldBookCreateDTO, WorldBookUpdateDTO, WorldBookEntryDTO, WorldBookEntryCreateDTO, WorldBookEntryUpdateDTO, RegexScriptDTO, RegexScriptCreateDTO, RegexScriptUpdateDTO, RegexScriptListOptionsDTO, RegexScriptActiveOptionsDTO, DatabankDTO, DatabankCreateDTO, DatabankUpdateDTO, DatabankDocumentDTO, DatabankDocumentCreateDTO, DatabankDocumentUpdateDTO, PersonaDTO, GlobalAddonDTO, GlobalAddonUpdateDTO, LumiaItemDTO, LumiaDlcCatalogDTO, PersonaCreateDTO, PersonaUpdateDTO, ActivatedWorldInfoEntryDTO, DryRunRequestDTO, DryRunResultDTO, AssembleRequestDTO, AssembleResultDTO, BoundAssembleRequestDTO, BoundAssemblyOutcomeDTO, QuietTrackedRequestDTO, QuietTrackedResultDTO, BrokerRequest, BrokerResponse, ChatMemoryResultDTO, ProviderManager, ImageGenRequestDTO, ImageGenResultDTO, ImageGenNativeRequestDTO, ImageGenNativeResultDTO, ImageGenPromptPresetsResultDTO, ImageGenStreamRequestDTO, ImageGenStreamEventDTO, ImageGenConnectionDTO, ImageGenProviderDTO, ImageGetOptionsDTO, ImageDTO, ImageListOptionsDTO, ImageUploadDTO, ImageUploadFromDataUrlOptionsDTO, MediaConvertAudioRequestDTO, MediaConvertVideoRequestDTO, MediaTranscodeVideoRequestDTO, MediaRemoveAudioFromVideoRequestDTO, MediaAddAudioToVideoRequestDTO, MediaCreateVideoFromImageAndAudioRequestDTO, MediaTransformResultDTO, ThemeOverrideDTO, ThemeInfoDTO, ThemePaletteConfigDTO, ThemeVariablesConfigDTO, ColorExtractionResult, SpindleUserRoleDTO, SpindleModalItemDTO, SpindleCommandDTO, SpindleCommandContextDTO, SpindleUIDrawerTabDTO, SpindleUISettingsTabDTO, FrontendProcessSpawnOptionsDTO, FrontendProcessListOptionsDTO, FrontendProcessInfoDTO, FrontendProcessLifecycleEventDTO, FrontendProcessStopOptionsDTO, BackendProcessSpawnOptionsDTO, BackendProcessListOptionsDTO, BackendProcessInfoDTO, BackendProcessLifecycleEventDTO, BackendProcessStopOptionsDTO, ChatChangedPayloadDTO, ChatForkedPayloadDTO, ChatMessageDTO, GenerationStartedPayloadDTO, StreamTokenPayloadDTO, GenerationEndedPayloadDTO, GenerationStoppedPayloadDTO, GenerationObserver, MessageSwipedPayloadDTO, SwipeEditedPayloadDTO, ToolInvocationPayloadDTO, StreamChunkDTO, TokenCountOptionsDTO, TokenCountResultDTO, SpindleUploadDTO, MacroInterceptorCtxDTO, MacroInterceptorResultDTO, WorldInfoInterceptorCtxDTO, WorldInfoInterceptorResultDTO, MessageContentProcessorCtxDTO, MessageContentProcessorResultDTO, SharedRpcRequestContextDTO, SharedRpcEndpointPolicyDTO, WebSearchRequestDTO, WebSearchResponseDTO, WebSearchSettingsDTO, McpServerDTO, McpServerCreateDTO, McpServerStatusDTO, McpToolDTO, McpToolCallOptionsDTO } from "./api.js";
6
7
  import type { ChatChunkDTO, ChatLinkAttachDTO, ChatLinkDTO, ChatMemoryWarmupResultDTO, CortexIngestionStatusDTO, CortexIngestionTelemetryDTO, CortexQueryDTO, CortexResultDTO, CortexUsageStatsDTO, LinkedCortexResultDTO, MemoryConsolidationDTO, MemoryCortexConfigDTO, MemoryEntityDTO, MemoryEntityStatusUpdateDTO, MemoryEntityUpsertDTO, MemoryRelationDTO, MemoryRelationUpsertDTO, MemorySalienceDTO, VaultChunkDTO, VaultCreateDTO, VaultDTO, VaultReindexResultDTO, VaultWithContentsDTO } from "./memories.js";
7
8
  export interface FrontendProcessHandle {
8
9
  /** Host-assigned process ID unique within the extension runtime. */
@@ -132,6 +133,7 @@ export interface SpindleConnectionsAPI {
132
133
  }
133
134
  /** The global `spindle` object available in backend extension workers */
134
135
  export interface SpindleAPI {
136
+ readonly desktop: SpindleDesktopAPI;
135
137
  /** Immutable host compatibility descriptor for this extension runtime. */
136
138
  readonly host: SpindleHostDescriptorV1;
137
139
  /**
@@ -697,6 +699,19 @@ export interface SpindleAPI {
697
699
  * connection-level generation semantics remain unchanged.
698
700
  */
699
701
  generateNative(input: ImageGenNativeRequestDTO): Promise<ImageGenNativeResultDTO>;
702
+ /**
703
+ * Read Main Presets and active preset/connection IDs without changing settings.
704
+ * Requires image_gen permission and account scope. Optional because older
705
+ * hosts do not implement it; feature-detect before calling.
706
+ */
707
+ getPromptPresets?(userId?: string): Promise<ImageGenPromptPresetsResultDTO>;
708
+ /**
709
+ * Cancel an in-flight native job owned by this extension and account.
710
+ * Returns false when no matching job exists. Requires image_gen permission;
711
+ * feature-detect on older hosts. Supply clientJobId when starting the job to
712
+ * know its ID before generateNative resolves.
713
+ */
714
+ cancelNative?(jobId: string, userId?: string): Promise<boolean>;
700
715
  /**
701
716
  * Generate through a provider that supports WebSocket preview images and
702
717
  * status updates (currently SwarmUI and ComfyUI). The terminal `done`
@@ -1340,9 +1355,12 @@ export interface SpindleAPI {
1340
1355
  * `dryRun` (tokenize/preview assemblies) and `userId`, returning it with
1341
1356
  * `cancelGeneration: true` stops the generation, and `opts.timeoutMs`
1342
1357
  * overrides the default 10s wall-clock budget (clamped to 1s-120s).
1358
+ * Hosts with required-context-handlers-v1 supply cancellation and honor
1359
+ * `required: true` by stopping generation on handler failure or timeout.
1343
1360
  */
1344
- registerContextHandler(handler: (context: unknown) => Promise<unknown>, priority?: number, opts?: {
1361
+ registerContextHandler(handler: (context: unknown, signal?: AbortSignal) => Promise<unknown>, priority?: number, opts?: {
1345
1362
  timeoutMs?: number;
1363
+ required?: boolean;
1346
1364
  }): void;
1347
1365
  /**
1348
1366
  * Host contract versions for feature detection, keyed by contract name.
@@ -1371,11 +1389,18 @@ export interface SpindleAPI {
1371
1389
  * Each invocation runs inside a 10-second wall-clock budget on the host.
1372
1390
  * On timeout or thrown error the chain logs the failure and forwards the
1373
1391
  * previous template to the next handler — macro evaluation itself never
1374
- * aborts. A second registration from the same extension replaces the
1392
+ * aborts in the normal chain. Owned-source evaluation instead rejects on failure.
1393
+ * A second registration from the same extension replaces the
1375
1394
  * previous handler.
1376
1395
  *
1377
1396
  * @param handler Returns the transformed template, or `void` to pass through.
1378
1397
  * @param priority Lower values run first. Default `100`.
1398
+ * @param opts Opt into exclusive evaluation of macro-bearing regex templates owned
1399
+ * by this extension. The handler receives the unmodified source with `sourceOwner`
1400
+ * set and must return a result, which is used verbatim without native evaluation.
1401
+ * Plain templates skip dispatch. Stored messages on characters with this extension
1402
+ * namespace's `display_owner: true` also stay verbatim for its display pipeline.
1403
+ * Other templates retain normal chain behavior.
1379
1404
  *
1380
1405
  * @example
1381
1406
  * ```ts
@@ -1385,7 +1410,9 @@ export interface SpindleAPI {
1385
1410
  * }, 100)
1386
1411
  * ```
1387
1412
  */
1388
- registerMacroInterceptor(handler: (ctx: MacroInterceptorCtxDTO) => Promise<MacroInterceptorResultDTO>, priority?: number): void;
1413
+ registerMacroInterceptor(handler: (ctx: MacroInterceptorCtxDTO) => Promise<MacroInterceptorResultDTO>, priority?: number, opts?: {
1414
+ handlesOwnedSources?: boolean;
1415
+ }): void;
1389
1416
  /**
1390
1417
  * Register a world info interceptor (permission: `generation`).
1391
1418
  *
@@ -1467,10 +1494,16 @@ export interface SpindleAPI {
1467
1494
  * other API call site that surfaced one) to route the reply
1468
1495
  * only to that user. User-scoped extensions always deliver
1469
1496
  * to their installer regardless of this argument.
1497
+ * @param options A document target requires frontend-session-routing-v1 and
1498
+ * never falls back to broadcasting when disconnected.
1470
1499
  */
1471
- sendToFrontend(payload: unknown, userId?: string): void;
1500
+ sendToFrontend(payload: unknown, userId?: string, options?: {
1501
+ frontendSessionId?: string;
1502
+ }): void;
1472
1503
  /** Receive messages from the frontend module (userId is the sender) */
1473
- onFrontendMessage(handler: (payload: unknown, userId: string) => void): () => void;
1504
+ onFrontendMessage(handler: (payload: unknown, userId: string, frontendSessionId?: string) => void): () => void;
1505
+ /** Versioned snapshots and command acknowledgements; requires runtime-state-v1. */
1506
+ runtimeState: import("./runtime-state.js").SpindleRuntimeStateAPI;
1474
1507
  /**
1475
1508
  * Backend-owned lifecycle controller for tracked frontend processes.
1476
1509
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lumiverse-spindle-types",
3
- "version": "0.6.36",
3
+ "version": "0.6.38",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "keywords": [