@cortex-agent/server 2026.9.21 → 2026.9.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/defaults/config/thread-templates/agents/creative.json +17 -0
- package/defaults/prompts/systemPrompts/creative.md +13 -0
- package/defaults/prompts/systemPrompts/direct.md +1 -1
- package/dist/agent-adapter/claude/adapter.d.ts +12 -0
- package/dist/agent-adapter/claude/adapter.js +19 -1
- package/dist/agent-adapter/claude/spawn-args.d.ts +7 -0
- package/dist/agent-adapter/claude/spawn-args.js +10 -0
- package/dist/agent-adapter/pi/child-runner.d.ts +4 -2
- package/dist/agent-adapter/pi/child-runner.js +5 -1
- package/dist/agent-adapter/pi/event-parser.d.ts +3 -2
- package/dist/agent-adapter/pi/event-parser.js +46 -2
- package/dist/agent-adapter/pi/extensions.d.ts +7 -1
- package/dist/agent-adapter/pi/extensions.js +10 -3
- package/dist/agent-adapter/pi/mcp-bridge.js +8 -8
- package/dist/agent-adapter/pi/pi-session.js +5 -0
- package/dist/agent-adapter/pi/runtime.js +3 -0
- package/dist/agent-adapter/pi/session-options.js +5 -1
- package/dist/agent-adapter/pi/subagent.d.ts +15 -3
- package/dist/agent-adapter/pi/subagent.js +18 -0
- package/dist/agent-adapter/pi/tool-shims.d.ts +6 -1
- package/dist/agent-adapter/pi/tool-shims.js +34 -1
- package/dist/agent-adapter/types.d.ts +5 -0
- package/dist/core/agents/subagent/types.d.ts +3 -0
- package/dist/core/config-generator.js +17 -2
- package/dist/core/debug-mode.d.ts +11 -10
- package/dist/core/debug-mode.js +12 -18
- package/dist/core/exec-async.d.ts +26 -0
- package/dist/core/exec-async.js +47 -0
- package/dist/core/locales/en.d.ts +14 -1
- package/dist/core/locales/slices/commands.d.ts +12 -1
- package/dist/core/locales/slices/commands.js +24 -2
- package/dist/core/locales/slices/startup.d.ts +2 -0
- package/dist/core/locales/slices/startup.js +4 -0
- package/dist/core/rebuild-progress.d.ts +58 -0
- package/dist/core/rebuild-progress.js +103 -0
- package/dist/core/resilient-watch.js +5 -3
- package/dist/core/run-registry.d.ts +7 -0
- package/dist/core/run-registry.js +6 -0
- package/dist/core/types/thread-types.d.ts +23 -4
- package/dist/domain/agents/agent-state.d.ts +7 -0
- package/dist/domain/agents/agent-state.js +9 -1
- package/dist/domain/agents/agent-switch.d.ts +38 -0
- package/dist/domain/agents/agent-switch.js +106 -0
- package/dist/domain/agents/config.d.ts +20 -2
- package/dist/domain/agents/config.js +58 -4
- package/dist/domain/agents/index.d.ts +1 -0
- package/dist/domain/agents/index.js +1 -0
- package/dist/domain/agents/profile-manager.d.ts +6 -0
- package/dist/domain/agents/profile-manager.js +14 -1
- package/dist/domain/executions/registry.d.ts +2 -0
- package/dist/domain/executions/registry.js +84 -7
- package/dist/domain/plugins/runtime.js +1 -1
- package/dist/domain/plugins/skill-projection.d.ts +8 -2
- package/dist/domain/plugins/skill-projection.js +76 -19
- package/dist/domain/remote/client-bootstrap.js +1 -1
- package/dist/domain/remote/client-hot-reload.d.ts +1 -1
- package/dist/domain/remote/client-hot-reload.js +27 -23
- package/dist/domain/runs/engine-spec.js +4 -0
- package/dist/domain/runs/request.d.ts +6 -0
- package/dist/domain/runs/run.js +1 -0
- package/dist/domain/runs/spec-loader.d.ts +4 -3
- package/dist/domain/runs/spec-loader.js +4 -3
- package/dist/domain/scheduling/jobs/sync-public.js +6 -6
- package/dist/domain/scheduling/scheduler.js +14 -12
- package/dist/domain/sessions/session-lifecycle.d.ts +5 -0
- package/dist/domain/sessions/session-lifecycle.js +13 -1
- package/dist/domain/system/rebuild-hold.d.ts +44 -0
- package/dist/domain/system/rebuild-hold.js +91 -0
- package/dist/domain/system/server-update-check.d.ts +2 -1
- package/dist/domain/system/server-update-check.js +15 -13
- package/dist/domain/tasks/archiver.js +21 -13
- package/dist/domain/tasks/mutator.js +60 -59
- package/dist/domain/tasks/system/task-completion.d.ts +7 -2
- package/dist/domain/tasks/system/task-completion.js +69 -6
- package/dist/domain/tasks/system/task-lifecycle-edit.d.ts +6 -1
- package/dist/domain/tasks/system/task-lifecycle-edit.js +21 -2
- package/dist/domain/tasks/system/task-lock.d.ts +23 -0
- package/dist/domain/tasks/system/task-lock.js +29 -1
- package/dist/domain/tasks/system/task-mutations.d.ts +14 -1
- package/dist/domain/tasks/system/task-mutations.js +25 -2
- package/dist/domain/tasks/system/task-state.d.ts +12 -1
- package/dist/domain/tasks/system/task-state.js +19 -2
- package/dist/domain/threads/prompt-builder.d.ts +9 -6
- package/dist/domain/threads/prompt-builder.js +28 -10
- package/dist/domain/threads/runner.js +7 -3
- package/dist/domain/threads/state-machine.js +15 -11
- package/dist/domain/threads/template-loader.js +6 -4
- package/dist/domain/threads/template-validate.d.ts +43 -6
- package/dist/domain/threads/template-validate.js +12 -0
- package/dist/domain/ui-service/app-router.d.ts +10 -0
- package/dist/domain/ui-service/app-router.js +2 -1
- package/dist/domain/ui-service/input-schemas.d.ts +11 -0
- package/dist/domain/ui-service/input-schemas.js +11 -0
- package/dist/domain/ui-service/mutate/sessions.d.ts +2 -1
- package/dist/domain/ui-service/mutate/sessions.js +40 -0
- package/dist/domain/ui-service/mutate/tasks.js +4 -3
- package/dist/domain/ui-service/query/config.js +19 -1
- package/dist/domain/ui-service/query/memory.js +28 -34
- package/dist/domain/ui-service/query/sessions.js +89 -12
- package/dist/domain/ui-service/query/system.js +19 -0
- package/dist/domain/ui-service/query-input-schemas.d.ts +1 -0
- package/dist/domain/ui-service/query-input-schemas.js +2 -0
- package/dist/domain/ui-service/types.d.ts +97 -3
- package/dist/domain/ui-service/ui-service.js +2 -1
- package/dist/entry/app.js +23 -4
- package/dist/entry/daemon-notice.d.ts +10 -1
- package/dist/entry/daemon-notice.js +16 -1
- package/dist/entry/daemon.d.ts +43 -2
- package/dist/entry/daemon.js +163 -9
- package/dist/orchestration/agent-runner.js +16 -0
- package/dist/orchestration/conversation-request.d.ts +33 -0
- package/dist/orchestration/conversation-request.js +78 -16
- package/dist/orchestration/mid-turn-inject.d.ts +3 -0
- package/dist/orchestration/mid-turn-inject.js +9 -4
- package/dist/orchestration/resume-dispatcher.js +4 -2
- package/dist/orchestration/routing/commands/mode.js +114 -63
- package/dist/orchestration/thread-executor.js +13 -0
- package/dist/orchestration/turn/turn.js +1 -0
- package/dist/store/conversation-display-projection.d.ts +9 -1
- package/dist/store/conversation-display-projection.js +13 -6
- package/dist/store/conversation-history-reader.d.ts +19 -0
- package/dist/store/conversation-history-reader.js +163 -44
- package/dist/store/conversation-history-repo.d.ts +37 -10
- package/dist/store/conversation-history-repo.js +161 -139
- package/dist/store/session-registry-journal.d.ts +4 -0
- package/dist/store/session-registry-journal.js +4 -0
- package/dist/store/session-registry-repo.d.ts +2 -1
- package/dist/store/session-registry-repo.js +2 -0
- package/dist/store/task-repo.d.ts +6 -3
- package/dist/store/task-repo.js +26 -10
- package/package.json +2 -1
- package/web/dist/AGENTS.md +10 -0
- package/web/dist/assets/index-B1dBi8Za.css +1 -0
- package/web/dist/assets/{index-DZTuqUO4.js → index-BAeLybF0.js} +1 -1
- package/web/dist/assets/index-BcQI8Fh5.js +445 -0
- package/web/dist/index.html +12 -4
- package/web/dist/theme.css +211 -40
- package/web/dist/assets/index-CwwQNMpP.css +0 -1
- package/web/dist/assets/index-DLSfgq3o.js +0 -444
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { LockState } from '../../../core/task-parser.js';
|
|
2
2
|
export declare function getOwnerIdentity(): string;
|
|
3
3
|
export declare function readLock(project: string): LockState | null;
|
|
4
|
+
/** Async twin of `readLock` for callers that must not block the event loop. */
|
|
5
|
+
export declare function readLockAsync(project: string): Promise<LockState | null>;
|
|
4
6
|
export declare function writeLock(project: string, lock: LockState | null): void;
|
|
7
|
+
/** Async twin of `writeLock`. */
|
|
8
|
+
export declare function writeLockAsync(project: string, lock: LockState | null): Promise<void>;
|
|
5
9
|
export declare function acquireLock(project: string, opts: {
|
|
6
10
|
owner: string;
|
|
7
11
|
force?: boolean;
|
|
@@ -11,12 +15,31 @@ export declare function acquireLock(project: string, opts: {
|
|
|
11
15
|
lock?: LockState;
|
|
12
16
|
message?: string;
|
|
13
17
|
};
|
|
18
|
+
/** Async twin of `acquireLock` — the server takes this path so retrying a contended project lock
|
|
19
|
+
* yields to the event loop instead of sleeping inside `Atomics.wait`. */
|
|
20
|
+
export declare function acquireLockAsync(project: string, opts: {
|
|
21
|
+
owner: string;
|
|
22
|
+
force?: boolean;
|
|
23
|
+
note?: string;
|
|
24
|
+
}): Promise<{
|
|
25
|
+
acquired: boolean;
|
|
26
|
+
lock?: LockState;
|
|
27
|
+
message?: string;
|
|
28
|
+
}>;
|
|
14
29
|
export declare function releaseLock(project: string, owner: string, opts?: {
|
|
15
30
|
force?: boolean;
|
|
16
31
|
}): {
|
|
17
32
|
released: boolean;
|
|
18
33
|
message?: string;
|
|
19
34
|
};
|
|
35
|
+
/** Async twin of `releaseLock` — the server takes this path so a contended cross-process
|
|
36
|
+
* mutation lock never parks the event loop in `Atomics.wait`. */
|
|
37
|
+
export declare function releaseLockAsync(project: string, owner: string, opts?: {
|
|
38
|
+
force?: boolean;
|
|
39
|
+
}): Promise<{
|
|
40
|
+
released: boolean;
|
|
41
|
+
message?: string;
|
|
42
|
+
}>;
|
|
20
43
|
export declare function assertLockHeld(project: string, owner: string): string | null;
|
|
21
44
|
export declare function isProjectLocked(project: string, now?: string): {
|
|
22
45
|
locked: boolean;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as fs from 'node:fs';
|
|
2
|
+
import * as fsp from 'node:fs/promises';
|
|
2
3
|
import * as path from 'node:path';
|
|
3
4
|
import * as os from 'node:os';
|
|
4
5
|
import { PROJECTS_DIR } from '../../../core/utils.js';
|
|
5
6
|
import { createLogger } from '../../../core/log.js';
|
|
6
7
|
import { parseTasksFileWithLock, serializeTasksFileWithLock } from '../../../core/task-parser.js';
|
|
7
|
-
import { withTaskFileMutationLock } from './task-lifecycle-edit.js';
|
|
8
|
+
import { withTaskFileMutationLock, withTaskFileMutationLockAsync } from './task-lifecycle-edit.js';
|
|
8
9
|
const log = createLogger('task-lock');
|
|
9
10
|
// ── Atomic write ──
|
|
10
11
|
function atomicWriteSync(filePath, data) {
|
|
@@ -52,6 +53,19 @@ export function readLock(project) {
|
|
|
52
53
|
return null;
|
|
53
54
|
}
|
|
54
55
|
}
|
|
56
|
+
/** Async twin of `readLock` for callers that must not block the event loop. */
|
|
57
|
+
export async function readLockAsync(project) {
|
|
58
|
+
try {
|
|
59
|
+
const content = await fsp.readFile(tasksYamlPath(project), 'utf8');
|
|
60
|
+
const { lock } = parseTasksFileWithLock(content, project);
|
|
61
|
+
return lock;
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
if (err?.code !== 'ENOENT')
|
|
65
|
+
log.warn('Failed to read lock for %s: %s', project, err);
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
55
69
|
function writeLockUnlocked(project, lock) {
|
|
56
70
|
const filePath = tasksYamlPath(project);
|
|
57
71
|
let tasks;
|
|
@@ -111,12 +125,26 @@ function releaseLockUnlocked(project, owner, opts) {
|
|
|
111
125
|
export function writeLock(project, lock) {
|
|
112
126
|
withTaskFileMutationLock(project, () => writeLockUnlocked(project, lock));
|
|
113
127
|
}
|
|
128
|
+
/** Async twin of `writeLock`. */
|
|
129
|
+
export async function writeLockAsync(project, lock) {
|
|
130
|
+
await withTaskFileMutationLockAsync(project, async () => writeLockUnlocked(project, lock));
|
|
131
|
+
}
|
|
114
132
|
export function acquireLock(project, opts) {
|
|
115
133
|
return withTaskFileMutationLock(project, () => acquireLockUnlocked(project, opts));
|
|
116
134
|
}
|
|
135
|
+
/** Async twin of `acquireLock` — the server takes this path so retrying a contended project lock
|
|
136
|
+
* yields to the event loop instead of sleeping inside `Atomics.wait`. */
|
|
137
|
+
export async function acquireLockAsync(project, opts) {
|
|
138
|
+
return withTaskFileMutationLockAsync(project, async () => acquireLockUnlocked(project, opts));
|
|
139
|
+
}
|
|
117
140
|
export function releaseLock(project, owner, opts) {
|
|
118
141
|
return withTaskFileMutationLock(project, () => releaseLockUnlocked(project, owner, opts));
|
|
119
142
|
}
|
|
143
|
+
/** Async twin of `releaseLock` — the server takes this path so a contended cross-process
|
|
144
|
+
* mutation lock never parks the event loop in `Atomics.wait`. */
|
|
145
|
+
export async function releaseLockAsync(project, owner, opts) {
|
|
146
|
+
return withTaskFileMutationLockAsync(project, async () => releaseLockUnlocked(project, owner, opts));
|
|
147
|
+
}
|
|
120
148
|
export function assertLockHeld(project, owner) {
|
|
121
149
|
const current = readLock(project);
|
|
122
150
|
if (!current) {
|
|
@@ -81,4 +81,17 @@ declare function decomposeTaskOwnedUnlocked(project: string, originalText: strin
|
|
|
81
81
|
declare const addTask: typeof addTaskUnlocked;
|
|
82
82
|
declare const bulkAddTasks: typeof bulkAddTasksUnlocked;
|
|
83
83
|
declare const decomposeTask: typeof decomposeTaskOwnedUnlocked;
|
|
84
|
-
|
|
84
|
+
declare const addTaskAsync: (project: string, ...args: any[]) => Promise<any>;
|
|
85
|
+
declare const bulkAddTasksAsync: (project: string, ...args: any[]) => Promise<any>;
|
|
86
|
+
declare const decomposeTaskAsync: (project: string, ...args: any[]) => Promise<any>;
|
|
87
|
+
/** Async twin of `batchEdit`: issues the per-task edits through the async lock. */
|
|
88
|
+
declare function batchEditAsync(project: string, taskIds: string[], options?: any): Promise<{
|
|
89
|
+
success: boolean;
|
|
90
|
+
message: string;
|
|
91
|
+
results: {
|
|
92
|
+
taskId: string;
|
|
93
|
+
success: boolean;
|
|
94
|
+
message: string;
|
|
95
|
+
}[];
|
|
96
|
+
}>;
|
|
97
|
+
export { addTask, addTaskAsync, batchEdit, batchEditAsync, bulkAddTasks, bulkAddTasksAsync, decomposeTask, decomposeTaskAsync };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as fs from 'node:fs';
|
|
2
2
|
import { createLogger } from '../../../core/log.js';
|
|
3
3
|
import { collectAllExistingHashes, generateHash } from './task-id-utils.js';
|
|
4
|
-
import { editTask, findTask, getTasksPath, readTasks, VALID_PRIORITIES, validateTemplateName, withTaskFileMutationLock, writeTasks, } from './task-lifecycle-edit.js';
|
|
4
|
+
import { editTask, editTaskAsync, findTask, getTasksPath, readTasks, VALID_PRIORITIES, validateTemplateName, withTaskFileMutationLock, withTaskFileMutationLockAsync, writeTasks, } from './task-lifecycle-edit.js';
|
|
5
5
|
import { recordProductionTopologyFact } from '../production-topology-ledger.js';
|
|
6
6
|
const log = createLogger('task-mutations');
|
|
7
7
|
function addTaskUnlocked(project, text, why, doneWhen, priority = 'medium', template = null, dependsOn = null, plan = null, origin = null) {
|
|
@@ -310,6 +310,11 @@ function bulkAddTasksUnlocked(project, inputs) {
|
|
|
310
310
|
function lockProjectMutation(mutation) {
|
|
311
311
|
return ((project, ...args) => withTaskFileMutationLock(project, () => mutation(project, ...args)));
|
|
312
312
|
}
|
|
313
|
+
/** Async twin of `lockProjectMutation`: server-side creation paths (MCP tools, dispatch
|
|
314
|
+
* decomposition) must not park the event loop on a contended cross-process mutation lock. */
|
|
315
|
+
function lockProjectMutationAsync(mutation) {
|
|
316
|
+
return ((project, ...args) => withTaskFileMutationLockAsync(project, async () => mutation(project, ...args)));
|
|
317
|
+
}
|
|
313
318
|
function decomposeTaskOwnedUnlocked(project, originalText, subtasks, taskId = null, options = {}) {
|
|
314
319
|
const found = findTask(readTasks(project), originalText, taskId);
|
|
315
320
|
if (options.ownership && 'error' in found)
|
|
@@ -327,4 +332,22 @@ function decomposeTaskOwnedUnlocked(project, originalText, subtasks, taskId = nu
|
|
|
327
332
|
const addTask = lockProjectMutation(addTaskUnlocked);
|
|
328
333
|
const bulkAddTasks = lockProjectMutation(bulkAddTasksUnlocked);
|
|
329
334
|
const decomposeTask = lockProjectMutation(decomposeTaskOwnedUnlocked);
|
|
330
|
-
|
|
335
|
+
const addTaskAsync = lockProjectMutationAsync(addTaskUnlocked);
|
|
336
|
+
const bulkAddTasksAsync = lockProjectMutationAsync(bulkAddTasksUnlocked);
|
|
337
|
+
const decomposeTaskAsync = lockProjectMutationAsync(decomposeTaskOwnedUnlocked);
|
|
338
|
+
/** Async twin of `batchEdit`: issues the per-task edits through the async lock. */
|
|
339
|
+
async function batchEditAsync(project, taskIds, options = {}) {
|
|
340
|
+
const results = [];
|
|
341
|
+
for (const id of taskIds) {
|
|
342
|
+
const result = await editTaskAsync(project, { ...options, taskId: id });
|
|
343
|
+
results.push({ taskId: id, success: result.success, message: result.message || '' });
|
|
344
|
+
}
|
|
345
|
+
const succeeded = results.filter((r) => r.success).length;
|
|
346
|
+
const failed = results.filter((r) => !r.success);
|
|
347
|
+
let message = `Batch edit: ${succeeded}/${taskIds.length} tasks updated`;
|
|
348
|
+
if (failed.length > 0) {
|
|
349
|
+
message += `\nFailed:\n${failed.map((r) => ` [${r.taskId}] ${r.message}`).join('\n')}`;
|
|
350
|
+
}
|
|
351
|
+
return { success: failed.length === 0, message, results };
|
|
352
|
+
}
|
|
353
|
+
export { addTask, addTaskAsync, batchEdit, batchEditAsync, bulkAddTasks, bulkAddTasksAsync, decomposeTask, decomposeTaskAsync };
|
|
@@ -130,4 +130,15 @@ declare const blockTask: typeof blockTaskUnlocked;
|
|
|
130
130
|
declare const pendingTask: typeof pendingTaskUnlocked;
|
|
131
131
|
declare const unblockTask: typeof unblockTaskUnlocked;
|
|
132
132
|
declare const reopenTask: typeof reopenTaskUnlocked;
|
|
133
|
-
|
|
133
|
+
declare const claimTaskAsync: (...args: any[]) => Promise<any>;
|
|
134
|
+
declare const unclaimTaskAsync: (...args: any[]) => Promise<any>;
|
|
135
|
+
declare const pauseTaskAsync: (...args: any[]) => Promise<any>;
|
|
136
|
+
declare const resumeTaskAsync: (...args: any[]) => Promise<any>;
|
|
137
|
+
declare const requestApprovalTaskAsync: (...args: any[]) => Promise<any>;
|
|
138
|
+
declare const approveTaskAsync: (...args: any[]) => Promise<any>;
|
|
139
|
+
declare const clearApprovalTaskAsync: (...args: any[]) => Promise<any>;
|
|
140
|
+
declare const blockTaskAsync: (...args: any[]) => Promise<any>;
|
|
141
|
+
declare const pendingTaskAsync: (...args: any[]) => Promise<any>;
|
|
142
|
+
declare const unblockTaskAsync: (...args: any[]) => Promise<any>;
|
|
143
|
+
declare const reopenTaskAsync: (...args: any[]) => Promise<any>;
|
|
144
|
+
export { approveTask, approveTaskAsync, blockTask, blockTaskAsync, claimTask, claimTaskAsync, clearApprovalTask, clearApprovalTaskAsync, pauseTask, pauseTaskAsync, pendingTask, pendingTaskAsync, reopenTask, reopenTaskAsync, requestApprovalTask, requestApprovalTaskAsync, resumeTask, resumeTaskAsync, unblockTask, unblockTaskAsync, unclaimTask, unclaimTaskAsync, };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { todayISO } from '../../../core/utils.js';
|
|
2
|
-
import { findTask, getTasksPath, readTasks, withTaskFileMutationLock, writeTasks, } from './task-lifecycle-edit.js';
|
|
2
|
+
import { findTask, getTasksPath, readTasks, withTaskFileMutationLock, withTaskFileMutationLockAsync, writeTasks, } from './task-lifecycle-edit.js';
|
|
3
3
|
import * as fs from 'node:fs';
|
|
4
4
|
function claimTaskUnlocked(taskText, project, agentId, taskId = null, dispatchGeneration = null) {
|
|
5
5
|
const tasks = readTasks(project);
|
|
@@ -261,6 +261,12 @@ function reopenTaskUnlocked(taskText, project, taskId = null, ownership) {
|
|
|
261
261
|
function lockTaskMutation(mutation) {
|
|
262
262
|
return ((...args) => withTaskFileMutationLock(args[1], () => mutation(...args)));
|
|
263
263
|
}
|
|
264
|
+
/** Async twin of `lockTaskMutation`. The mutation body itself is synchronous, so this only swaps
|
|
265
|
+
* the cross-process mutation lock's blocking wait for its async twin. The server takes this path
|
|
266
|
+
* (per-message / per-dispatch mutations); the standalone CLI keeps the sync one. */
|
|
267
|
+
function lockTaskMutationAsync(mutation) {
|
|
268
|
+
return ((...args) => withTaskFileMutationLockAsync(args[1], async () => mutation(...args)));
|
|
269
|
+
}
|
|
264
270
|
const claimTask = lockTaskMutation(claimTaskUnlocked);
|
|
265
271
|
const unclaimTask = lockTaskMutation(unclaimTaskUnlocked);
|
|
266
272
|
const pauseTask = lockTaskMutation(pauseTaskUnlocked);
|
|
@@ -272,4 +278,15 @@ const blockTask = lockTaskMutation(blockTaskUnlocked);
|
|
|
272
278
|
const pendingTask = lockTaskMutation(pendingTaskUnlocked);
|
|
273
279
|
const unblockTask = lockTaskMutation(unblockTaskUnlocked);
|
|
274
280
|
const reopenTask = lockTaskMutation(reopenTaskUnlocked);
|
|
275
|
-
|
|
281
|
+
const claimTaskAsync = lockTaskMutationAsync(claimTaskUnlocked);
|
|
282
|
+
const unclaimTaskAsync = lockTaskMutationAsync(unclaimTaskUnlocked);
|
|
283
|
+
const pauseTaskAsync = lockTaskMutationAsync(pauseTaskUnlocked);
|
|
284
|
+
const resumeTaskAsync = lockTaskMutationAsync(resumeTaskUnlocked);
|
|
285
|
+
const requestApprovalTaskAsync = lockTaskMutationAsync(requestApprovalTaskUnlocked);
|
|
286
|
+
const approveTaskAsync = lockTaskMutationAsync(approveTaskUnlocked);
|
|
287
|
+
const clearApprovalTaskAsync = lockTaskMutationAsync(clearApprovalTaskUnlocked);
|
|
288
|
+
const blockTaskAsync = lockTaskMutationAsync(blockTaskUnlocked);
|
|
289
|
+
const pendingTaskAsync = lockTaskMutationAsync(pendingTaskUnlocked);
|
|
290
|
+
const unblockTaskAsync = lockTaskMutationAsync(unblockTaskUnlocked);
|
|
291
|
+
const reopenTaskAsync = lockTaskMutationAsync(reopenTaskUnlocked);
|
|
292
|
+
export { approveTask, approveTaskAsync, blockTask, blockTaskAsync, claimTask, claimTaskAsync, clearApprovalTask, clearApprovalTaskAsync, pauseTask, pauseTaskAsync, pendingTask, pendingTaskAsync, reopenTask, reopenTaskAsync, requestApprovalTask, requestApprovalTaskAsync, resumeTask, resumeTaskAsync, unblockTask, unblockTaskAsync, unclaimTask, unclaimTaskAsync, };
|
|
@@ -4,15 +4,18 @@ import type { AgentSlotConfig, TemplateAgentRef, ThreadTemplate } from '../../co
|
|
|
4
4
|
* implementation is the layer-0 template engine every prompt composer shares. */
|
|
5
5
|
export { resolveSystemVars };
|
|
6
6
|
/** Resolve the `__active__` agent ref placeholder to the currently active default agent
|
|
7
|
-
* (set by `!agent`).
|
|
7
|
+
* (set by `!agent`). With a `channel`, that channel's own selection answers first — a thread
|
|
8
|
+
* running on a channel that picked an agent runs the agent the channel picked, the same way its
|
|
9
|
+
* profile follows the channel. Falls back to `'main'` when nothing is configured. Other names
|
|
8
10
|
* pass through unchanged. */
|
|
9
|
-
export declare function resolveActiveAgentName(name: string): string;
|
|
10
|
-
/** Resolve a TemplateAgentRef to a full AgentSlotConfig by merging agent definition with optional
|
|
11
|
-
|
|
11
|
+
export declare function resolveActiveAgentName(name: string, channel?: string): string;
|
|
12
|
+
/** Resolve a TemplateAgentRef to a full AgentSlotConfig by merging agent definition with optional
|
|
13
|
+
* overrides. `channel` only matters for an `__active__` ref — see {@link resolveActiveAgentName}. */
|
|
14
|
+
export declare function resolveAgentSlotConfig(ref: TemplateAgentRef, channel?: string): AgentSlotConfig | null;
|
|
12
15
|
/** Resolve a single agent name to AgentSlotConfig (for ad-hoc threads) */
|
|
13
|
-
export declare function resolveAgentSlotConfigByName(agentName: string): AgentSlotConfig | null;
|
|
16
|
+
export declare function resolveAgentSlotConfigByName(agentName: string, channel?: string): AgentSlotConfig | null;
|
|
14
17
|
/** Resolve all agent refs in a template to AgentSlotConfigs */
|
|
15
|
-
export declare function resolveTemplateAgents(template: ThreadTemplate): AgentSlotConfig[];
|
|
18
|
+
export declare function resolveTemplateAgents(template: ThreadTemplate, channel?: string): AgentSlotConfig[];
|
|
16
19
|
/** Resolve the unique profile names a template's agents will actually run with.
|
|
17
20
|
* Mirrors thread-runner profile resolution (runner.ts): hardcoded agent profiles win;
|
|
18
21
|
* `__active__` slots resolve to `activeProfile` (the dispatch/scheduler profile that
|
|
@@ -11,10 +11,12 @@ import { waitForPendingUserInputs } from './pending-user-inputs.js';
|
|
|
11
11
|
* implementation is the layer-0 template engine every prompt composer shares. */
|
|
12
12
|
export { resolveSystemVars };
|
|
13
13
|
/** Resolve the `__active__` agent ref placeholder to the currently active default agent
|
|
14
|
-
* (set by `!agent`).
|
|
14
|
+
* (set by `!agent`). With a `channel`, that channel's own selection answers first — a thread
|
|
15
|
+
* running on a channel that picked an agent runs the agent the channel picked, the same way its
|
|
16
|
+
* profile follows the channel. Falls back to `'main'` when nothing is configured. Other names
|
|
15
17
|
* pass through unchanged. */
|
|
16
|
-
export function resolveActiveAgentName(name) {
|
|
17
|
-
return name === '__active__' ? (getDefaultAgent() || 'main') : name;
|
|
18
|
+
export function resolveActiveAgentName(name, channel) {
|
|
19
|
+
return name === '__active__' ? (getDefaultAgent(channel) || 'main') : name;
|
|
18
20
|
}
|
|
19
21
|
function collectRefOverrides(ref) {
|
|
20
22
|
if (typeof ref === 'string')
|
|
@@ -39,12 +41,23 @@ function collectRefOverrides(ref) {
|
|
|
39
41
|
if (ref.mcpToolAllowlist != null) {
|
|
40
42
|
o.mcpToolAllowlist = canonicalizeMcpToolAllowlist(ref.mcpToolAllowlist);
|
|
41
43
|
}
|
|
44
|
+
if (ref.loadRules != null)
|
|
45
|
+
o.loadRules = ref.loadRules;
|
|
46
|
+
if (ref.disableHooks != null)
|
|
47
|
+
o.disableHooks = ref.disableHooks;
|
|
48
|
+
if (ref.skills != null)
|
|
49
|
+
o.skills = ref.skills;
|
|
50
|
+
if (ref.settingSources != null)
|
|
51
|
+
o.settingSources = ref.settingSources;
|
|
52
|
+
if (ref.projectContext != null)
|
|
53
|
+
o.projectContext = ref.projectContext;
|
|
42
54
|
return o;
|
|
43
55
|
}
|
|
44
|
-
/** Resolve a TemplateAgentRef to a full AgentSlotConfig by merging agent definition with optional
|
|
45
|
-
|
|
56
|
+
/** Resolve a TemplateAgentRef to a full AgentSlotConfig by merging agent definition with optional
|
|
57
|
+
* overrides. `channel` only matters for an `__active__` ref — see {@link resolveActiveAgentName}. */
|
|
58
|
+
export function resolveAgentSlotConfig(ref, channel) {
|
|
46
59
|
const rawName = typeof ref === 'string' ? ref : ref.ref;
|
|
47
|
-
const agentName = resolveActiveAgentName(rawName);
|
|
60
|
+
const agentName = resolveActiveAgentName(rawName, channel);
|
|
48
61
|
const agentDef = getAgent(agentName);
|
|
49
62
|
if (!agentDef)
|
|
50
63
|
return null;
|
|
@@ -64,19 +77,24 @@ export function resolveAgentSlotConfig(ref) {
|
|
|
64
77
|
mcpToolAllowlist: overrides.mcpToolAllowlist
|
|
65
78
|
?? (agentDef.mcpToolAllowlist
|
|
66
79
|
? canonicalizeMcpToolAllowlist(agentDef.mcpToolAllowlist) : undefined),
|
|
80
|
+
loadRules: overrides.loadRules ?? agentDef.loadRules,
|
|
81
|
+
disableHooks: overrides.disableHooks ?? agentDef.disableHooks,
|
|
82
|
+
skills: overrides.skills ?? agentDef.skills,
|
|
83
|
+
settingSources: overrides.settingSources ?? agentDef.settingSources,
|
|
84
|
+
projectContext: overrides.projectContext ?? agentDef.projectContext,
|
|
67
85
|
stages: agentDef.stages,
|
|
68
86
|
entryStage: agentDef.entryStage,
|
|
69
87
|
};
|
|
70
88
|
}
|
|
71
89
|
/** Resolve a single agent name to AgentSlotConfig (for ad-hoc threads) */
|
|
72
|
-
export function resolveAgentSlotConfigByName(agentName) {
|
|
73
|
-
return resolveAgentSlotConfig(agentName);
|
|
90
|
+
export function resolveAgentSlotConfigByName(agentName, channel) {
|
|
91
|
+
return resolveAgentSlotConfig(agentName, channel);
|
|
74
92
|
}
|
|
75
93
|
/** Resolve all agent refs in a template to AgentSlotConfigs */
|
|
76
|
-
export function resolveTemplateAgents(template) {
|
|
94
|
+
export function resolveTemplateAgents(template, channel) {
|
|
77
95
|
const configs = [];
|
|
78
96
|
for (const ref of template.agents) {
|
|
79
|
-
const config = resolveAgentSlotConfig(ref);
|
|
97
|
+
const config = resolveAgentSlotConfig(ref, channel);
|
|
80
98
|
if (config)
|
|
81
99
|
configs.push(config);
|
|
82
100
|
}
|
|
@@ -310,8 +310,12 @@ export function buildThreadRunRequest(threadId, stepCtx, ctx, opts) {
|
|
|
310
310
|
policy: {
|
|
311
311
|
background: stepBackgroundPolicy(),
|
|
312
312
|
recordCost: true,
|
|
313
|
-
hooks
|
|
314
|
-
|
|
313
|
+
// Both levels can switch hooks off and neither can switch the other's decision back on:
|
|
314
|
+
// the template speaks for the pipeline, the agent for its own environment.
|
|
315
|
+
hooks: ctx.template?.disableHooks !== true && agentConfig.disableHooks !== true,
|
|
316
|
+
loadRules: agentConfig.loadRules ?? true,
|
|
317
|
+
skills: agentConfig.skills,
|
|
318
|
+
settingSources: agentConfig.settingSources,
|
|
315
319
|
mcpComposition: resolvedComposition,
|
|
316
320
|
// Legacy thread surface selector: true only when the agent declared no explicit composition.
|
|
317
321
|
useCoreMcp: mcpComposition === undefined,
|
|
@@ -649,7 +653,7 @@ async function runThread(threadId, opts) {
|
|
|
649
653
|
// would otherwise hold the lock across the whole child-wait — starving sibling
|
|
650
654
|
// managers — and the terminal auto-release can't recover it (re-entry completes under
|
|
651
655
|
// a new executionId that no longer matches the original owner). See registry.ts.
|
|
652
|
-
executionRegistry.
|
|
656
|
+
await executionRegistry.releaseExecutionLocksAsync(stepCtx.execution.id);
|
|
653
657
|
const n = threadStore.get(threadId)?.metadata?.waitingOn?.length ?? 0;
|
|
654
658
|
if (ctx.stream)
|
|
655
659
|
ctx.stream.emitText(`${Icons.processing} Thread suspended — waiting on ${n} child thread(s)`);
|
|
@@ -36,14 +36,18 @@ function newAgentSlot(config) {
|
|
|
36
36
|
persistSession: config.persistSession,
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
// `channel` reaches every `__active__` resolution below, and MUST: the slot map is keyed by the
|
|
40
|
+
// resolved names, and the per-step resolution re-derives them from the thread's own channel. Were
|
|
41
|
+
// creation to resolve globally and the step per channel, the two would name different agents and
|
|
42
|
+
// `resolveNextStep` would find no slot at all.
|
|
43
|
+
function buildTemplateSlots(templateName, channel) {
|
|
40
44
|
const template = getTemplate(templateName);
|
|
41
45
|
if (!template)
|
|
42
46
|
throw new Error(`Unknown thread template: ${templateName}`);
|
|
43
|
-
const entryAgent = resolveActiveAgentName(template.entryAgent);
|
|
47
|
+
const entryAgent = resolveActiveAgentName(template.entryAgent, channel);
|
|
44
48
|
const agentSlots = {};
|
|
45
49
|
let entryConfig = null;
|
|
46
|
-
for (const config of resolveTemplateAgents(template)) {
|
|
50
|
+
for (const config of resolveTemplateAgents(template, channel)) {
|
|
47
51
|
agentSlots[config.slotId] = newAgentSlot(config);
|
|
48
52
|
if (config.slotId === entryAgent)
|
|
49
53
|
entryConfig = config;
|
|
@@ -51,8 +55,8 @@ function buildTemplateSlots(templateName) {
|
|
|
51
55
|
const entryStage = resolveStageName(entryConfig, template.entryStage || null);
|
|
52
56
|
return { agentSlots, entryAgent, entryStage };
|
|
53
57
|
}
|
|
54
|
-
function buildAdHocSlots(agentName) {
|
|
55
|
-
const agentConfig = resolveAgentSlotConfigByName(agentName);
|
|
58
|
+
function buildAdHocSlots(agentName, channel) {
|
|
59
|
+
const agentConfig = resolveAgentSlotConfigByName(agentName, channel);
|
|
56
60
|
if (!agentConfig)
|
|
57
61
|
throw new Error(`Unknown agent: ${agentName}`);
|
|
58
62
|
return {
|
|
@@ -122,8 +126,8 @@ export function createThread(channel, options) {
|
|
|
122
126
|
throw new Error('createThread requires either templateName or agentName');
|
|
123
127
|
}
|
|
124
128
|
const { agentSlots, entryAgent, entryStage } = isTemplate
|
|
125
|
-
? buildTemplateSlots(options.templateName)
|
|
126
|
-
: buildAdHocSlots(options.agentName);
|
|
129
|
+
? buildTemplateSlots(options.templateName, channel)
|
|
130
|
+
: buildAdHocSlots(options.agentName, channel);
|
|
127
131
|
const metadata = resolveThreadEvidenceMetadata(options.metadata, id => threadStore.get(id));
|
|
128
132
|
const id = threadStore.generateId();
|
|
129
133
|
const { workspacePath, artifactPath: workspaceArtifact } = createWorkspace(id);
|
|
@@ -183,7 +187,7 @@ export async function addAgentToThread(threadId, agentName, userMessage) {
|
|
|
183
187
|
const thread = threadStore.get(threadId);
|
|
184
188
|
if (!thread)
|
|
185
189
|
throw new Error(`Thread not found: ${threadId}`);
|
|
186
|
-
const agentConfig = resolveAgentSlotConfigByName(agentName);
|
|
190
|
+
const agentConfig = resolveAgentSlotConfigByName(agentName, thread.channel);
|
|
187
191
|
if (!agentConfig)
|
|
188
192
|
throw new Error(`Unknown agent: ${agentName}`);
|
|
189
193
|
ensureThreadWorkspace(thread);
|
|
@@ -201,7 +205,7 @@ export async function addAgentToThread(threadId, agentName, userMessage) {
|
|
|
201
205
|
return thread;
|
|
202
206
|
}
|
|
203
207
|
function resolveAdHocNextStep(thread) {
|
|
204
|
-
const agentConfig = resolveAgentSlotConfigByName(thread.activeAgent);
|
|
208
|
+
const agentConfig = resolveAgentSlotConfigByName(thread.activeAgent, thread.channel);
|
|
205
209
|
if (!agentConfig)
|
|
206
210
|
return null;
|
|
207
211
|
const stage = resolveStageName(agentConfig, thread.activeStage);
|
|
@@ -211,9 +215,9 @@ function resolveTemplateNextStep(thread) {
|
|
|
211
215
|
const template = getTemplate(thread.templateName);
|
|
212
216
|
if (!template)
|
|
213
217
|
return null;
|
|
214
|
-
const resolvedAgents = resolveTemplateAgents(template);
|
|
218
|
+
const resolvedAgents = resolveTemplateAgents(template, thread.channel);
|
|
215
219
|
const isFirstStep = thread.steps.length === 0;
|
|
216
|
-
const target = isFirstStep ? resolveActiveAgentName(template.entryAgent) : thread.activeAgent;
|
|
220
|
+
const target = isFirstStep ? resolveActiveAgentName(template.entryAgent, thread.channel) : thread.activeAgent;
|
|
217
221
|
const agentConfig = resolvedAgents.find(a => a.slotId === target);
|
|
218
222
|
if (!agentConfig)
|
|
219
223
|
return null;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { readFileSync, writeFileSync, readdirSync, renameSync, existsSync, mkdirSync, watch } from 'fs';
|
|
2
|
-
import { createHash } from 'node:crypto';
|
|
1
|
+
import { readFileSync, writeFileSync, readdirSync, renameSync, existsSync, mkdirSync, statSync, watch } from 'fs';
|
|
3
2
|
import { isDeepStrictEqual } from 'node:util';
|
|
4
3
|
import * as path from 'path';
|
|
5
4
|
import { CONFIG_DIR, DATA_DIR, PROMPTS_DIR } from '../../core/utils.js';
|
|
@@ -345,10 +344,13 @@ function scheduleConfigReload(label) {
|
|
|
345
344
|
loadConfig();
|
|
346
345
|
}, 300);
|
|
347
346
|
}
|
|
347
|
+
/** Stat stamp instead of a content hash: this runs on every fs event (and on the 5s polling
|
|
348
|
+
* fallback), and reading + sha256'ing all 40+ template files per event costs ~5x a stat. Any
|
|
349
|
+
* save, replace or in-place edit moves mtime/ctime, so the snapshot still detects it. */
|
|
348
350
|
function pathStamp(filePath) {
|
|
349
351
|
try {
|
|
350
|
-
const
|
|
351
|
-
return `${filePath}:${
|
|
352
|
+
const stat = statSync(filePath);
|
|
353
|
+
return `${filePath}:${stat.size}:${stat.mtimeMs}:${stat.ctimeMs}:${stat.ino}`;
|
|
352
354
|
}
|
|
353
355
|
catch {
|
|
354
356
|
return `${filePath}:missing`;
|
|
@@ -79,6 +79,21 @@ export declare const hooksSchema: z.ZodObject<{
|
|
|
79
79
|
}, z.core.$strip>>;
|
|
80
80
|
}, z.core.$strip>;
|
|
81
81
|
export declare const agentSchema: z.ZodObject<{
|
|
82
|
+
stages: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
83
|
+
promptTemplate: z.ZodString;
|
|
84
|
+
continuesSession: z.ZodOptional<z.ZodBoolean>;
|
|
85
|
+
description: z.ZodOptional<z.ZodString>;
|
|
86
|
+
}, z.core.$strip>>>;
|
|
87
|
+
entryStage: z.ZodOptional<z.ZodString>;
|
|
88
|
+
loadRules: z.ZodOptional<z.ZodBoolean>;
|
|
89
|
+
disableHooks: z.ZodOptional<z.ZodBoolean>;
|
|
90
|
+
skills: z.ZodOptional<z.ZodBoolean>;
|
|
91
|
+
settingSources: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
92
|
+
user: "user";
|
|
93
|
+
project: "project";
|
|
94
|
+
local: "local";
|
|
95
|
+
}>>>;
|
|
96
|
+
projectContext: z.ZodOptional<z.ZodBoolean>;
|
|
82
97
|
name: z.ZodString;
|
|
83
98
|
description: z.ZodOptional<z.ZodString>;
|
|
84
99
|
profile: z.ZodString;
|
|
@@ -96,14 +111,18 @@ export declare const agentSchema: z.ZodObject<{
|
|
|
96
111
|
"thread-control": "thread-control";
|
|
97
112
|
}>>;
|
|
98
113
|
mcpToolAllowlist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
99
|
-
|
|
100
|
-
promptTemplate: z.ZodString;
|
|
101
|
-
continuesSession: z.ZodOptional<z.ZodBoolean>;
|
|
102
|
-
description: z.ZodOptional<z.ZodString>;
|
|
103
|
-
}, z.core.$strip>>>;
|
|
104
|
-
entryStage: z.ZodOptional<z.ZodString>;
|
|
114
|
+
delegable: z.ZodOptional<z.ZodBoolean>;
|
|
105
115
|
}, z.core.$strip>;
|
|
106
116
|
export declare const agentRefOverrideSchema: z.ZodObject<{
|
|
117
|
+
loadRules: z.ZodOptional<z.ZodBoolean>;
|
|
118
|
+
disableHooks: z.ZodOptional<z.ZodBoolean>;
|
|
119
|
+
skills: z.ZodOptional<z.ZodBoolean>;
|
|
120
|
+
settingSources: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
121
|
+
user: "user";
|
|
122
|
+
project: "project";
|
|
123
|
+
local: "local";
|
|
124
|
+
}>>>;
|
|
125
|
+
projectContext: z.ZodOptional<z.ZodBoolean>;
|
|
107
126
|
ref: z.ZodString;
|
|
108
127
|
promptTemplate: z.ZodOptional<z.ZodString>;
|
|
109
128
|
directive: z.ZodOptional<z.ZodString>;
|
|
@@ -116,6 +135,15 @@ export declare const agentRefOverrideSchema: z.ZodObject<{
|
|
|
116
135
|
mcpToolAllowlist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
117
136
|
}, z.core.$strip>;
|
|
118
137
|
export declare const agentRefSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
138
|
+
loadRules: z.ZodOptional<z.ZodBoolean>;
|
|
139
|
+
disableHooks: z.ZodOptional<z.ZodBoolean>;
|
|
140
|
+
skills: z.ZodOptional<z.ZodBoolean>;
|
|
141
|
+
settingSources: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
142
|
+
user: "user";
|
|
143
|
+
project: "project";
|
|
144
|
+
local: "local";
|
|
145
|
+
}>>>;
|
|
146
|
+
projectContext: z.ZodOptional<z.ZodBoolean>;
|
|
119
147
|
ref: z.ZodString;
|
|
120
148
|
promptTemplate: z.ZodOptional<z.ZodString>;
|
|
121
149
|
directive: z.ZodOptional<z.ZodString>;
|
|
@@ -131,6 +159,15 @@ export declare const templateSchema: z.ZodObject<{
|
|
|
131
159
|
name: z.ZodOptional<z.ZodString>;
|
|
132
160
|
description: z.ZodString;
|
|
133
161
|
agents: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
162
|
+
loadRules: z.ZodOptional<z.ZodBoolean>;
|
|
163
|
+
disableHooks: z.ZodOptional<z.ZodBoolean>;
|
|
164
|
+
skills: z.ZodOptional<z.ZodBoolean>;
|
|
165
|
+
settingSources: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
166
|
+
user: "user";
|
|
167
|
+
project: "project";
|
|
168
|
+
local: "local";
|
|
169
|
+
}>>>;
|
|
170
|
+
projectContext: z.ZodOptional<z.ZodBoolean>;
|
|
134
171
|
ref: z.ZodString;
|
|
135
172
|
promptTemplate: z.ZodOptional<z.ZodString>;
|
|
136
173
|
directive: z.ZodOptional<z.ZodString>;
|
|
@@ -38,6 +38,15 @@ export const hooksSchema = z.object({
|
|
|
38
38
|
onTransition: hookConfigSchema.optional(),
|
|
39
39
|
onEnd: hookConfigSchema.optional(),
|
|
40
40
|
});
|
|
41
|
+
/** The execution-environment fields, spelled once: an agent declares them and a template ref may
|
|
42
|
+
* override all but `delegable` (which decides what the agent IS, not how one template runs it). */
|
|
43
|
+
const environmentShape = {
|
|
44
|
+
loadRules: z.boolean().optional(),
|
|
45
|
+
disableHooks: z.boolean().optional(),
|
|
46
|
+
skills: z.boolean().optional(),
|
|
47
|
+
settingSources: z.array(z.enum(['user', 'project', 'local'])).optional(),
|
|
48
|
+
projectContext: z.boolean().optional(),
|
|
49
|
+
};
|
|
41
50
|
export const agentSchema = z.object({
|
|
42
51
|
name: z.string().min(1),
|
|
43
52
|
description: z.string().optional(),
|
|
@@ -52,6 +61,8 @@ export const agentSchema = z.object({
|
|
|
52
61
|
pluginDirs: z.array(z.string()).optional(),
|
|
53
62
|
mcpComposition: z.enum(['direct', 'thread-control', 'none']).optional(),
|
|
54
63
|
mcpToolAllowlist: z.array(z.string()).optional(),
|
|
64
|
+
delegable: z.boolean().optional(),
|
|
65
|
+
...environmentShape,
|
|
55
66
|
stages: z.record(z.string(), stageSchema).optional(),
|
|
56
67
|
entryStage: z.string().optional(),
|
|
57
68
|
});
|
|
@@ -66,6 +77,7 @@ export const agentRefOverrideSchema = z.object({
|
|
|
66
77
|
tools: z.string().optional(),
|
|
67
78
|
pluginDirs: z.array(z.string()).optional(),
|
|
68
79
|
mcpToolAllowlist: z.array(z.string()).optional(),
|
|
80
|
+
...environmentShape,
|
|
69
81
|
});
|
|
70
82
|
export const agentRefSchema = z.union([z.string().min(1), agentRefOverrideSchema]);
|
|
71
83
|
export const templateSchema = z.object({
|
|
@@ -43,6 +43,7 @@ export declare function createAppRouter(service: UiService): import("@trpc/serve
|
|
|
43
43
|
input: {
|
|
44
44
|
sessionId: string;
|
|
45
45
|
compactSubagents?: boolean;
|
|
46
|
+
since?: string;
|
|
46
47
|
};
|
|
47
48
|
output: import("./types.js").SessionTranscript;
|
|
48
49
|
meta: object;
|
|
@@ -123,6 +124,14 @@ export declare function createAppRouter(service: UiService): import("@trpc/serve
|
|
|
123
124
|
output: import("./types.js").SessionsSetProfileReturn;
|
|
124
125
|
meta: object;
|
|
125
126
|
}>;
|
|
127
|
+
setAgent: import("@trpc/server").TRPCMutationProcedure<{
|
|
128
|
+
input: {
|
|
129
|
+
sessionId: string;
|
|
130
|
+
agentName?: string;
|
|
131
|
+
};
|
|
132
|
+
output: import("./types.js").SessionsSetAgentReturn;
|
|
133
|
+
meta: object;
|
|
134
|
+
}>;
|
|
126
135
|
setSelection: import("@trpc/server").TRPCMutationProcedure<{
|
|
127
136
|
input: {
|
|
128
137
|
sessionId: string;
|
|
@@ -157,6 +166,7 @@ export declare function createAppRouter(service: UiService): import("@trpc/serve
|
|
|
157
166
|
projectId: string;
|
|
158
167
|
text: string;
|
|
159
168
|
profileName?: string;
|
|
169
|
+
agentName?: string;
|
|
160
170
|
selection?: {
|
|
161
171
|
model?: string;
|
|
162
172
|
provider?: string;
|
|
@@ -6,7 +6,7 @@ import { platformSettingsInput } from '../../core/platform-settings-spec.js';
|
|
|
6
6
|
import { TRPCError } from '@trpc/server';
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
import { router, publicProcedure } from './trpc.js';
|
|
9
|
-
import { projectsListInput, projectsCreateInput, sessionsListInput, sessionsTranscriptInput, sessionsSubagentTranscriptInput, sessionsDebugDetailsInput, sessionsCreateInput, sessionsSendInput, sessionsCancelInput, sessionsCompactInput, sessionsSetProfileInput, sessionsSetSelectionInput, sessionsSetCommissionInput, sessionsCreateAndSendInput, sessionsMarkReadInput, sessionsMarkManyReadInput, sessionsAnswerQuestionInput, sessionsRespondPlanInput, sessionsRespondDecisionInput, sessionsCancelResumeInput, sessionsRewindInput, sessionsPendingInteractionInput, threadsListInput, threadsGetInput, tasksListInput, taskVerificationInput, schedulesListInput, commissionsListInput, commissionsGetInput, commissionsDecisionsInput, commissionCloseInput, executionsListInput, waitpointsListInput, executionsGetInput, memoryTreeInput, memoryFileInput, approvalsListInput, approvalsApproveInput, approvalsRejectInput, approvalsRequestInput, issuesListInput, issueActionInput, notesListInput, noteAddInput, noteUpdateInput, noteSetCompletedInput, noteActionInput, notesClearCompletedInput, costSummaryInput, threadsCancelInput, executionsCancelInput, waitpointsCancelInput, scheduleActionInput, scheduleAddInput, scheduleUpdateInput, taskActionInput, taskCompleteInput, taskBlockInput, configGetInput, configSetInput, configSetProviderRateLimitPolicyInput, authStatusInput, authFlowStateInput, authStartLoginInput, authRespondPromptInput, authCancelFlowInput, authLogoutInput, authSyncGatewayInput, authCustomProvidersInput, authUpsertCustomProviderInput, authRemoveCustomProviderInput, hooksListInput, hooksCreateInput, hooksUpdateInput, hooksSetEnabledInput, hooksRemoveInput, hooksTestInput, profilesCreateInput, profilesUpdateInput, profilesRemoveInput, modelsCatalogInput, machinesListInput, machineDetailInput, skillsListInput, pluginsListInput, pluginsAssignInput, pluginsSkillFileInput, pluginsSkillWriteInput, pluginsSkillCreateInput, pluginsSkillMoveInput, pluginsSkillRemoveInput, pluginsCreateInput, pluginsRemoveInput, pluginsConvertInput, pluginsMcpReadInput, pluginsMcpWriteInput, threadTemplatesGetInput, threadTemplatesDetailInput, threadTemplatesValidateInput, threadTemplatesSaveInput, threadTemplatesRemoveInput, systemDaemonStatusInput, systemRateLimitStatusInput, systemUsageStatusInput, systemNoticesInput, systemRestartInput, systemClearRateLimitInput, systemRefreshUsageInput, systemUpdateStatusInput, systemApplyUpdateInput, systemSkipUpdateInput, } from './input-schemas.js';
|
|
9
|
+
import { projectsListInput, projectsCreateInput, sessionsListInput, sessionsTranscriptInput, sessionsSubagentTranscriptInput, sessionsDebugDetailsInput, sessionsCreateInput, sessionsSendInput, sessionsCancelInput, sessionsCompactInput, sessionsSetProfileInput, sessionsSetAgentInput, sessionsSetSelectionInput, sessionsSetCommissionInput, sessionsCreateAndSendInput, sessionsMarkReadInput, sessionsMarkManyReadInput, sessionsAnswerQuestionInput, sessionsRespondPlanInput, sessionsRespondDecisionInput, sessionsCancelResumeInput, sessionsRewindInput, sessionsPendingInteractionInput, threadsListInput, threadsGetInput, tasksListInput, taskVerificationInput, schedulesListInput, commissionsListInput, commissionsGetInput, commissionsDecisionsInput, commissionCloseInput, executionsListInput, waitpointsListInput, executionsGetInput, memoryTreeInput, memoryFileInput, approvalsListInput, approvalsApproveInput, approvalsRejectInput, approvalsRequestInput, issuesListInput, issueActionInput, notesListInput, noteAddInput, noteUpdateInput, noteSetCompletedInput, noteActionInput, notesClearCompletedInput, costSummaryInput, threadsCancelInput, executionsCancelInput, waitpointsCancelInput, scheduleActionInput, scheduleAddInput, scheduleUpdateInput, taskActionInput, taskCompleteInput, taskBlockInput, configGetInput, configSetInput, configSetProviderRateLimitPolicyInput, authStatusInput, authFlowStateInput, authStartLoginInput, authRespondPromptInput, authCancelFlowInput, authLogoutInput, authSyncGatewayInput, authCustomProvidersInput, authUpsertCustomProviderInput, authRemoveCustomProviderInput, hooksListInput, hooksCreateInput, hooksUpdateInput, hooksSetEnabledInput, hooksRemoveInput, hooksTestInput, profilesCreateInput, profilesUpdateInput, profilesRemoveInput, modelsCatalogInput, machinesListInput, machineDetailInput, skillsListInput, pluginsListInput, pluginsAssignInput, pluginsSkillFileInput, pluginsSkillWriteInput, pluginsSkillCreateInput, pluginsSkillMoveInput, pluginsSkillRemoveInput, pluginsCreateInput, pluginsRemoveInput, pluginsConvertInput, pluginsMcpReadInput, pluginsMcpWriteInput, threadTemplatesGetInput, threadTemplatesDetailInput, threadTemplatesValidateInput, threadTemplatesSaveInput, threadTemplatesRemoveInput, systemDaemonStatusInput, systemRateLimitStatusInput, systemUsageStatusInput, systemNoticesInput, systemRestartInput, systemClearRateLimitInput, systemRefreshUsageInput, systemUpdateStatusInput, systemApplyUpdateInput, systemSkipUpdateInput, } from './input-schemas.js';
|
|
10
10
|
// ── Subscribe filter input (no keyed schema for subscribe; router-local) ──
|
|
11
11
|
const subscribeFilterInput = z.object({
|
|
12
12
|
events: z.array(z.string()),
|
|
@@ -83,6 +83,7 @@ function sessionsRouter(service) {
|
|
|
83
83
|
cancel: makeMutation(service, 'sessions.cancel', sessionsCancelInput),
|
|
84
84
|
compact: makeMutation(service, 'sessions.compact', sessionsCompactInput),
|
|
85
85
|
setProfile: makeMutation(service, 'sessions.setProfile', sessionsSetProfileInput),
|
|
86
|
+
setAgent: makeMutation(service, 'sessions.setAgent', sessionsSetAgentInput),
|
|
86
87
|
setSelection: makeMutation(service, 'sessions.setSelection', sessionsSetSelectionInput),
|
|
87
88
|
setCommission: makeMutation(service, 'sessions.setCommission', sessionsSetCommissionInput),
|
|
88
89
|
createAndSend: makeMutation(service, 'sessions.createAndSend', sessionsCreateAndSendInput),
|