@elizaos/plugin-vincent 2.0.3-beta.5 → 2.0.3-beta.7
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/dist/TradingProfileCard.d.ts +8 -0
- package/dist/TradingProfileCard.d.ts.map +1 -0
- package/dist/TradingProfileCard.js +70 -0
- package/dist/TradingProfileCard.js.map +1 -0
- package/dist/TradingStrategyPanel.d.ts +10 -0
- package/dist/TradingStrategyPanel.d.ts.map +1 -0
- package/dist/TradingStrategyPanel.js +133 -0
- package/dist/TradingStrategyPanel.js.map +1 -0
- package/dist/VincentAppView.d.ts +4 -0
- package/dist/VincentAppView.d.ts.map +1 -0
- package/dist/VincentAppView.helpers.d.ts +10 -0
- package/dist/VincentAppView.helpers.d.ts.map +1 -0
- package/dist/VincentAppView.helpers.js +21 -0
- package/dist/VincentAppView.helpers.js.map +1 -0
- package/dist/VincentAppView.interact.d.ts +2 -0
- package/dist/VincentAppView.interact.d.ts.map +1 -0
- package/dist/VincentAppView.interact.js +45 -0
- package/dist/VincentAppView.interact.js.map +1 -0
- package/dist/VincentAppView.js +145 -0
- package/dist/VincentAppView.js.map +1 -0
- package/dist/VincentConnectionCard.d.ts +9 -0
- package/dist/VincentConnectionCard.d.ts.map +1 -0
- package/dist/VincentConnectionCard.js +121 -0
- package/dist/VincentConnectionCard.js.map +1 -0
- package/dist/VincentView.d.ts +13 -0
- package/dist/VincentView.d.ts.map +1 -0
- package/dist/VincentView.js +86 -0
- package/dist/VincentView.js.map +1 -0
- package/dist/WalletStatusCard.d.ts +12 -0
- package/dist/WalletStatusCard.d.ts.map +1 -0
- package/dist/WalletStatusCard.js +203 -0
- package/dist/WalletStatusCard.js.map +1 -0
- package/dist/client.d.ts +21 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +31 -0
- package/dist/client.js.map +1 -0
- package/dist/components/VincentSpatialView.d.ts +32 -0
- package/dist/components/VincentSpatialView.d.ts.map +1 -0
- package/dist/components/VincentSpatialView.js +191 -0
- package/dist/components/VincentSpatialView.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +14 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +98 -0
- package/dist/plugin.js.map +1 -0
- package/dist/register-routes.d.ts +2 -0
- package/dist/register-routes.d.ts.map +1 -0
- package/dist/register-routes.js +6 -0
- package/dist/register-routes.js.map +1 -0
- package/dist/register-terminal-view.d.ts +15 -0
- package/dist/register-terminal-view.d.ts.map +1 -0
- package/dist/register-terminal-view.js +28 -0
- package/dist/register-terminal-view.js.map +1 -0
- package/dist/register.d.ts +2 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +6 -0
- package/dist/register.js.map +1 -0
- package/dist/routes.d.ts +24 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +429 -0
- package/dist/routes.js.map +1 -0
- package/dist/ui.d.ts +11 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +16 -0
- package/dist/ui.js.map +1 -0
- package/dist/useVincentDashboard.d.ts +21 -0
- package/dist/useVincentDashboard.d.ts.map +1 -0
- package/dist/useVincentDashboard.js +105 -0
- package/dist/useVincentDashboard.js.map +1 -0
- package/dist/useVincentState.d.ts +15 -0
- package/dist/useVincentState.d.ts.map +1 -0
- package/dist/useVincentState.js +116 -0
- package/dist/useVincentState.js.map +1 -0
- package/dist/views/bundle.js +500 -0
- package/dist/views/bundle.js.map +1 -0
- package/dist/vincent-app.d.ts +10 -0
- package/dist/vincent-app.d.ts.map +1 -0
- package/dist/vincent-app.js +16 -0
- package/dist/vincent-app.js.map +1 -0
- package/dist/vincent-contracts.d.ts +52 -0
- package/dist/vincent-contracts.d.ts.map +1 -0
- package/dist/vincent-contracts.js +8 -0
- package/dist/vincent-contracts.js.map +1 -0
- package/dist/vincent-view-bundle.d.ts +3 -0
- package/dist/vincent-view-bundle.d.ts.map +1 -0
- package/dist/vincent-view-bundle.js +7 -0
- package/dist/vincent-view-bundle.js.map +1 -0
- package/package.json +7 -7
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
Card,
|
|
5
|
+
Divider,
|
|
6
|
+
HStack,
|
|
7
|
+
List,
|
|
8
|
+
Text,
|
|
9
|
+
VStack
|
|
10
|
+
} from "@elizaos/ui/spatial";
|
|
11
|
+
function shortAddress(address) {
|
|
12
|
+
if (!address) return "not set";
|
|
13
|
+
if (address.length <= 14) return address;
|
|
14
|
+
return `${address.slice(0, 6)}..${address.slice(-4)}`;
|
|
15
|
+
}
|
|
16
|
+
function strategyTone(strategy) {
|
|
17
|
+
if (!strategy) return "muted";
|
|
18
|
+
if (strategy.running) return "success";
|
|
19
|
+
return "warning";
|
|
20
|
+
}
|
|
21
|
+
function pnlTone(totalPnl) {
|
|
22
|
+
const value = Number.parseFloat(totalPnl);
|
|
23
|
+
if (!Number.isFinite(value) || value === 0) return "muted";
|
|
24
|
+
return value > 0 ? "success" : "danger";
|
|
25
|
+
}
|
|
26
|
+
function formatPnl(totalPnl) {
|
|
27
|
+
const value = Number.parseFloat(totalPnl);
|
|
28
|
+
if (!Number.isFinite(value)) return totalPnl;
|
|
29
|
+
const sign = value > 0 ? "+" : "";
|
|
30
|
+
return `${sign}${totalPnl}`;
|
|
31
|
+
}
|
|
32
|
+
function formatWinRate(winRate) {
|
|
33
|
+
if (!Number.isFinite(winRate)) return "--";
|
|
34
|
+
return `${Math.round(winRate * 100)}%`;
|
|
35
|
+
}
|
|
36
|
+
function VincentSpatialView({
|
|
37
|
+
snapshot,
|
|
38
|
+
onAction
|
|
39
|
+
}) {
|
|
40
|
+
const dispatch = (action) => () => onAction?.(action);
|
|
41
|
+
const {
|
|
42
|
+
vincentConnected,
|
|
43
|
+
walletAddresses,
|
|
44
|
+
strategy,
|
|
45
|
+
tradingProfile,
|
|
46
|
+
loading,
|
|
47
|
+
error
|
|
48
|
+
} = snapshot;
|
|
49
|
+
return /* @__PURE__ */ jsxs(Card, { gap: 1, padding: 1, children: [
|
|
50
|
+
/* @__PURE__ */ jsxs(HStack, { gap: 1, align: "center", children: [
|
|
51
|
+
/* @__PURE__ */ jsx(
|
|
52
|
+
Text,
|
|
53
|
+
{
|
|
54
|
+
style: "caption",
|
|
55
|
+
tone: vincentConnected ? "success" : "muted",
|
|
56
|
+
grow: 1,
|
|
57
|
+
children: vincentConnected ? "connected" : "disconnected"
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
/* @__PURE__ */ jsx(Text, { style: "caption", tone: "muted", children: loading ? "loading" : "trading" })
|
|
61
|
+
] }),
|
|
62
|
+
error ? /* @__PURE__ */ jsx(Text, { tone: "danger", style: "caption", children: error }) : null,
|
|
63
|
+
/* @__PURE__ */ jsx(Divider, { label: "access" }),
|
|
64
|
+
vincentConnected ? /* @__PURE__ */ jsxs(List, { gap: 0, children: [
|
|
65
|
+
/* @__PURE__ */ jsxs(HStack, { gap: 1, align: "center", agent: "wallet-evm", children: [
|
|
66
|
+
/* @__PURE__ */ jsx(Text, { style: "caption", tone: "muted", width: 8, children: "evm" }),
|
|
67
|
+
/* @__PURE__ */ jsx(Text, { grow: 1, wrap: false, children: shortAddress(walletAddresses?.evmAddress ?? null) }),
|
|
68
|
+
walletAddresses?.evmAddress ? /* @__PURE__ */ jsx(
|
|
69
|
+
Button,
|
|
70
|
+
{
|
|
71
|
+
variant: "ghost",
|
|
72
|
+
tone: "default",
|
|
73
|
+
agent: "copy-evm",
|
|
74
|
+
onPress: dispatch("copy-evm"),
|
|
75
|
+
children: "Copy"
|
|
76
|
+
}
|
|
77
|
+
) : null
|
|
78
|
+
] }),
|
|
79
|
+
/* @__PURE__ */ jsxs(HStack, { gap: 1, align: "center", agent: "wallet-solana", children: [
|
|
80
|
+
/* @__PURE__ */ jsx(Text, { style: "caption", tone: "muted", width: 8, children: "sol" }),
|
|
81
|
+
/* @__PURE__ */ jsx(Text, { grow: 1, wrap: false, children: shortAddress(walletAddresses?.solanaAddress ?? null) }),
|
|
82
|
+
walletAddresses?.solanaAddress ? /* @__PURE__ */ jsx(
|
|
83
|
+
Button,
|
|
84
|
+
{
|
|
85
|
+
variant: "ghost",
|
|
86
|
+
tone: "default",
|
|
87
|
+
agent: "copy-solana",
|
|
88
|
+
onPress: dispatch("copy-solana"),
|
|
89
|
+
children: "Copy"
|
|
90
|
+
}
|
|
91
|
+
) : null
|
|
92
|
+
] })
|
|
93
|
+
] }) : /* @__PURE__ */ jsx(Text, { tone: "muted", style: "caption", children: "Connect Vincent to trade on Hyperliquid and Polymarket." }),
|
|
94
|
+
/* @__PURE__ */ jsxs(HStack, { gap: 1, wrap: true, children: [
|
|
95
|
+
vincentConnected ? /* @__PURE__ */ jsx(
|
|
96
|
+
Button,
|
|
97
|
+
{
|
|
98
|
+
variant: "outline",
|
|
99
|
+
tone: "danger",
|
|
100
|
+
grow: 1,
|
|
101
|
+
agent: "disconnect",
|
|
102
|
+
onPress: dispatch("disconnect"),
|
|
103
|
+
children: "Disconnect"
|
|
104
|
+
}
|
|
105
|
+
) : /* @__PURE__ */ jsx(Button, { grow: 1, agent: "connect", onPress: dispatch("connect"), children: "Connect" }),
|
|
106
|
+
/* @__PURE__ */ jsx(
|
|
107
|
+
Button,
|
|
108
|
+
{
|
|
109
|
+
variant: "ghost",
|
|
110
|
+
tone: "default",
|
|
111
|
+
agent: "refresh",
|
|
112
|
+
onPress: dispatch("refresh"),
|
|
113
|
+
children: "Refresh"
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
] }),
|
|
117
|
+
/* @__PURE__ */ jsx(Divider, { label: "strategy" }),
|
|
118
|
+
strategy ? /* @__PURE__ */ jsxs(VStack, { gap: 0, children: [
|
|
119
|
+
/* @__PURE__ */ jsxs(HStack, { gap: 1, align: "center", children: [
|
|
120
|
+
/* @__PURE__ */ jsx(Text, { bold: true, grow: 1, wrap: false, children: strategy.name }),
|
|
121
|
+
/* @__PURE__ */ jsx(Text, { style: "caption", tone: strategyTone(strategy), children: strategy.running ? "running" : "idle" })
|
|
122
|
+
] }),
|
|
123
|
+
/* @__PURE__ */ jsxs(HStack, { gap: 1, align: "center", children: [
|
|
124
|
+
/* @__PURE__ */ jsx(Text, { style: "caption", tone: "muted", grow: 1, wrap: false, children: strategy.venues.join(", ") || "no venues" }),
|
|
125
|
+
/* @__PURE__ */ jsx(Text, { style: "caption", tone: strategy.dryRun ? "warning" : "muted", children: strategy.dryRun ? "dry-run" : "live" })
|
|
126
|
+
] }),
|
|
127
|
+
/* @__PURE__ */ jsxs(Text, { style: "caption", tone: "muted", children: [
|
|
128
|
+
"interval ",
|
|
129
|
+
strategy.intervalSeconds,
|
|
130
|
+
"s"
|
|
131
|
+
] }),
|
|
132
|
+
tradingProfile ? /* @__PURE__ */ jsxs(List, { gap: 0, children: [
|
|
133
|
+
/* @__PURE__ */ jsxs(HStack, { gap: 1, align: "center", children: [
|
|
134
|
+
/* @__PURE__ */ jsx(Text, { style: "caption", tone: "muted", grow: 1, children: "pnl" }),
|
|
135
|
+
/* @__PURE__ */ jsx(
|
|
136
|
+
Text,
|
|
137
|
+
{
|
|
138
|
+
style: "caption",
|
|
139
|
+
tone: pnlTone(tradingProfile.totalPnl),
|
|
140
|
+
bold: true,
|
|
141
|
+
children: formatPnl(tradingProfile.totalPnl)
|
|
142
|
+
}
|
|
143
|
+
)
|
|
144
|
+
] }),
|
|
145
|
+
/* @__PURE__ */ jsxs(HStack, { gap: 1, align: "center", children: [
|
|
146
|
+
/* @__PURE__ */ jsx(Text, { style: "caption", tone: "muted", grow: 1, children: "win rate" }),
|
|
147
|
+
/* @__PURE__ */ jsx(Text, { style: "caption", children: formatWinRate(tradingProfile.winRate) })
|
|
148
|
+
] }),
|
|
149
|
+
/* @__PURE__ */ jsxs(HStack, { gap: 1, align: "center", children: [
|
|
150
|
+
/* @__PURE__ */ jsx(Text, { style: "caption", tone: "muted", grow: 1, children: "swaps / vol24h" }),
|
|
151
|
+
/* @__PURE__ */ jsxs(Text, { style: "caption", children: [
|
|
152
|
+
tradingProfile.totalSwaps,
|
|
153
|
+
" / ",
|
|
154
|
+
tradingProfile.volume24h
|
|
155
|
+
] })
|
|
156
|
+
] }),
|
|
157
|
+
tradingProfile.tokenBreakdown.length > 0 ? /* @__PURE__ */ jsx(List, { gap: 0, children: tradingProfile.tokenBreakdown.slice(0, 6).map((token) => /* @__PURE__ */ jsxs(
|
|
158
|
+
HStack,
|
|
159
|
+
{
|
|
160
|
+
gap: 1,
|
|
161
|
+
align: "center",
|
|
162
|
+
agent: `token-${token.symbol}`,
|
|
163
|
+
children: [
|
|
164
|
+
/* @__PURE__ */ jsx(Text, { bold: true, width: 10, wrap: false, children: token.symbol }),
|
|
165
|
+
/* @__PURE__ */ jsx(Text, { grow: 1, tone: pnlTone(token.pnl), wrap: false, children: formatPnl(token.pnl) }),
|
|
166
|
+
/* @__PURE__ */ jsxs(Text, { style: "caption", tone: "muted", children: [
|
|
167
|
+
token.swaps,
|
|
168
|
+
" swaps"
|
|
169
|
+
] })
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
token.symbol
|
|
173
|
+
)) }) : null
|
|
174
|
+
] }) : /* @__PURE__ */ jsx(Text, { tone: "muted", style: "caption", children: "No P&L" }),
|
|
175
|
+
/* @__PURE__ */ jsx(HStack, { gap: 1, wrap: true, children: /* @__PURE__ */ jsx(
|
|
176
|
+
Button,
|
|
177
|
+
{
|
|
178
|
+
variant: "outline",
|
|
179
|
+
tone: "default",
|
|
180
|
+
agent: "open-vincent",
|
|
181
|
+
onPress: dispatch("open-vincent"),
|
|
182
|
+
children: "Open Vincent"
|
|
183
|
+
}
|
|
184
|
+
) })
|
|
185
|
+
] }) : /* @__PURE__ */ jsx(Text, { tone: "muted", align: "center", style: "caption", children: "None" })
|
|
186
|
+
] });
|
|
187
|
+
}
|
|
188
|
+
export {
|
|
189
|
+
VincentSpatialView
|
|
190
|
+
};
|
|
191
|
+
//# sourceMappingURL=VincentSpatialView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/VincentSpatialView.tsx"],"sourcesContent":["/**\n * VincentSpatialView - the Vincent trading dashboard authored once with the\n * spatial vocabulary, so it renders correctly wherever it is displayed:\n *\n * - GUI / XR - mounted in `<SpatialSurface>` (DOM; XR scales up).\n * - TUI - rendered to real terminal lines by the agent terminal, via\n * `registerSpatialTerminalView` (see `register-terminal-view.tsx`).\n *\n * It is purely presentational (a snapshot + an action callback in, primitives\n * out) and imports only the cross-modality primitives plus type-only views of\n * the wallet and Vincent contracts, so it is safe to render in the Node agent\n * process where the terminal lives (no client/Capacitor runtime import).\n */\n\nimport type { WalletAddresses, WalletBalancesResponse } from \"@elizaos/shared\";\nimport {\n Button,\n Card,\n Divider,\n HStack,\n List,\n type SpatialTone,\n Text,\n VStack,\n} from \"@elizaos/ui/spatial\";\nimport type {\n VincentStrategy,\n VincentTradingProfile,\n} from \"../vincent-contracts.js\";\n\nexport interface VincentSnapshot {\n vincentConnected: boolean;\n vincentConnectedAt: number | null;\n walletAddresses: WalletAddresses | null;\n walletBalances: WalletBalancesResponse | null;\n strategy: VincentStrategy | null;\n tradingProfile: VincentTradingProfile | null;\n loading?: boolean;\n error?: string | null;\n}\n\nfunction shortAddress(address: string | null): string {\n if (!address) return \"not set\";\n if (address.length <= 14) return address;\n return `${address.slice(0, 6)}..${address.slice(-4)}`;\n}\n\nfunction strategyTone(strategy: VincentStrategy | null): SpatialTone {\n if (!strategy) return \"muted\";\n if (strategy.running) return \"success\";\n return \"warning\";\n}\n\nfunction pnlTone(totalPnl: string): SpatialTone {\n const value = Number.parseFloat(totalPnl);\n if (!Number.isFinite(value) || value === 0) return \"muted\";\n return value > 0 ? \"success\" : \"danger\";\n}\n\nfunction formatPnl(totalPnl: string): string {\n const value = Number.parseFloat(totalPnl);\n if (!Number.isFinite(value)) return totalPnl;\n const sign = value > 0 ? \"+\" : \"\";\n return `${sign}${totalPnl}`;\n}\n\nfunction formatWinRate(winRate: number): string {\n if (!Number.isFinite(winRate)) return \"--\";\n return `${Math.round(winRate * 100)}%`;\n}\n\nexport interface VincentSpatialViewProps {\n snapshot: VincentSnapshot;\n /** Dispatch by agent id: `connect`, `disconnect`, `refresh`, `start`, `stop`. */\n onAction?: (action: string) => void;\n}\n\nexport function VincentSpatialView({\n snapshot,\n onAction,\n}: VincentSpatialViewProps) {\n const dispatch = (action: string) => () => onAction?.(action);\n const {\n vincentConnected,\n walletAddresses,\n strategy,\n tradingProfile,\n loading,\n error,\n } = snapshot;\n\n return (\n <Card gap={1} padding={1}>\n <HStack gap={1} align=\"center\">\n <Text\n style=\"caption\"\n tone={vincentConnected ? \"success\" : \"muted\"}\n grow={1}\n >\n {vincentConnected ? \"connected\" : \"disconnected\"}\n </Text>\n <Text style=\"caption\" tone=\"muted\">\n {loading ? \"loading\" : \"trading\"}\n </Text>\n </HStack>\n\n {error ? (\n <Text tone=\"danger\" style=\"caption\">\n {error}\n </Text>\n ) : null}\n\n <Divider label=\"access\" />\n {vincentConnected ? (\n <List gap={0}>\n <HStack gap={1} align=\"center\" agent=\"wallet-evm\">\n <Text style=\"caption\" tone=\"muted\" width={8}>\n evm\n </Text>\n <Text grow={1} wrap={false}>\n {shortAddress(walletAddresses?.evmAddress ?? null)}\n </Text>\n {walletAddresses?.evmAddress ? (\n <Button\n variant=\"ghost\"\n tone=\"default\"\n agent=\"copy-evm\"\n onPress={dispatch(\"copy-evm\")}\n >\n Copy\n </Button>\n ) : null}\n </HStack>\n <HStack gap={1} align=\"center\" agent=\"wallet-solana\">\n <Text style=\"caption\" tone=\"muted\" width={8}>\n sol\n </Text>\n <Text grow={1} wrap={false}>\n {shortAddress(walletAddresses?.solanaAddress ?? null)}\n </Text>\n {walletAddresses?.solanaAddress ? (\n <Button\n variant=\"ghost\"\n tone=\"default\"\n agent=\"copy-solana\"\n onPress={dispatch(\"copy-solana\")}\n >\n Copy\n </Button>\n ) : null}\n </HStack>\n </List>\n ) : (\n <Text tone=\"muted\" style=\"caption\">\n Connect Vincent to trade on Hyperliquid and Polymarket.\n </Text>\n )}\n <HStack gap={1} wrap>\n {vincentConnected ? (\n <Button\n variant=\"outline\"\n tone=\"danger\"\n grow={1}\n agent=\"disconnect\"\n onPress={dispatch(\"disconnect\")}\n >\n Disconnect\n </Button>\n ) : (\n <Button grow={1} agent=\"connect\" onPress={dispatch(\"connect\")}>\n Connect\n </Button>\n )}\n <Button\n variant=\"ghost\"\n tone=\"default\"\n agent=\"refresh\"\n onPress={dispatch(\"refresh\")}\n >\n Refresh\n </Button>\n </HStack>\n\n <Divider label=\"strategy\" />\n {strategy ? (\n <VStack gap={0}>\n <HStack gap={1} align=\"center\">\n <Text bold grow={1} wrap={false}>\n {strategy.name}\n </Text>\n <Text style=\"caption\" tone={strategyTone(strategy)}>\n {strategy.running ? \"running\" : \"idle\"}\n </Text>\n </HStack>\n <HStack gap={1} align=\"center\">\n <Text style=\"caption\" tone=\"muted\" grow={1} wrap={false}>\n {strategy.venues.join(\", \") || \"no venues\"}\n </Text>\n <Text style=\"caption\" tone={strategy.dryRun ? \"warning\" : \"muted\"}>\n {strategy.dryRun ? \"dry-run\" : \"live\"}\n </Text>\n </HStack>\n <Text style=\"caption\" tone=\"muted\">\n interval {strategy.intervalSeconds}s\n </Text>\n {tradingProfile ? (\n <List gap={0}>\n <HStack gap={1} align=\"center\">\n <Text style=\"caption\" tone=\"muted\" grow={1}>\n pnl\n </Text>\n <Text\n style=\"caption\"\n tone={pnlTone(tradingProfile.totalPnl)}\n bold\n >\n {formatPnl(tradingProfile.totalPnl)}\n </Text>\n </HStack>\n <HStack gap={1} align=\"center\">\n <Text style=\"caption\" tone=\"muted\" grow={1}>\n win rate\n </Text>\n <Text style=\"caption\">\n {formatWinRate(tradingProfile.winRate)}\n </Text>\n </HStack>\n <HStack gap={1} align=\"center\">\n <Text style=\"caption\" tone=\"muted\" grow={1}>\n swaps / vol24h\n </Text>\n <Text style=\"caption\">\n {tradingProfile.totalSwaps} / {tradingProfile.volume24h}\n </Text>\n </HStack>\n {tradingProfile.tokenBreakdown.length > 0 ? (\n <List gap={0}>\n {tradingProfile.tokenBreakdown.slice(0, 6).map((token) => (\n <HStack\n key={token.symbol}\n gap={1}\n align=\"center\"\n agent={`token-${token.symbol}`}\n >\n <Text bold width={10} wrap={false}>\n {token.symbol}\n </Text>\n <Text grow={1} tone={pnlTone(token.pnl)} wrap={false}>\n {formatPnl(token.pnl)}\n </Text>\n <Text style=\"caption\" tone=\"muted\">\n {token.swaps} swaps\n </Text>\n </HStack>\n ))}\n </List>\n ) : null}\n </List>\n ) : (\n <Text tone=\"muted\" style=\"caption\">\n No P&L\n </Text>\n )}\n <HStack gap={1} wrap>\n <Button\n variant=\"outline\"\n tone=\"default\"\n agent=\"open-vincent\"\n onPress={dispatch(\"open-vincent\")}\n >\n Open Vincent\n </Button>\n </HStack>\n </VStack>\n ) : (\n <Text tone=\"muted\" align=\"center\" style=\"caption\">\n None\n </Text>\n )}\n </Card>\n );\n}\n"],"mappings":"AA6FM,SACE,KADF;AA9EN;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AAiBP,SAAS,aAAa,SAAgC;AACpD,MAAI,CAAC,QAAS,QAAO;AACrB,MAAI,QAAQ,UAAU,GAAI,QAAO;AACjC,SAAO,GAAG,QAAQ,MAAM,GAAG,CAAC,CAAC,KAAK,QAAQ,MAAM,EAAE,CAAC;AACrD;AAEA,SAAS,aAAa,UAA+C;AACnE,MAAI,CAAC,SAAU,QAAO;AACtB,MAAI,SAAS,QAAS,QAAO;AAC7B,SAAO;AACT;AAEA,SAAS,QAAQ,UAA+B;AAC9C,QAAM,QAAQ,OAAO,WAAW,QAAQ;AACxC,MAAI,CAAC,OAAO,SAAS,KAAK,KAAK,UAAU,EAAG,QAAO;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AAM,GAAG,CAAC,EAAE,IAAI,CAAC,UAC9C;AAAA,UAAC;AAAA;AAAA,YAEC,KAAK;AAAA,YACL,OAAM;AAAA,YACN,OAAO,SAAS,MAAM,MAAM;AAAA,YAE5B;AAAA,kCAAC,QAAK,MAAI,MAAC,OAAO,IAAI,MAAM,OACzB,gBAAM,QACT;AAAA,cACA,oBAAC,QAAK,MAAM,GAAG,MAAM,QAAQ,MAAM,GAAG,GAAG,MAAM,OAC5C,oBAAU,MAAM,GAAG,GACtB;AAAA,cACA,qBAAC,QAAK,OAAM,WAAU,MAAK,SACxB;AAAA,sBAAM;AAAA,gBAAM;AAAA,iBACf;AAAA;AAAA;AAAA,UAbK,MAAM;AAAA,QAcb,CACD,GACH,IACE;AAAA,SACN,IAEA,oBAAC,QAAK,MAAK,SAAQ,OAAM,WAAU,oBAEnC;AAAA,MAEF,oBAAC,UAAO,KAAK,GAAG,MAAI,MAClB;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,OAAM;AAAA,UACN,SAAS,SAAS,cAAc;AAAA,UACjC;AAAA;AAAA,MAED,GACF;AAAA,OACF,IAEA,oBAAC,QAAK,MAAK,SAAQ,OAAM,UAAS,OAAM,WAAU,kBAElD;AAAA,KAEJ;AAEJ;","names":[]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from "./client";
|
|
2
|
+
export { vincentPlugin } from "./plugin";
|
|
3
|
+
export * from "./register";
|
|
4
|
+
export * from "./routes";
|
|
5
|
+
export * from "./TradingProfileCard";
|
|
6
|
+
export * from "./TradingStrategyPanel";
|
|
7
|
+
export * from "./useVincentDashboard";
|
|
8
|
+
export * from "./useVincentState";
|
|
9
|
+
export * from "./VincentAppView";
|
|
10
|
+
export * from "./VincentAppView.helpers";
|
|
11
|
+
export * from "./VincentConnectionCard";
|
|
12
|
+
export { VincentView } from "./VincentView";
|
|
13
|
+
export { VINCENT_APP_NAME, vincentApp } from "./vincent-app";
|
|
14
|
+
export * from "./WalletStatusCard";
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC7D,cAAc,oBAAoB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from "./client.js";
|
|
2
|
+
import { vincentPlugin } from "./plugin.js";
|
|
3
|
+
export * from "./register.js";
|
|
4
|
+
export * from "./routes.js";
|
|
5
|
+
export * from "./TradingProfileCard.js";
|
|
6
|
+
export * from "./TradingStrategyPanel.js";
|
|
7
|
+
export * from "./useVincentDashboard.js";
|
|
8
|
+
export * from "./useVincentState.js";
|
|
9
|
+
export * from "./VincentAppView.js";
|
|
10
|
+
export * from "./VincentAppView.helpers";
|
|
11
|
+
export * from "./VincentConnectionCard.js";
|
|
12
|
+
import { VincentView } from "./VincentView.js";
|
|
13
|
+
import { VINCENT_APP_NAME, vincentApp } from "./vincent-app.js";
|
|
14
|
+
export * from "./WalletStatusCard.js";
|
|
15
|
+
export {
|
|
16
|
+
VINCENT_APP_NAME,
|
|
17
|
+
VincentView,
|
|
18
|
+
vincentApp,
|
|
19
|
+
vincentPlugin
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from \"./client.js\";\nexport { vincentPlugin } from \"./plugin.js\";\nexport * from \"./register.js\";\nexport * from \"./routes.js\";\nexport * from \"./TradingProfileCard.js\";\nexport * from \"./TradingStrategyPanel.js\";\nexport * from \"./useVincentDashboard.js\";\nexport * from \"./useVincentState.js\";\nexport * from \"./VincentAppView.js\";\nexport * from \"./VincentAppView.helpers\";\nexport * from \"./VincentConnectionCard.js\";\nexport { VincentView } from \"./VincentView.js\";\nexport { VINCENT_APP_NAME, vincentApp } from \"./vincent-app.js\";\nexport * from \"./WalletStatusCard.js\";\n"],"mappings":"AAAA,cAAc;AACd,SAAS,qBAAqB;AAC9B,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB,kBAAkB;AAC7C,cAAc;","names":[]}
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vincent plugin — registers all Vincent OAuth and dashboard routes
|
|
3
|
+
* with the elizaOS runtime plugin route system.
|
|
4
|
+
*
|
|
5
|
+
* All routes use `rawPath: true` so `/api/vincent/*` and `/callback/vincent`
|
|
6
|
+
* paths are preserved without a plugin-name prefix.
|
|
7
|
+
*
|
|
8
|
+
* The runtime route bridge hands us the raw request/response objects, so the
|
|
9
|
+
* adapter below narrows them to the HTTP stream types expected by the route
|
|
10
|
+
* handler.
|
|
11
|
+
*/
|
|
12
|
+
import type { Plugin } from "@elizaos/core";
|
|
13
|
+
export declare const vincentPlugin: Plugin;
|
|
14
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAsC,MAAM,eAAe,CAAC;AAyFhF,eAAO,MAAM,aAAa,EAAE,MAyB3B,CAAC"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { loadElizaConfig } from "@elizaos/agent/config/config";
|
|
2
|
+
import { handleVincentRoute } from "./routes.js";
|
|
3
|
+
function toHttpIncomingMessage(req) {
|
|
4
|
+
if (typeof req !== "object" || req === null || typeof req.method !== "string" || typeof req.headers !== "object") {
|
|
5
|
+
throw new TypeError("Vincent routes require a Node HTTP request");
|
|
6
|
+
}
|
|
7
|
+
return req;
|
|
8
|
+
}
|
|
9
|
+
function toHttpServerResponse(res) {
|
|
10
|
+
if (typeof res !== "object" || res === null || typeof res.end !== "function" || typeof res.setHeader !== "function") {
|
|
11
|
+
throw new TypeError("Vincent routes require a Node HTTP response");
|
|
12
|
+
}
|
|
13
|
+
return res;
|
|
14
|
+
}
|
|
15
|
+
function vincentRouteHandler(pathname) {
|
|
16
|
+
return async (req, res, _runtime) => {
|
|
17
|
+
const httpReq = toHttpIncomingMessage(req);
|
|
18
|
+
const httpRes = toHttpServerResponse(res);
|
|
19
|
+
const method = (httpReq.method ?? "GET").toUpperCase();
|
|
20
|
+
const config = loadElizaConfig();
|
|
21
|
+
await handleVincentRoute(httpReq, httpRes, pathname, method, { config });
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const vincentRoutes = [
|
|
25
|
+
{
|
|
26
|
+
type: "POST",
|
|
27
|
+
path: "/api/vincent/start-login",
|
|
28
|
+
rawPath: true,
|
|
29
|
+
handler: vincentRouteHandler("/api/vincent/start-login")
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
type: "GET",
|
|
33
|
+
path: "/callback/vincent",
|
|
34
|
+
rawPath: true,
|
|
35
|
+
public: true,
|
|
36
|
+
name: "vincent-oauth-callback",
|
|
37
|
+
handler: vincentRouteHandler("/callback/vincent")
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: "GET",
|
|
41
|
+
path: "/api/vincent/status",
|
|
42
|
+
rawPath: true,
|
|
43
|
+
handler: vincentRouteHandler("/api/vincent/status")
|
|
44
|
+
},
|
|
45
|
+
// POST /api/vincent/disconnect
|
|
46
|
+
{
|
|
47
|
+
type: "POST",
|
|
48
|
+
path: "/api/vincent/disconnect",
|
|
49
|
+
rawPath: true,
|
|
50
|
+
handler: vincentRouteHandler("/api/vincent/disconnect")
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
type: "GET",
|
|
54
|
+
path: "/api/vincent/trading-profile",
|
|
55
|
+
rawPath: true,
|
|
56
|
+
handler: vincentRouteHandler("/api/vincent/trading-profile")
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
type: "GET",
|
|
60
|
+
path: "/api/vincent/strategy",
|
|
61
|
+
rawPath: true,
|
|
62
|
+
handler: vincentRouteHandler("/api/vincent/strategy")
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: "POST",
|
|
66
|
+
path: "/api/vincent/strategy",
|
|
67
|
+
rawPath: true,
|
|
68
|
+
handler: vincentRouteHandler("/api/vincent/strategy")
|
|
69
|
+
}
|
|
70
|
+
];
|
|
71
|
+
const vincentPlugin = {
|
|
72
|
+
name: "@elizaos/plugin-vincent",
|
|
73
|
+
description: "Vincent OAuth and Hyperliquid/Polymarket trading dashboard routes",
|
|
74
|
+
routes: vincentRoutes,
|
|
75
|
+
views: [
|
|
76
|
+
// ONE declaration → GUI + XR + TUI, all drawn from the single VincentView
|
|
77
|
+
// spatial source. `modalities` is a plain literal here (plugin.ts is not in
|
|
78
|
+
// the view bundle), so no brand-new `@elizaos/core` runtime export reaches
|
|
79
|
+
// the bundle build.
|
|
80
|
+
{
|
|
81
|
+
id: "vincent",
|
|
82
|
+
label: "Vincent",
|
|
83
|
+
description: "Vincent trading dashboard \u2014 Hyperliquid/Polymarket strategy and wallet overview",
|
|
84
|
+
icon: "Zap",
|
|
85
|
+
path: "/vincent",
|
|
86
|
+
modalities: ["gui", "xr", "tui"],
|
|
87
|
+
bundlePath: "dist/views/bundle.js",
|
|
88
|
+
componentExport: "VincentView",
|
|
89
|
+
tags: ["trading", "vincent", "strategy"],
|
|
90
|
+
visibleInManager: true,
|
|
91
|
+
desktopTabEnabled: true
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
};
|
|
95
|
+
export {
|
|
96
|
+
vincentPlugin
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugin.ts"],"sourcesContent":["/**\n * Vincent plugin — registers all Vincent OAuth and dashboard routes\n * with the elizaOS runtime plugin route system.\n *\n * All routes use `rawPath: true` so `/api/vincent/*` and `/callback/vincent`\n * paths are preserved without a plugin-name prefix.\n *\n * The runtime route bridge hands us the raw request/response objects, so the\n * adapter below narrows them to the HTTP stream types expected by the route\n * handler.\n */\n\nimport type http from \"node:http\";\nimport { loadElizaConfig } from \"@elizaos/agent/config/config\";\nimport type { Plugin, Route, RouteRequest, RouteResponse } from \"@elizaos/core\";\nimport { handleVincentRoute } from \"./routes.js\";\n\nfunction toHttpIncomingMessage(req: RouteRequest): http.IncomingMessage {\n if (\n typeof req !== \"object\" ||\n req === null ||\n typeof req.method !== \"string\" ||\n typeof req.headers !== \"object\"\n ) {\n throw new TypeError(\"Vincent routes require a Node HTTP request\");\n }\n return req as unknown as http.IncomingMessage;\n}\n\nfunction toHttpServerResponse(res: RouteResponse): http.ServerResponse {\n if (\n typeof res !== \"object\" ||\n res === null ||\n typeof res.end !== \"function\" ||\n typeof res.setHeader !== \"function\"\n ) {\n throw new TypeError(\"Vincent routes require a Node HTTP response\");\n }\n return res as unknown as http.ServerResponse;\n}\n\nfunction vincentRouteHandler(pathname: string): NonNullable<Route[\"handler\"]> {\n return async (req, res, _runtime) => {\n const httpReq = toHttpIncomingMessage(req);\n const httpRes = toHttpServerResponse(res);\n const method = (httpReq.method ?? \"GET\").toUpperCase();\n const config = loadElizaConfig();\n await handleVincentRoute(httpReq, httpRes, pathname, method, { config });\n };\n}\n\nconst vincentRoutes: Route[] = [\n {\n type: \"POST\",\n path: \"/api/vincent/start-login\",\n rawPath: true,\n handler: vincentRouteHandler(\"/api/vincent/start-login\"),\n },\n {\n type: \"GET\",\n path: \"/callback/vincent\",\n rawPath: true,\n public: true,\n name: \"vincent-oauth-callback\",\n handler: vincentRouteHandler(\"/callback/vincent\"),\n },\n {\n type: \"GET\",\n path: \"/api/vincent/status\",\n rawPath: true,\n handler: vincentRouteHandler(\"/api/vincent/status\"),\n },\n // POST /api/vincent/disconnect\n {\n type: \"POST\",\n path: \"/api/vincent/disconnect\",\n rawPath: true,\n handler: vincentRouteHandler(\"/api/vincent/disconnect\"),\n },\n {\n type: \"GET\",\n path: \"/api/vincent/trading-profile\",\n rawPath: true,\n handler: vincentRouteHandler(\"/api/vincent/trading-profile\"),\n },\n {\n type: \"GET\",\n path: \"/api/vincent/strategy\",\n rawPath: true,\n handler: vincentRouteHandler(\"/api/vincent/strategy\"),\n },\n {\n type: \"POST\",\n path: \"/api/vincent/strategy\",\n rawPath: true,\n handler: vincentRouteHandler(\"/api/vincent/strategy\"),\n },\n];\n\n// ---------------------------------------------------------------------------\n// Plugin export\n// ---------------------------------------------------------------------------\n\nexport const vincentPlugin: Plugin = {\n name: \"@elizaos/plugin-vincent\",\n description:\n \"Vincent OAuth and Hyperliquid/Polymarket trading dashboard routes\",\n routes: vincentRoutes,\n views: [\n // ONE declaration → GUI + XR + TUI, all drawn from the single VincentView\n // spatial source. `modalities` is a plain literal here (plugin.ts is not in\n // the view bundle), so no brand-new `@elizaos/core` runtime export reaches\n // the bundle build.\n {\n id: \"vincent\",\n label: \"Vincent\",\n description:\n \"Vincent trading dashboard — Hyperliquid/Polymarket strategy and wallet overview\",\n icon: \"Zap\",\n path: \"/vincent\",\n modalities: [\"gui\", \"xr\", \"tui\"],\n bundlePath: \"dist/views/bundle.js\",\n componentExport: \"VincentView\",\n tags: [\"trading\", \"vincent\", \"strategy\"],\n visibleInManager: true,\n desktopTabEnabled: true,\n },\n ],\n};\n"],"mappings":"AAaA,SAAS,uBAAuB;AAEhC,SAAS,0BAA0B;AAEnC,SAAS,sBAAsB,KAAyC;AACtE,MACE,OAAO,QAAQ,YACf,QAAQ,QACR,OAAO,IAAI,WAAW,YACtB,OAAO,IAAI,YAAY,UACvB;AACA,UAAM,IAAI,UAAU,4CAA4C;AAAA,EAClE;AACA,SAAO;AACT;AAEA,SAAS,qBAAqB,KAAyC;AACrE,MACE,OAAO,QAAQ,YACf,QAAQ,QACR,OAAO,IAAI,QAAQ,cACnB,OAAO,IAAI,cAAc,YACzB;AACA,UAAM,IAAI,UAAU,6CAA6C;AAAA,EACnE;AACA,SAAO;AACT;AAEA,SAAS,oBAAoB,UAAiD;AAC5E,SAAO,OAAO,KAAK,KAAK,aAAa;AACnC,UAAM,UAAU,sBAAsB,GAAG;AACzC,UAAM,UAAU,qBAAqB,GAAG;AACxC,UAAM,UAAU,QAAQ,UAAU,OAAO,YAAY;AACrD,UAAM,SAAS,gBAAgB;AAC/B,UAAM,mBAAmB,SAAS,SAAS,UAAU,QAAQ,EAAE,OAAO,CAAC;AAAA,EACzE;AACF;AAEA,MAAM,gBAAyB;AAAA,EAC7B;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS,oBAAoB,0BAA0B;AAAA,EACzD;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,SAAS,oBAAoB,mBAAmB;AAAA,EAClD;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS,oBAAoB,qBAAqB;AAAA,EACpD;AAAA;AAAA,EAEA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS,oBAAoB,yBAAyB;AAAA,EACxD;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS,oBAAoB,8BAA8B;AAAA,EAC7D;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS,oBAAoB,uBAAuB;AAAA,EACtD;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS,oBAAoB,uBAAuB;AAAA,EACtD;AACF;AAMO,MAAM,gBAAwB;AAAA,EACnC,MAAM;AAAA,EACN,aACE;AAAA,EACF,QAAQ;AAAA,EACR,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKL;AAAA,MACE,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,aACE;AAAA,MACF,MAAM;AAAA,MACN,MAAM;AAAA,MACN,YAAY,CAAC,OAAO,MAAM,KAAK;AAAA,MAC/B,YAAY;AAAA,MACZ,iBAAiB;AAAA,MACjB,MAAM,CAAC,WAAW,WAAW,UAAU;AAAA,MACvC,kBAAkB;AAAA,MAClB,mBAAmB;AAAA,IACrB;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-routes.d.ts","sourceRoot":"","sources":["../src/register-routes.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/register-routes.ts"],"sourcesContent":["import { registerAppRoutePluginLoader } from \"@elizaos/core\";\n\nregisterAppRoutePluginLoader(\"@elizaos/plugin-vincent\", async () => {\n const { vincentPlugin } = await import(\"./plugin.js\");\n return vincentPlugin;\n});\n"],"mappings":"AAAA,SAAS,oCAAoC;AAE7C,6BAA6B,2BAA2B,YAAY;AAClE,QAAM,EAAE,cAAc,IAAI,MAAM,OAAO,aAAa;AACpD,SAAO;AACT,CAAC;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Register the Vincent view for terminal rendering.
|
|
3
|
+
*
|
|
4
|
+
* The agent terminal mounts plugin views by id from the `@elizaos/tui` terminal
|
|
5
|
+
* registry. This makes Vincent's `viewType: "tui"` declaration render for real
|
|
6
|
+
* in the terminal (the unified {@link VincentSpatialView}) rather than only
|
|
7
|
+
* navigating a GUI shell. A module-level snapshot lets a host push live trading
|
|
8
|
+
* data; on a fresh agent it defaults to the disconnected dashboard.
|
|
9
|
+
*/
|
|
10
|
+
import { type VincentSnapshot } from "./components/VincentSpatialView.tsx";
|
|
11
|
+
/** Update the snapshot the registered terminal view renders from. */
|
|
12
|
+
export declare function setVincentTerminalSnapshot(next: VincentSnapshot): void;
|
|
13
|
+
/** Register the Vincent terminal view; returns an unregister function. */
|
|
14
|
+
export declare function registerVincentTerminalView(): () => void;
|
|
15
|
+
//# sourceMappingURL=register-terminal-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-terminal-view.d.ts","sourceRoot":"","sources":["../src/register-terminal-view.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EACL,KAAK,eAAe,EAErB,MAAM,qCAAqC,CAAC;AAY7C,qEAAqE;AACrE,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,CAEtE;AAED,0EAA0E;AAC1E,wBAAgB,2BAA2B,IAAI,MAAM,IAAI,CAIxD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { registerSpatialTerminalView } from "@elizaos/ui/spatial/tui";
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
import {
|
|
4
|
+
VincentSpatialView
|
|
5
|
+
} from "./components/VincentSpatialView.js";
|
|
6
|
+
const EMPTY = {
|
|
7
|
+
vincentConnected: false,
|
|
8
|
+
vincentConnectedAt: null,
|
|
9
|
+
walletAddresses: null,
|
|
10
|
+
walletBalances: null,
|
|
11
|
+
strategy: null,
|
|
12
|
+
tradingProfile: null
|
|
13
|
+
};
|
|
14
|
+
let current = EMPTY;
|
|
15
|
+
function setVincentTerminalSnapshot(next) {
|
|
16
|
+
current = next;
|
|
17
|
+
}
|
|
18
|
+
function registerVincentTerminalView() {
|
|
19
|
+
return registerSpatialTerminalView(
|
|
20
|
+
"vincent",
|
|
21
|
+
() => createElement(VincentSpatialView, { snapshot: current })
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
registerVincentTerminalView,
|
|
26
|
+
setVincentTerminalSnapshot
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=register-terminal-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/register-terminal-view.tsx"],"sourcesContent":["/**\n * Register the Vincent view for terminal rendering.\n *\n * The agent terminal mounts plugin views by id from the `@elizaos/tui` terminal\n * registry. This makes Vincent's `viewType: \"tui\"` declaration render for real\n * in the terminal (the unified {@link VincentSpatialView}) rather than only\n * navigating a GUI shell. A module-level snapshot lets a host push live trading\n * data; on a fresh agent it defaults to the disconnected dashboard.\n */\n\nimport { registerSpatialTerminalView } from \"@elizaos/ui/spatial/tui\";\nimport { createElement } from \"react\";\nimport {\n type VincentSnapshot,\n VincentSpatialView,\n} from \"./components/VincentSpatialView.js\";\n\nconst EMPTY: VincentSnapshot = {\n vincentConnected: false,\n vincentConnectedAt: null,\n walletAddresses: null,\n walletBalances: null,\n strategy: null,\n tradingProfile: null,\n};\nlet current: VincentSnapshot = EMPTY;\n\n/** Update the snapshot the registered terminal view renders from. */\nexport function setVincentTerminalSnapshot(next: VincentSnapshot): void {\n current = next;\n}\n\n/** Register the Vincent terminal view; returns an unregister function. */\nexport function registerVincentTerminalView(): () => void {\n return registerSpatialTerminalView(\"vincent\", () =>\n createElement(VincentSpatialView, { snapshot: current }),\n );\n}\n"],"mappings":"AAUA,SAAS,mCAAmC;AAC5C,SAAS,qBAAqB;AAC9B;AAAA,EAEE;AAAA,OACK;AAEP,MAAM,QAAyB;AAAA,EAC7B,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV,gBAAgB;AAClB;AACA,IAAI,UAA2B;AAGxB,SAAS,2BAA2B,MAA6B;AACtE,YAAU;AACZ;AAGO,SAAS,8BAA0C;AACxD,SAAO;AAAA,IAA4B;AAAA,IAAW,MAC5C,cAAc,oBAAoB,EAAE,UAAU,QAAQ,CAAC;AAAA,EACzD;AACF;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AACA,OAAO,eAAe,CAAC"}
|
package/dist/register.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/register.ts"],"sourcesContent":["// Self-register Vincent overlay app at import time.\nimport \"./vincent-app.js\";\n\n// In a terminal host (the Node agent, no DOM), register the Vincent view so it\n// renders inline in the terminal. Lazy + DOM-guarded so the terminal engine\n// stays out of browser/mobile bundles.\nif (typeof window === \"undefined\") {\n void import(\"./register-terminal-view.js\")\n .then((m) => m.registerVincentTerminalView())\n .catch(() => {\n // Terminal rendering is best-effort; never block plugin load.\n });\n}\n"],"mappings":"AACA,OAAO;AAKP,IAAI,OAAO,WAAW,aAAa;AACjC,OAAK,OAAO,6BAA6B,EACtC,KAAK,CAAC,MAAM,EAAE,4BAA4B,CAAC,EAC3C,MAAM,MAAM;AAAA,EAEb,CAAC;AACL;","names":[]}
|
package/dist/routes.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vincent OAuth backend routes for Hyperliquid and Polymarket access.
|
|
3
|
+
*
|
|
4
|
+
* POST /api/vincent/start-login — Begin OAuth: register app, generate PKCE, return authUrl
|
|
5
|
+
* GET /callback/vincent — OAuth redirect target: exchange code, persist tokens
|
|
6
|
+
* GET /api/vincent/status — Check if Vincent is connected
|
|
7
|
+
* POST /api/vincent/disconnect — Clear stored Vincent tokens
|
|
8
|
+
*
|
|
9
|
+
* The start-login + /callback/vincent pair keeps the PKCE code_verifier on the
|
|
10
|
+
* server so the OAuth redirect can land in the user's external system browser
|
|
11
|
+
* (where sessionStorage is not shared with the desktop webview) and still
|
|
12
|
+
* complete the token exchange.
|
|
13
|
+
*/
|
|
14
|
+
import type http from "node:http";
|
|
15
|
+
import type { ElizaConfig } from "@elizaos/shared";
|
|
16
|
+
export interface VincentRouteState {
|
|
17
|
+
config: ElizaConfig;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Handle all /api/vincent/* routes.
|
|
21
|
+
* Returns true if the route was handled, false otherwise.
|
|
22
|
+
*/
|
|
23
|
+
export declare function handleVincentRoute(req: http.IncomingMessage, res: http.ServerResponse, pathname: string, method: string, state: VincentRouteState): Promise<boolean>;
|
|
24
|
+
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAIlC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAwKnD,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,WAAW,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,iBAAiB,GACvB,OAAO,CAAC,OAAO,CAAC,CAoWlB"}
|