@bendyline/docblocks 1.1.2 → 2.1.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.
- package/README.md +76 -11
- package/dist/chunk-6IYMTYMQ.js +1692 -0
- package/dist/chunk-6IYMTYMQ.js.map +1 -0
- package/dist/chunk-AEHCVWU5.js +25 -0
- package/dist/chunk-AEHCVWU5.js.map +1 -0
- package/dist/chunk-B56KWCSE.js +802 -0
- package/dist/chunk-B56KWCSE.js.map +1 -0
- package/dist/{chunk-ME76RUMR.js → chunk-BNKV7MTO.js} +15 -1
- package/dist/chunk-BNKV7MTO.js.map +1 -0
- package/dist/chunk-BXMF5YQJ.js +149 -0
- package/dist/chunk-BXMF5YQJ.js.map +1 -0
- package/dist/chunk-COYQXQK3.js +1071 -0
- package/dist/chunk-COYQXQK3.js.map +1 -0
- package/dist/chunk-DN7A33LL.js +780 -0
- package/dist/chunk-DN7A33LL.js.map +1 -0
- package/dist/chunk-EZKJZUNJ.js +13 -0
- package/dist/chunk-EZKJZUNJ.js.map +1 -0
- package/dist/chunk-FA7UNOXK.js +20 -0
- package/dist/chunk-FA7UNOXK.js.map +1 -0
- package/dist/chunk-FNW556FN.js +75 -0
- package/dist/chunk-FNW556FN.js.map +1 -0
- package/dist/chunk-GM5YXU4L.js +29 -0
- package/dist/chunk-GM5YXU4L.js.map +1 -0
- package/dist/chunk-JS6XFWQK.js +225 -0
- package/dist/chunk-JS6XFWQK.js.map +1 -0
- package/dist/chunk-MNSZ7EZN.js +111 -0
- package/dist/chunk-MNSZ7EZN.js.map +1 -0
- package/dist/chunk-P3DVZQ6S.js +228 -0
- package/dist/chunk-P3DVZQ6S.js.map +1 -0
- package/dist/chunk-P4WATND4.js +52 -0
- package/dist/chunk-P4WATND4.js.map +1 -0
- package/dist/chunk-RVPGQBWR.js +169 -0
- package/dist/chunk-RVPGQBWR.js.map +1 -0
- package/dist/chunk-U722UUFN.js +9 -0
- package/dist/chunk-U722UUFN.js.map +1 -0
- package/dist/chunk-VTCSF7VS.js +553 -0
- package/dist/chunk-VTCSF7VS.js.map +1 -0
- package/dist/chunk-WJKYY5QR.js +1350 -0
- package/dist/chunk-WJKYY5QR.js.map +1 -0
- package/dist/chunk-XUML3MKV.js +945 -0
- package/dist/chunk-XUML3MKV.js.map +1 -0
- package/dist/document/index.d.ts +358 -0
- package/dist/document/index.js +25 -0
- package/dist/document/index.js.map +1 -0
- package/dist/filesystem/electron.d.ts +73 -0
- package/dist/filesystem/electron.js +17 -0
- package/dist/filesystem/electron.js.map +1 -0
- package/dist/filesystem/index.d.ts +228 -8
- package/dist/filesystem/index.js +133 -6
- package/dist/filesystem/index.js.map +1 -1
- package/dist/filesystem/indexeddb.d.ts +284 -0
- package/dist/filesystem/indexeddb.js +23 -0
- package/dist/filesystem/indexeddb.js.map +1 -0
- package/dist/filesystem/memory.d.ts +152 -0
- package/dist/filesystem/memory.js +13 -0
- package/dist/filesystem/memory.js.map +1 -0
- package/dist/filesystem/native.d.ts +136 -0
- package/dist/filesystem/native.js +28 -0
- package/dist/filesystem/native.js.map +1 -0
- package/dist/host/index.d.ts +32 -6
- package/dist/host/index.js +26 -27
- package/dist/host/index.js.map +1 -1
- package/dist/index.d.ts +14 -9
- package/dist/index.js +204 -8
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.d.ts +33 -0
- package/dist/mcp/index.js +32 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/zod.d.ts +5765 -0
- package/dist/mcp/zod.js +724 -0
- package/dist/mcp/zod.js.map +1 -0
- package/dist/share/index.d.ts +43 -0
- package/dist/share/index.js +13 -0
- package/dist/share/index.js.map +1 -0
- package/dist/types-BEg5SQ1_.d.ts +301 -0
- package/dist/types-CX893hgH.d.ts +468 -0
- package/dist/types-CueK0tvU.d.ts +501 -0
- package/dist/vscode/index.d.ts +220 -0
- package/dist/vscode/index.js +383 -0
- package/dist/vscode/index.js.map +1 -0
- package/dist/workspace/index.d.ts +141 -3
- package/dist/workspace/index.js +28 -1
- package/dist/workspace/index.js.map +1 -1
- package/dist/workspace-path-CWVrcuPL.d.ts +21 -0
- package/package.json +50 -5
- package/dist/chunk-GUNM43XZ.js +0 -63
- package/dist/chunk-GUNM43XZ.js.map +0 -1
- package/dist/chunk-IM7LCQJ6.js +0 -850
- package/dist/chunk-IM7LCQJ6.js.map +0 -1
- package/dist/chunk-ME76RUMR.js.map +0 -1
- package/dist/filesystem/electron-provider.d.ts +0 -32
- package/dist/filesystem/electron-provider.d.ts.map +0 -1
- package/dist/filesystem/electron-provider.js +0 -64
- package/dist/filesystem/electron-provider.js.map +0 -1
- package/dist/filesystem/file-media-provider.d.ts +0 -23
- package/dist/filesystem/file-media-provider.d.ts.map +0 -1
- package/dist/filesystem/file-media-provider.js +0 -85
- package/dist/filesystem/file-media-provider.js.map +0 -1
- package/dist/filesystem/filesystem-content-container.d.ts +0 -24
- package/dist/filesystem/filesystem-content-container.d.ts.map +0 -1
- package/dist/filesystem/filesystem-content-container.js +0 -116
- package/dist/filesystem/filesystem-content-container.js.map +0 -1
- package/dist/filesystem/index.d.ts.map +0 -1
- package/dist/filesystem/indexeddb-content-container.d.ts +0 -20
- package/dist/filesystem/indexeddb-content-container.d.ts.map +0 -1
- package/dist/filesystem/indexeddb-content-container.js +0 -93
- package/dist/filesystem/indexeddb-content-container.js.map +0 -1
- package/dist/filesystem/indexeddb-provider.d.ts +0 -32
- package/dist/filesystem/indexeddb-provider.d.ts.map +0 -1
- package/dist/filesystem/indexeddb-provider.js +0 -295
- package/dist/filesystem/indexeddb-provider.js.map +0 -1
- package/dist/filesystem/native-provider.d.ts +0 -45
- package/dist/filesystem/native-provider.d.ts.map +0 -1
- package/dist/filesystem/native-provider.js +0 -336
- package/dist/filesystem/native-provider.js.map +0 -1
- package/dist/filesystem/types.d.ts +0 -50
- package/dist/filesystem/types.d.ts.map +0 -1
- package/dist/filesystem/types.js +0 -8
- package/dist/filesystem/types.js.map +0 -1
- package/dist/host/index.d.ts.map +0 -1
- package/dist/host/types.d.ts +0 -149
- package/dist/host/types.d.ts.map +0 -1
- package/dist/host/types.js +0 -10
- package/dist/host/types.js.map +0 -1
- package/dist/index-pgBHBQ9G.d.ts +0 -213
- package/dist/index.d.ts.map +0 -1
- package/dist/workspace/index.d.ts.map +0 -1
- package/dist/workspace/types.d.ts +0 -29
- package/dist/workspace/types.d.ts.map +0 -1
- package/dist/workspace/types.js +0 -6
- package/dist/workspace/types.js.map +0 -1
- package/dist/workspace/workspace-manager.d.ts +0 -35
- package/dist/workspace/workspace-manager.d.ts.map +0 -1
- package/dist/workspace/workspace-manager.js +0 -82
- package/dist/workspace/workspace-manager.js.map +0 -1
- package/src/filesystem/electron-provider.ts +0 -88
- package/src/filesystem/file-media-provider.ts +0 -103
- package/src/filesystem/filesystem-content-container.ts +0 -126
- package/src/filesystem/index.ts +0 -24
- package/src/filesystem/indexeddb-content-container.ts +0 -104
- package/src/filesystem/indexeddb-provider.ts +0 -345
- package/src/filesystem/native-provider.ts +0 -384
- package/src/filesystem/types.ts +0 -69
- package/src/host/index.ts +0 -47
- package/src/host/types.ts +0 -153
- package/src/index.ts +0 -9
- package/src/workspace/index.ts +0 -10
- package/src/workspace/types.ts +0 -29
- package/src/workspace/workspace-manager.ts +0 -90
package/README.md
CHANGED
|
@@ -10,28 +10,81 @@ npm install @bendyline/docblocks
|
|
|
10
10
|
|
|
11
11
|
## Exports
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
The package exposes focused subpath modules. Filesystem, document, workspace,
|
|
14
|
+
and host APIs are also re-exported from the package root; boundary-specific
|
|
15
|
+
wire protocols stay isolated in their own entry points.
|
|
14
16
|
|
|
15
17
|
### Filesystem (`@bendyline/docblocks/filesystem`)
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
Correctness-first, byte-authoritative filesystem abstraction — **the single seam for user-document storage**. UI code never touches `indexedDB`, `node:fs`, or `electron` directly; it goes through a provider.
|
|
18
20
|
|
|
19
|
-
- **`
|
|
21
|
+
- **`FileSystemProviderV2`** — canonical branded paths, typed errors, explicit mutation modes, opaque versions, capabilities, snapshots, watches, and disposal
|
|
22
|
+
- **`WorkspacePath` / `parseWorkspacePath()`** — the portable logical path representation (`''` is workspace root)
|
|
23
|
+
- **`FsError`** — stable error codes that survive IPC/structured clone boundaries
|
|
20
24
|
- **`IndexedDBFileSystemProvider`** — browser-local persistent storage (site, VS Code webview fallback)
|
|
21
25
|
- **`NativeFileSystemProvider`** — real folders in the browser via the File System Access API
|
|
22
26
|
- **`ElectronFileSystemProvider`** — bridges to the desktop main process over the host API
|
|
27
|
+
- **`MemoryFileSystemProvider`** — authoritative in-memory v2 storage for transient loose-file and DBK workspaces
|
|
23
28
|
- **`IndexedDBContentContainer`** / **`FileSystemContentContainer`** — content-container layer for media alongside documents
|
|
24
29
|
- **`createFileMediaProvider`** — media provider wired to a filesystem provider
|
|
25
30
|
|
|
26
31
|
```ts
|
|
27
|
-
import { IndexedDBFileSystemProvider } from '@bendyline/docblocks/filesystem';
|
|
28
|
-
|
|
29
|
-
const fs = new IndexedDBFileSystemProvider('my-workspace');
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
import { IndexedDBFileSystemProvider, parseWorkspacePath } from '@bendyline/docblocks/filesystem';
|
|
33
|
+
|
|
34
|
+
const fs = new IndexedDBFileSystemProvider('my-workspace', 'My workspace');
|
|
35
|
+
const path = parseWorkspacePath('/doc.md');
|
|
36
|
+
await fs.v2.writeFile(path, new TextEncoder().encode('# Hello'), {
|
|
37
|
+
mode: 'create',
|
|
38
|
+
createParents: true,
|
|
39
|
+
});
|
|
40
|
+
const content = await fs.v2.readFile(path);
|
|
32
41
|
```
|
|
33
42
|
|
|
34
|
-
|
|
43
|
+
`FileSystemProvider` remains as a deprecated text compatibility facade during the v2 migration. New code should discover `provider.v2` with `getFileSystemProviderV2()` and use v1 only as an explicit compatibility fallback. Every new backend must pass the shared v2 conformance suite.
|
|
44
|
+
|
|
45
|
+
Provider families also have isolated entry points so a browser or desktop
|
|
46
|
+
surface can load only the backend it selects:
|
|
47
|
+
|
|
48
|
+
- `@bendyline/docblocks/filesystem/indexeddb`
|
|
49
|
+
- `@bendyline/docblocks/filesystem/memory`
|
|
50
|
+
- `@bendyline/docblocks/filesystem/native`
|
|
51
|
+
- `@bendyline/docblocks/filesystem/electron`
|
|
52
|
+
|
|
53
|
+
Use literal dynamic imports of those subpaths in multi-surface shells. The
|
|
54
|
+
compatibility `filesystem` barrel still re-exports every provider, but eagerly
|
|
55
|
+
constructing from that barrel puts mutually exclusive backends in one startup
|
|
56
|
+
bundle.
|
|
57
|
+
|
|
58
|
+
Mutation behavior is explicit: `writeFile` requires a `create`, `replace`, or
|
|
59
|
+
`upsert` mode; `remove` distinguishes an empty-directory removal from a
|
|
60
|
+
recursive tree removal; and `move` never overwrites its destination. Missing
|
|
61
|
+
entries are returned as `null` only by `stat` and `readFile`. Permission,
|
|
62
|
+
wrong-kind, conflict, quota, and I/O failures remain typed `FsError`s.
|
|
63
|
+
|
|
64
|
+
Capability declarations are conservative promises, not marketing labels:
|
|
65
|
+
|
|
66
|
+
| Provider | Write | Move | Snapshot | Conditional write | Watch | Durability |
|
|
67
|
+
| ------------------------- | ------------- | ------------- | ------------- | ----------------- | ----- | ----------- |
|
|
68
|
+
| Memory | process | process | process | process | yes | volatile |
|
|
69
|
+
| IndexedDB | cross-context | cross-context | cross-context | storage-atomic | no | best-effort |
|
|
70
|
+
| Native File System Access | none | none | none | process | no | best-effort |
|
|
71
|
+
| Electron workspace | process | process | process | process | yes | best-effort |
|
|
72
|
+
|
|
73
|
+
Versions are opaque equality tokens scoped to their issuing provider. A
|
|
74
|
+
consumer must never parse them or compare tokens from different providers.
|
|
75
|
+
When a watch reports `overflow`, discard incremental assumptions and reload or
|
|
76
|
+
snapshot the relevant state.
|
|
77
|
+
|
|
78
|
+
IndexedDB workspaces migrate the legacy `fs:*` text/binary namespace in one
|
|
79
|
+
transaction and then use v2 records as their sole authority. Divergent legacy
|
|
80
|
+
or pre-release v2 data is retained as an explicit recovery candidate instead
|
|
81
|
+
of being guessed away. If an obsolete tab recreates legacy keys, a bounded
|
|
82
|
+
prefix probe quarantines that branch before the requested operation retries;
|
|
83
|
+
ordinary operations do not scan or deserialize the complete workspace.
|
|
84
|
+
|
|
85
|
+
### Document (`@bendyline/docblocks/document`)
|
|
86
|
+
|
|
87
|
+
Framework-neutral document transaction/session primitives: serialized latest-write commits, monotonic revisions, explicit transitions/retarget/delete/close, conflict state, and crash-recovery journals.
|
|
35
88
|
|
|
36
89
|
### Workspace (`@bendyline/docblocks/workspace`)
|
|
37
90
|
|
|
@@ -50,7 +103,7 @@ const workspaces = await listWorkspaces();
|
|
|
50
103
|
|
|
51
104
|
### Host (`@bendyline/docblocks/host`)
|
|
52
105
|
|
|
53
|
-
The canonical contract for what the Electron desktop shell exposes to its renderer (`fs`, `workspaces`, `shell`, `ffmpeg`, `updater`, `menu`, open-file requests).
|
|
106
|
+
The canonical contract for what the Electron desktop shell exposes to its renderer (`fsV2`, legacy `fs`, `workspaces`, `shell`, `ffmpeg`, `updater`, `menu`, open-file requests).
|
|
54
107
|
|
|
55
108
|
- **`DocBlocksHostAPI`** — the contract type (implemented by `desktop/main/ipc-*.ts`, exposed by `desktop/preload/preload.ts`)
|
|
56
109
|
- **`isElectronHost()`** — feature-detect the desktop shell
|
|
@@ -62,14 +115,26 @@ import { isElectronHost, maybeGetDocBlocksHost } from '@bendyline/docblocks/host
|
|
|
62
115
|
|
|
63
116
|
const host = maybeGetDocBlocksHost();
|
|
64
117
|
if (host) {
|
|
65
|
-
await host.shell.revealInFolder(path);
|
|
118
|
+
await host.shell.revealInFolder(workspaceId, path);
|
|
66
119
|
}
|
|
67
120
|
```
|
|
68
121
|
|
|
122
|
+
### VS Code protocol (`@bendyline/docblocks/vscode`)
|
|
123
|
+
|
|
124
|
+
The canonical bidirectional `postMessage` contract for the VS Code extension
|
|
125
|
+
host and editor webview. Both sides consume the same discriminated unions and
|
|
126
|
+
must parse incoming `unknown` values with `parseWebviewToExtensionMessage()`
|
|
127
|
+
or `parseExtensionToWebviewMessage()` before dispatch.
|
|
128
|
+
|
|
69
129
|
## Conventions
|
|
70
130
|
|
|
71
131
|
Anything that crosses IPC, postMessage, HTTP, or MCP boundaries belongs in this package — surface packages must not define their own copies of wire types.
|
|
72
132
|
|
|
133
|
+
Wire types document shape; they do not grant authority. Privileged hosts must
|
|
134
|
+
parse runtime values as `unknown`, apply `HOST_WIRE_LIMITS`, use
|
|
135
|
+
`parseExternalHttpUrl` for external navigation, and accept workspace IDs or
|
|
136
|
+
owner-scoped opaque grants instead of renderer-provided absolute paths.
|
|
137
|
+
|
|
73
138
|
## License
|
|
74
139
|
|
|
75
140
|
MIT
|