lumiverse-spindle-types 0.6.41 → 0.6.42
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 +1 -1
- package/dist/dom.d.ts +3 -0
- package/dist/file-transfers.d.ts +157 -0
- package/dist/file-transfers.js +10 -0
- package/dist/host.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/spindle-api.d.ts +5 -0
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -3333,7 +3333,7 @@ export interface ProviderManager {
|
|
|
3333
3333
|
key: ProviderKeyDTO;
|
|
3334
3334
|
}) => void): () => void;
|
|
3335
3335
|
}
|
|
3336
|
-
export type WorkerToHost = import("./desktop-capture.js").DesktopCaptureWorkerMessage | {
|
|
3336
|
+
export type WorkerToHost = import("./file-transfers.js").FileTransferWorkerMessage | import("./desktop-capture.js").DesktopCaptureWorkerMessage | {
|
|
3337
3337
|
type: "subscribe_event";
|
|
3338
3338
|
event: string;
|
|
3339
3339
|
} | {
|
package/dist/dom.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SpindleSTTAPI } from "./speech-to-text.js";
|
|
2
|
+
import type { SpindleFileDownloadAPI } from "./file-transfers.js";
|
|
2
3
|
import type { ChatDTO, ChatMessageDTO, ChatUpdateDTO, ConnectionProfileDTO, LlmMessageDTO, PromptBlockDTO, PromptVariableValuesDTO, RequestInitDTO, TokenCountOptionsDTO, TokenCountResultDTO, WorldBookCreateDTO, WorldBookDTO, WorldBookEntryCreateDTO, WorldBookEntryDTO, WorldBookEntryUpdateDTO, WorldBookUpdateDTO } from "./api.js";
|
|
3
4
|
import type { SpindleComponentsHelper } from "./components.js";
|
|
4
5
|
import type { SpindleHostDescriptorV1, SpindleHostLocaleAPI } from "./host.js";
|
|
@@ -1042,6 +1043,8 @@ export interface SpindleRecentChatsPage<TRow = SpindleRecentChat> {
|
|
|
1042
1043
|
}
|
|
1043
1044
|
/** Context object provided to frontend extension modules */
|
|
1044
1045
|
export interface SpindleFrontendContext {
|
|
1046
|
+
/** Native downloads of completed backend files. Available with file-transfers-v1. */
|
|
1047
|
+
readonly files: SpindleFileDownloadAPI;
|
|
1045
1048
|
/** Host-managed STT. Feature-detect speech-to-text-v1; unavailable on older hosts. */
|
|
1046
1049
|
readonly stt?: SpindleSTTAPI;
|
|
1047
1050
|
/** Per-document routing identity, available with frontend-session-origin-v1. */
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/** Maximum bytes in a worker read/write chunk; process one chunk at a time. */
|
|
2
|
+
export declare const SPINDLE_FILE_CHUNK_BYTES: number;
|
|
3
|
+
/** Per-file and per-installation/user aggregate staged storage ceiling. */
|
|
4
|
+
export declare const SPINDLE_FILE_MAX_BYTES: number;
|
|
5
|
+
/** Default disk reservation for downloads, generated files, and ZIP output. */
|
|
6
|
+
export declare const SPINDLE_FILE_DEFAULT_MAX_BYTES: number;
|
|
7
|
+
/** Inactivity lifetime; active readers and archive inputs are pinned. */
|
|
8
|
+
export declare const SPINDLE_FILE_TTL_MS: number;
|
|
9
|
+
/** Maximum staged file count per installation/user and archive entry count. */
|
|
10
|
+
export declare const SPINDLE_FILE_MAX_COUNT = 10000;
|
|
11
|
+
/** Opaque host-owned file reference. Paths and complete archive bytes stay on the host. */
|
|
12
|
+
export interface SpindleFileRef {
|
|
13
|
+
fileId: string;
|
|
14
|
+
fileName: string;
|
|
15
|
+
size: number;
|
|
16
|
+
mimeType: string;
|
|
17
|
+
}
|
|
18
|
+
/** A completed staged file or tus upload owned by this extension and user. */
|
|
19
|
+
export type SpindleFileSource = {
|
|
20
|
+
fileId: string;
|
|
21
|
+
} | {
|
|
22
|
+
uploadId: string;
|
|
23
|
+
};
|
|
24
|
+
export interface FileOperationOptions {
|
|
25
|
+
/** Required for operator-scoped extensions; inferred for user-scoped extensions. */
|
|
26
|
+
userId?: string;
|
|
27
|
+
/** Cancels the producer and cleans up partial output; rejects with AbortError. */
|
|
28
|
+
signal?: AbortSignal;
|
|
29
|
+
}
|
|
30
|
+
export interface FileFetchOptions extends FileOperationOptions {
|
|
31
|
+
headers?: Record<string, string>;
|
|
32
|
+
/** Default: download.bin. */
|
|
33
|
+
fileName?: string;
|
|
34
|
+
/** Maximum actual response bytes and disk reservation. Default: 5 GiB; maximum: 100 GiB. */
|
|
35
|
+
maxBytes?: number;
|
|
36
|
+
/** Default: 30 minutes; maximum: 1 hour. Includes body consumption. */
|
|
37
|
+
timeoutMs?: number;
|
|
38
|
+
}
|
|
39
|
+
export interface SpindleFileCreateInput {
|
|
40
|
+
fileName: string;
|
|
41
|
+
/** Exact final byte length. Specify size or maxBytes, never both. */
|
|
42
|
+
size?: number;
|
|
43
|
+
/** Output budget for unknown-length producers. Default: 5 GiB. */
|
|
44
|
+
maxBytes?: number;
|
|
45
|
+
mimeType?: string;
|
|
46
|
+
userId?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface SpindleFileChunk {
|
|
49
|
+
data: Uint8Array;
|
|
50
|
+
offset: number;
|
|
51
|
+
/** Total file length, not the length of this chunk. */
|
|
52
|
+
size: number;
|
|
53
|
+
eof: boolean;
|
|
54
|
+
}
|
|
55
|
+
export interface SpindleArchiveEntry {
|
|
56
|
+
/** Safe relative ZIP file name. Directory records and duplicate names reject. */
|
|
57
|
+
name: string;
|
|
58
|
+
source: SpindleFileSource;
|
|
59
|
+
/** Skip compression for already compressed assets. */
|
|
60
|
+
store?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface ArchiveCreateOptions extends FileOperationOptions {
|
|
63
|
+
/** Default: export.zip. */
|
|
64
|
+
fileName?: string;
|
|
65
|
+
/** Output budget. Default: 5 GiB; maximum: 100 GiB. */
|
|
66
|
+
maxBytes?: number;
|
|
67
|
+
}
|
|
68
|
+
export interface ArchiveExtractOptions extends FileOperationOptions {
|
|
69
|
+
/** Exact ZIP file names to extract. Omit for all files; an empty list extracts none. */
|
|
70
|
+
entries?: string[];
|
|
71
|
+
/** Total expansion limit and disk reservation. Default/maximum: 20 GiB. */
|
|
72
|
+
maxDecompressedBytes?: number;
|
|
73
|
+
}
|
|
74
|
+
export interface SpindleArchiveExtractedEntry {
|
|
75
|
+
/** Original relative entry name, including its archive directories. */
|
|
76
|
+
name: string;
|
|
77
|
+
file: SpindleFileRef;
|
|
78
|
+
}
|
|
79
|
+
/** Available with file-transfers-v1. All files are scoped to the installation, user, and worker lifetime. */
|
|
80
|
+
export interface SpindleFilesAPI {
|
|
81
|
+
/** GET through the host to disk. Requires cors_proxy; rejects non-success HTTP statuses. */
|
|
82
|
+
fetch(url: string, options?: FileFetchOptions): Promise<SpindleFileRef>;
|
|
83
|
+
/** Reserve a byte budget and create an incomplete file for sequential writes. */
|
|
84
|
+
create(input: SpindleFileCreateInput): Promise<SpindleFileRef>;
|
|
85
|
+
/** Write 1–SPINDLE_FILE_CHUNK_BYTES bytes at the current offset. Returns the next offset. */
|
|
86
|
+
writeChunk(fileId: string, offset: number, data: Uint8Array, userId?: string): Promise<number>;
|
|
87
|
+
/** Verify the byte budget/exact size, release unused capacity, and make the file immutable. */
|
|
88
|
+
finish(fileId: string, userId?: string): Promise<SpindleFileRef>;
|
|
89
|
+
/** Read at most SPINDLE_FILE_CHUNK_BYTES from a completed file or upload. */
|
|
90
|
+
readChunk(source: SpindleFileSource, offset: number, userId?: string): Promise<SpindleFileChunk>;
|
|
91
|
+
/** Delete an idle file. Unknown/expired/foreign ids return false; active files reject. */
|
|
92
|
+
delete(fileId: string, userId?: string): Promise<boolean>;
|
|
93
|
+
/** Relative attachment URL requiring the owning user's session cookie. */
|
|
94
|
+
getDownloadUrl(fileId: string, userId?: string): Promise<string>;
|
|
95
|
+
}
|
|
96
|
+
/** Host-side ZIP/ZIP64 processing with bounded memory and disk-backed output. */
|
|
97
|
+
export interface SpindleArchivesAPI {
|
|
98
|
+
create(entries: SpindleArchiveEntry[], options?: ArchiveCreateOptions): Promise<SpindleFileRef>;
|
|
99
|
+
/** Validate safe names, expansion, entry sizes, and CRC32; return staged file references. */
|
|
100
|
+
extract(source: SpindleFileSource, options?: ArchiveExtractOptions): Promise<SpindleArchiveExtractedEntry[]>;
|
|
101
|
+
}
|
|
102
|
+
export interface SpindleFileDownloadAPI {
|
|
103
|
+
/** Start a native browser/WebView attachment download without assembling a JavaScript Blob. */
|
|
104
|
+
download(fileId: string): void;
|
|
105
|
+
}
|
|
106
|
+
/** Signals stay in the worker; cancellation crosses the wire by operation id. */
|
|
107
|
+
export type FileTransferWorkerMessage = {
|
|
108
|
+
type: "files_fetch";
|
|
109
|
+
requestId: string;
|
|
110
|
+
url: string;
|
|
111
|
+
options: Omit<FileFetchOptions, "signal">;
|
|
112
|
+
} | {
|
|
113
|
+
type: "files_create";
|
|
114
|
+
requestId: string;
|
|
115
|
+
input: SpindleFileCreateInput;
|
|
116
|
+
} | {
|
|
117
|
+
type: "files_write_chunk";
|
|
118
|
+
requestId: string;
|
|
119
|
+
fileId: string;
|
|
120
|
+
offset: number;
|
|
121
|
+
data: Uint8Array;
|
|
122
|
+
userId?: string;
|
|
123
|
+
} | {
|
|
124
|
+
type: "files_finish";
|
|
125
|
+
requestId: string;
|
|
126
|
+
fileId: string;
|
|
127
|
+
userId?: string;
|
|
128
|
+
} | {
|
|
129
|
+
type: "files_delete";
|
|
130
|
+
requestId: string;
|
|
131
|
+
fileId: string;
|
|
132
|
+
userId?: string;
|
|
133
|
+
} | {
|
|
134
|
+
type: "files_download_url";
|
|
135
|
+
requestId: string;
|
|
136
|
+
fileId: string;
|
|
137
|
+
userId?: string;
|
|
138
|
+
} | {
|
|
139
|
+
type: "files_read_chunk";
|
|
140
|
+
requestId: string;
|
|
141
|
+
source: SpindleFileSource;
|
|
142
|
+
offset: number;
|
|
143
|
+
userId?: string;
|
|
144
|
+
} | {
|
|
145
|
+
type: "archives_create";
|
|
146
|
+
requestId: string;
|
|
147
|
+
entries: SpindleArchiveEntry[];
|
|
148
|
+
options: Omit<ArchiveCreateOptions, "signal">;
|
|
149
|
+
} | {
|
|
150
|
+
type: "archives_extract";
|
|
151
|
+
requestId: string;
|
|
152
|
+
source: SpindleFileSource;
|
|
153
|
+
options: Omit<ArchiveExtractOptions, "signal">;
|
|
154
|
+
} | {
|
|
155
|
+
type: "files_cancel";
|
|
156
|
+
operationId: string;
|
|
157
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Maximum bytes in a worker read/write chunk; process one chunk at a time. */
|
|
2
|
+
export const SPINDLE_FILE_CHUNK_BYTES = 1024 * 1024;
|
|
3
|
+
/** Per-file and per-installation/user aggregate staged storage ceiling. */
|
|
4
|
+
export const SPINDLE_FILE_MAX_BYTES = 100 * 1024 ** 3;
|
|
5
|
+
/** Default disk reservation for downloads, generated files, and ZIP output. */
|
|
6
|
+
export const SPINDLE_FILE_DEFAULT_MAX_BYTES = 5 * 1024 ** 3;
|
|
7
|
+
/** Inactivity lifetime; active readers and archive inputs are pinned. */
|
|
8
|
+
export const SPINDLE_FILE_TTL_MS = 30 * 60 * 1000;
|
|
9
|
+
/** Maximum staged file count per installation/user and archive entry count. */
|
|
10
|
+
export const SPINDLE_FILE_MAX_COUNT = 10_000;
|
package/dist/host.js
CHANGED
|
@@ -11,6 +11,7 @@ export const SPINDLE_HOST_CAPABILITIES = Object.freeze({
|
|
|
11
11
|
"frontend-extensibility-v2": 1,
|
|
12
12
|
"frontend-runtime-capabilities-v1": 1,
|
|
13
13
|
"mcp-servers-v1": 1,
|
|
14
|
+
"file-transfers-v1": 1,
|
|
14
15
|
});
|
|
15
16
|
/** Structured error code returned when host compatibility validation fails. */
|
|
16
17
|
export const SPINDLE_COMPATIBILITY_ERROR_CODE = "SPINDLE_COMPATIBILITY_ERROR";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export type { SpindleManifest, SpindlePermission, SpindleCapability, } from "./manifest.js";
|
|
2
2
|
export { IDENTIFIER_PATTERN, validateIdentifier, } from "./manifest.js";
|
|
3
3
|
export type { SpindleHostDescriptorV1, SpindleHostLocale, SpindleHostLocaleAPI, } from "./host.js";
|
|
4
|
+
export type { SpindleFileRef, SpindleFileSource, FileOperationOptions, FileFetchOptions, SpindleFileCreateInput, SpindleFileChunk, SpindleArchiveEntry, ArchiveCreateOptions, ArchiveExtractOptions, SpindleArchiveExtractedEntry, SpindleFilesAPI, SpindleArchivesAPI, SpindleFileDownloadAPI, FileTransferWorkerMessage, } from "./file-transfers.js";
|
|
5
|
+
export { SPINDLE_FILE_CHUNK_BYTES, SPINDLE_FILE_MAX_BYTES, SPINDLE_FILE_DEFAULT_MAX_BYTES, SPINDLE_FILE_TTL_MS, SPINDLE_FILE_MAX_COUNT, } from "./file-transfers.js";
|
|
4
6
|
export { SPINDLE_HOST_CAPABILITIES, SPINDLE_COMPATIBILITY_ERROR_CODE, } from "./host.js";
|
|
5
7
|
export type { SpindleThemeAsset, SpindleThemeAssetUploadOptions, SpindleThemeAssetUpdate, SpindleThemePackComponentDraft, SpindleThemePackDraft, SpindleThemePackImportResult, SpindleThemePackInstallOptions, SpindleThemePackInstallResult, SpindleThemeComponentCatalogEntry, SpindleThemeVariableCatalogEntry, SpindleThemeEditorTarget, SpindleThemeEditorOptions, SpindleThemeAuthoringAPI, } from "./theme.js";
|
|
6
8
|
export { SPINDLE_THEME_AUTHORING_HOST_CAPABILITIES } from "./theme.js";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { IDENTIFIER_PATTERN, validateIdentifier, } from "./manifest.js";
|
|
2
|
+
export { SPINDLE_FILE_CHUNK_BYTES, SPINDLE_FILE_MAX_BYTES, SPINDLE_FILE_DEFAULT_MAX_BYTES, SPINDLE_FILE_TTL_MS, SPINDLE_FILE_MAX_COUNT, } from "./file-transfers.js";
|
|
2
3
|
export { SPINDLE_HOST_CAPABILITIES, SPINDLE_COMPATIBILITY_ERROR_CODE, } from "./host.js";
|
|
3
4
|
export { SPINDLE_THEME_AUTHORING_HOST_CAPABILITIES } from "./theme.js";
|
|
4
5
|
export { ALL_PERMISSIONS, isValidPermission } from "./permissions.js";
|
package/dist/spindle-api.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SpindleManifest } from "./manifest.js";
|
|
2
2
|
import type { SpindleHostDescriptorV1 } from "./host.js";
|
|
3
3
|
import type { SpindleDesktopAPI } from "./desktop-capture.js";
|
|
4
|
+
import type { SpindleFilesAPI, SpindleArchivesAPI } from "./file-transfers.js";
|
|
4
5
|
import type { SpindleTextEditorOptions, SpindleTextEditorResult } from "./dom.js";
|
|
5
6
|
import type { CouncilMemberContext, CouncilSettings } from "./council.js";
|
|
6
7
|
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, ActivationPatternsOptions, ActivationPatternsResult, DatabankDTO, DatabankCreateDTO, DatabankUpdateDTO, DatabankDocumentDTO, DatabankDocumentCreateDTO, DatabankDocumentUpdateDTO, PersonaDTO, GlobalAddonDTO, GlobalAddonUpdateDTO, LumiaItemDTO, LumiaDlcCatalogDTO, PersonaCreateDTO, PersonaUpdateDTO, ActivatedWorldInfoEntryDTO, DryRunRequestDTO, DryRunResultDTO, SavedBreakdownDTO, 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";
|
|
@@ -133,6 +134,10 @@ export interface SpindleConnectionsAPI {
|
|
|
133
134
|
}
|
|
134
135
|
/** The global `spindle` object available in backend extension workers */
|
|
135
136
|
export interface SpindleAPI {
|
|
137
|
+
/** Disk-backed downloads and bounded reads/writes. Available with file-transfers-v1. */
|
|
138
|
+
readonly files: SpindleFilesAPI;
|
|
139
|
+
/** Streaming ZIP64 creation and validated disk-backed extraction. */
|
|
140
|
+
readonly archives: SpindleArchivesAPI;
|
|
136
141
|
readonly desktop: SpindleDesktopAPI;
|
|
137
142
|
/** Immutable host compatibility descriptor for this extension runtime. */
|
|
138
143
|
readonly host: SpindleHostDescriptorV1;
|