dsh-code-server-app 0.3.24 → 0.3.26

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.
@@ -615,19 +615,12 @@ async function openAskPanelFor(mode) {
615
615
  vscode.window.showInformationMessage('没有活动的编辑器:请先打开一个文件。');
616
616
  return;
617
617
  }
618
- // 0.2.5 起优先用 **DSH 页面里的悬浮对话框**(用户要的"对话框形式":浮在 DSH 界面上,不占编辑器版面)。
619
- // 宿主能力由 /sync 的 askDialog 字段探测;老宿主(探测不到)才退回编辑器里的 webview 面板。
618
+ // 0.3.26 回退:提问**始终**开编辑器里的 webview 面板。
619
+ // 0.2.5/0.2.6 试过"浮在 DSH 页面上的对话框",但实测在编辑器侧看不到授权卡片,而面板这条路是
620
+ // 验证过的(0.3.22/0.3.23 实测卡片就在面板里)。功能优先:先把能看、能批授权的 UI 还给用户;
621
+ // 对话框那套(client 半部 + /api/code-server/ask/*)留着但**不再自动启用**。
620
622
  if (askDialogSupported) {
621
- try {
622
- const result = await client.askOpen(mode);
623
- if (result !== null && result.ok === true) {
624
- log(`已请宿主打开对话对话框(mode=${mode}${typeof result.contextText === 'string' ? `,${result.contextText}` : ''})`);
625
- return;
626
- }
627
- log(`宿主没有打开对话框(${result !== null && result.error ? result.error : '未知原因'})→ 退回编辑器面板`);
628
- } catch (error) {
629
- log(`ask-open 失败(${error && error.message ? error.message : error}) → 退回编辑器面板`);
630
- }
623
+ log('宿主声明支持 DSH 页面对话框;本版仍用编辑器面板(0.3.26 回退,对话框待验证后再启用)');
631
624
  }
632
625
  openAskPanel(mode);
633
626
  }
@@ -2,7 +2,7 @@
2
2
  "name": "dshcs-editor-bridge",
3
3
  "displayName": "DSH Editor Bridge",
4
4
  "description": "只读地把编辑器状态(未保存缓冲区、诊断、活动选区)提供给 DSH;右键提问打开 DSH 页面里的悬浮对话对话框(0.2.5;老宿主退回编辑器面板),正文/思考/上下文都用 DSH 官方渲染器,并可就地回答授权请求。由 dsh-code-server-app 插件安装,可禁用。",
5
- "version": "0.2.5",
5
+ "version": "0.2.7",
6
6
  "publisher": "dsh-code-server-app",
7
7
  "license": "MIT",
8
8
  "private": true,
@@ -11,7 +11,7 @@
11
11
  | react | 18.3.1 | MIT |
12
12
  | react-dom | 18.3.1 | MIT |
13
13
 
14
- 生成时间:2026-09-13T09:15:47.607Z
14
+ 生成时间:2026-09-13T09:34:18.221Z
15
15
  渲染器:@deepseek-ai/dsh-client-ui-primitives@0.1.5-rc.2(DSH 部署的界面版本:0.1.5-rc.2)
16
16
  设计令牌:@deepseek-ai/dsh-client-ui-theme@0.1.5-rc.2(11 段)
17
17
  KaTeX:已打包(公式排版与 DSH 界面一致)
package/lib/index.js CHANGED
@@ -778,7 +778,19 @@ export async function apply(ctx, config) {
778
778
  * - 状态与动作的 HTTP 面(`/api/code-server/ask/*`,与 DSH 同源、吃它的 cookie/Origin 校验);
779
779
  * - 把面板产物(thread.js / thread.css)交给对话框注入(Lib 版本与 DSH 界面同版本,见 build-webview.mjs)。
780
780
  */
781
- const askDialog = { open: false, mode: 'selection', at: 0, sessionId: null };
781
+ const askDialog = { open: false, mode: 'selection', at: 0, sessionId: null, polls: 0, lastPollAt: 0 };
782
+
783
+ /**
784
+ * 对话框"活着吗" —— **能力位必须以此为准**(0.3.25)。
785
+ *
786
+ * 0.3.24 的教训:宿主无条件报 `askDialog: true`,扩展于是不再开编辑器面板;而客户端半部只要没跑起来
787
+ * (浏览器还缓存着旧 bundle / 没硬刷新),就**没有任何一方在看这个会话** ⇒ 授权悄悄落到 DSH 界面的
788
+ * 官方卡片,用户在编辑器里什么都看不到。现在只有**真的收到过 `/ask/state` 轮询**(5 秒内)才算有
789
+ * 这个能力;否则扩展退回编辑器面板 —— 那是验证过、能看能点的 UI。
790
+ */
791
+ function askDialogLive() {
792
+ return askDialog.polls > 0 && Date.now() - askDialog.lastPollAt < 5000;
793
+ }
782
794
 
783
795
  /** 缓存里的活动编辑器 → 提问上下文(mode 决定带不带行号/选区,与扩展侧 0.3.21 的语义一致)。 */
784
796
  function askContextFromCache(mode) {
@@ -1879,6 +1891,13 @@ export async function apply(ctx, config) {
1879
1891
  bridgeWatch.ids = watch.slice(0, 4);
1880
1892
  bridgeWatch.at = Date.now();
1881
1893
  bridgeThread.sync(watchedSessions());
1894
+ // 请求过对话框、客户端半部却从没来问过 → 说清楚原因(多半是浏览器还缓存着旧的客户端 bundle)。
1895
+ if (askDialog.open && !askDialogLive() && askDialog.warned !== true) {
1896
+ askDialog.warned = true;
1897
+ console.warn('[code-server] 请求了「问 DSH」对话框,但客户端半部没有轮询 /ask/state:'
1898
+ + '浏览器可能还在用旧的客户端 bundle(硬刷新 / 清 Code Cache)。'
1899
+ + '此期间提问会退回编辑器面板,授权也在面板里批。');
1900
+ }
1882
1901
  // 对话流走独立字段:每个会话给有界条目(见 lib/bridge-thread.mjs),
1883
1902
  // 授权待决列表也一并回去(面板显示卡片)。
1884
1903
  return jsonResponse({
@@ -1893,8 +1912,11 @@ export async function apply(ctx, config) {
1893
1912
  dshVersion: dshVersion(),
1894
1913
  // 界面版本:面板据此提示"内置渲染器与当前 DSH 界面版本不一致"。
1895
1914
  uiVersion: uiVersion(),
1896
- // 能力探测(0.3.24):宿主支持 DSH 页面里的悬浮对话框 ⇒ 扩展改用 ask-open 事件而不是开 webview 面板。
1897
- askDialog: true,
1915
+ // 能力探测(0.3.24;0.3.25 起以"客户端半部真的在轮询"为准):
1916
+ // 只有对话框活着的时候才让扩展走 ask-open;否则扩展开编辑器面板(那里也能批授权)。
1917
+ askDialog: askDialogLive(),
1918
+ // 诊断用:请求过对话框但客户端没响应(浏览器缓存旧 bundle?)。
1919
+ askDialogRequested: askDialog.open,
1898
1920
  });
1899
1921
  }
1900
1922
 
@@ -1966,6 +1988,12 @@ export async function apply(ctx, config) {
1966
1988
 
1967
1989
  /** 对话框每 900ms 问一次:给修订号,没变就只回一个数字(不重传几十 KB 的对话流)。 */
1968
1990
  async function handleAskState(request) {
1991
+ // 这一条就是"客户端半部活着"的证据(能力位 askDialog 以它为准,见 askDialogLive)。
1992
+ askDialog.polls += 1;
1993
+ askDialog.lastPollAt = Date.now();
1994
+ if (askDialog.polls === 1) {
1995
+ console.log('[code-server] 「问 DSH」对话框已连上客户端半部:/ask/state 开始轮询');
1996
+ }
1969
1997
  refreshDialogWatch();
1970
1998
  const current = askRevision();
1971
1999
  let rev = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-code-server-app",
3
- "version": "0.3.24",
3
+ "version": "0.3.26",
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. Since 0.3.22 the ask panel renders that session's new content with DSH's own Markdown renderer (pinned to the deployed DSH UI version); since 0.3.23 it is a full-width dialog with collapsible thinking rows and can answer approval requests in place — the bridge's only non-read-only route (POST /approve, constrained to pending in-process requests and the outcomes allowed-once/rejected; panel-first for 5 minutes, handed back to the official card the moment the panel closes). 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-13T09:15:46.539Z",
6
+ "preparedAt": "2026-09-13T09:34:17.083Z",
7
7
  "source": "registry",
8
8
  "node": "v24.21.0",
9
9
  "platform": "win32",