Чтение зеркала Supabase агентами (khb-sql, роли khb_agent / khb_agent_ceo, KHB_SQL_URL); отчёты для агента руководителя; промты; тесты; docs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -182,13 +182,14 @@ d("консольные агенты (временная БД, фейковый
|
||||
isActive: () => active, activeSession: () => (active ? lastSid : null), close: () => { active = false; }, closeAll: () => undefined, activeCount: () => (active ? 1 : 0),
|
||||
};
|
||||
const base = ctx();
|
||||
const liveCtx = { ...base, liveRunner, settings: { ...base.settings, live: { managerIds: [MGR], idleMinutes: 10, warmupSeconds: 0 } } };
|
||||
const liveCtx = { ...base, liveRunner, settings: { ...base.settings, live: { managerIds: [MGR], idleMinutes: 10, warmupSeconds: 0 }, sql: { agentUrl: "postgres://ro-agent", ceoUrl: "postgres://ro-ceo" } } };
|
||||
const slack = { postMessage: async () => true, fileInfo: async () => null, download: async () => 0 };
|
||||
const mgr = { personId: MGR, name: "llmtest-Manager", slackUserId: "ULLMTEST", slackChannelId: "CLLMTEST" };
|
||||
const msg = (text: string, ts: string) => [{ channel: "CLLMTEST", ts, text, fileIds: [] }];
|
||||
await handleManagerMessages({ ctx: liveCtx, timezone: "America/New_York", slack, dryPublish: true }, mgr, msg("первое сообщение", "1791741300.000001"));
|
||||
await handleManagerMessages({ ctx: liveCtx, timezone: "America/New_York", slack, dryPublish: true }, mgr, msg("второе сообщение", "1791741310.000001"));
|
||||
expect(calls).toHaveLength(0); // прежний раннер не использовался
|
||||
expect(liveCalls[0]!.env).toEqual({ KHB_SQL_URL: "postgres://ro-agent" }); // чтение Supabase: роль менеджеров
|
||||
expect(liveCalls).toHaveLength(2);
|
||||
expect(liveCalls[0]!.prompt).toContain("# Память");
|
||||
expect(liveCalls[0]!.prompt).toContain("JobTread недоступен или запись не проходит");
|
||||
@@ -476,7 +477,7 @@ d("консольные агенты (временная БД, фейковый
|
||||
isActive: () => false, activeSession: () => null, close: () => undefined, closeAll: () => undefined, activeCount: () => 0,
|
||||
};
|
||||
const base = ctx();
|
||||
const ceoCtx = { ...base, liveRunner, settings: { ...base.settings, live: { managerIds: [MGR], idleMinutes: 10, warmupSeconds: 0 } } };
|
||||
const ceoCtx = { ...base, liveRunner, settings: { ...base.settings, live: { managerIds: [MGR], idleMinutes: 10, warmupSeconds: 0 }, sql: { agentUrl: "postgres://ro-agent", ceoUrl: "postgres://ro-ceo" } } };
|
||||
const posted: string[] = [];
|
||||
const slack = { postMessage: async (_c: string, x: string) => { posted.push(x); return true; }, fileInfo: async () => null, download: async () => 0 };
|
||||
const ceo = { personId: MGR, name: "Arthur Atanoff", slackUserId: "ULLMTEST", slackChannelId: "CLLMTEST", chatKind: "ceo" as const };
|
||||
@@ -488,6 +489,7 @@ d("консольные агенты (временная БД, фейковый
|
||||
expect(p).not.toContain("# Список задач на сегодня");
|
||||
expect(p).toContain("# Память");
|
||||
expect(p).toContain("what is overdue?");
|
||||
expect(liveCalls[0]!.env).toEqual({ KHB_SQL_URL: "postgres://ro-ceo" }); // чтение Supabase: роль руководителя
|
||||
});
|
||||
it("API агентов: память читается и пишется с аудитом, сброс сессии, история", async () => {
|
||||
const app = buildApi({ pool: db.pool, token: "t", run: async () => { throw new Error("не нужен"); } });
|
||||
|
||||
Reference in New Issue
Block a user