dsh-ide-window 0.4.2 → 0.4.4
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 -0
- package/CHANGELOG.md +26 -0
- package/client.js +709 -50
- package/locale/en.json +14 -1
- package/locale/zh.json +14 -1
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -274,6 +274,7 @@ tail -f /tmp/dsh-ide-test/logs/dsh-ide-window.log # 自测实例
|
|
|
274
274
|
- 文件树右键 Java/Kotlin 文件 → 解析 `@TableName` 发 `openTable`;编辑器符号右键 → Mapper 方法发 `openSql`(`@Select` 等注解优先,其次按 namespace 在 XML 里找 statement,动态 SQL 会带注释提示原文粘贴);
|
|
275
275
|
- MyBatis 动态 SQL 会先转成可执行 SQL:`<foreach>` 展开 3 条默认值、`#{}`/`${}` 按方法签名里的参数类型填默认值(数字 `1`、字符串 `'demo'`、日期时间),SQL 头部注释列出默认参数;XML 的 `<if>/<where>/<set>/<trim>/<choose>` 会展开成静态 SQL。仍不自动执行,用户在数据窗口里改值后自己跑。
|
|
276
276
|
- **`<include refid="..."/>` 会展开再拼**(`test/data-bridge.mjs` 有用例):同文件 `<sql id>`、跨命名空间的片段、嵌套 include、include 自带的 `<property>` 都解析;解析不到的 refid 在 SQL 里留 `/* include not found: x */` 并在头部注释列出,条件被吃光后剩下的空 `WHERE` 直接去掉——绝不给数据窗口一段 `WHERE` 后面直接 `ORDER BY` 的语法错误 SQL。
|
|
277
|
+
- **标签属性里的 `>` 不算标签结束**(踩过,用户截图:SQL 中间多出一行 `0">`):`<if test="billStatusList != null and billStatusList.size() > 0">` 这种写法遍地都是,用 `[^>]*>` 匹配开标签会在属性质里的 `>` 处截断,剩下的 ` 0">` 被当成 SQL。所以所有开标签(if/when/otherwise/where/set/trim/foreach/include 的 property/bind/sql/select/兜底清理)一律用引号感知的 `IDE_DATA_WINDOW_TAG_ATTRS`(`(?:"[^"]*"|'[^']*'|[^>"'])*`)拼正则,别再手写 `[^>]*>`
|
|
277
278
|
- 本插件只解析、不执行 SQL;定位库、只读校验都在数据窗口与它的 Host 里。
|
|
278
279
|
|
|
279
280
|
### 4.4 与对话联动
|
|
@@ -333,10 +334,18 @@ tail -f /tmp/dsh-ide-test/logs/dsh-ide-window.log # 自测实例
|
|
|
333
334
|
- `@` 两节:**文件与文件夹**(`workspaceFiles.list(sessionId, dir)`,`'.'` 是根、其余相对路径、条目只有 `{name,type}`)+ **对话**(按标题过滤其他会话,选中即切换悬浮卡的会话)
|
|
334
335
|
- ↑/↓ 选、Enter/Tab 选中、Esc 关,目录**下钻**成 `@dir/`、文件变引用 chip、技能插入 `/<名字> `。菜单绝对定位在输入框上方(`.iw-float-input` 必须是 `position: relative`)
|
|
335
336
|
- **浮层挂在触发器上**:会话列表从标题 ▾ 向下、权限与模型从各自 chip 向上。菜单曾是卡片的 flex 子节点,于是点模型菜单会跑到卡片顶部——现在 `useLayoutEffect` 按触发器与卡片的 rect 算出 `left/top` 或 `right/bottom`,再用内联样式粘上去(卡片可缩放,写死偏移会漂)。`useLayoutEffect` 要记得在 `build.mjs` 的解构里导出
|
|
337
|
+
- **会话模式(Agent 预设)也显示在输入区底行**:`mode` chip 放在权限 pill 与思考/模型 chip 之间,只展示不切换(切换仍在 DSH 里做)。值读 `session.projections` 的 `agentPreset` 投影(字符串;`projections.get` / `faceOf().getSnapshot()` / 会话快照三条兜底),订阅 `faceOf('agentPreset').subscribe` 跟着变;名字优先用预设自己的 `name`(自定义模式),内置预设(`standard/ptc/minimal/cordis`)借 DSH 自己的 `settings.agentPreset` 命名空间文案(`ctx.locale.bind('settings.agentPreset')` 的 `preset*Name`),拿不到再用本插件 `floatMode*` 兜底,最后才显示 id。预设列表来自 `ctx.remote.agentPresets.list()` 的 `value.presets`
|
|
336
338
|
- **输入区 = DSH 的 composer**:一个 16px 圆角容器(内边距 `10px 10px 8px 14px`),里面是无边框 textarea(占位文案同 DSH)与底行 `+(圆形)/ 权限 pill(锁+文字+⌄)/ 空隙 / 思考等级 / 模型 chip / 圆形发送键(↑,运行中变 ■)`;引用是蓝色 chip,粘贴图片走剪贴板 `image/*`(≤4 张、单张 8 MB),发送 `prompt([image…, {text: refs + 正文}])`
|
|
337
339
|
- **跟随当前会话(`floatFollow`,默认开,持久化)**:`ideFloatTargetSession(state)` 决定卡片展示哪个会话——跟随用 `state.sessionId`;关掉后用卡片自己的 `state.floatSessionId`(只本次进程有效),DSH 里怎么切都不动。卡片标题菜单里点会话:跟随时照旧 `openSession()`,不跟随时只 `store.setFloatSessionId()`(不动面板);不跟随时菜单顶部有「不跟随当前会话 · 在下面手动切换」提示。卡片里点「+ 新建会话」用 `pinnedAdoptRef` 收养新会话,避免不跟随时新建完还停在旧会话。重新打开跟随会清掉钉子
|
|
338
340
|
- **表头**:`▾` 标题 **居中、16px、最多 20 个字**(超出加省略号,悬停给完整标题 + 工作区路径),标题颜色按**工作区**取色相(`ideFloatWorkspaceHue(path)` → `--iw-float-hue`,再和正文主色 `color-mix` 混,浅色/深色都压得住对比度);右侧 `+` 与 `–`/`×` 放在绝对定位的 `.iw-float-head-right` 里,标题才会在整条表头里真正居中
|
|
339
341
|
- **滚到顶 = 翻历史**:正文滚到顶部时(`scrollTop <= 4`)调用 `binding.session.loadOlder()` 补一页(DSH 的会话窗口是分页的:首屏 ≥50 条消息、最多 500 条),同时打开 `historyMode`——**否则补进来的旧行会被「只画本轮」过滤掉,看起来像没加载**。historyMode 下 `ideFloatVisibleRows(..., history)` 铺开整个已加载窗口的对话(`step`/`reasoning`/`context`/`notice` 仍然不画)。补完把 `scrollTop` 推到「长出来的高度」,视线不跳;`rowLimit` 每次 +200(上限 2000)让补进来的行真的出现。发消息或切会话回到「本轮状态板」;没有更多历史时滚到顶只展开已加载的历史,不再请求
|
|
342
|
+
- **到顶继续上滑 = 加载更早(回弹手势)**:正文滚到顶后继续往上滚(滚轮 `deltaY < 0` / 触摸下拉),内容被「拉」下来一段(`pull` 像素,最多 `IDE_FLOAT_PULL_MAX`),到 `IDE_FLOAT_PULL_TRIGGER`(64px)自动调 `loadOlderRows({ reveal: true })`,补完把视图移到新加载那段的开头;不用点任何按钮(用户明确要求「不想再点一次」)
|
|
343
|
+
- **不要再挂「滚到顶就加载」**:到顶立刻翻页的话,回弹一下子都看不到;`onScroll` 只管贴底状态
|
|
344
|
+
- **监听器用回调 ref 挂,不要用 effect**:`createOlderGesture(node, api)` 在 `ref={attachBody}` 里创建——节点一出现就挂、卸载就解绑。用 `useEffect` + 依赖数组时,收起成球期间 `bodyRef` 是空的,展开口很容易错过重挂,手势就整个失效(踩过:浏览器实测拉不出任何反应)。依赖里也**不能写 `collapsed`**(它在组件后面才声明,会抛 `Cannot access 'collapsed' before initialization`,整个 `shell.overlay` 槽直接崩掉、卡片整个不见)
|
|
345
|
+
- **回弹行是 flex 子项**:正文是 `flex-direction: column`,只写 `height` 会被 `flex-shrink` 压成 padding 高度(实测拉不动),必须同时写 `flex: 0 0 <h>px` + `minHeight`
|
|
346
|
+
- **高度不加 transition**:每个 wheel 事件都会重启过渡,看着像卡住;跟着滚轮实时变
|
|
347
|
+
- **补历史期间不许贴底**:贴底 effect 在 `olderRef.current.busy || pending` 时直接 return,`loadOlderRows` 先把 `stickRef.current = false`——否则补完立刻被拽回底部,看着像「没加载」
|
|
348
|
+
- **程序化滚动要防自触发**:`reveal` 把 `scrollTop` 设为 0 会再发一次 scroll 事件;`suppressUntil` 未过期时不重复加载
|
|
340
349
|
- **表头按钮**:`+` 新建、`–` 收起、`×` 关闭(模型与思考等级在输入区,别重复)
|
|
341
350
|
- **每次打开 DSH 都从「收起来」开始**:卡片存在,但只占一个 44px 圆球(`floatCollapsed` 初值 `true`,不持久化);球**由 CSS 钉在窗口右下角**(`right/bottom: 20px`,`left/top: auto`),窗口放大缩小都在原位——早先用卡片坐标算,最大化后还停在旧尺寸的位置,看着像跑到屏幕中间
|
|
342
351
|
- **窗口尺寸变化要重渲染**:`resize` 监听里 `setViewportTick` 一次,否则卡片坐标还是旧视口的夹取结果
|
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,32 @@
|
|
|
6
6
|
升级方式:DSH →「插件」→ 打开插件的「版本」区 →「检查更新」,或直接卸载后重新安装。
|
|
7
7
|
(`link:` 本地安装不参与版本检查,拉取仓库即可。)
|
|
8
8
|
|
|
9
|
+
## [0.4.4] — 2026-11-26
|
|
10
|
+
|
|
11
|
+
### 新增
|
|
12
|
+
|
|
13
|
+
- **悬浮框滚到顶继续上滑就加载更早的消息**:以前滚到顶要么没反应、要么得点一下提示。现在到顶后继续往上滚(滚轮 / 触摸下拉),内容会被「拉」下一段,到 64px 自动加载更早一页,视图停在新加载那段的开头;没有更多时直接告诉你「没有可加载的消息了 · 更多细节请移步会话框查看」。
|
|
14
|
+
|
|
15
|
+
### 改进
|
|
16
|
+
|
|
17
|
+
- **调用链不再只看 3 层**:`⌥+单击` 的调用链以前最多往上追 3 层,再往上就断了。现在一路追到没有调用方为止(只为防递归截断同一条路径),分支按实参归属重载、并按文件名排序,`⌥+单击` 看到的入口更完整。
|
|
18
|
+
|
|
19
|
+
### 修复
|
|
20
|
+
|
|
21
|
+
- **上滑手势在部分情况下完全没反应**:手势监听原来跟着渲染时机挂载,卡片收起成球再展开后可能一直挂不上,怎么拉都没反应。现在节点一出现就挂、卸载就解绑。
|
|
22
|
+
- **卡片谎称「已经到会话开头」**:以前只看会话窗口还有没有更早的页,忽略了卡片自己的行数上限,于是「上面还有内容」时也会说到了开头,和对话里看到的不一致。现在会先放开上限、再展开已加载的历史,真的没得加载了才给提示。
|
|
23
|
+
|
|
24
|
+
## [0.4.3] — 2026-11-26
|
|
25
|
+
|
|
26
|
+
### 新增
|
|
27
|
+
|
|
28
|
+
- **悬浮框显示当前会话的模式**:输入区底行(权限、思考、模型之间)新增模式 chip,值和 DSH 表头一致(标准模式 / PTC / 精简 / Cordis,自定义预设显示自己的名字),在 DSH 里换模式卡片立刻跟着变。
|
|
29
|
+
|
|
30
|
+
### 修复
|
|
31
|
+
|
|
32
|
+
- **Mapper SQL 里多出一行 `0">`**:`<if test="list.size() > 0">` 这种属性里带 `>` 的标签,被当成在 `>` 处结束,剩下的 ` 0">` 落到 SQL 中间(在数据窗口里执行就报语法错误)。现在所有标签都按引号感知解析,属性里的 `>` 不再算标签结尾。
|
|
33
|
+
- **卡片里图片加载失败只剩一枚裂图标**:消息里的 `` 如果文件已不存在,之前显示成裂图标 + 替代文字,看着像卡片坏了。现在换成一行「图片无法加载 · 文件名」,悬停显示完整路径;粘贴的附件图读取失败时同样给这行提示,不再永远停在灰色骨架。
|
|
34
|
+
|
|
9
35
|
## [0.4.2] — 2026-11-25
|
|
10
36
|
|
|
11
37
|
### 新增
|
package/client.js
CHANGED
|
@@ -342,6 +342,11 @@ window.__ModuleLoader__.load({
|
|
|
342
342
|
"floatExpand": "Expand assistant",
|
|
343
343
|
"floatEmpty": "Ask something; the answer lands in this session",
|
|
344
344
|
"floatLoadingOlder": "Loading earlier messages…",
|
|
345
|
+
"floatPullOlder": "Keep pulling for earlier messages",
|
|
346
|
+
"floatPullArmed": "Loading…",
|
|
347
|
+
"floatStartReached": "Nothing left to load here — see the conversation for the full history",
|
|
348
|
+
"floatLoadOlder": "↑ Keep scrolling up for earlier messages",
|
|
349
|
+
"floatLoadOlderHint": "Pull past the top, or click here",
|
|
345
350
|
"floatNoSession": "No session bound yet",
|
|
346
351
|
"floatNoWorkspace": "no workspace",
|
|
347
352
|
"floatPlaceholder": "Message or create a task, / for commands, @ for files or chats",
|
|
@@ -406,6 +411,12 @@ window.__ModuleLoader__.load({
|
|
|
406
411
|
"floatAttachReference": "Reference the open file",
|
|
407
412
|
"floatNeedsFile": "Open a file first",
|
|
408
413
|
"floatPermission": "Permission",
|
|
414
|
+
"floatMode": "Mode",
|
|
415
|
+
"floatImageMissing": "Image unavailable",
|
|
416
|
+
"floatModeStandard": "Standard mode",
|
|
417
|
+
"floatModePtc": "PTC mode",
|
|
418
|
+
"floatModeMinimal": "Minimal mode",
|
|
419
|
+
"floatModeCordis": "Cordis mode",
|
|
409
420
|
"floatPermissionReadOnly": "Read only",
|
|
410
421
|
"floatPermissionWorkspace": "Workspace write",
|
|
411
422
|
"floatPermissionFull": "Full access",
|
|
@@ -459,6 +470,8 @@ window.__ModuleLoader__.load({
|
|
|
459
470
|
"settingsFloatEventsHint": "List reasoning, context, Tool arguments and system events; off shows only the latest status line",
|
|
460
471
|
"floatWrap": "Wrap lines",
|
|
461
472
|
"floatLiveAnalyze": "Analyzing the request",
|
|
473
|
+
"chainRecursive": "recursive",
|
|
474
|
+
"chainTruncated": "More callers exist (display limit reached)",
|
|
462
475
|
}
|
|
463
476
|
const IDE_TEXT_ZH = {
|
|
464
477
|
"floatCommandNoEditor": "对话框还没就绪,稍后再试",
|
|
@@ -794,6 +807,11 @@ window.__ModuleLoader__.load({
|
|
|
794
807
|
"floatExpand": "展开助手",
|
|
795
808
|
"floatEmpty": "问点什么,回答会出现在当前会话里",
|
|
796
809
|
"floatLoadingOlder": "正在加载更早的消息…",
|
|
810
|
+
"floatPullOlder": "上滑加载更早",
|
|
811
|
+
"floatPullArmed": "即将加载…",
|
|
812
|
+
"floatStartReached": "没有可加载的消息了 · 更多细节请移步会话框查看",
|
|
813
|
+
"floatLoadOlder": "↑ 继续上滑加载更早",
|
|
814
|
+
"floatLoadOlderHint": "滚到顶后继续上滑,或点这里",
|
|
797
815
|
"floatNoSession": "还没有绑定会话",
|
|
798
816
|
"floatNoWorkspace": "未选择工作区",
|
|
799
817
|
"floatPlaceholder": "发消息或创建任务,/ 调用指令,@ 文件或对话",
|
|
@@ -858,6 +876,12 @@ window.__ModuleLoader__.load({
|
|
|
858
876
|
"floatAttachReference": "引用当前文件",
|
|
859
877
|
"floatNeedsFile": "先打开一个文件",
|
|
860
878
|
"floatPermission": "权限",
|
|
879
|
+
"floatMode": "模式",
|
|
880
|
+
"floatImageMissing": "图片无法加载",
|
|
881
|
+
"floatModeStandard": "标准模式",
|
|
882
|
+
"floatModePtc": "PTC 模式",
|
|
883
|
+
"floatModeMinimal": "精简模式",
|
|
884
|
+
"floatModeCordis": "Cordis 模式",
|
|
861
885
|
"floatPermissionReadOnly": "仅可查看",
|
|
862
886
|
"floatPermissionWorkspace": "工作区内修改",
|
|
863
887
|
"floatPermissionFull": "完全权限",
|
|
@@ -911,6 +935,8 @@ window.__ModuleLoader__.load({
|
|
|
911
935
|
"settingsFloatEventsHint": "把思考、上下文注入、工具参数与系统事件全部列出来;关闭时只显示最新一条状态",
|
|
912
936
|
"floatWrap": "自动换行",
|
|
913
937
|
"floatLiveAnalyze": "正在分析请求",
|
|
938
|
+
"chainRecursive": "递归",
|
|
939
|
+
"chainTruncated": "还有调用方未展开(已达展开上限)",
|
|
914
940
|
}
|
|
915
941
|
|
|
916
942
|
// ---- 00-css.js -----------------------------------------------------------
|
|
@@ -1544,6 +1570,16 @@ html.iw-select-code .iw-code .iw-vision {
|
|
|
1544
1570
|
font-size: 11px;
|
|
1545
1571
|
white-space: nowrap;
|
|
1546
1572
|
}
|
|
1573
|
+
/* A branch that stopped because the caller is already on this path. */
|
|
1574
|
+
.iw-chain-recursive {
|
|
1575
|
+
flex: none;
|
|
1576
|
+
padding: 0 7px;
|
|
1577
|
+
border-radius: 999px;
|
|
1578
|
+
background: rgba(240, 178, 107, 0.16);
|
|
1579
|
+
color: #f0b26b;
|
|
1580
|
+
font-size: 10.5px;
|
|
1581
|
+
white-space: nowrap;
|
|
1582
|
+
}
|
|
1547
1583
|
.iw-pop-section-head {
|
|
1548
1584
|
position: sticky;
|
|
1549
1585
|
top: -4px;
|
|
@@ -2682,6 +2718,19 @@ html.iw-select-code .iw-code .iw-vision {
|
|
|
2682
2718
|
var(--dsw-alias-label-primary, currentColor)
|
|
2683
2719
|
);
|
|
2684
2720
|
}
|
|
2721
|
+
.iw-float-mode {
|
|
2722
|
+
flex: 0 0 auto;
|
|
2723
|
+
max-width: 132px;
|
|
2724
|
+
overflow: hidden;
|
|
2725
|
+
text-overflow: ellipsis;
|
|
2726
|
+
white-space: nowrap;
|
|
2727
|
+
padding: 1px 7px;
|
|
2728
|
+
border-radius: var(--dsw-radius-sm, 6px);
|
|
2729
|
+
background: var(--dsw-alias-bg-layer-3, rgba(128, 128, 128, 0.12));
|
|
2730
|
+
color: var(--dsw-alias-label-secondary, inherit);
|
|
2731
|
+
font-size: 12.5px;
|
|
2732
|
+
line-height: 18px;
|
|
2733
|
+
}
|
|
2685
2734
|
.iw-float-older {
|
|
2686
2735
|
flex: 0 0 auto;
|
|
2687
2736
|
padding: 2px 0 6px;
|
|
@@ -2690,6 +2739,31 @@ html.iw-select-code .iw-code .iw-vision {
|
|
|
2690
2739
|
line-height: 18px;
|
|
2691
2740
|
color: var(--dsw-alias-label-tertiary, #81858c);
|
|
2692
2741
|
}
|
|
2742
|
+
/* 已经到顶还继续上滑:内容被拉下来一段(回弹),到阈值自动加载更早一页。 */
|
|
2743
|
+
.iw-float-puller {
|
|
2744
|
+
display: flex;
|
|
2745
|
+
align-items: flex-end;
|
|
2746
|
+
justify-content: center;
|
|
2747
|
+
overflow: hidden;
|
|
2748
|
+
padding-bottom: 4px;
|
|
2749
|
+
color: var(--dsw-alias-label-tertiary, #81858c);
|
|
2750
|
+
font-size: 12.5px;
|
|
2751
|
+
line-height: 16px;
|
|
2752
|
+
/* 高度跟着滚轮实时走,不加 transition——否则每来一个 wheel 事件都会重启过渡,
|
|
2753
|
+
看着像「拉不动」。 */
|
|
2754
|
+
}
|
|
2755
|
+
.iw-float-puller.armed { color: var(--dsw-alias-brand-primary, #4f7cf7); }
|
|
2756
|
+
/* 还有更早历史时常驻的一行提示;点一下也能加载(手势之外的口子)。 */
|
|
2757
|
+
.iw-float-older-hint {
|
|
2758
|
+
display: block;
|
|
2759
|
+
width: 100%;
|
|
2760
|
+
border: 0;
|
|
2761
|
+
background: transparent;
|
|
2762
|
+
cursor: pointer;
|
|
2763
|
+
color: var(--dsw-alias-label-tertiary, #81858c);
|
|
2764
|
+
text-align: center;
|
|
2765
|
+
}
|
|
2766
|
+
.iw-float-older-hint:hover { color: var(--dsw-alias-brand-primary, #4f7cf7); }
|
|
2693
2767
|
.iw-float-title-btn:hover { background: var(--dsw-alias-card-fill-hover, rgba(255, 255, 255, 0.08)); }
|
|
2694
2768
|
/* A model row must be clickable across its whole width, not just on the text. */
|
|
2695
2769
|
.iw-float-menu-item {
|
|
@@ -3002,6 +3076,38 @@ html.iw-select-code .iw-code .iw-vision {
|
|
|
3002
3076
|
border-radius: 6px;
|
|
3003
3077
|
border: 0.5px solid var(--dsw-alias-border-l1, rgba(255, 255, 255, 0.1));
|
|
3004
3078
|
}
|
|
3079
|
+
/* 图片文件不在了:一行说明,别只留一枚裂图标。 */
|
|
3080
|
+
.iw-float-img-missing {
|
|
3081
|
+
display: inline-flex;
|
|
3082
|
+
align-items: center;
|
|
3083
|
+
max-width: 100%;
|
|
3084
|
+
padding: 4px 10px;
|
|
3085
|
+
margin: 6px 0;
|
|
3086
|
+
border-radius: var(--dsw-radius-sm, 6px);
|
|
3087
|
+
background: var(--dsw-alias-bg-layer-3, rgba(128, 128, 128, 0.12));
|
|
3088
|
+
color: var(--dsw-alias-label-tertiary, inherit);
|
|
3089
|
+
font-size: 12.5px;
|
|
3090
|
+
line-height: 18px;
|
|
3091
|
+
overflow: hidden;
|
|
3092
|
+
text-overflow: ellipsis;
|
|
3093
|
+
white-space: nowrap;
|
|
3094
|
+
}
|
|
3095
|
+
.iw-float-pic-missing {
|
|
3096
|
+
display: flex;
|
|
3097
|
+
align-items: center;
|
|
3098
|
+
justify-content: center;
|
|
3099
|
+
max-width: 220px;
|
|
3100
|
+
min-height: 40px;
|
|
3101
|
+
padding: 6px 12px;
|
|
3102
|
+
border-radius: 8px;
|
|
3103
|
+
background: var(--dsw-alias-bg-layer-3, rgba(128, 128, 128, 0.12));
|
|
3104
|
+
color: var(--dsw-alias-label-tertiary, inherit);
|
|
3105
|
+
font-size: 12.5px;
|
|
3106
|
+
line-height: 18px;
|
|
3107
|
+
overflow: hidden;
|
|
3108
|
+
text-overflow: ellipsis;
|
|
3109
|
+
white-space: nowrap;
|
|
3110
|
+
}
|
|
3005
3111
|
.iw-float-filelist { display: flex; flex-direction: column; gap: 4px; }
|
|
3006
3112
|
.iw-float-file {
|
|
3007
3113
|
display: flex;
|
|
@@ -11594,10 +11700,14 @@ async function ideLspHoverText(store, tabPath, position) {
|
|
|
11594
11700
|
* resolving each call site to the method that contains it — is what produces the
|
|
11595
11701
|
* chain from an entry point down to the clicked method. Every node carries the
|
|
11596
11702
|
* location of its declaration, so a click in the popup is an ordinary jump.
|
|
11703
|
+
*
|
|
11704
|
+
* The walk has no depth limit: it keeps climbing level by level until a level
|
|
11705
|
+
* finds no caller at all. A branch stops early only for recursion — a caller
|
|
11706
|
+
* that already sits on the same path — so "the chain ends here" means the
|
|
11707
|
+
* entry point really was reached. The two limits below bound rows, not hops.
|
|
11597
11708
|
*/
|
|
11598
11709
|
|
|
11599
|
-
const
|
|
11600
|
-
const IDE_CHAIN_NODES = 40
|
|
11710
|
+
const IDE_CHAIN_NODES = 160
|
|
11601
11711
|
const IDE_CHAIN_CHILDREN = 6
|
|
11602
11712
|
|
|
11603
11713
|
/** The last declaration strictly above `line` (1-based) in one file. */
|
|
@@ -11676,6 +11786,85 @@ function ideChainDeclaresAt(lines, line) {
|
|
|
11676
11786
|
return ideDeclarations(lines, line - 1, line).length > 0
|
|
11677
11787
|
}
|
|
11678
11788
|
|
|
11789
|
+
/**
|
|
11790
|
+
* Index of the `(` that opens `name(...)` on one line, or `-1`.
|
|
11791
|
+
*
|
|
11792
|
+
* `indexOf(name)` alone is not enough: the receiver may contain the name
|
|
11793
|
+
* (`generateService.generate(`) and a name that is a prefix of another
|
|
11794
|
+
* identifier would point at the wrong place.
|
|
11795
|
+
*/
|
|
11796
|
+
function ideChainParenAt(text, name) {
|
|
11797
|
+
const line = String(text ?? '')
|
|
11798
|
+
let from = 0
|
|
11799
|
+
while (from < line.length) {
|
|
11800
|
+
const at = line.indexOf(name, from)
|
|
11801
|
+
if (at < 0) return -1
|
|
11802
|
+
const before = at === 0 ? '' : line[at - 1]
|
|
11803
|
+
const rest = line.slice(at + name.length)
|
|
11804
|
+
const indent = rest.length - rest.trimStart().length
|
|
11805
|
+
if (!/[\w$]/.test(before) && rest[indent] === '(') return at + name.length + indent
|
|
11806
|
+
from = at + name.length
|
|
11807
|
+
}
|
|
11808
|
+
return -1
|
|
11809
|
+
}
|
|
11810
|
+
|
|
11811
|
+
/**
|
|
11812
|
+
* How many arguments (or parameters) sit inside the `(...)` that starts at
|
|
11813
|
+
* `line`/`column`.
|
|
11814
|
+
*
|
|
11815
|
+
* `-1` means "could not read it with confidence" — the list never closes inside
|
|
11816
|
+
* a 200-line window, or it holds a comma whose nesting is ambiguous (`<>`,
|
|
11817
|
+
* `{}`, a comment). Callers must treat that as unknown, never as zero: the
|
|
11818
|
+
* count is what tells overloads apart, and a wrong number would drop a real
|
|
11819
|
+
* call edge.
|
|
11820
|
+
*/
|
|
11821
|
+
function ideChainArity(lines, line, column) {
|
|
11822
|
+
let depth = 0
|
|
11823
|
+
let commas = 0
|
|
11824
|
+
let content = false
|
|
11825
|
+
let started = false
|
|
11826
|
+
for (let index = Math.max(0, line); index < lines.length && index <= line + 200; index += 1) {
|
|
11827
|
+
const text = String(lines[index] ?? '')
|
|
11828
|
+
for (let at = index === line ? Math.max(0, column) : 0; at < text.length; at += 1) {
|
|
11829
|
+
const char = text[at]
|
|
11830
|
+
if (char === '"' || char === "'") {
|
|
11831
|
+
const quote = char
|
|
11832
|
+
at += 1
|
|
11833
|
+
while (at < text.length && text[at] !== quote) {
|
|
11834
|
+
if (text[at] === '\\') at += 1
|
|
11835
|
+
at += 1
|
|
11836
|
+
}
|
|
11837
|
+
if (started && depth === 1) content = true
|
|
11838
|
+
continue
|
|
11839
|
+
}
|
|
11840
|
+
if (char === '/' && (text[at + 1] === '/' || text[at + 1] === '*')) return -1
|
|
11841
|
+
if (char === '<' || char === '>' || char === '{' || char === '}') {
|
|
11842
|
+
if (started) return -1
|
|
11843
|
+
continue
|
|
11844
|
+
}
|
|
11845
|
+
if (char === '(') {
|
|
11846
|
+
depth += 1
|
|
11847
|
+
started = true
|
|
11848
|
+
continue
|
|
11849
|
+
}
|
|
11850
|
+
if (char === ')') {
|
|
11851
|
+
if (depth === 0) return -1
|
|
11852
|
+
depth -= 1
|
|
11853
|
+
if (depth === 0 && started) return content ? commas + 1 : 0
|
|
11854
|
+
continue
|
|
11855
|
+
}
|
|
11856
|
+
if (!started || depth !== 1) continue
|
|
11857
|
+
if (char === ',') {
|
|
11858
|
+
commas += 1
|
|
11859
|
+
content = true
|
|
11860
|
+
continue
|
|
11861
|
+
}
|
|
11862
|
+
if (char !== ' ' && char !== '\t') content = true
|
|
11863
|
+
}
|
|
11864
|
+
}
|
|
11865
|
+
return -1
|
|
11866
|
+
}
|
|
11867
|
+
|
|
11679
11868
|
/**
|
|
11680
11869
|
* Turn the caller tree into the tree the popup shows.
|
|
11681
11870
|
*
|
|
@@ -11701,6 +11890,7 @@ function ideChainInverted(tree) {
|
|
|
11701
11890
|
line: node.line,
|
|
11702
11891
|
callSite: node.callSite,
|
|
11703
11892
|
focus: node.focus === true,
|
|
11893
|
+
recursive: node.recursive === true,
|
|
11704
11894
|
children: parentOf.has(node) ? [build(parentOf.get(node))] : [],
|
|
11705
11895
|
})
|
|
11706
11896
|
return leaves.map(build)
|
|
@@ -11722,7 +11912,16 @@ function ideChainCount(node) {
|
|
|
11722
11912
|
* @returns the tree, filled in.
|
|
11723
11913
|
*/
|
|
11724
11914
|
async function ideCallChain(store, root, options = {}) {
|
|
11725
|
-
|
|
11915
|
+
// Which declarations already sit on the path from the clicked method to this
|
|
11916
|
+
// node. Recursion is the only natural stop, and it has to be per path: a
|
|
11917
|
+
// method reached through two routes is drawn on both.
|
|
11918
|
+
const tree = {
|
|
11919
|
+
...root,
|
|
11920
|
+
focus: true,
|
|
11921
|
+
children: [],
|
|
11922
|
+
chainKeys: new Set([`${root.path}:${root.line}`]),
|
|
11923
|
+
childKeys: new Set(),
|
|
11924
|
+
}
|
|
11726
11925
|
const files = new Map()
|
|
11727
11926
|
const linesOf = (path) => {
|
|
11728
11927
|
let pending = files.get(path)
|
|
@@ -11732,6 +11931,34 @@ async function ideCallChain(store, root, options = {}) {
|
|
|
11732
11931
|
}
|
|
11733
11932
|
return pending
|
|
11734
11933
|
}
|
|
11934
|
+
const declarationsByFile = new Map()
|
|
11935
|
+
const declarationsOf = (path) => {
|
|
11936
|
+
let pending = declarationsByFile.get(path)
|
|
11937
|
+
if (pending === undefined) {
|
|
11938
|
+
pending = linesOf(path).then((lines) => ideDeclarations(lines, 0, lines.length))
|
|
11939
|
+
declarationsByFile.set(path, pending)
|
|
11940
|
+
}
|
|
11941
|
+
return pending
|
|
11942
|
+
}
|
|
11943
|
+
/**
|
|
11944
|
+
* Whether a call site belongs to a different declaration of the same name.
|
|
11945
|
+
*
|
|
11946
|
+
* `findReferences` may answer with the whole overload group, and the text
|
|
11947
|
+
* fallback cannot tell two overloads apart at all — both hand a 4-argument
|
|
11948
|
+
* call to the 5-parameter method. Arity is the one thing a call site states
|
|
11949
|
+
* about itself, so it decides; when either side cannot be read the call is
|
|
11950
|
+
* kept, because a missing caller is worse than a doubtful one.
|
|
11951
|
+
*/
|
|
11952
|
+
const belongsToAnotherOverload = async (node, location) => {
|
|
11953
|
+
const callerLines = await linesOf(location.path)
|
|
11954
|
+
const open = ideChainParenAt(callerLines[location.line - 1], node.name)
|
|
11955
|
+
if (open < 0) return false
|
|
11956
|
+
const overloads = (await declarationsOf(node.path)).filter((entry) => entry.name === node.name)
|
|
11957
|
+
if (overloads.length < 2) return false
|
|
11958
|
+
const args = ideChainArity(callerLines, location.line - 1, open)
|
|
11959
|
+
const params = ideChainArity(await linesOf(node.path), node.position.line, node.position.character)
|
|
11960
|
+
return args >= 0 && params >= 0 && args !== params
|
|
11961
|
+
}
|
|
11735
11962
|
/**
|
|
11736
11963
|
* The method containing a call site, or nothing when it sits outside one.
|
|
11737
11964
|
*
|
|
@@ -11774,16 +12001,23 @@ async function ideCallChain(store, root, options = {}) {
|
|
|
11774
12001
|
return rows.map((row) => ({ path: row.path, line: row.line }))
|
|
11775
12002
|
}
|
|
11776
12003
|
|
|
11777
|
-
const seen = new Set([`${root.path}:${root.line}`])
|
|
11778
12004
|
let level = [tree]
|
|
11779
12005
|
let count = 1
|
|
11780
|
-
|
|
12006
|
+
let truncated = false
|
|
12007
|
+
while (level.length > 0) {
|
|
12008
|
+
if (count >= IDE_CHAIN_NODES) {
|
|
12009
|
+
truncated = true
|
|
12010
|
+
break
|
|
12011
|
+
}
|
|
11781
12012
|
const next = []
|
|
11782
12013
|
/** Turn caller locations into child nodes; returns how many were added. */
|
|
11783
12014
|
const attach = async (node, list) => {
|
|
11784
12015
|
let added = 0
|
|
11785
12016
|
for (const location of list) {
|
|
11786
|
-
if (count >= IDE_CHAIN_NODES
|
|
12017
|
+
if (count >= IDE_CHAIN_NODES) {
|
|
12018
|
+
truncated = true
|
|
12019
|
+
break
|
|
12020
|
+
}
|
|
11787
12021
|
if (typeof location?.path !== 'string' || typeof location?.line !== 'number') continue
|
|
11788
12022
|
// The declaration of the method we are walking is not a call to it.
|
|
11789
12023
|
if (location.path === node.path && location.line === node.line) continue
|
|
@@ -11797,15 +12031,38 @@ async function ideCallChain(store, root, options = {}) {
|
|
|
11797
12031
|
position: { line: location.line - 1, character: 0 },
|
|
11798
12032
|
}
|
|
11799
12033
|
const key = `${location.path}:${target.line}`
|
|
11800
|
-
if (
|
|
11801
|
-
|
|
12034
|
+
if (node.childKeys.has(key)) continue
|
|
12035
|
+
// A call site names its method by name alone, so it can land under the
|
|
12036
|
+
// wrong overload — the same line then shows up in two branches.
|
|
12037
|
+
if (await belongsToAnotherOverload(node, location)) continue
|
|
12038
|
+
// Checked after the filters, so the flag means a real caller was left
|
|
12039
|
+
// out — a seventh declaration on the line is not "more callers".
|
|
12040
|
+
if (added >= IDE_CHAIN_CHILDREN) {
|
|
12041
|
+
truncated = true
|
|
12042
|
+
break
|
|
12043
|
+
}
|
|
12044
|
+
node.childKeys.add(key)
|
|
11802
12045
|
count += 1
|
|
11803
12046
|
added += 1
|
|
12047
|
+
if (node.chainKeys.has(key)) {
|
|
12048
|
+
// The caller is already on this path: recursion, the one case where a
|
|
12049
|
+
// branch stops while callers still exist.
|
|
12050
|
+
node.children.push({
|
|
12051
|
+
...target,
|
|
12052
|
+
path: location.path,
|
|
12053
|
+
callSite: { path: location.path, line: location.line },
|
|
12054
|
+
recursive: true,
|
|
12055
|
+
children: [],
|
|
12056
|
+
})
|
|
12057
|
+
continue
|
|
12058
|
+
}
|
|
11804
12059
|
const child = {
|
|
11805
12060
|
...target,
|
|
11806
12061
|
path: location.path,
|
|
11807
12062
|
callSite: { path: location.path, line: location.line },
|
|
11808
12063
|
children: [],
|
|
12064
|
+
chainKeys: new Set([...node.chainKeys, key]),
|
|
12065
|
+
childKeys: new Set(),
|
|
11809
12066
|
}
|
|
11810
12067
|
node.children.push(child)
|
|
11811
12068
|
next.push(child)
|
|
@@ -11848,6 +12105,7 @@ async function ideCallChain(store, root, options = {}) {
|
|
|
11848
12105
|
}
|
|
11849
12106
|
tree.textual = textual
|
|
11850
12107
|
tree.failed = textual ? '' : failure
|
|
12108
|
+
tree.truncated = truncated
|
|
11851
12109
|
return tree
|
|
11852
12110
|
}
|
|
11853
12111
|
|
|
@@ -11857,8 +12115,45 @@ function ideChainFileOf(path) {
|
|
|
11857
12115
|
return name.endsWith('.java') ? name.slice(0, -'.java'.length) : name
|
|
11858
12116
|
}
|
|
11859
12117
|
|
|
12118
|
+
/**
|
|
12119
|
+
* Branch order for the popup: by the caller's file name, so every branch that
|
|
12120
|
+
* starts in one file sits together. A same-name tie falls back to the whole
|
|
12121
|
+
* path and then the line, which keeps the list stable while it is being filled
|
|
12122
|
+
* in level by level.
|
|
12123
|
+
*
|
|
12124
|
+
* Plain code-unit comparison, not `localeCompare`: the order must not depend on
|
|
12125
|
+
* the machine's locale (and the same list has to be checked by the tests).
|
|
12126
|
+
*/
|
|
12127
|
+
function ideChainCompareBranches(a, b) {
|
|
12128
|
+
const compare = (left, right) => (left < right ? -1 : (left > right ? 1 : 0))
|
|
12129
|
+
const byFile = compare(ideChainFileOf(a?.path ?? '').toLowerCase(), ideChainFileOf(b?.path ?? '').toLowerCase())
|
|
12130
|
+
if (byFile !== 0) return byFile
|
|
12131
|
+
const byPath = compare(String(a?.path ?? ''), String(b?.path ?? ''))
|
|
12132
|
+
if (byPath !== 0) return byPath
|
|
12133
|
+
return (Number(a?.line) || 0) - (Number(b?.line) || 0)
|
|
12134
|
+
}
|
|
12135
|
+
|
|
12136
|
+
/** The rows one branch would draw, as a single comparable string. */
|
|
12137
|
+
function ideChainSignature(node) {
|
|
12138
|
+
const site = node.callSite === undefined ? '' : node.callSite.line
|
|
12139
|
+
return `${node.path}:${node.line}@${site}/${node.children.map(ideChainSignature).join(',')}`
|
|
12140
|
+
}
|
|
12141
|
+
|
|
12142
|
+
/** One row per distinct chain: two walks that draw the same rows are noise. */
|
|
12143
|
+
function ideChainDistinct(forest) {
|
|
12144
|
+
const seen = new Set()
|
|
12145
|
+
const out = []
|
|
12146
|
+
for (const entry of forest) {
|
|
12147
|
+
const key = ideChainSignature(entry)
|
|
12148
|
+
if (seen.has(key)) continue
|
|
12149
|
+
seen.add(key)
|
|
12150
|
+
out.push(entry)
|
|
12151
|
+
}
|
|
12152
|
+
return out
|
|
12153
|
+
}
|
|
12154
|
+
|
|
11860
12155
|
/** One node card plus its children, joined by rounded elbows. */
|
|
11861
|
-
function IdeChainNode({ node, depth, onPick }) {
|
|
12156
|
+
function IdeChainNode({ node, depth, onPick, tr }) {
|
|
11862
12157
|
const where = `${ideChainFileOf(node.path)}:${node.line}`
|
|
11863
12158
|
return h('div', { className: 'iw-chain-node' }, [
|
|
11864
12159
|
h('button', {
|
|
@@ -11871,6 +12166,9 @@ function IdeChainNode({ node, depth, onPick }) {
|
|
|
11871
12166
|
h('span', { key: 'dot', className: 'iw-chain-dot' }),
|
|
11872
12167
|
h('span', { key: 'n', className: 'iw-chain-name' }, node.name),
|
|
11873
12168
|
h('span', { key: 'p', className: 'iw-chain-where' }, where),
|
|
12169
|
+
node.recursive === true
|
|
12170
|
+
? h('span', { key: 'r', className: 'iw-chain-recursive' }, tr('chainRecursive'))
|
|
12171
|
+
: null,
|
|
11874
12172
|
node.callSite === undefined
|
|
11875
12173
|
? null
|
|
11876
12174
|
: h('span', { key: 's', className: 'iw-chain-site', title: `${node.callSite.path}:${node.callSite.line}` }, `← :${node.callSite.line}`),
|
|
@@ -11882,6 +12180,7 @@ function IdeChainNode({ node, depth, onPick }) {
|
|
|
11882
12180
|
node: child,
|
|
11883
12181
|
depth: depth + 1,
|
|
11884
12182
|
onPick,
|
|
12183
|
+
tr,
|
|
11885
12184
|
}))),
|
|
11886
12185
|
])
|
|
11887
12186
|
}
|
|
@@ -11925,12 +12224,14 @@ function IdeChainPopup({ popup, tr, onPick, onClose }) {
|
|
|
11925
12224
|
const status = popup.state === 'loading'
|
|
11926
12225
|
? tr('chainLoading')
|
|
11927
12226
|
: `${count}${typeof popup.ms === 'number' ? ` · ${popup.ms}ms` : ''}`
|
|
11928
|
-
const forest = root === undefined ? [] : ideChainInverted(root)
|
|
11929
|
-
const
|
|
11930
|
-
|
|
11931
|
-
|
|
11932
|
-
|
|
11933
|
-
|
|
12227
|
+
const forest = root === undefined ? [] : ideChainDistinct(ideChainInverted(root).sort(ideChainCompareBranches))
|
|
12228
|
+
const notes = []
|
|
12229
|
+
if (root !== undefined) {
|
|
12230
|
+
if (typeof root.failed === 'string' && root.failed.startsWith('license:')) notes.push(tr('lspLicense'))
|
|
12231
|
+
else if (root.textual === true || root.failed) notes.push(tr('chainTextual'))
|
|
12232
|
+
if (root.truncated === true) notes.push(tr('chainTruncated'))
|
|
12233
|
+
}
|
|
12234
|
+
const note = notes.join(' · ')
|
|
11934
12235
|
const body = h(React.Fragment, null, [
|
|
11935
12236
|
h('div', { key: 'rule', className: 'iw-chain-rule' }, tr('chainRule')),
|
|
11936
12237
|
note === '' ? null : h('div', { key: 'note', className: 'iw-chain-note' }, note),
|
|
@@ -11941,6 +12242,7 @@ function IdeChainPopup({ popup, tr, onPick, onClose }) {
|
|
|
11941
12242
|
node: entry,
|
|
11942
12243
|
depth: 0,
|
|
11943
12244
|
onPick,
|
|
12245
|
+
tr,
|
|
11944
12246
|
}))),
|
|
11945
12247
|
])
|
|
11946
12248
|
return h('div', {
|
|
@@ -13656,6 +13958,14 @@ function IdeScreenshotEditor({ store, tr, onInsert, onCopy, onOpenSettings, onCl
|
|
|
13656
13958
|
const IDE_DATA_WINDOW_KEY = '__DSH_DATA_WINDOW_BRIDGE__'
|
|
13657
13959
|
const IDE_DATA_WINDOW_REQUEST = 'dsh-data-window:request'
|
|
13658
13960
|
const IDE_DATA_WINDOW_RESPONSE = 'dsh-data-window:response'
|
|
13961
|
+
/**
|
|
13962
|
+
* 一个标签的属性区,引号里的 `>` 不算标签结束。
|
|
13963
|
+
*
|
|
13964
|
+
* `<if test="billStatusList != null and billStatusList.size() > 0">` 这种写法到处都是;
|
|
13965
|
+
* 用 `[^>]*>` 会在第一个 `>` 处截断,把剩下的 ` 0">` 当成 SQL 留在语句里。
|
|
13966
|
+
*/
|
|
13967
|
+
const IDE_DATA_WINDOW_TAG_ATTRS = String.raw`(?:"[^"]*"|'[^']*'|[^>"'])*`
|
|
13968
|
+
|
|
13659
13969
|
const IDE_DATA_WINDOW_ACK_MS = 2000
|
|
13660
13970
|
|
|
13661
13971
|
/** Whether the data window plugin is installed and active in this page. */
|
|
@@ -13844,7 +14154,10 @@ const IDE_DATA_WINDOW_INCLUDE_DEPTH = 8
|
|
|
13844
14154
|
*/
|
|
13845
14155
|
function ideDataWindowSqlFragments(text) {
|
|
13846
14156
|
const fragments = {}
|
|
13847
|
-
const pattern =
|
|
14157
|
+
const pattern = new RegExp(
|
|
14158
|
+
`<sql\\b${IDE_DATA_WINDOW_TAG_ATTRS}\\bid\\s*=\\s*["']([^"']+)["']${IDE_DATA_WINDOW_TAG_ATTRS}>([\\s\\S]*?)<\\/\\s*sql\\s*>`,
|
|
14159
|
+
'gi',
|
|
14160
|
+
)
|
|
13848
14161
|
let match
|
|
13849
14162
|
while ((match = pattern.exec(String(text ?? ''))) !== null) {
|
|
13850
14163
|
fragments[match[1]] = match[2]
|
|
@@ -13910,7 +14223,7 @@ function ideDataWindowIncludes(body) {
|
|
|
13910
14223
|
/** `<include>` 里 `<property name=... value=.../>` 提供的占位符值。 */
|
|
13911
14224
|
function ideDataWindowIncludeProps(body) {
|
|
13912
14225
|
const props = {}
|
|
13913
|
-
for (const match of String(body ?? '').matchAll(
|
|
14226
|
+
for (const match of String(body ?? '').matchAll(new RegExp(`<property\\b${IDE_DATA_WINDOW_TAG_ATTRS}\\/?\\s*>`, 'gi'))) {
|
|
13914
14227
|
const attrs = ideDataWindowXmlAttrs(match[0])
|
|
13915
14228
|
if (attrs.name !== undefined && attrs.value !== undefined) props[attrs.name] = attrs.value
|
|
13916
14229
|
}
|
|
@@ -13987,7 +14300,7 @@ async function ideDataWindowXmlSql(root, fqcn, symbol) {
|
|
|
13987
14300
|
const text = await ideDataWindowReadFile(root, path)
|
|
13988
14301
|
if (text === '') return null
|
|
13989
14302
|
const pattern = new RegExp(
|
|
13990
|
-
`<\\s*(select|insert|update|delete)\\b
|
|
14303
|
+
`<\\s*(select|insert|update|delete)\\b${IDE_DATA_WINDOW_TAG_ATTRS}\\bid\\s*=\\s*["']${ideDataWindowEscape(symbol)}["']${IDE_DATA_WINDOW_TAG_ATTRS}>([\\s\\S]*?)<\\s*/\\s*\\1\\s*>`,
|
|
13991
14304
|
'i',
|
|
13992
14305
|
)
|
|
13993
14306
|
const match = pattern.exec(text)
|
|
@@ -14069,7 +14382,7 @@ function ideDataWindowValueFor(expr, params, index, item) {
|
|
|
14069
14382
|
/** Expand `<foreach>` into three default rows so the SQL can run as-is. */
|
|
14070
14383
|
function ideDataWindowExpandForeach(sql, params) {
|
|
14071
14384
|
let result = String(sql ?? '')
|
|
14072
|
-
const pattern =
|
|
14385
|
+
const pattern = new RegExp(`<foreach\\b(${IDE_DATA_WINDOW_TAG_ATTRS})>([\\s\\S]*?)<\\/foreach>`, 'i')
|
|
14073
14386
|
let match
|
|
14074
14387
|
while ((match = pattern.exec(result)) !== null) {
|
|
14075
14388
|
const attrs = ideDataWindowXmlAttrs(match[1])
|
|
@@ -14095,19 +14408,20 @@ function ideDataWindowStripTags(sql) {
|
|
|
14095
14408
|
let result = String(sql ?? '')
|
|
14096
14409
|
// CDATA 里是原样 SQL,先去壳,否则会被下面「未知标签」那条清理连内容一起吞掉。
|
|
14097
14410
|
result = result.replace(/<!\[CDATA\[([\s\S]*?)\]\]>/g, '$1')
|
|
14098
|
-
|
|
14099
|
-
result = result.replace(
|
|
14100
|
-
|
|
14101
|
-
const
|
|
14411
|
+
const open = (tag) => new RegExp(`<\\s*${tag}\\b${IDE_DATA_WINDOW_TAG_ATTRS}>`, 'gi')
|
|
14412
|
+
result = result.replace(open('script'), '').replace(/<\s*\/\s*script\s*>/gi, '')
|
|
14413
|
+
result = result.replace(new RegExp(`<choose\\b${IDE_DATA_WINDOW_TAG_ATTRS}>([\\s\\S]*?)<\\/choose>`, 'gi'), (whole, body) => {
|
|
14414
|
+
const when = new RegExp(`<when\\b${IDE_DATA_WINDOW_TAG_ATTRS}>([\\s\\S]*?)<\\/when>`, 'i').exec(body)
|
|
14415
|
+
const otherwise = new RegExp(`<otherwise\\b${IDE_DATA_WINDOW_TAG_ATTRS}>([\\s\\S]*?)<\\/otherwise>`, 'i').exec(body)
|
|
14102
14416
|
return when !== null ? when[1] : otherwise !== null ? otherwise[1] : ''
|
|
14103
14417
|
})
|
|
14104
|
-
result = result.replace(
|
|
14418
|
+
result = result.replace(new RegExp(`<where\\b${IDE_DATA_WINDOW_TAG_ATTRS}>([\\s\\S]*?)<\\/where>`, 'gi'), (whole, body) => (
|
|
14105
14419
|
` WHERE ${body.replace(/^\s*(and|or)\b/i, '')} `
|
|
14106
14420
|
))
|
|
14107
|
-
result = result.replace(
|
|
14421
|
+
result = result.replace(new RegExp(`<set\\b${IDE_DATA_WINDOW_TAG_ATTRS}>([\\s\\S]*?)<\\/set>`, 'gi'), (whole, body) => (
|
|
14108
14422
|
` SET ${body.replace(/,\s*$/, '')} `
|
|
14109
14423
|
))
|
|
14110
|
-
result = result.replace(
|
|
14424
|
+
result = result.replace(new RegExp(`<trim\\b(${IDE_DATA_WINDOW_TAG_ATTRS})>([\\s\\S]*?)<\\/trim>`, 'gi'), (whole, attrText, body) => {
|
|
14111
14425
|
const attrs = ideDataWindowXmlAttrs(attrText)
|
|
14112
14426
|
let inner = body
|
|
14113
14427
|
for (const prefix of String(attrs.prefixOverrides ?? '').split('|')) {
|
|
@@ -14121,14 +14435,14 @@ function ideDataWindowStripTags(sql) {
|
|
|
14121
14435
|
return `${String(attrs.prefix ?? '').trim()} ${inner} ${String(attrs.suffix ?? '').trim()}`
|
|
14122
14436
|
})
|
|
14123
14437
|
for (const tag of ['if', 'when', 'otherwise']) {
|
|
14124
|
-
const pattern = new RegExp(`<\\s*${tag}\\b
|
|
14438
|
+
const pattern = new RegExp(`<\\s*${tag}\\b${IDE_DATA_WINDOW_TAG_ATTRS}>([\\s\\S]*?)<\\s*/\\s*${tag}\\s*>`, 'gi')
|
|
14125
14439
|
result = result.replace(pattern, '$1')
|
|
14126
14440
|
}
|
|
14127
|
-
result = result.replace(
|
|
14441
|
+
result = result.replace(new RegExp(`<bind\\b${IDE_DATA_WINDOW_TAG_ATTRS}\\/?\\s*>`, 'gi'), '')
|
|
14128
14442
|
// Anything left (foreach and include are already expanded) is an unsupported tag: drop it.
|
|
14129
14443
|
// 只认「XML 形状」的标签(字母或 `!` 开头):`a < 5` 解出来是比较运算符,
|
|
14130
14444
|
// 按 `<[^>]+>` 删会把 `<` 到后面某个 `>` 之间的真实 SQL 一起吞掉。
|
|
14131
|
-
result = result.replace(
|
|
14445
|
+
result = result.replace(new RegExp(`<\\/?[A-Za-z!]${IDE_DATA_WINDOW_TAG_ATTRS}>`, 'g'), '')
|
|
14132
14446
|
// `<where>` may have wrapped its leading AND/OR inside a stripped `<if>`.
|
|
14133
14447
|
result = result.replace(/\bWHERE\s+(AND|OR)\b/gi, 'WHERE')
|
|
14134
14448
|
// 条件被动态标签或解析失败的 include 吃光后只剩一个 WHERE,留着就是语法错误。
|
|
@@ -14236,6 +14550,15 @@ async function ideDataWindowOpenMapper(store, tr, root, path, symbol, line) {
|
|
|
14236
14550
|
// everything but the last few rows off a long turn; the card scrolls, so the
|
|
14237
14551
|
// whole tail of the log is worth keeping.
|
|
14238
14552
|
const IDE_FLOAT_MESSAGES = 200
|
|
14553
|
+
/** 往回翻历史时卡片最多渲染这么多行(再多就该去对话里看了)。 */
|
|
14554
|
+
const IDE_FLOAT_MESSAGES_MAX = 1200
|
|
14555
|
+
/** 上拉回弹:到阈值自动加载更早一页(像素)。 */
|
|
14556
|
+
const IDE_FLOAT_PULL_TRIGGER = 64
|
|
14557
|
+
/** 回弹最多拉这么高,再多也没有意义。 */
|
|
14558
|
+
const IDE_FLOAT_PULL_MAX = 96
|
|
14559
|
+
/** 停止滚动这么久后回弹归零。 */
|
|
14560
|
+
const IDE_FLOAT_PULL_IDLE_MS = 420
|
|
14561
|
+
|
|
14239
14562
|
/** 表头标题最多显示多少个字(超出加省略号)。 */
|
|
14240
14563
|
const IDE_FLOAT_TITLE_CHARS = 20
|
|
14241
14564
|
/** Longest text a folded row shows once opened; longer payloads are clipped. */
|
|
@@ -14395,6 +14718,113 @@ function ideFloatTargetSession(state) {
|
|
|
14395
14718
|
return pinned !== '' ? pinned : panel
|
|
14396
14719
|
}
|
|
14397
14720
|
|
|
14721
|
+
/**
|
|
14722
|
+
* 往回翻历史时的下一步。判定与副作用分开,方便测。
|
|
14723
|
+
*
|
|
14724
|
+
* `hasMore` 只说明窗口里还有没有更早的**页**;卡片自己还有 `rowLimit` 这个渲染上限,
|
|
14725
|
+
* 两者不是一回事——早先只看 `hasMore`,于是在「上限截掉了更早的行」时也宣布
|
|
14726
|
+
* 「已经到会话开头」,和 DSH 对话显示的开头对不上(用户实测反馈)。
|
|
14727
|
+
*/
|
|
14728
|
+
function ideFloatOlderStep(state) {
|
|
14729
|
+
const hasMore = state?.hasMore === true
|
|
14730
|
+
const total = Number(state?.total ?? 0)
|
|
14731
|
+
const limit = Number(state?.limit ?? 0)
|
|
14732
|
+
const history = state?.history === true
|
|
14733
|
+
if (state?.loadable === false) return 'none'
|
|
14734
|
+
if (hasMore) return 'load'
|
|
14735
|
+
// 窗口没有更早的页了,但手里的行还没放完:先放开上限。
|
|
14736
|
+
if (total > limit) return 'raise'
|
|
14737
|
+
// 放完了,但正文还停在「本轮状态板」:先展开整段已加载的历史。
|
|
14738
|
+
if (!history) return 'expand'
|
|
14739
|
+
return 'start'
|
|
14740
|
+
}
|
|
14741
|
+
|
|
14742
|
+
/** 会话的模式:`agentPreset` 投影的值(字符串或 `{currentValue}`,没配置就是空)。 */
|
|
14743
|
+
function ideFloatPresetId(value) {
|
|
14744
|
+
if (typeof value === 'string') return value
|
|
14745
|
+
if (value !== null && typeof value === 'object' && typeof value.currentValue === 'string') return value.currentValue
|
|
14746
|
+
return ''
|
|
14747
|
+
}
|
|
14748
|
+
|
|
14749
|
+
/** 模式的名字:自定义预设用自己的名字,内置预设交给调用方翻译,最后兜底 id。 */
|
|
14750
|
+
function ideFloatPresetName(presets, id, translate) {
|
|
14751
|
+
if (typeof id !== 'string' || id === '') return ''
|
|
14752
|
+
const entry = Array.isArray(presets) ? presets.find((item) => item?.id === id) : undefined
|
|
14753
|
+
const named = typeof entry?.name === 'string' ? entry.name.trim() : ''
|
|
14754
|
+
if (named !== '') return named
|
|
14755
|
+
const text = typeof translate === 'function' ? translate(id) : ''
|
|
14756
|
+
return typeof text === 'string' && text !== '' ? text : id
|
|
14757
|
+
}
|
|
14758
|
+
|
|
14759
|
+
/**
|
|
14760
|
+
* 到顶继续上滑的手势:累积回弹距离,到阈值回调 `load`。
|
|
14761
|
+
*
|
|
14762
|
+
* 返回解绑函数。所有可变输入都走 `api`(`pull` 是同一个对象引用、`setPull` 是稳定的
|
|
14763
|
+
* setState),所以监听器不需要随每次渲染重建。
|
|
14764
|
+
*/
|
|
14765
|
+
function createOlderGesture(node, api) {
|
|
14766
|
+
const settle = (timer) => {
|
|
14767
|
+
if (timer !== 0) globalThis.clearTimeout(timer)
|
|
14768
|
+
}
|
|
14769
|
+
const reset = () => {
|
|
14770
|
+
api.pull.value = 0
|
|
14771
|
+
api.setPull(0)
|
|
14772
|
+
}
|
|
14773
|
+
const decay = () => {
|
|
14774
|
+
settle(api.pull.timer)
|
|
14775
|
+
api.pull.timer = globalThis.setTimeout(reset, IDE_FLOAT_PULL_IDLE_MS)
|
|
14776
|
+
}
|
|
14777
|
+
const push = (distance) => {
|
|
14778
|
+
if (api.isBusy() === true) return
|
|
14779
|
+
if (node.scrollTop > 2) return
|
|
14780
|
+
const next = Math.min(IDE_FLOAT_PULL_MAX, api.pull.value + distance)
|
|
14781
|
+
api.pull.value = next
|
|
14782
|
+
api.setPull(next)
|
|
14783
|
+
if (next >= IDE_FLOAT_PULL_TRIGGER) {
|
|
14784
|
+
settle(api.pull.timer)
|
|
14785
|
+
reset()
|
|
14786
|
+
api.load({ reveal: true })
|
|
14787
|
+
return
|
|
14788
|
+
}
|
|
14789
|
+
decay()
|
|
14790
|
+
}
|
|
14791
|
+
const onWheel = (event) => {
|
|
14792
|
+
if (event.deltaY >= 0) return
|
|
14793
|
+
// 到顶了才拦:否则正常滚动会被吃掉。
|
|
14794
|
+
if (node.scrollTop > 2) return
|
|
14795
|
+
event.preventDefault()
|
|
14796
|
+
push(-event.deltaY)
|
|
14797
|
+
}
|
|
14798
|
+
let touchY = null
|
|
14799
|
+
const onTouchStart = (event) => {
|
|
14800
|
+
touchY = event.touches?.[0]?.clientY ?? null
|
|
14801
|
+
}
|
|
14802
|
+
const onTouchMove = (event) => {
|
|
14803
|
+
if (touchY === null) return
|
|
14804
|
+
const y = event.touches?.[0]?.clientY ?? touchY
|
|
14805
|
+
const delta = y - touchY
|
|
14806
|
+
touchY = y
|
|
14807
|
+
if (delta <= 0) return
|
|
14808
|
+
if (node.scrollTop > 2) return
|
|
14809
|
+
push(delta)
|
|
14810
|
+
}
|
|
14811
|
+
const onTouchEnd = () => {
|
|
14812
|
+
touchY = null
|
|
14813
|
+
decay()
|
|
14814
|
+
}
|
|
14815
|
+
node.addEventListener('wheel', onWheel, { passive: false })
|
|
14816
|
+
node.addEventListener('touchstart', onTouchStart, { passive: true })
|
|
14817
|
+
node.addEventListener('touchmove', onTouchMove, { passive: true })
|
|
14818
|
+
node.addEventListener('touchend', onTouchEnd, { passive: true })
|
|
14819
|
+
return () => {
|
|
14820
|
+
settle(api.pull.timer)
|
|
14821
|
+
node.removeEventListener('wheel', onWheel)
|
|
14822
|
+
node.removeEventListener('touchstart', onTouchStart)
|
|
14823
|
+
node.removeEventListener('touchmove', onTouchMove)
|
|
14824
|
+
node.removeEventListener('touchend', onTouchEnd)
|
|
14825
|
+
}
|
|
14826
|
+
}
|
|
14827
|
+
|
|
14398
14828
|
/** 表头标题最多 `limit` 个字,超出用省略号——再长就分不清是哪个会话了。 */
|
|
14399
14829
|
function ideFloatTitleText(text, limit = IDE_FLOAT_TITLE_CHARS) {
|
|
14400
14830
|
const value = String(text ?? '').trim()
|
|
@@ -14545,7 +14975,12 @@ function ideFloatRow(row, tr, io) {
|
|
|
14545
14975
|
const body = row.text === '' ? null : h(IdeFloatMarkdown, { key: 'text', text: row.text, tr })
|
|
14546
14976
|
const pics = row.images === undefined || row.images.length === 0 ? null : h('div', { key: 'pics', className: 'iw-float-pics' }, row.images.map((image, index) => {
|
|
14547
14977
|
const url = pictures[image.attachmentId] ?? ''
|
|
14548
|
-
|
|
14978
|
+
// 还没读到用骨架,读失败用一行提示(`''` 是「试过了、失败」的标记)。
|
|
14979
|
+
if (url === '') {
|
|
14980
|
+
return Object.prototype.hasOwnProperty.call(picturesRef.current, image.attachmentId)
|
|
14981
|
+
? h('div', { key: `pic${index}`, className: 'iw-float-pic iw-float-pic-missing' }, `${tr('floatImageMissing')}${image.name === undefined ? '' : ` · ${image.name}`}`)
|
|
14982
|
+
: h('div', { key: `pic${index}`, className: 'iw-float-pic iw-float-pic-wait' })
|
|
14983
|
+
}
|
|
14549
14984
|
return h('img', {
|
|
14550
14985
|
key: `pic${index}`,
|
|
14551
14986
|
className: 'iw-float-pic',
|
|
@@ -15741,8 +16176,38 @@ function ideFloatFileUrl(path) {
|
|
|
15741
16176
|
}
|
|
15742
16177
|
}
|
|
15743
16178
|
|
|
16179
|
+
/**
|
|
16180
|
+
* 一张 markdown 图:加载不出来就换成一行提示。
|
|
16181
|
+
*
|
|
16182
|
+
* 助手有时会写 `` 指向已经不存在的文件(临时截图被清理了),
|
|
16183
|
+
* 浏览器只会给一枚裂图标 + alt 文字,看着像卡片坏了。这里显式说明「图片无法加载」
|
|
16184
|
+
* 并带上文件名,悬停给完整路径。
|
|
16185
|
+
*/
|
|
16186
|
+
function IdeFloatImage(props) {
|
|
16187
|
+
// 一个 props 参数、不解构:测试里的 grabSource 按花括号配平取函数体,
|
|
16188
|
+
// 解构里的 `{ ... }` 会被当成函数结尾。
|
|
16189
|
+
const src = props?.src
|
|
16190
|
+
const alt = props?.alt
|
|
16191
|
+
const path = props?.path
|
|
16192
|
+
const tr = props?.tr
|
|
16193
|
+
const [failed, setFailed] = useState(false)
|
|
16194
|
+
if (failed === true) {
|
|
16195
|
+
const name = String(path ?? '').split(/[\\/]/).pop() || String(alt ?? '')
|
|
16196
|
+
return h('span', {
|
|
16197
|
+
className: 'iw-float-img-missing',
|
|
16198
|
+
title: path === undefined ? name : String(path),
|
|
16199
|
+
}, name === '' ? tr('floatImageMissing') : `${tr('floatImageMissing')} · ${name}`)
|
|
16200
|
+
}
|
|
16201
|
+
return h('img', {
|
|
16202
|
+
className: 'iw-float-md-img',
|
|
16203
|
+
src,
|
|
16204
|
+
alt,
|
|
16205
|
+
onError: () => setFailed(true),
|
|
16206
|
+
})
|
|
16207
|
+
}
|
|
16208
|
+
|
|
15744
16209
|
/** One inline markdown run: code, bold, emphasis, strike, links, images, autolinks. */
|
|
15745
|
-
function ideFloatInline(text, prefix = '') {
|
|
16210
|
+
function ideFloatInline(text, prefix = '', tr) {
|
|
15746
16211
|
const nodes = []
|
|
15747
16212
|
const pattern = new RegExp([
|
|
15748
16213
|
'`+[^`]*`+', // inline code, any number of backticks
|
|
@@ -15781,7 +16246,14 @@ function ideFloatInline(text, prefix = '') {
|
|
|
15781
16246
|
const localImage = image === null ? '' : ideFloatFileUrl(image[2])
|
|
15782
16247
|
const src = localImage !== '' ? localImage : image === null ? '' : ideFloatSafeUrl(image[2], true)
|
|
15783
16248
|
if (src === '') pushText(image === null ? token : image[1])
|
|
15784
|
-
else nodes.push(h(
|
|
16249
|
+
else nodes.push(h(IdeFloatImage, {
|
|
16250
|
+
key,
|
|
16251
|
+
src,
|
|
16252
|
+
alt: image[1],
|
|
16253
|
+
// 本地路径的图才可能「文件没了」;网络图加载失败也给同一句提示。
|
|
16254
|
+
path: image[2],
|
|
16255
|
+
tr: typeof tr === 'function' ? tr : (key) => key,
|
|
16256
|
+
}))
|
|
15785
16257
|
} else if (token.startsWith('[')) {
|
|
15786
16258
|
const link = /^\[([^\]]+)\]\(([^)]+)\)$/.exec(token)
|
|
15787
16259
|
const localLink = link === null ? '' : ideFloatFileUrl(link[2])
|
|
@@ -16031,19 +16503,19 @@ function IdeFloatMarkdown({ text, tr }) {
|
|
|
16031
16503
|
return h('div', { className: 'iw-float-md' }, blocks.map((block, index) => {
|
|
16032
16504
|
const key = `b${index}`
|
|
16033
16505
|
if (block.type === 'code') return h(IdeFloatCodeBlock, { key, code: block.text, lang: block.lang, tr })
|
|
16034
|
-
if (block.type === 'heading') return h('div', { key, className: `iw-float-md-h iw-float-md-h${block.level}` }, ideFloatInline(block.text, key))
|
|
16506
|
+
if (block.type === 'heading') return h('div', { key, className: `iw-float-md-h iw-float-md-h${block.level}` }, ideFloatInline(block.text, key, tr))
|
|
16035
16507
|
if (block.type === 'hr') return h('div', { key, className: 'iw-float-md-hr' })
|
|
16036
|
-
if (block.type === 'quote') return h('blockquote', { key, className: 'iw-float-md-quote' }, ideFloatInline(block.text, key))
|
|
16508
|
+
if (block.type === 'quote') return h('blockquote', { key, className: 'iw-float-md-quote' }, ideFloatInline(block.text, key, tr))
|
|
16037
16509
|
if (block.type === 'table') {
|
|
16038
16510
|
return h('div', { key, className: 'iw-float-md-tablewrap' }, h('table', { key: 't', className: 'iw-float-md-table' }, [
|
|
16039
16511
|
h('thead', { key: 'head' }, h('tr', { key: 'row' }, block.head.map((cell, column) => h('th', {
|
|
16040
16512
|
key: `c${column}`,
|
|
16041
16513
|
className: cellClass(block.align[column]),
|
|
16042
|
-
}, ideFloatInline(cell, `${key}h${column}
|
|
16514
|
+
}, ideFloatInline(cell, `${key}h${column}`, tr))))),
|
|
16043
16515
|
h('tbody', { key: 'body' }, block.rows.map((row, rowIndex) => h('tr', { key: `r${rowIndex}` }, block.head.map((_, column) => h('td', {
|
|
16044
16516
|
key: `c${column}`,
|
|
16045
16517
|
className: cellClass(block.align[column]),
|
|
16046
|
-
}, ideFloatInline(row[column] ?? '', `${key}r${rowIndex}c${column}
|
|
16518
|
+
}, ideFloatInline(row[column] ?? '', `${key}r${rowIndex}c${column}`, tr)))))),
|
|
16047
16519
|
]))
|
|
16048
16520
|
}
|
|
16049
16521
|
if (block.type === 'ul' || block.type === 'ol') {
|
|
@@ -16057,10 +16529,10 @@ function IdeFloatMarkdown({ text, tr }) {
|
|
|
16057
16529
|
item.task === null || item.task === undefined
|
|
16058
16530
|
? null
|
|
16059
16531
|
: h('span', { key: 'check', className: 'iw-float-md-check' }, item.task === true ? '☑' : '☐'),
|
|
16060
|
-
...ideFloatInline(item.text.replace(/\n/g, ' '), `${key}l${itemIndex}
|
|
16532
|
+
...ideFloatInline(item.text.replace(/\n/g, ' '), `${key}l${itemIndex}`, tr),
|
|
16061
16533
|
])))
|
|
16062
16534
|
}
|
|
16063
|
-
return h('p', { key, className: 'iw-float-md-p' }, ideFloatInline(block.text, key))
|
|
16535
|
+
return h('p', { key, className: 'iw-float-md-p' }, ideFloatInline(block.text, key, tr))
|
|
16064
16536
|
}))
|
|
16065
16537
|
}
|
|
16066
16538
|
|
|
@@ -16070,7 +16542,7 @@ function IdeFloatMarkdown({ text, tr }) {
|
|
|
16070
16542
|
* @param props.sessions - the Client `sessions` service (retention + prompt).
|
|
16071
16543
|
* @param props.modelDirectories - the model directory service the composer uses.
|
|
16072
16544
|
*/
|
|
16073
|
-
function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSession, startSession, useWorkspaces, openInWorkspace, goToChat, composeText, commandList, workspaceList, skillList }) {
|
|
16545
|
+
function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSession, startSession, useWorkspaces, openInWorkspace, goToChat, composeText, commandList, workspaceList, skillList, modeList, modeLabel }) {
|
|
16074
16546
|
const tr = typeof translate === 'function' ? translate : (key) => key
|
|
16075
16547
|
const state = useSyncExternalStore(store.subscribe, store.getState, store.getState)
|
|
16076
16548
|
const [binding, setBinding] = useState(null)
|
|
@@ -16081,7 +16553,25 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
16081
16553
|
const olderRef = useRef({ busy: false, pending: false, height: 0 })
|
|
16082
16554
|
// 「+ 新建会话」之后,不跟随时把卡片收养到新会话上(只认卡片自己发起的创建)。
|
|
16083
16555
|
const pinnedAdoptRef = useRef(false)
|
|
16556
|
+
// 上拉回弹的实时值(不在 state 里累积,避免每帧渲染整个卡片)。
|
|
16557
|
+
const pullRef = useRef({ value: 0, timer: 0 })
|
|
16558
|
+
// 监听器里要调最新的 loadOlderRows(每次渲染都会重建)。
|
|
16559
|
+
const loadOlderRef = useRef(null)
|
|
16560
|
+
const olderAvailableRef = useRef(false)
|
|
16561
|
+
// 当前窗口折出来的总行数(含被 rowLimit 截掉的部分)。
|
|
16562
|
+
const transcriptTotalRef = useRef(0)
|
|
16563
|
+
// 回调 ref 挂上的手势清理函数(节点卸载或重新渲染时先解绑)。
|
|
16564
|
+
const gestureCleanupRef = useRef(null)
|
|
16084
16565
|
const [olderBusy, setOlderBusy] = useState(false)
|
|
16566
|
+
// 会话窗口里还有没有更早的一页(有才允许上拉加载)。
|
|
16567
|
+
const [olderAvailable, setOlderAvailable] = useState(false)
|
|
16568
|
+
// 上拉到顶后的「回弹」高度:内容整体往下推,松手/到阈值就加载。
|
|
16569
|
+
const [pull, setPull] = useState(0)
|
|
16570
|
+
// 拉到顶时的提示(已到开头 / 只保留最近若干行):一句话,看完自己消失。
|
|
16571
|
+
const [startHint, setStartHint] = useState('')
|
|
16572
|
+
// 会话的模式(Agent 预设):DSH 表头显示的就是它,卡片只展示不改。
|
|
16573
|
+
const [presetId, setPresetId] = useState('')
|
|
16574
|
+
const [presets, setPresets] = useState([])
|
|
16085
16575
|
// 卡片默认只画最后 200 行;用户主动往回翻时按步长放宽,别让补进来的行被裁掉。
|
|
16086
16576
|
const [rowLimit, setRowLimit] = useState(IDE_FLOAT_MESSAGES)
|
|
16087
16577
|
// 滚到顶 = 用户想看历史:整段对话铺开,直到发消息或切会话才回到「本轮状态板」。
|
|
@@ -16157,6 +16647,8 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
16157
16647
|
code: result?.error?.code ?? 'unknown',
|
|
16158
16648
|
message: result?.error?.message ?? '',
|
|
16159
16649
|
})
|
|
16650
|
+
// 读不出来就别留一个永远转圈的骨架:标成失败,渲染成「图片无法加载」。
|
|
16651
|
+
setPictures((current) => (current[image.attachmentId] !== undefined ? current : { ...current, [image.attachmentId]: '' }))
|
|
16160
16652
|
return
|
|
16161
16653
|
}
|
|
16162
16654
|
const data = result.value?.data
|
|
@@ -16184,6 +16676,44 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
16184
16676
|
stickRef.current = true
|
|
16185
16677
|
}, [state.floatOpen])
|
|
16186
16678
|
|
|
16679
|
+
// 会话的模式:投影一变就跟着变(在 DSH 里换模式,卡片立刻同步)。
|
|
16680
|
+
useEffect(() => {
|
|
16681
|
+
if (binding === null) {
|
|
16682
|
+
setPresetId('')
|
|
16683
|
+
return undefined
|
|
16684
|
+
}
|
|
16685
|
+
const projections = binding.session?.projections
|
|
16686
|
+
if (projections === undefined || projections === null) return undefined
|
|
16687
|
+
const face = typeof projections.faceOf === 'function' ? projections.faceOf('agentPreset') : undefined
|
|
16688
|
+
const read = () => {
|
|
16689
|
+
const direct = typeof projections.get === 'function' ? projections.get('agentPreset') : undefined
|
|
16690
|
+
const fromFace = typeof face?.getSnapshot === 'function' ? face.getSnapshot() : undefined
|
|
16691
|
+
const fromSession = typeof binding.session?.getSnapshot === 'function'
|
|
16692
|
+
? binding.session.getSnapshot()?.projectionValues?.agentPreset
|
|
16693
|
+
: undefined
|
|
16694
|
+
setPresetId(ideFloatPresetId(direct) || ideFloatPresetId(fromFace) || ideFloatPresetId(fromSession))
|
|
16695
|
+
}
|
|
16696
|
+
read()
|
|
16697
|
+
const off = typeof face?.subscribe === 'function' ? face.subscribe(read) : projections.subscribeAny?.(read)
|
|
16698
|
+
return () => {
|
|
16699
|
+
if (typeof off === 'function') off()
|
|
16700
|
+
}
|
|
16701
|
+
}, [binding])
|
|
16702
|
+
|
|
16703
|
+
// 预设列表只为「自定义模式」的名字;拿不到就只显示内置模式的名字。
|
|
16704
|
+
useEffect(() => {
|
|
16705
|
+
if (typeof modeList !== 'function') return undefined
|
|
16706
|
+
let cancelled = false
|
|
16707
|
+
Promise.resolve(modeList())
|
|
16708
|
+
.then((result) => {
|
|
16709
|
+
if (cancelled) return
|
|
16710
|
+
if (Array.isArray(result?.value)) setPresets(result.value)
|
|
16711
|
+
else if (result?.error !== undefined) ideLogRecord('warn', 'float', 'presets failed', String(result.error))
|
|
16712
|
+
})
|
|
16713
|
+
.catch((error) => { if (cancelled !== true) ideLogRecord('warn', 'float', 'presets failed', error?.message ?? String(error)) })
|
|
16714
|
+
return () => { cancelled = true }
|
|
16715
|
+
}, [modeList])
|
|
16716
|
+
|
|
16187
16717
|
// 不跟随时,第一次进入就把面板当前会话钉住;之后 DSH 里怎么切都不动。
|
|
16188
16718
|
useEffect(() => {
|
|
16189
16719
|
if (state.floatFollow !== false) return
|
|
@@ -16203,25 +16733,54 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
16203
16733
|
|
|
16204
16734
|
// 滚到「更早」补一页:DSH 的会话窗口是分页的(首屏 ≥50 条消息、最多 500 条),
|
|
16205
16735
|
// 卡片自己不请求就只能看到那一屏。补完把滚动位置往下推同样高度,视觉上停在原处。
|
|
16206
|
-
const loadOlderRows = async () => {
|
|
16736
|
+
const loadOlderRows = async (options) => {
|
|
16737
|
+
// 点「加载更早的消息」是明确要看旧内容:补完把视图挪到新加载那段的开头。
|
|
16738
|
+
// 滚到顶触发时相反——保持原位置,新内容自然出现在上方。
|
|
16739
|
+
const reveal = options?.reveal === true
|
|
16207
16740
|
const session = binding?.session
|
|
16208
16741
|
const source = binding?.eventSource
|
|
16209
16742
|
if (olderRef.current.busy) return
|
|
16743
|
+
// 往回翻就不再跟着最新一条走:否则补完历史,负责「贴底」的那个 effect 会
|
|
16744
|
+
// 立刻把视图拽回底部,用户根本看不到刚加载出来的旧消息。
|
|
16745
|
+
stickRef.current = false
|
|
16210
16746
|
const element = bodyRef.current
|
|
16211
16747
|
const taller = () => (element === null || element === undefined ? 0 : element.scrollHeight)
|
|
16212
16748
|
const hasMore = source?.getSnapshot()?.hasMore === true
|
|
16213
16749
|
const canLoad = session !== undefined && session !== null && typeof session.loadOlder === 'function'
|
|
16214
16750
|
// 已经到会话开头(或这条会话没有分页):不用请求,只把历史展开,
|
|
16215
16751
|
// 让已经拿到的更早内容显示出来。
|
|
16216
|
-
|
|
16217
|
-
|
|
16752
|
+
const step = ideFloatOlderStep({
|
|
16753
|
+
hasMore,
|
|
16754
|
+
loadable: canLoad,
|
|
16755
|
+
total: transcriptTotalRef.current,
|
|
16756
|
+
limit: rowLimit,
|
|
16757
|
+
history: historyMode,
|
|
16758
|
+
})
|
|
16759
|
+
if (step === 'raise') {
|
|
16760
|
+
// 上限截掉了更早的行:先把它放出来,绝不在这时候说「已经到开头」。
|
|
16218
16761
|
olderRef.current.height = taller()
|
|
16762
|
+
olderRef.current.top = element === null || element === undefined ? 0 : element.scrollTop
|
|
16763
|
+
setRowLimit(Math.min(transcriptTotalRef.current, IDE_FLOAT_MESSAGES_MAX))
|
|
16764
|
+
olderRef.current.pending = true
|
|
16765
|
+
return
|
|
16766
|
+
}
|
|
16767
|
+
if (step === 'expand') {
|
|
16768
|
+
// 展开「已加载但被本轮过滤掉」的历史。
|
|
16769
|
+
olderRef.current.height = taller()
|
|
16770
|
+
olderRef.current.top = element === null || element === undefined ? 0 : element.scrollTop
|
|
16219
16771
|
setHistoryMode(true)
|
|
16220
16772
|
olderRef.current.pending = true
|
|
16221
16773
|
return
|
|
16222
16774
|
}
|
|
16775
|
+
if (step === 'start' || step === 'none') {
|
|
16776
|
+
// 没得加载了就直说,并把人引到会话框——卡片不是阅读器,细节去对话看。
|
|
16777
|
+
setStartHint(tr('floatStartReached'))
|
|
16778
|
+
globalThis.setTimeout(() => setStartHint(''), 2600)
|
|
16779
|
+
return
|
|
16780
|
+
}
|
|
16223
16781
|
olderRef.current.busy = true
|
|
16224
16782
|
olderRef.current.height = taller()
|
|
16783
|
+
olderRef.current.top = element === null || element === undefined ? 0 : element.scrollTop
|
|
16225
16784
|
setOlderBusy(true)
|
|
16226
16785
|
if (!historyMode) setHistoryMode(true)
|
|
16227
16786
|
try {
|
|
@@ -16229,6 +16788,7 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
16229
16788
|
// 窗口补进来了,但卡片只画最后 N 行;放宽上限,让补进来的行真的出现。
|
|
16230
16789
|
setRowLimit((current) => Math.min(current + IDE_FLOAT_MESSAGES, IDE_FLOAT_MESSAGES * 10))
|
|
16231
16790
|
olderRef.current.pending = true
|
|
16791
|
+
olderRef.current.reveal = reveal
|
|
16232
16792
|
} catch (error) {
|
|
16233
16793
|
ideLogRecord('warn', 'float', 'load older failed', error?.message ?? String(error))
|
|
16234
16794
|
} finally {
|
|
@@ -16237,6 +16797,29 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
16237
16797
|
}
|
|
16238
16798
|
}
|
|
16239
16799
|
|
|
16800
|
+
// 已经到顶还继续往上滑:内容被「拉」下来一段,到阈值就自动加载更早一页。
|
|
16801
|
+
// 监听器挂在 body 节点上,用回调 ref(节点一出现就挂),不依赖 effect 的依赖数组:
|
|
16802
|
+
// 收起成球时 body 不存在,靠 effect 重挂很容易错过,手势就整个失效(踩过)。
|
|
16803
|
+
const attachBody = (node) => {
|
|
16804
|
+
if (typeof gestureCleanupRef.current === 'function') {
|
|
16805
|
+
gestureCleanupRef.current()
|
|
16806
|
+
gestureCleanupRef.current = null
|
|
16807
|
+
}
|
|
16808
|
+
bodyRef.current = node
|
|
16809
|
+
if (node === null || node === undefined) return
|
|
16810
|
+
gestureCleanupRef.current = createOlderGesture(node, {
|
|
16811
|
+
isBusy: () => olderRef.current.busy === true,
|
|
16812
|
+
load: (options) => {
|
|
16813
|
+
if (typeof loadOlderRef.current === 'function') void loadOlderRef.current(options)
|
|
16814
|
+
},
|
|
16815
|
+
pull: pullRef.current,
|
|
16816
|
+
setPull,
|
|
16817
|
+
})
|
|
16818
|
+
}
|
|
16819
|
+
|
|
16820
|
+
loadOlderRef.current = loadOlderRows
|
|
16821
|
+
olderAvailableRef.current = olderAvailable
|
|
16822
|
+
|
|
16240
16823
|
// 新行渲染完再量高度:把滚动条往下推「长出来的那一段」,视线不跳。
|
|
16241
16824
|
useLayoutEffect(() => {
|
|
16242
16825
|
const older = olderRef.current
|
|
@@ -16244,8 +16827,16 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
16244
16827
|
const element = bodyRef.current
|
|
16245
16828
|
if (element === null || element === undefined) return
|
|
16246
16829
|
const grown = element.scrollHeight - older.height
|
|
16247
|
-
//
|
|
16248
|
-
|
|
16830
|
+
// 下面这行是自己滚动:滚动事件会再进来一次,别把它当成用户在往回翻。
|
|
16831
|
+
older.suppressUntil = Date.now() + 800
|
|
16832
|
+
if (older.reveal === true) {
|
|
16833
|
+
// 明确点了「加载更早」:直接看到新加载的那段(它的开头就是最上面一行)。
|
|
16834
|
+
element.scrollTop = 0
|
|
16835
|
+
} else if (grown > 0) {
|
|
16836
|
+
// 滚到顶触发的:按点击时看到的位置还原,新内容自然出现在上方。
|
|
16837
|
+
element.scrollTop = Math.max(0, Number(older.top ?? 0) + grown)
|
|
16838
|
+
}
|
|
16839
|
+
older.reveal = false
|
|
16249
16840
|
older.height = element.scrollHeight
|
|
16250
16841
|
older.pending = false
|
|
16251
16842
|
})
|
|
@@ -16256,6 +16847,8 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
16256
16847
|
useEffect(() => {
|
|
16257
16848
|
const element = bodyRef.current
|
|
16258
16849
|
if (element === null || element === undefined || stickRef.current !== true) return undefined
|
|
16850
|
+
// 正在往回补历史:这时候贴到底就等于把刚加载出来的旧消息藏起来。
|
|
16851
|
+
if (olderRef.current.busy === true || olderRef.current.pending === true) return undefined
|
|
16259
16852
|
const toBottom = () => { element.scrollTop = element.scrollHeight }
|
|
16260
16853
|
toBottom()
|
|
16261
16854
|
// A picture or a code block grows the transcript after it lays out, which
|
|
@@ -16302,14 +16895,20 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
16302
16895
|
setRowLimit((current) => (current === IDE_FLOAT_MESSAGES ? current : IDE_FLOAT_MESSAGES))
|
|
16303
16896
|
olderRef.current = { busy: false, pending: false, height: 0 }
|
|
16304
16897
|
setHistoryMode(false)
|
|
16898
|
+
setOlderAvailable(false)
|
|
16305
16899
|
return undefined
|
|
16306
16900
|
}
|
|
16307
16901
|
const source = binding.eventSource
|
|
16308
16902
|
const read = () => {
|
|
16309
|
-
const
|
|
16903
|
+
const snapshot = source.getSnapshot()
|
|
16904
|
+
const raw = snapshot?.entries
|
|
16310
16905
|
// The transcript drops Tool calls; the progress line needs them.
|
|
16311
16906
|
rawEntries.current = Array.isArray(raw) ? raw : []
|
|
16312
|
-
|
|
16907
|
+
// 一次折出全部行,再按上限截断:这样才能判断「截掉的那些是不是比窗口还早」。
|
|
16908
|
+
const all = ideFloatTranscript(raw)
|
|
16909
|
+
transcriptTotalRef.current = all.length
|
|
16910
|
+
setEntries(all.length > rowLimit ? all.slice(-rowLimit) : all)
|
|
16911
|
+
setOlderAvailable(snapshot?.hasMore === true)
|
|
16313
16912
|
}
|
|
16314
16913
|
read()
|
|
16315
16914
|
return source.subscribe(read)
|
|
@@ -17416,15 +18015,36 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
17416
18015
|
h('div', {
|
|
17417
18016
|
key: 'body',
|
|
17418
18017
|
className: 'iw-float-body',
|
|
17419
|
-
ref:
|
|
18018
|
+
ref: attachBody,
|
|
17420
18019
|
onScroll: (event) => {
|
|
17421
18020
|
const element = event.currentTarget
|
|
17422
18021
|
stickRef.current = element.scrollTop + element.clientHeight >= element.scrollHeight - 40
|
|
17423
|
-
//
|
|
17424
|
-
|
|
18022
|
+
// 加载更早一页不在这里触发:到顶后继续上滑由上面的回弹累积器负责,
|
|
18023
|
+
// 否则一碰到顶就立刻翻页,用户根本看不到「拉扯」的那一下。
|
|
17425
18024
|
},
|
|
17426
18025
|
}, [
|
|
17427
|
-
|
|
18026
|
+
startHint !== '' && pull === 0
|
|
18027
|
+
? h('div', { key: 'start', className: 'iw-float-older' }, startHint)
|
|
18028
|
+
: olderBusy
|
|
18029
|
+
? h('div', { key: 'older', className: 'iw-float-older' }, tr('floatLoadingOlder'))
|
|
18030
|
+
: pull > 0
|
|
18031
|
+
? h('div', {
|
|
18032
|
+
key: 'older',
|
|
18033
|
+
className: `iw-float-puller${pull >= IDE_FLOAT_PULL_TRIGGER * 0.75 ? ' armed' : ''}`,
|
|
18034
|
+
// 正文是 flex 列:只写 height 会被 flex-shrink 压回 padding 高度,
|
|
18035
|
+
// 必须连 `flex` 一起钉住,回弹才拉得出来。
|
|
18036
|
+
style: { height: `${pull}px`, flex: `0 0 ${pull}px`, minHeight: `${pull}px` },
|
|
18037
|
+
}, pull >= IDE_FLOAT_PULL_TRIGGER * 0.75 ? tr('floatPullArmed') : tr('floatPullOlder'))
|
|
18038
|
+
: olderAvailable
|
|
18039
|
+
// 常驻一行提示:让人知道这个方向还有内容(点一下也能加载,手势失灵时的兜底)。
|
|
18040
|
+
? h('button', {
|
|
18041
|
+
key: 'older',
|
|
18042
|
+
type: 'button',
|
|
18043
|
+
className: 'iw-float-older iw-float-older-hint',
|
|
18044
|
+
title: tr('floatLoadOlderHint'),
|
|
18045
|
+
onClick: () => { void loadOlderRows({ reveal: true }) },
|
|
18046
|
+
}, tr('floatLoadOlder'))
|
|
18047
|
+
: null,
|
|
17428
18048
|
visibleEntries.length === 0 && running !== true
|
|
17429
18049
|
? h('div', { key: 'empty', className: 'iw-float-empty' }, sessionId === '' ? tr('floatNoSession') : tr('floatEmpty'))
|
|
17430
18050
|
: visibleEntries.map((row) => {
|
|
@@ -17655,6 +18275,11 @@ function IdeFloatingAsk({ store, sessions, modelDirectories, translate, openSess
|
|
|
17655
18275
|
h('span', { key: 't', className: 'iw-float-perm-text' }, ideFloatPermissionLabel(permission, tr)),
|
|
17656
18276
|
h(IdeChevronDownIcon, { key: 'c', size: 12 }),
|
|
17657
18277
|
]),
|
|
18278
|
+
presetId === '' ? null : h('span', {
|
|
18279
|
+
key: 'mode',
|
|
18280
|
+
className: 'iw-float-mode',
|
|
18281
|
+
title: `${tr('floatMode')}: ${ideFloatPresetName(presets, presetId, modeLabel)}`,
|
|
18282
|
+
}, ideFloatPresetName(presets, presetId, modeLabel)),
|
|
17658
18283
|
h('span', { key: 'gap', className: 'iw-float-gap' }),
|
|
17659
18284
|
efforts.length === 0 ? null : h('button', {
|
|
17660
18285
|
key: 'effort',
|
|
@@ -17811,6 +18436,16 @@ function apply(ctx) {
|
|
|
17811
18436
|
void error
|
|
17812
18437
|
}
|
|
17813
18438
|
const translate = ideMakeTranslator(ctx, bound)
|
|
18439
|
+
// 会话模式的标签:内置预设(standard/ptc/minimal/cordis)没有 name,文案在 DSH
|
|
18440
|
+
// 自己的 `settings.agentPreset` 命名空间里。借它的文案,和表头显示的一致。
|
|
18441
|
+
let presetText
|
|
18442
|
+
try {
|
|
18443
|
+
presetText = ctx.locale !== undefined && typeof ctx.locale.bind === 'function'
|
|
18444
|
+
? ctx.locale.bind('settings.agentPreset')
|
|
18445
|
+
: undefined
|
|
18446
|
+
} catch (error) {
|
|
18447
|
+
void error
|
|
18448
|
+
}
|
|
17814
18449
|
|
|
17815
18450
|
/**
|
|
17816
18451
|
* The palette's command list.
|
|
@@ -18950,6 +19585,30 @@ function apply(ctx) {
|
|
|
18950
19585
|
return { error: String(error?.message ?? error) }
|
|
18951
19586
|
}
|
|
18952
19587
|
},
|
|
19588
|
+
// 会话的模式 = Agent 预设;卡片只展示,切换仍在 DSH 里做。
|
|
19589
|
+
modeList: async () => {
|
|
19590
|
+
try {
|
|
19591
|
+
const result = await ctx.remote.agentPresets.list()
|
|
19592
|
+
if (result?.ok === false) return { error: result.error?.message ?? result.error?.code ?? 'failed' }
|
|
19593
|
+
const presets = result?.value?.presets
|
|
19594
|
+
return { value: Array.isArray(presets) ? presets : [] }
|
|
19595
|
+
} catch (error) {
|
|
19596
|
+
return { error: String(error?.message ?? error) }
|
|
19597
|
+
}
|
|
19598
|
+
},
|
|
19599
|
+
/** 内置预设的中文/英文名;返回空串表示「不是内置预设」,交给调用方兜底。 */
|
|
19600
|
+
modeLabel: (id) => {
|
|
19601
|
+
const builtin = { standard: 'Standard', ptc: 'Ptc', minimal: 'Minimal', cordis: 'Cordis' }[id]
|
|
19602
|
+
if (builtin === undefined) return ''
|
|
19603
|
+
const key = `preset${builtin}Name`
|
|
19604
|
+
try {
|
|
19605
|
+
const text = typeof presetText === 'function' ? presetText(key) : undefined
|
|
19606
|
+
if (typeof text === 'string' && text.trim() !== '' && text !== key) return text
|
|
19607
|
+
} catch (error) {
|
|
19608
|
+
void error
|
|
19609
|
+
}
|
|
19610
|
+
return translate(`floatMode${builtin}`)
|
|
19611
|
+
},
|
|
18953
19612
|
workspaceList: async (sessionId, path) => {
|
|
18954
19613
|
try {
|
|
18955
19614
|
const result = await ctx.remote.workspaceFiles.list(sessionId, path)
|
package/locale/en.json
CHANGED
|
@@ -336,6 +336,11 @@
|
|
|
336
336
|
"floatExpand": "Expand assistant",
|
|
337
337
|
"floatEmpty": "Ask something; the answer lands in this session",
|
|
338
338
|
"floatLoadingOlder": "Loading earlier messages…",
|
|
339
|
+
"floatPullOlder": "Keep pulling for earlier messages",
|
|
340
|
+
"floatPullArmed": "Loading…",
|
|
341
|
+
"floatStartReached": "Nothing left to load here — see the conversation for the full history",
|
|
342
|
+
"floatLoadOlder": "↑ Keep scrolling up for earlier messages",
|
|
343
|
+
"floatLoadOlderHint": "Pull past the top, or click here",
|
|
339
344
|
"floatNoSession": "No session bound yet",
|
|
340
345
|
"floatNoWorkspace": "no workspace",
|
|
341
346
|
"floatPlaceholder": "Message or create a task, / for commands, @ for files or chats",
|
|
@@ -400,6 +405,12 @@
|
|
|
400
405
|
"floatAttachReference": "Reference the open file",
|
|
401
406
|
"floatNeedsFile": "Open a file first",
|
|
402
407
|
"floatPermission": "Permission",
|
|
408
|
+
"floatMode": "Mode",
|
|
409
|
+
"floatImageMissing": "Image unavailable",
|
|
410
|
+
"floatModeStandard": "Standard mode",
|
|
411
|
+
"floatModePtc": "PTC mode",
|
|
412
|
+
"floatModeMinimal": "Minimal mode",
|
|
413
|
+
"floatModeCordis": "Cordis mode",
|
|
403
414
|
"floatPermissionReadOnly": "Read only",
|
|
404
415
|
"floatPermissionWorkspace": "Workspace write",
|
|
405
416
|
"floatPermissionFull": "Full access",
|
|
@@ -452,5 +463,7 @@
|
|
|
452
463
|
"settingsFloatEvents": "Show full detail",
|
|
453
464
|
"settingsFloatEventsHint": "List reasoning, context, Tool arguments and system events; off shows only the latest status line",
|
|
454
465
|
"floatWrap": "Wrap lines",
|
|
455
|
-
"floatLiveAnalyze": "Analyzing the request"
|
|
466
|
+
"floatLiveAnalyze": "Analyzing the request",
|
|
467
|
+
"chainRecursive": "recursive",
|
|
468
|
+
"chainTruncated": "More callers exist (display limit reached)"
|
|
456
469
|
}
|
package/locale/zh.json
CHANGED
|
@@ -336,6 +336,11 @@
|
|
|
336
336
|
"floatExpand": "展开助手",
|
|
337
337
|
"floatEmpty": "问点什么,回答会出现在当前会话里",
|
|
338
338
|
"floatLoadingOlder": "正在加载更早的消息…",
|
|
339
|
+
"floatPullOlder": "上滑加载更早",
|
|
340
|
+
"floatPullArmed": "即将加载…",
|
|
341
|
+
"floatStartReached": "没有可加载的消息了 · 更多细节请移步会话框查看",
|
|
342
|
+
"floatLoadOlder": "↑ 继续上滑加载更早",
|
|
343
|
+
"floatLoadOlderHint": "滚到顶后继续上滑,或点这里",
|
|
339
344
|
"floatNoSession": "还没有绑定会话",
|
|
340
345
|
"floatNoWorkspace": "未选择工作区",
|
|
341
346
|
"floatPlaceholder": "发消息或创建任务,/ 调用指令,@ 文件或对话",
|
|
@@ -400,6 +405,12 @@
|
|
|
400
405
|
"floatAttachReference": "引用当前文件",
|
|
401
406
|
"floatNeedsFile": "先打开一个文件",
|
|
402
407
|
"floatPermission": "权限",
|
|
408
|
+
"floatMode": "模式",
|
|
409
|
+
"floatImageMissing": "图片无法加载",
|
|
410
|
+
"floatModeStandard": "标准模式",
|
|
411
|
+
"floatModePtc": "PTC 模式",
|
|
412
|
+
"floatModeMinimal": "精简模式",
|
|
413
|
+
"floatModeCordis": "Cordis 模式",
|
|
403
414
|
"floatPermissionReadOnly": "仅可查看",
|
|
404
415
|
"floatPermissionWorkspace": "工作区内修改",
|
|
405
416
|
"floatPermissionFull": "完全权限",
|
|
@@ -452,5 +463,7 @@
|
|
|
452
463
|
"settingsFloatEvents": "显示详细过程",
|
|
453
464
|
"settingsFloatEventsHint": "把思考、上下文注入、工具参数与系统事件全部列出来;关闭时只显示最新一条状态",
|
|
454
465
|
"floatWrap": "自动换行",
|
|
455
|
-
"floatLiveAnalyze": "正在分析请求"
|
|
466
|
+
"floatLiveAnalyze": "正在分析请求",
|
|
467
|
+
"chainRecursive": "递归",
|
|
468
|
+
"chainTruncated": "还有调用方未展开(已达展开上限)"
|
|
456
469
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-ide-window",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
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",
|