dsh-mindmap 0.18.3 → 0.18.4
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/CHANGELOG.md +1 -0
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/client.js +2 -2
- package/index.js +18 -12
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -38,6 +38,7 @@ All notable changes to this project are documented here. Release-specific notes
|
|
|
38
38
|
|
|
39
39
|
### Fixed
|
|
40
40
|
|
|
41
|
+
- Extend the full-file-access compatibility fix to root renames, clearing content, and broad rewrites: when the host's live `sandboxPolicy.resolve({ session })` explicitly returns `danger-full-access`, these operations no longer request an extra plugin approval that the full-access preset would automatically reject. This supersedes the high-risk exception in the earlier ordinary-write fix below. Non-full-access policies still gate high-risk writes, and disabling approval prompts alone grants no file access. Upstream approval decisions, path containment, collision checks, size limits, revision conflicts, and session-grant isolation are preserved; guidance, settings help, and security documentation now describe the same boundary.
|
|
41
42
|
- Ordinary create/update calls no longer request an extra plugin confirmation when the host's live per-session `sandboxPolicy.resolve({ session })` explicitly returns `danger-full-access`. DSH's full-access preset also disables approval prompts, which rejects an extra `ask` as “the user rejected tool” even without a manual rejection. Full-access calls do not create reusable document grants, the workspace reports the effective confirmation mode, and effective-mode changes invalidate that session's prior grants and pending approval results without affecting other sessions. Switching back to a restricted policy restores the configured confirmation behavior. Renames, cleared content, broad rewrites, and upstream denials/asks/cancellations remain gated; missing, failing, or unknown policy APIs retain the previous confirmation policy. No session permission or host configuration is changed.
|
|
42
43
|
- Read draft text and attachment state from the host's `useInput` snapshot, including edits made while a file request is pending. Unknown state preserves input; old action-face getters remain supported. Inline references and attachment-only drafts block automatic submission too.
|
|
43
44
|
- Fresh disk reads no longer lose to older tool snapshots. A later tool event takes over normally; overlapping reads, closing, session switches, and newer open intents invalidate stale requests.
|
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ A DeepSeek Harness plugin that turns a plain Markdown file into a live mindmap.
|
|
|
35
35
|
- **Copy current node text** — 复制当前节点文本内容 sits immediately above 复制节点路径 in the node context menu. It copies only the current node's complete text, preserving line breaks and excluding ancestors, paths, and descendants. The mindmap and chat draft remain unchanged.
|
|
36
36
|
- **Copy node path** — the node context menu includes 复制节点路径, which copies the complete root-to-current path as one plain-text line, for example `Node 1--->Node 2--->Node 3--->Node 4`. It excludes descendants and never submits a message or replaces the chat draft. Clipboard failures keep the menu open and show the error.
|
|
37
37
|
- **Node search and quick navigation** — search the current mindmap by text (⌘/Ctrl+F, or the 🔍 in the zoom bar), jump through matches with Enter / ↑ ↓ (wrap-around), and automatically reveal matches inside collapsed subtrees. Jumping keeps your zoom and only scrolls; search is view-only, so the markdown never changes.
|
|
38
|
-
- **Safety** — when the host's live session file policy explicitly grants `danger-full-access`,
|
|
38
|
+
- **Safety** — when the host's live session file policy explicitly grants `danger-full-access`, all mindmap writes (create, update, rename, clearing content, and broad rewrites) skip this plugin's additional confirmation. This follows the effective file policy, including custom presets, not the approval-prompt setting; upstream approval decisions and path, collision, size, and revision checks still apply. Otherwise, write approval defaults to “once per session/document”; the settings page also offers “every write” and “disable ordinary confirmations”, and the current workspace shows and can revoke the current-session grant. Without full file access, renames, cleared content, and broad rewrites still require a separate confirmation, even with `approvalMode: off` or `requireApproval: false`. Disabling approval prompts alone is not file authorization: the host automatically rejects requests that still need confirmation. Missing, failing, or unrecognized host policy APIs retain the configured confirmation policy. Full-access calls do not create reusable document grants; returning to restricted permissions restores the configured confirmation behavior. The client has **no write path** to the filesystem — every edit goes through the AI tools.
|
|
39
39
|
|
|
40
40
|
Inside Better Sidebar, the mindmap list uses the host's 14px body typography. Markdown files carry a compact M badge; folders and other files use 14px outline icons. Other file formats are display-only, without hover feedback, opening, dragging, or context menus; folders remain expandable. Tabs, actions, and hints use the host's 12px typography role. Standalone mode retains its original appearance, and mindmap node typography, zoom, and image export are unchanged.
|
|
41
41
|
|
package/README.zh-CN.md
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
- **复制当前节点文本内容**——节点右键菜单中位于「复制节点路径」正上方。只复制当前节点自身的完整文本,保留原有换行;不包含父节点、路径或子节点,不修改脑图或聊天草稿。
|
|
36
36
|
- **复制节点路径**——节点右键菜单新增「复制节点路径」,把根节点到当前节点的完整路径复制为单行纯文本,例如 `节点1--->节点2--->节点3--->节点4`。不包含子节点,也不自动发送消息或覆盖聊天草稿;复制失败时保留菜单并提示原因。
|
|
37
37
|
- **节点搜索与快速定位**——⌘/Ctrl+F(或缩放条上的 🔍)在当前脑图中搜索文字,Enter / ↑ ↓ 逐个跳转匹配节点(双向环绕),并自动展开被折叠分支中的搜索结果;跳转保留当前缩放、只滚动视图。搜索只改视图状态,绝不动 Markdown。
|
|
38
|
-
- **安全**——宿主对当前会话明确授予 `danger-full-access
|
|
38
|
+
- **安全**——宿主对当前会话明确授予 `danger-full-access`(完全文件权限)时,新建、更新、重命名、清空和大范围重写均不额外请求插件确认。判断依据是宿主实时解析的文件权限(包括自定义预设),不是审批弹窗开关;宿主其他审批决定与路径、重名、大小、版本冲突检查仍保留。其他情况下,写入确认默认采用“本会话一次”,也可切换为“每次确认”或“关闭普通确认”;当前脑图工作区会显示并可撤销本会话授权。非完全权限时,重命名、清空和大范围重写仍需单独确认,`approvalMode: off` 或 `requireApproval: false` 只能关闭普通确认。仅关闭审批弹窗不等于授予文件权限:宿主会自动拒绝仍需确认的请求。宿主策略接口缺失、解析失败或返回未知值时,沿用配置的确认策略。完全权限下不积累可复用的文档授权,切回受限权限后恢复配置的确认策略。客户端**没有任何写文件通道**,一切编辑都经 AI 工具。
|
|
39
39
|
|
|
40
40
|
内嵌 Better Sidebar 时,脑图列表采用宿主的 14px 正文字体。Markdown 文件显示紧凑的 M 徽标,文件夹与其他文件使用 14px 线框图标;其他格式文件仅展示,没有悬停反馈、打开、拖拽或右键菜单,文件夹仍可展开。标签、操作按钮和提示采用宿主的 12px 字体角色。独立模式保留原有外观;脑图节点的基础字体层级和图片导出保持不变。
|
|
41
41
|
|
package/client.js
CHANGED
|
@@ -1980,8 +1980,8 @@ window.__ModuleLoader__.load({
|
|
|
1980
1980
|
onChange: (v) => setField({ approvalMode: v }),
|
|
1981
1981
|
}),
|
|
1982
1982
|
] }),
|
|
1983
|
-
(0, react_jsx_runtime.jsx)("p", { style: S.settingsHint, children: value.approvalMode === "session" ? "
|
|
1984
|
-
(0, react_jsx_runtime.jsx)("p", { style: S.settingsHint, children: "DSH
|
|
1983
|
+
(0, react_jsx_runtime.jsx)("p", { style: S.settingsHint, children: value.approvalMode === "session" ? "非完全权限时,本会话首次写入当前脑图后,后续普通更新无需重复确认。切换文件或会话会重新确认。" : value.approvalMode === "off" ? "非完全权限时,普通更新不再弹窗;重命名、清空和大范围重写仍需确认。" : "非完全权限时,每次写入都会弹窗确认。" }),
|
|
1984
|
+
(0, react_jsx_runtime.jsx)("p", { style: S.settingsHint, children: "DSH 明确授予完全文件权限时,新建、更新、重命名、清空和大范围重写均不额外请求插件确认;路径、重名和版本冲突检查仍保留。仅关闭审批弹窗不等于授予文件权限,也不会绕过宿主的其他审批决定。" }),
|
|
1985
1985
|
value.approvalMode === "session" ? (0, react_jsx_runtime.jsx)("p", { style: S.settingsHint, children: "授权状态显示在当前脑图工作区;可在那里撤销当前会话的普通写入授权。" }) : null,
|
|
1986
1986
|
] }),
|
|
1987
1987
|
saving ? (0, react_jsx_runtime.jsx)("p", { style: S.settingsHint, children: "保存中…" }) : null,
|
package/index.js
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
// 供模型续编辑,client 用同一份重放面板(工具结果即实时通道,002 第二节)。
|
|
15
15
|
// - requireApproval 配置(决策 6):默认 true;approvalMode 默认按「当前会话 + 当前文件」
|
|
16
16
|
// 首次确认,后续普通更新复用授权;per-operation 可恢复每次确认,off 关闭普通确认。
|
|
17
|
-
// 宿主明确授予 danger-full-access
|
|
18
|
-
//
|
|
17
|
+
// 宿主明确授予 danger-full-access 时所有脑图写入不额外确认,不缓存成文档授权。
|
|
18
|
+
// 非完全权限下,重命名、清空和大范围重写始终重新确认,关闭普通确认也不能跳过。
|
|
19
19
|
// 015 起经 settings namespace 可运行时切换。
|
|
20
20
|
// - 依赖:仅 @deepseek-ai/schemastery(settings schema;发布包正常解析,
|
|
21
21
|
// link 开发需先 npm i)。工具参数 schema 仍手写 JSON Schema(003 偏差 1)。
|
|
@@ -131,8 +131,8 @@ function configValue(value) {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
export const Config = Schema.object({
|
|
134
|
-
requireApproval: Schema.boolean().default(true).description('Legacy switch: false skips ordinary confirmations only, and is lifted when the settings panel picks an explicit approval mode. Rename, clearing content, and broad rewrites
|
|
135
|
-
approvalMode: Schema.union([...APPROVAL_MODES, 'once-per-document', 'always']).default('session').description('Confirm every ordinary write, once per document in the current session, or disable ordinary confirmations. Explicit host danger-full-access skips
|
|
134
|
+
requireApproval: Schema.boolean().default(true).description('Legacy switch: false skips ordinary confirmations only, and is lifted when the settings panel picks an explicit approval mode. Rename, clearing content, and broad rewrites require approval unless the host explicitly grants danger-full-access.').extra('volatile', true),
|
|
135
|
+
approvalMode: Schema.union([...APPROVAL_MODES, 'once-per-document', 'always']).default('session').description('Confirm every ordinary write, once per document in the current session, or disable ordinary confirmations. Explicit host danger-full-access skips all plugin write confirmations, including rename, clearing content, and broad rewrites. Otherwise high-risk writes always require approval.').extra('volatile', true),
|
|
136
136
|
defaultPanelWidth: Schema.number().default(42).description('Default floating-panel width as a percentage of the viewport (clamped 20-80 on the client).').extra('volatile', true),
|
|
137
137
|
lineStyle: Schema.union(['curve', 'elbow']).default('elbow').description('Connector line style between nodes: curve (bezier) or elbow (orthogonal).').extra('volatile', true),
|
|
138
138
|
cardStyle: Schema.union(['rounded', 'square']).default('rounded').description('Node card corner style.').extra('volatile', true),
|
|
@@ -185,7 +185,7 @@ Behavior rules:
|
|
|
185
185
|
- Update step by step: whenever the request involves several parts, call mindmap_update as soon as each part is ready — several small updates beat one giant update at the end. The panel plays a growth animation on newly added/changed nodes, so step-by-step updates make the tree visibly grow while you work. Do not call mindmap_update twice in a row with identical content.
|
|
186
186
|
- Never delete the whole document or restructure it without an explicit user request. Make the smallest change that answers the request.
|
|
187
187
|
- When the user steps away or pauses (e.g. "我去买咖啡"), stop all mindmap edits immediately and wait — never continue autonomously.
|
|
188
|
-
-
|
|
188
|
+
- Writes follow the host's live file policy: explicit \`danger-full-access\` skips all of this plugin's write confirmations, including rename, clearing content, and broad rewrites. This does not bypass upstream approval decisions or path, collision, size, and revision checks. Without full file access, native write approval defaults to once per document in the current session; \`per-operation\` asks for each ordinary write and \`off\` skips ordinary confirmations, but rename, clearing content, and broad rewrites still require confirmation. The current mindmap workspace shows and can revoke the current-session grants. If approval prompts are disabled, that alone is not file permission and does not bypass a required confirmation; report the failure without claiming that the user personally clicked Reject. Never treat a rejected or failed write as approved.
|
|
189
189
|
- Never run any git command for these files. The user commits themselves.
|
|
190
190
|
- Mindmap files stay inside the session working directory.`
|
|
191
191
|
|
|
@@ -734,12 +734,14 @@ export function apply(ctx, config = {}) {
|
|
|
734
734
|
// 完全权限预设同时关闭审批弹窗(never):额外返回 ask 会被宿主自动拒绝。
|
|
735
735
|
// 只认公共 sandboxPolicy 对当前 session 的实时解析;never 本身不是授权。
|
|
736
736
|
// 能力缺失、解析失败、未知模式或无会话时保留旧策略,不读部署默认值猜权限。
|
|
737
|
-
const
|
|
737
|
+
const approvalPolicyOf = (session) => {
|
|
738
738
|
let mode = readApprovalMode()
|
|
739
|
+
let fullAccess = false
|
|
739
740
|
if (session && typeof session === 'object') {
|
|
740
741
|
try {
|
|
741
742
|
const policy = ctx.get?.('sandboxPolicy')?.resolve?.({ session })
|
|
742
|
-
|
|
743
|
+
fullAccess = policy?.mode === 'danger-full-access'
|
|
744
|
+
if (fullAccess) mode = 'off'
|
|
743
745
|
} catch { /* 旧宿主或策略不可用时不新增免确认权限。 */ }
|
|
744
746
|
const previous = effectiveApprovalModes.get(session)
|
|
745
747
|
if (previous !== undefined && previous !== mode) {
|
|
@@ -748,7 +750,8 @@ export function apply(ctx, config = {}) {
|
|
|
748
750
|
}
|
|
749
751
|
effectiveApprovalModes.set(session, mode)
|
|
750
752
|
}
|
|
751
|
-
|
|
753
|
+
// 配置的 off 只免普通确认;宿主完全文件权限才免除高风险确认,不能混为一谈。
|
|
754
|
+
return { mode, fullAccess }
|
|
752
755
|
}
|
|
753
756
|
const stateOf = (session) => {
|
|
754
757
|
if (!session || typeof session !== 'object') return null
|
|
@@ -760,7 +763,7 @@ export function apply(ctx, config = {}) {
|
|
|
760
763
|
return state
|
|
761
764
|
}
|
|
762
765
|
const approvalStatusOf = (session) => {
|
|
763
|
-
const mode =
|
|
766
|
+
const { mode } = approvalPolicyOf(session)
|
|
764
767
|
const state = session && typeof session === 'object' ? approvedTargets.get(session) : null
|
|
765
768
|
return { mode, grantedDocuments: state?.paths.size ?? 0 }
|
|
766
769
|
}
|
|
@@ -846,9 +849,12 @@ export function apply(ctx, config = {}) {
|
|
|
846
849
|
const args = exec.arguments ?? {}
|
|
847
850
|
const session = sessionOf(exec)
|
|
848
851
|
const target = await targetOf(exec)
|
|
852
|
+
const { mode, fullAccess } = approvalPolicyOf(session)
|
|
853
|
+
// 完全权限涵盖所有脑图写入;不请求宿主无法展示的额外确认,也不缓存授权。
|
|
854
|
+
// 只跳过本插件的确认,execute 中的路径、重名、大小与 revision 校验照常执行。
|
|
855
|
+
if (fullAccess) return decision
|
|
849
856
|
const rename = exec.name === 'mindmap_update' && typeof args.renameRoot === 'string' && args.renameRoot.trim()
|
|
850
857
|
const deleteDocument = exec.name === 'mindmap_update' && typeof args.content === 'string' && args.content.trim() === ''
|
|
851
|
-
const mode = ordinaryApprovalModeOf(session)
|
|
852
858
|
const broadRewrite = await needsRewriteApproval(exec, target, args.content)
|
|
853
859
|
const highRisk = Boolean(rename || deleteDocument || broadRewrite)
|
|
854
860
|
if (mode === 'off' && !highRisk) return decision
|
|
@@ -866,7 +872,7 @@ export function apply(ctx, config = {}) {
|
|
|
866
872
|
const bytes = typeof args.content === 'string' ? byteLength(args.content) : 0
|
|
867
873
|
return {
|
|
868
874
|
kind: 'ask',
|
|
869
|
-
reason: `${rename ? 'Rename and write' : deleteDocument ? 'Delete mindmap content' : broadRewrite ? 'Broad rewrite' : 'Write'} mindmap ${JSON.stringify(String(args.path ?? '?'))} (${bytes} bytes${renameNote}). ${highRisk ? '
|
|
875
|
+
reason: `${rename ? 'Rename and write' : deleteDocument ? 'Delete mindmap content' : broadRewrite ? 'Broad rewrite' : 'Write'} mindmap ${JSON.stringify(String(args.path ?? '?'))} (${bytes} bytes${renameNote}). ${highRisk ? 'Without host full file access, this operation requires confirmation.' : mode === 'per-operation' ? 'Confirm this write.' : 'Confirm once for this document in the current session.'}`,
|
|
870
876
|
}
|
|
871
877
|
})
|
|
872
878
|
|
|
@@ -878,7 +884,7 @@ export function apply(ctx, config = {}) {
|
|
|
878
884
|
if (!pending) return
|
|
879
885
|
pendingApprovals.delete(exec)
|
|
880
886
|
if (result?.isError !== false || exec.signal?.aborted) return
|
|
881
|
-
if (
|
|
887
|
+
if (approvalPolicyOf(pending.session).mode !== 'session') return
|
|
882
888
|
// 撤销或策略切换之后,尚未结束的旧调用不能重新恢复授权。
|
|
883
889
|
if (approvedTargets.get(pending.session) !== pending.state || pending.state.generation !== pending.generation) return
|
|
884
890
|
// 审批后被抢注、实际写到了 -2 的情形:授权记真实路径,不记用户没见过的那条。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mindmap",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.4",
|
|
4
4
|
"description": "Mindmap plugin for DeepSeek Harness: a plain markdown file in the working directory IS the mindmap; the chat edits it step by step and the right-side panel follows live.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|