@bendyline/docblocks 1.1.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (270) hide show
  1. package/README.md +76 -11
  2. package/dist/chunk-2D7Y4IR3.js +1293 -0
  3. package/dist/chunk-2D7Y4IR3.js.map +1 -0
  4. package/dist/chunk-5MYAICRE.js +957 -0
  5. package/dist/chunk-5MYAICRE.js.map +1 -0
  6. package/dist/chunk-75UUF6C4.js +802 -0
  7. package/dist/chunk-75UUF6C4.js.map +1 -0
  8. package/dist/chunk-AEHCVWU5.js +25 -0
  9. package/dist/chunk-AEHCVWU5.js.map +1 -0
  10. package/dist/chunk-AYZ4HN5M.js +20 -0
  11. package/dist/chunk-AYZ4HN5M.js.map +1 -0
  12. package/dist/chunk-EGNDADXB.js +111 -0
  13. package/dist/chunk-EGNDADXB.js.map +1 -0
  14. package/dist/chunk-EZKJZUNJ.js +13 -0
  15. package/dist/chunk-EZKJZUNJ.js.map +1 -0
  16. package/dist/chunk-FNW556FN.js +75 -0
  17. package/dist/chunk-FNW556FN.js.map +1 -0
  18. package/dist/chunk-GCPBEMMH.js +563 -0
  19. package/dist/chunk-GCPBEMMH.js.map +1 -0
  20. package/dist/chunk-J32GU3F3.js +1664 -0
  21. package/dist/chunk-J32GU3F3.js.map +1 -0
  22. package/dist/chunk-PGR7LK6D.js +1062 -0
  23. package/dist/chunk-PGR7LK6D.js.map +1 -0
  24. package/dist/chunk-RQJRQF46.js +787 -0
  25. package/dist/chunk-RQJRQF46.js.map +1 -0
  26. package/dist/{chunk-ME76RUMR.js → chunk-RVQHY3XU.js} +15 -1
  27. package/dist/chunk-RVQHY3XU.js.map +1 -0
  28. package/dist/chunk-SI2LU2RP.js +224 -0
  29. package/dist/chunk-SI2LU2RP.js.map +1 -0
  30. package/dist/chunk-W5UUUII5.js +142 -0
  31. package/dist/chunk-W5UUUII5.js.map +1 -0
  32. package/dist/document/document-session.d.ts +127 -0
  33. package/dist/document/document-session.d.ts.map +1 -0
  34. package/dist/document/document-session.js +749 -0
  35. package/dist/document/document-session.js.map +1 -0
  36. package/dist/document/filesystem-target.d.ts +17 -0
  37. package/dist/document/filesystem-target.d.ts.map +1 -0
  38. package/dist/document/filesystem-target.js +70 -0
  39. package/dist/document/filesystem-target.js.map +1 -0
  40. package/dist/document/index.d.ts +6 -0
  41. package/dist/document/index.d.ts.map +1 -0
  42. package/dist/document/index.js +4 -0
  43. package/dist/document/index.js.map +1 -0
  44. package/dist/document/recovery-journal.d.ts +125 -0
  45. package/dist/document/recovery-journal.d.ts.map +1 -0
  46. package/dist/document/recovery-journal.js +385 -0
  47. package/dist/document/recovery-journal.js.map +1 -0
  48. package/dist/document/types.d.ts +89 -0
  49. package/dist/document/types.d.ts.map +1 -0
  50. package/dist/document/types.js +9 -0
  51. package/dist/document/types.js.map +1 -0
  52. package/dist/filesystem/commit-lock.d.ts +3 -0
  53. package/dist/filesystem/commit-lock.d.ts.map +1 -0
  54. package/dist/filesystem/commit-lock.js +20 -0
  55. package/dist/filesystem/commit-lock.js.map +1 -0
  56. package/dist/filesystem/dbk-workspace.d.ts +34 -0
  57. package/dist/filesystem/dbk-workspace.d.ts.map +1 -0
  58. package/dist/filesystem/dbk-workspace.js +85 -0
  59. package/dist/filesystem/dbk-workspace.js.map +1 -0
  60. package/dist/filesystem/electron-provider-v2.d.ts +36 -0
  61. package/dist/filesystem/electron-provider-v2.d.ts.map +1 -0
  62. package/dist/filesystem/electron-provider-v2.js +503 -0
  63. package/dist/filesystem/electron-provider-v2.js.map +1 -0
  64. package/dist/filesystem/electron-provider.d.ts +6 -3
  65. package/dist/filesystem/electron-provider.d.ts.map +1 -1
  66. package/dist/filesystem/electron-provider.js +18 -13
  67. package/dist/filesystem/electron-provider.js.map +1 -1
  68. package/dist/filesystem/electron.d.ts +4 -0
  69. package/dist/filesystem/electron.d.ts.map +1 -0
  70. package/dist/filesystem/electron.js +4 -0
  71. package/dist/filesystem/electron.js.map +1 -0
  72. package/dist/filesystem/filesystem-content-container.d.ts +1 -1
  73. package/dist/filesystem/filesystem-content-container.d.ts.map +1 -1
  74. package/dist/filesystem/filesystem-content-container.js +50 -13
  75. package/dist/filesystem/filesystem-content-container.js.map +1 -1
  76. package/dist/filesystem/fs-error.d.ts +46 -0
  77. package/dist/filesystem/fs-error.d.ts.map +1 -0
  78. package/dist/filesystem/fs-error.js +170 -0
  79. package/dist/filesystem/fs-error.js.map +1 -0
  80. package/dist/filesystem/index.d.ts +15 -1
  81. package/dist/filesystem/index.d.ts.map +1 -1
  82. package/dist/filesystem/index.js +13 -0
  83. package/dist/filesystem/index.js.map +1 -1
  84. package/dist/filesystem/indexeddb-content-container.d.ts +3 -1
  85. package/dist/filesystem/indexeddb-content-container.d.ts.map +1 -1
  86. package/dist/filesystem/indexeddb-content-container.js +18 -11
  87. package/dist/filesystem/indexeddb-content-container.js.map +1 -1
  88. package/dist/filesystem/indexeddb-provider-v2.d.ts +96 -0
  89. package/dist/filesystem/indexeddb-provider-v2.d.ts.map +1 -0
  90. package/dist/filesystem/indexeddb-provider-v2.js +1241 -0
  91. package/dist/filesystem/indexeddb-provider-v2.js.map +1 -0
  92. package/dist/filesystem/indexeddb-provider.d.ts +21 -14
  93. package/dist/filesystem/indexeddb-provider.d.ts.map +1 -1
  94. package/dist/filesystem/indexeddb-provider.js +111 -261
  95. package/dist/filesystem/indexeddb-provider.js.map +1 -1
  96. package/dist/filesystem/indexeddb-store.d.ts +34 -0
  97. package/dist/filesystem/indexeddb-store.d.ts.map +1 -0
  98. package/dist/filesystem/indexeddb-store.js +165 -0
  99. package/dist/filesystem/indexeddb-store.js.map +1 -0
  100. package/dist/filesystem/indexeddb.d.ts +5 -0
  101. package/dist/filesystem/indexeddb.d.ts.map +1 -0
  102. package/dist/filesystem/indexeddb.js +5 -0
  103. package/dist/filesystem/indexeddb.js.map +1 -0
  104. package/dist/filesystem/legacy-v2-adapter.d.ts +62 -0
  105. package/dist/filesystem/legacy-v2-adapter.d.ts.map +1 -0
  106. package/dist/filesystem/legacy-v2-adapter.js +499 -0
  107. package/dist/filesystem/legacy-v2-adapter.js.map +1 -0
  108. package/dist/filesystem/memory-provider-v2.d.ts +92 -0
  109. package/dist/filesystem/memory-provider-v2.d.ts.map +1 -0
  110. package/dist/filesystem/memory-provider-v2.js +615 -0
  111. package/dist/filesystem/memory-provider-v2.js.map +1 -0
  112. package/dist/filesystem/memory-provider.d.ts +54 -0
  113. package/dist/filesystem/memory-provider.d.ts.map +1 -0
  114. package/dist/filesystem/memory-provider.js +132 -0
  115. package/dist/filesystem/memory-provider.js.map +1 -0
  116. package/dist/filesystem/memory.d.ts +4 -0
  117. package/dist/filesystem/memory.d.ts.map +1 -0
  118. package/dist/filesystem/memory.js +4 -0
  119. package/dist/filesystem/memory.js.map +1 -0
  120. package/dist/filesystem/move-entry.d.ts +9 -0
  121. package/dist/filesystem/move-entry.d.ts.map +1 -0
  122. package/dist/filesystem/move-entry.js +103 -0
  123. package/dist/filesystem/move-entry.js.map +1 -0
  124. package/dist/filesystem/move-error.d.ts +53 -0
  125. package/dist/filesystem/move-error.d.ts.map +1 -0
  126. package/dist/filesystem/move-error.js +99 -0
  127. package/dist/filesystem/move-error.js.map +1 -0
  128. package/dist/filesystem/native-provider-v2.d.ts +75 -0
  129. package/dist/filesystem/native-provider-v2.d.ts.map +1 -0
  130. package/dist/filesystem/native-provider-v2.js +849 -0
  131. package/dist/filesystem/native-provider-v2.js.map +1 -0
  132. package/dist/filesystem/native-provider.d.ts +9 -1
  133. package/dist/filesystem/native-provider.d.ts.map +1 -1
  134. package/dist/filesystem/native-provider.js +172 -37
  135. package/dist/filesystem/native-provider.js.map +1 -1
  136. package/dist/filesystem/native.d.ts +4 -0
  137. package/dist/filesystem/native.d.ts.map +1 -0
  138. package/dist/filesystem/native.js +4 -0
  139. package/dist/filesystem/native.js.map +1 -0
  140. package/dist/filesystem/types.d.ts +37 -4
  141. package/dist/filesystem/types.d.ts.map +1 -1
  142. package/dist/filesystem/types.js +11 -3
  143. package/dist/filesystem/types.js.map +1 -1
  144. package/dist/filesystem/v2.d.ts +172 -0
  145. package/dist/filesystem/v2.d.ts.map +1 -0
  146. package/dist/filesystem/v2.js +16 -0
  147. package/dist/filesystem/v2.js.map +1 -0
  148. package/dist/filesystem/workspace-path.d.ts +21 -0
  149. package/dist/filesystem/workspace-path.d.ts.map +1 -0
  150. package/dist/filesystem/workspace-path.js +80 -0
  151. package/dist/filesystem/workspace-path.js.map +1 -0
  152. package/dist/host/filesystem-v2.d.ts +45 -0
  153. package/dist/host/filesystem-v2.d.ts.map +1 -0
  154. package/dist/host/filesystem-v2.js +13 -0
  155. package/dist/host/filesystem-v2.js.map +1 -0
  156. package/dist/host/git.d.ts +200 -0
  157. package/dist/host/git.d.ts.map +1 -0
  158. package/dist/host/git.js +15 -0
  159. package/dist/host/git.js.map +1 -0
  160. package/dist/host/index.d.ts +4 -1
  161. package/dist/host/index.d.ts.map +1 -1
  162. package/dist/host/index.js +2 -0
  163. package/dist/host/index.js.map +1 -1
  164. package/dist/host/types.d.ts +114 -31
  165. package/dist/host/types.d.ts.map +1 -1
  166. package/dist/host/wire-policy.d.ts +22 -0
  167. package/dist/host/wire-policy.d.ts.map +1 -0
  168. package/dist/host/wire-policy.js +92 -0
  169. package/dist/host/wire-policy.js.map +1 -0
  170. package/dist/index.d.ts +2 -1
  171. package/dist/index.d.ts.map +1 -1
  172. package/dist/index.js +2 -1
  173. package/dist/index.js.map +1 -1
  174. package/dist/mcp/index.d.ts +4 -0
  175. package/dist/mcp/index.d.ts.map +1 -0
  176. package/dist/mcp/index.js +4 -0
  177. package/dist/mcp/index.js.map +1 -0
  178. package/dist/mcp/types.d.ts +466 -0
  179. package/dist/mcp/types.d.ts.map +1 -0
  180. package/dist/mcp/types.js +25 -0
  181. package/dist/mcp/types.js.map +1 -0
  182. package/dist/mcp/wire.d.ts +29 -0
  183. package/dist/mcp/wire.d.ts.map +1 -0
  184. package/dist/mcp/wire.js +1046 -0
  185. package/dist/mcp/wire.js.map +1 -0
  186. package/dist/mcp/zod.d.ts +5763 -0
  187. package/dist/mcp/zod.d.ts.map +1 -0
  188. package/dist/mcp/zod.js +908 -0
  189. package/dist/mcp/zod.js.map +1 -0
  190. package/dist/types-CX893hgH.d.ts +468 -0
  191. package/dist/types-CsX6EN2t.d.ts +301 -0
  192. package/dist/types-eOlt9J7n.d.ts +478 -0
  193. package/dist/vscode/index.d.ts +3 -0
  194. package/dist/vscode/index.d.ts.map +1 -0
  195. package/dist/vscode/index.js +3 -0
  196. package/dist/vscode/index.js.map +1 -0
  197. package/dist/vscode/messages.d.ts +204 -0
  198. package/dist/vscode/messages.d.ts.map +1 -0
  199. package/dist/vscode/messages.js +494 -0
  200. package/dist/vscode/messages.js.map +1 -0
  201. package/dist/workspace/index.d.ts +3 -2
  202. package/dist/workspace/index.d.ts.map +1 -1
  203. package/dist/workspace/index.js +2 -1
  204. package/dist/workspace/index.js.map +1 -1
  205. package/dist/workspace/reconcile-electron.d.ts +19 -0
  206. package/dist/workspace/reconcile-electron.d.ts.map +1 -0
  207. package/dist/workspace/reconcile-electron.js +42 -0
  208. package/dist/workspace/reconcile-electron.js.map +1 -0
  209. package/dist/workspace/types.d.ts +41 -1
  210. package/dist/workspace/types.d.ts.map +1 -1
  211. package/dist/workspace/types.js +0 -4
  212. package/dist/workspace/types.js.map +1 -1
  213. package/dist/workspace/workspace-manager.d.ts +17 -5
  214. package/dist/workspace/workspace-manager.d.ts.map +1 -1
  215. package/dist/workspace/workspace-manager.js +55 -11
  216. package/dist/workspace/workspace-manager.js.map +1 -1
  217. package/dist/workspace-path-CWVrcuPL.d.ts +21 -0
  218. package/package.json +43 -2
  219. package/src/document/document-session.ts +834 -0
  220. package/src/document/filesystem-target.ts +109 -0
  221. package/src/document/index.ts +41 -0
  222. package/src/document/recovery-journal.ts +536 -0
  223. package/src/document/types.ts +116 -0
  224. package/src/filesystem/commit-lock.ts +29 -0
  225. package/src/filesystem/dbk-workspace.ts +135 -0
  226. package/src/filesystem/electron-provider-v2.ts +630 -0
  227. package/src/filesystem/electron-provider.ts +25 -14
  228. package/src/filesystem/electron.ts +3 -0
  229. package/src/filesystem/filesystem-content-container.ts +53 -15
  230. package/src/filesystem/fs-error.ts +234 -0
  231. package/src/filesystem/index.ts +119 -0
  232. package/src/filesystem/indexeddb-content-container.ts +20 -12
  233. package/src/filesystem/indexeddb-provider-v2.ts +1740 -0
  234. package/src/filesystem/indexeddb-provider.ts +126 -300
  235. package/src/filesystem/indexeddb-store.ts +207 -0
  236. package/src/filesystem/indexeddb.ts +12 -0
  237. package/src/filesystem/legacy-v2-adapter.ts +779 -0
  238. package/src/filesystem/memory-provider-v2.ts +896 -0
  239. package/src/filesystem/memory-provider.ts +180 -0
  240. package/src/filesystem/memory.ts +15 -0
  241. package/src/filesystem/move-entry.ts +142 -0
  242. package/src/filesystem/move-error.ts +159 -0
  243. package/src/filesystem/native-provider-v2.ts +1165 -0
  244. package/src/filesystem/native-provider.ts +194 -41
  245. package/src/filesystem/native.ts +16 -0
  246. package/src/filesystem/types.ts +49 -4
  247. package/src/filesystem/v2.ts +231 -0
  248. package/src/filesystem/workspace-path.ts +92 -0
  249. package/src/host/filesystem-v2.ts +104 -0
  250. package/src/host/git.ts +246 -0
  251. package/src/host/index.ts +46 -0
  252. package/src/host/types.ts +155 -34
  253. package/src/host/wire-policy.ts +103 -0
  254. package/src/index.ts +2 -1
  255. package/src/mcp/index.ts +3 -0
  256. package/src/mcp/types.ts +594 -0
  257. package/src/mcp/wire.ts +1280 -0
  258. package/src/mcp/zod.ts +1000 -0
  259. package/src/vscode/index.ts +2 -0
  260. package/src/vscode/messages.ts +704 -0
  261. package/src/workspace/index.ts +8 -1
  262. package/src/workspace/reconcile-electron.ts +65 -0
  263. package/src/workspace/types.ts +39 -1
  264. package/src/workspace/workspace-manager.ts +71 -10
  265. package/dist/chunk-GUNM43XZ.js +0 -63
  266. package/dist/chunk-GUNM43XZ.js.map +0 -1
  267. package/dist/chunk-IM7LCQJ6.js +0 -850
  268. package/dist/chunk-IM7LCQJ6.js.map +0 -1
  269. package/dist/chunk-ME76RUMR.js.map +0 -1
  270. package/dist/index-pgBHBQ9G.d.ts +0 -213
@@ -0,0 +1,301 @@
1
+ import { a as WorkspacePath } from './workspace-path-CWVrcuPL.js';
2
+
3
+ /** Stable error codes shared by every filesystem transport and backend. */
4
+ type FsErrorCode = 'invalid-path' | 'path-escape' | 'not-found' | 'already-exists' | 'type-mismatch' | 'not-empty' | 'permission-denied' | 'conflict' | 'quota-exceeded' | 'not-supported' | 'busy' | 'disposed' | 'closed' | 'aborted' | 'io';
5
+ type FsOperation = 'parse-path' | 'read' | 'stat' | 'list' | 'write' | 'create-directory' | 'remove' | 'move' | 'snapshot' | 'watch' | 'dispose';
6
+ /** Plain-data form safe to send over IPC, postMessage, or JSON. */
7
+ interface SerializedFsError {
8
+ readonly name: 'FsError';
9
+ readonly code: FsErrorCode;
10
+ readonly message: string;
11
+ readonly operation: FsOperation | null;
12
+ readonly path: string | null;
13
+ readonly destinationPath: string | null;
14
+ readonly retryable: boolean;
15
+ }
16
+ interface FsErrorContext {
17
+ readonly operation?: FsOperation;
18
+ readonly path?: string;
19
+ readonly destinationPath?: string;
20
+ readonly retryable?: boolean;
21
+ readonly defaultCode?: FsErrorCode;
22
+ }
23
+ /** Error with a stable code and a deliberately serializable public shape. */
24
+ declare class FsError extends Error {
25
+ readonly code: FsErrorCode;
26
+ readonly operation: FsOperation | null;
27
+ readonly path: string | null;
28
+ readonly destinationPath: string | null;
29
+ readonly retryable: boolean;
30
+ constructor(code: FsErrorCode, message: string, context?: FsErrorContext);
31
+ toJSON(): SerializedFsError;
32
+ }
33
+ declare function mapDomExceptionToFsErrorCode(name: string): FsErrorCode;
34
+ declare function mapNodeErrorCodeToFsErrorCode(code: string): FsErrorCode;
35
+ declare function isSerializedFsError(value: unknown): value is SerializedFsError;
36
+ declare function deserializeFsError(value: SerializedFsError): FsError;
37
+ declare function fsErrorFromUnknown(error: unknown, context?: FsErrorContext): FsError;
38
+ declare function serializeFsError(error: unknown, context?: FsErrorContext): SerializedFsError;
39
+ /**
40
+ * True when a storage backend rejected an operation because the origin or
41
+ * device is out of space. Covers typed `FsError`s (`'quota-exceeded'`, from
42
+ * DOMException `QuotaExceededError` or Node `ENOSPC`/`EDQUOT`), serialized
43
+ * transport copies, and raw DOMExceptions from backends that do not wrap
44
+ * their errors (e.g. the File System Access API) — including cross-realm
45
+ * instances where `instanceof DOMException` would fail.
46
+ */
47
+ declare function isQuotaExceededError(error: unknown): boolean;
48
+
49
+ /**
50
+ * Opaque provider-issued token representing one observed entry/tree state.
51
+ * Tokens support equality only within the issuing provider; callers must not
52
+ * parse them or assume a move or byte-identical rewrite changes the token.
53
+ * A token need not be a content hash, but it must change whenever the issuing
54
+ * provider observes a potentially different kind, payload, or descendant
55
+ * state. Detection of non-cooperating external changes is bounded by the
56
+ * backend's declared capabilities and metadata precision.
57
+ */
58
+ declare const fileSystemVersionBrand: unique symbol;
59
+ type FileSystemVersion = string & {
60
+ readonly [fileSystemVersionBrand]: 'FileSystemVersion';
61
+ };
62
+ /** Validate/rebrand a version received from a provider transport. */
63
+ declare function parseFileSystemVersion(value: unknown): FileSystemVersion;
64
+ declare function tryParseFileSystemVersion(value: unknown): FileSystemVersion | null;
65
+ /** `process` excludes this provider's local peers; `cross-context` also excludes cooperating tabs/processes. */
66
+ type FileSystemAtomicity = 'none' | 'process' | 'cross-context';
67
+ type FileSystemCaseSensitivity = 'sensitive' | 'insensitive' | 'platform';
68
+ type FileSystemDurability = 'volatile' | 'best-effort' | 'durable';
69
+ type FileSystemConditionalWriteStrength = 'none' | 'process' | 'cross-context' | 'storage-atomic';
70
+ type FileSystemSymlinkPolicy = 'unsupported' | 'reject' | 'follow-contained' | 'preserve';
71
+ /** Serializable feature declaration; consumers never need provider instanceof checks. */
72
+ interface FileSystemProviderCapabilities {
73
+ /** Isolation of one successful file replacement from cooperating writers. */
74
+ readonly writeAtomicity: FileSystemAtomicity;
75
+ /** Isolation of one successful source-to-destination move. */
76
+ readonly moveAtomicity: FileSystemAtomicity;
77
+ /** Writers excluded while one complete snapshot is captured. */
78
+ readonly snapshotAtomicity: FileSystemAtomicity;
79
+ /** Strongest boundary at which expectedVersion is checked with mutation. */
80
+ readonly conditionalWrite: FileSystemConditionalWriteStrength;
81
+ readonly recursiveRemove: boolean;
82
+ /** True only when watch has a real ready barrier and sequenced events. */
83
+ readonly watch: boolean;
84
+ readonly caseSensitivity: FileSystemCaseSensitivity;
85
+ readonly symlinkPolicy: FileSystemSymlinkPolicy;
86
+ readonly durability: FileSystemDurability;
87
+ }
88
+ interface FileSystemEntrySnapshotBase {
89
+ readonly path: WorkspacePath;
90
+ readonly name: string;
91
+ readonly version: FileSystemVersion;
92
+ /** ISO-8601 timestamp supplied by the backend; versions remain authoritative. */
93
+ readonly lastModified: string;
94
+ }
95
+ interface FileSystemFileSnapshot extends FileSystemEntrySnapshotBase {
96
+ readonly kind: 'file';
97
+ readonly size: number;
98
+ }
99
+ interface FileSystemDirectorySnapshot extends FileSystemEntrySnapshotBase {
100
+ readonly kind: 'directory';
101
+ readonly size: null;
102
+ }
103
+ type FileSystemEntrySnapshot = FileSystemFileSnapshot | FileSystemDirectorySnapshot;
104
+ /** A read always couples owned bytes to the exact metadata version they represent. */
105
+ interface FileSystemFileRead {
106
+ readonly entry: FileSystemFileSnapshot;
107
+ readonly data: ArrayBuffer;
108
+ }
109
+ interface FileSystemSnapshotFile extends FileSystemFileSnapshot {
110
+ readonly data: ArrayBuffer;
111
+ }
112
+ type FileSystemSnapshotEntry = FileSystemSnapshotFile | FileSystemDirectorySnapshot;
113
+ /**
114
+ * Complete best-available tree traversal. `snapshotAtomicity` declares
115
+ * whether concurrent local/cross-context mutations are excluded while it is
116
+ * captured. Implementations must never expose aliased buffers.
117
+ */
118
+ interface FileSystemSnapshot {
119
+ readonly version: FileSystemVersion;
120
+ readonly entries: readonly FileSystemSnapshotEntry[];
121
+ }
122
+ type FileSystemWriteMode = 'upsert' | 'create' | 'replace';
123
+ interface FileSystemWriteOptions {
124
+ /** Defaults to upsert. */
125
+ readonly mode?: FileSystemWriteMode;
126
+ /** Defaults to false so structure creation is never implicit. */
127
+ readonly createParents?: boolean;
128
+ /** null means the entry must not exist; a token requires an exact match. */
129
+ readonly expectedVersion?: FileSystemVersion | null;
130
+ }
131
+ type FileSystemCreateDirectoryMode = 'ensure' | 'create';
132
+ interface FileSystemCreateDirectoryOptions {
133
+ /** Defaults to ensure (idempotently return an existing directory). */
134
+ readonly mode?: FileSystemCreateDirectoryMode;
135
+ /** Defaults to false. */
136
+ readonly createParents?: boolean;
137
+ }
138
+ interface FileSystemRemoveOptions {
139
+ /** Defaults to false; non-empty directories otherwise fail with not-empty. */
140
+ readonly recursive?: boolean;
141
+ /** Defaults to error. */
142
+ readonly missing?: 'ignore' | 'error';
143
+ readonly expectedVersion?: FileSystemVersion;
144
+ }
145
+ interface FileSystemRemoveResult {
146
+ readonly removed: boolean;
147
+ /** Version of the complete tree after the removal attempt. */
148
+ readonly version: FileSystemVersion;
149
+ }
150
+ interface FileSystemMoveOptions {
151
+ /** Defaults to false. Destinations are never overwritten. */
152
+ readonly createParents?: boolean;
153
+ readonly expectedVersion?: FileSystemVersion;
154
+ }
155
+ type FileSystemWatchEventType = 'created' | 'modified' | 'removed' | 'moved' | 'overflow';
156
+ type FileSystemWatchEventOrigin = 'local' | 'external' | 'unknown';
157
+ interface FileSystemWatchEventBase {
158
+ readonly sequence: number;
159
+ readonly origin: FileSystemWatchEventOrigin;
160
+ readonly path: WorkspacePath;
161
+ }
162
+ interface FileSystemEntryWatchEvent extends FileSystemWatchEventBase {
163
+ readonly type: Exclude<FileSystemWatchEventType, 'overflow'>;
164
+ readonly kind: 'file' | 'directory';
165
+ readonly destinationPath: WorkspacePath | null;
166
+ readonly version: FileSystemVersion | null;
167
+ readonly previousVersion: FileSystemVersion | null;
168
+ }
169
+ interface FileSystemOverflowWatchEvent extends FileSystemWatchEventBase {
170
+ readonly type: 'overflow';
171
+ readonly kind: null;
172
+ readonly destinationPath: null;
173
+ readonly version: null;
174
+ readonly previousVersion: null;
175
+ }
176
+ type FileSystemWatchEvent = FileSystemEntryWatchEvent | FileSystemOverflowWatchEvent;
177
+ type FileSystemWatchListener = (event: FileSystemWatchEvent) => void;
178
+ type FileSystemWatchErrorListener = (error: FsError) => void;
179
+ interface FileSystemWatchOptions {
180
+ readonly onError?: FileSystemWatchErrorListener;
181
+ }
182
+ interface FileSystemWatchSubscription {
183
+ readonly closed: boolean;
184
+ /** Resolves after the backend watch is installed and no initial event can be missed. */
185
+ readonly ready: Promise<void>;
186
+ /** Idempotent and awaitable so resource release can join provider shutdown. */
187
+ dispose(): Promise<void>;
188
+ }
189
+ /**
190
+ * Correctness-first filesystem contract. Every logical path has exactly one
191
+ * kind and one byte payload; conditional writes and lifecycle disposal are
192
+ * mandatory rather than optional provider extensions.
193
+ */
194
+ interface FileSystemProviderV2 {
195
+ readonly id: string;
196
+ readonly label: string;
197
+ readonly capabilities: FileSystemProviderCapabilities;
198
+ /** Absence is represented only by null; permission/I/O/wrong-kind errors throw FsError. */
199
+ stat(path: WorkspacePath): Promise<FileSystemEntrySnapshot | null>;
200
+ /** Absence is represented only by null; a directory at path is type-mismatch. */
201
+ readFile(path: WorkspacePath): Promise<FileSystemFileRead | null>;
202
+ /** Missing paths and file paths throw; results are canonical and deterministic. */
203
+ readDirectory(path: WorkspacePath): Promise<readonly FileSystemEntrySnapshot[]>;
204
+ writeFile(path: WorkspacePath, data: ArrayBuffer | Uint8Array, options?: FileSystemWriteOptions): Promise<FileSystemFileSnapshot>;
205
+ createDirectory(path: WorkspacePath, options?: FileSystemCreateDirectoryOptions): Promise<FileSystemDirectorySnapshot>;
206
+ remove(path: WorkspacePath, options?: FileSystemRemoveOptions): Promise<FileSystemRemoveResult>;
207
+ move(oldPath: WorkspacePath, newPath: WorkspacePath, options?: FileSystemMoveOptions): Promise<FileSystemEntrySnapshot>;
208
+ snapshot(): Promise<FileSystemSnapshot>;
209
+ /**
210
+ * Always returns a disposable subscription. When `capabilities.watch` is
211
+ * false, `ready` rejects with `FsError('not-supported')` and `onError`
212
+ * observes the same failure; callers can therefore use one cleanup path.
213
+ */
214
+ watch(listener: FileSystemWatchListener, options?: FileSystemWatchOptions): FileSystemWatchSubscription;
215
+ dispose(): Promise<void>;
216
+ }
217
+
218
+ /**
219
+ * FileSystemProvider — abstract interface for a virtual filesystem.
220
+ *
221
+ * Legacy text-oriented facade retained while consumers migrate to
222
+ * FileSystemProviderV2. New persistence code must use the provider's `v2`
223
+ * contract so paths, errors, operation modes, and capabilities are explicit.
224
+ */
225
+
226
+ interface FileEntry {
227
+ kind: 'file';
228
+ name: string;
229
+ path: string;
230
+ }
231
+ interface FolderEntry {
232
+ kind: 'directory';
233
+ name: string;
234
+ path: string;
235
+ }
236
+ type FileSystemEntry = FileEntry | FolderEntry;
237
+ interface FileMeta {
238
+ name: string;
239
+ path: string;
240
+ size: number;
241
+ lastModified: string;
242
+ }
243
+ type FileCommitResult = {
244
+ status: 'committed';
245
+ version: string | null;
246
+ } | {
247
+ status: 'conflict';
248
+ content: string | null;
249
+ version: string | null;
250
+ };
251
+ /**
252
+ * @deprecated Compatibility facade for external providers and older callers.
253
+ * Implement new backends with `FileSystemProviderV2`; built-in facades expose
254
+ * their authoritative implementation through `v2`.
255
+ */
256
+ interface FileSystemProvider {
257
+ /** Unique identifier for this provider instance. */
258
+ readonly id: string;
259
+ /** Human-readable label (e.g., folder name or "Browser Storage"). */
260
+ readonly label: string;
261
+ /** Optional correctness-first implementation exposed during the v1-to-v2 migration. */
262
+ readonly v2?: FileSystemProviderV2;
263
+ /** Read the text content of a file. Returns null if the file doesn't exist. */
264
+ readFile(path: string): Promise<string | null>;
265
+ /** Write text content to a file, creating it (and parent dirs) if needed. */
266
+ writeFile(path: string, content: string): Promise<void>;
267
+ /**
268
+ * Conditionally replace a text file when it still matches the caller's
269
+ * persisted baseline. Production providers implement this at their
270
+ * strongest available serialization boundary.
271
+ */
272
+ commitFile?(path: string, content: string, expectedContent: string | null): Promise<FileCommitResult>;
273
+ /**
274
+ * Legacy recursive removal of a file or directory subtree. Workspace root
275
+ * deletion is forbidden. Prefer v2 `remove({ recursive })`.
276
+ */
277
+ delete(path: string): Promise<void>;
278
+ /** Rename or move an entry. Rejects missing sources and existing destinations. */
279
+ rename(oldPath: string, newPath: string): Promise<void>;
280
+ /** List immediate children of a directory. */
281
+ readDirectory(path: string): Promise<FileSystemEntry[]>;
282
+ /** Check whether a path exists. */
283
+ exists(path: string): Promise<boolean>;
284
+ /** Create a directory (and parents if needed). */
285
+ createDirectory(path: string): Promise<void>;
286
+ /** Get metadata for a file. Returns null if not found. */
287
+ stat(path: string): Promise<FileMeta | null>;
288
+ /** Read raw binary content. Returns null if not found. */
289
+ readBinary(path: string): Promise<ArrayBuffer | null>;
290
+ /** Write raw binary content. */
291
+ writeBinary(path: string, data: ArrayBuffer | Uint8Array): Promise<void>;
292
+ }
293
+ type FileSystemProviderWithV2 = FileSystemProvider & {
294
+ readonly v2: FileSystemProviderV2;
295
+ };
296
+ /** Discover a provider-owned v2 implementation without coupling consumers to a concrete class. */
297
+ declare function hasFileSystemProviderV2(provider: FileSystemProvider): provider is FileSystemProviderWithV2;
298
+ /** Return the provider-owned v2 implementation when migration support is available. */
299
+ declare function getFileSystemProviderV2(provider: FileSystemProvider): FileSystemProviderV2 | null;
300
+
301
+ export { tryParseFileSystemVersion as $, type FileSystemVersion as A, type FileSystemWatchErrorListener as B, type FileSystemWatchEvent as C, type FileSystemWatchEventOrigin as D, type FileSystemWatchEventType as E, type FileCommitResult as F, type FileSystemWatchListener as G, type FileSystemWatchOptions as H, type FileSystemWatchSubscription as I, type FileSystemWriteMode as J, type FileSystemWriteOptions as K, type FolderEntry as L, FsError as M, type FsErrorCode as N, type FsErrorContext as O, type FsOperation as P, deserializeFsError as Q, fsErrorFromUnknown as R, type SerializedFsError as S, getFileSystemProviderV2 as T, hasFileSystemProviderV2 as U, isQuotaExceededError as V, isSerializedFsError as W, mapDomExceptionToFsErrorCode as X, mapNodeErrorCodeToFsErrorCode as Y, parseFileSystemVersion as Z, serializeFsError as _, type FileEntry as a, type FileMeta as b, type FileSystemAtomicity as c, type FileSystemCaseSensitivity as d, type FileSystemConditionalWriteStrength as e, type FileSystemCreateDirectoryMode as f, type FileSystemCreateDirectoryOptions as g, type FileSystemDirectorySnapshot as h, type FileSystemDurability as i, type FileSystemEntry as j, type FileSystemEntrySnapshot as k, type FileSystemEntryWatchEvent as l, type FileSystemFileRead as m, type FileSystemFileSnapshot as n, type FileSystemMoveOptions as o, type FileSystemOverflowWatchEvent as p, type FileSystemProvider as q, type FileSystemProviderCapabilities as r, type FileSystemProviderV2 as s, type FileSystemProviderWithV2 as t, type FileSystemRemoveOptions as u, type FileSystemRemoveResult as v, type FileSystemSnapshot as w, type FileSystemSnapshotEntry as x, type FileSystemSnapshotFile as y, type FileSystemSymlinkPolicy as z };