@cortex-agent/server 2026.8.3 → 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 (224) 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/core/utils.d.ts +21 -1
  67. package/dist/core/utils.js +37 -1
  68. package/dist/domain/agent-run/agent-run-cli.js +3 -1
  69. package/dist/domain/agent-run/benchmark-local-thread-orchestrator.d.ts +31 -0
  70. package/dist/domain/agent-run/benchmark-local-thread-orchestrator.js +231 -24
  71. package/dist/domain/agent-run/benchmark-thread-identity.d.ts +15 -2
  72. package/dist/domain/agent-run/benchmark-thread-identity.js +123 -34
  73. package/dist/domain/agent-run/identity.d.ts +5 -0
  74. package/dist/domain/agent-run/identity.js +4 -1
  75. package/dist/domain/agent-run/journal.d.ts +3 -2
  76. package/dist/domain/agent-run/manifest.js +11 -4
  77. package/dist/domain/agent-run/pinned-node-process.d.ts +4 -0
  78. package/dist/domain/agent-run/pinned-node-process.js +9 -0
  79. package/dist/domain/agent-run/role-surface.d.ts +2 -2
  80. package/dist/domain/agent-run/role-surface.js +7 -3
  81. package/dist/domain/agent-run/run-config.d.ts +10 -1
  82. package/dist/domain/agent-run/run-config.js +57 -6
  83. package/dist/domain/agent-run/runner.js +149 -31
  84. package/dist/domain/agents/facade.d.ts +37 -122
  85. package/dist/domain/agents/facade.js +47 -115
  86. package/dist/domain/agents/spawn-config.d.ts +135 -0
  87. package/dist/domain/agents/spawn-config.js +121 -0
  88. package/dist/domain/benchmark/accounting-reconciliation.d.ts +98 -0
  89. package/dist/domain/benchmark/accounting-reconciliation.js +218 -0
  90. package/dist/domain/benchmark/arm-schema.d.ts +43 -0
  91. package/dist/domain/benchmark/arm-schema.js +243 -0
  92. package/dist/domain/benchmark/capabilities.d.ts +4 -0
  93. package/dist/domain/benchmark/capabilities.js +54 -0
  94. package/dist/domain/benchmark/decimal-text.d.ts +27 -0
  95. package/dist/domain/benchmark/decimal-text.js +67 -0
  96. package/dist/domain/benchmark/lease-echo.d.ts +43 -0
  97. package/dist/domain/benchmark/lease-echo.js +56 -0
  98. package/dist/domain/benchmark/policy-backed-runtime-deps.d.ts +14 -0
  99. package/dist/domain/benchmark/policy-backed-runtime-deps.js +47 -0
  100. package/dist/domain/benchmark/policy-compiler.d.ts +68 -0
  101. package/dist/domain/benchmark/policy-compiler.js +680 -0
  102. package/dist/domain/benchmark/resolved-policy.d.ts +110 -0
  103. package/dist/domain/benchmark/resolved-policy.js +195 -0
  104. package/dist/domain/benchmark/trial-adapter-factory.d.ts +38 -0
  105. package/dist/domain/benchmark/trial-adapter-factory.js +165 -0
  106. package/dist/domain/benchmark/trial-thread-adapter.d.ts +25 -0
  107. package/dist/domain/benchmark/trial-thread-adapter.js +106 -0
  108. package/dist/domain/benchmark/variant-proposal.d.ts +45 -0
  109. package/dist/domain/benchmark/variant-proposal.js +42 -0
  110. package/dist/domain/benchmark/workspace-lease.d.ts +99 -0
  111. package/dist/domain/benchmark/workspace-lease.js +272 -0
  112. package/dist/domain/costs/codex-quota.d.ts +29 -0
  113. package/dist/domain/costs/codex-quota.js +102 -0
  114. package/dist/domain/costs/cost-tracker.d.ts +48 -9
  115. package/dist/domain/costs/cost-tracker.js +74 -18
  116. package/dist/domain/costs/rate-limit-throttle.d.ts +23 -1
  117. package/dist/domain/costs/rate-limit-throttle.js +61 -6
  118. package/dist/domain/costs/resume-registry.d.ts +3 -1
  119. package/dist/domain/costs/resume-registry.js +10 -1
  120. package/dist/domain/mcp/tools/benchmark-thread-run.d.ts +26 -2
  121. package/dist/domain/mcp/tools/benchmark-thread-run.js +63 -20
  122. package/dist/domain/mcp/tools/cost.js +15 -6
  123. package/dist/domain/pi-providers/custom-provider-model.d.ts +53 -0
  124. package/dist/domain/pi-providers/custom-provider-model.js +122 -0
  125. package/dist/domain/pi-providers/custom-provider-service.d.ts +59 -0
  126. package/dist/domain/pi-providers/custom-provider-service.js +143 -0
  127. package/dist/domain/pi-providers/gateway-route-store.d.ts +23 -0
  128. package/dist/domain/pi-providers/gateway-route-store.js +78 -0
  129. package/dist/domain/pi-providers/index.d.ts +4 -0
  130. package/dist/domain/pi-providers/index.js +8 -0
  131. package/dist/domain/pi-providers/models-json-store.d.ts +6 -0
  132. package/dist/domain/pi-providers/models-json-store.js +77 -0
  133. package/dist/domain/remote/client-hot-reload.d.ts +9 -1
  134. package/dist/domain/remote/client-hot-reload.js +60 -12
  135. package/dist/domain/scheduling/jobs/_shared.d.ts +4 -1
  136. package/dist/domain/scheduling/jobs/_shared.js +11 -2
  137. package/dist/domain/scheduling/jobs/scheduled-task.js +1 -0
  138. package/dist/domain/scheduling/jobs/task-dispatch.js +49 -54
  139. package/dist/domain/sessions/session-lifecycle.d.ts +22 -0
  140. package/dist/domain/sessions/session-lifecycle.js +20 -1
  141. package/dist/domain/system/install-cli.js +8 -3
  142. package/dist/domain/system/system-notice.d.ts +4 -1
  143. package/dist/domain/system/system-notice.js +6 -2
  144. package/dist/domain/tasks/dispatch-utils.d.ts +0 -4
  145. package/dist/domain/tasks/dispatch-utils.js +24 -37
  146. package/dist/domain/threads/runner.d.ts +16 -1
  147. package/dist/domain/threads/runner.js +62 -8
  148. package/dist/domain/threads/template-loader.d.ts +5 -0
  149. package/dist/domain/threads/template-loader.js +120 -36
  150. package/dist/domain/threads/template-validate.d.ts +244 -0
  151. package/dist/domain/threads/template-validate.js +574 -0
  152. package/dist/domain/threads/template-validate.parity.d.ts +1 -0
  153. package/dist/domain/threads/template-validate.parity.js +47 -0
  154. package/dist/domain/threads/template-writer.d.ts +55 -0
  155. package/dist/domain/threads/template-writer.js +131 -0
  156. package/dist/domain/ui-service/app-router.d.ts +143 -1
  157. package/dist/domain/ui-service/app-router.js +29 -3
  158. package/dist/domain/ui-service/input-schemas.d.ts +228 -4
  159. package/dist/domain/ui-service/input-schemas.js +132 -1
  160. package/dist/domain/ui-service/mutate/config.d.ts +10 -1
  161. package/dist/domain/ui-service/mutate/config.js +45 -5
  162. package/dist/domain/ui-service/mutate/custom-providers.d.ts +8 -0
  163. package/dist/domain/ui-service/mutate/custom-providers.js +37 -0
  164. package/dist/domain/ui-service/mutate/profiles.d.ts +21 -0
  165. package/dist/domain/ui-service/mutate/profiles.js +156 -0
  166. package/dist/domain/ui-service/mutate/schedules.d.ts +2 -1
  167. package/dist/domain/ui-service/mutate/schedules.js +53 -3
  168. package/dist/domain/ui-service/mutate/sessions.d.ts +2 -1
  169. package/dist/domain/ui-service/mutate/sessions.js +25 -1
  170. package/dist/domain/ui-service/mutate/system.d.ts +2 -1
  171. package/dist/domain/ui-service/mutate/system.js +17 -3
  172. package/dist/domain/ui-service/mutate/thread-templates.d.ts +4 -0
  173. package/dist/domain/ui-service/mutate/thread-templates.js +71 -0
  174. package/dist/domain/ui-service/query/config.js +30 -0
  175. package/dist/domain/ui-service/query/custom-providers.d.ts +8 -0
  176. package/dist/domain/ui-service/query/custom-providers.js +13 -0
  177. package/dist/domain/ui-service/query/machine-detail.d.ts +2 -0
  178. package/dist/domain/ui-service/query/machine-detail.js +56 -0
  179. package/dist/domain/ui-service/query/machine-probe.d.ts +18 -0
  180. package/dist/domain/ui-service/query/machine-probe.js +136 -0
  181. package/dist/domain/ui-service/query/schedules.js +5 -0
  182. package/dist/domain/ui-service/query/sessions.js +8 -2
  183. package/dist/domain/ui-service/query/thread-template-detail.d.ts +8 -0
  184. package/dist/domain/ui-service/query/thread-template-detail.js +94 -0
  185. package/dist/domain/ui-service/query/thread-templates.d.ts +5 -3
  186. package/dist/domain/ui-service/query/thread-templates.js +44 -7
  187. package/dist/domain/ui-service/types.d.ts +298 -7
  188. package/dist/domain/ui-service/ui-service.js +27 -3
  189. package/dist/entry/app.js +24 -3
  190. package/dist/entry/auth-cli.d.ts +4 -1
  191. package/dist/entry/auth-cli.js +10 -2
  192. package/dist/entry/cli-help.js +6 -2
  193. package/dist/entry/cli.js +2 -1
  194. package/dist/entry/daemon.d.ts +0 -11
  195. package/dist/entry/daemon.js +5 -49
  196. package/dist/entry/provider-cli.d.ts +16 -0
  197. package/dist/entry/provider-cli.js +203 -0
  198. package/dist/events/event-types.d.ts +2 -1
  199. package/dist/orchestration/agent-runner.js +3 -2
  200. package/dist/orchestration/routing/commands/cost.d.ts +8 -0
  201. package/dist/orchestration/routing/commands/cost.js +93 -21
  202. package/dist/orchestration/routing/commands/login-custom.d.ts +26 -0
  203. package/dist/orchestration/routing/commands/login-custom.js +89 -0
  204. package/dist/orchestration/routing/commands/login.d.ts +3 -0
  205. package/dist/orchestration/routing/commands/login.js +7 -0
  206. package/dist/orchestration/routing/message-router.js +48 -33
  207. package/dist/orchestration/routing/webhook.js +1 -1
  208. package/dist/orchestration/session-events.d.ts +2 -1
  209. package/dist/orchestration/session-events.js +1 -0
  210. package/dist/orchestration/thread-callback.js +1 -1
  211. package/dist/store/conversation-history-repo.d.ts +5 -1
  212. package/dist/store/conversation-history-repo.js +2 -1
  213. package/dist/store/cost-repo.d.ts +17 -0
  214. package/dist/store/cost-repo.js +47 -5
  215. package/dist/store/profile-repo.d.ts +0 -10
  216. package/dist/store/profile-repo.js +34 -56
  217. package/dist/store/session-registry-repo.d.ts +12 -0
  218. package/dist/store/session-registry-repo.js +16 -0
  219. package/package.json +1 -1
  220. package/web/dist/assets/index-DYMfaAi4.css +1 -0
  221. package/web/dist/assets/index-uOoZjGKa.js +141 -0
  222. package/web/dist/index.html +2 -2
  223. package/web/dist/assets/index-DrNx9R6c.js +0 -139
  224. package/web/dist/assets/index-zpf3OSKC.css +0 -1
@@ -0,0 +1,131 @@
1
+ // input: a thread-templates directory + an entity kind/name/body and the hash it was read at
2
+ // output: readEntity / saveEntity / removeEntity / entityPath — validated, atomic, guarded writes
3
+ // pos: The write half of the thread-template config, mirroring store/hook-writer.ts. Nothing
4
+ // wrote these files before except the one-time legacy migration, so every rule about what
5
+ // may be written lives here: the filename IS the identity (the loader keys on the basename
6
+ // and skips a file whose `name` disagrees), validation errors block the write, and an
7
+ // optimistic baseHash stops a stale editor from clobbering an edit that landed underneath
8
+ // it — a real risk because the config is git-synced across machines and hot-reloaded.
9
+ // Deletes are reference-guarded. No backups: the directory is git-tracked, so git is undo.
10
+ // >>> If I am updated, update my header comment and the parent folder's CORTEX.md <<<
11
+ import { createHash } from 'node:crypto';
12
+ import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync } from 'node:fs';
13
+ import * as path from 'node:path';
14
+ import { atomicWriteSync } from '../../core/atomic-write.js';
15
+ import { validateEntity, withCandidate, rawRegistryFromDir, dependentTemplates, } from './template-validate.js';
16
+ /** Filename-safe entity name: rules out path separators, `..`, and leading punctuation. */
17
+ const NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
18
+ const SUBDIR = {
19
+ agent: 'agents',
20
+ template: 'templates',
21
+ shell: 'shells',
22
+ };
23
+ function writeError(code, message, issues) {
24
+ return Object.assign(new Error(message), { code, ...(issues ? { issues } : {}) });
25
+ }
26
+ export function sha256(text) {
27
+ return createHash('sha256').update(text, 'utf8').digest('hex');
28
+ }
29
+ export function entityPath(dir, kind, name) {
30
+ return path.join(dir, SUBDIR[kind], `${name}.json`);
31
+ }
32
+ function assertName(name) {
33
+ if (typeof name !== 'string' || !NAME_PATTERN.test(name)) {
34
+ throw writeError('invalid-args', `Name '${String(name)}' must start with a letter or digit and contain only letters, digits, '-' and '_'`);
35
+ }
36
+ }
37
+ /** `JSON.stringify(…, 2)` + trailing newline — the format the migration writer already produced. */
38
+ function serialize(body) {
39
+ return `${JSON.stringify(body, null, 2)}\n`;
40
+ }
41
+ const io = {
42
+ readdirSync: (p) => readdirSync(p),
43
+ readFileSync: (p, enc) => readFileSync(p, enc),
44
+ existsSync,
45
+ join: path.join,
46
+ };
47
+ export function readEntity(dir, kind, name) {
48
+ assertName(name);
49
+ const filePath = entityPath(dir, kind, name);
50
+ if (!existsSync(filePath)) {
51
+ throw writeError('not-found', `Unknown ${kind}: '${name}'`);
52
+ }
53
+ const raw = readFileSync(filePath, 'utf8');
54
+ let body = null;
55
+ try {
56
+ const parsed = JSON.parse(raw);
57
+ if (parsed && typeof parsed === 'object' && !Array.isArray(parsed))
58
+ body = parsed;
59
+ }
60
+ catch {
61
+ body = null;
62
+ }
63
+ return { kind, name, filePath, body, sha256: sha256(raw) };
64
+ }
65
+ /**
66
+ * Create or replace one entity file. The body is the complete desired state — omitted fields are
67
+ * removed, not merged, because the editor always holds the whole document.
68
+ *
69
+ * Validation runs against the registry with this candidate already swapped in, so a change is
70
+ * judged by the world it produces rather than the one it replaces. Errors block the write.
71
+ */
72
+ export function saveEntity(dir, input, refs) {
73
+ const { kind, name, body, baseHash } = input;
74
+ assertName(name);
75
+ if (!body || typeof body !== 'object' || Array.isArray(body)) {
76
+ throw writeError('invalid-args', 'Body must be a JSON object');
77
+ }
78
+ const filePath = entityPath(dir, kind, name);
79
+ const exists = existsSync(filePath);
80
+ const current = exists ? readFileSync(filePath, 'utf8') : null;
81
+ if (baseHash === null && exists) {
82
+ throw writeError('invalid-args', `${kind} '${name}' already exists`);
83
+ }
84
+ if (baseHash !== null && !exists) {
85
+ throw writeError('not-found', `Unknown ${kind}: '${name}'`);
86
+ }
87
+ if (baseHash !== null && current !== null && sha256(current) !== baseHash) {
88
+ throw writeError('conflict', `${kind} '${name}' changed on disk since it was loaded — reload before saving to avoid discarding that edit`);
89
+ }
90
+ const registry = withCandidate(rawRegistryFromDir(dir, io), kind, name, body);
91
+ const { errors, warnings } = validateEntity(kind, name, body, registry, refs);
92
+ if (errors.length > 0) {
93
+ throw writeError('invalid-args', `${kind} '${name}' is not valid: ${errors.map((e) => `${e.path}: ${e.message}`).join('; ')}`, errors);
94
+ }
95
+ const next = serialize(body);
96
+ const changed = current !== next;
97
+ if (changed) {
98
+ mkdirSync(path.dirname(filePath), { recursive: true });
99
+ atomicWriteSync(filePath, next);
100
+ }
101
+ return { changed, filePath, warnings, sha256: sha256(next) };
102
+ }
103
+ /**
104
+ * Delete one entity file. Refuses while another template still declares this agent or binds this
105
+ * shell — the loader would keep skipping that template, and any thread on it would stall.
106
+ * Templates themselves have no config-level dependents; task and running-thread references are the
107
+ * caller's to check, since they live outside this directory.
108
+ */
109
+ export function removeEntity(dir, kind, name) {
110
+ assertName(name);
111
+ const filePath = entityPath(dir, kind, name);
112
+ if (!existsSync(filePath)) {
113
+ throw writeError('not-found', `Unknown ${kind}: '${name}'`);
114
+ }
115
+ const dependents = dependentTemplates(kind, name, rawRegistryFromDir(dir, io));
116
+ if (dependents.length > 0) {
117
+ throw writeError('invalid-args', `${kind} '${name}' is still used by ${dependents.length} template(s): ${dependents.join(', ')}`);
118
+ }
119
+ rmSync(filePath, { force: true });
120
+ return { removed: true, filePath };
121
+ }
122
+ /** Every entity name present on disk, by kind. */
123
+ export function listEntityNames(dir, kind) {
124
+ const full = path.join(dir, SUBDIR[kind]);
125
+ if (!existsSync(full))
126
+ return [];
127
+ return readdirSync(full)
128
+ .filter((f) => f.endsWith('.json'))
129
+ .map((f) => f.slice(0, -'.json'.length))
130
+ .sort();
131
+ }
@@ -138,6 +138,13 @@ export declare function createAppRouter(service: UiService): import("@trpc/serve
138
138
  output: import("./types.js").SessionsInteractionMutateReturn;
139
139
  meta: object;
140
140
  }>;
141
+ cancelResume: import("@trpc/server").TRPCMutationProcedure<{
142
+ input: {
143
+ sessionId: string;
144
+ };
145
+ output: import("./types.js").SessionsCancelResumeReturn;
146
+ meta: object;
147
+ }>;
141
148
  rewind: import("@trpc/server").TRPCMutationProcedure<{
142
149
  input: {
143
150
  sessionId: string;
@@ -305,6 +312,19 @@ export declare function createAppRouter(service: UiService): import("@trpc/serve
305
312
  output: import("./types.js").ScheduleInfo;
306
313
  meta: object;
307
314
  }>;
315
+ update: import("@trpc/server").TRPCMutationProcedure<{
316
+ input: {
317
+ scheduleId: string;
318
+ message?: string;
319
+ projectId?: string;
320
+ profile?: string;
321
+ intervalMs?: number;
322
+ time?: string;
323
+ dayOfWeek?: number;
324
+ };
325
+ output: import("./types.js").ScheduleInfo;
326
+ meta: object;
327
+ }>;
308
328
  }>>;
309
329
  executions: import("@trpc/server").TRPCBuiltRouter<{
310
330
  ctx: object;
@@ -515,7 +535,8 @@ export declare function createAppRouter(service: UiService): import("@trpc/serve
515
535
  set: import("@trpc/server").TRPCMutationProcedure<{
516
536
  input: {
517
537
  section: "budget";
518
- value: {
538
+ project?: string;
539
+ value?: {
519
540
  daily_usd: number;
520
541
  monthly_usd: number;
521
542
  };
@@ -555,6 +576,48 @@ export declare function createAppRouter(service: UiService): import("@trpc/serve
555
576
  meta: object;
556
577
  }>;
557
578
  }>>;
579
+ profiles: import("@trpc/server").TRPCBuiltRouter<{
580
+ ctx: object;
581
+ meta: object;
582
+ errorShape: import("@trpc/server").TRPCDefaultErrorShape;
583
+ transformer: false;
584
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
585
+ create: import("@trpc/server").TRPCMutationProcedure<{
586
+ input: {
587
+ model: string;
588
+ name: string;
589
+ backend?: "claude" | "pi";
590
+ mode?: string;
591
+ provider?: string;
592
+ thinking?: string;
593
+ claudeBackend?: "print" | "tui";
594
+ extraOption?: Record<string, string>;
595
+ };
596
+ output: import("./types.js").ProfilesCreateReturn;
597
+ meta: object;
598
+ }>;
599
+ update: import("@trpc/server").TRPCMutationProcedure<{
600
+ input: {
601
+ model: string;
602
+ name: string;
603
+ backend?: "claude" | "pi";
604
+ mode?: string;
605
+ provider?: string;
606
+ thinking?: string;
607
+ claudeBackend?: "print" | "tui";
608
+ extraOption?: Record<string, string>;
609
+ };
610
+ output: import("./types.js").ProfilesUpdateReturn;
611
+ meta: object;
612
+ }>;
613
+ remove: import("@trpc/server").TRPCMutationProcedure<{
614
+ input: {
615
+ name: string;
616
+ };
617
+ output: import("./types.js").ProfilesRemoveReturn;
618
+ meta: object;
619
+ }>;
620
+ }>>;
558
621
  auth: import("@trpc/server").TRPCBuiltRouter<{
559
622
  ctx: object;
560
623
  meta: object;
@@ -607,6 +670,36 @@ export declare function createAppRouter(service: UiService): import("@trpc/serve
607
670
  output: import("../auth/logout.js").AuthLogoutSuccess;
608
671
  meta: object;
609
672
  }>;
673
+ customProviders: import("@trpc/server").TRPCQueryProcedure<{
674
+ input: Record<string, never>;
675
+ output: import("./types.js").CustomProviderView[];
676
+ meta: object;
677
+ }>;
678
+ upsertCustomProvider: import("@trpc/server").TRPCMutationProcedure<{
679
+ input: {
680
+ name: string;
681
+ api: "anthropic-messages" | "openai-responses" | "openai-completions" | "google-generative-ai";
682
+ upstreamUrl: string;
683
+ models: {
684
+ id: string;
685
+ contextWindow?: number;
686
+ maxTokens?: number;
687
+ reasoning?: boolean;
688
+ }[];
689
+ apiKey?: string;
690
+ headers?: Record<string, string>;
691
+ compat?: Record<string, unknown>;
692
+ };
693
+ output: import("./types.js").CustomProviderView;
694
+ meta: object;
695
+ }>;
696
+ removeCustomProvider: import("@trpc/server").TRPCMutationProcedure<{
697
+ input: {
698
+ name: string;
699
+ };
700
+ output: import("./types.js").AuthRemoveCustomProviderReturn;
701
+ meta: object;
702
+ }>;
610
703
  }>>;
611
704
  hooks: import("@trpc/server").TRPCBuiltRouter<{
612
705
  ctx: object;
@@ -688,6 +781,13 @@ export declare function createAppRouter(service: UiService): import("@trpc/serve
688
781
  output: import("./types.js").MachineInfo[];
689
782
  meta: object;
690
783
  }>;
784
+ detail: import("@trpc/server").TRPCQueryProcedure<{
785
+ input: {
786
+ machine: string;
787
+ };
788
+ output: import("./types.js").MachineDetail;
789
+ meta: object;
790
+ }>;
691
791
  }>>;
692
792
  skills: import("@trpc/server").TRPCBuiltRouter<{
693
793
  ctx: object;
@@ -712,6 +812,41 @@ export declare function createAppRouter(service: UiService): import("@trpc/serve
712
812
  output: import("./types.js").ThreadTemplateEntry[];
713
813
  meta: object;
714
814
  }>;
815
+ detail: import("@trpc/server").TRPCQueryProcedure<{
816
+ input: {
817
+ kind: "template" | "agent" | "shell";
818
+ name: string;
819
+ };
820
+ output: import("./types.js").ThreadTemplateDetail;
821
+ meta: object;
822
+ }>;
823
+ validate: import("@trpc/server").TRPCMutationProcedure<{
824
+ input: {
825
+ kind: "template" | "agent" | "shell";
826
+ name: string;
827
+ body: Record<string, unknown>;
828
+ };
829
+ output: import("./types.js").ThreadTemplatesValidateReturn;
830
+ meta: object;
831
+ }>;
832
+ save: import("@trpc/server").TRPCMutationProcedure<{
833
+ input: {
834
+ kind: "template" | "agent" | "shell";
835
+ name: string;
836
+ body: Record<string, unknown>;
837
+ baseHash?: string;
838
+ };
839
+ output: import("./types.js").ThreadTemplatesSaveReturn;
840
+ meta: object;
841
+ }>;
842
+ remove: import("@trpc/server").TRPCMutationProcedure<{
843
+ input: {
844
+ kind: "template" | "agent" | "shell";
845
+ name: string;
846
+ };
847
+ output: import("./types.js").ThreadTemplatesRemoveReturn;
848
+ meta: object;
849
+ }>;
715
850
  }>>;
716
851
  system: import("@trpc/server").TRPCBuiltRouter<{
717
852
  ctx: object;
@@ -736,6 +871,13 @@ export declare function createAppRouter(service: UiService): import("@trpc/serve
736
871
  output: import("./types.js").SystemRestartReturn;
737
872
  meta: object;
738
873
  }>;
874
+ clearRateLimit: import("@trpc/server").TRPCMutationProcedure<{
875
+ input: {
876
+ provider?: string;
877
+ };
878
+ output: import("./types.js").SystemClearRateLimitReturn;
879
+ meta: object;
880
+ }>;
739
881
  }>>;
740
882
  subscribe: import("@trpc/server").TRPCSubscriptionProcedure<{
741
883
  input: {
@@ -5,7 +5,7 @@
5
5
  import { TRPCError } from '@trpc/server';
6
6
  import { z } from 'zod';
7
7
  import { router, publicProcedure } from './trpc.js';
8
- import { projectsListInput, projectsCreateInput, sessionsListInput, sessionsTranscriptInput, sessionsCreateInput, sessionsSendInput, sessionsCancelInput, sessionsCompactInput, sessionsSetProfileInput, sessionsCreateAndSendInput, sessionsMarkReadInput, sessionsAnswerQuestionInput, sessionsRespondPlanInput, sessionsRewindInput, sessionsPendingInteractionInput, threadsListInput, threadsGetInput, tasksListInput, taskVerificationInput, schedulesListInput, executionsListInput, executionsGetInput, memoryTreeInput, memoryFileInput, approvalsListInput, approvalsApproveInput, approvalsRejectInput, approvalsRequestInput, issuesListInput, issueActionInput, notesListInput, noteAddInput, noteUpdateInput, noteSetCompletedInput, noteActionInput, notesClearCompletedInput, costSummaryInput, threadsCancelInput, executionsCancelInput, scheduleActionInput, scheduleAddInput, taskActionInput, taskCompleteInput, taskBlockInput, executionsLogInput, configGetInput, configSetInput, authStatusInput, authFlowStateInput, authStartLoginInput, authRespondPromptInput, authCancelFlowInput, authLogoutInput, hooksListInput, hooksCreateInput, hooksUpdateInput, hooksSetEnabledInput, hooksRemoveInput, hooksTestInput, machinesListInput, skillsListInput, threadTemplatesGetInput, systemDaemonStatusInput, systemRateLimitStatusInput, systemRestartInput, } from './input-schemas.js';
8
+ import { projectsListInput, projectsCreateInput, sessionsListInput, sessionsTranscriptInput, sessionsCreateInput, sessionsSendInput, sessionsCancelInput, sessionsCompactInput, sessionsSetProfileInput, sessionsCreateAndSendInput, sessionsMarkReadInput, sessionsAnswerQuestionInput, sessionsRespondPlanInput, sessionsCancelResumeInput, sessionsRewindInput, sessionsPendingInteractionInput, threadsListInput, threadsGetInput, tasksListInput, taskVerificationInput, schedulesListInput, executionsListInput, executionsGetInput, memoryTreeInput, memoryFileInput, approvalsListInput, approvalsApproveInput, approvalsRejectInput, approvalsRequestInput, issuesListInput, issueActionInput, notesListInput, noteAddInput, noteUpdateInput, noteSetCompletedInput, noteActionInput, notesClearCompletedInput, costSummaryInput, threadsCancelInput, executionsCancelInput, scheduleActionInput, scheduleAddInput, scheduleUpdateInput, taskActionInput, taskCompleteInput, taskBlockInput, executionsLogInput, configGetInput, configSetInput, authStatusInput, authFlowStateInput, authStartLoginInput, authRespondPromptInput, authCancelFlowInput, authLogoutInput, authCustomProvidersInput, authUpsertCustomProviderInput, authRemoveCustomProviderInput, hooksListInput, hooksCreateInput, hooksUpdateInput, hooksSetEnabledInput, hooksRemoveInput, hooksTestInput, profilesCreateInput, profilesUpdateInput, profilesRemoveInput, machinesListInput, machineDetailInput, skillsListInput, threadTemplatesGetInput, threadTemplatesDetailInput, threadTemplatesValidateInput, threadTemplatesSaveInput, threadTemplatesRemoveInput, systemDaemonStatusInput, systemRateLimitStatusInput, systemRestartInput, systemClearRateLimitInput, } from './input-schemas.js';
9
9
  // ── Subscribe filter input (no keyed schema for subscribe; router-local) ──
10
10
  const subscribeFilterInput = z.object({
11
11
  events: z.array(z.string()),
@@ -83,6 +83,7 @@ function sessionsRouter(service) {
83
83
  markRead: makeMutation(service, 'sessions.markRead', sessionsMarkReadInput),
84
84
  answerQuestion: makeMutation(service, 'sessions.answerQuestion', sessionsAnswerQuestionInput),
85
85
  respondPlan: makeMutation(service, 'sessions.respondPlan', sessionsRespondPlanInput),
86
+ cancelResume: makeMutation(service, 'sessions.cancelResume', sessionsCancelResumeInput),
86
87
  rewind: makeMutation(service, 'sessions.rewind', sessionsRewindInput),
87
88
  });
88
89
  }
@@ -111,6 +112,7 @@ function schedulesRouter(service) {
111
112
  resume: makeMutation(service, 'schedules.resume', scheduleActionInput),
112
113
  remove: makeMutation(service, 'schedules.remove', scheduleActionInput),
113
114
  add: makeMutation(service, 'schedules.add', scheduleAddInput),
115
+ update: makeMutation(service, 'schedules.update', scheduleUpdateInput),
114
116
  });
115
117
  }
116
118
  function executionLogProcedure(service) {
@@ -175,6 +177,14 @@ function hooksRouter(service) {
175
177
  test: makeMutation(service, 'hooks.test', hooksTestInput),
176
178
  });
177
179
  }
180
+ // The profiles map of profiles.json. `config.set {section:'profiles'}` keeps owning defaultProfile.
181
+ function profilesRouter(service) {
182
+ return router({
183
+ create: makeMutation(service, 'profiles.create', profilesCreateInput),
184
+ update: makeMutation(service, 'profiles.update', profilesUpdateInput),
185
+ remove: makeMutation(service, 'profiles.remove', profilesRemoveInput),
186
+ });
187
+ }
178
188
  function authRouter(service) {
179
189
  return router({
180
190
  status: makeQuery(service, 'auth.status', authStatusInput),
@@ -183,6 +193,11 @@ function authRouter(service) {
183
193
  respondPrompt: makeMutation(service, 'auth.respondPrompt', authRespondPromptInput),
184
194
  cancelFlow: makeMutation(service, 'auth.cancelFlow', authCancelFlowInput),
185
195
  logout: makeMutation(service, 'auth.logout', authLogoutInput),
196
+ // Self-hosted and proxied endpoints, which have no login flow: they are defined, edited and
197
+ // deleted rather than logged in and out of.
198
+ customProviders: makeQuery(service, 'auth.customProviders', authCustomProvidersInput),
199
+ upsertCustomProvider: makeMutation(service, 'auth.upsertCustomProvider', authUpsertCustomProviderInput),
200
+ removeCustomProvider: makeMutation(service, 'auth.removeCustomProvider', authRemoveCustomProviderInput),
186
201
  });
187
202
  }
188
203
  function systemRouter(service) {
@@ -190,6 +205,7 @@ function systemRouter(service) {
190
205
  daemonStatus: makeQuery(service, 'system.daemonStatus', systemDaemonStatusInput),
191
206
  rateLimitStatus: makeQuery(service, 'system.rateLimitStatus', systemRateLimitStatusInput),
192
207
  restart: makeMutation(service, 'system.restart', systemRestartInput),
208
+ clearRateLimit: makeMutation(service, 'system.clearRateLimit', systemClearRateLimitInput),
193
209
  });
194
210
  }
195
211
  function subscribeProcedure(service) {
@@ -222,11 +238,21 @@ export function createAppRouter(service) {
222
238
  get: makeQuery(service, 'config.get', configGetInput),
223
239
  set: makeMutation(service, 'config.set', configSetInput),
224
240
  }),
241
+ profiles: profilesRouter(service),
225
242
  auth: authRouter(service),
226
243
  hooks: hooksRouter(service),
227
- machines: router({ list: makeQuery(service, 'machines.list', machinesListInput) }),
244
+ machines: router({
245
+ list: makeQuery(service, 'machines.list', machinesListInput),
246
+ detail: makeQuery(service, 'machines.detail', machineDetailInput),
247
+ }),
228
248
  skills: router({ list: makeQuery(service, 'skills.list', skillsListInput) }),
229
- threadTemplates: router({ get: makeQuery(service, 'threadTemplates.get', threadTemplatesGetInput) }),
249
+ threadTemplates: router({
250
+ get: makeQuery(service, 'threadTemplates.get', threadTemplatesGetInput),
251
+ detail: makeQuery(service, 'threadTemplates.detail', threadTemplatesDetailInput),
252
+ validate: makeMutation(service, 'threadTemplates.validate', threadTemplatesValidateInput),
253
+ save: makeMutation(service, 'threadTemplates.save', threadTemplatesSaveInput),
254
+ remove: makeMutation(service, 'threadTemplates.remove', threadTemplatesRemoveInput),
255
+ }),
230
256
  system: systemRouter(service),
231
257
  subscribe: subscribeProcedure(service),
232
258
  });