Skip to content

Commit 29bc2a9

Browse files
jarrodwattsclaude
andauthored
Production-harden AGW: workspace restructure, delegated signing, and skill catalog (#4)
* feat: add Privy-backed delegated signer sessions * feat(app): add Privy delegated onboarding flow * Implement delegated AGW MCP signer onboarding * Use AGW address as canonical session wallet * Fix Privy wallet RPC: hex chain_id, chain_type, and error propagation Privy API requires chain_id as hex-prefixed string (0x2b74) not decimal (11124). Also adds missing chain_type field to RPC body and improves error parsing to surface actual Privy error messages through the proxy. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Replace AgwActionAdapter with AbstractClient from agw-client Use @abstract-foundation/agw-client's createAbstractClient directly with a custom EIP-1193 provider that routes signing RPCs to Privy's REST API. This replaces the manual transaction building in AgwActionAdapter with agw-client's native AA handling (tx preparation, EIP-712 signing, hook fetching, serialization, broadcasting). Key changes: - New src/agw/client.ts: custom transport + AbstractClient factory - Delete src/agw/actions.ts: fully replaced by AbstractClient - SessionManager.getAbstractClient(): lazy-cached client creation - All 7 tool handlers simplified to use AbstractClient methods - Privy RPC response: handle signature/signed_transaction/result fields - Privy signTypedData: strip caip2/chain_type, convert primaryType - Bundle agw-client via noExternal to fix broken ESM exports - Proxy route: strip caip2/chain_type for signTypedData forwarding Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Increase default policy expiry from 1 hour to 30 days Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: move agw runtime into workspace packages * chore: promote agw as the published product surface * chore: remove legacy runtime and stale repo artifacts * refactor: harden agw core command contracts * feat: align agw cli and extension surfaces * test: lock article parity behavior * chore: remove ZeroEx API integration and related artifacts This commit removes the `AGW_ZEROEX_API_KEY` from the public runtime configuration, deletes the ZeroEx configuration and quote adapter files, and updates related documentation and tests to reflect these changes. The `MYRIAD` app has also been removed from the app registry. * feat: add AGW CLI banner image and update README This commit introduces a new banner image for the AGW CLI and updates the README to include the banner at the top, enhancing the visual presentation of the project documentation. * Use live Portal data for AGW app discovery * Improve AGW installation and packaging guidance * Refresh shipped AGW skills for agent workflows * Restructure wallet read schemas and align public field paths Replace flat balance arrays with structured nativeBalance/tokenBalances objects, add tokenAddresses input, surface session and explorer context, and update all field-path references across docs and skills. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Harden Aborean discovery with exact-pair factory lookup Prefer direct getPool reads over DexScreener when an exact pair is named. Add factory query examples, clarify that DexScreener misses are not proof of absence, and align wallet field paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Update .gitignore to include additional file patterns * Rename CLI package from agw to agw-cli Rename the publishable CLI package directory, npm package name, binary entry point, and all references across source, configs, docs, and tests so the installed command becomes `agw-cli` and the npm identifier becomes `@abstract-foundation/agw-cli`. Also fix copy-button positioning in the companion app code blocks so the button stays pinned on horizontal scroll and gets a backdrop blur to avoid text overlap. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix publish workflow filter and session wizard chain resolution Address cursor bot PR feedback: 1. Update publish workflow pnpm filter from @abstract-foundation/agw to @abstract-foundation/agw-cli so releases actually publish. 2. Replace hardcoded abstractTestnet in useSessionWizardState with chain resolution from the store's chainId, set by SessionFlowClient on mount. Mainnet users were hitting the wrong chain for AGW account derivation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Remove duplicate lockfile and favicon causing Next.js conflicts Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Rename skills to gerund form per Anthropic naming conventions Adopt official gerund naming (`verb-ing-object`) for all shipped skills to improve discoverability and align with Anthropic's skill authoring best practices. Update all cross-references in app-catalog, tests, OpenAI agent YAML files, and README. Renames: - agw-auth-session → authenticating-with-agw - agw-wallet-reads → reading-agw-wallet - agw-tx-discipline → executing-agw-transactions - agw-portal-discovery → discovering-abstract-portal - protocol-aborean → trading-on-aborean Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add trading-on-uniswap skill for Uniswap V2+V3 swaps on Abstract New skill covering token swaps, price quotes, and basic LP operations via Uniswap V2 and V3 on Abstract mainnet and testnet. Includes all deployed contract addresses, function signatures, approval+swap batching patterns, V2 vs V3 decision guidance, slippage calculations, and error handling reference. Key content: - SKILL.md: swap workflow, V2/V3 decision tree, batching guide - references/contracts.md: all V2+V3 addresses (mainnet + testnet) - references/v2-entrypoints.md: router swap/quote/LP signatures - references/v3-entrypoints.md: SwapRouter02, QuoterV2, NFT manager Clarifies that agw tx calls requires raw hex calldata (not ABI-level args), while agw contract write supports ABI-level for readability. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add managing-agent-identity skill for ERC-8004 on Abstract New skill for AI agent identity registration and reputation management via the ERC-8004 Trustless Agents standard on Abstract. Covers both IdentityRegistry (agent registration, metadata, wallet management) and ReputationRegistry (feedback, summaries, revocation). Includes mainnet and testnet contract addresses (deterministic CREATE2 deploys identical across 20+ EVM chains), complete interface documentation, and the agentURI registration file schema. Key fix vs baseline: teaches correct `register(string agentURI)` signature — baselines hallucinate `registerAgent(address, string)` which would revert on-chain. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add bridging-to-abstract and building-on-abstract skills bridging-to-abstract: Covers native Ethereum bridge (L1↔L2 deposit/ withdrawal with timing and two-step finalization) and six third-party bridges (Relay, Jumper, Stargate, Symbiosis, thirdweb, deBridge). Includes Relay API for programmatic bridge quotes, bridge selection decision tree, and common failure troubleshooting. building-on-abstract: Developer onboarding skill covering project scaffolding (create-abstract-app), smart contract deployment via Foundry/Hardhat, AGW client and React SDK integration, paymaster development (General and Approval-Based flows), session keys with Policy Registry, and critical ZKsync VM EVM differences. Includes all 17 system contract addresses and network configuration. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add upvoting-on-abstract skill for Abstract Portal voting New skill for the on-chain AbstractVoting contract at 0x3b50de27506f0a8c1f4122a1e6f470009a76ce2a. Covers vote cost queries, remaining vote checks, casting votes (payable with correct value), checking vote counts per app/epoch, and epoch mechanics. Includes full verified contract ABI, error handling reference (InvalidValue, AlreadyVotedFor, UsedAllVotes, etc.), and the complete voting workflow from cost check through execution. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix ABI format in skills: use full JSON objects, not human-readable strings The AGW CLI schema validation requires ABI array elements to be JSON objects (with type, name, inputs, outputs, stateMutability fields), not human-readable strings like "function balanceOf(address) view returns (uint256)". The latter fails with "json.abi[0] must be an object" at the validation layer before reaching viem. Converted all SKILL.md task-map examples to full JSON ABI format and added an "ABI Format" section to each affected skill explaining the requirement. Reference files retain human-readable signatures for documentation purposes. Verified on-chain via direct RPC eth_call: - IdentityRegistry.balanceOf() ✓ - AbstractVoting.voteCost() = 0 (free), currentEpoch() = 317 ✓ - UniswapV2Router.getAmountsOut(0.1 ETH) = 190.22 USDC ✓ Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix auth state race conditions and redesign authorization page Resolve login loop caused by Privy SDK state transitions resetting the wizard to not_logged_in during async AGW on-chain verification. Add a resolving intermediate step, fix effect dependency array to use primitive signerAddress instead of user object, gate login redirect on embedded wallet readiness, and surface explicit errors for missing AGW and RPC failures with proper retry paths. Redesign the SelectPolicy authorization screen as a clean OAuth-style consent page: safety limits shown as prominent pills derived from actual policy defaults, compact permission checklist in plain English, simplified consent text, and green Approve Access CTA. Unify policy constants so the UI preview, preset definitions, and server-side Privy policy all reference the same source of truth in config.ts and default-policy.ts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add mining-with-bigcoin skill for Bigcoin game on Abstract New skill for the Bigcoin virtual mining simulator. Covers facility purchase/upgrade, miner buying, reward claiming, hashrate checking, and merge mining. Includes full MainV2 game contract interface discovered via Abscan verified source and on-chain state reads. Contracts verified on mainnet via RPC eth_call: - Game proxy: 0x89eb96a0a157f935de38d548b79af511d424e33a - BIG token: 0xdf70075737e9f96b078ab4461eee3e055e061223 - Bigtoshi NFT: 0xb1eefa4f7b3987468441baa339e147a2cfee3d36 - pendingRewards(), getBigcoinPerBlock(), ownerToFacility() all ✓ - Current emission: ~0.039 BIG/block (after 6 halvings) Includes all 9 facility tiers with costs, capacity, and power output. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix pre-merge review items: env docs, skills list, stray console.error - Add missing server-side env vars to app/.env.example (PRIVY_APP_ID, PRIVY_APP_SECRET, callback signing keys) - Add 6 missing skills to README table (uniswap, bridging, building, identity, upvoting, bigcoin) - Remove redundant console.error in useSessionWizardState (error already surfaced via markCreationError) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Override vulnerable transitive deps to fix CI audit Add pnpm.overrides for hono >=4.12.4, @hono/node-server >=1.19.10, express-rate-limit >=8.2.2, and socket.io-parser >=4.2.6 in both root and app package.json. All are transitive deps from wagmi and @modelcontextprotocol/sdk — floor constraints allow future patches. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix CI app job: install full workspace so overrides apply The app job was running pnpm --dir app install which bypasses the workspace root and its pnpm.overrides. Switch to full workspace install so transitive dependency overrides take effect for the audit step. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix CI: use valid registry app ID in test, suppress tsdown bundle warning - policy-validation test referenced app ID '12' which doesn't exist in the trimmed registry (only '136'/Gacha remains after seed removal). Update to '136' so callPolicies resolve correctly. - Add inlineOnly: false to tsdown config to prevent the intentional @abstract-foundation/agw-client bundling from exiting non-zero. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Use shared Privy policy instead of creating one per session Replace per-provision policy creation with a single pre-created policy referenced by PRIVY_DEFAULT_POLICY_ID env var. This eliminates unbounded policy sprawl in the Privy account — previously every session provision created an identical policy with a unique expiry timestamp. - Add getDefaultPolicyId() reading from env - Export buildDefaultCapabilitySummary for direct use in provision route - Remove createPolicy from privy-api.ts (zero callers) - Remove buildDefaultPolicyRequest (dead code, 90 lines of rules generation) - Update tests to cover live code paths - Add PRIVY_DEFAULT_POLICY_ID to .env.example Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add script to create default Privy policy One-time helper to create the shared wallet policy via Privy API. Reads credentials from .env.local, outputs the policy ID to set as PRIVY_DEFAULT_POLICY_ID. Usage: npx tsx scripts/create-default-policy.ts [chainId] Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ecf06e5 commit 29bc2a9

240 files changed

Lines changed: 28617 additions & 20697 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
with:
2626
node-version: "22"
2727
cache: pnpm
28-
- run: pnpm --dir app install --frozen-lockfile
28+
- run: pnpm install --frozen-lockfile
2929
- run: pnpm --dir app audit --prod --audit-level=high
3030
- name: App full audit (non-blocking visibility)
3131
run: pnpm --dir app audit --prod

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ jobs:
2727
- run: pnpm lint
2828
- run: pnpm test
2929
- run: pnpm build
30-
- run: pnpm publish --access public --no-git-checks
30+
- run: pnpm --filter @abstract-foundation/agw-cli publish --access public --no-git-checks

.github/workflows/release-please.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ jobs:
1616
fi
1717
- uses: googleapis/release-please-action@v4
1818
with:
19-
release-type: node
19+
config-file: release-please-config.json
20+
manifest-file: .release-please-manifest.json
2021
token: ${{ secrets.RELEASE_PLEASE_TOKEN != '' && secrets.RELEASE_PLEASE_TOKEN || github.token }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ coverage
44
.next
55
*.tsbuildinfo
66
*.log
7+
*.tgz
78
.DS_Store
89
.env
910
.agent-loop.lock
1011
.vercel
1112
.env*.local
13+
docs/abs-portal-apps-*.md

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"packages/agw-cli": "0.1.0"
3+
}

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

CLAUDE.md

Lines changed: 0 additions & 84 deletions
This file was deleted.

CONTEXT.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# AGW Context
2+
3+
AGW is an agent-first CLI for Abstract Global Wallet workflows. Treat the CLI as the source of truth.
4+
5+
## Rules
6+
7+
- Use `agw-cli schema <commandId>` whenever the request or response shape is unclear.
8+
- Pass command input with `--json <payload|@file>`.
9+
- Keep runtime config out of JSON payloads. Use `AGW_*` env vars or CLI flags such as `--home`, `--chain-id`, `--rpc-url`, and `--app-url`.
10+
- Treat signing and state-changing commands as preview-first.
11+
- Use `--dry-run` to validate locally and inspect the preview.
12+
- Use `--execute` only after explicit user confirmation.
13+
- Never infer execute permission from a successful preview.
14+
- Keep reads narrow with `fields`.
15+
- Use pagination on list surfaces and prefer `--page-all --output ndjson` for large result sets.
16+
- Parse stdout only. Diagnostics and warnings belong on stderr.
17+
- Prefer MCP when the host supports it. The MCP server is generated from the same registry as the CLI.
18+
- Sanitization profiles are `off` and `strict`. MCP and extension surfaces default to `strict`.
19+
20+
## Config
21+
22+
Public runtime config is:
23+
24+
- `AGW_HOME`
25+
- `AGW_CHAIN_ID`
26+
- `AGW_RPC_URL`
27+
- `AGW_APP_URL`
28+
- `AGW_OUTPUT`
29+
- `AGW_CALLBACK_SIGNING_PUBLIC_KEY`
30+
- `AGW_CALLBACK_SIGNING_ISSUER`
31+
- `AGW_SANITIZE_PROFILE`
32+
33+
## Common Patterns
34+
35+
Inspect schema:
36+
37+
```bash
38+
agw-cli schema tx.send
39+
```
40+
41+
Inspect session state:
42+
43+
```bash
44+
agw-cli session status --json '{"fields":["status","readiness","accountAddress"]}'
45+
```
46+
47+
Preview a mutating action:
48+
49+
```bash
50+
agw-cli tx send --json '{"to":"0x...","data":"0x1234","value":"0"}' --dry-run
51+
```
52+
53+
Execute after confirmation:
54+
55+
```bash
56+
agw-cli tx send --json '{"to":"0x...","data":"0x1234","value":"0"}' --execute
57+
```
58+
59+
Stream a paginated read:
60+
61+
```bash
62+
agw-cli wallet tokens list \
63+
--json '{"pageSize":25,"fields":["items.symbol","items.value","nextCursor"]}' \
64+
--page-all \
65+
--output ndjson
66+
```

0 commit comments

Comments
 (0)