dsh-remote-vs 0.20.0 → 0.21.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/README.en.md +6 -6
- package/README.md +5 -5
- package/cordis.patch.yml +10 -0
- package/lib/client.js +123 -89
- package/lib/index.js +234 -36
- package/lib/p2-router-fs.js +1 -1
- package/lib/types/client/vsc/editor-keymap.d.ts +45 -0
- package/lib/types/client/vsc/file-icons.d.ts +8 -9
- package/lib/types/client/vsc/kit.d.ts +7 -6
- package/lib/types/preset-switch.d.ts +89 -0
- package/lib/{worlds-Be1YE2Ot.js → worlds-DSzyajOB.js} +1 -1
- package/package.json +34 -34
- package/src/client/CodeEditor.tsx +24 -62
- package/src/client/index.tsx +3 -3
- package/src/client/vsc/editor-keymap.ts +97 -0
- package/src/client/vsc/file-icons.tsx +8 -9
- package/src/client/vsc/kit.tsx +7 -6
- package/src/index.ts +115 -52
- package/src/preset-switch.ts +143 -0
package/README.en.md
CHANGED
|
@@ -37,9 +37,9 @@ dsh plugin --profile web add dsh-remote-vs
|
|
|
37
37
|
(From npm, recommended; installing straight from the repository also works:
|
|
38
38
|
`dsh plugin --profile web add github:xiray-xia/dsh-remote-vs`.)
|
|
39
39
|
|
|
40
|
-
**Requires DSH `0.2.2-
|
|
41
|
-
**
|
|
42
|
-
|
|
40
|
+
**Requires DSH `0.2.2-rc.2` or newer and below `0.3.0`** (`engines.dsh` enforces the range;
|
|
41
|
+
**adapted to and typechecked against `0.2.2-rc.2`**). On Host `0.2.2-alpha.3` / `0.2.2-rc.1` use plugin `0.20.1`; the
|
|
42
|
+
`0.2.2-alpha.2` generation needs `0.17.0` and the `0.2.1-rc.2` generation needs `0.9.3`. `--profile web` selects which profile to install into —
|
|
43
43
|
this is a Web plugin, so it has to go into the profile your Web GUI runs from (`web` is
|
|
44
44
|
the common name; use your own profile's name). Desktop uses the reserved `desktop`
|
|
45
45
|
profile instead — see [Desktop](#desktop-dsh-desktop) below.
|
|
@@ -74,7 +74,7 @@ Install either way:
|
|
|
74
74
|
`desktop` is reserved for the Electron application: an **npm-installed `dsh` cannot manage
|
|
75
75
|
it** (it answers `profile "desktop" is managed exclusively by the Electron application`),
|
|
76
76
|
so one of the two routes above is required. The Desktop release version equals the DSH
|
|
77
|
-
runtime it bundles, and it must satisfy `engines.dsh` (`>=0.2.2-
|
|
77
|
+
runtime it bundles, and it must satisfy `engines.dsh` (`>=0.2.2-rc.2`; check About);
|
|
78
78
|
older releases make the Plugins page refuse the install. Desktop opens no visible Web
|
|
79
79
|
port, but the plugin's HTTP routes and terminal socket are forwarded through Desktop's
|
|
80
80
|
Host (the terminal resolves its address from `__DSH_TRANSPORT__.streamBaseUrl`), so no
|
|
@@ -220,7 +220,7 @@ dsh_remote_vs/
|
|
|
220
220
|
├── vendor/dsh-remote-helpers/ # helper seeds (shipped, seeded into cache at startup, see below)
|
|
221
221
|
├── docs/ # local-only working docs (only docs/media/ screenshots ship)
|
|
222
222
|
│ ├── MAINTENANCE.md # local-only (.gitignore), not shipped: upgrade impact, checklist, pitfalls, release
|
|
223
|
-
│ ├── VERSION-HISTORY.md # local-only: per-release change log (0.7.1 → 0.
|
|
223
|
+
│ ├── VERSION-HISTORY.md # local-only: per-release change log (0.7.1 → 0.21.0)
|
|
224
224
|
│ └── GATES.md # local-only: local gate inventory and measured assertion counts
|
|
225
225
|
├── locale/ # bilingual plugin metadata
|
|
226
226
|
└── lib/ # build output (**must be committed**; only .map is ignored; restart after link install)
|
|
@@ -462,7 +462,7 @@ tsc, to the bundler and to jsdom — this fixture is the only place they reprodu
|
|
|
462
462
|
> exactly why "57 call sites" and "55 checks run" differ by 2).
|
|
463
463
|
|
|
464
464
|
The live-host regression is still `npx tsc -p tsconfig.scratch.json && node .spike/build/.spike/p2-router.js`.
|
|
465
|
-
Before touching anything for a new DSH release, read the local-only `docs/MAINTENANCE.md` (§2 coupling points, §3 checklist) — it is gitignored, so a clone will not have it. After any change (host half or client half) the mandatory steps are: `pnpm run build` → `node scripts/verify-lib.mjs` (entries present, committed and loadable) → restart `dsh web`; and before committing, run every local gate under `scripts/` (`node scripts/check-*.mjs`,
|
|
465
|
+
Before touching anything for a new DSH release, read the local-only `docs/MAINTENANCE.md` (§2 coupling points, §3 checklist) — it is gitignored, so a clone will not have it. After any change (host half or client half) the mandatory steps are: `pnpm run build` → `node scripts/verify-lib.mjs` (entries present, committed and loadable) → restart `dsh web`; and before committing, run every local gate under `scripts/` (`node scripts/check-*.mjs`, 57 of them at the time of writing, plus `verify-lib.mjs` and the shared TS loader `_ts-hook.mjs`).
|
|
466
466
|
|
|
467
467
|
## License
|
|
468
468
|
|
package/README.md
CHANGED
|
@@ -34,8 +34,8 @@ dsh plugin --profile web add dsh-remote-vs
|
|
|
34
34
|
|
|
35
35
|
(从 npm 装,推荐;也可以直接跟仓库装:`dsh plugin --profile web add github:xiray-xia/dsh-remote-vs`。)
|
|
36
36
|
|
|
37
|
-
**需要 DSH `0.2.2-
|
|
38
|
-
Host 仍是 `0.2.2-alpha.
|
|
37
|
+
**需要 DSH `0.2.2-rc.2` 及以上、`0.3.0` 以下**(`engines.dsh` 门到底;已按 rc.2 适配并通过类型检查与本地全量门禁)。
|
|
38
|
+
Host 仍是 `0.2.2-alpha.3` / `0.2.2-rc.1` 的请用插件 `0.20.1`;`0.2.2-alpha.2` 一代请用 `0.17.0`;`0.2.1-rc.2` 一代请用 `0.9.3`。
|
|
39
39
|
`--profile web` 指明装进哪个 profile —— 本插件是 Web 插件,
|
|
40
40
|
要装进 Web GUI 所用的那个(`web` 是常见命名,以你自己的 profile 名为准);
|
|
41
41
|
桌面端用的是保留 profile `desktop`,见下面「桌面端」。
|
|
@@ -63,7 +63,7 @@ Host 仍是 `0.2.2-alpha.2` 的请用插件 `0.17.0`(或先把 DSH 升到 `0.2
|
|
|
63
63
|
注意:`desktop` 是桌面端独占的保留 profile,**npm 全局安装的 `dsh` 不能管理它**
|
|
64
64
|
(会报 `profile "desktop" is managed exclusively by the Electron application`),
|
|
65
65
|
只能走上面两条路径。桌面端的版本号等于它捆绑的 DSH 运行时版本,同样要满足
|
|
66
|
-
`engines.dsh` 要求(`>=0.2.2-
|
|
66
|
+
`engines.dsh` 要求(`>=0.2.2-rc.2`,关于面板可看);低于该版本时插件页会直接拒绝
|
|
67
67
|
安装。桌面端没有可见的 Web 端口,但本插件的 HTTP 路由与终端 socket 都经桌面端的
|
|
68
68
|
Host 转发(终端按 `__DSH_TRANSPORT__.streamBaseUrl` 解析地址),无需额外设置。
|
|
69
69
|
|
|
@@ -205,7 +205,7 @@ dsh_remote_vs/
|
|
|
205
205
|
├── vendor/dsh-remote-helpers/ # helper 种子(随包发布,启动铺缓存,见下)
|
|
206
206
|
├── docs/ # 本地工作文档(不推送 GitHub;只有 docs/media/ 的截图随仓库公开)
|
|
207
207
|
│ ├── MAINTENANCE.md # 本地私有(.gitignore,不入库):升级影响面/检查清单/踩坑/发布流程
|
|
208
|
-
│ ├── VERSION-HISTORY.md # 本地私有:逐版本变更纪要(0.7.1 → 0.
|
|
208
|
+
│ ├── VERSION-HISTORY.md # 本地私有:逐版本变更纪要(0.7.1 → 0.21.0)
|
|
209
209
|
│ └── GATES.md # 本地私有:本地门禁清单与实跑条数
|
|
210
210
|
├── locale/ # 插件元信息双语
|
|
211
211
|
└── lib/ # 构建产物(**必须入库**,只有 .map 忽略;link 安装后重启即生效)
|
|
@@ -413,7 +413,7 @@ node .spike/letter-check.mjs # 状态字母:未跟踪 ? 与冲突 U 不再
|
|
|
413
413
|
> 失败时才触发,所以「调用点 57」与「跑出来 55」本来就该差 2)。
|
|
414
414
|
|
|
415
415
|
真机回归仍是 `npx tsc -p tsconfig.scratch.json && node .spike/build/.spike/p2-router.js`。
|
|
416
|
-
DSH 发新版时先读本地维护文档 `docs/MAINTENANCE.md`(§2 逐项耦合点 + §3 升级清单)再动手;该文件被 .gitignore,克隆仓库的人看不到。改动后(无论 host 半还是 client 半)的必做动作是:`pnpm run build` → `node scripts/verify-lib.mjs`(核对 `lib/` 齐全、已入库、能加载)→ 重启 `dsh web`,提交前把 `scripts/` 下的本地门禁逐个跑一遍(`node scripts/check-*.mjs`,当前
|
|
416
|
+
DSH 发新版时先读本地维护文档 `docs/MAINTENANCE.md`(§2 逐项耦合点 + §3 升级清单)再动手;该文件被 .gitignore,克隆仓库的人看不到。改动后(无论 host 半还是 client 半)的必做动作是:`pnpm run build` → `node scripts/verify-lib.mjs`(核对 `lib/` 齐全、已入库、能加载)→ 重启 `dsh web`,提交前把 `scripts/` 下的本地门禁逐个跑一遍(`node scripts/check-*.mjs`,当前 57 个;另有 `verify-lib.mjs` 与共享 TS 加载器 `_ts-hook.mjs`)。
|
|
417
417
|
|
|
418
418
|
## 开源许可
|
|
419
419
|
|
package/cordis.patch.yml
CHANGED
|
@@ -54,6 +54,9 @@
|
|
|
54
54
|
inject: [localFileReferences, remoteWorlds]
|
|
55
55
|
|
|
56
56
|
# Remote agent preset, bound to this bundle's lifecycle.
|
|
57
|
+
# Mirrored from preset-standard @ dsh 0.2.2-rc.2. rc.2 deltas adopted:
|
|
58
|
+
# skill-filesystem customSkillDirs, tool-subagent-control interrupt:false,
|
|
59
|
+
# tool-office row.
|
|
57
60
|
# Mirrored from preset-standard @ dsh 0.2.2-alpha.2 with these diffs:
|
|
58
61
|
# 1. persona prefix reframed for remote SSH work (transparent routing);
|
|
59
62
|
# 2. tool-bash moved into an isolated shell group with our routed bash
|
|
@@ -126,6 +129,9 @@
|
|
|
126
129
|
name: '@deepseek-ai/dsh-tool-schedule'
|
|
127
130
|
- id: skill-filesystem
|
|
128
131
|
name: '@deepseek-ai/dsh-skill-filesystem'
|
|
132
|
+
config:
|
|
133
|
+
customSkillDirs:
|
|
134
|
+
- !!js process.getBuiltinModule('node:path').join(process.getBuiltinModule('node:path').dirname(process.getBuiltinModule('node:module').createRequire(baseUrl).resolve('@deepseek-ai/dsh-agent-preset/package.json')), 'skills')
|
|
129
135
|
- id: tool-skill
|
|
130
136
|
name: '@deepseek-ai/dsh-tool-skill'
|
|
131
137
|
- id: command-goal
|
|
@@ -218,6 +224,8 @@
|
|
|
218
224
|
config:
|
|
219
225
|
- id: tool-subagent-control
|
|
220
226
|
name: '@deepseek-ai/dsh-tool-subagent-control'
|
|
227
|
+
config:
|
|
228
|
+
interrupt: false
|
|
221
229
|
- id: tool-subagent
|
|
222
230
|
name: '@deepseek-ai/dsh-tool-subagent'
|
|
223
231
|
config:
|
|
@@ -249,6 +257,8 @@
|
|
|
249
257
|
searchTimeoutMs: 60000
|
|
250
258
|
- id: present
|
|
251
259
|
name: '@deepseek-ai/dsh-tool-present'
|
|
260
|
+
- id: tool-office
|
|
261
|
+
name: '@deepseek-ai/dsh-tool-office'
|
|
252
262
|
- id: tool-plugin-manager
|
|
253
263
|
name: '@deepseek-ai/dsh-plugin-manager/tools'
|
|
254
264
|
disabled: !!js "!ctx.get('profileContext')"
|
package/lib/client.js
CHANGED
|
@@ -23269,6 +23269,17 @@ window.__ModuleLoader__.load({
|
|
|
23269
23269
|
run: toggleTabFocusMode
|
|
23270
23270
|
}
|
|
23271
23271
|
].concat(standardKeymap);
|
|
23272
|
+
/**
|
|
23273
|
+
A binding that binds Tab to [`indentMore`](https://codemirror.net/6/docs/ref/#commands.indentMore) and
|
|
23274
|
+
Shift-Tab to [`indentLess`](https://codemirror.net/6/docs/ref/#commands.indentLess).
|
|
23275
|
+
Please see the [Tab example](../../examples/tab/) before using
|
|
23276
|
+
this.
|
|
23277
|
+
*/
|
|
23278
|
+
const indentWithTab = {
|
|
23279
|
+
key: "Tab",
|
|
23280
|
+
run: indentMore,
|
|
23281
|
+
shift: indentLess
|
|
23282
|
+
};
|
|
23272
23283
|
//#endregion
|
|
23273
23284
|
//#region node_modules/.pnpm/@codemirror+autocomplete@6.20.3/node_modules/@codemirror/autocomplete/dist/index.js
|
|
23274
23285
|
/**
|
|
@@ -25691,14 +25702,15 @@ window.__ModuleLoader__.load({
|
|
|
25691
25702
|
* Icon sourcing has two tiers. `FileIcon` / `FolderIcon` paint the plain glyphs
|
|
25692
25703
|
* below (search hits, SCM rows, commit panes, download rows — list chrome where
|
|
25693
25704
|
* one neutral outline reads best). `ExplorerFileIcon` / `ExplorerFolderIcon`
|
|
25694
|
-
* paint the COLOURED type set ported from
|
|
25695
|
-
* the remote directory tree looks like the local
|
|
25696
|
-
* whose colour and mark carry the file type, and an
|
|
25705
|
+
* paint the COLOURED type set ported from the local sidebar plugin in
|
|
25706
|
+
* `./file-icons.tsx`, so the remote directory tree looks like the local
|
|
25707
|
+
* sidebar's tree: one sheet whose colour and mark carry the file type, and an
|
|
25708
|
+
* amber folder that opens.
|
|
25697
25709
|
*
|
|
25698
25710
|
* Every tier still prefers the host service when one is published (the
|
|
25699
|
-
* better-sidebar
|
|
25700
|
-
* registered icon theme).
|
|
25701
|
-
*
|
|
25711
|
+
* better-sidebar contract's `fileIcon` / `folderIcon`: host classifier plus any
|
|
25712
|
+
* registered icon theme). That plugin publishes none today, so with the local
|
|
25713
|
+
* sidebar installed the SVG sets above are what actually render.
|
|
25702
25714
|
*/
|
|
25703
25715
|
function svg(size, children, className) {
|
|
25704
25716
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
@@ -26957,6 +26969,83 @@ window.__ModuleLoader__.load({
|
|
|
26957
26969
|
});
|
|
26958
26970
|
}
|
|
26959
26971
|
//#endregion
|
|
26972
|
+
//#region src/client/vsc/editor-keymap.ts
|
|
26973
|
+
/**
|
|
26974
|
+
* Build the editor keymap.
|
|
26975
|
+
*
|
|
26976
|
+
* Order: the stock keymaps first, then the two additions that make this editor
|
|
26977
|
+
* behave like VS Code — `indentWithTab` (Tab / Shift-Tab indent or dedent) and
|
|
26978
|
+
* our own shortcuts. `indentWithTab` is deliberately NOT part of CodeMirror's
|
|
26979
|
+
* defaults, which is exactly what shipped the "Tab does nothing" bug; a red
|
|
26980
|
+
* proof in the gate removes it again.
|
|
26981
|
+
*/
|
|
26982
|
+
function editorKeymap(handlers) {
|
|
26983
|
+
return [
|
|
26984
|
+
...defaultKeymap,
|
|
26985
|
+
...historyKeymap,
|
|
26986
|
+
indentWithTab,
|
|
26987
|
+
{
|
|
26988
|
+
key: "Mod-s",
|
|
26989
|
+
run: () => {
|
|
26990
|
+
handlers.save();
|
|
26991
|
+
return true;
|
|
26992
|
+
},
|
|
26993
|
+
preventDefault: true
|
|
26994
|
+
},
|
|
26995
|
+
{
|
|
26996
|
+
key: "Mod-f",
|
|
26997
|
+
run: (view) => {
|
|
26998
|
+
handlers.openFindForSelection(view);
|
|
26999
|
+
return true;
|
|
27000
|
+
},
|
|
27001
|
+
preventDefault: true
|
|
27002
|
+
},
|
|
27003
|
+
{
|
|
27004
|
+
key: "F3",
|
|
27005
|
+
run: (view) => {
|
|
27006
|
+
handlers.stepFind(view, true);
|
|
27007
|
+
return true;
|
|
27008
|
+
},
|
|
27009
|
+
preventDefault: true
|
|
27010
|
+
},
|
|
27011
|
+
{
|
|
27012
|
+
key: "Shift-F3",
|
|
27013
|
+
run: (view) => {
|
|
27014
|
+
handlers.stepFind(view, false);
|
|
27015
|
+
return true;
|
|
27016
|
+
},
|
|
27017
|
+
preventDefault: true
|
|
27018
|
+
},
|
|
27019
|
+
(
|
|
27020
|
+
/**
|
|
27021
|
+
* Previous / next change hunk.
|
|
27022
|
+
*
|
|
27023
|
+
* `Mod-Shift-Alt-ArrowUp/Down` is the free combination: defaultKeymap already
|
|
27024
|
+
* uses `Mod-Alt-Arrow*` (multi-cursor), `Alt-Arrow*` (move line) and
|
|
27025
|
+
* `Shift-Alt-Arrow*` (copy line), and browsers leave this extra Shift alone.
|
|
27026
|
+
*
|
|
27027
|
+
* NO `preventDefault: true` here, deliberately: CodeMirror prevents the
|
|
27028
|
+
* default whenever a binding for that key sets the flag, even if every
|
|
27029
|
+
* command returns false (view keymap `runFor`). With the panel closed the
|
|
27030
|
+
* handler returns false, and the key must fall through instead of being
|
|
27031
|
+
* swallowed — the 2026-11-10 gate found this latent swallow while pinning
|
|
27032
|
+
* the Tab fix.
|
|
27033
|
+
*/
|
|
27034
|
+
{
|
|
27035
|
+
key: "Mod-Shift-Alt-ArrowDown",
|
|
27036
|
+
run: () => handlers.stepHunk(1)
|
|
27037
|
+
}),
|
|
27038
|
+
{
|
|
27039
|
+
key: "Mod-Shift-Alt-ArrowUp",
|
|
27040
|
+
run: () => handlers.stepHunk(-1)
|
|
27041
|
+
},
|
|
27042
|
+
{
|
|
27043
|
+
key: "Escape",
|
|
27044
|
+
run: () => handlers.closeFind()
|
|
27045
|
+
}
|
|
27046
|
+
];
|
|
27047
|
+
}
|
|
27048
|
+
//#endregion
|
|
26960
27049
|
//#region node_modules/.pnpm/@lezer+lr@1.4.11/node_modules/@lezer/lr/dist/index.js
|
|
26961
27050
|
/**
|
|
26962
27051
|
A parse stack. These are used internally by the parser to track
|
|
@@ -41214,91 +41303,36 @@ Integer Float Double Long Int32 Int64 Uint8 uint32_t int32_t uint64_t int64_t si
|
|
|
41214
41303
|
if (host === null) return;
|
|
41215
41304
|
const extensions = [
|
|
41216
41305
|
history(),
|
|
41217
|
-
keymap.of(
|
|
41218
|
-
|
|
41219
|
-
|
|
41220
|
-
{
|
|
41221
|
-
key: "Mod-s",
|
|
41222
|
-
run: () => {
|
|
41223
|
-
propsRef.current.onSave();
|
|
41224
|
-
return true;
|
|
41225
|
-
},
|
|
41226
|
-
preventDefault: true
|
|
41227
|
-
},
|
|
41228
|
-
{
|
|
41229
|
-
key: "Mod-f",
|
|
41230
|
-
run: (view) => {
|
|
41231
|
-
const sel = view.state.selection.main;
|
|
41232
|
-
if (!sel.empty) {
|
|
41233
|
-
const text = view.state.sliceDoc(sel.from, sel.to);
|
|
41234
|
-
if (text !== "" && text.length <= 200) setFindSeed((prev) => ({
|
|
41235
|
-
text,
|
|
41236
|
-
id: prev.id + 1
|
|
41237
|
-
}));
|
|
41238
|
-
}
|
|
41239
|
-
setFindOpen(true);
|
|
41240
|
-
return true;
|
|
41241
|
-
},
|
|
41242
|
-
preventDefault: true
|
|
41306
|
+
keymap.of(editorKeymap({
|
|
41307
|
+
save: () => {
|
|
41308
|
+
propsRef.current.onSave();
|
|
41243
41309
|
},
|
|
41244
|
-
{
|
|
41245
|
-
|
|
41246
|
-
|
|
41247
|
-
|
|
41248
|
-
|
|
41249
|
-
|
|
41250
|
-
|
|
41310
|
+
openFindForSelection: (view) => {
|
|
41311
|
+
const sel = view.state.selection.main;
|
|
41312
|
+
if (!sel.empty) {
|
|
41313
|
+
const text = view.state.sliceDoc(sel.from, sel.to);
|
|
41314
|
+
if (text !== "" && text.length <= 200) setFindSeed((prev) => ({
|
|
41315
|
+
text,
|
|
41316
|
+
id: prev.id + 1
|
|
41317
|
+
}));
|
|
41318
|
+
}
|
|
41319
|
+
setFindOpen(true);
|
|
41251
41320
|
},
|
|
41252
|
-
{
|
|
41253
|
-
|
|
41254
|
-
run: (view) => {
|
|
41255
|
-
stepFind(view, false);
|
|
41256
|
-
return true;
|
|
41257
|
-
},
|
|
41258
|
-
preventDefault: true
|
|
41321
|
+
stepFind: (view, forward) => {
|
|
41322
|
+
stepFind(view, forward);
|
|
41259
41323
|
},
|
|
41260
|
-
(
|
|
41261
|
-
|
|
41262
|
-
|
|
41263
|
-
|
|
41264
|
-
|
|
41265
|
-
* defaultKeymap 里 `Mod-Alt-ArrowUp/Down`(多光标)、`Alt-ArrowUp/Down`
|
|
41266
|
-
* (移动行)、`Shift-Alt-ArrowUp/Down`(复制行)都被占了,三者之上再加
|
|
41267
|
-
* Shift 的这两个组合它没有用;浏览器侧 Ctrl+Shift+Alt+方向键也没有默认
|
|
41268
|
-
* 行为(选中/滚动都落在更低的组合上)。
|
|
41269
|
-
*
|
|
41270
|
-
* 没有 `onStepHunk`(面板没开)时返回 false,按键照旧落回 CodeMirror 的
|
|
41271
|
-
* 默认处理,不会平白吞掉一个组合键。
|
|
41272
|
-
*/
|
|
41273
|
-
{
|
|
41274
|
-
key: "Mod-Shift-Alt-ArrowDown",
|
|
41275
|
-
run: () => {
|
|
41276
|
-
const step = propsRef.current.onStepHunk;
|
|
41277
|
-
if (step === void 0) return false;
|
|
41278
|
-
step(1);
|
|
41279
|
-
return true;
|
|
41280
|
-
},
|
|
41281
|
-
preventDefault: true
|
|
41282
|
-
}),
|
|
41283
|
-
{
|
|
41284
|
-
key: "Mod-Shift-Alt-ArrowUp",
|
|
41285
|
-
run: () => {
|
|
41286
|
-
const step = propsRef.current.onStepHunk;
|
|
41287
|
-
if (step === void 0) return false;
|
|
41288
|
-
step(-1);
|
|
41289
|
-
return true;
|
|
41290
|
-
},
|
|
41291
|
-
preventDefault: true
|
|
41324
|
+
stepHunk: (delta) => {
|
|
41325
|
+
const step = propsRef.current.onStepHunk;
|
|
41326
|
+
if (step === void 0) return false;
|
|
41327
|
+
step(delta);
|
|
41328
|
+
return true;
|
|
41292
41329
|
},
|
|
41293
|
-
{
|
|
41294
|
-
|
|
41295
|
-
|
|
41296
|
-
|
|
41297
|
-
setFindOpen(false);
|
|
41298
|
-
return true;
|
|
41299
|
-
}
|
|
41330
|
+
closeFind: () => {
|
|
41331
|
+
if (!findOpenRef.current) return false;
|
|
41332
|
+
setFindOpen(false);
|
|
41333
|
+
return true;
|
|
41300
41334
|
}
|
|
41301
|
-
|
|
41335
|
+
})),
|
|
41302
41336
|
lineNumbers(),
|
|
41303
41337
|
highlightActiveLine(),
|
|
41304
41338
|
indentOnInput(),
|
|
@@ -41550,7 +41584,7 @@ Integer Float Double Long Int32 Int64 Uint8 uint32_t int32_t uint64_t int64_t si
|
|
|
41550
41584
|
const primary = host.querySelectorAll("[class*=\"rvs-ck-\"]").length;
|
|
41551
41585
|
const fallback = host.querySelectorAll("span[class^=\"rvs-t-\"]").length;
|
|
41552
41586
|
const count = primary > 0 ? primary : fallback;
|
|
41553
|
-
console.info(`[dsh-remote-vs] build
|
|
41587
|
+
console.info(`[dsh-remote-vs] build 1112-1558 · ${source} · colored tokens: ${count} (${propsRef.current.path})`);
|
|
41554
41588
|
propsRef.current.onTokens?.(count);
|
|
41555
41589
|
};
|
|
41556
41590
|
const armFallback = () => {
|
|
@@ -48774,8 +48808,8 @@ Integer Float Double Long Int32 Int64 Uint8 uint32_t int32_t uint64_t int64_t si
|
|
|
48774
48808
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ConnectionStatusChip, { compact: true }),
|
|
48775
48809
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
48776
48810
|
className: "rvs-build",
|
|
48777
|
-
title: `dsh-remote-vs build
|
|
48778
|
-
children: "
|
|
48811
|
+
title: `dsh-remote-vs build 1112-1558`,
|
|
48812
|
+
children: "1112-1558"
|
|
48779
48813
|
}),
|
|
48780
48814
|
tokenCount !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
48781
48815
|
className: "rvs-build",
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as keysDir, S as ensurePrivateDir, _ as clampExecTimeout, a as probe, b as aliasRoot, c as RemoteFiles, d as DEFAULT_GIT_TIMEOUT_MS, f as DEFAULT_READ_TIMEOUT_MS, g as MIN_TIMEOUT_MS, h as MAX_TIMEOUT_MS, i as helperAvailability, l as WriteConflictError, m as DeadlineError, n as TombstonedError, o as pushPipeline, p as DEFAULT_TIMEOUTS, s as seedHelperCache, t as RemoteWorlds, u as attachmentHeader, v as resolveTimeouts, w as storePath, x as dshHome, y as require_lib } from "./worlds-DSzyajOB.js";
|
|
2
2
|
import z from "@deepseek-ai/schemastery";
|
|
3
3
|
import { chmodSync, closeSync, existsSync, fsyncSync, mkdirSync, openSync, readFileSync, renameSync, statSync, writeSync } from "node:fs";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -4661,6 +4661,130 @@ function makeRoutes(deps) {
|
|
|
4661
4661
|
};
|
|
4662
4662
|
}
|
|
4663
4663
|
//#endregion
|
|
4664
|
+
//#region src/preset-switch.ts
|
|
4665
|
+
/**
|
|
4666
|
+
* Auto-switch decision for a new session born in a remote workspace.
|
|
4667
|
+
*
|
|
4668
|
+
* Why this module is pure
|
|
4669
|
+
* -----------------------
|
|
4670
|
+
* The 2026-11-10 bug was "sometimes no preset switch about 3 s after creating a
|
|
4671
|
+
* session". Two independent causes had to be found by reading the Host:
|
|
4672
|
+
*
|
|
4673
|
+
* 1. **The switch only listened to `source === 'startup'`.** The Web client does
|
|
4674
|
+
* not always mint a session: `session.create` accepts a named BLANK session
|
|
4675
|
+
* and reuses it (`createInWorkspace` passes the first listed blank id), which
|
|
4676
|
+
* the Host answers through `agents.resume` → `agent/created` with source
|
|
4677
|
+
* `'resume'`. Those sessions never even armed the timer.
|
|
4678
|
+
* 2. **A single 2.5 s shot lost every transient state.** At fire time the preset
|
|
4679
|
+
* may not be composed yet, the working directory may be unreadable, or the
|
|
4680
|
+
* workspace binding may not be listed; each guard returned silently, and the
|
|
4681
|
+
* one chance was spent.
|
|
4682
|
+
*
|
|
4683
|
+
* The fix keeps the "never block session creation" contract and turns the
|
|
4684
|
+
* decision into a pure function plus a bounded retry loop, so every branch is
|
|
4685
|
+
* covered by a gate instead of being inferred from a silent return.
|
|
4686
|
+
*
|
|
4687
|
+
* Blankness — no turn started — is the real precondition (`presets.select`
|
|
4688
|
+
* enforces exactly that), and it is also what excludes resumed sessions with
|
|
4689
|
+
* history. The event source only told us how the session came to be.
|
|
4690
|
+
*/
|
|
4691
|
+
/** Preset id this plugin switches remote sessions to (see `cordis.patch.yml`). */
|
|
4692
|
+
const REMOTE_PRESET_ID = "remote";
|
|
4693
|
+
/** Delay before each attempt, in order. The first attempt keeps the old 2.5 s. */
|
|
4694
|
+
const PRESET_SWITCH_DELAYS_MS = [
|
|
4695
|
+
2500,
|
|
4696
|
+
1e3,
|
|
4697
|
+
1500,
|
|
4698
|
+
2e3,
|
|
4699
|
+
3e3
|
|
4700
|
+
];
|
|
4701
|
+
/**
|
|
4702
|
+
* Decide one attempt.
|
|
4703
|
+
*
|
|
4704
|
+
* Order matters: the terminal reasons come first (config, history, user choice),
|
|
4705
|
+
* then the transient ones (composed preset, cwd, route), then the switch.
|
|
4706
|
+
*/
|
|
4707
|
+
function decidePresetSwitch(facts) {
|
|
4708
|
+
if (facts.mode !== "enforce") return {
|
|
4709
|
+
action: "stop",
|
|
4710
|
+
reason: "routing-off"
|
|
4711
|
+
};
|
|
4712
|
+
if (!facts.hasPresets) return {
|
|
4713
|
+
action: "stop",
|
|
4714
|
+
reason: "presets-absent"
|
|
4715
|
+
};
|
|
4716
|
+
if (!facts.blank) return {
|
|
4717
|
+
action: "stop",
|
|
4718
|
+
reason: "not-blank"
|
|
4719
|
+
};
|
|
4720
|
+
if (facts.currentPreset === "remote") return {
|
|
4721
|
+
action: "stop",
|
|
4722
|
+
reason: "already-remote"
|
|
4723
|
+
};
|
|
4724
|
+
if (facts.currentPreset === void 0) return {
|
|
4725
|
+
action: "retry",
|
|
4726
|
+
reason: "preset-unbound"
|
|
4727
|
+
};
|
|
4728
|
+
if (facts.currentPreset !== facts.defaultPreset) return {
|
|
4729
|
+
action: "stop",
|
|
4730
|
+
reason: "custom-preset"
|
|
4731
|
+
};
|
|
4732
|
+
if (facts.cwd.trim() === "") return {
|
|
4733
|
+
action: "retry",
|
|
4734
|
+
reason: "cwd-unavailable"
|
|
4735
|
+
};
|
|
4736
|
+
if (facts.tombstoned) return {
|
|
4737
|
+
action: "stop",
|
|
4738
|
+
reason: "tombstoned"
|
|
4739
|
+
};
|
|
4740
|
+
if (facts.remote === void 0) return {
|
|
4741
|
+
action: "retry",
|
|
4742
|
+
reason: "route-unknown"
|
|
4743
|
+
};
|
|
4744
|
+
if (!facts.remote) return {
|
|
4745
|
+
action: "stop",
|
|
4746
|
+
reason: "local-session"
|
|
4747
|
+
};
|
|
4748
|
+
return { action: "switch" };
|
|
4749
|
+
}
|
|
4750
|
+
/** Wait for `ms`, unref'd so a pending switch never keeps the Host alive. */
|
|
4751
|
+
function defaultSleep(ms) {
|
|
4752
|
+
return new Promise((resolve) => {
|
|
4753
|
+
setTimeout(resolve, ms).unref?.();
|
|
4754
|
+
});
|
|
4755
|
+
}
|
|
4756
|
+
/**
|
|
4757
|
+
* Run attempts with the given delays until one stops or switches.
|
|
4758
|
+
*
|
|
4759
|
+
* A retry is only worth spending for the transient reasons the planner names;
|
|
4760
|
+
* the loop itself does not re-classify, so a future terminal reason added to the
|
|
4761
|
+
* planner stays terminal automatically.
|
|
4762
|
+
*
|
|
4763
|
+
* @returns the last attempt and how many attempts were used (1-based).
|
|
4764
|
+
*/
|
|
4765
|
+
async function runPresetSwitchAttempts(attempt, sleep = defaultSleep, delays = PRESET_SWITCH_DELAYS_MS) {
|
|
4766
|
+
let last;
|
|
4767
|
+
let attempts = 0;
|
|
4768
|
+
for (const delay of delays) {
|
|
4769
|
+
attempts += 1;
|
|
4770
|
+
await sleep(delay);
|
|
4771
|
+
last = await attempt();
|
|
4772
|
+
if (last.step.action !== "retry") return {
|
|
4773
|
+
step: last.step,
|
|
4774
|
+
facts: last.facts,
|
|
4775
|
+
attempts
|
|
4776
|
+
};
|
|
4777
|
+
}
|
|
4778
|
+
return {
|
|
4779
|
+
step: last === void 0 ? {
|
|
4780
|
+
action: "stop",
|
|
4781
|
+
reason: "services-absent"
|
|
4782
|
+
} : last.step,
|
|
4783
|
+
facts: last?.facts,
|
|
4784
|
+
attempts
|
|
4785
|
+
};
|
|
4786
|
+
}
|
|
4787
|
+
//#endregion
|
|
4664
4788
|
//#region src/changes/status.ts
|
|
4665
4789
|
/** Exit statuses of the read commands (git's own statuses pass through as-is). */
|
|
4666
4790
|
const READ_EXIT = {
|
|
@@ -6817,43 +6941,117 @@ function apply(ctx, config) {
|
|
|
6817
6941
|
ctx.on("loader/volatile-update", () => {
|
|
6818
6942
|
sync();
|
|
6819
6943
|
});
|
|
6944
|
+
/**
|
|
6945
|
+
* Preset auto-switch for a new session born in a remote workspace (Phase 4b).
|
|
6946
|
+
*
|
|
6947
|
+
* 2026-11-10, bug "sometimes no Remote preset ~3 s after creating a session":
|
|
6948
|
+
*
|
|
6949
|
+
* - The Web client does not always MINT a session. `createInWorkspace` reuses
|
|
6950
|
+
* the first listed BLANK session of the workspace by passing its id, and the
|
|
6951
|
+
* Host answers that through `agents.resume` → `agent/created` with source
|
|
6952
|
+
* `'resume'`. The old `source !== 'startup'` guard silently skipped exactly
|
|
6953
|
+
* those sessions. Blankness (no turn started) is the precondition the preset
|
|
6954
|
+
* registry itself enforces, so it is what we check now — a resumed session
|
|
6955
|
+
* with history is excluded by it.
|
|
6956
|
+
* - One 2.5 s shot also lost every transient state: the preset may not be
|
|
6957
|
+
* composed yet, the working directory may be unreadable, or the workspace
|
|
6958
|
+
* binding may not be listed. `runPresetSwitchAttempts` retries those for a
|
|
6959
|
+
* bounded time and stops on terminal reasons (routing off, history, user's
|
|
6960
|
+
* own preset, local directory).
|
|
6961
|
+
*
|
|
6962
|
+
* The listener still DETACHES: it returns immediately, so session creation
|
|
6963
|
+
* never waits for a switch (the original 2026-10-13 race: selecting during
|
|
6964
|
+
* creation while both preset trees register tools could kill the session).
|
|
6965
|
+
* Failure modes are logged, never thrown; manual selection stays the fallback.
|
|
6966
|
+
*/
|
|
6967
|
+
const attemptPresetSwitch = async (agent) => {
|
|
6968
|
+
const presets = ctx.get("agentPresets");
|
|
6969
|
+
const agents = ctx.get("agents");
|
|
6970
|
+
const workingDirectory = ctx.get("workingDirectory");
|
|
6971
|
+
let boundary;
|
|
6972
|
+
try {
|
|
6973
|
+
boundary = agents?.turnBoundaryOf?.(agent.session);
|
|
6974
|
+
} catch {
|
|
6975
|
+
boundary = void 0;
|
|
6976
|
+
}
|
|
6977
|
+
let cwd = "";
|
|
6978
|
+
try {
|
|
6979
|
+
const current = workingDirectory?.get?.(agent.session);
|
|
6980
|
+
if (typeof current === "string") cwd = current;
|
|
6981
|
+
} catch {}
|
|
6982
|
+
let remote;
|
|
6983
|
+
let tombstoned = false;
|
|
6984
|
+
if (cwd !== "") try {
|
|
6985
|
+
remote = worlds.routeDir(cwd).kind === "remote";
|
|
6986
|
+
} catch (error) {
|
|
6987
|
+
if (error instanceof TombstonedError) tombstoned = true;
|
|
6988
|
+
}
|
|
6989
|
+
let currentPreset;
|
|
6990
|
+
let defaultPreset;
|
|
6991
|
+
try {
|
|
6992
|
+
currentPreset = presets?.composedPreset(agent.ctx);
|
|
6993
|
+
defaultPreset = presets?.defaultId;
|
|
6994
|
+
} catch {
|
|
6995
|
+
currentPreset = void 0;
|
|
6996
|
+
defaultPreset = void 0;
|
|
6997
|
+
}
|
|
6998
|
+
const facts = {
|
|
6999
|
+
mode: worlds.mode,
|
|
7000
|
+
hasPresets: presets !== void 0,
|
|
7001
|
+
blank: boundary !== void 0 && boundary.openTurnStartSeq === null && boundary.lastTurn === 0,
|
|
7002
|
+
cwd,
|
|
7003
|
+
remote,
|
|
7004
|
+
tombstoned,
|
|
7005
|
+
currentPreset,
|
|
7006
|
+
defaultPreset
|
|
7007
|
+
};
|
|
7008
|
+
const step = decidePresetSwitch(facts);
|
|
7009
|
+
if (step.action !== "switch") return {
|
|
7010
|
+
step,
|
|
7011
|
+
facts
|
|
7012
|
+
};
|
|
7013
|
+
if (presets === void 0) return {
|
|
7014
|
+
step: {
|
|
7015
|
+
action: "stop",
|
|
7016
|
+
reason: "presets-absent"
|
|
7017
|
+
},
|
|
7018
|
+
facts
|
|
7019
|
+
};
|
|
7020
|
+
try {
|
|
7021
|
+
await presets.select(agent, REMOTE_PRESET_ID);
|
|
7022
|
+
return {
|
|
7023
|
+
step: {
|
|
7024
|
+
action: "stop",
|
|
7025
|
+
reason: "switched"
|
|
7026
|
+
},
|
|
7027
|
+
facts
|
|
7028
|
+
};
|
|
7029
|
+
} catch (error) {
|
|
7030
|
+
const locked = error instanceof Error && /locked|already started/i.test(error.message);
|
|
7031
|
+
return {
|
|
7032
|
+
step: {
|
|
7033
|
+
action: locked ? "stop" : "retry",
|
|
7034
|
+
reason: locked ? "locked" : "select-failed"
|
|
7035
|
+
},
|
|
7036
|
+
facts
|
|
7037
|
+
};
|
|
7038
|
+
}
|
|
7039
|
+
};
|
|
6820
7040
|
ctx.on("agent/created", (payload) => {
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
7041
|
+
(async () => {
|
|
7042
|
+
try {
|
|
7043
|
+
const { step, facts, attempts } = await runPresetSwitchAttempts(() => attemptPresetSwitch(payload.agent));
|
|
6824
7044
|
try {
|
|
6825
|
-
|
|
6826
|
-
if (
|
|
6827
|
-
if (
|
|
6828
|
-
|
|
6829
|
-
|
|
6830
|
-
|
|
6831
|
-
|
|
6832
|
-
|
|
6833
|
-
|
|
6834
|
-
|
|
6835
|
-
} catch {
|
|
6836
|
-
return;
|
|
6837
|
-
}
|
|
6838
|
-
let remote = false;
|
|
6839
|
-
try {
|
|
6840
|
-
remote = worlds.routeDir(cwd).kind === "remote";
|
|
6841
|
-
} catch {
|
|
6842
|
-
return;
|
|
6843
|
-
}
|
|
6844
|
-
if (!remote) return;
|
|
6845
|
-
await presets.select(payload.agent, "remote");
|
|
6846
|
-
try {
|
|
6847
|
-
ctx.logger.info(`[remote-vs] new remote session entered ${cwd}; preset switched to remote`);
|
|
6848
|
-
} catch {}
|
|
6849
|
-
} catch (error) {
|
|
6850
|
-
if (error instanceof Error && /locked|already started/i.test(error.message)) return;
|
|
6851
|
-
try {
|
|
6852
|
-
ctx.logger.warn(`[remote-vs] preset auto-switch skipped: ${error instanceof Error ? error.message : String(error)}`);
|
|
6853
|
-
} catch {}
|
|
6854
|
-
}
|
|
6855
|
-
})();
|
|
6856
|
-
}, 2500).unref?.();
|
|
7045
|
+
if (step.reason === "switched" && facts?.remote === true) ctx.logger.info(`[remote-vs] remote session ${facts.cwd}: preset switched to ${REMOTE_PRESET_ID} after ${attempts} attempt(s)`);
|
|
7046
|
+
else if (step.action === "retry") ctx.logger.warn(`[remote-vs] preset auto-switch gave up after ${attempts} attempt(s): ${step.reason}`);
|
|
7047
|
+
else if (facts?.remote === true) ctx.logger.info(`[remote-vs] preset auto-switch skipped for ${facts.cwd}: ${step.reason}`);
|
|
7048
|
+
} catch {}
|
|
7049
|
+
} catch (error) {
|
|
7050
|
+
try {
|
|
7051
|
+
ctx.logger.warn(`[remote-vs] preset auto-switch skipped: ${error instanceof Error ? error.message : String(error)}`);
|
|
7052
|
+
} catch {}
|
|
7053
|
+
}
|
|
7054
|
+
})();
|
|
6857
7055
|
});
|
|
6858
7056
|
sync();
|
|
6859
7057
|
}
|
package/lib/p2-router-fs.js
CHANGED