@armadra/agent 0.7.0 → 0.7.2

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 (103) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/CHANGELOG.zh-CN.md +41 -0
  3. package/dist/agent/session-cache.d.ts +4 -2
  4. package/dist/agent/session-cache.js +5 -3
  5. package/dist/agent/session-compaction.d.ts +13 -1
  6. package/dist/agent/session-compaction.js +36 -0
  7. package/dist/agent/session-core.d.ts +2 -0
  8. package/dist/agent/session-state.d.ts +9 -3
  9. package/dist/agent/session-state.js +8 -6
  10. package/dist/agent/session.js +3 -3
  11. package/dist/agent/types-w5.d.ts +3 -0
  12. package/dist/agent/types.d.ts +18 -0
  13. package/dist/agents/task-record.d.ts +4 -0
  14. package/dist/agents/task-record.js +18 -0
  15. package/dist/ai/context.d.ts +7 -2
  16. package/dist/ai/context.js +45 -7
  17. package/dist/ai/providers/catalog-data.js +1 -1
  18. package/dist/auth/oauth/token-store.d.ts +2 -0
  19. package/dist/auth/oauth/token-store.js +7 -2
  20. package/dist/bundle/ama.cjs +1684 -490
  21. package/dist/checkpoints/shadow-git.js +2 -1
  22. package/dist/compaction/breakdown.d.ts +51 -0
  23. package/dist/compaction/breakdown.js +159 -0
  24. package/dist/compaction/estimate.d.ts +6 -0
  25. package/dist/compaction/estimate.js +1 -1
  26. package/dist/compaction/prefix-estimate.d.ts +23 -0
  27. package/dist/compaction/prefix-estimate.js +34 -0
  28. package/dist/config/auth-file.js +10 -2
  29. package/dist/config/fs-retry.d.ts +18 -0
  30. package/dist/config/fs-retry.js +33 -0
  31. package/dist/config/json-schema.js +1 -0
  32. package/dist/config/key-docs.js +1 -0
  33. package/dist/config/schema.js +2 -0
  34. package/dist/config/settings-registry.js +1 -0
  35. package/dist/config/types.d.ts +2 -0
  36. package/dist/drivers/native/codex-app-server.js +6 -0
  37. package/dist/drivers/runner.js +17 -0
  38. package/dist/drivers/store.d.ts +3 -0
  39. package/dist/drivers/store.js +4 -0
  40. package/dist/i18n/catalog.d.ts +53 -0
  41. package/dist/i18n/messages/agents.d.ts +3 -0
  42. package/dist/i18n/messages/agents.js +3 -0
  43. package/dist/i18n/messages/config-keys.d.ts +2 -0
  44. package/dist/i18n/messages/config-keys.js +2 -0
  45. package/dist/i18n/messages/config.d.ts +2 -0
  46. package/dist/i18n/messages/interactive.d.ts +6 -0
  47. package/dist/i18n/messages/interactive.js +6 -0
  48. package/dist/i18n/messages/panels.d.ts +3 -0
  49. package/dist/i18n/messages/panels.js +5 -2
  50. package/dist/i18n/messages/report-context.d.ts +94 -0
  51. package/dist/i18n/messages/report-context.js +95 -0
  52. package/dist/i18n/messages/report.d.ts +96 -0
  53. package/dist/i18n/messages/report.js +13 -2
  54. package/dist/i18n/messages/settings.d.ts +2 -0
  55. package/dist/i18n/messages/settings.js +2 -0
  56. package/dist/i18n/messages/subcommands.js +2 -2
  57. package/dist/modes/acp/acp-events.d.ts +17 -4
  58. package/dist/modes/acp/acp-events.js +32 -6
  59. package/dist/modes/commands-core.js +4 -0
  60. package/dist/modes/context-report.d.ts +35 -0
  61. package/dist/modes/context-report.js +172 -0
  62. package/dist/modes/interactive/agent-bar.d.ts +2 -0
  63. package/dist/modes/interactive/agent-bar.js +6 -0
  64. package/dist/modes/interactive/commands.d.ts +2 -1
  65. package/dist/modes/interactive/commands.js +10 -1
  66. package/dist/modes/interactive/interactive-mode.d.ts +3 -0
  67. package/dist/modes/interactive/interactive-mode.js +6 -1
  68. package/dist/modes/interactive/panels.d.ts +2 -1
  69. package/dist/modes/interactive/panels.js +13 -5
  70. package/dist/modes/interactive/program-status-ui.d.ts +72 -0
  71. package/dist/modes/interactive/program-status-ui.js +229 -0
  72. package/dist/modes/interactive/session-events.d.ts +4 -0
  73. package/dist/modes/interactive/session-events.js +24 -2
  74. package/dist/modes/interactive/status-bar.d.ts +21 -3
  75. package/dist/modes/interactive/status-bar.js +64 -25
  76. package/dist/modes/interactive/status-ctx.d.ts +55 -0
  77. package/dist/modes/interactive/status-ctx.js +125 -0
  78. package/dist/modes/interactive/status-line.d.ts +2 -1
  79. package/dist/modes/interactive/status-line.js +3 -2
  80. package/dist/modes/interactive/tasks-report.js +4 -0
  81. package/dist/modes/print/print-mode.js +12 -0
  82. package/dist/modes/session-report.d.ts +10 -2
  83. package/dist/modes/session-report.js +26 -2
  84. package/dist/sdk.d.ts +1 -1
  85. package/dist/tools/types.d.ts +6 -0
  86. package/dist/tui/components/meter.d.ts +2 -0
  87. package/dist/tui/components/meter.js +1 -1
  88. package/dist/tui/program-status.d.ts +90 -0
  89. package/dist/tui/program-status.js +259 -0
  90. package/docs/acp.md +4 -4
  91. package/docs/agents.md +1 -1
  92. package/docs/en/acp.md +4 -4
  93. package/docs/en/providers.md +5 -3
  94. package/docs/en/rpc.md +3 -0
  95. package/docs/en/sessions.md +24 -1
  96. package/docs/en/tui.md +79 -22
  97. package/docs/providers.md +8 -5
  98. package/docs/rpc.md +1 -0
  99. package/docs/session-format.md +3 -3
  100. package/docs/sessions.md +23 -1
  101. package/docs/tui-design.md +2 -2
  102. package/docs/tui.md +79 -22
  103. package/package.json +1 -1
@@ -20,6 +20,8 @@ export declare const en: {
20
20
  interrupted: string;
21
21
  };
22
22
  turns: (n: number) => string;
23
+ /** 外部 Agent 报告的上下文占用(`34%`、`0.4%`)。 */
24
+ context: (percent: string) => string;
23
25
  bar: {
24
26
  more: (n: number) => string;
25
27
  keys: (up: string, down: string) => string;
@@ -90,6 +92,7 @@ export declare const zh: {
90
92
  interrupted: string;
91
93
  };
92
94
  turns: (n: number) => string;
95
+ context: (percent: string) => string;
93
96
  bar: {
94
97
  more: (n: number) => string;
95
98
  keys: (up: string, down: string) => string;
@@ -21,6 +21,8 @@ export const en = {
21
21
  interrupted: "interrupted",
22
22
  },
23
23
  turns: (n) => plural(n, "turn"),
24
+ /** 外部 Agent 报告的上下文占用(`34%`、`0.4%`)。 */
25
+ context: (percent) => `ctx ${percent}`,
24
26
  bar: {
25
27
  more: (n) => `${n} more`,
26
28
  keys: (up, down) => `${up}${down} select · Enter open · Esc back`,
@@ -91,6 +93,7 @@ export const zh = {
91
93
  interrupted: "已中断",
92
94
  },
93
95
  turns: (n) => `${n} 轮`,
96
+ context: (percent) => `ctx ${percent}`,
94
97
  bar: {
95
98
  more: (n) => `另 ${n} 个`,
96
99
  keys: (up, down) => `${up}${down} 选择 · Enter 打开 · Esc 返回`,
@@ -56,6 +56,7 @@ export declare const en: {
56
56
  "ui.animation": string;
57
57
  "ui.restoreOnCancel": string;
58
58
  "ui.enterWhileRunning": string;
59
+ "ui.programStatus": string;
59
60
  "ui.statusLine": string;
60
61
  "ui.language": string;
61
62
  "ui.replyLanguage": string;
@@ -204,6 +205,7 @@ export declare const zh: {
204
205
  "ui.animation": string;
205
206
  "ui.restoreOnCancel": string;
206
207
  "ui.enterWhileRunning": string;
208
+ "ui.programStatus": string;
207
209
  "ui.statusLine": string;
208
210
  "ui.language": string;
209
211
  "ui.replyLanguage": string;
@@ -103,6 +103,7 @@ const keysEn = {
103
103
  "ui.animation": "false: the spinner stays still while running and redraws only when seconds change; the startup logo does not animate",
104
104
  "ui.restoreOnCancel": "When Esc interrupts a run before any reply or tool call in this turn, withdraw the turn and put the message back into the input box",
105
105
  "ui.enterWhileRunning": "Enter while a run is in progress: queue (default) queues the message as a steer delivered at the next delivery point; interrupt stops the current turn and sends it at once. The app.message.interrupt key (default Ctrl+X) does the other one",
106
+ "ui.programStatus": "Report run state to the terminal with OSC 7501 (idle / working / blocked / done / error): auto (default) sends only after the terminal answers the detection query (off inside tmux), on sends without detecting (inside tmux wrapped in passthrough; needs allow-passthrough on), off never sends. Interactive TUI only",
106
107
  "ui.statusLine": "Bottom info line: full shows two lines (rate line + status line), compact one; toggle at runtime with Ctrl+G or /statusline (effective from wave 5 W5-A)",
107
108
  "ui.language": "Interface language: auto decides from LC_ALL / LC_MESSAGES / LANG (zh* is Chinese, anything else English), zh, en; AMA_LANG and --lang override; affects the interface only, text sent to the model is always English",
108
109
  "ui.replyLanguage": "Reply language for the model (e.g. Chinese): one English rule is appended to the end of the rules section at session start; zero-byte change when unset; user level only (effective from wave 6)",
@@ -226,6 +227,7 @@ const keysZh = {
226
227
  "ui.animation": "false:运行中 spinner 静止,只在秒数变化时重绘;启动字符画不播放动画",
227
228
  "ui.restoreOnCancel": "运行中 Esc 中断、本回合还没有任何回复或工具调用时,撤回该回合并把原消息放回输入框",
228
229
  "ui.enterWhileRunning": "运行中按 Enter:queue(缺省)排队插话,等下一个投递点送达;interrupt 打断当前回合并立即发送。app.message.interrupt 键(缺省 Ctrl+X)做另一种",
230
+ "ui.programStatus": "用 OSC 7501 把运行状态报告给终端(idle / working / blocked / done / error):auto(缺省)终端回应检测查询后才发(tmux 里不发),on 不检测直接发(tmux 里经 passthrough 包裹,需要 allow-passthrough on),off 不发。只用于交互界面",
229
231
  "ui.statusLine": "底部信息行:full 两行(速率行 + 状态行),compact 一行;运行时 Ctrl+G 或 /statusline 切换(第五波 W5-A 起生效)",
230
232
  "ui.language": "界面语言:auto 按 LC_ALL / LC_MESSAGES / LANG 判断(zh* 为中文,其余英文),zh,en;AMA_LANG、--lang 覆盖;只影响界面,发给模型的文本固定英文",
231
233
  "ui.replyLanguage": "模型回复语言(如 Chinese):会话开始在 rules 节末尾追加一句英文规则;不设时零字节变化;只认用户级(第六波起生效)",
@@ -56,6 +56,7 @@ export declare const en: {
56
56
  "ui.animation": string;
57
57
  "ui.restoreOnCancel": string;
58
58
  "ui.enterWhileRunning": string;
59
+ "ui.programStatus": string;
59
60
  "ui.statusLine": string;
60
61
  "ui.language": string;
61
62
  "ui.replyLanguage": string;
@@ -316,6 +317,7 @@ export declare const zh: {
316
317
  "ui.animation": string;
317
318
  "ui.restoreOnCancel": string;
318
319
  "ui.enterWhileRunning": string;
320
+ "ui.programStatus": string;
319
321
  "ui.statusLine": string;
320
322
  "ui.language": string;
321
323
  "ui.replyLanguage": string;
@@ -93,6 +93,10 @@ export declare const en: {
93
93
  cacheSilent: string;
94
94
  sandbox: string;
95
95
  cycleHint: string;
96
+ /** full 本行 Ctx 段末尾:自动压缩开着。 */
97
+ autoCompact: string;
98
+ /** 模型没有上下文窗口(状态栏 `ctx ?`)时提示一次。 */
99
+ noWindow: (model: string) => string;
96
100
  /** [W6] 订阅配额行(full 第三行)与窄屏 / compact 短格式;标签自带分隔(英文冒号后空格)。 */
97
101
  quota: {
98
102
  session: string;
@@ -339,6 +343,8 @@ export declare const zh: {
339
343
  cacheSilent: string;
340
344
  sandbox: string;
341
345
  cycleHint: string;
346
+ autoCompact: string;
347
+ noWindow: (model: string) => string;
342
348
  quota: {
343
349
  session: string;
344
350
  reset: string;
@@ -107,6 +107,10 @@ export const en = {
107
107
  cacheSilent: "n/a",
108
108
  sandbox: "sandbox",
109
109
  cycleHint: "shift+tab to cycle",
110
+ /** full 本行 Ctx 段末尾:自动压缩开着。 */
111
+ autoCompact: "auto",
112
+ /** 模型没有上下文窗口(状态栏 `ctx ?`)时提示一次。 */
113
+ noWindow: (model) => `Context window unknown for ${model}: the status bar shows ctx ? and auto-compaction is off. Run \`ama models discover\` or set contextWindow for this model in the config.`,
110
114
  /** [W6] 订阅配额行(full 第三行)与窄屏 / compact 短格式;标签自带分隔(英文冒号后空格)。 */
111
115
  quota: {
112
116
  session: "Session: ",
@@ -238,6 +242,8 @@ export const zh = {
238
242
  cacheSilent: "未报告",
239
243
  sandbox: "沙箱",
240
244
  cycleHint: "shift+tab 切换",
245
+ autoCompact: "auto",
246
+ noWindow: (model) => `${model} 没有上下文窗口信息:状态栏显示 ctx ?,自动压缩关闭。运行 \`ama models discover\`,或在配置里为该模型设置 contextWindow。`,
241
247
  quota: {
242
248
  session: "5 小时:",
243
249
  reset: "重置:",
@@ -109,6 +109,8 @@ export declare const en: {
109
109
  interrupted: string;
110
110
  };
111
111
  turns: (n: number) => string;
112
+ /** 外部 Agent 报告的上下文占用(`34%`、`0.4%`)。 */
113
+ context: (percent: string) => string;
112
114
  agentRunner: (agent: string, runner: string) => string;
113
115
  background: string;
114
116
  none: string;
@@ -219,6 +221,7 @@ export declare const zh: {
219
221
  interrupted: string;
220
222
  };
221
223
  turns: (n: number) => string;
224
+ context: (percent: string) => string;
222
225
  agentRunner: (agent: string, runner: string) => string;
223
226
  background: string;
224
227
  none: string;
@@ -20,7 +20,7 @@ export const en = {
20
20
  user: (n) => `user ${n}`,
21
21
  assistant: (n) => `assistant ${n}`,
22
22
  toolCalls: (n) => `tool calls ${n}`,
23
- usage: "Usage",
23
+ usage: "Total usage",
24
24
  input: (tokens) => `input ${tokens}`,
25
25
  output: (tokens) => `output ${tokens}`,
26
26
  cacheRead: (tokens) => `cache read ${tokens}`,
@@ -109,6 +109,8 @@ export const en = {
109
109
  interrupted: "interrupted",
110
110
  },
111
111
  turns: (n) => plural(n, "turn"),
112
+ /** 外部 Agent 报告的上下文占用(`34%`、`0.4%`)。 */
113
+ context: (percent) => `ctx ${percent}`,
112
114
  agentRunner: (agent, runner) => `${agent} (${runner})`,
113
115
  background: "background",
114
116
  none: "No subagent tasks yet",
@@ -131,7 +133,7 @@ export const zh = {
131
133
  user: (n) => `用户 ${n}`,
132
134
  assistant: (n) => `助手 ${n}`,
133
135
  toolCalls: (n) => `工具调用 ${n}`,
134
- usage: "用量",
136
+ usage: "累计用量",
135
137
  input: (tokens) => `输入 ${tokens}`,
136
138
  output: (tokens) => `输出 ${tokens}`,
137
139
  cacheRead: (tokens) => `缓存读 ${tokens}`,
@@ -219,6 +221,7 @@ export const zh = {
219
221
  interrupted: "已中断",
220
222
  },
221
223
  turns: (n) => `${n} 轮`,
224
+ context: (percent) => `ctx ${percent}`,
222
225
  agentRunner: (agent, runner) => `${agent}(${runner})`,
223
226
  background: "后台",
224
227
  none: "还没有子 Agent 任务",
@@ -0,0 +1,94 @@
1
+ /**
2
+ * 消息目录:report 的 `/context` 部分(键名规范见 docs/i18n.md)。
3
+ *
4
+ * 单文件 600 行上限,从 `report.ts` 拆出;经 `msg().report.contextReport` 取用(modes/context-report.ts)。
5
+ * 只有数字与名字的格式,不含任何正文。en 是形状源;zh 用 `satisfies Messages<typeof en>`。
6
+ */
7
+ export declare const en: {
8
+ title: string;
9
+ keyUsed: string;
10
+ used: (tokens: string, window: string, percent: string | undefined) => string;
11
+ keyLeft: string;
12
+ left: (tokens: string) => string;
13
+ keySource: string;
14
+ sourceUsage: (usage: string, estimate: string) => string;
15
+ sourceEstimate: string;
16
+ keyAutoCompact: string;
17
+ autoCompact: (at: string, distance: string) => string;
18
+ autoCompactReached: (at: string) => string;
19
+ autoCompactOff: string;
20
+ windowUnknown: string;
21
+ keyPrune: string;
22
+ prune: (at: string) => string;
23
+ breakdown: (total: string) => string;
24
+ prefixCounted: string;
25
+ prefixPending: string;
26
+ categories: {
27
+ system: string;
28
+ tools: string;
29
+ user: string;
30
+ assistant: string;
31
+ reasoning: string;
32
+ toolCalls: string;
33
+ toolResults: string;
34
+ images: string;
35
+ summaries: string;
36
+ custom: string;
37
+ };
38
+ partNames: {
39
+ compaction: string;
40
+ branch: string;
41
+ user: string;
42
+ toolResult: string;
43
+ custom: string;
44
+ };
45
+ images: (count: number) => string;
46
+ more: (count: number) => string;
47
+ largest: (count: number) => string;
48
+ noToolResults: string;
49
+ empty: string;
50
+ };
51
+ export declare const zh: {
52
+ title: string;
53
+ keyUsed: string;
54
+ used: (tokens: string, window: string, percent: string | undefined) => string;
55
+ keyLeft: string;
56
+ left: (tokens: string) => string;
57
+ keySource: string;
58
+ sourceUsage: (usage: string, estimate: string) => string;
59
+ sourceEstimate: string;
60
+ keyAutoCompact: string;
61
+ autoCompact: (at: string, distance: string) => string;
62
+ autoCompactReached: (at: string) => string;
63
+ autoCompactOff: string;
64
+ windowUnknown: string;
65
+ keyPrune: string;
66
+ prune: (at: string) => string;
67
+ breakdown: (total: string) => string;
68
+ prefixCounted: string;
69
+ prefixPending: string;
70
+ categories: {
71
+ system: string;
72
+ tools: string;
73
+ user: string;
74
+ assistant: string;
75
+ reasoning: string;
76
+ toolCalls: string;
77
+ toolResults: string;
78
+ images: string;
79
+ summaries: string;
80
+ custom: string;
81
+ };
82
+ partNames: {
83
+ compaction: string;
84
+ branch: string;
85
+ user: string;
86
+ toolResult: string;
87
+ custom: string;
88
+ };
89
+ images: (count: number) => string;
90
+ more: (count: number) => string;
91
+ largest: (count: number) => string;
92
+ noToolResults: string;
93
+ empty: string;
94
+ };
@@ -0,0 +1,95 @@
1
+ /**
2
+ * 消息目录:report 的 `/context` 部分(键名规范见 docs/i18n.md)。
3
+ *
4
+ * 单文件 600 行上限,从 `report.ts` 拆出;经 `msg().report.contextReport` 取用(modes/context-report.ts)。
5
+ * 只有数字与名字的格式,不含任何正文。en 是形状源;zh 用 `satisfies Messages<typeof en>`。
6
+ */
7
+ import { plural } from "../format.js";
8
+ export const en = {
9
+ title: "Context",
10
+ keyUsed: "Used",
11
+ used: (tokens, window, percent) => `${tokens} / ${window}${percent !== undefined ? ` (${percent})` : ""}`,
12
+ keyLeft: "Left",
13
+ left: (tokens) => `${tokens} tokens`,
14
+ keySource: "Source",
15
+ sourceUsage: (usage, estimate) => `reported usage ${usage} + estimated ${estimate}`,
16
+ sourceEstimate: "estimated in full (no usable usage yet)",
17
+ keyAutoCompact: "Auto-compact",
18
+ autoCompact: (at, distance) => `at ${at}, ≈ ${distance} to go`,
19
+ autoCompactReached: (at) => `at ${at}, reached`,
20
+ autoCompactOff: "off",
21
+ windowUnknown: "window unknown",
22
+ keyPrune: "Pruning",
23
+ prune: (at) => `old tool results trimmed from ${at}`,
24
+ breakdown: (total) => `By category (estimated, ${total})`,
25
+ prefixCounted: "System prompt and tool declarations are counted from the stored system messages; the full estimate can differ from reported usage.",
26
+ prefixPending: "System prompt and tool declarations are not counted until the first request.",
27
+ categories: {
28
+ system: "System prompt",
29
+ tools: "Tool declarations",
30
+ user: "User messages",
31
+ assistant: "Assistant text",
32
+ reasoning: "Reasoning",
33
+ toolCalls: "Tool-call arguments",
34
+ toolResults: "Tool results",
35
+ images: "Images",
36
+ summaries: "Summaries",
37
+ custom: "Custom messages",
38
+ },
39
+ partNames: {
40
+ compaction: "compaction",
41
+ branch: "branch",
42
+ user: "user",
43
+ toolResult: "tool result",
44
+ custom: "custom",
45
+ },
46
+ images: (count) => plural(count, "image"),
47
+ more: (count) => `+${count} more`,
48
+ largest: (count) => `Largest tool results (top ${count})`,
49
+ noToolResults: "no tool results",
50
+ empty: "No messages in the context yet.",
51
+ };
52
+ export const zh = {
53
+ title: "上下文",
54
+ keyUsed: "已用",
55
+ used: (tokens, window, percent) => `${tokens} / ${window}${percent !== undefined ? `(${percent})` : ""}`,
56
+ keyLeft: "剩余",
57
+ left: (tokens) => `${tokens} token`,
58
+ keySource: "来源",
59
+ sourceUsage: (usage, estimate) => `usage 实测 ${usage} + 估算 ${estimate}`,
60
+ sourceEstimate: "全量估算(还没有可用的 usage)",
61
+ keyAutoCompact: "自动压缩",
62
+ autoCompact: (at, distance) => `${at} 触发,还差 ≈ ${distance}`,
63
+ autoCompactReached: (at) => `${at} 触发,已达到`,
64
+ autoCompactOff: "关闭",
65
+ windowUnknown: "窗口未知",
66
+ keyPrune: "裁剪",
67
+ prune: (at) => `超过 ${at} 时清理旧工具结果`,
68
+ breakdown: (total) => `按类别(估算,${total})`,
69
+ prefixCounted: "系统提示与工具声明按会话里存的 system 消息计入;全量估算可能与 usage 实测不同。",
70
+ prefixPending: "系统提示与工具声明在首次请求后才计入。",
71
+ categories: {
72
+ system: "系统提示",
73
+ tools: "工具声明",
74
+ user: "用户消息",
75
+ assistant: "助手文本",
76
+ reasoning: "推理",
77
+ toolCalls: "工具调用参数",
78
+ toolResults: "工具结果",
79
+ images: "附件图片",
80
+ summaries: "摘要",
81
+ custom: "自定义消息",
82
+ },
83
+ partNames: {
84
+ compaction: "压缩",
85
+ branch: "分支",
86
+ user: "用户",
87
+ toolResult: "工具结果",
88
+ custom: "自定义",
89
+ },
90
+ images: (count) => `${count} 张`,
91
+ more: (count) => `另有 ${count} 项`,
92
+ largest: (count) => `最大的工具结果(前 ${count})`,
93
+ noToolResults: "没有工具结果",
94
+ empty: "上下文里还没有消息。",
95
+ };
@@ -29,6 +29,7 @@ export declare const en: {
29
29
  tools: string;
30
30
  hooks: string;
31
31
  session: string;
32
+ context: string;
32
33
  cache: string;
33
34
  statusline: string;
34
35
  planArgs: string;
@@ -86,6 +87,51 @@ export declare const en: {
86
87
  cwdAnswer: string;
87
88
  notDirectory: (path: string) => string;
88
89
  };
90
+ /** `/context`:上下文分类明细(report-context.ts)。 */
91
+ contextReport: {
92
+ title: string;
93
+ keyUsed: string;
94
+ used: (tokens: string, window: string, percent: string | undefined) => string;
95
+ keyLeft: string;
96
+ left: (tokens: string) => string;
97
+ keySource: string;
98
+ sourceUsage: (usage: string, estimate: string) => string;
99
+ sourceEstimate: string;
100
+ keyAutoCompact: string;
101
+ autoCompact: (at: string, distance: string) => string;
102
+ autoCompactReached: (at: string) => string;
103
+ autoCompactOff: string;
104
+ windowUnknown: string;
105
+ keyPrune: string;
106
+ prune: (at: string) => string;
107
+ breakdown: (total: string) => string;
108
+ prefixCounted: string;
109
+ prefixPending: string;
110
+ categories: {
111
+ system: string;
112
+ tools: string;
113
+ user: string;
114
+ assistant: string;
115
+ reasoning: string;
116
+ toolCalls: string;
117
+ toolResults: string;
118
+ images: string;
119
+ summaries: string;
120
+ custom: string;
121
+ };
122
+ partNames: {
123
+ compaction: string;
124
+ branch: string;
125
+ user: string;
126
+ toolResult: string;
127
+ custom: string;
128
+ };
129
+ images: (count: number) => string;
130
+ more: (count: number) => string;
131
+ largest: (count: number) => string;
132
+ noToolResults: string;
133
+ empty: string;
134
+ };
89
135
  /** `/session`、`/cache` 报告与缓存提示行。 */
90
136
  cache: {
91
137
  unreported: string;
@@ -145,6 +191,9 @@ export declare const en: {
145
191
  usage: (input: number, output: number, cacheRead: number, cacheWrite: number, cost: string) => string;
146
192
  keyContext: string;
147
193
  context: (tokens: string, window: string, percent: string) => string;
194
+ /** 上下文行末尾:距自动压缩(档二)还有多少 token;自动压缩关闭 / 熔断时换成 autoCompactOff。 */
195
+ toAutoCompact: (tokens: string) => string;
196
+ autoCompactOff: string;
148
197
  keyAgents: string;
149
198
  externalTitle: string;
150
199
  noFingerprint: string;
@@ -225,6 +274,7 @@ export declare const zh: {
225
274
  tools: string;
226
275
  hooks: string;
227
276
  session: string;
277
+ context: string;
228
278
  cache: string;
229
279
  statusline: string;
230
280
  planArgs: string;
@@ -280,6 +330,50 @@ export declare const zh: {
280
330
  cwdAnswer: string;
281
331
  notDirectory: (path: string) => string;
282
332
  };
333
+ contextReport: {
334
+ title: string;
335
+ keyUsed: string;
336
+ used: (tokens: string, window: string, percent: string | undefined) => string;
337
+ keyLeft: string;
338
+ left: (tokens: string) => string;
339
+ keySource: string;
340
+ sourceUsage: (usage: string, estimate: string) => string;
341
+ sourceEstimate: string;
342
+ keyAutoCompact: string;
343
+ autoCompact: (at: string, distance: string) => string;
344
+ autoCompactReached: (at: string) => string;
345
+ autoCompactOff: string;
346
+ windowUnknown: string;
347
+ keyPrune: string;
348
+ prune: (at: string) => string;
349
+ breakdown: (total: string) => string;
350
+ prefixCounted: string;
351
+ prefixPending: string;
352
+ categories: {
353
+ system: string;
354
+ tools: string;
355
+ user: string;
356
+ assistant: string;
357
+ reasoning: string;
358
+ toolCalls: string;
359
+ toolResults: string;
360
+ images: string;
361
+ summaries: string;
362
+ custom: string;
363
+ };
364
+ partNames: {
365
+ compaction: string;
366
+ branch: string;
367
+ user: string;
368
+ toolResult: string;
369
+ custom: string;
370
+ };
371
+ images: (count: number) => string;
372
+ more: (count: number) => string;
373
+ largest: (count: number) => string;
374
+ noToolResults: string;
375
+ empty: string;
376
+ };
283
377
  cache: {
284
378
  unreported: string;
285
379
  unknown: string;
@@ -337,6 +431,8 @@ export declare const zh: {
337
431
  usage: (input: number, output: number, cacheRead: number, cacheWrite: number, cost: string) => string;
338
432
  keyContext: string;
339
433
  context: (tokens: string, window: string, percent: string) => string;
434
+ toAutoCompact: (tokens: string) => string;
435
+ autoCompactOff: string;
340
436
  keyAgents: string;
341
437
  externalTitle: string;
342
438
  noFingerprint: string;
@@ -9,6 +9,7 @@
9
9
  * `formatTokens` / `formatUsd` / `formatPercent` 的结果、`streaming` / `idle` 之类的枚举值不译。
10
10
  */
11
11
  import { plural } from "../format.js";
12
+ import * as contextReport from "./report-context.js";
12
13
  export const en = {
13
14
  /** 内置斜杠命令:`args` 只写需要翻译的占位,说明整句。 */
14
15
  commands: {
@@ -29,6 +30,7 @@ export const en = {
29
30
  tools: "List / set active tools",
30
31
  hooks: "List loaded hooks",
31
32
  session: "Session info, usage and cache",
33
+ context: "Context breakdown by category (estimated), source, window and auto-compact threshold",
32
34
  cache: "Cache stats; switch warming for this session; print the prefix fingerprint",
33
35
  statusline: "Footer info two lines / one line (Ctrl+G)",
34
36
  planArgs: "[goal] | approve [mode|fresh] | reject",
@@ -86,6 +88,8 @@ export const en = {
86
88
  cwdAnswer: "Replacement directory (empty line cancels): ",
87
89
  notDirectory: (path) => `Not a directory: ${path}\n`,
88
90
  },
91
+ /** `/context`:上下文分类明细(report-context.ts)。 */
92
+ contextReport: contextReport.en,
89
93
  /** `/session`、`/cache` 报告与缓存提示行。 */
90
94
  cache: {
91
95
  unreported: "not reported",
@@ -186,10 +190,13 @@ export const en = {
186
190
  model: (model, thinking, permission) => `${model} · thinking ${thinking} · permission ${permission}`,
187
191
  keyMessages: "Messages",
188
192
  messages: (user, assistant, tools) => `user ${user} · assistant ${assistant} · tool calls ${tools}`,
189
- keyUsage: "Usage",
193
+ keyUsage: "Total usage",
190
194
  usage: (input, output, cacheRead, cacheWrite, cost) => `input ${input} · output ${output} · cache read ${cacheRead} · cache write ${cacheWrite} · ${cost}`,
191
195
  keyContext: "Context",
192
196
  context: (tokens, window, percent) => `${tokens} / ${window} (${percent}%)`,
197
+ /** 上下文行末尾:距自动压缩(档二)还有多少 token;自动压缩关闭 / 熔断时换成 autoCompactOff。 */
198
+ toAutoCompact: (tokens) => `≈ ${tokens} until auto-compaction`,
199
+ autoCompactOff: "auto-compaction off",
193
200
  keyAgents: "Sub-agents",
194
201
  externalTitle: "External agents",
195
202
  noFingerprint: "This session does not provide a prefix fingerprint",
@@ -276,6 +283,7 @@ export const zh = {
276
283
  tools: "列出 / 设置活动工具",
277
284
  hooks: "列出已加载的 Hook",
278
285
  session: "会话信息、用量与缓存",
286
+ context: "上下文按类别拆分(估算)、来源、窗口与自动压缩阈值",
279
287
  cache: "缓存统计;切换本会话保温;打印前缀指纹",
280
288
  statusline: "底部信息行两行 / 一行(Ctrl+G)",
281
289
  planArgs: "[目标] | approve [模式|fresh] | reject",
@@ -331,6 +339,7 @@ export const zh = {
331
339
  cwdAnswer: "替代目录(空行取消):",
332
340
  notDirectory: (path) => `不是目录:${path}\n`,
333
341
  },
342
+ contextReport: contextReport.zh,
334
343
  cache: {
335
344
  unreported: "未报告",
336
345
  unknown: "未知",
@@ -426,10 +435,12 @@ export const zh = {
426
435
  model: (model, thinking, permission) => `${model} · 思考 ${thinking} · 权限 ${permission}`,
427
436
  keyMessages: "消息",
428
437
  messages: (user, assistant, tools) => `用户 ${user} · 助手 ${assistant} · 工具调用 ${tools}`,
429
- keyUsage: "用量",
438
+ keyUsage: "累计用量",
430
439
  usage: (input, output, cacheRead, cacheWrite, cost) => `输入 ${input} · 输出 ${output} · 缓存读 ${cacheRead} · 缓存写 ${cacheWrite} · ${cost}`,
431
440
  keyContext: "上下文",
432
441
  context: (tokens, window, percent) => `${tokens} / ${window}(${percent}%)`,
442
+ toAutoCompact: (tokens) => `距自动压缩 ≈ ${tokens}`,
443
+ autoCompactOff: "自动压缩关闭",
433
444
  keyAgents: "子 Agent",
434
445
  externalTitle: "外部 Agent",
435
446
  noFingerprint: "当前会话不提供前缀指纹",
@@ -29,6 +29,7 @@ export declare const en: {
29
29
  "ui.statusLine": string;
30
30
  "ui.restoreOnCancel": string;
31
31
  "ui.enterWhileRunning": string;
32
+ "ui.programStatus": string;
32
33
  "ui.quietStartup": string;
33
34
  "ui.ascii": string;
34
35
  "ui.language": string;
@@ -207,6 +208,7 @@ export declare const zh: {
207
208
  "ui.statusLine": string;
208
209
  "ui.restoreOnCancel": string;
209
210
  "ui.enterWhileRunning": string;
211
+ "ui.programStatus": string;
210
212
  "ui.quietStartup": string;
211
213
  "ui.ascii": string;
212
214
  "ui.language": string;
@@ -29,6 +29,7 @@ export const en = {
29
29
  "ui.statusLine": "Status line",
30
30
  "ui.restoreOnCancel": "Restore on cancel",
31
31
  "ui.enterWhileRunning": "Enter while running",
32
+ "ui.programStatus": "Terminal program status",
32
33
  "ui.quietStartup": "Startup screen",
33
34
  "ui.ascii": "ASCII glyphs",
34
35
  "ui.language": "Interface language",
@@ -201,6 +202,7 @@ export const zh = {
201
202
  "ui.statusLine": "底部信息行",
202
203
  "ui.restoreOnCancel": "中断后放回原消息",
203
204
  "ui.enterWhileRunning": "运行中按 Enter",
205
+ "ui.programStatus": "终端程序状态",
204
206
  "ui.quietStartup": "启动画面",
205
207
  "ui.ascii": "ASCII 字形",
206
208
  "ui.language": "界面语言",
@@ -206,7 +206,7 @@ export const en = {
206
206
  ? " (the response has cache fields but they stay 0; cache writes may also be delayed, try a larger --gap-ms)"
207
207
  : ""),
208
208
  adviceInconclusive: "The second request read only a little cache or only wrote: maybe cache granularity or TTL; retry with a larger --tokens or a shorter --gap-ms",
209
- advicePromptCache: (provider, id) => `Fill in promptCache.short yourself to enable warming (providers.${provider}.modelOverrides: [{ "id": "${id}", "promptCache": { "short": 300 } }])`,
209
+ advicePromptCache: (provider, id) => `The catalog has no cache lifetime for this model, so ama neither warms it nor prunes early. Fill in promptCache only with a lifetime the upstream documents (providers.${provider}.modelOverrides: [{ "id": "${id}", "promptCache": { "short": <seconds> } }]); a guessed short value fires warming and early pruning while the cache is still valid`,
210
210
  intAtLeast: (name, min) => `--${name} must be an integer ≥ ${min}`,
211
211
  yes: "yes",
212
212
  no: "no",
@@ -439,7 +439,7 @@ export const zh = {
439
439
  ? "(响应里有缓存字段但恒为 0;也可能是缓存写入有延迟,可加大 --gap-ms 再测一次)"
440
440
  : ""),
441
441
  adviceInconclusive: "第二次只读到少量缓存或只有写入:可能是缓存粒度或 TTL 问题,可加大 --tokens 或缩短 --gap-ms 重试",
442
- advicePromptCache: (provider, id) => `可自填 promptCache.short 以启用保温(providers.${provider}.modelOverrides: [{ "id": "${id}", "promptCache": { "short": 300 } }])`,
442
+ advicePromptCache: (provider, id) => `目录里没有这个模型的缓存寿命,ama 不保温、也不提前裁剪。只有上游文档写明了寿命时才填 promptCache(providers.${provider}.modelOverrides: [{ "id": "${id}", "promptCache": { "short": <秒数> } }]);猜一个偏短的值会在缓存仍有效时触发保温和提前裁剪`,
443
443
  intAtLeast: (name, min) => `--${name} 应为不小于 ${min} 的整数`,
444
444
  yes: "有",
445
445
  no: "无",