@bendyline/docblocks 2.0.0 → 2.1.1
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/README.md +2 -2
- package/dist/{chunk-2D7Y4IR3.js → chunk-4437YWLE.js} +123 -67
- package/dist/{chunk-5MYAICRE.js → chunk-45T5AFCN.js} +44 -57
- package/dist/{chunk-PGR7LK6D.js → chunk-6L3JRDE7.js} +14 -6
- package/dist/{chunk-RVQHY3XU.js → chunk-6XHOOBYF.js} +0 -1
- package/dist/chunk-73OOROXH.js +8 -0
- package/dist/{chunk-SI2LU2RP.js → chunk-AYWKIZLD.js} +1 -1
- package/dist/{chunk-GCPBEMMH.js → chunk-BVY7GGNV.js} +10 -21
- package/dist/{chunk-AEHCVWU5.js → chunk-DZB666V7.js} +0 -1
- package/dist/{chunk-75UUF6C4.js → chunk-HI7QEWL6.js} +18 -10
- package/dist/chunk-KQ6756AJ.js +28 -0
- package/dist/chunk-LMMOFRGQ.js +148 -0
- package/dist/{chunk-FNW556FN.js → chunk-M2PUNKHS.js} +0 -1
- package/dist/chunk-M5ZNQGR5.js +19 -0
- package/dist/chunk-M62ZGJ5I.js +51 -0
- package/dist/chunk-OQCPBOQA.js +168 -0
- package/dist/{chunk-EGNDADXB.js → chunk-QI6YKTQV.js} +2 -3
- package/dist/chunk-SJBB5OD7.js +227 -0
- package/dist/{chunk-EZKJZUNJ.js → chunk-XAMILHQP.js} +0 -1
- package/dist/{chunk-J32GU3F3.js → chunk-YM7O3PWO.js} +249 -222
- package/dist/{chunk-RQJRQF46.js → chunk-ZO7G53QP.js} +41 -49
- package/dist/document/index.d.ts +358 -6
- package/dist/document/index.js +24 -4
- package/dist/filesystem/electron.d.ts +73 -4
- package/dist/filesystem/electron.js +16 -4
- package/dist/filesystem/index.d.ts +228 -22
- package/dist/filesystem/index.js +133 -20
- package/dist/filesystem/indexeddb.d.ts +284 -5
- package/dist/filesystem/indexeddb.js +22 -5
- package/dist/filesystem/memory.d.ts +152 -4
- package/dist/filesystem/memory.js +12 -4
- package/dist/filesystem/native.d.ts +136 -4
- package/dist/filesystem/native.js +27 -4
- package/dist/host/index.d.ts +32 -9
- package/dist/host/index.js +26 -30
- package/dist/index.d.ts +14 -10
- package/dist/index.js +204 -10
- package/dist/mcp/index.d.ts +33 -4
- package/dist/mcp/index.js +31 -4
- package/dist/mcp/zod.d.ts +645 -643
- package/dist/mcp/zod.js +700 -885
- package/dist/share/index.d.ts +43 -0
- package/dist/share/index.js +12 -0
- package/dist/{types-CsX6EN2t.d.ts → types-BEg5SQ1_.d.ts} +1 -1
- package/dist/{types-eOlt9J7n.d.ts → types-CueK0tvU.d.ts} +34 -11
- package/dist/vscode/index.d.ts +225 -3
- package/dist/vscode/index.js +389 -3
- package/dist/workspace/index.d.ts +141 -4
- package/dist/workspace/index.js +28 -3
- package/package.json +10 -5
- package/dist/chunk-2D7Y4IR3.js.map +0 -1
- package/dist/chunk-5MYAICRE.js.map +0 -1
- package/dist/chunk-75UUF6C4.js.map +0 -1
- package/dist/chunk-AEHCVWU5.js.map +0 -1
- package/dist/chunk-AYZ4HN5M.js +0 -20
- package/dist/chunk-AYZ4HN5M.js.map +0 -1
- package/dist/chunk-EGNDADXB.js.map +0 -1
- package/dist/chunk-EZKJZUNJ.js.map +0 -1
- package/dist/chunk-FNW556FN.js.map +0 -1
- package/dist/chunk-GCPBEMMH.js.map +0 -1
- package/dist/chunk-J32GU3F3.js.map +0 -1
- package/dist/chunk-PGR7LK6D.js.map +0 -1
- package/dist/chunk-RQJRQF46.js.map +0 -1
- package/dist/chunk-RVQHY3XU.js.map +0 -1
- package/dist/chunk-SI2LU2RP.js.map +0 -1
- package/dist/chunk-W5UUUII5.js +0 -142
- package/dist/chunk-W5UUUII5.js.map +0 -1
- package/dist/document/document-session.d.ts +0 -127
- package/dist/document/document-session.d.ts.map +0 -1
- package/dist/document/document-session.js +0 -749
- package/dist/document/document-session.js.map +0 -1
- package/dist/document/filesystem-target.d.ts +0 -17
- package/dist/document/filesystem-target.d.ts.map +0 -1
- package/dist/document/filesystem-target.js +0 -70
- package/dist/document/filesystem-target.js.map +0 -1
- package/dist/document/index.d.ts.map +0 -1
- package/dist/document/index.js.map +0 -1
- package/dist/document/recovery-journal.d.ts +0 -125
- package/dist/document/recovery-journal.d.ts.map +0 -1
- package/dist/document/recovery-journal.js +0 -385
- package/dist/document/recovery-journal.js.map +0 -1
- package/dist/document/types.d.ts +0 -89
- package/dist/document/types.d.ts.map +0 -1
- package/dist/document/types.js +0 -9
- package/dist/document/types.js.map +0 -1
- package/dist/filesystem/commit-lock.d.ts +0 -3
- package/dist/filesystem/commit-lock.d.ts.map +0 -1
- package/dist/filesystem/commit-lock.js +0 -20
- package/dist/filesystem/commit-lock.js.map +0 -1
- package/dist/filesystem/dbk-workspace.d.ts +0 -34
- package/dist/filesystem/dbk-workspace.d.ts.map +0 -1
- package/dist/filesystem/dbk-workspace.js +0 -85
- package/dist/filesystem/dbk-workspace.js.map +0 -1
- package/dist/filesystem/electron-provider-v2.d.ts +0 -36
- package/dist/filesystem/electron-provider-v2.d.ts.map +0 -1
- package/dist/filesystem/electron-provider-v2.js +0 -503
- package/dist/filesystem/electron-provider-v2.js.map +0 -1
- package/dist/filesystem/electron-provider.d.ts +0 -35
- package/dist/filesystem/electron-provider.d.ts.map +0 -1
- package/dist/filesystem/electron-provider.js +0 -69
- package/dist/filesystem/electron-provider.js.map +0 -1
- package/dist/filesystem/electron.d.ts.map +0 -1
- package/dist/filesystem/electron.js.map +0 -1
- package/dist/filesystem/file-media-provider.d.ts +0 -23
- package/dist/filesystem/file-media-provider.d.ts.map +0 -1
- package/dist/filesystem/file-media-provider.js +0 -85
- package/dist/filesystem/file-media-provider.js.map +0 -1
- package/dist/filesystem/filesystem-content-container.d.ts +0 -24
- package/dist/filesystem/filesystem-content-container.d.ts.map +0 -1
- package/dist/filesystem/filesystem-content-container.js +0 -153
- package/dist/filesystem/filesystem-content-container.js.map +0 -1
- package/dist/filesystem/fs-error.d.ts +0 -46
- package/dist/filesystem/fs-error.d.ts.map +0 -1
- package/dist/filesystem/fs-error.js +0 -170
- package/dist/filesystem/fs-error.js.map +0 -1
- package/dist/filesystem/index.d.ts.map +0 -1
- package/dist/filesystem/index.js.map +0 -1
- package/dist/filesystem/indexeddb-content-container.d.ts +0 -22
- package/dist/filesystem/indexeddb-content-container.d.ts.map +0 -1
- package/dist/filesystem/indexeddb-content-container.js +0 -100
- package/dist/filesystem/indexeddb-content-container.js.map +0 -1
- package/dist/filesystem/indexeddb-provider-v2.d.ts +0 -96
- package/dist/filesystem/indexeddb-provider-v2.d.ts.map +0 -1
- package/dist/filesystem/indexeddb-provider-v2.js +0 -1241
- package/dist/filesystem/indexeddb-provider-v2.js.map +0 -1
- package/dist/filesystem/indexeddb-provider.d.ts +0 -39
- package/dist/filesystem/indexeddb-provider.d.ts.map +0 -1
- package/dist/filesystem/indexeddb-provider.js +0 -145
- package/dist/filesystem/indexeddb-provider.js.map +0 -1
- package/dist/filesystem/indexeddb-store.d.ts +0 -34
- package/dist/filesystem/indexeddb-store.d.ts.map +0 -1
- package/dist/filesystem/indexeddb-store.js +0 -165
- package/dist/filesystem/indexeddb-store.js.map +0 -1
- package/dist/filesystem/indexeddb.d.ts.map +0 -1
- package/dist/filesystem/indexeddb.js.map +0 -1
- package/dist/filesystem/legacy-v2-adapter.d.ts +0 -62
- package/dist/filesystem/legacy-v2-adapter.d.ts.map +0 -1
- package/dist/filesystem/legacy-v2-adapter.js +0 -499
- package/dist/filesystem/legacy-v2-adapter.js.map +0 -1
- package/dist/filesystem/memory-provider-v2.d.ts +0 -92
- package/dist/filesystem/memory-provider-v2.d.ts.map +0 -1
- package/dist/filesystem/memory-provider-v2.js +0 -615
- package/dist/filesystem/memory-provider-v2.js.map +0 -1
- package/dist/filesystem/memory-provider.d.ts +0 -54
- package/dist/filesystem/memory-provider.d.ts.map +0 -1
- package/dist/filesystem/memory-provider.js +0 -132
- package/dist/filesystem/memory-provider.js.map +0 -1
- package/dist/filesystem/memory.d.ts.map +0 -1
- package/dist/filesystem/memory.js.map +0 -1
- package/dist/filesystem/move-entry.d.ts +0 -9
- package/dist/filesystem/move-entry.d.ts.map +0 -1
- package/dist/filesystem/move-entry.js +0 -103
- package/dist/filesystem/move-entry.js.map +0 -1
- package/dist/filesystem/move-error.d.ts +0 -53
- package/dist/filesystem/move-error.d.ts.map +0 -1
- package/dist/filesystem/move-error.js +0 -99
- package/dist/filesystem/move-error.js.map +0 -1
- package/dist/filesystem/native-provider-v2.d.ts +0 -75
- package/dist/filesystem/native-provider-v2.d.ts.map +0 -1
- package/dist/filesystem/native-provider-v2.js +0 -849
- package/dist/filesystem/native-provider-v2.js.map +0 -1
- package/dist/filesystem/native-provider.d.ts +0 -53
- package/dist/filesystem/native-provider.d.ts.map +0 -1
- package/dist/filesystem/native-provider.js +0 -471
- package/dist/filesystem/native-provider.js.map +0 -1
- package/dist/filesystem/native.d.ts.map +0 -1
- package/dist/filesystem/native.js.map +0 -1
- package/dist/filesystem/types.d.ts +0 -83
- package/dist/filesystem/types.d.ts.map +0 -1
- package/dist/filesystem/types.js +0 -16
- package/dist/filesystem/types.js.map +0 -1
- package/dist/filesystem/v2.d.ts +0 -172
- package/dist/filesystem/v2.d.ts.map +0 -1
- package/dist/filesystem/v2.js +0 -16
- package/dist/filesystem/v2.js.map +0 -1
- package/dist/filesystem/workspace-path.d.ts +0 -21
- package/dist/filesystem/workspace-path.d.ts.map +0 -1
- package/dist/filesystem/workspace-path.js +0 -80
- package/dist/filesystem/workspace-path.js.map +0 -1
- package/dist/host/filesystem-v2.d.ts +0 -45
- package/dist/host/filesystem-v2.d.ts.map +0 -1
- package/dist/host/filesystem-v2.js +0 -13
- package/dist/host/filesystem-v2.js.map +0 -1
- package/dist/host/git.d.ts +0 -200
- package/dist/host/git.d.ts.map +0 -1
- package/dist/host/git.js +0 -15
- package/dist/host/git.js.map +0 -1
- package/dist/host/index.d.ts.map +0 -1
- package/dist/host/index.js.map +0 -1
- package/dist/host/types.d.ts +0 -232
- package/dist/host/types.d.ts.map +0 -1
- package/dist/host/types.js +0 -10
- package/dist/host/types.js.map +0 -1
- package/dist/host/wire-policy.d.ts +0 -22
- package/dist/host/wire-policy.d.ts.map +0 -1
- package/dist/host/wire-policy.js +0 -92
- package/dist/host/wire-policy.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/types.d.ts +0 -466
- package/dist/mcp/types.d.ts.map +0 -1
- package/dist/mcp/types.js +0 -25
- package/dist/mcp/types.js.map +0 -1
- package/dist/mcp/wire.d.ts +0 -29
- package/dist/mcp/wire.d.ts.map +0 -1
- package/dist/mcp/wire.js +0 -1046
- package/dist/mcp/wire.js.map +0 -1
- package/dist/mcp/zod.d.ts.map +0 -1
- package/dist/mcp/zod.js.map +0 -1
- package/dist/vscode/index.d.ts.map +0 -1
- package/dist/vscode/index.js.map +0 -1
- package/dist/vscode/messages.d.ts +0 -204
- package/dist/vscode/messages.d.ts.map +0 -1
- package/dist/vscode/messages.js +0 -494
- package/dist/vscode/messages.js.map +0 -1
- package/dist/workspace/index.d.ts.map +0 -1
- package/dist/workspace/index.js.map +0 -1
- package/dist/workspace/reconcile-electron.d.ts +0 -19
- package/dist/workspace/reconcile-electron.d.ts.map +0 -1
- package/dist/workspace/reconcile-electron.js +0 -42
- package/dist/workspace/reconcile-electron.js.map +0 -1
- package/dist/workspace/types.d.ts +0 -69
- package/dist/workspace/types.d.ts.map +0 -1
- package/dist/workspace/types.js +0 -2
- package/dist/workspace/types.js.map +0 -1
- package/dist/workspace/workspace-manager.d.ts +0 -47
- package/dist/workspace/workspace-manager.d.ts.map +0 -1
- package/dist/workspace/workspace-manager.js +0 -126
- package/dist/workspace/workspace-manager.js.map +0 -1
- package/src/document/document-session.ts +0 -834
- package/src/document/filesystem-target.ts +0 -109
- package/src/document/index.ts +0 -41
- package/src/document/recovery-journal.ts +0 -536
- package/src/document/types.ts +0 -116
- package/src/filesystem/commit-lock.ts +0 -29
- package/src/filesystem/dbk-workspace.ts +0 -135
- package/src/filesystem/electron-provider-v2.ts +0 -630
- package/src/filesystem/electron-provider.ts +0 -99
- package/src/filesystem/electron.ts +0 -3
- package/src/filesystem/file-media-provider.ts +0 -103
- package/src/filesystem/filesystem-content-container.ts +0 -164
- package/src/filesystem/fs-error.ts +0 -234
- package/src/filesystem/index.ts +0 -143
- package/src/filesystem/indexeddb-content-container.ts +0 -112
- package/src/filesystem/indexeddb-provider-v2.ts +0 -1740
- package/src/filesystem/indexeddb-provider.ts +0 -171
- package/src/filesystem/indexeddb-store.ts +0 -207
- package/src/filesystem/indexeddb.ts +0 -12
- package/src/filesystem/legacy-v2-adapter.ts +0 -779
- package/src/filesystem/memory-provider-v2.ts +0 -896
- package/src/filesystem/memory-provider.ts +0 -180
- package/src/filesystem/memory.ts +0 -15
- package/src/filesystem/move-entry.ts +0 -142
- package/src/filesystem/move-error.ts +0 -159
- package/src/filesystem/native-provider-v2.ts +0 -1165
- package/src/filesystem/native-provider.ts +0 -537
- package/src/filesystem/native.ts +0 -16
- package/src/filesystem/types.ts +0 -114
- package/src/filesystem/v2.ts +0 -231
- package/src/filesystem/workspace-path.ts +0 -92
- package/src/host/filesystem-v2.ts +0 -104
- package/src/host/git.ts +0 -246
- package/src/host/index.ts +0 -93
- package/src/host/types.ts +0 -274
- package/src/host/wire-policy.ts +0 -103
- package/src/index.ts +0 -10
- package/src/mcp/index.ts +0 -3
- package/src/mcp/types.ts +0 -594
- package/src/mcp/wire.ts +0 -1280
- package/src/mcp/zod.ts +0 -1000
- package/src/vscode/index.ts +0 -2
- package/src/vscode/messages.ts +0 -704
- package/src/workspace/index.ts +0 -17
- package/src/workspace/reconcile-electron.ts +0 -65
- package/src/workspace/types.ts +0 -67
- package/src/workspace/workspace-manager.ts +0 -151
package/dist/chunk-AYZ4HN5M.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// src/filesystem/v2.ts
|
|
2
|
-
function parseFileSystemVersion(value) {
|
|
3
|
-
if (typeof value !== "string" || !value || value.length > 1024 || value.includes("\0")) {
|
|
4
|
-
throw new TypeError("Filesystem version tokens must be non-empty bounded strings.");
|
|
5
|
-
}
|
|
6
|
-
return value;
|
|
7
|
-
}
|
|
8
|
-
function tryParseFileSystemVersion(value) {
|
|
9
|
-
try {
|
|
10
|
-
return parseFileSystemVersion(value);
|
|
11
|
-
} catch {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
parseFileSystemVersion,
|
|
18
|
-
tryParseFileSystemVersion
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=chunk-AYZ4HN5M.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/filesystem/v2.ts"],"sourcesContent":["import type { FsError } from './fs-error.js';\nimport type { WorkspacePath } from './workspace-path.js';\n\n/**\n * Opaque provider-issued token representing one observed entry/tree state.\n * Tokens support equality only within the issuing provider; callers must not\n * parse them or assume a move or byte-identical rewrite changes the token.\n * A token need not be a content hash, but it must change whenever the issuing\n * provider observes a potentially different kind, payload, or descendant\n * state. Detection of non-cooperating external changes is bounded by the\n * backend's declared capabilities and metadata precision.\n */\ndeclare const fileSystemVersionBrand: unique symbol;\nexport type FileSystemVersion = string & {\n readonly [fileSystemVersionBrand]: 'FileSystemVersion';\n};\n\n/** Validate/rebrand a version received from a provider transport. */\nexport function parseFileSystemVersion(value: unknown): FileSystemVersion {\n if (typeof value !== 'string' || !value || value.length > 1024 || value.includes('\\0')) {\n throw new TypeError('Filesystem version tokens must be non-empty bounded strings.');\n }\n return value as FileSystemVersion;\n}\n\nexport function tryParseFileSystemVersion(value: unknown): FileSystemVersion | null {\n try {\n return parseFileSystemVersion(value);\n } catch {\n return null;\n }\n}\n\n/** `process` excludes this provider's local peers; `cross-context` also excludes cooperating tabs/processes. */\nexport type FileSystemAtomicity = 'none' | 'process' | 'cross-context';\nexport type FileSystemCaseSensitivity = 'sensitive' | 'insensitive' | 'platform';\nexport type FileSystemDurability = 'volatile' | 'best-effort' | 'durable';\nexport type FileSystemConditionalWriteStrength =\n | 'none'\n | 'process'\n | 'cross-context'\n | 'storage-atomic';\nexport type FileSystemSymlinkPolicy = 'unsupported' | 'reject' | 'follow-contained' | 'preserve';\n\n/** Serializable feature declaration; consumers never need provider instanceof checks. */\nexport interface FileSystemProviderCapabilities {\n /** Isolation of one successful file replacement from cooperating writers. */\n readonly writeAtomicity: FileSystemAtomicity;\n /** Isolation of one successful source-to-destination move. */\n readonly moveAtomicity: FileSystemAtomicity;\n /** Writers excluded while one complete snapshot is captured. */\n readonly snapshotAtomicity: FileSystemAtomicity;\n /** Strongest boundary at which expectedVersion is checked with mutation. */\n readonly conditionalWrite: FileSystemConditionalWriteStrength;\n readonly recursiveRemove: boolean;\n /** True only when watch has a real ready barrier and sequenced events. */\n readonly watch: boolean;\n readonly caseSensitivity: FileSystemCaseSensitivity;\n readonly symlinkPolicy: FileSystemSymlinkPolicy;\n readonly durability: FileSystemDurability;\n}\n\ninterface FileSystemEntrySnapshotBase {\n readonly path: WorkspacePath;\n readonly name: string;\n readonly version: FileSystemVersion;\n /** ISO-8601 timestamp supplied by the backend; versions remain authoritative. */\n readonly lastModified: string;\n}\n\nexport interface FileSystemFileSnapshot extends FileSystemEntrySnapshotBase {\n readonly kind: 'file';\n readonly size: number;\n}\n\nexport interface FileSystemDirectorySnapshot extends FileSystemEntrySnapshotBase {\n readonly kind: 'directory';\n readonly size: null;\n}\n\nexport type FileSystemEntrySnapshot = FileSystemFileSnapshot | FileSystemDirectorySnapshot;\n\n/** A read always couples owned bytes to the exact metadata version they represent. */\nexport interface FileSystemFileRead {\n readonly entry: FileSystemFileSnapshot;\n readonly data: ArrayBuffer;\n}\n\nexport interface FileSystemSnapshotFile extends FileSystemFileSnapshot {\n readonly data: ArrayBuffer;\n}\n\nexport type FileSystemSnapshotEntry = FileSystemSnapshotFile | FileSystemDirectorySnapshot;\n\n/**\n * Complete best-available tree traversal. `snapshotAtomicity` declares\n * whether concurrent local/cross-context mutations are excluded while it is\n * captured. Implementations must never expose aliased buffers.\n */\nexport interface FileSystemSnapshot {\n readonly version: FileSystemVersion;\n readonly entries: readonly FileSystemSnapshotEntry[];\n}\n\nexport type FileSystemWriteMode = 'upsert' | 'create' | 'replace';\n\nexport interface FileSystemWriteOptions {\n /** Defaults to upsert. */\n readonly mode?: FileSystemWriteMode;\n /** Defaults to false so structure creation is never implicit. */\n readonly createParents?: boolean;\n /** null means the entry must not exist; a token requires an exact match. */\n readonly expectedVersion?: FileSystemVersion | null;\n}\n\nexport type FileSystemCreateDirectoryMode = 'ensure' | 'create';\n\nexport interface FileSystemCreateDirectoryOptions {\n /** Defaults to ensure (idempotently return an existing directory). */\n readonly mode?: FileSystemCreateDirectoryMode;\n /** Defaults to false. */\n readonly createParents?: boolean;\n}\n\nexport interface FileSystemRemoveOptions {\n /** Defaults to false; non-empty directories otherwise fail with not-empty. */\n readonly recursive?: boolean;\n /** Defaults to error. */\n readonly missing?: 'ignore' | 'error';\n readonly expectedVersion?: FileSystemVersion;\n}\n\nexport interface FileSystemRemoveResult {\n readonly removed: boolean;\n /** Version of the complete tree after the removal attempt. */\n readonly version: FileSystemVersion;\n}\n\nexport interface FileSystemMoveOptions {\n /** Defaults to false. Destinations are never overwritten. */\n readonly createParents?: boolean;\n readonly expectedVersion?: FileSystemVersion;\n}\n\nexport type FileSystemWatchEventType = 'created' | 'modified' | 'removed' | 'moved' | 'overflow';\nexport type FileSystemWatchEventOrigin = 'local' | 'external' | 'unknown';\n\ninterface FileSystemWatchEventBase {\n readonly sequence: number;\n readonly origin: FileSystemWatchEventOrigin;\n readonly path: WorkspacePath;\n}\n\nexport interface FileSystemEntryWatchEvent extends FileSystemWatchEventBase {\n readonly type: Exclude<FileSystemWatchEventType, 'overflow'>;\n readonly kind: 'file' | 'directory';\n readonly destinationPath: WorkspacePath | null;\n readonly version: FileSystemVersion | null;\n readonly previousVersion: FileSystemVersion | null;\n}\n\nexport interface FileSystemOverflowWatchEvent extends FileSystemWatchEventBase {\n readonly type: 'overflow';\n readonly kind: null;\n readonly destinationPath: null;\n readonly version: null;\n readonly previousVersion: null;\n}\n\nexport type FileSystemWatchEvent = FileSystemEntryWatchEvent | FileSystemOverflowWatchEvent;\n\nexport type FileSystemWatchListener = (event: FileSystemWatchEvent) => void;\nexport type FileSystemWatchErrorListener = (error: FsError) => void;\n\nexport interface FileSystemWatchOptions {\n readonly onError?: FileSystemWatchErrorListener;\n}\n\nexport interface FileSystemWatchSubscription {\n readonly closed: boolean;\n /** Resolves after the backend watch is installed and no initial event can be missed. */\n readonly ready: Promise<void>;\n /** Idempotent and awaitable so resource release can join provider shutdown. */\n dispose(): Promise<void>;\n}\n\n/**\n * Correctness-first filesystem contract. Every logical path has exactly one\n * kind and one byte payload; conditional writes and lifecycle disposal are\n * mandatory rather than optional provider extensions.\n */\nexport interface FileSystemProviderV2 {\n readonly id: string;\n readonly label: string;\n readonly capabilities: FileSystemProviderCapabilities;\n\n /** Absence is represented only by null; permission/I/O/wrong-kind errors throw FsError. */\n stat(path: WorkspacePath): Promise<FileSystemEntrySnapshot | null>;\n /** Absence is represented only by null; a directory at path is type-mismatch. */\n readFile(path: WorkspacePath): Promise<FileSystemFileRead | null>;\n /** Missing paths and file paths throw; results are canonical and deterministic. */\n readDirectory(path: WorkspacePath): Promise<readonly FileSystemEntrySnapshot[]>;\n\n writeFile(\n path: WorkspacePath,\n data: ArrayBuffer | Uint8Array,\n options?: FileSystemWriteOptions,\n ): Promise<FileSystemFileSnapshot>;\n createDirectory(\n path: WorkspacePath,\n options?: FileSystemCreateDirectoryOptions,\n ): Promise<FileSystemDirectorySnapshot>;\n remove(path: WorkspacePath, options?: FileSystemRemoveOptions): Promise<FileSystemRemoveResult>;\n move(\n oldPath: WorkspacePath,\n newPath: WorkspacePath,\n options?: FileSystemMoveOptions,\n ): Promise<FileSystemEntrySnapshot>;\n\n snapshot(): Promise<FileSystemSnapshot>;\n /**\n * Always returns a disposable subscription. When `capabilities.watch` is\n * false, `ready` rejects with `FsError('not-supported')` and `onError`\n * observes the same failure; callers can therefore use one cleanup path.\n */\n watch(\n listener: FileSystemWatchListener,\n options?: FileSystemWatchOptions,\n ): FileSystemWatchSubscription;\n dispose(): Promise<void>;\n}\n"],"mappings":";AAkBO,SAAS,uBAAuB,OAAmC;AACxE,MAAI,OAAO,UAAU,YAAY,CAAC,SAAS,MAAM,SAAS,QAAQ,MAAM,SAAS,IAAI,GAAG;AACtF,UAAM,IAAI,UAAU,8DAA8D;AAAA,EACpF;AACA,SAAO;AACT;AAEO,SAAS,0BAA0B,OAA0C;AAClF,MAAI;AACF,WAAO,uBAAuB,KAAK;AAAA,EACrC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/filesystem/move-error.ts"],"sourcesContent":["import { getFileSystemProviderV2, type FileSystemProvider } from './types.js';\nimport { parseWorkspacePath } from './workspace-path.js';\n\nexport type FileSystemPathPresence = 'present' | 'missing' | 'unknown';\n\nexport interface FileSystemPartialMoveState {\n readonly source: FileSystemPathPresence;\n readonly destination: FileSystemPathPresence;\n readonly companionSource: FileSystemPathPresence;\n readonly companionDestination: FileSystemPathPresence;\n}\n\nexport type FileSystemMoveLocation = 'source' | 'destination' | 'both' | 'neither' | 'unknown';\n\nexport interface FileSystemEntryMoveState {\n readonly source: FileSystemPathPresence;\n readonly destination: FileSystemPathPresence;\n}\n\nfunction locationFromPresence(\n source: FileSystemPathPresence,\n destination: FileSystemPathPresence,\n): FileSystemMoveLocation {\n if (source === 'unknown' || destination === 'unknown') return 'unknown';\n if (source === 'present' && destination === 'present') return 'both';\n if (source === 'present') return 'source';\n if (destination === 'present') return 'destination';\n return 'neither';\n}\n\n/**\n * One provider move failed without restoring a provable source-only state.\n * This is backend-neutral: callers must use `location`, never infer from the\n * original exception or a provider's advertised move atomicity.\n */\nexport class FileSystemMoveRecoveryError extends Error {\n public readonly code = 'partial-move' as const;\n\n public constructor(\n public readonly sourcePath: string,\n public readonly destinationPath: string,\n public readonly state: FileSystemEntryMoveState,\n public readonly moveError: unknown,\n ) {\n super(\n `The move did not restore one authoritative path. Entry location: ${locationFromPresence(\n state.source,\n state.destination,\n )}.`,\n );\n this.name = 'FileSystemMoveRecoveryError';\n }\n\n public get location(): FileSystemMoveLocation {\n return locationFromPresence(this.state.source, this.state.destination);\n }\n\n /** Alias used by DocumentSession's document-retarget recovery protocol. */\n public get documentLocation(): FileSystemMoveLocation {\n return this.location;\n }\n}\n\n/**\n * A compound document/companion move failed and the document rollback also\n * failed. Callers must use the recorded post-state instead of assuming the\n * original path is still authoritative.\n */\nexport class FileSystemPartialMoveError extends Error {\n readonly code = 'partial-move' as const;\n\n constructor(\n readonly sourcePath: string,\n readonly destinationPath: string,\n readonly companionSourcePath: string,\n readonly companionDestinationPath: string,\n readonly state: FileSystemPartialMoveState,\n readonly moveError: unknown,\n readonly rollbackError: unknown,\n ) {\n super(\n `The document move could not be rolled back. Document location: ${locationFromPresence(\n state.source,\n state.destination,\n )}; companion location: ${locationFromPresence(\n state.companionSource,\n state.companionDestination,\n )}.`,\n );\n this.name = 'FileSystemPartialMoveError';\n }\n\n get documentLocation(): FileSystemMoveLocation {\n return locationFromPresence(this.state.source, this.state.destination);\n }\n\n get companionLocation(): FileSystemMoveLocation {\n return locationFromPresence(this.state.companionSource, this.state.companionDestination);\n }\n}\n\nexport function isFileSystemPartialMoveError(error: unknown): error is FileSystemPartialMoveError {\n return error instanceof FileSystemPartialMoveError;\n}\n\nexport function isFileSystemMoveRecoveryError(\n error: unknown,\n): error is FileSystemMoveRecoveryError {\n return error instanceof FileSystemMoveRecoveryError;\n}\n\nexport function isFileSystemMoveStateError(\n error: unknown,\n): error is FileSystemMoveRecoveryError | FileSystemPartialMoveError {\n return isFileSystemMoveRecoveryError(error) || isFileSystemPartialMoveError(error);\n}\n\nasync function probePath(\n provider: FileSystemProvider,\n path: string,\n): Promise<FileSystemPathPresence> {\n try {\n const providerV2 = getFileSystemProviderV2(provider);\n const present = providerV2\n ? (await providerV2.stat(parseWorkspacePath(path))) !== null\n : await provider.exists(path);\n return present ? 'present' : 'missing';\n } catch {\n return 'unknown';\n }\n}\n\nexport async function describePartialMove(\n provider: FileSystemProvider,\n sourcePath: string,\n destinationPath: string,\n companionSourcePath: string,\n companionDestinationPath: string,\n): Promise<FileSystemPartialMoveState> {\n const [source, destination, companionSource, companionDestination] = await Promise.all([\n probePath(provider, sourcePath),\n probePath(provider, destinationPath),\n probePath(provider, companionSourcePath),\n probePath(provider, companionDestinationPath),\n ]);\n return { source, destination, companionSource, companionDestination };\n}\n\nexport async function describeEntryMove(\n provider: FileSystemProvider,\n sourcePath: string,\n destinationPath: string,\n): Promise<FileSystemEntryMoveState> {\n const [source, destination] = await Promise.all([\n probePath(provider, sourcePath),\n probePath(provider, destinationPath),\n ]);\n return { source, destination };\n}\n"],"mappings":";;;;;;;;AAmBA,SAAS,qBACP,QACA,aACwB;AACxB,MAAI,WAAW,aAAa,gBAAgB,UAAW,QAAO;AAC9D,MAAI,WAAW,aAAa,gBAAgB,UAAW,QAAO;AAC9D,MAAI,WAAW,UAAW,QAAO;AACjC,MAAI,gBAAgB,UAAW,QAAO;AACtC,SAAO;AACT;AAOO,IAAM,8BAAN,cAA0C,MAAM;AAAA,EAG9C,YACW,YACA,iBACA,OACA,WAChB;AACA;AAAA,MACE,oEAAoE;AAAA,QAClE,MAAM;AAAA,QACN,MAAM;AAAA,MACR,CAAC;AAAA,IACH;AAVgB;AACA;AACA;AACA;AANlB,SAAgB,OAAO;AAcrB,SAAK,OAAO;AAAA,EACd;AAAA,EAEA,IAAW,WAAmC;AAC5C,WAAO,qBAAqB,KAAK,MAAM,QAAQ,KAAK,MAAM,WAAW;AAAA,EACvE;AAA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IACvC,UAAU,UAAU,wBAAwB;AAAA,EAC9C,CAAC;AACD,SAAO,EAAE,QAAQ,aAAa,iBAAiB,qBAAqB;AACtE;AAEA,eAAsB,kBACpB,UACA,YACA,iBACmC;AACnC,QAAM,CAAC,QAAQ,WAAW,IAAI,MAAM,QAAQ,IAAI;AAAA,IAC9C,UAAU,UAAU,UAAU;AAAA,IAC9B,UAAU,UAAU,eAAe;AAAA,EACrC,CAAC;AACD,SAAO,EAAE,QAAQ,YAAY;AAC/B;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/filesystem/types.ts"],"sourcesContent":["/**\n * FileSystemProvider — abstract interface for a virtual filesystem.\n *\n * Legacy text-oriented facade retained while consumers migrate to\n * FileSystemProviderV2. New persistence code must use the provider's `v2`\n * contract so paths, errors, operation modes, and capabilities are explicit.\n */\n\n// ── Entry types ────────────────────────────────────────────────────\n\nimport type { FileSystemProviderV2 } from './v2.js';\n\nexport interface FileEntry {\n kind: 'file';\n name: string;\n path: string;\n}\n\nexport interface FolderEntry {\n kind: 'directory';\n name: string;\n path: string;\n}\n\nexport type FileSystemEntry = FileEntry | FolderEntry;\n\nexport interface FileMeta {\n name: string;\n path: string;\n size: number;\n lastModified: string;\n}\n\nexport type FileCommitResult =\n | { status: 'committed'; version: string | null }\n | { status: 'conflict'; content: string | null; version: string | null };\n\n// ── Provider interface ─────────────────────────────────────────────\n\n/**\n * @deprecated Compatibility facade for external providers and older callers.\n * Implement new backends with `FileSystemProviderV2`; built-in facades expose\n * their authoritative implementation through `v2`.\n */\nexport interface FileSystemProvider {\n /** Unique identifier for this provider instance. */\n readonly id: string;\n\n /** Human-readable label (e.g., folder name or \"Browser Storage\"). */\n readonly label: string;\n\n /** Optional correctness-first implementation exposed during the v1-to-v2 migration. */\n readonly v2?: FileSystemProviderV2;\n\n /** Read the text content of a file. Returns null if the file doesn't exist. */\n readFile(path: string): Promise<string | null>;\n\n /** Write text content to a file, creating it (and parent dirs) if needed. */\n writeFile(path: string, content: string): Promise<void>;\n\n /**\n * Conditionally replace a text file when it still matches the caller's\n * persisted baseline. Production providers implement this at their\n * strongest available serialization boundary.\n */\n commitFile?(\n path: string,\n content: string,\n expectedContent: string | null,\n ): Promise<FileCommitResult>;\n\n /**\n * Legacy recursive removal of a file or directory subtree. Workspace root\n * deletion is forbidden. Prefer v2 `remove({ recursive })`.\n */\n delete(path: string): Promise<void>;\n\n /** Rename or move an entry. Rejects missing sources and existing destinations. */\n rename(oldPath: string, newPath: string): Promise<void>;\n\n /** List immediate children of a directory. */\n readDirectory(path: string): Promise<FileSystemEntry[]>;\n\n /** Check whether a path exists. */\n exists(path: string): Promise<boolean>;\n\n /** Create a directory (and parents if needed). */\n createDirectory(path: string): Promise<void>;\n\n /** Get metadata for a file. Returns null if not found. */\n stat(path: string): Promise<FileMeta | null>;\n\n /** Read raw binary content. Returns null if not found. */\n readBinary(path: string): Promise<ArrayBuffer | null>;\n\n /** Write raw binary content. */\n writeBinary(path: string, data: ArrayBuffer | Uint8Array): Promise<void>;\n}\n\nexport type FileSystemProviderWithV2 = FileSystemProvider & {\n readonly v2: FileSystemProviderV2;\n};\n\n/** Discover a provider-owned v2 implementation without coupling consumers to a concrete class. */\nexport function hasFileSystemProviderV2(\n provider: FileSystemProvider,\n): provider is FileSystemProviderWithV2 {\n return provider.v2 !== undefined && provider.v2 !== null;\n}\n\n/** Return the provider-owned v2 implementation when migration support is available. */\nexport function getFileSystemProviderV2(provider: FileSystemProvider): FileSystemProviderV2 | null {\n return provider.v2 ?? null;\n}\n"],"mappings":";AAwGO,SAAS,wBACd,UACsC;AACtC,SAAO,SAAS,OAAO,UAAa,SAAS,OAAO;AACtD;AAGO,SAAS,wBAAwB,UAA2D;AACjG,SAAO,SAAS,MAAM;AACxB;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/host/wire-policy.ts"],"sourcesContent":["import type { OpenRequest } from './types.js';\n\n/** Quantitative limits shared by privileged host boundaries. */\nexport const HOST_WIRE_LIMITS = Object.freeze({\n identifierCharacters: 256,\n labelCharacters: 1_024,\n pathCharacters: 4_096,\n urlCharacters: 8_192,\n messageCharacters: 2_000,\n documentCharacters: 20 * 1024 * 1024,\n binaryBytes: 100 * 1024 * 1024,\n base64Characters: 140 * 1024 * 1024,\n arrayEntries: 10_000,\n});\n\nfunction hasExactKeys(value: Record<string, unknown>, keys: readonly string[]): boolean {\n const actual = Object.keys(value);\n return (\n actual.length === keys.length &&\n keys.every((key) => Object.prototype.hasOwnProperty.call(value, key))\n );\n}\n\nexport function isBoundedString(\n value: unknown,\n maximumCharacters: number,\n minimumCharacters = 0,\n): value is string {\n return (\n typeof value === 'string' &&\n value.length >= minimumCharacters &&\n value.length <= maximumCharacters &&\n !value.includes('\\0')\n );\n}\n\nexport function isBoundedBytePayload(\n value: unknown,\n maximumBytes = HOST_WIRE_LIMITS.binaryBytes,\n): value is ArrayBuffer | Uint8Array {\n return (\n (value instanceof ArrayBuffer || value instanceof Uint8Array) &&\n value.byteLength <= maximumBytes\n );\n}\n\n/** Parse one exact, bounded main-to-renderer open request. */\nexport function parseOpenRequest(value: unknown): OpenRequest | null {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) return null;\n const record = value as Record<string, unknown>;\n\n if (record.kind === 'workspace-file') {\n if (!hasExactKeys(record, ['kind', 'workspaceId', 'path'])) return null;\n if (!isBoundedString(record.workspaceId, HOST_WIRE_LIMITS.identifierCharacters, 1)) return null;\n if (!isBoundedString(record.path, HOST_WIRE_LIMITS.pathCharacters, 1)) return null;\n return { kind: 'workspace-file', workspaceId: record.workspaceId, path: record.path };\n }\n\n if (record.kind === 'external-file' || record.kind === 'external-bundle') {\n if (!hasExactKeys(record, ['kind', 'resourceId', 'name'])) return null;\n if (!isBoundedString(record.resourceId, HOST_WIRE_LIMITS.identifierCharacters, 1)) return null;\n if (!isBoundedString(record.name, HOST_WIRE_LIMITS.labelCharacters, 1)) return null;\n return { kind: record.kind, resourceId: record.resourceId, name: record.name };\n }\n\n return null;\n}\n\n/** Return one canonical HTTP(S) URL, or null when external navigation is unsafe. */\nexport function parseExternalHttpUrl(value: unknown): string | null {\n if (!isBoundedString(value, HOST_WIRE_LIMITS.urlCharacters, 1)) return null;\n try {\n const url = new URL(value);\n if (url.protocol !== 'http:' && url.protocol !== 'https:') return null;\n if (url.username || url.password) return null;\n const canonical = url.href;\n return canonical.length <= HOST_WIRE_LIMITS.urlCharacters ? canonical : null;\n } catch {\n return null;\n }\n}\n\n/** True only for the packaged renderer origin or the exact configured dev origin. */\nexport function isTrustedRendererUrl(value: unknown, developmentOrigin?: string): boolean {\n if (!isBoundedString(value, HOST_WIRE_LIMITS.urlCharacters, 1)) return false;\n try {\n const url = new URL(value);\n if (\n url.protocol === 'app:' &&\n url.hostname === 'docblocks' &&\n url.port === '' &&\n url.username === '' &&\n url.password === ''\n ) {\n return true;\n }\n if (!developmentOrigin) return false;\n const trustedDevelopmentOrigin = new URL(developmentOrigin);\n return url.origin === trustedDevelopmentOrigin.origin;\n } catch {\n return false;\n }\n}\n"],"mappings":";AAGO,IAAM,mBAAmB,OAAO,OAAO;AAAA,EAC5C,sBAAsB;AAAA,EACtB,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,oBAAoB,KAAK,OAAO;AAAA,EAChC,aAAa,MAAM,OAAO;AAAA,EAC1B,kBAAkB,MAAM,OAAO;AAAA,EAC/B,cAAc;AAChB,CAAC;AAED,SAAS,aAAa,OAAgC,MAAkC;AACtF,QAAM,SAAS,OAAO,KAAK,KAAK;AAChC,SACE,OAAO,WAAW,KAAK,UACvB,KAAK,MAAM,CAAC,QAAQ,OAAO,UAAU,eAAe,KAAK,OAAO,GAAG,CAAC;AAExE;AAEO,SAAS,gBACd,OACA,mBACA,oBAAoB,GACH;AACjB,SACE,OAAO,UAAU,YACjB,MAAM,UAAU,qBAChB,MAAM,UAAU,qBAChB,CAAC,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UAAU,UAAU,iBAAiB,gBAAgB,YAAY;AAAA,EAC1E,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGO,SAAS,qBAAqB,OAAgB,mBAAqC;AACxF,MAAI,CAAC,gBAAgB,OAAO,iBAAiB,eAAe,CAAC,EAAG,QAAO;AACvE,MAAI;AACF,UAAM,MAAM,IAAI,IAAI,KAAK;AACzB,QACE,IAAI,aAAa,UACjB,IAAI,aAAa,eACjB,IAAI,SAAS,MACb,IAAI,aAAa,MACjB,IAAI,aAAa,IACjB;AACA,aAAO;AAAA,IACT;AACA,QAAI,CAAC,kBAAmB,QAAO;AAC/B,UAAM,2BAA2B,IAAI,IAAI,iBAAiB;AAC1D,WAAO,IAAI,WAAW,yBAAyB;AAAA,EACjD,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/filesystem/electron-provider-v2.ts","../src/filesystem/electron-provider.ts"],"sourcesContent":["import {\n ELECTRON_FILE_SYSTEM_V2_CAPABILITIES,\n maybeGetDocBlocksHost,\n type DocBlocksHostFsV2API,\n type HostFileSystemV2Result,\n type HostFileSystemV2WatchMessage,\n} from '../host/index.js';\nimport {\n FsError,\n deserializeFsError,\n fsErrorFromUnknown,\n isSerializedFsError,\n type FsOperation,\n} from './fs-error.js';\nimport {\n WORKSPACE_ROOT,\n parseWorkspacePath,\n workspacePathBasename,\n workspacePathDirname,\n type WorkspacePath,\n} from './workspace-path.js';\nimport {\n parseFileSystemVersion,\n type FileSystemCreateDirectoryOptions,\n type FileSystemDirectorySnapshot,\n type FileSystemEntrySnapshot,\n type FileSystemFileRead,\n type FileSystemFileSnapshot,\n type FileSystemMoveOptions,\n type FileSystemProviderCapabilities,\n type FileSystemProviderV2,\n type FileSystemRemoveOptions,\n type FileSystemRemoveResult,\n type FileSystemSnapshot,\n type FileSystemSnapshotEntry,\n type FileSystemWatchEvent,\n type FileSystemWatchOptions,\n type FileSystemWatchSubscription,\n type FileSystemWriteOptions,\n} from './v2.js';\n\ninterface ClientWatcher {\n readonly listener: (event: FileSystemWatchEvent) => void;\n readonly onError: FileSystemWatchOptions['onError'];\n}\n\nlet fallbackInstanceSequence = 0;\n\nfunction getHostFsV2(operation: FsOperation): DocBlocksHostFsV2API {\n const host = maybeGetDocBlocksHost();\n if (!host?.fsV2) {\n throw new FsError('not-supported', 'Electron filesystem v2 host is unavailable.', {\n operation,\n });\n }\n return host.fsV2;\n}\n\n/** Pure renderer-side client for the typed Electron filesystem v2 transport. */\nexport class ElectronFileSystemProviderV2 implements FileSystemProviderV2 {\n public readonly id: string;\n public readonly label: string;\n public readonly capabilities = ELECTRON_FILE_SYSTEM_V2_CAPABILITIES;\n\n private readonly rootPath: string;\n private readonly instanceId = createInstanceId();\n private readonly watchers = new Map<string, ClientWatcher>();\n private readonly subscriptions = new Set<FileSystemWatchSubscription>();\n private readonly inFlight = new Set<Promise<unknown>>();\n private openPromise: Promise<void> | null = null;\n private removeWatchBridge: (() => void) | null = null;\n private disposePromise: Promise<void> | null = null;\n private hostOpened = false;\n private disposed = false;\n\n public constructor(id: string, label: string, rootPath: string) {\n this.id = id;\n this.label = label;\n this.rootPath = rootPath;\n }\n\n public getRootPath(): string {\n return this.rootPath;\n }\n\n public async stat(path: WorkspacePath): Promise<FileSystemEntrySnapshot | null> {\n const canonical = parseWorkspacePath(String(path));\n return this.request(\n 'stat',\n () => getHostFsV2('stat').stat(this.instanceId, canonical),\n (value) => (value ? normalizeEntry(value) : null),\n );\n }\n\n public async readFile(path: WorkspacePath): Promise<FileSystemFileRead | null> {\n const canonical = parseWorkspacePath(String(path));\n return this.request(\n 'read',\n () => getHostFsV2('read').readFile(this.instanceId, canonical),\n (value) => {\n if (!value) return null;\n const entry = normalizeFile(value.entry);\n const data = copyWireBuffer(value.data);\n if (data.byteLength !== entry.size) {\n throw new TypeError('Filesystem transport returned file bytes with the wrong size.');\n }\n return Object.freeze({ entry, data });\n },\n );\n }\n\n public async readDirectory(path: WorkspacePath): Promise<readonly FileSystemEntrySnapshot[]> {\n const canonical = parseWorkspacePath(String(path));\n return this.request(\n 'list',\n () => getHostFsV2('list').readDirectory(this.instanceId, canonical),\n (value) => normalizeDirectoryListing(value, canonical),\n );\n }\n\n public async writeFile(\n path: WorkspacePath,\n data: ArrayBuffer | Uint8Array,\n options?: FileSystemWriteOptions,\n ): Promise<FileSystemFileSnapshot> {\n const canonical = parseWorkspacePath(String(path));\n const owned = copyBytes(data);\n return this.request(\n 'write',\n () => getHostFsV2('write').writeFile(this.instanceId, canonical, owned, options),\n normalizeFile,\n );\n }\n\n public async createDirectory(\n path: WorkspacePath,\n options?: FileSystemCreateDirectoryOptions,\n ): Promise<FileSystemDirectorySnapshot> {\n const canonical = parseWorkspacePath(String(path));\n return this.request(\n 'create-directory',\n () => getHostFsV2('create-directory').createDirectory(this.instanceId, canonical, options),\n normalizeDirectory,\n );\n }\n\n public async remove(\n path: WorkspacePath,\n options?: FileSystemRemoveOptions,\n ): Promise<FileSystemRemoveResult> {\n const canonical = parseWorkspacePath(String(path));\n return this.request(\n 'remove',\n () => getHostFsV2('remove').remove(this.instanceId, canonical, options),\n normalizeRemoveResult,\n );\n }\n\n public async move(\n oldPath: WorkspacePath,\n newPath: WorkspacePath,\n options?: FileSystemMoveOptions,\n ): Promise<FileSystemEntrySnapshot> {\n const source = parseWorkspacePath(String(oldPath));\n const destination = parseWorkspacePath(String(newPath));\n return this.request(\n 'move',\n () => getHostFsV2('move').move(this.instanceId, source, destination, options),\n normalizeEntry,\n );\n }\n\n public async snapshot(): Promise<FileSystemSnapshot> {\n return this.request(\n 'snapshot',\n () => getHostFsV2('snapshot').snapshot(this.instanceId),\n normalizeSnapshot,\n );\n }\n\n public watch(\n listener: (event: FileSystemWatchEvent) => void,\n options: FileSystemWatchOptions = {},\n ): FileSystemWatchSubscription {\n this.assertOpen('watch');\n this.ensureWatchBridge();\n const subscriptionId = createInstanceId();\n const watcher: ClientWatcher = { listener, onError: options.onError };\n this.watchers.set(subscriptionId, watcher);\n let closed = false;\n let subscribed = false;\n let closePromise: Promise<void> | null = null;\n const ready = this.ensureOpen('watch')\n .then(async () => {\n if (closed) return;\n unwrap(await getHostFsV2('watch').watchSubscribe(this.instanceId, subscriptionId), 'watch');\n subscribed = true;\n })\n .catch((error: unknown) => {\n closed = true;\n this.watchers.delete(subscriptionId);\n const typed = error instanceof FsError ? error : new FsError('io', String(error));\n try {\n watcher.onError?.(typed);\n } catch {\n // Isolate observers.\n }\n throw typed;\n });\n\n const subscription: FileSystemWatchSubscription = {\n get closed() {\n return closed;\n },\n ready,\n dispose: () => {\n if (closePromise) return closePromise;\n closed = true;\n this.watchers.delete(subscriptionId);\n this.subscriptions.delete(subscription);\n closePromise = (async () => {\n await ready.catch(() => undefined);\n if (subscribed) {\n unwrap(\n await getHostFsV2('watch').watchUnsubscribe(this.instanceId, subscriptionId),\n 'watch',\n );\n }\n })();\n return closePromise;\n },\n };\n this.subscriptions.add(subscription);\n return subscription;\n }\n\n public dispose(): Promise<void> {\n if (this.disposePromise) return this.disposePromise;\n this.disposed = true;\n this.disposePromise = (async () => {\n await Promise.allSettled([...this.inFlight]);\n await Promise.all([...this.subscriptions].map((subscription) => subscription.dispose()));\n try {\n if (this.openPromise) {\n try {\n await this.openPromise;\n } catch {\n // A failed request normally creates no host record. `hostOpened`\n // separately tracks a successful open whose response validation\n // failed after the main-side record had already been published.\n }\n }\n if (this.hostOpened) {\n try {\n unwrap(await getHostFsV2('dispose').dispose(this.instanceId), 'dispose');\n } catch (error: unknown) {\n if (!(error instanceof FsError && error.code === 'closed')) throw error;\n } finally {\n this.hostOpened = false;\n }\n }\n } finally {\n this.removeWatchBridge?.();\n this.removeWatchBridge = null;\n }\n })();\n return this.disposePromise;\n }\n\n private request<T, U>(\n operation: FsOperation,\n send: () => Promise<HostFileSystemV2Result<T>>,\n normalize: (value: T) => U,\n ): Promise<U> {\n this.assertOpen(operation);\n const promise = this.ensureOpen(operation).then(async () => {\n try {\n return normalize(unwrap(await send(), operation));\n } catch (error: unknown) {\n throw transportErrorFromUnknown(error, operation);\n }\n });\n this.inFlight.add(promise);\n void promise.then(\n () => this.inFlight.delete(promise),\n () => this.inFlight.delete(promise),\n );\n return promise;\n }\n\n private ensureOpen(operation: FsOperation): Promise<void> {\n this.assertOpen(operation);\n if (!this.openPromise) {\n const attempt = getHostFsV2(operation)\n .open({\n instanceId: this.instanceId,\n providerId: this.id,\n label: this.label,\n })\n .then((result) => {\n if (isRecord(result) && result.ok === true) this.hostOpened = true;\n const capabilities = unwrap(result, operation);\n assertCapabilities(capabilities, operation);\n })\n .catch((error: unknown) => {\n const typed = withOperation(fsErrorFromUnknown(error, { operation }), operation);\n if (typed.retryable && this.openPromise === attempt) this.openPromise = null;\n throw typed;\n });\n this.openPromise = attempt;\n }\n return this.openPromise;\n }\n\n private ensureWatchBridge(): void {\n if (this.removeWatchBridge) return;\n this.removeWatchBridge = getHostFsV2('watch').onWatchMessage((message) =>\n this.handleWatchMessage(message),\n );\n }\n\n private handleWatchMessage(message: HostFileSystemV2WatchMessage): void {\n if (message.instanceId !== this.instanceId) return;\n const watcher = this.watchers.get(message.subscriptionId);\n if (!watcher) return;\n if (message.kind === 'error') {\n const typed = isSerializedFsError(message.error)\n ? deserializeFsError(message.error)\n : invalidTransport('watch', 'Filesystem transport returned an invalid watch error.');\n try {\n watcher.onError?.(typed);\n } catch {\n // Isolate observers.\n }\n return;\n }\n\n let event: FileSystemWatchEvent;\n try {\n event = normalizeWatchEvent(message.event);\n } catch (error: unknown) {\n try {\n watcher.onError?.(transportErrorFromUnknown(error, 'watch'));\n } catch {\n // Isolate observers.\n }\n return;\n }\n try {\n watcher.listener(event);\n } catch {\n // Watch callbacks are observational.\n }\n }\n\n private assertOpen(operation: FsOperation): void {\n if (!this.disposed) return;\n throw new FsError('disposed', 'Filesystem provider is disposed.', { operation });\n }\n}\n\nfunction unwrap<T>(result: HostFileSystemV2Result<T>, operation: FsOperation): T {\n if (!isRecord(result) || typeof result.ok !== 'boolean') {\n throw invalidTransport(operation, 'Filesystem transport returned an invalid result envelope.');\n }\n if (result.ok) {\n if (!('value' in result)) {\n throw invalidTransport(operation, 'Filesystem transport omitted a result value.');\n }\n return result.value;\n }\n if (!isSerializedFsError(result.error)) {\n throw invalidTransport(operation, 'Filesystem transport returned an invalid error envelope.');\n }\n throw deserializeFsError(result.error);\n}\n\nfunction normalizeEntry(entry: FileSystemEntrySnapshot): FileSystemEntrySnapshot {\n if (!isRecord(entry)) throw new TypeError('Expected a filesystem entry object.');\n if (typeof entry.path !== 'string')\n throw new TypeError('Filesystem entry path must be a string.');\n if (typeof entry.name !== 'string')\n throw new TypeError('Filesystem entry name must be a string.');\n if (typeof entry.lastModified !== 'string') {\n throw new TypeError('Filesystem entry timestamp must be a string.');\n }\n const path = parseWorkspacePath(entry.path);\n if (entry.name !== workspacePathBasename(path)) {\n throw new TypeError('Filesystem entry name does not match its canonical path.');\n }\n const common = {\n path,\n name: entry.name,\n version: parseFileSystemVersion(entry.version),\n lastModified: new Date(entry.lastModified).toISOString(),\n };\n if (entry.kind === 'file') {\n if (!isNonNegativeSafeInteger(entry.size)) {\n throw new TypeError('Filesystem file size must be a non-negative safe integer.');\n }\n return Object.freeze({ ...common, kind: 'file', size: entry.size });\n }\n if (entry.kind === 'directory') {\n if (entry.size !== null) throw new TypeError('Filesystem directory size must be null.');\n return Object.freeze({ ...common, kind: 'directory', size: null });\n }\n throw new TypeError('Unknown filesystem entry kind.');\n}\n\nfunction normalizeDirectoryListing(\n value: readonly FileSystemEntrySnapshot[],\n parent: WorkspacePath,\n): readonly FileSystemEntrySnapshot[] {\n if (!Array.isArray(value)) throw new TypeError('Expected a filesystem directory listing.');\n const entries = value.map(normalizeEntry);\n const seen = new Set<WorkspacePath>();\n for (const entry of entries) {\n if (entry.path === WORKSPACE_ROOT || workspacePathDirname(entry.path) !== parent) {\n throw new TypeError('Filesystem listing contained a non-child entry.');\n }\n if (seen.has(entry.path)) throw new TypeError('Filesystem listing contained a duplicate path.');\n seen.add(entry.path);\n }\n const ordered = [...entries].sort(compareDirectoryEntries);\n if (ordered.some((entry, index) => entry.path !== entries[index]?.path)) {\n throw new TypeError('Filesystem listing was not in canonical deterministic order.');\n }\n return Object.freeze(entries);\n}\n\nfunction normalizeFile(entry: FileSystemFileSnapshot): FileSystemFileSnapshot {\n const normalized = normalizeEntry(entry);\n if (normalized.kind !== 'file') throw new TypeError('Expected a file snapshot.');\n return normalized;\n}\n\nfunction normalizeDirectory(entry: FileSystemDirectorySnapshot): FileSystemDirectorySnapshot {\n const normalized = normalizeEntry(entry);\n if (normalized.kind !== 'directory') throw new TypeError('Expected a directory snapshot.');\n return normalized;\n}\n\nfunction normalizeSnapshot(snapshot: FileSystemSnapshot): FileSystemSnapshot {\n if (!isRecord(snapshot) || !Array.isArray(snapshot.entries)) {\n throw new TypeError('Expected a filesystem snapshot object.');\n }\n const version = parseFileSystemVersion(snapshot.version);\n const entries: FileSystemSnapshotEntry[] = snapshot.entries.map((entry) => {\n if (entry.kind === 'file') {\n const file = normalizeFile(entry);\n const data = copyWireBuffer(entry.data);\n if (data.byteLength !== file.size) {\n throw new TypeError('Filesystem snapshot file bytes have the wrong size.');\n }\n return Object.freeze({ ...file, data });\n }\n if (entry.kind === 'directory') return normalizeDirectory(entry);\n throw new TypeError('Unknown filesystem snapshot entry kind.');\n });\n const roots = entries.filter((entry) => entry.path === WORKSPACE_ROOT);\n if (roots.length !== 1 || roots[0]?.kind !== 'directory' || roots[0].version !== version) {\n throw new TypeError('Filesystem snapshot must contain one matching root directory.');\n }\n const seen = new Set<WorkspacePath>();\n for (const entry of entries) {\n if (seen.has(entry.path))\n throw new TypeError('Filesystem snapshot contained a duplicate path.');\n seen.add(entry.path);\n }\n const ordered = [...entries].sort((left, right) => compareText(left.path, right.path));\n if (ordered.some((entry, index) => entry.path !== entries[index]?.path)) {\n throw new TypeError('Filesystem snapshot was not in canonical deterministic order.');\n }\n return Object.freeze({\n version,\n entries: Object.freeze(entries),\n });\n}\n\nfunction normalizeWatchEvent(event: FileSystemWatchEvent): FileSystemWatchEvent {\n if (!isRecord(event)) throw new TypeError('Expected a filesystem watch event object.');\n if (!isPositiveSafeInteger(event.sequence)) {\n throw new TypeError('Filesystem watch sequence must be a positive safe integer.');\n }\n if (!isWatchOrigin(event.origin)) throw new TypeError('Unknown filesystem watch origin.');\n if (typeof event.path !== 'string') throw new TypeError('Watch event path must be a string.');\n const path = parseWorkspacePath(event.path);\n if (event.type === 'overflow') {\n if (\n event.kind !== null ||\n event.destinationPath !== null ||\n event.version !== null ||\n event.previousVersion !== null\n ) {\n throw new TypeError('Filesystem overflow event has entry-specific fields.');\n }\n return Object.freeze({\n sequence: event.sequence,\n origin: event.origin,\n type: 'overflow',\n kind: null,\n path,\n destinationPath: null,\n version: null,\n previousVersion: null,\n });\n }\n if (!isEntryWatchType(event.type)) throw new TypeError('Unknown filesystem watch event type.');\n if (event.kind !== 'file' && event.kind !== 'directory') {\n throw new TypeError('Unknown filesystem watch entry kind.');\n }\n const destinationPath =\n event.destinationPath === null\n ? null\n : typeof event.destinationPath === 'string'\n ? parseWorkspacePath(event.destinationPath)\n : (() => {\n throw new TypeError('Watch destination path must be a string or null.');\n })();\n if ((event.type === 'moved') !== (destinationPath !== null)) {\n throw new TypeError('Only moved watch events may have a destination path.');\n }\n return Object.freeze({\n sequence: event.sequence,\n origin: event.origin,\n type: event.type,\n kind: event.kind,\n path,\n destinationPath,\n version: event.version === null ? null : parseFileSystemVersion(event.version),\n previousVersion:\n event.previousVersion === null ? null : parseFileSystemVersion(event.previousVersion),\n });\n}\n\nfunction normalizeRemoveResult(value: FileSystemRemoveResult): FileSystemRemoveResult {\n if (!isRecord(value) || typeof value.removed !== 'boolean') {\n throw new TypeError('Filesystem transport returned an invalid remove result.');\n }\n return Object.freeze({ removed: value.removed, version: parseFileSystemVersion(value.version) });\n}\n\nfunction assertCapabilities(value: FileSystemProviderCapabilities, operation: FsOperation): void {\n if (!isRecord(value)) {\n throw invalidTransport(operation, 'Filesystem host returned invalid capabilities.');\n }\n for (const key of Object.keys(ELECTRON_FILE_SYSTEM_V2_CAPABILITIES) as Array<\n keyof FileSystemProviderCapabilities\n >) {\n if (value[key] !== ELECTRON_FILE_SYSTEM_V2_CAPABILITIES[key]) {\n throw invalidTransport(operation, `Filesystem host capability mismatch: ${key}.`);\n }\n }\n}\n\nfunction compareDirectoryEntries(\n left: FileSystemEntrySnapshot,\n right: FileSystemEntrySnapshot,\n): number {\n if (left.kind !== right.kind) return left.kind === 'directory' ? -1 : 1;\n return compareText(left.path, right.path);\n}\n\nfunction compareText(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n\nfunction isWatchOrigin(value: unknown): value is FileSystemWatchEvent['origin'] {\n return value === 'local' || value === 'external' || value === 'unknown';\n}\n\nfunction isEntryWatchType(\n value: unknown,\n): value is Exclude<FileSystemWatchEvent['type'], 'overflow'> {\n return value === 'created' || value === 'modified' || value === 'removed' || value === 'moved';\n}\n\nfunction isNonNegativeSafeInteger(value: unknown): value is number {\n return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0;\n}\n\nfunction isPositiveSafeInteger(value: unknown): value is number {\n return isNonNegativeSafeInteger(value) && value > 0;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\nfunction invalidTransport(operation: FsOperation, message: string): FsError {\n return new FsError('io', message, { operation, retryable: false });\n}\n\nfunction transportErrorFromUnknown(error: unknown, operation: FsOperation): FsError {\n if (error instanceof TypeError) return invalidTransport(operation, error.message);\n return withOperation(fsErrorFromUnknown(error, { operation }), operation);\n}\n\nfunction withOperation(error: FsError, operation: FsOperation): FsError {\n if (error.operation === operation) return error;\n return new FsError(error.code, error.message, {\n operation,\n path: error.path ?? undefined,\n destinationPath: error.destinationPath ?? undefined,\n retryable: error.retryable,\n });\n}\n\nfunction copyBytes(data: ArrayBuffer | Uint8Array): ArrayBuffer {\n const source = ArrayBuffer.isView(data)\n ? new Uint8Array(data.buffer, data.byteOffset, data.byteLength)\n : new Uint8Array(data);\n const copy = new Uint8Array(source.byteLength);\n copy.set(source);\n return copy.buffer as ArrayBuffer;\n}\n\nfunction copyWireBuffer(data: ArrayBuffer): ArrayBuffer {\n if (Object.prototype.toString.call(data) !== '[object ArrayBuffer]') {\n throw new TypeError('Expected an ArrayBuffer from the filesystem transport.');\n }\n return data.slice(0);\n}\n\nfunction createInstanceId(): string {\n const randomUUID = globalThis.crypto?.randomUUID;\n if (typeof randomUUID === 'function') return randomUUID.call(globalThis.crypto);\n fallbackInstanceSequence += 1;\n return `electron-fs-v2-${Date.now()}-${fallbackInstanceSequence}`;\n}\n","/**\n * ElectronFileSystemProvider — implements FileSystemProvider by delegating\n * to the Electron desktop host's fs IPC bridge. Every operation is scoped\n * to an opaque workspace id that the main process resolves against its\n * registered workspace authority.\n *\n * This file has no Electron dependency — it is a pure IPC client that\n * relies on the `docBlocksHost` global installed by the preload script.\n */\n\nimport type { FileCommitResult, FileSystemProvider, FileSystemEntry, FileMeta } from './types.js';\nimport { maybeGetDocBlocksHost } from '../host/index.js';\nimport type { DocBlocksHostFsAPI } from '../host/types.js';\nimport { ElectronFileSystemProviderV2 } from './electron-provider-v2.js';\n\nexport { isElectronHost } from '../host/index.js';\n\nfunction getHostFs(): DocBlocksHostFsAPI {\n const host = maybeGetDocBlocksHost();\n if (!host) {\n throw new Error(\n 'ElectronFileSystemProvider: docBlocksHost is not available — not running under Electron?',\n );\n }\n return host.fs;\n}\n\nexport class ElectronFileSystemProvider implements FileSystemProvider {\n readonly id: string;\n readonly label: string;\n readonly v2: ElectronFileSystemProviderV2;\n\n private readonly rootPath: string;\n\n constructor(id: string, label: string, rootPath: string) {\n this.id = id;\n this.label = label;\n this.rootPath = rootPath;\n this.v2 = new ElectronFileSystemProviderV2(id, label, rootPath);\n }\n\n /** Absolute path this provider is rooted at. */\n getRootPath(): string {\n return this.rootPath;\n }\n\n readFile(path: string): Promise<string | null> {\n return getHostFs().readFile(this.id, path);\n }\n\n writeFile(path: string, content: string): Promise<void> {\n return getHostFs().writeFile(this.id, path, content);\n }\n\n commitFile(\n path: string,\n content: string,\n expectedContent: string | null,\n ): Promise<FileCommitResult> {\n return getHostFs().commitFile(this.id, path, content, expectedContent);\n }\n\n delete(path: string): Promise<void> {\n return getHostFs().delete(this.id, path);\n }\n\n rename(oldPath: string, newPath: string): Promise<void> {\n return getHostFs().rename(this.id, oldPath, newPath);\n }\n\n readDirectory(path: string): Promise<FileSystemEntry[]> {\n return getHostFs().readDirectory(this.id, path);\n }\n\n exists(path: string): Promise<boolean> {\n return getHostFs().exists(this.id, path);\n }\n\n createDirectory(path: string): Promise<void> {\n return getHostFs().createDirectory(this.id, path);\n }\n\n stat(path: string): Promise<FileMeta | null> {\n return getHostFs().stat(this.id, path);\n }\n\n readBinary(path: string): Promise<ArrayBuffer | null> {\n return getHostFs().readBinary(this.id, path);\n }\n\n writeBinary(path: string, data: ArrayBuffer | Uint8Array): Promise<void> {\n return getHostFs().writeBinary(this.id, path, data);\n }\n\n /** Subscribe to external change notifications under this root. */\n watch(onChange: (changedPath: string) => void): () => void {\n return getHostFs().watch(this.id, onChange);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA8CA,IAAI,2BAA2B;AAE/B,SAAS,YAAY,WAA8C;AACjE,QAAM,OAAO,sBAAsB;AACnC,MAAI,CAAC,MAAM,MAAM;AACf,UAAM,IAAI,QAAQ,iBAAiB,+CAA+C;AAAA,MAChF;AAAA,IACF,CAAC;AAAA,EACH;AACA,SAAO,KAAK;AACd;AAGO,IAAM,+BAAN,MAAmE;AAAA,EAgBjE,YAAY,IAAY,OAAe,UAAkB;AAbhE,SAAgB,eAAe;AAG/B,SAAiB,aAAa,iBAAiB;AAC/C,SAAiB,WAAW,oBAAI,IAA2B;AAC3D,SAAiB,gBAAgB,oBAAI,IAAiC;AACtE,SAAiB,WAAW,oBAAI,IAAsB;AACtD,SAAQ,cAA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+0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/filesystem/indexeddb-store.ts","../src/filesystem/indexeddb-provider-v2.ts","../src/filesystem/indexeddb-provider.ts","../src/filesystem/indexeddb-content-container.ts"],"sourcesContent":["/**\n * Minimal, error-propagating IndexedDB store used by the virtual filesystem.\n *\n * The previous Squisq LocalForage adapter intentionally converted failed\n * reads/enumerations/removals into null/empty/success. Those semantics are\n * unsuitable for filesystem mutations: an unavailable database must never be\n * interpreted as an absent file. This layer opens the old database and object\n * store directly so existing data can be migrated in one transaction.\n */\n\nexport type IndexedDBFileSystemTransactionMode = 'readonly' | 'readwrite';\n\nexport interface IndexedDBFileSystemTransaction {\n get<T>(key: string): Promise<T | null>;\n put<T>(key: string, value: T): Promise<void>;\n delete(key: string): Promise<void>;\n keys(): Promise<string[]>;\n /** O(log n) namespace probe in the concrete IndexedDB implementation. */\n hasKeyWithPrefix(prefix: string): Promise<boolean>;\n}\n\nexport interface IndexedDBFileSystemStore {\n transaction<T>(\n mode: IndexedDBFileSystemTransactionMode,\n operation: (transaction: IndexedDBFileSystemTransaction) => Promise<T>,\n ): Promise<T>;\n close?(): void;\n}\n\nexport class RawIndexedDBFileSystemStore implements IndexedDBFileSystemStore {\n private database: IDBDatabase | null = null;\n private opening: Promise<IDBDatabase> | null = null;\n private closed = false;\n\n public constructor(\n private readonly databaseName: string,\n private readonly storeName: string,\n ) {}\n\n public async transaction<T>(\n mode: IndexedDBFileSystemTransactionMode,\n operation: (transaction: IndexedDBFileSystemTransaction) => Promise<T>,\n ): Promise<T> {\n const database = await this.getDatabase();\n const nativeTransaction = database.transaction(this.storeName, mode);\n const completion = waitForTransaction(nativeTransaction);\n const transaction = new RawIndexedDBFileSystemTransaction(\n nativeTransaction.objectStore(this.storeName),\n );\n\n let result: T;\n try {\n result = await operation(transaction);\n } catch (error: unknown) {\n try {\n nativeTransaction.abort();\n } catch {\n // The request failure may already have aborted the transaction.\n }\n await completion.catch(() => undefined);\n throw error;\n }\n\n await completion;\n return result;\n }\n\n public close(): void {\n if (this.closed) return;\n this.closed = true;\n this.database?.close();\n this.database = null;\n this.opening = null;\n }\n\n private getDatabase(): Promise<IDBDatabase> {\n if (this.closed) {\n return Promise.reject(new Error('The IndexedDB filesystem store is closed.'));\n }\n if (this.database) return Promise.resolve(this.database);\n if (this.opening) return this.opening;\n if (typeof indexedDB === 'undefined') {\n return Promise.reject(new Error('IndexedDB is not available in this environment.'));\n }\n\n this.opening = openDatabaseWithStore(this.databaseName, this.storeName)\n .then((database) => {\n if (this.closed) {\n database.close();\n throw new Error('The IndexedDB filesystem store is closed.');\n }\n this.database = database;\n this.opening = null;\n database.onversionchange = () => {\n database.close();\n if (this.database === database) this.database = null;\n };\n return database;\n })\n .catch((error: unknown) => {\n this.opening = null;\n throw error;\n });\n return this.opening;\n }\n}\n\nclass RawIndexedDBFileSystemTransaction implements IndexedDBFileSystemTransaction {\n public constructor(private readonly store: IDBObjectStore) {}\n\n public async get<T>(key: string): Promise<T | null> {\n const value = await requestResult(this.store.get(key));\n return value === undefined ? null : (value as T);\n }\n\n public async put<T>(key: string, value: T): Promise<void> {\n await requestResult(this.store.put(value, key));\n }\n\n public async delete(key: string): Promise<void> {\n await requestResult(this.store.delete(key));\n }\n\n public async keys(): Promise<string[]> {\n const keys = await requestResult(this.store.getAllKeys());\n return keys.map((key) => {\n if (typeof key !== 'string') {\n throw new Error('The DocBlocks filesystem store contains a non-string key.');\n }\n return key;\n });\n }\n\n public async hasKeyWithPrefix(prefix: string): Promise<boolean> {\n const cursor = await requestResult(this.store.openKeyCursor(IDBKeyRange.lowerBound(prefix)));\n return cursor !== null && typeof cursor.key === 'string' && cursor.key.startsWith(prefix);\n }\n}\n\nasync function openDatabaseWithStore(\n databaseName: string,\n storeName: string,\n): Promise<IDBDatabase> {\n const database = await openDatabase(databaseName, undefined, (upgradeDatabase) => {\n if (!upgradeDatabase.objectStoreNames.contains(storeName)) {\n upgradeDatabase.createObjectStore(storeName);\n }\n });\n if (database.objectStoreNames.contains(storeName)) return database;\n\n const nextVersion = database.version + 1;\n database.close();\n return openDatabase(databaseName, nextVersion, (upgradeDatabase) => {\n if (!upgradeDatabase.objectStoreNames.contains(storeName)) {\n upgradeDatabase.createObjectStore(storeName);\n }\n });\n}\n\nfunction openDatabase(\n databaseName: string,\n version: number | undefined,\n upgrade: (database: IDBDatabase) => void,\n): Promise<IDBDatabase> {\n return new Promise((resolve, reject) => {\n const request =\n version === undefined ? indexedDB.open(databaseName) : indexedDB.open(databaseName, version);\n let settled = false;\n\n request.onupgradeneeded = () => upgrade(request.result);\n request.onsuccess = () => {\n if (settled) {\n request.result.close();\n return;\n }\n settled = true;\n resolve(request.result);\n };\n request.onerror = () => {\n if (settled) return;\n settled = true;\n reject(request.error ?? new Error(`Could not open IndexedDB database ${databaseName}.`));\n };\n request.onblocked = () => {\n if (settled) return;\n settled = true;\n reject(new Error(`IndexedDB database ${databaseName} is blocked by another open page.`));\n };\n });\n}\n\nfunction requestResult<T>(request: IDBRequest<T>): Promise<T> {\n return new Promise((resolve, reject) => {\n request.onsuccess = () => resolve(request.result);\n request.onerror = () => reject(request.error ?? new Error('IndexedDB request failed.'));\n });\n}\n\nfunction waitForTransaction(transaction: IDBTransaction): Promise<void> {\n return new Promise((resolve, reject) => {\n transaction.oncomplete = () => resolve();\n transaction.onabort = () =>\n reject(transaction.error ?? new Error('IndexedDB transaction was aborted.'));\n transaction.onerror = () =>\n reject(transaction.error ?? new Error('IndexedDB transaction failed.'));\n });\n}\n","import {\n FsError,\n fsErrorFromUnknown,\n type FsErrorCode,\n type FsErrorContext,\n type FsOperation,\n} from './fs-error.js';\nimport { withFileCommitLock } from './commit-lock.js';\nimport {\n RawIndexedDBFileSystemStore,\n type IndexedDBFileSystemStore,\n type IndexedDBFileSystemTransaction,\n type IndexedDBFileSystemTransactionMode,\n} from './indexeddb-store.js';\nimport {\n parseFileSystemVersion,\n type FileSystemCreateDirectoryOptions,\n type FileSystemDirectorySnapshot,\n type FileSystemEntrySnapshot,\n type FileSystemFileRead,\n type FileSystemFileSnapshot,\n type FileSystemMoveOptions,\n type FileSystemProviderCapabilities,\n type FileSystemProviderV2,\n type FileSystemRemoveOptions,\n type FileSystemRemoveResult,\n type FileSystemSnapshot,\n type FileSystemSnapshotEntry,\n type FileSystemVersion,\n type FileSystemWatchListener,\n type FileSystemWatchOptions,\n type FileSystemWatchSubscription,\n type FileSystemWriteOptions,\n} from './v2.js';\nimport {\n WORKSPACE_ROOT,\n parseWorkspacePath,\n workspacePathBasename,\n workspacePathContains,\n workspacePathDirname,\n type WorkspacePath,\n} from './workspace-path.js';\nimport type { FileMeta } from './types.js';\n\nconst ENTRY_SCHEMA_VERSION = 1;\nconst STATE_SCHEMA_VERSION = 1;\nconst LEGACY_CONFLICT_SCHEMA_VERSION = 2;\nconst LEGACY_CONFLICT_SCHEMA_VERSION_V1 = 1;\nconst ENTRY_PREFIX = 'v2:entry:';\nconst STATE_KEY = 'v2:state';\nconst LEGACY_CONFLICT_PREFIX = 'v2:legacy-conflict:';\nconst LEGACY_IGNORED_PREFIX = 'v2:legacy-ignored:';\nconst LEGACY_OPAQUE_PREFIX = 'v2:legacy-opaque:';\nconst LEGACY_DIRS_KEY = 'fs:dirs';\nconst LEGACY_PREFIX = 'fs:';\nconst LEGACY_CONTENT_SUFFIX = ':content';\nconst LEGACY_BINARY_SUFFIX = ':binary';\nconst LEGACY_META_SUFFIX = ':meta';\n\nclass LegacyNamespaceDetectedError extends Error {}\n\nconst INDEXEDDB_V2_CAPABILITIES: FileSystemProviderCapabilities = Object.freeze({\n writeAtomicity: 'cross-context',\n moveAtomicity: 'cross-context',\n snapshotAtomicity: 'cross-context',\n conditionalWrite: 'storage-atomic',\n recursiveRemove: true,\n watch: false,\n caseSensitivity: 'sensitive',\n symlinkPolicy: 'unsupported',\n durability: 'best-effort',\n});\n\ninterface PersistedEntryBase {\n readonly schemaVersion: typeof ENTRY_SCHEMA_VERSION;\n readonly path: WorkspacePath;\n readonly version: string;\n readonly lastModified: string;\n}\n\ninterface PersistedFileEntry extends PersistedEntryBase {\n readonly kind: 'file';\n readonly data: ArrayBuffer;\n}\n\ninterface PersistedDirectoryEntry extends PersistedEntryBase {\n readonly kind: 'directory';\n}\n\ntype PersistedEntry = PersistedFileEntry | PersistedDirectoryEntry;\n\ninterface PersistedState {\n readonly schemaVersion: typeof STATE_SCHEMA_VERSION;\n readonly migrationVersion: 1 | 2;\n readonly mutationCounter: number;\n readonly treeVersion: string;\n}\n\nexport type IndexedDBLegacyConflictReason =\n | 'dual-payload'\n | 'kind-collision'\n | 'authority-collision'\n | 'stale-client-write';\n\nexport type IndexedDBLegacyRecoveryKind = 'file' | 'directory';\n\ninterface PersistedLegacyRecoveryCandidate {\n readonly kind: IndexedDBLegacyRecoveryKind;\n readonly reason: IndexedDBLegacyConflictReason;\n readonly text: string | null;\n readonly binary: ArrayBuffer | null;\n readonly metadata: FileMeta | null;\n readonly detectedAt: string;\n}\n\ninterface PersistedLegacyConflict {\n readonly schemaVersion: typeof LEGACY_CONFLICT_SCHEMA_VERSION;\n readonly path: WorkspacePath;\n readonly candidates: readonly PersistedLegacyRecoveryCandidate[];\n}\n\nexport interface IndexedDBLegacyRecoveryCandidate {\n readonly kind: IndexedDBLegacyRecoveryKind;\n readonly reason: IndexedDBLegacyConflictReason;\n readonly text: string | null;\n readonly binary: ArrayBuffer | null;\n readonly metadata: FileMeta | null;\n readonly detectedAt: string;\n}\n\nexport interface IndexedDBLegacyMigrationConflict {\n readonly path: WorkspacePath;\n /** Backward-compatible projection of the newest quarantined candidate. */\n readonly reason: IndexedDBLegacyConflictReason;\n readonly kind: IndexedDBLegacyRecoveryKind;\n readonly text: string | null;\n readonly binary: ArrayBuffer | null;\n readonly metadata: FileMeta | null;\n readonly detectedAt: string;\n readonly candidates: readonly IndexedDBLegacyRecoveryCandidate[];\n}\n\nexport type IndexedDBLegacyConflictResolution =\n | 'v2'\n | 'text'\n | 'binary'\n | {\n readonly candidate: number;\n readonly payload: 'text' | 'binary' | 'directory';\n };\n\nexport interface IndexedDBFileSystemProviderV2Options {\n /** Injectable store for fault, migration, and concurrency tests. */\n readonly store?: IndexedDBFileSystemStore;\n readonly now?: () => Date;\n /** Shared-store owners can retain the connection when this facade is disposed. */\n readonly closeStoreOnDispose?: boolean;\n}\n\ninterface MutationVersion {\n readonly state: PersistedState;\n readonly version: FileSystemVersion;\n readonly lastModified: string;\n}\n\n/**\n * IndexedDB implementation of the correctness-first filesystem contract.\n *\n * Each canonical path has one authoritative structured-clone record containing\n * its kind, owned bytes (for files), version, and metadata. Every mutation and\n * snapshot is one IndexedDB transaction. Legacy v1 keys are imported once;\n * ambiguous or stale branches move into durable recovery records before the\n * legacy namespace is deleted, leaving one live authority.\n */\nexport class IndexedDBFileSystemProviderV2 implements FileSystemProviderV2 {\n public readonly id: string;\n public readonly label: string;\n public readonly capabilities = INDEXEDDB_V2_CAPABILITIES;\n\n private readonly store: IndexedDBFileSystemStore;\n private readonly now: () => Date;\n private readonly closeStoreOnDispose: boolean;\n private readonly versionPrefix: string;\n private readonly subscriptions = new Set<FileSystemWatchSubscription>();\n private readonly inFlight = new Set<Promise<unknown>>();\n private initialization: Promise<void> | null = null;\n private disposePromise: Promise<void> | null = null;\n private storeClosed = false;\n private disposed = false;\n\n public constructor(\n id: string,\n label: string,\n options: IndexedDBFileSystemProviderV2Options = {},\n ) {\n this.id = id;\n this.label = label;\n this.store = options.store ?? new RawIndexedDBFileSystemStore(`docblocks-fs-${id}`, 'files');\n this.now = options.now ?? (() => new Date());\n this.closeStoreOnDispose = options.closeStoreOnDispose ?? true;\n this.versionPrefix = `idb-${encodeURIComponent(id).slice(0, 900) || 'workspace'}`;\n }\n\n /** Track accepted storage work so disposal can join it before closing. */\n private runSharedTransaction<T>(\n mode: IndexedDBFileSystemTransactionMode,\n operation: FsOperation,\n work: (transaction: IndexedDBFileSystemTransaction) => Promise<T>,\n ): Promise<T> {\n this.assertOpen(operation);\n const transaction = this.store.transaction(mode, work);\n this.inFlight.add(transaction);\n void transaction.then(\n () => this.inFlight.delete(transaction),\n () => this.inFlight.delete(transaction),\n );\n return transaction;\n }\n\n public async stat(path: WorkspacePath): Promise<FileSystemEntrySnapshot | null> {\n this.assertOpen('stat');\n const canonical = parseWorkspacePath(path);\n await this.ensureInitialized('stat');\n return this.transaction('readonly', { operation: 'stat', path: canonical }, async (tx) => {\n const entry = await readEntry(tx, canonical);\n return entry ? toEntrySnapshot(entry) : null;\n });\n }\n\n public async readFile(path: WorkspacePath): Promise<FileSystemFileRead | null> {\n this.assertOpen('read');\n const canonical = parseWorkspacePath(path);\n await this.ensureInitialized('read');\n return this.transaction('readonly', { operation: 'read', path: canonical }, async (tx) => {\n const entry = await readEntry(tx, canonical);\n if (!entry) return null;\n if (entry.kind !== 'file') {\n throw this.error(\n 'type-mismatch',\n 'read',\n canonical,\n 'Expected a file but found a directory.',\n );\n }\n return Object.freeze({ entry: toFileSnapshot(entry), data: copyBytes(entry.data) });\n });\n }\n\n public async readDirectory(path: WorkspacePath): Promise<readonly FileSystemEntrySnapshot[]> {\n this.assertOpen('list');\n const canonical = parseWorkspacePath(path);\n await this.ensureInitialized('list');\n return this.transaction('readonly', { operation: 'list', path: canonical }, async (tx) => {\n const directory = await readEntry(tx, canonical);\n if (!directory) {\n throw this.error('not-found', 'list', canonical, 'Directory does not exist.');\n }\n if (directory.kind !== 'directory') {\n throw this.error(\n 'type-mismatch',\n 'list',\n canonical,\n 'Expected a directory but found a file.',\n );\n }\n const paths = await listEntryPaths(tx);\n const children: FileSystemEntrySnapshot[] = [];\n for (const candidate of paths) {\n if (candidate && workspacePathDirname(candidate) === canonical) {\n const entry = await readRequiredEntry(tx, candidate);\n children.push(toEntrySnapshot(entry));\n }\n }\n children.sort(compareSnapshots);\n return Object.freeze(children);\n });\n }\n\n public async writeFile(\n path: WorkspacePath,\n data: ArrayBuffer | Uint8Array,\n options: FileSystemWriteOptions = {},\n ): Promise<FileSystemFileSnapshot> {\n this.assertOpen('write');\n const canonical = this.canonicalNonRoot(path, 'write');\n const ownedData = copyBytes(data);\n await this.ensureInitialized('write');\n return this.withMutationLock(() =>\n this.transaction('readwrite', { operation: 'write', path: canonical }, async (tx) => {\n await assertNoLegacyConflict(tx, canonical, 'write');\n const mutation = new EntryMutation(tx);\n const existing = await mutation.get(canonical);\n if (existing?.kind === 'directory') {\n throw this.error(\n 'type-mismatch',\n 'write',\n canonical,\n 'Cannot replace a directory with a file.',\n );\n }\n const mode = options.mode ?? 'upsert';\n if (mode === 'create' && existing) {\n throw this.error('already-exists', 'write', canonical, 'File already exists.');\n }\n if (mode === 'replace' && !existing) {\n throw this.error('not-found', 'write', canonical, 'File does not exist.');\n }\n this.assertExpectedVersion(existing, options.expectedVersion, 'write', canonical);\n const missingParents = await this.planParents(\n mutation,\n canonical,\n options.createParents ?? false,\n 'write',\n );\n const next = await this.nextMutationVersion(tx);\n this.addDirectories(mutation, missingParents, next);\n const file: PersistedFileEntry = {\n schemaVersion: ENTRY_SCHEMA_VERSION,\n kind: 'file',\n path: canonical,\n data: ownedData,\n version: next.version,\n lastModified: next.lastModified,\n };\n mutation.set(canonical, file);\n await this.touchParents(mutation, canonical, next);\n await mutation.commit(next.state);\n return toFileSnapshot(file);\n }),\n );\n }\n\n public async createDirectory(\n path: WorkspacePath,\n options: FileSystemCreateDirectoryOptions = {},\n ): Promise<FileSystemDirectorySnapshot> {\n this.assertOpen('create-directory');\n const canonical = parseWorkspacePath(path);\n await this.ensureInitialized('create-directory');\n return this.withMutationLock(() =>\n this.transaction(\n 'readwrite',\n { operation: 'create-directory', path: canonical },\n async (tx) => {\n await assertNoLegacyConflict(tx, canonical, 'create-directory');\n const mutation = new EntryMutation(tx);\n const existing = await mutation.get(canonical);\n if (existing) {\n if (existing.kind !== 'directory') {\n throw this.error(\n 'type-mismatch',\n 'create-directory',\n canonical,\n 'Cannot replace a file with a directory.',\n );\n }\n if ((options.mode ?? 'ensure') === 'create') {\n throw this.error(\n 'already-exists',\n 'create-directory',\n canonical,\n 'Directory already exists.',\n );\n }\n return toDirectorySnapshot(existing);\n }\n const missingParents = await this.planParents(\n mutation,\n canonical,\n options.createParents ?? false,\n 'create-directory',\n );\n const next = await this.nextMutationVersion(tx);\n this.addDirectories(mutation, [...missingParents, canonical], next);\n await this.touchParents(mutation, canonical, next);\n await mutation.commit(next.state);\n const created = await mutation.get(canonical);\n if (!created || created.kind !== 'directory') {\n throw corrupt('Created directory was not staged.', canonical);\n }\n return toDirectorySnapshot(created);\n },\n ),\n );\n }\n\n public async remove(\n path: WorkspacePath,\n options: FileSystemRemoveOptions = {},\n ): Promise<FileSystemRemoveResult> {\n this.assertOpen('remove');\n const canonical = this.canonicalNonRoot(path, 'remove');\n await this.ensureInitialized('remove');\n return this.withMutationLock(() =>\n this.transaction('readwrite', { operation: 'remove', path: canonical }, async (tx) => {\n const mutation = new EntryMutation(tx);\n const existing = await mutation.get(canonical);\n const state = await readRequiredState(tx);\n if (!existing) {\n if ((options.missing ?? 'error') === 'ignore') {\n return Object.freeze({\n removed: false,\n version: parseFileSystemVersion(state.treeVersion),\n });\n }\n throw this.error('not-found', 'remove', canonical, 'Entry does not exist.');\n }\n this.assertExpectedVersion(existing, options.expectedVersion, 'remove', canonical);\n const paths = await mutation.paths();\n const descendants = paths.filter((candidate) =>\n workspacePathContains(canonical, candidate, false),\n );\n if (existing.kind === 'directory' && descendants.length > 0 && !options.recursive) {\n throw this.error('not-empty', 'remove', canonical, 'Directory is not empty.');\n }\n const next = this.advanceState(state);\n mutation.delete(canonical);\n if (existing.kind === 'directory') {\n for (const descendant of descendants) mutation.delete(descendant);\n }\n await this.touchParents(mutation, canonical, next);\n await mutation.commit(next.state);\n return Object.freeze({ removed: true, version: next.version });\n }),\n );\n }\n\n public async move(\n oldPath: WorkspacePath,\n newPath: WorkspacePath,\n options: FileSystemMoveOptions = {},\n ): Promise<FileSystemEntrySnapshot> {\n this.assertOpen('move');\n const sourcePath = this.canonicalNonRoot(oldPath, 'move');\n const destinationPath = this.canonicalNonRoot(newPath, 'move');\n await this.ensureInitialized('move');\n return this.withMutationLock(() =>\n this.transaction(\n 'readwrite',\n { operation: 'move', path: sourcePath, destinationPath },\n async (tx) => {\n await assertNoLegacyConflict(tx, sourcePath, 'move');\n await assertNoLegacyConflict(tx, destinationPath, 'move');\n const mutation = new EntryMutation(tx);\n const source = await mutation.get(sourcePath);\n if (!source) {\n throw this.error('not-found', 'move', sourcePath, 'Source does not exist.');\n }\n this.assertExpectedVersion(source, options.expectedVersion, 'move', sourcePath);\n if (sourcePath === destinationPath) return toEntrySnapshot(source);\n if (await mutation.get(destinationPath)) {\n throw new FsError('already-exists', 'Destination already exists.', {\n operation: 'move',\n path: sourcePath,\n destinationPath,\n });\n }\n if (\n source.kind === 'directory' &&\n workspacePathContains(sourcePath, destinationPath, false)\n ) {\n throw new FsError('invalid-path', 'Cannot move a directory into itself.', {\n operation: 'move',\n path: sourcePath,\n destinationPath,\n });\n }\n const missingParents = await this.planParents(\n mutation,\n destinationPath,\n options.createParents ?? false,\n 'move',\n );\n const paths = await mutation.paths();\n const sourcePaths = paths.filter((candidate) =>\n workspacePathContains(sourcePath, candidate),\n );\n const sourceSet = new Set(sourcePaths);\n const remapped: Array<readonly [WorkspacePath, WorkspacePath, PersistedEntry]> = [];\n for (const currentPath of sourcePaths) {\n const suffix = currentPath.slice(sourcePath.length);\n const targetPath = parseWorkspacePath(`${destinationPath}${suffix}`);\n const collision = await mutation.get(targetPath);\n if (collision && !sourceSet.has(targetPath)) {\n throw new FsError('already-exists', 'A destination descendant already exists.', {\n operation: 'move',\n path: currentPath,\n destinationPath: targetPath,\n });\n }\n remapped.push([currentPath, targetPath, await mutation.require(currentPath)]);\n }\n const state = await readRequiredState(tx);\n const next = this.advanceState(state);\n for (const currentPath of sourcePaths) mutation.delete(currentPath);\n this.addDirectories(mutation, missingParents, next);\n for (const [, targetPath, current] of remapped) {\n mutation.set(targetPath, withPathAndVersion(current, targetPath, next));\n }\n await this.touchParents(mutation, sourcePath, next);\n await this.touchParents(mutation, destinationPath, next);\n await mutation.commit(next.state);\n return toEntrySnapshot(await mutation.require(destinationPath));\n },\n ),\n );\n }\n\n public async snapshot(): Promise<FileSystemSnapshot> {\n this.assertOpen('snapshot');\n await this.ensureInitialized('snapshot');\n return this.transaction('readonly', { operation: 'snapshot' }, async (tx) => {\n const [state, paths] = await Promise.all([readRequiredState(tx), listEntryPaths(tx)]);\n const entries: FileSystemSnapshotEntry[] = [];\n for (const path of paths.sort(compareText)) {\n const entry = await readRequiredEntry(tx, path);\n entries.push(\n entry.kind === 'file'\n ? Object.freeze({ ...toFileSnapshot(entry), data: copyBytes(entry.data) })\n : toDirectorySnapshot(entry),\n );\n }\n return Object.freeze({\n version: parseFileSystemVersion(state.treeVersion),\n entries: Object.freeze(entries),\n });\n });\n }\n\n /** IndexedDB has no reliable cross-browser external-change observer. */\n public watch(\n _listener: FileSystemWatchListener,\n options: FileSystemWatchOptions = {},\n ): FileSystemWatchSubscription {\n this.assertOpen('watch');\n const error = new FsError('not-supported', 'IndexedDB filesystem watching is unavailable.', {\n operation: 'watch',\n });\n let closed = false;\n let disposePromise: Promise<void> | null = null;\n const ready = Promise.reject(error);\n void ready.catch((caught: FsError) => {\n try {\n options.onError?.(caught);\n } catch {\n // An observational error callback cannot change subscription state.\n }\n });\n const subscription: FileSystemWatchSubscription = {\n get closed() {\n return closed;\n },\n ready,\n dispose: () => {\n if (disposePromise) return disposePromise;\n closed = true;\n this.subscriptions.delete(subscription);\n disposePromise = Promise.resolve();\n return disposePromise;\n },\n };\n this.subscriptions.add(subscription);\n return subscription;\n }\n\n public dispose(): Promise<void> {\n if (this.disposePromise) return this.disposePromise;\n this.disposed = true;\n this.disposePromise = (async () => {\n try {\n await Promise.allSettled([...this.inFlight]);\n await Promise.all([...this.subscriptions].map((subscription) => subscription.dispose()));\n } finally {\n if (this.closeStoreOnDispose && !this.storeClosed) {\n this.storeClosed = true;\n this.store.close?.();\n }\n }\n })();\n return this.disposePromise;\n }\n\n /** List unresolved, byte-preserving conflicts found during v1 migration. */\n public async listLegacyMigrationConflicts(): Promise<\n readonly IndexedDBLegacyMigrationConflict[]\n > {\n this.assertOpen('read');\n await this.ensureInitialized('read');\n return this.transaction('readonly', { operation: 'read' }, async (tx) => {\n const keys = (await tx.keys()).filter((key) => key.startsWith(LEGACY_CONFLICT_PREFIX));\n const conflicts: IndexedDBLegacyMigrationConflict[] = [];\n for (const key of keys) {\n const raw = await tx.get<unknown>(key);\n conflicts.push(toPublicLegacyConflict(validateLegacyConflict(raw)));\n }\n conflicts.sort((left, right) => compareText(left.path, right.path));\n return Object.freeze(conflicts);\n });\n }\n\n /** Resolve quarantined legacy data by choosing v2 or one legacy byte payload. */\n public async resolveLegacyMigrationConflict(\n path: WorkspacePath,\n resolution: IndexedDBLegacyConflictResolution,\n ): Promise<FileSystemEntrySnapshot> {\n this.assertOpen('write');\n const canonical = this.canonicalNonRoot(path, 'write');\n await this.ensureInitialized('write');\n return this.withMutationLock(() =>\n this.transaction('readwrite', { operation: 'write', path: canonical }, async (tx) => {\n const key = legacyConflictKey(canonical);\n const conflict = validateLegacyConflict(await tx.get<unknown>(key));\n if (conflict.path !== canonical) throw corrupt('Legacy conflict key mismatch.', canonical);\n const mutation = new EntryMutation(tx);\n const existing = await mutation.get(canonical);\n if (resolution === 'v2') {\n if (!existing) {\n throw this.error(\n 'type-mismatch',\n 'write',\n canonical,\n 'There is no v2 authority to keep at this path.',\n );\n }\n await tx.delete(key);\n return toEntrySnapshot(existing);\n }\n\n const selected = selectLegacyPayload(conflict, resolution, canonical);\n if (selected.kind === 'directory') {\n if (existing?.kind === 'file') {\n throw this.error(\n 'type-mismatch',\n 'write',\n canonical,\n 'Move or remove the v2 file before restoring a legacy directory at this path.',\n );\n }\n if (existing) {\n await tx.delete(key);\n return toDirectorySnapshot(existing);\n }\n const missingParents = await this.planParents(mutation, canonical, true, 'write');\n const next = await this.nextMutationVersion(tx);\n this.addDirectories(mutation, [...missingParents, canonical], next);\n await this.touchParents(mutation, canonical, next);\n await mutation.commit(next.state);\n await tx.delete(key);\n const restored = await mutation.require(canonical);\n if (restored.kind !== 'directory') {\n throw corrupt('Restored legacy directory was not staged as a directory.', canonical);\n }\n return toDirectorySnapshot(restored);\n }\n if (existing?.kind === 'directory') {\n throw this.error(\n 'type-mismatch',\n 'write',\n canonical,\n 'Move or remove the v2 directory before restoring a legacy file at this path.',\n );\n }\n const missingParents = await this.planParents(mutation, canonical, true, 'write');\n const next = await this.nextMutationVersion(tx);\n this.addDirectories(mutation, missingParents, next);\n const file: PersistedFileEntry = {\n schemaVersion: ENTRY_SCHEMA_VERSION,\n kind: 'file',\n path: canonical,\n data: copyBytes(selected.data),\n version: next.version,\n lastModified: next.lastModified,\n };\n mutation.set(canonical, file);\n await this.touchParents(mutation, canonical, next);\n await mutation.commit(next.state);\n await tx.delete(key);\n return toFileSnapshot(file);\n }),\n );\n }\n\n /** Explicitly discard every quarantined legacy candidate at a path. */\n public async discardLegacyMigrationConflict(path: WorkspacePath): Promise<boolean> {\n this.assertOpen('remove');\n const canonical = this.canonicalNonRoot(path, 'remove');\n await this.ensureInitialized('remove');\n return this.withMutationLock(() =>\n this.transaction('readwrite', { operation: 'remove', path: canonical }, async (tx) => {\n const key = legacyConflictKey(canonical);\n if ((await tx.get<unknown>(key)) === null) return false;\n await tx.delete(key);\n return true;\n }),\n );\n }\n\n private async ensureInitialized(operation: FsOperation): Promise<void> {\n this.assertOpen(operation);\n if (this.initialization) return this.initialization;\n const attempt = this.withMutationLock(() =>\n this.runSharedTransaction('readwrite', operation, (tx) => this.migrateLegacy(tx)),\n );\n this.initialization = attempt.catch((error: unknown) => {\n this.initialization = null;\n throw fsErrorFromUnknown(error, { operation });\n });\n return this.initialization;\n }\n\n private async migrateLegacy(tx: IndexedDBFileSystemTransaction): Promise<void> {\n const existingState = await readState(tx);\n const keys = await tx.keys();\n if (existingState) {\n const root = await readEntry(tx, WORKSPACE_ROOT);\n if (!root || root.kind !== 'directory') {\n throw corrupt('Initialized v2 filesystem has no root directory.', WORKSPACE_ROOT);\n }\n if (\n existingState.migrationVersion === 1 ||\n keys.some((key) => key.startsWith(LEGACY_PREFIX))\n ) {\n await this.quarantineExistingLegacy(\n tx,\n keys,\n existingState,\n existingState.migrationVersion === 1 ? 'authority-collision' : 'stale-client-write',\n );\n }\n return;\n }\n\n const now = this.now().toISOString();\n const version = this.makeVersion(1);\n const entries = new Map<WorkspacePath, PersistedEntry>();\n\n // Preserve any authoritative v2 records left by a pre-release build.\n for (const path of entryPathsFromKeys(keys)) {\n entries.set(path, await readRequiredEntry(tx, path));\n }\n if (entries.get(WORKSPACE_ROOT)?.kind === 'file') {\n throw corrupt(\n 'Pre-release v2 authority stored a file at the workspace root.',\n WORKSPACE_ROOT,\n );\n }\n entries.set(\n WORKSPACE_ROOT,\n entries.get(WORKSPACE_ROOT) ?? directoryRecord(WORKSPACE_ROOT, version, now),\n );\n\n const legacyDirectories = await readLegacyDirectories(tx);\n const legacyFilePaths = legacyPathsFromKeys(keys);\n for (const directory of legacyDirectories) {\n const existing = entries.get(directory);\n if (existing?.kind === 'file' || hasFileAncestor(entries, directory)) {\n await appendLegacyConflict(\n tx,\n directory,\n directoryRecoveryCandidate('authority-collision', now),\n );\n continue;\n }\n addParentDirectories(entries, directory, version, now);\n if (!existing) entries.set(directory, directoryRecord(directory, version, now));\n }\n\n for (const path of legacyFilePaths) {\n const legacy = await readLegacyFile(tx, path);\n const existing = entries.get(path);\n if (existing?.kind === 'file') {\n if (!legacyPayloadsMatchEntry(legacy, existing)) {\n await appendLegacyConflict(\n tx,\n path,\n fileRecoveryCandidate(legacy, 'authority-collision', now),\n );\n }\n continue;\n }\n const kindCollision = existing?.kind === 'directory' || hasFileAncestor(entries, path);\n const payloadsDisagree =\n legacy.content !== null &&\n legacy.binary !== null &&\n !bytesEqual(new TextEncoder().encode(legacy.content), legacy.binary);\n if (\n payloadsDisagree ||\n kindCollision ||\n (legacy.content === null && legacy.binary === null)\n ) {\n await appendLegacyConflict(\n tx,\n path,\n fileRecoveryCandidate(\n legacy,\n kindCollision\n ? 'kind-collision'\n : payloadsDisagree\n ? 'dual-payload'\n : 'authority-collision',\n now,\n ),\n );\n continue;\n }\n addParentDirectories(entries, path, version, now);\n const data =\n legacy.content !== null\n ? new TextEncoder().encode(legacy.content).buffer\n : copyBytes(legacy.binary!);\n entries.set(path, {\n schemaVersion: ENTRY_SCHEMA_VERSION,\n kind: 'file',\n path,\n data: copyBytes(data),\n version,\n lastModified: legacy.metadata?.lastModified ?? now,\n });\n }\n\n for (const entry of entries.values()) {\n await tx.put(entryKey(entry.path), entry);\n }\n await deleteLegacyNamespace(tx, keys);\n const state: PersistedState = {\n schemaVersion: STATE_SCHEMA_VERSION,\n migrationVersion: 2,\n mutationCounter: 1,\n treeVersion: version,\n };\n await tx.put(STATE_KEY, state);\n }\n\n private async quarantineExistingLegacy(\n tx: IndexedDBFileSystemTransaction,\n keys: readonly string[],\n state: PersistedState,\n reason: 'authority-collision' | 'stale-client-write',\n ): Promise<void> {\n const now = this.now().toISOString();\n const ignored = await readMarkerPaths(\n tx,\n keys,\n LEGACY_IGNORED_PREFIX,\n validateIgnoredLegacyPath,\n );\n const legacyDirectories = await readLegacyDirectories(tx);\n for (const path of legacyDirectories) {\n if (ignored.has(path)) continue;\n const entry = await readEntry(tx, path);\n if (entry?.kind === 'directory') continue;\n await appendLegacyConflict(\n tx,\n path,\n directoryRecoveryCandidate(entry ? 'kind-collision' : reason, now),\n );\n }\n\n for (const path of legacyPathsFromKeys(keys)) {\n if (ignored.has(path)) continue;\n const legacy = await readLegacyFile(tx, path);\n const entry = await readEntry(tx, path);\n if (entry?.kind === 'file' && legacyPayloadsMatchEntry(legacy, entry)) continue;\n await appendLegacyConflict(\n tx,\n path,\n fileRecoveryCandidate(legacy, entry?.kind === 'directory' ? 'kind-collision' : reason, now),\n );\n }\n\n await deleteLegacyNamespace(tx, keys);\n for (const key of keys) {\n if (key.startsWith(LEGACY_IGNORED_PREFIX)) await tx.delete(key);\n }\n if (state.migrationVersion === 1) {\n await tx.put(STATE_KEY, { ...state, migrationVersion: 2 } satisfies PersistedState);\n }\n }\n\n private async transaction<T>(\n mode: IndexedDBFileSystemTransactionMode,\n context: FsErrorContext,\n operation: (transaction: IndexedDBFileSystemTransaction) => Promise<T>,\n ): Promise<T> {\n this.assertOpen(context.operation ?? 'read');\n for (let attempt = 0; attempt < 3; attempt += 1) {\n try {\n const outcome = await this.runSharedTransaction(\n mode,\n context.operation ?? 'read',\n async (transaction) => {\n if (await transaction.hasKeyWithPrefix(LEGACY_PREFIX)) {\n if (mode === 'readonly') throw new LegacyNamespaceDetectedError();\n const state = await readRequiredState(transaction);\n await this.quarantineExistingLegacy(\n transaction,\n await transaction.keys(),\n state,\n 'stale-client-write',\n );\n return { retry: true as const };\n }\n return { retry: false as const, value: await operation(transaction) };\n },\n );\n if (outcome.retry) continue;\n return outcome.value;\n } catch (error: unknown) {\n if (!(error instanceof LegacyNamespaceDetectedError)) {\n throw fsErrorFromUnknown(error, context);\n }\n try {\n await this.withMutationLock(() =>\n this.runSharedTransaction(\n 'readwrite',\n context.operation ?? 'read',\n async (transaction) => {\n if (!(await transaction.hasKeyWithPrefix(LEGACY_PREFIX))) return;\n const state = await readRequiredState(transaction);\n await this.quarantineExistingLegacy(\n transaction,\n await transaction.keys(),\n state,\n 'stale-client-write',\n );\n },\n ),\n );\n } catch (quarantineError: unknown) {\n throw fsErrorFromUnknown(quarantineError, context);\n }\n }\n }\n throw new FsError('busy', 'A stale IndexedDB client is continuously writing legacy records.', {\n ...context,\n retryable: true,\n });\n }\n\n private withMutationLock<T>(operation: () => Promise<T>): Promise<T> {\n return withFileCommitLock(`indexeddb:${this.id}:workspace`, operation);\n }\n\n private async nextMutationVersion(tx: IndexedDBFileSystemTransaction): Promise<MutationVersion> {\n return this.advanceState(await readRequiredState(tx));\n }\n\n private advanceState(state: PersistedState): MutationVersion {\n if (state.mutationCounter >= Number.MAX_SAFE_INTEGER) {\n throw corrupt('IndexedDB filesystem mutation counter overflowed.');\n }\n const mutationCounter = state.mutationCounter + 1;\n const version = this.makeVersion(mutationCounter);\n const nextState: PersistedState = {\n ...state,\n mutationCounter,\n treeVersion: version,\n };\n return { state: nextState, version, lastModified: this.now().toISOString() };\n }\n\n private makeVersion(counter: number): FileSystemVersion {\n return parseFileSystemVersion(`${this.versionPrefix}:${counter}`);\n }\n\n private async planParents(\n mutation: EntryMutation,\n path: WorkspacePath,\n createParents: boolean,\n operation: FsOperation,\n ): Promise<WorkspacePath[]> {\n const missing: WorkspacePath[] = [];\n for (const parent of parentChain(path)) {\n const entry = await mutation.get(parent);\n if (entry?.kind === 'file') {\n throw this.error(\n 'type-mismatch',\n operation,\n parent,\n 'A parent path is a file, not a directory.',\n );\n }\n if (!entry) {\n if (!createParents) {\n throw this.error('not-found', operation, parent, 'Parent directory does not exist.');\n }\n missing.push(parent);\n }\n }\n return missing;\n }\n\n private addDirectories(\n mutation: EntryMutation,\n paths: readonly WorkspacePath[],\n next: MutationVersion,\n ): void {\n for (const path of paths) {\n mutation.set(path, directoryRecord(path, next.version, next.lastModified));\n }\n }\n\n private async touchParents(\n mutation: EntryMutation,\n path: WorkspacePath,\n next: MutationVersion,\n ): Promise<void> {\n for (const parent of parentChain(path)) {\n const entry = await mutation.get(parent);\n if (entry?.kind === 'directory') {\n mutation.set(parent, directoryRecord(parent, next.version, next.lastModified));\n }\n }\n }\n\n private canonicalNonRoot(path: WorkspacePath, operation: FsOperation): WorkspacePath {\n const canonical = parseWorkspacePath(path);\n if (!canonical) {\n throw this.error(\n 'invalid-path',\n operation,\n canonical,\n 'The workspace root is not a file entry.',\n );\n }\n return canonical;\n }\n\n private assertExpectedVersion(\n entry: PersistedEntry | null,\n expected: FileSystemVersion | null | undefined,\n operation: FsOperation,\n path: WorkspacePath,\n ): void {\n if (expected === undefined) return;\n if (expected === null ? !entry : entry?.version === expected) return;\n throw this.error(\n 'conflict',\n operation,\n path,\n 'Entry version does not match the expected version.',\n );\n }\n\n private assertOpen(operation: FsOperation): void {\n if (!this.disposed) return;\n throw new FsError('disposed', 'Filesystem provider is disposed.', { operation });\n }\n\n private error(\n code: FsErrorCode,\n operation: FsOperation,\n path: WorkspacePath,\n message: string,\n ): FsError {\n return new FsError(code, message, { operation, path });\n }\n}\n\nclass EntryMutation {\n private readonly cache = new Map<WorkspacePath, PersistedEntry | null>();\n private readonly changed = new Map<WorkspacePath, PersistedEntry>();\n private readonly deleted = new Set<WorkspacePath>();\n\n public constructor(private readonly transaction: IndexedDBFileSystemTransaction) {}\n\n public async get(path: WorkspacePath): Promise<PersistedEntry | null> {\n if (this.deleted.has(path)) return null;\n const cached = this.cache.get(path);\n if (cached !== undefined) return cached;\n const entry = await readEntry(this.transaction, path);\n this.cache.set(path, entry);\n return entry;\n }\n\n public async require(path: WorkspacePath): Promise<PersistedEntry> {\n const entry = await this.get(path);\n if (!entry) throw corrupt(`Missing staged entry: ${path}.`, path);\n return entry;\n }\n\n public set(path: WorkspacePath, entry: PersistedEntry): void {\n const owned = copyEntry(entry);\n this.cache.set(path, owned);\n this.changed.set(path, owned);\n this.deleted.delete(path);\n }\n\n public delete(path: WorkspacePath): void {\n this.cache.set(path, null);\n this.changed.delete(path);\n this.deleted.add(path);\n }\n\n public async paths(): Promise<WorkspacePath[]> {\n const paths = new Set(await listEntryPaths(this.transaction));\n for (const path of this.deleted) paths.delete(path);\n for (const path of this.changed.keys()) paths.add(path);\n return [...paths];\n }\n\n public async commit(state: PersistedState): Promise<void> {\n for (const path of this.deleted) await this.transaction.delete(entryKey(path));\n for (const [path, entry] of this.changed) await this.transaction.put(entryKey(path), entry);\n await this.transaction.put(STATE_KEY, state);\n }\n}\n\nfunction entryKey(path: WorkspacePath): string {\n return `${ENTRY_PREFIX}${path}`;\n}\n\nfunction legacyConflictKey(path: WorkspacePath): string {\n return `${LEGACY_CONFLICT_PREFIX}${path}`;\n}\n\nfunction entryPathsFromKeys(keys: readonly string[]): WorkspacePath[] {\n return keys\n .filter((key) => key.startsWith(ENTRY_PREFIX))\n .map((key) => {\n const rawPath = key.slice(ENTRY_PREFIX.length);\n const path = parseWorkspacePath(rawPath);\n if (path !== rawPath) throw corrupt(`Non-canonical v2 entry key: ${key}.`);\n return path;\n });\n}\n\nasync function listEntryPaths(tx: IndexedDBFileSystemTransaction): Promise<WorkspacePath[]> {\n return entryPathsFromKeys(await tx.keys());\n}\n\nasync function readEntry(\n tx: IndexedDBFileSystemTransaction,\n path: WorkspacePath,\n): Promise<PersistedEntry | null> {\n const raw = await tx.get<unknown>(entryKey(path));\n return raw === null ? null : validateEntry(raw, path);\n}\n\nasync function readRequiredEntry(\n tx: IndexedDBFileSystemTransaction,\n path: WorkspacePath,\n): Promise<PersistedEntry> {\n const entry = await readEntry(tx, path);\n if (!entry) throw corrupt(`Missing v2 entry record: ${path}.`, path);\n return entry;\n}\n\nfunction validateEntry(value: unknown, expectedPath: WorkspacePath): PersistedEntry {\n if (!isRecord(value)) throw corrupt(`Corrupt v2 entry record: ${expectedPath}.`, expectedPath);\n const path = parseWorkspacePath(readString(value.path, 'entry path'));\n if (path !== expectedPath) throw corrupt(`V2 entry path does not match key: ${expectedPath}.`);\n if (value.schemaVersion !== ENTRY_SCHEMA_VERSION) {\n throw corrupt(`Unsupported v2 entry schema at ${expectedPath}.`, expectedPath);\n }\n const version = parseFileSystemVersion(value.version);\n const lastModified = readString(value.lastModified, 'lastModified');\n if (value.kind === 'directory') {\n return { schemaVersion: ENTRY_SCHEMA_VERSION, kind: 'directory', path, version, lastModified };\n }\n if (value.kind !== 'file') throw corrupt(`Unknown entry kind at ${expectedPath}.`, expectedPath);\n return {\n schemaVersion: ENTRY_SCHEMA_VERSION,\n kind: 'file',\n path,\n version,\n lastModified,\n data: validateBytes(value.data, expectedPath),\n };\n}\n\nasync function readState(tx: IndexedDBFileSystemTransaction): Promise<PersistedState | null> {\n const raw = await tx.get<unknown>(STATE_KEY);\n return raw === null ? null : validateState(raw);\n}\n\nasync function readRequiredState(tx: IndexedDBFileSystemTransaction): Promise<PersistedState> {\n const state = await readState(tx);\n if (!state) throw corrupt('IndexedDB v2 state record is missing.');\n return state;\n}\n\nfunction validateState(value: unknown): PersistedState {\n if (\n !isRecord(value) ||\n value.schemaVersion !== STATE_SCHEMA_VERSION ||\n (value.migrationVersion !== 1 && value.migrationVersion !== 2) ||\n typeof value.mutationCounter !== 'number' ||\n !Number.isSafeInteger(value.mutationCounter) ||\n value.mutationCounter < 0\n ) {\n throw corrupt('IndexedDB v2 state record is corrupt.');\n }\n return {\n schemaVersion: STATE_SCHEMA_VERSION,\n migrationVersion: value.migrationVersion,\n mutationCounter: value.mutationCounter,\n treeVersion: parseFileSystemVersion(value.treeVersion),\n };\n}\n\nasync function readLegacyDirectories(tx: IndexedDBFileSystemTransaction): Promise<WorkspacePath[]> {\n const raw = await tx.get<unknown>(LEGACY_DIRS_KEY);\n if (raw === null) return [];\n if (!Array.isArray(raw)) throw corrupt('Legacy directory index is corrupt.');\n const directories: WorkspacePath[] = [];\n for (const value of raw) {\n if (typeof value !== 'string') throw corrupt('Legacy directory index is corrupt.');\n const path = parseWorkspacePath(value);\n if (path) directories.push(path);\n }\n return directories;\n}\n\nfunction legacyPathsFromKeys(keys: readonly string[]): WorkspacePath[] {\n const paths = new Set<WorkspacePath>();\n for (const key of keys) {\n if (!key.startsWith(LEGACY_PREFIX) || key === LEGACY_DIRS_KEY) continue;\n const suffix = [LEGACY_CONTENT_SUFFIX, LEGACY_BINARY_SUFFIX, LEGACY_META_SUFFIX].find(\n (candidate) => key.endsWith(candidate),\n );\n if (!suffix) continue;\n const rawPath = key.slice(LEGACY_PREFIX.length, -suffix.length);\n try {\n const path = parseWorkspacePath(rawPath);\n if (path) paths.add(path);\n } catch {\n // Invalid legacy keys remain untouched. They are not valid v2 paths.\n }\n }\n return [...paths];\n}\n\nasync function readLegacyFile(\n tx: IndexedDBFileSystemTransaction,\n path: WorkspacePath,\n): Promise<{ content: string | null; binary: ArrayBuffer | null; metadata: FileMeta | null }> {\n const [rawContent, rawBinary, rawMetadata] = await Promise.all([\n tx.get<unknown>(`${LEGACY_PREFIX}${path}${LEGACY_CONTENT_SUFFIX}`),\n tx.get<unknown>(`${LEGACY_PREFIX}${path}${LEGACY_BINARY_SUFFIX}`),\n tx.get<unknown>(`${LEGACY_PREFIX}${path}${LEGACY_META_SUFFIX}`),\n ]);\n if (rawContent !== null && typeof rawContent !== 'string') {\n throw corrupt(`Legacy text payload is corrupt: ${path}.`, path);\n }\n return {\n content: rawContent,\n binary: rawBinary === null ? null : validateBytes(rawBinary, path),\n metadata: validateLegacyMetadata(rawMetadata, path),\n };\n}\n\nasync function readMarkerPaths(\n transaction: IndexedDBFileSystemTransaction,\n keys: readonly string[],\n prefix: string,\n validate: (value: unknown) => WorkspacePath,\n): Promise<Set<WorkspacePath>> {\n const paths = new Set<WorkspacePath>();\n for (const key of keys) {\n if (!key.startsWith(prefix)) continue;\n const expectedPath = parseWorkspacePath(key.slice(prefix.length));\n if (!expectedPath) throw corrupt(`Recovery marker cannot target the workspace root: ${key}.`);\n const value = await transaction.get<unknown>(key);\n const path = validate(value);\n if (path !== expectedPath)\n throw corrupt(`Recovery marker path does not match its key: ${key}.`);\n paths.add(path);\n }\n return paths;\n}\n\nfunction validateIgnoredLegacyPath(value: unknown): WorkspacePath {\n if (!isRecord(value) || value.schemaVersion !== 1 || typeof value.ignoredAt !== 'string') {\n throw corrupt('Ignored legacy recovery marker is corrupt.');\n }\n const path = parseWorkspacePath(readString(value.path, 'ignored legacy path'));\n if (!path) throw corrupt('Ignored legacy recovery marker cannot target the workspace root.');\n return path;\n}\n\nfunction bytesEqual(left: ArrayBuffer | Uint8Array, right: ArrayBuffer | Uint8Array): boolean {\n const leftBytes = ArrayBuffer.isView(left)\n ? new Uint8Array(left.buffer, left.byteOffset, left.byteLength)\n : new Uint8Array(left);\n const rightBytes = ArrayBuffer.isView(right)\n ? new Uint8Array(right.buffer, right.byteOffset, right.byteLength)\n : new Uint8Array(right);\n if (leftBytes.byteLength !== rightBytes.byteLength) return false;\n return leftBytes.every((byte, index) => byte === rightBytes[index]);\n}\n\nasync function assertNoLegacyConflict(\n transaction: IndexedDBFileSystemTransaction,\n path: WorkspacePath,\n operation: FsOperation,\n): Promise<void> {\n if ((await transaction.get<unknown>(legacyConflictKey(path))) === null) return;\n throw new FsError(\n 'conflict',\n 'Resolve the legacy migration conflict before mutating this path.',\n {\n operation,\n path,\n retryable: false,\n },\n );\n}\n\nfunction validateLegacyMetadata(value: unknown, path: WorkspacePath): FileMeta | null {\n if (value === null) return null;\n if (\n !isRecord(value) ||\n typeof value.name !== 'string' ||\n typeof value.path !== 'string' ||\n typeof value.size !== 'number' ||\n !Number.isFinite(value.size) ||\n typeof value.lastModified !== 'string'\n ) {\n throw corrupt(`Legacy metadata is corrupt: ${path}.`, path);\n }\n return {\n name: value.name,\n path: value.path,\n size: value.size,\n lastModified: value.lastModified,\n };\n}\n\nfunction validateLegacyConflict(value: unknown): PersistedLegacyConflict {\n if (!isRecord(value)) {\n throw corrupt('Legacy migration conflict record is corrupt.');\n }\n const path = parseWorkspacePath(readString(value.path, 'legacy conflict path'));\n if (!path) throw corrupt('Legacy migration conflict cannot target the workspace root.');\n\n if (value.schemaVersion === LEGACY_CONFLICT_SCHEMA_VERSION_V1) {\n const reason = validateLegacyConflictReason(value.reason);\n const candidate: PersistedLegacyRecoveryCandidate = {\n kind: 'file',\n reason,\n text: value.text === null ? null : readString(value.text, 'legacy conflict text'),\n binary: value.binary === null ? null : validateBytes(value.binary, path),\n metadata: validateLegacyMetadata(value.metadata, path),\n detectedAt: readString(value.detectedAt, 'legacy conflict detectedAt'),\n };\n return {\n schemaVersion: LEGACY_CONFLICT_SCHEMA_VERSION,\n path,\n candidates: Object.freeze([candidate]),\n };\n }\n if (value.schemaVersion !== LEGACY_CONFLICT_SCHEMA_VERSION || !Array.isArray(value.candidates)) {\n throw corrupt('Legacy migration conflict record is corrupt.');\n }\n const candidates = value.candidates.map((candidate) =>\n validateLegacyRecoveryCandidate(candidate, path),\n );\n if (candidates.length === 0) throw corrupt('Legacy migration conflict has no candidates.', path);\n return {\n schemaVersion: LEGACY_CONFLICT_SCHEMA_VERSION,\n path,\n candidates: Object.freeze(candidates),\n };\n}\n\nfunction toPublicLegacyConflict(\n conflict: PersistedLegacyConflict,\n): IndexedDBLegacyMigrationConflict {\n const candidates = conflict.candidates.map(toPublicLegacyCandidate);\n const latest = candidates[candidates.length - 1]!;\n return Object.freeze({\n path: parseWorkspacePath(conflict.path),\n reason: latest.reason,\n kind: latest.kind,\n text: latest.text,\n binary: latest.binary,\n metadata: latest.metadata,\n detectedAt: latest.detectedAt,\n candidates: Object.freeze(candidates),\n });\n}\n\nfunction validateLegacyRecoveryCandidate(\n value: unknown,\n path: WorkspacePath,\n): PersistedLegacyRecoveryCandidate {\n if (!isRecord(value) || (value.kind !== 'file' && value.kind !== 'directory')) {\n throw corrupt('Legacy recovery candidate is corrupt.', path);\n }\n const kind = value.kind;\n const text = value.text === null ? null : readString(value.text, 'legacy recovery text');\n const binary = value.binary === null ? null : validateBytes(value.binary, path);\n const metadata = validateLegacyMetadata(value.metadata, path);\n if (kind === 'directory' && (text !== null || binary !== null || metadata !== null)) {\n throw corrupt('A legacy directory recovery candidate contains file data.', path);\n }\n return {\n kind,\n reason: validateLegacyConflictReason(value.reason),\n text,\n binary,\n metadata,\n detectedAt: readString(value.detectedAt, 'legacy recovery detectedAt'),\n };\n}\n\nfunction validateLegacyConflictReason(value: unknown): IndexedDBLegacyConflictReason {\n if (\n value === 'dual-payload' ||\n value === 'kind-collision' ||\n value === 'authority-collision' ||\n value === 'stale-client-write'\n ) {\n return value;\n }\n throw corrupt('Legacy recovery reason is invalid.');\n}\n\nfunction toPublicLegacyCandidate(\n candidate: PersistedLegacyRecoveryCandidate,\n): IndexedDBLegacyRecoveryCandidate {\n return Object.freeze({\n kind: candidate.kind,\n reason: candidate.reason,\n text: candidate.text,\n binary: candidate.binary ? copyBytes(candidate.binary) : null,\n metadata: candidate.metadata ? Object.freeze({ ...candidate.metadata }) : null,\n detectedAt: candidate.detectedAt,\n });\n}\n\nasync function appendLegacyConflict(\n transaction: IndexedDBFileSystemTransaction,\n path: WorkspacePath,\n candidate: PersistedLegacyRecoveryCandidate,\n): Promise<void> {\n const key = legacyConflictKey(path);\n const raw = await transaction.get<unknown>(key);\n const existing = raw === null ? null : validateLegacyConflict(raw);\n if (existing?.candidates.some((item) => recoveryCandidatesEqual(item, candidate))) return;\n const candidates = [...(existing?.candidates ?? []), copyRecoveryCandidate(candidate)];\n await transaction.put(key, {\n schemaVersion: LEGACY_CONFLICT_SCHEMA_VERSION,\n path,\n candidates,\n } satisfies PersistedLegacyConflict);\n}\n\nfunction fileRecoveryCandidate(\n legacy: { content: string | null; binary: ArrayBuffer | null; metadata: FileMeta | null },\n reason: IndexedDBLegacyConflictReason,\n detectedAt: string,\n): PersistedLegacyRecoveryCandidate {\n return {\n kind: 'file',\n reason,\n text: legacy.content,\n binary: legacy.binary ? copyBytes(legacy.binary) : null,\n metadata: legacy.metadata ? { ...legacy.metadata } : null,\n detectedAt,\n };\n}\n\nfunction directoryRecoveryCandidate(\n reason: IndexedDBLegacyConflictReason,\n detectedAt: string,\n): PersistedLegacyRecoveryCandidate {\n return { kind: 'directory', reason, text: null, binary: null, metadata: null, detectedAt };\n}\n\nfunction copyRecoveryCandidate(\n candidate: PersistedLegacyRecoveryCandidate,\n): PersistedLegacyRecoveryCandidate {\n return {\n ...candidate,\n binary: candidate.binary ? copyBytes(candidate.binary) : null,\n metadata: candidate.metadata ? { ...candidate.metadata } : null,\n };\n}\n\nfunction recoveryCandidatesEqual(\n left: PersistedLegacyRecoveryCandidate,\n right: PersistedLegacyRecoveryCandidate,\n): boolean {\n return (\n left.kind === right.kind &&\n left.text === right.text &&\n nullableBytesEqual(left.binary, right.binary) &&\n nullableMetadataEqual(left.metadata, right.metadata)\n );\n}\n\nfunction nullableBytesEqual(left: ArrayBuffer | null, right: ArrayBuffer | null): boolean {\n if (left === null || right === null) return left === right;\n return bytesEqual(left, right);\n}\n\nfunction nullableMetadataEqual(left: FileMeta | null, right: FileMeta | null): boolean {\n if (left === null || right === null) return left === right;\n return (\n left.name === right.name &&\n left.path === right.path &&\n left.size === right.size &&\n left.lastModified === right.lastModified\n );\n}\n\nfunction legacyPayloadsMatchEntry(\n legacy: { content: string | null; binary: ArrayBuffer | null; metadata: FileMeta | null },\n entry: PersistedFileEntry,\n): boolean {\n if (legacy.content === null && legacy.binary === null) return false;\n return (\n (legacy.content === null || bytesEqual(new TextEncoder().encode(legacy.content), entry.data)) &&\n (legacy.binary === null || bytesEqual(legacy.binary, entry.data))\n );\n}\n\nfunction hasFileAncestor(\n entries: ReadonlyMap<WorkspacePath, PersistedEntry>,\n path: WorkspacePath,\n): boolean {\n return parentChain(path).some((parent) => entries.get(parent)?.kind === 'file');\n}\n\nasync function deleteLegacyNamespace(\n transaction: IndexedDBFileSystemTransaction,\n keys: readonly string[],\n): Promise<void> {\n for (const key of keys) {\n if (key.startsWith(LEGACY_PREFIX) && !isRecognizedLegacyKey(key)) {\n const archiveKey = `${LEGACY_OPAQUE_PREFIX}${encodeURIComponent(key)}`;\n const existing = await transaction.get<unknown>(archiveKey);\n const values =\n isRecord(existing) &&\n existing.schemaVersion === 1 &&\n existing.key === key &&\n Array.isArray(existing.values)\n ? existing.values\n : [];\n await transaction.put(archiveKey, {\n schemaVersion: 1,\n key,\n values: [...values, await transaction.get<unknown>(key)],\n });\n }\n if (key.startsWith(LEGACY_PREFIX) || key.startsWith(LEGACY_IGNORED_PREFIX))\n await transaction.delete(key);\n }\n}\n\nfunction isRecognizedLegacyKey(key: string): boolean {\n if (key === LEGACY_DIRS_KEY) return true;\n const suffix = [LEGACY_CONTENT_SUFFIX, LEGACY_BINARY_SUFFIX, LEGACY_META_SUFFIX].find((item) =>\n key.endsWith(item),\n );\n if (!suffix) return false;\n const rawPath = key.slice(LEGACY_PREFIX.length, -suffix.length);\n try {\n const path = parseWorkspacePath(rawPath);\n return path !== WORKSPACE_ROOT && path === rawPath;\n } catch {\n return false;\n }\n}\n\nfunction selectLegacyPayload(\n conflict: PersistedLegacyConflict,\n resolution: Exclude<IndexedDBLegacyConflictResolution, 'v2'>,\n path: WorkspacePath,\n): { readonly kind: 'file'; readonly data: ArrayBuffer } | { readonly kind: 'directory' } {\n const payload = typeof resolution === 'string' ? resolution : resolution.payload;\n const eligible =\n typeof resolution === 'string'\n ? conflict.candidates.filter(\n (candidate) =>\n candidate.kind === 'file' &&\n (payload === 'text' ? candidate.text !== null : candidate.binary !== null),\n )\n : [conflict.candidates[resolution.candidate]].filter(\n (candidate): candidate is PersistedLegacyRecoveryCandidate => candidate !== undefined,\n );\n if (eligible.length !== 1) {\n throw new FsError(\n 'conflict',\n 'Choose an explicit recovery candidate because multiple legacy versions are quarantined.',\n { operation: 'write', path, retryable: false },\n );\n }\n const candidate = eligible[0]!;\n if (payload === 'directory') {\n if (candidate.kind !== 'directory') {\n throw new FsError('type-mismatch', 'The selected recovery candidate is not a directory.', {\n operation: 'write',\n path,\n });\n }\n return { kind: 'directory' };\n }\n if (candidate.kind !== 'file') {\n throw new FsError('type-mismatch', 'The selected recovery candidate is a directory.', {\n operation: 'write',\n path,\n });\n }\n const data =\n payload === 'text'\n ? candidate.text === null\n ? null\n : new TextEncoder().encode(candidate.text).buffer\n : candidate.binary;\n if (data === null) {\n throw new FsError('type-mismatch', `The selected candidate has no ${payload} payload.`, {\n operation: 'write',\n path,\n });\n }\n return { kind: 'file', data: copyBytes(data) };\n}\n\nfunction addParentDirectories(\n entries: Map<WorkspacePath, PersistedEntry>,\n path: WorkspacePath,\n version: FileSystemVersion,\n lastModified: string,\n): void {\n for (const parent of parentChain(path)) {\n if (!entries.has(parent)) entries.set(parent, directoryRecord(parent, version, lastModified));\n }\n}\n\nfunction parentChain(path: WorkspacePath): WorkspacePath[] {\n const parents: WorkspacePath[] = [];\n let current = workspacePathDirname(path);\n while (true) {\n parents.unshift(current);\n if (!current) return parents;\n current = workspacePathDirname(current);\n }\n}\n\nfunction directoryRecord(\n path: WorkspacePath,\n version: FileSystemVersion,\n lastModified: string,\n): PersistedDirectoryEntry {\n return {\n schemaVersion: ENTRY_SCHEMA_VERSION,\n kind: 'directory',\n path,\n version,\n lastModified,\n };\n}\n\nfunction withPathAndVersion(\n entry: PersistedEntry,\n path: WorkspacePath,\n next: MutationVersion,\n): PersistedEntry {\n return entry.kind === 'file'\n ? {\n schemaVersion: ENTRY_SCHEMA_VERSION,\n kind: 'file',\n path,\n data: copyBytes(entry.data),\n version: next.version,\n lastModified: next.lastModified,\n }\n : directoryRecord(path, next.version, next.lastModified);\n}\n\nfunction copyEntry(entry: PersistedEntry): PersistedEntry {\n return entry.kind === 'file' ? { ...entry, data: copyBytes(entry.data) } : { ...entry };\n}\n\nfunction toEntrySnapshot(entry: PersistedEntry): FileSystemEntrySnapshot {\n return entry.kind === 'file' ? toFileSnapshot(entry) : toDirectorySnapshot(entry);\n}\n\nfunction toFileSnapshot(entry: PersistedFileEntry): FileSystemFileSnapshot {\n return Object.freeze({\n kind: 'file',\n path: parseWorkspacePath(entry.path),\n name: workspacePathBasename(parseWorkspacePath(entry.path)),\n size: entry.data.byteLength,\n version: parseFileSystemVersion(entry.version),\n lastModified: entry.lastModified,\n });\n}\n\nfunction toDirectorySnapshot(entry: PersistedDirectoryEntry): FileSystemDirectorySnapshot {\n const path = parseWorkspacePath(entry.path);\n return Object.freeze({\n kind: 'directory',\n path,\n name: workspacePathBasename(path),\n size: null,\n version: parseFileSystemVersion(entry.version),\n lastModified: entry.lastModified,\n });\n}\n\nfunction compareSnapshots(left: FileSystemEntrySnapshot, right: FileSystemEntrySnapshot): number {\n if (left.kind !== right.kind) return left.kind === 'directory' ? -1 : 1;\n return compareText(left.name, right.name);\n}\n\nfunction compareText(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n\nfunction copyBytes(data: ArrayBuffer | Uint8Array): ArrayBuffer {\n const source = ArrayBuffer.isView(data)\n ? new Uint8Array(data.buffer, data.byteOffset, data.byteLength)\n : new Uint8Array(data);\n const copy = new Uint8Array(source.byteLength);\n copy.set(source);\n return copy.buffer as ArrayBuffer;\n}\n\nfunction validateBytes(value: unknown, path: WorkspacePath): ArrayBuffer {\n if (value instanceof ArrayBuffer) return copyBytes(value);\n if (value instanceof Uint8Array) return copyBytes(value);\n throw corrupt(`Stored file bytes are corrupt: ${path}.`, path);\n}\n\nfunction readString(value: unknown, label: string): string {\n if (typeof value !== 'string') throw corrupt(`Invalid ${label}.`);\n return value;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\nfunction corrupt(message: string, path?: WorkspacePath): FsError {\n return new FsError('io', message, { operation: 'read', path, retryable: false });\n}\n","/**\n * Legacy FileSystemProvider facade over the revisioned IndexedDB authority.\n *\n * The old `fs:*` namespace is migration input only. Keeping this facade as an\n * adapter prevents current callers from recreating a second persistent source\n * of truth while the workspace moves to FileSystemProviderV2.\n */\n\nimport type { FileCommitResult, FileMeta, FileSystemEntry, FileSystemProvider } from './types.js';\nimport { FsError, type FsOperation } from './fs-error.js';\nimport { parseWorkspacePath, type WorkspacePath } from './workspace-path.js';\nimport { RawIndexedDBFileSystemStore, type IndexedDBFileSystemStore } from './indexeddb-store.js';\nimport { IndexedDBFileSystemProviderV2 } from './indexeddb-provider-v2.js';\n\nexport interface IndexedDBFileSystemProviderOptions {\n /** Injectable transaction store for deterministic fault/concurrency tests. */\n store?: IndexedDBFileSystemStore;\n /** Injectable metadata clock. */\n now?: () => Date;\n}\n\nexport class IndexedDBFileSystemProvider implements FileSystemProvider {\n public readonly id: string;\n public readonly label: string;\n public readonly v2: IndexedDBFileSystemProviderV2;\n\n private disposed = false;\n\n public constructor(id: string, label: string, options: IndexedDBFileSystemProviderOptions = {}) {\n this.id = id;\n this.label = label;\n const store = options.store ?? new RawIndexedDBFileSystemStore(`docblocks-fs-${id}`, 'files');\n this.v2 = new IndexedDBFileSystemProviderV2(id, label, {\n store,\n now: options.now,\n closeStoreOnDispose: true,\n });\n }\n\n /** Release the underlying database connection after accepted work settles. */\n public dispose(): Promise<void> {\n this.disposed = true;\n return this.v2.dispose();\n }\n\n public async readFile(path: string): Promise<string | null> {\n this.assertOpen('read');\n const read = await this.v2.readFile(this.path(path, false, 'read'));\n return read ? new TextDecoder().decode(read.data) : null;\n }\n\n public async writeFile(path: string, content: string): Promise<void> {\n this.assertOpen('write');\n await this.v2.writeFile(this.path(path, false, 'write'), new TextEncoder().encode(content), {\n createParents: true,\n });\n }\n\n public async commitFile(\n path: string,\n content: string,\n expectedContent: string | null,\n ): Promise<FileCommitResult> {\n this.assertOpen('write');\n const canonical = this.path(path, false, 'write');\n const current = await this.v2.readFile(canonical);\n const currentContent = current ? new TextDecoder().decode(current.data) : null;\n if (currentContent !== expectedContent && currentContent !== content) {\n return {\n status: 'conflict',\n content: currentContent,\n version: current?.entry.version ?? null,\n };\n }\n\n try {\n const committed = await this.v2.writeFile(canonical, new TextEncoder().encode(content), {\n createParents: true,\n expectedVersion: current?.entry.version ?? null,\n });\n return { status: 'committed', version: committed.version };\n } catch (error: unknown) {\n if (!(error instanceof FsError) || error.code !== 'conflict') throw error;\n const latest = await this.v2.readFile(canonical);\n return {\n status: 'conflict',\n content: latest ? new TextDecoder().decode(latest.data) : null,\n version: latest?.entry.version ?? null,\n };\n }\n }\n\n public async delete(path: string): Promise<void> {\n this.assertOpen('remove');\n await this.v2.remove(this.path(path, false, 'remove'), {\n recursive: true,\n missing: 'ignore',\n });\n }\n\n public async rename(oldPath: string, newPath: string): Promise<void> {\n this.assertOpen('move');\n await this.v2.move(this.path(oldPath, false, 'move'), this.path(newPath, false, 'move'), {\n createParents: true,\n });\n }\n\n public async readDirectory(path: string): Promise<FileSystemEntry[]> {\n this.assertOpen('list');\n try {\n const entries = await this.v2.readDirectory(this.path(path, true, 'list'));\n return entries.map((entry) => ({\n kind: entry.kind,\n name: entry.name,\n path: entry.path,\n }));\n } catch (error: unknown) {\n if (error instanceof FsError && error.code === 'not-found') return [];\n throw error;\n }\n }\n\n public async exists(path: string): Promise<boolean> {\n this.assertOpen('stat');\n return (await this.v2.stat(this.path(path, true, 'stat'))) !== null;\n }\n\n public async createDirectory(path: string): Promise<void> {\n this.assertOpen('create-directory');\n await this.v2.createDirectory(this.path(path, false, 'create-directory'), {\n createParents: true,\n mode: 'ensure',\n });\n }\n\n public async stat(path: string): Promise<FileMeta | null> {\n this.assertOpen('stat');\n const entry = await this.v2.stat(this.path(path, false, 'stat'));\n if (!entry || entry.kind !== 'file') return null;\n return {\n name: entry.name,\n path: entry.path,\n size: entry.size,\n lastModified: entry.lastModified,\n };\n }\n\n public async readBinary(path: string): Promise<ArrayBuffer | null> {\n this.assertOpen('read');\n return (await this.v2.readFile(this.path(path, false, 'read')))?.data ?? null;\n }\n\n public async writeBinary(path: string, data: ArrayBuffer | Uint8Array): Promise<void> {\n this.assertOpen('write');\n await this.v2.writeFile(this.path(path, false, 'write'), data, { createParents: true });\n }\n\n private path(path: string, allowRoot: boolean, operation: FsOperation): WorkspacePath {\n const canonical = parseWorkspacePath(path);\n if (canonical || allowRoot) return canonical;\n throw new FsError('invalid-path', 'The filesystem root cannot be used as a mutation target.', {\n operation,\n path,\n });\n }\n\n private assertOpen(operation: FsOperation): void {\n if (!this.disposed) return;\n throw new FsError('closed', 'The IndexedDB filesystem provider is disposed.', { operation });\n }\n}\n","/**\n * IndexedDBContentContainer — a ContentContainer backed by IndexedDB.\n *\n * Uses a dedicated IndexedDBFileSystemProvider instance (separate store)\n * to persist media files across page refreshes.\n */\n\nimport type { ContentContainer, ContentEntry } from '@bendyline/squisq/storage';\nimport { findDocumentPath } from '@bendyline/squisq/storage';\nimport { IndexedDBFileSystemProviderV2 } from './indexeddb-provider-v2.js';\nimport { parseWorkspacePath, WORKSPACE_ROOT } from './workspace-path.js';\n\n// ── MIME type guessing ─────────────────────────────────────────────\n\nconst EXTENSION_MIME_MAP: Record<string, string> = {\n '.md': 'text/markdown',\n '.txt': 'text/plain',\n '.json': 'application/json',\n '.jpg': 'image/jpeg',\n '.jpeg': 'image/jpeg',\n '.png': 'image/png',\n '.gif': 'image/gif',\n '.svg': 'image/svg+xml',\n '.webp': 'image/webp',\n '.avif': 'image/avif',\n '.mp4': 'video/mp4',\n '.webm': 'video/webm',\n '.mp3': 'audio/mpeg',\n '.wav': 'audio/wav',\n '.ogg': 'audio/ogg',\n};\n\nfunction guessMimeType(path: string): string {\n const dot = path.lastIndexOf('.');\n if (dot === -1) return 'application/octet-stream';\n const ext = path.slice(dot).toLowerCase();\n return EXTENSION_MIME_MAP[ext] ?? 'application/octet-stream';\n}\n\n// ── Implementation ─────────────────────────────────────────────────\n\nexport class IndexedDBContentContainer implements ContentContainer {\n private readonly provider: IndexedDBFileSystemProviderV2;\n\n constructor(workspaceId: string) {\n this.provider = new IndexedDBFileSystemProviderV2(`${workspaceId}-media`, 'Media Storage');\n }\n\n async readFile(path: string): Promise<ArrayBuffer | null> {\n return (await this.provider.readFile(parseWorkspacePath(path)))?.data ?? null;\n }\n\n async writeFile(path: string, data: ArrayBuffer | Uint8Array, _mimeType?: string): Promise<void> {\n await this.provider.writeFile(parseWorkspacePath(path), data, {\n mode: 'upsert',\n createParents: true,\n });\n }\n\n async removeFile(path: string): Promise<void> {\n await this.provider.remove(parseWorkspacePath(path), { missing: 'ignore' });\n }\n\n async listFiles(prefix?: string): Promise<ContentEntry[]> {\n const entries: ContentEntry[] = [];\n const walk = async (dir: string) => {\n const children = await this.provider.readDirectory(parseWorkspacePath(dir));\n for (const child of children) {\n if (child.kind === 'directory') {\n await walk(child.path);\n } else {\n const filePath = child.path;\n if (prefix && !filePath.startsWith(prefix)) continue;\n entries.push({\n path: filePath,\n mimeType: guessMimeType(filePath),\n size: child.size,\n });\n }\n }\n };\n await walk(WORKSPACE_ROOT);\n return entries;\n }\n\n async exists(path: string): Promise<boolean> {\n return (await this.provider.stat(parseWorkspacePath(path))) !== null;\n }\n\n async getDocumentPath(): Promise<string | null> {\n return findDocumentPath(await this.listFiles());\n }\n\n async readDocument(): Promise<string | null> {\n const docPath = await this.getDocumentPath();\n if (!docPath) return null;\n const data = await this.readFile(docPath);\n if (!data) return null;\n return new TextDecoder().decode(data);\n }\n\n async writeDocument(markdown: string, filename?: string): Promise<void> {\n const name = filename ?? 'index.md';\n const data = new TextEncoder().encode(markdown);\n await this.writeFile(name, data, 'text/markdown');\n }\n\n /** Release the IndexedDB connection when a long-lived container is retired. */\n async dispose(): Promise<void> {\n await this.provider.dispose();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA6BO,IAAM,8BAAN,MAAsE;AAAA,EAKpE,YACY,cACA,WACjB;AAFiB;AACA;AANnB,SAAQ,WAA+B;AACvC,SAAQ,UAAuC;AAC/C,SAAQ,SAAS;AAAA,EAKd;AAAA,EAEH,MAAa,YACX,MACA,WACY;AACZ,UAAM,WAAW,MAAM,KAAK,YAAY;AACxC,UAAM,oBAAoB,SAAS,YAAY,KAAK,WAAW,IAAI;AACnE,UAAM,aAAa,mBAAmB,iBAAiB;AACvD,UAAM,cAAc,IAAI;AAAA,MACtB,kBAAkB,YAAY,KAAK,SAAS;AAAA,IAC9C;AAEA,QAAI;AACJ,QAAI;AACF,eAAS,MAAM,UAAU,WAAW;AAAA,IACtC,SAAS,OAAgB;AACvB,UAAI;AACF,0BAAkB,MAAM;AAAA,MAC1B,QAAQ;AAAA,MAER;AACA,YAAM,WAAW,MAAM,MAAM,MAAS;AACtC,YAAM;AAAA,IACR;AAEA,UAAM;AACN,WAAO;AAAA,EACT;AAAA,EAEO,QAAc;AACnB,QAAI,KAAK,OAAQ;AACjB,SAAK,SAAS;AACd,SAAK,UAAU,MAAM;AACrB,SAAK,WAAW;AAChB,SAAK,UAAU;AAAA,EACjB;AAAA,EAEQ,cAAoC;AAC1C,QAAI,KAAK,QAAQ;AACf,aAAO,QAAQ,OAAO,IAAI,MAAM,2CAA2C,CAAC;AAAA,IAC9E;AACA,Q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