@pgnio/helios-mcp 0.2.9 → 0.5.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/README.md +19 -2
- package/dist/chunk-XM257Y63.mjs +4307 -0
- package/dist/cli.js +2284 -1358
- package/dist/cli.mjs +8 -4
- package/dist/index.d.mts +1032 -134
- package/dist/index.d.ts +1032 -134
- package/dist/index.js +2250 -987
- package/dist/index.mjs +79 -3
- package/docs/ai-agent-mcp/04_trading/01_tools.txt +2 -1
- package/package.json +9 -16
- package/dist/chunk-7TMDGB6C.mjs +0 -3084
- package/dist/chunk-LMZEWQVW.mjs +0 -3084
package/dist/index.d.mts
CHANGED
|
@@ -10,6 +10,8 @@ declare const agentDeviceStartInputSchema: z.ZodObject<{
|
|
|
10
10
|
"orders:cancel": "orders:cancel";
|
|
11
11
|
}>>;
|
|
12
12
|
constraints: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
13
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
requireApprovalProof: z.ZodOptional<z.ZodBoolean>;
|
|
13
15
|
}, z.core.$strip>;
|
|
14
16
|
declare const agentDeviceStartOutputSchema: z.ZodObject<{
|
|
15
17
|
deviceCode: z.ZodString;
|
|
@@ -67,11 +69,6 @@ declare const openPositionsSnapshotSchema: z.ZodObject<{
|
|
|
67
69
|
liquidationPrice: z.ZodOptional<z.ZodNumber>;
|
|
68
70
|
}, z.core.$strip>>;
|
|
69
71
|
}, z.core.$strip>;
|
|
70
|
-
declare const portfolioInputSchema: z.ZodObject<{
|
|
71
|
-
provider: z.ZodEnum<{
|
|
72
|
-
hyperliquid: "hyperliquid";
|
|
73
|
-
}>;
|
|
74
|
-
}, z.core.$strip>;
|
|
75
72
|
declare const portfolioSnapshotSchema: z.ZodObject<{
|
|
76
73
|
provider: z.ZodLiteral<"hyperliquid">;
|
|
77
74
|
totalBalance: z.ZodNumber;
|
|
@@ -118,6 +115,11 @@ declare const portfolioSnapshotSchema: z.ZodObject<{
|
|
|
118
115
|
createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
119
116
|
}, z.core.$strip>>;
|
|
120
117
|
}, z.core.$strip>;
|
|
118
|
+
declare const portfolioInputSchema: z.ZodObject<{
|
|
119
|
+
provider: z.ZodEnum<{
|
|
120
|
+
hyperliquid: "hyperliquid";
|
|
121
|
+
}>;
|
|
122
|
+
}, z.core.$strip>;
|
|
121
123
|
declare const ledgerFillsInputSchema: z.ZodObject<{
|
|
122
124
|
window: z.ZodOptional<z.ZodEnum<{
|
|
123
125
|
"24h": "24h";
|
|
@@ -373,6 +375,7 @@ declare const submitTradeIntentInputSchema: z.ZodObject<{
|
|
|
373
375
|
}, z.core.$strip>>;
|
|
374
376
|
}, z.core.$strip>>;
|
|
375
377
|
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
378
|
+
idempotencyWindowSeconds: z.ZodOptional<z.ZodNumber>;
|
|
376
379
|
}, z.core.$strip>;
|
|
377
380
|
declare const submitTradeIntentResultSchema: z.ZodObject<{
|
|
378
381
|
status: z.ZodLiteral<"submitted">;
|
|
@@ -437,6 +440,7 @@ declare const closePositionInputSchema: z.ZodObject<{
|
|
|
437
440
|
}>>;
|
|
438
441
|
symbol: z.ZodString;
|
|
439
442
|
maxSlippageBps: z.ZodOptional<z.ZodNumber>;
|
|
443
|
+
fraction: z.ZodOptional<z.ZodNumber>;
|
|
440
444
|
}, z.core.$strip>;
|
|
441
445
|
declare const closePositionResultSchema: z.ZodObject<{
|
|
442
446
|
status: z.ZodLiteral<"submitted">;
|
|
@@ -448,7 +452,11 @@ declare const closePositionResultSchema: z.ZodObject<{
|
|
|
448
452
|
hyperliquid: "hyperliquid";
|
|
449
453
|
}>>;
|
|
450
454
|
symbol: z.ZodString;
|
|
451
|
-
mode: z.
|
|
455
|
+
mode: z.ZodEnum<{
|
|
456
|
+
FULL: "FULL";
|
|
457
|
+
PARTIAL: "PARTIAL";
|
|
458
|
+
}>;
|
|
459
|
+
fraction: z.ZodOptional<z.ZodNumber>;
|
|
452
460
|
maxSlippageBps: z.ZodOptional<z.ZodNumber>;
|
|
453
461
|
}, z.core.$strip>;
|
|
454
462
|
declare const setTpSlInputSchema: z.ZodObject<{
|
|
@@ -537,6 +545,433 @@ declare const cancelOrderResultSchema: z.ZodObject<{
|
|
|
537
545
|
symbol: z.ZodString;
|
|
538
546
|
oid: z.ZodNumber;
|
|
539
547
|
}, z.core.$strip>;
|
|
548
|
+
/** Moves a resting order (data-bridge positions.modifyOrder): its limit price, or trigger price for a trigger order. */
|
|
549
|
+
declare const modifyOrderInputSchema: z.ZodObject<{
|
|
550
|
+
symbol: z.ZodString;
|
|
551
|
+
oid: z.ZodNumber;
|
|
552
|
+
price: z.ZodNumber;
|
|
553
|
+
size: z.ZodNumber;
|
|
554
|
+
}, z.core.$strip>;
|
|
555
|
+
declare const modifyOrderResultSchema: z.ZodObject<{
|
|
556
|
+
status: z.ZodLiteral<"modified">;
|
|
557
|
+
symbol: z.ZodString;
|
|
558
|
+
oid: z.ZodNumber;
|
|
559
|
+
price: z.ZodNumber;
|
|
560
|
+
size: z.ZodNumber;
|
|
561
|
+
}, z.core.$strip>;
|
|
562
|
+
/** One paper fill as the paper engine records it (data-bridge services/paper/engine.ts PaperFill). */
|
|
563
|
+
declare const paperFillSchema: z.ZodObject<{
|
|
564
|
+
ts: z.ZodNumber;
|
|
565
|
+
coin: z.ZodString;
|
|
566
|
+
kind: z.ZodString;
|
|
567
|
+
side: z.ZodNullable<z.ZodEnum<{
|
|
568
|
+
BUY: "BUY";
|
|
569
|
+
SELL: "SELL";
|
|
570
|
+
}>>;
|
|
571
|
+
size: z.ZodNumber;
|
|
572
|
+
price: z.ZodNumber;
|
|
573
|
+
fee: z.ZodNumber;
|
|
574
|
+
pnl: z.ZodNumber;
|
|
575
|
+
}, z.core.$strip>;
|
|
576
|
+
/** A paper portfolio: the live shape plus the paper account's own totals. */
|
|
577
|
+
declare const paperPortfolioSchema: z.ZodObject<{
|
|
578
|
+
provider: z.ZodLiteral<"hyperliquid">;
|
|
579
|
+
totalBalance: z.ZodNumber;
|
|
580
|
+
availableBalance: z.ZodNumber;
|
|
581
|
+
totalMargin: z.ZodNumber;
|
|
582
|
+
unrealizedPnl: z.ZodNumber;
|
|
583
|
+
positions: z.ZodArray<z.ZodObject<{
|
|
584
|
+
symbol: z.ZodString;
|
|
585
|
+
side: z.ZodEnum<{
|
|
586
|
+
LONG: "LONG";
|
|
587
|
+
SHORT: "SHORT";
|
|
588
|
+
}>;
|
|
589
|
+
size: z.ZodNumber;
|
|
590
|
+
entryPrice: z.ZodNumber;
|
|
591
|
+
markPrice: z.ZodNumber;
|
|
592
|
+
unrealizedPnl: z.ZodNumber;
|
|
593
|
+
margin: z.ZodNumber;
|
|
594
|
+
leverage: z.ZodNumber;
|
|
595
|
+
liquidationPrice: z.ZodOptional<z.ZodNumber>;
|
|
596
|
+
}, z.core.$strip>>;
|
|
597
|
+
protectiveOrders: z.ZodArray<z.ZodObject<{
|
|
598
|
+
id: z.ZodString;
|
|
599
|
+
binanceOrderId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
600
|
+
clientOrderId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
601
|
+
symbol: z.ZodString;
|
|
602
|
+
side: z.ZodEnum<{
|
|
603
|
+
BUY: "BUY";
|
|
604
|
+
SELL: "SELL";
|
|
605
|
+
}>;
|
|
606
|
+
positionSide: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
607
|
+
LONG: "LONG";
|
|
608
|
+
SHORT: "SHORT";
|
|
609
|
+
BOTH: "BOTH";
|
|
610
|
+
}>>>, z.ZodTransform<"LONG" | "SHORT" | "BOTH", "LONG" | "SHORT" | "BOTH" | null | undefined>>;
|
|
611
|
+
status: z.ZodString;
|
|
612
|
+
kind: z.ZodEnum<{
|
|
613
|
+
STOP_LOSS: "STOP_LOSS";
|
|
614
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
615
|
+
}>;
|
|
616
|
+
groupId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
617
|
+
stopPrice: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>, z.ZodTransform<string | null | undefined, string | number | null | undefined>>;
|
|
618
|
+
parentClientOrderId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
619
|
+
assetId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
620
|
+
createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
621
|
+
}, z.core.$strip>>;
|
|
622
|
+
cash: z.ZodOptional<z.ZodNumber>;
|
|
623
|
+
realizedPnl: z.ZodOptional<z.ZodNumber>;
|
|
624
|
+
feesPaid: z.ZodOptional<z.ZodNumber>;
|
|
625
|
+
fundingPaid: z.ZodOptional<z.ZodNumber>;
|
|
626
|
+
liquidations: z.ZodOptional<z.ZodNumber>;
|
|
627
|
+
}, z.core.$strip>;
|
|
628
|
+
declare const agentMarketInputSchema: z.ZodObject<{
|
|
629
|
+
coins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
630
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
631
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
632
|
+
sort: z.ZodOptional<z.ZodEnum<{
|
|
633
|
+
rank: "rank";
|
|
634
|
+
volume: "volume";
|
|
635
|
+
move1h: "move1h";
|
|
636
|
+
move24h: "move24h";
|
|
637
|
+
funding: "funding";
|
|
638
|
+
lean: "lean";
|
|
639
|
+
edge: "edge";
|
|
640
|
+
}>>;
|
|
641
|
+
filter: z.ZodOptional<z.ZodEnum<{
|
|
642
|
+
turning: "turning";
|
|
643
|
+
falling: "falling";
|
|
644
|
+
stretched_up: "stretched_up";
|
|
645
|
+
stretched_down: "stretched_down";
|
|
646
|
+
sm_long: "sm_long";
|
|
647
|
+
sm_short: "sm_short";
|
|
648
|
+
discount: "discount";
|
|
649
|
+
}>>;
|
|
650
|
+
}, z.core.$strip>;
|
|
651
|
+
declare const agentMarketSchema: z.ZodObject<{
|
|
652
|
+
asOf: z.ZodNullable<z.ZodString>;
|
|
653
|
+
smAsOf: z.ZodNullable<z.ZodNumber>;
|
|
654
|
+
market: z.ZodObject<{
|
|
655
|
+
os: z.ZodNullable<z.ZodNumber>;
|
|
656
|
+
mti: z.ZodNullable<z.ZodNumber>;
|
|
657
|
+
Mti: z.ZodNullable<z.ZodNumber>;
|
|
658
|
+
}, z.core.$strip>;
|
|
659
|
+
total: z.ZodNumber;
|
|
660
|
+
offset: z.ZodNumber;
|
|
661
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
662
|
+
coin: z.ZodString;
|
|
663
|
+
rank: z.ZodNullable<z.ZodNumber>;
|
|
664
|
+
px: z.ZodNullable<z.ZodNumber>;
|
|
665
|
+
r15m: z.ZodNullable<z.ZodNumber>;
|
|
666
|
+
r1h: z.ZodNullable<z.ZodNumber>;
|
|
667
|
+
r24h: z.ZodNullable<z.ZodNumber>;
|
|
668
|
+
volUsd: z.ZodNullable<z.ZodNumber>;
|
|
669
|
+
fundAprPct: z.ZodNullable<z.ZodNumber>;
|
|
670
|
+
oiUsd: z.ZodNullable<z.ZodNumber>;
|
|
671
|
+
setup: z.ZodNullable<z.ZodEnum<{
|
|
672
|
+
"turning up from breakdown": "turning up from breakdown";
|
|
673
|
+
"falling, no turn yet": "falling, no turn yet";
|
|
674
|
+
"stretched up": "stretched up";
|
|
675
|
+
"stretched down": "stretched down";
|
|
676
|
+
neutral: "neutral";
|
|
677
|
+
}>>;
|
|
678
|
+
maxLev: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
679
|
+
spreadBps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
680
|
+
slip10kBps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
681
|
+
slip100kBps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
682
|
+
depth1pctUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
683
|
+
sm: z.ZodNullable<z.ZodObject<{
|
|
684
|
+
side: z.ZodNullable<z.ZodEnum<{
|
|
685
|
+
long: "long";
|
|
686
|
+
short: "short";
|
|
687
|
+
}>>;
|
|
688
|
+
share: z.ZodNumber;
|
|
689
|
+
edgePct: z.ZodNullable<z.ZodNumber>;
|
|
690
|
+
discount: z.ZodNullable<z.ZodEnum<{
|
|
691
|
+
strict: "strict";
|
|
692
|
+
fill: "fill";
|
|
693
|
+
}>>;
|
|
694
|
+
}, z.core.$strip>>;
|
|
695
|
+
}, z.core.$strip>>;
|
|
696
|
+
next: z.ZodNullable<z.ZodNumber>;
|
|
697
|
+
unknown: z.ZodArray<z.ZodString>;
|
|
698
|
+
}, z.core.$strip>;
|
|
699
|
+
declare const smartMoneyBoardInputSchema: z.ZodObject<{
|
|
700
|
+
view: z.ZodOptional<z.ZodEnum<{
|
|
701
|
+
discount: "discount";
|
|
702
|
+
conviction: "conviction";
|
|
703
|
+
flows: "flows";
|
|
704
|
+
pileins: "pileins";
|
|
705
|
+
}>>;
|
|
706
|
+
side: z.ZodOptional<z.ZodEnum<{
|
|
707
|
+
any: "any";
|
|
708
|
+
long: "long";
|
|
709
|
+
short: "short";
|
|
710
|
+
}>>;
|
|
711
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
712
|
+
}, z.core.$strip>;
|
|
713
|
+
declare const smartMoneyBoardSchema: z.ZodObject<{
|
|
714
|
+
asOf: z.ZodNullable<z.ZodNumber>;
|
|
715
|
+
view: z.ZodEnum<{
|
|
716
|
+
discount: "discount";
|
|
717
|
+
conviction: "conviction";
|
|
718
|
+
flows: "flows";
|
|
719
|
+
pileins: "pileins";
|
|
720
|
+
}>;
|
|
721
|
+
wallets: z.ZodNumber;
|
|
722
|
+
known: z.ZodNumber;
|
|
723
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
724
|
+
coin: z.ZodString;
|
|
725
|
+
side: z.ZodNullable<z.ZodEnum<{
|
|
726
|
+
long: "long";
|
|
727
|
+
short: "short";
|
|
728
|
+
}>>;
|
|
729
|
+
share: z.ZodNumber;
|
|
730
|
+
lean: z.ZodNumber;
|
|
731
|
+
sideUsd: z.ZodNumber;
|
|
732
|
+
heads: z.ZodNumber;
|
|
733
|
+
traders: z.ZodNumber;
|
|
734
|
+
entry: z.ZodNullable<z.ZodNumber>;
|
|
735
|
+
mark: z.ZodNullable<z.ZodNumber>;
|
|
736
|
+
edgePct: z.ZodNullable<z.ZodNumber>;
|
|
737
|
+
flow1hUsd: z.ZodNumber;
|
|
738
|
+
discount: z.ZodNullable<z.ZodEnum<{
|
|
739
|
+
strict: "strict";
|
|
740
|
+
fill: "fill";
|
|
741
|
+
}>>;
|
|
742
|
+
setup: z.ZodNullable<z.ZodEnum<{
|
|
743
|
+
"turning up from breakdown": "turning up from breakdown";
|
|
744
|
+
"falling, no turn yet": "falling, no turn yet";
|
|
745
|
+
"stretched up": "stretched up";
|
|
746
|
+
"stretched down": "stretched down";
|
|
747
|
+
neutral: "neutral";
|
|
748
|
+
}>>;
|
|
749
|
+
r24h: z.ZodNullable<z.ZodNumber>;
|
|
750
|
+
}, z.core.$strip>>;
|
|
751
|
+
pileIns: z.ZodArray<z.ZodObject<{
|
|
752
|
+
coin: z.ZodString;
|
|
753
|
+
side: z.ZodEnum<{
|
|
754
|
+
long: "long";
|
|
755
|
+
short: "short";
|
|
756
|
+
}>;
|
|
757
|
+
dir: z.ZodEnum<{
|
|
758
|
+
in: "in";
|
|
759
|
+
out: "out";
|
|
760
|
+
}>;
|
|
761
|
+
traders: z.ZodNumber;
|
|
762
|
+
totalUsd: z.ZodNumber;
|
|
763
|
+
weight: z.ZodNumber;
|
|
764
|
+
names: z.ZodArray<z.ZodString>;
|
|
765
|
+
first: z.ZodNumber;
|
|
766
|
+
last: z.ZodNumber;
|
|
767
|
+
}, z.core.$strip>>;
|
|
768
|
+
note: z.ZodNullable<z.ZodString>;
|
|
769
|
+
}, z.core.$strip>;
|
|
770
|
+
declare const smartMoneyMovesInputSchema: z.ZodObject<{
|
|
771
|
+
since: z.ZodOptional<z.ZodString>;
|
|
772
|
+
coin: z.ZodOptional<z.ZodString>;
|
|
773
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
774
|
+
all: "all";
|
|
775
|
+
entries: "entries";
|
|
776
|
+
exits: "exits";
|
|
777
|
+
}>>;
|
|
778
|
+
minUsd: z.ZodOptional<z.ZodNumber>;
|
|
779
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
780
|
+
}, z.core.$strip>;
|
|
781
|
+
declare const smMoveSchema: z.ZodObject<{
|
|
782
|
+
id: z.ZodString;
|
|
783
|
+
t: z.ZodNumber;
|
|
784
|
+
coin: z.ZodString;
|
|
785
|
+
kind: z.ZodEnum<{
|
|
786
|
+
open: "open";
|
|
787
|
+
add: "add";
|
|
788
|
+
reduce: "reduce";
|
|
789
|
+
close: "close";
|
|
790
|
+
flip: "flip";
|
|
791
|
+
}>;
|
|
792
|
+
side: z.ZodEnum<{
|
|
793
|
+
long: "long";
|
|
794
|
+
short: "short";
|
|
795
|
+
}>;
|
|
796
|
+
usd: z.ZodNumber;
|
|
797
|
+
px: z.ZodNumber;
|
|
798
|
+
lev: z.ZodNullable<z.ZodNumber>;
|
|
799
|
+
pnl: z.ZodNullable<z.ZodNumber>;
|
|
800
|
+
pnlPct: z.ZodNullable<z.ZodNumber>;
|
|
801
|
+
nick: z.ZodString;
|
|
802
|
+
rank: z.ZodNumber;
|
|
803
|
+
style: z.ZodString;
|
|
804
|
+
win: z.ZodNullable<z.ZodNumber>;
|
|
805
|
+
w: z.ZodNumber;
|
|
806
|
+
}, z.core.$strip>;
|
|
807
|
+
declare const smartMoneyMovesSchema: z.ZodObject<{
|
|
808
|
+
order: z.ZodEnum<{
|
|
809
|
+
newest: "newest";
|
|
810
|
+
oldest: "oldest";
|
|
811
|
+
}>;
|
|
812
|
+
moves: z.ZodArray<z.ZodObject<{
|
|
813
|
+
id: z.ZodString;
|
|
814
|
+
t: z.ZodNumber;
|
|
815
|
+
coin: z.ZodString;
|
|
816
|
+
kind: z.ZodEnum<{
|
|
817
|
+
open: "open";
|
|
818
|
+
add: "add";
|
|
819
|
+
reduce: "reduce";
|
|
820
|
+
close: "close";
|
|
821
|
+
flip: "flip";
|
|
822
|
+
}>;
|
|
823
|
+
side: z.ZodEnum<{
|
|
824
|
+
long: "long";
|
|
825
|
+
short: "short";
|
|
826
|
+
}>;
|
|
827
|
+
usd: z.ZodNumber;
|
|
828
|
+
px: z.ZodNumber;
|
|
829
|
+
lev: z.ZodNullable<z.ZodNumber>;
|
|
830
|
+
pnl: z.ZodNullable<z.ZodNumber>;
|
|
831
|
+
pnlPct: z.ZodNullable<z.ZodNumber>;
|
|
832
|
+
nick: z.ZodString;
|
|
833
|
+
rank: z.ZodNumber;
|
|
834
|
+
style: z.ZodString;
|
|
835
|
+
win: z.ZodNullable<z.ZodNumber>;
|
|
836
|
+
w: z.ZodNumber;
|
|
837
|
+
}, z.core.$strip>>;
|
|
838
|
+
next: z.ZodNullable<z.ZodString>;
|
|
839
|
+
more: z.ZodBoolean;
|
|
840
|
+
gap: z.ZodBoolean;
|
|
841
|
+
note: z.ZodNullable<z.ZodString>;
|
|
842
|
+
}, z.core.$strip>;
|
|
843
|
+
declare const smartMoneyCoinSchema: z.ZodObject<{
|
|
844
|
+
coin: z.ZodString;
|
|
845
|
+
asOf: z.ZodNullable<z.ZodNumber>;
|
|
846
|
+
sm: z.ZodNullable<z.ZodObject<{
|
|
847
|
+
coin: z.ZodString;
|
|
848
|
+
mark: z.ZodNullable<z.ZodNumber>;
|
|
849
|
+
long: z.ZodObject<{
|
|
850
|
+
usd: z.ZodNumber;
|
|
851
|
+
heads: z.ZodNumber;
|
|
852
|
+
traders: z.ZodNumber;
|
|
853
|
+
entry: z.ZodNullable<z.ZodNumber>;
|
|
854
|
+
}, z.core.$strip>;
|
|
855
|
+
short: z.ZodObject<{
|
|
856
|
+
usd: z.ZodNumber;
|
|
857
|
+
heads: z.ZodNumber;
|
|
858
|
+
traders: z.ZodNumber;
|
|
859
|
+
entry: z.ZodNullable<z.ZodNumber>;
|
|
860
|
+
}, z.core.$strip>;
|
|
861
|
+
lean: z.ZodNumber;
|
|
862
|
+
side: z.ZodNullable<z.ZodEnum<{
|
|
863
|
+
long: "long";
|
|
864
|
+
short: "short";
|
|
865
|
+
}>>;
|
|
866
|
+
share: z.ZodNumber;
|
|
867
|
+
edgePct: z.ZodNullable<z.ZodNumber>;
|
|
868
|
+
flow1hUsd: z.ZodNumber;
|
|
869
|
+
conviction: z.ZodNullable<z.ZodNumber>;
|
|
870
|
+
discount: z.ZodNullable<z.ZodEnum<{
|
|
871
|
+
strict: "strict";
|
|
872
|
+
fill: "fill";
|
|
873
|
+
}>>;
|
|
874
|
+
pileIn: z.ZodNullable<z.ZodObject<{
|
|
875
|
+
coin: z.ZodString;
|
|
876
|
+
side: z.ZodEnum<{
|
|
877
|
+
long: "long";
|
|
878
|
+
short: "short";
|
|
879
|
+
}>;
|
|
880
|
+
dir: z.ZodEnum<{
|
|
881
|
+
in: "in";
|
|
882
|
+
out: "out";
|
|
883
|
+
}>;
|
|
884
|
+
traders: z.ZodNumber;
|
|
885
|
+
totalUsd: z.ZodNumber;
|
|
886
|
+
weight: z.ZodNumber;
|
|
887
|
+
names: z.ZodArray<z.ZodString>;
|
|
888
|
+
first: z.ZodNumber;
|
|
889
|
+
last: z.ZodNumber;
|
|
890
|
+
}, z.core.$strip>>;
|
|
891
|
+
}, z.core.$strip>>;
|
|
892
|
+
market: z.ZodNullable<z.ZodObject<{
|
|
893
|
+
coin: z.ZodString;
|
|
894
|
+
rank: z.ZodNullable<z.ZodNumber>;
|
|
895
|
+
px: z.ZodNullable<z.ZodNumber>;
|
|
896
|
+
r15m: z.ZodNullable<z.ZodNumber>;
|
|
897
|
+
r1h: z.ZodNullable<z.ZodNumber>;
|
|
898
|
+
r24h: z.ZodNullable<z.ZodNumber>;
|
|
899
|
+
volUsd: z.ZodNullable<z.ZodNumber>;
|
|
900
|
+
fundAprPct: z.ZodNullable<z.ZodNumber>;
|
|
901
|
+
oiUsd: z.ZodNullable<z.ZodNumber>;
|
|
902
|
+
setup: z.ZodNullable<z.ZodEnum<{
|
|
903
|
+
"turning up from breakdown": "turning up from breakdown";
|
|
904
|
+
"falling, no turn yet": "falling, no turn yet";
|
|
905
|
+
"stretched up": "stretched up";
|
|
906
|
+
"stretched down": "stretched down";
|
|
907
|
+
neutral: "neutral";
|
|
908
|
+
}>>;
|
|
909
|
+
maxLev: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
910
|
+
spreadBps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
911
|
+
slip10kBps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
912
|
+
slip100kBps: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
913
|
+
depth1pctUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
914
|
+
}, z.core.$strip>>;
|
|
915
|
+
moves: z.ZodArray<z.ZodObject<{
|
|
916
|
+
id: z.ZodString;
|
|
917
|
+
t: z.ZodNumber;
|
|
918
|
+
coin: z.ZodString;
|
|
919
|
+
kind: z.ZodEnum<{
|
|
920
|
+
open: "open";
|
|
921
|
+
add: "add";
|
|
922
|
+
reduce: "reduce";
|
|
923
|
+
close: "close";
|
|
924
|
+
flip: "flip";
|
|
925
|
+
}>;
|
|
926
|
+
side: z.ZodEnum<{
|
|
927
|
+
long: "long";
|
|
928
|
+
short: "short";
|
|
929
|
+
}>;
|
|
930
|
+
usd: z.ZodNumber;
|
|
931
|
+
px: z.ZodNumber;
|
|
932
|
+
lev: z.ZodNullable<z.ZodNumber>;
|
|
933
|
+
pnl: z.ZodNullable<z.ZodNumber>;
|
|
934
|
+
pnlPct: z.ZodNullable<z.ZodNumber>;
|
|
935
|
+
nick: z.ZodString;
|
|
936
|
+
rank: z.ZodNumber;
|
|
937
|
+
style: z.ZodString;
|
|
938
|
+
win: z.ZodNullable<z.ZodNumber>;
|
|
939
|
+
w: z.ZodNumber;
|
|
940
|
+
}, z.core.$strip>>;
|
|
941
|
+
note: z.ZodNullable<z.ZodString>;
|
|
942
|
+
}, z.core.$strip>;
|
|
943
|
+
declare const marketCandlesInputSchema: z.ZodObject<{
|
|
944
|
+
symbol: z.ZodString;
|
|
945
|
+
interval: z.ZodEnum<{
|
|
946
|
+
"1m": "1m";
|
|
947
|
+
"3m": "3m";
|
|
948
|
+
"5m": "5m";
|
|
949
|
+
"15m": "15m";
|
|
950
|
+
"30m": "30m";
|
|
951
|
+
"1h": "1h";
|
|
952
|
+
"2h": "2h";
|
|
953
|
+
"4h": "4h";
|
|
954
|
+
"6h": "6h";
|
|
955
|
+
"8h": "8h";
|
|
956
|
+
"12h": "12h";
|
|
957
|
+
"1d": "1d";
|
|
958
|
+
"1w": "1w";
|
|
959
|
+
"1M": "1M";
|
|
960
|
+
}>;
|
|
961
|
+
endTime: z.ZodOptional<z.ZodNumber>;
|
|
962
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
963
|
+
}, z.core.$strip>;
|
|
964
|
+
declare const marketCandlesSchema: z.ZodObject<{
|
|
965
|
+
candles: z.ZodArray<z.ZodObject<{
|
|
966
|
+
t: z.ZodNumber;
|
|
967
|
+
o: z.ZodNumber;
|
|
968
|
+
h: z.ZodNumber;
|
|
969
|
+
l: z.ZodNumber;
|
|
970
|
+
c: z.ZodNumber;
|
|
971
|
+
v: z.ZodNumber;
|
|
972
|
+
}, z.core.$strip>>;
|
|
973
|
+
complete: z.ZodBoolean;
|
|
974
|
+
}, z.core.$strip>;
|
|
540
975
|
type AgentDeviceStartInput = z.infer<typeof agentDeviceStartInputSchema>;
|
|
541
976
|
type AgentDeviceStartOutput = z.infer<typeof agentDeviceStartOutputSchema>;
|
|
542
977
|
type AgentTokenResponse = z.infer<typeof agentTokenResponseSchema>;
|
|
@@ -566,61 +1001,63 @@ type DeleteTpSlResult = z.infer<typeof deleteTpSlResultSchema>;
|
|
|
566
1001
|
type OpenOrder = z.infer<typeof openOrderSchema>;
|
|
567
1002
|
type CancelOrderInput = z.infer<typeof cancelOrderInputSchema>;
|
|
568
1003
|
type CancelOrderResult = z.infer<typeof cancelOrderResultSchema>;
|
|
1004
|
+
type ModifyOrderInput = z.infer<typeof modifyOrderInputSchema>;
|
|
1005
|
+
type ModifyOrderResult = z.infer<typeof modifyOrderResultSchema>;
|
|
1006
|
+
type PaperFill = z.infer<typeof paperFillSchema>;
|
|
1007
|
+
type PaperPortfolio = z.infer<typeof paperPortfolioSchema>;
|
|
1008
|
+
type AgentMarketInput = z.infer<typeof agentMarketInputSchema>;
|
|
1009
|
+
type AgentMarket = z.infer<typeof agentMarketSchema>;
|
|
1010
|
+
type SmartMoneyBoardInput = z.infer<typeof smartMoneyBoardInputSchema>;
|
|
1011
|
+
type SmartMoneyBoard = z.infer<typeof smartMoneyBoardSchema>;
|
|
1012
|
+
type SmartMoneyMovesInput = z.infer<typeof smartMoneyMovesInputSchema>;
|
|
1013
|
+
type SmMove = z.infer<typeof smMoveSchema>;
|
|
1014
|
+
type SmartMoneyMoves = z.infer<typeof smartMoneyMovesSchema>;
|
|
1015
|
+
type SmartMoneyCoin = z.infer<typeof smartMoneyCoinSchema>;
|
|
1016
|
+
type MarketCandlesInput = z.infer<typeof marketCandlesInputSchema>;
|
|
1017
|
+
type MarketCandles = z.infer<typeof marketCandlesSchema>;
|
|
569
1018
|
|
|
570
1019
|
type FetchLike = typeof fetch;
|
|
571
1020
|
interface HeliosAgentAuthClientOptions {
|
|
572
1021
|
baseUrl: string;
|
|
573
1022
|
fetch?: FetchLike;
|
|
574
|
-
headers?:
|
|
1023
|
+
headers?: Record<string, string>;
|
|
1024
|
+
/**
|
|
1025
|
+
* The hosted MCP's shared secret (identity's AGENT_START_SECRET), sent on device/start only. Without it identity
|
|
1026
|
+
* ignores `verified` and labels a well-known app name as unverified. CLIs leave it unset.
|
|
1027
|
+
*/
|
|
1028
|
+
startSecret?: string;
|
|
1029
|
+
}
|
|
1030
|
+
interface StartLoginOptions {
|
|
1031
|
+
/**
|
|
1032
|
+
* The address of the person the login is for (the hosted MCP's req.ip): identity counts hosted starts per address.
|
|
1033
|
+
* Sent only along with the start secret; without one it would mean nothing to identity, so it is left out.
|
|
1034
|
+
*/
|
|
1035
|
+
clientIp?: string;
|
|
1036
|
+
}
|
|
1037
|
+
interface ExchangeDeviceCodeOptions {
|
|
1038
|
+
/** The proof the approval answered with, for a login started with requireApprovalProof. */
|
|
1039
|
+
approvalProof?: string;
|
|
575
1040
|
}
|
|
576
1041
|
declare class HeliosAgentAuthClient {
|
|
577
1042
|
private readonly baseUrl;
|
|
578
1043
|
private readonly fetchImpl;
|
|
579
1044
|
private readonly headers;
|
|
1045
|
+
private readonly startSecret;
|
|
580
1046
|
constructor(options: HeliosAgentAuthClientOptions);
|
|
581
|
-
startLogin(input: AgentDeviceStartInput): Promise<AgentDeviceStartOutput>;
|
|
582
|
-
exchangeDeviceCode(deviceCode: string): Promise<AgentTokenResponse>;
|
|
1047
|
+
startLogin(input: AgentDeviceStartInput, options?: StartLoginOptions): Promise<AgentDeviceStartOutput>;
|
|
1048
|
+
exchangeDeviceCode(deviceCode: string, options?: ExchangeDeviceCodeOptions): Promise<AgentTokenResponse>;
|
|
583
1049
|
refreshSession(refreshToken: string): Promise<AgentTokenResponse>;
|
|
584
1050
|
private post;
|
|
585
1051
|
private parseJson;
|
|
586
1052
|
}
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
constructor(options: HeliosAgentDataBridgeClientOptions);
|
|
596
|
-
getWalletState(accessToken: string): Promise<WalletState>;
|
|
597
|
-
getOpenPositions(accessToken: string): Promise<OpenPositionsSnapshot>;
|
|
598
|
-
getPortfolio(accessToken: string, input: PortfolioInput): Promise<PortfolioSnapshot>;
|
|
599
|
-
getLedgerFills(accessToken: string, input?: LedgerFillsInput): Promise<LedgerFillsPage>;
|
|
600
|
-
getLedgerSummary(accessToken: string, input?: LedgerSummaryInput): Promise<LedgerSummary>;
|
|
601
|
-
getMarketSnapshot(accessToken: string, input?: MarketSnapshotInput): Promise<MarketSnapshot>;
|
|
602
|
-
getMarketSnapshotChunk(accessToken: string, input?: MarketSnapshotChunkInput): Promise<MarketSnapshotChunk>;
|
|
603
|
-
getMarketSymbolDetail(accessToken: string, input: MarketSymbolDetailInput): Promise<MarketSymbolDetail>;
|
|
604
|
-
submitTradeIntent(accessToken: string, input: SubmitTradeIntentInput): Promise<SubmitTradeIntentResult>;
|
|
605
|
-
closePosition(accessToken: string, input: ClosePositionInput): Promise<ClosePositionResult>;
|
|
606
|
-
setTpSl(accessToken: string, input: SetTpSlInput): Promise<SetTpSlResult>;
|
|
607
|
-
deleteTpSl(accessToken: string, input: DeleteTpSlInput): Promise<DeleteTpSlResult>;
|
|
608
|
-
getOpenOrders(accessToken: string): Promise<OpenOrder[]>;
|
|
609
|
-
cancelOrder(accessToken: string, input: CancelOrderInput): Promise<CancelOrderResult>;
|
|
610
|
-
private request;
|
|
611
|
-
private buildProcedureUrl;
|
|
612
|
-
private parseJson;
|
|
613
|
-
/** The result of a mutation older data-bridges answer with nothing; null when there is none. */
|
|
614
|
-
private tryUnwrapResult;
|
|
615
|
-
private unwrapResult;
|
|
616
|
-
private extractErrorCode;
|
|
617
|
-
private extractErrorMessage;
|
|
618
|
-
/**
|
|
619
|
-
* Unwrap a tRPC error envelope, handling the superjson `{ json: ... }` wrapper
|
|
620
|
-
* that the data-bridge applies via its transformer configuration.
|
|
621
|
-
*/
|
|
622
|
-
private unwrapTrpcError;
|
|
623
|
-
}
|
|
1053
|
+
/**
|
|
1054
|
+
* The Helios hosts a session came from. A session is only sent back to them, so a config that points the server at
|
|
1055
|
+
* another host never hands it the stored tokens. Optional: sessions stored before it was recorded still load.
|
|
1056
|
+
*/
|
|
1057
|
+
declare const agentSessionIssuerSchema: z.ZodObject<{
|
|
1058
|
+
identityServiceUrl: z.ZodString;
|
|
1059
|
+
dataBridgeUrl: z.ZodString;
|
|
1060
|
+
}, z.core.$strip>;
|
|
624
1061
|
declare const storedAgentSessionSchema: z.ZodObject<{
|
|
625
1062
|
accessToken: z.ZodString;
|
|
626
1063
|
refreshToken: z.ZodString;
|
|
@@ -636,6 +1073,10 @@ declare const storedAgentSessionSchema: z.ZodObject<{
|
|
|
636
1073
|
accessTokenExpiresAt: z.ZodString;
|
|
637
1074
|
createdAt: z.ZodString;
|
|
638
1075
|
lastRefreshedAt: z.ZodString;
|
|
1076
|
+
issuer: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1077
|
+
identityServiceUrl: z.ZodString;
|
|
1078
|
+
dataBridgeUrl: z.ZodString;
|
|
1079
|
+
}, z.core.$strip>>>;
|
|
639
1080
|
}, z.core.$strip>;
|
|
640
1081
|
declare const agentSessionViewSchema: z.ZodObject<{
|
|
641
1082
|
connected: z.ZodBoolean;
|
|
@@ -658,6 +1099,7 @@ declare const agentSessionViewSchema: z.ZodObject<{
|
|
|
658
1099
|
accessTokenExpiresAt: z.ZodOptional<z.ZodString>;
|
|
659
1100
|
lastRefreshedAt: z.ZodOptional<z.ZodString>;
|
|
660
1101
|
}, z.core.$strip>;
|
|
1102
|
+
type AgentSessionIssuer = z.infer<typeof agentSessionIssuerSchema>;
|
|
661
1103
|
type StoredAgentSession = z.infer<typeof storedAgentSessionSchema>;
|
|
662
1104
|
type AgentSessionView = z.infer<typeof agentSessionViewSchema>;
|
|
663
1105
|
interface AgentSessionStore {
|
|
@@ -666,6 +1108,203 @@ interface AgentSessionStore {
|
|
|
666
1108
|
clearSession(): Promise<void>;
|
|
667
1109
|
}
|
|
668
1110
|
|
|
1111
|
+
/** A device login waiting for the person to approve it, as a login store keeps it. */
|
|
1112
|
+
declare const pendingAgentLoginSchema$1: z.ZodObject<{
|
|
1113
|
+
status: z.ZodLiteral<"pending">;
|
|
1114
|
+
deviceCode: z.ZodString;
|
|
1115
|
+
userCode: z.ZodString;
|
|
1116
|
+
verificationUri: z.ZodString;
|
|
1117
|
+
verificationUriComplete: z.ZodString;
|
|
1118
|
+
expiresInSeconds: z.ZodNumber;
|
|
1119
|
+
pollIntervalSeconds: z.ZodNumber;
|
|
1120
|
+
requestedScope: z.ZodArray<z.ZodEnum<{
|
|
1121
|
+
"account:read": "account:read";
|
|
1122
|
+
"market:read": "market:read";
|
|
1123
|
+
"orders:write": "orders:write";
|
|
1124
|
+
"orders:cancel": "orders:cancel";
|
|
1125
|
+
}>>;
|
|
1126
|
+
startedAt: z.ZodString;
|
|
1127
|
+
}, z.core.$strip>;
|
|
1128
|
+
type PendingAgentLogin$1 = z.infer<typeof pendingAgentLoginSchema$1>;
|
|
1129
|
+
/** A session store that also keeps the device login in progress. */
|
|
1130
|
+
interface AgentLoginStore extends AgentSessionStore {
|
|
1131
|
+
getPendingLogin(): Promise<PendingAgentLogin$1 | null>;
|
|
1132
|
+
setPendingLogin(pendingLogin: PendingAgentLogin$1): Promise<void>;
|
|
1133
|
+
clearPendingLogin(): Promise<void>;
|
|
1134
|
+
}
|
|
1135
|
+
type AgentStartLoginResult = PendingAgentLogin$1;
|
|
1136
|
+
type AgentPendingLoginResult = AgentStartLoginResult & {
|
|
1137
|
+
connected: false;
|
|
1138
|
+
message: string;
|
|
1139
|
+
};
|
|
1140
|
+
type ConnectedResult = AgentSessionView & {
|
|
1141
|
+
status: 'connected';
|
|
1142
|
+
connected: true;
|
|
1143
|
+
};
|
|
1144
|
+
type AgentEnsureLoginResult = ConnectedResult | AgentPendingLoginResult;
|
|
1145
|
+
type AgentPollLoginResult = ConnectedResult | {
|
|
1146
|
+
status: 'pending' | 'rejected' | 'expired' | 'failed';
|
|
1147
|
+
connected: false;
|
|
1148
|
+
message: string;
|
|
1149
|
+
};
|
|
1150
|
+
interface AgentEnsureLoginOptions {
|
|
1151
|
+
clientName?: string;
|
|
1152
|
+
scope?: AgentDeviceStartInput['scope'];
|
|
1153
|
+
constraints?: AgentDeviceStartInput['constraints'];
|
|
1154
|
+
}
|
|
1155
|
+
/** What the person or agent is told at each step; each app words them for its own commands. */
|
|
1156
|
+
interface AgentAuthMessages {
|
|
1157
|
+
/** The prompt shown with a login in progress: where to approve it and what to do next. */
|
|
1158
|
+
loginPrompt(result: Pick<AgentStartLoginResult, 'verificationUriComplete' | 'userCode' | 'requestedScope'>): string;
|
|
1159
|
+
/** pollLogin with no login in progress and no session. */
|
|
1160
|
+
noLoginInProgress: string;
|
|
1161
|
+
/** pollLogin with a code that isn't the login in progress. */
|
|
1162
|
+
wrongCode: string;
|
|
1163
|
+
/** The server no longer knows the stored device code (invalid_grant), so a fresh login is needed. */
|
|
1164
|
+
staleLogin: string;
|
|
1165
|
+
/** No session, and this service can't start a login (deviceLogin false). */
|
|
1166
|
+
reconnect: string;
|
|
1167
|
+
}
|
|
1168
|
+
interface AgentAuthServiceOptions {
|
|
1169
|
+
client: HeliosAgentAuthClient;
|
|
1170
|
+
sessionStore: AgentLoginStore;
|
|
1171
|
+
messages: AgentAuthMessages;
|
|
1172
|
+
refreshWindowMs?: number;
|
|
1173
|
+
now?: () => Date;
|
|
1174
|
+
/** The client name a login is started with when the caller gives none. */
|
|
1175
|
+
defaultClientName: string;
|
|
1176
|
+
/**
|
|
1177
|
+
* False on the hosted MCP server (helios.pgn.io/mcp): the AI app signed in through OAuth and holds the tokens, so this
|
|
1178
|
+
* service never starts a device login of its own; an expired or revoked connection is an error the app answers by
|
|
1179
|
+
* reconnecting. Default true.
|
|
1180
|
+
*/
|
|
1181
|
+
deviceLogin?: boolean;
|
|
1182
|
+
/**
|
|
1183
|
+
* True: ensureLogin with a scope the stored session wasn't granted drops that session and starts a login for the wider
|
|
1184
|
+
* scope. False: the session is used as it is, and the server refuses what it isn't allowed. Default false.
|
|
1185
|
+
*/
|
|
1186
|
+
reloginForMissingScope?: boolean;
|
|
1187
|
+
}
|
|
1188
|
+
/**
|
|
1189
|
+
* Device login and session refresh for a Helios delegated agent (helios-cli and helios-agent-mcp). Both refresh and the
|
|
1190
|
+
* device-code exchange are single-flight: refresh tokens rotate and a device code is collected once, so a second
|
|
1191
|
+
* concurrent request with the same token or code would be refused and log the agent out.
|
|
1192
|
+
*/
|
|
1193
|
+
declare class AgentAuthService {
|
|
1194
|
+
protected readonly client: HeliosAgentAuthClient;
|
|
1195
|
+
protected readonly sessionStore: AgentLoginStore;
|
|
1196
|
+
private readonly messages;
|
|
1197
|
+
private readonly refreshWindowMs;
|
|
1198
|
+
private readonly now;
|
|
1199
|
+
private readonly defaultClientName;
|
|
1200
|
+
private readonly deviceLogin;
|
|
1201
|
+
private readonly reloginForMissingScope;
|
|
1202
|
+
/** The refresh in progress, which concurrent callers join. */
|
|
1203
|
+
private refreshInFlight;
|
|
1204
|
+
/** The device-code exchange in progress, which concurrent polls of the same login join. */
|
|
1205
|
+
private exchangeInFlight;
|
|
1206
|
+
constructor(options: AgentAuthServiceOptions);
|
|
1207
|
+
startLogin(input: AgentDeviceStartInput): Promise<AgentStartLoginResult>;
|
|
1208
|
+
resetSessionAndStartLogin(input: AgentDeviceStartInput): Promise<AgentStartLoginResult>;
|
|
1209
|
+
startRelogin(options?: AgentEnsureLoginOptions): Promise<AgentPendingLoginResult>;
|
|
1210
|
+
clearSessionState(): Promise<void>;
|
|
1211
|
+
/** After a 401 from Helios: drops the session and starts a fresh login. Null for any other error. */
|
|
1212
|
+
invalidateIfUnauthorized(error: unknown, options?: AgentEnsureLoginOptions): Promise<AgentPendingLoginResult | null>;
|
|
1213
|
+
/** After a 401 from Helios: refreshes the session even if it isn't near expiry. Null for any other error. */
|
|
1214
|
+
refreshSessionAfterUnauthorized(error: unknown): Promise<StoredAgentSession | null>;
|
|
1215
|
+
ensureLogin(options?: AgentEnsureLoginOptions): Promise<AgentEnsureLoginResult>;
|
|
1216
|
+
/**
|
|
1217
|
+
* Polls the stored pending login. A code, when given, must be that login's device code or the user code shown to the
|
|
1218
|
+
* person: a code from anywhere else (a prompt injection carrying a login someone else approved) is never exchanged, so
|
|
1219
|
+
* it can't swap the stored session for another account's.
|
|
1220
|
+
*/
|
|
1221
|
+
pollLogin(code?: string): Promise<AgentPollLoginResult>;
|
|
1222
|
+
whoami(): Promise<AgentSessionView>;
|
|
1223
|
+
getAccessToken(): Promise<string | null>;
|
|
1224
|
+
getPendingLoginState(): Promise<PendingAgentLogin$1 | null>;
|
|
1225
|
+
requireSession(): Promise<StoredAgentSession>;
|
|
1226
|
+
private loginInput;
|
|
1227
|
+
private pendingResult;
|
|
1228
|
+
private getValidSession;
|
|
1229
|
+
/**
|
|
1230
|
+
* Refreshes `seen` (the session the caller read), joining a refresh already in progress. `force` refreshes even a
|
|
1231
|
+
* session that isn't near expiry (Helios just answered 401 to it).
|
|
1232
|
+
*/
|
|
1233
|
+
private refreshStoredSession;
|
|
1234
|
+
private refreshOnce;
|
|
1235
|
+
private exchangePendingLogin;
|
|
1236
|
+
private exchangeOnce;
|
|
1237
|
+
private getPendingLogin;
|
|
1238
|
+
private clearPendingLoginIfMatches;
|
|
1239
|
+
}
|
|
1240
|
+
/**
|
|
1241
|
+
* After a 401 from Helios: refreshes the session and retries once with the new access token. If no refresh is possible,
|
|
1242
|
+
* or the retry is refused too, starts a fresh login and returns it. Rethrows anything else.
|
|
1243
|
+
*/
|
|
1244
|
+
declare function retryAfterUnauthorizedRefresh<T>(options: {
|
|
1245
|
+
authService: AgentAuthService;
|
|
1246
|
+
error: unknown;
|
|
1247
|
+
loginOptions: AgentEnsureLoginOptions;
|
|
1248
|
+
retry: (accessToken: string) => Promise<T>;
|
|
1249
|
+
}): Promise<T | AgentPendingLoginResult | null>;
|
|
1250
|
+
|
|
1251
|
+
interface HeliosAgentDataBridgeClientOptions {
|
|
1252
|
+
baseUrl: string;
|
|
1253
|
+
fetch?: FetchLike;
|
|
1254
|
+
}
|
|
1255
|
+
declare class HeliosAgentDataBridgeClient {
|
|
1256
|
+
private readonly baseUrl;
|
|
1257
|
+
private readonly fetchImpl;
|
|
1258
|
+
constructor(options: HeliosAgentDataBridgeClientOptions);
|
|
1259
|
+
getWalletState(accessToken: string): Promise<WalletState>;
|
|
1260
|
+
getOpenPositions(accessToken: string): Promise<OpenPositionsSnapshot>;
|
|
1261
|
+
getPortfolio(accessToken: string, input: PortfolioInput): Promise<PortfolioSnapshot>;
|
|
1262
|
+
getLedgerFills(accessToken: string, input?: LedgerFillsInput): Promise<LedgerFillsPage>;
|
|
1263
|
+
getLedgerSummary(accessToken: string, input?: LedgerSummaryInput): Promise<LedgerSummary>;
|
|
1264
|
+
getMarketSnapshot(accessToken: string, input?: MarketSnapshotInput): Promise<MarketSnapshot>;
|
|
1265
|
+
getMarketSnapshotChunk(accessToken: string, input?: MarketSnapshotChunkInput): Promise<MarketSnapshotChunk>;
|
|
1266
|
+
getMarketSymbolDetail(accessToken: string, input: MarketSymbolDetailInput): Promise<MarketSymbolDetail>;
|
|
1267
|
+
/** The lean market table: price, two returns, volume, funding, open interest, setup label and the smart money lean. */
|
|
1268
|
+
getAgentMarket(accessToken: string, input?: AgentMarketInput): Promise<AgentMarket>;
|
|
1269
|
+
getMarketCandles(accessToken: string, input: MarketCandlesInput): Promise<MarketCandles>;
|
|
1270
|
+
/** The research wallets' smart money board (conviction, discount, flows or pile-ins). */
|
|
1271
|
+
getSmartMoneyBoard(accessToken: string, input?: SmartMoneyBoardInput): Promise<SmartMoneyBoard>;
|
|
1272
|
+
/** Their trades by nickname: the latest, or only what came after an earlier call's `next`. */
|
|
1273
|
+
getSmartMoneyMoves(accessToken: string, input?: SmartMoneyMovesInput): Promise<SmartMoneyMoves>;
|
|
1274
|
+
/** One coin: their book, its market row and their latest trades on it. */
|
|
1275
|
+
getSmartMoneyCoin(accessToken: string, coin: string): Promise<SmartMoneyCoin>;
|
|
1276
|
+
submitTradeIntent(accessToken: string, input: SubmitTradeIntentInput): Promise<SubmitTradeIntentResult>;
|
|
1277
|
+
closePosition(accessToken: string, input: ClosePositionInput): Promise<ClosePositionResult>;
|
|
1278
|
+
setTpSl(accessToken: string, input: SetTpSlInput): Promise<SetTpSlResult>;
|
|
1279
|
+
deleteTpSl(accessToken: string, input: DeleteTpSlInput): Promise<DeleteTpSlResult>;
|
|
1280
|
+
getOpenOrders(accessToken: string): Promise<OpenOrder[]>;
|
|
1281
|
+
cancelOrder(accessToken: string, input: CancelOrderInput): Promise<CancelOrderResult>;
|
|
1282
|
+
modifyOrder(accessToken: string, input: ModifyOrderInput): Promise<ModifyOrderResult>;
|
|
1283
|
+
getPaperPortfolio(accessToken: string, accountId?: string): Promise<PaperPortfolio>;
|
|
1284
|
+
/** A paper market order; answers with its fills (none when nothing filled). */
|
|
1285
|
+
submitPaperIntent(accessToken: string, input: SubmitTradeIntentInput, accountId?: string): Promise<PaperFill[]>;
|
|
1286
|
+
/** Closes all or part of a paper position; no fills when there was none. */
|
|
1287
|
+
closePaperPosition(accessToken: string, input: ClosePositionInput, accountId?: string): Promise<PaperFill[]>;
|
|
1288
|
+
setPaperTpSl(accessToken: string, input: SetTpSlInput, accountId?: string): Promise<SetTpSlResult>;
|
|
1289
|
+
deletePaperTpSl(accessToken: string, input: DeleteTpSlInput, accountId?: string): Promise<DeleteTpSlResult>;
|
|
1290
|
+
getPaperLedgerFills(accessToken: string, input?: LedgerFillsInput, accountId?: string): Promise<LedgerFillsPage>;
|
|
1291
|
+
/** Starts the paper account over with `startingBalance` USD (data-bridge's default when omitted). */
|
|
1292
|
+
resetPaperAccount(accessToken: string, startingBalance?: number, accountId?: string): Promise<void>;
|
|
1293
|
+
private request;
|
|
1294
|
+
private buildProcedureUrl;
|
|
1295
|
+
private parseJson;
|
|
1296
|
+
/** The result of a mutation older data-bridges answer with nothing; null when there is none. */
|
|
1297
|
+
private tryUnwrapResult;
|
|
1298
|
+
private unwrapResult;
|
|
1299
|
+
private extractErrorCode;
|
|
1300
|
+
private extractErrorMessage;
|
|
1301
|
+
/**
|
|
1302
|
+
* Unwrap a tRPC error envelope, handling the superjson `{ json: ... }` wrapper
|
|
1303
|
+
* that the data-bridge applies via its transformer configuration.
|
|
1304
|
+
*/
|
|
1305
|
+
private unwrapTrpcError;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
669
1308
|
declare function getDefaultHeliosAgentMcpSessionPath(): string;
|
|
670
1309
|
declare const pendingAgentLoginSchema: z.ZodObject<{
|
|
671
1310
|
status: z.ZodLiteral<"pending">;
|
|
@@ -682,19 +1321,30 @@ declare const pendingAgentLoginSchema: z.ZodObject<{
|
|
|
682
1321
|
"orders:cancel": "orders:cancel";
|
|
683
1322
|
}>>;
|
|
684
1323
|
startedAt: z.ZodString;
|
|
1324
|
+
issuer: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1325
|
+
identityServiceUrl: z.ZodString;
|
|
1326
|
+
dataBridgeUrl: z.ZodString;
|
|
1327
|
+
}, z.core.$strip>>>;
|
|
685
1328
|
}, z.core.$strip>;
|
|
686
1329
|
type PendingAgentLogin = z.infer<typeof pendingAgentLoginSchema>;
|
|
687
|
-
interface AgentMcpSessionStore extends
|
|
1330
|
+
interface AgentMcpSessionStore extends AgentLoginStore {
|
|
688
1331
|
getActiveProvider(): Promise<Provider | null>;
|
|
689
1332
|
setActiveProvider(provider: Provider): Promise<void>;
|
|
690
1333
|
clearActiveProvider(): Promise<void>;
|
|
691
1334
|
getPendingLogin(): Promise<PendingAgentLogin | null>;
|
|
692
1335
|
setPendingLogin(pendingLogin: PendingAgentLogin): Promise<void>;
|
|
693
|
-
|
|
1336
|
+
}
|
|
1337
|
+
interface FileAgentSessionStoreOptions {
|
|
1338
|
+
/**
|
|
1339
|
+
* The hosts this server sends tokens to. Sessions and logins are stored with it and only read back for the same hosts,
|
|
1340
|
+
* so pointing the server at another Helios (a staging URL, an edited .mcp.json) never sends it the stored tokens.
|
|
1341
|
+
*/
|
|
1342
|
+
issuer?: AgentSessionIssuer | null;
|
|
694
1343
|
}
|
|
695
1344
|
declare class FileAgentSessionStore implements AgentMcpSessionStore {
|
|
696
1345
|
private readonly filePath;
|
|
697
|
-
|
|
1346
|
+
private readonly issuer;
|
|
1347
|
+
constructor(filePath?: string, options?: FileAgentSessionStoreOptions);
|
|
698
1348
|
getSession(): Promise<StoredAgentSession | null>;
|
|
699
1349
|
getPendingLogin(): Promise<PendingAgentLogin | null>;
|
|
700
1350
|
getActiveProvider(): Promise<Provider | null>;
|
|
@@ -704,9 +1354,14 @@ declare class FileAgentSessionStore implements AgentMcpSessionStore {
|
|
|
704
1354
|
clearSession(): Promise<void>;
|
|
705
1355
|
clearPendingLogin(): Promise<void>;
|
|
706
1356
|
clearActiveProvider(): Promise<void>;
|
|
1357
|
+
private isFromIssuer;
|
|
1358
|
+
/**
|
|
1359
|
+
* Read-modify-write under the file's lock: tool calls run concurrently and several MCP processes can share the file,
|
|
1360
|
+
* so without it one write could drop another's (a refreshed session, a pending login).
|
|
1361
|
+
*/
|
|
1362
|
+
private update;
|
|
707
1363
|
private readState;
|
|
708
1364
|
private writeState;
|
|
709
|
-
private writeStateOrDelete;
|
|
710
1365
|
private deleteFile;
|
|
711
1366
|
}
|
|
712
1367
|
/**
|
|
@@ -747,6 +1402,11 @@ declare class HeliosAgentMcpProviderService {
|
|
|
747
1402
|
resolveProvider(explicitProvider?: Provider): Promise<Provider>;
|
|
748
1403
|
}
|
|
749
1404
|
|
|
1405
|
+
type StartLoginResult = AgentStartLoginResult;
|
|
1406
|
+
type EnsureLoginResult = AgentEnsureLoginResult;
|
|
1407
|
+
type PendingLoginResult = AgentPendingLoginResult;
|
|
1408
|
+
type PollLoginResult = AgentPollLoginResult;
|
|
1409
|
+
type EnsureLoginOptions = AgentEnsureLoginOptions;
|
|
750
1410
|
interface HeliosAgentMcpAuthServiceOptions {
|
|
751
1411
|
client: HeliosAgentAuthClient;
|
|
752
1412
|
sessionStore: AgentMcpSessionStore;
|
|
@@ -759,73 +1419,10 @@ interface HeliosAgentMcpAuthServiceOptions {
|
|
|
759
1419
|
deviceLogin?: boolean;
|
|
760
1420
|
}
|
|
761
1421
|
declare const HOSTED_RECONNECT_MESSAGE = "Helios no longer accepts this connection (it expired or was revoked). Reconnect Helios in your AI app to continue.";
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
deviceCode: string;
|
|
765
|
-
userCode: string;
|
|
766
|
-
verificationUri: string;
|
|
767
|
-
verificationUriComplete: string;
|
|
768
|
-
expiresInSeconds: number;
|
|
769
|
-
pollIntervalSeconds: number;
|
|
770
|
-
requestedScope: AgentDeviceStartInput['scope'];
|
|
771
|
-
startedAt: string;
|
|
772
|
-
}
|
|
773
|
-
type EnsureLoginResult = (AgentSessionView & {
|
|
774
|
-
status: 'connected';
|
|
775
|
-
connected: true;
|
|
776
|
-
}) | (StartLoginResult & {
|
|
777
|
-
connected: false;
|
|
778
|
-
message: string;
|
|
779
|
-
});
|
|
780
|
-
type PendingLoginResult = StartLoginResult & {
|
|
781
|
-
connected: false;
|
|
782
|
-
message: string;
|
|
783
|
-
};
|
|
784
|
-
type PollLoginResult = (AgentSessionView & {
|
|
785
|
-
status: 'connected';
|
|
786
|
-
connected: true;
|
|
787
|
-
}) | {
|
|
788
|
-
status: 'pending' | 'rejected' | 'expired' | 'failed';
|
|
789
|
-
connected: false;
|
|
790
|
-
message: string;
|
|
791
|
-
};
|
|
792
|
-
interface EnsureLoginOptions {
|
|
793
|
-
clientName?: string;
|
|
794
|
-
scope?: AgentDeviceStartInput['scope'];
|
|
795
|
-
constraints?: AgentDeviceStartInput['constraints'];
|
|
796
|
-
}
|
|
797
|
-
declare class HeliosAgentMcpAuthService {
|
|
798
|
-
private readonly client;
|
|
799
|
-
private readonly sessionStore;
|
|
800
|
-
private readonly refreshWindowMs;
|
|
801
|
-
private readonly now;
|
|
802
|
-
private readonly deviceLogin;
|
|
1422
|
+
/** The shared delegated-agent sign-in (AgentAuthService), worded for MCP tools. */
|
|
1423
|
+
declare class HeliosAgentMcpAuthService extends AgentAuthService {
|
|
803
1424
|
constructor(options: HeliosAgentMcpAuthServiceOptions);
|
|
804
|
-
startLogin(input: AgentDeviceStartInput): Promise<StartLoginResult>;
|
|
805
|
-
resetSessionAndStartLogin(input: AgentDeviceStartInput): Promise<StartLoginResult>;
|
|
806
|
-
private startDeviceLogin;
|
|
807
|
-
private buildStartLoginResult;
|
|
808
|
-
startRelogin(options?: EnsureLoginOptions): Promise<PendingLoginResult>;
|
|
809
|
-
clearSessionState(): Promise<void>;
|
|
810
|
-
invalidateIfUnauthorized(error: unknown, options?: EnsureLoginOptions): Promise<PendingLoginResult | null>;
|
|
811
|
-
refreshSessionAfterUnauthorized(error: unknown): Promise<StoredAgentSession | null>;
|
|
812
|
-
ensureLogin(options?: EnsureLoginOptions): Promise<EnsureLoginResult>;
|
|
813
|
-
/** Polls the given login, or the stored pending one when no device code is given. */
|
|
814
|
-
pollLogin(deviceCode?: string): Promise<PollLoginResult>;
|
|
815
|
-
whoami(): Promise<AgentSessionView>;
|
|
816
|
-
getAccessToken(): Promise<string | null>;
|
|
817
|
-
requireSession(): Promise<StoredAgentSession>;
|
|
818
|
-
private getValidSession;
|
|
819
|
-
private refreshStoredSession;
|
|
820
|
-
private getPendingLogin;
|
|
821
|
-
private clearPendingLoginIfMatches;
|
|
822
1425
|
}
|
|
823
|
-
declare function retryAfterUnauthorizedRefresh<T>(options: {
|
|
824
|
-
authService: HeliosAgentMcpAuthService;
|
|
825
|
-
error: unknown;
|
|
826
|
-
loginOptions: EnsureLoginOptions;
|
|
827
|
-
retry: (accessToken: string) => Promise<T>;
|
|
828
|
-
}): Promise<T | PendingLoginResult | null>;
|
|
829
1426
|
declare function formatHeliosLoginPrompt(result: Pick<StartLoginResult, 'verificationUriComplete' | 'userCode' | 'requestedScope'>): string;
|
|
830
1427
|
|
|
831
1428
|
interface HeliosAgentMcpAccountServiceOptions {
|
|
@@ -895,6 +1492,18 @@ declare class HeliosAgentMcpDocsService {
|
|
|
895
1492
|
}
|
|
896
1493
|
declare function getDefaultHeliosAgentMcpDocsRoot(): string;
|
|
897
1494
|
|
|
1495
|
+
/** Helios's public gateway serves both identity (/api/agents) and data-bridge (/api/trpc). */
|
|
1496
|
+
declare const DEFAULT_HELIOS_BASE_URL = "https://helios.pgn.io";
|
|
1497
|
+
/** Sessions stored before the issuer was recorded could only have come from the public gateway. */
|
|
1498
|
+
declare const DEFAULT_HELIOS_SESSION_ISSUER: AgentSessionIssuer;
|
|
1499
|
+
/**
|
|
1500
|
+
* Checks a Helios base URL the local server sends the stored tokens to: https, or plain http to localhost only, so a
|
|
1501
|
+
* config can't send them in clear text or to a host by mistake. Returns the value unchanged.
|
|
1502
|
+
*/
|
|
1503
|
+
declare function assertHeliosBaseUrl(name: string, value: string): string;
|
|
1504
|
+
/** True when a stored session or login came from the hosts this server is configured for. */
|
|
1505
|
+
declare function isSameHeliosIssuer(stored: AgentSessionIssuer | null | undefined, configured: AgentSessionIssuer): boolean;
|
|
1506
|
+
|
|
898
1507
|
interface HeliosAgentMcpLedgerServiceOptions {
|
|
899
1508
|
authService: HeliosAgentMcpAuthService;
|
|
900
1509
|
dataBridgeClient: HeliosAgentDataBridgeClient;
|
|
@@ -1043,6 +1652,16 @@ declare class HeliosAgentMcpTradingService {
|
|
|
1043
1652
|
private submitIntent;
|
|
1044
1653
|
}
|
|
1045
1654
|
|
|
1655
|
+
/**
|
|
1656
|
+
* Which tools a server lists (Mario 2026-10-26, the lean MCP):
|
|
1657
|
+
* - lean: the 9 smart-money-first tools (reads, your trades, trade, protect, candles) with short text answers, for small models (Qwen 27B
|
|
1658
|
+
* at 32k) and most agents;
|
|
1659
|
+
* - signals: the reads of lean, with trade and protect on the practice account only, for agents that watch or practice;
|
|
1660
|
+
* - full: lean plus the depth reads (the ~50-column snapshot, symbol detail with raw indicators, fills, the
|
|
1661
|
+
* indicator docs), for strong models that do their own analysis.
|
|
1662
|
+
*/
|
|
1663
|
+
type McpProfile = 'lean' | 'signals' | 'full';
|
|
1664
|
+
declare const MCP_PROFILES: readonly McpProfile[];
|
|
1046
1665
|
interface CreateHeliosAgentMcpServerOptions {
|
|
1047
1666
|
identityServiceUrl: string;
|
|
1048
1667
|
dataBridgeUrl: string;
|
|
@@ -1056,7 +1675,10 @@ interface CreateHeliosAgentMcpServerOptions {
|
|
|
1056
1675
|
* left out (whoami stays) and no tool ever starts a login of its own.
|
|
1057
1676
|
*/
|
|
1058
1677
|
hosted?: boolean;
|
|
1678
|
+
/** Default full, which keeps every read tool; the CLI and the hosted /mcp pass lean. */
|
|
1679
|
+
profile?: McpProfile;
|
|
1059
1680
|
}
|
|
1681
|
+
declare const MAX_TOOL_INPUT_ELEMENTS = 10000;
|
|
1060
1682
|
declare function createHeliosAgentMcpServer(options: CreateHeliosAgentMcpServerOptions): Promise<{
|
|
1061
1683
|
server: McpServer;
|
|
1062
1684
|
authService: HeliosAgentMcpAuthService;
|
|
@@ -1142,11 +1764,15 @@ declare function createHeliosAuthToolDefinitions(service: HeliosAgentMcpAuthServ
|
|
|
1142
1764
|
"orders:cancel": "orders:cancel";
|
|
1143
1765
|
}>>;
|
|
1144
1766
|
constraints: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
1767
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
1768
|
+
requireApprovalProof: z.ZodOptional<z.ZodBoolean>;
|
|
1145
1769
|
}, z.core.$strip>;
|
|
1146
1770
|
execute(input: {
|
|
1147
1771
|
clientName: string;
|
|
1148
1772
|
scope: ("account:read" | "market:read" | "orders:write" | "orders:cancel")[];
|
|
1149
1773
|
constraints?: Record<string, unknown> | undefined;
|
|
1774
|
+
verified?: boolean | undefined;
|
|
1775
|
+
requireApprovalProof?: boolean | undefined;
|
|
1150
1776
|
}): Promise<{
|
|
1151
1777
|
content: {
|
|
1152
1778
|
type: "text";
|
|
@@ -1157,7 +1783,6 @@ declare function createHeliosAuthToolDefinitions(service: HeliosAgentMcpAuthServ
|
|
|
1157
1783
|
loginUrl: string;
|
|
1158
1784
|
nextStep: string;
|
|
1159
1785
|
status: "pending";
|
|
1160
|
-
deviceCode: string;
|
|
1161
1786
|
userCode: string;
|
|
1162
1787
|
verificationUri: string;
|
|
1163
1788
|
verificationUriComplete: string;
|
|
@@ -1202,7 +1827,6 @@ declare function createHeliosAuthToolDefinitions(service: HeliosAgentMcpAuthServ
|
|
|
1202
1827
|
actionRequired: true;
|
|
1203
1828
|
loginUrl: string;
|
|
1204
1829
|
nextStep: string;
|
|
1205
|
-
deviceCode: string;
|
|
1206
1830
|
userCode: string;
|
|
1207
1831
|
verificationUri: string;
|
|
1208
1832
|
verificationUriComplete: string;
|
|
@@ -1322,7 +1946,7 @@ declare function createHeliosAccountToolDefinitions(service: HeliosAgentMcpAccou
|
|
|
1322
1946
|
verificationUriComplete: string;
|
|
1323
1947
|
expiresInSeconds: number;
|
|
1324
1948
|
pollIntervalSeconds: number;
|
|
1325
|
-
requestedScope:
|
|
1949
|
+
requestedScope: ("account:read" | "market:read" | "orders:write" | "orders:cancel")[];
|
|
1326
1950
|
startedAt: string;
|
|
1327
1951
|
};
|
|
1328
1952
|
}>;
|
|
@@ -1359,7 +1983,7 @@ declare function createHeliosAccountToolDefinitions(service: HeliosAgentMcpAccou
|
|
|
1359
1983
|
verificationUriComplete: string;
|
|
1360
1984
|
expiresInSeconds: number;
|
|
1361
1985
|
pollIntervalSeconds: number;
|
|
1362
|
-
requestedScope:
|
|
1986
|
+
requestedScope: ("account:read" | "market:read" | "orders:write" | "orders:cancel")[];
|
|
1363
1987
|
startedAt: string;
|
|
1364
1988
|
};
|
|
1365
1989
|
}>;
|
|
@@ -1391,7 +2015,7 @@ declare function createHeliosLedgerToolDefinitions(service: HeliosAgentMcpLedger
|
|
|
1391
2015
|
verificationUriComplete: string;
|
|
1392
2016
|
expiresInSeconds: number;
|
|
1393
2017
|
pollIntervalSeconds: number;
|
|
1394
|
-
requestedScope:
|
|
2018
|
+
requestedScope: ("account:read" | "market:read" | "orders:write" | "orders:cancel")[];
|
|
1395
2019
|
startedAt: string;
|
|
1396
2020
|
};
|
|
1397
2021
|
}>;
|
|
@@ -1434,7 +2058,7 @@ declare function createHeliosLedgerToolDefinitions(service: HeliosAgentMcpLedger
|
|
|
1434
2058
|
verificationUriComplete: string;
|
|
1435
2059
|
expiresInSeconds: number;
|
|
1436
2060
|
pollIntervalSeconds: number;
|
|
1437
|
-
requestedScope:
|
|
2061
|
+
requestedScope: ("account:read" | "market:read" | "orders:write" | "orders:cancel")[];
|
|
1438
2062
|
startedAt: string;
|
|
1439
2063
|
};
|
|
1440
2064
|
}>;
|
|
@@ -1473,7 +2097,7 @@ declare function createHeliosLedgerToolDefinitions(service: HeliosAgentMcpLedger
|
|
|
1473
2097
|
verificationUriComplete: string;
|
|
1474
2098
|
expiresInSeconds: number;
|
|
1475
2099
|
pollIntervalSeconds: number;
|
|
1476
|
-
requestedScope:
|
|
2100
|
+
requestedScope: ("account:read" | "market:read" | "orders:write" | "orders:cancel")[];
|
|
1477
2101
|
startedAt: string;
|
|
1478
2102
|
};
|
|
1479
2103
|
}>;
|
|
@@ -1520,7 +2144,7 @@ declare function createHeliosMarketToolDefinitions(service: HeliosAgentMcpMarket
|
|
|
1520
2144
|
verificationUriComplete: string;
|
|
1521
2145
|
expiresInSeconds: number;
|
|
1522
2146
|
pollIntervalSeconds: number;
|
|
1523
|
-
requestedScope:
|
|
2147
|
+
requestedScope: ("account:read" | "market:read" | "orders:write" | "orders:cancel")[];
|
|
1524
2148
|
startedAt: string;
|
|
1525
2149
|
};
|
|
1526
2150
|
}>;
|
|
@@ -1570,7 +2194,7 @@ declare function createHeliosMarketToolDefinitions(service: HeliosAgentMcpMarket
|
|
|
1570
2194
|
verificationUriComplete: string;
|
|
1571
2195
|
expiresInSeconds: number;
|
|
1572
2196
|
pollIntervalSeconds: number;
|
|
1573
|
-
requestedScope:
|
|
2197
|
+
requestedScope: ("account:read" | "market:read" | "orders:write" | "orders:cancel")[];
|
|
1574
2198
|
startedAt: string;
|
|
1575
2199
|
};
|
|
1576
2200
|
}>;
|
|
@@ -1607,7 +2231,7 @@ declare function createHeliosMarketToolDefinitions(service: HeliosAgentMcpMarket
|
|
|
1607
2231
|
verificationUriComplete: string;
|
|
1608
2232
|
expiresInSeconds: number;
|
|
1609
2233
|
pollIntervalSeconds: number;
|
|
1610
|
-
requestedScope:
|
|
2234
|
+
requestedScope: ("account:read" | "market:read" | "orders:write" | "orders:cancel")[];
|
|
1611
2235
|
startedAt: string;
|
|
1612
2236
|
};
|
|
1613
2237
|
}>;
|
|
@@ -1673,6 +2297,7 @@ declare function createHeliosTradingToolDefinitions(service: HeliosAgentMcpTradi
|
|
|
1673
2297
|
}, z.core.$strip>>;
|
|
1674
2298
|
}, z.core.$strip>>;
|
|
1675
2299
|
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
2300
|
+
idempotencyWindowSeconds: z.ZodOptional<z.ZodNumber>;
|
|
1676
2301
|
}, z.core.$strip>;
|
|
1677
2302
|
execute(input: {
|
|
1678
2303
|
symbol: string;
|
|
@@ -1704,6 +2329,7 @@ declare function createHeliosTradingToolDefinitions(service: HeliosAgentMcpTradi
|
|
|
1704
2329
|
} | undefined;
|
|
1705
2330
|
} | undefined;
|
|
1706
2331
|
idempotencyKey?: string | undefined;
|
|
2332
|
+
idempotencyWindowSeconds?: number | undefined;
|
|
1707
2333
|
}): Promise<{
|
|
1708
2334
|
content: {
|
|
1709
2335
|
type: "text";
|
|
@@ -1726,7 +2352,7 @@ declare function createHeliosTradingToolDefinitions(service: HeliosAgentMcpTradi
|
|
|
1726
2352
|
verificationUriComplete: string;
|
|
1727
2353
|
expiresInSeconds: number;
|
|
1728
2354
|
pollIntervalSeconds: number;
|
|
1729
|
-
requestedScope:
|
|
2355
|
+
requestedScope: ("account:read" | "market:read" | "orders:write" | "orders:cancel")[];
|
|
1730
2356
|
startedAt: string;
|
|
1731
2357
|
};
|
|
1732
2358
|
}>;
|
|
@@ -1791,6 +2417,7 @@ declare function createHeliosTradingToolDefinitions(service: HeliosAgentMcpTradi
|
|
|
1791
2417
|
}, z.core.$strip>>;
|
|
1792
2418
|
}, z.core.$strip>>;
|
|
1793
2419
|
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
2420
|
+
idempotencyWindowSeconds: z.ZodOptional<z.ZodNumber>;
|
|
1794
2421
|
}, z.core.$strip>;
|
|
1795
2422
|
execute(input: {
|
|
1796
2423
|
symbol: string;
|
|
@@ -1822,6 +2449,7 @@ declare function createHeliosTradingToolDefinitions(service: HeliosAgentMcpTradi
|
|
|
1822
2449
|
} | undefined;
|
|
1823
2450
|
} | undefined;
|
|
1824
2451
|
idempotencyKey?: string | undefined;
|
|
2452
|
+
idempotencyWindowSeconds?: number | undefined;
|
|
1825
2453
|
}): Promise<{
|
|
1826
2454
|
content: {
|
|
1827
2455
|
type: "text";
|
|
@@ -1844,7 +2472,7 @@ declare function createHeliosTradingToolDefinitions(service: HeliosAgentMcpTradi
|
|
|
1844
2472
|
verificationUriComplete: string;
|
|
1845
2473
|
expiresInSeconds: number;
|
|
1846
2474
|
pollIntervalSeconds: number;
|
|
1847
|
-
requestedScope:
|
|
2475
|
+
requestedScope: ("account:read" | "market:read" | "orders:write" | "orders:cancel")[];
|
|
1848
2476
|
startedAt: string;
|
|
1849
2477
|
};
|
|
1850
2478
|
}>;
|
|
@@ -1909,6 +2537,7 @@ declare function createHeliosTradingToolDefinitions(service: HeliosAgentMcpTradi
|
|
|
1909
2537
|
}, z.core.$strip>>;
|
|
1910
2538
|
}, z.core.$strip>>;
|
|
1911
2539
|
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
2540
|
+
idempotencyWindowSeconds: z.ZodOptional<z.ZodNumber>;
|
|
1912
2541
|
}, z.core.$strip>;
|
|
1913
2542
|
execute(input: {
|
|
1914
2543
|
symbol: string;
|
|
@@ -1940,6 +2569,7 @@ declare function createHeliosTradingToolDefinitions(service: HeliosAgentMcpTradi
|
|
|
1940
2569
|
} | undefined;
|
|
1941
2570
|
} | undefined;
|
|
1942
2571
|
idempotencyKey?: string | undefined;
|
|
2572
|
+
idempotencyWindowSeconds?: number | undefined;
|
|
1943
2573
|
}): Promise<{
|
|
1944
2574
|
content: {
|
|
1945
2575
|
type: "text";
|
|
@@ -1962,7 +2592,7 @@ declare function createHeliosTradingToolDefinitions(service: HeliosAgentMcpTradi
|
|
|
1962
2592
|
verificationUriComplete: string;
|
|
1963
2593
|
expiresInSeconds: number;
|
|
1964
2594
|
pollIntervalSeconds: number;
|
|
1965
|
-
requestedScope:
|
|
2595
|
+
requestedScope: ("account:read" | "market:read" | "orders:write" | "orders:cancel")[];
|
|
1966
2596
|
startedAt: string;
|
|
1967
2597
|
};
|
|
1968
2598
|
}>;
|
|
@@ -1976,11 +2606,13 @@ declare function createHeliosTradingToolDefinitions(service: HeliosAgentMcpTradi
|
|
|
1976
2606
|
}>>;
|
|
1977
2607
|
symbol: z.ZodString;
|
|
1978
2608
|
maxSlippageBps: z.ZodOptional<z.ZodNumber>;
|
|
2609
|
+
fraction: z.ZodOptional<z.ZodNumber>;
|
|
1979
2610
|
}, z.core.$strip>;
|
|
1980
2611
|
execute(input: {
|
|
1981
2612
|
symbol: string;
|
|
1982
2613
|
provider?: "hyperliquid" | undefined;
|
|
1983
2614
|
maxSlippageBps?: number | undefined;
|
|
2615
|
+
fraction?: number | undefined;
|
|
1984
2616
|
}): Promise<{
|
|
1985
2617
|
content: {
|
|
1986
2618
|
type: "text";
|
|
@@ -2003,7 +2635,7 @@ declare function createHeliosTradingToolDefinitions(service: HeliosAgentMcpTradi
|
|
|
2003
2635
|
verificationUriComplete: string;
|
|
2004
2636
|
expiresInSeconds: number;
|
|
2005
2637
|
pollIntervalSeconds: number;
|
|
2006
|
-
requestedScope:
|
|
2638
|
+
requestedScope: ("account:read" | "market:read" | "orders:write" | "orders:cancel")[];
|
|
2007
2639
|
startedAt: string;
|
|
2008
2640
|
};
|
|
2009
2641
|
}>;
|
|
@@ -2077,7 +2709,7 @@ declare function createHeliosTradingToolDefinitions(service: HeliosAgentMcpTradi
|
|
|
2077
2709
|
verificationUriComplete: string;
|
|
2078
2710
|
expiresInSeconds: number;
|
|
2079
2711
|
pollIntervalSeconds: number;
|
|
2080
|
-
requestedScope:
|
|
2712
|
+
requestedScope: ("account:read" | "market:read" | "orders:write" | "orders:cancel")[];
|
|
2081
2713
|
startedAt: string;
|
|
2082
2714
|
};
|
|
2083
2715
|
}>;
|
|
@@ -2118,7 +2750,7 @@ declare function createHeliosTradingToolDefinitions(service: HeliosAgentMcpTradi
|
|
|
2118
2750
|
verificationUriComplete: string;
|
|
2119
2751
|
expiresInSeconds: number;
|
|
2120
2752
|
pollIntervalSeconds: number;
|
|
2121
|
-
requestedScope:
|
|
2753
|
+
requestedScope: ("account:read" | "market:read" | "orders:write" | "orders:cancel")[];
|
|
2122
2754
|
startedAt: string;
|
|
2123
2755
|
};
|
|
2124
2756
|
}>;
|
|
@@ -2149,7 +2781,7 @@ declare function createHeliosTradingToolDefinitions(service: HeliosAgentMcpTradi
|
|
|
2149
2781
|
verificationUriComplete: string;
|
|
2150
2782
|
expiresInSeconds: number;
|
|
2151
2783
|
pollIntervalSeconds: number;
|
|
2152
|
-
requestedScope:
|
|
2784
|
+
requestedScope: ("account:read" | "market:read" | "orders:write" | "orders:cancel")[];
|
|
2153
2785
|
startedAt: string;
|
|
2154
2786
|
};
|
|
2155
2787
|
}>;
|
|
@@ -2186,10 +2818,276 @@ declare function createHeliosTradingToolDefinitions(service: HeliosAgentMcpTradi
|
|
|
2186
2818
|
verificationUriComplete: string;
|
|
2187
2819
|
expiresInSeconds: number;
|
|
2188
2820
|
pollIntervalSeconds: number;
|
|
2189
|
-
requestedScope:
|
|
2821
|
+
requestedScope: ("account:read" | "market:read" | "orders:write" | "orders:cancel")[];
|
|
2190
2822
|
startedAt: string;
|
|
2191
2823
|
};
|
|
2192
2824
|
}>;
|
|
2193
2825
|
}];
|
|
2194
2826
|
|
|
2195
|
-
|
|
2827
|
+
/**
|
|
2828
|
+
* Text for the lean tools: what a small model (Qwen 27B at 32k) reads, so every answer is short, line-oriented and the
|
|
2829
|
+
* same shape each time. The first line is the answer, then one line per row with `|` between fields, units on every
|
|
2830
|
+
* number, times as "minutes ago". Clients that read structured content also get the JSON these are rendered from.
|
|
2831
|
+
*/
|
|
2832
|
+
declare const usd: (v: number | null | undefined, signed?: boolean) => string;
|
|
2833
|
+
declare const pct: (v: number | null | undefined, places?: number) => string;
|
|
2834
|
+
/** A price with the digits that matter: 67,420 · 36.90 · 0.0001234. */
|
|
2835
|
+
declare const price: (v: number | null | undefined) => string;
|
|
2836
|
+
declare const ago: (t: number | null | undefined, now: number) => string;
|
|
2837
|
+
/** "Patient Sniper #4 (swing, 82% win)". */
|
|
2838
|
+
declare const trader: (m: Pick<SmMove, "nick" | "rank" | "style" | "win">) => string;
|
|
2839
|
+
/** "opened long HYPE $310k @ 36.95 5x" or "closed long SOL $150k +$11.8k (+7.9%)". */
|
|
2840
|
+
declare const moveText: (m: SmMove) => string;
|
|
2841
|
+
/** Where the mark sits against the bigger side's weighted entry: edge > 0 is better than their entry. */
|
|
2842
|
+
declare const entryText: (side: "long" | "short" | null, edgePct: number | null) => string | null;
|
|
2843
|
+
declare function renderMarket(m: AgentMarket, now?: number): string;
|
|
2844
|
+
declare function renderBoard(b: SmartMoneyBoard, now?: number): string;
|
|
2845
|
+
declare function renderMoves(m: SmartMoneyMoves, now?: number): string;
|
|
2846
|
+
interface CoinYou {
|
|
2847
|
+
position: PortfolioSnapshot['positions'][number] | null;
|
|
2848
|
+
availableBalance: number;
|
|
2849
|
+
}
|
|
2850
|
+
declare function renderCoin(c: SmartMoneyCoin, you: CoinYou | null, now?: number): string;
|
|
2851
|
+
/** Minimum order value on Hyperliquid (notional = margin x leverage). */
|
|
2852
|
+
declare const MIN_ORDER_USD = 10;
|
|
2853
|
+
/**
|
|
2854
|
+
* What it costs to trade the coin now: max leverage, spread, the slippage of a $10k and $100k market order (worse
|
|
2855
|
+
* side), USD resting within 1% (thinner side), and the next funding payment (Hyperliquid pays every hour on the hour).
|
|
2856
|
+
*/
|
|
2857
|
+
declare function tradingLine(mk: SmartMoneyCoin['market'] & object, now?: number): string;
|
|
2858
|
+
declare function renderAccount(p: PortfolioSnapshot, orders: OpenOrder[] | null, summary: LedgerSummary | null): string;
|
|
2859
|
+
/** "long 0.5 BTC @ 67,420 · mark 67,900 · open PnL +$240 · 10x · liquidation 61,200". */
|
|
2860
|
+
declare function positionLine(pos: PortfolioSnapshot['positions'][number]): string;
|
|
2861
|
+
/** The agent's own fills, newest first, with the window's totals on the first line. */
|
|
2862
|
+
declare function renderTrades(page: LedgerFillsPage, paper: boolean, coin: string | null, now?: number): string;
|
|
2863
|
+
declare function renderCandles(coin: string, interval: string, c: MarketCandles): string;
|
|
2864
|
+
|
|
2865
|
+
/**
|
|
2866
|
+
* The lean tool set (Mario 2026-10-26: "make our MCP incredibly high performance and valuable, even if it means
|
|
2867
|
+
* stripping away most of the indicators"): smart money first, flat parameters, short text answers a 27B model at 32k
|
|
2868
|
+
* reads reliably, and the full JSON as structured content for clients that read it. data-bridge serves the reads from
|
|
2869
|
+
* prebuilt views (services/agents/smartMoney.ts), so each call is a Redis read on the server.
|
|
2870
|
+
*/
|
|
2871
|
+
interface LeanToolResult {
|
|
2872
|
+
content: Array<{
|
|
2873
|
+
type: 'text';
|
|
2874
|
+
text: string;
|
|
2875
|
+
}>;
|
|
2876
|
+
structuredContent: Record<string, unknown>;
|
|
2877
|
+
}
|
|
2878
|
+
interface LeanToolDefinition<TInput> {
|
|
2879
|
+
name: string;
|
|
2880
|
+
title: string;
|
|
2881
|
+
description: string;
|
|
2882
|
+
inputSchema: z.ZodType<TInput>;
|
|
2883
|
+
/** Changes the account (MCP annotations: apps ask before running it). */
|
|
2884
|
+
acts?: boolean;
|
|
2885
|
+
execute(input: TInput): Promise<LeanToolResult>;
|
|
2886
|
+
}
|
|
2887
|
+
interface LeanServices {
|
|
2888
|
+
auth: HeliosAgentMcpAuthService;
|
|
2889
|
+
dataBridge: HeliosAgentDataBridgeClient;
|
|
2890
|
+
}
|
|
2891
|
+
declare const smBoardInputSchema: z.ZodObject<{
|
|
2892
|
+
view: z.ZodOptional<z.ZodEnum<{
|
|
2893
|
+
discount: "discount";
|
|
2894
|
+
conviction: "conviction";
|
|
2895
|
+
flows: "flows";
|
|
2896
|
+
pileins: "pileins";
|
|
2897
|
+
}>>;
|
|
2898
|
+
side: z.ZodOptional<z.ZodEnum<{
|
|
2899
|
+
long: "long";
|
|
2900
|
+
short: "short";
|
|
2901
|
+
any: "any";
|
|
2902
|
+
}>>;
|
|
2903
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
2904
|
+
}, z.core.$strip>;
|
|
2905
|
+
declare const smMovesInputSchema: z.ZodObject<{
|
|
2906
|
+
since: z.ZodOptional<z.ZodString>;
|
|
2907
|
+
coin: z.ZodOptional<z.ZodString>;
|
|
2908
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
2909
|
+
all: "all";
|
|
2910
|
+
entries: "entries";
|
|
2911
|
+
exits: "exits";
|
|
2912
|
+
}>>;
|
|
2913
|
+
min_usd: z.ZodOptional<z.ZodNumber>;
|
|
2914
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
2915
|
+
}, z.core.$strip>;
|
|
2916
|
+
declare const smCoinInputSchema: z.ZodObject<{
|
|
2917
|
+
coin: z.ZodString;
|
|
2918
|
+
}, z.core.$strip>;
|
|
2919
|
+
declare const marketInputSchema: z.ZodObject<{
|
|
2920
|
+
coins: z.ZodOptional<z.ZodString>;
|
|
2921
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
2922
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
2923
|
+
sort: z.ZodOptional<z.ZodEnum<{
|
|
2924
|
+
lean: "lean";
|
|
2925
|
+
rank: "rank";
|
|
2926
|
+
volume: "volume";
|
|
2927
|
+
move1h: "move1h";
|
|
2928
|
+
move24h: "move24h";
|
|
2929
|
+
funding: "funding";
|
|
2930
|
+
edge: "edge";
|
|
2931
|
+
}>>;
|
|
2932
|
+
filter: z.ZodOptional<z.ZodEnum<{
|
|
2933
|
+
discount: "discount";
|
|
2934
|
+
turning: "turning";
|
|
2935
|
+
falling: "falling";
|
|
2936
|
+
stretched_up: "stretched_up";
|
|
2937
|
+
stretched_down: "stretched_down";
|
|
2938
|
+
sm_long: "sm_long";
|
|
2939
|
+
sm_short: "sm_short";
|
|
2940
|
+
}>>;
|
|
2941
|
+
}, z.core.$strip>;
|
|
2942
|
+
declare const accountInputSchema: z.ZodObject<{
|
|
2943
|
+
paper: z.ZodOptional<z.ZodBoolean>;
|
|
2944
|
+
}, z.core.$strip>;
|
|
2945
|
+
declare const tradeInputSchema: z.ZodObject<{
|
|
2946
|
+
coin: z.ZodString;
|
|
2947
|
+
action: z.ZodEnum<{
|
|
2948
|
+
reverse: "reverse";
|
|
2949
|
+
open: "open";
|
|
2950
|
+
add: "add";
|
|
2951
|
+
close: "close";
|
|
2952
|
+
reset: "reset";
|
|
2953
|
+
}>;
|
|
2954
|
+
side: z.ZodOptional<z.ZodEnum<{
|
|
2955
|
+
long: "long";
|
|
2956
|
+
short: "short";
|
|
2957
|
+
}>>;
|
|
2958
|
+
margin_usd: z.ZodOptional<z.ZodNumber>;
|
|
2959
|
+
leverage: z.ZodOptional<z.ZodNumber>;
|
|
2960
|
+
sl_pct: z.ZodOptional<z.ZodNumber>;
|
|
2961
|
+
tp_pct: z.ZodOptional<z.ZodNumber>;
|
|
2962
|
+
limit_px: z.ZodOptional<z.ZodNumber>;
|
|
2963
|
+
slippage_bps: z.ZodOptional<z.ZodNumber>;
|
|
2964
|
+
fraction: z.ZodOptional<z.ZodNumber>;
|
|
2965
|
+
paper: z.ZodOptional<z.ZodBoolean>;
|
|
2966
|
+
key: z.ZodOptional<z.ZodString>;
|
|
2967
|
+
}, z.core.$strip>;
|
|
2968
|
+
/** How long after the first identical keyless trade call a repeat is still a retry of it (data-bridge holds the window). */
|
|
2969
|
+
declare const TRADE_KEY_WINDOW_SECONDS = 60;
|
|
2970
|
+
/**
|
|
2971
|
+
* The key for a trade call that brought none: a fingerprint of the account and the normalized order, sent with
|
|
2972
|
+
* idempotencyWindowSeconds. The data-bridge keeps the window in Redis, so an identical call within
|
|
2973
|
+
* TRADE_KEY_WINDOW_SECONDS of the first (a retry after a timeout or a lost reply, when the model never saw a key) names
|
|
2974
|
+
* the same order on every replica and after a restart, and is placed once. The window runs from the first call; after
|
|
2975
|
+
* it an identical call is a new order. A deliberate second identical order within the window needs its own `key`.
|
|
2976
|
+
*/
|
|
2977
|
+
declare function tradeKeyFor(input: z.infer<typeof tradeInputSchema>, account: string): string;
|
|
2978
|
+
declare const protectInputSchema: z.ZodObject<{
|
|
2979
|
+
coin: z.ZodString;
|
|
2980
|
+
op: z.ZodEnum<{
|
|
2981
|
+
set: "set";
|
|
2982
|
+
remove: "remove";
|
|
2983
|
+
cancel: "cancel";
|
|
2984
|
+
move: "move";
|
|
2985
|
+
}>;
|
|
2986
|
+
tp_px: z.ZodOptional<z.ZodNumber>;
|
|
2987
|
+
sl_px: z.ZodOptional<z.ZodNumber>;
|
|
2988
|
+
order_id: z.ZodOptional<z.ZodString>;
|
|
2989
|
+
px: z.ZodOptional<z.ZodNumber>;
|
|
2990
|
+
paper: z.ZodOptional<z.ZodBoolean>;
|
|
2991
|
+
}, z.core.$strip>;
|
|
2992
|
+
declare const tradesInputSchema: z.ZodObject<{
|
|
2993
|
+
window: z.ZodOptional<z.ZodEnum<{
|
|
2994
|
+
"24h": "24h";
|
|
2995
|
+
"7d": "7d";
|
|
2996
|
+
"30d": "30d";
|
|
2997
|
+
}>>;
|
|
2998
|
+
coin: z.ZodOptional<z.ZodString>;
|
|
2999
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
3000
|
+
paper: z.ZodOptional<z.ZodBoolean>;
|
|
3001
|
+
}, z.core.$strip>;
|
|
3002
|
+
declare const candlesInputSchema: z.ZodObject<{
|
|
3003
|
+
coin: z.ZodString;
|
|
3004
|
+
interval: z.ZodEnum<{
|
|
3005
|
+
"1m": "1m";
|
|
3006
|
+
"5m": "5m";
|
|
3007
|
+
"15m": "15m";
|
|
3008
|
+
"1h": "1h";
|
|
3009
|
+
"4h": "4h";
|
|
3010
|
+
"1d": "1d";
|
|
3011
|
+
}>;
|
|
3012
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
3013
|
+
}, z.core.$strip>;
|
|
3014
|
+
/**
|
|
3015
|
+
* Why a TP/SL would trigger the moment it is set, or null when both legs are on the right side of the mark: a long's
|
|
3016
|
+
* stop sits under the price and its take profit over it, a short's the other way round. Hyperliquid fires a trigger
|
|
3017
|
+
* that is already through the price at once, closing the position at market.
|
|
3018
|
+
*/
|
|
3019
|
+
declare function wrongSideTpSl(side: 'LONG' | 'SHORT', mark: number, tp?: number, sl?: number): string | null;
|
|
3020
|
+
declare function createLeanToolDefinitions(services: LeanServices): {
|
|
3021
|
+
smBoard: LeanToolDefinition<{
|
|
3022
|
+
view?: "discount" | "conviction" | "flows" | "pileins" | undefined;
|
|
3023
|
+
side?: "long" | "short" | "any" | undefined;
|
|
3024
|
+
limit?: number | undefined;
|
|
3025
|
+
}>;
|
|
3026
|
+
smMoves: LeanToolDefinition<{
|
|
3027
|
+
since?: string | undefined;
|
|
3028
|
+
coin?: string | undefined;
|
|
3029
|
+
kind?: "all" | "entries" | "exits" | undefined;
|
|
3030
|
+
min_usd?: number | undefined;
|
|
3031
|
+
limit?: number | undefined;
|
|
3032
|
+
}>;
|
|
3033
|
+
smCoin: LeanToolDefinition<{
|
|
3034
|
+
coin: string;
|
|
3035
|
+
}>;
|
|
3036
|
+
market: LeanToolDefinition<{
|
|
3037
|
+
coins?: string | undefined;
|
|
3038
|
+
limit?: number | undefined;
|
|
3039
|
+
offset?: number | undefined;
|
|
3040
|
+
sort?: "lean" | "rank" | "volume" | "move1h" | "move24h" | "funding" | "edge" | undefined;
|
|
3041
|
+
filter?: "discount" | "turning" | "falling" | "stretched_up" | "stretched_down" | "sm_long" | "sm_short" | undefined;
|
|
3042
|
+
}>;
|
|
3043
|
+
account: LeanToolDefinition<{
|
|
3044
|
+
paper?: boolean | undefined;
|
|
3045
|
+
}>;
|
|
3046
|
+
trade: LeanToolDefinition<{
|
|
3047
|
+
coin: string;
|
|
3048
|
+
action: "reverse" | "open" | "add" | "close" | "reset";
|
|
3049
|
+
side?: "long" | "short" | undefined;
|
|
3050
|
+
margin_usd?: number | undefined;
|
|
3051
|
+
leverage?: number | undefined;
|
|
3052
|
+
sl_pct?: number | undefined;
|
|
3053
|
+
tp_pct?: number | undefined;
|
|
3054
|
+
limit_px?: number | undefined;
|
|
3055
|
+
slippage_bps?: number | undefined;
|
|
3056
|
+
fraction?: number | undefined;
|
|
3057
|
+
paper?: boolean | undefined;
|
|
3058
|
+
key?: string | undefined;
|
|
3059
|
+
}>;
|
|
3060
|
+
protect: LeanToolDefinition<{
|
|
3061
|
+
coin: string;
|
|
3062
|
+
op: "set" | "remove" | "cancel" | "move";
|
|
3063
|
+
tp_px?: number | undefined;
|
|
3064
|
+
sl_px?: number | undefined;
|
|
3065
|
+
order_id?: string | undefined;
|
|
3066
|
+
px?: number | undefined;
|
|
3067
|
+
paper?: boolean | undefined;
|
|
3068
|
+
}>;
|
|
3069
|
+
trades: LeanToolDefinition<{
|
|
3070
|
+
window?: "24h" | "7d" | "30d" | undefined;
|
|
3071
|
+
coin?: string | undefined;
|
|
3072
|
+
limit?: number | undefined;
|
|
3073
|
+
paper?: boolean | undefined;
|
|
3074
|
+
}>;
|
|
3075
|
+
candles: LeanToolDefinition<{
|
|
3076
|
+
coin: string;
|
|
3077
|
+
interval: "1m" | "5m" | "15m" | "1h" | "4h" | "1d";
|
|
3078
|
+
limit?: number | undefined;
|
|
3079
|
+
}>;
|
|
3080
|
+
};
|
|
3081
|
+
type LeanTools = ReturnType<typeof createLeanToolDefinitions>;
|
|
3082
|
+
/** The tool sets per profile, in the order they are listed (smart money first, so it is what a model reaches for). */
|
|
3083
|
+
/**
|
|
3084
|
+
* A write tool for Watch only links (Mario 2026-11-08: they may paper trade): the same tool on the practice account
|
|
3085
|
+
* only, whatever `paper` says. data-bridge holds the same line (paper.ts paperWriter): a watch-only token may change
|
|
3086
|
+
* the agent practice account and nothing else.
|
|
3087
|
+
*/
|
|
3088
|
+
declare function practiceOnly<T extends {
|
|
3089
|
+
paper?: boolean;
|
|
3090
|
+
}>(tool: LeanToolDefinition<T>): LeanToolDefinition<T>;
|
|
3091
|
+
declare function leanToolsFor(tools: LeanTools, profile: 'lean' | 'signals' | 'full'): LeanToolDefinition<never>[];
|
|
3092
|
+
|
|
3093
|
+
export { type ActiveProviderView, type AgentMcpSessionStore, type CancelOrderToolResult, type ClosePositionToolResult, type CoinYou, type CreateHeliosAgentMcpServerOptions, DEFAULT_HELIOS_BASE_URL, DEFAULT_HELIOS_SESSION_ISSUER, DEFAULT_SNAPSHOT_FIELDS, DEFAULT_SNAPSHOT_TOP, type DeleteTpSlToolResult, type EnsureLoginOptions, type EnsureLoginResult, FileAgentSessionStore, type FileAgentSessionStoreOptions, type GetHeliosAgentMcpDocumentInput, HOSTED_RECONNECT_MESSAGE, HeliosAgentMcpAccountService, type HeliosAgentMcpAccountServiceOptions, HeliosAgentMcpAuthService, type HeliosAgentMcpAuthServiceOptions, type HeliosAgentMcpDocsIndex, type HeliosAgentMcpDocsIndexEntry, HeliosAgentMcpDocsService, type HeliosAgentMcpDocsServiceOptions, type HeliosAgentMcpDocument, HeliosAgentMcpLedgerService, type HeliosAgentMcpLedgerServiceOptions, HeliosAgentMcpMarketService, type HeliosAgentMcpMarketServiceOptions, HeliosAgentMcpProviderService, type HeliosAgentMcpProviderServiceOptions, HeliosAgentMcpTradingService, type HeliosAgentMcpTradingServiceOptions, type HeliosMcpToolDefinition, type HeliosMcpToolResult, type LeanServices, type LeanToolDefinition, type LeanToolResult, type LeanTools, type LedgerFillsResult, type LedgerSummaryResult, MAX_TOOL_INPUT_ELEMENTS, MCP_PROFILES, MIN_ORDER_USD, type MarketSnapshotChunkResult, type MarketSnapshotResult, type MarketSymbolDetailResult, type McpProfile, MemoryAgentMcpSessionStore, type OpenOrdersToolResult, type OpenPositionsResult, type PendingAgentLogin, type PendingLoginResult, type PollLoginResult, type PortfolioResult, type SetTpSlToolResult, type StartLoginResult, TRADE_KEY_WINDOW_SECONDS, type TradeIntentAction, type TradeIntentActionInput, type TradeIntentActionResult, type WalletStateResult, accountInputSchema, ago, assertHeliosBaseUrl, candlesInputSchema, compactSymbolDetail, createHeliosAccountToolDefinitions, createHeliosAgentMcpServer, createHeliosAuthToolDefinitions, createHeliosDocsToolDefinitions, createHeliosLedgerToolDefinitions, createHeliosMarketToolDefinitions, createHeliosProviderToolDefinitions, createHeliosTradingToolDefinitions, createLeanToolDefinitions, entryText, formatHeliosLoginPrompt, getDefaultHeliosAgentMcpDocsRoot, getDefaultHeliosAgentMcpSessionPath, isSameHeliosIssuer, leanToolsFor, marketInputSchema, moveText, pct, pendingAgentLoginSchema, positionLine, practiceOnly, price, protectInputSchema, renderAccount, renderBoard, renderCandles, renderCoin, renderMarket, renderMoves, renderTrades, retryAfterUnauthorizedRefresh, smBoardInputSchema, smCoinInputSchema, smMovesInputSchema, toolAnnotations, topOfSnapshot, tradeInputSchema, tradeKeyFor, trader, tradesInputSchema, tradingLine, usd, withDataText, withSnapshotDefaults, wrongSideTpSl };
|