Чтение зеркала Supabase агентами (khb-sql, роли khb_agent / khb_agent_ceo, KHB_SQL_URL); отчёты для агента руководителя; промты; тесты; docs
All checks were successful
ci / test (push) Successful in 23s
ci / deploy (push) Successful in 3m24s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-21 11:50:22 +03:00
parent 77b6e4ae3b
commit 00bf1cdd39
18 changed files with 246 additions and 7 deletions

View File

@@ -249,6 +249,9 @@ export async function handleManagerMessages(
if (freqText) freqBlocks.push("", `# Частота сообщений\n${freqText}`);
}
const isCeo = manager.chatKind === "ceo";
// чтение зеркала Supabase: агент менеджера - роль khb_agent, руководитель - khb_agent_ceo (команда khb-sql, Bash)
const sqlCfg = ctx.settings.sql;
const sqlEnv = sqlCfg ? { KHB_SQL_URL: isCeo ? (sqlCfg.ceoUrl ?? sqlCfg.agentUrl) : sqlCfg.agentUrl } : undefined;
const replyKey = isCeo ? "ответ arthur" : "ответ менеджеру";
const listText = isCeo ? "" : await todayList(ctx, manager.personId, today);
const buildPrompt = (dialog: boolean): string => [
@@ -280,7 +283,7 @@ export async function handleManagerMessages(
// 4. агент
let out;
try {
out = await runManagerAgent(ctx, { managerId: manager.personId, step: "step4", tools: "chat", prompt, fullPrompt, required: [replyKey, "память"] });
out = await runManagerAgent(ctx, { managerId: manager.personId, step: "step4", tools: "chat", prompt, fullPrompt, env: sqlEnv, required: [replyKey, "память"] });
tm.agent = out.timing;
mark = Date.now();
} catch (e) {