@armadra/agent 0.6.1 → 0.6.3

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 (152) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/CHANGELOG.zh-CN.md +56 -0
  3. package/README.md +168 -575
  4. package/README.zh-CN.md +165 -596
  5. package/dist/agent/session-settings.d.ts +4 -1
  6. package/dist/agent/session-settings.js +7 -2
  7. package/dist/agent/session.d.ts +6 -0
  8. package/dist/agent/session.js +8 -0
  9. package/dist/agent/subagent-background.d.ts +75 -0
  10. package/dist/agent/subagent-background.js +209 -0
  11. package/dist/agent/subagent-registry.d.ts +24 -5
  12. package/dist/agent/subagent-registry.js +64 -92
  13. package/dist/agent/types-w5.d.ts +11 -1
  14. package/dist/agent/types.d.ts +5 -0
  15. package/dist/agents/builtin.js +0 -1
  16. package/dist/agents/external.js +0 -1
  17. package/dist/agents/parse.js +4 -3
  18. package/dist/agents/result.d.ts +7 -1
  19. package/dist/agents/result.js +20 -1
  20. package/dist/agents/task-control.d.ts +13 -2
  21. package/dist/agents/task-record.d.ts +13 -1
  22. package/dist/agents/task-record.js +32 -0
  23. package/dist/agents/types.d.ts +5 -1
  24. package/dist/ai/apis/chatgpt-backend.d.ts +7 -2
  25. package/dist/ai/apis/chatgpt-backend.js +12 -4
  26. package/dist/ai/providers/discovered-cache.d.ts +29 -12
  27. package/dist/ai/providers/discovered-cache.js +72 -12
  28. package/dist/ai/providers/registry.js +7 -6
  29. package/dist/ai/types.d.ts +5 -0
  30. package/dist/auth/chatgpt/backend-client.d.ts +14 -4
  31. package/dist/auth/chatgpt/backend-client.js +41 -8
  32. package/dist/auth/chatgpt/cli.d.ts +2 -1
  33. package/dist/auth/chatgpt/cli.js +14 -7
  34. package/dist/auth/chatgpt/follow.d.ts +16 -0
  35. package/dist/auth/chatgpt/follow.js +51 -0
  36. package/dist/auth/chatgpt/presets.d.ts +8 -0
  37. package/dist/auth/chatgpt/presets.js +12 -0
  38. package/dist/auth/testing/fake-oauth.d.ts +4 -1
  39. package/dist/auth/testing/fake-oauth.js +24 -1
  40. package/dist/bundle/ama.cjs +2016 -664
  41. package/dist/cli/compose-agents.d.ts +2 -1
  42. package/dist/cli/compose-agents.js +11 -2
  43. package/dist/cli/compose-providers.d.ts +2 -1
  44. package/dist/cli/compose-providers.js +6 -3
  45. package/dist/cli/startup-steps.js +4 -1
  46. package/dist/cli/subcommands/models-discover.d.ts +5 -2
  47. package/dist/cli/subcommands/models-discover.js +52 -10
  48. package/dist/config/json-schema.js +10 -2
  49. package/dist/config/key-docs.js +9 -3
  50. package/dist/config/merge.d.ts +1 -1
  51. package/dist/config/merge.js +20 -3
  52. package/dist/config/schema-w5.js +4 -2
  53. package/dist/config/schema-w6.d.ts +1 -1
  54. package/dist/config/schema-w6.js +2 -1
  55. package/dist/config/schema.js +2 -0
  56. package/dist/config/settings-registry.js +4 -0
  57. package/dist/config/types-w5.d.ts +10 -0
  58. package/dist/config/types-w5.js +2 -0
  59. package/dist/config/types-w6.d.ts +5 -0
  60. package/dist/config/types.d.ts +3 -1
  61. package/dist/git/info.d.ts +19 -0
  62. package/dist/git/info.js +64 -8
  63. package/dist/i18n/catalog.d.ts +52 -8
  64. package/dist/i18n/messages/agents.d.ts +56 -0
  65. package/dist/i18n/messages/agents.js +58 -2
  66. package/dist/i18n/messages/auth.d.ts +12 -0
  67. package/dist/i18n/messages/auth.js +20 -0
  68. package/dist/i18n/messages/config-keys.d.ts +8 -0
  69. package/dist/i18n/messages/config-keys.js +18 -10
  70. package/dist/i18n/messages/config.d.ts +8 -0
  71. package/dist/i18n/messages/interactive-startup.d.ts +0 -16
  72. package/dist/i18n/messages/interactive-startup.js +0 -16
  73. package/dist/i18n/messages/interactive.d.ts +23 -16
  74. package/dist/i18n/messages/interactive.js +25 -0
  75. package/dist/i18n/messages/print.d.ts +4 -0
  76. package/dist/i18n/messages/print.js +4 -0
  77. package/dist/i18n/messages/report.js +4 -4
  78. package/dist/i18n/messages/settings.d.ts +6 -0
  79. package/dist/i18n/messages/settings.js +6 -0
  80. package/dist/i18n/messages/subcommands-config.d.ts +4 -0
  81. package/dist/i18n/messages/subcommands-config.js +4 -0
  82. package/dist/i18n/messages/subcommands.d.ts +4 -0
  83. package/dist/index.d.ts +1 -0
  84. package/dist/modes/commands-core.js +8 -4
  85. package/dist/modes/interactive/agent-bar.d.ts +3 -1
  86. package/dist/modes/interactive/agent-bar.js +12 -5
  87. package/dist/modes/interactive/agent-ui.d.ts +21 -3
  88. package/dist/modes/interactive/agent-ui.js +81 -12
  89. package/dist/modes/interactive/agent-view.d.ts +4 -0
  90. package/dist/modes/interactive/agent-view.js +14 -1
  91. package/dist/modes/interactive/approval-dock.d.ts +51 -0
  92. package/dist/modes/interactive/approval-dock.js +112 -0
  93. package/dist/modes/interactive/approval-ui.d.ts +43 -0
  94. package/dist/modes/interactive/approval-ui.js +64 -0
  95. package/dist/modes/interactive/commands.js +4 -1
  96. package/dist/modes/interactive/event-notices.d.ts +6 -1
  97. package/dist/modes/interactive/event-notices.js +7 -1
  98. package/dist/modes/interactive/interactive-mode.d.ts +4 -2
  99. package/dist/modes/interactive/interactive-mode.js +33 -38
  100. package/dist/modes/interactive/key-dispatch.d.ts +21 -4
  101. package/dist/modes/interactive/key-dispatch.js +60 -8
  102. package/dist/modes/interactive/line/line-mode.js +5 -0
  103. package/dist/modes/interactive/run-indicator.d.ts +15 -0
  104. package/dist/modes/interactive/run-indicator.js +37 -5
  105. package/dist/modes/interactive/session-events.js +5 -1
  106. package/dist/modes/interactive/startup-header.d.ts +29 -14
  107. package/dist/modes/interactive/startup-header.js +93 -59
  108. package/dist/modes/interactive/startup-logo.d.ts +83 -0
  109. package/dist/modes/interactive/startup-logo.js +183 -0
  110. package/dist/modes/interactive/status-area.d.ts +18 -0
  111. package/dist/modes/interactive/status-area.js +67 -1
  112. package/dist/modes/interactive/status-bar.d.ts +9 -1
  113. package/dist/modes/interactive/status-bar.js +43 -11
  114. package/dist/modes/interactive/status-line.d.ts +2 -0
  115. package/dist/modes/interactive/status-line.js +11 -6
  116. package/dist/modes/interactive/status-quota.d.ts +44 -0
  117. package/dist/modes/interactive/status-quota.js +135 -0
  118. package/dist/modes/interactive/subagent-view.d.ts +1 -0
  119. package/dist/modes/interactive/subagent-view.js +8 -0
  120. package/dist/modes/interactive/task-background.d.ts +31 -0
  121. package/dist/modes/interactive/task-background.js +68 -0
  122. package/dist/modes/interactive/tool-view.d.ts +7 -1
  123. package/dist/modes/interactive/tool-view.js +24 -1
  124. package/dist/modes/print/print-mode.d.ts +11 -0
  125. package/dist/modes/print/print-mode.js +36 -1
  126. package/dist/modes/rpc/commands.d.ts +2 -1
  127. package/dist/modes/rpc/commands.js +9 -1
  128. package/dist/rpc.d.ts +13 -0
  129. package/dist/rpc.js +3 -0
  130. package/dist/tools/task-ctl.d.ts +2 -0
  131. package/dist/tools/task-ctl.js +7 -2
  132. package/dist/tools/task.d.ts +11 -0
  133. package/dist/tools/task.js +20 -2
  134. package/dist/tui/components/editor.d.ts +2 -0
  135. package/dist/tui/components/editor.js +4 -0
  136. package/dist/tui/components/loader.d.ts +5 -1
  137. package/dist/tui/components/loader.js +18 -5
  138. package/dist/tui/keybindings.d.ts +8 -3
  139. package/dist/tui/keybindings.js +8 -3
  140. package/docs/agents.md +52 -28
  141. package/docs/en/host-api.md +5 -1
  142. package/docs/en/providers.md +8 -4
  143. package/docs/en/rpc.md +19 -7
  144. package/docs/en/sessions.md +3 -1
  145. package/docs/en/tui.md +84 -66
  146. package/docs/host-api.md +5 -1
  147. package/docs/providers.md +29 -12
  148. package/docs/rpc.md +19 -7
  149. package/docs/sessions.md +2 -1
  150. package/docs/tui-design.md +42 -29
  151. package/docs/tui.md +67 -49
  152. package/package.json +1 -1
package/dist/git/info.js CHANGED
@@ -7,13 +7,16 @@
7
7
  * `GIT_OPTIONAL_LOCKS=0`;两次之间 ≥ `minIntervalMs`(缺省 10 s),超过 `timeoutMs`(缺省 2 s)或
8
8
  * 非零退出 / 起不来就省略增删项,并在本实例(本会话)停用 numstat,HEAD 仍照常显示。
9
9
  * `AMA_STATUS_GIT=0` 直接关闭 numstat(排错用)。
10
+ * - [W6] 领先 / 落后上游:当前分支在 git 配置里有 `branch.<名>.merge`(零依赖读 config,不起进程判断)时,
11
+ * numstat 之后同一节流周期再跑 `git rev-list --left-right --count @{upstream}...HEAD`(同样的超时与环境);
12
+ * 没有上游、detached、非零退出就省略;超时则本会话不再统计领先 / 落后。`AMA_STATUS_GIT=0` 同样关闭。
10
13
  * - 非 git 目录 `current()` 为 undefined(状态行整段省略)。
11
14
  * - `refresh()` 在回合边界调用(agent_settled、写类工具结束、回滚、/tree),只发起读取、不阻塞;
12
15
  * 结果有变化时通知 `onChange` 的监听者。
13
16
  */
14
17
  import { spawn as nodeSpawn } from "node:child_process";
15
18
  import { readFile } from "node:fs/promises";
16
- import { join } from "node:path";
19
+ import { isAbsolute, join, resolve } from "node:path";
17
20
  import { findGitDir, readGitHead } from "../checkpoints/git-head.js";
18
21
  export const GIT_NUMSTAT_INTERVAL_MS = 10_000;
19
22
  export const GIT_NUMSTAT_TIMEOUT_MS = 2_000;
@@ -30,6 +33,32 @@ export function parseNumstat(text) {
30
33
  }
31
34
  return { insertions, deletions };
32
35
  }
36
+ /** `git rev-list --left-right --count @{upstream}...HEAD` 的输出:左(上游独有)= 落后,右 = 领先。 */
37
+ export function parseLeftRight(text) {
38
+ const match = /^\s*(\d+)\s+(\d+)\s*$/.exec(text);
39
+ return match === null ? undefined : { behind: Number(match[1]), ahead: Number(match[2]) };
40
+ }
41
+ /** 分支在 git 配置里有没有上游(`[branch "<名>"]` 段里的 `merge`);worktree 读主仓库的 config。 */
42
+ export async function hasUpstream(cwd, branch) {
43
+ const gitDir = await findGitDir(cwd);
44
+ if (gitDir === undefined)
45
+ return false;
46
+ const common = (await readFile(join(gitDir, "commondir"), "utf8").catch(() => undefined))?.trim();
47
+ const dir = common === undefined ? gitDir : isAbsolute(common) ? common : resolve(gitDir, common);
48
+ const text = await readFile(join(dir, "config"), "utf8").catch(() => "");
49
+ let inBranch = false;
50
+ for (const raw of text.split("\n")) {
51
+ const line = raw.trim();
52
+ const section = /^\[\s*([^\]\s"]+)(?:\s+"((?:[^"\\]|\\.)*)")?\s*\]/.exec(line);
53
+ if (section !== null) {
54
+ inBranch = section[1]?.toLowerCase() === "branch" && section[2] === branch;
55
+ continue;
56
+ }
57
+ if (inBranch && /^merge\s*=\s*\S/i.test(line))
58
+ return true;
59
+ }
60
+ return false;
61
+ }
33
62
  async function readHead(cwd) {
34
63
  const head = await readGitHead(cwd);
35
64
  if (head !== undefined) {
@@ -50,6 +79,8 @@ const sameInfo = (a, b) => a?.branch === b?.branch &&
50
79
  a?.shortHead === b?.shortHead &&
51
80
  a?.insertions === b?.insertions &&
52
81
  a?.deletions === b?.deletions &&
82
+ a?.ahead === b?.ahead &&
83
+ a?.behind === b?.behind &&
53
84
  (a === undefined) === (b === undefined);
54
85
  export class GitInfoWatcher {
55
86
  cwd;
@@ -67,6 +98,8 @@ export class GitInfoWatcher {
67
98
  headAgain = false;
68
99
  disposed = false;
69
100
  diff;
101
+ upstream;
102
+ upstreamDisabled;
70
103
  constructor(cwd, deps = {}) {
71
104
  this.cwd = cwd;
72
105
  this.spawn = deps.spawn ?? ((command, args, options) => nodeSpawn(command, args, options));
@@ -75,6 +108,7 @@ export class GitInfoWatcher {
75
108
  this.timeoutMs = deps.timeoutMs ?? GIT_NUMSTAT_TIMEOUT_MS;
76
109
  this.env = deps.env ?? process.env;
77
110
  this.numstatDisabled = this.env["AMA_STATUS_GIT"] === "0";
111
+ this.upstreamDisabled = this.numstatDisabled;
78
112
  }
79
113
  current() {
80
114
  return this.info;
@@ -118,6 +152,7 @@ export class GitInfoWatcher {
118
152
  : {
119
153
  ...head,
120
154
  ...(this.diff !== undefined && head.shortHead !== undefined ? this.diff : {}),
155
+ ...(this.upstream !== undefined && head.branch !== undefined ? this.upstream : {}),
121
156
  };
122
157
  if (sameInfo(this.info, next))
123
158
  return;
@@ -135,8 +170,7 @@ export class GitInfoWatcher {
135
170
  return Promise.resolve();
136
171
  this.lastNumstatAt = at;
137
172
  this.numstatRunning = true;
138
- return this.numstat().then((diff) => {
139
- this.numstatRunning = false;
173
+ return this.numstat().then(async (diff) => {
140
174
  if (this.disposed)
141
175
  return;
142
176
  if (diff === undefined) {
@@ -145,14 +179,36 @@ export class GitInfoWatcher {
145
179
  }
146
180
  else
147
181
  this.diff = diff;
182
+ await this.leftRight();
183
+ this.numstatRunning = false;
184
+ if (this.disposed)
185
+ return;
148
186
  const info = this.info;
149
187
  if (info === undefined)
150
188
  return;
151
- const { insertions: _i, deletions: _d, ...head } = info;
189
+ const { insertions: _i, deletions: _d, ahead: _a, behind: _b, ...head } = info;
152
190
  this.update(head);
153
191
  });
154
192
  }
155
- numstat() {
193
+ /** 领先 / 落后上游:只在配置里有上游时起进程;超时本会话停用,非零退出只省略这一次。 */
194
+ async leftRight() {
195
+ const branch = this.info?.branch;
196
+ if (this.upstreamDisabled || branch === undefined || !(await hasUpstream(this.cwd, branch))) {
197
+ this.upstream = undefined;
198
+ return;
199
+ }
200
+ const result = await this.run(["rev-list", "--left-right", "--count", "@{upstream}...HEAD"]);
201
+ if (result === "timeout")
202
+ this.upstreamDisabled = true;
203
+ this.upstream =
204
+ typeof result === "object" && result.code === 0 ? parseLeftRight(result.out) : undefined;
205
+ }
206
+ async numstat() {
207
+ const result = await this.run(["diff", "--numstat", "HEAD"]);
208
+ return typeof result === "object" && result.code === 0 ? parseNumstat(result.out) : undefined;
209
+ }
210
+ /** 后台起一次 git;起不来为 undefined,超时杀掉并返回 `"timeout"`。 */
211
+ run(args) {
156
212
  return new Promise((resolve) => {
157
213
  let settled = false;
158
214
  let timer;
@@ -165,7 +221,7 @@ export class GitInfoWatcher {
165
221
  };
166
222
  let child;
167
223
  try {
168
- child = this.spawn("git", ["diff", "--numstat", "HEAD"], {
224
+ child = this.spawn("git", args, {
169
225
  cwd: this.cwd,
170
226
  env: { ...this.env, GIT_OPTIONAL_LOCKS: "0" },
171
227
  });
@@ -176,7 +232,7 @@ export class GitInfoWatcher {
176
232
  }
177
233
  timer = setTimeout(() => {
178
234
  child.kill("SIGKILL");
179
- done(undefined);
235
+ done("timeout");
180
236
  }, this.timeoutMs);
181
237
  timer.unref?.();
182
238
  let out = "";
@@ -185,7 +241,7 @@ export class GitInfoWatcher {
185
241
  out += String(chunk);
186
242
  });
187
243
  child.on("error", () => done(undefined));
188
- child.on("close", (code) => done(code === 0 ? parseNumstat(out) : undefined));
244
+ child.on("close", (code) => done({ code, out }));
189
245
  });
190
246
  }
191
247
  }
@@ -447,6 +447,8 @@ declare const en: {
447
447
  listFailed: (provider: string, error: string) => string;
448
448
  found: (provider: string, count: number, url: string) => string;
449
449
  unmatched: string;
450
+ fromBackend: string;
451
+ noBackendWindow: (ids: string) => string;
450
452
  image: string;
451
453
  reasoning: string;
452
454
  noTools: string;
@@ -535,6 +537,17 @@ declare const en: {
535
537
  cacheSilent: string;
536
538
  sandbox: string;
537
539
  cycleHint: string;
540
+ quota: {
541
+ session: string;
542
+ reset: string;
543
+ weekly: string;
544
+ weeklyReset: string;
545
+ window: (duration: string) => string;
546
+ windowReset: (duration: string) => string;
547
+ short5h: string;
548
+ shortWeek: string;
549
+ pending: string;
550
+ };
538
551
  };
539
552
  subagent: {
540
553
  running: (elapsed: string) => string;
@@ -633,16 +646,8 @@ declare const en: {
633
646
  templates: (n: number) => string;
634
647
  host: (host: string) => string;
635
648
  warnings: (n: number) => string;
636
- hintCompact: string;
637
- keyModel: string;
638
- keyDir: string;
639
- keyMode: string;
640
- keyLoaded: string;
641
- keyHost: string;
642
- keyWarnings: string;
643
649
  thinking: (level: string) => string;
644
650
  preset: (preset: string) => string;
645
- warningsValue: (n: number) => string;
646
651
  hint: string;
647
652
  };
648
653
  ui: {
@@ -1249,6 +1254,7 @@ declare const en: {
1249
1254
  needsPrompt: string;
1250
1255
  retry: (attempt: number, max: number, seconds: number, error: string) => string;
1251
1256
  modelFailed: string;
1257
+ waitingTasks: (n: number) => string;
1252
1258
  planPending: (version: number, where: string) => string;
1253
1259
  limitTurns: (limit: number) => string;
1254
1260
  limitCost: (limit: string, spent: string) => string;
@@ -1257,6 +1263,7 @@ declare const en: {
1257
1263
  rpc: {
1258
1264
  unknownCommand: (type: string) => string;
1259
1265
  parseFailed: (error: string) => string;
1266
+ badTaskId: string;
1260
1267
  missingType: string;
1261
1268
  unsupported: string;
1262
1269
  noPlan: string;
@@ -1325,6 +1332,7 @@ declare const en: {
1325
1332
  "ui.quietStartup": string;
1326
1333
  "ui.ascii": string;
1327
1334
  "ui.compact": string;
1335
+ "ui.logo": string;
1328
1336
  "ui.animation": string;
1329
1337
  "ui.restoreOnCancel": string;
1330
1338
  "ui.statusLine": string;
@@ -1344,6 +1352,7 @@ declare const en: {
1344
1352
  "auth.chatgpt.clientId": string;
1345
1353
  "auth.chatgpt.issuer": string;
1346
1354
  "auth.chatgpt.originator": string;
1355
+ "auth.chatgpt.codexClientVersion": string;
1347
1356
  "auth.chatgpt.redirectPorts": string;
1348
1357
  skills: string;
1349
1358
  "skills.dirs": string;
@@ -1380,6 +1389,8 @@ declare const en: {
1380
1389
  "subagents.maxConcurrent": string;
1381
1390
  "subagents.maxPending": string;
1382
1391
  "subagents.defaultModel": string;
1392
+ "subagents.background": string;
1393
+ "subagents.autoBackgroundAfterMs": string;
1383
1394
  models: string;
1384
1395
  "models.aliases": string;
1385
1396
  "models.aliases.fast": string;
@@ -1736,7 +1747,31 @@ declare const en: {
1736
1747
  bar: {
1737
1748
  more: (n: number) => string;
1738
1749
  keys: (up: string, down: string) => string;
1750
+ keysFull: (up: string, down: string) => string;
1739
1751
  empty: string;
1752
+ runHint: (down: string) => string;
1753
+ };
1754
+ focus: {
1755
+ busyInput: (down: string) => string;
1756
+ disabled: string;
1757
+ };
1758
+ background: {
1759
+ done: (ids: string) => string;
1760
+ none: string;
1761
+ notForeground: (taskId: string) => string;
1762
+ runHint: (key: string) => string;
1763
+ timeout: (taskId: string, agent: string) => string;
1764
+ host: (taskId: string, agent: string) => string;
1765
+ moved: (elapsed: string) => string;
1766
+ started: string;
1767
+ interrupted: (ids: string) => string;
1768
+ };
1769
+ stop: {
1770
+ confirm: (taskId: string) => string;
1771
+ ended: (taskId: string) => string;
1772
+ };
1773
+ approval: {
1774
+ runHint: (down: string) => string;
1740
1775
  };
1741
1776
  view: {
1742
1777
  back: string;
@@ -1974,6 +2009,12 @@ declare const en: {
1974
2009
  freePlanHint: (plan: string) => string;
1975
2010
  modelHint: string;
1976
2011
  modelsCached: (count: number) => string;
2012
+ siwcEligibilityHint: string;
2013
+ codexNoModels: (version: string) => string;
2014
+ };
2015
+ request: {
2016
+ notEligible: string;
2017
+ flavorMismatch: (current: string, ref: string, pinned: string) => string;
1977
2018
  };
1978
2019
  errors: {
1979
2020
  portsBusy: (ports: string, codex: boolean) => string;
@@ -2043,6 +2084,7 @@ declare const en: {
2043
2084
  "ui.showThinking": string;
2044
2085
  "ui.compact": string;
2045
2086
  "ui.animation": string;
2087
+ "ui.logo": string;
2046
2088
  "ui.statusLine": string;
2047
2089
  "ui.restoreOnCancel": string;
2048
2090
  "ui.quietStartup": string;
@@ -2102,6 +2144,8 @@ declare const en: {
2102
2144
  "agents.sessionBudgetUsd": string;
2103
2145
  "subagents.maxConcurrent": string;
2104
2146
  "subagents.maxPending": string;
2147
+ "subagents.background": string;
2148
+ "subagents.autoBackgroundAfterMs": string;
2105
2149
  "memory.enabled": string;
2106
2150
  "memory.subagents": string;
2107
2151
  };
@@ -5,6 +5,8 @@
5
5
  * 整句一个键、禁止片段拼接;插值写成函数,条件分支写进函数体。
6
6
  *
7
7
  * W6-A:Agent 栏(状态、轮数、溢出行、按键提示)与子 Agent 视图(标题、占位、发送结果、外部 Agent 的说明)。
8
+ * W7-A:进栏键落空提示、运行提示行的进栏附加项。
9
+ * W7-C:转后台(Ctrl+B / 栏内 b / `/tasks bg`)、栏内 x 双击停止、停靠审批的提示、Esc 不影响后台任务。
8
10
  */
9
11
  export declare const en: {
10
12
  status: {
@@ -21,7 +23,37 @@ export declare const en: {
21
23
  bar: {
22
24
  more: (n: number) => string;
23
25
  keys: (up: string, down: string) => string;
26
+ /** [W7-C] 聚焦时的完整按键行(窄屏退回 `keys`)。 */
27
+ keysFull: (up: string, down: string) => string;
24
28
  empty: string;
29
+ /** [W7-A] 运行提示行的附加项(有子 Agent 任务时)。 */
30
+ runHint: (down: string) => string;
31
+ };
32
+ /** [W7-A] 进栏键落空时的一行提示。 */
33
+ focus: {
34
+ busyInput: (down: string) => string;
35
+ disabled: string;
36
+ };
37
+ /** [W7-C] 前台任务转后台。 */
38
+ background: {
39
+ done: (ids: string) => string;
40
+ none: string;
41
+ notForeground: (taskId: string) => string;
42
+ runHint: (key: string) => string;
43
+ timeout: (taskId: string, agent: string) => string;
44
+ host: (taskId: string, agent: string) => string;
45
+ moved: (elapsed: string) => string;
46
+ started: string;
47
+ interrupted: (ids: string) => string;
48
+ };
49
+ /** [W7-C] 栏内 x 停止(双击确认)。 */
50
+ stop: {
51
+ confirm: (taskId: string) => string;
52
+ ended: (taskId: string) => string;
53
+ };
54
+ /** [W7-C] 后台任务的审批停靠在栏里。 */
55
+ approval: {
56
+ runHint: (down: string) => string;
25
57
  };
26
58
  view: {
27
59
  back: string;
@@ -59,7 +91,31 @@ export declare const zh: {
59
91
  bar: {
60
92
  more: (n: number) => string;
61
93
  keys: (up: string, down: string) => string;
94
+ keysFull: (up: string, down: string) => string;
62
95
  empty: string;
96
+ runHint: (down: string) => string;
97
+ };
98
+ focus: {
99
+ busyInput: (down: string) => string;
100
+ disabled: string;
101
+ };
102
+ background: {
103
+ done: (ids: string) => string;
104
+ none: string;
105
+ notForeground: (taskId: string) => string;
106
+ runHint: (key: string) => string;
107
+ timeout: (taskId: string, agent: string) => string;
108
+ host: (taskId: string, agent: string) => string;
109
+ moved: (elapsed: string) => string;
110
+ started: string;
111
+ interrupted: (ids: string) => string;
112
+ };
113
+ stop: {
114
+ confirm: (taskId: string) => string;
115
+ ended: (taskId: string) => string;
116
+ };
117
+ approval: {
118
+ runHint: (down: string) => string;
63
119
  };
64
120
  view: {
65
121
  back: string;
@@ -5,6 +5,8 @@
5
5
  * 整句一个键、禁止片段拼接;插值写成函数,条件分支写进函数体。
6
6
  *
7
7
  * W6-A:Agent 栏(状态、轮数、溢出行、按键提示)与子 Agent 视图(标题、占位、发送结果、外部 Agent 的说明)。
8
+ * W7-A:进栏键落空提示、运行提示行的进栏附加项。
9
+ * W7-C:转后台(Ctrl+B / 栏内 b / `/tasks bg`)、栏内 x 双击停止、停靠审批的提示、Esc 不影响后台任务。
8
10
  */
9
11
  import { plural } from "../format.js";
10
12
  export const en = {
@@ -22,7 +24,37 @@ export const en = {
22
24
  bar: {
23
25
  more: (n) => `${n} more`,
24
26
  keys: (up, down) => `${up}${down} select · Enter open · Esc back`,
27
+ /** [W7-C] 聚焦时的完整按键行(窄屏退回 `keys`)。 */
28
+ keysFull: (up, down) => `${up}${down} select · Enter open · b background · x stop · Esc back`,
25
29
  empty: "No sub-agent tasks yet",
30
+ /** [W7-A] 运行提示行的附加项(有子 Agent 任务时)。 */
31
+ runHint: (down) => `${down} Agent bar`,
32
+ },
33
+ /** [W7-A] 进栏键落空时的一行提示。 */
34
+ focus: {
35
+ busyInput: (down) => `Input is not empty; clear it and press ${down} for the Agent bar`,
36
+ disabled: "Agent bar is off (ui.agentBar); use /tasks",
37
+ },
38
+ /** [W7-C] 前台任务转后台。 */
39
+ background: {
40
+ done: (ids) => `Moved to the background: ${ids}; you'll be notified when it finishes`,
41
+ none: "No foreground task to move to the background",
42
+ notForeground: (taskId) => `${taskId} is not a running foreground task`,
43
+ runHint: (key) => `${key} to background`,
44
+ timeout: (taskId, agent) => `${taskId} ${agent} ran long and moved to the background (subagents.autoBackgroundAfterMs)`,
45
+ host: (taskId, agent) => `${taskId} ${agent} was moved to the background by the host`,
46
+ moved: (elapsed) => `moved to the background · ${elapsed}`,
47
+ started: "started in the background",
48
+ interrupted: (ids) => `Interrupted (background task ${ids} keeps running; Esc doesn't affect it)`,
49
+ },
50
+ /** [W7-C] 栏内 x 停止(双击确认)。 */
51
+ stop: {
52
+ confirm: (taskId) => `Press x again to stop ${taskId}`,
53
+ ended: (taskId) => `${taskId} has already finished`,
54
+ },
55
+ /** [W7-C] 后台任务的审批停靠在栏里。 */
56
+ approval: {
57
+ runHint: (down) => `${down} handle approval`,
26
58
  },
27
59
  view: {
28
60
  back: "Esc back",
@@ -34,7 +66,7 @@ export const en = {
34
66
  resumed: (taskId) => `Sent to ${taskId}; it continues in the background`,
35
67
  sendFailed: (message) => `Could not send: ${message}`,
36
68
  stopped: (taskId) => `Stopped ${taskId}`,
37
- commandsHere: "Only /tasks stop works here; press Esc to go back for other commands",
69
+ commandsHere: "Only /tasks stop and /tasks bg work here; press Esc to go back for other commands",
38
70
  removed: (taskId) => `Task ${taskId} is gone`,
39
71
  unknown: (taskId) => `No task ${taskId}`,
40
72
  turn: (n) => `turn ${n}`,
@@ -60,7 +92,31 @@ export const zh = {
60
92
  bar: {
61
93
  more: (n) => `另 ${n} 个`,
62
94
  keys: (up, down) => `${up}${down} 选择 · Enter 打开 · Esc 返回`,
95
+ keysFull: (up, down) => `${up}${down} 选择 · Enter 打开 · b 转后台 · x 停止 · Esc 返回`,
63
96
  empty: "还没有子 Agent 任务",
97
+ runHint: (down) => `${down} Agent 栏`,
98
+ },
99
+ focus: {
100
+ busyInput: (down) => `输入框有字;清空后再按 ${down} 进 Agent 栏`,
101
+ disabled: "Agent 栏已关闭(ui.agentBar),用 /tasks",
102
+ },
103
+ background: {
104
+ done: (ids) => `已转后台:${ids},完成后会通知`,
105
+ none: "没有可转后台的前台任务",
106
+ notForeground: (taskId) => `${taskId} 不是运行中的前台任务`,
107
+ runHint: (key) => `${key} 转后台`,
108
+ timeout: (taskId, agent) => `${taskId} ${agent} 运行较久,已自动转后台(subagents.autoBackgroundAfterMs)`,
109
+ host: (taskId, agent) => `${taskId} ${agent} 已由宿主转后台`,
110
+ moved: (elapsed) => `已转后台 · ${elapsed}`,
111
+ started: "已在后台启动",
112
+ interrupted: (ids) => `已中断(后台任务 ${ids} 仍在运行,Esc 不影响)`,
113
+ },
114
+ stop: {
115
+ confirm: (taskId) => `再按 x 停止 ${taskId}`,
116
+ ended: (taskId) => `${taskId} 已结束`,
117
+ },
118
+ approval: {
119
+ runHint: (down) => `${down} 处理审批`,
64
120
  },
65
121
  view: {
66
122
  back: "Esc 返回",
@@ -72,7 +128,7 @@ export const zh = {
72
128
  resumed: (taskId) => `已发给 ${taskId},在后台继续`,
73
129
  sendFailed: (message) => `发送失败:${message}`,
74
130
  stopped: (taskId) => `已停止 ${taskId}`,
75
- commandsHere: "这里只能用 /tasks stop;其它命令按 Esc 返回后输入",
131
+ commandsHere: "这里只能用 /tasks stop 与 /tasks bg;其它命令按 Esc 返回后输入",
76
132
  removed: (taskId) => `任务 ${taskId} 已不存在`,
77
133
  unknown: (taskId) => `没有任务 ${taskId}`,
78
134
  turn: (n) => `第 ${n} 轮`,
@@ -46,6 +46,12 @@ export declare const en: {
46
46
  freePlanHint: (plan: string) => string;
47
47
  modelHint: string;
48
48
  modelsCached: (count: number) => string;
49
+ siwcEligibilityHint: string;
50
+ codexNoModels: (version: string) => string;
51
+ };
52
+ request: {
53
+ notEligible: string;
54
+ flavorMismatch: (current: string, ref: string, pinned: string) => string;
49
55
  };
50
56
  errors: {
51
57
  portsBusy: (ports: string, codex: boolean) => string;
@@ -137,6 +143,12 @@ export declare const zh: {
137
143
  freePlanHint: (plan: string) => string;
138
144
  modelHint: string;
139
145
  modelsCached: (count: number) => string;
146
+ siwcEligibilityHint: string;
147
+ codexNoModels: (version: string) => string;
148
+ };
149
+ request: {
150
+ notEligible: string;
151
+ flavorMismatch: (current: string, ref: string, pinned: string) => string;
140
152
  };
141
153
  errors: {
142
154
  portsBusy: (ports: string, codex: boolean) => string;
@@ -47,6 +47,16 @@ export const en = {
47
47
  freePlanHint: (plan) => `Note: the "${plan}" plan may not include subscription usage for ama.`,
48
48
  modelHint: "Use it with --model chatgpt/<model>; list the models your account can use with ama models discover chatgpt.",
49
49
  modelsCached: (count) => `Your account can use ${count} model(s); pick one with /model or --model chatgpt/<model>.`,
50
+ siwcEligibilityHint: "Whether this account can share its plan usage with ama is only confirmed on the first request.",
51
+ codexNoModels: (version) => `The codex backend returned no models. codexClientVersion (${version}) may be too old: set a newer Codex CLI version with ama config set auth.chatgpt.codexClientVersion <version>, then run ama models discover chatgpt.`,
52
+ },
53
+ request: {
54
+ notEligible: "this ChatGPT account cannot share plan usage with ama (403 subscription_sharing_user_not_eligible). Possible causes:\n" +
55
+ " 1. Plan: plan usage is shared with Plus / Pro only\n" +
56
+ " 2. Workspace account: Team / Enterprise / Edu workspaces may not offer it\n" +
57
+ " 3. Region restriction, or not yet rolled out during the preview (most likely when a Pro account still gets this error)\n" +
58
+ "You can sign in the other way instead: ama auth login chatgpt --flavor codex",
59
+ flavorMismatch: (current, ref, pinned) => `signed in with ${current}, but ${ref} pins the @${pinned} channel. Drop @${pinned} so the channel follows the sign-in, or run ama auth login chatgpt --flavor ${pinned}`,
50
60
  },
51
61
  errors: {
52
62
  portsBusy: (ports, codex) => `callback port ${ports} is in use: finish the other sign-in first, or use --paste${codex ? " / --device" : ""}`,
@@ -145,6 +155,16 @@ export const zh = {
145
155
  freePlanHint: (plan) => `注意:「${plan}」计划可能不含给 ama 用的订阅额度。`,
146
156
  modelHint: "用 --model chatgpt/<模型> 使用;账户可用的模型用 ama models discover chatgpt 查看。",
147
157
  modelsCached: (count) => `账户可用 ${count} 个模型,用 /model 或 --model chatgpt/<模型> 选择。`,
158
+ siwcEligibilityHint: "这个账户能否把套餐额度共享给 ama,要到首次请求时才能确认。",
159
+ codexNoModels: (version) => `codex 后端没有返回模型,可能是 codexClientVersion(${version})过旧:用 ama config set auth.chatgpt.codexClientVersion <版本> 设为较新的 Codex CLI 版本,再运行 ama models discover chatgpt。`,
160
+ },
161
+ request: {
162
+ notEligible: "这个 ChatGPT 账户不能把套餐额度共享给 ama(403 subscription_sharing_user_not_eligible)。可能的原因:\n" +
163
+ " 1. 账户套餐:额度共享只对 Plus / Pro 开放\n" +
164
+ " 2. 工作空间账户:Team / Enterprise / Edu 工作空间可能未开放\n" +
165
+ " 3. 地区受限,或预览期尚未开放(Pro 账户仍报此错时最可能是这一条)\n" +
166
+ "可以改用另一种登录方式:ama auth login chatgpt --flavor codex",
167
+ flavorMismatch: (current, ref, pinned) => `当前以 ${current} 方式登录,但 ${ref} 显式指定了 @${pinned} 渠道。去掉 @${pinned} 让渠道跟随登录方式,或运行 ama auth login chatgpt --flavor ${pinned}`,
148
168
  },
149
169
  errors: {
150
170
  portsBusy: (ports, codex) => `回调端口 ${ports} 被占用:请先结束其它登录,或用 --paste${codex ? " / --device" : ""}`,
@@ -52,6 +52,7 @@ export declare const en: {
52
52
  "ui.quietStartup": string;
53
53
  "ui.ascii": string;
54
54
  "ui.compact": string;
55
+ "ui.logo": string;
55
56
  "ui.animation": string;
56
57
  "ui.restoreOnCancel": string;
57
58
  "ui.statusLine": string;
@@ -71,6 +72,7 @@ export declare const en: {
71
72
  "auth.chatgpt.clientId": string;
72
73
  "auth.chatgpt.issuer": string;
73
74
  "auth.chatgpt.originator": string;
75
+ "auth.chatgpt.codexClientVersion": string;
74
76
  "auth.chatgpt.redirectPorts": string;
75
77
  skills: string;
76
78
  "skills.dirs": string;
@@ -107,6 +109,8 @@ export declare const en: {
107
109
  "subagents.maxConcurrent": string;
108
110
  "subagents.maxPending": string;
109
111
  "subagents.defaultModel": string;
112
+ "subagents.background": string;
113
+ "subagents.autoBackgroundAfterMs": string;
110
114
  models: string;
111
115
  "models.aliases": string;
112
116
  "models.aliases.fast": string;
@@ -195,6 +199,7 @@ export declare const zh: {
195
199
  "ui.quietStartup": string;
196
200
  "ui.ascii": string;
197
201
  "ui.compact": string;
202
+ "ui.logo": string;
198
203
  "ui.animation": string;
199
204
  "ui.restoreOnCancel": string;
200
205
  "ui.statusLine": string;
@@ -214,6 +219,7 @@ export declare const zh: {
214
219
  "auth.chatgpt.clientId": string;
215
220
  "auth.chatgpt.issuer": string;
216
221
  "auth.chatgpt.originator": string;
222
+ "auth.chatgpt.codexClientVersion": string;
217
223
  "auth.chatgpt.redirectPorts": string;
218
224
  skills: string;
219
225
  "skills.dirs": string;
@@ -250,6 +256,8 @@ export declare const zh: {
250
256
  "subagents.maxConcurrent": string;
251
257
  "subagents.maxPending": string;
252
258
  "subagents.defaultModel": string;
259
+ "subagents.background": string;
260
+ "subagents.autoBackgroundAfterMs": string;
253
261
  models: string;
254
262
  "models.aliases": string;
255
263
  "models.aliases.fast": string;