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.
- package/LICENSE +21 -0
- package/README.md +344 -2
- package/dist/agent.d.ts +47 -0
- package/dist/agent.js +104 -0
- package/dist/cases.d.ts +68 -0
- package/dist/cases.js +158 -0
- package/dist/cli/main.d.ts +12 -0
- package/dist/cli/main.js +1999 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +15 -0
- package/dist/core/context.d.ts +19 -0
- package/dist/core/context.js +19 -0
- package/dist/core/features.d.ts +22 -0
- package/dist/core/features.js +28 -0
- package/dist/core/graph.d.ts +38 -0
- package/dist/core/graph.js +81 -0
- package/dist/core/http.d.ts +42 -0
- package/dist/core/http.js +266 -0
- package/dist/core/keys.d.ts +8 -0
- package/dist/core/keys.js +22 -0
- package/dist/core/llm.d.ts +93 -0
- package/dist/core/llm.js +180 -0
- package/dist/core/merkle.d.ts +15 -0
- package/dist/core/merkle.js +46 -0
- package/dist/core/paths.d.ts +2 -0
- package/dist/core/paths.js +6 -0
- package/dist/core/png.d.ts +17 -0
- package/dist/core/png.js +101 -0
- package/dist/core/quota.d.ts +15 -0
- package/dist/core/quota.js +90 -0
- package/dist/core/stats.d.ts +24 -0
- package/dist/core/stats.js +67 -0
- package/dist/core/store.d.ts +20 -0
- package/dist/core/store.js +213 -0
- package/dist/core/text.d.ts +9 -0
- package/dist/core/text.js +30 -0
- package/dist/core/types.d.ts +38 -0
- package/dist/core/types.js +1 -0
- package/dist/index.d.ts +342 -0
- package/dist/index.js +495 -0
- package/dist/live.d.ts +53 -0
- package/dist/live.js +236 -0
- package/dist/mcp.d.ts +43 -0
- package/dist/mcp.js +651 -0
- package/dist/modules/airport.d.ts +60 -0
- package/dist/modules/airport.js +111 -0
- package/dist/modules/audit.d.ts +73 -0
- package/dist/modules/audit.js +211 -0
- package/dist/modules/bgp.d.ts +147 -0
- package/dist/modules/bgp.js +206 -0
- package/dist/modules/blackout.d.ts +41 -0
- package/dist/modules/blackout.js +98 -0
- package/dist/modules/brief.d.ts +26 -0
- package/dist/modules/brief.js +99 -0
- package/dist/modules/calendar.d.ts +27 -0
- package/dist/modules/calendar.js +145 -0
- package/dist/modules/calibrate.d.ts +46 -0
- package/dist/modules/calibrate.js +92 -0
- package/dist/modules/cloud.d.ts +32 -0
- package/dist/modules/cloud.js +94 -0
- package/dist/modules/condor.d.ts +66 -0
- package/dist/modules/condor.js +214 -0
- package/dist/modules/connect.d.ts +47 -0
- package/dist/modules/connect.js +114 -0
- package/dist/modules/contradictions.d.ts +27 -0
- package/dist/modules/contradictions.js +76 -0
- package/dist/modules/country.d.ts +82 -0
- package/dist/modules/country.js +136 -0
- package/dist/modules/cricket.d.ts +34 -0
- package/dist/modules/cricket.js +166 -0
- package/dist/modules/darkships.d.ts +219 -0
- package/dist/modules/darkships.js +400 -0
- package/dist/modules/defi.d.ts +237 -0
- package/dist/modules/defi.js +512 -0
- package/dist/modules/emailsec.d.ts +47 -0
- package/dist/modules/emailsec.js +146 -0
- package/dist/modules/exposure.d.ts +43 -0
- package/dist/modules/exposure.js +89 -0
- package/dist/modules/factcheck.d.ts +39 -0
- package/dist/modules/factcheck.js +127 -0
- package/dist/modules/falcon.d.ts +58 -0
- package/dist/modules/falcon.js +219 -0
- package/dist/modules/feedback.d.ts +24 -0
- package/dist/modules/feedback.js +37 -0
- package/dist/modules/fence.d.ts +52 -0
- package/dist/modules/fence.js +128 -0
- package/dist/modules/ferret.d.ts +47 -0
- package/dist/modules/ferret.js +220 -0
- package/dist/modules/filings.d.ts +86 -0
- package/dist/modules/filings.js +166 -0
- package/dist/modules/fires.d.ts +56 -0
- package/dist/modules/fires.js +150 -0
- package/dist/modules/hazards.d.ts +37 -0
- package/dist/modules/hazards.js +83 -0
- package/dist/modules/health.d.ts +24 -0
- package/dist/modules/health.js +82 -0
- package/dist/modules/heron.d.ts +68 -0
- package/dist/modules/heron.js +184 -0
- package/dist/modules/hound.d.ts +100 -0
- package/dist/modules/hound.js +301 -0
- package/dist/modules/impact.d.ts +39 -0
- package/dist/modules/impact.js +63 -0
- package/dist/modules/launches.d.ts +24 -0
- package/dist/modules/launches.js +61 -0
- package/dist/modules/listen.d.ts +48 -0
- package/dist/modules/listen.js +125 -0
- package/dist/modules/lynx.d.ts +43 -0
- package/dist/modules/lynx.js +127 -0
- package/dist/modules/magpie.d.ts +70 -0
- package/dist/modules/magpie.js +174 -0
- package/dist/modules/meerkat.d.ts +42 -0
- package/dist/modules/meerkat.js +293 -0
- package/dist/modules/monitor.d.ts +27 -0
- package/dist/modules/monitor.js +105 -0
- package/dist/modules/narratives.d.ts +33 -0
- package/dist/modules/narratives.js +136 -0
- package/dist/modules/owl.d.ts +71 -0
- package/dist/modules/owl.js +290 -0
- package/dist/modules/papers.d.ts +46 -0
- package/dist/modules/papers.js +135 -0
- package/dist/modules/personal.d.ts +54 -0
- package/dist/modules/personal.js +153 -0
- package/dist/modules/pulse.d.ts +19 -0
- package/dist/modules/pulse.js +59 -0
- package/dist/modules/raven.d.ts +80 -0
- package/dist/modules/raven.js +147 -0
- package/dist/modules/recall.d.ts +44 -0
- package/dist/modules/recall.js +123 -0
- package/dist/modules/regs.d.ts +88 -0
- package/dist/modules/regs.js +142 -0
- package/dist/modules/rewind.d.ts +22 -0
- package/dist/modules/rewind.js +68 -0
- package/dist/modules/sanctions.d.ts +62 -0
- package/dist/modules/sanctions.js +173 -0
- package/dist/modules/scam.d.ts +43 -0
- package/dist/modules/scam.js +111 -0
- package/dist/modules/scoop.d.ts +31 -0
- package/dist/modules/scoop.js +74 -0
- package/dist/modules/ships.d.ts +33 -0
- package/dist/modules/ships.js +113 -0
- package/dist/modules/sky.d.ts +47 -0
- package/dist/modules/sky.js +183 -0
- package/dist/modules/squawk.d.ts +46 -0
- package/dist/modules/squawk.js +106 -0
- package/dist/modules/tortoise.d.ts +40 -0
- package/dist/modules/tortoise.js +104 -0
- package/dist/modules/travel.d.ts +94 -0
- package/dist/modules/travel.js +241 -0
- package/dist/modules/urlcheck.d.ts +63 -0
- package/dist/modules/urlcheck.js +223 -0
- package/dist/modules/vulns.d.ts +142 -0
- package/dist/modules/vulns.js +276 -0
- package/dist/plugins.d.ts +41 -0
- package/dist/plugins.js +70 -0
- package/dist/report.d.ts +12 -0
- package/dist/report.js +90 -0
- package/dist/scheduler.d.ts +22 -0
- package/dist/scheduler.js +139 -0
- package/dist/sources/aircraft.d.ts +76 -0
- package/dist/sources/aircraft.js +107 -0
- package/dist/sources/airports.d.ts +28 -0
- package/dist/sources/airports.js +100 -0
- package/dist/sources/ais.d.ts +32 -0
- package/dist/sources/ais.js +111 -0
- package/dist/sources/apify.d.ts +28 -0
- package/dist/sources/apify.js +80 -0
- package/dist/sources/arxiv.d.ts +13 -0
- package/dist/sources/arxiv.js +27 -0
- package/dist/sources/certs.d.ts +12 -0
- package/dist/sources/certs.js +23 -0
- package/dist/sources/corp.d.ts +46 -0
- package/dist/sources/corp.js +60 -0
- package/dist/sources/earth.d.ts +39 -0
- package/dist/sources/earth.js +76 -0
- package/dist/sources/fda.d.ts +77 -0
- package/dist/sources/fda.js +121 -0
- package/dist/sources/finance.d.ts +181 -0
- package/dist/sources/finance.js +270 -0
- package/dist/sources/gdelt.d.ts +19 -0
- package/dist/sources/gdelt.js +33 -0
- package/dist/sources/github.d.ts +17 -0
- package/dist/sources/github.js +33 -0
- package/dist/sources/hackernews.d.ts +20 -0
- package/dist/sources/hackernews.js +37 -0
- package/dist/sources/labels.d.ts +21 -0
- package/dist/sources/labels.js +87 -0
- package/dist/sources/launch.d.ts +16 -0
- package/dist/sources/launch.js +41 -0
- package/dist/sources/ofac.d.ts +29 -0
- package/dist/sources/ofac.js +86 -0
- package/dist/sources/onchain.d.ts +77 -0
- package/dist/sources/onchain.js +189 -0
- package/dist/sources/opentimestamps.d.ts +44 -0
- package/dist/sources/opentimestamps.js +131 -0
- package/dist/sources/polymarket.d.ts +36 -0
- package/dist/sources/polymarket.js +70 -0
- package/dist/sources/predict.d.ts +18 -0
- package/dist/sources/predict.js +59 -0
- package/dist/sources/press.d.ts +30 -0
- package/dist/sources/press.js +111 -0
- package/dist/sources/resend.d.ts +14 -0
- package/dist/sources/resend.js +29 -0
- package/dist/sources/robinhood.d.ts +109 -0
- package/dist/sources/robinhood.js +129 -0
- package/dist/sources/sec.d.ts +67 -0
- package/dist/sources/sec.js +129 -0
- package/dist/sources/sentinel.d.ts +13 -0
- package/dist/sources/sentinel.js +63 -0
- package/dist/sources/signatures.d.ts +14 -0
- package/dist/sources/signatures.js +103 -0
- package/dist/sources/social.d.ts +22 -0
- package/dist/sources/social.js +56 -0
- package/dist/sources/space.d.ts +160 -0
- package/dist/sources/space.js +230 -0
- package/dist/sources/usgs.d.ts +17 -0
- package/dist/sources/usgs.js +24 -0
- package/dist/sources/wayback.d.ts +10 -0
- package/dist/sources/wayback.js +28 -0
- package/dist/sources/websec.d.ts +19 -0
- package/dist/sources/websec.js +40 -0
- package/dist/sources/wikidata.d.ts +11 -0
- package/dist/sources/wikidata.js +30 -0
- package/dist/sources/wikimedia.d.ts +28 -0
- package/dist/sources/wikimedia.js +52 -0
- package/dist/telegram.d.ts +104 -0
- package/dist/telegram.js +927 -0
- package/dist/web/assets/favicon-32.png +0 -0
- package/dist/web/assets/fx.js +178 -0
- package/dist/web/assets/icon-192.png +0 -0
- package/dist/web/assets/icon-512.png +0 -0
- package/dist/web/assets/icon-maskable-512.png +0 -0
- package/dist/web/assets/night-americas.jpg +0 -0
- package/dist/web/assets/night-emea.jpg +0 -0
- package/dist/web/assets/og.png +0 -0
- package/dist/web/assets/redsea-bm.jpg +0 -0
- package/dist/web/docs.html +263 -0
- package/dist/web/index.html +1828 -0
- package/dist/web/insights.d.ts +100 -0
- package/dist/web/insights.js +134 -0
- package/dist/web/landing.html +1143 -0
- package/dist/web/legal.html +176 -0
- package/dist/web/manifest.webmanifest +20 -0
- package/dist/web/mcp.html +104 -0
- package/dist/web/mcphttp.d.ts +10 -0
- package/dist/web/mcphttp.js +67 -0
- package/dist/web/openapi.d.ts +1 -0
- package/dist/web/openapi.js +51 -0
- package/dist/web/public.d.ts +45 -0
- package/dist/web/public.js +135 -0
- package/dist/web/server.d.ts +69 -0
- package/dist/web/server.js +750 -0
- package/dist/web/share.d.ts +35 -0
- package/dist/web/share.js +132 -0
- package/dist/web/sw.js +28 -0
- package/package.json +60 -4
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public mode: what a server open to the internet may show.
|
|
3
|
+
*
|
|
4
|
+
* Without the admin cookie a visitor gets the overview page, the docs, the legal pages and a read-only
|
|
5
|
+
* API limited to the endpoints those pages use. Writes, the dashboard, LLM-backed endpoints and anything
|
|
6
|
+
* personal (watchlist, cases, geofences, feedback) stay closed. Requests are rate limited per client.
|
|
7
|
+
* The owner signs in once with OCULON_ADMIN_TOKEN and then has the full app.
|
|
8
|
+
*/
|
|
9
|
+
import { createHash, timingSafeEqual } from 'node:crypto';
|
|
10
|
+
/** Read-only endpoints the public pages call. Everything else needs the admin cookie. */
|
|
11
|
+
export const PUBLIC_API = new Set([
|
|
12
|
+
'/api/meta',
|
|
13
|
+
'/api/readme',
|
|
14
|
+
'/api/console',
|
|
15
|
+
'/api/signals',
|
|
16
|
+
'/api/stream',
|
|
17
|
+
'/api/bgp',
|
|
18
|
+
'/api/vulns',
|
|
19
|
+
'/api/hazards',
|
|
20
|
+
'/api/robinhood',
|
|
21
|
+
'/api/rhtoken',
|
|
22
|
+
'/api/squawks',
|
|
23
|
+
'/api/defi',
|
|
24
|
+
'/api/quakes',
|
|
25
|
+
'/api/military',
|
|
26
|
+
'/api/events',
|
|
27
|
+
'/api/space',
|
|
28
|
+
'/api/cloud',
|
|
29
|
+
'/api/blackout',
|
|
30
|
+
'/api/calendar',
|
|
31
|
+
'/api/narratives',
|
|
32
|
+
'/api/forecasts',
|
|
33
|
+
'/api/verify',
|
|
34
|
+
'/api/graph',
|
|
35
|
+
'/api/quota',
|
|
36
|
+
'/api/url',
|
|
37
|
+
'/api/travel',
|
|
38
|
+
'/api/audit',
|
|
39
|
+
'/api/recall',
|
|
40
|
+
'/api/emailsec',
|
|
41
|
+
'/api/country',
|
|
42
|
+
'/api/airport',
|
|
43
|
+
'/api/share',
|
|
44
|
+
'/api/scam',
|
|
45
|
+
]);
|
|
46
|
+
/** Endpoints that start outside work (a CLI process or several upstream calls) get a tighter budget. */
|
|
47
|
+
const HEAVY = new Set(['/api/console', '/api/rhtoken', '/api/verify', '/api/url', '/api/travel', '/api/audit', '/api/recall', '/api/emailsec', '/api/country', '/api/airport', '/api/scam']);
|
|
48
|
+
/** Signals from these modules describe the owner's own watchlist, cases, fences, votes or raw social streams. */
|
|
49
|
+
const PRIVATE_MODULES = new Set(['meerkat', 'case', 'fence', 'feedback', 'live']);
|
|
50
|
+
export function publicSignals(list) {
|
|
51
|
+
return list.filter((s) => !PRIVATE_MODULES.has(s.module));
|
|
52
|
+
}
|
|
53
|
+
/** Drops case and watch entities (and their edges) from a graph slice. */
|
|
54
|
+
export function publicGraph(g) {
|
|
55
|
+
const hide = (n) => /^event:(case|watch|fence)/i.test(n.id) || /^(case #|watch:|fence:)/i.test(n.name);
|
|
56
|
+
const hidden = new Set(g.nodes.filter(hide).map((n) => n.id));
|
|
57
|
+
return { nodes: g.nodes.filter((n) => !hidden.has(n.id)), edges: g.edges.filter((e) => !hidden.has(e.src) && !hidden.has(e.dst)) };
|
|
58
|
+
}
|
|
59
|
+
/** The client address: Cloudflare and Railway put the real one in a header. */
|
|
60
|
+
export function clientIp(req) {
|
|
61
|
+
const h = (name) => {
|
|
62
|
+
const v = req.headers[name];
|
|
63
|
+
return (Array.isArray(v) ? v[0] : v)?.split(',')[0]?.trim();
|
|
64
|
+
};
|
|
65
|
+
return h('cf-connecting-ip') || h('x-real-ip') || h('x-forwarded-for') || req.socket.remoteAddress || 'unknown';
|
|
66
|
+
}
|
|
67
|
+
/** Fixed-window limiter: `perMinute` requests per client per minute, separately for heavy endpoints. */
|
|
68
|
+
export class RateLimiter {
|
|
69
|
+
perMinute;
|
|
70
|
+
heavyPerMinute;
|
|
71
|
+
hits = new Map();
|
|
72
|
+
constructor(perMinute = 180, heavyPerMinute = 10) {
|
|
73
|
+
this.perMinute = perMinute;
|
|
74
|
+
this.heavyPerMinute = heavyPerMinute;
|
|
75
|
+
}
|
|
76
|
+
allow(ip, path, now = Date.now()) {
|
|
77
|
+
const heavy = HEAVY.has(path);
|
|
78
|
+
const key = `${heavy ? 'h' : 'n'}:${ip}`;
|
|
79
|
+
const w = this.hits.get(key);
|
|
80
|
+
if (!w || now - w.start >= 60_000) {
|
|
81
|
+
this.hits.set(key, { start: now, n: 1 });
|
|
82
|
+
if (this.hits.size > 20_000)
|
|
83
|
+
this.prune(now);
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
w.n++;
|
|
87
|
+
return w.n <= (heavy ? this.heavyPerMinute : this.perMinute);
|
|
88
|
+
}
|
|
89
|
+
prune(now) {
|
|
90
|
+
for (const [k, w] of this.hits)
|
|
91
|
+
if (now - w.start >= 60_000)
|
|
92
|
+
this.hits.delete(k);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const digest = (s) => createHash('sha256').update(`oculon-admin:${s}`).digest('hex');
|
|
96
|
+
/** Cookie value for a valid token. The token itself is never stored in the browser. */
|
|
97
|
+
export function adminCookieValue(token) {
|
|
98
|
+
return digest(token);
|
|
99
|
+
}
|
|
100
|
+
export function isAdmin(req, token) {
|
|
101
|
+
if (!token)
|
|
102
|
+
return false;
|
|
103
|
+
const m = /(?:^|;\s*)oculon_admin=([a-f0-9]{64})/.exec(String(req.headers.cookie ?? ''));
|
|
104
|
+
if (!m)
|
|
105
|
+
return false;
|
|
106
|
+
const a = Buffer.from(m[1], 'hex');
|
|
107
|
+
const b = Buffer.from(digest(token), 'hex');
|
|
108
|
+
return a.length === b.length && timingSafeEqual(a, b);
|
|
109
|
+
}
|
|
110
|
+
export function tokenMatches(given, token) {
|
|
111
|
+
if (!token || !given)
|
|
112
|
+
return false;
|
|
113
|
+
const a = Buffer.from(digest(given), 'hex');
|
|
114
|
+
const b = Buffer.from(digest(token), 'hex');
|
|
115
|
+
return timingSafeEqual(a, b);
|
|
116
|
+
}
|
|
117
|
+
/** Shown at /app to visitors of a public install. */
|
|
118
|
+
export function lockedPage(signInAvailable, failed = false) {
|
|
119
|
+
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Oculon</title>
|
|
120
|
+
<link rel="icon" type="image/png" href="/favicon.ico"><meta name="theme-color" content="#000000">
|
|
121
|
+
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;600&family=Space+Mono&display=swap" rel="stylesheet">
|
|
122
|
+
<style>body{margin:0;min-height:100vh;display:grid;place-items:center;background:radial-gradient(ellipse at 70% 10%,rgba(0,240,255,.12),transparent 60%),#000;color:#fff;font-family:'Space Grotesk',system-ui,sans-serif;padding:24px}
|
|
123
|
+
.box{max-width:560px}.k{font:12px 'Space Mono',monospace;letter-spacing:.14em;text-transform:uppercase;color:#00f0ff}
|
|
124
|
+
h1{font-size:clamp(34px,6vw,54px);font-weight:300;letter-spacing:-.03em;line-height:1.05;margin:14px 0}
|
|
125
|
+
p{color:#b9c9cc;font-size:17px;line-height:1.65}code{font:14px 'Space Mono',monospace;background:#071114;border:1px solid #163038;padding:2px 7px;color:#e6fbff}
|
|
126
|
+
.cmd{margin:22px 0;display:flex;gap:12px;align-items:center;border:1px solid #1d3a41;background:#050b0c;padding:14px 16px;font:15px 'Space Mono',monospace}.cmd b{color:#00f0ff}
|
|
127
|
+
a{color:#fff;text-decoration-color:#00f0ff;text-underline-offset:3px}form{margin-top:26px;display:flex;gap:8px}input{flex:1;background:#050b0c;border:1px solid #1d3a41;color:#fff;padding:11px 12px;font:14px 'Space Mono',monospace}
|
|
128
|
+
button{background:#00f0ff;color:#001418;border:0;padding:11px 16px;font:600 14px 'Space Grotesk',sans-serif;cursor:pointer}.err{color:#ff6b6b;font:13px 'Space Mono',monospace;margin-top:10px}</style></head>
|
|
129
|
+
<body><div class="box"><div class="k">Oculon · dashboard</div><h1>The dashboard runs on your own machine.</h1>
|
|
130
|
+
<p>This site shows the public overview. The full app, with your watchlist, cases, inbox and agent, is part of every install and stays private to you.</p>
|
|
131
|
+
<div class="cmd"><b>$</b><span>npm i -g oculon && oculon serve</span></div>
|
|
132
|
+
<p>Then open <code>http://127.0.0.1:4747/app</code>. Back to the <a href="/">overview</a> or read the <a href="/docs">docs</a>.</p>
|
|
133
|
+
${signInAvailable ? `<form method="post" action="/login"><input type="password" name="token" placeholder="Owner token" autocomplete="current-password" aria-label="Owner token"><button>Sign in</button></form>${failed ? '<div class="err">That token is not right.</div>' : ''}` : ''}
|
|
134
|
+
</div></body></html>`;
|
|
135
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type Server } from 'node:http';
|
|
2
|
+
import { Oculon } from '../index.js';
|
|
3
|
+
import { type Delivery } from '../modules/personal.js';
|
|
4
|
+
export interface WebOptions {
|
|
5
|
+
port?: number;
|
|
6
|
+
host?: string;
|
|
7
|
+
/** Open to the internet: read-only overview and docs for visitors, full app only with the admin cookie. */
|
|
8
|
+
publicMode?: boolean;
|
|
9
|
+
/** Owner token for public mode (default OCULON_ADMIN_TOKEN). Without one the app cannot be opened remotely. */
|
|
10
|
+
adminToken?: string;
|
|
11
|
+
/** Public domain (default OCULON_DOMAIN): app.<domain> serves the dashboard and docs.<domain> the docs. */
|
|
12
|
+
domain?: string;
|
|
13
|
+
/** Shared secret with the edge Worker (default OCULON_EDGE_SECRET). */
|
|
14
|
+
edgeSecret?: string;
|
|
15
|
+
/** Public mode with the whole app open to every visitor (default OCULON_OPEN=1). */
|
|
16
|
+
open?: boolean;
|
|
17
|
+
/** Minutes between background scans; 0 disables. */
|
|
18
|
+
watchMinutes?: number;
|
|
19
|
+
oculon?: Oculon;
|
|
20
|
+
log?: (msg: string) => void;
|
|
21
|
+
/** Called with new signals and the daily brief from the schedule (used to forward them to Telegram). */
|
|
22
|
+
onSignals?: (signals: import('../core/types.js').Signal[]) => Promise<void> | void;
|
|
23
|
+
onBrief?: (markdown: string) => Promise<void> | void;
|
|
24
|
+
onReport?: (file: string) => Promise<void> | void;
|
|
25
|
+
/** Changes found by personal monitors (emails are sent by the server; Telegram owners need the bot). */
|
|
26
|
+
onPersonal?: (deliveries: Delivery[]) => Promise<void> | void;
|
|
27
|
+
}
|
|
28
|
+
type Handler = (q: URLSearchParams, o: Oculon) => Promise<unknown> | unknown;
|
|
29
|
+
/**
|
|
30
|
+
* Commands the public console may run, each mapped to the exact argv it spawns. Anything else is refused,
|
|
31
|
+
* so the page can never reach a command that writes (watch add, case new) or costs paid quota (ask, social).
|
|
32
|
+
*/
|
|
33
|
+
export declare function consoleArgv(input: string): string[] | null;
|
|
34
|
+
export declare function runConsole(input: string): Promise<{
|
|
35
|
+
command: string;
|
|
36
|
+
output: string;
|
|
37
|
+
ok: boolean;
|
|
38
|
+
ranAt: string;
|
|
39
|
+
cached: boolean;
|
|
40
|
+
}>;
|
|
41
|
+
/** Graph slice for the UI: walk the most recent edges and keep entities until `limit` nodes are collected. */
|
|
42
|
+
export declare function graphSlice(o: Oculon, limit: number): {
|
|
43
|
+
nodes: {
|
|
44
|
+
id: string;
|
|
45
|
+
kind: string;
|
|
46
|
+
name: string;
|
|
47
|
+
}[];
|
|
48
|
+
edges: {
|
|
49
|
+
src: string;
|
|
50
|
+
dst: string;
|
|
51
|
+
rel: string;
|
|
52
|
+
source: string;
|
|
53
|
+
}[];
|
|
54
|
+
};
|
|
55
|
+
export declare const ROUTES: Record<string, Handler>;
|
|
56
|
+
type PostHandler = (body: Record<string, unknown>, o: Oculon) => Promise<unknown> | unknown;
|
|
57
|
+
export declare const POST_ROUTES: Record<string, PostHandler>;
|
|
58
|
+
/**
|
|
59
|
+
* Prepares a page: keeps or removes the blocks marked for the on-chain features
|
|
60
|
+
* (<!--onchain-->…<!--/onchain--> and /*onchain*\/…/*\/onchain*\/; the offchain markers are the reverse),
|
|
61
|
+
* and on the public domain points /app and /docs links at their subdomains.
|
|
62
|
+
*/
|
|
63
|
+
export declare function renderPage(html: string, domain: string | null): string;
|
|
64
|
+
export declare function createWebServer(opts?: WebOptions): {
|
|
65
|
+
server: Server;
|
|
66
|
+
oculon: Oculon;
|
|
67
|
+
stop: () => Promise<void>;
|
|
68
|
+
};
|
|
69
|
+
export {};
|