@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/dist/document/index.d.ts
CHANGED
|
@@ -1,6 +1,358 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { q as FileSystemProvider } from '../types-BEg5SQ1_.js';
|
|
2
|
+
import '../workspace-path-CWVrcuPL.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Synchronous crash-recovery journal for dirty document snapshots.
|
|
6
|
+
*
|
|
7
|
+
* The journal deliberately depends on a tiny injected Storage-like contract
|
|
8
|
+
* instead of reading `window.localStorage` at module load time. This keeps the
|
|
9
|
+
* document package usable in Node, Electron main, VS Code extension hosts, and
|
|
10
|
+
* tests while allowing browser renderers to use localStorage for a best-effort
|
|
11
|
+
* write that completes before the current JavaScript turn ends.
|
|
12
|
+
*/
|
|
13
|
+
declare const DOCUMENT_RECOVERY_JOURNAL_STORAGE_KEY = "docblocks:document-recovery:v1";
|
|
14
|
+
declare const DOCUMENT_RECOVERY_JOURNAL_SCHEMA_VERSION = 1;
|
|
15
|
+
interface DocumentRecoveryStorage {
|
|
16
|
+
getItem(key: string): string | null;
|
|
17
|
+
setItem(key: string, value: string): void;
|
|
18
|
+
removeItem(key: string): void;
|
|
19
|
+
}
|
|
20
|
+
interface DocumentRecoveryRecord {
|
|
21
|
+
/** Stable commit-target key, including the workspace/provider scope. */
|
|
22
|
+
targetKey: string;
|
|
23
|
+
/** DocumentSession generation that produced this snapshot. */
|
|
24
|
+
generation: number;
|
|
25
|
+
/** Monotonic DocumentSession revision represented by `content`. */
|
|
26
|
+
revision: number;
|
|
27
|
+
/** Complete markdown snapshot. */
|
|
28
|
+
content: string;
|
|
29
|
+
/**
|
|
30
|
+
* Content last acknowledged by the commit target when this draft was made.
|
|
31
|
+
* Recovery may be applied automatically only when storage still matches this
|
|
32
|
+
* baseline; otherwise the caller must surface an external-change conflict.
|
|
33
|
+
*/
|
|
34
|
+
persistedContent: string | null;
|
|
35
|
+
/** Time the dirty record for this target was first created. */
|
|
36
|
+
createdAt: number;
|
|
37
|
+
/** Time the record was most recently replaced. */
|
|
38
|
+
updatedAt: number;
|
|
39
|
+
}
|
|
40
|
+
interface DocumentRecoveryWrite {
|
|
41
|
+
targetKey: string;
|
|
42
|
+
generation: number;
|
|
43
|
+
revision: number;
|
|
44
|
+
content: string;
|
|
45
|
+
persistedContent: string | null;
|
|
46
|
+
}
|
|
47
|
+
interface DocumentRecoveryAcknowledgement {
|
|
48
|
+
targetKey: string;
|
|
49
|
+
generation: number;
|
|
50
|
+
/** Highest revision durably acknowledged by the commit target. */
|
|
51
|
+
persistedRevision: number;
|
|
52
|
+
}
|
|
53
|
+
type DocumentRecoveryWriteFailure = 'invalid-record' | 'record-too-large' | 'storage-unavailable' | 'quota-exceeded';
|
|
54
|
+
type DocumentRecoveryWriteResult = {
|
|
55
|
+
status: 'stored';
|
|
56
|
+
evicted: number;
|
|
57
|
+
} | {
|
|
58
|
+
status: 'unchanged';
|
|
59
|
+
evicted: 0;
|
|
60
|
+
} | {
|
|
61
|
+
status: 'ignored-stale';
|
|
62
|
+
evicted: 0;
|
|
63
|
+
} | {
|
|
64
|
+
status: 'rejected';
|
|
65
|
+
reason: DocumentRecoveryWriteFailure;
|
|
66
|
+
evicted: number;
|
|
67
|
+
};
|
|
68
|
+
interface DocumentRecoveryJournalOptions {
|
|
69
|
+
storageKey?: string;
|
|
70
|
+
/** Maximum number of document records retained. Defaults to 20. */
|
|
71
|
+
maxEntries?: number;
|
|
72
|
+
/** Conservative UTF-16 estimate for the whole serialized journal. */
|
|
73
|
+
maxStorageBytes?: number;
|
|
74
|
+
/** Conservative UTF-16 estimate for one serialized record. */
|
|
75
|
+
maxRecordBytes?: number;
|
|
76
|
+
/** Records older than this are discarded while reading. Defaults to 7 days. */
|
|
77
|
+
maxAgeMs?: number;
|
|
78
|
+
/** Tolerated clock skew for records dated in the future. Defaults to 5 minutes. */
|
|
79
|
+
maxFutureSkewMs?: number;
|
|
80
|
+
/** Injected for deterministic tests. */
|
|
81
|
+
now?: () => number;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Best-effort, synchronous recovery storage.
|
|
85
|
+
*
|
|
86
|
+
* Normal save acknowledgement is the only automatic path that removes the
|
|
87
|
+
* current record. Explicit discard, age expiry, corruption repair, and bounded
|
|
88
|
+
* eviction are intentional exceptions: callers can discard after the user
|
|
89
|
+
* rejects recovery, and the journal must never grow without limit.
|
|
90
|
+
*/
|
|
91
|
+
declare class DocumentRecoveryJournal {
|
|
92
|
+
private readonly storage;
|
|
93
|
+
private readonly storageKey;
|
|
94
|
+
private readonly maxEntries;
|
|
95
|
+
private readonly maxStorageBytes;
|
|
96
|
+
private readonly maxRecordBytes;
|
|
97
|
+
private readonly maxAgeMs;
|
|
98
|
+
private readonly maxFutureSkewMs;
|
|
99
|
+
private readonly now;
|
|
100
|
+
constructor(storage: DocumentRecoveryStorage | null, options?: DocumentRecoveryJournalOptions);
|
|
101
|
+
/**
|
|
102
|
+
* Synchronously persist the latest dirty snapshot for a target.
|
|
103
|
+
* Storage/quota failures are returned, never thrown into an editor onChange.
|
|
104
|
+
*/
|
|
105
|
+
write(input: DocumentRecoveryWrite): DocumentRecoveryWriteResult;
|
|
106
|
+
/** Return the recoverable snapshot for one target, if present and valid. */
|
|
107
|
+
lookup(targetKey: string, generation?: number): DocumentRecoveryRecord | null;
|
|
108
|
+
/** List valid records, newest first. Optionally restrict to one target. */
|
|
109
|
+
list(targetKey?: string): DocumentRecoveryRecord[];
|
|
110
|
+
/**
|
|
111
|
+
* Clear a record only when the same generation has durably acknowledged at
|
|
112
|
+
* least the journaled revision. A stale acknowledgement cannot erase a newer
|
|
113
|
+
* crash-recovery snapshot.
|
|
114
|
+
*/
|
|
115
|
+
acknowledge(input: DocumentRecoveryAcknowledgement): boolean;
|
|
116
|
+
/** Explicitly discard recovery data after a user or lifecycle decision. */
|
|
117
|
+
discard(targetKey: string, generation?: number): boolean;
|
|
118
|
+
private load;
|
|
119
|
+
private persistBounded;
|
|
120
|
+
private persistExact;
|
|
121
|
+
private tryRemove;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Resolve browser localStorage on demand. Importing this module never touches
|
|
125
|
+
* browser globals, and access errors (sandboxing/security settings) yield null.
|
|
126
|
+
*/
|
|
127
|
+
declare function getDefaultDocumentRecoveryStorage(): DocumentRecoveryStorage | null;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Framework-neutral document persistence contracts.
|
|
131
|
+
*
|
|
132
|
+
* A DocumentSession owns one logical document at a time. Storage-specific
|
|
133
|
+
* adapters implement DocumentCommitTarget; the session owns revisions,
|
|
134
|
+
* serialization, lifecycle transitions, and conflict state.
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
type DocumentSaveReason = 'autosave' | 'manual' | 'transition' | 'close' | 'backup' | 'conflict';
|
|
138
|
+
type DocumentExternalVersion = string | number | null;
|
|
139
|
+
interface DocumentCommitRequest {
|
|
140
|
+
/** Stable key for the target this commit was created for. */
|
|
141
|
+
targetKey: string;
|
|
142
|
+
/** Latest complete document snapshot to persist. */
|
|
143
|
+
content: string;
|
|
144
|
+
/** Monotonic session revision represented by content. */
|
|
145
|
+
revision: number;
|
|
146
|
+
/** Most recent revision acknowledged by this target. */
|
|
147
|
+
persistedRevision: number;
|
|
148
|
+
/** Content last acknowledged by the target, or null if it did not exist. */
|
|
149
|
+
persistedContent: string | null;
|
|
150
|
+
reason: DocumentSaveReason;
|
|
151
|
+
}
|
|
152
|
+
interface DocumentCommitResult {
|
|
153
|
+
/** Optional backend version (mtime, TextDocument.version, etag, and so on). */
|
|
154
|
+
version?: DocumentExternalVersion;
|
|
155
|
+
}
|
|
156
|
+
interface DocumentCommitTarget {
|
|
157
|
+
readonly key: string;
|
|
158
|
+
commit(request: DocumentCommitRequest): Promise<DocumentCommitResult | void>;
|
|
159
|
+
}
|
|
160
|
+
type DocumentSessionStatus = 'idle' | 'saved' | 'dirty' | 'saving' | 'error' | 'conflict' | 'closed';
|
|
161
|
+
type DocumentSessionLifecycle = 'open' | 'transitioning' | 'closing' | 'closed';
|
|
162
|
+
interface DocumentExternalSnapshot {
|
|
163
|
+
/** Target key captured before the external read began. */
|
|
164
|
+
targetKey: string;
|
|
165
|
+
/** Monotonic observation number assigned by the target watcher. */
|
|
166
|
+
sequence?: number;
|
|
167
|
+
/** Null represents an externally deleted document. */
|
|
168
|
+
content: string | null;
|
|
169
|
+
version?: DocumentExternalVersion;
|
|
170
|
+
}
|
|
171
|
+
interface DocumentSessionConflict {
|
|
172
|
+
targetKey: string;
|
|
173
|
+
localContent: string;
|
|
174
|
+
localRevision: number;
|
|
175
|
+
externalContent: string | null;
|
|
176
|
+
externalVersion: DocumentExternalVersion;
|
|
177
|
+
}
|
|
178
|
+
interface DocumentSessionSnapshot {
|
|
179
|
+
targetKey: string | null;
|
|
180
|
+
content: string;
|
|
181
|
+
revision: number;
|
|
182
|
+
persistedRevision: number;
|
|
183
|
+
persistedContent: string | null;
|
|
184
|
+
savingRevision: number | null;
|
|
185
|
+
generation: number;
|
|
186
|
+
status: DocumentSessionStatus;
|
|
187
|
+
lifecycle: DocumentSessionLifecycle;
|
|
188
|
+
frozen: boolean;
|
|
189
|
+
error: Error | null;
|
|
190
|
+
conflict: DocumentSessionConflict | null;
|
|
191
|
+
}
|
|
192
|
+
interface DocumentSessionOptions {
|
|
193
|
+
autoSaveDelayMs?: number;
|
|
194
|
+
/** Whether edits schedule automatic persistence. Manual and lifecycle flushes remain available. */
|
|
195
|
+
autoSaveEnabled?: boolean;
|
|
196
|
+
/**
|
|
197
|
+
* Bounded delays used after an automatic save fails. Each entry permits
|
|
198
|
+
* one retry; exhausting the list leaves the session in error state until
|
|
199
|
+
* the user edits again or explicitly flushes it. Conflicts never retry.
|
|
200
|
+
*/
|
|
201
|
+
autoSaveRetryDelaysMs?: readonly number[];
|
|
202
|
+
/** Optional synchronous crash-recovery journal owned by this session. */
|
|
203
|
+
recoveryJournal?: DocumentRecoveryJournal | null;
|
|
204
|
+
}
|
|
205
|
+
/** Scope captured by an editor instance when it mounts. */
|
|
206
|
+
interface DocumentSessionEditScope {
|
|
207
|
+
targetKey: string;
|
|
208
|
+
generation: number;
|
|
209
|
+
}
|
|
210
|
+
/** Result produced while a session transition is frozen. */
|
|
211
|
+
interface DocumentSessionTransition {
|
|
212
|
+
target: DocumentCommitTarget | null;
|
|
213
|
+
content: string;
|
|
214
|
+
}
|
|
215
|
+
type DocumentExternalChangeResult = 'applied' | 'conflict' | 'ignored';
|
|
216
|
+
type DocumentConflictStrategy = 'use-local' | 'use-external';
|
|
217
|
+
|
|
218
|
+
type SessionListener = () => void;
|
|
219
|
+
/**
|
|
220
|
+
* Raised by a commit target when optimistic external-change verification
|
|
221
|
+
* fails. The session converts it into durable conflict state.
|
|
222
|
+
*/
|
|
223
|
+
declare class DocumentCommitConflictError extends Error {
|
|
224
|
+
readonly externalContent: string | null;
|
|
225
|
+
readonly externalVersion: string | number | null;
|
|
226
|
+
constructor(message: string, externalContent: string | null, externalVersion?: string | number | null);
|
|
227
|
+
}
|
|
228
|
+
declare class DocumentSessionConflictError extends Error {
|
|
229
|
+
readonly conflict: DocumentSessionConflict;
|
|
230
|
+
constructor(conflict: DocumentSessionConflict);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* A revisioned, serialized persistence boundary for one active document.
|
|
234
|
+
*
|
|
235
|
+
* Invariants:
|
|
236
|
+
* - only drain() calls target.commit();
|
|
237
|
+
* - at most one commit is in flight;
|
|
238
|
+
* - revisions never decrease, including across target transitions;
|
|
239
|
+
* - destructive operations wait for an in-flight commit and run last;
|
|
240
|
+
* - a target is never changed by a React effect cleanup.
|
|
241
|
+
*/
|
|
242
|
+
declare class DocumentSession {
|
|
243
|
+
private readonly autoSaveDelayMs;
|
|
244
|
+
private readonly autoSaveRetryDelaysMs;
|
|
245
|
+
private readonly recoveryJournal;
|
|
246
|
+
private readonly listeners;
|
|
247
|
+
private autoSaveEnabled;
|
|
248
|
+
private target;
|
|
249
|
+
private content;
|
|
250
|
+
private persistedContent;
|
|
251
|
+
private revision;
|
|
252
|
+
private persistedRevision;
|
|
253
|
+
private savingRevision;
|
|
254
|
+
private savingContent;
|
|
255
|
+
private generation;
|
|
256
|
+
private externalSequence;
|
|
257
|
+
private lifecycle;
|
|
258
|
+
private frozen;
|
|
259
|
+
private error;
|
|
260
|
+
private conflict;
|
|
261
|
+
private autoSaveTimer;
|
|
262
|
+
private autoSaveRetryAttempt;
|
|
263
|
+
private drainPromise;
|
|
264
|
+
private haltDrain;
|
|
265
|
+
private operationTail;
|
|
266
|
+
private snapshot;
|
|
267
|
+
constructor(options?: DocumentSessionOptions);
|
|
268
|
+
readonly subscribe: (listener: SessionListener) => (() => void);
|
|
269
|
+
readonly getSnapshot: () => DocumentSessionSnapshot;
|
|
270
|
+
/** Enable or disable automatic persistence without weakening explicit or lifecycle flushes. */
|
|
271
|
+
setAutoSaveEnabled(enabled: boolean): void;
|
|
272
|
+
/**
|
|
273
|
+
* Record a complete local snapshot and schedule its persistence.
|
|
274
|
+
* Returns the assigned monotonic revision.
|
|
275
|
+
*/
|
|
276
|
+
edit(content: string, scope: DocumentSessionEditScope): number;
|
|
277
|
+
/**
|
|
278
|
+
* Persist the revision current when flush() is called. A later edit may
|
|
279
|
+
* advance the session again, but commits remain strictly serialized.
|
|
280
|
+
*/
|
|
281
|
+
flush(reason?: DocumentSaveReason): Promise<DocumentSessionSnapshot>;
|
|
282
|
+
/**
|
|
283
|
+
* Flush the old document, then replace it with a new clean baseline.
|
|
284
|
+
* UI state should change only after this promise resolves.
|
|
285
|
+
*/
|
|
286
|
+
transitionTo(target: DocumentCommitTarget | null, content: string): Promise<DocumentSessionSnapshot>;
|
|
287
|
+
/**
|
|
288
|
+
* Freeze and flush the current document before reading the next one. The
|
|
289
|
+
* loader may return null when a navigation request was superseded, leaving
|
|
290
|
+
* the current target active and clean.
|
|
291
|
+
*/
|
|
292
|
+
transitionWithLoad(load: () => Promise<DocumentSessionTransition | null>): Promise<DocumentSessionSnapshot | null>;
|
|
293
|
+
/**
|
|
294
|
+
* Flush the current path, run the storage move, and only then swap the
|
|
295
|
+
* commit target. No edit can enter between those steps.
|
|
296
|
+
*/
|
|
297
|
+
retarget(nextTarget: DocumentCommitTarget, moveStorage: () => Promise<void>): Promise<DocumentSessionSnapshot>;
|
|
298
|
+
/**
|
|
299
|
+
* Cancel queued writes, wait for an already-running write, then delete.
|
|
300
|
+
* The deletion is therefore the final storage operation for this target.
|
|
301
|
+
*/
|
|
302
|
+
delete(deleteStorage: () => Promise<void>): Promise<DocumentSessionSnapshot>;
|
|
303
|
+
/**
|
|
304
|
+
* Discard queued changes and detach without mutating storage. This is used
|
|
305
|
+
* for explicitly abandoned sessions, never as an implicit effect cleanup.
|
|
306
|
+
*/
|
|
307
|
+
cancel(): Promise<DocumentSessionSnapshot>;
|
|
308
|
+
/**
|
|
309
|
+
* Observe a filesystem/host change captured for targetKey. Clean sessions
|
|
310
|
+
* adopt it. Dirty or saving sessions preserve local text and enter conflict.
|
|
311
|
+
*/
|
|
312
|
+
observeExternal(change: DocumentExternalSnapshot): DocumentExternalChangeResult;
|
|
313
|
+
resolveConflict(strategy: DocumentConflictStrategy): Promise<DocumentSessionSnapshot>;
|
|
314
|
+
/**
|
|
315
|
+
* Freeze edits and flush through the latest revision. A successful call
|
|
316
|
+
* remains frozen until cancelClose(); the owning host may now destroy it.
|
|
317
|
+
*/
|
|
318
|
+
prepareClose(): Promise<DocumentSessionSnapshot>;
|
|
319
|
+
/** Resume editing when a host cancels a prepared close. */
|
|
320
|
+
cancelClose(): void;
|
|
321
|
+
private performTransition;
|
|
322
|
+
private scheduleAutoSave;
|
|
323
|
+
private clearAutoSaveTimer;
|
|
324
|
+
private ensureDrain;
|
|
325
|
+
private drain;
|
|
326
|
+
private awaitActiveDrain;
|
|
327
|
+
/**
|
|
328
|
+
* Rehydrate a synchronous crash snapshot after the durable baseline has
|
|
329
|
+
* been read. A matching baseline is safe to resume as dirty; a changed
|
|
330
|
+
* baseline becomes an explicit conflict and is never auto-overwritten.
|
|
331
|
+
*/
|
|
332
|
+
private restoreRecoverySnapshot;
|
|
333
|
+
private writeRecoverySnapshot;
|
|
334
|
+
private discardRecoverySnapshot;
|
|
335
|
+
private detach;
|
|
336
|
+
private assertNotPreparingClose;
|
|
337
|
+
private enqueueOperation;
|
|
338
|
+
private createSnapshot;
|
|
339
|
+
private computeStatus;
|
|
340
|
+
private emit;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
interface FileSystemDocumentTargetOptions {
|
|
344
|
+
/**
|
|
345
|
+
* Compare the current file with the session's persisted baseline before
|
|
346
|
+
* replacing it. Enabled by default.
|
|
347
|
+
*/
|
|
348
|
+
verifyExternalChanges?: boolean;
|
|
349
|
+
onCommitted?: (content: string, revision: number) => void;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Adapt a FileSystemProvider path to the commit protocol used by
|
|
353
|
+
* DocumentSession. The optimistic read catches external edits/deletions
|
|
354
|
+
* before a local write recreates or silently replaces them.
|
|
355
|
+
*/
|
|
356
|
+
declare function createFileSystemDocumentTarget(provider: FileSystemProvider, path: string, options?: FileSystemDocumentTargetOptions): DocumentCommitTarget;
|
|
357
|
+
|
|
358
|
+
export { DOCUMENT_RECOVERY_JOURNAL_SCHEMA_VERSION, DOCUMENT_RECOVERY_JOURNAL_STORAGE_KEY, DocumentCommitConflictError, type DocumentCommitRequest, type DocumentCommitResult, type DocumentCommitTarget, type DocumentConflictStrategy, type DocumentExternalChangeResult, type DocumentExternalSnapshot, type DocumentExternalVersion, type DocumentRecoveryAcknowledgement, DocumentRecoveryJournal, type DocumentRecoveryJournalOptions, type DocumentRecoveryRecord, type DocumentRecoveryStorage, type DocumentRecoveryWrite, type DocumentRecoveryWriteFailure, type DocumentRecoveryWriteResult, type DocumentSaveReason, DocumentSession, type DocumentSessionConflict, DocumentSessionConflictError, type DocumentSessionEditScope, type DocumentSessionLifecycle, type DocumentSessionOptions, type DocumentSessionSnapshot, type DocumentSessionStatus, type DocumentSessionTransition, type FileSystemDocumentTargetOptions, createFileSystemDocumentTarget, getDefaultDocumentRecoveryStorage };
|
package/dist/document/index.js
CHANGED
|
@@ -1,4 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
DOCUMENT_RECOVERY_JOURNAL_SCHEMA_VERSION,
|
|
3
|
+
DOCUMENT_RECOVERY_JOURNAL_STORAGE_KEY,
|
|
4
|
+
DocumentCommitConflictError,
|
|
5
|
+
DocumentRecoveryJournal,
|
|
6
|
+
DocumentSession,
|
|
7
|
+
DocumentSessionConflictError,
|
|
8
|
+
createFileSystemDocumentTarget,
|
|
9
|
+
getDefaultDocumentRecoveryStorage
|
|
10
|
+
} from "../chunk-COYQXQK3.js";
|
|
11
|
+
import "../chunk-MNSZ7EZN.js";
|
|
12
|
+
import "../chunk-FA7UNOXK.js";
|
|
13
|
+
import "../chunk-JS6XFWQK.js";
|
|
14
|
+
import "../chunk-EZKJZUNJ.js";
|
|
15
|
+
export {
|
|
16
|
+
DOCUMENT_RECOVERY_JOURNAL_SCHEMA_VERSION,
|
|
17
|
+
DOCUMENT_RECOVERY_JOURNAL_STORAGE_KEY,
|
|
18
|
+
DocumentCommitConflictError,
|
|
19
|
+
DocumentRecoveryJournal,
|
|
20
|
+
DocumentSession,
|
|
21
|
+
DocumentSessionConflictError,
|
|
22
|
+
createFileSystemDocumentTarget,
|
|
23
|
+
getDefaultDocumentRecoveryStorage
|
|
24
|
+
};
|
|
4
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,4 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
|
|
1
|
+
import { s as FileSystemProviderV2, r as FileSystemProviderCapabilities, k as FileSystemEntrySnapshot, m as FileSystemFileRead, K as FileSystemWriteOptions, n as FileSystemFileSnapshot, g as FileSystemCreateDirectoryOptions, h as FileSystemDirectorySnapshot, u as FileSystemRemoveOptions, v as FileSystemRemoveResult, o as FileSystemMoveOptions, w as FileSystemSnapshot, C as FileSystemWatchEvent, H as FileSystemWatchOptions, I as FileSystemWatchSubscription, q as FileSystemProvider, F as FileCommitResult, j as FileSystemEntry, b as FileMeta } from '../types-BEg5SQ1_.js';
|
|
2
|
+
import { a as WorkspacePath } from '../workspace-path-CWVrcuPL.js';
|
|
3
|
+
export { isElectronHost } from '../host/index.js';
|
|
4
|
+
import '../types-CueK0tvU.js';
|
|
5
|
+
|
|
6
|
+
/** Pure renderer-side client for the typed Electron filesystem v2 transport. */
|
|
7
|
+
declare class ElectronFileSystemProviderV2 implements FileSystemProviderV2 {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly label: string;
|
|
10
|
+
readonly capabilities: FileSystemProviderCapabilities;
|
|
11
|
+
private readonly rootPath;
|
|
12
|
+
private readonly instanceId;
|
|
13
|
+
private readonly watchers;
|
|
14
|
+
private readonly subscriptions;
|
|
15
|
+
private readonly inFlight;
|
|
16
|
+
private openPromise;
|
|
17
|
+
private removeWatchBridge;
|
|
18
|
+
private disposePromise;
|
|
19
|
+
private hostOpened;
|
|
20
|
+
private disposed;
|
|
21
|
+
constructor(id: string, label: string, rootPath: string);
|
|
22
|
+
getRootPath(): string;
|
|
23
|
+
stat(path: WorkspacePath): Promise<FileSystemEntrySnapshot | null>;
|
|
24
|
+
readFile(path: WorkspacePath): Promise<FileSystemFileRead | null>;
|
|
25
|
+
readDirectory(path: WorkspacePath): Promise<readonly FileSystemEntrySnapshot[]>;
|
|
26
|
+
writeFile(path: WorkspacePath, data: ArrayBuffer | Uint8Array, options?: FileSystemWriteOptions): Promise<FileSystemFileSnapshot>;
|
|
27
|
+
createDirectory(path: WorkspacePath, options?: FileSystemCreateDirectoryOptions): Promise<FileSystemDirectorySnapshot>;
|
|
28
|
+
remove(path: WorkspacePath, options?: FileSystemRemoveOptions): Promise<FileSystemRemoveResult>;
|
|
29
|
+
move(oldPath: WorkspacePath, newPath: WorkspacePath, options?: FileSystemMoveOptions): Promise<FileSystemEntrySnapshot>;
|
|
30
|
+
snapshot(): Promise<FileSystemSnapshot>;
|
|
31
|
+
watch(listener: (event: FileSystemWatchEvent) => void, options?: FileSystemWatchOptions): FileSystemWatchSubscription;
|
|
32
|
+
dispose(): Promise<void>;
|
|
33
|
+
private request;
|
|
34
|
+
private ensureOpen;
|
|
35
|
+
private ensureWatchBridge;
|
|
36
|
+
private handleWatchMessage;
|
|
37
|
+
private assertOpen;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* ElectronFileSystemProvider — implements FileSystemProvider by delegating
|
|
42
|
+
* to the Electron desktop host's fs IPC bridge. Every operation is scoped
|
|
43
|
+
* to an opaque workspace id that the main process resolves against its
|
|
44
|
+
* registered workspace authority.
|
|
45
|
+
*
|
|
46
|
+
* This file has no Electron dependency — it is a pure IPC client that
|
|
47
|
+
* relies on the `docBlocksHost` global installed by the preload script.
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
declare class ElectronFileSystemProvider implements FileSystemProvider {
|
|
51
|
+
readonly id: string;
|
|
52
|
+
readonly label: string;
|
|
53
|
+
readonly v2: ElectronFileSystemProviderV2;
|
|
54
|
+
private readonly rootPath;
|
|
55
|
+
constructor(id: string, label: string, rootPath: string);
|
|
56
|
+
/** Absolute path this provider is rooted at. */
|
|
57
|
+
getRootPath(): string;
|
|
58
|
+
readFile(path: string): Promise<string | null>;
|
|
59
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
60
|
+
commitFile(path: string, content: string, expectedContent: string | null): Promise<FileCommitResult>;
|
|
61
|
+
delete(path: string): Promise<void>;
|
|
62
|
+
rename(oldPath: string, newPath: string): Promise<void>;
|
|
63
|
+
readDirectory(path: string): Promise<FileSystemEntry[]>;
|
|
64
|
+
exists(path: string): Promise<boolean>;
|
|
65
|
+
createDirectory(path: string): Promise<void>;
|
|
66
|
+
stat(path: string): Promise<FileMeta | null>;
|
|
67
|
+
readBinary(path: string): Promise<ArrayBuffer | null>;
|
|
68
|
+
writeBinary(path: string, data: ArrayBuffer | Uint8Array): Promise<void>;
|
|
69
|
+
/** Subscribe to external change notifications under this root. */
|
|
70
|
+
watch(onChange: (changedPath: string) => void): () => void;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { ElectronFileSystemProvider, ElectronFileSystemProviderV2 };
|
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
ElectronFileSystemProvider,
|
|
3
|
+
ElectronFileSystemProviderV2
|
|
4
|
+
} from "../chunk-VTCSF7VS.js";
|
|
5
|
+
import {
|
|
6
|
+
isElectronHost
|
|
7
|
+
} from "../chunk-BNKV7MTO.js";
|
|
8
|
+
import "../chunk-FNW556FN.js";
|
|
9
|
+
import "../chunk-U722UUFN.js";
|
|
10
|
+
import "../chunk-P4WATND4.js";
|
|
11
|
+
import "../chunk-JS6XFWQK.js";
|
|
12
|
+
export {
|
|
13
|
+
ElectronFileSystemProvider,
|
|
14
|
+
ElectronFileSystemProviderV2,
|
|
15
|
+
isElectronHost
|
|
16
|
+
};
|
|
4
17
|
//# sourceMappingURL=electron.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|