@armadra/agent 0.21.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/CHANGELOG.zh-CN.md +15 -0
  3. package/dist/agent/session-subagent.js +1 -1
  4. package/dist/agent/session-tools.js +3 -1
  5. package/dist/agent/subagent-land.d.ts +4 -0
  6. package/dist/agent/subagent-land.js +23 -0
  7. package/dist/agent/subagent-registry.d.ts +1 -0
  8. package/dist/agent/subagent-registry.js +8 -7
  9. package/dist/agent/worktree-land.d.ts +22 -0
  10. package/dist/agent/worktree-land.js +91 -0
  11. package/dist/agent/worktree-setup.d.ts +12 -0
  12. package/dist/agent/worktree-setup.js +84 -0
  13. package/dist/agent/worktree.d.ts +22 -2
  14. package/dist/agent/worktree.js +104 -10
  15. package/dist/agents/catalog.d.ts +1 -0
  16. package/dist/agents/result.js +2 -0
  17. package/dist/agents/task-control.d.ts +3 -0
  18. package/dist/bundle/ama.cjs +1693 -1335
  19. package/dist/cli/compose-agents.js +4 -1
  20. package/dist/codemode/tool.js +6 -5
  21. package/dist/config/json-schema.js +1 -0
  22. package/dist/config/schema-w5.js +2 -0
  23. package/dist/config/types-w5.d.ts +5 -0
  24. package/dist/drivers/jsonrpc.d.ts +2 -2
  25. package/dist/i18n/catalog.d.ts +73 -70
  26. package/dist/i18n/messages/config-keys.d.ts +4 -0
  27. package/dist/i18n/messages/config-keys.js +4 -0
  28. package/dist/i18n/messages/config.d.ts +4 -0
  29. package/dist/i18n/messages/errors.d.ts +3 -3
  30. package/dist/i18n/messages/print.d.ts +2 -0
  31. package/dist/i18n/messages/print.js +4 -0
  32. package/dist/i18n/messages/report.d.ts +2 -2
  33. package/dist/i18n/messages/subcommands.d.ts +85 -85
  34. package/dist/modes/print/print-mode.js +3 -0
  35. package/dist/permissions/pipeline.d.ts +2 -0
  36. package/dist/permissions/pipeline.js +2 -0
  37. package/dist/tools/registry.d.ts +1 -1
  38. package/dist/tools/registry.js +4 -2
  39. package/dist/tools/task-land.d.ts +17 -0
  40. package/dist/tools/task-land.js +64 -0
  41. package/docs/guides/agents.md +17 -6
  42. package/package.json +11 -10
@@ -22,6 +22,7 @@ import { NO_AGENT_PROBE_ENV, SessionExternalAgents, registerExternalAgents, } fr
22
22
  import { hostRunnersOf } from "../host/api-impl.js";
23
23
  import { isCoordinatorPreset } from "../tools/presets.js";
24
24
  import { COORDINATOR_WAIT_MAX_MS, bindTaskCtlWaitCap } from "../tools/task-ctl.js";
25
+ import { refuseTaskLand } from "../tools/task-land.js";
25
26
  import { bindTaskAgents, bindTaskBackground } from "../tools/task.js";
26
27
  import { resolveTaskBackground } from "../agent/subagent-background.js";
27
28
  import { msg } from "../i18n/index.js";
@@ -130,7 +131,9 @@ export function createSubagentsFactory(deps) {
130
131
  const env = subagentEnvironment(deps, catalog);
131
132
  bindTaskBackground(task, env.background === true);
132
133
  // [#242] 协调者预设:task_ctl wait 超时封顶(task 与 task_ctl 同进退)
133
- if (isCoordinatorPreset(deps.assembly.config))
134
+ if (isCoordinatorPreset(deps.assembly.config)) {
134
135
  bindTaskCtlWaitCap(deps.assembly.tools.get("task_ctl"), COORDINATOR_WAIT_MAX_MS);
136
+ refuseTaskLand(deps.assembly.tools.get("task_land")); // [#313] 协调者不写文件
137
+ }
135
138
  return ({ core }) => (core.depth > 0 ? undefined : createSubagentExtension(core, env, wiring));
136
139
  }
@@ -20,6 +20,7 @@ import { mkdirSync, writeFileSync } from "node:fs";
20
20
  import { tmpdir } from "node:os";
21
21
  import { join } from "node:path";
22
22
  import { codemodeCallableFilter, resolveCodemodeMode } from "../tools/presets.js";
23
+ import { TASK_LAND_TOOL } from "../tools/task-land.js";
23
24
  import { codemodeAvailability, detectSandboxCapability, sandboxCapabilityFor, strictNeedsOsSandbox, } from "./capability.js";
24
25
  import { BASH_RESULT_DECLARATION, DEFAULT_INLINE_BUDGET, buildDeclarationBlock, toolDeclaration, } from "./declarations.js";
25
26
  import { runSandbox } from "./host-side.js";
@@ -198,11 +199,13 @@ export function createCodemodeTool(options) {
198
199
  const inlineBudget = options.inlineBudget ?? DEFAULT_INLINE_BUDGET;
199
200
  const maxResultChars = options.maxResultChars ?? DEFAULT_MAX_TOOL_RESULT_CHARS;
200
201
  let frozenDescription;
202
+ // [#313] 落地会改父仓库:只作为直接工具经权限管线调用,脚本里不可调用,也不占描述长度
203
+ const listCallable = () => options.listTools().filter(({ tool: t }) => t.name !== TASK_LAND_TOOL);
201
204
  const tool = {
202
205
  name: CODEMODE_TOOL_NAME,
203
206
  label: "Codemode",
204
207
  get description() {
205
- frozenDescription ??= buildCodemodeDescription(options.listTools(), inlineBudget, capability, options.layout);
208
+ frozenDescription ??= buildCodemodeDescription(listCallable(), inlineBudget, capability, options.layout);
206
209
  return frozenDescription;
207
210
  },
208
211
  parameters: {
@@ -228,7 +231,7 @@ export function createCodemodeTool(options) {
228
231
  catch (error) {
229
232
  return { content: error.message, isError: true };
230
233
  }
231
- const tools = options.listTools().map(({ tool: t, textResult }) => ({
234
+ const tools = listCallable().map(({ tool: t, textResult }) => ({
232
235
  name: t.name,
233
236
  declaration: toolDeclaration(t, textResult ? {} : { textResult: false }),
234
237
  }));
@@ -249,9 +252,7 @@ export function createCodemodeTool(options) {
249
252
  ...(options.nodePath !== undefined ? { nodePath: options.nodePath } : {}),
250
253
  ...(options.maxHeapMb !== undefined ? { maxHeapMb: options.maxHeapMb } : {}),
251
254
  maxWorkers: resolveMaxWorkers(options.maxWorkers),
252
- searchTools: (query, searchOptions) => searchTools(options
253
- .listTools()
254
- .map(({ tool: t }) => ({ name: t.name, description: t.description })), query, searchOptions),
255
+ searchTools: (query, searchOptions) => searchTools(listCallable().map(({ tool: t }) => ({ name: t.name, description: t.description })), query, searchOptions),
255
256
  callTool: async (name, args, signal) => {
256
257
  if (!callable.has(name))
257
258
  throw new Error(`Tool ${name} is not available in codemode`);
@@ -164,6 +164,7 @@ function w5Sections() {
164
164
  backgroundMaxMs: num(0, MAX_TIMER_MS),
165
165
  retainSessions: num(0),
166
166
  forkMaxContextRatio: num(0.05, 0.95),
167
+ worktreeSetup: str(),
167
168
  }),
168
169
  models: object({ aliases: object({ fast: str(), strong: str() }), enabled: strings }),
169
170
  fallbackModel: str(),
@@ -93,6 +93,7 @@ export function validateConfigW5(c, config) {
93
93
  "backgroundMaxMs",
94
94
  "retainSessions",
95
95
  "forkMaxContextRatio",
96
+ "worktreeSetup",
96
97
  ], (s, p) => {
97
98
  c.number(s, "maxConcurrent", p, 1, 64);
98
99
  c.number(s, "maxPending", p, 0, 1024);
@@ -102,6 +103,7 @@ export function validateConfigW5(c, config) {
102
103
  c.number(s, "backgroundMaxMs", p, 0, MAX_TIMER_MS);
103
104
  c.number(s, "retainSessions", p, 0);
104
105
  c.number(s, "forkMaxContextRatio", p, 0.05, 0.95);
106
+ c.string(s, "worktreeSetup", p);
105
107
  });
106
108
  checkSection(c, config, "models", ["aliases", "enabled"], (s, p) => {
107
109
  c.stringArray(s, "enabled", p);
@@ -86,6 +86,11 @@ export interface SubagentsConfig {
86
86
  * fork 回落为 fresh;0.05–0.95,缺省 0.5。只认用户级。
87
87
  */
88
88
  forkMaxContextRatio?: number;
89
+ /**
90
+ * [#313] 新建 worktree 后在其根目录运行的命令(如安装或链接依赖);失败则任务失败。只认用户级:
91
+ * 项目配置不能借此执行命令。
92
+ */
93
+ worktreeSetup?: string;
89
94
  }
90
95
  /** `models.enabled` 的一项:`provider/model[@channel]` 或 `provider/*`。 */
91
96
  export declare const MODELS_ENABLED_REF: RegExp;
@@ -13,8 +13,8 @@
13
13
  export type RpcId = string | number;
14
14
  export declare class RpcError extends Error {
15
15
  readonly code: number;
16
- readonly data?: unknown | undefined;
17
- constructor(code: number, message: string, data?: unknown | undefined);
16
+ readonly data?: unknown;
17
+ constructor(code: number, message: string, data?: unknown);
18
18
  }
19
19
  export interface IncomingRequestContext {
20
20
  readonly id: RpcId;
@@ -189,6 +189,76 @@ declare const en: {
189
189
  };
190
190
  };
191
191
  subcommands: {
192
+ configShow: {
193
+ usage: string;
194
+ unknownAction: (action: string) => string;
195
+ missing: string;
196
+ configDir: string;
197
+ dataDir: string;
198
+ projectLevel: string;
199
+ noEditor: (path: string) => string;
200
+ editorFailed: (editor: string, path: string) => string;
201
+ registryMissing: string;
202
+ zeroConfigLocal: (provider: string, rule: string) => string;
203
+ zeroConfigKey: (provider: string, source: string, rule: string) => string;
204
+ providersHeading: string;
205
+ baseUrlFromEnv: (env: string) => string;
206
+ layerDefault: string;
207
+ layerCli: string;
208
+ sandboxIsolated: (node: number) => string;
209
+ sandboxOs: (node: number, kind: string) => string;
210
+ sandboxNone: (node: number) => string;
211
+ sandboxQuickjs: (node: number) => string;
212
+ engineExplicit: (engine: string) => string;
213
+ engineAutoNode: (sandbox: string) => string;
214
+ engineAutoQuickjs: (node: number) => string;
215
+ codemodeExplicit: (sandbox: string) => string;
216
+ codemodeFollowsPreset: (preset: string, sandbox: string) => string;
217
+ presetAlias: (layer: string, label: string, preset: string, canonical: string) => string;
218
+ defaultSource: (reason: string) => string;
219
+ heading: string;
220
+ layerLine: (name: string, label: string) => string;
221
+ model: (ref: string | undefined, reason: string) => string;
222
+ tools: (tools: string, preset: string, codemode: string) => string;
223
+ codemode: (mode: string, reason: string) => string;
224
+ bashSandbox: (detail: string) => string;
225
+ note: (text: string) => string;
226
+ warning: (text: string) => string;
227
+ };
228
+ discover: {
229
+ limitPositive: (raw: string) => string;
230
+ notInUserConfig: (provider: string, path: string) => string;
231
+ nothingToWrite: (kept: number) => string;
232
+ written: (path: string, provider: string, added: number, kept: number, backup: boolean) => string;
233
+ skippedNoTools: (ids: string) => string;
234
+ unmatchedWarning: (ids: string) => string;
235
+ listFailed: (provider: string, error: string) => string;
236
+ found: (provider: string, count: number, url: string) => string;
237
+ unmatched: string;
238
+ fromBackend: string;
239
+ noBackendWindow: (ids: string) => string;
240
+ image: string;
241
+ reasoning: string;
242
+ noTools: string;
243
+ configured: (api: string) => string;
244
+ probeHeader: (count: number, order: string, requests: number, extra: number, limit: number) => string;
245
+ unavailable: string;
246
+ probeStopped: (reason: string) => string;
247
+ cached: (path: string) => string;
248
+ };
249
+ modelsEnabled: {
250
+ badRef: (ref: string) => string;
251
+ unknownModel: (ref: string) => string;
252
+ added: (refs: string, path: string) => string;
253
+ alreadyListed: (refs: string) => string;
254
+ removed: (refs: string, path: string) => string;
255
+ notListed: (refs: string) => string;
256
+ cleared: (path: string) => string;
257
+ listHeader: (path: string) => string;
258
+ listUnset: string;
259
+ notInTable: string;
260
+ nothing: string;
261
+ };
192
262
  common: {
193
263
  warning: (text: string) => string;
194
264
  cancelled: string;
@@ -407,76 +477,6 @@ declare const en: {
407
477
  noHits: (all: boolean) => "No matches\n" | "No matches (only sessions of this directory; --all searches all)\n";
408
478
  truncated: (limit: number) => string;
409
479
  };
410
- modelsEnabled: {
411
- badRef: (ref: string) => string;
412
- unknownModel: (ref: string) => string;
413
- added: (refs: string, path: string) => string;
414
- alreadyListed: (refs: string) => string;
415
- removed: (refs: string, path: string) => string;
416
- notListed: (refs: string) => string;
417
- cleared: (path: string) => string;
418
- listHeader: (path: string) => string;
419
- listUnset: string;
420
- notInTable: string;
421
- nothing: string;
422
- };
423
- configShow: {
424
- usage: string;
425
- unknownAction: (action: string) => string;
426
- missing: string;
427
- configDir: string;
428
- dataDir: string;
429
- projectLevel: string;
430
- noEditor: (path: string) => string;
431
- editorFailed: (editor: string, path: string) => string;
432
- registryMissing: string;
433
- zeroConfigLocal: (provider: string, rule: string) => string;
434
- zeroConfigKey: (provider: string, source: string, rule: string) => string;
435
- providersHeading: string;
436
- baseUrlFromEnv: (env: string) => string;
437
- layerDefault: string;
438
- layerCli: string;
439
- sandboxIsolated: (node: number) => string;
440
- sandboxOs: (node: number, kind: string) => string;
441
- sandboxNone: (node: number) => string;
442
- sandboxQuickjs: (node: number) => string;
443
- engineExplicit: (engine: string) => string;
444
- engineAutoNode: (sandbox: string) => string;
445
- engineAutoQuickjs: (node: number) => string;
446
- codemodeExplicit: (sandbox: string) => string;
447
- codemodeFollowsPreset: (preset: string, sandbox: string) => string;
448
- presetAlias: (layer: string, label: string, preset: string, canonical: string) => string;
449
- defaultSource: (reason: string) => string;
450
- heading: string;
451
- layerLine: (name: string, label: string) => string;
452
- model: (ref: string | undefined, reason: string) => string;
453
- tools: (tools: string, preset: string, codemode: string) => string;
454
- codemode: (mode: string, reason: string) => string;
455
- bashSandbox: (detail: string) => string;
456
- note: (text: string) => string;
457
- warning: (text: string) => string;
458
- };
459
- discover: {
460
- limitPositive: (raw: string) => string;
461
- notInUserConfig: (provider: string, path: string) => string;
462
- nothingToWrite: (kept: number) => string;
463
- written: (path: string, provider: string, added: number, kept: number, backup: boolean) => string;
464
- skippedNoTools: (ids: string) => string;
465
- unmatchedWarning: (ids: string) => string;
466
- listFailed: (provider: string, error: string) => string;
467
- found: (provider: string, count: number, url: string) => string;
468
- unmatched: string;
469
- fromBackend: string;
470
- noBackendWindow: (ids: string) => string;
471
- image: string;
472
- reasoning: string;
473
- noTools: string;
474
- configured: (api: string) => string;
475
- probeHeader: (count: number, order: string, requests: number, extra: number, limit: number) => string;
476
- unavailable: string;
477
- probeStopped: (reason: string) => string;
478
- cached: (path: string) => string;
479
- };
480
480
  };
481
481
  interactive: {
482
482
  commands: {
@@ -1366,6 +1366,7 @@ declare const en: {
1366
1366
  limitTurns: (limit: number) => string;
1367
1367
  limitCost: (limit: string, spent: string) => string;
1368
1368
  denied: (count: number, tools: readonly string[], reason: string) => string;
1369
+ deniedClassifier: (count: number, tools: readonly string[]) => string;
1369
1370
  searchToolsMissing: (preset: string, missing: readonly string[]) => string;
1370
1371
  };
1371
1372
  rpc: {
@@ -1492,6 +1493,7 @@ declare const en: {
1492
1493
  "subagents.maxPending": string;
1493
1494
  "subagents.retainSessions": string;
1494
1495
  "subagents.defaultModel": string;
1496
+ "subagents.worktreeSetup": string;
1495
1497
  "subagents.forkMaxContextRatio": string;
1496
1498
  "subagents.background": string;
1497
1499
  "subagents.autoBackgroundAfterMs": string;
@@ -1526,6 +1528,7 @@ declare const en: {
1526
1528
  "plan.thinkingLevel": string;
1527
1529
  "agents.sessionBudgetUsd": string;
1528
1530
  "subagents.defaultModel": string;
1531
+ "subagents.worktreeSetup": string;
1529
1532
  "models.aliases.fast": string;
1530
1533
  "models.aliases.strong": string;
1531
1534
  "models.enabled": string;
@@ -119,6 +119,7 @@ export declare const en: {
119
119
  "subagents.maxPending": string;
120
120
  "subagents.retainSessions": string;
121
121
  "subagents.defaultModel": string;
122
+ "subagents.worktreeSetup": string;
122
123
  "subagents.forkMaxContextRatio": string;
123
124
  "subagents.background": string;
124
125
  "subagents.autoBackgroundAfterMs": string;
@@ -153,6 +154,7 @@ export declare const en: {
153
154
  "plan.thinkingLevel": string;
154
155
  "agents.sessionBudgetUsd": string;
155
156
  "subagents.defaultModel": string;
157
+ "subagents.worktreeSetup": string;
156
158
  "models.aliases.fast": string;
157
159
  "models.aliases.strong": string;
158
160
  "models.enabled": string;
@@ -280,6 +282,7 @@ export declare const zh: {
280
282
  "subagents.maxPending": string;
281
283
  "subagents.retainSessions": string;
282
284
  "subagents.defaultModel": string;
285
+ "subagents.worktreeSetup": string;
283
286
  "subagents.forkMaxContextRatio": string;
284
287
  "subagents.background": string;
285
288
  "subagents.autoBackgroundAfterMs": string;
@@ -314,6 +317,7 @@ export declare const zh: {
314
317
  "plan.thinkingLevel": string;
315
318
  "agents.sessionBudgetUsd": string;
316
319
  "subagents.defaultModel": string;
320
+ "subagents.worktreeSetup": string;
317
321
  "models.aliases.fast": string;
318
322
  "models.aliases.strong": string;
319
323
  "models.enabled": string;
@@ -19,6 +19,7 @@ const dynamicDefaultsEn = {
19
19
  "plan.thinkingLevel": "unset: keep the current thinking level",
20
20
  "agents.sessionBudgetUsd": "unset: unlimited",
21
21
  "subagents.defaultModel": "unset: inherit the parent session model",
22
+ "subagents.worktreeSetup": "unset: no setup command",
22
23
  "models.aliases.fast": "unset: fast is treated as inherit",
23
24
  "models.aliases.strong": "unset: strong is treated as inherit",
24
25
  "models.enabled": "unset: /model shows every model of configured providers",
@@ -44,6 +45,7 @@ const dynamicDefaultsZh = {
44
45
  "plan.thinkingLevel": "不设:沿用当前思考强度",
45
46
  "agents.sessionBudgetUsd": "不设:不限",
46
47
  "subagents.defaultModel": "不设:继承父会话模型",
48
+ "subagents.worktreeSetup": "不设:不运行初始化命令",
47
49
  "models.aliases.fast": "不设:fast 按 inherit 处理",
48
50
  "models.aliases.strong": "不设:strong 按 inherit 处理",
49
51
  "models.enabled": "不设:/model 显示已配置供应商的全部模型",
@@ -170,6 +172,7 @@ const keysEn = {
170
172
  "subagents.maxPending": "Queue limit; task fails beyond it",
171
173
  "subagents.retainSessions": "Finished sub-sessions kept in memory (least recently used first out); others reopen from their session file when continued",
172
174
  "subagents.defaultModel": "Default sub-session model provider/model[@channel]",
175
+ "subagents.worktreeSetup": "Command run once in the root of each new task worktree (for example to install or link dependencies); AMA_WORKTREE_PARENT is the parent repository; failure fails the task; user level only",
173
176
  "subagents.forkMaxContextRatio": "Fork sub-agents fall back to fresh when the parent's last request used more than this share of (window − compaction.reserveTokens); 0.05–0.95, default 0.5",
174
177
  "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",
175
178
  "subagents.autoBackgroundAfterMs": "Move a foreground task to the background after it has run this many milliseconds; 0 disables; user and project level",
@@ -304,6 +307,7 @@ const keysZh = {
304
307
  "subagents.maxPending": "排队上限,超出时 task 报错",
305
308
  "subagents.retainSessions": "内存中保留的已结束子会话数(最久未用的先释放),其余续聊时从会话文件重开",
306
309
  "subagents.defaultModel": "子会话缺省模型 provider/model[@channel]",
310
+ "subagents.worktreeSetup": "每个新建的任务 worktree 在其根目录运行一次的命令(如安装或链接依赖);AMA_WORKTREE_PARENT 指向父仓库;失败则任务失败;只认用户级",
307
311
  "subagents.forkMaxContextRatio": "fork 子 Agent 的回落比例:父上一次请求超过(窗口 − compaction.reserveTokens)的这一比例时改为 fresh;0.05–0.95,缺省 0.5",
308
312
  "subagents.background": "task 缺省是否后台:auto = TUI / RPC / ACP 下后台、-p 下前台;always / never 固定。调用参数与类型定义的 background: 优先;用户、项目、宿主级都认",
309
313
  "subagents.autoBackgroundAfterMs": "前台任务运行超过该毫秒数自动转后台;0 关闭;用户、项目级都认",
@@ -119,6 +119,7 @@ export declare const en: {
119
119
  "subagents.maxPending": string;
120
120
  "subagents.retainSessions": string;
121
121
  "subagents.defaultModel": string;
122
+ "subagents.worktreeSetup": string;
122
123
  "subagents.forkMaxContextRatio": string;
123
124
  "subagents.background": string;
124
125
  "subagents.autoBackgroundAfterMs": string;
@@ -153,6 +154,7 @@ export declare const en: {
153
154
  "plan.thinkingLevel": string;
154
155
  "agents.sessionBudgetUsd": string;
155
156
  "subagents.defaultModel": string;
157
+ "subagents.worktreeSetup": string;
156
158
  "models.aliases.fast": string;
157
159
  "models.aliases.strong": string;
158
160
  "models.enabled": string;
@@ -394,6 +396,7 @@ export declare const zh: {
394
396
  "subagents.maxPending": string;
395
397
  "subagents.retainSessions": string;
396
398
  "subagents.defaultModel": string;
399
+ "subagents.worktreeSetup": string;
397
400
  "subagents.forkMaxContextRatio": string;
398
401
  "subagents.background": string;
399
402
  "subagents.autoBackgroundAfterMs": string;
@@ -428,6 +431,7 @@ export declare const zh: {
428
431
  "plan.thinkingLevel": string;
429
432
  "agents.sessionBudgetUsd": string;
430
433
  "subagents.defaultModel": string;
434
+ "subagents.worktreeSetup": string;
431
435
  "models.aliases.fast": string;
432
436
  "models.aliases.strong": string;
433
437
  "models.enabled": string;
@@ -59,8 +59,8 @@ export declare const zh: {
59
59
  noPlan: string;
60
60
  };
61
61
  models: {
62
- lookupFailure: (ref: string, reason: "not_found" | "ambiguous" | "provider_not_found" | "channel_not_found", list: string, hasCandidates: boolean) => string;
63
- source: (source: FieldSource) => "config" | "目录" | "缺省" | "models.dev" | "目录(按 id 匹配)";
62
+ lookupFailure: (ref: string, reason: "ambiguous" | "channel_not_found" | "not_found" | "provider_not_found", list: string, hasCandidates: boolean) => string;
63
+ source: (source: FieldSource) => "config" | "models.dev" | "目录" | "目录(按 id 匹配)" | "缺省";
64
64
  unmatched: string;
65
65
  match: (kind: MatchKind, ref: string, normalized: string | undefined) => string;
66
66
  consensus: (key: string, entries: number, groups: number, best: number, signature: string) => string;
@@ -76,7 +76,7 @@ export declare const zh: {
76
76
  refreshFailed: (reason: string) => string;
77
77
  notListed: (unknown: string, choices: string) => string;
78
78
  refreshStatus: (status: "failed" | "unchanged" | "updated", providers: number, models: number, at: string | undefined) => string;
79
- section: (kind: "changed" | "added" | "removed", count: number) => string;
79
+ section: (kind: "added" | "changed" | "removed", count: number) => string;
80
80
  more: (count: number) => string;
81
81
  changed: (ref: string, parts: readonly string[]) => string;
82
82
  };
@@ -21,6 +21,7 @@ export declare const en: {
21
21
  limitTurns: (limit: number) => string;
22
22
  limitCost: (limit: string, spent: string) => string;
23
23
  denied: (count: number, tools: readonly string[], reason: string) => string;
24
+ deniedClassifier: (count: number, tools: readonly string[]) => string;
24
25
  searchToolsMissing: (preset: string, missing: readonly string[]) => string;
25
26
  };
26
27
  /** RPC 响应的 `error`(人读)。 */
@@ -48,6 +49,7 @@ export declare const zh: {
48
49
  limitTurns: (limit: number) => string;
49
50
  limitCost: (limit: string, spent: string) => string;
50
51
  denied: (count: number, tools: readonly string[], reason: string) => string;
52
+ deniedClassifier: (count: number, tools: readonly string[]) => string;
51
53
  searchToolsMissing: (preset: string, missing: readonly string[]) => string;
52
54
  };
53
55
  rpc: {
@@ -24,6 +24,8 @@ export const en = {
24
24
  limitCost: (limit, spent) => `ama: reached the cost limit ${limit} (spent ${spent}; --max-cost / limits.maxCostUsd); run ended before finishing`,
25
25
  denied: (count, tools, reason) => `ama: ${plural(count, "tool call")} denied: ${tools.join(", ")}${reason !== "" ? ` (${reason})` : ""}; ` +
26
26
  "-p has no one to approve; to allow them use --permission-mode auto-edit|auto or --allow <rule>",
27
+ deniedClassifier: (count, tools) => `ama: ${plural(count, "tool call")} denied: ${tools.join(", ")} (the auto-mode classifier is unavailable); ` +
28
+ "check the key and model it uses (permission.autoModel, see the warning above), or allow them with --allow <rule>",
27
29
  searchToolsMissing: (preset, missing) => `ama: the ${preset} preset has no ${missing.join(" / ")}; add ${missing.length === 1 ? "it" : "them"} with ` +
28
30
  `tools.default: [${missing.map((name) => `"+${name}"`).join(",")}]`,
29
31
  },
@@ -54,6 +56,8 @@ export const zh = {
54
56
  limitCost: (limit, spent) => `ama: 已达到费用上限 ${limit}(累计 ${spent};--max-cost / limits.maxCostUsd),运行在完成前结束`,
55
57
  denied: (count, tools, reason) => `ama: ${count} 次工具调用被拒:${tools.join("、")}${reason !== "" ? `(${reason})` : ""};` +
56
58
  "-p 没有人审批,需要放行时用 --permission-mode auto-edit|auto 或 --allow <规则>",
59
+ deniedClassifier: (count, tools) => `ama: ${count} 次工具调用被拒:${tools.join("、")}(auto 模式的分类器不可用);` +
60
+ "请检查它使用的 key 与模型(permission.autoModel,见上方警告),或用 --allow <规则> 放行",
57
61
  searchToolsMissing: (preset, missing) => `ama: ${preset} 预设没有 ${missing.join(" / ")},可用 ` +
58
62
  `tools.default: [${missing.map((name) => `"+${name}"`).join(",")}] 加上`,
59
63
  },
@@ -390,7 +390,7 @@ export declare const zh: {
390
390
  cache: {
391
391
  unreported: string;
392
392
  unknown: string;
393
- reason: (reason: CacheMissReason) => "切换模型" | "前缀变化" | "空闲超时" | "子任务" | "服务端淘汰";
393
+ reason: (reason: CacheMissReason) => "切换模型" | "前缀变化" | "子任务" | "服务端淘汰" | "空闲超时";
394
394
  missIdle: (minutes: number) => string;
395
395
  missSubtask: (minutes: number) => string;
396
396
  missModel: string;
@@ -491,7 +491,7 @@ export declare const zh: {
491
491
  size: (columns: number, rows: number | undefined) => string;
492
492
  defaultUi: (tui: boolean) => string;
493
493
  language: (locale: string, source: string) => string;
494
- languageSource: (kind: "cli" | "config" | "env" | "default" | "locale", name: string | undefined, value: string | undefined) => string;
494
+ languageSource: (kind: "cli" | "config" | "default" | "env" | "locale", name: string | undefined, value: string | undefined) => string;
495
495
  proxyTitle: string;
496
496
  fileHistory: (blobs: number, size: string, shadow: string | undefined, dir: string) => string;
497
497
  shadowRepos: (repos: number, size: string) => string;
@@ -6,6 +6,76 @@
6
6
  * 用法文本(`usage`)整段一个键:列对齐是手工排的。
7
7
  */
8
8
  export declare const en: {
9
+ configShow: {
10
+ usage: string;
11
+ unknownAction: (action: string) => string;
12
+ missing: string;
13
+ configDir: string;
14
+ dataDir: string;
15
+ projectLevel: string;
16
+ noEditor: (path: string) => string;
17
+ editorFailed: (editor: string, path: string) => string;
18
+ registryMissing: string;
19
+ zeroConfigLocal: (provider: string, rule: string) => string;
20
+ zeroConfigKey: (provider: string, source: string, rule: string) => string;
21
+ providersHeading: string;
22
+ baseUrlFromEnv: (env: string) => string;
23
+ layerDefault: string;
24
+ layerCli: string;
25
+ sandboxIsolated: (node: number) => string;
26
+ sandboxOs: (node: number, kind: string) => string;
27
+ sandboxNone: (node: number) => string;
28
+ sandboxQuickjs: (node: number) => string;
29
+ engineExplicit: (engine: string) => string;
30
+ engineAutoNode: (sandbox: string) => string;
31
+ engineAutoQuickjs: (node: number) => string;
32
+ codemodeExplicit: (sandbox: string) => string;
33
+ codemodeFollowsPreset: (preset: string, sandbox: string) => string;
34
+ presetAlias: (layer: string, label: string, preset: string, canonical: string) => string;
35
+ defaultSource: (reason: string) => string;
36
+ heading: string;
37
+ layerLine: (name: string, label: string) => string;
38
+ model: (ref: string | undefined, reason: string) => string;
39
+ tools: (tools: string, preset: string, codemode: string) => string;
40
+ codemode: (mode: string, reason: string) => string;
41
+ bashSandbox: (detail: string) => string;
42
+ note: (text: string) => string;
43
+ warning: (text: string) => string;
44
+ };
45
+ discover: {
46
+ limitPositive: (raw: string) => string;
47
+ notInUserConfig: (provider: string, path: string) => string;
48
+ nothingToWrite: (kept: number) => string;
49
+ written: (path: string, provider: string, added: number, kept: number, backup: boolean) => string;
50
+ skippedNoTools: (ids: string) => string;
51
+ unmatchedWarning: (ids: string) => string;
52
+ listFailed: (provider: string, error: string) => string;
53
+ found: (provider: string, count: number, url: string) => string;
54
+ unmatched: string;
55
+ fromBackend: string;
56
+ noBackendWindow: (ids: string) => string;
57
+ image: string;
58
+ reasoning: string;
59
+ noTools: string;
60
+ configured: (api: string) => string;
61
+ probeHeader: (count: number, order: string, requests: number, extra: number, limit: number) => string;
62
+ unavailable: string;
63
+ probeStopped: (reason: string) => string;
64
+ cached: (path: string) => string;
65
+ };
66
+ modelsEnabled: {
67
+ badRef: (ref: string) => string;
68
+ unknownModel: (ref: string) => string;
69
+ added: (refs: string, path: string) => string;
70
+ alreadyListed: (refs: string) => string;
71
+ removed: (refs: string, path: string) => string;
72
+ notListed: (refs: string) => string;
73
+ cleared: (path: string) => string;
74
+ listHeader: (path: string) => string;
75
+ listUnset: string;
76
+ notInTable: string;
77
+ nothing: string;
78
+ };
9
79
  /** 多个子命令共用。 */
10
80
  common: {
11
81
  warning: (text: string) => string;
@@ -225,19 +295,8 @@ export declare const en: {
225
295
  noHits: (all: boolean) => "No matches\n" | "No matches (only sessions of this directory; --all searches all)\n";
226
296
  truncated: (limit: number) => string;
227
297
  };
228
- modelsEnabled: {
229
- badRef: (ref: string) => string;
230
- unknownModel: (ref: string) => string;
231
- added: (refs: string, path: string) => string;
232
- alreadyListed: (refs: string) => string;
233
- removed: (refs: string, path: string) => string;
234
- notListed: (refs: string) => string;
235
- cleared: (path: string) => string;
236
- listHeader: (path: string) => string;
237
- listUnset: string;
238
- notInTable: string;
239
- nothing: string;
240
- };
298
+ };
299
+ export declare const zh: {
241
300
  configShow: {
242
301
  usage: string;
243
302
  unknownAction: (action: string) => string;
@@ -295,8 +354,19 @@ export declare const en: {
295
354
  probeStopped: (reason: string) => string;
296
355
  cached: (path: string) => string;
297
356
  };
298
- };
299
- export declare const zh: {
357
+ modelsEnabled: {
358
+ badRef: (ref: string) => string;
359
+ unknownModel: (ref: string) => string;
360
+ added: (refs: string, path: string) => string;
361
+ alreadyListed: (refs: string) => string;
362
+ removed: (refs: string, path: string) => string;
363
+ notListed: (refs: string) => string;
364
+ cleared: (path: string) => string;
365
+ listHeader: (path: string) => string;
366
+ listUnset: string;
367
+ notInTable: string;
368
+ nothing: string;
369
+ };
300
370
  common: {
301
371
  warning: (text: string) => string;
302
372
  cancelled: string;
@@ -515,74 +585,4 @@ export declare const zh: {
515
585
  noHits: (all: boolean) => "没有命中\n" | "没有命中(只搜了当前目录的会话,--all 搜全部)\n";
516
586
  truncated: (limit: number) => string;
517
587
  };
518
- modelsEnabled: {
519
- badRef: (ref: string) => string;
520
- unknownModel: (ref: string) => string;
521
- added: (refs: string, path: string) => string;
522
- alreadyListed: (refs: string) => string;
523
- removed: (refs: string, path: string) => string;
524
- notListed: (refs: string) => string;
525
- cleared: (path: string) => string;
526
- listHeader: (path: string) => string;
527
- listUnset: string;
528
- notInTable: string;
529
- nothing: string;
530
- };
531
- configShow: {
532
- usage: string;
533
- unknownAction: (action: string) => string;
534
- missing: string;
535
- configDir: string;
536
- dataDir: string;
537
- projectLevel: string;
538
- noEditor: (path: string) => string;
539
- editorFailed: (editor: string, path: string) => string;
540
- registryMissing: string;
541
- zeroConfigLocal: (provider: string, rule: string) => string;
542
- zeroConfigKey: (provider: string, source: string, rule: string) => string;
543
- providersHeading: string;
544
- baseUrlFromEnv: (env: string) => string;
545
- layerDefault: string;
546
- layerCli: string;
547
- sandboxIsolated: (node: number) => string;
548
- sandboxOs: (node: number, kind: string) => string;
549
- sandboxNone: (node: number) => string;
550
- sandboxQuickjs: (node: number) => string;
551
- engineExplicit: (engine: string) => string;
552
- engineAutoNode: (sandbox: string) => string;
553
- engineAutoQuickjs: (node: number) => string;
554
- codemodeExplicit: (sandbox: string) => string;
555
- codemodeFollowsPreset: (preset: string, sandbox: string) => string;
556
- presetAlias: (layer: string, label: string, preset: string, canonical: string) => string;
557
- defaultSource: (reason: string) => string;
558
- heading: string;
559
- layerLine: (name: string, label: string) => string;
560
- model: (ref: string | undefined, reason: string) => string;
561
- tools: (tools: string, preset: string, codemode: string) => string;
562
- codemode: (mode: string, reason: string) => string;
563
- bashSandbox: (detail: string) => string;
564
- note: (text: string) => string;
565
- warning: (text: string) => string;
566
- };
567
- discover: {
568
- limitPositive: (raw: string) => string;
569
- notInUserConfig: (provider: string, path: string) => string;
570
- nothingToWrite: (kept: number) => string;
571
- written: (path: string, provider: string, added: number, kept: number, backup: boolean) => string;
572
- skippedNoTools: (ids: string) => string;
573
- unmatchedWarning: (ids: string) => string;
574
- listFailed: (provider: string, error: string) => string;
575
- found: (provider: string, count: number, url: string) => string;
576
- unmatched: string;
577
- fromBackend: string;
578
- noBackendWindow: (ids: string) => string;
579
- image: string;
580
- reasoning: string;
581
- noTools: string;
582
- configured: (api: string) => string;
583
- probeHeader: (count: number, order: string, requests: number, extra: number, limit: number) => string;
584
- unavailable: string;
585
- probeStopped: (reason: string) => string;
586
- cached: (path: string) => string;
587
- };
588
588
  };