oculon 0.0.0-stage → 0.1.1

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 (255) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +344 -2
  3. package/dist/agent.d.ts +47 -0
  4. package/dist/agent.js +104 -0
  5. package/dist/cases.d.ts +68 -0
  6. package/dist/cases.js +158 -0
  7. package/dist/cli/main.d.ts +12 -0
  8. package/dist/cli/main.js +1999 -0
  9. package/dist/cli.d.ts +2 -0
  10. package/dist/cli.js +15 -0
  11. package/dist/core/context.d.ts +19 -0
  12. package/dist/core/context.js +19 -0
  13. package/dist/core/features.d.ts +22 -0
  14. package/dist/core/features.js +28 -0
  15. package/dist/core/graph.d.ts +38 -0
  16. package/dist/core/graph.js +81 -0
  17. package/dist/core/http.d.ts +42 -0
  18. package/dist/core/http.js +266 -0
  19. package/dist/core/keys.d.ts +8 -0
  20. package/dist/core/keys.js +22 -0
  21. package/dist/core/llm.d.ts +93 -0
  22. package/dist/core/llm.js +180 -0
  23. package/dist/core/merkle.d.ts +15 -0
  24. package/dist/core/merkle.js +46 -0
  25. package/dist/core/paths.d.ts +2 -0
  26. package/dist/core/paths.js +6 -0
  27. package/dist/core/png.d.ts +17 -0
  28. package/dist/core/png.js +101 -0
  29. package/dist/core/quota.d.ts +15 -0
  30. package/dist/core/quota.js +90 -0
  31. package/dist/core/stats.d.ts +24 -0
  32. package/dist/core/stats.js +67 -0
  33. package/dist/core/store.d.ts +20 -0
  34. package/dist/core/store.js +213 -0
  35. package/dist/core/text.d.ts +9 -0
  36. package/dist/core/text.js +30 -0
  37. package/dist/core/types.d.ts +38 -0
  38. package/dist/core/types.js +1 -0
  39. package/dist/index.d.ts +346 -0
  40. package/dist/index.js +503 -0
  41. package/dist/live.d.ts +53 -0
  42. package/dist/live.js +236 -0
  43. package/dist/mcp.d.ts +43 -0
  44. package/dist/mcp.js +651 -0
  45. package/dist/modules/airport.d.ts +60 -0
  46. package/dist/modules/airport.js +111 -0
  47. package/dist/modules/audit.d.ts +73 -0
  48. package/dist/modules/audit.js +211 -0
  49. package/dist/modules/bgp.d.ts +147 -0
  50. package/dist/modules/bgp.js +206 -0
  51. package/dist/modules/blackout.d.ts +41 -0
  52. package/dist/modules/blackout.js +98 -0
  53. package/dist/modules/brief.d.ts +26 -0
  54. package/dist/modules/brief.js +99 -0
  55. package/dist/modules/calendar.d.ts +27 -0
  56. package/dist/modules/calendar.js +145 -0
  57. package/dist/modules/calibrate.d.ts +46 -0
  58. package/dist/modules/calibrate.js +92 -0
  59. package/dist/modules/cloud.d.ts +32 -0
  60. package/dist/modules/cloud.js +94 -0
  61. package/dist/modules/condor.d.ts +66 -0
  62. package/dist/modules/condor.js +214 -0
  63. package/dist/modules/connect.d.ts +47 -0
  64. package/dist/modules/connect.js +114 -0
  65. package/dist/modules/contradictions.d.ts +27 -0
  66. package/dist/modules/contradictions.js +76 -0
  67. package/dist/modules/country.d.ts +82 -0
  68. package/dist/modules/country.js +136 -0
  69. package/dist/modules/cricket.d.ts +34 -0
  70. package/dist/modules/cricket.js +166 -0
  71. package/dist/modules/darkships.d.ts +219 -0
  72. package/dist/modules/darkships.js +400 -0
  73. package/dist/modules/defi.d.ts +237 -0
  74. package/dist/modules/defi.js +512 -0
  75. package/dist/modules/emailsec.d.ts +47 -0
  76. package/dist/modules/emailsec.js +146 -0
  77. package/dist/modules/exposure.d.ts +43 -0
  78. package/dist/modules/exposure.js +89 -0
  79. package/dist/modules/factcheck.d.ts +39 -0
  80. package/dist/modules/factcheck.js +127 -0
  81. package/dist/modules/falcon.d.ts +58 -0
  82. package/dist/modules/falcon.js +219 -0
  83. package/dist/modules/feedback.d.ts +24 -0
  84. package/dist/modules/feedback.js +37 -0
  85. package/dist/modules/fence.d.ts +52 -0
  86. package/dist/modules/fence.js +128 -0
  87. package/dist/modules/ferret.d.ts +47 -0
  88. package/dist/modules/ferret.js +220 -0
  89. package/dist/modules/filings.d.ts +86 -0
  90. package/dist/modules/filings.js +166 -0
  91. package/dist/modules/fires.d.ts +56 -0
  92. package/dist/modules/fires.js +150 -0
  93. package/dist/modules/hazards.d.ts +37 -0
  94. package/dist/modules/hazards.js +83 -0
  95. package/dist/modules/health.d.ts +24 -0
  96. package/dist/modules/health.js +82 -0
  97. package/dist/modules/heron.d.ts +68 -0
  98. package/dist/modules/heron.js +184 -0
  99. package/dist/modules/hound.d.ts +100 -0
  100. package/dist/modules/hound.js +301 -0
  101. package/dist/modules/impact.d.ts +39 -0
  102. package/dist/modules/impact.js +63 -0
  103. package/dist/modules/launches.d.ts +24 -0
  104. package/dist/modules/launches.js +61 -0
  105. package/dist/modules/listen.d.ts +48 -0
  106. package/dist/modules/listen.js +125 -0
  107. package/dist/modules/lynx.d.ts +43 -0
  108. package/dist/modules/lynx.js +127 -0
  109. package/dist/modules/magpie.d.ts +70 -0
  110. package/dist/modules/magpie.js +174 -0
  111. package/dist/modules/meerkat.d.ts +42 -0
  112. package/dist/modules/meerkat.js +293 -0
  113. package/dist/modules/monitor.d.ts +27 -0
  114. package/dist/modules/monitor.js +105 -0
  115. package/dist/modules/narratives.d.ts +33 -0
  116. package/dist/modules/narratives.js +136 -0
  117. package/dist/modules/owl.d.ts +71 -0
  118. package/dist/modules/owl.js +290 -0
  119. package/dist/modules/papers.d.ts +46 -0
  120. package/dist/modules/papers.js +135 -0
  121. package/dist/modules/personal.d.ts +54 -0
  122. package/dist/modules/personal.js +153 -0
  123. package/dist/modules/pulse.d.ts +19 -0
  124. package/dist/modules/pulse.js +59 -0
  125. package/dist/modules/raven.d.ts +80 -0
  126. package/dist/modules/raven.js +147 -0
  127. package/dist/modules/recall.d.ts +44 -0
  128. package/dist/modules/recall.js +123 -0
  129. package/dist/modules/regs.d.ts +88 -0
  130. package/dist/modules/regs.js +142 -0
  131. package/dist/modules/rewind.d.ts +22 -0
  132. package/dist/modules/rewind.js +68 -0
  133. package/dist/modules/sanctions.d.ts +62 -0
  134. package/dist/modules/sanctions.js +173 -0
  135. package/dist/modules/scam.d.ts +43 -0
  136. package/dist/modules/scam.js +149 -0
  137. package/dist/modules/scoop.d.ts +31 -0
  138. package/dist/modules/scoop.js +74 -0
  139. package/dist/modules/ships.d.ts +33 -0
  140. package/dist/modules/ships.js +113 -0
  141. package/dist/modules/sky.d.ts +47 -0
  142. package/dist/modules/sky.js +183 -0
  143. package/dist/modules/squawk.d.ts +46 -0
  144. package/dist/modules/squawk.js +106 -0
  145. package/dist/modules/tortoise.d.ts +59 -0
  146. package/dist/modules/tortoise.js +133 -0
  147. package/dist/modules/travel.d.ts +94 -0
  148. package/dist/modules/travel.js +241 -0
  149. package/dist/modules/urlcheck.d.ts +63 -0
  150. package/dist/modules/urlcheck.js +223 -0
  151. package/dist/modules/vulns.d.ts +142 -0
  152. package/dist/modules/vulns.js +276 -0
  153. package/dist/plugins.d.ts +41 -0
  154. package/dist/plugins.js +70 -0
  155. package/dist/report.d.ts +12 -0
  156. package/dist/report.js +90 -0
  157. package/dist/scheduler.d.ts +22 -0
  158. package/dist/scheduler.js +139 -0
  159. package/dist/sources/aircraft.d.ts +76 -0
  160. package/dist/sources/aircraft.js +107 -0
  161. package/dist/sources/airports.d.ts +28 -0
  162. package/dist/sources/airports.js +100 -0
  163. package/dist/sources/ais.d.ts +32 -0
  164. package/dist/sources/ais.js +111 -0
  165. package/dist/sources/apify.d.ts +28 -0
  166. package/dist/sources/apify.js +80 -0
  167. package/dist/sources/arxiv.d.ts +13 -0
  168. package/dist/sources/arxiv.js +27 -0
  169. package/dist/sources/certs.d.ts +12 -0
  170. package/dist/sources/certs.js +23 -0
  171. package/dist/sources/corp.d.ts +46 -0
  172. package/dist/sources/corp.js +60 -0
  173. package/dist/sources/earth.d.ts +39 -0
  174. package/dist/sources/earth.js +76 -0
  175. package/dist/sources/fda.d.ts +77 -0
  176. package/dist/sources/fda.js +121 -0
  177. package/dist/sources/finance.d.ts +181 -0
  178. package/dist/sources/finance.js +270 -0
  179. package/dist/sources/gdelt.d.ts +19 -0
  180. package/dist/sources/gdelt.js +33 -0
  181. package/dist/sources/github.d.ts +17 -0
  182. package/dist/sources/github.js +33 -0
  183. package/dist/sources/hackernews.d.ts +20 -0
  184. package/dist/sources/hackernews.js +37 -0
  185. package/dist/sources/labels.d.ts +21 -0
  186. package/dist/sources/labels.js +87 -0
  187. package/dist/sources/launch.d.ts +16 -0
  188. package/dist/sources/launch.js +41 -0
  189. package/dist/sources/ofac.d.ts +29 -0
  190. package/dist/sources/ofac.js +86 -0
  191. package/dist/sources/onchain.d.ts +77 -0
  192. package/dist/sources/onchain.js +189 -0
  193. package/dist/sources/opentimestamps.d.ts +49 -0
  194. package/dist/sources/opentimestamps.js +145 -0
  195. package/dist/sources/polymarket.d.ts +36 -0
  196. package/dist/sources/polymarket.js +70 -0
  197. package/dist/sources/predict.d.ts +18 -0
  198. package/dist/sources/predict.js +59 -0
  199. package/dist/sources/press.d.ts +30 -0
  200. package/dist/sources/press.js +111 -0
  201. package/dist/sources/resend.d.ts +14 -0
  202. package/dist/sources/resend.js +29 -0
  203. package/dist/sources/robinhood.d.ts +109 -0
  204. package/dist/sources/robinhood.js +129 -0
  205. package/dist/sources/sec.d.ts +67 -0
  206. package/dist/sources/sec.js +129 -0
  207. package/dist/sources/sentinel.d.ts +13 -0
  208. package/dist/sources/sentinel.js +63 -0
  209. package/dist/sources/signatures.d.ts +14 -0
  210. package/dist/sources/signatures.js +103 -0
  211. package/dist/sources/social.d.ts +22 -0
  212. package/dist/sources/social.js +56 -0
  213. package/dist/sources/space.d.ts +160 -0
  214. package/dist/sources/space.js +230 -0
  215. package/dist/sources/usgs.d.ts +17 -0
  216. package/dist/sources/usgs.js +24 -0
  217. package/dist/sources/wayback.d.ts +10 -0
  218. package/dist/sources/wayback.js +28 -0
  219. package/dist/sources/websec.d.ts +19 -0
  220. package/dist/sources/websec.js +40 -0
  221. package/dist/sources/wikidata.d.ts +11 -0
  222. package/dist/sources/wikidata.js +30 -0
  223. package/dist/sources/wikimedia.d.ts +28 -0
  224. package/dist/sources/wikimedia.js +52 -0
  225. package/dist/telegram.d.ts +104 -0
  226. package/dist/telegram.js +927 -0
  227. package/dist/web/assets/favicon-32.png +0 -0
  228. package/dist/web/assets/fx.js +178 -0
  229. package/dist/web/assets/icon-192.png +0 -0
  230. package/dist/web/assets/icon-512.png +0 -0
  231. package/dist/web/assets/icon-maskable-512.png +0 -0
  232. package/dist/web/assets/night-americas.jpg +0 -0
  233. package/dist/web/assets/night-emea.jpg +0 -0
  234. package/dist/web/assets/og.png +0 -0
  235. package/dist/web/assets/redsea-bm.jpg +0 -0
  236. package/dist/web/docs.html +281 -0
  237. package/dist/web/index.html +1828 -0
  238. package/dist/web/insights.d.ts +100 -0
  239. package/dist/web/insights.js +134 -0
  240. package/dist/web/landing.html +1144 -0
  241. package/dist/web/legal.html +176 -0
  242. package/dist/web/manifest.webmanifest +20 -0
  243. package/dist/web/mcp.html +104 -0
  244. package/dist/web/mcphttp.d.ts +10 -0
  245. package/dist/web/mcphttp.js +67 -0
  246. package/dist/web/openapi.d.ts +1 -0
  247. package/dist/web/openapi.js +51 -0
  248. package/dist/web/public.d.ts +45 -0
  249. package/dist/web/public.js +136 -0
  250. package/dist/web/server.d.ts +69 -0
  251. package/dist/web/server.js +764 -0
  252. package/dist/web/share.d.ts +35 -0
  253. package/dist/web/share.js +132 -0
  254. package/dist/web/sw.js +28 -0
  255. package/package.json +60 -4
@@ -0,0 +1,181 @@
1
+ /** Markets: Finnhub (stocks, insiders, company news), FRED (macro), CoinGecko (crypto). */
2
+ import { type Ctx } from '../core/context.js';
3
+ import type { Sourced } from '../core/types.js';
4
+ export interface Quote {
5
+ symbol: string;
6
+ price: number;
7
+ changePct: number;
8
+ high: number;
9
+ low: number;
10
+ prevClose: number;
11
+ }
12
+ export interface CompanyProfile {
13
+ name: string;
14
+ ticker: string;
15
+ exchange: string;
16
+ industry: string;
17
+ marketCapM: number;
18
+ weburl: string;
19
+ country: string;
20
+ }
21
+ export interface Insider {
22
+ name: string;
23
+ change: number;
24
+ shares: number;
25
+ date: string;
26
+ code: string;
27
+ price: number;
28
+ }
29
+ /** Best US common-stock symbol for a company name or ticker. */
30
+ export declare function findSymbol(ctx: Ctx, q: string): Promise<Sourced<string>>;
31
+ export declare function quote(ctx: Ctx, symbol: string): Promise<Sourced<Quote>>;
32
+ export declare function profile(ctx: Ctx, symbol: string): Promise<Sourced<CompanyProfile>>;
33
+ export declare function insiders(ctx: Ctx, symbol: string, days?: number): Promise<Sourced<Insider[]>>;
34
+ export interface NewsItem {
35
+ title: string;
36
+ url: string;
37
+ date: string;
38
+ source: string;
39
+ }
40
+ export declare function companyNews(ctx: Ctx, symbol: string, days?: number): Promise<Sourced<NewsItem[]>>;
41
+ export interface Recommendation {
42
+ period: string;
43
+ strongBuy: number;
44
+ buy: number;
45
+ hold: number;
46
+ sell: number;
47
+ strongSell: number;
48
+ }
49
+ /** Monthly analyst recommendation counts, newest first. */
50
+ export declare function recommendations(ctx: Ctx, symbol: string): Promise<Sourced<Recommendation[]>>;
51
+ /** Share of bullish ratings (strong buy + buy) in one month, 0-1. */
52
+ export declare const bullishShare: (r: Recommendation) => number | null;
53
+ export interface InsiderSentimentMonth {
54
+ /** YYYY-MM. */
55
+ month: string;
56
+ /** Net shares bought (+) or sold (-) by insiders. */
57
+ change: number;
58
+ /** Monthly share purchase ratio, -100 (all selling) to +100 (all buying). */
59
+ mspr: number;
60
+ }
61
+ export declare function insiderSentiment(ctx: Ctx, symbol: string, months?: number): Promise<Sourced<InsiderSentimentMonth[]>>;
62
+ /** Companies Finnhub groups with this one (same industry), excluding itself. */
63
+ export declare function peers(ctx: Ctx, symbol: string): Promise<Sourced<string[]>>;
64
+ export interface Ipo {
65
+ date: string;
66
+ symbol: string;
67
+ name: string;
68
+ exchange: string;
69
+ /** Single price or range, as Finnhub gives it, e.g. "10.00" or "17.00-19.00". */
70
+ price: string;
71
+ shares: number | null;
72
+ valueUsd: number | null;
73
+ status: string;
74
+ }
75
+ export declare function ipoCalendar(ctx: Ctx, from: string, to: string): Promise<Sourced<Ipo[]>>;
76
+ /** A compact subset of Finnhub's ~130 basic-financial metrics (the raw response is ~250 KB of history). */
77
+ export interface KeyMetrics {
78
+ peTTM: number | null;
79
+ psTTM: number | null;
80
+ pb: number | null;
81
+ epsTTM: number | null;
82
+ revenueGrowthTTMYoy: number | null;
83
+ epsGrowthTTMYoy: number | null;
84
+ grossMarginTTM: number | null;
85
+ netMarginTTM: number | null;
86
+ roeTTM: number | null;
87
+ debtToEquity: number | null;
88
+ currentRatio: number | null;
89
+ dividendYield: number | null;
90
+ beta: number | null;
91
+ high52w: number | null;
92
+ low52w: number | null;
93
+ return52w: number | null;
94
+ marketCapM: number | null;
95
+ }
96
+ export declare function metrics(ctx: Ctx, symbol: string): Promise<Sourced<KeyMetrics>>;
97
+ export interface EarningsSurprise {
98
+ period: string;
99
+ actual: number | null;
100
+ estimate: number | null;
101
+ surprisePct: number | null;
102
+ }
103
+ /** Last four quarters of reported EPS against the consensus estimate. */
104
+ export declare function earningsSurprises(ctx: Ctx, symbol: string): Promise<Sourced<EarningsSurprise[]>>;
105
+ export interface Lobbying {
106
+ /** Sum of reported lobbying income/expenses over the window (USD). */
107
+ totalUsd: number;
108
+ filings: number;
109
+ byPeriod: {
110
+ period: string;
111
+ usd: number;
112
+ }[];
113
+ latestUrl: string | null;
114
+ }
115
+ /** US Senate LDA lobbying disclosures linked to the company. */
116
+ export declare function lobbying(ctx: Ctx, symbol: string, days?: number): Promise<Sourced<Lobbying>>;
117
+ export interface GovContracts {
118
+ /** Distinct awards with an action in the window (latest action per award). */
119
+ awards: number;
120
+ /** Cumulative obligated value of those awards (multi-year contracts count in full), not money spent in the window. */
121
+ totalUsd: number;
122
+ topAgencies: {
123
+ agency: string;
124
+ usd: number;
125
+ }[];
126
+ latest: {
127
+ date: string;
128
+ agency: string;
129
+ usd: number;
130
+ description: string;
131
+ url: string;
132
+ }[];
133
+ }
134
+ /** US federal contract awards (USASpending.gov) to the company. The raw response can exceed 1 MB, so it is summarized. */
135
+ export declare function govContracts(ctx: Ctx, symbol: string, days?: number): Promise<Sourced<GovContracts>>;
136
+ export interface VisaFilings {
137
+ /** Finnhub returns at most 500 rows, so 500 means "500 or more". */
138
+ applications: number;
139
+ byClass: Record<string, number>;
140
+ topTitles: {
141
+ title: string;
142
+ count: number;
143
+ }[];
144
+ /** Median lower bound of the offered annual wage (USD). */
145
+ medianWageFrom: number | null;
146
+ }
147
+ /** H-1B / PERM labor certification filings (US DOL); a proxy for which roles a company hires from abroad. */
148
+ export declare function visaApplications(ctx: Ctx, symbol: string, days?: number): Promise<Sourced<VisaFilings>>;
149
+ export interface Patents {
150
+ /** Finnhub returns at most 250 rows, so 250 means "250 or more". */
151
+ count: number;
152
+ latest: {
153
+ date: string;
154
+ title: string;
155
+ number: string;
156
+ url: string;
157
+ }[];
158
+ }
159
+ /** USPTO patent applications and grants filed by the company. */
160
+ export declare function patents(ctx: Ctx, symbol: string, days?: number): Promise<Sourced<Patents>>;
161
+ export interface FredPoint {
162
+ date: string;
163
+ value: number;
164
+ }
165
+ export declare function fredSeries(ctx: Ctx, id: string, limit?: number): Promise<Sourced<FredPoint[]>>;
166
+ export interface TrendingCoin {
167
+ id: string;
168
+ name: string;
169
+ symbol: string;
170
+ rank: number | null;
171
+ change24h: number | null;
172
+ }
173
+ export declare function trendingCoins(ctx: Ctx): Promise<Sourced<TrendingCoin[]>>;
174
+ export declare function coinByContract(ctx: Ctx, platform: string, address: string): Promise<Sourced<{
175
+ id: string;
176
+ name: string;
177
+ symbol: string;
178
+ priceUsd: number | null;
179
+ marketCapUsd: number | null;
180
+ change24h: number | null;
181
+ }>>;
@@ -0,0 +1,270 @@
1
+ /** Markets: Finnhub (stocks, insiders, company news), FRED (macro), CoinGecko (crypto). */
2
+ import { DAY_MS, enc } from '../core/context.js';
3
+ import { key, noKey } from '../core/keys.js';
4
+ const FH = 'https://finnhub.io/api/v1';
5
+ const fh = (ctx, path, ttlSec) => {
6
+ const k = key('FINNHUB_API_KEY');
7
+ if (!k)
8
+ return Promise.resolve(noKey('finnhub', 'FINNHUB_API_KEY'));
9
+ return ctx.http.get(`${FH}${path}${path.includes('?') ? '&' : '?'}token=${k}`, { source: 'finnhub', ttlSec });
10
+ };
11
+ /** Best US common-stock symbol for a company name or ticker. */
12
+ export async function findSymbol(ctx, q) {
13
+ const r = await fh(ctx, `/search?q=${enc(q)}`, 7 * 86_400);
14
+ const hits = r.data?.result?.filter((x) => x.type === 'Common Stock' && !x.symbol.includes('.')) ?? [];
15
+ const exact = hits.find((x) => x.symbol.toLowerCase() === q.toLowerCase());
16
+ return { data: (exact ?? hits[0])?.symbol ?? null, prov: r.prov };
17
+ }
18
+ export async function quote(ctx, symbol) {
19
+ const r = await fh(ctx, `/quote?symbol=${enc(symbol)}`, 300);
20
+ return { data: r.data && r.data.c ? { symbol, price: r.data.c, changePct: r.data.dp, high: r.data.h, low: r.data.l, prevClose: r.data.pc } : null, prov: r.prov };
21
+ }
22
+ export async function profile(ctx, symbol) {
23
+ const r = await fh(ctx, `/stock/profile2?symbol=${enc(symbol)}`, 7 * 86_400);
24
+ const d = r.data;
25
+ return {
26
+ data: d?.name ? { name: d.name, ticker: d.ticker ?? symbol, exchange: d.exchange ?? '', industry: d.finnhubIndustry ?? '', marketCapM: d.marketCapitalization ?? 0, weburl: d.weburl ?? '', country: d.country ?? '' } : null,
27
+ prov: r.prov,
28
+ };
29
+ }
30
+ export async function insiders(ctx, symbol, days = 30) {
31
+ const from = new Date(ctx.now().getTime() - days * DAY_MS).toISOString().slice(0, 10);
32
+ const r = await fh(ctx, `/stock/insider-transactions?symbol=${enc(symbol)}&from=${from}`, 6 * 3600);
33
+ return { data: r.data?.data?.map((x) => ({ name: x.name, change: x.change, shares: x.share, date: x.transactionDate, code: x.transactionCode, price: x.transactionPrice })) ?? null, prov: r.prov };
34
+ }
35
+ export async function companyNews(ctx, symbol, days = 7) {
36
+ const to = ctx.now().toISOString().slice(0, 10);
37
+ const from = new Date(ctx.now().getTime() - days * DAY_MS).toISOString().slice(0, 10);
38
+ const r = await fh(ctx, `/company-news?symbol=${enc(symbol)}&from=${from}&to=${to}`, 1800);
39
+ return { data: r.data?.map((n) => ({ title: n.headline, url: n.url, date: new Date(n.datetime * 1000).toISOString(), source: n.source })) ?? null, prov: r.prov };
40
+ }
41
+ /** Monthly analyst recommendation counts, newest first. */
42
+ export async function recommendations(ctx, symbol) {
43
+ const r = await fh(ctx, `/stock/recommendation?symbol=${enc(symbol)}`, 12 * 3600);
44
+ return {
45
+ data: Array.isArray(r.data) ? r.data.map((x) => ({ period: x.period, strongBuy: x.strongBuy, buy: x.buy, hold: x.hold, sell: x.sell, strongSell: x.strongSell })).sort((a, b) => b.period.localeCompare(a.period)) : null,
46
+ prov: r.prov,
47
+ };
48
+ }
49
+ /** Share of bullish ratings (strong buy + buy) in one month, 0-1. */
50
+ export const bullishShare = (r) => {
51
+ const n = r.strongBuy + r.buy + r.hold + r.sell + r.strongSell;
52
+ return n ? (r.strongBuy + r.buy) / n : null;
53
+ };
54
+ export async function insiderSentiment(ctx, symbol, months = 12) {
55
+ const now = ctx.now();
56
+ const from = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth() - months, 1)).toISOString().slice(0, 10);
57
+ const r = await fh(ctx, `/stock/insider-sentiment?symbol=${enc(symbol)}&from=${from}&to=${now.toISOString().slice(0, 10)}`, 12 * 3600);
58
+ return {
59
+ data: r.data?.data?.map((x) => ({ month: `${x.year}-${String(x.month).padStart(2, '0')}`, change: x.change, mspr: Math.round(x.mspr * 10) / 10 })).sort((a, b) => b.month.localeCompare(a.month)) ?? null,
60
+ prov: r.prov,
61
+ };
62
+ }
63
+ /** Companies Finnhub groups with this one (same industry), excluding itself. */
64
+ export async function peers(ctx, symbol) {
65
+ const r = await fh(ctx, `/stock/peers?symbol=${enc(symbol)}`, 7 * 86_400);
66
+ return { data: Array.isArray(r.data) ? r.data.filter((s) => s.toUpperCase() !== symbol.toUpperCase()) : null, prov: r.prov };
67
+ }
68
+ export async function ipoCalendar(ctx, from, to) {
69
+ const r = await fh(ctx, `/calendar/ipo?from=${from}&to=${to}`, 6 * 3600);
70
+ return {
71
+ data: r.data?.ipoCalendar?.map((x) => ({ date: x.date, symbol: x.symbol ?? '', name: x.name, exchange: x.exchange ?? '', price: x.price ?? '', shares: x.numberOfShares ?? null, valueUsd: x.totalSharesValue ?? null, status: x.status ?? '' })) ?? null,
72
+ prov: r.prov,
73
+ };
74
+ }
75
+ export async function metrics(ctx, symbol) {
76
+ const k = key('FINNHUB_API_KEY');
77
+ if (!k)
78
+ return noKey('finnhub', 'FINNHUB_API_KEY');
79
+ const n = (v) => (typeof v === 'number' && Number.isFinite(v) ? v : null);
80
+ const r = await ctx.http.get(`${FH}/stock/metric?symbol=${enc(symbol)}&metric=all&token=${k}`, {
81
+ source: 'finnhub',
82
+ ttlSec: 24 * 3600,
83
+ keep: (d) => {
84
+ const m = d.metric;
85
+ if (!m || !Object.keys(m).length)
86
+ return null;
87
+ return {
88
+ peTTM: n(m.peTTM ?? m.peBasicExclExtraTTM),
89
+ psTTM: n(m.psTTM),
90
+ pb: n(m.pb ?? m.pbQuarterly),
91
+ epsTTM: n(m.epsTTM ?? m.epsBasicExclExtraItemsTTM),
92
+ revenueGrowthTTMYoy: n(m.revenueGrowthTTMYoy),
93
+ epsGrowthTTMYoy: n(m.epsGrowthTTMYoy),
94
+ grossMarginTTM: n(m.grossMarginTTM),
95
+ netMarginTTM: n(m.netProfitMarginTTM),
96
+ roeTTM: n(m.roeTTM),
97
+ debtToEquity: n(m['totalDebt/totalEquityQuarterly'] ?? m['totalDebt/totalEquityAnnual']),
98
+ currentRatio: n(m.currentRatioQuarterly ?? m.currentRatioAnnual),
99
+ dividendYield: n(m.currentDividendYieldTTM ?? m.dividendYieldIndicatedAnnual),
100
+ beta: n(m.beta),
101
+ high52w: n(m['52WeekHigh']),
102
+ low52w: n(m['52WeekLow']),
103
+ return52w: n(m['52WeekPriceReturnDaily']),
104
+ marketCapM: n(m.marketCapitalization),
105
+ };
106
+ },
107
+ });
108
+ return { data: r.data ?? null, prov: r.prov };
109
+ }
110
+ /** Last four quarters of reported EPS against the consensus estimate. */
111
+ export async function earningsSurprises(ctx, symbol) {
112
+ const r = await fh(ctx, `/stock/earnings?symbol=${enc(symbol)}`, 24 * 3600);
113
+ return { data: Array.isArray(r.data) ? r.data.map((x) => ({ period: x.period, actual: x.actual, estimate: x.estimate, surprisePct: x.surprisePercent })) : null, prov: r.prov };
114
+ }
115
+ /** US Senate LDA lobbying disclosures linked to the company. */
116
+ export async function lobbying(ctx, symbol, days = 730) {
117
+ const k = key('FINNHUB_API_KEY');
118
+ if (!k)
119
+ return noKey('finnhub', 'FINNHUB_API_KEY');
120
+ const to = ctx.now().toISOString().slice(0, 10);
121
+ const from = new Date(ctx.now().getTime() - days * DAY_MS).toISOString().slice(0, 10);
122
+ const r = await ctx.http.get(`${FH}/stock/lobbying?symbol=${enc(symbol)}&from=${from}&to=${to}&token=${k}`, {
123
+ source: 'finnhub',
124
+ ttlSec: 7 * 86_400,
125
+ keep: (d) => {
126
+ const rows = d.data ?? [];
127
+ if (!rows.length)
128
+ return null;
129
+ const per = new Map();
130
+ for (const x of rows) {
131
+ const p = `${x.year}-${x.period}`;
132
+ per.set(p, (per.get(p) ?? 0) + (x.income ?? 0) + (x.expenses ?? 0));
133
+ }
134
+ const byPeriod = [...per].map(([period, usd]) => ({ period, usd })).sort((a, b) => b.period.localeCompare(a.period));
135
+ const latest = [...rows].sort((a, b) => `${b.year}-${b.period}`.localeCompare(`${a.year}-${a.period}`))[0];
136
+ return { totalUsd: byPeriod.reduce((a, b) => a + b.usd, 0), filings: rows.length, byPeriod, latestUrl: latest?.documentUrl || null };
137
+ },
138
+ });
139
+ return { data: r.data ?? null, prov: r.prov };
140
+ }
141
+ /** US federal contract awards (USASpending.gov) to the company. The raw response can exceed 1 MB, so it is summarized. */
142
+ export async function govContracts(ctx, symbol, days = 365) {
143
+ const k = key('FINNHUB_API_KEY');
144
+ if (!k)
145
+ return noKey('finnhub', 'FINNHUB_API_KEY');
146
+ const to = ctx.now().toISOString().slice(0, 10);
147
+ const from = new Date(ctx.now().getTime() - days * DAY_MS).toISOString().slice(0, 10);
148
+ const r = await ctx.http.get(`${FH}/stock/usa-spending?symbol=${enc(symbol)}&from=${from}&to=${to}&token=${k}`, {
149
+ source: 'finnhub',
150
+ ttlSec: 7 * 86_400,
151
+ timeoutMs: 30_000,
152
+ keep: (d) => {
153
+ // Each row is a contract action; obligated amounts are cumulative per award, so keep the latest action per award.
154
+ const byAward = new Map();
155
+ for (const x of d.data ?? []) {
156
+ const k = x.permalink || `${x.awardingAgencyName}|${x.awardDescription ?? ''}|${x.actionDate}`;
157
+ const prev = byAward.get(k);
158
+ if (!prev || x.actionDate > prev.actionDate)
159
+ byAward.set(k, x);
160
+ }
161
+ const rows = [...byAward.values()];
162
+ if (!rows.length)
163
+ return null;
164
+ const val = (x) => x.obligatedAmount ?? x.totalValue ?? 0;
165
+ const ag = new Map();
166
+ for (const x of rows)
167
+ ag.set(x.awardingAgencyName, (ag.get(x.awardingAgencyName) ?? 0) + val(x));
168
+ return {
169
+ awards: rows.length,
170
+ totalUsd: rows.reduce((a, x) => a + val(x), 0),
171
+ topAgencies: [...ag].map(([agency, usd]) => ({ agency, usd })).sort((a, b) => b.usd - a.usd).slice(0, 5),
172
+ latest: [...rows]
173
+ .sort((a, b) => b.actionDate.localeCompare(a.actionDate))
174
+ .slice(0, 5)
175
+ .map((x) => ({ date: x.actionDate, agency: x.awardingAgencyName, usd: val(x), description: (x.awardDescription ?? '').slice(0, 200), url: x.permalink ?? '' })),
176
+ };
177
+ },
178
+ });
179
+ return { data: r.data ?? null, prov: r.prov };
180
+ }
181
+ /** H-1B / PERM labor certification filings (US DOL); a proxy for which roles a company hires from abroad. */
182
+ export async function visaApplications(ctx, symbol, days = 365) {
183
+ const k = key('FINNHUB_API_KEY');
184
+ if (!k)
185
+ return noKey('finnhub', 'FINNHUB_API_KEY');
186
+ const to = ctx.now().toISOString().slice(0, 10);
187
+ const from = new Date(ctx.now().getTime() - days * DAY_MS).toISOString().slice(0, 10);
188
+ const r = await ctx.http.get(`${FH}/stock/visa-application?symbol=${enc(symbol)}&from=${from}&to=${to}&token=${k}`, {
189
+ source: 'finnhub',
190
+ ttlSec: 7 * 86_400,
191
+ timeoutMs: 30_000,
192
+ keep: (d) => {
193
+ const rows = d.data ?? [];
194
+ if (!rows.length)
195
+ return null;
196
+ const byClass = {};
197
+ const titles = new Map();
198
+ for (const x of rows) {
199
+ byClass[x.visaClass || 'unknown'] = (byClass[x.visaClass || 'unknown'] ?? 0) + 1;
200
+ const t = (x.jobTitle ?? '').trim();
201
+ if (t)
202
+ titles.set(t, (titles.get(t) ?? 0) + 1);
203
+ }
204
+ const wages = rows
205
+ .filter((x) => !x.wageUnitOfPay || x.wageUnitOfPay === 'Year')
206
+ .map((x) => x.wageRangeFrom).filter((w) => typeof w === 'number' && w > 0).sort((a, b) => a - b);
207
+ return {
208
+ applications: rows.length,
209
+ byClass,
210
+ topTitles: [...titles].map(([title, count]) => ({ title, count })).sort((a, b) => b.count - a.count).slice(0, 8),
211
+ medianWageFrom: wages.length ? wages[Math.floor(wages.length / 2)] : null,
212
+ };
213
+ },
214
+ });
215
+ return { data: r.data ?? null, prov: r.prov };
216
+ }
217
+ /** USPTO patent applications and grants filed by the company. */
218
+ export async function patents(ctx, symbol, days = 365) {
219
+ const k = key('FINNHUB_API_KEY');
220
+ if (!k)
221
+ return noKey('finnhub', 'FINNHUB_API_KEY');
222
+ const to = ctx.now().toISOString().slice(0, 10);
223
+ const from = new Date(ctx.now().getTime() - days * DAY_MS).toISOString().slice(0, 10);
224
+ const r = await ctx.http.get(`${FH}/stock/uspto-patent?symbol=${enc(symbol)}&from=${from}&to=${to}&token=${k}`, {
225
+ source: 'finnhub',
226
+ ttlSec: 7 * 86_400,
227
+ timeoutMs: 30_000,
228
+ keep: (d) => {
229
+ const rows = d.data ?? [];
230
+ if (!rows.length)
231
+ return null;
232
+ return {
233
+ count: rows.length,
234
+ latest: [...rows]
235
+ .sort((a, b) => (b.publicationDate || b.filingDate).localeCompare(a.publicationDate || a.filingDate))
236
+ .slice(0, 5)
237
+ .map((x) => ({ date: (x.publicationDate || x.filingDate || '').slice(0, 10), title: x.description, number: x.patentNumber || x.applicationNumber, url: x.url ?? '' })),
238
+ };
239
+ },
240
+ });
241
+ return { data: r.data ?? null, prov: r.prov };
242
+ }
243
+ export async function fredSeries(ctx, id, limit = 24) {
244
+ const k = key('FRED_API_KEY');
245
+ if (!k)
246
+ return noKey('fred', 'FRED_API_KEY');
247
+ const r = await ctx.http.get(`https://api.stlouisfed.org/fred/series/observations?series_id=${enc(id)}&file_type=json&sort_order=desc&limit=${limit}&api_key=${k}`, { source: 'fred', ttlSec: 6 * 3600 });
248
+ return { data: r.data?.observations?.filter((o) => o.value !== '.').map((o) => ({ date: o.date, value: Number(o.value) })) ?? null, prov: r.prov };
249
+ }
250
+ const cgHeaders = () => {
251
+ const k = key('COINGECKO_API_KEY');
252
+ return k ? { 'x-cg-demo-api-key': k } : undefined;
253
+ };
254
+ export async function trendingCoins(ctx) {
255
+ const h = cgHeaders();
256
+ const r = await ctx.http.get('https://api.coingecko.com/api/v3/search/trending', { source: 'coingecko', ttlSec: 900, ...(h ? { headers: h } : {}) });
257
+ return {
258
+ data: r.data?.coins?.map(({ item }) => ({ id: item.id, name: item.name, symbol: item.symbol, rank: item.market_cap_rank, change24h: item.data?.price_change_percentage_24h?.usd ?? null })) ?? null,
259
+ prov: r.prov,
260
+ };
261
+ }
262
+ export async function coinByContract(ctx, platform, address) {
263
+ const h = cgHeaders();
264
+ const r = await ctx.http.get(`https://api.coingecko.com/api/v3/coins/${enc(platform)}/contract/${enc(address.toLowerCase())}`, { source: 'coingecko', ttlSec: 600, ...(h ? { headers: h } : {}) });
265
+ const d = r.data;
266
+ return {
267
+ data: d?.id ? { id: d.id, name: d.name ?? '', symbol: d.symbol ?? '', priceUsd: d.market_data?.current_price?.usd ?? null, marketCapUsd: d.market_data?.market_cap?.usd ?? null, change24h: d.market_data?.price_change_percentage_24h ?? null } : null,
268
+ prov: r.prov,
269
+ };
270
+ }
@@ -0,0 +1,19 @@
1
+ import { type Ctx } from '../core/context.js';
2
+ import type { Sourced } from '../core/types.js';
3
+ export interface GdeltPoint {
4
+ /** YYYYMMDD */
5
+ date: string;
6
+ /** Share of all monitored global news coverage, in percent. */
7
+ value: number;
8
+ }
9
+ export interface GdeltArticle {
10
+ url: string;
11
+ title: string;
12
+ seendate: string;
13
+ domain: string;
14
+ sourcecountry?: string;
15
+ }
16
+ export declare function gdeltQuery(q: string): string;
17
+ /** Daily share of global news coverage mentioning the query. */
18
+ export declare function coverageTimeline(ctx: Ctx, query: string, days?: number): Promise<Sourced<GdeltPoint[]>>;
19
+ export declare function latestArticles(ctx: Ctx, query: string, max?: number): Promise<Sourced<GdeltArticle[]>>;
@@ -0,0 +1,33 @@
1
+ import { enc } from '../core/context.js';
2
+ const GD = 'https://api.gdeltproject.org/api/v2/doc/doc';
3
+ const GDELT_LIMIT = /^Please limit requests/i;
4
+ export function gdeltQuery(q) {
5
+ const t = q.trim();
6
+ return /\s/.test(t) && !t.startsWith('"') ? `"${t}"` : t;
7
+ }
8
+ /** Daily share of global news coverage mentioning the query. */
9
+ export async function coverageTimeline(ctx, query, days = 56) {
10
+ const url = `${GD}?query=${enc(gdeltQuery(query))}&mode=timelinevol&timespan=${days}d&timelinesmooth=0&format=json`;
11
+ const r = await ctx.http.get(url, {
12
+ source: 'gdelt',
13
+ ttlSec: 3 * 3600,
14
+ timeoutMs: 30_000,
15
+ rateLimitText: GDELT_LIMIT,
16
+ });
17
+ const raw = r.data?.timeline?.[0]?.data;
18
+ if (!raw)
19
+ return { data: null, prov: r.data && r.prov.status !== 'ERROR' ? { ...r.prov, status: 'UNAVAILABLE' } : r.prov };
20
+ // Collapse to one value per day (GDELT may return sub-daily points).
21
+ const byDay = new Map();
22
+ for (const p of raw) {
23
+ const d = p.date.slice(0, 8);
24
+ byDay.set(d, [...(byDay.get(d) ?? []), p.value]);
25
+ }
26
+ const data = [...byDay].map(([date, vs]) => ({ date, value: vs.reduce((a, b) => a + b, 0) / vs.length }));
27
+ return { data, prov: r.prov };
28
+ }
29
+ export async function latestArticles(ctx, query, max = 10) {
30
+ const url = `${GD}?query=${enc(gdeltQuery(query))}&mode=artlist&maxrecords=${max}&sort=datedesc&timespan=3d&format=json`;
31
+ const r = await ctx.http.get(url, { source: 'gdelt', ttlSec: 1800, timeoutMs: 30_000, rateLimitText: GDELT_LIMIT });
32
+ return { data: r.data ? (r.data.articles ?? []) : null, prov: r.prov };
33
+ }
@@ -0,0 +1,17 @@
1
+ import { type Ctx } from '../core/context.js';
2
+ import type { Sourced } from '../core/types.js';
3
+ export interface Repo {
4
+ name: string;
5
+ full_name: string;
6
+ html_url: string;
7
+ description: string | null;
8
+ created_at: string;
9
+ pushed_at: string;
10
+ stargazers_count: number;
11
+ language: string | null;
12
+ fork: boolean;
13
+ }
14
+ /** Most recently created public repos of an org (falls back to a user account). */
15
+ export declare function recentRepos(ctx: Ctx, owner: string): Promise<Sourced<Repo[]>>;
16
+ /** Number of repositories matching a search query (e.g. `"ai agent" created:2026-10-01..2026-10-28`). */
17
+ export declare function repoCount(ctx: Ctx, query: string): Promise<Sourced<number>>;
@@ -0,0 +1,33 @@
1
+ import { enc } from '../core/context.js';
2
+ function headers() {
3
+ const h = { accept: 'application/vnd.github+json', 'x-github-api-version': '2022-11-28' };
4
+ const token = process.env.GITHUB_TOKEN?.trim();
5
+ if (token)
6
+ h.authorization = `Bearer ${token}`;
7
+ return h;
8
+ }
9
+ /** Most recently created public repos of an org (falls back to a user account). */
10
+ export async function recentRepos(ctx, owner) {
11
+ const q = 'sort=created&direction=desc&per_page=50';
12
+ const org = await ctx.http.get(`https://api.github.com/orgs/${enc(owner)}/repos?${q}`, {
13
+ source: 'github',
14
+ ttlSec: 3 * 3600,
15
+ headers: headers(),
16
+ });
17
+ if (org.prov.status !== 'UNAVAILABLE')
18
+ return org;
19
+ return ctx.http.get(`https://api.github.com/users/${enc(owner)}/repos?${q}`, {
20
+ source: 'github',
21
+ ttlSec: 3 * 3600,
22
+ headers: headers(),
23
+ });
24
+ }
25
+ /** Number of repositories matching a search query (e.g. `"ai agent" created:2026-10-01..2026-10-28`). */
26
+ export async function repoCount(ctx, query) {
27
+ const r = await ctx.http.get(`https://api.github.com/search/repositories?q=${enc(query)}&per_page=1`, {
28
+ source: 'github-search',
29
+ ttlSec: 6 * 3600,
30
+ headers: headers(),
31
+ });
32
+ return { data: r.data?.total_count ?? null, prov: r.prov };
33
+ }
@@ -0,0 +1,20 @@
1
+ import { type Ctx } from '../core/context.js';
2
+ import type { Provenance, Sourced } from '../core/types.js';
3
+ export interface HnStory {
4
+ objectID: string;
5
+ title: string;
6
+ url: string | null;
7
+ points: number;
8
+ num_comments: number;
9
+ created_at_i: number;
10
+ }
11
+ /** Story counts per week for `weeks` weeks, oldest first. Null if any bucket failed. */
12
+ export declare function weeklyStoryCounts(ctx: Ctx, query: string, weeks?: number): Promise<{
13
+ data: number[] | null;
14
+ provs: Provenance[];
15
+ }>;
16
+ /** Stories currently on the HN front page. */
17
+ export declare function frontPage(ctx: Ctx): Promise<Sourced<HnStory[]>>;
18
+ /** Most relevant/popular stories mentioning the query in the last `days` days. */
19
+ export declare function recentMentions(ctx: Ctx, query: string, days?: number, max?: number): Promise<Sourced<HnStory[]>>;
20
+ export declare const hnItemUrl: (id: string) => string;
@@ -0,0 +1,37 @@
1
+ import { DAY_MS, enc } from '../core/context.js';
2
+ const HN = 'https://hn.algolia.com/api/v1';
3
+ async function countBetween(ctx, query, from, to) {
4
+ const url = `${HN}/search?query=${enc(query)}&tags=story&hitsPerPage=0&numericFilters=${enc(`created_at_i>${from},created_at_i<=${to}`)}`;
5
+ const r = await ctx.http.get(url, { source: 'hackernews', ttlSec: 3 * 3600 });
6
+ return { data: r.data?.nbHits ?? null, prov: r.prov };
7
+ }
8
+ /** Story counts per week for `weeks` weeks, oldest first. Null if any bucket failed. */
9
+ export async function weeklyStoryCounts(ctx, query, weeks = 8) {
10
+ // Align bucket edges to whole hours so the cache key stays stable within a run.
11
+ const nowSec = Math.floor(ctx.now().getTime() / 3_600_000) * 3600;
12
+ const weekSec = (7 * DAY_MS) / 1000;
13
+ const results = await Promise.all(Array.from({ length: weeks }, (_, i) => {
14
+ const to = nowSec - (weeks - 1 - i) * weekSec;
15
+ return countBetween(ctx, query, to - weekSec, to);
16
+ }));
17
+ const provs = results.map((r) => r.prov);
18
+ if (results.some((r) => r.data === null))
19
+ return { data: null, provs };
20
+ return { data: results.map((r) => r.data), provs };
21
+ }
22
+ /** Stories currently on the HN front page. */
23
+ export async function frontPage(ctx) {
24
+ const r = await ctx.http.get(`${HN}/search?tags=front_page&hitsPerPage=50`, {
25
+ source: 'hackernews',
26
+ ttlSec: 600,
27
+ });
28
+ return { data: r.data?.hits ?? null, prov: r.prov };
29
+ }
30
+ /** Most relevant/popular stories mentioning the query in the last `days` days. */
31
+ export async function recentMentions(ctx, query, days = 14, max = 20) {
32
+ const since = Math.floor((ctx.now().getTime() - days * DAY_MS) / 3_600_000) * 3600;
33
+ const url = `${HN}/search?query=${enc(query)}&tags=story&hitsPerPage=${max}&numericFilters=${enc(`created_at_i>${since}`)}`;
34
+ const r = await ctx.http.get(url, { source: 'hackernews', ttlSec: 1800 });
35
+ return { data: r.data?.hits ?? null, prov: r.prov };
36
+ }
37
+ export const hnItemUrl = (id) => `https://news.ycombinator.com/item?id=${id}`;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Open address labels: the eth-labels dataset (MIT, github.com/dawsbot/eth-labels), about 100k addresses
3
+ * across EVM chains tagged by exchange, protocol, bridge, scam and so on. Downloaded once and indexed into the
4
+ * local database; refreshed when older than 14 days. Lookups are offline and free.
5
+ */
6
+ import type { Ctx } from '../core/context.js';
7
+ import type { Provenance } from '../core/types.js';
8
+ export interface AddressLabel {
9
+ chainId: number;
10
+ label: string;
11
+ nameTag: string;
12
+ }
13
+ /** Minimal CSV line parser for quoted fields. */
14
+ export declare function parseCsvLine(line: string): string[];
15
+ /** Load rows from CSV text into the table. Returns the number stored. */
16
+ export declare function loadLabels(ctx: Ctx, csv: string): number;
17
+ /** Make sure the dataset is present and fresh; downloads about 12 MB at most every 14 days. */
18
+ export declare function ensureLabels(ctx: Ctx): Promise<Provenance>;
19
+ export declare function labelsFor(ctx: Ctx, address: string): AddressLabel[];
20
+ /** Short human tag, e.g. "Binance 14 (binance)". */
21
+ export declare function describeLabels(ls: AddressLabel[]): string | null;