dsh-mindmap 0.15.0 → 0.16.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/CHANGELOG.md +2 -0
- package/index.js +59 -38
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -24,6 +24,8 @@ All notable changes to this project are documented here. Release-specific notes
|
|
|
24
24
|
|
|
25
25
|
### Fixed
|
|
26
26
|
|
|
27
|
+
- Restored host-side settings on 0.1.7+ hosts: the service no longer has `register`, so the 0.15.0 startup path never read live values or ran its `.imported` migration. The flat `Config` export remains the loader-discovered schema; host approval now reads the `mindmap` descriptor from `describe()` at execution time, and legacy settings are restored via revision-checked `update()` only when the profile has no saved user overrides. Older hosts retain their `register` path. The tests now mock the actual service surface without `register` and exercise live approval changes and one-time migration.
|
|
28
|
+
- Extended the tooling peer range with `^0.2.0-alpha.0` for the 0.2.0 prerelease tuple. Hosts that enforce peer compatibility no longer skip the plugin solely because its previous range stopped at 0.1.7; the optional sidebar peer is unchanged.
|
|
27
29
|
- 0.1.7 settings volatile mechanism: all seven Config fields (`requireApproval`, `approvalMode`, `defaultPanelWidth`, `lineStyle`, `cardStyle`, `colorTheme`, `growthAnimation`) are now marked `.extra('volatile', true)` on their schemastery schema nodes. Without `meta.volatile`, the 0.1.7 host's settings storage (`dsh-settings` `volatileForm`/`isVolatilePath`/`write`) rejects all reads and writes for the `mindmap` namespace — the settings panel (设置 → 思维脑图) displays stale or default values and saving a new choice is silently dropped. The `volatile` meta is transparent to older hosts (0.1.5 and below ignore it), so the dual-path behavior is unchanged. A one-time legacy migration was also added: on startup, when the settings value is all-defaults, the plugin reads `~/.dsh/settings.yaml.imported` (the host-renamed old `settings.yaml`), extracts the `mindmap:` section's scalar fields with a line-by-line parser (no YAML dependency), validates each value against its allowed set, and writes the result to the new settings store via `scope.update()`. The `.imported` file is never deleted (it is host-managed); failures are silently skipped so the plugin still loads and the user can configure manually.
|
|
28
30
|
- dsh-tools peer dependency window extended to cover the `0.1.7-rc.2` release: `^0.1.7-alpha.0` is appended to the comparator list (`^0.1.0-rc.6 || ^0.1.1-rc.0 || ^0.1.2-alpha.0 || ^0.1.3-alpha.0 || ^0.1.5-alpha.0 || ^0.1.7-alpha.0`). Under node-semver prerelease tuple rules, `0.1.7-rc.2` requires a `[0,1,7]` tuple with a prerelease tag in the range — without this comparator, `pnpm add dsh-mindmap` on a 0.1.7 host fails with ERESOLVE. The static API surface (Agent `{ id }`, `SessionHeader.cwd`, `settings.describe` envelope, `ChatSnapshot.legacy.nodes`, `ToolResultNode` fields, `conversation.session.header.actions` / `conversation.chat.turn` slots, `settings.section` slot, client inject ids, `@deepseek-ai/schemastery ^3.18.0`) was verified unchanged against the 0.1.7-rc.2 npm package. A `settings.plugin.item` string found in client.js comments was confirmed to be a documentation remark (the actual registration uses `settings.section`, which remains healthy in 0.1.7); no code migration is required.
|
|
29
31
|
- Creating a mindmap re-checks its target against the filesystem immediately before the write (036 follow-up, P1). The path was validated when the confirmation was drawn, but the plan was then trusted as-is: renaming the target directory and replacing it with a symlink pointing outside the session working directory while the user was reading the confirmation made `mindmap_create` write the file outside the workspace. Every candidate — inbox or explicit directory — is now re-resolved through the same inside-the-cwd check right before its atomic `wx` create; a path that no longer resolves inside the session cwd aborts the create (no outside file, no session grant), and the user is asked to start it again. The path confirmed and the path written stay the same one.
|
package/index.js
CHANGED
|
@@ -88,9 +88,8 @@ function parseLegacyMindmapSection(raw) {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
|
-
* 判断当前 settings value
|
|
92
|
-
*
|
|
93
|
-
* 和 entryConfig 的默认值一致。
|
|
91
|
+
* 判断当前 settings value 是否全为默认值。迁移还要检查 descriptor.user,
|
|
92
|
+
* 否则用户明确保存了默认值后,每次启动都会被旧文件覆盖。
|
|
94
93
|
*/
|
|
95
94
|
const CONFIG_DEFAULTS = {
|
|
96
95
|
requireApproval: true,
|
|
@@ -112,6 +111,21 @@ function isAllDefaults(value) {
|
|
|
112
111
|
return true
|
|
113
112
|
}
|
|
114
113
|
|
|
114
|
+
/** 只恢复尚无用户覆盖值的旧设置;修订号防止读取旧文件期间覆盖新的面板写入。 */
|
|
115
|
+
async function migrateLegacyMindmap(settings, imported, isActive = () => true) {
|
|
116
|
+
const descriptor = settings.describe().find((row) => row.ns === SETTINGS_NAMESPACE)
|
|
117
|
+
if (!descriptor || !isAllDefaults(descriptor.value) || Object.keys(descriptor.user ?? {}).length) return
|
|
118
|
+
const raw = await readFile(imported, 'utf8').catch(() => null)
|
|
119
|
+
const legacy = parseLegacyMindmapSection(raw)
|
|
120
|
+
if (!legacy || !isActive()) return
|
|
121
|
+
await settings.update(SETTINGS_NAMESPACE, legacy, descriptor.revision)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** 0.1.7+ 的 Config 字段可能是随设置变更而更新的 volatile 引用。 */
|
|
125
|
+
function configValue(value) {
|
|
126
|
+
return value !== null && typeof value === 'object' && typeof value.get === 'function' ? value.get() : value
|
|
127
|
+
}
|
|
128
|
+
|
|
115
129
|
export const Config = Schema.object({
|
|
116
130
|
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 always require approval.').extra('volatile', true),
|
|
117
131
|
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. High-risk writes always require approval.').extra('volatile', true),
|
|
@@ -636,45 +650,51 @@ function defineTool(spec) {
|
|
|
636
650
|
}
|
|
637
651
|
|
|
638
652
|
export function apply(ctx, config = {}) {
|
|
639
|
-
//
|
|
640
|
-
//
|
|
641
|
-
const entryConfig = {
|
|
642
|
-
requireApproval
|
|
643
|
-
approvalMode
|
|
644
|
-
|
|
645
|
-
lineStyle
|
|
646
|
-
cardStyle
|
|
647
|
-
|
|
648
|
-
|
|
653
|
+
// 新宿主从平铺导出的 Config 发现 schema,entry 的 config 由宿主提供;
|
|
654
|
+
// 未取得设置描述符时,回退到入口配置(兼容旧宿主和 volatile 引用)。
|
|
655
|
+
const entryConfig = () => {
|
|
656
|
+
const requireApproval = configValue(config.requireApproval) !== false
|
|
657
|
+
const approvalMode = configValue(config.approvalMode)
|
|
658
|
+
const defaultPanelWidth = configValue(config.defaultPanelWidth)
|
|
659
|
+
const lineStyle = configValue(config.lineStyle)
|
|
660
|
+
const cardStyle = configValue(config.cardStyle)
|
|
661
|
+
const colorTheme = configValue(config.colorTheme)
|
|
662
|
+
return {
|
|
663
|
+
requireApproval,
|
|
664
|
+
approvalMode: normalizeApprovalMode(approvalMode, requireApproval),
|
|
665
|
+
defaultPanelWidth: typeof defaultPanelWidth === 'number' ? defaultPanelWidth : 42,
|
|
666
|
+
lineStyle: lineStyle === 'curve' ? 'curve' : 'elbow',
|
|
667
|
+
cardStyle: cardStyle === 'square' ? 'square' : 'rounded',
|
|
668
|
+
colorTheme: colorTheme === 'sunset' || colorTheme === 'forest' ? colorTheme : 'ocean',
|
|
669
|
+
growthAnimation: configValue(config.growthAnimation) !== false,
|
|
670
|
+
}
|
|
649
671
|
}
|
|
650
672
|
|
|
651
|
-
|
|
652
|
-
// (schema 默认 → 组合层 base → 用户设置层),否则回退入口配置
|
|
653
|
-
// (dsh-grafana 同款模式;link 环境缺 schemastery 时见 003 偏差 1 的
|
|
654
|
-
// 依赖说明——发布包正常安装依赖)。
|
|
655
|
-
let activeConfig = () => entryConfig
|
|
673
|
+
let activeConfig = entryConfig
|
|
656
674
|
ctx.inject(['settings'], (sctx) => {
|
|
657
|
-
const
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
675
|
+
const settings = sctx.settings
|
|
676
|
+
let active = true
|
|
677
|
+
if (typeof settings.register === 'function') {
|
|
678
|
+
// 0.1.5 等旧宿主仍由插件注册 namespace。
|
|
679
|
+
const scope = settings.register(SETTINGS_NAMESPACE, Config, { base: entryConfig() })
|
|
680
|
+
activeConfig = () => scope.get()
|
|
681
|
+
} else {
|
|
682
|
+
// 0.1.7+ 只有 describe/update 服务面;描述符的 value 是已解析的实时值。
|
|
683
|
+
activeConfig = () => ({
|
|
684
|
+
...entryConfig(),
|
|
685
|
+
...settings.describe().find((row) => row.ns === SETTINGS_NAMESPACE)?.value,
|
|
686
|
+
})
|
|
687
|
+
// .imported 是宿主改名后的旧文件:只在新存储无用户覆盖时恢复,
|
|
688
|
+
// 不删除旧文件,失败也不妨碍工具和设置面板继续工作。
|
|
689
|
+
void (async () => {
|
|
690
|
+
// describe 只包含 state=2 的插件;等 loader 完成加载后再尝试迁移。
|
|
691
|
+
await sctx.root?.loader?.await?.()
|
|
692
|
+
if (active) await migrateLegacyMindmap(settings, join(homedir(), '.dsh', 'settings.yaml.imported'), () => active)
|
|
693
|
+
})().catch(() => {})
|
|
694
|
+
}
|
|
676
695
|
sctx.effect(() => () => {
|
|
677
|
-
|
|
696
|
+
active = false
|
|
697
|
+
activeConfig = entryConfig
|
|
678
698
|
})
|
|
679
699
|
})
|
|
680
700
|
|
|
@@ -1055,4 +1075,5 @@ export const internals = Object.freeze({
|
|
|
1055
1075
|
parseLegacyMindmapSection,
|
|
1056
1076
|
isAllDefaults,
|
|
1057
1077
|
CONFIG_DEFAULTS,
|
|
1078
|
+
migrateLegacyMindmap,
|
|
1058
1079
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mindmap",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
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",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@deepseek-ai/schemastery": "^3.18.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@deepseek-ai/dsh-tools": "^0.1.0-rc.6 || ^0.1.1-rc.0 || ^0.1.2-alpha.0 || ^0.1.3-alpha.0 || ^0.1.5-alpha.0 || ^0.1.7-alpha.0",
|
|
39
|
+
"@deepseek-ai/dsh-tools": "^0.1.0-rc.6 || ^0.1.1-rc.0 || ^0.1.2-alpha.0 || ^0.1.3-alpha.0 || ^0.1.5-alpha.0 || ^0.1.7-alpha.0 || ^0.2.0-alpha.0",
|
|
40
40
|
"dsh-better-sidebar": ">=0.10.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependenciesMeta": {
|