@bloxwap/agent-cli 0.3.0 → 0.4.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/CHANGELOG.md +14 -0
- package/SKILL.md +37 -18
- package/dist/chunk-R7P7UMOD.js +9003 -0
- package/dist/cli.js +701 -8652
- package/dist/rpc-F7ZZ354G.js +14 -0
- package/package.json +4 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @bloxwap/agent-cli
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Enforce trading, funding, and durability invariants: fail closed on retried orders, effective
|
|
8
|
+
leverage, serialized risk checks, mode and network pins, rotation merges, fresh approvals, quote
|
|
9
|
+
decimals, deposit terminals, locked deposits, agent error codes, exactly-once fills, journal
|
|
10
|
+
repair, stale locks, runner liveness, and exact fill linkage.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Publish file locks atomically so concurrent nonce updates stay unique. Missing locks are retried
|
|
15
|
+
instead of stolen, and the lock file is linked into place only after its record is complete.
|
|
16
|
+
|
|
3
17
|
## 0.3.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/SKILL.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: agent-cli
|
|
3
3
|
description: Operate the agent-cli Hyperliquid trading CLI, including managed-agent onboarding, paper trading against real market data, funding, orders, event monitoring, rotation, and normalized error recovery.
|
|
4
4
|
metadata:
|
|
5
|
-
version: "0.
|
|
5
|
+
version: "0.4.0"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
Use `agent-cli` for the user's authorized Hyperliquid account operations. Obtain
|
|
@@ -61,9 +61,13 @@ continue with live onboarding below and real funding.
|
|
|
61
61
|
4. Poll `status` until each active deposit is `settled`, for at most 12 polls
|
|
62
62
|
or 5 minutes, whichever comes first. Start with 1-second delays, double to a
|
|
63
63
|
15-second cap, and stop with an explicit pending report if the budget expires.
|
|
64
|
-
Settlement requires Relay success and
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
Settlement requires Relay success and a positive Hyperliquid ledger deposit
|
|
65
|
+
(`userNonFundingLedgerUpdates`), not an unchanged equity balance. Stop on
|
|
66
|
+
failed, refunded, expired, or abandoned deposits and explain their status.
|
|
67
|
+
Quotes that never receive funds become `expired` 15 minutes after `expiresAt`.
|
|
68
|
+
`deposit --abandon` marks an unfinished deposit `abandoned`. Do not place
|
|
69
|
+
risk-increasing orders while a deposit is awaiting funds or pending. `cancel`
|
|
70
|
+
and reduce-only orders still run.
|
|
67
71
|
5. Run `run --detach`, then monitor `events --follow --since SEQ`. Persist the
|
|
68
72
|
last handled sequence; replay after reconnect. An unfilled or rejected order
|
|
69
73
|
remains incomplete: do not claim the requested trade succeeded. A fill updates the trading
|
|
@@ -77,10 +81,15 @@ network, current stage, deposit IDs, last event sequence and order cloid/oid;
|
|
|
77
81
|
record public IDs only. Missing selected-signer settings, a wallet signature,
|
|
78
82
|
funding route or settled balance is a blocked stage. Report the exact next action
|
|
79
83
|
without requesting any secret in chat or moving to the next stage. Repeat `init`
|
|
80
|
-
to resume persisted approvals rather than creating another agent.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
to resume persisted approvals rather than creating another agent. Approval and
|
|
85
|
+
revoke payloads include `expiresAt` and are regenerated after 24 hours, or when
|
|
86
|
+
Hyperliquid rejects the nonce; sign the regenerated payload. An `ok:true`
|
|
87
|
+
transport envelope does not imply exchange acceptance. Every live or paper
|
|
88
|
+
`order` carries a `cloid` (generated when omitted) on the success and on the
|
|
89
|
+
error. A mutation timeout or disconnect is `NETWORK_ERROR` with `retryable:
|
|
90
|
+
false` and `details.outcome: "unknown"`. Retry that same `intentId` or `cloid`;
|
|
91
|
+
the CLI reuses the cloid and will not place a second order. Do not mint a new
|
|
92
|
+
cloid for the same intent.
|
|
84
93
|
|
|
85
94
|
For EOA rotation, the user sets a new local key and supplies only its reference
|
|
86
95
|
with `rotate --eoa-key-ref env:NEW_EOA_KEY`. For either signer, verify
|
|
@@ -122,14 +131,14 @@ Full inputs/outputs are discoverable with `schema`; amounts/prices are strings.
|
|
|
122
131
|
| `logs --follow --level warn` | `{"level":"warn","requestId":"...","message":"Risk rejected","time":"..."}` (JSON lines) |
|
|
123
132
|
| `paper reset --yes` | `{"ok":true,"data":{"paper":true,"mode":"paper","reset":true,"startingBalance":"10000"},"mode":"paper","paper":true}` |
|
|
124
133
|
| `paper summary` | `{"ok":true,"data":{"paper":true,"mode":"paper","equity":"10000","netPnl":"0","feesPaid":"0","fundingPaid":"0","trades":0,"positions":[]}}` |
|
|
125
|
-
| `order --paper --json '{"coin":"BTC","side":"buy","size":"0.001","type":"market"}'` | `{"ok":true,"data":{"result":{"status":"ok","response":{"data":{"statuses":[{"filled":{"oid":1,"totalSz":"0.001","avgPx":"20000","status":"filled"}}]}}},"builderFeeRate":"0%","builderAddress":"0x71b09A08257078A4d642F7Dd7315e656c837329a","cloid":
|
|
134
|
+
| `order --paper --json '{"coin":"BTC","side":"buy","size":"0.001","type":"market"}'` | `{"ok":true,"data":{"result":{"status":"ok","response":{"data":{"statuses":[{"filled":{"oid":1,"totalSz":"0.001","avgPx":"20000","status":"filled"}}]}}},"builderFeeRate":"0%","builderAddress":"0x71b09A08257078A4d642F7Dd7315e656c837329a","cloid":"0x22222222222222222222222222222222"},"mode":"paper","paper":true}` |
|
|
126
135
|
| `run --paper --detach` | `{"ok":true,"data":{"pid":123,"startedAt":1700000000000,"network":"mainnet","paper":true}}` |
|
|
127
136
|
| `rotate` then `rotate --signature 0x...` | `{"ok":true,"data":{"oldAgent":"0x...","newAgent":"0x...","swapped":true,"oldRevoked":false,"revokeApproval":{}}}` |
|
|
128
137
|
| `rotate --revoke-signature 0x...` | `{"ok":true,"data":{"swapped":true,"oldRevoked":true}}` |
|
|
129
138
|
| `revoke --cancel-orders` | `{"ok":true,"data":{"locallyRevoked":true,"exchangeRevoked":false,"requiresSignature":true,"approval":{}}}` |
|
|
130
139
|
| `revoke --signature 0x...` | `{"ok":true,"data":{"locallyRevoked":true,"exchangeRevoked":true}}` |
|
|
131
140
|
| `audit --intent ID` | `{"ok":true,"data":[{"intentId":"ID","stage":"decision","data":{"allowed":true},"previousHash":"...","hash":"..."}]}` |
|
|
132
|
-
| `skill install --target codex` | `{"ok":true,"data":{"target":"codex","path":".../agent-cli/SKILL.md","version":"0.
|
|
141
|
+
| `skill install --target codex` | `{"ok":true,"data":{"target":"codex","path":".../agent-cli/SKILL.md","version":"0.4.0"}}` |
|
|
133
142
|
|
|
134
143
|
Before an order, query `market --coin BTC` for `mid`, `szDecimals`, asset and
|
|
135
144
|
market leverage ceiling. Compute size/notional with decimal strings/bigints,
|
|
@@ -137,7 +146,13 @@ using the user-approved limit or the bounded IOC execution price. A valid schema
|
|
|
137
146
|
alone does not establish that an order is tradable or within the budget.
|
|
138
147
|
|
|
139
148
|
Use `--intent-id ID --intent "reason"` on trading actions to connect the user's
|
|
140
|
-
reasoning to the audit.
|
|
149
|
+
reasoning to the audit. The CLI binds that intent to one cloid. Risk checks use
|
|
150
|
+
the account leverage Hyperliquid will apply and fail closed if it cannot be
|
|
151
|
+
read. Live and paper mutations are serialized per account. `--live` and
|
|
152
|
+
`--paper` select the mode explicitly; a running runner rejects a command whose
|
|
153
|
+
mode does not match the runner or the saved config (`CONFIG_INVALID`) until the
|
|
154
|
+
runner is restarted. Trading, rotate, and revoke reject a network other than
|
|
155
|
+
`approvedNetwork`.
|
|
141
156
|
For TP/SL use `type:"tp"|"sl"` and `triggerPrice` with size/price/reduceOnly;
|
|
142
157
|
market orders use an explicit slippage-bounded IOC, not an unbounded market order.
|
|
143
158
|
|
|
@@ -145,9 +160,9 @@ market orders use an explicit slippage-bounded IOC, not an unbounded market orde
|
|
|
145
160
|
|
|
146
161
|
| Code | Action |
|
|
147
162
|
| --- | --- |
|
|
148
|
-
| RATE_LIMIT, NETWORK_ERROR | At most 3 read retries with exponential backoff
|
|
149
|
-
| NONCE_COLLISION | Retry using a newly issued nonce;
|
|
150
|
-
| DEPOSIT_PENDING | Poll status until settled
|
|
163
|
+
| RATE_LIMIT, NETWORK_ERROR | At most 3 read retries with exponential backoff. A mutation with `details.outcome` `"unknown"` is not retryable: retry the same `intentId` or `cloid` only, which the CLI reconciles. Stop if that result is still unknown |
|
|
164
|
+
| NONCE_COLLISION | Retry using a newly issued nonce. A stale approval nonce is not retryable; sign the regenerated payload. A lock held by a live process is `INTERNAL` and is not retryable |
|
|
165
|
+
| DEPOSIT_PENDING | Poll status until settled, expired, or abandoned. `cancel` and reduce-only orders still run. `deposit --abandon` stops a quote you will not fund |
|
|
151
166
|
| RUNNER_NOT_RUNNING | Start runner or use configured direct fallback |
|
|
152
167
|
| INSUFFICIENT_MARGIN | Reduce exposure or request authorized funding |
|
|
153
168
|
| POLICY_REJECTED | Stop and revise intent within limits; do not bypass policy |
|
|
@@ -155,15 +170,19 @@ market orders use an explicit slippage-bounded IOC, not an unbounded market orde
|
|
|
155
170
|
| AGENT_NOT_APPROVED | Complete init/approval or explain revocation |
|
|
156
171
|
| INVALID_SIZE, INVALID_PRICE | Correct input using market precision |
|
|
157
172
|
| UNKNOWN_MARKET | Refresh metadata; use an allowed market |
|
|
158
|
-
| ORDER_NOT_FOUND | Refresh orders before changing intent |
|
|
173
|
+
| ORDER_NOT_FOUND | Refresh orders before changing intent. An unknown or expired agent is `AGENT_NOT_APPROVED` or `AGENT_EXPIRED`, not this code |
|
|
159
174
|
| CONFIG_INVALID | Correct configuration/input; never insert secrets |
|
|
160
175
|
| UPSTREAM_ERROR, INTERNAL | Stop, inspect redacted details/logs and report failure |
|
|
161
176
|
|
|
162
177
|
## Gotchas
|
|
163
178
|
|
|
164
|
-
HyperCore perps USDC uses **8 decimals**; EVM USDC uses **6**.
|
|
165
|
-
|
|
166
|
-
|
|
179
|
+
HyperCore perps USDC uses **8 decimals**; EVM USDC uses **6**. The quote's origin
|
|
180
|
+
decimals must match `originDecimals` or `fund` returns `CONFIG_INVALID`. Preserve
|
|
181
|
+
strings and bigints. Some deposits require **two distinct signatures**; resume
|
|
182
|
+
stored steps rather than restarting the route. Agent expiry is at most **180 days**.
|
|
183
|
+
Fills in `events.jsonl` are delivered once per exchange `tid`, including
|
|
184
|
+
fills that happen while the runner is down; dedupe by `tid` as well as `seq`.
|
|
185
|
+
Never
|
|
167
186
|
ask for, paste, log or import a master private key or seed. EOA agent keys are
|
|
168
187
|
accepted only through user-configured local references, never command input.
|
|
169
188
|
The agent is trade-only; local limits include markets, size/notional, leverage,
|