@bendyline/docblocks 2.0.0 → 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/dist/{chunk-J32GU3F3.js → chunk-6IYMTYMQ.js} +249 -221
- package/dist/chunk-6IYMTYMQ.js.map +1 -0
- package/dist/{chunk-75UUF6C4.js → chunk-B56KWCSE.js} +2 -2
- package/dist/{chunk-RVQHY3XU.js → chunk-BNKV7MTO.js} +1 -1
- package/dist/{chunk-RVQHY3XU.js.map → chunk-BNKV7MTO.js.map} +1 -1
- package/dist/chunk-BXMF5YQJ.js +149 -0
- package/dist/chunk-BXMF5YQJ.js.map +1 -0
- package/dist/{chunk-PGR7LK6D.js → chunk-COYQXQK3.js} +14 -5
- package/dist/chunk-COYQXQK3.js.map +1 -0
- package/dist/{chunk-RQJRQF46.js → chunk-DN7A33LL.js} +42 -49
- package/dist/chunk-DN7A33LL.js.map +1 -0
- package/dist/chunk-FA7UNOXK.js +20 -0
- package/dist/chunk-FA7UNOXK.js.map +1 -0
- package/dist/chunk-GM5YXU4L.js +29 -0
- package/dist/chunk-GM5YXU4L.js.map +1 -0
- package/dist/{chunk-SI2LU2RP.js → chunk-JS6XFWQK.js} +2 -1
- package/dist/chunk-JS6XFWQK.js.map +1 -0
- package/dist/{chunk-EGNDADXB.js → chunk-MNSZ7EZN.js} +2 -2
- 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-GCPBEMMH.js → chunk-VTCSF7VS.js} +11 -21
- package/dist/chunk-VTCSF7VS.js.map +1 -0
- package/dist/{chunk-2D7Y4IR3.js → chunk-WJKYY5QR.js} +123 -66
- package/dist/chunk-WJKYY5QR.js.map +1 -0
- package/dist/{chunk-5MYAICRE.js → chunk-XUML3MKV.js} +44 -56
- package/dist/chunk-XUML3MKV.js.map +1 -0
- package/dist/document/index.d.ts +358 -6
- package/dist/document/index.js +24 -3
- package/dist/document/index.js.map +1 -1
- package/dist/filesystem/electron.d.ts +73 -4
- package/dist/filesystem/electron.js +16 -3
- package/dist/filesystem/electron.js.map +1 -1
- package/dist/filesystem/index.d.ts +228 -22
- package/dist/filesystem/index.js +133 -19
- package/dist/filesystem/index.js.map +1 -1
- package/dist/filesystem/indexeddb.d.ts +284 -5
- package/dist/filesystem/indexeddb.js +22 -4
- package/dist/filesystem/indexeddb.js.map +1 -1
- package/dist/filesystem/memory.d.ts +152 -4
- package/dist/filesystem/memory.js +12 -3
- package/dist/filesystem/memory.js.map +1 -1
- package/dist/filesystem/native.d.ts +136 -4
- package/dist/filesystem/native.js +27 -3
- package/dist/filesystem/native.js.map +1 -1
- package/dist/host/index.d.ts +32 -9
- package/dist/host/index.js +26 -29
- package/dist/host/index.js.map +1 -1
- package/dist/index.d.ts +14 -10
- package/dist/index.js +204 -9
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.d.ts +33 -4
- package/dist/mcp/index.js +31 -3
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/zod.d.ts +637 -635
- package/dist/mcp/zod.js +700 -884
- package/dist/mcp/zod.js.map +1 -1
- 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-CsX6EN2t.d.ts → types-BEg5SQ1_.d.ts} +1 -1
- package/dist/{types-eOlt9J7n.d.ts → types-CueK0tvU.d.ts} +34 -11
- package/dist/vscode/index.d.ts +220 -3
- package/dist/vscode/index.js +382 -2
- package/dist/vscode/index.js.map +1 -1
- package/dist/workspace/index.d.ts +141 -4
- package/dist/workspace/index.js +28 -2
- package/dist/workspace/index.js.map +1 -1
- package/package.json +9 -5
- package/dist/chunk-2D7Y4IR3.js.map +0 -1
- package/dist/chunk-5MYAICRE.js.map +0 -1
- package/dist/chunk-AYZ4HN5M.js +0 -20
- package/dist/chunk-AYZ4HN5M.js.map +0 -1
- package/dist/chunk-GCPBEMMH.js.map +0 -1
- package/dist/chunk-J32GU3F3.js.map +0 -1
- package/dist/chunk-PGR7LK6D.js.map +0 -1
- package/dist/chunk-RQJRQF46.js.map +0 -1
- package/dist/chunk-SI2LU2RP.js.map +0 -1
- package/dist/chunk-W5UUUII5.js +0 -142
- package/dist/chunk-W5UUUII5.js.map +0 -1
- package/dist/document/document-session.d.ts +0 -127
- package/dist/document/document-session.d.ts.map +0 -1
- package/dist/document/document-session.js +0 -749
- package/dist/document/document-session.js.map +0 -1
- package/dist/document/filesystem-target.d.ts +0 -17
- package/dist/document/filesystem-target.d.ts.map +0 -1
- package/dist/document/filesystem-target.js +0 -70
- package/dist/document/filesystem-target.js.map +0 -1
- package/dist/document/index.d.ts.map +0 -1
- package/dist/document/recovery-journal.d.ts +0 -125
- package/dist/document/recovery-journal.d.ts.map +0 -1
- package/dist/document/recovery-journal.js +0 -385
- package/dist/document/recovery-journal.js.map +0 -1
- package/dist/document/types.d.ts +0 -89
- package/dist/document/types.d.ts.map +0 -1
- package/dist/document/types.js +0 -9
- package/dist/document/types.js.map +0 -1
- package/dist/filesystem/commit-lock.d.ts +0 -3
- package/dist/filesystem/commit-lock.d.ts.map +0 -1
- package/dist/filesystem/commit-lock.js +0 -20
- package/dist/filesystem/commit-lock.js.map +0 -1
- package/dist/filesystem/dbk-workspace.d.ts +0 -34
- package/dist/filesystem/dbk-workspace.d.ts.map +0 -1
- package/dist/filesystem/dbk-workspace.js +0 -85
- package/dist/filesystem/dbk-workspace.js.map +0 -1
- package/dist/filesystem/electron-provider-v2.d.ts +0 -36
- package/dist/filesystem/electron-provider-v2.d.ts.map +0 -1
- package/dist/filesystem/electron-provider-v2.js +0 -503
- package/dist/filesystem/electron-provider-v2.js.map +0 -1
- package/dist/filesystem/electron-provider.d.ts +0 -35
- package/dist/filesystem/electron-provider.d.ts.map +0 -1
- package/dist/filesystem/electron-provider.js +0 -69
- package/dist/filesystem/electron-provider.js.map +0 -1
- package/dist/filesystem/electron.d.ts.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 -153
- package/dist/filesystem/filesystem-content-container.js.map +0 -1
- package/dist/filesystem/fs-error.d.ts +0 -46
- package/dist/filesystem/fs-error.d.ts.map +0 -1
- package/dist/filesystem/fs-error.js +0 -170
- package/dist/filesystem/fs-error.js.map +0 -1
- package/dist/filesystem/index.d.ts.map +0 -1
- package/dist/filesystem/indexeddb-content-container.d.ts +0 -22
- package/dist/filesystem/indexeddb-content-container.d.ts.map +0 -1
- package/dist/filesystem/indexeddb-content-container.js +0 -100
- package/dist/filesystem/indexeddb-content-container.js.map +0 -1
- package/dist/filesystem/indexeddb-provider-v2.d.ts +0 -96
- package/dist/filesystem/indexeddb-provider-v2.d.ts.map +0 -1
- package/dist/filesystem/indexeddb-provider-v2.js +0 -1241
- package/dist/filesystem/indexeddb-provider-v2.js.map +0 -1
- package/dist/filesystem/indexeddb-provider.d.ts +0 -39
- package/dist/filesystem/indexeddb-provider.d.ts.map +0 -1
- package/dist/filesystem/indexeddb-provider.js +0 -145
- package/dist/filesystem/indexeddb-provider.js.map +0 -1
- package/dist/filesystem/indexeddb-store.d.ts +0 -34
- package/dist/filesystem/indexeddb-store.d.ts.map +0 -1
- package/dist/filesystem/indexeddb-store.js +0 -165
- package/dist/filesystem/indexeddb-store.js.map +0 -1
- package/dist/filesystem/indexeddb.d.ts.map +0 -1
- package/dist/filesystem/legacy-v2-adapter.d.ts +0 -62
- package/dist/filesystem/legacy-v2-adapter.d.ts.map +0 -1
- package/dist/filesystem/legacy-v2-adapter.js +0 -499
- package/dist/filesystem/legacy-v2-adapter.js.map +0 -1
- package/dist/filesystem/memory-provider-v2.d.ts +0 -92
- package/dist/filesystem/memory-provider-v2.d.ts.map +0 -1
- package/dist/filesystem/memory-provider-v2.js +0 -615
- package/dist/filesystem/memory-provider-v2.js.map +0 -1
- package/dist/filesystem/memory-provider.d.ts +0 -54
- package/dist/filesystem/memory-provider.d.ts.map +0 -1
- package/dist/filesystem/memory-provider.js +0 -132
- package/dist/filesystem/memory-provider.js.map +0 -1
- package/dist/filesystem/memory.d.ts.map +0 -1
- package/dist/filesystem/move-entry.d.ts +0 -9
- package/dist/filesystem/move-entry.d.ts.map +0 -1
- package/dist/filesystem/move-entry.js +0 -103
- package/dist/filesystem/move-entry.js.map +0 -1
- package/dist/filesystem/move-error.d.ts +0 -53
- package/dist/filesystem/move-error.d.ts.map +0 -1
- package/dist/filesystem/move-error.js +0 -99
- package/dist/filesystem/move-error.js.map +0 -1
- package/dist/filesystem/native-provider-v2.d.ts +0 -75
- package/dist/filesystem/native-provider-v2.d.ts.map +0 -1
- package/dist/filesystem/native-provider-v2.js +0 -849
- package/dist/filesystem/native-provider-v2.js.map +0 -1
- package/dist/filesystem/native-provider.d.ts +0 -53
- package/dist/filesystem/native-provider.d.ts.map +0 -1
- package/dist/filesystem/native-provider.js +0 -471
- package/dist/filesystem/native-provider.js.map +0 -1
- package/dist/filesystem/native.d.ts.map +0 -1
- package/dist/filesystem/types.d.ts +0 -83
- package/dist/filesystem/types.d.ts.map +0 -1
- package/dist/filesystem/types.js +0 -16
- package/dist/filesystem/types.js.map +0 -1
- package/dist/filesystem/v2.d.ts +0 -172
- package/dist/filesystem/v2.d.ts.map +0 -1
- package/dist/filesystem/v2.js +0 -16
- package/dist/filesystem/v2.js.map +0 -1
- package/dist/filesystem/workspace-path.d.ts +0 -21
- package/dist/filesystem/workspace-path.d.ts.map +0 -1
- package/dist/filesystem/workspace-path.js +0 -80
- package/dist/filesystem/workspace-path.js.map +0 -1
- package/dist/host/filesystem-v2.d.ts +0 -45
- package/dist/host/filesystem-v2.d.ts.map +0 -1
- package/dist/host/filesystem-v2.js +0 -13
- package/dist/host/filesystem-v2.js.map +0 -1
- package/dist/host/git.d.ts +0 -200
- package/dist/host/git.d.ts.map +0 -1
- package/dist/host/git.js +0 -15
- package/dist/host/git.js.map +0 -1
- package/dist/host/index.d.ts.map +0 -1
- package/dist/host/types.d.ts +0 -232
- 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/host/wire-policy.d.ts +0 -22
- package/dist/host/wire-policy.d.ts.map +0 -1
- package/dist/host/wire-policy.js +0 -92
- package/dist/host/wire-policy.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/types.d.ts +0 -466
- package/dist/mcp/types.d.ts.map +0 -1
- package/dist/mcp/types.js +0 -25
- package/dist/mcp/types.js.map +0 -1
- package/dist/mcp/wire.d.ts +0 -29
- package/dist/mcp/wire.d.ts.map +0 -1
- package/dist/mcp/wire.js +0 -1046
- package/dist/mcp/wire.js.map +0 -1
- package/dist/mcp/zod.d.ts.map +0 -1
- package/dist/vscode/index.d.ts.map +0 -1
- package/dist/vscode/messages.d.ts +0 -204
- package/dist/vscode/messages.d.ts.map +0 -1
- package/dist/vscode/messages.js +0 -494
- package/dist/vscode/messages.js.map +0 -1
- package/dist/workspace/index.d.ts.map +0 -1
- package/dist/workspace/reconcile-electron.d.ts +0 -19
- package/dist/workspace/reconcile-electron.d.ts.map +0 -1
- package/dist/workspace/reconcile-electron.js +0 -42
- package/dist/workspace/reconcile-electron.js.map +0 -1
- package/dist/workspace/types.d.ts +0 -69
- package/dist/workspace/types.d.ts.map +0 -1
- package/dist/workspace/types.js +0 -2
- package/dist/workspace/types.js.map +0 -1
- package/dist/workspace/workspace-manager.d.ts +0 -47
- package/dist/workspace/workspace-manager.d.ts.map +0 -1
- package/dist/workspace/workspace-manager.js +0 -126
- package/dist/workspace/workspace-manager.js.map +0 -1
- package/src/document/document-session.ts +0 -834
- package/src/document/filesystem-target.ts +0 -109
- package/src/document/index.ts +0 -41
- package/src/document/recovery-journal.ts +0 -536
- package/src/document/types.ts +0 -116
- package/src/filesystem/commit-lock.ts +0 -29
- package/src/filesystem/dbk-workspace.ts +0 -135
- package/src/filesystem/electron-provider-v2.ts +0 -630
- package/src/filesystem/electron-provider.ts +0 -99
- package/src/filesystem/electron.ts +0 -3
- package/src/filesystem/file-media-provider.ts +0 -103
- package/src/filesystem/filesystem-content-container.ts +0 -164
- package/src/filesystem/fs-error.ts +0 -234
- package/src/filesystem/index.ts +0 -143
- package/src/filesystem/indexeddb-content-container.ts +0 -112
- package/src/filesystem/indexeddb-provider-v2.ts +0 -1740
- package/src/filesystem/indexeddb-provider.ts +0 -171
- package/src/filesystem/indexeddb-store.ts +0 -207
- package/src/filesystem/indexeddb.ts +0 -12
- package/src/filesystem/legacy-v2-adapter.ts +0 -779
- package/src/filesystem/memory-provider-v2.ts +0 -896
- package/src/filesystem/memory-provider.ts +0 -180
- package/src/filesystem/memory.ts +0 -15
- package/src/filesystem/move-entry.ts +0 -142
- package/src/filesystem/move-error.ts +0 -159
- package/src/filesystem/native-provider-v2.ts +0 -1165
- package/src/filesystem/native-provider.ts +0 -537
- package/src/filesystem/native.ts +0 -16
- package/src/filesystem/types.ts +0 -114
- package/src/filesystem/v2.ts +0 -231
- package/src/filesystem/workspace-path.ts +0 -92
- package/src/host/filesystem-v2.ts +0 -104
- package/src/host/git.ts +0 -246
- package/src/host/index.ts +0 -93
- package/src/host/types.ts +0 -274
- package/src/host/wire-policy.ts +0 -103
- package/src/index.ts +0 -10
- package/src/mcp/index.ts +0 -3
- package/src/mcp/types.ts +0 -594
- package/src/mcp/wire.ts +0 -1280
- package/src/mcp/zod.ts +0 -1000
- package/src/vscode/index.ts +0 -2
- package/src/vscode/messages.ts +0 -704
- package/src/workspace/index.ts +0 -17
- package/src/workspace/reconcile-electron.ts +0 -65
- package/src/workspace/types.ts +0 -67
- package/src/workspace/workspace-manager.ts +0 -151
- /package/dist/{chunk-75UUF6C4.js.map → chunk-B56KWCSE.js.map} +0 -0
- /package/dist/{chunk-EGNDADXB.js.map → chunk-MNSZ7EZN.js.map} +0 -0
package/src/host/index.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Host bridge — shared types + runtime access for the Electron desktop
|
|
3
|
-
* host. The renderer calls `getDocBlocksHost()` to reach the preload
|
|
4
|
-
* contextBridge; `isElectronHost()` gates desktop-only UI branches.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export type {
|
|
8
|
-
DocBlocksHostAPI,
|
|
9
|
-
DocBlocksHostFsAPI,
|
|
10
|
-
DocBlocksHostExternalAPI,
|
|
11
|
-
DocBlocksHostWorkspacesAPI,
|
|
12
|
-
DocBlocksHostShellAPI,
|
|
13
|
-
DocBlocksHostExportAPI,
|
|
14
|
-
DocBlocksHostFfmpegAPI,
|
|
15
|
-
DocBlocksHostUpdaterAPI,
|
|
16
|
-
DocBlocksHostLifecycleAPI,
|
|
17
|
-
ElectronWorkspaceInfo,
|
|
18
|
-
ExternalBinaryCommitResult,
|
|
19
|
-
HostCloseReason,
|
|
20
|
-
HostEnvironment,
|
|
21
|
-
HostExportTargetGrant,
|
|
22
|
-
HostPrepareCloseRequest,
|
|
23
|
-
HostPrepareCloseResult,
|
|
24
|
-
MenuCommand,
|
|
25
|
-
OpenRequest,
|
|
26
|
-
UpdateInstallResult,
|
|
27
|
-
UpdaterStatus,
|
|
28
|
-
} from './types.js';
|
|
29
|
-
|
|
30
|
-
export type {
|
|
31
|
-
DocBlocksHostGitAPI,
|
|
32
|
-
GitBranchInfo,
|
|
33
|
-
GitCapabilities,
|
|
34
|
-
GitCloneHandle,
|
|
35
|
-
GitCloneProgress,
|
|
36
|
-
GitError,
|
|
37
|
-
GitErrorCode,
|
|
38
|
-
GitFileAtRevision,
|
|
39
|
-
GitFileChange,
|
|
40
|
-
GitFileStatusCode,
|
|
41
|
-
GitLogEntry,
|
|
42
|
-
GitLogOptions,
|
|
43
|
-
GitRemoteInfo,
|
|
44
|
-
GitRepoDetection,
|
|
45
|
-
GitResult,
|
|
46
|
-
GitRevision,
|
|
47
|
-
GitStatus,
|
|
48
|
-
} from './git.js';
|
|
49
|
-
|
|
50
|
-
export {
|
|
51
|
-
ELECTRON_FILE_SYSTEM_V2_CAPABILITIES,
|
|
52
|
-
type DocBlocksHostFsV2API,
|
|
53
|
-
type HostFileSystemV2OpenRequest,
|
|
54
|
-
type HostFileSystemV2Result,
|
|
55
|
-
type HostFileSystemV2WatchMessage,
|
|
56
|
-
} from './filesystem-v2.js';
|
|
57
|
-
|
|
58
|
-
export {
|
|
59
|
-
HOST_WIRE_LIMITS,
|
|
60
|
-
isBoundedBytePayload,
|
|
61
|
-
isBoundedString,
|
|
62
|
-
isTrustedRendererUrl,
|
|
63
|
-
parseExternalHttpUrl,
|
|
64
|
-
parseOpenRequest,
|
|
65
|
-
} from './wire-policy.js';
|
|
66
|
-
|
|
67
|
-
import type { DocBlocksHostAPI } from './types.js';
|
|
68
|
-
|
|
69
|
-
/** True when running inside the Electron desktop shell. */
|
|
70
|
-
export function isElectronHost(): boolean {
|
|
71
|
-
if (typeof globalThis === 'undefined') return false;
|
|
72
|
-
const host = (globalThis as { docBlocksHost?: unknown }).docBlocksHost;
|
|
73
|
-
return (
|
|
74
|
-
typeof host === 'object' &&
|
|
75
|
-
host !== null &&
|
|
76
|
-
typeof (host as { fs?: unknown }).fs === 'object' &&
|
|
77
|
-
(host as { fs?: unknown }).fs !== null
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/** Return the host API, or throw if not running under Electron. */
|
|
82
|
-
export function getDocBlocksHost(): DocBlocksHostAPI {
|
|
83
|
-
const host = (globalThis as { docBlocksHost?: DocBlocksHostAPI }).docBlocksHost;
|
|
84
|
-
if (!host) {
|
|
85
|
-
throw new Error('docBlocksHost is not available — not running under Electron?');
|
|
86
|
-
}
|
|
87
|
-
return host;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/** Return the host API, or null if not running under Electron. */
|
|
91
|
-
export function maybeGetDocBlocksHost(): DocBlocksHostAPI | null {
|
|
92
|
-
return (globalThis as { docBlocksHost?: DocBlocksHostAPI }).docBlocksHost ?? null;
|
|
93
|
-
}
|
package/src/host/types.ts
DELETED
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DocBlocksHostAPI — the contract exposed by the Electron desktop shell
|
|
3
|
-
* to its renderer process via contextBridge.
|
|
4
|
-
*
|
|
5
|
-
* This file is the single source of truth for the host ↔ renderer
|
|
6
|
-
* bridge. The Electron preload script exposes an implementation matching
|
|
7
|
-
* this shape; the React renderer calls it through `window.docBlocksHost`.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import type { FileCommitResult, FileSystemEntry, FileMeta } from '../filesystem/types.js';
|
|
11
|
-
import type { DocBlocksHostFsV2API } from './filesystem-v2.js';
|
|
12
|
-
import type { DocBlocksHostGitAPI } from './git.js';
|
|
13
|
-
|
|
14
|
-
/** Filesystem operations scoped to a main-owned registered workspace id. */
|
|
15
|
-
export interface DocBlocksHostFsAPI {
|
|
16
|
-
readFile(workspaceId: string, path: string): Promise<string | null>;
|
|
17
|
-
writeFile(workspaceId: string, path: string, content: string): Promise<void>;
|
|
18
|
-
commitFile(
|
|
19
|
-
workspaceId: string,
|
|
20
|
-
path: string,
|
|
21
|
-
content: string,
|
|
22
|
-
expectedContent: string | null,
|
|
23
|
-
): Promise<FileCommitResult>;
|
|
24
|
-
delete(workspaceId: string, path: string): Promise<void>;
|
|
25
|
-
rename(workspaceId: string, oldPath: string, newPath: string): Promise<void>;
|
|
26
|
-
readDirectory(workspaceId: string, path: string): Promise<FileSystemEntry[]>;
|
|
27
|
-
exists(workspaceId: string, path: string): Promise<boolean>;
|
|
28
|
-
createDirectory(workspaceId: string, path: string): Promise<void>;
|
|
29
|
-
stat(workspaceId: string, path: string): Promise<FileMeta | null>;
|
|
30
|
-
readBinary(workspaceId: string, path: string): Promise<ArrayBuffer | null>;
|
|
31
|
-
writeBinary(workspaceId: string, path: string, data: ArrayBuffer | Uint8Array): Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* Subscribe to change notifications for a watched root. Returns an
|
|
34
|
-
* unsubscribe function. The main process uses chokidar under the hood.
|
|
35
|
-
*/
|
|
36
|
-
watch(workspaceId: string, onChange: (path: string) => void): () => void;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** Descriptor returned for an Electron-managed workspace (backed by a folder). */
|
|
40
|
-
export interface ElectronWorkspaceInfo {
|
|
41
|
-
id: string;
|
|
42
|
-
name: string;
|
|
43
|
-
/** Display/persistence metadata only. Privileged host calls accept `id`, never this path. */
|
|
44
|
-
rootPath: string;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/** Workspace-management operations exposed to the renderer. */
|
|
48
|
-
export interface DocBlocksHostWorkspacesAPI {
|
|
49
|
-
/** List only folders already persisted as trusted main-process roots. */
|
|
50
|
-
list(): Promise<ElectronWorkspaceInfo[]>;
|
|
51
|
-
/**
|
|
52
|
-
* Return the default workspace (creating DocBlocks inside the operating
|
|
53
|
-
* system's Documents folder on first call, or the user's configured default).
|
|
54
|
-
*/
|
|
55
|
-
getDefault(): Promise<ElectronWorkspaceInfo>;
|
|
56
|
-
/**
|
|
57
|
-
* Open the native folder picker. Returns null if the user cancels.
|
|
58
|
-
* The selected folder is registered in the main process whitelist.
|
|
59
|
-
*/
|
|
60
|
-
pickFolder(): Promise<ElectronWorkspaceInfo | null>;
|
|
61
|
-
/**
|
|
62
|
-
* Re-register a previously picker-approved workspace by main-owned id.
|
|
63
|
-
* Called on app startup before any filesystem operation.
|
|
64
|
-
*/
|
|
65
|
-
register(workspaceId: string): Promise<void>;
|
|
66
|
-
/** Remove a workspace from the trusted whitelist. */
|
|
67
|
-
unregister(id: string): Promise<void>;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/** Shell operations — reveal in Finder/Explorer, open external URLs. */
|
|
71
|
-
export interface DocBlocksHostShellAPI {
|
|
72
|
-
/** Reveal a registered workspace root or one root-relative entry. */
|
|
73
|
-
revealInFolder(workspaceId: string, workspacePath?: string): Promise<void>;
|
|
74
|
-
/** Open a URL in the default browser. */
|
|
75
|
-
openExternal(url: string): Promise<void>;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/** Exact, main-owned export authority. The display path is never authority. */
|
|
79
|
-
export interface HostExportTargetGrant {
|
|
80
|
-
/** Null means this is a display-only suggestion and save must show a picker. */
|
|
81
|
-
grantId: string | null;
|
|
82
|
-
displayPath: string;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/** Native export target selection and binary file writing. */
|
|
86
|
-
export interface DocBlocksHostExportAPI {
|
|
87
|
-
/** Resolve an exact remembered grant or a display-only host suggestion. */
|
|
88
|
-
resolveTarget(documentId: string, filename: string): Promise<HostExportTargetGrant>;
|
|
89
|
-
/** Open the native Save dialog and remember the selected target. */
|
|
90
|
-
pickTarget(
|
|
91
|
-
documentId: string,
|
|
92
|
-
filename: string,
|
|
93
|
-
currentGrantId?: string | null,
|
|
94
|
-
): Promise<HostExportTargetGrant | null>;
|
|
95
|
-
/** Write only to an exact target granted by the main process. */
|
|
96
|
-
save(
|
|
97
|
-
documentId: string,
|
|
98
|
-
filename: string,
|
|
99
|
-
grantId: string | null,
|
|
100
|
-
data: ArrayBuffer | Uint8Array,
|
|
101
|
-
): Promise<HostExportTargetGrant | null>;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/** System ffmpeg detection and invocation. */
|
|
105
|
-
export interface DocBlocksHostFfmpegAPI {
|
|
106
|
-
/** True if `ffmpeg` is available on PATH (or bundled). */
|
|
107
|
-
available(): Promise<boolean>;
|
|
108
|
-
/** Version string from `ffmpeg -version`, or null if unavailable. */
|
|
109
|
-
version(): Promise<string | null>;
|
|
110
|
-
/** Render a physically contained workspace-relative Markdown file to MP4. */
|
|
111
|
-
renderVideo(
|
|
112
|
-
workspaceId: string,
|
|
113
|
-
markdownPath: string,
|
|
114
|
-
options: { fps?: number; quality?: 'draft' | 'normal' | 'high' },
|
|
115
|
-
): Promise<string>;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/** Auto-updater control. */
|
|
119
|
-
export interface DocBlocksHostUpdaterAPI {
|
|
120
|
-
/** Kick off a check; resolves to true if an update is available. */
|
|
121
|
-
checkForUpdates(): Promise<boolean>;
|
|
122
|
-
/** Current app version string. */
|
|
123
|
-
getVersion(): Promise<string>;
|
|
124
|
-
/**
|
|
125
|
-
* Quit the app and apply a downloaded update. Should only be called
|
|
126
|
-
* after an `UpdaterStatus` of kind `'downloaded'` has been observed.
|
|
127
|
-
*/
|
|
128
|
-
quitAndInstall(): Promise<UpdateInstallResult>;
|
|
129
|
-
/**
|
|
130
|
-
* Subscribe to updater status events. Returns an unsubscribe function.
|
|
131
|
-
*/
|
|
132
|
-
onStatus(listener: (status: UpdaterStatus) => void): () => void;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export type UpdateInstallResult = 'installing' | 'cancelled' | 'not-ready';
|
|
136
|
-
|
|
137
|
-
export type UpdaterStatus =
|
|
138
|
-
| { kind: 'checking' }
|
|
139
|
-
| { kind: 'available'; version: string; releaseNotes?: string; releaseUrl?: string }
|
|
140
|
-
| { kind: 'not-available' }
|
|
141
|
-
| { kind: 'downloading'; percent: number }
|
|
142
|
-
| { kind: 'downloaded'; version: string; releaseNotes?: string; releaseUrl?: string }
|
|
143
|
-
| { kind: 'error'; message: string };
|
|
144
|
-
|
|
145
|
-
/** Menu-command events pushed from the main process to the renderer. */
|
|
146
|
-
export type MenuCommand =
|
|
147
|
-
| 'file:new'
|
|
148
|
-
| 'file:openFolder'
|
|
149
|
-
| 'file:revealWorkspace'
|
|
150
|
-
| 'file:settings'
|
|
151
|
-
| 'git:commit'
|
|
152
|
-
| 'git:push'
|
|
153
|
-
| 'git:pull'
|
|
154
|
-
| 'git:fetch'
|
|
155
|
-
| 'git:newBranch'
|
|
156
|
-
| 'git:switchBranch'
|
|
157
|
-
| 'git:history'
|
|
158
|
-
| 'git:clone'
|
|
159
|
-
| 'git:openOnRemote'
|
|
160
|
-
| 'git:createPullRequest'
|
|
161
|
-
| 'help:about'
|
|
162
|
-
| 'help:checkForUpdates'
|
|
163
|
-
| 'help:viewOnGitHub';
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* OS open-file / deep-link event resolved by the host.
|
|
167
|
-
* - 'workspace-file': a file inside an already-registered workspace.
|
|
168
|
-
* - 'external-file': a loose markdown file outside any workspace — opened in a
|
|
169
|
-
* transient workspace and saved through an opaque resource grant.
|
|
170
|
-
* - 'external-bundle': a `.dbk`/zip bundle — unpacked into a transient
|
|
171
|
-
* workspace and re-zipped through an opaque resource grant on save.
|
|
172
|
-
*/
|
|
173
|
-
export type OpenRequest =
|
|
174
|
-
| {
|
|
175
|
-
kind: 'workspace-file';
|
|
176
|
-
workspaceId: string;
|
|
177
|
-
/** Slash-prefixed path relative to the workspace root. */
|
|
178
|
-
path: string;
|
|
179
|
-
}
|
|
180
|
-
| { kind: 'external-file'; resourceId: string; name: string }
|
|
181
|
-
| { kind: 'external-bundle'; resourceId: string; name: string };
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Read/write access to individual OS files the user has explicitly opened
|
|
185
|
-
* (via "Open With" / deep link), outside the workspace-root whitelist. The
|
|
186
|
-
* main process gates these with owner-scoped, exact-file capabilities.
|
|
187
|
-
*/
|
|
188
|
-
export interface DocBlocksHostExternalAPI {
|
|
189
|
-
readText(resourceId: string): Promise<string | null>;
|
|
190
|
-
readBinary(resourceId: string): Promise<ArrayBuffer | null>;
|
|
191
|
-
writeText(resourceId: string, content: string): Promise<void>;
|
|
192
|
-
writeBinary(resourceId: string, data: ArrayBuffer | Uint8Array): Promise<void>;
|
|
193
|
-
commitText(
|
|
194
|
-
resourceId: string,
|
|
195
|
-
content: string,
|
|
196
|
-
expectedContent: string | null,
|
|
197
|
-
): Promise<FileCommitResult>;
|
|
198
|
-
commitBinary(
|
|
199
|
-
resourceId: string,
|
|
200
|
-
data: ArrayBuffer | Uint8Array,
|
|
201
|
-
expectedVersion: string | null,
|
|
202
|
-
): Promise<ExternalBinaryCommitResult>;
|
|
203
|
-
/** Revoke one external resource when its transient document is closed. */
|
|
204
|
-
revoke(resourceId: string): Promise<void>;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
export type ExternalBinaryCommitResult =
|
|
208
|
-
| { status: 'committed'; version: string }
|
|
209
|
-
| { status: 'conflict'; version: string | null; data: ArrayBuffer | null };
|
|
210
|
-
|
|
211
|
-
/** Environment metadata provided by the host. */
|
|
212
|
-
export interface HostEnvironment {
|
|
213
|
-
platform: 'darwin' | 'win32' | 'linux';
|
|
214
|
-
appVersion: string;
|
|
215
|
-
isDev: boolean;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
export type HostCloseReason =
|
|
219
|
-
| 'window-close'
|
|
220
|
-
| 'app-quit'
|
|
221
|
-
| 'update-install'
|
|
222
|
-
| 'reload'
|
|
223
|
-
| 'force-reload';
|
|
224
|
-
|
|
225
|
-
export interface HostPrepareCloseRequest {
|
|
226
|
-
requestId: string;
|
|
227
|
-
reason: HostCloseReason;
|
|
228
|
-
/** Absolute epoch-millisecond deadline chosen by the main process. */
|
|
229
|
-
deadline: number;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
export type HostPrepareCloseResult =
|
|
233
|
-
| { status: 'ready'; persistedRevision: number }
|
|
234
|
-
| {
|
|
235
|
-
status: 'blocked';
|
|
236
|
-
code: 'save-failed' | 'external-conflict' | 'not-ready';
|
|
237
|
-
message: string;
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Main-owned close handshake. Preload privately correlates replies; the
|
|
242
|
-
* renderer never chooses request or window identifiers.
|
|
243
|
-
*/
|
|
244
|
-
export interface DocBlocksHostLifecycleAPI {
|
|
245
|
-
onPrepareClose(
|
|
246
|
-
listener: (request: HostPrepareCloseRequest) => Promise<HostPrepareCloseResult>,
|
|
247
|
-
): () => void;
|
|
248
|
-
onCancelClose(listener: (requestId: string) => void): () => void;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/** The full DocBlocks desktop host API. */
|
|
252
|
-
export interface DocBlocksHostAPI {
|
|
253
|
-
env: HostEnvironment;
|
|
254
|
-
fs: DocBlocksHostFsAPI;
|
|
255
|
-
fsV2: DocBlocksHostFsV2API;
|
|
256
|
-
external: DocBlocksHostExternalAPI;
|
|
257
|
-
workspaces: DocBlocksHostWorkspacesAPI;
|
|
258
|
-
shell: DocBlocksHostShellAPI;
|
|
259
|
-
exports: DocBlocksHostExportAPI;
|
|
260
|
-
ffmpeg: DocBlocksHostFfmpegAPI;
|
|
261
|
-
git: DocBlocksHostGitAPI;
|
|
262
|
-
updater: DocBlocksHostUpdaterAPI;
|
|
263
|
-
lifecycle: DocBlocksHostLifecycleAPI;
|
|
264
|
-
/**
|
|
265
|
-
* Subscribe to menu commands dispatched by the native menu.
|
|
266
|
-
* Returns an unsubscribe function.
|
|
267
|
-
*/
|
|
268
|
-
onMenuCommand(listener: (cmd: MenuCommand) => void): () => void;
|
|
269
|
-
/**
|
|
270
|
-
* Subscribe to open-file / open-url requests from the OS.
|
|
271
|
-
* Returns an unsubscribe function.
|
|
272
|
-
*/
|
|
273
|
-
onOpenRequest(listener: (request: OpenRequest) => void): () => void;
|
|
274
|
-
}
|
package/src/host/wire-policy.ts
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import type { OpenRequest } from './types.js';
|
|
2
|
-
|
|
3
|
-
/** Quantitative limits shared by privileged host boundaries. */
|
|
4
|
-
export const HOST_WIRE_LIMITS = Object.freeze({
|
|
5
|
-
identifierCharacters: 256,
|
|
6
|
-
labelCharacters: 1_024,
|
|
7
|
-
pathCharacters: 4_096,
|
|
8
|
-
urlCharacters: 8_192,
|
|
9
|
-
messageCharacters: 2_000,
|
|
10
|
-
documentCharacters: 20 * 1024 * 1024,
|
|
11
|
-
binaryBytes: 100 * 1024 * 1024,
|
|
12
|
-
base64Characters: 140 * 1024 * 1024,
|
|
13
|
-
arrayEntries: 10_000,
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
function hasExactKeys(value: Record<string, unknown>, keys: readonly string[]): boolean {
|
|
17
|
-
const actual = Object.keys(value);
|
|
18
|
-
return (
|
|
19
|
-
actual.length === keys.length &&
|
|
20
|
-
keys.every((key) => Object.prototype.hasOwnProperty.call(value, key))
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function isBoundedString(
|
|
25
|
-
value: unknown,
|
|
26
|
-
maximumCharacters: number,
|
|
27
|
-
minimumCharacters = 0,
|
|
28
|
-
): value is string {
|
|
29
|
-
return (
|
|
30
|
-
typeof value === 'string' &&
|
|
31
|
-
value.length >= minimumCharacters &&
|
|
32
|
-
value.length <= maximumCharacters &&
|
|
33
|
-
!value.includes('\0')
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function isBoundedBytePayload(
|
|
38
|
-
value: unknown,
|
|
39
|
-
maximumBytes = HOST_WIRE_LIMITS.binaryBytes,
|
|
40
|
-
): value is ArrayBuffer | Uint8Array {
|
|
41
|
-
return (
|
|
42
|
-
(value instanceof ArrayBuffer || value instanceof Uint8Array) &&
|
|
43
|
-
value.byteLength <= maximumBytes
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/** Parse one exact, bounded main-to-renderer open request. */
|
|
48
|
-
export function parseOpenRequest(value: unknown): OpenRequest | null {
|
|
49
|
-
if (typeof value !== 'object' || value === null || Array.isArray(value)) return null;
|
|
50
|
-
const record = value as Record<string, unknown>;
|
|
51
|
-
|
|
52
|
-
if (record.kind === 'workspace-file') {
|
|
53
|
-
if (!hasExactKeys(record, ['kind', 'workspaceId', 'path'])) return null;
|
|
54
|
-
if (!isBoundedString(record.workspaceId, HOST_WIRE_LIMITS.identifierCharacters, 1)) return null;
|
|
55
|
-
if (!isBoundedString(record.path, HOST_WIRE_LIMITS.pathCharacters, 1)) return null;
|
|
56
|
-
return { kind: 'workspace-file', workspaceId: record.workspaceId, path: record.path };
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (record.kind === 'external-file' || record.kind === 'external-bundle') {
|
|
60
|
-
if (!hasExactKeys(record, ['kind', 'resourceId', 'name'])) return null;
|
|
61
|
-
if (!isBoundedString(record.resourceId, HOST_WIRE_LIMITS.identifierCharacters, 1)) return null;
|
|
62
|
-
if (!isBoundedString(record.name, HOST_WIRE_LIMITS.labelCharacters, 1)) return null;
|
|
63
|
-
return { kind: record.kind, resourceId: record.resourceId, name: record.name };
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/** Return one canonical HTTP(S) URL, or null when external navigation is unsafe. */
|
|
70
|
-
export function parseExternalHttpUrl(value: unknown): string | null {
|
|
71
|
-
if (!isBoundedString(value, HOST_WIRE_LIMITS.urlCharacters, 1)) return null;
|
|
72
|
-
try {
|
|
73
|
-
const url = new URL(value);
|
|
74
|
-
if (url.protocol !== 'http:' && url.protocol !== 'https:') return null;
|
|
75
|
-
if (url.username || url.password) return null;
|
|
76
|
-
const canonical = url.href;
|
|
77
|
-
return canonical.length <= HOST_WIRE_LIMITS.urlCharacters ? canonical : null;
|
|
78
|
-
} catch {
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/** True only for the packaged renderer origin or the exact configured dev origin. */
|
|
84
|
-
export function isTrustedRendererUrl(value: unknown, developmentOrigin?: string): boolean {
|
|
85
|
-
if (!isBoundedString(value, HOST_WIRE_LIMITS.urlCharacters, 1)) return false;
|
|
86
|
-
try {
|
|
87
|
-
const url = new URL(value);
|
|
88
|
-
if (
|
|
89
|
-
url.protocol === 'app:' &&
|
|
90
|
-
url.hostname === 'docblocks' &&
|
|
91
|
-
url.port === '' &&
|
|
92
|
-
url.username === '' &&
|
|
93
|
-
url.password === ''
|
|
94
|
-
) {
|
|
95
|
-
return true;
|
|
96
|
-
}
|
|
97
|
-
if (!developmentOrigin) return false;
|
|
98
|
-
const trustedDevelopmentOrigin = new URL(developmentOrigin);
|
|
99
|
-
return url.origin === trustedDevelopmentOrigin.origin;
|
|
100
|
-
} catch {
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @bendyline/docblocks — Core package
|
|
3
|
-
*
|
|
4
|
-
* Re-exports filesystem, document, workspace, and host modules for convenience.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export * from './filesystem/index.js';
|
|
8
|
-
export * from './document/index.js';
|
|
9
|
-
export * from './workspace/index.js';
|
|
10
|
-
export * from './host/index.js';
|
package/src/mcp/index.ts
DELETED