@aragon-agent/cli 0.6.11 → 0.6.13

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 (115) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/README.md +97 -20
  3. package/dist/agent/controller.d.ts +38 -3
  4. package/dist/agent/controller.js +151 -60
  5. package/dist/agent/model-profile-settings.d.ts +31 -0
  6. package/dist/agent/model-profile-settings.js +199 -0
  7. package/dist/agent/queued-messages.d.ts +20 -0
  8. package/dist/agent/queued-messages.js +46 -0
  9. package/dist/agent/reducer.d.ts +21 -2
  10. package/dist/agent/reducer.js +65 -37
  11. package/dist/cli.js +15 -1
  12. package/dist/commands/builtins.js +83 -42
  13. package/dist/commands/queue-command.d.ts +3 -0
  14. package/dist/commands/queue-command.js +5 -0
  15. package/dist/commands/registry.d.ts +3 -0
  16. package/dist/compaction/child.d.ts +4 -2
  17. package/dist/compaction/child.js +4 -1
  18. package/dist/compaction/compactor.d.ts +7 -2
  19. package/dist/compaction/compactor.js +13 -11
  20. package/dist/compaction/context-command.js +5 -0
  21. package/dist/compaction/wiring.d.ts +4 -3
  22. package/dist/compaction/wiring.js +6 -1
  23. package/dist/config/cli-commands.d.ts +2 -0
  24. package/dist/config/cli-commands.js +16 -4
  25. package/dist/config/load.d.ts +2 -1
  26. package/dist/config/load.js +15 -8
  27. package/dist/config/model-profile-resolution.d.ts +20 -0
  28. package/dist/config/model-profile-resolution.js +81 -0
  29. package/dist/config/model-profile-store.d.ts +67 -0
  30. package/dist/config/model-profile-store.js +153 -0
  31. package/dist/config/model-profiles.d.ts +44 -0
  32. package/dist/config/model-profiles.js +121 -0
  33. package/dist/config/schema.d.ts +9 -0
  34. package/dist/config/store.d.ts +11 -1
  35. package/dist/config/store.js +43 -27
  36. package/dist/fast/resolve.d.ts +2 -1
  37. package/dist/fast/resolve.js +6 -4
  38. package/dist/fast/wiring.d.ts +5 -3
  39. package/dist/fast/wiring.js +8 -4
  40. package/dist/input/enter-sequences.d.ts +11 -10
  41. package/dist/input/enter-sequences.js +29 -27
  42. package/dist/input/stdin-filter.js +93 -28
  43. package/dist/logging/install.d.ts +3 -0
  44. package/dist/logging/install.js +4 -2
  45. package/dist/logging/secret-registry.d.ts +2 -0
  46. package/dist/logging/secret-registry.js +18 -0
  47. package/dist/session/persist.d.ts +6 -7
  48. package/dist/session/persist.js +6 -9
  49. package/dist/session/store.d.ts +4 -1
  50. package/dist/session/validate-session.d.ts +3 -0
  51. package/dist/session/validate-session.js +207 -0
  52. package/dist/team/runtime.d.ts +2 -1
  53. package/dist/team/subagent.d.ts +3 -1
  54. package/dist/team/subagent.js +3 -1
  55. package/dist/ui/ActivityLine.d.ts +6 -70
  56. package/dist/ui/ActivityLine.js +12 -34
  57. package/dist/ui/App.d.ts +1 -0
  58. package/dist/ui/App.js +161 -226
  59. package/dist/ui/BottomStatusRow.d.ts +6 -86
  60. package/dist/ui/BottomStatusRow.js +11 -26
  61. package/dist/ui/Composer.d.ts +18 -84
  62. package/dist/ui/Composer.js +9 -100
  63. package/dist/ui/PromptInput.d.ts +6 -2
  64. package/dist/ui/PromptInput.js +91 -105
  65. package/dist/ui/QueuePanel.d.ts +8 -0
  66. package/dist/ui/QueuePanel.js +9 -0
  67. package/dist/ui/QueueStatusRow.d.ts +24 -0
  68. package/dist/ui/QueueStatusRow.js +51 -0
  69. package/dist/ui/StatusBar.d.ts +15 -149
  70. package/dist/ui/StatusBar.js +27 -112
  71. package/dist/ui/clipboard-task.d.ts +29 -0
  72. package/dist/ui/clipboard-task.js +66 -0
  73. package/dist/ui/clipboard.d.ts +29 -50
  74. package/dist/ui/clipboard.js +141 -75
  75. package/dist/ui/composer-input.d.ts +28 -0
  76. package/dist/ui/composer-input.js +46 -0
  77. package/dist/ui/composer-limits.d.ts +3 -4
  78. package/dist/ui/composer-limits.js +4 -9
  79. package/dist/ui/composer-rows.d.ts +1 -1
  80. package/dist/ui/composer-rows.js +24 -137
  81. package/dist/ui/editor-navigation.d.ts +45 -0
  82. package/dist/ui/editor-navigation.js +85 -0
  83. package/dist/ui/editor-reducer.d.ts +9 -0
  84. package/dist/ui/editor-reducer.js +31 -15
  85. package/dist/ui/enter-frames.d.ts +15 -31
  86. package/dist/ui/enter-frames.js +14 -33
  87. package/dist/ui/interaction-copy.d.ts +77 -0
  88. package/dist/ui/interaction-copy.js +40 -0
  89. package/dist/ui/interaction-hints.d.ts +18 -0
  90. package/dist/ui/interaction-hints.js +92 -0
  91. package/dist/ui/layout/budget.js +1 -1
  92. package/dist/ui/layout/queue-layout.d.ts +19 -0
  93. package/dist/ui/layout/queue-layout.js +26 -0
  94. package/dist/ui/layout/status-layout.d.ts +55 -0
  95. package/dist/ui/layout/status-layout.js +109 -0
  96. package/dist/ui/layout/todo-layout.d.ts +1 -0
  97. package/dist/ui/layout/todo-layout.js +1 -1
  98. package/dist/ui/overlays/HelpOverlay.js +11 -3
  99. package/dist/ui/overlays/ModelProfileEditor.d.ts +12 -0
  100. package/dist/ui/overlays/ModelProfileEditor.js +103 -0
  101. package/dist/ui/overlays/ModelProfilePicker.d.ts +35 -0
  102. package/dist/ui/overlays/ModelProfilePicker.js +167 -0
  103. package/dist/ui/overlays/QueueOverlay.d.ts +22 -0
  104. package/dist/ui/overlays/QueueOverlay.js +79 -0
  105. package/dist/ui/overlays/SettingsScreen.d.ts +9 -2
  106. package/dist/ui/overlays/SettingsScreen.js +347 -3
  107. package/dist/ui/overlays/model-profile-state.d.ts +74 -0
  108. package/dist/ui/overlays/model-profile-state.js +119 -0
  109. package/dist/ui/run-status-row.d.ts +7 -19
  110. package/dist/ui/run-status-row.js +2 -18
  111. package/dist/ui/selection/selection-controller.d.ts +2 -2
  112. package/dist/ui/selection/selection-controller.js +58 -20
  113. package/dist/ui/transcript-text.js +20 -12
  114. package/dist/ui/use-wheel-routing.js +2 -1
  115. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -5,7 +5,16 @@ All notable changes to `@aragon-agent/cli` are documented here. Entries at
5
5
  — those releases really were published under that name, so they are left as they
6
6
  were written.
7
7
 
8
- ## Unreleased
8
+ ## Unreleased
9
+
10
+ ### TUI 输入与排队可靠性
11
+
12
+ - Shift+Enter 与粘贴按输入顺序处理;普通 Enter 保持弹层兼容,混合输入最多提交一次,
13
+ 余稿及拒绝提交的正文保留。结束输入流时完整排空,不泄漏内部控制标记。
14
+ - 超限粘贴拒绝同一外部输入块的正文和 Enter,避免误提交旧稿;未闭合粘贴继续按正文消费。
15
+ - 拖选后仅 Ctrl+C 复制;文字变化与丢失鼠标释放时取消无效高亮,避免卡住视口。
16
+ - 固定 Queue 状态行按消息 ID 回执更新,支持窄屏、暂停与多条消息计数。
17
+ - 保存和退出保留所有未发送全文;恢复先验证存档,旧 queued 作为警告展示且不自动重放。
9
18
 
10
19
  ### Removed
11
20
 
package/README.md CHANGED
@@ -432,8 +432,8 @@ completes, `Up` / `Down` moves the selection, `Esc` closes it.
432
432
 
433
433
  | Key | Action |
434
434
  | --- | --- |
435
- | `Enter` | Submit (idle) / queue a steering message (running) — shown as `Queue: …` until the agent picks it up |
436
- | `Ctrl+J` / `Alt+Enter` / `Shift+Enter` | Insert a newline. `Ctrl+J` and `Alt+Enter` work everywhere; a distinct `Shift+Enter` needs a one-line terminal binding — see [`/terminal-setup`](#terminal-setup) |
435
+ | `Enter` | 空闲时发送,运行时加入队列;收到 Core 已纳入会话的接收凭据后才移除 Queue 提示 |
436
+ | `Ctrl+J` / `Alt+Enter` / `Shift+Enter` | 插入换行。Ctrl+J 已通过输入链路测试;另外两种组合键需要宿主发送独立序列,Alt+Enter 可能被宿主拦截。参见 [终端设置](#terminal-setup-for-shiftenter) |
437
437
  | `Shift+Tab` | Toggle **plan mode** (`BUILD` <-> `PLAN`). Equivalent: `/plan`. On Windows this needs a console flag Node < 22.17 does not set; aragon sets it at startup — see [Requirements](#requirements) |
438
438
  | `Ctrl+P` | The same toggle, over a channel no Windows console can swallow. Use it if `Shift+Tab` does nothing |
439
439
  | `Esc` | Close an overlay or popup; otherwise ask for interruption confirmation. While idle, cancel pending auto-continuation |
@@ -452,7 +452,7 @@ completes, `Up` / `Down` moves the selection, `Esc` closes it.
452
452
  | `Alt/Ctrl+←` / `→` | Word-wise cursor jump |
453
453
  | `Ctrl+W`, `Alt+Backspace` | Delete the previous word |
454
454
  | `Ctrl+U` / `Ctrl+K` | Kill to line start / end |
455
- | `Up` / `Down` | Move between draft lines; recall prompt history at the edges |
455
+ | `Up` / `Down` | 按视觉行移动;空草稿或正在浏览历史时,才在边界召回历史,避免覆盖新草稿 |
456
456
  | Paste | Inserted as-is up to 6 lines / 400 chars; larger collapses to `[Pasted text #1 +15 lines]`, which deletes as one unit and expands in full when you send. `--no-paste` restores the pre-0.6.3 behaviour |
457
457
  | `?` | Open help (empty input) |
458
458
 
@@ -462,7 +462,7 @@ new output automatically; once you scroll away the status bar shows `↑N`, a sl
462
462
  scrollbar occupies the terminal's last column (including 40-column windows). Drag its thumb
463
463
  to move through history, or click the track to move one page. Messages, the team panel
464
464
  and the input area scroll together; typing or editing returns to the input without
465
- losing the draft. The fixed status row shows `PgDn down` while reading history.
465
+ losing the draft. The fixed status row reports the distance from the end while reading history.
466
466
  `PgDn` moves one page down; editing or submitting returns directly to the end.
467
467
 
468
468
  **The mouse wheel is a viewport gesture and nothing else.** Wherever the pointer
@@ -493,15 +493,14 @@ is what it used to do. Inline mode is unaffected either way.
493
493
 
494
494
  ## Terminal setup for Shift+Enter
495
495
 
496
- `Ctrl+J` and `Alt+Enter` insert a newline in every terminal with no setup. A
497
- dedicated `Shift+Enter` key needs the terminal to send the CSI-u sequence
498
- `\u001b[13;2u` instead of a plain `Enter` — run `/terminal-setup` inside aragon
499
- for copy-paste bindings per terminal:
496
+ 输入支持 `Ctrl+J`、`Alt+Enter` 和可独立编码的 `Shift+Enter` 换行。如果终端把
497
+ Shift+Enter 与 Enter 都发送为 CR,应用无法区分;请用 `/terminal-setup` 查看绑定,
498
+ 让 Shift+Enter 发送 `\u001b[13;2u`。合并到已有终端配置,不要覆盖其他快捷键;
499
+ 终端拦截某个组合键时可使用另外两种方式。参考绑定如下:
500
500
 
501
- - **Windows Terminal** — `settings.json`, `actions`:
502
- `{ "keys": "shift+enter", "command": { "action": "sendInput", "input": "\u001b[13;2u" } }`
501
+ - **Windows Terminal** — `settings.json` 的 `actions` 与 `keybindings` 分别定义动作和按键;完整示例见下文“输入、待处理队列与底部状态区”。
503
502
  - **VS Code integrated terminal** — `keybindings.json`:
504
- `{ "key": "shift+enter", "command": "workbench.action.terminal.sendSequence", "args": { "text": "\u001b[13;2u" } }`
503
+ `{ "key": "shift+enter", "command": "workbench.action.terminal.sendSequence", "when": "terminalFocus", "args": { "text": "\u001b[13;2u" } }`
505
504
  - **iTerm2** — Settings > Profiles > Keys > Key Mappings, `Shift+Enter` ->
506
505
  *Send Escape Sequence* `[13;2u`
507
506
  - **kitty / WezTerm / foot** — native once keyboard-enhancement mode is on
@@ -518,20 +517,29 @@ user-side binding reaches the same result for the one key that needs it.
518
517
 
519
518
  ## Queued messages while the agent runs
520
519
 
521
- Sending a message while a run is in flight **queues** it for the agent's next
522
- turn. The transcript shows the queue honestly:
520
+ Agent 运行中发送的消息会进入队列。输入框附近的独立 Queue 面板按顺序显示摘要,
521
+ 限高后显示隐藏条数;固定状态栏始终显示真实待处理总数,没有自动消失的时间限制。
522
+ 使用 `/queue` 分页查看所有消息的完整原文,未接收消息不会在普通转录中重复显示:
523
523
 
524
524
  ```
525
525
  ◷ Queue: also check the tests
526
526
  ```
527
527
 
528
- The row stays until Core actually accepts the message into the conversation —
529
- the next `turn_start` — at which point it is rewritten **in place** into the
530
- user message it became, followed by the answer. Interrupting the run does not
531
- clear it: the message really is still queued, and it will be picked up when
532
- you continue the session. Messages still queued when the session is saved are
533
- restored as `Queued but never sent: …` warnings, because the in-memory queue
534
- does not survive a restart.
528
+ 仅当 Core 将消息写入对话历史并发出对应消息 ID 的接收回执,Queue 状态才移除。
529
+ 这表示引擎已接管后续处理,不表示回答完成;`turn_start`、动画和提示超时都不能代替回执。
530
+ 相同正文的两次发送仍是两条消息。中断或失败后尚未接收的消息保留并标记暂停。
531
+ 窄屏优先保留运行状态、待处理数量和上下文;其他字段整项隐藏,不截断关键数值。
532
+ 快捷键集中在操作提示行,并随覆盖层、补全、选区和中断确认状态变化。
533
+
534
+ `/clear` 清转录和 TODO,但保留待接收队列。保存和退出会补回被清屏或保留环裁剪的
535
+ 未发送全文。恢复存档时,queued 一律成为 `Queued but never sent: ...` 警告,
536
+ 不会自动重发;需要发送时请复制正文重新提交。运行尚未退出时 `/reset`、`/resume`
537
+ 会拒绝切换,损坏存档在替换当前会话之前报错。
538
+
539
+ 应用捕获鼠标时,拖选只保留高亮,按 Ctrl+C 才复制;本次按键不会停止服务或退出。
540
+ 选中文字改变、滚轮、其他按键或关闭选区会取消高亮。`--no-mouse` 或宿主原生选择的
541
+ 选中即复制由终端设置控制。OSC 52 发送成功仅证明请求已发出,不保证远程终端剪贴板
542
+ 已写入;SSH/tmux 是否允许该请求需在实际环境中验证。
535
543
 
536
544
  ## Themes
537
545
 
@@ -2334,3 +2342,72 @@ UTF-16 编辑和 ZWJ/组合字形仍有既有限制,本次修复保证视觉
2334
2342
  检查流式输出不阻止闪烁;单 ESC 不停止任务,两击中断,卡住时第三击强停;菜单关闭不计入两击。
2335
2343
  任务结束后保留最终计划,下一条普通消息启动时旧计划消失,新有效计划出现才恢复;显式续跑保留计划。
2336
2344
  强停后立即提交,在等待中双 ESC 取消,旧引擎退出后不得自行执行已取消的消息。
2345
+
2346
+ ## 输入、待处理队列与底部状态区
2347
+
2348
+ Enter 在空闲时发送,运行时加入队列;启动阶段拒绝重复提交并保留草稿。
2349
+ Ctrl+J 换行;终端能发送独立序列时,Shift+Enter 与 Alt+Enter 也可换行。
2350
+ 光标按完整字素移动,支持中文、组合字符和 emoji;输入最多占终端高度四分之一且不超过六行。
2351
+ 括号粘贴保留换行,不触发发送。过滤器或粘贴支持关闭时,不保证未标记多行粘贴安全。
2352
+ 过滤器不可用时 Delete 保守按 Backspace 处理,避免退格误删后文。
2353
+
2354
+ 应用鼠标拖选只建立选区,Ctrl+C 才复制;复制中再次按 Ctrl+C 不会退出或停止服务。
2355
+ 原生剪贴板工具完成后显示确认,OSC 52 只表示请求已发送,终端可能拒绝。
2356
+ Shift+拖动或 `/mouse off` 后的选区由宿主管理,应用无法关闭宿主的自动复制。
2357
+
2358
+ Queue 面板逐条显示待处理消息,数量始终留在状态栏。只有 Core 已把消息纳入会话并发回接收凭据,
2359
+ 该条提示才会消失。中断时未接收消息显示暂停;`/queue` 可分页查看全部原文,Esc 关闭。
2360
+ `/clear` 不丢待处理消息;`/reset`、切换会话会明确报告取消数量;恢复保存的未发送历史不会自动重发。
2361
+
2362
+ 底部依次为输入框、固定操作提示/短反馈行、全局状态栏。状态字段按显示宽度完整保留或整项隐藏。
2363
+ 上下文表示当前主 Agent 的已用/上限 tokens;`~` 表示含估算,`?` 表示上限未知。
2364
+ 费用是含子代理、快速模型及压缩的会话估算 USD,恢复会话沿用累计,缺价格按零计,零值不保证免费。
2365
+ 本轮均速是本轮期间入账输出 token 增量除以耗时,可能包含上述辅助调用,并非瞬时生成速度。
2366
+ `/context` 提供统计范围和完整值。
2367
+
2368
+ Windows Terminal:在设置 JSON **根级**添加 `"copyOnSelect": false`,把以下条目合并到已有数组:
2369
+
2370
+ ```json
2371
+ {
2372
+ "actions": [{ "id": "User.AragonNewline", "command": {
2373
+ "action": "sendInput", "input": "\u001b[13;2u"
2374
+ } }],
2375
+ "keybindings": [{ "keys": "shift+enter", "id": "User.AragonNewline" }]
2376
+ }
2377
+ ```
2378
+
2379
+ 依据:[Windows Terminal 交互设置](https://learn.microsoft.com/en-us/windows/terminal/customize-settings/interaction)、
2380
+ [按键动作](https://learn.microsoft.com/en-us/windows/terminal/customize-settings/actions)。PowerShell 是 shell,不能在其 profile 中设置终端按键映射。
2381
+
2382
+ VS Code 用户设置添加 `"terminal.integrated.copyOnSelection": false`,快捷键 JSON 添加:
2383
+
2384
+ ```json
2385
+ {
2386
+ "key": "shift+enter", "command": "workbench.action.terminal.sendSequence",
2387
+ "when": "terminalFocus", "args": { "text": "\u001b[13;2u" }
2388
+ }
2389
+ ```
2390
+
2391
+ 依据:[终端基础](https://code.visualstudio.com/docs/terminal/basics)、
2392
+ [终端高级设置](https://code.visualstudio.com/docs/terminal/advanced)。应用的 `/terminal-setup` 只输出说明,不修改宿主配置。
2393
+ 若宿主把 Shift+Enter 或 IME 候选确认同样编码为 CR,应用无法从相同字节推断用户意图。
2394
+ 可使用经输入链路测试的 Ctrl+J、独立 CSI-u 绑定及外部编辑后括号粘贴;具体宿主组合仍需实测。
2395
+ 双宿主、微软拼音及持续流式性能验收状态见 `docs/plans/tui-composer-queue-status/manual-test.md`。
2396
+
2397
+ ## 多套模型配置
2398
+
2399
+ 在 `/settings` 中使用 **Main profile** 和 **Fast profile**,可以分别为主任务与快速模型选择已保存的方案。两种角色共享配置库,但各自选择互不影响,也可以选择同一个方案。**Manage profiles** 提供新建、编辑、复制和删除;名称留空时采用模型名。同名方案通过地址主机和唯一 ID 区分。超过八条时按 `/` 搜索名称、模型或服务商。
2400
+
2401
+ 上下方向键或 Tab 移动,Enter 选择或编辑,根设置页 Ctrl+S 保存。普通文本字段的 Enter 仍保存设置。选择和子表单的修改先进入草稿;Esc 返回或确认丢弃。被主模型或快速模型引用的方案必须先解除绑定才能删除。复制包含本轮已经编辑的凭据,并产生新的 ID。
2402
+
2403
+ 方案保存服务商、模型、地址和凭据,不改变思考级别、token 上限、快速评审频率或预算。选择快速模型方案不会自动启用快速层。若本次启动时快速层未注册,首次启用会提示“已保存,待重启”;缺少模型或凭据时也需要先补齐。
2404
+
2405
+ **Current custom** 保留旧式连接,可继续编辑原连接字段。创建方案时从磁盘上的旧式配置预填,不复制环境变量或 `--api-key` 的运行时密钥。专属密钥可保持、替换或切换为共享/环境凭据;修改服务商或地址后,必须明确选择保留原密钥,或重新输入。空地址在方案中表示服务商默认地址,快速方案不会继承主网关。
2406
+
2407
+ 启动优先级为 CLI 参数、环境变量、所选方案、旧式字段、默认值。界面显示启动覆盖;明确重新选择方案可对本次会话立即生效,重启仍遵循启动参数。专属密钥仅对对应角色和目标地址生效;主模型启动密钥不会跟随切换发往另一个网关。
2408
+
2409
+ 运行、团队任务、后台评审或压缩尚未结束时禁止保存。保存采用原子文件替换,同时检查磁盘与当前会话版本;失败保留草稿,发生冲突时选择 Reload settings。写入已成功但会话应用异常时会明确提示重启并禁用重复保存。跨进程版本检查属于乐观检查,不能消除同时写入的极小竞态。
2410
+
2411
+ `/model`、`/fast model` 和 `config set` 修改连接会回到对应角色的自定义配置。若解除绑定会丢失专属账户或默认地址语义,命令会拒绝并引导到设置中编辑或复制。`/reload` 会一起刷新两个角色的连接和凭据,保留对话与用量。
2412
+
2413
+ 配置库仍位于 `ARAGON_HOME` 指向目录中的 `config.json`,不写入会话文件。密钥按现有机制明文保存:POSIX 创建权限为 0600,Windows 依赖用户目录 ACL,不提供加密。`config get/list` 对方案密钥使用固定掩码;损坏或未来版本的配置段整体隐藏。既有 `config edit` 备份也包含凭据。关闭通用日志脱敏、使用短密钥或分享第三方 SDK 错误日志时,仍需自行检查日志内容。
@@ -1,3 +1,5 @@
1
+ import { type ModelSettingsSnapshot } from './model-profile-settings.js';
2
+ import type { ModelSettingsDraft, ModelSettingsPatch, ModelSettingsSaveResult } from '../config/model-profile-store.js';
1
3
  /**
2
4
  * AgentController — builds the core `Agent`, wires the built-in toolset, and
3
5
  * exposes a small run/abort/steer surface plus the pre-flight validation that
@@ -11,6 +13,7 @@
11
13
  import type { PromptOptions, PromptOutcome } from './prompt-options.js';
12
14
  import { ModelRegistry, type AgentEvent, type AgentTool, type Message, type ModelInfo, type ModelRef, type ProviderRegistry, type ThinkingLevel } from '@aragon-agent/core';
13
15
  import type { CliConfig, CompactionConfig, FastConfig, RetryConfig, TeamConfig, ThemeName, TodoConfig } from '../config/schema.js';
16
+ import type { ModelRole } from '../config/model-profiles.js';
14
17
  import { type ConfirmRequest } from '../tools/index.js';
15
18
  import type { ToolPermission } from '../exec/permission.js';
16
19
  import { type ToolOutputListener } from '../tools/tool-output-store.js';
@@ -180,6 +183,9 @@ export declare class AgentController {
180
183
  private readonly outputListeners;
181
184
  private readonly fast;
182
185
  private readonly compaction;
186
+ private settingsRevision;
187
+ private modelSettingsBlocked;
188
+ private preparedSystemPrompt;
183
189
  private readonly contextMeter;
184
190
  private readonly procs;
185
191
  /**
@@ -214,8 +220,11 @@ export declare class AgentController {
214
220
  * Cleared at the next `agent_start`.
215
221
  */
216
222
  private abortRequested;
217
- /** User messages queued since the last `turn_start` (§3.5.4a guard 2). */
218
- private userSteerCount;
223
+ /** Only exact acceptance receipts release user messages from reviewer protection. */
224
+ private readonly pendingUserSteering;
225
+ /** Session changes must not make a delayed receipt match a new message. */
226
+ private readonly steeringPrefix;
227
+ private steeringSequence;
219
228
  constructor(config: CliConfig, deps?: ControllerDeps);
220
229
  private resolveKey;
221
230
  /**
@@ -246,7 +255,7 @@ export declare class AgentController {
246
255
  * Read-only CLI-layer helper for the Header/Welcome key-status dot (P1-1);
247
256
  * does not touch `@aragon-agent/core`.
248
257
  */
249
- hasApiKey(provider?: string): boolean;
258
+ hasApiKey(provider?: string, role?: ModelRole): boolean;
250
259
  /**
251
260
  * Set the color theme live. Mirrors the `setModel` / `setThinkingLevel`
252
261
  * mutator pattern — a subsequent re-render re-reads `getConfig().theme` and
@@ -360,7 +369,11 @@ export declare class AgentController {
360
369
  * which it has to be, since a normal quit reaches it twice.
361
370
  */
362
371
  reapServicesSync(): void;
372
+ /** Queue automation/user guidance with the same protection as visible input. */
363
373
  steer(text: string): void;
374
+ /** Return the opaque ID used by the view to match Core's acceptance receipt. */
375
+ queueUserMessage(text: string): string;
376
+ private enqueueSteering;
364
377
  followUp(text: string): void;
365
378
  isRunning(): boolean;
366
379
  getAgentMode(): AgentMode;
@@ -517,6 +530,28 @@ export declare class AgentController {
517
530
  * the runtime nor the file.
518
531
  */
519
532
  setRetryConfig(patch: Partial<RetryConfig>): RetryConfig;
533
+ /** True while any request can still use a model or credential snapshot. */
534
+ isModelSettingsBusy(): boolean;
535
+ /** Monotonic revision protects an editor from all intervening settings changes. */
536
+ getSettingsRevision(): number;
537
+ /** Read-only draft creation; no startup migration or credential copying. */
538
+ createModelSettingsDraft(): ModelSettingsDraft;
539
+ /** Save an explicit draft as a single disk/live transaction. */
540
+ saveModelSettings(draft: ModelSettingsDraft): ModelSettingsSaveResult;
541
+ /** Legacy commands share the same lossless conversion and atomic save path. */
542
+ saveModelSettingsPatch(patch: ModelSettingsPatch): ModelSettingsSaveResult;
543
+ /** Refresh both role connections and credentials while retaining conversation state. */
544
+ reloadModelSettings(): ModelSettingsSaveResult;
545
+ /** Prebuild all potentially failing model/prompt work before committing the file. */
546
+ prepareModelSettingsSnapshot(config: CliConfig): ModelSettingsSnapshot;
547
+ /** Apply prepared state synchronously, without rebuilding the controller or its history. */
548
+ applyModelSettingsSnapshot(snapshot: ModelSettingsSnapshot): void;
549
+ /** Potentially failing ordinary-setting side effects are isolated from model application. */
550
+ applyModelSettingsEffects(): void;
551
+ /** A partially applied model snapshot must never reach another provider request. */
552
+ blockModelSettingsRequests(): void;
553
+ /** The UI uses this before accepting or draining queued prompts. */
554
+ areModelSettingsBlocked(): boolean;
520
555
  setModel(provider: string, model: string, baseUrl?: string): void;
521
556
  setThinkingLevel(level: ThinkingLevel): void;
522
557
  setMaxTokens(value: number | undefined): void;