felix-mcp 2.0.132 → 2.0.134
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 +59 -38
- package/dist/getting-started-guide.js +49 -50
- package/dist/index.js +433 -27
- package/package.json +1 -1
- package/server.json +2 -2
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
Non-custodial trading tools for AI agents across Hyperliquid, Polymarket, and
|
|
8
8
|
Derive. Live execution is the default; paper mode must be selected explicitly.
|
|
9
9
|
|
|
10
|
-
Package version: `felix-mcp@2.0.
|
|
10
|
+
Package version: `felix-mcp@2.0.134`. For prepublication review, use the local
|
|
11
11
|
tarball below. Packaging checks do not certify live money workflows.
|
|
12
12
|
|
|
13
13
|
## Hosted (no install)
|
|
@@ -48,14 +48,14 @@ node --version
|
|
|
48
48
|
npm ci
|
|
49
49
|
candidate_dir="$(mktemp -d)"
|
|
50
50
|
npm pack --pack-destination "$candidate_dir"
|
|
51
|
-
npm install --global "$candidate_dir/felix-mcp-2.0.
|
|
51
|
+
npm install --global "$candidate_dir/felix-mcp-2.0.134.tgz"
|
|
52
52
|
felix-keys --help
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
After the operator publishes this version, the registry installation is:
|
|
56
56
|
|
|
57
57
|
```bash
|
|
58
|
-
npm install --global felix-mcp@2.0.
|
|
58
|
+
npm install --global felix-mcp@2.0.134
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
### 2. Set up keys locally
|
|
@@ -153,12 +153,12 @@ create_account(
|
|
|
153
153
|
|
|
154
154
|
Account creation is funded-first:
|
|
155
155
|
|
|
156
|
-
1. The first call reserves an isolated account and returns
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
156
|
+
1. The first call reserves an isolated account and returns how to fund it:
|
|
157
|
+
`create_deposit` moves stablecoins from another network into the account's
|
|
158
|
+
Arc home Safe. No wallet is deployed and no chain gas is spent.
|
|
159
|
+
2. Deposit at least the returned minimum, currently $5, with `create_deposit`.
|
|
160
160
|
3. After confirmation, retry `create_account` with the same idempotency key.
|
|
161
|
-
4. Felix verifies the owner-controlled
|
|
161
|
+
4. Felix verifies the owner-controlled Arc home Safe/module,
|
|
162
162
|
enables supported venues, stores the least-privilege child credential
|
|
163
163
|
locally, and activates it. If Arc verification is pending or unavailable,
|
|
164
164
|
retry the same key; no live credential is activated.
|
|
@@ -173,9 +173,10 @@ Then verify and trade:
|
|
|
173
173
|
get_status()
|
|
174
174
|
get_money_map()
|
|
175
175
|
search_markets(q="bitcoin")
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
create_deposit(from_currency="usdc_base", from_amount=17, idempotency_key="first-deposit")
|
|
177
|
+
preview_order(instrument="crypto:BTC", side="buy", size_usd=12)
|
|
178
|
+
fund_hypercore_from_arc(amount_usd=15, idempotency_key="first-hl-funding")
|
|
179
|
+
place_manual_order(instrument="crypto:BTC", side="buy", size_usd=12)
|
|
179
180
|
get_situation()
|
|
180
181
|
```
|
|
181
182
|
|
|
@@ -225,12 +226,11 @@ account's reported home rather than assuming every account uses Arc.
|
|
|
225
226
|
`get_deposit_address` reports `funded`, retry `create_account` with the same
|
|
226
227
|
idempotency key; it completes owner-signed Arc-home onboarding before issuing
|
|
227
228
|
a live key.
|
|
228
|
-
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
returns are not supported in this release.
|
|
229
|
+
- A new account funds venues from its Arc home: `fund_polymarket_from_arc`
|
|
230
|
+
(Polymarket) and `fund_hypercore_from_arc` (Hyperliquid), 5 to 25 USDC each
|
|
231
|
+
plus a disclosed 1.00 USDC network fee, the same moves the app uses.
|
|
232
|
+
`fund_market` spends USDC from a legacy Polygon owner wallet only. Derive
|
|
233
|
+
funding is not supported in this release.
|
|
234
234
|
- Arc transfers (`prepare_arc_transfer`, `submit_arc_transfer`) are not yet
|
|
235
235
|
certified end to end. Do not start one just to fund a venue. For a transfer
|
|
236
236
|
already started, keep its operation ID and key and follow
|
|
@@ -251,11 +251,9 @@ account's reported home rather than assuming every account uses Arc.
|
|
|
251
251
|
- `arc_home_deposit`: owner USDC on another chain into the Arc home Safe.
|
|
252
252
|
Felix tops up only the shortfall in the owner's Gateway balance, broadcast
|
|
253
253
|
by the owner through your own `FELIX_<CHAIN>_RPC_URL`.
|
|
254
|
-
- `arc_home_fund_venue`:
|
|
255
|
-
|
|
256
|
-
`
|
|
257
|
-
fund Polymarket. Hyperliquid and Derive are refused before anything is
|
|
258
|
-
prepared.
|
|
254
|
+
- `arc_home_fund_venue`: legacy, for accounts with a Polygon owner wallet
|
|
255
|
+
record. New accounts use `fund_polymarket_from_arc` and
|
|
256
|
+
`fund_hypercore_from_arc`.
|
|
259
257
|
- Recovery: `get_arc_home_operation` (read), `reconcile_arc_home_operation`,
|
|
260
258
|
and `report_arc_home_mint` for a destination mint you broadcast yourself.
|
|
261
259
|
Retry the original tool with the same `idempotency_key`; never start a
|
|
@@ -329,8 +327,7 @@ replacement within the account's owner-approved ceiling.
|
|
|
329
327
|
|
|
330
328
|
The account's operation, daily, and lifetime ceilings are selected and signed
|
|
331
329
|
when the account is created. They cannot be raised in place by an API key,
|
|
332
|
-
agent, or Felix.
|
|
333
|
-
`lockdown`, not higher ceilings.
|
|
330
|
+
agent, or Felix. To stop all trading on an account, use `panic`.
|
|
334
331
|
|
|
335
332
|
To use higher ceilings, create a new account with the intended limits and move
|
|
336
333
|
funds through the normal withdrawal and deposit flows. Lower local limits may be
|
|
@@ -359,7 +356,9 @@ symbol formats.
|
|
|
359
356
|
4. Verify the fill, position, fee status, and account state with
|
|
360
357
|
`get_situation`, `get_positions`, and `get_fills`.
|
|
361
358
|
|
|
362
|
-
`auto_fund:true` may fund the venue before placing the order
|
|
359
|
+
`auto_fund:true` may fund the venue before placing the order from the launcher
|
|
360
|
+
key; an account's own key funds the venue first with `fund_hypercore_from_arc`
|
|
361
|
+
or `fund_polymarket_from_arc`. The preview is the
|
|
363
362
|
authoritative cost and feasibility check. A successful funding leg is never
|
|
364
363
|
repeated merely because the later order is rejected.
|
|
365
364
|
|
|
@@ -389,18 +388,41 @@ Safe; it does not retrieve venue balances.
|
|
|
389
388
|
| Money action | Status in this candidate |
|
|
390
389
|
| --- | --- |
|
|
391
390
|
| Fund Polymarket or Hyperliquid from the Polygon owner wallet | End-to-end live evidence on earlier builds |
|
|
392
|
-
| Fund Polymarket or Hyperliquid from Arc home funds |
|
|
393
|
-
| Arc home Safe withdrawal
|
|
391
|
+
| Fund Polymarket or Hyperliquid from Arc home funds | `fund_polymarket_from_arc` and `fund_hypercore_from_arc` (the app's routes) |
|
|
392
|
+
| Arc home Safe withdrawal (`arc_home_withdraw`) | Available |
|
|
393
|
+
| Arc home Safe deposit from another chain (`arc_home_deposit`) | Not certified on this candidate; new accounts use `create_deposit` |
|
|
394
394
|
| Fund Derive | Not certified; do not start a new operation |
|
|
395
|
-
| Return
|
|
395
|
+
| Return Hyperliquid perps to the Arc home (`arc_home_hypercore_return`) | Available (the app's route) |
|
|
396
|
+
| Return from other venues to the Arc home | Not available from the MCP in this release; use Wallet in the Felix app |
|
|
396
397
|
| Withdraw owner-wallet or Safe funds to an approved address | Available; does not pull funds from a venue |
|
|
397
398
|
| Arc transfer between Gateway domains | Not certified; recover existing operations only |
|
|
398
|
-
|
|
|
399
|
+
| Move free cash between Hyperliquid, Polymarket and Lighter (`transfer_between_venues`) | Available (the app's Transfer) |
|
|
399
400
|
|
|
400
401
|
An unsupported action is not necessarily blocked by the current API. This
|
|
401
402
|
table is a safety boundary for this candidate, not a claim that the server
|
|
402
403
|
always refuses before movement.
|
|
403
404
|
|
|
405
|
+
### Venue-to-venue transfers
|
|
406
|
+
|
|
407
|
+
`transfer_between_venues` moves free cash straight from one venue to another
|
|
408
|
+
(Hyperliquid, Polymarket, Lighter), the same Transfer the Felix app uses. Felix
|
|
409
|
+
signs it; only the owner's own venue accounts and Trading wallet are paid, and
|
|
410
|
+
open orders, positions and running agents keep their cash. Give `amount_usd`,
|
|
411
|
+
or `all_free_cash:true` to move everything that is free. One `idempotency_key`
|
|
412
|
+
is one transfer: a retry with the same key returns the same transfer.
|
|
413
|
+
|
|
414
|
+
```text
|
|
415
|
+
preview_venue_transfer(from_venue="hyperliquid", to_venue="polymarket", amount_usd=20)
|
|
416
|
+
transfer_between_venues(from_venue="hyperliquid", to_venue="polymarket", amount_usd=20,
|
|
417
|
+
idempotency_key="hl-to-pm-1", wait_seconds=60)
|
|
418
|
+
get_venue_transfer(transfer_id="...")
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
States are `sending`, `completed`, `partial`, `failed` and `needs_review`. Never
|
|
422
|
+
start another transfer from a venue while one is `sending` or `needs_review`;
|
|
423
|
+
`list_venue_transfers(open_only=true)` shows any still moving. In an account
|
|
424
|
+
session the start goes out on the local launcher key for the selected account.
|
|
425
|
+
|
|
404
426
|
Use:
|
|
405
427
|
|
|
406
428
|
- `preview_funding_route`: read-only Polygon-to-Hyperliquid Relay quote with
|
|
@@ -571,14 +593,13 @@ the complete protocol.
|
|
|
571
593
|
and venue minimums can dominate small accounts. Do not infer economics from a
|
|
572
594
|
different instrument or venue.
|
|
573
595
|
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
a confirmed fill, and released after a confirmed no-fill. Withdrawals do not
|
|
578
|
-
collect trading fees and Felix does not create fee debt.
|
|
596
|
+
Felix's trading fee is charged from the trading account after each fill and
|
|
597
|
+
never blocks an order, so no prepaid fee credit or top-up is needed to trade.
|
|
598
|
+
Withdrawals do not collect trading fees.
|
|
579
599
|
|
|
580
|
-
|
|
581
|
-
|
|
600
|
+
Accounts that still hold prepaid fee credit from earlier releases can read it
|
|
601
|
+
with `get_fee_balance`; reserved credit is unavailable for another order until
|
|
602
|
+
its reservation is released or captured. Fee credit is not withdrawable cash or
|
|
582
603
|
venue collateral and is excluded from the money map's wallet total. When the
|
|
583
604
|
response includes `exact`, use its six-decimal unit strings for accounting;
|
|
584
605
|
the numeric USD fields are convenient display values. Captured prepaid fees
|
|
@@ -604,7 +625,6 @@ owner-authorized workflow.
|
|
|
604
625
|
|
|
605
626
|
## Emergency actions
|
|
606
627
|
|
|
607
|
-
- `update_wallet_policy(action="lockdown")`: owner-controlled account stop.
|
|
608
628
|
- `panic(confirm=true)`: blocks new exposure, attempts to cancel and flatten,
|
|
609
629
|
and revokes active account API keys.
|
|
610
630
|
- `archive_account`: locks and archives only a completely flat child account.
|
|
@@ -631,7 +651,8 @@ interrupted message with the same key.
|
|
|
631
651
|
- Portfolio: `get_situation`, `get_positions`, `get_fills`,
|
|
632
652
|
`get_account_statement`, `get_pnl`,
|
|
633
653
|
`get_money_map`, `verify_custody`.
|
|
634
|
-
- Money: funding,
|
|
654
|
+
- Money: funding, venue-to-venue transfers, bring-home, withdrawal, and venue
|
|
655
|
+
onboarding tools.
|
|
635
656
|
- Agents: strategy guide, backtest, walk-forward validation, deploy, status,
|
|
636
657
|
logs, events, update, stop.
|
|
637
658
|
- Account: keys, children, policy, webhooks, subscription, support, and archive.
|
|
@@ -18,7 +18,7 @@ then creates the identity and loads it into the session with no restart.
|
|
|
18
18
|
Or let your AI agent run this single command:
|
|
19
19
|
|
|
20
20
|
~~~bash
|
|
21
|
-
npx -y --package felix-mcp@2.0.
|
|
21
|
+
npx -y --package felix-mcp@2.0.134 felix-keys onboard --accept-terms --client claude
|
|
22
22
|
~~~
|
|
23
23
|
|
|
24
24
|
After the user reviews the terms and explicitly authorizes acceptance, the agent
|
|
@@ -95,26 +95,26 @@ Empty accounts remain database-only and consume no chain gas.
|
|
|
95
95
|
|
|
96
96
|
$5 is the activation minimum. It activates the wallet; it does not by itself
|
|
97
97
|
fund a first live trade, and Hyperliquid needs more than $5. Beyond the traded
|
|
98
|
-
notional,
|
|
99
|
-
|
|
100
|
-
credit
|
|
101
|
-
live open:
|
|
102
|
-
|
|
103
|
-
- Polymarket: about $
|
|
104
|
-
Many markets set a
|
|
98
|
+
notional, funding a venue from the Arc home pays a flat 1.00 USDC network fee
|
|
99
|
+
(5 to 25 USDC per move). Felix's trading fee is charged from the trading
|
|
100
|
+
account after each fill; no prepaid fee credit or top-up is needed. Approximate
|
|
101
|
+
all-in floors for a first live open:
|
|
102
|
+
|
|
103
|
+
- Polymarket: about $6.00 (fund_polymarket_from_arc moves at least $5, plus
|
|
104
|
+
the $1.00 network fee). Many markets set a share-based minimum; read
|
|
105
|
+
preview_order.
|
|
105
106
|
- Derive: about $1.90 when funds already sit on the Derive chain, or about
|
|
106
107
|
$4.90 bridged from Polygon, where the bridge minimum is $4. Derive's real
|
|
107
108
|
minimum order is market-derived and its option fee carries a $0.10 base.
|
|
108
109
|
Derive funding is under release hold in this release: do not start a new
|
|
109
110
|
Derive funding operation, even if a preview reports executable:true.
|
|
110
|
-
- Hyperliquid: about $11.
|
|
111
|
-
|
|
111
|
+
- Hyperliquid: about $11.00 ($10 minimum notional, $1.00 network fee), plus
|
|
112
|
+
Hyperliquid's one-time account activation (about $1.20, deducted from the
|
|
113
|
+
first funding) on a new HyperCore account. This exceeds the $5 activation
|
|
114
|
+
deposit.
|
|
112
115
|
|
|
113
|
-
Never route the whole
|
|
114
|
-
|
|
115
|
-
Polymarket leaves $0.00 at home, the first order is refused with
|
|
116
|
-
'fee_balance_required', and the top-up is then refused for insufficient owner
|
|
117
|
-
balance. Keep at least the top-up plus the disclosed trading buffer at home.
|
|
116
|
+
Never route the whole Arc home balance to a venue: each move also pays the
|
|
117
|
+
1.00 USDC network fee from the Arc home, so keep that much there.
|
|
118
118
|
|
|
119
119
|
After funding is verified, activation usually takes 60-120 seconds and may take
|
|
120
120
|
longer while venue onboarding settles. Keep the call open. If it is interrupted,
|
|
@@ -122,7 +122,7 @@ retry with the same idempotency key; never invent a new key for the same attempt
|
|
|
122
122
|
The workflow resumes completed checkpoints and reports whether any money moved.
|
|
123
123
|
|
|
124
124
|
The MCP derives a unique account owner from the local root owner, verifies and
|
|
125
|
-
signs the exact
|
|
125
|
+
signs the exact Arc home Safe/module locally, then
|
|
126
126
|
enables supported venues. It mints a least-privilege live key only after the
|
|
127
127
|
Arc home verifies, stores the account binding in Keychain, and activates it.
|
|
128
128
|
If Arc verification is pending or unavailable, retry the same key; do not
|
|
@@ -130,14 +130,15 @@ create a replacement account or send funds to an unverified Arc address.
|
|
|
130
130
|
Read 'get_deposit_address' before any deposit. Every deposit settles into the
|
|
131
131
|
Arc home Safe; use 'create_deposit' for any token on its own network, and send
|
|
132
132
|
USDC that is already on Arc only to 'direct_arc_usdc.address'.
|
|
133
|
-
To
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
To fund a venue from the Arc home, use 'fund_polymarket_from_arc' (Polymarket)
|
|
134
|
+
or 'fund_hypercore_from_arc' (Hyperliquid), 5 to 25 USDC plus a 1.00 USDC
|
|
135
|
+
Felix network fee, owner-signed locally, the same moves the app uses. To move money
|
|
136
|
+
in or out of the Arc home Safe itself, use 'arc_home_withdraw' or
|
|
137
|
+
'arc_home_deposit'. These are owner-signed and need an 'idempotency_key'.
|
|
137
138
|
Recover with 'get_arc_home_operation' and 'reconcile_arc_home_operation'.
|
|
138
139
|
Between the Arc home Safe and your own Hyperliquid perps (the moves the app
|
|
139
140
|
uses, 5 to 25 USDC each, Relay, owner-signed locally): 'fund_hypercore_from_arc'
|
|
140
|
-
(Home to perps; a separate 1.00 USDC Felix fee) and 'arc_home_hypercore_return'
|
|
141
|
+
(Home to perps; a separate 1.00 USDC Felix network fee) and 'arc_home_hypercore_return'
|
|
141
142
|
(perps to Home; no Felix fee). Select the account with 'use_child_account'
|
|
142
143
|
first; reuse the same 'idempotency_key' after any timeout.
|
|
143
144
|
Guided onboarding already created the encrypted recovery file; require
|
|
@@ -154,12 +155,11 @@ Then:
|
|
|
154
155
|
|
|
155
156
|
1. Retry 'create_account' after its required deposit and wait for activation.
|
|
156
157
|
2. Call 'get_money_map' and verify the active account ID and balances.
|
|
157
|
-
3. Call 'preview_order'
|
|
158
|
-
constraints, fees, prepaid fee-credit requirement, and expected duration
|
|
158
|
+
3. Call 'preview_order' to see constraints, fees and the live minimum
|
|
159
159
|
without moving money.
|
|
160
|
-
4.
|
|
161
|
-
|
|
162
|
-
5. Call '
|
|
160
|
+
4. Fund the venue from the Arc home with 'fund_hypercore_from_arc' or
|
|
161
|
+
'fund_polymarket_from_arc' (5 to 25 USDC plus the 1.00 USDC network fee).
|
|
162
|
+
5. Call 'place_manual_order' with the same intent and a stable idempotency key.
|
|
163
163
|
6. Verify the result with 'get_situation', positions, fills, and money state.
|
|
164
164
|
|
|
165
165
|
### Autonomous Polymarket agents
|
|
@@ -193,12 +193,13 @@ observe the existing intent, never to create a new one.
|
|
|
193
193
|
Use preview_order before every new live order shape. Venue minimums and fees
|
|
194
194
|
vary by instrument, and Derive's fixed venue fees can make a small option order
|
|
195
195
|
uneconomical even when collateral is technically sufficient. Do not infer a
|
|
196
|
-
minimum from a previous contract.
|
|
197
|
-
owner-wallet trading buffer by default; overriding that warning can leave the
|
|
198
|
-
home wallet unable to auto-fund a venue.
|
|
196
|
+
minimum from a previous contract.
|
|
199
197
|
|
|
200
|
-
## SDK or custom signer path
|
|
198
|
+
## SDK or custom signer path (retired)
|
|
201
199
|
|
|
200
|
+
Polygon Safe wallets are retired: every account's wallet is its Arc home Safe,
|
|
201
|
+
created by 'create_account', and the tools below answer
|
|
202
|
+
'polygon_safe_hub_retired'. This section is kept for reference only.
|
|
202
203
|
Use this path only when your application already owns the signer lifecycle.
|
|
203
204
|
The authenticated manage key creates or selects the account; the private key
|
|
204
205
|
must remain inside your wallet, HSM, or OS credential store.
|
|
@@ -304,16 +305,11 @@ Web equivalents:
|
|
|
304
305
|
- Never synthesize a Polymarket slug, Derive contract, or venue symbol.
|
|
305
306
|
- Call preview_order before every new live shape. It is the authoritative
|
|
306
307
|
source for tradeability, minimum size, collateral, leverage, liquidity,
|
|
307
|
-
all-in execution fees,
|
|
308
|
-
requirements. A minimum learned from
|
|
308
|
+
all-in execution fees, and funding requirements. A minimum learned from
|
|
309
309
|
a previous instrument or rejection is not reusable market metadata.
|
|
310
|
-
Read its 'fee_credit_check' block
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
$0, nothing in onboarding creates it, and there is no signup grant, so the
|
|
314
|
-
first live open needs 'top_up_fee_balance' first. Auto-funding does not buy
|
|
315
|
-
it: auto_fund routes venue collateral only. 'fee_credit_check.ok: null' means
|
|
316
|
-
the billing ledger could not be read and does not block; submission rechecks. Derive
|
|
310
|
+
Read its 'fee_credit_check' block: Felix's fee is charged from the trading
|
|
311
|
+
account after each fill and never blocks an order, so no prepaid fee credit
|
|
312
|
+
or top-up is needed. Derive
|
|
317
313
|
option previews also expose exact quote-sized signed delta and venue-native
|
|
318
314
|
gamma, theta, and vega impact. Missing Greek fields are unavailable, not zero.
|
|
319
315
|
If the owner configured Derive Greek limits, the preview includes the exact
|
|
@@ -326,17 +322,20 @@ Web equivalents:
|
|
|
326
322
|
|
|
327
323
|
## First safe trade
|
|
328
324
|
|
|
329
|
-
1. get_status
|
|
330
|
-
2. get_money_map
|
|
331
|
-
3. search_markets or list_markets
|
|
332
|
-
4. preview_order
|
|
333
|
-
5.
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
325
|
+
1. get_status: verify active account, client compatibility, venue health.
|
|
326
|
+
2. get_money_map: verify account scope, completeness, and available funds.
|
|
327
|
+
3. search_markets or list_markets: select a returned canonical instrument.
|
|
328
|
+
4. preview_order: no money moves. Read the live minimum and fees.
|
|
329
|
+
5. fund_hypercore_from_arc or fund_polymarket_from_arc: fund the venue from
|
|
330
|
+
the Arc home (5 to 25 USDC plus the 1.00 USDC network fee). No fee top-up is
|
|
331
|
+
needed: the fee is charged after each fill.
|
|
332
|
+
6. place_manual_order: live, exactly like the app's ticket. For a simulation
|
|
333
|
+
use place_order with paper:true.
|
|
334
|
+
7. get_situation, positions, and fills: reconcile before another action.
|
|
335
|
+
|
|
336
|
+
Cash already on one venue can move to another without going back through the
|
|
337
|
+
Arc home: preview_venue_transfer, then transfer_between_venues (Hyperliquid,
|
|
338
|
+
Polymarket, Lighter; open orders and positions keep their cash).
|
|
340
339
|
|
|
341
340
|
For a timeout or unknown order result, reuse the same idempotency key and
|
|
342
341
|
reconcile. Never create a replacement key until the original intent is known.
|
package/dist/index.js
CHANGED
|
@@ -126,7 +126,7 @@ export function validatedApiBase(raw = process.env.FELIX_API_URL || `https://${O
|
|
|
126
126
|
return parsed.origin;
|
|
127
127
|
}
|
|
128
128
|
const API = validatedApiBase();
|
|
129
|
-
const MCP_VERSION = "2.0.
|
|
129
|
+
const MCP_VERSION = "2.0.134";
|
|
130
130
|
const AES_GCM_IV_BYTES = 12;
|
|
131
131
|
const AES_GCM_TAG_BYTES = 16;
|
|
132
132
|
const MAX_MONEY_JOURNAL_BYTES = 16 * 1024 * 1024;
|
|
@@ -2720,6 +2720,7 @@ async function ensureManualTradingPolicy(accountId, ownerKey, authKey, consent =
|
|
|
2720
2720
|
manualPolicyReadyUntil.set(cacheKey, Date.now() + MANUAL_POLICY_READY_TTL_MS);
|
|
2721
2721
|
// The remembered yes only covers retrying a failed submit: once signed, any later draft asks the owner again.
|
|
2722
2722
|
approvedTradingPolicyTerms.delete(termsId);
|
|
2723
|
+
relayedTradingPolicyTerms.delete(termsId);
|
|
2723
2724
|
return { ok: true, status: renewal ? "renewed" : "ready", policy: signed.summary, money_moved: false };
|
|
2724
2725
|
})().finally(() => tradingPolicySubmitsInFlight.delete(termsId));
|
|
2725
2726
|
tradingPolicySubmitsInFlight.set(termsId, submitting);
|
|
@@ -2817,7 +2818,7 @@ const ARC_HOME_RECONCILE_POLL_MS = 5_000;
|
|
|
2817
2818
|
const ARC_HOME_VENUES = ["polymarket"];
|
|
2818
2819
|
const ARC_HOME_VENUE_CHAIN = { polymarket: "polygon" };
|
|
2819
2820
|
const ARC_HOME_UNSUPPORTED_VENUES = {
|
|
2820
|
-
hyperliquid: "
|
|
2821
|
+
hyperliquid: "This tool does not fund Hyperliquid. Use fund_hypercore_from_arc (5 to 25 USDC from the Arc home to the owner's own Hyperliquid perps).",
|
|
2821
2822
|
derive: "Arc home -> Derive funding is not executable in this release.",
|
|
2822
2823
|
};
|
|
2823
2824
|
function arcHomeFailure(error, operationId, moneyMoved) {
|
|
@@ -2839,7 +2840,13 @@ async function arcHomeOwnerKeyFor(accountId) {
|
|
|
2839
2840
|
async function arcHomeCall(method, path, body, opts = {}) {
|
|
2840
2841
|
// A child session's Arc home money calls go out on the launcher credential for that child (Astra mcploop r2:
|
|
2841
2842
|
// the child's read/trade key got 403 'transfer' on an implicit arc_home_withdraw).
|
|
2842
|
-
|
|
2843
|
+
// Opus QA r15: that launcher credential could act on ANY owned account, so an explicit account_id for a different
|
|
2844
|
+
// account than the session's is refused here exactly like call()'s child-management guard, never retargeted.
|
|
2845
|
+
const selected = activeChildAccountId();
|
|
2846
|
+
if (selected && opts.accountId && opts.accountId.toLowerCase() !== selected.toLowerCase()) {
|
|
2847
|
+
return clientError("account_mismatch", "This session is working on a different account than the account_id you passed. Nothing was sent.", "Omit account_id to act on the selected account, or call use_child_account with the other account first.", { selected_account_id: selected, money_moved: false });
|
|
2848
|
+
}
|
|
2849
|
+
const accountId = opts.accountId || selected;
|
|
2843
2850
|
const targetPath = accountId && method === "GET" ? withTargetAccountQuery(path, accountId) : path;
|
|
2844
2851
|
const targetBody = accountId && method === "POST" ? { ...(body || {}), account_id: accountId } : body;
|
|
2845
2852
|
return call(method, targetPath, targetBody, {
|
|
@@ -3708,6 +3715,215 @@ function fundingRpcAccess(targetAccountId) {
|
|
|
3708
3715
|
...(managingChild ? { account_id: selectedAccountId } : {}),
|
|
3709
3716
|
};
|
|
3710
3717
|
}
|
|
3718
|
+
// Opus QA r12: engine refusals that a new (Arc home) account reaches, mapped to the tool that works for it.
|
|
3719
|
+
const FUND_VENUE_FROM_ARC_HINT = "Fund the venue from the Arc home with fund_polymarket_from_arc (5 to 25 USDC plus a disclosed 1.00 USDC "
|
|
3720
|
+
+ "network fee) or fund_hypercore_from_arc (Hyperliquid), then place the order. Nothing was signed and no money moved.";
|
|
3721
|
+
const FEE_CREDIT_TOOLS = new Set(["top_up_fee_balance", "preview_fee_top_up", "settle_fees", "preview_fee_settlement"]);
|
|
3722
|
+
const VENUE_FUNDING_TOOLS = new Set([
|
|
3723
|
+
"start_home_funding", "start_capital_move", "prepare_venue_bootstrap", "submit_venue_bootstrap",
|
|
3724
|
+
"arc_home_fund_venue", "fund_market", "start_fund_market",
|
|
3725
|
+
]);
|
|
3726
|
+
export function withNewAccountNextStep(name, out, args = {}) {
|
|
3727
|
+
if (out.ok !== false || !isRecord(out.error))
|
|
3728
|
+
return out;
|
|
3729
|
+
// Never rewrite a result whose money may have moved or that needs reconciling (Opus QA r13).
|
|
3730
|
+
const moneyMaybeMoved = (record) => record.money_moved === true
|
|
3731
|
+
|| record.money_moved === "unknown" || record.user_funds_moved === true || record.reconciliation_required === true
|
|
3732
|
+
|| record.outcome_unknown === true;
|
|
3733
|
+
if ([out, out.error, out.result, out.workflow].some((record) => isRecord(record) && moneyMaybeMoved(record)))
|
|
3734
|
+
return out;
|
|
3735
|
+
if (isRecord(out.result) && isRecord(out.result.error) && isRecord(out.result.result)
|
|
3736
|
+
&& moneyMaybeMoved(out.result.result))
|
|
3737
|
+
return out;
|
|
3738
|
+
const error = out.error;
|
|
3739
|
+
const codes = [error.code, error.reason, out.reason].map((value) => nonEmptyString(value) ?? "");
|
|
3740
|
+
const message = typeof error.message === "string" ? error.message : "";
|
|
3741
|
+
// The mapped hint replaces every copy of the old one (an async operation repeats it at the top level and in result).
|
|
3742
|
+
const next = (hint, nextTools, extra = {}) => ({
|
|
3743
|
+
...out, ...extra,
|
|
3744
|
+
...(typeof out.hint === "string" ? { hint } : {}),
|
|
3745
|
+
...(isRecord(out.result) && isRecord(out.result.error)
|
|
3746
|
+
? { result: { ...out.result, error: { ...out.result.error, hint } } } : {}),
|
|
3747
|
+
error: { ...error, hint }, next_tools: nextTools,
|
|
3748
|
+
});
|
|
3749
|
+
if (codes.includes("arc_home_venue_wallet_unavailable")) {
|
|
3750
|
+
return next(FUND_VENUE_FROM_ARC_HINT, ["fund_polymarket_from_arc", "fund_hypercore_from_arc"]);
|
|
3751
|
+
}
|
|
3752
|
+
if (codes.includes("polygon_safe_hub_retired")) {
|
|
3753
|
+
return next("This Polygon Safe tool is retired: the account's wallet is its Arc home Safe. See it with get_balances, "
|
|
3754
|
+
+ "fund it with create_deposit, fund a venue with fund_polymarket_from_arc or fund_hypercore_from_arc, and stop "
|
|
3755
|
+
+ "all trading with panic.", ["get_balances", "create_deposit", "fund_polymarket_from_arc", "fund_hypercore_from_arc", "panic"]);
|
|
3756
|
+
}
|
|
3757
|
+
if (codes.includes("venue_return_prepare_not_launch_enabled")) {
|
|
3758
|
+
// Opus QA r14: new venue returns via bring_home are not enabled; name what works instead of a raw route.
|
|
3759
|
+
const venue = String(error.venue ?? out.venue ?? args.venue ?? "").toLowerCase();
|
|
3760
|
+
const already = " A return you already started keeps going: retry it with its original idempotency_key, and see "
|
|
3761
|
+
+ "balances with get_money_map.";
|
|
3762
|
+
if (venue === "crypto" || venue === "hyperliquid") {
|
|
3763
|
+
return next("Bring Hyperliquid perps money home with arc_home_hypercore_return (5 to 25 USDC to the Arc home). "
|
|
3764
|
+
+ "No return was created and no money moved." + already, ["arc_home_hypercore_return", "get_money_map"], { retryable: false });
|
|
3765
|
+
}
|
|
3766
|
+
return next("Bringing money home from this venue is not available from the MCP in this release; use Wallet in the "
|
|
3767
|
+
+ "Felix app. No return was created and no money moved." + already, ["get_money_map"], { retryable: false });
|
|
3768
|
+
}
|
|
3769
|
+
if (codes.includes("fee_credit_topup_not_ready") && FEE_CREDIT_TOOLS.has(name)) {
|
|
3770
|
+
return next("Not needed: Felix charges its fee from the trading account as each order fills, so no prepaid fee "
|
|
3771
|
+
+ "credit is required to trade. Nothing was signed and no money moved.", ["preview_order", "place_manual_order"], { fee_credit_required: false });
|
|
3772
|
+
}
|
|
3773
|
+
if (VENUE_FUNDING_TOOLS.has(name) && /lacks the '(?:transfer|manage)' scope/.test(message)) {
|
|
3774
|
+
const venue = String(args.venue ?? "").toLowerCase();
|
|
3775
|
+
// Only name routes that work from an account session (Opus QA r14: bring_home's new returns are not enabled).
|
|
3776
|
+
if (args.direction === "bring_home") {
|
|
3777
|
+
if (venue === "hyperliquid") {
|
|
3778
|
+
return next("Bring Hyperliquid perps money home with arc_home_hypercore_return (5 to 25 USDC to the Arc home). "
|
|
3779
|
+
+ "Nothing was signed and no money moved.", ["arc_home_hypercore_return"]);
|
|
3780
|
+
}
|
|
3781
|
+
return next("Bringing money home from this venue is not available from the MCP in this release; use Wallet in the "
|
|
3782
|
+
+ "Felix app. Nothing was signed and no money moved.", []);
|
|
3783
|
+
}
|
|
3784
|
+
if (venue === "lighter") {
|
|
3785
|
+
return next("Funding Lighter from the MCP is not available in this release; use Wallet in the Felix app. Nothing "
|
|
3786
|
+
+ "was signed and no money moved.", []);
|
|
3787
|
+
}
|
|
3788
|
+
if (venue === "" || venue === "hyperliquid" || venue === "polymarket" || venue === "prediction_market") {
|
|
3789
|
+
return next(FUND_VENUE_FROM_ARC_HINT, ["fund_polymarket_from_arc", "fund_hypercore_from_arc"]);
|
|
3790
|
+
}
|
|
3791
|
+
}
|
|
3792
|
+
return out;
|
|
3793
|
+
}
|
|
3794
|
+
// VENUE_TRANSFERS_2026_11_18: venue-to-venue transfers (engine services/agent_capital/venue_transfers.py).
|
|
3795
|
+
const VENUE_TRANSFER_VENUE_INPUTS = ["hyperliquid", "polymarket", "lighter", "prediction_market"];
|
|
3796
|
+
// Opus QA r16 F7: no "crypto" alias; Lighter is a crypto venue too. prediction_market is the engine's own alias.
|
|
3797
|
+
const VENUE_TRANSFER_ALIASES = {
|
|
3798
|
+
hyperliquid: "hyperliquid", polymarket: "polymarket", prediction_market: "polymarket", lighter: "lighter",
|
|
3799
|
+
};
|
|
3800
|
+
const VENUE_TRANSFER_NAMES = { hyperliquid: "Hyperliquid", polymarket: "Polymarket", lighter: "Lighter" };
|
|
3801
|
+
const VENUE_TRANSFER_FINAL = new Set(["completed", "partial", "failed", "needs_review"]);
|
|
3802
|
+
const VENUE_TRANSFER_STATES = new Set(["sending", ...VENUE_TRANSFER_FINAL]);
|
|
3803
|
+
const VENUE_TRANSFER_POLL_MS = 2_000;
|
|
3804
|
+
export function venueTransferVenue(value) {
|
|
3805
|
+
const key = typeof value === "string" ? value.trim().toLowerCase() : "";
|
|
3806
|
+
return Object.hasOwn(VENUE_TRANSFER_ALIASES, key) ? VENUE_TRANSFER_ALIASES[key] : undefined;
|
|
3807
|
+
}
|
|
3808
|
+
/** money_moved for a transfer record, from the engine's own state machine (venue_transfers.advance). */
|
|
3809
|
+
export function venueTransferMoneyMoved(state) {
|
|
3810
|
+
if (state === "completed" || state === "partial")
|
|
3811
|
+
return true;
|
|
3812
|
+
if (state === "failed")
|
|
3813
|
+
return false;
|
|
3814
|
+
return "unknown";
|
|
3815
|
+
}
|
|
3816
|
+
/** Adds the outcome fields an agent needs to a parsed transfer; never invents engine state. */
|
|
3817
|
+
export function describeVenueTransfer(transfer) {
|
|
3818
|
+
const state = String(transfer.state);
|
|
3819
|
+
const from = VENUE_TRANSFER_NAMES[String(transfer.from_venue)] ?? String(transfer.from_venue);
|
|
3820
|
+
const to = VENUE_TRANSFER_NAMES[String(transfer.to_venue)] ?? String(transfer.to_venue);
|
|
3821
|
+
const next = state === "sending"
|
|
3822
|
+
? `Still moving. Poll get_venue_transfer with this transfer_id; do not start another transfer from ${from}.`
|
|
3823
|
+
: state === "completed"
|
|
3824
|
+
? `Done: the cash is on ${to}.`
|
|
3825
|
+
: state === "partial"
|
|
3826
|
+
? "Part of this transfer finished; message says where the cash is. It is safe in the owner's own accounts; "
|
|
3827
|
+
+ "see get_money_map before moving it again."
|
|
3828
|
+
: state === "needs_review"
|
|
3829
|
+
? "Felix is confirming a step. The money is safe and nothing will move twice. Do not retry; check "
|
|
3830
|
+
+ "get_venue_transfer later."
|
|
3831
|
+
: "Nothing moved. A new transfer needs a new idempotency_key.";
|
|
3832
|
+
return { transfer, state, final: VENUE_TRANSFER_FINAL.has(state), money_moved: venueTransferMoneyMoved(state),
|
|
3833
|
+
next_action: next };
|
|
3834
|
+
}
|
|
3835
|
+
/** Validated venue-transfer arguments and the engine body, or the local refusal (nothing sent). */
|
|
3836
|
+
function venueTransferArgs(a) {
|
|
3837
|
+
const from = venueTransferVenue(a.from_venue);
|
|
3838
|
+
const to = venueTransferVenue(a.to_venue);
|
|
3839
|
+
const hasAmount = a.amount_usd !== undefined && a.amount_usd !== null;
|
|
3840
|
+
const amount = hasAmount ? arcHomeUnits(a.amount_usd, "amount_usd") : undefined;
|
|
3841
|
+
const bad = validateOptionalAccountId(a)
|
|
3842
|
+
|| (!from ? clientError("invalid_argument", "from_venue must be hyperliquid, polymarket or lighter.") : undefined)
|
|
3843
|
+
|| (!to ? clientError("invalid_argument", "to_venue must be hyperliquid, polymarket or lighter.") : undefined)
|
|
3844
|
+
|| (from && from === to ? clientError("same_venue", "Pick two different venues.") : undefined)
|
|
3845
|
+
|| (amount !== undefined && typeof amount !== "bigint" ? amount : undefined)
|
|
3846
|
+
|| (typeof amount === "bigint" && amount <= 0n
|
|
3847
|
+
? clientError("invalid_argument", "amount_usd must be greater than 0.") : undefined)
|
|
3848
|
+
|| (a.all_free_cash !== undefined && typeof a.all_free_cash !== "boolean"
|
|
3849
|
+
? clientError("invalid_argument", "all_free_cash must be true or false.") : undefined)
|
|
3850
|
+
|| (hasAmount && a.all_free_cash === true
|
|
3851
|
+
? clientError("invalid_argument", "Give amount_usd or all_free_cash:true, not both.") : undefined);
|
|
3852
|
+
if (bad || !from || !to)
|
|
3853
|
+
return { bad: { ...(bad ?? {}), money_moved: false } };
|
|
3854
|
+
return { from, to, hasAmount, requestBody: {
|
|
3855
|
+
...(a.account_id ? { account_id: a.account_id } : {}),
|
|
3856
|
+
from_venue: from, to_venue: to,
|
|
3857
|
+
...(hasAmount ? { amount_usd: Number(a.amount_usd) } : {}),
|
|
3858
|
+
} };
|
|
3859
|
+
}
|
|
3860
|
+
/** A transfer record shaped like the engine's public_transfer, or undefined (app parseVenueTransfer). */
|
|
3861
|
+
export function parseVenueTransferRecord(value) {
|
|
3862
|
+
if (!isRecord(value))
|
|
3863
|
+
return undefined;
|
|
3864
|
+
if (typeof value.transfer_id !== "string" || !UUID_RE.test(value.transfer_id))
|
|
3865
|
+
return undefined;
|
|
3866
|
+
if (!venueTransferVenue(value.from_venue) || !venueTransferVenue(value.to_venue))
|
|
3867
|
+
return undefined;
|
|
3868
|
+
if (typeof value.state !== "string" || !VENUE_TRANSFER_STATES.has(value.state))
|
|
3869
|
+
return undefined;
|
|
3870
|
+
return value;
|
|
3871
|
+
}
|
|
3872
|
+
const VENUE_TRANSFER_REFUSAL_HINTS = {
|
|
3873
|
+
insufficient_free_cash: "Pass a smaller amount_usd, or all_free_cash:true to move what is free. Open orders, "
|
|
3874
|
+
+ "positions and running agents keep their cash.",
|
|
3875
|
+
below_transfer_minimum: "Transfers start at minimum_usd. Move at least that much, or add cash to the source venue first.",
|
|
3876
|
+
transfer_in_progress: "Another transfer from this venue is still moving. Wait for it: list_venue_transfers with open_only:true.",
|
|
3877
|
+
venue_cash_unreadable: "The venue balance is updating. Retry in a moment with the same idempotency_key.",
|
|
3878
|
+
polymarket_return_not_ready: "Polymarket cash cannot move out yet. Retry later with the same idempotency_key.",
|
|
3879
|
+
idempotency_conflict: "This idempotency_key already belongs to another transfer: read it first with "
|
|
3880
|
+
+ "get_venue_transfer(existing_transfer_id); it may still be moving. Use a new idempotency_key only for a "
|
|
3881
|
+
+ "genuinely different transfer.",
|
|
3882
|
+
agent_capital_not_enabled: "Transfers between venues are not available on this account yet. Fund a venue from the "
|
|
3883
|
+
+ "Arc home with fund_hypercore_from_arc or fund_polymarket_from_arc instead.",
|
|
3884
|
+
unsupported_venue: "Transfers move between hyperliquid, polymarket and lighter.",
|
|
3885
|
+
same_venue: "Pick two different venues.",
|
|
3886
|
+
invalid_amount: "amount_usd must be a positive USDC amount.",
|
|
3887
|
+
};
|
|
3888
|
+
/** A refused preview/start (engine 400/409 TransferRefused): keep the engine's words, add the next step. */
|
|
3889
|
+
export function withVenueTransferRefusalHint(out) {
|
|
3890
|
+
if (out.ok !== false || !isRecord(out.error))
|
|
3891
|
+
return out;
|
|
3892
|
+
const error = out.error;
|
|
3893
|
+
const code = String(error.reason ?? error.code ?? "");
|
|
3894
|
+
const message = String(error.message ?? "");
|
|
3895
|
+
if (/lacks the '(?:transfer|read)' scope/.test(message)) {
|
|
3896
|
+
return { ...out, error: { ...error, hint: "This key cannot move money between venues. Use the owner's local "
|
|
3897
|
+
+ "launcher session (use_child_account selects the account), or Transfer in the Felix app. This request moved no money." },
|
|
3898
|
+
money_moved: false };
|
|
3899
|
+
}
|
|
3900
|
+
const hint = VENUE_TRANSFER_REFUSAL_HINTS[code]
|
|
3901
|
+
?? (/_order_in_flight$/.test(code)
|
|
3902
|
+
? "An order on the source venue is still settling. Retry in a moment with the same idempotency_key." : undefined);
|
|
3903
|
+
if (!hint)
|
|
3904
|
+
return out;
|
|
3905
|
+
return { ...out, error: { ...error, hint: `${hint} This request moved no money.` }, money_moved: false };
|
|
3906
|
+
}
|
|
3907
|
+
/** Opus QA r16 F1/F3: a failed start that is not a definite engine refusal never claims nothing moved. */
|
|
3908
|
+
export function withVenueTransferFailureOutcome(out) {
|
|
3909
|
+
if (out.ok !== false || !isRecord(out.error))
|
|
3910
|
+
return out;
|
|
3911
|
+
const error = out.error;
|
|
3912
|
+
const code = String(error.reason ?? error.code ?? "");
|
|
3913
|
+
// Arc admission paused for a release: the engine refused before admission. Keep its own words and retry advice.
|
|
3914
|
+
if (code === "arc_admission_frozen")
|
|
3915
|
+
return { ...out, money_moved: false };
|
|
3916
|
+
const meta = isRecord(out._meta) ? out._meta : {};
|
|
3917
|
+
const status = finiteNumber(meta.http_status);
|
|
3918
|
+
const definite = status !== undefined && status >= 400 && status < 500 && status !== 408 && status !== 429
|
|
3919
|
+
&& code !== "idempotency_in_progress";
|
|
3920
|
+
return {
|
|
3921
|
+
...out,
|
|
3922
|
+
error: { ...error, hint: "Retry with the same idempotency_key: it never starts a second transfer. Check "
|
|
3923
|
+
+ "list_venue_transfers before using a new key." },
|
|
3924
|
+
...(definite ? {} : { money_moved: "unknown", outcome_unknown: true }),
|
|
3925
|
+
};
|
|
3926
|
+
}
|
|
3711
3927
|
function isChildManagementRequest(method, path) {
|
|
3712
3928
|
const pathname = path.split("?", 1)[0];
|
|
3713
3929
|
if (method === "GET" || method === "DELETE") {
|
|
@@ -3719,9 +3935,18 @@ function isChildManagementRequest(method, path) {
|
|
|
3719
3935
|
// key); the child is named by account_id (engine _target_context).
|
|
3720
3936
|
|| (method === "GET" && isArcHomeManageRoute(pathname));
|
|
3721
3937
|
}
|
|
3938
|
+
// Opus QA r12 F3: the portfolio mandate needs "manage" (routes_quant_desk.py update_mandate), which the account's
|
|
3939
|
+
// read/trade key lacks; the engine targets the account via body.account_id (_target_context).
|
|
3940
|
+
if (method === "PUT")
|
|
3941
|
+
return pathname === "/v1/portfolio/mandate";
|
|
3722
3942
|
if (method !== "POST")
|
|
3723
3943
|
return false;
|
|
3724
3944
|
return pathname === "/v1/referrals"
|
|
3945
|
+
// Owner-signed venue bootstrap (routes_agent_capital.py: require("manage"), money_context(account_id)).
|
|
3946
|
+
|| pathname.startsWith("/v1/agent-capital/venue-bootstrap/")
|
|
3947
|
+
// Venue-to-venue transfer start needs "transfer" (routes_agent_capital.py create_transfer, money_context), which
|
|
3948
|
+
// the account's read/trade key lacks. Preview and reads need only "read" and stay on the account's key.
|
|
3949
|
+
|| pathname === "/v1/agent-capital/transfers"
|
|
3725
3950
|
|| pathname === "/v1/fund"
|
|
3726
3951
|
|| pathname === "/v1/bring-home"
|
|
3727
3952
|
|| pathname === "/v1/withdraw"
|
|
@@ -7261,6 +7486,12 @@ async function call(method, path, body, opts = {}) {
|
|
|
7261
7486
|
&& runtimeManagedAccountId
|
|
7262
7487
|
&& UUID_RE.test(runtimeManagedAccountId)
|
|
7263
7488
|
&& isChildManagementRequest(method, path)) {
|
|
7489
|
+
const explicitAccount = isRecord(requestBody) ? requestBody.account_id
|
|
7490
|
+
: new URLSearchParams(path.split("?", 2)[1] ?? "").get("account_id") ?? undefined;
|
|
7491
|
+
if (explicitAccount !== undefined && explicitAccount !== null
|
|
7492
|
+
&& String(explicitAccount).toLowerCase() !== runtimeManagedAccountId.toLowerCase()) {
|
|
7493
|
+
return clientError("account_mismatch", "This session is working on a different account than the account_id you passed. Nothing was sent.", "Omit account_id to act on the selected account, or call use_child_account with the other account first.", { selected_account_id: runtimeManagedAccountId, money_moved: false });
|
|
7494
|
+
}
|
|
7264
7495
|
key = START_KEY;
|
|
7265
7496
|
const pathname = path.split("?", 1)[0];
|
|
7266
7497
|
const targetInQuery = method === "GET"
|
|
@@ -7277,7 +7508,7 @@ async function call(method, path, body, opts = {}) {
|
|
|
7277
7508
|
}
|
|
7278
7509
|
}
|
|
7279
7510
|
if (!key && !opts.public) {
|
|
7280
|
-
return clientError("missing_api_key", "Set FELIX_API_KEY to a Felix fk_ key.", "
|
|
7511
|
+
return clientError("missing_api_key", "Set FELIX_API_KEY to a Felix fk_ key.", "Call the onboard tool (no restart needed). It creates the local identity and encrypted recovery file automatically.");
|
|
7281
7512
|
}
|
|
7282
7513
|
const idempotencyKey = opts.idempotencyKey || (opts.idempotent ? randomUUID() : undefined);
|
|
7283
7514
|
const transportAttempts = opts.retryOnError === false ? 1 : (method === "GET" || idempotencyKey ? 2 : 1);
|
|
@@ -11661,6 +11892,7 @@ const TOOL_RISK_GROUPS = {
|
|
|
11661
11892
|
read: [
|
|
11662
11893
|
"get_capital_move_recovery", "preview_home_funding", "get_home_funding", "get_withdrawal_confirmation",
|
|
11663
11894
|
"get_arc_home_operation", "get_agent_capital", "preview_capital_move", "get_capital_move",
|
|
11895
|
+
"preview_venue_transfer", "get_venue_transfer", "list_venue_transfers",
|
|
11664
11896
|
"get_status", "get_health", "get_metrics", "get_custody_recovery_status", "get_strategy_guide",
|
|
11665
11897
|
"get_market_streaming_guide",
|
|
11666
11898
|
"search_markets", "list_markets", "search_tokens", "inspect_token_risk",
|
|
@@ -11704,7 +11936,7 @@ const TOOL_RISK_GROUPS = {
|
|
|
11704
11936
|
],
|
|
11705
11937
|
money: [
|
|
11706
11938
|
"start_home_funding", "prepare_capital_allocation", "submit_capital_allocation", "submit_venue_bootstrap",
|
|
11707
|
-
"start_capital_move",
|
|
11939
|
+
"start_capital_move", "transfer_between_venues",
|
|
11708
11940
|
"resolve_network_fee", "swap_native_usdc", "fund_market",
|
|
11709
11941
|
"start_fund_market", "bring_home", "start_bring_home", "resume_money_operation",
|
|
11710
11942
|
"start_arc_home_hl_return", "fund_hypercore_from_arc", "arc_home_hypercore_return", "invalidate_safe_nonce",
|
|
@@ -11977,7 +12209,7 @@ export async function executeSafeInvalidation(writer, operationId, expectedNonce
|
|
|
11977
12209
|
}
|
|
11978
12210
|
const LIVE_MONEY_TOOLS = new Set([
|
|
11979
12211
|
"submit_capital_allocation", "submit_venue_bootstrap",
|
|
11980
|
-
"start_capital_move",
|
|
12212
|
+
"start_capital_move", "transfer_between_venues",
|
|
11981
12213
|
"place_order", "place_batch_orders", "close_position", "make_market",
|
|
11982
12214
|
"place_manual_order", "close_manual_position", "modify_order_price",
|
|
11983
12215
|
"swap_native_usdc", "fund_market", "start_fund_market",
|
|
@@ -12412,7 +12644,7 @@ const TOOLS = [
|
|
|
12412
12644
|
},
|
|
12413
12645
|
{
|
|
12414
12646
|
name: "preview_order",
|
|
12415
|
-
description: "Preview an order before placing it. No money moves; returns estimated fill, fees, live minimum, collateral, selected venue, and projected Hyperliquid leverage. fee_credit_check reports the
|
|
12647
|
+
description: "Preview an order before placing it. No money moves; returns estimated fill, fees, live minimum, collateral, selected venue, and projected Hyperliquid leverage. fee_credit_check reports how the Felix fee is collected: it is charged from the trading account after each fill and never blocks an order, so no prepaid fee credit or top-up is needed. Derive options also return exact quote-sized signed delta plus venue-native gamma, theta, and vega impact; missing Greeks remain unavailable, never zero. Set auto_fund:true to include the exact owner-to-venue funding plan without executing it.",
|
|
12416
12648
|
inputSchema: schema({
|
|
12417
12649
|
...orderFields,
|
|
12418
12650
|
auto_fund: booleanProp("Include a read-only funding plan when venue collateral is short. This preview never moves money."),
|
|
@@ -12635,7 +12867,7 @@ const TOOLS = [
|
|
|
12635
12867
|
},
|
|
12636
12868
|
{
|
|
12637
12869
|
name: "place_manual_order",
|
|
12638
|
-
description: "Place a LIVE manual order exactly like the app's ticket: market or limit, post-only, resting (Polymarket time_in_force GTC), reduce-only, leverage up to the venue maximum. This moves real money. Opening orders stay within this key's max_order_usd and max_daily_usd and the account's portfolio mandate.
|
|
12870
|
+
description: "Place a LIVE manual order exactly like the app's ticket: market or limit, post-only, resting (Polymarket time_in_force GTC), reduce-only, leverage up to the venue maximum. This moves real money. Opening orders stay within this key's max_order_usd and max_daily_usd and the account's portfolio mandate. An account's own key does not fund from Home: fund the venue first with fund_hypercore_from_arc or fund_polymarket_from_arc. If the account owner's trading policy (the app's device trading policy) is missing or within 3 days of expiry, it is signed locally first and returned in trading_policy (it includes Lighter Premium and Felix partner-fee consent). Reuse the same idempotency_key to retry safely; read the outcome with get_manual_order_receipt.",
|
|
12639
12871
|
inputSchema: schema({ ...manualOrderFields, idempotency_key: stringProp("Retry-safety key; reuse it for retries of the same order. Auto-generated when omitted."),
|
|
12640
12872
|
accept_trading_policy: booleanProp("Only after the owner answered yes to the trading_policy question this tool returned."),
|
|
12641
12873
|
trading_policy_terms_id: stringProp("The trading_policy_terms_id from that question.") }, ["instrument", "side", "size_usd"]),
|
|
@@ -12906,6 +13138,47 @@ const TOOLS = [
|
|
|
12906
13138
|
account_id: stringProp("Optional owned child account UUID.", undefined, { pattern: UUID_RE.source }),
|
|
12907
13139
|
}, ["move_id"]),
|
|
12908
13140
|
},
|
|
13141
|
+
// VENUE_TRANSFERS_2026_11_18 (engine routes_agent_capital.py /v1/agent-capital/transfers, app lib/venueTransfers.ts).
|
|
13142
|
+
{
|
|
13143
|
+
name: "preview_venue_transfer",
|
|
13144
|
+
description: "Read-only preview of moving free cash straight from one venue to another (Hyperliquid, Polymarket, Lighter), like Transfer in the Felix app: free cash on the source, the minimum, the route (front: the destination is funded at once from the Trading wallet; chain: through the Trading wallet) and an ETA in seconds. Omit amount_usd to preview all free cash. Open orders, positions and running agents keep their cash. Creates, reserves and signs nothing.",
|
|
13145
|
+
inputSchema: schema({
|
|
13146
|
+
from_venue: stringProp("Venue the money leaves.", [...VENUE_TRANSFER_VENUE_INPUTS]),
|
|
13147
|
+
to_venue: stringProp("Venue the money arrives on.", [...VENUE_TRANSFER_VENUE_INPUTS]),
|
|
13148
|
+
amount_usd: numberProp("USDC amount, at most six decimal places. Omit to preview all free cash.", 0.000001),
|
|
13149
|
+
account_id: stringProp("Optional owned child account UUID. Omit for the active account.", undefined, { pattern: UUID_RE.source }),
|
|
13150
|
+
}, ["from_venue", "to_venue"]),
|
|
13151
|
+
},
|
|
13152
|
+
{
|
|
13153
|
+
name: "transfer_between_venues",
|
|
13154
|
+
description: "LIVE: move the account's free cash from one venue to another (Hyperliquid, Polymarket, Lighter), exactly like Transfer in the Felix app. Felix signs it; no owner signature. Only the owner's own venue accounts and Trading wallet are paid, and open orders, positions and running agents keep their cash. Give exactly one of amount_usd or all_free_cash:true. Reuse the same idempotency_key to retry: it always returns the same transfer, never a second one. Most transfers finish in seconds to a few minutes (Lighter withdrawals can take longer). Set wait_seconds to wait for the result, or poll get_venue_transfer. Never start another transfer while one is sending or needs review.",
|
|
13155
|
+
inputSchema: schema({
|
|
13156
|
+
from_venue: stringProp("Venue the money leaves.", [...VENUE_TRANSFER_VENUE_INPUTS]),
|
|
13157
|
+
to_venue: stringProp("Venue the money arrives on.", [...VENUE_TRANSFER_VENUE_INPUTS]),
|
|
13158
|
+
amount_usd: numberProp("USDC amount, at most six decimal places. Omit only with all_free_cash:true.", 0.000001),
|
|
13159
|
+
all_free_cash: booleanProp("true moves all free cash on from_venue. Use instead of amount_usd."),
|
|
13160
|
+
idempotency_key: stringProp("Required, 8 to 128 printable characters. One key per transfer; reuse it after any timeout."),
|
|
13161
|
+
wait_seconds: integerProp("Optional: wait up to this many seconds (0 to 120) for a final state. Default 0.", 0, 120),
|
|
13162
|
+
account_id: stringProp("Optional owned child account UUID. Omit for the active account.", undefined, { pattern: UUID_RE.source }),
|
|
13163
|
+
}, ["from_venue", "to_venue", "idempotency_key"]),
|
|
13164
|
+
},
|
|
13165
|
+
{
|
|
13166
|
+
name: "get_venue_transfer",
|
|
13167
|
+
description: "Read one venue-to-venue transfer: state (sending, completed, partial, failed, needs_review), phase, the plain-language message, amounts credited and received. Read-only; never starts or retries a transfer.",
|
|
13168
|
+
inputSchema: schema({
|
|
13169
|
+
transfer_id: stringProp("transfer_id from transfer_between_venues.", undefined, { pattern: UUID_RE.source }),
|
|
13170
|
+
account_id: stringProp("Optional owned child account UUID. Omit for the active account.", undefined, { pattern: UUID_RE.source }),
|
|
13171
|
+
}, ["transfer_id"]),
|
|
13172
|
+
},
|
|
13173
|
+
{
|
|
13174
|
+
name: "list_venue_transfers",
|
|
13175
|
+
description: "The account's latest venue-to-venue transfers, newest first (for example one still sending after a restart). Read-only.",
|
|
13176
|
+
inputSchema: schema({
|
|
13177
|
+
open_only: booleanProp("true lists only transfers still sending."),
|
|
13178
|
+
limit: integerProp("How many to return, 1 to 20. Default 10.", 1, 20),
|
|
13179
|
+
account_id: stringProp("Optional owned child account UUID. Omit for the active account.", undefined, { pattern: UUID_RE.source }),
|
|
13180
|
+
}),
|
|
13181
|
+
},
|
|
12909
13182
|
{
|
|
12910
13183
|
name: "get_network_fee_status",
|
|
12911
13184
|
description: "Inspect an interrupted funding network-fee workflow. New funding pays and confirms the fee before any venue transfer; this tool exists only to reconcile a legacy or interrupted obligation without paying twice.",
|
|
@@ -13187,9 +13460,9 @@ const TOOLS = [
|
|
|
13187
13460
|
},
|
|
13188
13461
|
{
|
|
13189
13462
|
name: "arc_home_fund_venue",
|
|
13190
|
-
description: "
|
|
13463
|
+
description: "LEGACY: for accounts that still have a Polygon owner wallet record. A new account funds Polymarket with fund_polymarket_from_arc and Hyperliquid with fund_hypercore_from_arc instead (this tool answers arc_home_venue_wallet_unavailable for them). Stages Polymarket funding from the Arc home Safe: an owner-signed Circle Gateway withdrawal whose destination Felix resolves to this account's own Polygon owner wallet (the client refuses any other destination before signing). Completion is native USDC in the Polygon owner wallet, NOT Polymarket collateral: the result sets venue_funded=false and returns next_action fund_market(venue=prediction_market), a separate owner-signed call. Hyperliquid and Derive are refused before anything is prepared. Not live-certified on this release.",
|
|
13191
13464
|
inputSchema: schema({
|
|
13192
|
-
venue: stringProp("Destination venue. Only polymarket is supported by this
|
|
13465
|
+
venue: stringProp("Destination venue. Only polymarket is supported by this tool; for Hyperliquid use fund_hypercore_from_arc."),
|
|
13193
13466
|
amount_usd: numberProp("USDC to deliver to the Polygon owner wallet, at most six decimals.", 0.000001, ARC_HOME_MAX_AMOUNT_USD),
|
|
13194
13467
|
max_fee_usd: numberProp("Owner-paid Circle Gateway fee ceiling. Defaults to 0.05.", 0.000001, ARC_HOME_MAX_FEE_USD),
|
|
13195
13468
|
submit_destination_mint: booleanProp("Also broadcast the final Polygon mint into the owner wallet with the owner key through your own FELIX_POLYGON_RPC_URL. Defaults to true; that gas is owner paid."),
|
|
@@ -13258,12 +13531,12 @@ const TOOLS = [
|
|
|
13258
13531
|
},
|
|
13259
13532
|
{
|
|
13260
13533
|
name: "get_fee_balance",
|
|
13261
|
-
description: "Read prepaid execution-fee credit.
|
|
13534
|
+
description: "Read any prepaid execution-fee credit left from earlier releases. New orders do not need it: Felix's fee is charged from the trading account after each fill and never blocks an order. Withdrawals never collect trading fees.",
|
|
13262
13535
|
inputSchema: schema({}),
|
|
13263
13536
|
},
|
|
13264
13537
|
{
|
|
13265
13538
|
name: "preview_fee_top_up",
|
|
13266
|
-
description: "Preview an owner-signed execution-fee credit top-up without signing or exposing Felix's collection address. Nothing moves until top_up_fee_balance is called.",
|
|
13539
|
+
description: "Legacy, not needed to trade (Felix's fee is charged after each fill). Preview an owner-signed execution-fee credit top-up without signing or exposing Felix's collection address. Nothing moves until top_up_fee_balance is called.",
|
|
13267
13540
|
inputSchema: schema({
|
|
13268
13541
|
amount_usd: numberProp("USDC.e amount to prepay for future live execution fees.", 0.1, 10_000),
|
|
13269
13542
|
idempotency_key: stringProp("Required workflow replay key. Reuse this exact key for top_up_fee_balance."),
|
|
@@ -13271,7 +13544,7 @@ const TOOLS = [
|
|
|
13271
13544
|
},
|
|
13272
13545
|
{
|
|
13273
13546
|
name: "top_up_fee_balance",
|
|
13274
|
-
description: "
|
|
13547
|
+
description: "Legacy: sign one bounded USDC.e transfer locally and credit it as prepaid execution-fee credit (accounts with a Polygon owner wallet only). Not needed to trade: Felix's fee is charged from the trading account after each fill and never blocks an order.",
|
|
13275
13548
|
inputSchema: schema({
|
|
13276
13549
|
amount_usd: numberProp("USDC.e amount to prepay for future live execution fees.", 0.1, 10_000),
|
|
13277
13550
|
idempotency_key: stringProp("Required workflow replay key. Reuse it after any timeout or restart."),
|
|
@@ -13280,7 +13553,7 @@ const TOOLS = [
|
|
|
13280
13553
|
},
|
|
13281
13554
|
{
|
|
13282
13555
|
name: "preview_fee_settlement",
|
|
13283
|
-
description: "Deprecated compatibility alias for preview_fee_top_up. It previews prepaid execution-fee credit and never exposes the collection address.",
|
|
13556
|
+
description: "Legacy, not needed to trade. Deprecated compatibility alias for preview_fee_top_up. It previews prepaid execution-fee credit and never exposes the collection address.",
|
|
13284
13557
|
inputSchema: schema({
|
|
13285
13558
|
amount_usd: numberProp("USDC.e amount to prepay for future live execution fees.", 0.1, 10_000),
|
|
13286
13559
|
idempotency_key: stringProp("Required workflow replay key. Reuse this exact key for settle_fees."),
|
|
@@ -13288,7 +13561,7 @@ const TOOLS = [
|
|
|
13288
13561
|
},
|
|
13289
13562
|
{
|
|
13290
13563
|
name: "settle_fees",
|
|
13291
|
-
description: "Deprecated compatibility alias for top_up_fee_balance. It adds prepaid credit; it does not settle debt and is never called by withdrawals.",
|
|
13564
|
+
description: "Legacy, not needed to trade. Deprecated compatibility alias for top_up_fee_balance. It adds prepaid credit; it does not settle debt and is never called by withdrawals.",
|
|
13292
13565
|
inputSchema: schema({
|
|
13293
13566
|
amount_usd: numberProp("USDC.e amount to prepay for future live execution fees.", 0.1, 10_000),
|
|
13294
13567
|
idempotency_key: stringProp("Required workflow replay key. Reuse it after any timeout or restart."),
|
|
@@ -13376,7 +13649,7 @@ const TOOLS = [
|
|
|
13376
13649
|
},
|
|
13377
13650
|
{
|
|
13378
13651
|
name: "init_wallet_onboarding",
|
|
13379
|
-
description: `Start advanced client-owned Safe onboarding. The owner key must be generated and retained outside Felix; only public addresses are sent. Read ${GETTING_STARTED_GUIDE_URI} before implementing the signing flow.`,
|
|
13652
|
+
description: `RETIRED: Polygon Safe wallets are retired and Felix answers 410 polygon_safe_hub_retired; every account's wallet is its Arc home Safe (fund it with create_deposit; stop all trading with panic). Start advanced client-owned Safe onboarding. The owner key must be generated and retained outside Felix; only public addresses are sent. Read ${GETTING_STARTED_GUIDE_URI} before implementing the signing flow.`,
|
|
13380
13653
|
inputSchema: schema({
|
|
13381
13654
|
owner_address: stringProp("Client-owned EVM address.", undefined, { pattern: EVM_ADDRESS_RE.source }),
|
|
13382
13655
|
home_address: stringProp("Optional fixed sweep-home address. Defaults to owner.", undefined, { pattern: EVM_ADDRESS_RE.source }),
|
|
@@ -13390,7 +13663,7 @@ const TOOLS = [
|
|
|
13390
13663
|
},
|
|
13391
13664
|
{
|
|
13392
13665
|
name: "deploy_wallet_onboarding",
|
|
13393
|
-
description: `Verify the owner's locally validated personal-sign challenge and activate the Safe policy wallet. Accepts a signature, never the owner key. Follow ${GETTING_STARTED_GUIDE_URI}.`,
|
|
13666
|
+
description: `RETIRED: Polygon Safe wallets are retired and Felix answers 410 polygon_safe_hub_retired; every account's wallet is its Arc home Safe (fund it with create_deposit; stop all trading with panic). Verify the owner's locally validated personal-sign challenge and activate the Safe policy wallet. Accepts a signature, never the owner key. Follow ${GETTING_STARTED_GUIDE_URI}.`,
|
|
13394
13667
|
inputSchema: schema({
|
|
13395
13668
|
onboarding_id: stringProp("Onboarding UUID.", undefined, { pattern: UUID_RE.source }),
|
|
13396
13669
|
proof_signature: stringProp("0x-prefixed 65-byte owner proof signature.", undefined, { pattern: EVM_SIGNATURE_RE.source }),
|
|
@@ -13400,7 +13673,7 @@ const TOOLS = [
|
|
|
13400
13673
|
},
|
|
13401
13674
|
{
|
|
13402
13675
|
name: "complete_wallet_onboarding",
|
|
13403
|
-
description: `Verify and relay the owner's locally validated exact Safe module-enable and fallback-handler signatures, then link the client-owned wallet. Follow ${GETTING_STARTED_GUIDE_URI}.`,
|
|
13676
|
+
description: `RETIRED: Polygon Safe wallets are retired and Felix answers 410 polygon_safe_hub_retired; every account's wallet is its Arc home Safe (fund it with create_deposit; stop all trading with panic). Verify and relay the owner's locally validated exact Safe module-enable and fallback-handler signatures, then link the client-owned wallet. Follow ${GETTING_STARTED_GUIDE_URI}.`,
|
|
13404
13677
|
inputSchema: schema({
|
|
13405
13678
|
onboarding_id: stringProp("Onboarding UUID.", undefined, { pattern: UUID_RE.source }),
|
|
13406
13679
|
enable_signature: stringProp("0x-prefixed 65-byte canonical Safe signature.", undefined, { pattern: EVM_SIGNATURE_RE.source }),
|
|
@@ -13419,7 +13692,7 @@ const TOOLS = [
|
|
|
13419
13692
|
},
|
|
13420
13693
|
{
|
|
13421
13694
|
name: "migrate_wallet_to_v3",
|
|
13422
|
-
description: "Migrate a caller-owned legacy Safe to Felix V3 in one resumable local workflow: prove ownership, deploy only the V3 policy, locally execute enable/fallback/disable-V2, and confirm atomic account promotion.",
|
|
13695
|
+
description: "RETIRED: Polygon Safe wallets are retired and Felix answers 410 polygon_safe_hub_retired; every account's wallet is its Arc home Safe (fund it with create_deposit; stop all trading with panic). Migrate a caller-owned legacy Safe to Felix V3 in one resumable local workflow: prove ownership, deploy only the V3 policy, locally execute enable/fallback/disable-V2, and confirm atomic account promotion.",
|
|
13423
13696
|
inputSchema: schema({
|
|
13424
13697
|
max_operation_usd: numberProp("Maximum autonomous operation size. Defaults to the legacy wallet limit.", 0),
|
|
13425
13698
|
daily_limit_usd: numberProp("Maximum autonomous daily total. Defaults to the legacy wallet limit.", 0),
|
|
@@ -13432,7 +13705,7 @@ const TOOLS = [
|
|
|
13432
13705
|
},
|
|
13433
13706
|
{
|
|
13434
13707
|
name: "prepare_wallet_policy",
|
|
13435
|
-
description: "Prepare an owner-signed Safe V3 pause, resume, renewal, or emergency lockdown. Lockdown atomically pauses the agent and revokes fixed Polymarket approvals.",
|
|
13708
|
+
description: "RETIRED: Polygon Safe wallets are retired and Felix answers 410 polygon_safe_hub_retired; every account's wallet is its Arc home Safe (fund it with create_deposit; stop all trading with panic). Prepare an owner-signed Safe V3 pause, resume, renewal, or emergency lockdown. Lockdown atomically pauses the agent and revokes fixed Polymarket approvals.",
|
|
13436
13709
|
inputSchema: schema({
|
|
13437
13710
|
action: stringProp("pause|resume|renew|lockdown.", ["pause", "resume", "renew", "lockdown"]),
|
|
13438
13711
|
delegation_days: integerProp("Renewal lifetime in days. Valid only for renew; maximum 90.", 1, 90),
|
|
@@ -13442,7 +13715,7 @@ const TOOLS = [
|
|
|
13442
13715
|
},
|
|
13443
13716
|
{
|
|
13444
13717
|
name: "submit_wallet_policy",
|
|
13445
|
-
description: "Relay an exact owner-signed Safe V3 policy transaction. Accepts only the sealed policy token and canonical Safe signature.",
|
|
13718
|
+
description: "RETIRED: Polygon Safe wallets are retired and Felix answers 410 polygon_safe_hub_retired; every account's wallet is its Arc home Safe (fund it with create_deposit; stop all trading with panic). Relay an exact owner-signed Safe V3 policy transaction. Accepts only the sealed policy token and canonical Safe signature.",
|
|
13446
13719
|
inputSchema: schema({
|
|
13447
13720
|
policy_token: stringProp("Opaque sealed policy intent returned by prepare_wallet_policy.", undefined, { minLength: 1, maxLength: 16000 }),
|
|
13448
13721
|
owner_signature: stringProp("0x-prefixed 65-byte canonical EIP-712 signature.", undefined, { pattern: EVM_SIGNATURE_RE.source }),
|
|
@@ -13452,7 +13725,7 @@ const TOOLS = [
|
|
|
13452
13725
|
},
|
|
13453
13726
|
{
|
|
13454
13727
|
name: "update_wallet_policy",
|
|
13455
|
-
description: "Locally verify, sign, and relay a Safe V3 pause, resume, renewal, or emergency lockdown in one replay-safe workflow. Lockdown also revokes fixed Polymarket approvals.",
|
|
13728
|
+
description: "RETIRED: Polygon Safe wallets are retired and Felix answers 410 polygon_safe_hub_retired; every account's wallet is its Arc home Safe (fund it with create_deposit; stop all trading with panic). Locally verify, sign, and relay a Safe V3 pause, resume, renewal, or emergency lockdown in one replay-safe workflow. Lockdown also revokes fixed Polymarket approvals.",
|
|
13456
13729
|
inputSchema: schema({
|
|
13457
13730
|
action: stringProp("pause|resume|renew|lockdown.", ["pause", "resume", "renew", "lockdown"]),
|
|
13458
13731
|
delegation_days: integerProp("Renewal lifetime in days. Valid only for renew; maximum 90.", 1, 90),
|
|
@@ -13897,7 +14170,7 @@ const TOOLS = [
|
|
|
13897
14170
|
},
|
|
13898
14171
|
{
|
|
13899
14172
|
name: "create_account",
|
|
13900
|
-
description: `Create a real-money Felix account, like app.felix.trade. The first call reserves one isolated identity, binds its owner, and (until the account's Arc home holds the $5 minimum) returns account_funding_required with deposit_flow: pay with create_deposit, then retry the exact same idempotency_key; it never hands out a Polygon address. Felix then sets up and verifies the Arc home Safe/module, signs the account owner's trading policy locally (the app's device trading policy: no risk limits, Hyperliquid fast-custody trade keys, and Lighter Premium with Felix partner fees, returned in trading_policy), and mints a live key. The $5 deposit does not fund a first live trade
|
|
14173
|
+
description: `Create a real-money Felix account, like app.felix.trade. The first call reserves one isolated identity, binds its owner, and (until the account's Arc home holds the $5 minimum) returns account_funding_required with deposit_flow: pay with create_deposit, then retry the exact same idempotency_key; it never hands out a Polygon address. Felix then sets up and verifies the Arc home Safe/module, signs the account owner's trading policy locally (the app's device trading policy: no risk limits, Hyperliquid fast-custody trade keys, and Lighter Premium with Felix partner fees, returned in trading_policy), and mints a live key. The $5 deposit does not fund a first live trade: fund the venue with fund_hypercore_from_arc or fund_polymarket_from_arc. No prepaid fee credit is needed; Felix's fee is charged after each fill. Emits progress every 15 seconds. Requires the registered local owner signer and launcher manage key. Cold start: ${GETTING_STARTED_GUIDE_URI}.`,
|
|
13901
14174
|
inputSchema: schema({
|
|
13902
14175
|
email: stringProp("Optional new email for the isolated child. Omit to generate an internal identity."),
|
|
13903
14176
|
label: stringProp("Optional account/live-key label."),
|
|
@@ -16411,6 +16684,126 @@ export function makeServer() {
|
|
|
16411
16684
|
|| await call("GET", `/v1/agent-capital/moves/${encodeURIComponent(String(a.move_id))}${qs({ account_id: a.account_id })}`);
|
|
16412
16685
|
break;
|
|
16413
16686
|
}
|
|
16687
|
+
case "preview_venue_transfer": {
|
|
16688
|
+
const parsed = venueTransferArgs(a);
|
|
16689
|
+
if (!("requestBody" in parsed)) {
|
|
16690
|
+
out = parsed.bad;
|
|
16691
|
+
break;
|
|
16692
|
+
}
|
|
16693
|
+
const { from, to, hasAmount, requestBody } = parsed;
|
|
16694
|
+
const preview = await call("POST", "/v1/agent-capital/transfers/preview", requestBody, { retryOnError: false });
|
|
16695
|
+
if (preview.ok === false) {
|
|
16696
|
+
out = withVenueTransferRefusalHint(preview);
|
|
16697
|
+
break;
|
|
16698
|
+
}
|
|
16699
|
+
if (preview.from_venue !== from || preview.to_venue !== to) {
|
|
16700
|
+
out = clientError("transfer_preview_unreadable", "Felix returned a preview for different venues. Nothing moved.", "Retry preview_venue_transfer.", { money_moved: false });
|
|
16701
|
+
break;
|
|
16702
|
+
}
|
|
16703
|
+
out = { ...preview, money_moved: false, signed: false, operation_created: false,
|
|
16704
|
+
next_action: "To move it, call transfer_between_venues with the same venues and "
|
|
16705
|
+
+ (hasAmount ? "amount_usd" : "all_free_cash:true") + " and a new idempotency_key." };
|
|
16706
|
+
break;
|
|
16707
|
+
}
|
|
16708
|
+
case "transfer_between_venues": {
|
|
16709
|
+
const parsed = venueTransferArgs(a);
|
|
16710
|
+
if (!("requestBody" in parsed)) {
|
|
16711
|
+
out = parsed.bad;
|
|
16712
|
+
break;
|
|
16713
|
+
}
|
|
16714
|
+
const { from, to, hasAmount, requestBody } = parsed;
|
|
16715
|
+
// An omitted amount moves ALL free cash on the engine; that must be an explicit choice here.
|
|
16716
|
+
if (!hasAmount && a.all_free_cash !== true) {
|
|
16717
|
+
out = clientError("missing_argument", "Give amount_usd, or all_free_cash:true to move all free cash.", "preview_venue_transfer shows how much is free. Nothing moved.", { money_moved: false });
|
|
16718
|
+
break;
|
|
16719
|
+
}
|
|
16720
|
+
const key = requiredWorkflowKey(a);
|
|
16721
|
+
if (!key || key.length < 8) {
|
|
16722
|
+
out = clientError("missing_argument", "idempotency_key is required (8 to 128 printable characters).", "Use one new key per transfer and reuse it after any timeout. Nothing moved.", { money_moved: false });
|
|
16723
|
+
break;
|
|
16724
|
+
}
|
|
16725
|
+
const waitMs = Math.min(120, Math.max(0, Math.floor(Number(a.wait_seconds) || 0))) * 1_000;
|
|
16726
|
+
const deadline = Date.now() + waitMs;
|
|
16727
|
+
const start = () => call("POST", "/v1/agent-capital/transfers", requestBody, { idempotent: true, idempotencyKey: key, timeoutMs: 60_000 });
|
|
16728
|
+
let started = await start();
|
|
16729
|
+
// Arc admission frozen (engine release): the request is queued with nothing moved; the same key replays it.
|
|
16730
|
+
while (started.ok !== false && started.queued === true && Date.now() + VENUE_TRANSFER_POLL_MS < deadline) {
|
|
16731
|
+
await sleep(VENUE_TRANSFER_POLL_MS);
|
|
16732
|
+
started = await start();
|
|
16733
|
+
}
|
|
16734
|
+
if (started.ok === false) {
|
|
16735
|
+
const refused = withVenueTransferRefusalHint(started);
|
|
16736
|
+
out = refused !== started ? refused : withVenueTransferFailureOutcome(started);
|
|
16737
|
+
break;
|
|
16738
|
+
}
|
|
16739
|
+
if (started.queued === true) {
|
|
16740
|
+
const executing = started.status === "executing";
|
|
16741
|
+
out = { ...started, money_moved: executing ? "unknown" : false, state: executing ? "executing" : "queued",
|
|
16742
|
+
next_action: "Felix accepted the transfer and starts it in a moment. Call transfer_between_venues again "
|
|
16743
|
+
+ "with the same arguments and idempotency_key to get the transfer." };
|
|
16744
|
+
break;
|
|
16745
|
+
}
|
|
16746
|
+
let transfer = parseVenueTransferRecord(started.transfer);
|
|
16747
|
+
const receiptAmount = transfer ? finiteNumber(transfer.amount_usd) : undefined;
|
|
16748
|
+
const amountMismatch = hasAmount && receiptAmount !== undefined
|
|
16749
|
+
&& Math.abs(receiptAmount - Number(a.amount_usd)) > 0.0000005;
|
|
16750
|
+
if (!transfer || transfer.from_venue !== from || transfer.to_venue !== to || amountMismatch) {
|
|
16751
|
+
out = clientError("transfer_receipt_mismatch", "The transfer receipt did not match this request, so its outcome is not confirmed.", "Do not use a new idempotency_key. Check list_venue_transfers, or retry with the same key.", { money_moved: "unknown", outcome_unknown: true });
|
|
16752
|
+
break;
|
|
16753
|
+
}
|
|
16754
|
+
while (!VENUE_TRANSFER_FINAL.has(String(transfer.state)) && Date.now() + VENUE_TRANSFER_POLL_MS < deadline) {
|
|
16755
|
+
await sleep(VENUE_TRANSFER_POLL_MS);
|
|
16756
|
+
const read = await call("GET", `/v1/agent-capital/transfers/${encodeURIComponent(String(transfer.transfer_id))}`
|
|
16757
|
+
+ qs({ account_id: a.account_id }));
|
|
16758
|
+
const latest = read.ok === false ? undefined : parseVenueTransferRecord(read.transfer);
|
|
16759
|
+
if (latest && latest.transfer_id === transfer.transfer_id)
|
|
16760
|
+
transfer = latest;
|
|
16761
|
+
}
|
|
16762
|
+
out = { ok: true, ...describeVenueTransfer(transfer), idempotency_key: key,
|
|
16763
|
+
...(waitMs > 0 ? { wait_completed: VENUE_TRANSFER_FINAL.has(String(transfer.state)) } : {}) };
|
|
16764
|
+
break;
|
|
16765
|
+
}
|
|
16766
|
+
case "get_venue_transfer": {
|
|
16767
|
+
const bad = validateOptionalAccountId(a) || validateUuid(a, "transfer_id");
|
|
16768
|
+
if (bad) {
|
|
16769
|
+
out = bad;
|
|
16770
|
+
break;
|
|
16771
|
+
}
|
|
16772
|
+
const read = await call("GET", `/v1/agent-capital/transfers/${encodeURIComponent(String(a.transfer_id))}`
|
|
16773
|
+
+ qs({ account_id: a.account_id }));
|
|
16774
|
+
if (read.ok === false) {
|
|
16775
|
+
out = read;
|
|
16776
|
+
break;
|
|
16777
|
+
}
|
|
16778
|
+
const transfer = parseVenueTransferRecord(read.transfer);
|
|
16779
|
+
out = transfer && String(transfer.transfer_id).toLowerCase() === String(a.transfer_id).toLowerCase()
|
|
16780
|
+
? { ok: true, ...describeVenueTransfer(transfer) }
|
|
16781
|
+
: clientError("transfer_unreadable", "Felix returned an unreadable transfer.", "Retry shortly.");
|
|
16782
|
+
break;
|
|
16783
|
+
}
|
|
16784
|
+
case "list_venue_transfers": {
|
|
16785
|
+
const bad = validateOptionalAccountId(a)
|
|
16786
|
+
|| (a.open_only !== undefined && typeof a.open_only !== "boolean"
|
|
16787
|
+
? clientError("invalid_argument", "open_only must be true or false.") : undefined)
|
|
16788
|
+
|| (a.limit !== undefined && (!Number.isInteger(a.limit) || Number(a.limit) < 1 || Number(a.limit) > 20)
|
|
16789
|
+
? clientError("invalid_argument", "limit must be a whole number from 1 to 20.") : undefined);
|
|
16790
|
+
if (bad) {
|
|
16791
|
+
out = bad;
|
|
16792
|
+
break;
|
|
16793
|
+
}
|
|
16794
|
+
const read = await call("GET", `/v1/agent-capital/transfers${qs({ account_id: a.account_id,
|
|
16795
|
+
open_only: a.open_only === true ? "true" : undefined, limit: a.limit })}`);
|
|
16796
|
+
if (read.ok === false) {
|
|
16797
|
+
out = read;
|
|
16798
|
+
break;
|
|
16799
|
+
}
|
|
16800
|
+
const rows = Array.isArray(read.transfers) ? read.transfers : [];
|
|
16801
|
+
const transfers = rows.map(parseVenueTransferRecord).filter((row) => row !== undefined)
|
|
16802
|
+
.map(describeVenueTransfer);
|
|
16803
|
+
out = { ok: true, transfers, count: transfers.length,
|
|
16804
|
+
any_sending: transfers.some((row) => row.state === "sending") };
|
|
16805
|
+
break;
|
|
16806
|
+
}
|
|
16414
16807
|
case "get_network_fee_status":
|
|
16415
16808
|
if (a.account_id !== undefined && validateUuid(a, "account_id")) {
|
|
16416
16809
|
out = validateUuid(a, "account_id");
|
|
@@ -16613,10 +17006,19 @@ export function makeServer() {
|
|
|
16613
17006
|
out = clientError("invalid_argument", "reconcile must be a boolean when provided.");
|
|
16614
17007
|
break;
|
|
16615
17008
|
}
|
|
16616
|
-
|
|
16617
|
-
|
|
17009
|
+
let plainRead = a.reconcile === false;
|
|
17010
|
+
let reconcileSkipped = false;
|
|
17011
|
+
let result = plainRead
|
|
16618
17012
|
? await call("GET", `/v1/settlement/operations/${enc(operationId)}`)
|
|
16619
17013
|
: await call("POST", `/v1/settlement/transfers/${enc(operationId)}/reconcile`, undefined, { retryOnError: false, timeoutMs: 30_000 });
|
|
17014
|
+
// Opus QA r15: the reconcile step needs manage+transfer (engine routes_settlement.py reconcile_transfer) and
|
|
17015
|
+
// only advances the caller's own journey; an account's read/trade key gets 403. Fall back to the read-scope view.
|
|
17016
|
+
if (!plainRead && result.ok === false && isRecord(result.error)
|
|
17017
|
+
&& /lacks the '(?:manage|transfer)' scope/.test(String(result.error.message ?? ""))) {
|
|
17018
|
+
plainRead = true;
|
|
17019
|
+
reconcileSkipped = true;
|
|
17020
|
+
result = await call("GET", `/v1/settlement/operations/${enc(operationId)}`);
|
|
17021
|
+
}
|
|
16620
17022
|
if (result.ok === false) {
|
|
16621
17023
|
out = result;
|
|
16622
17024
|
break;
|
|
@@ -16634,6 +17036,8 @@ export function makeServer() {
|
|
|
16634
17036
|
source_transaction_hash: operation.source_transaction_hash ?? null,
|
|
16635
17037
|
destination_transaction_hash: operation.destination_transaction_hash ?? null,
|
|
16636
17038
|
operation,
|
|
17039
|
+
...(reconcileSkipped ? { reconciled: false,
|
|
17040
|
+
note: "This key cannot run the reconcile step, so this is the plain read. Felix advances the journey on its own." } : {}),
|
|
16637
17041
|
};
|
|
16638
17042
|
break;
|
|
16639
17043
|
}
|
|
@@ -16878,9 +17282,10 @@ export function makeServer() {
|
|
|
16878
17282
|
}
|
|
16879
17283
|
case "arc_home_fund_venue": {
|
|
16880
17284
|
const venue = nonEmptyString(a.venue)?.toLowerCase();
|
|
16881
|
-
const unsupported = venue
|
|
17285
|
+
const unsupported = venue && Object.hasOwn(ARC_HOME_UNSUPPORTED_VENUES, venue)
|
|
17286
|
+
? ARC_HOME_UNSUPPORTED_VENUES[venue] : undefined;
|
|
16882
17287
|
const bad = (unsupported
|
|
16883
|
-
? clientError("arc_home_venue_unsupported", unsupported, "Nothing was prepared or signed.
|
|
17288
|
+
? clientError("arc_home_venue_unsupported", unsupported, "Nothing was prepared or signed. Fund Hyperliquid with fund_hypercore_from_arc and Polymarket with fund_polymarket_from_arc.", { venue, money_moved: false })
|
|
16884
17289
|
: undefined)
|
|
16885
17290
|
|| (!venue || !ARC_HOME_VENUES.includes(venue)
|
|
16886
17291
|
? clientError("invalid_argument", `venue must be one of ${ARC_HOME_VENUES.join(", ")}.`)
|
|
@@ -19867,6 +20272,7 @@ export function makeServer() {
|
|
|
19867
20272
|
}
|
|
19868
20273
|
: {});
|
|
19869
20274
|
}
|
|
20275
|
+
out = withNewAccountNextStep(name, out, a);
|
|
19870
20276
|
if (liveMutation) {
|
|
19871
20277
|
out = { ...out, idempotency_key: liveMutation.key };
|
|
19872
20278
|
try {
|
package/package.json
CHANGED
package/server.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "trade.felix/mcp",
|
|
4
4
|
"title": "Felix MCP",
|
|
5
5
|
"description": "Non-custodial trading infrastructure for AI agents across prediction markets, crypto, and options.",
|
|
6
|
-
"version": "2.0.
|
|
6
|
+
"version": "2.0.134",
|
|
7
7
|
"websiteUrl": "https://felix.trade/docs",
|
|
8
8
|
"icons": [
|
|
9
9
|
{
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
{
|
|
26
26
|
"registryType": "npm",
|
|
27
27
|
"identifier": "felix-mcp",
|
|
28
|
-
"version": "2.0.
|
|
28
|
+
"version": "2.0.134",
|
|
29
29
|
"transport": {
|
|
30
30
|
"type": "stdio"
|
|
31
31
|
}
|