dsh-ide-window 0.3.7 → 0.3.8
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 +1 -1
- package/CHANGELOG.md +13 -0
- package/client.js +375 -113
- package/locale/en.json +1 -0
- package/locale/zh.json +1 -0
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -300,6 +300,7 @@ tail -f /tmp/dsh-ide-test/logs/dsh-ide-window.log # 自测实例
|
|
|
300
300
|
- `/` 三节:**添加**(文件→转 `@`、目标、计划、反馈)、**指令**(压缩、权限、模型→打开模型菜单、下载日志,外加 Host 里其他指令)、**技能**(`ctx.remote.skills.list({ sessionId })`——**这里要传对象**,传字符串拿不到)。前四项是编辑器动作,其余走 `binding.session.command('/name')`;名称/说明用本插件 locale(`floatCmdGoal`/`floatCmdGoalDesc`…),因为 Host 那份目录只有英文 name/description
|
|
301
301
|
- `@` 两节:**文件与文件夹**(`workspaceFiles.list(sessionId, dir)`,`'.'` 是根、其余相对路径、条目只有 `{name,type}`)+ **对话**(按标题过滤其他会话,选中即切换悬浮卡的会话)
|
|
302
302
|
- ↑/↓ 选、Enter/Tab 选中、Esc 关,目录**下钻**成 `@dir/`、文件变引用 chip、技能插入 `/<名字> `。菜单绝对定位在输入框上方(`.iw-float-input` 必须是 `position: relative`)
|
|
303
|
+
- **浮层挂在触发器上**:会话列表从标题 ▾ 向下、权限与模型从各自 chip 向上。菜单曾是卡片的 flex 子节点,于是点模型菜单会跑到卡片顶部——现在 `useLayoutEffect` 按触发器与卡片的 rect 算出 `left/top` 或 `right/bottom`,再用内联样式粘上去(卡片可缩放,写死偏移会漂)。`useLayoutEffect` 要记得在 `build.mjs` 的解构里导出
|
|
303
304
|
- **输入区 = DSH 的 composer**:一个 16px 圆角容器(内边距 `10px 10px 8px 14px`),里面是无边框 textarea(占位文案同 DSH)与底行 `+(圆形)/ 权限 pill(锁+文字+⌄)/ 空隙 / 思考等级 / 模型 chip / 圆形发送键(↑,运行中变 ■)`;引用是蓝色 chip,粘贴图片走剪贴板 `image/*`(≤4 张、单张 8 MB),发送 `prompt([image…, {text: refs + 正文}])`
|
|
304
305
|
- **表头只留**:`▾` 标题(46% 截断)、`+` 新建、`–`/`×`(模型与思考等级在输入区,别重复)
|
|
305
306
|
- **每次打开 DSH 都从「收起来」开始**:卡片存在,但只占一个 44px 圆球(`floatCollapsed` 初值 `true`,不持久化);球**由 CSS 钉在窗口右下角**(`right/bottom: 20px`,`left/top: auto`),窗口放大缩小都在原位——早先用卡片坐标算,最大化后还停在旧尺寸的位置,看着像跑到屏幕中间
|
|
@@ -421,7 +422,6 @@ dsh plugin --profile desktop add link:~/dev/dsh-ide-window
|
|
|
421
422
|
| 切到浅色主题后代码看不清(深色语法色仍在用) | 语法高亮是写死的深色配色,没有跟着主题走 | 语法色走 `--iw-syn-*` 变量,每套主题各给一组并按对比度校验(正文类 ≥4.5:1,注释 ≥3.5:1);`test/theme.mjs` 断言每套主题都有这 8 个变量 |
|
|
422
423
|
| 截图点了没反应,或只给一句「失败」 | `screencapture` 在 macOS 未授权时报 `could not create image from display`;浏览器侧也拿不到屏幕(DSH 把 `setDisplayMediaRequestHandler` 设成 `callback({})` 直接拒绝) | 截图只能由宿主用系统工具做;失败按文案归类成 `no-screen-permission`,弹层给「打开系统设置」深链 + 系统化指引 |
|
|
423
424
|
| 截图编辑器画出巨大的实心色块 | 操作对象里 `width` 同时被当成"笔宽"和"矩形宽度",`lineWidth` 变成几百像素 | 笔宽叫 `stroke`、几何叫 `width/height`;`ideShotDrawOp` 只从 `stroke` 取线宽 |
|
|
424
|
-
| 截图画框后的操作条是白底白字、字体也不对 | 编辑器渲染在 `shell.overlay`,不在 `.iw-root` 里:① 面板组件才注入 `IdeStyles`,浮层没注入 → 全部 `.iw-*` 规则失效,掉回浏览器默认按钮;② `[data-dsh-theme]` 只在面板根节点上 → 浮层拿不到工作区调色板,用宿主 token | 浮层自己 `h(IdeStyles)` + 自带 `data-dsh-theme` 与字体变量;按钮复用 `.iw-btn` 而不是自造一套 |
|
|
425
425
|
| 编辑器里拖拽完全没反应(或选框永远是全屏) | ① `setPointerCapture` 对合成 pointerId 抛错,异常发生在设置拖动状态之前;② 预设了全屏选框,按下点永远"命中选框内部",只能移动不能重画 | ① `setPointerCapture` 包 try/catch,且放在状态设置之后;② **不预设选框**,第一下按下-拖动就是画框;① 的检查同理适用于所有合成指针测试 |
|
|
426
426
|
| 截图附件太大(1 MB 以上) | 直接塞原图:Retina 全屏 5120×2880、PNG 1.2 MB | 质量阶梯 80→40 直到 ≤1 MB;仍超标才降分辨率(1 → 1/1.25 → 1/1.5 → 1/2)。**不预设 1080p**:抓屏与导出都保持设备像素 |
|
|
427
427
|
| 想只加一张图却把草稿弄乱 | 直接改输入框内容会动到用户已有的文字/引用/附件 | 合成 `ClipboardEvent('paste')` + `DataTransfer` + `File` 派发给 Lexical 输入框,让 DSH 自己处理粘贴;**不要**写 editor 的 `innerHTML`/`textContent`(`test/screenshot.mjs` 会断言这一点) |
|
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,19 @@
|
|
|
6
6
|
升级方式:DSH →「插件」→ 打开插件的「版本」区 →「检查更新」,或直接卸载后重新安装。
|
|
7
7
|
(`link:` 本地安装不参与版本检查,拉取仓库即可。)
|
|
8
8
|
|
|
9
|
+
## [0.3.8] — 2026-11-24
|
|
10
|
+
|
|
11
|
+
### 修复 / 改进
|
|
12
|
+
|
|
13
|
+
- **点「思考等级」「模型」「权限」时菜单跑到别处**:三个菜单原来排在卡片里当普通块,一个跑到卡片顶部、一个跑到输入框下面。现在都贴着各自的 chip 向上展开、右边缘对齐。
|
|
14
|
+
- **「目标 / 计划 / 反馈」点了没反应**:这三条命令的执行 UI 在对话里,插件调用它只会一直挂着。现在点它会切回对话,把 `/goal` 这类指令填进对话输入框,回车即执行。
|
|
15
|
+
- **输入框左边的 `+` 只能「引用文件」**:DSH 的 `+` 是「添加文件或调用指令」。现在打开的是与 `/` 同一份目录:添加 / 指令 / 技能,并保留「引用当前文件」。
|
|
16
|
+
|
|
17
|
+
### 新增
|
|
18
|
+
|
|
19
|
+
- **`/` 菜单按对话的样式重画**:每行带 14px 图标、中文名 + 英文别名、右侧对齐的说明,分区标题 11px;名称与说明走插件自己的文案,不再是 Host 那串英文。
|
|
20
|
+
- **`@` 菜单补上「对话」分区**:除了文件与文件夹,还能搜到其他会话,选中即把悬浮卡切过去。
|
|
21
|
+
|
|
9
22
|
## [0.3.7] — 2026-11-24
|
|
10
23
|
|
|
11
24
|
### 新增
|
package/client.js
CHANGED
|
@@ -6,9 +6,10 @@ window.__ModuleLoader__.load({
|
|
|
6
6
|
id: "dsh-ide-window",
|
|
7
7
|
factory(require) {
|
|
8
8
|
const React = require('react')
|
|
9
|
-
const { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } = React
|
|
9
|
+
const { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } = React
|
|
10
10
|
const h = React.createElement
|
|
11
11
|
const IDE_TEXT_EN = {
|
|
12
|
+
"floatCommandNoEditor": "The composer is not ready yet",
|
|
12
13
|
"floatStepMore": "{title} and more",
|
|
13
14
|
"floatStepSharedPrefix": "",
|
|
14
15
|
"floatStepComma": ", ",
|
|
@@ -396,6 +397,7 @@ window.__ModuleLoader__.load({
|
|
|
396
397
|
"floatWrap": "Wrap lines",
|
|
397
398
|
}
|
|
398
399
|
const IDE_TEXT_ZH = {
|
|
400
|
+
"floatCommandNoEditor": "对话框还没就绪,稍后再试",
|
|
399
401
|
"floatStepMore": "{title}等",
|
|
400
402
|
"floatStepSharedPrefix": "已",
|
|
401
403
|
"floatStepComma": ",",
|
|
@@ -2049,54 +2051,113 @@ html.iw-select-code .iw-code .iw-vision {
|
|
|
2049
2051
|
text-overflow: ellipsis;
|
|
2050
2052
|
white-space: nowrap;
|
|
2051
2053
|
}
|
|
2054
|
+
/* The composer dropdown, measured off DSH's own menu: 4px padding, 34px rows,
|
|
2055
|
+
a 14px glyph seat, the alias beside the title and the description flushed
|
|
2056
|
+
right. */
|
|
2052
2057
|
.iw-float-suggest {
|
|
2053
2058
|
position: absolute;
|
|
2054
|
-
left:
|
|
2055
|
-
right:
|
|
2056
|
-
bottom: calc(100% +
|
|
2059
|
+
left: 0;
|
|
2060
|
+
right: 0;
|
|
2061
|
+
bottom: calc(100% + 4px);
|
|
2057
2062
|
z-index: 20;
|
|
2058
2063
|
max-height: 240px;
|
|
2059
|
-
overflow: auto;
|
|
2064
|
+
overflow-y: auto;
|
|
2060
2065
|
padding: 4px;
|
|
2061
|
-
border
|
|
2062
|
-
border:
|
|
2063
|
-
background: var(--dsw-alias-bg-layer-1,
|
|
2064
|
-
box-shadow: var(--dsw-elevation-prominent, 0 10px 24px rgba(0, 0, 0, 0.
|
|
2066
|
+
border: 0;
|
|
2067
|
+
border-radius: var(--dsw-radius-lg, 12px);
|
|
2068
|
+
background: var(--dsw-specific-menu, var(--dsw-alias-bg-layer-1, #fff));
|
|
2069
|
+
box-shadow: var(--dsw-elevation-prominent, 0 10px 24px rgba(0, 0, 0, 0.18));
|
|
2065
2070
|
}
|
|
2066
2071
|
.iw-float-suggest-item {
|
|
2067
2072
|
display: flex;
|
|
2068
|
-
align-items:
|
|
2069
|
-
gap:
|
|
2073
|
+
align-items: center;
|
|
2074
|
+
gap: 6px;
|
|
2070
2075
|
width: 100%;
|
|
2076
|
+
min-height: 34px;
|
|
2071
2077
|
padding: 6px 8px;
|
|
2072
2078
|
border: 0;
|
|
2073
|
-
border-radius: 8px;
|
|
2079
|
+
border-radius: var(--dsw-radius-md, 8px);
|
|
2074
2080
|
background: transparent;
|
|
2075
2081
|
color: var(--dsw-alias-label-primary, inherit);
|
|
2076
2082
|
font: inherit;
|
|
2077
|
-
font-size:
|
|
2083
|
+
font-size: 13px;
|
|
2084
|
+
line-height: 20px;
|
|
2078
2085
|
text-align: left;
|
|
2079
2086
|
cursor: pointer;
|
|
2080
2087
|
}
|
|
2081
|
-
.iw-float-suggest-item.on { background: var(--dsw-alias-bg-
|
|
2088
|
+
.iw-float-suggest-item.on { background: var(--dsw-alias-interactive-bg-hover, rgba(127, 127, 127, 0.12)); }
|
|
2089
|
+
.iw-float-suggest-icon {
|
|
2090
|
+
flex: none;
|
|
2091
|
+
display: inline-flex;
|
|
2092
|
+
align-items: center;
|
|
2093
|
+
justify-content: center;
|
|
2094
|
+
width: 14px;
|
|
2095
|
+
height: 14px;
|
|
2096
|
+
color: var(--dsw-alias-menu-icon, var(--dsw-alias-label-tertiary, #81858c));
|
|
2097
|
+
}
|
|
2082
2098
|
.iw-float-suggest-section {
|
|
2083
|
-
|
|
2099
|
+
min-height: 23px;
|
|
2100
|
+
padding: 5px 8px 2px;
|
|
2101
|
+
font-size: 11px;
|
|
2102
|
+
font-weight: 500;
|
|
2103
|
+
line-height: 16px;
|
|
2104
|
+
color: var(--dsw-alias-label-tertiary, #81858c);
|
|
2105
|
+
}
|
|
2106
|
+
.iw-float-suggest-section:not(:first-child) { margin-top: 3px; }
|
|
2107
|
+
.iw-float-suggest-name {
|
|
2108
|
+
flex: none;
|
|
2109
|
+
max-width: 40%;
|
|
2110
|
+
overflow: hidden;
|
|
2111
|
+
text-overflow: ellipsis;
|
|
2112
|
+
white-space: nowrap;
|
|
2113
|
+
}
|
|
2114
|
+
.iw-float-suggest-alias {
|
|
2115
|
+
flex: none;
|
|
2116
|
+
max-width: 20%;
|
|
2117
|
+
overflow: hidden;
|
|
2118
|
+
text-overflow: ellipsis;
|
|
2119
|
+
white-space: nowrap;
|
|
2084
2120
|
font-size: 12px;
|
|
2085
2121
|
line-height: 18px;
|
|
2086
2122
|
color: var(--dsw-alias-label-tertiary, #81858c);
|
|
2087
2123
|
}
|
|
2088
|
-
.iw-float-suggest-alias { flex: 0 0 auto; font-size: 12.5px; color: var(--dsw-alias-label-tertiary, #81858c); }
|
|
2089
|
-
.iw-float-suggest-name { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2090
|
-
.iw-float-suggest-hint { flex: 0 0 auto; font-size: 12px; color: var(--dsw-alias-label-tertiary, #81858c); }
|
|
2091
2124
|
.iw-float-suggest-desc {
|
|
2092
|
-
flex: 1
|
|
2125
|
+
flex: 1;
|
|
2126
|
+
min-width: 0;
|
|
2093
2127
|
overflow: hidden;
|
|
2094
2128
|
text-overflow: ellipsis;
|
|
2095
2129
|
white-space: nowrap;
|
|
2096
2130
|
text-align: right;
|
|
2097
|
-
font-size:
|
|
2131
|
+
font-size: 12px;
|
|
2132
|
+
line-height: 18px;
|
|
2098
2133
|
color: var(--dsw-alias-label-tertiary, #81858c);
|
|
2099
2134
|
}
|
|
2135
|
+
.iw-float-suggest-trailing {
|
|
2136
|
+
flex: none;
|
|
2137
|
+
display: inline-flex;
|
|
2138
|
+
align-items: center;
|
|
2139
|
+
gap: 3px;
|
|
2140
|
+
margin-left: auto;
|
|
2141
|
+
}
|
|
2142
|
+
.iw-float-suggest-key {
|
|
2143
|
+
padding: 0 4px;
|
|
2144
|
+
border-radius: var(--dsw-radius-xs, 4px);
|
|
2145
|
+
background: var(--dsw-alias-interactive-bg-hover, rgba(127, 127, 127, 0.12));
|
|
2146
|
+
color: var(--dsw-alias-label-caption, var(--dsw-alias-label-tertiary, #81858c));
|
|
2147
|
+
font-size: 10px;
|
|
2148
|
+
line-height: 16px;
|
|
2149
|
+
}
|
|
2150
|
+
/* A popup belongs to its trigger: the card used to lay menus out in its own
|
|
2151
|
+
column, so a menu opened at the top of the card, far from the chip. The
|
|
2152
|
+
coordinates are measured per open; this only takes the menu out of the flow. */
|
|
2153
|
+
.iw-float-menu {
|
|
2154
|
+
position: absolute;
|
|
2155
|
+
z-index: 24;
|
|
2156
|
+
}
|
|
2157
|
+
/* A menu row must keep its name on one line: the card is narrow, the model
|
|
2158
|
+
names are not. */
|
|
2159
|
+
.iw-float-menu-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
2160
|
+
|
|
2100
2161
|
.iw-float-menu {
|
|
2101
2162
|
display: flex;
|
|
2102
2163
|
flex-direction: column;
|
|
@@ -2114,9 +2175,11 @@ html.iw-select-code .iw-code .iw-vision {
|
|
|
2114
2175
|
align-items: center;
|
|
2115
2176
|
justify-content: space-between;
|
|
2116
2177
|
gap: 10px;
|
|
2117
|
-
|
|
2178
|
+
min-height: 30px;
|
|
2179
|
+
font-size: 13px;
|
|
2180
|
+
padding: 6px 8px;
|
|
2118
2181
|
border: 0;
|
|
2119
|
-
border-radius:
|
|
2182
|
+
border-radius: var(--dsw-radius-md, 8px);
|
|
2120
2183
|
background: transparent;
|
|
2121
2184
|
color: var(--dsw-alias-label-primary, inherit);
|
|
2122
2185
|
font: inherit;
|
|
@@ -2126,7 +2189,8 @@ html.iw-select-code .iw-code .iw-vision {
|
|
|
2126
2189
|
cursor: pointer;
|
|
2127
2190
|
}
|
|
2128
2191
|
.iw-float-menu-item:hover { background: var(--dsw-alias-card-fill-hover, rgba(255, 255, 255, 0.08)); }
|
|
2129
|
-
|
|
2192
|
+
/* The current entry reads as a selected row, the way DSH's own menus do. */
|
|
2193
|
+
.iw-float-menu-item.on { background: var(--dsw-alias-interactive-bg-hover, rgba(127, 127, 127, 0.12)); }
|
|
2130
2194
|
.iw-float-menu-group { font-size: 12px; color: var(--dsw-alias-label-tertiary, inherit); white-space: nowrap; }
|
|
2131
2195
|
.iw-float-menu-empty { padding: 8px 10px; font-size: 14px; color: var(--dsw-alias-label-tertiary, inherit); }
|
|
2132
2196
|
/* Markdown tables: full width, scrolls sideways only when it must. */
|
|
@@ -3339,6 +3403,44 @@ function ideSvg(size, children, strokeWidth = 1.3) {
|
|
|
3339
3403
|
}, children)
|
|
3340
3404
|
}
|
|
3341
3405
|
|
|
3406
|
+
/**
|
|
3407
|
+
* The 14px glyphs the composer's `/` and `@` rows use. One switch keeps the
|
|
3408
|
+
* set small; DSH draws these at 14px in `--dsw-alias-menu-icon`, so every path
|
|
3409
|
+
* is authored on the same 16 grid and scaled down.
|
|
3410
|
+
*/
|
|
3411
|
+
function IdeMenuGlyph({ kind = 'file', size = 14 }) {
|
|
3412
|
+
const paths = {
|
|
3413
|
+
// 文件:别针夹一页纸
|
|
3414
|
+
file: ['M5.2 4.4h3.6l2.4 2.4v4.8H5.2z', 'M5.2 8.6h5.4'],
|
|
3415
|
+
// 目标:同心圆 + 十字
|
|
3416
|
+
goal: ['M8 13.4A5.4 5.4 0 1 0 8 2.6a5.4 5.4 0 0 0 0 10.8z', 'M8 9.9A1.9 1.9 0 1 0 8 6.1a1.9 1.9 0 0 0 0 3.8z'],
|
|
3417
|
+
// 计划:勾选清单
|
|
3418
|
+
plan: ['M3.2 4.2h.01M5.6 4.2h7.2', 'M3.2 8h.01M5.6 8h7.2', 'M3.2 11.8h.01M5.6 11.8h7.2'],
|
|
3419
|
+
// 反馈:纸飞机
|
|
3420
|
+
feedback: ['M13.4 2.6 2.6 7.1l4.2 1.6 1.6 4.2z', 'M13.4 2.6 8.8 8.7'],
|
|
3421
|
+
// 压缩:向内收拢的两条线
|
|
3422
|
+
compact: ['M8 2.8v3.4M8 9.8v3.4', 'M6.2 4.6 8 6.4l1.8-1.8', 'M6.2 11.4 8 9.6l1.8 1.8'],
|
|
3423
|
+
// 权限:盾牌
|
|
3424
|
+
permission: ['M8 2.4 12.6 4v4.1c0 2.5-1.9 4.3-4.6 5.2-2.7-.9-4.6-2.7-4.6-5.2V4z', 'M6.1 7.9 7.4 9.2l2.6-2.6'],
|
|
3425
|
+
// 模型:滑杆
|
|
3426
|
+
model: ['M3 5.2h10M3 10.8h10', 'M6.2 3.5v3.4M10.4 9.1v3.4'],
|
|
3427
|
+
// 下载日志:向下的箭头落到托盘
|
|
3428
|
+
export: ['M8 2.8v6.4', 'M5.4 6.9 8 9.5l2.6-2.6', 'M3.4 12.6h9.2'],
|
|
3429
|
+
// 技能:星芒
|
|
3430
|
+
skill: ['M8 2.6l1.2 3.2 3.2 1.2-3.2 1.2L8 11.4 6.8 8.2 3.6 7l3.2-1.2z'],
|
|
3431
|
+
// 对话:气泡
|
|
3432
|
+
chat: ['M3.2 4.2h9.6v6.2H7.8L4.6 13V10.4H3.2z'],
|
|
3433
|
+
// 文件夹
|
|
3434
|
+
folder: ['M2.8 5h4l1.2 1.6h5.2V12H2.8z'],
|
|
3435
|
+
// 命令(兜底)
|
|
3436
|
+
command: ['M6.2 3.6 3.4 8l2.8 4.4', 'M9.8 3.6 12.6 8l-2.8 4.4'],
|
|
3437
|
+
// 上下文 / 通用工具
|
|
3438
|
+
tool: ['M8 2.8 13 8l-5 5.2L3 8z'],
|
|
3439
|
+
}
|
|
3440
|
+
const children = (paths[kind] ?? paths.file).map((d, index) => h('path', { key: `p${index}`, d }))
|
|
3441
|
+
return ideSvg(size, children)
|
|
3442
|
+
}
|
|
3443
|
+
|
|
3342
3444
|
/** Terminal prompt (`>_`): marks a Tool step in the conversation. */
|
|
3343
3445
|
function IdeTerminalIcon({ size = 15 }) {
|
|
3344
3446
|
return ideSvg(size, [
|
|
@@ -13970,6 +14072,15 @@ function ideFloatEntryOf(raw, dir) {
|
|
|
13970
14072
|
* The `/` menu, in the conversation's own order. `action` rows are composer
|
|
13971
14073
|
* features (insert an `@`, open the model picker); the rest are Host commands.
|
|
13972
14074
|
*/
|
|
14075
|
+
/**
|
|
14076
|
+
* Commands whose visible half lives in the Conversation (a goal dialog, a plan
|
|
14077
|
+
* banner, the compact divider). Running them from the card and staying put
|
|
14078
|
+
* looks like nothing happened, so picking one also navigates back.
|
|
14079
|
+
*/
|
|
14080
|
+
const IDE_FLOAT_CHAT_COMMANDS = new Set(['goal', 'plan', 'feedback'])
|
|
14081
|
+
/** Host commands the card runs itself; the rest belong to the Conversation UI. */
|
|
14082
|
+
const IDE_FLOAT_HOST_COMMANDS = new Set(['compact', 'export', 'permission'])
|
|
14083
|
+
|
|
13973
14084
|
const IDE_FLOAT_SLASH = [
|
|
13974
14085
|
{ name: 'file', labelKey: 'floatCmdFile', section: 'add', action: 'mention' },
|
|
13975
14086
|
{ name: 'goal', labelKey: 'floatCmdGoal', descKey: 'floatCmdGoalDesc', section: 'add' },
|
|
@@ -14003,6 +14114,7 @@ function ideFloatSlashItems(catalog, skills, query, translate) {
|
|
|
14003
14114
|
alias: entry.name,
|
|
14004
14115
|
description,
|
|
14005
14116
|
section: entry.section,
|
|
14117
|
+
icon: entry.name,
|
|
14006
14118
|
})
|
|
14007
14119
|
}
|
|
14008
14120
|
const builtin = new Set(IDE_FLOAT_SLASH.map((entry) => entry.name))
|
|
@@ -14010,12 +14122,12 @@ function ideFloatSlashItems(catalog, skills, query, translate) {
|
|
|
14010
14122
|
const name = String(raw?.name ?? '')
|
|
14011
14123
|
if (name === '' || builtin.has(name)) continue
|
|
14012
14124
|
if (needle !== '' && !name.toLowerCase().includes(needle)) continue
|
|
14013
|
-
items.push({ kind: 'command', id: name, label: name, alias: '', description: String(raw?.description ?? ''), section: 'command' })
|
|
14125
|
+
items.push({ kind: 'command', id: name, label: name, alias: '', description: String(raw?.description ?? ''), section: 'command', icon: 'command' })
|
|
14014
14126
|
}
|
|
14015
14127
|
for (const raw of Array.isArray(skills) ? skills : []) {
|
|
14016
14128
|
const name = String(raw?.name ?? '')
|
|
14017
14129
|
if (name === '' || (needle !== '' && !name.toLowerCase().includes(needle))) continue
|
|
14018
|
-
items.push({ kind: 'skill', id: name, label: name, alias: '', description: String(raw?.description ?? ''), section: 'skill' })
|
|
14130
|
+
items.push({ kind: 'skill', id: name, label: name, alias: '', description: String(raw?.description ?? ''), section: 'skill', icon: 'skill' })
|
|
14019
14131
|
}
|
|
14020
14132
|
return items
|
|
14021
14133
|
}
|
|
@@ -14626,7 +14738,7 @@ function IdeFloatMarkdown({ text, tr }) {
|
|
|
14626
14738
|
* @param props.sessions - the Client `sessions` service (retention + prompt).
|
|
14627
14739
|
* @param props.modelDirectories - the model directory service the composer uses.
|
|
14628
14740
|
*/
|
|
14629
|
-
function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSession, startSession, useWorkspaces, openInWorkspace, goToChat, commandList, workspaceList, skillList }) {
|
|
14741
|
+
function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSession, startSession, useWorkspaces, openInWorkspace, goToChat, composeText, commandList, workspaceList, skillList }) {
|
|
14630
14742
|
const tr = typeof translate === 'function' ? translate : (key) => key
|
|
14631
14743
|
const state = useSyncExternalStore(store.subscribe, store.getState, store.getState)
|
|
14632
14744
|
const [binding, setBinding] = useState(null)
|
|
@@ -14653,6 +14765,7 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
14653
14765
|
const suggestSeq = useRef(0)
|
|
14654
14766
|
const commandCache = useRef(null)
|
|
14655
14767
|
const skillCache = useRef(null)
|
|
14768
|
+
const [plusItems, setPlusItems] = useState([])
|
|
14656
14769
|
const directoryCache = useRef(new Map())
|
|
14657
14770
|
const [pictures, setPictures] = useState({})
|
|
14658
14771
|
// The picture the user is looking at.
|
|
@@ -14661,6 +14774,13 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
14661
14774
|
picturesRef.current = pictures
|
|
14662
14775
|
const [projectedPreset, setProjectedPreset] = useState('')
|
|
14663
14776
|
const cardRef = useRef(null)
|
|
14777
|
+
const titleBtnRef = useRef(null)
|
|
14778
|
+
const permChipRef = useRef(null)
|
|
14779
|
+
const modelChipRef = useRef(null)
|
|
14780
|
+
const effortChipRef = useRef(null)
|
|
14781
|
+
// Where a popup opens: measured from the trigger, so a menu never lands at the
|
|
14782
|
+
// top of the card the way a flex child did.
|
|
14783
|
+
const [popup, setPopup] = useState(null)
|
|
14664
14784
|
// An Enter that confirms an IME candidate must only commit the text, never
|
|
14665
14785
|
// send: the conversation's composer behaves the same way. Some IMEs fire
|
|
14666
14786
|
// `compositionend` just before that keydown, so the timestamp covers them.
|
|
@@ -14862,11 +14982,155 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
14862
14982
|
}
|
|
14863
14983
|
}, [binding])
|
|
14864
14984
|
|
|
14985
|
+
// Menus are positioned from their trigger every time one opens: the card is
|
|
14986
|
+
// resizable and the chips sit at its bottom, so a static offset drifts.
|
|
14987
|
+
useLayoutEffect(() => {
|
|
14988
|
+
if (menu === '') { setPopup(null); return }
|
|
14989
|
+
const card = cardRef.current
|
|
14990
|
+
const chip = menu === 'sessions'
|
|
14991
|
+
? titleBtnRef.current
|
|
14992
|
+
: (menu === 'model' ? modelChipRef.current : (menu === 'effort' ? effortChipRef.current : null))
|
|
14993
|
+
const perm = menu === 'perm' ? permChipRef.current : chip
|
|
14994
|
+
const trigger = perm ?? card
|
|
14995
|
+
if (card === null || trigger === null) return
|
|
14996
|
+
const outer = card.getBoundingClientRect()
|
|
14997
|
+
const inner = trigger.getBoundingClientRect()
|
|
14998
|
+
setPopup(menu === 'sessions'
|
|
14999
|
+
? { left: Math.round(inner.left - outer.left), top: Math.round(inner.bottom - outer.top + 6) }
|
|
15000
|
+
: { right: Math.round(outer.right - inner.right), bottom: Math.round(outer.bottom - inner.top + 6) })
|
|
15001
|
+
}, [menu])
|
|
15002
|
+
|
|
14865
15003
|
const permission = projectedPreset !== '' ? projectedPreset : (preset !== '' ? preset : ideFloatPermissionOf(entries))
|
|
14866
15004
|
|
|
15005
|
+
/**
|
|
15006
|
+
* The three popups hang off their own trigger (the title, the permission chip,
|
|
15007
|
+
* the model chip). Before, they were flex children of the card, so a menu
|
|
15008
|
+
* opened at the top of the card — nowhere near the control that opened it.
|
|
15009
|
+
*/
|
|
15010
|
+
const renderSessionsMenu = () => (menu !== 'sessions' || popup === null
|
|
15011
|
+
? null
|
|
15012
|
+
: h('div', {
|
|
15013
|
+
key: 'sessions',
|
|
15014
|
+
className: 'iw-float-menu iw-float-sessions',
|
|
15015
|
+
ref: menuRef,
|
|
15016
|
+
style: { left: `${popup.left ?? 0}px`, top: `${popup.top ?? 0}px`, right: 'auto', bottom: 'auto' },
|
|
15017
|
+
}, [
|
|
15018
|
+
h('button', {
|
|
15019
|
+
key: 'new',
|
|
15020
|
+
type: 'button',
|
|
15021
|
+
className: 'iw-float-menu-item iw-float-menu-new',
|
|
15022
|
+
onClick: () => {
|
|
15023
|
+
setMenu('')
|
|
15024
|
+
if (typeof startSession === 'function') startSession()
|
|
15025
|
+
},
|
|
15026
|
+
}, `+ ${tr('floatNewSession')}`),
|
|
15027
|
+
sessionRows.length === 0
|
|
15028
|
+
? h('div', { key: 'empty', className: 'iw-float-menu-empty' }, tr('floatSessionEmpty'))
|
|
15029
|
+
: sessionGroups.map((group) => h('div', {
|
|
15030
|
+
key: `g:${group.cwd}`,
|
|
15031
|
+
className: group.current ? 'iw-float-group-current' : undefined,
|
|
15032
|
+
}, [
|
|
15033
|
+
h('div', { key: 'head', className: 'iw-float-group-head', title: group.cwd }, [
|
|
15034
|
+
h('span', { key: 'n', className: 'iw-float-group-name' }, group.title),
|
|
15035
|
+
group.current ? h('span', { key: 'c', className: 'iw-float-group-badge' }, tr('floatCurrentWorkspace')) : null,
|
|
15036
|
+
]),
|
|
15037
|
+
...group.sessions.slice(0, 30).map((row) => h('button', {
|
|
15038
|
+
key: row.sessionId,
|
|
15039
|
+
type: 'button',
|
|
15040
|
+
className: `iw-float-menu-item${row.sessionId === sessionId ? ' on' : ''}`,
|
|
15041
|
+
title: row.cwd === '' ? row.title : row.cwd,
|
|
15042
|
+
onClick: () => {
|
|
15043
|
+
setMenu('')
|
|
15044
|
+
if (typeof openSession === 'function') openSession(row.sessionId)
|
|
15045
|
+
},
|
|
15046
|
+
}, [
|
|
15047
|
+
h('span', { key: 't', className: 'iw-float-menu-label' }, row.title),
|
|
15048
|
+
row.running ? h('span', { key: 'r', className: 'iw-float-menu-group' }, tr('floatRunning')) : null,
|
|
15049
|
+
])),
|
|
15050
|
+
])),
|
|
15051
|
+
]))
|
|
15052
|
+
|
|
15053
|
+
const renderEffortMenu = () => (menu !== 'effort' || popup === null
|
|
15054
|
+
? null
|
|
15055
|
+
: h('div', {
|
|
15056
|
+
key: 'efforts',
|
|
15057
|
+
className: 'iw-float-menu',
|
|
15058
|
+
style: { right: `${popup.right ?? 0}px`, bottom: `${popup.bottom ?? 0}px`, left: 'auto', top: 'auto', minWidth: '140px' },
|
|
15059
|
+
}, [
|
|
15060
|
+
h('div', { key: 'head', className: 'iw-float-menu-head' }, tr('floatEffort')),
|
|
15061
|
+
...[{ id: '', label: tr('floatEffortDefault') }, ...efforts].map((entry) => h('button', {
|
|
15062
|
+
key: `e:${entry.id}`,
|
|
15063
|
+
type: 'button',
|
|
15064
|
+
className: `iw-float-menu-item${entry.id === (effort ?? '') ? ' on' : ''}`,
|
|
15065
|
+
onClick: () => { void chooseEffort(entry.id) },
|
|
15066
|
+
}, entry.label)),
|
|
15067
|
+
]))
|
|
15068
|
+
|
|
15069
|
+
const renderPermissionMenu = () => (menu !== 'perm' || popup === null
|
|
15070
|
+
? null
|
|
15071
|
+
: h('div', {
|
|
15072
|
+
key: 'permmenu',
|
|
15073
|
+
className: 'iw-float-menu',
|
|
15074
|
+
style: { right: `${popup.right ?? 0}px`, bottom: `${popup.bottom ?? 0}px`, left: 'auto', top: 'auto', minWidth: '160px' },
|
|
15075
|
+
},
|
|
15076
|
+
IDE_FLOAT_PERMISSIONS.map((entry) => h('button', {
|
|
15077
|
+
key: entry.id,
|
|
15078
|
+
type: 'button',
|
|
15079
|
+
className: `iw-float-menu-item${entry.id === permission ? ' on' : ''}`,
|
|
15080
|
+
onClick: () => { void choosePermission(entry.id) },
|
|
15081
|
+
}, tr(entry.labelKey)))))
|
|
15082
|
+
|
|
15083
|
+
const renderModelMenu = () => (menu !== 'model' || popup === null
|
|
15084
|
+
? null
|
|
15085
|
+
: h('div', {
|
|
15086
|
+
key: 'models',
|
|
15087
|
+
className: 'iw-float-menu',
|
|
15088
|
+
style: { right: `${popup.right ?? 0}px`, bottom: `${popup.bottom ?? 0}px`, left: 'auto', top: 'auto', minWidth: '240px' },
|
|
15089
|
+
}, options.length === 0
|
|
15090
|
+
? h('div', { key: 'none', className: 'iw-float-menu-empty' }, tr('floatModelEmpty'))
|
|
15091
|
+
: options.map((option) => h('button', {
|
|
15092
|
+
key: option.key,
|
|
15093
|
+
type: 'button',
|
|
15094
|
+
className: `iw-float-menu-item${option.model === models?.current?.model ? ' on' : ''}`,
|
|
15095
|
+
onClick: () => { void chooseModel(option) },
|
|
15096
|
+
}, [
|
|
15097
|
+
h('span', { key: 'l', className: 'iw-float-menu-label' }, option.label),
|
|
15098
|
+
h('span', { key: 'g', className: 'iw-float-menu-group' }, option.group),
|
|
15099
|
+
]))))
|
|
15100
|
+
|
|
14867
15101
|
// `/` and `@` suggestions, recomputed whenever the draft changes. The lists
|
|
14868
15102
|
// come from the Host (`commands.list` / `workspaceFiles.list`), which is the
|
|
14869
15103
|
// same pair the conversation composer reads.
|
|
15104
|
+
useEffect(() => {
|
|
15105
|
+
// The `+` button opens the same catalogue as typing `/`: DSH words its
|
|
15106
|
+
// tooltip 「添加文件或调用指令」 for exactly that reason. No cancellation on
|
|
15107
|
+
// re-render here — the io callbacks arrive as fresh closures, so cancelling
|
|
15108
|
+
// would keep losing the race with the fetch.
|
|
15109
|
+
if (menu !== 'attach') return
|
|
15110
|
+
// An empty Session has no catalogue yet: the Host waits for one, so fall
|
|
15111
|
+
// back to the rows the card can offer on its own instead of hanging.
|
|
15112
|
+
if (sessionId === '' || sessionId === undefined) {
|
|
15113
|
+
setPlusItems(ideFloatSlashItems([], [], '', tr))
|
|
15114
|
+
return
|
|
15115
|
+
}
|
|
15116
|
+
const load = async () => {
|
|
15117
|
+
if (commandCache.current === null) {
|
|
15118
|
+
const result = typeof commandList === 'function' ? await commandList(sessionId) : { value: [] }
|
|
15119
|
+
if (result?.error !== undefined) {
|
|
15120
|
+
store.setNotice(`${tr('floatSuggestFailed')}: ${String(result.error)}`)
|
|
15121
|
+
return
|
|
15122
|
+
}
|
|
15123
|
+
commandCache.current = Array.isArray(result?.value) ? result.value : []
|
|
15124
|
+
}
|
|
15125
|
+
if (skillCache.current === null) {
|
|
15126
|
+
const result = typeof skillList === 'function' ? await skillList(sessionId) : { value: [] }
|
|
15127
|
+
skillCache.current = result?.error === undefined && Array.isArray(result?.value) ? result.value : []
|
|
15128
|
+
}
|
|
15129
|
+
setPlusItems(ideFloatSlashItems(commandCache.current, skillCache.current, '', tr))
|
|
15130
|
+
}
|
|
15131
|
+
void load().catch((error) => store.setNotice(`${tr('floatSuggestFailed')}: ${error?.message ?? error}`))
|
|
15132
|
+
}, [menu, sessionId])
|
|
15133
|
+
|
|
14870
15134
|
useEffect(() => {
|
|
14871
15135
|
if (binding === null || sessionId === '') { setSuggest(null); return }
|
|
14872
15136
|
const token = ideFloatTrigger(draft, draft.length)
|
|
@@ -14928,13 +15192,13 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
14928
15192
|
.filter((entry) => needle === '' || entry.name.toLowerCase().includes(needle))
|
|
14929
15193
|
.sort((left, right) => (left.isDir === right.isDir ? left.name.localeCompare(right.name) : left.isDir ? -1 : 1))
|
|
14930
15194
|
.slice(0, 40)
|
|
14931
|
-
.map((entry) => ({ kind: entry.isDir ? 'dir' : 'file', id: entry.path, label: entry.name, alias: '', description: '', section: 'file' }))
|
|
15195
|
+
.map((entry) => ({ kind: entry.isDir ? 'dir' : 'file', id: entry.path, label: entry.name, alias: '', description: '', section: 'file', icon: entry.isDir ? 'folder' : 'file' }))
|
|
14932
15196
|
// The conversation's `@` list also offers other conversations.
|
|
14933
15197
|
const chats = sessionRows
|
|
14934
15198
|
.filter((row) => row.sessionId !== sessionId)
|
|
14935
15199
|
.filter((row) => needle === '' || String(row.title ?? '').toLowerCase().includes(needle))
|
|
14936
15200
|
.slice(0, 8)
|
|
14937
|
-
.map((row) => ({ kind: 'session', id: row.sessionId, label: row.title, alias: '', description: '', section: 'chat' }))
|
|
15201
|
+
.map((row) => ({ kind: 'session', id: row.sessionId, label: row.title, alias: '', description: '', section: 'chat', icon: 'chat' }))
|
|
14938
15202
|
setSuggest({ sign: '@', token, items: [...files, ...chats], index: 0, dir })
|
|
14939
15203
|
}
|
|
14940
15204
|
void run()
|
|
@@ -14978,11 +15242,23 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
14978
15242
|
setDraft(`${cut}/${item.id} `)
|
|
14979
15243
|
return
|
|
14980
15244
|
}
|
|
15245
|
+
// `/goal`, `/plan` and `/feedback` open DSH's own dialogs: fill the
|
|
15246
|
+
// Conversation's composer so its palette takes over.
|
|
15247
|
+
if (IDE_FLOAT_CHAT_COMMANDS.has(item.id) && typeof composeText === 'function') {
|
|
15248
|
+
Promise.resolve(composeText(`/${item.id}`)).catch((error) => {
|
|
15249
|
+
store.setNotice(`${tr('floatCommandFailed')}: ${error?.message ?? error}`)
|
|
15250
|
+
})
|
|
15251
|
+
return
|
|
15252
|
+
}
|
|
14981
15253
|
const command = binding?.session?.command
|
|
14982
15254
|
if (typeof command !== 'function') return
|
|
15255
|
+
// A dialog-driven command (`/goal`, `/plan`) stays pending until the user
|
|
15256
|
+
// closes its UI, so this must not wait on the promise: run it, land on the
|
|
15257
|
+
// Conversation where its half lives, and only report an outright rejection.
|
|
14983
15258
|
Promise.resolve(command(`/${item.id}`)).then((result) => {
|
|
14984
|
-
|
|
14985
|
-
|
|
15259
|
+
if (result?.ok === false || result?.value?.matched === false) {
|
|
15260
|
+
store.setNotice(`${tr('floatCommandFailed')}: ${item.id}`)
|
|
15261
|
+
}
|
|
14986
15262
|
}).catch((error) => {
|
|
14987
15263
|
store.setNotice(`${tr('floatCommandFailed')}: ${error?.message ?? error}`)
|
|
14988
15264
|
})
|
|
@@ -15381,6 +15657,7 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
15381
15657
|
h('button', {
|
|
15382
15658
|
key: 'name',
|
|
15383
15659
|
type: 'button',
|
|
15660
|
+
ref: titleBtnRef,
|
|
15384
15661
|
className: 'iw-float-title iw-float-title-btn',
|
|
15385
15662
|
title: `${tr('floatSessions')} · ${state.rootPath ?? ''}`,
|
|
15386
15663
|
onClick: () => setMenu(menu === 'sessions' ? '' : 'sessions'),
|
|
@@ -15418,60 +15695,10 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
15418
15695
|
}, '×'),
|
|
15419
15696
|
]),
|
|
15420
15697
|
]),
|
|
15421
|
-
|
|
15422
|
-
|
|
15423
|
-
|
|
15424
|
-
|
|
15425
|
-
type: 'button',
|
|
15426
|
-
className: 'iw-float-menu-item iw-float-menu-new',
|
|
15427
|
-
onClick: () => {
|
|
15428
|
-
setMenu('')
|
|
15429
|
-
if (typeof startSession === 'function') startSession()
|
|
15430
|
-
},
|
|
15431
|
-
}, `+ ${tr('floatNewSession')}`),
|
|
15432
|
-
sessionRows.length === 0
|
|
15433
|
-
? h('div', { key: 'empty', className: 'iw-float-menu-empty' }, tr('floatSessionEmpty'))
|
|
15434
|
-
: sessionGroups.map((group) => h('div', {
|
|
15435
|
-
key: `g:${group.cwd}`,
|
|
15436
|
-
className: group.current ? 'iw-float-group-current' : undefined,
|
|
15437
|
-
}, [
|
|
15438
|
-
h('div', {
|
|
15439
|
-
key: 'head',
|
|
15440
|
-
className: 'iw-float-group-head',
|
|
15441
|
-
title: group.cwd,
|
|
15442
|
-
}, [
|
|
15443
|
-
h('span', { key: 'n', className: 'iw-float-group-name' }, group.title),
|
|
15444
|
-
group.current ? h('span', { key: 'c', className: 'iw-float-group-badge' }, tr('floatCurrentWorkspace')) : null,
|
|
15445
|
-
]),
|
|
15446
|
-
...group.sessions.slice(0, 30).map((row) => h('button', {
|
|
15447
|
-
key: row.sessionId,
|
|
15448
|
-
type: 'button',
|
|
15449
|
-
className: `iw-float-menu-item${row.sessionId === sessionId ? ' on' : ''}`,
|
|
15450
|
-
title: row.cwd === '' ? row.title : row.cwd,
|
|
15451
|
-
onClick: () => {
|
|
15452
|
-
setMenu('')
|
|
15453
|
-
if (typeof openSession === 'function') openSession(row.sessionId)
|
|
15454
|
-
},
|
|
15455
|
-
}, [
|
|
15456
|
-
h('span', { key: 't', className: 'iw-float-menu-label' }, row.title),
|
|
15457
|
-
row.running ? h('span', { key: 'r', className: 'iw-float-menu-group' }, tr('floatRunning')) : null,
|
|
15458
|
-
])),
|
|
15459
|
-
])),
|
|
15460
|
-
])
|
|
15461
|
-
: null,
|
|
15462
|
-
menu === 'model'
|
|
15463
|
-
? h('div', { key: 'models', className: 'iw-float-menu' }, options.length === 0
|
|
15464
|
-
? h('div', { key: 'none', className: 'iw-float-menu-empty' }, tr('floatModelEmpty'))
|
|
15465
|
-
: options.map((option) => h('button', {
|
|
15466
|
-
key: option.key,
|
|
15467
|
-
type: 'button',
|
|
15468
|
-
className: `iw-float-menu-item${option.model === models?.current?.model ? ' on' : ''}`,
|
|
15469
|
-
onClick: () => { void chooseModel(option) },
|
|
15470
|
-
}, [
|
|
15471
|
-
h('span', { key: 'l', className: 'iw-float-menu-label' }, option.label),
|
|
15472
|
-
h('span', { key: 'g', className: 'iw-float-menu-group' }, option.group),
|
|
15473
|
-
])))
|
|
15474
|
-
: null,
|
|
15698
|
+
renderSessionsMenu(),
|
|
15699
|
+
renderEffortMenu(),
|
|
15700
|
+
renderModelMenu(),
|
|
15701
|
+
renderPermissionMenu(),
|
|
15475
15702
|
h('div', {
|
|
15476
15703
|
key: 'body',
|
|
15477
15704
|
className: 'iw-float-body',
|
|
@@ -15546,34 +15773,41 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
15546
15773
|
}, '×'),
|
|
15547
15774
|
])),
|
|
15548
15775
|
]),
|
|
15549
|
-
menu === 'effort'
|
|
15550
|
-
? h('div', { key: 'efforts', className: 'iw-float-menu' }, [
|
|
15551
|
-
h('div', { key: 'head', className: 'iw-float-menu-head' }, tr('floatEffort')),
|
|
15552
|
-
...[{ id: '', label: tr('floatEffortDefault') }, ...efforts].map((entry) => h('button', {
|
|
15553
|
-
key: `e:${entry.id}`,
|
|
15554
|
-
type: 'button',
|
|
15555
|
-
className: 'iw-float-menu-item',
|
|
15556
|
-
onClick: () => { void chooseEffort(entry.id) },
|
|
15557
|
-
}, entry.label)),
|
|
15558
|
-
])
|
|
15559
|
-
: null,
|
|
15560
15776
|
menu === 'attach'
|
|
15561
|
-
? h('div', { key: 'attachmenu', className: 'iw-float-
|
|
15562
|
-
|
|
15563
|
-
|
|
15564
|
-
|
|
15565
|
-
|
|
15566
|
-
|
|
15567
|
-
|
|
15568
|
-
|
|
15569
|
-
|
|
15570
|
-
|
|
15571
|
-
|
|
15572
|
-
|
|
15573
|
-
|
|
15574
|
-
|
|
15575
|
-
|
|
15576
|
-
|
|
15777
|
+
? h('div', { key: 'attachmenu', className: 'iw-float-suggest', role: 'listbox' },
|
|
15778
|
+
[
|
|
15779
|
+
// The card's own extra: the file currently open in the workspace.
|
|
15780
|
+
h('button', {
|
|
15781
|
+
key: 'plus-current',
|
|
15782
|
+
type: 'button',
|
|
15783
|
+
role: 'option',
|
|
15784
|
+
className: 'iw-float-suggest-item',
|
|
15785
|
+
onMouseDown: (event) => { event.preventDefault(); referenceOpenFile() },
|
|
15786
|
+
}, [
|
|
15787
|
+
h('span', { key: 'i', className: 'iw-float-suggest-icon' }, h(IdeMenuGlyph, { kind: 'file', size: 14 })),
|
|
15788
|
+
h('span', { key: 'n', className: 'iw-float-suggest-name' }, tr('floatAttachReference')),
|
|
15789
|
+
]),
|
|
15790
|
+
].concat(plusItems.map((item, index) => {
|
|
15791
|
+
const previous = index === 0 ? '' : (plusItems[index - 1]?.section ?? '')
|
|
15792
|
+
const titleKey = item.section !== previous ? ideFloatSectionKey(item.section) : ''
|
|
15793
|
+
return h(React.Fragment, { key: `plus:${item.kind}:${item.id}` }, [
|
|
15794
|
+
titleKey === ''
|
|
15795
|
+
? null
|
|
15796
|
+
: h('div', { key: 'section', className: 'iw-float-suggest-section', role: 'presentation' }, tr(titleKey)),
|
|
15797
|
+
h('button', {
|
|
15798
|
+
key: 'row',
|
|
15799
|
+
type: 'button',
|
|
15800
|
+
role: 'option',
|
|
15801
|
+
className: 'iw-float-suggest-item',
|
|
15802
|
+
onMouseDown: (event) => { event.preventDefault(); setMenu(''); pickSuggest(item) },
|
|
15803
|
+
}, [
|
|
15804
|
+
h('span', { key: 'i', className: 'iw-float-suggest-icon' }, h(IdeMenuGlyph, { kind: item.icon ?? 'file', size: 14 })),
|
|
15805
|
+
h('span', { key: 'n', className: 'iw-float-suggest-name' }, item.label),
|
|
15806
|
+
item.alias === '' ? null : h('span', { key: 'a', className: 'iw-float-suggest-alias' }, item.alias),
|
|
15807
|
+
h('span', { key: 'desc', className: 'iw-float-suggest-desc' }, item.description),
|
|
15808
|
+
]),
|
|
15809
|
+
])
|
|
15810
|
+
})))
|
|
15577
15811
|
: null,
|
|
15578
15812
|
suggest === null || suggest.items.length === 0
|
|
15579
15813
|
? null
|
|
@@ -15593,10 +15827,14 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
15593
15827
|
className: `iw-float-suggest-item${index === suggest.index ? ' on' : ''}`,
|
|
15594
15828
|
onMouseDown: (event) => { event.preventDefault(); pickSuggest(item) },
|
|
15595
15829
|
}, [
|
|
15830
|
+
h('span', { key: 'i', className: 'iw-float-suggest-icon' }, h(IdeMenuGlyph, { kind: item.icon ?? 'file', size: 14 })),
|
|
15596
15831
|
h('span', { key: 'n', className: 'iw-float-suggest-name' }, item.label),
|
|
15597
15832
|
item.alias === '' ? null : h('span', { key: 'a', className: 'iw-float-suggest-alias' }, item.alias),
|
|
15598
|
-
|
|
15599
|
-
|
|
15833
|
+
h('span', { key: 'desc', className: 'iw-float-suggest-desc' }, item.description),
|
|
15834
|
+
// Directories advertise the Tab key that drills in, like DSH's keycap.
|
|
15835
|
+
item.kind !== 'dir'
|
|
15836
|
+
? null
|
|
15837
|
+
: h('span', { key: 'd', className: 'iw-float-suggest-trailing' }, h('kbd', { key: 'k', className: 'iw-float-suggest-key' }, 'Tab')),
|
|
15600
15838
|
]),
|
|
15601
15839
|
])
|
|
15602
15840
|
})),
|
|
@@ -15657,6 +15895,7 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
15657
15895
|
h('button', {
|
|
15658
15896
|
key: 'perm',
|
|
15659
15897
|
type: 'button',
|
|
15898
|
+
ref: permChipRef,
|
|
15660
15899
|
className: 'iw-float-perm',
|
|
15661
15900
|
title: `${tr('floatPermission')}: ${ideFloatPermissionLabel(permission, tr)}`,
|
|
15662
15901
|
onClick: () => setMenu(menu === 'perm' ? '' : 'perm'),
|
|
@@ -15669,6 +15908,7 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
15669
15908
|
efforts.length === 0 ? null : h('button', {
|
|
15670
15909
|
key: 'effort',
|
|
15671
15910
|
type: 'button',
|
|
15911
|
+
ref: effortChipRef,
|
|
15672
15912
|
className: 'iw-float-foot-chip',
|
|
15673
15913
|
title: `${tr('floatEffort')}: ${effortLabel}`,
|
|
15674
15914
|
onClick: () => setMenu(menu === 'effort' ? '' : 'effort'),
|
|
@@ -15676,6 +15916,7 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
15676
15916
|
h('button', {
|
|
15677
15917
|
key: 'model',
|
|
15678
15918
|
type: 'button',
|
|
15919
|
+
ref: modelChipRef,
|
|
15679
15920
|
className: 'iw-float-foot-chip iw-float-foot-model',
|
|
15680
15921
|
title: tr('floatModelHint'),
|
|
15681
15922
|
onClick: () => setMenu(menu === 'model' ? '' : 'model'),
|
|
@@ -16084,6 +16325,26 @@ function apply(ctx) {
|
|
|
16084
16325
|
* The existing draft is never replaced: the caret is moved to its end first,
|
|
16085
16326
|
* so text and attachments the user already had stay untouched.
|
|
16086
16327
|
*/
|
|
16328
|
+
/**
|
|
16329
|
+
* DSH executes `/goal`-style commands in the Conversation's own front-end, not
|
|
16330
|
+
* through `session.command()` (that promise simply never settles for them).
|
|
16331
|
+
* So the card fills the Conversation's composer instead: DSH opens its own
|
|
16332
|
+
* palette and the user only presses Enter.
|
|
16333
|
+
*/
|
|
16334
|
+
async function composeInChat(text) {
|
|
16335
|
+
backToChat()
|
|
16336
|
+
const editor = await waitForProbe(() => composerEditor(), 2000)
|
|
16337
|
+
if (editor === null) {
|
|
16338
|
+
ideLogRecord('warn', 'compose', 'composer not found', text)
|
|
16339
|
+
store.setNotice(translate('floatCommandNoEditor'))
|
|
16340
|
+
return false
|
|
16341
|
+
}
|
|
16342
|
+
await new Promise((resolve) => setTimeout(resolve, 80))
|
|
16343
|
+
caretToEnd(editor)
|
|
16344
|
+
document.execCommand('insertText', false, text)
|
|
16345
|
+
return true
|
|
16346
|
+
}
|
|
16347
|
+
|
|
16087
16348
|
async function referenceToChat(path, isDir, suffix = '') {
|
|
16088
16349
|
const relative = ideRelativeTo(store.getState().rootPath, path)
|
|
16089
16350
|
const mention = ideReferenceMention(relative, isDir)
|
|
@@ -16942,6 +17203,7 @@ function apply(ctx) {
|
|
|
16942
17203
|
// An open question can only be answered in the Conversation; the card's
|
|
16943
17204
|
// button sends the user there instead of faking an answer.
|
|
16944
17205
|
goToChat: () => backToChat(),
|
|
17206
|
+
composeText: (text) => composeInChat(text),
|
|
16945
17207
|
// The card's file chips open files exactly like the conversation's file
|
|
16946
17208
|
// cards do: one workspace tab, one panel selection, no preview pane.
|
|
16947
17209
|
openInWorkspace: (path) => {
|
package/locale/en.json
CHANGED
package/locale/zh.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-ide-window",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8",
|
|
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",
|