Шаг 4: история напоминаний, запрос "что-то ещё" по таймеру, язык ответа; тесты; docs/proposed
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -144,6 +144,38 @@ d("консольные агенты (временная БД, фейковый
|
||||
expect(run.rows[0].changes).toContain("createDailyLog");
|
||||
});
|
||||
|
||||
it("событие ассистента: напоминание пишется в историю, ответ менеджера закрывает его; через followup агент спрашивает `что-то ещё`", async () => {
|
||||
calls = [];
|
||||
const posted: string[] = [];
|
||||
script = [
|
||||
ok("## Ответ менеджеру\nПривет! Как дела на объекте? llmtest\n## Память\nм6"),
|
||||
ok("## Ответ менеджеру\nСпасибо! llmtest\n## Память\nм7"),
|
||||
ok("## Ответ менеджеру\nЧто-то ещё по llmtest-job?\n## Память\nм8"),
|
||||
];
|
||||
const deps = {
|
||||
ctx: ctx(), timezone: "America/New_York",
|
||||
slack: { postMessage: async (_c: string, t: string) => { posted.push(t); return true; }, fileInfo: async () => null, download: async () => 0 },
|
||||
};
|
||||
const mgr = { personId: MGR, name: "llmtest-Manager", slackUserId: "ULLMTEST", slackChannelId: "CLLMTEST" };
|
||||
await handleManagerMessages(deps, mgr, [], { systemEvent: "12:00" });
|
||||
const r1 = await db.pool.query("select reminder_text, reply_at from reminder_history where reminder_text like '%llmtest%'");
|
||||
expect(r1.rows).toHaveLength(1);
|
||||
expect(r1.rows[0].reply_at).toBeNull();
|
||||
expect(calls[0]!.prompt).toContain("# Системное событие");
|
||||
|
||||
const intake = new SlackIntake(deps, { channelIds: ["CLLMTEST"], debounceMs: 600_000, followupMs: 300 });
|
||||
await intake.onEvent({ type: "message", channel: "CLLMTEST", user: "ULLMTEST", ts: "2.1", text: "делаю, всё идёт хорошо" });
|
||||
await intake.flush(MGR);
|
||||
const r2 = await db.pool.query("select reply_summary, reply_outcome from reminder_history where reminder_text like '%llmtest%'");
|
||||
expect(r2.rows[0]).toEqual({ reply_summary: "делаю, всё идёт хорошо", reply_outcome: "other" });
|
||||
await new Promise((r) => setTimeout(r, 1500)); // сработал followup
|
||||
await intake.idle();
|
||||
intake.stop();
|
||||
expect(calls).toHaveLength(3);
|
||||
expect(calls[2]!.prompt).toContain("Что-то ещё по");
|
||||
expect(posted[posted.length - 1]).toContain("Что-то ещё");
|
||||
});
|
||||
|
||||
it("приём события Slack: фильтры, дубли, накопление и запуск шага 4", async () => {
|
||||
calls = [];
|
||||
const posted: string[] = [];
|
||||
|
||||
Reference in New Issue
Block a user