@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,478 @@
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';
2
+ import { a as WorkspacePath } from './workspace-path-CWVrcuPL.js';
3
+
4
+ /** Stable capabilities shared by the Electron v2 client and native backend. */
5
+ declare const ELECTRON_FILE_SYSTEM_V2_CAPABILITIES: FileSystemProviderCapabilities;
6
+ /** Explicit result envelope; Electron does not preserve custom Error fields. */
7
+ type HostFileSystemV2Result<T> = {
8
+ readonly ok: true;
9
+ readonly value: T;
10
+ } | {
11
+ readonly ok: false;
12
+ readonly error: SerializedFsError;
13
+ };
14
+ interface HostFileSystemV2OpenRequest {
15
+ readonly instanceId: string;
16
+ /** Main-owned persisted workspace authority, never an absolute path. */
17
+ readonly providerId: string;
18
+ readonly label: string;
19
+ }
20
+ type HostFileSystemV2WatchMessage = {
21
+ readonly instanceId: string;
22
+ readonly subscriptionId: string;
23
+ readonly kind: 'event';
24
+ readonly event: FileSystemWatchEvent;
25
+ } | {
26
+ readonly instanceId: string;
27
+ readonly subscriptionId: string;
28
+ readonly kind: 'error';
29
+ readonly error: SerializedFsError;
30
+ };
31
+ /** Wire-level filesystem v2 API exposed by preload. */
32
+ interface DocBlocksHostFsV2API {
33
+ open(request: HostFileSystemV2OpenRequest): Promise<HostFileSystemV2Result<FileSystemProviderCapabilities>>;
34
+ stat(instanceId: string, path: WorkspacePath): Promise<HostFileSystemV2Result<FileSystemEntrySnapshot | null>>;
35
+ readFile(instanceId: string, path: WorkspacePath): Promise<HostFileSystemV2Result<FileSystemFileRead | null>>;
36
+ readDirectory(instanceId: string, path: WorkspacePath): Promise<HostFileSystemV2Result<readonly FileSystemEntrySnapshot[]>>;
37
+ writeFile(instanceId: string, path: WorkspacePath, data: ArrayBuffer | Uint8Array, options?: FileSystemWriteOptions): Promise<HostFileSystemV2Result<FileSystemFileSnapshot>>;
38
+ createDirectory(instanceId: string, path: WorkspacePath, options?: FileSystemCreateDirectoryOptions): Promise<HostFileSystemV2Result<FileSystemDirectorySnapshot>>;
39
+ remove(instanceId: string, path: WorkspacePath, options?: FileSystemRemoveOptions): Promise<HostFileSystemV2Result<FileSystemRemoveResult>>;
40
+ move(instanceId: string, oldPath: WorkspacePath, newPath: WorkspacePath, options?: FileSystemMoveOptions): Promise<HostFileSystemV2Result<FileSystemEntrySnapshot>>;
41
+ snapshot(instanceId: string): Promise<HostFileSystemV2Result<FileSystemSnapshot>>;
42
+ watchSubscribe(instanceId: string, subscriptionId: string): Promise<HostFileSystemV2Result<null>>;
43
+ watchUnsubscribe(instanceId: string, subscriptionId: string): Promise<HostFileSystemV2Result<null>>;
44
+ dispose(instanceId: string): Promise<HostFileSystemV2Result<null>>;
45
+ onWatchMessage(listener: (message: HostFileSystemV2WatchMessage) => void): () => void;
46
+ }
47
+
48
+ /**
49
+ * Git host API — wire types for the desktop shell's git integration.
50
+ *
51
+ * The desktop app spawns the user's system git from the main process, so
52
+ * credentials (helpers, SSH agent, signing config and raw remote URLs) remain
53
+ * in the main process. Everything here is generic git; the only host-specific
54
+ * conveniences are remote-URL parsing (`GitRemoteInfo.web`) and PR creation
55
+ * via the GitHub CLI when installed.
56
+ *
57
+ * Expected git failures cross IPC as data (`GitResult`), never as thrown
58
+ * errors — `ipcMain.handle` rejections lose structure. Throwing is reserved
59
+ * for contract violations (unregistered root, path escape).
60
+ */
61
+
62
+ /** Every git operation resolves this — expected failures are data, not throws. */
63
+ type GitResult<T> = {
64
+ ok: true;
65
+ value: T;
66
+ } | {
67
+ ok: false;
68
+ error: GitError;
69
+ };
70
+ interface GitError {
71
+ code: GitErrorCode;
72
+ /** One-line human summary (classified stderr or synthesized). */
73
+ message: string;
74
+ /** Truncated raw stderr for a details disclosure in the UI. */
75
+ stderr?: string;
76
+ exitCode?: number;
77
+ }
78
+ type GitErrorCode = 'git-not-available' | 'not-a-repository' | 'auth-failed' | 'remote-not-found' | 'no-upstream' | 'network' | 'non-fast-forward' | 'merge-conflict' | 'uncommitted-changes' | 'detached-head' | 'unborn-branch' | 'identity-not-configured' | 'branch-exists' | 'invalid-ref-name' | 'nothing-to-commit' | 'invalid-url' | 'destination-exists' | 'pr-exists' | 'gh-not-available' | 'timeout' | 'cancelled' | 'permission-denied' | 'unknown';
79
+ interface GitCapabilities {
80
+ /** False in store-sandboxed builds, when git is absent, or git < 2.23. */
81
+ gitAvailable: boolean;
82
+ gitVersion: string | null;
83
+ ghAvailable: boolean;
84
+ ghVersion: string | null;
85
+ }
86
+ interface GitRepoDetection {
87
+ isRepo: boolean;
88
+ /** False when the workspace root is a subdirectory of a larger repo. */
89
+ rootIsToplevel?: boolean;
90
+ /** Main-owned repository authority; absent when expanded access was declined. */
91
+ repositoryId?: string;
92
+ /** True when Git metadata or the work tree extends beyond the workspace grant. */
93
+ requiresExpandedGrant?: boolean;
94
+ }
95
+ type GitFileStatusCode = 'added' | 'modified' | 'deleted' | 'renamed' | 'copied' | 'type-changed' | 'untracked' | 'ignored' | 'unmerged';
96
+ interface GitFileChange {
97
+ /** Slash-prefixed path relative to the WORKSPACE root (fs API convention). */
98
+ path: string;
99
+ /** Previous path for renames/copies (workspace-relative, slash-prefixed). */
100
+ origPath?: string;
101
+ /** Index-vs-HEAD state (staged), if any. */
102
+ index?: GitFileStatusCode;
103
+ /** Worktree-vs-index state (unstaged), if any. */
104
+ worktree?: GitFileStatusCode;
105
+ conflicted: boolean;
106
+ }
107
+ interface GitStatus {
108
+ /** Branch name; null when detached or unborn with no branch. */
109
+ branch: string | null;
110
+ detached: boolean;
111
+ /** HEAD points at a branch with no commits yet. */
112
+ unborn: boolean;
113
+ /** Full HEAD SHA; null when unborn. */
114
+ head: string | null;
115
+ /** Upstream ref short name, e.g. "origin/main". */
116
+ upstream: string | null;
117
+ ahead: number;
118
+ behind: number;
119
+ changes: GitFileChange[];
120
+ /** True when `changes` was capped. */
121
+ truncated: boolean;
122
+ operation: 'merge' | 'rebase' | 'cherry-pick' | 'revert' | 'bisect' | null;
123
+ }
124
+ interface GitBranchInfo {
125
+ /** "main" for local branches, "origin/main" for remote entries. */
126
+ name: string;
127
+ kind: 'local' | 'remote';
128
+ current: boolean;
129
+ upstream: string | null;
130
+ ahead: number;
131
+ behind: number;
132
+ upstreamGone: boolean;
133
+ headSha: string;
134
+ headSubject: string;
135
+ /** ISO 8601. */
136
+ headDate: string;
137
+ }
138
+ interface GitLogOptions {
139
+ /** Workspace-relative file path — per-file history (follows renames). */
140
+ path?: string;
141
+ /** Default 100; the host caps at 1000. */
142
+ maxCount?: number;
143
+ skip?: number;
144
+ }
145
+ interface GitLogEntry {
146
+ sha: string;
147
+ parents: string[];
148
+ authorName: string;
149
+ authorEmail: string;
150
+ /** ISO 8601. */
151
+ authorDate: string;
152
+ subject: string;
153
+ /** Ref decorations ("HEAD -> main", "origin/main", "tag: v1"). */
154
+ refs: string[];
155
+ }
156
+ /** Typed revision selector — the renderer never passes raw rev strings. */
157
+ type GitRevision = {
158
+ kind: 'head';
159
+ } | {
160
+ kind: 'index';
161
+ } | {
162
+ kind: 'commit';
163
+ sha: string;
164
+ } | {
165
+ kind: 'parent-of';
166
+ sha: string;
167
+ };
168
+ interface GitFileAtRevision {
169
+ /** Null when the file is absent at that revision, or binary/too large. */
170
+ content: string | null;
171
+ binary: boolean;
172
+ }
173
+ interface GitRemoteInfo {
174
+ name: string;
175
+ /** Sanitized web location. Raw fetch/push URLs never cross IPC. */
176
+ web: {
177
+ host: string;
178
+ owner: string;
179
+ repo: string;
180
+ webUrl: string;
181
+ } | null;
182
+ }
183
+ interface GitCloneProgress {
184
+ /** e.g. "Receiving objects", "Resolving deltas", "Checking out files". */
185
+ phase: string;
186
+ percent: number | null;
187
+ /** Raw progress line for display. */
188
+ detail?: string;
189
+ }
190
+ interface GitCloneHandle {
191
+ /**
192
+ * Resolves `ok(null)` if the user cancels the destination picker; on
193
+ * success resolves the registered workspace ready to open.
194
+ */
195
+ result: Promise<GitResult<ElectronWorkspaceInfo | null>>;
196
+ /** Kill git and remove the partial clone directory. */
197
+ cancel: () => void;
198
+ }
199
+ interface DocBlocksHostGitAPI {
200
+ capabilities(): Promise<GitCapabilities>;
201
+ /** Detect a persisted workspace by opaque workspace id and mint repository authority. */
202
+ detectRepo(workspaceId: string): Promise<GitResult<GitRepoDetection>>;
203
+ init(workspaceId: string): Promise<GitResult<void>>;
204
+ status(repositoryId: string): Promise<GitResult<GitStatus>>;
205
+ stage(repositoryId: string, paths: string[]): Promise<GitResult<void>>;
206
+ unstage(repositoryId: string, paths: string[]): Promise<GitResult<void>>;
207
+ /** Revert tracked files to HEAD; delete untracked ones. Destructive — the renderer confirms. */
208
+ discard(repositoryId: string, paths: string[]): Promise<GitResult<void>>;
209
+ /**
210
+ * With `paths`: stages exactly those files (`add -A -- <paths>`) and commits
211
+ * them, leaving other staged entries staged. Without: commits the index as-is.
212
+ */
213
+ commit(repositoryId: string, message: string, paths?: string[]): Promise<GitResult<{
214
+ sha: string;
215
+ }>>;
216
+ push(repositoryId: string, opts?: {
217
+ setUpstream?: boolean;
218
+ }): Promise<GitResult<void>>;
219
+ pull(repositoryId: string): Promise<GitResult<void>>;
220
+ fetch(repositoryId: string): Promise<GitResult<void>>;
221
+ listBranches(repositoryId: string): Promise<GitResult<GitBranchInfo[]>>;
222
+ createBranch(repositoryId: string, name: string, opts?: {
223
+ checkout?: boolean;
224
+ }): Promise<GitResult<void>>;
225
+ checkoutBranch(repositoryId: string, name: string): Promise<GitResult<void>>;
226
+ log(repositoryId: string, opts?: GitLogOptions): Promise<GitResult<GitLogEntry[]>>;
227
+ /** Files changed in one commit plus the full message body. */
228
+ commitFiles(repositoryId: string, sha: string): Promise<GitResult<{
229
+ body: string;
230
+ files: GitFileChange[];
231
+ }>>;
232
+ readFileAtRevision(repositoryId: string, path: string, revision: GitRevision): Promise<GitResult<GitFileAtRevision>>;
233
+ listRemotes(repositoryId: string): Promise<GitResult<GitRemoteInfo[]>>;
234
+ /**
235
+ * Clone a remote repository. The main process shows a native picker for the
236
+ * destination parent directory, then registers the clone as a workspace.
237
+ */
238
+ clone(url: string, onProgress?: (p: GitCloneProgress) => void): GitCloneHandle;
239
+ /** `gh pr create --web` (falls back to `gh pr view --web` if one exists). */
240
+ createPullRequest(repositoryId: string): Promise<GitResult<void>>;
241
+ /**
242
+ * Throttled status stream for a workspace root. Emits once immediately on
243
+ * subscribe. Returns an unsubscribe function.
244
+ */
245
+ onStatusChanged(repositoryId: string, listener: (status: GitStatus) => void): () => void;
246
+ }
247
+
248
+ /**
249
+ * DocBlocksHostAPI — the contract exposed by the Electron desktop shell
250
+ * to its renderer process via contextBridge.
251
+ *
252
+ * This file is the single source of truth for the host ↔ renderer
253
+ * bridge. The Electron preload script exposes an implementation matching
254
+ * this shape; the React renderer calls it through `window.docBlocksHost`.
255
+ */
256
+
257
+ /** Filesystem operations scoped to a main-owned registered workspace id. */
258
+ interface DocBlocksHostFsAPI {
259
+ readFile(workspaceId: string, path: string): Promise<string | null>;
260
+ writeFile(workspaceId: string, path: string, content: string): Promise<void>;
261
+ commitFile(workspaceId: string, path: string, content: string, expectedContent: string | null): Promise<FileCommitResult>;
262
+ delete(workspaceId: string, path: string): Promise<void>;
263
+ rename(workspaceId: string, oldPath: string, newPath: string): Promise<void>;
264
+ readDirectory(workspaceId: string, path: string): Promise<FileSystemEntry[]>;
265
+ exists(workspaceId: string, path: string): Promise<boolean>;
266
+ createDirectory(workspaceId: string, path: string): Promise<void>;
267
+ stat(workspaceId: string, path: string): Promise<FileMeta | null>;
268
+ readBinary(workspaceId: string, path: string): Promise<ArrayBuffer | null>;
269
+ writeBinary(workspaceId: string, path: string, data: ArrayBuffer | Uint8Array): Promise<void>;
270
+ /**
271
+ * Subscribe to change notifications for a watched root. Returns an
272
+ * unsubscribe function. The main process uses chokidar under the hood.
273
+ */
274
+ watch(workspaceId: string, onChange: (path: string) => void): () => void;
275
+ }
276
+ /** Descriptor returned for an Electron-managed workspace (backed by a folder). */
277
+ interface ElectronWorkspaceInfo {
278
+ id: string;
279
+ name: string;
280
+ /** Display/persistence metadata only. Privileged host calls accept `id`, never this path. */
281
+ rootPath: string;
282
+ }
283
+ /** Workspace-management operations exposed to the renderer. */
284
+ interface DocBlocksHostWorkspacesAPI {
285
+ /** List only folders already persisted as trusted main-process roots. */
286
+ list(): Promise<ElectronWorkspaceInfo[]>;
287
+ /**
288
+ * Return the default workspace (creating DocBlocks inside the operating
289
+ * system's Documents folder on first call, or the user's configured default).
290
+ */
291
+ getDefault(): Promise<ElectronWorkspaceInfo>;
292
+ /**
293
+ * Open the native folder picker. Returns null if the user cancels.
294
+ * The selected folder is registered in the main process whitelist.
295
+ */
296
+ pickFolder(): Promise<ElectronWorkspaceInfo | null>;
297
+ /**
298
+ * Re-register a previously picker-approved workspace by main-owned id.
299
+ * Called on app startup before any filesystem operation.
300
+ */
301
+ register(workspaceId: string): Promise<void>;
302
+ /** Remove a workspace from the trusted whitelist. */
303
+ unregister(id: string): Promise<void>;
304
+ }
305
+ /** Shell operations — reveal in Finder/Explorer, open external URLs. */
306
+ interface DocBlocksHostShellAPI {
307
+ /** Reveal a registered workspace root or one root-relative entry. */
308
+ revealInFolder(workspaceId: string, workspacePath?: string): Promise<void>;
309
+ /** Open a URL in the default browser. */
310
+ openExternal(url: string): Promise<void>;
311
+ }
312
+ /** Exact, main-owned export authority. The display path is never authority. */
313
+ interface HostExportTargetGrant {
314
+ /** Null means this is a display-only suggestion and save must show a picker. */
315
+ grantId: string | null;
316
+ displayPath: string;
317
+ }
318
+ /** Native export target selection and binary file writing. */
319
+ interface DocBlocksHostExportAPI {
320
+ /** Resolve an exact remembered grant or a display-only host suggestion. */
321
+ resolveTarget(documentId: string, filename: string): Promise<HostExportTargetGrant>;
322
+ /** Open the native Save dialog and remember the selected target. */
323
+ pickTarget(documentId: string, filename: string, currentGrantId?: string | null): Promise<HostExportTargetGrant | null>;
324
+ /** Write only to an exact target granted by the main process. */
325
+ save(documentId: string, filename: string, grantId: string | null, data: ArrayBuffer | Uint8Array): Promise<HostExportTargetGrant | null>;
326
+ }
327
+ /** System ffmpeg detection and invocation. */
328
+ interface DocBlocksHostFfmpegAPI {
329
+ /** True if `ffmpeg` is available on PATH (or bundled). */
330
+ available(): Promise<boolean>;
331
+ /** Version string from `ffmpeg -version`, or null if unavailable. */
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
+ }
339
+ /** Auto-updater control. */
340
+ interface DocBlocksHostUpdaterAPI {
341
+ /** Kick off a check; resolves to true if an update is available. */
342
+ checkForUpdates(): Promise<boolean>;
343
+ /** Current app version string. */
344
+ getVersion(): Promise<string>;
345
+ /**
346
+ * Quit the app and apply a downloaded update. Should only be called
347
+ * after an `UpdaterStatus` of kind `'downloaded'` has been observed.
348
+ */
349
+ quitAndInstall(): Promise<UpdateInstallResult>;
350
+ /**
351
+ * Subscribe to updater status events. Returns an unsubscribe function.
352
+ */
353
+ onStatus(listener: (status: UpdaterStatus) => void): () => void;
354
+ }
355
+ type UpdateInstallResult = 'installing' | 'cancelled' | 'not-ready';
356
+ type UpdaterStatus = {
357
+ kind: 'checking';
358
+ } | {
359
+ kind: 'available';
360
+ version: string;
361
+ releaseNotes?: string;
362
+ releaseUrl?: string;
363
+ } | {
364
+ kind: 'not-available';
365
+ } | {
366
+ kind: 'downloading';
367
+ percent: number;
368
+ } | {
369
+ kind: 'downloaded';
370
+ version: string;
371
+ releaseNotes?: string;
372
+ releaseUrl?: string;
373
+ } | {
374
+ kind: 'error';
375
+ message: string;
376
+ };
377
+ /** Menu-command events pushed from the main process to the renderer. */
378
+ type MenuCommand = 'file:new' | 'file:openFolder' | 'file:revealWorkspace' | 'file:settings' | 'git:commit' | 'git:push' | 'git:pull' | 'git:fetch' | 'git:newBranch' | 'git:switchBranch' | 'git:history' | 'git:clone' | 'git:openOnRemote' | 'git:createPullRequest' | 'help:about' | 'help:checkForUpdates' | 'help:viewOnGitHub';
379
+ /**
380
+ * OS open-file / deep-link event resolved by the host.
381
+ * - 'workspace-file': a file inside an already-registered workspace.
382
+ * - 'external-file': a loose markdown file outside any workspace — opened in a
383
+ * transient workspace and saved through an opaque resource grant.
384
+ * - 'external-bundle': a `.dbk`/zip bundle — unpacked into a transient
385
+ * workspace and re-zipped through an opaque resource grant on save.
386
+ */
387
+ type OpenRequest = {
388
+ kind: 'workspace-file';
389
+ workspaceId: string;
390
+ /** Slash-prefixed path relative to the workspace root. */
391
+ path: string;
392
+ } | {
393
+ kind: 'external-file';
394
+ resourceId: string;
395
+ name: string;
396
+ } | {
397
+ kind: 'external-bundle';
398
+ resourceId: string;
399
+ name: string;
400
+ };
401
+ /**
402
+ * Read/write access to individual OS files the user has explicitly opened
403
+ * (via "Open With" / deep link), outside the workspace-root whitelist. The
404
+ * main process gates these with owner-scoped, exact-file capabilities.
405
+ */
406
+ interface DocBlocksHostExternalAPI {
407
+ readText(resourceId: string): Promise<string | null>;
408
+ readBinary(resourceId: string): Promise<ArrayBuffer | null>;
409
+ writeText(resourceId: string, content: string): Promise<void>;
410
+ writeBinary(resourceId: string, data: ArrayBuffer | Uint8Array): Promise<void>;
411
+ commitText(resourceId: string, content: string, expectedContent: string | null): Promise<FileCommitResult>;
412
+ commitBinary(resourceId: string, data: ArrayBuffer | Uint8Array, expectedVersion: string | null): Promise<ExternalBinaryCommitResult>;
413
+ /** Revoke one external resource when its transient document is closed. */
414
+ revoke(resourceId: string): Promise<void>;
415
+ }
416
+ type ExternalBinaryCommitResult = {
417
+ status: 'committed';
418
+ version: string;
419
+ } | {
420
+ status: 'conflict';
421
+ version: string | null;
422
+ data: ArrayBuffer | null;
423
+ };
424
+ /** Environment metadata provided by the host. */
425
+ interface HostEnvironment {
426
+ platform: 'darwin' | 'win32' | 'linux';
427
+ appVersion: string;
428
+ isDev: boolean;
429
+ }
430
+ type HostCloseReason = 'window-close' | 'app-quit' | 'update-install' | 'reload' | 'force-reload';
431
+ interface HostPrepareCloseRequest {
432
+ requestId: string;
433
+ reason: HostCloseReason;
434
+ /** Absolute epoch-millisecond deadline chosen by the main process. */
435
+ deadline: number;
436
+ }
437
+ type HostPrepareCloseResult = {
438
+ status: 'ready';
439
+ persistedRevision: number;
440
+ } | {
441
+ status: 'blocked';
442
+ code: 'save-failed' | 'external-conflict' | 'not-ready';
443
+ message: string;
444
+ };
445
+ /**
446
+ * Main-owned close handshake. Preload privately correlates replies; the
447
+ * renderer never chooses request or window identifiers.
448
+ */
449
+ interface DocBlocksHostLifecycleAPI {
450
+ onPrepareClose(listener: (request: HostPrepareCloseRequest) => Promise<HostPrepareCloseResult>): () => void;
451
+ onCancelClose(listener: (requestId: string) => void): () => void;
452
+ }
453
+ /** The full DocBlocks desktop host API. */
454
+ interface DocBlocksHostAPI {
455
+ env: HostEnvironment;
456
+ fs: DocBlocksHostFsAPI;
457
+ fsV2: DocBlocksHostFsV2API;
458
+ external: DocBlocksHostExternalAPI;
459
+ workspaces: DocBlocksHostWorkspacesAPI;
460
+ shell: DocBlocksHostShellAPI;
461
+ exports: DocBlocksHostExportAPI;
462
+ ffmpeg: DocBlocksHostFfmpegAPI;
463
+ git: DocBlocksHostGitAPI;
464
+ updater: DocBlocksHostUpdaterAPI;
465
+ lifecycle: DocBlocksHostLifecycleAPI;
466
+ /**
467
+ * Subscribe to menu commands dispatched by the native menu.
468
+ * Returns an unsubscribe function.
469
+ */
470
+ onMenuCommand(listener: (cmd: MenuCommand) => void): () => void;
471
+ /**
472
+ * Subscribe to open-file / open-url requests from the OS.
473
+ * Returns an unsubscribe function.
474
+ */
475
+ onOpenRequest(listener: (request: OpenRequest) => void): () => void;
476
+ }
477
+
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 };
@@ -0,0 +1,3 @@
1
+ /** Runtime-validated VS Code host/webview wire protocol. */
2
+ export * from './messages.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vscode/index.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,cAAc,eAAe,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Runtime-validated VS Code host/webview wire protocol. */
2
+ export * from './messages.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/vscode/index.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,cAAc,eAAe,CAAC"}