dsh-code-server-app 0.2.5 → 0.2.7
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 +43 -20
- package/README.md +26 -11
- package/cordis.patch.yml +4 -5
- package/lib/client.js +2 -3
- package/lib/index.js +19 -70
- package/lib/launcher.mjs +7 -14
- package/lib/native.js +1 -1
- package/lib/vendor.js +0 -18
- package/package.json +1 -1
- package/scripts/vendor-repacks.mjs +13 -21
- package/vendor/VENDOR.json +1 -1
package/README.en.md
CHANGED
|
@@ -32,9 +32,11 @@ A static profile plugin (npm package with host + client bundle) that ships the *
|
|
|
32
32
|
- upgrading DSH needs **no reinstall** — refresh the page and the card turns back into the full settings card.
|
|
33
33
|
- The sidebar tab hosts the code-server page (iframe) and follows the current session workspace; the panel can be collapsed/split/floated/fullscreened by DSH's right sidebar.
|
|
34
34
|
- **Resident IDE (0.2.2, on by default)**: switching to another tab or collapsing the sidebar and coming back **no longer reloads** code-server — unsaved editor buffers, terminals and debug sessions all stay put (see "Why switching tabs no longer reloads" below).
|
|
35
|
-
- The settings card
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
- The settings card has exactly **two settings**: "**Claim scope**" and "Resident in background" — no other rows (0.2.7 removed the "Entry", "dependency install" and "environment check" rows).
|
|
36
|
+
Open the IDE from the **Code Server box** on the sidebar's guide page, or by clicking DSH's own produced-file chips / delivered-file previews / inline file names;
|
|
37
|
+
diagnostics stay out of the UI — the `[code-server]` lines in the DSH host log are the place to look (`/api/code-server/status` still returns `env` for scripts).
|
|
38
|
+
The old `windowedOpen` (open in a window) and `reserveComposer` were **removed in 0.2.6**: leftover keys in an old settings document neither fail nor apply (they are no longer part of the schema).
|
|
39
|
+
To use the IDE in a browser tab, visit the loopback address `http://127.0.0.1:<port>/` (or DSH's `/code-server/` under `serve: dsh`).
|
|
38
40
|
|
|
39
41
|
## Opening files (official entry points since 0.2.5)
|
|
40
42
|
|
|
@@ -371,18 +373,20 @@ persisted via the official settings domain (`settingsScope`, namespace `code-ser
|
|
|
371
373
|
| Key | Default | Description |
|
|
372
374
|
|---|---|---|
|
|
373
375
|
| `fileOpenScope` | `session` | **Claim scope** (0.2.5): `session` claims only session-scoped file addresses (`dsh-resource://file/session/…` — DSH's produced files, declared deliveries, prose mentions); `all` also claims session-less `…/file/absolute/…`. Unclaimed addresses fall back to DSH's built-in preview |
|
|
374
|
-
| `windowedOpen` | `false` | **Open in a window**: on, the settings-card button / guide entry box opens code-server in a browser **new tab** (auto-starts and follows the active workspace); off (default) uses the right-sidebar tab. DSH's own file clicks are unaffected (that chain is started by DSH itself and targets the right sidebar) |
|
|
375
376
|
| `keepResident` | `true` | **Resident in background**: on, the host preloads the IDE into a parked surface right after start — switching tabs or collapsing the sidebar never reloads it and the first open needs no cold start; off loads it only when the panel is opened (saves memory) |
|
|
376
|
-
| ~~`reserveComposer`~~ | `true` | **Deprecated in 0.2.3**: it only ever affected the deleted internal floating window. An old value in the settings document is still accepted but ignored (the key is kept so old settings documents keep validating) |
|
|
377
377
|
|
|
378
|
-
|
|
379
|
-
|
|
378
|
+
(Since 0.2.6 the card keeps only those two settings; `windowedOpen` and `reserveComposer` are gone — leftover keys in an old
|
|
379
|
+
settings document neither fail nor apply. `serve` remains a key in the settings namespace (usable from a settings document) but
|
|
380
|
+
has **no card row** — see "Serving mode".)
|
|
381
|
+
|
|
382
|
+
> Card changes take effect immediately via `scope.watch` (the host status API returns `keepResident` and
|
|
383
|
+
> `fileOpenScope`; the client applies them at once); no dsh restart needed. **After adding new setting keys, restart dsh web before first use**,
|
|
380
384
|
> so the host re-registers the settings namespace (schema includes the new key); otherwise save/validation of the new key won't work.
|
|
381
385
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
+
Since 0.2.7 the card has **no** "Entry", "dependency install" or "environment check" rows: the entry lives in the sidebar's
|
|
387
|
+
guide page (and in DSH's own file clicks), and diagnostics stay out of the UI — the `/api/code-server/status` `env` field still
|
|
388
|
+
reports the tree version / `productPath` / server entry, VS Code inner dependencies and **prebuilt native packages**
|
|
389
|
+
(platform aggregator name + resolved module count) for scripts, and the DSH host log carries the `[code-server]` lines.
|
|
386
390
|
|
|
387
391
|
## Config (`config` in cordis.patch.yml; all have defaults)
|
|
388
392
|
|
|
@@ -463,15 +467,34 @@ Host/Origin fence and browser auth); in the desktop profile `apps/desktop-host`
|
|
|
463
467
|
`pnpm-workspace.yaml` sets `minimumReleaseAge: false`.
|
|
464
468
|
- this plugin's closure contains platform native sub-packages (`@jinsiyu/dsh-code-server-runtime-win32-*`) published together with
|
|
465
469
|
the plugin itself, so every new version hits that policy on desktop.
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
470
|
+
- **Desktop client bundles are cached by Electron; restarting the app does not guarantee a new one** (measured 2026-09, hit while shipping 0.2.5):
|
|
471
|
+
- symptom: `lib/client.js` in the profile is the new version, yet the renderer keeps running the old code —
|
|
472
|
+
`%APPDATA%\@deepseek-ai\dsh-desktop\Code Cache\js` only contains strings unique to the old version (e.g. `dshcs-artifacts`)
|
|
473
|
+
and none unique to the new one (`fileOpenScope`), and `Cache\` still holds an old response body referencing
|
|
474
|
+
`dsh-code-server-app`. The same applies to first-party plugins (the cached `ui-deliverables` even lacks the current
|
|
475
|
+
`data-presented-files-row` marker);
|
|
476
|
+
- diagnosis (byte level — do **not** use `Select-String`, which reads files with the console encoding and gives false
|
|
477
|
+
negatives on non-ASCII markers): search `Code Cache\js` for an **ASCII** marker unique to the new version
|
|
478
|
+
(ours is `fileOpenScope`); a hit proves the new bundle really was compiled;
|
|
479
|
+
- fix: fully close the app, delete the `Cache`, `Code Cache` and `GPUCache` directories, then start it (cache only —
|
|
480
|
+
profiles, sessions and settings are untouched):
|
|
481
|
+
```powershell
|
|
482
|
+
Remove-Item -Recurse -Force "$env:APPDATA\@deepseek-ai\dsh-desktop\Cache","$env:APPDATA\@deepseek-ai\dsh-desktop\Code Cache","$env:APPDATA\@deepseek-ai\dsh-desktop\GPUCache"
|
|
483
|
+
```
|
|
484
|
+
- scope: this is not specific to this plugin — **any** client plugin may keep running old code after an upgrade;
|
|
485
|
+
after a release, confirm with the marker trick above that the renderer actually swapped bundles.
|
|
486
|
+
|
|
487
|
+
## File-open plumbing (what the plugin itself still does)
|
|
488
|
+
|
|
489
|
+
DSH's own chips and preview buttons are what users click (see "Opening files" above); this plugin adds no row of its own.
|
|
490
|
+
What remains on the plugin side:
|
|
491
|
+
|
|
492
|
+
- the tab body parses `navigation.address` and posts the absolute path (plus an optional `line`) to
|
|
493
|
+
`/api/code-server/open-file`, which writes a signal file;
|
|
494
|
+
- the bundled `dshcs-open-file` extension polls that file and calls `showTextDocument` — VS Code Web has no official
|
|
495
|
+
"open this file from outside" API, so this is the only way to aim the workbench at a file. It is installed as a
|
|
496
|
+
**built-in** extension (in `lib/vscode/extensions`), so users cannot remove it from the extensions panel, and the
|
|
497
|
+
installer re-syncs it whenever its content changes.
|
|
475
498
|
|
|
476
499
|
## Known limitations
|
|
477
500
|
|
package/README.md
CHANGED
|
@@ -46,9 +46,11 @@
|
|
|
46
46
|
- 侧栏标签内即 code-server 页面(iframe),跟随当前会话工作区;面板可折叠/分屏/浮动/全屏(由 DSH 右侧栏提供)。
|
|
47
47
|
- **IDE 常驻(0.2.2 起,默认开)**:切到别的标签/收起侧栏再回来**不再重载** code-server——
|
|
48
48
|
未保存的编辑缓冲区、终端、调试会话都留在原处(见下方「为什么切标签不再重载」)。
|
|
49
|
-
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
- 设置卡片只有**两个设置**:「**认领范围**」与「**后台常驻(切标签不重载)**」——没有其它行(0.2.7 起移除「入口」「依赖安装」「环境检测」)。
|
|
50
|
+
打开 IDE 用右侧栏「开始」页的 **Code Server 入口框**,或直接点官方的产物 chip / 交付卡片 / 正文文件名;
|
|
51
|
+
诊断看 DSH host 日志里的 `[code-server]` 输出(`/api/code-server/status` 仍返回 `env` 供脚本排查)。
|
|
52
|
+
旧版的 `windowedOpen`(窗口化打开)、`reserveComposer` 已在 0.2.6 移除:旧设置文档里残留的这两个键不会报错,只是被忽略(不再出现在 schema 里)。
|
|
53
|
+
需要在新标签页用 IDE 时,直接访问回环地址 `http://127.0.0.1:<port>/`(`serve: dsh` 时为 DSH 的 `/code-server/`)。
|
|
52
54
|
|
|
53
55
|
## 文件打开(0.2.5 起走官方入口)
|
|
54
56
|
|
|
@@ -127,7 +129,7 @@ DSH 用**资源地址**命名文件,`openFile` 只负责把地址交给右侧栏
|
|
|
127
129
|
| **`loopback`(默认)** | 插件自己起一个回环端口(`host:port`),右侧栏 iframe 跨源直连;进程可被 adopt(DSH host 重启后接管) | 无 |
|
|
128
130
|
| **`dsh`** | IDE 挂到 **DSH 自己的 HTTP 端口**上的 `/code-server/*`(HTTP prefix 路由)+ `/code-server/<quality>-<commit>`(WS 精确路由),转发到 launcher 的**命名管道**;**没有额外端口**;每条请求(含 WS 握手)先过 `ctx.connection.requestRejection()` —— 与 `/api` 同一套 Host/Origin fence + 浏览器 cookie 认证 | DSH 提供 `webServer` 服务(web profile);desktop 无此服务 → 自动回退 loopback |
|
|
129
131
|
|
|
130
|
-
- 在 `cordis.patch.yml` 的 `config.serve`
|
|
132
|
+
- 在 `cordis.patch.yml` 的 `config.serve`(或设置文档里的 `code-server.serve`)切换,下次启动生效 —— **设置卡片不提供这一行**(卡片只有认领范围/后台常驻两个设置)。
|
|
131
133
|
- `dsh` 模式的实际收益:单一 URL/单一端口(远程访问 DSH 即可用 IDE)、不再暴露额外回环端口、认证与 DSH 同级。
|
|
132
134
|
- `dsh` 模式的两点**已知取舍**:
|
|
133
135
|
1. iframe 与 DSH **同源** → 该模式下不再挂 `sandbox`(同源 + `allow-same-origin` 可被 frame 自行摘除,属"看起来有防护");
|
|
@@ -381,16 +383,17 @@ host 探测顺序:`@jinsiyu/dshcs-vscode-server/vscode`(**0.2.0+ 正式布局**)
|
|
|
381
383
|
| 键 | 默认 | 说明 |
|
|
382
384
|
|---|---|---|
|
|
383
385
|
| `fileOpenScope` | `session` | **认领范围**(0.2.5):`session` = 只认领会话作用域的文件地址(`dsh-resource://file/session/…`,即官方产物/交付/正文提及);`all` = 连无会话的绝对路径(`…/file/absolute/…`)也认领。未认领的地址由 DSH 自带预览兜底 |
|
|
384
|
-
| `windowedOpen` | `false` | **窗口化打开**:开启后设置卡按钮 / guide 入口框在浏览器**新标签页**打开 code-server(自动启动并跟随当前工作区目录);关闭(默认)使用右侧栏标签。官方的文件点击不受它影响(那条链由 DSH 自己发起到右侧栏) |
|
|
385
386
|
| `keepResident` | `true` | **后台常驻**:开启后宿主启动即把 IDE 预加载到"停放区",切标签/收起侧栏不重载、首次打开免等待;关闭则只在打开面板时加载(省内存) |
|
|
386
|
-
| ~~`reserveComposer`~~ | `true` | **0.2.3 起废弃**:只对已删除的内部浮动窗口有意义。设置文件里的旧值仍被接受但被忽略(键保留,避免旧设置文档校验失败) |
|
|
387
387
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
0.1.36 起没有「安装环境」按钮 —— 依赖由包管理器安装,卡片里只显示结果。
|
|
388
|
+
(0.2.6 起卡片只留上面两个设置;`windowedOpen` 与 `reserveComposer` 已移除 —— 旧设置文档里残留的键既不报错也不生效。
|
|
389
|
+
`serve` 仍是设置命名空间里的键(便于用设置文档切换),但**没有卡片行**,见「服务方式」。)
|
|
391
390
|
|
|
392
|
-
|
|
393
|
-
|
|
391
|
+
0.2.7 起卡片**没有**「入口」「依赖安装」「环境检测」三行:入口在右侧栏「开始」页的 Code Server 入口框(或官方的文件点击),
|
|
392
|
+
诊断信息不再进 UI —— `/api/code-server/status` 的 `env` 字段仍返回
|
|
393
|
+
树版本 / `productPath` / server 入口、VS Code 内部依赖、**预编译原生包**(平台聚合包名 + 已解析模块数),需要时用脚本查或看 host 日志。
|
|
394
|
+
|
|
395
|
+
> 卡片改动经 `scope.watch` 实时生效(host 端 status API 同步返回 `keepResident` 与
|
|
396
|
+
> `fileOpenScope`,客户端立即生效);无需重启 dsh。**新增设置键后首次使用前需重启 dsh web**,
|
|
394
397
|
> 让 host 重新注册设置命名空间(schema 含新键),否则新键的保存与校验不生效。
|
|
395
398
|
|
|
396
399
|
## 配置(cordis.patch.yml 的 `config`,均有默认值)
|
|
@@ -466,6 +469,18 @@ desktop profile 由 `apps/desktop-host` 把 `/api/*` 交给同一个 `createShar
|
|
|
466
469
|
- 也可以选择 **等满 24 小时**再在插件管理里正常安装;web profile 不受影响(它的 `pnpm-workspace.yaml` 是 `minimumReleaseAge: false`)。
|
|
467
470
|
- 本插件的依赖闭包里含平台原生子包(`@jinsiyu/dsh-code-server-runtime-win32-*`),它们与插件本身**同批发布**,
|
|
468
471
|
因此每次新版本在桌面端都会受这条策略约束。
|
|
472
|
+
- **桌面端的客户端 bundle 会被 Electron 缓存,重启应用不保证换新**(2026-09 实测,0.2.5 踩到):
|
|
473
|
+
- 现象:profile 里 `lib/client.js` 已是新版本,但渲染器仍跑旧代码——`%APPDATA%\@deepseek-ai\dsh-desktop\Code Cache\js`
|
|
474
|
+
里只有旧版本独有的字符串(如 `dshcs-artifacts`),新版本独有的字符串(如 `fileOpenScope`)一个都没有;
|
|
475
|
+
`Cache\` 里也存着一份引用 `dsh-code-server-app` 的旧响应体。官方插件同理(缓存里那份 `ui-deliverables`
|
|
476
|
+
连当前的 `data-presented-files-row` 都没有)。
|
|
477
|
+
- 诊断手法(字节级,注意别用按控制台编码读文件的 `Select-String`,中文标记会假阴性):
|
|
478
|
+
在 `Code Cache\js` 里搜本版本独有的**ASCII** 标记(我们用 `fileOpenScope`),命中即说明新 bundle 真的被编译过。
|
|
479
|
+
- 修法:完全关闭应用后删 `Cache`、`Code Cache`、`GPUCache` 三个目录再启动(只清缓存,不动 profile/会话/设置):
|
|
480
|
+
```powershell
|
|
481
|
+
Remove-Item -Recurse -Force "$env:APPDATA\@deepseek-ai\dsh-desktop\Cache","$env:APPDATA\@deepseek-ai\dsh-desktop\Code Cache","$env:APPDATA\@deepseek-ai\dsh-desktop\GPUCache"
|
|
482
|
+
```
|
|
483
|
+
- 影响面:不只本插件——**任何**客户端插件升级后都可能继续跑旧代码;发布后请按上面的标记法确认渲染器真的换了 bundle。
|
|
469
484
|
|
|
470
485
|
## 已知限制
|
|
471
486
|
|
package/cordis.patch.yml
CHANGED
|
@@ -30,8 +30,7 @@
|
|
|
30
30
|
locale: ''
|
|
31
31
|
# 启动就绪探测超时(ms)。
|
|
32
32
|
readyTimeoutMs: 60000
|
|
33
|
-
#
|
|
34
|
-
# 卡片控制,持久化于官方 settings 域(命名空间 code-server
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
# 旧版上只在设置页给一条升级提示,不提供任何入口,也不预启动 IDE。
|
|
33
|
+
# 注:后台常驻(keepResident,默认 true)与认领范围(fileOpenScope,默认 session)由
|
|
34
|
+
# "设置 → 插件 → Code Server"卡片控制,持久化于官方 settings 域(命名空间 code-server),
|
|
35
|
+
# 卡片修改即时生效。服务方式(serve)没有卡片行:改这里的 config.serve 或设置文档。
|
|
36
|
+
# 另:不再兼容旧版 DSH(无 sidebarRightTabs/sidebarRight 服务),旧版上仅给设置页提示。
|
package/lib/client.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
window.__ModuleLoader__.load({id:'dsh-code-server-app',factory:function(require){var module={exports:{}};var exports=module.exports;
|
|
2
|
-
var H=Object.defineProperty;var we=Object.getOwnPropertyDescriptor;var xe=Object.getOwnPropertyNames;var Se=Object.prototype.hasOwnProperty;var ke=(e,r)=>{for(var t in r)H(e,t,{get:r[t],enumerable:!0})},Ee=(e,r,t,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let l of xe(r))!Se.call(e,l)&&l!==t&&H(e,l,{get:()=>r[l],enumerable:!(s=we(r,l))||s.enumerable});return e};var Ne=e=>Ee(H({},"__esModule",{value:!0}),e);var cr={};ke(cr,{apply:()=>lr,inject:()=>ir,name:()=>dr});module.exports=Ne(cr);var q="dsh-resource://file/",Ce="sidebar://",ee="session";function U(e){return typeof e=="string"&&e.startsWith(Ce)}function R(e){if(typeof e!="string"||!e.startsWith(q))return null;for(var r=e.length,t=0;t<e.length;t+=1){var s=e.charAt(t);if(s==="?"||s==="#"){r=t;break}}var l=e.slice(q.length,r).split("/"),i=l.shift();try{if(i==="session"){var d=l.shift();return d===void 0||d===""||l.length===0?null:{scope:"session",sessionId:decodeURIComponent(d),path:$(l)}}if(i==="absolute"){var p=l[0]===""&&l.length>1,b=p?l.slice(1):l,c=$(b);return(c===""||c.charAt(0)==="/")&&!p?null:p?{scope:"absolute",path:"//"+c}:c===""?null:{scope:"absolute",path:re(c)?c:"/"+c}}}catch(o){return null}return null}function $(e){for(var r=[],t=0;t<e.length;t+=1)r.push(decodeURIComponent(e[t]));return r.join("/")}function re(e){return/^[A-Za-z]:($|\/)/.test(e)}function Oe(e){return typeof e!="string"||e===""?!1:e.charAt(0)==="/"?!0:re(e)}function te(e){var r=R(e);if(r===null)return"";var t=r.path.replace(/[/\\]+$/,""),s=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\")),l=s===-1?t:t.slice(s+1);return l}function ne(e,r){if(e===null||e==null)return null;var t=typeof e.path=="string"?e.path:"";if(t==="")return null;if(Oe(t))return t;if(typeof r!="string"||r==="")return null;var s=r.indexOf("\\")!==-1?"\\":"/",l=r.replace(/[\\/]+$/,"");return l+s+(s==="\\"?t.replace(/\//g,"\\"):t)}function ae(e,r){return e===null||e==null?!1:e.scope==="session"?!0:r==="all"}var O=typeof Element!="undefined"&&typeof Element.prototype.moveBefore=="function",Te=-2e4,a={park:null,frame:null,currentSrc:null,sameOrigin:null,owner:null,lastRect:null,parkStrategy:"offscreen",degraded:!1,preloaded:!1,nudgeCount:0,nudgeEnabled:!0,lastNudgeAt:0,listeners:new Set};function _(){return{ready:a.frame!==null,docked:a.owner!==null,owner:a.owner,src:a.currentSrc,sameOrigin:a.sameOrigin,parkStrategy:a.parkStrategy,degraded:a.degraded,preloaded:a.preloaded,supportsMoveBefore:O,nudgeCount:a.nudgeCount,lastNudgeAt:a.lastNudgeAt}}function T(){var e=_();a.listeners.forEach(function(r){try{r(e)}catch(t){}})}function le(e){return a.listeners.add(e),function(){a.listeners.delete(e)}}function se(){return _()}function Le(e){e!=="offscreen"&&e!=="behind"||a.parkStrategy!==e&&(a.parkStrategy=e,a.frame!==null&&a.owner===null&&B(),T())}function Ae(){return a.parkStrategy}function Re(){var e=a.lastRect;e!==null&&(a.park.style.width=Math.max(1,Math.round(e.width))+"px",a.park.style.height=Math.max(1,Math.round(e.height))+"px")}function B(){if(a.park!==null){if(Re(),a.parkStrategy==="behind"&&a.lastRect!==null){a.park.style.left=Math.round(a.lastRect.left)+"px",a.park.style.top=Math.round(a.lastRect.top)+"px",a.park.style.visibility="visible",a.park.style.zIndex="0";return}a.park.style.left=Te+"px",a.park.style.top="0px",a.park.style.visibility="hidden",a.park.style.zIndex="0"}}function ie(){a.frame!==null&&(a.frame.setAttribute("inert",""),a.frame.setAttribute("aria-hidden","true"))}function Me(){a.frame!==null&&(a.frame.removeAttribute("inert"),a.frame.removeAttribute("aria-hidden"))}function De(){var e=document.createElement("div");e.className="dshcs-park",e.setAttribute("data-dshcs-park",""),e.setAttribute("aria-hidden","true");var r=document.createElement("iframe");return r.className="dshcs-frame",r.setAttribute("title","code-server"),r.setAttribute("allow","clipboard-read; clipboard-write"),r.setAttribute("data-dshcs-resident",""),r.src="about:blank",e.appendChild(r),document.body.appendChild(e),a.park=e,a.frame=r,a.currentSrc="about:blank",a.owner=null,B(),ie(),r}function je(e){var r=a.frame;if(r!==null){var t=a.sameOrigin!==e;!t&&r.hasAttribute("data-dshcs-attrs")||(e===!0?r.removeAttribute("sandbox"):e===!1&&r.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms allow-modals allow-popups allow-pointer-lock allow-clipboard-read allow-clipboard-write"),r.setAttribute("data-dshcs-attrs",e===!0?"same-origin":"cross-origin"),a.sameOrigin=e)}}function F(e){var r=e||{};return a.frame===null&&De(),typeof r.sameOrigin=="boolean"&&je(r.sameOrigin),typeof r.src=="string"&&r.src!==""&&r.src!==a.currentSrc&&ze(r.src),a.frame}function ze(e){a.frame===null||typeof e!="string"||e===""||e===a.currentSrc||(a.currentSrc=e,a.frame.src=e,T())}function de(){var e=a.frame;if(a.nudgeEnabled!==!0||e===null||e.isConnected!==!0)return!1;var r=e.style.display;return e.style.display="none",e.offsetHeight,e.style.display=r,a.nudgeCount+=1,a.lastNudgeAt=Date.now(),!0}function Pe(e){return a.nudgeEnabled=e!==!1,a.nudgeEnabled}function ce(e){if(a.frame!==null){if(O)try{e.moveBefore(a.frame,null);return}catch(r){a.degraded=!0,a.lastMoveError=(r&&r.name?r.name+": ":"")+(r&&r.message?r.message:String(r))}else a.degraded=!0;e.appendChild(a.frame)}}function G(e,r){if(!(a.frame===null||e==null)){var t=a.owner===null,s=e.getBoundingClientRect();s.width>=1&&s.height>=1&&(a.lastRect={left:s.left,top:s.top,width:s.width,height:s.height}),a.owner=r===void 0?null:r,Me(),a.park.setAttribute("aria-hidden","true"),ce(e),t&&de(),T()}}function L(e){a.frame!==null&&(e!==void 0&&a.owner!==e||(a.owner=null,B(),ie(),a.park.setAttribute("aria-hidden","true"),ce(a.park),T()))}function Q(e){var r=e||{};return F(r),a.owner===null&&(typeof r.src=="string"&&r.src!==""&&(a.preloaded=!0),L()),a.frame}function Ie(){a.park!==null&&a.park.parentNode!==null&&a.park.parentNode.removeChild(a.park),a.park=null,a.frame=null,a.currentSrc=null,a.sameOrigin=null,a.owner=null,a.lastRect=null,a.degraded=!1,a.preloaded=!1,a.nudgeCount=0,a.lastNudgeAt=0,T()}typeof window!="undefined"&&(window.__dshcsSurface={snapshot:_,setParkStrategy:Le,getParkStrategy:Ae,preload:Q,dock:G,park:L,nudge:de,setNudgeEnabled:Pe,destroy:Ie});var n=require("react"),Z=new Set,A={status:null,busy:!1,sidebarActive:!1,sidebarUi:"unknown",sidebarRegisterFailed:!1};function N(e){A=Object.assign({},A,e),Z.forEach(function(r){r()})}function He(e){return Z.add(e),function(){Z.delete(e)}}function Ue(){return A}function J(){return n.useSyncExternalStore(He,Ue)}var _e="/api",Be="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMTQ3IDE0NyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8c3R5bGU+QG1lZGlhIChwcmVmZXJzLWNvbG9yLXNjaGVtZTogZGFyaykgeyogeyBmaWxsOiB3aGl0ZTsgfX08L3N0eWxlPgogIDxwYXRoIGQ9Im00Mi40MjE0LDM5LjY1NWMtMjQuNDA1NywwIC00Mi4xNTU0LDEzLjE3MjEgLTQyLjE1NTQsMzMuODQ1YzAsMjAuNTgxNCAxOC40ODkyLDMzLjg0NSA0Mi4xNTU0LDMzLjg0NWMyMy42NjYyLDAgMzguMTgwMywtMTEuNjE3MSAzOC43MzQ5LC0yOC43MjI1bC0yMS4wNzc3LC0wLjQ1NzRjLTAuOTI0NCw5LjMzMDMgLTkuMTA1OSwxNS4xODQ1IC0xNy42NTcyLDE1LjE4NDVjLTExLjc0MDYsMCAtMjAuNDMwNiwtNy41OTIyIC0yMC40MzA2LC0xOS44NDk2YzAsLTEyLjI1NzQgOC42OSwtMTkuOTg2OCAyMC40MzA2LC0yMC4yMTU1YzguNTUxMywtMC4xODMgMTYuOTE3Nyw1Ljk0NTcgMTcuNDcyMywxNS4yNzZsMjEuMDc3NywtMC42NDAzYy0wLjQ2MjIsLTE2LjgzMTEgLTE0LjE0NDIsLTI4LjI2NTIgLTM4LjU1LC0yOC4yNjUyem00OC44NDQ2LDJsNTUuNDY4LDBsMCw2NC4wMzExbC01NS40NjgsMGwwLC02NC4wMzExeiIgY2xpcC1ydWxlPSJldmVub2RkIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz4KPC9zdmc+Cg==";async function k(e,r){var t={method:r===void 0?"GET":"POST",headers:{}};r!==void 0&&(t.headers["content-type"]="application/json",t.body=JSON.stringify(r));var s=await fetch(_e+e,t),l=await s.text(),i=null;try{i=l===""?null:JSON.parse(l)}catch(d){i=null}return s.ok?i!==null?i:{ok:!1,error:"invalid JSON response"}:{ok:!1,error:"HTTP "+s.status+(i!==null&&i.error!==void 0?": "+i.error:"")}}function ve(e,r){try{var t=e(function(h){return h}),s=r===null?null:typeof r=="function"?r(function(h){return h}):null,l=t!=null?t.current:void 0;if(l!==void 0&&t!=null&&t.byId!=null){var i=t.byId[l];if(i!=null&&typeof i.cwd=="string"&&i.cwd!=="")return i.cwd}var d=s!=null&&Array.isArray(s.items)?s.items:[];if(l!==void 0)for(var p=0;p<d.length;p++){var b=d[p];if(b.sessionIds!=null&&b.sessionIds.indexOf(l)!==-1&&typeof b.path=="string"&&b.path!=="")return b.path}var c=s!=null?s.recentWorkspaceId:void 0;if(c!==void 0){for(var o=0;o<d.length;o++)if(d[o].workspaceId===c&&typeof d[o].path=="string"&&d[o].path!=="")return d[o].path}if(d.length>0&&typeof d[0].path=="string"&&d[0].path!=="")return d[0].path}catch(h){}}function be(e,r){if(e==null||typeof e.url!="string"||e.url==="")return null;var t=typeof r=="string"&&r!==""?r:e!=null&&e.cwd!=null?e.cwd:null;if(t==null||t==="")return e.url;var s=t.replace(/\\/g,"/"),l=s;return(/^[A-Za-z]:\//.test(s)||s.charCodeAt(0)!==47)&&(l="/"+s),e.url+"?folder="+encodeURIComponent(l)}function Fe(e){var r=e.status,t=e.pageUrl,s=e.reloadTick,l=e.owner,i=n.useRef(null),d=r!=null&&r.ok===!0&&r.running===!0,p=r!=null&&r.status==="starting",b=r!=null&&r.ok===!1,c=r!=null&&r.serve==="dsh";if(n.useLayoutEffect(function(){if(!d||t===null){L(l);return}F({src:t,sameOrigin:c}),i.current!==null&&G(i.current,l)},[d,t,c,s,l]),n.useLayoutEffect(function(){return function(){L(l)}},[l]),d&&t!==null)return n.createElement("div",{ref:i,className:"dshcs-slot","data-code-server-slot":l!=null?l:"code-server"});if(p)return n.createElement("div",{className:"dshcs-loading"},"\u6B63\u5728\u542F\u52A8 code-server\u2026");var o=b&&r!=null&&r.error?r.error:"code-server \u672A\u8FD0\u884C",h=c?"\u5F53\u524D\u4EE5 DSH \u540C\u6E90\u8DEF\u5F84 "+(r!=null&&r.url||"/code-server/")+" \u63D0\u4F9B(\u65E0\u72EC\u7ACB\u7AEF\u53E3)\u3002":"\u5F53\u524D\u4EE5\u72EC\u7ACB\u56DE\u73AF\u7AEF\u53E3\u63D0\u4F9B(\u7AEF\u53E3 "+(r!=null&&r.port!=null?r.port:"8090")+" \u88AB\u5360\u7528\u65F6\u8BF7\u91CA\u653E\u6216\u4FEE\u6539 port \u914D\u7F6E)\u3002",x=O?"\u5E38\u9A7B\u9762:\u53EF\u7528(\u5207\u6807\u7B7E/\u6536\u8D77\u4FA7\u680F\u4E0D\u91CD\u8F7D)\u3002":"\u5E38\u9A7B\u9762:\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 Element.moveBefore \u2014\u2014 \u5207\u6807\u7B7E\u4F1A\u6574\u9875\u91CD\u8F7D(\u5347\u7EA7\u6D4F\u89C8\u5668\u540E\u81EA\u52A8\u53EF\u7528)\u3002";return n.createElement("div",{className:"dshcs-empty"},n.createElement("div",{className:"dshcs-emptybox"},n.createElement("div",null,b?"code-server \u542F\u52A8\u5931\u8D25":"code-server \u672A\u8FD0\u884C"),n.createElement("pre",{className:"dshcs-error"},o),n.createElement("p",{className:"dshcs-hint"},"VS Code \u6811\u968F\u63D2\u4EF6\u5305\u5185\u7F6E\u3001\u5C31\u5730\u8FD0\u884C(\u65E0\u9700\u5168\u5C40\u5B89\u88C5\u3001\u65E0\u9700\u8054\u7F51\u5B89\u88C5\u3001\u65E0\u300C\u5B89\u88C5\u73AF\u5883\u300D\u6B65\u9AA4);\u5185\u90E8\u4F9D\u8D56\u4E0E\u9884\u7F16\u8BD1\u539F\u751F\u6A21\u5757\u7531\u5305\u7BA1\u7406\u5668\u5728\u5B89\u88C5\u63D2\u4EF6\u65F6\u4E00\u5E76\u88C5\u597D(\u65E0\u9700 C++ \u5DE5\u5177\u94FE)\u3002\u82E5\u6B64\u5904\u957F\u671F\u672A\u8FD0\u884C,\u8BF7\u5230 \u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 Code Server \u70B9\u300C\u68C0\u6D4B\u73AF\u5883\u300D\u67E5\u770B\u539F\u56E0\u3002"+h+x)))}function Ge(e){var r=J(),t=r.status,s=t!=null&&t.ok===!0&&t.running===!0,l=t!=null&&t.keepResident===!0,i=ve(e&&e.useSessions,e&&e.useWorkspaces),d=s?be(t,i):null;return n.useEffect(function(){!l||!s||d===null||Q({src:d,sameOrigin:t!=null&&t.serve==="dsh"})},[l,s,d,t!=null?t.serve:null]),null}var Qe=".dshcs-frame{display:block;position:absolute;inset:0;z-index:1;width:100%;height:100%;border:0;background:var(--dsw-alias-bg-base,#fff)}.dshcs-tabroot{position:relative;display:flex;flex-direction:column;width:100%;height:100%;min-width:0;min-height:0;background:var(--dsw-alias-bg-base,#fff)}.dshcs-slot{position:relative;display:block;width:100%;height:100%;min-width:0;min-height:0;overflow:hidden;background:var(--dsw-alias-bg-base,#fff)}.dshcs-park{position:fixed;left:-20000px;top:0;width:320px;height:200px;overflow:hidden;pointer-events:none;z-index:0;visibility:hidden;contain:strict}.dshcs-loading{position:absolute;inset:0;z-index:2;display:grid;place-items:center;background:var(--dsw-alias-bg-base,#fff);color:var(--dsw-alias-label-tertiary,#7d8798);font-size:13px}.dshcs-empty{position:relative;z-index:2;flex:1;display:flex;align-items:center;justify-content:center;padding:44px 24px 24px}.dshcs-emptybox{max-width:560px;text-align:left;background:var(--dsw-alias-bg-layer-2,#f7f8fb);border:1px solid var(--dsw-alias-border-l2,#dfe3eb);border-radius:12px;padding:16px 18px}.dshcs-error{color:var(--dsw-alias-label-error,#d92d20);white-space:pre-wrap;word-break:break-all;font-family:ui-monospace,Consolas,monospace;font-size:12px;margin:8px 0 0}.dshcs-hint{color:var(--dsw-alias-label-tertiary,#7d8798);font-size:12px;margin:6px 0 0}.dshcs-legacy{color:var(--dsw-alias-label-warning,#b54708);font-size:12px;font-weight:600;margin:0 0 6px}",oe="dsh-code-server/styles";typeof document!="undefined"&&document.querySelector("style[data-dshcs="+JSON.stringify(oe)+"]")===null&&(M=document.createElement("style"),M.setAttribute("data-dshcs",oe),M.textContent=Qe,document.head.appendChild(M));var M,V="code-server",ue="dsh-code-server-app",Ve=2500,We=1e4,Ye=1500,D={openTab:null};function Ze(e){var r=e!=null&&typeof e.size=="number"?e.size:16;return n.createElement("img",{src:Be,alt:"","aria-hidden":!0,draggable:!1,className:e!=null?e.className:void 0,style:{width:r,height:r,display:"block",objectFit:"contain",WebkitUserDrag:"none",userSelect:"none"}})}function Je(){var e=A.status;return e!=null&&e.fileOpenScope==="all"?"all":ee}function Xe(e,r){try{var t=e(function(l){return l});if(t!=null&&r!=null&&t.byId!=null){var s=t.byId[r];if(s!=null&&typeof s.cwd=="string"&&s.cwd!=="")return s.cwd}}catch(l){}}function Ke(e){var r=e.useTabInfo(),t=r.tab,s=J(),l=s.status,i=t.navigation,d=i!=null&&typeof i.revision=="number"?i.revision:0,p=i!=null&&typeof i.address=="string"?i.address:"",b=U(p)?null:R(p),c=Xe(e.useSessions,b!=null?b.sessionId:void 0),o=c!==void 0?c:ve(e.useSessions,null),h=ne(b,o),x=i!=null&&i.params!=null&&typeof i.params.line=="number"?i.params.line:null,f=n.useRef(void 0),[g,m]=n.useState(0);return n.useEffect(function(){if(!(typeof o!="string"||o==="")&&f.current!==o){var y=f.current!==void 0;f.current=o;var S=!1;return k("/code-server/start",{cwd:o}).then(function(C){S||(N({status:C}),y&&C!=null&&C.ok===!0&&C.running===!0&&m(function(z){return z+1}))}).catch(function(){}),function(){S=!0}}},[o]),n.useEffect(function(){k("/code-server/status").then(function(S){S!=null&&N({status:S})}).catch(function(){});var y=window.setInterval(function(){k("/code-server/status").then(function(S){N({status:S})}).catch(function(){})},3e3);return function(){window.clearInterval(y)}},[]),n.useEffect(function(){h!==null&&k("/code-server/open-file",x===null?{file:h}:{file:h,line:x}).catch(function(){})},[d,h,x]),n.createElement("div",{className:"dshcs-tabroot","data-code-server-tab":"body"},n.createElement(Fe,{status:l,pageUrl:be(l,o),reloadTick:g,owner:"tab:"+t.id}))}function W(e,r){if(e==null)return null;var t=e[r];if(t!=null)return t;if(typeof e.get=="function"){var s=e.get(r);if(s!=null)return s}return null}function qe(e){var r=W(e,"sidebarRightTabs"),t=W(e,"sidebarRight");if(r==null||t==null)return console.error("[code-server] \u53F3\u4FA7\u680F\u670D\u52A1\u4E0A\u4E0B\u6587\u4E0D\u53EF\u89C1(sidebarRightTabs="+(r!=null)+", sidebarRight="+(t!=null)+"):\u8DF3\u8FC7\u4FA7\u680F\u6CE8\u518C"),!1;var s=W(e,"slots");if(e.effect(function(){return r.register({id:ue,kind:V,priority:"extension",patterns:["dsh-resource://file/**"],canOpen:function(l){return ae(R(l),Je())},title:function(l){if(U(l)||l===void 0||l===null||l==="")return"Code Server";var i=te(l);return i===""?"Code Server":i},guide:[{order:20,title:function(){return"Code Server"},description:function(){return"\u5728\u53F3\u4FA7\u680F\u6807\u7B7E\u91CC\u8FD0\u884C VS Code \u7F51\u9875\u7248,\u8DDF\u968F\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u533A;\u4EA7\u7269/\u4EA4\u4ED8\u6587\u4EF6\u70B9\u51FB\u540E\u5728\u6B64\u6253\u5F00\u3002"},icon:Ze}]})},"code-server: sidebar tab type"),s!=null)e.effect(function(){return s.inject("sidebar.right.pane.tab",function(){return s.register({name:"sidebar.right.pane.tab",key:ue},Ke)})},"code-server: sidebar tab body");else return console.error("[code-server] slots \u670D\u52A1\u4E0D\u53EF\u89C1:\u4FA7\u680F\u6807\u7B7E body \u672A\u6CE8\u518C"),!1;return D.openTab=function(l){try{return t.openTab(V,l!=null?{params:l}:void 0),!0}catch(i){return console.warn("[code-server] sidebar openTab failed:",i!=null&&i.message!=null?i.message:String(i)),!1}},e.effect(function(){return function(){D.openTab=null,N({sidebarActive:!1,sidebarUi:"unknown"})}},"code-server: sidebar mode reset"),console.log("[code-server] right-sidebar tab registered (kind="+V+")"),!0}var $e=".dshcs-card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}.dshcs-card:hover{border-color:var(--dsw-alias-label-dimmed,var(--dsw-alias-border-l2))}.dshcs-cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed,var(--dsw-alias-border-l2))}.dshcs-cardHeader{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}.dshcs-cardHeader:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}.dshcs-cardHeadText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.dshcs-cardName{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}.dshcs-cardDescription{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));font-size:13px;line-height:1.5}.dshcs-cardChevron{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));flex:none;transition:transform .16s;display:inline-flex}.dshcs-cardChevronOpen{transform:rotate(180deg)}.dshcs-cardBody{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}.dshcs-cardReadOnly{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));margin:12px 0 0;font-size:12px;line-height:1.5}.dshcs-pending{white-space:nowrap;background:var(--dsw-alias-bg-module-platform,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-secondary);border-radius:999px;flex:none;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.dshcs-cardFooter{border-top:1px solid var(--dsw-alias-border-l2);justify-content:flex-end;align-items:center;gap:8px;padding:12px 0 4px;display:flex}.dshcs-cardFailed{min-width:0;color:var(--dsw-alias-label-error,var(--dsw-alias-state-error-primary));flex:1;margin:0;font-size:12px;line-height:1.5}.dshcs-cbtn{appearance:none;font:inherit;cursor:pointer;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5;border:1px solid transparent;transition:color .12s ease,background .12s ease}.dshcs-cbtn:disabled{opacity:.4;cursor:default}.dshcs-cbtn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.dshcs-cbtnOutline{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:0 0}.dshcs-cbtnOutline:hover:not(:disabled){color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover,transparent)}.dshcs-cbtnPrimary{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3);border-color:var(--dsw-alias-label-primary);font-weight:600}.dshcs-cbtnPrimary:hover:not(:disabled){filter:brightness(.95)}.dshcs-cbtnPrimary:active:not(:disabled){filter:brightness(.9)}.dshcs-field{flex-direction:column;gap:6px;padding:12px 0;display:flex}.dshcs-field+.dshcs-field{border-top:1px solid var(--dsw-alias-border-l2)}.dshcs-fieldHead{align-items:center;gap:8px;display:flex}.dshcs-fieldLabel{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}.dshcs-hint{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));margin:0;font-size:12px;line-height:1.5}.dshcs-check{display:flex;align-items:center;gap:8px;cursor:pointer}.dshcs-check input{accent-color:var(--dsw-alias-brand-primary);width:15px;height:15px;margin:0;flex:none}.dshcs-check input:disabled{cursor:default}.dshcs-select{display:inline-flex;align-items:center}.dshcs-select select{font:inherit;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-3,transparent);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:4px 8px;min-width:220px;cursor:pointer}.dshcs-select select:disabled{opacity:.5;cursor:default}.dshcs-badges{align-items:center;gap:8px;display:inline-flex}.dshcs-badge{white-space:nowrap;background:var(--dsw-alias-bg-module-platform,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-secondary);border-radius:999px;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.dshcs-reset{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;padding:0;font-size:12px;line-height:1.5}.dshcs-reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}.dshcs-reset:disabled{cursor:default}",er="dsh-code-server/Card.module.css";function rr(e,r){if(typeof document!="undefined"&&document.querySelector("style[data-plugin-css="+JSON.stringify(e)+"]")===null){var t=document.createElement("style");t.dataset.plugin="dsh-code-server",t.dataset.pluginCss=e,t.textContent=r,document.head.appendChild(t)}}rr(er,$e);function tr(e){return n.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none","aria-hidden":!0,className:e.className},n.createElement("path",{d:"M3.5 5.25L7 8.75L10.5 5.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))}function j(e){return n.createElement("button",{type:"button",className:"dshcs-cbtn "+(e.variant==="primary"?"dshcs-cbtnPrimary":"dshcs-cbtnOutline"),disabled:e.disabled===!0,onClick:e.onClick},e.children)}function fe(e){return n.createElement("label",{className:"dshcs-check"},n.createElement("input",{type:"checkbox",checked:e.checked===!0,disabled:e.disabled===!0,onChange:function(r){e.onChange(r.target.checked)}}),n.createElement("span",{className:"dshcs-hint"},e.children))}function nr(e){var r=Array.isArray(e.options)?e.options:[];return n.createElement("label",{className:"dshcs-select"},n.createElement("select",{value:e.value,disabled:e.disabled===!0,onChange:function(t){e.onChange(t.target.value)}},r.map(function(t){return n.createElement("option",{key:t.value,value:t.value},t.label)})))}function Y(e){var r=[];return e.overridden===!0&&(r.push(n.createElement("span",{className:"dshcs-badge"},e.overriddenLabel)),r.push(n.createElement("button",{type:"button",className:"dshcs-reset",disabled:e.disabled===!0,onClick:e.onReset},e.resetLabel))),r.length===0?null:n.createElement("span",{className:"dshcs-badges"},...r)}function pe(e){var[r,t]=n.useState(e.defaultOpen===!0),s=e.state;if(s==null||s.available!==!0)return null;var l=e.title,i=e.noticeOnly===!0,d=s.dirty!==!0||s.invalid===!0||s.saving===!0;return n.createElement("li",{className:"dshcs-card"+(r?" dshcs-cardOpen":"")},n.createElement("button",{type:"button",className:"dshcs-cardHeader","aria-expanded":r,onClick:function(){t(!r)}},n.createElement("span",{className:"dshcs-cardHeadText"},n.createElement("span",{className:"dshcs-cardName"},l),n.createElement("span",{className:"dshcs-cardDescription"},e.description)),s.dirty===!0?n.createElement("span",{className:"dshcs-pending"},e.unsavedLabel):null,n.createElement(tr,{className:"dshcs-cardChevron"+(r?" dshcs-cardChevronOpen":"")})),r===!0?n.createElement("div",{className:"dshcs-cardBody"},i===!0?null:s.writable!==!0?n.createElement("p",{className:"dshcs-cardReadOnly",role:"status"},e.readOnlyLabel):null,e.children,i===!0?null:n.createElement("div",{className:"dshcs-cardFooter"},s.failed===!0?n.createElement("p",{className:"dshcs-cardFailed",role:"status"},e.saveFailedLabel):null,n.createElement(j,{disabled:s.dirty!==!0||s.saving===!0,onClick:e.onDiscard},e.discardLabel),n.createElement(j,{variant:"primary",disabled:d,onClick:e.onSave},s.saving===!0?e.savingLabel:e.saveLabel))):null)}function ar(e){try{let E=function(){k("/code-server/status").then(function(v){v!=null&&typeof v=="object"&&N({status:v})}).catch(function(){})};var r=e.scope,[t,s]=n.useState(function(){return r!==void 0?r.getSnapshot():null}),[l,i]=n.useState(null),[d,p]=n.useState(!1),[b,c]=n.useState(!1),o=J(),[h,x]=n.useState(se());if(n.useEffect(function(){return le(function(v){x(v)})},[]),n.useEffect(function(){if(r===void 0||typeof r.subscribe!="function")return;function v(){try{s(r.getSnapshot())}catch(ur){}}var w=r.subscribe(v);return function(){typeof w=="function"&&w()}},[r]),r===void 0)return console.error("[code-server] card scope missing"),null;if(t==null||t.status!=="ready")return t!=null&&t.status==="unavailable"&&console.warn("[code-server] settings scope unavailable:",t.status),null;var f=t.value!==void 0&&t.value!==null?t.value:{},g=t.user,m={windowedOpen:f.windowedOpen===!0,keepResident:f.keepResident!==!1,fileOpenScope:f.fileOpenScope==="all"?"all":"session"};if(o!=null&&o.sidebarUi==="legacy")return n.createElement(pe,{title:"Code Server",description:"\u5F53\u524D DSH \u7248\u672C\u4E0D\u53D7\u652F\u6301(\u7F3A\u5C11\u53F3\u4FA7\u680F\u670D\u52A1)",defaultOpen:!0,noticeOnly:!0,state:{available:!0,writable:!1,dirty:!1,invalid:!1,saving:!1,failed:!1}},n.createElement("div",{className:"dshcs-field"},n.createElement("div",{className:"dshcs-legacy"},"\u672C\u63D2\u4EF6\u81EA 0.2.3 \u8D77\u4E0D\u518D\u517C\u5BB9\u65E7\u7248 DSH\u3002"),n.createElement("div",{className:"dshcs-hint",style:{marginTop:0}},`\u672A\u68C0\u6D4B\u5230\u53F3\u4FA7\u680F\u63D2\u4EF6\u670D\u52A1 sidebarRightTabs / sidebarRight,\u56E0\u6B64\u63D2\u4EF6\u4E0D\u63D0\u4F9B\u4EFB\u4F55\u5165\u53E3(\u65E7\u7248\u7684\u60AC\u6D6E\u7403\u4E0E\u6D6E\u52A8\u7A97\u53E3\u5DF2\u79FB\u9664),\u4E5F\u4E0D\u4F1A\u540E\u53F0\u542F\u52A8 IDE\u3002
|
|
3
|
-
\u5347\u7EA7 DSH \u5230\u5E26\u53F3\u4FA7\u680F\u7684\u7248\u672C(\u2265 0.1.5-alpha.1)\u540E,Code Server \u4F1A\u51FA\u73B0\u5728\u53F3\u4FA7\u680F\u6807\u7B7E\u91CC,\u672C\u9875\u540C\u65F6\u663E\u793A\u5B8C\u6574\u8BBE\u7F6E\u9879;\u5347\u7EA7\u540E\u65E0\u9700\u91CD\u88C5\u672C\u63D2\u4EF6,\u5237\u65B0\u9875\u9762\u5373\u53EF\u3002`)));var
|
|
4
|
-
\u5378\u8F7D: dsh plugin --profile web remove dsh-code-server-app`));return n.createElement(pe,{title:"Code Server",description:"\u5165\u53E3:\u53F3\u4FA7\u680F\u6807\u7B7E(DSH \u2265 0.1.5-alpha.1);\u7A97\u53E3\u5316\u8BBE\u7F6E\u63A7\u5236\u65B0\u6807\u7B7E\u9875\u6253\u5F00",state:he,unsavedLabel:"\u672A\u4FDD\u5B58",readOnlyLabel:"\u672C\u90E8\u7F72\u7684\u8BBE\u7F6E\u4E3A\u53EA\u8BFB\u3002",saveFailedLabel:"\u672C\u90E8\u7F72\u6CA1\u6709\u63A5\u53D7\u8FD9\u4E9B\u503C\uFF0C\u5DF2\u4FDD\u7559\u4F9B\u4F60\u4FEE\u6539\u3002",discardLabel:"\u653E\u5F03\u4FEE\u6539",saveLabel:"\u4FDD\u5B58",savingLabel:"\u4FDD\u5B58\u4E2D\u2026",onSave:ye,onDiscard:function(){i(null),c(!1)}},n.createElement("div",{className:"dshcs-field"},n.createElement("div",{className:"dshcs-fieldHead"},n.createElement("span",{className:"dshcs-fieldLabel"},"\u5165\u53E3"),n.createElement("span",{className:"dshcs-badges"},n.createElement(j,{disabled:z!==!0,onClick:function(){D.openTab!==null&&D.openTab(null)}},"\u5728\u53F3\u4FA7\u680F\u6253\u5F00"))),n.createElement("div",{className:"dshcs-hint",style:{marginTop:6}},o!=null&&o.sidebarRegisterFailed===!0?'\u26A0 \u5DF2\u63A2\u6D4B\u5230\u53F3\u4FA7\u680F\u670D\u52A1,\u4F46\u6807\u7B7E\u6CE8\u518C\u5931\u8D25(\u63A7\u5236\u53F0\u6709 [code-server] \u62A5\u9519);IDE \u4ECD\u53EF\u901A\u8FC7"\u7A97\u53E3\u5316\u6253\u5F00(\u65B0\u6807\u7B7E\u9875)"\u4F7F\u7528\u3002':'\u5F53\u524D:\u53F3\u4FA7\u680F\u6807\u7B7E,\u5E76**\u8BA4\u9886\u6587\u4EF6\u5730\u5740**\u2014\u2014DSH \u5B98\u65B9\u7684\u4EA7\u7269 chip\u3001"\u4EA4\u4ED8"\u5361\u7247\u9884\u89C8\u3001\u6B63\u6587\u91CC\u7684\u6587\u4EF6\u540D\u70B9\u51FB\u90FD\u4F1A\u5728 Code Server \u91CC\u6253\u5F00\u3002')),n.createElement("div",{className:"dshcs-field"},n.createElement("div",{className:"dshcs-fieldHead"},n.createElement("span",{className:"dshcs-fieldLabel"},"\u8BA4\u9886\u8303\u56F4(\u54EA\u4E9B\u6587\u4EF6\u4EA4\u7ED9 Code Server)"),C===!0?n.createElement(Y,{overridden:!0,disabled:t.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){I()}}):null),n.createElement(nr,{value:l!==null?l.fileOpenScope:m.fileOpenScope,disabled:t.writable!==!0,options:[{value:"session",label:"\u4EC5\u4F1A\u8BDD\u5185\u6587\u4EF6(\u63A8\u8350)"},{value:"all",label:"\u6240\u6709\u6587\u4EF6(\u542B\u5DE5\u4F5C\u533A\u5916\u7684\u7EDD\u5BF9\u8DEF\u5F84)"}],onChange:function(v){i(function(w){return Object.assign({},w!==null?w:m,{fileOpenScope:v==="all"?"all":"session"})}),c(!1)}}),n.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},"\u4F1A\u8BDD\u5185\u6587\u4EF6 = DSH \u7528 `dsh-resource://file/session/\u2026` \u547D\u540D\u7684\u6587\u4EF6(\u4EA7\u7269\u3001\u4EA4\u4ED8\u3001\u6B63\u6587\u63D0\u53CA\u3001\u5DE5\u5177\u89C6\u56FE);\u201C\u6240\u6709\u6587\u4EF6\u201D\u8FD8\u4F1A\u8BA4\u9886\u4E0D\u5E26\u4F1A\u8BDD\u7684\u7EDD\u5BF9\u8DEF\u5F84 `dsh-resource://file/absolute/\u2026`\u3002\u672A\u88AB\u8BA4\u9886\u7684\u5730\u5740\u7531 DSH \u81EA\u5E26\u9884\u89C8\u515C\u5E95\u3002")),n.createElement("div",{className:"dshcs-field"},n.createElement("div",{className:"dshcs-fieldHead"},n.createElement("span",{className:"dshcs-fieldLabel"},"\u7A97\u53E3\u5316\u6253\u5F00(\u65B0\u6807\u7B7E\u9875)"),y===!0?n.createElement(Y,{overridden:!0,disabled:t.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){I()}}):null),n.createElement(fe,{checked:l!==null?l.windowedOpen:m.windowedOpen,disabled:t.writable!==!0,onChange:function(v){i(function(w){return Object.assign({},w!==null?w:m,{windowedOpen:v===!0})}),c(!1)}},"\u5F00\u542F\u540E\u5165\u53E3(\u8BBE\u7F6E\u5361\u6309\u94AE/guide \u5165\u53E3\u6846)\u5728\u6D4F\u89C8\u5668\u65B0\u6807\u7B7E\u9875\u6253\u5F00 code-server(\u81EA\u52A8\u542F\u52A8\u5E76\u8DDF\u968F\u5F53\u524D\u5DE5\u4F5C\u533A);\u5173\u95ED\u5219\u4F7F\u7528\u53F3\u4FA7\u680F\u6807\u7B7E")),n.createElement("div",{className:"dshcs-field"},n.createElement("div",{className:"dshcs-fieldHead"},n.createElement("span",{className:"dshcs-fieldLabel"},"\u540E\u53F0\u5E38\u9A7B(\u5207\u6807\u7B7E\u4E0D\u91CD\u8F7D)"),S===!0?n.createElement(Y,{overridden:!0,disabled:t.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){I()}}):null),n.createElement(fe,{checked:l!==null?l.keepResident:m.keepResident,disabled:t.writable!==!0,onChange:function(v){i(function(w){return Object.assign({},w!==null?w:m,{keepResident:v===!0})}),c(!1)}},'\u5F00\u542F\u540E\u5BBF\u4E3B\u542F\u52A8\u5373\u628A IDE \u52A0\u8F7D\u5230\u540E\u53F0"\u505C\u653E\u533A":\u5207\u6362\u53F3\u4FA7\u680F\u6807\u7B7E\u3001\u6536\u8D77/\u5C55\u5F00\u4FA7\u680F\u3001\u62D6\u6210\u6D6E\u52A8\u7A97\u53E3\u90FD\u4E0D\u518D\u91CD\u8F7D,\u9996\u6B21\u6253\u5F00\u514D\u7B49\u5F85;\u5173\u95ED\u5219\u53EA\u5728\u6253\u5F00\u9762\u677F\u65F6\u52A0\u8F7D(\u7701\u5185\u5B58)'),n.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},O?"\u5E38\u9A7B\u9762:"+(h.docked?"\u5DF2\u505C\u9760":h.ready?"\u5DF2\u505C\u653E(\u540E\u53F0\u8FD0\u884C\u4E2D)":"\u672A\u542F\u52A8")+(h.degraded?" \xB7 \u672C\u6B21\u53D1\u751F\u8FC7\u964D\u7EA7\u91CD\u8F7D":""):"\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 Element.moveBefore(Chromium <133)\u2192 \u5E38\u9A7B\u4E0D\u53EF\u7528,\u5207\u6807\u7B7E\u4ECD\u4F1A\u6574\u9875\u91CD\u8F7D(\u5347\u7EA7\u6D4F\u89C8\u5668\u540E\u81EA\u52A8\u751F\u6548)")),n.createElement("div",{className:"dshcs-field"},n.createElement("div",{className:"dshcs-fieldHead"},n.createElement("span",{className:"dshcs-fieldLabel"},"\u4F9D\u8D56\u5B89\u88C5"),null),n.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},"0.1.36 \u8D77 code-server \u672C\u4F53\u968F\u63D2\u4EF6\u5305\u53D1\u5E03,VS Code \u5185\u90E8\u4F9D\u8D56\u4E0E\u9884\u7F16\u8BD1\u539F\u751F\u6A21\u5757(\u5E73\u53F0\u805A\u5408\u5305)\u5168\u90E8\u7531\u5305\u7BA1\u7406\u5668\u5728 dsh plugin add \u65F6\u5B89\u88C5,\u4E0D\u518D\u9700\u8981\u300C\u5B89\u88C5\u73AF\u5883\u300D\u6B65\u9AA4\u3002")),ge)}catch(E){return console.error("[code-server] card render error:",E!=null&&E.message!==void 0?E.message:String(E)),null}}function lr(e){try{sr(e)}catch(r){console.error("[code-server] apply failed:",r&&r.stack?r.stack:String(r));try{document.title="CS-ERR "+(r&&r.message||String(r))}catch(t){}}}function sr(e){var r=e.get("slots");if(r===void 0){console.error("[code-server] slots service unavailable");return}var t=e.settingsScope,s=null;if(t!==void 0&&typeof t.bind=="function")s=t.bind({namespace:"code-server"});else{console.error("[code-server] settingsScope unavailable (inject missing?); settings card disabled");return}k("/code-server/status").then(function(f){N({status:f})}).catch(function(){}),r.inject("settings.plugin.item",()=>r.register({name:"settings.plugin.item",key:"code-server",label:"Code Server",inject:function(){return{scope:s}}},ar));var l=!1;function i(f,g){if(!l){l=!0,o();var m=!1;try{m=qe(f)}catch(y){console.error("[code-server] sidebar tab registration failed:",y!=null&&y.message!=null?y.message:String(y))}A.sidebarUi==="legacy"&&(console.log("[code-server] \u53F3\u4FA7\u680F\u670D\u52A1\u665A\u5230(\u7ECF "+g+"):\u64A4\u9500\u65E7\u7248 DSH \u5224\u5B9A"),k("/code-server/ui-mode",{sidebar:!0}).catch(function(){})),N({sidebarActive:m,sidebarUi:"modern",sidebarRegisterFailed:m!==!0}),r.inject("shell.overlay",()=>r.register({name:"shell.overlay",id:"code-server",order:70,label:"Code Server"},y=>n.createElement(Ge,y))),console.log("[code-server] client registered via "+g+": sidebar tab="+m+"(claims dsh-resource://file/**) + resident preload + settings card")}}function d(f){N({sidebarActive:!1,sidebarUi:"legacy"}),console.warn("[code-server] \u672A\u63A2\u6D4B\u5230\u53F3\u4FA7\u680F\u670D\u52A1(sidebarRightTabs/sidebarRight): \u672C\u63D2\u4EF6\u81EA 0.2.3 \u8D77\u4E0D\u518D\u517C\u5BB9\u65E7\u7248 DSH \u2014\u2014 \u9664\u300C\u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 Code Server\u300D\u7684\u63D0\u793A\u5916\u4E0D\u63D0\u4F9B\u4EFB\u4F55\u5165\u53E3,\u4E5F\u4E0D\u9884\u70ED IDE\u3002\u8BF7\u5347\u7EA7 DSH\u3002"),f===!0&&k("/code-server/ui-mode",{sidebar:!1}).catch(function(){})}var p=null,b=null,c=null;function o(){p!==null&&(clearTimeout(p),p=null),b!==null&&(clearTimeout(b),b=null),c!==null&&(clearTimeout(c),c=null)}var h=!1;try{typeof e.inject=="function"&&(h=!0,e.inject(["sidebarRightTabs","sidebarRight"],function(f){i(f,"inject")}))}catch(f){console.warn("[code-server] sidebar inject failed:",f!=null&&f.message!=null?f.message:String(f))}var x=typeof e.get=="function"&&e.get("sidebarRightTabs")!==void 0&&e.get("sidebarRight")!==void 0;if(x){c=setTimeout(function(){l||(console.warn("[code-server] ctx.inject \u672A\u5728 1.5s \u5185\u56DE\u8C03,\u6539\u7528\u540C\u6B65\u670D\u52A1\u6CE8\u518C\u4FA7\u680F"),i(e,"sync-fallback"))},Ye);return}if(h!==!0){d(!0);return}p=setTimeout(function(){l||d(!1)},Ve),b=setTimeout(function(){l||d(!0)},We)}var ir=["slots","settingsScope"],dr="code-server";
|
|
2
|
+
var R=Object.defineProperty;var fe=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var ve=Object.prototype.hasOwnProperty;var he=(e,r)=>{for(var t in r)R(e,t,{get:r[t],enumerable:!0})},be=(e,r,t,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of pe(r))!ve.call(e,a)&&a!==t&&R(e,a,{get:()=>r[a],enumerable:!(l=fe(r,a))||l.enumerable});return e};var ge=e=>be(R({},"__esModule",{value:!0}),e);var tr={};he(tr,{apply:()=>qe,inject:()=>er,name:()=>rr});module.exports=ge(tr);var Q="dsh-resource://file/",me="sidebar://",Y="session";function I(e){return typeof e=="string"&&e.startsWith(me)}function M(e){if(typeof e!="string"||!e.startsWith(Q))return null;for(var r=e.length,t=0;t<e.length;t+=1){var l=e.charAt(t);if(l==="?"||l==="#"){r=t;break}}var a=e.slice(Q.length,r).split("/"),s=a.shift();try{if(s==="session"){var d=a.shift();return d===void 0||d===""||a.length===0?null:{scope:"session",sessionId:decodeURIComponent(d),path:W(a)}}if(s==="absolute"){var f=a[0]===""&&a.length>1,p=f?a.slice(1):a,o=W(p);return(o===""||o.charAt(0)==="/")&&!f?null:f?{scope:"absolute",path:"//"+o}:o===""?null:{scope:"absolute",path:Z(o)?o:"/"+o}}}catch(c){return null}return null}function W(e){for(var r=[],t=0;t<e.length;t+=1)r.push(decodeURIComponent(e[t]));return r.join("/")}function Z(e){return/^[A-Za-z]:($|\/)/.test(e)}function ye(e){return typeof e!="string"||e===""?!1:e.charAt(0)==="/"?!0:Z(e)}function J(e){var r=M(e);if(r===null)return"";var t=r.path.replace(/[/\\]+$/,""),l=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\")),a=l===-1?t:t.slice(l+1);return a}function V(e,r){if(e===null||e==null)return null;var t=typeof e.path=="string"?e.path:"";if(t==="")return null;if(ye(t))return t;if(typeof r!="string"||r==="")return null;var l=r.indexOf("\\")!==-1?"\\":"/",a=r.replace(/[\\/]+$/,"");return a+l+(l==="\\"?t.replace(/\//g,"\\"):t)}function X(e,r){return e===null||e==null?!1:e.scope==="session"?!0:r==="all"}var N=typeof Element!="undefined"&&typeof Element.prototype.moveBefore=="function",we=-2e4,n={park:null,frame:null,currentSrc:null,sameOrigin:null,owner:null,lastRect:null,parkStrategy:"offscreen",degraded:!1,preloaded:!1,nudgeCount:0,nudgeEnabled:!0,lastNudgeAt:0,listeners:new Set};function D(){return{ready:n.frame!==null,docked:n.owner!==null,owner:n.owner,src:n.currentSrc,sameOrigin:n.sameOrigin,parkStrategy:n.parkStrategy,degraded:n.degraded,preloaded:n.preloaded,supportsMoveBefore:N,nudgeCount:n.nudgeCount,lastNudgeAt:n.lastNudgeAt}}function O(){var e=D();n.listeners.forEach(function(r){try{r(e)}catch(t){}})}function K(e){return n.listeners.add(e),function(){n.listeners.delete(e)}}function q(){return D()}function xe(e){e!=="offscreen"&&e!=="behind"||n.parkStrategy!==e&&(n.parkStrategy=e,n.frame!==null&&n.owner===null&&z(),O())}function Se(){return n.parkStrategy}function ke(){var e=n.lastRect;e!==null&&(n.park.style.width=Math.max(1,Math.round(e.width))+"px",n.park.style.height=Math.max(1,Math.round(e.height))+"px")}function z(){if(n.park!==null){if(ke(),n.parkStrategy==="behind"&&n.lastRect!==null){n.park.style.left=Math.round(n.lastRect.left)+"px",n.park.style.top=Math.round(n.lastRect.top)+"px",n.park.style.visibility="visible",n.park.style.zIndex="0";return}n.park.style.left=we+"px",n.park.style.top="0px",n.park.style.visibility="hidden",n.park.style.zIndex="0"}}function $(){n.frame!==null&&(n.frame.setAttribute("inert",""),n.frame.setAttribute("aria-hidden","true"))}function Ee(){n.frame!==null&&(n.frame.removeAttribute("inert"),n.frame.removeAttribute("aria-hidden"))}function Ce(){var e=document.createElement("div");e.className="dshcs-park",e.setAttribute("data-dshcs-park",""),e.setAttribute("aria-hidden","true");var r=document.createElement("iframe");return r.className="dshcs-frame",r.setAttribute("title","code-server"),r.setAttribute("allow","clipboard-read; clipboard-write"),r.setAttribute("data-dshcs-resident",""),r.src="about:blank",e.appendChild(r),document.body.appendChild(e),n.park=e,n.frame=r,n.currentSrc="about:blank",n.owner=null,z(),$(),r}function Ne(e){var r=n.frame;if(r!==null){var t=n.sameOrigin!==e;!t&&r.hasAttribute("data-dshcs-attrs")||(e===!0?r.removeAttribute("sandbox"):e===!1&&r.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms allow-modals allow-popups allow-pointer-lock allow-clipboard-read allow-clipboard-write"),r.setAttribute("data-dshcs-attrs",e===!0?"same-origin":"cross-origin"),n.sameOrigin=e)}}function j(e){var r=e||{};return n.frame===null&&Ce(),typeof r.sameOrigin=="boolean"&&Ne(r.sameOrigin),typeof r.src=="string"&&r.src!==""&&r.src!==n.currentSrc&&Oe(r.src),n.frame}function Oe(e){n.frame===null||typeof e!="string"||e===""||e===n.currentSrc||(n.currentSrc=e,n.frame.src=e,O())}function ee(){var e=n.frame;if(n.nudgeEnabled!==!0||e===null||e.isConnected!==!0)return!1;var r=e.style.display;return e.style.display="none",e.offsetHeight,e.style.display=r,n.nudgeCount+=1,n.lastNudgeAt=Date.now(),!0}function Le(e){return n.nudgeEnabled=e!==!1,n.nudgeEnabled}function re(e){if(n.frame!==null){if(N)try{e.moveBefore(n.frame,null);return}catch(r){n.degraded=!0,n.lastMoveError=(r&&r.name?r.name+": ":"")+(r&&r.message?r.message:String(r))}else n.degraded=!0;e.appendChild(n.frame)}}function P(e,r){if(!(n.frame===null||e==null)){var t=n.owner===null,l=e.getBoundingClientRect();l.width>=1&&l.height>=1&&(n.lastRect={left:l.left,top:l.top,width:l.width,height:l.height}),n.owner=r===void 0?null:r,Ee(),n.park.setAttribute("aria-hidden","true"),re(e),t&&ee(),O()}}function L(e){n.frame!==null&&(e!==void 0&&n.owner!==e||(n.owner=null,z(),$(),n.park.setAttribute("aria-hidden","true"),re(n.park),O()))}function H(e){var r=e||{};return j(r),n.owner===null&&(typeof r.src=="string"&&r.src!==""&&(n.preloaded=!0),L()),n.frame}function Ae(){n.park!==null&&n.park.parentNode!==null&&n.park.parentNode.removeChild(n.park),n.park=null,n.frame=null,n.currentSrc=null,n.sameOrigin=null,n.owner=null,n.lastRect=null,n.degraded=!1,n.preloaded=!1,n.nudgeCount=0,n.lastNudgeAt=0,O()}typeof window!="undefined"&&(window.__dshcsSurface={snapshot:D,setParkStrategy:xe,getParkStrategy:Se,preload:H,dock:P,park:L,nudge:ee,setNudgeEnabled:Le,destroy:Ae});var i=require("react"),_=new Set,A={status:null,busy:!1,sidebarUi:"unknown",sidebarRegisterFailed:!1};function C(e){A=Object.assign({},A,e),_.forEach(function(r){r()})}function Me(e){return _.add(e),function(){_.delete(e)}}function Te(){return A}function B(){return i.useSyncExternalStore(Me,Te)}var Re="/api",Ie="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMTQ3IDE0NyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8c3R5bGU+QG1lZGlhIChwcmVmZXJzLWNvbG9yLXNjaGVtZTogZGFyaykgeyogeyBmaWxsOiB3aGl0ZTsgfX08L3N0eWxlPgogIDxwYXRoIGQ9Im00Mi40MjE0LDM5LjY1NWMtMjQuNDA1NywwIC00Mi4xNTU0LDEzLjE3MjEgLTQyLjE1NTQsMzMuODQ1YzAsMjAuNTgxNCAxOC40ODkyLDMzLjg0NSA0Mi4xNTU0LDMzLjg0NWMyMy42NjYyLDAgMzguMTgwMywtMTEuNjE3MSAzOC43MzQ5LC0yOC43MjI1bC0yMS4wNzc3LC0wLjQ1NzRjLTAuOTI0NCw5LjMzMDMgLTkuMTA1OSwxNS4xODQ1IC0xNy42NTcyLDE1LjE4NDVjLTExLjc0MDYsMCAtMjAuNDMwNiwtNy41OTIyIC0yMC40MzA2LC0xOS44NDk2YzAsLTEyLjI1NzQgOC42OSwtMTkuOTg2OCAyMC40MzA2LC0yMC4yMTU1YzguNTUxMywtMC4xODMgMTYuOTE3Nyw1Ljk0NTcgMTcuNDcyMywxNS4yNzZsMjEuMDc3NywtMC42NDAzYy0wLjQ2MjIsLTE2LjgzMTEgLTE0LjE0NDIsLTI4LjI2NTIgLTM4LjU1LC0yOC4yNjUyem00OC44NDQ2LDJsNTUuNDY4LDBsMCw2NC4wMzExbC01NS40NjgsMGwwLC02NC4wMzExeiIgY2xpcC1ydWxlPSJldmVub2RkIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz4KPC9zdmc+Cg==";async function E(e,r){var t={method:r===void 0?"GET":"POST",headers:{}};r!==void 0&&(t.headers["content-type"]="application/json",t.body=JSON.stringify(r));var l=await fetch(Re+e,t),a=await l.text(),s=null;try{s=a===""?null:JSON.parse(a)}catch(d){s=null}return l.ok?s!==null?s:{ok:!1,error:"invalid JSON response"}:{ok:!1,error:"HTTP "+l.status+(s!==null&&s.error!==void 0?": "+s.error:"")}}function de(e,r){try{var t=e(function(v){return v}),l=r===null?null:typeof r=="function"?r(function(v){return v}):null,a=t!=null?t.current:void 0;if(a!==void 0&&t!=null&&t.byId!=null){var s=t.byId[a];if(s!=null&&typeof s.cwd=="string"&&s.cwd!=="")return s.cwd}var d=l!=null&&Array.isArray(l.items)?l.items:[];if(a!==void 0)for(var f=0;f<d.length;f++){var p=d[f];if(p.sessionIds!=null&&p.sessionIds.indexOf(a)!==-1&&typeof p.path=="string"&&p.path!=="")return p.path}var o=l!=null?l.recentWorkspaceId:void 0;if(o!==void 0){for(var c=0;c<d.length;c++)if(d[c].workspaceId===o&&typeof d[c].path=="string"&&d[c].path!=="")return d[c].path}if(d.length>0&&typeof d[0].path=="string"&&d[0].path!=="")return d[0].path}catch(v){}}function oe(e,r){if(e==null||typeof e.url!="string"||e.url==="")return null;var t=typeof r=="string"&&r!==""?r:e!=null&&e.cwd!=null?e.cwd:null;if(t==null||t==="")return e.url;var l=t.replace(/\\/g,"/"),a=l;return(/^[A-Za-z]:\//.test(l)||l.charCodeAt(0)!==47)&&(a="/"+l),e.url+"?folder="+encodeURIComponent(a)}function De(e){var r=e.status,t=e.pageUrl,l=e.reloadTick,a=e.owner,s=i.useRef(null),d=r!=null&&r.ok===!0&&r.running===!0,f=r!=null&&r.status==="starting",p=r!=null&&r.ok===!1,o=r!=null&&r.serve==="dsh";if(i.useLayoutEffect(function(){if(!d||t===null){L(a);return}j({src:t,sameOrigin:o}),s.current!==null&&P(s.current,a)},[d,t,o,l,a]),i.useLayoutEffect(function(){return function(){L(a)}},[a]),d&&t!==null)return i.createElement("div",{ref:s,className:"dshcs-slot","data-code-server-slot":a!=null?a:"code-server"});if(f)return i.createElement("div",{className:"dshcs-loading"},"\u6B63\u5728\u542F\u52A8 code-server\u2026");var c=p&&r!=null&&r.error?r.error:"code-server \u672A\u8FD0\u884C",v=o?"\u5F53\u524D\u4EE5 DSH \u540C\u6E90\u8DEF\u5F84 "+(r!=null&&r.url||"/code-server/")+" \u63D0\u4F9B(\u65E0\u72EC\u7ACB\u7AEF\u53E3)\u3002":"\u5F53\u524D\u4EE5\u72EC\u7ACB\u56DE\u73AF\u7AEF\u53E3\u63D0\u4F9B(\u7AEF\u53E3 "+(r!=null&&r.port!=null?r.port:"8090")+" \u88AB\u5360\u7528\u65F6\u8BF7\u91CA\u653E\u6216\u4FEE\u6539 port \u914D\u7F6E)\u3002",y=N?"\u5E38\u9A7B\u9762:\u53EF\u7528(\u5207\u6807\u7B7E/\u6536\u8D77\u4FA7\u680F\u4E0D\u91CD\u8F7D)\u3002":"\u5E38\u9A7B\u9762:\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 Element.moveBefore \u2014\u2014 \u5207\u6807\u7B7E\u4F1A\u6574\u9875\u91CD\u8F7D(\u5347\u7EA7\u6D4F\u89C8\u5668\u540E\u81EA\u52A8\u53EF\u7528)\u3002";return i.createElement("div",{className:"dshcs-empty"},i.createElement("div",{className:"dshcs-emptybox"},i.createElement("div",null,p?"code-server \u542F\u52A8\u5931\u8D25":"code-server \u672A\u8FD0\u884C"),i.createElement("pre",{className:"dshcs-error"},c),i.createElement("p",{className:"dshcs-hint"},"VS Code \u6811\u968F\u63D2\u4EF6\u5305\u5185\u7F6E\u3001\u5C31\u5730\u8FD0\u884C(\u65E0\u9700\u5168\u5C40\u5B89\u88C5\u3001\u65E0\u9700\u8054\u7F51\u5B89\u88C5\u3001\u65E0\u300C\u5B89\u88C5\u73AF\u5883\u300D\u6B65\u9AA4);\u5185\u90E8\u4F9D\u8D56\u4E0E\u9884\u7F16\u8BD1\u539F\u751F\u6A21\u5757\u7531\u5305\u7BA1\u7406\u5668\u5728\u5B89\u88C5\u63D2\u4EF6\u65F6\u4E00\u5E76\u88C5\u597D(\u65E0\u9700 C++ \u5DE5\u5177\u94FE)\u3002\u82E5\u6B64\u5904\u957F\u671F\u672A\u8FD0\u884C,\u8BF7\u67E5\u770B DSH host \u65E5\u5FD7\u91CC\u7684 [code-server] \u8F93\u51FA(\u6216\u5728\u8BBE\u7F6E\u5361\u7247\u91CC\u5207\u6362\u300C\u540E\u53F0\u5E38\u9A7B\u300D\u89E6\u53D1\u4E00\u6B21\u542F\u52A8)\u3002"+v+y)))}function ze(e){var r=B(),t=r.status,l=t!=null&&t.ok===!0&&t.running===!0,a=t!=null&&t.keepResident===!0,s=de(e&&e.useSessions,e&&e.useWorkspaces),d=l?oe(t,s):null;return i.useEffect(function(){!a||!l||d===null||H({src:d,sameOrigin:t!=null&&t.serve==="dsh"})},[a,l,d,t!=null?t.serve:null]),null}var je=".dshcs-frame{display:block;position:absolute;inset:0;z-index:1;width:100%;height:100%;border:0;background:var(--dsw-alias-bg-base,#fff)}.dshcs-tabroot{position:relative;display:flex;flex-direction:column;width:100%;height:100%;min-width:0;min-height:0;background:var(--dsw-alias-bg-base,#fff)}.dshcs-slot{position:relative;display:block;width:100%;height:100%;min-width:0;min-height:0;overflow:hidden;background:var(--dsw-alias-bg-base,#fff)}.dshcs-park{position:fixed;left:-20000px;top:0;width:320px;height:200px;overflow:hidden;pointer-events:none;z-index:0;visibility:hidden;contain:strict}.dshcs-loading{position:absolute;inset:0;z-index:2;display:grid;place-items:center;background:var(--dsw-alias-bg-base,#fff);color:var(--dsw-alias-label-tertiary,#7d8798);font-size:13px}.dshcs-empty{position:relative;z-index:2;flex:1;display:flex;align-items:center;justify-content:center;padding:44px 24px 24px}.dshcs-emptybox{max-width:560px;text-align:left;background:var(--dsw-alias-bg-layer-2,#f7f8fb);border:1px solid var(--dsw-alias-border-l2,#dfe3eb);border-radius:12px;padding:16px 18px}.dshcs-error{color:var(--dsw-alias-label-error,#d92d20);white-space:pre-wrap;word-break:break-all;font-family:ui-monospace,Consolas,monospace;font-size:12px;margin:8px 0 0}.dshcs-hint{color:var(--dsw-alias-label-tertiary,#7d8798);font-size:12px;margin:6px 0 0}.dshcs-legacy{color:var(--dsw-alias-label-warning,#b54708);font-size:12px;font-weight:600;margin:0 0 6px}",te="dsh-code-server/styles";typeof document!="undefined"&&document.querySelector("style[data-dshcs="+JSON.stringify(te)+"]")===null&&(T=document.createElement("style"),T.setAttribute("data-dshcs",te),T.textContent=je,document.head.appendChild(T));var T,ne="code-server",ae="dsh-code-server-app",Pe=2500,He=1e4,Ue=1500;function _e(e){var r=e!=null&&typeof e.size=="number"?e.size:16;return i.createElement("img",{src:Ie,alt:"","aria-hidden":!0,draggable:!1,className:e!=null?e.className:void 0,style:{width:r,height:r,display:"block",objectFit:"contain",WebkitUserDrag:"none",userSelect:"none"}})}function Be(){var e=A.status;return e!=null&&e.fileOpenScope==="all"?"all":Y}function Fe(e,r){try{var t=e(function(a){return a});if(t!=null&&r!=null&&t.byId!=null){var l=t.byId[r];if(l!=null&&typeof l.cwd=="string"&&l.cwd!=="")return l.cwd}}catch(a){}}function Ge(e){var r=e.useTabInfo(),t=r.tab,l=B(),a=l.status,s=t.navigation,d=s!=null&&typeof s.revision=="number"?s.revision:0,f=s!=null&&typeof s.address=="string"?s.address:"",p=I(f)?null:M(f),o=Fe(e.useSessions,p!=null?p.sessionId:void 0),c=o!==void 0?o:de(e.useSessions,null),v=V(p,c),y=s!=null&&s.params!=null&&typeof s.params.line=="number"?s.params.line:null,u=i.useRef(void 0),[m,b]=i.useState(0);return i.useEffect(function(){if(!(typeof c!="string"||c==="")&&u.current!==c){var g=u.current!==void 0;u.current=c;var w=!1;return E("/code-server/start",{cwd:c}).then(function(S){w||(C({status:S}),g&&S!=null&&S.ok===!0&&S.running===!0&&b(function(F){return F+1}))}).catch(function(){}),function(){w=!0}}},[c]),i.useEffect(function(){E("/code-server/status").then(function(w){w!=null&&C({status:w})}).catch(function(){});var g=window.setInterval(function(){E("/code-server/status").then(function(w){C({status:w})}).catch(function(){})},3e3);return function(){window.clearInterval(g)}},[]),i.useEffect(function(){v!==null&&E("/code-server/open-file",y===null?{file:v}:{file:v,line:y}).catch(function(){})},[d,v,y]),i.createElement("div",{className:"dshcs-tabroot","data-code-server-tab":"body"},i.createElement(De,{status:a,pageUrl:oe(a,c),reloadTick:m,owner:"tab:"+t.id}))}function U(e,r){if(e==null)return null;var t=e[r];if(t!=null)return t;if(typeof e.get=="function"){var l=e.get(r);if(l!=null)return l}return null}function Qe(e){var r=U(e,"sidebarRightTabs"),t=U(e,"sidebarRight");if(r==null||t==null)return console.error("[code-server] \u53F3\u4FA7\u680F\u670D\u52A1\u4E0A\u4E0B\u6587\u4E0D\u53EF\u89C1(sidebarRightTabs="+(r!=null)+", sidebarRight="+(t!=null)+"):\u8DF3\u8FC7\u4FA7\u680F\u6CE8\u518C"),!1;var l=U(e,"slots");if(e.effect(function(){return r.register({id:ae,kind:ne,priority:"extension",patterns:["dsh-resource://file/**"],canOpen:function(a){return X(M(a),Be())},title:function(a){if(I(a)||a===void 0||a===null||a==="")return"Code Server";var s=J(a);return s===""?"Code Server":s},guide:[{order:20,title:function(){return"Code Server"},description:function(){return"\u5728\u53F3\u4FA7\u680F\u6807\u7B7E\u91CC\u8FD0\u884C VS Code \u7F51\u9875\u7248,\u8DDF\u968F\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u533A;\u4EA7\u7269/\u4EA4\u4ED8\u6587\u4EF6\u70B9\u51FB\u540E\u5728\u6B64\u6253\u5F00\u3002"},icon:_e}]})},"code-server: sidebar tab type"),l!=null)e.effect(function(){return l.inject("sidebar.right.pane.tab",function(){return l.register({name:"sidebar.right.pane.tab",key:ae},Ge)})},"code-server: sidebar tab body");else return console.error("[code-server] slots \u670D\u52A1\u4E0D\u53EF\u89C1:\u4FA7\u680F\u6807\u7B7E body \u672A\u6CE8\u518C"),!1;return e.effect(function(){return function(){C({sidebarUi:"unknown"})}},"code-server: sidebar mode reset"),console.log("[code-server] right-sidebar tab registered (kind="+ne+")"),!0}var We=".dshcs-card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}.dshcs-card:hover{border-color:var(--dsw-alias-label-dimmed,var(--dsw-alias-border-l2))}.dshcs-cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed,var(--dsw-alias-border-l2))}.dshcs-cardHeader{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}.dshcs-cardHeader:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}.dshcs-cardHeadText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.dshcs-cardName{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}.dshcs-cardDescription{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));font-size:13px;line-height:1.5}.dshcs-cardChevron{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));flex:none;transition:transform .16s;display:inline-flex}.dshcs-cardChevronOpen{transform:rotate(180deg)}.dshcs-cardBody{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}.dshcs-cardReadOnly{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));margin:12px 0 0;font-size:12px;line-height:1.5}.dshcs-pending{white-space:nowrap;background:var(--dsw-alias-bg-module-platform,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-secondary);border-radius:999px;flex:none;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.dshcs-cardFooter{border-top:1px solid var(--dsw-alias-border-l2);justify-content:flex-end;align-items:center;gap:8px;padding:12px 0 4px;display:flex}.dshcs-cardFailed{min-width:0;color:var(--dsw-alias-label-error,var(--dsw-alias-state-error-primary));flex:1;margin:0;font-size:12px;line-height:1.5}.dshcs-cbtn{appearance:none;font:inherit;cursor:pointer;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5;border:1px solid transparent;transition:color .12s ease,background .12s ease}.dshcs-cbtn:disabled{opacity:.4;cursor:default}.dshcs-cbtn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.dshcs-cbtnOutline{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:0 0}.dshcs-cbtnOutline:hover:not(:disabled){color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover,transparent)}.dshcs-cbtnPrimary{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3);border-color:var(--dsw-alias-label-primary);font-weight:600}.dshcs-cbtnPrimary:hover:not(:disabled){filter:brightness(.95)}.dshcs-cbtnPrimary:active:not(:disabled){filter:brightness(.9)}.dshcs-field{flex-direction:column;gap:6px;padding:12px 0;display:flex}.dshcs-field+.dshcs-field{border-top:1px solid var(--dsw-alias-border-l2)}.dshcs-fieldHead{align-items:center;gap:8px;display:flex}.dshcs-fieldLabel{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}.dshcs-card .dshcs-hint{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));margin:0;font-size:12px;line-height:1.5}.dshcs-check{display:flex;align-items:center;gap:8px;cursor:pointer}.dshcs-check input{accent-color:var(--dsw-alias-brand-primary);width:15px;height:15px;margin:0;flex:none}.dshcs-check input:disabled{cursor:default}.dshcs-select{display:inline-flex;align-items:center}.dshcs-select select{font:inherit;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-3,transparent);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:4px 8px;min-width:220px;cursor:pointer}.dshcs-select select:disabled{opacity:.5;cursor:default}.dshcs-badges{align-items:center;gap:8px;display:inline-flex}.dshcs-badge{white-space:nowrap;background:var(--dsw-alias-bg-module-platform,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-secondary);border-radius:999px;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.dshcs-reset{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;padding:0;font-size:12px;line-height:1.5}.dshcs-reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}.dshcs-reset:disabled{cursor:default}",Ye="dsh-code-server/Card.module.css";function Ze(e,r){if(typeof document!="undefined"&&document.querySelector("style[data-plugin-css="+JSON.stringify(e)+"]")===null){var t=document.createElement("style");t.dataset.plugin="dsh-code-server",t.dataset.pluginCss=e,t.textContent=r,document.head.appendChild(t)}}Ze(Ye,We);function Je(e){return i.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none","aria-hidden":!0,className:e.className},i.createElement("path",{d:"M3.5 5.25L7 8.75L10.5 5.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))}function le(e){return i.createElement("button",{type:"button",className:"dshcs-cbtn "+(e.variant==="primary"?"dshcs-cbtnPrimary":"dshcs-cbtnOutline"),disabled:e.disabled===!0,onClick:e.onClick},e.children)}function Ve(e){return i.createElement("label",{className:"dshcs-check"},i.createElement("input",{type:"checkbox",checked:e.checked===!0,disabled:e.disabled===!0,onChange:function(r){e.onChange(r.target.checked)}}),i.createElement("span",{className:"dshcs-hint"},e.children))}function Xe(e){var r=Array.isArray(e.options)?e.options:[];return i.createElement("label",{className:"dshcs-select"},i.createElement("select",{value:e.value,disabled:e.disabled===!0,onChange:function(t){e.onChange(t.target.value)}},r.map(function(t){return i.createElement("option",{key:t.value,value:t.value},t.label)})))}function ie(e){var r=[];return e.overridden===!0&&(r.push(i.createElement("span",{className:"dshcs-badge"},e.overriddenLabel)),r.push(i.createElement("button",{type:"button",className:"dshcs-reset",disabled:e.disabled===!0,onClick:e.onReset},e.resetLabel))),r.length===0?null:i.createElement("span",{className:"dshcs-badges"},...r)}function se(e){var[r,t]=i.useState(e.defaultOpen===!0),l=e.state;if(l==null||l.available!==!0)return null;var a=e.title,s=e.noticeOnly===!0,d=l.dirty!==!0||l.invalid===!0||l.saving===!0;return i.createElement("li",{className:"dshcs-card"+(r?" dshcs-cardOpen":"")},i.createElement("button",{type:"button",className:"dshcs-cardHeader","aria-expanded":r,onClick:function(){t(!r)}},i.createElement("span",{className:"dshcs-cardHeadText"},i.createElement("span",{className:"dshcs-cardName"},a),i.createElement("span",{className:"dshcs-cardDescription"},e.description)),l.dirty===!0?i.createElement("span",{className:"dshcs-pending"},e.unsavedLabel):null,i.createElement(Je,{className:"dshcs-cardChevron"+(r?" dshcs-cardChevronOpen":"")})),r===!0?i.createElement("div",{className:"dshcs-cardBody"},s===!0?null:l.writable!==!0?i.createElement("p",{className:"dshcs-cardReadOnly",role:"status"},e.readOnlyLabel):null,e.children,s===!0?null:i.createElement("div",{className:"dshcs-cardFooter"},l.failed===!0?i.createElement("p",{className:"dshcs-cardFailed",role:"status"},e.saveFailedLabel):null,i.createElement(le,{disabled:l.dirty!==!0||l.saving===!0,onClick:e.onDiscard},e.discardLabel),i.createElement(le,{variant:"primary",disabled:d,onClick:e.onSave},l.saving===!0?e.savingLabel:e.saveLabel))):null)}function Ke(e){try{let k=function(){E("/code-server/status").then(function(h){h!=null&&typeof h=="object"&&C({status:h})}).catch(function(){})};var r=e.scope,[t,l]=i.useState(function(){return r!==void 0?r.getSnapshot():null}),[a,s]=i.useState(null),[d,f]=i.useState(!1),[p,o]=i.useState(!1),c=B(),[v,y]=i.useState(q());if(i.useEffect(function(){return K(function(h){y(h)})},[]),i.useEffect(function(){if(r===void 0||typeof r.subscribe!="function")return;function h(){try{l(r.getSnapshot())}catch(nr){}}var x=r.subscribe(h);return function(){typeof x=="function"&&x()}},[r]),r===void 0)return console.error("[code-server] card scope missing"),null;if(t==null||t.status!=="ready")return t!=null&&t.status==="unavailable"&&console.warn("[code-server] settings scope unavailable:",t.status),null;var u=t.value!==void 0&&t.value!==null?t.value:{},m=t.user,b={keepResident:u.keepResident!==!1,fileOpenScope:u.fileOpenScope==="all"?"all":"session"};if(c!=null&&c.sidebarUi==="legacy")return i.createElement(se,{title:"Code Server",description:"\u5F53\u524D DSH \u7248\u672C\u4E0D\u53D7\u652F\u6301(\u7F3A\u5C11\u53F3\u4FA7\u680F\u670D\u52A1)",defaultOpen:!0,noticeOnly:!0,state:{available:!0,writable:!1,dirty:!1,invalid:!1,saving:!1,failed:!1}},i.createElement("div",{className:"dshcs-field"},i.createElement("div",{className:"dshcs-legacy"},"\u672C\u63D2\u4EF6\u81EA 0.2.3 \u8D77\u4E0D\u518D\u517C\u5BB9\u65E7\u7248 DSH\u3002"),i.createElement("div",{className:"dshcs-hint",style:{marginTop:0}},`\u672A\u68C0\u6D4B\u5230\u53F3\u4FA7\u680F\u63D2\u4EF6\u670D\u52A1 sidebarRightTabs / sidebarRight,\u56E0\u6B64\u63D2\u4EF6\u4E0D\u63D0\u4F9B\u4EFB\u4F55\u5165\u53E3(\u65E7\u7248\u7684\u60AC\u6D6E\u7403\u4E0E\u6D6E\u52A8\u7A97\u53E3\u5DF2\u79FB\u9664),\u4E5F\u4E0D\u4F1A\u540E\u53F0\u542F\u52A8 IDE\u3002
|
|
3
|
+
\u5347\u7EA7 DSH \u5230\u5E26\u53F3\u4FA7\u680F\u7684\u7248\u672C(\u2265 0.1.5-alpha.1)\u540E,Code Server \u4F1A\u51FA\u73B0\u5728\u53F3\u4FA7\u680F\u6807\u7B7E\u91CC,\u672C\u9875\u540C\u65F6\u663E\u793A\u5B8C\u6574\u8BBE\u7F6E\u9879;\u5347\u7EA7\u540E\u65E0\u9700\u91CD\u88C5\u672C\u63D2\u4EF6,\u5237\u65B0\u9875\u9762\u5373\u53EF\u3002`)));var g=m!=null&&Object.prototype.hasOwnProperty.call(m,"keepResident"),w=m!=null&&Object.prototype.hasOwnProperty.call(m,"fileOpenScope"),S=a!==null&&(a.keepResident!==b.keepResident||a.fileOpenScope!==b.fileOpenScope),F=!S||d,ce={available:!0,writable:t.writable,dirty:S,invalid:!1,saving:d,failed:p};async function ue(){if(S&&!d){f(!0),o(!1);try{var h=a!==null?a:b;await e.scope.set("keepResident",h.keepResident===!0),await e.scope.set("fileOpenScope",h.fileOpenScope==="all"?"all":"session"),s(null),k()}catch(x){o(!0)}f(!1)}}async function G(){if(!(d||t.writable!==!0)){f(!0),o(!1);try{typeof e.scope.unset=="function"?(await e.scope.unset("keepResident"),await e.scope.unset("fileOpenScope")):(await e.scope.set("keepResident",u.keepResident===void 0||u.keepResident===null?!0:u.keepResident),await e.scope.set("fileOpenScope",u.fileOpenScope==="all"?"all":"session")),s(null),k()}catch(h){o(!0)}f(!1)}}return i.createElement(se,{title:"Code Server",description:"\u5165\u53E3:\u53F3\u4FA7\u680F\u6807\u7B7E(DSH \u2265 0.1.5-alpha.1);\u8BA4\u9886\u8303\u56F4\u51B3\u5B9A\u54EA\u4E9B\u6587\u4EF6\u4EA4\u7ED9 Code Server \u6253\u5F00",state:ce,unsavedLabel:"\u672A\u4FDD\u5B58",readOnlyLabel:"\u672C\u90E8\u7F72\u7684\u8BBE\u7F6E\u4E3A\u53EA\u8BFB\u3002",saveFailedLabel:"\u672C\u90E8\u7F72\u6CA1\u6709\u63A5\u53D7\u8FD9\u4E9B\u503C\uFF0C\u5DF2\u4FDD\u7559\u4F9B\u4F60\u4FEE\u6539\u3002",discardLabel:"\u653E\u5F03\u4FEE\u6539",saveLabel:"\u4FDD\u5B58",savingLabel:"\u4FDD\u5B58\u4E2D\u2026",onSave:ue,onDiscard:function(){s(null),o(!1)}},i.createElement("div",{className:"dshcs-field"},i.createElement("div",{className:"dshcs-fieldHead"},i.createElement("span",{className:"dshcs-fieldLabel"},"\u8BA4\u9886\u8303\u56F4(\u54EA\u4E9B\u6587\u4EF6\u4EA4\u7ED9 Code Server)"),w===!0?i.createElement(ie,{overridden:!0,disabled:t.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){G()}}):null),i.createElement(Xe,{value:a!==null?a.fileOpenScope:b.fileOpenScope,disabled:t.writable!==!0,options:[{value:"session",label:"\u4EC5\u4F1A\u8BDD\u5185\u6587\u4EF6(\u63A8\u8350)"},{value:"all",label:"\u6240\u6709\u6587\u4EF6(\u542B\u5DE5\u4F5C\u533A\u5916\u7684\u7EDD\u5BF9\u8DEF\u5F84)"}],onChange:function(h){s(function(x){return Object.assign({},x!==null?x:b,{fileOpenScope:h==="all"?"all":"session"})}),o(!1)}}),i.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},"\u4F1A\u8BDD\u5185\u6587\u4EF6 = DSH \u7528 `dsh-resource://file/session/\u2026` \u547D\u540D\u7684\u6587\u4EF6(\u4EA7\u7269\u3001\u4EA4\u4ED8\u3001\u6B63\u6587\u63D0\u53CA\u3001\u5DE5\u5177\u89C6\u56FE);\u201C\u6240\u6709\u6587\u4EF6\u201D\u8FD8\u4F1A\u8BA4\u9886\u4E0D\u5E26\u4F1A\u8BDD\u7684\u7EDD\u5BF9\u8DEF\u5F84 `dsh-resource://file/absolute/\u2026`\u3002\u672A\u88AB\u8BA4\u9886\u7684\u5730\u5740\u7531 DSH \u81EA\u5E26\u9884\u89C8\u515C\u5E95\u3002")),i.createElement("div",{className:"dshcs-field"},i.createElement("div",{className:"dshcs-fieldHead"},i.createElement("span",{className:"dshcs-fieldLabel"},"\u540E\u53F0\u5E38\u9A7B(\u5207\u6807\u7B7E\u4E0D\u91CD\u8F7D)"),g===!0?i.createElement(ie,{overridden:!0,disabled:t.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){G()}}):null),i.createElement(Ve,{checked:a!==null?a.keepResident:b.keepResident,disabled:t.writable!==!0,onChange:function(h){s(function(x){return Object.assign({},x!==null?x:b,{keepResident:h===!0})}),o(!1)}},'\u5F00\u542F\u540E\u5BBF\u4E3B\u542F\u52A8\u5373\u628A IDE \u52A0\u8F7D\u5230\u540E\u53F0"\u505C\u653E\u533A":\u5207\u6362\u53F3\u4FA7\u680F\u6807\u7B7E\u3001\u6536\u8D77/\u5C55\u5F00\u4FA7\u680F\u3001\u62D6\u6210\u6D6E\u52A8\u7A97\u53E3\u90FD\u4E0D\u518D\u91CD\u8F7D,\u9996\u6B21\u6253\u5F00\u514D\u7B49\u5F85;\u5173\u95ED\u5219\u53EA\u5728\u6253\u5F00\u9762\u677F\u65F6\u52A0\u8F7D(\u7701\u5185\u5B58)'),i.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},N?"\u5E38\u9A7B\u9762:"+(v.docked?"\u5DF2\u505C\u9760":v.ready?"\u5DF2\u505C\u653E(\u540E\u53F0\u8FD0\u884C\u4E2D)":"\u672A\u542F\u52A8")+(v.degraded?" \xB7 \u672C\u6B21\u53D1\u751F\u8FC7\u964D\u7EA7\u91CD\u8F7D":""):"\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 Element.moveBefore(Chromium <133)\u2192 \u5E38\u9A7B\u4E0D\u53EF\u7528,\u5207\u6807\u7B7E\u4ECD\u4F1A\u6574\u9875\u91CD\u8F7D(\u5347\u7EA7\u6D4F\u89C8\u5668\u540E\u81EA\u52A8\u751F\u6548)")))}catch(k){return console.error("[code-server] card render error:",k!=null&&k.message!==void 0?k.message:String(k)),null}}function qe(e){try{$e(e)}catch(r){console.error("[code-server] apply failed:",r&&r.stack?r.stack:String(r));try{document.title="CS-ERR "+(r&&r.message||String(r))}catch(t){}}}function $e(e){var r=e.get("slots");if(r===void 0){console.error("[code-server] slots service unavailable");return}var t=e.settingsScope,l=null;if(t!==void 0&&typeof t.bind=="function")l=t.bind({namespace:"code-server"});else{console.error("[code-server] settingsScope unavailable (inject missing?); settings card disabled");return}E("/code-server/status").then(function(u){C({status:u})}).catch(function(){}),r.inject("settings.plugin.item",()=>r.register({name:"settings.plugin.item",key:"code-server",label:"Code Server",inject:function(){return{scope:l}}},Ke));var a=!1;function s(u,m){if(!a){a=!0,c();var b=!1;try{b=Qe(u)}catch(g){console.error("[code-server] sidebar tab registration failed:",g!=null&&g.message!=null?g.message:String(g))}A.sidebarUi==="legacy"&&(console.log("[code-server] \u53F3\u4FA7\u680F\u670D\u52A1\u665A\u5230(\u7ECF "+m+"):\u64A4\u9500\u65E7\u7248 DSH \u5224\u5B9A"),E("/code-server/ui-mode",{sidebar:!0}).catch(function(){})),C({sidebarUi:"modern",sidebarRegisterFailed:b!==!0}),r.inject("shell.overlay",()=>r.register({name:"shell.overlay",id:"code-server",order:70,label:"Code Server"},g=>i.createElement(ze,g))),console.log("[code-server] client registered via "+m+": sidebar tab="+b+"(claims dsh-resource://file/**) + resident preload + settings card")}}function d(u){C({sidebarUi:"legacy"}),console.warn("[code-server] \u672A\u63A2\u6D4B\u5230\u53F3\u4FA7\u680F\u670D\u52A1(sidebarRightTabs/sidebarRight): \u672C\u63D2\u4EF6\u81EA 0.2.3 \u8D77\u4E0D\u518D\u517C\u5BB9\u65E7\u7248 DSH \u2014\u2014 \u9664\u300C\u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 Code Server\u300D\u7684\u63D0\u793A\u5916\u4E0D\u63D0\u4F9B\u4EFB\u4F55\u5165\u53E3,\u4E5F\u4E0D\u9884\u70ED IDE\u3002\u8BF7\u5347\u7EA7 DSH\u3002"),u===!0&&E("/code-server/ui-mode",{sidebar:!1}).catch(function(){})}var f=null,p=null,o=null;function c(){f!==null&&(clearTimeout(f),f=null),p!==null&&(clearTimeout(p),p=null),o!==null&&(clearTimeout(o),o=null)}var v=!1;try{typeof e.inject=="function"&&(v=!0,e.inject(["sidebarRightTabs","sidebarRight"],function(u){s(u,"inject")}))}catch(u){console.warn("[code-server] sidebar inject failed:",u!=null&&u.message!=null?u.message:String(u))}var y=typeof e.get=="function"&&e.get("sidebarRightTabs")!==void 0&&e.get("sidebarRight")!==void 0;if(y){o=setTimeout(function(){a||(console.warn("[code-server] ctx.inject \u672A\u5728 1.5s \u5185\u56DE\u8C03,\u6539\u7528\u540C\u6B65\u670D\u52A1\u6CE8\u518C\u4FA7\u680F"),s(e,"sync-fallback"))},Ue);return}if(v!==!0){d(!0);return}f=setTimeout(function(){a||d(!1)},Pe),p=setTimeout(function(){a||d(!0)},He)}var er=["slots","settingsScope"],rr="code-server";
|
|
5
4
|
return module.exports;}});
|
package/lib/index.js
CHANGED
|
@@ -1,43 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* dsh-code-server — host 半部:VS Code server 子进程(lib/launcher.mjs)
|
|
3
|
-
* + /api/code-server JSON API。
|
|
2
|
+
* dsh-code-server — host 半部:VS Code server 子进程(lib/launcher.mjs)的生命周期/状态 + /api/code-server JSON API。
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
* <树>/lib/vscode/out/server-main.js(树 = @<scope>/dshcs-vscode-server 的 vscode/ 子目录)
|
|
7
|
-
* 依据与实测见 docs/analysis-code-server-as-dsh-plugin.md。
|
|
4
|
+
* 模型:不运行 code-server 的 Node 服务层,直接由 lib/launcher.mjs 驱动树里的
|
|
5
|
+
* <树>/lib/vscode/out/server-main.js(树 = @<scope>/dshcs-vscode-server 的 vscode/ 子目录);
|
|
6
|
+
* 依据与实测见 docs/analysis-code-server-as-dsh-plugin.md。零外部依赖(只用 Node 内置模块)。
|
|
7
|
+
* 静态 profile 插件:exports.name 与 cordis.patch.yml 行 id 一致;inject = ['connection','settings']。
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* - apply(ctx, config) 在共享 /api 通道注册 6 条 exact Fetch 路由:
|
|
14
|
-
* status / start / stop / setup(兼容空操作) / open-file / ui-mode
|
|
9
|
+
* 路由经 ctx.connection.fetch.register 挂在 Connection 的共享 /api 通道上(**不依赖 webServer**):
|
|
10
|
+
* web profile 由 Connection 把 /api 挂到 webServer;desktop 由 apps/desktop-host 交给同一个
|
|
11
|
+
* createSharedFetchHandler('/api')(IPC 帧管道)→ 客户端只需同源 fetch('/api/code-server/<op>')。
|
|
12
|
+
* GET status | POST start{cwd?} | stop | setup(兼容空操作) | open-file{file,line?} | ui-mode{sidebar}
|
|
15
13
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* 通道选择(重要):**不依赖 webServer**。路由经 ctx.connection.fetch.register
|
|
20
|
-
* 挂在 Connection 服务的共享 /api 通道上:
|
|
21
|
-
* - web profile:Connection 自己把 /api 前缀挂到 webServer(带 Host/Origin + 浏览器鉴权);
|
|
22
|
-
* - desktop profile:apps/desktop-host 把 /api/* 交给同一个 createSharedFetchHandler('/api')
|
|
23
|
-
* (IPC 帧管道,无 HTTP 服务器)→ 插件在 desktop 下同样可用。
|
|
24
|
-
* 客户端因此只需同源 fetch('/api/code-server/<op>')(见 src/factory.js 的 api())。
|
|
25
|
-
*
|
|
26
|
-
* 设计要点:
|
|
27
|
-
* - 进程生命周期归本插件:启动写 pid.json,停止用树级终止(taskkill /T 或
|
|
28
|
-
* 进程组 SIGTERM→SIGKILL),退出监听更新状态。
|
|
29
|
-
* - host 重启后 adopt:pid.json 中的进程仍存活且 /healthz 响应 → 接管为
|
|
30
|
-
* running(不重复启动);否则清理 pid.json 视为 stopped。绝不误杀别的进程。
|
|
31
|
-
* - 就绪探测轮询 /healthz;失败时 status 携带启动日志尾部与错误信息。
|
|
32
|
-
* - auth=none 仅允许回环 host;非回环强制 password(未配置 token 则拒绝启动)。
|
|
33
|
-
* - 挂载于 ctx.effect:插件销毁(host 关闭/卸载)时回收自己启动的进程与路由。
|
|
34
|
-
*
|
|
35
|
-
* API(同源 fetch;web 与 desktop 同一套路径):
|
|
36
|
-
* GET /api/code-server/status → { ok, running, status, port, pid, cwd, url,
|
|
37
|
-
* version, error, logTail[, adopted] }
|
|
38
|
-
* POST /api/code-server/start { cwd? } → 幂等启动(换 cwd 则先停后启) → status
|
|
39
|
-
* POST /api/code-server/stop → 停止 → status
|
|
40
|
-
* POST /api/code-server/ui-mode { sidebar } → 客户端上报 UI 载体能力(旧版 DSH 上报 false)
|
|
14
|
+
* 不变量:进程生命周期归本插件(启动写 pid.json,停止树级终止);host 重启后按 pid.json + /healthz
|
|
15
|
+
* adopt 存活实例(不重复启动、不误杀);auth 固定 none(0.2.0 起不再支持口令);插件销毁时回收进程与路由。
|
|
16
|
+
* 旧版 DSH(客户端上报 {sidebar:false})会在此回收"自动预启动"的实例并停止预启动。
|
|
41
17
|
*/
|
|
42
18
|
|
|
43
19
|
import { spawn, execFile, execFileSync } from 'node:child_process';
|
|
@@ -49,7 +25,6 @@ import { fileURLToPath } from 'node:url';
|
|
|
49
25
|
import { createRequire } from 'node:module';
|
|
50
26
|
import {
|
|
51
27
|
PACKAGE_ROOT,
|
|
52
|
-
codeServerEntry,
|
|
53
28
|
codeServerPackageName,
|
|
54
29
|
legacyInstallRoot,
|
|
55
30
|
productPath,
|
|
@@ -91,16 +66,14 @@ export const inject = ['connection', 'settings'];
|
|
|
91
66
|
/** 设置命名空间:卡片经官方 settings 域读写,持久化到官方 settings 文档。 */
|
|
92
67
|
export const SETTINGS_NS = 'code-server';
|
|
93
68
|
|
|
94
|
-
/** 设置卡片 schema(
|
|
69
|
+
/** 设置卡片 schema(只留两个可改设置:keepResident / fileOpenScope)。
|
|
70
|
+
* 旧设置文档里残留的 reserveComposer / windowedOpen 不再出现在 schema 里 —— schemastery 的
|
|
71
|
+
* object 非 strict 会把未知键原样 merge 进解析结果,既不报错也不影响取值,故无需迁移。 */
|
|
95
72
|
export const Config = z.object({
|
|
96
|
-
/** 【0.2.3 起废弃】只对已删除的内部浮动窗口有意义;保留该键仅为兼容旧设置文件(读写均被忽略)。 */
|
|
97
|
-
reserveComposer: z.boolean().default(true),
|
|
98
|
-
/** windowedOpen=false(默认)在右侧栏标签里打开;
|
|
99
|
-
* true 时改为在浏览器新标签页打开 code-server(自动启动并跟随工作区)。 */
|
|
100
|
-
windowedOpen: z.boolean().default(false),
|
|
101
73
|
/** 服务方式:loopback(默认)独立回环端口;dsh 挂到 DSH webServer 的 /code-server
|
|
102
74
|
* (同源、无额外端口、复用 DSH 的 Host/Origin + cookie 防护;需要 DSH 提供 webServer 服务,
|
|
103
|
-
* 缺失或注册失败时自动回退 loopback)
|
|
75
|
+
* 缺失或注册失败时自动回退 loopback)。没有卡片行:改 cordis.patch.yml 的 config.serve
|
|
76
|
+
* 或设置文档里的 code-server.serve。 */
|
|
104
77
|
serve: z.union([z.const('loopback'), z.const('dsh')]).default('loopback'),
|
|
105
78
|
/** keepResident=true(默认)客户端在宿主 running 后把 IDE 预先加载到"停放区",
|
|
106
79
|
* 切标签/收起侧栏不再重载;false 则只在打开面板时才加载(省内存)。 */
|
|
@@ -158,15 +131,6 @@ function launcherPath() {
|
|
|
158
131
|
return path.join(path.dirname(fileURLToPath(import.meta.url)), 'launcher.mjs');
|
|
159
132
|
}
|
|
160
133
|
|
|
161
|
-
/** code-server 兼容入口(旧全量树才有 out/node/entry.js);新树返回 null。 */
|
|
162
|
-
function bundledRuntimeEntry() {
|
|
163
|
-
try {
|
|
164
|
-
return codeServerEntry();
|
|
165
|
-
} catch {
|
|
166
|
-
return null;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
134
|
/** 扩展安装目标:VS Code「内置扩展」目录 = <树>/lib/vscode/extensions。
|
|
171
135
|
* (位于程序内置目录的扩展被 VS Code 视为内置——用户视图显示为"内置",不可卸载;
|
|
172
136
|
* --extensions-dir 的是用户级扩展,可被用户禁用/卸载。)
|
|
@@ -401,8 +365,6 @@ export async function apply(ctx, config) {
|
|
|
401
365
|
console.error('[code-server] connection service unavailable; plugin registered but idle');
|
|
402
366
|
return;
|
|
403
367
|
}
|
|
404
|
-
let reserveComposer = true;
|
|
405
|
-
let windowedOpen = false;
|
|
406
368
|
let serveSetting = 'loopback';
|
|
407
369
|
let keepResident = true; // 客户端常驻预热(0.2.2)
|
|
408
370
|
let fileOpenScope = 'session'; // 客户端认领的文件地址范围(0.2.5)
|
|
@@ -412,21 +374,11 @@ export async function apply(ctx, config) {
|
|
|
412
374
|
const rawDoc = settingsSvc.get(SETTINGS_NS);
|
|
413
375
|
if (rawDoc !== undefined && rawDoc !== null) {
|
|
414
376
|
const resolved = scope.get();
|
|
415
|
-
reserveComposer = resolved && typeof resolved.reserveComposer === 'boolean' ? resolved.reserveComposer : true;
|
|
416
|
-
windowedOpen = resolved && typeof resolved.windowedOpen === 'boolean' ? resolved.windowedOpen : false;
|
|
417
377
|
serveSetting = resolved && resolved.serve === 'dsh' ? 'dsh' : 'loopback';
|
|
418
378
|
keepResident = resolved && typeof resolved.keepResident === 'boolean' ? resolved.keepResident : true;
|
|
419
379
|
fileOpenScope = resolved && resolved.fileOpenScope === 'all' ? 'all' : 'session';
|
|
420
380
|
}
|
|
421
381
|
scope.watch((next) => {
|
|
422
|
-
if (next != null && typeof next.reserveComposer === 'boolean') {
|
|
423
|
-
reserveComposer = next.reserveComposer;
|
|
424
|
-
console.log(`[code-server] reserveComposer updated: ${reserveComposer}`);
|
|
425
|
-
}
|
|
426
|
-
if (next != null && typeof next.windowedOpen === 'boolean') {
|
|
427
|
-
windowedOpen = next.windowedOpen;
|
|
428
|
-
console.log(`[code-server] windowedOpen updated: ${windowedOpen}`);
|
|
429
|
-
}
|
|
430
382
|
if (next != null && (next.serve === 'dsh' || next.serve === 'loopback')) {
|
|
431
383
|
if (next.serve !== serveSetting) {
|
|
432
384
|
serveSetting = next.serve;
|
|
@@ -445,7 +397,7 @@ export async function apply(ctx, config) {
|
|
|
445
397
|
}
|
|
446
398
|
});
|
|
447
399
|
} catch (error) {
|
|
448
|
-
console.error(`[code-server] settings unavailable; using defaults (keepResident=true,
|
|
400
|
+
console.error(`[code-server] settings unavailable; using defaults (keepResident=true, fileOpenScope=session): ${error.message}`);
|
|
449
401
|
}
|
|
450
402
|
}
|
|
451
403
|
|
|
@@ -538,10 +490,8 @@ export async function apply(ctx, config) {
|
|
|
538
490
|
error: state.error,
|
|
539
491
|
logTail: state.logTail.slice(-LOG_TAIL_MAX),
|
|
540
492
|
adopted: state.adopted,
|
|
541
|
-
reserveComposer, // 0.2.3 起废弃(仅旧版浮窗用过);保留字段以免旧客户端读取时报错
|
|
542
|
-
windowedOpen,
|
|
543
493
|
keepResident,
|
|
544
|
-
fileOpenScope
|
|
494
|
+
fileOpenScope, // 客户端据此决定认领哪些文件地址(0.2.5)
|
|
545
495
|
sidebarUi: state.sidebarUi,
|
|
546
496
|
env: state.env,
|
|
547
497
|
setup: {
|
|
@@ -623,7 +573,6 @@ export async function apply(ctx, config) {
|
|
|
623
573
|
|
|
624
574
|
async function stop(reason) {
|
|
625
575
|
stopPolling();
|
|
626
|
-
const wasRunning = state.status === 'running' || state.status === 'starting';
|
|
627
576
|
const pid = state.pid;
|
|
628
577
|
if (child !== null) {
|
|
629
578
|
child.stdout?.removeAllListeners?.('data');
|
package/lib/launcher.mjs
CHANGED
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* lib/launcher.mjs — VS Code server 的最小启动器(取代 code-server 的 out/node/** 服务层)。
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* /manifest.json PWA manifest(VS Code server 不提供)
|
|
8
|
-
* /_static/* 浏览器静态资源(favicon / PWA 图标 / serviceWorker.js)
|
|
9
|
-
* /proxy/:port/… 转发端口 HTTP 代理(Ports 面板;WS 版仅在 loopback 模式可用)
|
|
4
|
+
* 在**子进程**里加载 <tree>/lib/vscode/out/server-main.js,自建 node:http 把请求交给 VS Code 的
|
|
5
|
+
* handleRequest/handleUpgrade,并补齐 code-server 原先负责的少量 HTTP 面:/healthz(就绪探针)、
|
|
6
|
+
* /manifest.json(PWA)、/_static/*(favicon/PWA/serviceWorker)、/proxy/:port/…(端口转发)。
|
|
10
7
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* 且 node-pty/sqlite 崩溃时必须只带走 IDE,不能带走 DSH host。
|
|
14
|
-
*
|
|
15
|
-
* 用法(由 lib/index.js 调用,不面向用户):
|
|
16
|
-
* node lib/launcher.mjs --tree <VS Code 树根> --user-data-dir <dir> --extensions-dir <dir> \
|
|
17
|
-
* (--port <n> [--host 127.0.0.1] | --pipe <\\.\pipe\name|unix socket>) \
|
|
18
|
-
* [--parent-pid <pid>] [--locale zh-cn]
|
|
8
|
+
* 为什么独立进程:VS Code server 会改进程全局(win32 下 import 即 chdir、注册 SIGPIPE、patch
|
|
9
|
+
* Module 解析、多处 process.exit),且 node-pty/sqlite 崩溃时必须只带走 IDE、不能带走 DSH host。
|
|
19
10
|
*
|
|
11
|
+
* 用法(由 lib/index.js 调用):node lib/launcher.mjs --tree <树根> --user-data-dir <dir>
|
|
12
|
+
* --extensions-dir <dir> (--port <n> [--host 127.0.0.1] | --pipe <name>) [--parent-pid <pid>] [--locale zh-cn]
|
|
20
13
|
* 就绪信号:stdout 打印 `dshcs-ready <productPath> <mode> <addr>`。
|
|
21
14
|
*/
|
|
22
15
|
|
package/lib/native.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// 用 npm: 别名把它们装回**原始名字**。聚合包挂在插件 package.json 的
|
|
9
9
|
// optionalDependencies 上(os/cpu 限定)→ pnpm 一条命令按架构自动选中。
|
|
10
10
|
//
|
|
11
|
-
//
|
|
11
|
+
// 本模块只做三件事:
|
|
12
12
|
// 1. 找到本平台聚合包(以及它的依赖清单 = 期望可解析的原生模块名);
|
|
13
13
|
// 2. 从 code-server 运行位置出发校验这些模块是否真的能 require 到;
|
|
14
14
|
// 3. 必要时在 code-server 树里补齐别名 junction(ESM import 不认 NODE_PATH,只能靠目录链)。
|
package/lib/vendor.js
CHANGED
|
@@ -88,11 +88,6 @@ function rootOfPackage(name) {
|
|
|
88
88
|
return null;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
/** 是否是一棵「精简 VS Code 树」(含 lib/vscode/out/server-main.js,不含 code-server 服务层)。 */
|
|
92
|
-
export function isVscodeOnlyTree(root) {
|
|
93
|
-
return root !== null && existsSync(join(root, 'lib', 'vscode', 'out', 'server-main.js'));
|
|
94
|
-
}
|
|
95
|
-
|
|
96
91
|
/** VS Code 树根(新包 > 旧包 > 旧平台子包 > 包内 vendor/vscode > 包内 vendor/code-server)。
|
|
97
92
|
* @returns {string|null} 绝对路径,如 <profile>\node_modules\@jinsiyu\dshcs-vscode-server\vscode */
|
|
98
93
|
export function vsRoot() {
|
|
@@ -118,19 +113,6 @@ export function codeServerRoot() {
|
|
|
118
113
|
return vsRoot();
|
|
119
114
|
}
|
|
120
115
|
|
|
121
|
-
/** code-server 入口脚本(旧全量树的 out/node/entry.js);精简树下返回 null。 */
|
|
122
|
-
export function codeServerEntry() {
|
|
123
|
-
const root = vsRoot();
|
|
124
|
-
if (root === null) return null;
|
|
125
|
-
const entry = join(root, 'out', 'node', 'entry.js');
|
|
126
|
-
return existsSync(entry) ? entry : null;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/** code-server 运行根(旧名,脚本/调用方沿用)。 */
|
|
130
|
-
export function codeServerTarget() {
|
|
131
|
-
return vsRoot();
|
|
132
|
-
}
|
|
133
|
-
|
|
134
116
|
/** VS Code 客户端约定的产品路径(quality-commit);从 product.json 现算,禁止硬编码。 */
|
|
135
117
|
export function productPath(root = vsRoot()) {
|
|
136
118
|
if (root !== null) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-code-server-app",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
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. 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": {
|
|
@@ -1,29 +1,21 @@
|
|
|
1
|
-
// scripts/vendor-repacks.mjs — 打包期把「VS Code 树」与「pnpm
|
|
1
|
+
// scripts/vendor-repacks.mjs — 打包期把「VS Code 树」与「pnpm 拒绝安装」的原生包打成可安装的预编译包。
|
|
2
2
|
//
|
|
3
3
|
// 为什么:pnpm 认为「含安装脚本」或「含 binding.gyp / .hooks」的包需要构建,必须由宿主
|
|
4
|
-
// pnpm-workspace.yaml 的 allowBuilds 批准,否则 dsh plugin add 直接 exit 1
|
|
5
|
-
//
|
|
4
|
+
// pnpm-workspace.yaml 的 allowBuilds 批准,否则 dsh plugin add 直接 exit 1;VS Code 内部依赖里的一批
|
|
5
|
+
// 原生包都属于这一类。树本身则因为 npm 打包永远排除**包根** node_modules 而必须重打包。
|
|
6
6
|
//
|
|
7
|
-
// 产物(
|
|
8
|
-
// ① @<scope>/dshcs-vscode-server@<code-server 版本>
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
// ③ @<scope>/dsh-code-server-runtime-<platform>-<arch>@<插件版本> 平台聚合包:
|
|
15
|
-
// dependencies 用 npm: 别名把 ② 装回**原始名字**(node-pty / @vscode/sqlite3 / …),
|
|
16
|
-
// 这样 VS Code 的 require/import 不用改,插件只需按 os/cpu 声明 ①(常规依赖)+ ③(可选依赖)。
|
|
17
|
-
// (argon2 已随 code-server 服务层一起移除:auth=none 不再需要口令哈希。)
|
|
7
|
+
// 产物(全部由本脚本生成,再由 scripts/publish-repacks.mjs 发布):
|
|
8
|
+
// ① @<scope>/dshcs-vscode-server@<code-server 版本> vendor/vscode 的树(lib/vscode + out/browser
|
|
9
|
+
// + src/browser),不含 code-server 的 out/node 与它的 136 个依赖(那层由 lib/launcher.mjs 取代);
|
|
10
|
+
// ② @<scope>/dshcs-<名字>[-<platform>-<arch>]@<版本> 需要构建的原生包(node-pty / @vscode/sqlite3 /
|
|
11
|
+
// kerberos / koffi / ssh2 / …),依赖链上命中它们的包也一并重打包(含 optionalDependencies);
|
|
12
|
+
// ③ @<scope>/dsh-code-server-runtime-<platform>-<arch>@<插件版本> 平台聚合包:用 npm: 别名把 ② 装回
|
|
13
|
+
// 原始名字,VS Code 的 require/import 无需改动;插件按 os/cpu 声明 ①(常规)+ ③(可选)依赖。
|
|
18
14
|
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
// 用法:
|
|
22
|
-
// node scripts/vendor-repacks.mjs [--from <已完整安装的 code-server 树>] \
|
|
15
|
+
// 用法:node scripts/vendor-repacks.mjs [--from <已完整安装的 code-server 树>]
|
|
23
16
|
// [--target win32-arm64,win32-x64] [--scope @jinsiyu] [--pack]
|
|
24
|
-
// 不给 --from 时自动准备源树(按 vendor/VENDOR.json 的版本 npm install --ignore-scripts
|
|
25
|
-
//
|
|
26
|
-
// --pack 会用 npm pack 生成 repack/tgz/*.tgz(随后用 scripts/publish-repacks.mjs 发布)。
|
|
17
|
+
// 不给 --from 时自动准备源树(按 vendor/VENDOR.json 的版本 npm install --ignore-scripts,再在
|
|
18
|
+
// lib/vscode 里解包 + rebuild;耗时且需要工具链,维护者换版本时用)。--pack 生成 repack/tgz/*.tgz。
|
|
27
19
|
import { existsSync, readFileSync, readdirSync, mkdirSync, rmSync, writeFileSync, cpSync } from 'node:fs';
|
|
28
20
|
import { dirname, join, relative, resolve } from 'node:path';
|
|
29
21
|
import { fileURLToPath } from 'node:url';
|
package/vendor/VENDOR.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"vscodeVersion": "1.136.1",
|
|
4
4
|
"productPath": "stable-8d5f383f301ca20681f5b6606b8207d9dc87bdd8",
|
|
5
5
|
"layout": "vscode-only",
|
|
6
|
-
"preparedAt": "2026-09-
|
|
6
|
+
"preparedAt": "2026-09-11T02:00:19.679Z",
|
|
7
7
|
"source": "registry",
|
|
8
8
|
"node": "v24.13.1",
|
|
9
9
|
"platform": "win32",
|