@this-npm-test-org/connection-plaid 0.1.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/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # @this-npm-test-org/connection-plaid
2
+
3
+ Read-only bank account access via Plaid for amodal IR agents. Pulls transactions + balances for fund operating accounts so the reconcile-bank-activity intent can match observed bank movements against expected distributions and contributions.
4
+
5
+ The platform never moves money. JPMorgan (or whichever bank) executes the wires; this connection only reads the bank's record of what happened.
6
+
7
+ ## Auth
8
+
9
+ Set `PLAID_ACCESS_TOKEN` to the access_token obtained via Plaid Link.
10
+
11
+ For v1 local dev: one shared token works across all linked accounts on the Item. Production: one token per Item.
12
+
13
+ ## Tools generated
14
+
15
+ Auto-generated from the Plaid OpenAPI spec, scoped via `connections/plaid/spec.json` `filter.include_paths`:
16
+
17
+ - `plaid__transactions__sync` — incremental transaction sync
18
+ - `plaid__transactions__get` — date-range transaction fetch
19
+ - `plaid__accounts__get` — list accounts on the Item
20
+ - `plaid__accounts__balance__get` — real-time balance check
21
+ - `plaid__item__get` — Item + institution metadata
22
+
23
+ See `connections/plaid/access.json` for the field-restriction policy.
@@ -0,0 +1,72 @@
1
+ {
2
+ "endpoints": {
3
+ "POST /transactions/sync": {
4
+ "returns": ["added", "modified", "removed", "next_cursor", "has_more"]
5
+ },
6
+ "POST /transactions/get": {
7
+ "returns": ["transactions", "total_transactions", "accounts"]
8
+ },
9
+ "POST /accounts/get": {
10
+ "returns": ["accounts", "item"]
11
+ },
12
+ "POST /accounts/balance/get": {
13
+ "returns": ["accounts"]
14
+ },
15
+ "POST /item/get": {
16
+ "returns": ["item", "status"]
17
+ }
18
+ },
19
+ "fieldRestrictions": [
20
+ {
21
+ "entity": "account",
22
+ "field": "account_id",
23
+ "policy": "retrieve",
24
+ "sensitivity": "low",
25
+ "reason": "Plaid-internal id, safe to log"
26
+ },
27
+ {
28
+ "entity": "account",
29
+ "field": "mask",
30
+ "policy": "retrieve",
31
+ "sensitivity": "low",
32
+ "reason": "Last-four digits only — what's already shown on packets and wire instructions"
33
+ },
34
+ {
35
+ "entity": "account",
36
+ "field": "official_name",
37
+ "policy": "retrieve",
38
+ "sensitivity": "low",
39
+ "reason": "Bank-issued display name, safe"
40
+ },
41
+ {
42
+ "entity": "transaction",
43
+ "field": "merchant_name",
44
+ "policy": "retrieve",
45
+ "sensitivity": "low",
46
+ "reason": "Counterparty name — needed for matching"
47
+ },
48
+ {
49
+ "entity": "transaction",
50
+ "field": "location",
51
+ "policy": "never_retrieve",
52
+ "sensitivity": "PII",
53
+ "reason": "Geolocation isn't needed for fund-account reconciliation"
54
+ },
55
+ {
56
+ "entity": "transaction",
57
+ "field": "personal_finance_category",
58
+ "policy": "retrieve",
59
+ "sensitivity": "low",
60
+ "reason": "Plaid's categorization — helps the matcher disambiguate"
61
+ }
62
+ ],
63
+ "rowScoping": {
64
+ "accounts": {
65
+ "account_id": {
66
+ "type": "explicit",
67
+ "label": "Only accounts the operator has connected via Plaid Link",
68
+ "from": "fund_bank_accounts.plaid_account_id"
69
+ }
70
+ }
71
+ }
72
+ }
@@ -0,0 +1,13 @@
1
+ # Entities
2
+
3
+ ## Item
4
+ A connected institution (one row per bank the operator has linked via Plaid Link). Maps 1:N to accounts.
5
+
6
+ ## Account
7
+ A specific bank account on an Item. Plaid's `account_id` joins to `fund_bank_accounts.plaid_account_id`. The `mask` is the last 4 of the account number — what's already printed on packets and stored as `account_number_last4`.
8
+
9
+ ## Transaction
10
+ A posted (or pending) bank movement. The reconciler reads these and writes one `bank_transactions` row per posted transaction. `amount` is positive for debits (money out) in Plaid's convention; the reconciler normalizes to `direction: "debit" | "credit"` on the way in.
11
+
12
+ ## Cursor
13
+ A per-account opaque token tracking the last successful sync point. Stored on `fund_bank_accounts` directly (one cursor per account is sufficient for v1).
@@ -0,0 +1,19 @@
1
+ # Rules
2
+
3
+ ## Read-only, by design
4
+ - The platform never moves money. Plaid here is *only* for reading the bank's record of what happened. Any future write-side path (ACH initiation via `processor/*`, balance-locking, etc.) is a separate decision and should not be added by widening this connection's filter.
5
+
6
+ ## Rate limits
7
+ - Plaid throttles at the per-Item level. Default development tier is generous (no published per-minute cap), but production institutions can rate-limit `/transactions/sync` to ~5 rps per Item.
8
+ - The reconciler runs hourly (`sync.frequency = hourly` in spec.json). For local dev, the operator can call it on demand via the "Reconcile now" button on /distributions.
9
+
10
+ ## Cursor management
11
+ - `/transactions/sync` is cursor-based. The reconciler stores the latest `next_cursor` keyed by `fund_bank_accounts.account_id` (today: in the account row itself; future: a dedicated cursor table if multiple consumers need it).
12
+ - After a re-link (the operator runs Plaid Link again because the token expired), the cursor must be cleared — Plaid issues a new Item id under the hood.
13
+
14
+ ## Matching policy
15
+ - The reconciler does NOT auto-confirm transactions it can't unambiguously match. Ambiguous cases (multiple distributions of the same amount on the same day) become `unmatched_bank_transaction` suggestions for human review.
16
+ - When the matcher flips a distribution `approved → confirmed`, attribution is `confirmed_by: "plaid:reconciler"`. The operator can still manually mark sent/confirmed before the reconciler runs — manual flips are not overwritten.
17
+
18
+ ## What an LP can see
19
+ - Nothing. This connection is operator-side. LP-facing portal screens do not surface raw Plaid data; they show capital-account roll-forwards derived from the (post-reconciled) distribution + contribution rows.
@@ -0,0 +1,27 @@
1
+ {
2
+ "description": "Read-only bank transactions, balances, and account metadata via Plaid. Used by reconcile-bank-activity to match wire activity against expected distributions and contributions.",
3
+ "type": "connection",
4
+ "specUrl": "https://raw.githubusercontent.com/plaid/plaid-openapi/master/2020-09-14.yml",
5
+ "format": "openapi",
6
+ "auth": {
7
+ "type": "bearer",
8
+ "token": "env:PLAID_ACCESS_TOKEN",
9
+ "header": "Authorization",
10
+ "prefix": "Bearer"
11
+ },
12
+ "baseUrl": "https://production.plaid.com",
13
+ "sync": {
14
+ "auto": true,
15
+ "frequency": "hourly",
16
+ "notify_drift": false
17
+ },
18
+ "filter": {
19
+ "include_paths": [
20
+ "/transactions/sync",
21
+ "/transactions/get",
22
+ "/accounts/get",
23
+ "/accounts/balance/get",
24
+ "/item/get"
25
+ ]
26
+ }
27
+ }
@@ -0,0 +1,21 @@
1
+ ## Included
2
+
3
+ ### POST /transactions/sync
4
+ Cursor-based incremental sync of bank transactions. The reconciler calls this on a cadence to pull added/modified/removed activity since the last cursor.
5
+
6
+ ### POST /transactions/get
7
+ Date-range fetch of transactions. Fallback path when a cursor is unavailable (first sync, or after an Item re-link).
8
+
9
+ ### POST /accounts/get
10
+ List the accounts associated with an Item (the LP's or fund's connected bank). Used to map a Plaid account_id to a fund_bank_accounts row.
11
+
12
+ ### POST /accounts/balance/get
13
+ Real-time balance check. Read by the dashboard when an operator wants to see fund cash before approving a distribution.
14
+
15
+ ### POST /item/get
16
+ Item metadata + the institution it belongs to (e.g. "JPMorgan Chase"). Used to populate the bank_name on a fund_bank_accounts row.
17
+
18
+ ## Excluded
19
+
20
+ - `/auth/get`, `/identity/get`, `/processor/*` — these are write-adjacent / payment-rail surfaces. The platform doesn't initiate transfers; JPMorgan does. We only need read-only.
21
+ - `/link/token/create` — handled out-of-band. The operator runs Plaid Link once per account, exchanges the public_token for an access_token, and pastes that into PLAID_ACCESS_TOKEN. Not an agent-side tool.
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@this-npm-test-org/connection-plaid",
3
+ "version": "0.1.0",
4
+ "files": [
5
+ "connections"
6
+ ],
7
+ "description": "Read-only bank account access via Plaid. Pulls transactions + balances for fund operating accounts so the reconcile-bank-activity intent can match observed bank movements against expected distributions and contributions.",
8
+ "amodal": {
9
+ "name": "plaid",
10
+ "contains": ["connections"],
11
+ "tags": ["connection", "banking", "read-only"],
12
+ "description": "Read-only bank transaction + balance sync via Plaid. The platform never moves money; this connection only reads activity off the bank account so the reconciler can flip distribution/contribution status from approved → confirmed when the wire actually lands.",
13
+ "auth": {
14
+ "type": "bearer",
15
+ "envVars": {
16
+ "PLAID_ACCESS_TOKEN": "Plaid access_token obtained via Plaid Link. Per-account in production; one shared token is fine for v1 local."
17
+ }
18
+ },
19
+ "displayName": "Plaid",
20
+ "icon": "https://cdn.simpleicons.org/plaid",
21
+ "category": "Banking",
22
+ "oauth": null
23
+ }
24
+ }