@armadra/agent 0.7.2 → 0.7.4

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 (178) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/CHANGELOG.zh-CN.md +41 -0
  3. package/dist/agent/retry.d.ts +14 -5
  4. package/dist/agent/retry.js +30 -8
  5. package/dist/agent/session-cache-key.d.ts +8 -0
  6. package/dist/agent/session-cache-key.js +46 -0
  7. package/dist/agent/session-cache.d.ts +2 -3
  8. package/dist/agent/session-cache.js +19 -37
  9. package/dist/agent/session-classifier.d.ts +3 -2
  10. package/dist/agent/session-classifier.js +36 -10
  11. package/dist/agent/session-compaction.d.ts +30 -5
  12. package/dist/agent/session-compaction.js +69 -29
  13. package/dist/agent/session-core.d.ts +2 -0
  14. package/dist/agent/session-run.d.ts +12 -0
  15. package/dist/agent/session-run.js +29 -10
  16. package/dist/agent/session-subagent.d.ts +8 -1
  17. package/dist/agent/session-subagent.js +37 -14
  18. package/dist/agent/session-sync.d.ts +8 -2
  19. package/dist/agent/session-sync.js +7 -10
  20. package/dist/agent/session-tools.js +3 -2
  21. package/dist/agent/subagent-fork.d.ts +67 -0
  22. package/dist/agent/subagent-fork.js +87 -0
  23. package/dist/agent/subagent-registry.d.ts +2 -2
  24. package/dist/agent/subagent-registry.js +2 -2
  25. package/dist/agent/tool-availability.d.ts +8 -0
  26. package/dist/agent/tool-availability.js +8 -0
  27. package/dist/agent/tool-runner.js +13 -4
  28. package/dist/agent/worktree.d.ts +8 -0
  29. package/dist/agent/worktree.js +51 -4
  30. package/dist/agents/parse.js +6 -1
  31. package/dist/agents/task-record.js +3 -0
  32. package/dist/agents/types.d.ts +2 -0
  33. package/dist/ai/apis/anthropic-messages.js +10 -5
  34. package/dist/ai/apis/anthropic-request.d.ts +2 -1
  35. package/dist/ai/apis/anthropic-request.js +9 -3
  36. package/dist/ai/apis/google-generative-ai.js +4 -2
  37. package/dist/ai/apis/max-tokens.d.ts +42 -0
  38. package/dist/ai/apis/max-tokens.js +121 -0
  39. package/dist/ai/apis/openai-completions.js +10 -5
  40. package/dist/ai/apis/openai-request.js +1 -1
  41. package/dist/ai/apis/openai-responses-request.js +1 -1
  42. package/dist/ai/apis/openai-responses.js +9 -5
  43. package/dist/ai/apis/shared.d.ts +3 -1
  44. package/dist/ai/apis/shared.js +21 -3
  45. package/dist/ai/cache/fingerprint.d.ts +4 -1
  46. package/dist/ai/cache/fingerprint.js +18 -1
  47. package/dist/ai/cache/miss.d.ts +2 -1
  48. package/dist/ai/cache/miss.js +9 -3
  49. package/dist/ai/cache/reporting.js +5 -1
  50. package/dist/ai/cache/types.d.ts +10 -2
  51. package/dist/ai/cache/warmer.d.ts +6 -1
  52. package/dist/ai/cache/warmer.js +7 -0
  53. package/dist/ai/context.d.ts +12 -4
  54. package/dist/ai/context.js +43 -24
  55. package/dist/ai/fake/fake-provider.d.ts +8 -1
  56. package/dist/ai/fake/fake-provider.js +19 -7
  57. package/dist/ai/fake/fake-script.d.ts +2 -0
  58. package/dist/ai/http.d.ts +17 -9
  59. package/dist/ai/http.js +33 -13
  60. package/dist/ai/image-intern.d.ts +29 -0
  61. package/dist/ai/image-intern.js +58 -0
  62. package/dist/ai/json-body.d.ts +31 -0
  63. package/dist/ai/json-body.js +208 -0
  64. package/dist/ai/overflow.js +5 -0
  65. package/dist/ai/providers/catalog-data.js +13 -13
  66. package/dist/ai/providers/catalog.d.ts +33 -0
  67. package/dist/ai/providers/catalog.js +105 -6
  68. package/dist/ai/providers/enrich.d.ts +13 -3
  69. package/dist/ai/providers/enrich.js +87 -31
  70. package/dist/ai/sse.d.ts +3 -2
  71. package/dist/ai/sse.js +3 -2
  72. package/dist/ai/types.d.ts +9 -2
  73. package/dist/bundle/ama.cjs +3142 -1805
  74. package/dist/cli/compose-agents.js +3 -0
  75. package/dist/cli/compose-extensions.js +2 -0
  76. package/dist/cli/compose-request.d.ts +20 -0
  77. package/dist/cli/compose-request.js +37 -0
  78. package/dist/cli/compose-session.js +2 -2
  79. package/dist/cli/subcommands/model-meta.d.ts +2 -1
  80. package/dist/cli/subcommands/model-meta.js +3 -2
  81. package/dist/codemode/host-side.d.ts +11 -4
  82. package/dist/codemode/host-side.js +25 -6
  83. package/dist/codemode/tool.d.ts +2 -0
  84. package/dist/codemode/tool.js +4 -0
  85. package/dist/compaction/prefix-estimate.d.ts +3 -1
  86. package/dist/compaction/prefix-estimate.js +7 -3
  87. package/dist/config/json-schema.js +9 -2
  88. package/dist/config/key-docs.js +13 -4
  89. package/dist/config/schema-w5.js +9 -1
  90. package/dist/config/schema.d.ts +1 -1
  91. package/dist/config/schema.js +19 -3
  92. package/dist/config/settings-registry.js +6 -0
  93. package/dist/config/types-w5.d.ts +2 -0
  94. package/dist/config/types.d.ts +19 -1
  95. package/dist/config/types.js +4 -0
  96. package/dist/i18n/catalog.d.ts +15 -2
  97. package/dist/i18n/messages/cli.d.ts +2 -0
  98. package/dist/i18n/messages/cli.js +2 -0
  99. package/dist/i18n/messages/config-keys.d.ts +10 -0
  100. package/dist/i18n/messages/config-keys.js +12 -2
  101. package/dist/i18n/messages/config.d.ts +14 -0
  102. package/dist/i18n/messages/config.js +4 -0
  103. package/dist/i18n/messages/errors.d.ts +3 -2
  104. package/dist/i18n/messages/errors.js +15 -2
  105. package/dist/i18n/messages/report-context.d.ts +4 -0
  106. package/dist/i18n/messages/report-context.js +4 -0
  107. package/dist/i18n/messages/report.d.ts +6 -0
  108. package/dist/i18n/messages/report.js +2 -0
  109. package/dist/i18n/messages/settings.d.ts +4 -0
  110. package/dist/i18n/messages/settings.js +6 -2
  111. package/dist/i18n/messages/subcommands.d.ts +2 -2
  112. package/dist/i18n/messages/subcommands.js +4 -2
  113. package/dist/modes/acp/acp-server.js +15 -5
  114. package/dist/modes/acp/acp-sessions.d.ts +9 -0
  115. package/dist/modes/acp/acp-sessions.js +25 -0
  116. package/dist/modes/context-report.d.ts +2 -0
  117. package/dist/modes/context-report.js +25 -8
  118. package/dist/modes/print/json-event.d.ts +12 -1
  119. package/dist/modes/print/json-event.js +48 -1
  120. package/dist/modes/rpc/rpc-mode.d.ts +1 -0
  121. package/dist/modes/rpc/rpc-mode.js +9 -2
  122. package/dist/modes/session-report.d.ts +1 -1
  123. package/dist/modes/session-report.js +12 -6
  124. package/dist/rpc.d.ts +5 -2
  125. package/dist/session/line-reader.d.ts +28 -0
  126. package/dist/session/line-reader.js +82 -0
  127. package/dist/session/list.d.ts +14 -0
  128. package/dist/session/list.js +150 -0
  129. package/dist/session/manager.d.ts +7 -3
  130. package/dist/session/manager.js +21 -48
  131. package/dist/session/migrate.d.ts +2 -1
  132. package/dist/session/migrate.js +2 -1
  133. package/dist/session/projection.d.ts +16 -3
  134. package/dist/session/projection.js +96 -29
  135. package/dist/session/scan.d.ts +3 -3
  136. package/dist/session/scan.js +9 -18
  137. package/dist/session/store.d.ts +3 -0
  138. package/dist/session/store.js +37 -31
  139. package/dist/session/types.d.ts +7 -2
  140. package/dist/tools/bash.d.ts +1 -1
  141. package/dist/tools/bash.js +5 -4
  142. package/dist/tools/glob.d.ts +2 -2
  143. package/dist/tools/glob.js +2 -2
  144. package/dist/tools/grep.js +4 -6
  145. package/dist/tools/image-file.js +2 -1
  146. package/dist/tools/read-lines.d.ts +32 -0
  147. package/dist/tools/read-lines.js +147 -0
  148. package/dist/tools/read.d.ts +6 -2
  149. package/dist/tools/read.js +47 -27
  150. package/dist/tools/task.d.ts +9 -0
  151. package/dist/tools/task.js +21 -8
  152. package/dist/tools/truncate.d.ts +7 -0
  153. package/dist/tools/truncate.js +11 -0
  154. package/dist/tools/types.d.ts +13 -0
  155. package/dist/trace/build-index.js +13 -1
  156. package/dist/tui/ansi.d.ts +2 -0
  157. package/dist/tui/ansi.js +7 -3
  158. package/dist/tui/components/editor-buffer.js +2 -2
  159. package/dist/tui/components/editor.js +5 -6
  160. package/dist/tui/keys.js +2 -2
  161. package/dist/tui/stdin-buffer.js +3 -3
  162. package/docs/acp.md +5 -1
  163. package/docs/agents.md +42 -6
  164. package/docs/codemode.md +4 -2
  165. package/docs/en/acp.md +3 -2
  166. package/docs/en/host-api.md +1 -1
  167. package/docs/en/permissions.md +2 -2
  168. package/docs/en/providers.md +54 -20
  169. package/docs/en/rpc.md +23 -7
  170. package/docs/en/sessions.md +4 -2
  171. package/docs/en/tui.md +3 -3
  172. package/docs/permissions.md +4 -1
  173. package/docs/providers.md +85 -22
  174. package/docs/rpc.md +22 -6
  175. package/docs/session-format.md +3 -2
  176. package/docs/sessions.md +3 -1
  177. package/docs/tui.md +2 -2
  178. package/package.json +2 -2
@@ -158,6 +158,7 @@ declare const en: {
158
158
  invalidCacheWarming: (value: string) => string;
159
159
  invalidCacheRetention: (value: string) => string;
160
160
  invalidIdleTimeout: (value: string) => string;
161
+ invalidStreamIdleTimeout: (value: string) => string;
161
162
  notSessionManager: string;
162
163
  apiNotImplemented: (ref: string, api: string, viaOpenrouter: boolean) => string;
163
164
  appendToolFailed: (name: string, message: string) => string;
@@ -361,7 +362,7 @@ declare const en: {
361
362
  image: string;
362
363
  channels: (names: readonly string[]) => string;
363
364
  price: string;
364
- sources: (parts: readonly string[], match: string | undefined, noTools: boolean) => string;
365
+ sources: (parts: readonly string[], match: string | undefined, noTools: boolean, catalog?: string) => string;
365
366
  };
366
367
  cacheProbe: {
367
368
  adviceSilent: (provider: string, cacheFieldPresent: boolean) => string;
@@ -1152,6 +1153,7 @@ declare const en: {
1152
1153
  keySource: string;
1153
1154
  sourceUsage: (usage: string, estimate: string) => string;
1154
1155
  sourceEstimate: string;
1156
+ sourcePrefix: string;
1155
1157
  keyAutoCompact: string;
1156
1158
  autoCompact: (at: string, distance: string) => string;
1157
1159
  autoCompactReached: (at: string) => string;
@@ -1162,6 +1164,7 @@ declare const en: {
1162
1164
  breakdown: (total: string) => string;
1163
1165
  prefixCounted: string;
1164
1166
  prefixPending: string;
1167
+ prefixEstimated: string;
1165
1168
  categories: {
1166
1169
  system: string;
1167
1170
  tools: string;
@@ -1196,6 +1199,7 @@ declare const en: {
1196
1199
  missModel: string;
1197
1200
  missTools: string;
1198
1201
  missSystem: string;
1202
+ missSystemSections: (sections: string) => string;
1199
1203
  missPrefix: string;
1200
1204
  missEvicted: string;
1201
1205
  missNotice: (reason: string, tokens: string, cost: string | undefined) => string;
@@ -1350,6 +1354,7 @@ declare const en: {
1350
1354
  "compaction.enabled": string;
1351
1355
  "compaction.reserveTokens": string;
1352
1356
  "compaction.keepRecentTokens": string;
1357
+ "compaction.contextBudget": string;
1353
1358
  "compaction.prune": string;
1354
1359
  "compaction.prune.keepResults": string;
1355
1360
  "compaction.prune.clearAtLeast": string;
@@ -1369,6 +1374,7 @@ declare const en: {
1369
1374
  "codemode.mode": string;
1370
1375
  "codemode.inlineBudget": string;
1371
1376
  "codemode.requireStrict": string;
1377
+ "codemode.maxHeapMb": string;
1372
1378
  hooks: string;
1373
1379
  "hooks.timeoutMs": string;
1374
1380
  ui: string;
@@ -1408,6 +1414,7 @@ declare const en: {
1408
1414
  cache: string;
1409
1415
  request: string;
1410
1416
  "request.idleTimeoutMs": string;
1417
+ "request.streamIdleTimeoutMs": string;
1411
1418
  "cache.warming": string;
1412
1419
  "cache.retention": string;
1413
1420
  "cache.minSavingsUsd": string;
@@ -1437,6 +1444,7 @@ declare const en: {
1437
1444
  subagents: string;
1438
1445
  "subagents.maxConcurrent": string;
1439
1446
  "subagents.maxPending": string;
1447
+ "subagents.retainSessions": string;
1440
1448
  "subagents.defaultModel": string;
1441
1449
  "subagents.background": string;
1442
1450
  "subagents.autoBackgroundAfterMs": string;
@@ -1474,6 +1482,7 @@ declare const en: {
1474
1482
  "models.enabled": string;
1475
1483
  fallbackModel: string;
1476
1484
  "limits.maxTurns": string;
1485
+ "compaction.contextBudget": string;
1477
1486
  "limits.maxCostUsd": string;
1478
1487
  "ui.replyLanguage": string;
1479
1488
  "ui.agentBar": string;
@@ -1497,6 +1506,7 @@ declare const en: {
1497
1506
  stringArray: string;
1498
1507
  array: string;
1499
1508
  modelsDev: string;
1509
+ catalog: string;
1500
1510
  modelsEnabled: string;
1501
1511
  noChannels: string;
1502
1512
  unknownChannelOf: (name: string, available: readonly string[]) => string;
@@ -1575,6 +1585,7 @@ declare const en: {
1575
1585
  input: string;
1576
1586
  modelChannels: string;
1577
1587
  modelsDev: string;
1588
+ modelCatalog: string;
1578
1589
  baseUrl: string;
1579
1590
  channelApiKey: string;
1580
1591
  apiKey: string;
@@ -1759,7 +1770,7 @@ declare const en: {
1759
1770
  lookupFailure: (ref: string, reason: Extract<import("../index.js").ModelLookup, {
1760
1771
  ok: false;
1761
1772
  }>["reason"], list: string, hasCandidates: boolean) => string;
1762
- source: (source: import("../ai/providers/enrich.js").FieldSource) => string;
1773
+ source: (source: import("../ai/providers/enrich.js").FieldSource | "catalog-alias") => string;
1763
1774
  unmatched: string;
1764
1775
  match: (kind: import("../ai/providers/models-dev.js").MatchKind, ref: string, normalized: string | undefined) => string;
1765
1776
  consensus: (key: string, entries: number, groups: number, best: number, signature: string) => string;
@@ -2170,6 +2181,7 @@ declare const en: {
2170
2181
  "compaction.enabled": string;
2171
2182
  "compaction.reserveTokens": string;
2172
2183
  "compaction.keepRecentTokens": string;
2184
+ "compaction.contextBudget": string;
2173
2185
  "compaction.prune.keepResults": string;
2174
2186
  "compaction.prune.clearAtLeast": string;
2175
2187
  "cache.warming": string;
@@ -2178,6 +2190,7 @@ declare const en: {
2178
2190
  "cache.missNotices": string;
2179
2191
  "cache.warmSubagents": string;
2180
2192
  "request.idleTimeoutMs": string;
2193
+ "request.streamIdleTimeoutMs": string;
2181
2194
  "retry.enabled": string;
2182
2195
  "retry.maxRetries": string;
2183
2196
  "retry.baseDelayMs": string;
@@ -156,6 +156,7 @@ export declare const en: {
156
156
  invalidCacheWarming: (value: string) => string;
157
157
  invalidCacheRetention: (value: string) => string;
158
158
  invalidIdleTimeout: (value: string) => string;
159
+ invalidStreamIdleTimeout: (value: string) => string;
159
160
  notSessionManager: string;
160
161
  apiNotImplemented: (ref: string, api: string, viaOpenrouter: boolean) => string;
161
162
  appendToolFailed: (name: string, message: string) => string;
@@ -321,6 +322,7 @@ export declare const zh: {
321
322
  invalidCacheWarming: (value: string) => string;
322
323
  invalidCacheRetention: (value: string) => string;
323
324
  invalidIdleTimeout: (value: string) => string;
325
+ invalidStreamIdleTimeout: (value: string) => string;
324
326
  notSessionManager: string;
325
327
  apiNotImplemented: (ref: string, api: string, viaOpenrouter: boolean) => string;
326
328
  appendToolFailed: (name: string, message: string) => string;
@@ -144,6 +144,7 @@ export const en = {
144
144
  invalidCacheWarming: (value) => `AMA_CACHE_WARMING=${value} is invalid (off | streaming | idle), ignored`,
145
145
  invalidCacheRetention: (value) => `AMA_CACHE_RETENTION=${value} is invalid (none | short | long), ignored`,
146
146
  invalidIdleTimeout: (value) => `AMA_IDLE_TIMEOUT_MS=${value} is invalid (expected milliseconds ≥ 0), ignored`,
147
+ invalidStreamIdleTimeout: (value) => `AMA_STREAM_IDLE_TIMEOUT_MS=${value} is invalid (expected milliseconds ≥ 0), ignored`,
147
148
  notSessionManager: "The composition root only accepts SessionManager instances (created by sessions.open)",
148
149
  apiNotImplemented: (ref, api, viaOpenrouter) => `Protocol ${api} of model ${ref} is not implemented yet` +
149
150
  (viaOpenrouter ? "; go through openrouter for now" : ""),
@@ -294,6 +295,7 @@ export const zh = {
294
295
  invalidCacheWarming: (value) => `AMA_CACHE_WARMING=${value} 无效(off | streaming | idle),已忽略`,
295
296
  invalidCacheRetention: (value) => `AMA_CACHE_RETENTION=${value} 无效(none | short | long),已忽略`,
296
297
  invalidIdleTimeout: (value) => `AMA_IDLE_TIMEOUT_MS=${value} 无效(应为不小于 0 的毫秒数),已忽略`,
298
+ invalidStreamIdleTimeout: (value) => `AMA_STREAM_IDLE_TIMEOUT_MS=${value} 无效(应为不小于 0 的毫秒数),已忽略`,
297
299
  notSessionManager: "组装根只接受 SessionManager 实例(由 sessions.open 创建)",
298
300
  apiNotImplemented: (ref, api, viaOpenrouter) => `模型 ${ref} 的协议 ${api} 尚未实现` + (viaOpenrouter ? ";过渡期请经 openrouter 调用" : ""),
299
301
  appendToolFailed: (name, message) => `追加工具 ${name} 失败:${message}`,
@@ -23,6 +23,7 @@ export declare const en: {
23
23
  "compaction.enabled": string;
24
24
  "compaction.reserveTokens": string;
25
25
  "compaction.keepRecentTokens": string;
26
+ "compaction.contextBudget": string;
26
27
  "compaction.prune": string;
27
28
  "compaction.prune.keepResults": string;
28
29
  "compaction.prune.clearAtLeast": string;
@@ -42,6 +43,7 @@ export declare const en: {
42
43
  "codemode.mode": string;
43
44
  "codemode.inlineBudget": string;
44
45
  "codemode.requireStrict": string;
46
+ "codemode.maxHeapMb": string;
45
47
  hooks: string;
46
48
  "hooks.timeoutMs": string;
47
49
  ui: string;
@@ -81,6 +83,7 @@ export declare const en: {
81
83
  cache: string;
82
84
  request: string;
83
85
  "request.idleTimeoutMs": string;
86
+ "request.streamIdleTimeoutMs": string;
84
87
  "cache.warming": string;
85
88
  "cache.retention": string;
86
89
  "cache.minSavingsUsd": string;
@@ -110,6 +113,7 @@ export declare const en: {
110
113
  subagents: string;
111
114
  "subagents.maxConcurrent": string;
112
115
  "subagents.maxPending": string;
116
+ "subagents.retainSessions": string;
113
117
  "subagents.defaultModel": string;
114
118
  "subagents.background": string;
115
119
  "subagents.autoBackgroundAfterMs": string;
@@ -147,6 +151,7 @@ export declare const en: {
147
151
  "models.enabled": string;
148
152
  fallbackModel: string;
149
153
  "limits.maxTurns": string;
154
+ "compaction.contextBudget": string;
150
155
  "limits.maxCostUsd": string;
151
156
  "ui.replyLanguage": string;
152
157
  "ui.agentBar": string;
@@ -172,6 +177,7 @@ export declare const zh: {
172
177
  "compaction.enabled": string;
173
178
  "compaction.reserveTokens": string;
174
179
  "compaction.keepRecentTokens": string;
180
+ "compaction.contextBudget": string;
175
181
  "compaction.prune": string;
176
182
  "compaction.prune.keepResults": string;
177
183
  "compaction.prune.clearAtLeast": string;
@@ -191,6 +197,7 @@ export declare const zh: {
191
197
  "codemode.mode": string;
192
198
  "codemode.inlineBudget": string;
193
199
  "codemode.requireStrict": string;
200
+ "codemode.maxHeapMb": string;
194
201
  hooks: string;
195
202
  "hooks.timeoutMs": string;
196
203
  ui: string;
@@ -230,6 +237,7 @@ export declare const zh: {
230
237
  cache: string;
231
238
  request: string;
232
239
  "request.idleTimeoutMs": string;
240
+ "request.streamIdleTimeoutMs": string;
233
241
  "cache.warming": string;
234
242
  "cache.retention": string;
235
243
  "cache.minSavingsUsd": string;
@@ -259,6 +267,7 @@ export declare const zh: {
259
267
  subagents: string;
260
268
  "subagents.maxConcurrent": string;
261
269
  "subagents.maxPending": string;
270
+ "subagents.retainSessions": string;
262
271
  "subagents.defaultModel": string;
263
272
  "subagents.background": string;
264
273
  "subagents.autoBackgroundAfterMs": string;
@@ -296,6 +305,7 @@ export declare const zh: {
296
305
  "models.enabled": string;
297
306
  fallbackModel: string;
298
307
  "limits.maxTurns": string;
308
+ "compaction.contextBudget": string;
299
309
  "limits.maxCostUsd": string;
300
310
  "ui.replyLanguage": string;
301
311
  "ui.agentBar": string;
@@ -23,6 +23,7 @@ const dynamicDefaultsEn = {
23
23
  "models.enabled": "unset: /model shows every model of configured providers",
24
24
  fallbackModel: "unset: no fallback",
25
25
  "limits.maxTurns": "unset: unlimited",
26
+ "compaction.contextBudget": "unset: the model's context window",
26
27
  "limits.maxCostUsd": "unset: unlimited",
27
28
  "ui.replyLanguage": "unset: no reply-language rule is appended (zero-byte change)",
28
29
  "ui.agentBar": "auto (embedding hosts turn it off in their profile)",
@@ -46,6 +47,7 @@ const dynamicDefaultsZh = {
46
47
  "models.enabled": "不设:/model 显示已配置供应商的全部模型",
47
48
  fallbackModel: "不设:不回退",
48
49
  "limits.maxTurns": "不设:不限",
50
+ "compaction.contextBudget": "不设:模型的上下文窗口",
49
51
  "limits.maxCostUsd": "不设:不限",
50
52
  "ui.replyLanguage": "不设:不追加回复语言规则(零字节变化)",
51
53
  "ui.agentBar": "auto(嵌入宿主要关在自己的 profile 写 off)",
@@ -70,6 +72,7 @@ const keysEn = {
70
72
  "compaction.enabled": "Compact automatically when the context nears its limit",
71
73
  "compaction.reserveTokens": "Tokens reserved for the reply; compaction starts when less is left",
72
74
  "compaction.keepRecentTokens": "Tokens of recent messages kept verbatim when compacting",
75
+ "compaction.contextBudget": "Soft context window (tokens, at least 32768): pruning, compaction and context-pressure notices use min(model window, this value); lower it to keep long sessions cheaper on large-window models",
73
76
  "compaction.prune": "Tier-one pruning (old tool results replaced with placeholders); user level only (effective from wave 5 W5-H1)",
74
77
  "compaction.prune.keepResults": "Keep the most recent N tool results unpruned",
75
78
  "compaction.prune.clearAtLeast": "Prune only when at least this many tokens are saved (avoids breaking the cache too often); auto = max(20000, 0.1 × context budget)",
@@ -89,6 +92,7 @@ const keysEn = {
89
92
  "codemode.mode": "off | on | only; when unset it follows the preset: default → on (Node ≥ 25; Node 22 / 24 → off), codemode-only → only, minimal / coordinator → off; project level only accepts off",
90
93
  "codemode.inlineBudget": "Budget (estimated tokens) for inlining tool declarations in the description in only mode; beyond it only names are listed",
91
94
  "codemode.requireStrict": "true: disable codemode when the runtime Node does not isolate the network (Node 22 / 24)",
95
+ "codemode.maxHeapMb": "V8 heap limit (MB) for the script child process; a script that exceeds it ends with an error; 0 sets no limit",
92
96
  hooks: "Hook settings (the hooks themselves live in hooks.json)",
93
97
  "hooks.timeoutMs": "Default timeout for a single hook command (ms)",
94
98
  ui: "Terminal interface",
@@ -127,7 +131,8 @@ const keysEn = {
127
131
  "skills.dirs": "Extra skill directories; accumulated across levels",
128
132
  cache: "Prompt caching; the whole section is user level only",
129
133
  request: "Model requests; the whole section is user level / profile only",
130
- "request.idleTimeoutMs": "Stream idle timeout (ms): waiting longer for headers or between two chunks counts as stuck and is retried as a retryable error; 0 disables; AMA_IDLE_TIMEOUT_MS overrides",
134
+ "request.idleTimeoutMs": "Response idle timeout (ms): waiting longer than this for the response headers counts as stuck and is retried as a retryable error (gaps inside the stream use request.streamIdleTimeoutMs); 0 disables; AMA_IDLE_TIMEOUT_MS overrides",
135
+ "request.streamIdleTimeoutMs": "Idle limit between two chunks once the stream has started (ms); longer than the header wait because reasoning endpoints can stay silent while thinking; 0 disables; AMA_STREAM_IDLE_TIMEOUT_MS overrides",
131
136
  "cache.warming": "Warming: off disables, streaming warms while generating, idle also warms while idle",
132
137
  "cache.retention": "Cache retention tier: none, short, long (when the provider supports it)",
133
138
  "cache.minSavingsUsd": "Minimum expected savings (USD) for warming",
@@ -157,6 +162,7 @@ const keysEn = {
157
162
  subagents: "ama's own task sub-sessions; user level only except background / autoBackgroundAfterMs (effective from wave 5 W5-G)",
158
163
  "subagents.maxConcurrent": "Sub-sessions running at the same time",
159
164
  "subagents.maxPending": "Queue limit; task fails beyond it",
165
+ "subagents.retainSessions": "Finished sub-sessions kept in memory (least recently used first out); others reopen from their session file when continued",
160
166
  "subagents.defaultModel": "Default sub-session model provider/model[@channel]",
161
167
  "subagents.background": "Whether task runs in the background by default: auto = background in the TUI / RPC / ACP and foreground with -p; always / never are fixed. The call argument and the agent type's background: override it; user, project and host level",
162
168
  "subagents.autoBackgroundAfterMs": "Move a foreground task to the background after it has run this many milliseconds; 0 disables; user and project level",
@@ -194,6 +200,7 @@ const keysZh = {
194
200
  "compaction.enabled": "上下文接近上限时自动压缩",
195
201
  "compaction.reserveTokens": "为回复预留的 token;剩余不足时触发压缩",
196
202
  "compaction.keepRecentTokens": "压缩时原样保留的最近消息 token",
203
+ "compaction.contextBudget": "软窗口(token,至少 32768):裁剪、压缩与上下文余量提示按 min(模型窗口, 它) 计算;大窗口模型调低它可让长会话更省钱",
197
204
  "compaction.prune": "档一裁剪(旧工具结果换成占位);只认用户级(第五波 W5-H1 起生效)",
198
205
  "compaction.prune.keepResults": "保留最近 N 个工具结果不裁",
199
206
  "compaction.prune.clearAtLeast": "一次至少能省这么多 token 才裁(避免频繁打断缓存);auto = max(20000, 0.1 × 上下文预算)",
@@ -213,6 +220,7 @@ const keysZh = {
213
220
  "codemode.mode": "off | on | only;不写时跟随预设:default → on(Node ≥ 25;Node 22 / 24 → off)、codemode-only → only、minimal / coordinator → off;项目级只接受 off",
214
221
  "codemode.inlineBudget": "only 模式在描述里内联工具声明的预算(估算 token),超出只列名字",
215
222
  "codemode.requireStrict": "true:运行时 Node 不隔离网络(Node 22 / 24)时直接禁用 codemode",
223
+ "codemode.maxHeapMb": "脚本子进程的 V8 堆上限(MB),超出时脚本以错误结束;0 不设上限",
216
224
  hooks: "Hook 设置(Hook 本身写在 hooks.json)",
217
225
  "hooks.timeoutMs": "单个 Hook 命令的缺省超时(毫秒)",
218
226
  ui: "终端界面",
@@ -251,7 +259,8 @@ const keysZh = {
251
259
  "skills.dirs": "追加的 Skill 目录;各层累加",
252
260
  cache: "提示缓存;整段只认用户级",
253
261
  request: "模型请求;整段只认用户级 / profile",
254
- "request.idleTimeoutMs": "流空闲超时(毫秒):等响应头或两块数据之间超过即判卡住并按可重试错误重试;0 关闭;AMA_IDLE_TIMEOUT_MS 覆盖",
262
+ "request.idleTimeoutMs": "响应头等待超时(毫秒):等响应头超过即判卡住并按可重试错误重试(流中两块数据之间由 request.streamIdleTimeoutMs 管);0 关闭;AMA_IDLE_TIMEOUT_MS 覆盖",
263
+ "request.streamIdleTimeoutMs": "流开始后两块数据之间的空闲上限(毫秒);比等响应头宽,因为推理端点思考时可能长时间没有字节;0 关闭;AMA_STREAM_IDLE_TIMEOUT_MS 覆盖",
255
264
  "cache.warming": "保温:off 关闭,streaming 生成期间保温,idle 空闲时也保温",
256
265
  "cache.retention": "缓存时长档:none、short、long(供应商支持时)",
257
266
  "cache.minSavingsUsd": "保温的最低期望节省(美元)",
@@ -281,6 +290,7 @@ const keysZh = {
281
290
  subagents: "ama 自己的 task 子会话;除 background / autoBackgroundAfterMs 外只认用户级(第五波 W5-G 起生效)",
282
291
  "subagents.maxConcurrent": "同时运行的子会话数",
283
292
  "subagents.maxPending": "排队上限,超出时 task 报错",
293
+ "subagents.retainSessions": "内存中保留的已结束子会话数(最久未用的先释放),其余续聊时从会话文件重开",
284
294
  "subagents.defaultModel": "子会话缺省模型 provider/model[@channel]",
285
295
  "subagents.background": "task 缺省是否后台:auto = TUI / RPC / ACP 下后台、-p 下前台;always / never 固定。调用参数与类型定义的 background: 优先;用户、项目、宿主级都认",
286
296
  "subagents.autoBackgroundAfterMs": "前台任务运行超过该毫秒数自动转后台;0 关闭;用户、项目级都认",
@@ -23,6 +23,7 @@ export declare const en: {
23
23
  "compaction.enabled": string;
24
24
  "compaction.reserveTokens": string;
25
25
  "compaction.keepRecentTokens": string;
26
+ "compaction.contextBudget": string;
26
27
  "compaction.prune": string;
27
28
  "compaction.prune.keepResults": string;
28
29
  "compaction.prune.clearAtLeast": string;
@@ -42,6 +43,7 @@ export declare const en: {
42
43
  "codemode.mode": string;
43
44
  "codemode.inlineBudget": string;
44
45
  "codemode.requireStrict": string;
46
+ "codemode.maxHeapMb": string;
45
47
  hooks: string;
46
48
  "hooks.timeoutMs": string;
47
49
  ui: string;
@@ -81,6 +83,7 @@ export declare const en: {
81
83
  cache: string;
82
84
  request: string;
83
85
  "request.idleTimeoutMs": string;
86
+ "request.streamIdleTimeoutMs": string;
84
87
  "cache.warming": string;
85
88
  "cache.retention": string;
86
89
  "cache.minSavingsUsd": string;
@@ -110,6 +113,7 @@ export declare const en: {
110
113
  subagents: string;
111
114
  "subagents.maxConcurrent": string;
112
115
  "subagents.maxPending": string;
116
+ "subagents.retainSessions": string;
113
117
  "subagents.defaultModel": string;
114
118
  "subagents.background": string;
115
119
  "subagents.autoBackgroundAfterMs": string;
@@ -147,6 +151,7 @@ export declare const en: {
147
151
  "models.enabled": string;
148
152
  fallbackModel: string;
149
153
  "limits.maxTurns": string;
154
+ "compaction.contextBudget": string;
150
155
  "limits.maxCostUsd": string;
151
156
  "ui.replyLanguage": string;
152
157
  "ui.agentBar": string;
@@ -171,6 +176,7 @@ export declare const en: {
171
176
  stringArray: string;
172
177
  array: string;
173
178
  modelsDev: string;
179
+ catalog: string;
174
180
  modelsEnabled: string;
175
181
  noChannels: string;
176
182
  unknownChannelOf: (name: string, available: readonly string[]) => string;
@@ -257,6 +263,7 @@ export declare const en: {
257
263
  input: string;
258
264
  modelChannels: string;
259
265
  modelsDev: string;
266
+ modelCatalog: string;
260
267
  baseUrl: string;
261
268
  channelApiKey: string;
262
269
  apiKey: string;
@@ -284,6 +291,7 @@ export declare const zh: {
284
291
  "compaction.enabled": string;
285
292
  "compaction.reserveTokens": string;
286
293
  "compaction.keepRecentTokens": string;
294
+ "compaction.contextBudget": string;
287
295
  "compaction.prune": string;
288
296
  "compaction.prune.keepResults": string;
289
297
  "compaction.prune.clearAtLeast": string;
@@ -303,6 +311,7 @@ export declare const zh: {
303
311
  "codemode.mode": string;
304
312
  "codemode.inlineBudget": string;
305
313
  "codemode.requireStrict": string;
314
+ "codemode.maxHeapMb": string;
306
315
  hooks: string;
307
316
  "hooks.timeoutMs": string;
308
317
  ui: string;
@@ -342,6 +351,7 @@ export declare const zh: {
342
351
  cache: string;
343
352
  request: string;
344
353
  "request.idleTimeoutMs": string;
354
+ "request.streamIdleTimeoutMs": string;
345
355
  "cache.warming": string;
346
356
  "cache.retention": string;
347
357
  "cache.minSavingsUsd": string;
@@ -371,6 +381,7 @@ export declare const zh: {
371
381
  subagents: string;
372
382
  "subagents.maxConcurrent": string;
373
383
  "subagents.maxPending": string;
384
+ "subagents.retainSessions": string;
374
385
  "subagents.defaultModel": string;
375
386
  "subagents.background": string;
376
387
  "subagents.autoBackgroundAfterMs": string;
@@ -408,6 +419,7 @@ export declare const zh: {
408
419
  "models.enabled": string;
409
420
  fallbackModel: string;
410
421
  "limits.maxTurns": string;
422
+ "compaction.contextBudget": string;
411
423
  "limits.maxCostUsd": string;
412
424
  "ui.replyLanguage": string;
413
425
  "ui.agentBar": string;
@@ -431,6 +443,7 @@ export declare const zh: {
431
443
  stringArray: string;
432
444
  array: string;
433
445
  modelsDev: string;
446
+ catalog: string;
434
447
  modelsEnabled: string;
435
448
  noChannels: string;
436
449
  unknownChannelOf: (name: string, available: readonly string[]) => string;
@@ -509,6 +522,7 @@ export declare const zh: {
509
522
  input: string;
510
523
  modelChannels: string;
511
524
  modelsDev: string;
525
+ modelCatalog: string;
512
526
  baseUrl: string;
513
527
  channelApiKey: string;
514
528
  apiKey: string;
@@ -25,6 +25,7 @@ export const en = {
25
25
  stringArray: "should be an array of strings",
26
26
  array: "should be an array",
27
27
  modelsDev: `should be "provider/model" or false`,
28
+ catalog: `should be "provider/model" or false`,
28
29
  modelsEnabled: `should be "provider/model[@channel]" or "provider/*"`,
29
30
  noChannels: "the provider has no channels",
30
31
  unknownChannelOf: (name, available) => `channel "${name}" does not exist (available: ${available.join(", ")})`,
@@ -117,6 +118,7 @@ export const en = {
117
118
  input: '["text"] or ["text", "image"] (accepts images)',
118
119
  modelChannels: "Channels the model is mounted on; the first is preferred",
119
120
  modelsDev: 'models.dev entry "provider/model"; false disables enrichment',
121
+ modelCatalog: 'Built-in catalog entry "provider/model" whose intrinsic properties this model inherits; matched by id alias when unset; false disables',
120
122
  baseUrl: "Endpoint address",
121
123
  channelApiKey: "$ENV / ${ENV} / !command / literal; defaults to the provider's key",
122
124
  apiKey: "$ENV / ${ENV} / !command / literal",
@@ -145,6 +147,7 @@ export const zh = {
145
147
  stringArray: "应为字符串数组",
146
148
  array: "应为数组",
147
149
  modelsDev: `应为 "provider/model" 或 false`,
150
+ catalog: `应为 "provider/model" 或 false`,
148
151
  modelsEnabled: `应为 "provider/model[@channel]" 或 "provider/*"`,
149
152
  noChannels: "供应商没有 channels",
150
153
  unknownChannelOf: (name, available) => `渠道 "${name}" 不存在(可用:${available.join(", ")})`,
@@ -229,6 +232,7 @@ export const zh = {
229
232
  input: '["text"] 或 ["text", "image"](收图片)',
230
233
  modelChannels: "挂载的渠道,第一个是首选",
231
234
  modelsDev: 'models.dev 条目 "provider/model";false 关闭补全',
235
+ modelCatalog: '继承其固有属性的内置目录条目 "provider/model";不写时按 id 别名自动匹配;false 关闭',
232
236
  baseUrl: "接口地址",
233
237
  channelApiKey: "$ENV / ${ENV} / !command / 字面量;缺省用供应商的 key",
234
238
  apiKey: "$ENV / ${ENV} / !command / 字面量",
@@ -25,7 +25,8 @@ export declare const en: {
25
25
  lookupFailure: (ref: string, reason: Extract<ModelLookup, {
26
26
  ok: false;
27
27
  }>["reason"], list: string, hasCandidates: boolean) => string;
28
- source: (source: FieldSource) => string;
28
+ /** [ME-C0] `catalog-alias`:中转 / 自定义模型按 id 匹配内置目录后继承的字段(ME-D 起使用)。 */
29
+ source: (source: FieldSource | "catalog-alias") => string;
29
30
  unmatched: string;
30
31
  match: (kind: MatchKind, ref: string, normalized: string | undefined) => string;
31
32
  consensus: (key: string, entries: number, groups: number, best: number, signature: string) => string;
@@ -59,7 +60,7 @@ export declare const zh: {
59
60
  };
60
61
  models: {
61
62
  lookupFailure: (ref: string, reason: "not_found" | "ambiguous" | "provider_not_found" | "channel_not_found", list: string, hasCandidates: boolean) => string;
62
- source: (source: FieldSource) => "config" | "目录" | "缺省" | "models.dev";
63
+ source: (source: FieldSource) => "config" | "目录" | "缺省" | "models.dev" | "目录(按 id 匹配)";
63
64
  unmatched: string;
64
65
  match: (kind: MatchKind, ref: string, normalized: string | undefined) => string;
65
66
  consensus: (key: string, entries: number, groups: number, best: number, signature: string) => string;
@@ -49,7 +49,14 @@ export const en = {
49
49
  : `model not found: ${ref} (ama models list shows available models)`;
50
50
  }
51
51
  },
52
- source: (source) => source === "catalog" ? "catalog" : source === "default" ? "default" : source,
52
+ /** [ME-C0] `catalog-alias`:中转 / 自定义模型按 id 匹配内置目录后继承的字段(ME-D 起使用)。 */
53
+ source: (source) => source === "catalog"
54
+ ? "catalog"
55
+ : source === "catalog-alias"
56
+ ? "catalog (via id)"
57
+ : source === "default"
58
+ ? "default"
59
+ : source,
53
60
  unmatched: "unmatched",
54
61
  match: (kind, ref, normalized) => {
55
62
  const label = {
@@ -124,7 +131,13 @@ export const zh = {
124
131
  : `模型不存在:${ref}(ama models list 查看可用模型)`;
125
132
  }
126
133
  },
127
- source: (source) => (source === "catalog" ? "目录" : source === "default" ? "缺省" : source),
134
+ source: (source) => source === "catalog"
135
+ ? "目录"
136
+ : source === "catalog-alias"
137
+ ? "目录(按 id 匹配)"
138
+ : source === "default"
139
+ ? "缺省"
140
+ : source,
128
141
  unmatched: "未匹配",
129
142
  match: (kind, ref, normalized) => {
130
143
  const label = {
@@ -13,6 +13,7 @@ export declare const en: {
13
13
  keySource: string;
14
14
  sourceUsage: (usage: string, estimate: string) => string;
15
15
  sourceEstimate: string;
16
+ sourcePrefix: string;
16
17
  keyAutoCompact: string;
17
18
  autoCompact: (at: string, distance: string) => string;
18
19
  autoCompactReached: (at: string) => string;
@@ -23,6 +24,7 @@ export declare const en: {
23
24
  breakdown: (total: string) => string;
24
25
  prefixCounted: string;
25
26
  prefixPending: string;
27
+ prefixEstimated: string;
26
28
  categories: {
27
29
  system: string;
28
30
  tools: string;
@@ -57,6 +59,7 @@ export declare const zh: {
57
59
  keySource: string;
58
60
  sourceUsage: (usage: string, estimate: string) => string;
59
61
  sourceEstimate: string;
62
+ sourcePrefix: string;
60
63
  keyAutoCompact: string;
61
64
  autoCompact: (at: string, distance: string) => string;
62
65
  autoCompactReached: (at: string) => string;
@@ -67,6 +70,7 @@ export declare const zh: {
67
70
  breakdown: (total: string) => string;
68
71
  prefixCounted: string;
69
72
  prefixPending: string;
73
+ prefixEstimated: string;
70
74
  categories: {
71
75
  system: string;
72
76
  tools: string;
@@ -14,6 +14,7 @@ export const en = {
14
14
  keySource: "Source",
15
15
  sourceUsage: (usage, estimate) => `reported usage ${usage} + estimated ${estimate}`,
16
16
  sourceEstimate: "estimated in full (no usable usage yet)",
17
+ sourcePrefix: "system prompt and tools only, estimated before the first request",
17
18
  keyAutoCompact: "Auto-compact",
18
19
  autoCompact: (at, distance) => `at ${at}, ≈ ${distance} to go`,
19
20
  autoCompactReached: (at) => `at ${at}, reached`,
@@ -24,6 +25,7 @@ export const en = {
24
25
  breakdown: (total) => `By category (estimated, ${total})`,
25
26
  prefixCounted: "System prompt and tool declarations are counted from the stored system messages; the full estimate can differ from reported usage.",
26
27
  prefixPending: "System prompt and tool declarations are not counted until the first request.",
28
+ prefixEstimated: "System prompt and tool declarations are estimated from what the first request will send.",
27
29
  categories: {
28
30
  system: "System prompt",
29
31
  tools: "Tool declarations",
@@ -58,6 +60,7 @@ export const zh = {
58
60
  keySource: "来源",
59
61
  sourceUsage: (usage, estimate) => `usage 实测 ${usage} + 估算 ${estimate}`,
60
62
  sourceEstimate: "全量估算(还没有可用的 usage)",
63
+ sourcePrefix: "首次请求前,只有系统提示与工具声明的估算",
61
64
  keyAutoCompact: "自动压缩",
62
65
  autoCompact: (at, distance) => `${at} 触发,还差 ≈ ${distance}`,
63
66
  autoCompactReached: (at) => `${at} 触发,已达到`,
@@ -68,6 +71,7 @@ export const zh = {
68
71
  breakdown: (total) => `按类别(估算,${total})`,
69
72
  prefixCounted: "系统提示与工具声明按会话里存的 system 消息计入;全量估算可能与 usage 实测不同。",
70
73
  prefixPending: "系统提示与工具声明在首次请求后才计入。",
74
+ prefixEstimated: "系统提示与工具声明按首次请求将要发送的内容估算。",
71
75
  categories: {
72
76
  system: "系统提示",
73
77
  tools: "工具声明",
@@ -97,6 +97,7 @@ export declare const en: {
97
97
  keySource: string;
98
98
  sourceUsage: (usage: string, estimate: string) => string;
99
99
  sourceEstimate: string;
100
+ sourcePrefix: string;
100
101
  keyAutoCompact: string;
101
102
  autoCompact: (at: string, distance: string) => string;
102
103
  autoCompactReached: (at: string) => string;
@@ -107,6 +108,7 @@ export declare const en: {
107
108
  breakdown: (total: string) => string;
108
109
  prefixCounted: string;
109
110
  prefixPending: string;
111
+ prefixEstimated: string;
110
112
  categories: {
111
113
  system: string;
112
114
  tools: string;
@@ -142,6 +144,7 @@ export declare const en: {
142
144
  missModel: string;
143
145
  missTools: string;
144
146
  missSystem: string;
147
+ missSystemSections: (sections: string) => string;
145
148
  missPrefix: string;
146
149
  missEvicted: string;
147
150
  missNotice: (reason: string, tokens: string, cost: string | undefined) => string;
@@ -339,6 +342,7 @@ export declare const zh: {
339
342
  keySource: string;
340
343
  sourceUsage: (usage: string, estimate: string) => string;
341
344
  sourceEstimate: string;
345
+ sourcePrefix: string;
342
346
  keyAutoCompact: string;
343
347
  autoCompact: (at: string, distance: string) => string;
344
348
  autoCompactReached: (at: string) => string;
@@ -349,6 +353,7 @@ export declare const zh: {
349
353
  breakdown: (total: string) => string;
350
354
  prefixCounted: string;
351
355
  prefixPending: string;
356
+ prefixEstimated: string;
352
357
  categories: {
353
358
  system: string;
354
359
  tools: string;
@@ -383,6 +388,7 @@ export declare const zh: {
383
388
  missModel: string;
384
389
  missTools: string;
385
390
  missSystem: string;
391
+ missSystemSections: (sections: string) => string;
386
392
  missPrefix: string;
387
393
  missEvicted: string;
388
394
  missNotice: (reason: string, tokens: string, cost: string | undefined) => string;
@@ -113,6 +113,7 @@ export const en = {
113
113
  missModel: "after switching model",
114
114
  missTools: "tool list changed",
115
115
  missSystem: "system prompt changed",
116
+ missSystemSections: (sections) => `system prompt changed: ${sections}`,
116
117
  missPrefix: "prefix changed",
117
118
  missEvicted: "evicted by the server",
118
119
  missNotice: (reason, tokens, cost) => `Cache miss (${reason}): re-billed ${tokens} tokens${cost === undefined ? "" : ` (about ${cost})`}`,
@@ -362,6 +363,7 @@ export const zh = {
362
363
  missModel: "切换模型后",
363
364
  missTools: "工具表变化",
364
365
  missSystem: "系统提示变化",
366
+ missSystemSections: (sections) => `系统提示变化:${sections}`,
365
367
  missPrefix: "前缀变化",
366
368
  missEvicted: "服务端已淘汰",
367
369
  missNotice: (reason, tokens, cost) => `缓存未命中(${reason}):重计费 ${tokens} token${cost === undefined ? "" : `(约 ${cost})`}`,