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,35 @@
1
+ import type { Oculon } from '../index.js';
2
+ import type { ModuleResult } from '../core/types.js';
3
+ export declare const SHARE_KINDS: readonly ['url', 'factcheck', 'travel', 'audit', 'recall', 'emailsec', 'papers', 'country', 'airport'];
4
+ export type ShareKind = (typeof SHARE_KINDS)[number];
5
+ export interface ShareSummary {
6
+ kind: ShareKind;
7
+ label: string;
8
+ title: string;
9
+ verdict: string;
10
+ tone: 'ok' | 'warn' | 'bad' | 'info';
11
+ points: string[];
12
+ links: {
13
+ text: string;
14
+ url: string;
15
+ }[];
16
+ }
17
+ export interface Share {
18
+ id: string;
19
+ kind: ShareKind;
20
+ input: string;
21
+ createdAt: string;
22
+ summary: ShareSummary;
23
+ sources: string[];
24
+ }
25
+ type Anyr = Record<string, any>;
26
+ /** A plain summary of any shareable result: a title, a verdict, a few points and the key links. */
27
+ export declare function summarize(kind: ShareKind, r: Anyr): ShareSummary;
28
+ /** Runs the check for a shareable kind. */
29
+ export declare function runShareable(o: Oculon, kind: ShareKind, q: string): Promise<ModuleResult<unknown>>;
30
+ /** Runs the check and stores a snapshot; the same check within 6 hours reuses its link. */
31
+ export declare function createShare(o: Oculon, kind: string, input: string): Promise<Share>;
32
+ export declare function getShare(o: Oculon, id: string): Share | null;
33
+ /** The public page for a share, with Open Graph and Twitter card tags. */
34
+ export declare function sharePage(s: Share, origin: string, appUrl: string): string;
35
+ export {};
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Share links: a check (URL, claim, recall, travel...) is run on the server, its result is stored as a snapshot,
3
+ * and /r/<id> shows it as a page with link-preview tags. Results are never taken from the browser, so a shared
4
+ * page always shows what Oculon actually returned.
5
+ */
6
+ import { randomBytes } from 'node:crypto';
7
+ export const SHARE_KINDS = ['url', 'factcheck', 'travel', 'audit', 'recall', 'emailsec', 'papers', 'country', 'airport'];
8
+ const LABEL = { url: 'Link check', factcheck: 'Fact check', travel: 'Travel risk', audit: 'Dependency audit', recall: 'Recall check', emailsec: 'Email security', papers: 'Research brief', country: 'Country brief', airport: 'Airport status' };
9
+ const fmt = (n, unit) => {
10
+ if (n == null)
11
+ return 'n/a';
12
+ if (unit === 'USD')
13
+ return n >= 1e12 ? `$${(n / 1e12).toFixed(2)} trillion` : n >= 1e9 ? `$${(n / 1e9).toFixed(1)} billion` : `$${Math.round(n).toLocaleString('en-US')}`;
14
+ if (unit === 'people')
15
+ return n >= 1e6 ? `${(n / 1e6).toFixed(1)} million` : Math.round(n).toLocaleString('en-US');
16
+ return `${n.toFixed(1)}%`;
17
+ };
18
+ /** A plain summary of any shareable result: a title, a verdict, a few points and the key links. */
19
+ export function summarize(kind, r) {
20
+ const x = r.result;
21
+ const base = { kind, label: LABEL[kind] };
22
+ switch (kind) {
23
+ case 'url':
24
+ return { ...base, title: x.host, verdict: x.verdict, tone: x.verdict === 'malicious' ? 'bad' : x.verdict === 'suspicious' ? 'warn' : 'ok', points: [`Risk ${x.risk}/100`, ...x.reasons.slice(0, 5), ...(x.verdict === 'no known threats' ? ['No source flags it. That is not a guarantee the page is safe.'] : [])], links: x.scans?.latest ? [{ text: 'Latest urlscan.io scan', url: x.scans.latest }] : [] };
25
+ case 'factcheck': {
26
+ const all = [...x.factChecks, ...x.web];
27
+ const cited = all.filter((e) => !x.cited.length || x.cited.includes(e.n)).slice(0, 5);
28
+ return { ...base, title: x.claim, verdict: x.verdict, tone: /false|misleading/.test(x.verdict) ? 'bad' : /true/.test(x.verdict) ? 'ok' : 'warn', points: [x.summary.replace(/\s*\[\d+\]/g, ''), ...(x.confidence ? [`Confidence ${x.confidence}%`] : [])].filter(Boolean), links: cited.map((e) => ({ text: `${e.publisher}${e.rating ? `: "${e.rating}"` : ''}`, url: e.url })) };
29
+ }
30
+ case 'travel':
31
+ return { ...base, title: x.place.name.split(',').slice(0, 2).join(','), verdict: `${x.level} risk`, tone: x.level === 'low' ? 'ok' : x.level === 'moderate' ? 'warn' : 'bad', points: x.points.length ? x.points.slice(0, 6) : ['No warnings from the sources checked.'], links: [x.advisories.us && { text: 'US travel advisory', url: x.advisories.us.url }, x.advisories.uk && { text: 'UK travel advice', url: x.advisories.uk.url }].filter(Boolean) };
32
+ case 'audit': {
33
+ const s = x.summary;
34
+ const flagged = x.packages.filter((p) => p.flags.length).slice(0, 6);
35
+ return { ...base, title: `${s.checked} package${s.checked === 1 ? '' : 's'} checked`, verdict: s.vulnerable ? `${s.vulnerable} vulnerable` : 'no known vulnerabilities', tone: s.vulnerable ? 'bad' : s.deprecated || s.stale ? 'warn' : 'ok', points: flagged.map((p) => `${p.name}@${p.version}: ${p.flags.slice(0, 2).join('; ')}`), links: flagged.flatMap((p) => p.advisories.slice(0, 1).map((a) => ({ text: `${a.aliases[0] ?? a.id} (${p.name})`, url: a.url }))).slice(0, 5) };
36
+ }
37
+ case 'recall': {
38
+ const v = x.vehicle;
39
+ const title = v ? `${v.year} ${v.make} ${v.model}` : x.query;
40
+ const park = x.recalls.some((c) => c.parkIt || c.parkOutside);
41
+ return { ...base, title, verdict: x.recalls.length ? `${x.recalls.length} recall${x.recalls.length === 1 ? '' : 's'}` : 'no recalls found', tone: park ? 'bad' : x.recalls.length ? 'warn' : 'ok', points: [...x.recalls.slice(0, 5).map((c) => `${c.date ?? ''} ${c.title}: ${c.hazard}`.trim().slice(0, 220)), ...(x.note ? [x.note] : [])], links: x.recalls.slice(0, 5).map((c) => ({ text: `${c.source} ${c.id}`, url: c.url })) };
42
+ }
43
+ case 'emailsec':
44
+ return { ...base, title: x.domain, verdict: x.verdict, tone: x.verdict === 'protected' ? 'ok' : x.verdict === 'partly protected' ? 'warn' : 'bad', points: [`Score ${x.score}/100`, `SPF: ${x.spf.all ?? (x.spf.record ? 'present' : 'missing')}`, `DMARC: ${x.dmarc.policy ? `p=${x.dmarc.policy}` : 'missing'}`, `DKIM: ${x.dkim.selectorsFound.length ? x.dkim.selectorsFound.join(', ') : 'no common selector found'}`, ...x.fixes.slice(0, 3)], links: [] };
45
+ case 'papers':
46
+ return { ...base, title: x.topic, verdict: x.trend ? `field ${x.trend}` : `${x.totalWorks ?? 0} works`, tone: 'info', points: [...(x.overview ? [x.overview.replace(/\s*\[\d+(?:,\s*\d+)*\]/g, '')] : []), ...x.mostCited.slice(0, 4).map((p) => `${p.title} (${p.year}, ${p.citations} citations)`)], links: x.mostCited.slice(0, 5).map((p) => ({ text: p.title.slice(0, 80), url: p.openAccessUrl ?? p.url })) };
47
+ case 'country':
48
+ return { ...base, title: x.name, verdict: x.advisories.us ? `US advisory level ${x.advisories.us.level}` : x.region ?? '', tone: (x.advisories.us?.level ?? 1) >= 3 ? 'bad' : (x.advisories.us?.level ?? 1) === 2 ? 'warn' : 'info', points: [`Head of state: ${x.leaders.headOfState ?? 'n/a'}${x.leaders.headOfGovernment && x.leaders.headOfGovernment !== x.leaders.headOfState ? `; government: ${x.leaders.headOfGovernment}` : ''}`, ...x.indicators.filter((i) => i.value != null).map((i) => `${i.name}: ${fmt(i.value, i.unit)} (${i.year})`), ...(x.currency.perUsd ? [`1 USD = ${x.currency.perUsd.toFixed(2)} ${x.currency.code}`] : []), ...x.outages.slice(0, 1).map((o) => `Internet outage: ${o}`)], links: x.headlines.slice(0, 4).map((h) => ({ text: h.title, url: h.url })) };
49
+ case 'airport':
50
+ return { ...base, title: x.airport.name, verdict: x.verdict, tone: x.verdict === 'normal' ? 'ok' : x.verdict === 'disrupted' ? 'bad' : 'warn', points: x.points.slice(0, 6), links: [] };
51
+ }
52
+ }
53
+ /** Runs the check for a shareable kind. */
54
+ export async function runShareable(o, kind, q) {
55
+ switch (kind) {
56
+ case 'url': return o.urlCheck(q);
57
+ case 'factcheck': return o.factCheck(q);
58
+ case 'travel': return o.travel(q);
59
+ case 'audit': return o.audit(q);
60
+ case 'recall': return o.recall(q);
61
+ case 'emailsec': return o.emailSecurity(q);
62
+ case 'papers': return o.papers(q);
63
+ case 'country': return o.country(q);
64
+ case 'airport': return o.airport(q);
65
+ }
66
+ }
67
+ const sourcesOf = (prov) => [...new Set(prov.filter((p) => p.status === 'LIVE' || p.status === 'CACHED').map((p) => p.source))];
68
+ function table(o) {
69
+ o.ctx.store.db.exec('CREATE TABLE IF NOT EXISTS shares (id TEXT PRIMARY KEY, kind TEXT NOT NULL, input TEXT NOT NULL, payload TEXT NOT NULL, created_at INTEGER NOT NULL); CREATE INDEX IF NOT EXISTS shares_lookup ON shares (kind, input, created_at);');
70
+ return o.ctx.store.db;
71
+ }
72
+ /** Runs the check and stores a snapshot; the same check within 6 hours reuses its link. */
73
+ export async function createShare(o, kind, input) {
74
+ if (!SHARE_KINDS.includes(kind))
75
+ throw new Error(`cannot share "${kind}"`);
76
+ const k = kind;
77
+ const q = input.trim().slice(0, 2000);
78
+ if (!q)
79
+ throw new Error('missing input');
80
+ const db = table(o);
81
+ const recent = db.prepare('SELECT id FROM shares WHERE kind = ? AND input = ? AND created_at > ? ORDER BY created_at DESC LIMIT 1').get(k, q, Date.now() - 6 * 3600_000);
82
+ if (recent)
83
+ return getShare(o, recent.id);
84
+ const r = await runShareable(o, k, q);
85
+ const share = { id: randomBytes(6).toString('base64url'), kind: k, input: q, createdAt: new Date().toISOString(), summary: summarize(k, r), sources: sourcesOf(r.provenance) };
86
+ db.prepare('INSERT INTO shares (id, kind, input, payload, created_at) VALUES (?, ?, ?, ?, ?)').run(share.id, k, q, JSON.stringify(share), Date.now());
87
+ return share;
88
+ }
89
+ export function getShare(o, id) {
90
+ if (!/^[A-Za-z0-9_-]{6,16}$/.test(id))
91
+ return null;
92
+ const row = table(o).prepare('SELECT payload FROM shares WHERE id = ?').get(id);
93
+ return row ? JSON.parse(row.payload) : null;
94
+ }
95
+ const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
96
+ const safeUrl = (u) => (/^https?:\/\//i.test(u) ? esc(u) : '#');
97
+ /** The public page for a share, with Open Graph and Twitter card tags. */
98
+ export function sharePage(s, origin, appUrl) {
99
+ const x = s.summary;
100
+ const title = `${x.label}: ${x.title} · ${x.verdict}`;
101
+ const desc = (x.points[0] ?? '').slice(0, 200);
102
+ const url = `${origin}/r/${s.id}`;
103
+ const color = { ok: '#00f0ff', warn: '#ffd34d', bad: '#ff7a6b', info: '#e8e8e8' }[x.tone];
104
+ return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
105
+ <title>${esc(title)} · Oculon</title><meta name="description" content="${esc(desc)}">
106
+ <meta property="og:type" content="article"><meta property="og:site_name" content="Oculon"><meta property="og:title" content="${esc(title)}"><meta property="og:description" content="${esc(desc)}"><meta property="og:url" content="${esc(url)}"><meta property="og:image" content="${esc(origin)}/assets/og.png"><meta property="og:image:width" content="1200"><meta property="og:image:height" content="630">
107
+ <meta name="twitter:card" content="summary_large_image"><meta name="twitter:title" content="${esc(title)}"><meta name="twitter:description" content="${esc(desc)}"><meta name="twitter:image" content="${esc(origin)}/assets/og.png">
108
+ <link rel="icon" href="/favicon.ico"><link rel="preconnect" href="https://fonts.googleapis.com"><link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&family=Space+Mono:wght@400;700&display=swap" rel="stylesheet">
109
+ <style>
110
+ :root{--bg:#000;--card:#0a0a0a;--line:#1f1f1f;--text:#f2f2f2;--mut:#9aa5a7;--accent:#00f0ff}
111
+ @media (prefers-color-scheme:light){:root{--bg:#fff;--card:#fafafa;--line:#e4e4e4;--text:#0a0a0a;--mut:#555;--accent:#00838f}}
112
+ *{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font-family:'Space Grotesk',system-ui,sans-serif;line-height:1.55}
113
+ main{max-width:760px;margin:0 auto;padding:48px 16px 64px}
114
+ .brand{font-family:'Space Mono',monospace;letter-spacing:.2em;text-transform:uppercase;font-size:13px;color:var(--accent);text-decoration:none}
115
+ .kind{font-family:'Space Mono',monospace;font-size:12px;letter-spacing:.14em;text-transform:uppercase;color:var(--mut);margin-top:36px}
116
+ h1{font-weight:500;font-size:clamp(28px,5vw,44px);line-height:1.1;letter-spacing:-.02em;margin:10px 0 18px;overflow-wrap:anywhere}
117
+ .verdict{display:inline-block;font-family:'Space Mono',monospace;font-size:13px;text-transform:uppercase;letter-spacing:.08em;padding:4px 12px;border:1px solid ${color};color:${color}}
118
+ ul{list-style:none;padding:0;margin:26px 0;border-top:1px solid var(--line)}li{padding:12px 0;border-bottom:1px solid var(--line);overflow-wrap:anywhere}
119
+ h2{font-size:14px;font-family:'Space Mono',monospace;letter-spacing:.12em;text-transform:uppercase;color:var(--mut);font-weight:400;margin:30px 0 8px}
120
+ a{color:var(--accent)}.links a{display:block;padding:6px 0;text-decoration:none;overflow-wrap:anywhere}
121
+ .meta{color:var(--mut);font-size:14px}.cta{display:inline-block;margin-top:34px;background:var(--accent);color:#04130d;padding:11px 18px;text-decoration:none;font-weight:600}
122
+ </style></head><body><main>
123
+ <a class="brand" href="${esc(origin)}/">◉ Oculon</a>
124
+ <div class="kind">${esc(x.label)}</div>
125
+ <h1>${esc(x.title)}</h1>
126
+ <span class="verdict">${esc(x.verdict)}</span>
127
+ <ul>${x.points.map((p) => `<li>${esc(p)}</li>`).join('')}</ul>
128
+ ${x.links.length ? `<h2>Sources</h2><div class="links">${x.links.map((l) => `<a href="${safeUrl(l.url)}" target="_blank" rel="noopener noreferrer">${esc(l.text)} ↗</a>`).join('')}</div>` : ''}
129
+ <p class="meta">Checked ${esc(s.createdAt.slice(0, 16).replace('T', ' '))} UTC from ${esc(s.sources.join(', ') || 'public sources')}. A snapshot: run it again for the latest.</p>
130
+ <a class="cta" href="${esc(appUrl)}">Run your own check →</a>
131
+ </main></body></html>`;
132
+ }
package/dist/web/sw.js ADDED
@@ -0,0 +1,28 @@
1
+ // Oculon service worker: network first, so data is always live. The page shells and assets are kept
2
+ // as a fallback, so the app still opens (with its last-seen layout) when the server is unreachable.
3
+ const CACHE = 'oculon-shell-v1';
4
+ const SHELL = ['/', '/app', '/docs', '/privacy', '/terms', '/assets/fx.js', '/assets/icon-192.png'];
5
+
6
+ self.addEventListener('install', (e) => {
7
+ e.waitUntil(caches.open(CACHE).then((c) => c.addAll(SHELL)).catch(() => {}));
8
+ self.skipWaiting();
9
+ });
10
+
11
+ self.addEventListener('activate', (e) => {
12
+ e.waitUntil(caches.keys().then((keys) => Promise.all(keys.filter((k) => k !== CACHE).map((k) => caches.delete(k)))).then(() => self.clients.claim()));
13
+ });
14
+
15
+ self.addEventListener('fetch', (e) => {
16
+ const url = new URL(e.request.url);
17
+ if (e.request.method !== 'GET' || url.origin !== location.origin) return;
18
+ // Live data and the event stream are never cached.
19
+ if (url.pathname.startsWith('/api/')) return;
20
+ e.respondWith(
21
+ fetch(e.request)
22
+ .then((res) => {
23
+ if (res.ok) { const copy = res.clone(); caches.open(CACHE).then((c) => c.put(e.request, copy)).catch(() => {}); }
24
+ return res;
25
+ })
26
+ .catch(() => caches.match(e.request).then((hit) => hit || caches.match('/app'))),
27
+ );
28
+ });
package/package.json CHANGED
@@ -1,6 +1,62 @@
1
1
  {
2
2
  "name": "oculon",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Open-source intelligence engine and agent: cross-source signals with provenance from 50+ public sources (routing, exploits, ships, aircraft, satellites, markets), forecasts timestamped on Bitcoin. CLI, SDK, MCP server, web app and Telegram bot.",
5
+ "keywords": [
6
+ "osint",
7
+ "ai-agent",
8
+ "mcp",
9
+ "mcp-server",
10
+ "intelligence",
11
+ "satellite",
12
+ "ads-b",
13
+ "prediction-markets",
14
+ "opentimestamps",
15
+ "cli",
16
+ "bgp",
17
+ "cve",
18
+ "threat-intelligence"
19
+ ],
20
+ "license": "MIT",
21
+ "type": "module",
22
+ "engines": {
23
+ "node": ">=22.13"
24
+ },
25
+ "bin": {
26
+ "oculon": "dist/cli.js"
27
+ },
28
+ "main": "dist/index.js",
29
+ "types": "dist/index.d.ts",
30
+ "exports": {
31
+ ".": {
32
+ "types": "./dist/index.d.ts",
33
+ "default": "./dist/index.js"
34
+ },
35
+ "./package.json": "./package.json"
36
+ },
37
+ "files": [
38
+ "dist",
39
+ "README.md",
40
+ "LICENSE"
41
+ ],
42
+ "scripts": {
43
+ "build": "tsc -p tsconfig.build.json && node scripts/copy-assets.mjs",
44
+ "oculon": "node --import tsx src/cli.ts",
45
+ "test": "node --disable-warning=ExperimentalWarning --import tsx --test \"test/**/*.test.ts\"",
46
+ "typecheck": "tsc --noEmit",
47
+ "prepublishOnly": "npm run typecheck && npm test && npm run build"
48
+ },
49
+ "devDependencies": {
50
+ "@types/node": "^26.6.6",
51
+ "tsx": "^4.23.15",
52
+ "typescript": "^7.0.2"
53
+ },
54
+ "homepage": "https://oculon.live",
55
+ "repository": {
56
+ "type": "git",
57
+ "url": "git+https://github.com/oculonlive/oculon.git"
58
+ },
59
+ "bugs": {
60
+ "url": "https://github.com/oculonlive/oculon/issues"
61
+ }
62
+ }