Google Drive под ключами сервисных аккаунтов вместо rclone: клиент Drive API, папка приёма и выгрузка материалов; команда khb-drive для агентов (builder - строителям и проектным чатам, полный - руководителю); rclone удалён; промты; тесты
All checks were successful
ci / test (push) Successful in 25s
ci / deploy (push) Successful in 3m13s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-22 09:41:33 +03:00
parent c1f7c7b269
commit bfce62d66f
22 changed files with 805 additions and 103 deletions

View File

@@ -51,6 +51,8 @@ export interface ChatDeps {
tts?: Tts;
defaultVoice?: string;
drive?: DriveSync;
/** Ключи сервисных аккаунтов Google (JSON) для агентов: full - руководитель, builder - строители и проектные чаты. */
driveKeys?: { full?: string; builder?: string };
timezone: string;
now?: () => Date;
/** Тест: не слать ответ в Slack. */
@@ -251,7 +253,12 @@ export async function handleManagerMessages(
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 driveKey = isCeo ? deps.driveKeys?.full : deps.driveKeys?.builder; // Google Drive: руководитель - полный ключ, остальные (включая проектные чаты) - builder
const agentEnv: Record<string, string> = {
...(sqlCfg ? { KHB_SQL_URL: isCeo ? (sqlCfg.ceoUrl ?? sqlCfg.agentUrl) : sqlCfg.agentUrl } : {}),
...(driveKey ? { KHB_DRIVE_KEY: driveKey } : {}),
};
const sqlEnv = Object.keys(agentEnv).length ? agentEnv : undefined;
const replyKey = isCeo ? "ответ arthur" : "ответ менеджеру";
const listText = isCeo ? "" : await todayList(ctx, manager.personId, today);
const buildPrompt = (dialog: boolean): string => [