@aomi-labs/client 0.1.20 → 0.1.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aomi-labs/client",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "description": "Platform-agnostic TypeScript client for the Aomi backend API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -26,14 +26,15 @@
26
26
  "skills",
27
27
  "README.md"
28
28
  ],
29
- "scripts": {
30
- "build": "tsup",
31
- "clean:dist": "rm -rf dist"
32
- },
33
29
  "dependencies": {
34
30
  "@alchemy/wallet-apis": "5.0.0-beta.22",
35
31
  "@getpara/aa-alchemy": "2.21.0",
36
32
  "@getpara/aa-pimlico": "2.21.0",
33
+ "citty": "^0.2.2",
37
34
  "viem": "^2.47.11"
35
+ },
36
+ "scripts": {
37
+ "build": "tsup",
38
+ "clean:dist": "rm -rf dist"
38
39
  }
39
- }
40
+ }
@@ -5,14 +5,14 @@ description: >
5
5
  check balances or prices, build wallet requests, confirm quotes or routes,
6
6
  sign transactions or EIP-712 payloads, switch apps or chains, or execute
7
7
  swaps, transfers, and DeFi actions on-chain. Covers Aomi chat, transaction
8
- review, AA-first signing with automatic EOA fallback, session controls, and
9
- per-session secret ingestion.
10
- compatibility: "Requires @aomi-labs/client (`npm install -g @aomi-labs/client`). CLI executable is `aomi`. Requires viem for signing (`npm install viem`). Use AOMI_APP / --app, AOMI_MODEL / --model, AOMI_CHAIN_ID / --chain, CHAIN_RPC_URL / --rpc-url, optional --secret NAME=value ingestion, and AOMI_STATE_DIR for local session storage."
8
+ review, AA-first signing with mode fallback, persistent AA configuration,
9
+ session controls, and per-session secret ingestion.
10
+ compatibility: "Requires @aomi-labs/client (`npm install -g @aomi-labs/client`). CLI executable is `aomi`. Requires viem for signing (`npm install viem`). Use AOMI_APP / --app, AOMI_MODEL / --model, AOMI_CHAIN_ID / --chain, CHAIN_RPC_URL / --rpc-url, `aomi secret add` for session secret ingestion, and AOMI_STATE_DIR for local session storage."
11
11
  license: MIT
12
12
  allowed-tools: Bash
13
13
  metadata:
14
14
  author: aomi-labs
15
- version: "0.5"
15
+ version: "0.6"
16
16
  ---
17
17
 
18
18
  # Aomi Transact
@@ -28,29 +28,48 @@ backend. Local session data lives under `AOMI_STATE_DIR` or `~/.aomi`.
28
28
  - The user wants to build, confirm, sign, or broadcast wallet requests.
29
29
  - The user wants to inspect or switch apps, models, chains, or sessions.
30
30
  - The user wants to inject API keys or other backend secrets for the current session.
31
+ - The user wants to configure or inspect Account Abstraction settings.
31
32
 
32
33
  ## Hard Rules
33
34
 
34
35
  - Never print secrets verbatim in normal status, preflight, or confirmation output.
35
36
  - Treat `PRIVATE_KEY`, `AOMI_API_KEY`, `ALCHEMY_API_KEY`, `PIMLICO_API_KEY`, and private RPC URLs as secrets.
36
37
  - If the user provides a private key or API key, do not repeat it back unless they explicitly ask for that exact value to be reformatted.
37
- - Prefer `aomi --secret NAME=value ...` over stuffing provider API keys into normal chat text.
38
+ - Prefer `aomi secret add NAME=value` over stuffing provider API keys into normal chat text.
38
39
  - Do not sign anything unless the CLI has actually queued a wallet request and you can identify its `tx-N` ID.
39
40
  - When starting work from a new Codex or assistant chat thread, default the first Aomi command to `--new-session` unless the user explicitly wants to continue an existing session.
40
41
  - If `PRIVATE_KEY` is set in the environment, do not also pass `--private-key` unless you intentionally want to override the environment value.
41
- - `--public-key` must match the address derived from the signing key. If they differ, `aomi sign` will update the session to the signer address.
42
+ - `--public-key` must match the address derived from the signing key. If they differ, `aomi tx sign` will update the session to the signer address.
42
43
  - Private keys must start with `0x`. Add the prefix if missing.
43
- - `CHAIN_RPC_URL` is only one default RPC URL. When switching chains, prefer passing `--rpc-url` on `aomi sign`.
44
- - Switching the chat/session chain with `--chain` does not switch `CHAIN_RPC_URL`. The RPC used for `aomi sign` must match the pending transaction's chain.
44
+ - `CHAIN_RPC_URL` is only one default RPC URL. When switching chains, prefer passing `--rpc-url` on `aomi tx sign`.
45
+ - Switching the chat/session chain with `--chain` does not switch `CHAIN_RPC_URL`. The RPC used for `aomi tx sign` must match the pending transaction's chain.
45
46
  - `--aa-provider` and `--aa-mode` are AA-only controls and cannot be used with `--eoa`.
46
47
 
48
+ ## Command Structure
49
+
50
+ All commands follow a **noun-verb** pattern: `aomi <resource> <action>`.
51
+ There are no top-level aliases — use the full noun-verb form.
52
+
53
+ ```
54
+ aomi chat <message> Send a message
55
+ aomi tx list List pending/signed transactions
56
+ aomi tx simulate <id>... Simulate a batch
57
+ aomi tx sign <id>... Sign and submit
58
+ aomi session list|new|resume|delete|status|log|events|close
59
+ aomi model list|set|current
60
+ aomi app list|current
61
+ aomi chain list
62
+ aomi secret list|clear|add
63
+ aomi aa status|set|test|reset
64
+ ```
65
+
47
66
  ## Quick Start
48
67
 
49
68
  Run this once at the start of the session:
50
69
 
51
70
  ```bash
52
71
  aomi --version
53
- aomi status 2>/dev/null || echo "no session"
72
+ aomi session status 2>/dev/null || echo "no session"
54
73
  ```
55
74
 
56
75
  If the user is asking for a read-only result, that may be enough. If they want
@@ -60,9 +79,9 @@ to build or sign a transaction, continue with the workflow below.
60
79
 
61
80
  1. Chat with the agent.
62
81
  2. If the agent asks whether to proceed, send a short confirmation in the same session.
63
- 3. Review pending requests with `aomi tx`.
64
- 4. Sign the queued request.
65
- 5. Verify with `aomi tx`, `aomi log`, or `aomi status`.
82
+ 3. Review pending requests with `aomi tx list`.
83
+ 4. Sign the queued request with `aomi tx sign <id>`.
84
+ 5. Verify with `aomi tx list`, `aomi session log`, or `aomi session status`.
66
85
 
67
86
  The CLI output is the source of truth. If you do not see `Wallet request queued:
68
87
  tx-N`, there is nothing to sign yet.
@@ -76,10 +95,10 @@ Use these when the user does not need signing:
76
95
  ```bash
77
96
  aomi chat "<message>" --new-session
78
97
  aomi chat "<message>" --verbose
79
- aomi tx
80
- aomi log
81
- aomi status
82
- aomi events
98
+ aomi tx list
99
+ aomi session log
100
+ aomi session status
101
+ aomi session events
83
102
  aomi --version
84
103
  aomi app list
85
104
  aomi app current
@@ -98,7 +117,7 @@ Notes:
98
117
  - Pass `--public-key` on the first wallet-aware chat if the backend needs the user's address.
99
118
  - For chain-specific requests, prefer `--chain <id>` on the command itself. Use `AOMI_CHAIN_ID=<id>` only when multiple consecutive commands should stay on the same chain.
100
119
  - Use `aomi secret list` to inspect configured secret handles for the active session.
101
- - `aomi close` wipes the active local session pointer and starts a fresh thread next time.
120
+ - `aomi session close` wipes the active local session pointer and starts a fresh thread next time.
102
121
 
103
122
  ### Secret Ingestion
104
123
 
@@ -106,19 +125,18 @@ Use this when the backend or selected app needs API keys, provider tokens, or
106
125
  other named secrets for the current session:
107
126
 
108
127
  ```bash
109
- aomi --secret ALCHEMY_API_KEY=sk_live_123 --new-session
110
- aomi --secret ALCHEMY_API_KEY=sk_live_123 chat "simulate a swap on Base" --new-session
128
+ aomi secret add ALCHEMY_API_KEY=sk_live_123 --new-session
129
+ aomi chat "simulate a swap on Base" --new-session
111
130
  aomi secret list
112
131
  aomi secret clear
132
+ aomi secret add NAME=value [NAME=value ...]
113
133
  ```
114
134
 
115
135
  Important behavior:
116
136
 
117
- - `aomi --secret NAME=value` with no command ingests secrets into the active session and exits.
118
- - `aomi --secret NAME=value chat "..."` ingests first, then runs the command.
137
+ - `aomi secret add NAME=value [NAME=value ...]` ingests one or more secrets into the active session.
119
138
  - `aomi secret list` prints secret handle names, not raw values.
120
139
  - `aomi secret clear` removes all secrets for the active session.
121
- - Do not combine `--secret` with `aomi secret clear`.
122
140
 
123
141
  ### Building Wallet Requests
124
142
 
@@ -143,7 +161,7 @@ Important behavior:
143
161
  - A chat response does not always queue a transaction immediately.
144
162
  - The agent may return a quote, route, timing estimate, or deposit method and ask whether to proceed.
145
163
  - When that happens, keep the same session and reply with a short confirmation message.
146
- - Only move to `aomi sign` after a wallet request is queued.
164
+ - Only move to `aomi tx sign` after a wallet request is queued.
147
165
  - For Khalani, prefer a `TRANSFER` deposit method when available. The intended flow is quote -> sign transfer -> submit/continue after the transfer settles.
148
166
  - Avoid Khalani `CONTRACT_CALL` routes that require ERC-20 approval unless the user explicitly wants that path or no transfer route is available.
149
167
 
@@ -154,38 +172,35 @@ Queued request example:
154
172
  to: 0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD
155
173
  value: 1000000000000000000
156
174
  chain: 1
157
- Run `aomi tx` to see pending transactions, `aomi sign <id>` to sign.
175
+ Run `aomi tx list` to see pending transactions, `aomi tx sign <id>` to sign.
158
176
  ```
159
177
 
160
178
  ### Signing Policy
161
179
 
162
180
  Use these rules exactly:
163
181
 
164
- - Default command: `aomi sign <tx-id> [<tx-id> ...]`
165
- - Default behavior: try AA first, retry unsponsored AA when Alchemy sponsorship is unavailable, then fall back to EOA automatically if AA still fails.
166
- - `--aa`: require AA with no EOA fallback.
167
- - `--eoa`: force direct EOA execution.
168
- - `--aa-provider` or `--aa-mode`: AA-specific controls. Use them only when the user explicitly wants a provider or mode.
182
+ - Default command: `aomi tx sign <tx-id> [<tx-id> ...]`
183
+ - Default behavior (**auto-detect**): if an AA provider is configured (env vars, `~/.aomi/aa.json`, or flags), use AA automatically. If no AA provider is configured, use EOA. There is no silent fallback AA either works or fails.
184
+ - **Mode fallback**: when AA is used, the CLI tries the preferred mode (default 7702). If it fails, it tries the alternative mode (4337). If both fail, it returns an error suggesting `--eoa`.
185
+ - `--eoa`: force direct EOA execution, skip AA entirely.
186
+ - `--aa-provider` or `--aa-mode`: AA-specific controls that also force AA mode. Cannot be used with `--eoa`.
169
187
 
170
188
  Examples:
171
189
 
172
190
  ```bash
173
- # Default: AA first, automatic EOA fallback if needed
174
- aomi sign tx-1 --private-key 0xYourPrivateKey --rpc-url https://eth.llamarpc.com
175
-
176
- # Require AA only
177
- aomi sign tx-1 --aa --private-key 0xYourPrivateKey
191
+ # Default: auto-detect. AA if configured, EOA if not.
192
+ aomi tx sign tx-1 --private-key 0xYourPrivateKey --rpc-url https://eth.llamarpc.com
178
193
 
179
194
  # Force EOA only
180
- aomi sign tx-1 --eoa --private-key 0xYourPrivateKey --rpc-url https://eth.llamarpc.com
195
+ aomi tx sign tx-1 --eoa --private-key 0xYourPrivateKey --rpc-url https://eth.llamarpc.com
181
196
 
182
197
  # Explicit AA provider and mode
183
- aomi sign tx-1 --aa-provider pimlico --aa-mode 4337 --private-key 0xYourPrivateKey
198
+ aomi tx sign tx-1 --aa-provider pimlico --aa-mode 4337 --private-key 0xYourPrivateKey
184
199
  ```
185
200
 
186
201
  More signing notes:
187
202
 
188
- - `aomi sign` handles both transaction requests and EIP-712 typed data signatures.
203
+ - `aomi tx sign` handles both transaction requests and EIP-712 typed data signatures.
189
204
  - Batch signing is supported for transaction requests only, not EIP-712 requests.
190
205
  - A single `--rpc-url` override cannot be used for a mixed-chain multi-sign request.
191
206
  - If the signer address differs from the stored session public key, the CLI updates the session to the signer address.
@@ -205,7 +220,7 @@ More signing notes:
205
220
  aomi session list
206
221
  aomi session resume <id>
207
222
  aomi session delete <id>
208
- aomi close
223
+ aomi session close
209
224
  ```
210
225
 
211
226
  ## Reference: Commands
@@ -227,23 +242,48 @@ aomi chat "<message>" --app khalani --chain 137
227
242
  - Use `--app`, `--model`, and `--chain` to change the active context for the next request.
228
243
  - Prefer `--chain <id>` for one-off chain-specific requests. Use `AOMI_CHAIN_ID=<id>` when several consecutive commands should share the same chain context.
229
244
 
230
- ### Transaction Inspection
245
+ ### Transaction Commands
246
+
247
+ ```bash
248
+ aomi tx list
249
+ aomi tx simulate <id> [<id> ...]
250
+ aomi tx sign <id> [<id> ...]
251
+ ```
252
+
253
+ - `aomi tx list` inspects pending and signed requests.
254
+ - `aomi tx simulate` runs a simulation batch for the given tx IDs.
255
+ - `aomi tx sign` signs and submits one or more queued requests.
256
+
257
+ ### Session Commands
258
+
259
+ ```bash
260
+ aomi session list
261
+ aomi session new
262
+ aomi session resume <id>
263
+ aomi session delete <id>
264
+ aomi session status
265
+ aomi session log
266
+ aomi session events
267
+ aomi session close
268
+ ```
269
+
270
+ - `aomi session status` shows the current session summary.
271
+ - `aomi session log` replays conversation and tool output.
272
+ - `aomi session events` shows raw backend system events.
273
+ - `aomi session close` clears the active local session pointer. The next chat starts fresh.
274
+ - Session selectors accept the backend session ID, `session-N`, or `N`.
275
+
276
+ ### Secret Commands
231
277
 
232
278
  ```bash
233
- aomi tx
234
- aomi log
235
- aomi status
236
- aomi events
237
279
  aomi secret list
238
280
  aomi secret clear
281
+ aomi secret add NAME=value [NAME=value ...]
239
282
  ```
240
283
 
241
- - `aomi tx` inspects pending and signed requests.
242
- - `aomi log` replays conversation and tool output.
243
- - `aomi status` shows the current session summary.
244
- - `aomi events` shows raw backend system events.
245
284
  - `aomi secret list` shows configured secret handles for the active session.
246
285
  - `aomi secret clear` removes all configured secrets for the active session.
286
+ - `aomi secret add` ingests one or more NAME=value secrets.
247
287
 
248
288
  ### App And Model Commands
249
289
 
@@ -260,45 +300,116 @@ aomi model set <rig>
260
300
  - `aomi model set <rig>` persists the selected model for the current session.
261
301
  - `aomi chat --model <rig> "<message>"` also applies a model for the session.
262
302
 
303
+ ### Currently Integrated Apps
304
+
305
+ All apps share a common base toolset (`send_transaction_to_wallet`,
306
+ `encode_and_simulate`, `get_account_info`, `get_contract_abi`, etc.).
307
+ The tools listed below are the app-specific additions.
308
+
309
+ | App | Description | App-Specific Tools | Needs API Key |
310
+ |-----|-------------|-------------------|---------------|
311
+ | `default` | General-purpose on-chain agent with web search | `brave_search` | No |
312
+ | `binance` | Binance CEX — prices, order book, klines | `binance_get_price`, `binance_get_depth`, `binance_get_klines` | Yes (`BINANCE_API_KEY`, `BINANCE_SECRET_KEY`) |
313
+ | `bybit` | Bybit CEX — orders, positions, leverage | `brave_search` (no Bybit-specific tools yet) | Yes (`BYBIT_API_KEY`, `BYBIT_SECRET_KEY`) |
314
+ | `cow` | CoW Protocol — MEV-protected swaps via batch auctions | `get_cow_swap_quote`, `place_cow_order`, `get_cow_order`, `get_cow_order_status`, `get_cow_user_orders` | No |
315
+ | `defillama` | DefiLlama — TVL, yields, volumes, stablecoins | `get_token_price`, `get_yield_opportunities`, `get_defi_protocols`, `get_chain_tvl`, `get_protocol_detail`, `get_dex_volumes`, `get_fees_overview`, `get_protocol_fees`, `get_stablecoins`, `get_stablecoin_chains`, `get_historical_token_price`, `get_token_price_change`, `get_historical_chain_tvl`, `get_dex_protocol_volume`, `get_stablecoin_history`, `get_yield_pool_history` | No |
316
+ | `dune` | Dune Analytics — execute and fetch SQL queries | `execute_query`, `get_execution_status`, `get_execution_results`, `get_query_results` | Yes (`DUNE_API_KEY`) |
317
+ | `dydx` | dYdX perpetuals — markets, orderbook, candles, trades | `dydx_get_markets`, `dydx_get_orderbook`, `dydx_get_candles`, `dydx_get_trades`, `dydx_get_account` | No |
318
+ | `gmx` | GMX perpetuals — markets, positions, orders, prices | `get_gmx_prices`, `get_gmx_signed_prices`, `get_gmx_markets`, `get_gmx_positions`, `get_gmx_orders` | No |
319
+ | `hyperliquid` | Hyperliquid perps — mid prices, orderbook | `get_meta`, `get_all_mids` | No |
320
+ | `kaito` | Kaito — crypto social search, trending, mindshare | `kaito_search`, `kaito_get_trending`, `kaito_get_mindshare` | Yes (`KAITO_API_KEY`) |
321
+ | `kalshi` | Kalshi prediction markets via Simmer SDK | `simmer_register`, `simmer_status`, `simmer_briefing` | Yes (`SIMMER_API_KEY`) |
322
+ | `khalani` | Khalani cross-chain intents — quote, build, submit | `get_khalani_quote`, `build_khalani_order`, `submit_khalani_order`, `get_khalani_order_status`, `get_khalani_orders_by_address` | No |
323
+ | `lifi` | LI.FI aggregator — cross-chain swaps & bridges | `get_lifi_swap_quote`, `place_lifi_order`, `get_lifi_bridge_quote`, `get_lifi_transfer_status`, `get_lifi_chains` | No (optional `LIFI_API_KEY`) |
324
+ | `manifold` | Manifold prediction markets — search, bet, create | `list_markets`, `get_market`, `get_market_positions`, `search_markets`, `place_bet`, `create_market` | Yes (`MANIFOLD_API_KEY`) |
325
+ | `molinar` | Molinar on-chain world — move, explore, chat | `molinar_get_state`, `molinar_look`, `molinar_move`, `molinar_jump`, `molinar_chat`, `molinar_get_chat`, `molinar_get_new_messages`, `molinar_get_players`, `molinar_collect_coins`, `molinar_explore`, `molinar_create_object`, `molinar_customize`, `molinar_ping` | No |
326
+ | `morpho` | Morpho lending — markets, vaults, positions | `get_markets`, `get_vaults`, `get_user_positions` | No |
327
+ | `neynar` | Farcaster social — users, search | `get_user_by_username`, `search_users` | Yes (`NEYNAR_API_KEY`) |
328
+ | `okx` | OKX CEX — tickers, order book, candles | `okx_get_tickers`, `okx_get_order_book`, `okx_get_candles` | Yes (`OKX_API_KEY`, `OKX_SECRET_KEY`, `OKX_PASSPHRASE`) |
329
+ | `oneinch` | 1inch DEX aggregator — quotes, swaps, allowances | `get_oneinch_quote`, `get_oneinch_swap`, `get_oneinch_approve_transaction`, `get_oneinch_allowance`, `get_oneinch_liquidity_sources` | Yes (`ONEINCH_API_KEY`) |
330
+ | `polymarket` | Polymarket prediction markets — search, trade, CLOB | `search_polymarket`, `get_polymarket_details`, `get_polymarket_trades`, `resolve_polymarket_trade_intent`, `build_polymarket_order_preview` | No |
331
+ | `x` | X/Twitter — users, posts, search, trends | `get_x_user`, `get_x_user_posts`, `search_x`, `get_x_trends`, `get_x_post` | Yes (`X_API_KEY`) |
332
+ | `yearn` | Yearn Finance — vault discovery, details | `get_all_vaults`, `get_vault_detail`, `get_blacklisted_vaults` | No |
333
+ | `zerox` | 0x DEX aggregator — swaps, quotes, liquidity | `get_zerox_swap_quote`, `place_zerox_order`, `get_zerox_swap_chains`, `get_zerox_allowance_holder_price`, `get_zerox_liquidity_sources` | Yes (`ZEROX_API_KEY`) |
334
+
335
+ Some apps require API keys via `aomi secret add` (e.g. CEX apps need exchange credentials).
336
+ Use `--app <name>` or `AOMI_APP=<name>` to select an app.
337
+
338
+ To build a new app or update an existing one from an API spec, SDK, or product
339
+ docs, use the companion skill **aomi-build** (install with
340
+ `npx skills add aomi-labs/skills`). It scaffolds Aomi SDK crates with `lib.rs`,
341
+ `client.rs`, and `tool.rs` from OpenAPI specs, REST endpoints, or repository
342
+ examples.
343
+
263
344
  ### Chain Commands
264
345
 
265
346
  ```bash
266
347
  aomi chain list
267
348
  ```
268
349
 
269
- ### Session Commands
350
+ ## Reference: Account Abstraction
270
351
 
271
- ```bash
272
- aomi session list
273
- aomi session new
274
- aomi session resume <id>
275
- aomi session delete <id>
276
- aomi close
277
- ```
352
+ ### Execution Model
278
353
 
279
- - Session selectors accept the backend session ID, `session-N`, or `N`.
280
- - `aomi close` clears the active local session pointer. The next chat starts fresh.
354
+ The CLI uses **auto-detect** by default:
281
355
 
282
- ## Reference: Account Abstraction
356
+ | AA configured? | Flag | Result |
357
+ |---|---|---|
358
+ | Yes | (none) | **AA automatically** (preferred mode → alternative mode fallback) |
359
+ | Yes | `--aa-provider`/`--aa-mode` | AA with explicit settings |
360
+ | Yes | `--eoa` | EOA, skip AA |
361
+ | No | (none) | EOA |
362
+ | No | `--aa-provider` | Error: "AA requires provider credentials" |
363
+
364
+ There is **no silent EOA fallback**. If AA is selected (explicitly or by auto-detect) and both AA modes fail, the CLI returns a hard error suggesting `--eoa`.
365
+
366
+ ### Mode Fallback
283
367
 
284
- ### Signing Modes
368
+ When using AA, the CLI tries modes in order:
285
369
 
286
- - Default `aomi sign ...`: try AA first, retry unsponsored Alchemy AA when sponsorship is unavailable, then fall back to EOA automatically.
287
- - `aomi sign ... --aa`: require AA only. Do not fall back to EOA.
288
- - `aomi sign ... --eoa`: force direct EOA signing.
370
+ 1. Try preferred mode (default: 7702 for Ethereum, 4337 for L2s).
371
+ 2. If preferred mode fails, try the alternative mode (7702 4337).
372
+ 3. If both modes fail, return error with suggestion: use `--eoa` to sign without AA.
373
+
374
+ ### Persistent AA Configuration
375
+
376
+ AA settings can be persisted to `~/.aomi/aa.json` using the `aomi aa` commands,
377
+ eliminating the need to pass env vars or flags on every sign.
378
+
379
+ ```bash
380
+ # Configure AA provider and credentials
381
+ aomi aa set provider alchemy
382
+ aomi aa set key <your-alchemy-key>
383
+ aomi aa set alchemy-key <your-alchemy-key> # provider-specific key
384
+ aomi aa set pimlico-key <your-pimlico-key> # provider-specific key
385
+ aomi aa set policy <gas-policy-id>
386
+ aomi aa set mode 7702
387
+ aomi aa set fallback eoa
388
+
389
+ # View resolved config (all layers merged)
390
+ aomi aa status
391
+
392
+ # Validate setup against a chain
393
+ aomi aa test --chain 8453
394
+
395
+ # Clear all persisted config
396
+ aomi aa reset
397
+ ```
398
+
399
+ Priority chain for AA resolution: **flag > env var > `~/.aomi/aa.json` > defaults**.
289
400
 
290
401
  ### AA Providers
291
402
 
292
- | Provider | Flag | Env Var | Notes |
293
- | -------- | ----------------------- | ----------------- | -------------------------------- |
294
- | Alchemy | `--aa-provider alchemy` | `ALCHEMY_API_KEY` | Supports sponsorship, 4337, 7702 |
295
- | Pimlico | `--aa-provider pimlico` | `PIMLICO_API_KEY` | Supports 4337 and 7702 |
403
+ | Provider | Flag | Env Var | Persistent Config | Notes |
404
+ | -------- | ----------------------- | ----------------- | ------------------------- | -------------------------------- |
405
+ | Alchemy | `--aa-provider alchemy` | `ALCHEMY_API_KEY` | `aomi aa set provider alchemy` | Supports sponsorship, 4337, 7702 |
406
+ | Pimlico | `--aa-provider pimlico` | `PIMLICO_API_KEY` | `aomi aa set provider pimlico` | Supports 4337 and 7702 |
296
407
 
297
408
  Provider selection rules:
298
409
 
299
- - If the user explicitly selects a provider, use it.
300
- - In default mode, the CLI prefers the first configured AA provider.
301
- - If no AA provider is configured, default mode uses EOA directly.
410
+ - If the user explicitly selects a provider (flag or persistent config), use it.
411
+ - In auto-detect mode, the CLI uses the first configured AA provider.
412
+ - If no AA provider is configured, auto-detect uses EOA directly.
302
413
 
303
414
  ### AA Modes
304
415
 
@@ -324,14 +435,17 @@ Alchemy sponsorship is optional.
324
435
  ```bash
325
436
  export ALCHEMY_API_KEY=your-key
326
437
  export ALCHEMY_GAS_POLICY_ID=your-policy-id
327
- aomi sign tx-1
438
+ aomi tx sign tx-1
328
439
  ```
329
440
 
330
- Default signing behavior for Alchemy:
441
+ Or use persistent config:
331
442
 
332
- 1. Try sponsored AA.
333
- 2. If sponsorship is unavailable, retry AA with user-funded gas.
334
- 3. If AA still fails and the mode is default auto mode, fall back to EOA.
443
+ ```bash
444
+ aomi aa set provider alchemy
445
+ aomi aa set key your-key
446
+ aomi aa set policy your-policy-id
447
+ aomi tx sign tx-1
448
+ ```
335
449
 
336
450
  ### Supported Chains
337
451
 
@@ -358,7 +472,7 @@ Use an RPC that matches the pending transaction's chain:
358
472
  Practical rule:
359
473
 
360
474
  - `--chain` affects the wallet/session context for chat and request building.
361
- - `--rpc-url` affects where `aomi sign` estimates and submits the transaction.
475
+ - `--rpc-url` affects where `aomi tx sign` estimates and submits the transaction.
362
476
  - Treat them as separate controls and keep them aligned with the transaction you are signing.
363
477
 
364
478
  ## Reference: Configuration
@@ -366,27 +480,28 @@ Practical rule:
366
480
  ### Flags And Env Vars
367
481
 
368
482
  All config can be passed as flags. Flags override environment variables.
483
+ Environment variables override persistent config (`~/.aomi/aa.json`).
369
484
 
370
485
  | Flag | Env Var | Default | Purpose |
371
486
  | --------------- | ------------------ | ---------------------- | --------------------------------------- |
372
- | `--backend-url` | `AOMI_BACKEND_URL` | `https://api.aomi.dev` | Backend URL |
487
+ | `--backend-url` | `AOMI_BACKEND_URL` | `https://api.aomi.dev` | Backend URL |
373
488
  | `--api-key` | `AOMI_API_KEY` | none | API key for non-default apps |
374
489
  | `--app` | `AOMI_APP` | `default` | Backend app |
375
490
  | `--model` | `AOMI_MODEL` | backend default | Session model |
376
491
  | `--public-key` | `AOMI_PUBLIC_KEY` | none | Wallet address for chat/session context |
377
- | `--private-key` | `PRIVATE_KEY` | none | Signing key for `aomi sign` |
492
+ | `--private-key` | `PRIVATE_KEY` | none | Signing key for `aomi tx sign` |
378
493
  | `--rpc-url` | `CHAIN_RPC_URL` | chain RPC default | RPC override for signing |
379
494
  | `--chain` | `AOMI_CHAIN_ID` | `1` | Active wallet chain |
380
- | `--aa-provider` | `AOMI_AA_PROVIDER` | auto | AA provider override |
495
+ | `--aa-provider` | `AOMI_AA_PROVIDER` | auto-detect | AA provider override |
381
496
  | `--aa-mode` | `AOMI_AA_MODE` | chain default | AA mode override |
382
497
 
383
498
  ### AA Provider Credentials
384
499
 
385
- | Env Var | Purpose |
386
- | ----------------------- | ----------------------------------- |
387
- | `ALCHEMY_API_KEY` | Enables Alchemy AA |
388
- | `ALCHEMY_GAS_POLICY_ID` | Optional Alchemy sponsorship policy |
389
- | `PIMLICO_API_KEY` | Enables Pimlico AA |
500
+ | Env Var | Purpose |
501
+ | ------------------------ | ----------------------------------- |
502
+ | `ALCHEMY_API_KEY` | Enables Alchemy AA |
503
+ | `ALCHEMY_GAS_POLICY_ID` | Optional Alchemy sponsorship policy |
504
+ | `PIMLICO_API_KEY` | Enables Pimlico AA |
390
505
 
391
506
  `ALCHEMY_API_KEY` can also be used to construct chain-specific signing RPCs:
392
507
 
@@ -401,23 +516,25 @@ All config can be passed as flags. Flags override environment variables.
401
516
 
402
517
  ### Storage
403
518
 
404
- | Env Var | Default | Purpose |
405
- | ---------------- | --------- | -------------------------------------- |
406
- | `AOMI_STATE_DIR` | `~/.aomi` | Root directory for local session state |
519
+ | Env Var | Default | Purpose |
520
+ | ----------------- | --------- | -------------------------------------- |
521
+ | `AOMI_STATE_DIR` | `~/.aomi` | Root directory for local session state |
522
+ | `AOMI_CONFIG_DIR` | `~/.aomi` | Root directory for persistent config |
407
523
 
408
524
  Storage layout by default:
409
525
 
410
526
  - `~/.aomi/sessions/` stores per-session JSON files.
411
527
  - `~/.aomi/active-session.txt` stores the active local session pointer.
528
+ - `~/.aomi/aa.json` stores persistent AA configuration.
412
529
 
413
530
  ### Important Config Rules
414
531
 
415
532
  - `PRIVATE_KEY` should start with `0x`.
416
533
  - If `PRIVATE_KEY` is already set in the environment, do not also pass `--private-key` unless you intentionally want to override it.
417
- - `CHAIN_RPC_URL` is only one default RPC URL. For chain switching, prefer passing `--rpc-url` on `aomi sign`.
534
+ - `CHAIN_RPC_URL` is only one default RPC URL. For chain switching, prefer passing `--rpc-url` on `aomi tx sign`.
418
535
  - If the user switches from Ethereum to Polygon, Arbitrum, Base, Optimism, or Sepolia, do not keep using an Ethereum `CHAIN_RPC_URL` for signing.
419
536
  - `--aa-provider` and `--aa-mode` cannot be used with `--eoa`.
420
- - In default signing mode, missing AA credentials cause the CLI to use EOA directly.
537
+ - In auto-detect mode, missing AA credentials cause the CLI to use EOA directly (no error).
421
538
 
422
539
  ## Reference: Examples
423
540
 
@@ -425,7 +542,7 @@ Storage layout by default:
425
542
 
426
543
  ```bash
427
544
  aomi chat "what is the price of ETH?" --verbose
428
- aomi log
545
+ aomi session log
429
546
  ```
430
547
 
431
548
  ### Basic Swap Flow
@@ -440,22 +557,22 @@ aomi chat "swap 1 ETH for USDC on Uniswap" \
440
557
  aomi chat "proceed"
441
558
 
442
559
  # 3. Review the queued request
443
- aomi tx
560
+ aomi tx list
444
561
 
445
- # 4. Sign with default behavior: AA first, then automatic EOA fallback if needed
446
- aomi sign tx-1 \
562
+ # 4. Sign auto-detects AA if configured, otherwise uses EOA
563
+ aomi tx sign tx-1 \
447
564
  --private-key 0xYourPrivateKey \
448
565
  --rpc-url https://eth.llamarpc.com
449
566
 
450
567
  # 5. Verify
451
- aomi tx
452
- aomi log
568
+ aomi tx list
569
+ aomi session log
453
570
  ```
454
571
 
455
572
  ### Explicit EOA Flow
456
573
 
457
574
  ```bash
458
- aomi sign tx-1 \
575
+ aomi tx sign tx-1 \
459
576
  --eoa \
460
577
  --private-key 0xYourPrivateKey \
461
578
  --rpc-url https://eth.llamarpc.com
@@ -464,13 +581,25 @@ aomi sign tx-1 \
464
581
  ### Explicit AA Flow
465
582
 
466
583
  ```bash
467
- aomi sign tx-1 \
468
- --aa \
584
+ aomi tx sign tx-1 \
469
585
  --aa-provider pimlico \
470
586
  --aa-mode 4337 \
471
587
  --private-key 0xYourPrivateKey
472
588
  ```
473
589
 
590
+ ### AA Setup With Persistent Config
591
+
592
+ ```bash
593
+ # One-time setup
594
+ aomi aa set provider alchemy
595
+ aomi aa set key your-alchemy-key
596
+ aomi aa set policy your-gas-policy-id
597
+ aomi aa status
598
+
599
+ # Now all signs auto-use AA — no flags needed
600
+ aomi tx sign tx-1 --private-key 0xYourPrivateKey
601
+ ```
602
+
474
603
  ### Alchemy Sponsorship Flow
475
604
 
476
605
  ```bash
@@ -480,7 +609,7 @@ export PRIVATE_KEY=0xYourPrivateKey
480
609
  export CHAIN_RPC_URL=https://eth.llamarpc.com
481
610
 
482
611
  aomi chat "swap 100 USDC for ETH" --public-key 0xYourAddress --chain 1
483
- aomi sign tx-1
612
+ aomi tx sign tx-1
484
613
  ```
485
614
 
486
615
  ### Switching App And Chain
@@ -488,7 +617,7 @@ aomi sign tx-1
488
617
  ```bash
489
618
  aomi chat "show my balances" --app khalani
490
619
  aomi chat "swap 1 POL for USDC on Polygon" --app khalani --chain 137
491
- aomi tx
620
+ aomi tx list
492
621
  ```
493
622
 
494
623
  ### Khalani Transfer Flow
@@ -501,10 +630,10 @@ aomi chat "swap 0.1 USDC for WETH using Khalani. Prefer a TRANSFER deposit metho
501
630
  aomi chat "proceed with the transfer route"
502
631
 
503
632
  # 3. Review the queued transfer request
504
- aomi tx
633
+ aomi tx list
505
634
 
506
635
  # 4. Sign the transfer
507
- aomi sign tx-1 --private-key 0xYourPrivateKey --rpc-url https://eth.llamarpc.com
636
+ aomi tx sign tx-1 --private-key 0xYourPrivateKey --rpc-url https://eth.llamarpc.com
508
637
 
509
638
  # 5. Continue with the agent if a submit/finalize step is required
510
639
  aomi chat "the transfer has been sent, continue"
@@ -515,10 +644,10 @@ aomi chat "the transfer has been sent, continue"
515
644
  ```bash
516
645
  # Build the request on Polygon
517
646
  aomi chat "swap 0.1 USDC for WETH using Khalani on Polygon" --app khalani --chain 137
518
- aomi tx
647
+ aomi tx list
519
648
 
520
649
  # Sign with a Polygon RPC, even if CHAIN_RPC_URL is still set to Ethereum
521
- aomi sign tx-8 --rpc-url https://polygon.drpc.org --chain 137
650
+ aomi tx sign tx-8 --rpc-url https://polygon.drpc.org --chain 137
522
651
  ```
523
652
 
524
653
  ### Session Control
@@ -526,16 +655,17 @@ aomi sign tx-8 --rpc-url https://polygon.drpc.org --chain 137
526
655
  ```bash
527
656
  aomi session list
528
657
  aomi session resume 2
529
- aomi status
530
- aomi close
658
+ aomi session status
659
+ aomi session close
531
660
  ```
532
661
 
533
662
  ## Troubleshooting
534
663
 
535
- - If `aomi chat` returns `(no response)`, wait briefly and run `aomi status`.
536
- - If signing fails in default mode, the CLI may already retry with unsponsored AA and then EOA. Read the console output before retrying manually.
537
- - If AA is required and fails, check `ALCHEMY_API_KEY` or `PIMLICO_API_KEY`, the selected chain, and any requested `--aa-mode`.
664
+ - If `aomi chat` returns `(no response)`, wait briefly and run `aomi session status`.
665
+ - If AA signing fails, the CLI tries the alternative AA mode automatically. If both modes fail, it returns an error suggesting `--eoa`. Read the console output before retrying manually.
666
+ - If AA is required and fails, check `ALCHEMY_API_KEY` or `PIMLICO_API_KEY`, the selected chain, and any requested `--aa-mode`. Use `aomi aa status` to see the resolved AA config.
538
667
  - If a transaction fails on-chain, check the RPC URL, balance, and chain.
539
- - `401`, `429`, and generic parameter errors during `aomi sign` are often RPC problems rather than transaction-construction problems. Try a reliable RPC for the correct chain.
668
+ - `401`, `429`, and generic parameter errors during `aomi tx sign` are often RPC problems rather than transaction-construction problems. Try a reliable RPC for the correct chain.
540
669
  - If `ALCHEMY_API_KEY` is set, construct the correct chain-specific Alchemy RPC before falling back to random public endpoints.
541
670
  - If one or two public RPCs fail for the same chain, stop rotating through random endpoints and ask the user for a proper RPC URL for that chain.
671
+ - Use `aomi aa test --chain <id>` to validate AA setup for a specific chain before signing.