oculon 0.1.3 → 0.1.4
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/README.md +1 -1
- package/dist/cli/main.js +1 -1
- package/dist/mcp.d.ts +7 -0
- package/dist/mcp.js +47 -2
- package/dist/modules/contradictions.js +6 -4
- package/dist/modules/lynx.js +15 -9
- package/dist/modules/owl.js +4 -1
- package/dist/web/ask.html +1 -1
- package/dist/web/assets/og-app.png +0 -0
- package/dist/web/assets/og-docs.png +0 -0
- package/dist/web/assets/og-mcp.png +0 -0
- package/dist/web/assets/og.png +0 -0
- package/dist/web/docs.html +1 -1
- package/dist/web/index.html +39 -8
- package/dist/web/landing.html +1 -1
- package/dist/web/legal.html +1 -1
- package/dist/web/mcp.html +1 -1
- package/dist/web/server.js +31 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ npx oculon ask "why is Nvidia in the news this week?"
|
|
|
21
21
|
- **Sourced by design.** Every answer names the sources it used and whether each one was live, cached or unavailable. Nothing is presented without provenance.
|
|
22
22
|
- **Cross-source signals.** When independent sources move on the same subject, Oculon fuses them into one scored signal with the evidence behind it, and storylines are tracked across days.
|
|
23
23
|
- **Measured, not claimed.** A time machine replays past days to calibrate the radar, a first-to-know check compares Oculon against media coverage, and forecasts are timestamped on Bitcoin so they cannot be edited later.
|
|
24
|
-
- **Built for agents.** 75 MCP tools
|
|
24
|
+
- **Built for agents.** 75 MCP tools locally over stdio, and the 67 read-only ones remotely at `https://mcp.oculon.live`; the SDK and CLI return the same objects, and `--json` works on every command.
|
|
25
25
|
- **Everyday checks.** Is this message a scam? Is this link dangerous? Is this claim true? Is my car recalled? Can someone spoof my email domain? Are my dependencies safe? What should I know before I travel? Each answer names its sources, and any result can be shared as a link with a preview card.
|
|
26
26
|
- **Monitors in plain words.** "Tell me when there is an internet outage in Iran" becomes a rule that is re-checked on a schedule and reports only what changed, by email, in Telegram or in the app. Every visitor keeps their own monitors, with no account.
|
|
27
27
|
- **Everywhere people are.** A public Telegram bot ([@oculon_radar_bot](https://t.me/oculon_radar_bot)): forward it a suspicious message and it checks it. An OpenAPI spec at `/openapi.json` for ChatGPT Actions, n8n and Zapier.
|
package/dist/cli/main.js
CHANGED
|
@@ -1986,7 +1986,7 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
1986
1986
|
}
|
|
1987
1987
|
catch (e) {
|
|
1988
1988
|
if (e instanceof UsageError) {
|
|
1989
|
-
out(`${c.red('usage')}: ${e.message}. See \`oculon help\`.`);
|
|
1989
|
+
out(`${c.red('usage')}: ${e.message.replace(/^usage:\s*/i, '')}. See \`oculon help\`.`);
|
|
1990
1990
|
return 2;
|
|
1991
1991
|
}
|
|
1992
1992
|
out(`${c.red('error')}: ${e.message}`);
|
package/dist/mcp.d.ts
CHANGED
|
@@ -10,6 +10,13 @@ export interface Tool {
|
|
|
10
10
|
inputSchema: Json;
|
|
11
11
|
run: (o: Oculon, a: Json) => Promise<unknown> | unknown;
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Checks tool arguments against the tool's input schema before running it. A misspelled argument used
|
|
15
|
+
* to be dropped silently, so a scam check called with `text` instead of `message` ran on nothing and
|
|
16
|
+
* answered "no strong signs": the agent got a confident wrong answer instead of an error it can fix.
|
|
17
|
+
* Numeric strings are accepted for number fields and converted in place. Returns a message, or null.
|
|
18
|
+
*/
|
|
19
|
+
export declare function checkArgs(inputSchema: Json, args: Json): string | null;
|
|
13
20
|
export declare const TOOLS: Tool[];
|
|
14
21
|
interface Request {
|
|
15
22
|
jsonrpc: '2.0';
|
package/dist/mcp.js
CHANGED
|
@@ -7,11 +7,50 @@ import { createInterface } from 'node:readline';
|
|
|
7
7
|
import { Oculon, summarizeProvenance } from './index.js';
|
|
8
8
|
import { ONCHAIN_TOOLS, onchainEnabled } from './core/features.js';
|
|
9
9
|
import { availableKinds } from './modules/monitor.js';
|
|
10
|
-
export const SERVER_INFO = { name: 'oculon', version: '0.1.
|
|
10
|
+
export const SERVER_INFO = { name: 'oculon', version: '0.1.4' };
|
|
11
11
|
const SUPPORTED = ['2025-06-18', '2025-03-26', '2024-11-05'];
|
|
12
12
|
const str = (d) => ({ type: 'string', description: d });
|
|
13
13
|
const num = (d) => ({ type: 'number', description: d });
|
|
14
14
|
const schema = (props = {}, required = []) => ({ type: 'object', properties: props, required, additionalProperties: false });
|
|
15
|
+
/**
|
|
16
|
+
* Checks tool arguments against the tool's input schema before running it. A misspelled argument used
|
|
17
|
+
* to be dropped silently, so a scam check called with `text` instead of `message` ran on nothing and
|
|
18
|
+
* answered "no strong signs": the agent got a confident wrong answer instead of an error it can fix.
|
|
19
|
+
* Numeric strings are accepted for number fields and converted in place. Returns a message, or null.
|
|
20
|
+
*/
|
|
21
|
+
export function checkArgs(inputSchema, args) {
|
|
22
|
+
const props = (inputSchema.properties ?? {});
|
|
23
|
+
const required = (inputSchema.required ?? []);
|
|
24
|
+
const allowed = Object.keys(props);
|
|
25
|
+
if (inputSchema.additionalProperties === false) {
|
|
26
|
+
const unknown = Object.keys(args).filter((k) => !(k in props));
|
|
27
|
+
if (unknown.length)
|
|
28
|
+
return `unknown argument${unknown.length > 1 ? 's' : ''} ${unknown.map((k) => `"${k}"`).join(', ')}; this tool takes ${allowed.length ? allowed.map((k) => `"${k}"`).join(', ') : 'no arguments'}`;
|
|
29
|
+
}
|
|
30
|
+
for (const k of required) {
|
|
31
|
+
const v = args[k];
|
|
32
|
+
if (v === undefined || v === null || (typeof v === 'string' && !v.trim()))
|
|
33
|
+
return `missing required argument "${k}"`;
|
|
34
|
+
}
|
|
35
|
+
for (const [k, v] of Object.entries(args)) {
|
|
36
|
+
const p = props[k];
|
|
37
|
+
if (!p || v === undefined || v === null)
|
|
38
|
+
continue;
|
|
39
|
+
if (p.type === 'string' && typeof v !== 'string')
|
|
40
|
+
return `argument "${k}" must be a string`;
|
|
41
|
+
if (p.type === 'number' || p.type === 'integer') {
|
|
42
|
+
const n = typeof v === 'string' && v.trim() !== '' ? Number(v) : v;
|
|
43
|
+
if (typeof n !== 'number' || !Number.isFinite(n))
|
|
44
|
+
return `argument "${k}" must be a number`;
|
|
45
|
+
args[k] = n;
|
|
46
|
+
}
|
|
47
|
+
if (p.type === 'boolean' && typeof v !== 'boolean')
|
|
48
|
+
return `argument "${k}" must be true or false`;
|
|
49
|
+
if (Array.isArray(p.enum) && !p.enum.includes(v))
|
|
50
|
+
return `argument "${k}" must be one of ${p.enum.join(', ')}`;
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
15
54
|
/** Module results go out as result + signals + a compact provenance summary (full per-request provenance is noisy). */
|
|
16
55
|
function compact(r) {
|
|
17
56
|
return { module: r.module, input: r.input, generatedAt: r.generatedAt, result: r.result, signals: r.signals, provenance: summarizeProvenance(r.provenance) };
|
|
@@ -600,8 +639,14 @@ export class McpServer {
|
|
|
600
639
|
const tool = (await this.allTools()).find((t) => t.name === name);
|
|
601
640
|
if (!tool)
|
|
602
641
|
return fail(-32602, `unknown tool: ${name}`);
|
|
642
|
+
const raw = msg.params?.arguments ?? {};
|
|
643
|
+
if (typeof raw !== 'object' || raw === null || Array.isArray(raw))
|
|
644
|
+
return reply({ content: [{ type: 'text', text: 'Error: arguments must be a JSON object' }], isError: true });
|
|
645
|
+
const bad = checkArgs(tool.inputSchema, raw);
|
|
646
|
+
if (bad)
|
|
647
|
+
return reply({ content: [{ type: 'text', text: `Error: ${bad}` }], isError: true });
|
|
603
648
|
try {
|
|
604
|
-
const args =
|
|
649
|
+
const args = raw;
|
|
605
650
|
if (this.opts.remote && name === 'oculon_monitor')
|
|
606
651
|
args.dry_run = true;
|
|
607
652
|
const out = await tool.run(this.o, args);
|
|
@@ -22,12 +22,14 @@ export async function contradictions(ctx, topicInput, opts = {}) {
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
const pages = [];
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
// Pages are read in parallel: one at a time, a few slow sites pushed this past a minute and a half.
|
|
26
|
+
const picked = candidates.slice(0, opts.maxSources ?? 6);
|
|
27
|
+
const read = await Promise.all(picked.map((c) => readPage(ctx, c.url, 3500)));
|
|
28
|
+
read.forEach((p, i) => {
|
|
27
29
|
provenance.push(p.prov);
|
|
28
30
|
if (p.data && p.data.length > 400)
|
|
29
|
-
pages.push({ title:
|
|
30
|
-
}
|
|
31
|
+
pages.push({ title: picked[i].title, url: picked[i].url, text: p.data });
|
|
32
|
+
});
|
|
31
33
|
const result = { topic, sourcesRead: pages.map((p) => ({ title: p.title, url: p.url })), contradictions: [] };
|
|
32
34
|
if (pages.length < 2 || !availableProviders().length) {
|
|
33
35
|
if (!availableProviders().length)
|
package/dist/modules/lynx.js
CHANGED
|
@@ -39,7 +39,16 @@ async function pickSame(groups, fetchImpl) {
|
|
|
39
39
|
if (!availableProviders().length)
|
|
40
40
|
return null;
|
|
41
41
|
const out = groups.map(() => -1);
|
|
42
|
-
|
|
42
|
+
// Batches run three at a time: one after another they took over a minute for 40 markets.
|
|
43
|
+
const starts = [];
|
|
44
|
+
for (let s = 0; s < groups.length; s += 8)
|
|
45
|
+
starts.push(s);
|
|
46
|
+
let next = 0;
|
|
47
|
+
const worker = async () => { while (next < starts.length)
|
|
48
|
+
await runBatch(starts[next++]); };
|
|
49
|
+
await Promise.all([worker(), worker(), worker()]);
|
|
50
|
+
return out;
|
|
51
|
+
async function runBatch(start) {
|
|
43
52
|
const batch = groups.slice(start, start + 8);
|
|
44
53
|
try {
|
|
45
54
|
const r = await chat([
|
|
@@ -61,7 +70,6 @@ async function pickSame(groups, fetchImpl) {
|
|
|
61
70
|
// leave this batch unmatched
|
|
62
71
|
}
|
|
63
72
|
}
|
|
64
|
-
return out;
|
|
65
73
|
}
|
|
66
74
|
export async function lynx(ctx, opts = {}) {
|
|
67
75
|
const nowMs = ctx.now().getTime();
|
|
@@ -71,15 +79,13 @@ export async function lynx(ctx, opts = {}) {
|
|
|
71
79
|
const pool = (pm.data ?? []).filter((m) => !isSportsLine(m) && !isResolving(m, nowMs) && m.volume24h >= 20_000 && m.prices.length === 2).slice(0, opts.limit ?? 40);
|
|
72
80
|
// Per market: a loose shortlist from Kalshi, plus Manifold search results for the 12 highest-volume markets.
|
|
73
81
|
const groups = [];
|
|
82
|
+
const manifold = await Promise.all(pool.slice(0, 12).map((m) => { const term = searchTerm(m.question); return term ? manifoldSearch(ctx, term, 6) : null; }));
|
|
74
83
|
for (const [i, m] of pool.entries()) {
|
|
75
84
|
const options = ks.data ? shortlist(m.question, ks.data, 8) : [];
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
provenance.push(r.prov);
|
|
81
|
-
options.push(...(r.data ?? []));
|
|
82
|
-
}
|
|
85
|
+
const r = manifold[i];
|
|
86
|
+
if (r) {
|
|
87
|
+
provenance.push(r.prov);
|
|
88
|
+
options.push(...(r.data ?? []));
|
|
83
89
|
}
|
|
84
90
|
if (options.length)
|
|
85
91
|
groups.push({ pm: m, options });
|
package/dist/modules/owl.js
CHANGED
|
@@ -162,6 +162,9 @@ export async function owl(ctx, opts = {}) {
|
|
|
162
162
|
// Hacker News: front-page stories with unusual traction for their age.
|
|
163
163
|
if (hn.data) {
|
|
164
164
|
for (const s of hn.data) {
|
|
165
|
+
// Algolia sometimes returns hits without points or comment counts; those carry no traction signal.
|
|
166
|
+
if (!Number.isFinite(s.points) || !Number.isFinite(s.created_at_i))
|
|
167
|
+
continue;
|
|
165
168
|
const ageH = Math.max(1, (nowMs / 1000 - s.created_at_i) / 3600);
|
|
166
169
|
const velocity = s.points / ageH;
|
|
167
170
|
if (s.points < 150 && velocity < 40)
|
|
@@ -171,7 +174,7 @@ export async function owl(ctx, opts = {}) {
|
|
|
171
174
|
title: s.title,
|
|
172
175
|
url: hnItemUrl(s.objectID),
|
|
173
176
|
strength: clamp(Math.round(25 + 10 * Math.log2(Math.max(1, velocity))), 0, 85),
|
|
174
|
-
detail: `${s.points} points, ${s.num_comments} comments in ${ageH.toFixed(0)}h`,
|
|
177
|
+
detail: `${s.points} points, ${Number.isFinite(s.num_comments) ? s.num_comments : 0} comments in ${ageH.toFixed(0)}h`,
|
|
175
178
|
value: velocity,
|
|
176
179
|
}));
|
|
177
180
|
}
|
package/dist/web/ask.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<link rel="apple-touch-icon" href="/assets/icon-192.png">
|
|
9
9
|
<title>Oculon Analyst</title>
|
|
10
10
|
<meta name="description" content="Ask a question; Oculon checks live public data, then answers with a brief: bottom line, confidence, cited findings, and a cross-examination by other models.">
|
|
11
|
-
<meta property="og:type" content="website"><meta property="og:site_name" content="Oculon"><meta property="og:title" content="Oculon Analyst"><meta property="og:description" content="Ask anything. It checks live public data first, then answers with a cited brief you can cross-examine."><meta property="og:image" content="https://oculon.live/assets/og.png"><meta property="og:image:width" content="1200"><meta property="og:image:height" content="630"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:image" content="https://oculon.live/assets/og.png">
|
|
11
|
+
<meta property="og:type" content="website"><meta property="og:site_name" content="Oculon"><meta property="og:title" content="Oculon Analyst"><meta property="og:description" content="Ask anything. It checks live public data first, then answers with a cited brief you can cross-examine."><meta property="og:image" content="https://oculon.live/assets/og.png?v=2"><meta property="og:image:width" content="1200"><meta property="og:image:height" content="630"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:image" content="https://oculon.live/assets/og.png?v=2">
|
|
12
12
|
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
13
13
|
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Space+Mono:wght@400;700&display=swap" rel="stylesheet">
|
|
14
14
|
<style>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/web/assets/og.png
CHANGED
|
Binary file
|
package/dist/web/docs.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<link rel="icon" type="image/png" href="/favicon.ico">
|
|
9
9
|
<link rel="apple-touch-icon" href="/assets/icon-192.png">
|
|
10
10
|
<title>Oculon Docs</title>
|
|
11
|
-
<meta property="og:type" content="website"><meta property="og:site_name" content="Oculon"><meta property="og:title" content="Oculon docs"><meta property="og:description" content="Install, CLI, remote MCP, SDK and every module of the Oculon intelligence engine."><meta property="og:url" content="https://oculon.live/docs"><meta property="og:image" content="https://oculon.live/assets/og.png"><meta property="og:image:width" content="1200"><meta property="og:image:height" content="630"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:image" content="https://oculon.live/assets/og.png">
|
|
11
|
+
<meta property="og:type" content="website"><meta property="og:site_name" content="Oculon"><meta property="og:title" content="Oculon docs"><meta property="og:description" content="Install, CLI, remote MCP, SDK and every module of the Oculon intelligence engine."><meta property="og:url" content="https://oculon.live/docs"><meta property="og:image" content="https://oculon.live/assets/og-docs.png?v=2"><meta property="og:image:width" content="1200"><meta property="og:image:height" content="630"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:image" content="https://oculon.live/assets/og-docs.png?v=2">
|
|
12
12
|
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
13
13
|
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Space+Mono:wght@400;700&display=swap" rel="stylesheet">
|
|
14
14
|
<style>
|
package/dist/web/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<link rel="icon" type="image/png" href="/favicon.ico">
|
|
9
9
|
<link rel="apple-touch-icon" href="/assets/icon-192.png">
|
|
10
10
|
<title>Oculon</title>
|
|
11
|
-
<meta property="og:type" content="website"><meta property="og:site_name" content="Oculon"><meta property="og:title" content="Oculon app"><meta property="og:description" content="Investigate, monitor and share: the full Oculon intelligence app."><meta property="og:url" content="https://oculon.live/app"><meta property="og:image" content="https://oculon.live/assets/og.png"><meta property="og:image:width" content="1200"><meta property="og:image:height" content="630"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:image" content="https://oculon.live/assets/og.png">
|
|
11
|
+
<meta property="og:type" content="website"><meta property="og:site_name" content="Oculon"><meta property="og:title" content="Oculon app"><meta property="og:description" content="Investigate, monitor and share: the full Oculon intelligence app."><meta property="og:url" content="https://oculon.live/app"><meta property="og:image" content="https://oculon.live/assets/og-app.png?v=2"><meta property="og:image:width" content="1200"><meta property="og:image:height" content="630"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:image" content="https://oculon.live/assets/og-app.png?v=2">
|
|
12
12
|
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
13
13
|
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Space+Mono:wght@400;700&display=swap" rel="stylesheet">
|
|
14
14
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.min.css">
|
|
@@ -248,7 +248,7 @@ nav { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollb
|
|
|
248
248
|
header .spacer { display: none; }
|
|
249
249
|
header .status { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
250
250
|
@media (max-width: 1300px) { header .status { display: none; } }
|
|
251
|
-
@media (max-width: 720px) { header { flex-wrap: wrap; row-gap: 8px; } header nav { order: 5; flex-basis: 100%; } #pal-btn .kbd { display: none; } header .brand { margin-right: auto; } .ov-kpi b { font-size: 22px; overflow-wrap: anywhere; } .ov-kpi { padding: 12px 14px; } }
|
|
251
|
+
@media (max-width: 720px) { header { flex-wrap: wrap; row-gap: 8px; column-gap: 12px; padding: 10px 14px; } header nav { order: 5; flex-basis: 100%; } #pal-btn .kbd { display: none; } header .brand { margin-right: auto; } .ov-kpi b { font-size: 22px; overflow-wrap: anywhere; } .ov-kpi { padding: 12px 14px; } }
|
|
252
252
|
.pal input { color: var(--text) !important; }
|
|
253
253
|
#pal-btn { white-space: nowrap; flex: none; }
|
|
254
254
|
.ib .ev2 a { color: var(--text); text-decoration: underline; text-decoration-color: rgba(0,240,255,.4); text-underline-offset: 3px; }
|
|
@@ -1037,7 +1037,7 @@ async function loadCases() {
|
|
|
1037
1037
|
: '<p class="meta">No cases yet.</p>';
|
|
1038
1038
|
document.querySelectorAll('[data-case]').forEach((a) => (a.onclick = async (e) => {
|
|
1039
1039
|
e.preventDefault();
|
|
1040
|
-
const k = await api('/api/case?id=' + encodeURIComponent(a.dataset.case));
|
|
1040
|
+
const k = await api('/api/case?id=' + encodeURIComponent(a.dataset.case)).catch(() => null);
|
|
1041
1041
|
$('#case-view').innerHTML = k && k.markdown ? renderMd(k.markdown) : 'Not found.';
|
|
1042
1042
|
$('#case-view').className = 'md';
|
|
1043
1043
|
}));
|
|
@@ -1352,13 +1352,44 @@ function drawGraph() {
|
|
|
1352
1352
|
const line = getComputedStyle(document.documentElement).getPropertyValue('--line');
|
|
1353
1353
|
ctx.strokeStyle = line; ctx.lineWidth = 1;
|
|
1354
1354
|
for (const e of edges) { const [x1, y1] = graphState.tx(nodes[e.a]); const [x2, y2] = graphState.tx(nodes[e.b]); ctx.beginPath(); ctx.moveTo(x1, y1); ctx.lineTo(x2, y2); ctx.stroke(); }
|
|
1355
|
-
const
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1355
|
+
const css = getComputedStyle(document.documentElement);
|
|
1356
|
+
const text = css.getPropertyValue('--text'), bg = css.getPropertyValue('--bg') || '#000';
|
|
1357
|
+
const radius = (n) => 3 + Math.min(9, Math.sqrt(n.deg) * 2);
|
|
1358
|
+
nodes.forEach((n) => {
|
|
1359
|
+
const [x, y] = graphState.tx(n);
|
|
1360
|
+
ctx.beginPath(); ctx.arc(x, y, radius(n), 0, Math.PI * 2); ctx.fillStyle = KIND_COLORS[n.kind] || '#94a3b8'; ctx.fill();
|
|
1360
1361
|
});
|
|
1362
|
+
// Labels: the hovered node first, then the best-connected ones, and only where a label does not overlap
|
|
1363
|
+
// one already drawn, so dense clusters stay readable instead of turning into a block of text.
|
|
1364
|
+
ctx.font = '11px system-ui'; ctx.textBaseline = 'middle'; ctx.lineJoin = 'round';
|
|
1365
|
+
const placed = [], max = w < 520 ? 14 : 40;
|
|
1366
|
+
const order = nodes.map((n, i) => i).filter((i) => i === hover || nodes[i].deg >= 4).sort((a, b) => (b === hover) - (a === hover) || nodes[b].deg - nodes[a].deg);
|
|
1367
|
+
for (const i of order) {
|
|
1368
|
+
const n = nodes[i], [x, y] = graphState.tx(n), r = radius(n);
|
|
1369
|
+
const label = n.name.length > 28 ? n.name.slice(0, 27) + '…' : n.name;
|
|
1370
|
+
const tw = ctx.measureText(label).width;
|
|
1371
|
+
let lx = x + r + 4; if (lx + tw > w - 4) lx = x - r - 4 - tw;
|
|
1372
|
+
const box = [lx - 2, y - 8, lx + tw + 2, y + 8];
|
|
1373
|
+
if (i !== hover && (placed.length >= max || placed.some((p) => box[0] < p[2] && box[2] > p[0] && box[1] < p[3] && box[3] > p[1]))) continue;
|
|
1374
|
+
placed.push(box);
|
|
1375
|
+
ctx.strokeStyle = bg; ctx.lineWidth = 3; ctx.strokeText(label, lx, y);
|
|
1376
|
+
ctx.fillStyle = text; ctx.fillText(label, lx, y);
|
|
1377
|
+
}
|
|
1378
|
+
ctx.textBaseline = 'alphabetic';
|
|
1379
|
+
}
|
|
1380
|
+
function graphPick(e, reach) {
|
|
1381
|
+
if (!graphState?.tx) return -1;
|
|
1382
|
+
const rect = $('#graph').getBoundingClientRect(); const mx = e.clientX - rect.left, my = e.clientY - rect.top;
|
|
1383
|
+
let best = -1, bd = reach * reach;
|
|
1384
|
+
graphState.nodes.forEach((n, i) => { const [x, y] = graphState.tx(n); const d = (x - mx) ** 2 + (y - my) ** 2; if (d < bd) { bd = d; best = i; } });
|
|
1385
|
+
return best;
|
|
1361
1386
|
}
|
|
1387
|
+
// Touch has no hover: a tap picks the nearest node within a finger's reach.
|
|
1388
|
+
$('#graph').addEventListener('pointerdown', (e) => {
|
|
1389
|
+
if (e.pointerType === 'mouse' || !graphState) return;
|
|
1390
|
+
const best = graphPick(e, 28);
|
|
1391
|
+
if (best !== graphState.hover) { graphState.hover = best; drawGraph(); $('#graph-hover').textContent = best >= 0 ? `${graphState.nodes[best].kind}: ${graphState.nodes[best].name}` : 'Tap a node to see it; tap again to open its neighbors.'; }
|
|
1392
|
+
});
|
|
1362
1393
|
$('#graph').addEventListener('mousemove', (e) => {
|
|
1363
1394
|
if (!graphState?.tx) return;
|
|
1364
1395
|
const rect = e.target.getBoundingClientRect(); const mx = e.clientX - rect.left, my = e.clientY - rect.top;
|
package/dist/web/landing.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<link rel="icon" type="image/png" href="/favicon.ico">
|
|
9
9
|
<link rel="apple-touch-icon" href="/assets/icon-192.png">
|
|
10
10
|
<title>Oculon</title>
|
|
11
|
-
<meta property="og:type" content="website"><meta property="og:site_name" content="Oculon"><meta property="og:title" content="Oculon: check anything, every answer sourced"><meta property="og:description" content="Open-source intelligence engine and agent: link and claim checks, recalls, travel risk, routing, vulnerabilities, ships and satellites, with sources on every answer."><meta property="og:url" content="https://oculon.live/"><meta property="og:image" content="https://oculon.live/assets/og.png"><meta property="og:image:width" content="1200"><meta property="og:image:height" content="630"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:image" content="https://oculon.live/assets/og.png">
|
|
11
|
+
<meta property="og:type" content="website"><meta property="og:site_name" content="Oculon"><meta property="og:title" content="Oculon: check anything, every answer sourced"><meta property="og:description" content="Open-source intelligence engine and agent: link and claim checks, recalls, travel risk, routing, vulnerabilities, ships and satellites, with sources on every answer."><meta property="og:url" content="https://oculon.live/"><meta property="og:image" content="https://oculon.live/assets/og.png?v=2"><meta property="og:image:width" content="1200"><meta property="og:image:height" content="630"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:image" content="https://oculon.live/assets/og.png?v=2">
|
|
12
12
|
<!--onchain--><meta name="description" content="Open-source intelligence engine: routing, vulnerabilities, ships, satellites and Robinhood Chain, with sources on every answer."><!--/onchain-->
|
|
13
13
|
<!--offchain--><meta name="description" content="Open-source intelligence engine: routing, vulnerabilities, ships, satellites and markets, with sources on every answer."><!--/offchain-->
|
|
14
14
|
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
package/dist/web/legal.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<link rel="icon" type="image/png" href="/favicon.ico">
|
|
9
9
|
<link rel="apple-touch-icon" href="/assets/icon-192.png">
|
|
10
10
|
<title>Oculon Legal</title>
|
|
11
|
-
<meta property="og:type" content="website"><meta property="og:site_name" content="Oculon"><meta property="og:title" content="Oculon"><meta property="og:description" content="Privacy and terms for Oculon."><meta property="og:url" content="https://oculon.live/privacy"><meta property="og:image" content="https://oculon.live/assets/og.png"><meta property="og:image:width" content="1200"><meta property="og:image:height" content="630"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:image" content="https://oculon.live/assets/og.png">
|
|
11
|
+
<meta property="og:type" content="website"><meta property="og:site_name" content="Oculon"><meta property="og:title" content="Oculon"><meta property="og:description" content="Privacy and terms for Oculon."><meta property="og:url" content="https://oculon.live/privacy"><meta property="og:image" content="https://oculon.live/assets/og.png?v=2"><meta property="og:image:width" content="1200"><meta property="og:image:height" content="630"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:image" content="https://oculon.live/assets/og.png?v=2">
|
|
12
12
|
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
13
13
|
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Space+Mono:wght@400;700&display=swap" rel="stylesheet">
|
|
14
14
|
<style>
|
package/dist/web/mcp.html
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<link rel="icon" type="image/png" href="/favicon.ico">
|
|
8
8
|
<title>Oculon MCP</title>
|
|
9
9
|
<meta name="description" content="Remote MCP server for Oculon: OSINT checks with sources for any AI agent, nothing to install.">
|
|
10
|
-
<meta property="og:type" content="website"><meta property="og:site_name" content="Oculon"><meta property="og:title" content="Oculon MCP server"><meta property="og:description" content="One URL gives any AI agent Oculon's checks: scams, links, claims, recalls, travel risk, CVEs, outages and research, each with sources."><meta property="og:url" content="{{URL}}"><meta property="og:image" content="https://oculon.live/assets/og.png"><meta property="og:image:width" content="1200"><meta property="og:image:height" content="630"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:image" content="https://oculon.live/assets/og.png">
|
|
10
|
+
<meta property="og:type" content="website"><meta property="og:site_name" content="Oculon"><meta property="og:title" content="Oculon MCP server"><meta property="og:description" content="One URL gives any AI agent Oculon's checks: scams, links, claims, recalls, travel risk, CVEs, outages and research, each with sources."><meta property="og:url" content="{{URL}}"><meta property="og:image" content="https://oculon.live/assets/og-mcp.png?v=2"><meta property="og:image:width" content="1200"><meta property="og:image:height" content="630"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:image" content="https://oculon.live/assets/og-mcp.png?v=2">
|
|
11
11
|
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
12
12
|
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600&family=Space+Mono:wght@400;700&display=swap" rel="stylesheet">
|
|
13
13
|
<style>
|
package/dist/web/server.js
CHANGED
|
@@ -50,6 +50,19 @@ function need(q, key, max = 200) {
|
|
|
50
50
|
throw new HttpError(400, `parameter too long: ${key}`);
|
|
51
51
|
return v;
|
|
52
52
|
}
|
|
53
|
+
// Modules throw plain errors for bad input ("not a CVE id", "date must be YYYY-MM-DD") and for missing
|
|
54
|
+
// records ("no prediction x"). Those are the caller's problem, not a server failure, so they map to 400 and
|
|
55
|
+
// 404; anything else stays a 500.
|
|
56
|
+
function statusFor(e) {
|
|
57
|
+
if (e instanceof HttpError)
|
|
58
|
+
return e.status;
|
|
59
|
+
const m = e?.message ?? '';
|
|
60
|
+
if (/^no (such|prediction|case|share|entity|record)\b|\bnot found\b/i.test(m))
|
|
61
|
+
return 404;
|
|
62
|
+
if (/^(not an? |invalid |missing |expected |paste |give |that does not look|could not decode|could not read the manifest|could not turn that)|\b(must be|must include|expected) [A-Za-z0-9"(-]/i.test(m))
|
|
63
|
+
return 400;
|
|
64
|
+
return 500;
|
|
65
|
+
}
|
|
53
66
|
class HttpError extends Error {
|
|
54
67
|
status;
|
|
55
68
|
constructor(status, message) {
|
|
@@ -201,7 +214,12 @@ export const ROUTES = {
|
|
|
201
214
|
'/api/rewind': async (q, o) => slim(await o.rewind(need(q, 'date', 10))),
|
|
202
215
|
'/api/scoops': (_q, o) => o.scoops(),
|
|
203
216
|
'/api/cases': async (_q, o) => (await o.caseList()).map((k) => ({ id: k.id, question: k.question, confidence: k.report?.confidence ?? null, findings: k.report?.findings.length ?? 0, runs: k.runs, watch: k.watch, updatedAt: k.updatedAt })),
|
|
204
|
-
'/api/case': async (q, o) =>
|
|
217
|
+
'/api/case': async (q, o) => {
|
|
218
|
+
const id = need(q, 'id', 10);
|
|
219
|
+
if (!/^\d+$/.test(id))
|
|
220
|
+
throw new HttpError(400, 'id must be a case number');
|
|
221
|
+
return (await o.caseGet(Number(id))) ?? (() => { throw new HttpError(404, 'no such case'); })();
|
|
222
|
+
},
|
|
205
223
|
'/api/fences': (_q, o) => o.fenceList().map((f) => ({ id: f.id, name: f.name, box: [f.south, f.west, f.north, f.east], kinds: f.kinds, lastRun: f.lastRun, now: f.lastState ? { milAircraft: Object.values(f.lastState.milAircraft), milVessels: Object.values(f.lastState.milVessels), quakes: Object.values(f.lastState.quakes), events: Object.values(f.lastState.events) } : null })),
|
|
206
224
|
'/api/quakes': async (_q, o) => {
|
|
207
225
|
const { recentQuakes } = await import('../sources/usgs.js');
|
|
@@ -802,7 +820,7 @@ export function createWebServer(opts = {}) {
|
|
|
802
820
|
return send(res, 200, readFileSync(r.result.file), 'image/png');
|
|
803
821
|
}
|
|
804
822
|
catch (e) {
|
|
805
|
-
return send(res, e
|
|
823
|
+
return send(res, statusFor(e), JSON.stringify({ error: e.message }), 'application/json');
|
|
806
824
|
}
|
|
807
825
|
}
|
|
808
826
|
const route = ROUTES[url.pathname];
|
|
@@ -823,7 +841,7 @@ export function createWebServer(opts = {}) {
|
|
|
823
841
|
send(res, 200, JSON.stringify(out), 'application/json; charset=utf-8');
|
|
824
842
|
}
|
|
825
843
|
catch (e) {
|
|
826
|
-
const status = e
|
|
844
|
+
const status = statusFor(e);
|
|
827
845
|
log(`${url.pathname} ${status} ${e.message}`);
|
|
828
846
|
send(res, status, JSON.stringify({ error: e.message }), 'application/json; charset=utf-8');
|
|
829
847
|
}
|
|
@@ -831,6 +849,16 @@ export function createWebServer(opts = {}) {
|
|
|
831
849
|
const scheduler = opts.watchMinutes && opts.watchMinutes > 0
|
|
832
850
|
? startScheduler(oculon, { scanMinutes: opts.watchMinutes, log: (m) => log(`schedule ${m}`), baseUrl: siteDomain ? `https://${siteDomain}` : `http://127.0.0.1:${opts.port ?? 4747}`, appUrl: siteDomain ? `https://app.${siteDomain}/#watch` : `http://127.0.0.1:${opts.port ?? 4747}/app#watch`, ...(opts.onSignals ? { onSignals: opts.onSignals } : {}), ...(opts.onBrief ? { onBrief: opts.onBrief } : {}), ...(opts.onReport ? { onReport: opts.onReport } : {}), ...(opts.onPersonal ? { onPersonal: opts.onPersonal } : {}) })
|
|
833
851
|
: null;
|
|
852
|
+
server.on('error', (e) => {
|
|
853
|
+
const port = opts.port ?? 4747;
|
|
854
|
+
if (e.code === 'EADDRINUSE')
|
|
855
|
+
console.error(`Port ${port} is already in use, probably by another Oculon server. Stop that one, or pick another port: oculon serve --port ${port + 1}`);
|
|
856
|
+
else if (e.code === 'EACCES')
|
|
857
|
+
console.error(`No permission to listen on port ${port}. Pick a port above 1024: oculon serve --port 4747`);
|
|
858
|
+
else
|
|
859
|
+
console.error(`The server could not start: ${e.message}`);
|
|
860
|
+
process.exit(1);
|
|
861
|
+
});
|
|
834
862
|
server.listen(opts.port ?? 4747, opts.host ?? '127.0.0.1');
|
|
835
863
|
return {
|
|
836
864
|
server,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oculon",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "OSINT engine you can run, script and plug into agents: 70+ live tools for scams, links, outages, CVEs and research, each result with its sources. CLI, SDK, MCP server and web app. Zero dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"osint",
|