dsh-code-server-app 0.3.28 → 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.
|
@@ -62,8 +62,8 @@ let askPanel = null;
|
|
|
62
62
|
let askDialogSupported = false;
|
|
63
63
|
/** 上一份对话流快照(host 只在变化时回传,这里兜住"没变化"的那些轮询)。 */
|
|
64
64
|
let lastThreadSnapshot;
|
|
65
|
-
/**
|
|
66
|
-
let lastThreadRev =
|
|
65
|
+
/** 本扩展**当前持有**的对话流修订号(随请求上报;-1 = 一份都还没有 ⇒ host 必须发). */
|
|
66
|
+
let lastThreadRev = -1;
|
|
67
67
|
/** 扩展根目录(activate 时记下;面板要按它取 webview 产物 URI)。 */
|
|
68
68
|
let extensionRoot = null;
|
|
69
69
|
/** 是否已经确认过 host 端点可达(避免把"IDE 刚起、扩展先加载"误判为断线)。 */
|
|
@@ -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) {
|
|
@@ -412,6 +416,12 @@ async function pollOnce() {
|
|
|
412
416
|
: (result.threadRev !== undefined ? lastThreadSnapshot : undefined);
|
|
413
417
|
if (result.thread !== undefined) lastThreadSnapshot = result.thread;
|
|
414
418
|
if (Number.isSafeInteger(result.threadRev)) lastThreadRev = result.threadRev;
|
|
419
|
+
// 刚开面板、手里还没有任何快照,而 host 说"没变化"(它只看到我们持有 -1)→ 等下一份,别误报
|
|
420
|
+
// "宿主没有对话流能力"(0.3.29)。
|
|
421
|
+
if (result.thread === undefined && lastThreadSnapshot === undefined) {
|
|
422
|
+
refreshAskPanel();
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
415
425
|
if (applySync(askPanel.state, { ...result, thread })) refreshAskPanel();
|
|
416
426
|
}
|
|
417
427
|
}
|
|
@@ -635,8 +645,19 @@ async function openAskPanelFor(mode) {
|
|
|
635
645
|
// 0.2.5/0.2.6 试过"浮在 DSH 页面上的对话框",但实测在编辑器侧看不到授权卡片,而面板这条路是
|
|
636
646
|
// 验证过的(0.3.22/0.3.23 实测卡片就在面板里)。功能优先:先把能看、能批授权的 UI 还给用户;
|
|
637
647
|
// 对话框那套(client 半部 + /api/code-server/ask/*)留着但**不再自动启用**。
|
|
648
|
+
// 0.3.30:把悬浮对话框还回来(用户要的形态),但只在宿主证明客户端半部在轮询时才用
|
|
649
|
+
// (askDialogSupported 现在等于 askDialogLive());否则安静退回编辑器面板 —— 两条路都能看能批授权。
|
|
638
650
|
if (askDialogSupported) {
|
|
639
|
-
|
|
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
|
+
}
|
|
640
661
|
}
|
|
641
662
|
openAskPanel(mode);
|
|
642
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.
|
|
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-
|
|
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
|
-
|
|
771
|
-
|
|
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)。
|
|
@@ -1907,10 +1944,12 @@ export async function apply(ctx, config) {
|
|
|
1907
1944
|
const snapshot = bridgeThread.supported()
|
|
1908
1945
|
? bridgeThread.snapshot(watchedSessions())
|
|
1909
1946
|
: { available: false, sessionId: null, cursor: null, rev: 0, entries: [], error: '宿主没有 sessionController.follow(DSH 版本过旧)' };
|
|
1910
|
-
//
|
|
1911
|
-
//
|
|
1912
|
-
|
|
1913
|
-
|
|
1947
|
+
// **按"客户端已经拿到哪一版"决定发不发**(0.3.29 修):0.3.28 比的是宿主自己上次发过的版本,
|
|
1948
|
+
// 于是"面板是后开的"这种情形下宿主认为没变化、什么都不发,面板手里一份快照都没有 ⇒ 旧模型把它
|
|
1949
|
+
// 当成"宿主没有对话流能力"(用户实测到的那条误报)。现在由客户端用 threadRev 声明自己持有的版本;
|
|
1950
|
+
// 不带这个字段的旧扩展一律收整份(不省流量,但绝不误报)。
|
|
1951
|
+
const peerRev = Number.isSafeInteger(body.threadRev) ? body.threadRev : null;
|
|
1952
|
+
const threadChanged = peerRev === null || peerRev !== threadRev || snapshot.available === false;
|
|
1914
1953
|
bridgeThreadRevSent = threadRev;
|
|
1915
1954
|
// 对话流走独立字段:每个会话给有界条目(见 lib/bridge-thread.mjs),
|
|
1916
1955
|
// 授权待决列表也一并回去(面板显示卡片)。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-code-server-app",
|
|
3
|
-
"version": "0.3.
|
|
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": {
|
package/vendor/VENDOR.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"vscodeVersion": "1.137.0",
|
|
4
4
|
"productPath": "stable-b11dabdaca0d3369986975be285db92c8795cea5",
|
|
5
5
|
"layout": "vscode-only",
|
|
6
|
-
"preparedAt": "2026-09-
|
|
6
|
+
"preparedAt": "2026-09-13T11:47:10.302Z",
|
|
7
7
|
"source": "registry",
|
|
8
8
|
"node": "v24.21.0",
|
|
9
9
|
"platform": "win32",
|