acc_invoices: журнал без зависания (Proxy вместо подмены query), общий журнал /api/log, MCP-инструменты acc_inv_* (все функции WebUI и анализ журнала)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,8 @@ import { REVIEW_UI_HTML, REVIEW_UI_MIME, REVIEW_UI_URI, REVIEW_UI_URI_LEGACY, ro
|
||||
import { allowWithoutReceipt } from "./receipt-search.js";
|
||||
import type { AccountingSettings } from "./settings.js";
|
||||
import { Stage2Tools } from "./stage2-tools.js";
|
||||
import { AccInvoicesTools } from "./acc-invoices-tools.js";
|
||||
import { ACC_INV_TOOLS, ACC_INV_TOOL_NAMES } from "./acc-invoices-tool-defs.js";
|
||||
import { STAGE2_TOOL_NAMES, STAGE2_TOOLS } from "./stage2-tool-defs.js";
|
||||
|
||||
/**
|
||||
@@ -22,7 +24,7 @@ export class McpToolError extends Error {}
|
||||
|
||||
export interface ReviewDeps {
|
||||
pool: Pool;
|
||||
settings: Pick<AccountingSettings, "reviewers"> & { receipts?: { qboBankingUrl?: string } };
|
||||
settings: Pick<AccountingSettings, "reviewers"> & { receipts?: { qboBankingUrl?: string }; accInvoices?: { url: string; internalToken?: string } };
|
||||
/** Лимит расхода без чека (USD), по умолчанию 500. */
|
||||
noReceiptLimitUsd?: number;
|
||||
now?: () => Date;
|
||||
@@ -148,8 +150,10 @@ const metaOf = (t: Pick<Task, "kind">): KindMeta | undefined => KINDS[t.kind];
|
||||
export class ReviewTools {
|
||||
private readonly now: () => Date;
|
||||
private readonly stage2: Stage2Tools;
|
||||
private readonly accInv: AccInvoicesTools;
|
||||
constructor(private readonly d: ReviewDeps) {
|
||||
this.now = d.now ?? (() => new Date());
|
||||
this.accInv = new AccInvoicesTools(d.settings.accInvoices);
|
||||
this.stage2 = new Stage2Tools({ pool: d.pool, rolesOf: (p) => this.rolesOf(p), now: this.now });
|
||||
}
|
||||
|
||||
@@ -566,6 +570,7 @@ export class ReviewTools {
|
||||
case "acc_receipt_allow_without": return this.allowWithoutReceipt(personId, a);
|
||||
default:
|
||||
if (STAGE2_TOOL_NAMES.has(name)) return this.stage2.call(personId, name, a);
|
||||
if (ACC_INV_TOOL_NAMES.has(name)) return this.accInv.call(personId, name, a);
|
||||
throw new McpToolError(`Неизвестный инструмент ${name}`);
|
||||
}
|
||||
}
|
||||
@@ -681,6 +686,7 @@ export const TOOLS: { name: string; description: string; inputSchema: Json; anno
|
||||
),
|
||||
},
|
||||
...STAGE2_TOOLS,
|
||||
...ACC_INV_TOOLS,
|
||||
];
|
||||
|
||||
/** Встроенный текст инструкций (копия: docs/.../p-mcp-instructions.md; сервис подставляет файл, если он доступен). */
|
||||
|
||||
Reference in New Issue
Block a user