dsh-code-server-app 0.2.4 → 0.2.5

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 CHANGED
@@ -16,7 +16,7 @@ A static profile plugin (npm package with host + client bundle) that ships the *
16
16
 
17
17
  | DSH version | Carrier | Entry points |
18
18
  |---|---|---|
19
- | **>= 0.1.5-alpha.1** (has `sidebarRight` / `sidebarRightTabs`) | **Right-sidebar tab** (kind `code-server`, chip `Code Server`) | ① the **Code Server box** on the sidebar's guide ("开始") page; ② the icon button beside each turn's artifacts; ③ Settings → Plugins → Code Server → **"Open in right sidebar"** |
19
+ | **>= 0.1.5-alpha.1** (has `sidebarRight` / `sidebarRightTabs`) | **Right-sidebar tab** (kind `code-server`, chip `Code Server`), which also **claims file addresses** (see below) | ① DSH's own **produced-file chips / presented-file card previews / inline file names in prose** (since 0.2.5, via the official `openFile` → file address → this tab); ② the **Code Server box** on the sidebar's guide ("开始") page; ③ Settings → Plugins → Code Server → **"Open in right sidebar"** |
20
20
  | older (no sidebar service) | **Unsupported**: nothing but one notice on the settings page | none (Settings → Plugins → Code Server shows an upgrade notice) |
21
21
 
22
22
  - Detection: first a synchronous `ctx.get('sidebarRightTabs') / ctx.get('sidebarRight')` probe; because the services may come up after this plugin, `ctx.inject(['sidebarRightTabs','sidebarRight'], …)` is awaited and a **2.5 s timeout marks the DSH as legacy** (no version comparison, and the plugin's own activation is never blocked).
@@ -27,14 +27,51 @@ A static profile plugin (npm package with host + client bundle) that ships the *
27
27
  - services arriving late automatically revoke the legacy verdict, register the sidebar, and report `{sidebar:true}` so the host re-enables;
28
28
  - a failed registration is no longer silent: it logs an error and the card's entry row says "right-sidebar services were found but the tab could not be registered".
29
29
  - **0.2.3 dropped legacy-DSH compatibility**: the floating ball and the internal floating window are **deleted**. When the DSH is detected as legacy the plugin
30
- - registers only the settings card (an upgrade notice) — no ball, no floating window, no artifact buttons, no IDE preload;
30
+ - registers only the settings card (an upgrade notice) — no ball, no floating window, **no file-address claim**, no IDE preload;
31
31
  - reports `/api/code-server/ui-mode { sidebar:false }` to the host (after the 10 s grace above); the host then **recycles an instance it auto-prestarted** and stops prestarting (a user-started/adopted instance is never touched), and `{sidebar:true}` reverses that if the services show up later;
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 now has just two rows: "Open in a window (new tab)" and "Resident in background".
35
+ - The settings card now has three rows: "**Claim scope**", "Open in a window (new tab)" and "Resident in background".
36
36
  `reserveComposer` (reserve space above the composer) only ever mattered for the deleted floating window: it is **deprecated** in 0.2.3 — an old value in the settings document is still accepted but ignored.
37
- - `windowedOpen` has the highest priority: when on, entry buttons always open a browser tab.
37
+ - `windowedOpen` has the highest priority: when on, the **settings-card button / guide entry box** always open a browser tab (DSH's own file clicks are unaffected — that chain is started by DSH itself and targets the right sidebar).
38
+
39
+ ## Opening files (official entry points since 0.2.5)
40
+
41
+ DSH names files with **resource addresses**; `openFile` only hands the address to the right sidebar, which decides who draws it:
42
+
43
+ ```
44
+ DSH's produced-file chip / presented-file card preview / inline prose mention
45
+ → openFile(path, { line? }) (provided by ui-chat)
46
+ → dsh-resource://file/session/<sessionId>/<path> (or …/file/absolute/<path>)
47
+ → ctx.sidebarRight.openResource(address)
48
+ → claimed by the tab type whose patterns match (band extension(3) > builtin(2) > fallback(1),
49
+ then the longest matching pattern, then registration order)
50
+ ```
51
+
52
+ This plugin registers:
53
+
54
+ | Field | Value | Effect |
55
+ |---|---|---|
56
+ | `patterns` | `['dsh-resource://file/**']` | claims file addresses (a pattern containing `:` is matched against the **whole address**) |
57
+ | `priority` | `'extension'` | beats the built-in plain-text preview, which sits in `fallback` on purpose — DSH's own comment calls that band "the position VS Code's text editor holds among its editors", i.e. one any more specific type should beat |
58
+ | `canOpen` | see below | vetoes by the "claim scope" setting; unclaimed addresses fall back to DSH's built-in preview |
59
+ | `title` | last address segment (= file name) | the tab chip shows the file name; a page tab (`sidebar://code-server`) still reads `Code Server` |
60
+
61
+ - **Claim scope** (switchable in the settings card, `fileOpenScope`):
62
+ - `session` (default) — claim only `dsh-resource://file/session/…` (everything a session produces: deliverables, declared deliveries, prose mentions, tool views);
63
+ - `all` — also claim session-less `dsh-resource://file/absolute/…` addresses.
64
+ - **How the tab body locates the file**: it parses `useTabInfo().tab.navigation.address`
65
+ (`src/address.js`, same grammar as DSH's `parseFileAddress`), expands a workspace-relative path with that
66
+ session's cwd, and posts the absolute path (plus optional `line`) to the host's
67
+ `/api/code-server/open-file`; the bundled extension (`dshcs-open-file`) then calls `showTextDocument`
68
+ (positioned at the line when given).
69
+ - **One address = one tab** (DSH semantics: `contentId` *is* the address): three files mean three chips, but they
70
+ share the single resident workbench — switching tabs just re-aims the workbench at the corresponding file.
71
+ - **Why the bundled extension stays**: VS Code Web has no official "open this file from outside" API (the only
72
+ entry is `?folder=`, which picks the workspace), so aiming the workbench at a file has to be done by an
73
+ extension inside the tree. The host writes a signal file, the extension polls it and calls
74
+ `showTextDocument`, keeping the signal for retry when no window is connected yet.
38
75
 
39
76
  ## Why switching tabs no longer reloads (resident IDE)
40
77
 
@@ -108,7 +145,7 @@ state preserved (no full reload). Full evidence and probe scripts: `docs/analysi
108
145
  > background. Upgrade DSH to a version with the right sidebar (>= 0.1.5-alpha.1): Code Server then appears as a
109
146
  > right-sidebar tab, this page shows the full settings again, and no reinstall is needed — a page refresh is enough.
110
147
 
111
- - **No other UI**: no `shell.overlay` registration (floating ball), no artifact buttons, no resident preload.
148
+ - **No other UI**: no `shell.overlay` registration (floating ball), no file-address claim, no resident preload.
112
149
  - **Host side**: the client posts `/api/code-server/ui-mode { sidebar:false }`; the host then ① stops auto-prestarting
113
150
  the IDE (`maybePrestart` returns immediately) and ② **recycles** an instance it had just auto-prestarted (unless it
114
151
  was adopted), so no unusable IDE process or port is left behind. A user-started/adopted instance is never stopped.
@@ -333,7 +370,8 @@ persisted via the official settings domain (`settingsScope`, namespace `code-ser
333
370
 
334
371
  | Key | Default | Description |
335
372
  |---|---|---|
336
- | `windowedOpen` | `false` | **Open in a window**: on, every entry point (artifact button / settings card) opens code-server in a browser **new tab** (auto-starts and follows the active workspace); off (default) uses the right-sidebar tab |
373
+ | `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) |
337
375
  | `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) |
338
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) |
339
377
 
@@ -392,11 +430,39 @@ Host/Origin fence and browser auth); in the desktop profile `apps/desktop-host`
392
430
 
393
431
  - The host half is `inject = ['connection', 'settings']` (**no `webServer`**) — the desktop profile disables webserver/web-runtime
394
432
  and the plugin still works: `/api/*` requests travel Electron `dsh-app://` protocol handler → IPC framed pipe → `createSharedFetchHandler('/api')`.
395
- - The right-sidebar tab, guide entry box, artifact button, and settings card behave the same as in web (code-server remains an
433
+ - The right-sidebar tab, guide entry box, file-address claim, and settings card behave the same as in web (code-server remains an
396
434
  iframe to the local `http://127.0.0.1:<port>`; the desktop renderer uses `webSecurity: true` with no CSP, so the cross-origin iframe loads).
397
435
  The desktop build ships `dsh-client-ui-sidebar-right` in its seed package set as well, so the 0.2.3 "right-sidebar DSH only" rule is
398
436
  not a regression for desktop; the only difference is the missing `webServer`, where `serve: dsh` falls back to loopback.
399
- - Install into the desktop profile with `dsh plugin --profile desktop add dsh-code-server-app@<version>` (or the desktop plugin manager).
437
+ - Install into the desktop profile through the **desktop plugin manager** (not the CLI, see below).
438
+ - **Desktop installs face a 24-hour supply-chain policy (measured 2026-09-10; this is how 0.2.4 got installed)**:
439
+ - the CLI path is unavailable: `dsh plugin --profile desktop …` is rejected (*"profile "desktop" is managed exclusively by the
440
+ Electron application"*), so desktop installs only go through the app's package transaction (`pnpm add <spec> --save-exact`,
441
+ executed in `~/.dsh/desktop/staging/<uuid>/profile` before activation);
442
+ - that transaction's pnpm (the app bundles **11.7.0**, patched by DeepSeek) runs a **lockfile supply-chain verification** before
443
+ `add` ("Verifying lockfile against supply-chain policies (717 entries)") which requires packages to be **at least 24 h old**,
444
+ otherwise `ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION`;
445
+ - **the two stages behave differently (measured)**:
446
+ - verifying an **existing lockfile**: `minimumReleaseAgeExclude` is *not* honoured (exact versions and bare package names
447
+ were both tried);
448
+ - **resolution** (no lockfile to verify, e.g. after `pnpm clean --lockfile`): the list *is* honoured, and pnpm even appends
449
+ entries itself (the install log prints *"Added N entries to minimumReleaseAgeExclude…"*);
450
+ - so the working recipe for a **just-published** (<24 h) version on desktop is to start from a clean, lockfile-free profile:
451
+ 1. `pnpm clean --lockfile` (**note: it also deletes `node_modules`**, leaving the profile to be reinstalled);
452
+ 2. with the app's bundled runtime, run `add <spec> --save-exact --trust-lockfile` in the profile directory
453
+ (runtime/store/config live under `~/.dsh/desktop/pnpm/{store,cache,state,config,home}`,
454
+ `--config.userconfig=…/config/npmrc`, otherwise pnpm fails with `ERR_PNPM_UNEXPECTED_STORE` /
455
+ `…UNEXPECTED_VIRTUAL_STORE`);
456
+ 3. the app's boot command (`install --offline --frozen-lockfile --trust-lockfile`) then passes (lockfile matches
457
+ package.json, packages are in the store); if the plugin name is already in `dsh.profile.bundles` nothing else is needed.
458
+ - do **not** try to bypass it with `minimumReleaseAge: 0`: it does clear the check, but that key is **not** one of the policy
459
+ sections the app tolerates (`project-manager.ts` ignores only `minimumReleaseAgeExclude:` / `trustPolicyExclude:` and validates
460
+ the manifest before every `mutate()`), so persisting it makes the app fail with
461
+ *"core package mapping does not match desktop-packages.json"*.
462
+ - Alternatively **wait out the 24 h** and install normally from the plugin manager. The web profile is unaffected: its
463
+ `pnpm-workspace.yaml` sets `minimumReleaseAge: false`.
464
+ - this plugin's closure contains platform native sub-packages (`@jinsiyu/dsh-code-server-runtime-win32-*`) published together with
465
+ the plugin itself, so every new version hits that policy on desktop.
400
466
 
401
467
  ## Artifact open buttons
402
468
 
package/README.md CHANGED
@@ -26,7 +26,7 @@
26
26
 
27
27
  | DSH 版本 | 载体 | 入口 |
28
28
  |---|---|---|
29
- | **≥ 0.1.5-alpha.1**(有 `sidebarRight` / `sidebarRightTabs` 服务) | **右侧栏标签**(kind=`code-server`,标签名 `Code Server`) | ① 右侧栏「开始」页的 **Code Server 入口框**;② 每轮产物旁的图标按钮;③ 设置 → 插件 → Code Server → **「在右侧栏打开」** |
29
+ | **≥ 0.1.5-alpha.1**(有 `sidebarRight` / `sidebarRightTabs` 服务) | **右侧栏标签**(kind=`code-server`,标签名 `Code Server`),并**认领文件地址**(见下) | ① **DSH 官方的产物 chip / 「交付」卡片预览 / 正文里的文件名**(0.2.5 起,走官方 `openFile` → 文件地址 → 本 tab);② 右侧栏「开始」页的 **Code Server 入口框**;③ 设置 → 插件 → Code Server → **「在右侧栏打开」** |
30
30
  | 更早(无右侧栏服务) | **不受支持**:除设置页的一条提示外**不提供任何入口** | 无(设置 → 插件 → Code Server 显示升级提示) |
31
31
 
32
32
  - 检测方式:先 `ctx.get('sidebarRightTabs') / ctx.get('sidebarRight')` 同步探测;
@@ -39,16 +39,51 @@
39
39
  - 服务晚到 → 自动撤销旧版判定、补注册侧栏,并上报 `{sidebar:true}` 让 host 恢复;
40
40
  - 注册失败不再静默:控制台报错,设置卡入口行显示"已探测到右侧栏服务,但标签注册失败"。
41
41
  - **0.2.3 起不再兼容旧版 DSH**:悬浮球与内部浮动窗口回退**已删除**。判定为旧版时:
42
- - 只注册设置卡片,内容是一条升级提示(见下),不注册悬浮球/浮窗/产物按钮,也不预热 IDE;
42
+ - 只注册设置卡片,内容是一条升级提示(见下),不注册悬浮球/浮窗/**文件地址认领**,也不预热 IDE;
43
43
  - 客户端向 host 上报 `/api/code-server/ui-mode { sidebar:false }`(在上面的 10 s 宽限之后),host 据此**回收自动预启动的实例**
44
44
  并停止预启动(用户手动启动的实例不受影响);服务随后才出现时会再上报 `{sidebar:true}` 撤销;
45
45
  - 升级 DSH 后**无需重装插件**,刷新页面即可,本页会恢复为完整设置卡片。
46
46
  - 侧栏标签内即 code-server 页面(iframe),跟随当前会话工作区;面板可折叠/分屏/浮动/全屏(由 DSH 右侧栏提供)。
47
47
  - **IDE 常驻(0.2.2 起,默认开)**:切到别的标签/收起侧栏再回来**不再重载** code-server——
48
48
  未保存的编辑缓冲区、终端、调试会话都留在原处(见下方「为什么切标签不再重载」)。
49
- - 设置卡片只剩两行:「窗口化打开(新标签页)」与「后台常驻(切标签不重载)」。
49
+ - 设置卡片三行:「**认领范围**」「窗口化打开(新标签页)」「后台常驻(切标签不重载)」。
50
50
  `reserveComposer`(保留输入框上方空间)只对已删除的浮窗有意义,0.2.3 起**废弃**:设置文件里的旧值仍被接受但被忽略。
51
- - `windowedOpen` 优先级最高:开启时入口按钮一律新开浏览器标签页。
51
+ - `windowedOpen` 优先级最高:开启时**设置卡按钮 / guide 入口框**一律新开浏览器标签页(官方的文件点击不受它影响——那条链由 DSH 自己发起到右侧栏)。
52
+
53
+ ## 文件打开(0.2.5 起走官方入口)
54
+
55
+ DSH 用**资源地址**命名文件,`openFile` 只负责把地址交给右侧栏去认领:
56
+
57
+ ```
58
+ 官方产物 chip / 「交付」卡片预览 / 正文内联提及
59
+ → openFile(path, { line? }) (ui-chat 提供)
60
+ → dsh-resource://file/session/<sessionId>/<path> (或 …/file/absolute/<path>)
61
+ → ctx.sidebarRight.openResource(address)
62
+ → 由注册了匹配 patterns 的 tab 类型认领(优先级 extension(3) > builtin(2) > fallback(1),
63
+ 同带内按 pattern 长度、再按注册顺序)
64
+ ```
65
+
66
+ 本插件注册时带上:
67
+
68
+ | 字段 | 值 | 作用 |
69
+ |---|---|---|
70
+ | `patterns` | `['dsh-resource://file/**']` | 认领文件地址(含 `:` 的 pattern 按**整址** glob 匹配) |
71
+ | `priority` | `'extension'` | 高于官方纯文本预览的 `fallback`——DSH 源码注释写明后者是"VS Code 文本编辑器在编辑器中的位次,任何更具体的类型都应当击败它" |
72
+ | `canOpen` | 见下 | 按「认领范围」设置否决,未认领的地址由官方预览兜底 |
73
+ | `title` | 地址末段(=文件名) | tab chip 显示文件名;页面 tab(`sidebar://code-server`)仍是 `Code Server` |
74
+
75
+ - **认领范围**(设置卡片可切,`fileOpenScope`):
76
+ - `session`(默认)= 只认领 `dsh-resource://file/session/…`(会话里的产物、交付、正文提及、工具视图都走这条);
77
+ - `all` = 连不带会话的 `dsh-resource://file/absolute/…` 也认领("所有文件"模式)。
78
+ - **tab body 怎么定位文件**:从 `useTabInfo().tab.navigation.address` 解析出会话与路径
79
+ (`src/address.js`,与 DSH `parseFileAddress` 同语义),相对路径按该会话 cwd 展开成绝对路径,
80
+ 再把绝对路径 + 可选 `line` 交给 host 的 `/api/code-server/open-file`;内建扩展
81
+ (`dshcs-open-file`)在 workbench 里 `showTextDocument`(带行号时定位到该行)。
82
+ - **一个地址 = 一个 tab**(官方语义,`contentId` 就是地址):打开三个文件会有三个 chip,
83
+ 但它们共用同一个常驻 workbench(我们的 IDE 是单实例),切换时只是让 workbench 定位到对应文件。
84
+ - **为什么还留着那个内建扩展**:VS Code Web 没有"从外部打开文件"的官方 API(唯一入口是
85
+ `?folder=` 指定工作区),所以"让 workbench 定位到某个文件"只能由树内的扩展完成;
86
+ host 写信号文件、扩展轮询并 `showTextDocument`,失败保留重试(实例尚未就绪时也不会丢)。
52
87
 
53
88
  ## 为什么切标签不再重载(IDE 常驻)
54
89
 
@@ -114,7 +149,7 @@
114
149
  > 也不会后台启动 IDE。升级 DSH 到带右侧栏的版本(≥ 0.1.5-alpha.1)后,Code Server 会出现在右侧栏标签里,
115
150
  > 本页同时显示完整设置项;升级后无需重装本插件,刷新页面即可。
116
151
 
117
- - **没有任何其他 UI**:不注册 `shell.overlay`(悬浮球)、不注册产物按钮、不做常驻预热。
152
+ - **没有任何其他 UI**:不注册 `shell.overlay`(悬浮球)、不认领文件地址、不做常驻预热。
118
153
  - **host 侧**:客户端会 `POST /api/code-server/ui-mode { sidebar:false }`;host 收到后
119
154
  ① 不再自动预启动 IDE(`maybePrestart` 直接返回),② 若 IDE 是本插件刚自动预启动且尚未被 adopt,则**回收**该进程,
120
155
  避免留下一个用不上的 IDE 与端口。用户手动启动的实例(`adopted`)不会被停。
@@ -345,7 +380,8 @@ host 探测顺序:`@jinsiyu/dshcs-vscode-server/vscode`(**0.2.0+ 正式布局**)
345
380
 
346
381
  | 键 | 默认 | 说明 |
347
382
  |---|---|---|
348
- | `windowedOpen` | `false` | **窗口化打开**:开启后各入口(产物按钮 / 设置卡)在浏览器**新标签页**打开 code-server(自动启动并跟随当前工作区目录);关闭(默认)使用右侧栏标签 |
383
+ | `fileOpenScope` | `session` | **认领范围**(0.2.5):`session` = 只认领会话作用域的文件地址(`dsh-resource://file/session/…`,即官方产物/交付/正文提及);`all` = 连无会话的绝对路径(`…/file/absolute/…`)也认领。未认领的地址由 DSH 自带预览兜底 |
384
+ | `windowedOpen` | `false` | **窗口化打开**:开启后设置卡按钮 / guide 入口框在浏览器**新标签页**打开 code-server(自动启动并跟随当前工作区目录);关闭(默认)使用右侧栏标签。官方的文件点击不受它影响(那条链由 DSH 自己发起到右侧栏) |
349
385
  | `keepResident` | `true` | **后台常驻**:开启后宿主启动即把 IDE 预加载到"停放区",切标签/收起侧栏不重载、首次打开免等待;关闭则只在打开面板时加载(省内存) |
350
386
  | ~~`reserveComposer`~~ | `true` | **0.2.3 起废弃**:只对已删除的内部浮动窗口有意义。设置文件里的旧值仍被接受但被忽略(键保留,避免旧设置文档校验失败) |
351
387
 
@@ -402,11 +438,34 @@ desktop profile 由 `apps/desktop-host` 把 `/api/*` 交给同一个 `createShar
402
438
 
403
439
  - host 半部 `inject = ['connection', 'settings']`(**不含 `webServer`**)——desktop profile 关掉了 webserver/web-runtime,
404
440
  本插件照常工作;`/api/*` 请求由 Electron `dsh-app://` 协议处理器 → IPC 帧管道 → `createSharedFetchHandler('/api')`。
405
- - 右侧栏标签、guide 入口框、产物按钮、设置卡片在 desktop 下与 web 相同(code-server 仍是本机 `http://127.0.0.1:<port>` 的 iframe;
441
+ - 右侧栏标签、guide 入口框、文件地址认领、设置卡片在 desktop 下与 web 相同(code-server 仍是本机 `http://127.0.0.1:<port>` 的 iframe;
406
442
  桌面端 `webSecurity: true` 且页面无 CSP 限制,跨源 iframe 正常加载)。
407
443
  桌面端同样自带 `dsh-client-ui-sidebar-right`(见 desktop 构建 seed 包列表),因此 0.2.3 的
408
444
  "只支持带右侧栏的 DSH" 对 desktop 不构成降级;唯一差别是 desktop 无 `webServer`,`serve: dsh` 会自动回退 loopback。
409
- - 安装到 desktop profile:`dsh plugin --profile desktop add dsh-code-server-app@<版本>`(或桌面端插件管理窗)。
445
+ - 安装到 desktop profile:桌面端插件管理窗(**不是** CLI,见下)。
446
+ - **桌面端安装的 24 小时供应链策略(实测,2026-09-10,已用它装上 0.2.4)**:
447
+ - CLI 路径不可用:`dsh plugin --profile desktop …` 会被拒绝(*"profile "desktop" is managed exclusively by the Electron application"*),
448
+ 桌面端只能走应用内的包事务(`pnpm add <spec> --save-exact`,在 `~/.dsh/desktop/staging/<uuid>/profile` 里执行后激活)。
449
+ - 该事务用的 pnpm(应用自带 **11.7.0**,DeepSeek 打过补丁)在 `add` 前先做**锁文件供应链校验**:
450
+ "Verifying lockfile against supply-chain policies (717 entries)",默认要求**发布满 24 小时**,
451
+ 否则 `ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION`。
452
+ - **关键区别(两者行为不同,实测)**:
453
+ - 校验**已有锁文件**时:不接受 `minimumReleaseAgeExclude`(精确版本、裸包名都试过,不放行);
454
+ - **解析**(没有锁文件可校验时,如 `pnpm clean --lockfile` 之后):**认**这份名单,而且 pnpm 自己会往
455
+ `pnpm-workspace.yaml` 追加条目(安装日志会打印 *"Added N entries to minimumReleaseAgeExclude…"*)。
456
+ - 因此桌面端装**刚发布**(<24h)版本的可行路径是 **从"没有锁文件"的干净起点安装**:
457
+ 1. `pnpm clean --lockfile`(**注意:它会连 `node_modules` 一起删**,profile 变成待重装状态);
458
+ 2. 用应用自带的 runtime 在 profile 目录里 `add <spec> --save-exact --trust-lockfile`
459
+ (运行时/仓库/配置目录都在 `~/.dsh/desktop/pnpm/{store,cache,state,config,home}`,`--config.userconfig=…/config/npmrc`,
460
+ 否则会出现 `ERR_PNPM_UNEXPECTED_STORE` / `…UNEXPECTED_VIRTUAL_STORE`);
461
+ 3. 安装后应用启动用的 `install --offline --frozen-lockfile --trust-lockfile` 可正常通过(锁文件与 package.json 一致、
462
+ 包已在 store);`dsh.profile.bundles` 里已有插件名时不需要再改。
463
+ - 不要用 `minimumReleaseAge: 0` 绕过:它确实能让校验通过,但那个键**不在应用容忍的 policy 段里**
464
+ (`project-manager.ts` 只忽略 `minimumReleaseAgeExclude:` / `trustPolicyExclude:`,且每次 `mutate()` 前都会校验),
465
+ 写进去会让应用报 *"core package mapping does not match desktop-packages.json"*。
466
+ - 也可以选择 **等满 24 小时**再在插件管理里正常安装;web profile 不受影响(它的 `pnpm-workspace.yaml` 是 `minimumReleaseAge: false`)。
467
+ - 本插件的依赖闭包里含平台原生子包(`@jinsiyu/dsh-code-server-runtime-win32-*`),它们与插件本身**同批发布**,
468
+ 因此每次新版本在桌面端都会受这条策略约束。
410
469
 
411
470
  ## 已知限制
412
471
 
@@ -1,4 +1,4 @@
1
- // dshcs-open-file:DSH host 通过信号文件请求打开文件。
1
+ // dshcs-open-file:DSH host 通过信号文件请求打开文件(可带 1 基行号)。
2
2
  // host 写入 <user-data>/User/dshcs-open.json 后,本扩展在已连接的窗口中打开该文件。
3
3
  // 信号路径优先取环境变量 DSHCS_OPEN_FILE_SIGNAL(host 注入);
4
4
  // 取不到时用 context.globalStorageUri 推导(=<user-data>/User/globalStorage/<id> 的上两级)。
@@ -25,14 +25,22 @@ function processSignal(signal) {
25
25
  return; // 尚无信号
26
26
  }
27
27
  let file = null;
28
+ let line = null;
28
29
  try {
29
- file = JSON.parse(raw).file;
30
+ const parsed = JSON.parse(raw);
31
+ file = parsed.file;
32
+ line = typeof parsed.line === 'number' && Number.isSafeInteger(parsed.line) && parsed.line > 0 ? parsed.line : null;
30
33
  } catch {
31
34
  return;
32
35
  }
33
36
  if (typeof file !== 'string' || file === '') return;
34
37
  const uri = vscode.Uri.file(file);
35
- vscode.window.showTextDocument(uri, { preview: false }).then(
38
+ const options = { preview: false };
39
+ if (line !== null) {
40
+ const at = new vscode.Position(line - 1, 0);
41
+ options.selection = new vscode.Range(at, at);
42
+ }
43
+ vscode.window.showTextDocument(uri, options).then(
36
44
  () => {
37
45
  try {
38
46
  fs.unlinkSync(signal);
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "dshcs-open-file",
3
3
  "displayName": "DSH Code Server Open File",
4
- "description": "Opens files requested by the DSH host through a signal file (dshcs-open.json).",
5
- "version": "0.0.1",
4
+ "description": "Opens files requested by the DSH host through a signal file (dshcs-open.json), optionally at a line.",
5
+ "version": "0.0.2",
6
6
  "publisher": "dsh-code-server-app",
7
7
  "engines": {
8
8
  "vscode": "^1.80.0"
package/lib/client.js CHANGED
@@ -1,5 +1,5 @@
1
1
  window.__ModuleLoader__.load({id:'dsh-code-server-app',factory:function(require){var module={exports:{}};var exports=module.exports;
2
- var z=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var be=Object.getOwnPropertyNames;var he=Object.prototype.hasOwnProperty;var ve=(e,r)=>{for(var n in r)z(e,n,{get:r[n],enumerable:!0})},me=(e,r,n,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let l of be(r))!he.call(e,l)&&l!==n&&z(e,l,{get:()=>r[l],enumerable:!(s=pe(r,l))||s.enumerable});return e};var ge=e=>me(z({},"__esModule",{value:!0}),e);var $e={};ve($e,{apply:()=>Je,inject:()=>Xe,name:()=>Ke});module.exports=ge($e);var C=typeof Element!="undefined"&&typeof Element.prototype.moveBefore=="function",ye=-2e4,t={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 I(){return{ready:t.frame!==null,docked:t.owner!==null,owner:t.owner,src:t.currentSrc,sameOrigin:t.sameOrigin,parkStrategy:t.parkStrategy,degraded:t.degraded,preloaded:t.preloaded,supportsMoveBefore:C,nudgeCount:t.nudgeCount,lastNudgeAt:t.lastNudgeAt}}function T(){var e=I();t.listeners.forEach(function(r){try{r(e)}catch(n){}})}function J(e){return t.listeners.add(e),function(){t.listeners.delete(e)}}function q(){return I()}function we(e){e!=="offscreen"&&e!=="behind"||t.parkStrategy!==e&&(t.parkStrategy=e,t.frame!==null&&t.owner===null&&P(),T())}function xe(){return t.parkStrategy}function ke(){var e=t.lastRect;e!==null&&(t.park.style.width=Math.max(1,Math.round(e.width))+"px",t.park.style.height=Math.max(1,Math.round(e.height))+"px")}function P(){if(t.park!==null){if(ke(),t.parkStrategy==="behind"&&t.lastRect!==null){t.park.style.left=Math.round(t.lastRect.left)+"px",t.park.style.top=Math.round(t.lastRect.top)+"px",t.park.style.visibility="visible",t.park.style.zIndex="0";return}t.park.style.left=ye+"px",t.park.style.top="0px",t.park.style.visibility="hidden",t.park.style.zIndex="0"}}function X(){t.frame!==null&&(t.frame.setAttribute("inert",""),t.frame.setAttribute("aria-hidden","true"))}function Se(){t.frame!==null&&(t.frame.removeAttribute("inert"),t.frame.removeAttribute("aria-hidden"))}function Ee(){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),t.park=e,t.frame=r,t.currentSrc="about:blank",t.owner=null,P(),X(),r}function Ne(e){var r=t.frame;if(r!==null){var n=t.sameOrigin!==e;!n&&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"),t.sameOrigin=e)}}function H(e){var r=e||{};return t.frame===null&&Ee(),typeof r.sameOrigin=="boolean"&&Ne(r.sameOrigin),typeof r.src=="string"&&r.src!==""&&r.src!==t.currentSrc&&Ce(r.src),t.frame}function Ce(e){t.frame===null||typeof e!="string"||e===""||e===t.currentSrc||(t.currentSrc=e,t.frame.src=e,T())}function K(){var e=t.frame;if(t.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,t.nudgeCount+=1,t.lastNudgeAt=Date.now(),!0}function Te(e){return t.nudgeEnabled=e!==!1,t.nudgeEnabled}function $(e){if(t.frame!==null){if(C)try{e.moveBefore(t.frame,null);return}catch(r){t.degraded=!0,t.lastMoveError=(r&&r.name?r.name+": ":"")+(r&&r.message?r.message:String(r))}else t.degraded=!0;e.appendChild(t.frame)}}function U(e,r){if(!(t.frame===null||e==null)){var n=t.owner===null,s=e.getBoundingClientRect();s.width>=1&&s.height>=1&&(t.lastRect={left:s.left,top:s.top,width:s.width,height:s.height}),t.owner=r===void 0?null:r,Se(),t.park.setAttribute("aria-hidden","true"),$(e),n&&K(),T()}}function L(e){t.frame!==null&&(e!==void 0&&t.owner!==e||(t.owner=null,P(),X(),t.park.setAttribute("aria-hidden","true"),$(t.park),T()))}function B(e){var r=e||{};return H(r),t.owner===null&&(typeof r.src=="string"&&r.src!==""&&(t.preloaded=!0),L()),t.frame}function Le(){t.park!==null&&t.park.parentNode!==null&&t.park.parentNode.removeChild(t.park),t.park=null,t.frame=null,t.currentSrc=null,t.sameOrigin=null,t.owner=null,t.lastRect=null,t.degraded=!1,t.preloaded=!1,t.nudgeCount=0,t.lastNudgeAt=0,T()}typeof window!="undefined"&&(window.__dshcsSurface={snapshot:I,setParkStrategy:we,getParkStrategy:xe,preload:B,dock:U,park:L,nudge:K,setNudgeEnabled:Te,destroy:Le});var a=require("react"),V=new Set,R={status:null,busy:!1,sidebarActive:!1,sidebarUi:"unknown",sidebarRegisterFailed:!1};function k(e){R=Object.assign({},R,e),V.forEach(function(r){r()})}function Oe(e){return V.add(e),function(){V.delete(e)}}function W(){return R}function D(){return a.useSyncExternalStore(Oe,W)}var Re="/api",le="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMTQ3IDE0NyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8c3R5bGU+QG1lZGlhIChwcmVmZXJzLWNvbG9yLXNjaGVtZTogZGFyaykgeyogeyBmaWxsOiB3aGl0ZTsgfX08L3N0eWxlPgogIDxwYXRoIGQ9Im00Mi40MjE0LDM5LjY1NWMtMjQuNDA1NywwIC00Mi4xNTU0LDEzLjE3MjEgLTQyLjE1NTQsMzMuODQ1YzAsMjAuNTgxNCAxOC40ODkyLDMzLjg0NSA0Mi4xNTU0LDMzLjg0NWMyMy42NjYyLDAgMzguMTgwMywtMTEuNjE3MSAzOC43MzQ5LC0yOC43MjI1bC0yMS4wNzc3LC0wLjQ1NzRjLTAuOTI0NCw5LjMzMDMgLTkuMTA1OSwxNS4xODQ1IC0xNy42NTcyLDE1LjE4NDVjLTExLjc0MDYsMCAtMjAuNDMwNiwtNy41OTIyIC0yMC40MzA2LC0xOS44NDk2YzAsLTEyLjI1NzQgOC42OSwtMTkuOTg2OCAyMC40MzA2LC0yMC4yMTU1YzguNTUxMywtMC4xODMgMTYuOTE3Nyw1Ljk0NTcgMTcuNDcyMywxNS4yNzZsMjEuMDc3NywtMC42NDAzYy0wLjQ2MjIsLTE2LjgzMTEgLTE0LjE0NDIsLTI4LjI2NTIgLTM4LjU1LC0yOC4yNjUyem00OC44NDQ2LDJsNTUuNDY4LDBsMCw2NC4wMzExbC01NS40NjgsMGwwLC02NC4wMzExeiIgY2xpcC1ydWxlPSJldmVub2RkIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz4KPC9zdmc+Cg==";async function x(e,r){var n={method:r===void 0?"GET":"POST",headers:{}};r!==void 0&&(n.headers["content-type"]="application/json",n.body=JSON.stringify(r));var s=await fetch(Re+e,n),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 M(e,r){try{var n=e(function(p){return p}),s=r===null?null:typeof r=="function"?r(function(p){return p}):null,l=n!=null?n.current:void 0;if(l!==void 0&&n!=null&&n.byId!=null){var i=n.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 c=0;c<d.length;c++){var v=d[c];if(v.sessionIds!=null&&v.sessionIds.indexOf(l)!==-1&&typeof v.path=="string"&&v.path!=="")return v.path}var u=s!=null?s.recentWorkspaceId:void 0;if(u!==void 0){for(var b=0;b<d.length;b++)if(d[b].workspaceId===u&&typeof d[b].path=="string"&&d[b].path!=="")return d[b].path}if(d.length>0&&typeof d[0].path=="string"&&d[0].path!=="")return d[0].path}catch(p){}}function F(e,r){if(e==null||typeof e.url!="string"||e.url==="")return null;var n=typeof r=="string"&&r!==""?r:e!=null&&e.cwd!=null?e.cwd:null;if(n==null||n==="")return e.url;var s=n.replace(/\\/g,"/"),l=s;return(/^[A-Za-z]:\//.test(s)||s.charCodeAt(0)!==47)&&(l="/"+s),e.url+"?folder="+encodeURIComponent(l)}function Me(e){var r=e.status,n=e.pageUrl,s=e.reloadTick,l=e.owner,i=a.useRef(null),d=r!=null&&r.ok===!0&&r.running===!0,c=r!=null&&r.status==="starting",v=r!=null&&r.ok===!1,u=r!=null&&r.serve==="dsh";if(a.useLayoutEffect(function(){if(!d||n===null){L(l);return}H({src:n,sameOrigin:u}),i.current!==null&&U(i.current,l)},[d,n,u,s,l]),a.useLayoutEffect(function(){return function(){L(l)}},[l]),d&&n!==null)return a.createElement("div",{ref:i,className:"dshcs-slot","data-code-server-slot":l!=null?l:"code-server"});if(c)return a.createElement("div",{className:"dshcs-loading"},"\u6B63\u5728\u542F\u52A8 code-server\u2026");var b=v&&r!=null&&r.error?r.error:"code-server \u672A\u8FD0\u884C",p=u?"\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",m=C?"\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 a.createElement("div",{className:"dshcs-empty"},a.createElement("div",{className:"dshcs-emptybox"},a.createElement("div",null,v?"code-server \u542F\u52A8\u5931\u8D25":"code-server \u672A\u8FD0\u884C"),a.createElement("pre",{className:"dshcs-error"},b),a.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"+p+m)))}function Ae(e){var r=D(),n=r.status,s=n!=null&&n.ok===!0&&n.running===!0,l=n!=null&&n.keepResident===!0,i=M(e&&e.useSessions,e&&e.useWorkspaces),d=s?F(n,i):null;return a.useEffect(function(){!l||!s||d===null||B({src:d,sameOrigin:n!=null&&n.serve==="dsh"})},[l,s,d,n!=null?n.serve:null]),null}function ee(e){var r=function(s){var l=F(s,e);l!=null&&typeof window.open=="function"&&window.open(l,"_blank","noopener")},n=W().status;if(n!=null&&n.running===!0){r(n);return}W().busy!==!0&&(k({busy:!0}),x("/code-server/start",typeof e=="string"?{cwd:e}:{}).then(function(s){k({status:s,busy:!1}),r(s)}).catch(function(){k({busy:!1})}))}var De=".dshcs-artbtn{appearance:none;display:inline-grid;place-items:center;width:22px;height:22px;padding:0;border:1px solid var(--dsw-alias-border-l2,#dfe3eb);border-radius:6px;color:var(--dsw-alias-label-secondary,#566174);background:color-mix(in srgb,var(--dsw-alias-bg-base,#fff) 60%,transparent);cursor:pointer;transition:color .12s ease,background .12s ease,border-color .12s ease;vertical-align:middle}.dshcs-artbtn:hover{color:var(--dsw-alias-label-primary,#172033);border-color:color-mix(in srgb,var(--dshcs-accent,#5b6cff) 40%,var(--dsw-alias-border-l2,#dfe3eb));background:color-mix(in srgb,var(--dshcs-accent,#5b6cff) 8%,transparent)}.dshcs-artbtn:active{transform:scale(.94)}.dshcs-artbtn:focus-visible{outline:2px solid color-mix(in srgb,var(--dshcs-accent,#5b6cff) 65%,transparent);outline-offset:1px}.dshcs-artifacts{display:grid;grid-template-columns:max-content minmax(0,1fr);align-items:center;gap:6px 8px;margin-top:16px;font-size:13px;line-height:22px;position:relative}.dshcs-artlabel{color:var(--dsw-alias-label-tertiary,#7d8798);grid-area:1/1}.dshcs-artrow{flex-wrap:nowrap;grid-area:1/2;align-items:center;gap:8px;min-width:0;display:flex;overflow:hidden}.dshcs-artitem{display:inline-flex;align-items:center;gap:4px;flex:none;min-width:0}.dshcs-artfile{text-overflow:ellipsis;white-space:nowrap;background:var(--dsw-alias-interactive-bg-hover);max-width:320px;color:var(--dsw-alias-label-secondary,#566174);font:inherit;cursor:pointer;border:none;border-radius:6px;margin:0;padding:0 8px;overflow:hidden}.dshcs-artfile:hover{color:var(--dsw-alias-label-primary,#172033);text-decoration:underline}.dshcs-artfile:focus-visible{box-shadow:inset 0 0 0 2px var(--dsw-alias-border-l3);outline:none}.dshcs-artmore{white-space:nowrap;color:var(--dsw-alias-label-tertiary,#7d8798);flex:none}.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}",re="dsh-code-server/styles";typeof document!="undefined"&&document.querySelector("style[data-dshcs="+JSON.stringify(re)+"]")===null&&(O=document.createElement("style"),O.setAttribute("data-dshcs",re),O.textContent=De,document.head.appendChild(O));var O,_="code-server",ae="dsh-code-server-app",je=2500,ze=1e4,Ie=1500,N={openTab:null};function Pe(e){var r=e!=null&&typeof e.size=="number"?e.size:16;return a.createElement("img",{src:le,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 He(e){var r=e.useTabInfo(),n=r.tab,s=D(),l=s.status,i=M(e.useSessions,null),d=a.useRef(void 0),[c,v]=a.useState(0),u=n.navigation,b=u!=null&&typeof u.revision=="number"?u.revision:0;return a.useEffect(function(){if(!(typeof i!="string"||i==="")&&d.current!==i){var p=d.current!==void 0;d.current=i;var m=!1;return x("/code-server/start",{cwd:i}).then(function(f){m||(k({status:f}),p&&f!=null&&f.ok===!0&&f.running===!0&&v(function(w){return w+1}))}).catch(function(){}),function(){m=!0}}},[i]),a.useEffect(function(){x("/code-server/status").then(function(m){m!=null&&k({status:m})}).catch(function(){});var p=window.setInterval(function(){x("/code-server/status").then(function(m){k({status:m})}).catch(function(){})},3e3);return function(){window.clearInterval(p)}},[]),a.useEffect(function(){var p=u!=null?u.params:null,m=p!=null&&typeof p.path=="string"?p.path:"";m!==""&&x("/code-server/open-file",{file:m}).catch(function(){})},[b]),a.createElement("div",{className:"dshcs-tabroot","data-code-server-tab":"body"},a.createElement(Me,{status:l,pageUrl:F(l,i),reloadTick:c,owner:"tab:"+n.id}))}function G(e,r){if(e==null)return null;var n=e[r];if(n!=null)return n;if(typeof e.get=="function"){var s=e.get(r);if(s!=null)return s}return null}function Ue(e){var r=G(e,"sidebarRightTabs"),n=G(e,"sidebarRight");if(r==null||n==null)return console.error("[code-server] \u53F3\u4FA7\u680F\u670D\u52A1\u4E0A\u4E0B\u6587\u4E0D\u53EF\u89C1(sidebarRightTabs="+(r!=null)+", sidebarRight="+(n!=null)+"):\u8DF3\u8FC7\u4FA7\u680F\u6CE8\u518C"),!1;var s=G(e,"slots");if(e.effect(function(){return r.register({id:ae,kind:_,priority:"extension",title:function(){return"Code Server"},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\u3002"},icon:Pe}]})},"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:ae},He)})},"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 N.openTab=function(l){try{return n.openTab(_,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(){N.openTab=null,k({sidebarActive:!1,sidebarUi:"unknown"})}},"code-server: sidebar mode reset"),console.log("[code-server] right-sidebar tab registered (kind="+_+")"),!0}var Be=".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-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}",_e="dsh-code-server/Card.module.css";function Ge(e,r){if(typeof document!="undefined"&&document.querySelector("style[data-plugin-css="+JSON.stringify(e)+"]")===null){var n=document.createElement("style");n.dataset.plugin="dsh-code-server",n.dataset.pluginCss=e,n.textContent=r,document.head.appendChild(n)}}Ge(_e,Be);function Ve(e){return a.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none","aria-hidden":!0,className:e.className},a.createElement("path",{d:"M3.5 5.25L7 8.75L10.5 5.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))}function A(e){return a.createElement("button",{type:"button",className:"dshcs-cbtn "+(e.variant==="primary"?"dshcs-cbtnPrimary":"dshcs-cbtnOutline"),disabled:e.disabled===!0,onClick:e.onClick},e.children)}function te(e){return a.createElement("label",{className:"dshcs-check"},a.createElement("input",{type:"checkbox",checked:e.checked===!0,disabled:e.disabled===!0,onChange:function(r){e.onChange(r.target.checked)}}),a.createElement("span",{className:"dshcs-hint"},e.children))}function ne(e){var r=[];return e.overridden===!0&&(r.push(a.createElement("span",{className:"dshcs-badge"},e.overriddenLabel)),r.push(a.createElement("button",{type:"button",className:"dshcs-reset",disabled:e.disabled===!0,onClick:e.onReset},e.resetLabel))),r.length===0?null:a.createElement("span",{className:"dshcs-badges"},...r)}function se(e){var[r,n]=a.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 a.createElement("li",{className:"dshcs-card"+(r?" dshcs-cardOpen":"")},a.createElement("button",{type:"button",className:"dshcs-cardHeader","aria-expanded":r,onClick:function(){n(!r)}},a.createElement("span",{className:"dshcs-cardHeadText"},a.createElement("span",{className:"dshcs-cardName"},l),a.createElement("span",{className:"dshcs-cardDescription"},e.description)),s.dirty===!0?a.createElement("span",{className:"dshcs-pending"},e.unsavedLabel):null,a.createElement(Ve,{className:"dshcs-cardChevron"+(r?" dshcs-cardChevronOpen":"")})),r===!0?a.createElement("div",{className:"dshcs-cardBody"},i===!0?null:s.writable!==!0?a.createElement("p",{className:"dshcs-cardReadOnly",role:"status"},e.readOnlyLabel):null,e.children,i===!0?null:a.createElement("div",{className:"dshcs-cardFooter"},s.failed===!0?a.createElement("p",{className:"dshcs-cardFailed",role:"status"},e.saveFailedLabel):null,a.createElement(A,{disabled:s.dirty!==!0||s.saving===!0,onClick:e.onDiscard},e.discardLabel),a.createElement(A,{variant:"primary",disabled:d,onClick:e.onSave},s.saving===!0?e.savingLabel:e.saveLabel))):null)}function We(e){try{let E=function(){x("/code-server/status").then(function(h){h!=null&&typeof h=="object"&&k({status:h})}).catch(function(){})};var r=e.scope,[n,s]=a.useState(function(){return r!==void 0?r.getSnapshot():null}),[l,i]=a.useState(null),[d,c]=a.useState(!1),[v,u]=a.useState(!1),b=D(),[p,m]=a.useState(q());if(a.useEffect(function(){return J(function(h){m(h)})},[]),a.useEffect(function(){if(r===void 0||typeof r.subscribe!="function")return;function h(){try{s(r.getSnapshot())}catch(rr){}}var S=r.subscribe(h);return function(){typeof S=="function"&&S()}},[r]),r===void 0)return console.error("[code-server] card scope missing"),null;if(n==null||n.status!=="ready")return n!=null&&n.status==="unavailable"&&console.warn("[code-server] settings scope unavailable:",n.status),null;var f=n.value!==void 0&&n.value!==null?n.value:{},w=n.user,y={windowedOpen:f.windowedOpen===!0,keepResident:f.keepResident!==!1};if(b!=null&&b.sidebarUi==="legacy")return a.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}},a.createElement("div",{className:"dshcs-field"},a.createElement("div",{className:"dshcs-legacy"},"\u672C\u63D2\u4EF6\u81EA 0.2.3 \u8D77\u4E0D\u518D\u517C\u5BB9\u65E7\u7248 DSH\u3002"),a.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=w!=null&&Object.prototype.hasOwnProperty.call(w,"windowedOpen"),ie=w!=null&&Object.prototype.hasOwnProperty.call(w,"keepResident"),de=b!=null&&b.sidebarActive===!0,j=l!==null&&(l.windowedOpen!==y.windowedOpen||l.keepResident!==y.keepResident),er=!j||d,ce={available:!0,writable:n.writable,dirty:j,invalid:!1,saving:d,failed:v};async function fe(){if(j&&!d){c(!0),u(!1);try{var h=l!==null?l:y;await e.scope.set("windowedOpen",h.windowedOpen===!0),await e.scope.set("keepResident",h.keepResident===!0),i(null),E()}catch(S){u(!0)}c(!1)}}async function Z(){if(!(d||n.writable!==!0)){c(!0),u(!1);try{typeof e.scope.unset=="function"?(await e.scope.unset("windowedOpen"),await e.scope.unset("keepResident")):(await e.scope.set("windowedOpen",f.windowedOpen===!0),await e.scope.set("keepResident",f.keepResident===void 0||f.keepResident===null?!0:f.keepResident)),i(null),E()}catch(h){u(!0)}c(!1)}}var[o,oe]=a.useState(null),[Q,Y]=a.useState(!1),ue=a.createElement("div",{className:"dshcs-field"},a.createElement("div",{className:"dshcs-fieldHead"},a.createElement("span",{className:"dshcs-fieldLabel"},"\u73AF\u5883\u68C0\u6D4B"),a.createElement("span",{className:"dshcs-badges"},a.createElement(A,{variant:"primary",disabled:Q,onClick:async function(){Y(!0);var h=await x("/code-server/status");oe(h!=null&&h.env!=null?h.env:{error:"status \u672A\u8FD4\u56DE env"}),Y(!1)}},Q?"\u68C0\u6D4B\u4E2D\u2026":"\u68C0\u6D4B\u73AF\u5883"))),o!=null?a.createElement("div",{className:"dshcs-hint",style:{marginTop:6}},o.error!=null?a.createElement("span",null,"\u68C0\u6D4B\u5931\u8D25: "+o.error):a.createElement("span",null,"\u72B6\u6001: "+(o.ok===!0?"\u2705 \u5C31\u7EEA":"\u274C \u4E0D\u901A\u8FC7")+(o.treeVersion!=null?" \xB7 VS Code \u6811: "+o.treeVersion:"")+(o.upToDate===!1&&o.vendored!=null?"(\u5185\u7F6E "+o.vendored+") ":"")+(o.productPath!=null?" \xB7 \u5BA2\u6237\u7AEF\u8DEF\u5F84: "+o.productPath:"")+(o.entry!=null?" \xB7 \u5165\u53E3: "+o.entry:" \xB7 \u5165\u53E3\u7F3A\u5931")+" \xB7 VS Code \u5185\u90E8\u4F9D\u8D56: "+(o.vscodeInner===!0?"\u2705":"\u274C")+" \xB7 \u9884\u7F16\u8BD1\u539F\u751F\u5305: "+(o.nativeRuntime!=null&&o.nativeRuntime.packages>0?"\u2705 "+o.nativeRuntime.name+"@"+(o.nativeRuntime.version!=null?o.nativeRuntime.version:"?")+"("+o.nativeRuntime.packages+" \u5305)":"\u274C \u672A\u5B89\u88C5("+(o.nativeRuntime!=null&&o.nativeRuntime.name!=null?o.nativeRuntime.name:"\u5E73\u53F0\u805A\u5408\u5305")+")"))):a.createElement("div",{className:"dshcs-hint",style:{marginTop:6}},'\u70B9\u51FB"\u68C0\u6D4B\u73AF\u5883"\u67E5\u770B VS Code \u6811\u72B6\u6001(\u4F9D\u8D56\u7531\u5305\u7BA1\u7406\u5668\u5B89\u88C5,\u65E0\u9700\u5B89\u88C5\u6B65\u9AA4)'),a.createElement("div",{className:"dshcs-hint",style:{marginTop:10,color:"var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary))"}},"\u8FD0\u884C\u4F4D\u7F6E: "+(o!=null&&o.tree!=null?o.tree:"<\u63D2\u4EF6\u76EE\u5F55>\\vendor\\vscode")+`
4
- \u5378\u8F7D: dsh plugin --profile web remove dsh-code-server-app`));return a.createElement(se,{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: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:fe,onDiscard:function(){i(null),u(!1)}},a.createElement("div",{className:"dshcs-field"},a.createElement("div",{className:"dshcs-fieldHead"},a.createElement("span",{className:"dshcs-fieldLabel"},"\u5165\u53E3"),a.createElement("span",{className:"dshcs-badges"},a.createElement(A,{disabled:de!==!0,onClick:function(){N.openTab!==null&&N.openTab(null)}},"\u5728\u53F3\u4FA7\u680F\u6253\u5F00"))),a.createElement("div",{className:"dshcs-hint",style:{marginTop:6}},b!=null&&b.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\u3002\u4ECE\u53F3\u4FA7\u680F\u300C\u5F00\u59CB\u300D\u9875\u7684 Code Server \u5165\u53E3\u6846\u3001\u4EA7\u7269\u65C1\u6309\u94AE\u6216\u4E0A\u9762\u7684\u6309\u94AE\u6253\u5F00\u3002")),a.createElement("div",{className:"dshcs-field"},a.createElement("div",{className:"dshcs-fieldHead"},a.createElement("span",{className:"dshcs-fieldLabel"},"\u7A97\u53E3\u5316\u6253\u5F00(\u65B0\u6807\u7B7E\u9875)"),g===!0?a.createElement(ne,{overridden:!0,disabled:n.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){Z()}}):null),a.createElement(te,{checked:l!==null?l.windowedOpen:y.windowedOpen,disabled:n.writable!==!0,onChange:function(h){i(function(S){return Object.assign({},S!==null?S:y,{windowedOpen:h===!0})}),u(!1)}},"\u5F00\u542F\u540E\u5165\u53E3(\u4EA7\u7269\u6309\u94AE/\u8BBE\u7F6E\u5361)\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")),a.createElement("div",{className:"dshcs-field"},a.createElement("div",{className:"dshcs-fieldHead"},a.createElement("span",{className:"dshcs-fieldLabel"},"\u540E\u53F0\u5E38\u9A7B(\u5207\u6807\u7B7E\u4E0D\u91CD\u8F7D)"),ie===!0?a.createElement(ne,{overridden:!0,disabled:n.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){Z()}}):null),a.createElement(te,{checked:l!==null?l.keepResident:y.keepResident,disabled:n.writable!==!0,onChange:function(h){i(function(S){return Object.assign({},S!==null?S:y,{keepResident:h===!0})}),u(!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)'),a.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},C?"\u5E38\u9A7B\u9762:"+(p.docked?"\u5DF2\u505C\u9760":p.ready?"\u5DF2\u505C\u653E(\u540E\u53F0\u8FD0\u884C\u4E2D)":"\u672A\u542F\u52A8")+(p.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)")),a.createElement("div",{className:"dshcs-field"},a.createElement("div",{className:"dshcs-fieldHead"},a.createElement("span",{className:"dshcs-fieldLabel"},"\u4F9D\u8D56\u5B89\u88C5"),null),a.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")),ue)}catch(E){return console.error("[code-server] card render error:",E!=null&&E.message!==void 0?E.message:String(E)),null}}function Fe(e){var r=[];try{var n=e.turn.data.get("deliverables"),s=e.seq!=null?e.seq:Number.POSITIVE_INFINITY;if(n!=null&&Array.isArray(n.produced))for(var l={},i=0;i<n.produced.length;i++){var d=n.produced[i];d==null||typeof d.path!="string"||d.path===""||d.seq!=null&&d.seq>s||l[d.path]!==!0&&(l[d.path]=!0,r.push(d.path))}}catch(c){}return r}function Qe(e){var r=Fe(e);return r.length===0?null:r}function Ye(e){return a.createElement("img",{src:le,alt:"","aria-hidden":!0,draggable:!1,style:{width:15,height:15,display:"block",objectFit:"contain",WebkitUserDrag:"none",userSelect:"none"}})}function Ze(e){var r=D();if(e==null||!Array.isArray(e.matched)||e.matched.length===0)return null;var n=e.matched;function s(i){var d=String(i).replace(/\\/g,"/"),c=d.lastIndexOf("/");return c>=0?d.slice(c+1):d}function l(i){var d=r.status;if(d!=null&&d.windowedOpen===!0){ee(M(e.useSessions,e.useWorkspaces));return}r.sidebarActive===!0&&N.openTab!==null&&N.openTab({path:i})===!0||(ee(M(e.useSessions,e.useWorkspaces)),x("/code-server/open-file",{file:i}).then(function(c){(c==null||c.ok!==!0)&&window.alert(c!=null&&c.error?c.error:"\u6253\u5F00\u5931\u8D25")}).catch(function(c){window.alert("\u6253\u5F00\u5931\u8D25: "+String(c))}))}return a.createElement("div",{className:"dshcs-artifacts"},a.createElement("span",{className:"dshcs-artlabel"},"\u4EA7\u7269"),a.createElement("div",{className:"dshcs-artrow"},n.slice(0,6).map(function(i){return a.createElement("span",{key:i,className:"dshcs-artitem"},a.createElement("button",{type:"button",className:"dshcs-artfile",title:i,"aria-label":"\u6253\u5F00: "+i,onClick:function(){l(i)}},s(i)),a.createElement("button",{type:"button",className:"dshcs-artbtn",title:"\u5728 Code Server \u6253\u5F00: "+i,"aria-label":"\u5728 Code Server \u6253\u5F00: "+i,onClick:function(){l(i)}},a.createElement(Ye,null)))}),n.length>6?a.createElement("span",{className:"dshcs-artmore"},"\u2026"):null))}function Je(e){try{qe(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(n){}}}function qe(e){var r=e.get("slots");if(r===void 0){console.error("[code-server] slots service unavailable");return}var n=e.settingsScope,s=null;if(n!==void 0&&typeof n.bind=="function")s=n.bind({namespace:"code-server"});else{console.error("[code-server] settingsScope unavailable (inject missing?); settings card disabled");return}x("/code-server/status").then(function(f){k({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}}},We));var l=!1;function i(f,w){if(!l){l=!0,b();var y=!1;try{y=Ue(f)}catch(g){console.error("[code-server] sidebar tab registration failed:",g!=null&&g.message!=null?g.message:String(g))}R.sidebarUi==="legacy"&&(console.log("[code-server] \u53F3\u4FA7\u680F\u670D\u52A1\u665A\u5230(\u7ECF "+w+"):\u64A4\u9500\u65E7\u7248 DSH \u5224\u5B9A"),x("/code-server/ui-mode",{sidebar:!0}).catch(function(){})),k({sidebarActive:y,sidebarUi:"modern",sidebarRegisterFailed:y!==!0}),r.inject("shell.overlay",()=>r.register({name:"shell.overlay",id:"code-server",order:70,label:"Code Server"},g=>a.createElement(Ae,g)));try{r.inject("conversation.chat.turnTail",function(){return r.register({name:"conversation.chat.turnTail",priority:-9,id:"dshcs-open-file",select:Qe},Ze)})}catch(g){console.warn("[code-server] turnTail register failed:",g!=null&&g.message!=null?g.message:String(g))}console.log("[code-server] client registered via "+w+": sidebar tab="+y+" + turnTail artifacts + resident preload + settings card")}}function d(f){k({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&&x("/code-server/ui-mode",{sidebar:!1}).catch(function(){})}var c=null,v=null,u=null;function b(){c!==null&&(clearTimeout(c),c=null),v!==null&&(clearTimeout(v),v=null),u!==null&&(clearTimeout(u),u=null)}var p=!1;try{typeof e.inject=="function"&&(p=!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 m=typeof e.get=="function"&&e.get("sidebarRightTabs")!==void 0&&e.get("sidebarRight")!==void 0;if(m){u=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"))},Ie);return}if(p!==!0){d(!0);return}c=setTimeout(function(){l||d(!1)},je),v=setTimeout(function(){l||d(!0)},ze)}var Xe=["slots","settingsScope"],Ke="code-server";
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 y=g!=null&&Object.prototype.hasOwnProperty.call(g,"windowedOpen"),S=g!=null&&Object.prototype.hasOwnProperty.call(g,"keepResident"),C=g!=null&&Object.prototype.hasOwnProperty.call(g,"fileOpenScope"),z=o!=null&&o.sidebarActive===!0,P=l!==null&&(l.windowedOpen!==m.windowedOpen||l.keepResident!==m.keepResident||l.fileOpenScope!==m.fileOpenScope),or=!P||d,he={available:!0,writable:t.writable,dirty:P,invalid:!1,saving:d,failed:b};async function ye(){if(P&&!d){p(!0),c(!1);try{var v=l!==null?l:m;await e.scope.set("windowedOpen",v.windowedOpen===!0),await e.scope.set("keepResident",v.keepResident===!0),await e.scope.set("fileOpenScope",v.fileOpenScope==="all"?"all":"session"),i(null),E()}catch(w){c(!0)}p(!1)}}async function I(){if(!(d||t.writable!==!0)){p(!0),c(!1);try{typeof e.scope.unset=="function"?(await e.scope.unset("windowedOpen"),await e.scope.unset("keepResident"),await e.scope.unset("fileOpenScope")):(await e.scope.set("windowedOpen",f.windowedOpen===!0),await e.scope.set("keepResident",f.keepResident===void 0||f.keepResident===null?!0:f.keepResident),await e.scope.set("fileOpenScope",f.fileOpenScope==="all"?"all":"session")),i(null),E()}catch(v){c(!0)}p(!1)}}var[u,me]=n.useState(null),[X,K]=n.useState(!1),ge=n.createElement("div",{className:"dshcs-field"},n.createElement("div",{className:"dshcs-fieldHead"},n.createElement("span",{className:"dshcs-fieldLabel"},"\u73AF\u5883\u68C0\u6D4B"),n.createElement("span",{className:"dshcs-badges"},n.createElement(j,{variant:"primary",disabled:X,onClick:async function(){K(!0);var v=await k("/code-server/status");me(v!=null&&v.env!=null?v.env:{error:"status \u672A\u8FD4\u56DE env"}),K(!1)}},X?"\u68C0\u6D4B\u4E2D\u2026":"\u68C0\u6D4B\u73AF\u5883"))),u!=null?n.createElement("div",{className:"dshcs-hint",style:{marginTop:6}},u.error!=null?n.createElement("span",null,"\u68C0\u6D4B\u5931\u8D25: "+u.error):n.createElement("span",null,"\u72B6\u6001: "+(u.ok===!0?"\u2705 \u5C31\u7EEA":"\u274C \u4E0D\u901A\u8FC7")+(u.treeVersion!=null?" \xB7 VS Code \u6811: "+u.treeVersion:"")+(u.upToDate===!1&&u.vendored!=null?"(\u5185\u7F6E "+u.vendored+") ":"")+(u.productPath!=null?" \xB7 \u5BA2\u6237\u7AEF\u8DEF\u5F84: "+u.productPath:"")+(u.entry!=null?" \xB7 \u5165\u53E3: "+u.entry:" \xB7 \u5165\u53E3\u7F3A\u5931")+" \xB7 VS Code \u5185\u90E8\u4F9D\u8D56: "+(u.vscodeInner===!0?"\u2705":"\u274C")+" \xB7 \u9884\u7F16\u8BD1\u539F\u751F\u5305: "+(u.nativeRuntime!=null&&u.nativeRuntime.packages>0?"\u2705 "+u.nativeRuntime.name+"@"+(u.nativeRuntime.version!=null?u.nativeRuntime.version:"?")+"("+u.nativeRuntime.packages+" \u5305)":"\u274C \u672A\u5B89\u88C5("+(u.nativeRuntime!=null&&u.nativeRuntime.name!=null?u.nativeRuntime.name:"\u5E73\u53F0\u805A\u5408\u5305")+")"))):n.createElement("div",{className:"dshcs-hint",style:{marginTop:6}},'\u70B9\u51FB"\u68C0\u6D4B\u73AF\u5883"\u67E5\u770B VS Code \u6811\u72B6\u6001(\u4F9D\u8D56\u7531\u5305\u7BA1\u7406\u5668\u5B89\u88C5,\u65E0\u9700\u5B89\u88C5\u6B65\u9AA4)'),n.createElement("div",{className:"dshcs-hint",style:{marginTop:10,color:"var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary))"}},"\u8FD0\u884C\u4F4D\u7F6E: "+(u!=null&&u.tree!=null?u.tree:"<\u63D2\u4EF6\u76EE\u5F55>\\vendor\\vscode")+`
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";
5
5
  return module.exports;}});
package/lib/index.js CHANGED
@@ -105,6 +105,11 @@ export const Config = z.object({
105
105
  /** keepResident=true(默认)客户端在宿主 running 后把 IDE 预先加载到"停放区",
106
106
  * 切标签/收起侧栏不再重载;false 则只在打开面板时才加载(省内存)。 */
107
107
  keepResident: z.boolean().default(true),
108
+ /** 客户端认领哪些文件地址(哪些文件的点击交给 Code Server 打开):
109
+ * 'session'(默认)= 只认领会话作用域的 `dsh-resource://file/session/…`(产物、交付、
110
+ * 正文提及、工具视图都走这条);'all' = 连不带会话的 `dsh-resource://file/absolute/…` 也认领。
111
+ * 未认领的地址由 DSH 自带预览兜底。 */
112
+ fileOpenScope: z.union([z.const('session'), z.const('all')]).default('session'),
108
113
  });
109
114
 
110
115
  const DEFAULT_CONFIG = {
@@ -179,9 +184,9 @@ function extensionTarget(extensionsDir) {
179
184
  return { dst: path.join(extensionsDir, 'dshcs-open-file'), builtin: false };
180
185
  }
181
186
 
182
- /** 内置扩展安装:dshcs-open-file(host 信号文件 → VS Code 打开文件)。
187
+ /** 内置扩展安装:dshcs-open-file(host 信号文件 → VS Code 打开文件,可带行号)。
183
188
  * 优先装进 code-server 内置扩展目录(不可卸载);同时清理用户级旧副本。
184
- * 每次启动调用:缺失即拷(自愈,code-server 升级后自动找回)。 */
189
+ * 每次启动调用:缺失**或内容有变化**即同步(自愈,且插件升级后能更新已装的旧副本)。 */
185
190
  function installBundledExtension(extensionsDir, userDataDir) {
186
191
  try {
187
192
  const here = path.dirname(fileURLToPath(import.meta.url));
@@ -189,17 +194,26 @@ function installBundledExtension(extensionsDir, userDataDir) {
189
194
  if (!fs.existsSync(path.join(src, 'package.json'))) return;
190
195
  const target = extensionTarget(extensionsDir);
191
196
  const dst = target.dst;
192
- if (!fs.existsSync(path.join(dst, 'extension.js'))) {
197
+ const files = ['package.json', 'extension.js'];
198
+ const stale = files.filter((name) => {
199
+ const to = path.join(dst, name);
200
+ if (!fs.existsSync(to)) return true;
201
+ try {
202
+ return fs.readFileSync(path.join(src, name), 'utf8') !== fs.readFileSync(to, 'utf8');
203
+ } catch {
204
+ return true;
205
+ }
206
+ });
207
+ if (stale.length > 0) {
193
208
  fs.mkdirSync(dst, { recursive: true });
194
- fs.copyFileSync(path.join(src, 'package.json'), path.join(dst, 'package.json'));
195
- fs.copyFileSync(path.join(src, 'extension.js'), path.join(dst, 'extension.js'));
209
+ for (const name of stale) fs.copyFileSync(path.join(src, name), path.join(dst, name));
196
210
  }
197
211
  // 清理用户级旧副本(避免重复/可卸载副本)
198
212
  const legacy = path.join(extensionsDir, 'dshcs-open-file');
199
213
  if (legacy !== dst && fs.existsSync(legacy)) {
200
214
  fs.rmSync(legacy, { recursive: true, force: true });
201
215
  }
202
- console.log(`[code-server] bundled extension dshcs-open-file -> ${dst}${target.builtin ? ' (内置,不可卸载)' : ' (用户级回退)'}`);
216
+ console.log(`[code-server] bundled extension dshcs-open-file -> ${dst}${target.builtin ? ' (内置,不可卸载)' : ' (用户级回退)'}${stale.length > 0 ? ` [更新 ${stale.join(',')}]` : ''}`);
203
217
  } catch (err) {
204
218
  console.warn('[code-server] bundled extension install failed:', err && err.message ? err.message : String(err));
205
219
  }
@@ -391,6 +405,7 @@ export async function apply(ctx, config) {
391
405
  let windowedOpen = false;
392
406
  let serveSetting = 'loopback';
393
407
  let keepResident = true; // 客户端常驻预热(0.2.2)
408
+ let fileOpenScope = 'session'; // 客户端认领的文件地址范围(0.2.5)
394
409
  if (settingsSvc !== undefined && typeof settingsSvc.register === 'function') {
395
410
  try {
396
411
  const scope = settingsSvc.register(SETTINGS_NS, Config);
@@ -401,6 +416,7 @@ export async function apply(ctx, config) {
401
416
  windowedOpen = resolved && typeof resolved.windowedOpen === 'boolean' ? resolved.windowedOpen : false;
402
417
  serveSetting = resolved && resolved.serve === 'dsh' ? 'dsh' : 'loopback';
403
418
  keepResident = resolved && typeof resolved.keepResident === 'boolean' ? resolved.keepResident : true;
419
+ fileOpenScope = resolved && resolved.fileOpenScope === 'all' ? 'all' : 'session';
404
420
  }
405
421
  scope.watch((next) => {
406
422
  if (next != null && typeof next.reserveComposer === 'boolean') {
@@ -421,6 +437,12 @@ export async function apply(ctx, config) {
421
437
  keepResident = next.keepResident;
422
438
  console.log(`[code-server] keepResident updated: ${keepResident}`);
423
439
  }
440
+ if (next != null && (next.fileOpenScope === 'all' || next.fileOpenScope === 'session')) {
441
+ if (next.fileOpenScope !== fileOpenScope) {
442
+ fileOpenScope = next.fileOpenScope;
443
+ console.log(`[code-server] fileOpenScope updated: ${fileOpenScope}`);
444
+ }
445
+ }
424
446
  });
425
447
  } catch (error) {
426
448
  console.error(`[code-server] settings unavailable; using defaults (keepResident=true, windowedOpen=false): ${error.message}`);
@@ -519,6 +541,7 @@ export async function apply(ctx, config) {
519
541
  reserveComposer, // 0.2.3 起废弃(仅旧版浮窗用过);保留字段以免旧客户端读取时报错
520
542
  windowedOpen,
521
543
  keepResident,
544
+ fileOpenScope: /** 客户端据此决定认领哪些文件地址(0.2.5) */ fileOpenScope,
522
545
  sidebarUi: state.sidebarUi,
523
546
  env: state.env,
524
547
  setup: {
@@ -934,17 +957,19 @@ export async function apply(ctx, config) {
934
957
 
935
958
  async function handleOpenFile(request) {
936
959
  try {
937
- // 打开文件:host 写信号文件,内置扩展(dshcs-open-file)在 VS Code 中打开它
960
+ // 打开文件:host 写信号文件,内置扩展(dshcs-open-file)在 VS Code 中打开它。
961
+ // 0.2.5 起客户端只在"认领到文件地址"时调用本路由(address → 绝对路径);line 可选(1 基)。
938
962
  const body = await readJsonBody(request);
939
963
  const file = typeof body.file === 'string' ? body.file : null;
940
964
  if (file === null || file === '') {
941
965
  return jsonResponse({ ok: false, error: '需要 file 字段(要打开的绝对路径)' }, 400);
942
966
  }
967
+ const line = Number.isSafeInteger(body.line) && body.line > 0 ? body.line : null;
943
968
  const root = dataRoot(cfg);
944
969
  const userDataDir = cfg.userDataDir || path.join(root, 'user-data');
945
970
  const signal = openFileSignalPath(userDataDir);
946
971
  fs.mkdirSync(path.dirname(signal), { recursive: true });
947
- fs.writeFileSync(signal, JSON.stringify({ file, ts: Date.now() }), 'utf8');
972
+ fs.writeFileSync(signal, JSON.stringify(line === null ? { file, ts: Date.now() } : { file, line, ts: Date.now() }), 'utf8');
948
973
  return jsonResponse({ ok: true, signal });
949
974
  } catch (err) {
950
975
  return failureResponse(err);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-code-server-app",
3
- "version": "0.2.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 IDE is a resident surface moved with Element.moveBefore instead of being remounted, so switching sidebar tabs no longer reloads the workbench. Requires a DSH with the right-sidebar services (sidebarRightTabs/sidebarRight, >= 0.1.5-alpha.1); older DSH versions get a single upgrade notice on the settings page and no other UI. Two serving modes: loopback port (default) or same-origin mount on DSH's own webServer (/code-server, protected by ctx.connection.requestRejection). No code-server Node layer, no argon2, no C++ toolchain.",
3
+ "version": "0.2.5",
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": {
7
7
  "type": "git",
@@ -3,7 +3,7 @@
3
3
  "vscodeVersion": "1.136.1",
4
4
  "productPath": "stable-8d5f383f301ca20681f5b6606b8207d9dc87bdd8",
5
5
  "layout": "vscode-only",
6
- "preparedAt": "2026-09-10T14:42:14.464Z",
6
+ "preparedAt": "2026-09-10T16:21:18.035Z",
7
7
  "source": "registry",
8
8
  "node": "v24.13.1",
9
9
  "platform": "win32",