dsh-code-server-app 0.3.23 → 0.3.24
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/README.en.md +8 -3
- package/README.md +6 -2
- package/assets/extensions/dshcs-editor-bridge/extension.js +21 -0
- package/assets/extensions/dshcs-editor-bridge/lib/ask-panel.js +6 -2
- package/assets/extensions/dshcs-editor-bridge/lib/bridge-client.js +13 -0
- package/assets/extensions/dshcs-editor-bridge/package.json +2 -2
- package/assets/extensions/dshcs-editor-bridge/webview/THIRD-PARTY.md +2 -2
- package/assets/extensions/dshcs-editor-bridge/webview/src/app.jsx +25 -2
- package/assets/extensions/dshcs-editor-bridge/webview/src/official-tokens.css +573 -7
- package/assets/extensions/dshcs-editor-bridge/webview/src/panel.css +45 -11
- package/assets/extensions/dshcs-editor-bridge/webview/src/thread.jsx +38 -2
- package/assets/extensions/dshcs-editor-bridge/webview/thread.css +1 -1
- package/assets/extensions/dshcs-editor-bridge/webview/thread.js +61 -60
- package/lib/bridge-approval.mjs +8 -0
- package/lib/bridge-session.mjs +40 -0
- package/lib/bridge-thread.mjs +33 -6
- package/lib/client.js +2 -2
- package/lib/index.js +240 -14
- package/package.json +1 -1
- package/vendor/VENDOR.json +1 -1
- package/assets/extensions/dshcs-editor-bridge/webview/fonts/KaTeX_AMS-Regular-U6PRYMIZ.woff2 +0 -0
- package/assets/extensions/dshcs-editor-bridge/webview/fonts/KaTeX_Caligraphic-Bold-5QL5CMTE.woff2 +0 -0
- package/assets/extensions/dshcs-editor-bridge/webview/fonts/KaTeX_Caligraphic-Regular-KX5MEWCF.woff2 +0 -0
- package/assets/extensions/dshcs-editor-bridge/webview/fonts/KaTeX_Fraktur-Bold-2QVFK6NQ.woff2 +0 -0
- package/assets/extensions/dshcs-editor-bridge/webview/fonts/KaTeX_Fraktur-Regular-2PEIFJSJ.woff2 +0 -0
- package/assets/extensions/dshcs-editor-bridge/webview/fonts/KaTeX_Main-Bold-YP5VVQRP.woff2 +0 -0
- package/assets/extensions/dshcs-editor-bridge/webview/fonts/KaTeX_Main-BoldItalic-N4V3DX7S.woff2 +0 -0
- package/assets/extensions/dshcs-editor-bridge/webview/fonts/KaTeX_Main-Italic-RELBIK7M.woff2 +0 -0
- package/assets/extensions/dshcs-editor-bridge/webview/fonts/KaTeX_Main-Regular-ARRPAO67.woff2 +0 -0
- package/assets/extensions/dshcs-editor-bridge/webview/fonts/KaTeX_Math-BoldItalic-K4WTGH3J.woff2 +0 -0
- package/assets/extensions/dshcs-editor-bridge/webview/fonts/KaTeX_Math-Italic-6KGCHLFN.woff2 +0 -0
- package/assets/extensions/dshcs-editor-bridge/webview/fonts/KaTeX_SansSerif-Bold-RRNVJFFW.woff2 +0 -0
- package/assets/extensions/dshcs-editor-bridge/webview/fonts/KaTeX_SansSerif-Italic-HMPFTM52.woff2 +0 -0
- package/assets/extensions/dshcs-editor-bridge/webview/fonts/KaTeX_SansSerif-Regular-XIQ62X4E.woff2 +0 -0
- package/assets/extensions/dshcs-editor-bridge/webview/fonts/KaTeX_Script-Regular-APUWIHLP.woff2 +0 -0
- package/assets/extensions/dshcs-editor-bridge/webview/fonts/KaTeX_Size1-Regular-5LRUTBFT.woff2 +0 -0
- package/assets/extensions/dshcs-editor-bridge/webview/fonts/KaTeX_Size2-Regular-LELKET5D.woff2 +0 -0
- package/assets/extensions/dshcs-editor-bridge/webview/fonts/KaTeX_Size3-Regular-WQRQ47UD.woff2 +0 -0
- package/assets/extensions/dshcs-editor-bridge/webview/fonts/KaTeX_Size4-Regular-CDMV7U5C.woff2 +0 -0
- package/assets/extensions/dshcs-editor-bridge/webview/fonts/KaTeX_Typewriter-Regular-VBYJ4NRC.woff2 +0 -0
package/README.en.md
CHANGED
|
@@ -209,13 +209,18 @@ only the editor knows, and lets editor gestures drive the current session.
|
|
|
209
209
|
|
|
210
210
|
- The tools are only registered while the bridge is live (so the model never sees an unusable tool), and the
|
|
211
211
|
system-prompt section renders only then too.
|
|
212
|
-
- **Ask panel** (extension 0.2.0; the official renderer since 0.2.3; a **dialog
|
|
213
|
-
command opens a
|
|
214
|
-
|
|
212
|
+
- **Ask panel** (extension 0.2.0; the official renderer since 0.2.3; a **floating dialog over the DSH UI since
|
|
213
|
+
0.2.5**): the context-menu command no longer opens a panel inside the editor (that is always a tab or a column,
|
|
214
|
+
never a dialog) — the plugin's client half pops up a draggable, resizable floating chat window in the DSH page
|
|
215
|
+
itself (bottom-right, ✕ closes it), leaving the editor layout alone. Hosts without that capability fall back to
|
|
216
|
+
the in-editor webview panel. The selection can still be changed while the dialog stays open.
|
|
215
217
|
The two commands **remember their intent** (0.3.21): "ask about selection" carries a **line range + selection text**
|
|
216
218
|
only when something is actually selected, while "ask about file" **never carries line numbers or a selection** — the
|
|
217
219
|
cursor line is irrelevant to the question and only misleads the agent. With no selection, the selection command also
|
|
218
220
|
degrades to the plain file.
|
|
221
|
+
- **Injected context is collapsed** (0.3.24): the location line plus the selection code block the bridge adds to the
|
|
222
|
+
message are split out into a collapsed Context row (click it to see the code), while the bubble keeps only the user's
|
|
223
|
+
own words — the same treatment the DSH UI gives injected context.
|
|
219
224
|
- **The panel renders exactly what DSH renders** (0.3.22): the panel bundles DSH's official Markdown renderer
|
|
220
225
|
(`MarkdownText` from `@deepseek-ai/dsh-client-ui-primitives`) plus the official design tokens — the same
|
|
221
226
|
micromark/mdast pipeline, the same incremental streaming parser, the same shiki highlighting (boot set:
|
package/README.md
CHANGED
|
@@ -203,11 +203,15 @@ DSH 用**资源地址**命名文件,`openFile` 只负责把地址交给右侧栏
|
|
|
203
203
|
| agent → 编辑器 | agent 改了哪个文件 → 开**原生 diff** 审阅;缓冲区有未保存改动时**告警而不覆盖** | host 观察 `tools/result`,扩展轮询后开 diff + 非模态告警 |
|
|
204
204
|
|
|
205
205
|
- 工具只在桥就绪时注册(IDE 没起来时模型看不到"有个用不了的工具");提示词段落也只在桥存活时渲染。
|
|
206
|
-
- **提问面板**(扩展 0.2.0 起;0.2.3 起正文走官方渲染器;0.2.
|
|
207
|
-
|
|
206
|
+
- **提问面板**(扩展 0.2.0 起;0.2.3 起正文走官方渲染器;0.2.5 起是**浮在 DSH 界面上的对话框**):
|
|
207
|
+
右键命令不再开编辑器里的面板(那是编辑器的一个 tab/一列,怎么开都不像对话框),而是让 DSH 页面里的
|
|
208
|
+
插件客户端弹出一个**可拖动、可缩放的浮动对话窗**(右下角,✕ 关闭),不占编辑器版面;
|
|
209
|
+
面板开着的**同时**还能改选区再问。老宿主(探测不到对话框能力)才退回编辑器里的 webview 面板。
|
|
208
210
|
两个命令的**意图分开记**(0.3.21):「针对选中内容提问」只有真的选了内容才带**行区间 + 选区正文**;
|
|
209
211
|
「针对当前文件提问」**永远不带行号、不带选区** —— 光标停在哪一行跟问题无关,行号只会误导 agent;
|
|
210
212
|
没选区时用选中命令提问也会退化成纯文件。
|
|
213
|
+
- **注入的上下文是折叠的**(0.3.24):桥拼进消息的位置行 + 选区代码块会被拆出来,显示成一行默认收起的
|
|
214
|
+
「上下文」(点开才看得到那段代码),气泡里只留你的原话 —— 与 DSH 界面处理注入上下文的方式一致。
|
|
211
215
|
- **面板里的正文就是 DSH 的渲染结果**(0.3.22):面板打包了 DSH 官方的 markdown 渲染器
|
|
212
216
|
(`@deepseek-ai/dsh-client-ui-primitives` 的 `MarkdownText`)与官方设计令牌 —— 同一套 micromark/mdast 管线、
|
|
213
217
|
同一个增量流式解析器、同一个 shiki 高亮(启动集 typescript / shellscript / json)、KaTeX 公式、同样的标题与表格排版。
|
|
@@ -58,6 +58,8 @@ let pollTimer = null;
|
|
|
58
58
|
let lastPollAt = 0;
|
|
59
59
|
/** 「问 DSH」面板:null = 没开。`{panel, state, mode}`(状态模型见 lib/ask-panel.js)。 */
|
|
60
60
|
let askPanel = null;
|
|
61
|
+
/** 宿主是否支持 DSH 页面里的悬浮对话框(0.2.5;/sync 的 askDialog 字段)。 */
|
|
62
|
+
let askDialogSupported = false;
|
|
61
63
|
/** 扩展根目录(activate 时记下;面板要按它取 webview 产物 URI)。 */
|
|
62
64
|
let extensionRoot = null;
|
|
63
65
|
/** 是否已经确认过 host 端点可达(避免把"IDE 刚起、扩展先加载"误判为断线)。 */
|
|
@@ -388,6 +390,11 @@ async function pollOnce() {
|
|
|
388
390
|
await handleEvent(event);
|
|
389
391
|
}
|
|
390
392
|
if ((result.events ?? []).length > 0) client.persist();
|
|
393
|
+
// 能力探测:宿主支持悬浮对话框(0.3.24)⇒ 右键提问不再开编辑器面板。
|
|
394
|
+
if (result.askDialog === true && !askDialogSupported) {
|
|
395
|
+
askDialogSupported = true;
|
|
396
|
+
log('宿主支持 DSH 页面里的对话对话框:右键提问将浮在 DSH 界面上(不再开编辑器面板)');
|
|
397
|
+
}
|
|
391
398
|
// 对话流 + 授权待决:host 每趟把被观看会话的**新内容**与待决授权一起回来
|
|
392
399
|
// (见 host 侧 lib/bridge-thread.mjs / lib/bridge-approval.mjs),面板有变化才重画。
|
|
393
400
|
if (askPanel !== null && applySync(askPanel.state, result)) refreshAskPanel();
|
|
@@ -608,6 +615,20 @@ async function openAskPanelFor(mode) {
|
|
|
608
615
|
vscode.window.showInformationMessage('没有活动的编辑器:请先打开一个文件。');
|
|
609
616
|
return;
|
|
610
617
|
}
|
|
618
|
+
// 0.2.5 起优先用 **DSH 页面里的悬浮对话框**(用户要的"对话框形式":浮在 DSH 界面上,不占编辑器版面)。
|
|
619
|
+
// 宿主能力由 /sync 的 askDialog 字段探测;老宿主(探测不到)才退回编辑器里的 webview 面板。
|
|
620
|
+
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
|
+
}
|
|
631
|
+
}
|
|
611
632
|
openAskPanel(mode);
|
|
612
633
|
}
|
|
613
634
|
|
|
@@ -76,6 +76,8 @@ function cleanEntry(raw) {
|
|
|
76
76
|
text,
|
|
77
77
|
// 思考过程(0.3.23):渲染成默认收起的「思考」行。
|
|
78
78
|
thinking: typeof raw.thinking === 'string' ? raw.thinking.slice(0, MAX_TEXT) : '',
|
|
79
|
+
// 注入的上下文(0.3.24):桥自己拼的位置行 + 选区代码块,渲染成默认收起的「上下文」行。
|
|
80
|
+
context: typeof raw.context === 'string' ? raw.context.slice(0, MAX_TEXT) : '',
|
|
79
81
|
streaming: raw.streaming === true,
|
|
80
82
|
name: typeof raw.name === 'string' ? raw.name : null,
|
|
81
83
|
summary: typeof raw.summary === 'string' ? raw.summary : null,
|
|
@@ -98,6 +100,7 @@ function entriesSignature(entries) {
|
|
|
98
100
|
entry.streaming ? 1 : 0,
|
|
99
101
|
entry.text.length,
|
|
100
102
|
entry.thinking.length,
|
|
103
|
+
entry.context.length,
|
|
101
104
|
entry.summary === null ? '' : entry.summary.length,
|
|
102
105
|
].join(':'));
|
|
103
106
|
}
|
|
@@ -110,6 +113,7 @@ function pendingEntries(state) {
|
|
|
110
113
|
role: 'user',
|
|
111
114
|
text: item.text,
|
|
112
115
|
thinking: '',
|
|
116
|
+
context: '',
|
|
113
117
|
streaming: false,
|
|
114
118
|
name: null,
|
|
115
119
|
summary: null,
|
|
@@ -374,9 +378,9 @@ function renderPanelHtml({ cspSource, nonce, scriptUri, styleUri }) {
|
|
|
374
378
|
<meta charset="utf-8">
|
|
375
379
|
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src ${cspSource} data:; font-src ${cspSource}; style-src ${cspSource} 'unsafe-inline'; script-src 'nonce-${nonce}';">
|
|
376
380
|
<link rel="stylesheet" href="${style}">
|
|
377
|
-
<title>DSH
|
|
381
|
+
<title>DSH 对话</title>
|
|
378
382
|
</head>
|
|
379
|
-
<body>
|
|
383
|
+
<body class="dshcs-panel">
|
|
380
384
|
<div id="root"></div>
|
|
381
385
|
<script nonce="${nonce}" src="${script}"></script>
|
|
382
386
|
</body>
|
|
@@ -290,11 +290,24 @@ function createClient(options) {
|
|
|
290
290
|
approvals: body !== null && Array.isArray(body.approvals) ? body.approvals : [],
|
|
291
291
|
approvalHoldMs: body !== null && Number.isSafeInteger(body.approvalHoldMs) ? body.approvalHoldMs : undefined,
|
|
292
292
|
uiVersion: body !== null && typeof body.uiVersion === 'string' ? body.uiVersion : undefined,
|
|
293
|
+
// 能力探测(0.3.24):宿主支持 DSH 页面里的悬浮对话框 ⇒ 提问改走 ask-open 事件(不开 webview 面板)。
|
|
294
|
+
askDialog: body !== null && body.askDialog === true,
|
|
293
295
|
};
|
|
294
296
|
} catch (error) {
|
|
295
297
|
return { ok: false, error: error.message, status: error.status, code: error.code };
|
|
296
298
|
}
|
|
297
299
|
},
|
|
300
|
+
/**
|
|
301
|
+
* 请宿主打开 DSH 页面里的「问 DSH」对话框(0.3.24)。
|
|
302
|
+
* 只上报警图(mode),上下文由宿主从它自己的编辑器状态缓存里取 —— 扩展不用重复发一份。
|
|
303
|
+
*/
|
|
304
|
+
async askOpen(mode) {
|
|
305
|
+
return request(`${BRIDGE_BASE}/event`, {
|
|
306
|
+
method: 'POST',
|
|
307
|
+
headers: { 'content-type': 'application/json' },
|
|
308
|
+
body: JSON.stringify({ kind: 'ask-open', mode: mode === 'file' ? 'file' : 'selection' }),
|
|
309
|
+
});
|
|
310
|
+
},
|
|
298
311
|
/** 把"选中内容 + 问题"投给 DSH 的当前会话。 */
|
|
299
312
|
async ask(payload) {
|
|
300
313
|
return request(`${BRIDGE_BASE}/ask`, {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dshcs-editor-bridge",
|
|
3
3
|
"displayName": "DSH Editor Bridge",
|
|
4
|
-
"description": "只读地把编辑器状态(未保存缓冲区、诊断、活动选区)提供给 DSH
|
|
5
|
-
"version": "0.2.
|
|
4
|
+
"description": "只读地把编辑器状态(未保存缓冲区、诊断、活动选区)提供给 DSH;右键提问打开 DSH 页面里的悬浮对话对话框(0.2.5;老宿主退回编辑器面板),正文/思考/上下文都用 DSH 官方渲染器,并可就地回答授权请求。由 dsh-code-server-app 插件安装,可禁用。",
|
|
5
|
+
"version": "0.2.5",
|
|
6
6
|
"publisher": "dsh-code-server-app",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"private": true,
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
| react | 18.3.1 | MIT |
|
|
12
12
|
| react-dom | 18.3.1 | MIT |
|
|
13
13
|
|
|
14
|
-
生成时间:2026-09-
|
|
14
|
+
生成时间:2026-09-13T09:15:47.607Z
|
|
15
15
|
渲染器:@deepseek-ai/dsh-client-ui-primitives@0.1.5-rc.2(DSH 部署的界面版本:0.1.5-rc.2)
|
|
16
|
-
设计令牌:@deepseek-ai/dsh-client-ui-theme@0.1.5-rc.2(
|
|
16
|
+
设计令牌:@deepseek-ai/dsh-client-ui-theme@0.1.5-rc.2(11 段)
|
|
17
17
|
KaTeX:已打包(公式排版与 DSH 界面一致)
|
|
18
18
|
shiki 语法:typescript / shellscript / json(与 DSH 启动集一致)
|
|
19
19
|
令牌自检:通过
|
|
@@ -26,6 +26,13 @@ const RENDERER_PACKAGE = typeof __DSHCS_RENDERER_PACKAGE__ === 'string' ? __DSHC
|
|
|
26
26
|
|
|
27
27
|
const vscode = acquireVsCodeApi();
|
|
28
28
|
|
|
29
|
+
/** 宿主形态(0.2.5):`'dsh'` = 跑在 DSH 页面里的浮动对话框里,否则是 VS Code webview 面板。 */
|
|
30
|
+
const HOST = typeof window.__DSHCS_HOST__ === 'string' ? window.__DSHCS_HOST__ : 'webview';
|
|
31
|
+
/** 挂载点:对话框把它的容器交进来;webview 里就是 #root。 */
|
|
32
|
+
const MOUNT = window.__DSHCS_MOUNT__ instanceof HTMLElement
|
|
33
|
+
? window.__DSHCS_MOUNT__
|
|
34
|
+
: document.getElementById('root');
|
|
35
|
+
|
|
29
36
|
/** 面板外壳的初始视图状态。 */
|
|
30
37
|
const INITIAL = panel.createViewState();
|
|
31
38
|
|
|
@@ -40,7 +47,17 @@ function App() {
|
|
|
40
47
|
const stickRef = useRef(true);
|
|
41
48
|
const boxRef = useRef(null);
|
|
42
49
|
|
|
43
|
-
//
|
|
50
|
+
// 对话框形态:壳子直接推状态(同一个 window,不走 postMessage —— DSH 页面里 postMessage 是公共广播)。
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (HOST !== 'dsh') return undefined;
|
|
53
|
+
window.__DSHCS_ASK_PUSH__ = (payload) => {
|
|
54
|
+
if (payload === null || typeof payload !== 'object') return;
|
|
55
|
+
setView((prev) => panel.applyPayload(prev, { ...payload, type: 'state' }));
|
|
56
|
+
};
|
|
57
|
+
return () => { delete window.__DSHCS_ASK_PUSH__; };
|
|
58
|
+
}, []);
|
|
59
|
+
|
|
60
|
+
// 扩展 → 面板的消息(webview 形态)。
|
|
44
61
|
useEffect(() => {
|
|
45
62
|
const onMessage = (event) => {
|
|
46
63
|
const data = event.data;
|
|
@@ -62,7 +79,9 @@ function App() {
|
|
|
62
79
|
}, []);
|
|
63
80
|
|
|
64
81
|
// 暗色主题:官方令牌表用 body[data-ds-dark-theme] 切换调色板。
|
|
82
|
+
// **只在 webview 里做**:在 DSH 页面里那个属性属于 DSH 自己,面板不能去改它(会翻掉整个界面主题)。
|
|
65
83
|
useEffect(() => {
|
|
84
|
+
if (HOST === 'dsh') return undefined;
|
|
66
85
|
const sync = () => {
|
|
67
86
|
const dark = document.body.classList.contains('vscode-dark')
|
|
68
87
|
|| document.body.classList.contains('vscode-high-contrast');
|
|
@@ -196,4 +215,8 @@ function App() {
|
|
|
196
215
|
);
|
|
197
216
|
}
|
|
198
217
|
|
|
199
|
-
|
|
218
|
+
if (MOUNT === null || MOUNT === undefined) {
|
|
219
|
+
console.error('[dshcs] 面板挂载点不存在(#root 或 window.__DSHCS_MOUNT__)');
|
|
220
|
+
} else {
|
|
221
|
+
createRoot(MOUNT).render(<App />);
|
|
222
|
+
}
|