dsh-cabinet-mode 0.6.0 → 0.6.2
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 +16 -0
- package/README.md +10 -4
- package/README.zh.md +10 -4
- package/client.js +155 -61
- package/package.json +1 -1
- package/scripts/test-client.mjs +190 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.6.2] - 2026-11-08
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Disclose local-source fallback to the registry and show installed provenance from the host inventory, or Unknown when absent.
|
|
10
|
+
- Scope installed source, fallback notices and operation state to their connection; late replies cannot lock or mutate a replacement connection.
|
|
11
|
+
- Retain timeout/no-fallback safeguards and test connection changes during inspection and installation.
|
|
12
|
+
|
|
13
|
+
## [0.6.1] - 2026-11-08
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- 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.
|
|
18
|
+
- Use the current input even when browser storage fails; allow registry fallback only for pre-install inspection failure, never after installation or enablement.
|
|
19
|
+
- Exercise actual install calls and storage-denied, existing-install and enable-failure regressions.
|
|
20
|
+
|
|
5
21
|
## [0.6.0] - 2026-11-08
|
|
6
22
|
|
|
7
23
|
### 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.2):** Targets DSH **0.2.2-rc.1**. This release discloses installation source and isolates state across host connections, 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.2 (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.2/dsh-cabinet-mode-0.6.2.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.2/dsh-cabinet-mode-0.6.2.tgz
|
|
281
281
|
```
|
|
282
282
|
|
|
283
283
|
`dsh plugin --profile desktop list` should report the new version. Upgrades were
|
|
@@ -566,3 +566,9 @@ 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.
|
|
573
|
+
|
|
574
|
+
When local inspection fails and the card falls back, a notice names both attempted sources for the current mounted card and connection (until the next operation). The installed-source line uses the host inventory, not the input field; absent host metadata is shown as unknown.
|
package/README.zh.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 内阁模式(Cabinet Mode)· DeepSeek Harness 插件
|
|
2
2
|
|
|
3
|
-
**版本兼容(0.6.
|
|
3
|
+
**版本兼容(0.6.2):** 面向 DSH **0.2.2-rc.1**,本次修复安装来源展示及连接状态隔离;依赖连线与成员会话入口属于 0.5.4 的更新。保留在宿主固定每步模型前完成官职模型选择的修复;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.2 请遵循上方版本兼容说明(见 [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.2/dsh-cabinet-mode-0.6.2.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.2/dsh-cabinet-mode-0.6.2.tgz
|
|
208
208
|
```
|
|
209
209
|
|
|
210
210
|
`dsh plugin --profile desktop list` 应显示新版本。升级已在 Windows 实测:
|
|
@@ -383,3 +383,9 @@ npmjs.com 侧的一次性配置(维护者在网页上完成,无法从本仓
|
|
|
383
383
|
## 许可证
|
|
384
384
|
|
|
385
385
|
[MIT](LICENSE)
|
|
386
|
+
|
|
387
|
+
### 可选的 Respire 本地源
|
|
388
|
+
|
|
389
|
+
记忆插件卡可填写 DSH 宿主上的路径,**仅用于首次安装**。依赖可能仍需网络,不保证完全离线。已安装插件拒绝本地源更新:清空输入后使用固定 registry 版本操作,或通过原生插件管理器管理本地包。浏览器存储仅尽力保存;保存失败仍使用当前输入值。只有安装前检查源失败才可能向 registry 回退一次;安装、启用、未知结果或卸载之后不自动执行第二次修改。
|
|
390
|
+
|
|
391
|
+
本地检查失败后若改用线上源,卡片在当前挂载及连接内显示两次尝试的来源,直到下次操作;重挂载不保留此提示。已安装来源取自宿主库存,而不是输入框;宿主未提供来源时显示未知。
|
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();
|
|
@@ -3901,7 +3906,25 @@ window.__ModuleLoader__.load({
|
|
|
3901
3906
|
function memoryPluginInstalledOf(bundles) {
|
|
3902
3907
|
if (!Array.isArray(bundles)) return null;
|
|
3903
3908
|
const hit = bundles.find((entry) => entry && entry.name === MEMORY_PLUGIN_NAME && entry.installed === true);
|
|
3904
|
-
return hit === undefined ? null : { name: MEMORY_PLUGIN_NAME, version: typeof hit.version === 'string' ? hit.version : '', enabled: hit.enabled === true };
|
|
3909
|
+
return hit === undefined ? null : { name: MEMORY_PLUGIN_NAME, version: typeof hit.version === 'string' ? hit.version : '', enabled: hit.enabled === true, ...(typeof hit.source === 'string' ? {source:hit.source} : {}) };
|
|
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 */ }
|
|
3905
3928
|
}
|
|
3906
3929
|
function MemoryPluginCard(props) {
|
|
3907
3930
|
const [, refreshChannel] = React.useState(0);
|
|
@@ -3917,19 +3940,34 @@ window.__ModuleLoader__.load({
|
|
|
3917
3940
|
}
|
|
3918
3941
|
const token = lifetime.current;
|
|
3919
3942
|
React.useEffect(() => { token.active = true; return () => { token.active = false; }; }, [token]);
|
|
3920
|
-
const [
|
|
3921
|
-
|
|
3922
|
-
const [
|
|
3923
|
-
|
|
3924
|
-
const [
|
|
3925
|
-
const
|
|
3926
|
-
|
|
3927
|
-
const
|
|
3928
|
-
|
|
3929
|
-
const
|
|
3943
|
+
const [installedRecord, writeInstalled] = React.useState({manager, value:props?.initialInstalled ?? null});
|
|
3944
|
+
const installed = installedRecord.manager === manager ? installedRecord.value : null;
|
|
3945
|
+
const [workingRecord, writeWorking] = React.useState({manager,value:false});
|
|
3946
|
+
const working = workingRecord.manager === manager ? workingRecord.value : (false);
|
|
3947
|
+
const [progressRecord, writeProgress] = React.useState({manager,value:''});
|
|
3948
|
+
const progress = progressRecord.manager === manager ? progressRecord.value : ('');
|
|
3949
|
+
const [failureRecord, writeFailure] = React.useState({manager,value:''});
|
|
3950
|
+
const failure = failureRecord.manager === manager ? failureRecord.value : ('');
|
|
3951
|
+
const [restartRecord, writeRestart] = React.useState({manager,value:manager ? memoryPluginRestart.has(manager) : false});
|
|
3952
|
+
const restart = restartRecord.manager === manager ? restartRecord.value : (manager ? memoryPluginRestart.has(manager) : false);
|
|
3953
|
+
// Optional local-source override, read eagerly so the card face shows
|
|
3954
|
+
// the stored value on first paint.
|
|
3955
|
+
const [specText, writeSpecText] = React.useState(memoryPluginSpecRead());
|
|
3956
|
+
const [fallbackRecord, writeFallbackNotice] = React.useState({manager,value:''});
|
|
3957
|
+
const fallbackNotice = fallbackRecord.manager === manager ? fallbackRecord.value : '';
|
|
3958
|
+
const setFallbackNotice = value => { if (token.active) writeFallbackNotice({manager,value}); };
|
|
3959
|
+
const setInstalled = value => { if (token.active) writeInstalled({manager,value}); };
|
|
3960
|
+
const setWorking = value => { if (token.active) writeWorking({manager,value}); };
|
|
3961
|
+
const setProgress = value => { if (token.active) writeProgress({manager,value}); };
|
|
3962
|
+
const setFailure = value => { if (token.active) writeFailure({manager,value}); };
|
|
3963
|
+
const setRestart = value => { if (token.active) writeRestart({manager,value}); };
|
|
3964
|
+
const setSpecText = value => { if (token.active) writeSpecText(value); };
|
|
3930
3965
|
React.useEffect(() => {
|
|
3931
3966
|
let alive = true;
|
|
3932
3967
|
const generation = token.epoch;
|
|
3968
|
+
setInstalled(null);
|
|
3969
|
+
setFallbackNotice('');
|
|
3970
|
+
setWorking(false); setProgress(''); setFailure(''); setRestart(manager ? memoryPluginRestart.has(manager) : false);
|
|
3933
3971
|
(async () => {
|
|
3934
3972
|
if (!manager || typeof manager.listBundles !== 'function') return;
|
|
3935
3973
|
try {
|
|
@@ -3942,7 +3980,6 @@ window.__ModuleLoader__.load({
|
|
|
3942
3980
|
}, [manager]);
|
|
3943
3981
|
// Failures are echoed verbatim: the raw message is the evidence.
|
|
3944
3982
|
const fail = (text) => { setWorking(false); setFailure(typeof text === 'string' && text !== '' ? text : String(text)); };
|
|
3945
|
-
|
|
3946
3983
|
const run = async () => {
|
|
3947
3984
|
if (!manager || typeof manager.inspect !== 'function' || typeof manager.installBundle !== 'function' || typeof manager.listBundles !== 'function') { fail('pluginManager remote unavailable'); return; }
|
|
3948
3985
|
if (memoryPluginJobs.get(manager)?.running) return;
|
|
@@ -3966,51 +4003,89 @@ window.__ModuleLoader__.load({
|
|
|
3966
4003
|
if (outcome.application === 'restart-required') { memoryPluginRestart.add(manager); setRestart(true); }
|
|
3967
4004
|
return outcome;
|
|
3968
4005
|
};
|
|
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
|
-
if (
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
outcome
|
|
3994
|
-
if (
|
|
4006
|
+
/** One attempt against a concrete spec: the upstream 0.6.0 body
|
|
4007
|
+
* (inventory gate, pinned inspect, update/install, enable,
|
|
4008
|
+
* inventory confirm) verbatim, but it resolves {done}/{error}
|
|
4009
|
+
* instead of echoing so run() can annotate and fall back. */
|
|
4010
|
+
const attemptSpec = async (spec) => {
|
|
4011
|
+
let canFallback = false;
|
|
4012
|
+
try {
|
|
4013
|
+
const before = memoryPluginInstalledOf(valueOf(await pluginDeadline(manager.listBundles())));
|
|
4014
|
+
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.');
|
|
4015
|
+
if (before && before.version !== '0.1.13') {
|
|
4016
|
+
// Only known, older stable versions are offered this pinned update.
|
|
4017
|
+
// The official host independently enforces semver.gt(target, installed).
|
|
4018
|
+
const parts = /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/.exec(before.version);
|
|
4019
|
+
const values = parts?.slice(1).map(Number);
|
|
4020
|
+
const older = values && values.every(Number.isSafeInteger) && values[0] === 0 && (values[1] === 0 || values[1] === 1 && values[2] < 13);
|
|
4021
|
+
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.');
|
|
4022
|
+
}
|
|
4023
|
+
const inspectionReply = await pluginDeadline(manager.inspect(spec, {}));
|
|
4024
|
+
canFallback = !before;
|
|
4025
|
+
const inspected = valueOf(inspectionReply);
|
|
4026
|
+
if (!token.active) return {done:true};
|
|
4027
|
+
if (!inspected || inspected.status !== 'accepted' || inspected.name !== MEMORY_PLUGIN_NAME || inspected.bundle !== true) throw new Error(inspected?.reason || 'Plugin spec refused');
|
|
4028
|
+
canFallback = false;
|
|
4029
|
+
const requestId = globalThis.crypto?.randomUUID?.() || 'cabinet-' + Date.now() + '-' + Math.random().toString(16).slice(2);
|
|
4030
|
+
let outcome;
|
|
4031
|
+
if (before && before.version === '0.1.13') {
|
|
4032
|
+
outcome = { application: 'applied' };
|
|
4033
|
+
} else {
|
|
4034
|
+
if (before && typeof manager.updateBundle !== 'function') throw new Error('Use the native plugin manager to update this installed bundle');
|
|
4035
|
+
uncertain = true;
|
|
4036
|
+
const operation = before ? manager.updateBundle(MEMORY_PLUGIN_NAME, '0.1.13', {requestId}) : manager.installBundle(spec, {enabled:false,requestId});
|
|
4037
|
+
let reply = await pluginDeadline(observe(operation, !!before));
|
|
4038
|
+
if (reply?.ok !== true && !before && typeof manager.waitForInstall === 'function') reply = await pluginDeadline(observe(manager.waitForInstall(requestId)));
|
|
4039
|
+
const result = valueOf(reply);
|
|
4040
|
+
if (!result) throw new Error('Install outcome is unknown; check the native plugin manager before retrying');
|
|
4041
|
+
outcome = before ? result.result : result;
|
|
4042
|
+
if (!outcome || !['applied','restart-required','failed','cancelled'].includes(outcome.application)) throw new Error('Install outcome is unknown');
|
|
4043
|
+
uncertain = false;
|
|
4044
|
+
outcomeOf(outcome);
|
|
4045
|
+
}
|
|
4046
|
+
// Installation and enabling are separate operations; neither implies the other succeeded.
|
|
4047
|
+
setInstalled({name:MEMORY_PLUGIN_NAME,version:outcome.version || before?.version || '',enabled:false});
|
|
4048
|
+
if (!token.active) return { done: true };
|
|
4049
|
+
if (typeof manager.setBundleEnabled !== 'function') throw new Error('Installed, but enable is unavailable; enable it in the native plugin manager');
|
|
4050
|
+
uncertain = true; job.settled = false;
|
|
4051
|
+
const enabled = valueOf(await pluginDeadline(observe(manager.setBundleEnabled(MEMORY_PLUGIN_NAME,true))));
|
|
4052
|
+
if (!enabled || !['applied','restart-required','failed','cancelled'].includes(enabled.application)) throw new Error('Enable outcome is unknown');
|
|
3995
4053
|
uncertain = false;
|
|
3996
|
-
outcomeOf(
|
|
4054
|
+
outcomeOf(enabled);
|
|
4055
|
+
const found = memoryPluginInstalledOf(valueOf(await pluginDeadline(manager.listBundles())));
|
|
4056
|
+
if (!found) throw new Error('Installation cannot be confirmed from the plugin inventory');
|
|
4057
|
+
setInstalled(found);
|
|
4058
|
+
if (!found.enabled) throw new Error('Installed, but the plugin inventory reports disabled');
|
|
4059
|
+
setFailure('');
|
|
4060
|
+
return { done: true };
|
|
4061
|
+
} catch (error) {
|
|
4062
|
+
return { error: error?.message || String(error), canFallback };
|
|
3997
4063
|
}
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
const
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4064
|
+
};
|
|
4065
|
+
const specNote = (specs) => ' [spec' + (specs.length > 1 ? 's' : '') + ': ' + specs.join(' → ') + ']';
|
|
4066
|
+
try {
|
|
4067
|
+
// spec = stored local-source override, else the registry default.
|
|
4068
|
+
setFallbackNotice('');
|
|
4069
|
+
const overrideSpec = specText.trim();
|
|
4070
|
+
const primarySpec = overrideSpec !== '' ? overrideSpec : MEMORY_PLUGIN_SPEC;
|
|
4071
|
+
let first;
|
|
4072
|
+
try { first = await attemptSpec(primarySpec); } catch (error) { first = { error: error?.message || String(error) }; }
|
|
4073
|
+
if (first.done !== true) {
|
|
4074
|
+
// A definitive failure of the local source falls back to the
|
|
4075
|
+
// registry once; an uncertain outcome keeps the upstream
|
|
4076
|
+
// no-second-operation guard (its job stays registered).
|
|
4077
|
+
if (primarySpec !== MEMORY_PLUGIN_SPEC && first.canFallback === true && uncertain !== true && token.active) {
|
|
4078
|
+
setFallbackNotice(t('settings.plugin.fallbackNotice') + ' ' + primarySpec + ' → ' + MEMORY_PLUGIN_SPEC);
|
|
4079
|
+
let second;
|
|
4080
|
+
try { second = await attemptSpec(MEMORY_PLUGIN_SPEC); } catch (error) { second = { error: error?.message || String(error) }; }
|
|
4081
|
+
if (second.done !== true) fail(first.error + specNote([primarySpec, MEMORY_PLUGIN_SPEC]) + (second.error && second.error !== first.error ? ' · ' + second.error : ''));
|
|
4082
|
+
} else {
|
|
4083
|
+
fail(first.error + specNote([primarySpec]));
|
|
4084
|
+
}
|
|
4085
|
+
}
|
|
4086
|
+
} catch (error) {
|
|
4087
|
+
fail(error !== null && error !== undefined && typeof error.message === 'string' ? error.message : String(error));
|
|
4088
|
+
} finally {
|
|
4014
4089
|
job.running = false;
|
|
4015
4090
|
if (!uncertain && memoryPluginJobs.get(manager) === job) memoryPluginJobs.delete(manager);
|
|
4016
4091
|
setWorking(false);
|
|
@@ -4027,10 +4102,15 @@ window.__ModuleLoader__.load({
|
|
|
4027
4102
|
h('span', { key: 'gap', style: { flex: 1 } }),
|
|
4028
4103
|
installed !== null ? h('span', { key: 'badge', 'data-cabinet-plugin-state': 'installed', style: { fontSize: 11, color: '#3fb950' } }, t('settings.plugin.installed')) : null
|
|
4029
4104
|
]),
|
|
4030
|
-
// Highlight lines replace the old one-line description;
|
|
4031
|
-
//
|
|
4032
|
-
//
|
|
4105
|
+
// Highlight lines replace the old one-line description; install
|
|
4106
|
+
// specs stay off the card face — the local-source box below is
|
|
4107
|
+
// where a path belongs, and only when the user opts in.
|
|
4033
4108
|
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)))),
|
|
4109
|
+
h('div', { key: 'specRow', style: { ...line, marginTop: 8, display: 'flex', gap: 6, alignItems: 'center', flexWrap: 'wrap' } }, [
|
|
4110
|
+
h('label', { key: 'specLabel', style: { fontSize: 11, color: INK2 } }, t('settings.plugin.specLabel')),
|
|
4111
|
+
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); } }),
|
|
4112
|
+
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'))
|
|
4113
|
+
]),
|
|
4034
4114
|
installed !== null
|
|
4035
4115
|
? h('div', { key: 'where', style: { display: 'flex', gap: 8, alignItems: 'center', flexWrap: 'wrap', marginTop: 8 } }, [
|
|
4036
4116
|
h('span', { key: 'version', 'data-cabinet-plugin-version': shownVersion, style: { fontSize: 11, color: INK2 } }, shownVersion + (hasInstalledVersion ? '' : ' · ' + t('settings.plugin.versionFallback'))),
|
|
@@ -4041,7 +4121,9 @@ window.__ModuleLoader__.load({
|
|
|
4041
4121
|
h('button', { key: 'install', 'data-cabinet-plugin-action': 'install', type: 'button', disabled: !manager || working, style: { fontSize: 11, cursor: 'pointer' }, onClick: () => { void run(); } }, working ? t('settings.plugin.installing') : t('settings.plugin.install'))
|
|
4042
4122
|
]),
|
|
4043
4123
|
!manager ? h('div', { key: 'unavailable', 'data-cabinet-plugin-state': 'unavailable', style: line }, t('settings.plugin.unavailable')) : null,
|
|
4044
|
-
|
|
4124
|
+
fallbackNotice !== '' ? h('div', { key:'fallback', role:'status', 'data-cabinet-plugin-fallback':'1', style:{...line,overflowWrap:'anywhere'} }, fallbackNotice) : null,
|
|
4125
|
+
installed !== null ? h('div', {key:'source', 'data-cabinet-plugin-source':'1',style:{...line,overflowWrap:'anywhere'}}, t('settings.plugin.installedSource') + ' ' + (installed.source || t('settings.plugin.sourceUnknown'))) : null,
|
|
4126
|
+
progress !== '' ? h('div', { key: 'progress', 'data-cabinet-plugin-progress': '1', style: line }, progress) : null,
|
|
4045
4127
|
restart ? h('div', { key: 'restart', 'data-cabinet-plugin-state': 'restart', style: { ...line, color: '#d29922' } }, t('settings.plugin.restartRequired')) : null,
|
|
4046
4128
|
failure !== '' ? h('div', { key: 'failure', 'data-cabinet-plugin-state': 'error', style: { ...line, color: '#f25a5a' } }, failure) : null
|
|
4047
4129
|
]);
|
|
@@ -4051,8 +4133,8 @@ window.__ModuleLoader__.load({
|
|
|
4051
4133
|
const t = typeof props?.t === 'function' ? props.t : memberT;
|
|
4052
4134
|
const [, redraw] = React.useState(0);
|
|
4053
4135
|
// Active settings tab: session-local state (approved plan A). It is a
|
|
4054
|
-
// navigation preference, not user data
|
|
4055
|
-
//
|
|
4136
|
+
// navigation preference, not user data; the only persisted settings
|
|
4137
|
+
// value is the plugin card's local-source override.
|
|
4056
4138
|
const [activeTab, setActiveTab] = React.useState('members');
|
|
4057
4139
|
const editorRef = React.useRef(null);
|
|
4058
4140
|
if (!editorRef.current) editorRef.current = createMemberEditor(memberWriter, () => redraw(n => n + 1));
|
|
@@ -4298,6 +4380,12 @@ window.__ModuleLoader__.load({
|
|
|
4298
4380
|
'settings.plugin.versionFallback': '已安装版本未知',
|
|
4299
4381
|
'settings.plugin.restartRequired': '已安装,需重启 DSH 生效',
|
|
4300
4382
|
'settings.plugin.unavailable': '安装通道不可用:宿主未提供 remote.pluginManager。可在宿主会话执行 dsh plugin --profile web add <本地路径> 安装。',
|
|
4383
|
+
'settings.plugin.specLabel': '宿主本地源(仅首次安装;依赖可能需要网络)',
|
|
4384
|
+
'settings.plugin.specPlaceholder': '可选:本地源路径;留空则用官方 registry',
|
|
4385
|
+
'settings.plugin.specClear': '清空',
|
|
4386
|
+
'settings.plugin.fallbackNotice': '本地源检查失败,已改用线上源(不是所填本地包):',
|
|
4387
|
+
'settings.plugin.installedSource': '宿主记录的已安装来源:',
|
|
4388
|
+
'settings.plugin.sourceUnknown': '未知',
|
|
4301
4389
|
'settings.plugin.hint1': 'respire/dsh:原生 TypeScript 记忆插件,存储、去重与加密由 rsrs 负责',
|
|
4302
4390
|
'settings.plugin.hint2': '自动召回:新会话自动想起早前结论,不用重复交代背景',
|
|
4303
4391
|
'settings.plugin.hint3': '本地优先:记忆存本机,引擎故障只提示、主任务照跑',
|
|
@@ -4380,6 +4468,12 @@ window.__ModuleLoader__.load({
|
|
|
4380
4468
|
'settings.plugin.versionFallback': 'Installed version unavailable',
|
|
4381
4469
|
'settings.plugin.restartRequired': 'Installed; restart DSH to take effect',
|
|
4382
4470
|
'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.',
|
|
4471
|
+
'settings.plugin.specLabel': 'Host-local source (first install only; dependencies may need network)',
|
|
4472
|
+
'settings.plugin.specPlaceholder': 'Optional local source path; empty uses the official registry',
|
|
4473
|
+
'settings.plugin.specClear': 'Clear',
|
|
4474
|
+
'settings.plugin.fallbackNotice': 'Local source inspection failed; switched to the registry (not the entered local package):',
|
|
4475
|
+
'settings.plugin.installedSource': 'Installed source reported by host:',
|
|
4476
|
+
'settings.plugin.sourceUnknown': 'Unknown',
|
|
4383
4477
|
'settings.plugin.hint1': 'respire/dsh: native TypeScript memory plugin; rsrs owns storage, dedup and encryption',
|
|
4384
4478
|
'settings.plugin.hint2': 'Auto-recall: a new session resurfaces earlier conclusions without re-briefing',
|
|
4385
4479
|
'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.2",
|
|
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,146 @@ 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
|
+
// Fallback remains visible after success or failure; installed source is host evidence.
|
|
657
|
+
for(const succeeds of [true,false]) {
|
|
658
|
+
pluginSpecStore.set('cabinet.memoryPluginSpec','/tmp/custom-local');
|
|
659
|
+
settingsState.length=0;settingsCursor=0;let installed=false;const calls=[];
|
|
660
|
+
const manager={
|
|
661
|
+
listBundles:async()=>({ok:true,value:installed?[{name:'@rsrsai/dsh',installed:true,enabled:true,version:'0.1.13',source:'@rsrsai/dsh@0.1.13'}]:[]}),
|
|
662
|
+
inspect:async spec=>{calls.push(spec);return {ok:true,value:spec.startsWith('/tmp')?{status:'refused',reason:'missing local'}:{status:'accepted',name:'@rsrsai/dsh',bundle:true}}},
|
|
663
|
+
installBundle:async()=>{installed=succeeds;return {ok:true,value:succeeds?{application:'applied',version:'0.1.13'}:{application:'failed',error:{message:'registry failed'}}}},
|
|
664
|
+
setBundleEnabled:async()=>({ok:true,value:{application:'applied'}})
|
|
665
|
+
};
|
|
666
|
+
let nodes=elements(settingsClient.MemoryPluginCard({manager,t:k=>settingsClient.en[k]||k}));
|
|
667
|
+
nodes.find(n=>n.props?.['data-cabinet-plugin-action']).props.onClick();await new Promise(r=>setTimeout(r,0));
|
|
668
|
+
settingsCursor=0;nodes=elements(settingsClient.MemoryPluginCard({manager,t:k=>settingsClient.en[k]||k}));
|
|
669
|
+
const notice=nodes.find(n=>n.props?.['data-cabinet-plugin-fallback']);
|
|
670
|
+
assert.ok(String(notice.children.flat()).includes('/tmp/custom-local → @rsrsai/dsh@0.1.13'),'actual source switch remains visible');
|
|
671
|
+
if(succeeds)assert.ok(String(nodes.find(n=>n.props?.['data-cabinet-plugin-source']).children.flat()).includes('@rsrsai/dsh@0.1.13'),'success shows host inventory source');
|
|
672
|
+
else assert.ok(nodes.some(n=>n.props?.['data-cabinet-plugin-state']==='error'),'failure remains an error, not success');
|
|
673
|
+
assert.deepEqual(calls,['/tmp/custom-local','@rsrsai/dsh@0.1.13']);
|
|
674
|
+
settingsCursor=0;const other=elements(settingsClient.MemoryPluginCard({manager:{listBundles:async()=>{throw Error('new connection failed')}},t:k=>k}));
|
|
675
|
+
assert.equal(other.some(n=>n.props?.['data-cabinet-plugin-fallback']),false,'existing fallback notice cannot cross connection');
|
|
676
|
+
assert.equal(other.some(n=>n.props?.['data-cabinet-plugin-source']),false,'existing source cannot cross connection');
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
pluginSpecStore.delete('cabinet.memoryPluginSpec');
|
|
680
|
+
|
|
531
681
|
// Both dictionaries carry the same settings.* keys (nothing may exist in one
|
|
532
682
|
// language only) and every tab id is translatable.
|
|
533
683
|
const zhSettingsKeys = Object.keys(client.zh).filter((key) => key.startsWith('settings.'));
|
|
@@ -545,7 +695,11 @@ for (const n of [1, 2, 3, 4, 5]) {
|
|
|
545
695
|
assert.ok(zhSettingsKeys.includes(key), 'highlight line copy present: ' + key);
|
|
546
696
|
assert.ok(enSettingsKeys.includes(key), 'highlight line copy present in en: ' + key);
|
|
547
697
|
}
|
|
548
|
-
|
|
698
|
+
for (const key of ['settings.plugin.specLabel', 'settings.plugin.specPlaceholder', 'settings.plugin.specClear']) {
|
|
699
|
+
assert.ok(zhSettingsKeys.includes(key), 'local-source copy present: ' + key);
|
|
700
|
+
assert.ok(enSettingsKeys.includes(key), 'local-source copy present in en: ' + key);
|
|
701
|
+
}
|
|
702
|
+
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
703
|
|
|
550
704
|
// Installation state machine uses the real remote Result envelope.
|
|
551
705
|
for (const scenario of ['success','install-failed','enable-failed','missing-wait','timeout','restart','update','missing-enable','wait-null','wait-failed']) {
|
|
@@ -617,3 +771,36 @@ console.log('PASS: effectful inventory first mount/remount/channel replacement a
|
|
|
617
771
|
h.render(manager).find(n=>n.props?.['data-cabinet-plugin-action']==='install').props.onClick();await tick();resolve({ok:true,value:[]});await tick();assert.equal(versionOf(h.render(manager)),'0.1.13','epoch rejects pre-operation inventory response');h.unmount();
|
|
618
772
|
}
|
|
619
773
|
console.log('PASS: late initial inventory cannot overwrite a completed operation');
|
|
774
|
+
|
|
775
|
+
{
|
|
776
|
+
const h=memoryCardHarness();
|
|
777
|
+
const a={listBundles:async()=>({ok:true,value:[{name:'@rsrsai/dsh',installed:true,enabled:true,version:'0.1.13',source:'registry-A'}]})};
|
|
778
|
+
const b={listBundles:async()=>{throw Error('unavailable')}};
|
|
779
|
+
const sourceOf=n=>n.find(x=>x.props?.['data-cabinet-plugin-source'])?.children.flat().join('');
|
|
780
|
+
h.render(a);await tick();assert.ok(sourceOf(h.render(a)).includes('registry-A'));
|
|
781
|
+
assert.equal(sourceOf(h.render(b)),undefined,'new connection hides old source immediately');await tick();assert.equal(sourceOf(h.render(b)),undefined,'failed inventory never exposes previous source');
|
|
782
|
+
const c={listBundles:async()=>inventory('0.1.13')};h.render(c);await tick();assert.ok(sourceOf(h.render(c)).includes('settings.plugin.sourceUnknown'),'missing provenance is unknown');
|
|
783
|
+
h.unmount();h.render(a);await tick();assert.ok(sourceOf(h.render(a)).includes('registry-A'),'remount reloads host provenance');h.unmount();
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
// Switching connections during inspection never locks the new connection or mutates the old one.
|
|
787
|
+
{
|
|
788
|
+
const h=memoryCardHarness();let finish,mutations=0;
|
|
789
|
+
const a={listBundles:async()=>({ok:true,value:[]}),inspect:()=>new Promise(r=>finish=r),installBundle:async()=>{mutations++;return {ok:true,value:{application:'applied'}}}};
|
|
790
|
+
const b={listBundles:async()=>{throw Error('new inventory failed')},inspect:async()=>{},installBundle:async()=>{}};
|
|
791
|
+
const action=n=>n.find(x=>x.props?.['data-cabinet-plugin-action']);
|
|
792
|
+
h.render(a);await tick();action(h.render(a)).props.onClick();await tick();assert.equal(action(h.render(a)).props.disabled,true);
|
|
793
|
+
assert.equal(action(h.render(b)).props.disabled,false,'new connection is not locked by old work');await tick();
|
|
794
|
+
finish({ok:true,value:{status:'accepted',name:'@rsrsai/dsh',bundle:true}});await tick();
|
|
795
|
+
assert.equal(action(h.render(b)).props.disabled,false,'late completion cannot lock new UI');assert.equal(mutations,0,'late inspection cannot start installation after connection changed');h.unmount();
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
{
|
|
799
|
+
const h=memoryCardHarness();let finish,enabled=0;
|
|
800
|
+
const a={listBundles:async()=>({ok:true,value:[]}),inspect:async()=>({ok:true,value:{status:'accepted',name:'@rsrsai/dsh',bundle:true}}),installBundle:()=>new Promise(r=>finish=r),setBundleEnabled:async()=>{enabled++;return {ok:true,value:{application:'applied'}}}};
|
|
801
|
+
const b={listBundles:async()=>({ok:true,value:[]})};const action=n=>n.find(x=>x.props?.['data-cabinet-plugin-action']);
|
|
802
|
+
h.render(a);await tick();action(h.render(a)).props.onClick();await tick();assert.equal(typeof finish,'function');
|
|
803
|
+
assert.equal(action(h.render(b)).props.disabled,false);await tick();
|
|
804
|
+
finish({ok:true,value:{application:'applied',version:'0.1.13'}});await tick();
|
|
805
|
+
const nodes=h.render(b);assert.equal(action(nodes).props.disabled,false);assert.equal(versionOf(nodes),undefined);assert.equal(enabled,0,'old installation completion must not enable after switching');h.unmount();
|
|
806
|
+
}
|