e-arveldaja-mcp 0.25.7 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/import-wise.md +5 -5
- package/.claude/commands/lightyear-booking.md +5 -4
- package/CHANGELOG.md +84 -0
- package/CLAUDE.md +22 -6
- package/dist/account-resolution.d.ts +12 -0
- package/dist/account-resolution.d.ts.map +1 -1
- package/dist/account-resolution.js +13 -1
- package/dist/account-resolution.js.map +1 -1
- package/dist/accounting-defaults.d.ts +7 -0
- package/dist/accounting-defaults.d.ts.map +1 -1
- package/dist/accounting-defaults.js +7 -0
- package/dist/accounting-defaults.js.map +1 -1
- package/dist/accounting-rules.d.ts +40 -3
- package/dist/accounting-rules.d.ts.map +1 -1
- package/dist/accounting-rules.js +93 -19
- package/dist/accounting-rules.js.map +1 -1
- package/dist/api/base-resource.d.ts +13 -0
- package/dist/api/base-resource.d.ts.map +1 -1
- package/dist/api/base-resource.js +15 -0
- package/dist/api/base-resource.js.map +1 -1
- package/dist/api/journals.api.d.ts +0 -11
- package/dist/api/journals.api.d.ts.map +1 -1
- package/dist/api/journals.api.js +0 -13
- package/dist/api/journals.api.js.map +1 -1
- package/dist/api/purchase-invoices.api.d.ts.map +1 -1
- package/dist/api/purchase-invoices.api.js +47 -4
- package/dist/api/purchase-invoices.api.js.map +1 -1
- package/dist/api/transactions.api.d.ts +40 -7
- package/dist/api/transactions.api.d.ts.map +1 -1
- package/dist/api/transactions.api.js +90 -24
- package/dist/api/transactions.api.js.map +1 -1
- package/dist/audit-log.d.ts +13 -3
- package/dist/audit-log.d.ts.map +1 -1
- package/dist/audit-log.js +73 -9
- package/dist/audit-log.js.map +1 -1
- package/dist/bank-posting-duplicate-guard.d.ts +2 -1
- package/dist/bank-posting-duplicate-guard.d.ts.map +1 -1
- package/dist/bank-posting-duplicate-guard.js +4 -2
- package/dist/bank-posting-duplicate-guard.js.map +1 -1
- package/dist/bank-transaction-direction.d.ts +18 -0
- package/dist/bank-transaction-direction.d.ts.map +1 -1
- package/dist/bank-transaction-direction.js +26 -1
- package/dist/bank-transaction-direction.js.map +1 -1
- package/dist/banking/reconciliation/executor.d.ts.map +1 -1
- package/dist/banking/reconciliation/executor.js +94 -48
- package/dist/banking/reconciliation/executor.js.map +1 -1
- package/dist/banking/reconciliation/match-score.d.ts.map +1 -1
- package/dist/banking/reconciliation/match-score.js +11 -1
- package/dist/banking/reconciliation/match-score.js.map +1 -1
- package/dist/banking/reconciliation/presenter.d.ts.map +1 -1
- package/dist/banking/reconciliation/presenter.js +6 -2
- package/dist/banking/reconciliation/presenter.js.map +1 -1
- package/dist/banking/reconciliation/projection.d.ts.map +1 -1
- package/dist/banking/reconciliation/projection.js +5 -0
- package/dist/banking/reconciliation/projection.js.map +1 -1
- package/dist/banking/reconciliation/types.d.ts +7 -1
- package/dist/banking/reconciliation/types.d.ts.map +1 -1
- package/dist/booking-guard.d.ts +15 -0
- package/dist/booking-guard.d.ts.map +1 -1
- package/dist/booking-guard.js +22 -1
- package/dist/booking-guard.js.map +1 -1
- package/dist/camt/duplicate-identity.d.ts +2 -0
- package/dist/camt/duplicate-identity.d.ts.map +1 -1
- package/dist/camt/duplicate-identity.js +27 -23
- package/dist/camt/duplicate-identity.js.map +1 -1
- package/dist/camt/executor.d.ts +3 -1
- package/dist/camt/executor.d.ts.map +1 -1
- package/dist/camt/executor.js +35 -9
- package/dist/camt/executor.js.map +1 -1
- package/dist/camt/operations.d.ts +4 -0
- package/dist/camt/operations.d.ts.map +1 -1
- package/dist/camt/operations.js +18 -6
- package/dist/camt/operations.js.map +1 -1
- package/dist/camt/presenter.d.ts.map +1 -1
- package/dist/camt/presenter.js +7 -9
- package/dist/camt/presenter.js.map +1 -1
- package/dist/camt/projection.d.ts.map +1 -1
- package/dist/camt/projection.js +20 -3
- package/dist/camt/projection.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +75 -41
- package/dist/config.js.map +1 -1
- package/dist/documents/operations.d.ts.map +1 -1
- package/dist/documents/operations.js +83 -8
- package/dist/documents/operations.js.map +1 -1
- package/dist/documents/types.d.ts +4 -0
- package/dist/documents/types.d.ts.map +1 -1
- package/dist/external-text-renderer.d.ts.map +1 -1
- package/dist/external-text-renderer.js +7 -1
- package/dist/external-text-renderer.js.map +1 -1
- package/dist/file-lock.d.ts.map +1 -1
- package/dist/file-lock.js +56 -34
- package/dist/file-lock.js.map +1 -1
- package/dist/file-validation.d.ts +14 -0
- package/dist/file-validation.d.ts.map +1 -1
- package/dist/file-validation.js +46 -3
- package/dist/file-validation.js.map +1 -1
- package/dist/guided/manage-sale-invoice.js +3 -3
- package/dist/guided/manage-sale-invoice.js.map +1 -1
- package/dist/guided/process-accounting-document.d.ts.map +1 -1
- package/dist/guided/process-accounting-document.js +3 -0
- package/dist/guided/process-accounting-document.js.map +1 -1
- package/dist/guided/run-accounting-report.d.ts.map +1 -1
- package/dist/guided/run-accounting-report.js +22 -14
- package/dist/guided/run-accounting-report.js.map +1 -1
- package/dist/invoice-extraction-fallback.d.ts +6 -0
- package/dist/invoice-extraction-fallback.d.ts.map +1 -1
- package/dist/invoice-extraction-fallback.js +2 -0
- package/dist/invoice-extraction-fallback.js.map +1 -1
- package/dist/local-date.d.ts +3 -0
- package/dist/local-date.d.ts.map +1 -0
- package/dist/local-date.js +14 -0
- package/dist/local-date.js.map +1 -0
- package/dist/mcp-json.d.ts.map +1 -1
- package/dist/mcp-json.js +5 -1
- package/dist/mcp-json.js.map +1 -1
- package/dist/money.d.ts +23 -0
- package/dist/money.d.ts.map +1 -1
- package/dist/money.js +22 -0
- package/dist/money.js.map +1 -1
- package/dist/opening-balance-limitations.d.ts.map +1 -1
- package/dist/opening-balance-limitations.js +6 -0
- package/dist/opening-balance-limitations.js.map +1 -1
- package/dist/opening-balance-store.d.ts +13 -0
- package/dist/opening-balance-store.d.ts.map +1 -1
- package/dist/opening-balance-store.js +51 -16
- package/dist/opening-balance-store.js.map +1 -1
- package/dist/prompt-registry.js +1 -1
- package/dist/prompt-registry.js.map +1 -1
- package/dist/purchase-invoice-status.d.ts +7 -0
- package/dist/purchase-invoice-status.d.ts.map +1 -0
- package/dist/purchase-invoice-status.js +20 -0
- package/dist/purchase-invoice-status.js.map +1 -0
- package/dist/receipts/batch-operations.d.ts.map +1 -1
- package/dist/receipts/batch-operations.js +4 -1
- package/dist/receipts/batch-operations.js.map +1 -1
- package/dist/receipts/classification-operations.d.ts.map +1 -1
- package/dist/receipts/classification-operations.js +8 -0
- package/dist/receipts/classification-operations.js.map +1 -1
- package/dist/reporting/operations.d.ts.map +1 -1
- package/dist/reporting/operations.js +24 -85
- package/dist/reporting/operations.js.map +1 -1
- package/dist/reporting/types.d.ts +23 -10
- package/dist/reporting/types.d.ts.map +1 -1
- package/dist/resolution/supplier-default-resolution.d.ts +5 -0
- package/dist/resolution/supplier-default-resolution.d.ts.map +1 -1
- package/dist/resolution/supplier-default-resolution.js +37 -13
- package/dist/resolution/supplier-default-resolution.js.map +1 -1
- package/dist/sales/invoice-operations.d.ts.map +1 -1
- package/dist/sales/invoice-operations.js +31 -6
- package/dist/sales/invoice-operations.js.map +1 -1
- package/dist/server/create-server.d.ts.map +1 -1
- package/dist/server/create-server.js +5 -2
- package/dist/server/create-server.js.map +1 -1
- package/dist/server/register-system-tools.d.ts.map +1 -1
- package/dist/server/register-system-tools.js +10 -2
- package/dist/server/register-system-tools.js.map +1 -1
- package/dist/statement-balance-check.d.ts +8 -0
- package/dist/statement-balance-check.d.ts.map +1 -1
- package/dist/statement-balance-check.js +3 -0
- package/dist/statement-balance-check.js.map +1 -1
- package/dist/statement-balance-store.d.ts +6 -0
- package/dist/statement-balance-store.d.ts.map +1 -1
- package/dist/statement-balance-store.js +57 -19
- package/dist/statement-balance-store.js.map +1 -1
- package/dist/tool-catalog.js +1 -1
- package/dist/tool-catalog.js.map +1 -1
- package/dist/tools/accounting-inbox-autopilot-service.d.ts +3 -1
- package/dist/tools/accounting-inbox-autopilot-service.d.ts.map +1 -1
- package/dist/tools/accounting-inbox-autopilot-service.js +52 -9
- package/dist/tools/accounting-inbox-autopilot-service.js.map +1 -1
- package/dist/tools/accounting-inbox.d.ts.map +1 -1
- package/dist/tools/accounting-inbox.js +167 -15
- package/dist/tools/accounting-inbox.js.map +1 -1
- package/dist/tools/aging-analysis.d.ts +14 -0
- package/dist/tools/aging-analysis.d.ts.map +1 -1
- package/dist/tools/aging-analysis.js +70 -28
- package/dist/tools/aging-analysis.js.map +1 -1
- package/dist/tools/analyze-unconfirmed.d.ts.map +1 -1
- package/dist/tools/analyze-unconfirmed.js +99 -15
- package/dist/tools/analyze-unconfirmed.js.map +1 -1
- package/dist/tools/annual-report.d.ts +2 -2
- package/dist/tools/annual-report.d.ts.map +1 -1
- package/dist/tools/annual-report.js +630 -216
- package/dist/tools/annual-report.js.map +1 -1
- package/dist/tools/credential-tools.d.ts +11 -0
- package/dist/tools/credential-tools.d.ts.map +1 -1
- package/dist/tools/credential-tools.js +13 -0
- package/dist/tools/credential-tools.js.map +1 -1
- package/dist/tools/crud/transactions.d.ts.map +1 -1
- package/dist/tools/crud/transactions.js +101 -4
- package/dist/tools/crud/transactions.js.map +1 -1
- package/dist/tools/currency-rounding.d.ts.map +1 -1
- package/dist/tools/currency-rounding.js +2 -1
- package/dist/tools/currency-rounding.js.map +1 -1
- package/dist/tools/document-attachments.d.ts.map +1 -1
- package/dist/tools/document-attachments.js +53 -8
- package/dist/tools/document-attachments.js.map +1 -1
- package/dist/tools/document-audit.d.ts +3 -1
- package/dist/tools/document-audit.d.ts.map +1 -1
- package/dist/tools/document-audit.js +38 -13
- package/dist/tools/document-audit.js.map +1 -1
- package/dist/tools/estonian-tax.d.ts.map +1 -1
- package/dist/tools/estonian-tax.js +416 -180
- package/dist/tools/estonian-tax.js.map +1 -1
- package/dist/tools/financial-statements.d.ts +42 -0
- package/dist/tools/financial-statements.d.ts.map +1 -1
- package/dist/tools/financial-statements.js +304 -157
- package/dist/tools/financial-statements.js.map +1 -1
- package/dist/tools/lightyear-investments.d.ts +1 -1
- package/dist/tools/lightyear-investments.d.ts.map +1 -1
- package/dist/tools/lightyear-investments.js +226 -48
- package/dist/tools/lightyear-investments.js.map +1 -1
- package/dist/tools/pdf-workflow.d.ts +4 -9
- package/dist/tools/pdf-workflow.d.ts.map +1 -1
- package/dist/tools/pdf-workflow.js +73 -13
- package/dist/tools/pdf-workflow.js.map +1 -1
- package/dist/tools/receipt-extraction.d.ts +4 -6
- package/dist/tools/receipt-extraction.d.ts.map +1 -1
- package/dist/tools/receipt-extraction.js +111 -23
- package/dist/tools/receipt-extraction.js.map +1 -1
- package/dist/tools/receipt-inbox-booking.d.ts +12 -1
- package/dist/tools/receipt-inbox-booking.d.ts.map +1 -1
- package/dist/tools/receipt-inbox-booking.js +86 -11
- package/dist/tools/receipt-inbox-booking.js.map +1 -1
- package/dist/tools/receipt-inbox-files.d.ts.map +1 -1
- package/dist/tools/receipt-inbox-files.js +4 -0
- package/dist/tools/receipt-inbox-files.js.map +1 -1
- package/dist/tools/receipt-inbox-matching.d.ts.map +1 -1
- package/dist/tools/receipt-inbox-matching.js +5 -6
- package/dist/tools/receipt-inbox-matching.js.map +1 -1
- package/dist/tools/receipt-inbox.d.ts +1 -1
- package/dist/tools/receipt-inbox.d.ts.map +1 -1
- package/dist/tools/receipt-inbox.js +23 -13
- package/dist/tools/receipt-inbox.js.map +1 -1
- package/dist/tools/recurring-invoices.d.ts +14 -0
- package/dist/tools/recurring-invoices.d.ts.map +1 -1
- package/dist/tools/recurring-invoices.js +213 -73
- package/dist/tools/recurring-invoices.js.map +1 -1
- package/dist/tools/supplier-resolution.d.ts.map +1 -1
- package/dist/tools/supplier-resolution.js +32 -6
- package/dist/tools/supplier-resolution.js.map +1 -1
- package/dist/wise/executor.d.ts +6 -1
- package/dist/wise/executor.d.ts.map +1 -1
- package/dist/wise/executor.js +71 -75
- package/dist/wise/executor.js.map +1 -1
- package/dist/wise/operations.d.ts +2 -2
- package/dist/wise/operations.d.ts.map +1 -1
- package/dist/wise/operations.js.map +1 -1
- package/dist/wise/preflight.d.ts.map +1 -1
- package/dist/wise/preflight.js +7 -1
- package/dist/wise/preflight.js.map +1 -1
- package/dist/wise/presenter.d.ts.map +1 -1
- package/dist/wise/presenter.js +13 -3
- package/dist/wise/presenter.js.map +1 -1
- package/dist/wise/projection.d.ts +9 -0
- package/dist/wise/projection.d.ts.map +1 -1
- package/dist/wise/projection.js +142 -102
- package/dist/wise/projection.js.map +1 -1
- package/dist/wise/types.d.ts +13 -13
- package/dist/wise/types.d.ts.map +1 -1
- package/dist/wise/types.js.map +1 -1
- package/dist/workflow-action-v2.d.ts +15 -1
- package/dist/workflow-action-v2.d.ts.map +1 -1
- package/dist/workflow-action-v2.js +49 -3
- package/dist/workflow-action-v2.js.map +1 -1
- package/dist/workflow-response.d.ts +7 -0
- package/dist/workflow-response.d.ts.map +1 -1
- package/dist/workflow-response.js +30 -2
- package/dist/workflow-response.js.map +1 -1
- package/dist/year-end-closing-journal.d.ts +60 -0
- package/dist/year-end-closing-journal.d.ts.map +1 -0
- package/dist/year-end-closing-journal.js +100 -0
- package/dist/year-end-closing-journal.js.map +1 -0
- package/package.json +8 -8
- package/server.json +2 -2
- package/workflows/import-wise.md +5 -5
- package/workflows/lightyear-booking.md +5 -4
|
@@ -79,7 +79,7 @@ Review:
|
|
|
79
79
|
- `summary.blockers` — never hidden
|
|
80
80
|
- Record BOTH the `summary.plan_handle` and the `approved_command_digest`; approval and execution must use that exact pair.
|
|
81
81
|
|
|
82
|
-
Show main transactions and fee rows that would be created, exact duplicate / skip reasons, whether fees will be auto-confirmed to the chosen dimension, inter-account transfer confirmations or skips, and invoice FX
|
|
82
|
+
Show main transactions and fee rows that would be created, exact duplicate / skip reasons, whether fees will be auto-confirmed to the chosen dimension, inter-account transfer confirmations or skips, and advisory invoice FX corrections (reported only — the import never changes confirmed purchase invoices).
|
|
83
83
|
|
|
84
84
|
### Step 3: Approval gate
|
|
85
85
|
|
|
@@ -93,13 +93,13 @@ The approval card must include:
|
|
|
93
93
|
- number of main transactions and fee rows that would be created as PROJECT (draft/unconfirmed) bank transactions
|
|
94
94
|
- fee confirmations that will be posted automatically to `fee_account_dimensions_id`
|
|
95
95
|
- inter-account confirmations or skips, including selected `inter_account_dimension_id` when used
|
|
96
|
-
- each invoice FX
|
|
96
|
+
- each advisory invoice FX correction (not applied), including whether it would lock a foreign-currency rate or fix a legacy EUR settlement; the user corrects those invoices separately (invalidate → edit → re-confirm)
|
|
97
97
|
- skipped duplicates and Jar-transfer handling
|
|
98
98
|
- selected fee account dimension, if any
|
|
99
|
-
- side effects: PROJECT bank rows, fee confirmations, inter-account confirmations/skips, and
|
|
99
|
+
- side effects: PROJECT bank rows, fee confirmations, inter-account confirmations/skips, and transfer reviews (ownership, cross-currency, ambiguous or already-journalized)
|
|
100
100
|
- the reviewed plan's `plan_handle` + `approved_command_digest` pair
|
|
101
101
|
|
|
102
|
-
State that approval authorizes all listed categories (PROJECT bank-row creation, fee creation and confirmation, inter-account handling
|
|
102
|
+
State that approval authorizes all listed categories (PROJECT bank-row creation, fee creation and confirmation, inter-account handling). Both the `plan_handle` and the `approved_command_digest` are required. If the user does not approve every listed category, stop and ask which should be excluded; do not run `mode: "execute"`.
|
|
103
103
|
|
|
104
104
|
If the user does not explicitly approve, stop.
|
|
105
105
|
|
|
@@ -116,7 +116,7 @@ Every execute attempt consumes the plan handle exactly once. If execution report
|
|
|
116
116
|
Report from the executed `summary`:
|
|
117
117
|
- `summary.counts` created / skipped / errors
|
|
118
118
|
- fee transactions created
|
|
119
|
-
- inter-account confirmations, invoice FX
|
|
119
|
+
- inter-account confirmations, advisory invoice FX corrections (not applied)
|
|
120
120
|
- any rows still needing manual follow-up
|
|
121
121
|
|
|
122
122
|
For created PROJECT bank transactions, keep follow-up decisions compact: group low-risk identical confirmations, show the first items plus counts, and ask one batch approval with exceptions instead of one yes/no question per row. Offer the next inline action for the approved group — do NOT close the workflow with "confirm them in e-arveldaja UI". That is a last-resort fallback only when no MCP tool can perform the action.
|
|
@@ -68,6 +68,7 @@ Call `book_lightyear_trades` with `dry_run: true`.
|
|
|
68
68
|
- Include `capital_gains_file`, `gain_loss_account`, `loss_account`, `investment_dimension_id`, and `broker_dimension_id` when available.
|
|
69
69
|
- `book_lightyear_trades` takes a single `fee_account` argument. If a `trade_fee_account` value was supplied, pass it as the tool's `fee_account` (i.e. call the tool with `"fee_account": <trade_fee_account>`); otherwise omit `fee_account` and let it default to 8335. Never pass the tool an argument literally named `trade_fee_account`, and never send `distribution_fee_account` to this tool.
|
|
70
70
|
- Present trades that would be booked, skipped entries, duplicate-detection basis, and warnings.
|
|
71
|
+
- A sell debits the broker account with the cash the statement shows (net of fees), expenses its fees, credits the investment account at Lightyear's FIFO cost basis, and books the realized gain/loss as the balancing figure. When that differs from Lightyear's own `Capital Gains (EUR)` (the FX-rate gap), the row carries `lightyear_capital_gains_eur` — mention it.
|
|
71
72
|
- The reviewed dry run issues an immutable execution plan and returns a `plan_handle` (top-level in the response). It binds BOTH the statement CSV and the capital-gains CSV, the normalized arguments, the enumerated journals, and the duplicate/skip decisions.
|
|
72
73
|
- Use `get_execution_plan_page` with that `plan_handle` to page the enumerated journals, exclusions, and reviews without consuming the plan.
|
|
73
74
|
- The plan handle is not approval. Ask for explicit human approval before re-running with `dry_run: false`.
|
|
@@ -75,18 +76,18 @@ Call `book_lightyear_trades` with `dry_run: true`.
|
|
|
75
76
|
|
|
76
77
|
### Step 5: Preview distributions only after required accounts are known
|
|
77
78
|
|
|
78
|
-
If there are distributions in the statement and no `income_account` is known, ask the user for an income_account number before calling `book_lightyear_distributions`.
|
|
79
|
+
If there are distributions in the statement and no `income_account` is known, ask the user for an income_account number before calling `book_lightyear_distributions`. `income_account` is used for **Dividend** rows (dividends from directly-held shares → **8330** "Tulu aktsiatelt ja osadelt"). Fund **Distribution** rows go to `fund_distribution_account` (default **8320** "Tulu fondiosakute ümberhindlusest", name-resolved) and **Interest** rows to `interest_account` (default **8400** "Intressitulu hoiustelt", name-resolved); pass those only to override. Dividend **withheld tax** stays on **8610** "Muud finantskulud" (pass it as `tax_account`).
|
|
79
80
|
|
|
80
81
|
If the parsed distributions include withheld tax and no `tax_account` is known, ask the user for `tax_account` before booking them.
|
|
81
82
|
|
|
82
83
|
When the required accounts are known, call `book_lightyear_distributions` with `dry_run: true`.
|
|
83
|
-
- Include `broker_account`, `income_account`, optional `tax_account`, and optional `broker_dimension_id`.
|
|
84
|
+
- Include `broker_account`, `income_account`, optional `tax_account`, optional `interest_account` / `fund_distribution_account` overrides, and optional `broker_dimension_id`.
|
|
84
85
|
- `book_lightyear_distributions` takes a single `fee_account` argument. If a `distribution_fee_account` value was supplied, pass it as the tool's `fee_account` (i.e. call the tool with `"fee_account": <distribution_fee_account>`); otherwise omit it and let it default to 8610 "Muud finantskulud" — NOT the 8335 trade-fee account. Never pass the tool an argument literally named `distribution_fee_account`, and never send `trade_fee_account` to this tool.
|
|
85
86
|
- The tool defaults `reward_account` to 8600 ("Muud finantstulud", other financial income, name-resolved) for platform rewards/bonuses — a broker fee/campaign income, NOT securities income (8330) and NOT a financial cost. Only pass `reward_account` explicitly to override.
|
|
86
|
-
- Present dividends, interest, platform rewards, withheld tax, skipped entries, duplicate-detection basis, and warnings.
|
|
87
|
+
- Present dividends, fund distributions, interest, platform rewards, withheld tax, skipped entries, duplicate-detection basis, and warnings.
|
|
87
88
|
- The reviewed dry run issues an immutable execution plan and returns a `plan_handle` (top-level in the response) binding the statement CSV, the normalized arguments, and the enumerated distribution journals. Page it with `get_execution_plan_page` if needed.
|
|
88
89
|
- The plan handle is not approval. Ask for explicit human approval before re-running with `dry_run: false`.
|
|
89
|
-
- The distribution approval card must include source CSV, income/tax/reward accounts, journals that would be created, skipped duplicates, and side effects.
|
|
90
|
+
- The distribution approval card must include source CSV, income/interest/fund-distribution/tax/reward accounts, journals that would be created, skipped duplicates, and side effects.
|
|
90
91
|
|
|
91
92
|
### Step 6: Execute after approval
|
|
92
93
|
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,90 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.26.0] - 2026-09-25
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- **Month-end checklist no longer reports not-yet-due invoices as overdue while the month is still open.** `month_end_close_checklist` and `run_accounting_report` (`month_end`) compared due dates against the month's last day even mid-month, so on 2026-09-25 an invoice due 2026-09-26 was listed under `overdue_receivables`. Overdue is now evaluated as of `min(today, month-end)` and exposed as `overdue_as_of`; while the month is open (including its last day), invoices still payable this month (due date from today up to and including the month's last day — the due date is the last day to pay) go to new `due_before_month_end_receivables` / `due_before_month_end_payables` lists (not counted in `issues_found`) with an explanatory warning. Overdue rows now carry `due_date` and `days_overdue`. A closed month evaluates exactly as before.
|
|
10
|
+
- **"Today" is now the Estonian calendar date, not the UTC date.** Between local midnight and 02:00/03:00 the UTC date was still yesterday, which shifted the month-end open-month cut-off, the default `as_of_date` of `compute_receivables_aging` / `compute_payables_aging` and the `run_accounting_report` aging op, the default end of the `receipt_client_alignment` window, and the fallback journal date in currency rounding. All now use a shared `todayInTallinn()` (Europe/Tallinn).
|
|
11
|
+
- **Profit and loss no longer shows zeros for a closed year.** `compute_profit_and_loss` and `run_accounting_report` (`profit_and_loss`) summed the `YECL-YYYY` closing journal that older versions of `execute_year_end_close` booked on 12-31, which nets every revenue and expense account to 0 — so after the close the year's P&L read 0 / 0 / 0. Year-end closing journals are now excluded from P&L (with a warning naming how many); the balance sheet and trial balance still include them, since there they are real postings.
|
|
12
|
+
- **`run_accounting_report` statements now carry the opening-balance (algbilanss) warnings.** The `trial_balance`, `balance_sheet` and `profit_and_loss` ops dropped the "opening balances applied / not captured / outside this range" and unmapped-account warnings that the standalone `compute_*` tools emit. Both now share one implementation and emit identical warnings for the same dates. The unresolved-dimension-label warning, which no path ever passed through, now fires too.
|
|
13
|
+
- **Balance sheet without `date_to` is now as of today.** `compute_balance_sheet` and `run_accounting_report` (`balance_sheet`) documented "default: today" but applied no end date, so future-dated journals were included and the report said `date: "current"`. The default is now today's date (Europe/Tallinn), reported as a concrete `date`. A trial balance without `date_to` still counts every posting, but now says `period.to: "unbounded"` instead of the misleading `"now"`.
|
|
14
|
+
- **Month-end no longer counts unpaid credit invoices as receivables.** `month_end_close_checklist` and `run_accounting_report` (`month_end`) listed an unpaid `CREDIT_INVOICE` under `overdue_receivables` with a positive amount, inflating what customers owe. Credit invoices (money owed *to* the customer) are now left out of the receivables lists, with a warning giving the count.
|
|
15
|
+
- **Invalid report dates are rejected instead of producing wrong reports.** `compute_receivables_aging` / `compute_payables_aging` accepted any `as_of_date` string, putting every invoice in "90+" (or failing with a `RangeError`). They, and `compute_trial_balance` / `compute_balance_sheet` / `compute_profit_and_loss`, now require a real `YYYY-MM-DD` date and reject `date_from` after `date_to` (`category: "invalid_date"`), matching `run_accounting_report`.
|
|
16
|
+
- **`detail="full"` now returns every aging and month-end row.** The shared aging and month-end cores kept only the top 10 rows per aging bucket, party list and overdue/due-before list, so `run_accounting_report` with `detail="full"` silently dropped rows and compact mode never marked them. The cores now return full lists; the report caps compact output at 25 rows and marks every capped list with `truncated` (including the `unconfirmed_*` lists; capped aging party lists add `top_parties_truncated` and `party_count`). The standalone aging and month-end tools keep their 10-row cap but now flag it (`truncated`, `top_debtors_truncated` / `debtor_count`, `top_creditors_truncated` / `creditor_count`).
|
|
17
|
+
- **Foreign-currency invoices without a EUR amount are no longer added to EUR totals.** When a non-EUR invoice had no `base_gross_price`, aging and month-end summed its foreign-currency `gross_price` as if it were EUR. Such invoices now stay in the row lists, marked with `currency` and `excluded_from_eur_totals`, but are left out of every EUR total (bucket, party, unmatched, overdue/due-before), with a warning listing them.
|
|
18
|
+
- **Month-end and aging no longer crash on an invoice without `create_date`.** An open invoice with a missing or empty `create_date` aborted the month-end checklist (and aging, for an empty string) with a `RangeError`. The due date now falls back to the evaluation date, and month-end warns about such invoices. The month-end PARTIALLY_PAID warning now also counts invoices in the `due_before_month_end_*` lists.
|
|
19
|
+
- **Annual report income statement follows the real e-arveldaja chart.** `generate_annual_report_data` mapped Schema 1 lines to invented ranges (sales 3000-3099, depreciation 4800-4899, financial 7200-7699), so on the standard chart sales on 31xx-36xx fell out of net profit, 4800 goods costs were reported and added back as depreciation, and fines landed under financial items. Lines now follow the standard chart (revenue 3100-3799, other income 3800-3999, goods/services 4000-4999, operating expenses 5000-5999, staff 6000-6999, depreciation 7000-7099, other expenses 7100-7999, financial 8000-8899 net, income tax 8900-8999), checked against the account type. Any other Tulud/Kulud account (e.g. 3000 clearing) goes to a new `kaardistamata_tulud_ja_kulud` line with a warning, so net profit always equals Tulud − Kulud (excluding 9000, see below) as in `prepare_year_end_close` and `compute_profit_and_loss`.
|
|
20
|
+
- **First-year annual report starts from the opening balance.** With an algbilanss dated inside the report year, cash flow and ROE started from zero, giving a reconciliation difference equal to the opening position. The opening position is now the start-of-period balance, and a warning appears whenever the cash-flow statement does not reconcile.
|
|
21
|
+
- **Annual report classification on the real chart.** Accruals are flagged from 2600-2799 liabilities (29xx is equity); 21xx-27xx liabilities are current and 28xx non-current; 13xx are receivables and 11xx short-term investments in the cash flow; the opening-balance note says when a stored algbilanss falls after the report year; staff and related-party names, YECL document numbers and draft purchase numbers are marked as untrusted text. When the closing-journal create outcome is unknown, `execute_year_end_close` no longer says "No journals were created" and asks to check for a `YEC-RESULT-YYYY` / `YEC-RETAINED-YYYY` draft first; audit entries are logged under `execute_year_end_close`.
|
|
22
|
+
- **Year-end close never books twice.** Hand-booked RIK closing entries (any document number, draft or registered) and legacy `YECL-YYYY` journals that post to 2970 are detected; only the missing entry is proposed or created, and the new `close_status` reports open / partially_closed / closed. A 2970 → 2960 transfer booked by hand on any date of the next year (e.g. 1 December) counts as entry 2 when its amount equals the result; a transfer that puts the whole profit into reserve capital (D 2970 / K 2940, no 2960 line) counts too. Both entries are checked for direction and amount: a partial, reversed or stale entry is reported as `mismatch` / `partially_closed` in `blocked_entries` with booked vs expected amounts; only the remainder of a smaller same-direction 1 January transfer is proposed, and booked only with `allow_additional_transfer=true`; an off-date, ambiguous, over-, reversed or duplicate transfer (e.g. a second 2970 → 2960 transfer later in the year beside a complete 1 January one) is left for manual review and the year is not reported closed. `prepare_year_end_close` also warns when an earlier year is not closed or transferred. Re-running `execute_year_end_close` after a partial failure creates only what is missing.
|
|
23
|
+
- **Account 9000 is left out of every income statement.** `compute_profit_and_loss`, `run_accounting_report` `profit_and_loss`, `generate_annual_report_data` (9000 listed under `excluded_from_income_statement`) and `prepare_year_end_close` report the real result after the RIK close. The 9000 warning fires only for postings outside a closing entry or an amount that no longer matches the year's result.
|
|
24
|
+
- **Annual-report equity matches `compute_balance_sheet` in every state.** Equity shows 2970 as `current_year_result` ("Aruandeaasta kasum") plus a new `sulgemata_tulem` line (open P&L including 9000), with a `result_reconciliation` block warning when a prior year is unclosed or not transferred. ROE opening equity and prepare's balance check use the same basis.
|
|
25
|
+
- **Dividend legality checks count pending unconfirmed dividends.** `prepare_dividend_package` books drafts, but the ÄS § 157 checks read only confirmed journals, so two shareholders' dividends could each pass against the same retained earnings. Live unconfirmed dividend journals (`DIV-…` or crediting dividend payable) now reduce the lg 1 and lg 2 headroom and `max_net_dividend`, and are listed in the response.
|
|
26
|
+
- **Dividend retry with a different amount is refused.** A second call with the same `DIV-{date}-{shareholder}` key reported `duplicate` while echoing the new amounts, although the ledger kept the old journal. It now fails with `dividend_key_conflict` showing both sets of postings (also on `dry_run`); an identical retry echoes the existing journal's actual postings, and the duplicate check runs before the legality checks.
|
|
27
|
+
- **Dividend lg 1 ceiling includes the prior-year result.** The ceiling read only retained earnings (2960), so last year's profit closed to "Aruandeaasta kasum" (2970) or still in unclosed P&L blocked a normal dividend and pushed towards `force=true`. Distributable profit is now 2960 + 2970 (name-resolved, honouring the accounting-rules current-year-profit override) + unclosed prior-year P&L including 9000, excluding the distribution year's result, reported in `retained_earnings_check.components`. An inactive explicit `restricted_reserve_accounts` entry is accepted, and the shareholder name is desandboxed for the journal title and wrapped as untrusted text in output.
|
|
28
|
+
- **Recurring invoices execute exactly what was previewed.** `manage_sale_invoice` `action='recurring'` bound only the parameters, so an invoice confirmed or edited after the preview could be cloned (and with `auto_confirm` registered) unseen. The preview's source set and a canonical hash of each clone's complete create payload (client, receivable/bank account, dimensions, item accounts, VAT and amounts; `clone_payload_sha256`) are now bound into the plan; execute refuses with `plan_drift` if anything changed, clones only the reviewed ids, and rechecks each payload right before its create. Execute and its drift check read the sale invoices uncached, and each create is preceded by a live check for a clone made elsewhere meanwhile (UI or another process), which is skipped instead of duplicated.
|
|
29
|
+
- **Recurring invoices clone only confirmed ordinary invoices.** The default path cloned credit invoices, and explicit `invoice_ids` cloned any invoice including VOID credit notes from other months. Non-CONFIRMED, deleted and credit sources are now refused per row, ids outside `source_month` get a warning, and preview rows show `source_status`, `source_sale_invoice_type` and `source_create_date`.
|
|
30
|
+
- **Recurring clones keep the receivable dimension.** Clones copied `receivable_accounts_id` but dropped `receivable_accounts_dimensions_id` (and `bank_accounts_id`, `payment_description`, `subclients_id`, `recipient_clients_id`, `recipient_subclients_id`); these are now copied when present. Dedupe matches source invoice + target month, so a re-run on another day of the month no longer duplicates, and inherited recurring markers no longer pile up in notes. `confirm_error` is sandbox-wrapped.
|
|
31
|
+
- **`manage_sale_invoice` read `list` honours `view`.** `view="full"` was ignored.
|
|
32
|
+
- **Automatic import of a single `apikey*.txt` at startup works again.** It always failed with "invalid or oversized data" because it ran outside an invocation scope.
|
|
33
|
+
- **Inter-account transfers can no longer be booked reversed.** When both legs of a transfer carried the same stored `type` (legacy all-`C` rows), reconciliation confirmed whichever leg came first in the listing, so a transfer could be journalized in the wrong direction and the real outgoing leg deleted. Such a pair is now auto-confirmed only when exactly one leg has a signed outgoing marker; otherwise it goes to review as `direction_unresolved`. Pair confirms now post the base EUR amount, the same as one-sided confirms.
|
|
34
|
+
- **A signed outgoing bank row no longer settles a sale invoice.** A CAMT `DBIT` / Wise `OUT` row (e.g. a customer refund quoting the invoice reference) could exact-match and auto-confirm against an open sale invoice. Signed outgoing rows now match purchase invoices only.
|
|
35
|
+
- **Confirming a row whose stored type contradicts its statement direction is refused** (`stored_type_direction_mismatch`) on every confirm path, since the backend would place the cash leg on the wrong side; reconciliation execution reports carry this code (and `linked_invoice_client_mismatch`) instead of a generic `confirm_failed`. The confirm client auto-fix never writes a null client. A distribution linking invoices of several different clients is refused before any mutation (`linked_invoice_clients_ambiguous`) whether or not the transaction already has a client — one journal carries one client, so the other invoices' receipts would land in the wrong sub-ledger (v0.25.7 let such a split through when the transaction had a client); split the payment per client. An invoice without a client next to another client's invoice no longer disables the payer check.
|
|
36
|
+
- **CAMT import keeps a second identical entry without a bank reference.** Two genuine identical same-day entries without `AcctSvcrRef` were collapsed into one; the ledger count now decides how many copies are flagged as possible duplicates. The closing-balance tripwire now also works on the dry run (`pending_import_amount`), and execute re-reads the ledger uncached right before every row it creates (rows created earlier in the same run count too), so a row booked elsewhere during a long import stops it with `plan_drift`.
|
|
37
|
+
- **`analyze_unconfirmed_transactions` suggestions are safer.** Duplicate detection uses the statement direction with a ±1-day window, inter-account suggestions are skipped when the transfer is already journalized, and invoice status is read fail-closed.
|
|
38
|
+
- **`create_transaction` requires a positive amount**, and a Wise import stops on an unknown-outcome write instead of reporting it as skipped.
|
|
39
|
+
- **Receipt gross is no longer taken from the net-total line.** On a receipt like "Kokku km-ta 50,00 / KM 24% 12,00 / Kokku 62,00" the extractor picked 50 as the gross (a VAT label on the next line scored it up) and derived net 38, which still added up, so `receipt_batch` created — and in `create_and_confirm` confirmed — a 62 € receipt at 50 €. Net-labelled lines are no longer gross candidates, and a layout/text gross disagreement now blocks automatic creation (`total_gross_conflict`).
|
|
40
|
+
- **Receipt VAT rate comes from the receipt and its date.** The batch took the rate from the supplier's last invoice (e.g. 22% on a 2026 receipt) or none at all on the keyword path; it is now derived from extracted VAT/net and snapped to the standard or a reduced rate in force on the invoice date, with a mismatch sent to review. A reverse-charge receipt showing 0 VAT self-assesses at the standard rate in force on the invoice date instead of "-" or a stale 20/22% history rate; a reduced history rate is kept only if in force on that date, otherwise the receipt goes to review.
|
|
41
|
+
- **Foreign-currency invoices with `base_gross_price` no longer get phantom EUR VAT.** Base net/VAT are split in the invoice's own proportion, so a 0-VAT invoice keeps base VAT 0.
|
|
42
|
+
- **Purchase-invoice totals are safer.** All PATCH item paths apply the #62 structural defaults (`cl_fringe_benefits_id`, `amount`); a non-VAT company's multi-item invoice distributes the gross across items pro rata to net; the explicit-VAT rounding absorb is capped at 0.01 per item and a larger mismatch is refused instead of being hidden in the last line.
|
|
43
|
+
- **Duplicate purchase invoices are blocked.** `process_accounting_document` blocks an exact live supplier + invoice-number match at prepare and re-checks at create against live data (the 120 s list cache is dropped first, so an invoice booked meanwhile in the UI or by another process is caught); `create_purchase_invoice_from_pdf` refuses it too (also on live data) and now validates dates, `term_days` and non-VAT VAT fields. An explicit `allow_duplicate_invoice_number: true` (bound into the `process_accounting_document` plan) turns the block into a warning for suppliers that reuse numbers across years. Duplicate checks compare invoice numbers ignoring spaces, dashes and case, treat VOID/INVALIDATED/DELETED as not live, and limit same-amount candidates to ±7 days (`detect_duplicate_purchase_invoice` gains `invoice_date`).
|
|
44
|
+
- **Supplier resolution.** The business-register lookup parsed the wrong response shape and never returned data; it now reads the live autocomplete shape, requires an exact registry-code match, reports the company status and never auto-creates a deleted company. Tied supplier names resolve as ambiguous instead of silently picking the first client.
|
|
45
|
+
- **Receipt field extraction.** Invoice numbers must contain a digit, stay on one line, skip reference/account/IBAN/phone lines and real calendar dates (date-like numbers such as 2025-09-012 are kept), and prefer invoice labels over order labels; the invoice date prefers explicit invoice-date labels over due/delivery/order dates; a due date before the invoice date gives term 0 with a note; negated reverse-charge phrases are ignored and the phrase path requires VAT registration; dot-files are skipped in folder scans; `suggest_booking` `limit` is capped at 20.
|
|
46
|
+
- **Receipt-batch invoice notes no longer contain the source filename.**
|
|
47
|
+
- **Bank classification never books a refund as an expense.** Counterparty groups mixed incoming and outgoing rows and were categorized from the first row only, so an incoming refund could be booked as a new purchase invoice. Groups are now split by direction and the apply step skips non-outgoing rows.
|
|
48
|
+
- **Payment-receipt invoice cross-references match invoice numbers ignoring spaces and dash variants**, like the duplicate checks.
|
|
49
|
+
- **Wise import no longer double-books an own transfer already journalized from the other bank.** The inter-account check now uses BookingGuard Lane B with a ±1-day window at plan and execute time (it matched the exact date only, and a journal labelled with another reference never matched). A differently labelled or ambiguous same-amount journal sends the row to review instead of auto-confirming; an already-journalized transfer no longer creates a duplicate PROJECT bank row.
|
|
50
|
+
- **Wise cross-currency own transfers are no longer confirmed in the foreign nominal.** A USD → EUR own transfer posted 100 to the EUR bank where 92 EUR arrived. Transfers that are not same-currency EUR are imported unconfirmed with a `wise_transfer_cross_currency` review; the base-EUR booking is left to `reconcile_inter_account_transfers`.
|
|
51
|
+
- **Wise own-account transfers are no longer skipped as jar transfers.** `TRANSFER-*` / `BANK_DETAILS_*` rows whose two endpoints carry the same name went to "Jar / self-transfer"; they now flow through the ownership / inter-account path. Naming an already-imported row in `confirm_own_transfer_ids` produces a `wise_transfer_already_imported` review instead of silently doing nothing.
|
|
52
|
+
- **Wise bank rows stay within the API limits** (description 150, `bank_account_name` 100) while keeping the `WISE:{id}` tag and the direction marker; duplicate detection still recognises rows imported before the caps. A row whose Wise ID is too long for the tag and marker to fit (over 122 characters, or over 102 with a fee) is skipped with a reason instead of being truncated. A fully imported re-run no longer fails with `wise_client_not_found` or a missing fee dimension, and raw error text in result `status` fields is sandboxed.
|
|
53
|
+
- **Lightyear sells book the cash the statement shows.** `book_lightyear_trades` debited the broker with the capital-gains file's proceeds, so a EUR sell overstated the broker by the proceeds gap and FX sells deducted the fees twice. Sells now debit the broker with the cash actually received (net for EUR sells, the EUR conversion leg for FX sells), expense the trade/FX fees, credit the investment at Lightyear's FIFO cost basis and book the gain/loss as the balancing figure; gains rows are matched on the sell's consideration, and a gain differing from Lightyear's `Capital Gains (EUR)` is shown as `lightyear_capital_gains_eur`.
|
|
54
|
+
- **Lightyear booking no longer promises journals the API rejects.** Every projected posting is checked against the dimension rules on dry run and execute; a 4xx client rejection is reported as a failed command (`journal_create_rejected`) with the sandboxed upstream detail instead of `mutation_outcome_unknown` (a 5xx, timeout or network error stays `mutation_outcome_unknown`, since the journal may have been saved), and the approval view shows each posting's `accounts_dimensions_id`, including an auto-filled single dimension. Rows with an impossible date (`31/02/2026`, non-DD/MM/YYYY) go to review (`invalid_date`) and ISO timestamps book on their calendar day; same-reference rows with differing content go to review (`reference_conflict`) instead of silently booking the first; `parse_lightyear_statement` cash reconciliation counts buys and conversion source legs at gross; a `capital_gains_file_ref` no longer triggers the missing-file warning.
|
|
55
|
+
- **`accounting_inbox` dry runs no longer exhaust the plan store.** Each dry run minted consume-once plan handles for every CAMT, Wise and inter-account preview (one slot per file per run) until gated flows failed with `plan_capacity_exceeded`. Its approvable previews now point at the tool's own dry run, which returns the required `plan_handle`, instead of an execute card that always failed with `plan_handle_required`.
|
|
56
|
+
- **`accounting_inbox` reports Wise transfer reviews.** Ownership, dimension, cross-currency, ambiguous-journal and already-imported reviews each become a review item with a stable id, advisory invoice FX corrections are listed, and a Wise import with open reviews is no longer offered for approval (the inbox reported it clean). A skipped (not failed) import step now defers the ledger-reading steps as `materialization_state: "pending_input"` instead of reporting an earlier step as failed.
|
|
57
|
+
- **Guided workflow continuation works.** A pending question in `workflow_action_v2` routed to `get_setup_instructions`; it now tells the agent to ask the user and rerun `accounting_inbox` with the answer, naming the input when known (e.g. `answer_input: "bank_account_dimension_id"`); question items keep their item id, unanswered questions appear as `needs_input` blockers, and a completed workflow carries no `next_action`. `continue_accounting_workflow action="next"` implements the advertised `workflow_handle` + `item_id` continuation for review items (the unused `answer` input was removed), refuses a compact v2 response instead of falsely reporting "no workflow action pending", and sandboxes echoed caller text.
|
|
58
|
+
- **Owner-expense reimbursements are not booked twice on retry.** Booking (tool or continuation) returns the existing journal as `booking_status: "duplicate"` when a live journal with the same document number, owner, date and total exists; `prepare_action` no longer mints a plan handle while the item has unresolved questions (`status: "needs_answers"`), and the echoed recommendation and compliance basis are sandboxed.
|
|
59
|
+
- **Uploaded documents keep a meaningful name.** `process_accounting_document` uploaded every source as `document.pdf` and base64 uploads got a random UUID name; the source file's own name is used, and `attach_document` / `create_purchase_invoice_from_pdf` take an optional `file_name`. Upload names go through one sanitizer that strips control characters and path components but keeps Estonian letters (receipt-inbox uploads sent raw directory-entry names). A failed snapshot write no longer leaks a temp directory.
|
|
60
|
+
- **A `.reclaim` guard left by a crashed process no longer blocks lock recovery forever** (audit-log and booking-guard locks); it is cleared with the same dead-owner check.
|
|
61
|
+
|
|
62
|
+
### Added
|
|
63
|
+
|
|
64
|
+
- **`confirm_transaction` checks inter-account confirms for duplicates.** Confirming against an own bank account now looks for an existing transfer journal (±1 day) and a matching bank posting, warns by default, and refuses with `block_on_duplicate: true`; a failed read in this advisory check becomes a warning, never a failed confirm.
|
|
65
|
+
- **Lightyear `interest_account` and `fund_distribution_account`.** `book_lightyear_distributions` routes Interest rows to `interest_account` (default 8400 "Intressitulu hoiustelt") and fund Distribution rows to `fund_distribution_account` (default 8320), both name-resolved; `income_account` now applies to Dividend rows only (all three types used to land on one account).
|
|
66
|
+
|
|
67
|
+
### Changed
|
|
68
|
+
|
|
69
|
+
- **`generate_annual_report_data` `balance_sheet.equity.current_year_result.amount` changed meaning.** It used to be the year's net profit; it is now the balance of 2970 "Aruandeaasta kasum" (0 before the RIK close), with the not-yet-closed result shown separately as `sulgemata_tulem`. Read the year's profit from the income statement instead.
|
|
70
|
+
- **Year-end close follows RIK's e-arveldaja method.** `prepare_year_end_close` / `execute_year_end_close` now propose and book the two manual entries from RIK's guide "Äriühingu majandusaasta lõpetamiskanded e-arveldajas": Dec 31 profit D 9000 "Arvestuslik koondtulemus" / K 2970 "Aruandeaasta kasum" (loss reversed, document `YEC-RESULT-YYYY`) and Jan 1 of the next year D 2970 / K 2960 "Jaotamata kasum" (document `YEC-RETAINED-YYYY`, optional `reserve_capital_amount` split to 2940). Revenue and expense accounts are no longer zeroed: the old `YECL-YYYY` entry zeroed every P&L account into 2970, which broke e-arveldaja's own income statement, double-credited 2970 when the RIK entry was also booked, and never moved 2970 to 2960. Accounts are name-resolved with standard numbers as fallback.
|
|
71
|
+
- **`force=true` in `prepare_dividend_package` no longer overrides the ledger-imbalance block**; it only overrides the two ÄS § 157 clauses.
|
|
72
|
+
- **Dependencies updated.** `@modelcontextprotocol/sdk` 1.30.0 → 1.30.1, `@llamaindex/liteparse` 2.14.6 → 2.14.7, `dotenv` 17.4.2 → 18.0.3, plus dev tooling (`@babel/parser` 8.0.6, `@types/node` 26.6.2, `tsx` 4.23.15, `vite` 8.3.1). Declared floors raised to the tested versions. dotenv 18 removes preloading, `.env.vault` and console tips, and adds an opt-in fast parser; this server only calls `dotenv.parse()` with the default parser, so behaviour is unchanged. `vitest` stays on 4.1.11 because vitest 5 requires Node ≥ 22.12 and CI still runs unit tests on Node 20.
|
|
73
|
+
- **`attach_document` no longer silently replaces an existing source document.** It refuses with `document_exists` (showing the current file name, sandboxed, and the target record) unless `replace_existing: true` is passed; the tool is now annotated and catalogued as destructive, a replacement is audited with the replaced file name, and `file_path` must be absolute (or `base64:[<ext>:]<data>`).
|
|
74
|
+
- **Wise import no longer modifies confirmed purchase invoices.** The Wise-rate lock and the legacy EUR settlement fix PATCHed money fields on CONFIRMED invoices without items (bypassing the confirmed-record rules); they are now reported as advisories with `proposed_correction` (the upstream invoice number is sandboxed), and purchase invoices are no longer part of the Wise plan digest.
|
|
75
|
+
|
|
76
|
+
### Security
|
|
77
|
+
|
|
78
|
+
- **Credential writes can no longer be captured through a planted symlink.** `.env` and other secret files were written via a predictable `<file>.tmp-<pid>` path opened without `O_EXCL`, so a symlink planted there received the API password. The temp file now has a random name, is opened `O_EXCL` with mode 0600, and cleanup never follows a symlink.
|
|
79
|
+
- **Opening and statement balances are bound to the connection.** When several companies share one accounting-rules bundle (`EARVELDAJA_RULES_DIR` or a legacy root bundle), `opening-balances.json` and `statement-balances.json` were shared too, so one company's algbilanss was folded into another's balances and ÄS § 157 checks. Records are now stamped with the connection fingerprint; a record from another connection is ignored with a warning (re-import after an API key rotation). Legacy unstamped records keep applying on single-connection servers and in the default per-connection bundle directory; they are ignored only in a shared bundle with several connections. Both files are written atomically with mode 0600 and reads are capped at 1 MB.
|
|
80
|
+
- **Nested sandbox markers are stripped completely** before text is persisted or matched.
|
|
81
|
+
- **Duplicate connection names are made unique** (`apikey.txt` + `apikey.TXT` → `apikey`, `apikey-2`), so the multi-company `connection` guard cannot match two companies.
|
|
82
|
+
- **`.env` values always round-trip.** Quote-wrapped values and a literal `\n` were rewritten corrupted (a stored password could silently stop working); every value is now checked with `dotenv.parse` before writing, and unrepresentable values are refused.
|
|
83
|
+
- **Accounting-rules bundle files are created 0600 and directories 0700.**
|
|
84
|
+
- **`clear_session_log` leaves a tombstone entry** (action `LOG_CLEARED`, filterable in `get_session_log`; time, connection, process, entries removed) and reports failure instead of claiming success; the tombstone replaces the log atomically, so a failed clear leaves the existing entries intact. Failed audit-log writes and slow audit-lock waits are reported on stderr.
|
|
85
|
+
- **More bank free text is sandboxed:** CAMT end-to-end id, counterparty IBAN and registry code, reference and patch fields, and journal `document_number` in duplicate warnings.
|
|
86
|
+
- **Invoice numbers are sandboxed in `detect_duplicate_purchase_invoice` output.**
|
|
87
|
+
- **Document content must match its extension.** PDF/PNG/JPEG uploads must carry their format's magic bytes: a local file whose content does not match its extension (`content_type_mismatch`) or a `base64:pdf|png|jpg:` payload without the signature is refused. XML/CSV/TXT inputs are unaffected.
|
|
88
|
+
|
|
5
89
|
## [0.25.7] - 2026-09-18
|
|
6
90
|
|
|
7
91
|
### Fixed
|
package/CLAUDE.md
CHANGED
|
@@ -41,6 +41,9 @@ The active connection is in-process state: a server respawned by the MCP host st
|
|
|
41
41
|
With 2+ connections every non-readonly tool gains an optional `connection` argument
|
|
42
42
|
(index or name); a mismatch with the active connection is refused (`connection_mismatch`)
|
|
43
43
|
before any API request. Pass it on every write in multi-company sessions (GitHub #61).
|
|
44
|
+
Connection names are unique: when two distinct credentials derive the same name
|
|
45
|
+
(e.g. `apikey.txt` + `apikey.TXT`, or `env-local` from two working dirs), later ones
|
|
46
|
+
in load order get a deterministic `-2`, `-3`, … suffix, so a name-pinned call is never ambiguous.
|
|
44
47
|
|
|
45
48
|
**NEVER commit `.env` or `apikey.txt` to git.** The `.gitignore` is configured to exclude them.
|
|
46
49
|
|
|
@@ -82,7 +85,12 @@ can paste that register once via the `import_opening_balances` tool
|
|
|
82
85
|
the result under `dry_run` (default `true`), and on `dry_run=false` persists
|
|
83
86
|
it as `opening-balances.json` in the same accounting-rules bundle described
|
|
84
87
|
above (`src/opening-balance-store.ts`; requires bundle mode — not available
|
|
85
|
-
under `EARVELDAJA_RULES_FILE` single-file mode).
|
|
88
|
+
under `EARVELDAJA_RULES_FILE` single-file mode). Because a bundle can be shared
|
|
89
|
+
by several connections (`EARVELDAJA_RULES_DIR`, or a kept-in-place project/global
|
|
90
|
+
bundle), the record — like each `statement-balances.json` record — is stamped with
|
|
91
|
+
the active connection fingerprint and ignored (with a warning) on another
|
|
92
|
+
connection; a legacy unstamped record applies only when exactly one connection is
|
|
93
|
+
configured. Both files are written atomically 0600 and reads are capped at 1 MB. At compute time the stored
|
|
86
94
|
balances are folded in as one synthetic journal dated at the opening date
|
|
87
95
|
(`src/opening-balance-journal.ts`), so `compute_account_balance`,
|
|
88
96
|
`compute_trial_balance`, `compute_balance_sheet`, `compute_profit_and_loss`,
|
|
@@ -212,7 +220,7 @@ OpenAPI spec: `GET /openapi.yaml` on the API server. HTML docs: `/api.html`.
|
|
|
212
220
|
- **Deliver sale invoice**: `PATCH /sale_invoices/{id}/deliver` (not `/send_einvoice`)
|
|
213
221
|
|
|
214
222
|
### Document endpoints
|
|
215
|
-
- **User-uploaded docs**: `GET/PUT/DELETE /{entity}/{id}/document_user` (PUT to upload, not POST). Implemented generically on `BaseResource` (`getDocument`/`uploadDocument`/`deleteDocument`, keyed on `basePath`) and exposed by the entity-agnostic tools `attach_document` / `get_document` / `delete_document` (`entity_type` ∈ purchase_invoice, sale_invoice, journal, transaction) in `src/tools/document-attachments.ts`. RPS requires a source document on every entry, so manual journals and directly-booked bank transactions can carry one too — `find_missing_documents` flags those that don't.
|
|
223
|
+
- **User-uploaded docs**: `GET/PUT/DELETE /{entity}/{id}/document_user` (PUT to upload, not POST). Implemented generically on `BaseResource` (`getDocument`/`uploadDocument`/`deleteDocument`, keyed on `basePath`) and exposed by the entity-agnostic tools `attach_document` / `get_document` / `delete_document` (`entity_type` ∈ purchase_invoice, sale_invoice, journal, transaction) in `src/tools/document-attachments.ts`. RPS requires a source document on every entry, so manual journals and directly-booked bank transactions can carry one too — `find_missing_documents` flags those that don't. PUT replaces an existing document, so `attach_document` checks first and refuses with `document_exists` unless `replace_existing: true` (tool is destructive).
|
|
216
224
|
- **System-generated sale invoice PDF**: `GET /sale_invoices/{id}/pdf_system` (tool `get_sale_invoice_document`)
|
|
217
225
|
- **System-generated sale invoice e-invoice XML**: `GET /sale_invoices/{id}/xml` (tool `get_sale_invoice_xml`) — the structured machine-readable e-arve, distinct from the human-readable PDF
|
|
218
226
|
|
|
@@ -248,6 +256,11 @@ OpenAPI spec: `GET /openapi.yaml` on the API server. HTML docs: `/api.html`.
|
|
|
248
256
|
`IN`/`OUT`) via `bankTransactionDirection`, with legacy `D`/`C` only as a fallback for
|
|
249
257
|
older rows — never re-derive accounting treatment from a raw stored `type` alone, since
|
|
250
258
|
historically-imported rows may all be `C`.
|
|
259
|
+
- **Confirm-time guard:** `TransactionsApi.confirm` refuses (`stored_type_direction_mismatch`,
|
|
260
|
+
before any mutation, on every confirm path) a row whose signed marker contradicts its
|
|
261
|
+
stored `type` — the backend would book the cash leg backwards. A signed outgoing row
|
|
262
|
+
(DBIT/OUT) only ever matches purchase invoices; the sale-invoice fallback for outgoing
|
|
263
|
+
rows exists only for legacy unsigned `C` rows.
|
|
251
264
|
- **Distribution + direction together** determine the journal at confirmation:
|
|
252
265
|
- Confirming against another bank account → "Laekumine"/"Tasumine" per the account
|
|
253
266
|
relationship (inter-account transfers use the source/target dimensions).
|
|
@@ -274,8 +287,10 @@ OpenAPI spec: `GET /openapi.yaml` on the API server. HTML docs: `/api.html`.
|
|
|
274
287
|
- CAMT-imported transactions confirmed as inter-account transfers create journal entries touching both bank accounts
|
|
275
288
|
- If the other side (e.g. Wise import) is also confirmed against the same bank account → **duplicate journal entries** and incorrect balance
|
|
276
289
|
- **Always use `reconcile_inter_account_transfers`** for inter-account confirmation — it checks existing journals before confirming
|
|
277
|
-
- The Wise import tool (`import_wise_transactions`) has built-in duplicate detection for inter-account transfers
|
|
278
|
-
- When manually confirming transactions against another bank account, first check for existing journals at that date/amount
|
|
290
|
+
- The Wise import tool (`import_wise_transactions`) has built-in duplicate detection for inter-account transfers (BookingGuard Lane B, ±1 day, labelled journals identity-only); it auto-confirms only same-currency EUR own transfers — cross-currency ones go to review for `reconcile_inter_account_transfers` (H10), and it never modifies confirmed purchase invoices (invoice FX corrections are advisory)
|
|
291
|
+
- When manually confirming transactions against another bank account, first check for existing journals at that date/amount — `confirm_transaction` warns (BookingGuard Lane B ±1 day + bank-posting scan) and refuses with `block_on_duplicate: true`
|
|
292
|
+
- Same-type reciprocal legs (both stored `C`, or both `D`) are auto-confirmed only when exactly one leg carries a signed outgoing marker agreeing with its stored `C`; otherwise they go to `ambiguous_pairs` with `code: "direction_unresolved"` (the stored type cannot say which account the money left)
|
|
293
|
+
- Inter-account distribution amounts are base EUR (`base_amount ?? amount`) in every phase (pairs, same-type pairs, one-sided — H10)
|
|
279
294
|
|
|
280
295
|
### Cross-mechanism bank-posting duplicate guard
|
|
281
296
|
|
|
@@ -514,10 +529,11 @@ API data remains raw.
|
|
|
514
529
|
- **VD**: Intra-community supply declaration (EU only)
|
|
515
530
|
- **CIT on dividends**: 22/78 from 2025-01-01; 20/80 before (date-gated `CIT_RATE_TIMELINE` / `getCitRateForDate` in `src/estonian-tax-rules.ts`, re-exported from `src/tools/estonian-tax.ts`)
|
|
516
531
|
- **Dividend booking (net vs. gross)**: `prepare_dividend_package` debits **only the net dividend** to retained earnings (Jaotamata kasum; account resolved by name against the company chart, standard 2960, override with `retained_earnings_account`). The CIT is a current-period **income-tax expense** (the P&L "Tulumaks" line), booked to an 8900-series Kulud account (auto-detected via `resolveIncomeTaxExpenseAccount`, override with `income_tax_expense_account`, default 8900), NOT a second debit to retained earnings. Per Estonian GAAP / RTJ the dividend income tax (TuMS § 50) is charged against current-year profit, not equity directly. All equity/liability accounts (retained earnings, dividend payable → standard 2650, dividend income-tax payable → standard 2656, share capital → standard 2900) are **name-resolved** against the actual chart via `src/account-resolution.ts`, with the standard number as fallback.
|
|
517
|
-
- **ÄS § 157 legality checks are split by clause**: the **lg 1
|
|
532
|
+
- **ÄS § 157 legality checks are split by clause**: the **lg 1 ceiling is NET-based** — the ENTIRE lg 1 distributable profit (retained earnings 2960 + closed prior-year result on "Aruandeaasta kasum" 2970, name-resolved + unclosed prior-year P&L; never the distribution year's own result) is distributable as net dividend, since the CIT is not part of the payout; the **lg 2 net-assets floor is GROSS-based** (net assets fall by dividend payable + tax liability) at share capital **+ non-distributable reserves** (reservkapital, name-detected in the chart, standard 2940; override with `restricted_reserve_accounts`). Live unconfirmed dividend drafts (`DIV-…` or crediting dividend payable) are subtracted from both headrooms, since the tool books drafts and balances read only confirmed journals. The tool hard-blocks violations of either clause unless `force=true` (use only alongside a legitimate action such as a capital reduction; `force` never overrides the ledger-imbalance block), and always reports `maximum_distributable.max_net_dividend` = min(lg 1 distributable profit, (net assets − floor) × den/(den+num)), both net of pending drafts. One journal per shareholder+date: an identical retry returns `duplicate`, a different amount `dividend_key_conflict`.
|
|
533
|
+
- **Year-end close (RIK method, calendar year).** e-arveldaja has no native closing; RIK's guide "Äriühingu majandusaasta lõpetamiskanded e-arveldajas" prescribes two manual entries, which `prepare_year_end_close` / `execute_year_end_close` propose and book as drafts: (1) Dec 31 profit D 9000 "Arvestuslik koondtulemus" / K 2970 "Aruandeaasta kasum" (loss reversed), document `YEC-RESULT-YYYY`; (2) Jan 1 of the next year D 2970 / K 2960 (optional `reserve_capital_amount` to 2940), document `YEC-RETAINED-YYYY`. Revenue/expense accounts are NOT zeroed and 9000 is not part of the income statement: every P&L surface (`compute_profit_and_loss`, `run_accounting_report`, `generate_annual_report_data`, prepare's result) excludes it, while the balance sheet keeps it in open P&L so equity balances. Existing entries are detected structurally (date + accounts touched, any document number, drafts included); legacy `YECL-YYYY` journals (the old zero-all-P&L close, `src/year-end-closing-journal.ts`) that post to 2970 count as entry 1 — never book either twice. Entry 2 is 2970 against 2960 and/or reserve accounts only (an all-to-reserve D 2970 / K 2940 counts); it is also recognised on any date of the next year when its amount matches (operators often transfer on another day). Both entries are checked for direction and amount; a mismatch is reported as `mismatch`/`partially_closed` in `blocked_entries` and blocks booking — `allow_additional_transfer` acknowledges only a smaller same-direction 1 January transfer (the remainder is booked); an off-date, ambiguous, over- or reversed transfer and a wrong entry 1 always need manual correction. The dividend §157 lg 1 unclosed-P&L sum must INCLUDE 9000 (it cancels the still-open P&L once entry 1 exists).
|
|
518
534
|
- **Dividend statutory prerequisites** are echoed as `compliance_notes` on every path: ÄS § 157 lg 1 requires an APPROVED annual report + profit-distribution decision (attach the decision via `attach_document`), and the CIT is declared on TSD annex 7 by the 10th of the month after payout (TuMS § 54).
|
|
519
535
|
- **Capital gains**: Securities taxed at 22% income tax
|
|
520
|
-
- **Third-party payer / receipt client alignment**: e-arveldaja copies a registration journal's `clients_id` from the bank transaction (payer), not from the linked invoice, and postings carry no client — so a payer that differs from the invoice client books the receivable credit into the wrong client sub-ledger (verified live 2026-09). `TransactionsApi.confirm` refuses such a confirm (`linked_invoice_client_mismatch`) unless `reassignClientToInvoice` (tool param `reassign_client_to_invoice`, an explicit approval) is set; the registration journal is located by `operation_type = "TRANSACTION"` + `operations_id = tx id` (the register call returns no journal id) and checked after every invoice-linked confirm (`src/banking/receipt-ledger-check.ts`); exact-match reconciliation routes these to `third_party_payer_reviews`; `run_accounting_report` `receipt_client_alignment` audits existing books. Repair is invalidate → reassign → re-confirm; a one-journal reclassification between two clients is not expressible.
|
|
536
|
+
- **Third-party payer / receipt client alignment**: e-arveldaja copies a registration journal's `clients_id` from the bank transaction (payer), not from the linked invoice, and postings carry no client — so a payer that differs from the invoice client books the receivable credit into the wrong client sub-ledger (verified live 2026-09). `TransactionsApi.confirm` refuses such a confirm (`linked_invoice_client_mismatch`) unless `reassignClientToInvoice` (tool param `reassign_client_to_invoice`, an explicit approval) is set; a distribution linking invoices of several clients is always refused (`linked_invoice_clients_ambiguous`, no reassignment can fix one journal/one client — split the payment); the registration journal is located by `operation_type = "TRANSACTION"` + `operations_id = tx id` (the register call returns no journal id) and checked after every invoice-linked confirm (`src/banking/receipt-ledger-check.ts`); exact-match reconciliation routes these to `third_party_payer_reviews`; `run_accounting_report` `receipt_client_alignment` audits existing books. Repair is invalidate → reassign → re-confirm; a one-journal reclassification between two clients is not expressible.
|
|
521
537
|
- **Input-VAT deduction restrictions** (`src/estonian-tax-rules.ts`): single date-gated source for the standard VAT-rate timeline (20→22%→24%), the dividend-CIT timeline (20/80→22/78), the 40 000 EUR VAT registration threshold, current reduced rates, and the deduction detectors. `suggest_booking` returns these as `tax_notes` — `KMS § 30` (külaliste vastuvõtt / esinduskulu: input VAT non-deductible; also `TuMS § 49 lg 4` representation limit 50 €/month + 2% of payroll) and `KMS § 30 lg 4` (M1 passenger car: 50% cap). Notes are advisory; `workflows/book-invoice.md` requires surfacing each on the approval card. `validate_invoice_data` also uses the rate timeline to warn when a line's standard rate (20/22/24%) does not match the invoice date. The full dataset is browsable read-only at `earveldaja://tax_rules` — including the `TuMS § 49` representation/donation limits, `TuMS § 48` fringe-benefit pointer, the profit-distribution rules (`ÄS § 157 lg 1–2`, `TuMS § 50`), and the RPS process rules (`§ 10` corrections, `§ 12` 7-year retention, `§ 15` inventory) — plus a `verified_at` stamp (`TAX_RULES_VERIFIED_AT`). `check_tax_free_limits` computes the cumulative `TuMS § 49` representation/donation limits and the 22/78 tax on any excess from caller-supplied year-to-date figures (it does not read the ledger). Update the figures in this module when the law changes — the Estonian-tax tool descriptions render their rates/thresholds from these constants, so they follow automatically (pinned by tests).
|
|
522
538
|
|
|
523
539
|
**Non-goals — do NOT reimplement in MCP (e-arveldaja does these natively; reimplementing risks double-booking):**
|
|
@@ -24,6 +24,18 @@ export declare function resolveAccountByName(accounts: Account[], pattern: RegEx
|
|
|
24
24
|
/** Retained earnings — "Eelmiste perioodide jaotamata kasum (kahjum)" (2960);
|
|
25
25
|
* anchored so "Jaotamata kasumi reserv" (a distributable reserve) is excluded. */
|
|
26
26
|
export declare const resolveRetainedEarningsAccount: (accounts: Account[], override?: number) => number;
|
|
27
|
+
/** Current-year result — "Aruandeaasta kasum (kahjum)" (2970), the account
|
|
28
|
+
* RIK's year-end result entry credits with a closed year's profit; anchored so a
|
|
29
|
+
* suffixed sibling ("Aruandeaasta kasum erikonto") is excluded. */
|
|
30
|
+
export declare const resolveCurrentYearProfitAccount: (accounts: Account[], override?: number) => number;
|
|
31
|
+
/** Calculated result — "Arvestuslik koondtulemus" (9000), the counter-account
|
|
32
|
+
* of RIK's year-end result entry (profit: D 9000 / K 2970). Not an income-
|
|
33
|
+
* statement line. */
|
|
34
|
+
export declare const resolveCalculatedResultAccount: (accounts: Account[], override?: number) => number;
|
|
35
|
+
/** Posting target for a statutory reserve-capital transfer — the lowest-numbered
|
|
36
|
+
* ACTIVE "Kohustuslik reservkapital" (2940). Unlike
|
|
37
|
+
* resolveRestrictedReserveAccounts (a balance read), this picks one account. */
|
|
38
|
+
export declare const resolveReserveCapitalAccount: (accounts: Account[], override?: number) => number;
|
|
27
39
|
/** Dividend payable — "Dividendivõlad" (2650). */
|
|
28
40
|
export declare const resolveDividendPayableAccount: (accounts: Account[], override?: number) => number;
|
|
29
41
|
/** Dividend income-tax payable — "Dividenditulumaksu võlg" (2656), not the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-resolution.d.ts","sourceRoot":"","sources":["../src/account-resolution.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"account-resolution.d.ts","sourceRoot":"","sources":["../src/account-resolution.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAe9C;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAM1F;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,OAAO,EAAE,EACnB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,CAGR;AAWD;kFACkF;AAClF,eAAO,MAAM,8BAA8B,aAAc,OAAO,EAAE,aAAa,MAAM,KAAG,MACwC,CAAC;AAEjI;;mEAEmE;AACnE,eAAO,MAAM,+BAA+B,aAAc,OAAO,EAAE,aAAa,MAAM,KAAG,MACqB,CAAC;AAE/G;;qBAEqB;AACrB,eAAO,MAAM,8BAA8B,aAAc,OAAO,EAAE,aAAa,MAAM,KAAG,MACY,CAAC;AAErG;;gFAEgF;AAChF,eAAO,MAAM,4BAA4B,aAAc,OAAO,EAAE,aAAa,MAAM,KAAG,MACa,CAAC;AAEpG,kDAAkD;AAClD,eAAO,MAAM,6BAA6B,aAAc,OAAO,EAAE,aAAa,MAAM,KAAG,MACK,CAAC;AAE7F;qCACqC;AACrC,eAAO,MAAM,gCAAgC,aAAc,OAAO,EAAE,aAAa,MAAM,KAAG,MACM,CAAC;AAEjG;;0DAE0D;AAC1D,eAAO,MAAM,0BAA0B,aAAc,OAAO,EAAE,aAAa,MAAM,KAAG,MACiC,CAAC;AAEtH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,CAK9E;AAED,qFAAqF;AACrF,eAAO,MAAM,kCAAkC,aAAc,OAAO,EAAE,aAAa,MAAM,KAAG,MACc,CAAC;AAE3G;4EAC4E;AAC5E,eAAO,MAAM,gBAAgB,aAAc,OAAO,EAAE,aAAa,MAAM,KAAG,MACqC,CAAC;AAEhH,+DAA+D;AAC/D,eAAO,MAAM,8BAA8B,aAAc,OAAO,EAAE,aAAa,MAAM,KAAG,MACc,CAAC;AAEvG,gEAAgE;AAChE,eAAO,MAAM,+BAA+B,aAAc,OAAO,EAAE,aAAa,MAAM,KAAG,MACc,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RETAINED_EARNINGS_ACCOUNT, DIVIDEND_PAYABLE_ACCOUNT, CIT_PAYABLE_ACCOUNT, SHARE_CAPITAL_ACCOUNT, RESERVE_CAPITAL_ACCOUNT, DEFAULT_OTHER_FINANCIAL_INCOME_ACCOUNT, DEFAULT_FX_GAIN_ACCOUNT, SECURITIES_INCOME_ACCOUNT, SECURITIES_EXPENSE_ACCOUNT, } from "./accounting-defaults.js";
|
|
1
|
+
import { RETAINED_EARNINGS_ACCOUNT, DIVIDEND_PAYABLE_ACCOUNT, CIT_PAYABLE_ACCOUNT, SHARE_CAPITAL_ACCOUNT, RESERVE_CAPITAL_ACCOUNT, CURRENT_YEAR_PROFIT_ACCOUNT, CALCULATED_RESULT_ACCOUNT, DEFAULT_OTHER_FINANCIAL_INCOME_ACCOUNT, DEFAULT_FX_GAIN_ACCOUNT, SECURITIES_INCOME_ACCOUNT, SECURITIES_EXPENSE_ACCOUNT, } from "./accounting-defaults.js";
|
|
2
2
|
/**
|
|
3
3
|
* Return the id (account number) of the lowest-numbered ACTIVE account whose
|
|
4
4
|
* Estonian name matches `pattern`, or undefined when none match. Inactive
|
|
@@ -32,6 +32,18 @@ export function resolveAccountByName(accounts, pattern, fallback, override) {
|
|
|
32
32
|
/** Retained earnings — "Eelmiste perioodide jaotamata kasum (kahjum)" (2960);
|
|
33
33
|
* anchored so "Jaotamata kasumi reserv" (a distributable reserve) is excluded. */
|
|
34
34
|
export const resolveRetainedEarningsAccount = (accounts, override) => resolveAccountByName(accounts, /^(eelmiste perioodide )?jaotamata kasum( \(kahjum\))?$/i, RETAINED_EARNINGS_ACCOUNT, override);
|
|
35
|
+
/** Current-year result — "Aruandeaasta kasum (kahjum)" (2970), the account
|
|
36
|
+
* RIK's year-end result entry credits with a closed year's profit; anchored so a
|
|
37
|
+
* suffixed sibling ("Aruandeaasta kasum erikonto") is excluded. */
|
|
38
|
+
export const resolveCurrentYearProfitAccount = (accounts, override) => resolveAccountByName(accounts, /^aruandeaasta kasum( \(kahjum\))?$/i, CURRENT_YEAR_PROFIT_ACCOUNT, override);
|
|
39
|
+
/** Calculated result — "Arvestuslik koondtulemus" (9000), the counter-account
|
|
40
|
+
* of RIK's year-end result entry (profit: D 9000 / K 2970). Not an income-
|
|
41
|
+
* statement line. */
|
|
42
|
+
export const resolveCalculatedResultAccount = (accounts, override) => resolveAccountByName(accounts, /^arvestuslik koondtulemus$/i, CALCULATED_RESULT_ACCOUNT, override);
|
|
43
|
+
/** Posting target for a statutory reserve-capital transfer — the lowest-numbered
|
|
44
|
+
* ACTIVE "Kohustuslik reservkapital" (2940). Unlike
|
|
45
|
+
* resolveRestrictedReserveAccounts (a balance read), this picks one account. */
|
|
46
|
+
export const resolveReserveCapitalAccount = (accounts, override) => resolveAccountByName(accounts, /^kohustuslik reservkapital$/i, RESERVE_CAPITAL_ACCOUNT, override);
|
|
35
47
|
/** Dividend payable — "Dividendivõlad" (2650). */
|
|
36
48
|
export const resolveDividendPayableAccount = (accounts, override) => resolveAccountByName(accounts, /^dividendiv[õo]lad$/i, DIVIDEND_PAYABLE_ACCOUNT, override);
|
|
37
49
|
/** Dividend income-tax payable — "Dividenditulumaksu võlg" (2656), not the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-resolution.js","sourceRoot":"","sources":["../src/account-resolution.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,EACvB,sCAAsC,EACtC,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,0BAA0B,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAmB,EAAE,OAAe;IACpE,OAAO,QAAQ;SACZ,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,KAAK,CAAC;SACjC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;SAC3C,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACd,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,QAAmB,EACnB,OAAe,EACf,QAAgB,EAChB,QAAiB;IAEjB,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC;IAC5C,OAAO,iBAAiB,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,QAAQ,CAAC;AAC1D,CAAC;AAED,iFAAiF;AACjF,iFAAiF;AACjF,yCAAyC;AAEzC,+EAA+E;AAC/E,6EAA6E;AAC7E,gFAAgF;AAChF,6BAA6B;AAE7B;kFACkF;AAClF,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,QAAmB,EAAE,QAAiB,EAAU,EAAE,CAC/F,oBAAoB,CAAC,QAAQ,EAAE,yDAAyD,EAAE,yBAAy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AC,MAAM,+BAA+B,GAAG,CAAC,QAAmB,EAAE,QAAiB,EAAU,EAAE,CAChG,oBAAoB,CAAC,QAAQ,EAAE,+BAA+B,EAAE,0BAA0B,EAAE,QAAQ,CAAC,CAAC"}
|
|
@@ -59,6 +59,13 @@ export declare const SHARE_CAPITAL_ACCOUNT = 2900;
|
|
|
59
59
|
export declare const RESERVE_CAPITAL_ACCOUNT = 2940;
|
|
60
60
|
/** Current year profit/loss (Aruandeaasta kasum/kahjum) */
|
|
61
61
|
export declare const CURRENT_YEAR_PROFIT_ACCOUNT = 2970;
|
|
62
|
+
/**
|
|
63
|
+
* Calculated result (Arvestuslik koondtulemus), standard chart 9000 — class
|
|
64
|
+
* Tulud, balance type D. Under RIK's e-arveldaja year-end method it is the
|
|
65
|
+
* counter-account of the result entry (profit: D 9000 / K 2970) and is NOT
|
|
66
|
+
* part of the income statement. Name-resolved first.
|
|
67
|
+
*/
|
|
68
|
+
export declare const CALCULATED_RESULT_ACCOUNT = 9000;
|
|
62
69
|
/** Other financial expenses (Muud finantskulud) */
|
|
63
70
|
export declare const DEFAULT_OTHER_FINANCIAL_EXPENSE_ACCOUNT = 8610;
|
|
64
71
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounting-defaults.d.ts","sourceRoot":"","sources":["../src/accounting-defaults.ts"],"names":[],"mappings":"AAAA,iFAAiF;AAEjF,6CAA6C;AAC7C,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAE9C,kCAAkC;AAClC,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC,wCAAwC;AACxC,eAAO,MAAM,6BAA6B,OAAO,CAAC;AAElD,wDAAwD;AACxD,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAEhD;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAE9C,mFAAmF;AACnF,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAE7C;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,OAA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;;GAQG;AACH,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAE1C;;;GAGG;AACH,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C,2DAA2D;AAC3D,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAEhD;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAE9C,mDAAmD;AACnD,eAAO,MAAM,uCAAuC,OAAO,CAAC;AAE5D;;;;;;;GAOG;AACH,eAAO,MAAM,sCAAsC,OAAO,CAAC;AAE3D;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C,4EAA4E;AAC5E,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAE9C;;;GAGG;AACH,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,0DAA0D;AAC1D,eAAO,MAAM,2BAA2B,UAA0F,CAAC"}
|
|
@@ -59,6 +59,13 @@ export const SHARE_CAPITAL_ACCOUNT = 2900;
|
|
|
59
59
|
export const RESERVE_CAPITAL_ACCOUNT = 2940;
|
|
60
60
|
/** Current year profit/loss (Aruandeaasta kasum/kahjum) */
|
|
61
61
|
export const CURRENT_YEAR_PROFIT_ACCOUNT = 2970;
|
|
62
|
+
/**
|
|
63
|
+
* Calculated result (Arvestuslik koondtulemus), standard chart 9000 — class
|
|
64
|
+
* Tulud, balance type D. Under RIK's e-arveldaja year-end method it is the
|
|
65
|
+
* counter-account of the result entry (profit: D 9000 / K 2970) and is NOT
|
|
66
|
+
* part of the income statement. Name-resolved first.
|
|
67
|
+
*/
|
|
68
|
+
export const CALCULATED_RESULT_ACCOUNT = 9000;
|
|
62
69
|
/** Other financial expenses (Muud finantskulud) */
|
|
63
70
|
export const DEFAULT_OTHER_FINANCIAL_EXPENSE_ACCOUNT = 8610;
|
|
64
71
|
/**
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AG,IAAI,CAAC;AAE5D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,IAAI,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAE5C,4EAA4E;AAC5E,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAE5C;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAE9C;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAE/C,0DAA0D;AAC1D,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,6BAA6B,EAAE,yBAAyB,EAAE,2BAA2B,CAAC,CAAC"}
|
|
@@ -58,11 +58,43 @@ export interface SaveAutoBookingRuleInput {
|
|
|
58
58
|
reversed_vat_id?: number;
|
|
59
59
|
reason?: string;
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
export declare function initAccountingRulesConnection(getter: () => {
|
|
61
|
+
interface AccountingRulesConnection {
|
|
63
62
|
name: string;
|
|
64
63
|
stableIdentity: string;
|
|
65
|
-
|
|
64
|
+
/** How many connections this server has configured (legacy-record gating). */
|
|
65
|
+
connectionCount?: number;
|
|
66
|
+
}
|
|
67
|
+
declare const AUTO_BOOKING_RULE_ACTION_FIELDS: readonly ["purchase_article_id", "purchase_account_id", "purchase_account_dimensions_id", "liability_account_id", "vat_rate_dropdown", "reversed_vat_id"];
|
|
68
|
+
export declare function initAccountingRulesConnection(getter: () => AccountingRulesConnection): void;
|
|
69
|
+
/**
|
|
70
|
+
* The active connection's stable identity (the same connection fingerprint the
|
|
71
|
+
* plan store scopes by) plus the configured connection count. Company-specific
|
|
72
|
+
* data files stored in the bundle (opening-balances.json,
|
|
73
|
+
* statement-balances.json) stamp this identity, because a bundle is NOT always
|
|
74
|
+
* per-connection: `EARVELDAJA_RULES_DIR` and the kept-in-place project/global
|
|
75
|
+
* bundle are shared by every connection of the server.
|
|
76
|
+
*/
|
|
77
|
+
export declare function getBundleRecordIdentity(): {
|
|
78
|
+
stableIdentity: string;
|
|
79
|
+
connectionCount: number;
|
|
80
|
+
};
|
|
81
|
+
export type BundleRecordIdentityVerdict = {
|
|
82
|
+
accept: true;
|
|
83
|
+
warning?: undefined;
|
|
84
|
+
} | {
|
|
85
|
+
accept: false;
|
|
86
|
+
warning: string;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Decide whether a bundle record stamped with `recordIdentity` belongs to the
|
|
90
|
+
* active connection. A record from another connection is refused. A legacy
|
|
91
|
+
* record without identity (written before identity stamping) is accepted when
|
|
92
|
+
* the server has exactly one connection, or when the bundle is the default
|
|
93
|
+
* per-connection hashed dir (private to this connection by construction). In a
|
|
94
|
+
* shared bundle with several connections it cannot be attributed, so it is
|
|
95
|
+
* refused with a warning (re-import it on the right connection to stamp it).
|
|
96
|
+
*/
|
|
97
|
+
export declare function checkBundleRecordIdentity(recordIdentity: unknown, label: string): BundleRecordIdentityVerdict;
|
|
66
98
|
export declare function sanitizeAccountingRulesConnectionName(name: string): string;
|
|
67
99
|
export declare function buildAccountingRulesConnectionScope(_name: string, stableIdentity: string): string;
|
|
68
100
|
/**
|
|
@@ -98,6 +130,11 @@ export declare function hasConcreteAutoBookingRuleBookingTarget(value: Partial<P
|
|
|
98
130
|
export declare function resetAccountingRulesCache(): void;
|
|
99
131
|
export declare function getAccountingRulesPath(): string;
|
|
100
132
|
export declare function resolveOpeningBalanceStorePath(): string | null;
|
|
133
|
+
/**
|
|
134
|
+
* Size-capped JSON read for bundle data files: refuse (before reading) a file
|
|
135
|
+
* above MAX_JSON_INPUT_SIZE so a runaway or planted file cannot exhaust memory.
|
|
136
|
+
*/
|
|
137
|
+
export declare function readBoundedBundleJson(path: string, label: string): unknown;
|
|
101
138
|
export declare function resolveStatementBalanceStorePath(): string | null;
|
|
102
139
|
export declare function saveAutoBookingRule(rawInput: SaveAutoBookingRuleInput): {
|
|
103
140
|
path: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounting-rules.d.ts","sourceRoot":"","sources":["../src/accounting-rules.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"accounting-rules.d.ts","sourceRoot":"","sources":["../src/accounting-rules.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,QAAA,MAAM,6BAA6B;;;EAAqC,CAAC;AACzE,QAAA,MAAM,sBAAsB;;;;EAAkD,CAAC;AAC/E,QAAA,MAAM,sBAAsB;;;;EAAsC,CAAC;AAEnE,QAAA,MAAM,yBAAyB;;;;;;;;;EAS7B,CAAC;AAcH,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;iBAQzB,CAAC;AA+BH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AACxF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAC1E,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAI9E,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;IACrD,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACxC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,C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