dsh-code-server-app 0.2.11 → 0.2.13
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 +34 -10
- package/README.md +28 -11
- package/lib/index.js +27 -3
- package/package.json +17 -16
- package/scripts/vendor-vscode-server.mjs +7 -2
- package/vendor/VENDOR.json +5 -5
package/README.en.md
CHANGED
|
@@ -182,7 +182,7 @@ state preserved (no full reload). Full evidence and probe scripts: `docs/analysi
|
|
|
182
182
|
|
|
183
183
|
## code-server workspace and process lifecycle
|
|
184
184
|
|
|
185
|
-
- code-server's workspace **follows the active DSH session/workspace**: switching sessions/workspaces while the IDE is open
|
|
185
|
+
- code-server's workspace **follows the active DSH session/workspace**: switching sessions/workspaces while the IDE is open moves code-server to the new directory
|
|
186
186
|
(resolution order: current session cwd → session's workspace.path → recentWorkspace.path → first workspace.path);
|
|
187
187
|
the opened directory is shown inside code-server (`?folder=<cwd>`, the page reloads when following a switch);
|
|
188
188
|
implementation note: the iframe `src` must carry `?folder=<cwd>` — code-server's front-end remembers the "last workspace" and restores it by itself;
|
|
@@ -190,15 +190,31 @@ state preserved (no full reload). Full evidence and probe scripts: `docs/analysi
|
|
|
190
190
|
**Windows path format (verified)**: the `folder` parameter must start with `/` and use forward slashes only, e.g. `/C:/Users/User/Desktop/biss`;
|
|
191
191
|
a bare Windows path (`C:\...`) is parsed as a URI scheme and the drive letter is stripped (page shows `\Users\User\...` with an empty file tree),
|
|
192
192
|
while `file:///C:/...` reports "Workspace does not exist".
|
|
193
|
+
- **The switch is lightweight (since 0.2.12)**: a running instance is **not restarted** when the workspace changes — the host
|
|
194
|
+
only updates `state.cwd` and the workbench re-navigates with the new `?folder=` (the workspace directory was always the
|
|
195
|
+
client URL's business; the process cwd only affects the server's own relative-path resolution at spawn time). The switch is
|
|
196
|
+
much faster and no longer throws away the extension host, background tasks or server-side state.
|
|
197
|
+
- In `status`, `cwd` is the current workbench directory; `launchCwd` is the directory the **process was started with**
|
|
198
|
+
(diagnostics only; it does not change on a switch).
|
|
199
|
+
- The trade-off, stated plainly: background processes/terminals started by the IDE in the **old** directory are no longer
|
|
200
|
+
killed automatically (a full restart used to take them with it) — clean them up yourself if needed. That is the same coin
|
|
201
|
+
as "nothing is lost".
|
|
202
|
+
- The trigger does not depend on the tab being visible: **the tab body is not unmounted while the sidebar is collapsed**,
|
|
203
|
+
so it also follows in the background (behaviour deliberately kept in 0.2.12).
|
|
204
|
+
- Regression: `scripts/test-workspace-switch.mjs` (5 assertions: adopting an instance, cwd change keeps pid/status, the
|
|
205
|
+
process stays alive, same-directory idempotence, no-cwd does not switch; it fails again if the old behaviour returns).
|
|
193
206
|
- Process lifecycle is managed by the host plugin: startup writes `$DSH_HOME/code-server/pid.json`, stop kills the tree (`taskkill /T` or process-group SIGKILL),
|
|
194
207
|
crash/exit updates status live; after a DSH host restart the plugin **adopts** a still-running instance (verifies pid + `/healthz`), without duplicate start or killing unrelated processes;
|
|
195
208
|
- `node_modules` and the pack-time artifact `vendor/` are git-ignored; after cloning, follow
|
|
196
209
|
"Install the plugin (script-free install; code-server bundled)" below — `pnpm install` → `pnpm run build:client` →
|
|
197
210
|
`pnpm run vendor:vscode` → `pnpm pack` + `dsh plugin --profile web add`.
|
|
198
211
|
|
|
199
|
-
> Verified locally (BM: Windows 11 ARM64):
|
|
200
|
-
>
|
|
201
|
-
>
|
|
212
|
+
> Verified locally (BM: Windows 11 ARM64): the whole tree/dependency chain is supplied by per-platform
|
|
213
|
+
> sub-packages — the tree package `@jinsiyu/dshcs-vscode-server` (currently 4.137.0, a 50.8 MB tarball),
|
|
214
|
+
> the pure-JS inner dependencies directly in the plugin's `dependencies`, and 16 prebuilt native modules
|
|
215
|
+
> re-exported under their original names by the aggregator `@jinsiyu/dsh-code-server-runtime-win32-<arch>`
|
|
216
|
+
> (picked by os/cpu) → healthz 200 → stopped → fully recycled.
|
|
217
|
+
> (The 0.1.37-era "one big platform package" layout is gone — see "Upgrading the VS Code tree" below.)
|
|
202
218
|
|
|
203
219
|
## Packaging (how to build the tarball)
|
|
204
220
|
|
|
@@ -236,7 +252,7 @@ pnpm run promote -- <version>
|
|
|
236
252
|
| Goal | Command |
|
|
237
253
|
|---|---|
|
|
238
254
|
| **Build from the latest upstream release** | `pnpm run vendor:latest` (= `--force`): pulls `code-server@latest`'s tree into `vendor/vscode`; afterwards you **must** re-run `repack:build` and republish every sub-package |
|
|
239
|
-
| **Pin a version** | `pnpm run vendor:vscode -- --version 4.
|
|
255
|
+
| **Pin a version** | `pnpm run vendor:vscode -- --version 4.137.0` |
|
|
240
256
|
| **Snapshot from an existing tree** | `pnpm run vendor:vscode -- --from <code-server dir>` (seconds) |
|
|
241
257
|
| **Rebuild every sub-package** | `pnpm run repack:build -- --target win32-arm64,win32-x64 --pack` (without `--from` it npm-installs and compiles the source tree itself — slow) |
|
|
242
258
|
| **Rebuild only the tree/aggregator packages** | `node scripts/vendor-repacks.mjs --reuse --target win32-arm64,win32-x64 --pack` (reuses the natives already in `repack/build`) |
|
|
@@ -368,8 +384,17 @@ dsh plugin --profile web add C:\Users\User\Desktop\dsh-code-server-app
|
|
|
368
384
|
### Upgrading the VS Code tree (upstream = a code-server release)
|
|
369
385
|
|
|
370
386
|
- **The version is decided at pack time**: `pnpm run vendor:latest` (= `--force`) pulls the tree of the npm **latest**
|
|
371
|
-
release; or use `pnpm run vendor:vscode -- --version 4.
|
|
387
|
+
release; or use `pnpm run vendor:vscode -- --version 4.137.0` / `DSHCS_CODE_SERVER_VERSION`.
|
|
372
388
|
With an existing `vendor/vscode`, a plain `pnpm pack` never upgrades (it is a no-op).
|
|
389
|
+
**Source-tree precedence (fixed in 0.2.13)**: an explicit `--from` uses that tree, while an explicit
|
|
390
|
+
`--force`/`--version` now **always goes to the registry** — before the fix a local source tree won
|
|
391
|
+
(`defaultSourceTree()` hit `vendor/code-server` or an installed profile tree first), so the documented
|
|
392
|
+
"`vendor:latest` takes latest from the registry" silently kept the old version (hit while upgrading to 0.2.13:
|
|
393
|
+
the bundled tree stayed at 4.136.2). A run with neither flag still reuses a local tree to save the download.
|
|
394
|
+
- **Sync the inner dependency pins when the tree changes**: in `--reuse` mode the pure-JS install set is read from
|
|
395
|
+
the **plugin's package.json**, so update those pins from the new tree's `lib/vscode/package.json` first
|
|
396
|
+
(this time: 10 `@xterm/*` beta bumps). The rule is "only move a pin that no longer satisfies the new range",
|
|
397
|
+
which keeps already-newer pins such as `cookie`/`ws`/`tar`/`node-addon-api` from being downgraded.
|
|
373
398
|
- **Check first**: `pnpm run vendor:check` prints the bundled version / upstream latest.
|
|
374
399
|
- **A version bump means rebuilding and republishing the sub-packages** (all with the same script):
|
|
375
400
|
1. `pnpm run repack:build -- --target win32-arm64,win32-x64 --pack` → the new tree package
|
|
@@ -380,7 +405,7 @@ dsh plugin --profile web add C:\Users\User\Desktop\dsh-code-server-app
|
|
|
380
405
|
- `productPath` (`<quality>-<commit>`, part of the client WebSocket path) is **computed from `lib/vscode/product.json`**,
|
|
381
406
|
so upgrading the tree needs no code change — but the routes are registered at activation, so restart `dsh web` afterwards.
|
|
382
407
|
- **No runtime auto-upgrade anymore**: nothing fetches latest at startup; the version is fully determined by the bundled artifact.
|
|
383
|
-
- Bundled locally right now: the tree of `code-server@4.
|
|
408
|
+
- Bundled locally right now: the tree of `code-server@4.137.0` (VS Code 1.137.0, `productPath=stable-b11dabda…`).
|
|
384
409
|
|
|
385
410
|
### Compatibility with the old install locations
|
|
386
411
|
|
|
@@ -447,7 +472,7 @@ Host/Origin fence and browser auth); in the desktop profile `apps/desktop-host`
|
|
|
447
472
|
| Method | Path | Description |
|
|
448
473
|
|---|---|---|
|
|
449
474
|
| GET | `/api/code-server/status` | `{ ok, running, status, host, port, pid, cwd, url, version, error, logTail, adopted }` (also `env` environment check and the `setup` compatibility field) |
|
|
450
|
-
| POST | `/api/code-server/start` | body `{ cwd? }` (omit cwd to keep the current workspace); idempotent |
|
|
475
|
+
| POST | `/api/code-server/start` | body `{ cwd? }` (omit cwd to keep the current workspace); idempotent; changing cwd while running only **switches the directory, without restarting the process** (0.2.12) |
|
|
451
476
|
| POST | `/api/code-server/stop` | Stop and recycle the process tree |
|
|
452
477
|
| POST | `/api/code-server/setup` | **Compatibility no-op**: since 0.1.36 dependencies are installed by the package manager, so this only re-runs the env self-check and returns |
|
|
453
478
|
| POST | `/api/code-server/open-file` | body `{ file }` — writes the signal consumed by the built-in `dshcs-open-file` extension to open the file in code-server |
|
|
@@ -533,8 +558,7 @@ What remains on the plugin side:
|
|
|
533
558
|
works). Use `serve: loopback` when you need it.
|
|
534
559
|
- **`serve: dsh` shares DSH's origin**, so the iframe is not sandboxed there (same-origin plus `allow-same-origin` is
|
|
535
560
|
escapable by the frame itself); in `loopback` mode the iframe is cross-origin and `sandbox` stays as real protection.
|
|
536
|
-
- **Single instance across sessions**: one shared IDE per host; switching cwd
|
|
537
|
-
handles it and hints).
|
|
561
|
+
- **Single instance across sessions**: one shared IDE per host; switching cwd only re-navigates the workbench (since 0.2.12 no process restart, so the old directory's background terminals are not collected).
|
|
538
562
|
- **Older DSH versions are unsupported (since 0.2.3)**: on a DSH without `sidebarRightTabs` / `sidebarRight` the plugin
|
|
539
563
|
offers nothing but an upgrade notice on the settings page; older-DSH users should stay on `0.2.2`
|
|
540
564
|
(`dsh plugin --profile web add dsh-code-server-app@0.2.2`).
|
package/README.md
CHANGED
|
@@ -182,7 +182,7 @@ DSH 用**资源地址**命名文件,`openFile` 只负责把地址交给右侧栏
|
|
|
182
182
|
|
|
183
183
|
## code-server 服务目录与进程生命周期
|
|
184
184
|
|
|
185
|
-
- code-server 服务目录**跟随活动工作区/会话**:打开期间切换 DSH 会话/工作区,code-server
|
|
185
|
+
- code-server 服务目录**跟随活动工作区/会话**:打开期间切换 DSH 会话/工作区,code-server 自动切到新目录
|
|
186
186
|
(解析优先级:当前会话 cwd → 会话所属 workspace.path → recentWorkspace.path → 首个 workspace.path);
|
|
187
187
|
打开目录显示在 code-server 页面内(`?folder=<cwd>`,跟随切换时页面自动重新加载);
|
|
188
188
|
实现要点:iframe src 必须带 `?folder=<cwd>`——code-server 前端会记住“最近工作区”并自行恢复,
|
|
@@ -190,16 +190,26 @@ DSH 用**资源地址**命名文件,`openFile` 只负责把地址交给右侧栏
|
|
|
190
190
|
**Windows 路径格式(实测)**:folder 参数必须以 `/` 开头且全部正斜杠,形如 `/C:/Users/User/Desktop/biss`;
|
|
191
191
|
裸 Windows 路径(`C:\...`)会被前端当 URI scheme 而剥掉盘符(页面显示 `\Users\User\...` 且文件树为空),
|
|
192
192
|
`file:///C:/...` 形式则报 “Workspace does not exist”。
|
|
193
|
+
- **切换是"轻量"的(0.2.12 起)**:运行中切工作区**不重启 IDE 进程**,host 只把 `state.cwd` 改成新目录,
|
|
194
|
+
由 workbench 拿新的 `?folder=` 重新导航(工作区目录本来就由客户端 URL 决定,进程 cwd 只影响它自己
|
|
195
|
+
spawn 时的相对路径解析)。因此切换**不再丢**扩展宿主/后台任务/服务端状态,也快得多。
|
|
196
|
+
- `status` 里 `cwd` = 当前 workbench 目录;`launchCwd` = **进程启动时**的目录(诊断用,不随切换变化)。
|
|
197
|
+
- 代价(要说清楚):旧目录里**由 IDE 拉起的后台进程/终端不再被自动杀掉**(以前靠"整进程重启"顺带收走)——
|
|
198
|
+
需要时手动收;这也是"不丢状态"的同一枚硬币。
|
|
199
|
+
- 触发时机与本标签是否可见无关:**侧栏收起时标签 body 并不卸载**,所以后台也会跟随(0.2.12 明确保留此行为)。
|
|
200
|
+
- 回归:`scripts/test-workspace-switch.mjs`(5 项:接管实例、切目录不改 pid/不换状态、进程存活、
|
|
201
|
+
同目录幂等、无 cwd 不切换;改回旧行为必挂)。
|
|
193
202
|
- process 生命周期由 host 插件管理:启动写 `$DSH_HOME/code-server/pid.json`,停止树级终止(taskkill /T 或进程组 SIGKILL),
|
|
194
203
|
崩溃/退出实时更新状态;DSH host 重启后自动 adopt 仍在运行的实例(校验 pid + /healthz),不重复启动、不误杀别的进程;
|
|
195
204
|
- `node_modules`、`vendor/` 与 `repack/` 已被 `.gitignore` 排除,推送/克隆仓库后按下方
|
|
196
205
|
"打包(如何出包)"执行 `pnpm install` → `pnpm run build:client` → `pnpm run vendor:vscode` →
|
|
197
206
|
(发布预编译原生包)→ `pnpm pack` + `dsh plugin --profile web add` 即可。
|
|
198
207
|
|
|
199
|
-
> 本机(BM: Windows 11 ARM64)
|
|
200
|
-
> `@jinsiyu/dshcs-
|
|
201
|
-
>
|
|
202
|
-
>
|
|
208
|
+
> 本机(BM: Windows 11 ARM64)实测:树/依赖全链路是"平台子包 + 聚合包"供给 ——
|
|
209
|
+
> 树包 `@jinsiyu/dshcs-vscode-server`(当前 4.137.0,50.8 MB tgz)、纯 JS 内部依赖直接进插件
|
|
210
|
+
> `dependencies`、16 个预编译原生包经平台聚合包 `@jinsiyu/dsh-code-server-runtime-win32-<arch>`
|
|
211
|
+
> (按 os/cpu 自动选)装回原名 → healthz 200 → 停止 → 回收全链路验证。
|
|
212
|
+
> (0.1.37 时代的主包形态已废弃,见下方"升级 VS Code 树"。)
|
|
203
213
|
|
|
204
214
|
## 打包(如何出包)
|
|
205
215
|
|
|
@@ -237,7 +247,7 @@ pnpm run promote -- <version>
|
|
|
237
247
|
| 目标 | 命令 |
|
|
238
248
|
|---|---|
|
|
239
249
|
| **打最新版(上游 code-server 发行版)** | `pnpm run vendor:latest`(= `--force`):从 registry 取 `code-server@latest` 的树到 `vendor/vscode`;之后**必须**重跑 `repack:build` 并重发全部子包 |
|
|
240
|
-
| **指定版本** | `pnpm run vendor:vscode -- --version 4.
|
|
250
|
+
| **指定版本** | `pnpm run vendor:vscode -- --version 4.137.0` |
|
|
241
251
|
| **从已装好的树快照** | `pnpm run vendor:vscode -- --from <code-server 目录>`(秒级) |
|
|
242
252
|
| **开发期让树可直接跑** | `pnpm run vendor:vscode -- --dev-links`(额外把 `lib/vscode/node_modules` 用 junction 补上) |
|
|
243
253
|
| **完整重打子包** | `pnpm run repack:build -- --target win32-arm64,win32-x64 --pack`(不给 `--from` 会自动 npm install 解包 + 编译,耗时) |
|
|
@@ -375,8 +385,15 @@ dsh plugin --profile web add C:\Users\User\Desktop\dsh-code-server-app
|
|
|
375
385
|
### 升级 VS Code 树(上游 = code-server 发行版)
|
|
376
386
|
|
|
377
387
|
- **打包期决定版本**:`pnpm run vendor:latest`(= `--force`)取 npm **最新版 code-server** 的树并重建 `vendor/vscode`;
|
|
378
|
-
也可 `pnpm run vendor:vscode -- --version 4.
|
|
388
|
+
也可 `pnpm run vendor:vscode -- --version 4.137.0` 或设 `DSHCS_CODE_SERVER_VERSION`。
|
|
379
389
|
已有 `vendor/vscode` 时,不带 `--force`/`--version` 不会升级(日常 `pnpm pack` 是 no-op)。
|
|
390
|
+
**源树优先级(0.2.13 修正)**:显式 `--from` 用给定树;显式 `--force`/`--version` **一定走 registry**
|
|
391
|
+
—— 修正前它们会被"本机已有源树"抢走(`defaultSourceTree()` 先命中 `vendor/code-server` 或 profile 里的旧树),
|
|
392
|
+
于是 README 写的"`vendor:latest` 从 registry 取 latest"实际拿不到新版本(0.2.13 升级时踩到:内置树一直停在 4.136.2);
|
|
393
|
+
只有既没 `--force` 也没 `--version` 时才复用本机源树省一次下载。
|
|
394
|
+
- **换版本时同步树内依赖 pin**:`--reuse` 模式下纯 JS 直装集是从**插件 package.json 现读**的,
|
|
395
|
+
所以要先按新树的 `lib/vscode/package.json` 更新 pin(本次 10 个 `@xterm/*` 的 beta 跳号;
|
|
396
|
+
判定规则是"现有 pin 不满足新范围才动",避免把 `cookie`/`ws`/`tar`/`node-addon-api` 这类已有更高版本降级)。
|
|
380
397
|
- **先查再升**:`pnpm run vendor:check` 打印「内置版本 / 上游 latest」。
|
|
381
398
|
- **换版本后重新出子包并发布**(全部由同一个脚本):
|
|
382
399
|
1. `pnpm run repack:build -- --target win32-arm64,win32-x64 --pack` → 新的树包
|
|
@@ -386,7 +403,7 @@ dsh plugin --profile web add C:\Users\User\Desktop\dsh-code-server-app
|
|
|
386
403
|
- `productPath`(`<quality>-<commit>`,客户端 WS 路径的组成)**从 `lib/vscode/product.json` 现算**,
|
|
387
404
|
升级树后无需改代码 —— 但也意味着切版本后必须重启 dsh web(路由在激活期注册)。
|
|
388
405
|
- **不再有运行期自动升级**:不会在启动时联网取 latest;版本完全由内置产物决定。
|
|
389
|
-
- 本机当前内置:`code-server@4.
|
|
406
|
+
- 本机当前内置:`code-server@4.137.0` 的树(VS Code 1.137.0,`productPath=stable-b11dabda…`)。
|
|
390
407
|
|
|
391
408
|
### 兼容旧安装位
|
|
392
409
|
|
|
@@ -449,8 +466,8 @@ desktop profile 由 `apps/desktop-host` 把 `/api/*` 交给同一个 `createShar
|
|
|
449
466
|
|
|
450
467
|
| 方法 | 路径 | 说明 |
|
|
451
468
|
|---|---|---|
|
|
452
|
-
| GET | `/api/code-server/status` | `{ ok, running, status, host, port, pid, cwd, url, version, error, logTail, adopted }`(另含 `env` 环境检测与 `setup`
|
|
453
|
-
| POST | `/api/code-server/start` | body `{ cwd? }`(省略 cwd 不切换工作目录)
|
|
469
|
+
| GET | `/api/code-server/status` | `{ ok, running, status, host, port, pid, cwd, launchCwd, url, version, error, logTail, adopted }`(另含 `env` 环境检测与 `setup` 兼容字段;`cwd` = 当前 workbench 目录,`launchCwd` = 进程启动目录) |
|
|
470
|
+
| POST | `/api/code-server/start` | body `{ cwd? }`(省略 cwd 不切换工作目录);幂等;运行中切 cwd = **只换目录不重启进程**(0.2.12) |
|
|
454
471
|
| POST | `/api/code-server/stop` | 停止并回收进程树 |
|
|
455
472
|
| POST | `/api/code-server/setup` | **兼容空操作**:0.1.36 起依赖由包管理器安装,调用只重新自检 `env` 并返回 |
|
|
456
473
|
| POST | `/api/code-server/open-file` | body `{ file }` — 写信号文件,由内置扩展 `dshcs-open-file` 在 code-server 中打开 |
|
|
@@ -514,7 +531,7 @@ desktop profile 由 `apps/desktop-host` 把 `/api/*` 交给同一个 `createShar
|
|
|
514
531
|
→ 该模式下 Ports 面板的 **WebSocket** 转发不可用(HTTP 转发正常);需要时用 `serve: loopback`。
|
|
515
532
|
- **`serve: dsh` 的 iframe 与 DSH 同源** → 该模式不挂 `sandbox`(同源 + `allow-same-origin` 可被 frame 自行摘除);
|
|
516
533
|
`loopback` 模式跨源,`sandbox` 作为真防护保留。
|
|
517
|
-
- **跨会话单实例**:host 级共享一份 IDE;切换 cwd
|
|
534
|
+
- **跨会话单实例**:host 级共享一份 IDE;切换 cwd 只换 workbench 目录(0.2.12 起不重启进程,旧目录的后台终端不会被收走)。
|
|
518
535
|
- **旧版 DSH 不受支持(0.2.3 起)**:没有 `sidebarRightTabs`/`sidebarRight` 的 DSH 上,除设置页一条升级提示外无任何入口;
|
|
519
536
|
旧版用户请留在 `0.2.2`(`dsh plugin --profile web add dsh-code-server-app@0.2.2`)。
|
|
520
537
|
- **侧栏标签切换**(0.2.2 起不再重载):DSH 右侧栏只渲染当前激活标签的 body,React 卸载会移走 iframe;
|
package/lib/index.js
CHANGED
|
@@ -449,6 +449,8 @@ export async function apply(ctx, config) {
|
|
|
449
449
|
pid: null,
|
|
450
450
|
port: cfg.port,
|
|
451
451
|
cwd: null,
|
|
452
|
+
/** 进程**启动时**的工作目录(诊断用):运行时切工作区只改 cwd,进程 cwd 保持这里不变。 */
|
|
453
|
+
launchCwd: null,
|
|
452
454
|
version: null,
|
|
453
455
|
error: null,
|
|
454
456
|
logTail: '',
|
|
@@ -507,6 +509,7 @@ export async function apply(ctx, config) {
|
|
|
507
509
|
host: dshMode ? null : cfg.host,
|
|
508
510
|
pid: state.pid,
|
|
509
511
|
cwd: state.cwd,
|
|
512
|
+
launchCwd: state.launchCwd,
|
|
510
513
|
// dsh 模式:同源相对地址(由 DSH webServer 的 prefix 路由提供服务)
|
|
511
514
|
url: running ? (dshMode ? '/code-server/' : `http://${cfg.host}:${state.port}/`) : null,
|
|
512
515
|
productPath: state.env?.productPath ?? null,
|
|
@@ -617,6 +620,7 @@ export async function apply(ctx, config) {
|
|
|
617
620
|
state.status = 'stopped';
|
|
618
621
|
state.pid = null;
|
|
619
622
|
state.cwd = null;
|
|
623
|
+
state.launchCwd = null;
|
|
620
624
|
state.startedAt = null;
|
|
621
625
|
state.adopted = false;
|
|
622
626
|
if (reason) state.error = null;
|
|
@@ -663,13 +667,29 @@ export async function apply(ctx, config) {
|
|
|
663
667
|
return run;
|
|
664
668
|
}
|
|
665
669
|
|
|
670
|
+
/** 已运行实例切换工作区:**只改"当前 workbench 目录",不重启进程**。
|
|
671
|
+
*
|
|
672
|
+
* 为什么够用:工作区目录由客户端 URL 的 `&folder=<绝对路径>` 决定(见 src/factory.js 的
|
|
673
|
+
* buildPageUrl),服务进程自己的 cwd 只影响它 spawn 时对相对路径的解析;真正"换目录"是
|
|
674
|
+
* workbench 拿新 folder 重新导航(客户端导航 iframe)。
|
|
675
|
+
* 旧行为(0.2.11 及以前)在这里 stop('restart') + 重新 launch:切一次工作区就整进程重启,
|
|
676
|
+
* 编辑缓冲、终端、扩展宿主状态全丢,而且侧栏收起时是在后台悄悄发生。
|
|
677
|
+
* 进程 cwd 保持在 launchCwd 里,诊断时能看出"这个实例是哪个目录拉起来的"。 */
|
|
678
|
+
function adoptWorkspace(cwd) {
|
|
679
|
+
const previous = state.cwd;
|
|
680
|
+
state.cwd = cwd;
|
|
681
|
+
console.log(`[code-server] workspace switch: ${previous ?? '(none)'} -> ${cwd}`
|
|
682
|
+
+ `(不重启进程,进程 cwd 仍是 ${state.launchCwd ?? '(none)'};workbench 用新的 folder 重新导航)`);
|
|
683
|
+
return snapshot();
|
|
684
|
+
}
|
|
685
|
+
|
|
666
686
|
async function startInner(cwdArg) {
|
|
667
687
|
const cwd = typeof cwdArg === 'string' && cwdArg.trim() !== '' ? cwdArg : undefined;
|
|
668
688
|
if (state.status === 'running' && state.pid !== null) {
|
|
669
689
|
if (cwd === undefined || cwd === state.cwd) return snapshot();
|
|
670
|
-
|
|
690
|
+
return adoptWorkspace(cwd);
|
|
671
691
|
}
|
|
672
|
-
//
|
|
692
|
+
// 上一次启动仍在进行:等待它结算后再决定(运行中则同上面一样只换目录,不重启)
|
|
673
693
|
if (state.status === 'starting') {
|
|
674
694
|
const deadline = Date.now() + 10000;
|
|
675
695
|
while (state.status === 'starting' && Date.now() < deadline) {
|
|
@@ -683,7 +703,7 @@ export async function apply(ctx, config) {
|
|
|
683
703
|
}
|
|
684
704
|
if (state.status === 'running') {
|
|
685
705
|
if (cwd === undefined || cwd === state.cwd) return snapshot();
|
|
686
|
-
|
|
706
|
+
return adoptWorkspace(cwd);
|
|
687
707
|
}
|
|
688
708
|
}
|
|
689
709
|
|
|
@@ -710,6 +730,7 @@ export async function apply(ctx, config) {
|
|
|
710
730
|
state.status = 'running';
|
|
711
731
|
state.pid = record.pid;
|
|
712
732
|
state.cwd = cwd ?? record.cwd ?? null;
|
|
733
|
+
state.launchCwd = record.launchCwd ?? record.cwd ?? null;
|
|
713
734
|
state.startedAt = record.startedAt ?? null;
|
|
714
735
|
state.adopted = true;
|
|
715
736
|
return snapshot();
|
|
@@ -763,6 +784,7 @@ export async function apply(ctx, config) {
|
|
|
763
784
|
state.logTail = '';
|
|
764
785
|
state.status = 'starting';
|
|
765
786
|
state.cwd = cwd ?? null;
|
|
787
|
+
state.launchCwd = cwd ?? null;
|
|
766
788
|
state.startedAt = Date.now();
|
|
767
789
|
state.adopted = false;
|
|
768
790
|
|
|
@@ -809,6 +831,7 @@ export async function apply(ctx, config) {
|
|
|
809
831
|
pid: proc.pid,
|
|
810
832
|
startedAt: state.startedAt,
|
|
811
833
|
cwd: cwd ?? null,
|
|
834
|
+
launchCwd: cwd ?? null,
|
|
812
835
|
host: serve === 'dsh' ? null : cfg.host,
|
|
813
836
|
port: serve === 'dsh' ? null : cfg.port,
|
|
814
837
|
serve,
|
|
@@ -1080,6 +1103,7 @@ export async function apply(ctx, config) {
|
|
|
1080
1103
|
state.status = 'running';
|
|
1081
1104
|
state.pid = record.pid;
|
|
1082
1105
|
state.cwd = record.cwd ?? null;
|
|
1106
|
+
state.launchCwd = record.launchCwd ?? record.cwd ?? null;
|
|
1083
1107
|
state.startedAt = record.startedAt ?? null;
|
|
1084
1108
|
state.adopted = true;
|
|
1085
1109
|
console.log(`[code-server] adopted running instance pid=${record.pid} port=${cfg.port}`);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-code-server-app",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "VS Code (from a code-server release) inside DSH: a right-sidebar tab driven by the plugin's own launcher over the in-process VS Code server (lib/launcher.mjs). The tab claims DSH file addresses (dsh-resource://file/**), so the product's own produced-file chips, delivered-file previews and inline prose mentions open in the workbench. The IDE is a resident surface moved with Element.moveBefore instead of being remounted, so switching sidebar tabs no longer reloads it. Opening the tab switches the right sidebar to fullscreen by default (setting fullscreenOnOpen). Requires a DSH with the right-sidebar services (sidebarRightTabs/sidebarRight, >= 0.1.5-alpha.1); older DSH versions get a single upgrade notice on the settings page and no other UI. Two serving modes: loopback port (default) or same-origin mount on DSH's own webServer (/code-server, protected by ctx.connection.requestRejection). No code-server Node layer, no argon2, no C++ toolchain.",
|
|
3
|
+
"version": "0.2.13",
|
|
4
|
+
"description": "VS Code (from a code-server release) inside DSH: a right-sidebar tab driven by the plugin's own launcher over the in-process VS Code server (lib/launcher.mjs). The tab claims DSH file addresses (dsh-resource://file/**) by file type (setting claimExtensions), so the product's own produced-file chips, delivered-file previews and inline prose mentions open in the workbench. The IDE is a resident surface moved with Element.moveBefore instead of being remounted, so switching sidebar tabs no longer reloads it. Opening the tab switches the right sidebar to fullscreen by default (setting fullscreenOnOpen). Following a workspace switch is lightweight: the workbench re-navigates with the new ?folder= and the IDE process is not restarted (since 0.2.12). Requires a DSH with the right-sidebar services (sidebarRightTabs/sidebarRight, >= 0.1.5-alpha.1); older DSH versions get a single upgrade notice on the settings page and no other UI. Two serving modes: loopback port (default) or same-origin mount on DSH's own webServer (/code-server, protected by ctx.connection.requestRejection). No code-server Node layer, no argon2, no C++ toolchain.",
|
|
5
5
|
"homepage": "https://github.com/jinsiyu/dsh-code-server-app",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
},
|
|
63
63
|
"license": "MIT",
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@jinsiyu/dshcs-vscode-server": "4.
|
|
65
|
+
"@jinsiyu/dshcs-vscode-server": "4.137.0",
|
|
66
66
|
"@microsoft/1ds-core-js": "3.2.13",
|
|
67
67
|
"@microsoft/1ds-post-js": "3.2.13",
|
|
68
68
|
"@vscode/iconv-lite-umd": "0.7.1",
|
|
@@ -70,16 +70,16 @@
|
|
|
70
70
|
"@vscode/sandbox-runtime": "0.0.1",
|
|
71
71
|
"@vscode/tree-sitter-wasm": "0.3.1",
|
|
72
72
|
"@vscode/vscode-languagedetection": "1.0.23",
|
|
73
|
-
"@xterm/addon-clipboard": "0.3.0-beta.
|
|
74
|
-
"@xterm/addon-image": "0.10.0-beta.
|
|
75
|
-
"@xterm/addon-ligatures": "0.11.0-beta.
|
|
76
|
-
"@xterm/addon-progress": "0.3.0-beta.
|
|
77
|
-
"@xterm/addon-search": "0.17.0-beta.
|
|
78
|
-
"@xterm/addon-serialize": "0.15.0-beta.
|
|
79
|
-
"@xterm/addon-unicode11": "0.10.0-beta.
|
|
80
|
-
"@xterm/addon-webgl": "0.20.0-beta.
|
|
81
|
-
"@xterm/headless": "6.1.0-beta.
|
|
82
|
-
"@xterm/xterm": "6.1.0-beta.
|
|
73
|
+
"@xterm/addon-clipboard": "0.3.0-beta.302",
|
|
74
|
+
"@xterm/addon-image": "0.10.0-beta.300",
|
|
75
|
+
"@xterm/addon-ligatures": "0.11.0-beta.300",
|
|
76
|
+
"@xterm/addon-progress": "0.3.0-beta.300",
|
|
77
|
+
"@xterm/addon-search": "0.17.0-beta.300",
|
|
78
|
+
"@xterm/addon-serialize": "0.15.0-beta.300",
|
|
79
|
+
"@xterm/addon-unicode11": "0.10.0-beta.300",
|
|
80
|
+
"@xterm/addon-webgl": "0.20.0-beta.299",
|
|
81
|
+
"@xterm/headless": "6.1.0-beta.302",
|
|
82
|
+
"@xterm/xterm": "6.1.0-beta.303",
|
|
83
83
|
"cookie": "0.7.2",
|
|
84
84
|
"detect-libc": "2.1.2",
|
|
85
85
|
"http-proxy-agent": "7.0.0",
|
|
@@ -100,8 +100,8 @@
|
|
|
100
100
|
"zod": "4.4.3"
|
|
101
101
|
},
|
|
102
102
|
"optionalDependencies": {
|
|
103
|
-
"@jinsiyu/dsh-code-server-runtime-win32-arm64": "^0.2.
|
|
104
|
-
"@jinsiyu/dsh-code-server-runtime-win32-x64": "^0.2.
|
|
103
|
+
"@jinsiyu/dsh-code-server-runtime-win32-arm64": "^0.2.13",
|
|
104
|
+
"@jinsiyu/dsh-code-server-runtime-win32-x64": "^0.2.13"
|
|
105
105
|
},
|
|
106
106
|
"scripts": {
|
|
107
107
|
"vendor:vscode": "node scripts/vendor-vscode-server.mjs",
|
|
@@ -116,6 +116,7 @@
|
|
|
116
116
|
"test:apply": "node scripts/test-plugin-apply.mjs",
|
|
117
117
|
"test:launcher-routes": "node scripts/test-launcher-routes.mjs",
|
|
118
118
|
"test:fullscreen": "node scripts/test-sidebar-fullscreen.mjs",
|
|
119
|
-
"test:claim-types": "node scripts/test-claim-types.mjs"
|
|
119
|
+
"test:claim-types": "node scripts/test-claim-types.mjs",
|
|
120
|
+
"test:workspace-switch": "node scripts/test-workspace-switch.mjs"
|
|
120
121
|
}
|
|
121
122
|
}
|
|
@@ -200,14 +200,19 @@ async function main() {
|
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
const skip = existing !== null && !FORCE && FROM === null && PINNED === null;
|
|
203
|
+
// 源树优先级(0.2.13 修正):显式 `--from` 用给定树;显式 `--force`/`--version` 表示"就是要换版本"
|
|
204
|
+
// → 只认 registry;其余情况才复用本机已有源树(省一次 53MB 下载)。
|
|
205
|
+
// 修正前:`--force`/`--version` 也会被本机源树抢先,导致 README 写的
|
|
206
|
+
// 「vendor:latest(= --force)从 registry 取 latest」实际拿不到新版本(本次升级踩到)。
|
|
207
|
+
const localSource = FROM === null && !FORCE && PINNED === null ? defaultSourceTree() : null;
|
|
203
208
|
let codeServerVersion = existing;
|
|
204
209
|
let sourceKind = 'registry';
|
|
205
210
|
let sourceTree = null;
|
|
206
211
|
|
|
207
212
|
if (skip) {
|
|
208
213
|
console.log(`[vendor] vendor/vscode 已存在(code-server@${existing});跳过(用 --force 重建)`);
|
|
209
|
-
} else if (FROM !== null ||
|
|
210
|
-
const src = FROM ??
|
|
214
|
+
} else if (FROM !== null || localSource !== null) {
|
|
215
|
+
const src = FROM ?? localSource;
|
|
211
216
|
codeServerVersion = readJson(join(src, 'package.json'))?.version ?? null;
|
|
212
217
|
if (codeServerVersion === null) throw new Error(`--from ${src} 不是一棵 code-server 树`);
|
|
213
218
|
console.log(`[vendor] 源树 ${src}(code-server@${codeServerVersion})→ vendor/vscode/`);
|
package/vendor/VENDOR.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"codeServerVersion": "4.
|
|
3
|
-
"vscodeVersion": "1.
|
|
4
|
-
"productPath": "stable-
|
|
2
|
+
"codeServerVersion": "4.137.0",
|
|
3
|
+
"vscodeVersion": "1.137.0",
|
|
4
|
+
"productPath": "stable-b11dabdaca0d3369986975be285db92c8795cea5",
|
|
5
5
|
"layout": "vscode-only",
|
|
6
|
-
"preparedAt": "2026-09-
|
|
6
|
+
"preparedAt": "2026-09-11T14:13:32.827Z",
|
|
7
7
|
"source": "registry",
|
|
8
8
|
"node": "v24.13.1",
|
|
9
9
|
"platform": "win32",
|
|
10
10
|
"arch": "arm64",
|
|
11
|
-
"sizeMB": 197.
|
|
11
|
+
"sizeMB": 197.9
|
|
12
12
|
}
|