dsh-code-server-app 0.3.29 → 0.3.30

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.
@@ -376,6 +376,10 @@ async function pollOnce() {
376
376
  // 声明"本扩展懂对话流修订号"(0.2.9):host 才会在没变化时省略 thread 省流量。
377
377
  // 不声明(旧扩展)时 host 照旧发整份快照 —— 否则旧扩展会误报"宿主没有对话流能力"。
378
378
  threadRev: lastThreadRev,
379
+ // 声明"我这边能把授权卡片画出来"(0.3.30):面板开着 **且** 对话流正常(不是那条"宿主没有对话流能力"
380
+ // 的坏状态)。宿主只在它为 true 时才敢抢答授权 —— 否则"抢过来却没人看得见"就是用户遇到的
381
+ // "没弹出授权"(官方卡片被我们吞了,面板又不画)。
382
+ approvalsUi: askPanel !== null && askPanel.state.available === true,
379
383
  };
380
384
  const result = await client.sync(payload);
381
385
  if (result.ok !== true) {
@@ -641,8 +645,19 @@ async function openAskPanelFor(mode) {
641
645
  // 0.2.5/0.2.6 试过"浮在 DSH 页面上的对话框",但实测在编辑器侧看不到授权卡片,而面板这条路是
642
646
  // 验证过的(0.3.22/0.3.23 实测卡片就在面板里)。功能优先:先把能看、能批授权的 UI 还给用户;
643
647
  // 对话框那套(client 半部 + /api/code-server/ask/*)留着但**不再自动启用**。
648
+ // 0.3.30:把悬浮对话框还回来(用户要的形态),但只在宿主证明客户端半部在轮询时才用
649
+ // (askDialogSupported 现在等于 askDialogLive());否则安静退回编辑器面板 —— 两条路都能看能批授权。
644
650
  if (askDialogSupported) {
645
- log('宿主声明支持 DSH 页面对话框;本版仍用编辑器面板(0.3.26 回退,对话框待验证后再启用)');
651
+ try {
652
+ const result = await client.askOpen(mode);
653
+ if (result !== null && result.ok === true) {
654
+ log('已请宿主打开悬浮对话框(mode=' + mode + ')');
655
+ return;
656
+ }
657
+ log('宿主没有打开对话框(' + (result !== null && result.error ? result.error : '未知原因') + ')→ 退回编辑器面板');
658
+ } catch (error) {
659
+ log('ask-open 失败(' + (error && error.message ? error.message : error) + ') → 退回编辑器面板');
660
+ }
646
661
  }
647
662
  openAskPanel(mode);
648
663
  }
@@ -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.10",
5
+ "version": "0.2.11",
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-13T10:00:36.531Z
14
+ 生成时间:2026-09-13T11:47:11.472Z
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
@@ -752,7 +752,33 @@ export async function apply(ctx, config) {
752
752
  */
753
753
  const bridgeWatch = { ids: [], dialogIds: [], at: 0 };
754
754
  /** 上次回给扩展的对话流修订号(0.3.27:没变化就不重传整份快照)。 */
755
- let bridgeThreadRevSent = -1;
755
+ let bridgeThreadRevSent = -1;
756
+ /** 上次记录过的"有没有人在看"(0.3.30:状态翻转才写诊断日志)。 */
757
+ let bridgeWatchLogged = false;
758
+ /** 客户端(self-declared)是否能把授权卡片画出来(0.3.30)。 */
759
+ let bridgeApprovalsUi = false;
760
+ let bridgeApprovalsUiLogged = false;
761
+
762
+ /**
763
+ * 授权/看护状态的**诊断日志**(0.3.30):写到 <home>/.dsh/code-server/bridge-approval.log。
764
+ * "卡片为什么不出现"只有三个问题:有没有人在看 / 请求到没到 / 谁答的 —— 三件事都在宿主进程里,
765
+ * 用户看不到、我也读不到;落成有界文件后一次复现就能定论。
766
+ */
767
+ function bridgeDiag(message) {
768
+ try {
769
+ const dir = path.join(os.homedir(), '.dsh', 'code-server');
770
+ fs.mkdirSync(dir, { recursive: true });
771
+ const file2 = path.join(dir, 'bridge-approval.log');
772
+ try {
773
+ if (fs.statSync(file2).size > 256 * 1024) fs.writeFileSync(file2, '');
774
+ } catch {
775
+ // 首次写入:文件不存在
776
+ }
777
+ fs.appendFileSync(file2, new Date().toISOString() + ' ' + message + '\n');
778
+ } catch {
779
+ // 诊断失败绝不影响主流程
780
+ }
781
+ }
756
782
 
757
783
  /** 当前所有"在看"的会话(去重)。 */
758
784
  function watchedSessions() {
@@ -767,8 +793,14 @@ export async function apply(ctx, config) {
767
793
  const bridgeApproval = createApprovalInterceptor({
768
794
  board: bridgeApprovalBoard,
769
795
  holdMs: DEFAULT_HOLD_MS,
770
- hasPanel: hasWatcher,
771
- log: (message) => console.warn(`[code-server] 编辑器桥授权:${message}`),
796
+ // **只在客户端能画卡片时才抢答**(0.3.30):面板/对话框在看 **且** 它自己声明 approvalsUi。
797
+ // 反例(用户实测):面板处于"宿主没有对话流能力"的坏状态时我们仍然抢答 ⇒ 官方卡片不出现、
798
+ // 面板也不画 ⇒ 用户看到的是"没弹出授权",请求在宿主里干等 5 分钟。
799
+ hasPanel: () => hasWatcher() && bridgeApprovalsUi,
800
+ log: (message) => {
801
+ console.warn(`[code-server] 编辑器桥授权:${message}`);
802
+ bridgeDiag(`approval: ${message}`);
803
+ },
772
804
  });
773
805
 
774
806
  /**
@@ -1890,7 +1922,12 @@ export async function apply(ctx, config) {
1890
1922
  // 面板声明它要看哪些会话(数组;空 = 关掉了)。据此对齐订阅 + 判断"面板在不在看"
1891
1923
  // (授权拦截只在面板看着的时候才抢答,否则一律交给官方链路)。
1892
1924
  const watch = Array.isArray(body.watch) ? body.watch.filter((id) => typeof id === 'string' && id !== '') : [];
1893
- bridgeWatch.ids = watch.slice(0, 4);
1925
+ bridgeWatch.ids = watch.slice(0, 4);
1926
+ bridgeApprovalsUi = body.approvalsUi === true;
1927
+ if (bridgeApprovalsUi !== bridgeApprovalsUiLogged) {
1928
+ bridgeApprovalsUiLogged = bridgeApprovalsUi;
1929
+ bridgeDiag('approvalsUi → ' + bridgeApprovalsUi + '(客户端可否显示授权卡片)');
1930
+ }
1894
1931
  bridgeWatch.at = Date.now();
1895
1932
  bridgeThread.sync(watchedSessions());
1896
1933
  // 请求过对话框、客户端半部却从没来问过 → 说清楚原因(多半是浏览器还缓存着旧的客户端 bundle)。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-code-server-app",
3
- "version": "0.3.29",
3
+ "version": "0.3.30",
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-13T10:00:35.533Z",
6
+ "preparedAt": "2026-09-13T11:47:10.302Z",
7
7
  "source": "registry",
8
8
  "node": "v24.21.0",
9
9
  "platform": "win32",