@bendyline/docblocks 2.6.2 → 2.7.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 (62) hide show
  1. package/THIRD_PARTY_NOTICES.txt +33 -33
  2. package/dist/capabilities-CdQAc745.d.ts +1233 -0
  3. package/dist/catalog-BQK05tne.d.ts +122 -0
  4. package/dist/chunk-245W57QP.js +31 -0
  5. package/dist/{chunk-2WDJ27EH.js → chunk-46AGYHDY.js} +8 -0
  6. package/dist/{chunk-4437YWLE.js → chunk-6UPO2GE6.js} +4 -2
  7. package/dist/{chunk-UMWCTEXW.js → chunk-7SN7YQL4.js} +211 -40
  8. package/dist/{chunk-OQCPBOQA.js → chunk-DAPFSEKY.js} +35 -0
  9. package/dist/{chunk-M62ZGJ5I.js → chunk-HABG2JM3.js} +0 -17
  10. package/dist/{chunk-YM7O3PWO.js → chunk-HKOOHM67.js} +20 -12
  11. package/dist/chunk-IDYE73TU.js +77 -0
  12. package/dist/{chunk-KLQKU74Q.js → chunk-IGB2VSRE.js} +124 -330
  13. package/dist/{chunk-5MJC4KOE.js → chunk-L6PRMR7T.js} +53 -101
  14. package/dist/chunk-LPIJ6HKL.js +19 -0
  15. package/dist/{chunk-SJBB5OD7.js → chunk-QS5WTLUZ.js} +10 -8
  16. package/dist/chunk-R2JX5N3F.js +382 -0
  17. package/dist/{chunk-ZO7G53QP.js → chunk-UDEWLHQI.js} +4 -2
  18. package/dist/chunk-UK7R3RC7.js +514 -0
  19. package/dist/chunk-XTNWCNSK.js +464 -0
  20. package/dist/chunk-YHSFRPBS.js +42 -0
  21. package/dist/chunk-YNUQG4GF.js +1173 -0
  22. package/dist/document/index.d.ts +31 -1
  23. package/dist/document/index.js +7 -6
  24. package/dist/filesystem/electron.d.ts +8 -35
  25. package/dist/filesystem/electron.js +7 -4
  26. package/dist/filesystem/host.d.ts +28 -0
  27. package/dist/filesystem/host.js +103 -0
  28. package/dist/filesystem/index.d.ts +52 -6
  29. package/dist/filesystem/index.js +36 -15
  30. package/dist/filesystem/indexeddb.d.ts +8 -1
  31. package/dist/filesystem/indexeddb.js +7 -6
  32. package/dist/filesystem/memory.d.ts +2 -1
  33. package/dist/filesystem/memory.js +3 -2
  34. package/dist/filesystem/native.d.ts +2 -1
  35. package/dist/filesystem/native.js +3 -2
  36. package/dist/filesystem-v2-C8AdSXUN.d.ts +74 -0
  37. package/dist/host/index.d.ts +127 -5
  38. package/dist/host/index.js +98 -4
  39. package/dist/host/mobile.d.ts +389 -0
  40. package/dist/host/mobile.js +315 -0
  41. package/dist/host-provider-v2-CyLTRKJF.d.ts +51 -0
  42. package/dist/index.d.ts +8 -5
  43. package/dist/index.js +151 -34
  44. package/dist/mcp/index.d.ts +2 -2
  45. package/dist/mcp/zod.d.ts +23 -1
  46. package/dist/mcp/zod.js +1 -0
  47. package/dist/settings-HrrCikVX.d.ts +170 -0
  48. package/dist/types-BvDnr3YU.d.ts +88 -0
  49. package/dist/{types-Oy9U5FST.d.ts → types-d0yvHUJz.d.ts} +6 -0
  50. package/dist/{types-Bb3yccTH.d.ts → v2-BVnZZyd4.d.ts} +1 -86
  51. package/dist/vscode/index.d.ts +43 -1
  52. package/dist/vscode/index.js +67 -1
  53. package/dist/workspace/index.d.ts +10 -6
  54. package/dist/workspace/index.js +4 -2
  55. package/dist/workspace-index/index.d.ts +240 -0
  56. package/dist/workspace-index/index.js +1287 -0
  57. package/dist/workspace-settings/index.d.ts +301 -0
  58. package/dist/workspace-settings/index.js +820 -0
  59. package/package.json +22 -2
  60. package/dist/chunk-KFWPPIJH.js +0 -45
  61. package/dist/chunk-QI6YKTQV.js +0 -110
  62. package/dist/types-DhLZZNEn.d.ts +0 -577
@@ -1,577 +0,0 @@
1
- import { S as SerializedFsError, n as FileSystemFileSnapshot, K as FileSystemWriteOptions, r as FileSystemProviderCapabilities, k as FileSystemEntrySnapshot, m as FileSystemFileRead, 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-Bb3yccTH.js';
2
- import { a as WorkspacePath } from './workspace-path-CWVrcuPL.js';
3
-
4
- /** File size and per-message size are deliberately separate budgets. */
5
- declare const FILE_SYSTEM_TRANSFER_LIMITS: Readonly<{
6
- fileBytes: number;
7
- chunkBytes: number;
8
- totalBytes: number;
9
- transfers: 4;
10
- idleMs: 120000;
11
- lifetimeMs: number;
12
- }>;
13
- interface HostFileSystemReadTransfer {
14
- readonly transferId: string;
15
- readonly entry: FileSystemFileSnapshot;
16
- }
17
- /** Stable capabilities shared by the Electron v2 client and native backend. */
18
- declare const ELECTRON_FILE_SYSTEM_V2_CAPABILITIES: FileSystemProviderCapabilities;
19
- /** Explicit result envelope; Electron does not preserve custom Error fields. */
20
- type HostFileSystemV2Result<T> = {
21
- readonly ok: true;
22
- readonly value: T;
23
- } | {
24
- readonly ok: false;
25
- readonly error: SerializedFsError;
26
- };
27
- interface HostFileSystemV2OpenRequest {
28
- readonly instanceId: string;
29
- /** Main-owned persisted workspace authority, never an absolute path. */
30
- readonly providerId: string;
31
- readonly label: string;
32
- }
33
- type HostFileSystemV2WatchMessage = {
34
- readonly instanceId: string;
35
- readonly subscriptionId: string;
36
- readonly kind: 'event';
37
- readonly event: FileSystemWatchEvent;
38
- } | {
39
- readonly instanceId: string;
40
- readonly subscriptionId: string;
41
- readonly kind: 'error';
42
- readonly error: SerializedFsError;
43
- };
44
- /** Wire-level filesystem v2 API exposed by preload. */
45
- interface DocBlocksHostFsV2API {
46
- /** Optional for compatibility with older preload versions. */
47
- beginRead?(instanceId: string, path: WorkspacePath): Promise<HostFileSystemV2Result<HostFileSystemReadTransfer | null>>;
48
- readChunk?(instanceId: string, transferId: string, offset: number): Promise<HostFileSystemV2Result<ArrayBuffer>>;
49
- beginWrite?(instanceId: string, path: WorkspacePath, byteLength: number, options?: FileSystemWriteOptions): Promise<HostFileSystemV2Result<string>>;
50
- writeChunk?(instanceId: string, transferId: string, offset: number, data: ArrayBuffer | Uint8Array): Promise<HostFileSystemV2Result<null>>;
51
- finishWrite?(instanceId: string, transferId: string): Promise<HostFileSystemV2Result<FileSystemFileSnapshot>>;
52
- closeTransfer?(instanceId: string, transferId: string): Promise<HostFileSystemV2Result<null>>;
53
- open(request: HostFileSystemV2OpenRequest): Promise<HostFileSystemV2Result<FileSystemProviderCapabilities>>;
54
- stat(instanceId: string, path: WorkspacePath): Promise<HostFileSystemV2Result<FileSystemEntrySnapshot | null>>;
55
- readFile(instanceId: string, path: WorkspacePath): Promise<HostFileSystemV2Result<FileSystemFileRead | null>>;
56
- readDirectory(instanceId: string, path: WorkspacePath): Promise<HostFileSystemV2Result<readonly FileSystemEntrySnapshot[]>>;
57
- writeFile(instanceId: string, path: WorkspacePath, data: ArrayBuffer | Uint8Array, options?: FileSystemWriteOptions): Promise<HostFileSystemV2Result<FileSystemFileSnapshot>>;
58
- createDirectory(instanceId: string, path: WorkspacePath, options?: FileSystemCreateDirectoryOptions): Promise<HostFileSystemV2Result<FileSystemDirectorySnapshot>>;
59
- remove(instanceId: string, path: WorkspacePath, options?: FileSystemRemoveOptions): Promise<HostFileSystemV2Result<FileSystemRemoveResult>>;
60
- move(instanceId: string, oldPath: WorkspacePath, newPath: WorkspacePath, options?: FileSystemMoveOptions): Promise<HostFileSystemV2Result<FileSystemEntrySnapshot>>;
61
- snapshot(instanceId: string): Promise<HostFileSystemV2Result<FileSystemSnapshot>>;
62
- watchSubscribe(instanceId: string, subscriptionId: string): Promise<HostFileSystemV2Result<null>>;
63
- watchUnsubscribe(instanceId: string, subscriptionId: string): Promise<HostFileSystemV2Result<null>>;
64
- dispose(instanceId: string): Promise<HostFileSystemV2Result<null>>;
65
- onWatchMessage(listener: (message: HostFileSystemV2WatchMessage) => void): () => void;
66
- }
67
-
68
- /**
69
- * Git host API — wire types for the desktop shell's git integration.
70
- *
71
- * The desktop app spawns the user's system git from the main process, so
72
- * credentials (helpers, SSH agent, signing config and raw remote URLs) remain
73
- * in the main process. Everything here is generic git; the only host-specific
74
- * conveniences are remote-URL parsing (`GitRemoteInfo.web`) and PR creation
75
- * via the GitHub CLI when installed.
76
- *
77
- * Expected git failures cross IPC as data (`GitResult`), never as thrown
78
- * errors — `ipcMain.handle` rejections lose structure. Throwing is reserved
79
- * for contract violations (unregistered root, path escape).
80
- */
81
-
82
- /** Every git operation resolves this — expected failures are data, not throws. */
83
- type GitResult<T> = {
84
- ok: true;
85
- value: T;
86
- } | {
87
- ok: false;
88
- error: GitError;
89
- };
90
- interface GitError {
91
- code: GitErrorCode;
92
- /** One-line human summary (classified stderr or synthesized). */
93
- message: string;
94
- /** Truncated raw stderr for a details disclosure in the UI. */
95
- stderr?: string;
96
- exitCode?: number;
97
- }
98
- 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';
99
- interface GitCapabilities {
100
- /** False in store-sandboxed builds, when git is absent, or git < 2.23. */
101
- gitAvailable: boolean;
102
- gitVersion: string | null;
103
- ghAvailable: boolean;
104
- ghVersion: string | null;
105
- }
106
- interface GitRepoDetection {
107
- isRepo: boolean;
108
- /** False when the workspace root is a subdirectory of a larger repo. */
109
- rootIsToplevel?: boolean;
110
- /** Main-owned repository authority; absent while expanded access is ungranted. */
111
- repositoryId?: string;
112
- /** True when Git metadata or the work tree extends beyond the workspace grant. */
113
- requiresExpandedGrant?: boolean;
114
- /**
115
- * Display path of the enclosing repository root. Present only alongside
116
- * `requiresExpandedGrant` so the in-app consent surface can name what the
117
- * user would be granting access to.
118
- */
119
- repositoryRoot?: string;
120
- }
121
- type GitFileStatusCode = 'added' | 'modified' | 'deleted' | 'renamed' | 'copied' | 'type-changed' | 'untracked' | 'ignored' | 'unmerged';
122
- interface GitFileChange {
123
- /** Slash-prefixed path relative to the WORKSPACE root (fs API convention). */
124
- path: string;
125
- /** Previous path for renames/copies (workspace-relative, slash-prefixed). */
126
- origPath?: string;
127
- /** Index-vs-HEAD state (staged), if any. */
128
- index?: GitFileStatusCode;
129
- /** Worktree-vs-index state (unstaged), if any. */
130
- worktree?: GitFileStatusCode;
131
- conflicted: boolean;
132
- }
133
- interface GitStatus {
134
- /** Branch name; null when detached or unborn with no branch. */
135
- branch: string | null;
136
- detached: boolean;
137
- /** HEAD points at a branch with no commits yet. */
138
- unborn: boolean;
139
- /** Full HEAD SHA; null when unborn. */
140
- head: string | null;
141
- /** Upstream ref short name, e.g. "origin/main". */
142
- upstream: string | null;
143
- ahead: number;
144
- behind: number;
145
- changes: GitFileChange[];
146
- /** True when `changes` was capped. */
147
- truncated: boolean;
148
- operation: 'merge' | 'rebase' | 'cherry-pick' | 'revert' | 'bisect' | null;
149
- }
150
- interface GitBranchInfo {
151
- /** "main" for local branches, "origin/main" for remote entries. */
152
- name: string;
153
- kind: 'local' | 'remote';
154
- current: boolean;
155
- upstream: string | null;
156
- ahead: number;
157
- behind: number;
158
- upstreamGone: boolean;
159
- headSha: string;
160
- headSubject: string;
161
- /** ISO 8601. */
162
- headDate: string;
163
- }
164
- interface GitLogOptions {
165
- /** Workspace-relative file path — per-file history (follows renames). */
166
- path?: string;
167
- /** Default 100; the host caps at 1000. */
168
- maxCount?: number;
169
- skip?: number;
170
- }
171
- interface GitLogEntry {
172
- sha: string;
173
- parents: string[];
174
- authorName: string;
175
- authorEmail: string;
176
- /** ISO 8601. */
177
- authorDate: string;
178
- subject: string;
179
- /** Ref decorations ("HEAD -> main", "origin/main", "tag: v1"). */
180
- refs: string[];
181
- }
182
- /** Typed revision selector — the renderer never passes raw rev strings. */
183
- type GitRevision = {
184
- kind: 'head';
185
- } | {
186
- kind: 'index';
187
- } | {
188
- kind: 'commit';
189
- sha: string;
190
- } | {
191
- kind: 'parent-of';
192
- sha: string;
193
- };
194
- interface GitFileAtRevision {
195
- /** Null when the file is absent at that revision, or binary/too large. */
196
- content: string | null;
197
- binary: boolean;
198
- }
199
- interface GitRemoteInfo {
200
- name: string;
201
- /** Sanitized web location. Raw fetch/push URLs never cross IPC. */
202
- web: {
203
- host: string;
204
- owner: string;
205
- repo: string;
206
- webUrl: string;
207
- } | null;
208
- }
209
- interface GitCloneProgress {
210
- /** e.g. "Receiving objects", "Resolving deltas", "Checking out files". */
211
- phase: string;
212
- percent: number | null;
213
- /** Raw progress line for display. */
214
- detail?: string;
215
- }
216
- interface GitCloneHandle {
217
- /**
218
- * Resolves `ok(null)` if the user cancels the destination picker; on
219
- * success resolves the registered workspace ready to open.
220
- */
221
- result: Promise<GitResult<ElectronWorkspaceInfo | null>>;
222
- /** Kill git and remove the partial clone directory. */
223
- cancel: () => void;
224
- }
225
- interface DocBlocksHostGitAPI {
226
- capabilities(): Promise<GitCapabilities>;
227
- /**
228
- * Detect a persisted workspace by opaque workspace id and mint repository
229
- * authority. Never prompts: a workspace inside a larger repository comes
230
- * back with `requiresExpandedGrant` and no `repositoryId` until the user
231
- * opts in through `grantExpandedRepo`.
232
- */
233
- detectRepo(workspaceId: string): Promise<GitResult<GitRepoDetection>>;
234
- /**
235
- * Grant expanded access to the repository enclosing the workspace and mint
236
- * repository authority. Must be called from an explicit user gesture. The
237
- * choice is remembered for that repository; `always` remembers it for every
238
- * repository opened from a subfolder.
239
- */
240
- grantExpandedRepo(workspaceId: string, opts?: {
241
- always?: boolean;
242
- }): Promise<GitResult<GitRepoDetection>>;
243
- init(workspaceId: string): Promise<GitResult<void>>;
244
- status(repositoryId: string): Promise<GitResult<GitStatus>>;
245
- stage(repositoryId: string, paths: string[]): Promise<GitResult<void>>;
246
- unstage(repositoryId: string, paths: string[]): Promise<GitResult<void>>;
247
- /** Revert tracked files to HEAD; delete untracked ones. Destructive — the renderer confirms. */
248
- discard(repositoryId: string, paths: string[]): Promise<GitResult<void>>;
249
- /**
250
- * With `paths`: stages exactly those files (`add -A -- <paths>`) and commits
251
- * them, leaving other staged entries staged. Without: commits the index as-is.
252
- */
253
- commit(repositoryId: string, message: string, paths?: string[]): Promise<GitResult<{
254
- sha: string;
255
- }>>;
256
- push(repositoryId: string, opts?: {
257
- setUpstream?: boolean;
258
- }): Promise<GitResult<void>>;
259
- pull(repositoryId: string): Promise<GitResult<void>>;
260
- fetch(repositoryId: string): Promise<GitResult<void>>;
261
- listBranches(repositoryId: string): Promise<GitResult<GitBranchInfo[]>>;
262
- createBranch(repositoryId: string, name: string, opts?: {
263
- checkout?: boolean;
264
- }): Promise<GitResult<void>>;
265
- checkoutBranch(repositoryId: string, name: string): Promise<GitResult<void>>;
266
- log(repositoryId: string, opts?: GitLogOptions): Promise<GitResult<GitLogEntry[]>>;
267
- /** Files changed in one commit plus the full message body. */
268
- commitFiles(repositoryId: string, sha: string): Promise<GitResult<{
269
- body: string;
270
- files: GitFileChange[];
271
- }>>;
272
- readFileAtRevision(repositoryId: string, path: string, revision: GitRevision): Promise<GitResult<GitFileAtRevision>>;
273
- listRemotes(repositoryId: string): Promise<GitResult<GitRemoteInfo[]>>;
274
- /**
275
- * Clone a remote repository. The main process shows a native picker for the
276
- * destination parent directory, then registers the clone as a workspace.
277
- */
278
- clone(url: string, onProgress?: (p: GitCloneProgress) => void): GitCloneHandle;
279
- /** `gh pr create --web` (falls back to `gh pr view --web` if one exists). */
280
- createPullRequest(repositoryId: string): Promise<GitResult<void>>;
281
- /**
282
- * Throttled status stream for a workspace root. Emits once immediately on
283
- * subscribe. Returns an unsubscribe function.
284
- */
285
- onStatusChanged(repositoryId: string, listener: (status: GitStatus) => void): () => void;
286
- }
287
-
288
- /**
289
- * DocBlocksHostAPI — the contract exposed by the Electron desktop shell
290
- * to its renderer process via contextBridge.
291
- *
292
- * This file is the single source of truth for the host ↔ renderer
293
- * bridge. The Electron preload script exposes an implementation matching
294
- * this shape; the React renderer calls it through `window.docBlocksHost`.
295
- */
296
-
297
- /** Filesystem operations scoped to a main-owned registered workspace id. */
298
- interface DocBlocksHostFsAPI {
299
- readFile(workspaceId: string, path: string): Promise<string | null>;
300
- writeFile(workspaceId: string, path: string, content: string): Promise<void>;
301
- commitFile(workspaceId: string, path: string, content: string, expectedContent: string | null): Promise<FileCommitResult>;
302
- delete(workspaceId: string, path: string): Promise<void>;
303
- rename(workspaceId: string, oldPath: string, newPath: string): Promise<void>;
304
- readDirectory(workspaceId: string, path: string): Promise<FileSystemEntry[]>;
305
- exists(workspaceId: string, path: string): Promise<boolean>;
306
- createDirectory(workspaceId: string, path: string): Promise<void>;
307
- stat(workspaceId: string, path: string): Promise<FileMeta | null>;
308
- readBinary(workspaceId: string, path: string): Promise<ArrayBuffer | null>;
309
- writeBinary(workspaceId: string, path: string, data: ArrayBuffer | Uint8Array): Promise<void>;
310
- /**
311
- * Subscribe to change notifications for a watched root. Returns an
312
- * unsubscribe function. The main process uses chokidar under the hood.
313
- */
314
- watch(workspaceId: string, onChange: (path: string) => void): () => void;
315
- }
316
- /** Descriptor returned for an Electron-managed workspace (backed by a folder). */
317
- interface ElectronWorkspaceInfo {
318
- id: string;
319
- name: string;
320
- /** Display/persistence metadata only. Privileged host calls accept `id`, never this path. */
321
- rootPath: string;
322
- }
323
- /** Workspace-management operations exposed to the renderer. */
324
- interface DocBlocksHostWorkspacesAPI {
325
- /** List only folders already persisted as trusted main-process roots. */
326
- list(): Promise<ElectronWorkspaceInfo[]>;
327
- /**
328
- * Return the default workspace (creating DocBlocks inside the operating
329
- * system's Documents folder on first call, or the user's configured default).
330
- */
331
- getDefault(): Promise<ElectronWorkspaceInfo>;
332
- /**
333
- * Open the native folder picker. Returns null if the user cancels.
334
- * The selected folder is registered in the main process whitelist.
335
- */
336
- pickFolder(): Promise<ElectronWorkspaceInfo | null>;
337
- /**
338
- * Re-register a previously picker-approved workspace by main-owned id.
339
- * Called on app startup before any filesystem operation.
340
- */
341
- register(workspaceId: string): Promise<void>;
342
- /** Remove a workspace from the trusted whitelist. */
343
- unregister(id: string): Promise<void>;
344
- }
345
- /** Shell operations — reveal in Finder/Explorer, open external URLs. */
346
- interface DocBlocksHostShellAPI {
347
- /** Reveal a registered workspace root or one root-relative entry. */
348
- revealInFolder(workspaceId: string, workspacePath?: string): Promise<void>;
349
- /** Open a registered workspace root in Finder or the platform file manager. */
350
- openWorkspaceFolder(workspaceId: string): Promise<void>;
351
- /** Open a URL in the default browser. */
352
- openExternal(url: string): Promise<void>;
353
- }
354
- /** Native clipboard operations exposed through the trusted host boundary. */
355
- interface DocBlocksHostClipboardAPI {
356
- /** Replace the system clipboard's plain-text contents. */
357
- writeText(text: string): Promise<void>;
358
- /** Resolve a registered workspace entry in main and copy its absolute path. */
359
- writeWorkspacePath(workspaceId: string, workspacePath: string): Promise<void>;
360
- }
361
- /** Exact, main-owned export authority. The display path is never authority. */
362
- interface HostExportTargetGrant {
363
- /** Null means this is a display-only suggestion and save must show a picker. */
364
- grantId: string | null;
365
- displayPath: string;
366
- }
367
- /** Native export target selection and binary file writing. */
368
- interface DocBlocksHostExportAPI {
369
- /** Resolve an exact remembered grant or a display-only host suggestion. */
370
- resolveTarget(documentId: string, filename: string): Promise<HostExportTargetGrant>;
371
- /** Open the native Save dialog and remember the selected target. */
372
- pickTarget(documentId: string, filename: string, currentGrantId?: string | null): Promise<HostExportTargetGrant | null>;
373
- /** Write only to an exact target granted by the main process. */
374
- save(documentId: string, filename: string, grantId: string | null, data: ArrayBuffer | Uint8Array): Promise<HostExportTargetGrant | null>;
375
- }
376
- /** System ffmpeg detection. */
377
- interface DocBlocksHostFfmpegAPI {
378
- /** True if `ffmpeg` is available on PATH. */
379
- available(): Promise<boolean>;
380
- /** Version string from `ffmpeg -version`, or null if unavailable. */
381
- version(): Promise<string | null>;
382
- }
383
- /** Auto-updater control. */
384
- interface DocBlocksHostUpdaterAPI {
385
- /** Kick off a check without collapsing a failed check into "no update". */
386
- checkForUpdates(): Promise<UpdateCheckResult>;
387
- /** Current app version string. */
388
- getVersion(): Promise<string>;
389
- /**
390
- * Quit the app and apply a downloaded update. Should only be called
391
- * after an `UpdaterStatus` of kind `'downloaded'` has been observed.
392
- */
393
- quitAndInstall(): Promise<UpdateInstallResult>;
394
- /**
395
- * Subscribe to updater status events. Returns an unsubscribe function.
396
- */
397
- onStatus(listener: (status: UpdaterStatus) => void): () => void;
398
- }
399
- type UpdateInstallResult = 'installing' | 'cancelled' | 'not-ready';
400
- type UpdateCheckResult = {
401
- kind: 'available';
402
- version: string;
403
- } | {
404
- kind: 'not-available';
405
- } | {
406
- kind: 'store-managed';
407
- } | {
408
- kind: 'error';
409
- message: string;
410
- };
411
- type UpdaterStatus = {
412
- kind: 'checking';
413
- } | {
414
- kind: 'available';
415
- version: string;
416
- releaseNotes?: string;
417
- releaseUrl?: string;
418
- } | {
419
- kind: 'not-available';
420
- } | {
421
- kind: 'downloading';
422
- percent: number;
423
- } | {
424
- kind: 'downloaded';
425
- version: string;
426
- releaseNotes?: string;
427
- releaseUrl?: string;
428
- } | {
429
- kind: 'error';
430
- message: string;
431
- };
432
- /** Menu-command events pushed from the main process to the renderer. */
433
- 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';
434
- /**
435
- * One pinned document mirrored from the renderer into native menu surfaces.
436
- *
437
- * The renderer owns the authoritative pinned list (localStorage). The main
438
- * process only caches the latest snapshot so the tray / menu bar can offer a
439
- * one-click shortcut per document; it never persists or mutates it.
440
- */
441
- interface HostPinnedDocument {
442
- readonly workspaceId: string;
443
- readonly workspaceName: string;
444
- /** Canonical, root-relative workspace path. */
445
- readonly path: string;
446
- }
447
- /**
448
- * Renderer-to-main channel that keeps native menu surfaces in sync with
449
- * renderer-owned state.
450
- */
451
- interface DocBlocksHostMenuAPI {
452
- /**
453
- * Publish the current pinned-document list so the desktop tray can offer a
454
- * shortcut per document that activates it in the main window. Replaces any
455
- * previously published list; send an empty array to clear the shortcuts.
456
- */
457
- setPinnedDocuments(documents: readonly HostPinnedDocument[]): void;
458
- }
459
- /**
460
- * OS open-file / deep-link event resolved by the host.
461
- * - 'workspace-file': a file inside an already-registered workspace.
462
- * - 'external-file': a loose markdown file outside any workspace — opened in a
463
- * transient workspace and saved through an opaque resource grant.
464
- * - 'external-bundle': a `.dbk`/zip bundle — unpacked into a transient
465
- * workspace and re-zipped through an opaque resource grant on save.
466
- */
467
- type OpenRequest = {
468
- kind: 'workspace-file';
469
- workspaceId: string;
470
- /** Slash-prefixed path relative to the workspace root. */
471
- path: string;
472
- } | {
473
- kind: 'external-file';
474
- resourceId: string;
475
- name: string;
476
- } | {
477
- kind: 'external-bundle';
478
- resourceId: string;
479
- name: string;
480
- };
481
- /**
482
- * Read/write access to individual OS files the user has explicitly opened
483
- * (via "Open With" / deep link), outside the workspace-root whitelist. The
484
- * main process gates these with owner-scoped, exact-file capabilities.
485
- */
486
- interface DocBlocksHostExternalAPI {
487
- readText(resourceId: string): Promise<string | null>;
488
- readBinary(resourceId: string): Promise<ArrayBuffer | null>;
489
- writeText(resourceId: string, content: string): Promise<void>;
490
- writeBinary(resourceId: string, data: ArrayBuffer | Uint8Array): Promise<void>;
491
- commitText(resourceId: string, content: string, expectedContent: string | null): Promise<FileCommitResult>;
492
- commitBinary(resourceId: string, data: ArrayBuffer | Uint8Array, expectedVersion: string | null): Promise<ExternalBinaryCommitResult>;
493
- /** Revoke one external resource when its transient document is closed. */
494
- revoke(resourceId: string): Promise<void>;
495
- }
496
- type ExternalBinaryCommitResult = {
497
- status: 'committed';
498
- version: string;
499
- } | {
500
- status: 'conflict';
501
- version: string | null;
502
- data: ArrayBuffer | null;
503
- };
504
- /**
505
- * Environment metadata provided by the host.
506
- *
507
- * Read synchronously by the renderer, so a host implementation must have
508
- * these values in hand before it exposes the bridge — they cannot be awaited.
509
- *
510
- * Every field is main-process authority. A host must derive them from what it
511
- * actually knows about itself (in Electron: `app.getVersion()` and
512
- * `app.isPackaged`) and never from renderer-visible environment variables:
513
- * `npm_package_version` exists only under an `npm run` script and `NODE_ENV`
514
- * is unset in a packaged app, so both silently lie in exactly the builds users
515
- * install. `appVersion` in particular reaches users through the About surface
516
- * and issue-report URLs.
517
- */
518
- interface HostEnvironment {
519
- platform: 'darwin' | 'win32' | 'linux';
520
- /** Real, user-facing app version. Never a placeholder like '0.0.0'. */
521
- appVersion: string;
522
- /** True only in an unpackaged development run. */
523
- isDev: boolean;
524
- }
525
- type HostCloseReason = 'window-close' | 'app-quit' | 'update-install' | 'reload' | 'force-reload';
526
- interface HostPrepareCloseRequest {
527
- requestId: string;
528
- reason: HostCloseReason;
529
- /** Absolute epoch-millisecond deadline chosen by the main process. */
530
- deadline: number;
531
- }
532
- type HostPrepareCloseResult = {
533
- status: 'ready';
534
- persistedRevision: number;
535
- } | {
536
- status: 'blocked';
537
- code: 'save-failed' | 'external-conflict' | 'not-ready';
538
- message: string;
539
- };
540
- /**
541
- * Main-owned close handshake. Preload privately correlates replies; the
542
- * renderer never chooses request or window identifiers.
543
- */
544
- interface DocBlocksHostLifecycleAPI {
545
- /** Request the main-owned guarded close path for this renderer window. */
546
- requestWindowClose(): void;
547
- onPrepareClose(listener: (request: HostPrepareCloseRequest) => Promise<HostPrepareCloseResult>): () => void;
548
- onCancelClose(listener: (requestId: string) => void): () => void;
549
- }
550
- /** The full DocBlocks desktop host API. */
551
- interface DocBlocksHostAPI {
552
- env: HostEnvironment;
553
- fs: DocBlocksHostFsAPI;
554
- fsV2: DocBlocksHostFsV2API;
555
- external: DocBlocksHostExternalAPI;
556
- workspaces: DocBlocksHostWorkspacesAPI;
557
- shell: DocBlocksHostShellAPI;
558
- clipboard: DocBlocksHostClipboardAPI;
559
- exports: DocBlocksHostExportAPI;
560
- ffmpeg: DocBlocksHostFfmpegAPI;
561
- git: DocBlocksHostGitAPI;
562
- updater: DocBlocksHostUpdaterAPI;
563
- lifecycle: DocBlocksHostLifecycleAPI;
564
- menu: DocBlocksHostMenuAPI;
565
- /**
566
- * Subscribe to menu commands dispatched by the native menu.
567
- * Returns an unsubscribe function.
568
- */
569
- onMenuCommand(listener: (cmd: MenuCommand) => void): () => void;
570
- /**
571
- * Subscribe to open-file / open-url requests from the OS.
572
- * Returns an unsubscribe function.
573
- */
574
- onOpenRequest(listener: (request: OpenRequest) => void): () => void;
575
- }
576
-
577
- export { type GitResult as A, type GitRevision as B, type GitStatus as C, type DocBlocksHostAPI as D, ELECTRON_FILE_SYSTEM_V2_CAPABILITIES as E, FILE_SYSTEM_TRANSFER_LIMITS as F, type GitBranchInfo as G, type HostCloseReason as H, type HostEnvironment as I, type HostExportTargetGrant as J, type HostFileSystemReadTransfer as K, type HostFileSystemV2OpenRequest as L, type HostFileSystemV2Result as M, type HostFileSystemV2WatchMessage as N, type HostPinnedDocument as O, type HostPrepareCloseRequest as P, type HostPrepareCloseResult as Q, type MenuCommand as R, type OpenRequest as S, type UpdateInstallResult as T, type UpdateCheckResult as U, type UpdaterStatus as V, type DocBlocksHostClipboardAPI as a, type DocBlocksHostExportAPI as b, type DocBlocksHostExternalAPI as c, type DocBlocksHostFfmpegAPI as d, type DocBlocksHostFsAPI as e, type DocBlocksHostFsV2API as f, type DocBlocksHostGitAPI as g, type DocBlocksHostLifecycleAPI as h, type DocBlocksHostMenuAPI as i, type DocBlocksHostShellAPI as j, type DocBlocksHostUpdaterAPI as k, type DocBlocksHostWorkspacesAPI as l, type ElectronWorkspaceInfo as m, type ExternalBinaryCommitResult as n, type GitCapabilities as o, type GitCloneHandle as p, type GitCloneProgress as q, type GitError as r, type GitErrorCode as s, type GitFileAtRevision as t, type GitFileChange as u, type GitFileStatusCode as v, type GitLogEntry as w, type GitLogOptions as x, type GitRemoteInfo as y, type GitRepoDetection as z };