@armadra/agent 0.7.1 → 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.
- package/CHANGELOG.md +57 -0
- package/CHANGELOG.zh-CN.md +34 -0
- package/dist/agent/session-cache.d.ts +4 -2
- package/dist/agent/session-cache.js +5 -3
- package/dist/agent/session-compaction.d.ts +13 -1
- package/dist/agent/session-compaction.js +36 -0
- package/dist/agent/session-core.d.ts +2 -0
- package/dist/agent/session-state.d.ts +9 -3
- package/dist/agent/session-state.js +8 -6
- package/dist/agent/session.js +3 -3
- package/dist/agent/types-w5.d.ts +3 -0
- package/dist/agent/types.d.ts +18 -0
- package/dist/agents/task-record.d.ts +4 -0
- package/dist/agents/task-record.js +18 -0
- package/dist/ai/context.d.ts +7 -2
- package/dist/ai/context.js +45 -7
- package/dist/ai/providers/catalog-data.js +1 -1
- package/dist/bundle/ama.cjs +1643 -486
- package/dist/compaction/breakdown.d.ts +51 -0
- package/dist/compaction/breakdown.js +159 -0
- package/dist/compaction/estimate.d.ts +6 -0
- package/dist/compaction/estimate.js +1 -1
- package/dist/compaction/prefix-estimate.d.ts +23 -0
- package/dist/compaction/prefix-estimate.js +34 -0
- package/dist/config/json-schema.js +1 -0
- package/dist/config/key-docs.js +1 -0
- package/dist/config/schema.js +2 -0
- package/dist/config/settings-registry.js +1 -0
- package/dist/config/types.d.ts +2 -0
- package/dist/drivers/native/codex-app-server.js +6 -0
- package/dist/drivers/runner.js +17 -0
- package/dist/drivers/store.d.ts +3 -0
- package/dist/drivers/store.js +4 -0
- package/dist/i18n/catalog.d.ts +53 -0
- package/dist/i18n/messages/agents.d.ts +3 -0
- package/dist/i18n/messages/agents.js +3 -0
- package/dist/i18n/messages/config-keys.d.ts +2 -0
- package/dist/i18n/messages/config-keys.js +2 -0
- package/dist/i18n/messages/config.d.ts +2 -0
- package/dist/i18n/messages/interactive.d.ts +6 -0
- package/dist/i18n/messages/interactive.js +6 -0
- package/dist/i18n/messages/panels.d.ts +3 -0
- package/dist/i18n/messages/panels.js +5 -2
- package/dist/i18n/messages/report-context.d.ts +94 -0
- package/dist/i18n/messages/report-context.js +95 -0
- package/dist/i18n/messages/report.d.ts +96 -0
- package/dist/i18n/messages/report.js +13 -2
- package/dist/i18n/messages/settings.d.ts +2 -0
- package/dist/i18n/messages/settings.js +2 -0
- package/dist/i18n/messages/subcommands.js +2 -2
- package/dist/modes/acp/acp-events.d.ts +17 -4
- package/dist/modes/acp/acp-events.js +32 -6
- package/dist/modes/commands-core.js +4 -0
- package/dist/modes/context-report.d.ts +35 -0
- package/dist/modes/context-report.js +172 -0
- package/dist/modes/interactive/agent-bar.d.ts +2 -0
- package/dist/modes/interactive/agent-bar.js +6 -0
- package/dist/modes/interactive/commands.d.ts +2 -1
- package/dist/modes/interactive/commands.js +10 -1
- package/dist/modes/interactive/interactive-mode.d.ts +3 -0
- package/dist/modes/interactive/interactive-mode.js +6 -1
- package/dist/modes/interactive/panels.d.ts +2 -1
- package/dist/modes/interactive/panels.js +13 -5
- package/dist/modes/interactive/program-status-ui.d.ts +72 -0
- package/dist/modes/interactive/program-status-ui.js +229 -0
- package/dist/modes/interactive/session-events.d.ts +4 -0
- package/dist/modes/interactive/session-events.js +24 -2
- package/dist/modes/interactive/status-bar.d.ts +21 -3
- package/dist/modes/interactive/status-bar.js +64 -25
- package/dist/modes/interactive/status-ctx.d.ts +55 -0
- package/dist/modes/interactive/status-ctx.js +125 -0
- package/dist/modes/interactive/status-line.d.ts +2 -1
- package/dist/modes/interactive/status-line.js +3 -2
- package/dist/modes/interactive/tasks-report.js +4 -0
- package/dist/modes/print/print-mode.js +12 -0
- package/dist/modes/session-report.d.ts +10 -2
- package/dist/modes/session-report.js +26 -2
- package/dist/sdk.d.ts +1 -1
- package/dist/tools/types.d.ts +6 -0
- package/dist/tui/components/meter.d.ts +2 -0
- package/dist/tui/components/meter.js +1 -1
- package/dist/tui/program-status.d.ts +90 -0
- package/dist/tui/program-status.js +259 -0
- package/docs/acp.md +4 -4
- package/docs/agents.md +1 -1
- package/docs/en/acp.md +4 -4
- package/docs/en/providers.md +5 -3
- package/docs/en/rpc.md +3 -0
- package/docs/en/sessions.md +23 -0
- package/docs/en/tui.md +79 -22
- package/docs/providers.md +8 -5
- package/docs/rpc.md +1 -0
- package/docs/session-format.md +3 -3
- package/docs/sessions.md +22 -0
- package/docs/tui-design.md +2 -2
- package/docs/tui.md +79 -22
- package/package.json +1 -1
|
@@ -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: "
|
|
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: "
|
|
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
|
|
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) =>
|
|
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: "无",
|
|
@@ -12,9 +12,13 @@
|
|
|
12
12
|
* | permission_resolved(allow / allow_session)| tool_call_update(in_progress) |
|
|
13
13
|
* | tool_execution_end | tool_call_update(completed / failed,`[diff?, text]`,locations[].line) |
|
|
14
14
|
* | todo_updated | plan |
|
|
15
|
-
* | turn_end
|
|
15
|
+
* | message_end(助手)/ turn_end | usage_update(上下文用量、窗口、会话累计美元;与上次同值不发) |
|
|
16
16
|
* | permission_mode_changed | current_mode_update + config_option_update |
|
|
17
|
-
* | model_changed
|
|
17
|
+
* | model_changed | config_option_update + usage_update(窗口可能变了,不去重) |
|
|
18
|
+
* | thinking_level_changed | config_option_update |
|
|
19
|
+
*
|
|
20
|
+
* new / load(回放之后)/ resume 的答复发出后,{@link AcpEventMapper.announce} 另发一条 `usage_update`,
|
|
21
|
+
* 客户端不用等第一轮结束就能显示用量。模型窗口未知时不发:schema 里 `size` 必填,不编造窗口。
|
|
18
22
|
*
|
|
19
23
|
* 工具结果只回前 4 KB 文本(完整结果在 ama 会话里);diff 只在实时事件里有(`fileChange` 不落盘)。
|
|
20
24
|
* `session/load` 回放同一套映射(用户消息 → user_message_chunk,工具结果带文本、无 diff)。
|
|
@@ -55,13 +59,18 @@ export declare class AcpEventMapper {
|
|
|
55
59
|
private readonly usedWireIds;
|
|
56
60
|
/** 上次 `session_info_update` 带出的标题。 */
|
|
57
61
|
private lastTitle;
|
|
62
|
+
/** 上次 `usage_update` 的内容(同值不重发)。 */
|
|
63
|
+
private lastUsage;
|
|
58
64
|
constructor(cwd: string, emit: (update: AcpSessionUpdate) => void, session: () => AgentSession,
|
|
59
65
|
/** 会话的配置项与命令表({@link announce} 与配置变化时取;[ACP-D] 填实际内容)。 */
|
|
60
66
|
extras?: () => {
|
|
61
67
|
configOptions: AcpSessionConfigOption[];
|
|
62
68
|
commands: AcpAvailableCommand[];
|
|
63
69
|
});
|
|
64
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* 会话 new / load / resume 的响应发出后由服务端调:`available_commands_update`、`config_option_update`
|
|
72
|
+
* 与 `usage_update`(客户端可能刚重建线程,用量不去重,照发一次)。
|
|
73
|
+
*/
|
|
65
74
|
announce(): void;
|
|
66
75
|
/** 回合结束后由服务端调:`session_info_update`(标题与上次不同才带 title)。 */
|
|
67
76
|
emitSessionInfo(title: string | null, updatedAt: string): void;
|
|
@@ -73,7 +82,11 @@ export declare class AcpEventMapper {
|
|
|
73
82
|
wireId(toolCallId: string): string;
|
|
74
83
|
private claimWireId;
|
|
75
84
|
onEvent(event: SessionEvent): void;
|
|
76
|
-
|
|
85
|
+
/**
|
|
86
|
+
* 发一条 `usage_update`:上下文用量、窗口与会话累计美元。窗口未知时不发(`size` 必填);
|
|
87
|
+
* 与上次内容相同时不发,`force` 时照发。
|
|
88
|
+
*/
|
|
89
|
+
emitUsage(force?: boolean): void;
|
|
77
90
|
/** `session/load`:按消息回放历史(工具结果带前 4 KB 文本;diff 不落盘,回放没有)。 */
|
|
78
91
|
replay(messages: readonly AgentMessage[]): void;
|
|
79
92
|
private status;
|