@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.
Files changed (105) hide show
  1. package/defaults/config/thread-templates.json +2 -2
  2. package/defaults/hooks/task-status-check.mjs +9 -7
  3. package/defaults/plugins/cortex-stage-gate/skills/task/SKILL.md +103 -16
  4. package/defaults/plugins/cortex-system/skills/orient/SKILL.md +6 -6
  5. package/defaults/plugins/cortex-system/skills/thread/SKILL.md +29 -35
  6. package/defaults/prompts/directives/manager.md +21 -11
  7. package/dist/agent-adapter/claude/spawn-args.d.ts +5 -0
  8. package/dist/agent-adapter/claude/spawn-args.js +6 -0
  9. package/dist/agent-adapter/types.d.ts +4 -0
  10. package/dist/core/gateway-generator.js +24 -3
  11. package/dist/core/i18n.d.ts +19 -0
  12. package/dist/core/i18n.js +46 -0
  13. package/dist/core/locales/en.d.ts +438 -0
  14. package/dist/core/locales/en.js +24 -0
  15. package/dist/core/locales/slices/commands.d.ts +214 -0
  16. package/dist/core/locales/slices/commands.js +462 -0
  17. package/dist/core/locales/slices/init.d.ts +121 -0
  18. package/dist/core/locales/slices/init.js +380 -0
  19. package/dist/core/locales/slices/interactions.d.ts +47 -0
  20. package/dist/core/locales/slices/interactions.js +102 -0
  21. package/dist/core/locales/slices/lang.d.ts +8 -0
  22. package/dist/core/locales/slices/lang.js +18 -0
  23. package/dist/core/locales/slices/scheduling.d.ts +36 -0
  24. package/dist/core/locales/slices/scheduling.js +74 -0
  25. package/dist/core/locales/slices/startup.d.ts +6 -0
  26. package/dist/core/locales/slices/startup.js +14 -0
  27. package/dist/core/locales/slices/status.d.ts +20 -0
  28. package/dist/core/locales/slices/status.js +48 -0
  29. package/dist/core/locales/zh.d.ts +5 -0
  30. package/dist/core/locales/zh.js +23 -0
  31. package/dist/core/singleton-lock.d.ts +23 -0
  32. package/dist/core/singleton-lock.js +53 -0
  33. package/dist/core/status-format.js +2 -1
  34. package/dist/core/task-parser.d.ts +6 -0
  35. package/dist/core/task-parser.js +10 -0
  36. package/dist/core/types/thread-types.d.ts +29 -0
  37. package/dist/core/utils.d.ts +9 -1
  38. package/dist/core/utils.js +9 -1
  39. package/dist/domain/agents/config.d.ts +2 -1
  40. package/dist/domain/agents/config.js +25 -6
  41. package/dist/domain/agents/facade.d.ts +4 -0
  42. package/dist/domain/agents/facade.js +3 -1
  43. package/dist/domain/mcp/core-server.js +15 -9
  44. package/dist/domain/mcp/tools/task-monitor.d.ts +2 -0
  45. package/dist/domain/mcp/tools/task-monitor.js +99 -0
  46. package/dist/domain/mcp/tools/thread-ops.js +50 -85
  47. package/dist/domain/scheduling/jobs/task-dispatch.js +18 -16
  48. package/dist/domain/scheduling/schedule-command.js +38 -37
  49. package/dist/domain/system/github-release.d.ts +18 -0
  50. package/dist/domain/system/github-release.js +106 -0
  51. package/dist/domain/system/preferences.d.ts +12 -0
  52. package/dist/domain/system/preferences.js +36 -0
  53. package/dist/domain/tasks/dispatch-utils.d.ts +5 -0
  54. package/dist/domain/tasks/dispatch-utils.js +9 -1
  55. package/dist/domain/tasks/dispatcher.d.ts +11 -2
  56. package/dist/domain/tasks/dispatcher.js +41 -11
  57. package/dist/domain/tasks/system/task-cli.d.ts +1 -0
  58. package/dist/domain/tasks/system/task-cli.js +82 -6
  59. package/dist/domain/tasks/system/task-mutations.d.ts +6 -1
  60. package/dist/domain/tasks/system/task-mutations.js +10 -1
  61. package/dist/domain/threads/hook-runner.js +1 -0
  62. package/dist/domain/threads/prompt-builder.d.ts +6 -0
  63. package/dist/domain/threads/prompt-builder.js +34 -11
  64. package/dist/domain/threads/runner.d.ts +5 -0
  65. package/dist/domain/threads/runner.js +44 -11
  66. package/dist/domain/threads/state-machine.d.ts +9 -12
  67. package/dist/domain/threads/state-machine.js +27 -50
  68. package/dist/entry/app.js +36 -3
  69. package/dist/entry/daemon.js +12 -30
  70. package/dist/entry/init.d.ts +4 -3
  71. package/dist/entry/init.js +151 -208
  72. package/dist/entry/startup-notify.js +6 -3
  73. package/dist/hooks/task-status-check.mjs +9 -7
  74. package/dist/orchestration/interactions/interaction-handlers.js +12 -11
  75. package/dist/orchestration/interactions/update-prompt-slack.js +11 -10
  76. package/dist/orchestration/interactions/update-prompt.js +66 -11
  77. package/dist/orchestration/lifecycle.js +13 -12
  78. package/dist/orchestration/routing/commands/cancel.js +10 -9
  79. package/dist/orchestration/routing/commands/channel.js +27 -26
  80. package/dist/orchestration/routing/commands/cost.js +10 -2
  81. package/dist/orchestration/routing/commands/device.js +11 -9
  82. package/dist/orchestration/routing/commands/dispatch.js +10 -10
  83. package/dist/orchestration/routing/commands/index.js +6 -2
  84. package/dist/orchestration/routing/commands/lang.d.ts +3 -0
  85. package/dist/orchestration/routing/commands/lang.js +31 -0
  86. package/dist/orchestration/routing/commands/mode.js +28 -27
  87. package/dist/orchestration/routing/commands/nvtop.js +13 -12
  88. package/dist/orchestration/routing/commands/orient.js +2 -1
  89. package/dist/orchestration/routing/commands/schedule.js +23 -22
  90. package/dist/orchestration/routing/commands/sendfile.js +8 -7
  91. package/dist/orchestration/routing/commands/session.js +11 -10
  92. package/dist/orchestration/routing/commands/status.js +78 -71
  93. package/dist/orchestration/routing/commands/tail.js +6 -5
  94. package/dist/orchestration/routing/commands/task.js +23 -22
  95. package/dist/orchestration/routing/commands/thread-handlers.js +40 -39
  96. package/dist/orchestration/routing/webhook.js +38 -1
  97. package/dist/orchestration/status-helpers.js +6 -5
  98. package/dist/orchestration/thread-callback.d.ts +11 -1
  99. package/dist/orchestration/thread-callback.js +66 -30
  100. package/dist/platform/adapters/feishu.d.ts +27 -0
  101. package/dist/platform/adapters/feishu.js +136 -4
  102. package/dist/platform/interactive-builder.js +19 -18
  103. package/dist/store/version-migrations.d.ts +7 -0
  104. package/dist/store/version-migrations.js +88 -0
  105. package/package.json +1 -1
@@ -2,6 +2,7 @@ import { queryGpuSnapshot, renderGpuSnapshot } from '../../../domain/monitor/gpu
2
2
  import { getMachineRegistry, getLocalMachine } from '../../../domain/tasks/dispatch-utils.js';
3
3
  import { sendCommand, isDeviceOnline } from '../../../domain/remote/client-manager.js';
4
4
  import { Icons } from '../../../core/icons.js';
5
+ import { t } from '../../../core/i18n.js';
5
6
  const NVTOP_REFRESH_MS = 1000;
6
7
  const NVTOP_HISTORY_LIMIT = 12;
7
8
  const activeNvtopMonitors = new Map();
@@ -30,24 +31,24 @@ export async function handleNvidiaSmiCmd(channel, adapter, trimmedMessage) {
30
31
  const reg = getMachineRegistry()[machine];
31
32
  if (!reg) {
32
33
  const valid = Object.keys(getMachineRegistry()).filter(m => getMachineRegistry()[m].gpuCount > 0).map(m => `\`${m}\``).join(', ');
33
- await adapter.postMessage(dest, { text: `${Icons.error} Unknown machine: \`${machine}\`\nGPU machines: ${valid}` });
34
+ await adapter.postMessage(dest, { text: `${Icons.error} ${t('cmd.nvtop.unknownMachineGpu', { machine, valid })}` });
34
35
  return;
35
36
  }
36
37
  if (reg.gpuCount === 0) {
37
- await adapter.postMessage(dest, { text: `${Icons.error} \`${machine}\` has no GPU.` });
38
+ await adapter.postMessage(dest, { text: `${Icons.error} ${t('cmd.nvtop.noGpu', { machine })}` });
38
39
  return;
39
40
  }
40
41
  if (!isDeviceOnline(machine)) {
41
- await adapter.postMessage(dest, { text: `${Icons.error} Device \`${machine}\` is not online.` });
42
+ await adapter.postMessage(dest, { text: `${Icons.error} ${t('cmd.nvtop.deviceOffline', { machine })}` });
42
43
  return;
43
44
  }
44
45
  try {
45
46
  const result = await sendCommand(machine, { action: 'bash', params: { command: 'nvidia-smi' }, timeout: 15000 });
46
- const output = result.stdout || result.stderr || '(no output)';
47
- await adapter.postMessage(dest, { text: `*nvidia-smi* on \`${machine}\`\n\`\`\`\n${output}\n\`\`\`` });
47
+ const output = result.stdout || result.stderr || t('cmd.nvtop.noOutput');
48
+ await adapter.postMessage(dest, { text: t('cmd.nvtop.smiHeader', { machine, output }) });
48
49
  }
49
50
  catch (err) {
50
- await adapter.postMessage(dest, { text: `${Icons.error} nvidia-smi failed on \`${machine}\`: ${err.message}` });
51
+ await adapter.postMessage(dest, { text: `${Icons.error} ${t('cmd.nvtop.smiFailed', { machine, error: err.message })}` });
51
52
  }
52
53
  }
53
54
  export async function handleNvtopCmd(channel, adapter, trimmedMessage) {
@@ -56,27 +57,27 @@ export async function handleNvtopCmd(channel, adapter, trimmedMessage) {
56
57
  if (args[0] === 'stop') {
57
58
  const active = activeNvtopMonitors.get(channel);
58
59
  if (!active) {
59
- await adapter.postMessage(dest, { text: 'No active nvtop monitor in this channel.' });
60
+ await adapter.postMessage(dest, { text: t('cmd.nvtop.noActive') });
60
61
  return;
61
62
  }
62
63
  clearInterval(active.interval);
63
64
  activeNvtopMonitors.delete(channel);
64
- await adapter.postMessage(dest, { text: `${Icons.stopped} nvtop stopped on \`${active.machine}\`.` });
65
+ await adapter.postMessage(dest, { text: `${Icons.stopped} ${t('cmd.nvtop.stopped', { machine: active.machine })}` });
65
66
  return;
66
67
  }
67
68
  if (activeNvtopMonitors.has(channel)) {
68
- await adapter.postMessage(dest, { text: 'nvtop already running. Use `!nvtop stop` first.' });
69
+ await adapter.postMessage(dest, { text: t('cmd.nvtop.alreadyRunning') });
69
70
  return;
70
71
  }
71
72
  const machine = args[0] || getLocalMachine();
72
73
  const reg = getMachineRegistry()[machine];
73
74
  if (!reg) {
74
75
  const valid = Object.keys(getMachineRegistry()).filter(m => getMachineRegistry()[m].gpuCount > 0).map(m => `\`${m}\``).join(', ');
75
- await adapter.postMessage(dest, { text: `${Icons.error} Unknown machine: \`${machine}\`\nGPU machines: ${valid}` });
76
+ await adapter.postMessage(dest, { text: `${Icons.error} ${t('cmd.nvtop.unknownMachineGpu', { machine, valid })}` });
76
77
  return;
77
78
  }
78
79
  if (reg.gpuCount === 0) {
79
- await adapter.postMessage(dest, { text: `${Icons.error} nvtop monitoring is not supported on \`${machine}\` yet.` });
80
+ await adapter.postMessage(dest, { text: `${Icons.error} ${t('cmd.nvtop.notSupported', { machine })}` });
80
81
  return;
81
82
  }
82
83
  try {
@@ -101,6 +102,6 @@ export async function handleNvtopCmd(channel, adapter, trimmedMessage) {
101
102
  });
102
103
  }
103
104
  catch (err) {
104
- await adapter.postMessage(dest, { text: `${Icons.error} nvtop failed on \`${machine}\`: ${err.message}` });
105
+ await adapter.postMessage(dest, { text: `${Icons.error} ${t('cmd.nvtop.failed', { machine, error: err.message })}` });
105
106
  }
106
107
  }
@@ -1,4 +1,5 @@
1
+ import { t } from '../../../core/i18n.js';
1
2
  export async function handleOrientCmd(channel, adapter) {
2
3
  const dest = { type: 'interactive-reply', conduit: channel, sessionId: '' };
3
- await adapter.postMessage(dest, { text: '`!orient` command not yet implemented.' });
4
+ await adapter.postMessage(dest, { text: t('cmd.orient.notImplemented') });
4
5
  }
@@ -1,10 +1,11 @@
1
1
  import { handleScheduleCommand } from '../../../domain/scheduling/schedule-command.js';
2
+ import { t } from '../../../core/i18n.js';
2
3
  const MAX_SCHEDULE_BUTTONS = 10;
3
4
  const FMT_OPTS = { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit', hour12: false };
4
5
  const fmtTime = (ts) => new Date(ts).toLocaleString('en-US', FMT_OPTS);
5
6
  function formatTimeUntilCompact(ms) {
6
7
  if (ms <= 0)
7
- return 'now';
8
+ return t('cmd.schedule.now');
8
9
  const seconds = Math.floor(ms / 1000);
9
10
  if (seconds < 60)
10
11
  return `${seconds}s`;
@@ -16,35 +17,35 @@ function formatTimeUntilCompact(ms) {
16
17
  return `${hours}h`;
17
18
  return `${Math.floor(hours / 24)}d`;
18
19
  }
19
- function formatTaskLine(t, now) {
20
- const id = `\`${t.id}\``;
21
- const profile = t.profile ? ` · ${t.profile}` : '';
22
- const paused = t.isPaused ? ' · *paused*' : '';
23
- const nextMs = (t.nextRun || t.runAt || 0) - now;
24
- const next = t.isPaused ? '' : ` · next: ${formatTimeUntilCompact(nextMs)}`;
25
- const msg = t.message.length > 40 ? t.message.slice(0, 37) + '...' : t.message;
26
- return `${id} ${t.type}${profile}${paused}${next} · "${msg}"`;
20
+ function formatTaskLine(task, now) {
21
+ const id = `\`${task.id}\``;
22
+ const profile = task.profile ? ` · ${task.profile}` : '';
23
+ const paused = task.isPaused ? ` · *${t('cmd.schedule.paused')}*` : '';
24
+ const nextMs = (task.nextRun || task.runAt || 0) - now;
25
+ const next = task.isPaused ? '' : ` · ${t('cmd.schedule.nextLabel')}: ${formatTimeUntilCompact(nextMs)}`;
26
+ const msg = task.message.length > 40 ? task.message.slice(0, 37) + '...' : task.message;
27
+ return `${id} ${task.type}${profile}${paused}${next} · "${msg}"`;
27
28
  }
28
29
  function buildScheduleTaskButtons(tasks) {
29
30
  const buttons = [];
30
31
  for (let i = 0; i < Math.min(tasks.length, MAX_SCHEDULE_BUTTONS); i++) {
31
- const t = tasks[i];
32
- if (t.type === 'once') {
32
+ const task = tasks[i];
33
+ if (task.type === 'once') {
33
34
  buttons.push({
34
- type: 'button', text: `Remove ${t.id}`,
35
- actionId: `cmd:schedule:remove-${i}`, value: t.id, style: 'danger',
35
+ type: 'button', text: t('cmd.schedule.removeButton', { id: task.id }),
36
+ actionId: `cmd:schedule:remove-${i}`, value: task.id, style: 'danger',
36
37
  });
37
38
  }
38
- else if (t.isPaused) {
39
+ else if (task.isPaused) {
39
40
  buttons.push({
40
- type: 'button', text: `Resume ${t.id}`,
41
- actionId: `cmd:schedule:resume-${i}`, value: t.id,
41
+ type: 'button', text: t('cmd.schedule.resumeButton', { id: task.id }),
42
+ actionId: `cmd:schedule:resume-${i}`, value: task.id,
42
43
  });
43
44
  }
44
45
  else {
45
46
  buttons.push({
46
- type: 'button', text: `Pause ${t.id}`,
47
- actionId: `cmd:schedule:pause-${i}`, value: t.id,
47
+ type: 'button', text: t('cmd.schedule.pauseButton', { id: task.id }),
48
+ actionId: `cmd:schedule:pause-${i}`, value: task.id,
48
49
  });
49
50
  }
50
51
  }
@@ -56,8 +57,8 @@ export function createScheduleHandler(scheduler, router) {
56
57
  const tasks = await scheduler.list();
57
58
  const now = Date.now();
58
59
  const text = tasks.length === 0
59
- ? 'No scheduled tasks.'
60
- : `*Scheduled tasks (${tasks.length}):*\n${tasks.map(t => `• ${formatTaskLine(t, now)}`).join('\n')}`;
60
+ ? t('cmd.schedule.none')
61
+ : `${t('cmd.schedule.header', { n: tasks.length })}\n${tasks.map(task => `• ${formatTaskLine(task, now)}`).join('\n')}`;
61
62
  await adapter.updateMessage(messageRef, {
62
63
  text,
63
64
  richBlocks: [
@@ -117,11 +118,11 @@ export function createScheduleHandler(scheduler, router) {
117
118
  if (router && scheduler && (!sub || sub === 'list')) {
118
119
  const tasks = await scheduler.list();
119
120
  if (tasks.length === 0) {
120
- await adapter.postMessage(dest, { text: 'No scheduled tasks.' });
121
+ await adapter.postMessage(dest, { text: t('cmd.schedule.none') });
121
122
  return;
122
123
  }
123
124
  const now = Date.now();
124
- const text = `*Scheduled tasks (${tasks.length}):*\n${tasks.map(t => `• ${formatTaskLine(t, now)}`).join('\n')}`;
125
+ const text = `${t('cmd.schedule.header', { n: tasks.length })}\n${tasks.map(task => `• ${formatTaskLine(task, now)}`).join('\n')}`;
125
126
  return {
126
127
  text,
127
128
  richBlocks: [{ type: 'section', text }],
@@ -1,5 +1,6 @@
1
1
  import { getMachineRegistry } from '../../../domain/tasks/dispatch-utils.js';
2
2
  import { Icons } from '../../../core/icons.js';
3
+ import { t } from '../../../core/i18n.js';
3
4
  import { statSync, existsSync, mkdirSync, unlinkSync } from 'fs';
4
5
  import { execFile } from 'child_process';
5
6
  import * as os from 'os';
@@ -18,16 +19,16 @@ async function sendLocalFile(channel, adapter, reg, filePath, machine) {
18
19
  resolved = path.resolve(reg.cortexPath, filePath);
19
20
  }
20
21
  if (!existsSync(resolved)) {
21
- await adapter.postMessage(dest, { text: `${Icons.error} File not found: \`${resolved}\`` });
22
+ await adapter.postMessage(dest, { text: `${Icons.error} ${t('cmd.sendfile.fileNotFound', { path: resolved })}` });
22
23
  return;
23
24
  }
24
25
  const stat = statSync(resolved);
25
26
  if (!stat.isFile()) {
26
- await adapter.postMessage(dest, { text: `${Icons.error} Not a file: \`${resolved}\`` });
27
+ await adapter.postMessage(dest, { text: `${Icons.error} ${t('cmd.sendfile.notAFile', { path: resolved })}` });
27
28
  return;
28
29
  }
29
30
  await adapter.uploadFile(dest, resolved, { filename: path.basename(resolved) });
30
- await adapter.postMessage(dest, { text: `${Icons.ok} Sent \`${path.basename(resolved)}\` (${(stat.size / 1024).toFixed(1)} KB) from ${machine}` });
31
+ await adapter.postMessage(dest, { text: `${Icons.ok} ${t('cmd.sendfile.sent', { name: path.basename(resolved), size: (stat.size / 1024).toFixed(1), machine })}` });
31
32
  }
32
33
  async function sendRemoteFile(channel, adapter, reg, filePath, machine) {
33
34
  const dest = { type: 'interactive-reply', conduit: channel, sessionId: '' };
@@ -61,13 +62,13 @@ async function sendRemoteFile(channel, adapter, reg, filePath, machine) {
61
62
  });
62
63
  }
63
64
  catch (err) {
64
- await adapter.postMessage(dest, { text: `${Icons.error} Failed to fetch from ${machine}: ${err.message}` });
65
+ await adapter.postMessage(dest, { text: `${Icons.error} ${t('cmd.sendfile.fetchFailed', { machine, error: err.message })}` });
65
66
  return;
66
67
  }
67
68
  try {
68
69
  const tmpStat = statSync(localTmp);
69
70
  await adapter.uploadFile(dest, localTmp, { filename: fileName });
70
- await adapter.postMessage(dest, { text: `${Icons.ok} Sent \`${fileName}\` (${(tmpStat.size / 1024).toFixed(1)} KB) from ${machine}` });
71
+ await adapter.postMessage(dest, { text: `${Icons.ok} ${t('cmd.sendfile.sent', { name: fileName, size: (tmpStat.size / 1024).toFixed(1), machine })}` });
71
72
  }
72
73
  finally {
73
74
  try {
@@ -80,14 +81,14 @@ export async function handleSendFileCmd(channel, adapter, trimmedMessage) {
80
81
  const dest = { type: 'interactive-reply', conduit: channel, sessionId: '' };
81
82
  const args = trimmedMessage.split(/\s+/).slice(1);
82
83
  if (args.length < 2) {
83
- await adapter.postMessage(dest, { text: 'Usage: `!sendFile <machine> <path>`\nPath can be absolute, relative to Cortex root, or start with `~`' });
84
+ await adapter.postMessage(dest, { text: t('cmd.sendfile.usage') });
84
85
  return;
85
86
  }
86
87
  const machine = args[0];
87
88
  const filePath = args.slice(1).join(' ');
88
89
  const reg = getMachineRegistry()[machine];
89
90
  if (!reg) {
90
- await adapter.postMessage(dest, { text: `${Icons.error} Unknown machine: \`${machine}\`. Known: ${Object.keys(getMachineRegistry()).join(', ')}` });
91
+ await adapter.postMessage(dest, { text: `${Icons.error} ${t('cmd.sendfile.unknownMachine', { machine, known: Object.keys(getMachineRegistry()).join(', ') })}` });
91
92
  return;
92
93
  }
93
94
  if (!reg.ssh)
@@ -1,5 +1,6 @@
1
1
  import { createLogger } from '../../../core/log.js';
2
2
  import { Icons } from '../../../core/icons.js';
3
+ import { t } from '../../../core/i18n.js';
3
4
  import { closeSession, getActiveBackend, getActiveProfile } from '../../../domain/agents/index.js';
4
5
  import { fireAndForgetPreCloseHook } from '../../../domain/sessions/session-hooks.js';
5
6
  import { sessionStore } from '../../../store/session-registry-repo.js';
@@ -50,7 +51,7 @@ export async function handleNewCmd(channel, adapter, opts = {}, threadAnchorId)
50
51
  if (cleared > 0)
51
52
  log.info('Cleared pending plan for channel:', channel);
52
53
  log.info('New conversation started in channel:', channel);
53
- await adapter.postMessage(dest, { text: `--- new conversation --- (profile: ${profileName})` });
54
+ await adapter.postMessage(dest, { text: t('cmd.session.newConversation', { profile: profileName }) });
54
55
  }
55
56
  const MAX_RESUME_BUTTONS = 10;
56
57
  export function createResumeHandler(router) {
@@ -64,16 +65,16 @@ export function createResumeHandler(router) {
64
65
  if (!record) {
65
66
  if (ctx.messageRef) {
66
67
  await adapter.updateMessage(ctx.messageRef, {
67
- text: `${Icons.error} Session \`${name}\` not found.`,
68
+ text: `${Icons.error} ${t('cmd.session.notFound', { name })}`,
68
69
  }).catch(() => { });
69
70
  }
70
71
  return;
71
72
  }
72
73
  await attachExistingSession(ctx.channelId, { sessionId: record.sessionId, sessionName: name, backend: record.backend, profileName: record.profileName });
73
- const profileNote = record.profileName ? ` (profile: ${record.profileName})` : '';
74
+ const profileNote = record.profileName ? t('cmd.session.profileNote', { profile: record.profileName }) : '';
74
75
  if (ctx.messageRef) {
75
76
  await adapter.updateMessage(ctx.messageRef, {
76
- text: `${Icons.refresh} Switched to session \`${name}\`${profileNote}`,
77
+ text: `${Icons.refresh} ${t('cmd.session.switched', { name, profileNote })}`,
77
78
  }).catch(() => { });
78
79
  }
79
80
  };
@@ -91,25 +92,25 @@ export function createResumeHandler(router) {
91
92
  const name = args[0];
92
93
  const record = await sessionStore.lookupSession(name);
93
94
  if (!record) {
94
- await adapter.postMessage(dest, { text: `${Icons.error} Session \`${name}\` not found. Run \`!resume\` to list sessions.` });
95
+ await adapter.postMessage(dest, { text: `${Icons.error} ${t('cmd.session.notFoundList', { name })}` });
95
96
  return;
96
97
  }
97
98
  await attachExistingSession(channel, { sessionId: record.sessionId, sessionName: name, backend: record.backend, profileName: record.profileName });
98
- const profileNote = record.profileName ? ` (profile: ${record.profileName})` : '';
99
- await adapter.postMessage(dest, { text: `${Icons.refresh} Switched to session \`${name}\`${profileNote}` });
99
+ const profileNote = record.profileName ? t('cmd.session.profileNote', { profile: record.profileName }) : '';
100
+ await adapter.postMessage(dest, { text: `${Icons.refresh} ${t('cmd.session.switched', { name, profileNote })}` });
100
101
  return;
101
102
  }
102
103
  const sessions = await sessionStore.listRecentSessions(10);
103
104
  if (sessions.length === 0) {
104
- await adapter.postMessage(dest, { text: 'No sessions recorded yet.' });
105
+ await adapter.postMessage(dest, { text: t('cmd.session.noSessions') });
105
106
  return;
106
107
  }
107
108
  const activeId = await sessionStore.getActiveSessionName(channel, getActiveBackend());
108
109
  const now = Date.now();
109
- const lines = ['*Recent sessions*'];
110
+ const lines = [t('cmd.session.recentHeader')];
110
111
  for (const s of sessions) {
111
112
  const isActive = s.name === activeId;
112
- const activeTag = isActive ? ' *(active)*' : '';
113
+ const activeTag = isActive ? t('cmd.session.activeTag') : '';
113
114
  const ago = formatTimeAgo(now - new Date(s.lastUsedAt).getTime());
114
115
  const label = s.label ? ` — ${s.label}` : '';
115
116
  const kind = s.kind === 'scheduled' ? ` ${Icons.scheduled}` : '';
@@ -1,3 +1,4 @@
1
+ import { t } from '../../../core/i18n.js';
1
2
  export function createStatusHandler(getExecutionStatusReport, router) {
2
3
  // Register refresh action handler
3
4
  if (router) {
@@ -17,7 +18,7 @@ export function createStatusHandler(getExecutionStatusReport, router) {
17
18
  type: 'actions',
18
19
  elements: [{
19
20
  type: 'button',
20
- text: 'Refresh',
21
+ text: t('cmd.status.refreshButton'),
21
22
  actionId: 'cmd:status:refresh',
22
23
  value: 'refresh',
23
24
  }],
@@ -29,7 +30,7 @@ export function createStatusHandler(getExecutionStatusReport, router) {
29
30
  });
30
31
  }
31
32
  return async function handleStatusCmd(channel, adapter) {
32
- const text = getExecutionStatusReport ? getExecutionStatusReport() : 'Execution status reporting is not available in this process.';
33
+ const text = getExecutionStatusReport ? getExecutionStatusReport() : t('cmd.status.unavailable');
33
34
  if (!router) {
34
35
  await adapter.postMessage({ type: 'interactive-reply', conduit: channel, sessionId: '' }, { text });
35
36
  return;
@@ -39,7 +40,7 @@ export function createStatusHandler(getExecutionStatusReport, router) {
39
40
  richBlocks: [{ type: 'section', text }],
40
41
  actions: [{
41
42
  type: 'button',
42
- text: 'Refresh',
43
+ text: t('cmd.status.refreshButton'),
43
44
  actionId: 'cmd:status:refresh',
44
45
  value: 'refresh',
45
46
  }],
@@ -47,84 +48,90 @@ export function createStatusHandler(getExecutionStatusReport, router) {
47
48
  };
48
49
  }
49
50
  // --- Help command categories ---
50
- const HELP_CATEGORIES = {
51
- session: {
52
- label: 'Session',
53
- commands: [
54
- '`!new` — start a new conversation; runs pre-close hook (`!newq` to skip)',
55
- '`!cancel [taskId]` — stop current task, or a dispatched task by id',
56
- '`!resume [cortex-XXXX]` — list recent sessions, or switch to one',
57
- ],
58
- },
59
- config: {
60
- label: 'Config',
61
- commands: [
62
- '`!mode` — toggle API / Plan mode',
63
- '`!backend` — toggle Claude Code / Codex backend',
64
- '`!model [name]` — show or set Claude model',
65
- '`!profile [name]` — show active profile or switch to one',
66
- '`!skills` — list available skills',
67
- ],
68
- },
69
- monitoring: {
70
- label: 'Monitoring',
71
- commands: [
72
- '`!cost [project]` — show cost summary (global or per-project)',
73
- '`!status` — show running execution summary',
74
- '`!budget $X/d $Y/m` — set daily/monthly budget',
75
- '`!schedule` — list, add, pause, resume, or remove scheduled tasks',
76
- ],
77
- },
78
- tasks: {
79
- label: 'Tasks',
80
- commands: [
81
- '`!tasks <project>` — list all tasks with details for a project',
82
- '`!projects` — list projects and their registered channels',
83
- '`!register <project>` — register this channel for project task notifications',
84
- '`!unregister <project>` — unregister this channel from a project',
85
- '`!project-dir` — manage project code directories per machine',
86
- ],
87
- },
88
- devices: {
89
- label: 'Devices',
90
- commands: [
91
- '`!devices` — show online/offline status of all cortex-client devices',
92
- '`!nvidia-smi [machine]` — show GPU status (default: local)',
93
- '`!nvtop [machine|stop]` — live GPU monitor with sparkline view',
94
- '`!tail [stop]` — live-tail daemon.log',
95
- '`!sendFile <machine> <path>` — send a file to Slack',
96
- ],
97
- },
98
- threads: {
99
- label: 'Threads',
100
- commands: [
101
- '`!thread` — manage threads: status, start, add agent, cancel, list agents/templates',
102
- '`!agent [name|off]` — show, set, or disable default agent',
103
- ],
104
- },
105
- };
51
+ // Built per call so labels and command descriptions resolve in the ACTIVE locale (the !lang
52
+ // command can switch it at runtime). A module-level const would freeze English at import time.
53
+ function getHelpCategories() {
54
+ return {
55
+ session: {
56
+ label: t('cmd.help.catSession'),
57
+ commands: [
58
+ t('cmd.help.session.new'),
59
+ t('cmd.help.session.cancel'),
60
+ t('cmd.help.session.resume'),
61
+ ],
62
+ },
63
+ config: {
64
+ label: t('cmd.help.catConfig'),
65
+ commands: [
66
+ t('cmd.help.config.mode'),
67
+ t('cmd.help.config.backend'),
68
+ t('cmd.help.config.model'),
69
+ t('cmd.help.config.profile'),
70
+ t('cmd.help.config.skills'),
71
+ ],
72
+ },
73
+ monitoring: {
74
+ label: t('cmd.help.catMonitoring'),
75
+ commands: [
76
+ t('cmd.help.monitoring.cost'),
77
+ t('cmd.help.monitoring.status'),
78
+ t('cmd.help.monitoring.budget'),
79
+ t('cmd.help.monitoring.schedule'),
80
+ ],
81
+ },
82
+ tasks: {
83
+ label: t('cmd.help.catTasks'),
84
+ commands: [
85
+ t('cmd.help.tasks.tasks'),
86
+ t('cmd.help.tasks.projects'),
87
+ t('cmd.help.tasks.register'),
88
+ t('cmd.help.tasks.unregister'),
89
+ t('cmd.help.tasks.projectDir'),
90
+ ],
91
+ },
92
+ devices: {
93
+ label: t('cmd.help.catDevices'),
94
+ commands: [
95
+ t('cmd.help.devices.devices'),
96
+ t('cmd.help.devices.nvidiaSmi'),
97
+ t('cmd.help.devices.nvtop'),
98
+ t('cmd.help.devices.tail'),
99
+ t('cmd.help.devices.sendfile'),
100
+ ],
101
+ },
102
+ threads: {
103
+ label: t('cmd.help.catThreads'),
104
+ commands: [
105
+ t('cmd.help.threads.thread'),
106
+ t('cmd.help.threads.agent'),
107
+ ],
108
+ },
109
+ };
110
+ }
106
111
  function buildHelpText(category) {
107
- if (category && category !== 'all' && HELP_CATEGORIES[category]) {
108
- const cat = HELP_CATEGORIES[category];
109
- return `*Commands — ${cat.label}*\n${cat.commands.join('\n')}`;
112
+ const categories = getHelpCategories();
113
+ if (category && category !== 'all' && categories[category]) {
114
+ const cat = categories[category];
115
+ return `${t('cmd.help.headingCategory', { label: cat.label })}\n${cat.commands.join('\n')}`;
110
116
  }
111
- const allCommands = Object.values(HELP_CATEGORIES).flatMap(c => c.commands);
112
- return ['*Commands*', ...allCommands, '`!help` — this message'].join('\n');
117
+ const allCommands = Object.values(categories).flatMap(c => c.commands);
118
+ return [t('cmd.help.heading'), ...allCommands, t('cmd.help.selfLine')].join('\n');
113
119
  }
114
120
  // Slack section blocks have a 3000-char limit; split into one block per category.
115
121
  function buildHelpRichBlocks(category) {
116
- if (category && category !== 'all' && HELP_CATEGORIES[category]) {
117
- const cat = HELP_CATEGORIES[category];
118
- return [{ type: 'section', text: `*Commands — ${cat.label}*\n${cat.commands.join('\n')}` }];
122
+ const categories = getHelpCategories();
123
+ if (category && category !== 'all' && categories[category]) {
124
+ const cat = categories[category];
125
+ return [{ type: 'section', text: `${t('cmd.help.headingCategory', { label: cat.label })}\n${cat.commands.join('\n')}` }];
119
126
  }
120
- return Object.values(HELP_CATEGORIES).map(cat => ({
127
+ return Object.values(categories).map(cat => ({
121
128
  type: 'section',
122
129
  text: `*${cat.label}*\n${cat.commands.join('\n')}`,
123
130
  }));
124
131
  }
125
- const HELP_CATEGORY_KEYS = [...Object.keys(HELP_CATEGORIES), 'all'];
132
+ const HELP_CATEGORY_KEYS = ['session', 'config', 'monitoring', 'tasks', 'devices', 'threads', 'all'];
126
133
  function buildHelpButtons() {
127
- const buttons = Object.entries(HELP_CATEGORIES).map(([key, cat]) => ({
134
+ const buttons = Object.entries(getHelpCategories()).map(([key, cat]) => ({
128
135
  type: 'button',
129
136
  text: cat.label,
130
137
  actionId: `cmd:help:cat-${key}`,
@@ -132,7 +139,7 @@ function buildHelpButtons() {
132
139
  }));
133
140
  buttons.push({
134
141
  type: 'button',
135
- text: 'Show All',
142
+ text: t('cmd.help.showAll'),
136
143
  actionId: 'cmd:help:cat-all',
137
144
  value: 'all',
138
145
  });
@@ -2,18 +2,19 @@ import { statSync, openSync, readSync, closeSync } from 'fs';
2
2
  import * as path from 'path';
3
3
  import { moduleDir } from '../../../core/utils.js';
4
4
  import { Icons } from '../../../core/icons.js';
5
+ import { t } from '../../../core/i18n.js';
5
6
  const DAEMON_LOG_PATH = path.join(moduleDir(import.meta.url), '..', '..', '..', '..', 'logs', 'daemon.log');
6
7
  const activeTails = new Map();
7
8
  async function stopTail(channel, adapter) {
8
9
  const dest = { type: 'interactive-reply', conduit: channel, sessionId: '' };
9
10
  const active = activeTails.get(channel);
10
11
  if (!active) {
11
- await adapter.postMessage(dest, { text: 'No active tail in this channel.' });
12
+ await adapter.postMessage(dest, { text: t('cmd.tail.noActive') });
12
13
  return;
13
14
  }
14
15
  clearInterval(active.interval);
15
16
  activeTails.delete(channel);
16
- await adapter.postMessage(dest, { text: `${Icons.stopped} Tail stopped.` });
17
+ await adapter.postMessage(dest, { text: `${Icons.stopped} ${t('cmd.tail.stopped')}` });
17
18
  }
18
19
  async function sendInitialTailPreview(channel, adapter) {
19
20
  const previewDest = { type: 'interactive-reply', conduit: channel, sessionId: '' };
@@ -25,11 +26,11 @@ async function sendInitialTailPreview(channel, adapter) {
25
26
  readSync(fd, buf, 0, previewBytes, stat.size - previewBytes);
26
27
  closeSync(fd);
27
28
  const lines = buf.toString('utf-8').split('\n').filter(Boolean).slice(-30);
28
- await adapter.postMessage(previewDest, { text: `${Icons.scroll} *Tailing daemon.log* (last ${lines.length} lines, refresh every 3s)\n\`\`\`\n${lines.join('\n')}\n\`\`\`\nUse \`!tail stop\` to stop.` });
29
+ await adapter.postMessage(previewDest, { text: `${Icons.scroll} ${t('cmd.tail.preview', { n: lines.length, content: lines.join('\n') })}` });
29
30
  return stat.size;
30
31
  }
31
32
  catch (err) {
32
- await adapter.postMessage(previewDest, { text: `${Icons.error} Cannot read daemon.log: ${err.message}` });
33
+ await adapter.postMessage(previewDest, { text: `${Icons.error} ${t('cmd.tail.cannotRead', { error: err.message })}` });
33
34
  return null;
34
35
  }
35
36
  }
@@ -68,7 +69,7 @@ export async function handleTailCmd(channel, adapter, trimmedMessage) {
68
69
  return stopTail(channel, adapter);
69
70
  const cmdDest = { type: 'interactive-reply', conduit: channel, sessionId: '' };
70
71
  if (activeTails.has(channel)) {
71
- await adapter.postMessage(cmdDest, { text: 'Already tailing. Use `!tail stop` to stop first.' });
72
+ await adapter.postMessage(cmdDest, { text: t('cmd.tail.alreadyTailing') });
72
73
  return;
73
74
  }
74
75
  const offset = await sendInitialTailPreview(channel, adapter);