Skip to content

Circle wallet migration#23

Merged
AaronUppal-AI merged 2 commits into
mainfrom
circle-wallet-migration
May 23, 2026
Merged

Circle wallet migration#23
AaronUppal-AI merged 2 commits into
mainfrom
circle-wallet-migration

Conversation

@AaronUppal-AI

Copy link
Copy Markdown
Owner

Summary

Describe the changes introduced by this PR.

Related issues

  • Fixes: #

Checklist

  • I updated the documentation if necessary
  • I added tests that prove my fix is effective or that my feature works
  • All new and existing tests pass

AaronUppal-AI and others added 2 commits May 23, 2026 14:36
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
#15 — Fix stale Base Sepolia/BaseScan references (demo-blocker)
  - publish.js: chain label updated to ARC-TESTNET (Circle), no broken link
  - history.js: removed BaseScan URL, tx hash shown as plain text
  - README: fixed wallet section heading and receipt description

#14 — Auto-retry with backoff on Circle transaction failures
  - payment.js: retryWithBackoff() helper (2 attempts, 5s linear backoff)
  - idempotencyKey (randomUUID) on createTransaction prevents double-spend on retry
  - Non-retryable errors (DENIED, INSUFFICIENT_FUNDS) bypass retry immediately
  - Emits shop3.payment.tx.retried metric

#12 — Pre-flight wallet status banner at agent startup
  - payment.js: getWalletStatus() fetches USDC balance + spend today (non-fatal)
  - agent.js: 5-line banner printed before first tool call (wallet, balance,
    daily cap, spent today, network)

#11 — Structured extraction schema in search middleware
  - server.js: accepts ?schema={"fields":["name","price","url",...]} param
  - Field whitelist enforced (name, price, url, rating, vendor, description)
  - Extraction batched into one claude-haiku-4-5 call per query
  - agent.js: search_web tool exposes optional schema field
  - search.js: passes schema through to middleware URL

#10 — ClickHouse analytics schema + aggregation queries
  - memory.js: 4 new columns (nimble_results_count, total_latency_ms,
    tools_invoked Array(String), price_usd); ALTER TABLE IF NOT EXISTS is idempotent
  - agent.js: captures and writes all 4 new fields at log_to_database step
  - history.js: --stats mode runs 3 ClickHouse aggregations (top domains,
    tools distribution, 7-day spend summary); npm run history:stats

#9 — Document spend guard direction
  - README: "Spend Guard" section documents Option A (ClickHouse-backed JS guard)
    with honest scope statement

#8 — Harden 402 payment verification
  - server.js: verifyCirclePayment() now checks state, recipient address,
    amount (>= PAYMENT_PRICE), and chain — returns {ok, reason} not boolean
  - 402 response body distinguishes tx_not_found / not_confirmed /
    wrong_recipient / amount_too_low / wrong_chain / already_used

#7 — Make x402 middleware always-on
  - search.js: SERVER_MODE branch removed; agent always routes through
    SEARCH_MIDDLEWARE_URL; fails fast if env var is unset
  - server.js: nimbleSearch() lives here only (agent never calls Nimble directly)
  - index.js: SEARCH_MIDDLEWARE_URL added to REQUIRED_ENV; NIMBLE_API_KEY removed
  - .env.example: NIMBLE_API_KEY annotated as server-only

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@AaronUppal-AI AaronUppal-AI merged commit 0abc5ac into main May 23, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant