dsh-code-server-app 0.3.22 → 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 +24 -11
- package/README.md +16 -8
- package/assets/extensions/dshcs-editor-bridge/extension.js +32 -3
- package/assets/extensions/dshcs-editor-bridge/lib/ask-panel.js +18 -4
- 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 +36 -3
- package/assets/extensions/dshcs-editor-bridge/webview/src/approval.jsx +28 -20
- package/assets/extensions/dshcs-editor-bridge/webview/src/official-tokens.css +573 -7
- package/assets/extensions/dshcs-editor-bridge/webview/src/panel.css +108 -11
- package/assets/extensions/dshcs-editor-bridge/webview/src/thread.jsx +89 -10
- package/assets/extensions/dshcs-editor-bridge/webview/thread.css +1 -1
- package/assets/extensions/dshcs-editor-bridge/webview/thread.js +66 -63
- package/lib/bridge-approval.mjs +48 -14
- package/lib/bridge-session.mjs +40 -0
- package/lib/bridge-thread.mjs +80 -24
- package/lib/client.js +2 -2
- package/lib/index.js +240 -14
- package/package.json +2 -2
- 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
|
@@ -16,26 +16,33 @@
|
|
|
16
16
|
color-scheme: light dark;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
body
|
|
21
|
-
|
|
19
|
+
/* 面板根容器:
|
|
20
|
+
* - webview 形态:body 带 .dshcs-panel(见 lib/ask-panel.js 的外壳 HTML);
|
|
21
|
+
* - DSH 页面形态(0.2.5):对话框把 .dshcs-panel 放在自己的容器 div 上,
|
|
22
|
+
* 所有排版规则都挂在这个类下,**绝不碰 DSH 自己的 body**(注入样式不能改宿主界面)。
|
|
23
|
+
*/
|
|
24
|
+
.dshcs-panel {
|
|
22
25
|
height: 100%;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
body {
|
|
26
26
|
margin: 0;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
font-family: var(--vscode-font-family);
|
|
27
|
+
background: var(--vscode-editor-background, var(--dsw-alias-bg-base, #1e1e1e));
|
|
28
|
+
color: var(--vscode-foreground, var(--dsw-alias-label-primary, #ccc));
|
|
29
|
+
font-family: var(--vscode-font-family, var(--dsw-font-family, sans-serif));
|
|
31
30
|
font-size: var(--vscode-font-size, 13px);
|
|
32
31
|
overflow: hidden;
|
|
33
32
|
}
|
|
34
33
|
|
|
34
|
+
.dshcs-panel #root {
|
|
35
|
+
height: 100%;
|
|
36
|
+
}
|
|
37
|
+
|
|
35
38
|
.dshcs-app {
|
|
36
39
|
display: flex;
|
|
37
40
|
flex-direction: column;
|
|
38
41
|
height: 100%;
|
|
42
|
+
/* 对话框形状(0.2.4):面板开在编辑器区、占满工作台宽度,内容居中限宽。 */
|
|
43
|
+
width: 100%;
|
|
44
|
+
max-width: 900px;
|
|
45
|
+
margin: 0 auto;
|
|
39
46
|
}
|
|
40
47
|
|
|
41
48
|
.dshcs-header {
|
|
@@ -48,6 +55,11 @@ body {
|
|
|
48
55
|
opacity: 0.9;
|
|
49
56
|
}
|
|
50
57
|
|
|
58
|
+
.dshcs-header .dshcs-title {
|
|
59
|
+
font-weight: 600;
|
|
60
|
+
letter-spacing: 0.04em;
|
|
61
|
+
}
|
|
62
|
+
|
|
51
63
|
.dshcs-header .dshcs-where {
|
|
52
64
|
flex: 1;
|
|
53
65
|
overflow: hidden;
|
|
@@ -61,6 +73,60 @@ body {
|
|
|
61
73
|
font-size: 11px;
|
|
62
74
|
}
|
|
63
75
|
|
|
76
|
+
.dshcs-header .dshcs-close {
|
|
77
|
+
border: none;
|
|
78
|
+
background: transparent;
|
|
79
|
+
color: inherit;
|
|
80
|
+
cursor: pointer;
|
|
81
|
+
font-size: 13px;
|
|
82
|
+
line-height: 1;
|
|
83
|
+
padding: 2px 6px;
|
|
84
|
+
border-radius: 4px;
|
|
85
|
+
opacity: 0.75;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.dshcs-header .dshcs-close:hover {
|
|
89
|
+
background: var(--vscode-toolbar-hoverBackground, rgba(128, 128, 128, 0.2));
|
|
90
|
+
opacity: 1;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* ---- 思考行(默认收起;外形照抄官方 ReasoningRow 的排版语言) ---- */
|
|
94
|
+
|
|
95
|
+
.dshcs-think {
|
|
96
|
+
display: flex;
|
|
97
|
+
flex-direction: column;
|
|
98
|
+
margin: 2px 0 6px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.dshcs-think .dshcs-think-separator {
|
|
102
|
+
flex: none;
|
|
103
|
+
width: 2px;
|
|
104
|
+
height: 2px;
|
|
105
|
+
margin: 0 8px;
|
|
106
|
+
border-radius: 1px;
|
|
107
|
+
background: var(--dsw-alias-label-caption, currentColor);
|
|
108
|
+
display: inline-block;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.dshcs-think .dshcs-think-summary {
|
|
112
|
+
min-width: 0;
|
|
113
|
+
overflow: hidden;
|
|
114
|
+
flex: 1 1 auto;
|
|
115
|
+
color: var(--dsw-alias-label-tertiary, var(--vscode-descriptionForeground));
|
|
116
|
+
font-size: var(--dsh-content-font-size-secondary, 13px);
|
|
117
|
+
white-space: nowrap;
|
|
118
|
+
text-overflow: ellipsis;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.dshcs-think .dshcs-think-body {
|
|
122
|
+
padding: 4px 0 4px calc(22px + var(--dsh-content-font-delta, 0px));
|
|
123
|
+
color: var(--dsw-alias-label-tertiary, var(--vscode-descriptionForeground));
|
|
124
|
+
font-size: var(--dsh-content-font-size-secondary, 13px);
|
|
125
|
+
line-height: 1.55;
|
|
126
|
+
white-space: pre-wrap;
|
|
127
|
+
word-break: break-word;
|
|
128
|
+
}
|
|
129
|
+
|
|
64
130
|
.dshcs-warn {
|
|
65
131
|
margin: 8px 12px 0;
|
|
66
132
|
padding: 6px 8px;
|
|
@@ -94,8 +160,39 @@ body {
|
|
|
94
160
|
justify-content: flex-end;
|
|
95
161
|
}
|
|
96
162
|
|
|
97
|
-
|
|
163
|
+
/* 用户消息:注入的上下文(折叠行)+ 问题气泡,右对齐成一组。 */
|
|
164
|
+
.dshcs-user-stack {
|
|
98
165
|
max-width: 88%;
|
|
166
|
+
display: flex;
|
|
167
|
+
flex-direction: column;
|
|
168
|
+
align-items: stretch;
|
|
169
|
+
gap: 2px;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.dshcs-context .dshcs-context-summary {
|
|
173
|
+
min-width: 0;
|
|
174
|
+
overflow: hidden;
|
|
175
|
+
flex: 1 1 auto;
|
|
176
|
+
color: var(--dsw-alias-label-tertiary, var(--vscode-descriptionForeground));
|
|
177
|
+
font-size: var(--dsh-content-font-size-secondary, 13px);
|
|
178
|
+
white-space: nowrap;
|
|
179
|
+
text-overflow: ellipsis;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.dshcs-context .dshcs-context-body {
|
|
183
|
+
margin: 2px 0 4px;
|
|
184
|
+
padding: 4px 0 4px calc(22px + var(--dsh-content-font-delta, 0px));
|
|
185
|
+
color: var(--dsw-alias-label-tertiary, var(--vscode-descriptionForeground));
|
|
186
|
+
font-size: var(--dsh-content-font-size-secondary, 12px);
|
|
187
|
+
font-family: var(--ds-font-family-code, monospace);
|
|
188
|
+
line-height: 1.5;
|
|
189
|
+
white-space: pre-wrap;
|
|
190
|
+
word-break: break-word;
|
|
191
|
+
max-height: 40vh;
|
|
192
|
+
overflow: auto;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.dshcs-bubble {
|
|
99
196
|
padding: 6px 10px;
|
|
100
197
|
border-radius: 8px;
|
|
101
198
|
background: var(--vscode-input-background, rgba(128, 128, 128, 0.12));
|
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
// dshcs-editor-bridge / webview/src/thread.jsx —— 一个对话条目的渲染(0.2.3)
|
|
1
|
+
// dshcs-editor-bridge / webview/src/thread.jsx —— 一个对话条目的渲染(0.2.3 起;0.2.4 加思考行)
|
|
2
2
|
//
|
|
3
3
|
// 助手正文**不再自己排版**:直接调用 DSH 官方渲染器
|
|
4
4
|
// (`@deepseek-ai/dsh-client-ui-primitives` 的 `MarkdownText` —— 与 DSH 界面同一份代码,
|
|
5
5
|
// 同一套 mdast 管线、KaTeX、shiki 高亮、增量流式解析),面板只负责"外壳"。
|
|
6
6
|
//
|
|
7
|
+
// 思考过程(0.2.4):DSH 界面把它渲染成一行可折叠的「思考」(官方 `ReasoningRow` 用的就是
|
|
8
|
+
// `DisclosureRow` + `IconThinkOutline14`,**默认收起**,收起时显示首行 / 流式时的最新一行)。
|
|
9
|
+
// 面板用同一套官方部件重现它,差别只在文案与类名。
|
|
10
|
+
//
|
|
7
11
|
// 用户消息:DSH 界面里用户消息是纯文本气泡,这里保持一致(不渲染 markdown)。
|
|
8
|
-
// 工具 / 授权:面板只给一行紧凑摘要(
|
|
12
|
+
// 工具 / 授权:面板只给一行紧凑摘要(不做逐工具的自定义卡片)。
|
|
9
13
|
|
|
10
|
-
import { memo } from 'react';
|
|
11
|
-
import {
|
|
14
|
+
import { memo, useState } from 'react';
|
|
15
|
+
import {
|
|
16
|
+
DisclosureRow,
|
|
17
|
+
IconContextInjectionOutline16,
|
|
18
|
+
IconThinkOutline14,
|
|
19
|
+
MarkdownText,
|
|
20
|
+
} from '@deepseek-ai/dsh-client-ui-primitives';
|
|
12
21
|
|
|
13
22
|
/** 官方渲染器的界面文案(面板自己给中文;DSH 界面走它自己的 locale)。 */
|
|
14
23
|
const LABELS = { code: { copyLabel: '复制', copiedLabel: '已复制' }, footnotes: '脚注' };
|
|
@@ -25,23 +34,93 @@ const APPROVAL_STATE = {
|
|
|
25
34
|
unavailable: '无人处理',
|
|
26
35
|
};
|
|
27
36
|
|
|
37
|
+
/** 折叠摘要取首行(还在流式时取最新一行)—— 与官方 ReasoningRow 同一规则。 */
|
|
38
|
+
function summaryLine(text, running) {
|
|
39
|
+
const source = running ? text.trimEnd() : text;
|
|
40
|
+
if (source === '') return '';
|
|
41
|
+
const index = running ? source.lastIndexOf('\n') : source.indexOf('\n');
|
|
42
|
+
const line = index === -1 ? source : (running ? source.slice(index + 1) : source.slice(0, index));
|
|
43
|
+
return line.replaceAll('**', '');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 一行「思考」(默认收起,点行即展开)—— 外形与交互照抄官方 `ReasoningRow`。
|
|
48
|
+
* @param {{text: string, running: boolean}} props running = 这一轮的正文还没开始落
|
|
49
|
+
*/
|
|
50
|
+
function ThinkingRow({ text, running }) {
|
|
51
|
+
const [expanded, setExpanded] = useState(false);
|
|
52
|
+
return (
|
|
53
|
+
<div className="dshcs-think" data-state={running ? 'running' : 'ok'} data-expanded={expanded || undefined}>
|
|
54
|
+
<DisclosureRow
|
|
55
|
+
icon={<IconThinkOutline14 size={14} />}
|
|
56
|
+
title={running ? '思考中' : '思考'}
|
|
57
|
+
open={expanded}
|
|
58
|
+
expandable
|
|
59
|
+
expandOnRowClick
|
|
60
|
+
onToggle={() => setExpanded((value) => !value)}
|
|
61
|
+
collapsedContent={(
|
|
62
|
+
<>
|
|
63
|
+
<span className="dshcs-think-separator" aria-hidden />
|
|
64
|
+
<span className="dshcs-think-summary">{summaryLine(text, running)}</span>
|
|
65
|
+
</>
|
|
66
|
+
)}
|
|
67
|
+
>
|
|
68
|
+
<div className="dshcs-think-body">{text}</div>
|
|
69
|
+
</DisclosureRow>
|
|
70
|
+
</div>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 一行「注入的上下文」(默认收起):桥拼进消息的位置行 + 选区代码块。
|
|
76
|
+
*
|
|
77
|
+
* 与 DSH 界面对注入上下文的处理一致 —— 默认折叠,只留一行摘要;点开才看得到那段代码。
|
|
78
|
+
* 摘要取位置行(第一行),去掉 `From the editor: ` 前缀(标题已经说了"来自编辑器")。
|
|
79
|
+
*/
|
|
80
|
+
function ContextRow({ text }) {
|
|
81
|
+
const [expanded, setExpanded] = useState(false);
|
|
82
|
+
const firstLine = text.split('\n')[0] ?? '';
|
|
83
|
+
const summary = firstLine.replace(/^From the editor:\s*/i, '');
|
|
84
|
+
return (
|
|
85
|
+
<div className="dshcs-context" data-expanded={expanded || undefined}>
|
|
86
|
+
<DisclosureRow
|
|
87
|
+
icon={<IconContextInjectionOutline16 size={16} />}
|
|
88
|
+
title="上下文"
|
|
89
|
+
open={expanded}
|
|
90
|
+
expandable
|
|
91
|
+
expandOnRowClick
|
|
92
|
+
onToggle={() => setExpanded((value) => !value)}
|
|
93
|
+
collapsedContent={<span className="dshcs-context-summary">{summary}</span>}
|
|
94
|
+
>
|
|
95
|
+
<pre className="dshcs-context-body">{text}</pre>
|
|
96
|
+
</DisclosureRow>
|
|
97
|
+
</div>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
28
101
|
export const ThreadEntry = memo(function ThreadEntry({ entry }) {
|
|
29
102
|
if (entry.role === 'user') {
|
|
103
|
+
const context = typeof entry.context === 'string' ? entry.context : '';
|
|
30
104
|
return (
|
|
31
105
|
<div className="dshcs-msg dshcs-user">
|
|
32
|
-
<div className="dshcs-
|
|
106
|
+
<div className="dshcs-user-stack">
|
|
107
|
+
{context === '' ? null : <ContextRow text={context} />}
|
|
108
|
+
<div className="dshcs-bubble" data-status={entry.status ?? undefined}>{entry.text}</div>
|
|
109
|
+
</div>
|
|
33
110
|
</div>
|
|
34
111
|
);
|
|
35
112
|
}
|
|
36
113
|
|
|
37
114
|
if (entry.role === 'assistant') {
|
|
115
|
+
const thinking = typeof entry.thinking === 'string' ? entry.thinking : '';
|
|
116
|
+
// 正文还没到(整轮都是思考)→ 思考行标"思考中";正文到了就标"思考"(官方同一判据)。
|
|
117
|
+
const running = entry.streaming === true && entry.text === '';
|
|
38
118
|
return (
|
|
39
119
|
<div className="dshcs-msg dshcs-assistant">
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
labels={LABELS}
|
|
44
|
-
/>
|
|
120
|
+
{thinking === '' ? null : <ThinkingRow text={thinking} running={running} />}
|
|
121
|
+
{entry.text === ''
|
|
122
|
+
? null
|
|
123
|
+
: <MarkdownText text={entry.text} streaming={entry.streaming === true} labels={LABELS} />}
|
|
45
124
|
</div>
|
|
46
125
|
);
|
|
47
126
|
}
|