oculon 0.1.1 → 0.1.3
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 +33 -20
- package/dist/agent.d.ts +25 -1
- package/dist/agent.js +14 -4
- package/dist/analyst.d.ts +99 -0
- package/dist/analyst.js +335 -0
- package/dist/cli/main.js +1 -1
- package/dist/core/llm.d.ts +2 -0
- package/dist/core/llm.js +29 -0
- package/dist/mcp.js +1 -1
- package/dist/modules/personal.js +1 -1
- package/dist/web/ask.html +410 -0
- package/dist/web/assets/favicon-32.png +0 -0
- package/dist/web/assets/fx.js +49 -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/logo.svg +1 -0
- package/dist/web/assets/og.png +0 -0
- package/dist/web/docs.html +31 -8
- package/dist/web/index.html +16 -9
- package/dist/web/landing.html +12 -6
- package/dist/web/legal.html +9 -5
- package/dist/web/manifest.webmanifest +31 -7
- package/dist/web/mcp.html +7 -3
- package/dist/web/server.js +87 -4
- package/dist/web/share.js +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -29,25 +29,25 @@ npx oculon ask "why is Nvidia in the news this week?"
|
|
|
29
29
|
|
|
30
30
|
## Contents
|
|
31
31
|
|
|
32
|
-
[What it does](#what-it-does) · [Install](#install) · [CLI](#cli) · [MCP server](#mcp-server) · [Remote MCP](#remote-mcp) · [SDK](#sdk) · [Web app](#dashboard-and-schedule) · [Telegram bot](#telegram-bot) · [Configuration](#configuration) · [Deploy](#deploy) · [How it works](#how-it-works) · [Limits](#limits) · [Development](#development)
|
|
32
|
+
[What it does](#what-it-does) · [Install](#install) · [CLI](#cli) · [MCP server](#mcp-server) · [Remote MCP](#remote-mcp) · [Analyst](#oculon-analyst) · [SDK](#sdk) · [Web app](#dashboard-and-schedule) · [Telegram bot](#telegram-bot) · [Configuration](#configuration) · [Deploy](#deploy) · [How it works](#how-it-works) · [Limits](#limits) · [Development](#development)
|
|
33
33
|
|
|
34
34
|
## What it does
|
|
35
35
|
|
|
36
36
|
| Module | Command | What it does | Sources |
|
|
37
37
|
|---|---|---|---|
|
|
38
|
-
| Scam check | `oculon scam "<message>"` · Telegram: forward the message | Is this SMS, email or chat message a scam? Every link goes through the URL check, the sender is compared with any brand it names, and known scam patterns are matched in code (parcel fees, account locked, one-time codes, gift cards and crypto, "hi mum" new number asking for money, prizes, job and investment promises); a verdict, a 0-100 risk, the reasons and what to do |
|
|
38
|
+
| Scam check | `oculon scam "<message>"` · Telegram: forward the message | Is this SMS, email or chat message a scam? Every link goes through the URL check, the sender is compared with any brand it names, and known scam patterns are matched in code (parcel fees, account locked, one-time codes, gift cards and crypto, "hi mum" new number asking for money, prizes, job and investment promises); a verdict, a 0-100 risk, the reasons and what to do | Google Safe Browsing, URLhaus, urlscan.io, RDAP, Groq, Gemini, Mistral |
|
|
39
39
|
| URL check | `oculon url <link>` | Is a link dangerous? A verdict (malicious, suspicious, no known threats), a 0-100 risk and the reasons: Safe Browsing and URLhaus matches, community tags on urlscan.io scans, domain age and registrar, and warning signs in the URL itself (a brand name on someone else's domain, punycode look-alikes, risky top-level domains, `@` tricks). Big platforms are not blamed for files their users upload | Google Safe Browsing, URLhaus (abuse.ch), urlscan.io, RDAP |
|
|
40
|
-
| Fact check | `oculon factcheck "<claim>"` or a news URL | Published fact checks about the claim (Snopes, AFP, PolitiFact, Full Fact and others) plus current reporting; an LLM weighs only that evidence and cites it by number, giving true, mostly true, mixed, misleading, false or unverified with a confidence. Without an LLM the published ratings decide | Google Fact Check Tools, Tavily
|
|
40
|
+
| Fact check | `oculon factcheck "<claim>"` or a news URL | Published fact checks about the claim (Snopes, AFP, PolitiFact, Full Fact and others) plus current reporting; an LLM weighs only that evidence and cites it by number, giving true, mostly true, mixed, misleading, false or unverified with a confidence. Without an LLM the published ratings decide | Google Fact Check Tools, Tavily, Exa, Jina Reader, Groq, Gemini, Mistral |
|
|
41
41
|
| Audit | `oculon audit [package.json\|requirements.txt\|npm:name@ver ...]` | Dependency health for npm and PyPI: known vulnerabilities with CVSS, deprecation, years since the last release, major versions behind, OpenSSF Scorecard and its "Maintained" check, license; a 0-100 risk per package (dev dependencies weigh less) | deps.dev (Google Open Source Insights), OpenSSF Scorecard, OSV |
|
|
42
42
|
| Travel | `oculon travel <place>` | What a visitor should know for the coming week: US State Department level and UK FCDO advice, 7-day weather warnings (storms, heavy rain, strong gusts, heat, cold, UV), PM2.5, WHO disease outbreak news, orange and red disaster alerts, nearby strong earthquakes, satellite heat detections and confirmed internet outages; a level from low to severe | US State Department, UK FCDO, Open-Meteo, OpenAQ, WHO, GDACS, USGS, NASA FIRMS, Cloudflare Radar |
|
|
43
43
|
| Recall | `oculon recall <VIN\|"2018 Honda Accord"\|product>` | Is this car or product recalled? A VIN is decoded to make, model and year; vehicles get NHTSA safety recalls with do-not-drive and park-outside warnings; products get US consumer recalls and FDA food, drug and device enforcement reports from the last few years | NHTSA (vPIC and recalls), CPSC SaferProducts, openFDA |
|
|
44
44
|
| Email security | `oculon email <domain>` | Can someone send mail that looks like it comes from a domain? SPF (qualifier, DNS lookup count), DMARC (policy, coverage, reporting), DKIM on common selectors, MTA-STS, TLS reporting, BIMI, CAA and DNSSEC, a 0-100 score, a verdict (spoofable, partly protected, protected) and the fixes in order | Google Public DNS (DNS over HTTPS) |
|
|
45
|
-
| Papers | `oculon papers "<topic>"` | Research brief: the most cited papers of recent years among the most relevant, the newest relevant ones, papers per year (growing, steady or shrinking), PubMed counts for medical topics, and a short overview that cites the numbered papers | OpenAlex, PubMed, Semantic Scholar
|
|
45
|
+
| Papers | `oculon papers "<topic>"` | Research brief: the most cited papers of recent years among the most relevant, the newest relevant ones, papers per year (growing, steady or shrinking), PubMed counts for medical topics, and a short overview that cites the numbered papers | OpenAlex, PubMed, Semantic Scholar, Groq, Gemini, Mistral |
|
|
46
46
|
| Country | `oculon country <name>` | One-page country brief: GDP, growth, GDP per person, inflation, unemployment and population, the IMF outlook for this year and next, head of state and government, capital, currency and its rate to the dollar, US and UK travel advice, internet outages, disaster alerts and the latest headlines | World Bank, IMF, Wikidata, open.er-api.com, US State Department, UK FCDO, Cloudflare Radar, GDACS, Guardian |
|
|
47
47
|
| Airport | `oculon airport <JFK\|EGLL\|name>` | Is an airport running normally? Current METAR and TAF (flight category, wind, visibility, ceiling), FAA ground stops, ground delay programs, delays and closures at US airports, and aircraft squawking an emergency within 150 km | aviationweather.gov (NOAA), FAA NAS status, adsb.lol, OurAirports |
|
|
48
48
|
| Share | web app · `/r/<id>` | Any everyday check can be shared as a link: the server runs the check, keeps a snapshot and serves it as a page with a preview card for X, Telegram, WhatsApp and Slack | Oculon |
|
|
49
49
|
| Personal monitors | web app · Telegram `/monitor` | Each visitor (a random id in a cookie, no account) or Telegram chat keeps up to 10 monitors of its own, written in plain language and re-checked about hourly; changes are kept as alerts and sent by email (after a confirmation link, with one-click unsubscribe) or to the Telegram chat | Resend (email), Meerkat |
|
|
50
|
-
| Monitor | `oculon monitor "<request>"` | Watch anything in plain language: "internet outages in Iran", "critical CVEs for nginx", "earthquakes above 6 near Tokyo", "news about OpenAI", "travel risk changes for Bangkok", "flood or cyclone alerts for the Philippines". The request becomes a watchlist rule; only changes are reported, with evidence, in the app, Telegram and the signal feed |
|
|
50
|
+
| Monitor | `oculon monitor "<request>"` | Watch anything in plain language: "internet outages in Iran", "critical CVEs for nginx", "earthquakes above 6 near Tokyo", "news about OpenAI", "travel risk changes for Bangkok", "flood or cyclone alerts for the Philippines". The request becomes a watchlist rule; only changes are reported, with evidence, in the app, Telegram and the signal feed | Groq, Gemini, Mistral (with a pattern fallback), Meerkat |
|
|
51
51
|
| Live | `oculon live` / `serve --live` | Listens to two real-time streams: English Wikipedia articles suddenly edited by several people (6+ human edits by 3+ editors in 15 minutes), and names or hashtags surging in English Bluesky posts against their own last hour (watched companies and topics get a lower bar) | Wikimedia EventStreams, Bluesky Jetstream |
|
|
52
52
|
| Calendar | `oculon calendar [days]` | Catalysts ahead: earnings (watched companies first, then the largest by revenue estimate), IPOs, key US macro releases (CPI, jobs, GDP, PCE, JOLTS...), rules taking effect and comment periods closing at market-moving agencies, and high-volume prediction markets that close; also added to the daily brief | Finnhub, FRED, Federal Register, Polymarket |
|
|
53
53
|
| Connect | `oculon connect <A> to <B>` / `resolve` | Entity resolution merges duplicates across kinds (`org:nvidia` = `company:nvidia` = `nvidia.com`), then finds the shortest chain of typed links between two things in the graph | Oculon graph |
|
|
@@ -67,20 +67,20 @@ npx oculon ask "why is Nvidia in the news this week?"
|
|
|
67
67
|
| Social pulse | `oculon social <subject>` | Recent posts about a subject on X, Reddit, TikTok and Bluesky: count per platform, the most engaged and the newest posts with links, and Reddit's pace over the last six hours versus the day before; a sharp acceleration is a signal | Apify (X, Reddit, TikTok; pay per result), Bluesky |
|
|
68
68
|
| Feedback | Telegram buttons / `oculon feedback` | Every alert has Useful and Noise buttons; votes move that module's alert bar (from the third vote, capped at -10/+20 points) | your votes |
|
|
69
69
|
| Sanctions | `oculon sanctions <IMO\|name>` | Screens against the US OFAC SDN list and, for names, sanctions, PEP and wanted lists worldwide (OpenSanctions, free non-commercial key): vessel IMO numbers, exact names and aliases; for a confident name match, its owners, subsidiaries, directors and associates, sanctioned ones first. Runs automatically on every vessel seen over AIS | OFAC SDN, OpenSanctions |
|
|
70
|
-
| Narratives | `oculon narratives [run]` | Groups headlines into storylines that persist across days and flags new or fast-growing ones | Guardian, NYT, Hacker News, Oculon signals,
|
|
70
|
+
| Narratives | `oculon narratives [run]` | Groups headlines into storylines that persist across days and flags new or fast-growing ones | Guardian, NYT, Hacker News, Oculon signals, Groq, Gemini, Mistral |
|
|
71
71
|
| Calibration | `oculon calibrate` | Replays past days with the Time Machine, checks which radar items became news within three days, picks the signal threshold with the best F1 and per-source weights; the live radar uses them | Time Machine, Guardian |
|
|
72
72
|
| Company health | `oculon health <company>` | 0-100 early-warning score from hiring momentum, new lawsuits, insider selling, news tone, shipping and the stock move, each part explained; a sharp drop is a signal | Hound sources |
|
|
73
73
|
| Disaster impact | `oculon impact [place]` | People living within the affected radius of M6+ quakes and severe storms, plus night-light change once data covers the days after | USGS, NASA EONET, Wikidata, NASA VIIRS |
|
|
74
|
-
| Contradictions | `oculon contradictions <topic>` | Reads several outlets and lists factual claims that conflict, each side with its source | Tavily, GNews, Guardian, Jina,
|
|
74
|
+
| Contradictions | `oculon contradictions <topic>` | Reads several outlets and lists factual claims that conflict, each side with its source | Tavily, GNews, Guardian, Jina, Groq, Gemini, Mistral |
|
|
75
75
|
| Report | `oculon report` | A self-contained weekly HTML report; sent to Telegram on Mondays | everything above |
|
|
76
76
|
| Plugins | `oculon plugin list/run` | Local `.mjs` plugins add tools to the CLI and MCP server (see `examples/plugins/show-hn.mjs`) | your code |
|
|
77
|
-
| Case Files | `oculon case new "<question>"` | Deep investigations: an agent runs up to 10 tool steps, cross-checks sources and looks for contrary evidence, then writes a case file (answer, findings with confidence, timeline, entities, open questions). Citations are verified in code against what the tools returned; a finding needs two independent sources for "high". Watched cases are re-investigated daily and only new findings are reported | every tool below,
|
|
77
|
+
| Case Files | `oculon case new "<question>"` | Deep investigations: an agent runs up to 10 tool steps, cross-checks sources and looks for contrary evidence, then writes a case file (answer, findings with confidence, timeline, entities, open questions). Citations are verified in code against what the tools returned; a finding needs two independent sources for "high". Watched cases are re-investigated daily and only new findings are reported | every tool below, Groq, Gemini, Mistral |
|
|
78
78
|
| First to Know | `oculon scoops` | For each strong signal, finds when major media first covered the subject (oldest-first search from a week before) and records the lead time, positive or negative. An honest scoreboard of how often Oculon was ahead | Guardian, NYT, GNews |
|
|
79
79
|
| Lynx | `oculon markets` | Cross-checks Polymarket against Kalshi and Manifold; an LLM confirms each pair asks exactly the same question before gaps are reported | Polymarket, Kalshi, Manifold |
|
|
80
80
|
| Launch Radar | `oculon launches <company>` | New Hugging Face models/datasets/Spaces, new iOS apps and updates, new npm packages, plus (with a domain) new hostnames, pages and repos | Hugging Face, App Store, npm, Ferret sources |
|
|
81
81
|
| Time Machine | `oculon rewind <date>` | What Oculon would have seen on a past date: Wikipedia spikes against the weeks before, top Hacker News stories, strong earthquakes and that day's Guardian headlines, fused | Wikimedia, HN, USGS, Guardian |
|
|
82
82
|
| Geofences | `oculon fence add <name> <place>` | Boxes on the map, checked every scan for new military aircraft, military vessels, earthquakes and natural events; draw them on the dashboard map | adsb.lol, aisstream, USGS, NASA EONET |
|
|
83
|
-
| Octopus | `oculon ask "<question>"` | Tool-using AI agent: picks Oculon tools, searches and reads the web, answers with sources. Read-only. | Claude (optional, pay per use: Opus 5.5, Fable 5.2 for case files), then Groq, Gemini, Mistral, NVIDIA NIM, OpenRouter (
|
|
83
|
+
| Octopus | `oculon ask "<question>"` | Tool-using AI agent: picks Oculon tools, searches and reads the web, answers with sources. Read-only. | Claude (optional, pay per use: Opus 5.5, Fable 5.2 for case files), then Groq, Gemini, Mistral, NVIDIA NIM, OpenRouter (automatic fallback) |
|
|
84
84
|
| Owl | `oculon radar` | Global anomaly radar: Wikipedia readership spikes, Hacker News traction, prediction-market swings, trending coins, NYT top stories, earthquakes, natural events and space weather, fused across sources | Wikimedia, HN, Polymarket, CoinGecko, NYT, USGS, NASA EONET, NOAA SWPC |
|
|
85
85
|
| Hound | `oculon dossier <name> [--deep]` | Dossier on a company, person or project: profile and readership spike, stock quote, insider trades and insider sentiment, analyst ratings and their shift, peers, key financials, earnings surprises, decoded 8-K events, news from five outlets, web results, federal court dockets, job openings, UK registry, brand, prediction markets, repos, YouTube, Bluesky; FDA recalls and clinical trials for health and food companies; with `--deep` lobbying, federal contracts, visa filings and patents; one merged timeline | Wikipedia, Finnhub, SEC EDGAR, openFDA, ClinicalTrials.gov, GDELT, GNews, Guardian, NYT, Tavily, CourtListener, Adzuna, Companies House, Brandfetch, Polymarket, GitHub, YouTube, Bluesky |
|
|
86
86
|
| Cricket | `oculon hype <topic>` | Hype-cycle phase (DORMANT, EMERGING, RISING, PEAK, COOLING, STEADY) from 8 weeks of readers, developers, news, press, research, scholarly output and builders | Wikimedia, HN, GDELT, Guardian, arXiv, OpenAlex, GitHub |
|
|
@@ -96,10 +96,14 @@ npx oculon ask "why is Nvidia in the news this week?"
|
|
|
96
96
|
Requires Node.js 22.13 or newer (it uses the built-in `node:sqlite`).
|
|
97
97
|
|
|
98
98
|
```sh
|
|
99
|
-
npm install -g oculon
|
|
100
|
-
oculon
|
|
99
|
+
npm install -g oculon # install the oculon command
|
|
100
|
+
oculon tour # what you can try right away
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
+
Or try it without installing: put `npx` in front of any command, for example `npx oculon scam "Your package is on hold, pay the customs fee"`.
|
|
104
|
+
|
|
105
|
+
`oculon doctor` checks your setup afterwards: the Node.js version, the data folder and which optional API keys are set. Keys are read from the environment or from a `.env` file in the folder you run `oculon` in.
|
|
106
|
+
|
|
103
107
|
Data is stored in `~/.oculon` (set `OCULON_HOME` to change it).
|
|
104
108
|
|
|
105
109
|
## CLI
|
|
@@ -124,7 +128,7 @@ oculon ships "Port of Rotterdam" # live vessels (AIS)
|
|
|
124
128
|
oculon watch add company Nvidia # watchlist: company domain plane topic lights air port
|
|
125
129
|
oculon watch run # report only what changed since last time
|
|
126
130
|
oculon brief # today's brief
|
|
127
|
-
oculon quota # today's API usage vs
|
|
131
|
+
oculon quota # today's API usage vs daily budgets
|
|
128
132
|
oculon ask "is there a geomagnetic storm right now?"
|
|
129
133
|
oculon radar # what the world is suddenly watching
|
|
130
134
|
oculon dossier Nvidia # company / person dossier
|
|
@@ -168,6 +172,19 @@ Or with any MCP client that launches stdio servers:
|
|
|
168
172
|
|
|
169
173
|
Every module is a tool (about 50, plus one per installed plugin tool; `tools/list` returns them with schemas). A few: `oculon_ask`, `oculon_radar`, `oculon_dossier`, `oculon_case_new`, `oculon_calendar`, `oculon_connect`, `oculon_markets_crosscheck`, `oculon_sanctions`, `oculon_health`, `oculon_narratives`, `oculon_ships`, `oculon_military_air`, `oculon_satellite_image` (returns the image), `oculon_forecast`, `oculon_verify_proof`, `oculon_watch_add`, `oculon_brief`, `oculon_signals`, `oculon_entity`.
|
|
170
174
|
|
|
175
|
+
## Oculon Analyst
|
|
176
|
+
|
|
177
|
+
`/ask` on any install (`https://oculon.live/ask`) is a question desk built on the same tools. It is not a chat window:
|
|
178
|
+
|
|
179
|
+
- **Ask anything.** Questions about Oculon itself are answered from its documentation, live-data questions from Oculon's tools, and everything else by searching the web and reading the best pages, preferring official and primary sources.
|
|
180
|
+
- **It plans, then checks.** The analyst splits the question into parts and shows that plan, then runs the checks for every part in parallel. The page shows each source as it is touched (data feeds with LIVE, CACHED or ERROR, plus the pages, articles and records found).
|
|
181
|
+
- **It answers with a brief.** A headline and bottom line, a short explanation for how and why questions, a 0-100 confidence with its reason, 2-6 findings that each cite numbered sources, what the data could not show, and what new evidence would change the answer. Findings can only cite sources the tools returned.
|
|
182
|
+
- **Cross-examine.** One click asks the two other models to judge each finding against the same evidence (supported, partly, unsupported) and to say what the brief missed.
|
|
183
|
+
- **Watch.** A brief can become a personal monitor that reports when the answer changes.
|
|
184
|
+
- **Pick the model:** Claude Haiku 5.5 (fast), Claude Opus 5.5 (thorough) or GPT-6.2 Astra, all through OpenRouter (`OPENROUTER_API_KEY`). Follow-up questions keep the earlier bottom lines as context; the session stays in the browser.
|
|
185
|
+
|
|
186
|
+
On a public install each visitor gets `OCULON_ANALYST_PER_HOUR` questions and cross-examinations per hour (default 40).
|
|
187
|
+
|
|
171
188
|
## Remote MCP
|
|
172
189
|
|
|
173
190
|
Oculon also runs as a remote MCP server, so an agent can use every tool with nothing installed. The endpoint speaks Streamable HTTP (stateless JSON responses):
|
|
@@ -235,10 +252,6 @@ Press Ctrl+K anywhere to search entities or run a module (CVE ids, AS numbers, d
|
|
|
235
252
|
|
|
236
253
|
Free-tier quotas are protected by daily per-source budgets (`oculon quota`); when one is spent, Oculon serves the last cached result or labels the source unavailable instead of calling it.
|
|
237
254
|
|
|
238
|
-
## Splice skill
|
|
239
|
-
|
|
240
|
-
`integrations/splice/oculon` packages keyless tools (radar, space weather, military air, new subdomains) as a Splice skill: `manifest.json`, `SKILL.md`, `tools/`, `tests/`, `examples/`, with network access limited to the seven hosts it uses.
|
|
241
|
-
|
|
242
255
|
## Telegram bot
|
|
243
256
|
|
|
244
257
|
Create a bot with @BotFather, then set:
|
|
@@ -262,7 +275,7 @@ All optional, read from the environment or a `.env` file in the working director
|
|
|
262
275
|
| `OCULON_DB` | Database path override |
|
|
263
276
|
| `OCULON_CONTACT` | Contact email, sent only to SEC EDGAR (which requires one); no other API receives it |
|
|
264
277
|
| `GITHUB_TOKEN` | Raises GitHub limits from 60 to 5000 requests/hour |
|
|
265
|
-
| LLM, search, news, markets, company, security, social and air keys | See `.env.example`; each is optional
|
|
278
|
+
| LLM, search, news, markets, company, security, social and air keys | See `.env.example`; each is optional. `oculon doctor` shows which groups are on |
|
|
266
279
|
|
|
267
280
|
API keys never appear in output: provenance URLs, errors and agent tool results are scrubbed of every key in the environment.
|
|
268
281
|
|
|
@@ -288,7 +301,7 @@ Other deployment switches:
|
|
|
288
301
|
| `RESEND_API_KEY`, `OCULON_MAIL_FROM` | Email alerts for personal monitors (default sender `Oculon <alerts@oculon.live>`; the domain must be verified in Resend). |
|
|
289
302
|
| `OCULON_PURGE_ONCHAIN=1` | Clears data left by the paused on-chain modules each time the server starts. |
|
|
290
303
|
|
|
291
|
-
The repository includes a `Dockerfile`
|
|
304
|
+
The repository includes a `Dockerfile` (on Railway, set the service health check to `/api/meta`). Mount a persistent volume at `/data` (the image sets `OCULON_HOME=/data`), set your keys as environment variables, and point a domain at the service. Each deployment keeps its own database and its own daily budgets.
|
|
292
305
|
|
|
293
306
|
## How it works
|
|
294
307
|
|
|
@@ -299,7 +312,7 @@ The repository includes a `Dockerfile` and `railway.json`. Mount a persistent vo
|
|
|
299
312
|
|
|
300
313
|
## Limits
|
|
301
314
|
|
|
302
|
-
-
|
|
315
|
+
- Public APIs rate-limit; GDELT and arXiv in particular answer 429 after heavy use. Affected sources are reported as errors and the rest of the result still returns.
|
|
303
316
|
- The Wayback Machine CDX API is often slow; Ferret caps it at 45 s.
|
|
304
317
|
- crt.sh can lag behind the CT logs by weeks.
|
|
305
318
|
- OpenTimestamps proofs stay PENDING until a calendar commits to Bitcoin, usually a few hours.
|
|
@@ -323,7 +336,7 @@ The repository includes a `Dockerfile` and `railway.json`. Mount a persistent vo
|
|
|
323
336
|
- Exposure uses InternetDB, which reflects Shodan's last scan (days to weeks old) and knows nothing about machines behind a CDN.
|
|
324
337
|
- Social pulse samples are small (X returns about 10 posts per search on Apify's free plan) and X, TikTok and Bluesky are fetched by popularity, so pace is measured on Reddit only. Address labels come from a community dataset (MIT) and can be incomplete or stale.
|
|
325
338
|
- Plugins run with full Node permissions; install only code you trust.
|
|
326
|
-
- `oculon ask` answers are written by
|
|
339
|
+
- `oculon ask` answers are written by an LLM from tool results; they can still misread data, so check the cited sources.
|
|
327
340
|
- Respect each data provider's terms. OpenStreetMap, Nominatim and adsb.lol data are ODbL-licensed and require attribution.
|
|
328
341
|
|
|
329
342
|
## Development
|
package/dist/agent.d.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { type ChatMessage } from './core/llm.js';
|
|
7
7
|
import type { Oculon } from './index.js';
|
|
8
|
-
|
|
8
|
+
import { type Tool } from './mcp.js';
|
|
9
|
+
export declare const AGENT_TOOLS: Tool[];
|
|
9
10
|
export interface AskStep {
|
|
10
11
|
tool: string;
|
|
11
12
|
args: Record<string, unknown>;
|
|
@@ -41,6 +42,29 @@ export interface AgentOptions {
|
|
|
41
42
|
maxTokens?: number;
|
|
42
43
|
/** Paid Claude first when configured; 'deep' for the most capable model. */
|
|
43
44
|
premium?: boolean | 'deep';
|
|
45
|
+
/** Use exactly this OpenRouter model for every round. */
|
|
46
|
+
route?: string;
|
|
47
|
+
/** Called before a tool runs. */
|
|
48
|
+
onToolStart?: (call: {
|
|
49
|
+
id: string;
|
|
50
|
+
tool: string;
|
|
51
|
+
args: Record<string, unknown>;
|
|
52
|
+
}) => void;
|
|
53
|
+
/** Called with the raw result; text it returns is appended to what the model sees (e.g. numbered sources). */
|
|
54
|
+
onToolResult?: (call: {
|
|
55
|
+
id: string;
|
|
56
|
+
tool: string;
|
|
57
|
+
args: Record<string, unknown>;
|
|
58
|
+
ok: boolean;
|
|
59
|
+
ms: number;
|
|
60
|
+
raw: unknown;
|
|
61
|
+
}) => string | void;
|
|
62
|
+
/** Earlier turns of a conversation, placed before the new question. */
|
|
63
|
+
history?: ChatMessage[];
|
|
64
|
+
/** Extra tools for this run only (not exposed over MCP). */
|
|
65
|
+
extraTools?: Tool[];
|
|
66
|
+
/** Text the model writes alongside its tool calls (its plan for that round). */
|
|
67
|
+
onThought?: (text: string) => void;
|
|
44
68
|
}
|
|
45
69
|
/** The tool loop shared by `ask` and case investigations. */
|
|
46
70
|
export declare function runAgent(o: Oculon, system: string, user: string, opts?: AgentOptions): Promise<AgentRun>;
|
package/dist/agent.js
CHANGED
|
@@ -47,9 +47,11 @@ export function forModel(out, max = 14_000) {
|
|
|
47
47
|
}
|
|
48
48
|
/** The tool loop shared by `ask` and case investigations. */
|
|
49
49
|
export async function runAgent(o, system, user, opts = {}) {
|
|
50
|
-
const
|
|
50
|
+
const runTools = [...(opts.extraTools ?? []), ...agentTools()];
|
|
51
|
+
const tools = runTools.map((t) => ({ type: 'function', function: { name: t.name, description: t.description, parameters: t.inputSchema } }));
|
|
51
52
|
const messages = [
|
|
52
53
|
{ role: 'system', content: `${system}\nToday is ${o.ctx.now().toISOString().slice(0, 10)}.` },
|
|
54
|
+
...(opts.history ?? []),
|
|
53
55
|
{ role: 'user', content: user },
|
|
54
56
|
];
|
|
55
57
|
const steps = [];
|
|
@@ -58,15 +60,17 @@ export async function runAgent(o, system, user, opts = {}) {
|
|
|
58
60
|
const maxSteps = opts.maxSteps ?? 6;
|
|
59
61
|
for (let round = 0; round < maxSteps; round++) {
|
|
60
62
|
// On the last round, withhold tools so the model must answer.
|
|
61
|
-
const r = await chat(messages, { tools: round < maxSteps - 1 ? tools : [], maxTokens: opts.maxTokens ?? 1800, premium: opts.premium ?? true, ...(opts.fetch ? { fetch: opts.fetch } : {}) });
|
|
63
|
+
const r = await chat(messages, { tools: round < maxSteps - 1 ? tools : [], maxTokens: opts.maxTokens ?? 1800, premium: opts.premium ?? true, ...(opts.route ? { route: opts.route } : {}), ...(opts.fetch ? { fetch: opts.fetch } : {}) });
|
|
62
64
|
providers.push(r.provider);
|
|
63
65
|
const calls = r.message.tool_calls ?? [];
|
|
64
66
|
if (!calls.length) {
|
|
65
67
|
return { answer: (r.message.content ?? '').trim() || '(no answer)', steps, providers, messages, urls };
|
|
66
68
|
}
|
|
67
69
|
messages.push(carryRaw(r.message, { role: 'assistant', content: r.message.content ?? '', tool_calls: calls }));
|
|
70
|
+
if (r.message.content?.trim())
|
|
71
|
+
opts.onThought?.(r.message.content.trim());
|
|
68
72
|
const results = await Promise.all(calls.map(async (c) => {
|
|
69
|
-
const tool =
|
|
73
|
+
const tool = runTools.find((t) => t.name === c.function.name);
|
|
70
74
|
let args = {};
|
|
71
75
|
try {
|
|
72
76
|
args = JSON.parse(c.function.arguments || '{}');
|
|
@@ -74,21 +78,27 @@ export async function runAgent(o, system, user, opts = {}) {
|
|
|
74
78
|
catch { }
|
|
75
79
|
const t0 = Date.now();
|
|
76
80
|
opts.onStep?.(`${c.function.name}(${JSON.stringify(args)})`);
|
|
81
|
+
opts.onToolStart?.({ id: c.id, tool: c.function.name, args });
|
|
77
82
|
let content;
|
|
78
83
|
let ok = true;
|
|
84
|
+
let raw = null;
|
|
79
85
|
if (!tool) {
|
|
80
86
|
content = `error: unknown tool ${c.function.name}`;
|
|
81
87
|
ok = false;
|
|
82
88
|
}
|
|
83
89
|
else {
|
|
84
90
|
try {
|
|
85
|
-
|
|
91
|
+
raw = await tool.run(o, args);
|
|
92
|
+
content = forModel(raw);
|
|
86
93
|
}
|
|
87
94
|
catch (e) {
|
|
88
95
|
content = `error: ${scrubSecrets(e.message)}`;
|
|
89
96
|
ok = false;
|
|
90
97
|
}
|
|
91
98
|
}
|
|
99
|
+
const extra = opts.onToolResult?.({ id: c.id, tool: c.function.name, args, ok, ms: Date.now() - t0, raw });
|
|
100
|
+
if (extra)
|
|
101
|
+
content += `\n${extra}`;
|
|
92
102
|
steps.push({ tool: c.function.name, args, ok, ms: Date.now() - t0, chars: content.length });
|
|
93
103
|
for (const u of content.match(/https?:\/\/[^\s"'<>\\]+/g) ?? [])
|
|
94
104
|
urls.add(u.replace(/[).,;]+$/, ''));
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { Oculon } from './index.js';
|
|
2
|
+
export declare const ANALYST_MODELS: {
|
|
3
|
+
readonly haiku: {
|
|
4
|
+
readonly id: 'anthropic/claude-haiku-5.5';
|
|
5
|
+
readonly label: 'Claude Haiku 5.5';
|
|
6
|
+
readonly note: 'fast';
|
|
7
|
+
};
|
|
8
|
+
readonly opus: {
|
|
9
|
+
readonly id: 'anthropic/claude-opus-5.5';
|
|
10
|
+
readonly label: 'Claude Opus 5.5';
|
|
11
|
+
readonly note: 'thorough';
|
|
12
|
+
};
|
|
13
|
+
readonly gpt: {
|
|
14
|
+
readonly id: 'openai/gpt-6.2-astra';
|
|
15
|
+
readonly label: 'GPT-6.2 Astra';
|
|
16
|
+
readonly note: 'second view';
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export type AnalystModel = keyof typeof ANALYST_MODELS;
|
|
20
|
+
export declare const isAnalystModel: (m: unknown) => m is AnalystModel;
|
|
21
|
+
export interface Source {
|
|
22
|
+
n: number;
|
|
23
|
+
kind: 'feed' | 'link';
|
|
24
|
+
label: string;
|
|
25
|
+
url?: string;
|
|
26
|
+
host?: string;
|
|
27
|
+
status?: string;
|
|
28
|
+
tool: string;
|
|
29
|
+
}
|
|
30
|
+
export interface Finding {
|
|
31
|
+
text: string;
|
|
32
|
+
sources: number[];
|
|
33
|
+
}
|
|
34
|
+
export interface Brief {
|
|
35
|
+
headline: string;
|
|
36
|
+
bottomLine: string;
|
|
37
|
+
/** Longer explanation for how/why/steps questions, with [n] citations inline. */
|
|
38
|
+
details: string;
|
|
39
|
+
confidence: number;
|
|
40
|
+
confidenceWhy: string;
|
|
41
|
+
findings: Finding[];
|
|
42
|
+
unknowns: string[];
|
|
43
|
+
changeMyMind: string;
|
|
44
|
+
followUps: string[];
|
|
45
|
+
watch: string | null;
|
|
46
|
+
}
|
|
47
|
+
export interface AnalystEvent {
|
|
48
|
+
type: 'start' | 'plan' | 'step' | 'stepdone' | 'brief' | 'error';
|
|
49
|
+
[k: string]: unknown;
|
|
50
|
+
}
|
|
51
|
+
export interface AnalystResult {
|
|
52
|
+
id: string;
|
|
53
|
+
question: string;
|
|
54
|
+
model: AnalystModel;
|
|
55
|
+
brief: Brief;
|
|
56
|
+
sources: Source[];
|
|
57
|
+
steps: {
|
|
58
|
+
tool: string;
|
|
59
|
+
label: string;
|
|
60
|
+
ok: boolean;
|
|
61
|
+
ms: number;
|
|
62
|
+
}[];
|
|
63
|
+
ms: number;
|
|
64
|
+
}
|
|
65
|
+
export declare function searchDocs(query: string, max?: number): {
|
|
66
|
+
title: string;
|
|
67
|
+
url: string;
|
|
68
|
+
text: string;
|
|
69
|
+
}[];
|
|
70
|
+
/** "oculon_url_check" -> "URL check" */
|
|
71
|
+
export declare function toolLabel(name: string): string;
|
|
72
|
+
export interface AnalystOptions {
|
|
73
|
+
question: string;
|
|
74
|
+
model: AnalystModel;
|
|
75
|
+
/** Earlier turns: the question and the brief's bottom line, oldest first. */
|
|
76
|
+
history?: {
|
|
77
|
+
q: string;
|
|
78
|
+
a: string;
|
|
79
|
+
}[];
|
|
80
|
+
onEvent?: (e: AnalystEvent) => void;
|
|
81
|
+
}
|
|
82
|
+
export declare function analyst(o: Oculon, opts: AnalystOptions): Promise<AnalystResult>;
|
|
83
|
+
export interface Review {
|
|
84
|
+
model: AnalystModel;
|
|
85
|
+
label: string;
|
|
86
|
+
findings: {
|
|
87
|
+
i: number;
|
|
88
|
+
verdict: 'supported' | 'partly' | 'unsupported';
|
|
89
|
+
note: string;
|
|
90
|
+
}[];
|
|
91
|
+
bottomLine: 'agree' | 'partly' | 'disagree';
|
|
92
|
+
missed: string | null;
|
|
93
|
+
error?: string;
|
|
94
|
+
}
|
|
95
|
+
/** The other models re-read the same evidence and judge each finding. */
|
|
96
|
+
export declare function crossExamine(id: string): Promise<{
|
|
97
|
+
id: string;
|
|
98
|
+
reviews: Review[];
|
|
99
|
+
}>;
|