dsh-ide-window 0.4.1 → 0.4.2
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/AGENTS.md +9 -2
- package/CHANGELOG.md +18 -0
- package/client.js +461 -88
- package/locale/en.json +17 -0
- package/locale/zh.json +17 -0
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -293,6 +293,9 @@ tail -f /tmp/dsh-ide-test/logs/dsh-ide-window.log # 自测实例
|
|
|
293
293
|
- **已回答** → 右对齐蓝气泡:header 12.5px 三级色、问题 14px 二级色、选中项 14px 一级色(上边距 4px)
|
|
294
294
|
- **未回答** → 整张卡(和对话里那张同一套度量):eyebrow 11px 三级色、标题 16px、选项行 12px 圆角 + 序号徽标 20×20(radius 4,`bg-layer-3`)+ 14px 标签 + 13px 说明;卡片本身 `bg-layer-1` + `0 0 0 0.5px border-l1` 细环 + 两层软阴影(对话那张卡没有边框);底部一行提示 + 「去对话作答」
|
|
295
295
|
- **作答只能在对话里**:宿主 `ctx.remote.userQuestions.answer` 对前台问题返回 `false`(作答权由 DSH 自己的卡片持有),所以卡片的按钮走 `goToChat()` 切回对话,不假装能在这里答
|
|
296
|
+
- **审批(`approval/asked`)也进卡片**:`role: 'approval'` 自成一卡(eyebrow「等待审批 / 审批结果」+ 工具名 + reason + 底部一行),compact 模式下**永不被隐藏**(和未作答的问题卡同一规则),`approval/decided` 按 `id` 回填到同一张卡(`allowed-once / rejected / cancelled / unavailable` → 已允许这一次 / 已拒绝 / 已取消 / 没有可用的审批人)。发生时先 `flushBatch()`,免得那张卡跑到正在等批的命令上面。
|
|
297
|
+
- **为什么不在卡里做「允许/拒绝」**:DSH 的审批请求是 `approval/request` **waterfall** 远程事件,唯一的作答者是 `dsh-client-ui-approval` 插件——它把审批卡挂在对话的输入区,返回的 promise 就是决定本身。插件再注册一个监听器要么抢先消费(对话那张卡消失,卡片一收起审批就彻底没人能答),要么根本轮不到,所以卡片只展示 + 「去对话处理」(`goToChat()`)。别改成「假装有按钮」或「自己 register 一个 handler」。
|
|
298
|
+
- 收起成球时球上点一个告警点(`iw-float-ball-dot`,`ideFloatPendingApprovals(rows) > 0`),tooltip 是「有审批在等,点开处理」。
|
|
296
299
|
- **图片点开预览**:点缩略图开卡内全屏层(`Esc` 关、`复制图片` 走 canvas→PNG)
|
|
297
300
|
- **能选中**:卡片与 `.iw-md` 要列进 `html.iw-select-code` 的白名单
|
|
298
301
|
- **中文输入法组词时按 Enter 只上屏、不发送**:keydown 里先看 `composingRef`(`compositionstart/end` 维护)、`event.isComposing`、`keyCode === 229`,再看 `compositionend` 之后 80ms 内的那次 Enter(部分输入法先发 end 再发 keydown);三条任一命中就交给输入法。**只判断 `isComposing` 不够**——踩过,用户组词按 Enter 直接把半句话发了出去
|
|
@@ -331,7 +334,10 @@ tail -f /tmp/dsh-ide-test/logs/dsh-ide-window.log # 自测实例
|
|
|
331
334
|
- ↑/↓ 选、Enter/Tab 选中、Esc 关,目录**下钻**成 `@dir/`、文件变引用 chip、技能插入 `/<名字> `。菜单绝对定位在输入框上方(`.iw-float-input` 必须是 `position: relative`)
|
|
332
335
|
- **浮层挂在触发器上**:会话列表从标题 ▾ 向下、权限与模型从各自 chip 向上。菜单曾是卡片的 flex 子节点,于是点模型菜单会跑到卡片顶部——现在 `useLayoutEffect` 按触发器与卡片的 rect 算出 `left/top` 或 `right/bottom`,再用内联样式粘上去(卡片可缩放,写死偏移会漂)。`useLayoutEffect` 要记得在 `build.mjs` 的解构里导出
|
|
333
336
|
- **输入区 = DSH 的 composer**:一个 16px 圆角容器(内边距 `10px 10px 8px 14px`),里面是无边框 textarea(占位文案同 DSH)与底行 `+(圆形)/ 权限 pill(锁+文字+⌄)/ 空隙 / 思考等级 / 模型 chip / 圆形发送键(↑,运行中变 ■)`;引用是蓝色 chip,粘贴图片走剪贴板 `image/*`(≤4 张、单张 8 MB),发送 `prompt([image…, {text: refs + 正文}])`
|
|
334
|
-
-
|
|
337
|
+
- **跟随当前会话(`floatFollow`,默认开,持久化)**:`ideFloatTargetSession(state)` 决定卡片展示哪个会话——跟随用 `state.sessionId`;关掉后用卡片自己的 `state.floatSessionId`(只本次进程有效),DSH 里怎么切都不动。卡片标题菜单里点会话:跟随时照旧 `openSession()`,不跟随时只 `store.setFloatSessionId()`(不动面板);不跟随时菜单顶部有「不跟随当前会话 · 在下面手动切换」提示。卡片里点「+ 新建会话」用 `pinnedAdoptRef` 收养新会话,避免不跟随时新建完还停在旧会话。重新打开跟随会清掉钉子
|
|
338
|
+
- **表头**:`▾` 标题 **居中、16px、最多 20 个字**(超出加省略号,悬停给完整标题 + 工作区路径),标题颜色按**工作区**取色相(`ideFloatWorkspaceHue(path)` → `--iw-float-hue`,再和正文主色 `color-mix` 混,浅色/深色都压得住对比度);右侧 `+` 与 `–`/`×` 放在绝对定位的 `.iw-float-head-right` 里,标题才会在整条表头里真正居中
|
|
339
|
+
- **滚到顶 = 翻历史**:正文滚到顶部时(`scrollTop <= 4`)调用 `binding.session.loadOlder()` 补一页(DSH 的会话窗口是分页的:首屏 ≥50 条消息、最多 500 条),同时打开 `historyMode`——**否则补进来的旧行会被「只画本轮」过滤掉,看起来像没加载**。historyMode 下 `ideFloatVisibleRows(..., history)` 铺开整个已加载窗口的对话(`step`/`reasoning`/`context`/`notice` 仍然不画)。补完把 `scrollTop` 推到「长出来的高度」,视线不跳;`rowLimit` 每次 +200(上限 2000)让补进来的行真的出现。发消息或切会话回到「本轮状态板」;没有更多历史时滚到顶只展开已加载的历史,不再请求
|
|
340
|
+
- **表头按钮**:`+` 新建、`–` 收起、`×` 关闭(模型与思考等级在输入区,别重复)
|
|
335
341
|
- **每次打开 DSH 都从「收起来」开始**:卡片存在,但只占一个 44px 圆球(`floatCollapsed` 初值 `true`,不持久化);球**由 CSS 钉在窗口右下角**(`right/bottom: 20px`,`left/top: auto`),窗口放大缩小都在原位——早先用卡片坐标算,最大化后还停在旧尺寸的位置,看着像跑到屏幕中间
|
|
336
342
|
- **窗口尺寸变化要重渲染**:`resize` 监听里 `setViewportTick` 一次,否则卡片坐标还是旧视口的夹取结果
|
|
337
343
|
- **`⌥`+空格**(`dsh-ide-window.float-toggle`,可改键):不可见→展开、球→展开、展开→收球;设置里关掉悬浮框时给一条提示而不是假装切了
|
|
@@ -350,8 +356,9 @@ tail -f /tmp/dsh-ide-test/logs/dsh-ide-window.log # 自测实例
|
|
|
350
356
|
|
|
351
357
|
- **它是设置左侧导航里的独立一页**(`settings.section`,id `dsh-ide-window`,order 70,排在「归档管理」这一层),不再塞进「通用设置」里当一行——那样既挤又得先点「查看」才能看到内容。导航标签来自 `locale` 的 `settingsNav`(代码工作区 / Code workspace),由 `label: () => translate('settingsNav')` 提供
|
|
352
358
|
- **快捷键**(8 条,全部可改,点「修改」直接按新键;「恢复默认」逐条重置);手势三条是下拉(双击 / ⌘+单击 / Ctrl+单击(仅 macOS)/ ⌥+单击,互斥)
|
|
359
|
+
- **分组**:`快捷键` → `基础设置`(字号、Maven 本地仓库)→ `悬浮助手卡`(启用、跟随当前会话、脱离代码工作区、显示详细过程、默认大小)。悬浮卡相关单独成组,别塞回「基础设置」
|
|
353
360
|
- **基础设置 → 字号**:代码字号(默认 12.5)、文件树字号(默认 14.5),10–24px 步进 0.5,行高按比例联动
|
|
354
|
-
-
|
|
361
|
+
- **悬浮助手卡**:启用开关(行标签叫「启用」,组头已经叫「悬浮助手卡」,别重复)、**跟随当前会话**(`floatFollow`,默认开、持久化;关掉后 DSH 里切会话不带动卡片,只能在卡片标题菜单里手动切;关掉那一刻把当前会话钉住)、脱离代码工作区开关、显示详细过程、默认大小(744×560)±20 步进
|
|
355
362
|
- **Maven 本地仓库**:留空=自动检测,下面一行直接显示当前在用的路径
|
|
356
363
|
- 整页样式走 `.iw-settings-section`(max-width 720px、上下留白),`IdeStyles` 由组件自己渲染(设置弹窗不在 `.iw-root` 里)
|
|
357
364
|
|
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,24 @@
|
|
|
6
6
|
升级方式:DSH →「插件」→ 打开插件的「版本」区 →「检查更新」,或直接卸载后重新安装。
|
|
7
7
|
(`link:` 本地安装不参与版本检查,拉取仓库即可。)
|
|
8
8
|
|
|
9
|
+
## [0.4.2] — 2026-11-25
|
|
10
|
+
|
|
11
|
+
### 新增
|
|
12
|
+
|
|
13
|
+
- **悬浮框里看得到审批请求**:需要你批准的命令以前只在对话里出现,卡片上什么都没有,一收起就彻底看不见。现在 `approval/asked` 会在卡片里独立成一张卡(工具名 + 原因),决定之后按 `id` 回填结果(已允许这一次 / 已拒绝 / 已取消 / 没有可用的审批人);收起成球时球上带一个橙色告警点。批准动作仍然只能在对话里做,卡片给的是「去对话处理」。
|
|
14
|
+
- **悬浮框滚到顶会加载更早的消息**:卡片原来只能看到当前这一屏历史,往上滚到头就没东西了。现在滚到顶会补一页(DSH 的会话窗口是分页的),并把整段已加载的对话铺开(工具批次、思考、系统事件仍然不显示),视线停在原处不跳;发消息或切会话回到「本轮状态板」。
|
|
15
|
+
- **悬浮框可以不再跟着对话走**:设置 →「代码工作区」里新增「跟随当前会话」(默认开)。关掉之后,在 DSH 里切换会话不会带动卡片,只能在卡片的标题菜单里手动切换;卡片里新建会话时也会跟过去。
|
|
16
|
+
- **设置页把悬浮框相关项单独成组**:`快捷键` / `基础设置`(字号、Maven 仓库)/ `悬浮助手卡`(启用、跟随当前会话、脱离工作区、显示详细过程、默认大小)。
|
|
17
|
+
|
|
18
|
+
### 改进
|
|
19
|
+
|
|
20
|
+
- **悬浮框表头更好认**:标题放大到 16px、居中、最多显示 20 个字(悬停给完整标题和路径),并按工作区取色(同一个目录永远同一颜色),一眼能分出是哪个会话。
|
|
21
|
+
- **卡片里的本地图片不再显示成裂图标**:`` 以前渲染成一个方框加替代文字,现在走 DSH 的文件路由正常显示。
|
|
22
|
+
|
|
23
|
+
### 修复
|
|
24
|
+
|
|
25
|
+
- **切到别的会话再回来,卡片上的审批卡会消失**:审批卡以前会被「只画本轮」的规则过滤掉,现在和未回答的问题卡一样,任何时候都不隐藏。
|
|
26
|
+
|
|
9
27
|
## [0.4.1] — 2026-11-25
|
|
10
28
|
|
|
11
29
|
### 修复
|
package/client.js
CHANGED
|
@@ -341,6 +341,7 @@ window.__ModuleLoader__.load({
|
|
|
341
341
|
"floatCollapse": "Collapse",
|
|
342
342
|
"floatExpand": "Expand assistant",
|
|
343
343
|
"floatEmpty": "Ask something; the answer lands in this session",
|
|
344
|
+
"floatLoadingOlder": "Loading earlier messages…",
|
|
344
345
|
"floatNoSession": "No session bound yet",
|
|
345
346
|
"floatNoWorkspace": "no workspace",
|
|
346
347
|
"floatPlaceholder": "Message or create a task, / for commands, @ for files or chats",
|
|
@@ -373,6 +374,17 @@ window.__ModuleLoader__.load({
|
|
|
373
374
|
"floatNoticeAttempt": "Attempt failed",
|
|
374
375
|
"floatNoticeRetry": "Model retry",
|
|
375
376
|
"floatNoticeApproval": "Approval requested",
|
|
377
|
+
"floatApprovalPending": "Waiting for approval",
|
|
378
|
+
"floatApprovalSettled": "Approval result",
|
|
379
|
+
"floatApprovalTitle": "A tool asks for more access",
|
|
380
|
+
"floatApprovalTool": "Tool",
|
|
381
|
+
"floatApprovalHint": "Approvals are answered in the conversation",
|
|
382
|
+
"floatApprovalGo": "Go to the conversation",
|
|
383
|
+
"floatApprovalBallHint": "An approval is waiting — click to open",
|
|
384
|
+
"floatApprovalAllowed": "Allowed once",
|
|
385
|
+
"floatApprovalRejected": "Rejected",
|
|
386
|
+
"floatApprovalCancelled": "Cancelled",
|
|
387
|
+
"floatApprovalUnavailable": "No answerer available",
|
|
376
388
|
"floatNoticeApprovalResult": "Approval result",
|
|
377
389
|
"floatNoticeApprovalPolicy": "Approval policy",
|
|
378
390
|
"floatNoticeWorkspace": "Workspace changed",
|
|
@@ -409,6 +421,7 @@ window.__ModuleLoader__.load({
|
|
|
409
421
|
"floatSessionFailed": "Switching the session failed",
|
|
410
422
|
"floatCurrentWorkspace": "current",
|
|
411
423
|
"settingsFloat": "Floating assistant",
|
|
424
|
+
"settingsFloatEnable": "Enable",
|
|
412
425
|
"settingsFloatHint": "When off, the floating card no longer opens in the code workspace",
|
|
413
426
|
"settingsOn": "On",
|
|
414
427
|
"settingsOff": "Off",
|
|
@@ -438,6 +451,10 @@ window.__ModuleLoader__.load({
|
|
|
438
451
|
"floatCloseViewer": "Close",
|
|
439
452
|
"settingsFloatDetach": "Detach from the workspace",
|
|
440
453
|
"settingsFloatDetachHint": "Keep the card on screen when you switch to another panel or back to the conversation",
|
|
454
|
+
"settingsFloatGroup": "Floating card",
|
|
455
|
+
"settingsFloatFollow": "Follow the current conversation",
|
|
456
|
+
"settingsFloatFollowHint": "When off, switching conversations in DSH leaves the card alone; switch inside the card's title menu instead",
|
|
457
|
+
"floatPinnedHint": "Not following DSH · pick a conversation below",
|
|
441
458
|
"settingsFloatEvents": "Show full detail",
|
|
442
459
|
"settingsFloatEventsHint": "List reasoning, context, Tool arguments and system events; off shows only the latest status line",
|
|
443
460
|
"floatWrap": "Wrap lines",
|
|
@@ -776,6 +793,7 @@ window.__ModuleLoader__.load({
|
|
|
776
793
|
"floatCollapse": "收起",
|
|
777
794
|
"floatExpand": "展开助手",
|
|
778
795
|
"floatEmpty": "问点什么,回答会出现在当前会话里",
|
|
796
|
+
"floatLoadingOlder": "正在加载更早的消息…",
|
|
779
797
|
"floatNoSession": "还没有绑定会话",
|
|
780
798
|
"floatNoWorkspace": "未选择工作区",
|
|
781
799
|
"floatPlaceholder": "发消息或创建任务,/ 调用指令,@ 文件或对话",
|
|
@@ -808,6 +826,17 @@ window.__ModuleLoader__.load({
|
|
|
808
826
|
"floatNoticeAttempt": "模型尝试失败",
|
|
809
827
|
"floatNoticeRetry": "模型重试",
|
|
810
828
|
"floatNoticeApproval": "审批请求",
|
|
829
|
+
"floatApprovalPending": "等待审批",
|
|
830
|
+
"floatApprovalSettled": "审批结果",
|
|
831
|
+
"floatApprovalTitle": "工具请求更高权限",
|
|
832
|
+
"floatApprovalTool": "工具",
|
|
833
|
+
"floatApprovalHint": "审批只能在对话里作答",
|
|
834
|
+
"floatApprovalGo": "去对话处理",
|
|
835
|
+
"floatApprovalBallHint": "有审批在等,点开处理",
|
|
836
|
+
"floatApprovalAllowed": "已允许这一次",
|
|
837
|
+
"floatApprovalRejected": "已拒绝",
|
|
838
|
+
"floatApprovalCancelled": "已取消",
|
|
839
|
+
"floatApprovalUnavailable": "没有可用的审批人",
|
|
811
840
|
"floatNoticeApprovalResult": "审批结果",
|
|
812
841
|
"floatNoticeApprovalPolicy": "审批策略",
|
|
813
842
|
"floatNoticeWorkspace": "文件变更",
|
|
@@ -844,6 +873,7 @@ window.__ModuleLoader__.load({
|
|
|
844
873
|
"floatSessionFailed": "切换会话失败",
|
|
845
874
|
"floatCurrentWorkspace": "当前",
|
|
846
875
|
"settingsFloat": "悬浮助手卡",
|
|
876
|
+
"settingsFloatEnable": "启用",
|
|
847
877
|
"settingsFloatHint": "关掉后进入代码工作区不再自动弹出悬浮卡",
|
|
848
878
|
"settingsOn": "已启用",
|
|
849
879
|
"settingsOff": "已关闭",
|
|
@@ -873,6 +903,10 @@ window.__ModuleLoader__.load({
|
|
|
873
903
|
"floatCloseViewer": "关闭",
|
|
874
904
|
"settingsFloatDetach": "脱离代码工作区",
|
|
875
905
|
"settingsFloatDetachHint": "开启后悬浮框不再跟着代码工作区出现与消失:切到其他插件视图或回到对话时它依然在",
|
|
906
|
+
"settingsFloatGroup": "悬浮助手卡",
|
|
907
|
+
"settingsFloatFollow": "跟随当前会话",
|
|
908
|
+
"settingsFloatFollowHint": "关闭后,在 DSH 里切换会话不会带动悬浮卡;只能在悬浮卡标题菜单里手动切换",
|
|
909
|
+
"floatPinnedHint": "不跟随当前会话 · 在下面手动切换",
|
|
876
910
|
"settingsFloatEvents": "显示详细过程",
|
|
877
911
|
"settingsFloatEventsHint": "把思考、上下文注入、工具参数与系统事件全部列出来;关闭时只显示最新一条状态",
|
|
878
912
|
"floatWrap": "自动换行",
|
|
@@ -2055,7 +2089,26 @@ html.iw-select-code .iw-code .iw-vision {
|
|
|
2055
2089
|
/* Every child measures like the card, or a 100%-wide textarea with its own
|
|
2056
2090
|
padding pokes through the right border (rounded on one side, square on the other). */
|
|
2057
2091
|
.iw-float, .iw-float *, .iw-float *::before, .iw-float *::after { box-sizing: border-box; }
|
|
2058
|
-
.iw-float-head {
|
|
2092
|
+
.iw-float-head {
|
|
2093
|
+
position: relative;
|
|
2094
|
+
display: flex;
|
|
2095
|
+
align-items: center;
|
|
2096
|
+
justify-content: center;
|
|
2097
|
+
gap: 6px;
|
|
2098
|
+
min-height: 24px;
|
|
2099
|
+
cursor: grab;
|
|
2100
|
+
user-select: none;
|
|
2101
|
+
touch-action: none;
|
|
2102
|
+
}
|
|
2103
|
+
/* 左右两簇贴边,标题才能在整个表头里居中(而不是在剩余空隙里居中)。 */
|
|
2104
|
+
.iw-float-head > .iw-float-dot { position: absolute; left: 0; }
|
|
2105
|
+
.iw-float-head-right {
|
|
2106
|
+
position: absolute;
|
|
2107
|
+
right: 0;
|
|
2108
|
+
display: flex;
|
|
2109
|
+
align-items: center;
|
|
2110
|
+
gap: 2px;
|
|
2111
|
+
}
|
|
2059
2112
|
.iw-float-head:active { cursor: grabbing; }
|
|
2060
2113
|
.iw-float-collapsed {
|
|
2061
2114
|
padding: 4px;
|
|
@@ -2595,9 +2648,11 @@ html.iw-select-code .iw-code .iw-vision {
|
|
|
2595
2648
|
.iw-float-title-btn {
|
|
2596
2649
|
display: inline-flex;
|
|
2597
2650
|
align-items: center;
|
|
2651
|
+
justify-content: center;
|
|
2598
2652
|
gap: 3px;
|
|
2599
2653
|
min-width: 0;
|
|
2600
|
-
|
|
2654
|
+
/* 20 个字左右:标题是最能区分会话的东西,别只剩半截;但要给右侧按钮组让位。 */
|
|
2655
|
+
max-width: min(calc(100% - 96px), 21em);
|
|
2601
2656
|
flex: 0 1 auto;
|
|
2602
2657
|
padding: 1px 4px;
|
|
2603
2658
|
border: 0;
|
|
@@ -2610,11 +2665,30 @@ html.iw-select-code .iw-code .iw-vision {
|
|
|
2610
2665
|
overflow: hidden;
|
|
2611
2666
|
}
|
|
2612
2667
|
/* The label truncates; the caret must never be the thing that gets clipped. */
|
|
2613
|
-
.iw-float-title
|
|
2668
|
+
/* 两个类的选择器:基础 .iw-float-title 也落在这个 span 上,靠顺序会被它压回去。 */
|
|
2669
|
+
.iw-float-title-btn .iw-float-title-text {
|
|
2614
2670
|
min-width: 0;
|
|
2671
|
+
max-width: 100%;
|
|
2672
|
+
font-size: 16px;
|
|
2673
|
+
line-height: 24px;
|
|
2674
|
+
letter-spacing: 0.1px;
|
|
2615
2675
|
overflow: hidden;
|
|
2616
2676
|
text-overflow: ellipsis;
|
|
2617
2677
|
white-space: nowrap;
|
|
2678
|
+
/* 按工作区取色(--iw-float-hue),再和正文主色混,浅色/深色都压得住对比度。 */
|
|
2679
|
+
color: color-mix(
|
|
2680
|
+
in oklab,
|
|
2681
|
+
hsl(var(--iw-float-hue, 214) 68% 52%) 72%,
|
|
2682
|
+
var(--dsw-alias-label-primary, currentColor)
|
|
2683
|
+
);
|
|
2684
|
+
}
|
|
2685
|
+
.iw-float-older {
|
|
2686
|
+
flex: 0 0 auto;
|
|
2687
|
+
padding: 2px 0 6px;
|
|
2688
|
+
text-align: center;
|
|
2689
|
+
font-size: 12.5px;
|
|
2690
|
+
line-height: 18px;
|
|
2691
|
+
color: var(--dsw-alias-label-tertiary, #81858c);
|
|
2618
2692
|
}
|
|
2619
2693
|
.iw-float-title-btn:hover { background: var(--dsw-alias-card-fill-hover, rgba(255, 255, 255, 0.08)); }
|
|
2620
2694
|
/* A model row must be clickable across its whole width, not just on the text. */
|
|
@@ -2670,7 +2744,6 @@ html.iw-select-code .iw-code .iw-vision {
|
|
|
2670
2744
|
overflow: hidden;
|
|
2671
2745
|
text-overflow: ellipsis;
|
|
2672
2746
|
white-space: nowrap;
|
|
2673
|
-
max-width: 150px;
|
|
2674
2747
|
}
|
|
2675
2748
|
.iw-float-model { font-size: 11px; color: var(--dsw-alias-label-tertiary, inherit); }
|
|
2676
2749
|
.iw-float-icon {
|
|
@@ -2776,6 +2849,27 @@ html.iw-select-code .iw-code .iw-vision {
|
|
|
2776
2849
|
.iw-float-ask-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
|
|
2777
2850
|
.iw-float-ask-hint { font-size: 12.5px; line-height: 18px; color: var(--dsw-alias-label-tertiary, #81858c); }
|
|
2778
2851
|
.iw-float-ask-go { flex: 0 0 auto; }
|
|
2852
|
+
/* 审批卡:和问答卡同一张纸,只是多一段「为什么要批」的说明。 */
|
|
2853
|
+
.iw-float-approval-done { opacity: 0.9; }
|
|
2854
|
+
/* 收起成球时,等着的审批用一个小告警点表示。 */
|
|
2855
|
+
.iw-float-ball-btn { position: relative; }
|
|
2856
|
+
.iw-float-ball-dot {
|
|
2857
|
+
position: absolute;
|
|
2858
|
+
top: 7px;
|
|
2859
|
+
right: 7px;
|
|
2860
|
+
width: 9px;
|
|
2861
|
+
height: 9px;
|
|
2862
|
+
border-radius: 50%;
|
|
2863
|
+
background: var(--dsw-alias-state-warn-primary, #d97706);
|
|
2864
|
+
box-shadow: 0 0 0 2px var(--dsw-alias-bg-layer-1, #ffffff);
|
|
2865
|
+
}
|
|
2866
|
+
.iw-float-approval-reason {
|
|
2867
|
+
font-size: 13px;
|
|
2868
|
+
line-height: 20px;
|
|
2869
|
+
color: var(--dsw-alias-label-secondary, #61666b);
|
|
2870
|
+
white-space: pre-wrap;
|
|
2871
|
+
overflow-wrap: anywhere;
|
|
2872
|
+
}
|
|
2779
2873
|
/* The问答 card, borrowed from the conversation: the bubble is the user's own,
|
|
2780
2874
|
header and question in the secondary colour, the picked answer in primary. */
|
|
2781
2875
|
.iw-float-question { display: flex; flex-direction: column; }
|
|
@@ -5034,6 +5128,10 @@ function ideCreateStore(refs) {
|
|
|
5034
5128
|
floatEvents: prefs.floatEvents === true,
|
|
5035
5129
|
// Detached cards stay on screen in every panel, not only the workspace.
|
|
5036
5130
|
floatDetached: prefs.floatDetached === true,
|
|
5131
|
+
// 跟随当前会话(默认):关掉后,DSH 里切会话不再带动卡片,只能在卡片里手动切。
|
|
5132
|
+
floatFollow: prefs.floatFollow !== false,
|
|
5133
|
+
// 不跟随时卡片自己钉住的会话(只本次进程有效,重启回到当前会话)。
|
|
5134
|
+
floatSessionId: null,
|
|
5037
5135
|
floatClosed: false,
|
|
5038
5136
|
// One reference waiting to be appended to the card's draft.
|
|
5039
5137
|
floatInsert: null,
|
|
@@ -5538,6 +5636,25 @@ function ideCreateStore(refs) {
|
|
|
5538
5636
|
if (next) patch({ floatOpen: true, floatClosed: false })
|
|
5539
5637
|
}
|
|
5540
5638
|
|
|
5639
|
+
/**
|
|
5640
|
+
* 悬浮卡要不要跟着当前会话走(持久化,默认跟)。
|
|
5641
|
+
* 关掉的瞬间把当前会话钉住,否则「当前会话」一变它又跟着跑了。
|
|
5642
|
+
*/
|
|
5643
|
+
function setFloatFollow(floatFollow) {
|
|
5644
|
+
const next = floatFollow !== false
|
|
5645
|
+
if (state.floatFollow === next) return
|
|
5646
|
+
ideWritePrefs({ floatFollow: next })
|
|
5647
|
+
// 关掉时把当前会话钉住;重新打开跟随就把钉子清掉,避免下次关掉时用旧值。
|
|
5648
|
+
patch(next ? { floatFollow: true, floatSessionId: null } : { floatFollow: false, floatSessionId: state.sessionId })
|
|
5649
|
+
}
|
|
5650
|
+
|
|
5651
|
+
/** 不跟随时,卡片自己选中的会话(`null` = 还没有手动选过)。 */
|
|
5652
|
+
function setFloatSessionId(floatSessionId) {
|
|
5653
|
+
const next = typeof floatSessionId === 'string' && floatSessionId !== '' ? floatSessionId : null
|
|
5654
|
+
if (state.floatSessionId === next) return
|
|
5655
|
+
patch({ floatSessionId: next })
|
|
5656
|
+
}
|
|
5657
|
+
|
|
5541
5658
|
/** Turn the floating card on or off (persisted). */
|
|
5542
5659
|
function setFloatEvents(floatEvents) {
|
|
5543
5660
|
const next = floatEvents === true
|
|
@@ -6242,6 +6359,8 @@ function ideCreateStore(refs) {
|
|
|
6242
6359
|
setFloatSize,
|
|
6243
6360
|
setFloatDefaultSize,
|
|
6244
6361
|
setFloatEnabled,
|
|
6362
|
+
setFloatFollow,
|
|
6363
|
+
setFloatSessionId,
|
|
6245
6364
|
setFloatEvents,
|
|
6246
6365
|
setFloatDetached,
|
|
6247
6366
|
setFloatClosed,
|
|
@@ -9825,9 +9944,45 @@ function IdeWorkspaceSettingsSection(props) {
|
|
|
9825
9944
|
])
|
|
9826
9945
|
: null,
|
|
9827
9946
|
h('div', { key: 'basic', className: 'iw-settings-group' }, tr('settingsBasic')),
|
|
9947
|
+
h('div', { key: 'font', className: 'iw-settings-item' }, [
|
|
9948
|
+
h('span', { key: 'l', className: 'iw-settings-item-label' }, tr('settingsFont')),
|
|
9949
|
+
h('button', {
|
|
9950
|
+
key: 'b',
|
|
9951
|
+
type: 'button',
|
|
9952
|
+
className: 'iw-gesture-chip',
|
|
9953
|
+
onClick: () => setFontsOpen(!fontsOpen),
|
|
9954
|
+
}, fontsOpen ? tr('settingsCollapse') : `${codeSize} / ${treeSize} px`),
|
|
9955
|
+
]),
|
|
9956
|
+
fontsOpen
|
|
9957
|
+
? h('div', { key: 'fontbody', className: 'iw-settings-body' }, [
|
|
9958
|
+
stepper('code', tr('settingsCodeFont'), codeSize, (next) => store.setCodeFontSize(next)),
|
|
9959
|
+
stepper('tree', tr('settingsTreeFont'), treeSize, (next) => store.setTreeFontSize(next)),
|
|
9960
|
+
])
|
|
9961
|
+
: null,
|
|
9962
|
+
h('div', { key: 'maven', className: 'iw-settings-maven' }, [
|
|
9963
|
+
h('div', { key: 'row', className: 'iw-settings-maven-row' }, [
|
|
9964
|
+
h('span', { key: 'l', className: 'iw-settings-item-label' }, tr('settingsMavenRepo')),
|
|
9965
|
+
h('input', {
|
|
9966
|
+
key: 'i',
|
|
9967
|
+
className: 'iw-settings-input',
|
|
9968
|
+
type: 'text',
|
|
9969
|
+
spellCheck: false,
|
|
9970
|
+
defaultValue: state.mavenRepo,
|
|
9971
|
+
placeholder: tr('settingsMavenRepoAuto'),
|
|
9972
|
+
title: tr('settingsMavenRepoHint'),
|
|
9973
|
+
onKeyDown: (event) => {
|
|
9974
|
+
if (event.key === 'Enter') event.currentTarget.blur()
|
|
9975
|
+
},
|
|
9976
|
+
onBlur: (event) => store.setMavenRepo(event.target.value),
|
|
9977
|
+
}),
|
|
9978
|
+
]),
|
|
9979
|
+
mavenRowHint(tr, state),
|
|
9980
|
+
]),
|
|
9981
|
+
// 悬浮卡自己的那一组:启用、跟随、脱离、详细过程、默认大小,跟其它设置分开。
|
|
9982
|
+
h('div', { key: 'floatgroup', className: 'iw-settings-group' }, tr('settingsFloatGroup')),
|
|
9828
9983
|
// The floating card is on by default; this is where it is turned off.
|
|
9829
9984
|
h('div', { key: 'float', className: 'iw-settings-item' }, [
|
|
9830
|
-
h('span', { key: 'l', className: 'iw-settings-item-label' }, tr('
|
|
9985
|
+
h('span', { key: 'l', className: 'iw-settings-item-label' }, tr('settingsFloatEnable')),
|
|
9831
9986
|
h('button', {
|
|
9832
9987
|
key: 'b',
|
|
9833
9988
|
type: 'button',
|
|
@@ -9836,6 +9991,17 @@ function IdeWorkspaceSettingsSection(props) {
|
|
|
9836
9991
|
onClick: () => store.setFloatEnabled(state.floatEnabled === false),
|
|
9837
9992
|
}, state.floatEnabled !== false ? tr('settingsOn') : tr('settingsOff')),
|
|
9838
9993
|
]),
|
|
9994
|
+
// 默认跟随当前会话;关掉后 DSH 里切会话不带动卡片,只能在卡片里切。
|
|
9995
|
+
h('div', { key: 'floatfollow', className: 'iw-settings-item' }, [
|
|
9996
|
+
h('span', { key: 'l', className: 'iw-settings-item-label' }, tr('settingsFloatFollow')),
|
|
9997
|
+
h('button', {
|
|
9998
|
+
key: 'b',
|
|
9999
|
+
type: 'button',
|
|
10000
|
+
className: `iw-gesture-chip${state.floatFollow !== false ? ' on' : ''}`,
|
|
10001
|
+
title: tr('settingsFloatFollowHint'),
|
|
10002
|
+
onClick: () => store.setFloatFollow(state.floatFollow === false),
|
|
10003
|
+
}, state.floatFollow !== false ? tr('settingsOn') : tr('settingsOff')),
|
|
10004
|
+
]),
|
|
9839
10005
|
// A card that lives on its own stays visible in other panels too.
|
|
9840
10006
|
h('div', { key: 'floatdetach', className: 'iw-settings-item' }, [
|
|
9841
10007
|
h('span', { key: 'l', className: 'iw-settings-item-label' }, tr('settingsFloatDetach')),
|
|
@@ -9881,42 +10047,8 @@ function IdeWorkspaceSettingsSection(props) {
|
|
|
9881
10047
|
(next) => store.setFloatDefaultSize(floatWidth, next)),
|
|
9882
10048
|
])
|
|
9883
10049
|
: null,
|
|
9884
|
-
h('div', { key: 'font', className: 'iw-settings-item' }, [
|
|
9885
|
-
h('span', { key: 'l', className: 'iw-settings-item-label' }, tr('settingsFont')),
|
|
9886
|
-
h('button', {
|
|
9887
|
-
key: 'b',
|
|
9888
|
-
type: 'button',
|
|
9889
|
-
className: 'iw-gesture-chip',
|
|
9890
|
-
onClick: () => setFontsOpen(!fontsOpen),
|
|
9891
|
-
}, fontsOpen ? tr('settingsCollapse') : `${codeSize} / ${treeSize} px`),
|
|
9892
|
-
]),
|
|
9893
|
-
fontsOpen
|
|
9894
|
-
? h('div', { key: 'fontbody', className: 'iw-settings-body' }, [
|
|
9895
|
-
stepper('code', tr('settingsCodeFont'), codeSize, (next) => store.setCodeFontSize(next)),
|
|
9896
|
-
stepper('tree', tr('settingsTreeFont'), treeSize, (next) => store.setTreeFontSize(next)),
|
|
9897
|
-
])
|
|
9898
|
-
: null,
|
|
9899
10050
|
// Dependency sources come from a Maven repository; the Host detects the
|
|
9900
10051
|
// usual places, and this field covers repositories kept anywhere else.
|
|
9901
|
-
h('div', { key: 'maven', className: 'iw-settings-maven' }, [
|
|
9902
|
-
h('div', { key: 'row', className: 'iw-settings-maven-row' }, [
|
|
9903
|
-
h('span', { key: 'l', className: 'iw-settings-item-label' }, tr('settingsMavenRepo')),
|
|
9904
|
-
h('input', {
|
|
9905
|
-
key: 'i',
|
|
9906
|
-
className: 'iw-settings-input',
|
|
9907
|
-
type: 'text',
|
|
9908
|
-
spellCheck: false,
|
|
9909
|
-
defaultValue: state.mavenRepo,
|
|
9910
|
-
placeholder: tr('settingsMavenRepoAuto'),
|
|
9911
|
-
title: tr('settingsMavenRepoHint'),
|
|
9912
|
-
onKeyDown: (event) => {
|
|
9913
|
-
if (event.key === 'Enter') event.currentTarget.blur()
|
|
9914
|
-
},
|
|
9915
|
-
onBlur: (event) => store.setMavenRepo(event.target.value),
|
|
9916
|
-
}),
|
|
9917
|
-
]),
|
|
9918
|
-
mavenRowHint(tr, state),
|
|
9919
|
-
]),
|
|
9920
10052
|
]),
|
|
9921
10053
|
])
|
|
9922
10054
|
}
|
|
@@ -14104,6 +14236,8 @@ async function ideDataWindowOpenMapper(store, tr, root, path, symbol, line) {
|
|
|
14104
14236
|
// everything but the last few rows off a long turn; the card scrolls, so the
|
|
14105
14237
|
// whole tail of the log is worth keeping.
|
|
14106
14238
|
const IDE_FLOAT_MESSAGES = 200
|
|
14239
|
+
/** 表头标题最多显示多少个字(超出加省略号)。 */
|
|
14240
|
+
const IDE_FLOAT_TITLE_CHARS = 20
|
|
14107
14241
|
/** Longest text a folded row shows once opened; longer payloads are clipped. */
|
|
14108
14242
|
const IDE_FLOAT_DETAIL_MAX = 6000
|
|
14109
14243
|
/** How long after `compositionend` an Enter still counts as "confirm the IME". */
|
|
@@ -14243,6 +14377,59 @@ function ideFloatCallsDetail(calls) {
|
|
|
14243
14377
|
}).join('\n\n')
|
|
14244
14378
|
}
|
|
14245
14379
|
|
|
14380
|
+
/** 还没决定的审批数量:折叠成球时靠它在球上点一个告警点。 */
|
|
14381
|
+
function ideFloatPendingApprovals(rows) {
|
|
14382
|
+
return Array.isArray(rows) ? rows.filter((row) => row?.role === 'approval' && row.pending === true).length : 0
|
|
14383
|
+
}
|
|
14384
|
+
|
|
14385
|
+
/**
|
|
14386
|
+
* 卡片当前展示哪个会话。
|
|
14387
|
+
*
|
|
14388
|
+
* 默认跟随面板(`state.sessionId`);设置里关掉「跟随当前会话」后,卡片只认自己
|
|
14389
|
+
* 钉住的那个 `state.floatSessionId`,DSH 里怎么切都不动。
|
|
14390
|
+
*/
|
|
14391
|
+
function ideFloatTargetSession(state) {
|
|
14392
|
+
const panel = typeof state?.sessionId === 'string' ? state.sessionId : ''
|
|
14393
|
+
if (state?.floatFollow !== false) return panel
|
|
14394
|
+
const pinned = typeof state?.floatSessionId === 'string' ? state.floatSessionId : ''
|
|
14395
|
+
return pinned !== '' ? pinned : panel
|
|
14396
|
+
}
|
|
14397
|
+
|
|
14398
|
+
/** 表头标题最多 `limit` 个字,超出用省略号——再长就分不清是哪个会话了。 */
|
|
14399
|
+
function ideFloatTitleText(text, limit = IDE_FLOAT_TITLE_CHARS) {
|
|
14400
|
+
const value = String(text ?? '').trim()
|
|
14401
|
+
const chars = [...value]
|
|
14402
|
+
if (chars.length <= limit) return value
|
|
14403
|
+
return `${chars.slice(0, limit).join('')}…`
|
|
14404
|
+
}
|
|
14405
|
+
|
|
14406
|
+
/**
|
|
14407
|
+
* 一个工作区固定一个色相:同一个目录永远是同一个颜色,不同工作区尽量分开。
|
|
14408
|
+
* 只给表头标题上色,且和正文主色混合,浅色/深色主题下都保持可读。
|
|
14409
|
+
*/
|
|
14410
|
+
function ideFloatWorkspaceHue(path) {
|
|
14411
|
+
const text = String(path ?? '').trim()
|
|
14412
|
+
if (text === '') return 214
|
|
14413
|
+
let hash = 0
|
|
14414
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
14415
|
+
hash = (hash * 33 + text.charCodeAt(index)) % 360
|
|
14416
|
+
}
|
|
14417
|
+
return hash
|
|
14418
|
+
}
|
|
14419
|
+
|
|
14420
|
+
/** 审批结果的一句话说法;后续版本出现新结果时原样显示,不吞掉。 */
|
|
14421
|
+
function ideFloatApprovalOutcome(outcome, tr) {
|
|
14422
|
+
const value = String(outcome ?? '')
|
|
14423
|
+
const labels = {
|
|
14424
|
+
'allowed-once': 'floatApprovalAllowed',
|
|
14425
|
+
rejected: 'floatApprovalRejected',
|
|
14426
|
+
cancelled: 'floatApprovalCancelled',
|
|
14427
|
+
unavailable: 'floatApprovalUnavailable',
|
|
14428
|
+
}
|
|
14429
|
+
const key = labels[value]
|
|
14430
|
+
return key === undefined ? `${tr('floatApprovalSettled')} · ${value}`.trim() : tr(key)
|
|
14431
|
+
}
|
|
14432
|
+
|
|
14246
14433
|
function ideFloatRow(row, tr, io) {
|
|
14247
14434
|
const { setViewing, store, pictures } = io
|
|
14248
14435
|
// Compact (the default) is about WHICH rows show, not about cutting the text:
|
|
@@ -14301,6 +14488,35 @@ function ideFloatRow(row, tr, io) {
|
|
|
14301
14488
|
// Questions cannot be answered here: DSH only accepts the answer in the
|
|
14302
14489
|
// Conversation, so the card's button navigates there instead.
|
|
14303
14490
|
const goToChat = typeof io.goToChat === 'function' ? io.goToChat : () => {}
|
|
14491
|
+
// 审批也一样:`approval/request` 是 waterfall 事件,唯一的作答入口是 DSH 自己的
|
|
14492
|
+
// 审批插件(它把审批卡挂在对话的输入区)。插件再抢这份事件会把对话那张卡顶掉,
|
|
14493
|
+
// 一旦卡片被收起,审批就彻底没人能答。所以这里只展示 + 把人送回对话。
|
|
14494
|
+
if (row.role === 'approval') {
|
|
14495
|
+
const settled = row.pending !== true
|
|
14496
|
+
return h('div', { key: row.key, className: 'iw-float-row' }, [
|
|
14497
|
+
h('div', { key: 'card', className: `iw-float-ask iw-float-approval${settled ? ' iw-float-approval-done' : ''}` }, [
|
|
14498
|
+
h('div', { key: 'head', className: 'iw-float-ask-head' }, [
|
|
14499
|
+
h('div', { key: 'e', className: 'iw-float-ask-eyebrow' },
|
|
14500
|
+
settled ? tr('floatApprovalSettled') : tr('floatApprovalPending')),
|
|
14501
|
+
h('div', { key: 't', className: 'iw-float-ask-title' },
|
|
14502
|
+
row.tool === '' ? tr('floatApprovalTitle') : `${tr('floatApprovalTool')} · ${row.tool}`),
|
|
14503
|
+
]),
|
|
14504
|
+
row.reason === '' ? null : h('div', { key: 'r', className: 'iw-float-approval-reason' }, row.reason),
|
|
14505
|
+
h('div', { key: 'foot', className: 'iw-float-ask-foot' }, [
|
|
14506
|
+
h('span', { key: 'hint', className: 'iw-float-ask-hint' },
|
|
14507
|
+
settled ? ideFloatApprovalOutcome(row.outcome, tr) : tr('floatApprovalHint')),
|
|
14508
|
+
settled
|
|
14509
|
+
? null
|
|
14510
|
+
: h('button', {
|
|
14511
|
+
key: 'go',
|
|
14512
|
+
type: 'button',
|
|
14513
|
+
className: 'iw-btn primary iw-float-ask-go',
|
|
14514
|
+
onClick: () => { goToChat() },
|
|
14515
|
+
}, tr('floatApprovalGo')),
|
|
14516
|
+
]),
|
|
14517
|
+
]),
|
|
14518
|
+
])
|
|
14519
|
+
}
|
|
14304
14520
|
if (row.role === 'files') {
|
|
14305
14521
|
return h('div', { key: row.key, className: 'iw-float-row iw-float-files' }, [
|
|
14306
14522
|
h('span', { key: 'who', className: 'iw-float-who' }, tr('floatFiles')),
|
|
@@ -14566,10 +14782,6 @@ function ideFloatNotice(event) {
|
|
|
14566
14782
|
labelKey: 'floatNoticeRetry',
|
|
14567
14783
|
text: ideFloatDetail(`第 ${data.retry ?? '?'} / ${data.maxRetries ?? '?'} 次\n${data.failure?.code ?? ''} ${data.failure?.message ?? ''}`.trim()),
|
|
14568
14784
|
}
|
|
14569
|
-
case 'approval/asked':
|
|
14570
|
-
return { labelKey: 'floatNoticeApproval', text: ideFloatDetail(`${data.toolName ?? ''}\n${data.reason ?? ''}`.trim()) }
|
|
14571
|
-
case 'approval/decided':
|
|
14572
|
-
return { labelKey: 'floatNoticeApprovalResult', text: String(data.outcome ?? '') }
|
|
14573
14785
|
case 'approval/policy':
|
|
14574
14786
|
return { labelKey: 'floatNoticeApprovalPolicy', text: String(data.policy ?? '') }
|
|
14575
14787
|
case 'workspace/changes':
|
|
@@ -14722,6 +14934,33 @@ function ideFloatTranscript(entries, limit = IDE_FLOAT_MESSAGES) {
|
|
|
14722
14934
|
}
|
|
14723
14935
|
continue
|
|
14724
14936
|
}
|
|
14937
|
+
// 审批请求自成一卡:它发生在某个工具调用「等批」期间,先把这一批收口,
|
|
14938
|
+
// 免得「等待审批」跑到那条命令上面去。
|
|
14939
|
+
if (event.type === 'approval/asked') {
|
|
14940
|
+
flushBatch()
|
|
14941
|
+
rows.push({
|
|
14942
|
+
key: `ap${event.seq}`,
|
|
14943
|
+
role: 'approval',
|
|
14944
|
+
text: '',
|
|
14945
|
+
images: [],
|
|
14946
|
+
tool: String(event.data?.toolName ?? ''),
|
|
14947
|
+
reason: String(event.data?.reason ?? ''),
|
|
14948
|
+
approvalId: String(event.data?.id ?? ''),
|
|
14949
|
+
pending: true,
|
|
14950
|
+
time: Number(event.time ?? 0),
|
|
14951
|
+
seq: event.seq,
|
|
14952
|
+
})
|
|
14953
|
+
continue
|
|
14954
|
+
}
|
|
14955
|
+
if (event.type === 'approval/decided') {
|
|
14956
|
+
const approvalId = String(event.data?.id ?? '')
|
|
14957
|
+
const settled = rows.find((row) => row.role === 'approval' && row.approvalId === approvalId)
|
|
14958
|
+
if (settled !== undefined) {
|
|
14959
|
+
settled.pending = false
|
|
14960
|
+
settled.outcome = String(event.data?.outcome ?? '')
|
|
14961
|
+
}
|
|
14962
|
+
continue
|
|
14963
|
+
}
|
|
14725
14964
|
// The conversation's own question card: `ask_user_question` is a tool call,
|
|
14726
14965
|
// and its answer comes back as the tool result with matching ids.
|
|
14727
14966
|
if (event.type === 'tool/call' && event.data?.name === 'ask_user_question') {
|
|
@@ -14780,10 +15019,18 @@ function ideFloatTranscript(entries, limit = IDE_FLOAT_MESSAGES) {
|
|
|
14780
15019
|
* scrolls away, once where it stays. Finished batches stay in the transcript,
|
|
14781
15020
|
* folded, because they are part of the record.
|
|
14782
15021
|
*/
|
|
14783
|
-
function ideFloatVisibleRows(rows, running, detail) {
|
|
15022
|
+
function ideFloatVisibleRows(rows, running, detail, history) {
|
|
14784
15023
|
if (!Array.isArray(rows)) return []
|
|
14785
|
-
//
|
|
15024
|
+
// 还没作答的问题卡片、还没决定的审批不管在哪个位置都要露出来,否则用户永远
|
|
15025
|
+
// 看不到「要你选 / 要你批」。
|
|
14786
15026
|
const pendingQuestion = (row) => row?.role === 'question' && !(Array.isArray(row?.answers) && row.answers.length > 0)
|
|
15027
|
+
const pendingApproval = (row) => row?.role === 'approval' && row.pending === true
|
|
15028
|
+
// 用户主动往回翻(滚到顶):把整个已加载窗口里的对话铺开,否则补进来的历史会
|
|
15029
|
+
// 被「只画本轮」过滤掉,看起来像什么都没加载。过程行(工具批次/思考/上下文/
|
|
15030
|
+
// notice)仍然不画——那是对话的事。
|
|
15031
|
+
if (detail !== true && history === true) {
|
|
15032
|
+
return rows.filter((row) => row?.role !== 'step' && row?.role !== 'reasoning' && row?.role !== 'context' && row?.role !== 'notice')
|
|
15033
|
+
}
|
|
14787
15034
|
if (detail !== true) {
|
|
14788
15035
|
// The card is a status board for the current turn: what you last said, then
|
|
14789
15036
|
// every line the agent printed after it. An agent narrates between Tool calls
|
|
@@ -14813,14 +15060,14 @@ function ideFloatVisibleRows(rows, running, detail) {
|
|
|
14813
15060
|
}
|
|
14814
15061
|
}
|
|
14815
15062
|
rows.forEach((row, index) => {
|
|
14816
|
-
if (pendingQuestion(row)) keep.add(index)
|
|
15063
|
+
if (pendingQuestion(row) || pendingApproval(row)) keep.add(index)
|
|
14817
15064
|
})
|
|
14818
15065
|
return [...keep].sort((left, right) => left - right).map((index) => rows[index])
|
|
14819
15066
|
}
|
|
14820
15067
|
const keep = new Set([lastUser])
|
|
14821
15068
|
rows.forEach((row, index) => {
|
|
14822
|
-
if (index > lastUser && (row?.role === 'assistant' || row?.role === 'files' || pendingQuestion(row))) keep.add(index)
|
|
14823
|
-
else if (index < lastUser && pendingQuestion(row)) keep.add(index)
|
|
15069
|
+
if (index > lastUser && (row?.role === 'assistant' || row?.role === 'files' || row?.role === 'approval' || pendingQuestion(row))) keep.add(index)
|
|
15070
|
+
else if (index < lastUser && (pendingQuestion(row) || pendingApproval(row))) keep.add(index)
|
|
14824
15071
|
})
|
|
14825
15072
|
return [...keep].sort((left, right) => left - right).map((index) => rows[index])
|
|
14826
15073
|
}
|
|
@@ -15472,6 +15719,28 @@ function ideFloatSafeUrl(url, image = false) {
|
|
|
15472
15719
|
return ''
|
|
15473
15720
|
}
|
|
15474
15721
|
|
|
15722
|
+
/**
|
|
15723
|
+
* 本地绝对路径的图片走 DSH 自己的 `api/file` 路由——对话里就是这么显示的。
|
|
15724
|
+
*
|
|
15725
|
+
* 直接把 `/tmp/x.jpg` 塞进 `<img src>` 会变成「相对当前页面」的地址,浏览器只会
|
|
15726
|
+
* 拿到 404 和一张裂图标(alt 文字旁边那个 ⧉)。`https?` 与 `dsh-app:` 两种部署
|
|
15727
|
+
* 下都能用同一个相对路由,和 DSH 客户端自己的 `fileMediaUrl` 规则一致。
|
|
15728
|
+
*/
|
|
15729
|
+
function ideFloatFileUrl(path) {
|
|
15730
|
+
const text = String(path ?? '').trim()
|
|
15731
|
+
if (text === '') return ''
|
|
15732
|
+
// 只认绝对路径:Windows 的 `C:\x`、UNC 的 `\\host\share`、POSIX 的 `/tmp/x`。
|
|
15733
|
+
if (!/^(?:\/|[A-Za-z]:[\\/]|\\\\)/.test(text)) return ''
|
|
15734
|
+
const base = typeof document !== 'undefined' && typeof document.baseURI === 'string' ? document.baseURI : ''
|
|
15735
|
+
if (base === '') return ''
|
|
15736
|
+
if (!/^https?:/i.test(base) && !base.startsWith('dsh-app://')) return ''
|
|
15737
|
+
try {
|
|
15738
|
+
return new URL(`api/file?path=${encodeURIComponent(text)}`, base).href
|
|
15739
|
+
} catch (error) {
|
|
15740
|
+
return ''
|
|
15741
|
+
}
|
|
15742
|
+
}
|
|
15743
|
+
|
|
15475
15744
|
/** One inline markdown run: code, bold, emphasis, strike, links, images, autolinks. */
|
|
15476
15745
|
function ideFloatInline(text, prefix = '') {
|
|
15477
15746
|
const nodes = []
|
|
@@ -15509,12 +15778,14 @@ function ideFloatInline(text, prefix = '') {
|
|
|
15509
15778
|
nodes.push(h('code', { key, className: 'iw-float-md-code' }, token.slice(ticks, -ticks).replace(/^ | $/g, '')))
|
|
15510
15779
|
} else if (token.startsWith('![')) {
|
|
15511
15780
|
const image = /^!\[([^\]]*)\]\(([^)]+)\)$/.exec(token)
|
|
15512
|
-
const
|
|
15781
|
+
const localImage = image === null ? '' : ideFloatFileUrl(image[2])
|
|
15782
|
+
const src = localImage !== '' ? localImage : image === null ? '' : ideFloatSafeUrl(image[2], true)
|
|
15513
15783
|
if (src === '') pushText(image === null ? token : image[1])
|
|
15514
15784
|
else nodes.push(h('img', { key, className: 'iw-float-md-img', src, alt: image[1] }))
|
|
15515
15785
|
} else if (token.startsWith('[')) {
|
|
15516
15786
|
const link = /^\[([^\]]+)\]\(([^)]+)\)$/.exec(token)
|
|
15517
|
-
const
|
|
15787
|
+
const localLink = link === null ? '' : ideFloatFileUrl(link[2])
|
|
15788
|
+
const href = localLink !== '' ? localLink : link === null ? '' : ideFloatSafeUrl(link[2])
|
|
15518
15789
|
if (href === '') pushText(link === null ? token : link[1])
|
|
15519
15790
|
else nodes.push(h('a', { key, className: 'iw-float-md-link', href, target: '_blank', rel: 'noreferrer' }, link[1]))
|
|
15520
15791
|
} else if (token.startsWith('<http')) {
|
|
@@ -15806,6 +16077,15 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
15806
16077
|
const bodyRef = useRef(null)
|
|
15807
16078
|
// Whether the transcript should follow the newest line.
|
|
15808
16079
|
const stickRef = useRef(true)
|
|
16080
|
+
// 滚到顶时往回补历史:记录「正在加载」与补完要还原的滚动高度。
|
|
16081
|
+
const olderRef = useRef({ busy: false, pending: false, height: 0 })
|
|
16082
|
+
// 「+ 新建会话」之后,不跟随时把卡片收养到新会话上(只认卡片自己发起的创建)。
|
|
16083
|
+
const pinnedAdoptRef = useRef(false)
|
|
16084
|
+
const [olderBusy, setOlderBusy] = useState(false)
|
|
16085
|
+
// 卡片默认只画最后 200 行;用户主动往回翻时按步长放宽,别让补进来的行被裁掉。
|
|
16086
|
+
const [rowLimit, setRowLimit] = useState(IDE_FLOAT_MESSAGES)
|
|
16087
|
+
// 滚到顶 = 用户想看历史:整段对话铺开,直到发消息或切会话才回到「本轮状态板」。
|
|
16088
|
+
const [historyMode, setHistoryMode] = useState(false)
|
|
15809
16089
|
const [entries, setEntries] = useState([])
|
|
15810
16090
|
const [draft, setDraft] = useState('')
|
|
15811
16091
|
const [sending, setSending] = useState(false)
|
|
@@ -15904,6 +16184,72 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
15904
16184
|
stickRef.current = true
|
|
15905
16185
|
}, [state.floatOpen])
|
|
15906
16186
|
|
|
16187
|
+
// 不跟随时,第一次进入就把面板当前会话钉住;之后 DSH 里怎么切都不动。
|
|
16188
|
+
useEffect(() => {
|
|
16189
|
+
if (state.floatFollow !== false) return
|
|
16190
|
+
if (state.floatSessionId !== undefined && state.floatSessionId !== null) return
|
|
16191
|
+
if (typeof state.sessionId !== 'string' || state.sessionId === '') return
|
|
16192
|
+
store.setFloatSessionId(state.sessionId)
|
|
16193
|
+
}, [state.floatFollow, state.floatSessionId, state.sessionId, store])
|
|
16194
|
+
|
|
16195
|
+
// 卡片里点「+ 新建会话」:新会话属于卡片自己,不跟随时也要跟过去。
|
|
16196
|
+
useEffect(() => {
|
|
16197
|
+
if (pinnedAdoptRef.current !== true) return
|
|
16198
|
+
pinnedAdoptRef.current = false
|
|
16199
|
+
if (state.floatFollow !== false) return
|
|
16200
|
+
if (typeof state.sessionId !== 'string' || state.sessionId === '') return
|
|
16201
|
+
store.setFloatSessionId(state.sessionId)
|
|
16202
|
+
}, [state.sessionId, state.floatFollow, store])
|
|
16203
|
+
|
|
16204
|
+
// 滚到「更早」补一页:DSH 的会话窗口是分页的(首屏 ≥50 条消息、最多 500 条),
|
|
16205
|
+
// 卡片自己不请求就只能看到那一屏。补完把滚动位置往下推同样高度,视觉上停在原处。
|
|
16206
|
+
const loadOlderRows = async () => {
|
|
16207
|
+
const session = binding?.session
|
|
16208
|
+
const source = binding?.eventSource
|
|
16209
|
+
if (olderRef.current.busy) return
|
|
16210
|
+
const element = bodyRef.current
|
|
16211
|
+
const taller = () => (element === null || element === undefined ? 0 : element.scrollHeight)
|
|
16212
|
+
const hasMore = source?.getSnapshot()?.hasMore === true
|
|
16213
|
+
const canLoad = session !== undefined && session !== null && typeof session.loadOlder === 'function'
|
|
16214
|
+
// 已经到会话开头(或这条会话没有分页):不用请求,只把历史展开,
|
|
16215
|
+
// 让已经拿到的更早内容显示出来。
|
|
16216
|
+
if (!hasMore || !canLoad) {
|
|
16217
|
+
if (historyMode) return
|
|
16218
|
+
olderRef.current.height = taller()
|
|
16219
|
+
setHistoryMode(true)
|
|
16220
|
+
olderRef.current.pending = true
|
|
16221
|
+
return
|
|
16222
|
+
}
|
|
16223
|
+
olderRef.current.busy = true
|
|
16224
|
+
olderRef.current.height = taller()
|
|
16225
|
+
setOlderBusy(true)
|
|
16226
|
+
if (!historyMode) setHistoryMode(true)
|
|
16227
|
+
try {
|
|
16228
|
+
await session.loadOlder()
|
|
16229
|
+
// 窗口补进来了,但卡片只画最后 N 行;放宽上限,让补进来的行真的出现。
|
|
16230
|
+
setRowLimit((current) => Math.min(current + IDE_FLOAT_MESSAGES, IDE_FLOAT_MESSAGES * 10))
|
|
16231
|
+
olderRef.current.pending = true
|
|
16232
|
+
} catch (error) {
|
|
16233
|
+
ideLogRecord('warn', 'float', 'load older failed', error?.message ?? String(error))
|
|
16234
|
+
} finally {
|
|
16235
|
+
olderRef.current.busy = false
|
|
16236
|
+
setOlderBusy(false)
|
|
16237
|
+
}
|
|
16238
|
+
}
|
|
16239
|
+
|
|
16240
|
+
// 新行渲染完再量高度:把滚动条往下推「长出来的那一段」,视线不跳。
|
|
16241
|
+
useLayoutEffect(() => {
|
|
16242
|
+
const older = olderRef.current
|
|
16243
|
+
if (older.pending !== true) return
|
|
16244
|
+
const element = bodyRef.current
|
|
16245
|
+
if (element === null || element === undefined) return
|
|
16246
|
+
const grown = element.scrollHeight - older.height
|
|
16247
|
+
// 浏览器若已按 scroll anchoring 挪过位置,就保留它的结果,别把高度算两遍。
|
|
16248
|
+
if (grown > 0) element.scrollTop = Math.max(element.scrollTop, grown)
|
|
16249
|
+
older.height = element.scrollHeight
|
|
16250
|
+
older.pending = false
|
|
16251
|
+
})
|
|
16252
|
+
|
|
15907
16253
|
// The transcript shows the newest line: on mount, when it comes back into
|
|
15908
16254
|
// view, and after every new message. `stickRef` follows the user, so reading
|
|
15909
16255
|
// older content is not yanked back; sending forces the jump.
|
|
@@ -15920,7 +16266,8 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
15920
16266
|
}
|
|
15921
16267
|
})
|
|
15922
16268
|
|
|
15923
|
-
const sessionId = state
|
|
16269
|
+
const sessionId = ideFloatTargetSession(state)
|
|
16270
|
+
const follow = state.floatFollow !== false
|
|
15924
16271
|
const open = state.floatOpen === true && state.floatEnabled !== false && state.floatClosed !== true
|
|
15925
16272
|
const collapsed = state.floatCollapsed === true
|
|
15926
16273
|
|
|
@@ -15952,6 +16299,9 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
15952
16299
|
useEffect(() => {
|
|
15953
16300
|
if (binding === null) {
|
|
15954
16301
|
setEntries([])
|
|
16302
|
+
setRowLimit((current) => (current === IDE_FLOAT_MESSAGES ? current : IDE_FLOAT_MESSAGES))
|
|
16303
|
+
olderRef.current = { busy: false, pending: false, height: 0 }
|
|
16304
|
+
setHistoryMode(false)
|
|
15955
16305
|
return undefined
|
|
15956
16306
|
}
|
|
15957
16307
|
const source = binding.eventSource
|
|
@@ -15959,11 +16309,11 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
15959
16309
|
const raw = source.getSnapshot()?.entries
|
|
15960
16310
|
// The transcript drops Tool calls; the progress line needs them.
|
|
15961
16311
|
rawEntries.current = Array.isArray(raw) ? raw : []
|
|
15962
|
-
setEntries(ideFloatTranscript(raw))
|
|
16312
|
+
setEntries(ideFloatTranscript(raw, rowLimit))
|
|
15963
16313
|
}
|
|
15964
16314
|
read()
|
|
15965
16315
|
return source.subscribe(read)
|
|
15966
|
-
}, [binding])
|
|
16316
|
+
}, [binding, rowLimit])
|
|
15967
16317
|
|
|
15968
16318
|
// The session directory, for the switcher in the header. The Workspace snapshot
|
|
15969
16319
|
// carries the archive set, which is what keeps archived conversations out.
|
|
@@ -16105,9 +16455,11 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
16105
16455
|
className: 'iw-float-menu-item iw-float-menu-new',
|
|
16106
16456
|
onClick: () => {
|
|
16107
16457
|
setMenu('')
|
|
16458
|
+
pinnedAdoptRef.current = true
|
|
16108
16459
|
if (typeof startSession === 'function') startSession()
|
|
16109
16460
|
},
|
|
16110
16461
|
}, `+ ${tr('floatNewSession')}`),
|
|
16462
|
+
follow ? null : h('div', { key: 'pin', className: 'iw-float-menu-head' }, tr('floatPinnedHint')),
|
|
16111
16463
|
sessionRows.length === 0
|
|
16112
16464
|
? h('div', { key: 'empty', className: 'iw-float-menu-empty' }, tr('floatSessionEmpty'))
|
|
16113
16465
|
: sessionGroups.map((group) => h('div', {
|
|
@@ -16125,7 +16477,9 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
16125
16477
|
title: row.cwd === '' ? row.title : row.cwd,
|
|
16126
16478
|
onClick: () => {
|
|
16127
16479
|
setMenu('')
|
|
16128
|
-
|
|
16480
|
+
// 不跟随:只换卡片自己的会话,不动 DSH 面板;跟随:照旧打开那个会话。
|
|
16481
|
+
if (!follow) store.setFloatSessionId(row.sessionId)
|
|
16482
|
+
else if (typeof openSession === 'function') openSession(row.sessionId)
|
|
16129
16483
|
},
|
|
16130
16484
|
}, [
|
|
16131
16485
|
h('span', { key: 't', className: 'iw-float-menu-label' }, row.title),
|
|
@@ -16514,7 +16868,7 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
16514
16868
|
|
|
16515
16869
|
// The transcript holds the conversation; the Tool log is live status pinned to
|
|
16516
16870
|
// the card's footer, so it never scrolls away with the history.
|
|
16517
|
-
const visibleEntries = ideFloatVisibleRows(entries, running, state.floatEvents === true)
|
|
16871
|
+
const visibleEntries = ideFloatVisibleRows(entries, running, state.floatEvents === true, historyMode)
|
|
16518
16872
|
|
|
16519
16873
|
// The live line reads the RAW entries: `entries` is already folded into rows,
|
|
16520
16874
|
// and the streamed deltas live only in the window (they are not rows).
|
|
@@ -16759,6 +17113,8 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
16759
17113
|
const text = draft.trim()
|
|
16760
17114
|
const parts = ideFloatPromptParts(text, refs, images)
|
|
16761
17115
|
if (parts.length === 0 || binding === null || sending) return
|
|
17116
|
+
// 发新消息 = 回到实时状态板,不再停在历史视图里。
|
|
17117
|
+
setHistoryMode(false)
|
|
16762
17118
|
// Sending means the user wants to see their own message, wherever they were.
|
|
16763
17119
|
stickRef.current = true
|
|
16764
17120
|
setSending(true)
|
|
@@ -16977,20 +17333,27 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
16977
17333
|
width: `${box?.width ?? size.width}px`,
|
|
16978
17334
|
height: `${box?.height ?? size.height}px`,
|
|
16979
17335
|
fontSize: font,
|
|
17336
|
+
// 表头标题按工作区取色;同一个目录永远同一个色相。
|
|
17337
|
+
'--iw-float-hue': String(ideFloatWorkspaceHue(state.rootPath ?? '')),
|
|
16980
17338
|
},
|
|
16981
17339
|
}, children))
|
|
16982
17340
|
|
|
16983
17341
|
if (collapsed) {
|
|
16984
17342
|
// The ball is anchored to the window's bottom-right corner by CSS, so a
|
|
16985
17343
|
// window resize can never leave it stranded mid-screen.
|
|
17344
|
+
// 收起来时审批不会自己跳出来,球上点一个告警点,别让人错过要批的东西。
|
|
17345
|
+
const waiting = ideFloatPendingApprovals(entries)
|
|
16986
17346
|
return shell([h('button', {
|
|
16987
17347
|
key: 'b',
|
|
16988
17348
|
type: 'button',
|
|
16989
17349
|
className: 'iw-float-ball-btn',
|
|
16990
17350
|
onClick: () => store.setFloatCollapsed(false),
|
|
16991
|
-
title: tr('floatExpand'),
|
|
16992
|
-
'aria-label': tr('floatExpand'),
|
|
16993
|
-
},
|
|
17351
|
+
title: waiting > 0 ? tr('floatApprovalBallHint') : tr('floatExpand'),
|
|
17352
|
+
'aria-label': waiting > 0 ? tr('floatApprovalBallHint') : tr('floatExpand'),
|
|
17353
|
+
}, [
|
|
17354
|
+
'AI',
|
|
17355
|
+
waiting > 0 ? h('span', { key: 'dot', className: 'iw-float-ball-dot' }) : null,
|
|
17356
|
+
])], 'iw-float-collapsed', { width: IDE_FLOAT_BALL, height: IDE_FLOAT_BALL })
|
|
16994
17357
|
}
|
|
16995
17358
|
|
|
16996
17359
|
return shell([
|
|
@@ -17005,40 +17368,45 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
17005
17368
|
type: 'button',
|
|
17006
17369
|
ref: titleBtnRef,
|
|
17007
17370
|
className: 'iw-float-title iw-float-title-btn',
|
|
17008
|
-
|
|
17371
|
+
// 悬停给完整标题 + 工作区路径:标题本身最多 20 个字。
|
|
17372
|
+
title: `${sessionTitle} · ${state.rootPath ?? ''}`,
|
|
17009
17373
|
onClick: () => setMenu(menu === 'sessions' ? '' : 'sessions'),
|
|
17010
17374
|
}, [
|
|
17011
|
-
h('span', { key: 'text', className: 'iw-float-title iw-float-title-text' }, sessionTitle),
|
|
17375
|
+
h('span', { key: 'text', className: 'iw-float-title iw-float-title-text' }, ideFloatTitleText(sessionTitle)),
|
|
17012
17376
|
h('span', { key: 'caret', className: 'iw-float-title-caret' }, '▾'),
|
|
17013
17377
|
]),
|
|
17014
|
-
|
|
17015
|
-
|
|
17016
|
-
type: 'button',
|
|
17017
|
-
className: 'iw-float-new-btn',
|
|
17018
|
-
title: tr('floatNewSession'),
|
|
17019
|
-
'aria-label': tr('floatNewSession'),
|
|
17020
|
-
onClick: () => {
|
|
17021
|
-
setMenu('')
|
|
17022
|
-
if (typeof startSession === 'function') startSession()
|
|
17023
|
-
},
|
|
17024
|
-
}, '+'),
|
|
17025
|
-
h('div', { key: 'actions', className: 'iw-float-actions' }, [
|
|
17026
|
-
h('button', {
|
|
17027
|
-
key: 'shrink',
|
|
17028
|
-
type: 'button',
|
|
17029
|
-
className: 'iw-float-icon',
|
|
17030
|
-
title: tr('floatCollapse'),
|
|
17031
|
-
'aria-label': tr('floatCollapse'),
|
|
17032
|
-
onClick: () => store.setFloatCollapsed(true),
|
|
17033
|
-
}, '–'),
|
|
17378
|
+
// 右侧按钮组绝对定位,标题才能在表头里真正居中。
|
|
17379
|
+
h('div', { key: 'right', className: 'iw-float-head-right' }, [
|
|
17034
17380
|
h('button', {
|
|
17035
|
-
key: '
|
|
17381
|
+
key: 'new',
|
|
17036
17382
|
type: 'button',
|
|
17037
|
-
className: 'iw-float-
|
|
17038
|
-
title: tr('
|
|
17039
|
-
'aria-label': tr('
|
|
17040
|
-
onClick: () =>
|
|
17041
|
-
|
|
17383
|
+
className: 'iw-float-new-btn',
|
|
17384
|
+
title: tr('floatNewSession'),
|
|
17385
|
+
'aria-label': tr('floatNewSession'),
|
|
17386
|
+
onClick: () => {
|
|
17387
|
+
setMenu('')
|
|
17388
|
+
pinnedAdoptRef.current = true
|
|
17389
|
+
if (typeof startSession === 'function') startSession()
|
|
17390
|
+
},
|
|
17391
|
+
}, '+'),
|
|
17392
|
+
h('div', { key: 'actions', className: 'iw-float-actions' }, [
|
|
17393
|
+
h('button', {
|
|
17394
|
+
key: 'shrink',
|
|
17395
|
+
type: 'button',
|
|
17396
|
+
className: 'iw-float-icon',
|
|
17397
|
+
title: tr('floatCollapse'),
|
|
17398
|
+
'aria-label': tr('floatCollapse'),
|
|
17399
|
+
onClick: () => store.setFloatCollapsed(true),
|
|
17400
|
+
}, '–'),
|
|
17401
|
+
h('button', {
|
|
17402
|
+
key: 'close',
|
|
17403
|
+
type: 'button',
|
|
17404
|
+
className: 'iw-float-icon',
|
|
17405
|
+
title: tr('floatClose'),
|
|
17406
|
+
'aria-label': tr('floatClose'),
|
|
17407
|
+
onClick: () => store.setFloatClosed(true),
|
|
17408
|
+
}, '×'),
|
|
17409
|
+
]),
|
|
17042
17410
|
]),
|
|
17043
17411
|
]),
|
|
17044
17412
|
renderSessionsMenu(),
|
|
@@ -17052,8 +17420,12 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
17052
17420
|
onScroll: (event) => {
|
|
17053
17421
|
const element = event.currentTarget
|
|
17054
17422
|
stickRef.current = element.scrollTop + element.clientHeight >= element.scrollHeight - 40
|
|
17423
|
+
// 滚到最顶再往上拉:补一页更早的历史(没有更多时是空操作)。
|
|
17424
|
+
if (element.scrollTop <= 4) void loadOlderRows()
|
|
17055
17425
|
},
|
|
17056
|
-
},
|
|
17426
|
+
}, [
|
|
17427
|
+
olderBusy ? h('div', { key: 'older', className: 'iw-float-older' }, tr('floatLoadingOlder')) : null,
|
|
17428
|
+
visibleEntries.length === 0 && running !== true
|
|
17057
17429
|
? h('div', { key: 'empty', className: 'iw-float-empty' }, sessionId === '' ? tr('floatNoSession') : tr('floatEmpty'))
|
|
17058
17430
|
: visibleEntries.map((row) => {
|
|
17059
17431
|
// One malformed event must not take the whole card down: a throw inside
|
|
@@ -17064,7 +17436,8 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
17064
17436
|
ideLogRecord('warn', 'float', 'row render failed', { key: row.key, error: String(error) })
|
|
17065
17437
|
return h('div', { key: row.key, className: 'iw-float-row iw-float-assistant' }, String(row.text ?? ''))
|
|
17066
17438
|
}
|
|
17067
|
-
})
|
|
17439
|
+
}),
|
|
17440
|
+
]),
|
|
17068
17441
|
// The in-flight message renders in the transcript, exactly like the one the
|
|
17069
17442
|
// conversation is printing — no separate 「正在输出」 step.
|
|
17070
17443
|
streamRow === null
|
package/locale/en.json
CHANGED
|
@@ -335,6 +335,7 @@
|
|
|
335
335
|
"floatCollapse": "Collapse",
|
|
336
336
|
"floatExpand": "Expand assistant",
|
|
337
337
|
"floatEmpty": "Ask something; the answer lands in this session",
|
|
338
|
+
"floatLoadingOlder": "Loading earlier messages…",
|
|
338
339
|
"floatNoSession": "No session bound yet",
|
|
339
340
|
"floatNoWorkspace": "no workspace",
|
|
340
341
|
"floatPlaceholder": "Message or create a task, / for commands, @ for files or chats",
|
|
@@ -367,6 +368,17 @@
|
|
|
367
368
|
"floatNoticeAttempt": "Attempt failed",
|
|
368
369
|
"floatNoticeRetry": "Model retry",
|
|
369
370
|
"floatNoticeApproval": "Approval requested",
|
|
371
|
+
"floatApprovalPending": "Waiting for approval",
|
|
372
|
+
"floatApprovalSettled": "Approval result",
|
|
373
|
+
"floatApprovalTitle": "A tool asks for more access",
|
|
374
|
+
"floatApprovalTool": "Tool",
|
|
375
|
+
"floatApprovalHint": "Approvals are answered in the conversation",
|
|
376
|
+
"floatApprovalGo": "Go to the conversation",
|
|
377
|
+
"floatApprovalBallHint": "An approval is waiting — click to open",
|
|
378
|
+
"floatApprovalAllowed": "Allowed once",
|
|
379
|
+
"floatApprovalRejected": "Rejected",
|
|
380
|
+
"floatApprovalCancelled": "Cancelled",
|
|
381
|
+
"floatApprovalUnavailable": "No answerer available",
|
|
370
382
|
"floatNoticeApprovalResult": "Approval result",
|
|
371
383
|
"floatNoticeApprovalPolicy": "Approval policy",
|
|
372
384
|
"floatNoticeWorkspace": "Workspace changed",
|
|
@@ -403,6 +415,7 @@
|
|
|
403
415
|
"floatSessionFailed": "Switching the session failed",
|
|
404
416
|
"floatCurrentWorkspace": "current",
|
|
405
417
|
"settingsFloat": "Floating assistant",
|
|
418
|
+
"settingsFloatEnable": "Enable",
|
|
406
419
|
"settingsFloatHint": "When off, the floating card no longer opens in the code workspace",
|
|
407
420
|
"settingsOn": "On",
|
|
408
421
|
"settingsOff": "Off",
|
|
@@ -432,6 +445,10 @@
|
|
|
432
445
|
"floatCloseViewer": "Close",
|
|
433
446
|
"settingsFloatDetach": "Detach from the workspace",
|
|
434
447
|
"settingsFloatDetachHint": "Keep the card on screen when you switch to another panel or back to the conversation",
|
|
448
|
+
"settingsFloatGroup": "Floating card",
|
|
449
|
+
"settingsFloatFollow": "Follow the current conversation",
|
|
450
|
+
"settingsFloatFollowHint": "When off, switching conversations in DSH leaves the card alone; switch inside the card's title menu instead",
|
|
451
|
+
"floatPinnedHint": "Not following DSH · pick a conversation below",
|
|
435
452
|
"settingsFloatEvents": "Show full detail",
|
|
436
453
|
"settingsFloatEventsHint": "List reasoning, context, Tool arguments and system events; off shows only the latest status line",
|
|
437
454
|
"floatWrap": "Wrap lines",
|
package/locale/zh.json
CHANGED
|
@@ -335,6 +335,7 @@
|
|
|
335
335
|
"floatCollapse": "收起",
|
|
336
336
|
"floatExpand": "展开助手",
|
|
337
337
|
"floatEmpty": "问点什么,回答会出现在当前会话里",
|
|
338
|
+
"floatLoadingOlder": "正在加载更早的消息…",
|
|
338
339
|
"floatNoSession": "还没有绑定会话",
|
|
339
340
|
"floatNoWorkspace": "未选择工作区",
|
|
340
341
|
"floatPlaceholder": "发消息或创建任务,/ 调用指令,@ 文件或对话",
|
|
@@ -367,6 +368,17 @@
|
|
|
367
368
|
"floatNoticeAttempt": "模型尝试失败",
|
|
368
369
|
"floatNoticeRetry": "模型重试",
|
|
369
370
|
"floatNoticeApproval": "审批请求",
|
|
371
|
+
"floatApprovalPending": "等待审批",
|
|
372
|
+
"floatApprovalSettled": "审批结果",
|
|
373
|
+
"floatApprovalTitle": "工具请求更高权限",
|
|
374
|
+
"floatApprovalTool": "工具",
|
|
375
|
+
"floatApprovalHint": "审批只能在对话里作答",
|
|
376
|
+
"floatApprovalGo": "去对话处理",
|
|
377
|
+
"floatApprovalBallHint": "有审批在等,点开处理",
|
|
378
|
+
"floatApprovalAllowed": "已允许这一次",
|
|
379
|
+
"floatApprovalRejected": "已拒绝",
|
|
380
|
+
"floatApprovalCancelled": "已取消",
|
|
381
|
+
"floatApprovalUnavailable": "没有可用的审批人",
|
|
370
382
|
"floatNoticeApprovalResult": "审批结果",
|
|
371
383
|
"floatNoticeApprovalPolicy": "审批策略",
|
|
372
384
|
"floatNoticeWorkspace": "文件变更",
|
|
@@ -403,6 +415,7 @@
|
|
|
403
415
|
"floatSessionFailed": "切换会话失败",
|
|
404
416
|
"floatCurrentWorkspace": "当前",
|
|
405
417
|
"settingsFloat": "悬浮助手卡",
|
|
418
|
+
"settingsFloatEnable": "启用",
|
|
406
419
|
"settingsFloatHint": "关掉后进入代码工作区不再自动弹出悬浮卡",
|
|
407
420
|
"settingsOn": "已启用",
|
|
408
421
|
"settingsOff": "已关闭",
|
|
@@ -432,6 +445,10 @@
|
|
|
432
445
|
"floatCloseViewer": "关闭",
|
|
433
446
|
"settingsFloatDetach": "脱离代码工作区",
|
|
434
447
|
"settingsFloatDetachHint": "开启后悬浮框不再跟着代码工作区出现与消失:切到其他插件视图或回到对话时它依然在",
|
|
448
|
+
"settingsFloatGroup": "悬浮助手卡",
|
|
449
|
+
"settingsFloatFollow": "跟随当前会话",
|
|
450
|
+
"settingsFloatFollowHint": "关闭后,在 DSH 里切换会话不会带动悬浮卡;只能在悬浮卡标题菜单里手动切换",
|
|
451
|
+
"floatPinnedHint": "不跟随当前会话 · 在下面手动切换",
|
|
435
452
|
"settingsFloatEvents": "显示详细过程",
|
|
436
453
|
"settingsFloatEventsHint": "把思考、上下文注入、工具参数与系统事件全部列出来;关闭时只显示最新一条状态",
|
|
437
454
|
"floatWrap": "自动换行",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-ide-window",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "IDEA-style code workspace for DeepSeek Harness: a centre panel with a workspace file tree, editor tabs and live-updating source, while the left navigation column hides.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"icon": "icon.svg",
|