@cortex-agent/server 2026.6.11 → 2026.6.18-2
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.json +2 -2
- package/defaults/hooks/task-status-check.mjs +9 -7
- package/defaults/plugins/cortex-stage-gate/skills/task/SKILL.md +103 -16
- package/defaults/plugins/cortex-system/skills/orient/SKILL.md +6 -6
- package/defaults/plugins/cortex-system/skills/thread/SKILL.md +29 -35
- package/defaults/prompts/directives/manager.md +21 -11
- package/dist/agent-adapter/claude/spawn-args.d.ts +5 -0
- package/dist/agent-adapter/claude/spawn-args.js +6 -0
- package/dist/agent-adapter/types.d.ts +4 -0
- package/dist/core/gateway-generator.js +24 -3
- package/dist/core/i18n.d.ts +19 -0
- package/dist/core/i18n.js +46 -0
- package/dist/core/locales/en.d.ts +438 -0
- package/dist/core/locales/en.js +24 -0
- package/dist/core/locales/slices/commands.d.ts +214 -0
- package/dist/core/locales/slices/commands.js +462 -0
- package/dist/core/locales/slices/init.d.ts +121 -0
- package/dist/core/locales/slices/init.js +380 -0
- package/dist/core/locales/slices/interactions.d.ts +47 -0
- package/dist/core/locales/slices/interactions.js +102 -0
- package/dist/core/locales/slices/lang.d.ts +8 -0
- package/dist/core/locales/slices/lang.js +18 -0
- package/dist/core/locales/slices/scheduling.d.ts +36 -0
- package/dist/core/locales/slices/scheduling.js +74 -0
- package/dist/core/locales/slices/startup.d.ts +6 -0
- package/dist/core/locales/slices/startup.js +14 -0
- package/dist/core/locales/slices/status.d.ts +20 -0
- package/dist/core/locales/slices/status.js +48 -0
- package/dist/core/locales/zh.d.ts +5 -0
- package/dist/core/locales/zh.js +23 -0
- package/dist/core/singleton-lock.d.ts +23 -0
- package/dist/core/singleton-lock.js +53 -0
- package/dist/core/status-format.js +2 -1
- package/dist/core/task-parser.d.ts +6 -0
- package/dist/core/task-parser.js +10 -0
- package/dist/core/types/thread-types.d.ts +29 -0
- package/dist/core/utils.d.ts +9 -1
- package/dist/core/utils.js +9 -1
- package/dist/domain/agents/config.d.ts +2 -1
- package/dist/domain/agents/config.js +25 -6
- package/dist/domain/agents/facade.d.ts +4 -0
- package/dist/domain/agents/facade.js +3 -1
- package/dist/domain/mcp/core-server.js +15 -9
- package/dist/domain/mcp/tools/task-monitor.d.ts +2 -0
- package/dist/domain/mcp/tools/task-monitor.js +99 -0
- package/dist/domain/mcp/tools/thread-ops.js +50 -85
- package/dist/domain/scheduling/jobs/task-dispatch.js +18 -16
- package/dist/domain/scheduling/schedule-command.js +38 -37
- package/dist/domain/system/github-release.d.ts +18 -0
- package/dist/domain/system/github-release.js +106 -0
- package/dist/domain/system/preferences.d.ts +12 -0
- package/dist/domain/system/preferences.js +36 -0
- package/dist/domain/tasks/dispatch-utils.d.ts +5 -0
- package/dist/domain/tasks/dispatch-utils.js +9 -1
- package/dist/domain/tasks/dispatcher.d.ts +11 -2
- package/dist/domain/tasks/dispatcher.js +41 -11
- package/dist/domain/tasks/system/task-cli.d.ts +1 -0
- package/dist/domain/tasks/system/task-cli.js +82 -6
- package/dist/domain/tasks/system/task-mutations.d.ts +6 -1
- package/dist/domain/tasks/system/task-mutations.js +10 -1
- package/dist/domain/threads/hook-runner.js +1 -0
- package/dist/domain/threads/prompt-builder.d.ts +6 -0
- package/dist/domain/threads/prompt-builder.js +34 -11
- package/dist/domain/threads/runner.d.ts +5 -0
- package/dist/domain/threads/runner.js +44 -11
- package/dist/domain/threads/state-machine.d.ts +9 -12
- package/dist/domain/threads/state-machine.js +27 -50
- package/dist/entry/app.js +36 -3
- package/dist/entry/daemon.js +12 -30
- package/dist/entry/init.d.ts +4 -3
- package/dist/entry/init.js +151 -208
- package/dist/entry/startup-notify.js +6 -3
- package/dist/hooks/task-status-check.mjs +9 -7
- package/dist/orchestration/interactions/interaction-handlers.js +12 -11
- package/dist/orchestration/interactions/update-prompt-slack.js +11 -10
- package/dist/orchestration/interactions/update-prompt.js +66 -11
- package/dist/orchestration/lifecycle.js +13 -12
- package/dist/orchestration/routing/commands/cancel.js +10 -9
- package/dist/orchestration/routing/commands/channel.js +27 -26
- package/dist/orchestration/routing/commands/cost.js +10 -2
- package/dist/orchestration/routing/commands/device.js +11 -9
- package/dist/orchestration/routing/commands/dispatch.js +10 -10
- package/dist/orchestration/routing/commands/index.js +6 -2
- package/dist/orchestration/routing/commands/lang.d.ts +3 -0
- package/dist/orchestration/routing/commands/lang.js +31 -0
- package/dist/orchestration/routing/commands/mode.js +28 -27
- package/dist/orchestration/routing/commands/nvtop.js +13 -12
- package/dist/orchestration/routing/commands/orient.js +2 -1
- package/dist/orchestration/routing/commands/schedule.js +23 -22
- package/dist/orchestration/routing/commands/sendfile.js +8 -7
- package/dist/orchestration/routing/commands/session.js +11 -10
- package/dist/orchestration/routing/commands/status.js +78 -71
- package/dist/orchestration/routing/commands/tail.js +6 -5
- package/dist/orchestration/routing/commands/task.js +23 -22
- package/dist/orchestration/routing/commands/thread-handlers.js +40 -39
- package/dist/orchestration/routing/webhook.js +38 -1
- package/dist/orchestration/status-helpers.js +6 -5
- package/dist/orchestration/thread-callback.d.ts +11 -1
- package/dist/orchestration/thread-callback.js +66 -30
- package/dist/platform/adapters/feishu.d.ts +27 -0
- package/dist/platform/adapters/feishu.js +136 -4
- package/dist/platform/interactive-builder.js +19 -18
- package/dist/store/version-migrations.d.ts +7 -0
- package/dist/store/version-migrations.js +88 -0
- package/package.json +1 -1
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// input: McpServer, @core/task-parser (reads TASKS.yaml on disk)
|
|
2
|
+
// output: task_status / task_result / task_list read-only tool registrations
|
|
3
|
+
// pos: Agent-facing task monitoring. Delegation is done via the cortex-task CLI (add / spawn);
|
|
4
|
+
// these tools let an agent observe a task it created or depends on without shelling out.
|
|
5
|
+
// Read-only and disk-direct (TASKS.yaml is on the shared filesystem) — no daemon webhook,
|
|
6
|
+
// mirroring tools/context.ts. They replace the removed thread_status / thread_result /
|
|
7
|
+
// thread_list monitoring tools now that a task (not a thread) is the unit of delegation.
|
|
8
|
+
// >>> If I am updated, update my header comment and the parent folder's CORTEX.md <<<
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
import { scanAllTasks, isActionable, completedHashSet, filterTasks, } from '../../../core/task-parser.js';
|
|
11
|
+
/** Default project scope from env so an in-task agent need not re-declare it. null = all projects. */
|
|
12
|
+
function defaultProject(project) {
|
|
13
|
+
return project || process.env.CORTEX_TASK_PROJECT || process.env.CORTEX_PROJECT || null;
|
|
14
|
+
}
|
|
15
|
+
function statusView(task, completed) {
|
|
16
|
+
return {
|
|
17
|
+
id: task.id,
|
|
18
|
+
project: task.project,
|
|
19
|
+
text: task.text,
|
|
20
|
+
status: task.status,
|
|
21
|
+
actionable: isActionable(task, completed),
|
|
22
|
+
priority: task.priority,
|
|
23
|
+
template: task.template,
|
|
24
|
+
parent: task.parent,
|
|
25
|
+
depends_on: task.depends_on,
|
|
26
|
+
claimed_by: task.claimed_by,
|
|
27
|
+
blocked_by: task.blocked_by,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function jsonResult(payload) {
|
|
31
|
+
return { content: [{ type: 'text', text: JSON.stringify(payload, null, 2) }] };
|
|
32
|
+
}
|
|
33
|
+
export function registerTaskMonitorTools(server) {
|
|
34
|
+
// --- task_status ---
|
|
35
|
+
server.tool('task_status', 'Query a task\'s current lifecycle state: status (open/pending/done), whether it is actionable, who claimed it, what blocks it, its dependencies and parent. Read-only view of TASKS.yaml. Use to poll a child task you created via `cortex-task spawn` (or any task you depend on).', {
|
|
36
|
+
task_id: z.string().describe('Task id (4-char hex).'),
|
|
37
|
+
project: z.string().optional().describe('Project to scope the lookup. Defaults to CORTEX_TASK_PROJECT / CORTEX_PROJECT, else all projects.'),
|
|
38
|
+
}, { readOnlyHint: true }, async ({ task_id, project }) => {
|
|
39
|
+
try {
|
|
40
|
+
const all = scanAllTasks(defaultProject(project));
|
|
41
|
+
const task = all.find((t) => t.id === task_id);
|
|
42
|
+
if (!task)
|
|
43
|
+
return { content: [{ type: 'text', text: `task ${task_id} not found` }], isError: true };
|
|
44
|
+
return jsonResult(statusView(task, completedHashSet(all)));
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
return { content: [{ type: 'text', text: `task_status error: ${e.message}` }], isError: true };
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
// --- task_result ---
|
|
51
|
+
server.tool('task_result', 'Fetch a task\'s outcome: its done/blocked state, success criteria (done_when), completion note, and block reason. If the task is not yet terminal, the result is partial (a note flags this). Read-only. Use after a child task you depend on turns terminal to inspect what it produced.', {
|
|
52
|
+
task_id: z.string().describe('Task id (4-char hex).'),
|
|
53
|
+
project: z.string().optional().describe('Project to scope the lookup. Defaults to CORTEX_TASK_PROJECT / CORTEX_PROJECT, else all projects.'),
|
|
54
|
+
}, { readOnlyHint: true }, async ({ task_id, project }) => {
|
|
55
|
+
try {
|
|
56
|
+
const all = scanAllTasks(defaultProject(project));
|
|
57
|
+
const task = all.find((t) => t.id === task_id);
|
|
58
|
+
if (!task)
|
|
59
|
+
return { content: [{ type: 'text', text: `task ${task_id} not found` }], isError: true };
|
|
60
|
+
const terminal = task.status === 'done' || !!task.blocked_by;
|
|
61
|
+
return jsonResult({
|
|
62
|
+
id: task.id,
|
|
63
|
+
project: task.project,
|
|
64
|
+
text: task.text,
|
|
65
|
+
status: task.status,
|
|
66
|
+
terminal,
|
|
67
|
+
...(terminal ? {} : { note: 'task not yet terminal — result is partial' }),
|
|
68
|
+
done_when: task.done_when,
|
|
69
|
+
completed_at: task.completed_at,
|
|
70
|
+
completed_note: task.completed_note,
|
|
71
|
+
blocked_by: task.blocked_by,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
catch (e) {
|
|
75
|
+
return { content: [{ type: 'text', text: `task_result error: ${e.message}` }], isError: true };
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
// --- task_list ---
|
|
79
|
+
server.tool('task_list', 'List tasks, newest-first by file order, optionally filtered by project and status. Each entry is a compact status view. Use to see the children you spawned under a parent, or the actionable queue of a project.', {
|
|
80
|
+
project: z.string().optional().describe('Project to scope. Defaults to CORTEX_TASK_PROJECT / CORTEX_PROJECT, else all projects.'),
|
|
81
|
+
status: z.string().optional().describe('Filter by status: actionable / open / blocked / in-progress / paused / pending / completed / approval-needed / approved.'),
|
|
82
|
+
parent: z.string().optional().describe('Only tasks whose parent is this task id (the children you spawned).'),
|
|
83
|
+
limit: z.number().optional().describe('Max tasks to return (default 50).'),
|
|
84
|
+
}, { readOnlyHint: true }, async ({ project, status, parent, limit }) => {
|
|
85
|
+
try {
|
|
86
|
+
const proj = defaultProject(project);
|
|
87
|
+
const all = scanAllTasks(proj);
|
|
88
|
+
const completed = completedHashSet(all);
|
|
89
|
+
let tasks = filterTasks(all, { project: proj, status }, completed);
|
|
90
|
+
if (parent)
|
|
91
|
+
tasks = tasks.filter((t) => t.parent === parent);
|
|
92
|
+
const out = tasks.slice(0, limit ?? 50).map((t) => statusView(t, completed));
|
|
93
|
+
return jsonResult({ count: out.length, tasks: out });
|
|
94
|
+
}
|
|
95
|
+
catch (e) {
|
|
96
|
+
return { content: [{ type: 'text', text: `task_list error: ${e.message}` }], isError: true };
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
// input: McpServer, webhook proxy,
|
|
2
|
-
// output:
|
|
3
|
-
// pos:
|
|
4
|
-
//
|
|
5
|
-
//
|
|
1
|
+
// input: McpServer, webhook proxy, CORTEX_THREAD_ID env
|
|
2
|
+
// output: thread_abort / thread_split / thread_wait registrations (DR-0015 control plane)
|
|
3
|
+
// pos: Self-control of the CALLER'S OWN thread, proxied through the daemon webhook. An agent
|
|
4
|
+
// signals its own thread (CORTEX_THREAD_ID) and the runner reads metadata.pendingControl at
|
|
5
|
+
// the step boundary — no artifact string markers. The agent-facing thread spawn/monitor
|
|
6
|
+
// tools (thread_start + thread_status/result/list/list_templates/cancel) were REMOVED:
|
|
7
|
+
// delegation is now done via the task system (cortex-task spawn / add) and monitored via the
|
|
8
|
+
// read-only task_* tools. thread_wait is the suspend primitive paired with cortex-task spawn.
|
|
6
9
|
// >>> If I am updated, update my header comment and the parent folder's CORTEX.md <<<
|
|
7
10
|
import { z } from 'zod';
|
|
8
11
|
// Thread operations proxied through the daemon webhook (separate process, no shared memory with
|
|
@@ -20,102 +23,64 @@ async function proxyThreadOp(action, payload) {
|
|
|
20
23
|
return data.data;
|
|
21
24
|
}
|
|
22
25
|
export function registerThreadTools(server) {
|
|
23
|
-
// ---
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}, async ({
|
|
26
|
+
// --- Control plane (DR-0015): self-control of the CALLER'S OWN thread ---
|
|
27
|
+
// All three target CORTEX_THREAD_ID (the thread you are running inside) — you never pass a
|
|
28
|
+
// threadId. They write a structured intent the runner consumes at the next step boundary, then
|
|
29
|
+
// your step should end. Calling outside a thread (no CORTEX_THREAD_ID) is an error.
|
|
30
|
+
const selfThreadId = () => {
|
|
31
|
+
const id = process.env.CORTEX_THREAD_ID;
|
|
32
|
+
if (!id)
|
|
33
|
+
throw new Error('not running inside a thread (CORTEX_THREAD_ID unset) — control tools only work from within a thread');
|
|
34
|
+
return id;
|
|
35
|
+
};
|
|
36
|
+
// --- thread_abort ---
|
|
37
|
+
server.tool('thread_abort', 'Abort (escalate) YOUR OWN thread when the task cannot be completed as scoped — terminal state `aborted`, distinct from `failed`. Use only when truly blocked: a missing prerequisite, contradictory requirements, or a task far bigger / mis-scoped than its description. A precise diagnosis is the most valuable thing you can produce — it beats a half-done grind. For a dispatch task this blocks the task with your diagnosis and escalates it (its manager, or a human, re-plans). Normal retries, minor issues, or disagreements with the plan are NOT abort cases. After calling, end your step.', {
|
|
38
|
+
kind: z.enum(['too-big', 'mis-scoped', 'blocked-external']).describe('Why you are aborting: "too-big" (needs decomposition into independent units), "mis-scoped" (the task definition is wrong) — both route to a re-planning manager; "blocked-external" (a missing external resource / dependency you cannot obtain) routes to a human.'),
|
|
39
|
+
diagnosis: z.string().min(1).describe('Required one-line diagnosis of the real structure / blocker. Becomes the abort reason and the task block reason.'),
|
|
40
|
+
}, async ({ kind, diagnosis }) => {
|
|
38
41
|
try {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
const projectId = project || process.env.CORTEX_PROJECT || undefined;
|
|
43
|
-
const channel = process.env.SLACK_CHANNEL || undefined;
|
|
44
|
-
const depth = parseInt(process.env.CORTEX_THREAD_DEPTH || '0', 10) || 0;
|
|
45
|
-
const parentSessionId = process.env.CORTEX_SESSION_ID || null;
|
|
46
|
-
const parentThreadId = process.env.CORTEX_THREAD_ID || null;
|
|
47
|
-
const parentChannel = process.env.SLACK_CHANNEL || null;
|
|
48
|
-
const parentProfile = process.env.CORTEX_PROFILE || null;
|
|
49
|
-
const result = await proxyThreadOp('start', {
|
|
50
|
-
template, agent, message, projectId, channel, depth, parentSessionId, parentThreadId, parentChannel, parentProfile,
|
|
51
|
-
goal, done_when, context_files, deliverable_path, budget_usd, wait,
|
|
52
|
-
});
|
|
42
|
+
const threadId = selfThreadId();
|
|
43
|
+
const result = await proxyThreadOp('control', { threadId, control: { action: 'abort', kind, diagnosis } });
|
|
53
44
|
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
54
45
|
}
|
|
55
46
|
catch (e) {
|
|
56
|
-
return { content: [{ type: 'text', text: `
|
|
47
|
+
return { content: [{ type: 'text', text: `thread_abort error: ${e.message}` }], isError: true };
|
|
57
48
|
}
|
|
58
49
|
});
|
|
59
|
-
// ---
|
|
60
|
-
server.tool('
|
|
61
|
-
|
|
62
|
-
|
|
50
|
+
// --- thread_split ---
|
|
51
|
+
server.tool('thread_split', 'Propose a decomposition of YOUR OWN (dispatch) task instead of doing it: the task is decomposed into the given children (keep-parent — your task becomes the join/acceptance node depending on all children), unclaimed, and the children flow through the normal dispatch queue. Use when the task is actually several independently verifiable units. After calling, end your step.', {
|
|
52
|
+
subtasks: z.array(z.object({
|
|
53
|
+
key: z.string().optional().describe('Local key for sibling depends_on references within this batch.'),
|
|
54
|
+
text: z.string().describe('What this child must do (imperative, one unit of work).'),
|
|
55
|
+
template: z.string().optional().describe('Thread template the child runs under (e.g. coder-review). Inherits the parent template when omitted.'),
|
|
56
|
+
why: z.string().optional().describe('Why this child exists.'),
|
|
57
|
+
done_when: z.string().optional().describe('Verifiable completion criteria for this child.'),
|
|
58
|
+
priority: z.string().optional(),
|
|
59
|
+
plan: z.string().optional(),
|
|
60
|
+
depends_on: z.array(z.string()).optional().describe('Sibling keys (from this batch) or existing 4-hex task ids this child depends on.'),
|
|
61
|
+
})).min(1).describe('Non-empty array of child subtasks (decomposeTask shape).'),
|
|
62
|
+
}, async ({ subtasks }) => {
|
|
63
63
|
try {
|
|
64
|
-
const
|
|
64
|
+
const threadId = selfThreadId();
|
|
65
|
+
const result = await proxyThreadOp('control', { threadId, control: { action: 'split', subtasks } });
|
|
65
66
|
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
66
67
|
}
|
|
67
68
|
catch (e) {
|
|
68
|
-
return { content: [{ type: 'text', text: `
|
|
69
|
+
return { content: [{ type: 'text', text: `thread_split error: ${e.message}` }], isError: true };
|
|
69
70
|
}
|
|
70
71
|
});
|
|
71
|
-
// ---
|
|
72
|
-
server.tool('
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
// --- thread_wait ---
|
|
73
|
+
server.tool('thread_wait', 'Suspend YOUR OWN thread until its awaited children finish (DR-0014 parent suspension). Call this after creating child tasks you depend on (cortex-task spawn) — you are re-entered once ALL awaited children are terminal, with their results injected. If nothing is left to wait on, the thread simply continues. After calling, end your step.', {
|
|
74
|
+
on_tasks: z.array(z.string()).optional().describe('Optional explicit child task ids to wait on (otherwise inferred from the thread / task tree).'),
|
|
75
|
+
on_threads: z.array(z.string()).optional().describe('Optional explicit child thread ids to wait on (otherwise inferred from spawned children).'),
|
|
76
|
+
}, async ({ on_tasks, on_threads }) => {
|
|
75
77
|
try {
|
|
76
|
-
const
|
|
78
|
+
const threadId = selfThreadId();
|
|
79
|
+
const result = await proxyThreadOp('control', { threadId, control: { action: 'wait', on_tasks, on_threads } });
|
|
77
80
|
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
78
81
|
}
|
|
79
82
|
catch (e) {
|
|
80
|
-
return { content: [{ type: 'text', text: `
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
// --- thread_list ---
|
|
84
|
-
server.tool('thread_list', 'List threads you started, newest first. scope "mine" (default) returns threads spawned from your current session; "project" returns all threads in the current project. Each entry has threadId, status, template/agent, step count, cost, and timestamps — use thread_status / thread_result for full detail.', {
|
|
85
|
-
scope: z.enum(['mine', 'project']).optional().describe('"mine" (default): threads you started from this session. "project": all threads in the current project (any starter).'),
|
|
86
|
-
limit: z.number().optional().describe('Max threads to return (default 50, newest first).'),
|
|
87
|
-
view: z.enum(['flat', 'tree']).optional().describe('"flat" (default): newest-first list. "tree": nested thread trees (children under parents) with per-root rollups (nodeCount / totalCostUsd / byStatus / maxDepth).'),
|
|
88
|
-
}, { readOnlyHint: true }, async ({ scope, limit, view }) => {
|
|
89
|
-
try {
|
|
90
|
-
const parentSessionId = process.env.CORTEX_SESSION_ID || null;
|
|
91
|
-
const projectId = process.env.CORTEX_PROJECT || undefined;
|
|
92
|
-
const result = await proxyThreadOp('list-threads', { scope: scope || 'mine', parentSessionId, projectId, limit, view });
|
|
93
|
-
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
94
|
-
}
|
|
95
|
-
catch (e) {
|
|
96
|
-
return { content: [{ type: 'text', text: `thread_list error: ${e.message}` }], isError: true };
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
// --- thread_list_templates ---
|
|
100
|
-
server.tool('thread_list_templates', 'List available thread templates (multi-agent pipelines) and agents (single ad-hoc roles) with their descriptions. Use to discover what can be passed to thread_start.', {}, { readOnlyHint: true }, async () => {
|
|
101
|
-
try {
|
|
102
|
-
const result = await proxyThreadOp('list', {});
|
|
103
|
-
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
104
|
-
}
|
|
105
|
-
catch (e) {
|
|
106
|
-
return { content: [{ type: 'text', text: `thread_list_templates error: ${e.message}` }], isError: true };
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
// --- thread_cancel ---
|
|
110
|
-
server.tool('thread_cancel', 'Cancel a running thread. Returns whether a running thread was found and cancelled.', {
|
|
111
|
-
threadId: z.string().describe('Thread id (thr_XXXX) to cancel'),
|
|
112
|
-
}, async ({ threadId }) => {
|
|
113
|
-
try {
|
|
114
|
-
const result = await proxyThreadOp('cancel', { threadId });
|
|
115
|
-
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
116
|
-
}
|
|
117
|
-
catch (e) {
|
|
118
|
-
return { content: [{ type: 'text', text: `thread_cancel error: ${e.message}` }], isError: true };
|
|
83
|
+
return { content: [{ type: 'text', text: `thread_wait error: ${e.message}` }], isError: true };
|
|
119
84
|
}
|
|
120
85
|
});
|
|
121
86
|
}
|
|
@@ -9,12 +9,11 @@ import * as executionRegistry from '../../executions/registry.js';
|
|
|
9
9
|
const log = createLogger('task-dispatch');
|
|
10
10
|
import * as pendingTaskTracker from '../../tasks/pending-tracker.js';
|
|
11
11
|
import { sessionStore } from '../../../store/session-registry-repo.js';
|
|
12
|
-
import { allConfigsRateLimited } from '../../agents/facade.js';
|
|
13
12
|
import { selectAndClaimTask, computeNextInterval, updateScheduleInterval } from '../../tasks/dispatcher.js';
|
|
14
13
|
import { taskMutator } from '../../tasks/mutator.js';
|
|
15
|
-
import { createThread,
|
|
14
|
+
import { createThread, detectSplitFromControl, clearPendingControl } from '../../threads/index.js';
|
|
16
15
|
import { runThread as runThreadExec } from '../../threads/runner.js';
|
|
17
|
-
import { processSplitOutcome, processAbortOutcome } from '../../tasks/dispatch-utils.js';
|
|
16
|
+
import { processSplitOutcome, processAbortOutcome, formatWorkerAbortReason } from '../../tasks/dispatch-utils.js';
|
|
18
17
|
import { threadStore } from '../../../store/thread-repo.js';
|
|
19
18
|
import { computeElapsed, buildSessionTag } from '../../../core/status-format.js';
|
|
20
19
|
import { finalizeThreadSuccess } from './_shared.js';
|
|
@@ -69,19 +68,16 @@ async function runDispatchAsync({ channel, scheduleTaskId, profileName }) {
|
|
|
69
68
|
let selectedTask = null;
|
|
70
69
|
let outcome = { success: false, skipped: false, note: '' };
|
|
71
70
|
try {
|
|
72
|
-
// Step 1: Dry run — check there is a dispatchable task without claiming
|
|
73
|
-
|
|
71
|
+
// Step 1: Dry run — check there is a dispatchable task without claiming.
|
|
72
|
+
// Rate-limit eligibility is decided per-task inside selection, against each task's
|
|
73
|
+
// TEMPLATE profiles (profileName only resolves __active__ slots) — see dispatcher.ts.
|
|
74
|
+
const preview = await selectAndClaimTask({ scheduleTaskId, dryRun: true, profileName });
|
|
74
75
|
if (!preview) {
|
|
75
76
|
outcome = { success: false, skipped: true, note: 'No dispatchable tasks available' };
|
|
76
77
|
return;
|
|
77
78
|
}
|
|
78
|
-
// Step 2:
|
|
79
|
-
|
|
80
|
-
outcome = { success: false, skipped: true, note: `All configs rate-limited for ${profileName}` };
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
// Step 3: Real claim + execute
|
|
84
|
-
const selected = await selectAndClaimTask({ scheduleTaskId });
|
|
79
|
+
// Step 2: Real claim + execute
|
|
80
|
+
const selected = await selectAndClaimTask({ scheduleTaskId, profileName });
|
|
85
81
|
if (!selected) {
|
|
86
82
|
outcome = { success: false, skipped: true, note: 'No dispatchable tasks available' };
|
|
87
83
|
return;
|
|
@@ -137,6 +133,9 @@ async function executeDispatchTask({ selected, selectedTask, channel, scheduleTa
|
|
|
137
133
|
adapter, channel: channel, threadAnchorId: statusMsg?.messageId || null, statusMsg, startTime,
|
|
138
134
|
destination: { type: 'project-report', projectId: selectedTask.project || channel, trigger: 'task-dispatch', sessionId: '' },
|
|
139
135
|
onToolUse: icb?.onToolUse ?? null, onPlanWritten: icb?.onPlanWritten ?? null, onAskUserQuestion: icb?.onAskUserQuestion ?? null,
|
|
136
|
+
// DR-0015 problem 2: block the owning task at abort time, BEFORE the onEnd task-status-check
|
|
137
|
+
// hook runs, so the hook sees a blocked task and does not unclaim it back to actionable.
|
|
138
|
+
onAbort: async ({ taskId, reason }) => { await taskMutator.block(taskId, formatWorkerAbortReason(reason)); },
|
|
140
139
|
extraHooks: {
|
|
141
140
|
onEnd: {
|
|
142
141
|
command: 'node hooks/task-status-check.mjs',
|
|
@@ -197,16 +196,19 @@ async function executeDispatchTask({ selected, selectedTask, channel, scheduleTa
|
|
|
197
196
|
dispatchFailureCounts.delete(selectedTask.id); // abort is judgment, not fault
|
|
198
197
|
return { success: !abortOutcome.error, skipped: false, note: abortOutcome.error ? `abort-block failed: ${abortOutcome.error}` : `[${selectedTask.project}] ${abortOutcome.note}` };
|
|
199
198
|
}
|
|
200
|
-
// DR-0014: the worker proposed a
|
|
201
|
-
//
|
|
202
|
-
//
|
|
199
|
+
// DR-0014: the worker proposed a decomposition (thread_split) instead of doing the task.
|
|
200
|
+
// The signal rides on metadata.pendingControl (DR-0015 problem 1), read via detectSplitFromControl.
|
|
201
|
+
// Decompose keep-parent (task becomes the join/acceptance node) and unclaim; the children flow
|
|
202
|
+
// through the normal dispatch queue.
|
|
203
203
|
const splitOutcome = await processSplitOutcome({ threadId: thread.id, taskId: selectedTask.id ?? null, project: selectedTask.project }, {
|
|
204
|
-
detect:
|
|
204
|
+
detect: detectSplitFromControl,
|
|
205
205
|
// system:true — no agent lock in the dispatch path; defer if a foreign lock exists.
|
|
206
206
|
decompose: (p, t, subs, tid, opts) => taskMutator.decompose(p, t, subs, tid, { ...opts, system: true }),
|
|
207
207
|
unclaim: (tid) => taskMutator.unclaim(tid),
|
|
208
208
|
});
|
|
209
209
|
if (splitOutcome.handled) {
|
|
210
|
+
// Control intent consumed — clear it so a re-read never re-fires.
|
|
211
|
+
await clearPendingControl(thread.id);
|
|
210
212
|
const text = splitOutcome.error
|
|
211
213
|
? `${Icons.error} [${selectedTask.project}] ${selectedTask.text.substring(0, 80)} | [SPLIT] proposal invalid: ${splitOutcome.error} — task unclaimed`
|
|
212
214
|
: `🌿 [${selectedTask.project}] ${selectedTask.text.substring(0, 80)} | ${splitOutcome.note}`;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// pos: !schedule subcommand routing and profile pinning
|
|
4
4
|
// >>> If I am updated, update my header comment and the parent folder's CORTEX.md <<<
|
|
5
5
|
import { Icons } from '../../core/icons.js';
|
|
6
|
+
import { t } from '../../core/i18n.js';
|
|
6
7
|
import { formatDuration, formatTimeUntil, parseDuration } from './scheduler.js';
|
|
7
8
|
import { channelToProjectId } from '../../store/schedule-repo.js';
|
|
8
9
|
import { listProfiles, resolveProfile, getDefaultProfileName } from '../agents/profile-manager.js';
|
|
@@ -13,16 +14,16 @@ function toDest(channel) {
|
|
|
13
14
|
function scheduleHelp() {
|
|
14
15
|
const profileNames = listProfiles().map(p => `\`${p.name}\``).join(', ');
|
|
15
16
|
return [
|
|
16
|
-
'
|
|
17
|
-
'
|
|
18
|
-
'
|
|
19
|
-
'
|
|
20
|
-
'
|
|
21
|
-
'
|
|
22
|
-
'
|
|
23
|
-
'
|
|
24
|
-
'
|
|
25
|
-
|
|
17
|
+
t('schedule.help.title'),
|
|
18
|
+
t('schedule.help.addInterval'),
|
|
19
|
+
t('schedule.help.addDaily'),
|
|
20
|
+
t('schedule.help.addWeekly'),
|
|
21
|
+
t('schedule.help.addOnce'),
|
|
22
|
+
t('schedule.help.list'),
|
|
23
|
+
t('schedule.help.pause'),
|
|
24
|
+
t('schedule.help.resume'),
|
|
25
|
+
t('schedule.help.remove'),
|
|
26
|
+
t('schedule.help.availableProfiles', { profileNames }),
|
|
26
27
|
].join('\n');
|
|
27
28
|
}
|
|
28
29
|
const DAY_MAP = { sun: 0, mon: 1, tue: 2, wed: 3, thu: 4, fri: 5, sat: 6 };
|
|
@@ -31,12 +32,12 @@ const fmtTime = (ts) => new Date(ts).toLocaleString('en-US', FMT_OPTS);
|
|
|
31
32
|
async function handleList(parts, channel, adapter, scheduler) {
|
|
32
33
|
const tasks = await scheduler.list();
|
|
33
34
|
if (tasks.length === 0) {
|
|
34
|
-
await adapter.postMessage(toDest(channel), { text: '
|
|
35
|
+
await adapter.postMessage(toDest(channel), { text: t('schedule.list.empty') });
|
|
35
36
|
return;
|
|
36
37
|
}
|
|
37
38
|
const now = Date.now();
|
|
38
|
-
const lines = tasks.map((
|
|
39
|
-
await adapter.postMessage(toDest(channel), { text:
|
|
39
|
+
const lines = tasks.map((task) => formatTaskLine(task, now));
|
|
40
|
+
await adapter.postMessage(toDest(channel), { text: t('schedule.list.header', { count: tasks.length, lines: lines.join('\n') }) });
|
|
40
41
|
}
|
|
41
42
|
function formatTaskLine(t, now) {
|
|
42
43
|
const id = `\`${t.id}\``;
|
|
@@ -75,28 +76,28 @@ async function handleRemove(parts, channel, adapter, scheduler) {
|
|
|
75
76
|
const rawId = parts[2];
|
|
76
77
|
const id = normalizeTaskId(rawId);
|
|
77
78
|
if (!id) {
|
|
78
|
-
await adapter.postMessage(toDest(channel), { text: '
|
|
79
|
+
await adapter.postMessage(toDest(channel), { text: t('schedule.remove.usage') });
|
|
79
80
|
return;
|
|
80
81
|
}
|
|
81
82
|
const removed = await scheduler.remove(id);
|
|
82
83
|
await adapter.postMessage(toDest(channel), {
|
|
83
|
-
text: removed ? `${Icons.ok}
|
|
84
|
+
text: removed ? `${Icons.ok} ${t('schedule.remove.ok', { id })}` : `${Icons.error} ${t('schedule.taskNotFound', { id })}`,
|
|
84
85
|
});
|
|
85
86
|
}
|
|
86
87
|
async function handlePause(parts, channel, adapter, scheduler) {
|
|
87
88
|
const rawId = parts[2];
|
|
88
89
|
const id = normalizeTaskId(rawId);
|
|
89
90
|
if (!id) {
|
|
90
|
-
await adapter.postMessage(toDest(channel), { text: '
|
|
91
|
+
await adapter.postMessage(toDest(channel), { text: t('schedule.pause.usage') });
|
|
91
92
|
return;
|
|
92
93
|
}
|
|
93
94
|
try {
|
|
94
95
|
const task = await scheduler.pause(id);
|
|
95
96
|
if (!task) {
|
|
96
|
-
await adapter.postMessage(toDest(channel), { text: `${Icons.error}
|
|
97
|
+
await adapter.postMessage(toDest(channel), { text: `${Icons.error} ${t('schedule.taskNotFound', { id })}` });
|
|
97
98
|
return;
|
|
98
99
|
}
|
|
99
|
-
await adapter.postMessage(toDest(channel), { text: `${Icons.paused}
|
|
100
|
+
await adapter.postMessage(toDest(channel), { text: `${Icons.paused} ${t('schedule.pause.ok', { id })}` });
|
|
100
101
|
}
|
|
101
102
|
catch (error) {
|
|
102
103
|
await adapter.postMessage(toDest(channel), { text: `${Icons.error} ${error.message}` });
|
|
@@ -106,17 +107,17 @@ async function handleResume(parts, channel, adapter, scheduler) {
|
|
|
106
107
|
const rawId = parts[2];
|
|
107
108
|
const id = normalizeTaskId(rawId);
|
|
108
109
|
if (!id) {
|
|
109
|
-
await adapter.postMessage(toDest(channel), { text: '
|
|
110
|
+
await adapter.postMessage(toDest(channel), { text: t('schedule.resume.usage') });
|
|
110
111
|
return;
|
|
111
112
|
}
|
|
112
113
|
try {
|
|
113
114
|
const task = await scheduler.resume(id);
|
|
114
115
|
if (!task) {
|
|
115
|
-
await adapter.postMessage(toDest(channel), { text: `${Icons.error}
|
|
116
|
+
await adapter.postMessage(toDest(channel), { text: `${Icons.error} ${t('schedule.taskNotFound', { id })}` });
|
|
116
117
|
return;
|
|
117
118
|
}
|
|
118
|
-
const nextAt = task.nextRun ?
|
|
119
|
-
await adapter.postMessage(toDest(channel), { text: `${Icons.resume}
|
|
119
|
+
const nextAt = task.nextRun ? t('schedule.resume.nextRun', { time: fmtTime(task.nextRun) }) : '';
|
|
120
|
+
await adapter.postMessage(toDest(channel), { text: `${Icons.resume} ${t('schedule.resume.ok', { id, nextAt })}` });
|
|
120
121
|
}
|
|
121
122
|
catch (error) {
|
|
122
123
|
await adapter.postMessage(toDest(channel), { text: `${Icons.error} ${error.message}` });
|
|
@@ -131,7 +132,7 @@ function parseProfileArgs(args, usage) {
|
|
|
131
132
|
}
|
|
132
133
|
const profileName = args[1];
|
|
133
134
|
if (!profileName)
|
|
134
|
-
throw new Error(
|
|
135
|
+
throw new Error(t('schedule.profileUsage', { usage }));
|
|
135
136
|
try {
|
|
136
137
|
resolveProfile(profileName);
|
|
137
138
|
}
|
|
@@ -157,17 +158,17 @@ async function handleAddInterval(parts, channel, adapter, scheduler) {
|
|
|
157
158
|
const msg = parsed.rest.join(' ');
|
|
158
159
|
const ms = parseDuration(durationStr);
|
|
159
160
|
if (!ms) {
|
|
160
|
-
await adapter.postMessage(toDest(channel), { text:
|
|
161
|
+
await adapter.postMessage(toDest(channel), { text: t('schedule.invalidDuration', { duration: durationStr }) });
|
|
161
162
|
return;
|
|
162
163
|
}
|
|
163
164
|
if (!msg) {
|
|
164
|
-
await adapter.postMessage(toDest(channel), { text: '
|
|
165
|
+
await adapter.postMessage(toDest(channel), { text: t('schedule.add.intervalUsage') });
|
|
165
166
|
return;
|
|
166
167
|
}
|
|
167
168
|
const resolvedProjectId = channelToProjectId(channel) ?? 'general';
|
|
168
169
|
const task = await scheduler.add('interval', { intervalMs: ms, message: msg, projectId: resolvedProjectId, profile: parsed.profileName });
|
|
169
170
|
const nextAt = task.nextRun ? ` | first run: ${fmtTime(task.nextRun)}` : '';
|
|
170
|
-
await adapter.postMessage(toDest(channel), { text: buildScheduledConfirmation(`${Icons.ok}
|
|
171
|
+
await adapter.postMessage(toDest(channel), { text: buildScheduledConfirmation(`${Icons.ok} ${t('schedule.add.scheduledInterval', { duration: formatDuration(ms), message: msg })}`, task, nextAt) });
|
|
171
172
|
}
|
|
172
173
|
async function handleAddDaily(parts, channel, adapter, scheduler) {
|
|
173
174
|
const time = parts[3];
|
|
@@ -181,17 +182,17 @@ async function handleAddDaily(parts, channel, adapter, scheduler) {
|
|
|
181
182
|
}
|
|
182
183
|
const msg = parsed.rest.join(' ');
|
|
183
184
|
if (!/^\d{2}:\d{2}$/.test(time)) {
|
|
184
|
-
await adapter.postMessage(toDest(channel), { text:
|
|
185
|
+
await adapter.postMessage(toDest(channel), { text: t('schedule.invalidTime', { time, example: '09:00' }) });
|
|
185
186
|
return;
|
|
186
187
|
}
|
|
187
188
|
if (!msg) {
|
|
188
|
-
await adapter.postMessage(toDest(channel), { text: '
|
|
189
|
+
await adapter.postMessage(toDest(channel), { text: t('schedule.add.dailyUsage') });
|
|
189
190
|
return;
|
|
190
191
|
}
|
|
191
192
|
const resolvedProjectId = channelToProjectId(channel) ?? 'general';
|
|
192
193
|
const task = await scheduler.add('daily', { time, message: msg, projectId: resolvedProjectId, profile: parsed.profileName });
|
|
193
194
|
const nextAt = task.nextRun ? ` | first run: ${fmtTime(task.nextRun)}` : '';
|
|
194
|
-
await adapter.postMessage(toDest(channel), { text: buildScheduledConfirmation(`${Icons.ok}
|
|
195
|
+
await adapter.postMessage(toDest(channel), { text: buildScheduledConfirmation(`${Icons.ok} ${t('schedule.add.scheduledDaily', { time, message: msg })}`, task, nextAt) });
|
|
195
196
|
}
|
|
196
197
|
async function handleAddWeekly(parts, channel, adapter, scheduler) {
|
|
197
198
|
const dayStr = (parts[3] || '').toLowerCase();
|
|
@@ -207,22 +208,22 @@ async function handleAddWeekly(parts, channel, adapter, scheduler) {
|
|
|
207
208
|
const msg = parsed.rest.join(' ');
|
|
208
209
|
const dayOfWeek = DAY_MAP[dayStr];
|
|
209
210
|
if (dayOfWeek == null) {
|
|
210
|
-
await adapter.postMessage(toDest(channel), { text:
|
|
211
|
+
await adapter.postMessage(toDest(channel), { text: t('schedule.invalidDay', { day: parts[3] }) });
|
|
211
212
|
return;
|
|
212
213
|
}
|
|
213
214
|
if (!/^\d{2}:\d{2}$/.test(time)) {
|
|
214
|
-
await adapter.postMessage(toDest(channel), { text:
|
|
215
|
+
await adapter.postMessage(toDest(channel), { text: t('schedule.invalidTime', { time, example: '21:00' }) });
|
|
215
216
|
return;
|
|
216
217
|
}
|
|
217
218
|
if (!msg) {
|
|
218
|
-
await adapter.postMessage(toDest(channel), { text: '
|
|
219
|
+
await adapter.postMessage(toDest(channel), { text: t('schedule.add.weeklyUsage') });
|
|
219
220
|
return;
|
|
220
221
|
}
|
|
221
222
|
const dayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
222
223
|
const resolvedProjectId = channelToProjectId(channel) ?? 'general';
|
|
223
224
|
const task = await scheduler.add('weekly', { dayOfWeek, time, message: msg, projectId: resolvedProjectId, profile: parsed.profileName });
|
|
224
225
|
const nextAt = task.nextRun ? ` | first run: ${fmtTime(task.nextRun)}` : '';
|
|
225
|
-
await adapter.postMessage(toDest(channel), { text: buildScheduledConfirmation(`${Icons.ok}
|
|
226
|
+
await adapter.postMessage(toDest(channel), { text: buildScheduledConfirmation(`${Icons.ok} ${t('schedule.add.scheduledWeekly', { day: dayNames[dayOfWeek], time, message: msg })}`, task, nextAt) });
|
|
226
227
|
}
|
|
227
228
|
async function handleAddOnce(parts, channel, adapter, scheduler) {
|
|
228
229
|
const durationStr = parts[3];
|
|
@@ -237,17 +238,17 @@ async function handleAddOnce(parts, channel, adapter, scheduler) {
|
|
|
237
238
|
const msg = parsed.rest.join(' ');
|
|
238
239
|
const ms = parseDuration(durationStr);
|
|
239
240
|
if (!ms) {
|
|
240
|
-
await adapter.postMessage(toDest(channel), { text:
|
|
241
|
+
await adapter.postMessage(toDest(channel), { text: t('schedule.invalidDuration', { duration: durationStr }) });
|
|
241
242
|
return;
|
|
242
243
|
}
|
|
243
244
|
if (!msg) {
|
|
244
|
-
await adapter.postMessage(toDest(channel), { text: '
|
|
245
|
+
await adapter.postMessage(toDest(channel), { text: t('schedule.add.onceUsage') });
|
|
245
246
|
return;
|
|
246
247
|
}
|
|
247
248
|
const resolvedProjectId = channelToProjectId(channel) ?? 'general';
|
|
248
249
|
const task = await scheduler.add('once', { delay: ms, message: msg, projectId: resolvedProjectId, profile: parsed.profileName });
|
|
249
250
|
const runAt = task.runAt ? ` | runs at: ${fmtTime(task.runAt)}` : '';
|
|
250
|
-
await adapter.postMessage(toDest(channel), { text: buildScheduledConfirmation(`${Icons.ok}
|
|
251
|
+
await adapter.postMessage(toDest(channel), { text: buildScheduledConfirmation(`${Icons.ok} ${t('schedule.add.scheduledOnce', { duration: formatDuration(ms), message: msg })}`, task, runAt) });
|
|
251
252
|
}
|
|
252
253
|
const ADD_TYPE_HANDLERS = {
|
|
253
254
|
interval: handleAddInterval,
|
|
@@ -261,7 +262,7 @@ async function handleAdd(parts, channel, adapter, scheduler) {
|
|
|
261
262
|
if (handler)
|
|
262
263
|
return handler(parts, channel, adapter, scheduler);
|
|
263
264
|
if (type) {
|
|
264
|
-
await adapter.postMessage(toDest(channel), { text:
|
|
265
|
+
await adapter.postMessage(toDest(channel), { text: t('schedule.add.unknownType', { type }) });
|
|
265
266
|
return;
|
|
266
267
|
}
|
|
267
268
|
await adapter.postMessage(toDest(channel), { text: scheduleHelp() });
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface ReleaseInfo {
|
|
2
|
+
tagName: string;
|
|
3
|
+
version: string;
|
|
4
|
+
name: string;
|
|
5
|
+
body: string;
|
|
6
|
+
htmlUrl: string;
|
|
7
|
+
publishedAt: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Build GitHub Release web URL for a given version.
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildGitHubReleaseUrl(version: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Fetch release notes from GitHub API for a given version.
|
|
15
|
+
* Returns cached result if available and not expired.
|
|
16
|
+
* Returns null if fetch fails or release doesn't exist.
|
|
17
|
+
*/
|
|
18
|
+
export declare function fetchReleaseNote(version: string): Promise<ReleaseInfo | null>;
|