pi-web-ui 0.107.0 → 0.109.0
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/CHANGELOG.md +59 -10
- package/dist/server/agent-formatters.js +19 -4
- package/dist/server/agent-service.js +28 -6
- package/dist/server/bg-servers.js +205 -53
- package/dist/server/client-state.js +8 -3
- package/dist/server/dispatch-domain-handlers.js +2 -0
- package/dist/server/dsh/dsh-agent-service.js +11 -2
- package/dist/server/files-service.js +15 -1
- package/dist/server/model-admin.js +61 -10
- package/dist/server/preset-fields.js +14 -0
- package/dist/server/preset-share.js +2 -0
- package/dist/server/process-utils.js +114 -12
- package/dist/server/protocol-version.js +1 -1
- package/dist/server/settings-service.js +7 -3
- package/dist/server/text-sniff.js +2 -0
- package/dist/server/universal/universal-session.js +4 -1
- package/package.json +2 -1
- package/themes/aetheris.css +6 -3
- package/themes/ayu-light.css +19 -15
- package/themes/catppuccin-latte.css +17 -15
- package/themes/catppuccin.css +5 -2
- package/themes/claude-code-dark.css +2 -0
- package/themes/codex.css +16 -14
- package/themes/cyberpunk.css +4 -1
- package/themes/dark-teal.css +4 -1
- package/themes/dazzle.css +3 -0
- package/themes/everforest-light.css +17 -15
- package/themes/flow-light.css +8 -6
- package/themes/flow.css +12 -10
- package/themes/geist.css +16 -14
- package/themes/gruvbox-light.css +13 -11
- package/themes/kanagawa-lotus.css +16 -14
- package/themes/mist.css +18 -16
- package/themes/nord.css +16 -12
- package/themes/one-dark.css +9 -5
- package/themes/paper.css +9 -7
- package/themes/rose-pine-dawn.css +14 -12
- package/themes/sakura.css +15 -13
- package/themes/solarized-light.css +19 -17
- package/themes/tokyo-night.css +4 -2
- package/themes/vs-code-dark.css +4 -3
- package/themes/wallpaper-flow.css +2 -0
- package/themes/wallpaper-obsidian.css +3 -0
- package/themes/white.css +8 -6
- package/themes/zhujian-dark.css +5 -3
- package/themes/zhujian.css +5 -3
- package/themes/zhupi-dark.css +5 -3
- package/themes/zhupi.css +5 -3
- package/web/dist/assets/{TerminalPanel-BnViyTlx.js → TerminalPanel-BD3a9o-a.js} +1 -1
- package/web/dist/assets/index-AccytlpP.css +1 -0
- package/web/dist/assets/index-B3dar1BK.js +690 -0
- package/web/dist/index.html +2 -2
- package/web/dist/sw.js +1 -1
- package/web/dist/assets/index-cCRCYMwT.css +0 -1
- package/web/dist/assets/index-fH5vhkAE.js +0 -690
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,56 @@
|
|
|
8
8
|
每个版本的内容按"实际合入该版本发布的提交"归档(以 `package.json` 的 version 变更提交为准),
|
|
9
9
|
而不是按提交日期聚类——连续快速发布的 patch 版本以此为准最准确。
|
|
10
10
|
|
|
11
|
+
## [0.109.0] — 2026-10-19
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- **「工具按需加载」出厂默认关闭**:新装 / 未改过该开关的实例开箱即用全部工具,与 pi 命令行一致——模型不会因为忘记先 `load_tools` 而白吃一次「工具不存在」(#652)。需要省上下文的实例在 设置 → 工具 → 工具按需加载 里打开,或者用 `PI_WEB_TOOL_LAZY_LOADING=1` 把部署级默认改回去;**已存盘的设置不受影响**。
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- **延迟加载下「直呼未加载工具」的死路(#652)**:模型直接调用目录里尚未加载的工具时,SDK 会回一条 `Tool <name> not found`,而旧实现只把工具名记进「已加载」集合、没有重放门控,`load_tools` 又回「已经加载过了」——只有改去加载别的工具才自愈。现在直呼即**自动激活**(下一轮就真的可用,原样重试成功),`load_tools` 的「已加载」也改按**活跃集**判断。
|
|
20
|
+
- **浅色主题下按钮与标记文字隐形**:强调色 / 语义色(`--accent` / `--green` / `--red` / `--amber` / `--blue` 等)做实心底时写死的白字,在浅色主题里几乎看不见(flow 主题主按钮 1.00:1、默认主题 `--amber` 1.67:1)。新增 `--accent-contrast` 与 `--on-*` 前景令牌、由主题各自声明,30 套主题与 22 个内置插件同步;主题里「当文字用」的 16 个令牌补上了明暗下限(1120 组检查从 279 组不达标、最差 1.50:1 → 全部达标,最低 3.08:1),半透明染色底也改走语义令牌。
|
|
21
|
+
- **目录选择器 / 项目管理弹层背景发虚、SSH 表单主按钮被裁**:两者改用 Portal 挂到 `body`(原先被底栏 `opacity` 层层相乘、又锁在祖先 stacking context 里),`.cwd-ssh-form` 的「选择目录」主按钮粘底,矮窗口下不再被面板下沿裁掉。
|
|
22
|
+
|
|
23
|
+
### i18n
|
|
24
|
+
|
|
25
|
+
- 前端中文变更(1):`toolLazyLoadingDesc`
|
|
26
|
+
- 前端英文变更(1):`toolLazyLoadingDesc`
|
|
27
|
+
|
|
28
|
+
## [0.108.0] — 2026-10-18
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
|
|
32
|
+
- **集中式「插件设置」面板 (Plugin Settings Center)**:
|
|
33
|
+
- 顶栏插件菜单新增「插件设置」入口,一屏集中管理所有插件的启用状态与参数配置,不必再逐个进设置页翻找;
|
|
34
|
+
- 支持「全部 / 可配置 / 已启用 / 已停用」筛选与插件名称、ID、描述关键词搜索,卡片直观标注「可配置 / 界面 / 后台 / N 个工具」徽标;
|
|
35
|
+
- 支持批量展开/折叠配置、单卡快速配置,并可一键跳转插件市场做高级管理。
|
|
36
|
+
- **插件菜单分组**:插件菜单按「功能界面」与「扩展组件」分栏展示,界面插件与工具型扩展一目了然。
|
|
37
|
+
- **向上分页加载 (Reverse Pagination)**:设置 › 界面 › 新增开关。开启后默认只挂载最近消息,向上滚动或点击「加载前 N 条 / 全部展开」按需取更早历史,完全不使用视口占位符,超长会话滚动更接近原生流畅度。
|
|
38
|
+
- **输入框文字跨对话保留**:设置 › 界面 › 新增开关。开启后输入的文字在切换会话时不再清空,可跨对话延续;关闭时各会话草稿严格独立,切回原会话照常恢复。
|
|
39
|
+
- **`browser-use` 插件升级 0.9.0:常驻 Chrome 自动化 + 智能搜索**:
|
|
40
|
+
- 新增 `browser_search` 搜索工具:专用工作标签页隔离、无图极速渲染(CDP 阻断图片/字体/媒体)、搜阅一体(搜索结果与首条正文一次返回)、时效过滤(24 小时 / 周 / 月 / 年)、官网与权威源认证置顶、域名多样性、真实落地页还原与反爬降级链重试;
|
|
41
|
+
- 新增插件设置项:无头模式(默认静默后台运行)、默认搜索引擎、极速搜索、搜索标签页隔离、闲置自动关闭时长;
|
|
42
|
+
- `read_page` 纯净阅读增强(表格转 Markdown、代码语法高亮);后台任务面板统一精确管理,支持一键停止。
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
|
|
46
|
+
- **后台服务误报治理**:新增「创建时序 + 进程链完整性 + 桌面安装路径」三重判定,WPS、腾讯 ima 等随桌面软件启动的常驻进程不再被误判为 AI 拉起,后台服务面板更贴近真实任务(#651)。
|
|
47
|
+
- 消息编辑区的「取消 / 从这条重问」改用标准按钮样式,与其余操作区视觉统一。
|
|
48
|
+
|
|
49
|
+
### Fixed
|
|
50
|
+
|
|
51
|
+
- 会话切换结转草稿时,仅在目标会话没有自己的草稿时才写入,避免覆盖该会话已保留的输入内容。
|
|
52
|
+
|
|
53
|
+
<!-- auto-i18n:start -->
|
|
54
|
+
|
|
55
|
+
### i18n
|
|
56
|
+
|
|
57
|
+
- 前端新增 key(30):`preserveDraftAcrossConversations`、`preserveDraftAcrossConversationsDesc`、`reversePagination`、`reversePaginationDesc`、`earlierMessagesInfo`、`loadEarlier`、`loadAllEarlier`、`pluginMenuSettings`、`pluginGroupViews`、`pluginGroupExtensions`、`pluginManagerTitle`、`pluginManagerDesc`、`pluginFilterAll`、`pluginFilterConfigurable`、`pluginFilterEnabled`、`pluginFilterDisabled`、`pluginSearchPlaceholder`、`pluginQuickSettings`、`pluginToggleEnable`、`pluginToggleDisable`、`pluginExpandAll`、`pluginCollapseAll`、`pluginGoMarket`、`pluginCountSummary`、`pluginBadgeConfig`、`pluginBadgeView`、`pluginBadgeBg`、`pluginBadgeTools`、`pluginOpenView`、`pluginEmptyFilter`
|
|
58
|
+
|
|
59
|
+
<!-- auto-i18n:end -->
|
|
60
|
+
|
|
11
61
|
## [0.107.0] — 2026-10-18
|
|
12
62
|
|
|
13
63
|
### Added
|
|
@@ -40,6 +90,7 @@
|
|
|
40
90
|
- 优化高并发测试环境下的引擎探测超时保护。
|
|
41
91
|
|
|
42
92
|
<!-- auto-i18n:start -->
|
|
93
|
+
|
|
43
94
|
### i18n
|
|
44
95
|
|
|
45
96
|
- 前端新增 key(23):`showAllModels`、`showEnabledModels`、`showAllModelsTitle`、`showEnabledModelsTitle`、`searchAllModelsHint`、`notInScopeBadge`、`settingsEngineDurableTitle`、`settingsEngineDurableDesc`、`engineTagDurable`、`engineUpdating`、`ttsStreamReplies`、`ttsStreamRepliesDesc`、`ttsEngine`、`ttsEngineBuiltin`、`settingsSearchPlaceholder`、`settingsSearchEmpty`、`settingsGroupCore`、`settingsGroupTools`、`settingsGroupUi`、`settingsGroupAdvanced`、`settingsAutoSavedTip`、`settingsContextSafeZone`、`settingsCacheReady`
|
|
@@ -48,6 +99,7 @@
|
|
|
48
99
|
- 前端英文变更(2):`ttsEnableDesc`、`settingsMarkersDesc`
|
|
49
100
|
- 服务端文案变更(1):`markers.service.guidance.frame`
|
|
50
101
|
- 服务端删除 key(18):`markers.service.describe.empty`、`markers.todo.guidance`、`markers.todo.new.requires.subject`、`markers.todo.new.created`、`markers.todo.set.invalid.id`、`markers.todo.set.invalid.status`、`markers.todo.set.task.missing`、`markers.todo.set.completed.no.pending`、`markers.todo.set.completed.no.inprogress`、`markers.todo.set.updated`、`markers.todo.remove.invalid.id`、`markers.todo.remove.task.missing`、`markers.todo.remove.deleted`、`markers.todo.dep.invalid.id`、`markers.todo.dep.task.missing`、`markers.todo.dep.invalid.dependencies`、`markers.todo.dep.blocks.updated`、`markers.todo.unknown.operation`
|
|
102
|
+
|
|
51
103
|
<!-- auto-i18n:end -->
|
|
52
104
|
|
|
53
105
|
## [0.106.0] — 2026-10-16
|
|
@@ -834,15 +886,7 @@
|
|
|
834
886
|
|
|
835
887
|
### Fixed
|
|
836
888
|
|
|
837
|
-
-
|
|
838
|
-
- **排队消息按索引删除**(#200)—— `removeQueued` 按索引删,文本只做回退匹配,重复文本不再连带误删。
|
|
839
|
-
- **更新面板:过时行按钮优先 + git 扩展名填充**(#202)。
|
|
840
|
-
- **↑ 翻历史可靠进入 prompt 历史**;**提交后按时间戳水位丢弃过期草稿**;**switchSession 限定 sessions 根目录**;**折叠控制展开时保持在左侧**。
|
|
841
|
-
- **在资源管理器中显示 / 默认打开不再压住 GUI 窗口**;**git 扩展更新命令加 `git:` 前缀,更新面板隐藏 SHA 并修复横向滚动**。
|
|
842
|
-
- **Windows ConPTY 关停死锁改走外部看门狗**(#215);**心跳定时器 unref,不再阻塞进程退出**。
|
|
843
|
-
- **无挂载 widget 时跳过刷新**(perf);**未知消息类型节流打日志**;**WS maxPayload 对齐 100MB 上限**。
|
|
844
|
-
- **安全**:TLS 下 `pi_web_token` cookie 加 `Secure` 标记;`shell.openExternal` 前做 URL scheme 白名单校验。
|
|
845
|
-
- **设置重载失败打日志**,不再静默吞错。
|
|
889
|
+
- **git 源扩展更新命令补 `git:` 前缀**(P1 TODO 14)—— 更新面板为 git 源扩展生成的命令由 `pi update <host>/<path>` 改为 `pi update git:<host>/<path>`(裸路径会被 pi core 拒绝并提示 `Did you mean git:...?`);已带 `git:` 前缀的输入不会重复加前缀。
|
|
846
890
|
|
|
847
891
|
<!-- auto-i18n:start -->
|
|
848
892
|
|
|
@@ -851,6 +895,8 @@
|
|
|
851
895
|
- 前端新增 key(27):`brandLogo`、`brandName`、`manageProjects`、`projectPickerTitle`、`newProject`、`projectName`、`createAndOpenProject`、`invalidProjectName`、`openProject`、`fileCompress`、`fileExtract`、`fileCompressDownload`、`fileUploadFolder`、`fileChooseFolder`、`fileExtractDestination`、`fileConflictPolicy`、`fileConflictSkip`、`fileConflictOverwrite`、`fileConflictError`、`fileArchiveLimits`、`fileFolderUploadHint`、`fileTransferBusy`、`fileTransferFailed`、`conversationReadEnabledDesc`、`conversationReadOffHint`、`scheduleTaskEnabledDesc`、`scheduleTaskOffHint`
|
|
852
896
|
- 服务端新增 key(9):`sched.not.wired`、`sched.task.bad.schedule`、`sched.task.interval.too.short`、`sched.task.empty.prompt`、`sched.task.no.cwd`、`sched.list.empty`、`sched.cancel.empty.id`、`sched.cancel.not.found`、`sched.cancel.ok`
|
|
853
897
|
|
|
898
|
+
- 前端新增 key(26):`fileCompress`、`fileExtract`、`fileCompressDownload`、`fileUploadFolder`、`fileChooseFolder`、`fileExtractDestination`、`fileConflictPolicy`、`fileConflictSkip`、`fileConflictOverwrite`、`fileConflictError`、`fileArchiveLimits`、`fileFolderUploadHint`、`fileTransferBusy`、`fileTransferFailed`、`tmuxNewWindow`、`tmuxTakeControl`、`tmuxTakeControlShort`、`tmuxRelease`、`tmuxReleaseShort`、`tmuxReadonly`、`tmuxAdopted`、`tmuxDetach`、`tmuxDetachShort`、`tmuxAdoptGroup`、`tmuxAdopt`、`tmuxNoAdoptable`
|
|
899
|
+
|
|
854
900
|
<!-- auto-i18n:end -->
|
|
855
901
|
|
|
856
902
|
## [0.89.0] — 2026-09-17
|
|
@@ -1831,7 +1877,9 @@ when?, children?}`,也收 `topbar` / `settings` 这类简写别名);宿主
|
|
|
1831
1877
|
- 0.35.1(2026-08-27):编辑重问保留附件(#18)+ 全窗口拖放(#19)。
|
|
1832
1878
|
- 0.29.0(2026-08-23):全局搜索弹窗(Ctrl+K)+ 消息列表惰性窗口化。
|
|
1833
1879
|
|
|
1834
|
-
[Unreleased]: https://github.com/xing-shuyin/pi-web-ui/compare/v0.
|
|
1880
|
+
[Unreleased]: https://github.com/xing-shuyin/pi-web-ui/compare/v0.108.0...main
|
|
1881
|
+
[0.108.0]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.108.0
|
|
1882
|
+
[0.109.0]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.109.0
|
|
1835
1883
|
[0.103.3]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.103.3
|
|
1836
1884
|
[0.103.2]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.103.2
|
|
1837
1885
|
[0.103.1]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.103.1
|
|
@@ -1853,6 +1901,7 @@ when?, children?}`,也收 `topbar` / `settings` 这类简写别名);宿主
|
|
|
1853
1901
|
[0.90.1]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.90.1
|
|
1854
1902
|
[0.90.0]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.90.0
|
|
1855
1903
|
[0.89.0]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.89.0
|
|
1904
|
+
[Unreleased]: https://github.com/xing-shuyin/pi-web-ui/compare/v0.88.0...main
|
|
1856
1905
|
[0.88.0]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.88.0
|
|
1857
1906
|
[0.87.2]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.87.2
|
|
1858
1907
|
[0.87.1]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.87.1
|
|
@@ -148,13 +148,28 @@ export function contentFingerprint(m) {
|
|
|
148
148
|
if (first?.type === "image") {
|
|
149
149
|
return `img:${(first.data ?? "").length}`;
|
|
150
150
|
}
|
|
151
|
-
|
|
151
|
+
if (first?.type === "toolCall") {
|
|
152
|
+
if (typeof first?.id === "string" && first.id.length > 0)
|
|
153
|
+
return `tc:${first.id}`;
|
|
154
|
+
return `tc:${first?.name ?? ""}`;
|
|
155
|
+
}
|
|
156
|
+
// Ported from fork fix(cache): type-aware contentFingerprint (949a8bd):
|
|
157
|
+
// thinking-first blocks hash their thinking text (they carry no .text —
|
|
158
|
+
// else all collide as txt:45h:0). Per-type prefix keeps old txt: keys stable.
|
|
159
|
+
const tag = first?.type === "thinking" ? "thk" : "txt";
|
|
160
|
+
const s = tag === "thk"
|
|
161
|
+
? typeof first?.thinking === "string"
|
|
162
|
+
? first.thinking
|
|
163
|
+
: ""
|
|
164
|
+
: typeof first?.text === "string"
|
|
165
|
+
? first.text
|
|
166
|
+
: "";
|
|
152
167
|
// djb2 — fast enough to run per snapshot, distinct enough for asides.
|
|
153
168
|
let h = 5381;
|
|
154
|
-
for (let i = 0; i <
|
|
155
|
-
h = ((h << 5) + h +
|
|
169
|
+
for (let i = 0; i < s.length && i < 512; i++) {
|
|
170
|
+
h = ((h << 5) + h + s.charCodeAt(i)) >>> 0;
|
|
156
171
|
}
|
|
157
|
-
return
|
|
172
|
+
return `${tag}:${h.toString(36)}:${s.length}`;
|
|
158
173
|
}
|
|
159
174
|
export function extractPartialText(partial) {
|
|
160
175
|
const content = partial?.content;
|
|
@@ -290,6 +290,7 @@ export class ClientSession {
|
|
|
290
290
|
pluginTasks: () => this.pluginBgTasksProvider?.() ?? [],
|
|
291
291
|
// 「自动清理遗留实例」阈值(分钟;0 = 关):每轮定时器实时读设置。
|
|
292
292
|
cleanupMinutes: () => this.settingsSvc.current.bgAutoCleanupMin ?? 0,
|
|
293
|
+
workspaceCwd: () => this.convs.get(this.activeId)?.cwd ?? this.cwd,
|
|
293
294
|
});
|
|
294
295
|
/** index.ts 注入(经 AgentService 拷贝到每个新会话):把 SDK 工具执行事件转发给
|
|
295
296
|
* 插件(PluginManager.emitToolEvent)。未设置时不做任何事。 */
|
|
@@ -856,9 +857,9 @@ export class ClientSession {
|
|
|
856
857
|
* 集合跟它一起走;会话销毁后 WeakMap 自动回收,不需要清理钩子。
|
|
857
858
|
*/
|
|
858
859
|
lazyLoadedBySession = new WeakMap();
|
|
859
|
-
/**
|
|
860
|
+
/** 延迟加载总开关(设置项,默认关;DSH 无 pi 工具注册面,走自己的服务)。 */
|
|
860
861
|
lazyLoadingOn() {
|
|
861
|
-
return this.settingsSvc?.current.toolLazyLoading
|
|
862
|
+
return this.settingsSvc?.current.toolLazyLoading === true;
|
|
862
863
|
}
|
|
863
864
|
/** 会话是否已有转录内容 —— 区分「刚建的新会话」(种子为空)与「从转录恢复的会话」
|
|
864
865
|
* (种子 = 当时活跃的非核心工具,保证上次加载过什么就还是什么)。 */
|
|
@@ -1059,6 +1060,16 @@ export class ClientSession {
|
|
|
1059
1060
|
for (const n of PLAN_MODE_BLOCKED_TOOL_NAMES)
|
|
1060
1061
|
disabled.add(n);
|
|
1061
1062
|
const set = this.lazyLoadedFor(session, this.sessionHasTranscript(session));
|
|
1063
|
+
// 「已加载集合」里有名字 ≠ 活跃集里有它:JIT 自动激活(见 autoActivateToolIfLoadable)
|
|
1064
|
+
// 与任何只标记不重放门控的路径都会造出这种半吊子状态。按活跃集判定,
|
|
1065
|
+
// 否则回一句「已经加载过了」就把模型堵死在死路上(issue #652)。
|
|
1066
|
+
let activeNow = new Set();
|
|
1067
|
+
try {
|
|
1068
|
+
activeNow = new Set(session.getActiveToolNames());
|
|
1069
|
+
}
|
|
1070
|
+
catch {
|
|
1071
|
+
/* session 未就绪:当作什么都不活跃,走正常加载路径 */
|
|
1072
|
+
}
|
|
1062
1073
|
let changed = false;
|
|
1063
1074
|
for (const name of names) {
|
|
1064
1075
|
if (!known.has(name)) {
|
|
@@ -1075,7 +1086,7 @@ export class ClientSession {
|
|
|
1075
1086
|
});
|
|
1076
1087
|
continue;
|
|
1077
1088
|
}
|
|
1078
|
-
if (set.has(name)) {
|
|
1089
|
+
if (set.has(name) && activeNow.has(name)) {
|
|
1079
1090
|
rejected.push({ name, reason: pick(lang, "已经加载过了", "already loaded", "loadtools.already") });
|
|
1080
1091
|
continue;
|
|
1081
1092
|
}
|
|
@@ -1114,6 +1125,13 @@ export class ClientSession {
|
|
|
1114
1125
|
/**
|
|
1115
1126
|
* JIT Auto-activation: if an allowed catalog tool is executed without prior load_tools,
|
|
1116
1127
|
* automatically mark it as loaded so subsequent turns track it as fully active.
|
|
1128
|
+
*
|
|
1129
|
+
* 触发点包含「模型直接调了目录里尚未加载的工具」:SDK 在解析工具之前就派发了
|
|
1130
|
+
* `tool_execution_start`(见 pi-agent-core 的 executeToolCalls),随后因该工具不在
|
|
1131
|
+
* 活跃集而回一条 `Tool <name> not found`。此时只把名字塞进已加载集合是不够的
|
|
1132
|
+
* ——活跃集不会自己变,模型下一轮照样调不动,而 `load_tools` 又回「已经加载过了」,
|
|
1133
|
+
* 于是整条路被堵死(issue #652:模型要靠加载别的工具顺带触发门控才自愈)。
|
|
1134
|
+
* 因此这里必须立刻重放门控,让该工具从下一轮起真的活跃。
|
|
1117
1135
|
*/
|
|
1118
1136
|
autoActivateToolIfLoadable(session, conv, name) {
|
|
1119
1137
|
if (!this.lazyLoadingOn() ||
|
|
@@ -1126,9 +1144,13 @@ export class ClientSession {
|
|
|
1126
1144
|
if (loaded.has(name))
|
|
1127
1145
|
return;
|
|
1128
1146
|
const allowed = new Set(this.allowedToolNames(session, conv));
|
|
1129
|
-
if (allowed.has(name))
|
|
1130
|
-
|
|
1131
|
-
|
|
1147
|
+
if (!allowed.has(name))
|
|
1148
|
+
return;
|
|
1149
|
+
loaded.add(name);
|
|
1150
|
+
this.applyToolGating(session, conv.agentPreset);
|
|
1151
|
+
this.sessionStatsCache = null;
|
|
1152
|
+
this.cachedBaseTokens = null;
|
|
1153
|
+
this.flushSnapshot();
|
|
1132
1154
|
}
|
|
1133
1155
|
/** 当前活动会话的工具/资源快照 → composer 输入。cwd 取活动对话的。 */
|
|
1134
1156
|
composeInputs(src) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { killPidTree,
|
|
1
|
+
import { killPidTree, lookupProcessDetailsBatch, snapshotListeningPorts, snapshotProcessTree, } from "./process-utils.js";
|
|
2
2
|
const BG_REFRESH_INTERVAL_MS = 30_000;
|
|
3
3
|
/** bash 结束后等这么久再拍「后」快照——给后台服务绑定端口的时间。 */
|
|
4
4
|
const BG_BIND_WAIT_MS = 1500;
|
|
@@ -20,11 +20,20 @@ export function staleLeftovers(entries, opts) {
|
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* 基本不可能由 AI 启动的常驻桌面软件进程名(小写)。命中即跳过,避免面板被
|
|
23
|
-
* 微信/QQ 等本地软件的动态监听端口污染。注意 Chrome 不进黑名单:AI 会用
|
|
23
|
+
* 微信/QQ/WPS/ima 等本地软件的动态监听端口污染。注意 Chrome 不进黑名单:AI 会用
|
|
24
24
|
* Playwright 拉浏览器做模拟,它靠下方父链回溯判定(Playwright 起的 chrome
|
|
25
25
|
* 能回溯到服务器进程,自己开的 chrome 父链是 explorer,分得开)。
|
|
26
26
|
*/
|
|
27
27
|
export const NON_AGENT_PROCESS_NAMES = new Set([
|
|
28
|
+
// 办公与知识库(Issue #651:WPS、腾讯 ima.copilot 等)
|
|
29
|
+
"wps.exe",
|
|
30
|
+
"wpscenter.exe",
|
|
31
|
+
"ksoqing.exe",
|
|
32
|
+
"ksolaunch.exe",
|
|
33
|
+
"wpscloudsvr.exe",
|
|
34
|
+
"ima.copilot.exe",
|
|
35
|
+
"ima.exe",
|
|
36
|
+
// 即时通讯与社交
|
|
28
37
|
"wechat.exe",
|
|
29
38
|
"weixin.exe",
|
|
30
39
|
"wechatappex.exe",
|
|
@@ -32,6 +41,7 @@ export const NON_AGENT_PROCESS_NAMES = new Set([
|
|
|
32
41
|
"tim.exe",
|
|
33
42
|
"telegram.exe",
|
|
34
43
|
"dingtalk.exe",
|
|
44
|
+
// 系统外壳与基础设施
|
|
35
45
|
"explorer.exe",
|
|
36
46
|
"searchhost.exe",
|
|
37
47
|
"searchapp.exe",
|
|
@@ -40,43 +50,176 @@ export const NON_AGENT_PROCESS_NAMES = new Set([
|
|
|
40
50
|
"dwm.exe",
|
|
41
51
|
"csrss.exe",
|
|
42
52
|
"conhost.exe",
|
|
53
|
+
"sihost.exe",
|
|
54
|
+
"taskhostw.exe",
|
|
55
|
+
"services.exe",
|
|
56
|
+
"shellexperiencehost.exe",
|
|
57
|
+
"startmenuexperiencehost.exe",
|
|
58
|
+
]);
|
|
59
|
+
/**
|
|
60
|
+
* 桌面外壳与系统服务进程名(小写)。
|
|
61
|
+
* 祖先回溯时如果撞上这些进程,说明该进程是由桌面 GUI、开始菜单或系统服务启动的,
|
|
62
|
+
* 绝不可能由当前 CLI / Node.js 进程在后台拉起。
|
|
63
|
+
*/
|
|
64
|
+
export const SHELL_OR_SYSTEM_PROCESS_NAMES = new Set([
|
|
65
|
+
"explorer.exe",
|
|
66
|
+
"winlogon.exe",
|
|
67
|
+
"services.exe",
|
|
68
|
+
"dwm.exe",
|
|
69
|
+
"taskhostw.exe",
|
|
70
|
+
"sihost.exe",
|
|
71
|
+
"svchost.exe",
|
|
72
|
+
"shellexperiencehost.exe",
|
|
73
|
+
"startmenuexperiencehost.exe",
|
|
74
|
+
"system",
|
|
75
|
+
]);
|
|
76
|
+
/**
|
|
77
|
+
* 典型的 AI / 开发者开发服务运行时进程名(小写)。
|
|
78
|
+
* 在发生中途断链(父进程已退出)时作为启发式白名单校验依据。
|
|
79
|
+
*/
|
|
80
|
+
export const DEV_RUNTIME_PROCESS_NAMES = new Set([
|
|
81
|
+
"node.exe",
|
|
82
|
+
"node",
|
|
83
|
+
"python.exe",
|
|
84
|
+
"python",
|
|
85
|
+
"python3.exe",
|
|
86
|
+
"python3",
|
|
87
|
+
"deno.exe",
|
|
88
|
+
"deno",
|
|
89
|
+
"bun.exe",
|
|
90
|
+
"bun",
|
|
91
|
+
"ruby.exe",
|
|
92
|
+
"ruby",
|
|
93
|
+
"go.exe",
|
|
94
|
+
"go",
|
|
95
|
+
"java.exe",
|
|
96
|
+
"java",
|
|
97
|
+
"dotnet.exe",
|
|
98
|
+
"dotnet",
|
|
99
|
+
"php.exe",
|
|
100
|
+
"php",
|
|
101
|
+
"cargo.exe",
|
|
102
|
+
"cargo",
|
|
103
|
+
"uvicorn.exe",
|
|
104
|
+
"uvicorn",
|
|
105
|
+
"gunicorn",
|
|
106
|
+
"vite.exe",
|
|
107
|
+
"vite",
|
|
108
|
+
"flask.exe",
|
|
109
|
+
"flask",
|
|
43
110
|
]);
|
|
44
111
|
/**
|
|
45
112
|
* 判定 bash 后新出现的监听端口进程是否该记入后台任务列表(即「AI 启动的」)。
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* -
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
113
|
+
*
|
|
114
|
+
* 判定规则(三重防护):
|
|
115
|
+
* 1. 【时序防线(CreationDate)】如果进程启动时间早于 bash 启动时刻(留 2s 容差),
|
|
116
|
+
* 说明该进程在 bash 执行前就已存在,100% 为外部已有应用(如提前开着的 WPS、ima、游戏),跳过;
|
|
117
|
+
* 2. 【进程名与黑名单】命中 NON_AGENT_PROCESS_NAMES(如 wps.exe、ima.copilot.exe、wechat.exe),跳过;
|
|
118
|
+
* 3. 【祖先链追溯】
|
|
119
|
+
* - 撞上服务器进程(serverPid)→ 记录(铁证);
|
|
120
|
+
* - 撞上桌面 Shell 或系统服务(explorer.exe / services.exe 等)→ 跳过;
|
|
121
|
+
* - 撞上本次 diff 出的其他新 pid(如 concurrently 等中间层)→ 记录并继续向上回溯;
|
|
122
|
+
* - 完整回溯到系统根(0/1)未命中 serverPid → 跳过;
|
|
123
|
+
* 4. 【断链安全底线】中途断链(父进程已退出,常见于 nohup 或 Windows launcher):
|
|
124
|
+
* - 具备明确开发特征(DEV_RUNTIME_PROCESS_NAMES 或命令行/路径包含工作区)才予收录;
|
|
125
|
+
* - 未知可执行文件或桌面安装目录应用(如 Program Files)坚决跳过,杜绝误杀用户正常程序。
|
|
57
126
|
*/
|
|
58
|
-
export function shouldTrackBackgroundServer(pid, parents, newPids, serverPid, name) {
|
|
59
|
-
|
|
127
|
+
export function shouldTrackBackgroundServer(pid, parents, newPids, serverPid, name, opts) {
|
|
128
|
+
const lowerName = name?.toLowerCase();
|
|
129
|
+
// 1. 命中黑名单 → 跳过
|
|
130
|
+
if (lowerName && NON_AGENT_PROCESS_NAMES.has(lowerName))
|
|
60
131
|
return false;
|
|
61
|
-
|
|
62
|
-
|
|
132
|
+
// 2. 时序防护:早于 bash 开始时刻创建的进程绝不可能是本次命令拉起的新任务。
|
|
133
|
+
if (typeof opts?.startedBeforeMs === "number" &&
|
|
134
|
+
opts.startedBeforeMs > 0 &&
|
|
135
|
+
typeof opts.createdMs === "number" &&
|
|
136
|
+
opts.createdMs > 0) {
|
|
137
|
+
// 允许 2000ms 的时钟抖动/快照耗时容差
|
|
138
|
+
if (opts.createdMs < opts.startedBeforeMs - 2000) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// 3. 命令行路径防范:如果可执行路径明显指向普通桌面安装目录(如 Program Files / AppData Local Programs)
|
|
143
|
+
// 且不是开发工具链运行时,跳过
|
|
144
|
+
if (opts?.commandLine) {
|
|
145
|
+
const lowerCmd = opts.commandLine.toLowerCase();
|
|
146
|
+
const isDevRuntime = lowerName ? DEV_RUNTIME_PROCESS_NAMES.has(lowerName) : false;
|
|
147
|
+
if (!isDevRuntime) {
|
|
148
|
+
const isDesktopPath = lowerCmd.includes("\\program files") ||
|
|
149
|
+
lowerCmd.includes("/program files") ||
|
|
150
|
+
lowerCmd.includes("\\appdata\\local\\programs\\") ||
|
|
151
|
+
lowerCmd.includes("/appdata/local/programs/");
|
|
152
|
+
if (isDesktopPath) {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// 4. 进程树查不到时:降级为保守记录(保持现有纯单测行为)
|
|
158
|
+
if (!parents) {
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
// 5. 向上回溯父链
|
|
63
162
|
const seen = new Set();
|
|
64
163
|
let cur = pid;
|
|
164
|
+
let brokenAt;
|
|
65
165
|
while (cur !== undefined && !seen.has(cur)) {
|
|
66
166
|
seen.add(cur);
|
|
67
167
|
if (cur === serverPid)
|
|
68
168
|
return true;
|
|
69
169
|
if (cur !== pid && newPids.has(cur))
|
|
70
170
|
return true;
|
|
71
|
-
const
|
|
171
|
+
const parentEntry = parents.get(cur);
|
|
172
|
+
let next;
|
|
173
|
+
let parentName;
|
|
174
|
+
if (typeof parentEntry === "object" && parentEntry !== null) {
|
|
175
|
+
next = parentEntry.ppid;
|
|
176
|
+
parentName = parentEntry.name;
|
|
177
|
+
}
|
|
178
|
+
else if (typeof parentEntry === "number") {
|
|
179
|
+
next = parentEntry;
|
|
180
|
+
}
|
|
181
|
+
// 检查当前祖先节点是否命中桌面外壳或系统服务
|
|
182
|
+
if (parentName) {
|
|
183
|
+
const lowerParent = parentName.toLowerCase();
|
|
184
|
+
if (SHELL_OR_SYSTEM_PROCESS_NAMES.has(lowerParent) || NON_AGENT_PROCESS_NAMES.has(lowerParent)) {
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
72
188
|
if (next === undefined) {
|
|
73
|
-
// 到达系统根(0
|
|
74
|
-
|
|
189
|
+
// 到达系统根(0 或 1)→ 完整链,非 AI 启动
|
|
190
|
+
if (cur <= 1)
|
|
191
|
+
return false;
|
|
192
|
+
// 中途断链:父进程已退出
|
|
193
|
+
brokenAt = cur;
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
if (next === cur) {
|
|
197
|
+
// 自引用根,视为完整链终点
|
|
198
|
+
return false;
|
|
75
199
|
}
|
|
76
|
-
if (next === cur)
|
|
77
|
-
return false; // 自引用根,同样视为完整链终点
|
|
78
200
|
cur = next;
|
|
79
201
|
}
|
|
202
|
+
// 6. 断链处理(brokenAt !== undefined)
|
|
203
|
+
if (brokenAt !== undefined) {
|
|
204
|
+
// 如果未传 opts 且未传 name(保持现有纯断链单测的向后兼容)
|
|
205
|
+
if (!opts && !name) {
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
// 具备明确开发运行时特征(node, python 等)才予收录
|
|
209
|
+
if (lowerName && DEV_RUNTIME_PROCESS_NAMES.has(lowerName)) {
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
// 命令行包含当前工作区路径时收录
|
|
213
|
+
if (opts?.workspaceCwd && opts.commandLine) {
|
|
214
|
+
const normalizedCwd = opts.workspaceCwd.toLowerCase().replace(/\\/g, "/");
|
|
215
|
+
const normalizedCmd = opts.commandLine.toLowerCase().replace(/\\/g, "/");
|
|
216
|
+
if (normalizedCmd.includes(normalizedCwd)) {
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
// 默认断链不再盲目信任,防止误杀外部软件
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
80
223
|
return false;
|
|
81
224
|
}
|
|
82
225
|
export class BgServerTracker {
|
|
@@ -90,6 +233,7 @@ export class BgServerTracker {
|
|
|
90
233
|
* 读到 null 直接漏记,延迟解析的旧快照还会污染下一轮)。
|
|
91
234
|
*/
|
|
92
235
|
listenBefore = null;
|
|
236
|
+
listenBeforeTime = 0;
|
|
93
237
|
refreshTimer = null;
|
|
94
238
|
constructor(opts) {
|
|
95
239
|
this.opts = opts;
|
|
@@ -113,9 +257,12 @@ export class BgServerTracker {
|
|
|
113
257
|
this.refreshTimer = null;
|
|
114
258
|
}
|
|
115
259
|
}
|
|
116
|
-
/** tool_execution_start(bash)
|
|
260
|
+
/** tool_execution_start(bash):先记下「前」快照(快照在途时保留最早的一份与启动时间)。 */
|
|
117
261
|
snapshotBefore() {
|
|
118
|
-
this.listenBefore
|
|
262
|
+
if (!this.listenBefore) {
|
|
263
|
+
this.listenBeforeTime = Date.now();
|
|
264
|
+
this.listenBefore = snapshotListeningPorts();
|
|
265
|
+
}
|
|
119
266
|
}
|
|
120
267
|
/** After a bash tool run, wait briefly for background servers to bind,
|
|
121
268
|
* then diff the listening-port snapshot against the pre-run one and
|
|
@@ -124,7 +271,9 @@ export class BgServerTracker {
|
|
|
124
271
|
// 读后清槽:await in-flight 快照(消除 fire-and-forget 的时序竞态),
|
|
125
272
|
// 并发 bash 共用这份最早的基线,各自结束都能对得上。
|
|
126
273
|
const beforePromise = this.listenBefore;
|
|
274
|
+
const beforeTime = this.listenBeforeTime;
|
|
127
275
|
this.listenBefore = null;
|
|
276
|
+
this.listenBeforeTime = 0;
|
|
128
277
|
if (!beforePromise)
|
|
129
278
|
return;
|
|
130
279
|
const before = await beforePromise;
|
|
@@ -138,30 +287,19 @@ export class BgServerTracker {
|
|
|
138
287
|
}
|
|
139
288
|
if (fresh.length === 0)
|
|
140
289
|
return;
|
|
141
|
-
//
|
|
142
|
-
const keep = await this.filterAgentSpawned(fresh);
|
|
290
|
+
// 剔除桌面软件误报(微信/WPS/ima 等)后,剩下的才是 AI 启动的后台服务。
|
|
291
|
+
const keep = await this.filterAgentSpawned(fresh, beforeTime);
|
|
143
292
|
let added = false;
|
|
144
|
-
for (const { port, pid } of keep) {
|
|
293
|
+
for (const { port, pid, name, command } of keep) {
|
|
145
294
|
if (this.servers.has(port))
|
|
146
295
|
continue;
|
|
147
|
-
this.servers.set(port, {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const cur = this.servers.get(port);
|
|
153
|
-
if (cur && cur.pid === pid && name) {
|
|
154
|
-
cur.name = name;
|
|
155
|
-
this.push();
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
void lookupProcessCommandLine(pid).then((command) => {
|
|
159
|
-
const cur = this.servers.get(port);
|
|
160
|
-
if (cur && cur.pid === pid && command) {
|
|
161
|
-
cur.command = command;
|
|
162
|
-
this.push();
|
|
163
|
-
}
|
|
296
|
+
this.servers.set(port, {
|
|
297
|
+
pid,
|
|
298
|
+
since: Date.now(),
|
|
299
|
+
...(name ? { name } : {}),
|
|
300
|
+
...(command ? { command } : {}),
|
|
164
301
|
});
|
|
302
|
+
added = true;
|
|
165
303
|
this.opts.emit({
|
|
166
304
|
type: "notice",
|
|
167
305
|
level: "info",
|
|
@@ -172,16 +310,30 @@ export class BgServerTracker {
|
|
|
172
310
|
if (added)
|
|
173
311
|
this.push();
|
|
174
312
|
}
|
|
175
|
-
/**
|
|
176
|
-
async filterAgentSpawned(fresh) {
|
|
177
|
-
const
|
|
178
|
-
const
|
|
179
|
-
const newPids = new Set(
|
|
313
|
+
/** 并行拉进程树与各进程详情,用时序防线 + 黑名单 + 父链回溯剔除桌面软件误报。 */
|
|
314
|
+
async filterAgentSpawned(fresh, beforeTime) {
|
|
315
|
+
const pids = [...new Set(fresh.map((f) => f.pid))];
|
|
316
|
+
const [tree, detailsMap] = await Promise.all([snapshotProcessTree(), lookupProcessDetailsBatch(pids)]);
|
|
317
|
+
const newPids = new Set(pids);
|
|
318
|
+
const cwd = this.opts.workspaceCwd?.();
|
|
180
319
|
const out = [];
|
|
181
|
-
for (
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
320
|
+
for (const { port, pid } of fresh) {
|
|
321
|
+
const details = detailsMap.get(pid);
|
|
322
|
+
const name = details?.name;
|
|
323
|
+
const command = details?.commandLine;
|
|
324
|
+
const should = shouldTrackBackgroundServer(pid, tree, newPids, process.pid, name, {
|
|
325
|
+
commandLine: command,
|
|
326
|
+
createdMs: details?.createdMs,
|
|
327
|
+
startedBeforeMs: beforeTime > 0 ? beforeTime : undefined,
|
|
328
|
+
workspaceCwd: cwd,
|
|
329
|
+
});
|
|
330
|
+
if (should) {
|
|
331
|
+
out.push({
|
|
332
|
+
port,
|
|
333
|
+
pid,
|
|
334
|
+
...(name ? { name } : {}),
|
|
335
|
+
...(command ? { command } : {}),
|
|
336
|
+
});
|
|
185
337
|
}
|
|
186
338
|
}
|
|
187
339
|
return out;
|
|
@@ -250,11 +250,12 @@ export function normalizeUiLayout(v) {
|
|
|
250
250
|
export function normalizeSkillList(v) {
|
|
251
251
|
return Array.isArray(v) ? v.filter((x) => typeof x === "string") : [];
|
|
252
252
|
}
|
|
253
|
-
/**
|
|
254
|
-
*
|
|
253
|
+
/** 工具延迟加载的**出厂默认**(默认关:模型忘记加载会先吃一次 `Tool <name> not found`,
|
|
254
|
+
* 开箱即用优先——见 #652;`PI_WEB_TOOL_LAZY_LOADING=1/true/on/yes` 部署级打开,给
|
|
255
|
+
* 「想省上下文、愿意让模型多一步 load_tools」的实例一个开关;用户在设置面板的选择优先于此)。 */
|
|
255
256
|
export const DEFAULT_TOOL_LAZY_LOADING = (() => {
|
|
256
257
|
const v = (process.env.PI_WEB_TOOL_LAZY_LOADING ?? "").trim().toLowerCase();
|
|
257
|
-
return
|
|
258
|
+
return v === "1" || v === "true" || v === "on" || v === "yes";
|
|
258
259
|
})();
|
|
259
260
|
export const DEFAULT_CODEMODE_MODE = "on";
|
|
260
261
|
export const DEFAULT_CODEMODE_INLINE_BUDGET = 3000;
|
|
@@ -846,6 +847,7 @@ export class ClientStateStore {
|
|
|
846
847
|
toolsWrap: stored?.toolsWrap ?? true,
|
|
847
848
|
toolImagesEnabled: stored?.toolImagesEnabled ?? true,
|
|
848
849
|
keepRecentMessages: normalizeKeepRecentMessages(stored?.keepRecentMessages),
|
|
850
|
+
reversePagination: stored?.reversePagination ?? false,
|
|
849
851
|
showForkedParentSessions: stored?.showForkedParentSessions ?? false,
|
|
850
852
|
retainFinishedConversations: stored?.retainFinishedConversations ?? false,
|
|
851
853
|
openRecentSessionOnProjectSwitch: stored?.openRecentSessionOnProjectSwitch ?? true,
|
|
@@ -865,6 +867,7 @@ export class ClientStateStore {
|
|
|
865
867
|
quickPhrases: stored?.quickPhrases ?? [],
|
|
866
868
|
quickPhrasesEnabled: stored?.quickPhrasesEnabled ?? true,
|
|
867
869
|
minimalNewChat: stored?.minimalNewChat ?? false,
|
|
870
|
+
preserveDraftAcrossConversations: stored?.preserveDraftAcrossConversations ?? false,
|
|
868
871
|
reviewPrompt: stored?.reviewPrompt ?? "",
|
|
869
872
|
reviewDisabledSkills: stored?.reviewDisabledSkills ?? [],
|
|
870
873
|
disabledPlugins: stored?.disabledPlugins ?? [],
|
|
@@ -913,6 +916,7 @@ export class ClientStateStore {
|
|
|
913
916
|
toolsWrap: settings.toolsWrap ?? cur.toolsWrap ?? true,
|
|
914
917
|
toolImagesEnabled: settings.toolImagesEnabled ?? cur.toolImagesEnabled ?? true,
|
|
915
918
|
keepRecentMessages: normalizeKeepRecentMessages(settings.keepRecentMessages ?? cur.keepRecentMessages ?? DEFAULT_KEEP_RECENT_MESSAGES),
|
|
919
|
+
reversePagination: settings.reversePagination ?? cur.reversePagination ?? false,
|
|
916
920
|
showForkedParentSessions: settings.showForkedParentSessions ?? cur.showForkedParentSessions ?? false,
|
|
917
921
|
retainFinishedConversations: settings.retainFinishedConversations ?? cur.retainFinishedConversations ?? false,
|
|
918
922
|
openRecentSessionOnProjectSwitch: settings.openRecentSessionOnProjectSwitch ?? cur.openRecentSessionOnProjectSwitch ?? true,
|
|
@@ -941,6 +945,7 @@ export class ClientStateStore {
|
|
|
941
945
|
quickPhrases: settings.quickPhrases ?? cur.quickPhrases ?? [],
|
|
942
946
|
quickPhrasesEnabled: settings.quickPhrasesEnabled ?? cur.quickPhrasesEnabled ?? true,
|
|
943
947
|
minimalNewChat: settings.minimalNewChat ?? cur.minimalNewChat ?? false,
|
|
948
|
+
preserveDraftAcrossConversations: settings.preserveDraftAcrossConversations ?? cur.preserveDraftAcrossConversations ?? false,
|
|
944
949
|
defaultAgentPreset: settings.defaultAgentPreset ?? cur.defaultAgentPreset ?? "standard",
|
|
945
950
|
defaultPermissionPreset: settings.defaultPermissionPreset ?? cur.defaultPermissionPreset ?? "workspace-write-never",
|
|
946
951
|
};
|
|
@@ -615,6 +615,8 @@ export function handleSettingsMessage(msg, cs) {
|
|
|
615
615
|
quickPhrases: msg.quickPhrases,
|
|
616
616
|
quickPhrasesEnabled: msg.quickPhrasesEnabled,
|
|
617
617
|
minimalNewChat: msg.minimalNewChat,
|
|
618
|
+
preserveDraftAcrossConversations: msg
|
|
619
|
+
.preserveDraftAcrossConversations,
|
|
618
620
|
quickPhrasesSeeded: msg.quickPhrasesSeeded,
|
|
619
621
|
uiLayout: msg.uiLayout,
|
|
620
622
|
});
|