dsh-cabinet-mode 0.6.0 → 0.6.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/CHANGELOG.md +8 -0
- package/README.md +8 -4
- package/README.zh.md +8 -4
- package/client.js +121 -49
- package/package.json +1 -1
- package/scripts/test-client.mjs +134 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.6.1] - 2026-11-08
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Add an optional host-local source for first-time Respire installation; dependencies can still require network access. Local-source updates are explicitly refused by the card.
|
|
10
|
+
- Use the current input even when browser storage fails; allow registry fallback only for pre-install inspection failure, never after installation or enablement.
|
|
11
|
+
- Exercise actual install calls and storage-denied, existing-install and enable-failure regressions.
|
|
12
|
+
|
|
5
13
|
## [0.6.0] - 2026-11-08
|
|
6
14
|
|
|
7
15
|
### Added
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Cabinet Mode (内阁模式) for DeepSeek Harness
|
|
2
2
|
|
|
3
|
-
**Version compatibility (0.6.
|
|
3
|
+
**Version compatibility (0.6.1):** Targets DSH **0.2.2-rc.1**. This release adds five settings tabs and an optional Respire install card, and retains the per-office model selection fix before the host freezes each step; 0.5.1/0.5.2 only repaired preset loading and display metadata. Verified with official host components and isolated profiles, without real model calls; see the model regression scope below. Earlier rc.3/rc.5 UI and installation results are historical evidence for earlier packages. On DSH 0.2.1-rc.3/rc.5 retain the previously verified package, including 0.5.0: the current preset omits the separate list_agents entry required on rc.5. Select the compatible version in the market.
|
|
4
4
|
|
|
5
5
|
[中文](README.zh.md) | English
|
|
6
6
|
|
|
@@ -37,7 +37,7 @@ and the rest) come from the profile-level
|
|
|
37
37
|
ship them**.
|
|
38
38
|
|
|
39
39
|
This bundle declares **no hard DSH version gate**: no `engines.dsh`, no DSH
|
|
40
|
-
`peerDependencies`, no install-time version check. Earlier package releases were tested on DSH **0.2.1-rc.3**; use the compatibility guidance above for 0.6.
|
|
40
|
+
`peerDependencies`, no install-time version check. Earlier package releases were tested on DSH **0.2.1-rc.3**; use the compatibility guidance above for 0.6.1 (see [DSH-side constraints](#dsh-side-constraints)).
|
|
41
41
|
|
|
42
42
|
## Optional memory plugin
|
|
43
43
|
|
|
@@ -262,7 +262,7 @@ On failure, show the exact error. For $.format must be 1, replace the webpage so
|
|
|
262
262
|
Use this only when the market is unavailable or for local development. Fully quit desktop DSH first to release the profile lock, then install the release bundle:
|
|
263
263
|
|
|
264
264
|
```sh
|
|
265
|
-
dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.6.
|
|
265
|
+
dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.6.1/dsh-cabinet-mode-0.6.1.tgz
|
|
266
266
|
dsh plugin --profile desktop list
|
|
267
267
|
```
|
|
268
268
|
|
|
@@ -277,7 +277,7 @@ the same install command with the new version URL (or pick the new `.tgz` in the
|
|
|
277
277
|
plugin page), then fully quit and restart DeepSeek Harness:
|
|
278
278
|
|
|
279
279
|
```sh
|
|
280
|
-
dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.6.
|
|
280
|
+
dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.6.1/dsh-cabinet-mode-0.6.1.tgz
|
|
281
281
|
```
|
|
282
282
|
|
|
283
283
|
`dsh plugin --profile desktop list` should report the new version. Upgrades were
|
|
@@ -566,3 +566,7 @@ and the Windows-tested vs Linux/macOS-inferred split. Sections:
|
|
|
566
566
|
## License
|
|
567
567
|
|
|
568
568
|
[MIT](LICENSE)
|
|
569
|
+
|
|
570
|
+
### Optional Respire local source
|
|
571
|
+
|
|
572
|
+
The memory-plugin card accepts a path on the DSH host for **first installation only**. Dependencies may still need network access; this is not a guaranteed offline installer. Installed bundles reject local-source updates: clear the field for the pinned registry action, or manage local packages through the native plugin manager. Browser storage is best-effort; the current field value is used even when persistence fails. Only inspection failure before installation may fall back once to the registry. Installation, enablement, unknown outcomes, and unmount never trigger a second automatic mutation.
|
package/README.zh.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 内阁模式(Cabinet Mode)· DeepSeek Harness 插件
|
|
2
2
|
|
|
3
|
-
**版本兼容(0.6.
|
|
3
|
+
**版本兼容(0.6.1):** 面向 DSH **0.2.2-rc.1**,修正依赖连线方向,支持点击任务名和成员卡打开会话,并保留在宿主固定每步模型前完成官职模型选择的修复;0.5.1/0.5.2 仅修复了预设加载和显示元数据。已使用官方宿主组件与隔离 profile 验证,未调用真实模型;测试范围见下文。旧 rc.3/rc.5 的界面及安装记录仅适用于当时的包。DSH 0.2.1-rc.3/rc.5 用户应保留原先已验证版本(包括 0.5.0),当前预设已移除 rc.5 所需的独立 list_agents 入口;请在商店选择匹配版本。
|
|
4
4
|
|
|
5
5
|
[English](README.md) | 中文
|
|
6
6
|
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
它声明**两行**——`preset-cabinet`(一条 `@deepseek-ai/dsh-agent-preset` 声明)与 `cabinet-ui`(载入本包 JavaScript 的 Loader 行)——并复用 DSH **标准模式**(Standard Mode)出厂的 22 行插件清单,因此工具与标准模式一致;与出厂模式的差异是 persona,并另加右栏「内阁」面板。团队工具(`spawn_teammate`、`team_task_*` 等)由 profile 层的 `@deepseek-ai/dsh-experimental-agent-team-profile` 提供,**本 preset 未内置**。
|
|
23
23
|
|
|
24
|
-
本包声明 **无 DSH 版本硬限制**:没有 `engines.dsh`、没有 DSH `peerDependencies`、安装时不做版本检查。旧包曾在 DSH **0.2.1-rc.3** 实测;0.6.
|
|
24
|
+
本包声明 **无 DSH 版本硬限制**:没有 `engines.dsh`、没有 DSH `peerDependencies`、安装时不做版本检查。旧包曾在 DSH **0.2.1-rc.3** 实测;0.6.1 请遵循上方版本兼容说明(见 [DSH 侧限制与说明](#dsh-侧限制与说明))。
|
|
25
25
|
|
|
26
26
|
## 可选记忆插件
|
|
27
27
|
|
|
@@ -193,7 +193,7 @@ https://raw.githubusercontent.com/luodaoyi/dsh-cabinet-mode/market-index/marketp
|
|
|
193
193
|
仅在商店不可用或本地开发时使用。先完全退出桌面 DSH,释放 profile 锁,再执行:
|
|
194
194
|
|
|
195
195
|
```sh
|
|
196
|
-
dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.6.
|
|
196
|
+
dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.6.1/dsh-cabinet-mode-0.6.1.tgz
|
|
197
197
|
dsh plugin --profile desktop list
|
|
198
198
|
```
|
|
199
199
|
|
|
@@ -204,7 +204,7 @@ dsh plugin --profile desktop list
|
|
|
204
204
|
若通过插件市场安装:刷新市场,先在**已安装**页卸载旧版本,再从**插件市场**安装新版本,然后重启——没有 tgz URL 要换,也没有一键更新。否则用同一条安装命令换新版本 URL(或在插件页选新 `.tgz`),然后完全退出并重启 DeepSeek Harness:
|
|
205
205
|
|
|
206
206
|
```sh
|
|
207
|
-
dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.6.
|
|
207
|
+
dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.6.1/dsh-cabinet-mode-0.6.1.tgz
|
|
208
208
|
```
|
|
209
209
|
|
|
210
210
|
`dsh plugin --profile desktop list` 应显示新版本。升级已在 Windows 实测:
|
|
@@ -383,3 +383,7 @@ npmjs.com 侧的一次性配置(维护者在网页上完成,无法从本仓
|
|
|
383
383
|
## 许可证
|
|
384
384
|
|
|
385
385
|
[MIT](LICENSE)
|
|
386
|
+
|
|
387
|
+
### 可选的 Respire 本地源
|
|
388
|
+
|
|
389
|
+
记忆插件卡可填写 DSH 宿主上的路径,**仅用于首次安装**。依赖可能仍需网络,不保证完全离线。已安装插件拒绝本地源更新:清空输入后使用固定 registry 版本操作,或通过原生插件管理器管理本地包。浏览器存储仅尽力保存;保存失败仍使用当前输入值。只有安装前检查源失败才可能向 registry 回退一次;安装、启用、未知结果或卸载之后不自动执行第二次修改。
|
package/client.js
CHANGED
|
@@ -3888,6 +3888,11 @@ window.__ModuleLoader__.load({
|
|
|
3888
3888
|
const MEMORY_PLUGIN_NAME = '@rsrsai/dsh';
|
|
3889
3889
|
/** Public pinned package; inspect and install use the same spec. */
|
|
3890
3890
|
const MEMORY_PLUGIN_SPEC = '@rsrsai/dsh@0.1.13';
|
|
3891
|
+
/** Browser key holding the optional local-source override (empty = none).
|
|
3892
|
+
* Machines whose registry is unreachable store a path in the card's
|
|
3893
|
+
* local-source box; no machine path may be hardcoded here, and every
|
|
3894
|
+
* failure echoes the spec(s) it actually tried. */
|
|
3895
|
+
const MEMORY_PLUGIN_SPEC_STORAGE_KEY = 'cabinet.memoryPluginSpec';
|
|
3891
3896
|
const MEMORY_PLUGIN_SOURCE_VERSION = '';
|
|
3892
3897
|
const memoryPluginJobs = new WeakMap();
|
|
3893
3898
|
const memoryPluginRestart = new WeakSet();
|
|
@@ -3903,6 +3908,24 @@ window.__ModuleLoader__.load({
|
|
|
3903
3908
|
const hit = bundles.find((entry) => entry && entry.name === MEMORY_PLUGIN_NAME && entry.installed === true);
|
|
3904
3909
|
return hit === undefined ? null : { name: MEMORY_PLUGIN_NAME, version: typeof hit.version === 'string' ? hit.version : '', enabled: hit.enabled === true };
|
|
3905
3910
|
}
|
|
3911
|
+
/** Read/write the optional local-source override. Both are best-effort:
|
|
3912
|
+
* private modes and test harnesses may expose no storage at all, and an
|
|
3913
|
+
* empty value is removed rather than persisted as a junk string. */
|
|
3914
|
+
function memoryPluginSpecRead() {
|
|
3915
|
+
try {
|
|
3916
|
+
const value = globalThis.localStorage?.getItem(MEMORY_PLUGIN_SPEC_STORAGE_KEY);
|
|
3917
|
+
return typeof value === 'string' ? value.trim() : '';
|
|
3918
|
+
} catch { return ''; }
|
|
3919
|
+
}
|
|
3920
|
+
function memoryPluginSpecWrite(value) {
|
|
3921
|
+
try {
|
|
3922
|
+
const store = globalThis.localStorage;
|
|
3923
|
+
if (!store) return;
|
|
3924
|
+
const text = typeof value === 'string' ? value.trim() : '';
|
|
3925
|
+
if (text === '') store.removeItem(MEMORY_PLUGIN_SPEC_STORAGE_KEY);
|
|
3926
|
+
else store.setItem(MEMORY_PLUGIN_SPEC_STORAGE_KEY, text);
|
|
3927
|
+
} catch { /* no storage available: the override simply does not persist */ }
|
|
3928
|
+
}
|
|
3906
3929
|
function MemoryPluginCard(props) {
|
|
3907
3930
|
const [, refreshChannel] = React.useState(0);
|
|
3908
3931
|
React.useEffect(() => { const listener = () => refreshChannel(n => n + 1); memoryPluginListeners.add(listener); return () => memoryPluginListeners.delete(listener); }, []);
|
|
@@ -3922,11 +3945,15 @@ window.__ModuleLoader__.load({
|
|
|
3922
3945
|
const [progress, writeProgress] = React.useState('');
|
|
3923
3946
|
const [failure, writeFailure] = React.useState('');
|
|
3924
3947
|
const [restart, writeRestart] = React.useState(manager ? memoryPluginRestart.has(manager) : false);
|
|
3948
|
+
// Optional local-source override, read eagerly so the card face shows
|
|
3949
|
+
// the stored value on first paint.
|
|
3950
|
+
const [specText, writeSpecText] = React.useState(memoryPluginSpecRead());
|
|
3925
3951
|
const setInstalled = value => { if (token.active) writeInstalled(value); };
|
|
3926
3952
|
const setWorking = value => { if (token.active) writeWorking(value); };
|
|
3927
3953
|
const setProgress = value => { if (token.active) writeProgress(value); };
|
|
3928
3954
|
const setFailure = value => { if (token.active) writeFailure(value); };
|
|
3929
3955
|
const setRestart = value => { if (token.active) writeRestart(value); };
|
|
3956
|
+
const setSpecText = value => { if (token.active) writeSpecText(value); };
|
|
3930
3957
|
React.useEffect(() => {
|
|
3931
3958
|
let alive = true;
|
|
3932
3959
|
const generation = token.epoch;
|
|
@@ -3942,7 +3969,6 @@ window.__ModuleLoader__.load({
|
|
|
3942
3969
|
}, [manager]);
|
|
3943
3970
|
// Failures are echoed verbatim: the raw message is the evidence.
|
|
3944
3971
|
const fail = (text) => { setWorking(false); setFailure(typeof text === 'string' && text !== '' ? text : String(text)); };
|
|
3945
|
-
|
|
3946
3972
|
const run = async () => {
|
|
3947
3973
|
if (!manager || typeof manager.inspect !== 'function' || typeof manager.installBundle !== 'function' || typeof manager.listBundles !== 'function') { fail('pluginManager remote unavailable'); return; }
|
|
3948
3974
|
if (memoryPluginJobs.get(manager)?.running) return;
|
|
@@ -3966,51 +3992,86 @@ window.__ModuleLoader__.load({
|
|
|
3966
3992
|
if (outcome.application === 'restart-required') { memoryPluginRestart.add(manager); setRestart(true); }
|
|
3967
3993
|
return outcome;
|
|
3968
3994
|
};
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
const
|
|
3977
|
-
if (
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
const
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
const
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
+
/** One attempt against a concrete spec: the upstream 0.6.0 body
|
|
3996
|
+
* (inventory gate, pinned inspect, update/install, enable,
|
|
3997
|
+
* inventory confirm) verbatim, but it resolves {done}/{error}
|
|
3998
|
+
* instead of echoing so run() can annotate and fall back. */
|
|
3999
|
+
const attemptSpec = async (spec) => {
|
|
4000
|
+
let canFallback = false;
|
|
4001
|
+
try {
|
|
4002
|
+
const before = memoryPluginInstalledOf(valueOf(await pluginDeadline(manager.listBundles())));
|
|
4003
|
+
if (before && spec !== MEMORY_PLUGIN_SPEC) throw new Error('Local sources support first installation only. Clear the path for a registry update, or use the native plugin manager. No package was changed.');
|
|
4004
|
+
if (before && before.version !== '0.1.13') {
|
|
4005
|
+
// Only known, older stable versions are offered this pinned update.
|
|
4006
|
+
// The official host independently enforces semver.gt(target, installed).
|
|
4007
|
+
const parts = /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/.exec(before.version);
|
|
4008
|
+
const values = parts?.slice(1).map(Number);
|
|
4009
|
+
const older = values && values.every(Number.isSafeInteger) && values[0] === 0 && (values[1] === 0 || values[1] === 1 && values[2] < 13);
|
|
4010
|
+
if (!older) throw new Error('Installed version is newer than the pinned version or cannot be safely compared. Use the native plugin manager; no package was changed.');
|
|
4011
|
+
}
|
|
4012
|
+
const inspectionReply = await pluginDeadline(manager.inspect(spec, {}));
|
|
4013
|
+
canFallback = !before;
|
|
4014
|
+
const inspected = valueOf(inspectionReply);
|
|
4015
|
+
if (!inspected || inspected.status !== 'accepted' || inspected.name !== MEMORY_PLUGIN_NAME || inspected.bundle !== true) throw new Error(inspected?.reason || 'Plugin spec refused');
|
|
4016
|
+
canFallback = false;
|
|
4017
|
+
const requestId = globalThis.crypto?.randomUUID?.() || 'cabinet-' + Date.now() + '-' + Math.random().toString(16).slice(2);
|
|
4018
|
+
let outcome;
|
|
4019
|
+
if (before && before.version === '0.1.13') {
|
|
4020
|
+
outcome = { application: 'applied' };
|
|
4021
|
+
} else {
|
|
4022
|
+
if (before && typeof manager.updateBundle !== 'function') throw new Error('Use the native plugin manager to update this installed bundle');
|
|
4023
|
+
uncertain = true;
|
|
4024
|
+
const operation = before ? manager.updateBundle(MEMORY_PLUGIN_NAME, '0.1.13', {requestId}) : manager.installBundle(spec, {enabled:false,requestId});
|
|
4025
|
+
let reply = await pluginDeadline(observe(operation, !!before));
|
|
4026
|
+
if (reply?.ok !== true && !before && typeof manager.waitForInstall === 'function') reply = await pluginDeadline(observe(manager.waitForInstall(requestId)));
|
|
4027
|
+
const result = valueOf(reply);
|
|
4028
|
+
if (!result) throw new Error('Install outcome is unknown; check the native plugin manager before retrying');
|
|
4029
|
+
outcome = before ? result.result : result;
|
|
4030
|
+
if (!outcome || !['applied','restart-required','failed','cancelled'].includes(outcome.application)) throw new Error('Install outcome is unknown');
|
|
4031
|
+
uncertain = false;
|
|
4032
|
+
outcomeOf(outcome);
|
|
4033
|
+
}
|
|
4034
|
+
// Installation and enabling are separate operations; neither implies the other succeeded.
|
|
4035
|
+
setInstalled({name:MEMORY_PLUGIN_NAME,version:outcome.version || before?.version || '',enabled:false});
|
|
4036
|
+
if (!token.active) return { done: true };
|
|
4037
|
+
if (typeof manager.setBundleEnabled !== 'function') throw new Error('Installed, but enable is unavailable; enable it in the native plugin manager');
|
|
4038
|
+
uncertain = true; job.settled = false;
|
|
4039
|
+
const enabled = valueOf(await pluginDeadline(observe(manager.setBundleEnabled(MEMORY_PLUGIN_NAME,true))));
|
|
4040
|
+
if (!enabled || !['applied','restart-required','failed','cancelled'].includes(enabled.application)) throw new Error('Enable outcome is unknown');
|
|
3995
4041
|
uncertain = false;
|
|
3996
|
-
outcomeOf(
|
|
4042
|
+
outcomeOf(enabled);
|
|
4043
|
+
const found = memoryPluginInstalledOf(valueOf(await pluginDeadline(manager.listBundles())));
|
|
4044
|
+
if (!found) throw new Error('Installation cannot be confirmed from the plugin inventory');
|
|
4045
|
+
setInstalled(found);
|
|
4046
|
+
if (!found.enabled) throw new Error('Installed, but the plugin inventory reports disabled');
|
|
4047
|
+
setFailure('');
|
|
4048
|
+
return { done: true };
|
|
4049
|
+
} catch (error) {
|
|
4050
|
+
return { error: error?.message || String(error), canFallback };
|
|
3997
4051
|
}
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
const
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4052
|
+
};
|
|
4053
|
+
const specNote = (specs) => ' [spec' + (specs.length > 1 ? 's' : '') + ': ' + specs.join(' → ') + ']';
|
|
4054
|
+
try {
|
|
4055
|
+
// spec = stored local-source override, else the registry default.
|
|
4056
|
+
const overrideSpec = specText.trim();
|
|
4057
|
+
const primarySpec = overrideSpec !== '' ? overrideSpec : MEMORY_PLUGIN_SPEC;
|
|
4058
|
+
let first;
|
|
4059
|
+
try { first = await attemptSpec(primarySpec); } catch (error) { first = { error: error?.message || String(error) }; }
|
|
4060
|
+
if (first.done !== true) {
|
|
4061
|
+
// A definitive failure of the local source falls back to the
|
|
4062
|
+
// registry once; an uncertain outcome keeps the upstream
|
|
4063
|
+
// no-second-operation guard (its job stays registered).
|
|
4064
|
+
if (primarySpec !== MEMORY_PLUGIN_SPEC && first.canFallback === true && uncertain !== true && token.active) {
|
|
4065
|
+
let second;
|
|
4066
|
+
try { second = await attemptSpec(MEMORY_PLUGIN_SPEC); } catch (error) { second = { error: error?.message || String(error) }; }
|
|
4067
|
+
if (second.done !== true) fail(first.error + specNote([primarySpec, MEMORY_PLUGIN_SPEC]) + (second.error && second.error !== first.error ? ' · ' + second.error : ''));
|
|
4068
|
+
} else {
|
|
4069
|
+
fail(first.error + specNote([primarySpec]));
|
|
4070
|
+
}
|
|
4071
|
+
}
|
|
4072
|
+
} catch (error) {
|
|
4073
|
+
fail(error !== null && error !== undefined && typeof error.message === 'string' ? error.message : String(error));
|
|
4074
|
+
} finally {
|
|
4014
4075
|
job.running = false;
|
|
4015
4076
|
if (!uncertain && memoryPluginJobs.get(manager) === job) memoryPluginJobs.delete(manager);
|
|
4016
4077
|
setWorking(false);
|
|
@@ -4027,10 +4088,15 @@ window.__ModuleLoader__.load({
|
|
|
4027
4088
|
h('span', { key: 'gap', style: { flex: 1 } }),
|
|
4028
4089
|
installed !== null ? h('span', { key: 'badge', 'data-cabinet-plugin-state': 'installed', style: { fontSize: 11, color: '#3fb950' } }, t('settings.plugin.installed')) : null
|
|
4029
4090
|
]),
|
|
4030
|
-
// Highlight lines replace the old one-line description;
|
|
4031
|
-
//
|
|
4032
|
-
//
|
|
4091
|
+
// Highlight lines replace the old one-line description; install
|
|
4092
|
+
// specs stay off the card face — the local-source box below is
|
|
4093
|
+
// where a path belongs, and only when the user opts in.
|
|
4033
4094
|
h('div', { key: 'hints', style: line }, [1, 2, 3, 4, 5].map((n) => h('div', { key: 'hint' + n, 'data-cabinet-plugin-hint': String(n), style: { ...line, marginTop: 3 } }, t('settings.plugin.hint' + n)))),
|
|
4095
|
+
h('div', { key: 'specRow', style: { ...line, marginTop: 8, display: 'flex', gap: 6, alignItems: 'center', flexWrap: 'wrap' } }, [
|
|
4096
|
+
h('label', { key: 'specLabel', style: { fontSize: 11, color: INK2 } }, t('settings.plugin.specLabel')),
|
|
4097
|
+
h('input', { key: 'specInput', 'data-cabinet-plugin-spec-input': '1', type: 'text', value: specText, placeholder: t('settings.plugin.specPlaceholder'), style: { flex: 1, minWidth: 160, fontSize: 11 }, onChange: (event) => { const next = event !== null && event !== undefined && typeof event.target?.value === 'string' ? event.target.value : ''; setSpecText(next); memoryPluginSpecWrite(next); } }),
|
|
4098
|
+
h('button', { key: 'specClear', 'data-cabinet-plugin-spec-clear': '1', type: 'button', disabled: specText === '', style: { fontSize: 11, cursor: 'pointer' }, onClick: () => { setSpecText(''); memoryPluginSpecWrite(''); } }, t('settings.plugin.specClear'))
|
|
4099
|
+
]),
|
|
4034
4100
|
installed !== null
|
|
4035
4101
|
? h('div', { key: 'where', style: { display: 'flex', gap: 8, alignItems: 'center', flexWrap: 'wrap', marginTop: 8 } }, [
|
|
4036
4102
|
h('span', { key: 'version', 'data-cabinet-plugin-version': shownVersion, style: { fontSize: 11, color: INK2 } }, shownVersion + (hasInstalledVersion ? '' : ' · ' + t('settings.plugin.versionFallback'))),
|
|
@@ -4051,8 +4117,8 @@ window.__ModuleLoader__.load({
|
|
|
4051
4117
|
const t = typeof props?.t === 'function' ? props.t : memberT;
|
|
4052
4118
|
const [, redraw] = React.useState(0);
|
|
4053
4119
|
// Active settings tab: session-local state (approved plan A). It is a
|
|
4054
|
-
// navigation preference, not user data
|
|
4055
|
-
//
|
|
4120
|
+
// navigation preference, not user data; the only persisted settings
|
|
4121
|
+
// value is the plugin card's local-source override.
|
|
4056
4122
|
const [activeTab, setActiveTab] = React.useState('members');
|
|
4057
4123
|
const editorRef = React.useRef(null);
|
|
4058
4124
|
if (!editorRef.current) editorRef.current = createMemberEditor(memberWriter, () => redraw(n => n + 1));
|
|
@@ -4298,6 +4364,9 @@ window.__ModuleLoader__.load({
|
|
|
4298
4364
|
'settings.plugin.versionFallback': '已安装版本未知',
|
|
4299
4365
|
'settings.plugin.restartRequired': '已安装,需重启 DSH 生效',
|
|
4300
4366
|
'settings.plugin.unavailable': '安装通道不可用:宿主未提供 remote.pluginManager。可在宿主会话执行 dsh plugin --profile web add <本地路径> 安装。',
|
|
4367
|
+
'settings.plugin.specLabel': '宿主本地源(仅首次安装;依赖可能需要网络)',
|
|
4368
|
+
'settings.plugin.specPlaceholder': '可选:本地源路径;留空则用官方 registry',
|
|
4369
|
+
'settings.plugin.specClear': '清空',
|
|
4301
4370
|
'settings.plugin.hint1': 'respire/dsh:原生 TypeScript 记忆插件,存储、去重与加密由 rsrs 负责',
|
|
4302
4371
|
'settings.plugin.hint2': '自动召回:新会话自动想起早前结论,不用重复交代背景',
|
|
4303
4372
|
'settings.plugin.hint3': '本地优先:记忆存本机,引擎故障只提示、主任务照跑',
|
|
@@ -4380,6 +4449,9 @@ window.__ModuleLoader__.load({
|
|
|
4380
4449
|
'settings.plugin.versionFallback': 'Installed version unavailable',
|
|
4381
4450
|
'settings.plugin.restartRequired': 'Installed; restart DSH to take effect',
|
|
4382
4451
|
'settings.plugin.unavailable': 'Install channel unavailable: the host did not expose remote.pluginManager. Run dsh plugin --profile web add <local path> in a host session instead.',
|
|
4452
|
+
'settings.plugin.specLabel': 'Host-local source (first install only; dependencies may need network)',
|
|
4453
|
+
'settings.plugin.specPlaceholder': 'Optional local source path; empty uses the official registry',
|
|
4454
|
+
'settings.plugin.specClear': 'Clear',
|
|
4383
4455
|
'settings.plugin.hint1': 'respire/dsh: native TypeScript memory plugin; rsrs owns storage, dedup and encryption',
|
|
4384
4456
|
'settings.plugin.hint2': 'Auto-recall: a new session resurfaces earlier conclusions without re-briefing',
|
|
4385
4457
|
'settings.plugin.hint3': 'Local first: memories stay on this machine; an engine outage only notices, work continues',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-cabinet-mode",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Cabinet Mode (内阁模式) for DeepSeek Harness: a declarative DSH bundle that adds a dual-identity Lead/teammate agent preset for the Great Ming Research Bureau cabinet team.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"icon": "./icon.svg",
|
package/scripts/test-client.mjs
CHANGED
|
@@ -6,6 +6,16 @@ let client;
|
|
|
6
6
|
const source = readFileSync(new URL('../client.js', import.meta.url), 'utf8');
|
|
7
7
|
const exportPoint = 'return { inject, apply };';
|
|
8
8
|
assert.equal(source.split(exportPoint).length, 2);
|
|
9
|
+
// PR#22 coderabbit Major: client.js must not hardcode a machine home path.
|
|
10
|
+
assert.ok(!source.includes('/home/fslong'), 'client.js source carries no hardcoded home path');
|
|
11
|
+
// The card persists its optional local-source override in localStorage; both
|
|
12
|
+
// VM realms below get a minimal store so the save/clear paths are observable.
|
|
13
|
+
const pluginSpecStore = new Map();
|
|
14
|
+
const pluginSpecStorage = {
|
|
15
|
+
getItem: (key) => (pluginSpecStore.has(key) ? pluginSpecStore.get(key) : null),
|
|
16
|
+
setItem: (key, value) => { pluginSpecStore.set(key, String(value)); },
|
|
17
|
+
removeItem: (key) => { pluginSpecStore.delete(key); },
|
|
18
|
+
};
|
|
9
19
|
const React = {
|
|
10
20
|
useId: () => 'test-mask',
|
|
11
21
|
createElement: (type, props, ...children) => ({ type, props, children }),
|
|
@@ -16,7 +26,7 @@ const React = {
|
|
|
16
26
|
};
|
|
17
27
|
const exportList = 'return { inject, apply, avatarFor, displayName, CabinetPanel, MemberCard, TaskLine, TaskEdgeLayer, buildTaskEdges, taskEdgesEqual, zh, en, BUREAUX, AVATARS, setMemberConfig, memberLabel, configuredAvatar, configuredPrompt, factoryPromptFor, DEFAULT_MEMBER_PROMPTS, DEFAULT_LEAD_PROMPT, CabinetMemberSettings, MemoryPluginCard, memoryPluginInstalledOf, SETTINGS_TABS };';
|
|
18
28
|
runInNewContext(source.replace(exportPoint, exportList), {
|
|
19
|
-
setTimeout: (fn, ms) => setTimeout(fn, ms === 120000 ? 20 : ms), clearTimeout, window: { __ModuleLoader__: { load: ({ factory }) => {
|
|
29
|
+
setTimeout: (fn, ms) => setTimeout(fn, ms === 120000 ? 20 : ms), clearTimeout, localStorage: pluginSpecStorage, window: { __ModuleLoader__: { load: ({ factory }) => {
|
|
20
30
|
client = factory((name) => { assert.equal(name, 'react'); return React; });
|
|
21
31
|
} } },
|
|
22
32
|
});
|
|
@@ -408,7 +418,7 @@ const SettingsReact = {
|
|
|
408
418
|
},
|
|
409
419
|
};
|
|
410
420
|
runInNewContext(source.replace(exportPoint, exportList), {
|
|
411
|
-
setTimeout: (fn, ms) => setTimeout(fn, ms === 120000 ? 20 : ms), clearTimeout, window: { __ModuleLoader__: { load: ({ factory }) => { settingsClient = factory((name) => { assert.equal(name, 'react'); return SettingsReact; }); } } },
|
|
421
|
+
setTimeout: (fn, ms) => setTimeout(fn, ms === 120000 ? 20 : ms), clearTimeout, localStorage: pluginSpecStorage, window: { __ModuleLoader__: { load: ({ factory }) => { settingsClient = factory((name) => { assert.equal(name, 'react'); return SettingsReact; }); } } },
|
|
412
422
|
});
|
|
413
423
|
const mountSettings = (props) => {
|
|
414
424
|
settingsState.length = 0;
|
|
@@ -528,6 +538,123 @@ cardNodes = elements(settingsClient.MemoryPluginCard({ t: (key) => key, manager:
|
|
|
528
538
|
const updateError = cardNodes.find((node) => node.props?.['data-cabinet-plugin-state'] === 'error');
|
|
529
539
|
assert.ok(updateError && String(updateError.children.flat().join('')).includes('boom: registry unreachable'), 'the update button reuses the install chain and echoes its failure verbatim');
|
|
530
540
|
|
|
541
|
+
// PR#22 coderabbit Major follow-up: no hardcoded machine path — the card reads
|
|
542
|
+
// its optional local-source override from localStorage (cabinet.memoryPluginSpec),
|
|
543
|
+
// tries it before the registry default, falls back once, and notes the specs.
|
|
544
|
+
pluginSpecStore.clear();
|
|
545
|
+
settingsState.length = 0; settingsCursor = 0;
|
|
546
|
+
let specCard = elements(settingsClient.MemoryPluginCard({ t: (key) => key, manager: failingManager }));
|
|
547
|
+
const specInput = specCard.find((node) => node.props?.['data-cabinet-plugin-spec-input']);
|
|
548
|
+
assert.ok(specInput, 'the card renders the optional local-source input');
|
|
549
|
+
assert.equal(specInput.props.value, '', 'the input starts empty with no stored override');
|
|
550
|
+
specInput.props.onChange({ target: { value: '/tmp/local-source' } });
|
|
551
|
+
assert.equal(pluginSpecStore.get('cabinet.memoryPluginSpec'), '/tmp/local-source', 'typing saves the override to localStorage');
|
|
552
|
+
settingsState.length = 0; settingsCursor = 0;
|
|
553
|
+
specCard = elements(settingsClient.MemoryPluginCard({ t: (key) => key, manager: failingManager }));
|
|
554
|
+
assert.equal(specCard.find((node) => node.props?.['data-cabinet-plugin-spec-input']).props.value, '/tmp/local-source', 'a stored override is shown on the card');
|
|
555
|
+
const specClear = specCard.find((node) => node.props?.['data-cabinet-plugin-spec-clear']);
|
|
556
|
+
assert.ok(specClear && specClear.props.disabled === false, 'the clear button is offered once a value is stored');
|
|
557
|
+
specClear.props.onClick();
|
|
558
|
+
assert.equal(pluginSpecStore.has('cabinet.memoryPluginSpec'), false, 'clearing removes the key instead of persisting an empty string');
|
|
559
|
+
|
|
560
|
+
// Spec selection: no override goes straight to the registry default; a stored
|
|
561
|
+
// override is tried first and the registry default is the single fallback.
|
|
562
|
+
const specCalls = [];
|
|
563
|
+
const specRefusingManager = {
|
|
564
|
+
inspect: async (spec) => { specCalls.push(spec); return { ok: false, error: { message: 'refused: ' + spec } }; },
|
|
565
|
+
installBundle: async (spec) => { specCalls.push(spec); return { ok: false, error: { message: 'unreachable' } }; },
|
|
566
|
+
listBundles: async () => ({ ok: true, value: [] }),
|
|
567
|
+
};
|
|
568
|
+
settingsState.length = 0; settingsCursor = 0;
|
|
569
|
+
specCard = elements(settingsClient.MemoryPluginCard({ t: (key) => key, manager: specRefusingManager }));
|
|
570
|
+
specCard.find((node) => node.props?.['data-cabinet-plugin-action'] === 'install').props.onClick();
|
|
571
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
572
|
+
assert.deepEqual(specCalls.slice(), ['@rsrsai/dsh@0.1.13'], 'without an override the run chain goes straight to the registry default');
|
|
573
|
+
settingsCursor = 0;
|
|
574
|
+
specCard = elements(settingsClient.MemoryPluginCard({ t: (key) => key, manager: specRefusingManager }));
|
|
575
|
+
const defaultError = specCard.find((node) => node.props?.['data-cabinet-plugin-state'] === 'error');
|
|
576
|
+
const defaultErrorText = String(defaultError.children.flat().join(''));
|
|
577
|
+
assert.ok(defaultErrorText.includes('refused: @rsrsai/dsh@0.1.13'), 'the single-spec failure is echoed verbatim');
|
|
578
|
+
assert.ok(defaultErrorText.includes('[spec: @rsrsai/dsh@0.1.13]'), 'the failure notes the spec it tried');
|
|
579
|
+
|
|
580
|
+
pluginSpecStore.set('cabinet.memoryPluginSpec', '/tmp/local-source');
|
|
581
|
+
specCalls.length = 0;
|
|
582
|
+
settingsState.length = 0; settingsCursor = 0;
|
|
583
|
+
specCard = elements(settingsClient.MemoryPluginCard({ t: (key) => key, manager: specRefusingManager }));
|
|
584
|
+
specCard.find((node) => node.props?.['data-cabinet-plugin-action'] === 'install').props.onClick();
|
|
585
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
586
|
+
assert.deepEqual(specCalls.slice(), ['/tmp/local-source', '@rsrsai/dsh@0.1.13'], 'a failing override falls back to the registry default exactly once, in order');
|
|
587
|
+
settingsCursor = 0;
|
|
588
|
+
specCard = elements(settingsClient.MemoryPluginCard({ t: (key) => key, manager: specRefusingManager }));
|
|
589
|
+
const fallbackError = specCard.find((node) => node.props?.['data-cabinet-plugin-state'] === 'error');
|
|
590
|
+
const fallbackErrorText = String(fallbackError.children.flat().join(''));
|
|
591
|
+
assert.ok(fallbackErrorText.includes('refused: /tmp/local-source'), 'the override error is echoed verbatim');
|
|
592
|
+
assert.ok(fallbackErrorText.includes('/tmp/local-source') && fallbackErrorText.includes('@rsrsai/dsh@0.1.13'), 'both tried specs are noted when both attempts fail');
|
|
593
|
+
|
|
594
|
+
// A successful override must not trigger the fallback at all.
|
|
595
|
+
pluginSpecStore.set('cabinet.memoryPluginSpec', '/tmp/ok-source');
|
|
596
|
+
const okSpecCalls = [];
|
|
597
|
+
let localInstalled = false;
|
|
598
|
+
const okSpecManager = {
|
|
599
|
+
inspect: async (spec) => { okSpecCalls.push(spec); return { ok: true, value: { status: 'accepted', name: '@rsrsai/dsh', bundle: true } }; },
|
|
600
|
+
installBundle: async (spec) => { localInstalled = true; okSpecCalls.push(spec); return { ok: true, value: { application: 'applied', bundle: '@rsrsai/dsh', version: '0.1.13' } }; },
|
|
601
|
+
setBundleEnabled: async () => ({ ok: true, value: { application: 'applied' } }),
|
|
602
|
+
listBundles: async () => ({ ok: true, value: localInstalled ? [{ name: '@rsrsai/dsh', installed: true, version: '0.1.13', enabled: true }] : [] }),
|
|
603
|
+
};
|
|
604
|
+
settingsState.length = 0; settingsCursor = 0;
|
|
605
|
+
specCard = elements(settingsClient.MemoryPluginCard({ t: (key) => key, manager: okSpecManager }));
|
|
606
|
+
specCard.find((node) => node.props?.['data-cabinet-plugin-action'] === 'install').props.onClick();
|
|
607
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
608
|
+
assert.equal(okSpecCalls.length, 2, 'inspect and actual install both run');
|
|
609
|
+
assert.ok(localInstalled, 'installation changes inventory');
|
|
610
|
+
assert.ok(okSpecCalls.length > 0 && okSpecCalls.every((spec) => spec === '/tmp/ok-source'), 'a successful override never touches the registry fallback');
|
|
611
|
+
|
|
612
|
+
// A displayed override remains authoritative even when storage rejects writes.
|
|
613
|
+
for (const scenario of ['storage', 'installed', 'enable-failed']) {
|
|
614
|
+
pluginSpecStore.clear(); settingsState.length = 0; settingsCursor = 0;
|
|
615
|
+
let added = false; const calls = [];
|
|
616
|
+
const manager = {
|
|
617
|
+
listBundles: async () => ({ok:true,value: (added || scenario === 'installed') ? [{name:'@rsrsai/dsh',installed:true,version:'0.1.13',enabled:false}] : []}),
|
|
618
|
+
inspect: async spec => { calls.push(['inspect',spec]); return {ok:true,value:{status:'accepted',name:'@rsrsai/dsh',bundle:true}}; },
|
|
619
|
+
installBundle: async spec => { calls.push(['install',spec]); added=true;return {ok:true,value:{application:'applied',version:'0.1.13'}}; },
|
|
620
|
+
setBundleEnabled: async () => { calls.push(['enable']); return {ok:true,value:{application:'failed',error:{message:'enable refused'}}}; }
|
|
621
|
+
};
|
|
622
|
+
let nodes=elements(settingsClient.MemoryPluginCard({manager,t:k=>k}));
|
|
623
|
+
const write=pluginSpecStorage.setItem; pluginSpecStorage.setItem=()=>{throw Error('storage denied')};
|
|
624
|
+
nodes.find(n=>n.props?.['data-cabinet-plugin-spec-input']).props.onChange({target:{value:'/tmp/session-only'}});
|
|
625
|
+
pluginSpecStorage.setItem=write; settingsCursor=0;
|
|
626
|
+
nodes=elements(settingsClient.MemoryPluginCard({manager,t:k=>k}));
|
|
627
|
+
nodes.find(n=>n.props?.['data-cabinet-plugin-action']).props.onClick();
|
|
628
|
+
await new Promise(r=>setTimeout(r,0));
|
|
629
|
+
if(scenario==='installed') assert.deepEqual(calls,[], 'local update refuses before any inspection/mutation');
|
|
630
|
+
else assert.deepEqual(calls,[['inspect','/tmp/session-only'],['install','/tmp/session-only'],['enable']], 'current input survives failed persistence; enable failure never retries');
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
// Pending or rejected inspection promises must never start a fallback mutation.
|
|
634
|
+
for (const outcome of ['late-accepted', 'late-refused', 'rejected']) {
|
|
635
|
+
pluginSpecStore.set('cabinet.memoryPluginSpec', '/tmp/pending-source');
|
|
636
|
+
settingsState.length=0;settingsCursor=0;
|
|
637
|
+
const calls=[];let resolveInspection;
|
|
638
|
+
const manager={
|
|
639
|
+
listBundles:async()=>({ok:true,value:[]}),
|
|
640
|
+
inspect:spec=>{calls.push(['inspect',spec]);return outcome==='rejected'?Promise.reject(Error('transport failed')):new Promise(resolve=>{resolveInspection=resolve});},
|
|
641
|
+
installBundle:async()=>{calls.push(['install']);throw Error('must not install');},
|
|
642
|
+
setBundleEnabled:async()=>{calls.push(['enable']);throw Error('must not enable');}
|
|
643
|
+
};
|
|
644
|
+
let nodes=elements(settingsClient.MemoryPluginCard({manager,t:k=>k}));
|
|
645
|
+
nodes.find(n=>n.props?.['data-cabinet-plugin-action']).props.onClick();
|
|
646
|
+
await new Promise(r=>setTimeout(r,50));
|
|
647
|
+
assert.deepEqual(calls,[['inspect','/tmp/pending-source']],outcome+' causes no registry fallback');
|
|
648
|
+
settingsCursor=0;nodes=elements(settingsClient.MemoryPluginCard({manager,t:k=>k}));
|
|
649
|
+
assert.ok(nodes.some(n=>n.props?.['data-cabinet-plugin-state']==='error'), 'failure is visible');
|
|
650
|
+
resolveInspection?.({ok:true,value:{status:outcome==='late-accepted'?'accepted':'refused',name:'@rsrsai/dsh',bundle:true}});
|
|
651
|
+
await new Promise(r=>setTimeout(r,0));
|
|
652
|
+
assert.deepEqual(calls,[['inspect','/tmp/pending-source']], 'late response cannot resume installation');
|
|
653
|
+
}
|
|
654
|
+
console.log('PASS: inspection timeout, late acceptance/refusal and transport rejection cause no fallback mutation');
|
|
655
|
+
|
|
656
|
+
pluginSpecStore.delete('cabinet.memoryPluginSpec');
|
|
657
|
+
|
|
531
658
|
// Both dictionaries carry the same settings.* keys (nothing may exist in one
|
|
532
659
|
// language only) and every tab id is translatable.
|
|
533
660
|
const zhSettingsKeys = Object.keys(client.zh).filter((key) => key.startsWith('settings.'));
|
|
@@ -545,7 +672,11 @@ for (const n of [1, 2, 3, 4, 5]) {
|
|
|
545
672
|
assert.ok(zhSettingsKeys.includes(key), 'highlight line copy present: ' + key);
|
|
546
673
|
assert.ok(enSettingsKeys.includes(key), 'highlight line copy present in en: ' + key);
|
|
547
674
|
}
|
|
548
|
-
|
|
675
|
+
for (const key of ['settings.plugin.specLabel', 'settings.plugin.specPlaceholder', 'settings.plugin.specClear']) {
|
|
676
|
+
assert.ok(zhSettingsKeys.includes(key), 'local-source copy present: ' + key);
|
|
677
|
+
assert.ok(enSettingsKeys.includes(key), 'local-source copy present in en: ' + key);
|
|
678
|
+
}
|
|
679
|
+
console.log('PASS: five settings tabs switch by section; the plugin card keeps specs off its face, renders highlight lines and the local-source override box, offers update with a visible version, falls back from a failing override to the registry default, and echoes failures verbatim with the tried specs; bilingual settings keys match');
|
|
549
680
|
|
|
550
681
|
// Installation state machine uses the real remote Result envelope.
|
|
551
682
|
for (const scenario of ['success','install-failed','enable-failed','missing-wait','timeout','restart','update','missing-enable','wait-null','wait-failed']) {
|