@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
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Canonical wire format for a document embedded in a DocBlocks URL hash.
3
+ *
4
+ * The base64 payload is deliberately small and versioned:
5
+ *
6
+ * "DBSHARE" + version byte + mode byte + bounded DBK bytes
7
+ *
8
+ * The DBK itself is validated at the filesystem import boundary. Keeping the
9
+ * launch mode outside the archive means the copied Markdown is never mutated
10
+ * merely to choose its initial presentation.
11
+ */
12
+ type SharedDocumentMode = 'slideshow' | 'video' | 'page' | 'document' | 'narrate';
13
+ interface SharedDocumentPayload {
14
+ readonly archive: Uint8Array;
15
+ readonly mode: SharedDocumentMode | null;
16
+ }
17
+ type SharedDocumentHashParseResult = {
18
+ readonly kind: 'none';
19
+ } | {
20
+ readonly kind: 'valid';
21
+ readonly payload: SharedDocumentPayload;
22
+ } | {
23
+ readonly kind: 'invalid';
24
+ readonly message: string;
25
+ };
26
+ declare const SHARED_DOCUMENT_LIMITS: Readonly<{
27
+ /** A conservative interoperability threshold, not a universal browser limit. */
28
+ portableUrlCharacters: 4096;
29
+ /** Hard cap applied before a hash is copied or decoded. */
30
+ urlCharacters: 32768;
31
+ /** Maximum UTF-8 Markdown accepted by the first-party link generator. */
32
+ markdownBytes: number;
33
+ /** Maximum compressed DBK bytes carried by the versioned envelope. */
34
+ archiveBytes: number;
35
+ }>;
36
+ /** Build the exact `#shared(<base64>)` fragment for a bounded DBK archive. */
37
+ declare function createSharedDocumentHash(archive: Uint8Array, mode?: SharedDocumentMode | null): string;
38
+ /** Replace any existing hash on a base URL with a validated shared payload. */
39
+ declare function createSharedDocumentUrl(baseUrl: string, archive: Uint8Array, mode?: SharedDocumentMode | null): string;
40
+ /** Parse a hash without ever treating malformed shared input as workspace routing. */
41
+ declare function parseSharedDocumentHash(hash: string): SharedDocumentHashParseResult;
42
+
43
+ export { SHARED_DOCUMENT_LIMITS, type SharedDocumentHashParseResult, type SharedDocumentMode, type SharedDocumentPayload, createSharedDocumentHash, createSharedDocumentUrl, parseSharedDocumentHash };
@@ -0,0 +1,12 @@
1
+ import {
2
+ SHARED_DOCUMENT_LIMITS,
3
+ createSharedDocumentHash,
4
+ createSharedDocumentUrl,
5
+ parseSharedDocumentHash
6
+ } from "../chunk-LMMOFRGQ.js";
7
+ export {
8
+ SHARED_DOCUMENT_LIMITS,
9
+ createSharedDocumentHash,
10
+ createSharedDocumentUrl,
11
+ parseSharedDocumentHash
12
+ };
@@ -1,7 +1,7 @@
1
1
  import { a as WorkspacePath } from './workspace-path-CWVrcuPL.js';
2
2
 
3
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';
4
+ type FsErrorCode = 'invalid-path' | 'path-escape' | 'not-found' | 'already-exists' | 'type-mismatch' | 'not-empty' | 'permission-denied' | 'conflict' | 'corrupt' | 'quota-exceeded' | 'not-supported' | 'busy' | 'disposed' | 'closed' | 'aborted' | 'io';
5
5
  type FsOperation = 'parse-path' | 'read' | 'stat' | 'list' | 'write' | 'create-directory' | 'remove' | 'move' | 'snapshot' | 'watch' | 'dispose';
6
6
  /** Plain-data form safe to send over IPC, postMessage, or JSON. */
7
7
  interface SerializedFsError {
@@ -1,4 +1,4 @@
1
- import { S as SerializedFsError, 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, F as FileCommitResult, j as FileSystemEntry, b as FileMeta } from './types-CsX6EN2t.js';
1
+ import { S as SerializedFsError, 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, F as FileCommitResult, j as FileSystemEntry, b as FileMeta } from './types-BEg5SQ1_.js';
2
2
  import { a as WorkspacePath } from './workspace-path-CWVrcuPL.js';
3
3
 
4
4
  /** Stable capabilities shared by the Electron v2 client and native backend. */
@@ -324,22 +324,17 @@ interface DocBlocksHostExportAPI {
324
324
  /** Write only to an exact target granted by the main process. */
325
325
  save(documentId: string, filename: string, grantId: string | null, data: ArrayBuffer | Uint8Array): Promise<HostExportTargetGrant | null>;
326
326
  }
327
- /** System ffmpeg detection and invocation. */
327
+ /** System ffmpeg detection. */
328
328
  interface DocBlocksHostFfmpegAPI {
329
329
  /** True if `ffmpeg` is available on PATH (or bundled). */
330
330
  available(): Promise<boolean>;
331
331
  /** Version string from `ffmpeg -version`, or null if unavailable. */
332
332
  version(): Promise<string | null>;
333
- /** Render a physically contained workspace-relative Markdown file to MP4. */
334
- renderVideo(workspaceId: string, markdownPath: string, options: {
335
- fps?: number;
336
- quality?: 'draft' | 'normal' | 'high';
337
- }): Promise<string>;
338
333
  }
339
334
  /** Auto-updater control. */
340
335
  interface DocBlocksHostUpdaterAPI {
341
- /** Kick off a check; resolves to true if an update is available. */
342
- checkForUpdates(): Promise<boolean>;
336
+ /** Kick off a check without collapsing a failed check into "no update". */
337
+ checkForUpdates(): Promise<UpdateCheckResult>;
343
338
  /** Current app version string. */
344
339
  getVersion(): Promise<string>;
345
340
  /**
@@ -353,6 +348,17 @@ interface DocBlocksHostUpdaterAPI {
353
348
  onStatus(listener: (status: UpdaterStatus) => void): () => void;
354
349
  }
355
350
  type UpdateInstallResult = 'installing' | 'cancelled' | 'not-ready';
351
+ type UpdateCheckResult = {
352
+ kind: 'available';
353
+ version: string;
354
+ } | {
355
+ kind: 'not-available';
356
+ } | {
357
+ kind: 'store-managed';
358
+ } | {
359
+ kind: 'error';
360
+ message: string;
361
+ };
356
362
  type UpdaterStatus = {
357
363
  kind: 'checking';
358
364
  } | {
@@ -421,10 +427,25 @@ type ExternalBinaryCommitResult = {
421
427
  version: string | null;
422
428
  data: ArrayBuffer | null;
423
429
  };
424
- /** Environment metadata provided by the host. */
430
+ /**
431
+ * Environment metadata provided by the host.
432
+ *
433
+ * Read synchronously by the renderer, so a host implementation must have
434
+ * these values in hand before it exposes the bridge — they cannot be awaited.
435
+ *
436
+ * Every field is main-process authority. A host must derive them from what it
437
+ * actually knows about itself (in Electron: `app.getVersion()` and
438
+ * `app.isPackaged`) and never from renderer-visible environment variables:
439
+ * `npm_package_version` exists only under an `npm run` script and `NODE_ENV`
440
+ * is unset in a packaged app, so both silently lie in exactly the builds users
441
+ * install. `appVersion` in particular reaches users through the About surface
442
+ * and issue-report URLs.
443
+ */
425
444
  interface HostEnvironment {
426
445
  platform: 'darwin' | 'win32' | 'linux';
446
+ /** Real, user-facing app version. Never a placeholder like '0.0.0'. */
427
447
  appVersion: string;
448
+ /** True only in an unpackaged development run. */
428
449
  isDev: boolean;
429
450
  }
430
451
  type HostCloseReason = 'window-close' | 'app-quit' | 'update-install' | 'reload' | 'force-reload';
@@ -447,6 +468,8 @@ type HostPrepareCloseResult = {
447
468
  * renderer never chooses request or window identifiers.
448
469
  */
449
470
  interface DocBlocksHostLifecycleAPI {
471
+ /** Request the main-owned guarded close path for this renderer window. */
472
+ requestWindowClose(): void;
450
473
  onPrepareClose(listener: (request: HostPrepareCloseRequest) => Promise<HostPrepareCloseResult>): () => void;
451
474
  onCancelClose(listener: (requestId: string) => void): () => void;
452
475
  }
@@ -475,4 +498,4 @@ interface DocBlocksHostAPI {
475
498
  onOpenRequest(listener: (request: OpenRequest) => void): () => void;
476
499
  }
477
500
 
478
- export { type GitStatus as A, type HostEnvironment as B, type HostExportTargetGrant as C, type DocBlocksHostAPI as D, ELECTRON_FILE_SYSTEM_V2_CAPABILITIES as E, type HostFileSystemV2OpenRequest as F, type GitBranchInfo as G, type HostCloseReason as H, type HostFileSystemV2Result as I, type HostFileSystemV2WatchMessage as J, type HostPrepareCloseRequest as K, type HostPrepareCloseResult as L, type MenuCommand as M, type UpdaterStatus as N, type OpenRequest as O, type UpdateInstallResult as U, type DocBlocksHostExportAPI as a, type DocBlocksHostExternalAPI as b, type DocBlocksHostFfmpegAPI as c, type DocBlocksHostFsAPI as d, type DocBlocksHostFsV2API as e, type DocBlocksHostGitAPI as f, type DocBlocksHostLifecycleAPI as g, type DocBlocksHostShellAPI as h, type DocBlocksHostUpdaterAPI as i, type DocBlocksHostWorkspacesAPI as j, type ElectronWorkspaceInfo as k, type ExternalBinaryCommitResult as l, type GitCapabilities as m, type GitCloneHandle as n, type GitCloneProgress as o, type GitError as p, type GitErrorCode as q, type GitFileAtRevision as r, type GitFileChange as s, type GitFileStatusCode as t, type GitLogEntry as u, type GitLogOptions as v, type GitRemoteInfo as w, type GitRepoDetection as x, type GitResult as y, type GitRevision as z };
501
+ export { type GitStatus as A, type HostEnvironment as B, type HostExportTargetGrant as C, type DocBlocksHostAPI as D, ELECTRON_FILE_SYSTEM_V2_CAPABILITIES as E, type HostFileSystemV2OpenRequest as F, type GitBranchInfo as G, type HostCloseReason as H, type HostFileSystemV2Result as I, type HostFileSystemV2WatchMessage as J, type HostPrepareCloseRequest as K, type HostPrepareCloseResult as L, type MenuCommand as M, type UpdateInstallResult as N, type OpenRequest as O, type UpdaterStatus as P, type UpdateCheckResult as U, type DocBlocksHostExportAPI as a, type DocBlocksHostExternalAPI as b, type DocBlocksHostFfmpegAPI as c, type DocBlocksHostFsAPI as d, type DocBlocksHostFsV2API as e, type DocBlocksHostGitAPI as f, type DocBlocksHostLifecycleAPI as g, type DocBlocksHostShellAPI as h, type DocBlocksHostUpdaterAPI as i, type DocBlocksHostWorkspacesAPI as j, type ElectronWorkspaceInfo as k, type ExternalBinaryCommitResult as l, type GitCapabilities as m, type GitCloneHandle as n, type GitCloneProgress as o, type GitError as p, type GitErrorCode as q, type GitFileAtRevision as r, type GitFileChange as s, type GitFileStatusCode as t, type GitLogEntry as u, type GitLogOptions as v, type GitRemoteInfo as w, type GitRepoDetection as x, type GitResult as y, type GitRevision as z };
@@ -1,3 +1,225 @@
1
- /** Runtime-validated VS Code host/webview wire protocol. */
2
- export * from './messages.js';
3
- //# sourceMappingURL=index.d.ts.map
1
+ /**
2
+ * Typed message protocol between the extension host and webview.
3
+ */
4
+ type DocumentSessionMessageStatus = 'idle' | 'saved' | 'dirty' | 'saving' | 'error' | 'conflict' | 'closed';
5
+ type DocumentConflictChoice = 'use-local' | 'use-external';
6
+ /** Host-observed details that help a user distinguish two text branches. */
7
+ interface DocumentConflictDetailsMessage {
8
+ /** VS Code document version on which the DocBlocks draft was based. */
9
+ localBaseDocumentVersion: number;
10
+ /** Current VS Code document version observed outside the DocBlocks edit pipeline. */
11
+ externalDocumentVersion: number;
12
+ /** UTF-8 encoded sizes of the complete text snapshots. */
13
+ localBytes: number;
14
+ externalBytes: number | null;
15
+ /** Times are extension-host observations, not filesystem-authoritative mtimes. */
16
+ localEditedAt: number | null;
17
+ externalObservedAt: number | null;
18
+ /** Whether VS Code reported the external document snapshot as not yet saved. */
19
+ externalIsDirty: boolean | null;
20
+ }
21
+ declare const DOCBLOCKS_ACCENT_COLORS: readonly ["brown", "green", "blue", "purple", "maroon", "orange", "gray"];
22
+ type DocBlocksAccentColor = (typeof DOCBLOCKS_ACCENT_COLORS)[number];
23
+ declare const DOCBLOCKS_WRITE_CANVAS_TEXT_SIZE_MIN = 12;
24
+ declare const DOCBLOCKS_WRITE_CANVAS_TEXT_SIZE_MAX = 32;
25
+ declare const DOCBLOCKS_WRITE_CANVAS_LINE_SPACING_MIN = 1.2;
26
+ declare const DOCBLOCKS_WRITE_CANVAS_LINE_SPACING_MAX = 2.4;
27
+ interface VscodeWriteCanvasSettings {
28
+ textSize: number;
29
+ lineSpacing: number;
30
+ }
31
+ declare const DEFAULT_VSCODE_WRITE_CANVAS_SETTINGS: Readonly<VscodeWriteCanvasSettings>;
32
+ interface VscodeEditorSettings {
33
+ autoSave: boolean;
34
+ accentColor: DocBlocksAccentColor;
35
+ writeCanvasSettings: VscodeWriteCanvasSettings;
36
+ }
37
+ /**
38
+ * An opaque, one-shot authority to write one host-owned export target.
39
+ * The label is presentation-only and must never be interpreted as a path.
40
+ */
41
+ interface ExportTargetGrantMessage {
42
+ grantId: string;
43
+ displayLabel: string;
44
+ }
45
+ /** Messages sent from the extension host to the webview. */
46
+ type ExtensionToWebviewMessage = {
47
+ type: 'setContent';
48
+ content: string;
49
+ documentVersion: number;
50
+ fileName: string;
51
+ sessionId: string;
52
+ sessionRevision: number;
53
+ acknowledgedClientRevision: number;
54
+ } | {
55
+ type: 'editAcknowledged';
56
+ sessionId: string;
57
+ clientRevision: number;
58
+ sessionRevision: number;
59
+ accepted: boolean;
60
+ message: string | null;
61
+ } | {
62
+ type: 'sessionState';
63
+ sessionId: string;
64
+ status: DocumentSessionMessageStatus;
65
+ revision: number;
66
+ persistedRevision: number;
67
+ acknowledgedClientRevision: number;
68
+ documentVersion: number;
69
+ error: string | null;
70
+ conflict: DocumentConflictDetailsMessage | null;
71
+ } | {
72
+ type: 'saveResult';
73
+ sessionId: string;
74
+ requestId: number;
75
+ ok: boolean;
76
+ revision: number;
77
+ persistedRevision: number;
78
+ documentVersion: number;
79
+ message: string | null;
80
+ } | {
81
+ type: 'themeChange';
82
+ theme: 'light' | 'dark';
83
+ } | {
84
+ type: 'editorSettings';
85
+ settings: VscodeEditorSettings;
86
+ } | {
87
+ type: 'mediaResolved';
88
+ requestId: number;
89
+ url: string;
90
+ } | {
91
+ type: 'mediaListed';
92
+ requestId: number;
93
+ entries: MediaEntryMessage[];
94
+ } | {
95
+ type: 'mediaAdded';
96
+ requestId: number;
97
+ path: string;
98
+ } | {
99
+ type: 'mediaRemoved';
100
+ requestId: number;
101
+ } | {
102
+ type: 'mediaError';
103
+ requestId: number;
104
+ message: string;
105
+ } | {
106
+ type: 'exportSaved';
107
+ requestId: number;
108
+ target: ExportTargetGrantMessage | null;
109
+ } | {
110
+ type: 'exportError';
111
+ requestId: number;
112
+ message: string;
113
+ } | {
114
+ type: 'exportTargetResolved';
115
+ requestId: number;
116
+ target: ExportTargetGrantMessage | null;
117
+ } | {
118
+ type: 'exportTargetPicked';
119
+ requestId: number;
120
+ target: ExportTargetGrantMessage | null;
121
+ } | {
122
+ type: 'workspaceFileRead';
123
+ requestId: number;
124
+ dataBase64: string | null;
125
+ } | {
126
+ type: 'workspaceFileError';
127
+ requestId: number;
128
+ message: string;
129
+ };
130
+ /** Messages sent from the webview to the extension host. */
131
+ type WebviewToExtensionMessage = {
132
+ type: 'ready';
133
+ } | {
134
+ type: 'setAutoSave';
135
+ enabled: boolean;
136
+ } | {
137
+ type: 'setAccentColor';
138
+ accentColor: DocBlocksAccentColor;
139
+ } | {
140
+ type: 'setWriteCanvasSettings';
141
+ settings: VscodeWriteCanvasSettings;
142
+ } | {
143
+ type: 'openLink';
144
+ href: string;
145
+ } | {
146
+ type: 'edit';
147
+ content: string;
148
+ sessionId: string;
149
+ clientRevision: number;
150
+ baseDocumentVersion: number;
151
+ } | {
152
+ type: 'save';
153
+ sessionId: string;
154
+ requestId: number;
155
+ clientRevision: number;
156
+ baseDocumentVersion: number;
157
+ } | {
158
+ type: 'resolveConflict';
159
+ sessionId: string;
160
+ choice: DocumentConflictChoice;
161
+ } | {
162
+ type: 'resolveMedia';
163
+ requestId: number;
164
+ ref: string;
165
+ } | {
166
+ type: 'listMedia';
167
+ requestId: number;
168
+ } | {
169
+ type: 'addMedia';
170
+ requestId: number;
171
+ name: string;
172
+ dataBase64: string;
173
+ mimeType: string;
174
+ } | {
175
+ type: 'removeMedia';
176
+ requestId: number;
177
+ ref: string;
178
+ } | {
179
+ type: 'saveExport';
180
+ requestId: number;
181
+ filename: string;
182
+ dataBase64: string;
183
+ mimeType: string;
184
+ grantId: string | null;
185
+ /** Optional validated basename edit; the host derives it from the opaque grant. */
186
+ targetFilename: string | null;
187
+ } | {
188
+ type: 'resolveExportTarget';
189
+ requestId: number;
190
+ filename: string;
191
+ } | {
192
+ type: 'pickExportTarget';
193
+ requestId: number;
194
+ filename: string;
195
+ currentGrantId: string | null;
196
+ } | {
197
+ type: 'readWorkspaceFile';
198
+ requestId: number;
199
+ path: string;
200
+ };
201
+ interface MediaEntryMessage {
202
+ name: string;
203
+ mimeType: string;
204
+ size: number;
205
+ }
206
+ /**
207
+ * The webview boundary is untrusted at runtime. Keep malformed or stale
208
+ * messages out of the document session instead of relying on a TypeScript
209
+ * assertion in the extension host.
210
+ */
211
+ declare function parseWebviewToExtensionMessage(value: unknown): WebviewToExtensionMessage | null;
212
+ /**
213
+ * Validate host responses before they influence webview state. This protects
214
+ * the browser side from protocol drift and from messages injected by another
215
+ * script in the webview document; a TypeScript MessageEvent annotation is not
216
+ * runtime validation.
217
+ */
218
+ declare function parseExtensionToWebviewMessage(value: unknown): ExtensionToWebviewMessage | null;
219
+ declare function isDocBlocksAccentColor(value: unknown): value is DocBlocksAccentColor;
220
+ declare function isDocBlocksWriteCanvasTextSize(value: unknown): value is number;
221
+ declare function isDocBlocksWriteCanvasLineSpacing(value: unknown): value is number;
222
+ declare function isSafeExportFilename(value: unknown): value is string;
223
+ declare function isSafeMimeType(value: unknown): value is string;
224
+
225
+ export { DEFAULT_VSCODE_WRITE_CANVAS_SETTINGS, DOCBLOCKS_ACCENT_COLORS, DOCBLOCKS_WRITE_CANVAS_LINE_SPACING_MAX, DOCBLOCKS_WRITE_CANVAS_LINE_SPACING_MIN, DOCBLOCKS_WRITE_CANVAS_TEXT_SIZE_MAX, DOCBLOCKS_WRITE_CANVAS_TEXT_SIZE_MIN, type DocBlocksAccentColor, type DocumentConflictChoice, type DocumentConflictDetailsMessage, type DocumentSessionMessageStatus, type ExportTargetGrantMessage, type ExtensionToWebviewMessage, type MediaEntryMessage, type VscodeEditorSettings, type VscodeWriteCanvasSettings, type WebviewToExtensionMessage, isDocBlocksAccentColor, isDocBlocksWriteCanvasLineSpacing, isDocBlocksWriteCanvasTextSize, isSafeExportFilename, isSafeMimeType, parseExtensionToWebviewMessage, parseWebviewToExtensionMessage };