@bendyline/docblocks 2.7.3 → 2.7.4

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 (52) hide show
  1. package/THIRD_PARTY_NOTICES.txt +4 -4
  2. package/dist/{capabilities-r03EXSAi.d.ts → capabilities-BJEkIsO1.d.ts} +5 -2
  3. package/dist/{chunk-KQ6756AJ.js → chunk-3GSMJ4MQ.js} +1 -1
  4. package/dist/{chunk-YWYT6K6J.js → chunk-3LXXRIO2.js} +1 -1
  5. package/dist/{chunk-DFMRE22M.js → chunk-7LPIGCBG.js} +17 -3
  6. package/dist/{chunk-UK7R3RC7.js → chunk-BC42VRYW.js} +1 -1
  7. package/dist/{chunk-IGB2VSRE.js → chunk-FIEMYP2N.js} +2 -2
  8. package/dist/{chunk-M5ZNQGR5.js → chunk-IYKGM3PV.js} +1 -1
  9. package/dist/{chunk-6UPO2GE6.js → chunk-K5HRMSXD.js} +3 -3
  10. package/dist/{chunk-ZTSG7AC3.js → chunk-KXQDMZFH.js} +2 -0
  11. package/dist/{chunk-UDEWLHQI.js → chunk-LDAG5NTQ.js} +3 -3
  12. package/dist/{chunk-7SN7YQL4.js → chunk-LJLQYXVL.js} +99 -3
  13. package/dist/{chunk-4I4AG2BH.js → chunk-PSGAZKWO.js} +2 -2
  14. package/dist/{chunk-HKOOHM67.js → chunk-Q3OFZWJS.js} +3 -3
  15. package/dist/{chunk-AYWKIZLD.js → chunk-UTH3HYCZ.js} +5 -1
  16. package/dist/{chunk-QS5WTLUZ.js → chunk-XI2LYBRR.js} +167 -0
  17. package/dist/document/index.d.ts +2 -2
  18. package/dist/document/index.js +3 -3
  19. package/dist/filesystem/electron.d.ts +5 -5
  20. package/dist/filesystem/electron.js +4 -4
  21. package/dist/filesystem/host.d.ts +4 -4
  22. package/dist/filesystem/host.js +4 -4
  23. package/dist/filesystem/index.d.ts +27 -8
  24. package/dist/filesystem/index.js +22 -12
  25. package/dist/filesystem/indexeddb.d.ts +2 -2
  26. package/dist/filesystem/indexeddb.js +4 -4
  27. package/dist/filesystem/memory.d.ts +2 -2
  28. package/dist/filesystem/memory.js +4 -4
  29. package/dist/filesystem/native.d.ts +2 -2
  30. package/dist/filesystem/native.js +4 -4
  31. package/dist/{filesystem-v2-C8AdSXUN.d.ts → filesystem-v2-CXdAPR27.d.ts} +1 -1
  32. package/dist/host/index.d.ts +5 -5
  33. package/dist/host/index.js +1 -1
  34. package/dist/host/mobile.d.ts +2 -2
  35. package/dist/host/mobile.js +1 -1
  36. package/dist/{host-provider-v2-CV0joXaL.d.ts → host-provider-v2-DEWMPiRD.d.ts} +2 -2
  37. package/dist/index.d.ts +8 -7
  38. package/dist/index.js +23 -13
  39. package/dist/mcp/index.js +2 -2
  40. package/dist/mcp/zod.js +2 -2
  41. package/dist/reconcile-electron-Bz-iAY_B.d.ts +142 -0
  42. package/dist/{types-BvDnr3YU.d.ts → types-DLteNrK0.d.ts} +3 -1
  43. package/dist/{v2-BVnZZyd4.d.ts → v2-DwxWjFC0.d.ts} +12 -1
  44. package/dist/vscode/index.d.ts +28 -2
  45. package/dist/vscode/index.js +21 -3
  46. package/dist/workspace/index.d.ts +41 -141
  47. package/dist/workspace/index.js +16 -1
  48. package/dist/workspace-index/index.d.ts +3 -1
  49. package/dist/workspace-index/index.js +18 -2
  50. package/dist/workspace-settings/index.d.ts +1 -1
  51. package/dist/workspace-settings/index.js +3 -3
  52. package/package.json +2 -2
@@ -0,0 +1,142 @@
1
+ import { d as FileSystemProvider } from './types-DLteNrK0.js';
2
+ import { Z as ElectronWorkspaceInfo, aj as HostEnvironment } from './capabilities-BJEkIsO1.js';
3
+
4
+ /**
5
+ * Origin of a transient workspace — records where its contents came from and
6
+ * how to save them back. Set only on `type: 'transient'` workspaces.
7
+ * - 'loose-file' — a single markdown file opened from the OS (Electron);
8
+ * edits write back through an owner-scoped `resourceId` grant.
9
+ * - 'dbk' — a `.dbk`/zip bundle unpacked into memory (Electron); edits are
10
+ * re-zipped and written back through an owner-scoped resource grant.
11
+ * - 'web-file' — a single markdown file launched into the installed web app
12
+ * (File Handling API); edits write back through `handle`.
13
+ * - 'web-dbk' — a `.dbk`/zip bundle launched into the installed web app;
14
+ * edits are re-zipped and written back through `handle`.
15
+ *
16
+ * The web variants hold a live `FileSystemFileHandle`. That is safe because
17
+ * transient descriptors are never persisted — they live only in the
18
+ * in-memory registry (see workspace-manager) for the current page session.
19
+ */
20
+ type TransientOrigin = {
21
+ kind: 'loose-file';
22
+ resourceId: string;
23
+ } | {
24
+ kind: 'dbk';
25
+ resourceId: string;
26
+ /** SHA-256 of the last bundle version acknowledged by the host. */
27
+ version: string | null;
28
+ } | {
29
+ kind: 'web-file';
30
+ handle: FileSystemFileHandle;
31
+ name: string;
32
+ } | {
33
+ kind: 'web-dbk';
34
+ handle: FileSystemFileHandle;
35
+ name: string;
36
+ /** SHA-256 of the last bundle version observed on disk. */
37
+ version: string | null;
38
+ };
39
+ /**
40
+ * Workspace — a named binding to a FileSystemProvider, representing
41
+ * the user's current working context (a folder of markdown files).
42
+ */
43
+ interface WorkspaceDescriptor {
44
+ /** Unique stable identifier (persisted in IndexedDB). */
45
+ id: string;
46
+ /** User-visible label. */
47
+ name: string;
48
+ /**
49
+ * Provider kind:
50
+ * - 'indexeddb' — browser-local storage (web only)
51
+ * - 'native' — File System Access API (web Chrome/Edge only)
52
+ * - 'host-native' — Electron main-process native filesystem
53
+ * - 'transient' — session-only, in-memory (a loose file/`.dbk` opened from
54
+ * the OS, or a document copied from a shared URL). Never persisted; its
55
+ * provider lives in an in-memory registry (see workspace-manager). An
56
+ * `origin` is present only when changes can be saved back externally.
57
+ */
58
+ type: 'indexeddb' | 'native' | 'host-native' | 'transient';
59
+ /** ISO timestamp of last access. */
60
+ lastOpened: string;
61
+ /** Absolute filesystem path for 'host-native' workspaces. */
62
+ rootPath?: string;
63
+ /** For 'transient' workspaces: where the contents came from / save back to. */
64
+ origin?: TransientOrigin;
65
+ /**
66
+ * Per-workspace override for the global versioning preference. When
67
+ * `'inherit'` (or absent), the global preference applies. `'on'` /
68
+ * `'off'` force the corresponding behavior regardless of the global
69
+ * setting. See `resolveVersioningEnabled` in the preferences module.
70
+ */
71
+ versioningOverride?: 'inherit' | 'on' | 'off';
72
+ }
73
+
74
+ /** Parse the complete persisted workspace list before it reaches startup code. */
75
+ declare function parsePersistedWorkspaceList(value: unknown): WorkspaceDescriptor[];
76
+
77
+ /**
78
+ * WorkspaceManager — manages the list of known workspaces in IndexedDB
79
+ * and provides helpers for creating / switching / removing them.
80
+ *
81
+ * The actual FileSystemProvider instances are created by the caller
82
+ * (since native providers need a DirectoryHandle from user interaction).
83
+ */
84
+
85
+ /** Id of the browser-local workspace `ensureDefaultWorkspace` creates. */
86
+ declare const DEFAULT_WORKSPACE_ID = "default";
87
+ /** Register a transient workspace and its (already-built) provider. */
88
+ declare function registerTransientWorkspace(descriptor: WorkspaceDescriptor, provider: FileSystemProvider): void;
89
+ /** Look up a transient workspace (descriptor + provider) by id, if any. */
90
+ declare function getTransientWorkspace(id: string): {
91
+ descriptor: WorkspaceDescriptor;
92
+ provider: FileSystemProvider;
93
+ } | null;
94
+ /** Forget a transient workspace (e.g. when it is closed). */
95
+ declare function unregisterTransientWorkspace(id: string): Promise<void>;
96
+ /**
97
+ * Get all known workspace descriptors — persisted plus any session-only
98
+ * transient ones (so they show in the picker and resolve for the session).
99
+ */
100
+ declare function listWorkspaces(): Promise<WorkspaceDescriptor[]>;
101
+ /**
102
+ * Get a specific workspace descriptor by id (transient or persisted).
103
+ */
104
+ declare function getWorkspace(id: string): Promise<WorkspaceDescriptor | null>;
105
+ /**
106
+ * Add or update a workspace descriptor. If a workspace with the same id
107
+ * already exists, it is replaced. Transient workspaces are never persisted.
108
+ */
109
+ declare function saveWorkspace(workspace: WorkspaceDescriptor): Promise<void>;
110
+ /**
111
+ * Remove a workspace descriptor by id (transient or persisted).
112
+ */
113
+ declare function removeWorkspace(id: string): Promise<void>;
114
+ /**
115
+ * Touch the lastOpened timestamp on a workspace. For transient workspaces this
116
+ * updates the in-memory descriptor only (nothing is persisted).
117
+ */
118
+ declare function touchWorkspace(id: string): Promise<void>;
119
+ /**
120
+ * Ensure a default IndexedDB workspace exists. Called on app startup.
121
+ * Returns the descriptor.
122
+ */
123
+ declare function ensureDefaultWorkspace(): Promise<WorkspaceDescriptor>;
124
+
125
+ interface ElectronWorkspaceReconciliation {
126
+ /** Obsolete renderer descriptors to remove before attempting restoration. */
127
+ readonly removeIds: readonly string[];
128
+ /** Canonical main-authorized descriptors to insert or replace. */
129
+ readonly upsert: readonly WorkspaceDescriptor[];
130
+ /** Safe navigation migration for a local descriptor matched by root. */
131
+ readonly idRemap: Readonly<Record<string, string>>;
132
+ }
133
+ /**
134
+ * Reconcile renderer IndexedDB metadata with the main process authority list.
135
+ * `hostWorkspaces` is authoritative: local Electron descriptors absent from
136
+ * it cannot be opened safely and are removed. Root-path matching carries user
137
+ * metadata across an id migration without treating that display path as
138
+ * authority.
139
+ */
140
+ declare function reconcileElectronWorkspaceDescriptors(local: readonly WorkspaceDescriptor[], hostWorkspaces: readonly ElectronWorkspaceInfo[], platform: HostEnvironment['platform'], now: string): ElectronWorkspaceReconciliation;
141
+
142
+ export { DEFAULT_WORKSPACE_ID as D, type ElectronWorkspaceReconciliation as E, type TransientOrigin as T, type WorkspaceDescriptor as W, getWorkspace as a, registerTransientWorkspace as b, removeWorkspace as c, ensureDefaultWorkspace as e, getTransientWorkspace as g, listWorkspaces as l, parsePersistedWorkspaceList as p, reconcileElectronWorkspaceDescriptors as r, saveWorkspace as s, touchWorkspace as t, unregisterTransientWorkspace as u };
@@ -1,4 +1,4 @@
1
- import { n as FileSystemProviderV2 } from './v2-BVnZZyd4.js';
1
+ import { g as FileSystemEntryReadIssue, o as FileSystemProviderV2 } from './v2-DwxWjFC0.js';
2
2
 
3
3
  /**
4
4
  * FileSystemProvider — abstract interface for a virtual filesystem.
@@ -14,6 +14,8 @@ interface FileEntry {
14
14
  path: string;
15
15
  /** ISO-8601 timestamp when the provider can supply file metadata while listing. */
16
16
  lastModified?: string;
17
+ /** Set when the provider listed the file but could not read it at the time. */
18
+ readIssue?: FileSystemEntryReadIssue;
17
19
  }
18
20
  interface FolderEntry {
19
21
  kind: 'directory';
@@ -92,9 +92,20 @@ interface FileSystemEntrySnapshotBase {
92
92
  /** ISO-8601 timestamp supplied by the backend; versions remain authoritative. */
93
93
  readonly lastModified: string;
94
94
  }
95
+ /** Why a listed file's bytes could not be read when it was observed. */
96
+ interface FileSystemEntryReadIssue {
97
+ readonly code: FsErrorCode;
98
+ readonly message: string;
99
+ }
95
100
  interface FileSystemFileSnapshot extends FileSystemEntrySnapshotBase {
96
101
  readonly kind: 'file';
97
102
  readonly size: number;
103
+ /**
104
+ * Present when a listing or watch observation could not read the file (a
105
+ * sync client holding it, an ACL). The entry stays listed, but its version
106
+ * then reflects metadata only; callers needing content must read the file.
107
+ */
108
+ readonly readIssue?: FileSystemEntryReadIssue;
98
109
  }
99
110
  interface FileSystemDirectorySnapshot extends FileSystemEntrySnapshotBase {
100
111
  readonly kind: 'directory';
@@ -215,4 +226,4 @@ interface FileSystemProviderV2 {
215
226
  dispose(): Promise<void>;
216
227
  }
217
228
 
218
- export { type FileSystemWatchOptions as A, type FileSystemWatchSubscription as B, type FileSystemWriteMode as C, type FileSystemWriteOptions as D, FsError as E, type FileSystemAtomicity as F, type FsErrorCode as G, type FsErrorContext as H, type FsOperation as I, deserializeFsError as J, fsErrorFromUnknown as K, isQuotaExceededError as L, isSerializedFsError as M, mapDomExceptionToFsErrorCode as N, mapNodeErrorCodeToFsErrorCode as O, parseFileSystemVersion as P, serializeFsError as Q, tryParseFileSystemVersion as R, type SerializedFsError as S, type FileSystemCaseSensitivity as a, type FileSystemConditionalWriteStrength as b, type FileSystemCreateDirectoryMode as c, type FileSystemCreateDirectoryOptions as d, type FileSystemDirectorySnapshot as e, type FileSystemDurability as f, type FileSystemEntrySnapshot as g, type FileSystemEntryWatchEvent as h, type FileSystemFileRead as i, type FileSystemFileSnapshot as j, type FileSystemMoveOptions as k, type FileSystemOverflowWatchEvent as l, type FileSystemProviderCapabilities as m, type FileSystemProviderV2 as n, type FileSystemRemoveOptions as o, type FileSystemRemoveResult as p, type FileSystemSnapshot as q, type FileSystemSnapshotEntry as r, type FileSystemSnapshotFile as s, type FileSystemSymlinkPolicy as t, type FileSystemVersion as u, type FileSystemWatchErrorListener as v, type FileSystemWatchEvent as w, type FileSystemWatchEventOrigin as x, type FileSystemWatchEventType as y, type FileSystemWatchListener as z };
229
+ export { type FileSystemWatchListener as A, type FileSystemWatchOptions as B, type FileSystemWatchSubscription as C, type FileSystemWriteMode as D, type FileSystemWriteOptions as E, type FileSystemAtomicity as F, FsError as G, type FsErrorCode as H, type FsErrorContext as I, type FsOperation as J, deserializeFsError as K, fsErrorFromUnknown as L, isQuotaExceededError as M, isSerializedFsError as N, mapDomExceptionToFsErrorCode as O, mapNodeErrorCodeToFsErrorCode as P, parseFileSystemVersion as Q, serializeFsError as R, type SerializedFsError as S, tryParseFileSystemVersion as T, type FileSystemCaseSensitivity as a, type FileSystemConditionalWriteStrength as b, type FileSystemCreateDirectoryMode as c, type FileSystemCreateDirectoryOptions as d, type FileSystemDirectorySnapshot as e, type FileSystemDurability as f, type FileSystemEntryReadIssue as g, type FileSystemEntrySnapshot as h, type FileSystemEntryWatchEvent as i, type FileSystemFileRead as j, type FileSystemFileSnapshot as k, type FileSystemMoveOptions as l, type FileSystemOverflowWatchEvent as m, type FileSystemProviderCapabilities as n, type FileSystemProviderV2 as o, type FileSystemRemoveOptions as p, type FileSystemRemoveResult as q, type FileSystemSnapshot as r, type FileSystemSnapshotEntry as s, type FileSystemSnapshotFile as t, type FileSystemSymlinkPolicy as u, type FileSystemVersion as v, type FileSystemWatchErrorListener as w, type FileSystemWatchEvent as x, type FileSystemWatchEventOrigin as y, type FileSystemWatchEventType as z };
@@ -5,6 +5,11 @@ import '../workspace-path-CWVrcuPL.js';
5
5
  * Typed message protocol between the extension host and webview.
6
6
  */
7
7
 
8
+ interface WikiSuggestionMessage {
9
+ target: string;
10
+ label: string;
11
+ kind: 'article' | 'folder';
12
+ }
8
13
  /**
9
14
  * Bounds for host-persisted proofing state.
10
15
  *
@@ -49,7 +54,7 @@ declare const DOCBLOCKS_WRITE_CANVAS_LINE_SPACING_MAX = 2.4;
49
54
  * registry, and the VS Code `package.json` enum in sync. `'theme'` is the
50
55
  * default and means "inherit from the active theme override".
51
56
  */
52
- declare const DOCBLOCKS_WRITE_CANVAS_FONT_SCHEMES: readonly ["theme", "serif-sans", "sans-sans", "serif-serif", "pt-serif", "hanken", "playfair-pt-serif", "hanken-lora", "dm-serif-dm-sans", "inter"];
57
+ declare const DOCBLOCKS_WRITE_CANVAS_FONT_SCHEMES: readonly ["theme", "serif-sans", "sans-sans", "serif-serif", "pt-serif", "hanken", "playfair-pt-serif", "hanken-lora", "dm-serif-dm-sans", "inter", "inconsolata"];
53
58
  type DocBlocksWriteCanvasFontScheme = (typeof DOCBLOCKS_WRITE_CANVAS_FONT_SCHEMES)[number];
54
59
  interface VscodeWriteCanvasSettings {
55
60
  textSize: number;
@@ -198,6 +203,18 @@ type ExtensionToWebviewMessage = {
198
203
  type: 'workspaceFileRead';
199
204
  requestId: number;
200
205
  dataBase64: string | null;
206
+ } | {
207
+ type: 'wikiLinkResult';
208
+ requestId: number;
209
+ exists: boolean;
210
+ } | {
211
+ type: 'wikiSuggestions';
212
+ requestId: number;
213
+ items: WikiSuggestionMessage[];
214
+ } | {
215
+ type: 'wikiLinkError';
216
+ requestId: number;
217
+ message: string;
201
218
  } | {
202
219
  type: 'workspaceFileError';
203
220
  requestId: number;
@@ -233,6 +250,15 @@ type WebviewToExtensionMessage = {
233
250
  } | {
234
251
  type: 'openLink';
235
252
  href: string;
253
+ } | {
254
+ type: 'wikiSuggestRequest';
255
+ requestId: number;
256
+ query: string;
257
+ } | {
258
+ type: 'wikiLinkRequest';
259
+ requestId: number;
260
+ target: string;
261
+ action: 'exists' | 'open' | 'create';
236
262
  } | {
237
263
  type: 'copyCode';
238
264
  requestId: number;
@@ -354,4 +380,4 @@ declare function isSafeMimeType(value: unknown): value is string;
354
380
  */
355
381
  declare function hasSubstantiveTextChange(baseline: string, candidate: string): boolean;
356
382
 
357
- export { DEFAULT_VSCODE_PROOFING_SETTINGS, DEFAULT_VSCODE_WRITE_CANVAS_SETTINGS, DOCBLOCKS_ACCENT_COLORS, DOCBLOCKS_WRITE_CANVAS_FONT_SCHEMES, 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 DocBlocksWriteCanvasFontScheme, type DocumentConflictChoice, type DocumentConflictDetailsMessage, type DocumentSessionMessageStatus, type ExportTargetGrantMessage, type ExtensionToWebviewMessage, type MediaEntryMessage, PROOF_STATE_LIMITS, VSCODE_CATALOG_STATES, VSCODE_WORKSPACE_SETTINGS_STATUSES, type VscodeCatalogState, type VscodeEditorSettings, type VscodeProofingSettings, type VscodeWorkspaceSettingsState, type VscodeWorkspaceSettingsStatus, type VscodeWriteCanvasSettings, type WebviewToExtensionMessage, hasSubstantiveTextChange, isDocBlocksAccentColor, isDocBlocksWriteCanvasFontScheme, isDocBlocksWriteCanvasLineSpacing, isDocBlocksWriteCanvasTextSize, isSafeExportFilename, isSafeMimeType, normalizeDocBlocksAccentColor, parseExtensionToWebviewMessage, parseVscodeWorkspaceSettingsState, parseWebviewToExtensionMessage };
383
+ export { DEFAULT_VSCODE_PROOFING_SETTINGS, DEFAULT_VSCODE_WRITE_CANVAS_SETTINGS, DOCBLOCKS_ACCENT_COLORS, DOCBLOCKS_WRITE_CANVAS_FONT_SCHEMES, 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 DocBlocksWriteCanvasFontScheme, type DocumentConflictChoice, type DocumentConflictDetailsMessage, type DocumentSessionMessageStatus, type ExportTargetGrantMessage, type ExtensionToWebviewMessage, type MediaEntryMessage, PROOF_STATE_LIMITS, VSCODE_CATALOG_STATES, VSCODE_WORKSPACE_SETTINGS_STATUSES, type VscodeCatalogState, type VscodeEditorSettings, type VscodeProofingSettings, type VscodeWorkspaceSettingsState, type VscodeWorkspaceSettingsStatus, type VscodeWriteCanvasSettings, type WebviewToExtensionMessage, type WikiSuggestionMessage, hasSubstantiveTextChange, isDocBlocksAccentColor, isDocBlocksWriteCanvasFontScheme, isDocBlocksWriteCanvasLineSpacing, isDocBlocksWriteCanvasTextSize, isSafeExportFilename, isSafeMimeType, normalizeDocBlocksAccentColor, parseExtensionToWebviewMessage, parseVscodeWorkspaceSettingsState, parseWebviewToExtensionMessage };
@@ -1,15 +1,18 @@
1
1
  import {
2
2
  parseWorkspaceSettings,
3
3
  parseWorkspaceSettingsPatch
4
- } from "../chunk-UK7R3RC7.js";
4
+ } from "../chunk-BC42VRYW.js";
5
5
  import {
6
6
  HOST_WIRE_LIMITS,
7
7
  isBoundedString
8
8
  } from "../chunk-46AGYHDY.js";
9
- import "../chunk-AYWKIZLD.js";
9
+ import "../chunk-UTH3HYCZ.js";
10
10
 
11
11
  // src/vscode/messages.ts
12
12
  var MAX_REQUEST_ID = 2147483647;
13
+ function isWikiSuggestion(value) {
14
+ return isRecord(value) && hasOnlyKeys(value, ["target", "label", "kind"]) && hasBoundedString(value, "target", 2048, 1) && hasBoundedString(value, "label", 2048, 1) && (value.kind === "article" || value.kind === "folder");
15
+ }
13
16
  var PROOF_STATE_LIMITS = Object.freeze({
14
17
  dictionaryWords: 5e3,
15
18
  wordCharacters: 128,
@@ -38,7 +41,8 @@ var DOCBLOCKS_WRITE_CANVAS_FONT_SCHEMES = [
38
41
  "playfair-pt-serif",
39
42
  "hanken-lora",
40
43
  "dm-serif-dm-sans",
41
- "inter"
44
+ "inter",
45
+ "inconsolata"
42
46
  ];
43
47
  var DEFAULT_VSCODE_WRITE_CANVAS_SETTINGS = {
44
48
  textSize: 16,
@@ -80,6 +84,15 @@ function parseWebviewToExtensionMessage(value) {
80
84
  }
81
85
  case "openLink":
82
86
  return hasOnlyKeys(value, ["type", "href"]) && hasBoundedString(value, "href", HOST_WIRE_LIMITS.urlCharacters, 1) ? { type: "openLink", href: value.href } : null;
87
+ case "wikiSuggestRequest":
88
+ return hasOnlyKeys(value, ["type", "requestId", "query"]) && hasRequestId(value) && hasBoundedString(value, "query", 2048, 0) ? { type: "wikiSuggestRequest", requestId: value.requestId, query: value.query } : null;
89
+ case "wikiLinkRequest":
90
+ return hasOnlyKeys(value, ["type", "requestId", "target", "action"]) && hasRequestId(value) && hasBoundedString(value, "target", 2048, 1) && (value.action === "exists" || value.action === "open" || value.action === "create") ? {
91
+ type: "wikiLinkRequest",
92
+ requestId: value.requestId,
93
+ target: value.target,
94
+ action: value.action
95
+ } : null;
83
96
  case "copyCode":
84
97
  return hasOnlyKeys(value, ["type", "requestId", "code"]) && hasRequestId(value) && hasBoundedString(value, "code", HOST_WIRE_LIMITS.documentCharacters) ? { type: "copyCode", requestId: value.requestId, code: value.code } : null;
85
98
  case "edit":
@@ -299,6 +312,7 @@ function parseExtensionToWebviewMessage(value) {
299
312
  case "exportError":
300
313
  case "proofStateError":
301
314
  case "workspaceFileError":
315
+ case "wikiLinkError":
302
316
  return hasOnlyKeys(value, ["type", "requestId", "message"]) && hasRequestId(value) && hasBoundedString(value, "message", HOST_WIRE_LIMITS.messageCharacters, 1) ? { type: value.type, requestId: value.requestId, message: value.message } : null;
303
317
  case "exportSaved":
304
318
  case "exportTargetResolved":
@@ -309,6 +323,10 @@ function parseExtensionToWebviewMessage(value) {
309
323
  const target = parseExportTargetGrant(value.target);
310
324
  return target !== void 0 ? { type: value.type, requestId: value.requestId, target } : null;
311
325
  }
326
+ case "wikiSuggestions":
327
+ return hasOnlyKeys(value, ["type", "requestId", "items"]) && hasRequestId(value) && Array.isArray(value.items) && value.items.length <= 20 && value.items.every(isWikiSuggestion) ? { type: "wikiSuggestions", requestId: value.requestId, items: value.items } : null;
328
+ case "wikiLinkResult":
329
+ return hasOnlyKeys(value, ["type", "requestId", "exists"]) && hasRequestId(value) && typeof value.exists === "boolean" ? { type: "wikiLinkResult", requestId: value.requestId, exists: value.exists } : null;
312
330
  case "workspaceFileRead":
313
331
  return hasOnlyKeys(value, ["type", "requestId", "dataBase64"]) && hasRequestId(value) && hasNullableBoundedString(value, "dataBase64", HOST_WIRE_LIMITS.base64Characters) ? { type: "workspaceFileRead", requestId: value.requestId, dataBase64: value.dataBase64 } : null;
314
332
  case "workspaceSettings": {
@@ -1,145 +1,45 @@
1
- import { d as FileSystemProvider } from '../types-BvDnr3YU.js';
2
- import { Z as ElectronWorkspaceInfo, aj as HostEnvironment } from '../capabilities-r03EXSAi.js';
3
- import '../v2-BVnZZyd4.js';
4
- import '../workspace-path-CWVrcuPL.js';
5
- import '../filesystem-v2-C8AdSXUN.js';
1
+ export { D as DEFAULT_WORKSPACE_ID, E as ElectronWorkspaceReconciliation, T as TransientOrigin, W as WorkspaceDescriptor, e as ensureDefaultWorkspace, g as getTransientWorkspace, a as getWorkspace, l as listWorkspaces, p as parsePersistedWorkspaceList, r as reconcileElectronWorkspaceDescriptors, b as registerTransientWorkspace, c as removeWorkspace, s as saveWorkspace, t as touchWorkspace, u as unregisterTransientWorkspace } from '../reconcile-electron-Bz-iAY_B.js';
2
+ import { ContentContainer } from '@bendyline/squisq/storage';
3
+ import { o as FileSystemProviderV2 } from '../v2-DwxWjFC0.js';
4
+ import { a as WorkspacePath } from '../workspace-path-CWVrcuPL.js';
5
+ import '../types-DLteNrK0.js';
6
+ import '../capabilities-BJEkIsO1.js';
7
+ import '../filesystem-v2-CXdAPR27.js';
6
8
 
7
- /**
8
- * Origin of a transient workspace — records where its contents came from and
9
- * how to save them back. Set only on `type: 'transient'` workspaces.
10
- * - 'loose-file' — a single markdown file opened from the OS (Electron);
11
- * edits write back through an owner-scoped `resourceId` grant.
12
- * - 'dbk' — a `.dbk`/zip bundle unpacked into memory (Electron); edits are
13
- * re-zipped and written back through an owner-scoped resource grant.
14
- * - 'web-file' — a single markdown file launched into the installed web app
15
- * (File Handling API); edits write back through `handle`.
16
- * - 'web-dbk' — a `.dbk`/zip bundle launched into the installed web app;
17
- * edits are re-zipped and written back through `handle`.
18
- *
19
- * The web variants hold a live `FileSystemFileHandle`. That is safe because
20
- * transient descriptors are never persisted — they live only in the
21
- * in-memory registry (see workspace-manager) for the current page session.
22
- */
23
- type TransientOrigin = {
24
- kind: 'loose-file';
25
- resourceId: string;
26
- } | {
27
- kind: 'dbk';
28
- resourceId: string;
29
- /** SHA-256 of the last bundle version acknowledged by the host. */
30
- version: string | null;
31
- } | {
32
- kind: 'web-file';
33
- handle: FileSystemFileHandle;
34
- name: string;
35
- } | {
36
- kind: 'web-dbk';
37
- handle: FileSystemFileHandle;
38
- name: string;
39
- /** SHA-256 of the last bundle version observed on disk. */
40
- version: string | null;
41
- };
42
- /**
43
- * Workspace — a named binding to a FileSystemProvider, representing
44
- * the user's current working context (a folder of markdown files).
45
- */
46
- interface WorkspaceDescriptor {
47
- /** Unique stable identifier (persisted in IndexedDB). */
48
- id: string;
49
- /** User-visible label. */
50
- name: string;
51
- /**
52
- * Provider kind:
53
- * - 'indexeddb' — browser-local storage (web only)
54
- * - 'native' — File System Access API (web Chrome/Edge only)
55
- * - 'host-native' — Electron main-process native filesystem
56
- * - 'transient' — session-only, in-memory (a loose file/`.dbk` opened from
57
- * the OS, or a document copied from a shared URL). Never persisted; its
58
- * provider lives in an in-memory registry (see workspace-manager). An
59
- * `origin` is present only when changes can be saved back externally.
60
- */
61
- type: 'indexeddb' | 'native' | 'host-native' | 'transient';
62
- /** ISO timestamp of last access. */
63
- lastOpened: string;
64
- /** Absolute filesystem path for 'host-native' workspaces. */
65
- rootPath?: string;
66
- /** For 'transient' workspaces: where the contents came from / save back to. */
67
- origin?: TransientOrigin;
68
- /**
69
- * Per-workspace override for the global versioning preference. When
70
- * `'inherit'` (or absent), the global preference applies. `'on'` /
71
- * `'off'` force the corresponding behavior regardless of the global
72
- * setting. See `resolveVersioningEnabled` in the preferences module.
73
- */
74
- versioningOverride?: 'inherit' | 'on' | 'off';
9
+ declare const WORKSPACE_BACKUP_MANIFEST = "docblocks-backup.json";
10
+ declare const WORKSPACE_BACKUP_LIMITS: Readonly<{
11
+ maxEntries: 10000;
12
+ maxUncompressedBytes: number;
13
+ maxEntryUncompressedBytes: number;
14
+ maxCompressionRatio: 1000;
15
+ }>;
16
+ interface BackupWorkspace {
17
+ readonly name: string;
18
+ readonly prefix: string;
19
+ readonly directories: readonly WorkspacePath[];
75
20
  }
76
-
77
- /** Parse the complete persisted workspace list before it reaches startup code. */
78
- declare function parsePersistedWorkspaceList(value: unknown): WorkspaceDescriptor[];
79
-
80
- /**
81
- * WorkspaceManager — manages the list of known workspaces in IndexedDB
82
- * and provides helpers for creating / switching / removing them.
83
- *
84
- * The actual FileSystemProvider instances are created by the caller
85
- * (since native providers need a DirectoryHandle from user interaction).
86
- */
87
-
88
- /** Id of the browser-local workspace `ensureDefaultWorkspace` creates. */
89
- declare const DEFAULT_WORKSPACE_ID = "default";
90
- /** Register a transient workspace and its (already-built) provider. */
91
- declare function registerTransientWorkspace(descriptor: WorkspaceDescriptor, provider: FileSystemProvider): void;
92
- /** Look up a transient workspace (descriptor + provider) by id, if any. */
93
- declare function getTransientWorkspace(id: string): {
94
- descriptor: WorkspaceDescriptor;
95
- provider: FileSystemProvider;
96
- } | null;
97
- /** Forget a transient workspace (e.g. when it is closed). */
98
- declare function unregisterTransientWorkspace(id: string): Promise<void>;
99
- /**
100
- * Get all known workspace descriptors — persisted plus any session-only
101
- * transient ones (so they show in the picker and resolve for the session).
102
- */
103
- declare function listWorkspaces(): Promise<WorkspaceDescriptor[]>;
104
- /**
105
- * Get a specific workspace descriptor by id (transient or persisted).
106
- */
107
- declare function getWorkspace(id: string): Promise<WorkspaceDescriptor | null>;
108
- /**
109
- * Add or update a workspace descriptor. If a workspace with the same id
110
- * already exists, it is replaced. Transient workspaces are never persisted.
111
- */
112
- declare function saveWorkspace(workspace: WorkspaceDescriptor): Promise<void>;
113
- /**
114
- * Remove a workspace descriptor by id (transient or persisted).
115
- */
116
- declare function removeWorkspace(id: string): Promise<void>;
117
- /**
118
- * Touch the lastOpened timestamp on a workspace. For transient workspaces this
119
- * updates the in-memory descriptor only (nothing is persisted).
120
- */
121
- declare function touchWorkspace(id: string): Promise<void>;
122
- /**
123
- * Ensure a default IndexedDB workspace exists. Called on app startup.
124
- * Returns the descriptor.
125
- */
126
- declare function ensureDefaultWorkspace(): Promise<WorkspaceDescriptor>;
127
-
128
- interface ElectronWorkspaceReconciliation {
129
- /** Obsolete renderer descriptors to remove before attempting restoration. */
130
- readonly removeIds: readonly string[];
131
- /** Canonical main-authorized descriptors to insert or replace. */
132
- readonly upsert: readonly WorkspaceDescriptor[];
133
- /** Safe navigation migration for a local descriptor matched by root. */
134
- readonly idRemap: Readonly<Record<string, string>>;
21
+ interface WorkspaceBackupManifest {
22
+ readonly format: 'docblocks-workspace-backup';
23
+ readonly version: 1;
24
+ readonly workspaces: readonly BackupWorkspace[];
135
25
  }
136
- /**
137
- * Reconcile renderer IndexedDB metadata with the main process authority list.
138
- * `hostWorkspaces` is authoritative: local Electron descriptors absent from
139
- * it cannot be opened safely and are removed. Root-path matching carries user
140
- * metadata across an id migration without treating that display path as
141
- * authority.
142
- */
143
- declare function reconcileElectronWorkspaceDescriptors(local: readonly WorkspaceDescriptor[], hostWorkspaces: readonly ElectronWorkspaceInfo[], platform: HostEnvironment['platform'], now: string): ElectronWorkspaceReconciliation;
26
+ interface RestorableWorkspace {
27
+ readonly name: string;
28
+ readonly directories: readonly WorkspacePath[];
29
+ readonly files: readonly {
30
+ path: WorkspacePath;
31
+ data: ArrayBuffer;
32
+ }[];
33
+ }
34
+ declare function parseWorkspaceBackupManifest(value: unknown): WorkspaceBackupManifest;
35
+ /** Capture bytes and empty directories without modifying the source workspace. */
36
+ declare function appendWorkspaceBackup(container: ContentContainer, provider: FileSystemProviderV2, previous: readonly BackupWorkspace[]): Promise<BackupWorkspace[]>;
37
+ declare function finishWorkspaceBackup(container: ContentContainer, workspaces: readonly BackupWorkspace[]): Promise<void>;
38
+ /** Validate the complete archive before creating any destination workspace.
39
+ * Legacy plain ZIP backups restore as one workspace, retaining their full tree.
40
+ */
41
+ declare function readWorkspaceBackup(container: ContentContainer, legacyName: string): Promise<RestorableWorkspace[]>;
42
+ /** Only an empty, newly allocated destination may receive a restored tree. */
43
+ declare function restoreWorkspaceBackup(workspace: RestorableWorkspace, provider: FileSystemProviderV2): Promise<void>;
144
44
 
145
- export { DEFAULT_WORKSPACE_ID, type ElectronWorkspaceReconciliation, type TransientOrigin, type WorkspaceDescriptor, ensureDefaultWorkspace, getTransientWorkspace, getWorkspace, listWorkspaces, parsePersistedWorkspaceList, reconcileElectronWorkspaceDescriptors, registerTransientWorkspace, removeWorkspace, saveWorkspace, touchWorkspace, unregisterTransientWorkspace };
45
+ export { type BackupWorkspace, type RestorableWorkspace, WORKSPACE_BACKUP_LIMITS, WORKSPACE_BACKUP_MANIFEST, type WorkspaceBackupManifest, appendWorkspaceBackup, finishWorkspaceBackup, parseWorkspaceBackupManifest, readWorkspaceBackup, restoreWorkspaceBackup };
@@ -1,29 +1,44 @@
1
1
  import {
2
2
  DEFAULT_WORKSPACE_ID,
3
+ WORKSPACE_BACKUP_LIMITS,
4
+ WORKSPACE_BACKUP_MANIFEST,
5
+ appendWorkspaceBackup,
3
6
  ensureDefaultWorkspace,
7
+ finishWorkspaceBackup,
4
8
  getTransientWorkspace,
5
9
  getWorkspace,
6
10
  listWorkspaces,
7
11
  parsePersistedWorkspaceList,
12
+ parseWorkspaceBackupManifest,
13
+ readWorkspaceBackup,
8
14
  reconcileElectronWorkspaceDescriptors,
9
15
  registerTransientWorkspace,
10
16
  removeWorkspace,
17
+ restoreWorkspaceBackup,
11
18
  saveWorkspace,
12
19
  touchWorkspace,
13
20
  unregisterTransientWorkspace
14
- } from "../chunk-QS5WTLUZ.js";
21
+ } from "../chunk-XI2LYBRR.js";
15
22
  import "../chunk-DAPFSEKY.js";
16
23
  import "../chunk-XAMILHQP.js";
24
+ import "../chunk-UTH3HYCZ.js";
17
25
  export {
18
26
  DEFAULT_WORKSPACE_ID,
27
+ WORKSPACE_BACKUP_LIMITS,
28
+ WORKSPACE_BACKUP_MANIFEST,
29
+ appendWorkspaceBackup,
19
30
  ensureDefaultWorkspace,
31
+ finishWorkspaceBackup,
20
32
  getTransientWorkspace,
21
33
  getWorkspace,
22
34
  listWorkspaces,
23
35
  parsePersistedWorkspaceList,
36
+ parseWorkspaceBackupManifest,
37
+ readWorkspaceBackup,
24
38
  reconcileElectronWorkspaceDescriptors,
25
39
  registerTransientWorkspace,
26
40
  removeWorkspace,
41
+ restoreWorkspaceBackup,
27
42
  saveWorkspace,
28
43
  touchWorkspace,
29
44
  unregisterTransientWorkspace
@@ -1,4 +1,4 @@
1
- import { n as FileSystemProviderV2, m as FileSystemProviderCapabilities } from '../v2-BVnZZyd4.js';
1
+ import { o as FileSystemProviderV2, n as FileSystemProviderCapabilities } from '../v2-DwxWjFC0.js';
2
2
  import { a as WorkspacePath } from '../workspace-path-CWVrcuPL.js';
3
3
  import { d as CatalogDocumentFormat, f as CatalogOutlineEntry } from '../catalog-BQK05tne.js';
4
4
  import '@bendyline/squisq/markdown';
@@ -151,6 +151,8 @@ interface WorkspaceIndex {
151
151
  start(): void;
152
152
  /** Every discoverable file, sorted by path; the same array within a generation. */
153
153
  getFiles(): readonly WorkspaceIndexFile[];
154
+ /** Discoverable folders, including empty folders; sorted within a generation. */
155
+ getDirectories(): readonly WorkspacePath[];
154
156
  /** Every document (Markdown and outside-in), sorted by path. */
155
157
  getDocuments(): readonly IndexedDocument[];
156
158
  getDocument(path: string): IndexedDocument | null;
@@ -11,14 +11,14 @@ import {
11
11
  } from "../chunk-YHSFRPBS.js";
12
12
  import {
13
13
  decodeUtf8Text
14
- } from "../chunk-M5ZNQGR5.js";
14
+ } from "../chunk-IYKGM3PV.js";
15
15
  import {
16
16
  FsError,
17
17
  WORKSPACE_ROOT,
18
18
  parseWorkspacePath,
19
19
  tryParseWorkspacePath,
20
20
  workspacePathContains
21
- } from "../chunk-AYWKIZLD.js";
21
+ } from "../chunk-UTH3HYCZ.js";
22
22
 
23
23
  // src/workspace-index/search-text.ts
24
24
  var LineBuilder = class {
@@ -533,6 +533,7 @@ var WorkspaceIndexImpl = class {
533
533
  this.generation = 0;
534
534
  this.lastPublish = 0;
535
535
  this.filesCache = null;
536
+ this.directoriesCache = null;
536
537
  this.documentsCache = null;
537
538
  this.statusCache = null;
538
539
  this.workspaceId = options.workspaceId;
@@ -592,6 +593,20 @@ var WorkspaceIndexImpl = class {
592
593
  }
593
594
  return this.documentsCache;
594
595
  }
596
+ getDirectories() {
597
+ if (!this.directoriesCache) {
598
+ const directories = new Set(this.tree.directories);
599
+ for (const path of [...this.tree.directories, ...this.tree.files.keys()]) {
600
+ let slash = path.lastIndexOf("/");
601
+ while (slash >= 0) {
602
+ directories.add(parseWorkspacePath(path.slice(0, slash)));
603
+ slash = path.lastIndexOf("/", slash - 1);
604
+ }
605
+ }
606
+ this.directoriesCache = Object.freeze([...directories].sort(compareCodeUnits2));
607
+ }
608
+ return this.directoriesCache;
609
+ }
595
610
  getDocument(path) {
596
611
  const canonical = tryParseWorkspacePath(path);
597
612
  const state = canonical === null ? void 0 : this.tree.documents.get(canonical);
@@ -1167,6 +1182,7 @@ var WorkspaceIndexImpl = class {
1167
1182
  this.generation += 1;
1168
1183
  this.lastPublish = this.now();
1169
1184
  this.filesCache = null;
1185
+ this.directoriesCache = null;
1170
1186
  this.documentsCache = null;
1171
1187
  this.statusCache = null;
1172
1188
  for (const listener of [...this.listeners]) {
@@ -3,7 +3,7 @@ export { b as CATALOG_JSON_CONTENT_MODES, c as CATALOG_SORT_ORDERS, d as Catalog
3
3
  import { C as CatalogEntry, W as WorkspaceCatalog } from '../catalog-BQK05tne.js';
4
4
  export { a as CATALOG_FORMAT_VERSION, b as CATALOG_GENERATOR, c as CATALOG_LIMITS, d as CatalogDocumentFormat, e as CatalogEntryHints, f as CatalogOutlineEntry, g as CatalogSource, O as OUTSIDE_IN_FORMAT_IDS, h as OutsideInFormatId, i as OutsideInLayout, j as buildCatalogMarkdownDocument, k as catalogEntryForUnreadable, l as catalogEntryFromDocument, m as catalogEntryFromMarkdown, n as chooseOutsideInMarkdownPath, o as createWorkspaceCatalog, p as isGeneratedCatalogHtml, q as isGeneratedCatalogJson, r as readCatalogHtmlDigest, s as relativeCatalogLink, t as relocateOutsideInLayout, u as resolveOutsideInLayout, v as serializeCatalogJson, w as sortCatalogEntries, x as stampCatalogHtml } from '../catalog-BQK05tne.js';
5
5
  import { MarkdownDocument } from '@bendyline/squisq/markdown';
6
- import { u as FileSystemVersion, n as FileSystemProviderV2 } from '../v2-BVnZZyd4.js';
6
+ import { v as FileSystemVersion, o as FileSystemProviderV2 } from '../v2-DwxWjFC0.js';
7
7
  import { a as WorkspacePath } from '../workspace-path-CWVrcuPL.js';
8
8
 
9
9
  /**