@cortex-agent/server 2026.10.15 → 2026.10.21

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 (333) hide show
  1. package/README.md +76 -50
  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/plugins/cortex-board/skills/board/SKILL.md +30 -22
  7. package/defaults/plugins/cortex-system/plugin.json +2 -2
  8. package/defaults/plugins/cortex-system/skills/browser/SKILL.md +56 -0
  9. package/dist/agent-adapter/claude/adapter.d.ts +2 -5
  10. package/dist/agent-adapter/claude/adapter.js +6 -5
  11. package/dist/agent-adapter/claude/assistant-blocks.d.ts +5 -0
  12. package/dist/agent-adapter/claude/assistant-blocks.js +61 -0
  13. package/dist/agent-adapter/claude/cache-refresh.d.ts +58 -0
  14. package/dist/agent-adapter/claude/cache-refresh.js +145 -0
  15. package/dist/agent-adapter/claude/cache-touch.d.ts +12 -0
  16. package/dist/agent-adapter/claude/cache-touch.js +75 -0
  17. package/dist/agent-adapter/claude/event-parser.d.ts +8 -3
  18. package/dist/agent-adapter/claude/event-parser.js +33 -17
  19. package/dist/agent-adapter/claude/event-translator.d.ts +2 -0
  20. package/dist/agent-adapter/claude/event-translator.js +2 -0
  21. package/dist/agent-adapter/claude/session-options.d.ts +6 -13
  22. package/dist/agent-adapter/claude/session-options.js +2 -13
  23. package/dist/agent-adapter/claude/spawn-args.d.ts +4 -21
  24. package/dist/agent-adapter/claude/spawn-args.js +17 -24
  25. package/dist/agent-adapter/claude/transcript-clear.d.ts +42 -0
  26. package/dist/agent-adapter/claude/transcript-clear.js +217 -0
  27. package/dist/agent-adapter/claude/turn-machine.d.ts +3 -2
  28. package/dist/agent-adapter/claude/turn-machine.js +21 -68
  29. package/dist/agent-adapter/claude/window-warmup.d.ts +13 -0
  30. package/dist/agent-adapter/claude/window-warmup.js +38 -0
  31. package/dist/agent-adapter/continuation-phase.js +3 -0
  32. package/dist/agent-adapter/normalize/event-types.d.ts +8 -0
  33. package/dist/agent-adapter/pi/adapter.d.ts +0 -1
  34. package/dist/agent-adapter/pi/adapter.js +5 -13
  35. package/dist/agent-adapter/pi/event-parser.d.ts +1 -1
  36. package/dist/agent-adapter/pi/event-parser.js +43 -27
  37. package/dist/agent-adapter/pi/mcp-bridge.d.ts +1 -1
  38. package/dist/agent-adapter/pi/pi-session.d.ts +2 -0
  39. package/dist/agent-adapter/pi/pi-session.js +15 -0
  40. package/dist/agent-adapter/pi/providers-config.d.ts +2 -2
  41. package/dist/agent-adapter/pi/providers-config.js +1 -1
  42. package/dist/agent-adapter/pi/quota-sink.d.ts +3 -3
  43. package/dist/agent-adapter/pi/quota-sink.js +3 -3
  44. package/dist/agent-adapter/pi/runtime.js +6 -1
  45. package/dist/agent-adapter/pi/session-options.d.ts +9 -13
  46. package/dist/agent-adapter/pi/session-options.js +12 -25
  47. package/dist/agent-adapter/run-events.d.ts +11 -10
  48. package/dist/agent-adapter/run-events.js +2 -0
  49. package/dist/agent-adapter/types.d.ts +5 -4
  50. package/dist/client-bundle/manifest.json +2 -2
  51. package/dist/core/codex-quota.d.ts +1 -1
  52. package/dist/core/codex-quota.js +1 -1
  53. package/dist/core/gateway-generator.d.ts +9 -11
  54. package/dist/core/gateway-generator.js +31 -58
  55. package/dist/core/locales/en.d.ts +51 -77
  56. package/dist/core/locales/slices/commands.d.ts +26 -31
  57. package/dist/core/locales/slices/commands.js +54 -64
  58. package/dist/core/locales/slices/init.d.ts +8 -19
  59. package/dist/core/locales/slices/init.js +17 -53
  60. package/dist/core/locales/slices/interactions.d.ts +3 -3
  61. package/dist/core/locales/slices/interactions.js +6 -6
  62. package/dist/core/locales/slices/notices.d.ts +1 -3
  63. package/dist/core/locales/slices/notices.js +2 -6
  64. package/dist/core/locales/slices/scheduling.d.ts +9 -9
  65. package/dist/core/locales/slices/scheduling.js +18 -18
  66. package/dist/core/locales/slices/status.d.ts +0 -4
  67. package/dist/core/locales/slices/status.js +0 -8
  68. package/dist/core/locales/slices/tui.d.ts +0 -1
  69. package/dist/core/locales/slices/tui.js +0 -2
  70. package/dist/core/locales/slices/uimsg.d.ts +4 -7
  71. package/dist/core/locales/slices/uimsg.js +9 -15
  72. package/dist/core/models-generator.d.ts +29 -0
  73. package/dist/core/models-generator.js +82 -0
  74. package/dist/core/paths.d.ts +1 -1
  75. package/dist/core/paths.js +1 -1
  76. package/dist/core/settings-spec.d.ts +25 -0
  77. package/dist/core/settings-spec.js +34 -0
  78. package/dist/core/status-format.d.ts +3 -2
  79. package/dist/core/status-format.js +2 -2
  80. package/dist/core/types/environment-types.d.ts +0 -2
  81. package/dist/domain/agents/agent-state.d.ts +11 -56
  82. package/dist/domain/agents/agent-state.js +48 -115
  83. package/dist/domain/agents/agent-switch.d.ts +2 -24
  84. package/dist/domain/agents/agent-switch.js +9 -72
  85. package/dist/domain/agents/config.d.ts +11 -61
  86. package/dist/domain/agents/config.js +47 -154
  87. package/dist/domain/agents/engine-selection.d.ts +21 -0
  88. package/dist/domain/agents/engine-selection.js +37 -0
  89. package/dist/domain/agents/environments/registry.js +2 -1
  90. package/dist/domain/agents/environments/resolve.js +0 -1
  91. package/dist/domain/agents/environments/schema.d.ts +0 -1
  92. package/dist/domain/agents/environments/schema.js +0 -1
  93. package/dist/domain/agents/index.d.ts +2 -1
  94. package/dist/domain/agents/index.js +3 -7
  95. package/dist/domain/agents/model-selection.d.ts +18 -70
  96. package/dist/domain/agents/model-selection.js +100 -150
  97. package/dist/domain/agents/models.d.ts +12 -0
  98. package/dist/domain/agents/models.js +94 -0
  99. package/dist/domain/agents/subagent/registry.d.ts +2 -0
  100. package/dist/domain/agents/subagent/registry.js +8 -0
  101. package/dist/domain/agents/subagent/runner.d.ts +5 -5
  102. package/dist/domain/agents/subagent/runner.js +12 -35
  103. package/dist/domain/auth/auth-status.d.ts +4 -4
  104. package/dist/domain/auth/auth-status.js +17 -28
  105. package/dist/domain/auth/gateway-sync.d.ts +6 -26
  106. package/dist/domain/auth/gateway-sync.js +31 -75
  107. package/dist/domain/benchmark/identity.d.ts +3 -5
  108. package/dist/domain/benchmark/identity.js +0 -1
  109. package/dist/domain/benchmark/production-attempt-identity.d.ts +6 -5
  110. package/dist/domain/benchmark/production-attempt-identity.js +32 -35
  111. package/dist/domain/benchmark/session-evidence.d.ts +2 -1
  112. package/dist/domain/benchmark/session-evidence.js +8 -1
  113. package/dist/domain/browser/broker.d.ts +99 -0
  114. package/dist/domain/browser/broker.js +487 -0
  115. package/dist/domain/costs/claude-account.js +21 -0
  116. package/dist/domain/costs/rate-limit-throttle.js +3 -1
  117. package/dist/domain/costs/reset-account.d.ts +2 -0
  118. package/dist/domain/costs/usage-service.d.ts +1 -1
  119. package/dist/domain/costs/usage-service.js +20 -7
  120. package/dist/domain/mcp/tools/context.d.ts +5 -6
  121. package/dist/domain/mcp/tools/context.js +17 -3
  122. package/dist/domain/mcp/tools/subagent.js +1 -1
  123. package/dist/domain/mcp/tools/ui-file.js +1 -1
  124. package/dist/domain/pi-providers/custom-provider-model.d.ts +1 -1
  125. package/dist/domain/pi-providers/custom-provider-model.js +1 -1
  126. package/dist/domain/remote/device-browser.js +1 -1
  127. package/dist/domain/remote/device-chrome-commands.js +2 -0
  128. package/dist/domain/remote/device-port.js +2 -2
  129. package/dist/domain/runs/attempt.d.ts +3 -3
  130. package/dist/domain/runs/attempt.js +2 -3
  131. package/dist/domain/runs/builders.d.ts +4 -4
  132. package/dist/domain/runs/builders.js +4 -5
  133. package/dist/domain/runs/compact.d.ts +4 -17
  134. package/dist/domain/runs/compact.js +14 -56
  135. package/dist/domain/runs/config-resolver.d.ts +15 -83
  136. package/dist/domain/runs/config-resolver.js +24 -150
  137. package/dist/domain/runs/engine-spec.d.ts +8 -8
  138. package/dist/domain/runs/engine-spec.js +15 -31
  139. package/dist/domain/runs/events.d.ts +1 -1
  140. package/dist/domain/runs/fallback.d.ts +6 -38
  141. package/dist/domain/runs/fallback.js +10 -72
  142. package/dist/domain/runs/notices.d.ts +1 -11
  143. package/dist/domain/runs/notices.js +3 -30
  144. package/dist/domain/runs/request.d.ts +4 -3
  145. package/dist/domain/runs/retryable-errors.d.ts +0 -13
  146. package/dist/domain/runs/retryable-errors.js +0 -17
  147. package/dist/domain/runs/run.d.ts +12 -42
  148. package/dist/domain/runs/run.js +40 -147
  149. package/dist/domain/runs/service.d.ts +1 -1
  150. package/dist/domain/runs/service.js +8 -3
  151. package/dist/domain/runs/spec-loader.d.ts +1 -1
  152. package/dist/domain/runs/spend.d.ts +1 -1
  153. package/dist/domain/runs/spend.js +1 -1
  154. package/dist/domain/scheduling/jobs/scheduled-task.d.ts +3 -2
  155. package/dist/domain/scheduling/jobs/scheduled-task.js +25 -19
  156. package/dist/domain/scheduling/schedule-ops.d.ts +0 -1
  157. package/dist/domain/scheduling/schedule-ops.js +2 -5
  158. package/dist/domain/scheduling/schedule-selection.d.ts +3 -0
  159. package/dist/domain/scheduling/schedule-selection.js +16 -0
  160. package/dist/domain/scheduling/schedule-spec.d.ts +6 -5
  161. package/dist/domain/scheduling/schedule-spec.js +6 -6
  162. package/dist/domain/scheduling/scheduler.d.ts +3 -1
  163. package/dist/domain/scheduling/scheduler.js +22 -21
  164. package/dist/domain/sessions/session-hooks.d.ts +5 -4
  165. package/dist/domain/sessions/session-hooks.js +15 -33
  166. package/dist/domain/sessions/session-lifecycle.d.ts +19 -51
  167. package/dist/domain/sessions/session-lifecycle.js +34 -96
  168. package/dist/domain/system/doctor.d.ts +3 -3
  169. package/dist/domain/system/doctor.js +22 -26
  170. package/dist/domain/system/own-bin-path.d.ts +13 -0
  171. package/dist/domain/system/own-bin-path.js +36 -0
  172. package/dist/domain/system/terminal-cli/index.d.ts +58 -0
  173. package/dist/domain/system/terminal-cli/index.js +100 -0
  174. package/dist/domain/system/terminal-cli/posix-profiles.d.ts +23 -0
  175. package/dist/domain/system/terminal-cli/posix-profiles.js +74 -0
  176. package/dist/domain/system/terminal-cli/registrar.d.ts +12 -0
  177. package/dist/domain/system/terminal-cli/registrar.js +1 -0
  178. package/dist/domain/system/terminal-cli/shims.d.ts +27 -0
  179. package/dist/domain/system/terminal-cli/shims.js +108 -0
  180. package/dist/domain/system/terminal-cli/state.d.ts +7 -0
  181. package/dist/domain/system/terminal-cli/state.js +36 -0
  182. package/dist/domain/system/terminal-cli/windows-user-path.d.ts +13 -0
  183. package/dist/domain/system/terminal-cli/windows-user-path.js +67 -0
  184. package/dist/domain/tui-session/tui-session-service.js +1 -1
  185. package/dist/domain/tui-session/types.d.ts +2 -2
  186. package/dist/domain/ui-service/app-router.d.ts +49 -71
  187. package/dist/domain/ui-service/app-router.js +9 -13
  188. package/dist/domain/ui-service/assistant-snapshots.js +2 -0
  189. package/dist/domain/ui-service/contract.parity.d.ts +19 -0
  190. package/dist/domain/ui-service/contract.parity.js +1 -0
  191. package/dist/domain/ui-service/inline-media-types.d.ts +18 -0
  192. package/dist/domain/ui-service/inline-media-types.js +1 -0
  193. package/dist/domain/ui-service/input-schemas.d.ts +52 -115
  194. package/dist/domain/ui-service/input-schemas.js +38 -84
  195. package/dist/domain/ui-service/mutate/auth.d.ts +1 -1
  196. package/dist/domain/ui-service/mutate/auth.js +3 -2
  197. package/dist/domain/ui-service/mutate/config.d.ts +0 -8
  198. package/dist/domain/ui-service/mutate/config.js +0 -22
  199. package/dist/domain/ui-service/mutate/models.d.ts +13 -0
  200. package/dist/domain/ui-service/mutate/models.js +137 -0
  201. package/dist/domain/ui-service/mutate/resolve-media.d.ts +4 -0
  202. package/dist/domain/ui-service/mutate/resolve-media.js +17 -0
  203. package/dist/domain/ui-service/mutate/sessions.d.ts +2 -2
  204. package/dist/domain/ui-service/mutate/sessions.js +29 -126
  205. package/dist/domain/ui-service/query/config.js +22 -42
  206. package/dist/domain/ui-service/query/models.js +2 -2
  207. package/dist/domain/ui-service/query/schedules.js +1 -1
  208. package/dist/domain/ui-service/query/sessions.js +7 -13
  209. package/dist/domain/ui-service/types.d.ts +51 -177
  210. package/dist/domain/ui-service/ui-service.d.ts +23 -49
  211. package/dist/domain/ui-service/ui-service.js +8 -6
  212. package/dist/entry/app.js +42 -19
  213. package/dist/entry/browser-cli.d.ts +39 -0
  214. package/dist/entry/browser-cli.js +317 -0
  215. package/dist/entry/cli-help.d.ts +1 -0
  216. package/dist/entry/cli-help.js +37 -6
  217. package/dist/entry/cli.js +16 -14
  218. package/dist/entry/daemon.js +2 -0
  219. package/dist/entry/init-auth.js +1 -1
  220. package/dist/entry/init.d.ts +7 -8
  221. package/dist/entry/init.js +89 -249
  222. package/dist/entry/path-cli.d.ts +4 -0
  223. package/dist/entry/path-cli.js +65 -0
  224. package/dist/entry/schedule-cli.js +13 -6
  225. package/dist/entry/shutdown.d.ts +1 -1
  226. package/dist/entry/shutdown.js +8 -1
  227. package/dist/entry/start-ui-http.js +8 -0
  228. package/dist/entry/ui-service-wiring.js +8 -10
  229. package/dist/events/event-types.d.ts +3 -2
  230. package/dist/orchestration/agent-runner.d.ts +2 -2
  231. package/dist/orchestration/agent-runner.js +10 -9
  232. package/dist/orchestration/benchmark-session-webhook.js +13 -1
  233. package/dist/orchestration/browser-webhook.d.ts +11 -0
  234. package/dist/orchestration/browser-webhook.js +28 -0
  235. package/dist/orchestration/cache-keep-warm.d.ts +77 -0
  236. package/dist/orchestration/cache-keep-warm.js +213 -0
  237. package/dist/orchestration/claude-window-warmup.d.ts +40 -0
  238. package/dist/orchestration/claude-window-warmup.js +126 -0
  239. package/dist/orchestration/conversation-request.d.ts +6 -10
  240. package/dist/orchestration/conversation-request.js +5 -23
  241. package/dist/orchestration/delta-coalescer.d.ts +4 -2
  242. package/dist/orchestration/delta-coalescer.js +5 -5
  243. package/dist/orchestration/edit-retry.js +9 -11
  244. package/dist/orchestration/inline-media-eager.d.ts +13 -0
  245. package/dist/orchestration/inline-media-eager.js +58 -0
  246. package/dist/orchestration/inline-media.d.ts +22 -0
  247. package/dist/orchestration/inline-media.js +151 -0
  248. package/dist/orchestration/interactions/ask-user-resume.js +3 -7
  249. package/dist/orchestration/interactions/interaction-handlers.js +6 -6
  250. package/dist/orchestration/mid-turn-inject.d.ts +2 -1
  251. package/dist/orchestration/mid-turn-inject.js +1 -1
  252. package/dist/orchestration/pending-injection-recovery.d.ts +2 -1
  253. package/dist/orchestration/pending-injection-recovery.js +1 -1
  254. package/dist/orchestration/routing/commands/index.js +4 -4
  255. package/dist/orchestration/routing/commands/mode.d.ts +5 -44
  256. package/dist/orchestration/routing/commands/mode.js +98 -272
  257. package/dist/orchestration/routing/commands/schedule.js +29 -18
  258. package/dist/orchestration/routing/commands/session.js +9 -9
  259. package/dist/orchestration/routing/commands/status.js +1 -1
  260. package/dist/orchestration/routing/commands/usage-format.js +3 -0
  261. package/dist/orchestration/routing/webhook.js +4 -0
  262. package/dist/orchestration/session-compact.d.ts +0 -1
  263. package/dist/orchestration/session-compact.js +5 -7
  264. package/dist/orchestration/session-events.d.ts +2 -1
  265. package/dist/orchestration/session-events.js +1 -0
  266. package/dist/orchestration/status-helpers.d.ts +0 -4
  267. package/dist/orchestration/status-helpers.js +0 -18
  268. package/dist/orchestration/subagent-webhook.js +9 -34
  269. package/dist/orchestration/team-webhook.d.ts +8 -9
  270. package/dist/orchestration/team-webhook.js +16 -42
  271. package/dist/orchestration/transcript-sink.d.ts +6 -0
  272. package/dist/orchestration/transcript-sink.js +21 -2
  273. package/dist/orchestration/turn/terminal.js +7 -7
  274. package/dist/orchestration/turn/turn-prep.d.ts +0 -8
  275. package/dist/orchestration/turn/turn-prep.js +0 -51
  276. package/dist/orchestration/turn/turn-tracking.d.ts +2 -2
  277. package/dist/orchestration/turn/turn-tracking.js +8 -5
  278. package/dist/orchestration/turn/turn.d.ts +0 -2
  279. package/dist/orchestration/turn/turn.js +13 -15
  280. package/dist/platform/adapters/tui/ports.d.ts +1 -1
  281. package/dist/platform/adapters/tui/tui-transcript.js +2 -0
  282. package/dist/platform/browser/agent-browser.d.ts +50 -0
  283. package/dist/platform/browser/agent-browser.js +165 -0
  284. package/dist/platform/browser/managed-browser.d.ts +1 -11
  285. package/dist/platform/browser/managed-browser.js +4 -12
  286. package/dist/platform/ui-http/browser-stream.d.ts +110 -0
  287. package/dist/platform/ui-http/browser-stream.js +447 -0
  288. package/dist/platform/ui-http/ui-http-server.d.ts +12 -0
  289. package/dist/platform/ui-http/ui-http-server.js +23 -6
  290. package/dist/store/conversation-history-reader.js +8 -0
  291. package/dist/store/conversation-history-repo.d.ts +8 -1
  292. package/dist/store/conversation-history-repo.js +5 -0
  293. package/dist/store/conversation-ledger-repo.d.ts +6 -6
  294. package/dist/store/conversation-ledger-repo.js +4 -4
  295. package/dist/store/models-repo.d.ts +18 -0
  296. package/dist/store/models-repo.js +74 -0
  297. package/dist/store/pending-injection-repo.d.ts +2 -1
  298. package/dist/store/pending-injection-repo.js +3 -1
  299. package/dist/store/retire-profiles-migration.d.ts +28 -0
  300. package/dist/store/retire-profiles-migration.js +335 -0
  301. package/dist/store/schedule-repo.d.ts +2 -1
  302. package/dist/store/session-registry-import.js +3 -2
  303. package/dist/store/session-registry-journal.d.ts +10 -13
  304. package/dist/store/session-registry-journal.js +48 -25
  305. package/dist/store/session-registry-repo.d.ts +4 -4
  306. package/dist/store/session-registry-repo.js +4 -5
  307. package/dist/store/version-migrations.d.ts +2 -3
  308. package/dist/store/version-migrations.js +19 -3
  309. package/dist/tui/slash-commands.js +2 -2
  310. package/dist/tui/turn-status.js +1 -1
  311. package/package.json +6 -4
  312. package/web/dist/assets/board-math-css-CB4GJ6qO.js +2 -0
  313. package/web/dist/assets/index-CaSZPg_H.css +1 -0
  314. package/web/dist/assets/index-CzOR7Edh.js +522 -0
  315. package/web/dist/assets/{index-CndZZ1IQ.js → index-cIGFv27z.js} +1 -1
  316. package/web/dist/index.html +3 -2
  317. package/web/dist/theme.css +6 -0
  318. package/dist/agent-adapter/browser-mcp-server.d.ts +0 -13
  319. package/dist/agent-adapter/browser-mcp-server.js +0 -28
  320. package/dist/agent-adapter/claude/browser-mcp.d.ts +0 -9
  321. package/dist/agent-adapter/claude/browser-mcp.js +0 -10
  322. package/dist/core/profile-generator.d.ts +0 -79
  323. package/dist/core/profile-generator.js +0 -215
  324. package/dist/domain/agents/profile-manager.d.ts +0 -103
  325. package/dist/domain/agents/profile-manager.js +0 -286
  326. package/dist/domain/agents/profile-switch.d.ts +0 -49
  327. package/dist/domain/agents/profile-switch.js +0 -62
  328. package/dist/domain/ui-service/mutate/profiles.d.ts +0 -36
  329. package/dist/domain/ui-service/mutate/profiles.js +0 -151
  330. package/dist/store/profile-repo.d.ts +0 -20
  331. package/dist/store/profile-repo.js +0 -97
  332. package/web/dist/assets/index-B76ueW3q.js +0 -494
  333. package/web/dist/assets/index-C8O0yxg8.css +0 -1
@@ -1,5 +1,6 @@
1
1
  export { platformSettingsInput } from '../../core/platform-settings-spec.js';
2
2
  import { z } from 'zod';
3
+ import type { EngineSelection, ModelRef } from '../agents/engine-selection.js';
3
4
  export { sessionsSetStarredInput, sessionsRenameInput } from './session-metadata-schemas.js';
4
5
  import { sessionsListInput, sessionsTranscriptInput, sessionsSubagentTranscriptInput, sessionsDebugDetailsInput, sessionsPendingInteractionInput, schedulesListInput, boardsListInput, boardsGetInput, boardsDecisionsInput, boardsStyleInput, executionsListInput, executionsGetInput, waitpointsListInput, memoryTreeInput, memoryFileInput, approvalsListInput, issuesListInput, notesListInput } from './query-input-schemas.js';
5
6
  export { sessionsListInput, sessionsTranscriptInput, sessionsSubagentTranscriptInput, sessionsDebugDetailsInput, sessionsPendingInteractionInput, schedulesListInput, boardsListInput, boardsGetInput, boardsDecisionsInput, boardsStyleInput, executionsListInput, executionsGetInput, waitpointsListInput, memoryTreeInput, memoryFileInput, approvalsListInput, issuesListInput, notesListInput, };
@@ -102,16 +103,8 @@ export declare const authRemoveCustomProviderInput: z.ZodObject<{
102
103
  export declare const projectsCreateInput: z.ZodObject<{
103
104
  name: z.ZodString;
104
105
  }, z.core.$strip>;
105
- /** Per-session browser opt-in. `device` names where Chrome runs; 'server' is the only value until
106
- * the cortex-client reverse channel exists. Absent → the session gets no browser tools. */
107
- export declare const sessionBrowserInput: z.ZodObject<{
108
- device: z.ZodString;
109
- }, z.core.$strip>;
110
106
  export declare const sessionsCreateInput: z.ZodObject<{
111
107
  projectId: z.ZodOptional<z.ZodString>;
112
- browser: z.ZodOptional<z.ZodNullable<z.ZodObject<{
113
- device: z.ZodString;
114
- }, z.core.$strip>>>;
115
108
  }, z.core.$strip>;
116
109
  export declare const sessionsSendInput: z.ZodObject<{
117
110
  sessionId: z.ZodString;
@@ -141,24 +134,15 @@ export declare const sessionsMarkReadInput: z.ZodObject<{
141
134
  export declare const sessionsMarkManyReadInput: z.ZodObject<{
142
135
  sessionIds: z.ZodArray<z.ZodString>;
143
136
  }, z.core.$strip>;
144
- export declare const sessionsSetProfileInput: z.ZodObject<{
145
- sessionId: z.ZodString;
146
- profileName: z.ZodString;
147
- }, z.core.$strip>;
148
137
  export declare const sessionsSetAgentInput: z.ZodObject<{
149
138
  sessionId: z.ZodString;
150
139
  agentName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
151
140
  }, z.core.$strip>;
141
+ export declare const engineSelectionInput: z.ZodType<EngineSelection, EngineSelection>;
152
142
  export declare const sessionsSetSelectionInput: z.ZodObject<{
153
143
  sessionId: z.ZodString;
154
- profileName: z.ZodOptional<z.ZodString>;
155
- selection: z.ZodOptional<z.ZodObject<{
156
- model: z.ZodOptional<z.ZodString>;
157
- provider: z.ZodOptional<z.ZodString>;
158
- thinking: z.ZodOptional<z.ZodString>;
159
- mode: z.ZodOptional<z.ZodString>;
160
- }, z.core.$strip>>;
161
- }, z.core.$strip>;
144
+ selection: z.ZodType<EngineSelection, EngineSelection, z.core.$ZodTypeInternals<EngineSelection, EngineSelection>>;
145
+ }, z.core.$strict>;
162
146
  export declare const sessionsAnswerQuestionInput: z.ZodObject<{
163
147
  requestId: z.ZodString;
164
148
  answers: z.ZodRecord<z.ZodString, z.ZodString>;
@@ -178,6 +162,12 @@ export declare const sessionsRespondDecisionInput: z.ZodObject<{
178
162
  }>;
179
163
  message: z.ZodOptional<z.ZodString>;
180
164
  }, z.core.$strip>;
165
+ /** Message identity keys an immutable snapshot of this media source. */
166
+ export declare const sessionsResolveMediaInput: z.ZodObject<{
167
+ sessionId: z.ZodString;
168
+ ts: z.ZodString;
169
+ src: z.ZodString;
170
+ }, z.core.$strip>;
181
171
  /** Args for `sessions.cancelResume`: decline the auto-resume promised when a rate limit
182
172
  * interrupted this session's turn. */
183
173
  export declare const sessionsCancelResumeInput: z.ZodObject<{
@@ -194,17 +184,8 @@ export declare const sessionsRewindInput: z.ZodObject<{
194
184
  }, z.core.$strip>;
195
185
  export declare const sessionsCreateAndSendInput: z.ZodObject<{
196
186
  projectId: z.ZodString;
197
- profileName: z.ZodOptional<z.ZodString>;
198
187
  agentName: z.ZodOptional<z.ZodString>;
199
- selection: z.ZodOptional<z.ZodObject<{
200
- model: z.ZodOptional<z.ZodString>;
201
- provider: z.ZodOptional<z.ZodString>;
202
- thinking: z.ZodOptional<z.ZodString>;
203
- mode: z.ZodOptional<z.ZodString>;
204
- }, z.core.$strip>>;
205
- browser: z.ZodOptional<z.ZodNullable<z.ZodObject<{
206
- device: z.ZodString;
207
- }, z.core.$strip>>>;
188
+ selection: z.ZodOptional<z.ZodType<EngineSelection, EngineSelection, z.core.$ZodTypeInternals<EngineSelection, EngineSelection>>>;
208
189
  text: z.ZodString;
209
190
  draftUploadId: z.ZodOptional<z.ZodString>;
210
191
  attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -237,7 +218,7 @@ export declare const scheduleAddInput: z.ZodObject<{
237
218
  }>;
238
219
  message: z.ZodString;
239
220
  projectId: z.ZodOptional<z.ZodString>;
240
- profile: z.ZodOptional<z.ZodString>;
221
+ selection: z.ZodOptional<z.ZodType<EngineSelection, EngineSelection, z.core.$ZodTypeInternals<EngineSelection, EngineSelection>>>;
241
222
  intervalMs: z.ZodOptional<z.ZodNumber>;
242
223
  time: z.ZodOptional<z.ZodString>;
243
224
  dayOfWeek: z.ZodOptional<z.ZodNumber>;
@@ -247,7 +228,7 @@ export declare const scheduleUpdateInput: z.ZodObject<{
247
228
  scheduleId: z.ZodString;
248
229
  message: z.ZodOptional<z.ZodString>;
249
230
  projectId: z.ZodOptional<z.ZodString>;
250
- profile: z.ZodOptional<z.ZodString>;
231
+ selection: z.ZodOptional<z.ZodType<EngineSelection, EngineSelection, z.core.$ZodTypeInternals<EngineSelection, EngineSelection>>>;
251
232
  intervalMs: z.ZodOptional<z.ZodNumber>;
252
233
  time: z.ZodOptional<z.ZodString>;
253
234
  dayOfWeek: z.ZodOptional<z.ZodNumber>;
@@ -259,11 +240,6 @@ export declare const configSetInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
259
240
  daily_usd: z.ZodNumber;
260
241
  monthly_usd: z.ZodNumber;
261
242
  }, z.core.$strip>>>;
262
- }, z.core.$strip>, z.ZodObject<{
263
- section: z.ZodLiteral<"profiles">;
264
- value: z.ZodObject<{
265
- defaultProfile: z.ZodString;
266
- }, z.core.$strip>;
267
243
  }, z.core.$strip>, z.ZodObject<{
268
244
  section: z.ZodLiteral<"settings">;
269
245
  value: z.ZodObject<{
@@ -337,33 +313,23 @@ export declare const hooksTestInput: z.ZodObject<{
337
313
  id: z.ZodString;
338
314
  payload: z.ZodString;
339
315
  }, z.core.$strip>;
340
- export declare const profilesCreateInput: z.ZodObject<{
341
- model: z.ZodString;
342
- backend: z.ZodOptional<z.ZodEnum<{
316
+ export declare const modelRefInput: z.ZodType<ModelRef, ModelRef>;
317
+ export declare const modelsFavoriteInput: z.ZodObject<{
318
+ backend: z.ZodEnum<{
343
319
  claude: "claude";
344
320
  pi: "pi";
345
- }>>;
346
- mode: z.ZodOptional<z.ZodString>;
347
- provider: z.ZodOptional<z.ZodString>;
348
- thinking: z.ZodOptional<z.ZodString>;
349
- extraOption: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
350
- name: z.ZodString;
351
- }, z.core.$strip>;
352
- export declare const profilesUpdateInput: z.ZodObject<{
321
+ }>;
322
+ provider: z.ZodOptional<z.ZodNullable<z.ZodString>>;
353
323
  model: z.ZodString;
354
- backend: z.ZodOptional<z.ZodEnum<{
355
- claude: "claude";
356
- pi: "pi";
357
- }>>;
358
- mode: z.ZodOptional<z.ZodString>;
359
- provider: z.ZodOptional<z.ZodString>;
360
- thinking: z.ZodOptional<z.ZodString>;
361
- extraOption: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
362
- name: z.ZodString;
363
- }, z.core.$strip>;
364
- export declare const profilesRemoveInput: z.ZodObject<{
365
- name: z.ZodString;
366
- }, z.core.$strip>;
324
+ }, z.core.$strict>;
325
+ type ModelsSetThinkingInput = {
326
+ ref: ModelRef;
327
+ thinking: string | null;
328
+ };
329
+ export declare const modelsSetThinkingInput: z.ZodType<ModelsSetThinkingInput, ModelsSetThinkingInput>;
330
+ export declare const modelsSetDefaultInput: z.ZodObject<{
331
+ selection: z.ZodType<EngineSelection, EngineSelection, z.core.$ZodTypeInternals<EngineSelection, EngineSelection>>;
332
+ }, z.core.$strict>;
367
333
  export declare const pluginsAssignInput: z.ZodObject<{
368
334
  target: z.ZodObject<{
369
335
  kind: z.ZodLiteral<"agent">;
@@ -636,9 +602,6 @@ export declare const mutateInputSchemas: {
636
602
  }, z.core.$strip>;
637
603
  'sessions.create': z.ZodObject<{
638
604
  projectId: z.ZodOptional<z.ZodString>;
639
- browser: z.ZodOptional<z.ZodNullable<z.ZodObject<{
640
- device: z.ZodString;
641
- }, z.core.$strip>>>;
642
605
  }, z.core.$strip>;
643
606
  'sessions.send': z.ZodObject<{
644
607
  sessionId: z.ZodString;
@@ -662,37 +625,18 @@ export declare const mutateInputSchemas: {
662
625
  'sessions.compact': z.ZodObject<{
663
626
  sessionId: z.ZodString;
664
627
  }, z.core.$strip>;
665
- 'sessions.setProfile': z.ZodObject<{
666
- sessionId: z.ZodString;
667
- profileName: z.ZodString;
668
- }, z.core.$strip>;
669
628
  'sessions.setAgent': z.ZodObject<{
670
629
  sessionId: z.ZodString;
671
630
  agentName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
672
631
  }, z.core.$strip>;
673
632
  'sessions.setSelection': z.ZodObject<{
674
633
  sessionId: z.ZodString;
675
- profileName: z.ZodOptional<z.ZodString>;
676
- selection: z.ZodOptional<z.ZodObject<{
677
- model: z.ZodOptional<z.ZodString>;
678
- provider: z.ZodOptional<z.ZodString>;
679
- thinking: z.ZodOptional<z.ZodString>;
680
- mode: z.ZodOptional<z.ZodString>;
681
- }, z.core.$strip>>;
682
- }, z.core.$strip>;
634
+ selection: z.ZodType<EngineSelection, EngineSelection, z.core.$ZodTypeInternals<EngineSelection, EngineSelection>>;
635
+ }, z.core.$strict>;
683
636
  'sessions.createAndSend': z.ZodObject<{
684
637
  projectId: z.ZodString;
685
- profileName: z.ZodOptional<z.ZodString>;
686
638
  agentName: z.ZodOptional<z.ZodString>;
687
- selection: z.ZodOptional<z.ZodObject<{
688
- model: z.ZodOptional<z.ZodString>;
689
- provider: z.ZodOptional<z.ZodString>;
690
- thinking: z.ZodOptional<z.ZodString>;
691
- mode: z.ZodOptional<z.ZodString>;
692
- }, z.core.$strip>>;
693
- browser: z.ZodOptional<z.ZodNullable<z.ZodObject<{
694
- device: z.ZodString;
695
- }, z.core.$strip>>>;
639
+ selection: z.ZodOptional<z.ZodType<EngineSelection, EngineSelection, z.core.$ZodTypeInternals<EngineSelection, EngineSelection>>>;
696
640
  text: z.ZodString;
697
641
  draftUploadId: z.ZodOptional<z.ZodString>;
698
642
  attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -748,6 +692,11 @@ export declare const mutateInputSchemas: {
748
692
  turnIndex: z.ZodNumber;
749
693
  text: z.ZodString;
750
694
  }, z.core.$strip>;
695
+ 'sessions.resolveMedia': z.ZodObject<{
696
+ sessionId: z.ZodString;
697
+ ts: z.ZodString;
698
+ src: z.ZodString;
699
+ }, z.core.$strip>;
751
700
  'executions.cancel': z.ZodObject<{
752
701
  executionId: z.ZodString;
753
702
  }, z.core.$strip>;
@@ -772,7 +721,7 @@ export declare const mutateInputSchemas: {
772
721
  }>;
773
722
  message: z.ZodString;
774
723
  projectId: z.ZodOptional<z.ZodString>;
775
- profile: z.ZodOptional<z.ZodString>;
724
+ selection: z.ZodOptional<z.ZodType<EngineSelection, EngineSelection, z.core.$ZodTypeInternals<EngineSelection, EngineSelection>>>;
776
725
  intervalMs: z.ZodOptional<z.ZodNumber>;
777
726
  time: z.ZodOptional<z.ZodString>;
778
727
  dayOfWeek: z.ZodOptional<z.ZodNumber>;
@@ -782,7 +731,7 @@ export declare const mutateInputSchemas: {
782
731
  scheduleId: z.ZodString;
783
732
  message: z.ZodOptional<z.ZodString>;
784
733
  projectId: z.ZodOptional<z.ZodString>;
785
- profile: z.ZodOptional<z.ZodString>;
734
+ selection: z.ZodOptional<z.ZodType<EngineSelection, EngineSelection, z.core.$ZodTypeInternals<EngineSelection, EngineSelection>>>;
786
735
  intervalMs: z.ZodOptional<z.ZodNumber>;
787
736
  time: z.ZodOptional<z.ZodString>;
788
737
  dayOfWeek: z.ZodOptional<z.ZodNumber>;
@@ -841,11 +790,6 @@ export declare const mutateInputSchemas: {
841
790
  daily_usd: z.ZodNumber;
842
791
  monthly_usd: z.ZodNumber;
843
792
  }, z.core.$strip>>>;
844
- }, z.core.$strip>, z.ZodObject<{
845
- section: z.ZodLiteral<"profiles">;
846
- value: z.ZodObject<{
847
- defaultProfile: z.ZodString;
848
- }, z.core.$strip>;
849
793
  }, z.core.$strip>, z.ZodObject<{
850
794
  section: z.ZodLiteral<"settings">;
851
795
  value: z.ZodObject<{
@@ -1003,33 +947,26 @@ export declare const mutateInputSchemas: {
1003
947
  id: z.ZodString;
1004
948
  payload: z.ZodString;
1005
949
  }, z.core.$strip>;
1006
- 'profiles.create': z.ZodObject<{
1007
- model: z.ZodString;
1008
- backend: z.ZodOptional<z.ZodEnum<{
950
+ 'models.favorites.add': z.ZodObject<{
951
+ backend: z.ZodEnum<{
1009
952
  claude: "claude";
1010
953
  pi: "pi";
1011
- }>>;
1012
- mode: z.ZodOptional<z.ZodString>;
1013
- provider: z.ZodOptional<z.ZodString>;
1014
- thinking: z.ZodOptional<z.ZodString>;
1015
- extraOption: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1016
- name: z.ZodString;
1017
- }, z.core.$strip>;
1018
- 'profiles.update': z.ZodObject<{
954
+ }>;
955
+ provider: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1019
956
  model: z.ZodString;
1020
- backend: z.ZodOptional<z.ZodEnum<{
957
+ }, z.core.$strict>;
958
+ 'models.favorites.remove': z.ZodObject<{
959
+ backend: z.ZodEnum<{
1021
960
  claude: "claude";
1022
961
  pi: "pi";
1023
- }>>;
1024
- mode: z.ZodOptional<z.ZodString>;
1025
- provider: z.ZodOptional<z.ZodString>;
1026
- thinking: z.ZodOptional<z.ZodString>;
1027
- extraOption: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1028
- name: z.ZodString;
1029
- }, z.core.$strip>;
1030
- 'profiles.remove': z.ZodObject<{
1031
- name: z.ZodString;
1032
- }, z.core.$strip>;
962
+ }>;
963
+ provider: z.ZodOptional<z.ZodNullable<z.ZodString>>;
964
+ model: z.ZodString;
965
+ }, z.core.$strict>;
966
+ 'models.setDefault': z.ZodObject<{
967
+ selection: z.ZodType<EngineSelection, EngineSelection, z.core.$ZodTypeInternals<EngineSelection, EngineSelection>>;
968
+ }, z.core.$strict>;
969
+ 'models.setThinking': z.ZodType<ModelsSetThinkingInput, ModelsSetThinkingInput, z.core.$ZodTypeInternals<ModelsSetThinkingInput, ModelsSetThinkingInput>>;
1033
970
  'plugins.assign': z.ZodObject<{
1034
971
  target: z.ZodObject<{
1035
972
  kind: z.ZodLiteral<"agent">;
@@ -29,9 +29,7 @@ export const usageSharingSetInput = z.object({
29
29
  org: z.string().trim().optional(),
30
30
  email: z.string().trim().optional(),
31
31
  });
32
- // models.catalog — what a profile's `model`, `provider` and `mode` may be SELECTED from. It is a
33
- // union of every source that knows about an endpoint, so it never narrows what profiles.json
34
- // accepts: the editor keeps a free-text escape for anything the host cannot enumerate.
32
+ // models.catalog — discover selectable models and gateway routes.
35
33
  export const modelsCatalogInput = z.object({});
36
34
  export const machinesListInput = z.object({});
37
35
  export const machineDetailInput = z.object({
@@ -66,7 +64,7 @@ export const authRespondPromptInput = z.object({
66
64
  export const authCancelFlowInput = z.object({
67
65
  flowId: z.string().min(1),
68
66
  });
69
- // auth.syncGateway — re-derive gateway modes and profiles from the backends reachable right now.
67
+ // auth.syncGateway — re-derive gateway routes and favorites from reachable backends.
70
68
  // Credentials alone do not make a model usable: the routing map is generated by scanning local
71
69
  // backend state, so a login performed outside `cortex init` needs this to become effective.
72
70
  export const authSyncGatewayInput = z.object({
@@ -109,16 +107,9 @@ export const authRemoveCustomProviderInput = z.object({
109
107
  export const projectsCreateInput = z.object({
110
108
  name: z.string(),
111
109
  });
112
- /** Per-session browser opt-in. `device` names where Chrome runs; 'server' is the only value until
113
- * the cortex-client reverse channel exists. Absent → the session gets no browser tools. */
114
- export const sessionBrowserInput = z.object({
115
- device: z.string(),
116
- });
117
110
  export const sessionsCreateInput = z.object({
118
111
  /** Project the new session belongs to. Omitted → the default project (handler fallback). */
119
112
  projectId: z.string().optional(),
120
- /** Opt in to browser control for this session. Omitted → no browser tools are loaded. */
121
- browser: sessionBrowserInput.nullish(),
122
113
  });
123
114
  export const sessionsSendInput = z.object({
124
115
  sessionId: z.string(),
@@ -145,11 +136,6 @@ export const sessionsMarkReadInput = z.object({
145
136
  export const sessionsMarkManyReadInput = z.object({
146
137
  sessionIds: z.array(z.string()).min(1).max(500),
147
138
  });
148
- export const sessionsSetProfileInput = z.object({
149
- sessionId: z.string(),
150
- /** The profile to switch the session to. Must exist in profiles.json. */
151
- profileName: z.string().min(1),
152
- });
153
139
  // sessions.setAgent — which agent template (execution environment) the session runs as. "Follow the
154
140
  // global default again" is sayable two ways, `null` and absent, because the browser client cannot
155
141
  // say the first one: this project compiles without strictNullChecks, so the `| null` of an INFERRED
@@ -161,25 +147,20 @@ export const sessionsSetAgentInput = z.object({
161
147
  * hands the session back to the global default agent. */
162
148
  agentName: z.string().min(1).nullable().optional(),
163
149
  });
164
- /** What a session runs on top of its profile. Stated WHOLE, never patched: a field the object does
165
- * not carry is a field that follows the profile, so "go back to the profile's model" needs no null
166
- * (which the typed tRPC client cannot express through an optional input anyway). */
167
- const sessionSelectionInput = z.object({
168
- model: z.string().min(1).optional(),
169
- provider: z.string().min(1).optional(),
170
- thinking: z.string().min(1).optional(),
171
- mode: z.string().min(1).optional(),
172
- });
173
- // sessions.setSelection — the profile and/or the selection on top of it, in one decision. Shape
174
- // gate only: WHICH levels a backend accepts, whether it has a provider at all, and whether a live
175
- // conversation may change backend stay with the domain rule (domain/agents/model-selection.ts),
176
- // which every surface goes through.
150
+ /** Complete engine choice. Backend-specific thinking and route validation belong to the domain. */
151
+ const engineSelectionShape = z.object({
152
+ backend: z.enum(['claude', 'pi']),
153
+ provider: z.string().min(1).nullable(),
154
+ model: z.string().min(1),
155
+ thinking: z.string().min(1).nullable(),
156
+ mode: z.string().min(1),
157
+ }).strict();
158
+ // Preserve required nullable fields in declarations even with strictNullChecks disabled.
159
+ export const engineSelectionInput = engineSelectionShape;
177
160
  export const sessionsSetSelectionInput = z.object({
178
161
  sessionId: z.string(),
179
- profileName: z.string().min(1).optional(),
180
- /** Absent: the profile keeps whatever the session had (and a profile switch drops it). */
181
- selection: sessionSelectionInput.optional(),
182
- });
162
+ selection: engineSelectionInput,
163
+ }).strict();
183
164
  export const sessionsAnswerQuestionInput = z.object({
184
165
  requestId: z.string().min(1),
185
166
  answers: z.record(z.string(), z.string()),
@@ -198,6 +179,12 @@ export const sessionsRespondDecisionInput = z.object({
198
179
  /** Required for explain/revise; ignored for approve. */
199
180
  message: z.string().optional(),
200
181
  });
182
+ /** Message identity keys an immutable snapshot of this media source. */
183
+ export const sessionsResolveMediaInput = z.object({
184
+ sessionId: z.string().regex(/^[\w-]+$/),
185
+ ts: z.string().min(1),
186
+ src: z.string().min(1),
187
+ });
201
188
  /** Args for `sessions.cancelResume`: decline the auto-resume promised when a rate limit
202
189
  * interrupted this session's turn. */
203
190
  export const sessionsCancelResumeInput = z.object({
@@ -217,20 +204,11 @@ export const sessionsRewindInput = z.object({
217
204
  export const sessionsCreateAndSendInput = z.object({
218
205
  /** Project the new session belongs to. */
219
206
  projectId: z.string(),
220
- /** The profile to create the session with. Omitted → system default. */
221
- profileName: z.string().optional(),
222
207
  /** The agent template — the environment — the new session runs as. Omitted → whatever the
223
208
  * global default agent is. Applied at creation, so the first turn already runs in it. */
224
209
  agentName: z.string().min(1).optional(),
225
- /** The model / provider / thinking the draft composer had selected on top of that profile.
226
- * Omitted (or empty) → the profile's own values: this call always comes from a composer, so
227
- * "nothing overridden" is a statement ("run the profile as declared"), not silence, and is
228
- * remembered as the engine the next new conversation opens on. Applied at creation so the first
229
- * turn already runs what the user picked (there is no session to `setSelection` on before this
230
- * call). */
231
- selection: sessionSelectionInput.optional(),
232
- /** Opt in to browser control for this session. Omitted → no browser tools are loaded. */
233
- browser: sessionBrowserInput.nullish(),
210
+ /** Complete engine choice applied before the first turn. Omitted → system default. */
211
+ selection: engineSelectionInput.optional(),
234
212
  /** First user message text. */
235
213
  text: z.string(),
236
214
  /** Temporary upload directory id (draft mode). Attachments were uploaded under this id
@@ -261,7 +239,7 @@ export const scheduleAddInput = z
261
239
  type: z.enum(['interval', 'daily', 'weekly', 'once']),
262
240
  message: z.string().min(1),
263
241
  projectId: z.string().optional(),
264
- profile: z.string().optional(),
242
+ selection: engineSelectionInput.optional(),
265
243
  intervalMs: z.number().int().positive().optional(),
266
244
  time: z.string().regex(/^\d{2}:\d{2}$/).optional(),
267
245
  dayOfWeek: z.number().int().min(0).max(6).optional(),
@@ -287,7 +265,7 @@ export const scheduleUpdateInput = z.object({
287
265
  scheduleId: z.string(),
288
266
  message: z.string().min(1).optional(),
289
267
  projectId: z.string().optional(),
290
- profile: z.string().optional(),
268
+ selection: engineSelectionInput.optional(),
291
269
  intervalMs: z.number().int().positive().optional(),
292
270
  time: z.string().regex(/^\d{2}:\d{2}$/).optional(),
293
271
  dayOfWeek: z.number().int().min(0).max(6).optional(),
@@ -329,7 +307,7 @@ function rejectUndefinedSettings(value, ctx) {
329
307
  const settingsValueInput = z.object(settingsShape).partial().strict()
330
308
  .superRefine(rejectUndefinedSettings);
331
309
  // config.set: a discriminated union of the safely-writable sections. `budget` numbers must be
332
- // finite and positive; `profiles` selects an existing default; `settings` accepts only finite,
310
+ // finite and positive; `settings` accepts only finite,
333
311
  // spec-typed partial overrides. Any section or settings key outside this union is rejected.
334
312
  //
335
313
  // `budget` targets the global limits by default, or one project's override when `project` is given.
@@ -355,12 +333,6 @@ export const configSetInput = z.discriminatedUnion('section', [
355
333
  });
356
334
  }
357
335
  }),
358
- z.object({
359
- section: z.literal('profiles'),
360
- value: z.object({
361
- defaultProfile: z.string().min(1),
362
- }),
363
- }),
364
336
  z.object({
365
337
  section: z.literal('settings'),
366
338
  value: settingsValueInput,
@@ -435,34 +407,15 @@ export const hooksTestInput = z.object({
435
407
  id: z.string().min(1),
436
408
  payload: z.string(),
437
409
  });
438
- // ── profiles.* ────────────────────────────────────────────────────
439
- // CRUD over the `profiles` map of profiles.json. This schema is the SHAPE gate only (types, name
440
- // charset, flag prefix); the SEMANTIC rules — pi requires a provider, thinking levels are
441
- // backend-specific, defaultProfile must exist — stay with validateProfilesFile(), which the mutate
442
- // handlers run over the assembled file so the server has exactly one profile validator.
443
- // `extraEnv` and `fallback[]` are absent by construction: extraEnv values are secret-bearing (the
444
- // read DTO returns keys only) and fallback is a nested chain with no editor. Both round-trip
445
- // untouched through an update.
446
- const profileSafeName = z.string().regex(/^[a-zA-Z0-9_-]+$/, 'may contain only letters, digits, - and _');
447
- const profileDraftShape = {
410
+ // ── models.* ──────────────────────────────────────────────────────
411
+ export const modelRefInput = engineSelectionShape.pick({ backend: true, provider: true, model: true });
412
+ export const modelsFavoriteInput = z.object({
413
+ backend: z.enum(['claude', 'pi']),
414
+ provider: z.string().min(1).nullable().optional(),
448
415
  model: z.string().min(1),
449
- backend: z.enum(['claude', 'pi']).optional(),
450
- mode: profileSafeName.optional(),
451
- provider: profileSafeName.optional(),
452
- thinking: z.string().min(1).optional(),
453
- extraOption: z.record(z.string().startsWith('--'), z.string()).optional(),
454
- };
455
- export const profilesCreateInput = z.object({
456
- name: profileSafeName.min(1),
457
- ...profileDraftShape,
458
- });
459
- export const profilesUpdateInput = z.object({
460
- name: profileSafeName.min(1),
461
- ...profileDraftShape,
462
- });
463
- export const profilesRemoveInput = z.object({
464
- name: profileSafeName.min(1),
465
- });
416
+ }).strict();
417
+ export const modelsSetThinkingInput = z.object({ ref: modelRefInput, thinking: z.string().nullable() }).strict();
418
+ export const modelsSetDefaultInput = z.object({ selection: engineSelectionInput }).strict();
466
419
  const componentByteLength = (value) => new TextEncoder().encode(value).byteLength <= 255;
467
420
  const isSafeComponent = (value) => value !== '.' && value !== '..'
468
421
  && !value.includes('/') && !value.includes('\\') && !value.includes('\0');
@@ -675,7 +628,6 @@ export const mutateInputSchemas = {
675
628
  'sessions.send': sessionsSendInput,
676
629
  'sessions.cancel': sessionsCancelInput,
677
630
  'sessions.compact': sessionsCompactInput,
678
- 'sessions.setProfile': sessionsSetProfileInput,
679
631
  'sessions.setAgent': sessionsSetAgentInput,
680
632
  'sessions.setSelection': sessionsSetSelectionInput,
681
633
  'sessions.createAndSend': sessionsCreateAndSendInput,
@@ -688,6 +640,7 @@ export const mutateInputSchemas = {
688
640
  'sessions.respondDecision': sessionsRespondDecisionInput,
689
641
  'sessions.cancelResume': sessionsCancelResumeInput,
690
642
  'sessions.rewind': sessionsRewindInput,
643
+ 'sessions.resolveMedia': sessionsResolveMediaInput,
691
644
  'executions.cancel': executionsCancelInput,
692
645
  'waitpoints.cancel': waitpointsCancelInput,
693
646
  'schedules.pause': scheduleActionInput,
@@ -721,9 +674,10 @@ export const mutateInputSchemas = {
721
674
  'hooks.setEnabled': hooksSetEnabledInput,
722
675
  'hooks.remove': hooksRemoveInput,
723
676
  'hooks.test': hooksTestInput,
724
- 'profiles.create': profilesCreateInput,
725
- 'profiles.update': profilesUpdateInput,
726
- 'profiles.remove': profilesRemoveInput,
677
+ 'models.favorites.add': modelsFavoriteInput,
678
+ 'models.favorites.remove': modelsFavoriteInput,
679
+ 'models.setDefault': modelsSetDefaultInput,
680
+ 'models.setThinking': modelsSetThinkingInput,
727
681
  'plugins.assign': pluginsAssignInput,
728
682
  'plugins.skillWrite': pluginsSkillWriteInput,
729
683
  'plugins.skillCreate': pluginsSkillCreateInput,
@@ -5,7 +5,7 @@ export declare function handleAuthRespondPrompt(deps: UiServiceDeps, args: Mutat
5
5
  export declare function handleAuthCancelFlow(deps: UiServiceDeps, args: MutateArgs<'auth.cancelFlow'>): Promise<Result<LoginFlowState>>;
6
6
  export declare function handleAuthLogout(deps: UiServiceDeps, args: MutateArgs<'auth.logout'>): Promise<Result<AuthLogoutReturn>>;
7
7
  /**
8
- * Re-derive gateway modes and profiles from the backends this machine can reach.
8
+ * Re-derive gateway routes and favorites from the backends this machine can reach.
9
9
  *
10
10
  * Runs automatically after a login (see the `onLoginSuccess` wiring in entry/app.ts); this is the
11
11
  * manual entry point for the cases that misses — a credential that predates the automatic sync, or
@@ -80,7 +80,7 @@ export async function handleAuthLogout(deps, args) {
80
80
  return { ok: false, code: result.error.code, message: result.error.message };
81
81
  }
82
82
  /**
83
- * Re-derive gateway modes and profiles from the backends this machine can reach.
83
+ * Re-derive gateway routes and favorites from the backends this machine can reach.
84
84
  *
85
85
  * Runs automatically after a login (see the `onLoginSuccess` wiring in entry/app.ts); this is the
86
86
  * manual entry point for the cases that misses — a credential that predates the automatic sync, or
@@ -95,7 +95,8 @@ export async function handleAuthSyncGateway(deps, args) {
95
95
  data: {
96
96
  configured: result.configured,
97
97
  endpoints: result.endpoints,
98
- profiles: result.profiles,
98
+ defaultSet: result.defaultSet,
99
+ favorites: result.favorites,
99
100
  ...(result.reason ? { reason: result.reason } : {}),
100
101
  },
101
102
  };
@@ -14,13 +14,5 @@ import type { UiServiceDeps, Result, ConfigSetReturn, ConfigSetProviderRateLimit
14
14
  * where typos are likely, validates against projectStore before calling into the domain.
15
15
  */
16
16
  export declare function writeBudget(configDir: string, value?: BudgetValue | null, project?: string | null): Promise<void>;
17
- /**
18
- * Re-point profiles.json `defaultProfile`, PRESERVING every other field. Pure over its dir
19
- * argument. The target MUST already exist in the file's `profiles` map — the write can only SELECT
20
- * an existing profile, never invent one (a non-existent default would break agent startup). A
21
- * missing / malformed profiles.json or an unknown profile throws with `code: 'invalid-args'` so the
22
- * handler maps it to BAD_REQUEST rather than an internal error.
23
- */
24
- export declare function writeDefaultProfile(configDir: string, defaultProfile: string): Promise<void>;
25
17
  export declare function handleConfigSet(deps: UiServiceDeps, args: MutateArgs<'config.set'>): Promise<Result<ConfigSetReturn>>;
26
18
  export declare function handleConfigSetProviderRateLimitPolicy(_deps: UiServiceDeps, args: MutateArgs<'config.setProviderRateLimitPolicy'>): Promise<Result<ConfigSetProviderRateLimitPolicyReturn>>;
@@ -1,4 +1,3 @@
1
- import { t } from '../../../core/i18n.js';
2
1
  import path from 'node:path';
3
2
  import fs from 'node:fs/promises';
4
3
  import { CONFIG_DIR } from '../../../core/paths.js';
@@ -7,7 +6,6 @@ import { setProviderRateLimitPolicy, updateSettings } from '../../../core/settin
7
6
  import { applyLang } from '../../system/preferences.js';
8
7
  import { costRepo } from '../../../store/cost-repo.js';
9
8
  import { configSetInput, configSetProviderRateLimitPolicyInput, } from '../input-schemas.js';
10
- import { readProfilesFile, writeProfilesFile } from './profiles.js';
11
9
  /**
12
10
  * Validate and atomically write budget.json into `configDir`. Pure over its dir argument
13
11
  * (hermetically testable against a temp dir). Re-validates through the same zod schema the router
@@ -56,22 +54,6 @@ export async function writeBudget(configDir, value, project) {
56
54
  // beats a file whose keys depend on which surface last wrote it.
57
55
  await atomicWrite(file, JSON.stringify(next, null, 2) + '\n');
58
56
  }
59
- /**
60
- * Re-point profiles.json `defaultProfile`, PRESERVING every other field. Pure over its dir
61
- * argument. The target MUST already exist in the file's `profiles` map — the write can only SELECT
62
- * an existing profile, never invent one (a non-existent default would break agent startup). A
63
- * missing / malformed profiles.json or an unknown profile throws with `code: 'invalid-args'` so the
64
- * handler maps it to BAD_REQUEST rather than an internal error.
65
- */
66
- export async function writeDefaultProfile(configDir, defaultProfile) {
67
- const raw = await readProfilesFile(configDir);
68
- if (!Object.prototype.hasOwnProperty.call(raw.profiles, defaultProfile)) {
69
- throw Object.assign(new Error(t('ui.profile.notFound', { name: defaultProfile })), {
70
- code: 'invalid-args',
71
- });
72
- }
73
- await writeProfilesFile(configDir, { ...raw, defaultProfile });
74
- }
75
57
  export async function handleConfigSet(deps, args) {
76
58
  // Validate first (invalid-args → BAD_REQUEST), so a genuine write/IO failure below is not
77
59
  // misreported as bad input. Covers the section guard and each section's constraints in one pass.
@@ -87,10 +69,6 @@ export async function handleConfigSet(deps, args) {
87
69
  costRepo.invalidateBudget();
88
70
  return { ok: true, data: { written: true, section: 'budget' } };
89
71
  }
90
- if (parsed.data.section === 'profiles') {
91
- await writeDefaultProfile(CONFIG_DIR, parsed.data.value.defaultProfile);
92
- return { ok: true, data: { written: true, section: 'profiles' } };
93
- }
94
72
  if (parsed.data.section === 'preferences') {
95
73
  // One knob, two effects: preferences.json is rewritten AND the live locale switches, so the
96
74
  // very next server-side t() (a compaction notice, a command reply) speaks the new language.
@@ -0,0 +1,13 @@
1
+ import { readGatewayYaml } from '../../../core/gateway-generator.js';
2
+ import { type EngineSelection, type ModelRef } from '../../agents/engine-selection.js';
3
+ import type { UiServiceDeps, Result, ModelsMutationReturn, MutateArgs } from '../types.js';
4
+ type GatewayReader = () => ReturnType<typeof readGatewayYaml>;
5
+ export declare function addFavorite(configDir: string, args: MutateArgs<'models.favorites.add'>): Promise<boolean>;
6
+ export declare function removeFavorite(configDir: string, args: MutateArgs<'models.favorites.remove'>): Promise<boolean>;
7
+ export declare function setDefaultModel(configDir: string, args: MutateArgs<'models.setDefault'>, readGateway?: GatewayReader): Promise<boolean>;
8
+ export declare function setModelThinking(configDir: string, args: MutateArgs<'models.setThinking'>, resolveSelection?: (ref: ModelRef) => EngineSelection): Promise<boolean>;
9
+ export declare function handleModelsFavoriteAdd(_deps: UiServiceDeps, args: MutateArgs<'models.favorites.add'>): Promise<Result<ModelsMutationReturn>>;
10
+ export declare function handleModelsFavoriteRemove(_deps: UiServiceDeps, args: MutateArgs<'models.favorites.remove'>): Promise<Result<ModelsMutationReturn>>;
11
+ export declare function handleModelsSetDefault(_deps: UiServiceDeps, args: MutateArgs<'models.setDefault'>): Promise<Result<ModelsMutationReturn>>;
12
+ export declare function handleModelsSetThinking(_deps: UiServiceDeps, args: MutateArgs<'models.setThinking'>): Promise<Result<ModelsMutationReturn>>;
13
+ export {};