@elizaos/plugin-social-alpha 2.0.3-beta.6 → 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.
Files changed (151) hide show
  1. package/dist/clients.d.ts +354 -0
  2. package/dist/clients.d.ts.map +1 -0
  3. package/dist/clients.js +670 -0
  4. package/dist/clients.js.map +1 -0
  5. package/dist/config.d.ts +144 -0
  6. package/dist/config.d.ts.map +1 -0
  7. package/dist/config.js +122 -0
  8. package/dist/config.js.map +1 -0
  9. package/dist/events.d.ts +5 -0
  10. package/dist/events.d.ts.map +1 -0
  11. package/dist/events.js +426 -0
  12. package/dist/events.js.map +1 -0
  13. package/dist/frontend/LeaderboardView.helpers.d.ts +6 -0
  14. package/dist/frontend/LeaderboardView.helpers.d.ts.map +1 -0
  15. package/dist/frontend/LeaderboardView.helpers.js +59 -0
  16. package/dist/frontend/LeaderboardView.helpers.js.map +1 -0
  17. package/dist/frontend/SocialAlphaSpatialView.d.ts +52 -0
  18. package/dist/frontend/SocialAlphaSpatialView.d.ts.map +1 -0
  19. package/dist/frontend/SocialAlphaSpatialView.js +72 -0
  20. package/dist/frontend/SocialAlphaSpatialView.js.map +1 -0
  21. package/dist/frontend/SocialAlphaView.d.ts +35 -0
  22. package/dist/frontend/SocialAlphaView.d.ts.map +1 -0
  23. package/dist/frontend/SocialAlphaView.js +125 -0
  24. package/dist/frontend/SocialAlphaView.js.map +1 -0
  25. package/dist/index.d.ts +24 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +73 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/mockPriceService.d.ts +22 -0
  30. package/dist/mockPriceService.d.ts.map +1 -0
  31. package/dist/mockPriceService.js +21 -0
  32. package/dist/mockPriceService.js.map +1 -0
  33. package/dist/providers/socialAlphaProvider.d.ts +15 -0
  34. package/dist/providers/socialAlphaProvider.d.ts.map +1 -0
  35. package/dist/providers/socialAlphaProvider.js +261 -0
  36. package/dist/providers/socialAlphaProvider.js.map +1 -0
  37. package/dist/register-terminal-view.d.ts +15 -0
  38. package/dist/register-terminal-view.d.ts.map +1 -0
  39. package/dist/register-terminal-view.js +21 -0
  40. package/dist/register-terminal-view.js.map +1 -0
  41. package/dist/register.d.ts +10 -0
  42. package/dist/register.d.ts.map +1 -0
  43. package/dist/register.js +5 -0
  44. package/dist/register.js.map +1 -0
  45. package/dist/reports.d.ts +57 -0
  46. package/dist/reports.d.ts.map +1 -0
  47. package/dist/reports.js +455 -0
  48. package/dist/reports.js.map +1 -0
  49. package/dist/routes.d.ts +3 -0
  50. package/dist/routes.d.ts.map +1 -0
  51. package/dist/routes.js +59 -0
  52. package/dist/routes.js.map +1 -0
  53. package/dist/schemas.d.ts +151 -0
  54. package/dist/schemas.d.ts.map +1 -0
  55. package/dist/schemas.js +258 -0
  56. package/dist/schemas.js.map +1 -0
  57. package/dist/service.d.ts +306 -0
  58. package/dist/service.d.ts.map +1 -0
  59. package/dist/service.js +3078 -0
  60. package/dist/service.js.map +1 -0
  61. package/dist/services/balancedTrustScoreCalculator.d.ts +61 -0
  62. package/dist/services/balancedTrustScoreCalculator.d.ts.map +1 -0
  63. package/dist/services/balancedTrustScoreCalculator.js +207 -0
  64. package/dist/services/balancedTrustScoreCalculator.js.map +1 -0
  65. package/dist/services/historicalPriceService.d.ts +59 -0
  66. package/dist/services/historicalPriceService.d.ts.map +1 -0
  67. package/dist/services/historicalPriceService.js +291 -0
  68. package/dist/services/historicalPriceService.js.map +1 -0
  69. package/dist/services/index.d.ts +12 -0
  70. package/dist/services/index.d.ts.map +1 -0
  71. package/dist/services/index.js +17 -0
  72. package/dist/services/index.js.map +1 -0
  73. package/dist/services/priceEnrichmentService.d.ts +109 -0
  74. package/dist/services/priceEnrichmentService.d.ts.map +1 -0
  75. package/dist/services/priceEnrichmentService.js +780 -0
  76. package/dist/services/priceEnrichmentService.js.map +1 -0
  77. package/dist/services/simulationActorsV2.d.ts +54 -0
  78. package/dist/services/simulationActorsV2.d.ts.map +1 -0
  79. package/dist/services/simulationActorsV2.js +362 -0
  80. package/dist/services/simulationActorsV2.js.map +1 -0
  81. package/dist/services/simulationRunner.d.ts +113 -0
  82. package/dist/services/simulationRunner.d.ts.map +1 -0
  83. package/dist/services/simulationRunner.js +771 -0
  84. package/dist/services/simulationRunner.js.map +1 -0
  85. package/dist/services/tokenSimulationService.d.ts +34 -0
  86. package/dist/services/tokenSimulationService.d.ts.map +1 -0
  87. package/dist/services/tokenSimulationService.js +297 -0
  88. package/dist/services/tokenSimulationService.js.map +1 -0
  89. package/dist/services/trustScoreOptimizer.d.ts +110 -0
  90. package/dist/services/trustScoreOptimizer.d.ts.map +1 -0
  91. package/dist/services/trustScoreOptimizer.js +635 -0
  92. package/dist/services/trustScoreOptimizer.js.map +1 -0
  93. package/dist/simulationActors.d.ts +35 -0
  94. package/dist/simulationActors.d.ts.map +1 -0
  95. package/dist/simulationActors.js +160 -0
  96. package/dist/simulationActors.js.map +1 -0
  97. package/dist/social-alpha-view-bundle.d.ts +2 -0
  98. package/dist/social-alpha-view-bundle.d.ts.map +1 -0
  99. package/dist/social-alpha-view-bundle.js +5 -0
  100. package/dist/social-alpha-view-bundle.js.map +1 -0
  101. package/dist/types.d.ts +937 -0
  102. package/dist/types.d.ts.map +1 -0
  103. package/dist/types.js +46 -0
  104. package/dist/types.js.map +1 -0
  105. package/dist/views/brand/background/clouds_background.jpg +0 -0
  106. package/dist/views/brand/banners/eliza_banner.svg +20 -0
  107. package/dist/views/brand/banners/elizacloud_banner.svg +20 -0
  108. package/dist/views/brand/banners/elizaos_banner.svg +20 -0
  109. package/dist/views/brand/concepts/billboard_concept_1200.jpg +0 -0
  110. package/dist/views/brand/concepts/chibi_usb_concept_900.jpg +0 -0
  111. package/dist/views/brand/concepts/concept_minipc_900.jpg +0 -0
  112. package/dist/views/brand/concepts/concept_phone_800.jpg +0 -0
  113. package/dist/views/brand/concepts/concept_usbdrive_900.jpg +0 -0
  114. package/dist/views/brand/favicons/android-chrome-192x192.png +0 -0
  115. package/dist/views/brand/favicons/android-chrome-512x512.png +0 -0
  116. package/dist/views/brand/favicons/apple-touch-icon.png +0 -0
  117. package/dist/views/brand/favicons/favicon-16x16.png +0 -0
  118. package/dist/views/brand/favicons/favicon-32x32.png +0 -0
  119. package/dist/views/brand/favicons/favicon.ico +0 -0
  120. package/dist/views/brand/favicons/favicon.svg +17 -0
  121. package/dist/views/brand/logos/elizaOS_text_black.svg +3 -0
  122. package/dist/views/brand/logos/elizaOS_text_white.svg +3 -0
  123. package/dist/views/brand/logos/eliza_logotext.svg +26 -0
  124. package/dist/views/brand/logos/eliza_logotext_black.svg +26 -0
  125. package/dist/views/brand/logos/eliza_text_black.svg +3 -0
  126. package/dist/views/brand/logos/eliza_text_white.svg +3 -0
  127. package/dist/views/brand/logos/elizacloud_logotext.svg +26 -0
  128. package/dist/views/brand/logos/elizacloud_logotext_black.svg +26 -0
  129. package/dist/views/brand/logos/elizacloud_text_black.svg +3 -0
  130. package/dist/views/brand/logos/elizacloud_text_white.svg +3 -0
  131. package/dist/views/brand/logos/elizaos_logotext.svg +26 -0
  132. package/dist/views/brand/logos/elizaos_logotext_black.svg +26 -0
  133. package/dist/views/brand/logos/logo_blue_blackbg.svg +18 -0
  134. package/dist/views/brand/logos/logo_blue_nobg.svg +17 -0
  135. package/dist/views/brand/logos/logo_orange_blackbg.svg +18 -0
  136. package/dist/views/brand/logos/logo_orange_nobg.svg +17 -0
  137. package/dist/views/brand/logos/logo_white_blackbg.svg +25 -0
  138. package/dist/views/brand/logos/logo_white_bluebg.svg +25 -0
  139. package/dist/views/brand/logos/logo_white_graybg.svg +18 -0
  140. package/dist/views/brand/logos/logo_white_nobg.svg +24 -0
  141. package/dist/views/brand/logos/logo_white_orangebg.svg +25 -0
  142. package/dist/views/brand/ogembeds/eliza_ogembed.png +0 -0
  143. package/dist/views/brand/ogembeds/eliza_ogembed.svg +20 -0
  144. package/dist/views/brand/ogembeds/elizacloud_ogembed.png +0 -0
  145. package/dist/views/brand/ogembeds/elizacloud_ogembed.svg +20 -0
  146. package/dist/views/brand/ogembeds/elizaos_ogembed.png +0 -0
  147. package/dist/views/brand/ogembeds/elizaos_ogembed.svg +20 -0
  148. package/dist/views/bundle.js +268 -0
  149. package/dist/views/bundle.js.map +1 -0
  150. package/dist/views/site.webmanifest +19 -0
  151. package/package.json +5 -5
@@ -0,0 +1,72 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { Button, Card, HStack, List, Text, VStack } from "@elizaos/ui/spatial";
3
+ const EMPTY_SOCIAL_ALPHA_SNAPSHOT = {
4
+ state: "loading",
5
+ rows: [],
6
+ leading: ""
7
+ };
8
+ function SocialAlphaSpatialView({
9
+ snapshot,
10
+ onAction
11
+ }) {
12
+ const dispatch = (action) => () => onAction?.(action);
13
+ return /* @__PURE__ */ jsx(Card, { gap: 1, padding: 1, children: snapshot.state === "loading" ? /* @__PURE__ */ jsx(Text, { tone: "muted", align: "center", style: "caption", children: "Loading leaderboard" }) : snapshot.state === "wallet-required" ? /* @__PURE__ */ jsx(WalletRequiredBody, { dispatch }) : snapshot.state === "error" ? /* @__PURE__ */ jsx(ErrorBody, { snapshot, dispatch }) : snapshot.state === "empty" ? /* @__PURE__ */ jsx(EmptyBody, {}) : /* @__PURE__ */ jsx(ReadyBody, { snapshot, dispatch }) });
14
+ }
15
+ function WalletRequiredBody({
16
+ dispatch
17
+ }) {
18
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
19
+ /* @__PURE__ */ jsx(Text, { bold: true, children: "Wallet required" }),
20
+ /* @__PURE__ */ jsx(HStack, { gap: 1, children: /* @__PURE__ */ jsx(Button, { agent: "connect-wallet", onPress: dispatch("connect-wallet"), children: "Wallet" }) })
21
+ ] });
22
+ }
23
+ function ErrorBody({
24
+ snapshot,
25
+ dispatch
26
+ }) {
27
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
28
+ /* @__PURE__ */ jsx(Text, { bold: true, children: "Could not load leaderboard" }),
29
+ /* @__PURE__ */ jsx(Text, { tone: "danger", style: "caption", children: snapshot.error ?? "Could not load leaderboard." }),
30
+ /* @__PURE__ */ jsx(HStack, { gap: 1, children: /* @__PURE__ */ jsx(Button, { agent: "retry", onPress: dispatch("retry"), children: "Retry" }) })
31
+ ] });
32
+ }
33
+ function EmptyBody() {
34
+ return /* @__PURE__ */ jsx(Text, { bold: true, children: "None" });
35
+ }
36
+ function ReadyBody({
37
+ snapshot,
38
+ dispatch
39
+ }) {
40
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
41
+ snapshot.leading ? /* @__PURE__ */ jsx(Text, { tone: "primary", style: "caption", children: snapshot.leading }) : null,
42
+ /* @__PURE__ */ jsx(List, { gap: 0, children: snapshot.rows.map((row) => /* @__PURE__ */ jsx(LeaderRowView, { row, dispatch }, row.userId)) })
43
+ ] });
44
+ }
45
+ function LeaderRowView({
46
+ row,
47
+ dispatch
48
+ }) {
49
+ return /* @__PURE__ */ jsxs(VStack, { gap: 0, agent: `caller-${row.userId}`, children: [
50
+ /* @__PURE__ */ jsxs(HStack, { gap: 1, align: "center", children: [
51
+ /* @__PURE__ */ jsx(Text, { tone: "primary", wrap: false, children: row.rank }),
52
+ /* @__PURE__ */ jsx(Text, { bold: true, grow: 1, wrap: false, children: row.name })
53
+ ] }),
54
+ /* @__PURE__ */ jsxs(HStack, { gap: 1, align: "center", children: [
55
+ /* @__PURE__ */ jsx(Text, { style: "caption", tone: "muted", grow: 1, wrap: false, children: row.score }),
56
+ /* @__PURE__ */ jsx(
57
+ Button,
58
+ {
59
+ agent: `open-${row.userId}`,
60
+ variant: "ghost",
61
+ onPress: dispatch(`open:${row.userId}`),
62
+ children: "\u203A"
63
+ }
64
+ )
65
+ ] })
66
+ ] });
67
+ }
68
+ export {
69
+ EMPTY_SOCIAL_ALPHA_SNAPSHOT,
70
+ SocialAlphaSpatialView
71
+ };
72
+ //# sourceMappingURL=SocialAlphaSpatialView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/frontend/SocialAlphaSpatialView.tsx"],"sourcesContent":["/**\n * SocialAlphaSpatialView — the alpha trust leaderboard 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, so it is safe to render\n * in the Node agent process where the terminal lives (no browser/client import).\n *\n * Every derived value — the leading-caller line, each row's formatted trust\n * score — is computed in the data wrapper ({@link ./SocialAlphaView.tsx}) and\n * handed in already formatted; this component never fetches or computes — it\n * displays the snapshot and dispatches actions.\n */\n\nimport { Button, Card, HStack, List, Text, VStack } from \"@elizaos/ui/spatial\";\n\n/** A single leaderboard caller, already projected to display shape. */\nexport interface LeaderRow {\n\t/** Stable id used to key rows and build the open-caller action. */\n\tuserId: string;\n\t/** Pre-formatted rank label (e.g. \"1\"), or empty when unranked. */\n\trank: string;\n\t/** Display name (username, or a short id when anonymous). */\n\tname: string;\n\t/** Pre-formatted trust score (e.g. \"12.50\"). */\n\tscore: string;\n}\n\n/** Which render state the leaderboard is in. */\nexport type SocialAlphaViewState =\n\t| \"loading\"\n\t| \"wallet-required\"\n\t| \"error\"\n\t| \"empty\"\n\t| \"ready\";\n\nexport interface SocialAlphaSnapshot {\n\t/** The leaderboard state machine. */\n\tstate: SocialAlphaViewState;\n\t/** Ranked callers (only meaningful when state === \"ready\"). */\n\trows: LeaderRow[];\n\t/** Pre-formatted leading-caller line, or empty when none. */\n\tleading: string;\n\t/** Error message when state === \"error\". */\n\terror?: string;\n}\n\nexport const EMPTY_SOCIAL_ALPHA_SNAPSHOT: SocialAlphaSnapshot = {\n\tstate: \"loading\",\n\trows: [],\n\tleading: \"\",\n};\n\nexport interface SocialAlphaSpatialViewProps {\n\tsnapshot: SocialAlphaSnapshot;\n\t/**\n\t * Dispatch by action id: `retry` (reload after an error),\n\t * `connect-wallet` (route a wallet-setup request), `open:<userId>`\n\t * (drill into a caller through chat).\n\t */\n\tonAction?: (action: string) => void;\n}\n\nexport function SocialAlphaSpatialView({\n\tsnapshot,\n\tonAction,\n}: SocialAlphaSpatialViewProps) {\n\tconst dispatch = (action: string) => () => onAction?.(action);\n\n\treturn (\n\t\t<Card gap={1} padding={1}>\n\t\t\t{snapshot.state === \"loading\" ? (\n\t\t\t\t<Text tone=\"muted\" align=\"center\" style=\"caption\">\n\t\t\t\t\tLoading leaderboard\n\t\t\t\t</Text>\n\t\t\t) : snapshot.state === \"wallet-required\" ? (\n\t\t\t\t<WalletRequiredBody dispatch={dispatch} />\n\t\t\t) : snapshot.state === \"error\" ? (\n\t\t\t\t<ErrorBody snapshot={snapshot} dispatch={dispatch} />\n\t\t\t) : snapshot.state === \"empty\" ? (\n\t\t\t\t<EmptyBody />\n\t\t\t) : (\n\t\t\t\t<ReadyBody snapshot={snapshot} dispatch={dispatch} />\n\t\t\t)}\n\t\t</Card>\n\t);\n}\n\nfunction WalletRequiredBody({\n\tdispatch,\n}: {\n\tdispatch: (action: string) => () => void;\n}) {\n\treturn (\n\t\t<>\n\t\t\t<Text bold>Wallet required</Text>\n\t\t\t<HStack gap={1}>\n\t\t\t\t<Button agent=\"connect-wallet\" onPress={dispatch(\"connect-wallet\")}>\n\t\t\t\t\tWallet\n\t\t\t\t</Button>\n\t\t\t</HStack>\n\t\t</>\n\t);\n}\n\nfunction ErrorBody({\n\tsnapshot,\n\tdispatch,\n}: {\n\tsnapshot: SocialAlphaSnapshot;\n\tdispatch: (action: string) => () => void;\n}) {\n\treturn (\n\t\t<>\n\t\t\t<Text bold>Could not load leaderboard</Text>\n\t\t\t<Text tone=\"danger\" style=\"caption\">\n\t\t\t\t{snapshot.error ?? \"Could not load leaderboard.\"}\n\t\t\t</Text>\n\t\t\t<HStack gap={1}>\n\t\t\t\t<Button agent=\"retry\" onPress={dispatch(\"retry\")}>\n\t\t\t\t\tRetry\n\t\t\t\t</Button>\n\t\t\t</HStack>\n\t\t</>\n\t);\n}\n\nfunction EmptyBody() {\n\treturn <Text bold>None</Text>;\n}\n\nfunction ReadyBody({\n\tsnapshot,\n\tdispatch,\n}: {\n\tsnapshot: SocialAlphaSnapshot;\n\tdispatch: (action: string) => () => void;\n}) {\n\treturn (\n\t\t<>\n\t\t\t{snapshot.leading ? (\n\t\t\t\t<Text tone=\"primary\" style=\"caption\">\n\t\t\t\t\t{snapshot.leading}\n\t\t\t\t</Text>\n\t\t\t) : null}\n\t\t\t<List gap={0}>\n\t\t\t\t{snapshot.rows.map((row) => (\n\t\t\t\t\t<LeaderRowView key={row.userId} row={row} dispatch={dispatch} />\n\t\t\t\t))}\n\t\t\t</List>\n\t\t</>\n\t);\n}\n\nfunction LeaderRowView({\n\trow,\n\tdispatch,\n}: {\n\trow: LeaderRow;\n\tdispatch: (action: string) => () => void;\n}) {\n\t// Rank + name share the first line (name fills, Card ellipsizes a long one);\n\t// the score and Open control sit on the second line so the row stays\n\t// narrow-safe at width 40 regardless of username length.\n\treturn (\n\t\t<VStack gap={0} agent={`caller-${row.userId}`}>\n\t\t\t<HStack gap={1} align=\"center\">\n\t\t\t\t<Text tone=\"primary\" wrap={false}>\n\t\t\t\t\t{row.rank}\n\t\t\t\t</Text>\n\t\t\t\t<Text bold grow={1} wrap={false}>\n\t\t\t\t\t{row.name}\n\t\t\t\t</Text>\n\t\t\t</HStack>\n\t\t\t<HStack gap={1} align=\"center\">\n\t\t\t\t<Text style=\"caption\" tone=\"muted\" grow={1} wrap={false}>\n\t\t\t\t\t{row.score}\n\t\t\t\t</Text>\n\t\t\t\t<Button\n\t\t\t\t\tagent={`open-${row.userId}`}\n\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\tonPress={dispatch(`open:${row.userId}`)}\n\t\t\t\t>\n\t\t\t\t\t›\n\t\t\t\t</Button>\n\t\t\t</HStack>\n\t\t</VStack>\n\t);\n}\n"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ACF,SACC,iCACE;AAAA,aAAS,UACT,oBAAC,QAAK,MAAK,WAAU,OAAM,WACzB,mBAAS,SACX,IACG;AAAA,IACJ,oBAAC,QAAK,KAAK,GACT,mBAAS,KAAK,IAAI,CAAC,QACnB,oBAAC,iBAA+B,KAAU,YAAtB,IAAI,MAAsC,CAC9D,GACF;AAAA,KACD;AAEF;AAEA,SAAS,cAAc;AAAA,EACtB;AAAA,EACA;AACD,GAGG;AAIF,SACC,qBAAC,UAAO,KAAK,GAAG,OAAO,UAAU,IAAI,MAAM,IAC1C;AAAA,yBAAC,UAAO,KAAK,GAAG,OAAM,UACrB;AAAA,0BAAC,QAAK,MAAK,WAAU,MAAM,OACzB,cAAI,MACN;AAAA,MACA,oBAAC,QAAK,MAAI,MAAC,MAAM,GAAG,MAAM,OACxB,cAAI,MACN;AAAA,OACD;AAAA,IACA,qBAAC,UAAO,KAAK,GAAG,OAAM,UACrB;AAAA,0BAAC,QAAK,OAAM,WAAU,MAAK,SAAQ,MAAM,GAAG,MAAM,OAChD,cAAI,OACN;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACA,OAAO,QAAQ,IAAI,MAAM;AAAA,UACzB,SAAQ;AAAA,UACR,SAAS,SAAS,QAAQ,IAAI,MAAM,EAAE;AAAA,UACtC;AAAA;AAAA,MAED;AAAA,OACD;AAAA,KACD;AAEF;","names":[]}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * SocialAlphaView — the single GUI/XR data wrapper for the alpha trust
3
+ * leaderboard.
4
+ *
5
+ * It owns the live leaderboard data (the fetcher seam over the plugin's
6
+ * read-only route, the wallet gate, the quiet background poll, and the
7
+ * wire->display projection) and renders the one presentational
8
+ * {@link SocialAlphaSpatialView} inside a {@link SpatialSurface}. Omitting the
9
+ * `modality` prop lets `SpatialSurface` auto-detect GUI vs XR, so the SAME
10
+ * component serves both surfaces; the TUI surface renders the same
11
+ * `SocialAlphaSpatialView` through the terminal registry (see
12
+ * `../register-terminal-view.tsx`).
13
+ *
14
+ * Data source (the plugin owns the leaderboard route):
15
+ * GET /api/social-alpha/leaderboard -> LeaderboardEntry[] (ranked)
16
+ * client.getWalletAddresses() -> wallet gate
17
+ *
18
+ * The board is read-only. The only owner actions route through the assistant
19
+ * chat (no fabricated state): `retry` (reload after an error), `connect-wallet`
20
+ * (ask the assistant to set up the agent wallet), and `open:<userId>` (drill
21
+ * into a caller).
22
+ */
23
+ import type { ReactNode } from "react";
24
+ import type { LeaderboardEntry } from "../types";
25
+ export interface SocialAlphaFetchers {
26
+ checkWallet: () => Promise<boolean>;
27
+ fetchLeaderboard: () => Promise<LeaderboardEntry[]>;
28
+ }
29
+ export interface SocialAlphaViewProps {
30
+ /** Test/host injection seam. Defaults to the real wallet + leaderboard helpers. */
31
+ fetchers?: SocialAlphaFetchers;
32
+ }
33
+ export declare function SocialAlphaView(props?: SocialAlphaViewProps): ReactNode;
34
+ export default SocialAlphaView;
35
+ //# sourceMappingURL=SocialAlphaView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SocialAlphaView.d.ts","sourceRoot":"","sources":["../../src/frontend/SocialAlphaView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAgBjD,MAAM,WAAW,mBAAmB;IACnC,WAAW,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IACpC,gBAAgB,EAAE,MAAM,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;CACpD;AAOD,MAAM,WAAW,oBAAoB;IACpC,mFAAmF;IACnF,QAAQ,CAAC,EAAE,mBAAmB,CAAC;CAC/B;AAgDD,wBAAgB,eAAe,CAAC,KAAK,GAAE,oBAAyB,GAAG,SAAS,CAoG3E;AAED,eAAe,eAAe,CAAC"}
@@ -0,0 +1,125 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { client } from "@elizaos/ui";
3
+ import { SpatialSurface } from "@elizaos/ui/spatial";
4
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
5
+ import {
6
+ fetchLeaderboardData,
7
+ hasWalletConfigured
8
+ } from "./LeaderboardView.helpers";
9
+ import {
10
+ EMPTY_SOCIAL_ALPHA_SNAPSHOT,
11
+ SocialAlphaSpatialView
12
+ } from "./SocialAlphaSpatialView.js";
13
+ const defaultFetchers = {
14
+ checkWallet: hasWalletConfigured,
15
+ fetchLeaderboard: fetchLeaderboardData
16
+ };
17
+ function shortId(userId) {
18
+ return userId.length > 12 ? `${userId.slice(0, 12)}\u2026` : userId;
19
+ }
20
+ function toRow(entry) {
21
+ return {
22
+ userId: entry.userId,
23
+ rank: entry.rank !== void 0 ? String(entry.rank) : "",
24
+ name: entry.username ?? shortId(entry.userId),
25
+ score: entry.trustScore.toFixed(2)
26
+ };
27
+ }
28
+ function leadingLine(entries) {
29
+ const leader = entries[0];
30
+ if (!leader?.username) return "";
31
+ return `leading: ${leader.username} (${leader.trustScore.toFixed(2)})`;
32
+ }
33
+ const POLL_INTERVAL_MS = 15e3;
34
+ function requestThroughChat(text) {
35
+ const send = client.sendChatMessage;
36
+ send?.(text);
37
+ }
38
+ function SocialAlphaView(props = {}) {
39
+ const fetchers = props.fetchers ?? defaultFetchers;
40
+ const [state, setState] = useState({ kind: "loading" });
41
+ const fetchersRef = useRef(fetchers);
42
+ fetchersRef.current = fetchers;
43
+ const load = useCallback(() => {
44
+ let cancelled = false;
45
+ setState({ kind: "loading" });
46
+ void (async () => {
47
+ try {
48
+ const ready = await fetchersRef.current.checkWallet();
49
+ if (cancelled) return;
50
+ if (!ready) {
51
+ setState({ kind: "wallet-required" });
52
+ return;
53
+ }
54
+ const entries = await fetchersRef.current.fetchLeaderboard();
55
+ if (cancelled) return;
56
+ setState({ kind: "ready", entries });
57
+ } catch (error) {
58
+ if (cancelled) return;
59
+ setState({
60
+ kind: "error",
61
+ message: error instanceof Error ? error.message : "Could not load leaderboard."
62
+ });
63
+ }
64
+ })();
65
+ return () => {
66
+ cancelled = true;
67
+ };
68
+ }, []);
69
+ useEffect(() => load(), [load]);
70
+ useEffect(() => {
71
+ if (state.kind !== "ready") return;
72
+ const id = setInterval(() => {
73
+ fetchersRef.current.fetchLeaderboard().then((entries) => {
74
+ setState(
75
+ (prev) => prev.kind === "ready" ? { kind: "ready", entries } : prev
76
+ );
77
+ }).catch(() => {
78
+ });
79
+ }, POLL_INTERVAL_MS);
80
+ return () => clearInterval(id);
81
+ }, [state.kind]);
82
+ const snapshot = useMemo(() => {
83
+ if (state.kind === "loading") return EMPTY_SOCIAL_ALPHA_SNAPSHOT;
84
+ if (state.kind === "wallet-required") {
85
+ return { state: "wallet-required", rows: [], leading: "" };
86
+ }
87
+ if (state.kind === "error") {
88
+ return { state: "error", rows: [], leading: "", error: state.message };
89
+ }
90
+ if (state.entries.length === 0) {
91
+ return { state: "empty", rows: [], leading: "" };
92
+ }
93
+ return {
94
+ state: "ready",
95
+ rows: state.entries.map(toRow),
96
+ leading: leadingLine(state.entries)
97
+ };
98
+ }, [state]);
99
+ const onAction = useCallback(
100
+ (action) => {
101
+ if (action === "retry") {
102
+ load();
103
+ return;
104
+ }
105
+ if (action === "connect-wallet") {
106
+ requestThroughChat("Set up the agent wallet for Social Alpha.");
107
+ return;
108
+ }
109
+ if (action.startsWith("open:")) {
110
+ const userId = action.slice("open:".length);
111
+ requestThroughChat(
112
+ `Show me the Social Alpha recommendations for caller ${userId}.`
113
+ );
114
+ }
115
+ },
116
+ [load]
117
+ );
118
+ return /* @__PURE__ */ jsx(SpatialSurface, { children: /* @__PURE__ */ jsx(SocialAlphaSpatialView, { snapshot, onAction }) });
119
+ }
120
+ var SocialAlphaView_default = SocialAlphaView;
121
+ export {
122
+ SocialAlphaView,
123
+ SocialAlphaView_default as default
124
+ };
125
+ //# sourceMappingURL=SocialAlphaView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/frontend/SocialAlphaView.tsx"],"sourcesContent":["/**\n * SocialAlphaView — the single GUI/XR data wrapper for the alpha trust\n * leaderboard.\n *\n * It owns the live leaderboard data (the fetcher seam over the plugin's\n * read-only route, the wallet gate, the quiet background poll, and the\n * wire->display projection) and renders the one presentational\n * {@link SocialAlphaSpatialView} inside a {@link SpatialSurface}. Omitting the\n * `modality` prop lets `SpatialSurface` auto-detect GUI vs XR, so the SAME\n * component serves both surfaces; the TUI surface renders the same\n * `SocialAlphaSpatialView` through the terminal registry (see\n * `../register-terminal-view.tsx`).\n *\n * Data source (the plugin owns the leaderboard route):\n * GET /api/social-alpha/leaderboard -> LeaderboardEntry[] (ranked)\n * client.getWalletAddresses() -> wallet gate\n *\n * The board is read-only. The only owner actions route through the assistant\n * chat (no fabricated state): `retry` (reload after an error), `connect-wallet`\n * (ask the assistant to set up the agent wallet), and `open:<userId>` (drill\n * into a caller).\n */\n\nimport { client } from \"@elizaos/ui\";\nimport { SpatialSurface } from \"@elizaos/ui/spatial\";\nimport type { ReactNode } from \"react\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport type { LeaderboardEntry } from \"../types.js\";\nimport {\n\tfetchLeaderboardData,\n\thasWalletConfigured,\n} from \"./LeaderboardView.helpers\";\nimport {\n\tEMPTY_SOCIAL_ALPHA_SNAPSHOT,\n\ttype LeaderRow,\n\ttype SocialAlphaSnapshot,\n\tSocialAlphaSpatialView,\n} from \"./SocialAlphaSpatialView.js\";\n\n// ---------------------------------------------------------------------------\n// Fetcher seam — default to the real helpers; tests inject offline fakes.\n// ---------------------------------------------------------------------------\n\nexport interface SocialAlphaFetchers {\n\tcheckWallet: () => Promise<boolean>;\n\tfetchLeaderboard: () => Promise<LeaderboardEntry[]>;\n}\n\nconst defaultFetchers: SocialAlphaFetchers = {\n\tcheckWallet: hasWalletConfigured,\n\tfetchLeaderboard: fetchLeaderboardData,\n};\n\nexport interface SocialAlphaViewProps {\n\t/** Test/host injection seam. Defaults to the real wallet + leaderboard helpers. */\n\tfetchers?: SocialAlphaFetchers;\n}\n\n// ---------------------------------------------------------------------------\n// Wire -> display projection (client displays, never computes).\n// ---------------------------------------------------------------------------\n\nfunction shortId(userId: string): string {\n\treturn userId.length > 12 ? `${userId.slice(0, 12)}…` : userId;\n}\n\nfunction toRow(entry: LeaderboardEntry): LeaderRow {\n\treturn {\n\t\tuserId: entry.userId,\n\t\trank: entry.rank !== undefined ? String(entry.rank) : \"\",\n\t\tname: entry.username ?? shortId(entry.userId),\n\t\tscore: entry.trustScore.toFixed(2),\n\t};\n}\n\nfunction leadingLine(entries: LeaderboardEntry[]): string {\n\tconst leader = entries[0];\n\tif (!leader?.username) return \"\";\n\treturn `leading: ${leader.username} (${leader.trustScore.toFixed(2)})`;\n}\n\n// ---------------------------------------------------------------------------\n// Fetch-driven state machine.\n// ---------------------------------------------------------------------------\n\nconst POLL_INTERVAL_MS = 15_000;\n\ntype LoadState =\n\t| { kind: \"loading\" }\n\t| { kind: \"wallet-required\" }\n\t| { kind: \"error\"; message: string }\n\t| { kind: \"ready\"; entries: LeaderboardEntry[] };\n\n/**\n * Route a natural-language request through the assistant chat. `client` does\n * not type `sendChatMessage`, so read it through a narrow optional-method view\n * and call it only when present — best-effort dispatch, no fabricated state.\n */\nfunction requestThroughChat(text: string): void {\n\tconst send = (client as { sendChatMessage?: (text: string) => void })\n\t\t.sendChatMessage;\n\tsend?.(text);\n}\n\nexport function SocialAlphaView(props: SocialAlphaViewProps = {}): ReactNode {\n\tconst fetchers = props.fetchers ?? defaultFetchers;\n\tconst [state, setState] = useState<LoadState>({ kind: \"loading\" });\n\n\tconst fetchersRef = useRef(fetchers);\n\tfetchersRef.current = fetchers;\n\n\tconst load = useCallback(() => {\n\t\tlet cancelled = false;\n\t\tsetState({ kind: \"loading\" });\n\t\tvoid (async () => {\n\t\t\ttry {\n\t\t\t\tconst ready = await fetchersRef.current.checkWallet();\n\t\t\t\tif (cancelled) return;\n\t\t\t\tif (!ready) {\n\t\t\t\t\tsetState({ kind: \"wallet-required\" });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst entries = await fetchersRef.current.fetchLeaderboard();\n\t\t\t\tif (cancelled) return;\n\t\t\t\tsetState({ kind: \"ready\", entries });\n\t\t\t} catch (error: unknown) {\n\t\t\t\tif (cancelled) return;\n\t\t\t\tsetState({\n\t\t\t\t\tkind: \"error\",\n\t\t\t\t\tmessage:\n\t\t\t\t\t\terror instanceof Error\n\t\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t\t: \"Could not load leaderboard.\",\n\t\t\t\t});\n\t\t\t}\n\t\t})();\n\t\treturn () => {\n\t\t\tcancelled = true;\n\t\t};\n\t}, []);\n\n\tuseEffect(() => load(), [load]);\n\n\t// Background poll: refresh the leaderboard on an interval without flashing the\n\t// loading state. Transient poll failures are ignored — the explicit Retry path\n\t// is what surfaces errors. The poll only runs once the wallet gate is open.\n\tuseEffect(() => {\n\t\tif (state.kind !== \"ready\") return;\n\t\tconst id = setInterval(() => {\n\t\t\tfetchersRef.current\n\t\t\t\t.fetchLeaderboard()\n\t\t\t\t.then((entries) => {\n\t\t\t\t\tsetState((prev) =>\n\t\t\t\t\t\tprev.kind === \"ready\" ? { kind: \"ready\", entries } : prev,\n\t\t\t\t\t);\n\t\t\t\t})\n\t\t\t\t.catch(() => {});\n\t\t}, POLL_INTERVAL_MS);\n\t\treturn () => clearInterval(id);\n\t}, [state.kind]);\n\n\tconst snapshot = useMemo<SocialAlphaSnapshot>(() => {\n\t\tif (state.kind === \"loading\") return EMPTY_SOCIAL_ALPHA_SNAPSHOT;\n\t\tif (state.kind === \"wallet-required\") {\n\t\t\treturn { state: \"wallet-required\", rows: [], leading: \"\" };\n\t\t}\n\t\tif (state.kind === \"error\") {\n\t\t\treturn { state: \"error\", rows: [], leading: \"\", error: state.message };\n\t\t}\n\t\tif (state.entries.length === 0) {\n\t\t\treturn { state: \"empty\", rows: [], leading: \"\" };\n\t\t}\n\t\treturn {\n\t\t\tstate: \"ready\",\n\t\t\trows: state.entries.map(toRow),\n\t\t\tleading: leadingLine(state.entries),\n\t\t};\n\t}, [state]);\n\n\tconst onAction = useCallback(\n\t\t(action: string) => {\n\t\t\tif (action === \"retry\") {\n\t\t\t\tload();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (action === \"connect-wallet\") {\n\t\t\t\trequestThroughChat(\"Set up the agent wallet for Social Alpha.\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (action.startsWith(\"open:\")) {\n\t\t\t\tconst userId = action.slice(\"open:\".length);\n\t\t\t\trequestThroughChat(\n\t\t\t\t\t`Show me the Social Alpha recommendations for caller ${userId}.`,\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[load],\n\t);\n\n\treturn (\n\t\t<SpatialSurface>\n\t\t\t<SocialAlphaSpatialView snapshot={snapshot} onAction={onAction} />\n\t\t</SpatialSurface>\n\t);\n}\n\nexport default SocialAlphaView;\n"],"mappings":"AAyMG;AAlLH,SAAS,cAAc;AACvB,SAAS,sBAAsB;AAE/B,SAAS,aAAa,WAAW,SAAS,QAAQ,gBAAgB;AAElE;AAAA,EACC;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACC;AAAA,EAGA;AAAA,OACM;AAWP,MAAM,kBAAuC;AAAA,EAC5C,aAAa;AAAA,EACb,kBAAkB;AACnB;AAWA,SAAS,QAAQ,QAAwB;AACxC,SAAO,OAAO,SAAS,KAAK,GAAG,OAAO,MAAM,GAAG,EAAE,CAAC,WAAM;AACzD;AAEA,SAAS,MAAM,OAAoC;AAClD,SAAO;AAAA,IACN,QAAQ,MAAM;AAAA,IACd,MAAM,MAAM,SAAS,SAAY,OAAO,MAAM,IAAI,IAAI;AAAA,IACtD,MAAM,MAAM,YAAY,QAAQ,MAAM,MAAM;AAAA,IAC5C,OAAO,MAAM,WAAW,QAAQ,CAAC;AAAA,EAClC;AACD;AAEA,SAAS,YAAY,SAAqC;AACzD,QAAM,SAAS,QAAQ,CAAC;A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ialAlphaProvider } from "./providers/socialAlphaProvider";
3
+ export * from "./types";
4
+ /**
5
+ * Social Alpha Plugin for ElizaOS.
6
+ *
7
+ * Tracks token recommendations ("shills") and criticisms ("FUD") made by
8
+ * users in chat. Builds trust scores for each recommender based on whether
9
+ * following their calls would have been profitable — accounting for:
10
+ *
11
+ * - Buy calls that mooned vs dumped
12
+ * - Sell/FUD calls on tokens that were scams (good call) vs tokens that rallied (bad call)
13
+ * - Conviction level, recency, and consistency
14
+ *
15
+ * Exposes a **Social Alpha Provider** that injects trust data (win rate,
16
+ * rank, P&L history) into the agent's context so it can weigh advice
17
+ * from different users.
18
+ */
19
+ export declare const socialAlphaPlugin: Plugin;
20
+ export default socialAlphaPlugin;
21
+ export { EMPTY_SOCIAL_ALPHA_SNAPSHOT, type LeaderRow, type SocialAlphaSnapshot, SocialAlphaSpatialView, type SocialAlphaViewState, } from "./frontend/SocialAlphaSpatialView";
22
+ export { registerSocialAlphaTerminalView, setSocialAlphaTerminalSnapshot, } from "./register-terminal-view";
23
+ import "./register.js";
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,MAAM,EAAE,MAAM,eAAe,CAAC;AAO3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,cAAc,SAAS,CAAC;AAExB;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAiD/B,CAAC;AAEF,eAAe,iBAAiB,CAAC;AAOjC,OAAO,EACN,2BAA2B,EAC3B,KAAK,SAAS,EACd,KAAK,mBAAmB,EACxB,sBAAsB,EACtB,KAAK,oBAAoB,GACzB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACN,+BAA+B,EAC/B,8BAA8B,GAC9B,MAAM,0BAA0B,CAAC;AAKlC,OAAO,eAAe,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,73 @@
1
+ import { logger } from "@elizaos/core";
2
+ import { events } from "./events.js";
3
+ import { socialAlphaProvider } from "./providers/socialAlphaProvider.js";
4
+ import { communityInvestorRoutes } from "./routes.js";
5
+ import { CommunityInvestorService } from "./service.js";
6
+ import { socialAlphaProvider as socialAlphaProvider2 } from "./providers/socialAlphaProvider.js";
7
+ export * from "./types.js";
8
+ const socialAlphaPlugin = {
9
+ name: "@elizaos/plugin-social-alpha",
10
+ description: "Tracks token shills and FUD, builds trust scores based on P&L outcomes, and provides a Social Alpha Provider with win rate, rank, and recommender analytics.",
11
+ config: {
12
+ BIRDEYE_API_KEY: "",
13
+ DEXSCREENER_API_KEY: "",
14
+ HELIUS_API_KEY: "",
15
+ PROCESS_TRADE_DECISION_INTERVAL_HOURS: "1",
16
+ METRIC_REFRESH_INTERVAL_HOURS: "24",
17
+ USER_TRADE_COOLDOWN_HOURS: "12",
18
+ SCAM_PENALTY: "-100",
19
+ SCAM_CORRECT_CALL_BONUS: "100",
20
+ MAX_RECOMMENDATIONS_IN_PROFILE: "50"
21
+ },
22
+ async init(_config, runtime) {
23
+ logger.info("[SocialAlpha] Plugin initializing...");
24
+ if (runtime) {
25
+ logger.info(`[SocialAlpha] Initialized for agent: ${runtime.agentId}`);
26
+ }
27
+ },
28
+ services: [CommunityInvestorService],
29
+ providers: [socialAlphaProvider],
30
+ routes: communityInvestorRoutes,
31
+ events,
32
+ views: [
33
+ {
34
+ id: "social-alpha",
35
+ label: "Social Alpha",
36
+ description: "Trust leaderboard for token calls. Requires an agent wallet.",
37
+ icon: "UsersRound",
38
+ path: "/social-alpha",
39
+ modalities: ["gui", "xr", "tui"],
40
+ bundlePath: "dist/views/bundle.js",
41
+ componentExport: "SocialAlphaView",
42
+ tags: ["finance", "crypto", "social", "trust", "leaderboard"],
43
+ visibleInManager: true,
44
+ desktopTabEnabled: true
45
+ }
46
+ ],
47
+ tests: [],
48
+ async dispose(runtime) {
49
+ await runtime.getService(
50
+ CommunityInvestorService.serviceType
51
+ )?.stop();
52
+ }
53
+ };
54
+ var index_default = socialAlphaPlugin;
55
+ import {
56
+ EMPTY_SOCIAL_ALPHA_SNAPSHOT,
57
+ SocialAlphaSpatialView
58
+ } from "./frontend/SocialAlphaSpatialView.js";
59
+ import {
60
+ registerSocialAlphaTerminalView,
61
+ setSocialAlphaTerminalSnapshot
62
+ } from "./register-terminal-view.js";
63
+ import "./register.js";
64
+ export {
65
+ EMPTY_SOCIAL_ALPHA_SNAPSHOT,
66
+ SocialAlphaSpatialView,
67
+ index_default as default,
68
+ registerSocialAlphaTerminalView,
69
+ setSocialAlphaTerminalSnapshot,
70
+ socialAlphaPlugin,
71
+ socialAlphaProvider2 as socialAlphaProvider
72
+ };
73
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { IAgentRuntime, Plugin } from \"@elizaos/core\";\nimport { logger } from \"@elizaos/core\";\nimport { events } from \"./events.js\";\nimport { socialAlphaProvider } from \"./providers/socialAlphaProvider.js\";\nimport { communityInvestorRoutes } from \"./routes.js\";\nimport { CommunityInvestorService } from \"./service.js\";\n\nexport { socialAlphaProvider } from \"./providers/socialAlphaProvider.js\";\nexport * from \"./types.js\";\n\n/**\n * Social Alpha Plugin for ElizaOS.\n *\n * Tracks token recommendations (\"shills\") and criticisms (\"FUD\") made by\n * users in chat. Builds trust scores for each recommender based on whether\n * following their calls would have been profitable — accounting for:\n *\n * - Buy calls that mooned vs dumped\n * - Sell/FUD calls on tokens that were scams (good call) vs tokens that rallied (bad call)\n * - Conviction level, recency, and consistency\n *\n * Exposes a **Social Alpha Provider** that injects trust data (win rate,\n * rank, P&L history) into the agent's context so it can weigh advice\n * from different users.\n */\nexport const socialAlphaPlugin: Plugin = {\n\tname: \"@elizaos/plugin-social-alpha\",\n\tdescription:\n\t\t\"Tracks token shills and FUD, builds trust scores based on P&L outcomes, and provides a Social Alpha Provider with win rate, rank, and recommender analytics.\",\n\tconfig: {\n\t\tBIRDEYE_API_KEY: \"\",\n\t\tDEXSCREENER_API_KEY: \"\",\n\t\tHELIUS_API_KEY: \"\",\n\t\tPROCESS_TRADE_DECISION_INTERVAL_HOURS: \"1\",\n\t\tMETRIC_REFRESH_INTERVAL_HOURS: \"24\",\n\t\tUSER_TRADE_COOLDOWN_HOURS: \"12\",\n\t\tSCAM_PENALTY: \"-100\",\n\t\tSCAM_CORRECT_CALL_BONUS: \"100\",\n\t\tMAX_RECOMMENDATIONS_IN_PROFILE: \"50\",\n\t},\n\tasync init(_config: Record<string, string>, runtime?: IAgentRuntime) {\n\t\tlogger.info(\"[SocialAlpha] Plugin initializing...\");\n\t\tif (runtime) {\n\t\t\tlogger.info(`[SocialAlpha] Initialized for agent: ${runtime.agentId}`);\n\t\t}\n\t},\n\tservices: [CommunityInvestorService],\n\tproviders: [socialAlphaProvider],\n\troutes: communityInvestorRoutes,\n\tevents: events as Plugin[\"events\"],\n\tviews: [\n\t\t{\n\t\t\tid: \"social-alpha\",\n\t\t\tlabel: \"Social Alpha\",\n\t\t\tdescription:\n\t\t\t\t\"Trust leaderboard for token calls. Requires an agent wallet.\",\n\t\t\ticon: \"UsersRound\",\n\t\t\tpath: \"/social-alpha\",\n\t\t\tmodalities: [\"gui\", \"xr\", \"tui\"],\n\t\t\tbundlePath: \"dist/views/bundle.js\",\n\t\t\tcomponentExport: \"SocialAlphaView\",\n\t\t\ttags: [\"finance\", \"crypto\", \"social\", \"trust\", \"leaderboard\"],\n\t\t\tvisibleInManager: true,\n\t\t\tdesktopTabEnabled: true,\n\t\t},\n\t],\n\ttests: [],\n\tasync dispose(runtime) {\n\t\tawait runtime\n\t\t\t.getService<CommunityInvestorService>(\n\t\t\t\tCommunityInvestorService.serviceType,\n\t\t\t)\n\t\t\t?.stop();\n\t},\n};\n\nexport default socialAlphaPlugin;\n\n// The GUI/XR data wrapper (`SocialAlphaView`) reaches the view bundle through\n// `social-alpha-view-bundle.ts`; it is intentionally NOT re-exported here, since\n// it imports the `@elizaos/ui` client barrel (browser-only) and the plugin's\n// runtime export surface stays free of it. The presentational spatial component\n// and its snapshot types are browser-safe and exported for terminal hosts.\nexport {\n\tEMPTY_SOCIAL_ALPHA_SNAPSHOT,\n\ttype LeaderRow,\n\ttype SocialAlphaSnapshot,\n\tSocialAlphaSpatialView,\n\ttype SocialAlphaViewState,\n} from \"./frontend/SocialAlphaSpatialView.js\";\nexport {\n\tregisterSocialAlphaTerminalView,\n\tsetSocialAlphaTerminalSnapshot,\n} from \"./register-terminal-view.js\";\n\n// Side-effect: in a terminal host (Node agent, no DOM) this registers the\n// Social Alpha terminal view. DOM-guarded so the terminal engine stays out of\n// browser bundles.\nimport \"./register.js\";\n"],"mappings":"AACA,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,2BAA2B;AACpC,SAAS,+BAA+B;AACxC,SAAS,gCAAgC;AAEzC,SAAS,uBAAAA,4BAA2B;AACpC,cAAc;AAiBP,MAAM,oBAA4B;AAAA,EACxC,MAAM;AAAA,EACN,aACC;AAAA,EACD,QAAQ;AAAA,IACP,iBAAiB;AAAA,IACjB,qBAAqB;AAAA,IACrB,gBAAgB;AAAA,IAChB,uCAAuC;AAAA,IACvC,+BAA+B;AAAA,IAC/B,2BAA2B;AAAA,IAC3B,cAAc;AAAA,IACd,yBAAyB;AAAA,IACzB,gCAAgC;AAAA,EACjC;AAAA,EACA,MAAM,KAAK,SAAiC,SAAyB;AACpE,WAAO,KAAK,sCAAsC;AAClD,QAAI,SAAS;AACZ,aAAO,KAAK,wCAAwC,QAAQ,OAAO,EAAE;AAAA,IACtE;AAAA,EACD;AAAA,EACA,UAAU,CAAC,wBAAwB;AAAA,EACnC,WAAW,CAAC,mBAAmB;AAAA,EAC/B,QAAQ;AAAA,EACR;AAAA,EACA,OAAO;AAAA,IACN;AAAA,MACC,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,aACC;AAAA,MACD,MAAM;AAAA,MACN,MAAM;AAAA,MACN,YAAY,CAAC,OAAO,MAAM,KAAK;AAAA,MAC/B,YAAY;AAAA,MACZ,iBAAiB;AAAA,MACjB,MAAM,CAAC,WAAW,UAAU,UAAU,SAAS,aAAa;AAAA,MAC5D,kBAAkB;AAAA,MAClB,mBAAmB;AAAA,IACpB;AAAA,EACD;AAAA,EACA,OAAO,CAAC;AAAA,EACR,MAAM,QAAQ,SAAS;AACtB,UAAM,QACJ;AAAA,MACA,yBAAyB;AAAA,IAC1B,GACE,KAAK;AAAA,EACT;AACD;AAEA,IAAO,gBAAQ;AAOf;AAAA,EACC;AAAA,EAGA;AAAA,OAEM;AACP;AAAA,EACC;AAAA,EACA;AAAA,OACM;AAKP,OAAO;","names":["socialAlphaProvider"]}
@@ -0,0 +1,22 @@
1
+ import type { SupportedChain } from "./types";
2
+ export interface SimulatedToken {
3
+ address: string;
4
+ symbol: string;
5
+ name: string;
6
+ chain: SupportedChain;
7
+ initialPrice: number;
8
+ performanceType?: "good" | "bad" | "neutral";
9
+ priceTrajectory?: (step: number) => number;
10
+ currentPrice?: number;
11
+ liquidity?: number;
12
+ marketCap?: number;
13
+ createdAt?: number;
14
+ }
15
+ export declare class MockPriceService {
16
+ private tokens;
17
+ static neutralTokenTrajectory(initialPrice: number): (step: number) => number;
18
+ addToken(token: SimulatedToken): void;
19
+ getToken(addressOrSymbol: string): SimulatedToken | undefined;
20
+ getPrice(addressOrSymbol: string): number | null;
21
+ }
22
+ //# sourceMappingURL=mockPriceService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockPriceService.d.ts","sourceRoot":"","sources":["../src/mockPriceService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,WAAW,cAAc;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,cAAc,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;IAC7C,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,gBAAgB;IAC5B,OAAO,CAAC,MAAM,CAAqC;IAEnD,MAAM,CAAC,sBAAsB,CAC5B,YAAY,EAAE,MAAM,GAClB,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM;IAI3B,QAAQ,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;IAKrC,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAO7D,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CAIhD"}
@@ -0,0 +1,21 @@
1
+ class MockPriceService {
2
+ tokens = /* @__PURE__ */ new Map();
3
+ static neutralTokenTrajectory(initialPrice) {
4
+ return (step) => initialPrice * (1 + Math.sin(step / 10) * 0.02);
5
+ }
6
+ addToken(token) {
7
+ this.tokens.set(token.address, token);
8
+ this.tokens.set(token.symbol.toUpperCase(), token);
9
+ }
10
+ getToken(addressOrSymbol) {
11
+ return this.tokens.get(addressOrSymbol) ?? this.tokens.get(addressOrSymbol.toUpperCase());
12
+ }
13
+ getPrice(addressOrSymbol) {
14
+ const token = this.getToken(addressOrSymbol);
15
+ return token?.currentPrice ?? token?.initialPrice ?? null;
16
+ }
17
+ }
18
+ export {
19
+ MockPriceService
20
+ };
21
+ //# sourceMappingURL=mockPriceService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/mockPriceService.ts"],"sourcesContent":["import type { SupportedChain } from \"./types.js\";\n\nexport interface SimulatedToken {\n\taddress: string;\n\tsymbol: string;\n\tname: string;\n\tchain: SupportedChain;\n\tinitialPrice: number;\n\tperformanceType?: \"good\" | \"bad\" | \"neutral\";\n\tpriceTrajectory?: (step: number) => number;\n\tcurrentPrice?: number;\n\tliquidity?: number;\n\tmarketCap?: number;\n\tcreatedAt?: number;\n}\n\nexport class MockPriceService {\n\tprivate tokens = new Map<string, SimulatedToken>();\n\n\tstatic neutralTokenTrajectory(\n\t\tinitialPrice: number,\n\t): (step: number) => number {\n\t\treturn (step: number) => initialPrice * (1 + Math.sin(step / 10) * 0.02);\n\t}\n\n\taddToken(token: SimulatedToken): void {\n\t\tthis.tokens.set(token.address, token);\n\t\tthis.tokens.set(token.symbol.toUpperCase(), token);\n\t}\n\n\tgetToken(addressOrSymbol: string): SimulatedToken | undefined {\n\t\treturn (\n\t\t\tthis.tokens.get(addressOrSymbol) ??\n\t\t\tthis.tokens.get(addressOrSymbol.toUpperCase())\n\t\t);\n\t}\n\n\tgetPrice(addressOrSymbol: string): number | null {\n\t\tconst token = this.getToken(addressOrSymbol);\n\t\treturn token?.currentPrice ?? token?.initialPrice ?? null;\n\t}\n}\n"],"mappings":"AAgBO,MAAM,iBAAiB;AAAA,EACrB,SAAS,oBAAI,IAA4B;AAAA,EAEjD,OAAO,uBACN,cAC2B;AAC3B,WAAO,CAAC,SAAiB,gBAAgB,IAAI,KAAK,IAAI,OAAO,EAAE,IAAI;AAAA,EACpE;AAAA,EAEA,SAAS,OAA6B;AACrC,SAAK,OAAO,IAAI,MAAM,SAAS,KAAK;AACpC,SAAK,OAAO,IAAI,MAAM,OAAO,YAAY,GAAG,KAAK;AAAA,EAClD;AAAA,EAEA,SAAS,iBAAqD;AAC7D,WACC,KAAK,OAAO,IAAI,eAAe,KAC/B,KAAK,OAAO,IAAI,gBAAgB,YAAY,CAAC;AAAA,EAE/C;AAAA,EAEA,SAAS,iBAAwC;AAChD,UAAM,QAAQ,KAAK,SAAS,eAAe;AAC3C,WAAO,OAAO,gBAAgB,OAAO,gBAAgB;AAAA,EACtD;AACD;","names":[]}
@@ -0,0 +1,15 @@
1
+ import type { Provider } from "@elizaos/core";
2
+ /**
3
+ * socialAlphaProvider — Injects trust-score intelligence into agent context.
4
+ *
5
+ * When the agent processes a message, this provider:
6
+ * 1. Looks up the sender's trust profile (if they have one).
7
+ * 2. Provides a compact leaderboard summary (top callers + bottom callers).
8
+ * 3. Surfaces win rate, rank, avg P&L, scam detection stats.
9
+ *
10
+ * The agent can use this data to weigh recommendations, respond with trust
11
+ * context, or decline to act on low-trust callers.
12
+ */
13
+ export declare const socialAlphaProvider: Provider;
14
+ export default socialAlphaProvider;
15
+ //# sourceMappingURL=socialAlphaProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"socialAlphaProvider.d.ts","sourceRoot":"","sources":["../../src/providers/socialAlphaProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGX,QAAQ,EAGR,MAAM,eAAe,CAAC;AA4IvB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAmMjC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}