@cortex-agent/server 2026.6.11 → 2026.6.15
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/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/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/scheduling/jobs/task-dispatch.js +6 -10
- 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/dispatcher.d.ts +11 -2
- package/dist/domain/tasks/dispatcher.js +37 -7
- package/dist/domain/threads/prompt-builder.d.ts +6 -0
- package/dist/domain/threads/prompt-builder.js +19 -2
- 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/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/status-helpers.js +6 -5
- 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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Icons } from '../../../core/icons.js';
|
|
2
|
+
import { t } from '../../../core/i18n.js';
|
|
2
3
|
import { scanAllTasks, completedHashSet, isActionable } from '../../../domain/tasks/parser.js';
|
|
3
4
|
import { PROJECTS_DIR } from '../../../core/utils.js';
|
|
4
5
|
import * as path from 'path';
|
|
@@ -13,8 +14,8 @@ function formatTaskList(tasks, filter, project) {
|
|
|
13
14
|
default: return true;
|
|
14
15
|
}
|
|
15
16
|
});
|
|
16
|
-
const filterLabel = filter === 'all' ? '' :
|
|
17
|
-
const lines = [
|
|
17
|
+
const filterLabel = filter === 'all' ? '' : t('cmd.task.filterLabel', { filter });
|
|
18
|
+
const lines = [`${t('cmd.task.header', { project, shown: filtered.length, total: tasks.length, filterLabel })}\n`];
|
|
18
19
|
for (const task of filtered) {
|
|
19
20
|
const status = task.status === 'done' ? Icons.ok : (task.blocked_by ? Icons.blocked : (task.claimed_by ? Icons.refresh : (task.paused ? Icons.paused : Icons.pending)));
|
|
20
21
|
const id = task.id ? `\`${task.id}\`` : '—';
|
|
@@ -23,27 +24,27 @@ function formatTaskList(tasks, filter, project) {
|
|
|
23
24
|
tags.push(task.priority);
|
|
24
25
|
if (task.gpu)
|
|
25
26
|
tags.push(`gpu:${task.gpu}`);
|
|
26
|
-
const statusLabel = task.status === 'done' ? '
|
|
27
|
-
: task.blocked_by ?
|
|
28
|
-
: task.claimed_by ?
|
|
29
|
-
: task.paused ? '
|
|
30
|
-
: (task.approval_needed && !task.approved_at) ? '
|
|
31
|
-
: isActionable(task, completed) ? '
|
|
32
|
-
: '
|
|
27
|
+
const statusLabel = task.status === 'done' ? t('cmd.task.statusCompleted')
|
|
28
|
+
: task.blocked_by ? t('cmd.task.statusBlocked', { by: task.blocked_by })
|
|
29
|
+
: task.claimed_by ? t('cmd.task.statusInProgress', { by: task.claimed_by })
|
|
30
|
+
: task.paused ? t('cmd.task.statusPaused')
|
|
31
|
+
: (task.approval_needed && !task.approved_at) ? t('cmd.task.statusApprovalNeeded')
|
|
32
|
+
: isActionable(task, completed) ? t('cmd.task.statusActionable')
|
|
33
|
+
: t('cmd.task.statusOpen');
|
|
33
34
|
lines.push(`${status} ${id} *${task.text}*`);
|
|
34
|
-
lines.push(
|
|
35
|
+
lines.push(t('cmd.task.statusLine', { status: statusLabel, priority: task.priority }));
|
|
35
36
|
if (tags.length)
|
|
36
|
-
lines.push(
|
|
37
|
+
lines.push(t('cmd.task.tagsLine', { tags: tags.join(', ') }));
|
|
37
38
|
if (task.why)
|
|
38
|
-
lines.push(
|
|
39
|
+
lines.push(t('cmd.task.whyLine', { why: task.why }));
|
|
39
40
|
if (task.done_when)
|
|
40
|
-
lines.push(
|
|
41
|
+
lines.push(t('cmd.task.doneWhenLine', { doneWhen: task.done_when }));
|
|
41
42
|
if (task.depends_on.length)
|
|
42
|
-
lines.push(
|
|
43
|
+
lines.push(t('cmd.task.dependsLine', { depends: task.depends_on.join(', ') }));
|
|
43
44
|
lines.push('');
|
|
44
45
|
}
|
|
45
46
|
if (filtered.length === 0) {
|
|
46
|
-
lines.push(
|
|
47
|
+
lines.push(t('cmd.task.noneFound', { filter }));
|
|
47
48
|
}
|
|
48
49
|
return lines.join('\n');
|
|
49
50
|
}
|
|
@@ -68,10 +69,10 @@ function textToSectionBlocks(text) {
|
|
|
68
69
|
}
|
|
69
70
|
function buildFilterButtons(project) {
|
|
70
71
|
const TASK_FILTERS = [
|
|
71
|
-
{ label: '
|
|
72
|
-
{ label: '
|
|
73
|
-
{ label: '
|
|
74
|
-
{ label: '
|
|
72
|
+
{ label: t('cmd.task.filterAll'), value: 'all' },
|
|
73
|
+
{ label: t('cmd.task.filterActionable'), value: 'actionable' },
|
|
74
|
+
{ label: t('cmd.task.filterInProgress'), value: 'in-progress' },
|
|
75
|
+
{ label: t('cmd.task.filterBlocked'), value: 'blocked' },
|
|
75
76
|
];
|
|
76
77
|
return TASK_FILTERS.map(f => ({
|
|
77
78
|
type: 'button',
|
|
@@ -111,18 +112,18 @@ export function createTasksHandler(router) {
|
|
|
111
112
|
const dest = { type: 'interactive-reply', conduit: channel, sessionId: '' };
|
|
112
113
|
const args = trimmedMessage.split(/\s+/).slice(1);
|
|
113
114
|
if (args.length === 0) {
|
|
114
|
-
await adapter.postMessage(dest, { text: `${Icons.error}
|
|
115
|
+
await adapter.postMessage(dest, { text: `${Icons.error} ${t('cmd.task.usage')}` });
|
|
115
116
|
return;
|
|
116
117
|
}
|
|
117
118
|
const project = args[0];
|
|
118
119
|
const projectDir = path.join(PROJECTS_DIR, project);
|
|
119
120
|
if (!existsSync(projectDir)) {
|
|
120
|
-
await adapter.postMessage(dest, { text: `${Icons.error}
|
|
121
|
+
await adapter.postMessage(dest, { text: `${Icons.error} ${t('cmd.task.projectNotFound', { project })}` });
|
|
121
122
|
return;
|
|
122
123
|
}
|
|
123
124
|
const tasks = scanAllTasks(project);
|
|
124
125
|
if (tasks.length === 0) {
|
|
125
|
-
await adapter.postMessage(dest, { text:
|
|
126
|
+
await adapter.postMessage(dest, { text: t('cmd.task.noTasks', { project }) });
|
|
126
127
|
return;
|
|
127
128
|
}
|
|
128
129
|
const text = formatTaskList(tasks, 'all', project);
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// >>> If I am updated, update my header comment and the parent folder's CORTEX.md <<<
|
|
5
5
|
import { createLogger } from '../../../core/log.js';
|
|
6
6
|
import { Icons } from '../../../core/icons.js';
|
|
7
|
+
import { t } from '../../../core/i18n.js';
|
|
7
8
|
import { threadStore } from '../../../store/thread-repo.js';
|
|
8
9
|
import { listTemplates, listAgents } from '../../../domain/threads/index.js';
|
|
9
10
|
import { runningExecutions } from '../../../core/running-executions.js';
|
|
@@ -14,19 +15,19 @@ async function handleThreadStatus(channel, adapter) {
|
|
|
14
15
|
const dest = { type: 'interactive-reply', conduit: channel, sessionId: '' };
|
|
15
16
|
const active = threadStore.findActive(channel);
|
|
16
17
|
if (!active) {
|
|
17
|
-
await adapter.postMessage(dest, { text: '
|
|
18
|
+
await adapter.postMessage(dest, { text: t('cmd.thread.noActive') });
|
|
18
19
|
return;
|
|
19
20
|
}
|
|
20
21
|
const agents = Object.keys(active.agents).join(', ');
|
|
21
|
-
const modeLabel = active.templateName ? active.templateName : '
|
|
22
|
+
const modeLabel = active.templateName ? active.templateName : t('cmd.thread.adHoc');
|
|
22
23
|
const lines = [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
t('cmd.thread.activeHeader', { id: active.id, mode: modeLabel }),
|
|
25
|
+
t('cmd.thread.statusLine', { status: active.status, agent: active.activeAgent }),
|
|
26
|
+
t('cmd.thread.stepsLine', { steps: active.steps.length, cost: active.totalCostUsd.toFixed(4) }),
|
|
27
|
+
t('cmd.thread.agentsLine', { agents }),
|
|
27
28
|
];
|
|
28
29
|
if (active.status === 'aborted' && active.abortReason) {
|
|
29
|
-
lines.push(
|
|
30
|
+
lines.push(t('cmd.thread.abortLine', { reason: active.abortReason }));
|
|
30
31
|
}
|
|
31
32
|
await adapter.postMessage(dest, { text: lines.join('\n') });
|
|
32
33
|
}
|
|
@@ -34,13 +35,13 @@ async function handleThreadTemplates(channel, adapter) {
|
|
|
34
35
|
const dest = { type: 'interactive-reply', conduit: channel, sessionId: '' };
|
|
35
36
|
const templates = listTemplates();
|
|
36
37
|
if (templates.length === 0) {
|
|
37
|
-
await adapter.postMessage(dest, { text: '
|
|
38
|
+
await adapter.postMessage(dest, { text: t('cmd.thread.noTemplates') });
|
|
38
39
|
return;
|
|
39
40
|
}
|
|
40
|
-
const lines = ['
|
|
41
|
-
for (const
|
|
42
|
-
const agentList =
|
|
43
|
-
lines.push(`•
|
|
41
|
+
const lines = [t('cmd.thread.templatesHeader')];
|
|
42
|
+
for (const tpl of templates) {
|
|
43
|
+
const agentList = tpl.agents.map(a => typeof a === 'string' ? a : a.ref).join(', ');
|
|
44
|
+
lines.push(`• ${t('cmd.thread.templateLine', { name: tpl.name, description: tpl.description, agents: agentList })}`);
|
|
44
45
|
}
|
|
45
46
|
await adapter.postMessage(dest, { text: lines.join('\n') });
|
|
46
47
|
}
|
|
@@ -49,22 +50,22 @@ async function handleThreadAgents(channel, adapter) {
|
|
|
49
50
|
const agentDefs = listAgents();
|
|
50
51
|
const lines = [];
|
|
51
52
|
if (agentDefs.length > 0) {
|
|
52
|
-
lines.push('
|
|
53
|
+
lines.push(t('cmd.thread.agentsTitle'));
|
|
53
54
|
for (const a of agentDefs) {
|
|
54
|
-
lines.push(`•
|
|
55
|
+
lines.push(`• ${t('cmd.thread.agentLine', { name: a.name, profile: a.profile, description: a.description || '' })}`);
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
else {
|
|
58
|
-
lines.push('
|
|
59
|
+
lines.push(t('cmd.thread.noAgents'));
|
|
59
60
|
}
|
|
60
61
|
const active = threadStore.findActive(channel);
|
|
61
62
|
if (active) {
|
|
62
63
|
lines.push('');
|
|
63
|
-
lines.push(
|
|
64
|
+
lines.push(t('cmd.thread.activeThreadHeader', { id: active.id }));
|
|
64
65
|
for (const [slotId, slot] of Object.entries(active.agents)) {
|
|
65
66
|
const isActiveAgent = slotId === active.activeAgent ? ` ${Icons.arrowLeft}` : '';
|
|
66
|
-
const sessionStr = slot.sessionName || '
|
|
67
|
-
lines.push(` •
|
|
67
|
+
const sessionStr = slot.sessionName || t('cmd.thread.noSession');
|
|
68
|
+
lines.push(` • ${t('cmd.thread.slotLine', { slotId, profile: slot.profile, status: slot.status, session: sessionStr })}${isActiveAgent}`);
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
await adapter.postMessage(dest, { text: lines.join('\n') });
|
|
@@ -83,23 +84,23 @@ async function handleThreadCancelAlias(channel, adapter) {
|
|
|
83
84
|
if (execs.length > 0) {
|
|
84
85
|
log.info('Cancel requested for channel:', channel);
|
|
85
86
|
conduitQueues.delete(channel);
|
|
86
|
-
await adapter.postMessage(dest, { text: `${Icons.stopped}
|
|
87
|
+
await adapter.postMessage(dest, { text: `${Icons.stopped} ${t('cmd.thread.cancelledSessionPreserved')}` });
|
|
87
88
|
}
|
|
88
89
|
else {
|
|
89
|
-
await adapter.postMessage(dest, { text: '
|
|
90
|
+
await adapter.postMessage(dest, { text: t('cmd.thread.nothingRunning') });
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
async function handleThreadList(channel, adapter) {
|
|
93
94
|
const dest = { type: 'interactive-reply', conduit: channel, sessionId: '' };
|
|
94
95
|
const threads = threadStore.findByChannel(channel).slice(0, 10);
|
|
95
96
|
if (threads.length === 0) {
|
|
96
|
-
await adapter.postMessage(dest, { text: '
|
|
97
|
+
await adapter.postMessage(dest, { text: t('cmd.thread.noThreadsChannel') });
|
|
97
98
|
return;
|
|
98
99
|
}
|
|
99
|
-
const lines = ['
|
|
100
|
-
for (const
|
|
101
|
-
const modeLabel =
|
|
102
|
-
lines.push(`•
|
|
100
|
+
const lines = [t('cmd.thread.recentHeader')];
|
|
101
|
+
for (const thr of threads) {
|
|
102
|
+
const modeLabel = thr.templateName || t('cmd.thread.adHoc');
|
|
103
|
+
lines.push(`• ${t('cmd.thread.recentLine', { id: thr.id, mode: modeLabel, status: thr.status, steps: thr.steps.length, cost: thr.totalCostUsd.toFixed(4) })}`);
|
|
103
104
|
}
|
|
104
105
|
await adapter.postMessage(dest, { text: lines.join('\n') });
|
|
105
106
|
}
|
|
@@ -107,16 +108,16 @@ async function handleThreadListRunning(channel, adapter) {
|
|
|
107
108
|
const dest = { type: 'interactive-reply', conduit: channel, sessionId: '' };
|
|
108
109
|
const executions = runningExecutions.getAll().filter(e => e.threadId);
|
|
109
110
|
if (executions.length === 0) {
|
|
110
|
-
await adapter.postMessage(dest, { text: '
|
|
111
|
+
await adapter.postMessage(dest, { text: t('cmd.thread.noRunning') });
|
|
111
112
|
return;
|
|
112
113
|
}
|
|
113
|
-
const lines = ['
|
|
114
|
+
const lines = [t('cmd.thread.runningHeader')];
|
|
114
115
|
for (const exec of executions) {
|
|
115
116
|
const thread = exec.threadId ? threadStore.get(exec.threadId) : null;
|
|
116
|
-
const modeLabel = thread?.templateName || '
|
|
117
|
+
const modeLabel = thread?.templateName || t('cmd.thread.adHoc');
|
|
117
118
|
const stepCount = thread?.steps.length ?? 0;
|
|
118
119
|
const cost = thread?.totalCostUsd ?? 0;
|
|
119
|
-
lines.push(`•
|
|
120
|
+
lines.push(`• ${t('cmd.thread.runningLine', { id: exec.threadId ?? '', channel: exec.channel || '?', mode: modeLabel, steps: stepCount, cost: cost.toFixed(4) })}`);
|
|
120
121
|
}
|
|
121
122
|
await adapter.postMessage(dest, { text: lines.join('\n') });
|
|
122
123
|
}
|
|
@@ -124,16 +125,16 @@ async function sendThreadUsage(channel, adapter) {
|
|
|
124
125
|
const dest = { type: 'interactive-reply', conduit: channel, sessionId: '' };
|
|
125
126
|
await adapter.postMessage(dest, {
|
|
126
127
|
text: [
|
|
127
|
-
'
|
|
128
|
-
'
|
|
129
|
-
'
|
|
130
|
-
'
|
|
131
|
-
'
|
|
132
|
-
'
|
|
133
|
-
'
|
|
134
|
-
'
|
|
135
|
-
'
|
|
136
|
-
'
|
|
128
|
+
t('cmd.thread.usageHeader'),
|
|
129
|
+
t('cmd.thread.usageStatus'),
|
|
130
|
+
t('cmd.thread.usageAgents'),
|
|
131
|
+
t('cmd.thread.usageTemplates'),
|
|
132
|
+
t('cmd.thread.usageAdHoc'),
|
|
133
|
+
t('cmd.thread.usageTemplate'),
|
|
134
|
+
t('cmd.thread.usageAdd'),
|
|
135
|
+
t('cmd.thread.usageCancel'),
|
|
136
|
+
t('cmd.thread.usageList'),
|
|
137
|
+
t('cmd.thread.usageListRunning'),
|
|
137
138
|
].join('\n'),
|
|
138
139
|
});
|
|
139
140
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// >>> If I am updated, update my header comment and the parent folder's CORTEX.md <<<
|
|
5
5
|
import { createLogger } from '../core/log.js';
|
|
6
6
|
import { Icons } from '../core/icons.js';
|
|
7
|
+
import { t } from '../core/i18n.js';
|
|
7
8
|
import * as executionRegistry from '../domain/executions/registry.js';
|
|
8
9
|
import { runAgent } from '../domain/agents/index.js';
|
|
9
10
|
import { shouldAutoRunCompound, combineFinalOutputs } from '../domain/threads/auto-thread.js';
|
|
@@ -19,8 +20,8 @@ export function resolveExecutionProject({ execution, fallbackMessage }) {
|
|
|
19
20
|
export function buildExecutionStatusReport() {
|
|
20
21
|
const running = executionRegistry.getRunningExecutions();
|
|
21
22
|
if (running.length === 0)
|
|
22
|
-
return '
|
|
23
|
-
const lines = [
|
|
23
|
+
return t('status.noRunningExecutions');
|
|
24
|
+
const lines = [t('status.runningExecutions', { count: running.length })];
|
|
24
25
|
for (const record of running) {
|
|
25
26
|
const location = record.kind === 'dispatch'
|
|
26
27
|
? `${record.dispatch?.machine || '?'}:${record.dispatch?.taskId || record.id}`
|
|
@@ -113,7 +114,7 @@ function buildActionElements({ channel, sessionName, isDm, includeCancel, thread
|
|
|
113
114
|
if (includeCancel) {
|
|
114
115
|
elements.push({
|
|
115
116
|
type: 'button',
|
|
116
|
-
text: '
|
|
117
|
+
text: t('btn.cancel'),
|
|
117
118
|
actionId: 'status_cancel',
|
|
118
119
|
value: JSON.stringify({ channel, threadId: threadId ?? null, executionId: executionId ?? null }),
|
|
119
120
|
style: 'danger',
|
|
@@ -122,7 +123,7 @@ function buildActionElements({ channel, sessionName, isDm, includeCancel, thread
|
|
|
122
123
|
if (sessionName) {
|
|
123
124
|
elements.push({
|
|
124
125
|
type: 'button',
|
|
125
|
-
text: '
|
|
126
|
+
text: t('btn.resume'),
|
|
126
127
|
actionId: 'status_resume',
|
|
127
128
|
value: sessionName,
|
|
128
129
|
});
|
|
@@ -130,7 +131,7 @@ function buildActionElements({ channel, sessionName, isDm, includeCancel, thread
|
|
|
130
131
|
if (isDm) {
|
|
131
132
|
elements.push({
|
|
132
133
|
type: 'button',
|
|
133
|
-
text: '
|
|
134
|
+
text: t('btn.new'),
|
|
134
135
|
actionId: 'status_new',
|
|
135
136
|
value: channel,
|
|
136
137
|
});
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// pos: Platform-independent interactive component builder
|
|
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
|
// --- AskUserQuestion builders ---
|
|
7
8
|
export function buildQuestionGroupBlocks(group) {
|
|
8
9
|
const blocks = [];
|
|
@@ -26,7 +27,7 @@ export function buildQuestionGroupBlocks(group) {
|
|
|
26
27
|
type: 'actions',
|
|
27
28
|
elements: [{
|
|
28
29
|
type: 'button',
|
|
29
|
-
text:
|
|
30
|
+
text: t('modal.answer', { answered: group.answers.size, total: group.questions.length }),
|
|
30
31
|
actionId: 'ask_user_question_open_modal',
|
|
31
32
|
value: group.groupId,
|
|
32
33
|
style: 'primary',
|
|
@@ -51,9 +52,9 @@ export function buildQuestionModalDefinition(group) {
|
|
|
51
52
|
fields.push({
|
|
52
53
|
type: q.multiSelect ? 'multi_select' : 'select',
|
|
53
54
|
blockId: `q_${qIdx}`,
|
|
54
|
-
label: q.multiSelect ? '
|
|
55
|
+
label: q.multiSelect ? t('modal.selectOneOrMore') : t('modal.selectOne'),
|
|
55
56
|
actionId: 'selection',
|
|
56
|
-
placeholder: q.multiSelect ? '
|
|
57
|
+
placeholder: q.multiSelect ? t('modal.selectOneOrMore') : t('modal.selectOne'),
|
|
57
58
|
options: q.options.map((option, optIdx) => ({
|
|
58
59
|
label: option.label,
|
|
59
60
|
value: String(optIdx),
|
|
@@ -63,9 +64,9 @@ export function buildQuestionModalDefinition(group) {
|
|
|
63
64
|
fields.push({
|
|
64
65
|
type: 'text_input',
|
|
65
66
|
blockId: `q_${qIdx}_other`,
|
|
66
|
-
label: '
|
|
67
|
+
label: t('modal.typeAnswerLabel'),
|
|
67
68
|
actionId: 'other_text',
|
|
68
|
-
placeholder: '
|
|
69
|
+
placeholder: t('modal.customAnswerPlaceholder'),
|
|
69
70
|
optional: true,
|
|
70
71
|
});
|
|
71
72
|
}
|
|
@@ -74,18 +75,18 @@ export function buildQuestionModalDefinition(group) {
|
|
|
74
75
|
fields.push({
|
|
75
76
|
type: 'text_input',
|
|
76
77
|
blockId: `q_${qIdx}_other`,
|
|
77
|
-
label: '
|
|
78
|
+
label: t('modal.yourAnswerLabel'),
|
|
78
79
|
actionId: 'other_text',
|
|
79
|
-
placeholder: '
|
|
80
|
+
placeholder: t('modal.yourAnswerPlaceholder'),
|
|
80
81
|
optional: false,
|
|
81
82
|
});
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
return {
|
|
85
86
|
callbackId: 'ask_user_question_modal_submit',
|
|
86
|
-
title: '
|
|
87
|
-
submitLabel: '
|
|
88
|
-
closeLabel: '
|
|
87
|
+
title: t('modal.questionsTitle'),
|
|
88
|
+
submitLabel: t('modal.submit'),
|
|
89
|
+
closeLabel: t('modal.cancel'),
|
|
89
90
|
privateMetadata: JSON.stringify({ groupId: group.groupId }),
|
|
90
91
|
fields,
|
|
91
92
|
};
|
|
@@ -94,28 +95,28 @@ export function buildQuestionModalDefinition(group) {
|
|
|
94
95
|
export function buildPlanApprovalContent(requestId) {
|
|
95
96
|
return {
|
|
96
97
|
richBlocks: [
|
|
97
|
-
{ type: 'section', text: `${Icons.memo}
|
|
98
|
+
{ type: 'section', text: `${Icons.memo} ${t('modal.planReady')}` },
|
|
98
99
|
],
|
|
99
100
|
actions: [
|
|
100
|
-
{ type: 'button', text: '
|
|
101
|
-
{ type: 'button', text: '
|
|
101
|
+
{ type: 'button', text: t('modal.approve'), actionId: 'hook_plan_approve', value: requestId, style: 'primary' },
|
|
102
|
+
{ type: 'button', text: t('modal.provideFeedback'), actionId: 'hook_plan_feedback', value: requestId },
|
|
102
103
|
],
|
|
103
104
|
};
|
|
104
105
|
}
|
|
105
106
|
export function buildPlanFeedbackModal(requestId) {
|
|
106
107
|
return {
|
|
107
108
|
callbackId: 'hook_plan_feedback_submit',
|
|
108
|
-
title: '
|
|
109
|
-
submitLabel: '
|
|
110
|
-
closeLabel: '
|
|
109
|
+
title: t('modal.planFeedbackTitle'),
|
|
110
|
+
submitLabel: t('modal.submit'),
|
|
111
|
+
closeLabel: t('modal.cancel'),
|
|
111
112
|
privateMetadata: JSON.stringify({ requestId }),
|
|
112
113
|
fields: [{
|
|
113
114
|
type: 'text_input',
|
|
114
115
|
blockId: 'feedback',
|
|
115
|
-
label: '
|
|
116
|
+
label: t('modal.feedbackLabel'),
|
|
116
117
|
actionId: 'text',
|
|
117
118
|
multiline: true,
|
|
118
|
-
placeholder: '
|
|
119
|
+
placeholder: t('modal.feedbackPlaceholder'),
|
|
119
120
|
}],
|
|
120
121
|
};
|
|
121
122
|
}
|
|
@@ -20,3 +20,10 @@ export interface MigrationOptions {
|
|
|
20
20
|
storeDir?: string;
|
|
21
21
|
}
|
|
22
22
|
export declare function runMigrations(opts?: MigrationOptions): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Migrate config.yaml from CORTEX_HOME/config/ (wrong location before 2026.6.11)
|
|
25
|
+
* to ~/.aistatus/config.yaml (correct location read by aistatus).
|
|
26
|
+
* Idempotent: if target already exists and is valid YAML, source is deleted without copying.
|
|
27
|
+
* If source is malformed YAML, it's deleted to avoid interfering with aistatus.
|
|
28
|
+
*/
|
|
29
|
+
export declare function migrateAistatusConfigLocation(dataDir: string): Promise<void>;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
// >>> If I am updated, update my header comment and the parent folder's CORTEX.md <<<
|
|
7
7
|
import * as path from 'node:path';
|
|
8
8
|
import * as fs from 'node:fs/promises';
|
|
9
|
+
import * as os from 'node:os';
|
|
9
10
|
import { CORTEX_VERSION } from '../core/version.js';
|
|
10
11
|
import { DATA_DIR, DEFAULTS_DIR } from '../core/paths.js';
|
|
11
12
|
import { atomicWrite } from '../core/atomic-write.js';
|
|
@@ -298,3 +299,90 @@ export async function runMigrations(opts = {}) {
|
|
|
298
299
|
}
|
|
299
300
|
await saveVersionsTo(versionsFile, versions);
|
|
300
301
|
}
|
|
302
|
+
// ── File location migrations ───────────────────────────────────
|
|
303
|
+
/**
|
|
304
|
+
* Migrate config.yaml from CORTEX_HOME/config/ (wrong location before 2026.6.11)
|
|
305
|
+
* to ~/.aistatus/config.yaml (correct location read by aistatus).
|
|
306
|
+
* Idempotent: if target already exists and is valid YAML, source is deleted without copying.
|
|
307
|
+
* If source is malformed YAML, it's deleted to avoid interfering with aistatus.
|
|
308
|
+
*/
|
|
309
|
+
export async function migrateAistatusConfigLocation(dataDir) {
|
|
310
|
+
const srcPath = path.join(dataDir, 'config', 'config.yaml');
|
|
311
|
+
const dstPath = path.join(os.homedir(), '.aistatus', 'config.yaml');
|
|
312
|
+
// Check if source exists
|
|
313
|
+
let srcExists = false;
|
|
314
|
+
try {
|
|
315
|
+
await fs.access(srcPath);
|
|
316
|
+
srcExists = true;
|
|
317
|
+
}
|
|
318
|
+
catch {
|
|
319
|
+
// Source does not exist — nothing to migrate
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
// Check if target already exists
|
|
323
|
+
let dstExists = false;
|
|
324
|
+
let dstValid = false;
|
|
325
|
+
try {
|
|
326
|
+
await fs.access(dstPath);
|
|
327
|
+
dstExists = true;
|
|
328
|
+
// Validate target is readable YAML (not corrupted)
|
|
329
|
+
const raw = await fs.readFile(dstPath, 'utf8');
|
|
330
|
+
// Simple YAML validation: must be parseable as key: value pairs
|
|
331
|
+
if (raw.trim().length === 0 || /^[a-zA-Z_][\w]*:/.test(raw)) {
|
|
332
|
+
dstValid = true;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
catch {
|
|
336
|
+
// Target does not exist or is not readable
|
|
337
|
+
}
|
|
338
|
+
// If target exists and is valid, source is redundant — just remove it
|
|
339
|
+
if (dstExists && dstValid) {
|
|
340
|
+
try {
|
|
341
|
+
await fs.unlink(srcPath);
|
|
342
|
+
log.info(`Migrated aistatus config: removed redundant ${srcPath} (target ${dstPath} already exists)`);
|
|
343
|
+
}
|
|
344
|
+
catch {
|
|
345
|
+
// Best effort — if we can't delete, log warning but don't fail
|
|
346
|
+
log.warn(`Could not remove old config file: ${srcPath}`);
|
|
347
|
+
}
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
// Read source, validate, and copy to target
|
|
351
|
+
let srcData;
|
|
352
|
+
try {
|
|
353
|
+
srcData = await fs.readFile(srcPath, 'utf8');
|
|
354
|
+
}
|
|
355
|
+
catch (err) {
|
|
356
|
+
log.warn(`Could not read old config file: ${srcPath}; skipping migration`);
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
// Validate source is valid YAML before copying
|
|
360
|
+
if (srcData.trim().length === 0 || !/^[a-zA-Z_][\w]*:/.test(srcData)) {
|
|
361
|
+
// Source is empty or doesn't look like YAML — delete it to avoid pollution
|
|
362
|
+
try {
|
|
363
|
+
await fs.unlink(srcPath);
|
|
364
|
+
log.info(`Removed malformed old config file: ${srcPath}`);
|
|
365
|
+
}
|
|
366
|
+
catch {
|
|
367
|
+
log.warn(`Could not remove malformed old config file: ${srcPath}`);
|
|
368
|
+
}
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
// Copy source to target
|
|
372
|
+
try {
|
|
373
|
+
const dstDir = path.dirname(dstPath);
|
|
374
|
+
await fs.mkdir(dstDir, { recursive: true });
|
|
375
|
+
await atomicWrite(dstPath, srcData);
|
|
376
|
+
log.info(`Migrated aistatus config from ${srcPath} to ${dstPath}`);
|
|
377
|
+
// Clean up source after successful copy
|
|
378
|
+
try {
|
|
379
|
+
await fs.unlink(srcPath);
|
|
380
|
+
}
|
|
381
|
+
catch {
|
|
382
|
+
log.warn(`Could not remove old config file after migration: ${srcPath}`);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
catch (err) {
|
|
386
|
+
log.error(`Failed to migrate aistatus config to ${dstPath}: ${err.message}`);
|
|
387
|
+
}
|
|
388
|
+
}
|
package/package.json
CHANGED