oculon 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +342 -0
  40. package/dist/index.js +495 -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 +111 -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 +40 -0
  146. package/dist/modules/tortoise.js +104 -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 +44 -0
  194. package/dist/sources/opentimestamps.js +131 -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 +263 -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 +1143 -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 +135 -0
  250. package/dist/web/server.d.ts +69 -0
  251. package/dist/web/server.js +750 -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,111 @@
1
+ /** News and web search: GNews, The Guardian, New York Times, Tavily, Exa, plus Jina/Firecrawl page reading. */
2
+ import { DAY_MS, enc } from '../core/context.js';
3
+ import { key, noKey } from '../core/keys.js';
4
+ export async function gnews(ctx, q, max = 10, earliest) {
5
+ if (earliest) {
6
+ const k = key('GNEWS_API_KEY');
7
+ if (!k)
8
+ return noKey('gnews', 'GNEWS_API_KEY');
9
+ // GNews has no oldest-first sort; bound the window instead so the earliest stories are inside it.
10
+ const r = await ctx.http.get(`https://gnews.io/api/v4/search?q=${enc(`"${q.replace(/"/g, '')}"`)}&lang=en&max=${max}&from=${enc(earliest.fromIso.slice(0, 19) + 'Z')}&sortby=publishedAt&apikey=${k}`, { source: 'gnews', ttlSec: 6 * 3600 });
11
+ return { data: r.data?.articles?.map((a) => ({ title: a.title, url: a.url, date: a.publishedAt, source: a.source?.name ?? 'gnews' })) ?? null, prov: r.prov };
12
+ }
13
+ const k = key('GNEWS_API_KEY');
14
+ if (!k)
15
+ return noKey('gnews', 'GNEWS_API_KEY');
16
+ const r = await ctx.http.get(`https://gnews.io/api/v4/search?q=${enc(`"${q.replace(/"/g, '')}"`)}&lang=en&max=${max}&sortby=publishedAt&apikey=${k}`, { source: 'gnews', ttlSec: 3 * 3600 });
17
+ return { data: r.data?.articles?.map((a) => ({ title: a.title, url: a.url, date: a.publishedAt, source: a.source?.name ?? 'gnews' })) ?? null, prov: r.prov };
18
+ }
19
+ export async function guardian(ctx, q, days = 14, max = 10, earliest) {
20
+ const k = key('GUARDIAN_API_KEY');
21
+ if (!k)
22
+ return noKey('guardian', 'GUARDIAN_API_KEY');
23
+ const from = earliest ? earliest.fromIso.slice(0, 10) : new Date(ctx.now().getTime() - days * DAY_MS).toISOString().slice(0, 10);
24
+ const r = await ctx.http.get(`https://content.guardianapis.com/search?q=${enc(`"${q.replace(/"/g, '')}"`)}&from-date=${from}&order-by=${earliest ? 'oldest' : 'newest'}&page-size=${max}&api-key=${k}`, { source: 'guardian', ttlSec: 3 * 3600 });
25
+ return { data: r.data?.response?.results?.map((a) => ({ title: a.webTitle, url: a.webUrl, date: a.webPublicationDate, source: 'The Guardian' })) ?? null, prov: r.prov };
26
+ }
27
+ /** Guardian news stories published on one day (YYYY-MM-DD), in the main news sections. */
28
+ export async function guardianDay(ctx, date, max = 30) {
29
+ const k = key('GUARDIAN_API_KEY');
30
+ if (!k)
31
+ return noKey('guardian', 'GUARDIAN_API_KEY');
32
+ const sections = 'world|us-news|uk-news|business|technology|politics|environment|science';
33
+ const r = await ctx.http.get(`https://content.guardianapis.com/search?from-date=${date}&to-date=${date}&section=${enc(sections)}&order-by=newest&page-size=${max}&api-key=${k}`, { source: 'guardian', ttlSec: 30 * 86_400 });
34
+ return { data: r.data?.response?.results?.map((a) => ({ title: a.webTitle, url: a.webUrl, date: a.webPublicationDate, source: 'The Guardian' })) ?? null, prov: r.prov };
35
+ }
36
+ /** Number of Guardian articles matching `q` between two dates (YYYY-MM-DD, inclusive). */
37
+ export async function guardianCount(ctx, q, from, to) {
38
+ const k = key('GUARDIAN_API_KEY');
39
+ if (!k)
40
+ return noKey('guardian', 'GUARDIAN_API_KEY');
41
+ const r = await ctx.http.get(`https://content.guardianapis.com/search?q=${enc(`"${q.replace(/"/g, '')}"`)}&from-date=${from}&to-date=${to}&page-size=1&api-key=${k}`, { source: 'guardian', ttlSec: 12 * 3600 });
42
+ return { data: r.data?.response?.total ?? null, prov: r.prov };
43
+ }
44
+ export async function nytSearch(ctx, q, days = 14, earliest) {
45
+ const k = key('NYT_API_KEY');
46
+ if (!k)
47
+ return noKey('nyt', 'NYT_API_KEY');
48
+ const begin = (earliest ? earliest.fromIso : new Date(ctx.now().getTime() - days * DAY_MS).toISOString()).slice(0, 10).replace(/-/g, '');
49
+ const r = await ctx.http.get(`https://api.nytimes.com/svc/search/v2/articlesearch.json?q=${enc(q)}&begin_date=${begin}&sort=${earliest ? 'oldest' : 'newest'}&api-key=${k}`, { source: 'nyt', ttlSec: 3 * 3600 });
50
+ return { data: r.data?.response ? (r.data.response.docs ?? []).map((d) => ({ title: d.headline?.main ?? '', url: d.web_url, date: d.pub_date, source: 'New York Times' })) : null, prov: r.prov };
51
+ }
52
+ export async function nytTopStories(ctx) {
53
+ const k = key('NYT_API_KEY');
54
+ if (!k)
55
+ return noKey('nyt', 'NYT_API_KEY');
56
+ const r = await ctx.http.get(`https://api.nytimes.com/svc/topstories/v2/home.json?api-key=${k}`, {
57
+ source: 'nyt',
58
+ ttlSec: 1800,
59
+ });
60
+ return { data: r.data?.results?.filter((s) => s.title).map((s) => ({ title: s.title, url: s.url, date: s.published_date, source: `NYT ${s.section}` })) ?? null, prov: r.prov };
61
+ }
62
+ /** Web search: Tavily first, Exa as fallback. */
63
+ export async function webSearch(ctx, q, max = 6, news = false) {
64
+ const tv = key('TAVILY_API_KEY');
65
+ if (tv) {
66
+ const r = await postJson(ctx, 'https://api.tavily.com/search', { query: q, max_results: max, ...(news ? { topic: 'news', days: 7 } : {}) }, { authorization: `Bearer ${tv}` }, 'tavily');
67
+ if (r.data)
68
+ return { data: r.data.results?.map((x) => ({ title: x.title, url: x.url, snippet: x.content.slice(0, 300), date: x.published_date ?? null })) ?? [], prov: r.prov };
69
+ }
70
+ const ex = key('EXA_API_KEY');
71
+ if (!ex)
72
+ return noKey('websearch', 'TAVILY_API_KEY or EXA_API_KEY');
73
+ const r = await postJson(ctx, 'https://api.exa.ai/search', { query: q, numResults: max, contents: { text: { maxCharacters: 300 } } }, { 'x-api-key': ex }, 'exa');
74
+ return { data: r.data?.results?.map((x) => ({ title: x.title, url: x.url, snippet: (x.text ?? '').slice(0, 300), date: x.publishedDate ?? null })) ?? null, prov: r.prov };
75
+ }
76
+ /** Readable text of a web page: Jina Reader first, Firecrawl as fallback. Capped at `maxChars`. */
77
+ export async function readPage(ctx, url, maxChars = 6000) {
78
+ if (!/^https?:\/\//i.test(url))
79
+ return { data: null, prov: { source: 'reader', url, status: 'ERROR', fetchedAt: new Date().toISOString(), note: 'only http(s) URLs' } };
80
+ const jina = key('JINA_API_KEY');
81
+ const r = await ctx.http.get(`https://r.jina.ai/${url}`, { source: 'jina', as: 'text', ttlSec: 6 * 3600, timeoutMs: 45_000, ...(jina ? { headers: { authorization: `Bearer ${jina}` } } : {}) });
82
+ if (r.data)
83
+ return { data: r.data.slice(0, maxChars), prov: r.prov };
84
+ const fc = key('FIRECRAWL_API_KEY');
85
+ if (!fc)
86
+ return r;
87
+ const f = await postJson(ctx, 'https://api.firecrawl.dev/v1/scrape', { url, formats: ['markdown'], onlyMainContent: true }, { authorization: `Bearer ${fc}` }, 'firecrawl');
88
+ return { data: f.data?.data?.markdown?.slice(0, maxChars) ?? null, prov: f.prov };
89
+ }
90
+ /**
91
+ * POST JSON with caching keyed on the body. Used for search APIs whose results are fine to reuse for a few hours.
92
+ */
93
+ export async function postJson(ctx, url, body, headers, source, ttlSec = 3 * 3600) {
94
+ const cacheKey = `post:${url}:${JSON.stringify(body)}`;
95
+ const cached = ctx.store.cacheGet(cacheKey);
96
+ if (cached && Date.now() - cached.fetchedAt < ttlSec * 1000) {
97
+ return { data: JSON.parse(cached.body), prov: { source, url, status: 'CACHED', fetchedAt: new Date(cached.fetchedAt).toISOString() } };
98
+ }
99
+ const r = await ctx.http.postBytes(url, new TextEncoder().encode(JSON.stringify(body)), { source, headers: { 'content-type': 'application/json', ...headers }, timeoutMs: 45_000 });
100
+ if (!r.data)
101
+ return { data: null, prov: r.prov };
102
+ try {
103
+ const text = r.data.toString('utf8');
104
+ const data = JSON.parse(text);
105
+ ctx.store.cachePut(cacheKey, text);
106
+ return { data, prov: r.prov };
107
+ }
108
+ catch {
109
+ return { data: null, prov: { ...r.prov, status: 'ERROR', note: 'invalid JSON' } };
110
+ }
111
+ }
@@ -0,0 +1,14 @@
1
+ export interface MailResult {
2
+ ok: boolean;
3
+ id?: string;
4
+ error?: string;
5
+ }
6
+ export declare const mailFrom: () => string;
7
+ export declare const mailEnabled: () => boolean;
8
+ export declare function sendEmail(msg: {
9
+ to: string;
10
+ subject: string;
11
+ html: string;
12
+ text: string;
13
+ unsubscribeUrl?: string;
14
+ }, fetchImpl?: typeof fetch): Promise<MailResult>;
@@ -0,0 +1,29 @@
1
+ /** Outgoing email through Resend (RESEND_API_KEY; free tier 3,000 emails a month). Never cached. */
2
+ import { key } from '../core/keys.js';
3
+ export const mailFrom = () => process.env.OCULON_MAIL_FROM?.trim() || 'Oculon <alerts@oculon.live>';
4
+ export const mailEnabled = () => Boolean(key('RESEND_API_KEY'));
5
+ export async function sendEmail(msg, fetchImpl = fetch) {
6
+ const k = key('RESEND_API_KEY');
7
+ if (!k)
8
+ return { ok: false, error: 'RESEND_API_KEY is not set' };
9
+ try {
10
+ const res = await fetchImpl('https://api.resend.com/emails', {
11
+ method: 'POST',
12
+ headers: { authorization: `Bearer ${k}`, 'content-type': 'application/json' },
13
+ body: JSON.stringify({
14
+ from: mailFrom(),
15
+ to: [msg.to],
16
+ subject: msg.subject,
17
+ html: msg.html,
18
+ text: msg.text,
19
+ ...(msg.unsubscribeUrl ? { headers: { 'List-Unsubscribe': `<${msg.unsubscribeUrl}>`, 'List-Unsubscribe-Post': 'List-Unsubscribe=One-Click' } } : {}),
20
+ }),
21
+ signal: AbortSignal.timeout(20_000),
22
+ });
23
+ const j = (await res.json().catch(() => ({})));
24
+ return res.ok ? { ok: true, id: j.id } : { ok: false, error: `HTTP ${res.status}${j.message ? ` (${j.message})` : ''}` };
25
+ }
26
+ catch (e) {
27
+ return { ok: false, error: e.message };
28
+ }
29
+ }
@@ -0,0 +1,109 @@
1
+ /** Robinhood Chain (id 4663) data: GeckoTerminal pools (keyless) and Blockscout explorer API. */
2
+ import { type Ctx } from '../core/context.js';
3
+ import type { Sourced } from '../core/types.js';
4
+ export declare const RH_CHAIN_ID = 4663;
5
+ export interface Pool {
6
+ name: string;
7
+ address: string;
8
+ token: string;
9
+ createdAt: string;
10
+ liquidityUsd: number;
11
+ volume24h: number;
12
+ change1h: number | null;
13
+ change24h: number | null;
14
+ buys24h: number;
15
+ sells24h: number;
16
+ buyers24h: number;
17
+ sellers24h: number;
18
+ fdvUsd: number | null;
19
+ url: string;
20
+ }
21
+ interface GtPool {
22
+ id: string;
23
+ attributes: {
24
+ name: string;
25
+ address: string;
26
+ pool_created_at: string;
27
+ reserve_in_usd?: string;
28
+ fdv_usd?: string | null;
29
+ volume_usd?: {
30
+ h24?: string;
31
+ };
32
+ price_change_percentage?: {
33
+ h1?: string;
34
+ h24?: string;
35
+ };
36
+ transactions?: {
37
+ h24?: {
38
+ buys?: number;
39
+ sells?: number;
40
+ buyers?: number;
41
+ sellers?: number;
42
+ };
43
+ };
44
+ };
45
+ relationships?: {
46
+ base_token?: {
47
+ data?: {
48
+ id?: string;
49
+ };
50
+ };
51
+ };
52
+ }
53
+ export declare function toPool(p: GtPool): Pool;
54
+ export declare const newPools: (ctx: Ctx) => Promise<Sourced<Pool[]>>;
55
+ export declare const trendingPools: (ctx: Ctx) => Promise<Sourced<Pool[]>>;
56
+ export declare const tokenPools: (ctx: Ctx, token: string) => Promise<Sourced<Pool[]>>;
57
+ export interface ChainStats {
58
+ blocks: number;
59
+ transactions: number;
60
+ addresses: number;
61
+ transactionsToday: number;
62
+ gasAverage: number | null;
63
+ }
64
+ export declare function chainStats(ctx: Ctx): Promise<Sourced<ChainStats>>;
65
+ export interface RhToken {
66
+ name: string;
67
+ symbol: string;
68
+ holders: number;
69
+ totalSupply: number;
70
+ decimals: number;
71
+ }
72
+ export declare function rhToken(ctx: Ctx, address: string): Promise<Sourced<RhToken>>;
73
+ /** Share of supply held by the 10 largest holders (0-1). */
74
+ export declare function topHolderShare(ctx: Ctx, address: string, totalSupply: number): Promise<Sourced<number>>;
75
+ /** Who deployed a contract (null for a plain wallet). */
76
+ export declare function contractCreator(ctx: Ctx, address: string): Promise<Sourced<{
77
+ creator: string;
78
+ creationTx: string | null;
79
+ } | null>>;
80
+ export interface CreatedContract {
81
+ address: string;
82
+ name: string | null;
83
+ createdAt: string;
84
+ }
85
+ /** Contracts deployed by an address, from its most recent transactions (one page, newest first). */
86
+ export declare function createdContracts(ctx: Ctx, deployer: string): Promise<Sourced<CreatedContract[]>>;
87
+ export declare function addressInfo(ctx: Ctx, address: string): Promise<Sourced<{
88
+ isContract: boolean;
89
+ name: string | null;
90
+ }>>;
91
+ export declare function txParties(ctx: Ctx, hash: string): Promise<Sourced<{
92
+ from: string;
93
+ to: string | null;
94
+ method: string | null;
95
+ }>>;
96
+ /**
97
+ * Tokens a wallet launched through a launchpad/factory contract: its transactions to the launcher, then the
98
+ * contracts each one created internally. Limited to the most recent `max` launches.
99
+ */
100
+ export declare function launchesVia(ctx: Ctx, wallet: string, launcher: string, max?: number): Promise<Sourced<CreatedContract[]>>;
101
+ export interface TokenMarket {
102
+ symbol: string;
103
+ reserveUsd: number;
104
+ volume24h: number;
105
+ }
106
+ /** Market data for up to 30 tokens in one GeckoTerminal call. Tokens without pools are simply absent. */
107
+ export declare function tokensMarket(ctx: Ctx, addresses: string[]): Promise<Sourced<Map<string, TokenMarket>>>;
108
+ export declare function isVerified(ctx: Ctx, address: string): Promise<Sourced<boolean>>;
109
+ export {};
@@ -0,0 +1,129 @@
1
+ /** Robinhood Chain (id 4663) data: GeckoTerminal pools (keyless) and Blockscout explorer API. */
2
+ import { enc } from '../core/context.js';
3
+ import { key } from '../core/keys.js';
4
+ export const RH_CHAIN_ID = 4663;
5
+ const GT = 'https://api.geckoterminal.com/api/v2/networks/robinhood';
6
+ const n = (v) => (v === null || v === undefined || v === '' ? null : Number(v));
7
+ export function toPool(p) {
8
+ const a = p.attributes;
9
+ const tx = a.transactions?.h24 ?? {};
10
+ return {
11
+ name: a.name,
12
+ address: a.address,
13
+ token: (p.relationships?.base_token?.data?.id ?? '').replace(/^robinhood_/, ''),
14
+ createdAt: a.pool_created_at,
15
+ liquidityUsd: n(a.reserve_in_usd) ?? 0,
16
+ volume24h: n(a.volume_usd?.h24) ?? 0,
17
+ change1h: n(a.price_change_percentage?.h1),
18
+ change24h: n(a.price_change_percentage?.h24),
19
+ buys24h: tx.buys ?? 0,
20
+ sells24h: tx.sells ?? 0,
21
+ buyers24h: tx.buyers ?? 0,
22
+ sellers24h: tx.sellers ?? 0,
23
+ fdvUsd: n(a.fdv_usd),
24
+ url: `https://www.geckoterminal.com/robinhood/pools/${a.address}`,
25
+ };
26
+ }
27
+ async function pools(ctx, path, ttlSec) {
28
+ const r = await ctx.http.get(`${GT}${path}`, { source: 'geckoterminal', ttlSec });
29
+ return { data: r.data?.data?.map(toPool) ?? null, prov: r.prov };
30
+ }
31
+ export const newPools = (ctx) => pools(ctx, '/new_pools?page=1', 120);
32
+ export const trendingPools = (ctx) => pools(ctx, '/trending_pools?page=1', 300);
33
+ export const tokenPools = (ctx, token) => pools(ctx, `/tokens/${enc(token)}/pools?page=1`, 300);
34
+ const bs = (path) => {
35
+ const k = key('BLOCKSCOUT_API_KEY');
36
+ return `https://api.blockscout.com/${RH_CHAIN_ID}/api/v2${path}${k ? `${path.includes('?') ? '&' : '?'}apikey=${k}` : ''}`;
37
+ };
38
+ export async function chainStats(ctx) {
39
+ const r = await ctx.http.get(bs('/stats'), {
40
+ source: 'blockscout',
41
+ ttlSec: 600,
42
+ });
43
+ const d = r.data;
44
+ return {
45
+ data: d?.total_blocks ? { blocks: Number(d.total_blocks), transactions: Number(d.total_transactions), addresses: Number(d.total_addresses), transactionsToday: Number(d.transactions_today ?? 0), gasAverage: d.gas_prices?.average ?? null } : null,
46
+ prov: r.prov,
47
+ };
48
+ }
49
+ export async function rhToken(ctx, address) {
50
+ const r = await ctx.http.get(bs(`/tokens/${enc(address)}`), { source: 'blockscout', ttlSec: 600 });
51
+ const d = r.data;
52
+ return {
53
+ data: d?.symbol !== undefined ? { name: d.name ?? '', symbol: d.symbol ?? '', holders: Number(d.holders_count ?? d.holders ?? 0), totalSupply: Number(d.total_supply ?? 0), decimals: Number(d.decimals ?? 18) } : null,
54
+ prov: r.prov,
55
+ };
56
+ }
57
+ /** Share of supply held by the 10 largest holders (0-1). */
58
+ export async function topHolderShare(ctx, address, totalSupply) {
59
+ const r = await ctx.http.get(bs(`/tokens/${enc(address)}/holders`), { source: 'blockscout', ttlSec: 600 });
60
+ if (!r.data?.items || !totalSupply)
61
+ return { data: null, prov: r.prov };
62
+ const top = r.data.items.slice(0, 10).reduce((a, h) => a + Number(h.value), 0);
63
+ return { data: Math.min(1, top / totalSupply), prov: r.prov };
64
+ }
65
+ /** Who deployed a contract (null for a plain wallet). */
66
+ export async function contractCreator(ctx, address) {
67
+ const r = await ctx.http.get(bs(`/addresses/${enc(address)}`), {
68
+ source: 'blockscout',
69
+ ttlSec: 86_400,
70
+ });
71
+ const d = r.data;
72
+ if (!d)
73
+ return { data: null, prov: r.prov };
74
+ return { data: d.creator_address_hash ? { creator: d.creator_address_hash, creationTx: d.creation_transaction_hash ?? d.creation_tx_hash ?? null } : null, prov: r.prov };
75
+ }
76
+ /** Contracts deployed by an address, from its most recent transactions (one page, newest first). */
77
+ export async function createdContracts(ctx, deployer) {
78
+ const r = await ctx.http.get(bs(`/addresses/${enc(deployer)}/transactions`), {
79
+ source: 'blockscout',
80
+ ttlSec: 3600,
81
+ });
82
+ return {
83
+ data: r.data?.items?.filter((t) => t.created_contract?.hash).map((t) => ({ address: t.created_contract.hash, name: t.created_contract.name ?? null, createdAt: t.timestamp ?? '' })) ?? null,
84
+ prov: r.prov,
85
+ };
86
+ }
87
+ export async function addressInfo(ctx, address) {
88
+ const r = await ctx.http.get(bs(`/addresses/${enc(address)}`), { source: 'blockscout', ttlSec: 86_400 });
89
+ return { data: r.data ? { isContract: Boolean(r.data.is_contract), name: r.data.name ?? null } : null, prov: r.prov };
90
+ }
91
+ export async function txParties(ctx, hash) {
92
+ const r = await ctx.http.get(bs(`/transactions/${enc(hash)}`), { source: 'blockscout', ttlSec: 30 * 86_400 });
93
+ return { data: r.data?.from ? { from: r.data.from.hash, to: r.data.to?.hash ?? null, method: r.data.method ?? null } : null, prov: r.prov };
94
+ }
95
+ /**
96
+ * Tokens a wallet launched through a launchpad/factory contract: its transactions to the launcher, then the
97
+ * contracts each one created internally. Limited to the most recent `max` launches.
98
+ */
99
+ export async function launchesVia(ctx, wallet, launcher, max = 15) {
100
+ const txs = await ctx.http.get(bs(`/addresses/${enc(wallet)}/transactions`), { source: 'blockscout', ttlSec: 3600 });
101
+ if (!txs.data)
102
+ return { data: null, prov: txs.prov };
103
+ const calls = (txs.data.items ?? []).filter((t) => t.to?.hash?.toLowerCase() === launcher.toLowerCase()).slice(0, max);
104
+ const out = [];
105
+ for (const t of calls) {
106
+ const it = await ctx.http.get(bs(`/transactions/${enc(t.hash)}/internal-transactions`), { source: 'blockscout', ttlSec: 30 * 86_400 });
107
+ for (const x of it.data?.items ?? [])
108
+ if ((x.type === 'create' || x.type === 'create2') && x.created_contract?.hash)
109
+ out.push({ address: x.created_contract.hash, name: x.created_contract.name ?? null, createdAt: t.timestamp ?? '' });
110
+ }
111
+ return { data: out, prov: txs.prov };
112
+ }
113
+ /** Market data for up to 30 tokens in one GeckoTerminal call. Tokens without pools are simply absent. */
114
+ export async function tokensMarket(ctx, addresses) {
115
+ const list = addresses.slice(0, 30);
116
+ if (!list.length)
117
+ return { data: new Map(), prov: { source: 'geckoterminal', url: '', status: 'LIVE', fetchedAt: new Date().toISOString(), note: 'nothing to look up' } };
118
+ const r = await ctx.http.get(`${GT}/tokens/multi/${list.join(',')}`, { source: 'geckoterminal', ttlSec: 900 });
119
+ const m = new Map();
120
+ for (const t of r.data?.data ?? [])
121
+ m.set(t.attributes.address.toLowerCase(), { symbol: t.attributes.symbol, reserveUsd: Number(t.attributes.total_reserve_in_usd ?? 0), volume24h: Number(t.attributes.volume_usd?.h24 ?? 0) });
122
+ return { data: r.data ? m : null, prov: r.prov };
123
+ }
124
+ export async function isVerified(ctx, address) {
125
+ const r = await ctx.http.get(bs(`/smart-contracts/${enc(address)}`), { source: 'blockscout', ttlSec: 3600 });
126
+ if (r.prov.status === 'UNAVAILABLE')
127
+ return { data: false, prov: { ...r.prov, status: 'LIVE', note: 'no verified source' } };
128
+ return { data: r.data ? Boolean(r.data.is_verified) : null, prov: r.prov };
129
+ }
@@ -0,0 +1,67 @@
1
+ import { type Ctx } from '../core/context.js';
2
+ import type { Sourced } from '../core/types.js';
3
+ export interface Company {
4
+ cik: number;
5
+ ticker: string;
6
+ name: string;
7
+ }
8
+ export interface Filing {
9
+ form: string;
10
+ date: string;
11
+ description: string;
12
+ url: string;
13
+ /** 8-K item codes such as 1.05 or 5.02, from the submissions feed. */
14
+ items?: string[];
15
+ accession?: string;
16
+ }
17
+ export declare function companies(ctx: Ctx): Promise<Sourced<Company[]>>;
18
+ /** Exact ticker match first, then the shortest company name that contains the query as a word. */
19
+ export declare function matchCompany(list: Company[], query: string): Company | null;
20
+ export declare function recentFilings(ctx: Ctx, cik: number, max?: number): Promise<Sourced<Filing[]>>;
21
+ export interface FullTextHit {
22
+ company: string;
23
+ ticker: string | null;
24
+ cik: number;
25
+ form: string;
26
+ filed: string;
27
+ /** The document type that matched, e.g. 8-K or EX-99.1. */
28
+ fileType: string;
29
+ items: string[];
30
+ location: string | null;
31
+ accession: string;
32
+ url: string;
33
+ /** EDGAR filing index page. */
34
+ indexUrl: string;
35
+ }
36
+ export interface FullTextResult {
37
+ total: number;
38
+ /** True when SEC caps the count (relation "gte"). */
39
+ totalIsLowerBound: boolean;
40
+ /** One entry per filing (exhibits of the same filing are merged), newest first. */
41
+ hits: FullTextHit[];
42
+ /** Companies with the most matching documents, from SEC's own aggregation. */
43
+ topCompanies: {
44
+ name: string;
45
+ docs: number;
46
+ }[];
47
+ }
48
+ export interface FullTextOptions {
49
+ /** e.g. ['8-K'] or ['10-K', '10-Q']. */
50
+ forms?: string[];
51
+ /** YYYY-MM-DD. */
52
+ from?: string;
53
+ to?: string;
54
+ /** Limit to one company. */
55
+ cik?: number;
56
+ /** Offset for paging (SEC returns 100 documents per page). */
57
+ offset?: number;
58
+ }
59
+ /** "Examplecorp Inc. (EXC) (CIK 0000000001)" -> name and ticker. */
60
+ export declare function parseDisplayName(s: string): {
61
+ name: string;
62
+ ticker: string | null;
63
+ };
64
+ /** EDGAR full-text search (2001 onward); the same index that powers sec.gov/edgar/search. Phrases need double quotes. */
65
+ export declare function fullTextSearch(ctx: Ctx, q: string, o?: FullTextOptions): Promise<Sourced<FullTextResult>>;
66
+ /** Plain text of one filing document (HTML stripped), capped in size; used to read 8-K item 5.02 details. */
67
+ export declare function filingText(ctx: Ctx, url: string, maxChars?: number): Promise<Sourced<string>>;
@@ -0,0 +1,129 @@
1
+ import { enc } from '../core/context.js';
2
+ /** SEC requires a User-Agent with contact details; without OCULON_CONTACT we do not call it at all. */
3
+ function contactMissing(url) {
4
+ return {
5
+ data: null,
6
+ prov: { source: 'sec-edgar', url, status: 'UNAVAILABLE', fetchedAt: new Date().toISOString(), note: 'set OCULON_CONTACT in .env to enable SEC EDGAR' },
7
+ };
8
+ }
9
+ const hasContact = () => Boolean(process.env.OCULON_CONTACT?.trim());
10
+ export async function companies(ctx) {
11
+ const url = 'https://www.sec.gov/files/company_tickers.json';
12
+ if (!hasContact())
13
+ return contactMissing(url);
14
+ const r = await ctx.http.get(url, { source: 'sec-edgar', ttlSec: 7 * 86_400 });
15
+ return { data: r.data ? Object.values(r.data).map((c) => ({ cik: c.cik_str, ticker: c.ticker, name: c.title })) : null, prov: r.prov };
16
+ }
17
+ /** Exact ticker match first, then the shortest company name that contains the query as a word. */
18
+ export function matchCompany(list, query) {
19
+ const q = query.trim().toLowerCase();
20
+ const byTicker = list.find((c) => c.ticker.toLowerCase() === q);
21
+ if (byTicker)
22
+ return byTicker;
23
+ const re = new RegExp(`\\b${q.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\b`, 'i');
24
+ return list.filter((c) => re.test(c.name)).sort((a, b) => a.name.length - b.name.length)[0] ?? null;
25
+ }
26
+ const archiveUrl = (cik, accession, doc) => `https://www.sec.gov/Archives/edgar/data/${Number(cik)}/${accession.replace(/-/g, '')}/${doc}`;
27
+ export async function recentFilings(ctx, cik, max = 40) {
28
+ const url = `https://data.sec.gov/submissions/CIK${String(cik).padStart(10, '0')}.json`;
29
+ if (!hasContact())
30
+ return contactMissing(url);
31
+ const r = await ctx.http.get(url, { source: 'sec-edgar', ttlSec: 1800 });
32
+ const rec = r.data?.filings?.recent;
33
+ if (!rec)
34
+ return { data: null, prov: r.prov };
35
+ const n = Math.min(max, rec.form?.length ?? 0);
36
+ const data = Array.from({ length: n }, (_, i) => {
37
+ const acc = rec.accessionNumber?.[i] ?? '';
38
+ const items = rec.items?.[i]
39
+ ?.split(',')
40
+ .map((x) => x.trim())
41
+ .filter(Boolean);
42
+ return {
43
+ form: rec.form?.[i] ?? '',
44
+ date: rec.filingDate?.[i] ?? '',
45
+ description: rec.primaryDocDescription?.[i] || rec.form?.[i] || '',
46
+ url: archiveUrl(cik, acc, rec.primaryDocument?.[i] ?? ''),
47
+ ...(items?.length ? { items } : {}),
48
+ ...(acc ? { accession: acc } : {}),
49
+ };
50
+ });
51
+ return { data, prov: r.prov };
52
+ }
53
+ /** "Examplecorp Inc. (EXC) (CIK 0000000001)" -> name and ticker. */
54
+ export function parseDisplayName(s) {
55
+ const m = s.match(/^(.*?)\s+(?:\(([A-Z0-9.\-, ]+)\)\s+)?\(CIK \d+\)\s*$/);
56
+ if (!m)
57
+ return { name: s.trim(), ticker: null };
58
+ return { name: m[1].trim(), ticker: m[2]?.split(',')[0]?.trim() || null };
59
+ }
60
+ /** EDGAR full-text search (2001 onward); the same index that powers sec.gov/edgar/search. Phrases need double quotes. */
61
+ export async function fullTextSearch(ctx, q, o = {}) {
62
+ const params = [`q=${enc(q)}`];
63
+ if (o.from || o.to)
64
+ params.push('dateRange=custom', ...(o.from ? [`startdt=${o.from}`] : []), ...(o.to ? [`enddt=${o.to}`] : []));
65
+ if (o.forms?.length)
66
+ params.push(`forms=${enc(o.forms.join(','))}`);
67
+ if (o.cik)
68
+ params.push(`ciks=${String(o.cik).padStart(10, '0')}`);
69
+ if (o.offset)
70
+ params.push(`from=${o.offset}`);
71
+ const url = `https://efts.sec.gov/LATEST/search-index?${params.join('&')}`;
72
+ if (!hasContact())
73
+ return contactMissing(url);
74
+ const r = await ctx.http.get(url, {
75
+ source: 'sec-edgar',
76
+ ttlSec: 3600,
77
+ // Raw pages are ~60 KB; keep only what we show.
78
+ keep: (d) => {
79
+ const byAcc = new Map();
80
+ for (const h of d.hits?.hits ?? []) {
81
+ const s = h._source;
82
+ const acc = s.adsh ?? h._id.split(':')[0] ?? '';
83
+ if (!acc || byAcc.has(acc))
84
+ continue;
85
+ const cik = Number(s.ciks?.[0] ?? 0);
86
+ const doc = h._id.split(':')[1] ?? '';
87
+ const dn = parseDisplayName(s.display_names?.[0] ?? '');
88
+ byAcc.set(acc, {
89
+ company: dn.name,
90
+ ticker: dn.ticker,
91
+ cik,
92
+ form: s.form ?? s.root_forms?.[0] ?? '',
93
+ filed: s.file_date ?? '',
94
+ fileType: s.file_type ?? '',
95
+ items: s.items ?? [],
96
+ location: s.biz_locations?.[0] ?? null,
97
+ accession: acc,
98
+ url: archiveUrl(cik, acc, doc),
99
+ indexUrl: `https://www.sec.gov/Archives/edgar/data/${cik}/${acc.replace(/-/g, '')}/${acc}-index.htm`,
100
+ });
101
+ }
102
+ return {
103
+ total: d.hits?.total?.value ?? 0,
104
+ totalIsLowerBound: d.hits?.total?.relation === 'gte',
105
+ hits: [...byAcc.values()].sort((a, b) => b.filed.localeCompare(a.filed)),
106
+ topCompanies: (d.aggregations?.entity_filter?.buckets ?? []).slice(0, 10).map((b) => ({ name: parseDisplayName(b.key).name, docs: b.doc_count })),
107
+ };
108
+ },
109
+ });
110
+ return { data: r.data, prov: r.prov };
111
+ }
112
+ /** Plain text of one filing document (HTML stripped), capped in size; used to read 8-K item 5.02 details. */
113
+ export async function filingText(ctx, url, maxChars = 20_000) {
114
+ if (!hasContact())
115
+ return contactMissing(url);
116
+ const r = await ctx.http.get(url, { source: 'sec-edgar', ttlSec: 30 * 86_400, as: 'text', timeoutMs: 20_000 });
117
+ if (!r.data)
118
+ return { data: null, prov: r.prov };
119
+ const text = r.data
120
+ .replace(/<(script|style)[\s\S]*?<\/\1>/gi, ' ')
121
+ .replace(/<[^>]+>/g, ' ')
122
+ .replace(/&nbsp;|&#160;/g, ' ')
123
+ .replace(/&amp;/g, '&')
124
+ .replace(/&#8217;|&rsquo;/g, "'")
125
+ .replace(/&#\d+;|&[a-z]+;/gi, ' ')
126
+ .replace(/\s+/g, ' ')
127
+ .trim();
128
+ return { data: text.slice(0, maxChars), prov: r.prov };
129
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copernicus Data Space (free account, OAuth client): Sentinel-2 true color at 10 m, and Sentinel-1 radar,
3
+ * which sees through clouds and at night, through the Sentinel Hub Process API.
4
+ * The least cloudy scene in the time window is used. Tokens are kept in memory only.
5
+ */
6
+ import type { Ctx } from '../core/context.js';
7
+ import type { Provenance } from '../core/types.js';
8
+ export type SentinelKind = 'optical' | 'radar';
9
+ /** [south, north, west, east] box, time window, image width; returns a PNG. */
10
+ export declare function sentinelImage(ctx: Ctx, box: [number, number, number, number], from: Date, to: Date, kind?: SentinelKind, width?: number): Promise<{
11
+ png: Buffer | null;
12
+ prov: Provenance;
13
+ }>;