@cortex-agent/server 2026.9.15 → 2026.9.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 (297) hide show
  1. package/README.md +3 -2
  2. package/defaults/config/hooks/08-agents-md-injector-post-tool.json +10 -0
  3. package/defaults/config/hooks/{10-cortex-md-injector-session-start.json → 10-agents-md-injector-session-start.json} +3 -3
  4. package/defaults/config/hooks/{CORTEX.md → AGENTS.md} +2 -2
  5. package/defaults/config/thread-templates/agents/creative.json +17 -0
  6. package/defaults/hooks/{CORTEX.md → AGENTS.md} +1 -1
  7. package/defaults/hooks/{cortex-md-injector.mjs → agents-md-injector.mjs} +117 -26
  8. package/defaults/hooks/cortex-hook-api.mjs +2 -2
  9. package/defaults/hooks/new-session-hook.mjs +2 -2
  10. package/defaults/hooks/rules-loader.mjs +2 -2
  11. package/defaults/hooks/status-md-guard.mjs +8 -8
  12. package/defaults/hooks/task-status-check.mjs +18 -76
  13. package/defaults/hooks/tasks-yaml-guard.mjs +2 -2
  14. package/defaults/plugins/cortex-feishu/skills/feishu-doc/SKILL.md +1 -1
  15. package/defaults/plugins/cortex-system/skills/client-manage/SKILL.md +2 -2
  16. package/defaults/plugins/cortex-system/skills/project-init/SKILL.md +4 -4
  17. package/defaults/plugins/cortex-system/skills/task/SKILL.md +1 -1
  18. package/defaults/prompts/systemPrompts/creative.md +13 -0
  19. package/defaults/prompts/systemPrompts/direct.md +1 -1
  20. package/defaults/rules/{cortex-md.md → agents-md.md} +4 -4
  21. package/defaults/rules/decision-records.md +1 -1
  22. package/defaults/rules/meta-conventions.md +4 -4
  23. package/defaults/rules/mission-md.md +1 -1
  24. package/dist/agent-adapter/claude/adapter.d.ts +12 -0
  25. package/dist/agent-adapter/claude/adapter.js +19 -1
  26. package/dist/agent-adapter/claude/hooks-builder.js +2 -2
  27. package/dist/agent-adapter/claude/spawn-args.d.ts +7 -0
  28. package/dist/agent-adapter/claude/spawn-args.js +14 -0
  29. package/dist/agent-adapter/claude/turn-machine.d.ts +11 -0
  30. package/dist/agent-adapter/claude/turn-machine.js +46 -5
  31. package/dist/agent-adapter/normalize/prompt-builder.d.ts +16 -1
  32. package/dist/agent-adapter/normalize/prompt-builder.js +24 -6
  33. package/dist/agent-adapter/pi/child-runner.d.ts +4 -2
  34. package/dist/agent-adapter/pi/child-runner.js +5 -1
  35. package/dist/agent-adapter/pi/event-parser.d.ts +3 -2
  36. package/dist/agent-adapter/pi/event-parser.js +46 -2
  37. package/dist/agent-adapter/pi/extensions.d.ts +7 -1
  38. package/dist/agent-adapter/pi/extensions.js +10 -3
  39. package/dist/agent-adapter/pi/mcp-bridge.js +8 -8
  40. package/dist/agent-adapter/pi/pi-session.js +5 -0
  41. package/dist/agent-adapter/pi/runtime.js +3 -0
  42. package/dist/agent-adapter/pi/session-options.js +5 -1
  43. package/dist/agent-adapter/pi/subagent.d.ts +15 -3
  44. package/dist/agent-adapter/pi/subagent.js +18 -0
  45. package/dist/agent-adapter/pi/tool-shims.d.ts +6 -1
  46. package/dist/agent-adapter/pi/tool-shims.js +34 -1
  47. package/dist/agent-adapter/types.d.ts +6 -0
  48. package/dist/core/agents/subagent/types.d.ts +3 -0
  49. package/dist/core/config-generator.js +17 -2
  50. package/dist/core/debug-mode.d.ts +11 -10
  51. package/dist/core/debug-mode.js +12 -18
  52. package/dist/core/exec-async.d.ts +26 -0
  53. package/dist/core/exec-async.js +47 -0
  54. package/dist/core/locales/en.d.ts +14 -1
  55. package/dist/core/locales/slices/commands.d.ts +12 -1
  56. package/dist/core/locales/slices/commands.js +24 -2
  57. package/dist/core/locales/slices/startup.d.ts +2 -0
  58. package/dist/core/locales/slices/startup.js +4 -0
  59. package/dist/core/mcp-tool-gate.js +1 -0
  60. package/dist/core/media-types.d.ts +10 -0
  61. package/dist/core/media-types.js +34 -0
  62. package/dist/core/platform-settings-spec.js +1 -1
  63. package/dist/core/rebuild-progress.d.ts +58 -0
  64. package/dist/core/rebuild-progress.js +103 -0
  65. package/dist/core/resilient-watch.js +5 -3
  66. package/dist/core/run-registry.d.ts +7 -0
  67. package/dist/core/run-registry.js +6 -0
  68. package/dist/core/settings-spec.d.ts +21 -0
  69. package/dist/core/settings-spec.js +28 -1
  70. package/dist/core/types/agent-types.d.ts +3 -1
  71. package/dist/core/types/thread-types.d.ts +23 -4
  72. package/dist/core/utils.d.ts +1 -1
  73. package/dist/core/utils.js +1 -1
  74. package/dist/domain/agents/agent-state.d.ts +7 -0
  75. package/dist/domain/agents/agent-state.js +9 -1
  76. package/dist/domain/agents/agent-switch.d.ts +38 -0
  77. package/dist/domain/agents/agent-switch.js +106 -0
  78. package/dist/domain/agents/config.d.ts +20 -2
  79. package/dist/domain/agents/config.js +58 -4
  80. package/dist/domain/agents/index.d.ts +1 -0
  81. package/dist/domain/agents/index.js +1 -0
  82. package/dist/domain/agents/profile-manager.d.ts +6 -0
  83. package/dist/domain/agents/profile-manager.js +14 -1
  84. package/dist/domain/executions/registry.d.ts +3 -2
  85. package/dist/domain/executions/registry.js +84 -10
  86. package/dist/domain/mcp/bundled-server.js +4 -3
  87. package/dist/domain/mcp/feishu/file.js +37 -18
  88. package/dist/domain/mcp/feishu/types.d.ts +3 -0
  89. package/dist/domain/mcp/feishu-server.js +1 -1
  90. package/dist/domain/mcp/tools/{cortex-md.d.ts → agents-md.d.ts} +6 -6
  91. package/dist/domain/mcp/tools/{cortex-md.js → agents-md.js} +6 -6
  92. package/dist/domain/mcp/tools/remote-file.d.ts +20 -0
  93. package/dist/domain/mcp/tools/remote-file.js +44 -0
  94. package/dist/domain/mcp/tools/slack.d.ts +2 -0
  95. package/dist/domain/mcp/tools/slack.js +22 -7
  96. package/dist/domain/mcp/tools/task-ops.js +5 -13
  97. package/dist/domain/mcp/tools/ui-file.js +23 -10
  98. package/dist/domain/mcp/tools/waitpoint.d.ts +3 -0
  99. package/dist/domain/mcp/tools/waitpoint.js +122 -0
  100. package/dist/domain/memory/agents-md-injector.d.ts +24 -0
  101. package/dist/domain/memory/{cortex-md-injector.js → agents-md-injector.js} +10 -7
  102. package/dist/domain/plugins/runtime.js +1 -1
  103. package/dist/domain/plugins/skill-projection.d.ts +8 -2
  104. package/dist/domain/plugins/skill-projection.js +76 -19
  105. package/dist/domain/projects/project-store.d.ts +1 -1
  106. package/dist/domain/projects/project-store.js +3 -3
  107. package/dist/domain/remote/client-bootstrap.js +1 -1
  108. package/dist/domain/remote/client-hot-reload.d.ts +1 -1
  109. package/dist/domain/remote/client-hot-reload.js +30 -24
  110. package/dist/domain/remote/client-manager.js +39 -119
  111. package/dist/domain/remote/cortex-client-config.d.ts +1 -1
  112. package/dist/domain/remote/cortex-client-config.js +1 -1
  113. package/dist/domain/remote/device-file.d.ts +51 -0
  114. package/dist/domain/remote/device-file.js +193 -0
  115. package/dist/domain/remote/device-port.js +3 -0
  116. package/dist/domain/remote/reverse-stream.d.ts +18 -7
  117. package/dist/domain/remote/reverse-stream.js +19 -6
  118. package/dist/domain/runs/engine-spec.js +4 -0
  119. package/dist/domain/runs/request.d.ts +6 -0
  120. package/dist/domain/runs/run.js +1 -0
  121. package/dist/domain/runs/spec-loader.d.ts +4 -3
  122. package/dist/domain/runs/spec-loader.js +4 -3
  123. package/dist/domain/scheduling/jobs/sync-public.js +6 -6
  124. package/dist/domain/scheduling/scheduler.js +14 -12
  125. package/dist/domain/sessions/session-lifecycle.d.ts +5 -0
  126. package/dist/domain/sessions/session-lifecycle.js +13 -1
  127. package/dist/domain/system/rebuild-hold.d.ts +44 -0
  128. package/dist/domain/system/rebuild-hold.js +91 -0
  129. package/dist/domain/system/server-update-check.d.ts +2 -1
  130. package/dist/domain/system/server-update-check.js +15 -13
  131. package/dist/domain/tasks/archiver.js +21 -13
  132. package/dist/domain/tasks/claim-recovery.js +2 -2
  133. package/dist/domain/tasks/dispatch-utils.d.ts +10 -1
  134. package/dist/domain/tasks/dispatch-utils.js +46 -1
  135. package/dist/domain/tasks/dispatcher.js +4 -5
  136. package/dist/domain/tasks/mutator.d.ts +2 -2
  137. package/dist/domain/tasks/mutator.js +62 -61
  138. package/dist/domain/tasks/system/task-cli.js +2 -2
  139. package/dist/domain/tasks/system/task-completion.d.ts +7 -2
  140. package/dist/domain/tasks/system/task-completion.js +69 -6
  141. package/dist/domain/tasks/system/task-lifecycle-edit.d.ts +6 -1
  142. package/dist/domain/tasks/system/task-lifecycle-edit.js +21 -2
  143. package/dist/domain/tasks/system/task-lock.d.ts +23 -0
  144. package/dist/domain/tasks/system/task-lock.js +29 -1
  145. package/dist/domain/tasks/system/task-mutations.d.ts +14 -1
  146. package/dist/domain/tasks/system/task-mutations.js +25 -2
  147. package/dist/domain/tasks/system/task-state.d.ts +12 -1
  148. package/dist/domain/tasks/system/task-state.js +20 -3
  149. package/dist/domain/threads/prompt-builder.d.ts +9 -6
  150. package/dist/domain/threads/prompt-builder.js +28 -10
  151. package/dist/domain/threads/runner.js +10 -4
  152. package/dist/domain/threads/state-machine.js +15 -11
  153. package/dist/domain/threads/template-loader.js +6 -4
  154. package/dist/domain/threads/template-validate.d.ts +43 -6
  155. package/dist/domain/threads/template-validate.js +12 -0
  156. package/dist/domain/ui-service/app-router.d.ts +34 -3
  157. package/dist/domain/ui-service/app-router.js +9 -14
  158. package/dist/domain/ui-service/input-schemas.d.ts +28 -5
  159. package/dist/domain/ui-service/input-schemas.js +24 -9
  160. package/dist/domain/ui-service/mutate/platform-settings.js +1 -1
  161. package/dist/domain/ui-service/mutate/sessions.d.ts +6 -1
  162. package/dist/domain/ui-service/mutate/sessions.js +54 -0
  163. package/dist/domain/ui-service/mutate/tasks.js +4 -3
  164. package/dist/domain/ui-service/mutate/waitpoints.d.ts +2 -0
  165. package/dist/domain/ui-service/mutate/waitpoints.js +20 -0
  166. package/dist/domain/ui-service/platform-settings.js +1 -1
  167. package/dist/domain/ui-service/plugins-shared.js +1 -1
  168. package/dist/domain/ui-service/query/config.js +20 -2
  169. package/dist/domain/ui-service/query/executions.js +0 -2
  170. package/dist/domain/ui-service/query/machine-detail.js +3 -8
  171. package/dist/domain/ui-service/query/memory.js +29 -35
  172. package/dist/domain/ui-service/query/sessions.js +96 -12
  173. package/dist/domain/ui-service/query/system.js +19 -0
  174. package/dist/domain/ui-service/query/threads.js +1 -54
  175. package/dist/domain/ui-service/query/waitpoints.d.ts +30 -0
  176. package/dist/domain/ui-service/query/waitpoints.js +117 -0
  177. package/dist/domain/ui-service/query-input-schemas.d.ts +4 -0
  178. package/dist/domain/ui-service/query-input-schemas.js +5 -0
  179. package/dist/domain/ui-service/trpc.js +1 -1
  180. package/dist/domain/ui-service/types.d.ts +229 -51
  181. package/dist/domain/ui-service/types.js +1 -1
  182. package/dist/domain/ui-service/ui-service.js +8 -31
  183. package/dist/domain/waitpoints/notices.d.ts +21 -0
  184. package/dist/domain/waitpoints/notices.js +115 -0
  185. package/dist/domain/waitpoints/service.d.ts +91 -0
  186. package/dist/domain/waitpoints/service.js +243 -0
  187. package/dist/entry/app.js +52 -11
  188. package/dist/entry/auth-login-cli.js +1 -1
  189. package/dist/entry/auth-login-terminal.js +1 -1
  190. package/dist/entry/daemon-notice.d.ts +10 -1
  191. package/dist/entry/daemon-notice.js +16 -1
  192. package/dist/entry/daemon.d.ts +43 -2
  193. package/dist/entry/daemon.js +163 -9
  194. package/dist/entry/init-auth.js +1 -1
  195. package/dist/entry/init.js +6 -6
  196. package/dist/entry/signal-cli.d.ts +30 -0
  197. package/dist/entry/signal-cli.js +207 -0
  198. package/dist/entry/start-ui-http.d.ts +1 -1
  199. package/dist/entry/start-ui-http.js +2 -2
  200. package/dist/events/event-types.d.ts +0 -7
  201. package/dist/hooks/{cortex-md-injector.mjs → agents-md-injector.mjs} +117 -26
  202. package/dist/hooks/cortex-hook-api.mjs +2 -2
  203. package/dist/hooks/new-session-hook.mjs +2 -2
  204. package/dist/hooks/rules-loader.mjs +2 -2
  205. package/dist/hooks/status-md-guard.mjs +8 -8
  206. package/dist/hooks/task-status-check.mjs +18 -76
  207. package/dist/hooks/tasks-yaml-guard.mjs +2 -2
  208. package/dist/orchestration/agent-file-send.d.ts +9 -0
  209. package/dist/orchestration/agent-file-send.js +21 -2
  210. package/dist/orchestration/agent-runner.d.ts +3 -2
  211. package/dist/orchestration/agent-runner.js +33 -12
  212. package/dist/orchestration/attachments-store.d.ts +31 -0
  213. package/dist/orchestration/attachments-store.js +184 -0
  214. package/dist/orchestration/conversation-request.d.ts +37 -0
  215. package/dist/orchestration/conversation-request.js +91 -22
  216. package/dist/orchestration/interactions/plan-approvals.js +1 -1
  217. package/dist/orchestration/mid-turn-inject.d.ts +3 -0
  218. package/dist/orchestration/mid-turn-inject.js +9 -4
  219. package/dist/orchestration/outputs-store.d.ts +11 -0
  220. package/dist/orchestration/outputs-store.js +32 -6
  221. package/dist/orchestration/resume-dispatcher.js +4 -2
  222. package/dist/orchestration/routing/commands/mode.js +114 -63
  223. package/dist/orchestration/routing/file-handler.d.ts +23 -2
  224. package/dist/orchestration/routing/file-handler.js +22 -5
  225. package/dist/orchestration/routing/webhook.js +193 -39
  226. package/dist/orchestration/session-gateway.d.ts +1 -1
  227. package/dist/orchestration/session-gateway.js +1 -0
  228. package/dist/orchestration/thread-executor.d.ts +2 -0
  229. package/dist/orchestration/thread-executor.js +24 -1
  230. package/dist/orchestration/thread-input.d.ts +3 -2
  231. package/dist/orchestration/thread-input.js +8 -9
  232. package/dist/orchestration/turn/turn-prep.d.ts +15 -1
  233. package/dist/orchestration/turn/turn-prep.js +19 -8
  234. package/dist/orchestration/turn/turn.js +1 -0
  235. package/dist/orchestration/waitpoint-ingress.d.ts +41 -0
  236. package/dist/orchestration/waitpoint-ingress.js +172 -0
  237. package/dist/orchestration/waitpoint-notifier.d.ts +21 -0
  238. package/dist/orchestration/waitpoint-notifier.js +119 -0
  239. package/dist/orchestration/waitpoint-remote-drain.d.ts +20 -0
  240. package/dist/orchestration/waitpoint-remote-drain.js +147 -0
  241. package/dist/orchestration/waitpoint-sweep.d.ts +42 -0
  242. package/dist/orchestration/waitpoint-sweep.js +87 -0
  243. package/dist/platform/adapters/feishu-image.d.ts +19 -0
  244. package/dist/platform/adapters/feishu-image.js +71 -0
  245. package/dist/platform/adapters/feishu.d.ts +2 -0
  246. package/dist/platform/adapters/feishu.js +26 -16
  247. package/dist/platform/ui-http/listening-ports.d.ts +1 -1
  248. package/dist/platform/ui-http/listening-ports.js +1 -1
  249. package/dist/platform/ui-http/ui-session.js +1 -1
  250. package/dist/store/conversation-display-projection.d.ts +9 -1
  251. package/dist/store/conversation-display-projection.js +13 -6
  252. package/dist/store/conversation-history-reader.d.ts +19 -0
  253. package/dist/store/conversation-history-reader.js +163 -44
  254. package/dist/store/conversation-history-repo.d.ts +37 -10
  255. package/dist/store/conversation-history-repo.js +161 -139
  256. package/dist/store/conversation-ledger-repo.js +1 -1
  257. package/dist/store/execution-repo.d.ts +1 -19
  258. package/dist/store/execution-repo.js +1 -18
  259. package/dist/store/project-notes-repo.js +11 -2
  260. package/dist/store/prompt-migration-replacements.js +1 -1
  261. package/dist/store/session-registry-import.js +1 -1
  262. package/dist/store/session-registry-journal.d.ts +4 -0
  263. package/dist/store/session-registry-journal.js +5 -1
  264. package/dist/store/session-registry-repo.d.ts +2 -1
  265. package/dist/store/session-registry-repo.js +3 -1
  266. package/dist/store/task-repo.d.ts +6 -3
  267. package/dist/store/task-repo.js +26 -10
  268. package/dist/store/version-migrations.d.ts +13 -3
  269. package/dist/store/version-migrations.js +254 -24
  270. package/dist/store/waitpoint-repo.d.ts +108 -0
  271. package/dist/store/waitpoint-repo.js +94 -0
  272. package/package.json +3 -2
  273. package/web/dist/AGENTS.md +10 -0
  274. package/web/dist/assets/index-B1dBi8Za.css +1 -0
  275. package/web/dist/assets/{index-CEZ0DSei.js → index-BAeLybF0.js} +1 -1
  276. package/web/dist/assets/index-BcQI8Fh5.js +445 -0
  277. package/web/dist/index.html +12 -4
  278. package/web/dist/theme.css +211 -40
  279. package/defaults/config/hooks/08-cortex-md-injector-post-tool.json +0 -10
  280. package/dist/domain/executions/log-tailer.d.ts +0 -71
  281. package/dist/domain/executions/log-tailer.js +0 -194
  282. package/dist/domain/memory/cortex-md-injector.d.ts +0 -24
  283. package/dist/domain/memory/cortex-md-scanner.d.ts +0 -10
  284. package/dist/domain/memory/cortex-md-scanner.js +0 -66
  285. package/dist/domain/remote/cortex-client.d.ts +0 -1
  286. package/dist/domain/remote/cortex-client.js +0 -662
  287. package/dist/domain/tasks/system/cortex-run.d.ts +0 -25
  288. package/dist/domain/tasks/system/cortex-run.js +0 -360
  289. package/web/dist/assets/index-CRDJo39X.css +0 -1
  290. package/web/dist/assets/index-DjuPJVZE.js +0 -444
  291. /package/defaults/{CORTEX.md → AGENTS.md} +0 -0
  292. /package/defaults/config/{CORTEX.md → AGENTS.md} +0 -0
  293. /package/defaults/context/{CORTEX.md → AGENTS.md} +0 -0
  294. /package/defaults/context/ideas/{CORTEX.md → AGENTS.md} +0 -0
  295. /package/defaults/context/projects/{CORTEX.md → AGENTS.md} +0 -0
  296. /package/defaults/context/scans/{CORTEX.md → AGENTS.md} +0 -0
  297. /package/defaults/context/user/{CORTEX.md → AGENTS.md} +0 -0
@@ -17,11 +17,11 @@ import type { HookBackend, HookEvent, HookFilterValue, HookPhase, HookResultMode
17
17
  import type { HookApplyTime, HookMountTarget } from '../hooks/hook-view.js';
18
18
  export type { HookApplyTime, HookMountTarget } from '../hooks/hook-view.js';
19
19
  import type { Session } from '../../store/session-registry-repo.js';
20
+ import type { Waitpoint } from '../../store/waitpoint-repo.js';
20
21
  import type { SessionTotals } from '../../store/session-totals.js';
21
22
  export type { SessionTotals } from '../../store/session-totals.js';
22
23
  import type { ScheduleTask, ScheduleTarget } from '../../store/schedule-repo.js';
23
24
  import type { CommissionRecord } from '../../store/commission-repo.js';
24
- import type { LogLocation } from '../executions/log-tailer.js';
25
25
  import type { SessionHistory } from '../../store/conversation-history-repo.js';
26
26
  import type { Backend } from '../../agent-adapter/types.js';
27
27
  import type { ProjectNote } from '../../store/project-notes-repo.js';
@@ -40,12 +40,12 @@ export type Err = {
40
40
  message: string;
41
41
  };
42
42
  export type Result<T> = Ok<T> | Err;
43
- export type QueryScope = 'projects.list' | 'sessions.list' | 'sessions.transcript' | 'sessions.subagentTranscript' | 'sessions.debugDetails' | 'sessions.pendingInteraction' | 'threads.list' | 'threads.get' | 'tasks.list' | 'tasks.verification' | 'schedules.list' | 'commissions.list' | 'commissions.get' | 'commissions.decisions' | 'executions.list' | 'executions.get' | 'memory.tree' | 'memory.file' | 'approvals.list' | 'issues.list' | 'notes.list' | 'cost.summary' | 'config.get' | 'auth.status' | 'auth.flowState' | 'auth.customProviders' | 'models.catalog' | 'hooks.list' | 'machines.list' | 'machines.detail' | 'skills.list' | 'plugins.list' | 'plugins.skillFile' | 'plugins.mcpRead' | 'threadTemplates.get' | 'threadTemplates.detail' | 'system.daemonStatus' | 'system.rateLimitStatus' | 'system.usageStatus' | 'system.notices' | 'system.updateStatus';
44
- export type MutateOp = 'projects.create' | 'sessions.create' | 'sessions.send' | 'sessions.cancel' | 'sessions.compact' | 'sessions.setProfile' | 'sessions.setSelection' | 'sessions.setCommission' | 'sessions.createAndSend' | 'sessions.markRead' | 'sessions.answerQuestion' | 'sessions.respondPlan' | 'sessions.respondDecision' | 'sessions.cancelResume' | 'sessions.rewind' | 'threads.cancel' | 'executions.cancel' | 'schedules.pause' | 'schedules.resume' | 'schedules.remove' | 'schedules.add' | 'schedules.update' | 'commissions.close' | 'tasks.claim' | 'tasks.unclaim' | 'tasks.complete' | 'tasks.block' | 'tasks.unblock' | 'approvals.approve' | 'approvals.reject' | 'approvals.request' | 'issues.handle' | 'issues.delete' | 'notes.add' | 'notes.update' | 'notes.setCompleted' | 'notes.delete' | 'notes.clearCompleted' | 'config.set' | 'config.setPlatform' | 'config.setProviderRateLimitPolicy' | 'auth.startLogin' | 'auth.respondPrompt' | 'auth.cancelFlow' | 'auth.logout' | 'auth.syncGateway' | 'auth.upsertCustomProvider' | 'auth.removeCustomProvider' | 'hooks.create' | 'hooks.update' | 'hooks.setEnabled' | 'hooks.remove' | 'hooks.test' | 'profiles.create' | 'profiles.update' | 'profiles.remove' | 'plugins.assign' | 'plugins.skillWrite' | 'plugins.skillCreate' | 'plugins.skillMove' | 'plugins.skillRemove' | 'plugins.create' | 'plugins.remove' | 'plugins.convertToPortable' | 'plugins.mcpWrite' | 'threadTemplates.validate' | 'threadTemplates.save' | 'threadTemplates.remove' | 'system.restart' | 'system.clearRateLimit' | 'system.refreshUsage' | 'system.applyUpdate' | 'system.skipUpdate';
43
+ export type QueryScope = 'projects.list' | 'sessions.list' | 'sessions.transcript' | 'sessions.subagentTranscript' | 'sessions.debugDetails' | 'sessions.pendingInteraction' | 'threads.list' | 'threads.get' | 'tasks.list' | 'tasks.verification' | 'schedules.list' | 'commissions.list' | 'commissions.get' | 'commissions.decisions' | 'executions.list' | 'executions.get' | 'memory.tree' | 'memory.file' | 'approvals.list' | 'issues.list' | 'notes.list' | 'cost.summary' | 'config.get' | 'auth.status' | 'auth.flowState' | 'auth.customProviders' | 'models.catalog' | 'hooks.list' | 'machines.list' | 'machines.detail' | 'skills.list' | 'plugins.list' | 'plugins.skillFile' | 'plugins.mcpRead' | 'threadTemplates.get' | 'threadTemplates.detail' | 'system.daemonStatus' | 'system.rateLimitStatus' | 'system.usageStatus' | 'system.notices' | 'system.updateStatus' | 'waitpoints.list';
44
+ export type MutateOp = 'projects.create' | 'sessions.create' | 'sessions.send' | 'sessions.cancel' | 'sessions.compact' | 'sessions.setProfile' | 'sessions.setAgent' | 'sessions.setSelection' | 'sessions.setCommission' | 'sessions.createAndSend' | 'sessions.markRead' | 'sessions.markManyRead' | 'sessions.answerQuestion' | 'sessions.respondPlan' | 'sessions.respondDecision' | 'sessions.cancelResume' | 'sessions.rewind' | 'threads.cancel' | 'executions.cancel' | 'waitpoints.cancel' | 'schedules.pause' | 'schedules.resume' | 'schedules.remove' | 'schedules.add' | 'schedules.update' | 'commissions.close' | 'tasks.claim' | 'tasks.unclaim' | 'tasks.complete' | 'tasks.block' | 'tasks.unblock' | 'approvals.approve' | 'approvals.reject' | 'approvals.request' | 'issues.handle' | 'issues.delete' | 'notes.add' | 'notes.update' | 'notes.setCompleted' | 'notes.delete' | 'notes.clearCompleted' | 'config.set' | 'config.setPlatform' | 'config.setProviderRateLimitPolicy' | 'auth.startLogin' | 'auth.respondPrompt' | 'auth.cancelFlow' | 'auth.logout' | 'auth.syncGateway' | 'auth.upsertCustomProvider' | 'auth.removeCustomProvider' | 'hooks.create' | 'hooks.update' | 'hooks.setEnabled' | 'hooks.remove' | 'hooks.test' | 'profiles.create' | 'profiles.update' | 'profiles.remove' | 'plugins.assign' | 'plugins.skillWrite' | 'plugins.skillCreate' | 'plugins.skillMove' | 'plugins.skillRemove' | 'plugins.create' | 'plugins.remove' | 'plugins.convertToPortable' | 'plugins.mcpWrite' | 'threadTemplates.validate' | 'threadTemplates.save' | 'threadTemplates.remove' | 'system.restart' | 'system.clearRateLimit' | 'system.refreshUsage' | 'system.applyUpdate' | 'system.skipUpdate';
45
45
  export interface SubscribeFilter {
46
46
  events: string[];
47
47
  projectId?: string | null;
48
- /** Scope `execution.log` events to a single execution (B2-C live log stream). */
48
+ /** Scope execution-carrying events (agent.*) to a single execution. */
49
49
  executionId?: string | null;
50
50
  /** Scope `session.message` events to a single session (S4 chat live stream). REQUIRED for
51
51
  * `session.message.delta`: token-level previews are delivered to session-scoped subscriptions
@@ -57,10 +57,6 @@ export interface UiEvent {
57
57
  ts: string;
58
58
  payload: unknown;
59
59
  }
60
- /** Input for the `executions.log` subscription (B2-C). Parity-guarded in @cortex-agent/ui-contract. */
61
- export interface ExecutionsLogParams {
62
- executionId: string;
63
- }
64
60
  export interface SessionsListParams {
65
61
  projectId?: string;
66
62
  resumable?: boolean;
@@ -71,6 +67,9 @@ export interface SessionsListParams {
71
67
  export interface SessionsTranscriptParams {
72
68
  sessionId: string;
73
69
  compactSubagents?: boolean;
70
+ /** Cursor from a previous response's `cursor`. Compact reads only; a matching cursor is answered
71
+ * with a `delta` instead of the whole transcript. */
72
+ since?: string;
74
73
  }
75
74
  export interface SessionsSubagentTranscriptParams {
76
75
  sessionId: string;
@@ -147,6 +146,11 @@ export interface ExecutionsListParams {
147
146
  export interface ExecutionsGetParams {
148
147
  executionId: string;
149
148
  }
149
+ /** Waitpoints belonging to ONE session. Scoped server-side: the client cannot compute the match
150
+ * because SessionInfo carries no `channel` (see WaitpointInfo for the ownership rule). */
151
+ export interface WaitpointsListParams {
152
+ sessionId: string;
153
+ }
150
154
  export interface MemoryTreeParams {
151
155
  projectId: string;
152
156
  }
@@ -276,11 +280,28 @@ export interface SessionsCompactArgs {
276
280
  export interface SessionsMarkReadArgs {
277
281
  sessionId: string;
278
282
  }
283
+ /** Batch form of markRead: the client hands over the exact sessions it is showing as unread (the
284
+ * run list's「mark all read」), so the server never has to re-derive the set. */
285
+ export interface SessionsMarkManyReadArgs {
286
+ sessionIds: string[];
287
+ }
288
+ export interface SessionsMarkManyReadReturn {
289
+ /** How many of the requested sessions were stamped — ids that no longer resolve (purged runs)
290
+ * are skipped rather than failing the batch. */
291
+ marked: number;
292
+ }
279
293
  export interface SessionsSetProfileArgs {
280
294
  sessionId: string;
281
295
  /** The profile to switch the session to. Must exist in profiles.json. */
282
296
  profileName: string;
283
297
  }
298
+ export interface SessionsSetAgentArgs {
299
+ sessionId: string;
300
+ /** The agent template to run this session as — its execution environment. `null` (or an absent
301
+ * field, which the browser client sends instead — see `sessionsSetAgentInput`) hands the session
302
+ * back to the global default agent. */
303
+ agentName?: string | null;
304
+ }
284
305
  /** The part of a session's engine selection that came from the user rather than from its profile.
285
306
  * Every field is optional: a session may override only its thinking level, only its model, or any
286
307
  * mix. Backend is never here — it belongs to the profile (and a live conversation cannot change it). */
@@ -390,6 +411,9 @@ export interface SessionsCreateAndSendArgs {
390
411
  projectId: string;
391
412
  /** The profile to create the session with. Omitted → system default. */
392
413
  profileName?: string;
414
+ /** The agent template — the environment — the new session runs as. Omitted → whatever the
415
+ * global default agent is. Applied at creation, so the first turn already runs in it. */
416
+ agentName?: string;
393
417
  /** The model / provider / thinking the draft composer had selected on top of that profile.
394
418
  * Omitted (or empty) → the profile's own values: this call always comes from a composer, so
395
419
  * "nothing overridden" is a statement ("run the profile as declared"), not silence, and is
@@ -423,6 +447,9 @@ export interface ThreadsCancelArgs {
423
447
  export interface ExecutionsCancelArgs {
424
448
  executionId: string;
425
449
  }
450
+ export interface WaitpointsCancelArgs {
451
+ waitpointId: string;
452
+ }
426
453
  export interface ScheduleActionArgs {
427
454
  scheduleId: string;
428
455
  }
@@ -612,6 +639,10 @@ export interface SessionInfo {
612
639
  /** The session's active agent profile (registry record). Null when never explicitly set — the
613
640
  * client falls back to the config default. Kept in sync by the shared profile-switch rule. */
614
641
  profileName: string | null;
642
+ /** The agent template the session runs as — its environment (prompt, tools, skills, rules), the
643
+ * other half of "what will the next turn be". Null when the session follows its channel's
644
+ * selection and, beneath that, the global default. Kept in sync by the agent-switch rule. */
645
+ agentName?: string | null;
615
646
  /** What the user selected on top of that profile (model / provider / thinking), or null when the
616
647
  * session runs its profile as declared. The composer needs both halves to show what the next turn
617
648
  * will actually run; the profile alone would lie whenever a model was picked. */
@@ -649,6 +680,14 @@ export interface SessionInfo {
649
680
  * blue. False when nothing is pending, and false when the pending-interaction deps are absent
650
681
  * (fixtures / TUI). Snapshot-only, mirrored live via the `session.interaction` event stream. */
651
682
  awaitingInput: boolean;
683
+ /** How many waitpoints this session is still waiting on — external "wake me when X finishes"
684
+ * objects that are still `armed` (docs/waitpoints.md). Distinct from `awaitingInput`: that one
685
+ * means "blocked on YOU", this one means "blocked on a machine, nothing for you to do", which is
686
+ * why it must never drive the amber dot. Counted with the ownership union documented on
687
+ * WaitpointInfo (own sessionId OR own channel), deduped per waitpoint. 0 when nothing is pending
688
+ * and 0 when the waitpoint dep is absent (fixtures / TUI). Optional for rolling compatibility
689
+ * with older servers, like `totals` below — consumers read it as `?? 0`. */
690
+ waitingOn?: number;
652
691
  /** Real agent-turn count for the composer (NOT the number of user-message rounds). While running,
653
692
  * the live count of the in-flight turn (from the running execution); while idle, the last run's
654
693
  * final turn count (from the most recent non-thread execution on the session's channel). Null when
@@ -817,6 +856,18 @@ export interface TranscriptSubagentSummary {
817
856
  hasDetails: boolean;
818
857
  structurallyOpen: boolean;
819
858
  }
859
+ /** Rows that changed since a client's cursor, addressed by flat position across the transcript. */
860
+ export interface TranscriptDeltaRow {
861
+ /** Position in the flattened row stream (turns concatenated in order). */
862
+ index: number;
863
+ turnIndex: number;
864
+ message: TranscriptMessage;
865
+ }
866
+ export interface TranscriptDelta {
867
+ changed: TranscriptDeltaRow[];
868
+ /** Row count now. A client drops anything at or past it, which is how a rewind shortens. */
869
+ total: number;
870
+ }
820
871
  export interface SessionTranscript {
821
872
  sessionId: string;
822
873
  turns: TranscriptTurn[];
@@ -825,6 +876,12 @@ export interface SessionTranscript {
825
876
  pendingUserMessages?: PendingTranscriptUserMessage[];
826
877
  /** Compact opt-in only. Present even when empty; absent on full transcript responses. */
827
878
  subagentSummaries?: TranscriptSubagentSummary[];
879
+ /** Compact opt-in only. Pass back as `since` to get the next response as a delta. Absent when
880
+ * the server cannot serve deltas for this read. */
881
+ cursor?: string;
882
+ /** Present INSTEAD of a populated `turns` when the response answers a `since` cursor. A client
883
+ * that does not understand it must not send `since`. */
884
+ delta?: TranscriptDelta;
828
885
  }
829
886
  export interface SessionSubagentTranscript {
830
887
  sessionId: string;
@@ -871,20 +928,6 @@ export interface ThreadAgentFlow {
871
928
  sessionName: string | null;
872
929
  lastOutput: string | null;
873
930
  }
874
- export interface ThreadDispatchInfo {
875
- executionId: string;
876
- status: string;
877
- machine: string | null;
878
- type: 'local' | 'dispatch';
879
- agentSlotId: string | null;
880
- stepIndex: number | null;
881
- taskId: string | null;
882
- runName: string | null;
883
- startedAt: string;
884
- finishedAt: string | null;
885
- durationMs: number | null;
886
- cost: number | null;
887
- }
888
931
  export interface ThreadChildNode {
889
932
  id: string;
890
933
  templateName: string | null;
@@ -934,7 +977,6 @@ export interface ThreadDetail {
934
977
  totalCostUsd: number;
935
978
  steps: ThreadStepDetail[];
936
979
  agentFlow: ThreadAgentFlow | null;
937
- dispatches: ThreadDispatchInfo[];
938
980
  subtasks: ThreadSubtaskInfo[];
939
981
  children: ThreadChildNode[];
940
982
  artifacts: ThreadArtifactRefs;
@@ -1042,6 +1084,83 @@ export interface CommissionDecisionEntry {
1042
1084
  sessionId: string;
1043
1085
  item: DecisionItem;
1044
1086
  }
1087
+ /** One signal that has landed on a waitpoint. `message`/`member`/`source` are written by the
1088
+ * external process — plain text only, never interpreted. */
1089
+ export interface WaitpointSignalInfo {
1090
+ at: number;
1091
+ status: 'ok' | 'fail' | 'progress';
1092
+ member: string | null;
1093
+ message: string | null;
1094
+ source: string;
1095
+ }
1096
+ /** One waitpoint a session is still waiting on (docs/waitpoints.md). Only `armed` ones are returned:
1097
+ * a fired or expired waitpoint has already posted its own notice into the transcript, so repeating
1098
+ * it in a panel would tell the same story twice.
1099
+ *
1100
+ * OWNERSHIP — a waitpoint belongs to a session when EITHER holds:
1101
+ * `owner.sessionId === session.sessionId` the session armed it, or
1102
+ * `owner.channel === session's channel` the wake will be delivered HERE.
1103
+ * Both clauses are needed. The first survives a channel rebind (`bindChannel` does not rewrite
1104
+ * `record.channel`); the second survives the session being recreated (`!new`, a scheduled re-run),
1105
+ * because delivery is channel-addressed and find-or-creates a session. A consequence worth knowing:
1106
+ * the second clause can legitimately surface a waitpoint armed by an EARLIER session on the same
1107
+ * channel — that is honest, since its wake really will land on the current one.
1108
+ *
1109
+ * SECURITY: built field-by-field from the stored record, never by spreading it, so the capability
1110
+ * secret hash cannot leak by omission. `signals[].data` is deliberately absent — externally written
1111
+ * and capped at 16 KB per signal, it would bloat every list response. */
1112
+ export interface WaitpointInfo {
1113
+ /** `wp_<12 hex>` — public, appears in notices and in the signal command line. */
1114
+ id: string;
1115
+ /** Agent-written short name. */
1116
+ label: string;
1117
+ /** What the agent said it was waiting for, in its own words. */
1118
+ intent: string;
1119
+ /** Always `armed` today; the wider union is carried so the shape survives if settled waitpoints
1120
+ * are ever surfaced. */
1121
+ state: 'armed' | 'fired' | 'expired' | 'cancelled';
1122
+ /** Where the signal is expected from. `device` names the machine whose spool dir the sweep drains. */
1123
+ emitFrom: {
1124
+ kind: 'local';
1125
+ } | {
1126
+ kind: 'device';
1127
+ device: string;
1128
+ };
1129
+ /** Quorum progress. `got` counts distinct REPORTER KEYS, not signals: named members are deduped,
1130
+ * anonymous signals take synthetic slots. So `got` can exceed `members.length`, and a per-member
1131
+ * checklist must never be rendered from `members` alone. */
1132
+ quorum: {
1133
+ need: number;
1134
+ got: number;
1135
+ members: string[];
1136
+ };
1137
+ /** A single `fail` resolves it with the quorum unmet — which is why a resolved waitpoint can
1138
+ * legitimately read "1 of 3". */
1139
+ failFast: boolean;
1140
+ /** Mailbox mode. After each fire below `maxSignals` the quorum counter resets, so progress
1141
+ * appearing to go backwards is not a bug — `fires`/`maxSignals` is what disambiguates it. */
1142
+ fires: number;
1143
+ maxSignals: number;
1144
+ createdAt: number;
1145
+ expiresAt: number;
1146
+ /** Signals received so far, oldest first. Includes `progress` reports, which never resolve. */
1147
+ signals: WaitpointSignalInfo[];
1148
+ /** Delivery write-ahead bit. `pending && attempts > 1 && lastError` is the silent failure
1149
+ * "the signal landed but the wake did not, and it is being retried" — invisible everywhere else.
1150
+ * `lastError` is a locally generated message, not attacker input. */
1151
+ delivery: {
1152
+ pending: boolean;
1153
+ attempts: number;
1154
+ lastError: string | null;
1155
+ lastAt: number | null;
1156
+ };
1157
+ /** Wakes spent in the trailing hour, and the cap they are counted against. */
1158
+ wakesLastHour: number;
1159
+ wakeLimit: number;
1160
+ /** True once the rate limit has bitten: further signals are RECORDED BUT NEVER WAKE the session,
1161
+ * and the flag is never reset. The loudest thing this DTO carries. */
1162
+ rateLimited: boolean;
1163
+ }
1045
1164
  export interface ExecutionInfo {
1046
1165
  id: string;
1047
1166
  type: 'local' | 'dispatch';
@@ -1075,18 +1194,12 @@ export interface ExecutionDetailInfo {
1075
1194
  tmuxName: string | null;
1076
1195
  sessionName: string | null;
1077
1196
  scheduleTaskId: string | null;
1078
- /** cortex-run `--name`; non-null ⇒ a live `execution.log` stream is subscribable (B2-C 8b). */
1079
- runName: string | null;
1080
1197
  } | null;
1081
1198
  metrics: {
1082
1199
  costUsd: number | null;
1083
1200
  numTurns: number | null;
1084
1201
  durationS: number | null;
1085
1202
  };
1086
- gpu: {
1087
- indices: number[];
1088
- memoryMb: number | null;
1089
- } | null;
1090
1203
  text: {
1091
1204
  label: string | null;
1092
1205
  finalOutput: string | null;
@@ -1169,6 +1282,14 @@ export interface ConfigThreadTemplates {
1169
1282
  templates: string[];
1170
1283
  shells: string[];
1171
1284
  }
1285
+ /** One agent template as a picker needs it: what it is for, and which profile it pins (or
1286
+ * `__active__` — it runs whatever the conversation's own profile resolves to). Richer than
1287
+ * {@link ConfigThreadTemplates.agents}, which is the bare file listing the config editor uses. */
1288
+ export interface ConfigAgentEntry {
1289
+ name: string;
1290
+ description?: string;
1291
+ profile: string;
1292
+ }
1172
1293
  export interface ConfigEnvEntry {
1173
1294
  key: string;
1174
1295
  present: boolean;
@@ -1293,6 +1414,9 @@ export interface HooksTestReturn {
1293
1414
  * nobody has picked anything yet — the composer then falls back to the default profile. */
1294
1415
  export interface ConfigSelectionDefault extends SessionSelectionOverride {
1295
1416
  profileName?: string;
1417
+ /** The agent the last composer pick ran as — a draft opens in the environment the previous
1418
+ * conversation was working in, the same way it opens on its profile. */
1419
+ agentName?: string;
1296
1420
  }
1297
1421
  export interface ConfigSnapshot {
1298
1422
  platforms?: PlatformSettingsSnapshot[];
@@ -1301,6 +1425,9 @@ export interface ConfigSnapshot {
1301
1425
  machines: ConfigMachine[];
1302
1426
  mcp: ConfigMcp | null;
1303
1427
  threadTemplates: ConfigThreadTemplates;
1428
+ /** The agent templates a composer may pick from, with what each one is and pins. Always emitted
1429
+ * by current servers; optional while clients and servers roll independently. */
1430
+ agents?: ConfigAgentEntry[];
1304
1431
  hooks: ConfigHook[];
1305
1432
  env: ConfigEnvEntry[];
1306
1433
  /** Always emitted by current servers; optional while clients and servers roll independently. */
@@ -1352,7 +1479,7 @@ export interface MachineGpuProcess {
1352
1479
  memoryMb: number;
1353
1480
  }
1354
1481
  export interface MachineGpu {
1355
- /** CUDA device ordinal — the same index MachineLiveRun.gpuIndices refers to. */
1482
+ /** CUDA device ordinal. */
1356
1483
  index: number;
1357
1484
  name: string;
1358
1485
  utilPercent: number;
@@ -1377,10 +1504,7 @@ export interface MachineVitals {
1377
1504
  export interface MachineLiveRun {
1378
1505
  executionId: string;
1379
1506
  taskId: string | null;
1380
- runName: string | null;
1381
1507
  project: string | null;
1382
- /** GPU ordinals the run actually acquired (recorded by the client watcher); [] when unknown. */
1383
- gpuIndices: number[];
1384
1508
  startedAt: string | null;
1385
1509
  }
1386
1510
  export interface MachineDetail {
@@ -1699,10 +1823,10 @@ export interface MemoryFileEntry {
1699
1823
  }
1700
1824
  export interface MemoryDirEntry {
1701
1825
  name: string;
1702
- /** Number of `*.md` entry files, excluding the auto-generated `index.md` and `CORTEX.md`. */
1826
+ /** Number of `*.md` entry files, excluding the auto-generated `index.md` and `AGENTS.md`. */
1703
1827
  entryCount: number;
1704
1828
  /**
1705
- * The dir's `*.md` entry files (same filter as `entryCount` — excludes `index.md` / `CORTEX.md`),
1829
+ * The dir's `*.md` entry files (same filter as `entryCount` — excludes `index.md` / `AGENTS.md`),
1706
1830
  * sorted by name. Lets a client enumerate + open the files under each memory dir (mobile 1j
1707
1831
  * accordion) without a second round-trip. `entryCount === entries.length`.
1708
1832
  */
@@ -1800,6 +1924,8 @@ export interface IssueInfo {
1800
1924
  body: string;
1801
1925
  }
1802
1926
  export type NoteInfo = ProjectNote;
1927
+ import type { RebuildProgress as DaemonRebuildProgress, RebuildStepState as DaemonRebuildStep, RebuildStepName as DaemonRebuildStepName, RebuildStepStatus as DaemonRebuildStepStatus, RebuildStatus as DaemonRebuildStatus } from '../../core/rebuild-progress.js';
1928
+ export type { DaemonRebuildProgress, DaemonRebuildStep, DaemonRebuildStepName, DaemonRebuildStepStatus, DaemonRebuildStatus, };
1803
1929
  export interface DaemonProcessInfo {
1804
1930
  name: string;
1805
1931
  label: string;
@@ -1815,6 +1941,10 @@ export interface SystemDaemonStatus {
1815
1941
  at: string | null;
1816
1942
  reason: string | null;
1817
1943
  };
1944
+ /** The supervisor's hot-rebuild pipeline: the run in flight, or the last one it finished. Null
1945
+ * when no rebuild has run (production installs never rebuild) or when the record belongs to a
1946
+ * supervisor that is no longer alive. */
1947
+ rebuild: DaemonRebuildProgress | null;
1818
1948
  }
1819
1949
  export type SystemNoticesParams = {
1820
1950
  limit?: number;
@@ -1916,6 +2046,15 @@ export interface SessionsSetProfileReturn {
1916
2046
  /** True when the switch moved to a different backend (only possible on a session with no history). */
1917
2047
  backendChanged: boolean;
1918
2048
  }
2049
+ export interface SessionsSetAgentReturn {
2050
+ /** The agent now selected for the session; null when it follows the global default again. */
2051
+ agentName: string | null;
2052
+ /** The profile that agent will run under — its own when it pins one, the channel's otherwise.
2053
+ * For display: the switch never writes the channel's profile. */
2054
+ profileName: string;
2055
+ /** True when the switch moved to a different backend (only possible on a session with no history). */
2056
+ backendChanged: boolean;
2057
+ }
1919
2058
  /** What the session will run on its next turn, after the change — effective values, so the client
1920
2059
  * can render the chip without re-deriving the profile/override layering. */
1921
2060
  export interface SessionsSetSelectionReturn {
@@ -1943,6 +2082,11 @@ export interface ThreadsCancelReturn {
1943
2082
  export interface ExecutionsCancelReturn {
1944
2083
  cancelled: boolean;
1945
2084
  }
2085
+ export interface WaitpointsCancelReturn {
2086
+ cancelled: boolean;
2087
+ /** The state that blocked the cancel when `cancelled` is false (already fired/expired/cancelled). */
2088
+ state: string | null;
2089
+ }
1946
2090
  export interface ConfigSetReturn {
1947
2091
  written: true;
1948
2092
  section: 'budget' | 'profiles' | 'settings' | 'preferences';
@@ -1991,6 +2135,7 @@ export interface QueryParamMap {
1991
2135
  'commissions.get': CommissionsGetParams;
1992
2136
  'commissions.decisions': CommissionsDecisionsParams;
1993
2137
  'executions.list': ExecutionsListParams;
2138
+ 'waitpoints.list': WaitpointsListParams;
1994
2139
  'executions.get': ExecutionsGetParams;
1995
2140
  'memory.tree': MemoryTreeParams;
1996
2141
  'memory.file': MemoryFileParams;
@@ -2034,6 +2179,7 @@ export interface QueryReturnMap {
2034
2179
  'commissions.get': CommissionInfo;
2035
2180
  'commissions.decisions': CommissionDecisionEntry[];
2036
2181
  'executions.list': ExecutionInfo[];
2182
+ 'waitpoints.list': WaitpointInfo[];
2037
2183
  'executions.get': ExecutionDetailInfo;
2038
2184
  'memory.tree': MemoryTree;
2039
2185
  'memory.file': MemoryFile;
@@ -2068,10 +2214,12 @@ export interface MutateArgsMap {
2068
2214
  'sessions.cancel': SessionsCancelArgs;
2069
2215
  'sessions.compact': SessionsCompactArgs;
2070
2216
  'sessions.setProfile': SessionsSetProfileArgs;
2217
+ 'sessions.setAgent': SessionsSetAgentArgs;
2071
2218
  'sessions.setSelection': SessionsSetSelectionArgs;
2072
2219
  'sessions.setCommission': SessionsSetCommissionArgs;
2073
2220
  'sessions.createAndSend': SessionsCreateAndSendArgs;
2074
2221
  'sessions.markRead': SessionsMarkReadArgs;
2222
+ 'sessions.markManyRead': SessionsMarkManyReadArgs;
2075
2223
  'sessions.answerQuestion': SessionsAnswerQuestionArgs;
2076
2224
  'sessions.respondPlan': SessionsRespondPlanArgs;
2077
2225
  'sessions.respondDecision': SessionsRespondDecisionArgs;
@@ -2079,6 +2227,7 @@ export interface MutateArgsMap {
2079
2227
  'sessions.rewind': SessionsRewindArgs;
2080
2228
  'threads.cancel': ThreadsCancelArgs;
2081
2229
  'executions.cancel': ExecutionsCancelArgs;
2230
+ 'waitpoints.cancel': WaitpointsCancelArgs;
2082
2231
  'schedules.pause': ScheduleActionArgs;
2083
2232
  'schedules.resume': ScheduleActionArgs;
2084
2233
  'schedules.remove': ScheduleActionArgs;
@@ -2143,10 +2292,12 @@ export interface MutateReturnMap {
2143
2292
  'sessions.cancel': SessionsCancelReturn;
2144
2293
  'sessions.compact': SessionsCompactReturn;
2145
2294
  'sessions.setProfile': SessionsSetProfileReturn;
2295
+ 'sessions.setAgent': SessionsSetAgentReturn;
2146
2296
  'sessions.setSelection': SessionsSetSelectionReturn;
2147
2297
  'sessions.setCommission': SessionsSetCommissionReturn;
2148
2298
  'sessions.createAndSend': SessionsCreateAndSendReturn;
2149
2299
  'sessions.markRead': void;
2300
+ 'sessions.markManyRead': SessionsMarkManyReadReturn;
2150
2301
  'sessions.answerQuestion': SessionsInteractionMutateReturn;
2151
2302
  'sessions.respondPlan': SessionsInteractionMutateReturn;
2152
2303
  'sessions.respondDecision': SessionsRespondDecisionReturn;
@@ -2154,6 +2305,7 @@ export interface MutateReturnMap {
2154
2305
  'sessions.rewind': SessionsRewindReturn;
2155
2306
  'threads.cancel': ThreadsCancelReturn;
2156
2307
  'executions.cancel': ExecutionsCancelReturn;
2308
+ 'waitpoints.cancel': WaitpointsCancelReturn;
2157
2309
  'schedules.pause': void;
2158
2310
  'schedules.resume': void;
2159
2311
  'schedules.remove': void;
@@ -2224,14 +2376,6 @@ export interface UiService {
2224
2376
  subscribe(filter: SubscribeFilter): AsyncIterable<UiEvent> & {
2225
2377
  close(): void;
2226
2378
  };
2227
- /**
2228
- * Live `execution.log` stream for one running execution (B2-C). Resolves the log location from
2229
- * the executionId, ref-counts the shared tailer (first subscriber starts it, last stops it), and
2230
- * delivers lines over the same bounded queue as `subscribe`. A closed stream when unresolvable.
2231
- */
2232
- subscribeExecutionLog(executionId: string): AsyncIterable<UiEvent> & {
2233
- close(): void;
2234
- };
2235
2379
  }
2236
2380
  export interface UiServiceDeps {
2237
2381
  /** Optional seams for deterministic authentication dispatch tests. */
@@ -2263,8 +2407,10 @@ export interface UiServiceDeps {
2263
2407
  * facade/test fixtures need not provide it (the handler no-ops when absent). */
2264
2408
  markRead?(sessionId: string): Promise<void>;
2265
2409
  };
2266
- /** Capability hint for sessions.list; execution revalidates inside orchestration. */
2267
- supportsSessionCompaction?: (session: Session) => boolean;
2410
+ /** Capability hint for sessions.list; execution revalidates inside orchestration. Narrowed to
2411
+ * the two fields the answer depends on so the list can answer it once per distinct profile
2412
+ * instead of once per row. */
2413
+ supportsSessionCompaction?: (session: Pick<Session, 'backend' | 'profileName'>) => boolean;
2268
2414
  /** Latest task-list snapshot for a session (in-memory registry). Optional so facade/test
2269
2415
  * fixtures need not provide it — absent means the session reports no task list. */
2270
2416
  getSessionTodos?: (sessionId: string) => TodoSnapshot | null;
@@ -2285,6 +2431,12 @@ export interface UiServiceDeps {
2285
2431
  includeToolDebug?: boolean;
2286
2432
  }): Promise<SessionHistory | null>;
2287
2433
  getCompactHistory?(sessionId: string): Promise<import('../../store/conversation-history-repo.js').CompactConversationHistory | null>;
2434
+ /** Compact history plus the cursor that makes the next read a delta. Optional: a store without
2435
+ * it simply never serves deltas. */
2436
+ getCompactHistoryAt?(sessionId: string): Promise<{
2437
+ value: import('../../store/conversation-history-repo.js').CompactConversationHistory | null;
2438
+ cursor: string;
2439
+ }>;
2288
2440
  getSubagentHistory?(sessionId: string, subagentId: string): Promise<import('../../store/conversation-history-repo.js').SubagentConversationHistory>;
2289
2441
  getToolDebugDetails?(sessionId: string, toolRef: string): Promise<TranscriptDebugDetails | null>;
2290
2442
  /** First user message text — used to title a label-less session in `sessions.list`. Optional so
@@ -2358,6 +2510,7 @@ export interface UiServiceDeps {
2358
2510
  projectId: string;
2359
2511
  sessionId?: string;
2360
2512
  profileName?: string | null;
2513
+ agentName?: string | null;
2361
2514
  selection?: SessionSelectionOverride | null;
2362
2515
  browser?: {
2363
2516
  device: string;
@@ -2413,6 +2566,25 @@ export interface UiServiceDeps {
2413
2566
  backendChanged: boolean;
2414
2567
  reason?: 'unknown-profile' | 'cross-backend-live-session';
2415
2568
  }>;
2569
+ /**
2570
+ * Switch the agent — the execution environment — a session's channel runs, under the shared
2571
+ * agent-switch rule (the same `switchChannelAgent` the Slack/Feishu `!agent` command uses). A
2572
+ * null name clears the channel's selection. Wired in the entry layer (app.ts) for the same reason
2573
+ * as the profile switch above: the ui-service domain never imports domain/agents.
2574
+ */
2575
+ switchSessionAgent?: (opts: {
2576
+ channel: string;
2577
+ name: string | null;
2578
+ }) => Promise<{
2579
+ ok: boolean;
2580
+ agentName: string | null;
2581
+ /** The profile the agent will run under, for display. */
2582
+ effectiveProfile: string;
2583
+ backendChanged: boolean;
2584
+ reason?: 'unknown-agent' | 'cross-backend-live-session';
2585
+ currentBackend?: string;
2586
+ targetBackend?: string;
2587
+ }>;
2416
2588
  /**
2417
2589
  * Apply a session's engine selection (profile and/or model / provider / thinking) under the
2418
2590
  * shared rule — the domain `applyChannelSelection`, wired in the entry layer (app.ts) so the
@@ -2487,6 +2659,18 @@ export interface UiServiceDeps {
2487
2659
  getAll(): any[];
2488
2660
  cancelExecution(id: string, metrics?: any): any | null;
2489
2661
  };
2662
+ /** Waitpoint seam (`waitpoints.*` ops and SessionInfo.waitingOn). Injected at the entry layer so
2663
+ * the ui-service domain never reaches into the waitpoint store itself. Optional on purpose:
2664
+ * absent ⇒ no waitpoints and `waitingOn: 0`, so every existing fixture keeps working unchanged.
2665
+ * Only `armed` records are ever listed — settled ones have already announced themselves in the
2666
+ * session transcript. */
2667
+ waitpointRegistry?: {
2668
+ listArmed(): Promise<Waitpoint[]>;
2669
+ cancel(id: string): Promise<{
2670
+ cancelled: boolean;
2671
+ state?: string;
2672
+ }>;
2673
+ };
2490
2674
  /** Commission registry seam (commissions.* ops). Optional — handlers fall back to the
2491
2675
  * commissionRepo singleton when absent, so existing fixtures/entry wiring need no change;
2492
2676
  * tests inject it for determinism. */
@@ -2497,12 +2681,6 @@ export interface UiServiceDeps {
2497
2681
  };
2498
2682
  /** Absolute path to PENDING_APPROVALS.md (the approval-center 7a markdown queue). */
2499
2683
  approvalsPath: string;
2500
- /** Ref-counted live log tailer (B2-C). Started/stopped around each execution.log subscription. */
2501
- executionLogTailer: {
2502
- startTail(executionId: string, location: LogLocation): void;
2503
- stopTail(executionId: string): void;
2504
- refCount(executionId: string): number;
2505
- };
2506
2684
  /** The one busy answer (core/session-state.ts): sessions.list joins on it rather than
2507
2685
  * re-deriving "running" from the executions index and the hold registry separately. */
2508
2686
  runningExecutions: SessionStateReader;
@@ -1,5 +1,5 @@
1
1
  // input: domain, platform, auth and runtime setting types
2
2
  // output: canonical UI DTOs and operation signatures
3
3
  // pos: Transport-neutral UI service contract
4
- // >>> Once updated, update this header and parent CORTEX.md <<<
4
+ // >>> Once updated, update this header and parent AGENTS.md <<<
5
5
  export {};