dsh-code-server-app 0.3.14 → 0.3.15

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
@@ -354,6 +354,36 @@ function openFileSignalPath(userDataDir) {
354
354
  return path.join(userDataDir, 'User', 'dshcs-open.json');
355
355
  }
356
356
 
357
+ /** 已安装的内置扩展里最新的文件 mtime(ms);取不到返回 null。
358
+ *
359
+ * 用途:**adopt(接管正在运行的 IDE)时判断"里面跑的是不是升级前的旧代码"**。
360
+ * 扩展代码只在扩展宿主进程启动时被加载一次 —— 文件是新的不代表跑着的进程里是新的。
361
+ * `mtime > IDE 进程启动时间` 说明这些文件是在该进程起来之后写的,那个进程不可能加载过它们。
362
+ * (可能偏保守:之后重载过窗口就没事了 —— 所以提示写成"可能/重载即可"。) */
363
+ export function newestBundledExtensionMtime(extensionsDir, options = {}) {
364
+ const treeRoot = options.treeRoot === undefined ? vsRoot() : options.treeRoot;
365
+ let newest = null;
366
+ for (const ext of BUNDLED_EXTENSIONS) {
367
+ const target = extensionTarget(extensionsDir, ext.name, ext.placement, treeRoot);
368
+ if (!fs.existsSync(target.dst)) continue;
369
+ let files;
370
+ try {
371
+ files = listExtensionFiles(target.dst);
372
+ } catch {
373
+ continue;
374
+ }
375
+ for (const rel of files) {
376
+ try {
377
+ const at = fs.statSync(path.join(target.dst, rel)).mtimeMs;
378
+ if (newest === null || at > newest) newest = at;
379
+ } catch {
380
+ // 单个文件 stat 失败不影响结论
381
+ }
382
+ }
383
+ }
384
+ return newest;
385
+ }
386
+
357
387
  /** 插件 package.json 里声明的内部依赖(纯 JS 直装集;排除 VS Code 树包本身)。 */
358
388
  function declaredInnerDeps() {
359
389
  try {
@@ -1219,10 +1249,15 @@ export async function apply(ctx, config) {
1219
1249
  // 桥的传输/协议变更(0.3.13 的 url → pipe)会让旧代码读到 v2 配置后休眠 —— 必须明说,否则
1220
1250
  // 表现又是那句无法自查的"编辑器还没有上报状态"。
1221
1251
  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
- + '否则编辑器桥不会连上');
1252
+ const newest = newestBundledExtensionMtime(extensionsDir);
1253
+ const staleCode = synced.updated.length > 0
1254
+ || (newest !== null && record.startedAt !== null && newest > record.startedAt);
1255
+ if (staleCode) {
1256
+ console.warn('[code-server] 内置扩展文件比当前 IDE 进程新'
1257
+ + `${synced.updated.length > 0 ? `(本次更新:${synced.updated.join(',')})` : ''}:`
1258
+ + '被接管的 IDE 不会重新加载扩展,里面跑的**可能仍是旧代码**。'
1259
+ + '若编辑器桥没有状态(editor_context 报"编辑器还没有上报状态"),'
1260
+ + '请在 Code Server 标签里重载一次窗口(或重启 IDE)让扩展宿主读到新代码');
1226
1261
  }
1227
1262
  adoptBridgeRuntime(record.pid, state.startedAt);
1228
1263
  return snapshot();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-code-server-app",
3
- "version": "0.3.14",
3
+ "version": "0.3.15",
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:11:48.032Z",
6
+ "preparedAt": "2026-09-13T05:15:19.676Z",
7
7
  "source": "registry",
8
8
  "node": "v24.21.0",
9
9
  "platform": "win32",