@zmskco/dsh-notebook 0.1.0 → 0.2.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/LICENSE +23 -23
- package/README.md +238 -96
- package/assets/material-icons/LICENSE.txt +8 -0
- package/assets/material-icons/NOTICE.md +13 -0
- package/cordis.patch.yml +4 -2
- package/icon.png +0 -0
- package/lib/client.js +5359 -245
- package/lib/http/api.js +64 -13
- package/lib/index.js +19 -8
- package/lib/story/bootstrap.js +4 -9
- package/lib/story/project.js +175 -5
- package/lib/story/readme.js +9 -9
- package/lib/story/root.js +12 -9
- package/lib/story/sandbox.js +33 -106
- package/lib/story/workspace.js +1 -15
- package/locale/en.json +6 -6
- package/locale/zh.json +6 -6
- package/package.json +93 -89
- package/icon.svg +0 -9
- package/lib/config.js +0 -43
- package/lib/http/media.js +0 -187
- package/lib/render/backend.js +0 -247
- package/lib/render/jobs.js +0 -267
- package/lib/render/png.js +0 -125
- package/lib/tools.js +0 -341
package/lib/story/sandbox.js
CHANGED
|
@@ -1,55 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The plugin's write boundary
|
|
3
|
-
* it.
|
|
2
|
+
* The plugin's write boundary.
|
|
4
3
|
*
|
|
5
|
-
* Every write this plugin makes — from the panel and from
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
4
|
+
* Every write this plugin makes — from the panel, and from the model going
|
|
5
|
+
* through the same store — goes through `ctx.fs` with an explicit policy. That
|
|
6
|
+
* matters because `fs-sandbox` otherwise calls `ctx.sandboxPolicy.resolve()` with
|
|
7
|
+
* **no session**: a call with no policy of its own is judged against the
|
|
8
|
+
* *deployment* fallback, `defaultMode` plus `workspaceRoot` (whose own default is
|
|
9
|
+
* wherever dsh was launched), never against the workspace it is actually writing
|
|
10
|
+
* to.
|
|
12
11
|
*
|
|
13
|
-
* So {@link storyWritePolicy} states the boundary per call: the
|
|
14
|
-
* is
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* actually stops a path escaping.
|
|
12
|
+
* So {@link storyWritePolicy} states the boundary per call: the resolved root,
|
|
13
|
+
* which is the calling Session's own workspace. Nothing is widened by that — the
|
|
14
|
+
* boundary the plugin stamps is the boundary the Session already has — and
|
|
15
|
+
* `fs-sandbox` still re-canonicalizes the target and enforces containment against
|
|
16
|
+
* it, which is the check that actually stops a path escaping.
|
|
19
17
|
*
|
|
20
|
-
* The **mode** is not invented either: it comes from `resolve({ session })`,
|
|
21
|
-
*
|
|
18
|
+
* The **mode** is not invented either: it comes from `resolve({ session })`, the
|
|
19
|
+
* same call `fs-sandbox` makes, so a Session the operator has switched to
|
|
22
20
|
* `danger-full-access` (or a deployment still under `read-only`) behaves here
|
|
23
21
|
* exactly as it does for the model's own `write`/`edit` and `pwsh`.
|
|
24
22
|
*
|
|
25
|
-
* What is left to report is therefore
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* `rootDir` outside the Session's workspace, where the plugin's own writes
|
|
29
|
-
* succeed but the model's tools and scripts are refused by the very same
|
|
30
|
-
* boundary they are confined to.
|
|
23
|
+
* What is left to report is therefore a single arrangement: a `read-only`
|
|
24
|
+
* deployment, where nothing may write at all — the panel and the model's tools
|
|
25
|
+
* alike, because they are the same boundary.
|
|
31
26
|
*
|
|
32
27
|
* @module notebook/story/sandbox
|
|
33
28
|
*/
|
|
34
29
|
import { homedir } from 'node:os';
|
|
35
|
-
import { join
|
|
36
|
-
/**
|
|
37
|
-
* Whether `child` is `parent` or lives under it.
|
|
38
|
-
*
|
|
39
|
-
* Advisory only — this decides what to *say*, while `fs-sandbox` does the
|
|
40
|
-
* canonical containment check that decides what happens. Windows paths are
|
|
41
|
-
* compared case-insensitively because the filesystem is.
|
|
42
|
-
*/
|
|
43
|
-
function isUnder(child, parent) {
|
|
44
|
-
const outer = resolve(parent);
|
|
45
|
-
const inner = resolve(child);
|
|
46
|
-
const fold = (value) => (process.platform === 'win32' ? value.toLowerCase() : value);
|
|
47
|
-
const outerKey = fold(outer);
|
|
48
|
-
const innerKey = fold(inner);
|
|
49
|
-
if (innerKey === outerKey)
|
|
50
|
-
return true;
|
|
51
|
-
return innerKey.startsWith(outerKey.endsWith(sep) ? outerKey : outerKey + sep);
|
|
52
|
-
}
|
|
30
|
+
import { join } from 'node:path';
|
|
53
31
|
/**
|
|
54
32
|
* The mode one call runs under, resolved exactly as `fs-sandbox` resolves it.
|
|
55
33
|
*
|
|
@@ -65,11 +43,11 @@ export function callMode(policy, session) {
|
|
|
65
43
|
return policy.resolve(session === undefined ? {} : { session }).mode;
|
|
66
44
|
}
|
|
67
45
|
/**
|
|
68
|
-
* The policy to stamp on every write of one
|
|
46
|
+
* The policy to stamp on every write of one root.
|
|
69
47
|
*
|
|
70
|
-
* The mode is the caller's own; the boundary
|
|
71
|
-
*
|
|
72
|
-
* @param rootDir - the resolved absolute
|
|
48
|
+
* The mode is the caller's own; the boundary is the directory the notes actually
|
|
49
|
+
* live in, which is that Session's workspace.
|
|
50
|
+
* @param rootDir - the resolved absolute root for this call.
|
|
73
51
|
* @param policy - the sandbox policy service, when the profile has one.
|
|
74
52
|
* @param session - the calling Session, when the caller named one.
|
|
75
53
|
* @returns the per-call policy, or `undefined` when nothing confines this
|
|
@@ -81,13 +59,12 @@ export function storyWritePolicy(rootDir, policy, session) {
|
|
|
81
59
|
return { mode: callMode(policy, session), workspaceRoot: rootDir };
|
|
82
60
|
}
|
|
83
61
|
/**
|
|
84
|
-
* Decide whether a write to `rootDir` should be expected to work
|
|
85
|
-
* the model's own tools will not be able to follow.
|
|
62
|
+
* Decide whether a write to `rootDir` should be expected to work.
|
|
86
63
|
*
|
|
87
64
|
* Advisory only: the caller reports this and uses it to explain a failure, but
|
|
88
65
|
* still attempts the write, because refusing a write that would have succeeded
|
|
89
66
|
* is worse than a warning that turns out to be unnecessary.
|
|
90
|
-
* @param rootDir - the resolved absolute
|
|
67
|
+
* @param rootDir - the resolved absolute root for this call.
|
|
91
68
|
* @param policy - the sandbox policy service, when this profile has one.
|
|
92
69
|
* @param session - the calling Session, when the caller named one.
|
|
93
70
|
* @returns the assessment shown in the panel and used to explain failures.
|
|
@@ -98,19 +75,6 @@ export function assessWriteAccess(rootDir, policy, session) {
|
|
|
98
75
|
const mode = callMode(policy, session);
|
|
99
76
|
if (mode === 'read-only')
|
|
100
77
|
return { writable: false, mode, workspaceRoot: rootDir, reason: 'read-only' };
|
|
101
|
-
const workspace = session?.header.cwd;
|
|
102
|
-
if (workspace !== undefined && workspace.trim().length > 0 && !isUnder(rootDir, workspace.trim())) {
|
|
103
|
-
// Not a refusal: the plugin stamps its own boundary and writes here happily.
|
|
104
|
-
// It is the model's half that cannot follow, and silence about that is how a
|
|
105
|
-
// half-working setup looks like a working one.
|
|
106
|
-
return {
|
|
107
|
-
writable: true,
|
|
108
|
-
mode,
|
|
109
|
-
workspaceRoot: rootDir,
|
|
110
|
-
reason: 'outside-workspace',
|
|
111
|
-
sessionWorkspace: workspace.trim(),
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
78
|
return { writable: true, mode, workspaceRoot: rootDir };
|
|
115
79
|
}
|
|
116
80
|
/** The profile patch file a user edits to change the sandbox mode. */
|
|
@@ -123,18 +87,18 @@ export function profilePatchPath() {
|
|
|
123
87
|
/**
|
|
124
88
|
* Explain a read-only deployment and give the exact edit that lifts it.
|
|
125
89
|
*
|
|
126
|
-
* The mode is the only knob that can be turned from here — the
|
|
127
|
-
*
|
|
128
|
-
* not a directory move.
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* replaced wholesale, never deep-merged — an entry that set only `mode` would
|
|
132
|
-
* reset `workspaceRoot` to `process.cwd()`.
|
|
90
|
+
* The mode is the only knob that can be turned from here — the root follows the
|
|
91
|
+
* calling Session, so the remedy for a *read-only* deployment is a mode change,
|
|
92
|
+
* not a directory move. The YAML is spelled out rather than described because
|
|
93
|
+
* `config` in a Loader patch is replaced wholesale, never deep-merged — an entry
|
|
94
|
+
* that set only `mode` would reset `workspaceRoot` to `process.cwd()`.
|
|
133
95
|
* @param rootDir - the root the refused call resolved to.
|
|
134
96
|
* @param access - the assessment for that root.
|
|
135
97
|
* @returns a multi-line message suitable for the panel and for a tool result.
|
|
136
98
|
*/
|
|
137
|
-
function
|
|
99
|
+
export function writeAccessGuidance(rootDir, access) {
|
|
100
|
+
if (access.reason !== 'read-only')
|
|
101
|
+
return null;
|
|
138
102
|
const patch = profilePatchPath();
|
|
139
103
|
return [
|
|
140
104
|
`目录 ${rootDir} 不可写:当前部署的文件策略是 read-only,插件的每一次写入都会被拒绝。`,
|
|
@@ -147,40 +111,3 @@ function readOnlyGuidance(rootDir, access) {
|
|
|
147
111
|
` workspaceRoot: ${access.workspaceRoot ?? rootDir}`,
|
|
148
112
|
].join('\n');
|
|
149
113
|
}
|
|
150
|
-
/**
|
|
151
|
-
* Explain a root that sits outside the open workspace.
|
|
152
|
-
*
|
|
153
|
-
* Nothing here is broken from the plugin's side — which is exactly why it has to
|
|
154
|
-
* be said out loud, in both directions: what still works, and what does not.
|
|
155
|
-
* @param rootDir - the root the call resolved to.
|
|
156
|
-
* @param access - the assessment for that root.
|
|
157
|
-
* @returns a multi-line message suitable for the panel and for a tool result.
|
|
158
|
-
*/
|
|
159
|
-
function outsideWorkspaceGuidance(rootDir, access) {
|
|
160
|
-
const workspace = access.sessionWorkspace ?? '当前工作区';
|
|
161
|
-
return [
|
|
162
|
-
`目录 ${rootDir} 不在当前工作区 ${workspace} 之内(由 profile 里的 rootDir 固定)。`,
|
|
163
|
-
'',
|
|
164
|
-
'面板照常读写:插件给每次写入盖的边界就是这个目录本身。',
|
|
165
|
-
'但模型自己的 write/edit 工具,以及 pwsh / python 脚本,边界是本会话的工作区,',
|
|
166
|
-
'在这里会被沙箱拒绝(读不受影响)。',
|
|
167
|
-
'',
|
|
168
|
-
'两种改法,任选其一:',
|
|
169
|
-
` · 去掉 profile 里的 rootDir,笔记本就落在工作区 ${workspace};`,
|
|
170
|
-
' · 或者把这个目录本身作为工作区打开。',
|
|
171
|
-
].join('\n');
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* The remedy text for a root that cannot be written, or that only this plugin
|
|
175
|
-
* can write.
|
|
176
|
-
* @param rootDir - the story root the call resolved to.
|
|
177
|
-
* @param access - the assessment for that root.
|
|
178
|
-
* @returns a multi-line message, or `null` when there is nothing to say.
|
|
179
|
-
*/
|
|
180
|
-
export function writeAccessGuidance(rootDir, access) {
|
|
181
|
-
if (access.reason === 'read-only')
|
|
182
|
-
return readOnlyGuidance(rootDir, access);
|
|
183
|
-
if (access.reason === 'outside-workspace')
|
|
184
|
-
return outsideWorkspaceGuidance(rootDir, access);
|
|
185
|
-
return null;
|
|
186
|
-
}
|
package/lib/story/workspace.js
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
import { ProjectStore } from './project.js';
|
|
2
2
|
import { storyWritePolicy } from './sandbox.js';
|
|
3
|
-
/**
|
|
4
|
-
* The directory the panel's tree shows.
|
|
5
|
-
*
|
|
6
|
-
* A live Session knows it exactly (`header.cwd`, the folder the operator opened).
|
|
7
|
-
* Without one — a scripted caller, or the moment before the page binds — the
|
|
8
|
-
* session-less fallback root *is* the workspace, so it is used as is.
|
|
9
|
-
* @param session - the calling Session, when live.
|
|
10
|
-
* @param fallbackRoot - the store root resolved for this call.
|
|
11
|
-
* @returns an absolute path to the workspace.
|
|
12
|
-
*/
|
|
13
|
-
export function workspaceDirFor(session, fallbackRoot) {
|
|
14
|
-
const cwd = session?.header.cwd;
|
|
15
|
-
return typeof cwd === 'string' && cwd.length > 0 ? cwd : fallbackRoot;
|
|
16
|
-
}
|
|
17
3
|
/** Workspaces kept as live stores; beyond this the oldest is dropped. */
|
|
18
4
|
const MAX_CACHED_WORKSPACES = 8;
|
|
19
5
|
/** One store per (workspace, sandbox mode). */
|
|
@@ -26,7 +12,7 @@ const cache = new Map();
|
|
|
26
12
|
* entry costs one listing.
|
|
27
13
|
* @param deps - filesystem, sandbox policy, logger.
|
|
28
14
|
* @param session - the calling Session, for the write policy.
|
|
29
|
-
* @param dir - the workspace directory.
|
|
15
|
+
* @param dir - the workspace directory, as resolved for this call.
|
|
30
16
|
* @returns a store whose root is `dir` and whose only project is that directory.
|
|
31
17
|
*/
|
|
32
18
|
export function workspaceStore(deps, session, dir) {
|
package/locale/en.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"meta": {
|
|
3
|
-
"title": "Notebook",
|
|
4
|
-
"description": "A markdown notebook for the workspace: file tree, WYSIWYG editing, autosave and an embedded AI chat."
|
|
5
|
-
}
|
|
6
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"title": "Notebook",
|
|
4
|
+
"description": "A markdown notebook for the workspace: file tree, WYSIWYG editing, autosave and an embedded AI chat."
|
|
5
|
+
}
|
|
6
|
+
}
|
package/locale/zh.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"meta": {
|
|
3
|
-
"title": "笔记本",
|
|
4
|
-
"description": "工作区里的 markdown 笔记本:目录树、所见即所得编辑、自动保存与内嵌 AI 对话。"
|
|
5
|
-
}
|
|
6
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"title": "笔记本",
|
|
4
|
+
"description": "工作区里的 markdown 笔记本:目录树、所见即所得编辑、自动保存与内嵌 AI 对话。"
|
|
5
|
+
}
|
|
6
|
+
}
|
package/package.json
CHANGED
|
@@ -1,89 +1,93 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@zmskco/dsh-notebook",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "笔记本 (Notebook) — a markdown notebook for the DeepSeek Harness workspace: file tree, WYSIWYG editor, autosave and an embedded AI chat.",
|
|
5
|
-
"icon": "./icon.
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/zmskco/dsh-notebook.git"
|
|
9
|
-
},
|
|
10
|
-
"homepage": "https://github.com/zmskco/dsh-notebook#readme",
|
|
11
|
-
"bugs": {
|
|
12
|
-
"url": "https://github.com/zmskco/dsh-notebook/issues"
|
|
13
|
-
},
|
|
14
|
-
"type": "module",
|
|
15
|
-
"license": "MIT",
|
|
16
|
-
"main": "lib/index.js",
|
|
17
|
-
"exports": {
|
|
18
|
-
".": "./lib/index.js",
|
|
19
|
-
"./client": "./lib/client.js",
|
|
20
|
-
"./locale/*.json": "./locale/*.json",
|
|
21
|
-
"./icon
|
|
22
|
-
"./
|
|
23
|
-
"./
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"lib/
|
|
28
|
-
"lib
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"prosemirror-
|
|
79
|
-
"prosemirror-
|
|
80
|
-
"prosemirror-
|
|
81
|
-
"prosemirror-
|
|
82
|
-
"prosemirror-
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@zmskco/dsh-notebook",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "笔记本 (Notebook) — a markdown notebook for the DeepSeek Harness workspace: file tree, WYSIWYG editor, autosave and an embedded AI chat.",
|
|
5
|
+
"icon": "./icon.png",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/zmskco/dsh-notebook.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/zmskco/dsh-notebook#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/zmskco/dsh-notebook/issues"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"main": "lib/index.js",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": "./lib/index.js",
|
|
19
|
+
"./client": "./lib/client.js",
|
|
20
|
+
"./locale/*.json": "./locale/*.json",
|
|
21
|
+
"./icon": "./icon.png",
|
|
22
|
+
"./icon.png": "./icon.png",
|
|
23
|
+
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
24
|
+
"./package.json": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"lib/index.js",
|
|
28
|
+
"lib/client.js",
|
|
29
|
+
"lib/**/*.js",
|
|
30
|
+
"cordis.patch.yml",
|
|
31
|
+
"locale/*.json",
|
|
32
|
+
"icon.png",
|
|
33
|
+
"assets/material-icons/LICENSE.txt",
|
|
34
|
+
"assets/material-icons/NOTICE.md",
|
|
35
|
+
"LICENSE",
|
|
36
|
+
"README.md"
|
|
37
|
+
],
|
|
38
|
+
"keywords": [
|
|
39
|
+
"dsh",
|
|
40
|
+
"deepseek-harness",
|
|
41
|
+
"cordis",
|
|
42
|
+
"bundle",
|
|
43
|
+
"notebook",
|
|
44
|
+
"markdown",
|
|
45
|
+
"editor"
|
|
46
|
+
],
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=20",
|
|
49
|
+
"dsh": "^0.2.2-alpha.2"
|
|
50
|
+
},
|
|
51
|
+
"dsh": {
|
|
52
|
+
"bundle": {
|
|
53
|
+
"patch": "./cordis.patch.yml"
|
|
54
|
+
},
|
|
55
|
+
"client": {
|
|
56
|
+
"platform": "web",
|
|
57
|
+
"immediately": true
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"build": "npm run build:host && npm run build:client && npm run check:client",
|
|
62
|
+
"build:host": "tsc -p tsconfig.host.json",
|
|
63
|
+
"build:client": "tsdown",
|
|
64
|
+
"check:client": "node scripts/check-client.mjs",
|
|
65
|
+
"check:sandbox": "node scripts/check-sandbox.mjs",
|
|
66
|
+
"smoke": "node scripts/smoke-host.mjs",
|
|
67
|
+
"test": "npm run typecheck && npm run check:sandbox && npm run smoke",
|
|
68
|
+
"vendor:icons": "node scripts/vendor-material-icons.mjs",
|
|
69
|
+
"watch:client": "tsdown --watch",
|
|
70
|
+
"watch:host": "tsc -p tsconfig.host.json --watch --preserveWatchOutput",
|
|
71
|
+
"typecheck": "tsc -p tsconfig.host.json --noEmit && tsc -p tsconfig.json",
|
|
72
|
+
"prepublishOnly": "npm run build && npm test",
|
|
73
|
+
"pack:check": "npm pack --dry-run"
|
|
74
|
+
},
|
|
75
|
+
"devDependencies": {
|
|
76
|
+
"@types/node": "^22.10.0",
|
|
77
|
+
"@types/react": "^18.3.0",
|
|
78
|
+
"prosemirror-commands": "^1.7.2",
|
|
79
|
+
"prosemirror-history": "^1.5.1",
|
|
80
|
+
"prosemirror-inputrules": "^1.5.1",
|
|
81
|
+
"prosemirror-keymap": "^1.2.3",
|
|
82
|
+
"prosemirror-model": "^1.25.12",
|
|
83
|
+
"prosemirror-schema-basic": "^1.2.5",
|
|
84
|
+
"prosemirror-schema-list": "^1.5.1",
|
|
85
|
+
"prosemirror-state": "^1.4.4",
|
|
86
|
+
"prosemirror-view": "^1.42.8",
|
|
87
|
+
"tsdown": "^0.22.2",
|
|
88
|
+
"typescript": "^5.7.0"
|
|
89
|
+
},
|
|
90
|
+
"publishConfig": {
|
|
91
|
+
"access": "public"
|
|
92
|
+
}
|
|
93
|
+
}
|
package/icon.svg
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none"
|
|
2
|
-
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
3
|
-
<path d="M2 6h4" />
|
|
4
|
-
<path d="M2 10h4" />
|
|
5
|
-
<path d="M2 14h4" />
|
|
6
|
-
<path d="M2 18h4" />
|
|
7
|
-
<rect width="16" height="20" x="4" y="2" rx="2" />
|
|
8
|
-
<path d="M16 2v20" />
|
|
9
|
-
</svg>
|
package/lib/config.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Plugin configuration: validation and defaults.
|
|
3
|
-
*
|
|
4
|
-
* The plugin exports no `Config` schema, because the schema DSL lives in a DSH
|
|
5
|
-
* package this out-of-checkout bundle does not depend on. Configuration that a
|
|
6
|
-
* profile patch supplies therefore arrives unvalidated, and this module is the
|
|
7
|
-
* replacement: every field is checked once at activation and either accepted or
|
|
8
|
-
* replaced with a default, with a warning naming the field.
|
|
9
|
-
*/
|
|
10
|
-
import { isAbsolute, join, resolve } from 'node:path';
|
|
11
|
-
function optionalString(value) {
|
|
12
|
-
return typeof value === 'string' && value.trim().length > 0 ? value.trim() : null;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Resolve the effective configuration.
|
|
16
|
-
* @param raw - the row's `config`, or `undefined` when the row declared none.
|
|
17
|
-
* @param fallbackRoot - default root, already derived from the sandbox boundary.
|
|
18
|
-
* @param warn - sink for rejected fields; the caller supplies the plugin logger.
|
|
19
|
-
* @param workspaceRoot - the sandbox's `workspace-write` boundary, when known.
|
|
20
|
-
* A **relative** `rootDir` resolves against it, so `rootDir: notes` lands
|
|
21
|
-
* inside the one directory the sandbox is guaranteed to permit. Without a
|
|
22
|
-
* boundary a relative path falls back to resolving against `process.cwd()`.
|
|
23
|
-
* @returns the validated configuration.
|
|
24
|
-
*/
|
|
25
|
-
export function resolveConfig(raw, fallbackRoot, warn, workspaceRoot) {
|
|
26
|
-
const input = typeof raw === 'object' && raw !== null ? raw : {};
|
|
27
|
-
const configured = optionalString(input.rootDir);
|
|
28
|
-
let rootDir = fallbackRoot;
|
|
29
|
-
let rootDirOverride = false;
|
|
30
|
-
if (configured !== null) {
|
|
31
|
-
rootDirOverride = true;
|
|
32
|
-
if (isAbsolute(configured))
|
|
33
|
-
rootDir = configured;
|
|
34
|
-
else if (workspaceRoot !== undefined && workspaceRoot.length > 0)
|
|
35
|
-
rootDir = join(workspaceRoot, configured);
|
|
36
|
-
else
|
|
37
|
-
rootDir = resolve(configured);
|
|
38
|
-
}
|
|
39
|
-
else if (input.rootDir !== undefined) {
|
|
40
|
-
warn(`rootDir must be a non-empty string; received ${JSON.stringify(input.rootDir)}, using the workspace`);
|
|
41
|
-
}
|
|
42
|
-
return { rootDir, rootDirOverride };
|
|
43
|
-
}
|