accounting_automation: этап 1 бухгалтерской автоматизации (инвойсы из почты, категоризация, ручной разбор, MCP), интервальные задания scheduler, миграции 033/034/038
All checks were successful
ci / test (push) Successful in 40s
ci / deploy (push) Successful in 2m41s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 08:05:28 +03:00
parent 12e331efe9
commit b422309148
62 changed files with 4278 additions and 148 deletions

View File

@@ -26,6 +26,11 @@
{ name: "sync_events_1700", call: { service: "data_collector", method: "POST", path: "/events/sync" }, at: "17:00", days: "daily" },
{ name: "sync_events_2100", call: { service: "data_collector", method: "POST", path: "/events/sync" }, at: "21:00", days: "daily" },
{ name: "sync_events_2355", call: { service: "data_collector", method: "POST", path: "/events/sync" }, at: "23:55", days: "daily" },
// бухгалтерская автоматизация (accounting_automation, процессы quickbooks_bookkeeper)
{ name: "acc_invoices_mail", call: { service: "accounting_automation", method: "POST", path: "/jobs/invoices-mail" }, everyMinutes: 15, days: "daily" },
{ name: "acc_finalize", call: { service: "accounting_automation", method: "POST", path: "/jobs/finalize" }, everyMinutes: 1, days: "daily" },
{ name: "acc_categorize", call: { service: "accounting_automation", method: "POST", path: "/jobs/categorize" }, at: "06:30", days: "daily" },
{ name: "acc_summary", call: { service: "accounting_automation", method: "POST", path: "/jobs/summary" }, at: "03:00", days: "workdays" }, // 10:00 по Кипру (зимой)
{ name: "retention", call: { service: "data_collector", method: "POST", path: "/retention/run" }, at: "03:30", days: "daily" },
],
services: {
@@ -98,4 +103,15 @@
redirectUri: "https://services.khbuild.freeddns.org/api/qbo/callback", // тот же адрес - в Redirect URIs приложения
encryptionKey: "<64 hex-символа: openssl rand -hex 32>", // ключ шифрования токенов в БД
},
accounting_automation: { // бухгалтерия QuickBooks: инвойсы из почты, категоризация (claude -p), ручной разбор, MCP (services.khbuild.freeddns.org/api/acc/mcp)
http: { host: "0.0.0.0", port: 8096, token: "***" },
claude: { bin: "claude", workDir: "/data/agents/accounting", timeoutMs: 900000, sqlUrl: "postgres://khb_agent_acc:...@supabase-db:5432/postgres" },
// prompt: { driveDocId: "<id документа Google Docs с промптом>" }, // по умолчанию документ «Промпт категоризации банковских операций»
google: { client_email: "...", private_key: "***", gmailUser: "invoices@khbuild.pro", rootFolderId: "<папка Google Drive для документов бухгалтерии>" },
slack: { botToken: "***", accountingChannelId: "<канал бухгалтерии>" },
approvalThresholdUsd: 5000,
reviewers: [{ personId: "<person.id Анастасии>", roles: ["accountant", "cfo"] }], // кто какие роли очереди закрывает
mcp: { enabled: true, publicUrl: "https://services.khbuild.freeddns.org/api/acc", issuer: "https://keycloak.khbuild.freeddns.org/realms/khbuild", staticTokens: [] },
},
}