oculon 0.1.0 → 0.1.1
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/index.d.ts +4 -0
- package/dist/index.js +9 -1
- package/dist/mcp.js +1 -1
- package/dist/modules/scam.js +40 -2
- package/dist/modules/tortoise.d.ts +19 -0
- package/dist/modules/tortoise.js +31 -2
- package/dist/sources/opentimestamps.d.ts +5 -0
- package/dist/sources/opentimestamps.js +14 -0
- package/dist/web/docs.html +18 -0
- package/dist/web/landing.html +2 -1
- package/dist/web/public.js +1 -0
- package/dist/web/server.js +14 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -89,7 +89,7 @@ npx oculon ask "why is Nvidia in the news this week?"
|
|
|
89
89
|
| Falcon | `oculon plane <reg>` / `oculon mil` | One aircraft (owner, live position, nearest airport, moves between checks); worldwide military air traffic with notable roles (tanker, AWACS, ISR, bomber) and surges versus history | adsb.lol, OpenSky, hexdb.io, OurAirports |
|
|
90
90
|
| Condor | `oculon events` / `lights` / `image` / `space` / `air` | Natural events with severity; night-time lights of any place versus a baseline month to spot blackouts or surges; true-color satellite images; space weather (official NOAA alerts and scales, solar wind, 3-day forecast, solar flares, coronal mass ejections modelled to reach Earth, geomagnetic storms, close asteroid passes); PM2.5 air quality | NASA EONET, NASA GIBS (VIIRS, MODIS), NOAA SWPC, NASA DONKI and NeoWs, OpenAQ, Nominatim |
|
|
91
91
|
| Raven | `oculon forecast ...` | Forecasts on live Polymarket markets, resolved against real outcomes and scored (Brier) against the crowd price at forecast time | Polymarket |
|
|
92
|
-
| Tortoise | `oculon proof ...` | Tamper-evident proofs: forecasts hashed into a Merkle tree, timestamped on Bitcoin through OpenTimestamps, verified down to the block merkle root | OpenTimestamps, Blockstream |
|
|
92
|
+
| Tortoise | `oculon proof ...` | Tamper-evident proofs: forecasts hashed into a Merkle tree, timestamped on Bitcoin through OpenTimestamps, verified down to the block merkle root. Each proof can be checked without Oculon: `/api/proof?id=<id>` gives the forecast, its canonical JSON, hash and Merkle path, and `/proof/<id>.ots` is a standard OpenTimestamps file for `ots verify -d <root> <id>.ots` | OpenTimestamps, Blockstream |
|
|
93
93
|
|
|
94
94
|
## Install
|
|
95
95
|
|
package/dist/index.d.ts
CHANGED
|
@@ -82,6 +82,10 @@ export declare class Oculon {
|
|
|
82
82
|
}>>;
|
|
83
83
|
/** Tortoise: verify a forecast's proof down to the Bitcoin block. */
|
|
84
84
|
verifyProof(predictionId: string): Promise<ModuleResult<import("./modules/tortoise.js").Verification>>;
|
|
85
|
+
/** Tortoise: the forecast, its hash, Merkle path and root, for checking without this install. */
|
|
86
|
+
proofBundle(predictionId: string): import("./modules/tortoise.js").ProofBundle;
|
|
87
|
+
/** Tortoise: the standard OpenTimestamps `.ots` file for a forecast's batch, or null before stamping. */
|
|
88
|
+
proofOts(predictionId: string): Buffer<ArrayBufferLike> | null;
|
|
85
89
|
/** Magpie: wallet portfolio, history and risk (EVM or Solana address). */
|
|
86
90
|
wallet(address: string): Promise<ModuleResult<import("./modules/magpie.js").WalletResult>>;
|
|
87
91
|
/** Magpie: token contract risk, DEX pairs and price. On chain "robinhood" this uses Heron's own rules. */
|
package/dist/index.js
CHANGED
|
@@ -37,7 +37,7 @@ import { ferret } from './modules/ferret.js';
|
|
|
37
37
|
import { hound } from './modules/hound.js';
|
|
38
38
|
import { owl } from './modules/owl.js';
|
|
39
39
|
import { auto, getPrediction, listPredictions, predict, resolve, scoreboard } from './modules/raven.js';
|
|
40
|
-
import { stamp, verify } from './modules/tortoise.js';
|
|
40
|
+
import { proofBundle, proofOts, stamp, verify } from './modules/tortoise.js';
|
|
41
41
|
import { token, wallet } from './modules/magpie.js';
|
|
42
42
|
import { deployerProfile, overview, rhTokenCheck } from './modules/heron.js';
|
|
43
43
|
import { addWatch, listWatch, removeWatch, runWatch } from './modules/meerkat.js';
|
|
@@ -139,6 +139,14 @@ export class Oculon {
|
|
|
139
139
|
verifyProof(predictionId) {
|
|
140
140
|
return verify(this.ctx, predictionId);
|
|
141
141
|
}
|
|
142
|
+
/** Tortoise: the forecast, its hash, Merkle path and root, for checking without this install. */
|
|
143
|
+
proofBundle(predictionId) {
|
|
144
|
+
return proofBundle(this.ctx, predictionId);
|
|
145
|
+
}
|
|
146
|
+
/** Tortoise: the standard OpenTimestamps `.ots` file for a forecast's batch, or null before stamping. */
|
|
147
|
+
proofOts(predictionId) {
|
|
148
|
+
return proofOts(this.ctx, predictionId);
|
|
149
|
+
}
|
|
142
150
|
/** Magpie: wallet portfolio, history and risk (EVM or Solana address). */
|
|
143
151
|
wallet(address) {
|
|
144
152
|
return wallet(this.ctx, address);
|
package/dist/mcp.js
CHANGED
|
@@ -7,7 +7,7 @@ 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.1' };
|
|
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 });
|
package/dist/modules/scam.js
CHANGED
|
@@ -5,7 +5,8 @@ const PATTERNS = [
|
|
|
5
5
|
{ name: 'urgency or threat', weight: 15, re: /\b(urgent|immediately|within (24|48) hours|final (notice|warning)|last chance|act now|expires? today|will be (suspended|closed|deleted|blocked)|legal action|arrest warrant)\b/i },
|
|
6
6
|
{ name: 'account locked or verify your account', weight: 20, re: /\b(account (has been |is )?(suspended|locked|limited|restricted|on hold|compromised)|verify your (account|identity|details)|unusual (sign[- ]?in|activity)|confirm your (password|details|information))\b/i },
|
|
7
7
|
{ name: 'parcel or delivery fee', weight: 25, re: /\b(parcel|package|delivery|shipment)\b[\s\S]{0,80}\b(fee|pay|held|on hold|failed|unpaid|customs|redeliver|re-?schedule)\b/i },
|
|
8
|
-
{ name: 'prize, lottery or giveaway', weight: 25, re: /\b(you('ve| have)? won|winner|lottery|jackpot|claim your (prize|reward|gift)|selected to receive|free (iphone|gift))\b/i },
|
|
8
|
+
{ name: 'prize, lottery or giveaway', weight: 25, re: /\b(you('ve| have)? won|winner|lottery|jackpot|claim your (prize|reward|gift)|selected to receive|free (iphone|gift)|giveaway|airdrop|you (were|have been|are|got) (selected|chosen|picked)|(selected|chosen|picked) as (the|a|one of)|lucky (winner|recipient|one))\b/i },
|
|
9
|
+
{ name: 'asks for your crypto wallet or recovery phrase', weight: 35, re: /\b(seed phrase|recovery phrase|secret (recovery )?phrase|private key|1[2-8][- ]word|connect your wallet|(validate|verify|sync|rectify) your wallet)\b|\b(send|share|give|drop|reply with|dm|tell)\b(?: me)?[\s\S]{0,25}\b(sol|solana|eth|ethereum|btc|bitcoin|usdt|bnb|trx|crypto|wallet|metamask|phantom|trust ?wallet)\s+(wallet\s+)?(address|addy|wallet)\b/i },
|
|
9
10
|
{ name: 'refund or tax rebate', weight: 20, re: /\b(refund|rebate|overpaid|reimbursement|compensation)\b[\s\S]{0,60}\b(claim|click|eligible|pending|approved)\b/i },
|
|
10
11
|
{ name: 'asks for a one-time code or password', weight: 40, re: /\b(otp|one[- ]time (code|password)|verification code|security code|6-digit code|pin)\b[\s\S]{0,60}\b(send|share|reply|tell|give|forward)\b|\b(send|share|reply with|tell me|give me|forward)\b[\s\S]{0,40}\b(otp|code|password|pin)\b/i },
|
|
11
12
|
{ name: 'gift card or crypto payment', weight: 30, re: /\b(gift ?cards?|itunes card|google play card|steam card|pay (in|with|via) (bitcoin|btc|usdt|crypto)|bitcoin atm|wallet address)\b/i },
|
|
@@ -13,6 +14,20 @@ const PATTERNS = [
|
|
|
13
14
|
{ name: 'guaranteed investment returns', weight: 25, re: /\b(guaranteed (profit|return)s?|double your (money|investment)|\d{2,3}% (return|profit)|risk[- ]free investment|trading (signal|mentor)|recover your (lost )?(funds|crypto))\b/i },
|
|
14
15
|
{ name: 'a "new number" or a request for secrecy', weight: 25, re: /\b(this is my new number|my new number|lost my phone|phone (is )?broken|don't tell (anyone|dad|mom|mum)|keep (this|it) (between us|confidential|secret|quiet))\b/i },
|
|
15
16
|
{ name: 'asks you to send money', weight: 20, re: /\b(send|transfer|wire|lend|pay)\b(?: me)?[\s\S]{0,25}(\$|€|£|usd|eur|gbp)\s?\d|\b(send|transfer|wire|lend)\b(?: me)? (some )?(money|cash|funds)\b/i },
|
|
17
|
+
{ name: 'crypto promotion or fake volume offer', weight: 35, re: /\b(promot(e|ion|ing) (your|ur|the) (project|token|coin|community|launch)|(massive|organic|real|huge) (volume|holders|buyers|traction)|volume bots?|diamond holders|increase (your |ur )?(project'?s? )?(market ?cap|mc|holders|volume)|(trend(ing)?) on (dextools|dexscreener|coingecko|cmc|birdeye|pump\.?fun|twitter|x)|(cmc|coingecko|coinmarketcap|cg|cex) listings?|fast[- ]track listing|kol (campaign|marketing|promotion)s?|shill(ing)? (campaign|service|team)|raid (team|service)s?|call channels?|promote on all chains|pump (your|ur) (chart|token|coin))\b/i },
|
|
18
|
+
{ name: 'unsolicited paid service for your token', weight: 30, re: /\b(how to buy (guide|video|tutorial)|(logo|banner|website|video|meme|sticker|animation)s? for (your|ur) (token|project|coin|memecoin))\b|\b(yo|hey|hi|hello|dear|gm) dev\b[\s\S]{0,220}\b(dm|d m|telegram|details|\$\s?\d+)|\bfor (your|ur) (token|project|coin|memecoin)\b[\s\S]{0,160}(\$\s?\d+|\d+\s?(usdt|usd|sol|eth|bnb)\b|check my (last |previous |past )?work)/i },
|
|
19
|
+
{ name: 'exclusive early-access or signals pitch', weight: 25, re: /\b(right circle|inner circle|private (group|circle|channel|community)|vip (group|channel|signals?|access)|alpha (group|channel|calls?|chat)|position(ing|ed)? (early|smart)|get in early|before (it|they) (pumps?|moons?|trends?|explodes?)|first wave|next \d{2,4}x|\d{2,4}x (gems?|coins?|potential|returns?)|insider (info|calls|tips|access)|(trading|crypto|forex) signals?|pump (group|signals?))\b/i },
|
|
20
|
+
{ name: 'hype or fear of missing out', weight: 10, re: /\b(don'?t miss (out|this)|before it'?s too late|limited (spots|slots|seats)|only \d+ (spots|slots|seats) left|access matters|timing matters|being early|early (access|entry|birds?)|to the moon|life[- ]changing (money|opportunity)|financial freedom|passive income)\b/i },
|
|
21
|
+
{ name: 'fake support or wallet "validation"', weight: 35, re: /\b(i('m| am) (from|with) (the )?(support|admin|help ?desk|security|compliance) team|(binance|coinbase|metamask|trust ?wallet|phantom|kraken|ledger|okx|bybit|kucoin) (support|team|security|admin)|wallet (validation|synchroni[sz]ation|sync|migration|rectification|whitelisting)|(claim|unlock|release) your (airdrop|tokens|funds|rewards)|dapp (link|portal|connect))\b/i },
|
|
22
|
+
{ name: 'investment platform that needs a fee to withdraw', weight: 35, re: /\b((withdrawal|unlock|release|clearance|verification|upgrade) (fee|tax|deposit)|pay (the |a |an )?(tax|fee|deposit) (to|before|in order to) (withdraw|release|unlock)|(liquidity|usdt|cloud|defi) mining|mining pool|arbitrage (bot|platform|trading)|my (uncle|aunt|mentor|teacher|cousin) (works|taught|showed|is an analyst)|(trading|investment) platform\b[\s\S]{0,60}\b(profit|returns?|deposit|withdraw))\b/i },
|
|
23
|
+
{ name: 'task job that asks for a deposit', weight: 30, re: /\b((optimi[sz]ation|rating|review|data|order) tasks?|complete (\d+ )?tasks (a|per) day|(recharge|top[- ]?up|deposit) (to|before|in order to) (unlock|continue|complete|withdraw)|commission (per|for each|on every) (task|order|review)|negative balance)\b/i },
|
|
24
|
+
{ name: 'funds recovery offer', weight: 35, re: /\b((funds?|crypto|scam|asset) recovery (service|expert|agent|team|company)|recovery (expert|agent|specialist|hacker)|ethical hacker|hire a hacker|we (can )?(help )?(get|bring) (your |the )?(money|funds|crypto) back)\b/i },
|
|
25
|
+
{ name: 'blackmail or sextortion', weight: 45, re: /\b(i (have )?(recorded|hacked|filmed) (you|your)|(webcam|camera) (recording|footage)|intimate (video|photos?|pictures)|send (it|this|the (video|photos?)) to (all )?your (contacts|friends|family|colleagues)|(or|otherwise) (i will|i'll) (send|share|publish|release|leak))\b/i },
|
|
26
|
+
{ name: 'tech support or fake subscription renewal', weight: 30, re: /\b(your (computer|pc|device|phone|mac) (is|has been) (infected|hacked|compromised|locked)|(call|contact) (microsoft|apple|windows|norton|mcafee) support|(norton|mcafee|geek squad|amazon prime|paypal)\b[\s\S]{0,50}\b(renew(al|ed)?|subscription|charged|invoice|order)\b[\s\S]{0,80}\b(call|cancel|dispute|refund)|toll[- ]free)\b/i },
|
|
27
|
+
{ name: 'loan that wants a fee first', weight: 30, re: /\b((instant|guaranteed|pre[- ]?approved) loan|loan (has been |is )?approved|no credit check|(processing|insurance|activation|registration) fee\b[\s\S]{0,40}\bloan|loan\b[\s\S]{0,40}\b(processing|insurance|activation|registration) fee)\b/i },
|
|
28
|
+
{ name: 'government, toll or tax impersonation', weight: 25, re: /\b(irs|hmrc|social security (number|administration)|ssn (has been |is )?(suspended|compromised|blocked)|tax (office|department|authority) [\s\S]{0,40}(owe|unpaid|refund)|toll (charges?|payment|violation|balance)|unpaid (toll|tax|fine|ticket)|outstanding (toll|fine|penalty|balance)[\s\S]{0,40}(pay|avoid))\b/i },
|
|
29
|
+
{ name: 'wrong-number or cold friendly opener', weight: 10, re: /^\s*((hi|hello|hey)[\s,!.]*)?(is this|are you) [A-Z][a-z]+\b|\b(sorry,? (wrong number|i (must have )?(texted|messaged) the wrong (person|number))|remember me\?)/i },
|
|
30
|
+
{ name: 'moves you to a private chat', weight: 10, re: /\b(check (my|the|your) (dm|d m|inbox|pm)|in (the |my )?d ?m\b|dm me|pm me|message me on (whatsapp|telegram|signal)|add me on (whatsapp|telegram|signal|wechat|line)|contact (me|us) on (whatsapp|telegram))\b/i },
|
|
16
31
|
{ name: 'link shortener or tracking link', weight: 10, re: /\b(bit\.ly|tinyurl\.com|t\.co|is\.gd|cutt\.ly|rb\.gy|shorturl\.at|ow\.ly|tiny\.cc)\//i },
|
|
17
32
|
];
|
|
18
33
|
const BRANDS = /\b(paypal|apple|amazon|netflix|microsoft|google|facebook|instagram|whatsapp|dhl|fedex|ups|usps|royal mail|irs|hmrc|bank|visa|mastercard|binance|coinbase|metamask)\b/i;
|
|
@@ -73,6 +88,17 @@ export async function scamCheck(ctx, text) {
|
|
|
73
88
|
risk += 20;
|
|
74
89
|
reasons.push('a new number asking for money is the "hi mum" family-impersonation scam');
|
|
75
90
|
}
|
|
91
|
+
// Several crypto scam signs in one message weigh more than each alone.
|
|
92
|
+
const cryptoHits = patterns.filter((p) => /crypto|token|early-access|fake support|withdraw/.test(p.name)).length;
|
|
93
|
+
if (cryptoHits >= 2) {
|
|
94
|
+
risk += 15;
|
|
95
|
+
reasons.push('several crypto scam signs appear together');
|
|
96
|
+
}
|
|
97
|
+
// A giveaway that wants your wallet is the crypto "you were selected" scam.
|
|
98
|
+
if (patterns.some((p) => /giveaway/.test(p.name)) && patterns.some((p) => /crypto wallet/.test(p.name))) {
|
|
99
|
+
risk += 20;
|
|
100
|
+
reasons.push('a giveaway that asks for your wallet is a common crypto scam');
|
|
101
|
+
}
|
|
76
102
|
const brand = BRANDS.exec(msg)?.[1];
|
|
77
103
|
if (brand && sender && (sender.freeMail || !senderDomain.includes(brand.toLowerCase().replace(/\s+/g, '')))) {
|
|
78
104
|
risk += 25;
|
|
@@ -89,8 +115,20 @@ export async function scamCheck(ctx, text) {
|
|
|
89
115
|
advice.push('Do not click the links or reply. Open the company\'s app or type its address yourself.');
|
|
90
116
|
if (patterns.some((p) => /code|password/.test(p.name)))
|
|
91
117
|
advice.push('Never share a one-time code: no real company asks for it.');
|
|
92
|
-
if (patterns.some((p) => /gift card|crypto/.test(p.name)))
|
|
118
|
+
if (patterns.some((p) => /gift card|crypto payment/.test(p.name)))
|
|
93
119
|
advice.push('Requests for gift cards or crypto are almost always fraud.');
|
|
120
|
+
if (patterns.some((p) => /crypto wallet/.test(p.name)))
|
|
121
|
+
advice.push('Never share a recovery phrase or private key, and ignore "giveaways" that ask for your wallet: they lead to drained wallets or fake fees.');
|
|
122
|
+
if (patterns.some((p) => /promotion|paid service|early-access/.test(p.name)))
|
|
123
|
+
advice.push('Unsolicited offers to promote a token, sell you "volume" or let you into an early group are spam or paid pump schemes. Do not pay upfront.');
|
|
124
|
+
if (patterns.some((p) => /fee to withdraw|task job/.test(p.name)))
|
|
125
|
+
advice.push('If a platform or job wants a fee or deposit before you can withdraw, stop paying: the money will not come back.');
|
|
126
|
+
if (patterns.some((p) => /recovery/.test(p.name)))
|
|
127
|
+
advice.push('"Recovery" services that contact you after a loss are a second scam.');
|
|
128
|
+
if (patterns.some((p) => /blackmail/.test(p.name)))
|
|
129
|
+
advice.push('Do not pay or reply. These threats are usually sent in bulk with a password from an old data leak. Change that password and report the message.');
|
|
130
|
+
if (patterns.some((p) => /tech support|subscription/.test(p.name)))
|
|
131
|
+
advice.push('Do not call numbers in the message. Check your account on the company\'s own site.');
|
|
94
132
|
if (patterns.some((p) => /new number/.test(p.name)))
|
|
95
133
|
advice.push('Call the person on the number you already have before sending anything.');
|
|
96
134
|
advice.push('Report it: forward phishing SMS to 7726 (US, UK) and report emails to the impersonated company.');
|
|
@@ -6,8 +6,27 @@
|
|
|
6
6
|
* because it needs a funded wallet.
|
|
7
7
|
*/
|
|
8
8
|
import type { Ctx } from '../core/context.js';
|
|
9
|
+
import { type PathStep } from '../core/merkle.js';
|
|
9
10
|
import type { ModuleResult } from '../core/types.js';
|
|
10
11
|
import { type Receipt } from '../sources/opentimestamps.js';
|
|
12
|
+
import { predictionCore } from './raven.js';
|
|
13
|
+
/** Everything needed to check a forecast's proof without trusting this server. */
|
|
14
|
+
export interface ProofBundle {
|
|
15
|
+
forecast: ReturnType<typeof predictionCore>;
|
|
16
|
+
canonicalJson: string;
|
|
17
|
+
leaf: string;
|
|
18
|
+
merklePath: PathStep[];
|
|
19
|
+
root: string | null;
|
|
20
|
+
batchId: string | null;
|
|
21
|
+
bitcoin: {
|
|
22
|
+
height: number;
|
|
23
|
+
time: string;
|
|
24
|
+
} | null;
|
|
25
|
+
howToVerify: string[];
|
|
26
|
+
}
|
|
27
|
+
export declare function proofBundle(ctx: Ctx, predictionId: string): ProofBundle;
|
|
28
|
+
/** The forecast's batch root as a standard `.ots` file, or null when it has not been stamped yet. */
|
|
29
|
+
export declare function proofOts(ctx: Ctx, predictionId: string): Buffer | null;
|
|
11
30
|
export interface Batch {
|
|
12
31
|
id: string;
|
|
13
32
|
root: string;
|
package/dist/modules/tortoise.js
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
import { applyPath, merkle } from '../core/merkle.js';
|
|
2
|
-
import { bitcoinBlock, matchesMerkleRoot, parseTimestamp, submit, upgrade } from '../sources/opentimestamps.js';
|
|
3
|
-
import {
|
|
2
|
+
import { bitcoinBlock, matchesMerkleRoot, otsFile, parseTimestamp, submit, upgrade } from '../sources/opentimestamps.js';
|
|
3
|
+
import { canonicalJson } from '../core/merkle.js';
|
|
4
|
+
import { getPrediction, leafOf, predictionCore } from './raven.js';
|
|
5
|
+
export function proofBundle(ctx, predictionId) {
|
|
6
|
+
const p = getPrediction(ctx, predictionId);
|
|
7
|
+
if (!p)
|
|
8
|
+
throw new Error(`no prediction ${predictionId}`);
|
|
9
|
+
const forecast = predictionCore(p);
|
|
10
|
+
const row = ctx.store.db.prepare('SELECT merkle_path FROM predictions WHERE id = ?').get(p.id);
|
|
11
|
+
const batch = p.batchId ? getBatch(ctx, p.batchId) : null;
|
|
12
|
+
return {
|
|
13
|
+
forecast,
|
|
14
|
+
canonicalJson: canonicalJson(forecast),
|
|
15
|
+
leaf: p.leaf,
|
|
16
|
+
merklePath: row.merkle_path ? JSON.parse(row.merkle_path) : [],
|
|
17
|
+
root: batch?.root ?? null,
|
|
18
|
+
batchId: batch?.id ?? null,
|
|
19
|
+
bitcoin: batch?.bitcoinHeight ? { height: batch.bitcoinHeight, time: new Date((batch.bitcoinTime ?? 0) * 1000).toISOString() } : null,
|
|
20
|
+
howToVerify: [
|
|
21
|
+
'SHA-256 of canonicalJson (UTF-8) must equal leaf.',
|
|
22
|
+
'Walk merklePath from leaf: for each step, hash sha256(current || sibling) when side is R, or sha256(sibling || current) when side is L. The result must equal root.',
|
|
23
|
+
`Download the OpenTimestamps proof (/proof/${p.id}.ots) and run: ots verify -d ${batch?.root ?? '<root>'} ${p.id}.ots (or open it at opentimestamps.org). It names the Bitcoin block whose merkle root commits to root.`,
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/** The forecast's batch root as a standard `.ots` file, or null when it has not been stamped yet. */
|
|
28
|
+
export function proofOts(ctx, predictionId) {
|
|
29
|
+
const p = getPrediction(ctx, predictionId);
|
|
30
|
+
const batch = p?.batchId ? getBatch(ctx, p.batchId) : null;
|
|
31
|
+
return batch && batch.receipts.length ? otsFile(batch.root, batch.receipts) : null;
|
|
32
|
+
}
|
|
4
33
|
const toBatch = (r) => ({
|
|
5
34
|
id: r.id,
|
|
6
35
|
root: r.root,
|
|
@@ -21,6 +21,11 @@ export interface Receipt {
|
|
|
21
21
|
/** Hex of the calendar's serialized timestamp for our digest. */
|
|
22
22
|
ots: string;
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* A standard detached `.ots` file for a SHA-256 digest, built from the calendar receipts.
|
|
26
|
+
* Any OpenTimestamps tool can upgrade and verify it, e.g. `ots verify -d <digest> proof.ots`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function otsFile(digestHex: string, receipts: Receipt[]): Buffer;
|
|
24
29
|
export declare function submit(ctx: Ctx, digestHex: string): Promise<{
|
|
25
30
|
receipts: Receipt[];
|
|
26
31
|
provenance: Provenance[];
|
|
@@ -96,6 +96,20 @@ export function parseTimestamp(bytes, digest) {
|
|
|
96
96
|
walk(digest);
|
|
97
97
|
return out;
|
|
98
98
|
}
|
|
99
|
+
const OTS_MAGIC = Buffer.from('004f70656e54696d657374616d7073000050726f6f6600bf89e2e884e89294', 'hex');
|
|
100
|
+
/**
|
|
101
|
+
* A standard detached `.ots` file for a SHA-256 digest, built from the calendar receipts.
|
|
102
|
+
* Any OpenTimestamps tool can upgrade and verify it, e.g. `ots verify -d <digest> proof.ots`.
|
|
103
|
+
*/
|
|
104
|
+
export function otsFile(digestHex, receipts) {
|
|
105
|
+
const parts = [OTS_MAGIC, Buffer.from([0x01, 0x08]), Buffer.from(digestHex, 'hex')];
|
|
106
|
+
receipts.forEach((rc, i) => {
|
|
107
|
+
if (i < receipts.length - 1)
|
|
108
|
+
parts.push(Buffer.from([0xff]));
|
|
109
|
+
parts.push(Buffer.from(rc.ots, 'hex'));
|
|
110
|
+
});
|
|
111
|
+
return Buffer.concat(parts);
|
|
112
|
+
}
|
|
99
113
|
export async function submit(ctx, digestHex) {
|
|
100
114
|
const body = Buffer.from(digestHex, 'hex');
|
|
101
115
|
const results = await Promise.all(CALENDARS.map((c) => ctx.http.postBytes(`${c}/digest`, body, { source: 'opentimestamps', headers: { accept: 'application/vnd.opentimestamps.v1' } })));
|
package/dist/web/docs.html
CHANGED
|
@@ -109,6 +109,10 @@ aside.left a.on{text-shadow:0 0 18px rgba(0,240,255,.6)}
|
|
|
109
109
|
.msearch span{font:12px var(--mono);color:var(--mut)}
|
|
110
110
|
.msearch:focus-within{border-color:var(--y);box-shadow:0 0 22px rgba(0,240,255,.15)}
|
|
111
111
|
.mods{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
|
|
112
|
+
.fusion{border:1px solid #1f2a2d;background:rgba(4,8,9,.85);padding:20px 22px}
|
|
113
|
+
.fusion .ft{font-size:20px;color:#fff;margin:6px 0 4px}.fusion .fs{font:12px var(--mono);color:var(--y);letter-spacing:.08em}
|
|
114
|
+
.fusion ul{list-style:none;padding:0;margin:14px 0 0}.fusion li{font-size:14.5px;line-height:1.55;padding:8px 0;border-top:1px solid #151d20;color:var(--soft)}
|
|
115
|
+
.fusion li b{font:12px var(--mono);color:var(--y);margin-right:8px}
|
|
112
116
|
.mc{border:1px solid #1f2a2d;background:rgba(4,8,9,.85);padding:16px 16px 14px;position:relative;overflow:hidden;transition:border-color .3s,transform .35s;animation:mcin .5s cubic-bezier(.2,.8,.2,1) both}
|
|
113
117
|
@keyframes mcin{from{opacity:0;transform:translateY(12px)}}
|
|
114
118
|
.mc:hover{border-color:rgba(0,240,255,.5);transform:translateY(-2px)}
|
|
@@ -151,6 +155,12 @@ aside.left a.on{text-shadow:0 0 18px rgba(0,240,255,.6)}
|
|
|
151
155
|
<div class="dsec"><h2 id="module-finder">Module finder</h2><p class="sub">Every module from the table in <a href="#what-it-does">What it does</a>. Type to filter by name, command or source.</p>
|
|
152
156
|
<label class="msearch"><span>⌕</span><input id="mq" placeholder="cve, ships, satellite, sanctions…" autocomplete="off" spellcheck="false"><span id="mn"></span></label>
|
|
153
157
|
<div class="mods" id="mods"></div></div>
|
|
158
|
+
<div class="dsec"><h2 id="fusion-live">Cross-source fusion, live</h2><p class="sub">The strongest signal on this install right now that more than one independent source agrees on, read from <a href="/api/signals?limit=200">/api/signals</a>. Every line links to the original record.</p>
|
|
159
|
+
<div id="fusion" class="fusion"><p class="skeleton">Loading…</p></div></div>
|
|
160
|
+
<div class="dsec"><h2 id="verify-a-forecast">Verify a forecast yourself</h2><p class="sub">Forecast proofs do not depend on this server. For any forecast id: <code>/api/proof?id=<id></code> gives the forecast, its canonical JSON, hash and Merkle path, and <code>/proof/<id>.ots</code> is a standard OpenTimestamps file.</p>
|
|
161
|
+
<pre><code>sha256(canonicalJson) == leaf # the forecast was not edited
|
|
162
|
+
leaf + merklePath -> root # it is in the stamped batch
|
|
163
|
+
ots verify -d <root> <id>.ots # the root is committed in a Bitcoin block</code></pre></div>
|
|
154
164
|
</section>
|
|
155
165
|
<div id="doc" class="skeleton">Loading…</div>
|
|
156
166
|
<section id="help"><h2 id="cli-reference">CLI reference</h2><p>The full command list, printed by <code>oculon help</code> on this install.</p><div id="help-out" class="skeleton">Loading…</div></section>
|
|
@@ -217,6 +227,14 @@ fetch('/api/readme').then((r) => r.json()).then((j) => {
|
|
|
217
227
|
}
|
|
218
228
|
}).catch((e) => { $('doc').textContent = `Could not load the README: ${e.message}`; });
|
|
219
229
|
fetch('/api/meta').then((r) => r.json()).then((m) => { $('ver').textContent = `v${m.version}`; }).catch(() => {});
|
|
230
|
+
// Live fusion example: the top-scored signal whose evidence comes from two or more different sources.
|
|
231
|
+
fetch('/api/signals?limit=200').then((r) => r.json()).then((list) => {
|
|
232
|
+
const multi = (Array.isArray(list) ? list : []).map((s) => ({ s, n: new Set((s.evidence || []).map((e) => e.source)).size })).filter((x) => x.n > 1).sort((a, b) => b.s.score - a.s.score)[0];
|
|
233
|
+
if (!multi) { $('fusion').innerHTML = '<p class="skeleton">No multi-source signal right now. Signals agree across sources a few times a day; check back later.</p>'; return; }
|
|
234
|
+
const s = multi.s;
|
|
235
|
+
const items = (s.evidence || []).slice(0, 8).map((e) => `<li><b>${esc(e.source)}</b>${e.url ? `<a href="${esc(e.url)}" target="_blank" rel="noopener">${esc(String(e.text).slice(0, 180))}</a>` : esc(String(e.text).slice(0, 180))}</li>`).join('');
|
|
236
|
+
$('fusion').innerHTML = `<div class="fs">SCORE ${esc(s.score)} · ${multi.n} SOURCES · ${esc(s.module)} · ${esc(String(s.createdAt).slice(0, 16).replace('T', ' '))} UTC</div><div class="ft">${esc(s.title)}</div><ul>${items}</ul>`;
|
|
237
|
+
}).catch(() => { $('fusion').innerHTML = '<p class="skeleton">Could not load signals right now.</p>'; });
|
|
220
238
|
fetch('/api/console?cmd=help').then((r) => r.json()).then((r) => {
|
|
221
239
|
const o = $('help-out'); o.className = '';
|
|
222
240
|
o.innerHTML = `<pre><code>${esc(r.output).split('\n').map((l) => /^\S/.test(l) ? `<span style="color:#fff;font-weight:700">${l}</span>` : l.replace(/^(\s+)(oculon)\b/, '$1<span class="k">$2</span>')).join('\n')}</code></pre>`;
|
package/dist/web/landing.html
CHANGED
|
@@ -1114,7 +1114,8 @@ api('/api/forecasts').then(async (r) => {
|
|
|
1114
1114
|
const p = v.result;
|
|
1115
1115
|
$('fc-proof').innerHTML = `<div class="lbl">Proof · Tortoise</div><div class="steps">${(p.steps || []).map((s) => `<div class="step"><div class="ck">✓</div><p>${esc(s)}</p></div>`).join('')}</div>
|
|
1116
1116
|
<div class="verified">● ${esc(p.status)}${p.bitcoin?.height ? ` · BITCOIN BLOCK ${esc(p.bitcoin.height)}` : ''}</div>
|
|
1117
|
-
<div class="hash">leaf ${esc(p.leaf)}${p.bitcoin?.blockHash ? `<br>block ${esc(p.bitcoin.blockHash)}` : ''}</div
|
|
1117
|
+
<div class="hash">leaf ${esc(p.leaf)}${p.bitcoin?.blockHash ? `<br>block ${esc(p.bitcoin.blockHash)}` : ''}</div>
|
|
1118
|
+
<div class="src" style="margin-top:14px;line-height:1.8">Check it without Oculon: <a href="/proof/${encodeURIComponent(f.id)}.ots" download>OpenTimestamps proof (.ots)</a> · <a href="/api/proof?id=${encodeURIComponent(f.id)}" target="_blank" rel="noopener">forecast, hash and Merkle path</a>${p.bitcoin?.blockHash ? ` · <a href="https://blockstream.info/block/${encodeURIComponent(p.bitcoin.blockHash)}" target="_blank" rel="noopener">block on Blockstream</a>` : ''}<br><code>ots verify -d ${esc(p.root || '')} ${esc(f.id)}.ots</code></div>`;
|
|
1118
1119
|
const steps = [...document.querySelectorAll('#fc-proof .step')];
|
|
1119
1120
|
new IntersectionObserver((es, o) => { if (es.some((e) => e.isIntersecting)) { steps.forEach((s, i) => setTimeout(() => s.classList.add('in'), 300 + i * 450)); o.disconnect(); } }, { threshold: .3 }).observe($('fc-proof'));
|
|
1120
1121
|
} catch { $('fc-proof').innerHTML = '<div class="lbl">Proof · Tortoise</div><p class="mut" style="margin-top:14px">Verification unavailable right now. Run oculon proof verify to check it locally.</p>'; }
|
package/dist/web/public.js
CHANGED
package/dist/web/server.js
CHANGED
|
@@ -244,6 +244,7 @@ export const ROUTES = {
|
|
|
244
244
|
'/api/quota': (_q, o) => o.quota(),
|
|
245
245
|
'/api/forecasts': (_q, o) => ({ scoreboard: o.scoreboard(), forecasts: o.forecasts('all', 200) }),
|
|
246
246
|
'/api/verify': async (q, o) => slim(await o.verifyProof(need(q, 'id', 64))),
|
|
247
|
+
'/api/proof': (q, o) => o.proofBundle(need(q, 'id', 64)),
|
|
247
248
|
'/api/entity': (q, o) => o.entity(need(q, 'id', 300)),
|
|
248
249
|
'/api/exposure': async (q, o) => slim(await o.exposure(need(q, 'domain', 120))),
|
|
249
250
|
'/api/podcast': async (q, o) => slim(await o.podcast(need(q, 'q', 120))),
|
|
@@ -652,6 +653,19 @@ export function createWebServer(opts = {}) {
|
|
|
652
653
|
res.setHeader('access-control-allow-origin', '*');
|
|
653
654
|
return send(res, 200, JSON.stringify(openApiSpec(siteDomain ? `https://app.${siteDomain}` : `http://${req.headers.host ?? '127.0.0.1'}`), null, 2), 'application/json; charset=utf-8', 'public, max-age=3600');
|
|
654
655
|
}
|
|
656
|
+
// A forecast's OpenTimestamps proof as a standard .ots file, for checking with any OpenTimestamps tool.
|
|
657
|
+
const otsId = /^\/proof\/([A-Za-z0-9_-]{1,64})\.ots$/.exec(url.pathname)?.[1];
|
|
658
|
+
if (otsId) {
|
|
659
|
+
let file = null;
|
|
660
|
+
try {
|
|
661
|
+
file = oculon.proofOts(otsId);
|
|
662
|
+
}
|
|
663
|
+
catch { }
|
|
664
|
+
if (!file)
|
|
665
|
+
return send(res, 404, '{"error":"no stamped proof for this forecast yet"}', 'application/json');
|
|
666
|
+
res.writeHead(200, { 'content-type': 'application/vnd.opentimestamps.v1', 'content-disposition': `attachment; filename="${otsId}.ots"`, 'cache-control': 'public, max-age=3600', 'access-control-allow-origin': '*' });
|
|
667
|
+
return void res.end(file);
|
|
668
|
+
}
|
|
655
669
|
// Shared results: /r/<id> is a public snapshot page with link-preview tags.
|
|
656
670
|
const shareId = /^\/r\/([A-Za-z0-9_-]{6,16})\/?$/.exec(url.pathname)?.[1];
|
|
657
671
|
if (shareId) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oculon",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
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
5
|
"keywords": [
|
|
6
6
|
"osint",
|