oculon 0.1.6 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/README.md +93 -17
  2. package/dist/cli/main.js +397 -0
  3. package/dist/core/calls.d.ts +63 -0
  4. package/dist/core/calls.js +120 -0
  5. package/dist/core/der.d.ts +2 -0
  6. package/dist/core/der.js +17 -0
  7. package/dist/core/http.d.ts +30 -1
  8. package/dist/core/http.js +133 -29
  9. package/dist/core/pdf.d.ts +51 -0
  10. package/dist/core/pdf.js +211 -0
  11. package/dist/core/qr.d.ts +23 -0
  12. package/dist/core/qr.js +577 -0
  13. package/dist/core/quota.js +5 -0
  14. package/dist/core/raster.d.ts +6 -0
  15. package/dist/core/raster.js +298 -0
  16. package/dist/core/safeurl.d.ts +5 -0
  17. package/dist/core/safeurl.js +26 -0
  18. package/dist/core/verdict.d.ts +30 -0
  19. package/dist/core/verdict.js +164 -0
  20. package/dist/core/zip.d.ts +9 -0
  21. package/dist/core/zip.js +46 -0
  22. package/dist/index.d.ts +83 -0
  23. package/dist/index.js +128 -0
  24. package/dist/mcp.d.ts +1 -0
  25. package/dist/mcp.js +256 -6
  26. package/dist/modules/address.d.ts +6 -2
  27. package/dist/modules/address.js +32 -5
  28. package/dist/modules/apk.d.ts +37 -0
  29. package/dist/modules/apk.js +191 -0
  30. package/dist/modules/approvals.d.ts +40 -0
  31. package/dist/modules/approvals.js +155 -0
  32. package/dist/modules/archive.d.ts +21 -0
  33. package/dist/modules/archive.js +94 -0
  34. package/dist/modules/checks.d.ts +59 -0
  35. package/dist/modules/checks.js +167 -0
  36. package/dist/modules/contract.d.ts +56 -0
  37. package/dist/modules/contract.js +167 -0
  38. package/dist/modules/deployer.d.ts +42 -0
  39. package/dist/modules/deployer.js +90 -0
  40. package/dist/modules/doc.d.ts +83 -0
  41. package/dist/modules/doc.js +841 -0
  42. package/dist/modules/eml.d.ts +46 -0
  43. package/dist/modules/eml.js +175 -0
  44. package/dist/modules/hashcheck.d.ts +19 -3
  45. package/dist/modules/hashcheck.js +28 -4
  46. package/dist/modules/image.d.ts +32 -0
  47. package/dist/modules/image.js +276 -0
  48. package/dist/modules/invite.d.ts +27 -0
  49. package/dist/modules/invite.js +69 -0
  50. package/dist/modules/job.d.ts +33 -0
  51. package/dist/modules/job.js +64 -0
  52. package/dist/modules/meerkat.d.ts +1 -1
  53. package/dist/modules/meerkat.js +35 -2
  54. package/dist/modules/monitor.js +14 -0
  55. package/dist/modules/poisoning.d.ts +43 -0
  56. package/dist/modules/poisoning.js +114 -0
  57. package/dist/modules/qrcheck.d.ts +24 -0
  58. package/dist/modules/qrcheck.js +136 -0
  59. package/dist/modules/repo.d.ts +61 -0
  60. package/dist/modules/repo.js +162 -0
  61. package/dist/modules/report.d.ts +32 -0
  62. package/dist/modules/report.js +108 -0
  63. package/dist/modules/signature.d.ts +35 -0
  64. package/dist/modules/signature.js +283 -0
  65. package/dist/modules/site.d.ts +62 -0
  66. package/dist/modules/site.js +191 -0
  67. package/dist/modules/stocktoken.d.ts +48 -0
  68. package/dist/modules/stocktoken.js +99 -0
  69. package/dist/modules/trace.d.ts +37 -0
  70. package/dist/modules/trace.js +150 -0
  71. package/dist/modules/txexplain.d.ts +40 -0
  72. package/dist/modules/txexplain.js +135 -0
  73. package/dist/modules/urlcheck.js +15 -1
  74. package/dist/modules/utility.d.ts +27 -1
  75. package/dist/modules/utility.js +108 -11
  76. package/dist/modules/where.d.ts +63 -0
  77. package/dist/modules/where.js +165 -0
  78. package/dist/report-pdf.d.ts +7 -0
  79. package/dist/report-pdf.js +84 -0
  80. package/dist/sources/cfurlscan.d.ts +24 -0
  81. package/dist/sources/cfurlscan.js +46 -0
  82. package/dist/sources/chainabuse.d.ts +17 -0
  83. package/dist/sources/chainabuse.js +19 -0
  84. package/dist/sources/evm.d.ts +135 -0
  85. package/dist/sources/evm.js +260 -0
  86. package/dist/sources/phishlists.d.ts +20 -0
  87. package/dist/sources/phishlists.js +90 -0
  88. package/dist/telegram.d.ts +17 -0
  89. package/dist/telegram.js +151 -4
  90. package/dist/web/card.d.ts +28 -0
  91. package/dist/web/card.js +75 -0
  92. package/dist/web/docs.html +1 -1
  93. package/dist/web/index.html +213 -5
  94. package/dist/web/landing.html +1 -1
  95. package/dist/web/legal.html +3 -1
  96. package/dist/web/mcp.html +1 -1
  97. package/dist/web/openapi.js +15 -0
  98. package/dist/web/pages.d.ts +24 -0
  99. package/dist/web/pages.js +139 -0
  100. package/dist/web/public.js +16 -1
  101. package/dist/web/server.d.ts +13 -0
  102. package/dist/web/server.js +152 -13
  103. package/dist/web/token.html +25 -4
  104. package/dist/web/token.json +12 -1
  105. package/dist/web/utility.html +40 -14
  106. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -256,6 +256,28 @@ export declare class Oculon {
256
256
  }): Promise<ModuleResult<import("./modules/iban.js").IbanCheck>>;
257
257
  /** Raw email headers: SPF, DKIM and DMARC results, the delivery path, the origin IP and spoofing signs. */
258
258
  headerCheck(rawHeaders: string): Promise<ModuleResult<import("./modules/headers.js").HeaderReport>>;
259
+ /** Was this invoice, bank statement or screenshot edited? PDF, JPEG or PNG bytes; IBANs in the text are checked. */
260
+ docCheck(file: Buffer, name?: string): Promise<ModuleResult<import("./modules/doc.js").DocResult>>;
261
+ /** Run a check and keep it: returns the value plus a check id, a replay link and what changed since the last check of the same target. */
262
+ recordCheck<T>(kind: string, target: string, run: () => Promise<T>, opts?: {
263
+ label?: string;
264
+ }): Promise<{
265
+ value: T;
266
+ check: import("./modules/checks.js").CheckMeta;
267
+ }>;
268
+ /** A stored check: verdict, every source call it made (the replay log) and the full result. */
269
+ check(id: string): import("./modules/checks.js").CheckRecord | null;
270
+ /** Earlier checks of the same target as check `id`, newest first. */
271
+ checkHistory(id: string, limit?: number): {
272
+ id: string;
273
+ at: string;
274
+ verdict: string | null;
275
+ risk: number | null;
276
+ }[];
277
+ /** One stored check as a PDF report. */
278
+ checkPdf(id: string, baseUrl?: string): Buffer<ArrayBufferLike> | null;
279
+ /** Which sources are up, slow or down: live calls of the last `hours`. */
280
+ sourceStatus(hours?: number): import("./core/calls.js").SourceStatus[];
259
281
  /** Lookalike domains of a brand that exist in DNS, and new certificates naming the brand (crt.sh). */
260
282
  lookalikes(domain: string): Promise<ModuleResult<import("./modules/lookalike.js").LookalikeReport>>;
261
283
  /** Can this token be sold? Buy and sell simulation with taxes (honeypot.is): Ethereum, BNB Chain, Base. */
@@ -266,6 +288,67 @@ export declare class Oculon {
266
288
  addressCheck(address: string, opts?: {
267
289
  network?: string;
268
290
  }): Promise<ModuleResult<import("./modules/address.js").AddressReport>>;
291
+ /** Token and NFT approvals still active on a wallet, with risky spenders flagged (Ethereum, Arbitrum, Polygon). */
292
+ approvalsCheck(address: string, opts?: {
293
+ chain?: string;
294
+ }): Promise<ModuleResult<import("./modules/approvals.js").ApprovalsReport>>;
295
+ /** What the owner of a token contract can still do: mint, blacklist, taxes, upgrades, plus holders and liquidity. */
296
+ contractRisk(address: string, opts?: {
297
+ chain?: string;
298
+ }): Promise<ModuleResult<import("./modules/contract.js").ContractReport>>;
299
+ /** What a wallet signature request really allows: permits, Permit2, Seaport orders, approvals, calldata. */
300
+ signatureCheck(request: string, opts?: {
301
+ chain?: string;
302
+ to?: string;
303
+ }): Promise<ModuleResult<import("./modules/signature.js").SignatureReport>>;
304
+ /** Lookalike addresses, zero-value transfers and fake tokens planted in a wallet's history. */
305
+ poisoningCheck(address: string, opts?: {
306
+ chain?: string;
307
+ }): Promise<ModuleResult<import("./modules/poisoning.js").PoisoningReport>>;
308
+ /** Follow funds out of an address for a few hops, until exchanges, mixers, bridges or sanctioned addresses. */
309
+ traceFunds(address: string, opts?: {
310
+ chain?: string;
311
+ hops?: number;
312
+ width?: number;
313
+ }): Promise<ModuleResult<import("./modules/trace.js").TraceReport>>;
314
+ /** Was this image made by AI, edited, or taken with a camera? C2PA credentials, IPTC, generator settings, EXIF. */
315
+ imageCheck(file: Buffer, name?: string): Promise<ModuleResult<import("./modules/image.js").ImageReport>>;
316
+ /** Read the QR code in an image and check where it leads: link, crypto or bank payment, Wi-Fi. */
317
+ qrCheck(file: Buffer, name?: string): Promise<ModuleResult<import("./modules/qrcheck.js").QrReport>>;
318
+ /** Is this GitHub repo safe to run? Install hooks, remote code, wallet and browser theft, obfuscation, fake stars. */
319
+ repoCheck(repo: string): Promise<ModuleResult<import("./modules/repo.js").RepoReport>>;
320
+ /** One report for a domain: link check, email protection, exposure, lookalikes and the company. */
321
+ domainReport(domain: string): Promise<ModuleResult<import("./modules/report.js").FullReport>>;
322
+ /** One report for a wallet or token: address, approvals, poisoning, fund trace, or contract risk and sell test. */
323
+ walletReport(address: string, opts?: {
324
+ chain?: string;
325
+ }): Promise<ModuleResult<import("./modules/report.js").FullReport>>;
326
+ /** Open a page and look for wallet drainer code and phishing (forms, brand copies, Telegram exfiltration). */
327
+ siteCheck(url: string, opts?: {
328
+ browser?: boolean;
329
+ }): Promise<ModuleResult<import("./modules/site.js").SiteReport>>;
330
+ /** What happened in a transaction: function, token transfers, approvals, tokens taken with an earlier approval. */
331
+ explainTx(hash: string, opts?: {
332
+ chain?: string;
333
+ }): Promise<ModuleResult<import("./modules/txexplain.js").TxReport>>;
334
+ /** Who created a token and how many of their other tokens are dead (Ethereum, Arbitrum, Polygon). */
335
+ creatorCheck(token: string, opts?: {
336
+ chain?: string;
337
+ }): Promise<ModuleResult<import("./modules/deployer.js").DeployerReport>>;
338
+ /** A whole .eml email: headers, message and links, and every attachment through the matching check. */
339
+ emlCheck(file: Buffer, name?: string): Promise<ModuleResult<import("./modules/eml.js").EmlReport>>;
340
+ /** Is this Android app safe to install? Permissions, accessibility and SMS abuse, signer, known malware. */
341
+ apkCheck(file: Buffer, name?: string): Promise<ModuleResult<import("./modules/apk.js").ApkReport>>;
342
+ /** Is this job offer a scam? Fees, paid tasks, crypto pay, chat-only contact, test-task repos. */
343
+ jobCheck(message: string): Promise<ModuleResult<import("./modules/job.js").JobReport>>;
344
+ /** Where and when a photo was taken (EXIF GPS and time), the place, and the weather and daylight at that hour. */
345
+ whereCheck(file: Buffer, name?: string): Promise<ModuleResult<import("./modules/where.js").WhereReport>>;
346
+ /** Save a page as evidence in the Wayback Machine and record its hash, status and final address. */
347
+ archivePage(url: string): Promise<ModuleResult<import("./modules/archive.js").ArchiveReport>>;
348
+ /** What is behind a Telegram or Discord invite: members, age, verified badge, scam labels, impersonation. */
349
+ inviteCheck(link: string): Promise<ModuleResult<import("./modules/invite.js").InviteReport>>;
350
+ /** Robinhood Stock Tokens: official contract, live price, corporate actions; or whether an address is a fake one. */
351
+ stockToken(query?: string): Promise<ModuleResult<import("./modules/stocktoken.js").StockTokenReport>>;
269
352
  /** Satellites: launches of the last 30 days, or one object's orbit, owner and status (CelesTrak). */
270
353
  satellites(query?: string): Promise<ModuleResult<import("./modules/satellites.js").SatResult>>;
271
354
  /** Airport status: METAR and TAF, FAA delays and ground stops (US), emergency squawks nearby. */
package/dist/index.js CHANGED
@@ -71,10 +71,33 @@ import { breaches, passwordCheck, pwnedRange } from './modules/breach.js';
71
71
  import { phoneCheck } from './modules/phone.js';
72
72
  import { ibanCheck } from './modules/iban.js';
73
73
  import { headerCheck } from './modules/headers.js';
74
+ import { docCheck } from './modules/doc.js';
75
+ import { checkHistory, getCheck, recordCheck } from './modules/checks.js';
76
+ import { sourceStatus } from './core/calls.js';
77
+ import { reportPdf } from './report-pdf.js';
74
78
  import { lookalikes } from './modules/lookalike.js';
75
79
  import { honeypotCheck } from './modules/honeypot.js';
76
80
  import { addressCheck } from './modules/address.js';
77
81
  import { satellites } from './modules/satellites.js';
82
+ import { approvalsCheck } from './modules/approvals.js';
83
+ import { contractRisk } from './modules/contract.js';
84
+ import { signatureCheck } from './modules/signature.js';
85
+ import { poisoningCheck } from './modules/poisoning.js';
86
+ import { traceFunds } from './modules/trace.js';
87
+ import { imageCheck } from './modules/image.js';
88
+ import { qrCheck } from './modules/qrcheck.js';
89
+ import { repoCheck } from './modules/repo.js';
90
+ import { domainReport, walletReport } from './modules/report.js';
91
+ import { siteCheck } from './modules/site.js';
92
+ import { explainTx } from './modules/txexplain.js';
93
+ import { deployerCheck } from './modules/deployer.js';
94
+ import { emlCheck } from './modules/eml.js';
95
+ import { apkCheck } from './modules/apk.js';
96
+ import { jobCheck } from './modules/job.js';
97
+ import { whereCheck } from './modules/where.js';
98
+ import { archivePage } from './modules/archive.js';
99
+ import { inviteCheck } from './modules/invite.js';
100
+ import { stockToken } from './modules/stocktoken.js';
78
101
  export class Oculon {
79
102
  ctx;
80
103
  constructor(opts = {}) {
@@ -404,6 +427,31 @@ export class Oculon {
404
427
  headerCheck(rawHeaders) {
405
428
  return headerCheck(this.ctx, rawHeaders);
406
429
  }
430
+ /** Was this invoice, bank statement or screenshot edited? PDF, JPEG or PNG bytes; IBANs in the text are checked. */
431
+ docCheck(file, name) {
432
+ return docCheck(this.ctx, file, name);
433
+ }
434
+ /** Run a check and keep it: returns the value plus a check id, a replay link and what changed since the last check of the same target. */
435
+ recordCheck(kind, target, run, opts = {}) {
436
+ return recordCheck(this.ctx, kind, target, run, opts);
437
+ }
438
+ /** A stored check: verdict, every source call it made (the replay log) and the full result. */
439
+ check(id) {
440
+ return getCheck(this.ctx, id);
441
+ }
442
+ /** Earlier checks of the same target as check `id`, newest first. */
443
+ checkHistory(id, limit = 10) {
444
+ return checkHistory(this.ctx, id, limit);
445
+ }
446
+ /** One stored check as a PDF report. */
447
+ checkPdf(id, baseUrl) {
448
+ const c = getCheck(this.ctx, id);
449
+ return c ? reportPdf(c, checkHistory(this.ctx, id), baseUrl) : null;
450
+ }
451
+ /** Which sources are up, slow or down: live calls of the last `hours`. */
452
+ sourceStatus(hours = 24) {
453
+ return sourceStatus(this.ctx.store, hours);
454
+ }
407
455
  /** Lookalike domains of a brand that exist in DNS, and new certificates naming the brand (crt.sh). */
408
456
  lookalikes(domain) {
409
457
  return lookalikes(this.ctx, domain);
@@ -416,6 +464,86 @@ export class Oculon {
416
464
  addressCheck(address, opts = {}) {
417
465
  return addressCheck(this.ctx, address, opts);
418
466
  }
467
+ /** Token and NFT approvals still active on a wallet, with risky spenders flagged (Ethereum, Arbitrum, Polygon). */
468
+ approvalsCheck(address, opts = {}) {
469
+ return approvalsCheck(this.ctx, address, opts);
470
+ }
471
+ /** What the owner of a token contract can still do: mint, blacklist, taxes, upgrades, plus holders and liquidity. */
472
+ contractRisk(address, opts = {}) {
473
+ return contractRisk(this.ctx, address, opts);
474
+ }
475
+ /** What a wallet signature request really allows: permits, Permit2, Seaport orders, approvals, calldata. */
476
+ signatureCheck(request, opts = {}) {
477
+ return signatureCheck(this.ctx, request, opts);
478
+ }
479
+ /** Lookalike addresses, zero-value transfers and fake tokens planted in a wallet's history. */
480
+ poisoningCheck(address, opts = {}) {
481
+ return poisoningCheck(this.ctx, address, opts);
482
+ }
483
+ /** Follow funds out of an address for a few hops, until exchanges, mixers, bridges or sanctioned addresses. */
484
+ traceFunds(address, opts = {}) {
485
+ return traceFunds(this.ctx, address, opts);
486
+ }
487
+ /** Was this image made by AI, edited, or taken with a camera? C2PA credentials, IPTC, generator settings, EXIF. */
488
+ imageCheck(file, name) {
489
+ return imageCheck(this.ctx, file, name);
490
+ }
491
+ /** Read the QR code in an image and check where it leads: link, crypto or bank payment, Wi-Fi. */
492
+ qrCheck(file, name) {
493
+ return qrCheck(this.ctx, file, name);
494
+ }
495
+ /** Is this GitHub repo safe to run? Install hooks, remote code, wallet and browser theft, obfuscation, fake stars. */
496
+ repoCheck(repo) {
497
+ return repoCheck(this.ctx, repo);
498
+ }
499
+ /** One report for a domain: link check, email protection, exposure, lookalikes and the company. */
500
+ domainReport(domain) {
501
+ return domainReport(this.ctx, domain);
502
+ }
503
+ /** One report for a wallet or token: address, approvals, poisoning, fund trace, or contract risk and sell test. */
504
+ walletReport(address, opts = {}) {
505
+ return walletReport(this.ctx, address, opts);
506
+ }
507
+ /** Open a page and look for wallet drainer code and phishing (forms, brand copies, Telegram exfiltration). */
508
+ siteCheck(url, opts = {}) {
509
+ return siteCheck(this.ctx, url, opts);
510
+ }
511
+ /** What happened in a transaction: function, token transfers, approvals, tokens taken with an earlier approval. */
512
+ explainTx(hash, opts = {}) {
513
+ return explainTx(this.ctx, hash, opts);
514
+ }
515
+ /** Who created a token and how many of their other tokens are dead (Ethereum, Arbitrum, Polygon). */
516
+ creatorCheck(token, opts = {}) {
517
+ return deployerCheck(this.ctx, token, opts);
518
+ }
519
+ /** A whole .eml email: headers, message and links, and every attachment through the matching check. */
520
+ emlCheck(file, name) {
521
+ return emlCheck(this.ctx, file, name);
522
+ }
523
+ /** Is this Android app safe to install? Permissions, accessibility and SMS abuse, signer, known malware. */
524
+ apkCheck(file, name) {
525
+ return apkCheck(this.ctx, file, name);
526
+ }
527
+ /** Is this job offer a scam? Fees, paid tasks, crypto pay, chat-only contact, test-task repos. */
528
+ jobCheck(message) {
529
+ return jobCheck(this.ctx, message);
530
+ }
531
+ /** Where and when a photo was taken (EXIF GPS and time), the place, and the weather and daylight at that hour. */
532
+ whereCheck(file, name) {
533
+ return whereCheck(this.ctx, file, name);
534
+ }
535
+ /** Save a page as evidence in the Wayback Machine and record its hash, status and final address. */
536
+ archivePage(url) {
537
+ return archivePage(this.ctx, url);
538
+ }
539
+ /** What is behind a Telegram or Discord invite: members, age, verified badge, scam labels, impersonation. */
540
+ inviteCheck(link) {
541
+ return inviteCheck(this.ctx, link);
542
+ }
543
+ /** Robinhood Stock Tokens: official contract, live price, corporate actions; or whether an address is a fake one. */
544
+ stockToken(query = '') {
545
+ return stockToken(this.ctx, query);
546
+ }
419
547
  /** Satellites: launches of the last 30 days, or one object's orbit, owner and status (CelesTrak). */
420
548
  satellites(query = '') {
421
549
  return satellites(this.ctx, query);
package/dist/mcp.d.ts CHANGED
@@ -36,6 +36,7 @@ export declare class McpServer {
36
36
  */
37
37
  constructor(makeOculon?: () => Oculon, opts?: {
38
38
  remote?: boolean;
39
+ baseUrl?: string;
39
40
  });
40
41
  private get o();
41
42
  private pluginTools;
package/dist/mcp.js CHANGED
@@ -2,12 +2,17 @@
2
2
  * Oculon MCP server over stdio (JSON-RPC 2.0, one message per line). No dependencies.
3
3
  * Lets Claude and other MCP clients call every Oculon module as a tool.
4
4
  */
5
+ import { createHash } from 'node:crypto';
5
6
  import { readFileSync } from 'node:fs';
6
7
  import { createInterface } from 'node:readline';
7
8
  import { Oculon, summarizeProvenance } from './index.js';
8
9
  import { ONCHAIN_TOOLS, onchainEnabled } from './core/features.js';
9
10
  import { availableKinds } from './modules/monitor.js';
10
- export const SERVER_INFO = { name: 'oculon', version: '0.1.6' };
11
+ import { CHECK_TOOLS } from './modules/checks.js';
12
+ import { DOC_MAX_BYTES } from './modules/doc.js';
13
+ import { briefOf, verdictOf } from './core/verdict.js';
14
+ import { CARD_HTML, CARD_URI, CARD_URI_OPENAI, MCP_APP_MIME, SKYBRIDGE_MIME } from './web/card.js';
15
+ export const SERVER_INFO = { name: 'oculon', version: '0.2.0' };
11
16
  const SUPPORTED = ['2025-06-18', '2025-03-26', '2024-11-05'];
12
17
  const str = (d) => ({ type: 'string', description: d });
13
18
  const num = (d) => ({ type: 'number', description: d });
@@ -55,6 +60,51 @@ export function checkArgs(inputSchema, args) {
55
60
  function compact(r) {
56
61
  return { module: r.module, input: r.input, generatedAt: r.generatedAt, result: r.result, signals: r.signals, provenance: summarizeProvenance(r.provenance) };
57
62
  }
63
+ /** File bytes for the document check: base64, or an https URL on a public host. */
64
+ async function docBytes(o, a) {
65
+ if (a.data) {
66
+ const b64 = String(a.data).replace(/^data:[^;]+;base64,/, '').replace(/\s+/g, '');
67
+ if (b64.length > Math.ceil(DOC_MAX_BYTES / 3) * 4 + 4)
68
+ throw new Error('the file is larger than 10 MB');
69
+ return Buffer.from(b64, 'base64');
70
+ }
71
+ if (!a.url)
72
+ throw new Error('give the file as data (base64) or url');
73
+ let u;
74
+ try {
75
+ u = new URL(String(a.url));
76
+ }
77
+ catch {
78
+ throw new Error('not a valid URL');
79
+ }
80
+ // Public https hosts only: no addresses, no internal names.
81
+ if (u.protocol !== 'https:' || /^(\d+\.){3}\d+$|^\[|^localhost$|\.(local|internal|localhost|lan|home|corp)$/i.test(u.hostname) || !u.hostname.includes('.'))
82
+ throw new Error('only https links to public hosts are fetched');
83
+ const r = await o.ctx.http.getBytes(u.href, { source: 'doc-download', timeoutMs: 30_000, retries: 0 });
84
+ if (!r.data)
85
+ throw new Error(`could not download the file (${r.prov.note ?? r.prov.status})`);
86
+ if (r.data.length > DOC_MAX_BYTES)
87
+ throw new Error('the file is larger than 10 MB');
88
+ return r.data;
89
+ }
90
+ /** The verdict card data a chat app renders next to a check result. */
91
+ function cardOf(kind, out, check, baseUrl) {
92
+ const v = verdictOf(out);
93
+ return {
94
+ kind,
95
+ title: v.title,
96
+ verdict: v.verdict,
97
+ tone: v.tone,
98
+ risk: v.risk,
99
+ points: v.points.slice(0, 6),
100
+ sources: `${v.sources.live} live, ${v.sources.cached} cached, ${v.sources.failed} failed`,
101
+ seenBefore: check.seenBefore ? { at: check.seenBefore.at, changes: check.seenBefore.changes } : null,
102
+ links: { replay: baseUrl ? baseUrl + check.replay : null, report: baseUrl ? baseUrl + check.report : null },
103
+ checkId: check.id,
104
+ };
105
+ }
106
+ /** Tool definitions with UI templates for the chat apps that render them (MCP Apps, ChatGPT apps). */
107
+ const UI_META = { ui: { resourceUri: CARD_URI }, 'ui/resourceUri': CARD_URI, 'openai/outputTemplate': CARD_URI_OPENAI, 'openai/toolInvocation/invoking': 'Checking sources', 'openai/toolInvocation/invoked': 'Checked', 'openai/widgetAccessible': false };
58
108
  export const TOOLS = [
59
109
  {
60
110
  name: 'oculon_radar',
@@ -327,6 +377,158 @@ export const TOOLS = [
327
377
  inputSchema: schema({ address: str('Crypto address'), network: str('Optional for 0x addresses: "robinhood" for Robinhood Chain, default Ethereum') }, ['address']),
328
378
  run: async (o, a) => compact(await o.addressCheck(String(a.address), a.network ? { network: String(a.network) } : {})),
329
379
  },
380
+ {
381
+ name: 'oculon_doc_check',
382
+ description: 'Was this invoice, bank statement or payment screenshot edited? Reads a PDF, Word, Excel, PowerPoint, JPEG or PNG: macros, remote templates, DDE fields, embedded objects and hidden sheets in Office files, the programs that made and saved it (online PDF editors, image editors), creation vs modification date, how many times it was saved, fonts embedded twice, white boxes over text, annotations, dangerous parts (JavaScript, launch actions), and checks every IBAN in its text. Screenshots are read with a free AI vision model when a key is set. A clean result is not proof the document is genuine.',
383
+ inputSchema: schema({ data: str('The file as base64 (max 10 MB)'), url: str('Or an https URL of the file'), name: str('File name, for display') }),
384
+ run: async (o, a) => {
385
+ const file = await docBytes(o, a);
386
+ return compact(await o.docCheck(file, a.name ? String(a.name) : a.url ? String(a.url).split('/').pop().split('?')[0] : 'document'));
387
+ },
388
+ },
389
+ {
390
+ name: 'oculon_approvals',
391
+ description: 'Who can take tokens out of this wallet right now: every ERC-20 and NFT approval the wallet signed (Etherscan logs), re-read on chain so revoked ones drop out. Spenders are named (Uniswap, 1inch, OpenSea...) or flagged: plain wallets, unverified contracts and unknown contracts with unlimited access. Spam approval events from fake tokens are filtered. Gives a revoke.cash link. Chains: eth, arbitrum, polygon.',
392
+ inputSchema: schema({ address: str('Wallet address (0x...)'), chain: str('eth, arbitrum or polygon (default eth)') }, ['address']),
393
+ run: async (o, a) => compact(await o.approvalsCheck(String(a.address), a.chain ? { chain: String(a.chain) } : {})),
394
+ },
395
+ {
396
+ name: 'oculon_contract_risk',
397
+ description: 'What the owner of a token contract can still do to holders: mint, blacklist, pause trading, change taxes, limit wallets, change balances, upgrade the code (proxy), self-destruct. Read from verified source (Sourcify, Etherscan) or, for unverified contracts, from selectors in the bytecode. Plus current owner (renounced or not), proxy admin and implementation, holder concentration and locked liquidity (GoPlus), main pool and age (DexScreener). Chains: eth, base, bsc, arbitrum, polygon.',
398
+ inputSchema: schema({ address: str('Token contract address (0x...)'), chain: str('eth, base, bsc, arbitrum or polygon (default eth)') }, ['address']),
399
+ run: async (o, a) => compact(await o.contractRisk(String(a.address), a.chain ? { chain: String(a.chain) } : {})),
400
+ },
401
+ {
402
+ name: 'oculon_signature_check',
403
+ description: 'Decode what a wallet signature request really allows before signing: EIP-712 typed data (ERC-2612 and DAI permits, Uniswap Permit2 allowances and transfers, Seaport orders that give NFTs away for nothing), transaction calldata or a {to, data, value} object (approve, setApprovalForAll, transfers, Permit2 approve, multicall bundles, unknown functions named via signature databases), and raw eth_sign hashes. Spenders are looked up on chain (wallet or contract, verified or not).',
404
+ inputSchema: schema({ request: str('The request: typed data JSON, 0x calldata, a {to,data,value} JSON, or the message text'), chain: str('Optional chain: eth, base, bsc, arbitrum, polygon'), to: str('Optional: the contract the calldata is sent to (token address for approve)') }, ['request']),
405
+ run: async (o, a) => compact(await o.signatureCheck(String(a.request), { ...(a.chain ? { chain: String(a.chain) } : {}), ...(a.to ? { to: String(a.to) } : {}) })),
406
+ },
407
+ {
408
+ name: 'oculon_address_poisoning',
409
+ description: 'Has someone planted lookalike addresses in this wallet\'s history? Finds addresses that share the first and last characters with ones the wallet really paid, zero-value transfers it never signed, and fake USDT/USDC tokens, and says whether funds were already sent to a lookalike. Chains: eth, arbitrum, polygon.',
410
+ inputSchema: schema({ address: str('Wallet address (0x...)'), chain: str('eth, arbitrum or polygon (default eth)') }, ['address']),
411
+ run: async (o, a) => compact(await o.poisoningCheck(String(a.address), a.chain ? { chain: String(a.chain) } : {})),
412
+ },
413
+ {
414
+ name: 'oculon_trace_funds',
415
+ description: 'Follow where money went from an address (for example a scammer or a drained wallet): the largest outgoing flows priced in USD, hop by hop, until an exchange (where funds can be frozen), a mixer, a bridge, a contract or a sanctioned address. Labels from the open eth-labels dataset, transaction hashes for a report. Chains: eth, arbitrum, polygon.',
416
+ inputSchema: schema({ address: str('Start address (0x...)'), chain: str('eth, arbitrum or polygon (default eth)'), hops: num('Hops to follow, 1-4 (default 3)') }, ['address']),
417
+ run: async (o, a) => compact(await o.traceFunds(String(a.address), { ...(a.chain ? { chain: String(a.chain) } : {}), ...(a.hops ? { hops: Number(a.hops) } : {}) })),
418
+ },
419
+ {
420
+ name: 'oculon_image_check',
421
+ description: 'Was this image made by AI, edited, or taken with a camera? Reads C2PA Content Credentials (generator app, actions, AI source type, organizations in the signing certificates), IPTC digital source type, generator settings and prompts left by Stable Diffusion, ComfyUI, NovelAI, InvokeAI and Midjourney, EXIF camera data and editing software. Read locally. Missing metadata proves nothing.',
422
+ inputSchema: schema({ data: str('The image as base64 (JPEG, PNG or WebP, max 10 MB)'), url: str('Or an https URL of the image'), name: str('File name, for display') }),
423
+ run: async (o, a) => {
424
+ const file = await docBytes(o, a);
425
+ return compact(await o.imageCheck(file, a.name ? String(a.name) : a.url ? String(a.url).split('/').pop().split('?')[0] : 'image'));
426
+ },
427
+ },
428
+ {
429
+ name: 'oculon_qr_check',
430
+ description: 'Read the QR code in a photo or screenshot (PNG or baseline JPEG, versions 1-15) and check where it leads: links go through the URL check (Safe Browsing, URLhaus, domain age, lookalikes, shorteners), crypto payment codes and addresses through the address check, SEPA payment codes get their IBAN checked, Wi-Fi, SMS and phone codes are explained. Catches fake parking, parcel and login QR codes (quishing).',
431
+ inputSchema: schema({ data: str('The image as base64 (max 10 MB)'), url: str('Or an https URL of the image'), name: str('File name, for display') }),
432
+ run: async (o, a) => {
433
+ const file = await docBytes(o, a);
434
+ return compact(await o.qrCheck(file, a.name ? String(a.name) : 'qr image'));
435
+ },
436
+ },
437
+ {
438
+ name: 'oculon_repo_check',
439
+ description: 'Is this GitHub repository safe to clone and run? Built for fake job tests and "run our bot" scams: install hooks (npm preinstall/postinstall, setup.py, VS Code tasks that run on folder open), code that downloads and runs code, wallet extension and browser password theft, Discord/Telegram webhooks, obfuscation and code hidden past the edge of the screen, committed program files, owner account age and bought stars. Reads files through the GitHub API; nothing is run.',
440
+ inputSchema: schema({ repo: str('owner/name or a github.com link') }, ['repo']),
441
+ run: async (o, a) => compact(await o.repoCheck(String(a.repo))),
442
+ },
443
+ {
444
+ name: 'oculon_domain_report',
445
+ description: 'One report for a domain, all parts run together: link check of the site, email protection (SPF, DKIM, DMARC), what it exposes to the internet (open ports, CVEs), lookalike domains, and the company behind the name. Each part keeps its verdict and sources; PDF report available through the check id.',
446
+ inputSchema: schema({ domain: str('The domain, e.g. "example.com"') }, ['domain']),
447
+ run: async (o, a) => compact(await o.domainReport(String(a.domain))),
448
+ },
449
+ {
450
+ name: 'oculon_wallet_report',
451
+ description: 'One report for a wallet or token address. Wallet: address check (sanctions, activity), active approvals, address poisoning and where funds went. Token contract: contract risk, sell simulation and address check. PDF report available through the check id.',
452
+ inputSchema: schema({ address: str('Wallet or token address (0x...)'), chain: str('eth, arbitrum, polygon, base or bsc (default eth)') }, ['address']),
453
+ run: async (o, a) => compact(await o.walletReport(String(a.address), a.chain ? { chain: String(a.chain) } : {})),
454
+ },
455
+ {
456
+ name: 'oculon_site_check',
457
+ description: 'Open a web page and look for wallet drainers and phishing: wallet connection code next to permit, Permit2, setApprovalForAll or unlimited approve requests, a receiver address written into the script, token-balance APIs used to rank what to take, known drainer kits, seed phrase and login forms on the wrong domain, forms posting elsewhere, Telegram bot tokens and Discord webhooks in the code, lookalikes of known apps, plus the link check of the final address. Scripts are read, never run.',
458
+ inputSchema: schema({ url: str('The page link') }, ['url']),
459
+ run: async (o, a) => compact(await o.siteCheck(String(a.url))),
460
+ },
461
+ {
462
+ name: 'oculon_tx_explain',
463
+ description: 'Explain a transaction in plain words: who called what, every token and NFT transfer, approvals given or removed, and the fee. Flags tokens taken from a wallet in a transaction it did not send (an earlier approval or permit being used), approvals to plain wallets or unverified contracts, and NFT collections handed over. Spam tokens faking transfers are recognized. Chains: eth, base, arbitrum, bsc, polygon (found automatically).',
464
+ inputSchema: schema({ hash: str('Transaction hash or explorer link'), chain: str('Optional: eth, base, arbitrum, bsc, polygon') }, ['hash']),
465
+ run: async (o, a) => compact(await o.explainTx(String(a.hash), a.chain ? { chain: String(a.chain) } : {})),
466
+ },
467
+ {
468
+ name: 'oculon_token_creator',
469
+ description: 'Who created this token and what is their record: the creator wallet and date, the other contracts it deployed, which of those tokens are dead today (no pool or under $1,000 of liquidity), its wallet age, and who first funded it (exchange or mixer, from eth-labels). Chains: eth, arbitrum, polygon.',
470
+ inputSchema: schema({ address: str('Token contract address (0x...)'), chain: str('eth, arbitrum or polygon (default eth)') }, ['address']),
471
+ run: async (o, a) => compact(await o.creatorCheck(String(a.address), a.chain ? { chain: String(a.chain) } : {})),
472
+ },
473
+ {
474
+ name: 'oculon_email_file',
475
+ description: 'Check a whole email file (.eml): SPF, DKIM, DMARC and spoofing in the headers, the message and every link through the scam check, and each attachment through the document check (PDF, Office), the QR reader and image check (images), or the malware hash lookup. Flags risky attachment types (programs, scripts, HTML, disk images).',
476
+ inputSchema: schema({ data: str('The file as base64 (max 10 MB)'), url: str('Or an https URL of the file'), name: str('File name, for display') }, []),
477
+ run: async (o, a) => compact(await o.emlCheck(await docBytes(o, a), a.name ? String(a.name) : 'email.eml')),
478
+ },
479
+ {
480
+ name: 'oculon_apk_check',
481
+ description: 'Is this Android app (APK) safe to install? Reads its manifest: package, version, every permission, and the ones banking trojans use (reading SMS codes, accessibility services, drawing over other apps, notification access, device admin, installing other apps); the signing certificate (debug keys flagged); and the SHA-256 in malware databases. Nothing is installed or run.',
482
+ inputSchema: schema({ data: str('The APK as base64 (max 10 MB here; the CLI takes up to 40 MB)'), url: str('Or an https URL of the APK'), name: str('File name') }, []),
483
+ run: async (o, a) => compact(await o.apkCheck(await docBytes(o, a), a.name ? String(a.name) : 'app.apk')),
484
+ },
485
+ {
486
+ name: 'oculon_job_check',
487
+ description: 'Is this job offer a scam? Matches the patterns of job scams in the message (fees before you start, paid tasks you top up, crypto pay, pay that does not fit the work, contact only through WhatsApp or Telegram, no interview, early requests for ID or bank details, check-cashing, coding test tasks that ask you to run a repo), checks every link and the sender, and runs the repo check on any GitHub link.',
488
+ inputSchema: schema({ message: str('The job message or email text') }, ['message']),
489
+ run: async (o, a) => compact(await o.jobCheck(String(a.message))),
490
+ },
491
+ {
492
+ name: 'oculon_photo_location',
493
+ description: 'Where and when was this photo taken? GPS position and capture time from its EXIF data, the place name (OpenStreetMap), and the weather and daylight at that place and hour (Open-Meteo, sun position), so claims about a photo can be checked. Flags capture and GPS times that disagree. EXIF can be edited.',
494
+ inputSchema: schema({ data: str('The file as base64 (max 10 MB)'), url: str('Or an https URL of the file'), name: str('File name, for display') }, []),
495
+ run: async (o, a) => compact(await o.whereCheck(await docBytes(o, a), a.name ? String(a.name) : 'photo.jpg')),
496
+ },
497
+ {
498
+ name: 'oculon_archive',
499
+ description: 'Save a web page as evidence: asks the Wayback Machine to save it now and records the page status, final address, title and SHA-256 of what was served. Falls back to the newest existing snapshot when saving fails.',
500
+ inputSchema: schema({ url: str('The page link') }, ['url']),
501
+ run: async (o, a) => compact(await o.archivePage(String(a.url))),
502
+ },
503
+ {
504
+ name: 'oculon_invite_check',
505
+ description: 'What is behind a Telegram (t.me) or Discord (discord.gg) invite before joining: name, members and online, verified badge, Telegram scam or fake labels, server creation date, and the fake support or fake project pattern (brand plus "official", "support", "airdrop" without a verified badge).',
506
+ inputSchema: schema({ link: str('The invite link') }, ['link']),
507
+ run: async (o, a) => compact(await o.inviteCheck(String(a.link))),
508
+ },
509
+ {
510
+ name: 'oculon_stock_token',
511
+ description: 'Robinhood Stock Tokens (tokenized shares on Robinhood Chain), from Robinhood\'s official API. A ticker (TSLA) gives the official contract, ISIN, which sessions trade, the live bid and ask per token (adjusted by the corporate-action multiplier), daily range, volume, supply on chain, and upcoming dividends and splits. An address says whether it is an official Stock Token, and flags tokens that copy a ticker or call themselves Robinhood tokens without being on the list. Empty: the list size and upcoming corporate actions.',
512
+ inputSchema: schema({ query: str('A ticker (TSLA), a token address (0x...), or empty for the overview') }),
513
+ run: async (o, a) => compact(await o.stockToken(a.query ? String(a.query) : '')),
514
+ },
515
+ {
516
+ name: 'oculon_replay',
517
+ description: 'Replay log of an earlier check by its check id: the verdict, what changed since the check before it, and every source called in order with status and time.',
518
+ inputSchema: schema({ id: str('Check id, as returned in check.id') }, ['id']),
519
+ run: (o, a) => {
520
+ const c = o.check(String(a.id));
521
+ if (!c)
522
+ throw new Error('no such check (ids are kept for 90 days)');
523
+ return { id: c.id, kind: c.kind, target: c.label, checkedAt: c.createdAt, durationMs: c.durationMs, verdict: c.verdict, seenBefore: c.seenBefore, calls: c.calls, history: o.checkHistory(c.id) };
524
+ },
525
+ },
526
+ {
527
+ name: 'oculon_status',
528
+ description: 'Which Oculon sources are up, slow, degraded or down, from real calls in the last hours: success rate, median time, last error, and sources being skipped (a mirror or cached data answers instead).',
529
+ inputSchema: schema({ hours: num('Window in hours (default 24, max 48)') }),
530
+ run: (o, a) => ({ hours: Math.min(48, Number(a.hours ?? 24) || 24), sources: o.sourceStatus(Math.min(48, Number(a.hours ?? 24) || 24)) }),
531
+ },
330
532
  {
331
533
  name: 'oculon_satellites',
332
534
  description: 'Satellites from CelesTrak. Leave query empty for everything launched in the last 30 days, grouped by launch. Or pass a satellite name ("ISS", "starlink-1007") or NORAD catalog number for its orbit (perigee, apogee, period, inclination, regime), owner, launch date and status.',
@@ -482,7 +684,7 @@ export const TOOLS = [
482
684
  },
483
685
  {
484
686
  name: 'oculon_watch_add',
485
- description: `Add a watchlist target. Kinds: company, domain, plane, topic, lights (place), air (place), port (place, anchored-vessel queue), news (keyword), outage (country), cve (vendor or product), quake ("place|min magnitude"), hazard (country or storm name), url, package ("npm:name" or "pypi:name"), travel (place)${onchainEnabled() ? ', wallet, token (address or address@chain)' : ''}. For plain-language requests use oculon_monitor.`,
687
+ description: `Add a watchlist target. Kinds: company, domain, plane, topic, lights (place), air (place), port (place, anchored-vessel queue), news (keyword), outage (country), cve (vendor or product), quake ("place|min magnitude"), hazard (country or storm name), url, package ("npm:name" or "pypi:name"), travel (place), approvals (wallet address or address@chain: new approvals), contract (token address or address@chain: owner, upgrade and liquidity changes)${onchainEnabled() ? ', wallet, token (address or address@chain)' : ''}. For plain-language requests use oculon_monitor.`,
486
688
  inputSchema: schema({ kind: { type: 'string', enum: availableKinds() }, target: str('What to watch'), label: str('Optional display name') }, ['kind', 'target']),
487
689
  run: (o, a) => o.watchAdd(String(a.kind), String(a.target), a.label ? String(a.label) : undefined),
488
690
  },
@@ -704,15 +906,37 @@ export class McpServer {
704
906
  const asked = String(msg.params?.protocolVersion ?? '');
705
907
  return reply({
706
908
  protocolVersion: SUPPORTED.includes(asked) ? asked : SUPPORTED[0],
707
- capabilities: { tools: { listChanged: false } },
909
+ capabilities: { tools: { listChanged: false }, resources: { listChanged: false } },
708
910
  serverInfo: SERVER_INFO,
709
- instructions: 'Oculon is an OSINT engine. Every result includes provenance (LIVE/CACHED/UNAVAILABLE/ERROR per source). Report data as given; do not present ERROR or UNAVAILABLE sources as findings.',
911
+ instructions: 'Oculon is an OSINT engine. Every result includes provenance (LIVE/CACHED/UNAVAILABLE/ERROR per source). Report data as given; do not present ERROR or UNAVAILABLE sources as findings. Pass brief: true to any tool for a short answer. Check tools return check.id; oculon_replay shows every source call of a check.',
710
912
  });
711
913
  }
712
914
  case 'ping':
713
915
  return reply({});
714
916
  case 'tools/list':
715
- return reply({ tools: (await this.allTools()).map(({ name, description, inputSchema }) => ({ name, description, inputSchema })) });
917
+ return reply({
918
+ tools: (await this.allTools()).map(({ name, description, inputSchema }) => ({
919
+ name,
920
+ description,
921
+ inputSchema: { ...inputSchema, properties: { ...(inputSchema.properties ?? {}), brief: { type: 'boolean', description: 'Short answer for agents: verdict, risk, top reasons, sources and check id (fewer tokens)' } } },
922
+ ...(CHECK_TOOLS[name] ? { _meta: UI_META } : {}),
923
+ })),
924
+ });
925
+ case 'resources/list':
926
+ return reply({ resources: [
927
+ { uri: CARD_URI, name: 'Oculon verdict card', mimeType: MCP_APP_MIME, description: 'Verdict, risk, reasons and sources of a check' },
928
+ { uri: CARD_URI_OPENAI, name: 'Oculon verdict card (ChatGPT)', mimeType: SKYBRIDGE_MIME, description: 'Verdict, risk, reasons and sources of a check' },
929
+ ] });
930
+ case 'resources/templates/list':
931
+ return reply({ resourceTemplates: [] });
932
+ case 'resources/read': {
933
+ const uri = String(msg.params?.uri ?? '');
934
+ if (uri !== CARD_URI && uri !== CARD_URI_OPENAI)
935
+ return fail(-32002, `resource not found: ${uri}`);
936
+ const base = this.opts.baseUrl;
937
+ const domains = base && /^https:/.test(base) ? [base] : [];
938
+ return reply({ contents: [{ uri, mimeType: uri === CARD_URI ? MCP_APP_MIME : SKYBRIDGE_MIME, text: CARD_HTML, _meta: { ui: { csp: { connectDomains: [], resourceDomains: [] }, prefersBorder: false }, 'openai/widgetDescription': 'Oculon verdict for the check above, with its reasons and sources.', 'openai/widgetPrefersBorder': false, 'openai/widgetCSP': { connect_domains: [], resource_domains: [] }, ...(domains.length ? { 'openai/widgetDomain': domains[0] } : {}) } }] });
939
+ }
716
940
  case 'tools/call': {
717
941
  const name = String(msg.params?.name ?? '');
718
942
  const tool = (await this.allTools()).find((t) => t.name === name);
@@ -721,6 +945,8 @@ export class McpServer {
721
945
  const raw = msg.params?.arguments ?? {};
722
946
  if (typeof raw !== 'object' || raw === null || Array.isArray(raw))
723
947
  return reply({ content: [{ type: 'text', text: 'Error: arguments must be a JSON object' }], isError: true });
948
+ const brief = raw.brief === true;
949
+ delete raw.brief;
724
950
  const bad = checkArgs(tool.inputSchema, raw);
725
951
  if (bad)
726
952
  return reply({ content: [{ type: 'text', text: `Error: ${bad}` }], isError: true });
@@ -728,7 +954,31 @@ export class McpServer {
728
954
  const args = raw;
729
955
  if (this.opts.remote && name === 'oculon_monitor')
730
956
  args.dry_run = true;
731
- const out = await tool.run(this.o, args);
957
+ const ck = CHECK_TOOLS[name];
958
+ let out;
959
+ let check = null;
960
+ if (ck) {
961
+ // Checks are kept: a check id, a replay log, and what changed since the last check of the same thing.
962
+ const target = ck.arg === 'name' ? String(args.url ?? '') || createHash('sha256').update(String(args.data ?? '')).digest('hex') : `${String(args[ck.arg] ?? '')}${args.chain ? `@${String(args.chain).toLowerCase()}` : ''}`;
963
+ const label = ck.arg === 'name' ? String(args.name ?? args.url ?? 'file').slice(0, 90) : undefined;
964
+ const r = await this.o.recordCheck(ck.kind, target, async () => tool.run(this.o, args), label ? { label } : {});
965
+ out = r.value;
966
+ check = r.check;
967
+ const base = this.opts.baseUrl;
968
+ const meta = { id: check.id, seenBefore: check.seenBefore, replay: base ? base + check.replay : `oculon replay ${check.id}`, report: base ? base + check.report : `oculon replay ${check.id} --pdf report.pdf` };
969
+ if (out && typeof out === 'object')
970
+ out = { ...out, check: meta };
971
+ }
972
+ else {
973
+ out = await tool.run(this.o, args);
974
+ }
975
+ if (brief && !(out && typeof out === 'object' && '__image' in out)) {
976
+ const c = out?.check;
977
+ out = briefOf(out, c ? { check: { id: c.id, replay: c.replay, ...(c.seenBefore ? { changedSinceLast: c.seenBefore.changes } : {}) } } : {});
978
+ }
979
+ if (check) {
980
+ return reply({ content: [{ type: 'text', text: JSON.stringify(out) }], structuredContent: cardOf(ck.kind, out, check, this.opts.baseUrl), _meta: { 'openai/outputTemplate': CARD_URI_OPENAI } });
981
+ }
732
982
  if (out && typeof out === 'object' && '__image' in out) {
733
983
  const { __image, meta } = out;
734
984
  const content = [{ type: 'text', text: JSON.stringify(meta) }];
@@ -1,11 +1,13 @@
1
1
  /**
2
2
  * Crypto address check without API keys: which chain the address belongs to (from its format), whether it is
3
3
  * on the US OFAC sanctions list, and its age, balance and activity from free explorers (mempool.space for
4
- * Bitcoin, Blockscout for Ethereum and Robinhood Chain, the public Solana RPC). Useful before you send
5
- * funds to an address someone gave you in a chat.
4
+ * Bitcoin, Blockscout for Ethereum and Robinhood Chain, the public Solana RPC), victims' scam reports
5
+ * (Chainabuse, free key) and the ScamSniffer scam address list. Useful before you send funds to an address
6
+ * someone gave you in a chat.
6
7
  */
7
8
  import type { Ctx } from '../core/context.js';
8
9
  import type { ModuleResult } from '../core/types.js';
10
+ import { type AbuseReports } from '../sources/chainabuse.js';
9
11
  export interface AddressReport {
10
12
  address: string;
11
13
  chain: 'bitcoin' | 'evm' | 'solana' | 'tron' | 'unknown';
@@ -20,6 +22,8 @@ export interface AddressReport {
20
22
  } | null;
21
23
  sanctioned: boolean | null;
22
24
  sanctionHits: string[];
25
+ /** Scam reports filed by victims (Chainabuse). */
26
+ reports: AbuseReports | null;
23
27
  warnings: string[];
24
28
  advice: string[];
25
29
  }