team-anya-cli 0.1.8 → 1.0.1
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/README.md +1 -37
- package/package.json +6 -37
- package/anya/prompts/execution-guides/git-delivery.md +0 -38
- package/anya/prompts/execution-guides/testing-and-self-heal.md +0 -28
- package/anya/prompts/protocols/brief-assembly.md +0 -55
- package/anya/prompts/protocols/report.md +0 -175
- package/anya/prompts/protocols/review.md +0 -90
- package/anya/prompts/task-claude-md.template.md +0 -32
- package/apps/server/dist/broker/cc-broker.js +0 -261
- package/apps/server/dist/cli.js +0 -296
- package/apps/server/dist/config.js +0 -76
- package/apps/server/dist/daemon.js +0 -51
- package/apps/server/dist/franky/context-builder.js +0 -160
- package/apps/server/dist/franky/franky-mcp-server.js +0 -107
- package/apps/server/dist/franky/franky-orchestrator.js +0 -450
- package/apps/server/dist/franky/index.js +0 -5
- package/apps/server/dist/franky/topic-router.js +0 -16
- package/apps/server/dist/gateway/chat-sync.js +0 -135
- package/apps/server/dist/gateway/command-router.js +0 -114
- package/apps/server/dist/gateway/commands/cancel.js +0 -32
- package/apps/server/dist/gateway/commands/help.js +0 -16
- package/apps/server/dist/gateway/commands/index.js +0 -26
- package/apps/server/dist/gateway/commands/restart.js +0 -34
- package/apps/server/dist/gateway/commands/status.js +0 -34
- package/apps/server/dist/gateway/commands/tasks.js +0 -33
- package/apps/server/dist/gateway/feishu-sender.js +0 -410
- package/apps/server/dist/gateway/feishu-ws.js +0 -256
- package/apps/server/dist/gateway/http.js +0 -1019
- package/apps/server/dist/gateway/media-downloader.js +0 -149
- package/apps/server/dist/gateway/message-events.js +0 -10
- package/apps/server/dist/gateway/message-intake.js +0 -67
- package/apps/server/dist/gateway/message-queue.js +0 -118
- package/apps/server/dist/gateway/session-reader.js +0 -142
- package/apps/server/dist/gateway/ws-push.js +0 -115
- package/apps/server/dist/loid/brain.js +0 -105
- package/apps/server/dist/loid/clarifier.js +0 -162
- package/apps/server/dist/loid/context-builder.js +0 -413
- package/apps/server/dist/loid/mcp-server.js +0 -106
- package/apps/server/dist/loid/memory-settler.js +0 -189
- package/apps/server/dist/loid/opportunity-manager.js +0 -148
- package/apps/server/dist/loid/profile-updater.js +0 -179
- package/apps/server/dist/loid/reporter.js +0 -148
- package/apps/server/dist/loid/schemas.js +0 -117
- package/apps/server/dist/loid/self-calibrator.js +0 -314
- package/apps/server/dist/loid/session-manager.js +0 -301
- package/apps/server/dist/loid/session.js +0 -271
- package/apps/server/dist/loid/worktree-manager.js +0 -191
- package/apps/server/dist/main.js +0 -393
- package/apps/server/dist/tracing/index.js +0 -2
- package/apps/server/dist/tracing/trace-context.js +0 -92
- package/apps/server/dist/types/message.js +0 -2
- package/apps/server/dist/yor/yor-mcp-server.js +0 -104
- package/apps/server/dist/yor/yor-orchestrator.js +0 -233
- package/apps/web/dist/assets/index-BiiEB0qZ.css +0 -1
- package/apps/web/dist/assets/index-D1AK5ZEE.js +0 -798
- package/apps/web/dist/index.html +0 -13
- package/packages/cc-client/dist/claude-code-backend.js +0 -664
- package/packages/cc-client/dist/index.js +0 -2
- package/packages/cc-client/package.json +0 -11
- package/packages/core/dist/constants.js +0 -59
- package/packages/core/dist/errors.js +0 -35
- package/packages/core/dist/index.js +0 -7
- package/packages/core/dist/office-init.js +0 -101
- package/packages/core/dist/scope/checker.js +0 -114
- package/packages/core/dist/scope/defaults.js +0 -55
- package/packages/core/dist/scope/index.js +0 -3
- package/packages/core/dist/state-machine.js +0 -85
- package/packages/core/dist/types/audit.js +0 -12
- package/packages/core/dist/types/backend.js +0 -2
- package/packages/core/dist/types/commitment.js +0 -17
- package/packages/core/dist/types/communication.js +0 -18
- package/packages/core/dist/types/index.js +0 -8
- package/packages/core/dist/types/opportunity.js +0 -27
- package/packages/core/dist/types/org.js +0 -26
- package/packages/core/dist/types/task.js +0 -46
- package/packages/core/package.json +0 -10
- package/packages/db/dist/client.js +0 -69
- package/packages/db/dist/index.js +0 -691
- package/packages/db/dist/schema/audit-events.js +0 -13
- package/packages/db/dist/schema/cc-sessions.js +0 -14
- package/packages/db/dist/schema/chats.js +0 -33
- package/packages/db/dist/schema/commitments.js +0 -18
- package/packages/db/dist/schema/communication-events.js +0 -14
- package/packages/db/dist/schema/index.js +0 -13
- package/packages/db/dist/schema/message-log.js +0 -20
- package/packages/db/dist/schema/opportunities.js +0 -23
- package/packages/db/dist/schema/org.js +0 -36
- package/packages/db/dist/schema/projects.js +0 -23
- package/packages/db/dist/schema/tasks.js +0 -48
- package/packages/db/dist/schema/topics.js +0 -20
- package/packages/db/dist/schema/trace-spans.js +0 -19
- package/packages/db/package.json +0 -12
- package/packages/db/src/migrations/0000_baseline.sql +0 -251
- package/packages/db/src/migrations/meta/_journal.json +0 -13
- package/packages/mcp-tools/dist/index.js +0 -41
- package/packages/mcp-tools/dist/layer1/audit-append.js +0 -38
- package/packages/mcp-tools/dist/layer1/audit-query.js +0 -51
- package/packages/mcp-tools/dist/layer1/memory-brief.js +0 -168
- package/packages/mcp-tools/dist/layer1/memory-context.js +0 -124
- package/packages/mcp-tools/dist/layer1/memory-digest.js +0 -126
- package/packages/mcp-tools/dist/layer1/memory-forget.js +0 -108
- package/packages/mcp-tools/dist/layer1/memory-learn.js +0 -63
- package/packages/mcp-tools/dist/layer1/memory-recall.js +0 -287
- package/packages/mcp-tools/dist/layer1/memory-reflect.js +0 -80
- package/packages/mcp-tools/dist/layer1/memory-remember.js +0 -119
- package/packages/mcp-tools/dist/layer1/memory-search.js +0 -263
- package/packages/mcp-tools/dist/layer1/memory-write.js +0 -21
- package/packages/mcp-tools/dist/layer1/org-lookup.js +0 -47
- package/packages/mcp-tools/dist/layer1/project-get.js +0 -28
- package/packages/mcp-tools/dist/layer1/project-list.js +0 -20
- package/packages/mcp-tools/dist/layer1/report-daily.js +0 -68
- package/packages/mcp-tools/dist/layer1/task-get.js +0 -29
- package/packages/mcp-tools/dist/layer1/task-update.js +0 -34
- package/packages/mcp-tools/dist/layer2/franky/topic-checkpoint.js +0 -43
- package/packages/mcp-tools/dist/layer2/franky/topic-escalate.js +0 -19
- package/packages/mcp-tools/dist/layer2/loid/decision-log.js +0 -15
- package/packages/mcp-tools/dist/layer2/loid/decision-no-action.js +0 -15
- package/packages/mcp-tools/dist/layer2/loid/delivery-create-pr.js +0 -30
- package/packages/mcp-tools/dist/layer2/loid/delivery-share.js +0 -12
- package/packages/mcp-tools/dist/layer2/loid/delivery-submit.js +0 -77
- package/packages/mcp-tools/dist/layer2/loid/delivery-upload.js +0 -18
- package/packages/mcp-tools/dist/layer2/loid/project-remove.js +0 -16
- package/packages/mcp-tools/dist/layer2/loid/project-upsert.js +0 -33
- package/packages/mcp-tools/dist/layer2/loid/task-dispatch.js +0 -196
- package/packages/mcp-tools/dist/layer2/loid/task-lookup.js +0 -38
- package/packages/mcp-tools/dist/layer2/loid/topic-close.js +0 -22
- package/packages/mcp-tools/dist/layer2/loid/topic-create.js +0 -56
- package/packages/mcp-tools/dist/layer2/loid/yor-approve.js +0 -8
- package/packages/mcp-tools/dist/layer2/loid/yor-kill.js +0 -7
- package/packages/mcp-tools/dist/layer2/loid/yor-rework.js +0 -7
- package/packages/mcp-tools/dist/layer2/loid/yor-spawn.js +0 -15
- package/packages/mcp-tools/dist/layer2/loid/yor-status.js +0 -8
- package/packages/mcp-tools/dist/layer2/yor/task-block.js +0 -11
- package/packages/mcp-tools/dist/layer2/yor/task-deliver.js +0 -35
- package/packages/mcp-tools/dist/layer2/yor/task-progress.js +0 -21
- package/packages/mcp-tools/dist/layer3/adapters/feishu-adapter.js +0 -192
- package/packages/mcp-tools/dist/layer3/adapters/types.js +0 -28
- package/packages/mcp-tools/dist/layer3/channel-receive.js +0 -11
- package/packages/mcp-tools/dist/layer3/channel-send.js +0 -91
- package/packages/mcp-tools/dist/layer3/file-upload.js +0 -44
- package/packages/mcp-tools/dist/registry.js +0 -871
- package/packages/mcp-tools/package.json +0 -13
- package/workspace/.claude/settings.local.json +0 -9
- package/workspace/.mcp.json +0 -12
- package/workspace/CHARTER.md +0 -76
- package/workspace/CLAUDE.md +0 -58
- package/workspace/PROTOCOL.md +0 -160
- package/workspace/TOOLS.md +0 -470
- package/workspace/audit/.gitkeep +0 -0
- package/workspace/franky/CLAUDE.md +0 -37
- package/workspace/franky/PLAYBOOK.md +0 -215
- package/workspace/franky/PROFILE.md +0 -80
- package/workspace/loid/CLAUDE.md +0 -12
- package/workspace/loid/PLAYBOOK.md +0 -198
- package/workspace/loid/PROFILE.md +0 -78
- package/workspace/memory/commitments/.gitkeep +0 -0
- package/workspace/memory/execution/.gitkeep +0 -0
- package/workspace/memory/people/.gitkeep +0 -0
- package/workspace/memory/projects/.gitkeep +0 -0
- package/workspace/memory/self/.gitkeep +0 -0
- package/workspace/reference/identity/.gitkeep +0 -0
- package/workspace/reference/org/escalation.yaml +0 -24
- package/workspace/reference/org/ownership.yaml +0 -28
- package/workspace/reports/.gitkeep +0 -0
- package/workspace/yor/CLAUDE.md +0 -22
- package/workspace/yor/PLAYBOOK.md +0 -73
- package/workspace/yor/PROFILE.md +0 -52
- package/workspace/yor/SELF-HEAL.md +0 -39
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
// ── CommandRouter ──
|
|
2
|
-
export class CommandRouter {
|
|
3
|
-
commands = new Map();
|
|
4
|
-
deps;
|
|
5
|
-
constructor(deps) {
|
|
6
|
-
this.deps = deps;
|
|
7
|
-
}
|
|
8
|
-
register(cmd) {
|
|
9
|
-
this.commands.set(cmd.name, cmd);
|
|
10
|
-
for (const alias of cmd.aliases) {
|
|
11
|
-
this.commands.set(alias, cmd);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
getCommands() {
|
|
15
|
-
const seen = new Set();
|
|
16
|
-
const result = [];
|
|
17
|
-
for (const cmd of this.commands.values()) {
|
|
18
|
-
if (!seen.has(cmd.name)) {
|
|
19
|
-
seen.add(cmd.name);
|
|
20
|
-
result.push(cmd);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return result;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* 尝试处理消息。返回 true 表示已拦截(不需要送 Loid)。
|
|
27
|
-
*/
|
|
28
|
-
async tryHandle(message) {
|
|
29
|
-
const parsed = this.parseCommand(message);
|
|
30
|
-
if (!parsed)
|
|
31
|
-
return false;
|
|
32
|
-
const { commandName, args } = parsed;
|
|
33
|
-
const cmd = this.commands.get(commandName);
|
|
34
|
-
if (!cmd)
|
|
35
|
-
return false;
|
|
36
|
-
const logger = this.deps.logger;
|
|
37
|
-
logger?.info(`[CommandRouter] 匹配命令: /${cmd.name} (category: ${cmd.category})`);
|
|
38
|
-
// pass-through:标记 metadata 后继续送 Loid
|
|
39
|
-
if (cmd.category === 'pass-through') {
|
|
40
|
-
if (!message.metadata)
|
|
41
|
-
message.metadata = {};
|
|
42
|
-
message.metadata._command = cmd.name;
|
|
43
|
-
message.metadata._commandArgs = args;
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
// intercepted / control:执行 handler 并直接回复
|
|
47
|
-
try {
|
|
48
|
-
const ctx = {
|
|
49
|
-
message,
|
|
50
|
-
args,
|
|
51
|
-
db: this.deps.db,
|
|
52
|
-
broker: this.deps.broker,
|
|
53
|
-
router: this,
|
|
54
|
-
onRestart: this.deps.onRestart,
|
|
55
|
-
};
|
|
56
|
-
const result = await cmd.handler(ctx);
|
|
57
|
-
if (result) {
|
|
58
|
-
await this.sendResponse(message, result);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
catch (err) {
|
|
62
|
-
logger?.error(`[CommandRouter] 命令执行失败 (/${cmd.name}):`, err);
|
|
63
|
-
await this.sendResponse(message, {
|
|
64
|
-
text: `命令执行出错: ${err instanceof Error ? err.message : String(err)}`,
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* 解析消息中的命令名和参数。
|
|
71
|
-
* 群聊需要 mentionsAnya,私聊直接匹配。
|
|
72
|
-
*/
|
|
73
|
-
parseCommand(message) {
|
|
74
|
-
let text = message.content.trim();
|
|
75
|
-
// 群聊:需要 @Anya
|
|
76
|
-
if (!message.isDirectMessage) {
|
|
77
|
-
if (!message.mentionsAnya)
|
|
78
|
-
return null;
|
|
79
|
-
// 去掉 @mention 前缀(飞书格式通常是 @_user_1 或已被替换为空)
|
|
80
|
-
text = text.replace(/^@\S+\s*/, '').trim();
|
|
81
|
-
}
|
|
82
|
-
// 匹配 /command 格式
|
|
83
|
-
const slashMatch = text.match(/^\/(\S+)(?:\s+(.*))?$/s);
|
|
84
|
-
if (slashMatch) {
|
|
85
|
-
return { commandName: slashMatch[1].toLowerCase(), args: (slashMatch[2] ?? '').trim() };
|
|
86
|
-
}
|
|
87
|
-
// 裸词匹配:仅对已注册命令名/别名生效
|
|
88
|
-
const firstWord = text.split(/\s+/)[0]?.toLowerCase();
|
|
89
|
-
if (firstWord && this.commands.has(firstWord)) {
|
|
90
|
-
const rest = text.slice(firstWord.length).trim();
|
|
91
|
-
return { commandName: firstWord, args: rest };
|
|
92
|
-
}
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
async sendResponse(message, result) {
|
|
96
|
-
const sender = this.deps.feishuSender;
|
|
97
|
-
const messageId = message.metadata?.message_id;
|
|
98
|
-
try {
|
|
99
|
-
if (messageId) {
|
|
100
|
-
await sender.sendReply({ text: result.text, replyToMessageId: messageId });
|
|
101
|
-
}
|
|
102
|
-
else if (message.chatId) {
|
|
103
|
-
await sender.sendText({ receiveIdType: 'chat_id', receiveId: message.chatId, text: result.text });
|
|
104
|
-
}
|
|
105
|
-
else if (message.sender) {
|
|
106
|
-
await sender.sendText({ receiveIdType: 'open_id', receiveId: message.sender, text: result.text });
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
catch (err) {
|
|
110
|
-
this.deps.logger?.error('[CommandRouter] 发送回复失败:', err);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
//# sourceMappingURL=command-router.js.map
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { getTask, updateTask, insertAuditEvent } from '@team-anya/db';
|
|
2
|
-
import { TaskStatus, validateTransition } from '@team-anya/core';
|
|
3
|
-
export const cancelCommand = {
|
|
4
|
-
name: 'cancel',
|
|
5
|
-
aliases: ['取消'],
|
|
6
|
-
category: 'control',
|
|
7
|
-
description: '取消任务(/cancel <task_id>)',
|
|
8
|
-
handler: async (ctx) => {
|
|
9
|
-
const taskId = ctx.args.trim();
|
|
10
|
-
if (!taskId) {
|
|
11
|
-
return { text: '请指定任务 ID,例如: /cancel ANYA-20260224-001' };
|
|
12
|
-
}
|
|
13
|
-
const task = getTask(ctx.db, taskId);
|
|
14
|
-
if (!task) {
|
|
15
|
-
return { text: `任务 ${taskId} 不存在` };
|
|
16
|
-
}
|
|
17
|
-
const currentStatus = task.status;
|
|
18
|
-
if (!validateTransition(currentStatus, TaskStatus.CANCELLED)) {
|
|
19
|
-
return { text: `任务 ${taskId} 当前状态为 ${currentStatus},无法取消` };
|
|
20
|
-
}
|
|
21
|
-
updateTask(ctx.db, taskId, { status: TaskStatus.CANCELLED });
|
|
22
|
-
insertAuditEvent(ctx.db, {
|
|
23
|
-
event_type: 'command_invoked',
|
|
24
|
-
actor: ctx.message.senderName ?? ctx.message.sender ?? 'unknown',
|
|
25
|
-
summary: `取消任务 ${taskId}`,
|
|
26
|
-
task_id: taskId,
|
|
27
|
-
detail: JSON.stringify({ command: 'cancel', from: currentStatus, to: TaskStatus.CANCELLED }),
|
|
28
|
-
});
|
|
29
|
-
return { text: `任务 ${taskId} 已取消(${currentStatus} → CANCELLED)` };
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=cancel.js.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export const helpCommand = {
|
|
2
|
-
name: 'help',
|
|
3
|
-
aliases: ['h', '帮助'],
|
|
4
|
-
category: 'intercepted',
|
|
5
|
-
description: '显示命令列表',
|
|
6
|
-
handler: async (ctx) => {
|
|
7
|
-
const commands = ctx.router.getCommands();
|
|
8
|
-
const lines = ['📋 可用命令:', ''];
|
|
9
|
-
for (const cmd of commands) {
|
|
10
|
-
const aliases = cmd.aliases.length > 0 ? ` (${cmd.aliases.join(', ')})` : '';
|
|
11
|
-
lines.push(`/${cmd.name}${aliases} — ${cmd.description}`);
|
|
12
|
-
}
|
|
13
|
-
return { text: lines.join('\n') };
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=help.js.map
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { helpCommand } from './help.js';
|
|
2
|
-
import { statusCommand } from './status.js';
|
|
3
|
-
import { tasksCommand } from './tasks.js';
|
|
4
|
-
import { cancelCommand } from './cancel.js';
|
|
5
|
-
import { restartCommand } from './restart.js';
|
|
6
|
-
// pass-through 命令(仅标记 metadata,透传给 Loid)
|
|
7
|
-
const passThrough = (name, description) => ({
|
|
8
|
-
name,
|
|
9
|
-
aliases: [],
|
|
10
|
-
category: 'pass-through',
|
|
11
|
-
description,
|
|
12
|
-
handler: async () => null,
|
|
13
|
-
});
|
|
14
|
-
export function registerBuiltinCommands(router) {
|
|
15
|
-
// 直接处理
|
|
16
|
-
router.register(helpCommand);
|
|
17
|
-
router.register(statusCommand);
|
|
18
|
-
router.register(tasksCommand);
|
|
19
|
-
router.register(cancelCommand);
|
|
20
|
-
router.register(restartCommand);
|
|
21
|
-
// 透传 Loid
|
|
22
|
-
router.register(passThrough('task', '显式创建任务(透传 Loid)'));
|
|
23
|
-
router.register(passThrough('report', '生成报告(透传 Loid)'));
|
|
24
|
-
router.register(passThrough('review', '审核交付(透传 Loid)'));
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export const restartCommand = {
|
|
2
|
-
name: 'restart',
|
|
3
|
-
aliases: ['重启'],
|
|
4
|
-
category: 'control',
|
|
5
|
-
description: '重启所有 Claude Code 实例(安装 skills 后需要重启生效)',
|
|
6
|
-
handler: async (ctx) => {
|
|
7
|
-
if (!ctx.onRestart) {
|
|
8
|
-
return { text: '重启功能未配置' };
|
|
9
|
-
}
|
|
10
|
-
// 列出当前实例
|
|
11
|
-
const instances = ctx.broker.status();
|
|
12
|
-
const activeCount = instances.filter(i => i.state !== 'disposed').length;
|
|
13
|
-
if (activeCount === 0) {
|
|
14
|
-
return { text: '当前没有活跃的 CC 实例,无需重启' };
|
|
15
|
-
}
|
|
16
|
-
// 检查正在执行任务的 Yor 实例
|
|
17
|
-
const executingYor = instances.filter(i => i.role === 'yor' && i.state === 'executing');
|
|
18
|
-
let warning = '';
|
|
19
|
-
if (executingYor.length > 0) {
|
|
20
|
-
const taskIds = executingYor.map(i => i.taskId ?? i.id).join(', ');
|
|
21
|
-
warning = `\n\n⚠️ 注意: ${executingYor.length} 个 Yor 实例正在执行任务 (${taskIds}),已强制终止`;
|
|
22
|
-
}
|
|
23
|
-
const result = await ctx.onRestart();
|
|
24
|
-
const lines = [
|
|
25
|
-
'🔄 CC 实例已全部重启',
|
|
26
|
-
'',
|
|
27
|
-
`已释放实例: ${result.disposed} 个`,
|
|
28
|
-
'Loid 会话将在下次收到消息时自动重建',
|
|
29
|
-
'Yor 实例将在下次派工时重新创建',
|
|
30
|
-
];
|
|
31
|
-
return { text: lines.join('\n') + warning };
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=restart.js.map
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { getTaskCountByStatus } from '@team-anya/db';
|
|
2
|
-
export const statusCommand = {
|
|
3
|
-
name: 'status',
|
|
4
|
-
aliases: ['s', '状态'],
|
|
5
|
-
category: 'intercepted',
|
|
6
|
-
description: '系统状态概览',
|
|
7
|
-
handler: async (ctx) => {
|
|
8
|
-
const counts = getTaskCountByStatus(ctx.db);
|
|
9
|
-
const total = Object.values(counts).reduce((a, b) => a + b, 0);
|
|
10
|
-
const yorInstances = ctx.broker.getInstancesByRole('yor');
|
|
11
|
-
const activeYorCount = yorInstances.length;
|
|
12
|
-
const lines = ['📊 系统状态', ''];
|
|
13
|
-
lines.push(`任务总数: ${total}`);
|
|
14
|
-
if (total > 0) {
|
|
15
|
-
const statusLabels = {
|
|
16
|
-
NEW: '新建',
|
|
17
|
-
NEED_CLARIFICATION: '待澄清',
|
|
18
|
-
READY: '就绪',
|
|
19
|
-
IN_PROGRESS: '执行中',
|
|
20
|
-
DELIVERING: '交付中',
|
|
21
|
-
DONE: '已完成',
|
|
22
|
-
BLOCKED: '已阻塞',
|
|
23
|
-
CANCELLED: '已取消',
|
|
24
|
-
};
|
|
25
|
-
for (const [status, count] of Object.entries(counts)) {
|
|
26
|
-
const label = statusLabels[status] ?? status;
|
|
27
|
-
lines.push(` ${label}: ${count}`);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
lines.push(`\n活跃 Yor 实例: ${activeYorCount}`);
|
|
31
|
-
return { text: lines.join('\n') };
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=status.js.map
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { getAllTasks, getTasksByChatId, getTasksByStatus } from '@team-anya/db';
|
|
2
|
-
const MAX_DISPLAY = 15;
|
|
3
|
-
export const tasksCommand = {
|
|
4
|
-
name: 'tasks',
|
|
5
|
-
aliases: ['t', '任务'],
|
|
6
|
-
category: 'intercepted',
|
|
7
|
-
description: '任务列表(支持状态过滤:/tasks in_progress)',
|
|
8
|
-
handler: async (ctx) => {
|
|
9
|
-
const statusFilter = ctx.args.toUpperCase().trim();
|
|
10
|
-
let taskList;
|
|
11
|
-
if (statusFilter) {
|
|
12
|
-
taskList = getTasksByStatus(ctx.db, statusFilter);
|
|
13
|
-
}
|
|
14
|
-
else if (!ctx.message.isDirectMessage && ctx.message.chatId) {
|
|
15
|
-
taskList = getTasksByChatId(ctx.db, ctx.message.chatId);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
taskList = getAllTasks(ctx.db);
|
|
19
|
-
}
|
|
20
|
-
if (taskList.length === 0) {
|
|
21
|
-
const hint = statusFilter ? `(状态: ${statusFilter})` : '';
|
|
22
|
-
return { text: `暂无任务${hint}` };
|
|
23
|
-
}
|
|
24
|
-
const displayed = taskList.slice(0, MAX_DISPLAY);
|
|
25
|
-
const lines = [`📝 任务列表(共 ${taskList.length} 条${taskList.length > MAX_DISPLAY ? `,显示前 ${MAX_DISPLAY} 条` : ''}):`, ''];
|
|
26
|
-
for (const task of displayed) {
|
|
27
|
-
const status = task.status.padEnd(18);
|
|
28
|
-
lines.push(`${task.task_id} ${status} ${task.title ?? '(无标题)'}`);
|
|
29
|
-
}
|
|
30
|
-
return { text: lines.join('\n') };
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=tasks.js.map
|