@bendyline/docblocks 1.1.2 → 2.1.0

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.
Files changed (149) hide show
  1. package/README.md +76 -11
  2. package/dist/chunk-6IYMTYMQ.js +1692 -0
  3. package/dist/chunk-6IYMTYMQ.js.map +1 -0
  4. package/dist/chunk-AEHCVWU5.js +25 -0
  5. package/dist/chunk-AEHCVWU5.js.map +1 -0
  6. package/dist/chunk-B56KWCSE.js +802 -0
  7. package/dist/chunk-B56KWCSE.js.map +1 -0
  8. package/dist/{chunk-ME76RUMR.js → chunk-BNKV7MTO.js} +15 -1
  9. package/dist/chunk-BNKV7MTO.js.map +1 -0
  10. package/dist/chunk-BXMF5YQJ.js +149 -0
  11. package/dist/chunk-BXMF5YQJ.js.map +1 -0
  12. package/dist/chunk-COYQXQK3.js +1071 -0
  13. package/dist/chunk-COYQXQK3.js.map +1 -0
  14. package/dist/chunk-DN7A33LL.js +780 -0
  15. package/dist/chunk-DN7A33LL.js.map +1 -0
  16. package/dist/chunk-EZKJZUNJ.js +13 -0
  17. package/dist/chunk-EZKJZUNJ.js.map +1 -0
  18. package/dist/chunk-FA7UNOXK.js +20 -0
  19. package/dist/chunk-FA7UNOXK.js.map +1 -0
  20. package/dist/chunk-FNW556FN.js +75 -0
  21. package/dist/chunk-FNW556FN.js.map +1 -0
  22. package/dist/chunk-GM5YXU4L.js +29 -0
  23. package/dist/chunk-GM5YXU4L.js.map +1 -0
  24. package/dist/chunk-JS6XFWQK.js +225 -0
  25. package/dist/chunk-JS6XFWQK.js.map +1 -0
  26. package/dist/chunk-MNSZ7EZN.js +111 -0
  27. package/dist/chunk-MNSZ7EZN.js.map +1 -0
  28. package/dist/chunk-P3DVZQ6S.js +228 -0
  29. package/dist/chunk-P3DVZQ6S.js.map +1 -0
  30. package/dist/chunk-P4WATND4.js +52 -0
  31. package/dist/chunk-P4WATND4.js.map +1 -0
  32. package/dist/chunk-RVPGQBWR.js +169 -0
  33. package/dist/chunk-RVPGQBWR.js.map +1 -0
  34. package/dist/chunk-U722UUFN.js +9 -0
  35. package/dist/chunk-U722UUFN.js.map +1 -0
  36. package/dist/chunk-VTCSF7VS.js +553 -0
  37. package/dist/chunk-VTCSF7VS.js.map +1 -0
  38. package/dist/chunk-WJKYY5QR.js +1350 -0
  39. package/dist/chunk-WJKYY5QR.js.map +1 -0
  40. package/dist/chunk-XUML3MKV.js +945 -0
  41. package/dist/chunk-XUML3MKV.js.map +1 -0
  42. package/dist/document/index.d.ts +358 -0
  43. package/dist/document/index.js +25 -0
  44. package/dist/document/index.js.map +1 -0
  45. package/dist/filesystem/electron.d.ts +73 -0
  46. package/dist/filesystem/electron.js +17 -0
  47. package/dist/filesystem/electron.js.map +1 -0
  48. package/dist/filesystem/index.d.ts +228 -8
  49. package/dist/filesystem/index.js +133 -6
  50. package/dist/filesystem/index.js.map +1 -1
  51. package/dist/filesystem/indexeddb.d.ts +284 -0
  52. package/dist/filesystem/indexeddb.js +23 -0
  53. package/dist/filesystem/indexeddb.js.map +1 -0
  54. package/dist/filesystem/memory.d.ts +152 -0
  55. package/dist/filesystem/memory.js +13 -0
  56. package/dist/filesystem/memory.js.map +1 -0
  57. package/dist/filesystem/native.d.ts +136 -0
  58. package/dist/filesystem/native.js +28 -0
  59. package/dist/filesystem/native.js.map +1 -0
  60. package/dist/host/index.d.ts +32 -6
  61. package/dist/host/index.js +26 -27
  62. package/dist/host/index.js.map +1 -1
  63. package/dist/index.d.ts +14 -9
  64. package/dist/index.js +204 -8
  65. package/dist/index.js.map +1 -1
  66. package/dist/mcp/index.d.ts +33 -0
  67. package/dist/mcp/index.js +32 -0
  68. package/dist/mcp/index.js.map +1 -0
  69. package/dist/mcp/zod.d.ts +5765 -0
  70. package/dist/mcp/zod.js +724 -0
  71. package/dist/mcp/zod.js.map +1 -0
  72. package/dist/share/index.d.ts +43 -0
  73. package/dist/share/index.js +13 -0
  74. package/dist/share/index.js.map +1 -0
  75. package/dist/types-BEg5SQ1_.d.ts +301 -0
  76. package/dist/types-CX893hgH.d.ts +468 -0
  77. package/dist/types-CueK0tvU.d.ts +501 -0
  78. package/dist/vscode/index.d.ts +220 -0
  79. package/dist/vscode/index.js +383 -0
  80. package/dist/vscode/index.js.map +1 -0
  81. package/dist/workspace/index.d.ts +141 -3
  82. package/dist/workspace/index.js +28 -1
  83. package/dist/workspace/index.js.map +1 -1
  84. package/dist/workspace-path-CWVrcuPL.d.ts +21 -0
  85. package/package.json +50 -5
  86. package/dist/chunk-GUNM43XZ.js +0 -63
  87. package/dist/chunk-GUNM43XZ.js.map +0 -1
  88. package/dist/chunk-IM7LCQJ6.js +0 -850
  89. package/dist/chunk-IM7LCQJ6.js.map +0 -1
  90. package/dist/chunk-ME76RUMR.js.map +0 -1
  91. package/dist/filesystem/electron-provider.d.ts +0 -32
  92. package/dist/filesystem/electron-provider.d.ts.map +0 -1
  93. package/dist/filesystem/electron-provider.js +0 -64
  94. package/dist/filesystem/electron-provider.js.map +0 -1
  95. package/dist/filesystem/file-media-provider.d.ts +0 -23
  96. package/dist/filesystem/file-media-provider.d.ts.map +0 -1
  97. package/dist/filesystem/file-media-provider.js +0 -85
  98. package/dist/filesystem/file-media-provider.js.map +0 -1
  99. package/dist/filesystem/filesystem-content-container.d.ts +0 -24
  100. package/dist/filesystem/filesystem-content-container.d.ts.map +0 -1
  101. package/dist/filesystem/filesystem-content-container.js +0 -116
  102. package/dist/filesystem/filesystem-content-container.js.map +0 -1
  103. package/dist/filesystem/index.d.ts.map +0 -1
  104. package/dist/filesystem/indexeddb-content-container.d.ts +0 -20
  105. package/dist/filesystem/indexeddb-content-container.d.ts.map +0 -1
  106. package/dist/filesystem/indexeddb-content-container.js +0 -93
  107. package/dist/filesystem/indexeddb-content-container.js.map +0 -1
  108. package/dist/filesystem/indexeddb-provider.d.ts +0 -32
  109. package/dist/filesystem/indexeddb-provider.d.ts.map +0 -1
  110. package/dist/filesystem/indexeddb-provider.js +0 -295
  111. package/dist/filesystem/indexeddb-provider.js.map +0 -1
  112. package/dist/filesystem/native-provider.d.ts +0 -45
  113. package/dist/filesystem/native-provider.d.ts.map +0 -1
  114. package/dist/filesystem/native-provider.js +0 -336
  115. package/dist/filesystem/native-provider.js.map +0 -1
  116. package/dist/filesystem/types.d.ts +0 -50
  117. package/dist/filesystem/types.d.ts.map +0 -1
  118. package/dist/filesystem/types.js +0 -8
  119. package/dist/filesystem/types.js.map +0 -1
  120. package/dist/host/index.d.ts.map +0 -1
  121. package/dist/host/types.d.ts +0 -149
  122. package/dist/host/types.d.ts.map +0 -1
  123. package/dist/host/types.js +0 -10
  124. package/dist/host/types.js.map +0 -1
  125. package/dist/index-pgBHBQ9G.d.ts +0 -213
  126. package/dist/index.d.ts.map +0 -1
  127. package/dist/workspace/index.d.ts.map +0 -1
  128. package/dist/workspace/types.d.ts +0 -29
  129. package/dist/workspace/types.d.ts.map +0 -1
  130. package/dist/workspace/types.js +0 -6
  131. package/dist/workspace/types.js.map +0 -1
  132. package/dist/workspace/workspace-manager.d.ts +0 -35
  133. package/dist/workspace/workspace-manager.d.ts.map +0 -1
  134. package/dist/workspace/workspace-manager.js +0 -82
  135. package/dist/workspace/workspace-manager.js.map +0 -1
  136. package/src/filesystem/electron-provider.ts +0 -88
  137. package/src/filesystem/file-media-provider.ts +0 -103
  138. package/src/filesystem/filesystem-content-container.ts +0 -126
  139. package/src/filesystem/index.ts +0 -24
  140. package/src/filesystem/indexeddb-content-container.ts +0 -104
  141. package/src/filesystem/indexeddb-provider.ts +0 -345
  142. package/src/filesystem/native-provider.ts +0 -384
  143. package/src/filesystem/types.ts +0 -69
  144. package/src/host/index.ts +0 -47
  145. package/src/host/types.ts +0 -153
  146. package/src/index.ts +0 -9
  147. package/src/workspace/index.ts +0 -10
  148. package/src/workspace/types.ts +0 -29
  149. package/src/workspace/workspace-manager.ts +0 -90
@@ -1,8 +1,228 @@
1
- export type { FileSystemProvider, FileSystemEntry, FileEntry, FolderEntry, FileMeta, } from './types.js';
2
- export { IndexedDBFileSystemProvider } from './indexeddb-provider.js';
3
- export { IndexedDBContentContainer } from './indexeddb-content-container.js';
4
- export { FileSystemContentContainer } from './filesystem-content-container.js';
5
- export { createFileMediaProvider } from './file-media-provider.js';
6
- export { NativeFileSystemProvider, isNativeFileSystemSupported, openNativeFolder, restoreNativeFolder, storeDirectoryHandle, loadDirectoryHandle, removeDirectoryHandle, } from './native-provider.js';
7
- export { ElectronFileSystemProvider, isElectronHost } from './electron-provider.js';
8
- //# sourceMappingURL=index.d.ts.map
1
+ import { P as FsOperation, s as FileSystemProviderV2, r as FileSystemProviderCapabilities, q as FileSystemProvider, c as FileSystemAtomicity, d as FileSystemCaseSensitivity, z as FileSystemSymlinkPolicy, i as FileSystemDurability, k as FileSystemEntrySnapshot, m as FileSystemFileRead, K as FileSystemWriteOptions, n as FileSystemFileSnapshot, g as FileSystemCreateDirectoryOptions, h as FileSystemDirectorySnapshot, u as FileSystemRemoveOptions, v as FileSystemRemoveResult, o as FileSystemMoveOptions, w as FileSystemSnapshot, G as FileSystemWatchListener, H as FileSystemWatchOptions, I as FileSystemWatchSubscription } from '../types-BEg5SQ1_.js';
2
+ export { F as FileCommitResult, a as FileEntry, b as FileMeta, e as FileSystemConditionalWriteStrength, f as FileSystemCreateDirectoryMode, j as FileSystemEntry, l as FileSystemEntryWatchEvent, p as FileSystemOverflowWatchEvent, t as FileSystemProviderWithV2, x as FileSystemSnapshotEntry, y as FileSystemSnapshotFile, A as FileSystemVersion, B as FileSystemWatchErrorListener, C as FileSystemWatchEvent, D as FileSystemWatchEventOrigin, E as FileSystemWatchEventType, J as FileSystemWriteMode, L as FolderEntry, M as FsError, N as FsErrorCode, O as FsErrorContext, S as SerializedFsError, Q as deserializeFsError, R as fsErrorFromUnknown, T as getFileSystemProviderV2, U as hasFileSystemProviderV2, V as isQuotaExceededError, W as isSerializedFsError, X as mapDomExceptionToFsErrorCode, Y as mapNodeErrorCodeToFsErrorCode, Z as parseFileSystemVersion, _ as serializeFsError, $ as tryParseFileSystemVersion } from '../types-BEg5SQ1_.js';
3
+ import { a as WorkspacePath } from '../workspace-path-CWVrcuPL.js';
4
+ export { W as WORKSPACE_ROOT, p as parseWorkspacePath, t as tryParseWorkspacePath, w as workspacePathBasename, b as workspacePathContains, c as workspacePathDirname, d as workspacePathJoin, e as workspacePathToLegacy } from '../workspace-path-CWVrcuPL.js';
5
+ import { MemoryFileSystemSnapshot, MemoryFileSystemProvider } from './memory.js';
6
+ export { MemoryFilePayloadKind, MemoryFileSystemProviderV2, MemoryFileSystemSnapshotFile, MemoryFileSystemV2CompatibilityFile, MemoryFileSystemV2Replacement, MemoryFileSystemV2ReplacementFile, MemoryFileSystemV2State, MemoryFileSystemV2StateFile } from './memory.js';
7
+ export { IndexedDBContentContainer, IndexedDBFileSystemProvider, IndexedDBFileSystemProviderV2, IndexedDBFileSystemProviderV2Options, IndexedDBLegacyConflictReason, IndexedDBLegacyConflictResolution, IndexedDBLegacyMigrationConflict, IndexedDBLegacyOpaqueDiscardTarget, IndexedDBLegacyOpaqueRecord, IndexedDBLegacyOpaqueRecordSummary, IndexedDBLegacyOpaqueValue, IndexedDBLegacyRecoveryCandidate, IndexedDBLegacyRecoveryKind } from './indexeddb.js';
8
+ import { ContentContainer, ContentEntry } from '@bendyline/squisq/storage';
9
+ import { MediaProvider } from '@bendyline/squisq/schemas';
10
+ export { NativeFileSystemMovePathState, NativeFileSystemMoveRecoveryError, NativeFileSystemMoveRecoveryState, NativeFileSystemProvider, NativeFileSystemProviderV2, isNativeFileSystemSupported, loadDirectoryHandle, openNativeFolder, removeDirectoryHandle, restoreNativeFolder, storeDirectoryHandle } from './native.js';
11
+ export { ElectronFileSystemProvider, ElectronFileSystemProviderV2 } from './electron.js';
12
+ export { isElectronHost } from '../host/index.js';
13
+ import '../types-CueK0tvU.js';
14
+
15
+ interface DecodeUtf8TextOptions {
16
+ /** User-facing description of the payload being decoded. */
17
+ readonly label?: string;
18
+ /** Filesystem operation that produced the bytes. */
19
+ readonly operation?: FsOperation;
20
+ /** Canonical or display path associated with the payload. */
21
+ readonly path?: string;
22
+ }
23
+ /**
24
+ * Decode byte-authoritative text without silently replacing malformed input.
25
+ * Replacement characters are unsafe at persistence boundaries because a later
26
+ * save can permanently overwrite the original bytes with altered content.
27
+ */
28
+ declare function decodeUtf8Text(data: ArrayBuffer | ArrayBufferView, options?: DecodeUtf8TextOptions): string;
29
+
30
+ type LegacyFilePayloadModel = 'split' | 'binary-first-text-fallback' | 'binary-authoritative';
31
+ interface LegacyFileSystemProviderV2AdapterOptions {
32
+ /**
33
+ * Split stores expose independent raw text and binary channels and reject
34
+ * dual payloads. Binary-first stores synthesize text for binary records, so
35
+ * the adapter only asks for text after readBinary() returns null. Binary-
36
+ * authoritative stores expose every file through readBinary().
37
+ */
38
+ readonly payloadModel: LegacyFilePayloadModel;
39
+ readonly writeAtomicity?: FileSystemAtomicity;
40
+ readonly moveAtomicity?: FileSystemAtomicity;
41
+ readonly caseSensitivity?: FileSystemCaseSensitivity;
42
+ readonly symlinkPolicy?: FileSystemSymlinkPolicy;
43
+ readonly durability?: FileSystemDurability;
44
+ /** Optional ownership hook; omitted when the adapter does not own the v1 provider. */
45
+ readonly dispose?: () => void | Promise<void>;
46
+ }
47
+ /**
48
+ * Correctness bridge for hardened v1 providers while storage backends migrate.
49
+ *
50
+ * The adapter deliberately serializes every observable operation. This makes a
51
+ * version check and its mutation indivisible among v2 callers, but cannot make
52
+ * calls that bypass the adapter participate in that boundary. Content-derived
53
+ * versions make those external changes visible on the next adapter operation.
54
+ */
55
+ declare class LegacyFileSystemProviderV2Adapter implements FileSystemProviderV2 {
56
+ private readonly provider;
57
+ private readonly options;
58
+ readonly id: string;
59
+ readonly label: string;
60
+ readonly capabilities: FileSystemProviderCapabilities;
61
+ private operationTail;
62
+ private readonly subscriptions;
63
+ private closing;
64
+ private disposed;
65
+ private disposePromise;
66
+ constructor(provider: FileSystemProvider, options: LegacyFileSystemProviderV2AdapterOptions);
67
+ stat(path: WorkspacePath): Promise<FileSystemEntrySnapshot | null>;
68
+ readFile(path: WorkspacePath): Promise<FileSystemFileRead | null>;
69
+ readDirectory(path: WorkspacePath): Promise<readonly FileSystemEntrySnapshot[]>;
70
+ writeFile(path: WorkspacePath, data: ArrayBuffer | Uint8Array, options?: FileSystemWriteOptions): Promise<FileSystemFileSnapshot>;
71
+ createDirectory(path: WorkspacePath, options?: FileSystemCreateDirectoryOptions): Promise<FileSystemDirectorySnapshot>;
72
+ remove(path: WorkspacePath, options?: FileSystemRemoveOptions): Promise<FileSystemRemoveResult>;
73
+ move(oldPath: WorkspacePath, newPath: WorkspacePath, options?: FileSystemMoveOptions): Promise<FileSystemEntrySnapshot>;
74
+ snapshot(): Promise<FileSystemSnapshot>;
75
+ watch(_listener: FileSystemWatchListener, options?: FileSystemWatchOptions): FileSystemWatchSubscription;
76
+ dispose(): Promise<void>;
77
+ private enqueue;
78
+ private assertAccepting;
79
+ private canonical;
80
+ private canonicalNonRoot;
81
+ private assertExpectedVersion;
82
+ private assertParents;
83
+ private captureTree;
84
+ private captureFile;
85
+ private invoke;
86
+ private error;
87
+ }
88
+
89
+ type DbkWorkspaceAssetLayout = 'auto' | 'preserve' | 'companion';
90
+ interface DbkWorkspaceSnapshotOptions {
91
+ /** Provider-relative path of the transient workspace's active markdown file. */
92
+ targetDocumentPath: string;
93
+ /**
94
+ * `preserve` treats the DBK as a serialized workspace tree. `companion`
95
+ * rebases secondary Markdown files beneath `<document>_files/`. `auto`
96
+ * preserves a DBK whose primary path already matches the target, otherwise
97
+ * rebasing the secondary documents into the companion directory.
98
+ */
99
+ assetLayout?: DbkWorkspaceAssetLayout;
100
+ }
101
+ interface DbkWorkspaceSnapshot extends MemoryFileSystemSnapshot {
102
+ readonly sourceDocumentPath: string;
103
+ readonly targetDocumentPath: string;
104
+ readonly documentContent: string;
105
+ readonly assetLayout: Exclude<DbkWorkspaceAssetLayout, 'auto'>;
106
+ }
107
+ /**
108
+ * Fully materialize and validate a DBK container before touching its target
109
+ * provider. Transient workspace DBKs are intentionally Markdown-only: every
110
+ * member must be a valid UTF-8 `.md` file. A missing, unreadable, binary, or
111
+ * differently typed entry fails the snapshot as a whole.
112
+ */
113
+ declare function createDbkWorkspaceSnapshot(source: ContentContainer, options: DbkWorkspaceSnapshotOptions): Promise<DbkWorkspaceSnapshot>;
114
+ /**
115
+ * Replace a transient DBK workspace as one logical operation.
116
+ *
117
+ * Container reads and validation happen before provider mutation. The memory
118
+ * provider then stages and swaps the full tree synchronously, which removes
119
+ * stale files and guarantees the old tree survives any failed replacement.
120
+ */
121
+ declare function replaceMemoryWorkspaceFromDbk(provider: MemoryFileSystemProvider, source: ContentContainer, options: DbkWorkspaceSnapshotOptions): Promise<DbkWorkspaceSnapshot>;
122
+
123
+ /**
124
+ * FileSystemContentContainer — a ContentContainer backed by any
125
+ * FileSystemProvider, scoped to a sub-path (e.g., ".docblocks/media/").
126
+ *
127
+ * Used by the Electron desktop app so media lives inside the workspace
128
+ * folder (visible as regular files) rather than in a separate IndexedDB
129
+ * origin that only the app can see.
130
+ */
131
+
132
+ declare class FileSystemContentContainer implements ContentContainer {
133
+ private readonly provider;
134
+ private readonly prefix;
135
+ constructor(provider: FileSystemProvider, prefix?: string);
136
+ readFile(path: string): Promise<ArrayBuffer | null>;
137
+ writeFile(path: string, data: ArrayBuffer | Uint8Array, _mimeType?: string): Promise<void>;
138
+ removeFile(path: string): Promise<void>;
139
+ listFiles(prefix?: string): Promise<ContentEntry[]>;
140
+ exists(path: string): Promise<boolean>;
141
+ getDocumentPath(): Promise<string | null>;
142
+ readDocument(): Promise<string | null>;
143
+ writeDocument(markdown: string, filename?: string): Promise<void>;
144
+ }
145
+
146
+ /**
147
+ * createFileMediaProvider — per-file media storage following the pandoc /
148
+ * Word convention: a markdown file `notes.md` gets a sibling folder
149
+ * `notes_files/` that holds its images, audio, and video.
150
+ *
151
+ * Given:
152
+ * • `container` — a ContentContainer scoped to the markdown file's
153
+ * parent directory (so `readFile('notes_files/image.png')` maps to the
154
+ * parent-relative path)
155
+ * • `markdownBasename` — e.g. `"notes.md"`
156
+ *
157
+ * Returns a MediaProvider that:
158
+ * • Writes new media under `{basename}_files/{name}` in the parent dir
159
+ * • Returns the folder-qualified path (`notes_files/image.png`) from
160
+ * addMedia so the markdown stays portable outside DocBlocks
161
+ * • Resolves both bare (`image.png`) and folder-qualified
162
+ * (`notes_files/image.png`) references — so legacy markdown and
163
+ * exports from other tools both work
164
+ */
165
+
166
+ declare function createFileMediaProvider(container: ContentContainer, markdownBasename: string): MediaProvider;
167
+
168
+ /** Return the hidden companion directory used for a document's media and versions. */
169
+ declare function documentCompanionPath(documentPath: string): string;
170
+ /**
171
+ * Move an explorer entry without overwriting an existing entry. Markdown files
172
+ * carry their hidden `<basename>_files` companion directory with them.
173
+ */
174
+ declare function moveFileSystemEntry(provider: FileSystemProvider, oldPath: string, newPath: string, kind: 'file' | 'directory'): Promise<void>;
175
+
176
+ type FileSystemPathPresence = 'present' | 'missing' | 'unknown';
177
+ interface FileSystemPartialMoveState {
178
+ readonly source: FileSystemPathPresence;
179
+ readonly destination: FileSystemPathPresence;
180
+ readonly companionSource: FileSystemPathPresence;
181
+ readonly companionDestination: FileSystemPathPresence;
182
+ }
183
+ type FileSystemMoveLocation = 'source' | 'destination' | 'both' | 'neither' | 'unknown';
184
+ interface FileSystemEntryMoveState {
185
+ readonly source: FileSystemPathPresence;
186
+ readonly destination: FileSystemPathPresence;
187
+ }
188
+ /**
189
+ * One provider move failed without restoring a provable source-only state.
190
+ * This is backend-neutral: callers must use `location`, never infer from the
191
+ * original exception or a provider's advertised move atomicity.
192
+ */
193
+ declare class FileSystemMoveRecoveryError extends Error {
194
+ readonly sourcePath: string;
195
+ readonly destinationPath: string;
196
+ readonly state: FileSystemEntryMoveState;
197
+ readonly moveError: unknown;
198
+ readonly code: "partial-move";
199
+ constructor(sourcePath: string, destinationPath: string, state: FileSystemEntryMoveState, moveError: unknown);
200
+ get location(): FileSystemMoveLocation;
201
+ /** Alias used by DocumentSession's document-retarget recovery protocol. */
202
+ get documentLocation(): FileSystemMoveLocation;
203
+ }
204
+ /**
205
+ * A compound document/companion move failed and the document rollback also
206
+ * failed. Callers must use the recorded post-state instead of assuming the
207
+ * original path is still authoritative.
208
+ */
209
+ declare class FileSystemPartialMoveError extends Error {
210
+ readonly sourcePath: string;
211
+ readonly destinationPath: string;
212
+ readonly companionSourcePath: string;
213
+ readonly companionDestinationPath: string;
214
+ readonly state: FileSystemPartialMoveState;
215
+ readonly moveError: unknown;
216
+ readonly rollbackError: unknown;
217
+ readonly code: "partial-move";
218
+ constructor(sourcePath: string, destinationPath: string, companionSourcePath: string, companionDestinationPath: string, state: FileSystemPartialMoveState, moveError: unknown, rollbackError: unknown);
219
+ get documentLocation(): FileSystemMoveLocation;
220
+ get companionLocation(): FileSystemMoveLocation;
221
+ }
222
+ declare function isFileSystemPartialMoveError(error: unknown): error is FileSystemPartialMoveError;
223
+ declare function isFileSystemMoveRecoveryError(error: unknown): error is FileSystemMoveRecoveryError;
224
+ declare function isFileSystemMoveStateError(error: unknown): error is FileSystemMoveRecoveryError | FileSystemPartialMoveError;
225
+ declare function describePartialMove(provider: FileSystemProvider, sourcePath: string, destinationPath: string, companionSourcePath: string, companionDestinationPath: string): Promise<FileSystemPartialMoveState>;
226
+ declare function describeEntryMove(provider: FileSystemProvider, sourcePath: string, destinationPath: string): Promise<FileSystemEntryMoveState>;
227
+
228
+ export { type DbkWorkspaceAssetLayout, type DbkWorkspaceSnapshot, type DbkWorkspaceSnapshotOptions, type DecodeUtf8TextOptions, FileSystemAtomicity, FileSystemCaseSensitivity, FileSystemContentContainer, FileSystemCreateDirectoryOptions, FileSystemDirectorySnapshot, FileSystemDurability, type FileSystemEntryMoveState, FileSystemEntrySnapshot, FileSystemFileRead, FileSystemFileSnapshot, type FileSystemMoveLocation, FileSystemMoveOptions, FileSystemMoveRecoveryError, FileSystemPartialMoveError, type FileSystemPartialMoveState, type FileSystemPathPresence, FileSystemProvider, FileSystemProviderCapabilities, FileSystemProviderV2, FileSystemRemoveOptions, FileSystemRemoveResult, FileSystemSnapshot, FileSystemSymlinkPolicy, FileSystemWatchListener, FileSystemWatchOptions, FileSystemWatchSubscription, FileSystemWriteOptions, FsOperation, type LegacyFilePayloadModel, LegacyFileSystemProviderV2Adapter, type LegacyFileSystemProviderV2AdapterOptions, MemoryFileSystemProvider, MemoryFileSystemSnapshot, WorkspacePath, createDbkWorkspaceSnapshot, createFileMediaProvider, decodeUtf8Text, describeEntryMove, describePartialMove, documentCompanionPath, isFileSystemMoveRecoveryError, isFileSystemMoveStateError, isFileSystemPartialMoveError, moveFileSystemEntry, replaceMemoryWorkspaceFromDbk };
@@ -1,7 +1,134 @@
1
- export { IndexedDBFileSystemProvider } from './indexeddb-provider.js';
2
- export { IndexedDBContentContainer } from './indexeddb-content-container.js';
3
- export { FileSystemContentContainer } from './filesystem-content-container.js';
4
- export { createFileMediaProvider } from './file-media-provider.js';
5
- export { NativeFileSystemProvider, isNativeFileSystemSupported, openNativeFolder, restoreNativeFolder, storeDirectoryHandle, loadDirectoryHandle, removeDirectoryHandle, } from './native-provider.js';
6
- export { ElectronFileSystemProvider, isElectronHost } from './electron-provider.js';
1
+ import {
2
+ FileSystemContentContainer,
3
+ LegacyFileSystemProviderV2Adapter,
4
+ createDbkWorkspaceSnapshot,
5
+ createFileMediaProvider,
6
+ documentCompanionPath,
7
+ moveFileSystemEntry,
8
+ replaceMemoryWorkspaceFromDbk
9
+ } from "../chunk-XUML3MKV.js";
10
+ import {
11
+ IndexedDBContentContainer,
12
+ IndexedDBFileSystemProvider,
13
+ IndexedDBFileSystemProviderV2
14
+ } from "../chunk-6IYMTYMQ.js";
15
+ import {
16
+ MemoryFileSystemProvider,
17
+ MemoryFileSystemProviderV2
18
+ } from "../chunk-DN7A33LL.js";
19
+ import {
20
+ NativeFileSystemMoveRecoveryError,
21
+ NativeFileSystemProvider,
22
+ NativeFileSystemProviderV2,
23
+ isNativeFileSystemSupported,
24
+ loadDirectoryHandle,
25
+ openNativeFolder,
26
+ removeDirectoryHandle,
27
+ restoreNativeFolder,
28
+ storeDirectoryHandle
29
+ } from "../chunk-WJKYY5QR.js";
30
+ import "../chunk-AEHCVWU5.js";
31
+ import "../chunk-GM5YXU4L.js";
32
+ import {
33
+ ElectronFileSystemProvider,
34
+ ElectronFileSystemProviderV2
35
+ } from "../chunk-VTCSF7VS.js";
36
+ import {
37
+ isElectronHost
38
+ } from "../chunk-BNKV7MTO.js";
39
+ import "../chunk-FNW556FN.js";
40
+ import "../chunk-U722UUFN.js";
41
+ import {
42
+ parseFileSystemVersion,
43
+ tryParseFileSystemVersion
44
+ } from "../chunk-P4WATND4.js";
45
+ import {
46
+ FileSystemMoveRecoveryError,
47
+ FileSystemPartialMoveError,
48
+ describeEntryMove,
49
+ describePartialMove,
50
+ isFileSystemMoveRecoveryError,
51
+ isFileSystemMoveStateError,
52
+ isFileSystemPartialMoveError
53
+ } from "../chunk-MNSZ7EZN.js";
54
+ import {
55
+ decodeUtf8Text
56
+ } from "../chunk-FA7UNOXK.js";
57
+ import {
58
+ FsError,
59
+ WORKSPACE_ROOT,
60
+ deserializeFsError,
61
+ fsErrorFromUnknown,
62
+ isQuotaExceededError,
63
+ isSerializedFsError,
64
+ mapDomExceptionToFsErrorCode,
65
+ mapNodeErrorCodeToFsErrorCode,
66
+ parseWorkspacePath,
67
+ serializeFsError,
68
+ tryParseWorkspacePath,
69
+ workspacePathBasename,
70
+ workspacePathContains,
71
+ workspacePathDirname,
72
+ workspacePathJoin,
73
+ workspacePathToLegacy
74
+ } from "../chunk-JS6XFWQK.js";
75
+ import "../chunk-RVPGQBWR.js";
76
+ import {
77
+ getFileSystemProviderV2,
78
+ hasFileSystemProviderV2
79
+ } from "../chunk-EZKJZUNJ.js";
80
+ export {
81
+ ElectronFileSystemProvider,
82
+ ElectronFileSystemProviderV2,
83
+ FileSystemContentContainer,
84
+ FileSystemMoveRecoveryError,
85
+ FileSystemPartialMoveError,
86
+ FsError,
87
+ IndexedDBContentContainer,
88
+ IndexedDBFileSystemProvider,
89
+ IndexedDBFileSystemProviderV2,
90
+ LegacyFileSystemProviderV2Adapter,
91
+ MemoryFileSystemProvider,
92
+ MemoryFileSystemProviderV2,
93
+ NativeFileSystemMoveRecoveryError,
94
+ NativeFileSystemProvider,
95
+ NativeFileSystemProviderV2,
96
+ WORKSPACE_ROOT,
97
+ createDbkWorkspaceSnapshot,
98
+ createFileMediaProvider,
99
+ decodeUtf8Text,
100
+ describeEntryMove,
101
+ describePartialMove,
102
+ deserializeFsError,
103
+ documentCompanionPath,
104
+ fsErrorFromUnknown,
105
+ getFileSystemProviderV2,
106
+ hasFileSystemProviderV2,
107
+ isElectronHost,
108
+ isFileSystemMoveRecoveryError,
109
+ isFileSystemMoveStateError,
110
+ isFileSystemPartialMoveError,
111
+ isNativeFileSystemSupported,
112
+ isQuotaExceededError,
113
+ isSerializedFsError,
114
+ loadDirectoryHandle,
115
+ mapDomExceptionToFsErrorCode,
116
+ mapNodeErrorCodeToFsErrorCode,
117
+ moveFileSystemEntry,
118
+ openNativeFolder,
119
+ parseFileSystemVersion,
120
+ parseWorkspacePath,
121
+ removeDirectoryHandle,
122
+ replaceMemoryWorkspaceFromDbk,
123
+ restoreNativeFolder,
124
+ serializeFsError,
125
+ storeDirectoryHandle,
126
+ tryParseFileSystemVersion,
127
+ tryParseWorkspacePath,
128
+ workspacePathBasename,
129
+ workspacePathContains,
130
+ workspacePathDirname,
131
+ workspacePathJoin,
132
+ workspacePathToLegacy
133
+ };
7
134
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/filesystem/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,0BAA0B,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,284 @@
1
+ import { s as FileSystemProviderV2, r as FileSystemProviderCapabilities, k as FileSystemEntrySnapshot, m as FileSystemFileRead, K as FileSystemWriteOptions, n as FileSystemFileSnapshot, g as FileSystemCreateDirectoryOptions, h as FileSystemDirectorySnapshot, u as FileSystemRemoveOptions, v as FileSystemRemoveResult, o as FileSystemMoveOptions, w as FileSystemSnapshot, G as FileSystemWatchListener, H as FileSystemWatchOptions, I as FileSystemWatchSubscription, b as FileMeta, q as FileSystemProvider, F as FileCommitResult, j as FileSystemEntry } from '../types-BEg5SQ1_.js';
2
+ import { a as WorkspacePath } from '../workspace-path-CWVrcuPL.js';
3
+ import { ContentContainer, ContentEntry } from '@bendyline/squisq/storage';
4
+
5
+ /**
6
+ * Minimal, error-propagating IndexedDB store used by the virtual filesystem.
7
+ *
8
+ * The previous Squisq LocalForage adapter intentionally converted failed
9
+ * reads/enumerations/removals into null/empty/success. Those semantics are
10
+ * unsuitable for filesystem mutations: an unavailable database must never be
11
+ * interpreted as an absent file. This layer opens the old database and object
12
+ * store directly so existing data can be migrated in one transaction.
13
+ */
14
+ type IndexedDBFileSystemTransactionMode = 'readonly' | 'readwrite';
15
+ /** The database holding one browser-local workspace's files. */
16
+ declare function indexedDBWorkspaceDatabaseName(workspaceId: string): string;
17
+ /**
18
+ * Delete a browser-local workspace's stored files.
19
+ *
20
+ * Removing a workspace descriptor alone leaves these bytes behind: invisible to
21
+ * the user, still counted against the origin's quota, and ready to reappear
22
+ * under any later workspace that reuses the same id.
23
+ */
24
+ declare function deleteIndexedDBWorkspaceData(workspaceId: string): Promise<void>;
25
+ interface IndexedDBFileSystemTransaction {
26
+ get<T>(key: string): Promise<T | null>;
27
+ put<T>(key: string, value: T): Promise<void>;
28
+ delete(key: string): Promise<void>;
29
+ keys(): Promise<string[]>;
30
+ /** O(log n) namespace probe in the concrete IndexedDB implementation. */
31
+ hasKeyWithPrefix(prefix: string): Promise<boolean>;
32
+ }
33
+ interface IndexedDBFileSystemStore {
34
+ transaction<T>(mode: IndexedDBFileSystemTransactionMode, operation: (transaction: IndexedDBFileSystemTransaction) => Promise<T>): Promise<T>;
35
+ close?(): void;
36
+ }
37
+
38
+ type IndexedDBLegacyConflictReason = 'dual-payload' | 'kind-collision' | 'authority-collision' | 'stale-client-write';
39
+ type IndexedDBLegacyRecoveryKind = 'file' | 'directory';
40
+ interface IndexedDBLegacyRecoveryCandidate {
41
+ readonly kind: IndexedDBLegacyRecoveryKind;
42
+ readonly reason: IndexedDBLegacyConflictReason;
43
+ readonly text: string | null;
44
+ readonly binary: ArrayBuffer | null;
45
+ readonly metadata: FileMeta | null;
46
+ readonly detectedAt: string;
47
+ }
48
+ interface IndexedDBLegacyMigrationConflict {
49
+ readonly path: WorkspacePath;
50
+ /** Backward-compatible projection of the newest quarantined candidate. */
51
+ readonly reason: IndexedDBLegacyConflictReason;
52
+ readonly kind: IndexedDBLegacyRecoveryKind;
53
+ readonly text: string | null;
54
+ readonly binary: ArrayBuffer | null;
55
+ readonly metadata: FileMeta | null;
56
+ readonly detectedAt: string;
57
+ readonly candidates: readonly IndexedDBLegacyRecoveryCandidate[];
58
+ }
59
+ type IndexedDBLegacyConflictResolution = 'v2' | 'text' | 'binary' | {
60
+ readonly candidate: number;
61
+ readonly payload: 'text' | 'binary' | 'directory';
62
+ };
63
+ /** One archived snapshot of an unrecognized legacy key's value. */
64
+ interface IndexedDBLegacyOpaqueValue {
65
+ /**
66
+ * The structured-clone value exactly as the legacy key held it. DocBlocks
67
+ * never interpreted these bytes, so the shape is whatever the writing tool
68
+ * chose. Callers must treat it as untrusted and narrow it themselves.
69
+ */
70
+ readonly value: unknown;
71
+ /** Byte size when the value is sized (bytes or string); null otherwise. */
72
+ readonly byteLength: number | null;
73
+ /** Null for values archived before archival timestamps were recorded. */
74
+ readonly archivedAt: string | null;
75
+ }
76
+ /** What is archived under one unrecognized legacy key, without its values. */
77
+ interface IndexedDBLegacyOpaqueRecordSummary {
78
+ /** The original legacy key, decoded (for example `fs:some-other-tool`). */
79
+ readonly key: string;
80
+ /** Archived snapshots of this key, oldest first. Never zero. */
81
+ readonly valueCount: number;
82
+ /** Total bytes across values; null when any value is not sized. */
83
+ readonly byteLength: number | null;
84
+ readonly firstArchivedAt: string | null;
85
+ readonly lastArchivedAt: string | null;
86
+ }
87
+ /** An archived legacy key together with every value snapshot it holds. */
88
+ interface IndexedDBLegacyOpaqueRecord extends IndexedDBLegacyOpaqueRecordSummary {
89
+ /** Oldest first. Index N here matches index N of the archival order. */
90
+ readonly values: readonly IndexedDBLegacyOpaqueValue[];
91
+ }
92
+ /**
93
+ * One record a caller has looked at and intends to destroy.
94
+ *
95
+ * Both {@link IndexedDBLegacyOpaqueRecordSummary} and
96
+ * {@link IndexedDBLegacyOpaqueRecord} satisfy this shape, so the value returned
97
+ * by a list or read can be handed straight to the discard call.
98
+ */
99
+ interface IndexedDBLegacyOpaqueDiscardTarget {
100
+ readonly key: string;
101
+ /**
102
+ * The number of archived values the caller saw. The discard fails if the
103
+ * record has since grown, so a snapshot that arrived after the caller looked
104
+ * is never destroyed unseen.
105
+ */
106
+ readonly valueCount: number;
107
+ }
108
+ interface IndexedDBFileSystemProviderV2Options {
109
+ /** Injectable store for fault, migration, and concurrency tests. */
110
+ readonly store?: IndexedDBFileSystemStore;
111
+ readonly now?: () => Date;
112
+ /** Shared-store owners can retain the connection when this facade is disposed. */
113
+ readonly closeStoreOnDispose?: boolean;
114
+ }
115
+ /**
116
+ * IndexedDB implementation of the correctness-first filesystem contract.
117
+ *
118
+ * Each canonical path has one authoritative structured-clone record containing
119
+ * its kind, owned bytes (for files), version, and metadata. Every mutation and
120
+ * snapshot is one IndexedDB transaction. Legacy v1 keys are imported once;
121
+ * ambiguous or stale branches move into durable recovery records before the
122
+ * legacy namespace is deleted, leaving one live authority.
123
+ */
124
+ declare class IndexedDBFileSystemProviderV2 implements FileSystemProviderV2 {
125
+ readonly id: string;
126
+ readonly label: string;
127
+ readonly capabilities: FileSystemProviderCapabilities;
128
+ private readonly store;
129
+ private readonly now;
130
+ private readonly closeStoreOnDispose;
131
+ private readonly versionPrefix;
132
+ private readonly subscriptions;
133
+ private readonly inFlight;
134
+ private initialization;
135
+ private disposePromise;
136
+ private storeClosed;
137
+ private disposed;
138
+ constructor(id: string, label: string, options?: IndexedDBFileSystemProviderV2Options);
139
+ /** Track accepted storage work so disposal can join it before closing. */
140
+ private runSharedTransaction;
141
+ stat(path: WorkspacePath): Promise<FileSystemEntrySnapshot | null>;
142
+ readFile(path: WorkspacePath): Promise<FileSystemFileRead | null>;
143
+ readDirectory(path: WorkspacePath): Promise<readonly FileSystemEntrySnapshot[]>;
144
+ writeFile(path: WorkspacePath, data: ArrayBuffer | Uint8Array, options?: FileSystemWriteOptions): Promise<FileSystemFileSnapshot>;
145
+ createDirectory(path: WorkspacePath, options?: FileSystemCreateDirectoryOptions): Promise<FileSystemDirectorySnapshot>;
146
+ remove(path: WorkspacePath, options?: FileSystemRemoveOptions): Promise<FileSystemRemoveResult>;
147
+ move(oldPath: WorkspacePath, newPath: WorkspacePath, options?: FileSystemMoveOptions): Promise<FileSystemEntrySnapshot>;
148
+ snapshot(): Promise<FileSystemSnapshot>;
149
+ /** IndexedDB has no reliable cross-browser external-change observer. */
150
+ watch(_listener: FileSystemWatchListener, options?: FileSystemWatchOptions): FileSystemWatchSubscription;
151
+ dispose(): Promise<void>;
152
+ /** List unresolved, byte-preserving conflicts found during v1 migration. */
153
+ listLegacyMigrationConflicts(): Promise<readonly IndexedDBLegacyMigrationConflict[]>;
154
+ /** Resolve quarantined legacy data by choosing v2 or one legacy byte payload. */
155
+ resolveLegacyMigrationConflict(path: WorkspacePath, resolution: IndexedDBLegacyConflictResolution): Promise<FileSystemEntrySnapshot>;
156
+ /** Explicitly discard every quarantined legacy candidate at a path. */
157
+ discardLegacyMigrationConflict(path: WorkspacePath): Promise<boolean>;
158
+ /**
159
+ * List the unrecognized legacy keys this workspace archived during migration.
160
+ *
161
+ * Migration deletes the legacy `fs:` namespace, but a key it cannot interpret
162
+ * is copied aside first rather than dropped: those bytes belong to whatever
163
+ * tool wrote them against this origin, and DocBlocks is not entitled to
164
+ * decide they are worthless. Nothing else reads that archive, so without this
165
+ * call the bytes are invisible and their quota is unaccountable.
166
+ *
167
+ * Values are deliberately excluded — an archive large enough to matter is an
168
+ * archive too large to materialize just to count it. Use
169
+ * {@link readLegacyOpaqueRecord} for the values themselves.
170
+ */
171
+ listLegacyOpaqueRecords(): Promise<readonly IndexedDBLegacyOpaqueRecordSummary[]>;
172
+ /** Retrieve every archived value for one unrecognized legacy key. */
173
+ readLegacyOpaqueRecord(key: string): Promise<IndexedDBLegacyOpaqueRecord | null>;
174
+ /**
175
+ * Permanently destroy archived legacy values. This is the only operation that
176
+ * can lose data the archive exists to protect.
177
+ *
178
+ * For every target, all of that key's archived value snapshots are erased and
179
+ * the quota they held is reclaimed. There is no undo, no tombstone, and no
180
+ * other copy: migration already deleted the original `fs:` key, so the
181
+ * archive is the last one. Retrieve anything worth keeping with
182
+ * {@link readLegacyOpaqueRecord} before calling this.
183
+ *
184
+ * Each target must carry the `valueCount` the caller actually observed, which
185
+ * is why a target is a value returned by {@link listLegacyOpaqueRecords} or
186
+ * {@link readLegacyOpaqueRecord} rather than a bare key. A stale client can
187
+ * append a new snapshot at any time; if any target has grown since it was
188
+ * observed, the whole call fails with `conflict` and destroys nothing, so
189
+ * re-list and look again. A key that is already absent is not an error —
190
+ * discarding what is gone is a no-op — but a key whose count disagrees is.
191
+ *
192
+ * @returns how many records were destroyed.
193
+ */
194
+ discardLegacyOpaqueRecords(targets: readonly IndexedDBLegacyOpaqueDiscardTarget[]): Promise<number>;
195
+ private ensureInitialized;
196
+ private migrateLegacy;
197
+ private quarantineExistingLegacy;
198
+ private transaction;
199
+ private withMutationLock;
200
+ private nextMutationVersion;
201
+ private advanceState;
202
+ private makeVersion;
203
+ private planParents;
204
+ private addDirectories;
205
+ private touchParents;
206
+ private canonicalNonRoot;
207
+ private assertExpectedVersion;
208
+ private assertOpen;
209
+ private error;
210
+ }
211
+
212
+ /**
213
+ * Legacy FileSystemProvider facade over the revisioned IndexedDB authority.
214
+ *
215
+ * The old `fs:*` namespace is migration input only. Keeping this facade as an
216
+ * adapter prevents current callers from recreating a second persistent source
217
+ * of truth while the workspace moves to FileSystemProviderV2.
218
+ */
219
+
220
+ interface IndexedDBFileSystemProviderOptions {
221
+ /** Injectable transaction store for deterministic fault/concurrency tests. */
222
+ store?: IndexedDBFileSystemStore;
223
+ /** Injectable metadata clock. */
224
+ now?: () => Date;
225
+ }
226
+ declare class IndexedDBFileSystemProvider implements FileSystemProvider {
227
+ readonly id: string;
228
+ readonly label: string;
229
+ readonly v2: IndexedDBFileSystemProviderV2;
230
+ private disposed;
231
+ constructor(id: string, label: string, options?: IndexedDBFileSystemProviderOptions);
232
+ /** Release the underlying database connection after accepted work settles. */
233
+ dispose(): Promise<void>;
234
+ readFile(path: string): Promise<string | null>;
235
+ writeFile(path: string, content: string): Promise<void>;
236
+ commitFile(path: string, content: string, expectedContent: string | null): Promise<FileCommitResult>;
237
+ delete(path: string): Promise<void>;
238
+ rename(oldPath: string, newPath: string): Promise<void>;
239
+ readDirectory(path: string): Promise<FileSystemEntry[]>;
240
+ exists(path: string): Promise<boolean>;
241
+ createDirectory(path: string): Promise<void>;
242
+ stat(path: string): Promise<FileMeta | null>;
243
+ readBinary(path: string): Promise<ArrayBuffer | null>;
244
+ writeBinary(path: string, data: ArrayBuffer | Uint8Array): Promise<void>;
245
+ /**
246
+ * Canonicalize only. Root policy is the v2 authority's to state: it accepts
247
+ * the root wherever the root is a legitimate target (`stat`, `readDirectory`,
248
+ * `createDirectory`) and rejects it with one consistent code and message
249
+ * everywhere else. Re-deriving that policy here is how this facade previously
250
+ * drifted from both v2 and its sibling facades.
251
+ */
252
+ private path;
253
+ /**
254
+ * Byte-authoritative entries may hold payloads that are not valid UTF-8. A
255
+ * lossy decode would hand the caller replacement characters that a later save
256
+ * writes back over the user's original bytes, so surface the fault instead.
257
+ */
258
+ private decode;
259
+ private assertOpen;
260
+ }
261
+
262
+ /**
263
+ * IndexedDBContentContainer — a ContentContainer backed by IndexedDB.
264
+ *
265
+ * Uses a dedicated IndexedDBFileSystemProvider instance (separate store)
266
+ * to persist media files across page refreshes.
267
+ */
268
+
269
+ declare class IndexedDBContentContainer implements ContentContainer {
270
+ private readonly provider;
271
+ constructor(workspaceId: string);
272
+ readFile(path: string): Promise<ArrayBuffer | null>;
273
+ writeFile(path: string, data: ArrayBuffer | Uint8Array, _mimeType?: string): Promise<void>;
274
+ removeFile(path: string): Promise<void>;
275
+ listFiles(prefix?: string): Promise<ContentEntry[]>;
276
+ exists(path: string): Promise<boolean>;
277
+ getDocumentPath(): Promise<string | null>;
278
+ readDocument(): Promise<string | null>;
279
+ writeDocument(markdown: string, filename?: string): Promise<void>;
280
+ /** Release the IndexedDB connection when a long-lived container is retired. */
281
+ dispose(): Promise<void>;
282
+ }
283
+
284
+ export { IndexedDBContentContainer, IndexedDBFileSystemProvider, IndexedDBFileSystemProviderV2, type IndexedDBFileSystemProviderV2Options, type IndexedDBLegacyConflictReason, type IndexedDBLegacyConflictResolution, type IndexedDBLegacyMigrationConflict, type IndexedDBLegacyOpaqueDiscardTarget, type IndexedDBLegacyOpaqueRecord, type IndexedDBLegacyOpaqueRecordSummary, type IndexedDBLegacyOpaqueValue, type IndexedDBLegacyRecoveryCandidate, type IndexedDBLegacyRecoveryKind, deleteIndexedDBWorkspaceData, indexedDBWorkspaceDatabaseName };