@armadra/agent 0.5.1 → 0.6.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.
Files changed (467) hide show
  1. package/CHANGELOG.md +177 -304
  2. package/CHANGELOG.zh-CN.md +442 -0
  3. package/README.md +408 -364
  4. package/README.zh-CN.md +705 -0
  5. package/dist/agent/session-plan.js +2 -2
  6. package/dist/agent/session-state.d.ts +3 -0
  7. package/dist/agent/session-state.js +20 -0
  8. package/dist/agent/session-subagent.d.ts +15 -1
  9. package/dist/agent/session-subagent.js +26 -3
  10. package/dist/agent/session-telemetry.d.ts +16 -2
  11. package/dist/agent/session-telemetry.js +29 -7
  12. package/dist/agent/session-tools.js +5 -2
  13. package/dist/agent/session-trace-writer.d.ts +27 -0
  14. package/dist/agent/session-trace-writer.js +253 -0
  15. package/dist/agent/session.d.ts +2 -0
  16. package/dist/agent/session.js +12 -0
  17. package/dist/agent/subagent-direct.d.ts +20 -0
  18. package/dist/agent/subagent-direct.js +76 -0
  19. package/dist/agent/subagent-registry.d.ts +8 -1
  20. package/dist/agent/subagent-registry.js +28 -1
  21. package/dist/agent/system-prompt.d.ts +3 -1
  22. package/dist/agent/system-prompt.js +3 -0
  23. package/dist/agent/tool-runner.d.ts +2 -1
  24. package/dist/agent/tool-runner.js +5 -4
  25. package/dist/agent/types-w6.d.ts +39 -0
  26. package/dist/agent/types-w6.js +4 -0
  27. package/dist/agent/types.d.ts +5 -2
  28. package/dist/agents/external.js +1 -1
  29. package/dist/agents/task-record.d.ts +74 -1
  30. package/dist/agents/task-record.js +100 -0
  31. package/dist/ai/apis/cache-params.js +2 -1
  32. package/dist/ai/apis/chatgpt-backend.d.ts +52 -0
  33. package/dist/ai/apis/chatgpt-backend.js +224 -0
  34. package/dist/ai/apis/chatgpt-rate-limits.d.ts +26 -0
  35. package/dist/ai/apis/chatgpt-rate-limits.js +91 -0
  36. package/dist/ai/apis/openai-responses-request.d.ts +2 -1
  37. package/dist/ai/apis/openai-responses-request.js +8 -2
  38. package/dist/ai/apis/openai-responses.d.ts +2 -0
  39. package/dist/ai/apis/openai-responses.js +51 -16
  40. package/dist/ai/overflow.d.ts +1 -1
  41. package/dist/ai/overflow.js +10 -7
  42. package/dist/ai/providers/auth.d.ts +15 -2
  43. package/dist/ai/providers/auth.js +69 -2
  44. package/dist/ai/providers/builtin.js +27 -0
  45. package/dist/ai/providers/catalog-data.js +1 -0
  46. package/dist/ai/providers/enrich.js +2 -7
  47. package/dist/ai/providers/models-dev-cache.js +15 -19
  48. package/dist/ai/providers/models-dev-snapshot.js +8 -7
  49. package/dist/ai/providers/models-dev.js +5 -15
  50. package/dist/ai/providers/suggest.js +2 -16
  51. package/dist/ai/types.d.ts +27 -1
  52. package/dist/auth/chatgpt/backend-client.d.ts +26 -0
  53. package/dist/auth/chatgpt/backend-client.js +74 -0
  54. package/dist/auth/chatgpt/claims.d.ts +17 -0
  55. package/dist/auth/chatgpt/claims.js +46 -0
  56. package/dist/auth/chatgpt/cli.d.ts +33 -0
  57. package/dist/auth/chatgpt/cli.js +252 -0
  58. package/dist/auth/chatgpt/doctor.d.ts +17 -0
  59. package/dist/auth/chatgpt/doctor.js +36 -0
  60. package/dist/auth/chatgpt/host-id.d.ts +7 -0
  61. package/dist/auth/chatgpt/host-id.js +26 -0
  62. package/dist/auth/chatgpt/login.d.ts +30 -0
  63. package/dist/auth/chatgpt/login.js +130 -0
  64. package/dist/auth/chatgpt/presets.d.ts +66 -0
  65. package/dist/auth/chatgpt/presets.js +120 -0
  66. package/dist/auth/chatgpt/quota-text.d.ts +13 -0
  67. package/dist/auth/chatgpt/quota-text.js +36 -0
  68. package/dist/auth/oauth/browser.d.ts +12 -0
  69. package/dist/auth/oauth/browser.js +27 -0
  70. package/dist/auth/oauth/callback-server.d.ts +47 -0
  71. package/dist/auth/oauth/callback-server.js +147 -0
  72. package/dist/auth/oauth/flows.d.ts +62 -0
  73. package/dist/auth/oauth/flows.js +113 -0
  74. package/dist/auth/oauth/jwt.d.ts +24 -0
  75. package/dist/auth/oauth/jwt.js +81 -0
  76. package/dist/auth/oauth/live.d.ts +21 -0
  77. package/dist/auth/oauth/live.js +25 -0
  78. package/dist/auth/oauth/oidc.d.ts +26 -0
  79. package/dist/auth/oauth/oidc.js +72 -0
  80. package/dist/auth/oauth/pkce.d.ts +15 -0
  81. package/dist/auth/oauth/pkce.js +20 -0
  82. package/dist/auth/oauth/refresh.d.ts +35 -0
  83. package/dist/auth/oauth/refresh.js +129 -0
  84. package/dist/auth/oauth/token-client.d.ts +33 -0
  85. package/dist/auth/oauth/token-client.js +121 -0
  86. package/dist/auth/oauth/token-store.d.ts +23 -0
  87. package/dist/auth/oauth/token-store.js +125 -0
  88. package/dist/auth/testing/fake-oauth.d.ts +73 -0
  89. package/dist/auth/testing/fake-oauth.js +271 -0
  90. package/dist/auth/testing/refresh-child.d.ts +5 -0
  91. package/dist/auth/testing/refresh-child.js +16 -0
  92. package/dist/bundle/ama.cjs +25928 -11144
  93. package/dist/checkpoints/backend.js +6 -5
  94. package/dist/checkpoints/restore.js +3 -2
  95. package/dist/checkpoints/settings.js +2 -1
  96. package/dist/checkpoints/shadow-git.js +7 -6
  97. package/dist/checkpoints/shadow-restore.js +3 -2
  98. package/dist/checkpoints/tracker.js +4 -3
  99. package/dist/cli/args.d.ts +9 -2
  100. package/dist/cli/args.js +74 -27
  101. package/dist/cli/bootstrap.js +53 -31
  102. package/dist/cli/choice-prompt.js +8 -6
  103. package/dist/cli/codemode-notice.js +2 -2
  104. package/dist/cli/compose-agents.js +2 -1
  105. package/dist/cli/compose-extensions.js +2 -0
  106. package/dist/cli/compose-memory.d.ts +53 -0
  107. package/dist/cli/compose-memory.js +127 -0
  108. package/dist/cli/compose-providers.d.ts +5 -0
  109. package/dist/cli/compose-providers.js +32 -2
  110. package/dist/cli/compose-session.d.ts +5 -0
  111. package/dist/cli/compose-session.js +27 -13
  112. package/dist/cli/compose-store.d.ts +2 -0
  113. package/dist/cli/compose-store.js +9 -5
  114. package/dist/cli/compose.d.ts +2 -0
  115. package/dist/cli/compose.js +13 -5
  116. package/dist/cli/default-model.d.ts +0 -2
  117. package/dist/cli/default-model.js +5 -8
  118. package/dist/cli/deps.d.ts +5 -1
  119. package/dist/cli/exit-codes.d.ts +1 -1
  120. package/dist/cli/exit-codes.js +7 -16
  121. package/dist/cli/from-prompt.js +3 -2
  122. package/dist/cli/help-text.d.ts +2 -1
  123. package/dist/cli/help-text.js +5 -99
  124. package/dist/cli/main.d.ts +5 -0
  125. package/dist/cli/main.js +21 -2
  126. package/dist/cli/proxy.js +14 -9
  127. package/dist/cli/runtime.d.ts +5 -0
  128. package/dist/cli/startup-screen.js +20 -27
  129. package/dist/cli/startup-steps.js +6 -8
  130. package/dist/cli/subcommands/auth.d.ts +6 -3
  131. package/dist/cli/subcommands/auth.js +52 -22
  132. package/dist/cli/subcommands/config-set.d.ts +21 -0
  133. package/dist/cli/subcommands/config-set.js +137 -0
  134. package/dist/cli/subcommands/config.d.ts +2 -1
  135. package/dist/cli/subcommands/config.js +51 -37
  136. package/dist/cli/subcommands/doctor.d.ts +2 -1
  137. package/dist/cli/subcommands/doctor.js +97 -58
  138. package/dist/cli/subcommands/init.d.ts +1 -1
  139. package/dist/cli/subcommands/init.js +8 -7
  140. package/dist/cli/subcommands/memory.d.ts +18 -0
  141. package/dist/cli/subcommands/memory.js +189 -0
  142. package/dist/cli/subcommands/model-meta.js +11 -9
  143. package/dist/cli/subcommands/models-cache-probe.js +23 -20
  144. package/dist/cli/subcommands/models-discover.d.ts +3 -0
  145. package/dist/cli/subcommands/models-discover.js +44 -21
  146. package/dist/cli/subcommands/models.d.ts +1 -1
  147. package/dist/cli/subcommands/models.js +29 -22
  148. package/dist/cli/subcommands/probe-runner.js +8 -7
  149. package/dist/cli/subcommands/providers-list.js +32 -21
  150. package/dist/cli/subcommands/providers-plan.js +24 -25
  151. package/dist/cli/subcommands/providers-probe.js +5 -6
  152. package/dist/cli/subcommands/providers.d.ts +1 -1
  153. package/dist/cli/subcommands/providers.js +45 -50
  154. package/dist/cli/subcommands/sessions-export.d.ts +1 -1
  155. package/dist/cli/subcommands/sessions-export.js +10 -9
  156. package/dist/cli/subcommands/sessions-search.d.ts +1 -1
  157. package/dist/cli/subcommands/sessions-search.js +11 -10
  158. package/dist/cli/subcommands/sessions-trace.d.ts +30 -0
  159. package/dist/cli/subcommands/sessions-trace.js +156 -0
  160. package/dist/cli/subcommands/sessions.d.ts +4 -3
  161. package/dist/cli/subcommands/sessions.js +40 -37
  162. package/dist/cli/subcommands/stats.d.ts +1 -1
  163. package/dist/cli/subcommands/stats.js +49 -30
  164. package/dist/cli/system-prompt-arg.js +3 -2
  165. package/dist/codemode/capability.js +3 -2
  166. package/dist/compaction/post-compact.d.ts +1 -0
  167. package/dist/compaction/post-compact.js +15 -1
  168. package/dist/compaction/prune-tier.d.ts +1 -1
  169. package/dist/compaction/prune-tier.js +3 -3
  170. package/dist/compaction/serialize.js +2 -1
  171. package/dist/config/auth-file.d.ts +12 -2
  172. package/dist/config/auth-file.js +32 -10
  173. package/dist/config/checker.js +12 -11
  174. package/dist/config/context-files.js +3 -2
  175. package/dist/config/edit.d.ts +106 -0
  176. package/dist/config/edit.js +350 -0
  177. package/dist/config/init.d.ts +4 -3
  178. package/dist/config/init.js +10 -18
  179. package/dist/config/json-schema.d.ts +2 -1
  180. package/dist/config/json-schema.js +101 -68
  181. package/dist/config/key-docs.d.ts +18 -7
  182. package/dist/config/key-docs.js +43 -128
  183. package/dist/config/load.js +7 -6
  184. package/dist/config/merge.d.ts +4 -1
  185. package/dist/config/merge.js +42 -22
  186. package/dist/config/paths.js +6 -5
  187. package/dist/config/profile.d.ts +5 -1
  188. package/dist/config/profile.js +7 -2
  189. package/dist/config/schema-w5.js +3 -2
  190. package/dist/config/schema-w6.d.ts +19 -0
  191. package/dist/config/schema-w6.js +115 -0
  192. package/dist/config/schema.js +34 -20
  193. package/dist/config/settings-registry.d.ts +78 -0
  194. package/dist/config/settings-registry.js +184 -0
  195. package/dist/config/types-w6.d.ts +109 -0
  196. package/dist/config/types-w6.js +19 -0
  197. package/dist/config/types.d.ts +11 -8
  198. package/dist/config/types.js +1 -0
  199. package/dist/drivers/acp/client.js +1 -1
  200. package/dist/drivers/acp/driver.js +13 -8
  201. package/dist/drivers/agents.js +4 -3
  202. package/dist/drivers/base.js +3 -2
  203. package/dist/drivers/host-runners.js +2 -1
  204. package/dist/drivers/native/claude-stream.js +12 -11
  205. package/dist/drivers/native/codex-app-server.js +17 -12
  206. package/dist/drivers/native/oneshot.js +8 -7
  207. package/dist/drivers/pool.js +1 -1
  208. package/dist/drivers/runner.d.ts +3 -1
  209. package/dist/drivers/runner.js +68 -20
  210. package/dist/drivers/turn.js +1 -1
  211. package/dist/hooks/config.js +3 -2
  212. package/dist/hooks/protocol.js +18 -12
  213. package/dist/host/api-impl.js +11 -10
  214. package/dist/host/loader.js +9 -8
  215. package/dist/host/types.d.ts +3 -0
  216. package/dist/i18n/catalog.d.ts +2169 -0
  217. package/dist/i18n/catalog.js +72 -0
  218. package/dist/i18n/format.d.ts +21 -0
  219. package/dist/i18n/format.js +58 -0
  220. package/dist/i18n/index.d.ts +58 -0
  221. package/dist/i18n/index.js +72 -0
  222. package/dist/i18n/messages/agents.d.ts +84 -0
  223. package/dist/i18n/messages/agents.js +85 -0
  224. package/dist/i18n/messages/approval.d.ts +99 -0
  225. package/dist/i18n/messages/approval.js +100 -0
  226. package/dist/i18n/messages/auth.d.ts +187 -0
  227. package/dist/i18n/messages/auth.js +189 -0
  228. package/dist/i18n/messages/cli-args.d.ts +46 -0
  229. package/dist/i18n/messages/cli-args.js +46 -0
  230. package/dist/i18n/messages/cli-help.d.ts +12 -0
  231. package/dist/i18n/messages/cli-help.js +244 -0
  232. package/dist/i18n/messages/cli.d.ts +336 -0
  233. package/dist/i18n/messages/cli.js +311 -0
  234. package/dist/i18n/messages/config-keys.d.ts +289 -0
  235. package/dist/i18n/messages/config-keys.js +292 -0
  236. package/dist/i18n/messages/config.d.ts +502 -0
  237. package/dist/i18n/messages/config.js +239 -0
  238. package/dist/i18n/messages/drivers.d.ts +123 -0
  239. package/dist/i18n/messages/drivers.js +124 -0
  240. package/dist/i18n/messages/errors.d.ts +83 -0
  241. package/dist/i18n/messages/errors.js +171 -0
  242. package/dist/i18n/messages/interactive-line.d.ts +61 -0
  243. package/dist/i18n/messages/interactive-line.js +69 -0
  244. package/dist/i18n/messages/interactive-startup.d.ts +103 -0
  245. package/dist/i18n/messages/interactive-startup.js +104 -0
  246. package/dist/i18n/messages/interactive-view.d.ts +140 -0
  247. package/dist/i18n/messages/interactive-view.js +141 -0
  248. package/dist/i18n/messages/interactive.d.ts +493 -0
  249. package/dist/i18n/messages/interactive.js +248 -0
  250. package/dist/i18n/messages/memory.d.ts +123 -0
  251. package/dist/i18n/messages/memory.js +128 -0
  252. package/dist/i18n/messages/panels.d.ts +190 -0
  253. package/dist/i18n/messages/panels.js +189 -0
  254. package/dist/i18n/messages/permissions.d.ts +126 -0
  255. package/dist/i18n/messages/permissions.js +151 -0
  256. package/dist/i18n/messages/plan.d.ts +123 -0
  257. package/dist/i18n/messages/plan.js +124 -0
  258. package/dist/i18n/messages/print.d.ts +86 -0
  259. package/dist/i18n/messages/print.js +91 -0
  260. package/dist/i18n/messages/report.d.ts +391 -0
  261. package/dist/i18n/messages/report.js +490 -0
  262. package/dist/i18n/messages/rewind.d.ts +198 -0
  263. package/dist/i18n/messages/rewind.js +217 -0
  264. package/dist/i18n/messages/session.d.ts +230 -0
  265. package/dist/i18n/messages/session.js +258 -0
  266. package/dist/i18n/messages/settings.d.ts +348 -0
  267. package/dist/i18n/messages/settings.js +336 -0
  268. package/dist/i18n/messages/subcommands-config.d.ts +111 -0
  269. package/dist/i18n/messages/subcommands-config.js +127 -0
  270. package/dist/i18n/messages/subcommands.d.ts +548 -0
  271. package/dist/i18n/messages/subcommands.js +474 -0
  272. package/dist/i18n/messages/trace.d.ts +243 -0
  273. package/dist/i18n/messages/trace.js +238 -0
  274. package/dist/i18n/types.d.ts +15 -0
  275. package/dist/i18n/types.js +7 -0
  276. package/dist/index.d.ts +6 -0
  277. package/dist/index.js +2 -0
  278. package/dist/memory/edit.d.ts +24 -0
  279. package/dist/memory/edit.js +63 -0
  280. package/dist/memory/frontmatter.d.ts +37 -0
  281. package/dist/memory/frontmatter.js +79 -0
  282. package/dist/memory/index.d.ts +28 -0
  283. package/dist/memory/index.js +126 -0
  284. package/dist/memory/lock.d.ts +17 -0
  285. package/dist/memory/lock.js +62 -0
  286. package/dist/memory/paths.d.ts +57 -0
  287. package/dist/memory/paths.js +175 -0
  288. package/dist/memory/report.d.ts +36 -0
  289. package/dist/memory/report.js +86 -0
  290. package/dist/memory/runtime.d.ts +42 -0
  291. package/dist/memory/runtime.js +36 -0
  292. package/dist/memory/secrets.d.ts +8 -0
  293. package/dist/memory/secrets.js +27 -0
  294. package/dist/memory/section.d.ts +28 -0
  295. package/dist/memory/section.js +59 -0
  296. package/dist/memory/store.d.ts +70 -0
  297. package/dist/memory/store.js +284 -0
  298. package/dist/memory/tool.d.ts +31 -0
  299. package/dist/memory/tool.js +94 -0
  300. package/dist/modes/acp/acp-events.js +2 -1
  301. package/dist/modes/acp/acp-server.js +13 -12
  302. package/dist/modes/commands-core.d.ts +11 -0
  303. package/dist/modes/commands-core.js +93 -62
  304. package/dist/modes/image-input.js +20 -6
  305. package/dist/modes/interactive/agent-bar.d.ts +95 -0
  306. package/dist/modes/interactive/agent-bar.js +248 -0
  307. package/dist/modes/interactive/agent-panels.js +27 -26
  308. package/dist/modes/interactive/agent-transcript.d.ts +47 -0
  309. package/dist/modes/interactive/agent-transcript.js +191 -0
  310. package/dist/modes/interactive/agent-ui.d.ts +36 -1
  311. package/dist/modes/interactive/agent-ui.js +180 -14
  312. package/dist/modes/interactive/agent-view.d.ts +72 -0
  313. package/dist/modes/interactive/agent-view.js +281 -0
  314. package/dist/modes/interactive/approval-dialog.js +46 -34
  315. package/dist/modes/interactive/clipboard-paste.d.ts +2 -2
  316. package/dist/modes/interactive/clipboard-paste.js +9 -4
  317. package/dist/modes/interactive/commands.d.ts +19 -1
  318. package/dist/modes/interactive/commands.js +84 -40
  319. package/dist/modes/interactive/completion.js +2 -1
  320. package/dist/modes/interactive/config-panel.d.ts +70 -0
  321. package/dist/modes/interactive/config-panel.js +319 -0
  322. package/dist/modes/interactive/config-ui.d.ts +96 -0
  323. package/dist/modes/interactive/config-ui.js +397 -0
  324. package/dist/modes/interactive/confirm-dialog.js +6 -7
  325. package/dist/modes/interactive/event-notices.js +11 -9
  326. package/dist/modes/interactive/interactive-mode.d.ts +1 -1
  327. package/dist/modes/interactive/interactive-mode.js +19 -22
  328. package/dist/modes/interactive/key-dispatch.d.ts +12 -0
  329. package/dist/modes/interactive/key-dispatch.js +24 -9
  330. package/dist/modes/interactive/line/line-editor.js +2 -1
  331. package/dist/modes/interactive/line/line-mode.js +18 -7
  332. package/dist/modes/interactive/line/line-render.js +25 -24
  333. package/dist/modes/interactive/memory-panel.d.ts +64 -0
  334. package/dist/modes/interactive/memory-panel.js +221 -0
  335. package/dist/modes/interactive/message-view.d.ts +4 -2
  336. package/dist/modes/interactive/message-view.js +42 -33
  337. package/dist/modes/interactive/panels.js +39 -31
  338. package/dist/modes/interactive/pickers.d.ts +2 -1
  339. package/dist/modes/interactive/pickers.js +10 -6
  340. package/dist/modes/interactive/plan-command.d.ts +1 -1
  341. package/dist/modes/interactive/plan-command.js +24 -27
  342. package/dist/modes/interactive/plan-dialog.js +18 -17
  343. package/dist/modes/interactive/plan-flow.js +6 -5
  344. package/dist/modes/interactive/rewind-command.d.ts +1 -1
  345. package/dist/modes/interactive/rewind-command.js +18 -16
  346. package/dist/modes/interactive/rewind-flow.d.ts +0 -1
  347. package/dist/modes/interactive/rewind-flow.js +13 -14
  348. package/dist/modes/interactive/rewind-list.js +7 -6
  349. package/dist/modes/interactive/rewind-panel.js +40 -40
  350. package/dist/modes/interactive/rewind-text.d.ts +5 -3
  351. package/dist/modes/interactive/rewind-text.js +48 -38
  352. package/dist/modes/interactive/run-indicator.js +15 -12
  353. package/dist/modes/interactive/session-events.js +3 -2
  354. package/dist/modes/interactive/startup-header.js +22 -23
  355. package/dist/modes/interactive/startup-ui.js +38 -30
  356. package/dist/modes/interactive/status-area.d.ts +2 -0
  357. package/dist/modes/interactive/status-area.js +8 -2
  358. package/dist/modes/interactive/status-bar.js +4 -3
  359. package/dist/modes/interactive/subagent-view.js +9 -7
  360. package/dist/modes/interactive/tasks-report.d.ts +6 -0
  361. package/dist/modes/interactive/tasks-report.js +28 -31
  362. package/dist/modes/interactive/terminal-setup.d.ts +9 -0
  363. package/dist/modes/interactive/terminal-setup.js +23 -0
  364. package/dist/modes/interactive/tool-summary.js +19 -17
  365. package/dist/modes/interactive/tool-view.js +7 -4
  366. package/dist/modes/interactive/trace-view.d.ts +89 -0
  367. package/dist/modes/interactive/trace-view.js +332 -0
  368. package/dist/modes/print/print-mode.js +14 -15
  369. package/dist/modes/rpc/commands.js +7 -3
  370. package/dist/modes/rpc/rpc-mode.js +9 -3
  371. package/dist/modes/session-report.d.ts +2 -0
  372. package/dist/modes/session-report.js +101 -105
  373. package/dist/modes/startup-ui-text.js +11 -6
  374. package/dist/permissions/bypass.d.ts +8 -10
  375. package/dist/permissions/bypass.js +19 -10
  376. package/dist/permissions/memory-class.d.ts +23 -0
  377. package/dist/permissions/memory-class.js +54 -0
  378. package/dist/permissions/modes.d.ts +3 -3
  379. package/dist/permissions/modes.js +21 -16
  380. package/dist/permissions/pipeline.d.ts +1 -1
  381. package/dist/permissions/pipeline.js +9 -2
  382. package/dist/permissions/preview.js +49 -42
  383. package/dist/permissions/rules.js +5 -2
  384. package/dist/permissions/types.d.ts +4 -0
  385. package/dist/plan/store.js +2 -1
  386. package/dist/rpc.d.ts +39 -1
  387. package/dist/rpc.js +3 -0
  388. package/dist/sandbox/bash.js +11 -8
  389. package/dist/sandbox/detect.js +14 -11
  390. package/dist/sdk.d.ts +17 -1
  391. package/dist/sdk.js +29 -7
  392. package/dist/session/export.js +31 -30
  393. package/dist/session/manager.d.ts +1 -1
  394. package/dist/session/manager.js +5 -3
  395. package/dist/session/reuse.js +5 -4
  396. package/dist/session/scan.js +3 -2
  397. package/dist/session/stats-aggregate.d.ts +3 -1
  398. package/dist/session/stats-aggregate.js +5 -1
  399. package/dist/session/stats-index.js +2 -1
  400. package/dist/session/stats-scan.d.ts +4 -1
  401. package/dist/session/stats-scan.js +6 -2
  402. package/dist/session/store.d.ts +11 -0
  403. package/dist/session/store.js +48 -1
  404. package/dist/session/types.d.ts +2 -0
  405. package/dist/skills/builtin.js +2 -1
  406. package/dist/tools/image-file.d.ts +26 -1
  407. package/dist/tools/image-file.js +55 -13
  408. package/dist/tools/presets.d.ts +14 -1
  409. package/dist/tools/presets.js +3 -3
  410. package/dist/tools/registry.js +1 -1
  411. package/dist/tools/truncate.d.ts +1 -1
  412. package/dist/tools/truncate.js +2 -2
  413. package/dist/tools/types.d.ts +17 -1
  414. package/dist/trace/build-index.d.ts +91 -0
  415. package/dist/trace/build-index.js +127 -0
  416. package/dist/trace/build-nodes.d.ts +24 -0
  417. package/dist/trace/build-nodes.js +279 -0
  418. package/dist/trace/build-util.d.ts +43 -0
  419. package/dist/trace/build-util.js +120 -0
  420. package/dist/trace/build.d.ts +82 -0
  421. package/dist/trace/build.js +382 -0
  422. package/dist/trace/detail.d.ts +35 -0
  423. package/dist/trace/detail.js +205 -0
  424. package/dist/trace/flatten.d.ts +69 -0
  425. package/dist/trace/flatten.js +173 -0
  426. package/dist/trace/format.d.ts +47 -0
  427. package/dist/trace/format.js +329 -0
  428. package/dist/trace/html-template.d.ts +19 -0
  429. package/dist/trace/html-template.js +150 -0
  430. package/dist/trace/html.d.ts +104 -0
  431. package/dist/trace/html.js +292 -0
  432. package/dist/trace/preview.d.ts +29 -0
  433. package/dist/trace/preview.js +59 -0
  434. package/dist/trace/query-session.d.ts +14 -0
  435. package/dist/trace/query-session.js +38 -0
  436. package/dist/trace/query.d.ts +55 -0
  437. package/dist/trace/query.js +188 -0
  438. package/dist/trace/session.d.ts +40 -0
  439. package/dist/trace/session.js +168 -0
  440. package/dist/trace/types.d.ts +243 -0
  441. package/dist/trace/types.js +13 -0
  442. package/dist/tui/components/editor-paste.d.ts +2 -0
  443. package/dist/tui/components/editor-paste.js +6 -3
  444. package/dist/tui/components/editor.js +2 -2
  445. package/dist/tui/components/loader.d.ts +3 -0
  446. package/dist/tui/components/loader.js +14 -0
  447. package/dist/tui/components/settings-list.d.ts +61 -0
  448. package/dist/tui/components/settings-list.js +135 -0
  449. package/dist/tui/keybindings.d.ts +5 -0
  450. package/dist/tui/keybindings.js +17 -5
  451. package/dist/tui.d.ts +1 -0
  452. package/dist/tui.js +2 -0
  453. package/docs/en/host-api.md +167 -0
  454. package/docs/en/permissions.md +214 -0
  455. package/docs/en/providers.md +625 -0
  456. package/docs/en/rpc.md +361 -0
  457. package/docs/en/sessions.md +219 -0
  458. package/docs/en/tui.md +527 -0
  459. package/docs/host-api.md +18 -17
  460. package/docs/memory.md +172 -0
  461. package/docs/permissions.md +2 -2
  462. package/docs/providers.md +67 -1
  463. package/docs/rpc.md +31 -3
  464. package/docs/session-format.md +8 -2
  465. package/docs/sessions.md +29 -1
  466. package/docs/tui.md +132 -3
  467. package/package.json +8 -3
@@ -0,0 +1,171 @@
1
+ /**
2
+ * 消息目录:errors(键名规范见 docs/i18n.md)。[W6-C0 建空壳,归 W6-I3]
3
+ *
4
+ * en 是形状源;zh 用 `satisfies Messages<typeof en>`,缺键 / 多键 / 参数不符在 tsc 期报错。
5
+ * 整句一个键、禁止片段拼接;插值写成函数,条件分支写进函数体。
6
+ */
7
+ import { plural } from "../format.js";
8
+ const EN_HINT = {
9
+ resize_off: " (images.resize is off)",
10
+ no_tool: " (no resize tool found: install ImageMagick, or sips on macOS)",
11
+ still_too_large: " (resizing did not bring it under the limit)",
12
+ };
13
+ const ZH_HINT = {
14
+ resize_off: "(images.resize 为 off)",
15
+ no_tool: "(没找到缩放工具:装 ImageMagick,macOS 自带 sips)",
16
+ still_too_large: "(缩放后仍超限)",
17
+ };
18
+ export const en = {
19
+ /** [W6-I3] 图片附件:当前模型不收图片(`--image` / `@路径`)。 */
20
+ imageUnsupported: (model) => `${model ?? "The current model"} does not accept image input (the model's input has no image); switch to a model that supports images ` +
21
+ `(marked "image" in ama models list, or give the model "input": ["text", "image"] in the config)`,
22
+ /** [W6-I3] SDK(`createRuntime` / `createAgentSession`)。 */
23
+ /** [W6-I5] 端点拒收缓存参数后自动去掉重发(`ai/apis/cache-params.ts`)。 */
24
+ cacheParamsStripped: (key, field, suggestion) => `${key}: the endpoint does not support ${field}; resent without cache parameters automatically; ` +
25
+ `you can set ${suggestion ?? "the matching compat switch"} in the config`,
26
+ sdk: {
27
+ noSubcommand: "createRuntime does not accept subcommands",
28
+ modelNotFound: (ref) => `model not found: ${ref}`,
29
+ noModel: "no model available: pass model, or configure a key for any provider",
30
+ noPlan: "this session has no plan extension",
31
+ },
32
+ /** [W6-I3] 模型查找、models.dev 元数据(`src/ai/providers/**`)。 */
33
+ models: {
34
+ lookupFailure: (ref, reason, list, hasCandidates) => {
35
+ switch (reason) {
36
+ case "channel_not_found":
37
+ return hasCandidates
38
+ ? `channel not found: ${ref}; channels for this model: ${list}`
39
+ : `channel not found: ${ref}; this model has no channels to choose (drop the @ suffix)`;
40
+ case "provider_not_found":
41
+ return hasCandidates
42
+ ? `provider not found: ${ref}; closest providers: ${list}`
43
+ : `provider not found: ${ref} (ama providers list shows configured providers)`;
44
+ case "ambiguous":
45
+ return `ambiguous model name: ${ref}; candidates: ${list}`;
46
+ default:
47
+ return hasCandidates
48
+ ? `model not found: ${ref}; closest models: ${list}`
49
+ : `model not found: ${ref} (ama models list shows available models)`;
50
+ }
51
+ },
52
+ source: (source) => source === "catalog" ? "catalog" : source === "default" ? "default" : source,
53
+ unmatched: "unmatched",
54
+ match: (kind, ref, normalized) => {
55
+ const label = {
56
+ explicit: "explicit",
57
+ prefix: "prefix",
58
+ canonical: "vendor",
59
+ vendor: "vendor",
60
+ consensus: "majority",
61
+ single: "unique",
62
+ };
63
+ return `${label[kind]} ${ref}${normalized !== undefined ? `, via ${normalized}` : ""}`;
64
+ },
65
+ consensus: (key, entries, groups, best, signature) => `${key}: models.dev has ${plural(entries, "entry", "entries")} with ${groups} different values; took the majority (${best}: ${signature})`,
66
+ notObject: "models.dev data is not an object",
67
+ snapshotMissing: (id) => `the models.dev snapshot has no ${id}`,
68
+ apiNotObject: "api.json top level is not an object",
69
+ apiMissingProvider: (id) => `api.json has no provider ${id}`,
70
+ noModelsAfterFilter: (id) => `${id} has no models after filtering`,
71
+ none: "none",
72
+ describe: (via, providers, models) => `models.dev: ${via} (${plural(providers, "provider")}, ${plural(models, "model")})`,
73
+ viaSnapshot: (at) => `snapshot ${at}`,
74
+ viaRefresh: (snapshot, refreshed) => `snapshot ${snapshot} ⊕ refresh ${refreshed}`,
75
+ refreshFailed: (reason) => `models.dev refresh failed (${reason}); keeping the current data`,
76
+ notListed: (unknown, choices) => `not in the snapshot list: ${unknown}; choose from ${choices}`,
77
+ refreshStatus: (status, providers, models, at) => `models.dev: ${status === "updated" ? "refreshed" : status === "unchanged" ? "refreshed, no changes" : "refresh failed"} (${plural(providers, "provider")}, ${plural(models, "model")}${at ? `, ${at}` : ""})`,
78
+ section: (kind, count) => `${kind === "added" ? "Added" : kind === "removed" ? "Removed upstream (snapshot entries kept)" : "Changed"} (${count}):`,
79
+ more: (count) => ` …${count} more`,
80
+ changed: (ref, parts) => `${ref}: ${parts.join("; ")}`,
81
+ },
82
+ /** [W6-C0] 读图失败(`tools/image-file.ts` 的 `AmaError.detail`),`--image` 与 `@路径` 显示。 */
83
+ imageFile: (d) => {
84
+ switch (d.reason) {
85
+ case "missing":
86
+ return `Image not found: ${d.path}`;
87
+ case "not_file":
88
+ return `Not a file: ${d.path}`;
89
+ case "unsupported":
90
+ return `Unsupported image (PNG / JPEG / GIF / WebP): ${d.path}`;
91
+ case "too_large":
92
+ return `Image exceeds the ${d.limitMb} limit (counted after base64): ${d.path} (${d.sizeMb})${d.hint === undefined ? "" : EN_HINT[d.hint]}`;
93
+ case "too_wide":
94
+ return `Image edge exceeds ${d.maxEdge} px: ${d.path}${d.size === undefined ? "" : ` (${d.size.width}×${d.size.height})`}${d.hint === undefined ? "" : EN_HINT[d.hint]}`;
95
+ }
96
+ },
97
+ };
98
+ export const zh = {
99
+ imageUnsupported: (model) => `${model ?? "当前模型"} 不接受图片输入(模型 input 没有 image);换一个支持图像的模型再试` +
100
+ `(ama models list 里标「图片」的,或在配置里给该模型写 "input": ["text", "image"])`,
101
+ cacheParamsStripped: (key, field, suggestion) => `${key}:该端点不支持 ${field},已自动去掉缓存参数重发;可在 config 里设 ${suggestion ?? "相应的 compat 开关"}`,
102
+ sdk: {
103
+ noSubcommand: "createRuntime 不接受子命令",
104
+ modelNotFound: (ref) => `模型不存在:${ref}`,
105
+ noModel: "没有可用模型:传 model,或配置任一供应商的 key",
106
+ noPlan: "该会话没有装配 plan 扩展",
107
+ },
108
+ models: {
109
+ lookupFailure: (ref, reason, list, hasCandidates) => {
110
+ switch (reason) {
111
+ case "channel_not_found":
112
+ return hasCandidates
113
+ ? `渠道不存在:${ref};该模型可用渠道:${list}`
114
+ : `渠道不存在:${ref};该模型没有可选渠道(去掉 @ 后缀)`;
115
+ case "provider_not_found":
116
+ return hasCandidates
117
+ ? `供应商不存在:${ref};最接近的供应商:${list}`
118
+ : `供应商不存在:${ref}(ama providers list 查看已配置的供应商)`;
119
+ case "ambiguous":
120
+ return `模型名有歧义:${ref};候选:${list}`;
121
+ default:
122
+ return hasCandidates
123
+ ? `模型不存在:${ref};最接近的模型:${list}`
124
+ : `模型不存在:${ref}(ama models list 查看可用模型)`;
125
+ }
126
+ },
127
+ source: (source) => (source === "catalog" ? "目录" : source === "default" ? "缺省" : source),
128
+ unmatched: "未匹配",
129
+ match: (kind, ref, normalized) => {
130
+ const label = {
131
+ explicit: "显式",
132
+ prefix: "前缀",
133
+ canonical: "原厂",
134
+ vendor: "原厂",
135
+ consensus: "多数",
136
+ single: "唯一",
137
+ };
138
+ return `${label[kind]} ${ref}${normalized !== undefined ? `,按 ${normalized}` : ""}`;
139
+ },
140
+ consensus: (key, entries, groups, best, signature) => `${key}:models.dev 有 ${entries} 个条目、${groups} 种取值,取多数(${best} 条:${signature})`,
141
+ notObject: "models.dev 数据不是对象",
142
+ snapshotMissing: (id) => `models.dev 快照缺少 ${id}`,
143
+ apiNotObject: "api.json 顶层不是对象",
144
+ apiMissingProvider: (id) => `api.json 缺少供应商 ${id}`,
145
+ noModelsAfterFilter: (id) => `${id} 过滤后没有模型`,
146
+ none: "无",
147
+ describe: (via, providers, models) => `models.dev:${via}(${providers} 家供应商、${models} 个模型)`,
148
+ viaSnapshot: (at) => `快照 ${at}`,
149
+ viaRefresh: (snapshot, refreshed) => `快照 ${snapshot} ⊕ 刷新 ${refreshed}`,
150
+ refreshFailed: (reason) => `models.dev 刷新失败(${reason}),沿用现有数据`,
151
+ notListed: (unknown, choices) => `不在收录清单里:${unknown};可选 ${choices}`,
152
+ refreshStatus: (status, providers, models, at) => `models.dev:${status === "updated" ? "已刷新" : status === "unchanged" ? "已刷新,无变化" : "刷新失败"}(${providers} 家供应商、${models} 个模型${at ? `,${at}` : ""})`,
153
+ section: (kind, count) => `${kind === "added" ? "新增" : kind === "removed" ? "上游删除(快照里的条目保留)" : "变化"}(${count}):`,
154
+ more: (count) => ` …另 ${count} 条`,
155
+ changed: (ref, parts) => `${ref}:${parts.join(";")}`,
156
+ },
157
+ imageFile: (d) => {
158
+ switch (d.reason) {
159
+ case "missing":
160
+ return `图片不存在:${d.path}`;
161
+ case "not_file":
162
+ return `不是文件:${d.path}`;
163
+ case "unsupported":
164
+ return `不是支持的图片(PNG / JPEG / GIF / WebP):${d.path}`;
165
+ case "too_large":
166
+ return `图片超过 ${d.limitMb} 上限(按 base64 后计算):${d.path}(${d.sizeMb})${d.hint === undefined ? "" : ZH_HINT[d.hint]}`;
167
+ case "too_wide":
168
+ return `图片任一边超过 ${d.maxEdge} px:${d.path}${d.size === undefined ? "" : `(${d.size.width}×${d.size.height})`}${d.hint === undefined ? "" : ZH_HINT[d.hint]}`;
169
+ }
170
+ },
171
+ };
@@ -0,0 +1,61 @@
1
+ /**
2
+ * 消息目录:interactive 的行式界面部分(键名规范见 docs/i18n.md)。[W6-I2]
3
+ *
4
+ * 单文件 600 行上限,`interactive.ts` 拆出:`modes/interactive/line/**`(行式审批问句、事件行、选择列表、
5
+ * 启动行与中断提示)。经 `msg().interactive.line` 取用。en 是形状源;zh 用 `satisfies Messages<typeof en>`。
6
+ */
7
+ /** 行式审批问句里括号说明的来由。 */
8
+ export type LineApprovalWhy = {
9
+ kind: "dangerous";
10
+ } | {
11
+ kind: "hook";
12
+ reason: string;
13
+ } | {
14
+ kind: "auto";
15
+ layer: string;
16
+ reason: string;
17
+ };
18
+ export declare const en: {
19
+ approvalOrigin: (task: string, title: string, where: string | undefined) => string;
20
+ approvalFirstRun: (task: string, note: string) => string;
21
+ approvalTool: (task: string, tool: string, summary: string, why: LineApprovalWhy | undefined) => string;
22
+ retry: (attempt: number, max: number, seconds: number, error: string) => string;
23
+ compacting: string;
24
+ error: (error: string) => string;
25
+ planProposed: (version: number, file: string | undefined) => string;
26
+ subagentStart: (taskId: string, agent: string, background: boolean) => string;
27
+ modelsHeading: string;
28
+ noSessions: string;
29
+ sessionsHeading: string;
30
+ noForkable: string;
31
+ forkHeading: string;
32
+ modeHeading: string;
33
+ thinking: (levels: string, current: string) => string;
34
+ banner: (version: string, model: string) => string;
35
+ interrupted: string;
36
+ ctrlCAgain: string;
37
+ steer: (text: string) => string;
38
+ pasteMarker: (id: number, lines: number) => string;
39
+ };
40
+ export declare const zh: {
41
+ approvalOrigin: (task: string, title: string, where: string | undefined) => string;
42
+ approvalFirstRun: (task: string, note: string) => string;
43
+ approvalTool: (task: string, tool: string, summary: string, why: LineApprovalWhy | undefined) => string;
44
+ retry: (attempt: number, max: number, seconds: number, error: string) => string;
45
+ compacting: string;
46
+ error: (error: string) => string;
47
+ planProposed: (version: number, file: string | undefined) => string;
48
+ subagentStart: (taskId: string, agent: string, background: boolean) => string;
49
+ modelsHeading: string;
50
+ noSessions: string;
51
+ sessionsHeading: string;
52
+ noForkable: string;
53
+ forkHeading: string;
54
+ modeHeading: string;
55
+ thinking: (levels: string, current: string) => string;
56
+ banner: (version: string, model: string) => string;
57
+ interrupted: string;
58
+ ctrlCAgain: string;
59
+ steer: (text: string) => string;
60
+ pasteMarker: (id: number, lines: number) => string;
61
+ };
@@ -0,0 +1,69 @@
1
+ /**
2
+ * 消息目录:interactive 的行式界面部分(键名规范见 docs/i18n.md)。[W6-I2]
3
+ *
4
+ * 单文件 600 行上限,`interactive.ts` 拆出:`modes/interactive/line/**`(行式审批问句、事件行、选择列表、
5
+ * 启动行与中断提示)。经 `msg().interactive.line` 取用。en 是形状源;zh 用 `satisfies Messages<typeof en>`。
6
+ */
7
+ import { plural } from "../format.js";
8
+ function enWhy(why) {
9
+ if (why === undefined)
10
+ return "";
11
+ if (why.kind === "dangerous")
12
+ return " (dangerous command)";
13
+ if (why.kind === "hook")
14
+ return ` (${why.reason})`;
15
+ return ` (Auto ${why.layer}: ${why.reason})`;
16
+ }
17
+ function zhWhy(why) {
18
+ if (why === undefined)
19
+ return "";
20
+ if (why.kind === "dangerous")
21
+ return "(危险命令)";
22
+ if (why.kind === "hook")
23
+ return `(${why.reason})`;
24
+ return `(Auto ${why.layer}:${why.reason})`;
25
+ }
26
+ export const en = {
27
+ approvalOrigin: (task, title, where) => `${task}Allow ${title}${where !== undefined ? ` ${where}` : ""}? [y allow / a allow all this session / N deny] `,
28
+ approvalFirstRun: (task, note) => `${task}${note} Allow? [y allow / N deny] `,
29
+ approvalTool: (task, tool, summary, why) => `${task}Allow ${tool}${summary !== "" ? ` ${summary}` : ""}${enWhy(why)}? [y allow / a allow all this session / N deny] `,
30
+ retry: (attempt, max, seconds, error) => `↻ Retry ${attempt}/${max} (${seconds}s): ${error}`,
31
+ compacting: "… Compacting context",
32
+ error: (error) => `ama: error: ${error}`,
33
+ planProposed: (version, file) => `◇ Plan v${version} awaits approval${file !== undefined ? ` (${file})` : ""}: /plan approve [mode|fresh] to approve · /plan reject to reject · type to give feedback`,
34
+ subagentStart: (taskId, agent, background) => ` ↳ ${taskId} ${agent}${background ? " (background)" : ""} started`,
35
+ modelsHeading: "Available models (/model <provider/id>):",
36
+ noSessions: "No sessions in this directory",
37
+ sessionsHeading: "Recent sessions (/resume <id>):",
38
+ noForkable: "No messages to fork from yet",
39
+ forkHeading: "Fork points (/fork <entry id>):",
40
+ modeHeading: "Mode (/permission <mode>):",
41
+ thinking: (levels, current) => `Thinking level (/thinking <level>): ${levels}; current ${current}`,
42
+ banner: (version, model) => `ama ${version} · ${model} · /help for commands, Ctrl+D to quit`,
43
+ interrupted: "^C interrupted",
44
+ ctrlCAgain: "(press Ctrl+C again to quit)",
45
+ steer: (text) => `↳ steer: ${text}`,
46
+ pasteMarker: (id, lines) => `[paste #${id} +${plural(lines, "line")}]`,
47
+ };
48
+ export const zh = {
49
+ approvalOrigin: (task, title, where) => `${task}允许 ${title}${where !== undefined ? ` ${where}` : ""}?[y 允许 / a 本会话都允许 / N 拒绝] `,
50
+ approvalFirstRun: (task, note) => `${task}${note} 允许?[y 允许 / N 拒绝] `,
51
+ approvalTool: (task, tool, summary, why) => `${task}允许 ${tool}${summary !== "" ? ` ${summary}` : ""}${zhWhy(why)}?[y 允许 / a 本会话都允许 / N 拒绝] `,
52
+ retry: (attempt, max, seconds, error) => `↻ 重试 ${attempt}/${max}(${seconds}s):${error}`,
53
+ compacting: "… 压缩上下文",
54
+ error: (error) => `ama: 错误:${error}`,
55
+ planProposed: (version, file) => `◇ 计划 v${version} 待审批${file !== undefined ? `(${file})` : ""}:/plan approve [模式|fresh] 批准 · /plan reject 放弃 · 直接输入修改意见`,
56
+ subagentStart: (taskId, agent, background) => ` ↳ ${taskId} ${agent}${background ? "(后台)" : ""} 开始`,
57
+ modelsHeading: "可用模型(/model <provider/id>):",
58
+ noSessions: "本目录没有会话",
59
+ sessionsHeading: "最近的会话(/resume <id>):",
60
+ noForkable: "还没有可分叉的消息",
61
+ forkHeading: "可分叉的位置(/fork <条目 id>):",
62
+ modeHeading: "Mode(/permission <模式>):",
63
+ thinking: (levels, current) => `思考级别(/thinking <级别>):${levels};当前 ${current}`,
64
+ banner: (version, model) => `ama ${version} · ${model} · /help 查看命令,Ctrl+D 退出`,
65
+ interrupted: "^C 已中断",
66
+ ctrlCAgain: "(再按一次 Ctrl+C 退出)",
67
+ steer: (text) => `↳ steer:${text}`,
68
+ pasteMarker: (id, lines) => `[粘贴 #${id} +${lines} 行]`,
69
+ };
@@ -0,0 +1,103 @@
1
+ /**
2
+ * 消息目录:interactive 的启动部分(键名规范见 docs/i18n.md)。[W6-I2]
3
+ *
4
+ * 单文件 600 行上限,`interactive.ts` 拆出:启动头(`startup-header.ts`)与启动期交互(`startup-ui.ts`:
5
+ * 信任、恢复会话、选模型、工作目录)。经 `msg().interactive.startup` 取用。
6
+ * en 是形状源;zh 用 `satisfies Messages<typeof en>`。
7
+ */
8
+ export declare const en: {
9
+ header: {
10
+ trusted: string;
11
+ untrusted: string;
12
+ trustSource: (source: string) => string;
13
+ templates: (n: number) => string;
14
+ host: (host: string) => string;
15
+ warnings: (n: number) => string;
16
+ hintCompact: string;
17
+ keyModel: string;
18
+ keyDir: string;
19
+ keyMode: string;
20
+ keyLoaded: string;
21
+ keyHost: string;
22
+ keyWarnings: string;
23
+ thinking: (level: string) => string;
24
+ preset: (preset: string) => string;
25
+ warningsValue: (n: number) => string;
26
+ hint: string;
27
+ };
28
+ ui: {
29
+ cancelled: string;
30
+ hintFilter: (arrows: string) => string;
31
+ hintNumbers: (arrows: string, n: number) => string;
32
+ hint: (arrows: string) => string;
33
+ local: string;
34
+ noKey: string;
35
+ justNow: string;
36
+ minutesAgo: (n: number) => string;
37
+ hoursAgo: (n: number) => string;
38
+ daysAgo: (n: number) => string;
39
+ messages: (n: number) => string;
40
+ trustRemember: string;
41
+ trustOnce: string;
42
+ trustSkip: string;
43
+ trustNever: string;
44
+ moreResources: (n: number) => string;
45
+ trustTitle: string;
46
+ resumeTitle: string;
47
+ modelTitle: string;
48
+ cwdTitle: string;
49
+ cwdPrompt: string;
50
+ cwdPlaceholder: string;
51
+ cwdEmpty: string;
52
+ cwdMissing: (path: string) => string;
53
+ cwdNotDir: (path: string) => string;
54
+ };
55
+ };
56
+ export declare const zh: {
57
+ header: {
58
+ trusted: string;
59
+ untrusted: string;
60
+ trustSource: (source: string) => string;
61
+ templates: (n: number) => string;
62
+ host: (host: string) => string;
63
+ warnings: (n: number) => string;
64
+ hintCompact: string;
65
+ keyModel: string;
66
+ keyDir: string;
67
+ keyMode: string;
68
+ keyLoaded: string;
69
+ keyHost: string;
70
+ keyWarnings: string;
71
+ thinking: (level: string) => string;
72
+ preset: (preset: string) => string;
73
+ warningsValue: (n: number) => string;
74
+ hint: string;
75
+ };
76
+ ui: {
77
+ cancelled: string;
78
+ hintFilter: (arrows: string) => string;
79
+ hintNumbers: (arrows: string, n: number) => string;
80
+ hint: (arrows: string) => string;
81
+ local: string;
82
+ noKey: string;
83
+ justNow: string;
84
+ minutesAgo: (n: number) => string;
85
+ hoursAgo: (n: number) => string;
86
+ daysAgo: (n: number) => string;
87
+ messages: (n: number) => string;
88
+ trustRemember: string;
89
+ trustOnce: string;
90
+ trustSkip: string;
91
+ trustNever: string;
92
+ moreResources: (n: number) => string;
93
+ trustTitle: string;
94
+ resumeTitle: string;
95
+ modelTitle: string;
96
+ cwdTitle: string;
97
+ cwdPrompt: string;
98
+ cwdPlaceholder: string;
99
+ cwdEmpty: string;
100
+ cwdMissing: (path: string) => string;
101
+ cwdNotDir: (path: string) => string;
102
+ };
103
+ };
@@ -0,0 +1,104 @@
1
+ /**
2
+ * 消息目录:interactive 的启动部分(键名规范见 docs/i18n.md)。[W6-I2]
3
+ *
4
+ * 单文件 600 行上限,`interactive.ts` 拆出:启动头(`startup-header.ts`)与启动期交互(`startup-ui.ts`:
5
+ * 信任、恢复会话、选模型、工作目录)。经 `msg().interactive.startup` 取用。
6
+ * en 是形状源;zh 用 `satisfies Messages<typeof en>`。
7
+ */
8
+ import { plural } from "../format.js";
9
+ export const en = {
10
+ header: {
11
+ trusted: "trusted",
12
+ untrusted: "untrusted",
13
+ trustSource: (source) => ` (${source})`,
14
+ templates: (n) => plural(n, "template"),
15
+ host: (host) => `host ${host}`,
16
+ warnings: (n) => `${plural(n, "warning")} (ama doctor)`,
17
+ hintCompact: "/help · Shift+Tab mode",
18
+ keyModel: "Model",
19
+ keyDir: "Folder",
20
+ keyMode: "Mode",
21
+ keyLoaded: "Loaded",
22
+ keyHost: "Host",
23
+ keyWarnings: "Warnings",
24
+ thinking: (level) => `thinking ${level}`,
25
+ preset: (preset) => `preset ${preset}`,
26
+ warningsValue: (n) => `${n} (see ama doctor)`,
27
+ hint: "/help commands · Shift+Tab mode · Ctrl+O expand tool output",
28
+ },
29
+ ui: {
30
+ cancelled: "(cancelled)",
31
+ hintFilter: (arrows) => `type to filter · ${arrows} select · Enter confirm · Esc cancel`,
32
+ hintNumbers: (arrows, n) => `${arrows} select · Enter confirm · 1-${n} pick · Esc cancel`,
33
+ hint: (arrows) => `${arrows} select · Enter confirm · Esc cancel`,
34
+ local: "local",
35
+ noKey: "no key",
36
+ justNow: "just now",
37
+ minutesAgo: (n) => `${n}m ago`,
38
+ hoursAgo: (n) => `${n}h ago`,
39
+ daysAgo: (n) => `${n}d ago`,
40
+ messages: (n) => plural(n, "message"),
41
+ trustRemember: "Trust and remember",
42
+ trustOnce: "Trust this time only",
43
+ trustSkip: "Don't trust this time",
44
+ trustNever: "Don't trust and remember",
45
+ moreResources: (n) => ` …${n} more`,
46
+ trustTitle: "Trust this folder's project resources?",
47
+ resumeTitle: "Resume which session?",
48
+ modelTitle: "Choose a model",
49
+ cwdTitle: "The session's working directory does not exist",
50
+ cwdPrompt: "Enter a replacement directory (Enter confirm · Esc cancel)",
51
+ cwdPlaceholder: "directory path",
52
+ cwdEmpty: "Enter a directory",
53
+ cwdMissing: (path) => `Does not exist: ${path}`,
54
+ cwdNotDir: (path) => `Not a directory: ${path}`,
55
+ },
56
+ };
57
+ export const zh = {
58
+ header: {
59
+ trusted: "已信任",
60
+ untrusted: "未信任",
61
+ trustSource: (source) => `(${source})`,
62
+ templates: (n) => `${n} 模板`,
63
+ host: (host) => `宿主 ${host}`,
64
+ warnings: (n) => `警告 ${n} 条(ama doctor)`,
65
+ hintCompact: "/help · Shift+Tab 切模式",
66
+ keyModel: "模型",
67
+ keyDir: "目录",
68
+ keyMode: "模式",
69
+ keyLoaded: "已加载",
70
+ keyHost: "宿主",
71
+ keyWarnings: "警告",
72
+ thinking: (level) => `思考 ${level}`,
73
+ preset: (preset) => `预设 ${preset}`,
74
+ warningsValue: (n) => `${n} 条(ama doctor 查看)`,
75
+ hint: "/help 命令 · Shift+Tab 切模式 · Ctrl+O 展开工具输出",
76
+ },
77
+ ui: {
78
+ cancelled: "(已取消)",
79
+ hintFilter: (arrows) => `输入过滤 · ${arrows} 选择 · Enter 确认 · Esc 取消`,
80
+ hintNumbers: (arrows, n) => `${arrows} 选择 · Enter 确认 · 1-${n} 直接选 · Esc 取消`,
81
+ hint: (arrows) => `${arrows} 选择 · Enter 确认 · Esc 取消`,
82
+ local: "本地",
83
+ noKey: "无 key",
84
+ justNow: "刚刚",
85
+ minutesAgo: (n) => `${n} 分钟前`,
86
+ hoursAgo: (n) => `${n} 小时前`,
87
+ daysAgo: (n) => `${n} 天前`,
88
+ messages: (n) => `${n} 条`,
89
+ trustRemember: "信任并记住",
90
+ trustOnce: "仅本次信任",
91
+ trustSkip: "本次不信任",
92
+ trustNever: "不信任并记住",
93
+ moreResources: (n) => ` …另有 ${n} 项`,
94
+ trustTitle: "信任这个目录的项目资源?",
95
+ resumeTitle: "恢复哪个会话?",
96
+ modelTitle: "选择模型",
97
+ cwdTitle: "会话的工作目录不存在",
98
+ cwdPrompt: "输入替代目录(Enter 确认 · Esc 取消)",
99
+ cwdPlaceholder: "目录路径",
100
+ cwdEmpty: "请输入目录",
101
+ cwdMissing: (path) => `不存在:${path}`,
102
+ cwdNotDir: (path) => `不是目录:${path}`,
103
+ },
104
+ };
@@ -0,0 +1,140 @@
1
+ /**
2
+ * 消息目录:interactive 的消息区部分(键名规范见 docs/i18n.md)。[W6-I2]
3
+ *
4
+ * 单文件 600 行上限,`interactive.ts` 拆出:消息区(`message-view.ts`)、运行指示(`run-indicator.ts`)、
5
+ * 工具摘要与工具块(`tool-summary.ts`、`tool-view.ts`)。经 `msg().interactive.view` 取用。
6
+ * en 是形状源;zh 用 `satisfies Messages<typeof en>`。
7
+ */
8
+ export declare const en: {
9
+ message: {
10
+ /** 退出摘要的时长:不足 1 分钟按秒,否则按分钟。 */
11
+ duration: (seconds: number) => string;
12
+ sessionPrefix: (rule: string) => string;
13
+ turns: (n: number) => string;
14
+ rebill: (cost: string) => string;
15
+ resume: string;
16
+ origin: {
17
+ steer: string;
18
+ followUp: string;
19
+ host: string;
20
+ task: string;
21
+ plan: string;
22
+ };
23
+ planHandoff: string;
24
+ thinkingStreaming: (glyph: string, ellipsis: string) => string;
25
+ thinking: (glyph: string, tokens: string) => string;
26
+ moreLines: (ellipsis: string, n: number) => string;
27
+ image: string;
28
+ modelError: string;
29
+ interrupted: string;
30
+ lengthLimit: string;
31
+ hookBlocked: (glyph: string, reason: string) => string;
32
+ retry: (glyph: string, attempt: number, max: number, seconds: number, error: string) => string;
33
+ retryFailed: (error: string | undefined) => string;
34
+ summaryTokens: (before: string, after: string | undefined) => string;
35
+ compacted: string;
36
+ branchSummary: string;
37
+ };
38
+ run: {
39
+ esc: string;
40
+ awaitingApproval: string;
41
+ runningTool: (name: string) => string;
42
+ runningTools: (n: number) => string;
43
+ retry: (attempt: number, max: number) => string;
44
+ retryIn: (seconds: number) => string;
45
+ compacting: string;
46
+ replying: string;
47
+ thinking: string;
48
+ queueMore: (ellipsis: string, n: number) => string;
49
+ queueHint: (arrow: string) => string;
50
+ };
51
+ tool: {
52
+ interrupted: string;
53
+ timedOut: string;
54
+ exit: (code: number) => string;
55
+ lines: (n: number) => string;
56
+ failed: string;
57
+ image: (mime: string) => string;
58
+ emptyFile: string;
59
+ read: (n: number) => string;
60
+ edits: (n: number) => string;
61
+ write: (created: boolean, n: number) => string;
62
+ noMatch: string;
63
+ matches: (matches: number, files: number | undefined) => string;
64
+ files: (n: number) => string;
65
+ codemode: (calls: number, lines: number) => string;
66
+ done: string;
67
+ outputLines: (n: number) => string;
68
+ awaiting: (glyph: string) => string;
69
+ subagentRunning: (elapsed: string) => string;
70
+ running: (elapsed: string) => string;
71
+ moreLines: (ellipsis: string, n: number) => string;
72
+ earlierCalls: (ellipsis: string, n: number) => string;
73
+ };
74
+ };
75
+ export declare const zh: {
76
+ message: {
77
+ duration: (seconds: number) => string;
78
+ sessionPrefix: (rule: string) => string;
79
+ turns: (n: number) => string;
80
+ rebill: (cost: string) => string;
81
+ resume: string;
82
+ origin: {
83
+ steer: string;
84
+ followUp: string;
85
+ host: string;
86
+ task: string;
87
+ plan: string;
88
+ };
89
+ planHandoff: string;
90
+ thinkingStreaming: (glyph: string, ellipsis: string) => string;
91
+ thinking: (glyph: string, tokens: string) => string;
92
+ moreLines: (ellipsis: string, n: number) => string;
93
+ image: string;
94
+ modelError: string;
95
+ interrupted: string;
96
+ lengthLimit: string;
97
+ hookBlocked: (glyph: string, reason: string) => string;
98
+ retry: (glyph: string, attempt: number, max: number, seconds: number, error: string) => string;
99
+ retryFailed: (error: string | undefined) => string;
100
+ summaryTokens: (before: string, after: string | undefined) => string;
101
+ compacted: string;
102
+ branchSummary: string;
103
+ };
104
+ run: {
105
+ esc: string;
106
+ awaitingApproval: string;
107
+ runningTool: (name: string) => string;
108
+ runningTools: (n: number) => string;
109
+ retry: (attempt: number, max: number) => string;
110
+ retryIn: (seconds: number) => string;
111
+ compacting: string;
112
+ replying: string;
113
+ thinking: string;
114
+ queueMore: (ellipsis: string, n: number) => string;
115
+ queueHint: (arrow: string) => string;
116
+ };
117
+ tool: {
118
+ interrupted: string;
119
+ timedOut: string;
120
+ exit: (code: number) => string;
121
+ lines: (n: number) => string;
122
+ failed: string;
123
+ image: (mime: string) => string;
124
+ emptyFile: string;
125
+ read: (n: number) => string;
126
+ edits: (n: number) => string;
127
+ write: (created: boolean, n: number) => string;
128
+ noMatch: string;
129
+ matches: (matches: number, files: number | undefined) => string;
130
+ files: (n: number) => string;
131
+ codemode: (calls: number, lines: number) => string;
132
+ done: string;
133
+ outputLines: (n: number) => string;
134
+ awaiting: (glyph: string) => string;
135
+ subagentRunning: (elapsed: string) => string;
136
+ running: (elapsed: string) => string;
137
+ moreLines: (ellipsis: string, n: number) => string;
138
+ earlierCalls: (ellipsis: string, n: number) => string;
139
+ };
140
+ };