accounting_automation, этап 2 (часть A): роль cfo по сумме, флажки fraud, проверка и оплата инвойсов

- approval.ts: роль подтверждающего при создании задачи категоризации (порог approvalThresholdUsd, первая оплата вендору)
- fraud.ts: красные флажки по картам (первая оплата, рост суммы от медианы), задание fraud-flags
- invoice-check.ts: заключение по инвойсу и задача invoice_approval; задание invoice-check
- invoice-paid.ts: markPaid и задание invoice-paid (paid_on, paid_amount контракта)
- MCP: acc_invoice_to_approve, acc_invoice_decide; миграция 041; документы proposed

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-23 16:44:33 +03:00
parent f636836f47
commit 9f8bf1932f
21 changed files with 902 additions and 20 deletions

View File

@@ -295,7 +295,7 @@ d("MCP бухгалтерии (временная БД)", () => {
expect(((await post(bearer(TOKEN_A), rpc("ping"))).json()).result).toEqual({ resultType: "complete" });
const l = (await post(bearer(TOKEN_A), rpc("tools/list"))).json();
expect(l.result.tools.map((t: { name: string }) => t.name)).toEqual([
"acc_review_list", "acc_review_get", "acc_review_update", "acc_review_done", "acc_review_handoff", "acc_review_return", "acc_review_batch", "acc_review_snooze",
"acc_review_list", "acc_review_get", "acc_review_update", "acc_review_done", "acc_review_handoff", "acc_review_return", "acc_review_batch", "acc_review_snooze", "acc_invoice_to_approve", "acc_invoice_decide",
]);
const tl = l.result.tools as Array<{ name: string; annotations?: { readOnlyHint?: boolean }; _meta?: { ui?: { resourceUri?: string } } }>;
expect(tl.find((t) => t.name === "acc_review_list")?.annotations?.readOnlyHint).toBe(true);