pi-web-ui 0.106.0 → 0.108.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 +77 -11
- package/README.zh-TW.md +2 -2
- package/dist/server/agent-formatters.js +19 -4
- package/dist/server/agent-service.js +33 -16
- package/dist/server/bg-servers.js +205 -53
- package/dist/server/client-state.js +6 -2
- package/dist/server/dispatch-domain-handlers.js +2 -0
- package/dist/server/dsh/dsh-agent-service.js +24 -10
- package/dist/server/durable/durable-agent-service.js +153 -0
- package/dist/server/durable/durable-capabilities.js +11 -0
- package/dist/server/durable/durable-driver.js +481 -0
- package/dist/server/durable/durable-loader.js +38 -0
- package/dist/server/durable/durable-models.js +283 -0
- package/dist/server/durable/durable-storage.js +42 -0
- package/dist/server/durable/durable-tools.js +45 -0
- package/dist/server/durable/index.js +8 -0
- package/dist/server/engine-capabilities.js +20 -1
- package/dist/server/engine-probe.js +156 -8
- package/dist/server/files-service.js +15 -1
- package/dist/server/global-loader.js +335 -0
- package/dist/server/index.js +127 -17
- package/dist/server/managed.js +2 -0
- package/dist/server/marker-service.js +5 -19
- package/dist/server/markers/index.js +1 -3
- package/dist/server/model-admin.js +61 -10
- package/dist/server/model-resolver.js +91 -3
- package/dist/server/plugins.js +18 -1
- 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/sdk-origin.js +2 -2
- package/dist/server/serialize.js +1 -1
- package/dist/server/settings-service.js +4 -0
- package/dist/server/text-sniff.js +2 -0
- package/dist/server/tool-manager.js +3 -19
- package/dist/server/universal/driver-base.js +4 -0
- package/dist/server/universal/drivers/claude-code.js +3 -2
- package/dist/server/universal/universal-service.js +19 -2
- package/dist/server/universal/universal-session.js +63 -7
- package/dist/server/update-check.js +20 -8
- package/package.json +2 -1
- package/plugins/catalog.json +13 -2
- package/themes/dark-teal.css +0 -1
- package/themes/flow-light.css +1085 -0
- package/themes/flow.css +1094 -0
- package/themes/wallpaper-flow.css +1158 -0
- package/themes/wallpaper-obsidian.css +50 -0
- package/themes/zhujian-dark.css +0 -7
- package/themes/zhujian.css +0 -7
- package/themes/zhupi-dark.css +0 -7
- package/themes/zhupi.css +0 -7
- package/web/dist/assets/{TerminalPanel-CfxKLDW9.js → TerminalPanel-CslRhcS7.js} +2 -2
- package/web/dist/assets/index-C_2Fl6f6.js +690 -0
- package/web/dist/assets/index-D0BtO5dn.css +1 -0
- package/web/dist/index.html +2 -2
- package/web/dist/sw.js +1 -1
- package/web/dist/assets/index-BtcP6BDk.css +0 -1
- package/web/dist/assets/index-XVtCzcHR.js +0 -690
package/CHANGELOG.md
CHANGED
|
@@ -8,7 +8,78 @@
|
|
|
8
8
|
每个版本的内容按"实际合入该版本发布的提交"归档(以 `package.json` 的 version 变更提交为准),
|
|
9
9
|
而不是按提交日期聚类——连续快速发布的 patch 版本以此为准最准确。
|
|
10
10
|
|
|
11
|
-
## [
|
|
11
|
+
## [0.108.0] — 2026-10-18
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **集中式「插件设置」面板 (Plugin Settings Center)**:
|
|
16
|
+
- 顶栏插件菜单新增「插件设置」入口,一屏集中管理所有插件的启用状态与参数配置,不必再逐个进设置页翻找;
|
|
17
|
+
- 支持「全部 / 可配置 / 已启用 / 已停用」筛选与插件名称、ID、描述关键词搜索,卡片直观标注「可配置 / 界面 / 后台 / N 个工具」徽标;
|
|
18
|
+
- 支持批量展开/折叠配置、单卡快速配置,并可一键跳转插件市场做高级管理。
|
|
19
|
+
- **插件菜单分组**:插件菜单按「功能界面」与「扩展组件」分栏展示,界面插件与工具型扩展一目了然。
|
|
20
|
+
- **向上分页加载 (Reverse Pagination)**:设置 › 界面 › 新增开关。开启后默认只挂载最近消息,向上滚动或点击「加载前 N 条 / 全部展开」按需取更早历史,完全不使用视口占位符,超长会话滚动更接近原生流畅度。
|
|
21
|
+
- **输入框文字跨对话保留**:设置 › 界面 › 新增开关。开启后输入的文字在切换会话时不再清空,可跨对话延续;关闭时各会话草稿严格独立,切回原会话照常恢复。
|
|
22
|
+
- **`browser-use` 插件升级 0.9.0:常驻 Chrome 自动化 + 智能搜索**:
|
|
23
|
+
- 新增 `browser_search` 搜索工具:专用工作标签页隔离、无图极速渲染(CDP 阻断图片/字体/媒体)、搜阅一体(搜索结果与首条正文一次返回)、时效过滤(24 小时 / 周 / 月 / 年)、官网与权威源认证置顶、域名多样性、真实落地页还原与反爬降级链重试;
|
|
24
|
+
- 新增插件设置项:无头模式(默认静默后台运行)、默认搜索引擎、极速搜索、搜索标签页隔离、闲置自动关闭时长;
|
|
25
|
+
- `read_page` 纯净阅读增强(表格转 Markdown、代码语法高亮);后台任务面板统一精确管理,支持一键停止。
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- **后台服务误报治理**:新增「创建时序 + 进程链完整性 + 桌面安装路径」三重判定,WPS、腾讯 ima 等随桌面软件启动的常驻进程不再被误判为 AI 拉起,后台服务面板更贴近真实任务(#651)。
|
|
30
|
+
- 消息编辑区的「取消 / 从这条重问」改用标准按钮样式,与其余操作区视觉统一。
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
|
|
34
|
+
- 会话切换结转草稿时,仅在目标会话没有自己的草稿时才写入,避免覆盖该会话已保留的输入内容。
|
|
35
|
+
|
|
36
|
+
<!-- auto-i18n:start -->
|
|
37
|
+
### i18n
|
|
38
|
+
|
|
39
|
+
- 前端新增 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`
|
|
40
|
+
<!-- auto-i18n:end -->
|
|
41
|
+
|
|
42
|
+
## [0.107.0] — 2026-10-18
|
|
43
|
+
|
|
44
|
+
### Added
|
|
45
|
+
|
|
46
|
+
- **设置面板全新结构化重构 (Settings Redesign)**:
|
|
47
|
+
- 设置页全新引入四大核心业务分组:「核心配置 (Core)」、「AI 与工具 (Tools)」、「界面与外观 (UI)」、「高级与扩展 (Advanced)」;
|
|
48
|
+
- 新增全局实时即搜即显搜索框,支持中英文关键词双向匹配高亮;
|
|
49
|
+
- 新增上下文安全区 (Context Safe Zone) 与供应商 Prompt Cache 缓存就绪状态指示器,带来沉浸式修改自动保存体验。
|
|
50
|
+
- **通用多源 TTS 语音合成插件 (`plugins/tts`)**:
|
|
51
|
+
- 深度聚合字节豆包大模型语音(阳光阿辰、磁性俊宇、清爽男大、阳光甜妹等)与 DeepSeek 官方音色(Echo、Tide、Mira、Stella);
|
|
52
|
+
- 内置配套 Chrome / Edge 伴侣扩展,支持在网页端一键无感同步双平台凭据;
|
|
53
|
+
- 原生接入系统设置中的语音引擎切换(浏览器内置 / 豆包语音 / DeepSeek 语音),并提供 `tts_speak` 智能体音频生成工具。
|
|
54
|
+
- **流式语音伴读 (Streaming TTS)**:
|
|
55
|
+
- 新增智能分句流式伴读机制,模型流式吐字的同时自动分句并行预取语音,首句 200~300ms 极速发声,告别大段长文本的漫长等待。
|
|
56
|
+
- **浅色流体主题 (Flow Light)**:
|
|
57
|
+
- 新增极简现代的「浅色流体」专属主题(`flow-light`),搭配细腻高光微透材质与清晰层次,日间编码更轻快舒适。
|
|
58
|
+
|
|
59
|
+
### Changed
|
|
60
|
+
|
|
61
|
+
- **官方插件体验升级**:
|
|
62
|
+
- 动态壁纸插件(`wallpaper-engine` 0.3.59)优化了渲染性能负载与抽屉展开交互;
|
|
63
|
+
- 语音与拍照输入插件(`voice-input` 0.4.2)强化了听写识别流程与状态同步稳定性。
|
|
64
|
+
- **引擎探测与模型管理增强**:
|
|
65
|
+
- 改进多引擎(DSH、Claude 等)后台更新检测与版本同步;模型选择器支持在工作区范围与全量配置模型间自如切换。
|
|
66
|
+
|
|
67
|
+
### Fixed
|
|
68
|
+
|
|
69
|
+
- **标记系统精简与单测稳定性**:
|
|
70
|
+
- 清理废弃的内置 Todo 标记与孤立工具定义,精简智能体系统提示词上下文预算;
|
|
71
|
+
- 优化高并发测试环境下的引擎探测超时保护。
|
|
72
|
+
|
|
73
|
+
<!-- auto-i18n:start -->
|
|
74
|
+
### i18n
|
|
75
|
+
|
|
76
|
+
- 前端新增 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`
|
|
77
|
+
- 前端删除 key(4):`updateEngineTabTitle`、`markerGroupTodo`、`todoListEnabledDesc`、`todoListOffHint`
|
|
78
|
+
- 前端中文变更(2):`ttsEnableDesc`、`settingsMarkersDesc`
|
|
79
|
+
- 前端英文变更(2):`ttsEnableDesc`、`settingsMarkersDesc`
|
|
80
|
+
- 服务端文案变更(1):`markers.service.guidance.frame`
|
|
81
|
+
- 服务端删除 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`
|
|
82
|
+
<!-- auto-i18n:end -->
|
|
12
83
|
|
|
13
84
|
## [0.106.0] — 2026-10-16
|
|
14
85
|
|
|
@@ -794,15 +865,7 @@
|
|
|
794
865
|
|
|
795
866
|
### Fixed
|
|
796
867
|
|
|
797
|
-
-
|
|
798
|
-
- **排队消息按索引删除**(#200)—— `removeQueued` 按索引删,文本只做回退匹配,重复文本不再连带误删。
|
|
799
|
-
- **更新面板:过时行按钮优先 + git 扩展名填充**(#202)。
|
|
800
|
-
- **↑ 翻历史可靠进入 prompt 历史**;**提交后按时间戳水位丢弃过期草稿**;**switchSession 限定 sessions 根目录**;**折叠控制展开时保持在左侧**。
|
|
801
|
-
- **在资源管理器中显示 / 默认打开不再压住 GUI 窗口**;**git 扩展更新命令加 `git:` 前缀,更新面板隐藏 SHA 并修复横向滚动**。
|
|
802
|
-
- **Windows ConPTY 关停死锁改走外部看门狗**(#215);**心跳定时器 unref,不再阻塞进程退出**。
|
|
803
|
-
- **无挂载 widget 时跳过刷新**(perf);**未知消息类型节流打日志**;**WS maxPayload 对齐 100MB 上限**。
|
|
804
|
-
- **安全**:TLS 下 `pi_web_token` cookie 加 `Secure` 标记;`shell.openExternal` 前做 URL scheme 白名单校验。
|
|
805
|
-
- **设置重载失败打日志**,不再静默吞错。
|
|
868
|
+
- **git 源扩展更新命令补 `git:` 前缀**(P1 TODO 14)—— 更新面板为 git 源扩展生成的命令由 `pi update <host>/<path>` 改为 `pi update git:<host>/<path>`(裸路径会被 pi core 拒绝并提示 `Did you mean git:...?`);已带 `git:` 前缀的输入不会重复加前缀。
|
|
806
869
|
|
|
807
870
|
<!-- auto-i18n:start -->
|
|
808
871
|
|
|
@@ -811,6 +874,7 @@
|
|
|
811
874
|
- 前端新增 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`
|
|
812
875
|
- 服务端新增 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`
|
|
813
876
|
|
|
877
|
+
- 前端新增 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`
|
|
814
878
|
<!-- auto-i18n:end -->
|
|
815
879
|
|
|
816
880
|
## [0.89.0] — 2026-09-17
|
|
@@ -1791,7 +1855,8 @@ when?, children?}`,也收 `topbar` / `settings` 这类简写别名);宿主
|
|
|
1791
1855
|
- 0.35.1(2026-08-27):编辑重问保留附件(#18)+ 全窗口拖放(#19)。
|
|
1792
1856
|
- 0.29.0(2026-08-23):全局搜索弹窗(Ctrl+K)+ 消息列表惰性窗口化。
|
|
1793
1857
|
|
|
1794
|
-
[Unreleased]: https://github.com/xing-shuyin/pi-web-ui/compare/v0.
|
|
1858
|
+
[Unreleased]: https://github.com/xing-shuyin/pi-web-ui/compare/v0.108.0...main
|
|
1859
|
+
[0.108.0]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.108.0
|
|
1795
1860
|
[0.103.3]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.103.3
|
|
1796
1861
|
[0.103.2]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.103.2
|
|
1797
1862
|
[0.103.1]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.103.1
|
|
@@ -1813,6 +1878,7 @@ when?, children?}`,也收 `topbar` / `settings` 这类简写别名);宿主
|
|
|
1813
1878
|
[0.90.1]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.90.1
|
|
1814
1879
|
[0.90.0]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.90.0
|
|
1815
1880
|
[0.89.0]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.89.0
|
|
1881
|
+
[Unreleased]: https://github.com/xing-shuyin/pi-web-ui/compare/v0.88.0...main
|
|
1816
1882
|
[0.88.0]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.88.0
|
|
1817
1883
|
[0.87.2]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.87.2
|
|
1818
1884
|
[0.87.1]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.87.1
|
package/README.zh-TW.md
CHANGED
|
@@ -113,8 +113,8 @@ QQ 群組 1126050727
|
|
|
113
113
|
|
|
114
114
|
**代理工具與行內標記**
|
|
115
115
|
|
|
116
|
-
- **工具開關** —— 設定 →「工具」把所有可選工具逐個列出:統一的 `subagent` 工具(預設開)、以及另外
|
|
117
|
-
- **行內標記** —— 狀態改變不需要工具往返,AI
|
|
116
|
+
- **工具開關** —— 設定 →「工具」把所有可選工具逐個列出:統一的 `subagent` 工具(預設開)、以及另外 14 個工具 —— `edit_soft`、`browser_page`、`eval` 與 `lsp` 預設關,`delegate_task` / `ask_user_question` / `conversation_read` / `present_files` / `skill` / `schedule` / `claim_files` / `plan_update` / `patch` / `compact_context` 預設開。開關即時生效、不重新啟動,工具只是被停用仍保留註冊以便隨時開回;核心工具 `bash` 與 SDK 內建的 `read` / `write` / `edit` 走設定頁「核心工具」獨立區域管理。
|
|
117
|
+
- **行內標記** —— 狀態改變不需要工具往返,AI 直接把標記寫進回覆:不打斷的提醒用 `[[notify:<級別>:<內容>]]`,改對話標題用 `[[conv:rename:<標題>]]`,建議操作用 `[[action:suggest:<文字>]]`。氣泡定稿即執行,標記寫錯會以瀏覽器提示回顯。設定 →「工具」另有總開關與逐標記開關(這兩項全域共享)。
|
|
118
118
|
- **`edit_soft`** —— 更寬鬆的 `edit`(預設關):縮排/空白導致內建工具失敗時用它,先精確子串、再按去空白逐行核心比對,`newText` 原樣寫入並保留檔案換行符/BOM,結果帶 diff 與 unified patch。
|
|
119
119
|
- **`delegate_task`** —— 強制六段派單(TASK / EXPECTED OUTCOME / REQUIRED TOOLS / MUST DO / MUST NOT DO / CONTEXT)並在伺服器端校驗:範本不可用、任務少於 20 字或任一段為空都會被打回,並把可用範本清單回給模型。卡片按六段結構化展示,跑完後可一鍵跳到對應子代理對話。
|
|
120
120
|
- **`ask_user_question`** —— pi 引擎本身沒有問卷工具,這是 pi-web-ui 加的:模型可以問結構化問題(單選/多選 + 富文字選項預覽 + 自由文字),以對話方塊彈出;回答作為工具結果回給模型,取消則以工具錯誤返回,等你回答的時間不受工具看門狗限制,未答的問卷重新整理/重連後會恢復。
|
|
@@ -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;
|
|
@@ -25,7 +25,7 @@ import { homedir } from "node:os";
|
|
|
25
25
|
import { basename, delimiter, dirname, join, resolve, sep } from "node:path";
|
|
26
26
|
import { fileURLToPath } from "node:url";
|
|
27
27
|
import { writeAtomicSync } from "./atomic-file.js";
|
|
28
|
-
import { createAgentSessionFromServices, createAgentSessionRuntime, createAgentSessionServices, createBashToolDefinition, createCodemodeExtension, createEditToolDefinition, createFindToolDefinition, createGrepToolDefinition, createLocalBashOperations, createLsToolDefinition, createToolSearchExtension, createWriteToolDefinition, getAgentDir, SessionManager, VERSION, estimateTokens, } from "@earendil-works/pi-coding-agent";
|
|
28
|
+
import { createAgentSessionFromServices, createAgentSessionRuntime, createAgentSessionServices, createBashToolDefinition, createCodemodeExtension, createEditToolDefinition, createFindToolDefinition, createGrepToolDefinition, createLocalBashOperations, createLsToolDefinition, createToolSearchExtension, createWriteToolDefinition, resolveModelScopeWithDiagnostics, getAgentDir, SessionManager, VERSION, estimateTokens, } from "@earendil-works/pi-coding-agent";
|
|
29
29
|
import { Type } from "typebox";
|
|
30
30
|
import { BG_CLEANUP_FALLBACK_MIN, BgServerTracker } from "./bg-servers.js";
|
|
31
31
|
import { checkAll as checkAllUpdates, collectTargets, compareVersions as compareSemver, detectPiSdkSplit, resolveNpmRegistry, sortUpdateItems, } from "./update-check.js";
|
|
@@ -74,7 +74,7 @@ import { goalReviewDenial, shouldDeferPromptForReview } from "./goal-review-gate
|
|
|
74
74
|
import { readPlanModeFromSession, readPlanFromSession } from "./permission-preset.js";
|
|
75
75
|
import { readDelegateModeFromSession } from "./permission-preset.js";
|
|
76
76
|
import { applyHeadTail, makePersistentTerminalTools, makeTerminalBashTool, stripAnsi, TERMINAL_TOOLS_GUIDANCE, } from "./terminals.js";
|
|
77
|
-
import { applyAgentToolsGating, ASK_USER_QUESTION_TOOL_NAME, BROWSER_PAGE_TOOL_NAME, effectiveDisabledAgentTools, filterToolsByPreset, isAgentToolEnabled, isTerminalGuidanceOn, LAZY_CORE_TOOL_NAMES, lazyLoadingDisabledTools, LOAD_TOOLS_TOOL_NAME, localizedName,
|
|
77
|
+
import { applyAgentToolsGating, ASK_USER_QUESTION_TOOL_NAME, BROWSER_PAGE_TOOL_NAME, effectiveDisabledAgentTools, filterToolsByPreset, isAgentToolEnabled, isTerminalGuidanceOn, LAZY_CORE_TOOL_NAMES, lazyLoadingDisabledTools, LOAD_TOOLS_TOOL_NAME, localizedName, PI_AGENT_PRESETS, PI_PERMISSION_OPTIONS, PLAN_UPDATE_TOOL_NAME, PRESENT_FILES_TOOL_NAME, presetAllowsPluginTools, presetHasQuestionnaire, presetShowsSkillCatalog, } from "./tool-manager.js";
|
|
78
78
|
import { makeLoadToolsTool } from "./load-tools-tool.js";
|
|
79
79
|
import { formatCompactSignature } from "./tool-signature.js";
|
|
80
80
|
import { WebUIContext } from "./webui-context.js";
|
|
@@ -209,13 +209,12 @@ import { withPlanModeGate, withGoalReviewGate, withDelegationGate, makeLateToolG
|
|
|
209
209
|
export { withPlanModeGate, withGoalReviewGate, withDelegationGate, makeLateToolGuard, withToolGuard, isInsideWorkspaceRoots, wrapWriteToolWithPermission, EDIT_DESCRIPTION, EDIT_GUIDELINES, wrapEditToolWithPermission, wrapEditSoftToolWithPermission, wrapBashToolWithPermission, };
|
|
210
210
|
import { normalizeSolPlanToPlanSteps, makePlanUpdateTool } from "./plan-update-tool.js";
|
|
211
211
|
export { normalizeSolPlanToPlanSteps, makePlanUpdateTool };
|
|
212
|
-
import { makeMarkersListTool } from "./markers-list-tool.js";
|
|
213
212
|
import { makeAskUserQuestionTool, shouldPopQuestion } from "./ask-user-question-tool.js";
|
|
214
213
|
import { normalizePageCallTimeoutMs, collectBrowserPageArgs, formatPageCallResult, formatBrowserPageError, makeBrowserPageTool, extractShotImage, } from "./browser-page-tool.js";
|
|
215
214
|
export { makeAskUserQuestionTool, shouldPopQuestion, normalizePageCallTimeoutMs, collectBrowserPageArgs, formatPageCallResult, formatBrowserPageError, makeBrowserPageTool, extractShotImage, };
|
|
216
215
|
import { RUN_TASK_CAP, RUN_ARGS_CAP, RUN_RESULT_CAP, getMaxOpenConversations, getMaxSubagents, SUBAGENT_PROMPT_SNAPSHOT_CAP, DEFAULT_CONV_TITLE, truncRun, previewToolResult, atomicWriteFileSync, conversationTitle, pluginToolToDefinition, contentFingerprint, extractPartialText, extractAssistantTextFromContent, firstSentence, modelKeyOf, contextWindowOf, } from "./agent-formatters.js";
|
|
217
216
|
export { workspacePath };
|
|
218
|
-
import { MAX_TRANSCRIPT_SCAN_BYTES,
|
|
217
|
+
import { MAX_TRANSCRIPT_SCAN_BYTES, sessionMatchesMetadata, collectSessionAnchors, piSessionsRoot, isInsideSessionsDir, } from "./session-search.js";
|
|
219
218
|
export { piSessionsRoot, isInsideSessionsDir };
|
|
220
219
|
import { discoverRecentProjectsFromDisk, filterForkedParentSessions, findMostRecentSessionFileFast, parseSessionInfoFast, } from "./session-parser.js";
|
|
221
220
|
import { pickAdoptableOrphan, sameCwd } from "./orphan-manager.js";
|
|
@@ -291,6 +290,7 @@ export class ClientSession {
|
|
|
291
290
|
pluginTasks: () => this.pluginBgTasksProvider?.() ?? [],
|
|
292
291
|
// 「自动清理遗留实例」阈值(分钟;0 = 关):每轮定时器实时读设置。
|
|
293
292
|
cleanupMinutes: () => this.settingsSvc.current.bgAutoCleanupMin ?? 0,
|
|
293
|
+
workspaceCwd: () => this.convs.get(this.activeId)?.cwd ?? this.cwd,
|
|
294
294
|
});
|
|
295
295
|
/** index.ts 注入(经 AgentService 拷贝到每个新会话):把 SDK 工具执行事件转发给
|
|
296
296
|
* 插件(PluginManager.emitToolEvent)。未设置时不做任何事。 */
|
|
@@ -1645,7 +1645,7 @@ export class ClientSession {
|
|
|
1645
1645
|
sandboxes;
|
|
1646
1646
|
/** 当前工作区关联的 Git 工作树元数据(用于顶栏横幅与 AI 工具同步)。 */
|
|
1647
1647
|
worktreeInfo = null;
|
|
1648
|
-
/** 内置标记服务(
|
|
1648
|
+
/** 内置标记服务(action/notify/conv 等,可全局/分组开关)。 */
|
|
1649
1649
|
markerSvc;
|
|
1650
1650
|
// -----------------------------------------------------------------------
|
|
1651
1651
|
// 用户提问桥(标准 pi 引擎的 ask_user_question customTool):与 DSH 引擎的
|
|
@@ -1712,7 +1712,7 @@ export class ClientSession {
|
|
|
1712
1712
|
// issue #91:标记引导/错误按客户端 UI 语言出中英(英文默认)。
|
|
1713
1713
|
lang: () => this.getLang(),
|
|
1714
1714
|
});
|
|
1715
|
-
// 标记 widget 动态渲染「当前活动会话」的
|
|
1715
|
+
// 标记 widget 动态渲染「当前活动会话」的 overlay:切换会话时只要刷新
|
|
1716
1716
|
// webUi(见 switchConversation/setCwd/newChat)就会显示对应会话的标记,
|
|
1717
1717
|
// 且与扩展 widget 合并下发、不会互相覆盖。
|
|
1718
1718
|
this.webUi.setDynamicWidget("markers", () => this.markerSvc.overlayLines(this.activeId));
|
|
@@ -2459,8 +2459,6 @@ export class ClientSession {
|
|
|
2459
2459
|
...(ownerId
|
|
2460
2460
|
? [makeDelegateTaskTool(withSubagentOwner(this.subagentHost, ownerId))]
|
|
2461
2461
|
: [makeDelegateTaskTool(this.subagentHost)]),
|
|
2462
|
-
// 内置标记只读查询工具(todo/svc 状态查询,写操作走内联标记)。
|
|
2463
|
-
makeMarkersListTool(() => this.activeId, this.markerSvc),
|
|
2464
2462
|
// 结构化任务计划更新(Plan Mode / Step State Machine)。
|
|
2465
2463
|
makePlanUpdateTool(this.planManager, () => {
|
|
2466
2464
|
const id = ownerId ?? this.activeId;
|
|
@@ -3675,7 +3673,7 @@ export class ClientSession {
|
|
|
3675
3673
|
this.scheduleSessionsRefresh();
|
|
3676
3674
|
this.refreshConversationTitle(conv);
|
|
3677
3675
|
// 内联标记不在此兜底扫最后一条 assistant:每条气泡结束已走 message_end
|
|
3678
|
-
//
|
|
3676
|
+
// 即时解析(含中间文本块);这里再扫会把最后一条标记重复执行。
|
|
3679
3677
|
// Manual interrupt (Stop button / abort): the last assistant message
|
|
3680
3678
|
// carries stopReason "aborted". A half-finished run should NOT be
|
|
3681
3679
|
// reviewed (it would fail and inject a revision, only to be stopped
|
|
@@ -11505,10 +11503,12 @@ export class ClientSession {
|
|
|
11505
11503
|
.slice(0, 50)
|
|
11506
11504
|
.map((s) => {
|
|
11507
11505
|
const isPinned = this.stateStore?.isSessionPinned(this.cwd, s.path);
|
|
11506
|
+
const displayName = s.name?.trim() || (s.firstMessage ? s.firstMessage.trim().replace(/\s+/g, " ") : undefined);
|
|
11508
11507
|
const base = {
|
|
11509
11508
|
path: s.path,
|
|
11510
11509
|
...(s.id ? { sessionId: s.id } : {}),
|
|
11511
11510
|
name: s.name,
|
|
11511
|
+
displayName,
|
|
11512
11512
|
firstMessage: s.firstMessage,
|
|
11513
11513
|
messageCount: s.messageCount,
|
|
11514
11514
|
modified: s.modified.getTime(),
|
|
@@ -12159,13 +12159,30 @@ export class ClientSession {
|
|
|
12159
12159
|
// list must never fail because the catalog sync did
|
|
12160
12160
|
});
|
|
12161
12161
|
const available = await mr.getAvailable();
|
|
12162
|
-
|
|
12163
|
-
|
|
12164
|
-
|
|
12165
|
-
|
|
12166
|
-
|
|
12167
|
-
|
|
12168
|
-
|
|
12162
|
+
// 遵循 ~/.pi/agent/settings.json 中的 enabledModels 白名单限定(issue #646)
|
|
12163
|
+
let enabledSet = null;
|
|
12164
|
+
try {
|
|
12165
|
+
const sm = this.session?.settingsManager ?? this.runtime?.services?.settingsManager;
|
|
12166
|
+
const patterns = sm?.getEnabledModels?.();
|
|
12167
|
+
if (Array.isArray(patterns) && patterns.length > 0 && typeof resolveModelScopeWithDiagnostics === "function") {
|
|
12168
|
+
const { scopedModels } = await resolveModelScopeWithDiagnostics(patterns, mr);
|
|
12169
|
+
enabledSet = new Set(scopedModels.map((s) => `${s.model.provider}/${s.model.id}`));
|
|
12170
|
+
}
|
|
12171
|
+
}
|
|
12172
|
+
catch {
|
|
12173
|
+
// 作用域解析异常时静默回退全量(enabledSet 保持 null)
|
|
12174
|
+
}
|
|
12175
|
+
const models = available.map((m) => {
|
|
12176
|
+
const fullId = `${m.provider}/${m.id}`;
|
|
12177
|
+
return {
|
|
12178
|
+
id: fullId,
|
|
12179
|
+
name: this.cleanModelDisplayName(m.name),
|
|
12180
|
+
provider: m.provider,
|
|
12181
|
+
reasoning: m.reasoning,
|
|
12182
|
+
vision: m.input?.includes("image") ?? false,
|
|
12183
|
+
...(enabledSet ? { enabled: enabledSet.has(fullId) } : {}),
|
|
12184
|
+
};
|
|
12185
|
+
});
|
|
12169
12186
|
this.emit({ type: "models", models });
|
|
12170
12187
|
}
|
|
12171
12188
|
catch (err) {
|