lumiverse-spindle-types 0.6.36 → 0.6.37

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>;
@@ -96,16 +104,21 @@ export interface InterceptorMatchDTO {
96
104
  }
97
105
  export interface InterceptorRegistrationMatchOptions {
98
106
  match?: InterceptorMatchDTO;
107
+ /** Stop generation on failure instead of continuing with the previous prompt. */
108
+ required?: boolean;
99
109
  }
100
110
  export interface InterceptorRegistrationOptions {
101
111
  priority?: number;
102
112
  match?: InterceptorMatchDTO;
113
+ required?: boolean;
103
114
  }
104
115
  /**
105
116
  * Host-owned, immutable context for one bound interceptor callback.
106
117
  * `signal` is local to the worker invocation and is never serialized.
107
118
  */
108
119
  export interface InterceptorContextDTO {
120
+ /** Host-selected execution document, pinned for this generation. Absent when no main frontend is connected. */
121
+ readonly frontendSessionId?: string;
109
122
  readonly userId: string;
110
123
  readonly chatId: string;
111
124
  readonly generationId: string;
@@ -278,6 +291,10 @@ export interface MacroInterceptorCtxDTO {
278
291
  readonly commit: boolean;
279
292
  readonly phase: MacroInterceptorPhase;
280
293
  readonly sourceHint?: string;
294
+ /** Present when this extension is the opted-in evaluator for the complete source. */
295
+ readonly sourceOwner?: {
296
+ readonly extensionIdentifier: string;
297
+ };
281
298
  /**
282
299
  * User ID that initiated the macro resolution (when available). Relevant
283
300
  * for operator-scoped extensions that need to route work through other
@@ -3134,7 +3151,7 @@ export interface ProviderManager {
3134
3151
  key: ProviderKeyDTO;
3135
3152
  }) => void): () => void;
3136
3153
  }
3137
- export type WorkerToHost = {
3154
+ export type WorkerToHost = import("./desktop-capture.js").DesktopCaptureWorkerMessage | {
3138
3155
  type: "subscribe_event";
3139
3156
  event: string;
3140
3157
  } | {
@@ -3161,6 +3178,7 @@ export type WorkerToHost = {
3161
3178
  registrationId: string;
3162
3179
  priority?: number;
3163
3180
  match?: InterceptorMatchDTO;
3181
+ required?: boolean;
3164
3182
  } | {
3165
3183
  type: "unregister_interceptor";
3166
3184
  registrationId: string;
@@ -3507,13 +3525,16 @@ export type WorkerToHost = {
3507
3525
  type: "register_context_handler";
3508
3526
  priority?: number;
3509
3527
  timeoutMs?: number;
3528
+ required?: boolean;
3510
3529
  } | {
3511
3530
  type: "context_handler_result";
3512
3531
  requestId: string;
3513
3532
  context: unknown;
3533
+ error?: string;
3514
3534
  } | {
3515
3535
  type: "register_macro_interceptor";
3516
3536
  priority?: number;
3537
+ handlesOwnedSources?: boolean;
3517
3538
  } | {
3518
3539
  type: "macro_interceptor_result";
3519
3540
  requestId: string;
@@ -3541,6 +3562,20 @@ export type WorkerToHost = {
3541
3562
  type: "frontend_message";
3542
3563
  payload: unknown;
3543
3564
  userId?: string;
3565
+ frontendSessionId?: string;
3566
+ } | {
3567
+ type: "runtime_state_read";
3568
+ requestId: string;
3569
+ chatId: string;
3570
+ characterId: string;
3571
+ userId?: string;
3572
+ } | {
3573
+ type: "runtime_state_write";
3574
+ requestId: string;
3575
+ chatId: string;
3576
+ command: import("./runtime-state.js").RuntimeStateCommandDTO;
3577
+ userId?: string;
3578
+ mutationId?: string;
3544
3579
  } | {
3545
3580
  type: "user_storage_read";
3546
3581
  requestId: string;
@@ -4695,6 +4730,10 @@ export type HostToWorker = {
4695
4730
  type: "context_handler_request";
4696
4731
  requestId: string;
4697
4732
  context: unknown;
4733
+ } | {
4734
+ type: "context_handler_abort";
4735
+ requestId: string;
4736
+ reason: string;
4698
4737
  } | {
4699
4738
  type: "macro_interceptor_request";
4700
4739
  requestId: string;
@@ -4757,6 +4796,7 @@ export type HostToWorker = {
4757
4796
  type: "frontend_message";
4758
4797
  payload: unknown;
4759
4798
  userId: string;
4799
+ frontendSessionId?: string;
4760
4800
  } | {
4761
4801
  type: "frontend_process_lifecycle";
4762
4802
  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,10 +5,12 @@ 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
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, 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";
@@ -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,5 +1,6 @@
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
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, 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";
@@ -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
  /**
@@ -1340,9 +1342,12 @@ export interface SpindleAPI {
1340
1342
  * `dryRun` (tokenize/preview assemblies) and `userId`, returning it with
1341
1343
  * `cancelGeneration: true` stops the generation, and `opts.timeoutMs`
1342
1344
  * overrides the default 10s wall-clock budget (clamped to 1s-120s).
1345
+ * Hosts with required-context-handlers-v1 supply cancellation and honor
1346
+ * `required: true` by stopping generation on handler failure or timeout.
1343
1347
  */
1344
- registerContextHandler(handler: (context: unknown) => Promise<unknown>, priority?: number, opts?: {
1348
+ registerContextHandler(handler: (context: unknown, signal?: AbortSignal) => Promise<unknown>, priority?: number, opts?: {
1345
1349
  timeoutMs?: number;
1350
+ required?: boolean;
1346
1351
  }): void;
1347
1352
  /**
1348
1353
  * Host contract versions for feature detection, keyed by contract name.
@@ -1371,11 +1376,18 @@ export interface SpindleAPI {
1371
1376
  * Each invocation runs inside a 10-second wall-clock budget on the host.
1372
1377
  * On timeout or thrown error the chain logs the failure and forwards the
1373
1378
  * previous template to the next handler — macro evaluation itself never
1374
- * aborts. A second registration from the same extension replaces the
1379
+ * aborts in the normal chain. Owned-source evaluation instead rejects on failure.
1380
+ * A second registration from the same extension replaces the
1375
1381
  * previous handler.
1376
1382
  *
1377
1383
  * @param handler Returns the transformed template, or `void` to pass through.
1378
1384
  * @param priority Lower values run first. Default `100`.
1385
+ * @param opts Opt into exclusive evaluation of macro-bearing regex templates owned
1386
+ * by this extension. The handler receives the unmodified source with `sourceOwner`
1387
+ * set and must return a result, which is used verbatim without native evaluation.
1388
+ * Plain templates skip dispatch. Stored messages on characters with this extension
1389
+ * namespace's `display_owner: true` also stay verbatim for its display pipeline.
1390
+ * Other templates retain normal chain behavior.
1379
1391
  *
1380
1392
  * @example
1381
1393
  * ```ts
@@ -1385,7 +1397,9 @@ export interface SpindleAPI {
1385
1397
  * }, 100)
1386
1398
  * ```
1387
1399
  */
1388
- registerMacroInterceptor(handler: (ctx: MacroInterceptorCtxDTO) => Promise<MacroInterceptorResultDTO>, priority?: number): void;
1400
+ registerMacroInterceptor(handler: (ctx: MacroInterceptorCtxDTO) => Promise<MacroInterceptorResultDTO>, priority?: number, opts?: {
1401
+ handlesOwnedSources?: boolean;
1402
+ }): void;
1389
1403
  /**
1390
1404
  * Register a world info interceptor (permission: `generation`).
1391
1405
  *
@@ -1467,10 +1481,16 @@ export interface SpindleAPI {
1467
1481
  * other API call site that surfaced one) to route the reply
1468
1482
  * only to that user. User-scoped extensions always deliver
1469
1483
  * to their installer regardless of this argument.
1484
+ * @param options A document target requires frontend-session-routing-v1 and
1485
+ * never falls back to broadcasting when disconnected.
1470
1486
  */
1471
- sendToFrontend(payload: unknown, userId?: string): void;
1487
+ sendToFrontend(payload: unknown, userId?: string, options?: {
1488
+ frontendSessionId?: string;
1489
+ }): void;
1472
1490
  /** Receive messages from the frontend module (userId is the sender) */
1473
- onFrontendMessage(handler: (payload: unknown, userId: string) => void): () => void;
1491
+ onFrontendMessage(handler: (payload: unknown, userId: string, frontendSessionId?: string) => void): () => void;
1492
+ /** Versioned snapshots and command acknowledgements; requires runtime-state-v1. */
1493
+ runtimeState: import("./runtime-state.js").SpindleRuntimeStateAPI;
1474
1494
  /**
1475
1495
  * Backend-owned lifecycle controller for tracked frontend processes.
1476
1496
  *
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.37",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "keywords": [