@cortex-agent/server 2026.8.3-2 → 2026.8.6

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 (219) hide show
  1. package/defaults/config/thread-templates/agents/benchmark-coder.json +2 -2
  2. package/defaults/config/thread-templates/agents/benchmark-fixer.json +17 -0
  3. package/defaults/config/thread-templates/agents/benchmark-reviewer.json +5 -5
  4. package/defaults/config/thread-templates/templates/benchmark-coder-review-fix.json +21 -0
  5. package/defaults/plugins/cortex-system/skills/thread/SKILL.md +1 -0
  6. package/defaults/prompts/directives/benchmark-coder.md +1 -0
  7. package/defaults/prompts/directives/benchmark-fixer.md +1 -0
  8. package/defaults/prompts/directives/benchmark-reviewer.md +1 -0
  9. package/defaults/prompts/systemPrompts/benchmark-coder.md +1 -0
  10. package/defaults/prompts/systemPrompts/benchmark-fixer.md +1 -0
  11. package/defaults/prompts/systemPrompts/benchmark-reviewer.md +1 -0
  12. package/dist/agent-adapter/capabilities.d.ts +32 -1
  13. package/dist/agent-adapter/capabilities.js +39 -1
  14. package/dist/agent-adapter/claude/adapter.d.ts +15 -0
  15. package/dist/agent-adapter/claude/adapter.js +29 -7
  16. package/dist/agent-adapter/claude/spawn-args.d.ts +5 -2
  17. package/dist/agent-adapter/claude/spawn-args.js +29 -6
  18. package/dist/agent-adapter/index.js +11 -1
  19. package/dist/agent-adapter/normalize/tool-names.d.ts +4 -0
  20. package/dist/agent-adapter/normalize/tool-names.js +10 -0
  21. package/dist/agent-adapter/pi/adapter.d.ts +20 -8
  22. package/dist/agent-adapter/pi/adapter.js +130 -35
  23. package/dist/agent-adapter/pi/agent-dir.d.ts +20 -53
  24. package/dist/agent-adapter/pi/agent-dir.js +48 -89
  25. package/dist/agent-adapter/pi/custom-catalog.d.ts +10 -0
  26. package/dist/agent-adapter/pi/custom-catalog.js +42 -0
  27. package/dist/agent-adapter/pi/defaults.d.ts +9 -0
  28. package/dist/agent-adapter/pi/defaults.js +14 -4
  29. package/dist/agent-adapter/pi/discovery.d.ts +1 -3
  30. package/dist/agent-adapter/pi/discovery.js +3 -15
  31. package/dist/agent-adapter/pi/event-parser.js +8 -0
  32. package/dist/agent-adapter/pi/mcp-bridge.d.ts +13 -0
  33. package/dist/agent-adapter/pi/mcp-bridge.js +31 -6
  34. package/dist/agent-adapter/pi/mcp-duration.d.ts +28 -0
  35. package/dist/agent-adapter/pi/mcp-duration.js +48 -0
  36. package/dist/agent-adapter/pi/policy-guard.d.ts +40 -0
  37. package/dist/agent-adapter/pi/policy-guard.js +111 -0
  38. package/dist/agent-adapter/pi/providers-config.d.ts +62 -0
  39. package/dist/agent-adapter/pi/providers-config.js +101 -0
  40. package/dist/agent-adapter/pi/quota-probe.d.ts +11 -0
  41. package/dist/agent-adapter/pi/quota-probe.js +36 -0
  42. package/dist/agent-adapter/pi/quota-sink.d.ts +25 -0
  43. package/dist/agent-adapter/pi/quota-sink.js +31 -0
  44. package/dist/agent-adapter/pi/session-files.d.ts +2 -0
  45. package/dist/agent-adapter/pi/session-files.js +19 -0
  46. package/dist/agent-adapter/pi/session-support.d.ts +14 -3
  47. package/dist/agent-adapter/pi/session-support.js +8 -0
  48. package/dist/agent-adapter/pi/spawn-args.d.ts +11 -1
  49. package/dist/agent-adapter/pi/spawn-args.js +13 -0
  50. package/dist/agent-adapter/pi/tool-shims.d.ts +2 -2
  51. package/dist/agent-adapter/pi/tool-shims.js +32 -21
  52. package/dist/agent-adapter/pi/web-search.js +36 -8
  53. package/dist/agent-adapter/types.d.ts +14 -0
  54. package/dist/core/locales/en.d.ts +54 -1
  55. package/dist/core/locales/en.js +2 -0
  56. package/dist/core/locales/slices/commands.d.ts +12 -1
  57. package/dist/core/locales/slices/commands.js +24 -2
  58. package/dist/core/locales/slices/providers.d.ts +45 -0
  59. package/dist/core/locales/slices/providers.js +95 -0
  60. package/dist/core/locales/zh.js +2 -0
  61. package/dist/core/resilient-watch.d.ts +28 -0
  62. package/dist/core/resilient-watch.js +110 -0
  63. package/dist/core/settings.js +15 -20
  64. package/dist/core/types/agent-types.d.ts +6 -0
  65. package/dist/core/types/thread-types.d.ts +21 -3
  66. package/dist/domain/agent-run/agent-run-cli.js +3 -1
  67. package/dist/domain/agent-run/benchmark-local-thread-orchestrator.d.ts +31 -0
  68. package/dist/domain/agent-run/benchmark-local-thread-orchestrator.js +231 -24
  69. package/dist/domain/agent-run/benchmark-thread-identity.d.ts +15 -2
  70. package/dist/domain/agent-run/benchmark-thread-identity.js +123 -34
  71. package/dist/domain/agent-run/identity.d.ts +5 -0
  72. package/dist/domain/agent-run/identity.js +4 -1
  73. package/dist/domain/agent-run/journal.d.ts +3 -2
  74. package/dist/domain/agent-run/manifest.js +11 -4
  75. package/dist/domain/agent-run/pinned-node-process.d.ts +4 -0
  76. package/dist/domain/agent-run/pinned-node-process.js +9 -0
  77. package/dist/domain/agent-run/role-surface.d.ts +2 -2
  78. package/dist/domain/agent-run/role-surface.js +7 -3
  79. package/dist/domain/agent-run/run-config.d.ts +10 -1
  80. package/dist/domain/agent-run/run-config.js +57 -6
  81. package/dist/domain/agent-run/runner.js +149 -31
  82. package/dist/domain/agents/facade.d.ts +37 -122
  83. package/dist/domain/agents/facade.js +47 -115
  84. package/dist/domain/agents/spawn-config.d.ts +135 -0
  85. package/dist/domain/agents/spawn-config.js +121 -0
  86. package/dist/domain/benchmark/accounting-reconciliation.d.ts +98 -0
  87. package/dist/domain/benchmark/accounting-reconciliation.js +218 -0
  88. package/dist/domain/benchmark/arm-schema.d.ts +43 -0
  89. package/dist/domain/benchmark/arm-schema.js +243 -0
  90. package/dist/domain/benchmark/capabilities.d.ts +4 -0
  91. package/dist/domain/benchmark/capabilities.js +54 -0
  92. package/dist/domain/benchmark/decimal-text.d.ts +27 -0
  93. package/dist/domain/benchmark/decimal-text.js +67 -0
  94. package/dist/domain/benchmark/lease-echo.d.ts +43 -0
  95. package/dist/domain/benchmark/lease-echo.js +56 -0
  96. package/dist/domain/benchmark/policy-backed-runtime-deps.d.ts +14 -0
  97. package/dist/domain/benchmark/policy-backed-runtime-deps.js +47 -0
  98. package/dist/domain/benchmark/policy-compiler.d.ts +68 -0
  99. package/dist/domain/benchmark/policy-compiler.js +680 -0
  100. package/dist/domain/benchmark/resolved-policy.d.ts +110 -0
  101. package/dist/domain/benchmark/resolved-policy.js +195 -0
  102. package/dist/domain/benchmark/trial-adapter-factory.d.ts +38 -0
  103. package/dist/domain/benchmark/trial-adapter-factory.js +165 -0
  104. package/dist/domain/benchmark/trial-thread-adapter.d.ts +25 -0
  105. package/dist/domain/benchmark/trial-thread-adapter.js +106 -0
  106. package/dist/domain/benchmark/variant-proposal.d.ts +45 -0
  107. package/dist/domain/benchmark/variant-proposal.js +42 -0
  108. package/dist/domain/benchmark/workspace-lease.d.ts +99 -0
  109. package/dist/domain/benchmark/workspace-lease.js +272 -0
  110. package/dist/domain/costs/codex-quota.d.ts +29 -0
  111. package/dist/domain/costs/codex-quota.js +102 -0
  112. package/dist/domain/costs/cost-tracker.d.ts +48 -9
  113. package/dist/domain/costs/cost-tracker.js +74 -18
  114. package/dist/domain/costs/rate-limit-throttle.d.ts +23 -1
  115. package/dist/domain/costs/rate-limit-throttle.js +61 -6
  116. package/dist/domain/costs/resume-registry.d.ts +3 -1
  117. package/dist/domain/costs/resume-registry.js +10 -1
  118. package/dist/domain/mcp/tools/benchmark-thread-run.d.ts +26 -2
  119. package/dist/domain/mcp/tools/benchmark-thread-run.js +63 -20
  120. package/dist/domain/mcp/tools/cost.js +15 -6
  121. package/dist/domain/pi-providers/custom-provider-model.d.ts +53 -0
  122. package/dist/domain/pi-providers/custom-provider-model.js +122 -0
  123. package/dist/domain/pi-providers/custom-provider-service.d.ts +59 -0
  124. package/dist/domain/pi-providers/custom-provider-service.js +143 -0
  125. package/dist/domain/pi-providers/gateway-route-store.d.ts +23 -0
  126. package/dist/domain/pi-providers/gateway-route-store.js +78 -0
  127. package/dist/domain/pi-providers/index.d.ts +4 -0
  128. package/dist/domain/pi-providers/index.js +8 -0
  129. package/dist/domain/pi-providers/models-json-store.d.ts +6 -0
  130. package/dist/domain/pi-providers/models-json-store.js +77 -0
  131. package/dist/domain/scheduling/jobs/_shared.d.ts +4 -1
  132. package/dist/domain/scheduling/jobs/_shared.js +11 -2
  133. package/dist/domain/scheduling/jobs/scheduled-task.js +1 -0
  134. package/dist/domain/scheduling/jobs/task-dispatch.js +49 -54
  135. package/dist/domain/sessions/session-lifecycle.d.ts +22 -0
  136. package/dist/domain/sessions/session-lifecycle.js +20 -1
  137. package/dist/domain/system/system-notice.d.ts +4 -1
  138. package/dist/domain/system/system-notice.js +6 -2
  139. package/dist/domain/tasks/dispatch-utils.d.ts +0 -4
  140. package/dist/domain/tasks/dispatch-utils.js +24 -37
  141. package/dist/domain/threads/runner.d.ts +16 -1
  142. package/dist/domain/threads/runner.js +62 -8
  143. package/dist/domain/threads/template-loader.d.ts +5 -0
  144. package/dist/domain/threads/template-loader.js +120 -36
  145. package/dist/domain/threads/template-validate.d.ts +244 -0
  146. package/dist/domain/threads/template-validate.js +574 -0
  147. package/dist/domain/threads/template-validate.parity.d.ts +1 -0
  148. package/dist/domain/threads/template-validate.parity.js +47 -0
  149. package/dist/domain/threads/template-writer.d.ts +55 -0
  150. package/dist/domain/threads/template-writer.js +131 -0
  151. package/dist/domain/ui-service/app-router.d.ts +143 -1
  152. package/dist/domain/ui-service/app-router.js +29 -3
  153. package/dist/domain/ui-service/input-schemas.d.ts +228 -4
  154. package/dist/domain/ui-service/input-schemas.js +132 -1
  155. package/dist/domain/ui-service/mutate/config.d.ts +10 -1
  156. package/dist/domain/ui-service/mutate/config.js +45 -5
  157. package/dist/domain/ui-service/mutate/custom-providers.d.ts +8 -0
  158. package/dist/domain/ui-service/mutate/custom-providers.js +37 -0
  159. package/dist/domain/ui-service/mutate/profiles.d.ts +21 -0
  160. package/dist/domain/ui-service/mutate/profiles.js +156 -0
  161. package/dist/domain/ui-service/mutate/schedules.d.ts +2 -1
  162. package/dist/domain/ui-service/mutate/schedules.js +53 -3
  163. package/dist/domain/ui-service/mutate/sessions.d.ts +2 -1
  164. package/dist/domain/ui-service/mutate/sessions.js +25 -1
  165. package/dist/domain/ui-service/mutate/system.d.ts +2 -1
  166. package/dist/domain/ui-service/mutate/system.js +17 -3
  167. package/dist/domain/ui-service/mutate/thread-templates.d.ts +4 -0
  168. package/dist/domain/ui-service/mutate/thread-templates.js +71 -0
  169. package/dist/domain/ui-service/query/config.js +30 -0
  170. package/dist/domain/ui-service/query/custom-providers.d.ts +8 -0
  171. package/dist/domain/ui-service/query/custom-providers.js +13 -0
  172. package/dist/domain/ui-service/query/machine-detail.d.ts +2 -0
  173. package/dist/domain/ui-service/query/machine-detail.js +56 -0
  174. package/dist/domain/ui-service/query/machine-probe.d.ts +18 -0
  175. package/dist/domain/ui-service/query/machine-probe.js +136 -0
  176. package/dist/domain/ui-service/query/schedules.js +5 -0
  177. package/dist/domain/ui-service/query/sessions.js +8 -2
  178. package/dist/domain/ui-service/query/thread-template-detail.d.ts +8 -0
  179. package/dist/domain/ui-service/query/thread-template-detail.js +94 -0
  180. package/dist/domain/ui-service/query/thread-templates.d.ts +5 -3
  181. package/dist/domain/ui-service/query/thread-templates.js +44 -7
  182. package/dist/domain/ui-service/types.d.ts +298 -7
  183. package/dist/domain/ui-service/ui-service.js +27 -3
  184. package/dist/entry/app.js +24 -3
  185. package/dist/entry/auth-cli.d.ts +4 -1
  186. package/dist/entry/auth-cli.js +10 -2
  187. package/dist/entry/cli-help.js +6 -2
  188. package/dist/entry/cli.js +2 -1
  189. package/dist/entry/daemon.d.ts +0 -11
  190. package/dist/entry/daemon.js +5 -49
  191. package/dist/entry/provider-cli.d.ts +16 -0
  192. package/dist/entry/provider-cli.js +203 -0
  193. package/dist/events/event-types.d.ts +2 -1
  194. package/dist/orchestration/agent-runner.js +3 -2
  195. package/dist/orchestration/routing/commands/cost.d.ts +8 -0
  196. package/dist/orchestration/routing/commands/cost.js +93 -21
  197. package/dist/orchestration/routing/commands/login-custom.d.ts +26 -0
  198. package/dist/orchestration/routing/commands/login-custom.js +89 -0
  199. package/dist/orchestration/routing/commands/login.d.ts +3 -0
  200. package/dist/orchestration/routing/commands/login.js +7 -0
  201. package/dist/orchestration/routing/message-router.js +48 -33
  202. package/dist/orchestration/routing/webhook.js +1 -1
  203. package/dist/orchestration/session-events.d.ts +2 -1
  204. package/dist/orchestration/session-events.js +1 -0
  205. package/dist/orchestration/thread-callback.js +1 -1
  206. package/dist/store/conversation-history-repo.d.ts +5 -1
  207. package/dist/store/conversation-history-repo.js +2 -1
  208. package/dist/store/cost-repo.d.ts +17 -0
  209. package/dist/store/cost-repo.js +47 -5
  210. package/dist/store/profile-repo.d.ts +0 -10
  211. package/dist/store/profile-repo.js +34 -56
  212. package/dist/store/session-registry-repo.d.ts +12 -0
  213. package/dist/store/session-registry-repo.js +16 -0
  214. package/package.json +1 -1
  215. package/web/dist/assets/index-DYMfaAi4.css +1 -0
  216. package/web/dist/assets/index-uOoZjGKa.js +141 -0
  217. package/web/dist/index.html +2 -2
  218. package/web/dist/assets/index-XqBCYtkw.js +0 -139
  219. package/web/dist/assets/index-zpf3OSKC.css +0 -1
@@ -3,8 +3,8 @@ import type { CostSummary } from '../costs/cost-tracker.js';
3
3
  import type { EventBus } from '../../events/index.js';
4
4
  import type { RunningExecutions } from '../../core/running-executions.js';
5
5
  import type { Settings, SettingSnapshotEntry } from '../../core/settings-spec.js';
6
- import type { AuthNoticeAction, ChatNoticeLevel, SessionContextUsage } from '../../core/types/agent-types.js';
7
- export type { AuthNoticeAction, ChatNoticeLevel, SessionContextUsage, } from '../../core/types/agent-types.js';
6
+ import type { AuthNoticeAction, ChatNoticeLevel, NoticeAction, SessionContextUsage } from '../../core/types/agent-types.js';
7
+ export type { AuthNoticeAction, ChatNoticeLevel, NoticeAction, SessionContextUsage, } from '../../core/types/agent-types.js';
8
8
  import type { PlatformAdapter } from '../../platform/adapter.js';
9
9
  import type { HookBackend, HookEvent, HookFilterValue, HookPhase, HookResultMode, HookSource } from '../../store/hook-registry.js';
10
10
  import type { HookApplyTime, HookMountTarget } from '../hooks/hook-view.js';
@@ -17,6 +17,8 @@ import type { Backend } from '../../agent-adapter/types.js';
17
17
  import type { ProjectNote } from '../../store/project-notes-repo.js';
18
18
  import type { AuthLoginService, AuthLogoutResult, AuthLogoutSuccess, AuthStatusSnapshot, AuthType, LoginFlowState, LogoutAccountInput } from '../auth/index.js';
19
19
  export type { AuthAccountState, AuthAccountStatus, AuthCredentialStatus, AuthStatusSnapshot, AuthType, LoginFlowNotice, LoginFlowState, LoginFlowStep, LoginOutcome, LoginPendingPrompt, LoginPromptOption, } from '../auth/index.js';
20
+ import type { CustomProviderApi, CustomProviderModelSpec, CustomProviderStores, CustomProviderView } from '../pi-providers/index.js';
21
+ export type { CustomProviderApi, CustomProviderModelSpec, CustomProviderView, } from '../pi-providers/index.js';
20
22
  export type Ok<T> = {
21
23
  ok: true;
22
24
  data: T;
@@ -27,8 +29,8 @@ export type Err = {
27
29
  message: string;
28
30
  };
29
31
  export type Result<T> = Ok<T> | Err;
30
- export type QueryScope = 'projects.list' | 'sessions.list' | 'sessions.transcript' | 'sessions.pendingInteraction' | 'threads.list' | 'threads.get' | 'tasks.list' | 'tasks.verification' | 'schedules.list' | 'executions.list' | 'executions.get' | 'memory.tree' | 'memory.file' | 'approvals.list' | 'issues.list' | 'notes.list' | 'cost.summary' | 'config.get' | 'auth.status' | 'auth.flowState' | 'hooks.list' | 'machines.list' | 'skills.list' | 'threadTemplates.get' | 'system.daemonStatus' | 'system.rateLimitStatus';
31
- export type MutateOp = 'projects.create' | 'sessions.create' | 'sessions.send' | 'sessions.cancel' | 'sessions.compact' | 'sessions.setProfile' | 'sessions.createAndSend' | 'sessions.markRead' | 'sessions.answerQuestion' | 'sessions.respondPlan' | 'sessions.rewind' | 'threads.cancel' | 'executions.cancel' | 'schedules.pause' | 'schedules.resume' | 'schedules.remove' | 'schedules.add' | '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' | 'auth.startLogin' | 'auth.respondPrompt' | 'auth.cancelFlow' | 'auth.logout' | 'hooks.create' | 'hooks.update' | 'hooks.setEnabled' | 'hooks.remove' | 'hooks.test' | 'system.restart';
32
+ export type QueryScope = 'projects.list' | 'sessions.list' | 'sessions.transcript' | 'sessions.pendingInteraction' | 'threads.list' | 'threads.get' | 'tasks.list' | 'tasks.verification' | 'schedules.list' | 'executions.list' | 'executions.get' | 'memory.tree' | 'memory.file' | 'approvals.list' | 'issues.list' | 'notes.list' | 'cost.summary' | 'config.get' | 'auth.status' | 'auth.flowState' | 'auth.customProviders' | 'hooks.list' | 'machines.list' | 'machines.detail' | 'skills.list' | 'threadTemplates.get' | 'threadTemplates.detail' | 'system.daemonStatus' | 'system.rateLimitStatus';
33
+ export type MutateOp = 'projects.create' | 'sessions.create' | 'sessions.send' | 'sessions.cancel' | 'sessions.compact' | 'sessions.setProfile' | 'sessions.createAndSend' | 'sessions.markRead' | 'sessions.answerQuestion' | 'sessions.respondPlan' | 'sessions.cancelResume' | 'sessions.rewind' | 'threads.cancel' | 'executions.cancel' | 'schedules.pause' | 'schedules.resume' | 'schedules.remove' | 'schedules.add' | 'schedules.update' | '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' | 'auth.startLogin' | 'auth.respondPrompt' | 'auth.cancelFlow' | 'auth.logout' | 'auth.upsertCustomProvider' | 'auth.removeCustomProvider' | 'hooks.create' | 'hooks.update' | 'hooks.setEnabled' | 'hooks.remove' | 'hooks.test' | 'profiles.create' | 'profiles.update' | 'profiles.remove' | 'threadTemplates.validate' | 'threadTemplates.save' | 'threadTemplates.remove' | 'system.restart' | 'system.clearRateLimit';
32
34
  export interface SubscribeFilter {
33
35
  events: string[];
34
36
  projectId?: string | null;
@@ -141,7 +143,12 @@ export type AuthStatusParams = Record<string, never>;
141
143
  export interface AuthFlowStateParams {
142
144
  flowId: string;
143
145
  }
146
+ export type AuthCustomProvidersParams = Record<string, never>;
144
147
  export type MachinesListParams = Record<string, never>;
148
+ export interface MachineDetailParams {
149
+ /** Machine name as registered in machines.json. */
150
+ machine: string;
151
+ }
145
152
  export type SkillsListParams = Record<string, never>;
146
153
  export type ThreadTemplatesGetParams = Record<string, never>;
147
154
  export type SystemDaemonStatusParams = Record<string, never>;
@@ -164,6 +171,21 @@ export interface AuthCancelFlowArgs {
164
171
  }
165
172
  export type AuthLogoutArgs = LogoutAccountInput;
166
173
  export type AuthLogoutReturn = AuthLogoutSuccess;
174
+ export interface AuthUpsertCustomProviderArgs {
175
+ name: string;
176
+ api: CustomProviderApi;
177
+ upstreamUrl: string;
178
+ apiKey?: string;
179
+ models: CustomProviderModelSpec[];
180
+ headers?: Record<string, string>;
181
+ compat?: Record<string, unknown>;
182
+ }
183
+ export interface AuthRemoveCustomProviderArgs {
184
+ name: string;
185
+ }
186
+ export interface AuthRemoveCustomProviderReturn {
187
+ removed: boolean;
188
+ }
167
189
  export interface SessionsCreateArgs {
168
190
  /** Project the new session belongs to. Omitted → the default project (handler fallback). */
169
191
  projectId?: string;
@@ -210,6 +232,16 @@ export interface SessionsRespondPlanArgs {
210
232
  export interface SessionsInteractionMutateReturn {
211
233
  outcome: 'resolved' | 'already-resolved';
212
234
  }
235
+ /** Args for `sessions.cancelResume`: decline the auto-resume promised when a rate limit
236
+ * interrupted this session's turn. */
237
+ export interface SessionsCancelResumeArgs {
238
+ sessionId: string;
239
+ }
240
+ /** `cancelled: false` means nothing was queued any more — the window reset and the turn
241
+ * already resumed. A late click is a no-op, not an error. */
242
+ export interface SessionsCancelResumeReturn {
243
+ cancelled: boolean;
244
+ }
213
245
  /** Args for `sessions.rewind` (message edit + rewind, desktop design 23 / mobile 7): replace the
214
246
  * user message that opened `turnIndex` with `text`, rolling back every later turn and
215
247
  * regenerating. Attachments of the original message are preserved server-side (the edit UI can
@@ -259,6 +291,15 @@ export interface ScheduleAddArgs {
259
291
  target?: ScheduleTarget;
260
292
  fallback?: 'fresh' | 'skip' | 'wait';
261
293
  }
294
+ export interface ScheduleUpdateArgs {
295
+ scheduleId: string;
296
+ message?: string;
297
+ projectId?: string;
298
+ profile?: string;
299
+ intervalMs?: number;
300
+ time?: string;
301
+ dayOfWeek?: number;
302
+ }
262
303
  export interface TaskActionArgs {
263
304
  projectId: string;
264
305
  taskId: string;
@@ -277,16 +318,50 @@ export interface ProfilesValue {
277
318
  defaultProfile: string;
278
319
  }
279
320
  export type SettingsValue = Partial<Settings>;
280
- export type ConfigSetArgs = {
321
+ /**
322
+ * `project` absent/null targets the global limits; a project id targets that project's override.
323
+ * An absent/null `value` clears an override (legal only together with a `project`) — per-project
324
+ * overrides are pair-only, so a project either declares both limits or inherits both globals.
325
+ */
326
+ export interface ConfigSetBudgetArgs {
281
327
  section: 'budget';
282
- value: BudgetValue;
283
- } | {
328
+ project?: string | null;
329
+ value?: BudgetValue | null;
330
+ }
331
+ export type ConfigSetArgs = ConfigSetBudgetArgs | {
284
332
  section: 'profiles';
285
333
  value: ProfilesValue;
286
334
  } | {
287
335
  section: 'settings';
288
336
  value: SettingsValue;
289
337
  };
338
+ export interface ProfileDraftInput {
339
+ model: string;
340
+ backend?: Backend;
341
+ mode?: string;
342
+ provider?: string;
343
+ thinking?: string;
344
+ claudeBackend?: 'print' | 'tui';
345
+ extraOption?: Record<string, string>;
346
+ }
347
+ export interface ProfilesCreateArgs extends ProfileDraftInput {
348
+ name: string;
349
+ }
350
+ export interface ProfilesCreateReturn {
351
+ name: string;
352
+ }
353
+ export interface ProfilesUpdateArgs extends ProfileDraftInput {
354
+ name: string;
355
+ }
356
+ export interface ProfilesUpdateReturn {
357
+ changed: boolean;
358
+ }
359
+ export interface ProfilesRemoveArgs {
360
+ name: string;
361
+ }
362
+ export interface ProfilesRemoveReturn {
363
+ removed: boolean;
364
+ }
290
365
  export interface ApprovalsApproveArgs {
291
366
  id: string;
292
367
  }
@@ -348,6 +423,10 @@ export interface SessionInfo {
348
423
  /** How the session was initiated: 'direct' (user chat), 'thread' (pipeline/dispatch
349
424
  * step), or 'scheduled' (scheduled job). The workbench session list shows only 'direct'. */
350
425
  origin: 'direct' | 'thread' | 'scheduled';
426
+ /** The schedule (ScheduleInfo.id) whose fire produced this session — drives the left rail's
427
+ * per-schedule run grouping and the chat trigger card. Survives a reply converting the run to
428
+ * a direct session (provenance). Null for sessions with no schedule origin / legacy records. */
429
+ scheduleId: string | null;
351
430
  createdAt: string;
352
431
  lastUsedAt: string;
353
432
  resumable: boolean;
@@ -449,6 +528,8 @@ export interface TranscriptMessage {
449
528
  debug?: TranscriptDebugDetails;
450
529
  /** Semantic chat-notice styling for system-authored assistant messages. */
451
530
  noticeLevel?: ChatNoticeLevel;
531
+ /** Control the notice offers (e.g. declining a promised auto-resume). */
532
+ noticeAction?: NoticeAction;
452
533
  /** Secret-free one-click target carried only by authentication notices. */
453
534
  authAction?: AuthNoticeAction;
454
535
  /** interaction subtype: 'ask-user-answered' | 'plan-approved' | 'plan-rejected' (legacy rows)
@@ -673,6 +754,14 @@ export interface ScheduleInfo {
673
754
  lastRun: string | null;
674
755
  paused: boolean;
675
756
  pausedBy: string | null;
757
+ /** Timing spec — only the field(s) matching `type` are set; the rest are null.
758
+ * Drives cadence labels ("daily 07:30") and edit-form prefill. */
759
+ intervalMs: number | null;
760
+ time: string | null;
761
+ dayOfWeek: number | null;
762
+ /** Persisted dispatch target / fallback; null when the record predates them (never fabricated). */
763
+ target: ScheduleTarget | null;
764
+ fallback: 'fresh' | 'skip' | 'wait' | null;
676
765
  }
677
766
  export interface ExecutionInfo {
678
767
  id: string;
@@ -728,6 +817,10 @@ export interface ExecutionDetailInfo {
728
817
  export interface ConfigBudget {
729
818
  daily_usd: number | null;
730
819
  monthly_usd: number | null;
820
+ /** Per-project overrides keyed by project id. Empty when every project inherits the globals.
821
+ * Entries are pair-only by construction — a malformed half-pair on disk is dropped, not
822
+ * surfaced as a partially-null override. */
823
+ projects: Record<string, BudgetValue>;
731
824
  }
732
825
  export interface ConfigProfileEntry {
733
826
  name: string;
@@ -736,6 +829,17 @@ export interface ConfigProfileEntry {
736
829
  mode: string | null;
737
830
  /** Thinking level (backend-native value: claude --effort / pi --thinking). */
738
831
  thinking: string | null;
832
+ /** Rate-limit provider identity; required by profiles whose effective backend is 'pi'. */
833
+ provider: string | null;
834
+ /** DR-0012 claude adapter mode. null when the entry does not declare one (resolves to 'print'). */
835
+ claudeBackend: 'print' | 'tui' | null;
836
+ /** Extra CLI flags (keys start with '--'). Returned in full — the editor must round-trip them. */
837
+ extraOption: Record<string, string>;
838
+ /** KEYS ONLY of `extraEnv`. Values are environment injection and may hold a token, so they are
839
+ * never returned; an edit preserves the stored values untouched. */
840
+ extraEnvKeys: string[];
841
+ /** Number of declared fallback entries. The fallback chain itself is not editable from the UI. */
842
+ fallbackCount: number;
739
843
  }
740
844
  export interface ConfigProfiles {
741
845
  defaultProfile: string | null;
@@ -908,6 +1012,58 @@ export interface MachineInfo {
908
1012
  /** Number of dispatch executions currently running on this machine. */
909
1013
  liveRuns: number;
910
1014
  }
1015
+ /** A compute process holding memory on a GPU (from `nvidia-smi --query-compute-apps`). */
1016
+ export interface MachineGpuProcess {
1017
+ pid: string;
1018
+ /** Process name as reported by nvidia-smi (may be a bare name or a full path). */
1019
+ name: string;
1020
+ memoryMb: number;
1021
+ }
1022
+ export interface MachineGpu {
1023
+ /** CUDA device ordinal — the same index MachineLiveRun.gpuIndices refers to. */
1024
+ index: number;
1025
+ name: string;
1026
+ utilPercent: number;
1027
+ memUsedMb: number;
1028
+ memTotalMb: number;
1029
+ tempC: number;
1030
+ powerW: number;
1031
+ processes: MachineGpuProcess[];
1032
+ }
1033
+ /** Host vitals in absolute units; every field is null when the host did not report it. */
1034
+ export interface MachineVitals {
1035
+ cpuCores: number | null;
1036
+ loadAvg1: number | null;
1037
+ memUsedMb: number | null;
1038
+ memTotalMb: number | null;
1039
+ /** Free/total space on the filesystem holding the machine's cortexPath. */
1040
+ diskFreeGb: number | null;
1041
+ diskTotalGb: number | null;
1042
+ uptimeSec: number | null;
1043
+ }
1044
+ /** A dispatch execution currently running on this machine (from executionRegistry). */
1045
+ export interface MachineLiveRun {
1046
+ executionId: string;
1047
+ taskId: string | null;
1048
+ runName: string | null;
1049
+ project: string | null;
1050
+ /** GPU ordinals the run actually acquired (recorded by the client watcher); [] when unknown. */
1051
+ gpuIndices: number[];
1052
+ startedAt: string | null;
1053
+ }
1054
+ export interface MachineDetail {
1055
+ name: string;
1056
+ online: boolean;
1057
+ /** null when the machine is offline or the probe failed. */
1058
+ vitals: MachineVitals | null;
1059
+ /** Empty when the machine is offline, has no nvidia-smi, or the probe failed. */
1060
+ gpus: MachineGpu[];
1061
+ liveRuns: MachineLiveRun[];
1062
+ /** ISO timestamp of the successful probe; null when no probe ran or it failed. */
1063
+ probedAt: string | null;
1064
+ /** Human-readable probe failure reason; null when the probe succeeded or was skipped. */
1065
+ probeError: string | null;
1066
+ }
911
1067
  export interface ThreadTemplateEntry {
912
1068
  /** Subdir origin: 'template' (orchestration), 'agent' (execution), 'shell' (shorthand). */
913
1069
  kind: 'template' | 'agent' | 'shell';
@@ -917,6 +1073,74 @@ export interface ThreadTemplateEntry {
917
1073
  description: string | null;
918
1074
  /** Full parsed JSON body; null when the file cannot be parsed. */
919
1075
  body: Record<string, unknown> | null;
1076
+ /** False when the validator reports blocking errors — the row is flagged in the list. */
1077
+ valid: boolean;
1078
+ /** Count of blocking errors; 0 when valid. */
1079
+ errorCount: number;
1080
+ /** Relationship to the shipped defaults. `mergeThreadTemplates` is copy-if-missing and never
1081
+ * overwrites, so editing a `stock` entity forks it from upstream permanently. */
1082
+ origin: ThreadTemplateOrigin;
1083
+ }
1084
+ /** 'stock' = byte-identical to the shipped default, 'modified' = a shipped name that differs,
1085
+ * 'custom' = no shipped default of that name. */
1086
+ export type ThreadTemplateOrigin = 'stock' | 'modified' | 'custom';
1087
+ export interface ThreadTemplateIssue {
1088
+ /** Field anchor, e.g. `transitions[2].from`, or `template:<name>` for a knock-on breakage. */
1089
+ path: string;
1090
+ message: string;
1091
+ }
1092
+ export interface ThreadTemplateDetailParams {
1093
+ kind: 'template' | 'agent' | 'shell';
1094
+ name: string;
1095
+ }
1096
+ export interface ThreadTemplateDetail {
1097
+ kind: 'template' | 'agent' | 'shell';
1098
+ name: string;
1099
+ description: string | null;
1100
+ body: Record<string, unknown> | null;
1101
+ /** Absolute path of the backing file. */
1102
+ filePath: string;
1103
+ origin: ThreadTemplateOrigin;
1104
+ /** Hash of the bytes on disk — pass back as `baseHash` on save to detect a concurrent edit. */
1105
+ sha256: string;
1106
+ errors: ThreadTemplateIssue[];
1107
+ warnings: ThreadTemplateIssue[];
1108
+ /** Templates that declare this agent or bind this shell; empty for a template. */
1109
+ usedByTemplates: string[];
1110
+ /** Non-terminal threads currently running on this template. Transitions are re-read every step,
1111
+ * so editing while these are alive can reroute or stall them. */
1112
+ runningThreads: number;
1113
+ /** Open TASKS.yaml entries dispatching this template — they break if it is deleted. */
1114
+ referencingTasks: number;
1115
+ /** For a shell-binding template: the transition graph it expands to. Null otherwise. */
1116
+ expanded: Record<string, unknown> | null;
1117
+ }
1118
+ export interface ThreadTemplatesValidateArgs {
1119
+ kind: 'template' | 'agent' | 'shell';
1120
+ name: string;
1121
+ body: Record<string, unknown>;
1122
+ }
1123
+ export interface ThreadTemplatesValidateReturn {
1124
+ ok: boolean;
1125
+ errors: ThreadTemplateIssue[];
1126
+ warnings: ThreadTemplateIssue[];
1127
+ }
1128
+ export interface ThreadTemplatesSaveArgs extends ThreadTemplatesValidateArgs {
1129
+ /** Absent creates (the file must not exist); present is the hash the editor loaded, which the
1130
+ * writer compares against disk to reject a save made under a stale editor. */
1131
+ baseHash?: string;
1132
+ }
1133
+ export interface ThreadTemplatesSaveReturn {
1134
+ changed: boolean;
1135
+ sha256: string;
1136
+ warnings: ThreadTemplateIssue[];
1137
+ }
1138
+ export interface ThreadTemplatesRemoveArgs {
1139
+ kind: 'template' | 'agent' | 'shell';
1140
+ name: string;
1141
+ }
1142
+ export interface ThreadTemplatesRemoveReturn {
1143
+ removed: boolean;
920
1144
  }
921
1145
  export interface SkillGroup {
922
1146
  /** Plugin name (e.g. 'cortex-common'); null for user-owned skills under DATA_DIR/.claude/skills */
@@ -1071,6 +1295,21 @@ export interface SystemRestartReturn {
1071
1295
  ok: boolean;
1072
1296
  message: string;
1073
1297
  }
1298
+ export interface SystemClearRateLimitArgs {
1299
+ /** Provider key to clear; omit to clear every throttled provider. */
1300
+ provider?: string;
1301
+ }
1302
+ export interface SystemClearRateLimitReturn {
1303
+ /** Providers whose throttle was lifted early. */
1304
+ cleared: {
1305
+ provider: string;
1306
+ displayName: string;
1307
+ /** Window types cleared (e.g. five_hour / outage). */
1308
+ types: string[];
1309
+ /** Latest resetsAt among the cleared windows (epoch sec). */
1310
+ resetsAt: number;
1311
+ }[];
1312
+ }
1074
1313
  export interface ProjectCreateReturn {
1075
1314
  /** The id of the newly created project (equals its directory name). */
1076
1315
  id: string;
@@ -1159,10 +1398,13 @@ export interface QueryParamMap {
1159
1398
  'config.get': ConfigGetParams;
1160
1399
  'auth.status': AuthStatusParams;
1161
1400
  'auth.flowState': AuthFlowStateParams;
1401
+ 'auth.customProviders': AuthCustomProvidersParams;
1162
1402
  'hooks.list': HooksListParams;
1163
1403
  'machines.list': MachinesListParams;
1404
+ 'machines.detail': MachineDetailParams;
1164
1405
  'skills.list': SkillsListParams;
1165
1406
  'threadTemplates.get': ThreadTemplatesGetParams;
1407
+ 'threadTemplates.detail': ThreadTemplateDetailParams;
1166
1408
  'system.daemonStatus': SystemDaemonStatusParams;
1167
1409
  'system.rateLimitStatus': SystemRateLimitStatusParams;
1168
1410
  }
@@ -1187,10 +1429,13 @@ export interface QueryReturnMap {
1187
1429
  'config.get': ConfigSnapshot;
1188
1430
  'auth.status': AuthStatusSnapshot;
1189
1431
  'auth.flowState': LoginFlowState | null;
1432
+ 'auth.customProviders': CustomProviderView[];
1190
1433
  'hooks.list': HooksOverview;
1191
1434
  'machines.list': MachineInfo[];
1435
+ 'machines.detail': MachineDetail;
1192
1436
  'skills.list': SkillGroup[];
1193
1437
  'threadTemplates.get': ThreadTemplateEntry[];
1438
+ 'threadTemplates.detail': ThreadTemplateDetail;
1194
1439
  'system.daemonStatus': SystemDaemonStatus;
1195
1440
  'system.rateLimitStatus': SystemRateLimitStatus;
1196
1441
  }
@@ -1205,6 +1450,7 @@ export interface MutateArgsMap {
1205
1450
  'sessions.markRead': SessionsMarkReadArgs;
1206
1451
  'sessions.answerQuestion': SessionsAnswerQuestionArgs;
1207
1452
  'sessions.respondPlan': SessionsRespondPlanArgs;
1453
+ 'sessions.cancelResume': SessionsCancelResumeArgs;
1208
1454
  'sessions.rewind': SessionsRewindArgs;
1209
1455
  'threads.cancel': ThreadsCancelArgs;
1210
1456
  'executions.cancel': ExecutionsCancelArgs;
@@ -1212,6 +1458,7 @@ export interface MutateArgsMap {
1212
1458
  'schedules.resume': ScheduleActionArgs;
1213
1459
  'schedules.remove': ScheduleActionArgs;
1214
1460
  'schedules.add': ScheduleAddArgs;
1461
+ 'schedules.update': ScheduleUpdateArgs;
1215
1462
  'tasks.claim': TaskActionArgs;
1216
1463
  'tasks.unclaim': TaskActionArgs;
1217
1464
  'tasks.complete': TaskCompleteArgs;
@@ -1232,12 +1479,21 @@ export interface MutateArgsMap {
1232
1479
  'auth.respondPrompt': AuthRespondPromptArgs;
1233
1480
  'auth.cancelFlow': AuthCancelFlowArgs;
1234
1481
  'auth.logout': AuthLogoutArgs;
1482
+ 'auth.upsertCustomProvider': AuthUpsertCustomProviderArgs;
1483
+ 'auth.removeCustomProvider': AuthRemoveCustomProviderArgs;
1235
1484
  'hooks.create': HooksCreateArgs;
1236
1485
  'hooks.update': HooksUpdateArgs;
1237
1486
  'hooks.setEnabled': HooksSetEnabledArgs;
1238
1487
  'hooks.remove': HooksRemoveArgs;
1239
1488
  'hooks.test': HooksTestArgs;
1489
+ 'profiles.create': ProfilesCreateArgs;
1490
+ 'profiles.update': ProfilesUpdateArgs;
1491
+ 'profiles.remove': ProfilesRemoveArgs;
1492
+ 'threadTemplates.validate': ThreadTemplatesValidateArgs;
1493
+ 'threadTemplates.save': ThreadTemplatesSaveArgs;
1494
+ 'threadTemplates.remove': ThreadTemplatesRemoveArgs;
1240
1495
  'system.restart': SystemRestartArgs;
1496
+ 'system.clearRateLimit': SystemClearRateLimitArgs;
1241
1497
  }
1242
1498
  export interface MutateReturnMap {
1243
1499
  'projects.create': ProjectCreateReturn;
@@ -1250,6 +1506,7 @@ export interface MutateReturnMap {
1250
1506
  'sessions.markRead': void;
1251
1507
  'sessions.answerQuestion': SessionsInteractionMutateReturn;
1252
1508
  'sessions.respondPlan': SessionsInteractionMutateReturn;
1509
+ 'sessions.cancelResume': SessionsCancelResumeReturn;
1253
1510
  'sessions.rewind': SessionsRewindReturn;
1254
1511
  'threads.cancel': ThreadsCancelReturn;
1255
1512
  'executions.cancel': ExecutionsCancelReturn;
@@ -1257,6 +1514,7 @@ export interface MutateReturnMap {
1257
1514
  'schedules.resume': void;
1258
1515
  'schedules.remove': void;
1259
1516
  'schedules.add': ScheduleInfo;
1517
+ 'schedules.update': ScheduleInfo;
1260
1518
  'tasks.claim': void;
1261
1519
  'tasks.unclaim': void;
1262
1520
  'tasks.complete': void;
@@ -1277,12 +1535,21 @@ export interface MutateReturnMap {
1277
1535
  'auth.respondPrompt': LoginFlowState;
1278
1536
  'auth.cancelFlow': LoginFlowState;
1279
1537
  'auth.logout': AuthLogoutReturn;
1538
+ 'auth.upsertCustomProvider': CustomProviderView;
1539
+ 'auth.removeCustomProvider': AuthRemoveCustomProviderReturn;
1280
1540
  'hooks.create': HooksCreateReturn;
1281
1541
  'hooks.update': HooksUpdateReturn;
1282
1542
  'hooks.setEnabled': HooksSetEnabledReturn;
1283
1543
  'hooks.remove': HooksRemoveReturn;
1284
1544
  'hooks.test': HooksTestReturn;
1545
+ 'profiles.create': ProfilesCreateReturn;
1546
+ 'profiles.update': ProfilesUpdateReturn;
1547
+ 'profiles.remove': ProfilesRemoveReturn;
1548
+ 'threadTemplates.validate': ThreadTemplatesValidateReturn;
1549
+ 'threadTemplates.save': ThreadTemplatesSaveReturn;
1550
+ 'threadTemplates.remove': ThreadTemplatesRemoveReturn;
1285
1551
  'system.restart': SystemRestartReturn;
1552
+ 'system.clearRateLimit': SystemClearRateLimitReturn;
1286
1553
  }
1287
1554
  export type QueryParams<S extends QueryScope> = S extends keyof QueryParamMap ? QueryParamMap[S] : never;
1288
1555
  export type QueryReturn<S extends QueryScope> = S extends keyof QueryReturnMap ? QueryReturnMap[S] : never;
@@ -1308,6 +1575,8 @@ export interface UiServiceDeps {
1308
1575
  getAuthStatus?: () => Promise<AuthStatusSnapshot>;
1309
1576
  authLogin?: AuthLoginService;
1310
1577
  logoutAccount?: (input: LogoutAccountInput) => Promise<AuthLogoutResult>;
1578
+ /** Files custom providers are read from and written to; defaults to the host's own two files. */
1579
+ customProviderStores?: CustomProviderStores;
1311
1580
  projectStore: {
1312
1581
  list(): Project[];
1313
1582
  get(id: string): Project | undefined;
@@ -1407,6 +1676,18 @@ export interface UiServiceDeps {
1407
1676
  sessionName: string;
1408
1677
  channel: string;
1409
1678
  }>;
1679
+ /**
1680
+ * Convert a scheduled run's session into a normal direct web session before a reply is sent
1681
+ * (design 27b: replying adopts the run — it leaves the schedule grouping and becomes a normal
1682
+ * conversation; the next fire starts a fresh session). Injected in the entry layer (app.ts) to
1683
+ * the domain `adoptScheduledSession` primitive. Returns the adopted channel, or null when the
1684
+ * session is unknown. Optional — the send handler returns not-available when absent.
1685
+ */
1686
+ adoptScheduledSession?: (opts: {
1687
+ sessionId: string;
1688
+ }) => Promise<{
1689
+ channel: string;
1690
+ } | null>;
1410
1691
  /**
1411
1692
  * Move files uploaded under a draft upload id to the real session's attachment directory
1412
1693
  * and return updated AttachmentMeta with corrected paths. No-op when draftUploadId is null.
@@ -1464,6 +1745,9 @@ export interface UiServiceDeps {
1464
1745
  target?: ScheduleTarget;
1465
1746
  fallback?: 'fresh' | 'skip' | 'wait';
1466
1747
  }): Promise<ScheduleTask>;
1748
+ /** Patch an existing schedule (schedules.update). Maps to the real scheduler.update
1749
+ * (validateTaskPatch + retiming + reschedule). Returns null when the id is unknown. */
1750
+ update(id: string, patch: Record<string, unknown>): Promise<ScheduleTask | null>;
1467
1751
  };
1468
1752
  executionRegistry: {
1469
1753
  getExecution(id: string): any | null;
@@ -1501,6 +1785,13 @@ export interface UiServiceDeps {
1501
1785
  ssh?: string;
1502
1786
  win?: boolean;
1503
1787
  }>;
1788
+ /**
1789
+ * Run a read-only shell probe on a connected device and return its stdout (machines.detail).
1790
+ * Optional so servers/tests without the remote transport degrade to a reported probeError
1791
+ * rather than fabricating empty telemetry. The command is built server-side — callers never
1792
+ * forward user input into it.
1793
+ */
1794
+ probeMachine?(device: string, command: string, timeoutMs: number): Promise<string>;
1504
1795
  };
1505
1796
  bus: EventBus;
1506
1797
  adapter: PlatformAdapter;
@@ -16,24 +16,30 @@ import { handleNotesList } from './query/notes.js';
16
16
  import { handleCostSummary } from './query/cost.js';
17
17
  import { handleConfigGet } from './query/config.js';
18
18
  import { handleAuthFlowState, handleAuthStatus } from './query/auth.js';
19
+ import { handleCustomProvidersList } from './query/custom-providers.js';
19
20
  import { handleHooksList } from './query/hooks.js';
20
21
  import { handleMachinesList } from './query/machines.js';
22
+ import { handleMachineDetail } from './query/machine-detail.js';
21
23
  import { handleSkillsList } from './query/skills.js';
22
24
  import { handleThreadTemplatesGet } from './query/thread-templates.js';
25
+ import { handleThreadTemplatesDetail } from './query/thread-template-detail.js';
23
26
  import { handleSystemDaemonStatus, handleSystemRateLimitStatus } from './query/system.js';
24
27
  import { handleConfigSet } from './mutate/config.js';
25
28
  import { handleHooksCreate, handleHooksUpdate, handleHooksSetEnabled, handleHooksRemove, handleHooksTest, } from './mutate/hooks.js';
29
+ import { handleProfilesCreate, handleProfilesUpdate, handleProfilesRemove, } from './mutate/profiles.js';
30
+ import { handleThreadTemplatesValidate, handleThreadTemplatesSave, handleThreadTemplatesRemove, } from './mutate/thread-templates.js';
26
31
  import { handleCreateProject } from './mutate/projects.js';
27
- import { handleCreateSession, handleSendSession, handleCancelSession, handleCompactSession, handleSetProfile, handleCreateAndSend, handleMarkReadSession, handleAnswerQuestion, handleRespondPlan, handleRewindSession } from './mutate/sessions.js';
32
+ import { handleCreateSession, handleSendSession, handleCancelSession, handleCompactSession, handleSetProfile, handleCreateAndSend, handleMarkReadSession, handleAnswerQuestion, handleRespondPlan, handleCancelResume, handleRewindSession } from './mutate/sessions.js';
28
33
  import { handleCancelThread } from './mutate/threads.js';
29
34
  import { handleCancelExecution } from './mutate/executions.js';
30
- import { handlePauseSchedule, handleResumeSchedule, handleRemoveSchedule, handleAddSchedule, } from './mutate/schedules.js';
35
+ import { handlePauseSchedule, handleResumeSchedule, handleRemoveSchedule, handleAddSchedule, handleUpdateSchedule, } from './mutate/schedules.js';
31
36
  import { handleClaimTask, handleUnclaimTask, handleCompleteTask, handleBlockTask, handleUnblockTask, } from './mutate/tasks.js';
32
37
  import { handleApproveApproval, handleRejectApproval, handleRequestApproval } from './mutate/approvals.js';
33
38
  import { handleIssuesDelete, handleIssuesHandle } from './mutate/issues.js';
34
39
  import { handleNotesAdd, handleNotesClearCompleted, handleNotesDelete, handleNotesSetCompleted, handleNotesUpdate, } from './mutate/notes.js';
35
- import { handleSystemRestart } from './mutate/system.js';
40
+ import { handleSystemRestart, handleSystemClearRateLimit } from './mutate/system.js';
36
41
  import { handleAuthCancelFlow, handleAuthLogout, handleAuthRespondPrompt, handleAuthStartLogin, } from './mutate/auth.js';
42
+ import { handleCustomProviderRemove, handleCustomProviderUpsert, } from './mutate/custom-providers.js';
37
43
  import { createSubscription } from './subscribe.js';
38
44
  import { resolveExecutionLogLocation } from '../executions/log-tailer.js';
39
45
  const queryHandlers = {
@@ -57,10 +63,13 @@ const queryHandlers = {
57
63
  'config.get': (deps, params) => handleConfigGet(deps, params),
58
64
  'auth.status': (deps, params) => handleAuthStatus(params, deps.getAuthStatus),
59
65
  'auth.flowState': (deps, params) => handleAuthFlowState(params, deps.authLogin?.getState),
66
+ 'auth.customProviders': (deps, params) => handleCustomProvidersList(deps, params),
60
67
  'hooks.list': (deps, params) => handleHooksList(deps, params),
61
68
  'machines.list': (deps, params) => handleMachinesList(deps, params),
69
+ 'machines.detail': (deps, params) => handleMachineDetail(deps, params),
62
70
  'skills.list': (deps, params) => handleSkillsList(deps, params),
63
71
  'threadTemplates.get': (deps, params) => handleThreadTemplatesGet(deps, params),
72
+ 'threadTemplates.detail': (deps, params) => handleThreadTemplatesDetail(deps, params),
64
73
  'system.daemonStatus': (_deps, params) => handleSystemDaemonStatus(params),
65
74
  'system.rateLimitStatus': (_deps, params) => handleSystemRateLimitStatus(params),
66
75
  };
@@ -75,6 +84,7 @@ const mutateHandlers = {
75
84
  'sessions.markRead': (deps, args) => handleMarkReadSession(deps, args),
76
85
  'sessions.answerQuestion': (deps, args) => handleAnswerQuestion(deps, args),
77
86
  'sessions.respondPlan': (deps, args) => handleRespondPlan(deps, args),
87
+ 'sessions.cancelResume': (_deps, args) => handleCancelResume(args),
78
88
  'sessions.rewind': (deps, args) => handleRewindSession(deps, args),
79
89
  'threads.cancel': (deps, args) => handleCancelThread(deps, args),
80
90
  'executions.cancel': (deps, args) => handleCancelExecution(deps, args),
@@ -82,6 +92,7 @@ const mutateHandlers = {
82
92
  'schedules.resume': (deps, args) => handleResumeSchedule(deps, args),
83
93
  'schedules.remove': (deps, args) => handleRemoveSchedule(deps, args),
84
94
  'schedules.add': (deps, args) => handleAddSchedule(deps, args),
95
+ 'schedules.update': (deps, args) => handleUpdateSchedule(deps, args),
85
96
  'tasks.claim': (deps, args) => handleClaimTask(deps, args),
86
97
  'tasks.unclaim': (deps, args) => handleUnclaimTask(deps, args),
87
98
  'tasks.complete': (deps, args) => handleCompleteTask(deps, args),
@@ -102,12 +113,21 @@ const mutateHandlers = {
102
113
  'auth.respondPrompt': (deps, args) => handleAuthRespondPrompt(deps, args),
103
114
  'auth.cancelFlow': (deps, args) => handleAuthCancelFlow(deps, args),
104
115
  'auth.logout': (deps, args) => handleAuthLogout(deps, args),
116
+ 'auth.upsertCustomProvider': (deps, args) => handleCustomProviderUpsert(deps, args),
117
+ 'auth.removeCustomProvider': (deps, args) => handleCustomProviderRemove(deps, args),
105
118
  'hooks.create': (deps, args) => handleHooksCreate(deps, args),
106
119
  'hooks.update': (deps, args) => handleHooksUpdate(deps, args),
107
120
  'hooks.setEnabled': (deps, args) => handleHooksSetEnabled(deps, args),
108
121
  'hooks.remove': (deps, args) => handleHooksRemove(deps, args),
109
122
  'hooks.test': (deps, args) => handleHooksTest(deps, args),
123
+ 'profiles.create': (deps, args) => handleProfilesCreate(deps, args),
124
+ 'profiles.update': (deps, args) => handleProfilesUpdate(deps, args),
125
+ 'profiles.remove': (deps, args) => handleProfilesRemove(deps, args),
126
+ 'threadTemplates.validate': (deps, args) => handleThreadTemplatesValidate(deps, args),
127
+ 'threadTemplates.save': (deps, args) => handleThreadTemplatesSave(deps, args),
128
+ 'threadTemplates.remove': (deps, args) => handleThreadTemplatesRemove(deps, args),
110
129
  'system.restart': (_deps, args) => handleSystemRestart(args),
130
+ 'system.clearRateLimit': (_deps, args) => handleSystemClearRateLimit(args),
111
131
  };
112
132
  export function redactMutationAuditArgs(op, args) {
113
133
  if (!args || typeof args !== 'object')
@@ -116,6 +136,10 @@ export function redactMutationAuditArgs(op, args) {
116
136
  const { flowId } = args;
117
137
  return { flowId };
118
138
  }
139
+ if (op === 'auth.upsertCustomProvider') {
140
+ const { apiKey: _upstreamKey, ...safe } = args;
141
+ return safe;
142
+ }
119
143
  if (!op.startsWith('notes.'))
120
144
  return args;
121
145
  const { text: _privateText, ...safe } = args;