@oracle-agent/oracle 0.9.8 → 0.11.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 (160) hide show
  1. package/README.md +15 -10
  2. package/bin/oracle-data-mcp.mjs +9 -0
  3. package/docs/architecture.md +3 -1
  4. package/docs/profiles.md +3 -6
  5. package/docs/public-surface.md +133 -0
  6. package/package.json +3 -2
  7. package/public/oracle-splash/assets/cli-chain-hyperliquid.jpg +0 -0
  8. package/public/oracle-splash/brand/aave.webp +0 -0
  9. package/public/oracle-splash/brand/aavev2.webp +0 -0
  10. package/public/oracle-splash/brand/aborean.webp +0 -0
  11. package/public/oracle-splash/brand/across.webp +0 -0
  12. package/public/oracle-splash/brand/aerodrome.webp +0 -0
  13. package/public/oracle-splash/brand/afi.webp +0 -0
  14. package/public/oracle-splash/brand/arcus.webp +0 -0
  15. package/public/oracle-splash/brand/aster.webp +0 -0
  16. package/public/oracle-splash/brand/avant.webp +0 -0
  17. package/public/oracle-splash/brand/balancer.webp +0 -0
  18. package/public/oracle-splash/brand/beefy.webp +0 -0
  19. package/public/oracle-splash/brand/benqi.webp +0 -0
  20. package/public/oracle-splash/brand/bestinslot.ico +0 -0
  21. package/public/oracle-splash/brand/bitfi.webp +0 -0
  22. package/public/oracle-splash/brand/bonkswap.webp +0 -0
  23. package/public/oracle-splash/brand/bouncebit.webp +0 -0
  24. package/public/oracle-splash/brand/camelot.webp +0 -0
  25. package/public/oracle-splash/brand/compound.webp +0 -0
  26. package/public/oracle-splash/brand/concrete.webp +0 -0
  27. package/public/oracle-splash/brand/cow.webp +0 -0
  28. package/public/oracle-splash/brand/curve.webp +0 -0
  29. package/public/oracle-splash/brand/derive.webp +0 -0
  30. package/public/oracle-splash/brand/dolomite.webp +0 -0
  31. package/public/oracle-splash/brand/eigenlayer.webp +0 -0
  32. package/public/oracle-splash/brand/ekubo.webp +0 -0
  33. package/public/oracle-splash/brand/ethena.webp +0 -0
  34. package/public/oracle-splash/brand/etherfi.webp +0 -0
  35. package/public/oracle-splash/brand/etherfiborrow.webp +0 -0
  36. package/public/oracle-splash/brand/felix.webp +0 -0
  37. package/public/oracle-splash/brand/fluid.webp +0 -0
  38. package/public/oracle-splash/brand/fluxbeam.webp +0 -0
  39. package/public/oracle-splash/brand/folks.webp +0 -0
  40. package/public/oracle-splash/brand/fortyacres.webp +0 -0
  41. package/public/oracle-splash/brand/gainsnetwork.webp +0 -0
  42. package/public/oracle-splash/brand/gassss.webp +0 -0
  43. package/public/oracle-splash/brand/gmx.webp +0 -0
  44. package/public/oracle-splash/brand/harmonix.webp +0 -0
  45. package/public/oracle-splash/brand/hlorderbook.webp +0 -0
  46. package/public/oracle-splash/brand/hlp.webp +0 -0
  47. package/public/oracle-splash/brand/hop.webp +0 -0
  48. package/public/oracle-splash/brand/hyperbeat.webp +0 -0
  49. package/public/oracle-splash/brand/hyperlend.webp +0 -0
  50. package/public/oracle-splash/brand/hyperliquid.webp +0 -0
  51. package/public/oracle-splash/brand/hyperliquidhpl.webp +0 -0
  52. package/public/oracle-splash/brand/hyperliquidspot.webp +0 -0
  53. package/public/oracle-splash/brand/hyperswap.webp +0 -0
  54. package/public/oracle-splash/brand/hypha.webp +0 -0
  55. package/public/oracle-splash/brand/joedex.webp +0 -0
  56. package/public/oracle-splash/brand/jupiter.webp +0 -0
  57. package/public/oracle-splash/brand/kelp.webp +0 -0
  58. package/public/oracle-splash/brand/kinetiq.webp +0 -0
  59. package/public/oracle-splash/brand/kmhype.webp +0 -0
  60. package/public/oracle-splash/brand/kona.webp +0 -0
  61. package/public/oracle-splash/brand/konalend.webp +0 -0
  62. package/public/oracle-splash/brand/lfj.webp +0 -0
  63. package/public/oracle-splash/brand/lido.webp +0 -0
  64. package/public/oracle-splash/brand/lifi.webp +0 -0
  65. package/public/oracle-splash/brand/lighter.webp +0 -0
  66. package/public/oracle-splash/brand/lista.webp +0 -0
  67. package/public/oracle-splash/brand/loopedhype.webp +0 -0
  68. package/public/oracle-splash/brand/lorenzo.webp +0 -0
  69. package/public/oracle-splash/brand/magic-eden.webp +0 -0
  70. package/public/oracle-splash/brand/magiceden.webp +0 -0
  71. package/public/oracle-splash/brand/mempool.png +0 -0
  72. package/public/oracle-splash/brand/meteora.webp +0 -0
  73. package/public/oracle-splash/brand/morpho.webp +0 -0
  74. package/public/oracle-splash/brand/myriad.webp +0 -0
  75. package/public/oracle-splash/brand/noxa.webp +0 -0
  76. package/public/oracle-splash/brand/odos.webp +0 -0
  77. package/public/oracle-splash/brand/oneinch.webp +0 -0
  78. package/public/oracle-splash/brand/openbook.webp +0 -0
  79. package/public/oracle-splash/brand/opensea.webp +0 -0
  80. package/public/oracle-splash/brand/orca.webp +0 -0
  81. package/public/oracle-splash/brand/ordinals.png +0 -0
  82. package/public/oracle-splash/brand/ostium.webp +0 -0
  83. package/public/oracle-splash/brand/pancakeswap.webp +0 -0
  84. package/public/oracle-splash/brand/pendle.webp +0 -0
  85. package/public/oracle-splash/brand/perena.webp +0 -0
  86. package/public/oracle-splash/brand/pharaoh.webp +0 -0
  87. package/public/oracle-splash/brand/phoenix.webp +0 -0
  88. package/public/oracle-splash/brand/polymarket.webp +0 -0
  89. package/public/oracle-splash/brand/polynomial.webp +0 -0
  90. package/public/oracle-splash/brand/projectx.webp +0 -0
  91. package/public/oracle-splash/brand/pumpfun.webp +0 -0
  92. package/public/oracle-splash/brand/quickswap.webp +0 -0
  93. package/public/oracle-splash/brand/rain.webp +0 -0
  94. package/public/oracle-splash/brand/raydium.webp +0 -0
  95. package/public/oracle-splash/brand/relay.webp +0 -0
  96. package/public/oracle-splash/brand/rocketpool.webp +0 -0
  97. package/public/oracle-splash/brand/saber.webp +0 -0
  98. package/public/oracle-splash/brand/sakuraswap.webp +0 -0
  99. package/public/oracle-splash/brand/sanctum.webp +0 -0
  100. package/public/oracle-splash/brand/satflow.png +0 -0
  101. package/public/oracle-splash/brand/sierra.webp +0 -0
  102. package/public/oracle-splash/brand/sky.webp +0 -0
  103. package/public/oracle-splash/brand/solv.webp +0 -0
  104. package/public/oracle-splash/brand/spark.webp +0 -0
  105. package/public/oracle-splash/brand/sparksavings.webp +0 -0
  106. package/public/oracle-splash/brand/sphere.webp +0 -0
  107. package/public/oracle-splash/brand/ssv.webp +0 -0
  108. package/public/oracle-splash/brand/stabble.webp +0 -0
  109. package/public/oracle-splash/brand/stableswap.webp +0 -0
  110. package/public/oracle-splash/brand/stakewise.webp +0 -0
  111. package/public/oracle-splash/brand/stargate.webp +0 -0
  112. package/public/oracle-splash/brand/sthype.webp +0 -0
  113. package/public/oracle-splash/brand/sushiswap.webp +0 -0
  114. package/public/oracle-splash/brand/unisat.png +0 -0
  115. package/public/oracle-splash/brand/uniswap.webp +0 -0
  116. package/public/oracle-splash/brand/uniswapv2.webp +0 -0
  117. package/public/oracle-splash/brand/uniswapv4.webp +0 -0
  118. package/public/oracle-splash/brand/unit.webp +0 -0
  119. package/public/oracle-splash/brand/velodrome.webp +0 -0
  120. package/public/oracle-splash/brand/velora.webp +0 -0
  121. package/public/oracle-splash/brand/venus.webp +0 -0
  122. package/public/oracle-splash/brand/wbeth.webp +0 -0
  123. package/public/oracle-splash/brand/xsy.webp +0 -0
  124. package/public/oracle-splash/brand/yieldyak.webp +0 -0
  125. package/public/oracle-splash/brand/zerobase.webp +0 -0
  126. package/public/oracle-splash/brand/zerox.webp +0 -0
  127. package/public/oracle-splash/index.html +337 -197
  128. package/scripts/check-doc-drift.mjs +11 -0
  129. package/scripts/e2e-solana-bitcoin.mjs +1 -1
  130. package/scripts/secret-scan.mjs +1 -1
  131. package/src/action-receipts.mjs +108 -11
  132. package/src/auth/oauth.mjs +672 -0
  133. package/src/cli/commands/auth.mjs +193 -0
  134. package/src/cli/commands/bootstrap.mjs +2 -2
  135. package/src/cli/commands/chat.mjs +97 -75
  136. package/src/cli/commands/data.mjs +3 -1
  137. package/src/cli/commands/doctor.mjs +11 -1
  138. package/src/cli/commands/model.mjs +79 -23
  139. package/src/cli/kernel.mjs +4 -3
  140. package/src/cli/model-config.mjs +70 -0
  141. package/src/data/catalog.mjs +38 -7
  142. package/src/data/desk-data.mjs +12 -0
  143. package/src/data/providers/evm-rpc.mjs +19 -16
  144. package/src/data/providers/jupiter-venues.mjs +119 -0
  145. package/src/data/providers/jupiter.mjs +132 -0
  146. package/src/data/providers/magiceden-sol.mjs +13 -0
  147. package/src/data/providers/morpho.mjs +6 -2
  148. package/src/data/providers/pendle.mjs +3 -2
  149. package/src/data/providers/satflow.mjs +4 -1
  150. package/src/data/providers/signed-material-guard.mjs +108 -0
  151. package/src/data/providers/uniswap-v3.mjs +34 -5
  152. package/src/data/providers/uniswap-v4.mjs +414 -0
  153. package/src/prepare-envelope.mjs +22 -4
  154. package/src/router/prepare-route.mjs +17 -0
  155. package/src/router/route-sources.mjs +35 -0
  156. package/src/tui/app.mjs +18 -7
  157. package/src/tui/backend.mjs +145 -0
  158. package/src/tui/standalone-client.mjs +666 -0
  159. package/src/cards.mjs +0 -369
  160. package/src/cli/__pycache__/oracle-harness.cpython-311.pyc +0 -0
@@ -60,6 +60,17 @@ function checkVersionPins(rel, text) {
60
60
  `${rel}:${i + 1} advertises oracle ${latest[1]} as latest but this package is ${pkg.version}\n ${line.trim().slice(0, 120)}`,
61
61
  );
62
62
  }
63
+ // The 2026-08-03 grok lane found `Source tree: **oracle \`0.5.0\`**` and a
64
+ // `Published npm: **oracle \`0.4.2\`**` line surviving inside a 0.10.0
65
+ // tarball. Both shapes sailed past the two matchers above, so a stranger
66
+ // reading the shipped README saw a version five releases stale. Match any
67
+ // prose that states an oracle version, not just the two blessed prefixes.
68
+ const stated = line.match(/oracle\s+`(\d+\.\d+\.\d+)`/i);
69
+ if (stated && stated[1] !== pkg.version) {
70
+ failures.push(
71
+ `${rel}:${i + 1} states oracle ${stated[1]} but this package is ${pkg.version}\n ${line.trim().slice(0, 120)}`,
72
+ );
73
+ }
63
74
  });
64
75
  }
65
76
 
@@ -9,7 +9,7 @@ import { jupiterQuote, jupiterPrepareSwap, SOL_MINT, USDC_MINT } from "../src/da
9
9
  import { solanaSimulateTransaction } from "../src/data/providers/solana-rpc.mjs";
10
10
  import { magicEdenSolStats, magicEdenSolListings, magicEdenSolPrepareBuy } from "../src/data/providers/magiceden-sol.mjs";
11
11
 
12
- const PROBE_WALLET = process.env.ORACLE_E2E_SOL_PUBKEY || "11111111111111111111111111111111";
12
+ const PROBE_WALLET = process.env.ORACLE_E2E_SOL_PUBKEY || "DtM6A1ivwvFeT14f7ggTAGvpUTZA5LeutV3rLe8wR6U3";
13
13
  const PROBE_BTC = process.env.ORACLE_E2E_BTC_ADDRESS || "bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq";
14
14
 
15
15
  const results = [];
@@ -6,7 +6,7 @@
6
6
 
7
7
  import { execFileSync } from "node:child_process";
8
8
 
9
- const ROOT = process.cwd();
9
+ const ROOT = execFileSync("git", ["rev-parse", "--show-toplevel"], { cwd: process.cwd(), encoding: "utf8" }).trim();
10
10
 
11
11
  // Live values that must never appear. Sourced from the environment at scan
12
12
  // time so the scanner itself contains no secrets.
@@ -4,17 +4,89 @@
4
4
  // sign, broadcast, or fetch. It only records facts supplied by its caller.
5
5
 
6
6
  import { createHash } from "node:crypto";
7
+ import { wordlists } from "ethers";
7
8
 
8
9
  export const ACTION_RECEIPT_VERSION = 1;
9
10
 
11
+ // Key-name matching was exact-ish and only covered five words, so every wallet
12
+ // export alias (secretKey, seedPhrase, wif, keyMaterial, privKey, xprv, seed,
13
+ // keystore) sailed through. There was also NO value-shape rule, so a raw key or
14
+ // a BIP-39 phrase pasted into a benign field like `memo` was recorded verbatim.
15
+ //
16
+ // Both concerns were already solved in src/address-book.mjs; this module simply
17
+ // did not use the hardened list. Found by the opus lane of the 2026-08-03
18
+ // four-model review, and verified to PERSIST: unknown top-level props are
19
+ // dropped by the schema whitelist, but a secret nested inside a RETAINED field
20
+ // (intent, route, decodedAction) survives into the frozen receipt.
10
21
  const SECRET_KEYS = new Set([
11
22
  "privatekey",
23
+ "privkey",
24
+ "secretkey",
25
+ "seedphrase",
26
+ "seed",
12
27
  "mnemonic",
28
+ "passphrase",
29
+ "password",
30
+ "keystore",
31
+ "keymaterial",
32
+ "wif",
33
+ "xprv",
34
+ "xpriv",
13
35
  "bearer",
14
36
  "authorization",
15
37
  "signature",
38
+ "apikey",
39
+ "credential",
40
+ ]);
41
+
42
+ // Unambiguous key shapes: WIF, extended private key, BIP-39 word run. These are
43
+ // refused wherever they appear.
44
+ //
45
+ // A bare 64-hex string is deliberately NOT in this list. A raw EVM private key
46
+ // and a bytes32 tx hash are byte-identical, and receipts legitimately carry
47
+ // txHash / orderHash / salt / merkleRoot / nonce. Blanket-refusing 64-hex would
48
+ // break real receipts — an over-tight filter is its own bug. It is instead
49
+ // gated on the field name below.
50
+ const KEY_SHAPED_VALUE = [
51
+ /\b[5KL][1-9A-HJ-NP-Za-km-z]{50,51}\b/,
52
+ /\bxprv[0-9A-Za-z]{50,}\b/,
53
+ ];
54
+
55
+ const BIP39_WORD_COUNTS = new Set([12, 15, 18, 21, 24]);
56
+
57
+ function isBip39EnglishPhrase(value) {
58
+ const words = String(value).trim().toLowerCase().split(/\s+/).filter(Boolean);
59
+ return BIP39_WORD_COUNTS.has(words.length) && words.every((word) => wordlists.en.getWordIndex(word) >= 0);
60
+ }
61
+
62
+ const BARE_32_BYTE_HEX = /^\s*(?:0x)?[0-9a-fA-F]{64}\s*$/;
63
+
64
+ // Field names whose whole value is EXPECTED to be a 32-byte digest.
65
+ //
66
+ // The trailing `(?:e?s)?` matters: `publicValue` scans array leaves using the
67
+ // PARENT key, so a batched route's `orderHashes` / `proofs` / `commitments`
68
+ // arrives here in its plural form (English pluralizes `hash` as `hashes`).
69
+ // Without it a digest LIST is refused while the exact same digest in singular
70
+ // form is accepted — an over-tight filter that breaks real receipts and blocks
71
+ // no secret (key-SHAPED values are refused by KEY_SHAPED_VALUE / BIP-39
72
+ // regardless of field name).
73
+ const DIGEST_FIELD = /(hash|digest|root|salt|nonce|proof|commitment|sig|id)(?:e?s)?$/i;
74
+ const PROTOCOL_HEX_FIELDS = new Set([
75
+ "calldata",
76
+ "data",
77
+ "publickey",
78
+ "pubkey",
79
+ "message",
80
+ "payload",
81
+ "input",
82
+ "extradata",
16
83
  ]);
17
84
 
85
+ function allows32ByteHex(key) {
86
+ const normalized = normalizedKey(key);
87
+ return PROTOCOL_HEX_FIELDS.has(normalized) || DIGEST_FIELD.test(normalized);
88
+ }
89
+
18
90
  export class ActionReceiptSecretError extends Error {
19
91
  constructor(path) {
20
92
  super(`action receipt refused: secret-bearing field at ${path}`);
@@ -32,23 +104,45 @@ function isSecretKey(key) {
32
104
  return [...SECRET_KEYS].some((secret) => normalized.includes(secret));
33
105
  }
34
106
 
35
- function publicValue(value, path = "$") {
36
- if (value == null || typeof value === "string" || typeof value === "boolean") return value;
107
+ /**
108
+ * Refuse a key-material-shaped VALUE, so a secret pasted into a benign field
109
+ * name (memo, note, label) cannot be recorded verbatim.
110
+ *
111
+ * Bare 64-hex is only refused when the field name is NOT digest-shaped: a raw
112
+ * EVM private key and a bytes32 hash are byte-identical, and receipts carry
113
+ * txHash / orderHash / salt / nonce legitimately.
114
+ */
115
+ function assertNoSecretValue(key, value, path) {
116
+ if (typeof value !== "string") return;
117
+ if (KEY_SHAPED_VALUE.some((re) => re.test(value)) || isBip39EnglishPhrase(value)) {
118
+ throw new ActionReceiptSecretError(path);
119
+ }
120
+ if (BARE_32_BYTE_HEX.test(value) && !allows32ByteHex(key)) {
121
+ throw new ActionReceiptSecretError(path);
122
+ }
123
+ }
124
+
125
+ function publicValue(value, path = "$", key = "") {
126
+ if (value == null || typeof value === "boolean") return value;
127
+ if (typeof value === "string") {
128
+ assertNoSecretValue(key, value, path);
129
+ return value;
130
+ }
37
131
  if (typeof value === "number") {
38
132
  if (!Number.isFinite(value)) throw new TypeError(`action receipt: non-finite number at ${path}`);
39
133
  return value;
40
134
  }
41
135
  if (typeof value === "bigint") return value.toString();
42
- if (Array.isArray(value)) return value.map((item, index) => publicValue(item, `${path}[${index}]`));
136
+ if (Array.isArray(value)) return value.map((item, index) => publicValue(item, `${path}[${index}]`, key));
43
137
  if (typeof value !== "object" || Object.getPrototypeOf(value) !== Object.prototype) {
44
138
  throw new TypeError(`action receipt: JSON-like value required at ${path}`);
45
139
  }
46
140
 
47
141
  const out = {};
48
- for (const key of Object.keys(value).sort()) {
49
- const childPath = `${path}.${key}`;
50
- if (isSecretKey(key)) throw new ActionReceiptSecretError(childPath);
51
- if (value[key] !== undefined) out[key] = publicValue(value[key], childPath);
142
+ for (const childKey of Object.keys(value).sort()) {
143
+ const childPath = `${path}.${childKey}`;
144
+ if (isSecretKey(childKey)) throw new ActionReceiptSecretError(childPath);
145
+ if (value[childKey] !== undefined) out[childKey] = publicValue(value[childKey], childPath, childKey);
52
146
  }
53
147
  return out;
54
148
  }
@@ -58,12 +152,15 @@ export function assertNoReceiptSecrets(value) {
58
152
  return publicValue(value);
59
153
  }
60
154
 
155
+ function canonicalPublicJson(value) {
156
+ if (value === null || typeof value !== "object") return JSON.stringify(value);
157
+ if (Array.isArray(value)) return `[${value.map(canonicalPublicJson).join(",")}]`;
158
+ return `{${Object.keys(value).map((key) => `${JSON.stringify(key)}:${canonicalPublicJson(value[key])}`).join(",")}}`;
159
+ }
160
+
61
161
  /** Canonical JSON with recursively sorted object keys. */
62
162
  export function canonicalReceiptJson(value) {
63
- const safe = publicValue(value);
64
- if (safe === null || typeof safe !== "object") return JSON.stringify(safe);
65
- if (Array.isArray(safe)) return `[${safe.map(canonicalReceiptJson).join(",")}]`;
66
- return `{${Object.keys(safe).map((key) => `${JSON.stringify(key)}:${canonicalReceiptJson(safe[key])}`).join(",")}}`;
163
+ return canonicalPublicJson(publicValue(value));
67
164
  }
68
165
 
69
166
  /** Hash exactly the public receipt fields, excluding the self-referential id. */