@ai-zen/cli 1.0.0-alpha.27 → 1.0.0-alpha.30

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.
Files changed (171) hide show
  1. package/CHANGELOG.md +158 -0
  2. package/README.md +9 -6
  3. package/README.zh.md +9 -6
  4. package/dist/clipboard.d.ts +68 -0
  5. package/dist/clipboard.d.ts.map +1 -0
  6. package/dist/clipboard.js +177 -0
  7. package/dist/clipboard.js.map +1 -0
  8. package/dist/config-editor.d.ts +17 -0
  9. package/dist/config-editor.d.ts.map +1 -1
  10. package/dist/config-editor.js +31 -0
  11. package/dist/config-editor.js.map +1 -1
  12. package/dist/config.d.ts +53 -15
  13. package/dist/config.d.ts.map +1 -1
  14. package/dist/config.js +90 -26
  15. package/dist/config.js.map +1 -1
  16. package/dist/conversation-commands/registry.d.ts.map +1 -1
  17. package/dist/conversation-persist-plugin.d.ts.map +1 -1
  18. package/dist/conversation-persist-plugin.js.map +1 -1
  19. package/dist/conversation-repository.d.ts +23 -20
  20. package/dist/conversation-repository.d.ts.map +1 -1
  21. package/dist/conversation-repository.js +46 -37
  22. package/dist/conversation-repository.js.map +1 -1
  23. package/dist/cwd-tracker-plugin.d.ts.map +1 -1
  24. package/dist/cwd-tracker-plugin.js +17 -6
  25. package/dist/cwd-tracker-plugin.js.map +1 -1
  26. package/dist/handoff-service.js.map +1 -1
  27. package/dist/i18n/en-wizard.d.ts.map +1 -1
  28. package/dist/i18n/en-wizard.js +9 -6
  29. package/dist/i18n/en-wizard.js.map +1 -1
  30. package/dist/i18n/en.d.ts.map +1 -1
  31. package/dist/i18n/en.js +13 -2
  32. package/dist/i18n/en.js.map +1 -1
  33. package/dist/i18n/index.js.map +1 -1
  34. package/dist/i18n/preferences.d.ts +7 -4
  35. package/dist/i18n/preferences.d.ts.map +1 -1
  36. package/dist/i18n/preferences.js +15 -11
  37. package/dist/i18n/preferences.js.map +1 -1
  38. package/dist/i18n/zh-wizard.d.ts.map +1 -1
  39. package/dist/i18n/zh-wizard.js +9 -6
  40. package/dist/i18n/zh-wizard.js.map +1 -1
  41. package/dist/i18n/zh.d.ts.map +1 -1
  42. package/dist/i18n/zh.js +13 -2
  43. package/dist/i18n/zh.js.map +1 -1
  44. package/dist/index.js +11 -0
  45. package/dist/index.js.map +1 -1
  46. package/dist/sdk-log.d.ts +15 -3
  47. package/dist/sdk-log.d.ts.map +1 -1
  48. package/dist/sdk-log.js +29 -9
  49. package/dist/sdk-log.js.map +1 -1
  50. package/dist/session-pointer.d.ts.map +1 -1
  51. package/dist/session-pointer.js +10 -4
  52. package/dist/session-pointer.js.map +1 -1
  53. package/dist/sub-agent-guard-plugin.d.ts.map +1 -1
  54. package/dist/tui/chat-history.d.ts +29 -0
  55. package/dist/tui/chat-history.d.ts.map +1 -0
  56. package/dist/tui/chat-history.js +55 -0
  57. package/dist/tui/chat-history.js.map +1 -0
  58. package/dist/tui/chat-session.d.ts +31 -2
  59. package/dist/tui/chat-session.d.ts.map +1 -1
  60. package/dist/tui/chat-session.js +64 -9
  61. package/dist/tui/chat-session.js.map +1 -1
  62. package/dist/tui/components.d.ts +65 -5
  63. package/dist/tui/components.d.ts.map +1 -1
  64. package/dist/tui/components.js +85 -13
  65. package/dist/tui/components.js.map +1 -1
  66. package/dist/tui/config-wizard/detail.d.ts +6 -4
  67. package/dist/tui/config-wizard/detail.d.ts.map +1 -1
  68. package/dist/tui/config-wizard/detail.js +20 -14
  69. package/dist/tui/config-wizard/detail.js.map +1 -1
  70. package/dist/tui/config-wizard/engine.d.ts +1 -1
  71. package/dist/tui/config-wizard/engine.d.ts.map +1 -1
  72. package/dist/tui/config-wizard/engine.js +18 -6
  73. package/dist/tui/config-wizard/engine.js.map +1 -1
  74. package/dist/tui/config-wizard/fields.d.ts.map +1 -1
  75. package/dist/tui/config-wizard/fields.js +1 -30
  76. package/dist/tui/config-wizard/fields.js.map +1 -1
  77. package/dist/tui/config-wizard/frame.js +1 -1
  78. package/dist/tui/config-wizard/kv-editor.d.ts.map +1 -1
  79. package/dist/tui/config-wizard/kv-editor.js +4 -0
  80. package/dist/tui/config-wizard/kv-editor.js.map +1 -1
  81. package/dist/tui/config-wizard/list.d.ts +3 -1
  82. package/dist/tui/config-wizard/list.d.ts.map +1 -1
  83. package/dist/tui/config-wizard/list.js +3 -4
  84. package/dist/tui/config-wizard/list.js.map +1 -1
  85. package/dist/tui/config-wizard/prompt-editor.d.ts +8 -1
  86. package/dist/tui/config-wizard/prompt-editor.d.ts.map +1 -1
  87. package/dist/tui/config-wizard/prompt-editor.js +7 -4
  88. package/dist/tui/config-wizard/prompt-editor.js.map +1 -1
  89. package/dist/tui/config-wizard/step-agents.d.ts.map +1 -1
  90. package/dist/tui/config-wizard/step-agents.js +25 -13
  91. package/dist/tui/config-wizard/step-agents.js.map +1 -1
  92. package/dist/tui/config-wizard/step-endpoints.d.ts.map +1 -1
  93. package/dist/tui/config-wizard/step-endpoints.js +18 -15
  94. package/dist/tui/config-wizard/step-endpoints.js.map +1 -1
  95. package/dist/tui/config-wizard/step-mcp.d.ts.map +1 -1
  96. package/dist/tui/config-wizard/step-mcp.js +15 -9
  97. package/dist/tui/config-wizard/step-mcp.js.map +1 -1
  98. package/dist/tui/config-wizard/step-models.d.ts.map +1 -1
  99. package/dist/tui/config-wizard/step-models.js +67 -27
  100. package/dist/tui/config-wizard/step-models.js.map +1 -1
  101. package/dist/tui/config-wizard/types.d.ts +12 -0
  102. package/dist/tui/config-wizard/types.d.ts.map +1 -1
  103. package/dist/tui/file-index.d.ts +38 -0
  104. package/dist/tui/file-index.d.ts.map +1 -0
  105. package/dist/tui/file-index.js +117 -0
  106. package/dist/tui/file-index.js.map +1 -0
  107. package/dist/tui/index.d.ts.map +1 -1
  108. package/dist/tui/index.js +1 -1
  109. package/dist/tui/index.js.map +1 -1
  110. package/dist/tui/key-debug.js.map +1 -1
  111. package/dist/tui/mention.d.ts +47 -0
  112. package/dist/tui/mention.d.ts.map +1 -0
  113. package/dist/tui/mention.js +152 -0
  114. package/dist/tui/mention.js.map +1 -0
  115. package/dist/tui/mouse.js.map +1 -1
  116. package/dist/tui/phase.d.ts.map +1 -1
  117. package/dist/tui/screens/chat-commands.d.ts +8 -0
  118. package/dist/tui/screens/chat-commands.d.ts.map +1 -1
  119. package/dist/tui/screens/chat-commands.js +60 -34
  120. package/dist/tui/screens/chat-commands.js.map +1 -1
  121. package/dist/tui/screens/chat.d.ts +37 -0
  122. package/dist/tui/screens/chat.d.ts.map +1 -1
  123. package/dist/tui/screens/chat.js +238 -31
  124. package/dist/tui/screens/chat.js.map +1 -1
  125. package/dist/tui/screens/common-keys.js.map +1 -1
  126. package/dist/tui/screens/frame-buffer.d.ts.map +1 -1
  127. package/dist/tui/screens/frame-buffer.js.map +1 -1
  128. package/dist/tui/screens/index.d.ts +1 -1
  129. package/dist/tui/screens/index.d.ts.map +1 -1
  130. package/dist/tui/screens/index.js +1 -1
  131. package/dist/tui/screens/index.js.map +1 -1
  132. package/dist/tui/screens/input.d.ts +30 -1
  133. package/dist/tui/screens/input.d.ts.map +1 -1
  134. package/dist/tui/screens/input.js +39 -2
  135. package/dist/tui/screens/input.js.map +1 -1
  136. package/dist/tui/screens/layout.d.ts +14 -0
  137. package/dist/tui/screens/layout.d.ts.map +1 -1
  138. package/dist/tui/screens/layout.js +22 -11
  139. package/dist/tui/screens/layout.js.map +1 -1
  140. package/dist/tui/screens/messages-view.d.ts.map +1 -1
  141. package/dist/tui/screens/messages-view.js +6 -2
  142. package/dist/tui/screens/messages-view.js.map +1 -1
  143. package/dist/tui/screens/notice.d.ts.map +1 -1
  144. package/dist/tui/screens/notice.js.map +1 -1
  145. package/dist/tui/screens/overlays.js +1 -1
  146. package/dist/tui/screens/render.d.ts +1 -1
  147. package/dist/tui/screens/render.d.ts.map +1 -1
  148. package/dist/tui/screens/render.js +6 -2
  149. package/dist/tui/screens/render.js.map +1 -1
  150. package/dist/tui/screens/use-input-editing.d.ts +29 -4
  151. package/dist/tui/screens/use-input-editing.d.ts.map +1 -1
  152. package/dist/tui/screens/use-input-editing.js +42 -14
  153. package/dist/tui/screens/use-input-editing.js.map +1 -1
  154. package/dist/tui/screens/use-wizard-host.d.ts +12 -1
  155. package/dist/tui/screens/use-wizard-host.d.ts.map +1 -1
  156. package/dist/tui/screens/use-wizard-host.js +26 -7
  157. package/dist/tui/screens/use-wizard-host.js.map +1 -1
  158. package/dist/tui/status-segments.js.map +1 -1
  159. package/dist/tui/text.d.ts +7 -0
  160. package/dist/tui/text.d.ts.map +1 -1
  161. package/dist/tui/text.js +5 -1
  162. package/dist/tui/text.js.map +1 -1
  163. package/dist/tui/theme.d.ts.map +1 -1
  164. package/dist/tui/token-rate.d.ts.map +1 -1
  165. package/dist/tui/token-rate.js.map +1 -1
  166. package/dist/user-content.d.ts +41 -0
  167. package/dist/user-content.d.ts.map +1 -0
  168. package/dist/user-content.js +37 -0
  169. package/dist/user-content.js.map +1 -0
  170. package/dist/version.js.map +1 -1
  171. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,3 +1,161 @@
1
+ ## [1.0.0-alpha.30] - 2026-11-02
2
+
3
+ > 本版把 22 条审查问题一次收口。有三处直接改变手感:补全菜单改为底部锚定、多行输入里
4
+ > `↑`/`↓` 先移光标、输入区限高 8 行;另外详情屏不再暴露 `custom`,换成了「恢复出厂设置」。
5
+ >
6
+ > 注:`1.0.0-alpha.28` / `.29` 的条目此前也只在本地(registry 上的 `alpha` 停在 alpha.27),
7
+ > 本版一并带出去。
8
+
9
+ ### 💥 行为变更
10
+
11
+ - **补全菜单改为底部锚定** —— `/` 命令与 `@` 路径共用一套 `BottomMenu`:`items[0]` 紧贴输入框,
12
+ 其余向上生长、装不下从顶端丢弃;行数上限由布局按剩余空间放行(不再固定 8 行),
13
+ 渲染与 IME 光标读同一个 `layout.hintRows`。说明文字不再把命令名挤成一截。
14
+ - **`↑` / `↓` 先移动光标** —— 多行草稿里到首行 / 末行才翻历史(原来一按就跳历史)。
15
+ - **输入区限高 8 行**,窗口跟随光标(原来钉住末尾,光标退到第一行时会消失在框外)。
16
+ - **`↑` 翻历史带图片** —— 历史数据源统一到 `messages`,回到带图消息时图片一起恢复;
17
+ `file_id` 类型的历史图片只能恢复文本(本地没有副本)。
18
+ - **`/load` 列表只显示会话文件名** —— 不再逐个读会话文件解析摘要。
19
+ - **`/save <名字>`** —— 另存为指定文件名(旧文件名消失、last-session 指针跟随);
20
+ 重名且不是当前会话时先二次确认。
21
+ - **详情屏不再有 `custom` 开关,改为「恢复出厂设置」** —— 出厂模型 / 图片模型用出厂定义
22
+ **整条替换**(`custom` 随之消失 = 重新归 SDK 托管);默认 Agent 只把提示词换回出厂,
23
+ 名称 / 描述 / 模型 / 权限全部保留;出厂清单里没有同 id 的(自建)不显示该动作。
24
+ - **粘贴文本 256KB 上限** —— 超了报错且**不截断**(半截代码 / 半截 JSON 比不粘更坑)。
25
+ - **写句子不再乱弹 `@` 菜单** —— token 边界补上 `。 、 ! ? ( ) 《 》 【 】 〔 〕 「 」 『 』 … — ~`。
26
+ - **没有端点时禁止新建模型 / 图片模型** —— 以前能创建出 `endpointId: ""` 的空壳。
27
+ - **坏掉的 `mcp.json` 不再冒充空配置** —— MCP 屏写明「无法解析」、照样能编辑,
28
+ 保存产出的正是一份格式正确的新文件(那是修复,不是覆盖丢数据)。
29
+
30
+ ### 🐛 修复
31
+
32
+ - KV 编辑器删掉末项后回车崩溃(光标钳到新的末项)。
33
+ - `SelectList` 列表变短后回车崩溃(渲染与确认都走 `safeIndex`)。
34
+ - 自动落盘失败混在 info 语气里上报。
35
+ - `/back` 撤回后不落盘(存档里还留着被撤回的消息)。
36
+ - 删掉默认 Agent 时没清 `config.defaultAgent`,下次启动死在「Agent 未绑定模型」。
37
+ - stdout 被提前关闭时打 EPIPE 堆栈(按正常结束处理)。
38
+ - `/load` `/back` 选择器条数预算少扣 2 行,最后两条被吸底布局吃掉。
39
+ - `truncate` 按字素簇截断,不再把 emoji 劈成孤立代理项。
40
+ - e2e 断言与事实不符(`ai hook` 写 stdout、退出码 0),且被 `vitest.config.ts` 排除、
41
+ 永远不会红 —— 断言修正后从 5 红变全绿。
42
+
43
+ ### 🔒 安全
44
+
45
+ - **`@ai-zen/agents-sdk` 升到 `1.0.0-alpha.25`**:`EntityRepository.path()` 校验实体 id 不得逃出
46
+ 仓储目录(`resolve` + `root + sep`,裸 `startsWith` 拦不住 `<root>-evil`)。`/save ../x`
47
+ 现在明确报错,不再可能写到会话目录之外。这一版同时带上 SDK 的端点 `capabilities`
48
+ 迁移回填(老的 `deepseek` 端点会补上 `filesApi`,图片改走 Files API)。
49
+
50
+ ### ✅ 测试
51
+
52
+ - 单测 **57 文件 / 798 例通过**,e2e **9 passed / 3 skipped**(3 条需真 API key),
53
+ `tsc --noEmit` 干净。
54
+ - 发布门禁 `prepublishOnly` 改为 `npm run test:all`(单测 + 构建 + e2e);
55
+ `npm test` 语义不变,仍只跑类型 + 单测。
56
+ - 测试耗时 43.6s → ~8s:去掉 `isolate`、单 fork、依赖注入替换全部模块级 `vi.mock`。
57
+
58
+ ## [1.0.0-alpha.29] - 2026-10-31
59
+
60
+ > `Ctrl+V` 从「弹一句未支持」变成**真的粘贴**:剪贴板里有图片就附在消息上,
61
+ > 没有就退回粘贴文本。
62
+
63
+ ### ✨ 新功能
64
+
65
+ - **粘贴图片** —— `Ctrl+V`(kitty 协议下 `⌘V`)先问系统剪贴板要图片,有图就附到待发送
66
+ 消息上,输入框上方出现 `📎 已附加 N 张图片 · Ctrl+V 再加 · Esc 清空`;没有图片则
67
+ 当作普通粘贴,把剪贴板文本插到光标处。按平台探测:
68
+
69
+ | 平台 | 图片 | 文本 |
70
+ |---|---|---|
71
+ | macOS | `osascript -e "get the clipboard as «class PNGf»"`(stdout 是 `«data PNGf<HEX>»`) | `pbpaste` |
72
+ | Linux | `wl-paste --type image/png`(Wayland)→ `xclip -t image/png -o`(X11) | `wl-paste --no-newline` → `xclip -o` |
73
+ | Windows | PowerShell `Get-Clipboard -Format Image` → PNG → base64 | `Get-Clipboard -Raw` |
74
+
75
+ - **全程不落盘** —— 图片以 base64 直接交给 SDK 的 `fileToContentSection()`(它的
76
+ `FileSource` 本来就有 `{ base64, mime }` 变体):上传 Files API 还是内联 base64、
77
+ 模型不支持视觉时怎么退化,全部由 SDK 按当前端点决定,CLI 不重复实现、也不硬编码端点。
78
+ - **一条消息最多 4 张**(`MAX_PASTED_IMAGES`):一张截图内联后常 1~3MB,再多一次请求
79
+ 就是几十 MB。超限、图片过大(>20MB)、剪贴板为空、没有剪贴板工具,各有独立提示。
80
+
81
+ ### 🎨 交互
82
+
83
+ - **图片优先、文本兑底**,顺序不能反:文本先粘进去就来不及了(草稿里已经多了一坨东西)。
84
+ - `Esc` 有附件时**先清附件、草稿保留** —— 误粘一张总有退路,又不必让 `ESC` 变成
85
+ 「清空一切」的随机键。
86
+ - 附件提示行恒为一行,行数同时计入 `computeChatLayout`(占高)与
87
+ `computeInputCursorPosition`(IME 光标 y)—— 差一行输入框就整体位移,这条有前科。
88
+ - 乐观回显按「文本段 + 图片占位块」构造,与实际发送的结构一致(否则图片那几条会在
89
+ 真实消息落地前闪一下不见);转录里内联图片只显示 `[图片]`,不把几十万字符的
90
+ data URL 铺到屏幕上(远程 URL 才带地址)。
91
+
92
+ ### 🐛 修复
93
+
94
+ - **带图片的消息会丢掉 cwd 注入** —— `CwdTrackerPlugin` 原来只找 `content` 是字符串的
95
+ 用户消息,换成内容块数组后会被直接跳过,那一轮模型看到的还是上一轮的工作目录。
96
+ 现在追加到**最后一个 text 段**上;数组里没有 text 段时补一段。
97
+ - README / getting-started 里「`PgUp`/`PgDn`(或 `Alt+V`/`Ctrl+V`)翻页」是错的:
98
+ `Ctrl+V` 从未兼任翻页(`common-keys.ts` 只认 `Alt+V`),已修正。
99
+
100
+ ### ✅ 测试
101
+
102
+ - 新增 33 例:`clipboard.test.ts` 15(三平台命令选择 / osascript 十六进制解析 / 缺工具 /
103
+ 空输出 / 超限 / CRLF 归一)、`user-content.test.ts` 6(文本段在首位 / 部分失败 /
104
+ 全失败退回纯文本 / warning 透传)、`cwd-tracker-plugin.test.ts` 4(字符串 / 内容块 /
105
+ 只有图片 / 不重复注入)、`pasted-images.test.tsx` 3(恒一行 / 布局多占一行 / 光标 y 同步)、
106
+ `chat.test.tsx` +5(无图粘文本 / 有图出附件行 / Esc 清附件保草稿 / 发送带图 / 空剪贴板提示)。
107
+ - 全量 **57 文件 / 741 例通过**,`tsc --noEmit` 0 错误。
108
+ - 真产物验证(本机 Linux、无剪贴板工具):`readClipboardImage() → { kind: "none" }`、
109
+ `readClipboardText() → null`,11ms 不抛错;不打桩地跑真实 SDK 转换,`vision: true` 得到
110
+ `image_url` 内联块,`vision` 缺省得到文本提示 + warning。
111
+
112
+ ## [1.0.0-alpha.28] - 2026-10-31
113
+
114
+ > 输入框里敲 `@` 唤起**文件路径补全** —— 补进去的是相对路径文本,模型用 `read` 工具自己去读。
115
+
116
+ ### ✨ 新功能
117
+
118
+ - **`@` 文件路径补全** —— 敲 `@` 弹出项目内候选,`↑`/`↓` 选择、`Tab` 或 `Enter` 补进草稿、
119
+ `Esc` 只关菜单(不动草稿)。三层拆分,与仓库既有风格一致:
120
+ - `tui/mention.ts`(纯逻辑):`extractMention()` 判「光标在不在一个 `@token` 里」、
121
+ `rankPaths()` 子序列模糊排序、`menuWindow()` 视窗、`mentionMenuRows()` 行数;
122
+ - `tui/file-index.ts`(IO):`git ls-files -co --exclude-standard` 优先(尊重 `.gitignore`、
123
+ 含未跟踪文件),非 git 目录回落 `fs.glob` 并排除 `node_modules` / `.git` / `dist`;
124
+ 15s 缓存、20000 条封顶、5s 超时;
125
+ - `screens/chat.tsx`:按键 → 候选 → `replaceRange()` 落字的接线。
126
+ - **判据落在字符事实上**:从光标往回扫到空白 / 行首,途中遇到 `@` 且其前一个是行首、空白或
127
+ 分隔符才算 mention。于是 `a@b.com` 不会弹菜单;`@src/tui`、`(@src/x)`、`"@src/x"` 都会;
128
+ 光标停在 token 中间(`@src|/foo.ts`)时 query 截止于光标、`end` 向后吃掉整个 token ——
129
+ 补全替换的是整段,不会留下半截残字。
130
+ - **排序**:贪婪子序列 + 跳跃惩罚 + 连续命中奖励;**整体前缀 > 文件名前缀**,同分时浅的 / 短的
131
+ 优先。实测本仓:`@` → 182 条索引里取 50 条(1.1ms)、`@chat` 命中 19 条(0.2ms)、
132
+ `@file-index` 精确命中 2 条(0.1ms)。
133
+ - **目录可逐层往下钻**:选中目录补尾斜杠(`@src/tui/`),补完菜单重新过滤出该目录下内容,
134
+ 于是能一路 `@src/` → `@src/tui/` → 目标文件。
135
+
136
+ ### 🎨 交互
137
+
138
+ - `Tab` / `Enter` = **补全不发送**(选完继续接着写,避免误发半截消息);`Esc` 只关菜单,
139
+ 不清草稿(原 `Esc` 语义是清空草稿,`@` 打一半按 Esc 会连正文一起没)。
140
+ - 候选可能几十条,菜单**最多占 8 行**并随高亮滚动;索引未就绪时先占一行「正在扫描项目文件…」。
141
+ - 行数有**唯一真源** `mentionMenuRows()`:`computeChatLayout` 的 `hintCount`、IME 光标的 y 坐标、
142
+ `MentionMenu` 实际渲染三处同源,并有用例断言 `mentionMenuRows(n) === menuWindow(n)` 的行数。
143
+ - 占位提示改为「输入消息,/ 命令,@ 文件…」,让这个入口能被看见。
144
+
145
+ ### 🔧 重构
146
+
147
+ - `useInputEditing` 新增 `replaceRange(start, end, text)`:整段替换**并记撤销快照**,
148
+ 补错了 `Ctrl+_` 能退回(用 `setInputText` 会绕过撤销栈)。
149
+
150
+ ### ✅ 测试
151
+
152
+ - 新增 39 例:`mention.test.ts` 22(提取 / 插入 / 排序 / 视窗 / 行数一致)、
153
+ `file-index.test.ts` 9(git 清单归一 / 缓存 TTL / cwd 切换 / 兜底 / 异常收敛 / 真磁盘)、
154
+ `components-mention.test.tsx` 5(8 行封顶 / 滚动跟随 / 目录尾斜杠 / 扫描占位 / 无匹配不占行)、
155
+ `chat.test.tsx` +6(弹菜单 / Tab 补全不发送 / Enter 补全 / ↓ 换高亮 / Esc 只关菜单 / 无匹配照常发)、
156
+ `use-input-editing.test.tsx` +3(区间替换 / 可撤销 / 越界钳制)。
157
+ - 全量 **53 文件 / 708 例通过**,`tsc --noEmit` 0 错误。
158
+
1
159
  ## [1.0.0-alpha.27] - 2026-10-29
2
160
 
3
161
  > SDK 的警告与错误现在会进通知栏——**通用通道**,不为某个功能单独接线。
package/README.md CHANGED
@@ -66,7 +66,7 @@ When run with no arguments on an interactive terminal, the CLI opens a full-scre
66
66
  ╚═╝ ╚═╝╚═╝ ╚══════╝╚══════╝╚═╝ ╚═══╝
67
67
 
68
68
  AI workbench in your terminal
69
- v1.0.0-alpha.27 · sdk x · core y
69
+ v1.0.0-alpha.30 · sdk x · core y
70
70
  ```
71
71
 
72
72
  After the splash, you land **directly in the chat screen** (resuming the last session if there is one, otherwise starting a new conversation). The chat screen is **bottom-pinned**: a divider, the input line, and a **status bar** (three priority-ordered blocks: model · agent · reasoning effort | this-round / cumulative tokens · generation rate | key hints; a block that does not fit moves to the next line whole, so nothing is truncated and no block gets split) always sit at the bottom of the terminal, while the conversation scrolls above them. While generating, the spinner replaces the input line and its label shows **which phase** the round is in: connecting → queued → thinking → calling a tool → waiting for the tool to return → streaming; the two tool phases include the tool name. The generation rate shows a live value while streaming (2-second sliding window, estimated from output deltas) and switches to this round's average once it finishes (preferring the real `completion_tokens` from the API).
@@ -75,7 +75,9 @@ While sub-agents are running, a **main / sub-agent bar** appears below the trans
75
75
 
76
76
  **Messages that never enter the context are struck through**: the criterion is core's `formatHistory()` filter (`status` not `Completed`, or `omit`). That covers a turn reconciled away by the `drop` strategy after an interrupt, or a failed request — the message stays visible in the transcript but is crossed out, so you can tell at a glance "it's still here, but the model never sees it". The message currently streaming is not struck (that's "not yet", not "discarded").
77
77
 
78
- The chat screen provides a streaming output area (reasoning / answer / tool calls on separate lines), a multiline input (`Enter` sends; `Ctrl+N` inserts a newline; `← →` move the cursor, `Ctrl+← →` by word; `Ctrl+W` / `Alt+Backspace` delete the previous word, `Alt+D` / `Ctrl+Delete` the next word; `Ctrl+K` kills to end of line; `Ctrl+U` kills to line start; `PgUp`/`PgDn` (or `Alt+V`/`Ctrl+V`) scroll the transcript, the mouse wheel scrolls by line; on macOS `⌘← →` moves by word, `⌘⌫`/`⌘⌦` deletes by word, `⌘[`/`⌘]` pages and `⌘;`/`⌘'` scrolls by line (depending on whether the terminal reports Cmd — see below)., and an inline `/` command menu (↑↓ to choose, `Tab` to complete). Tool calls render as `⚙ name(args)` with **JSON syntax highlighting**; the answer / reasoning is **Markdown-source-colored** (headings, bold, italic, inline code, lists, quotes, links), and fenced code blocks are **syntax-highlighted by language with the fence markers kept** (highlight data from `highlight.js` via `lowlight`). `Ctrl+C` cancels the current request while generating, and exits when idle.
78
+ **`@` triggers file-path completion**: type `@` in the input and a project-wide candidate list pops up (`@chat` narrows straight to `src/tui/screens/chat.tsx`; `@src/tui/` keeps descending directory by directory). `↑`/`↓` to choose, `Tab` or `Enter` to insert, `Esc` to dismiss the menu only (your draft is kept). What gets inserted is the **relative path as plain text** (`@src/tui/screens/chat.tsx`); the message stays ordinary text and the model reads the file itself with the `read` tool — so a wrong completion is one `Ctrl+_` away, and large files never get stuffed into the context. Candidates come from `git ls-files -co --exclude-standard` (honours `.gitignore`, includes untracked files), falling back to `fs.glob` with `node_modules` / `.git` / `dist` excluded outside a git repo; the index is cached for 15 seconds; the menu is anchored right above the input and grows upward until it runs out of room (whatever does not fit is dropped from the top, so the entry next to the input is always the one you are on).
79
+
80
+ The chat screen provides a streaming output area (reasoning / answer / tool calls on separate lines), a multiline input (`Enter` sends; `Ctrl+N` inserts a newline; `← →` move the cursor, `Ctrl+← →` by word; `Ctrl+W` / `Alt+Backspace` delete the previous word, `Alt+D` / `Ctrl+Delete` the next word; `Ctrl+K` kills to end of line; `Ctrl+U` kills to line start; `PgUp`/`PgDn` (or `Alt+V`) scroll the transcript, the mouse wheel scrolls by line; on macOS `⌘← →` moves by word, `⌘⌫`/`⌘⌦` deletes by word, `⌘[`/`⌘]` pages and `⌘;`/`⌘'` scrolls by line (depending on whether the terminal reports Cmd — see below)., and an inline `/` command menu (↑↓ to choose, `Tab` to complete). Tool calls render as `⚙ name(args)` with **JSON syntax highlighting**; the answer / reasoning is **Markdown-source-colored** (headings, bold, italic, inline code, lists, quotes, links), and fenced code blocks are **syntax-highlighted by language with the fence markers kept** (highlight data from `highlight.js` via `lowlight`). `Ctrl+C` cancels the current request while generating, and exits when idle.
79
81
 
80
82
  ### Keyboard & terminal compatibility (macOS, etc.)
81
83
 
@@ -101,6 +103,7 @@ Key map (aligned with [Claude Code](https://docs.claude.com/en/docs/claude-code/
101
103
  | `Esc` | While generating: interrupt; otherwise clear the draft and jump to the bottom |
102
104
  | `Ctrl+A` / `Ctrl+E` | Line start / end |
103
105
  | `Ctrl+P` / `Ctrl+N` | Previous / next history entry (also moves the slash menu) |
106
+ | `↑` / `↓` | In a multi-line draft: move between visual rows; at the first / last row they walk history. With the `/` or `@` menu open they pick an entry |
104
107
  | `Ctrl+K` / `Ctrl+U` | Kill to line end / line start |
105
108
  | `Ctrl+W` | Kill back to the previous whitespace (punctuation does not split: `src/utils/foo.ts` goes in one press) |
106
109
  | `Alt+B` / `Alt+F` | Move by word |
@@ -108,7 +111,7 @@ Key map (aligned with [Claude Code](https://docs.claude.com/en/docs/claude-code/
108
111
  | `Ctrl+Y` / `Alt+Y` | Yank the last killed text / cycle older entries |
109
112
  | `Ctrl+_` | Undo the last input edit |
110
113
  | `Ctrl+S` | Stash the draft / press again to restore |
111
- | `Ctrl+V` | Reserved for image paste (**not implemented yet**; shows a notice) |
114
+ | `Ctrl+V` | Paste: attaches the clipboard image if there is one, otherwise pastes text (text over 256KB is refused, not truncated) |
112
115
  | `Ctrl+L` | Clear the screen (context kept) |
113
116
  | `PgUp` / `PgDn` | Page through the transcript |
114
117
  | Mouse wheel | Scroll by line (3 lines per notch). With mouse reporting on, text selection needs `Shift` (native terminal selection); `tmux` users need `set -g mouse off`, otherwise the wheel is swallowed by copy-mode |
@@ -119,7 +122,7 @@ Key map (aligned with [Claude Code](https://docs.claude.com/en/docs/claude-code/
119
122
 
120
123
  Not implemented (no counterpart here): `Ctrl+O` transcript viewer, `Ctrl+R` reverse search, `Ctrl+B` background tasks, `Ctrl+T` task list, `Shift+Tab` permission modes.
121
124
 
122
- `Ctrl+V` (Claude Code's "paste image") is **not implemented yet** — pressing it shows a notice. It first needs a proper "file → content block" capability probe (Files API upload vs base64 inline) instead of hard-coding a single endpoint. Note that macOS maps `⌘⌫` to `Ctrl+U`, which is why `Ctrl+U` kills to line start here; use `Esc` to clear the draft.
125
+ `Ctrl+V` is **image first, text as fallback**: it asks the system clipboard for an image (via `osascript` on macOS, `wl-paste` / `xclip` on Linux, PowerShell on Windows) and, if there is one, attaches it to the message (an `📎 N attached` line appears above the input, up to 4 images, `Esc` clears them). With no image on the clipboard it behaves like a normal paste and inserts the text at the cursor. Text over 256KB is **refused, not truncated** — half a file in the draft is worse than none — and the notice points at `@`-referencing it from a file instead. Nothing is written to disk — the image becomes a content block straight from base64, and whether it goes through the Files API or inline is decided by the SDK based on the current endpoint; when the model does not declare `vision: true`, the SDK degrades it to a path hint and says so in the notice bar. Note that macOS maps `⌘⌫` to `Ctrl+U`, which is why `Ctrl+U` kills to line start here; use `Esc` to clear the draft.
123
126
 
124
127
  \* `⌘` combos only carry the `super` bit when the terminal **enables the kitty keyboard protocol** (and for iTerm2, when Cmd is mapped to Super). Terminals without it (e.g. Apple Terminal) can only map `⌘` to `ESC` sequences (e.g. `⌘←` → `ESC[1;9D`, equivalent to `Alt+←`), or you can use the Alt combos above.
125
128
 
@@ -192,8 +195,8 @@ While in a conversation, all commands start with `/`. Typing `/` lists the avail
192
195
  | Command | Description |
193
196
  |---------|-------------|
194
197
  | `/exit` `/quit` | Exit the conversation (offers to save) |
195
- | `/save` | Save the conversation (already flushed every turn) |
196
- | `/load` | Load a conversation (replaces this one) |
198
+ | `/save [name]` | Save the conversation (already flushed every turn); with a name it is saved as that file name (a rename — it asks first if the name already exists) |
199
+ | `/load` | Load a conversation (replaces this one; the picker lists saved conversation file names only) |
197
200
  | `/new` | Reset the conversation (clear history) |
198
201
  | `/back` | Retract a message (roll back to a point and resend) |
199
202
  | `/editor` | Compose a long message in your editor (vim/nano) |
package/README.zh.md CHANGED
@@ -66,7 +66,7 @@ ai --version
66
66
  ╚═╝ ╚═╝╚═╝ ╚══════╝╚══════╝╚═╝ ╚═══╝
67
67
 
68
68
  终端里的 AI 协作台
69
- v1.0.0-alpha.27 · sdk x · core y
69
+ v1.0.0-alpha.30 · sdk x · core y
70
70
  ```
71
71
 
72
72
  启动界面结束后**直接进入对话界面**(若存在「上一轮会话」则自动续接,否则新建对话)。对话界面采用**底部固定**布局:分隔线、输入行与**状态栏**(按优先级分三块:模型 · Agent · 思考强度 | 本轮 / 累计 token 用量 · 生成速率 | 快捷键提示;窄屏时放不下的块整块顺延到下一行,既不截断内容也不劈开单块)始终贴在终端底部,对话内容在其上方滚动;生成中时输入行位置显示**分阶段进度**(连接中 → 排队中 → 思考中 → 调用工具 → 等待工具返回 → 输出中,工具阶段带上工具名)。生成速率在生成中显示实时值(最近 2 秒滑动窗口,按输出增量估算),一轮结束后换成这一轮的平均值(优先用 API 返回的真实 `completion_tokens`)。
@@ -75,7 +75,9 @@ ai --version
75
75
 
76
76
  **不进上下文的消息会划删除线**:判据与 core 的 `formatHistory()` 同源(`status` 非 `Completed` 或带 `omit`)。比如中断后按 `drop` 策略结算的那一轮、或请求出错的那条 —— 它们仍在转录里可见,但整行划掉,一眼看出「还在,可没发给模型」;正在流式输出的那条不算(那是「尚未」,不是「被丢弃」)。
77
77
 
78
- 对话界面包含:流式输出区(思考过程 / 回答正文 / 工具调用分行展示)、多行输入(`Enter` 发送、`Ctrl+N` 换行、`← →` 移动光标、`Ctrl+← →` 跨词、`Ctrl+W` / `Alt+Backspace` 删前一个词、`Alt+D` / `Ctrl+Delete` 删后一个词、`Ctrl+K` 删到行尾、`Ctrl+U` 删到行首、`PgUp`/`PgDn`(或 `Alt+V`/`Ctrl+V`)翻页、鼠标滚轮按行滚动;macOS 上另支持 `⌘← →` 跨词、`⌘⌫`/`⌘⌦` 按词删除、`⌘[`/`⌘]` 翻页、`⌘;`/`⌘'` 按行滚动(取决于终端是否上报 Cmd,见下))与内联 `/` 命令菜单(↑↓ 选择、`Tab` 补全)。工具调用以 `⚙ 名称(参数)` 展示并带 **JSON 语法高亮**,正文与思考按 **Markdown 源码着色**(标题 / 粗体 / 斜体 / 行内代码 / 列表 / 引用 / 链接),**围栏代码块按语言高亮并保留围栏标记**(高亮数据来自 `highlight.js` / `lowlight`)。`Ctrl+C` 在生成中取消本轮请求、空闲时退出。
78
+ **`@` 唤起文件路径补全**:输入框里敲 `@` 就弹出项目内候选(`@chat` 一次过滤到 `src/tui/screens/chat.tsx`,`@src/tui/` 则接着按目录往下钻),`↑`/`↓` 选择、`Tab` 或 `Enter` 补进草稿、`Esc` 只关菜单(不动草稿)。补进去的是**相对路径文本**(`@src/tui/screens/chat.tsx`),消息本身仍是普通文本,模型用 `read` 工具自己去读 —— 因此补错可 `Ctrl+_` 退回,也不会把大文件塞进上下文。候选来自 `git ls-files -co --exclude-standard`(尊重 `.gitignore`、含未跟踪文件),不在 git 仓库里时回落到 `fs.glob` 并排除 `node_modules` / `.git` / `dist`;索引缓存 15 秒;菜单紧贴输入框向上生长,装不下的从顶端丢弃(贴着输入框的那条永远是你正在选的那条)。
79
+
80
+ 对话界面包含:流式输出区(思考过程 / 回答正文 / 工具调用分行展示)、多行输入(`Enter` 发送、`Ctrl+N` 换行、`← →` 移动光标、`Ctrl+← →` 跨词、`Ctrl+W` / `Alt+Backspace` 删前一个词、`Alt+D` / `Ctrl+Delete` 删后一个词、`Ctrl+K` 删到行尾、`Ctrl+U` 删到行首、`PgUp`/`PgDn`(或 `Alt+V`)翻页、鼠标滚轮按行滚动;macOS 上另支持 `⌘← →` 跨词、`⌘⌫`/`⌘⌦` 按词删除、`⌘[`/`⌘]` 翻页、`⌘;`/`⌘'` 按行滚动(取决于终端是否上报 Cmd,见下))与内联 `/` 命令菜单(↑↓ 选择、`Tab` 补全)。工具调用以 `⚙ 名称(参数)` 展示并带 **JSON 语法高亮**,正文与思考按 **Markdown 源码着色**(标题 / 粗体 / 斜体 / 行内代码 / 列表 / 引用 / 链接),**围栏代码块按语言高亮并保留围栏标记**(高亮数据来自 `highlight.js` / `lowlight`)。`Ctrl+C` 在生成中取消本轮请求、空闲时退出。
79
81
 
80
82
  ### 键盘与终端兼容(macOS 等)
81
83
 
@@ -101,6 +103,7 @@ macOS 上终端 TUI 的通行做法是 **Option 当 Meta + readline 系 Ctrl 键
101
103
  | `Esc` | 生成中:中断;否则清空草稿并回到底部 |
102
104
  | `Ctrl+A` / `Ctrl+E` | 行首 / 行尾 |
103
105
  | `Ctrl+P` / `Ctrl+N` | 历史上一条 / 下一条(也用于斜杠菜单选择) |
106
+ | `↑` / `↓` | 多行草稿里按视觉行移动光标,到首行 / 末行才翻历史;`/` 或 `@` 菜单打开时用于选择 |
104
107
  | `Ctrl+K` / `Ctrl+U` | 删到行尾 / 删到行首 |
105
108
  | `Ctrl+W` | 删到前一空白(标点不切分:`src/utils/foo.ts` 一次删完) |
106
109
  | `Alt+B` / `Alt+F` | 跨词移动 |
@@ -108,7 +111,7 @@ macOS 上终端 TUI 的通行做法是 **Option 当 Meta + readline 系 Ctrl 键
108
111
  | `Ctrl+Y` / `Alt+Y` | 取回刚删掉的文本 / 循环取回更早的 |
109
112
  | `Ctrl+_` | 撤销上一次输入编辑 |
110
113
  | `Ctrl+S` | 暂存当前草稿 / 再按恢复 |
111
- | `Ctrl+V` | 预留:粘贴图片(**暂未实现**,按下会提示) |
114
+ | `Ctrl+V` | 粘贴:剪贴板有图片就附在消息上,没有就粘贴文本(文本超过 256KB 直接拒绝,不截断) |
112
115
  | `Ctrl+L` | 清屏(保留上下文) |
113
116
  | `PgUp` / `PgDn` | 应用内翻页回看 |
114
117
  | 鼠标滚轮 | 按行滚动(每格 3 行)。开启鼠标上报后拖选复制需按住 `Shift`(终端原生选择);`tmux` 用户需 `set -g mouse off`,否则滚轮会先被 copy-mode 拦下 |
@@ -119,7 +122,7 @@ macOS 上终端 TUI 的通行做法是 **Option 当 Meta + readline 系 Ctrl 键
119
122
 
120
123
  未实现(我们的场景没有对应物):`Ctrl+O` 转录查看器、`Ctrl+R` 反向历史搜索、`Ctrl+B` 后台任务、`Ctrl+T` 任务清单、`Shift+Tab` 权限模式。
121
124
 
122
- `Ctrl+V`(Claude Code 的「粘贴图片」)**暂未实现**:按下会提示未支持。原因是它需要先解决「文件 → 内容块」的端点能力探测(Files API 上传 vs base64内联),不能简单硬编码某个端点。⌘⌫ 已被终端映射为 `Ctrl+U`,所以这里删到行首;要清空草稿用 `Esc`。
125
+ `Ctrl+V` **图片优先、文本兑底**:先问系统剪贴板要图片(macOS 用 `osascript`、Linux 用 `wl-paste` / `xclip`、Windows 用 PowerShell),有图就附在消息上(输入框上方出现「📎 已附加 N 张图片」,最多 4 张,`Esc` 清空);剪贴板里没有图片则当作普通粘贴,把文本插到光标处(文本超过 256KB **直接拒绝、不截断** —— 半截内容比不粘更坑,提示会建议存成文件用 `@` 引用)。全程不落盘 —— 图片以 base64 直接转成内容块,上传 Files API 还是内联由 SDK 按当前端点自动决定;当前模型没有 `vision: true` 时 SDK 会退化成一行路径提示并在通知栏说明。`⌘⌫` 已被终端映射为 `Ctrl+U`,所以这里删到行首;要清空草稿用 `Esc`。
123
126
 
124
127
  \* `⌘` 组合只有终端**启用 kitty 键盘协议**时才会带上 `super` 位(iTerm2 还需把 Cmd 映射为 Super);不支持的终端(如 Apple Terminal)只能在终端里把 `⌘` 映射成 `ESC` 序列(如 `⌘←` → `ESC[1;9D`,等价于 `Alt+←`),或直接用上表的 Alt 组合。
125
128
 
@@ -192,8 +195,8 @@ key input="" flags=[pageUp] raw=false
192
195
  | 命令 | 说明 |
193
196
  |------|------|
194
197
  | `/exit` `/quit` | 退出对话(提示保存) |
195
- | `/save` | 保存对话(本就每轮实时落盘) |
196
- | `/load` | 加载对话(替换当前会话) |
198
+ | `/save [名字]` | 保存对话(本就每轮实时落盘);带名字则另存为该文件名(相当于改名,重名先确认) |
199
+ | `/load` | 加载对话(替换当前会话;选择器只列会话文件名) |
197
200
  | `/new` | 重置会话(清空历史) |
198
201
  | `/back` | 撤回上一条(回退到指定位置并可编辑重发) |
199
202
  | `/editor` | 用外部编辑器(vim/nano)写长消息 |
@@ -0,0 +1,68 @@
1
+ /** 一张剪贴板图片(已是 base64,未落盘) */
2
+ export interface ClipboardImage {
3
+ base64: string;
4
+ mime: string;
5
+ }
6
+ /**
7
+ * 读取结果三态。
8
+ *
9
+ * 为什么要区分「没有」和「太大」:两者都要回退到粘贴文本,但提示不一样 ——
10
+ * 「剪贴板里没有图片」是正常情况(用户就是想贴文本),「图片太大」是真问题
11
+ * (用户以为贴上了,其实没有),不提示会让人莫名其妙。
12
+ */
13
+ export type ClipboardImageResult = {
14
+ kind: "image";
15
+ image: ClipboardImage;
16
+ } | {
17
+ kind: "too-large";
18
+ bytes: number;
19
+ } | {
20
+ kind: "none";
21
+ };
22
+ /** 单张粘贴图片上限:与 SDK 默认内联上限(8MB)同量级,留出 base64 膨胀余量 */
23
+ export declare const MAX_CLIPBOARD_IMAGE_BYTES: number;
24
+ /**
25
+ * 单次粘贴文本上限 256KB。
26
+ *
27
+ * 超了**报错而不是截断**:半截代码 / 半截 JSON 粘进对话比不粘更坑(用户会以
28
+ * 为粘全了,基于残缺内容提问)。需要大段内容时让他存成文件用 `@` 引用。
29
+ */
30
+ export declare const MAX_CLIPBOARD_TEXT_BYTES: number;
31
+ export interface ClipboardDeps {
32
+ platform?: NodeJS.Platform;
33
+ env?: NodeJS.ProcessEnv;
34
+ /** 执行命令;不可用(不存在 / 非零退出 / 超时)返回 null,成功返回 stdout 原始字节 */
35
+ run?: (cmd: string, args: string[]) => Promise<Buffer | null>;
36
+ }
37
+ /**
38
+ * 解析 osascript 的输出 `«data PNGf89504E47…»`(PNGf 后面全是十六进制)。
39
+ *
40
+ * 格式不符(或没有图片时 osascript 直接非零退出)一律返回 null:
41
+ * 这条路径上「猜」比「放弃」危险得多 —— 猜错就会把半截字节当成图片发出去。
42
+ */
43
+ export declare function parseAppleScriptPng(stdout: string): Buffer | null;
44
+ /** 读剪贴板里的图片;没有图片时返回 `{ kind: "none" }`(调用方据此回退到文本) */
45
+ export declare function readClipboardImage(deps?: ClipboardDeps): Promise<ClipboardImageResult>;
46
+ /**
47
+ * 读剪贴板文本的结果。
48
+ *
49
+ * 三态分开是因为提示文案各不相同:`unavailable` = 环境缺剪贴板工具,
50
+ * `too-large` = 真问题(用户以为粘上了其实没有),空文本 = 剪贴板确实空着。
51
+ */
52
+ export type ClipboardTextResult = {
53
+ kind: "text";
54
+ text: string;
55
+ } | {
56
+ kind: "too-large";
57
+ bytes: number;
58
+ } | {
59
+ kind: "unavailable";
60
+ };
61
+ /**
62
+ * 读剪贴板里的文本。
63
+ *
64
+ * 返回 `unavailable` = 压根没有可用的剪贴板工具(区别于「剪贴板是空的」= 空文本),
65
+ * 两者在提示上要分开:一个是环境缺依赖,一个是用户剪贴板确实空着。
66
+ */
67
+ export declare function readClipboardText(deps?: ClipboardDeps): Promise<ClipboardTextResult>;
68
+ //# sourceMappingURL=clipboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../src/clipboard.ts"],"names":[],"mappings":"AA0BA,6BAA6B;AAC7B,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAC5B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,cAAc,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAErB,mDAAmD;AACnD,eAAO,MAAM,yBAAyB,QAAmB,CAAC;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,QAAa,CAAC;AAMnD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,wDAAwD;IACxD,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC/D;AAaD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMjE;AA6FD,sDAAsD;AACtD,wBAAsB,kBAAkB,CAAC,IAAI,GAAE,aAAkB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAchG;AAED;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAC3B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC;AAE5B;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,GAAE,aAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAe9F"}
@@ -0,0 +1,177 @@
1
+ /**
2
+ * 系统剪贴板读取 —— `Ctrl+V` 粘贴图片 / 文本的唯一入口。
3
+ *
4
+ * ## 为什么必须主动去问系统
5
+ *
6
+ * 终端协议里没有「剪贴板内容」这一说:`Ctrl+V` 到进程的**只是一个按键事件**,
7
+ * 图片数据不会自己流进来(终端自身的 `Cmd+V` 也只能贴文本)。所以图片必须去问
8
+ * 系统剪贴板;问不到就退回「粘贴文本」—— 那才是用户按 `Ctrl+V` 的默认期待。
9
+ *
10
+ * ## 各平台怎么问
11
+ *
12
+ * | 平台 | 图片 | 文本 |
13
+ * |---|---|---|
14
+ * | macOS | `osascript -e "get the clipboard as «class PNGf»"`,stdout 是 `«data PNGf<HEX>»` | `pbpaste` |
15
+ * | Linux | `wl-paste --type image/png`(Wayland)→ `xclip -t image/png -o`(X11) | `wl-paste --no-newline` → `xclip -o` |
16
+ * | Windows | PowerShell `Get-Clipboard -Format Image` → PNG → base64 | `Get-Clipboard -Raw` |
17
+ *
18
+ * **一律不落盘**:macOS 那条给的是十六进制文本,Linux 给的是二进制,Windows 给的是
19
+ * base64 —— 三者都能在内存里还原成 base64,而 SDK 的 `fileToContentSection()` 正好接受
20
+ * `{ base64, mime }`,于是粘贴一张图片不需要写任何临时文件。
21
+ *
22
+ * 命令不存在 / 退出码非 0 / 输出为空,一律当作「没有」,由调用方回退到文本。
23
+ * 这条约定让「没装 `wl-paste`」「剪贴板是文本」「剪贴板是图片」三种情况不会互相阻塞。
24
+ */
25
+ import { execFile } from "node:child_process";
26
+ /** 单张粘贴图片上限:与 SDK 默认内联上限(8MB)同量级,留出 base64 膨胀余量 */
27
+ export const MAX_CLIPBOARD_IMAGE_BYTES = 20 * 1024 * 1024;
28
+ /**
29
+ * 单次粘贴文本上限 256KB。
30
+ *
31
+ * 超了**报错而不是截断**:半截代码 / 半截 JSON 粘进对话比不粘更坑(用户会以
32
+ * 为粘全了,基于残缺内容提问)。需要大段内容时让他存成文件用 `@` 引用。
33
+ */
34
+ export const MAX_CLIPBOARD_TEXT_BYTES = 256 * 1024;
35
+ /** 单次命令超时:剪贴板是本机操作,超过这个时间基本就是命令卡住了 */
36
+ const CMD_TIMEOUT_MS = 3000;
37
+ /** stdout 上限:20MB 图片在 macOS 上是 40MB 十六进制文本 */
38
+ const MAX_STDOUT_BYTES = 64 * 1024 * 1024;
39
+ function defaultRun(cmd, args) {
40
+ return new Promise((resolve) => {
41
+ execFile(cmd, args, { timeout: CMD_TIMEOUT_MS, maxBuffer: MAX_STDOUT_BYTES, encoding: "buffer" }, (error, stdout) => resolve(error ? null : stdout));
42
+ });
43
+ }
44
+ /**
45
+ * 解析 osascript 的输出 `«data PNGf89504E47…»`(PNGf 后面全是十六进制)。
46
+ *
47
+ * 格式不符(或没有图片时 osascript 直接非零退出)一律返回 null:
48
+ * 这条路径上「猜」比「放弃」危险得多 —— 猜错就会把半截字节当成图片发出去。
49
+ */
50
+ export function parseAppleScriptPng(stdout) {
51
+ const matched = /«data PNGf([0-9A-Fa-f]+)»/.exec(stdout);
52
+ if (!matched)
53
+ return null;
54
+ const hex = matched[1];
55
+ if (hex.length === 0 || hex.length % 2 !== 0)
56
+ return null;
57
+ return Buffer.from(hex, "hex");
58
+ }
59
+ /**
60
+ * 候选命令列表(按优先级)。
61
+ *
62
+ * Linux 交换顺序的依据:Wayland 下 `xclip` 通常也能碰巧工作(XWayland),但反过来
63
+ * Wayland 会话里 `wl-paste` 更可靠,且不会因为缺 X 授权而静默失败。
64
+ */
65
+ function imageCommands(platform, env) {
66
+ if (platform === "darwin") {
67
+ return [
68
+ {
69
+ cmd: "osascript",
70
+ args: ["-e", "get the clipboard as «class PNGf»"],
71
+ mime: "image/png",
72
+ parse: (stdout) => parseAppleScriptPng(stdout.toString("utf8")),
73
+ },
74
+ ];
75
+ }
76
+ if (platform === "linux") {
77
+ const wayland = Boolean(env.WAYLAND_DISPLAY) || env.XDG_SESSION_TYPE === "wayland";
78
+ const wl = [
79
+ { cmd: "wl-paste", args: ["--type", "image/png"], mime: "image/png", parse: (stdout) => stdout },
80
+ { cmd: "wl-paste", args: ["--type", "image/jpeg"], mime: "image/jpeg", parse: (stdout) => stdout },
81
+ ];
82
+ const x11 = [
83
+ {
84
+ cmd: "xclip",
85
+ args: ["-selection", "clipboard", "-t", "image/png", "-o"],
86
+ mime: "image/png",
87
+ parse: (stdout) => stdout,
88
+ },
89
+ {
90
+ cmd: "xclip",
91
+ args: ["-selection", "clipboard", "-t", "image/jpeg", "-o"],
92
+ mime: "image/jpeg",
93
+ parse: (stdout) => stdout,
94
+ },
95
+ ];
96
+ return wayland ? [...wl, ...x11] : [...x11, ...wl];
97
+ }
98
+ if (platform === "win32") {
99
+ return [
100
+ {
101
+ cmd: "powershell",
102
+ args: [
103
+ "-NoProfile",
104
+ "-NonInteractive",
105
+ "-Command",
106
+ "$img = Get-Clipboard -Format Image; " +
107
+ "if ($img) { $ms = New-Object System.IO.MemoryStream; " +
108
+ "$img.Save($ms, [System.Drawing.Imaging.ImageFormat]::Png); " +
109
+ "[Console]::Out.Write([Convert]::ToBase64String($ms.ToArray())) }",
110
+ ],
111
+ mime: "image/png",
112
+ parse: (stdout) => {
113
+ const base64 = stdout.toString("utf8").replace(/\s/g, "");
114
+ return base64 ? Buffer.from(base64, "base64") : null;
115
+ },
116
+ },
117
+ ];
118
+ }
119
+ return [];
120
+ }
121
+ function textCommands(platform, env) {
122
+ if (platform === "darwin")
123
+ return [{ cmd: "pbpaste", args: [] }];
124
+ if (platform === "linux") {
125
+ const wayland = Boolean(env.WAYLAND_DISPLAY) || env.XDG_SESSION_TYPE === "wayland";
126
+ // `--no-newline`:wl-paste 默认给文本补一个换行,粘进输入框会多出一行
127
+ const wl = [{ cmd: "wl-paste", args: ["--no-newline"] }];
128
+ const x11 = [{ cmd: "xclip", args: ["-selection", "clipboard", "-o"] }];
129
+ return wayland ? [...wl, ...x11] : [...x11, ...wl];
130
+ }
131
+ if (platform === "win32") {
132
+ return [{ cmd: "powershell", args: ["-NoProfile", "-NonInteractive", "-Command", "Get-Clipboard -Raw"] }];
133
+ }
134
+ return [];
135
+ }
136
+ /** 读剪贴板里的图片;没有图片时返回 `{ kind: "none" }`(调用方据此回退到文本) */
137
+ export async function readClipboardImage(deps = {}) {
138
+ const platform = deps.platform ?? process.platform;
139
+ const env = deps.env ?? process.env;
140
+ const run = deps.run ?? defaultRun;
141
+ for (const candidate of imageCommands(platform, env)) {
142
+ const stdout = await run(candidate.cmd, candidate.args);
143
+ if (!stdout || stdout.length === 0)
144
+ continue;
145
+ const bytes = candidate.parse(stdout);
146
+ if (!bytes || bytes.length === 0)
147
+ continue;
148
+ if (bytes.length > MAX_CLIPBOARD_IMAGE_BYTES)
149
+ return { kind: "too-large", bytes: bytes.length };
150
+ return { kind: "image", image: { base64: bytes.toString("base64"), mime: candidate.mime } };
151
+ }
152
+ return { kind: "none" };
153
+ }
154
+ /**
155
+ * 读剪贴板里的文本。
156
+ *
157
+ * 返回 `unavailable` = 压根没有可用的剪贴板工具(区别于「剪贴板是空的」= 空文本),
158
+ * 两者在提示上要分开:一个是环境缺依赖,一个是用户剪贴板确实空着。
159
+ */
160
+ export async function readClipboardText(deps = {}) {
161
+ const platform = deps.platform ?? process.platform;
162
+ const env = deps.env ?? process.env;
163
+ const run = deps.run ?? defaultRun;
164
+ for (const candidate of textCommands(platform, env)) {
165
+ const stdout = await run(candidate.cmd, candidate.args);
166
+ if (stdout == null)
167
+ continue;
168
+ // 统一换行:Windows 剪贴板给 CRLF,插进输入框会变成「多了个不可见字符」
169
+ const text = stdout.toString("utf8").replace(/\r\n?/g, "\n");
170
+ const bytes = Buffer.byteLength(text, "utf8");
171
+ if (bytes > MAX_CLIPBOARD_TEXT_BYTES)
172
+ return { kind: "too-large", bytes };
173
+ return { kind: "text", text };
174
+ }
175
+ return { kind: "unavailable" };
176
+ }
177
+ //# sourceMappingURL=clipboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../src/clipboard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAoB9C,mDAAmD;AACnD,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,GAAG,IAAI,CAAC;AACnD,sC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,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC1B,CAAC;AAaD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,IAAI,GAAkB,EAAE;IAC9D,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC;IACnD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IACpC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,UAAU,CAAC;IAEnC,KAAK,MAAM,SAAS,IAAI,YAAY,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC;QACpD,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;QACxD,IAAI,MAAM,IAAI,IAAI;YAAE,SAAS;QAC7B,4CAA4C;QAC5C,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC7D,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC9C,IAAI,KAAK,GAAG,wBAAwB;YAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;QAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAChC,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;AACjC,CAAC"}
@@ -91,6 +91,23 @@ export declare function mergeTokenThresholds(current: TokenThresholds | undefine
91
91
  * 「默认模型」——删除后由 `createAgent` 报错引导用户重选,而不是静默回退。
92
92
  */
93
93
  export declare function removeModel(config: AppConfig, modelId: string): AppConfig;
94
+ /**
95
+ * 「恢复出厂设置」—— 用出厂定义**整条**替换同 id 的模型。
96
+ *
97
+ * 不能写成 `updateModel(config, id, factory)`:那是浅合并,出厂定义里没有的字段
98
+ * (尤其 `custom: true`)会原样留下 —— 点了恢复出厂,条目仍被当成自建,
99
+ * 下次 SDK 同步依旧不动它,按钮等于失效。
100
+ */
101
+ export declare function restoreFactoryModel(config: AppConfig, factory: Model): AppConfig;
102
+ /** 同上,图片模型版 */
103
+ export declare function restoreFactoryImageModel(config: AppConfig, factory: ImageModel): AppConfig;
104
+ /**
105
+ * 默认 Agent 的「恢复出厂设置」:提示词换回出厂、`custom` 去掉,其余字段一律保留。
106
+ *
107
+ * 与 SDK `ensureDefaultAgent` 的同步语义一致(它也只同步 `messages`):整条替换会把
108
+ * 用户自己选的 `modelId` 与四维权限一起冲掉。
109
+ */
110
+ export declare function restoreFactoryAgent(def: AgentDefinition, factory: Pick<AgentDefinition, "messages">): AgentDefinition;
94
111
  /** 新增模型(id 由名称派生;默认 `custom: true`,避免被 SDK 出厂清单托管覆盖) */
95
112
  export declare function addModel(config: AppConfig, input: {
96
113
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"config-editor.d.ts","sourceRoot":"","sources":["../src/config-editor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,QAAQ,EACR,UAAU,EACV,KAAK,EACL,gBAAgB,EAChB,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAiB,MAAM,aAAa,CAAC;AAK5E,gBAAgB;AAChB,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,CAG3F;AAED,gBAAgB;AAChB,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,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