site-agent-pro 1.0.9 → 1.0.12

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 CHANGED
@@ -427,7 +427,7 @@ If you specifically need to test how a dApp interacts with the MetaMask UI, you
427
427
  The agent has built-in support for the Paystack API (Nigeria) to handle Naira payments and payouts. This enables "Agent-as-a-Service" monetization flows.
428
428
 
429
429
  ### Features
430
- - **Dedicated Virtual Accounts (DVA):** Automatically provisions a unique bank account number (Wema/GTB) for each agent persona.
430
+ - **Dedicated Virtual Accounts (DVA):** Provisions or reuses a real Nigerian bank account number (Wema/GTB) for the agent to receive payments.
431
431
  - **Naira Transfers:** Initiates outbound transfers to any Nigerian bank account via the Transfers API.
432
432
  - **Webhook Processing:** Securely handles `charge.success` and `transfer.success` events with HMAC-SHA512 verification.
433
433
  - **Zero-Dependency Client:** Uses Node 20+ native `fetch` (no `axios` required).
@@ -435,26 +435,65 @@ The agent has built-in support for the Paystack API (Nigeria) to handle Naira pa
435
435
  ### Quick Setup
436
436
  Configure Paystack in `.env`:
437
437
  ```bash
438
- PAYSTACK_SECRET_KEY=sk_test_...
439
- PAYSTACK_PUBLIC_KEY=pk_test_...
438
+ PAYSTACK_SECRET_KEY=sk_live_...
439
+ PAYSTACK_PUBLIC_KEY=pk_live_...
440
440
  PAYSTACK_DVA_PROVIDER=wema-bank
441
- PAYSTACK_AGENT_PHONE=+234... # Required for Live DVAs
441
+ PAYSTACK_AGENT_EMAIL=agent@example.com # Email of the Paystack customer that holds the DVA
442
+ PAYSTACK_AGENT_FIRST_NAME=Site
443
+ PAYSTACK_AGENT_LAST_NAME=Agent
444
+ PAYSTACK_AGENT_PHONE=+234... # Required for Live DVA creation
445
+ PAYSTACK_TRANSFER_ENABLED=false # Set to true only when ready for real transfers
446
+ ```
447
+
448
+ ### Reusing an Existing DVA (Recommended for Live Keys)
449
+
450
+ On startup, `getAgentAccount()` looks up the customer by `PAYSTACK_AGENT_EMAIL` first. If that customer already has a DVA on your Paystack account, it is returned immediately — **no new DVA is created**. This means you can point the agent at any existing Paystack customer and reuse their bank account number without provisioning anything new.
451
+
452
+ To find your existing DVAs:
453
+ ```bash
454
+ source .env && curl -s \
455
+ -H "Authorization: Bearer $PAYSTACK_SECRET_KEY" \
456
+ "https://api.paystack.co/dedicated_account" | python3 -m json.tool
457
+ ```
458
+
459
+ Then set `PAYSTACK_AGENT_EMAIL` to the email of whichever customer owns the DVA you want to use.
460
+
461
+ ### Settlement Timing & Balance
462
+
463
+ > **Important:** DVA receipts (money sent to the virtual account number) are **not immediately spendable**. Paystack settles DVA payments to your Paystack balance on a **T+1 business day** schedule.
464
+
465
+ Two funding strategies:
466
+
467
+ | Strategy | Receiving Account | Spend Delay |
468
+ |---|---|---|
469
+ | **DVA receipts** | Share the DVA account number | T+1 business day |
470
+ | **Pre-fund balance** | Fund via Paystack Dashboard → Fund Balance | Available immediately |
471
+
472
+ The agent's outbound transfers always draw from the **Paystack balance** (`source: 'balance'`), not the DVA directly. If you pre-fund the balance via the dashboard, the agent can spend immediately without waiting for settlement.
473
+
474
+ To check your current spendable balance:
475
+ ```bash
476
+ source .env && curl -s \
477
+ -H "Authorization: Bearer $PAYSTACK_SECRET_KEY" \
478
+ "https://api.paystack.co/balance" | python3 -m json.tool
442
479
  ```
443
480
 
444
481
  ### Autonomous Transfers & Verification
445
482
  The agent can autonomously fulfill payment requests and **verify incoming funds or tokens** using its direct API/on-chain access:
446
- - **Sending Naira**: When it encounters a task like "Pay the vendor ₦500," it extracts the bank details from the page and initiates a transfer using the `pay` action.
483
+ - **Sending Naira**: When it encounters a task like "Pay the vendor ₦500," it extracts the bank details from the page and initiates a transfer using the `pay` action with format `amount:bankCode:accountNumber` (e.g. `5000:058:0123456789`).
447
484
  - **Verifying Naira**: If tasked to "wait for payment before releasing tokens," the agent monitors its own Paystack transaction history. It will only proceed to click "Release" or "Confirm" once it sees the matching successful transaction in its account.
448
485
  - **Verifying Tokens**: If tasked to "confirm tokens have arrived before paying Naira," the agent monitors its actual on-chain wallet balance via its RPC connection. It ignores potentially fake website UIs and only pays once the blockchain confirms the receipt of funds.
449
486
 
450
487
  **Safety:** Transfers are only broadcast if `PAYSTACK_TRANSFER_ENABLED=true`. Otherwise, it performs a dry-run validation.
451
488
 
452
489
  ### Testing the Integration
453
- Run the standalone smoke test to verify your API keys and DVA provisioning:
490
+ Run the standalone smoke test to verify your API keys and DVA connectivity:
454
491
  ```bash
455
492
  npm run paystack:test
456
493
  ```
457
494
 
495
+ > **Note on live keys:** The smoke test's step 5 (transfer) uses a placeholder account number. On live keys, Paystack validates that the account exists at the specified bank — the test will fail at step 5 unless you replace `0123456789` with a real account. Steps 1–4 (environment, DVA, bank list, bank code resolution) are the meaningful validation checks.
496
+
458
497
  ---
459
498
 
460
499
 
package/dist/bin.js CHANGED
File without changes
@@ -28,7 +28,8 @@ export const PaystackDVASchema = z.object({
28
28
  bank: PaystackBankSchema,
29
29
  customer: PaystackCustomerSchema,
30
30
  active: z.boolean(),
31
- createdAt: z.string(),
31
+ createdAt: z.string().optional(), // returned by POST /dedicated_account
32
+ created_at: z.string().optional(), // returned by GET /dedicated_account (list)
32
33
  });
33
34
  // ─── Transfer Recipient ───────────────────────────────────────────────────────
34
35
  export const PaystackRecipientSchema = z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "site-agent-pro",
3
- "version": "1.0.9",
3
+ "version": "1.0.12",
4
4
  "type": "module",
5
5
  "description": "AI-powered browser agent that tests websites like a real user and produces evidence-based, scored reports.",
6
6
  "bin": {
@@ -17,6 +17,7 @@
17
17
  ],
18
18
  "scripts": {
19
19
  "build": "tsc -p tsconfig.json",
20
+ "postbuild": "chmod +x dist/bin.js",
20
21
  "prepublishOnly": "npm run build",
21
22
  "check": "tsc --noEmit -p tsconfig.json",
22
23
  "start": "node dist/cli/run.js",