@caupulican/pi-adaptative 0.81.40 → 0.81.41

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 (406) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts.map +1 -1
  3. package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js +1 -0
  4. package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js.map +1 -1
  5. package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.ts +1 -0
  6. package/dist/cli/args.d.ts +2 -0
  7. package/dist/cli/args.d.ts.map +1 -1
  8. package/dist/cli/args.js +22 -1
  9. package/dist/cli/args.js.map +1 -1
  10. package/dist/core/agent-paths.d.ts +6 -0
  11. package/dist/core/agent-paths.d.ts.map +1 -1
  12. package/dist/core/agent-paths.js +12 -0
  13. package/dist/core/agent-paths.js.map +1 -1
  14. package/dist/core/agent-session-contracts.d.ts +293 -0
  15. package/dist/core/agent-session-contracts.d.ts.map +1 -0
  16. package/dist/core/agent-session-contracts.js +26 -0
  17. package/dist/core/agent-session-contracts.js.map +1 -0
  18. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  19. package/dist/core/agent-session-runtime.js +3 -0
  20. package/dist/core/agent-session-runtime.js.map +1 -1
  21. package/dist/core/agent-session.d.ts +26 -405
  22. package/dist/core/agent-session.d.ts.map +1 -1
  23. package/dist/core/agent-session.js +86 -307
  24. package/dist/core/agent-session.js.map +1 -1
  25. package/dist/core/auth-storage.d.ts.map +1 -1
  26. package/dist/core/auth-storage.js +3 -1
  27. package/dist/core/auth-storage.js.map +1 -1
  28. package/dist/core/autonomy/lane-tool-surface.d.ts.map +1 -1
  29. package/dist/core/autonomy/lane-tool-surface.js +2 -1
  30. package/dist/core/autonomy/lane-tool-surface.js.map +1 -1
  31. package/dist/core/background-lane-controller.d.ts +3 -1
  32. package/dist/core/background-lane-controller.d.ts.map +1 -1
  33. package/dist/core/background-lane-controller.js +1 -0
  34. package/dist/core/background-lane-controller.js.map +1 -1
  35. package/dist/core/bedrock-sso-login.d.ts +16 -0
  36. package/dist/core/bedrock-sso-login.d.ts.map +1 -0
  37. package/dist/core/bedrock-sso-login.js +98 -0
  38. package/dist/core/bedrock-sso-login.js.map +1 -0
  39. package/dist/core/compaction-controller.d.ts.map +1 -1
  40. package/dist/core/compaction-controller.js +1 -1
  41. package/dist/core/compaction-controller.js.map +1 -1
  42. package/dist/core/compaction-support.d.ts +3 -8
  43. package/dist/core/compaction-support.d.ts.map +1 -1
  44. package/dist/core/compaction-support.js +3 -3
  45. package/dist/core/compaction-support.js.map +1 -1
  46. package/dist/core/context-pipeline.d.ts +1 -1
  47. package/dist/core/context-pipeline.d.ts.map +1 -1
  48. package/dist/core/context-pipeline.js +7 -33
  49. package/dist/core/context-pipeline.js.map +1 -1
  50. package/dist/core/cost/cost-summary.d.ts.map +1 -1
  51. package/dist/core/cost/cost-summary.js +5 -3
  52. package/dist/core/cost/cost-summary.js.map +1 -1
  53. package/dist/core/cost/daily-usage.d.ts.map +1 -1
  54. package/dist/core/cost/daily-usage.js +4 -5
  55. package/dist/core/cost/daily-usage.js.map +1 -1
  56. package/dist/core/default-tool-surface.d.ts.map +1 -1
  57. package/dist/core/default-tool-surface.js +1 -0
  58. package/dist/core/default-tool-surface.js.map +1 -1
  59. package/dist/core/extension-import-authority.d.ts +6 -0
  60. package/dist/core/extension-import-authority.d.ts.map +1 -0
  61. package/dist/core/extension-import-authority.js +10 -0
  62. package/dist/core/extension-import-authority.js.map +1 -0
  63. package/dist/core/extensions/loader.d.ts.map +1 -1
  64. package/dist/core/extensions/loader.js +2 -3
  65. package/dist/core/extensions/loader.js.map +1 -1
  66. package/dist/core/extensions/runner.d.ts +3 -0
  67. package/dist/core/extensions/runner.d.ts.map +1 -1
  68. package/dist/core/extensions/runner.js +14 -5
  69. package/dist/core/extensions/runner.js.map +1 -1
  70. package/dist/core/extensions/stale-context.d.ts +2 -0
  71. package/dist/core/extensions/stale-context.d.ts.map +1 -0
  72. package/dist/core/extensions/stale-context.js +2 -0
  73. package/dist/core/extensions/stale-context.js.map +1 -0
  74. package/dist/core/extensions/types.d.ts +8 -0
  75. package/dist/core/extensions/types.d.ts.map +1 -1
  76. package/dist/core/extensions/types.js.map +1 -1
  77. package/dist/core/foreground-recovery-controller.d.ts +1 -0
  78. package/dist/core/foreground-recovery-controller.d.ts.map +1 -1
  79. package/dist/core/foreground-recovery-controller.js +13 -13
  80. package/dist/core/foreground-recovery-controller.js.map +1 -1
  81. package/dist/core/goal-loop-controller.d.ts +14 -9
  82. package/dist/core/goal-loop-controller.d.ts.map +1 -1
  83. package/dist/core/goal-loop-controller.js +47 -75
  84. package/dist/core/goal-loop-controller.js.map +1 -1
  85. package/dist/core/goals/compact-goal-context.d.ts +11 -0
  86. package/dist/core/goals/compact-goal-context.d.ts.map +1 -0
  87. package/dist/core/goals/compact-goal-context.js +59 -0
  88. package/dist/core/goals/compact-goal-context.js.map +1 -0
  89. package/dist/core/goals/goal-acceptance.d.ts.map +1 -1
  90. package/dist/core/goals/goal-acceptance.js +2 -0
  91. package/dist/core/goals/goal-acceptance.js.map +1 -1
  92. package/dist/core/goals/goal-auto-continue-controller.d.ts +2 -1
  93. package/dist/core/goals/goal-auto-continue-controller.d.ts.map +1 -1
  94. package/dist/core/goals/goal-auto-continue-controller.js +5 -8
  95. package/dist/core/goals/goal-auto-continue-controller.js.map +1 -1
  96. package/dist/core/goals/goal-continuation-controller.d.ts +2 -2
  97. package/dist/core/goals/goal-continuation-controller.d.ts.map +1 -1
  98. package/dist/core/goals/goal-continuation-controller.js +42 -11
  99. package/dist/core/goals/goal-continuation-controller.js.map +1 -1
  100. package/dist/core/goals/goal-continuation-defaults.d.ts +4 -29
  101. package/dist/core/goals/goal-continuation-defaults.d.ts.map +1 -1
  102. package/dist/core/goals/goal-continuation-defaults.js +4 -32
  103. package/dist/core/goals/goal-continuation-defaults.js.map +1 -1
  104. package/dist/core/goals/goal-continuation-prompt.d.ts +8 -18
  105. package/dist/core/goals/goal-continuation-prompt.d.ts.map +1 -1
  106. package/dist/core/goals/goal-continuation-prompt.js +9 -179
  107. package/dist/core/goals/goal-continuation-prompt.js.map +1 -1
  108. package/dist/core/goals/goal-lifecycle.d.ts +35 -12
  109. package/dist/core/goals/goal-lifecycle.d.ts.map +1 -1
  110. package/dist/core/goals/goal-lifecycle.js +98 -13
  111. package/dist/core/goals/goal-lifecycle.js.map +1 -1
  112. package/dist/core/goals/goal-record.d.ts +17 -0
  113. package/dist/core/goals/goal-record.d.ts.map +1 -0
  114. package/dist/core/goals/goal-record.js +31 -0
  115. package/dist/core/goals/goal-record.js.map +1 -0
  116. package/dist/core/goals/goal-session-controller.d.ts +42 -0
  117. package/dist/core/goals/goal-session-controller.d.ts.map +1 -0
  118. package/dist/core/goals/goal-session-controller.js +128 -0
  119. package/dist/core/goals/goal-session-controller.js.map +1 -0
  120. package/dist/core/goals/goal-state.d.ts +45 -25
  121. package/dist/core/goals/goal-state.d.ts.map +1 -1
  122. package/dist/core/goals/goal-state.js +85 -15
  123. package/dist/core/goals/goal-state.js.map +1 -1
  124. package/dist/core/goals/goal-tool-core.d.ts +1 -4
  125. package/dist/core/goals/goal-tool-core.d.ts.map +1 -1
  126. package/dist/core/goals/goal-tool-core.js +49 -34
  127. package/dist/core/goals/goal-tool-core.js.map +1 -1
  128. package/dist/core/goals/session-goal-state.d.ts +18 -8
  129. package/dist/core/goals/session-goal-state.d.ts.map +1 -1
  130. package/dist/core/goals/session-goal-state.js +134 -11
  131. package/dist/core/goals/session-goal-state.js.map +1 -1
  132. package/dist/core/human-input-controller.d.ts +47 -0
  133. package/dist/core/human-input-controller.d.ts.map +1 -0
  134. package/dist/core/human-input-controller.js +181 -0
  135. package/dist/core/human-input-controller.js.map +1 -0
  136. package/dist/core/local-runtime-controller.d.ts +1 -1
  137. package/dist/core/local-runtime-controller.d.ts.map +1 -1
  138. package/dist/core/local-runtime-controller.js.map +1 -1
  139. package/dist/core/model-capability.d.ts +0 -19
  140. package/dist/core/model-capability.d.ts.map +1 -1
  141. package/dist/core/model-capability.js +0 -19
  142. package/dist/core/model-capability.js.map +1 -1
  143. package/dist/core/model-registry.d.ts +6 -1
  144. package/dist/core/model-registry.d.ts.map +1 -1
  145. package/dist/core/model-registry.js +13 -5
  146. package/dist/core/model-registry.js.map +1 -1
  147. package/dist/core/model-resolver.d.ts +16 -1
  148. package/dist/core/model-resolver.d.ts.map +1 -1
  149. package/dist/core/model-resolver.js +32 -16
  150. package/dist/core/model-resolver.js.map +1 -1
  151. package/dist/core/model-router-controller.d.ts +1 -1
  152. package/dist/core/model-router-controller.d.ts.map +1 -1
  153. package/dist/core/model-router-controller.js.map +1 -1
  154. package/dist/core/model-selection-controller.d.ts +1 -1
  155. package/dist/core/model-selection-controller.d.ts.map +1 -1
  156. package/dist/core/model-selection-controller.js.map +1 -1
  157. package/dist/core/orchestration/delegation-ledger.d.ts.map +1 -1
  158. package/dist/core/orchestration/delegation-ledger.js +3 -0
  159. package/dist/core/orchestration/delegation-ledger.js.map +1 -1
  160. package/dist/core/orchestration/work-state-projection.d.ts.map +1 -1
  161. package/dist/core/orchestration/work-state-projection.js +1 -1
  162. package/dist/core/orchestration/work-state-projection.js.map +1 -1
  163. package/dist/core/package-manager.d.ts.map +1 -1
  164. package/dist/core/package-manager.js +20 -3
  165. package/dist/core/package-manager.js.map +1 -1
  166. package/dist/core/profile-filter-controller.d.ts +8 -1
  167. package/dist/core/profile-filter-controller.d.ts.map +1 -1
  168. package/dist/core/profile-filter-controller.js +23 -5
  169. package/dist/core/profile-filter-controller.js.map +1 -1
  170. package/dist/core/prompt-templates.d.ts +1 -0
  171. package/dist/core/prompt-templates.d.ts.map +1 -1
  172. package/dist/core/prompt-templates.js +18 -29
  173. package/dist/core/prompt-templates.js.map +1 -1
  174. package/dist/core/reflection-controller.d.ts +1 -1
  175. package/dist/core/reflection-controller.d.ts.map +1 -1
  176. package/dist/core/reflection-controller.js +3 -1
  177. package/dist/core/reflection-controller.js.map +1 -1
  178. package/dist/core/request-auth.d.ts +7 -0
  179. package/dist/core/request-auth.d.ts.map +1 -0
  180. package/dist/core/request-auth.js +8 -0
  181. package/dist/core/request-auth.js.map +1 -0
  182. package/dist/core/resource-loader.d.ts.map +1 -1
  183. package/dist/core/resource-loader.js +16 -6
  184. package/dist/core/resource-loader.js.map +1 -1
  185. package/dist/core/risk-classifier.d.ts.map +1 -1
  186. package/dist/core/risk-classifier.js +8 -0
  187. package/dist/core/risk-classifier.js.map +1 -1
  188. package/dist/core/runtime-builder.d.ts +15 -3
  189. package/dist/core/runtime-builder.d.ts.map +1 -1
  190. package/dist/core/runtime-builder.js +132 -79
  191. package/dist/core/runtime-builder.js.map +1 -1
  192. package/dist/core/sdk.d.ts.map +1 -1
  193. package/dist/core/sdk.js +7 -1
  194. package/dist/core/sdk.js.map +1 -1
  195. package/dist/core/secrets/credential-exposure-guard.d.ts +9 -0
  196. package/dist/core/secrets/credential-exposure-guard.d.ts.map +1 -0
  197. package/dist/core/secrets/credential-exposure-guard.js +241 -0
  198. package/dist/core/secrets/credential-exposure-guard.js.map +1 -0
  199. package/dist/core/secrets/secret-dotenv.d.ts +27 -0
  200. package/dist/core/secrets/secret-dotenv.d.ts.map +1 -0
  201. package/dist/core/secrets/secret-dotenv.js +183 -0
  202. package/dist/core/secrets/secret-dotenv.js.map +1 -0
  203. package/dist/core/secrets/secret-vault-format.d.ts +112 -0
  204. package/dist/core/secrets/secret-vault-format.d.ts.map +1 -0
  205. package/dist/core/secrets/secret-vault-format.js +397 -0
  206. package/dist/core/secrets/secret-vault-format.js.map +1 -0
  207. package/dist/core/secrets/secret-vault.d.ts +72 -0
  208. package/dist/core/secrets/secret-vault.d.ts.map +1 -0
  209. package/dist/core/secrets/secret-vault.js +671 -0
  210. package/dist/core/secrets/secret-vault.js.map +1 -0
  211. package/dist/core/session-analytics.d.ts +4 -23
  212. package/dist/core/session-analytics.d.ts.map +1 -1
  213. package/dist/core/session-analytics.js +39 -69
  214. package/dist/core/session-analytics.js.map +1 -1
  215. package/dist/core/session-role.d.ts +5 -0
  216. package/dist/core/session-role.d.ts.map +1 -1
  217. package/dist/core/session-role.js +14 -1
  218. package/dist/core/session-role.js.map +1 -1
  219. package/dist/core/session-tree-navigator.d.ts +4 -6
  220. package/dist/core/session-tree-navigator.d.ts.map +1 -1
  221. package/dist/core/session-tree-navigator.js +4 -1
  222. package/dist/core/session-tree-navigator.js.map +1 -1
  223. package/dist/core/settings-manager.d.ts +1 -1
  224. package/dist/core/settings-manager.d.ts.map +1 -1
  225. package/dist/core/settings-manager.js +1 -1
  226. package/dist/core/settings-manager.js.map +1 -1
  227. package/dist/core/slash-commands.d.ts.map +1 -1
  228. package/dist/core/slash-commands.js +2 -2
  229. package/dist/core/slash-commands.js.map +1 -1
  230. package/dist/core/tool-capability-policy.d.ts.map +1 -1
  231. package/dist/core/tool-capability-policy.js +1 -0
  232. package/dist/core/tool-capability-policy.js.map +1 -1
  233. package/dist/core/tool-gate-controller.d.ts.map +1 -1
  234. package/dist/core/tool-gate-controller.js +8 -2
  235. package/dist/core/tool-gate-controller.js.map +1 -1
  236. package/dist/core/tool-protocol-controller.d.ts +2 -4
  237. package/dist/core/tool-protocol-controller.d.ts.map +1 -1
  238. package/dist/core/tool-protocol-controller.js.map +1 -1
  239. package/dist/core/tool-recovery-stats.d.ts +21 -1
  240. package/dist/core/tool-recovery-stats.d.ts.map +1 -1
  241. package/dist/core/tool-recovery-stats.js.map +1 -1
  242. package/dist/core/tools/bash.d.ts +5 -0
  243. package/dist/core/tools/bash.d.ts.map +1 -1
  244. package/dist/core/tools/bash.js +59 -5
  245. package/dist/core/tools/bash.js.map +1 -1
  246. package/dist/core/tools/delegate-status.d.ts.map +1 -1
  247. package/dist/core/tools/delegate-status.js +6 -7
  248. package/dist/core/tools/delegate-status.js.map +1 -1
  249. package/dist/core/tools/delegate.d.ts.map +1 -1
  250. package/dist/core/tools/delegate.js +6 -8
  251. package/dist/core/tools/delegate.js.map +1 -1
  252. package/dist/core/tools/git-filter.d.ts +1 -8
  253. package/dist/core/tools/git-filter.d.ts.map +1 -1
  254. package/dist/core/tools/git-filter.js +2 -63
  255. package/dist/core/tools/git-filter.js.map +1 -1
  256. package/dist/core/tools/goal.d.ts +5 -3
  257. package/dist/core/tools/goal.d.ts.map +1 -1
  258. package/dist/core/tools/goal.js +97 -19
  259. package/dist/core/tools/goal.js.map +1 -1
  260. package/dist/core/tools/index.d.ts +1 -0
  261. package/dist/core/tools/index.d.ts.map +1 -1
  262. package/dist/core/tools/index.js +1 -0
  263. package/dist/core/tools/index.js.map +1 -1
  264. package/dist/core/tools/orchestration-panel.d.ts +1 -4
  265. package/dist/core/tools/orchestration-panel.d.ts.map +1 -1
  266. package/dist/core/tools/orchestration-panel.js +0 -44
  267. package/dist/core/tools/orchestration-panel.js.map +1 -1
  268. package/dist/core/tools/output-accumulator.d.ts +11 -0
  269. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  270. package/dist/core/tools/output-accumulator.js +36 -3
  271. package/dist/core/tools/output-accumulator.js.map +1 -1
  272. package/dist/core/tools/python.d.ts +2 -0
  273. package/dist/core/tools/python.d.ts.map +1 -1
  274. package/dist/core/tools/python.js +3 -1
  275. package/dist/core/tools/python.js.map +1 -1
  276. package/dist/core/tools/read.d.ts.map +1 -1
  277. package/dist/core/tools/read.js +1 -1
  278. package/dist/core/tools/read.js.map +1 -1
  279. package/dist/core/tools/search-command-guard.d.ts +14 -0
  280. package/dist/core/tools/search-command-guard.d.ts.map +1 -0
  281. package/dist/core/tools/search-command-guard.js +333 -0
  282. package/dist/core/tools/search-command-guard.js.map +1 -0
  283. package/dist/core/tools/secret-store.d.ts +38 -0
  284. package/dist/core/tools/secret-store.d.ts.map +1 -0
  285. package/dist/core/tools/secret-store.js +412 -0
  286. package/dist/core/tools/secret-store.js.map +1 -0
  287. package/dist/core/tools/shell-command-parser.d.ts +16 -0
  288. package/dist/core/tools/shell-command-parser.d.ts.map +1 -0
  289. package/dist/core/tools/shell-command-parser.js +113 -0
  290. package/dist/core/tools/shell-command-parser.js.map +1 -0
  291. package/dist/core/tools/task-steps.d.ts.map +1 -1
  292. package/dist/core/tools/task-steps.js +4 -7
  293. package/dist/core/tools/task-steps.js.map +1 -1
  294. package/dist/core/util/atomic-file.d.ts +6 -2
  295. package/dist/core/util/atomic-file.d.ts.map +1 -1
  296. package/dist/core/util/atomic-file.js +4 -4
  297. package/dist/core/util/atomic-file.js.map +1 -1
  298. package/dist/index.d.ts +3 -2
  299. package/dist/index.d.ts.map +1 -1
  300. package/dist/index.js +2 -1
  301. package/dist/index.js.map +1 -1
  302. package/dist/main.d.ts.map +1 -1
  303. package/dist/main.js +25 -11
  304. package/dist/main.js.map +1 -1
  305. package/dist/modes/interactive/auth-dialogs-controller.d.ts +4 -0
  306. package/dist/modes/interactive/auth-dialogs-controller.d.ts.map +1 -1
  307. package/dist/modes/interactive/auth-dialogs-controller.js +60 -1
  308. package/dist/modes/interactive/auth-dialogs-controller.js.map +1 -1
  309. package/dist/modes/interactive/components/activity-lane.d.ts +55 -0
  310. package/dist/modes/interactive/components/activity-lane.d.ts.map +1 -0
  311. package/dist/modes/interactive/components/activity-lane.js +304 -0
  312. package/dist/modes/interactive/components/activity-lane.js.map +1 -0
  313. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  314. package/dist/modes/interactive/components/assistant-message.js +19 -10
  315. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  316. package/dist/modes/interactive/components/expandable-text.d.ts +12 -0
  317. package/dist/modes/interactive/components/expandable-text.d.ts.map +1 -0
  318. package/dist/modes/interactive/components/expandable-text.js +17 -0
  319. package/dist/modes/interactive/components/expandable-text.js.map +1 -0
  320. package/dist/modes/interactive/components/extension-editor.d.ts +15 -1
  321. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  322. package/dist/modes/interactive/components/extension-editor.js +30 -21
  323. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  324. package/dist/modes/interactive/components/extension-input.d.ts +1 -0
  325. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  326. package/dist/modes/interactive/components/extension-input.js +6 -1
  327. package/dist/modes/interactive/components/extension-input.js.map +1 -1
  328. package/dist/modes/interactive/components/scoped-models-selector.d.ts +2 -2
  329. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  330. package/dist/modes/interactive/components/scoped-models-selector.js +23 -14
  331. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  332. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  333. package/dist/modes/interactive/components/settings-selector.js +4 -4
  334. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  335. package/dist/modes/interactive/components/tool-execution.d.ts +19 -11
  336. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  337. package/dist/modes/interactive/components/tool-execution.js +53 -20
  338. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  339. package/dist/modes/interactive/components/tool-group.d.ts.map +1 -1
  340. package/dist/modes/interactive/components/tool-group.js +3 -0
  341. package/dist/modes/interactive/components/tool-group.js.map +1 -1
  342. package/dist/modes/interactive/components/usage-action-selector.d.ts +16 -0
  343. package/dist/modes/interactive/components/usage-action-selector.d.ts.map +1 -0
  344. package/dist/modes/interactive/components/usage-action-selector.js +46 -0
  345. package/dist/modes/interactive/components/usage-action-selector.js.map +1 -0
  346. package/dist/modes/interactive/extension-ui-host.d.ts.map +1 -1
  347. package/dist/modes/interactive/extension-ui-host.js +1 -0
  348. package/dist/modes/interactive/extension-ui-host.js.map +1 -1
  349. package/dist/modes/interactive/external-editor.d.ts +15 -0
  350. package/dist/modes/interactive/external-editor.d.ts.map +1 -1
  351. package/dist/modes/interactive/external-editor.js +27 -19
  352. package/dist/modes/interactive/external-editor.js.map +1 -1
  353. package/dist/modes/interactive/history-reload-math.d.ts +6 -2
  354. package/dist/modes/interactive/history-reload-math.d.ts.map +1 -1
  355. package/dist/modes/interactive/history-reload-math.js +10 -5
  356. package/dist/modes/interactive/history-reload-math.js.map +1 -1
  357. package/dist/modes/interactive/interactive-event-controller.d.ts +74 -0
  358. package/dist/modes/interactive/interactive-event-controller.d.ts.map +1 -0
  359. package/dist/modes/interactive/interactive-event-controller.js +328 -0
  360. package/dist/modes/interactive/interactive-event-controller.js.map +1 -0
  361. package/dist/modes/interactive/interactive-mode.d.ts +20 -25
  362. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  363. package/dist/modes/interactive/interactive-mode.js +196 -608
  364. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  365. package/dist/modes/interactive/loaded-resources-view.d.ts +20 -0
  366. package/dist/modes/interactive/loaded-resources-view.d.ts.map +1 -0
  367. package/dist/modes/interactive/loaded-resources-view.js +147 -0
  368. package/dist/modes/interactive/loaded-resources-view.js.map +1 -0
  369. package/dist/modes/interactive/resource-display.d.ts.map +1 -1
  370. package/dist/modes/interactive/resource-display.js +8 -2
  371. package/dist/modes/interactive/resource-display.js.map +1 -1
  372. package/dist/modes/interactive/resource-shell-commands.d.ts +1 -5
  373. package/dist/modes/interactive/resource-shell-commands.d.ts.map +1 -1
  374. package/dist/modes/interactive/resource-shell-commands.js +0 -5
  375. package/dist/modes/interactive/resource-shell-commands.js.map +1 -1
  376. package/dist/modes/interactive/session-flow-commands.d.ts +10 -6
  377. package/dist/modes/interactive/session-flow-commands.d.ts.map +1 -1
  378. package/dist/modes/interactive/session-flow-commands.js +123 -70
  379. package/dist/modes/interactive/session-flow-commands.js.map +1 -1
  380. package/dist/modes/interactive/usage-commands.d.ts +34 -0
  381. package/dist/modes/interactive/usage-commands.d.ts.map +1 -0
  382. package/dist/modes/interactive/usage-commands.js +225 -0
  383. package/dist/modes/interactive/usage-commands.js.map +1 -0
  384. package/dist/utils/shell.d.ts.map +1 -1
  385. package/dist/utils/shell.js +5 -3
  386. package/dist/utils/shell.js.map +1 -1
  387. package/dist/utils/version-check.d.ts.map +1 -1
  388. package/dist/utils/version-check.js +3 -1
  389. package/dist/utils/version-check.js.map +1 -1
  390. package/docs/UI_POLISH_ORCHESTRATION.md +25 -31
  391. package/docs/UI_QUALITY_ORCHESTRATION.md +22 -24
  392. package/docs/providers.md +9 -1
  393. package/docs/ui-reference/README.md +6 -6
  394. package/docs/ui-reference/orchestration-after.txt +14 -7
  395. package/docs/ui-reference/orchestration-before.txt +12 -6
  396. package/docs/ui-reference/orchestration-reference.txt +15 -5
  397. package/docs/usage.md +9 -1
  398. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  399. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  400. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  401. package/examples/extensions/sandbox/package-lock.json +2 -2
  402. package/examples/extensions/sandbox/package.json +1 -1
  403. package/examples/extensions/with-deps/package-lock.json +2 -2
  404. package/examples/extensions/with-deps/package.json +1 -1
  405. package/npm-shrinkwrap.json +13 -13
  406. package/package.json +4 -4
@@ -4,8 +4,7 @@
4
4
  */
5
5
  import * as fs from "node:fs";
6
6
  import * as path from "node:path";
7
- import { createCompactionSummaryMessage } from "@caupulican/pi-agent-core";
8
- import { Container, Loader, ProcessTerminal, Spacer, setKeybindings, Text, TruncatedText, TUI, } from "@caupulican/pi-tui";
7
+ import { Container, Loader, ProcessTerminal, Spacer, setKeybindings, Text, TUI, } from "@caupulican/pi-tui";
9
8
  import { APP_NAME, APP_TITLE, getAgentDir, VERSION } from "../../config.js";
10
9
  import { parseSkillBlock } from "../../core/agent-session.js";
11
10
  import { FooterDataProvider } from "../../core/footer-data-provider.js";
@@ -14,9 +13,8 @@ import { configureHttpDispatcher } from "../../core/http-dispatcher.js";
14
13
  import { KeybindingsManager } from "../../core/keybindings.js";
15
14
  import { formatMissingSessionCwdPrompt } from "../../core/session-cwd.js";
16
15
  import { SessionImageStore } from "../../core/session-image-store.js";
17
- import { BUILTIN_SLASH_COMMANDS } from "../../core/slash-commands.js";
18
- import { createOrchestrationActivityModel, OrchestrationPanelComponent } from "../../core/tools/orchestration-panel.js";
19
- import { getCwdRelativePath, resolvePath } from "../../utils/paths.js";
16
+ import { isRecordObject } from "../../core/util/value-guards.js";
17
+ import { resolvePath } from "../../utils/paths.js";
20
18
  import { ensureTool } from "../../utils/tools-manager.js";
21
19
  import { checkForNewPiVersion } from "../../utils/version-check.js";
22
20
  import { AuthDialogsController } from "./auth-dialogs-controller.js";
@@ -25,31 +23,33 @@ import * as autocompleteProvider from "./autocomplete-provider.js";
25
23
  import * as autonomyCommands from "./autonomy-commands.js";
26
24
  import * as clipboardInput from "./clipboard-input.js";
27
25
  import * as compactionQueue from "./compaction-queue.js";
26
+ import { ActivityLaneComponent } from "./components/activity-lane.js";
28
27
  import { AssistantMessageComponent } from "./components/assistant-message.js";
29
28
  import { BashExecutionComponent } from "./components/bash-execution.js";
30
29
  import { BranchSummaryMessageComponent } from "./components/branch-summary-message.js";
31
30
  import { CompactionSummaryMessageComponent } from "./components/compaction-summary-message.js";
32
- import { CountdownTimer } from "./components/countdown-timer.js";
33
31
  import { CustomEditor } from "./components/custom-editor.js";
34
32
  import { CustomMessageComponent } from "./components/custom-message.js";
35
33
  import { DynamicBorder } from "./components/dynamic-border.js";
34
+ import { ExpandableText, isExpandable } from "./components/expandable-text.js";
36
35
  import { FooterComponent } from "./components/footer.js";
37
36
  import { formatKeyText, keyDisplayText, keyHint, keyText, rawKeyHint } from "./components/keybinding-hints.js";
38
37
  import { SkillInvocationMessageComponent } from "./components/skill-invocation-message.js";
39
38
  import { ToolExecutionComponent } from "./components/tool-execution.js";
40
39
  import { ToolGroupComponent } from "./components/tool-group.js";
41
- import { getToolPanelActionKey, getToolPanelResultActionKeys, shouldReuseToolPanelInPlace, ToolPanelRegistry, } from "./components/tool-panel-registry.js";
40
+ import { getToolPanelActionKey, shouldReuseToolPanelInPlace, ToolPanelRegistry, } from "./components/tool-panel-registry.js";
42
41
  import { UserMessageComponent } from "./components/user-message.js";
43
42
  import * as configBackup from "./config-backup.js";
44
43
  import { EditorOverlayHost } from "./editor-overlay-host.js";
45
44
  import { ExtensionUiHost } from "./extension-ui-host.js";
46
45
  import { openEditorForPath, openExternalEditor } from "./external-editor.js";
47
46
  import * as historyReloadMath from "./history-reload-math.js";
47
+ import { handleInteractiveEvent } from "./interactive-event-controller.js";
48
48
  import * as keyHandlers from "./key-handlers.js";
49
+ import { renderLoadedResources } from "./loaded-resources-view.js";
49
50
  import * as localModelCommands from "./local-model-commands.js";
50
51
  import { ProfileMenuController } from "./profile-menu-controller.js";
51
52
  import * as reportCommands from "./report-commands.js";
52
- import * as resourceDisplay from "./resource-display.js";
53
53
  import * as resourceShellCommands from "./resource-shell-commands.js";
54
54
  import * as sessionFlows from "./session-flow-commands.js";
55
55
  import * as sessionIoCommands from "./session-io-commands.js";
@@ -58,25 +58,11 @@ import * as settingsSelectorFlow from "./settings-selector-flow.js";
58
58
  import * as signalLifecycle from "./signal-lifecycle.js";
59
59
  import * as startupChecks from "./startup-checks.js";
60
60
  import { getEditorTheme, getMarkdownTheme, initTheme, onThemeChange, setRegisteredThemes, setTheme, stopThemeWatcher, theme, } from "./theme/theme.js";
61
+ import * as usageCommands from "./usage-commands.js";
61
62
  const TUI_HISTORY_RELOAD_CHUNK_SIZE = 20;
62
63
  const TUI_LIVE_HISTORY_MAX_COMPONENTS = 260;
63
64
  const TUI_LIVE_HISTORY_TRIM_TO_COMPONENTS = 220;
64
65
  const STREAMING_UI_UPDATE_INTERVAL_MS = 80;
65
- function isExpandable(obj) {
66
- return typeof obj === "object" && obj !== null && "setExpanded" in obj && typeof obj.setExpanded === "function";
67
- }
68
- class ExpandableText extends Text {
69
- getCollapsedText;
70
- getExpandedText;
71
- constructor(getCollapsedText, getExpandedText, expanded = false, paddingX = 0, paddingY = 0) {
72
- super(expanded ? getExpandedText() : getCollapsedText(), paddingX, paddingY);
73
- this.getCollapsedText = getCollapsedText;
74
- this.getExpandedText = getExpandedText;
75
- }
76
- setExpanded(expanded) {
77
- this.setText(expanded ? this.getExpandedText() : this.getCollapsedText());
78
- }
79
- }
80
66
  const ANTHROPIC_SUBSCRIPTION_AUTH_WARNING = "Anthropic subscription auth is active. Third-party harness usage draws from extra usage and is billed per token, not your Claude plan limits. Manage extra usage at https://claude.ai/settings/usage.";
81
67
  function isAnthropicSubscriptionAuthKey(apiKey) {
82
68
  return typeof apiKey === "string" && apiKey.startsWith("sk-ant-oat");
@@ -174,10 +160,8 @@ export class InteractiveMode {
174
160
  // Track pending bash components (shown in pending area, moved to chat on submit)
175
161
  pendingBashComponents = [];
176
162
  // Auto-compaction state
177
- autoCompactionLoader = undefined;
178
163
  autoCompactionEscapeHandler;
179
164
  // Auto-retry state
180
- retryLoader = undefined;
181
165
  retryCountdown = undefined;
182
166
  retryEscapeHandler;
183
167
  // Messages queued while compaction is running
@@ -187,6 +171,8 @@ export class InteractiveMode {
187
171
  // Extension widget containers (hold components rendered above/below the editor)
188
172
  widgetContainerAbove;
189
173
  widgetContainerBelow;
174
+ activityLane;
175
+ hasHumanAudience;
190
176
  // Header container that holds the built-in or custom header
191
177
  headerContainer;
192
178
  // Built-in header (logo + keybinding hints + changelog)
@@ -208,6 +194,8 @@ export class InteractiveMode {
208
194
  constructor(runtimeHost, options = {}) {
209
195
  this.runtimeHost = runtimeHost;
210
196
  this.options = options;
197
+ this.hasHumanAudience = options.hasHumanAudience ?? true;
198
+ this.workingVisible = this.hasHumanAudience;
211
199
  this.runtimeHost.setBeforeSessionInvalidate(() => {
212
200
  this.extensionUiHost.resetExtensionUI();
213
201
  });
@@ -223,6 +211,9 @@ export class InteractiveMode {
223
211
  this.statusContainer = new Container();
224
212
  this.widgetContainerAbove = new Container();
225
213
  this.widgetContainerBelow = new Container();
214
+ this.activityLane = this.hasHumanAudience
215
+ ? new ActivityLaneComponent(theme, () => this.ui.requestRender())
216
+ : undefined;
226
217
  this.keybindings = KeybindingsManager.create();
227
218
  setKeybindings(this.keybindings);
228
219
  const editorPaddingX = this.settingsManager.getEditorPaddingX();
@@ -344,19 +335,6 @@ export class InteractiveMode {
344
335
  setRegisteredThemes(this.session.resourceLoader.getThemes().themes);
345
336
  initTheme(this.settingsManager.getTheme(), true);
346
337
  }
347
- getBuiltInCommandConflictDiagnostics(extensionRunner) {
348
- const builtinNames = new Set(BUILTIN_SLASH_COMMANDS.map((command) => command.name));
349
- return extensionRunner
350
- .getRegisteredCommands()
351
- .filter((command) => builtinNames.has(command.name))
352
- .map((command) => ({
353
- type: "warning",
354
- message: command.invocationName === command.name
355
- ? `Extension command '/${command.name}' conflicts with built-in interactive command. Skipping in autocomplete.`
356
- : `Extension command '/${command.name}' conflicts with built-in interactive command. Available as '/${command.invocationName}'.`,
357
- path: command.sourceInfo.path,
358
- }));
359
- }
360
338
  // Thin delegate retained so setupAutocompleteProvider's base-provider seam
361
339
  // (stubbed via prototype in interactive-mode-status.test.ts) keeps working.
362
340
  createBaseAutocompleteProvider() {
@@ -477,13 +455,19 @@ export class InteractiveMode {
477
455
  this.headerContainer.addChild(this.builtInHeader);
478
456
  }
479
457
  this.ui.addChild(this.chatContainer);
480
- this.ui.addChild(this.pendingMessagesContainer);
481
- this.ui.addChild(this.statusContainer);
482
- this.extensionUiHost.renderWidgets(); // Initialize with default spacer
483
- this.ui.addChild(this.widgetContainerAbove);
458
+ if (this.hasHumanAudience) {
459
+ this.ui.addChild(this.pendingMessagesContainer);
460
+ this.ui.addChild(this.statusContainer);
461
+ this.extensionUiHost.renderWidgets(); // Initialize with default spacer
462
+ this.ui.addChild(this.widgetContainerAbove);
463
+ if (this.activityLane)
464
+ this.ui.addChild(this.activityLane);
465
+ }
484
466
  this.ui.addChild(this.editorContainer);
485
- this.ui.addChild(this.widgetContainerBelow);
486
- this.ui.addChild(this.footer);
467
+ if (this.hasHumanAudience) {
468
+ this.ui.addChild(this.widgetContainerBelow);
469
+ this.ui.addChild(this.footer);
470
+ }
487
471
  this.ui.setFocus(this.editor);
488
472
  this.setupKeyHandlers();
489
473
  this.setupEditorSubmitHandler();
@@ -501,7 +485,7 @@ export class InteractiveMode {
501
485
  onThemeChange(() => {
502
486
  this.ui.invalidate();
503
487
  this.updateEditorBorderColor();
504
- this.refreshOrchestrationWidget();
488
+ this.refreshActivityLane();
505
489
  this.ui.requestRender();
506
490
  });
507
491
  // Set up git branch watcher (uses provider instead of footer)
@@ -541,10 +525,17 @@ export class InteractiveMode {
541
525
  }
542
526
  });
543
527
  // Start package update check asynchronously
544
- this.checkForPackageUpdates().then((updates) => {
528
+ this.checkForPackageUpdates()
529
+ .then((updates) => {
545
530
  if (updates.length > 0) {
546
531
  this.showPackageUpdateNotification(updates);
547
532
  }
533
+ })
534
+ .finally(() => {
535
+ // npm can overwrite the shared Windows console title while checking extension versions.
536
+ if (process.platform === "win32" && this.isInitialized) {
537
+ this.updateTerminalTitle();
538
+ }
548
539
  });
549
540
  // Check tmux keyboard setup asynchronously
550
541
  this.checkTmuxKeyboardSetup().then((warning) => {
@@ -623,9 +614,49 @@ export class InteractiveMode {
623
614
  this.footerDataProvider.setAutonomyStatusSnapshot(this.session.getAutonomyStatusSnapshot());
624
615
  this.footer.invalidate();
625
616
  }
626
- refreshOrchestrationWidget() {
627
- const model = createOrchestrationActivityModel(this.session.getTaskStepsStateSnapshot(), this.session.getLaneRecords());
628
- this.extensionUiHost.setHostWidget("native-orchestration", model ? new OrchestrationPanelComponent(theme, model) : undefined, "belowEditor");
617
+ activityLaneSnapshot() {
618
+ return {
619
+ goalState: this.session.getGoalStateSnapshot(),
620
+ taskState: this.session.getTaskStepsStateSnapshot(),
621
+ laneRecords: this.session.getLaneRecords(),
622
+ };
623
+ }
624
+ refreshActivityLane(options = {}) {
625
+ if (!this.activityLane)
626
+ return;
627
+ const sessionKey = this.sessionManager.getSessionId();
628
+ if (options.replace) {
629
+ this.activityLane.replaceCanonical(sessionKey, this.activityLaneSnapshot());
630
+ }
631
+ else {
632
+ this.activityLane.updateCanonical(sessionKey, this.activityLaneSnapshot());
633
+ }
634
+ }
635
+ toolActivityKind(toolName) {
636
+ if (toolName === "task_steps")
637
+ return "task";
638
+ if (toolName === "goal")
639
+ return "goal";
640
+ if (toolName === "delegate" || toolName === "delegate_status")
641
+ return "worker";
642
+ return "tool";
643
+ }
644
+ toolActivityLabel(toolName) {
645
+ const label = this.getRegisteredToolDefinition(toolName)?.label?.trim() || toolName;
646
+ return label.replace(/[_-]+/g, " ").replace(/(^|\s)\S/g, (character) => character.toUpperCase());
647
+ }
648
+ toolActivityTerminalStatus(isError, details) {
649
+ if (isError)
650
+ return "failure";
651
+ if (!isRecordObject(details))
652
+ return "success";
653
+ if (details.applied === false || details.kind === "error")
654
+ return "failure";
655
+ if (details.kind === "review" && details.reviewed === false)
656
+ return "failure";
657
+ if (details.started === false)
658
+ return "neutral";
659
+ return "success";
629
660
  }
630
661
  checkForPackageUpdates() {
631
662
  return startupChecks.checkForPackageUpdates(this.startupChecksHost());
@@ -649,220 +680,25 @@ export class InteractiveMode {
649
680
  // =========================================================================
650
681
  // Extension System
651
682
  // =========================================================================
652
- // The resource-display formatters below are pure and live in ./resource-display.ts.
653
- // These thin `this.`-delegates are retained so showLoadedResources' formatter
654
- // injection seam (exercised via prototype stubs in interactive-mode-status.test.ts)
655
- // keeps working unchanged.
656
- formatDisplayPath(p) {
657
- return resourceDisplay.formatDisplayPath(p);
658
- }
659
- formatExtensionDisplayPath(path) {
660
- return resourceDisplay.formatExtensionDisplayPath(path);
661
- }
662
- formatContextPath(p) {
663
- const cwd = path.resolve(this.sessionManager.getCwd());
664
- const absolutePath = path.isAbsolute(p) ? path.resolve(p) : path.resolve(cwd, p);
665
- const relativePath = getCwdRelativePath(absolutePath, cwd);
666
- if (relativePath !== undefined) {
667
- return relativePath;
668
- }
669
- return this.formatDisplayPath(absolutePath);
670
- }
671
683
  getStartupExpansionState() {
672
684
  return this.options.verbose || this.toolOutputExpanded;
673
685
  }
674
- getShortPath(fullPath, sourceInfo) {
675
- return resourceDisplay.getShortPath(fullPath, sourceInfo);
676
- }
677
- getCompactPathLabel(resourcePath, sourceInfo) {
678
- return resourceDisplay.getCompactPathLabel(resourcePath, sourceInfo);
679
- }
680
- getCompactPackageSourceLabel(sourceInfo) {
681
- return resourceDisplay.getCompactPackageSourceLabel(sourceInfo);
682
- }
683
- getCompactExtensionLabel(resourcePath, sourceInfo) {
684
- return resourceDisplay.getCompactExtensionLabel(resourcePath, sourceInfo);
685
- }
686
- getCompactDisplayPathSegments(resourcePath) {
687
- return resourceDisplay.getCompactDisplayPathSegments(resourcePath);
688
- }
689
- getCompactNonPackageExtensionLabel(resourcePath, index, allPaths) {
690
- return resourceDisplay.getCompactNonPackageExtensionLabel(resourcePath, index, allPaths);
691
- }
692
- getCompactExtensionLabels(extensions) {
693
- return resourceDisplay.getCompactExtensionLabels(extensions);
694
- }
695
- getScopeGroup(sourceInfo) {
696
- return resourceDisplay.getScopeGroup(sourceInfo);
697
- }
698
- isPackageSource(sourceInfo) {
699
- return resourceDisplay.isPackageSource(sourceInfo);
700
- }
701
- buildScopeGroups(items) {
702
- return resourceDisplay.buildScopeGroups(items);
703
- }
704
- formatScopeGroups(groups, options) {
705
- return resourceDisplay.formatScopeGroups(groups, options);
706
- }
707
- formatDiagnostics(diagnostics, sourceInfos) {
708
- return resourceDisplay.formatDiagnostics(diagnostics, sourceInfos);
709
- }
710
686
  showLoadedResources(options) {
711
- const showListing = options?.force || this.options.verbose || !this.settingsManager.getQuietStartup();
712
- const showDiagnostics = showListing || options?.showDiagnosticsWhenQuiet === true;
713
- if (!showListing && !showDiagnostics) {
714
- return;
715
- }
716
- const sectionHeader = (name, color = "mdHeading") => theme.fg(color, `[${name}]`);
717
- const formatCompactList = (items, options) => {
718
- const labels = items.map((item) => item.trim()).filter((item) => item.length > 0);
719
- if (options?.sort !== false) {
720
- labels.sort((a, b) => a.localeCompare(b));
721
- }
722
- return theme.fg("dim", ` ${labels.join(", ")}`);
723
- };
724
- const addLoadedSection = (name, collapsedBody, expandedBody = collapsedBody, color = "mdHeading") => {
725
- const section = new ExpandableText(() => `${sectionHeader(name, color)}\n${collapsedBody}`, () => `${sectionHeader(name, color)}\n${expandedBody}`, this.getStartupExpansionState(), 0, 0);
726
- this.chatContainer.addChild(section);
727
- this.chatContainer.addChild(new Spacer(1));
728
- };
729
- const skillsResult = this.session.resourceLoader.getSkills();
730
- const promptsResult = this.session.resourceLoader.getPrompts();
731
- const themesResult = this.session.resourceLoader.getThemes();
732
- const extensions = options?.extensions ??
733
- this.session.resourceLoader.getExtensions().extensions.map((extension) => ({
734
- path: extension.path,
735
- sourceInfo: extension.sourceInfo,
736
- }));
737
- const sourceInfos = new Map();
738
- for (const extension of extensions) {
739
- if (extension.sourceInfo) {
740
- sourceInfos.set(extension.path, extension.sourceInfo);
741
- }
742
- }
743
- for (const skill of skillsResult.skills) {
744
- if (skill.sourceInfo) {
745
- sourceInfos.set(skill.filePath, skill.sourceInfo);
746
- }
747
- }
748
- for (const prompt of promptsResult.prompts) {
749
- if (prompt.sourceInfo) {
750
- sourceInfos.set(prompt.filePath, prompt.sourceInfo);
751
- }
752
- }
753
- for (const loadedTheme of themesResult.themes) {
754
- if (loadedTheme.sourcePath && loadedTheme.sourceInfo) {
755
- sourceInfos.set(loadedTheme.sourcePath, loadedTheme.sourceInfo);
756
- }
757
- }
758
- if (showListing) {
759
- const contextFiles = this.session.resourceLoader.getAgentsFiles().agentsFiles;
760
- if (contextFiles.length > 0) {
761
- this.chatContainer.addChild(new Spacer(1));
762
- const contextList = contextFiles
763
- .map((f) => theme.fg("dim", ` ${this.formatDisplayPath(f.path)}`))
764
- .join("\n");
765
- const contextCompactList = formatCompactList(contextFiles.map((contextFile) => this.formatContextPath(contextFile.path)), { sort: false });
766
- addLoadedSection("Context", contextCompactList, contextList);
767
- }
768
- const skills = this.session.resourceLoader.getActiveSkills();
769
- if (skills.length > 0) {
770
- const groups = this.buildScopeGroups(skills.map((skill) => ({ path: skill.filePath, sourceInfo: skill.sourceInfo })));
771
- const skillList = this.formatScopeGroups(groups, {
772
- formatPath: (item) => this.formatDisplayPath(item.path),
773
- formatPackagePath: (item) => this.getShortPath(item.path, item.sourceInfo),
774
- });
775
- const skillCompactList = formatCompactList(skills.map((skill) => skill.name));
776
- addLoadedSection("Skills", skillCompactList, skillList);
777
- }
778
- const templates = this.session.promptTemplates;
779
- if (templates.length > 0) {
780
- const groups = this.buildScopeGroups(templates.map((template) => ({ path: template.filePath, sourceInfo: template.sourceInfo })));
781
- const templateByPath = new Map(templates.map((t) => [t.filePath, t]));
782
- const templateList = this.formatScopeGroups(groups, {
783
- formatPath: (item) => {
784
- const template = templateByPath.get(item.path);
785
- return template ? `/${template.name}` : this.formatDisplayPath(item.path);
786
- },
787
- formatPackagePath: (item) => {
788
- const template = templateByPath.get(item.path);
789
- return template ? `/${template.name}` : this.formatDisplayPath(item.path);
790
- },
791
- });
792
- const promptCompactList = formatCompactList(templates.map((template) => `/${template.name}`));
793
- addLoadedSection("Prompts", promptCompactList, templateList);
794
- }
795
- if (extensions.length > 0) {
796
- const groups = this.buildScopeGroups(extensions);
797
- const extList = this.formatScopeGroups(groups, {
798
- formatPath: (item) => this.formatExtensionDisplayPath(item.path),
799
- formatPackagePath: (item) => this.formatExtensionDisplayPath(this.getShortPath(item.path, item.sourceInfo)),
800
- });
801
- const extensionCompactList = formatCompactList(this.getCompactExtensionLabels(extensions));
802
- addLoadedSection("Extensions", extensionCompactList, extList, "mdHeading");
803
- }
804
- // Show loaded themes (excluding built-in)
805
- const loadedThemes = themesResult.themes;
806
- const customThemes = loadedThemes.filter((t) => t.sourcePath);
807
- if (customThemes.length > 0) {
808
- const groups = this.buildScopeGroups(customThemes.map((loadedTheme) => ({
809
- path: loadedTheme.sourcePath,
810
- sourceInfo: loadedTheme.sourceInfo,
811
- })));
812
- const themeList = this.formatScopeGroups(groups, {
813
- formatPath: (item) => this.formatDisplayPath(item.path),
814
- formatPackagePath: (item) => this.getShortPath(item.path, item.sourceInfo),
815
- });
816
- const themeCompactList = formatCompactList(customThemes.map((loadedTheme) => loadedTheme.name ?? this.getCompactPathLabel(loadedTheme.sourcePath, loadedTheme.sourceInfo)));
817
- addLoadedSection("Themes", themeCompactList, themeList);
818
- }
819
- }
820
- if (showDiagnostics) {
821
- const skillDiagnostics = skillsResult.diagnostics;
822
- if (skillDiagnostics.length > 0) {
823
- const warningLines = this.formatDiagnostics(skillDiagnostics, sourceInfos);
824
- this.chatContainer.addChild(new Text(`${theme.fg("warning", "[Skill conflicts]")}\n${warningLines}`, 0, 0));
825
- this.chatContainer.addChild(new Spacer(1));
826
- }
827
- const promptDiagnostics = promptsResult.diagnostics;
828
- if (promptDiagnostics.length > 0) {
829
- const warningLines = this.formatDiagnostics(promptDiagnostics, sourceInfos);
830
- this.chatContainer.addChild(new Text(`${theme.fg("warning", "[Prompt conflicts]")}\n${warningLines}`, 0, 0));
831
- this.chatContainer.addChild(new Spacer(1));
832
- }
833
- const extensionDiagnostics = [];
834
- const extensionErrors = this.session.resourceLoader.getExtensions().errors;
835
- if (extensionErrors.length > 0) {
836
- for (const error of extensionErrors) {
837
- extensionDiagnostics.push({ type: "error", message: error.error, path: error.path });
838
- }
839
- }
840
- const commandDiagnostics = this.session.extensionRunner.getCommandDiagnostics();
841
- extensionDiagnostics.push(...commandDiagnostics);
842
- extensionDiagnostics.push(...this.getBuiltInCommandConflictDiagnostics(this.session.extensionRunner));
843
- const shortcutDiagnostics = this.session.extensionRunner.getShortcutDiagnostics();
844
- extensionDiagnostics.push(...shortcutDiagnostics);
845
- if (extensionDiagnostics.length > 0) {
846
- const warningLines = this.formatDiagnostics(extensionDiagnostics, sourceInfos);
847
- this.chatContainer.addChild(new Text(`${theme.fg("warning", "[Extension issues]")}\n${warningLines}`, 0, 0));
848
- this.chatContainer.addChild(new Spacer(1));
849
- }
850
- const themeDiagnostics = themesResult.diagnostics;
851
- if (themeDiagnostics.length > 0) {
852
- const warningLines = this.formatDiagnostics(themeDiagnostics, sourceInfos);
853
- this.chatContainer.addChild(new Text(`${theme.fg("warning", "[Theme conflicts]")}\n${warningLines}`, 0, 0));
854
- this.chatContainer.addChild(new Spacer(1));
855
- }
856
- }
687
+ renderLoadedResources({
688
+ session: this.session,
689
+ chatContainer: this.chatContainer,
690
+ verbose: this.options.verbose ?? false,
691
+ expanded: this.getStartupExpansionState(),
692
+ }, options);
857
693
  }
858
694
  /**
859
695
  * Initialize the extension system with TUI-based UI context.
860
696
  */
861
697
  async bindCurrentSessionExtensions() {
862
- const uiContext = this.extensionUiHost.createExtensionUIContext();
698
+ const uiContext = this.hasHumanAudience ? this.extensionUiHost.createExtensionUIContext() : undefined;
863
699
  await this.session.bindExtensions({
864
700
  uiContext,
865
- mode: "tui",
701
+ mode: this.hasHumanAudience ? "tui" : "print",
866
702
  abortHandler: () => {
867
703
  this.restoreQueuedMessagesToEditor({ abort: true });
868
704
  },
@@ -987,7 +823,7 @@ export class InteractiveMode {
987
823
  await this.updateAvailableProviderCount();
988
824
  this.updateEditorBorderColor();
989
825
  this.updateTerminalTitle();
990
- this.refreshOrchestrationWidget();
826
+ this.refreshActivityLane({ replace: true });
991
827
  try {
992
828
  await this.session.resumePendingHumanInput();
993
829
  }
@@ -1082,21 +918,21 @@ export class InteractiveMode {
1082
918
  return;
1083
919
  }
1084
920
  }
1085
- attachToolExecutionComponent(toolName, toolCallId, args, repair) {
921
+ attachToolExecutionComponent(toolName, toolCallId, args, repair, deferResultUntilExpanded = false) {
1086
922
  const actionKey = getToolPanelActionKey(this.getToolPanelScope(), toolName, args);
1087
923
  const toolDefinition = this.getRegisteredToolDefinition(toolName);
1088
924
  const reuseInPlace = shouldReuseToolPanelInPlace(toolName, args);
1089
925
  const existing = this.toolPanels.getReusable(actionKey, { allowActive: reuseInPlace });
1090
926
  if (existing) {
1091
927
  if (reuseInPlace && actionKey) {
1092
- existing.resetInvocation(toolName, toolCallId, args, toolDefinition, repair);
928
+ existing.resetInvocation(toolName, toolCallId, args, toolDefinition, repair, deferResultUntilExpanded);
1093
929
  existing.setExpanded(this.toolOutputExpanded);
1094
930
  this.toolPanels.replaceActiveForAction(toolCallId, existing, actionKey);
1095
931
  this.ui.requestRender();
1096
932
  return existing;
1097
933
  }
1098
934
  this.detachToolExecutionComponent(existing);
1099
- existing.resetInvocation(toolName, toolCallId, args, toolDefinition, repair);
935
+ existing.resetInvocation(toolName, toolCallId, args, toolDefinition, repair, deferResultUntilExpanded);
1100
936
  existing.setExpanded(this.toolOutputExpanded);
1101
937
  this.appendToolExecutionComponent(existing, true);
1102
938
  this.toolPanels.register(toolCallId, existing, actionKey);
@@ -1106,6 +942,7 @@ export class InteractiveMode {
1106
942
  showImages: this.settingsManager.getShowImages(),
1107
943
  imageWidthCells: this.settingsManager.getImageWidthCells(),
1108
944
  repair,
945
+ deferResultUntilExpanded,
1109
946
  }, toolDefinition, this.ui, this.sessionManager.getCwd());
1110
947
  component.setExpanded(this.toolOutputExpanded);
1111
948
  this.appendToolExecutionComponent(component, true);
@@ -1130,8 +967,15 @@ export class InteractiveMode {
1130
967
  this.loadingAnimation = undefined;
1131
968
  }
1132
969
  this.statusContainer.clear();
970
+ this.activityLane?.remove("runtime:routing");
971
+ this.activityLane?.remove("runtime:turn");
1133
972
  }
1134
973
  setWorkingVisible(visible) {
974
+ if (!this.hasHumanAudience) {
975
+ this.workingVisible = false;
976
+ this.stopWorkingLoader();
977
+ return;
978
+ }
1135
979
  this.workingVisible = visible;
1136
980
  if (!visible) {
1137
981
  this.stopWorkingLoader();
@@ -1139,15 +983,39 @@ export class InteractiveMode {
1139
983
  return;
1140
984
  }
1141
985
  if (this.session.isStreaming && !this.loadingAnimation) {
1142
- this.statusContainer.clear();
1143
- this.loadingAnimation = this.createWorkingLoader();
1144
- this.statusContainer.addChild(this.loadingAnimation);
986
+ if (this.workingIndicatorOptions) {
987
+ this.statusContainer.clear();
988
+ this.loadingAnimation = this.createWorkingLoader();
989
+ this.statusContainer.addChild(this.loadingAnimation);
990
+ }
991
+ else {
992
+ this.activityLane?.start({ id: "runtime:turn", kind: "runtime", label: this.getWorkingLoaderMessage() });
993
+ }
1145
994
  }
1146
995
  this.ui.requestRender();
1147
996
  }
1148
997
  setWorkingIndicator(options) {
1149
998
  this.workingIndicatorOptions = options;
1150
- this.loadingAnimation?.setIndicator(options);
999
+ if (!this.hasHumanAudience) {
1000
+ this.stopWorkingLoader();
1001
+ return;
1002
+ }
1003
+ if (options) {
1004
+ this.activityLane?.remove("runtime:turn");
1005
+ if (this.session.isStreaming && this.workingVisible) {
1006
+ this.stopWorkingLoader();
1007
+ this.loadingAnimation = this.createWorkingLoader();
1008
+ this.statusContainer.addChild(this.loadingAnimation);
1009
+ }
1010
+ }
1011
+ else {
1012
+ this.loadingAnimation?.stop();
1013
+ this.loadingAnimation = undefined;
1014
+ this.statusContainer.clear();
1015
+ if (this.session.isStreaming && this.workingVisible) {
1016
+ this.activityLane?.start({ id: "runtime:turn", kind: "runtime", label: this.getWorkingLoaderMessage() });
1017
+ }
1018
+ }
1151
1019
  this.ui.requestRender();
1152
1020
  }
1153
1021
  setHiddenThinkingLabel(label) {
@@ -1170,13 +1038,14 @@ export class InteractiveMode {
1170
1038
  if (this.loadingAnimation) {
1171
1039
  this.loadingAnimation.setMessage(message ?? this.defaultWorkingMessage);
1172
1040
  }
1041
+ this.activityLane?.update("runtime:turn", message ?? this.defaultWorkingMessage);
1173
1042
  }
1174
1043
  /**
1175
1044
  * Reset the working indicator and hidden-thinking label to their built-in defaults.
1176
1045
  */
1177
1046
  resetWorkingIndicators() {
1178
1047
  this.workingMessage = undefined;
1179
- this.workingVisible = true;
1048
+ this.workingVisible = this.hasHumanAudience;
1180
1049
  this.setWorkingIndicator();
1181
1050
  if (this.loadingAnimation) {
1182
1051
  this.loadingAnimation.setMessage(`${this.defaultWorkingMessage} (${keyText("app.interrupt")} to interrupt)`);
@@ -1462,7 +1331,12 @@ export class InteractiveMode {
1462
1331
  this.editor.setText("");
1463
1332
  return;
1464
1333
  }
1465
- if (text === "/usage" || text === "/cost") {
1334
+ if (text === "/usage") {
1335
+ this.handleUsageMenuCommand();
1336
+ this.editor.setText("");
1337
+ return;
1338
+ }
1339
+ if (text === "/cost") {
1466
1340
  this.handleUsageCommand();
1467
1341
  this.editor.setText("");
1468
1342
  return;
@@ -1617,324 +1491,8 @@ export class InteractiveMode {
1617
1491
  await this.handleEvent(event);
1618
1492
  });
1619
1493
  }
1620
- async handleEvent(event) {
1621
- if (!this.isInitialized) {
1622
- await this.init();
1623
- }
1624
- this.footer.invalidate();
1625
- switch (event.type) {
1626
- // Part B: general "the system is processing" feedback for the routing/prep gap before a
1627
- // turn starts streaming (the judge is a real bounded LLM call, not instant) — independent
1628
- // of thinking level, since this isn't model-thinking. Reuses the same working loader
1629
- // agent_start below uses, so the hand-off into real streaming is the same
1630
- // stop-then-recreate it already does — no distinct spinner, no double-render.
1631
- case "routing_start":
1632
- if (!this.session.isStreaming && !this.loadingAnimation && this.workingVisible) {
1633
- this.loadingAnimation = this.createWorkingLoader();
1634
- this.statusContainer.addChild(this.loadingAnimation);
1635
- this.ui.requestRender();
1636
- }
1637
- break;
1638
- case "routing_end":
1639
- // Unconditional: covers both a clean hand-off into agent_start (which immediately
1640
- // stops-and-recreates its own loader anyway) and a turn that failed before ever
1641
- // starting, which must not leave the indicator spinning forever.
1642
- this.stopWorkingLoader();
1643
- this.ui.requestRender();
1644
- break;
1645
- case "agent_start":
1646
- this.clearActiveToolCalls();
1647
- if (this.settingsManager.getShowTerminalProgress()) {
1648
- this.ui.terminal.setProgress(true);
1649
- }
1650
- // Restore main escape handler if retry handler is still active
1651
- // (retry success event fires later, but we need main handler now)
1652
- if (this.retryEscapeHandler) {
1653
- this.defaultEditor.onEscape = this.retryEscapeHandler;
1654
- this.retryEscapeHandler = undefined;
1655
- }
1656
- if (this.retryCountdown) {
1657
- this.retryCountdown.dispose();
1658
- this.retryCountdown = undefined;
1659
- }
1660
- if (this.retryLoader) {
1661
- this.retryLoader.stop();
1662
- this.retryLoader = undefined;
1663
- }
1664
- this.stopWorkingLoader();
1665
- if (this.workingVisible) {
1666
- this.loadingAnimation = this.createWorkingLoader();
1667
- this.statusContainer.addChild(this.loadingAnimation);
1668
- }
1669
- this.ui.requestRender();
1670
- break;
1671
- case "queue_update":
1672
- this.updatePendingMessagesDisplay();
1673
- this.ui.requestRender();
1674
- break;
1675
- case "session_info_changed":
1676
- this.updateTerminalTitle();
1677
- this.refreshOrchestrationWidget();
1678
- this.footer.invalidate();
1679
- this.ui.requestRender();
1680
- break;
1681
- case "thinking_level_changed":
1682
- this.footer.invalidate();
1683
- this.updateEditorBorderColor();
1684
- break;
1685
- case "warning":
1686
- this.showWarning(event.message);
1687
- break;
1688
- case "delegate_workers": {
1689
- const activeParts = [
1690
- event.running > 0 ? `${event.running} running` : undefined,
1691
- event.queued > 0 ? `${event.queued} queued` : undefined,
1692
- ].filter((part) => part !== undefined);
1693
- const latestTerminal = event.terminalSinceFlush.at(-1);
1694
- const terminalStatus = event.terminalSinceFlush.length === 1 && latestTerminal
1695
- ? `${latestTerminal.laneId} ${latestTerminal.status}`
1696
- : event.failedSinceFlush > 0
1697
- ? `${event.failedSinceFlush} failed`
1698
- : event.completedSinceFlush > 0
1699
- ? `${event.completedSinceFlush} completed`
1700
- : undefined;
1701
- const status = activeParts.length > 0 ? activeParts.join(", ") : terminalStatus;
1702
- this.footerDataProvider.setExtensionStatus("delegate", status ? `delegate: ${status}` : undefined);
1703
- this.refreshOrchestrationWidget();
1704
- this.footer.invalidate();
1705
- break;
1706
- }
1707
- case "message_start":
1708
- if (event.message.role === "custom") {
1709
- this.addMessageToChat(event.message);
1710
- this.ui.requestRender();
1711
- }
1712
- else if (event.message.role === "user") {
1713
- this.addMessageToChat(event.message);
1714
- this.updatePendingMessagesDisplay();
1715
- this.ui.requestRender();
1716
- }
1717
- else if (event.message.role === "assistant") {
1718
- this.clearPendingStreamingUiUpdate();
1719
- this.lastStreamingUiUpdateAt = 0;
1720
- this.streamingComponent = new AssistantMessageComponent(undefined, this.hideThinkingBlock, this.getMarkdownThemeWithSettings(), this.hiddenThinkingLabel);
1721
- this.streamingMessage = event.message;
1722
- this.chatContainer.addChild(this.streamingComponent);
1723
- this.applyStreamingMessageUpdate(this.streamingMessage, { force: true });
1724
- this.trimLiveTuiHistory();
1725
- }
1726
- break;
1727
- case "message_update":
1728
- if (this.streamingComponent && event.message.role === "assistant") {
1729
- this.applyStreamingMessageUpdate(event.message);
1730
- }
1731
- break;
1732
- case "message_end":
1733
- if (event.message.role === "user")
1734
- break;
1735
- if (this.streamingComponent && event.message.role === "assistant") {
1736
- this.streamingMessage = event.message;
1737
- let errorMessage;
1738
- if (this.streamingMessage.stopReason === "aborted") {
1739
- const retryAttempt = this.session.retryAttempt;
1740
- errorMessage =
1741
- retryAttempt > 0
1742
- ? `Aborted after ${retryAttempt} retry attempt${retryAttempt > 1 ? "s" : ""}`
1743
- : "Operation aborted";
1744
- this.streamingMessage.errorMessage = errorMessage;
1745
- }
1746
- this.applyStreamingMessageUpdate(this.streamingMessage, { force: true });
1747
- if (this.streamingMessage.stopReason === "aborted" || this.streamingMessage.stopReason === "error") {
1748
- if (!errorMessage) {
1749
- errorMessage = this.streamingMessage.errorMessage || "Error";
1750
- }
1751
- for (const [, component] of this.toolPanels.activeEntries()) {
1752
- component.updateResult({
1753
- content: [{ type: "text", text: errorMessage }],
1754
- isError: true,
1755
- });
1756
- }
1757
- this.clearActiveToolCalls();
1758
- }
1759
- else {
1760
- // Args are now complete - trigger diff computation for edit tools
1761
- for (const [, component] of this.toolPanels.activeEntries()) {
1762
- component.setArgsComplete();
1763
- }
1764
- }
1765
- this.streamingComponent = undefined;
1766
- this.streamingMessage = undefined;
1767
- this.footer.invalidate();
1768
- }
1769
- this.ui.requestRender();
1770
- break;
1771
- case "tool_execution_start": {
1772
- let component = this.toolPanels.getActive(event.toolCallId);
1773
- if (!component)
1774
- component = this.attachToolExecutionComponent(event.toolName, event.toolCallId, event.args, event.repair);
1775
- else
1776
- component.updateArgs(event.args, event.repair);
1777
- component.markExecutionStarted(event.repair);
1778
- this.ui.requestRender();
1779
- break;
1780
- }
1781
- case "tool_execution_update": {
1782
- const component = this.toolPanels.getActive(event.toolCallId);
1783
- if (component) {
1784
- component.updateArgs(event.args, event.repair);
1785
- component.updateResult({ ...event.partialResult, isError: false }, true);
1786
- this.ui.requestRender();
1787
- }
1788
- break;
1789
- }
1790
- case "tool_execution_end": {
1791
- const component = this.toolPanels.getActive(event.toolCallId);
1792
- if (component) {
1793
- component.updateResult({ ...event.result, isError: event.isError });
1794
- this.toolPanels.registerAliases(component, getToolPanelResultActionKeys(this.getToolPanelScope(), event.toolName, event.result));
1795
- this.toolPanels.finish(event.toolCallId);
1796
- this.ui.requestRender();
1797
- }
1798
- if (event.toolName === "task_steps" ||
1799
- event.toolName === "delegate" ||
1800
- event.toolName === "delegate_status") {
1801
- this.refreshOrchestrationWidget();
1802
- }
1803
- break;
1804
- }
1805
- case "agent_end":
1806
- // Native in-process reflection fully replaces the subprocess learning paths
1807
- // (continuous-learning AND autonomy-review) when enabled; otherwise fall back to legacy.
1808
- if (this.isNativeReflectionEnabled()) {
1809
- this.maybeRunNativeReflection(event.messages);
1810
- }
1811
- else if (!this.maybeStartAutoLearn()) {
1812
- this.maybeStartAutonomyReview(event.messages);
1813
- }
1814
- if (this.settingsManager.getShowTerminalProgress()) {
1815
- this.ui.terminal.setProgress(false);
1816
- }
1817
- if (this.loadingAnimation) {
1818
- this.loadingAnimation.stop();
1819
- this.loadingAnimation = undefined;
1820
- this.statusContainer.clear();
1821
- }
1822
- if (this.streamingComponent) {
1823
- this.chatContainer.removeChild(this.streamingComponent);
1824
- this.streamingComponent = undefined;
1825
- this.streamingMessage = undefined;
1826
- }
1827
- this.clearActiveToolCalls();
1828
- await this.checkShutdownRequested();
1829
- this.ui.requestRender();
1830
- break;
1831
- case "compaction_start": {
1832
- if (this.settingsManager.getShowTerminalProgress()) {
1833
- this.ui.terminal.setProgress(true);
1834
- }
1835
- // Keep editor active; submissions are queued during compaction.
1836
- this.autoCompactionEscapeHandler = this.defaultEditor.onEscape;
1837
- this.defaultEditor.onEscape = () => {
1838
- this.session.abortCompaction();
1839
- };
1840
- this.statusContainer.clear();
1841
- const cancelHint = `(${keyText("app.interrupt")} to cancel)`;
1842
- const label = event.reason === "manual"
1843
- ? `Compacting context... ${cancelHint}`
1844
- : `${event.reason === "overflow" ? "Context overflow detected, " : ""}Auto-compacting... ${cancelHint}`;
1845
- this.autoCompactionLoader = new Loader(this.ui, (spinner) => theme.fg("accent", spinner), (text) => theme.fg("muted", text), label);
1846
- this.statusContainer.addChild(this.autoCompactionLoader);
1847
- this.ui.requestRender();
1848
- break;
1849
- }
1850
- case "compaction_end": {
1851
- if (this.settingsManager.getShowTerminalProgress()) {
1852
- this.ui.terminal.setProgress(false);
1853
- }
1854
- if (this.autoCompactionEscapeHandler) {
1855
- this.defaultEditor.onEscape = this.autoCompactionEscapeHandler;
1856
- this.autoCompactionEscapeHandler = undefined;
1857
- }
1858
- if (this.autoCompactionLoader) {
1859
- this.autoCompactionLoader.stop();
1860
- this.autoCompactionLoader = undefined;
1861
- this.statusContainer.clear();
1862
- }
1863
- if (event.aborted) {
1864
- if (event.reason === "manual") {
1865
- this.showError("Compaction cancelled");
1866
- }
1867
- else {
1868
- this.showStatus("Auto-compaction cancelled");
1869
- }
1870
- }
1871
- else if (event.result) {
1872
- await this.rebuildChatFromMessages();
1873
- this.addMessageToChat(createCompactionSummaryMessage(event.result.summary, event.result.tokensBefore, new Date().toISOString()));
1874
- this.footer.invalidate();
1875
- }
1876
- else if (event.errorMessage) {
1877
- if (event.reason === "manual") {
1878
- this.showError(event.errorMessage);
1879
- }
1880
- else {
1881
- this.chatContainer.addChild(new Spacer(1));
1882
- this.chatContainer.addChild(new Text(theme.fg("error", event.errorMessage), 1, 0));
1883
- }
1884
- }
1885
- else if (event.skipReason) {
1886
- // Benign auto-compaction no-op: still tell the user WHY nothing changed —
1887
- // an invisible skip is indistinguishable from broken compaction.
1888
- this.showStatus(`Auto-compaction skipped: ${event.skipReason}`);
1889
- }
1890
- void this.flushCompactionQueue({ willRetry: event.willRetry });
1891
- this.ui.requestRender();
1892
- break;
1893
- }
1894
- case "auto_retry_start": {
1895
- // Set up escape to abort retry
1896
- this.retryEscapeHandler = this.defaultEditor.onEscape;
1897
- this.defaultEditor.onEscape = () => {
1898
- this.session.abortRetry();
1899
- };
1900
- // Show retry indicator
1901
- this.statusContainer.clear();
1902
- this.retryCountdown?.dispose();
1903
- const retryMessage = (seconds) => `Retrying (${event.attempt}/${event.maxAttempts}) in ${seconds}s... (${keyText("app.interrupt")} to cancel)`;
1904
- this.retryLoader = new Loader(this.ui, (spinner) => theme.fg("warning", spinner), (text) => theme.fg("muted", text), retryMessage(Math.ceil(event.delayMs / 1000)));
1905
- this.retryCountdown = new CountdownTimer(event.delayMs, this.ui, (seconds) => {
1906
- this.retryLoader?.setMessage(retryMessage(seconds));
1907
- }, () => {
1908
- this.retryCountdown = undefined;
1909
- });
1910
- this.statusContainer.addChild(this.retryLoader);
1911
- this.ui.requestRender();
1912
- break;
1913
- }
1914
- case "auto_retry_end": {
1915
- // Restore escape handler
1916
- if (this.retryEscapeHandler) {
1917
- this.defaultEditor.onEscape = this.retryEscapeHandler;
1918
- this.retryEscapeHandler = undefined;
1919
- }
1920
- if (this.retryCountdown) {
1921
- this.retryCountdown.dispose();
1922
- this.retryCountdown = undefined;
1923
- }
1924
- // Stop loader
1925
- if (this.retryLoader) {
1926
- this.retryLoader.stop();
1927
- this.retryLoader = undefined;
1928
- this.statusContainer.clear();
1929
- }
1930
- // Show error only on final failure (success shows normal response)
1931
- if (!event.success) {
1932
- this.showError(`Retry failed after ${event.attempt} attempts: ${event.finalError || "Unknown error"}`);
1933
- }
1934
- this.ui.requestRender();
1935
- break;
1936
- }
1937
- }
1494
+ handleEvent(event) {
1495
+ return handleInteractiveEvent(this, event);
1938
1496
  }
1939
1497
  /** Extract text content from a user message */
1940
1498
  // Thin `this.`-delegate to the pure formatter in ./history-reload-math.ts; kept so
@@ -2127,6 +1685,8 @@ export class InteractiveMode {
2127
1685
  * we update the previous status line instead of appending new ones to avoid log spam.
2128
1686
  */
2129
1687
  showStatus(message) {
1688
+ if (!this.hasHumanAudience)
1689
+ return;
2130
1690
  this.appendStatusToChat(message);
2131
1691
  }
2132
1692
  addMessageToChat(message, options) {
@@ -2209,7 +1769,9 @@ export class InteractiveMode {
2209
1769
  // Thin `this.`-delegate to the pure reload-window math in ./history-reload-math.ts;
2210
1770
  // kept so renderSessionContext and the prototype-based history tests resolve it via `this`.
2211
1771
  messagesForTuiHistoryReload(messages) {
2212
- return historyReloadMath.messagesForTuiHistoryReload(messages);
1772
+ return historyReloadMath.messagesForTuiHistoryReload(messages, {
1773
+ includeToolResultContent: this.toolOutputExpanded,
1774
+ });
2213
1775
  }
2214
1776
  /**
2215
1777
  * Render session context to chat. Used for initial load and rebuild after compaction.
@@ -2260,7 +1822,7 @@ export class InteractiveMode {
2260
1822
  // Render tool call components
2261
1823
  for (const content of message.content) {
2262
1824
  if (content.type === "toolCall") {
2263
- const component = this.attachToolExecutionComponent(content.name, content.id, content.arguments);
1825
+ const component = this.attachToolExecutionComponent(content.name, content.id, content.arguments, undefined, true);
2264
1826
  if (message.stopReason === "aborted" || message.stopReason === "error") {
2265
1827
  let errorMessage;
2266
1828
  if (message.stopReason === "aborted") {
@@ -2637,20 +2199,28 @@ export class InteractiveMode {
2637
2199
  }
2638
2200
  updatePendingMessagesDisplay() {
2639
2201
  this.pendingMessagesContainer.clear();
2202
+ for (const component of this.pendingBashComponents)
2203
+ this.pendingMessagesContainer.addChild(component);
2640
2204
  const { steering: steeringMessages, followUp: followUpMessages } = this.getAllQueuedMessages();
2641
- if (steeringMessages.length > 0 || followUpMessages.length > 0) {
2642
- this.pendingMessagesContainer.addChild(new Spacer(1));
2643
- for (const message of steeringMessages) {
2644
- const text = theme.fg("dim", `Steering: ${message}`);
2645
- this.pendingMessagesContainer.addChild(new TruncatedText(text, 1, 0));
2646
- }
2647
- for (const message of followUpMessages) {
2648
- const text = theme.fg("dim", `Follow-up: ${message}`);
2649
- this.pendingMessagesContainer.addChild(new TruncatedText(text, 1, 0));
2650
- }
2205
+ const steeringCount = steeringMessages.length;
2206
+ const followUpCount = followUpMessages.length;
2207
+ const total = steeringCount + followUpCount;
2208
+ if (total > 0) {
2651
2209
  const dequeueHint = this.getAppKeyDisplay("app.message.dequeue");
2652
- const hintText = theme.fg("dim", `↳ ${dequeueHint} to edit all queued messages`);
2653
- this.pendingMessagesContainer.addChild(new TruncatedText(hintText, 1, 0));
2210
+ const details = [
2211
+ steeringCount > 0 ? `${steeringCount} steering` : undefined,
2212
+ followUpCount > 0 ? `${followUpCount} follow-up` : undefined,
2213
+ ]
2214
+ .filter((value) => value !== undefined)
2215
+ .join(" · ");
2216
+ this.activityLane?.wait({
2217
+ id: "queue:messages",
2218
+ kind: "queue",
2219
+ label: `Queued ${total} · ${details} · ${dequeueHint} edit`,
2220
+ });
2221
+ }
2222
+ else {
2223
+ this.activityLane?.remove("queue:messages");
2654
2224
  }
2655
2225
  }
2656
2226
  restoreQueuedMessagesToEditor(options) {
@@ -3268,7 +2838,7 @@ export class InteractiveMode {
3268
2838
  }, text);
3269
2839
  }
3270
2840
  parseGoalContinueCommand(text) {
3271
- const usage = "Usage: /goal-continue [maxTurns 1-20] [maxStallTurns 0-100] [maxMinutes 0-1440]";
2841
+ const usage = "Usage: /goal-continue [maxTurns 0=unbounded] [maxStallTurns 0-100] [maxMinutes 0-1440]";
3272
2842
  const parts = text.trim().split(/\s+/).slice(1);
3273
2843
  if (parts.length > 3) {
3274
2844
  return { ok: false, error: usage };
@@ -3283,7 +2853,7 @@ export class InteractiveMode {
3283
2853
  return undefined;
3284
2854
  return parsed;
3285
2855
  };
3286
- const maxTurns = parseBoundedInteger(parts[0], DEFAULT_GOAL_CONTINUE_MAX_TURNS, 1, MAX_GOAL_CONTINUE_MAX_TURNS);
2856
+ const maxTurns = parseBoundedInteger(parts[0], DEFAULT_GOAL_CONTINUE_MAX_TURNS, 0, MAX_GOAL_CONTINUE_MAX_TURNS);
3287
2857
  const maxStallTurns = parseBoundedInteger(parts[1], DEFAULT_GOAL_CONTINUE_MAX_STALL_TURNS, 0, MAX_GOAL_CONTINUE_MAX_STALL_TURNS);
3288
2858
  const maxWallClockMinutes = parseBoundedInteger(parts[2], DEFAULT_GOAL_CONTINUE_MAX_WALL_CLOCK_MINUTES, 0, MAX_GOAL_CONTINUE_MAX_WALL_CLOCK_MINUTES);
3289
2859
  if (maxTurns === undefined || maxStallTurns === undefined || maxWallClockMinutes === undefined) {
@@ -3292,29 +2862,45 @@ export class InteractiveMode {
3292
2862
  return { ok: true, maxTurns, maxStallTurns, maxWallClockMinutes };
3293
2863
  }
3294
2864
  async handleGoalCommand(text) {
2865
+ let statusMessage;
3295
2866
  await sessionFlows.handleGoalCommand({
3296
2867
  session: this.session,
3297
- showStatus: (message) => this.showStatus(message),
2868
+ promptForGoalEdit: (currentObjective) => this.extensionUiHost.showExtensionEditor("Edit goal objective", currentObjective),
2869
+ getMaxStallTurns: () => this.settingsManager?.getAutonomySettings().maxStallTurns ?? 20,
2870
+ showStatus: (message) => {
2871
+ statusMessage = message;
2872
+ },
3298
2873
  showError: (message) => this.showError(message),
3299
2874
  refreshAutonomyFooterStatus: () => this.refreshAutonomyFooterStatus(),
3300
2875
  }, text);
2876
+ this.refreshActivityLane?.();
2877
+ if (statusMessage)
2878
+ this.activityLane?.announce(statusMessage, "neutral");
3301
2879
  }
3302
2880
  handleTaskCommand(text) {
2881
+ let statusMessage;
3303
2882
  sessionFlows.handleTaskCommand({
3304
2883
  session: this.session,
3305
- showStatus: (message) => this.showStatus(message),
2884
+ showStatus: (message) => {
2885
+ statusMessage = message;
2886
+ },
3306
2887
  showError: (message) => this.showError(message),
3307
2888
  }, text);
3308
- this.refreshOrchestrationWidget();
2889
+ this.refreshActivityLane?.();
2890
+ const state = this.session.getTaskStepsStateSnapshot();
2891
+ if ((!state || state.steps.length === 0 || statusMessage?.startsWith("/task ")) && statusMessage) {
2892
+ this.activityLane?.announce(statusMessage, "neutral");
2893
+ }
3309
2894
  }
3310
2895
  async handleGoalContinueCommand(text) {
3311
2896
  await sessionFlows.handleGoalContinueCommand({
3312
2897
  session: this.session,
3313
2898
  parseGoalContinueCommand: (t) => this.parseGoalContinueCommand(t),
3314
- showStatus: (message) => this.showStatus(message),
2899
+ showStatus: (message) => this.activityLane?.announce(message),
3315
2900
  showError: (message) => this.showError(message),
3316
2901
  refreshAutonomyFooterStatus: () => this.refreshAutonomyFooterStatus(),
3317
2902
  }, text);
2903
+ this.refreshActivityLane?.();
3318
2904
  }
3319
2905
  handleSessionCommand() {
3320
2906
  sessionFlows.handleSessionCommand({
@@ -3332,6 +2918,15 @@ export class InteractiveMode {
3332
2918
  getCurrentAutoLearnSettings: () => this.getCurrentAutoLearnSettings(),
3333
2919
  });
3334
2920
  }
2921
+ handleUsageMenuCommand() {
2922
+ usageCommands.handleUsageMenuCommand({
2923
+ session: this.session,
2924
+ showSelector: (create) => this.showSelector(create),
2925
+ showStatus: (message) => this.showStatus(message),
2926
+ showError: (message) => this.showError(message),
2927
+ showUsageReport: () => this.handleUsageCommand(),
2928
+ });
2929
+ }
3335
2930
  handleChangelogCommand() {
3336
2931
  reportCommands.handleChangelogCommand({
3337
2932
  chatContainer: this.chatContainer,
@@ -3483,17 +3078,9 @@ export class InteractiveMode {
3483
3078
  }, command, excludeFromContext);
3484
3079
  }
3485
3080
  handleCompactCommand(customInstructions) {
3486
- const self = this;
3487
3081
  return resourceShellCommands.handleCompactCommand({
3488
3082
  sessionManager: this.sessionManager,
3489
3083
  showWarning: (message) => this.showWarning(message),
3490
- get loadingAnimation() {
3491
- return self.loadingAnimation;
3492
- },
3493
- set loadingAnimation(value) {
3494
- self.loadingAnimation = value;
3495
- },
3496
- statusContainer: this.statusContainer,
3497
3084
  session: this.session,
3498
3085
  }, customInstructions);
3499
3086
  }
@@ -3510,6 +3097,7 @@ export class InteractiveMode {
3510
3097
  this.extensionUiHost.clearHostWidgets();
3511
3098
  this.extensionUiHost.resetExtensionUI();
3512
3099
  this.overlayHost.unmount();
3100
+ this.activityLane?.dispose();
3513
3101
  this.footer.dispose();
3514
3102
  this.footerDataProvider.dispose();
3515
3103
  if (this.unsubscribe) {