@bendyline/docblocks 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/{chunk-2D7Y4IR3.js → chunk-4437YWLE.js} +123 -67
- package/dist/{chunk-5MYAICRE.js → chunk-45T5AFCN.js} +44 -57
- package/dist/{chunk-PGR7LK6D.js → chunk-6L3JRDE7.js} +14 -6
- package/dist/{chunk-RVQHY3XU.js → chunk-6XHOOBYF.js} +0 -1
- package/dist/chunk-73OOROXH.js +8 -0
- package/dist/{chunk-SI2LU2RP.js → chunk-AYWKIZLD.js} +1 -1
- package/dist/{chunk-GCPBEMMH.js → chunk-BVY7GGNV.js} +10 -21
- package/dist/{chunk-AEHCVWU5.js → chunk-DZB666V7.js} +0 -1
- package/dist/{chunk-75UUF6C4.js → chunk-HI7QEWL6.js} +18 -10
- package/dist/chunk-KQ6756AJ.js +28 -0
- package/dist/chunk-LMMOFRGQ.js +148 -0
- package/dist/{chunk-FNW556FN.js → chunk-M2PUNKHS.js} +0 -1
- package/dist/chunk-M5ZNQGR5.js +19 -0
- package/dist/chunk-M62ZGJ5I.js +51 -0
- package/dist/chunk-OQCPBOQA.js +168 -0
- package/dist/{chunk-EGNDADXB.js → chunk-QI6YKTQV.js} +2 -3
- package/dist/chunk-SJBB5OD7.js +227 -0
- package/dist/{chunk-EZKJZUNJ.js → chunk-XAMILHQP.js} +0 -1
- package/dist/{chunk-J32GU3F3.js → chunk-YM7O3PWO.js} +249 -222
- package/dist/{chunk-RQJRQF46.js → chunk-ZO7G53QP.js} +41 -49
- package/dist/document/index.d.ts +358 -6
- package/dist/document/index.js +24 -4
- package/dist/filesystem/electron.d.ts +73 -4
- package/dist/filesystem/electron.js +16 -4
- package/dist/filesystem/index.d.ts +228 -22
- package/dist/filesystem/index.js +133 -20
- package/dist/filesystem/indexeddb.d.ts +284 -5
- package/dist/filesystem/indexeddb.js +22 -5
- package/dist/filesystem/memory.d.ts +152 -4
- package/dist/filesystem/memory.js +12 -4
- package/dist/filesystem/native.d.ts +136 -4
- package/dist/filesystem/native.js +27 -4
- package/dist/host/index.d.ts +32 -9
- package/dist/host/index.js +26 -30
- package/dist/index.d.ts +14 -10
- package/dist/index.js +204 -10
- package/dist/mcp/index.d.ts +33 -4
- package/dist/mcp/index.js +31 -4
- package/dist/mcp/zod.d.ts +645 -643
- package/dist/mcp/zod.js +700 -885
- package/dist/share/index.d.ts +43 -0
- package/dist/share/index.js +12 -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 +225 -3
- package/dist/vscode/index.js +389 -3
- package/dist/workspace/index.d.ts +141 -4
- package/dist/workspace/index.js +28 -3
- package/package.json +10 -5
- package/dist/chunk-2D7Y4IR3.js.map +0 -1
- package/dist/chunk-5MYAICRE.js.map +0 -1
- package/dist/chunk-75UUF6C4.js.map +0 -1
- package/dist/chunk-AEHCVWU5.js.map +0 -1
- package/dist/chunk-AYZ4HN5M.js +0 -20
- package/dist/chunk-AYZ4HN5M.js.map +0 -1
- package/dist/chunk-EGNDADXB.js.map +0 -1
- package/dist/chunk-EZKJZUNJ.js.map +0 -1
- package/dist/chunk-FNW556FN.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-RVQHY3XU.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/index.js.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/electron.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 -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/index.js.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/indexeddb.js.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/memory.js.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/native.js.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/index.js.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/index.js.map +0 -1
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/index.js.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/mcp/zod.js.map +0 -1
- package/dist/vscode/index.d.ts.map +0 -1
- package/dist/vscode/index.js.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/index.js.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/vscode/index.js
CHANGED
|
@@ -1,3 +1,389 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
HOST_WIRE_LIMITS,
|
|
3
|
+
isBoundedString
|
|
4
|
+
} from "../chunk-M2PUNKHS.js";
|
|
5
|
+
|
|
6
|
+
// src/vscode/messages.ts
|
|
7
|
+
var MAX_REQUEST_ID = 2147483647;
|
|
8
|
+
var DOCBLOCKS_ACCENT_COLORS = [
|
|
9
|
+
"brown",
|
|
10
|
+
"green",
|
|
11
|
+
"blue",
|
|
12
|
+
"purple",
|
|
13
|
+
"maroon",
|
|
14
|
+
"orange",
|
|
15
|
+
"gray"
|
|
16
|
+
];
|
|
17
|
+
var DOCBLOCKS_WRITE_CANVAS_TEXT_SIZE_MIN = 12;
|
|
18
|
+
var DOCBLOCKS_WRITE_CANVAS_TEXT_SIZE_MAX = 32;
|
|
19
|
+
var DOCBLOCKS_WRITE_CANVAS_LINE_SPACING_MIN = 1.2;
|
|
20
|
+
var DOCBLOCKS_WRITE_CANVAS_LINE_SPACING_MAX = 2.4;
|
|
21
|
+
var DEFAULT_VSCODE_WRITE_CANVAS_SETTINGS = {
|
|
22
|
+
textSize: 16,
|
|
23
|
+
lineSpacing: 1.7
|
|
24
|
+
};
|
|
25
|
+
function parseWebviewToExtensionMessage(value) {
|
|
26
|
+
if (!isRecord(value) || typeof value.type !== "string") return null;
|
|
27
|
+
switch (value.type) {
|
|
28
|
+
case "ready":
|
|
29
|
+
return hasOnlyKeys(value, ["type"]) ? { type: "ready" } : null;
|
|
30
|
+
case "setAutoSave":
|
|
31
|
+
return hasOnlyKeys(value, ["type", "enabled"]) && typeof value.enabled === "boolean" ? { type: "setAutoSave", enabled: value.enabled } : null;
|
|
32
|
+
case "setAccentColor":
|
|
33
|
+
return hasOnlyKeys(value, ["type", "accentColor"]) && isDocBlocksAccentColor(value.accentColor) ? { type: "setAccentColor", accentColor: value.accentColor } : null;
|
|
34
|
+
case "setWriteCanvasSettings": {
|
|
35
|
+
if (!hasOnlyKeys(value, ["type", "settings"])) return null;
|
|
36
|
+
const settings = parseVscodeWriteCanvasSettings(value.settings);
|
|
37
|
+
return settings ? { type: "setWriteCanvasSettings", settings } : null;
|
|
38
|
+
}
|
|
39
|
+
case "openLink":
|
|
40
|
+
return hasOnlyKeys(value, ["type", "href"]) && hasBoundedString(value, "href", HOST_WIRE_LIMITS.urlCharacters, 1) ? { type: "openLink", href: value.href } : null;
|
|
41
|
+
case "edit":
|
|
42
|
+
return hasOnlyKeys(value, [
|
|
43
|
+
"type",
|
|
44
|
+
"content",
|
|
45
|
+
"sessionId",
|
|
46
|
+
"clientRevision",
|
|
47
|
+
"baseDocumentVersion"
|
|
48
|
+
]) && hasBoundedString(value, "content", HOST_WIRE_LIMITS.documentCharacters) && isSessionEnvelope(value) ? {
|
|
49
|
+
type: "edit",
|
|
50
|
+
content: value.content,
|
|
51
|
+
sessionId: value.sessionId,
|
|
52
|
+
clientRevision: value.clientRevision,
|
|
53
|
+
baseDocumentVersion: value.baseDocumentVersion
|
|
54
|
+
} : null;
|
|
55
|
+
case "save":
|
|
56
|
+
return hasOnlyKeys(value, [
|
|
57
|
+
"type",
|
|
58
|
+
"sessionId",
|
|
59
|
+
"requestId",
|
|
60
|
+
"clientRevision",
|
|
61
|
+
"baseDocumentVersion"
|
|
62
|
+
]) && isSessionEnvelope(value) && hasRequestId(value) ? {
|
|
63
|
+
type: "save",
|
|
64
|
+
sessionId: value.sessionId,
|
|
65
|
+
requestId: value.requestId,
|
|
66
|
+
clientRevision: value.clientRevision,
|
|
67
|
+
baseDocumentVersion: value.baseDocumentVersion
|
|
68
|
+
} : null;
|
|
69
|
+
case "resolveConflict":
|
|
70
|
+
return hasOnlyKeys(value, ["type", "sessionId", "choice"]) && hasBoundedString(value, "sessionId", HOST_WIRE_LIMITS.identifierCharacters, 1) && (value.choice === "use-local" || value.choice === "use-external") ? { type: "resolveConflict", sessionId: value.sessionId, choice: value.choice } : null;
|
|
71
|
+
case "resolveMedia":
|
|
72
|
+
return hasOnlyKeys(value, ["type", "requestId", "ref"]) && hasRequestId(value) && hasBoundedString(value, "ref", HOST_WIRE_LIMITS.pathCharacters, 1) ? { type: "resolveMedia", requestId: value.requestId, ref: value.ref } : null;
|
|
73
|
+
case "listMedia":
|
|
74
|
+
return hasOnlyKeys(value, ["type", "requestId"]) && hasRequestId(value) ? { type: "listMedia", requestId: value.requestId } : null;
|
|
75
|
+
case "addMedia":
|
|
76
|
+
return hasOnlyKeys(value, ["type", "requestId", "name", "dataBase64", "mimeType"]) && hasRequestId(value) && hasBoundedString(value, "name", HOST_WIRE_LIMITS.pathCharacters, 1) && hasBoundedString(value, "dataBase64", HOST_WIRE_LIMITS.base64Characters) && hasMimeType(value, "mimeType") ? {
|
|
77
|
+
type: "addMedia",
|
|
78
|
+
requestId: value.requestId,
|
|
79
|
+
name: value.name,
|
|
80
|
+
dataBase64: value.dataBase64,
|
|
81
|
+
mimeType: value.mimeType
|
|
82
|
+
} : null;
|
|
83
|
+
case "removeMedia":
|
|
84
|
+
return hasOnlyKeys(value, ["type", "requestId", "ref"]) && hasRequestId(value) && hasBoundedString(value, "ref", HOST_WIRE_LIMITS.pathCharacters, 1) ? { type: "removeMedia", requestId: value.requestId, ref: value.ref } : null;
|
|
85
|
+
case "saveExport":
|
|
86
|
+
return hasOnlyKeys(value, [
|
|
87
|
+
"type",
|
|
88
|
+
"requestId",
|
|
89
|
+
"filename",
|
|
90
|
+
"dataBase64",
|
|
91
|
+
"mimeType",
|
|
92
|
+
"grantId",
|
|
93
|
+
"targetFilename"
|
|
94
|
+
]) && hasRequestId(value) && hasSafeFilename(value, "filename") && hasBoundedString(value, "dataBase64", HOST_WIRE_LIMITS.base64Characters) && hasMimeType(value, "mimeType") && hasNullableBoundedString(value, "grantId", HOST_WIRE_LIMITS.identifierCharacters, 1) && hasNullableSafeFilename(value, "targetFilename") ? {
|
|
95
|
+
type: "saveExport",
|
|
96
|
+
requestId: value.requestId,
|
|
97
|
+
filename: value.filename,
|
|
98
|
+
dataBase64: value.dataBase64,
|
|
99
|
+
mimeType: value.mimeType,
|
|
100
|
+
grantId: value.grantId,
|
|
101
|
+
targetFilename: value.targetFilename
|
|
102
|
+
} : null;
|
|
103
|
+
case "resolveExportTarget":
|
|
104
|
+
return hasOnlyKeys(value, ["type", "requestId", "filename"]) && hasRequestId(value) && hasSafeFilename(value, "filename") ? { type: "resolveExportTarget", requestId: value.requestId, filename: value.filename } : null;
|
|
105
|
+
case "pickExportTarget":
|
|
106
|
+
return hasOnlyKeys(value, ["type", "requestId", "filename", "currentGrantId"]) && hasRequestId(value) && hasSafeFilename(value, "filename") && hasNullableBoundedString(value, "currentGrantId", HOST_WIRE_LIMITS.identifierCharacters, 1) ? {
|
|
107
|
+
type: "pickExportTarget",
|
|
108
|
+
requestId: value.requestId,
|
|
109
|
+
filename: value.filename,
|
|
110
|
+
currentGrantId: value.currentGrantId
|
|
111
|
+
} : null;
|
|
112
|
+
case "readWorkspaceFile":
|
|
113
|
+
return hasOnlyKeys(value, ["type", "requestId", "path"]) && hasRequestId(value) && hasBoundedString(value, "path", HOST_WIRE_LIMITS.pathCharacters, 1) ? { type: "readWorkspaceFile", requestId: value.requestId, path: value.path } : null;
|
|
114
|
+
default:
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function parseExtensionToWebviewMessage(value) {
|
|
119
|
+
if (!isRecord(value) || typeof value.type !== "string") return null;
|
|
120
|
+
switch (value.type) {
|
|
121
|
+
case "setContent":
|
|
122
|
+
return hasOnlyKeys(value, [
|
|
123
|
+
"type",
|
|
124
|
+
"content",
|
|
125
|
+
"documentVersion",
|
|
126
|
+
"fileName",
|
|
127
|
+
"sessionId",
|
|
128
|
+
"sessionRevision",
|
|
129
|
+
"acknowledgedClientRevision"
|
|
130
|
+
]) && hasBoundedString(value, "content", HOST_WIRE_LIMITS.documentCharacters) && hasNonNegativeInteger(value, "documentVersion") && hasBoundedString(value, "fileName", HOST_WIRE_LIMITS.pathCharacters, 1) && hasBoundedString(value, "sessionId", HOST_WIRE_LIMITS.identifierCharacters, 1) && hasNonNegativeInteger(value, "sessionRevision") && hasNonNegativeInteger(value, "acknowledgedClientRevision") ? {
|
|
131
|
+
type: "setContent",
|
|
132
|
+
content: value.content,
|
|
133
|
+
documentVersion: value.documentVersion,
|
|
134
|
+
fileName: value.fileName,
|
|
135
|
+
sessionId: value.sessionId,
|
|
136
|
+
sessionRevision: value.sessionRevision,
|
|
137
|
+
acknowledgedClientRevision: value.acknowledgedClientRevision
|
|
138
|
+
} : null;
|
|
139
|
+
case "editAcknowledged":
|
|
140
|
+
return hasOnlyKeys(value, [
|
|
141
|
+
"type",
|
|
142
|
+
"sessionId",
|
|
143
|
+
"clientRevision",
|
|
144
|
+
"sessionRevision",
|
|
145
|
+
"accepted",
|
|
146
|
+
"message"
|
|
147
|
+
]) && hasBoundedString(value, "sessionId", HOST_WIRE_LIMITS.identifierCharacters, 1) && hasNonNegativeInteger(value, "clientRevision") && hasNonNegativeInteger(value, "sessionRevision") && typeof value.accepted === "boolean" && hasNullableBoundedString(value, "message", HOST_WIRE_LIMITS.messageCharacters) ? {
|
|
148
|
+
type: "editAcknowledged",
|
|
149
|
+
sessionId: value.sessionId,
|
|
150
|
+
clientRevision: value.clientRevision,
|
|
151
|
+
sessionRevision: value.sessionRevision,
|
|
152
|
+
accepted: value.accepted,
|
|
153
|
+
message: value.message
|
|
154
|
+
} : null;
|
|
155
|
+
case "sessionState": {
|
|
156
|
+
if (!hasOnlyKeys(value, [
|
|
157
|
+
"type",
|
|
158
|
+
"sessionId",
|
|
159
|
+
"status",
|
|
160
|
+
"revision",
|
|
161
|
+
"persistedRevision",
|
|
162
|
+
"acknowledgedClientRevision",
|
|
163
|
+
"documentVersion",
|
|
164
|
+
"error",
|
|
165
|
+
"conflict"
|
|
166
|
+
]) || !hasBoundedString(value, "sessionId", HOST_WIRE_LIMITS.identifierCharacters, 1) || !isDocumentSessionMessageStatus(value.status) || !hasNonNegativeInteger(value, "revision") || !hasNonNegativeInteger(value, "persistedRevision") || value.persistedRevision > value.revision || !hasNonNegativeInteger(value, "acknowledgedClientRevision") || !hasNonNegativeInteger(value, "documentVersion") || !hasNullableBoundedString(value, "error", HOST_WIRE_LIMITS.messageCharacters)) {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
const conflict = parseDocumentConflictDetails(value.conflict);
|
|
170
|
+
if (conflict === void 0 || value.status === "conflict" && conflict === null || value.status !== "conflict" && conflict !== null) {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
return {
|
|
174
|
+
type: "sessionState",
|
|
175
|
+
sessionId: value.sessionId,
|
|
176
|
+
status: value.status,
|
|
177
|
+
revision: value.revision,
|
|
178
|
+
persistedRevision: value.persistedRevision,
|
|
179
|
+
acknowledgedClientRevision: value.acknowledgedClientRevision,
|
|
180
|
+
documentVersion: value.documentVersion,
|
|
181
|
+
error: value.error,
|
|
182
|
+
conflict
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
case "saveResult":
|
|
186
|
+
return hasOnlyKeys(value, [
|
|
187
|
+
"type",
|
|
188
|
+
"sessionId",
|
|
189
|
+
"requestId",
|
|
190
|
+
"ok",
|
|
191
|
+
"revision",
|
|
192
|
+
"persistedRevision",
|
|
193
|
+
"documentVersion",
|
|
194
|
+
"message"
|
|
195
|
+
]) && hasBoundedString(value, "sessionId", HOST_WIRE_LIMITS.identifierCharacters, 1) && hasRequestId(value) && typeof value.ok === "boolean" && hasNonNegativeInteger(value, "revision") && hasNonNegativeInteger(value, "persistedRevision") && value.persistedRevision <= value.revision && hasNonNegativeInteger(value, "documentVersion") && hasNullableBoundedString(value, "message", HOST_WIRE_LIMITS.messageCharacters) ? {
|
|
196
|
+
type: "saveResult",
|
|
197
|
+
sessionId: value.sessionId,
|
|
198
|
+
requestId: value.requestId,
|
|
199
|
+
ok: value.ok,
|
|
200
|
+
revision: value.revision,
|
|
201
|
+
persistedRevision: value.persistedRevision,
|
|
202
|
+
documentVersion: value.documentVersion,
|
|
203
|
+
message: value.message
|
|
204
|
+
} : null;
|
|
205
|
+
case "themeChange":
|
|
206
|
+
return hasOnlyKeys(value, ["type", "theme"]) && (value.theme === "light" || value.theme === "dark") ? { type: "themeChange", theme: value.theme } : null;
|
|
207
|
+
case "editorSettings": {
|
|
208
|
+
if (!hasOnlyKeys(value, ["type", "settings"])) return null;
|
|
209
|
+
const settings = parseVscodeEditorSettings(value.settings);
|
|
210
|
+
return settings ? { type: "editorSettings", settings } : null;
|
|
211
|
+
}
|
|
212
|
+
case "mediaResolved":
|
|
213
|
+
return hasOnlyKeys(value, ["type", "requestId", "url"]) && hasRequestId(value) && isBoundedMediaDataUrl(value.url) ? { type: "mediaResolved", requestId: value.requestId, url: value.url } : null;
|
|
214
|
+
case "mediaListed": {
|
|
215
|
+
if (!hasOnlyKeys(value, ["type", "requestId", "entries"]) || !hasRequestId(value)) {
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
const entries = parseMediaEntries(value.entries);
|
|
219
|
+
return entries ? { type: "mediaListed", requestId: value.requestId, entries } : null;
|
|
220
|
+
}
|
|
221
|
+
case "mediaAdded":
|
|
222
|
+
return hasOnlyKeys(value, ["type", "requestId", "path"]) && hasRequestId(value) && hasBoundedString(value, "path", HOST_WIRE_LIMITS.pathCharacters, 1) ? { type: "mediaAdded", requestId: value.requestId, path: value.path } : null;
|
|
223
|
+
case "mediaRemoved":
|
|
224
|
+
return hasOnlyKeys(value, ["type", "requestId"]) && hasRequestId(value) ? { type: "mediaRemoved", requestId: value.requestId } : null;
|
|
225
|
+
case "mediaError":
|
|
226
|
+
case "exportError":
|
|
227
|
+
case "workspaceFileError":
|
|
228
|
+
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;
|
|
229
|
+
case "exportSaved":
|
|
230
|
+
case "exportTargetResolved":
|
|
231
|
+
case "exportTargetPicked": {
|
|
232
|
+
if (!hasOnlyKeys(value, ["type", "requestId", "target"]) || !hasRequestId(value)) {
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
const target = parseExportTargetGrant(value.target);
|
|
236
|
+
return target !== void 0 ? { type: value.type, requestId: value.requestId, target } : null;
|
|
237
|
+
}
|
|
238
|
+
case "workspaceFileRead":
|
|
239
|
+
return hasOnlyKeys(value, ["type", "requestId", "dataBase64"]) && hasRequestId(value) && hasNullableBoundedString(value, "dataBase64", HOST_WIRE_LIMITS.base64Characters) ? { type: "workspaceFileRead", requestId: value.requestId, dataBase64: value.dataBase64 } : null;
|
|
240
|
+
default:
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
function parseExportTargetGrant(value) {
|
|
245
|
+
if (value === null) return null;
|
|
246
|
+
if (!isRecord(value) || !hasOnlyKeys(value, ["grantId", "displayLabel"]) || !hasBoundedString(value, "grantId", HOST_WIRE_LIMITS.identifierCharacters, 1) || !hasBoundedString(value, "displayLabel", HOST_WIRE_LIMITS.pathCharacters, 1)) {
|
|
247
|
+
return void 0;
|
|
248
|
+
}
|
|
249
|
+
return { grantId: value.grantId, displayLabel: value.displayLabel };
|
|
250
|
+
}
|
|
251
|
+
function parseDocumentConflictDetails(value) {
|
|
252
|
+
if (value === null) return null;
|
|
253
|
+
if (!isRecord(value) || !hasOnlyKeys(value, [
|
|
254
|
+
"localBaseDocumentVersion",
|
|
255
|
+
"externalDocumentVersion",
|
|
256
|
+
"localBytes",
|
|
257
|
+
"externalBytes",
|
|
258
|
+
"localEditedAt",
|
|
259
|
+
"externalObservedAt",
|
|
260
|
+
"externalIsDirty"
|
|
261
|
+
]) || !hasNonNegativeInteger(value, "localBaseDocumentVersion") || !hasNonNegativeInteger(value, "externalDocumentVersion") || !hasNonNegativeInteger(value, "localBytes") || !isNullableNonNegativeInteger(value.externalBytes) || !isNullableNonNegativeInteger(value.localEditedAt) || !isNullableNonNegativeInteger(value.externalObservedAt) || value.externalIsDirty !== null && typeof value.externalIsDirty !== "boolean") {
|
|
262
|
+
return void 0;
|
|
263
|
+
}
|
|
264
|
+
return {
|
|
265
|
+
localBaseDocumentVersion: value.localBaseDocumentVersion,
|
|
266
|
+
externalDocumentVersion: value.externalDocumentVersion,
|
|
267
|
+
localBytes: value.localBytes,
|
|
268
|
+
externalBytes: value.externalBytes,
|
|
269
|
+
localEditedAt: value.localEditedAt,
|
|
270
|
+
externalObservedAt: value.externalObservedAt,
|
|
271
|
+
externalIsDirty: value.externalIsDirty
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
function parseVscodeEditorSettings(value) {
|
|
275
|
+
if (!isRecord(value) || !hasOnlyKeys(value, ["autoSave", "accentColor", "writeCanvasSettings"]) || typeof value.autoSave !== "boolean" || !isDocBlocksAccentColor(value.accentColor)) {
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
const writeCanvasSettings = parseVscodeWriteCanvasSettings(value.writeCanvasSettings);
|
|
279
|
+
return writeCanvasSettings ? { autoSave: value.autoSave, accentColor: value.accentColor, writeCanvasSettings } : null;
|
|
280
|
+
}
|
|
281
|
+
function isDocBlocksAccentColor(value) {
|
|
282
|
+
return DOCBLOCKS_ACCENT_COLORS.some((color) => color === value);
|
|
283
|
+
}
|
|
284
|
+
function isDocBlocksWriteCanvasTextSize(value) {
|
|
285
|
+
return numberInRange(
|
|
286
|
+
value,
|
|
287
|
+
DOCBLOCKS_WRITE_CANVAS_TEXT_SIZE_MIN,
|
|
288
|
+
DOCBLOCKS_WRITE_CANVAS_TEXT_SIZE_MAX
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
function isDocBlocksWriteCanvasLineSpacing(value) {
|
|
292
|
+
return numberInRange(
|
|
293
|
+
value,
|
|
294
|
+
DOCBLOCKS_WRITE_CANVAS_LINE_SPACING_MIN,
|
|
295
|
+
DOCBLOCKS_WRITE_CANVAS_LINE_SPACING_MAX
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
function parseVscodeWriteCanvasSettings(value) {
|
|
299
|
+
return isRecord(value) && hasOnlyKeys(value, ["textSize", "lineSpacing"]) && isDocBlocksWriteCanvasTextSize(value.textSize) && isDocBlocksWriteCanvasLineSpacing(value.lineSpacing) ? { textSize: value.textSize, lineSpacing: value.lineSpacing } : null;
|
|
300
|
+
}
|
|
301
|
+
function numberInRange(value, min, max) {
|
|
302
|
+
return typeof value === "number" && Number.isFinite(value) && value >= min && value <= max;
|
|
303
|
+
}
|
|
304
|
+
function parseMediaEntries(value) {
|
|
305
|
+
if (!Array.isArray(value) || value.length > HOST_WIRE_LIMITS.arrayEntries) return null;
|
|
306
|
+
const entries = [];
|
|
307
|
+
for (const entry of value) {
|
|
308
|
+
if (!isRecord(entry) || !hasOnlyKeys(entry, ["name", "mimeType", "size"]) || !hasBoundedString(entry, "name", HOST_WIRE_LIMITS.pathCharacters, 1) || !hasMimeType(entry, "mimeType") || !hasNonNegativeInteger(entry, "size") || entry.size > HOST_WIRE_LIMITS.binaryBytes) {
|
|
309
|
+
return null;
|
|
310
|
+
}
|
|
311
|
+
entries.push({ name: entry.name, mimeType: entry.mimeType, size: entry.size });
|
|
312
|
+
}
|
|
313
|
+
return entries;
|
|
314
|
+
}
|
|
315
|
+
function isBoundedMediaDataUrl(value) {
|
|
316
|
+
if (!isBoundedString(value, HOST_WIRE_LIMITS.base64Characters + 512, 1)) return false;
|
|
317
|
+
if (!value.startsWith("data:")) return false;
|
|
318
|
+
const separator = value.indexOf(";base64,");
|
|
319
|
+
return separator > 5 && separator <= HOST_WIRE_LIMITS.identifierCharacters;
|
|
320
|
+
}
|
|
321
|
+
function isDocumentSessionMessageStatus(value) {
|
|
322
|
+
return value === "idle" || value === "saved" || value === "dirty" || value === "saving" || value === "error" || value === "conflict" || value === "closed";
|
|
323
|
+
}
|
|
324
|
+
function isSessionEnvelope(value) {
|
|
325
|
+
return hasBoundedString(value, "sessionId", HOST_WIRE_LIMITS.identifierCharacters, 1) && hasNonNegativeInteger(value, "clientRevision") && hasNonNegativeInteger(value, "baseDocumentVersion");
|
|
326
|
+
}
|
|
327
|
+
function hasRequestId(value) {
|
|
328
|
+
return hasNonNegativeInteger(value, "requestId") && value.requestId <= MAX_REQUEST_ID;
|
|
329
|
+
}
|
|
330
|
+
function hasBoundedString(value, key, maximumCharacters, minimumCharacters = 0) {
|
|
331
|
+
return isBoundedString(value[key], maximumCharacters, minimumCharacters);
|
|
332
|
+
}
|
|
333
|
+
function hasNullableBoundedString(value, key, maximumCharacters, minimumCharacters = 0) {
|
|
334
|
+
return value[key] === null || isBoundedString(value[key], maximumCharacters, minimumCharacters);
|
|
335
|
+
}
|
|
336
|
+
function hasNonNegativeInteger(value, key) {
|
|
337
|
+
const entry = value[key];
|
|
338
|
+
return typeof entry === "number" && Number.isSafeInteger(entry) && entry >= 0;
|
|
339
|
+
}
|
|
340
|
+
function isNullableNonNegativeInteger(value) {
|
|
341
|
+
return value === null || typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
342
|
+
}
|
|
343
|
+
function isRecord(value) {
|
|
344
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
345
|
+
}
|
|
346
|
+
function hasOnlyKeys(value, keys) {
|
|
347
|
+
const expected = new Set(keys);
|
|
348
|
+
const actual = Object.keys(value);
|
|
349
|
+
return actual.length === expected.size && actual.every((key) => expected.has(key));
|
|
350
|
+
}
|
|
351
|
+
function hasSafeFilename(value, key) {
|
|
352
|
+
return isSafeExportFilename(value[key]);
|
|
353
|
+
}
|
|
354
|
+
function hasNullableSafeFilename(value, key) {
|
|
355
|
+
return value[key] === null || isSafeExportFilename(value[key]);
|
|
356
|
+
}
|
|
357
|
+
function isSafeExportFilename(value) {
|
|
358
|
+
return isBoundedString(value, 255, 1) && value.trim() === value && !/[\\/:*?"<>|]/.test(value) && !hasControlCharacter(value) && value !== "." && value !== ".." && !value.endsWith(".") && !value.endsWith(" ");
|
|
359
|
+
}
|
|
360
|
+
function hasControlCharacter(value) {
|
|
361
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
362
|
+
const code = value.charCodeAt(index);
|
|
363
|
+
if (code <= 31 || code === 127) return true;
|
|
364
|
+
}
|
|
365
|
+
return false;
|
|
366
|
+
}
|
|
367
|
+
function hasMimeType(value, key) {
|
|
368
|
+
return isSafeMimeType(value[key]);
|
|
369
|
+
}
|
|
370
|
+
function isSafeMimeType(value) {
|
|
371
|
+
return isBoundedString(value, HOST_WIRE_LIMITS.identifierCharacters, 1) && /^[A-Za-z0-9!#$&^_.+-]+\/[A-Za-z0-9!#$&^_.+-]+(?:\s*;\s*[A-Za-z0-9!#$&^_.+-]+=[^;\r\n]+)*$/.test(
|
|
372
|
+
value
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
export {
|
|
376
|
+
DEFAULT_VSCODE_WRITE_CANVAS_SETTINGS,
|
|
377
|
+
DOCBLOCKS_ACCENT_COLORS,
|
|
378
|
+
DOCBLOCKS_WRITE_CANVAS_LINE_SPACING_MAX,
|
|
379
|
+
DOCBLOCKS_WRITE_CANVAS_LINE_SPACING_MIN,
|
|
380
|
+
DOCBLOCKS_WRITE_CANVAS_TEXT_SIZE_MAX,
|
|
381
|
+
DOCBLOCKS_WRITE_CANVAS_TEXT_SIZE_MIN,
|
|
382
|
+
isDocBlocksAccentColor,
|
|
383
|
+
isDocBlocksWriteCanvasLineSpacing,
|
|
384
|
+
isDocBlocksWriteCanvasTextSize,
|
|
385
|
+
isSafeExportFilename,
|
|
386
|
+
isSafeMimeType,
|
|
387
|
+
parseExtensionToWebviewMessage,
|
|
388
|
+
parseWebviewToExtensionMessage
|
|
389
|
+
};
|
|
@@ -1,4 +1,141 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { q as FileSystemProvider } from '../types-BEg5SQ1_.js';
|
|
2
|
+
import { k as ElectronWorkspaceInfo, B as HostEnvironment } from '../types-CueK0tvU.js';
|
|
3
|
+
import '../workspace-path-CWVrcuPL.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Origin of a transient workspace — records where its contents came from and
|
|
7
|
+
* how to save them back. Set only on `type: 'transient'` workspaces.
|
|
8
|
+
* - 'loose-file' — a single markdown file opened from the OS (Electron);
|
|
9
|
+
* edits write back through an owner-scoped `resourceId` grant.
|
|
10
|
+
* - 'dbk' — a `.dbk`/zip bundle unpacked into memory (Electron); edits are
|
|
11
|
+
* re-zipped and written back through an owner-scoped resource grant.
|
|
12
|
+
* - 'web-file' — a single markdown file launched into the installed web app
|
|
13
|
+
* (File Handling API); edits write back through `handle`.
|
|
14
|
+
* - 'web-dbk' — a `.dbk`/zip bundle launched into the installed web app;
|
|
15
|
+
* edits are re-zipped and written back through `handle`.
|
|
16
|
+
*
|
|
17
|
+
* The web variants hold a live `FileSystemFileHandle`. That is safe because
|
|
18
|
+
* transient descriptors are never persisted — they live only in the
|
|
19
|
+
* in-memory registry (see workspace-manager) for the current page session.
|
|
20
|
+
*/
|
|
21
|
+
type TransientOrigin = {
|
|
22
|
+
kind: 'loose-file';
|
|
23
|
+
resourceId: string;
|
|
24
|
+
} | {
|
|
25
|
+
kind: 'dbk';
|
|
26
|
+
resourceId: string;
|
|
27
|
+
/** SHA-256 of the last bundle version acknowledged by the host. */
|
|
28
|
+
version: string | null;
|
|
29
|
+
} | {
|
|
30
|
+
kind: 'web-file';
|
|
31
|
+
handle: FileSystemFileHandle;
|
|
32
|
+
name: string;
|
|
33
|
+
} | {
|
|
34
|
+
kind: 'web-dbk';
|
|
35
|
+
handle: FileSystemFileHandle;
|
|
36
|
+
name: string;
|
|
37
|
+
/** SHA-256 of the last bundle version observed on disk. */
|
|
38
|
+
version: string | null;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Workspace — a named binding to a FileSystemProvider, representing
|
|
42
|
+
* the user's current working context (a folder of markdown files).
|
|
43
|
+
*/
|
|
44
|
+
interface WorkspaceDescriptor {
|
|
45
|
+
/** Unique stable identifier (persisted in IndexedDB). */
|
|
46
|
+
id: string;
|
|
47
|
+
/** User-visible label. */
|
|
48
|
+
name: string;
|
|
49
|
+
/**
|
|
50
|
+
* Provider kind:
|
|
51
|
+
* - 'indexeddb' — browser-local storage (web only)
|
|
52
|
+
* - 'native' — File System Access API (web Chrome/Edge only)
|
|
53
|
+
* - 'electron-native' — Electron main-process native filesystem
|
|
54
|
+
* - 'transient' — session-only, in-memory (a loose file/`.dbk` opened from
|
|
55
|
+
* the OS, or a document copied from a shared URL). Never persisted; its
|
|
56
|
+
* provider lives in an in-memory registry (see workspace-manager). An
|
|
57
|
+
* `origin` is present only when changes can be saved back externally.
|
|
58
|
+
*/
|
|
59
|
+
type: 'indexeddb' | 'native' | 'electron-native' | 'transient';
|
|
60
|
+
/** ISO timestamp of last access. */
|
|
61
|
+
lastOpened: string;
|
|
62
|
+
/** Absolute filesystem path for 'electron-native' workspaces. */
|
|
63
|
+
rootPath?: string;
|
|
64
|
+
/** For 'transient' workspaces: where the contents came from / save back to. */
|
|
65
|
+
origin?: TransientOrigin;
|
|
66
|
+
/**
|
|
67
|
+
* Per-workspace override for the global versioning preference. When
|
|
68
|
+
* `'inherit'` (or absent), the global preference applies. `'on'` /
|
|
69
|
+
* `'off'` force the corresponding behavior regardless of the global
|
|
70
|
+
* setting. See `resolveVersioningEnabled` in the preferences module.
|
|
71
|
+
*/
|
|
72
|
+
versioningOverride?: 'inherit' | 'on' | 'off';
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Parse the complete persisted workspace list before it reaches startup code. */
|
|
76
|
+
declare function parsePersistedWorkspaceList(value: unknown): WorkspaceDescriptor[];
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* WorkspaceManager — manages the list of known workspaces in IndexedDB
|
|
80
|
+
* and provides helpers for creating / switching / removing them.
|
|
81
|
+
*
|
|
82
|
+
* The actual FileSystemProvider instances are created by the caller
|
|
83
|
+
* (since native providers need a DirectoryHandle from user interaction).
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
/** Register a transient workspace and its (already-built) provider. */
|
|
87
|
+
declare function registerTransientWorkspace(descriptor: WorkspaceDescriptor, provider: FileSystemProvider): void;
|
|
88
|
+
/** Look up a transient workspace (descriptor + provider) by id, if any. */
|
|
89
|
+
declare function getTransientWorkspace(id: string): {
|
|
90
|
+
descriptor: WorkspaceDescriptor;
|
|
91
|
+
provider: FileSystemProvider;
|
|
92
|
+
} | null;
|
|
93
|
+
/** Forget a transient workspace (e.g. when it is closed). */
|
|
94
|
+
declare function unregisterTransientWorkspace(id: string): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Get all known workspace descriptors — persisted plus any session-only
|
|
97
|
+
* transient ones (so they show in the picker and resolve for the session).
|
|
98
|
+
*/
|
|
99
|
+
declare function listWorkspaces(): Promise<WorkspaceDescriptor[]>;
|
|
100
|
+
/**
|
|
101
|
+
* Get a specific workspace descriptor by id (transient or persisted).
|
|
102
|
+
*/
|
|
103
|
+
declare function getWorkspace(id: string): Promise<WorkspaceDescriptor | null>;
|
|
104
|
+
/**
|
|
105
|
+
* Add or update a workspace descriptor. If a workspace with the same id
|
|
106
|
+
* already exists, it is replaced. Transient workspaces are never persisted.
|
|
107
|
+
*/
|
|
108
|
+
declare function saveWorkspace(workspace: WorkspaceDescriptor): Promise<void>;
|
|
109
|
+
/**
|
|
110
|
+
* Remove a workspace descriptor by id (transient or persisted).
|
|
111
|
+
*/
|
|
112
|
+
declare function removeWorkspace(id: string): Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* Touch the lastOpened timestamp on a workspace. For transient workspaces this
|
|
115
|
+
* updates the in-memory descriptor only (nothing is persisted).
|
|
116
|
+
*/
|
|
117
|
+
declare function touchWorkspace(id: string): Promise<void>;
|
|
118
|
+
/**
|
|
119
|
+
* Ensure a default IndexedDB workspace exists. Called on app startup.
|
|
120
|
+
* Returns the descriptor.
|
|
121
|
+
*/
|
|
122
|
+
declare function ensureDefaultWorkspace(): Promise<WorkspaceDescriptor>;
|
|
123
|
+
|
|
124
|
+
interface ElectronWorkspaceReconciliation {
|
|
125
|
+
/** Obsolete renderer descriptors to remove before attempting restoration. */
|
|
126
|
+
readonly removeIds: readonly string[];
|
|
127
|
+
/** Canonical main-authorized descriptors to insert or replace. */
|
|
128
|
+
readonly upsert: readonly WorkspaceDescriptor[];
|
|
129
|
+
/** Safe navigation migration for a local descriptor matched by root. */
|
|
130
|
+
readonly idRemap: Readonly<Record<string, string>>;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Reconcile renderer IndexedDB metadata with the main process authority list.
|
|
134
|
+
* `hostWorkspaces` is authoritative: local Electron descriptors absent from
|
|
135
|
+
* it cannot be opened safely and are removed. Root-path matching carries user
|
|
136
|
+
* metadata across an id migration without treating that display path as
|
|
137
|
+
* authority.
|
|
138
|
+
*/
|
|
139
|
+
declare function reconcileElectronWorkspaceDescriptors(local: readonly WorkspaceDescriptor[], hostWorkspaces: readonly ElectronWorkspaceInfo[], platform: HostEnvironment['platform'], now: string): ElectronWorkspaceReconciliation;
|
|
140
|
+
|
|
141
|
+
export { type ElectronWorkspaceReconciliation, type TransientOrigin, type WorkspaceDescriptor, ensureDefaultWorkspace, getTransientWorkspace, getWorkspace, listWorkspaces, parsePersistedWorkspaceList, reconcileElectronWorkspaceDescriptors, registerTransientWorkspace, removeWorkspace, saveWorkspace, touchWorkspace, unregisterTransientWorkspace };
|
package/dist/workspace/index.js
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
ensureDefaultWorkspace,
|
|
3
|
+
getTransientWorkspace,
|
|
4
|
+
getWorkspace,
|
|
5
|
+
listWorkspaces,
|
|
6
|
+
parsePersistedWorkspaceList,
|
|
7
|
+
reconcileElectronWorkspaceDescriptors,
|
|
8
|
+
registerTransientWorkspace,
|
|
9
|
+
removeWorkspace,
|
|
10
|
+
saveWorkspace,
|
|
11
|
+
touchWorkspace,
|
|
12
|
+
unregisterTransientWorkspace
|
|
13
|
+
} from "../chunk-SJBB5OD7.js";
|
|
14
|
+
import "../chunk-OQCPBOQA.js";
|
|
15
|
+
import "../chunk-XAMILHQP.js";
|
|
16
|
+
export {
|
|
17
|
+
ensureDefaultWorkspace,
|
|
18
|
+
getTransientWorkspace,
|
|
19
|
+
getWorkspace,
|
|
20
|
+
listWorkspaces,
|
|
21
|
+
parsePersistedWorkspaceList,
|
|
22
|
+
reconcileElectronWorkspaceDescriptors,
|
|
23
|
+
registerTransientWorkspace,
|
|
24
|
+
removeWorkspace,
|
|
25
|
+
saveWorkspace,
|
|
26
|
+
touchWorkspace,
|
|
27
|
+
unregisterTransientWorkspace
|
|
28
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bendyline/docblocks",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Core data structures and filesystem abstractions for DocBlocks",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Bendyline",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"url": "https://github.com/bendyline/docblocks.git",
|
|
10
10
|
"directory": "packages/core"
|
|
11
11
|
},
|
|
12
|
-
"homepage": "https://
|
|
12
|
+
"homepage": "https://docblocks.com/",
|
|
13
13
|
"keywords": [
|
|
14
14
|
"docblocks",
|
|
15
15
|
"markdown",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"main": "./dist/index.js",
|
|
24
24
|
"module": "./dist/index.js",
|
|
25
25
|
"types": "./dist/index.d.ts",
|
|
26
|
+
"sideEffects": false,
|
|
26
27
|
"files": [
|
|
27
|
-
"dist"
|
|
28
|
-
"src"
|
|
28
|
+
"dist"
|
|
29
29
|
],
|
|
30
30
|
"exports": {
|
|
31
31
|
".": {
|
|
@@ -73,6 +73,11 @@
|
|
|
73
73
|
"import": "./dist/host/index.js",
|
|
74
74
|
"default": "./dist/host/index.js"
|
|
75
75
|
},
|
|
76
|
+
"./share": {
|
|
77
|
+
"types": "./dist/share/index.d.ts",
|
|
78
|
+
"import": "./dist/share/index.js",
|
|
79
|
+
"default": "./dist/share/index.js"
|
|
80
|
+
},
|
|
76
81
|
"./vscode": {
|
|
77
82
|
"types": "./dist/vscode/index.d.ts",
|
|
78
83
|
"import": "./dist/vscode/index.js",
|
|
@@ -94,7 +99,7 @@
|
|
|
94
99
|
"typecheck": "tsc --noEmit"
|
|
95
100
|
},
|
|
96
101
|
"dependencies": {
|
|
97
|
-
"@bendyline/squisq": "2.
|
|
102
|
+
"@bendyline/squisq": "2.3.1",
|
|
98
103
|
"zod": "3.25.76"
|
|
99
104
|
}
|
|
100
105
|
}
|