@cortex-agent/server 2026.10.15 → 2026.10.25

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 (469) hide show
  1. package/README.md +81 -51
  2. package/defaults/board/board.css +140 -62
  3. package/defaults/board/scaffold.html +36 -13
  4. package/defaults/config/environments/creative.json +0 -1
  5. package/defaults/config/environments/main.json +1 -2
  6. package/defaults/context/projects/AGENTS.md +1 -1
  7. package/defaults/gitignore +3 -3
  8. package/defaults/hooks/new-session-hook.mjs +1 -1
  9. package/defaults/hooks/status-md-guard.mjs +6 -6
  10. package/defaults/plugins/cortex-board/skills/board/SKILL.md +30 -22
  11. package/defaults/plugins/cortex-system/plugin.json +2 -2
  12. package/defaults/plugins/cortex-system/skills/browser/SKILL.md +56 -0
  13. package/defaults/plugins/cortex-system/skills/client-manage/SKILL.md +16 -9
  14. package/defaults/plugins/cortex-system/skills/project-init/SKILL.md +2 -2
  15. package/defaults/rules/agents-md.md +1 -1
  16. package/defaults/rules/issues-md.md +1 -1
  17. package/defaults/rules/meta-conventions.md +3 -3
  18. package/defaults/rules/mission-md.md +1 -1
  19. package/defaults/rules/status-md.md +1 -1
  20. package/dist/agent-adapter/claude/adapter.d.ts +2 -5
  21. package/dist/agent-adapter/claude/adapter.js +6 -5
  22. package/dist/agent-adapter/claude/assistant-blocks.d.ts +5 -0
  23. package/dist/agent-adapter/claude/assistant-blocks.js +61 -0
  24. package/dist/agent-adapter/claude/bg-task-tracker.d.ts +3 -1
  25. package/dist/agent-adapter/claude/bg-task-tracker.js +6 -2
  26. package/dist/agent-adapter/claude/cache-refresh.d.ts +58 -0
  27. package/dist/agent-adapter/claude/cache-refresh.js +145 -0
  28. package/dist/agent-adapter/claude/cache-touch.d.ts +12 -0
  29. package/dist/agent-adapter/claude/cache-touch.js +75 -0
  30. package/dist/agent-adapter/claude/event-parser.d.ts +8 -3
  31. package/dist/agent-adapter/claude/event-parser.js +33 -17
  32. package/dist/agent-adapter/claude/event-translator.d.ts +2 -0
  33. package/dist/agent-adapter/claude/event-translator.js +2 -0
  34. package/dist/agent-adapter/claude/mcp-config.js +11 -0
  35. package/dist/agent-adapter/claude/session-options.d.ts +6 -13
  36. package/dist/agent-adapter/claude/session-options.js +2 -13
  37. package/dist/agent-adapter/claude/spawn-args.d.ts +4 -21
  38. package/dist/agent-adapter/claude/spawn-args.js +17 -24
  39. package/dist/agent-adapter/claude/transcript-clear.d.ts +42 -0
  40. package/dist/agent-adapter/claude/transcript-clear.js +217 -0
  41. package/dist/agent-adapter/claude/turn-machine.d.ts +5 -3
  42. package/dist/agent-adapter/claude/turn-machine.js +29 -73
  43. package/dist/agent-adapter/claude/window-warmup.d.ts +13 -0
  44. package/dist/agent-adapter/claude/window-warmup.js +38 -0
  45. package/dist/agent-adapter/continuation-phase.d.ts +6 -3
  46. package/dist/agent-adapter/continuation-phase.js +11 -3
  47. package/dist/agent-adapter/normalize/event-types.d.ts +8 -0
  48. package/dist/agent-adapter/pi/adapter.d.ts +0 -1
  49. package/dist/agent-adapter/pi/adapter.js +5 -13
  50. package/dist/agent-adapter/pi/event-parser.d.ts +1 -1
  51. package/dist/agent-adapter/pi/event-parser.js +43 -27
  52. package/dist/agent-adapter/pi/mcp-bridge.d.ts +1 -1
  53. package/dist/agent-adapter/pi/pi-session.d.ts +2 -0
  54. package/dist/agent-adapter/pi/pi-session.js +15 -0
  55. package/dist/agent-adapter/pi/providers-config.d.ts +2 -2
  56. package/dist/agent-adapter/pi/providers-config.js +1 -1
  57. package/dist/agent-adapter/pi/quota-sink.d.ts +3 -3
  58. package/dist/agent-adapter/pi/quota-sink.js +3 -3
  59. package/dist/agent-adapter/pi/runtime.js +6 -1
  60. package/dist/agent-adapter/pi/session-options.d.ts +9 -13
  61. package/dist/agent-adapter/pi/session-options.js +12 -25
  62. package/dist/agent-adapter/run-events.d.ts +15 -10
  63. package/dist/agent-adapter/run-events.js +2 -0
  64. package/dist/agent-adapter/types.d.ts +14 -6
  65. package/dist/build-info.json +1 -0
  66. package/dist/client-bundle/client.mjs +10 -5
  67. package/dist/client-bundle/manifest.json +3 -3
  68. package/dist/core/claude-credentials.d.ts +6 -0
  69. package/dist/core/claude-credentials.js +11 -0
  70. package/dist/core/codex-quota.d.ts +1 -1
  71. package/dist/core/codex-quota.js +1 -1
  72. package/dist/core/gateway-generator.d.ts +26 -11
  73. package/dist/core/gateway-generator.js +73 -62
  74. package/dist/core/hook-bus.d.ts +1 -1
  75. package/dist/core/hook-bus.js +1 -8
  76. package/dist/core/locales/en.d.ts +52 -77
  77. package/dist/core/locales/slices/commands.d.ts +26 -31
  78. package/dist/core/locales/slices/commands.js +54 -64
  79. package/dist/core/locales/slices/init.d.ts +9 -19
  80. package/dist/core/locales/slices/init.js +19 -53
  81. package/dist/core/locales/slices/interactions.d.ts +3 -3
  82. package/dist/core/locales/slices/interactions.js +6 -6
  83. package/dist/core/locales/slices/notices.d.ts +1 -3
  84. package/dist/core/locales/slices/notices.js +2 -6
  85. package/dist/core/locales/slices/scheduling.d.ts +9 -9
  86. package/dist/core/locales/slices/scheduling.js +18 -18
  87. package/dist/core/locales/slices/status.d.ts +0 -4
  88. package/dist/core/locales/slices/status.js +0 -8
  89. package/dist/core/locales/slices/tui.d.ts +0 -1
  90. package/dist/core/locales/slices/tui.js +0 -2
  91. package/dist/core/locales/slices/uimsg.d.ts +4 -7
  92. package/dist/core/locales/slices/uimsg.js +9 -15
  93. package/dist/core/log.d.ts +3 -0
  94. package/dist/core/log.js +18 -1
  95. package/dist/core/models-generator.d.ts +29 -0
  96. package/dist/core/models-generator.js +82 -0
  97. package/dist/core/paths.d.ts +1 -1
  98. package/dist/core/paths.js +1 -1
  99. package/dist/core/settings-spec.d.ts +30 -0
  100. package/dist/core/settings-spec.js +38 -0
  101. package/dist/core/status-format.d.ts +3 -2
  102. package/dist/core/status-format.js +2 -2
  103. package/dist/core/types/agent-types.d.ts +3 -1
  104. package/dist/core/types/environment-types.d.ts +1 -8
  105. package/dist/domain/agents/agent-state.d.ts +11 -56
  106. package/dist/domain/agents/agent-state.js +48 -115
  107. package/dist/domain/agents/agent-switch.d.ts +2 -24
  108. package/dist/domain/agents/agent-switch.js +9 -72
  109. package/dist/domain/agents/config.d.ts +11 -61
  110. package/dist/domain/agents/config.js +47 -154
  111. package/dist/domain/agents/engine-selection.d.ts +21 -0
  112. package/dist/domain/agents/engine-selection.js +37 -0
  113. package/dist/domain/agents/environments/registry.js +4 -2
  114. package/dist/domain/agents/environments/resolve.js +0 -1
  115. package/dist/domain/agents/environments/schema.d.ts +3 -3
  116. package/dist/domain/agents/environments/schema.js +4 -4
  117. package/dist/domain/agents/index.d.ts +2 -1
  118. package/dist/domain/agents/index.js +3 -7
  119. package/dist/domain/agents/model-selection.d.ts +18 -70
  120. package/dist/domain/agents/model-selection.js +100 -150
  121. package/dist/domain/agents/models.d.ts +12 -0
  122. package/dist/domain/agents/models.js +94 -0
  123. package/dist/domain/agents/subagent/registry.d.ts +2 -0
  124. package/dist/domain/agents/subagent/registry.js +8 -0
  125. package/dist/domain/agents/subagent/runner.d.ts +5 -5
  126. package/dist/domain/agents/subagent/runner.js +12 -35
  127. package/dist/domain/auth/auth-status.d.ts +4 -4
  128. package/dist/domain/auth/auth-status.js +17 -28
  129. package/dist/domain/auth/auth-watch.js +48 -18
  130. package/dist/domain/auth/gateway-sync.d.ts +6 -26
  131. package/dist/domain/auth/gateway-sync.js +31 -75
  132. package/dist/domain/benchmark/identity.d.ts +3 -5
  133. package/dist/domain/benchmark/identity.js +0 -1
  134. package/dist/domain/benchmark/production-attempt-identity.d.ts +6 -5
  135. package/dist/domain/benchmark/production-attempt-identity.js +32 -35
  136. package/dist/domain/benchmark/session-evidence.d.ts +2 -1
  137. package/dist/domain/benchmark/session-evidence.js +8 -1
  138. package/dist/domain/browser/broker.d.ts +99 -0
  139. package/dist/domain/browser/broker.js +487 -0
  140. package/dist/domain/costs/claude-account.js +21 -0
  141. package/dist/domain/costs/rate-limit-throttle.js +3 -1
  142. package/dist/domain/costs/reset-account.d.ts +2 -0
  143. package/dist/domain/costs/usage-service.d.ts +1 -1
  144. package/dist/domain/costs/usage-service.js +20 -7
  145. package/dist/domain/mcp/tools/context.d.ts +5 -7
  146. package/dist/domain/mcp/tools/context.js +17 -4
  147. package/dist/domain/mcp/tools/subagent.js +1 -1
  148. package/dist/domain/mcp/tools/ui-file.js +1 -1
  149. package/dist/domain/monitor/event-loop-monitor.d.ts +2 -0
  150. package/dist/domain/monitor/event-loop-monitor.js +5 -1
  151. package/dist/domain/pi-providers/custom-provider-model.d.ts +1 -1
  152. package/dist/domain/pi-providers/custom-provider-model.js +1 -1
  153. package/dist/domain/plugins/authoring.d.ts +8 -1
  154. package/dist/domain/plugins/authoring.js +24 -9
  155. package/dist/domain/plugins/runtime-gc.d.ts +7 -0
  156. package/dist/domain/plugins/runtime-gc.js +52 -19
  157. package/dist/domain/plugins/runtime.js +2 -1
  158. package/dist/domain/remote/client-bootstrap.js +1 -1
  159. package/dist/domain/remote/client-manager.js +6 -1
  160. package/dist/domain/remote/device-browser.js +1 -1
  161. package/dist/domain/remote/device-chrome-commands.js +2 -0
  162. package/dist/domain/remote/device-port.js +2 -2
  163. package/dist/domain/runs/attempt.d.ts +3 -3
  164. package/dist/domain/runs/attempt.js +2 -3
  165. package/dist/domain/runs/builders.d.ts +4 -4
  166. package/dist/domain/runs/builders.js +4 -5
  167. package/dist/domain/runs/compact.d.ts +4 -17
  168. package/dist/domain/runs/compact.js +14 -56
  169. package/dist/domain/runs/config-resolver.d.ts +15 -83
  170. package/dist/domain/runs/config-resolver.js +24 -150
  171. package/dist/domain/runs/engine-spec.d.ts +8 -8
  172. package/dist/domain/runs/engine-spec.js +15 -31
  173. package/dist/domain/runs/events.d.ts +1 -1
  174. package/dist/domain/runs/fallback.d.ts +6 -38
  175. package/dist/domain/runs/fallback.js +10 -72
  176. package/dist/domain/runs/notices.d.ts +1 -11
  177. package/dist/domain/runs/notices.js +3 -30
  178. package/dist/domain/runs/request.d.ts +4 -3
  179. package/dist/domain/runs/retryable-errors.d.ts +0 -13
  180. package/dist/domain/runs/retryable-errors.js +3 -18
  181. package/dist/domain/runs/run.d.ts +12 -42
  182. package/dist/domain/runs/run.js +40 -147
  183. package/dist/domain/runs/service.d.ts +0 -9
  184. package/dist/domain/runs/service.js +33 -14
  185. package/dist/domain/runs/spec-loader.d.ts +1 -1
  186. package/dist/domain/runs/spend.d.ts +1 -1
  187. package/dist/domain/runs/spend.js +1 -1
  188. package/dist/domain/scheduling/builtin-job-controller.d.ts +3 -1
  189. package/dist/domain/scheduling/builtin-job-controller.js +5 -2
  190. package/dist/domain/scheduling/builtin-jobs.js +7 -0
  191. package/dist/domain/scheduling/jobs/scheduled-task.d.ts +3 -2
  192. package/dist/domain/scheduling/jobs/scheduled-task.js +25 -19
  193. package/dist/domain/scheduling/schedule-ops.d.ts +0 -1
  194. package/dist/domain/scheduling/schedule-ops.js +2 -5
  195. package/dist/domain/scheduling/schedule-selection.d.ts +3 -0
  196. package/dist/domain/scheduling/schedule-selection.js +16 -0
  197. package/dist/domain/scheduling/schedule-spec.d.ts +6 -5
  198. package/dist/domain/scheduling/schedule-spec.js +6 -6
  199. package/dist/domain/scheduling/scheduler.d.ts +3 -1
  200. package/dist/domain/scheduling/scheduler.js +36 -26
  201. package/dist/domain/sessions/session-hooks.d.ts +5 -4
  202. package/dist/domain/sessions/session-hooks.js +15 -33
  203. package/dist/domain/sessions/session-lifecycle.d.ts +19 -51
  204. package/dist/domain/sessions/session-lifecycle.js +34 -96
  205. package/dist/domain/system/doctor.d.ts +3 -3
  206. package/dist/domain/system/doctor.js +22 -26
  207. package/dist/domain/system/own-bin-path.d.ts +13 -0
  208. package/dist/domain/system/own-bin-path.js +36 -0
  209. package/dist/domain/system/server-update-check.js +2 -1
  210. package/dist/domain/system/terminal-cli/index.d.ts +58 -0
  211. package/dist/domain/system/terminal-cli/index.js +100 -0
  212. package/dist/domain/system/terminal-cli/posix-profiles.d.ts +23 -0
  213. package/dist/domain/system/terminal-cli/posix-profiles.js +74 -0
  214. package/dist/domain/system/terminal-cli/registrar.d.ts +12 -0
  215. package/dist/domain/system/terminal-cli/registrar.js +1 -0
  216. package/dist/domain/system/terminal-cli/shims.d.ts +27 -0
  217. package/dist/domain/system/terminal-cli/shims.js +108 -0
  218. package/dist/domain/system/terminal-cli/state.d.ts +7 -0
  219. package/dist/domain/system/terminal-cli/state.js +36 -0
  220. package/dist/domain/system/terminal-cli/windows-user-path.d.ts +13 -0
  221. package/dist/domain/system/terminal-cli/windows-user-path.js +67 -0
  222. package/dist/domain/telemetry/bus-collector.d.ts +3 -0
  223. package/dist/domain/telemetry/bus-collector.js +22 -0
  224. package/dist/domain/telemetry/child-exit.d.ts +11 -0
  225. package/dist/domain/telemetry/child-exit.js +36 -0
  226. package/dist/domain/telemetry/client-kind.d.ts +4 -0
  227. package/dist/domain/telemetry/client-kind.js +7 -0
  228. package/dist/domain/telemetry/crash-limits.d.ts +15 -0
  229. package/dist/domain/telemetry/crash-limits.js +50 -0
  230. package/dist/domain/telemetry/crash.d.ts +25 -0
  231. package/dist/domain/telemetry/crash.js +70 -0
  232. package/dist/domain/telemetry/daily-upload.d.ts +5 -0
  233. package/dist/domain/telemetry/daily-upload.js +20 -0
  234. package/dist/domain/telemetry/daily.d.ts +5 -0
  235. package/dist/domain/telemetry/daily.js +104 -0
  236. package/dist/domain/telemetry/endpoint.d.ts +7 -0
  237. package/dist/domain/telemetry/endpoint.js +40 -0
  238. package/dist/domain/telemetry/envelope.d.ts +6 -0
  239. package/dist/domain/telemetry/envelope.js +35 -0
  240. package/dist/domain/telemetry/error-digest.d.ts +7 -0
  241. package/dist/domain/telemetry/error-digest.js +43 -0
  242. package/dist/domain/telemetry/funnel.d.ts +6 -0
  243. package/dist/domain/telemetry/funnel.js +22 -0
  244. package/dist/domain/telemetry/gate.d.ts +19 -0
  245. package/dist/domain/telemetry/gate.js +67 -0
  246. package/dist/domain/telemetry/heartbeat.d.ts +17 -0
  247. package/dist/domain/telemetry/heartbeat.js +49 -0
  248. package/dist/domain/telemetry/info.d.ts +9 -0
  249. package/dist/domain/telemetry/info.js +12 -0
  250. package/dist/domain/telemetry/init-answer.d.ts +12 -0
  251. package/dist/domain/telemetry/init-answer.js +42 -0
  252. package/dist/domain/telemetry/install-id.d.ts +5 -0
  253. package/dist/domain/telemetry/install-id.js +42 -0
  254. package/dist/domain/telemetry/normalize.d.ts +33 -0
  255. package/dist/domain/telemetry/normalize.js +88 -0
  256. package/dist/domain/telemetry/outbox.d.ts +18 -0
  257. package/dist/domain/telemetry/outbox.js +93 -0
  258. package/dist/domain/telemetry/panic-group.d.ts +4 -0
  259. package/dist/domain/telemetry/panic-group.js +51 -0
  260. package/dist/domain/telemetry/paths.d.ts +7 -0
  261. package/dist/domain/telemetry/paths.js +11 -0
  262. package/dist/domain/telemetry/redact.d.ts +18 -0
  263. package/dist/domain/telemetry/redact.js +109 -0
  264. package/dist/domain/telemetry/rollup-types.d.ts +81 -0
  265. package/dist/domain/telemetry/rollup-types.js +31 -0
  266. package/dist/domain/telemetry/rollup.d.ts +16 -0
  267. package/dist/domain/telemetry/rollup.js +102 -0
  268. package/dist/domain/telemetry/schema.d.ts +931 -0
  269. package/dist/domain/telemetry/schema.js +275 -0
  270. package/dist/domain/telemetry/service.d.ts +34 -0
  271. package/dist/domain/telemetry/service.js +146 -0
  272. package/dist/domain/telemetry/state.d.ts +17 -0
  273. package/dist/domain/telemetry/state.js +29 -0
  274. package/dist/domain/telemetry/turns.d.ts +17 -0
  275. package/dist/domain/telemetry/turns.js +176 -0
  276. package/dist/domain/telemetry/upgrade.d.ts +14 -0
  277. package/dist/domain/telemetry/upgrade.js +87 -0
  278. package/dist/domain/telemetry/uploader.d.ts +21 -0
  279. package/dist/domain/telemetry/uploader.js +82 -0
  280. package/dist/domain/telemetry/usage.d.ts +25 -0
  281. package/dist/domain/telemetry/usage.js +153 -0
  282. package/dist/domain/telemetry/web-report.d.ts +8 -0
  283. package/dist/domain/telemetry/web-report.js +15 -0
  284. package/dist/domain/tui-session/tui-session-service.js +1 -1
  285. package/dist/domain/tui-session/types.d.ts +2 -2
  286. package/dist/domain/ui-service/app-router.d.ts +117 -95
  287. package/dist/domain/ui-service/app-router.js +17 -14
  288. package/dist/domain/ui-service/assistant-snapshots.js +2 -0
  289. package/dist/domain/ui-service/contract.parity.d.ts +19 -0
  290. package/dist/domain/ui-service/contract.parity.js +1 -0
  291. package/dist/domain/ui-service/inline-media-types.d.ts +18 -0
  292. package/dist/domain/ui-service/inline-media-types.js +1 -0
  293. package/dist/domain/ui-service/input-schemas.d.ts +120 -119
  294. package/dist/domain/ui-service/input-schemas.js +47 -85
  295. package/dist/domain/ui-service/mutate/approvals.d.ts +3 -2
  296. package/dist/domain/ui-service/mutate/approvals.js +3 -2
  297. package/dist/domain/ui-service/mutate/auth.d.ts +1 -1
  298. package/dist/domain/ui-service/mutate/auth.js +3 -2
  299. package/dist/domain/ui-service/mutate/config.d.ts +0 -8
  300. package/dist/domain/ui-service/mutate/config.js +0 -22
  301. package/dist/domain/ui-service/mutate/models.d.ts +13 -0
  302. package/dist/domain/ui-service/mutate/models.js +137 -0
  303. package/dist/domain/ui-service/mutate/plugin-packages.js +1 -1
  304. package/dist/domain/ui-service/mutate/resolve-media.d.ts +4 -0
  305. package/dist/domain/ui-service/mutate/resolve-media.js +17 -0
  306. package/dist/domain/ui-service/mutate/sessions.d.ts +2 -2
  307. package/dist/domain/ui-service/mutate/sessions.js +29 -126
  308. package/dist/domain/ui-service/mutate/telemetry.d.ts +5 -0
  309. package/dist/domain/ui-service/mutate/telemetry.js +6 -0
  310. package/dist/domain/ui-service/query/approvals.js +4 -3
  311. package/dist/domain/ui-service/query/config.js +22 -42
  312. package/dist/domain/ui-service/query/machine-probe.d.ts +1 -1
  313. package/dist/domain/ui-service/query/machine-probe.js +3 -2
  314. package/dist/domain/ui-service/query/models.d.ts +3 -0
  315. package/dist/domain/ui-service/query/models.js +49 -32
  316. package/dist/domain/ui-service/query/plugin-source.js +4 -3
  317. package/dist/domain/ui-service/query/schedules.js +1 -1
  318. package/dist/domain/ui-service/query/sessions.js +8 -13
  319. package/dist/domain/ui-service/query/telemetry.d.ts +3 -0
  320. package/dist/domain/ui-service/query/telemetry.js +4 -0
  321. package/dist/domain/ui-service/trpc.d.ts +8 -3
  322. package/dist/domain/ui-service/trpc.js +1 -1
  323. package/dist/domain/ui-service/types.d.ts +71 -179
  324. package/dist/domain/ui-service/ui-service.d.ts +56 -53
  325. package/dist/domain/ui-service/ui-service.js +27 -24
  326. package/dist/entry/app.js +62 -21
  327. package/dist/entry/browser-cli.d.ts +39 -0
  328. package/dist/entry/browser-cli.js +317 -0
  329. package/dist/entry/cli-help.d.ts +1 -0
  330. package/dist/entry/cli-help.js +64 -20
  331. package/dist/entry/cli.js +16 -14
  332. package/dist/entry/daemon.d.ts +1 -1
  333. package/dist/entry/daemon.js +88 -72
  334. package/dist/entry/init-auth.js +1 -1
  335. package/dist/entry/init.d.ts +10 -8
  336. package/dist/entry/init.js +138 -276
  337. package/dist/entry/path-cli.d.ts +4 -0
  338. package/dist/entry/path-cli.js +65 -0
  339. package/dist/entry/schedule-cli.js +13 -6
  340. package/dist/entry/shutdown.d.ts +1 -1
  341. package/dist/entry/shutdown.js +11 -1
  342. package/dist/entry/signal-cli.js +8 -11
  343. package/dist/entry/start-ui-http.js +48 -18
  344. package/dist/entry/telemetry-wiring.d.ts +12 -0
  345. package/dist/entry/telemetry-wiring.js +56 -0
  346. package/dist/entry/ui-cli.d.ts +0 -11
  347. package/dist/entry/ui-cli.js +42 -33
  348. package/dist/entry/ui-service-wiring.js +8 -10
  349. package/dist/events/event-types.d.ts +4 -6
  350. package/dist/orchestration/agent-runner.d.ts +2 -2
  351. package/dist/orchestration/agent-runner.js +10 -9
  352. package/dist/orchestration/benchmark-session-webhook.js +13 -1
  353. package/dist/orchestration/browser-webhook.d.ts +11 -0
  354. package/dist/orchestration/browser-webhook.js +28 -0
  355. package/dist/orchestration/cache-keep-warm.d.ts +77 -0
  356. package/dist/orchestration/cache-keep-warm.js +213 -0
  357. package/dist/orchestration/claude-window-warmup.d.ts +40 -0
  358. package/dist/orchestration/claude-window-warmup.js +126 -0
  359. package/dist/orchestration/conversation-request.d.ts +6 -10
  360. package/dist/orchestration/conversation-request.js +5 -23
  361. package/dist/orchestration/delta-coalescer.d.ts +4 -2
  362. package/dist/orchestration/delta-coalescer.js +5 -5
  363. package/dist/orchestration/edit-retry.js +9 -11
  364. package/dist/orchestration/inline-media-eager.d.ts +13 -0
  365. package/dist/orchestration/inline-media-eager.js +58 -0
  366. package/dist/orchestration/inline-media.d.ts +22 -0
  367. package/dist/orchestration/inline-media.js +151 -0
  368. package/dist/orchestration/interactions/ask-user-resume.js +3 -7
  369. package/dist/orchestration/interactions/interaction-handlers.js +6 -6
  370. package/dist/orchestration/mid-turn-inject.d.ts +2 -1
  371. package/dist/orchestration/mid-turn-inject.js +1 -1
  372. package/dist/orchestration/pending-injection-recovery.d.ts +2 -1
  373. package/dist/orchestration/pending-injection-recovery.js +1 -1
  374. package/dist/orchestration/routing/commands/index.js +4 -4
  375. package/dist/orchestration/routing/commands/mode.d.ts +5 -44
  376. package/dist/orchestration/routing/commands/mode.js +98 -272
  377. package/dist/orchestration/routing/commands/schedule.js +29 -18
  378. package/dist/orchestration/routing/commands/session.js +9 -9
  379. package/dist/orchestration/routing/commands/status.js +1 -1
  380. package/dist/orchestration/routing/commands/usage-format.js +3 -0
  381. package/dist/orchestration/routing/message-router.js +2 -0
  382. package/dist/orchestration/routing/webhook.js +6 -0
  383. package/dist/orchestration/session-compact.d.ts +0 -1
  384. package/dist/orchestration/session-compact.js +5 -7
  385. package/dist/orchestration/session-events.d.ts +2 -1
  386. package/dist/orchestration/session-events.js +1 -0
  387. package/dist/orchestration/status-helpers.d.ts +0 -4
  388. package/dist/orchestration/status-helpers.js +0 -18
  389. package/dist/orchestration/subagent-webhook.js +9 -34
  390. package/dist/orchestration/team-webhook.d.ts +8 -9
  391. package/dist/orchestration/team-webhook.js +16 -42
  392. package/dist/orchestration/transcript-sink.d.ts +12 -0
  393. package/dist/orchestration/transcript-sink.js +38 -2
  394. package/dist/orchestration/turn/terminal.js +7 -7
  395. package/dist/orchestration/turn/turn-prep.d.ts +0 -8
  396. package/dist/orchestration/turn/turn-prep.js +0 -51
  397. package/dist/orchestration/turn/turn-tracking.d.ts +2 -2
  398. package/dist/orchestration/turn/turn-tracking.js +8 -5
  399. package/dist/orchestration/turn/turn.d.ts +0 -2
  400. package/dist/orchestration/turn/turn.js +13 -15
  401. package/dist/orchestration/waitpoint-ingress.js +3 -0
  402. package/dist/platform/adapters/tui/ports.d.ts +1 -1
  403. package/dist/platform/adapters/tui/tui-transcript.js +2 -0
  404. package/dist/platform/browser/agent-browser.d.ts +50 -0
  405. package/dist/platform/browser/agent-browser.js +165 -0
  406. package/dist/platform/browser/managed-browser.d.ts +1 -11
  407. package/dist/platform/browser/managed-browser.js +4 -12
  408. package/dist/platform/ui-http/browser-stream.d.ts +110 -0
  409. package/dist/platform/ui-http/browser-stream.js +447 -0
  410. package/dist/platform/ui-http/ui-auth-routes.d.ts +2 -0
  411. package/dist/platform/ui-http/ui-auth-routes.js +9 -2
  412. package/dist/platform/ui-http/ui-device-routes.d.ts +13 -0
  413. package/dist/platform/ui-http/ui-device-routes.js +81 -0
  414. package/dist/platform/ui-http/ui-devices.d.ts +24 -0
  415. package/dist/platform/ui-http/ui-devices.js +107 -0
  416. package/dist/platform/ui-http/ui-http-server.d.ts +22 -3
  417. package/dist/platform/ui-http/ui-http-server.js +33 -12
  418. package/dist/platform/ui-http/ui-pairing.d.ts +25 -0
  419. package/dist/platform/ui-http/ui-pairing.js +98 -0
  420. package/dist/store/conversation-history-reader.js +8 -0
  421. package/dist/store/conversation-history-repo.d.ts +8 -1
  422. package/dist/store/conversation-history-repo.js +5 -0
  423. package/dist/store/conversation-ledger-repo.d.ts +6 -6
  424. package/dist/store/conversation-ledger-repo.js +4 -4
  425. package/dist/store/gitignore-migration.d.ts +2 -0
  426. package/dist/store/gitignore-migration.js +16 -0
  427. package/dist/store/hook-registry.d.ts +1 -1
  428. package/dist/store/hook-registry.js +11 -6
  429. package/dist/store/models-repo.d.ts +18 -0
  430. package/dist/store/models-repo.js +74 -0
  431. package/dist/store/pending-injection-repo.d.ts +2 -1
  432. package/dist/store/pending-injection-repo.js +3 -1
  433. package/dist/store/retire-profiles-migration.d.ts +28 -0
  434. package/dist/store/retire-profiles-migration.js +335 -0
  435. package/dist/store/schedule-repo.d.ts +2 -1
  436. package/dist/store/session-registry-import.js +3 -2
  437. package/dist/store/session-registry-journal.d.ts +10 -13
  438. package/dist/store/session-registry-journal.js +51 -25
  439. package/dist/store/session-registry-repo.d.ts +4 -4
  440. package/dist/store/session-registry-repo.js +4 -5
  441. package/dist/store/version-migrations.d.ts +7 -3
  442. package/dist/store/version-migrations.js +133 -80
  443. package/dist/tui/components/Dashboard.js +4 -3
  444. package/dist/tui/hooks/useDashboardData.js +1 -1
  445. package/dist/tui/slash-commands.js +2 -2
  446. package/dist/tui/turn-status.js +1 -1
  447. package/package.json +6 -4
  448. package/web/dist/assets/board-math-css-spk7yR6n.js +2 -0
  449. package/web/dist/assets/index-BQ69u-92.css +1 -0
  450. package/web/dist/assets/{index-CndZZ1IQ.js → index-CKNLatCd.js} +1 -1
  451. package/web/dist/assets/index-CkzWfC98.js +525 -0
  452. package/web/dist/index.html +3 -2
  453. package/web/dist/theme.css +6 -0
  454. package/dist/agent-adapter/browser-mcp-server.d.ts +0 -13
  455. package/dist/agent-adapter/browser-mcp-server.js +0 -28
  456. package/dist/agent-adapter/claude/browser-mcp.d.ts +0 -9
  457. package/dist/agent-adapter/claude/browser-mcp.js +0 -10
  458. package/dist/core/profile-generator.d.ts +0 -79
  459. package/dist/core/profile-generator.js +0 -215
  460. package/dist/domain/agents/profile-manager.d.ts +0 -103
  461. package/dist/domain/agents/profile-manager.js +0 -286
  462. package/dist/domain/agents/profile-switch.d.ts +0 -49
  463. package/dist/domain/agents/profile-switch.js +0 -62
  464. package/dist/domain/ui-service/mutate/profiles.d.ts +0 -36
  465. package/dist/domain/ui-service/mutate/profiles.js +0 -151
  466. package/dist/store/profile-repo.d.ts +0 -20
  467. package/dist/store/profile-repo.js +0 -97
  468. package/web/dist/assets/index-B76ueW3q.js +0 -494
  469. package/web/dist/assets/index-C8O0yxg8.css +0 -1
@@ -12,7 +12,7 @@ One subdirectory per active project.
12
12
 
13
13
  | File | Type | Purpose |
14
14
  |------|------|---------|
15
- | `STATUS.md` | Overwrite | Present-tense state register: overwritten when the project situation changes (hard cap 80 lines AND 6KB; see rules/status-md.md) |
15
+ | `STATUS.md` | Overwrite | Present-tense state register: overwritten when the project situation changes (hard caps <=80 lines and <=6KB, exceeding either is rejected; see rules/status-md.md) |
16
16
  | `ISSUES.md` | Append | Record issues affecting work efficiency |
17
17
  | `experiments/` | Atomic file | One `.md` file per experiment (YAML frontmatter + body), `index.md` auto-generated |
18
18
  | `knowledge/` | Atomic file | One `.md` file per knowledge entry, `index.md` auto-generated |
@@ -38,9 +38,9 @@ __pycache__/
38
38
  .venv/
39
39
 
40
40
  # Generated: memory index files (auto-rebuilt by memory-watcher / memory-index-regen)
41
- projects/*/experiments/index.md
42
- projects/*/knowledge/index.md
43
- projects/*/patterns/index.md
41
+ context/projects/*/experiments/index.md
42
+ context/projects/*/knowledge/index.md
43
+ context/projects/*/patterns/index.md
44
44
 
45
45
  # Local worktrees
46
46
  .claude/worktrees/
@@ -40,7 +40,7 @@ Examples of what to record:
40
40
  - A new project dependency or constraint was discovered → update STATUS.md
41
41
 
42
42
  File update rules you MUST respect:
43
- - **STATUS.md** — state register (hard cap 80 lines AND 6KB): replace stale lines with the latest state, never append; one line + pointer per change, details live in EXP/K entries; adding a line requires checking which old lines expired
43
+ - **STATUS.md** — state register (hard caps <=80 lines and <=6KB; exceeding either is rejected): replace stale lines with the latest state, never append; one line + pointer per change, details live in EXP/K entries; adding a line requires checking which old lines expired
44
44
  - **ISSUES.md** — append mode: add new entries at the end, keep history
45
45
  - **knowledge/K-NNN.md** — atomic: one file per knowledge entry, with YAML frontmatter
46
46
  - **knowledge/index.md, experiments/index.md, patterns/index.md** — AUTO-GENERATED, do NOT edit manually
@@ -24,7 +24,7 @@ const LIMIT_RULES = [
24
24
  maxBytes: 6 * 1024,
25
25
  warnLines: 60,
26
26
  warnBytes: 4 * 1024,
27
- capLabel: '80 lines AND 6KB',
27
+ capLabel: '<=80 lines and <=6KB',
28
28
  trimAdvice: [
29
29
  'STATUS is a state register, not a changelog. Trim before writing:',
30
30
  '- delete entries that no longer affect decisions (their content already lives in git / EXP records),',
@@ -40,7 +40,7 @@ const LIMIT_RULES = [
40
40
  maxBytes: 6 * 1024,
41
41
  warnLines: 60,
42
42
  warnBytes: 4 * 1024,
43
- capLabel: '80 lines AND 6KB',
43
+ capLabel: '<=80 lines and <=6KB',
44
44
  trimAdvice: [
45
45
  'ISSUES.md is a friction log with <=4-line entries. Trim before writing:',
46
46
  '- delete resolved entries outright (no changelog),',
@@ -56,7 +56,7 @@ const LIMIT_RULES = [
56
56
  maxBytes: 8 * 1024,
57
57
  warnLines: 90,
58
58
  warnBytes: 6656,
59
- capLabel: '120 lines AND 8KB',
59
+ capLabel: '<=120 lines and <=8KB',
60
60
  trimAdvice: [
61
61
  'AGENTS.md is a directory index loaded into every agent that works here: it answers "what is here, where to look", not the content itself. Trim before writing:',
62
62
  '- collapse atomic directories (experiments/ knowledge/ patterns/ decisions/) to one line each pointing at their index.md,',
@@ -89,7 +89,7 @@ function proposedContent(toolName, toolInput, currentContent) {
89
89
 
90
90
  function denyReason(rule, lineCount, byteCount) {
91
91
  return [
92
- `${rule.name} write rejected: the result would be ${lineCount} lines / ${byteCount} bytes — the hard cap is ${rule.capLabel} (${rule.ruleFile}).`,
92
+ `${rule.name} write rejected: the result would be ${lineCount} lines / ${byteCount} bytes — the hard cap is ${rule.capLabel}, and exceeding either limit is rejected (${rule.ruleFile}).`,
93
93
  '',
94
94
  ...rule.trimAdvice,
95
95
  '',
@@ -150,9 +150,9 @@ function main() {
150
150
  hookSpecificOutput: {
151
151
  hookEventName: 'PreToolUse',
152
152
  permissionDecision: 'allow',
153
- permissionDecisionReason: `Still over the ${rule.name} cap (${lineCount} lines / ${byteCount} bytes > ${rule.capLabel}) but shrinking — keep trimming to within the limit.`,
153
+ permissionDecisionReason: `Still over the ${rule.name} cap (${lineCount} lines / ${byteCount} bytes; cap ${rule.capLabel}) but shrinking — keep trimming until both limits are met.`,
154
154
  },
155
- systemMessage: `${rule.name} is still over the ${rule.capLabel} cap (${lineCount} lines / ${byteCount} bytes). This write shrinks it and is allowed — keep trimming.`,
155
+ systemMessage: `${rule.name} is still over its cap of ${rule.capLabel} (${lineCount} lines / ${byteCount} bytes). This write shrinks it and is allowed — keep trimming.`,
156
156
  }));
157
157
  return;
158
158
  }
@@ -4,12 +4,12 @@ description: "Open and keep a board: the live HTML status page the Web UI shows
4
4
  allowed-tools: Read, Edit, Write, Bash, mcp__cortex-core__board_open, mcp__cortex-core__send_decision, mcp__cortex-core__current_time, mcp__cortex-core__cortex_context
5
5
  metadata:
6
6
  author: "Cortex"
7
- version: "1.2.0"
7
+ version: "1.5.1"
8
8
  ---
9
9
 
10
10
  # Board
11
11
 
12
- A board is one HTML page per long task, shown in the Web UI beside the conversation and on the phone. The app draws a live strip above the page by itself: title, every bound session's status, questions waiting for the user, and the decision stream from `send_decision`. You write the page body: what the task is, where it stands, what comes next, and what needs the user. Someone glancing at it for five seconds should know whether things are on track.
12
+ A board is one HTML page per long task, shown in the Web UI beside the conversation and on the phone. The app names the board and draws a live strip above the page by itself: every bound session's status, questions waiting for the user, and the decision stream from `send_decision`. You write the page body: what the task is, where it stands, what comes next, and what needs the user. Someone glancing at it for five seconds should know whether things are on track.
13
13
 
14
14
  ## When to open one
15
15
 
@@ -37,11 +37,14 @@ A session is bound to at most one board. The tool returns the board directory; l
37
37
 
38
38
  ## Writing the page
39
39
 
40
- - **Open with the head card**: title, an overall state chip, and a one-line `.lead` saying where things stand. Keep the lead current; it is what the user reads first.
40
+ - **Open with the head**: title, an overall state chip, and a one-line `.lead` saying where things stand. Keep the lead current; it is what the user reads first.
41
41
  - **Replace the scaffold's examples** with real content on the first fill, and delete sections that do not apply.
42
- - **Use the preset classes** below. They follow the user's theme (light/dark, palette, accent) without any work from you. When they do not fit, write your own HTML, inline SVG charts, or a little inline `style`, and take colours from theme variables (`var(--proto-accent)`, `var(--proto-muted)`, …) rather than fixed values so the page still reads in dark mode.
43
- - **Images** go in `assets/` and are referenced relatively: `<img src="assets/loss.png" alt="loss curve">`. The app inlines them (up to 2 MB each).
42
+ - **Use the preset classes** below. They follow the user's theme (light/dark, palette, accent) without any work from you. The page reads as one document: each `card` is a section under its `h` heading, set apart by space rather than a box, and only a `callout` is boxed, for something the user has to act on. When the classes do not fit, write your own HTML, inline SVG charts, or a little inline `style`, and take colours from theme variables (`var(--proto-accent)`, `var(--proto-muted)`, …) rather than fixed values so the page still reads in dark mode.
43
+ - **Images** go in `assets/` and are referenced relatively: `<img src="assets/loss.png" alt="loss curve">`. A click opens any board image full size in the app's viewer, so a thumbnail need not be readable at board size; put a set of screenshots or plots in a `gallery`. The app inlines each image up to 2 MB, so resize or compress larger screenshots; a larger one shows as a dashed box that still opens on click. Wrap an image in `<a data-open="…">` to open something else instead.
44
+ - **Videos**: `<video src="assets/rollout.mp4" poster="assets/rollout.jpg" controls></video>`. Up to 2 MB plays in place; a larger one shows as a play tile (its `poster` frame, if any) that plays it in the app's viewer.
45
+ - **Formulas**: `<span class="tex">\mathcal{L} = \lVert x - \hat{x} \rVert^2</span>` inline, `<div class="tex">…</div>` on a line of its own. Write the TeX as text, with `<` as `&lt;`; the app renders it with KaTeX, as in the chat. Do not use `$…$`: nothing on a board reads it.
44
46
  - **Outputs**: put a file the user should open into the board's `assets/` and link it with `<a data-open="assets/report.md">report.md</a>`; a click opens it in the app. `data-open` only reaches files inside the board directory, so name anything elsewhere as path text without a link: `<code>experiments/run-12/metrics.json</code>`. Ordinary `https://` links open in the browser.
47
+ - **Type**: everything is in the app's face; the mono face (`code`, `pre`, `mono`, a row's `.id`) is only for code, paths, ids and hashes, never for names, times, numbers or labels. Headings and table headers are in sentence case, not capitals.
45
48
  - **Keep it static.** The page runs in a sandbox; scripts are not needed for anything the presets do.
46
49
  - **Decisions**: record them with `send_decision`; the strip shows them. On the page, keep at most a short "key decisions" row list.
47
50
  - Write in the user's language.
@@ -49,16 +52,16 @@ A session is bound to at most one board. The tool returns the board directory; l
49
52
 
50
53
  ### States
51
54
 
52
- One vocabulary across `chip`, `step`, `meter i`, `legend .sw` and `ic`:
55
+ One vocabulary across `chip`, `step`, `meter i`, `legend .sw` and `ic`. It is the app's own status-dot language:
53
56
 
54
57
  | modifier | meaning | look |
55
58
  |---|---|---|
56
- | `ok` | done | success green |
57
- | `run` | in progress | accent |
58
- | `ask` | waiting on the user (a question, a review, a go/no-go) | light amber; nothing else on the page is amber |
59
- | `wait` | blocked on a machine or someone else: queue, GPU, rate limit, external review | hollow, dashed |
59
+ | `ok` | done | success green; a check in a step |
60
+ | `run` | in progress | accent, with a soft halo |
61
+ | `ask` | waiting on the user (a question, a review, a go/no-go) | amber; nothing else on the page is amber |
62
+ | `wait` | blocked on a machine or someone else: queue, GPU, rate limit, external review | hollow ring |
60
63
  | `bad` | failed, unexpected, risk | danger red |
61
- | none | not started | gray |
64
+ | none | not started | faint gray |
62
65
 
63
66
  Use `ask` only for things truly waiting on the user, so the amber stays meaningful.
64
67
 
@@ -66,21 +69,26 @@ Use `ask` only for things truly waiting on the user, so the amber stays meaningf
66
69
 
67
70
  | class | use | shape |
68
71
  |---|---|---|
69
- | `stack` | vertical spacing between blocks | `<div class="stack">…cards…</div>` |
70
- | `card` | a glass panel; one topic each | `<div class="card">…</div>` |
71
- | `grid`, `grid wide-left` | cards side by side (auto columns; `wide-left` is 1.3 : 1) | `<div class="grid wide-left"><div class="card">…</div><div class="stack">…</div></div>` |
72
- | `h`, `.n` | small section heading, optional count | `<div class="h">Acceptance <span class="n">3 / 11</span></div>` |
73
- | `head`, `.meta` | title line | `<div class="head"><h1>Title</h1><span class="chip run">in progress</span><span class="meta mono faint">updated MM-DD HH:MM</span></div>` |
72
+ | `stack` | vertical spacing between sections | `<div class="stack">…cards…</div>` |
73
+ | `card` | a section of the page, one topic each: plain, no box | `<div class="card">…</div>` |
74
+ | `callout` | the one boxed panel, for something the user has to act on; `callout ask` tints it amber | `<div class="card callout ask"><div class="h">Needs you</div>…</div>` |
75
+ | `grid`, `grid wide-left` | sections side by side (auto columns; `wide-left` is 1.3 : 1) | `<div class="grid wide-left"><div class="card">…</div><div class="stack">…</div></div>` |
76
+ | `h`, `.n` | section heading, optional count or note in a quieter tone | `<div class="h">Acceptance <span class="n">3 / 11</span></div>` |
77
+ | `kicker`, `.meta` | optional muted line above the title: scope, with the updated time on the right | `<div class="kicker">Project · scope<span class="meta">updated MM-DD HH:MM</span></div>` |
78
+ | `head`, `.meta` | title line with the overall state; `.meta` (right-aligned) when there is no kicker | `<div class="head"><h1>Title</h1><span class="chip run">in progress</span></div>` |
74
79
  | `lead` | the one-line status under the head; `<b>` for the key fact | `<div class="lead"><b>Stage B merged.</b> C waits for a GPU.</div>` |
75
- | `chip` + state | a state label | `<span class="chip wait">waiting</span>` |
80
+ | `chip` + state | a state label: a status dot and a word | `<span class="chip wait">waiting</span>` |
76
81
  | `meter`, `legend .sw` | progress, one `<i>` per unit | `<div class="meter"><i class="ok"></i><i class="run"></i><i></i></div>` and `<div class="legend"><span><span class="sw ok"></span>done 1</span></div>` |
77
- | `steps` > `step` + state | stage cards: `.top` (`.k` name + chip), `.t` what it delivers, `.m` a fact | `<div class="step run"><div class="top"><span class="k">C</span><span class="chip run">running</span></div><div class="t">…</div><div class="m">2 / 5</div></div>` |
78
- | `rows` > `row` | lists of acceptance criteria, checkpoints, decisions, risks, outputs: `.id`, `.body` (with `.sub` second line), `.end` | `<div class="row"><span class="ic ok">✓</span><span class="id">A-2</span><span class="body">…<span class="sub">…</span></span><span class="end">4a85587c</span></div>` |
82
+ | `steps` > `step` + state | stages, as rows in two columns: the step's state draws its icon column, `.top` (`.k` name + chip), `.t` what it delivers, `.m` a fact | `<div class="step run"><div class="top"><span class="k">C</span><span class="chip run">running</span></div><div class="t">…</div><div class="m">2 / 5</div></div>` |
83
+ | `rows` > `row` | lists of acceptance criteria, checkpoints, decisions, risks, outputs: `.id` (mono), `.body` (with `.sub` second line), `.end` right-aligned meta | `<div class="row"><span class="ic ok">✓</span><span class="id">A-2</span><span class="body">…<span class="sub">…</span></span><span class="end">4a85587c</span></div>` |
79
84
  | `ic` + state, `ic risk`, `ic todo` | the icon at the start of a row; you choose the glyph (✓ ◐ ● ◌ ▲ ○) | `<span class="ic risk">▲</span>` |
80
- | `tl` | a timeline card: each row starts with `.when` | `<div class="card tl"><div class="rows"><div class="row"><span class="when">MM-DD HH:MM</span><span class="chip ok">done</span><span class="body">…</span></div></div></div>` |
81
- | `mono`, `muted`, `faint`, `code` | text tones and inline code | `<span class="mono faint">…</span>`, `<code>path</code>` |
85
+ | `tl` | a timeline section: each row starts with `.when` | `<div class="card tl"><div class="rows"><div class="row"><span class="when">MM-DD HH:MM</span><span class="chip ok">done</span><span class="body">…</span></div></div></div>` |
86
+ | `gallery` > `figure` | same-size thumbnails of images or videos, each with an optional `figcaption`; `style="--b-thumb:240px"` sets the minimum column width (default 160px) | `<div class="gallery"><figure><img src="assets/a.png" alt="…"><figcaption>run-12 · loss</figcaption></figure>…</div>` |
87
+ | `tex` on a `span` / `div` | a formula, inline or on its own line | `<span class="tex">\alpha_t</span>`, `<div class="tex">\frac{a}{b}</div>` |
88
+ | `tbl`, `num` | a table in a wrapper that scrolls sideways instead of squeezing: headers and `num` cells stay on one line, so wrap any table wider than a phone in it; `num` right-aligns a numeric `th`/`td` | `<div class="tbl"><table><tr><th>Run</th><th class="num">Success</th></tr><tr><td>run-12</td><td class="num">0.84</td></tr></table></div>` |
89
+ | `mono`, `muted`, `faint`, `code` | the code face (code only) and text tones; inline code | `<span class="muted">…</span>`, `<code>path</code>` |
82
90
 
83
- Plain `p`, `ul`, `table` and `img` are styled to match. The scaffold written by `board_open` has a working example of each component.
91
+ Plain `p`, `ul`, `table`, `img`, `figure` and `pre` are styled to match; `pre` (a log tail, a command) scrolls in place rather than widening the page. The scaffold written by `board_open` has a working example of each component.
84
92
 
85
93
  ## When to update
86
94
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
3
  "name": "cortex-system",
4
- "version": "0.6.5",
5
- "description": "Cortex system skill bundle — approval / client-manage / project-init / schedule / user-learn."
4
+ "version": "0.7.1",
5
+ "description": "Cortex system skill bundle — approval / browser / client-manage / project-init / schedule / user-learn."
6
6
  }
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: browser
3
+ description: "Use whenever a task needs a real web browser: verifying or inspecting a web UI (a dev server, a Cortex page, a deployed site), taking a screenshot of a page, reading a page that needs JavaScript or a login, clicking through or operating a website, filling in forms, or checking what a user sees on their own machine. Drive it with the `cortex-browser` CLI."
4
+ metadata:
5
+ author: "Cortex"
6
+ version: "1.1.1"
7
+ date: "2026-10-19"
8
+ ---
9
+
10
+ # Browser
11
+
12
+ `cortex-browser` is agent-browser attached to a Chrome that Cortex manages. Every session (and
13
+ every worker or subagent) gets its own tab, kept between turns. After 10 minutes without a
14
+ `cortex-browser` call the tab is closed, and the next call starts on a blank page, so reopen the URL
15
+ you need. Logins live in the browser profile, not the tab, and survive that and later sessions.
16
+
17
+ ## Commands
18
+
19
+ Everything except `--device` is passed to agent-browser. Its full, version-matched guide is one
20
+ command away; read it before anything beyond open/snapshot/click rather than guessing flags:
21
+
22
+ ```bash
23
+ cortex-browser skills get core # workflow and common commands
24
+ cortex-browser skills get core --full # every command and option
25
+ ```
26
+
27
+ The guide is written for plain `agent-browser`: run its examples as `cortex-browser`, and skip its
28
+ advice on `--session`, `--cdp`, `connect` and launching browsers, which Cortex handles.
29
+
30
+ The usual loop: `cortex-browser open <url>`, then `cortex-browser snapshot -i` to list interactive
31
+ elements as refs (`@e1`, `@e2` …), then `click @e2` / `fill @e3 "text"`. Snapshot again after the
32
+ page changes: refs from an old snapshot go stale.
33
+
34
+ ## Which machine
35
+
36
+ - Default is `server`, the Chrome on the Cortex server. There, `localhost` means the server.
37
+ - `--device <name>` uses the Chrome on a connected device instead (its `localhost`, its network,
38
+ its logins), and sticks for the rest of the session. Use it when the user asks for their machine
39
+ or when the page only exists there.
40
+ - Commands still run on the server, so screenshots and other files land on the server either way.
41
+
42
+ When `cortex-browser` exits non-zero (device offline, Chrome failed to start, unknown device), the
43
+ message says why and what to do.
44
+
45
+ ## Showing the user
46
+
47
+ `cortex-browser screenshot ./page.png` (relative paths resolve against your working directory;
48
+ `--full` for the whole page), then send it with `send_file`. The user can also watch the browser
49
+ live in the **Agent browser** tab of the Cortex app.
50
+
51
+ ## Logins, captchas, 2FA
52
+
53
+ Don't try to get around them. Ask the user to open the **Agent browser** tab, press **Take over**,
54
+ finish the login, and press **Hand back**, then end your turn. When they reply, carry on in the same
55
+ tab. While they are in control, `cortex-browser` refuses with "the user is controlling this
56
+ browser": wait for them rather than retrying.
@@ -4,8 +4,8 @@ description: "Use when creating, deploying, updating, or troubleshooting cortex-
4
4
  allowed-tools: Read, Write, Edit, Bash, mcp__cortex-core__remote_bash, mcp__cortex-core__remote_read, mcp__cortex-core__remote_write, mcp__cortex-core__remote_edit, mcp__cortex-core__remote_glob, mcp__cortex-core__remote_grep
5
5
  metadata:
6
6
  author: "Cortex"
7
- version: "1.4.0"
8
- date: "2026-05-03"
7
+ version: "1.4.1"
8
+ date: "2026-10-22"
9
9
  ---
10
10
 
11
11
  # Client Manage
@@ -52,7 +52,13 @@ The client resolves its server URL by precedence (`server-url.ts`): `CORTEX_SERV
52
52
  - `clientToken` — The server's `CORTEX_CLIENT_TOKEN` (see Authentication). Required unless injected via the `CORTEX_CLIENT_TOKEN` env at launch.
53
53
  - `deviceName` — Must match the name in `machines.json` on the server.
54
54
 
55
- **This config file is managed by you (LLM).** The server never writes it. Server only starts/kills the client process.
55
+ Who writes this file:
56
+
57
+ - The bootstrap script (step 2 below) writes `serverHost`, `serverPort` and `deviceName`, replacing the whole file. Re-running bootstrap drops any `serverUrl` or `clientToken` you added.
58
+ - `cortex init` writes it for a local desktop client it prepares, and server startup finishes an interrupted preparation. It records ownership in `client/local-install.json` and refuses to overwrite a config that was edited afterwards.
59
+ - `cortex client remove` deletes it together with the client install.
60
+
61
+ Any other edit, such as switching a device to `serverUrl`, is yours to make on the device.
56
62
 
57
63
  ## Connectivity — The Most Important Part
58
64
 
@@ -97,7 +103,7 @@ Test each candidate from the remote device. Use the first one that works.
97
103
  Read `machines.json` on the server for the current device list. Key fields per device:
98
104
 
99
105
  - `ssh` — How the server reaches this device (empty = local)
100
- - `cortexPath` — Path to user's workspace on the device
106
+ - `cortexPath` — The user's home directory on the device (`/home/<user>`, `C:\Users\<user>` on Windows). It must exist: the Machines panel reports disk space for the filesystem holding it, and relative `!sendfile` paths resolve against it
101
107
  - `gpuCount` — Number of GPUs
102
108
  - `win` — `true` for Windows
103
109
  - `clientCommand` — (optional) command the server runs over SSH to launch the client; defaults to `node "$HOME/.cortex/client/current/client.mjs"` (`%USERPROFILE%` on Windows). Override on machines where `node` isn't on the **non-login** SSH PATH — e.g. nvm installs: set an absolute node path like `"/home/u/.nvm/versions/node/v20.19.5/bin/node /home/u/.cortex/client/current/client.mjs"`. See Troubleshooting.
@@ -106,7 +112,7 @@ Read `machines.json` on the server for the current device list. Key fields per d
106
112
 
107
113
  ### 1. Register in machines.json
108
114
 
109
- Edit `machines.json` on the server to add the device entry.
115
+ Edit `machines.json` on the server to add the device entry. Set `cortexPath` to the user's home directory on the device and confirm it exists (`ssh user@host 'echo $HOME'`).
110
116
 
111
117
  ### 2. Deploy the client bundle
112
118
 
@@ -180,13 +186,14 @@ To force a refresh, kill the client — the server relaunches it and the reconne
180
186
  ssh user@host "pkill -f client.mjs"
181
187
  ```
182
188
 
183
- If a bad bundle leaves the client unable to start, roll back or redeploy:
189
+ If a bad bundle leaves the client unable to start, switch back to the prior version in `previous/` or re-run the bootstrap deployment (step 2 above). `current/` and `previous/` are real directories, not symlinks. Move the failing version aside into an unused name rather than deleting it; the command checks that `previous/` exists and `broken/` is free before moving anything:
184
190
 
185
191
  ```bash
186
- ssh user@host "rm -rf ~/.cortex/client/current && mv ~/.cortex/client/previous ~/.cortex/client/current"
187
- # or re-run the bootstrap deployment (step 2 above)
192
+ ssh user@host 'cd ~/.cortex/client && test -d previous && test ! -e broken && mv current broken && mv previous current'
188
193
  ```
189
194
 
195
+ On Windows devices, run the PowerShell form from `docs/cross-machine.md`. The server relaunches the client from `current/`. On reconnect it pushes its own bundle again whenever the hashes differ, so a rollback holds only until the server's bundle is fixed; setting `clientHotReloadEnabled` to `false` in the server's `settings.json` turns update pushes off meanwhile. Remove `broken/` once the device is healthy.
196
+
190
197
  ### Edit the config
191
198
 
192
199
  ```
@@ -201,7 +208,7 @@ mcp__cortex-core__remote_edit({
201
208
  After editing, kill the client — server will restart it:
202
209
 
203
210
  ```bash
204
- ssh user@host "pkill -f 'node.*cortex-client'"
211
+ ssh user@host "pkill -f client.mjs"
205
212
  ```
206
213
 
207
214
  ## Troubleshooting
@@ -51,7 +51,7 @@ This is the entry point for future sessions. Must include:
51
51
 
52
52
  | File | Type | Purpose |
53
53
  |------|------|---------|
54
- | STATUS.md | Overwrite | Present-tense state register (hard cap 80 lines AND 6KB) |
54
+ | STATUS.md | Overwrite | Present-tense state register (hard caps <=80 lines and <=6KB; exceeding either is rejected) |
55
55
  | experiments/ | Atomic file | One EXP-NNN.md per experiment (YAML frontmatter + body), index.md auto-generated |
56
56
  | knowledge/ | Atomic file | One K-NNN.md per knowledge entry, index.md auto-generated |
57
57
  | patterns/ | Atomic file | Cross-experiment patterns, index.md auto-generated |
@@ -80,7 +80,7 @@ This is the entry point for future sessions. Must include:
80
80
 
81
81
  ### STATUS.md (required) — Current state snapshot
82
82
 
83
- Format is governed by `rules/status-md.md` (overwrite-style state register, hard cap 80 lines AND 6KB, each bullet <=2 lines, facts with a durable home appear as pointers only):
83
+ Format is governed by `rules/status-md.md` (overwrite-style state register, hard caps <=80 lines and <=6KB with either one rejecting the write, each bullet <=2 lines, facts with a durable home appear as pointers only):
84
84
 
85
85
  ```markdown
86
86
  # [Project Name] Status
@@ -9,7 +9,7 @@ Directory index + entry map. Loaded into the context of every agent that works i
9
9
 
10
10
  ## Hard Constraints
11
11
 
12
- - **Hard cap: 120 lines AND 8KB** (enforced by guard hook). The hook path truncates at 9,500 characters, so content past that line is never injected at all — pure waste.
12
+ - **Hard cap: at most 120 lines and at most 8KB** (enforced by guard hook, which rejects a write that exceeds either limit). The hook path truncates at 9,500 characters, so content past that line is never injected at all — pure waste.
13
13
  - **Each index line <=200 characters**: one sentence of purpose + pointer.
14
14
  - **One line per atomic directory**: experiments/, knowledge/, patterns/, decisions/ each take a single line in the index, pointing at their auto-generated index.md (or the directory itself). **Never enumerate per-entry summaries** — summaries already live in the atomic files' frontmatter and index.md; copies in the index are pure redundancy.
15
15
 
@@ -9,7 +9,7 @@ Records execution friction affecting work efficiency: misleading requirements, c
9
9
 
10
10
  ## Hard Constraints
11
11
 
12
- - **Length limit: 80 lines AND 6KB** (enforced by guard hook; the dual limit prevents gaming the line cap with mega-lines). Exceeding means unresolved issues are accumulating, triggering cleanup.
12
+ - **Length limit: at most 80 lines and at most 6KB** (enforced by guard hook, which rejects a write that exceeds either limit; the byte limit keeps mega-lines from gaming the line cap). Exceeding means unresolved issues are accumulating, triggering cleanup.
13
13
  - **Each entry <=4 lines**. Investigation detail not fitting is a signal to pointer-ize, not to lengthen the line.
14
14
  - **Append mode**: New issues are appended to the end.
15
15
  - **Resolved entries are deleted directly**: No archiving, no history retained. Delete the corresponding entry from the file immediately after fixing.
@@ -31,9 +31,9 @@ PostToolUse hook automatically records Read/Grep access to atomic files (EXP/K/P
31
31
 
32
32
  | File | Dedicated rule | Update mode |
33
33
  |------|----------------|-------------|
34
- | `STATUS.md` | status-md.md | Overwrite snapshot (state register), hard limit 80 lines AND 6KB, each bullet <=2 lines |
35
- | `ISSUES.md` | issues-md.md | Append, resolved entries deleted directly, hard limit 80 lines AND 6KB, each entry <=4 lines |
36
- | `AGENTS.md` (directory index) | agents-md.md | Pointer-style index, hard limit 120 lines AND 8KB, one line per atomic directory |
34
+ | `STATUS.md` | status-md.md | Overwrite snapshot (state register), hard limits <=80 lines and <=6KB (exceeding either is rejected), each bullet <=2 lines |
35
+ | `ISSUES.md` | issues-md.md | Append, resolved entries deleted directly, hard limits <=80 lines and <=6KB (exceeding either is rejected), each entry <=4 lines |
36
+ | `AGENTS.md` (directory index) | agents-md.md | Pointer-style index, hard limits <=120 lines and <=8KB (exceeding either is rejected), one line per atomic directory |
37
37
  | `mission.md` | mission-md.md | Modify after user confirmation |
38
38
  | `roadmap.md` | roadmap-md.md | Stable, milestones must contain testable checklist |
39
39
  | `OVERVIEW.md` | overview-md.md | Synchronous update, hard limit 60 lines |
@@ -11,7 +11,7 @@ The project's "constitution": defines goals and success conditions. It is the ba
11
11
 
12
12
  - **Stable file**: Can only be modified after user confirmation. Cortex must not rewrite or expand scope on its own.
13
13
  - **Modification trigger condition**: User explicitly directs a re-orientation, pivot, or scope change. Do not touch in any other case.
14
- - **Limit: 100 lines AND 8KB**. Too long means content that belongs in roadmap/STATUS or a project-pitch document has been mixed in; trimming also requires user confirmation.
14
+ - **Limit: at most 100 lines and at most 8KB**. Exceeding either means content that belongs in roadmap/STATUS or a project-pitch document has been mixed in; trimming also requires user confirmation.
15
15
 
16
16
  ## Required Sections
17
17
 
@@ -17,7 +17,7 @@ It answers exactly four questions: where are we, what is in flight, what is in t
17
17
  ## Hard Constraints
18
18
 
19
19
  - **Update mode: overwrite-rewrite the snapshot**. Every "add a line" must be paired with a check for which existing lines it makes stale — delete those.
20
- - **Length limit: 80 lines AND 6KB, both hard**. Scan before writing: at >=60 lines or >=4KB, warn and trim proactively; over the limit, trim below it before the write is allowed.
20
+ - **Length limit: at most 80 lines and at most 6KB, both hard**: exceeding either one blocks the write. Scan before writing: at >=60 lines or >=4KB, warn and trim proactively; over either limit, trim below both before the write is allowed.
21
21
  - **Each bullet <= 2 lines**. If it doesn't fit, the detail belongs elsewhere — keep one sentence + a pointer.
22
22
  - **Facts with a durable home appear only as pointers**: EXP-NNN / K-NNN / DR-NNNN / commit SHA / file path. The only content unique to STATUS is the one-sentence synthesis of the current situation.
23
23
 
@@ -31,11 +31,8 @@ export interface ClaudeSpawnCompatibility {
31
31
  mcpConfigPaths: string[];
32
32
  mcpToolAllowlist: string[] | null;
33
33
  supplementalMcpConfigIdentity: string | null;
34
- /** Turning the browser on or off must force a FRESH process: a pooled Claude keeps whatever MCP
35
- * set it was spawned with, so without this the toggle would silently no-op until the process died. */
36
- browserMcpConfigIdentity: string | null;
37
- /** `--disable-slash-commands`. Part of the identity for the same reason as the browser: the skill
38
- * surface is fixed at spawn, so two agents that differ only here must not share a process. */
34
+ /** `--disable-slash-commands`. Part of the identity because the skill surface is fixed at spawn,
35
+ * so two agents that differ only here must not share a process. */
39
36
  disableSkills: boolean;
40
37
  /** `--setting-sources`. Null = the CLI's own default set; `[]` = load none. Both are decided at
41
38
  * spawn and cannot be re-pointed afterwards. */
@@ -8,6 +8,7 @@ import { IDLE_SESSION_TIMEOUT, TURN_IDLE_TIMEOUT, } from './defaults.js';
8
8
  import { claudeRouteIdentity } from './spawn-args.js';
9
9
  import { claudeProcessLaunch, launchFromSpec, sessionOptionsFromSpec, } from './session-options.js';
10
10
  import { computeTranscriptPath, readRestoredSessionCost, resolveResumeAgainstTranscript } from './transcript-path.js';
11
+ import { clearToolResultsForColdResume } from './transcript-clear.js';
11
12
  import { buildPrompt, clearActivePlanFile, createStreamDeltaState, } from './event-parser.js';
12
13
  import { BgTaskTracker } from './bg-task-tracker.js';
13
14
  import { ClaudeTurnMachine } from './turn-machine.js';
@@ -44,7 +45,6 @@ function compatibilityFromOptions(options) {
44
45
  mcpConfigPaths: cloneTextArray(options.mcpConfigPaths),
45
46
  mcpToolAllowlist: optionalTextArray(options.mcpToolAllowlist),
46
47
  supplementalMcpConfigIdentity: options.supplementalMcpConfigIdentity ?? null,
47
- browserMcpConfigIdentity: options.browserMcpConfigIdentity ?? null,
48
48
  disableSkills: options.disableSkills === true,
49
49
  settingSources: optionalTextArray(options.settingSources),
50
50
  };
@@ -66,7 +66,6 @@ export function claudeCompatibilityIdentity(compatibility) {
66
66
  ['tools', compatibility.tools],
67
67
  ['pluginCapabilityFingerprint', compatibility.pluginCapabilityFingerprint],
68
68
  ['supplementalMcpConfigIdentity', compatibility.supplementalMcpConfigIdentity],
69
- ['browserMcpConfigIdentity', compatibility.browserMcpConfigIdentity],
70
69
  ['disableSkills', compatibility.disableSkills],
71
70
  ['pluginDirs', compatibility.pluginDirs],
72
71
  ['mcpConfigPaths', compatibility.mcpConfigPaths],
@@ -178,12 +177,14 @@ class ClaudeSession {
178
177
  }
179
178
  spawnProcess() {
180
179
  this.validateSupplementalMcpConfig();
180
+ const { cwd, processSpawner, cliPath } = this.options;
181
+ const transcriptPath = computeTranscriptPath(cwd, this.sessionId);
182
+ if (this.needsResume)
183
+ clearToolResultsForColdResume(transcriptPath, this.sessionId);
181
184
  const { args, env } = claudeProcessLaunch({
182
185
  channel: this.channel, sessionId: this.sessionId, needsResume: this.needsResume, options: this.options,
183
186
  });
184
- const { cwd, processSpawner, cliPath } = this.options;
185
- const restoredCost = this.needsResume
186
- ? readRestoredSessionCost(computeTranscriptPath(cwd, this.sessionId), this.sessionId) : 0;
187
+ const restoredCost = this.needsResume ? readRestoredSessionCost(transcriptPath, this.sessionId) : 0;
187
188
  this.turns.resetCostBaseline(restoredCost);
188
189
  log.info(`Spawning persistent process: ${this.sessionId.substring(0, 8)} ${this.needsResume ? `(resume, restored cost $${restoredCost.toFixed(2)})` : '(new)'}`);
189
190
  const spawned = spawnClaudeProcess(processSpawner, args, { cwd, env }, cliPath);
@@ -0,0 +1,5 @@
1
+ import type { ToolUseSubagent } from '../normalize/event-types.js';
2
+ import type { PendingTurn } from './turn-machine.js';
3
+ import { type StreamDeltaState } from './event-parser.js';
4
+ /** Complete blocks share turn accounting, but thinking never enters the answer/text callbacks. */
5
+ export declare function handleAssistantBlocks(turn: PendingTurn, data: any, state: StreamDeltaState, sessionId: string, subagent?: ToolUseSubagent): void;
@@ -0,0 +1,61 @@
1
+ import { createLogger } from '../../core/log.js';
2
+ import { getSettings } from '../../core/settings.js';
3
+ import { isPlanFilePath, setActivePlanFile, takeTextBlockId, takeThinkingBlockId, } from './event-parser.js';
4
+ const log = createLogger('claude-bridge');
5
+ function handleToolBlock(turn, block, sessionId, subagent) {
6
+ if (block.name === 'Write' && isPlanFilePath(block.input?.file_path)) {
7
+ turn.planFilePath = block.input.file_path;
8
+ setActivePlanFile(sessionId, block.input.file_path);
9
+ }
10
+ if (block.name === 'EnterPlanMode')
11
+ turn.enteredPlanMode = true;
12
+ if (block.name === 'ExitPlanMode')
13
+ turn.exitedPlanMode = true;
14
+ try {
15
+ turn.onToolUse?.(block.name || '?', block.input || {}, typeof block.id === 'string' ? block.id : '', subagent);
16
+ }
17
+ catch (error) {
18
+ log.warn('onToolUse threw:', error.message);
19
+ }
20
+ }
21
+ function handleTextBlock(turn, data, block, state, subagent) {
22
+ if (!block.text)
23
+ return;
24
+ const model = typeof data.message?.model === 'string' ? data.message.model : null;
25
+ // Child prose is complete and attributed, never the parent's answer or streamed text cursor.
26
+ if (subagent) {
27
+ turn.onAssistantMessage?.(block.text, undefined, model, subagent);
28
+ return;
29
+ }
30
+ turn.finalOutput = block.text;
31
+ if (block.text.length > (turn.longestOutput?.length || 0))
32
+ turn.longestOutput = block.text;
33
+ const blockId = takeTextBlockId(state) ?? undefined;
34
+ const streamedModel = state.messageId === data.message?.id ? state.model : null;
35
+ turn.onAssistantMessage?.(block.text, blockId, model ?? streamedModel);
36
+ }
37
+ function handleThinkingBlock(turn, block, state, subagent) {
38
+ if (subagent)
39
+ return;
40
+ // Consume even suppressed/empty blocks so a later complete event cannot adopt a stale id.
41
+ const blockId = takeThinkingBlockId(state) ?? undefined;
42
+ if (!getSettings().showThinking || typeof block.thinking !== 'string' || !block.thinking)
43
+ return;
44
+ turn.onAssistantThinking?.(block.thinking, blockId);
45
+ }
46
+ /** Complete blocks share turn accounting, but thinking never enters the answer/text callbacks. */
47
+ export function handleAssistantBlocks(turn, data, state, sessionId, subagent) {
48
+ if (subagent)
49
+ turn.subagentTurnCount += 1;
50
+ else
51
+ turn.turnCount += 1;
52
+ const handlers = {
53
+ tool_use: block => handleToolBlock(turn, block, sessionId, subagent),
54
+ text: block => handleTextBlock(turn, data, block, state, subagent),
55
+ thinking: block => handleThinkingBlock(turn, block, state, subagent),
56
+ };
57
+ for (const block of (data.message?.content || []))
58
+ handlers[block.type]?.(block);
59
+ if (!subagent)
60
+ turn.onProgress?.({ num_turns: turn.turnCount, total_cost_usd: null, duration_ms: null });
61
+ }
@@ -47,6 +47,7 @@ export declare class BgTaskTracker {
47
47
  private readonly running;
48
48
  private readonly undelivered;
49
49
  private readonly foreground;
50
+ /** task_id → the notification's `summary` ('' when it carried none). */
50
51
  private readonly armed;
51
52
  /** task_id → the `Agent`/`Task` tool call that spawned it. Populated from `task_started`, which
52
53
  * is the only event carrying BOTH ids: `task_updated` reports terminal status with `task_id`
@@ -67,7 +68,8 @@ export declare class BgTaskTracker {
67
68
  * opened yet; the next assistant line with no active turn is that turn. Cleared by
68
69
  * disarmContinuation(). */
69
70
  get continuationArmed(): boolean;
70
- disarmContinuation(): void;
71
+ /** Clear the armed notifications and return their non-empty summaries: what woke the model. */
72
+ disarmContinuation(): string[];
71
73
  /**
72
74
  * The authoritative "this subagent is over" signal, read off the same line `observe` consumes.
73
75
  *
@@ -3,7 +3,8 @@ export class BgTaskTracker {
3
3
  running = new Set();
4
4
  undelivered = new Set();
5
5
  foreground = new Set();
6
- armed = new Set();
6
+ /** task_id → the notification's `summary` ('' when it carried none). */
7
+ armed = new Map();
7
8
  /** task_id → the `Agent`/`Task` tool call that spawned it. Populated from `task_started`, which
8
9
  * is the only event carrying BOTH ids: `task_updated` reports terminal status with `task_id`
9
10
  * alone, so without this map a completion cannot be attributed to a UI subagent block. */
@@ -62,7 +63,7 @@ export class BgTaskTracker {
62
63
  if (!known && data.status === 'stopped')
63
64
  break;
64
65
  // The authoritative completion-delivery signal: the model is being re-invoked.
65
- this.armed.add(id);
66
+ this.armed.set(id, typeof data.summary === 'string' ? data.summary.trim() : '');
66
67
  break;
67
68
  }
68
69
  default:
@@ -103,8 +104,11 @@ export class BgTaskTracker {
103
104
  get continuationArmed() {
104
105
  return this.armed.size > 0;
105
106
  }
107
+ /** Clear the armed notifications and return their non-empty summaries: what woke the model. */
106
108
  disarmContinuation() {
109
+ const summaries = [...this.armed.values()].filter(Boolean);
107
110
  this.armed.clear();
111
+ return summaries;
108
112
  }
109
113
  /**
110
114
  * The authoritative "this subagent is over" signal, read off the same line `observe` consumes.