@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.
Files changed (278) hide show
  1. package/README.md +2 -2
  2. package/dist/{chunk-2D7Y4IR3.js → chunk-4437YWLE.js} +123 -67
  3. package/dist/{chunk-5MYAICRE.js → chunk-45T5AFCN.js} +44 -57
  4. package/dist/{chunk-PGR7LK6D.js → chunk-6L3JRDE7.js} +14 -6
  5. package/dist/{chunk-RVQHY3XU.js → chunk-6XHOOBYF.js} +0 -1
  6. package/dist/chunk-73OOROXH.js +8 -0
  7. package/dist/{chunk-SI2LU2RP.js → chunk-AYWKIZLD.js} +1 -1
  8. package/dist/{chunk-GCPBEMMH.js → chunk-BVY7GGNV.js} +10 -21
  9. package/dist/{chunk-AEHCVWU5.js → chunk-DZB666V7.js} +0 -1
  10. package/dist/{chunk-75UUF6C4.js → chunk-HI7QEWL6.js} +18 -10
  11. package/dist/chunk-KQ6756AJ.js +28 -0
  12. package/dist/chunk-LMMOFRGQ.js +148 -0
  13. package/dist/{chunk-FNW556FN.js → chunk-M2PUNKHS.js} +0 -1
  14. package/dist/chunk-M5ZNQGR5.js +19 -0
  15. package/dist/chunk-M62ZGJ5I.js +51 -0
  16. package/dist/chunk-OQCPBOQA.js +168 -0
  17. package/dist/{chunk-EGNDADXB.js → chunk-QI6YKTQV.js} +2 -3
  18. package/dist/chunk-SJBB5OD7.js +227 -0
  19. package/dist/{chunk-EZKJZUNJ.js → chunk-XAMILHQP.js} +0 -1
  20. package/dist/{chunk-J32GU3F3.js → chunk-YM7O3PWO.js} +249 -222
  21. package/dist/{chunk-RQJRQF46.js → chunk-ZO7G53QP.js} +41 -49
  22. package/dist/document/index.d.ts +358 -6
  23. package/dist/document/index.js +24 -4
  24. package/dist/filesystem/electron.d.ts +73 -4
  25. package/dist/filesystem/electron.js +16 -4
  26. package/dist/filesystem/index.d.ts +228 -22
  27. package/dist/filesystem/index.js +133 -20
  28. package/dist/filesystem/indexeddb.d.ts +284 -5
  29. package/dist/filesystem/indexeddb.js +22 -5
  30. package/dist/filesystem/memory.d.ts +152 -4
  31. package/dist/filesystem/memory.js +12 -4
  32. package/dist/filesystem/native.d.ts +136 -4
  33. package/dist/filesystem/native.js +27 -4
  34. package/dist/host/index.d.ts +32 -9
  35. package/dist/host/index.js +26 -30
  36. package/dist/index.d.ts +14 -10
  37. package/dist/index.js +204 -10
  38. package/dist/mcp/index.d.ts +33 -4
  39. package/dist/mcp/index.js +31 -4
  40. package/dist/mcp/zod.d.ts +645 -643
  41. package/dist/mcp/zod.js +700 -885
  42. package/dist/share/index.d.ts +43 -0
  43. package/dist/share/index.js +12 -0
  44. package/dist/{types-CsX6EN2t.d.ts → types-BEg5SQ1_.d.ts} +1 -1
  45. package/dist/{types-eOlt9J7n.d.ts → types-CueK0tvU.d.ts} +34 -11
  46. package/dist/vscode/index.d.ts +225 -3
  47. package/dist/vscode/index.js +389 -3
  48. package/dist/workspace/index.d.ts +141 -4
  49. package/dist/workspace/index.js +28 -3
  50. package/package.json +10 -5
  51. package/dist/chunk-2D7Y4IR3.js.map +0 -1
  52. package/dist/chunk-5MYAICRE.js.map +0 -1
  53. package/dist/chunk-75UUF6C4.js.map +0 -1
  54. package/dist/chunk-AEHCVWU5.js.map +0 -1
  55. package/dist/chunk-AYZ4HN5M.js +0 -20
  56. package/dist/chunk-AYZ4HN5M.js.map +0 -1
  57. package/dist/chunk-EGNDADXB.js.map +0 -1
  58. package/dist/chunk-EZKJZUNJ.js.map +0 -1
  59. package/dist/chunk-FNW556FN.js.map +0 -1
  60. package/dist/chunk-GCPBEMMH.js.map +0 -1
  61. package/dist/chunk-J32GU3F3.js.map +0 -1
  62. package/dist/chunk-PGR7LK6D.js.map +0 -1
  63. package/dist/chunk-RQJRQF46.js.map +0 -1
  64. package/dist/chunk-RVQHY3XU.js.map +0 -1
  65. package/dist/chunk-SI2LU2RP.js.map +0 -1
  66. package/dist/chunk-W5UUUII5.js +0 -142
  67. package/dist/chunk-W5UUUII5.js.map +0 -1
  68. package/dist/document/document-session.d.ts +0 -127
  69. package/dist/document/document-session.d.ts.map +0 -1
  70. package/dist/document/document-session.js +0 -749
  71. package/dist/document/document-session.js.map +0 -1
  72. package/dist/document/filesystem-target.d.ts +0 -17
  73. package/dist/document/filesystem-target.d.ts.map +0 -1
  74. package/dist/document/filesystem-target.js +0 -70
  75. package/dist/document/filesystem-target.js.map +0 -1
  76. package/dist/document/index.d.ts.map +0 -1
  77. package/dist/document/index.js.map +0 -1
  78. package/dist/document/recovery-journal.d.ts +0 -125
  79. package/dist/document/recovery-journal.d.ts.map +0 -1
  80. package/dist/document/recovery-journal.js +0 -385
  81. package/dist/document/recovery-journal.js.map +0 -1
  82. package/dist/document/types.d.ts +0 -89
  83. package/dist/document/types.d.ts.map +0 -1
  84. package/dist/document/types.js +0 -9
  85. package/dist/document/types.js.map +0 -1
  86. package/dist/filesystem/commit-lock.d.ts +0 -3
  87. package/dist/filesystem/commit-lock.d.ts.map +0 -1
  88. package/dist/filesystem/commit-lock.js +0 -20
  89. package/dist/filesystem/commit-lock.js.map +0 -1
  90. package/dist/filesystem/dbk-workspace.d.ts +0 -34
  91. package/dist/filesystem/dbk-workspace.d.ts.map +0 -1
  92. package/dist/filesystem/dbk-workspace.js +0 -85
  93. package/dist/filesystem/dbk-workspace.js.map +0 -1
  94. package/dist/filesystem/electron-provider-v2.d.ts +0 -36
  95. package/dist/filesystem/electron-provider-v2.d.ts.map +0 -1
  96. package/dist/filesystem/electron-provider-v2.js +0 -503
  97. package/dist/filesystem/electron-provider-v2.js.map +0 -1
  98. package/dist/filesystem/electron-provider.d.ts +0 -35
  99. package/dist/filesystem/electron-provider.d.ts.map +0 -1
  100. package/dist/filesystem/electron-provider.js +0 -69
  101. package/dist/filesystem/electron-provider.js.map +0 -1
  102. package/dist/filesystem/electron.d.ts.map +0 -1
  103. package/dist/filesystem/electron.js.map +0 -1
  104. package/dist/filesystem/file-media-provider.d.ts +0 -23
  105. package/dist/filesystem/file-media-provider.d.ts.map +0 -1
  106. package/dist/filesystem/file-media-provider.js +0 -85
  107. package/dist/filesystem/file-media-provider.js.map +0 -1
  108. package/dist/filesystem/filesystem-content-container.d.ts +0 -24
  109. package/dist/filesystem/filesystem-content-container.d.ts.map +0 -1
  110. package/dist/filesystem/filesystem-content-container.js +0 -153
  111. package/dist/filesystem/filesystem-content-container.js.map +0 -1
  112. package/dist/filesystem/fs-error.d.ts +0 -46
  113. package/dist/filesystem/fs-error.d.ts.map +0 -1
  114. package/dist/filesystem/fs-error.js +0 -170
  115. package/dist/filesystem/fs-error.js.map +0 -1
  116. package/dist/filesystem/index.d.ts.map +0 -1
  117. package/dist/filesystem/index.js.map +0 -1
  118. package/dist/filesystem/indexeddb-content-container.d.ts +0 -22
  119. package/dist/filesystem/indexeddb-content-container.d.ts.map +0 -1
  120. package/dist/filesystem/indexeddb-content-container.js +0 -100
  121. package/dist/filesystem/indexeddb-content-container.js.map +0 -1
  122. package/dist/filesystem/indexeddb-provider-v2.d.ts +0 -96
  123. package/dist/filesystem/indexeddb-provider-v2.d.ts.map +0 -1
  124. package/dist/filesystem/indexeddb-provider-v2.js +0 -1241
  125. package/dist/filesystem/indexeddb-provider-v2.js.map +0 -1
  126. package/dist/filesystem/indexeddb-provider.d.ts +0 -39
  127. package/dist/filesystem/indexeddb-provider.d.ts.map +0 -1
  128. package/dist/filesystem/indexeddb-provider.js +0 -145
  129. package/dist/filesystem/indexeddb-provider.js.map +0 -1
  130. package/dist/filesystem/indexeddb-store.d.ts +0 -34
  131. package/dist/filesystem/indexeddb-store.d.ts.map +0 -1
  132. package/dist/filesystem/indexeddb-store.js +0 -165
  133. package/dist/filesystem/indexeddb-store.js.map +0 -1
  134. package/dist/filesystem/indexeddb.d.ts.map +0 -1
  135. package/dist/filesystem/indexeddb.js.map +0 -1
  136. package/dist/filesystem/legacy-v2-adapter.d.ts +0 -62
  137. package/dist/filesystem/legacy-v2-adapter.d.ts.map +0 -1
  138. package/dist/filesystem/legacy-v2-adapter.js +0 -499
  139. package/dist/filesystem/legacy-v2-adapter.js.map +0 -1
  140. package/dist/filesystem/memory-provider-v2.d.ts +0 -92
  141. package/dist/filesystem/memory-provider-v2.d.ts.map +0 -1
  142. package/dist/filesystem/memory-provider-v2.js +0 -615
  143. package/dist/filesystem/memory-provider-v2.js.map +0 -1
  144. package/dist/filesystem/memory-provider.d.ts +0 -54
  145. package/dist/filesystem/memory-provider.d.ts.map +0 -1
  146. package/dist/filesystem/memory-provider.js +0 -132
  147. package/dist/filesystem/memory-provider.js.map +0 -1
  148. package/dist/filesystem/memory.d.ts.map +0 -1
  149. package/dist/filesystem/memory.js.map +0 -1
  150. package/dist/filesystem/move-entry.d.ts +0 -9
  151. package/dist/filesystem/move-entry.d.ts.map +0 -1
  152. package/dist/filesystem/move-entry.js +0 -103
  153. package/dist/filesystem/move-entry.js.map +0 -1
  154. package/dist/filesystem/move-error.d.ts +0 -53
  155. package/dist/filesystem/move-error.d.ts.map +0 -1
  156. package/dist/filesystem/move-error.js +0 -99
  157. package/dist/filesystem/move-error.js.map +0 -1
  158. package/dist/filesystem/native-provider-v2.d.ts +0 -75
  159. package/dist/filesystem/native-provider-v2.d.ts.map +0 -1
  160. package/dist/filesystem/native-provider-v2.js +0 -849
  161. package/dist/filesystem/native-provider-v2.js.map +0 -1
  162. package/dist/filesystem/native-provider.d.ts +0 -53
  163. package/dist/filesystem/native-provider.d.ts.map +0 -1
  164. package/dist/filesystem/native-provider.js +0 -471
  165. package/dist/filesystem/native-provider.js.map +0 -1
  166. package/dist/filesystem/native.d.ts.map +0 -1
  167. package/dist/filesystem/native.js.map +0 -1
  168. package/dist/filesystem/types.d.ts +0 -83
  169. package/dist/filesystem/types.d.ts.map +0 -1
  170. package/dist/filesystem/types.js +0 -16
  171. package/dist/filesystem/types.js.map +0 -1
  172. package/dist/filesystem/v2.d.ts +0 -172
  173. package/dist/filesystem/v2.d.ts.map +0 -1
  174. package/dist/filesystem/v2.js +0 -16
  175. package/dist/filesystem/v2.js.map +0 -1
  176. package/dist/filesystem/workspace-path.d.ts +0 -21
  177. package/dist/filesystem/workspace-path.d.ts.map +0 -1
  178. package/dist/filesystem/workspace-path.js +0 -80
  179. package/dist/filesystem/workspace-path.js.map +0 -1
  180. package/dist/host/filesystem-v2.d.ts +0 -45
  181. package/dist/host/filesystem-v2.d.ts.map +0 -1
  182. package/dist/host/filesystem-v2.js +0 -13
  183. package/dist/host/filesystem-v2.js.map +0 -1
  184. package/dist/host/git.d.ts +0 -200
  185. package/dist/host/git.d.ts.map +0 -1
  186. package/dist/host/git.js +0 -15
  187. package/dist/host/git.js.map +0 -1
  188. package/dist/host/index.d.ts.map +0 -1
  189. package/dist/host/index.js.map +0 -1
  190. package/dist/host/types.d.ts +0 -232
  191. package/dist/host/types.d.ts.map +0 -1
  192. package/dist/host/types.js +0 -10
  193. package/dist/host/types.js.map +0 -1
  194. package/dist/host/wire-policy.d.ts +0 -22
  195. package/dist/host/wire-policy.d.ts.map +0 -1
  196. package/dist/host/wire-policy.js +0 -92
  197. package/dist/host/wire-policy.js.map +0 -1
  198. package/dist/index.d.ts.map +0 -1
  199. package/dist/index.js.map +0 -1
  200. package/dist/mcp/index.d.ts.map +0 -1
  201. package/dist/mcp/index.js.map +0 -1
  202. package/dist/mcp/types.d.ts +0 -466
  203. package/dist/mcp/types.d.ts.map +0 -1
  204. package/dist/mcp/types.js +0 -25
  205. package/dist/mcp/types.js.map +0 -1
  206. package/dist/mcp/wire.d.ts +0 -29
  207. package/dist/mcp/wire.d.ts.map +0 -1
  208. package/dist/mcp/wire.js +0 -1046
  209. package/dist/mcp/wire.js.map +0 -1
  210. package/dist/mcp/zod.d.ts.map +0 -1
  211. package/dist/mcp/zod.js.map +0 -1
  212. package/dist/vscode/index.d.ts.map +0 -1
  213. package/dist/vscode/index.js.map +0 -1
  214. package/dist/vscode/messages.d.ts +0 -204
  215. package/dist/vscode/messages.d.ts.map +0 -1
  216. package/dist/vscode/messages.js +0 -494
  217. package/dist/vscode/messages.js.map +0 -1
  218. package/dist/workspace/index.d.ts.map +0 -1
  219. package/dist/workspace/index.js.map +0 -1
  220. package/dist/workspace/reconcile-electron.d.ts +0 -19
  221. package/dist/workspace/reconcile-electron.d.ts.map +0 -1
  222. package/dist/workspace/reconcile-electron.js +0 -42
  223. package/dist/workspace/reconcile-electron.js.map +0 -1
  224. package/dist/workspace/types.d.ts +0 -69
  225. package/dist/workspace/types.d.ts.map +0 -1
  226. package/dist/workspace/types.js +0 -2
  227. package/dist/workspace/types.js.map +0 -1
  228. package/dist/workspace/workspace-manager.d.ts +0 -47
  229. package/dist/workspace/workspace-manager.d.ts.map +0 -1
  230. package/dist/workspace/workspace-manager.js +0 -126
  231. package/dist/workspace/workspace-manager.js.map +0 -1
  232. package/src/document/document-session.ts +0 -834
  233. package/src/document/filesystem-target.ts +0 -109
  234. package/src/document/index.ts +0 -41
  235. package/src/document/recovery-journal.ts +0 -536
  236. package/src/document/types.ts +0 -116
  237. package/src/filesystem/commit-lock.ts +0 -29
  238. package/src/filesystem/dbk-workspace.ts +0 -135
  239. package/src/filesystem/electron-provider-v2.ts +0 -630
  240. package/src/filesystem/electron-provider.ts +0 -99
  241. package/src/filesystem/electron.ts +0 -3
  242. package/src/filesystem/file-media-provider.ts +0 -103
  243. package/src/filesystem/filesystem-content-container.ts +0 -164
  244. package/src/filesystem/fs-error.ts +0 -234
  245. package/src/filesystem/index.ts +0 -143
  246. package/src/filesystem/indexeddb-content-container.ts +0 -112
  247. package/src/filesystem/indexeddb-provider-v2.ts +0 -1740
  248. package/src/filesystem/indexeddb-provider.ts +0 -171
  249. package/src/filesystem/indexeddb-store.ts +0 -207
  250. package/src/filesystem/indexeddb.ts +0 -12
  251. package/src/filesystem/legacy-v2-adapter.ts +0 -779
  252. package/src/filesystem/memory-provider-v2.ts +0 -896
  253. package/src/filesystem/memory-provider.ts +0 -180
  254. package/src/filesystem/memory.ts +0 -15
  255. package/src/filesystem/move-entry.ts +0 -142
  256. package/src/filesystem/move-error.ts +0 -159
  257. package/src/filesystem/native-provider-v2.ts +0 -1165
  258. package/src/filesystem/native-provider.ts +0 -537
  259. package/src/filesystem/native.ts +0 -16
  260. package/src/filesystem/types.ts +0 -114
  261. package/src/filesystem/v2.ts +0 -231
  262. package/src/filesystem/workspace-path.ts +0 -92
  263. package/src/host/filesystem-v2.ts +0 -104
  264. package/src/host/git.ts +0 -246
  265. package/src/host/index.ts +0 -93
  266. package/src/host/types.ts +0 -274
  267. package/src/host/wire-policy.ts +0 -103
  268. package/src/index.ts +0 -10
  269. package/src/mcp/index.ts +0 -3
  270. package/src/mcp/types.ts +0 -594
  271. package/src/mcp/wire.ts +0 -1280
  272. package/src/mcp/zod.ts +0 -1000
  273. package/src/vscode/index.ts +0 -2
  274. package/src/vscode/messages.ts +0 -704
  275. package/src/workspace/index.ts +0 -17
  276. package/src/workspace/reconcile-electron.ts +0 -65
  277. package/src/workspace/types.ts +0 -67
  278. package/src/workspace/workspace-manager.ts +0 -151
@@ -1,6 +1,15 @@
1
1
  import {
2
+ parentChainWithRoot
3
+ } from "./chunk-KQ6756AJ.js";
4
+ import {
5
+ compareSnapshotsByName,
6
+ compareText,
7
+ copyBytes,
2
8
  parseFileSystemVersion
3
- } from "./chunk-AYZ4HN5M.js";
9
+ } from "./chunk-M62ZGJ5I.js";
10
+ import {
11
+ decodeUtf8Text
12
+ } from "./chunk-M5ZNQGR5.js";
4
13
  import {
5
14
  FsError,
6
15
  WORKSPACE_ROOT,
@@ -8,7 +17,7 @@ import {
8
17
  workspacePathBasename,
9
18
  workspacePathContains,
10
19
  workspacePathDirname
11
- } from "./chunk-SI2LU2RP.js";
20
+ } from "./chunk-AYWKIZLD.js";
12
21
 
13
22
  // src/filesystem/memory-provider-v2.ts
14
23
  var MEMORY_CAPABILITIES = Object.freeze({
@@ -126,7 +135,7 @@ var MemoryFileSystemProviderV2 = class {
126
135
  "Replacement path has conflicting file and directory kinds."
127
136
  );
128
137
  }
129
- for (const parent of parentChain(path)) {
138
+ for (const parent of parentChainWithRoot(path)) {
130
139
  if (parent && stagedFiles.has(parent)) {
131
140
  throw this.error("type-mismatch", "write", parent, "A replacement parent is a file.");
132
141
  }
@@ -185,8 +194,12 @@ var MemoryFileSystemProviderV2 = class {
185
194
  if (existing?.kind === "directory") {
186
195
  throw this.error("type-mismatch", "write", canonical, "Cannot replace a directory.");
187
196
  }
188
- const currentContent = existing?.kind === "file" && existing.payloadKind === "text" ? new TextDecoder().decode(existing.data) : null;
189
- if (existing?.kind === "file" && existing.payloadKind === "binary" || currentContent !== expectedContent && currentContent !== content) {
197
+ const currentContent = existing?.kind === "file" ? decodeUtf8Text(existing.data, {
198
+ label: "The stored file",
199
+ operation: "write",
200
+ path: canonical
201
+ }) : null;
202
+ if (currentContent !== expectedContent && currentContent !== content) {
190
203
  return {
191
204
  status: "conflict",
192
205
  content: currentContent,
@@ -246,7 +259,7 @@ var MemoryFileSystemProviderV2 = class {
246
259
  children.push(this.toEntrySnapshot(entryPath2, entry));
247
260
  }
248
261
  }
249
- children.sort(compareSnapshots);
262
+ children.sort(compareSnapshotsByName);
250
263
  return Object.freeze(children);
251
264
  }
252
265
  async writeFile(path, data, options = {}) {
@@ -537,7 +550,7 @@ var MemoryFileSystemProviderV2 = class {
537
550
  }
538
551
  planParents(path, createParents, operation) {
539
552
  const missing = [];
540
- for (const parent of parentChain(path)) {
553
+ for (const parent of parentChainWithRoot(path)) {
541
554
  if (!parent) continue;
542
555
  const entry = this.entries.get(parent);
543
556
  if (entry?.kind === "file") {
@@ -563,7 +576,7 @@ var MemoryFileSystemProviderV2 = class {
563
576
  }
564
577
  }
565
578
  touchParents(target, path, version, lastModified) {
566
- for (const parent of parentChain(path)) {
579
+ for (const parent of parentChainWithRoot(path)) {
567
580
  const entry = target.get(parent);
568
581
  if (entry?.kind === "directory") {
569
582
  target.set(parent, { kind: "directory", version, lastModified });
@@ -635,36 +648,14 @@ var MemoryFileSystemProviderV2 = class {
635
648
  return new FsError(code, message, { operation, path });
636
649
  }
637
650
  };
638
- function parentChain(path) {
639
- const parents = [];
640
- let current = workspacePathDirname(path);
641
- while (true) {
642
- parents.unshift(current);
643
- if (!current) return parents;
644
- current = workspacePathDirname(current);
645
- }
646
- }
647
651
  function addParentPaths(target, path) {
648
- for (const parent of parentChain(path)) {
652
+ for (const parent of parentChainWithRoot(path)) {
649
653
  if (parent) target.add(parent);
650
654
  }
651
655
  }
652
656
  function isMemoryFilePayloadKind(value) {
653
657
  return value === "text" || value === "binary";
654
658
  }
655
- function copyBytes(data) {
656
- const source = ArrayBuffer.isView(data) ? new Uint8Array(data.buffer, data.byteOffset, data.byteLength) : new Uint8Array(data);
657
- const copy = new Uint8Array(source.byteLength);
658
- copy.set(source);
659
- return copy.buffer;
660
- }
661
- function compareSnapshots(left, right) {
662
- if (left.kind !== right.kind) return left.kind === "directory" ? -1 : 1;
663
- return compareText(left.name, right.name);
664
- }
665
- function compareText(left, right) {
666
- return left < right ? -1 : left > right ? 1 : 0;
667
- }
668
659
 
669
660
  // src/filesystem/memory-provider.ts
670
661
  function canonicalPath(path) {
@@ -680,8 +671,8 @@ function entryPath(path, operation) {
680
671
  }
681
672
  return canonical;
682
673
  }
683
- function decode(data) {
684
- return new TextDecoder().decode(data);
674
+ function decode(data, path) {
675
+ return decodeUtf8Text(data, { label: "The file", operation: "read", path });
685
676
  }
686
677
  var MemoryFileSystemProvider = class {
687
678
  constructor(id, label) {
@@ -698,7 +689,7 @@ var MemoryFileSystemProvider = class {
698
689
  const state = this.v2.captureState();
699
690
  return {
700
691
  files: state.files.map(
701
- (file) => file.payloadKind === "text" ? { kind: "text", path: file.path, content: decode(file.data) } : { kind: "binary", path: file.path, data: file.data.slice(0) }
692
+ (file) => file.payloadKind === "text" ? { kind: "text", path: file.path, content: decode(file.data, file.path) } : { kind: "binary", path: file.path, data: file.data.slice(0) }
702
693
  ),
703
694
  directories: [...state.directories]
704
695
  };
@@ -720,20 +711,21 @@ var MemoryFileSystemProvider = class {
720
711
  this.v2.seedText(entryPath(path, "write"), content);
721
712
  }
722
713
  async readFile(path) {
723
- const file = await this.v2.readFile(entryPath(path, "read"));
724
- return file ? decode(file.data) : null;
714
+ const canonical = canonicalPath(path);
715
+ const file = await this.v2.readFile(canonical);
716
+ return file ? decode(file.data, canonical) : null;
725
717
  }
726
718
  async writeFile(path, content) {
727
- await this.v2.writeText(entryPath(path, "write"), content, { createParents: true });
719
+ await this.v2.writeText(canonicalPath(path), content, { createParents: true });
728
720
  }
729
721
  commitFile(path, content, expectedContent) {
730
- return this.v2.commitText(entryPath(path, "write"), content, expectedContent);
722
+ return this.v2.commitText(canonicalPath(path), content, expectedContent);
731
723
  }
732
724
  async delete(path) {
733
- await this.v2.remove(entryPath(path, "remove"), { recursive: true, missing: "ignore" });
725
+ await this.v2.remove(canonicalPath(path), { recursive: true, missing: "ignore" });
734
726
  }
735
727
  async rename(oldPath, newPath) {
736
- await this.v2.move(entryPath(oldPath, "move"), entryPath(newPath, "move"), {
728
+ await this.v2.move(canonicalPath(oldPath), canonicalPath(newPath), {
737
729
  createParents: true
738
730
  });
739
731
  }
@@ -758,9 +750,7 @@ var MemoryFileSystemProvider = class {
758
750
  await this.v2.createDirectory(canonicalPath(path), { createParents: true });
759
751
  }
760
752
  async stat(path) {
761
- const canonical = canonicalPath(path);
762
- if (!canonical) return null;
763
- const entry = await this.v2.stat(canonical);
753
+ const entry = await this.v2.stat(canonicalPath(path));
764
754
  if (!entry || entry.kind !== "file") return null;
765
755
  return {
766
756
  name: entry.name,
@@ -769,14 +759,17 @@ var MemoryFileSystemProvider = class {
769
759
  lastModified: entry.lastModified
770
760
  };
771
761
  }
762
+ /**
763
+ * Every stored file is bytes, so every stored file is readable as binary.
764
+ * `payloadKind` records how a file was written for DBK export fidelity; it is
765
+ * not a filter. Gating on it made `readBinary` report an existing text file as
766
+ * missing, which no other provider does and which callers read as "no file".
767
+ */
772
768
  async readBinary(path) {
773
- const canonical = entryPath(path, "read");
774
- const file = this.v2.readCompatibilityFile(canonical);
775
- if (!file || file.payloadKind !== "binary") return null;
776
- return file.data;
769
+ return this.v2.readCompatibilityFile(canonicalPath(path))?.data ?? null;
777
770
  }
778
771
  async writeBinary(path, data) {
779
- await this.v2.writeBinary(entryPath(path, "write"), data, { createParents: true });
772
+ await this.v2.writeBinary(canonicalPath(path), data, { createParents: true });
780
773
  }
781
774
  };
782
775
 
@@ -784,4 +777,3 @@ export {
784
777
  MemoryFileSystemProviderV2,
785
778
  MemoryFileSystemProvider
786
779
  };
787
- //# sourceMappingURL=chunk-RQJRQF46.js.map
@@ -1,6 +1,358 @@
1
- export { DocumentCommitConflictError, DocumentSession, DocumentSessionConflictError, } from './document-session.js';
2
- export { createFileSystemDocumentTarget, type FileSystemDocumentTargetOptions, } from './filesystem-target.js';
3
- export { DOCUMENT_RECOVERY_JOURNAL_SCHEMA_VERSION, DOCUMENT_RECOVERY_JOURNAL_STORAGE_KEY, DocumentRecoveryJournal, getDefaultDocumentRecoveryStorage, } from './recovery-journal.js';
4
- export type { DocumentCommitRequest, DocumentCommitResult, DocumentCommitTarget, DocumentConflictStrategy, DocumentExternalChangeResult, DocumentExternalSnapshot, DocumentExternalVersion, DocumentSaveReason, DocumentSessionConflict, DocumentSessionEditScope, DocumentSessionLifecycle, DocumentSessionOptions, DocumentSessionSnapshot, DocumentSessionStatus, DocumentSessionTransition, } from './types.js';
5
- export type { DocumentRecoveryAcknowledgement, DocumentRecoveryJournalOptions, DocumentRecoveryRecord, DocumentRecoveryStorage, DocumentRecoveryWrite, DocumentRecoveryWriteFailure, DocumentRecoveryWriteResult, } from './recovery-journal.js';
6
- //# sourceMappingURL=index.d.ts.map
1
+ import { q as FileSystemProvider } from '../types-BEg5SQ1_.js';
2
+ import '../workspace-path-CWVrcuPL.js';
3
+
4
+ /**
5
+ * Synchronous crash-recovery journal for dirty document snapshots.
6
+ *
7
+ * The journal deliberately depends on a tiny injected Storage-like contract
8
+ * instead of reading `window.localStorage` at module load time. This keeps the
9
+ * document package usable in Node, Electron main, VS Code extension hosts, and
10
+ * tests while allowing browser renderers to use localStorage for a best-effort
11
+ * write that completes before the current JavaScript turn ends.
12
+ */
13
+ declare const DOCUMENT_RECOVERY_JOURNAL_STORAGE_KEY = "docblocks:document-recovery:v1";
14
+ declare const DOCUMENT_RECOVERY_JOURNAL_SCHEMA_VERSION = 1;
15
+ interface DocumentRecoveryStorage {
16
+ getItem(key: string): string | null;
17
+ setItem(key: string, value: string): void;
18
+ removeItem(key: string): void;
19
+ }
20
+ interface DocumentRecoveryRecord {
21
+ /** Stable commit-target key, including the workspace/provider scope. */
22
+ targetKey: string;
23
+ /** DocumentSession generation that produced this snapshot. */
24
+ generation: number;
25
+ /** Monotonic DocumentSession revision represented by `content`. */
26
+ revision: number;
27
+ /** Complete markdown snapshot. */
28
+ content: string;
29
+ /**
30
+ * Content last acknowledged by the commit target when this draft was made.
31
+ * Recovery may be applied automatically only when storage still matches this
32
+ * baseline; otherwise the caller must surface an external-change conflict.
33
+ */
34
+ persistedContent: string | null;
35
+ /** Time the dirty record for this target was first created. */
36
+ createdAt: number;
37
+ /** Time the record was most recently replaced. */
38
+ updatedAt: number;
39
+ }
40
+ interface DocumentRecoveryWrite {
41
+ targetKey: string;
42
+ generation: number;
43
+ revision: number;
44
+ content: string;
45
+ persistedContent: string | null;
46
+ }
47
+ interface DocumentRecoveryAcknowledgement {
48
+ targetKey: string;
49
+ generation: number;
50
+ /** Highest revision durably acknowledged by the commit target. */
51
+ persistedRevision: number;
52
+ }
53
+ type DocumentRecoveryWriteFailure = 'invalid-record' | 'record-too-large' | 'storage-unavailable' | 'quota-exceeded';
54
+ type DocumentRecoveryWriteResult = {
55
+ status: 'stored';
56
+ evicted: number;
57
+ } | {
58
+ status: 'unchanged';
59
+ evicted: 0;
60
+ } | {
61
+ status: 'ignored-stale';
62
+ evicted: 0;
63
+ } | {
64
+ status: 'rejected';
65
+ reason: DocumentRecoveryWriteFailure;
66
+ evicted: number;
67
+ };
68
+ interface DocumentRecoveryJournalOptions {
69
+ storageKey?: string;
70
+ /** Maximum number of document records retained. Defaults to 20. */
71
+ maxEntries?: number;
72
+ /** Conservative UTF-16 estimate for the whole serialized journal. */
73
+ maxStorageBytes?: number;
74
+ /** Conservative UTF-16 estimate for one serialized record. */
75
+ maxRecordBytes?: number;
76
+ /** Records older than this are discarded while reading. Defaults to 7 days. */
77
+ maxAgeMs?: number;
78
+ /** Tolerated clock skew for records dated in the future. Defaults to 5 minutes. */
79
+ maxFutureSkewMs?: number;
80
+ /** Injected for deterministic tests. */
81
+ now?: () => number;
82
+ }
83
+ /**
84
+ * Best-effort, synchronous recovery storage.
85
+ *
86
+ * Normal save acknowledgement is the only automatic path that removes the
87
+ * current record. Explicit discard, age expiry, corruption repair, and bounded
88
+ * eviction are intentional exceptions: callers can discard after the user
89
+ * rejects recovery, and the journal must never grow without limit.
90
+ */
91
+ declare class DocumentRecoveryJournal {
92
+ private readonly storage;
93
+ private readonly storageKey;
94
+ private readonly maxEntries;
95
+ private readonly maxStorageBytes;
96
+ private readonly maxRecordBytes;
97
+ private readonly maxAgeMs;
98
+ private readonly maxFutureSkewMs;
99
+ private readonly now;
100
+ constructor(storage: DocumentRecoveryStorage | null, options?: DocumentRecoveryJournalOptions);
101
+ /**
102
+ * Synchronously persist the latest dirty snapshot for a target.
103
+ * Storage/quota failures are returned, never thrown into an editor onChange.
104
+ */
105
+ write(input: DocumentRecoveryWrite): DocumentRecoveryWriteResult;
106
+ /** Return the recoverable snapshot for one target, if present and valid. */
107
+ lookup(targetKey: string, generation?: number): DocumentRecoveryRecord | null;
108
+ /** List valid records, newest first. Optionally restrict to one target. */
109
+ list(targetKey?: string): DocumentRecoveryRecord[];
110
+ /**
111
+ * Clear a record only when the same generation has durably acknowledged at
112
+ * least the journaled revision. A stale acknowledgement cannot erase a newer
113
+ * crash-recovery snapshot.
114
+ */
115
+ acknowledge(input: DocumentRecoveryAcknowledgement): boolean;
116
+ /** Explicitly discard recovery data after a user or lifecycle decision. */
117
+ discard(targetKey: string, generation?: number): boolean;
118
+ private load;
119
+ private persistBounded;
120
+ private persistExact;
121
+ private tryRemove;
122
+ }
123
+ /**
124
+ * Resolve browser localStorage on demand. Importing this module never touches
125
+ * browser globals, and access errors (sandboxing/security settings) yield null.
126
+ */
127
+ declare function getDefaultDocumentRecoveryStorage(): DocumentRecoveryStorage | null;
128
+
129
+ /**
130
+ * Framework-neutral document persistence contracts.
131
+ *
132
+ * A DocumentSession owns one logical document at a time. Storage-specific
133
+ * adapters implement DocumentCommitTarget; the session owns revisions,
134
+ * serialization, lifecycle transitions, and conflict state.
135
+ */
136
+
137
+ type DocumentSaveReason = 'autosave' | 'manual' | 'transition' | 'close' | 'backup' | 'conflict';
138
+ type DocumentExternalVersion = string | number | null;
139
+ interface DocumentCommitRequest {
140
+ /** Stable key for the target this commit was created for. */
141
+ targetKey: string;
142
+ /** Latest complete document snapshot to persist. */
143
+ content: string;
144
+ /** Monotonic session revision represented by content. */
145
+ revision: number;
146
+ /** Most recent revision acknowledged by this target. */
147
+ persistedRevision: number;
148
+ /** Content last acknowledged by the target, or null if it did not exist. */
149
+ persistedContent: string | null;
150
+ reason: DocumentSaveReason;
151
+ }
152
+ interface DocumentCommitResult {
153
+ /** Optional backend version (mtime, TextDocument.version, etag, and so on). */
154
+ version?: DocumentExternalVersion;
155
+ }
156
+ interface DocumentCommitTarget {
157
+ readonly key: string;
158
+ commit(request: DocumentCommitRequest): Promise<DocumentCommitResult | void>;
159
+ }
160
+ type DocumentSessionStatus = 'idle' | 'saved' | 'dirty' | 'saving' | 'error' | 'conflict' | 'closed';
161
+ type DocumentSessionLifecycle = 'open' | 'transitioning' | 'closing' | 'closed';
162
+ interface DocumentExternalSnapshot {
163
+ /** Target key captured before the external read began. */
164
+ targetKey: string;
165
+ /** Monotonic observation number assigned by the target watcher. */
166
+ sequence?: number;
167
+ /** Null represents an externally deleted document. */
168
+ content: string | null;
169
+ version?: DocumentExternalVersion;
170
+ }
171
+ interface DocumentSessionConflict {
172
+ targetKey: string;
173
+ localContent: string;
174
+ localRevision: number;
175
+ externalContent: string | null;
176
+ externalVersion: DocumentExternalVersion;
177
+ }
178
+ interface DocumentSessionSnapshot {
179
+ targetKey: string | null;
180
+ content: string;
181
+ revision: number;
182
+ persistedRevision: number;
183
+ persistedContent: string | null;
184
+ savingRevision: number | null;
185
+ generation: number;
186
+ status: DocumentSessionStatus;
187
+ lifecycle: DocumentSessionLifecycle;
188
+ frozen: boolean;
189
+ error: Error | null;
190
+ conflict: DocumentSessionConflict | null;
191
+ }
192
+ interface DocumentSessionOptions {
193
+ autoSaveDelayMs?: number;
194
+ /** Whether edits schedule automatic persistence. Manual and lifecycle flushes remain available. */
195
+ autoSaveEnabled?: boolean;
196
+ /**
197
+ * Bounded delays used after an automatic save fails. Each entry permits
198
+ * one retry; exhausting the list leaves the session in error state until
199
+ * the user edits again or explicitly flushes it. Conflicts never retry.
200
+ */
201
+ autoSaveRetryDelaysMs?: readonly number[];
202
+ /** Optional synchronous crash-recovery journal owned by this session. */
203
+ recoveryJournal?: DocumentRecoveryJournal | null;
204
+ }
205
+ /** Scope captured by an editor instance when it mounts. */
206
+ interface DocumentSessionEditScope {
207
+ targetKey: string;
208
+ generation: number;
209
+ }
210
+ /** Result produced while a session transition is frozen. */
211
+ interface DocumentSessionTransition {
212
+ target: DocumentCommitTarget | null;
213
+ content: string;
214
+ }
215
+ type DocumentExternalChangeResult = 'applied' | 'conflict' | 'ignored';
216
+ type DocumentConflictStrategy = 'use-local' | 'use-external';
217
+
218
+ type SessionListener = () => void;
219
+ /**
220
+ * Raised by a commit target when optimistic external-change verification
221
+ * fails. The session converts it into durable conflict state.
222
+ */
223
+ declare class DocumentCommitConflictError extends Error {
224
+ readonly externalContent: string | null;
225
+ readonly externalVersion: string | number | null;
226
+ constructor(message: string, externalContent: string | null, externalVersion?: string | number | null);
227
+ }
228
+ declare class DocumentSessionConflictError extends Error {
229
+ readonly conflict: DocumentSessionConflict;
230
+ constructor(conflict: DocumentSessionConflict);
231
+ }
232
+ /**
233
+ * A revisioned, serialized persistence boundary for one active document.
234
+ *
235
+ * Invariants:
236
+ * - only drain() calls target.commit();
237
+ * - at most one commit is in flight;
238
+ * - revisions never decrease, including across target transitions;
239
+ * - destructive operations wait for an in-flight commit and run last;
240
+ * - a target is never changed by a React effect cleanup.
241
+ */
242
+ declare class DocumentSession {
243
+ private readonly autoSaveDelayMs;
244
+ private readonly autoSaveRetryDelaysMs;
245
+ private readonly recoveryJournal;
246
+ private readonly listeners;
247
+ private autoSaveEnabled;
248
+ private target;
249
+ private content;
250
+ private persistedContent;
251
+ private revision;
252
+ private persistedRevision;
253
+ private savingRevision;
254
+ private savingContent;
255
+ private generation;
256
+ private externalSequence;
257
+ private lifecycle;
258
+ private frozen;
259
+ private error;
260
+ private conflict;
261
+ private autoSaveTimer;
262
+ private autoSaveRetryAttempt;
263
+ private drainPromise;
264
+ private haltDrain;
265
+ private operationTail;
266
+ private snapshot;
267
+ constructor(options?: DocumentSessionOptions);
268
+ readonly subscribe: (listener: SessionListener) => (() => void);
269
+ readonly getSnapshot: () => DocumentSessionSnapshot;
270
+ /** Enable or disable automatic persistence without weakening explicit or lifecycle flushes. */
271
+ setAutoSaveEnabled(enabled: boolean): void;
272
+ /**
273
+ * Record a complete local snapshot and schedule its persistence.
274
+ * Returns the assigned monotonic revision.
275
+ */
276
+ edit(content: string, scope: DocumentSessionEditScope): number;
277
+ /**
278
+ * Persist the revision current when flush() is called. A later edit may
279
+ * advance the session again, but commits remain strictly serialized.
280
+ */
281
+ flush(reason?: DocumentSaveReason): Promise<DocumentSessionSnapshot>;
282
+ /**
283
+ * Flush the old document, then replace it with a new clean baseline.
284
+ * UI state should change only after this promise resolves.
285
+ */
286
+ transitionTo(target: DocumentCommitTarget | null, content: string): Promise<DocumentSessionSnapshot>;
287
+ /**
288
+ * Freeze and flush the current document before reading the next one. The
289
+ * loader may return null when a navigation request was superseded, leaving
290
+ * the current target active and clean.
291
+ */
292
+ transitionWithLoad(load: () => Promise<DocumentSessionTransition | null>): Promise<DocumentSessionSnapshot | null>;
293
+ /**
294
+ * Flush the current path, run the storage move, and only then swap the
295
+ * commit target. No edit can enter between those steps.
296
+ */
297
+ retarget(nextTarget: DocumentCommitTarget, moveStorage: () => Promise<void>): Promise<DocumentSessionSnapshot>;
298
+ /**
299
+ * Cancel queued writes, wait for an already-running write, then delete.
300
+ * The deletion is therefore the final storage operation for this target.
301
+ */
302
+ delete(deleteStorage: () => Promise<void>): Promise<DocumentSessionSnapshot>;
303
+ /**
304
+ * Discard queued changes and detach without mutating storage. This is used
305
+ * for explicitly abandoned sessions, never as an implicit effect cleanup.
306
+ */
307
+ cancel(): Promise<DocumentSessionSnapshot>;
308
+ /**
309
+ * Observe a filesystem/host change captured for targetKey. Clean sessions
310
+ * adopt it. Dirty or saving sessions preserve local text and enter conflict.
311
+ */
312
+ observeExternal(change: DocumentExternalSnapshot): DocumentExternalChangeResult;
313
+ resolveConflict(strategy: DocumentConflictStrategy): Promise<DocumentSessionSnapshot>;
314
+ /**
315
+ * Freeze edits and flush through the latest revision. A successful call
316
+ * remains frozen until cancelClose(); the owning host may now destroy it.
317
+ */
318
+ prepareClose(): Promise<DocumentSessionSnapshot>;
319
+ /** Resume editing when a host cancels a prepared close. */
320
+ cancelClose(): void;
321
+ private performTransition;
322
+ private scheduleAutoSave;
323
+ private clearAutoSaveTimer;
324
+ private ensureDrain;
325
+ private drain;
326
+ private awaitActiveDrain;
327
+ /**
328
+ * Rehydrate a synchronous crash snapshot after the durable baseline has
329
+ * been read. A matching baseline is safe to resume as dirty; a changed
330
+ * baseline becomes an explicit conflict and is never auto-overwritten.
331
+ */
332
+ private restoreRecoverySnapshot;
333
+ private writeRecoverySnapshot;
334
+ private discardRecoverySnapshot;
335
+ private detach;
336
+ private assertNotPreparingClose;
337
+ private enqueueOperation;
338
+ private createSnapshot;
339
+ private computeStatus;
340
+ private emit;
341
+ }
342
+
343
+ interface FileSystemDocumentTargetOptions {
344
+ /**
345
+ * Compare the current file with the session's persisted baseline before
346
+ * replacing it. Enabled by default.
347
+ */
348
+ verifyExternalChanges?: boolean;
349
+ onCommitted?: (content: string, revision: number) => void;
350
+ }
351
+ /**
352
+ * Adapt a FileSystemProvider path to the commit protocol used by
353
+ * DocumentSession. The optimistic read catches external edits/deletions
354
+ * before a local write recreates or silently replaces them.
355
+ */
356
+ declare function createFileSystemDocumentTarget(provider: FileSystemProvider, path: string, options?: FileSystemDocumentTargetOptions): DocumentCommitTarget;
357
+
358
+ export { DOCUMENT_RECOVERY_JOURNAL_SCHEMA_VERSION, DOCUMENT_RECOVERY_JOURNAL_STORAGE_KEY, DocumentCommitConflictError, type DocumentCommitRequest, type DocumentCommitResult, type DocumentCommitTarget, type DocumentConflictStrategy, type DocumentExternalChangeResult, type DocumentExternalSnapshot, type DocumentExternalVersion, type DocumentRecoveryAcknowledgement, DocumentRecoveryJournal, type DocumentRecoveryJournalOptions, type DocumentRecoveryRecord, type DocumentRecoveryStorage, type DocumentRecoveryWrite, type DocumentRecoveryWriteFailure, type DocumentRecoveryWriteResult, type DocumentSaveReason, DocumentSession, type DocumentSessionConflict, DocumentSessionConflictError, type DocumentSessionEditScope, type DocumentSessionLifecycle, type DocumentSessionOptions, type DocumentSessionSnapshot, type DocumentSessionStatus, type DocumentSessionTransition, type FileSystemDocumentTargetOptions, createFileSystemDocumentTarget, getDefaultDocumentRecoveryStorage };
@@ -1,4 +1,24 @@
1
- export { DocumentCommitConflictError, DocumentSession, DocumentSessionConflictError, } from './document-session.js';
2
- export { createFileSystemDocumentTarget, } from './filesystem-target.js';
3
- export { DOCUMENT_RECOVERY_JOURNAL_SCHEMA_VERSION, DOCUMENT_RECOVERY_JOURNAL_STORAGE_KEY, DocumentRecoveryJournal, getDefaultDocumentRecoveryStorage, } from './recovery-journal.js';
4
- //# sourceMappingURL=index.js.map
1
+ import {
2
+ DOCUMENT_RECOVERY_JOURNAL_SCHEMA_VERSION,
3
+ DOCUMENT_RECOVERY_JOURNAL_STORAGE_KEY,
4
+ DocumentCommitConflictError,
5
+ DocumentRecoveryJournal,
6
+ DocumentSession,
7
+ DocumentSessionConflictError,
8
+ createFileSystemDocumentTarget,
9
+ getDefaultDocumentRecoveryStorage
10
+ } from "../chunk-6L3JRDE7.js";
11
+ import "../chunk-QI6YKTQV.js";
12
+ import "../chunk-M5ZNQGR5.js";
13
+ import "../chunk-AYWKIZLD.js";
14
+ import "../chunk-XAMILHQP.js";
15
+ export {
16
+ DOCUMENT_RECOVERY_JOURNAL_SCHEMA_VERSION,
17
+ DOCUMENT_RECOVERY_JOURNAL_STORAGE_KEY,
18
+ DocumentCommitConflictError,
19
+ DocumentRecoveryJournal,
20
+ DocumentSession,
21
+ DocumentSessionConflictError,
22
+ createFileSystemDocumentTarget,
23
+ getDefaultDocumentRecoveryStorage
24
+ };
@@ -1,4 +1,73 @@
1
- /** Electron renderer filesystem provider entry point. */
2
- export { ElectronFileSystemProvider, isElectronHost } from './electron-provider.js';
3
- export { ElectronFileSystemProviderV2 } from './electron-provider-v2.js';
4
- //# sourceMappingURL=electron.d.ts.map
1
+ import { s as FileSystemProviderV2, r as FileSystemProviderCapabilities, k as FileSystemEntrySnapshot, m as FileSystemFileRead, K as FileSystemWriteOptions, n as FileSystemFileSnapshot, g as FileSystemCreateDirectoryOptions, h as FileSystemDirectorySnapshot, u as FileSystemRemoveOptions, v as FileSystemRemoveResult, o as FileSystemMoveOptions, w as FileSystemSnapshot, C as FileSystemWatchEvent, H as FileSystemWatchOptions, I as FileSystemWatchSubscription, q as FileSystemProvider, F as FileCommitResult, j as FileSystemEntry, b as FileMeta } from '../types-BEg5SQ1_.js';
2
+ import { a as WorkspacePath } from '../workspace-path-CWVrcuPL.js';
3
+ export { isElectronHost } from '../host/index.js';
4
+ import '../types-CueK0tvU.js';
5
+
6
+ /** Pure renderer-side client for the typed Electron filesystem v2 transport. */
7
+ declare class ElectronFileSystemProviderV2 implements FileSystemProviderV2 {
8
+ readonly id: string;
9
+ readonly label: string;
10
+ readonly capabilities: FileSystemProviderCapabilities;
11
+ private readonly rootPath;
12
+ private readonly instanceId;
13
+ private readonly watchers;
14
+ private readonly subscriptions;
15
+ private readonly inFlight;
16
+ private openPromise;
17
+ private removeWatchBridge;
18
+ private disposePromise;
19
+ private hostOpened;
20
+ private disposed;
21
+ constructor(id: string, label: string, rootPath: string);
22
+ getRootPath(): string;
23
+ stat(path: WorkspacePath): Promise<FileSystemEntrySnapshot | null>;
24
+ readFile(path: WorkspacePath): Promise<FileSystemFileRead | null>;
25
+ readDirectory(path: WorkspacePath): Promise<readonly FileSystemEntrySnapshot[]>;
26
+ writeFile(path: WorkspacePath, data: ArrayBuffer | Uint8Array, options?: FileSystemWriteOptions): Promise<FileSystemFileSnapshot>;
27
+ createDirectory(path: WorkspacePath, options?: FileSystemCreateDirectoryOptions): Promise<FileSystemDirectorySnapshot>;
28
+ remove(path: WorkspacePath, options?: FileSystemRemoveOptions): Promise<FileSystemRemoveResult>;
29
+ move(oldPath: WorkspacePath, newPath: WorkspacePath, options?: FileSystemMoveOptions): Promise<FileSystemEntrySnapshot>;
30
+ snapshot(): Promise<FileSystemSnapshot>;
31
+ watch(listener: (event: FileSystemWatchEvent) => void, options?: FileSystemWatchOptions): FileSystemWatchSubscription;
32
+ dispose(): Promise<void>;
33
+ private request;
34
+ private ensureOpen;
35
+ private ensureWatchBridge;
36
+ private handleWatchMessage;
37
+ private assertOpen;
38
+ }
39
+
40
+ /**
41
+ * ElectronFileSystemProvider — implements FileSystemProvider by delegating
42
+ * to the Electron desktop host's fs IPC bridge. Every operation is scoped
43
+ * to an opaque workspace id that the main process resolves against its
44
+ * registered workspace authority.
45
+ *
46
+ * This file has no Electron dependency — it is a pure IPC client that
47
+ * relies on the `docBlocksHost` global installed by the preload script.
48
+ */
49
+
50
+ declare class ElectronFileSystemProvider implements FileSystemProvider {
51
+ readonly id: string;
52
+ readonly label: string;
53
+ readonly v2: ElectronFileSystemProviderV2;
54
+ private readonly rootPath;
55
+ constructor(id: string, label: string, rootPath: string);
56
+ /** Absolute path this provider is rooted at. */
57
+ getRootPath(): string;
58
+ readFile(path: string): Promise<string | null>;
59
+ writeFile(path: string, content: string): Promise<void>;
60
+ commitFile(path: string, content: string, expectedContent: string | null): Promise<FileCommitResult>;
61
+ delete(path: string): Promise<void>;
62
+ rename(oldPath: string, newPath: string): Promise<void>;
63
+ readDirectory(path: string): Promise<FileSystemEntry[]>;
64
+ exists(path: string): Promise<boolean>;
65
+ createDirectory(path: string): Promise<void>;
66
+ stat(path: string): Promise<FileMeta | null>;
67
+ readBinary(path: string): Promise<ArrayBuffer | null>;
68
+ writeBinary(path: string, data: ArrayBuffer | Uint8Array): Promise<void>;
69
+ /** Subscribe to external change notifications under this root. */
70
+ watch(onChange: (changedPath: string) => void): () => void;
71
+ }
72
+
73
+ export { ElectronFileSystemProvider, ElectronFileSystemProviderV2 };