dsh-code-server-app 0.3.30 → 0.3.32
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.
|
@@ -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.12",
|
|
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-13T12:00:07.837Z
|
|
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,32 +752,34 @@ 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;
|
|
756
|
-
/** 上次记录过的"有没有人在看"(0.3.30:状态翻转才写诊断日志)。 */
|
|
757
|
-
let bridgeWatchLogged = false;
|
|
758
|
-
/**
|
|
759
|
-
let
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
*
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
const
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
}
|
|
755
|
+
let bridgeThreadRevSent = -1;
|
|
756
|
+
/** 上次记录过的"有没有人在看"(0.3.30:状态翻转才写诊断日志)。 */
|
|
757
|
+
let bridgeWatchLogged = false;
|
|
758
|
+
/** 首帧是否已写过诊断(0.3.31:"一直没人看"也要留下证据)。 */
|
|
759
|
+
let bridgeWatchWroteFirst = false;
|
|
760
|
+
/** 客户端(self-declared)是否能把授权卡片画出来(0.3.30)。 */
|
|
761
|
+
let bridgeApprovalsUi = false;
|
|
762
|
+
let bridgeApprovalsUiLogged = false;
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* 授权/看护状态的**诊断日志**(0.3.30):写到 <home>/.dsh/code-server/bridge-approval.log。
|
|
766
|
+
* "卡片为什么不出现"只有三个问题:有没有人在看 / 请求到没到 / 谁答的 —— 三件事都在宿主进程里,
|
|
767
|
+
* 用户看不到、我也读不到;落成有界文件后一次复现就能定论。
|
|
768
|
+
*/
|
|
769
|
+
function bridgeDiag(message) {
|
|
770
|
+
try {
|
|
771
|
+
const dir = path.join(os.homedir(), '.dsh', 'code-server');
|
|
772
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
773
|
+
const file2 = path.join(dir, 'bridge-approval.log');
|
|
774
|
+
try {
|
|
775
|
+
if (fs.statSync(file2).size > 256 * 1024) fs.writeFileSync(file2, '');
|
|
776
|
+
} catch {
|
|
777
|
+
// 首次写入:文件不存在
|
|
778
|
+
}
|
|
779
|
+
fs.appendFileSync(file2, new Date().toISOString() + ' ' + message + '\n');
|
|
780
|
+
} catch {
|
|
781
|
+
// 诊断失败绝不影响主流程
|
|
782
|
+
}
|
|
781
783
|
}
|
|
782
784
|
|
|
783
785
|
/** 当前所有"在看"的会话(去重)。 */
|
|
@@ -787,19 +789,29 @@ export async function apply(ctx, config) {
|
|
|
787
789
|
}
|
|
788
790
|
/** 现在有没有人在看(授权拦截的唯一判据)。 */
|
|
789
791
|
function hasWatcher() {
|
|
790
|
-
|
|
792
|
+
const sessions = watchedSessions();
|
|
793
|
+
if (sessions.length === 0) return false;
|
|
794
|
+
// **对话框是宿主侧状态**(只在 /ask/close 时消失):不拿轮询新鲜度去判它 ——
|
|
795
|
+
// 浏览器把后台标签的定时器节流到分钟级时,900ms 的心跳一断、5 秒窗口就过期,
|
|
796
|
+
// 我们会误判"没人看"而放弃拦截(用户实测:授权卡片因此跑到 DSH 界面)。
|
|
797
|
+
if (bridgeWatch.dialogIds.length > 0) return true;
|
|
798
|
+
// 编辑器面板靠 /sync 的 600ms 心跳;窗口放宽到 60 秒(正常心跳远小于它)。
|
|
799
|
+
return Date.now() - bridgeWatch.at < 60000;
|
|
791
800
|
}
|
|
792
801
|
|
|
793
802
|
const bridgeApproval = createApprovalInterceptor({
|
|
794
803
|
board: bridgeApprovalBoard,
|
|
795
804
|
holdMs: DEFAULT_HOLD_MS,
|
|
796
|
-
// **只在客户端能画卡片时才抢答**(0.3.30):面板/对话框在看 **且** 它自己声明 approvalsUi。
|
|
797
|
-
// 反例(用户实测):面板处于"宿主没有对话流能力"的坏状态时我们仍然抢答 ⇒ 官方卡片不出现、
|
|
798
|
-
// 面板也不画 ⇒ 用户看到的是"没弹出授权",请求在宿主里干等 5 分钟。
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
805
|
+
// **只在客户端能画卡片时才抢答**(0.3.30):面板/对话框在看 **且** 它自己声明 approvalsUi。
|
|
806
|
+
// 反例(用户实测):面板处于"宿主没有对话流能力"的坏状态时我们仍然抢答 ⇒ 官方卡片不出现、
|
|
807
|
+
// 面板也不画 ⇒ 用户看到的是"没弹出授权",请求在宿主里干等 5 分钟。
|
|
808
|
+
// 客户端能画卡片 = 编辑器面板自报可以的 **或** 对话框活着(对话框跑的就是同一个面板产物,
|
|
809
|
+
// "活着"由 /ask/state 轮询证明)。0.3.31 的日志给出了反例:用户从**对话框**提问 ⇒
|
|
810
|
+
// 编辑器面板是 null ⇒ 旧判据误判成"画不出卡片",授权被让给了 DSH 界面。
|
|
811
|
+
hasPanel: () => hasWatcher() && (bridgeApprovalsUi || askDialogLive()),
|
|
812
|
+
log: (message) => {
|
|
813
|
+
console.warn(`[code-server] 编辑器桥授权:${message}`);
|
|
814
|
+
bridgeDiag(`approval: ${message}`);
|
|
803
815
|
},
|
|
804
816
|
});
|
|
805
817
|
|
|
@@ -1922,14 +1934,24 @@ export async function apply(ctx, config) {
|
|
|
1922
1934
|
// 面板声明它要看哪些会话(数组;空 = 关掉了)。据此对齐订阅 + 判断"面板在不在看"
|
|
1923
1935
|
// (授权拦截只在面板看着的时候才抢答,否则一律交给官方链路)。
|
|
1924
1936
|
const watch = Array.isArray(body.watch) ? body.watch.filter((id) => typeof id === 'string' && id !== '') : [];
|
|
1925
|
-
bridgeWatch.ids = watch.slice(0, 4);
|
|
1926
|
-
bridgeApprovalsUi = body.approvalsUi === true;
|
|
1927
|
-
if (bridgeApprovalsUi !== bridgeApprovalsUiLogged) {
|
|
1928
|
-
bridgeApprovalsUiLogged = bridgeApprovalsUi;
|
|
1929
|
-
bridgeDiag('approvalsUi → ' + bridgeApprovalsUi + '(客户端可否显示授权卡片)');
|
|
1937
|
+
bridgeWatch.ids = watch.slice(0, 4);
|
|
1938
|
+
bridgeApprovalsUi = body.approvalsUi === true;
|
|
1939
|
+
if (bridgeApprovalsUi !== bridgeApprovalsUiLogged) {
|
|
1940
|
+
bridgeApprovalsUiLogged = bridgeApprovalsUi;
|
|
1941
|
+
bridgeDiag('approvalsUi → ' + bridgeApprovalsUi + '(客户端可否显示授权卡片)');
|
|
1930
1942
|
}
|
|
1931
1943
|
bridgeWatch.at = Date.now();
|
|
1932
1944
|
bridgeThread.sync(watchedSessions());
|
|
1945
|
+
// 看护状态变化就写一行;并且**首帧必写**(0.3.31:只记"翻转"会让"一直没人看"这种情况在日志里
|
|
1946
|
+
// 完全空白,事后无从判断 —— 上一轮就是这样被拖了一整轮)。
|
|
1947
|
+
const watchingNow = hasWatcher();
|
|
1948
|
+
if (watchingNow !== bridgeWatchLogged || bridgeWatchWroteFirst !== true) {
|
|
1949
|
+
bridgeWatchLogged = watchingNow;
|
|
1950
|
+
bridgeWatchWroteFirst = true;
|
|
1951
|
+
bridgeDiag('hasWatcher → ' + watchingNow
|
|
1952
|
+
+ ' (面板=[' + bridgeWatch.ids.join(',') + '] 对话框=[' + bridgeWatch.dialogIds.join(',') + ']'
|
|
1953
|
+
+ ' approvalsUi=' + bridgeApprovalsUi + ')');
|
|
1954
|
+
}
|
|
1933
1955
|
// 请求过对话框、客户端半部却从没来问过 → 说清楚原因(多半是浏览器还缓存着旧的客户端 bundle)。
|
|
1934
1956
|
if (askDialog.open && !askDialogLive() && askDialog.warned !== true) {
|
|
1935
1957
|
askDialog.warned = true;
|
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.32",
|
|
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-13T12:00:06.604Z",
|
|
7
7
|
"source": "registry",
|
|
8
8
|
"node": "v24.21.0",
|
|
9
9
|
"platform": "win32",
|