dsh-code-server-app 0.3.13 → 0.3.14

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/lib/index.js CHANGED
@@ -276,11 +276,14 @@ export function clearObsoleteMarkers(extensionsDir, ids) {
276
276
  /** 内置扩展安装:每次启动调用 —— 缺失**或内容有变化**即同步(自愈,且插件升级后能更新已装的旧副本)。
277
277
  * 源目录里已不存在的文件会从目标里删掉(否则旧版本的 `lib/` 会一直留着)。
278
278
  * 同时清理"放错位置"的旧副本(用户级/内置两份同时存在会让 VS Code 打架),并清掉 `.obsolete` 自锁标记。
279
- * 导出供测试直接调(apply 期不装扩展,只有 start 才装);`options.treeRoot` 供测试注入假树。 */
279
+ * 导出供测试直接调(apply 期不装扩展,只有 start 才装);`options.treeRoot` 供测试注入假树。
280
+ * @returns {{updated: string[], cleared: string[]}} `updated` = 本次真的写了文件/删了文件的扩展名
281
+ * (adopt 路径据此判断"运行中的 IDE 里是旧代码");`cleared` = 本次清掉的 `.obsolete` 键。 */
280
282
  export function installBundledExtensions(extensionsDir, userDataDir, options = {}) {
281
283
  const here = path.dirname(fileURLToPath(import.meta.url));
282
284
  const treeRoot = options.treeRoot === undefined ? vsRoot() : options.treeRoot;
283
285
  const managedIds = [];
286
+ const updated = [];
284
287
  for (const ext of BUNDLED_EXTENSIONS) {
285
288
  try {
286
289
  const src = path.join(here, '..', 'assets', 'extensions', ext.name);
@@ -332,6 +335,7 @@ export function installBundledExtensions(extensionsDir, userDataDir, options = {
332
335
  }
333
336
  console.log(`[code-server] bundled extension ${ext.name} -> ${dst}${target.builtin ? ' (内置,不可卸载)' : ' (用户级,可禁用)'}`
334
337
  + `${stale.length > 0 ? ` [更新 ${stale.join(',')}]` : ''}${removed.length > 0 ? ` [清理 ${removed.join(',')}]` : ''}`);
338
+ if (stale.length > 0 || removed.length > 0) updated.push(ext.name);
335
339
  } catch (err) {
336
340
  console.warn(`[code-server] bundled extension ${ext.name} install failed:`, err && err.message ? err.message : String(err));
337
341
  }
@@ -342,6 +346,7 @@ export function installBundledExtensions(extensionsDir, userDataDir, options = {
342
346
  + '(留着的话扫描器会永远跳过这些扩展,编辑器桥就永远没有状态)');
343
347
  }
344
348
  void userDataDir;
349
+ return { updated, cleared };
345
350
  }
346
351
 
347
352
  /** 打开文件信号文件:<user-data>/User/dshcs-open.json(扩展轮询此文件)。 */
@@ -1185,6 +1190,13 @@ export async function apply(ctx, config) {
1185
1190
  console.warn('[code-server] 0.2.0 起不再支持口令认证(argon2 已移除),按 auth=none 运行');
1186
1191
  }
1187
1192
 
1193
+ // 数据目录(adopt 路径也要用:被接管的 IDE 同样需要最新的内置扩展文件)
1194
+ const root = dataRoot(cfg);
1195
+ const userDataDir = cfg.userDataDir || path.join(root, 'user-data');
1196
+ const extensionsDir = cfg.extensionsDir || path.join(root, 'extensions');
1197
+ fs.mkdirSync(userDataDir, { recursive: true });
1198
+ fs.mkdirSync(extensionsDir, { recursive: true });
1199
+
1188
1200
  // 端口占用则尝试 adopt(仅"显式指定端口"时;默认 port=0 由系统分配,不存在占用问题)。
1189
1201
  // 探针必须带路径令牌(被接管的实例是我们自己拉的,令牌在令牌文件里)——
1190
1202
  // 没有令牌文件说明那个实例不是本插件当前这代拉起来的,不接管。
@@ -1203,6 +1215,15 @@ export async function apply(ctx, config) {
1203
1215
  state.launchCwd = record.launchCwd ?? record.cwd ?? null;
1204
1216
  state.startedAt = record.startedAt ?? null;
1205
1217
  state.adopted = true;
1218
+ // 被接管的 IDE **不会**重新加载扩展:文件可以同步,但扩展宿主里跑的仍是上次启动时那份代码。
1219
+ // 桥的传输/协议变更(0.3.13 的 url → pipe)会让旧代码读到 v2 配置后休眠 —— 必须明说,否则
1220
+ // 表现又是那句无法自查的"编辑器还没有上报状态"。
1221
+ const synced = installBundledExtensions(extensionsDir, userDataDir);
1222
+ if (synced.updated.length > 0) {
1223
+ console.warn(`[code-server] 内置扩展文件已更新(${synced.updated.join(',')}),`
1224
+ + '但正在运行的 IDE 里跑的是旧代码:请在 Code Server 标签里重载一次窗口(或重启 IDE),'
1225
+ + '否则编辑器桥不会连上');
1226
+ }
1206
1227
  adoptBridgeRuntime(record.pid, state.startedAt);
1207
1228
  return snapshot();
1208
1229
  }
@@ -1212,13 +1233,6 @@ export async function apply(ctx, config) {
1212
1233
  }
1213
1234
  }
1214
1235
 
1215
- // 重建数据目录
1216
- const root = dataRoot(cfg);
1217
- const userDataDir = cfg.userDataDir || path.join(root, 'user-data');
1218
- const extensionsDir = cfg.extensionsDir || path.join(root, 'extensions');
1219
- fs.mkdirSync(userDataDir, { recursive: true });
1220
- fs.mkdirSync(extensionsDir, { recursive: true });
1221
-
1222
1236
  // 安装树内自带扩展(dshcs-open-file:host 信号文件 → VS Code 打开文件;
1223
1237
  // dshcs-editor-bridge:编辑器桥的扩展侧,0.3.0)
1224
1238
  installBundledExtensions(extensionsDir, userDataDir);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-code-server-app",
3
- "version": "0.3.13",
3
+ "version": "0.3.14",
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). Since 0.3.0 the bundle also ships an editor bridge (assets/extensions/dshcs-editor-bridge): a read-only channel between the in-tree VS Code extension host and DSH, giving the agent what only the editor knows (unsaved buffers, language-server diagnostics, the active selection) and letting editor gestures drive the session. The tab claims DSH file addresses (dsh-resource://file/**) by file type (setting claimExtensions), so the product's own produced-file chips, delivered-file previews and inline prose mentions open in the workbench. The IDE is a resident surface moved with Element.moveBefore instead of being remounted, so switching sidebar tabs no longer reloads it. Opening the tab switches the right sidebar to fullscreen by default (setting fullscreenOnOpen). Following a workspace switch is lightweight: the workbench re-navigates with the new ?folder= and the IDE process is not restarted (since 0.2.12). Requires a DSH with the right-sidebar services (sidebarRightTabs/sidebarRight, >= 0.1.5-alpha.1); older DSH versions get a single upgrade notice on the settings page and no other UI. Two serving modes: loopback port (default) or same-origin mount on DSH's own webServer (/code-server, protected by ctx.connection.requestRejection). No code-server Node layer, no argon2, no C++ toolchain.",
5
5
  "homepage": "https://github.com/jinsiyu/dsh-code-server-app",
6
6
  "repository": {
@@ -3,7 +3,7 @@
3
3
  "vscodeVersion": "1.137.0",
4
4
  "productPath": "stable-b11dabdaca0d3369986975be285db92c8795cea5",
5
5
  "layout": "vscode-only",
6
- "preparedAt": "2026-09-13T05:03:27.361Z",
6
+ "preparedAt": "2026-09-13T05:11:48.032Z",
7
7
  "source": "registry",
8
8
  "node": "v24.21.0",
9
9
  "platform": "win32",