kimaki 1.4.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (326) hide show
  1. package/assets/fonts/Geist-Bold.ttf +0 -0
  2. package/assets/fonts/Geist-Regular.ttf +0 -0
  3. package/assets/fonts/GeistMono-Regular.ttf +0 -0
  4. package/assets/fonts/OFL.txt +92 -0
  5. package/dist/agent-ui.e2e.test.js +27 -13
  6. package/dist/agent-ui.e2e.test.js.map +1 -1
  7. package/dist/agent-ui.js +2 -1
  8. package/dist/agent-ui.js.map +1 -1
  9. package/dist/analytics.e2e.test.js +1 -1
  10. package/dist/analytics.e2e.test.js.map +1 -1
  11. package/dist/autostart.d.ts +4 -0
  12. package/dist/autostart.js +55 -10
  13. package/dist/autostart.js.map +1 -1
  14. package/dist/bot.d.ts +10 -1
  15. package/dist/bot.js +14 -6
  16. package/dist/bot.js.map +1 -1
  17. package/dist/btw.e2e.test.js +3 -3
  18. package/dist/builtin-skills.d.ts +1 -1
  19. package/dist/builtin-skills.js +1 -1
  20. package/dist/builtin-skills.js.map +1 -1
  21. package/dist/builtin-skills.test.js +3 -4
  22. package/dist/builtin-skills.test.js.map +1 -1
  23. package/dist/catalog-refresh.e2e.test.js +2 -2
  24. package/dist/cli/bot.js +25 -14
  25. package/dist/cli/bot.js.map +1 -1
  26. package/dist/cli/discord.js +32 -6
  27. package/dist/cli/discord.js.map +1 -1
  28. package/dist/cli/schedule.js +23 -9
  29. package/dist/cli/schedule.js.map +1 -1
  30. package/dist/cli/session.js +37 -12
  31. package/dist/cli/session.js.map +1 -1
  32. package/dist/cli/shared.d.ts +5 -3
  33. package/dist/cli/shared.js +45 -10
  34. package/dist/cli/shared.js.map +1 -1
  35. package/dist/cli-discord.e2e.test.js +13 -8
  36. package/dist/cli-discord.e2e.test.js.map +1 -1
  37. package/dist/cli-lock.e2e.test.js +87 -20
  38. package/dist/cli-lock.e2e.test.js.map +1 -1
  39. package/dist/cli-read.e2e.test.js +18 -9
  40. package/dist/cli-read.e2e.test.js.map +1 -1
  41. package/dist/cli-sessions.e2e.test.js +4 -3
  42. package/dist/cli-sessions.e2e.test.js.map +1 -1
  43. package/dist/cli.js +2 -0
  44. package/dist/cli.js.map +1 -1
  45. package/dist/commands/preference-commands.d.ts +4 -0
  46. package/dist/commands/preference-commands.js +38 -4
  47. package/dist/commands/preference-commands.js.map +1 -1
  48. package/dist/commands/session-commands.js +11 -8
  49. package/dist/commands/session-commands.js.map +1 -1
  50. package/dist/commands/thread-commands.js +94 -24
  51. package/dist/commands/thread-commands.js.map +1 -1
  52. package/dist/commands/worktree-commands.d.ts +4 -5
  53. package/dist/commands/worktree-commands.js +8 -7
  54. package/dist/commands/worktree-commands.js.map +1 -1
  55. package/dist/commands.e2e.test.js +25 -21
  56. package/dist/commands.e2e.test.js.map +1 -1
  57. package/dist/coordinator-agents.e2e.test.js +135 -0
  58. package/dist/coordinator-agents.e2e.test.js.map +1 -0
  59. package/dist/coordinator-idle.e2e.test.js +100 -0
  60. package/dist/coordinator-idle.e2e.test.js.map +1 -0
  61. package/dist/coordinator-queue.e2e.test.js +244 -0
  62. package/dist/coordinator-queue.e2e.test.js.map +1 -0
  63. package/dist/coordinator-warmup.e2e.test.d.ts +1 -0
  64. package/dist/coordinator-warmup.e2e.test.js +131 -0
  65. package/dist/coordinator-warmup.e2e.test.js.map +1 -0
  66. package/dist/coordinator.d.ts +6 -0
  67. package/dist/coordinator.e2e.test.d.ts +1 -0
  68. package/dist/coordinator.e2e.test.js +505 -0
  69. package/dist/coordinator.e2e.test.js.map +1 -0
  70. package/dist/coordinator.js +164 -0
  71. package/dist/coordinator.js.map +1 -0
  72. package/dist/db.d.ts +75 -0
  73. package/dist/db.test.js +1 -0
  74. package/dist/db.test.js.map +1 -1
  75. package/dist/diagram.d.ts +11 -0
  76. package/dist/diagram.js +232 -0
  77. package/dist/diagram.js.map +1 -0
  78. package/dist/diagram.test.d.ts +1 -0
  79. package/dist/diagram.test.js +52 -0
  80. package/dist/diagram.test.js.map +1 -0
  81. package/dist/duration.js +13 -5
  82. package/dist/duration.js.map +1 -1
  83. package/dist/effects.d.ts +6 -1
  84. package/dist/effects.js +97 -26
  85. package/dist/effects.js.map +1 -1
  86. package/dist/event-loop.d.ts +1 -1
  87. package/dist/event-loop.js +73 -43
  88. package/dist/event-loop.js.map +1 -1
  89. package/dist/format-parts.d.ts +21 -4
  90. package/dist/format-parts.js +40 -23
  91. package/dist/format-parts.js.map +1 -1
  92. package/dist/gateway-replay.e2e.test.js +4 -4
  93. package/dist/harness.e2e.test.js +2 -2
  94. package/dist/harness.e2e.test.js.map +1 -1
  95. package/dist/hello-thread.e2e.test.js +56 -5
  96. package/dist/hello-thread.e2e.test.js.map +1 -1
  97. package/dist/ingress.js +68 -13
  98. package/dist/ingress.js.map +1 -1
  99. package/dist/interaction-context.d.ts +4 -4
  100. package/dist/interaction-context.js +9 -7
  101. package/dist/interaction-context.js.map +1 -1
  102. package/dist/interrupt.e2e.test.js +8 -5
  103. package/dist/interrupt.e2e.test.js.map +1 -1
  104. package/dist/legacy.e2e.test.js +1 -1
  105. package/dist/lock-routes.d.ts +68 -16
  106. package/dist/lock-routes.js +68 -8
  107. package/dist/lock-routes.js.map +1 -1
  108. package/dist/lock-server.d.ts +3 -2
  109. package/dist/lock-server.js +23 -7
  110. package/dist/lock-server.js.map +1 -1
  111. package/dist/main.d.ts +4 -2
  112. package/dist/main.js +13 -3
  113. package/dist/main.js.map +1 -1
  114. package/dist/markdown/markdown.test.js +4 -4
  115. package/dist/markdown/render-markdown.js +6 -5
  116. package/dist/markdown/render-markdown.js.map +1 -1
  117. package/dist/onboarding-cli.e2e.test.js +7 -6
  118. package/dist/onboarding-cli.e2e.test.js.map +1 -1
  119. package/dist/onboarding.d.ts +3 -10
  120. package/dist/onboarding.e2e.test.js +8 -10
  121. package/dist/onboarding.e2e.test.js.map +1 -1
  122. package/dist/onboarding.js +14 -24
  123. package/dist/onboarding.js.map +1 -1
  124. package/dist/permissions.e2e.test.js +3 -3
  125. package/dist/plugin/coordinator.d.ts +4 -0
  126. package/dist/plugin/coordinator.js +389 -0
  127. package/dist/plugin/coordinator.js.map +1 -0
  128. package/dist/plugin/index.js +76 -17
  129. package/dist/plugin/index.js.map +1 -1
  130. package/dist/plugin.e2e.test.js +1 -1
  131. package/dist/preference-commands.e2e.test.js +103 -24
  132. package/dist/preference-commands.e2e.test.js.map +1 -1
  133. package/dist/prompt.d.ts +21 -8
  134. package/dist/prompt.js +64 -48
  135. package/dist/prompt.js.map +1 -1
  136. package/dist/questions.e2e.test.js +13 -13
  137. package/dist/queue-sources.e2e.test.d.ts +1 -0
  138. package/dist/queue-sources.e2e.test.js +168 -0
  139. package/dist/queue-sources.e2e.test.js.map +1 -0
  140. package/dist/queue.d.ts +9 -1
  141. package/dist/queue.e2e.test.js +48 -30
  142. package/dist/queue.e2e.test.js.map +1 -1
  143. package/dist/queue.js +97 -24
  144. package/dist/queue.js.map +1 -1
  145. package/dist/queue.test.d.ts +1 -0
  146. package/dist/queue.test.js +57 -0
  147. package/dist/queue.test.js.map +1 -0
  148. package/dist/remote-send.e2e.test.js +6 -6
  149. package/dist/remote-send.js +2 -1
  150. package/dist/remote-send.js.map +1 -1
  151. package/dist/renderer.e2e.test.js +7 -7
  152. package/dist/restart.e2e.test.js +2 -2
  153. package/dist/routines.e2e.test.js +2 -2
  154. package/dist/scheduler.d.ts +1 -1
  155. package/dist/scheduler.e2e.test.js +43 -20
  156. package/dist/scheduler.e2e.test.js.map +1 -1
  157. package/dist/scheduler.js +4 -2
  158. package/dist/scheduler.js.map +1 -1
  159. package/dist/schema-sql.d.ts +1 -1
  160. package/dist/schema-sql.js +1 -1
  161. package/dist/schema-sql.js.map +1 -1
  162. package/dist/schema.d.ts +146 -0
  163. package/dist/schema.js +12 -0
  164. package/dist/schema.js.map +1 -1
  165. package/dist/session-commands.e2e.test.js +36 -11
  166. package/dist/session-commands.e2e.test.js.map +1 -1
  167. package/dist/session-events.d.ts +19 -7
  168. package/dist/session-events.js +166 -22
  169. package/dist/session-events.js.map +1 -1
  170. package/dist/session-ops.e2e.test.js +88 -11
  171. package/dist/session-ops.e2e.test.js.map +1 -1
  172. package/dist/sessions.d.ts +41 -18
  173. package/dist/sessions.js +174 -63
  174. package/dist/sessions.js.map +1 -1
  175. package/dist/shell.e2e.test.js +4 -4
  176. package/dist/slash-commands.js +12 -6
  177. package/dist/slash-commands.js.map +1 -1
  178. package/dist/slash-commands.test.js +2 -0
  179. package/dist/slash-commands.test.js.map +1 -1
  180. package/dist/sleep.e2e.test.js +29 -14
  181. package/dist/sleep.e2e.test.js.map +1 -1
  182. package/dist/sleeps.d.ts +1 -0
  183. package/dist/sleeps.js +21 -3
  184. package/dist/sleeps.js.map +1 -1
  185. package/dist/store.d.ts +1 -0
  186. package/dist/store.js +3 -2
  187. package/dist/store.js.map +1 -1
  188. package/dist/system-prompt.d.ts +3 -1
  189. package/dist/system-prompt.js +138 -64
  190. package/dist/system-prompt.js.map +1 -1
  191. package/dist/test/generate-log-plugin/index.js +15 -0
  192. package/dist/test/generate-log-plugin/index.js.map +1 -0
  193. package/dist/test/harness.d.ts +20 -1
  194. package/dist/test/harness.js +51 -10
  195. package/dist/test/harness.js.map +1 -1
  196. package/dist/test/replay.js +11 -7
  197. package/dist/test/replay.js.map +1 -1
  198. package/dist/thread-reducer.d.ts +29 -3
  199. package/dist/thread-reducer.fixtures.test.js +58 -51
  200. package/dist/thread-reducer.fixtures.test.js.map +1 -1
  201. package/dist/thread-reducer.js +112 -25
  202. package/dist/thread-reducer.js.map +1 -1
  203. package/dist/thread-reducer.test.js +197 -24
  204. package/dist/thread-reducer.test.js.map +1 -1
  205. package/dist/voice-attachments.e2e.test.js +108 -18
  206. package/dist/voice-attachments.e2e.test.js.map +1 -1
  207. package/dist/voice-call.e2e.test.js +9 -9
  208. package/dist/voice-call.js +6 -6
  209. package/dist/voice-call.js.map +1 -1
  210. package/dist/voice-openai.e2e.test.js +59 -23
  211. package/dist/voice-openai.e2e.test.js.map +1 -1
  212. package/dist/voice.js +80 -24
  213. package/dist/voice.js.map +1 -1
  214. package/dist/working-directory.e2e.test.js +11 -11
  215. package/dist/working-directory.e2e.test.js.map +1 -1
  216. package/package.json +12 -6
  217. package/src/agent-ui.e2e.test.ts +27 -13
  218. package/src/agent-ui.ts +2 -1
  219. package/src/analytics.e2e.test.ts +1 -1
  220. package/src/autostart.ts +55 -10
  221. package/src/bot.ts +29 -5
  222. package/src/btw.e2e.test.ts +3 -3
  223. package/src/builtin-skills.test.ts +3 -4
  224. package/src/builtin-skills.ts +1 -1
  225. package/src/catalog-refresh.e2e.test.ts +2 -2
  226. package/src/cli/bot.ts +23 -14
  227. package/src/cli/discord.ts +30 -6
  228. package/src/cli/schedule.ts +23 -9
  229. package/src/cli/session.ts +35 -12
  230. package/src/cli/shared.ts +43 -8
  231. package/src/cli-discord.e2e.test.ts +13 -8
  232. package/src/cli-lock.e2e.test.ts +88 -20
  233. package/src/cli-read.e2e.test.ts +17 -8
  234. package/src/cli-sessions.e2e.test.ts +4 -3
  235. package/src/cli.ts +2 -0
  236. package/src/commands/preference-commands.ts +38 -4
  237. package/src/commands/session-commands.ts +12 -7
  238. package/src/commands/thread-commands.ts +92 -24
  239. package/src/commands/worktree-commands.ts +10 -9
  240. package/src/commands.e2e.test.ts +25 -21
  241. package/src/coordinator-agents.e2e.test.ts +168 -0
  242. package/src/coordinator-idle.e2e.test.ts +122 -0
  243. package/src/coordinator-queue.e2e.test.ts +279 -0
  244. package/src/coordinator-warmup.e2e.test.ts +158 -0
  245. package/src/coordinator.e2e.test.ts +545 -0
  246. package/src/coordinator.ts +168 -0
  247. package/src/db.test.ts +1 -0
  248. package/src/diagram.test.ts +56 -0
  249. package/src/diagram.ts +243 -0
  250. package/src/duration.ts +13 -5
  251. package/src/effects.ts +99 -27
  252. package/src/event-loop.ts +71 -42
  253. package/src/format-parts.ts +53 -22
  254. package/src/gateway-replay.e2e.test.ts +4 -4
  255. package/src/harness.e2e.test.ts +2 -2
  256. package/src/hello-thread.e2e.test.ts +59 -5
  257. package/src/ingress.ts +62 -12
  258. package/src/interaction-context.ts +12 -11
  259. package/src/interrupt.e2e.test.ts +8 -5
  260. package/src/legacy.e2e.test.ts +1 -1
  261. package/src/lock-routes.ts +62 -8
  262. package/src/lock-server.ts +23 -7
  263. package/src/main.ts +22 -7
  264. package/src/markdown/markdown.test.ts +4 -4
  265. package/src/markdown/render-markdown.ts +6 -5
  266. package/src/onboarding-cli.e2e.test.ts +7 -6
  267. package/src/onboarding.e2e.test.ts +8 -10
  268. package/src/onboarding.ts +13 -29
  269. package/src/permissions.e2e.test.ts +3 -3
  270. package/src/plugin/coordinator.ts +401 -0
  271. package/src/plugin/index.ts +68 -15
  272. package/src/plugin.e2e.test.ts +1 -1
  273. package/src/preference-commands.e2e.test.ts +103 -23
  274. package/src/prompt.ts +87 -43
  275. package/src/questions.e2e.test.ts +13 -13
  276. package/src/queue-sources.e2e.test.ts +197 -0
  277. package/src/queue.e2e.test.ts +48 -30
  278. package/src/queue.test.ts +59 -0
  279. package/src/queue.ts +104 -24
  280. package/src/remote-send.e2e.test.ts +6 -6
  281. package/src/remote-send.ts +2 -1
  282. package/src/renderer.e2e.test.ts +7 -7
  283. package/src/restart.e2e.test.ts +2 -2
  284. package/src/routines.e2e.test.ts +2 -2
  285. package/src/scheduler.e2e.test.ts +45 -19
  286. package/src/scheduler.ts +4 -2
  287. package/src/schema-sql.ts +1 -1
  288. package/src/schema.ts +13 -0
  289. package/src/session-commands.e2e.test.ts +38 -11
  290. package/src/session-events.ts +160 -21
  291. package/src/session-ops.e2e.test.ts +90 -10
  292. package/src/sessions.ts +214 -64
  293. package/src/shell.e2e.test.ts +4 -4
  294. package/src/slash-commands.test.ts +2 -0
  295. package/src/slash-commands.ts +12 -6
  296. package/src/sleep.e2e.test.ts +30 -13
  297. package/src/sleeps.ts +20 -3
  298. package/src/store.ts +5 -2
  299. package/src/system-prompt.ts +143 -63
  300. package/src/test/generate-log-plugin/index.ts +16 -0
  301. package/src/test/harness.ts +77 -14
  302. package/src/test/replay.ts +12 -6
  303. package/src/thread-reducer.fixtures.test.ts +58 -51
  304. package/src/thread-reducer.test.ts +207 -26
  305. package/src/thread-reducer.ts +138 -37
  306. package/src/voice-attachments.e2e.test.ts +110 -18
  307. package/src/voice-call.e2e.test.ts +9 -9
  308. package/src/voice-call.ts +6 -6
  309. package/src/voice-openai.e2e.test.ts +64 -24
  310. package/src/voice.ts +101 -26
  311. package/src/working-directory.e2e.test.ts +11 -11
  312. package/dist/message-tool.e2e.test.js +0 -39
  313. package/dist/message-tool.e2e.test.js.map +0 -1
  314. package/dist/plugin/read-media.d.ts +0 -23
  315. package/dist/plugin/read-media.js +0 -72
  316. package/dist/plugin/read-media.js.map +0 -1
  317. package/dist/plugin/session-id/index.js +0 -18
  318. package/dist/plugin/session-id/index.js.map +0 -1
  319. package/dist/probe-live.tmp.js +0 -82
  320. package/dist/probe-live.tmp.js.map +0 -1
  321. package/dist/tasks.e2e.test.js +0 -173
  322. package/dist/tasks.e2e.test.js.map +0 -1
  323. /package/dist/{message-tool.e2e.test.d.ts → coordinator-agents.e2e.test.d.ts} +0 -0
  324. /package/dist/{probe-live.tmp.d.ts → coordinator-idle.e2e.test.d.ts} +0 -0
  325. /package/dist/{tasks.e2e.test.d.ts → coordinator-queue.e2e.test.d.ts} +0 -0
  326. /package/dist/{plugin/session-id → test/generate-log-plugin}/index.d.ts +0 -0
@@ -8,7 +8,7 @@ test('tools: names from tool.input.started, failed tool lines, read-only tools h
8
8
  const { effects } = replay({ events: loadFixture('tools.events.jsonl') });
9
9
  expect(effectLines(effects)).toMatchInlineSnapshot(`
10
10
  [
11
- "» **user:** Do these steps with tools, one by one: 1) run \`ls cli/src | head -5\` with bash, 2) write a file tmp-events/hello.txt containing "hello", 3) edit that file to replace hello with "hello world", 4) glob for **/*.txt under tmp-events, 5) read the file. Then reply with one short line.",
11
+ "-# » **user:** Do these steps with tools, one by one: 1) run \`ls cli/src | head -5\` with bash, 2) write a file tmp-events/hello.txt containing "hello", 3) edit that file to replace hello with "hello world", 4) glob for **/*.txt under tmp-events, 5) read the file. Then reply with one short line.",
12
12
  "[typing on]",
13
13
  "-# *using openai/gpt-6-luna low ⋅ build*",
14
14
  "-# ┣ shell _ls cli/src \\| head -5_",
@@ -20,25 +20,25 @@ test('tools: names from tool.input.started, failed tool lines, read-only tools h
20
20
  "-# ┣ shell _python3 -c "from pathlib import Path; p=Path('tmp-events/hello.txt'); p.write\\_t…_",
21
21
  "\\nDone. \`tmp-events/hello.txt\` contains \`hello world\`.",
22
22
  "[typing off]",
23
- "-# *project ⋅ main ⋅ 17s ⋅ 6% ⋅ gpt-6-luna*",
23
+ "-# *main ⋅ 17s ⋅ 6% ⋅ gpt-6-luna*",
24
24
  ]
25
25
  `);
26
26
  });
27
27
  test('tools at text verbosity: text, edits and errors only', () => {
28
28
  const { effects } = replay({
29
29
  events: loadFixture('tools.events.jsonl'),
30
- prefs: { verbosity: 'text', contextLimits: {} },
30
+ prefs: { verbosity: 'text', models: {} },
31
31
  });
32
32
  expect(effectLines(effects)).toMatchInlineSnapshot(`
33
33
  [
34
- "» **user:** Do these steps with tools, one by one: 1) run \`ls cli/src | head -5\` with bash, 2) write a file tmp-events/hello.txt containing "hello", 3) edit that file to replace hello with "hello world", 4) glob for **/*.txt under tmp-events, 5) read the file. Then reply with one short line.",
34
+ "-# » **user:** Do these steps with tools, one by one: 1) run \`ls cli/src | head -5\` with bash, 2) write a file tmp-events/hello.txt containing "hello", 3) edit that file to replace hello with "hello world", 4) glob for **/*.txt under tmp-events, 5) read the file. Then reply with one short line.",
35
35
  "[typing on]",
36
36
  "-# *using openai/gpt-6-luna low ⋅ build*",
37
37
  "-# ⨯ shell _Invalid arguments for tool "shell":_",
38
38
  "-# ⨯ shell _Invalid arguments for tool "shell":_",
39
39
  "\\nDone. \`tmp-events/hello.txt\` contains \`hello world\`.",
40
40
  "[typing off]",
41
- "-# *project ⋅ main ⋅ 17s ⋅ gpt-6-luna*",
41
+ "-# *main ⋅ 17s ⋅ gpt-6-luna*",
42
42
  ]
43
43
  `);
44
44
  });
@@ -46,13 +46,13 @@ test('task-subagent: child tool lines labelled with the agent, no child text, fo
46
46
  const { effects, view } = replay({ events: loadFixture('task-subagent.events.jsonl') });
47
47
  expect(effectLines(effects)).toMatchInlineSnapshot(`
48
48
  [
49
- "» **user:** Use the subagent tool with agent "general" to find which file defines the Drizzle SQLite schema in cli/src (the subagent should use glob and read). Then read the first 10 lines of that file yourself with the read tool and answer in 2 short sentences.",
49
+ "-# » **user:** Use the subagent tool with agent "general" to find which file defines the Drizzle SQLite schema in cli/src (the subagent should use glob and read). Then read the first 10 lines of that file yourself with the read tool and answer in 2 short sentences.",
50
50
  "[typing on]",
51
51
  "-# *using openai/gpt-6-luna low ⋅ build*",
52
52
  "-# ┣ general **Find SQLite schema file**",
53
53
  "\\nThe Drizzle SQLite schema is defined in \`cli/src/schema.ts\`. Its first lines confirm it defines tables for Kimaki’s local SQLite database.",
54
54
  "[typing off]",
55
- "-# *project ⋅ main ⋅ 12s ⋅ 6% ⋅ gpt-6-luna*",
55
+ "-# *main ⋅ 12s ⋅ 6% ⋅ gpt-6-luna*",
56
56
  ]
57
57
  `);
58
58
  expect(view.children).toMatchInlineSnapshot(`
@@ -70,12 +70,12 @@ test('task-parallel: background children show start and end lines only, no foote
70
70
  const { effects, view } = replay({ events: loadFixture('task-parallel.events.jsonl') });
71
71
  expect(effectLines(effects)).toMatchInlineSnapshot(`
72
72
  [
73
- "» **user:** In a single step, call the subagent tool twice in parallel, both with agent "general": one to count the .ts files in cli/src/commands using a shell command, one to list the top-level folders of the repo with a shell command. Then reply with both results in 2 lines.",
73
+ "-# » **user:** In a single step, call the subagent tool twice in parallel, both with agent "general": one to count the .ts files in cli/src/commands using a shell command, one to list the top-level folders of the repo with a shell command. Then reply with both results in 2 lines.",
74
74
  "[typing on]",
75
75
  "-# *using openai/gpt-6-luna low ⋅ build*",
76
76
  "-# ┣ general **Count command TypeScript** (background)",
77
77
  "-# ┣ general **List repo folders** (background)",
78
- "-# ⬦ general finished: Count command TypeScript",
78
+ "-# general finished: Count command TypeScript",
79
79
  "\\nBoth tasks are running. I’ll report the two results when they finish.",
80
80
  "\\n-# ┣ general **List repo folders**",
81
81
  "-# ┣ general ⋅ shell _find . -maxdepth 1 -type d -not -name . -print \\| sed 's#^./##' \\| sort_",
@@ -108,16 +108,16 @@ test('abort: no error line for the aborted tool, no footer, next turn is normal'
108
108
  const { effects } = replay({ events: loadFixture('abort.events.jsonl') });
109
109
  expect(effectLines(effects)).toMatchInlineSnapshot(`
110
110
  [
111
- "» **user:** Run \`sleep 30 && echo never\` with bash, then summarize.",
111
+ "-# » **user:** Run \`sleep 30 && echo never\` with bash, then summarize.",
112
112
  "[typing on]",
113
113
  "-# *using openai/gpt-6-luna low ⋅ build*",
114
114
  "-# ┣ shell _sleep 30 && echo never_",
115
115
  "[typing off]",
116
- "» **user:** Say only: resumed after abort.",
116
+ "-# » **user:** Say only: resumed after abort.",
117
117
  "[typing on]",
118
118
  "resumed after abort",
119
119
  "[typing off]",
120
- "-# *project ⋅ main ⋅ 1s ⋅ 6% ⋅ gpt-6-luna*",
120
+ "-# *main ⋅ 1s ⋅ 6% ⋅ gpt-6-luna*",
121
121
  ]
122
122
  `);
123
123
  });
@@ -176,23 +176,25 @@ test('queue-plain: acks with positions while busy, silent footer before each del
176
176
  const { effects, view } = replay({ events: loadFixture('queue-plain.events.jsonl') });
177
177
  expect(effectLines(effects)).toMatchInlineSnapshot(`
178
178
  [
179
- "» **user:** Run \`sleep 6 && echo slow-done\` with bash, then say done.",
179
+ "-# » **user:** Run \`sleep 6 && echo slow-done\` with bash, then say done.",
180
180
  "[typing on]",
181
181
  "-# *using openai/gpt-6-luna low ⋅ build*",
182
182
  "-# ┣ shell _sleep 6 && echo slow-done_",
183
- "[show queue:msg_0f20347e1001nsJ7W4hOvhBpQb] -# Queued at position 1. Delete the original message to remove it, or use /clear-queue position:1",
184
- "[show queue:msg_0f20347e500196F4o0voD7LGMV] -# Queued at position 2. Delete the original message to remove it, or use /clear-queue position:2",
183
+ "[show queue:msg_0f20347e1001nsJ7W4hOvhBpQb] -# » **user:** QUEUED-1: reply with the word apple.
184
+ -# Queued at position 1. Remove it with /clear-queue position:1",
185
+ "[show queue:msg_0f20347e500196F4o0voD7LGMV] -# » **user:** QUEUED-2: reply with the word cherry.
186
+ -# Queued at position 2. Remove it with /clear-queue position:2",
185
187
  "\\nDone.",
186
- "[silent] -# *project ⋅ main ⋅ 10s ⋅ 6% ⋅ gpt-6-luna*",
187
- "[edit queue:msg_0f20347e1001nsJ7W4hOvhBpQb] -# Queued message sent",
188
- "» **user:** QUEUED-1: reply with the word apple.",
188
+ "[silent] -# *main ⋅ 10s ⋅ 6% ⋅ gpt-6-luna*",
189
+ "[edit queue:msg_0f20347e1001nsJ7W4hOvhBpQb] -# » **user:** QUEUED-1: reply with the word apple.",
190
+ "[reply to queue:msg_0f20347e1001nsJ7W4hOvhBpQb] -# Queued message sent",
189
191
  "apple",
190
- "[silent] -# *project ⋅ main ⋅ 2s ⋅ 6% ⋅ gpt-6-luna*",
191
- "[edit queue:msg_0f20347e500196F4o0voD7LGMV] -# Queued message sent",
192
- "» **user:** QUEUED-2: reply with the word cherry.",
192
+ "[silent] -# *main ⋅ 2s ⋅ 6% ⋅ gpt-6-luna*",
193
+ "[edit queue:msg_0f20347e500196F4o0voD7LGMV] -# » **user:** QUEUED-2: reply with the word cherry.",
194
+ "[reply to queue:msg_0f20347e500196F4o0voD7LGMV] -# Queued message sent",
193
195
  "cherry",
194
196
  "[typing off]",
195
- "-# *project ⋅ main ⋅ 2s ⋅ 6% ⋅ gpt-6-luna*",
197
+ "-# *main ⋅ 2s ⋅ 6% ⋅ gpt-6-luna*",
196
198
  ]
197
199
  `);
198
200
  expect(view.inbox).toMatchInlineSnapshot(`[]`);
@@ -201,21 +203,25 @@ test('steer-queue: cancelled item edits its ack, interrupted run has no footer',
201
203
  const { effects, view } = replay({ events: loadFixture('steer-queue.events.jsonl') });
202
204
  expect(effectLines(effects)).toMatchInlineSnapshot(`
203
205
  [
204
- "» **user:** Run \`sleep 8 && echo slow-done\` with bash, then say done.",
206
+ "-# » **user:** Run \`sleep 8 && echo slow-done\` with bash, then say done.",
205
207
  "[typing on]",
206
208
  "-# *using openai/gpt-6-luna low ⋅ build*",
207
209
  "-# ┣ shell _sleep 8 && echo slow-done_",
208
- "[show queue:msg_0f200f884001tIpWlHhNB8Y5bv] -# Queued at position 1. Delete the original message to remove it, or use /clear-queue position:1",
209
- "[show queue:msg_kimaki_queued_b_test1] -# Queued at position 2. Delete the original message to remove it, or use /clear-queue position:2",
210
- "[show queue:msg_0f200f88a001SXny4FyIMuMPS6] -# Queued at position 3. Delete the original message to remove it, or use /clear-queue position:3",
211
- "[edit queue:msg_kimaki_queued_b_test1] -# Removed from queue",
212
- "» **user:** STEER: actually also tell me the current date using bash \`date\`.",
210
+ "[show queue:msg_0f200f884001tIpWlHhNB8Y5bv] -# » **user:** QUEUED-A: after everything, reply with the word apple.
211
+ -# Queued at position 1. Remove it with /clear-queue position:1",
212
+ "[show queue:msg_kimaki_queued_b_test1] -# » **user:** QUEUED-B: reply with the word banana.
213
+ -# Queued at position 2. Remove it with /clear-queue position:2",
214
+ "[show queue:msg_0f200f88a001SXny4FyIMuMPS6] -# » **user:** QUEUED-C: reply with the word cherry.
215
+ -# Queued at position 3. Remove it with /clear-queue position:3",
216
+ "[edit queue:msg_kimaki_queued_b_test1] -# » **user:** QUEUED-B: reply with the word banana.
217
+ -# Removed from queue",
218
+ "-# » **user:** STEER: actually also tell me the current date using bash \`date\`.",
213
219
  "[typing off]",
214
220
  "[typing on]",
215
221
  "-# ┣ shell _date_",
216
222
  "\\nDone. The current date is Wed Sep 30 2026.",
217
223
  "[typing off]",
218
- "-# *project ⋅ main ⋅ 3s ⋅ 6% ⋅ gpt-6-luna*",
224
+ "-# *main ⋅ 3s ⋅ 6% ⋅ gpt-6-luna*",
219
225
  ]
220
226
  `);
221
227
  // The recorded order (prompt, then interrupt with resume) parks queued items.
@@ -230,21 +236,22 @@ test('queue-parked: parked item runs and echoes after the next prompt, with a fo
230
236
  const { effects } = replay({ events: loadFixture('queue-parked.events.jsonl') });
231
237
  expect(effectLines(effects)).toMatchInlineSnapshot(`
232
238
  [
233
- "» **user:** Run \`sleep 6 && echo slow-done\` with bash, then say done.",
239
+ "-# » **user:** Run \`sleep 6 && echo slow-done\` with bash, then say done.",
234
240
  "[typing on]",
235
241
  "-# *using openai/gpt-6-luna low ⋅ build*",
236
242
  "-# ┣ shell _sleep 6 && echo slow-done_",
237
- "[show queue:msg_0f2039909001oR0GJKPGqxOjml] -# Queued at position 1. Delete the original message to remove it, or use /clear-queue position:1",
243
+ "[show queue:msg_0f2039909001oR0GJKPGqxOjml] -# » **user:** PARKED-1: reply with the word apple.
244
+ -# Queued at position 1. Remove it with /clear-queue position:1",
238
245
  "[typing off]",
239
- "» **user:** NEW: reply with the word kiwi.",
246
+ "-# » **user:** NEW: reply with the word kiwi.",
240
247
  "[typing on]",
241
248
  "kiwi",
242
- "[silent] -# *project ⋅ main ⋅ 3s ⋅ 6% ⋅ gpt-6-luna*",
243
- "[edit queue:msg_0f2039909001oR0GJKPGqxOjml] -# Queued message sent",
244
- "» **user:** PARKED-1: reply with the word apple.",
249
+ "[silent] -# *main ⋅ 3s ⋅ 6% ⋅ gpt-6-luna*",
250
+ "[edit queue:msg_0f2039909001oR0GJKPGqxOjml] -# » **user:** PARKED-1: reply with the word apple.",
251
+ "[reply to queue:msg_0f2039909001oR0GJKPGqxOjml] -# Queued message sent",
245
252
  "apple",
246
253
  "[typing off]",
247
- "-# *project ⋅ main ⋅ 3s ⋅ 6% ⋅ gpt-6-luna*",
254
+ "-# *main ⋅ 3s ⋅ 6% ⋅ gpt-6-luna*",
248
255
  ]
249
256
  `);
250
257
  });
@@ -252,7 +259,7 @@ test('question: one dropdown per question, typing off while waiting, edited on r
252
259
  const { effects, view } = replay({ events: loadFixture('question.events.jsonl') });
253
260
  expect(effectLines(effects)).toMatchInlineSnapshot(`
254
261
  [
255
- "» **user:** Use the question tool to ask me which color I prefer, with options red, green, blue (single choice), and in the same question tool call add a second question asking which fruits I like with options apple, pear, kiwi (multiple choice). After my answer, reply with one line.",
262
+ "-# » **user:** Use the question tool to ask me which color I prefer, with options red, green, blue (single choice), and in the same question tool call add a second question asking which fruits I like with options apple, pear, kiwi (multiple choice). After my answer, reply with one line.",
256
263
  "[typing on]",
257
264
  "-# *using openai/gpt-6-luna low ⋅ build*",
258
265
  "[typing off]",
@@ -267,7 +274,7 @@ test('question: one dropdown per question, typing off while waiting, edited on r
267
274
  ✓ _apple, kiwi_",
268
275
  "You prefer green, and you like apples and kiwi.",
269
276
  "[typing off]",
270
- "-# *project ⋅ main ⋅ 5s ⋅ 6% ⋅ gpt-6-luna*",
277
+ "-# *main ⋅ 5s ⋅ 6% ⋅ gpt-6-luna*",
271
278
  ]
272
279
  `);
273
280
  expect(view.forms).toMatchInlineSnapshot(`{}`);
@@ -276,7 +283,7 @@ test('permission: two requests, the rejected one fails its tool call', () => {
276
283
  const { effects, view } = replay({ events: loadFixture('permission.events.jsonl') });
277
284
  expect(effectLines(effects)).toMatchInlineSnapshot(`
278
285
  [
279
- "» **user:** Run \`echo first\` with bash. Then run \`echo second\` with bash. Then reply with one line describing what happened.",
286
+ "-# » **user:** Run \`echo first\` with bash. Then run \`echo second\` with bash. Then reply with one line describing what happened.",
280
287
  "[typing on]",
281
288
  "-# *using openai/gpt-6-luna low ⋅ build*",
282
289
  "-# ┣ shell _echo first_",
@@ -302,33 +309,33 @@ test('permission: two requests, the rejected one fails its tool call', () => {
302
309
  "-# ⨯ shell _Unable to execute command: echo second_",
303
310
  "\\n\`echo first\` printed \`first\`; \`echo second\` failed to execute.",
304
311
  "[typing off]",
305
- "-# *project ⋅ main ⋅ 5s ⋅ 6% ⋅ gpt-6-luna*",
312
+ "-# *main ⋅ 5s ⋅ 6% ⋅ gpt-6-luna*",
306
313
  ]
307
314
  `);
308
315
  expect(view.permissions).toMatchInlineSnapshot(`{}`);
309
316
  });
310
317
  test('shell-background: background shell line even without side effects, finished line when its job ends', () => {
311
318
  const events = loadFixture('shell-background.events.jsonl');
312
- const view = emptyView({ sessionId: 'ses_ee56d6caeffech0rMI5NTnkky1', channelId: 'channel', directory: '/project', isNew: false });
313
- const { effects, view: end } = replay({ events, view, prefs: { verbosity: 'tools', contextLimits: {} } });
319
+ const view = emptyView({ sessionId: 'ses_ee56d6caeffech0rMI5NTnkky1', channelId: 'channel', directory: '/project', isNew: false, coordinator: false });
320
+ const { effects, view: end } = replay({ events, view, prefs: { verbosity: 'tools', models: {} } });
314
321
  expect(effectLines(effects)).toMatchInlineSnapshot(`
315
322
  [
316
- "» **user:** start a task in background that runs sleep 100",
323
+ "-# » **user:** start a task in background that runs sleep 100",
317
324
  "[typing on]",
318
325
  "-# ┣ shell _Run sleep 100 in background_ (background)",
319
326
  "\\nI started \`sleep 100\` in the background (shell ID \`sh_11a929cf5001mAukdL6rQFIbLg\`). It ends in about 100 seconds, and I get a notification when it does.",
320
327
  "[typing off]",
321
- "-# *project ⋅ main ⋅ 4s ⋅ claude-opus-5-5 ⋅ opus*",
322
- "» **user:** is it still running",
328
+ "-# *main ⋅ 4s ⋅ claude-opus-5-5 ⋅ opus*",
329
+ "-# » **user:** is it still running",
323
330
  "[typing on]",
324
331
  "Yes, it is still running (PID 47861). I have not had the completion notification yet.",
325
332
  "[typing off]",
326
- "-# *project ⋅ main ⋅ 5s ⋅ claude-opus-5-5 ⋅ opus*",
327
- "-# ⬦ background shell finished: _Run sleep 100 in background_",
333
+ "-# *main ⋅ 5s ⋅ claude-opus-5-5 ⋅ opus*",
334
+ "-# background shell finished: _Run sleep 100 in background_",
328
335
  "[typing on]",
329
336
  "\\nThe background \`sleep 100\` has finished. It printed no output.",
330
337
  "[typing off]",
331
- "-# *project ⋅ main ⋅ 2s ⋅ claude-opus-5-5 ⋅ opus*",
338
+ "-# *main ⋅ 2s ⋅ claude-opus-5-5 ⋅ opus*",
332
339
  ]
333
340
  `);
334
341
  expect(end.shells).toMatchInlineSnapshot(`{}`);
@@ -342,8 +349,8 @@ test('shell: user !cmd output while idle and while busy, synthetic items render
342
349
  user-shell-idle
343
350
  05de62d feat: make external opencode session sync opt-in via --enable-sync
344
351
  \`\`\`",
345
- "» **user:** CONTEXT ONLY: the deploy tag is v9.9.9",
346
- "» **user:** What did my shell command print, and what is the deploy tag? Also run \`sleep 5\` with bash first.",
352
+ "-# » **user:** CONTEXT ONLY: the deploy tag is v9.9.9",
353
+ "-# » **user:** What did my shell command print, and what is the deploy tag? Also run \`sleep 5\` with bash first.",
347
354
  "[typing on]",
348
355
  "-# *using openai/gpt-6-luna low ⋅ build*",
349
356
  "-# ┣ shell _sleep 5_",
@@ -353,7 +360,7 @@ test('shell: user !cmd output while idle and while busy, synthetic items render
353
360
  \`\`\`",
354
361
  "\\nYour shell command printed \`user-shell-idle\` and \`05de62d feat: make external opencode session sync opt-in via --enable-sync\`. The deploy tag is \`v9.9.9\`.",
355
362
  "[typing off]",
356
- "-# *project ⋅ main ⋅ 9s ⋅ 6% ⋅ gpt-6-luna*",
363
+ "-# *main ⋅ 9s ⋅ 6% ⋅ gpt-6-luna*",
357
364
  ]
358
365
  `);
359
366
  });
@@ -1 +1 @@
1
- {"version":3,"file":"thread-reducer.fixtures.test.js","sourceRoot":"","sources":["../src/thread-reducer.fixtures.test.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,8EAA8E;AAE9E,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAErC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAoB,MAAM,qBAAqB,CAAA;AACzE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AA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,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,mFAAmF,EAAE,GAAG,EAAE;IAC7F,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAA;IACzE,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;GAoBlD,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -12,14 +12,15 @@
12
12
  //
13
13
  // root text, tool lines, banner, footer, retries, errors
14
14
  // child foreground: tool lines labelled "┣ general ⋅ glob ..."
15
- // background: no tool lines, one "⬦ general finished: ..." line
15
+ // background: no tool lines, one "general finished: ..." line
16
16
  // never text, banner or footer
17
17
  //
18
18
  // busy = root execution running OR any child running (29.2 #3). Typing
19
19
  // follows busy; the footer waits until nothing runs.
20
20
  import { ButtonStyle } from 'discord.js';
21
21
  import { produce } from 'immer';
22
- import { asSubtext, button, executeCalls, formatExecuteFailures, buttonRow, formatBanner, formatCacheMiss, formatError, formatRetry, formatShellEnded, formatShellFinished, formatShellStarted, formatSubagentFinished, formatToolFailed, formatToolLine, isToolVisible, textOnly, } from "./format-parts.js";
22
+ import { asSubtext, button, executeCalls, formatExecuteFailures, buttonRow, formatAgentSwitched, formatBanner, formatCacheMiss, formatCompacted, formatError, formatModelSwitched, formatRetry, formatShellEnded, formatShellFinished, formatShellStarted, formatSubagentFinished, formatToolFailed, formatToolLine, isToolVisible, textOnly, } from "./format-parts.js";
23
+ import { IDLE_REPLY } from "./plugin/coordinator.js";
23
24
  import { closePermission, hydratePermissions, showPermission, STATUS } from "./permissions.js";
24
25
  import { closeForm, formatAnswer, hydrateForms, showForm, withAnswer } from "./questions.js";
25
26
  import { cancelQueued, deliverQueued, enqueueInput, hydrateQueue, promoteQueued, queuedItems } from "./queue.js";
@@ -28,11 +29,13 @@ export function isKimakiEvent(event) {
28
29
  }
29
30
  const RETRY_NOTICE_INTERVAL_MS = 10_000;
30
31
  const CACHE_MISS_SLACK = 1_024;
32
+ const CACHE_MISS_MIN_WRITE_SHARE = 0.5;
31
33
  const REPLAY_LIMIT = 30;
32
- export function emptyView({ sessionId, channelId, directory, isNew, }) {
34
+ export function emptyView({ sessionId, channelId, directory, isNew, coordinator, }) {
33
35
  return {
34
36
  sessionId,
35
37
  channelId,
38
+ coordinator,
36
39
  directory,
37
40
  bannerPending: isNew,
38
41
  turn: null,
@@ -43,18 +46,42 @@ export function emptyView({ sessionId, channelId, directory, isNew, }) {
43
46
  lastKind: null,
44
47
  lastRetryAt: null,
45
48
  cached: null,
49
+ compacted: false,
46
50
  inbox: [],
47
51
  commandPending: null,
48
52
  forms: {},
49
53
  permissions: {},
50
54
  };
51
55
  }
56
+ function newTurn(startedAt) {
57
+ return { startedAt, model: null, agent: null, tokens: 0, slept: false, replyTo: null, texted: false };
58
+ }
52
59
  export function isBusy(view) {
53
60
  return view.turn !== null || Object.values(view.children).some((child) => child.running);
54
61
  }
62
+ function waitsForUser(view) {
63
+ return Object.keys(view.forms).length > 0 || Object.keys(view.permissions).length > 0;
64
+ }
55
65
  // Typing stops while the agent waits for the user (spec 6.6).
56
66
  function isTyping(view) {
57
- return isBusy(view) && Object.keys(view.forms).length === 0 && Object.keys(view.permissions).length === 0;
67
+ return isBusy(view) && !waitsForUser(view);
68
+ }
69
+ // Typing of one conversation across all views: a coordinator (a view whose channel
70
+ // is its own conversation) also types while a thread of its channel does, so
71
+ // background workers show there. Other conversations: isTyping of their view.
72
+ export function conversationTyping({ threads, threadId }) {
73
+ const view = threads[threadId];
74
+ if (!view || waitsForUser(view))
75
+ return false;
76
+ if (isBusy(view))
77
+ return true;
78
+ if (!view.coordinator)
79
+ return false;
80
+ return workersTyping({ threads, channelId: threadId });
81
+ }
82
+ // A thread of the channel runs and does not wait for the user.
83
+ export function workersTyping({ threads, channelId }) {
84
+ return Object.entries(threads).some(([id, thread]) => id !== channelId && thread.channelId === channelId && isTyping(thread));
58
85
  }
59
86
  export function eventSessionId(event) {
60
87
  if (event.type === 'form.created')
@@ -90,27 +117,45 @@ function toolLine({ draft, emit }, text) {
90
117
  emit({ type: 'send', text: draft.lastKind === 'text' ? `\n${text}` : text });
91
118
  draft.lastKind = 'tool';
92
119
  }
93
- function contextPercent({ turn, prefs }) {
94
- if (!turn.model || turn.tokens <= 0)
120
+ function showCompacted(context, size) {
121
+ context.draft.compacted = false;
122
+ toolLine(context, formatCompacted(size));
123
+ }
124
+ // A compaction in an execution with no model step (`/compact`, the idle coordinator compaction) stays silent:
125
+ // the user did not ask for anything, so the line is only noise. Auto compaction in a turn shows.
126
+ function endCompaction(context) {
127
+ if (context.draft.compacted && context.draft.turn?.model)
128
+ showCompacted(context, { tokens: null, percent: null });
129
+ context.draft.compacted = false;
130
+ }
131
+ function contextPercent({ tokens, model, prefs }) {
132
+ if (!model || tokens <= 0)
95
133
  return null;
96
- const limit = prefs.contextLimits[`${turn.model.providerID}/${turn.model.id}`];
134
+ const limit = prefs.models[`${model.providerID}/${model.id}`]?.context;
97
135
  if (!limit || limit <= 0)
98
136
  return null;
99
- return Math.round((turn.tokens / limit) * 100);
137
+ return Math.round((tokens / limit) * 100);
100
138
  }
101
139
  // The footer closing the answer of `turn` at `at`.
102
140
  function emitFooter({ draft, prefs, emit, turn, at, notify }) {
103
141
  // No model step ran (a compaction-only execution): nothing to summarize.
104
142
  if (!turn.model)
105
143
  return;
144
+ // The answer posted no text or tool line (e.g. an IDLE_REPLY, only hidden tools).
145
+ if (draft.lastKind === null)
146
+ return;
147
+ // A coordinator answer with only tool lines (it started a worker, then answered IDLE): its thread shows the work.
148
+ if (draft.coordinator && !turn.texted)
149
+ return;
106
150
  // A child still runs: the answer comes later.
107
151
  if (Object.values(draft.children).some((child) => child.running))
108
152
  return;
109
153
  emit({
110
154
  type: 'footer',
155
+ channelId: draft.channelId,
111
156
  directory: draft.directory,
112
157
  durationMs: at - turn.startedAt,
113
- contextPercent: contextPercent({ turn, prefs }),
158
+ contextPercent: contextPercent({ tokens: turn.tokens, model: turn.model, prefs }),
114
159
  model: { providerID: turn.model.providerID, id: turn.model.id },
115
160
  agent: turn.agent,
116
161
  notify,
@@ -145,7 +190,8 @@ function applyOpencode({ draft, event, prefs, emit }) {
145
190
  // Questions and permissions of subagents show in this thread too.
146
191
  const label = child?.agent ?? null;
147
192
  if (event.type === 'session.inbox.enqueued' && event.data.item.type === 'synthetic' && !child?.background) {
148
- return showShellFinished({ draft, prefs, emit, metadata: event.data.item.payload.metadata ?? {}, label });
193
+ const metadata = event.data.item.payload.metadata ?? {};
194
+ return showShellFinished({ draft, prefs, emit, metadata, label });
149
195
  }
150
196
  switch (event.type) {
151
197
  case 'form.created':
@@ -171,15 +217,31 @@ function applyRoot(context) {
171
217
  emit({ type: 'send', text: asSubtext(`Working directory changed to ${event.data.location.directory}`) });
172
218
  return;
173
219
  case 'session.execution.started':
174
- draft.turn ??= { startedAt: event.created, model: null, agent: null, tokens: 0, slept: false };
220
+ draft.turn ??= newTurn(event.created);
221
+ return;
222
+ // A new session's banner already shows its first model and agent.
223
+ case 'session.model.selected': {
224
+ const { model, previous } = event.data;
225
+ const same = previous && previous.providerID === model.providerID && previous.id === model.id && previous.variant === model.variant;
226
+ if (draft.bannerPending || same)
227
+ return;
228
+ emit({ type: 'send', text: formatModelSwitched({ name: prefs.models[`${model.providerID}/${model.id}`]?.name ?? `${model.providerID}/${model.id}`, variant: model.variant }) });
175
229
  return;
230
+ }
231
+ case 'session.agent.selected': {
232
+ const { agent, previous } = event.data;
233
+ if (draft.bannerPending || agent === previous)
234
+ return;
235
+ emit({ type: 'send', text: formatAgentSwitched({ agent, previous }) });
236
+ return;
237
+ }
176
238
  case 'session.step.started': {
177
239
  const model = { providerID: event.data.model.providerID, id: event.data.model.id };
178
- draft.turn ??= { startedAt: event.created, model: null, agent: null, tokens: 0, slept: false };
240
+ draft.turn ??= newTurn(event.created);
179
241
  draft.turn.model = model;
180
242
  draft.turn.agent = event.data.agent;
181
243
  if (draft.bannerPending)
182
- emit({ type: 'send', text: formatBanner({ model: event.data.model, agent: event.data.agent }) });
244
+ emit({ type: 'send', text: formatBanner({ model: event.data.model, agent: event.data.agent, coordinator: draft.coordinator }) });
183
245
  draft.bannerPending = false;
184
246
  return;
185
247
  }
@@ -188,10 +250,17 @@ function applyRoot(context) {
188
250
  return;
189
251
  const { tokens } = event.data;
190
252
  draft.turn.tokens = tokens.input + tokens.output + tokens.reasoning + tokens.cache.read + tokens.cache.write;
253
+ if (draft.compacted) {
254
+ const prompt = tokens.input + tokens.cache.read + tokens.cache.write;
255
+ showCompacted(context, { tokens: prompt, percent: contextPercent({ tokens: prompt, model: draft.turn.model, prefs }) });
256
+ }
191
257
  // The prompt only grows, so the cached prefix should too. A drop means the provider
192
258
  // re-read it: changed prefix, other model, or cache expired (TTL). The slack absorbs cache block rounding.
259
+ // Only a step that rewrote most of the prompt is a full loss; a smaller rewrite is a partial miss, not worth a line.
193
260
  const previous = draft.cached;
194
- if (previous && tokens.cache.read + CACHE_MISS_SLACK < previous.tokens) {
261
+ const promptTokens = tokens.input + tokens.cache.read + tokens.cache.write;
262
+ const rewroteMost = tokens.cache.write >= promptTokens * CACHE_MISS_MIN_WRITE_SHARE;
263
+ if (previous && rewroteMost && tokens.cache.read + CACHE_MISS_SLACK < previous.tokens) {
195
264
  toolLine(context, formatCacheMiss({ read: tokens.cache.read, expected: previous.tokens, idleMs: event.created - previous.at }));
196
265
  }
197
266
  draft.cached = { tokens: tokens.cache.read + tokens.cache.write, at: event.created };
@@ -199,9 +268,16 @@ function applyRoot(context) {
199
268
  }
200
269
  case 'session.text.ended': {
201
270
  const text = event.data.text.trim();
202
- if (!text)
271
+ // A coordinator turn with nothing for the user (a note, a started worker) answers IDLE_REPLY: Discord shows nothing.
272
+ if (!text || text === IDLE_REPLY)
203
273
  return;
204
- emit({ type: 'markdown', text, blankLineBefore: draft.lastKind === 'tool' });
274
+ const replyTo = draft.turn?.replyTo ?? null;
275
+ // The reply header already sets the text apart from the tool lines above.
276
+ emit({ type: 'markdown', text, blankLineBefore: draft.lastKind === 'tool' && !replyTo, replyTo });
277
+ if (draft.turn) {
278
+ draft.turn.replyTo = null;
279
+ draft.turn.texted = true;
280
+ }
205
281
  draft.lastKind = 'text';
206
282
  return;
207
283
  }
@@ -230,25 +306,29 @@ function applyRoot(context) {
230
306
  case 'session.compaction.ended':
231
307
  // A compacted history has a new prefix: its first miss is expected.
232
308
  draft.cached = null;
233
- return toolLine(context, asSubtext('⬦ context compacted'));
309
+ // Its size is only known when the next step reads it.
310
+ draft.compacted = true;
311
+ return;
234
312
  case 'session.compaction.failed':
235
313
  return toolLine(context, formatError(`compaction failed: ${event.data.error.message}`));
236
314
  case 'session.execution.succeeded': {
237
- const turn = draft.turn;
315
+ endCompaction(context);
316
+ if (draft.turn)
317
+ emitFooter({ ...context, turn: draft.turn, at: event.created, notify: !draft.turn.slept });
238
318
  draft.turn = null;
239
319
  draft.lastKind = null;
240
- if (turn)
241
- emitFooter({ ...context, turn, at: event.created, notify: !turn.slept });
242
320
  emit({ type: 'viewed', sessionId: draft.sessionId, idle: event.created });
243
321
  return;
244
322
  }
245
323
  case 'session.execution.failed':
324
+ endCompaction(context);
246
325
  draft.turn = null;
247
326
  draft.lastKind = null;
248
327
  emit({ type: 'send', text: formatError(event.data.error.message), notify: true });
249
328
  emit({ type: 'viewed', sessionId: draft.sessionId, idle: event.created });
250
329
  return;
251
330
  case 'session.execution.interrupted':
331
+ endCompaction(context);
252
332
  draft.turn = null;
253
333
  draft.lastKind = null;
254
334
  // A shutdown does not make the session idle in OpenCode.
@@ -260,11 +340,17 @@ function applyRoot(context) {
260
340
  case 'session.inbox.delivered': {
261
341
  // OpenCode runs queued items in the same execution: close the answer
262
342
  // before each one with a silent footer, like V1 did per turn.
263
- const queued = queuedItems(draft).some((item) => item.inboxID === event.data.inboxID);
343
+ const item = draft.inbox.find((candidate) => candidate.inboxID === event.data.inboxID);
344
+ const queued = item?.delivery === 'queue';
345
+ // Each user prompt the run takes gets its own reply; synthetic items keep the current one.
346
+ // An acked item's "Queued message sent" reply already marks where its answer starts.
347
+ if (item && draft.turn)
348
+ draft.turn.replyTo = item.acked ? null : item.replyTo;
264
349
  if (queued && draft.turn?.model) {
265
350
  emitFooter({ ...context, turn: draft.turn, at: event.created, notify: false });
266
351
  draft.turn.startedAt = event.created;
267
352
  draft.turn.slept = false;
353
+ draft.turn.texted = false;
268
354
  draft.lastKind = null;
269
355
  }
270
356
  return deliverQueued({ draft, emit, inboxID: event.data.inboxID });
@@ -379,6 +465,7 @@ function showInnerCalls({ tool, metadata, label, render, ...context }) {
379
465
  // Only background jobs carry `jobID`; user `!cmd` shells have their own lines.
380
466
  function showShellFinished({ metadata, label, ...context }) {
381
467
  const { shellID, jobID, state, exit } = metadata;
468
+ // A <session-finished> note (coordinator.ts) shows nothing: the coordinator reports the outcome.
382
469
  if (metadata['source'] !== 'shell' || typeof shellID !== 'string' || typeof jobID !== 'string')
383
470
  return;
384
471
  const description = context.draft.shells[shellID] ?? null;
@@ -404,7 +491,7 @@ function dismissAgentPrompts({ draft, emit, ids, result = 'dismissed' }) {
404
491
  return;
405
492
  draft.agentUi = draft.agentUi.filter((prompt) => !ids.includes(prompt.id));
406
493
  for (const id of ids)
407
- emit({ type: 'edit', key: `agent:${id}`, messages: [textOnly(asSubtext(`⬦ ${result}`))] });
494
+ emit({ type: 'edit', key: `agent:${id}`, messages: [textOnly(asSubtext(result))] });
408
495
  }
409
496
  function applyKimaki({ draft, event, prefs, emit }) {
410
497
  switch (event.type) {
@@ -417,7 +504,7 @@ function applyKimaki({ draft, event, prefs, emit }) {
417
504
  draft.turn.slept = true;
418
505
  return;
419
506
  case 'kimaki.command':
420
- draft.commandPending = { text: event.text, username: event.username };
507
+ draft.commandPending = { text: event.text, username: event.username, messageId: event.messageId, echo: event.echo };
421
508
  return;
422
509
  case 'kimaki.command-failed':
423
510
  draft.commandPending = null;
@@ -441,7 +528,7 @@ function applyKimaki({ draft, event, prefs, emit }) {
441
528
  if (!active.has(draft.sessionId))
442
529
  draft.turn = null;
443
530
  else
444
- draft.turn ??= { startedAt: event.at, model: null, agent: null, tokens: 0, slept: false };
531
+ draft.turn ??= newTurn(event.at);
445
532
  // Nothing runs: tool calls whose end was missed while disconnected are over.
446
533
  if (!isBusy(draft))
447
534
  draft.tools = {};
@@ -485,7 +572,7 @@ export function replayEffects({ messages, prefs, note, }) {
485
572
  const effects = kept.map((block, index) => {
486
573
  const previous = kept[index - 1]?.kind ?? null;
487
574
  if (block.kind === 'text')
488
- return { type: 'markdown', text: block.text, blankLineBefore: previous === 'tool' };
575
+ return { type: 'markdown', text: block.text, blankLineBefore: previous === 'tool', replyTo: null };
489
576
  return { type: 'send', text: previous === 'text' ? `\n${block.text}` : block.text };
490
577
  });
491
578
  return [