@cortex-agent/server 2026.9.14 → 2026.9.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 (259) 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/hooks/{CORTEX.md → AGENTS.md} +1 -1
  6. package/defaults/hooks/{cortex-md-injector.mjs → agents-md-injector.mjs} +117 -26
  7. package/defaults/hooks/cortex-hook-api.mjs +2 -2
  8. package/defaults/hooks/new-session-hook.mjs +2 -2
  9. package/defaults/hooks/rules-loader.mjs +2 -2
  10. package/defaults/hooks/status-md-guard.mjs +8 -8
  11. package/defaults/hooks/task-status-check.mjs +18 -76
  12. package/defaults/hooks/tasks-yaml-guard.mjs +2 -2
  13. package/defaults/plugins/cortex-commission/.claude-plugin/plugin.json +2 -2
  14. package/defaults/plugins/cortex-commission/plugin.json +2 -2
  15. package/defaults/plugins/cortex-commission/skills/commission/SKILL.md +3 -3
  16. package/defaults/plugins/cortex-feishu/skills/feishu-doc/SKILL.md +1 -1
  17. package/defaults/plugins/cortex-system/skills/client-manage/SKILL.md +2 -2
  18. package/defaults/plugins/cortex-system/skills/project-init/SKILL.md +4 -4
  19. package/defaults/plugins/cortex-system/skills/task/SKILL.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 +0 -6
  25. package/dist/agent-adapter/claude/adapter.js +0 -8
  26. package/dist/agent-adapter/claude/defaults.d.ts +10 -7
  27. package/dist/agent-adapter/claude/defaults.js +18 -16
  28. package/dist/agent-adapter/claude/hooks-builder.js +2 -2
  29. package/dist/agent-adapter/claude/spawn-args.d.ts +0 -3
  30. package/dist/agent-adapter/claude/spawn-args.js +20 -16
  31. package/dist/agent-adapter/claude/turn-machine.d.ts +11 -0
  32. package/dist/agent-adapter/claude/turn-machine.js +46 -5
  33. package/dist/agent-adapter/normalize/prompt-builder.d.ts +16 -1
  34. package/dist/agent-adapter/normalize/prompt-builder.js +24 -6
  35. package/dist/agent-adapter/pi/mcp-bridge-logic.d.ts +11 -2
  36. package/dist/agent-adapter/pi/mcp-bridge-logic.js +32 -1
  37. package/dist/agent-adapter/pi/mcp-bridge.js +16 -15
  38. package/dist/agent-adapter/pi/session-options.d.ts +0 -6
  39. package/dist/agent-adapter/pi/session-options.js +1 -8
  40. package/dist/agent-adapter/types.d.ts +1 -1
  41. package/dist/core/mcp-tool-gate.d.ts +3 -17
  42. package/dist/core/mcp-tool-gate.js +4 -19
  43. package/dist/core/media-types.d.ts +10 -0
  44. package/dist/core/media-types.js +34 -0
  45. package/dist/core/platform-settings-spec.js +1 -1
  46. package/dist/core/settings-spec.d.ts +22 -1
  47. package/dist/core/settings-spec.js +33 -2
  48. package/dist/core/types/agent-types.d.ts +3 -1
  49. package/dist/core/utils.d.ts +1 -1
  50. package/dist/core/utils.js +1 -1
  51. package/dist/domain/agents/config.d.ts +1 -1
  52. package/dist/domain/agents/config.js +1 -1
  53. package/dist/domain/agents/profile-switch.d.ts +1 -1
  54. package/dist/domain/agents/profile-switch.js +3 -5
  55. package/dist/domain/agents/subagent/runner.js +0 -1
  56. package/dist/domain/commissions/commission-draft.d.ts +58 -0
  57. package/dist/domain/commissions/commission-draft.js +87 -4
  58. package/dist/domain/commissions/commission-finalize.d.ts +8 -3
  59. package/dist/domain/commissions/commission-finalize.js +14 -0
  60. package/dist/domain/executions/registry.d.ts +1 -2
  61. package/dist/domain/executions/registry.js +0 -3
  62. package/dist/domain/mcp/bundled-server.js +4 -3
  63. package/dist/domain/mcp/feishu/file.js +37 -18
  64. package/dist/domain/mcp/feishu/types.d.ts +3 -0
  65. package/dist/domain/mcp/feishu-server.js +1 -1
  66. package/dist/domain/mcp/tools/{cortex-md.d.ts → agents-md.d.ts} +6 -6
  67. package/dist/domain/mcp/tools/{cortex-md.js → agents-md.js} +6 -6
  68. package/dist/domain/mcp/tools/commission-tools.d.ts +12 -1
  69. package/dist/domain/mcp/tools/commission-tools.js +68 -14
  70. package/dist/domain/mcp/tools/remote-file.d.ts +20 -0
  71. package/dist/domain/mcp/tools/remote-file.js +44 -0
  72. package/dist/domain/mcp/tools/slack.d.ts +2 -0
  73. package/dist/domain/mcp/tools/slack.js +22 -7
  74. package/dist/domain/mcp/tools/task-ops.js +5 -13
  75. package/dist/domain/mcp/tools/ui-file.js +23 -10
  76. package/dist/domain/mcp/tools/waitpoint.d.ts +3 -0
  77. package/dist/domain/mcp/tools/waitpoint.js +122 -0
  78. package/dist/domain/memory/agents-md-injector.d.ts +24 -0
  79. package/dist/domain/memory/{cortex-md-injector.js → agents-md-injector.js} +10 -7
  80. package/dist/domain/projects/project-store.d.ts +1 -1
  81. package/dist/domain/projects/project-store.js +3 -3
  82. package/dist/domain/remote/client-hot-reload.js +3 -1
  83. package/dist/domain/remote/client-manager.js +105 -126
  84. package/dist/domain/remote/client-ssh-tunnel.d.ts +16 -5
  85. package/dist/domain/remote/client-ssh-tunnel.js +12 -5
  86. package/dist/domain/remote/cortex-client-config.d.ts +1 -1
  87. package/dist/domain/remote/cortex-client-config.js +1 -1
  88. package/dist/domain/remote/device-file.d.ts +51 -0
  89. package/dist/domain/remote/device-file.js +193 -0
  90. package/dist/domain/remote/device-port.js +3 -0
  91. package/dist/domain/remote/reverse-stream.d.ts +18 -7
  92. package/dist/domain/remote/reverse-stream.js +19 -6
  93. package/dist/domain/runs/builders.js +0 -1
  94. package/dist/domain/runs/compact.js +0 -1
  95. package/dist/domain/runs/engine-spec.d.ts +11 -4
  96. package/dist/domain/runs/engine-spec.js +7 -4
  97. package/dist/domain/runs/prompt.js +16 -10
  98. package/dist/domain/runs/request.d.ts +0 -1
  99. package/dist/domain/sessions/session-hooks.d.ts +5 -12
  100. package/dist/domain/sessions/session-hooks.js +6 -13
  101. package/dist/domain/sessions/session-lifecycle.d.ts +4 -4
  102. package/dist/domain/sessions/session-lifecycle.js +5 -6
  103. package/dist/domain/sessions/session-retention.d.ts +1 -3
  104. package/dist/domain/sessions/session-retention.js +9 -26
  105. package/dist/domain/sessions/session-use.d.ts +32 -0
  106. package/dist/domain/sessions/session-use.js +63 -0
  107. package/dist/domain/sessions/session.js +6 -5
  108. package/dist/domain/system/server-update-check.js +29 -1
  109. package/dist/domain/system/update-ui-state.d.ts +32 -0
  110. package/dist/domain/system/update-ui-state.js +63 -0
  111. package/dist/domain/tasks/claim-recovery.js +2 -2
  112. package/dist/domain/tasks/dispatch-utils.d.ts +10 -1
  113. package/dist/domain/tasks/dispatch-utils.js +46 -1
  114. package/dist/domain/tasks/dispatcher.js +4 -5
  115. package/dist/domain/tasks/mutator.d.ts +2 -2
  116. package/dist/domain/tasks/mutator.js +2 -2
  117. package/dist/domain/tasks/system/task-cli.js +2 -2
  118. package/dist/domain/tasks/system/task-state.js +1 -1
  119. package/dist/domain/threads/runner.js +3 -2
  120. package/dist/domain/ui-service/app-router.d.ts +54 -3
  121. package/dist/domain/ui-service/app-router.js +12 -14
  122. package/dist/domain/ui-service/input-schemas.d.ts +49 -5
  123. package/dist/domain/ui-service/input-schemas.js +35 -9
  124. package/dist/domain/ui-service/mutate/platform-settings.js +1 -1
  125. package/dist/domain/ui-service/mutate/sessions.d.ts +17 -1
  126. package/dist/domain/ui-service/mutate/sessions.js +83 -3
  127. package/dist/domain/ui-service/mutate/system.d.ts +3 -1
  128. package/dist/domain/ui-service/mutate/system.js +13 -0
  129. package/dist/domain/ui-service/mutate/waitpoints.d.ts +2 -0
  130. package/dist/domain/ui-service/mutate/waitpoints.js +20 -0
  131. package/dist/domain/ui-service/platform-settings.js +1 -1
  132. package/dist/domain/ui-service/plugins-shared.js +1 -1
  133. package/dist/domain/ui-service/query/config.js +1 -1
  134. package/dist/domain/ui-service/query/executions.js +0 -2
  135. package/dist/domain/ui-service/query/machine-detail.js +3 -8
  136. package/dist/domain/ui-service/query/memory.js +1 -1
  137. package/dist/domain/ui-service/query/sessions.js +7 -0
  138. package/dist/domain/ui-service/query/system.d.ts +2 -1
  139. package/dist/domain/ui-service/query/system.js +4 -0
  140. package/dist/domain/ui-service/query/threads.js +1 -54
  141. package/dist/domain/ui-service/query/waitpoints.d.ts +30 -0
  142. package/dist/domain/ui-service/query/waitpoints.js +117 -0
  143. package/dist/domain/ui-service/query-input-schemas.d.ts +3 -0
  144. package/dist/domain/ui-service/query-input-schemas.js +3 -0
  145. package/dist/domain/ui-service/trpc.js +1 -1
  146. package/dist/domain/ui-service/types.d.ts +175 -50
  147. package/dist/domain/ui-service/types.js +1 -1
  148. package/dist/domain/ui-service/ui-service.js +13 -33
  149. package/dist/domain/waitpoints/notices.d.ts +21 -0
  150. package/dist/domain/waitpoints/notices.js +115 -0
  151. package/dist/domain/waitpoints/service.d.ts +91 -0
  152. package/dist/domain/waitpoints/service.js +243 -0
  153. package/dist/entry/app.js +39 -29
  154. package/dist/entry/auth-login-cli.js +1 -1
  155. package/dist/entry/auth-login-terminal.js +1 -1
  156. package/dist/entry/init-auth.js +1 -1
  157. package/dist/entry/init.js +6 -6
  158. package/dist/entry/signal-cli.d.ts +30 -0
  159. package/dist/entry/signal-cli.js +207 -0
  160. package/dist/entry/start-ui-http.d.ts +1 -1
  161. package/dist/entry/start-ui-http.js +5 -3
  162. package/dist/events/event-types.d.ts +5 -7
  163. package/dist/hooks/{cortex-md-injector.mjs → agents-md-injector.mjs} +117 -26
  164. package/dist/hooks/cortex-hook-api.mjs +2 -2
  165. package/dist/hooks/new-session-hook.mjs +2 -2
  166. package/dist/hooks/rules-loader.mjs +2 -2
  167. package/dist/hooks/status-md-guard.mjs +8 -8
  168. package/dist/hooks/task-status-check.mjs +18 -76
  169. package/dist/hooks/tasks-yaml-guard.mjs +2 -2
  170. package/dist/orchestration/agent-file-send.d.ts +9 -0
  171. package/dist/orchestration/agent-file-send.js +21 -2
  172. package/dist/orchestration/agent-runner.d.ts +4 -3
  173. package/dist/orchestration/agent-runner.js +25 -23
  174. package/dist/orchestration/attachments-store.d.ts +31 -0
  175. package/dist/orchestration/attachments-store.js +184 -0
  176. package/dist/orchestration/conversation-request.d.ts +30 -8
  177. package/dist/orchestration/conversation-request.js +62 -26
  178. package/dist/orchestration/edit-retry.js +2 -1
  179. package/dist/orchestration/interactions/ask-user-resume.js +2 -1
  180. package/dist/orchestration/interactions/plan-approvals.js +1 -1
  181. package/dist/orchestration/interactions/ui-update-prompt.d.ts +8 -0
  182. package/dist/orchestration/interactions/ui-update-prompt.js +47 -0
  183. package/dist/orchestration/outputs-store.d.ts +11 -0
  184. package/dist/orchestration/outputs-store.js +32 -6
  185. package/dist/orchestration/resume-dispatcher.js +2 -2
  186. package/dist/orchestration/routing/file-handler.d.ts +23 -2
  187. package/dist/orchestration/routing/file-handler.js +22 -5
  188. package/dist/orchestration/routing/webhook.js +240 -39
  189. package/dist/orchestration/session-compact.d.ts +3 -0
  190. package/dist/orchestration/session-compact.js +3 -2
  191. package/dist/orchestration/session-events.d.ts +6 -0
  192. package/dist/orchestration/session-events.js +5 -0
  193. package/dist/orchestration/session-gateway.d.ts +1 -1
  194. package/dist/orchestration/session-gateway.js +1 -0
  195. package/dist/orchestration/thread-executor.d.ts +2 -0
  196. package/dist/orchestration/thread-executor.js +11 -1
  197. package/dist/orchestration/thread-input.d.ts +3 -2
  198. package/dist/orchestration/thread-input.js +8 -9
  199. package/dist/orchestration/turn/turn-prep.d.ts +15 -1
  200. package/dist/orchestration/turn/turn-prep.js +21 -9
  201. package/dist/orchestration/waitpoint-ingress.d.ts +41 -0
  202. package/dist/orchestration/waitpoint-ingress.js +172 -0
  203. package/dist/orchestration/waitpoint-notifier.d.ts +21 -0
  204. package/dist/orchestration/waitpoint-notifier.js +119 -0
  205. package/dist/orchestration/waitpoint-remote-drain.d.ts +20 -0
  206. package/dist/orchestration/waitpoint-remote-drain.js +147 -0
  207. package/dist/orchestration/waitpoint-sweep.d.ts +42 -0
  208. package/dist/orchestration/waitpoint-sweep.js +87 -0
  209. package/dist/platform/adapters/feishu-image.d.ts +19 -0
  210. package/dist/platform/adapters/feishu-image.js +71 -0
  211. package/dist/platform/adapters/feishu.d.ts +2 -0
  212. package/dist/platform/adapters/feishu.js +26 -16
  213. package/dist/platform/ui-http/app-update.d.ts +11 -0
  214. package/dist/platform/ui-http/app-update.js +3 -0
  215. package/dist/platform/ui-http/listening-ports.d.ts +1 -1
  216. package/dist/platform/ui-http/listening-ports.js +1 -1
  217. package/dist/platform/ui-http/ui-session.js +1 -1
  218. package/dist/store/conversation-ledger-repo.d.ts +10 -19
  219. package/dist/store/conversation-ledger-repo.js +143 -152
  220. package/dist/store/execution-repo.d.ts +1 -19
  221. package/dist/store/execution-repo.js +1 -18
  222. package/dist/store/project-notes-repo.js +11 -2
  223. package/dist/store/prompt-migration-replacements.js +1 -1
  224. package/dist/store/session-registry-import.d.ts +34 -0
  225. package/dist/store/session-registry-import.js +182 -0
  226. package/dist/store/session-registry-journal.d.ts +107 -0
  227. package/dist/store/session-registry-journal.js +308 -19
  228. package/dist/store/session-registry-repo.d.ts +113 -28
  229. package/dist/store/session-registry-repo.js +288 -105
  230. package/dist/store/version-migrations.d.ts +29 -3
  231. package/dist/store/version-migrations.js +288 -24
  232. package/dist/store/waitpoint-repo.d.ts +108 -0
  233. package/dist/store/waitpoint-repo.js +94 -0
  234. package/package.json +2 -2
  235. package/web/dist/assets/index-CwwQNMpP.css +1 -0
  236. package/web/dist/assets/index-DLSfgq3o.js +444 -0
  237. package/web/dist/assets/{index-aHbOZSP6.js → index-DZTuqUO4.js} +1 -1
  238. package/web/dist/index.html +2 -2
  239. package/defaults/config/hooks/08-cortex-md-injector-post-tool.json +0 -10
  240. package/dist/domain/executions/log-tailer.d.ts +0 -71
  241. package/dist/domain/executions/log-tailer.js +0 -194
  242. package/dist/domain/memory/cortex-md-injector.d.ts +0 -24
  243. package/dist/domain/memory/cortex-md-scanner.d.ts +0 -10
  244. package/dist/domain/memory/cortex-md-scanner.js +0 -66
  245. package/dist/domain/remote/cortex-client.d.ts +0 -1
  246. package/dist/domain/remote/cortex-client.js +0 -662
  247. package/dist/domain/tasks/system/cortex-run.d.ts +0 -25
  248. package/dist/domain/tasks/system/cortex-run.js +0 -360
  249. package/dist/store/session-repo.d.ts +0 -65
  250. package/dist/store/session-repo.js +0 -184
  251. package/web/dist/assets/index-BuXbCsuz.js +0 -444
  252. package/web/dist/assets/index-CCPxQ94C.css +0 -1
  253. /package/defaults/{CORTEX.md → AGENTS.md} +0 -0
  254. /package/defaults/config/{CORTEX.md → AGENTS.md} +0 -0
  255. /package/defaults/context/{CORTEX.md → AGENTS.md} +0 -0
  256. /package/defaults/context/ideas/{CORTEX.md → AGENTS.md} +0 -0
  257. /package/defaults/context/projects/{CORTEX.md → AGENTS.md} +0 -0
  258. /package/defaults/context/scans/{CORTEX.md → AGENTS.md} +0 -0
  259. /package/defaults/context/user/{CORTEX.md → AGENTS.md} +0 -0
@@ -4,6 +4,8 @@ import type { Project, CreateProjectResult } from '../projects/index.js';
4
4
  import type { CostSummary } from '../costs/cost-tracker.js';
5
5
  import type { ProviderUsage } from '../costs/usage-store.js';
6
6
  export type { ProviderUsage, UsageBilling, UsageFreshness, UsageWindow } from '../costs/usage-store.js';
7
+ import type { ServerUpdateStatus } from '../system/update-ui-state.js';
8
+ export type { ServerUpdateState, ServerUpdateStatus } from '../system/update-ui-state.js';
7
9
  import type { EventBus } from '../../events/index.js';
8
10
  import type { SessionStateReader } from '../../core/session-state.js';
9
11
  import type { Settings, SettingSnapshotEntry } from '../../core/settings-spec.js';
@@ -15,11 +17,11 @@ import type { HookBackend, HookEvent, HookFilterValue, HookPhase, HookResultMode
15
17
  import type { HookApplyTime, HookMountTarget } from '../hooks/hook-view.js';
16
18
  export type { HookApplyTime, HookMountTarget } from '../hooks/hook-view.js';
17
19
  import type { Session } from '../../store/session-registry-repo.js';
20
+ import type { Waitpoint } from '../../store/waitpoint-repo.js';
18
21
  import type { SessionTotals } from '../../store/session-totals.js';
19
22
  export type { SessionTotals } from '../../store/session-totals.js';
20
23
  import type { ScheduleTask, ScheduleTarget } from '../../store/schedule-repo.js';
21
24
  import type { CommissionRecord } from '../../store/commission-repo.js';
22
- import type { LogLocation } from '../executions/log-tailer.js';
23
25
  import type { SessionHistory } from '../../store/conversation-history-repo.js';
24
26
  import type { Backend } from '../../agent-adapter/types.js';
25
27
  import type { ProjectNote } from '../../store/project-notes-repo.js';
@@ -38,12 +40,12 @@ export type Err = {
38
40
  message: string;
39
41
  };
40
42
  export type Result<T> = Ok<T> | Err;
41
- 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';
42
- export type MutateOp = 'projects.create' | 'sessions.create' | 'sessions.send' | 'sessions.cancel' | 'sessions.compact' | 'sessions.setProfile' | 'sessions.setSelection' | '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';
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.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';
43
45
  export interface SubscribeFilter {
44
46
  events: string[];
45
47
  projectId?: string | null;
46
- /** Scope `execution.log` events to a single execution (B2-C live log stream). */
48
+ /** Scope execution-carrying events (agent.*) to a single execution. */
47
49
  executionId?: string | null;
48
50
  /** Scope `session.message` events to a single session (S4 chat live stream). REQUIRED for
49
51
  * `session.message.delta`: token-level previews are delivered to session-scoped subscriptions
@@ -55,10 +57,6 @@ export interface UiEvent {
55
57
  ts: string;
56
58
  payload: unknown;
57
59
  }
58
- /** Input for the `executions.log` subscription (B2-C). Parity-guarded in @cortex-agent/ui-contract. */
59
- export interface ExecutionsLogParams {
60
- executionId: string;
61
- }
62
60
  export interface SessionsListParams {
63
61
  projectId?: string;
64
62
  resumable?: boolean;
@@ -145,6 +143,11 @@ export interface ExecutionsListParams {
145
143
  export interface ExecutionsGetParams {
146
144
  executionId: string;
147
145
  }
146
+ /** Waitpoints belonging to ONE session. Scoped server-side: the client cannot compute the match
147
+ * because SessionInfo carries no `channel` (see WaitpointInfo for the ownership rule). */
148
+ export interface WaitpointsListParams {
149
+ sessionId: string;
150
+ }
148
151
  export interface MemoryTreeParams {
149
152
  projectId: string;
150
153
  }
@@ -274,6 +277,16 @@ export interface SessionsCompactArgs {
274
277
  export interface SessionsMarkReadArgs {
275
278
  sessionId: string;
276
279
  }
280
+ /** Batch form of markRead: the client hands over the exact sessions it is showing as unread (the
281
+ * run list's「mark all read」), so the server never has to re-derive the set. */
282
+ export interface SessionsMarkManyReadArgs {
283
+ sessionIds: string[];
284
+ }
285
+ export interface SessionsMarkManyReadReturn {
286
+ /** How many of the requested sessions were stamped — ids that no longer resolve (purged runs)
287
+ * are skipped rather than failing the batch. */
288
+ marked: number;
289
+ }
277
290
  export interface SessionsSetProfileArgs {
278
291
  sessionId: string;
279
292
  /** The profile to switch the session to. Must exist in profiles.json. */
@@ -297,6 +310,28 @@ export interface SessionSelectionOverride {
297
310
  * Naming a profile without naming anything else means "run this profile as declared", which drops
298
311
  * the session's earlier model/thinking choices.
299
312
  */
313
+ /** Move a live session in or out of commission mode. `new` starts a contract draft, `join` attaches
314
+ * to a landed commission, `off` leaves the drafting phase. A session already bound to a commission
315
+ * is terminal and refuses every transition. */
316
+ export interface SessionsSetCommissionArgs {
317
+ sessionId: string;
318
+ commission: {
319
+ mode: 'off';
320
+ } | {
321
+ mode: 'new';
322
+ } | {
323
+ mode: 'join';
324
+ commissionId: string;
325
+ };
326
+ }
327
+ export interface SessionsSetCommissionReturn {
328
+ /** The session's state after the call: which half of the mode it is in, if any. */
329
+ phase: 'none' | 'draft' | 'active';
330
+ commissionId: string | null;
331
+ commissionDraft: string | null;
332
+ /** True when leaving also deleted an untouched draft directory. */
333
+ removedDraftDir?: boolean;
334
+ }
300
335
  export interface SessionsSetSelectionArgs {
301
336
  sessionId: string;
302
337
  profileName?: string;
@@ -399,6 +434,9 @@ export interface ThreadsCancelArgs {
399
434
  export interface ExecutionsCancelArgs {
400
435
  executionId: string;
401
436
  }
437
+ export interface WaitpointsCancelArgs {
438
+ waitpointId: string;
439
+ }
402
440
  export interface ScheduleActionArgs {
403
441
  scheduleId: string;
404
442
  }
@@ -625,6 +663,14 @@ export interface SessionInfo {
625
663
  * blue. False when nothing is pending, and false when the pending-interaction deps are absent
626
664
  * (fixtures / TUI). Snapshot-only, mirrored live via the `session.interaction` event stream. */
627
665
  awaitingInput: boolean;
666
+ /** How many waitpoints this session is still waiting on — external "wake me when X finishes"
667
+ * objects that are still `armed` (docs/waitpoints.md). Distinct from `awaitingInput`: that one
668
+ * means "blocked on YOU", this one means "blocked on a machine, nothing for you to do", which is
669
+ * why it must never drive the amber dot. Counted with the ownership union documented on
670
+ * WaitpointInfo (own sessionId OR own channel), deduped per waitpoint. 0 when nothing is pending
671
+ * and 0 when the waitpoint dep is absent (fixtures / TUI). Optional for rolling compatibility
672
+ * with older servers, like `totals` below — consumers read it as `?? 0`. */
673
+ waitingOn?: number;
628
674
  /** Real agent-turn count for the composer (NOT the number of user-message rounds). While running,
629
675
  * the live count of the in-flight turn (from the running execution); while idle, the last run's
630
676
  * final turn count (from the most recent non-thread execution on the session's channel). Null when
@@ -847,20 +893,6 @@ export interface ThreadAgentFlow {
847
893
  sessionName: string | null;
848
894
  lastOutput: string | null;
849
895
  }
850
- export interface ThreadDispatchInfo {
851
- executionId: string;
852
- status: string;
853
- machine: string | null;
854
- type: 'local' | 'dispatch';
855
- agentSlotId: string | null;
856
- stepIndex: number | null;
857
- taskId: string | null;
858
- runName: string | null;
859
- startedAt: string;
860
- finishedAt: string | null;
861
- durationMs: number | null;
862
- cost: number | null;
863
- }
864
896
  export interface ThreadChildNode {
865
897
  id: string;
866
898
  templateName: string | null;
@@ -910,7 +942,6 @@ export interface ThreadDetail {
910
942
  totalCostUsd: number;
911
943
  steps: ThreadStepDetail[];
912
944
  agentFlow: ThreadAgentFlow | null;
913
- dispatches: ThreadDispatchInfo[];
914
945
  subtasks: ThreadSubtaskInfo[];
915
946
  children: ThreadChildNode[];
916
947
  artifacts: ThreadArtifactRefs;
@@ -1018,6 +1049,83 @@ export interface CommissionDecisionEntry {
1018
1049
  sessionId: string;
1019
1050
  item: DecisionItem;
1020
1051
  }
1052
+ /** One signal that has landed on a waitpoint. `message`/`member`/`source` are written by the
1053
+ * external process — plain text only, never interpreted. */
1054
+ export interface WaitpointSignalInfo {
1055
+ at: number;
1056
+ status: 'ok' | 'fail' | 'progress';
1057
+ member: string | null;
1058
+ message: string | null;
1059
+ source: string;
1060
+ }
1061
+ /** One waitpoint a session is still waiting on (docs/waitpoints.md). Only `armed` ones are returned:
1062
+ * a fired or expired waitpoint has already posted its own notice into the transcript, so repeating
1063
+ * it in a panel would tell the same story twice.
1064
+ *
1065
+ * OWNERSHIP — a waitpoint belongs to a session when EITHER holds:
1066
+ * `owner.sessionId === session.sessionId` the session armed it, or
1067
+ * `owner.channel === session's channel` the wake will be delivered HERE.
1068
+ * Both clauses are needed. The first survives a channel rebind (`bindChannel` does not rewrite
1069
+ * `record.channel`); the second survives the session being recreated (`!new`, a scheduled re-run),
1070
+ * because delivery is channel-addressed and find-or-creates a session. A consequence worth knowing:
1071
+ * the second clause can legitimately surface a waitpoint armed by an EARLIER session on the same
1072
+ * channel — that is honest, since its wake really will land on the current one.
1073
+ *
1074
+ * SECURITY: built field-by-field from the stored record, never by spreading it, so the capability
1075
+ * secret hash cannot leak by omission. `signals[].data` is deliberately absent — externally written
1076
+ * and capped at 16 KB per signal, it would bloat every list response. */
1077
+ export interface WaitpointInfo {
1078
+ /** `wp_<12 hex>` — public, appears in notices and in the signal command line. */
1079
+ id: string;
1080
+ /** Agent-written short name. */
1081
+ label: string;
1082
+ /** What the agent said it was waiting for, in its own words. */
1083
+ intent: string;
1084
+ /** Always `armed` today; the wider union is carried so the shape survives if settled waitpoints
1085
+ * are ever surfaced. */
1086
+ state: 'armed' | 'fired' | 'expired' | 'cancelled';
1087
+ /** Where the signal is expected from. `device` names the machine whose spool dir the sweep drains. */
1088
+ emitFrom: {
1089
+ kind: 'local';
1090
+ } | {
1091
+ kind: 'device';
1092
+ device: string;
1093
+ };
1094
+ /** Quorum progress. `got` counts distinct REPORTER KEYS, not signals: named members are deduped,
1095
+ * anonymous signals take synthetic slots. So `got` can exceed `members.length`, and a per-member
1096
+ * checklist must never be rendered from `members` alone. */
1097
+ quorum: {
1098
+ need: number;
1099
+ got: number;
1100
+ members: string[];
1101
+ };
1102
+ /** A single `fail` resolves it with the quorum unmet — which is why a resolved waitpoint can
1103
+ * legitimately read "1 of 3". */
1104
+ failFast: boolean;
1105
+ /** Mailbox mode. After each fire below `maxSignals` the quorum counter resets, so progress
1106
+ * appearing to go backwards is not a bug — `fires`/`maxSignals` is what disambiguates it. */
1107
+ fires: number;
1108
+ maxSignals: number;
1109
+ createdAt: number;
1110
+ expiresAt: number;
1111
+ /** Signals received so far, oldest first. Includes `progress` reports, which never resolve. */
1112
+ signals: WaitpointSignalInfo[];
1113
+ /** Delivery write-ahead bit. `pending && attempts > 1 && lastError` is the silent failure
1114
+ * "the signal landed but the wake did not, and it is being retried" — invisible everywhere else.
1115
+ * `lastError` is a locally generated message, not attacker input. */
1116
+ delivery: {
1117
+ pending: boolean;
1118
+ attempts: number;
1119
+ lastError: string | null;
1120
+ lastAt: number | null;
1121
+ };
1122
+ /** Wakes spent in the trailing hour, and the cap they are counted against. */
1123
+ wakesLastHour: number;
1124
+ wakeLimit: number;
1125
+ /** True once the rate limit has bitten: further signals are RECORDED BUT NEVER WAKE the session,
1126
+ * and the flag is never reset. The loudest thing this DTO carries. */
1127
+ rateLimited: boolean;
1128
+ }
1021
1129
  export interface ExecutionInfo {
1022
1130
  id: string;
1023
1131
  type: 'local' | 'dispatch';
@@ -1051,18 +1159,12 @@ export interface ExecutionDetailInfo {
1051
1159
  tmuxName: string | null;
1052
1160
  sessionName: string | null;
1053
1161
  scheduleTaskId: string | null;
1054
- /** cortex-run `--name`; non-null ⇒ a live `execution.log` stream is subscribable (B2-C 8b). */
1055
- runName: string | null;
1056
1162
  } | null;
1057
1163
  metrics: {
1058
1164
  costUsd: number | null;
1059
1165
  numTurns: number | null;
1060
1166
  durationS: number | null;
1061
1167
  };
1062
- gpu: {
1063
- indices: number[];
1064
- memoryMb: number | null;
1065
- } | null;
1066
1168
  text: {
1067
1169
  label: string | null;
1068
1170
  finalOutput: string | null;
@@ -1328,7 +1430,7 @@ export interface MachineGpuProcess {
1328
1430
  memoryMb: number;
1329
1431
  }
1330
1432
  export interface MachineGpu {
1331
- /** CUDA device ordinal — the same index MachineLiveRun.gpuIndices refers to. */
1433
+ /** CUDA device ordinal. */
1332
1434
  index: number;
1333
1435
  name: string;
1334
1436
  utilPercent: number;
@@ -1353,10 +1455,7 @@ export interface MachineVitals {
1353
1455
  export interface MachineLiveRun {
1354
1456
  executionId: string;
1355
1457
  taskId: string | null;
1356
- runName: string | null;
1357
1458
  project: string | null;
1358
- /** GPU ordinals the run actually acquired (recorded by the client watcher); [] when unknown. */
1359
- gpuIndices: number[];
1360
1459
  startedAt: string | null;
1361
1460
  }
1362
1461
  export interface MachineDetail {
@@ -1675,10 +1774,10 @@ export interface MemoryFileEntry {
1675
1774
  }
1676
1775
  export interface MemoryDirEntry {
1677
1776
  name: string;
1678
- /** Number of `*.md` entry files, excluding the auto-generated `index.md` and `CORTEX.md`. */
1777
+ /** Number of `*.md` entry files, excluding the auto-generated `index.md` and `AGENTS.md`. */
1679
1778
  entryCount: number;
1680
1779
  /**
1681
- * The dir's `*.md` entry files (same filter as `entryCount` — excludes `index.md` / `CORTEX.md`),
1780
+ * The dir's `*.md` entry files (same filter as `entryCount` — excludes `index.md` / `AGENTS.md`),
1682
1781
  * sorted by name. Lets a client enumerate + open the files under each memory dir (mobile 1j
1683
1782
  * accordion) without a second round-trip. `entryCount === entries.length`.
1684
1783
  */
@@ -1834,6 +1933,15 @@ export interface SystemRestartReturn {
1834
1933
  ok: boolean;
1835
1934
  message: string;
1836
1935
  }
1936
+ export type SystemUpdateStatusParams = Record<string, never>;
1937
+ export type SystemUpdateStatus = ServerUpdateStatus;
1938
+ export type SystemApplyUpdateArgs = Record<string, never>;
1939
+ export type SystemSkipUpdateArgs = Record<string, never>;
1940
+ export interface SystemUpdateDecisionReturn {
1941
+ /** false when no prompt was pending — a stale dialog whose answer arrived too late. */
1942
+ accepted: boolean;
1943
+ status: SystemUpdateStatus;
1944
+ }
1837
1945
  export interface SystemClearRateLimitArgs {
1838
1946
  /** Provider key to clear; omit to clear every throttled provider. */
1839
1947
  provider?: string;
@@ -1910,6 +2018,11 @@ export interface ThreadsCancelReturn {
1910
2018
  export interface ExecutionsCancelReturn {
1911
2019
  cancelled: boolean;
1912
2020
  }
2021
+ export interface WaitpointsCancelReturn {
2022
+ cancelled: boolean;
2023
+ /** The state that blocked the cancel when `cancelled` is false (already fired/expired/cancelled). */
2024
+ state: string | null;
2025
+ }
1913
2026
  export interface ConfigSetReturn {
1914
2027
  written: true;
1915
2028
  section: 'budget' | 'profiles' | 'settings' | 'preferences';
@@ -1958,6 +2071,7 @@ export interface QueryParamMap {
1958
2071
  'commissions.get': CommissionsGetParams;
1959
2072
  'commissions.decisions': CommissionsDecisionsParams;
1960
2073
  'executions.list': ExecutionsListParams;
2074
+ 'waitpoints.list': WaitpointsListParams;
1961
2075
  'executions.get': ExecutionsGetParams;
1962
2076
  'memory.tree': MemoryTreeParams;
1963
2077
  'memory.file': MemoryFileParams;
@@ -1983,6 +2097,7 @@ export interface QueryParamMap {
1983
2097
  'system.rateLimitStatus': SystemRateLimitStatusParams;
1984
2098
  'system.usageStatus': SystemUsageStatusParams;
1985
2099
  'system.notices': SystemNoticesParams;
2100
+ 'system.updateStatus': SystemUpdateStatusParams;
1986
2101
  }
1987
2102
  export interface QueryReturnMap {
1988
2103
  'projects.list': ProjectConduitInfo[];
@@ -2000,6 +2115,7 @@ export interface QueryReturnMap {
2000
2115
  'commissions.get': CommissionInfo;
2001
2116
  'commissions.decisions': CommissionDecisionEntry[];
2002
2117
  'executions.list': ExecutionInfo[];
2118
+ 'waitpoints.list': WaitpointInfo[];
2003
2119
  'executions.get': ExecutionDetailInfo;
2004
2120
  'memory.tree': MemoryTree;
2005
2121
  'memory.file': MemoryFile;
@@ -2025,6 +2141,7 @@ export interface QueryReturnMap {
2025
2141
  'system.rateLimitStatus': SystemRateLimitStatus;
2026
2142
  'system.usageStatus': SystemUsageStatus;
2027
2143
  'system.notices': SystemNotices;
2144
+ 'system.updateStatus': SystemUpdateStatus;
2028
2145
  }
2029
2146
  export interface MutateArgsMap {
2030
2147
  'projects.create': ProjectCreateArgs;
@@ -2034,8 +2151,10 @@ export interface MutateArgsMap {
2034
2151
  'sessions.compact': SessionsCompactArgs;
2035
2152
  'sessions.setProfile': SessionsSetProfileArgs;
2036
2153
  'sessions.setSelection': SessionsSetSelectionArgs;
2154
+ 'sessions.setCommission': SessionsSetCommissionArgs;
2037
2155
  'sessions.createAndSend': SessionsCreateAndSendArgs;
2038
2156
  'sessions.markRead': SessionsMarkReadArgs;
2157
+ 'sessions.markManyRead': SessionsMarkManyReadArgs;
2039
2158
  'sessions.answerQuestion': SessionsAnswerQuestionArgs;
2040
2159
  'sessions.respondPlan': SessionsRespondPlanArgs;
2041
2160
  'sessions.respondDecision': SessionsRespondDecisionArgs;
@@ -2043,6 +2162,7 @@ export interface MutateArgsMap {
2043
2162
  'sessions.rewind': SessionsRewindArgs;
2044
2163
  'threads.cancel': ThreadsCancelArgs;
2045
2164
  'executions.cancel': ExecutionsCancelArgs;
2165
+ 'waitpoints.cancel': WaitpointsCancelArgs;
2046
2166
  'schedules.pause': ScheduleActionArgs;
2047
2167
  'schedules.resume': ScheduleActionArgs;
2048
2168
  'schedules.remove': ScheduleActionArgs;
@@ -2097,6 +2217,8 @@ export interface MutateArgsMap {
2097
2217
  'system.restart': SystemRestartArgs;
2098
2218
  'system.clearRateLimit': SystemClearRateLimitArgs;
2099
2219
  'system.refreshUsage': SystemRefreshUsageArgs;
2220
+ 'system.applyUpdate': SystemApplyUpdateArgs;
2221
+ 'system.skipUpdate': SystemSkipUpdateArgs;
2100
2222
  }
2101
2223
  export interface MutateReturnMap {
2102
2224
  'projects.create': ProjectCreateReturn;
@@ -2106,8 +2228,10 @@ export interface MutateReturnMap {
2106
2228
  'sessions.compact': SessionsCompactReturn;
2107
2229
  'sessions.setProfile': SessionsSetProfileReturn;
2108
2230
  'sessions.setSelection': SessionsSetSelectionReturn;
2231
+ 'sessions.setCommission': SessionsSetCommissionReturn;
2109
2232
  'sessions.createAndSend': SessionsCreateAndSendReturn;
2110
2233
  'sessions.markRead': void;
2234
+ 'sessions.markManyRead': SessionsMarkManyReadReturn;
2111
2235
  'sessions.answerQuestion': SessionsInteractionMutateReturn;
2112
2236
  'sessions.respondPlan': SessionsInteractionMutateReturn;
2113
2237
  'sessions.respondDecision': SessionsRespondDecisionReturn;
@@ -2115,6 +2239,7 @@ export interface MutateReturnMap {
2115
2239
  'sessions.rewind': SessionsRewindReturn;
2116
2240
  'threads.cancel': ThreadsCancelReturn;
2117
2241
  'executions.cancel': ExecutionsCancelReturn;
2242
+ 'waitpoints.cancel': WaitpointsCancelReturn;
2118
2243
  'schedules.pause': void;
2119
2244
  'schedules.resume': void;
2120
2245
  'schedules.remove': void;
@@ -2172,6 +2297,8 @@ export interface MutateReturnMap {
2172
2297
  'system.restart': SystemRestartReturn;
2173
2298
  'system.clearRateLimit': SystemClearRateLimitReturn;
2174
2299
  'system.refreshUsage': SystemRefreshUsageReturn;
2300
+ 'system.applyUpdate': SystemUpdateDecisionReturn;
2301
+ 'system.skipUpdate': SystemUpdateDecisionReturn;
2175
2302
  }
2176
2303
  export type QueryParams<S extends QueryScope> = S extends keyof QueryParamMap ? QueryParamMap[S] : never;
2177
2304
  export type QueryReturn<S extends QueryScope> = S extends keyof QueryReturnMap ? QueryReturnMap[S] : never;
@@ -2183,14 +2310,6 @@ export interface UiService {
2183
2310
  subscribe(filter: SubscribeFilter): AsyncIterable<UiEvent> & {
2184
2311
  close(): void;
2185
2312
  };
2186
- /**
2187
- * Live `execution.log` stream for one running execution (B2-C). Resolves the log location from
2188
- * the executionId, ref-counts the shared tailer (first subscriber starts it, last stops it), and
2189
- * delivers lines over the same bounded queue as `subscribe`. A closed stream when unresolvable.
2190
- */
2191
- subscribeExecutionLog(executionId: string): AsyncIterable<UiEvent> & {
2192
- close(): void;
2193
- };
2194
2313
  }
2195
2314
  export interface UiServiceDeps {
2196
2315
  /** Optional seams for deterministic authentication dispatch tests. */
@@ -2217,7 +2336,7 @@ export interface UiServiceDeps {
2217
2336
  getById(sessionId: string): Promise<Session | null>;
2218
2337
  /** Admission-only liveness touch for fire-and-forget send. Updates lastUsedAt and returns false
2219
2338
  * when the session is already pending deletion or missing. Optional for legacy fixtures. */
2220
- touchForUse?(sessionId: string): Promise<boolean>;
2339
+ touchSessionUse?(sessionId: string): Promise<boolean>;
2221
2340
  /** Stamp lastReadAt=now (unread tracking; backs `sessions.markRead`). Optional so existing
2222
2341
  * facade/test fixtures need not provide it (the handler no-ops when absent). */
2223
2342
  markRead?(sessionId: string): Promise<void>;
@@ -2446,6 +2565,18 @@ export interface UiServiceDeps {
2446
2565
  getAll(): any[];
2447
2566
  cancelExecution(id: string, metrics?: any): any | null;
2448
2567
  };
2568
+ /** Waitpoint seam (`waitpoints.*` ops and SessionInfo.waitingOn). Injected at the entry layer so
2569
+ * the ui-service domain never reaches into the waitpoint store itself. Optional on purpose:
2570
+ * absent ⇒ no waitpoints and `waitingOn: 0`, so every existing fixture keeps working unchanged.
2571
+ * Only `armed` records are ever listed — settled ones have already announced themselves in the
2572
+ * session transcript. */
2573
+ waitpointRegistry?: {
2574
+ listArmed(): Promise<Waitpoint[]>;
2575
+ cancel(id: string): Promise<{
2576
+ cancelled: boolean;
2577
+ state?: string;
2578
+ }>;
2579
+ };
2449
2580
  /** Commission registry seam (commissions.* ops). Optional — handlers fall back to the
2450
2581
  * commissionRepo singleton when absent, so existing fixtures/entry wiring need no change;
2451
2582
  * tests inject it for determinism. */
@@ -2456,12 +2587,6 @@ export interface UiServiceDeps {
2456
2587
  };
2457
2588
  /** Absolute path to PENDING_APPROVALS.md (the approval-center 7a markdown queue). */
2458
2589
  approvalsPath: string;
2459
- /** Ref-counted live log tailer (B2-C). Started/stopped around each execution.log subscription. */
2460
- executionLogTailer: {
2461
- startTail(executionId: string, location: LogLocation): void;
2462
- stopTail(executionId: string): void;
2463
- refCount(executionId: string): number;
2464
- };
2465
2590
  /** The one busy answer (core/session-state.ts): sessions.list joins on it rather than
2466
2591
  * re-deriving "running" from the executions index and the hold registry separately. */
2467
2592
  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 {};
@@ -1,7 +1,7 @@
1
1
  // input: UI dependencies and operation handlers
2
2
  // output: UI dispatcher with credential-safe mutation audit
3
3
  // pos: Transport-neutral UI-service dispatcher
4
- // >>> Once updated, update this header and parent CORTEX.md <<<
4
+ // >>> Once updated, update this header and parent AGENTS.md <<<
5
5
  import { handleProjectsList } from './query/projects.js';
6
6
  import { handleSessionsList, handleSessionsTranscript, handleSessionsSubagentTranscript, handleSessionsDebugDetails, handleSessionsPendingInteraction, } from './query/sessions.js';
7
7
  import { handleThreadsList, handleThreadsGet } from './query/threads.js';
@@ -10,6 +10,7 @@ import { handleTaskVerification } from './query/task-verification.js';
10
10
  import { handleSchedulesList } from './query/schedules.js';
11
11
  import { handleCommissionsList, handleCommissionsGet, handleCommissionsDecisions, } from './query/commissions.js';
12
12
  import { handleExecutionsList, handleExecutionsGet } from './query/executions.js';
13
+ import { handleWaitpointsList } from './query/waitpoints.js';
13
14
  import { handleMemoryTree, handleMemoryFile } from './query/memory.js';
14
15
  import { handleApprovalsList } from './query/approvals.js';
15
16
  import { handleIssuesList } from './query/issues.js';
@@ -28,7 +29,7 @@ import { handlePluginsList } from './query/plugins.js';
28
29
  import { handlePluginsSkillFile, handlePluginsMcpRead } from './query/plugin-source.js';
29
30
  import { handleThreadTemplatesGet } from './query/thread-templates.js';
30
31
  import { handleThreadTemplatesDetail } from './query/thread-template-detail.js';
31
- import { handleSystemDaemonStatus, handleSystemRateLimitStatus, handleSystemUsageStatus, handleSystemNotices, } from './query/system.js';
32
+ import { handleSystemDaemonStatus, handleSystemRateLimitStatus, handleSystemUsageStatus, handleSystemNotices, handleSystemUpdateStatus, } from './query/system.js';
32
33
  import { handleConfigSet, handleConfigSetProviderRateLimitPolicy, } from './mutate/config.js';
33
34
  import { handleHooksCreate, handleHooksUpdate, handleHooksSetEnabled, handleHooksRemove, handleHooksTest, } from './mutate/hooks.js';
34
35
  import { handleProfilesCreate, handleProfilesUpdate, handleProfilesRemove, } from './mutate/profiles.js';
@@ -36,20 +37,20 @@ import { handleThreadTemplatesValidate, handleThreadTemplatesSave, handleThreadT
36
37
  import { handlePluginsAssign } from './mutate/plugins.js';
37
38
  import { handlePluginsSkillWrite, handlePluginsSkillCreate, handlePluginsSkillMove, handlePluginsSkillRemove, handlePluginsCreate, handlePluginsRemove, handlePluginsConvertToPortable, handlePluginsMcpWrite, } from './mutate/plugin-packages.js';
38
39
  import { handleCreateProject } from './mutate/projects.js';
39
- import { handleCreateSession, handleSendSession, handleCancelSession, handleCompactSession, handleSetProfile, handleSetSelection, handleCreateAndSend, handleMarkReadSession, handleAnswerQuestion, handleRespondPlan, handleRespondDecision, handleCancelResume, handleRewindSession } from './mutate/sessions.js';
40
+ import { handleCreateSession, handleSendSession, handleCancelSession, handleCompactSession, handleSetProfile, handleSetSelection, handleSetCommission, handleCreateAndSend, handleMarkReadSession, handleMarkManyReadSessions, handleAnswerQuestion, handleRespondPlan, handleRespondDecision, handleCancelResume, handleRewindSession } from './mutate/sessions.js';
40
41
  import { handleCancelThread } from './mutate/threads.js';
41
42
  import { handleCancelExecution } from './mutate/executions.js';
43
+ import { handleCancelWaitpoint } from './mutate/waitpoints.js';
42
44
  import { handlePauseSchedule, handleResumeSchedule, handleRemoveSchedule, handleAddSchedule, handleUpdateSchedule, } from './mutate/schedules.js';
43
45
  import { handleCommissionClose } from './mutate/commissions.js';
44
46
  import { handleClaimTask, handleUnclaimTask, handleCompleteTask, handleBlockTask, handleUnblockTask, } from './mutate/tasks.js';
45
47
  import { handleApproveApproval, handleRejectApproval, handleRequestApproval } from './mutate/approvals.js';
46
48
  import { handleIssuesDelete, handleIssuesHandle } from './mutate/issues.js';
47
49
  import { handleNotesAdd, handleNotesClearCompleted, handleNotesDelete, handleNotesSetCompleted, handleNotesUpdate, } from './mutate/notes.js';
48
- import { handleSystemRestart, handleSystemClearRateLimit, handleSystemRefreshUsage, } from './mutate/system.js';
50
+ import { handleSystemRestart, handleSystemClearRateLimit, handleSystemRefreshUsage, handleSystemApplyUpdate, handleSystemSkipUpdate, } from './mutate/system.js';
49
51
  import { handleAuthCancelFlow, handleAuthLogout, handleAuthSyncGateway, handleAuthRespondPrompt, handleAuthStartLogin, } from './mutate/auth.js';
50
52
  import { handleCustomProviderRemove, handleCustomProviderUpsert, } from './mutate/custom-providers.js';
51
53
  import { createSubscription } from './subscribe.js';
52
- import { resolveExecutionLogLocation } from '../executions/log-tailer.js';
53
54
  const queryHandlers = {
54
55
  'projects.list': (deps) => handleProjectsList(deps),
55
56
  'sessions.list': (deps, params) => handleSessionsList(deps, params),
@@ -66,6 +67,7 @@ const queryHandlers = {
66
67
  'commissions.get': (deps, params) => handleCommissionsGet(deps, params),
67
68
  'commissions.decisions': (deps, params) => handleCommissionsDecisions(deps, params),
68
69
  'executions.list': (deps, params) => handleExecutionsList(deps, params),
70
+ 'waitpoints.list': (deps, params) => handleWaitpointsList(deps, params),
69
71
  'executions.get': (deps, params) => handleExecutionsGet(deps, params),
70
72
  'memory.tree': (deps, params) => handleMemoryTree(deps, params),
71
73
  'memory.file': (deps, params) => handleMemoryFile(deps, params),
@@ -91,6 +93,7 @@ const queryHandlers = {
91
93
  'system.rateLimitStatus': (_deps, params) => handleSystemRateLimitStatus(params),
92
94
  'system.usageStatus': (_deps, params) => handleSystemUsageStatus(params),
93
95
  'system.notices': (_deps, params) => handleSystemNotices(params),
96
+ 'system.updateStatus': (_deps, params) => handleSystemUpdateStatus(params),
94
97
  };
95
98
  const mutateHandlers = {
96
99
  'projects.create': (deps, args) => handleCreateProject(deps, args),
@@ -100,8 +103,10 @@ const mutateHandlers = {
100
103
  'sessions.compact': (deps, args) => handleCompactSession(deps, args),
101
104
  'sessions.setProfile': (deps, args) => handleSetProfile(deps, args),
102
105
  'sessions.setSelection': (deps, args) => handleSetSelection(deps, args),
106
+ 'sessions.setCommission': (deps, args) => handleSetCommission(deps, args),
103
107
  'sessions.createAndSend': (deps, args) => handleCreateAndSend(deps, args),
104
108
  'sessions.markRead': (deps, args) => handleMarkReadSession(deps, args),
109
+ 'sessions.markManyRead': (deps, args) => handleMarkManyReadSessions(deps, args),
105
110
  'sessions.answerQuestion': (deps, args) => handleAnswerQuestion(deps, args),
106
111
  'sessions.respondPlan': (deps, args) => handleRespondPlan(deps, args),
107
112
  'sessions.respondDecision': (deps, args) => handleRespondDecision(deps, args),
@@ -109,6 +114,7 @@ const mutateHandlers = {
109
114
  'sessions.rewind': (deps, args) => handleRewindSession(deps, args),
110
115
  'threads.cancel': (deps, args) => handleCancelThread(deps, args),
111
116
  'executions.cancel': (deps, args) => handleCancelExecution(deps, args),
117
+ 'waitpoints.cancel': (deps, args) => handleCancelWaitpoint(deps, args),
112
118
  'schedules.pause': (deps, args) => handlePauseSchedule(deps, args),
113
119
  'schedules.resume': (deps, args) => handleResumeSchedule(deps, args),
114
120
  'schedules.remove': (deps, args) => handleRemoveSchedule(deps, args),
@@ -163,6 +169,8 @@ const mutateHandlers = {
163
169
  'system.restart': (_deps, args) => handleSystemRestart(args),
164
170
  'system.clearRateLimit': (_deps, args) => handleSystemClearRateLimit(args),
165
171
  'system.refreshUsage': (_deps, args) => handleSystemRefreshUsage(args),
172
+ 'system.applyUpdate': (_deps, args) => handleSystemApplyUpdate(args),
173
+ 'system.skipUpdate': (_deps, args) => handleSystemSkipUpdate(args),
166
174
  };
167
175
  export function redactMutationAuditArgs(op, args) {
168
176
  if (op === 'config.setPlatform')
@@ -228,33 +236,5 @@ export function createUiService(deps) {
228
236
  subscribe(filter) {
229
237
  return createSubscription(deps.bus, filter);
230
238
  },
231
- subscribeExecutionLog(executionId) {
232
- // Resolve the run's log location from the persisted dispatch.runName (B2-C). When it cannot
233
- // be resolved (unknown id / no runName / not a cortex-run), hand back an already-closed
234
- // stream so the client ends cleanly rather than hanging on a tail that will never emit.
235
- const location = resolveExecutionLogLocation(executionId, {
236
- getExecution: (id) => deps.executionRegistry.getExecution(id),
237
- });
238
- if (!location) {
239
- const empty = createSubscription(deps.bus, { events: [] });
240
- empty.close();
241
- return empty;
242
- }
243
- // First subscriber starts the shared tailer (ref-count +1); the last close stops it (-1).
244
- deps.executionLogTailer.startTail(executionId, location);
245
- const sub = createSubscription(deps.bus, { events: ['execution.log'], executionId });
246
- let stopped = false;
247
- const close = () => {
248
- sub.close();
249
- if (stopped)
250
- return;
251
- stopped = true;
252
- deps.executionLogTailer.stopTail(executionId);
253
- };
254
- return {
255
- [Symbol.asyncIterator]: () => sub[Symbol.asyncIterator](),
256
- close,
257
- };
258
- },
259
239
  };
260
240
  }
@@ -0,0 +1,21 @@
1
+ import type { Waitpoint, WaitpointSignal } from '../../store/waitpoint-repo.js';
2
+ export declare function formatDuration(ms: number): string;
3
+ /** One-line reminder of what the agent said it was waiting for. */
4
+ export declare function describeWaitFor(wp: Waitpoint): string;
5
+ export interface SignalNoticeOptions {
6
+ /** Signals folded into this wake (a coalesce window may hold several). */
7
+ signals: WaitpointSignal[];
8
+ now: number;
9
+ /** Set when this wake is the last one before the per-hour cap starts withholding. */
10
+ rateLimited?: boolean;
11
+ }
12
+ /**
13
+ * The turn text delivered when a waitpoint fires.
14
+ *
15
+ * Wrapped in `<system-reminder>` like the task-callback notice, and the external payload is
16
+ * explicitly framed as data: it is attacker-controlled in the general case (anything holding the
17
+ * capability can write it) and it arrives in the transcript as a *user* turn.
18
+ */
19
+ export declare function buildSignalNotice(wp: Waitpoint, opts: SignalNoticeOptions): string;
20
+ /** Delivered when a waitpoint's deadline passes with nobody ever signalling it. */
21
+ export declare function buildExpiryNotice(wp: Waitpoint, now: number): string;