Skip to content

Open-source personal finance manager. Self-hosted, privacy-first.

feat(mcp): add transfer-pair tools (list candidates, propose link, propose unlink) (#1268)

Tássio Noronhae3eb0e8559d1
diff --git a/backend/mcp_server/tools/__init__.py b/backend/mcp_server/tools/__init__.py
index 2a7aebf3..e28cd3b7 100644
--- a/backend/mcp_server/tools/__init__.py
+++ b/backend/mcp_server/tools/__init__.py
@@ -15,4 +15,5 @@ from mcp_server.tools import ( # noqa: F401
lifecycle,
groups,
rules,
+ transfers,
)
diff --git a/backend/mcp_server/tools/transfers.py b/backend/mcp_server/tools/transfers.py
new file mode 100644
index 00000000..399aa671
--- /dev/null
+++ b/backend/mcp_server/tools/transfers.py
@@ -0,0 +1,325 @@
+"""Transfer-pair maintenance for the agent.
+
+Closes the transfer-matching dead end from the MCP: an agent can find
+likely counterparts for a transaction, preview and link a pair, and
+preview and unlink a pair, all inside the protocol. Reads reuse the
+existing service layer directly; writes follow the propose pattern
+(preview first, apply only on the external transport), so Securo's own
+runtime never writes through MCP.
+"""
+
+from __future__ import annotations
+
+from typing import Any
+
+from sqlalchemy import select
+from sqlalchemy.ext.asyncio import AsyncSession
+from sqlalchemy.orm import selectinload
+
+from app.models.account import Account
+from app.models.transaction import Transaction
+from app.services import transaction_service
+from app.services.transfer_detection_service import unlink_transfer_pair
+from mcp_server.auth import CallContext
+from mcp_server.registry import tool
+from mcp_server.tools._helpers import num, parse_uuid, parse_uuid_list, resolve_workspace_id
+from mcp_server.tools.proposals import _APPLY_FIELD, _PROPOSAL_PREFACE, _can_apply
+
+
+def _tx_summary(tx: Transaction, account_name: str | None) -> dict[str, Any]:
+ """Small, stable dict for one transfer leg (either side of a pair)."""
+ return {
+ "id": str(tx.id),
+ "description": tx.description,
+ "date": tx.date.isoformat() if tx.date else None,
+ "amount": num(tx.amount),
+ "currency": tx.currency,
+ "amount_primary": num(getattr(tx, "amount_primary", None)),
+ "type": tx.type,
+ "account_id": str(tx.account_id) if tx.account_id else None,
+ "account_name": account_name,
+ "category_id": str(tx.category_id) if tx.category_id else None,
+ "category_name": tx.category.name if tx.category else None,
+ "status": getattr(tx, "status", None),
+ "is_ignored": bool(getattr(tx, "is_ignored", False)),
+ }
+
+
+async def _account_names(session: AsyncSession, txs: list[Transaction]) -> dict:
+ """Batch-load account names for a set of transactions.
+
+ Keeps the payloads free of lazy loads: the service fetches do not all
+ selectinload the account relationship.
+ """
+ ids = {t.account_id for t in txs if t.account_id}
+ if not ids:
+ return {}
+ rows = (
+ await session.execute(select(Account).where(Account.id.in_(ids)))
+ ).scalars().all()
+ return {a.id: a.name for a in rows}
+
+
+@tool(
+ name="list_transfer_candidates",
+ description=(
+ "Read-only. Find likely transfer counterparts for one "
+ "transaction: other-account rows of the opposing type, not "
+ "already linked, within plus or minus window_days of the anchor "
+ "date, ranked by date proximity then primary-currency amount "
+ "closeness (so cross-currency pairs match well). Use it before "
+ "propose_link_transfer. If the anchor is already part of a pair, "
+ "returns that pair with linked=true instead of candidates."
+ ),
+ parameters={
+ "type": "object",
+ "properties": {
+ "transaction_id": {
+ "type": "string",
+ "format": "uuid",
+ "description": "The anchor transaction to find a counterpart for",
+ },
+ "window_days": {
+ "type": "integer",
+ "minimum": 1,
+ "maximum": 365,
+ "default": 30,
+ "description": "Date window on each side of the anchor date",
+ },
+ "limit": {
+ "type": "integer",
+ "minimum": 1,
+ "maximum": 50,
+ "default": 10,
+ "description": "Max candidates to return",
+ },
+ },
+ "required": ["transaction_id"],
+ "additionalProperties": False,
+ },
+ tags=["read", "transactions"],
+)
+async def list_transfer_candidates(
+ *,
+ session: AsyncSession,
+ ctx: CallContext,
+ transaction_id: str,
+ window_days: int = 30,
+ limit: int = 10,
+) -> dict[str, Any]:
+ anchor_id = parse_uuid(transaction_id)
+ if anchor_id is None:
+ return {"error": "transaction_id must be a uuid"}
+ # Hard cap regardless of what the LLM asks.
+ limit = max(1, min(int(limit), 50))
+ window = max(1, min(int(window_days), 365))
+ ws_id = await resolve_workspace_id(session, ctx)
+
+ anchor = await transaction_service.get_transaction(session, anchor_id, ws_id)
+ if anchor is None:
+ return {"error": "transaction not found in this workspace"}
+
+ names = await _account_names(session, [anchor])
+ anchor_summary = _tx_summary(anchor, names.get(anchor.account_id))
+
+ if anchor.transfer_pair_id is not None:
+ pair = await transaction_service.get_transfer_pair(session, ws_id, anchor_id)
+ pair_names = await _account_names(session, [pair]) if pair else {}
+ return {
+ "anchor": anchor_summary,
+ "linked": True,
+ "transfer_pair_id": str(anchor.transfer_pair_id),
+ "pair": _tx_summary(pair, pair_names.get(pair.account_id)) if pair else None,
+ "candidates": [],
+ }
+
+ candidates = await transaction_service.get_transfer_candidates(
+ session, ws_id, anchor_id, limit=limit, window_days=window
+ )
+ names = await _account_names(session, candidates)
+ return {
+ "anchor": anchor_summary,
+ "linked": False,
+ "window_days": window,
+ "limit": limit,
+ "candidates": [_tx_summary(c, names.get(c.account_id)) for c in candidates],
+ }
+
+
+@tool(
+ name="propose_link_transfer",
+ description=_PROPOSAL_PREFACE
+ + (
+ "Build a preview for linking two existing transactions as a "
+ "transfer pair (one debit, one credit, in different accounts; "
+ "amounts do not have to match). The preview shows both legs in "
+ "full, so the user can compare dates, amounts, and accounts "
+ "before confirming. Call list_transfer_candidates first unless "
+ "the user names both transactions explicitly. After applying, "
+ "the pair is treated as a transfer in reports and excluded "
+ "from income and expense totals."
+ ),
+ parameters={
+ "type": "object",
+ "properties": {
+ "transaction_ids": {
+ "type": "array",
+ "items": {"type": "string", "format": "uuid"},
+ "minItems": 2,
+ "maxItems": 2,
+ "description": "Exactly two transactions: one debit and one credit in different accounts",
+ },
+ "apply": _APPLY_FIELD,
+ },
+ "required": ["transaction_ids"],
+ "additionalProperties": False,
+ },
+ is_proposal=True,
+ tags=["propose", "transactions"],
+)
+async def propose_link_transfer(
+ *,
+ session: AsyncSession,
+ ctx: CallContext,
+ transaction_ids: list[str],
+ apply: bool = False,
+) -> dict[str, Any]:
+ ws_id = await resolve_workspace_id(session, ctx)
+ ids = parse_uuid_list(transaction_ids) or []
+ if len(ids) != 2:
+ return {"error": "pass exactly two transaction ids"}
+ if ids[0] == ids[1]:
+ return {"error": "cannot link a transaction to itself"}
+
+ rows = (
+ (
+ await session.execute(
+ select(Transaction)
+ .where(
+ Transaction.id.in_(ids),
+ Transaction.workspace_id == ws_id,
+ )
+ .options(
+ selectinload(Transaction.account),
+ selectinload(Transaction.category),
+ )
+ )
+ )
+ .scalars()
+ .all()
+ )
+ by_id = {t.id: t for t in rows}
+ txs = [by_id[i] for i in ids if i in by_id]
+ if len(txs) != 2:
+ return {"error": "one or both transactions not found in this workspace"}
+
+ # Re-run the service's validation so the preview reports conflicts
+ # instead of failing at apply time.
+ for tx in txs:
+ if tx.transfer_pair_id is not None:
+ return {
+ "error": "Transaction is already part of a transfer",
+ "transaction_id": str(tx.id),
+ "transfer_pair_id": str(tx.transfer_pair_id),
+ }
+ if txs[0].account_id == txs[1].account_id:
+ return {"error": "transactions must be in different accounts"}
+ if {tx.type for tx in txs} != {"debit", "credit"}:
+ return {"error": "transactions must be one debit and one credit"}
+
+ preview = {
+ "kind": "link_transfer",
+ "transaction_ids": [str(t.id) for t in txs],
+ "legs": [_tx_summary(t, t.account.name if t.account else None) for t in txs],
+ "apply_endpoint": "POST /api/transactions/link-transfer",
+ }
+
+ if _can_apply(ctx, apply):
+ try:
+ debit_tx, _ = await transaction_service.link_existing_as_transfer(
+ session, ws_id, ids
+ )
+ except ValueError as exc:
+ return {**preview, "error": str(exc)}
+ return {
+ **preview,
+ "applied": True,
+ "transfer_pair_id": str(debit_tx.transfer_pair_id),
+ }
+
+ return preview
+
+
+@tool(
+ name="propose_unlink_transfer",
+ description=_PROPOSAL_PREFACE
+ + (
+ "Build a preview for unlinking an existing transfer pair (undo "
+ "a previous link). Pass the transfer_pair_id returned by "
+ "propose_link_transfer or list_transfer_candidates. Both legs "
+ "become ordinary transactions again; amounts, dates, and every "
+ "other field are left untouched."
+ ),
+ parameters={
+ "type": "object",
+ "properties": {
+ "transfer_pair_id": {
+ "type": "string",
+ "format": "uuid",
+ "description": "The shared pair id carried by both legs of a linked transfer",
+ },
+ "apply": _APPLY_FIELD,
+ },
+ "required": ["transfer_pair_id"],
+ "additionalProperties": False,
+ },
+ is_proposal=True,
+ tags=["propose", "transactions"],
+)
+async def propose_unlink_transfer(
+ *,
+ session: AsyncSession,
+ ctx: CallContext,
+ transfer_pair_id: str,
+ apply: bool = False,
+) -> dict[str, Any]:
+ pair_id = parse_uuid(transfer_pair_id)
+ if pair_id is None:
+ return {"error": "transfer_pair_id must be a uuid"}
+ ws_id = await resolve_workspace_id(session, ctx)
+
+ legs = (
+ (
+ await session.execute(
+ select(Transaction)
+ .where(
+ Transaction.workspace_id == ws_id,
+ Transaction.transfer_pair_id == pair_id,
+ )
+ .options(
+ selectinload(Transaction.account),
+ selectinload(Transaction.category),
+ )
+ )
+ )
+ .scalars()
+ .all()
+ )
+ if not legs:
+ return {"error": "transfer pair not found in this workspace"}
+
+ preview = {
+ "kind": "unlink_transfer",
+ "transfer_pair_id": str(pair_id),
+ "legs": [_tx_summary(t, t.account.name if t.account else None) for t in legs],
+ "apply_endpoint": f"DELETE /api/connections/transfers/{pair_id}",
+ }
+
+ if _can_apply(ctx, apply):
+ unlinked = await unlink_transfer_pair(session, ws_id, pair_id)
+ if not unlinked:
+ return {**preview, "error": "transfer pair not found in this workspace"}
+ await session.commit()
+ return {**preview, "applied": True, "unlinked_count": unlinked}
+
+ return preview
diff --git a/backend/tests/test_mcp_transfer_tools.py b/backend/tests/test_mcp_transfer_tools.py
new file mode 100644
index 00000000..ef3ae9a5
--- /dev/null
+++ b/backend/tests/test_mcp_transfer_tools.py
@@ -0,0 +1,518 @@
+"""MCP transfer-pair tools: list candidates, propose link, propose unlink.
+
+Exercises the handlers directly with seeded data (same pattern as
+test_agents_mcp_tools.py). Covers the acceptance criteria from the
+issue: cross-workspace ids, missing ids, already-applied/idempotent
+states, and conflicting transfer state.
+"""
+import uuid
+from datetime import date, datetime, timedelta, timezone
+from decimal import Decimal
+
+import pytest_asyncio
+from sqlalchemy import select
+from sqlalchemy.ext.asyncio import AsyncSession
+
+# Importing this package registers all tools into mcp_server.registry.REGISTRY.
+import mcp_server.tools # noqa: F401
+from app.models.account import Account
+from app.models.transaction import Transaction
+from app.models.workspace import Workspace, WorkspaceMember
+from app.services import transaction_service
+from mcp_server.auth import CallContext
+from mcp_server.registry import REGISTRY
+
+
+@pytest_asyncio.fixture
+async def ctx(test_user) -> CallContext:
+ """Internal runtime context (Securo's own agent): can never apply."""
+ return CallContext(user_id=test_user.id, conversation_id=uuid.uuid4())
+
+
+@pytest_asyncio.fixture
+async def ext_ctx(test_user) -> CallContext:
+ """External MCP token context (Claude Desktop, n8n): may apply."""
+ return CallContext(user_id=test_user.id, conversation_id=uuid.uuid4(), external=True)
+
+
+@pytest_asyncio.fixture
+async def second_account(session: AsyncSession, test_user, test_connection) -> Account:
+ """A second account in the default workspace, for the other leg."""
+ account = Account(
+ id=uuid.uuid4(),
+ user_id=test_user.id,
+ connection_id=test_connection.id,
+ external_id="acc-ext-456",
+ name="Conta Poupanca",
+ type="savings",
+ balance=Decimal("1000.00"),
+ currency="BRL",
+ )
+ session.add(account)
+ await session.commit()
+ await session.refresh(account)
+ return account
+
+
+@pytest_asyncio.fixture
+async def other_workspace(session: AsyncSession, test_user) -> Workspace:
+ """A second workspace for the same user (newer, so it is NOT the default)."""
+ ws = Workspace(
+ id=uuid.uuid4(),
+ name="Outro Espaco",
+ kind="personal",
+ created_by_user_id=test_user.id,
+ default_currency="BRL",
+ locale="pt-BR",
+ )
+ session.add(ws)
+ await session.flush()
+ session.add(
+ WorkspaceMember(
+ id=uuid.uuid4(),
+ workspace_id=ws.id,
+ user_id=test_user.id,
+ role="owner",
+ )
+ )
+ await session.commit()
+ await session.refresh(ws)
+ return ws
+
+
+@pytest_asyncio.fixture
+async def other_account(
+ session: AsyncSession, test_user, test_connection, other_workspace
+) -> Account:
+ """An account that lives in the second workspace."""
+ account = Account(
+ id=uuid.uuid4(),
+ user_id=test_user.id,
+ connection_id=test_connection.id,
+ external_id="acc-ext-789",
+ name="Conta Outro Espaco",
+ type="checking",
+ balance=Decimal("500.00"),
+ currency="BRL",
+ workspace_id=other_workspace.id,
+ )
+ session.add(account)
+ await session.commit()
+ await session.refresh(account)
+ return account
+
+
+async def _mk_tx(
+ session: AsyncSession,
+ *,
+ user,
+ account: Account,
+ ws: Workspace,
+ description: str,
+ amount,
+ tx_type: str = "credit",
+ day_offset: int = 0,
+ source: str = "manual",
+) -> Transaction:
+ tx = Transaction(
+ id=uuid.uuid4(),
+ user_id=user.id,
+ workspace_id=getattr(ws, "id", ws),
+ account_id=account.id,
+ description=description,
+ amount=Decimal(str(amount)),
+ date=date.today() + timedelta(days=day_offset),
+ type=tx_type,
+ source=source,
+ currency="BRL",
+ created_at=datetime.now(timezone.utc),
+ )
+ session.add(tx)
+ await session.commit()
+ await session.refresh(tx)
+ return tx
+
+
+async def _fetch(session: AsyncSession, tx_id: uuid.UUID) -> Transaction:
+ result = await session.execute(select(Transaction).where(Transaction.id == tx_id))
+ return result.scalar_one()
+
+
+def _call(name: str):
+ return REGISTRY[name].handler
+
+
+# --- Registry shape ---------------------------------------------------------
+
+
+def test_registry_contains_transfer_tools():
+ for name in ("list_transfer_candidates", "propose_link_transfer", "propose_unlink_transfer"):
+ assert name in REGISTRY, f"missing tool: {name}"
+ assert REGISTRY["propose_link_transfer"].is_proposal is True
+ assert REGISTRY["propose_unlink_transfer"].is_proposal is True
+ assert REGISTRY["list_transfer_candidates"].is_proposal is False
+ # The propose tools carry the apply flag, the read tool does not.
+ assert "apply" in REGISTRY["propose_link_transfer"].parameters["properties"]
+ assert "apply" in REGISTRY["propose_unlink_transfer"].parameters["properties"]
+ assert "apply" not in REGISTRY["list_transfer_candidates"].parameters["properties"]
+
+
+# --- list_transfer_candidates -----------------------------------------------
+
+
+async def test_list_candidates_ranked(
+ session: AsyncSession, ctx: CallContext, test_user, test_account, second_account, other_workspace, other_account
+):
+ ws = test_account.workspace_id
+ anchor = await _mk_tx(session, user=test_user, account=test_account, ws=ws,
+ description="STORE A", amount="100.00", tx_type="debit")
+ exact = await _mk_tx(session, user=test_user, account=second_account, ws=ws,
+ description="SALARY 100", amount="100.00")
+ amount_off = await _mk_tx(session, user=test_user, account=second_account, ws=ws,
+ description="SALARY 90", amount="90.00")
+ date_off = await _mk_tx(session, user=test_user, account=second_account, ws=ws,
+ description="SALARY LATER", amount="100.00", day_offset=2)
+ # Decoys: same type, opening balance, already linked, outside window.
+ await _mk_tx(session, user=test_user, account=second_account, ws=ws,
+ description="STORE B", amount="100.00", tx_type="debit")
+ await _mk_tx(session, user=test_user, account=second_account, ws=ws,
+ description="OPENING CREDIT", amount="100.00", source="opening_balance")
+ d1 = await _mk_tx(session, user=test_user, account=test_account, ws=ws,
+ description="STORE C", amount="10.00", tx_type="debit", day_offset=1)
+ d2 = await _mk_tx(session, user=test_user, account=second_account, ws=ws,
+ description="SALARY 10", amount="10.00", day_offset=1)
+ await transaction_service.link_existing_as_transfer(session, ws, [d1.id, d2.id])
+ await _mk_tx(session, user=test_user, account=second_account, ws=ws,
+ description="SALARY FAR", amount="100.00", day_offset=40)
+ # Cross-workspace decoy: same shape, different workspace.
+ await _mk_tx(session, user=test_user, account=other_account, ws=other_workspace,
+ description="OTHER WORKSPACE CREDIT", amount="100.00")
+
+ result = await _call("list_transfer_candidates")(
+ session=session, ctx=ctx, transaction_id=str(anchor.id)
+ )
+ assert "error" not in result, result
+ assert result["linked"] is False
+ assert result["anchor"]["id"] == str(anchor.id)
+ ids = [c["id"] for c in result["candidates"]]
+ # Ranked by date proximity first, then primary-currency amount closeness.
+ assert ids == [str(exact.id), str(amount_off.id), str(date_off.id)], ids
+ # Each candidate carries the fields needed to compare both legs safely.
+ for cand in result["candidates"]:
+ for field in ("id", "description", "date", "amount", "currency",
+ "amount_primary", "type", "account_id", "account_name",
+ "category_id", "category_name", "status", "is_ignored"):
+ assert field in cand, f"missing field {field}"
+ assert all(c["type"] == "credit" for c in result["candidates"])
+ assert all(c["account_id"] == str(second_account.id) for c in result["candidates"])
+
+
+async def test_list_candidates_window_and_limit(
+ session: AsyncSession, ctx: CallContext, test_user, test_account, second_account
+):
+ ws = test_account.workspace_id
+ anchor = await _mk_tx(session, user=test_user, account=test_account, ws=ws,
+ description="STORE A", amount="100.00", tx_type="debit")
+ await _mk_tx(session, user=test_user, account=second_account, ws=ws,
+ description="SALARY 100", amount="100.00")
+ await _mk_tx(session, user=test_user, account=second_account, ws=ws,
+ description="SALARY 95", amount="95.00")
+ await _mk_tx(session, user=test_user, account=second_account, ws=ws,
+ description="SALARY WEEK", amount="100.00", day_offset=14)
+
+ narrow = await _call("list_transfer_candidates")(
+ session=session, ctx=ctx, transaction_id=str(anchor.id), window_days=1
+ )
+ # The 14-day-away candidate falls outside a 1-day window.
+ assert [c["description"] for c in narrow["candidates"]] == ["SALARY 100", "SALARY 95"]
+
+ limited = await _call("list_transfer_candidates")(
+ session=session, ctx=ctx, transaction_id=str(anchor.id), limit=1
+ )
+ assert len(limited["candidates"]) == 1
+
+
+async def test_list_candidates_anchor_cross_workspace(
+ session: AsyncSession, ctx: CallContext, test_user, other_workspace, other_account
+):
+ anchor = await _mk_tx(session, user=test_user, account=other_account, ws=other_workspace,
+ description="STORE A", amount="100.00", tx_type="debit")
+ result = await _call("list_transfer_candidates")(
+ session=session, ctx=ctx, transaction_id=str(anchor.id)
+ )
+ assert result == {"error": "transaction not found in this workspace"}
+
+
+async def test_list_candidates_unknown_anchor(session: AsyncSession, ctx: CallContext):
+ result = await _call("list_transfer_candidates")(
+ session=session, ctx=ctx, transaction_id=str(uuid.uuid4())
+ )
+ assert result == {"error": "transaction not found in this workspace"}
+
+
+async def test_list_candidates_already_linked(
+ session: AsyncSession, ctx: CallContext, test_user, test_account, second_account
+):
+ ws = test_account.workspace_id
+ d1 = await _mk_tx(session, user=test_user, account=test_account, ws=ws,
+ description="STORE A", amount="100.00", tx_type="debit")
+ d2 = await _mk_tx(session, user=test_user, account=second_account, ws=ws,
+ description="SALARY 100", amount="100.00")
+ await transaction_service.link_existing_as_transfer(session, ws, [d1.id, d2.id])
+
+ result = await _call("list_transfer_candidates")(
+ session=session, ctx=ctx, transaction_id=str(d1.id)
+ )
+ assert result["linked"] is True
+ assert result["candidates"] == []
+ assert result["transfer_pair_id"] == str(d1.transfer_pair_id)
+ assert result["pair"]["id"] == str(d2.id)
+ assert result["pair"]["account_name"] == second_account.name
+
+
+# --- propose_link_transfer ---------------------------------------------------
+
+
+async def _seed_linkable_pair(session, ctx_args) -> tuple[Transaction, Transaction]:
+ test_user, test_account, second_account = ctx_args
+ ws = test_account.workspace_id
+ debit = await _mk_tx(session, user=test_user, account=test_account, ws=ws,
+ description="STORE A", amount="100.00", tx_type="debit")
+ credit = await _mk_tx(session, user=test_user, account=second_account, ws=ws,
+ description="SALARY 100", amount="100.00")
+ return debit, credit
+
+
+async def test_propose_link_preview_does_not_write(
+ session: AsyncSession, ctx: CallContext, test_user, test_account, second_account
+):
+ debit, credit = await _seed_linkable_pair(
+ session, (test_user, test_account, second_account)
+ )
+ result = await _call("propose_link_transfer")(
+ session=session, ctx=ctx,
+ transaction_ids=[str(debit.id), str(credit.id)],
+ )
+ assert "error" not in result, result
+ assert result["kind"] == "link_transfer"
+ assert "applied" not in result
+ assert result["apply_endpoint"] == "POST /api/transactions/link-transfer"
+ legs = {leg["id"]: leg for leg in result["legs"]}
+ assert legs[str(debit.id)]["type"] == "debit"
+ assert legs[str(credit.id)]["type"] == "credit"
+ assert legs[str(debit.id)]["account_name"] == test_account.name
+ assert legs[str(credit.id)]["account_name"] == second_account.name
+ # Nothing was written.
+ for tx in (debit, credit):
+ fresh = await _fetch(session, tx.id)
+ assert fresh.transfer_pair_id is None
+
+
+async def test_propose_link_apply_external_writes(
+ session: AsyncSession, ext_ctx: CallContext, test_user, test_account, second_account
+):
+ debit, credit = await _seed_linkable_pair(
+ session, (test_user, test_account, second_account)
+ )
+ result = await _call("propose_link_transfer")(
+ session=session, ctx=ext_ctx,
+ transaction_ids=[str(debit.id), str(credit.id)], apply=True,
+ )
+ assert "error" not in result, result
+ assert result["applied"] is True
+ pair_id = result["transfer_pair_id"]
+ fresh_debit = await _fetch(session, debit.id)
+ fresh_credit = await _fetch(session, credit.id)
+ assert str(fresh_debit.transfer_pair_id) == pair_id
+ assert str(fresh_credit.transfer_pair_id) == pair_id
+
+
+async def test_propose_link_internal_cannot_apply(
+ session: AsyncSession, ctx: CallContext, test_user, test_account, second_account
+):
+ debit, credit = await _seed_linkable_pair(
+ session, (test_user, test_account, second_account)
+ )
+ result = await _call("propose_link_transfer")(
+ session=session, ctx=ctx,
+ transaction_ids=[str(debit.id), str(credit.id)], apply=True,
+ )
+ # Internal runtime: apply is silently ignored, preview only, no write.
+ assert "applied" not in result
+ assert result["kind"] == "link_transfer"
+ for tx in (debit, credit):
+ fresh = await _fetch(session, tx.id)
+ assert fresh.transfer_pair_id is None
+
+
+async def test_propose_link_validation_errors(
+ session: AsyncSession, ctx: CallContext, test_user, test_account, second_account,
+ other_workspace, other_account,
+):
+ ws = test_account.workspace_id
+ same_acc_1 = await _mk_tx(session, user=test_user, account=test_account, ws=ws,
+ description="STORE A", amount="100.00", tx_type="debit")
+ same_acc_2 = await _mk_tx(session, user=test_user, account=test_account, ws=ws,
+ description="STORE B", amount="100.00", tx_type="credit")
+ same_type_1 = await _mk_tx(session, user=test_user, account=test_account, ws=ws,
+ description="STORE C", amount="50.00", tx_type="debit")
+ same_type_2 = await _mk_tx(session, user=test_user, account=second_account, ws=ws,
+ description="STORE D", amount="50.00", tx_type="debit")
+ other_ws_tx = await _mk_tx(session, user=test_user, account=other_account,
+ ws=other_workspace, description="STORE E", amount="100.00",
+ tx_type="credit")
+
+ # Same account.
+ r = await _call("propose_link_transfer")(
+ session=session, ctx=ctx,
+ transaction_ids=[str(same_acc_1.id), str(same_acc_2.id)])
+ assert r["error"] == "transactions must be in different accounts"
+ # Same type.
+ r = await _call("propose_link_transfer")(
+ session=session, ctx=ctx,
+ transaction_ids=[str(same_type_1.id), str(same_type_2.id)])
+ assert r["error"] == "transactions must be one debit and one credit"
+ # Self link.
+ r = await _call("propose_link_transfer")(
+ session=session, ctx=ctx,
+ transaction_ids=[str(same_acc_1.id), str(same_acc_1.id)])
+ assert r["error"] == "cannot link a transaction to itself"
+ # Wrong number of ids.
+ r = await _call("propose_link_transfer")(
+ session=session, ctx=ctx, transaction_ids=[str(same_acc_1.id)])
+ assert r["error"] == "pass exactly two transaction ids"
+ r = await _call("propose_link_transfer")(
+ session=session, ctx=ctx,
+ transaction_ids=[str(same_acc_1.id), str(same_acc_2.id), str(same_type_1.id)])
+ assert r["error"] == "pass exactly two transaction ids"
+ # One leg in another workspace.
+ r = await _call("propose_link_transfer")(
+ session=session, ctx=ctx,
+ transaction_ids=[str(same_acc_1.id), str(other_ws_tx.id)])
+ assert r["error"] == "one or both transactions not found in this workspace"
+ # No writes happened anywhere.
+ for tx in (same_acc_1, same_acc_2, same_type_1, same_type_2):
+ fresh = await _fetch(session, tx.id)
+ assert fresh.transfer_pair_id is None
+
+
+async def test_propose_link_already_linked_preview_error(
+ session: AsyncSession, ctx: CallContext, test_user, test_account, second_account
+):
+ ws = test_account.workspace_id
+ d1 = await _mk_tx(session, user=test_user, account=test_account, ws=ws,
+ description="STORE A", amount="100.00", tx_type="debit")
+ d2 = await _mk_tx(session, user=test_user, account=second_account, ws=ws,
+ description="SALARY 100", amount="100.00")
+ await transaction_service.link_existing_as_transfer(session, ws, [d1.id, d2.id])
+ d3 = await _mk_tx(session, user=test_user, account=test_account, ws=ws,
+ description="STORE B", amount="200.00", tx_type="debit")
+
+ result = await _call("propose_link_transfer")(
+ session=session, ctx=ctx, transaction_ids=[str(d1.id), str(d3.id)]
+ )
+ assert result["error"] == "Transaction is already part of a transfer"
+ assert result["transaction_id"] == str(d1.id)
+ assert result["transfer_pair_id"] == str(d1.transfer_pair_id)
+
+
+async def test_propose_link_apply_is_idempotent_on_state(
+ session: AsyncSession, ext_ctx: CallContext, test_user, test_account, second_account
+):
+ debit, credit = await _seed_linkable_pair(
+ session, (test_user, test_account, second_account)
+ )
+ first = await _call("propose_link_transfer")(
+ session=session, ctx=ext_ctx,
+ transaction_ids=[str(debit.id), str(credit.id)], apply=True,
+ )
+ assert first["applied"] is True
+ pair_id = first["transfer_pair_id"]
+ # Re-applying the same preview fails on state, no second write.
+ second = await _call("propose_link_transfer")(
+ session=session, ctx=ext_ctx,
+ transaction_ids=[str(debit.id), str(credit.id)], apply=True,
+ )
+ assert second["error"] == "Transaction is already part of a transfer"
+ assert "applied" not in second
+ fresh_debit = await _fetch(session, debit.id)
+ assert str(fresh_debit.transfer_pair_id) == pair_id
+
+
+# --- propose_unlink_transfer -------------------------------------------------
+
+
+async def _seed_linked_pair(session, test_user, test_account, second_account):
+ ws = test_account.workspace_id
+ debit = await _mk_tx(session, user=test_user, account=test_account, ws=ws,
+ description="STORE A", amount="100.00", tx_type="debit")
+ credit = await _mk_tx(session, user=test_user, account=second_account, ws=ws,
+ description="SALARY 100", amount="100.00")
+ await transaction_service.link_existing_as_transfer(session, ws, [debit.id, credit.id])
+ return debit, credit
+
+
+async def test_propose_unlink_preview_does_not_write(
+ session: AsyncSession, ctx: CallContext, test_user, test_account, second_account
+):
+ debit, credit = await _seed_linked_pair(session, test_user, test_account, second_account)
+ result = await _call("propose_unlink_transfer")(
+ session=session, ctx=ctx, transfer_pair_id=str(debit.transfer_pair_id)
+ )
+ assert "error" not in result, result
+ assert result["kind"] == "unlink_transfer"
+ assert "applied" not in result
+ assert result["transfer_pair_id"] == str(debit.transfer_pair_id)
+ assert {leg["id"] for leg in result["legs"]} == {str(debit.id), str(credit.id)}
+ for tx in (debit, credit):
+ fresh = await _fetch(session, tx.id)
+ assert fresh.transfer_pair_id is not None
+
+
+async def test_propose_unlink_apply_external_writes(
+ session: AsyncSession, ext_ctx: CallContext, test_user, test_account, second_account
+):
+ debit, credit = await _seed_linked_pair(session, test_user, test_account, second_account)
+ pair_id = str(debit.transfer_pair_id)
+ result = await _call("propose_unlink_transfer")(
+ session=session, ctx=ext_ctx, transfer_pair_id=pair_id, apply=True
+ )
+ assert "error" not in result, result
+ assert result["applied"] is True
+ assert result["unlinked_count"] == 2
+ fresh_debit = await _fetch(session, debit.id)
+ fresh_credit = await _fetch(session, credit.id)
+ assert fresh_debit.transfer_pair_id is None
+ assert fresh_credit.transfer_pair_id is None
+
+
+async def test_propose_unlink_unknown_pair(session: AsyncSession, ctx: CallContext):
+ result = await _call("propose_unlink_transfer")(
+ session=session, ctx=ctx, transfer_pair_id=str(uuid.uuid4())
+ )
+ assert result == {"error": "transfer pair not found in this workspace"}
+
+
+async def test_propose_unlink_cross_workspace(
+ session: AsyncSession, ctx: CallContext, test_user, other_workspace, other_account
+):
+ # A pair that only exists in the other workspace.
+ ws = other_workspace
+ debit = await _mk_tx(session, user=test_user, account=other_account, ws=ws,
+ description="STORE A", amount="100.00", tx_type="debit")
+ credit = await _mk_tx(session, user=test_user, account=other_account, ws=ws,
+ description="SALARY 100", amount="100.00")
+ # Manually share a pair id: the service refuses same-account links, so
+ # set the column directly for this scoping test.
+ pair_id = uuid.uuid4()
+ debit.transfer_pair_id = pair_id
+ credit.transfer_pair_id = pair_id
+ await session.commit()
+
+ result = await _call("propose_unlink_transfer")(
+ session=session, ctx=ctx, transfer_pair_id=str(pair_id)
+ )
+ assert result == {"error": "transfer pair not found in this workspace"}
+ # The other-workspace pair is untouched.
+ fresh = await _fetch(session, debit.id)
+ assert str(fresh.transfer_pair_id) == str(pair_id)
diff --git a/frontend/src/components/agents/proposal-card.test.tsx b/frontend/src/components/agents/proposal-card.test.tsx
new file mode 100644
index 00000000..9918b02e
--- /dev/null
+++ b/frontend/src/components/agents/proposal-card.test.tsx
@@ -0,0 +1,101 @@
+import { screen, waitFor } from '@testing-library/react'
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+
+import { renderWithProviders } from '@/test/utils'
+import { isProposalData } from '@/lib/agent-proposals'
+
+const { linkTransfer, unlinkTransfer } = vi.hoisted(() => ({
+ linkTransfer: vi.fn(),
+ unlinkTransfer: vi.fn(),
+}))
+vi.mock('@/lib/api', () => ({
+ budgets: {},
+ categories: {},
+ goals: {},
+ recurring: {},
+ rules: {},
+ transactions: { linkTransfer, unlinkTransfer },
+}))
+vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn() } }))
+vi.mock('@/hooks/use-display-locale', () => ({ useDateLocale: () => 'en-GB' }))
+
+import { ProposalCard } from './proposal-card'
+
+const debitLeg = {
+ id: 'tx-debit',
+ description: 'Move to savings',
+ date: '2026-10-01',
+ amount: 250,
+ currency: 'USD',
+ type: 'debit',
+ account_name: 'Checking',
+}
+const creditLeg = {
+ id: 'tx-credit',
+ description: 'From checking',
+ date: '2026-10-02',
+ amount: 250,
+ currency: 'USD',
+ type: 'credit',
+ account_name: 'Savings',
+}
+
+describe('ProposalCard transfer kinds', () => {
+ beforeEach(() => {
+ localStorage.clear()
+ linkTransfer.mockReset()
+ unlinkTransfer.mockReset()
+ })
+
+ it('treats the transfer tool previews as proposals', () => {
+ expect(isProposalData({ kind: 'link_transfer' })).toBe(true)
+ expect(isProposalData({ kind: 'unlink_transfer' })).toBe(true)
+ })
+
+ it('shows both legs of a link preview and links them on Apply', async () => {
+ linkTransfer.mockResolvedValue({ transfer_pair_id: 'pair-1' })
+ const { user } = renderWithProviders(
+ <ProposalCard
+ toolCallId="call-link"
+ data={{
+ kind: 'link_transfer',
+ // Credit listed first: the card still reads from the debit side.
+ transaction_ids: ['tx-credit', 'tx-debit'],
+ legs: [creditLeg, debitLeg],
+ }}
+ />,
+ )
+
+ expect(screen.getByText('Link as transfer')).toBeInTheDocument()
+ const summary = screen.getByText(/Checking .*→ Savings/)
+ // Leg dates go through the shared date formatter in the viewer's date
+ // locale, not as the raw ISO string from the tool payload.
+ expect(summary.textContent).toContain('(01 Oct 2026)')
+ expect(summary.textContent).not.toContain('2026-10-01')
+
+ await user.click(screen.getByRole('button', { name: /Apply/ }))
+
+ await waitFor(() => expect(linkTransfer).toHaveBeenCalledWith(['tx-credit', 'tx-debit']))
+ })
+
+ it('unlinks the pair by its id on Apply', async () => {
+ unlinkTransfer.mockResolvedValue(undefined)
+ const { user } = renderWithProviders(
+ <ProposalCard
+ toolCallId="call-unlink"
+ data={{
+ kind: 'unlink_transfer',
+ transfer_pair_id: 'pair-9',
+ legs: [debitLeg, creditLeg],
+ }}
+ />,
+ )
+
+ expect(screen.getByText('Unlink transfer')).toBeInTheDocument()
+ expect(screen.getByText(/go back to regular transactions/)).toBeInTheDocument()
+
+ await user.click(screen.getByRole('button', { name: /Apply/ }))
+
+ await waitFor(() => expect(unlinkTransfer).toHaveBeenCalledWith('pair-9'))
+ })
+})
diff --git a/frontend/src/components/agents/proposal-card.tsx b/frontend/src/components/agents/proposal-card.tsx
index 9b2de4ea..84e8fe36 100644
--- a/frontend/src/components/agents/proposal-card.tsx
+++ b/frontend/src/components/agents/proposal-card.tsx
@@ -5,6 +5,8 @@ import { AlertCircle, Check, ChevronDown, ChevronRight, Loader2, Sparkles } from
import { toast } from 'sonner'
import { Button } from '@/components/ui/button'
import { cn } from '@/lib/utils'
+import { formatDate } from '@/lib/date-range-format'
+import { useDateLocale } from '@/hooks/use-display-locale'
import {
budgets,
categories,
@@ -14,7 +16,7 @@ import {
transactions,
} from '@/lib/api'
-import type { ProposalKind, ProposalData } from '@/lib/agent-proposals'
+import type { ProposalKind, ProposalData, TransferLeg } from '@/lib/agent-proposals'
interface Props {
toolCallId: string
@@ -39,6 +41,7 @@ function persistApplied(toolCallId: string, ref?: string) {
export function ProposalCard({ toolCallId, data }: Props) {
const { t } = useTranslation()
+ const dateLocale = useDateLocale()
const qc = useQueryClient()
const initiallyApplied = loadApplied()[toolCallId]
const [appliedAt, setAppliedAt] = useState<number | null>(initiallyApplied?.ts ?? null)
@@ -82,7 +85,7 @@ export function ProposalCard({ toolCallId, data }: Props) {
if (!data.kind) return null
const kind = data.kind
- const summary = renderSummary(kind, data, t)
+ const summary = renderSummary(kind, data, t, dateLocale)
const isApplied = appliedAt !== null
return (
@@ -161,7 +164,12 @@ function kindTitle(kind: ProposalKind, t: ReturnType<typeof useTranslation>['t']
return t(`agents.proposal.kind.${kind}`)
}
-function renderSummary(kind: ProposalKind, d: ProposalData, t: ReturnType<typeof useTranslation>['t']): string {
+function renderSummary(
+ kind: ProposalKind,
+ d: ProposalData,
+ t: ReturnType<typeof useTranslation>['t'],
+ dateLocale: string,
+): string {
const p = (d.proposed || {}) as Record<string, unknown>
const tgt = (d.target || {}) as Record<string, unknown>
switch (kind) {
@@ -230,11 +238,29 @@ function renderSummary(kind: ProposalKind, d: ProposalData, t: ReturnType<typeof
target: fmt(p.target_amount, p.currency),
deadline: p.deadline ? String(p.deadline) : '—',
})
+ case 'link_transfer':
+ case 'unlink_transfer': {
+ const legs = d.legs || []
+ // Debit first: money leaves that account and lands in the credit one.
+ const from = legs.find((l) => l.type === 'debit') ?? legs[0]
+ const to = legs.find((l) => l !== from)
+ return t(
+ kind === 'link_transfer' ? 'agents.proposal.summary.linkTransfer' : 'agents.proposal.summary.unlinkTransfer',
+ { from: legLabel(from, dateLocale), to: legLabel(to, dateLocale) },
+ )
+ }
default:
return ''
}
}
+function legLabel(leg: TransferLeg | undefined, dateLocale: string): string {
+ if (!leg) return '?'
+ const parts = [String(leg.account_name ?? leg.description ?? '?'), fmt(leg.amount, leg.currency)]
+ if (leg.date) parts.push(`(${formatDate(leg.date, dateLocale)})`)
+ return parts.join(' ')
+}
+
function fmt(amount: unknown, currency: unknown): string {
if (amount == null) return '?'
const n = typeof amount === 'number' ? amount : Number(amount) || 0
@@ -409,5 +435,14 @@ async function applyProposal(data: ProposalData): Promise<string | void> {
} as Parameters<typeof goals.create>[0])
return g.id
}
+ case 'link_transfer': {
+ const res = await transactions.linkTransfer(data.transaction_ids || [])
+ return res.transfer_pair_id
+ }
+ case 'unlink_transfer': {
+ const pairId = String(data.transfer_pair_id)
+ await transactions.unlinkTransfer(pairId)
+ return pairId
+ }
}
}
diff --git a/frontend/src/lib/agent-proposals.ts b/frontend/src/lib/agent-proposals.ts
index 70d85ab9..1cfa3dca 100644
--- a/frontend/src/lib/agent-proposals.ts
+++ b/frontend/src/lib/agent-proposals.ts
@@ -11,6 +11,19 @@ export type ProposalKind =
| 'update_recurring_transaction'
| 'cancel_recurring_transaction'
| 'create_goal'
+ | 'link_transfer'
+ | 'unlink_transfer'
+
+/** One leg of a transfer pair, as the transfer tools preview it. */
+export interface TransferLeg {
+ id: string
+ description?: string | null
+ date?: string | null
+ amount?: number | null
+ currency?: string | null
+ type?: string | null
+ account_name?: string | null
+}
export interface ProposalData {
kind?: ProposalKind
@@ -23,6 +36,9 @@ export interface ProposalData {
name_collision?: { id: string; name: string }
mode?: 'deactivate' | 'delete'
apply_endpoint?: string
+ transaction_ids?: string[]
+ transfer_pair_id?: string
+ legs?: TransferLeg[]
error?: string
}
@@ -35,7 +51,7 @@ export function isProposalData(data: unknown): data is ProposalData {
'create_rule', 'update_rule', 'delete_rule',
'create_transaction', 'create_recurring_transaction',
'update_recurring_transaction', 'cancel_recurring_transaction',
- 'create_goal',
+ 'create_goal', 'link_transfer', 'unlink_transfer',
].includes(k)
}
diff --git a/frontend/src/lib/date-range-format.test.ts b/frontend/src/lib/date-range-format.test.ts
index 636b7026..5e1c663a 100644
--- a/frontend/src/lib/date-range-format.test.ts
+++ b/frontend/src/lib/date-range-format.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest'
-import { formatDateRange } from './date-range-format'
+import { formatDate, formatDateRange } from './date-range-format'
describe('formatDateRange', () => {
it('formats a closed range with the year by default', () => {
@@ -27,3 +27,14 @@ describe('formatDateRange', () => {
expect(formatDateRange('2026-03-01', '2026-03-10', 'es-ES')).toMatch(/mar\.?/i)
})
})
+
+describe('formatDate', () => {
+ it('formats one ISO day the way a range formats each bound', () => {
+ expect(formatDate('2026-10-01', 'en-US')).toBe('Oct 01, 2026')
+ expect(formatDate('2026-10-01', 'en-US', { compact: true })).toBe('Oct 01')
+ })
+
+ it('follows the requested locale instead of echoing the ISO string', () => {
+ expect(formatDate('2026-10-01', 'en-GB')).toBe('01 Oct 2026')
+ })
+})
diff --git a/frontend/src/lib/date-range-format.ts b/frontend/src/lib/date-range-format.ts
index 7da46a97..ae94b013 100644
--- a/frontend/src/lib/date-range-format.ts
+++ b/frontend/src/lib/date-range-format.ts
@@ -17,13 +17,25 @@ export function formatDateRange(
locale: string,
{ compact = false }: { compact?: boolean } = {},
): string {
- const fmt = (iso: string) =>
- new Date(iso + 'T00:00:00').toLocaleDateString(locale, {
- day: '2-digit',
- month: 'short',
- ...(compact ? {} : { year: 'numeric' as const }),
- })
+ const fmt = (iso: string) => formatDate(iso, locale, { compact })
if (from && to) return `${fmt(from)} - ${fmt(to)}`
if (from) return `≥ ${fmt(from)}`
return `≤ ${fmt(to)}`
}
+
+/**
+ * One ISO date (`YYYY-MM-DD`) in the same shape `formatDateRange` uses for
+ * each bound, for places that show a single day. Parsed as local midnight so
+ * the day does not shift with the viewer's timezone.
+ */
+export function formatDate(
+ iso: string,
+ locale: string,
+ { compact = false }: { compact?: boolean } = {},
+): string {
+ return new Date(iso.slice(0, 10) + 'T00:00:00').toLocaleDateString(locale, {
+ day: '2-digit',
+ month: 'short',
+ ...(compact ? {} : { year: 'numeric' as const }),
+ })
+}
diff --git a/frontend/src/locales/cs.json b/frontend/src/locales/cs.json
index 60593938..d844e295 100644
--- a/frontend/src/locales/cs.json
+++ b/frontend/src/locales/cs.json
@@ -2817,7 +2817,9 @@
"create_recurring_transaction": "Přidat opakovanou transakci",
"update_recurring_transaction": "Upravit opakovanou transakci",
"cancel_recurring_transaction": "Zrušit opakovanou transakci",
- "create_goal": "Vytvořit cíl"
+ "create_goal": "Vytvořit cíl",
+ "link_transfer": "Propojit jako převod",
+ "unlink_transfer": "Zrušit propojení převodu"
},
"summary": {
"categorize": "{{count}} transakcí → {{category}}",
@@ -2833,7 +2835,9 @@
"updateRecurring": "{{description}} → {{changes}}",
"deactivateRecurring": "Zastavit budoucí výskyty „{{description}}“ (historie zůstane)",
"deleteRecurring": "Natrvalo smazat „{{description}}“",
- "createGoal": "„{{name}}“ — cílová částka {{target}}, termín {{deadline}}"
+ "createGoal": "„{{name}}“ — cílová částka {{target}}, termín {{deadline}}",
+ "linkTransfer": "{{from}} → {{to}}",
+ "unlinkTransfer": "{{from}} a {{to}} budou opět běžné transakce"
}
},
"conversation": {
diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json
index e1e95a2c..db3485ae 100644
--- a/frontend/src/locales/de.json
+++ b/frontend/src/locales/de.json
@@ -2662,7 +2662,9 @@
"create_recurring_transaction": "Wiederkehrende Transaktion hinzufügen",
"update_recurring_transaction": "Wiederkehrende Transaktion aktualisieren",
"cancel_recurring_transaction": "Wiederkehrende Transaktion kündigen",
- "create_goal": "Ziel erstellen"
+ "create_goal": "Ziel erstellen",
+ "link_transfer": "Als Überweisung verknüpfen",
+ "unlink_transfer": "Überweisung trennen"
},
"summary": {
"categorize": "{{count}} Transaktion(en) → {{category}}",
@@ -2674,7 +2676,9 @@
"updateRecurring": "{{description}} → {{changes}}",
"deactivateRecurring": "Zukünftige Vorkommen von “{{description}}” stoppen (Verlauf bleibt erhalten)",
"deleteRecurring": "“{{description}}” dauerhaft löschen",
- "createGoal": "“{{name}}” — Ziel {{target}}, Frist {{deadline}}"
+ "createGoal": "“{{name}}” — Ziel {{target}}, Frist {{deadline}}",
+ "linkTransfer": "{{from}} → {{to}}",
+ "unlinkTransfer": "{{from}} und {{to}} werden wieder normale Transaktionen"
}
},
"conversation": {
diff --git a/frontend/src/locales/el.json b/frontend/src/locales/el.json
index 03424ecc..0c768a5e 100644
--- a/frontend/src/locales/el.json
+++ b/frontend/src/locales/el.json
@@ -2661,7 +2661,9 @@
"create_recurring_transaction": "Προσθήκη επαναλαμβανόμενης συναλλαγής",
"update_recurring_transaction": "Ενημέρωση επαναλαμβανόμενης συναλλαγής",
"cancel_recurring_transaction": "Ακύρωση επαναλαμβανόμενης συναλλαγής",
- "create_goal": "Δημιουργία στόχου"
+ "create_goal": "Δημιουργία στόχου",
+ "link_transfer": "Σύνδεση ως μεταφορά",
+ "unlink_transfer": "Αποσύνδεση μεταφοράς"
},
"summary": {
"categorize": "{{count}} συναλλαγή(ές) → {{category}}",
@@ -2673,7 +2675,9 @@
"updateRecurring": "{{description}} → {{changes}}",
"deactivateRecurring": "Διακοπή μελλοντικών εμφανίσεων του «{{description}}» (διατήρηση ιστορικού)",
"deleteRecurring": "Οριστική διαγραφή του «{{description}}»",
- "createGoal": "«{{name}}» — στόχος {{target}}, προθεσμία {{deadline}}"
+ "createGoal": "«{{name}}» — στόχος {{target}}, προθεσμία {{deadline}}",
+ "linkTransfer": "{{from}} → {{to}}",
+ "unlinkTransfer": "{{from}} και {{to}} γίνονται ξανά κανονικές συναλλαγές"
}
},
"conversation": {
diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json
index f5b8072b..3d0e1b03 100644
--- a/frontend/src/locales/en.json
+++ b/frontend/src/locales/en.json
@@ -2661,7 +2661,9 @@
"create_recurring_transaction": "Add recurring transaction",
"update_recurring_transaction": "Update recurring transaction",
"cancel_recurring_transaction": "Cancel recurring transaction",
- "create_goal": "Create goal"
+ "create_goal": "Create goal",
+ "link_transfer": "Link as transfer",
+ "unlink_transfer": "Unlink transfer"
},
"summary": {
"categorize": "{{count}} transaction(s) → {{category}}",
@@ -2673,7 +2675,9 @@
"updateRecurring": "{{description}} → {{changes}}",
"deactivateRecurring": "Stop future occurrences of “{{description}}” (history kept)",
"deleteRecurring": "Permanently delete “{{description}}”",
- "createGoal": "“{{name}}” — target {{target}}, deadline {{deadline}}"
+ "createGoal": "“{{name}}” — target {{target}}, deadline {{deadline}}",
+ "linkTransfer": "{{from}} → {{to}}",
+ "unlinkTransfer": "{{from}} and {{to}} go back to regular transactions"
}
},
"conversation": {
diff --git a/frontend/src/locales/es.json b/frontend/src/locales/es.json
index a72dc61c..cee1d8be 100644
--- a/frontend/src/locales/es.json
+++ b/frontend/src/locales/es.json
@@ -2649,7 +2649,9 @@
"create_recurring_transaction": "Agregar transacción recurrente",
"update_recurring_transaction": "Actualizar transacción recurrente",
"cancel_recurring_transaction": "Cancelar transacción recurrente",
- "create_goal": "Crear objetivo"
+ "create_goal": "Crear objetivo",
+ "link_transfer": "Vincular como transferencia",
+ "unlink_transfer": "Desvincular transferencia"
},
"summary": {
"categorize": "{{count}} transacción(es) → {{category}}",
@@ -2661,7 +2663,9 @@
"updateRecurring": "{{description}} → {{changes}}",
"deactivateRecurring": "Detener las próximas ocurrencias de “{{description}}” (se conserva el historial)",
"deleteRecurring": "Eliminar permanentemente “{{description}}”",
- "createGoal": "“{{name}}” — objetivo {{target}}, fecha límite {{deadline}}"
+ "createGoal": "“{{name}}” — objetivo {{target}}, fecha límite {{deadline}}",
+ "linkTransfer": "{{from}} → {{to}}",
+ "unlinkTransfer": "{{from}} y {{to}} vuelven a ser transacciones normales"
}
},
"conversation": {
diff --git a/frontend/src/locales/fr.json b/frontend/src/locales/fr.json
index 603196de..70ff109f 100644
--- a/frontend/src/locales/fr.json
+++ b/frontend/src/locales/fr.json
@@ -2665,7 +2665,9 @@
"create_recurring_transaction": "Ajouter une transaction récurrente",
"update_recurring_transaction": "Mettre à jour une transaction récurrente",
"cancel_recurring_transaction": "Annuler une transaction récurrente",
- "create_goal": "Créer un objectif"
+ "create_goal": "Créer un objectif",
+ "link_transfer": "Lier comme virement",
+ "unlink_transfer": "Délier le virement"
},
"summary": {
"categorize": "{{count}} transaction(s) → {{category}}",
@@ -2677,7 +2679,9 @@
"updateRecurring": "{{description}} → {{changes}}",
"deactivateRecurring": "Arrêter les occurrences futures de « {{description}} » (historique conservé)",
"deleteRecurring": "Supprimer définitivement « {{description}} »",
- "createGoal": "« {{name}} » — cible {{target}}, échéance {{deadline}}"
+ "createGoal": "« {{name}} » — cible {{target}}, échéance {{deadline}}",
+ "linkTransfer": "{{from}} → {{to}}",
+ "unlinkTransfer": "{{from}} et {{to}} redeviennent des transactions ordinaires"
}
},
"conversation": {
diff --git a/frontend/src/locales/hi.json b/frontend/src/locales/hi.json
index edb4afbb..0ea8fcdb 100644
--- a/frontend/src/locales/hi.json
+++ b/frontend/src/locales/hi.json
@@ -2661,7 +2661,9 @@
"create_recurring_transaction": "आवर्ती लेन-देन जोड़ें",
"update_recurring_transaction": "आवर्ती लेन-देन अपडेट करें",
"cancel_recurring_transaction": "आवर्ती लेन-देन रद्द करें",
- "create_goal": "लक्ष्य बनाएँ"
+ "create_goal": "लक्ष्य बनाएँ",
+ "link_transfer": "ट्रांसफ़र के रूप में जोड़ें",
+ "unlink_transfer": "ट्रांसफ़र अलग करें"
},
"summary": {
"categorize": "{{count}} लेन-देन → {{category}}",
@@ -2673,7 +2675,9 @@
"updateRecurring": "{{description}} → {{changes}}",
"deactivateRecurring": "“{{description}}” की आगे की घटनाएँ रोकें (इतिहास रखा जाता है)",
"deleteRecurring": "“{{description}}” को स्थायी रूप से हटाएँ",
- "createGoal": "“{{name}}” — लक्ष्य {{target}}, समय-सीमा {{deadline}}"
+ "createGoal": "“{{name}}” — लक्ष्य {{target}}, समय-सीमा {{deadline}}",
+ "linkTransfer": "{{from}} → {{to}}",
+ "unlinkTransfer": "{{from}} और {{to}} फिर से सामान्य लेनदेन बन जाएँगे"
}
},
"conversation": {
diff --git a/frontend/src/locales/hu.json b/frontend/src/locales/hu.json
index 45a6414c..7d4c2539 100644
--- a/frontend/src/locales/hu.json
+++ b/frontend/src/locales/hu.json
@@ -2661,7 +2661,9 @@
"create_recurring_transaction": "Ismétlődő tranzakció hozzáadása",
"update_recurring_transaction": "Ismétlődő tranzakció frissítése",
"cancel_recurring_transaction": "Ismétlődő tranzakció leállítása",
- "create_goal": "Cél létrehozása"
+ "create_goal": "Cél létrehozása",
+ "link_transfer": "Összekapcsolás átvezetésként",
+ "unlink_transfer": "Átvezetés szétválasztása"
},
"summary": {
"categorize": "{{count}} tranzakció → {{category}}",
@@ -2673,7 +2675,9 @@
"updateRecurring": "{{description}} → {{changes}}",
"deactivateRecurring": "„{{description}}” jövőbeli előfordulásainak leállítása (az előzmények megmaradnak)",
"deleteRecurring": "„{{description}}” végleges törlése",
- "createGoal": "„{{name}}” — célösszeg: {{target}}, határidő: {{deadline}}"
+ "createGoal": "„{{name}}” — célösszeg: {{target}}, határidő: {{deadline}}",
+ "linkTransfer": "{{from}} → {{to}}",
+ "unlinkTransfer": "{{from}} és {{to}} ismét normál tranzakció lesz"
}
},
"conversation": {
diff --git a/frontend/src/locales/it.json b/frontend/src/locales/it.json
index adc86193..1af9cd21 100644
--- a/frontend/src/locales/it.json
+++ b/frontend/src/locales/it.json
@@ -2649,7 +2649,9 @@
"create_recurring_transaction": "Aggiungi transazione ricorrente",
"update_recurring_transaction": "Aggiorna transazione ricorrente",
"cancel_recurring_transaction": "Annulla transazione ricorrente",
- "create_goal": "Crea obiettivo"
+ "create_goal": "Crea obiettivo",
+ "link_transfer": "Collega come trasferimento",
+ "unlink_transfer": "Scollega trasferimento"
},
"summary": {
"categorize": "{{count}} transazione/i → {{category}}",
@@ -2661,7 +2663,9 @@
"updateRecurring": "{{description}} → {{changes}}",
"deactivateRecurring": "Interrompi le occorrenze future di “{{description}}” (cronologia mantenuta)",
"deleteRecurring": "Elimina definitivamente “{{description}}”",
- "createGoal": "“{{name}}” — obiettivo {{target}}, scadenza {{deadline}}"
+ "createGoal": "“{{name}}” — obiettivo {{target}}, scadenza {{deadline}}",
+ "linkTransfer": "{{from}} → {{to}}",
+ "unlinkTransfer": "{{from}} e {{to}} tornano transazioni normali"
}
},
"conversation": {
diff --git a/frontend/src/locales/ja.json b/frontend/src/locales/ja.json
index 3b052564..3b32a6a4 100644
--- a/frontend/src/locales/ja.json
+++ b/frontend/src/locales/ja.json
@@ -2661,7 +2661,9 @@
"create_recurring_transaction": "定期取引を追加",
"update_recurring_transaction": "定期取引を更新",
"cancel_recurring_transaction": "定期取引を中止",
- "create_goal": "目標を作成"
+ "create_goal": "目標を作成",
+ "link_transfer": "振替としてリンク",
+ "unlink_transfer": "振替のリンクを解除"
},
"summary": {
"categorize": "{{count}}件の取引 → {{category}}",
@@ -2673,7 +2675,9 @@
"updateRecurring": "{{description}} → {{changes}}",
"deactivateRecurring": "「{{description}}」の今後の発生を停止(履歴は保持)",
"deleteRecurring": "「{{description}}」を完全に削除",
- "createGoal": "「{{name}}」 — 目標{{target}}、期日{{deadline}}"
+ "createGoal": "「{{name}}」 — 目標{{target}}、期日{{deadline}}",
+ "linkTransfer": "{{from}} → {{to}}",
+ "unlinkTransfer": "{{from}} と {{to}} は通常の取引に戻ります"
}
},
"conversation": {
diff --git a/frontend/src/locales/nl.json b/frontend/src/locales/nl.json
index b3f3595c..32c8956f 100644
--- a/frontend/src/locales/nl.json
+++ b/frontend/src/locales/nl.json
@@ -2663,7 +2663,9 @@
"create_recurring_transaction": "Terugkerende transactie toevoegen",
"update_recurring_transaction": "Update terugkerende transactie",
"cancel_recurring_transaction": "Terugkerende transactie annuleren",
- "create_goal": "Doel creëren"
+ "create_goal": "Doel creëren",
+ "link_transfer": "Koppelen als overboeking",
+ "unlink_transfer": "Overboeking ontkoppelen"
},
"summary": {
"categorize": "{{count}} transactie(s) → {{category}}",
@@ -2675,7 +2677,9 @@
"updateRecurring": "{{description}} → {{changes}}",
"deactivateRecurring": "Stop toekomstige exemplaren van “{{description}}” (geschiedenis bewaard)",
"deleteRecurring": "“{{description}}” definitief verwijderen",
- "createGoal": "“{{name}}” — doel {{target}}, deadline {{deadline}}"
+ "createGoal": "“{{name}}” — doel {{target}}, deadline {{deadline}}",
+ "linkTransfer": "{{from}} → {{to}}",
+ "unlinkTransfer": "{{from}} en {{to}} worden weer gewone transacties"
}
},
"conversation": {
diff --git a/frontend/src/locales/pl.json b/frontend/src/locales/pl.json
index 69167d70..c5076c51 100644
--- a/frontend/src/locales/pl.json
+++ b/frontend/src/locales/pl.json
@@ -2752,7 +2752,9 @@
"create_recurring_transaction": "Dodaj transakcję cykliczną",
"update_recurring_transaction": "Zaktualizuj transakcję cykliczną",
"cancel_recurring_transaction": "Anuluj transakcję cykliczną",
- "create_goal": "Utwórz cel"
+ "create_goal": "Utwórz cel",
+ "link_transfer": "Połącz jako przelew",
+ "unlink_transfer": "Rozłącz przelew"
},
"summary": {
"categorize_one": "{{count}} transakcja → {{category}}",
@@ -2767,7 +2769,9 @@
"updateRecurring": "{{description}} → {{changes}}",
"deactivateRecurring": "Zatrzymaj przyszłe wystąpienia „{{description}}” (historia zachowana)",
"deleteRecurring": "Trwale usuń „{{description}}”",
- "createGoal": "„{{name}}” — cel {{target}}, termin {{deadline}}"
+ "createGoal": "„{{name}}” — cel {{target}}, termin {{deadline}}",
+ "linkTransfer": "{{from}} → {{to}}",
+ "unlinkTransfer": "{{from}} i {{to}} znów będą zwykłymi transakcjami"
}
},
"conversation": {
diff --git a/frontend/src/locales/pt-BR.json b/frontend/src/locales/pt-BR.json
index c480cab6..569174cf 100644
--- a/frontend/src/locales/pt-BR.json
+++ b/frontend/src/locales/pt-BR.json
@@ -2649,7 +2649,9 @@
"create_recurring_transaction": "Adicionar transação recorrente",
"update_recurring_transaction": "Atualizar transação recorrente",
"cancel_recurring_transaction": "Cancelar transação recorrente",
- "create_goal": "Criar meta"
+ "create_goal": "Criar meta",
+ "link_transfer": "Vincular como transferência",
+ "unlink_transfer": "Desvincular transferência"
},
"summary": {
"categorize": "{{count}} transação(ões) → {{category}}",
@@ -2661,7 +2663,9 @@
"updateRecurring": "{{description}} → {{changes}}",
"deactivateRecurring": "Parar futuras ocorrências de “{{description}}” (histórico mantido)",
"deleteRecurring": "Excluir permanentemente “{{description}}”",
- "createGoal": "“{{name}}” — meta {{target}}, prazo {{deadline}}"
+ "createGoal": "“{{name}}” — meta {{target}}, prazo {{deadline}}",
+ "linkTransfer": "{{from}} → {{to}}",
+ "unlinkTransfer": "{{from}} e {{to}} voltam a ser transações comuns"
}
},
"conversation": {
diff --git a/frontend/src/locales/pt-PT.json b/frontend/src/locales/pt-PT.json
index 2a4dba48..9ab1f70c 100644
--- a/frontend/src/locales/pt-PT.json
+++ b/frontend/src/locales/pt-PT.json
@@ -2649,7 +2649,9 @@
"create_recurring_transaction": "Adicionar transação recorrente",
"update_recurring_transaction": "Atualizar transação recorrente",
"cancel_recurring_transaction": "Cancelar transação recorrente",
- "create_goal": "Criar objetivo"
+ "create_goal": "Criar objetivo",
+ "link_transfer": "Associar como transferência",
+ "unlink_transfer": "Desassociar transferência"
},
"summary": {
"categorize": "{{count}} transação(ões) → {{category}}",
@@ -2661,7 +2663,9 @@
"updateRecurring": "{{description}} → {{changes}}",
"deactivateRecurring": "Parar futuras ocorrências de “{{description}}” (histórico mantido)",
"deleteRecurring": "Eliminar permanentemente “{{description}}”",
- "createGoal": "“{{name}}” — meta {{target}}, prazo {{deadline}}"
+ "createGoal": "“{{name}}” — meta {{target}}, prazo {{deadline}}",
+ "linkTransfer": "{{from}} → {{to}}",
+ "unlinkTransfer": "{{from}} e {{to}} voltam a ser transações normais"
}
},
"conversation": {
diff --git a/frontend/src/locales/ru.json b/frontend/src/locales/ru.json
index 57a189d0..420b62af 100644
--- a/frontend/src/locales/ru.json
+++ b/frontend/src/locales/ru.json
@@ -2678,7 +2678,9 @@
"create_recurring_transaction": "Добавить регулярную транзакцию",
"update_recurring_transaction": "Обновить регулярную транзакцию",
"cancel_recurring_transaction": "Отменить регулярную транзакцию",
- "create_goal": "Создать цель"
+ "create_goal": "Создать цель",
+ "link_transfer": "Связать как перевод",
+ "unlink_transfer": "Разорвать связь перевода"
},
"summary": {
"categorize": "{{count}} транзакций → {{category}}",
@@ -2690,7 +2692,9 @@
"updateRecurring": "{{description}} → {{changes}}",
"deactivateRecurring": "Остановить будущие повторения «{{description}}» (история сохранена)",
"deleteRecurring": "Навсегда удалить «{{description}}»",
- "createGoal": "«{{name}}» — цель {{target}}, срок {{deadline}}"
+ "createGoal": "«{{name}}» — цель {{target}}, срок {{deadline}}",
+ "linkTransfer": "{{from}} → {{to}}",
+ "unlinkTransfer": "{{from}} и {{to}} снова станут обычными операциями"
}
},
"conversation": {
diff --git a/frontend/src/locales/sk.json b/frontend/src/locales/sk.json
index 8120a0d0..5271be96 100644
--- a/frontend/src/locales/sk.json
+++ b/frontend/src/locales/sk.json
@@ -2801,7 +2801,9 @@
"create_recurring_transaction": "Pridať opakovanú transakciu",
"update_recurring_transaction": "Upraviť opakovanú transakciu",
"cancel_recurring_transaction": "Zrušiť opakovanú transakciu",
- "create_goal": "Vytvoriť cieľ"
+ "create_goal": "Vytvoriť cieľ",
+ "link_transfer": "Prepojiť ako prevod",
+ "unlink_transfer": "Zrušiť prepojenie prevodu"
},
"summary": {
"categorize": "{{count}} transakcií → {{category}}",
@@ -2817,7 +2819,9 @@
"updateRecurring": "{{description}} → {{changes}}",
"deactivateRecurring": "Zastaviť budúce výskyty „{{description}}“ (história zostane)",
"deleteRecurring": "Natrvalo vymazať „{{description}}“",
- "createGoal": "„{{name}}“ — cieľová suma {{target}}, termín {{deadline}}"
+ "createGoal": "„{{name}}“ — cieľová suma {{target}}, termín {{deadline}}",
+ "linkTransfer": "{{from}} → {{to}}",
+ "unlinkTransfer": "{{from}} a {{to}} budú opäť bežné transakcie"
}
},
"conversation": {
diff --git a/frontend/src/locales/uk.json b/frontend/src/locales/uk.json
index c5e07c1b..73a9cc58 100644
--- a/frontend/src/locales/uk.json
+++ b/frontend/src/locales/uk.json
@@ -2678,7 +2678,9 @@
"create_recurring_transaction": "Додати регулярну транзакцію",
"update_recurring_transaction": "Оновити регулярну транзакцію",
"cancel_recurring_transaction": "Скасувати регулярну транзакцію",
- "create_goal": "Створити ціль"
+ "create_goal": "Створити ціль",
+ "link_transfer": "Пов'язати як переказ",
+ "unlink_transfer": "Розірвати зв'язок переказу"
},
"summary": {
"categorize": "{{count}} транзакцій → {{category}}",
@@ -2690,7 +2692,9 @@
"updateRecurring": "{{description}} → {{changes}}",
"deactivateRecurring": "Зупинити майбутні повторення «{{description}}» (історія збережена)",
"deleteRecurring": "Назавжди видалити «{{description}}»",
- "createGoal": "«{{name}}» — ціль {{target}}, термін {{deadline}}"
+ "createGoal": "«{{name}}» — ціль {{target}}, термін {{deadline}}",
+ "linkTransfer": "{{from}} → {{to}}",
+ "unlinkTransfer": "{{from}} і {{to}} знову стануть звичайними операціями"
}
},
"conversation": {