@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
@@ -29,7 +29,7 @@ export const UI_SSE_KEEPALIVE = {
29
29
  ping: { enabled: true, intervalMs: 15_000 },
30
30
  client: { reconnectAfterInactivityMs: 45_000 },
31
31
  };
32
- const t = initTRPC.create({
32
+ const t = initTRPC.context().create({
33
33
  sse: UI_SSE_KEEPALIVE,
34
34
  errorFormatter({ shape, path }) {
35
35
  if (path !== 'config.setPlatform')
@@ -1,8 +1,12 @@
1
1
  import type { PlatformSettingsSnapshot } from '../../core/platform-settings-spec.js';
2
2
  export type { PlatformSettingsPatch, PlatformSettingsSnapshot, PlatformFieldSnapshot, PlatformFieldKey } from '../../core/platform-settings-spec.js';
3
+ import type { ResolveMediaInput, ResolveMediaResult } from './inline-media-types.js';
4
+ export type { InlineMediaErrorCode, ResolveMediaInput, ResolveMediaResult } from './inline-media-types.js';
3
5
  import type { SessionsSetStarredReturn, SessionsRenameReturn } from './session-metadata-schemas.js';
4
6
  export type { SessionsSetStarredArgs, SessionsSetStarredReturn, SessionsRenameArgs, SessionsRenameReturn, } from './session-metadata-schemas.js';
5
7
  import type { z } from 'zod';
8
+ import type { EngineSelection, ModelRef } from '../agents/engine-selection.js';
9
+ export type { EngineSelection, ModelRef } from '../agents/engine-selection.js';
6
10
  import type { queryInputSchemas, mutateInputSchemas } from './input-schemas.js';
7
11
  import type { Project, CreateProjectResult } from '../projects/index.js';
8
12
  import type { CostSummary } from '../costs/cost-tracker.js';
@@ -49,6 +53,10 @@ import type { CustomProviderStores, CustomProviderView } from '../pi-providers/i
49
53
  export type { CustomProviderApi, CustomProviderModelSpec, CustomProviderView, } from '../pi-providers/index.js';
50
54
  import type { UsageSharingSettings } from '../costs/aistatus-config.js';
51
55
  export type { UsageSharingSettings } from '../costs/aistatus-config.js';
56
+ import type { TelemetryInfo } from '../telemetry/info.js';
57
+ export type { TelemetryInfo } from '../telemetry/info.js';
58
+ import type { ClientKind } from '../telemetry/client-kind.js';
59
+ export type { ClientKind } from '../telemetry/client-kind.js';
52
60
  export type { ProviderRateLimitPolicyOverride, ProviderRateLimitWindowPolicyOverride, ProviderRateLimits, } from '../../core/settings-spec.js';
53
61
  export type Ok<T> = {
54
62
  ok: true;
@@ -104,7 +112,8 @@ export interface AuthSyncGatewayReturn {
104
112
  /** False when nothing was written (see `reason`); not an error. */
105
113
  configured: boolean;
106
114
  endpoints: number;
107
- profiles: string[];
115
+ defaultSet: boolean;
116
+ favorites: ModelRef[];
108
117
  reason?: string;
109
118
  }
110
119
  export interface AuthRemoveCustomProviderReturn {
@@ -116,16 +125,6 @@ export interface SessionsMarkManyReadReturn {
116
125
  * are skipped rather than failing the batch. */
117
126
  marked: number;
118
127
  }
119
- /** The part of a session's engine selection that came from the user rather than from its profile.
120
- * Every field is optional: a session may override only its thinking level, only its model, or any
121
- * mix. Backend is never here — it belongs to the profile (and a live conversation cannot change it). */
122
- export interface SessionSelectionOverride {
123
- model?: string;
124
- provider?: string;
125
- thinking?: string;
126
- /** Which gateway route of the profile's endpoint bills the turn — anthropic `plan` vs `api`. */
127
- mode?: string;
128
- }
129
128
  /** Return of sessions.answerQuestion / sessions.respondPlan. 'already-resolved' means another
130
129
  * client (or Slack / timeout) resolved the interaction first — not an error; the caller
131
130
  * refetches the transcript to show the final state. */
@@ -157,23 +156,9 @@ export interface ProviderRateLimitPolicy {
157
156
  enabled: boolean;
158
157
  threshold: number | null;
159
158
  }
160
- export interface ProfileDraftInput {
161
- model: string;
162
- backend?: Backend;
163
- mode?: string;
164
- provider?: string;
165
- thinking?: string;
166
- extraOption?: Record<string, string>;
167
- }
168
- export interface ProfilesCreateReturn {
169
- name: string;
170
- }
171
- export interface ProfilesUpdateReturn {
159
+ export interface ModelsMutationReturn {
172
160
  changed: boolean;
173
161
  }
174
- export interface ProfilesRemoveReturn {
175
- removed: boolean;
176
- }
177
162
  export interface ProjectConduitInfo {
178
163
  id: string;
179
164
  kind: 'research' | 'general';
@@ -218,27 +203,16 @@ export interface SessionInfo {
218
203
  starred?: boolean;
219
204
  /** Explicitly renamed labels take precedence over generated scheduled-run titles. */
220
205
  labelRenamed?: boolean;
221
- /** The session's active agent profile (registry record). Null when never explicitly set — the
222
- * client falls back to the config default. Kept in sync by the shared profile-switch rule. */
223
- profileName: string | null;
206
+ /** Complete engine choice persisted with the session. */
207
+ selection: EngineSelection | null;
224
208
  /** The agent template the session runs as — its environment (prompt, tools, skills, rules), the
225
209
  * other half of "what will the next turn be". Null when the session follows its channel's
226
210
  * selection and, beneath that, the global default. Kept in sync by the agent-switch rule. */
227
211
  agentName?: string | null;
228
- /** What the user selected on top of that profile (model / provider / thinking), or null when the
229
- * session runs its profile as declared. The composer needs both halves to show what the next turn
230
- * will actually run; the profile alone would lie whenever a model was picked. */
231
- selectionOverride?: SessionSelectionOverride | null;
232
- /** Browser control this session opted into at creation, or null. Fixed for the session's life:
233
- * the agent's tool set is decided when its process spawns, so this is a fact to display, not a
234
- * setting to flip. */
235
- browser?: {
236
- device: string;
237
- } | null;
238
212
  /** Latest backend context occupancy, or null until a supported backend reports one. Optional only
239
213
  * for rolling compatibility with older servers/fixtures; current sessions.list always supplies it. */
240
214
  contextUsage?: SessionContextUsage | null;
241
- /** True only for PI and Claude print sessions under their fixed profile. */
215
+ /** Whether this backend supports manual context compaction. */
242
216
  contextCompactionSupported?: boolean;
243
217
  /** The agent's latest task list, or null when it has not written one. Queryable snapshot half of
244
218
  * snapshot+delta — `session.todos` is the delta. Live state, not persisted: a server restart
@@ -296,6 +270,9 @@ export interface SessionInfo {
296
270
  * it (`sessions.markRead` → registry lastReadAt). Legacy records with no lastReadAt are treated
297
271
  * as read (no unread flood on first deploy). */
298
272
  unread: boolean;
273
+ /** When the user last viewed the session (`sessions.markRead`); null when never. The chat finds
274
+ * the first reply that landed after it. Optional for rolling compatibility with older servers. */
275
+ lastReadAt?: string | null;
299
276
  }
300
277
  export type InteractionKind = 'ask-user' | 'plan-approval';
301
278
  export type InteractionStatus = 'pending' | 'answered' | 'approved' | 'rejected' | 'expired' | 'cancelled';
@@ -361,7 +338,8 @@ export interface TranscriptMessage {
361
338
  /** `worker-progress`: a team worker's final reply for a turn that ended while it still had work
362
339
  * pending (queued message, background task, open waitpoint or interaction). Recorded in the
363
340
  * LEAD's history for display only: it never reaches the lead model and is not a user turn. */
364
- type: 'user' | 'assistant' | 'tool' | 'interaction' | 'worker-progress';
341
+ type: 'user' | 'assistant' | 'thinking' | 'tool' | 'interaction' | 'worker-progress';
342
+ blockId?: string;
365
343
  /** user / assistant / interaction / worker-progress text; null for tool events. */
366
344
  text: string | null;
367
345
  /** tool name (tool events only). */
@@ -491,9 +469,8 @@ export interface ScheduleInfo {
491
469
  type: 'interval' | 'daily' | 'weekly' | 'once';
492
470
  message: string;
493
471
  projectId: string;
494
- /** The agent profile this schedule runs under, from the schedule config source.
495
- * null for legacy records that never recorded a profile (honest placeholder — no fabrication). */
496
- profile: string | null;
472
+ /** Complete engine choice materialized when the schedule is created. */
473
+ selection: EngineSelection | null;
497
474
  nextRun: string | null;
498
475
  lastRun: string | null;
499
476
  paused: boolean;
@@ -650,32 +627,19 @@ export interface ConfigBudget {
650
627
  * surfaced as a partially-null override. */
651
628
  projects: Record<string, BudgetValue>;
652
629
  }
653
- export interface ConfigProfileEntry {
654
- name: string;
655
- model: string | null;
656
- backend: Backend | null;
657
- mode: string | null;
658
- /** Thinking level (backend-native value: claude --effort / pi --thinking). */
659
- thinking: string | null;
660
- /** Rate-limit provider identity; required by profiles whose effective backend is 'pi'. */
661
- provider: string | null;
662
- /** Extra CLI flags (keys start with '--'). Returned in full — the editor must round-trip them. */
663
- extraOption: Record<string, string>;
664
- /** KEYS ONLY of `extraEnv`. Values are environment injection and may hold a token, so they are
665
- * never returned; an edit preserves the stored values untouched. */
666
- extraEnvKeys: string[];
667
- /** Number of declared fallback entries. The fallback chain itself is not editable from the UI. */
668
- fallbackCount: number;
669
- }
670
- export interface ConfigProfiles {
671
- defaultProfile: string | null;
672
- profiles: ConfigProfileEntry[];
630
+ export interface ConfigModels {
631
+ default: EngineSelection | null;
632
+ favorites: ModelRef[];
633
+ memory: Record<string, {
634
+ thinking: string | null;
635
+ mode: string;
636
+ }>;
673
637
  }
674
638
  export interface ModelCatalogRoute {
675
639
  /** Gateway endpoint group: 'anthropic' for claude, the PI provider name otherwise. */
676
640
  endpoint: string;
677
641
  backend: Backend;
678
- /** PI `--provider`; null for claude, whose provider identity is not a profile field. */
642
+ /** PI `--provider`; null for claude. */
679
643
  provider: string | null;
680
644
  /** Mode names gateway.yaml actually declares for this endpoint, in file order. Never empty: an
681
645
  * endpoint with no gateway section falls back to the name `discoverEndpoints` would generate. */
@@ -696,7 +660,7 @@ export interface ModelCatalogSnapshot {
696
660
  /** True while PI's first model scan is still in flight — the client may refetch shortly. */
697
661
  piPending: boolean;
698
662
  /** The backend-wide thinking ladders, served so a picker does not keep a second copy of the
699
- * table the profile validator already enforces. Optional for the same roll-skew reason as
663
+ * table the selection validator already enforces. Optional for the same roll-skew reason as
700
664
  * `modelThinking`. */
701
665
  thinkingLevels?: Record<Backend, string[]>;
702
666
  }
@@ -710,13 +674,10 @@ export interface ConfigMachine {
710
674
  export interface ConfigMcp {
711
675
  servers: string[];
712
676
  }
713
- /** One execution environment (`config/environments/`) as a picker needs it: what it is for, and
714
- * which profile it pins (or `__active__` — it runs whatever the conversation's own profile
715
- * resolves to). */
677
+ /** One execution environment (`config/environments/`) offered by the picker. */
716
678
  export interface ConfigAgentEntry {
717
679
  name: string;
718
680
  description?: string;
719
- profile: string;
720
681
  }
721
682
  export interface ConfigEnvEntry {
722
683
  key: string;
@@ -827,19 +788,14 @@ export interface HooksTestReturn {
827
788
  stderr: string;
828
789
  error: string | null;
829
790
  }
830
- /** What a brand-new conversation starts on: the profile the composer should preselect, plus the
831
- * model / provider / thinking / route the last pick left on top of it. Null on a host where
832
- * nobody has picked anything yet — the composer then falls back to the default profile. */
833
- export interface ConfigSelectionDefault extends SessionSelectionOverride {
834
- profileName?: string;
835
- /** The agent the last composer pick ran as — a draft opens in the environment the previous
836
- * conversation was working in, the same way it opens on its profile. */
791
+ /** Last composer choice; absent state falls back to models.default. */
792
+ export interface ConfigSelectionDefault extends EngineSelection {
837
793
  agentName?: string;
838
794
  }
839
795
  export interface ConfigSnapshot {
840
796
  platforms?: PlatformSettingsSnapshot[];
841
797
  budget: ConfigBudget | null;
842
- profiles: ConfigProfiles | null;
798
+ models: ConfigModels;
843
799
  machines: ConfigMachine[];
844
800
  mcp: ConfigMcp | null;
845
801
  /** The execution environments a composer may pick from, with what each one is and pins. Always
@@ -857,9 +813,8 @@ export interface ConfigSnapshot {
857
813
  * falls back to its local cache.
858
814
  */
859
815
  lang?: ConfigLang;
860
- /** Seed for a draft composer — see {@link ConfigSelectionDefault}. Optional while clients and
861
- * servers roll independently. */
862
- selectionDefault?: ConfigSelectionDefault | null;
816
+ /** Seed for a draft composer — see {@link ConfigSelectionDefault}. */
817
+ selectionDefault: ConfigSelectionDefault | null;
863
818
  }
864
819
  export interface ConfigLang {
865
820
  value: 'en' | 'zh';
@@ -1107,6 +1062,8 @@ export interface PluginsMcpRead {
1107
1062
  /** False when the plugin is legacy, where mcp.json is never loaded however it is written. */
1108
1063
  supported: boolean;
1109
1064
  servers: UiPluginMcpDraft[];
1065
+ /** Send back on save: a write from a stale read is refused as a conflict. */
1066
+ baseHash: string;
1110
1067
  }
1111
1068
  /** Secret maps are patches, not replacements: `null` keeps whatever is on disk under that key, a
1112
1069
  * string sets a new value, and an omitted key is dropped. That is what lets the browser edit a
@@ -1195,7 +1152,7 @@ export interface ApprovalInfo {
1195
1152
  id: string;
1196
1153
  title: string;
1197
1154
  /**
1198
- * Owning project from the `- **Project**:` bullet (need-approval skill template). `null` (honest
1155
+ * Owning project from the optional `- **Project**:` bullet on hand-written entries. `null` (honest
1199
1156
  * placeholder, never fabricated) for legacy entries and system-level operations — the UI renders
1200
1157
  * those as "global".
1201
1158
  */
@@ -1339,34 +1296,12 @@ export interface SessionsCompactReturn {
1339
1296
  status: 'compacted' | 'not-needed';
1340
1297
  contextUsage: SessionContextUsage | null;
1341
1298
  }
1342
- export interface SessionsSetProfileReturn {
1343
- /** The profile now active on the session. */
1344
- profileName: string;
1345
- /** True when the switch moved to a different backend (only possible on a session with no history). */
1346
- backendChanged: boolean;
1347
- }
1348
1299
  export interface SessionsSetAgentReturn {
1349
- /** The agent now selected for the session; null when it follows the global default again. */
1300
+ /** The selected environment; null follows the global default agent. */
1350
1301
  agentName: string | null;
1351
- /** The profile that agent will run under — its own when it pins one, the channel's otherwise.
1352
- * For display: the switch never writes the channel's profile. */
1353
- profileName: string;
1354
- /** True when the switch moved to a different backend (only possible on a session with no history). */
1355
- backendChanged: boolean;
1356
1302
  }
1357
- /** What the session will run on its next turn, after the change — effective values, so the client
1358
- * can render the chip without re-deriving the profile/override layering. */
1359
- export interface SessionsSetSelectionReturn {
1360
- profileName: string;
1361
- backend: Backend;
1362
- model: string;
1363
- provider: string | null;
1364
- thinking: string | null;
1365
- /** The gateway route the next turn bills to. */
1366
- mode: string;
1367
- /** The fields that came from the selection rather than from the profile. Null when the session
1368
- * runs its profile as declared. */
1369
- override: SessionSelectionOverride | null;
1303
+ /** Effective engine choice after the mutation. */
1304
+ export interface SessionsSetSelectionReturn extends EngineSelection {
1370
1305
  backendChanged: boolean;
1371
1306
  }
1372
1307
  export interface SessionsCreateAndSendReturn {
@@ -1385,7 +1320,7 @@ export interface WaitpointsCancelReturn {
1385
1320
  }
1386
1321
  export interface ConfigSetReturn {
1387
1322
  written: true;
1388
- section: 'budget' | 'profiles' | 'settings' | 'preferences';
1323
+ section: 'budget' | 'settings' | 'preferences';
1389
1324
  }
1390
1325
  export interface ConfigSetProviderRateLimitPolicyReturn {
1391
1326
  written: true;
@@ -1445,6 +1380,7 @@ export interface QueryReturnMap {
1445
1380
  'auth.flowState': LoginFlowState | null;
1446
1381
  'auth.customProviders': CustomProviderView[];
1447
1382
  'usageSharing.get': UsageSharingSettings;
1383
+ 'telemetry.info': TelemetryInfo;
1448
1384
  'models.catalog': ModelCatalogSnapshot;
1449
1385
  'hooks.list': HooksOverview;
1450
1386
  'machines.list': MachineInfo[];
@@ -1472,7 +1408,6 @@ export interface MutateReturnMap {
1472
1408
  'sessions.send': SessionsSendReturn;
1473
1409
  'sessions.cancel': SessionsCancelReturn;
1474
1410
  'sessions.compact': SessionsCompactReturn;
1475
- 'sessions.setProfile': SessionsSetProfileReturn;
1476
1411
  'sessions.setAgent': SessionsSetAgentReturn;
1477
1412
  'sessions.setSelection': SessionsSetSelectionReturn;
1478
1413
  'sessions.createAndSend': SessionsCreateAndSendReturn;
@@ -1485,6 +1420,7 @@ export interface MutateReturnMap {
1485
1420
  'sessions.respondDecision': SessionsRespondDecisionReturn;
1486
1421
  'sessions.cancelResume': SessionsCancelResumeReturn;
1487
1422
  'sessions.rewind': SessionsRewindReturn;
1423
+ 'sessions.resolveMedia': ResolveMediaResult;
1488
1424
  'executions.cancel': ExecutionsCancelReturn;
1489
1425
  'waitpoints.cancel': WaitpointsCancelReturn;
1490
1426
  'schedules.pause': void;
@@ -1516,14 +1452,18 @@ export interface MutateReturnMap {
1516
1452
  'auth.upsertCustomProvider': CustomProviderView;
1517
1453
  'auth.removeCustomProvider': AuthRemoveCustomProviderReturn;
1518
1454
  'usageSharing.set': UsageSharingSettings;
1455
+ 'telemetry.report': {
1456
+ ok: true;
1457
+ };
1519
1458
  'hooks.create': HooksCreateReturn;
1520
1459
  'hooks.update': HooksUpdateReturn;
1521
1460
  'hooks.setEnabled': HooksSetEnabledReturn;
1522
1461
  'hooks.remove': HooksRemoveReturn;
1523
1462
  'hooks.test': HooksTestReturn;
1524
- 'profiles.create': ProfilesCreateReturn;
1525
- 'profiles.update': ProfilesUpdateReturn;
1526
- 'profiles.remove': ProfilesRemoveReturn;
1463
+ 'models.favorites.add': ModelsMutationReturn;
1464
+ 'models.favorites.remove': ModelsMutationReturn;
1465
+ 'models.setDefault': ModelsMutationReturn;
1466
+ 'models.setThinking': ModelsMutationReturn;
1527
1467
  'plugins.assign': PluginsAssignReturn;
1528
1468
  'plugins.skillWrite': PluginsSkillWriteReturn;
1529
1469
  'plugins.skillCreate': PluginsSkillReturn;
@@ -1550,21 +1490,28 @@ export type QueryParams<S extends QueryScope> = QueryParamMap[S];
1550
1490
  export type QueryReturn<S extends QueryScope> = QueryReturnMap[S];
1551
1491
  export type MutateArgs<O extends MutateOp> = MutateArgsMap[O];
1552
1492
  export type MutateReturn<O extends MutateOp> = MutateReturnMap[O];
1493
+ /** Per-request facts the transport knows and handlers may use; never part of the op's args. */
1494
+ export interface UiCallContext {
1495
+ /** Which app sent the request (`x-cortex-client`), null for unknown callers. */
1496
+ client: ClientKind | null;
1497
+ }
1553
1498
  export interface UiService {
1554
1499
  query<S extends QueryScope>(scope: S, params: QueryParams<S>): Promise<Result<QueryReturn<S>>>;
1555
- mutate<O extends MutateOp>(op: O, args: MutateArgs<O>): Promise<Result<MutateReturn<O>>>;
1500
+ mutate<O extends MutateOp>(op: O, args: MutateArgs<O>, ctx?: UiCallContext): Promise<Result<MutateReturn<O>>>;
1556
1501
  subscribe(filter: SubscribeFilter): AsyncIterable<UiEvent> & {
1557
1502
  close(): void;
1558
1503
  };
1559
1504
  }
1560
1505
  export interface UiServiceDeps {
1506
+ /** Entry-layer callback: domain handlers never import orchestration. */
1507
+ resolveMedia: (input: ResolveMediaInput) => Promise<ResolveMediaResult>;
1561
1508
  /** Shared with background timers; bounded discovery, never waits for update consent. */
1562
1509
  checkServerUpdate: () => Promise<SystemUpdateCheckResult>;
1563
1510
  /** Optional seams for deterministic authentication dispatch tests. */
1564
1511
  getAuthStatus?: () => Promise<AuthStatusSnapshot>;
1565
1512
  authLogin?: AuthLoginService;
1566
1513
  logoutAccount?: (input: LogoutAccountInput) => Promise<AuthLogoutResult>;
1567
- /** Re-derives gateway modes and profiles; defaults to the real discovery-backed sync. */
1514
+ /** Re-derives gateway routes and favorites; defaults to discovery-backed sync. */
1568
1515
  syncGateway?: (options: {
1569
1516
  backends?: string[];
1570
1517
  }) => Promise<AuthSyncGatewayReturn>;
@@ -1593,10 +1540,8 @@ export interface UiServiceDeps {
1593
1540
  setStarred(sessionId: string, starred: boolean): Promise<Session | null>;
1594
1541
  rename(sessionId: string, label: string): Promise<Session | null>;
1595
1542
  };
1596
- /** Capability hint for sessions.list; execution revalidates inside orchestration. Narrowed to
1597
- * the two fields the answer depends on so the list can answer it once per distinct profile
1598
- * instead of once per row. */
1599
- supportsSessionCompaction: (session: Pick<Session, 'backend' | 'profileName'>) => boolean;
1543
+ /** Capability hint for sessions.list; execution revalidates inside orchestration. */
1544
+ supportsSessionCompaction: (session: Pick<Session, 'backend'>) => boolean;
1600
1545
  /** Latest task-list snapshot for a session (in-memory registry). */
1601
1546
  getSessionTodos: (sessionId: string) => TodoSnapshot | null;
1602
1547
  /** Idle-only manual context compaction, injected at the entry layer. */
@@ -1693,12 +1638,8 @@ export interface UiServiceDeps {
1693
1638
  createDirectSession: (opts: {
1694
1639
  projectId: string;
1695
1640
  sessionId?: string;
1696
- profileName?: string | null;
1697
1641
  agentName?: string | null;
1698
- selection?: SessionSelectionOverride | null;
1699
- browser?: {
1700
- device: string;
1701
- } | null;
1642
+ selection?: EngineSelection;
1702
1643
  }) => Promise<{
1703
1644
  sessionId: string;
1704
1645
  channel: string;
@@ -1724,76 +1665,27 @@ export interface UiServiceDeps {
1724
1665
  sessionId: string;
1725
1666
  attachments: AttachmentMeta[];
1726
1667
  }) => Promise<AttachmentMeta[]>;
1727
- /**
1728
- * Switch the active agent profile for a session's channel under the shared profile-switch rule
1729
- * (same `switchChannelProfile` the Slack/Feishu `!profile` command uses). Wired in the entry layer
1730
- * (app.ts) so the ui-service domain never imports domain/agents. Returns a structured outcome:
1731
- * `ok:false` with `reason` when the profile is unknown or a cross-backend switch is attempted on a
1732
- * session that already has conversation history.
1733
- */
1734
- switchSessionProfile: (opts: {
1735
- channel: string;
1736
- name: string;
1737
- }) => Promise<{
1738
- ok: boolean;
1739
- name: string;
1740
- currentBackend: string;
1741
- targetBackend: string;
1742
- backendChanged: boolean;
1743
- reason?: 'unknown-profile' | 'cross-backend-live-session';
1744
- }>;
1745
- /**
1746
- * Switch the agent — the execution environment — a session's channel runs, under the shared
1747
- * agent-switch rule (the same `switchChannelAgent` the Slack/Feishu `!agent` command uses). A
1748
- * null name clears the channel's selection. Wired in the entry layer (app.ts) for the same reason
1749
- * as the profile switch above: the ui-service domain never imports domain/agents.
1750
- */
1668
+ /** Switch execution environment without changing the engine. */
1751
1669
  switchSessionAgent: (opts: {
1752
1670
  channel: string;
1753
1671
  name: string | null;
1754
1672
  }) => Promise<{
1755
1673
  ok: boolean;
1756
1674
  agentName: string | null;
1757
- /** The profile the agent will run under, for display. */
1758
- effectiveProfile: string;
1759
- backendChanged: boolean;
1760
- reason?: 'unknown-agent' | 'cross-backend-live-session';
1761
- currentBackend?: string;
1762
- targetBackend?: string;
1675
+ reason?: 'unknown-agent';
1763
1676
  }>;
1764
- /**
1765
- * Apply a session's engine selection (profile and/or model / provider / thinking) under the
1766
- * shared rule — the domain `applyChannelSelection`, wired in the entry layer (app.ts) so the
1767
- * ui-service domain never imports domain/agents. Returns the effective selection, or a structured
1768
- * refusal the handler maps to a Result code.
1769
- */
1770
- applySessionSelection: (opts: {
1677
+ /** Shared domain selection rule, wired at the entry layer. */
1678
+ applySessionSelection: (opts: EngineSelection & {
1771
1679
  channel: string;
1772
- profileName?: string;
1773
- model?: string | null;
1774
- provider?: string | null;
1775
- thinking?: string | null;
1776
- mode?: string | null;
1777
- }) => Promise<{
1680
+ }) => Promise<EngineSelection & {
1778
1681
  ok: boolean;
1779
1682
  backendChanged: boolean;
1780
- /** The channel's selection after the change — or the untouched one when `ok` is false. */
1781
- profileName: string;
1782
- backend: Backend;
1783
- model: string;
1784
- provider: string | null;
1785
- thinking: string | null;
1786
- mode: string;
1787
- override: SessionSelectionOverride | null;
1788
- /** Present only when `ok` is false. */
1789
- reason?: 'unknown-profile' | 'cross-backend-live-session' | 'invalid-thinking' | 'provider-not-supported' | 'invalid-mode';
1683
+ reason?: string;
1790
1684
  currentBackend?: string;
1791
1685
  targetBackend?: string;
1792
1686
  allowed?: readonly string[];
1793
1687
  }>;
1794
- /** What a session selected on top of its profile, by channel — the read half of
1795
- * `applySessionSelection`, used to render `sessions.list`. Injected for the same reason. */
1796
- getChannelSelectionOverride: (channel: string) => SessionSelectionOverride | null;
1688
+ getModelMemory: () => ConfigModels['memory'];
1797
1689
  /** The last composer pick on this host, which a draft conversation starts from. Injected for the
1798
1690
  * same reason as the two above. */
1799
1691
  getSelectionDefault: () => ConfigSelectionDefault | null;