chain-insights 0.68.2 → 0.69.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.
Files changed (43) hide show
  1. package/README.md +1 -0
  2. package/dist/apps/claude-view.html +39 -38
  3. package/dist/cli.cjs +31 -5
  4. package/dist/cli.mjs +31 -5
  5. package/dist/cli.mjs.map +1 -1
  6. package/dist/dex-registry-05wAhSa0.mjs +383 -0
  7. package/dist/dex-registry-05wAhSa0.mjs.map +1 -0
  8. package/dist/dex-registry-KOTJhAQf.cjs +411 -0
  9. package/dist/dex-tool-DIKN4dXB.cjs +536 -0
  10. package/dist/dex-tool-DpQKS7Te.mjs +497 -0
  11. package/dist/dex-tool-DpQKS7Te.mjs.map +1 -0
  12. package/dist/{format-DB2IH2U5.mjs → format-CSesEBvS.mjs} +4 -4
  13. package/dist/format-CSesEBvS.mjs.map +1 -0
  14. package/dist/{format-BjZuYDr8.cjs → format-DfhRQq4L.cjs} +3 -3
  15. package/dist/{graph-schema-DHd2fGbr.mjs → graph-schema-C7LgLhlY.mjs} +11 -4
  16. package/dist/graph-schema-C7LgLhlY.mjs.map +1 -0
  17. package/dist/{graph-schema-C_7aZ8RL.cjs → graph-schema-DHZi7kUu.cjs} +10 -3
  18. package/dist/mcp-proxy.cjs +113 -79
  19. package/dist/mcp-proxy.d.cts +4 -0
  20. package/dist/mcp-proxy.d.cts.map +1 -1
  21. package/dist/mcp-proxy.d.mts +4 -0
  22. package/dist/mcp-proxy.d.mts.map +1 -1
  23. package/dist/mcp-proxy.mjs +110 -79
  24. package/dist/mcp-proxy.mjs.map +1 -1
  25. package/dist/{tool-visibility-B4RAFMaB.cjs → tool-visibility-BopFnGsT.cjs} +5 -0
  26. package/dist/{tool-visibility-kclgGKL5.mjs → tool-visibility-Dq-Ruj-8.mjs} +6 -1
  27. package/dist/tool-visibility-Dq-Ruj-8.mjs.map +1 -0
  28. package/docs/mcp-proxy.md +71 -0
  29. package/docs/stability.md +3 -2
  30. package/package.json +3 -2
  31. package/registry/README.md +133 -0
  32. package/registry/robinhood.json +769 -0
  33. package/registry/robinhood.md +102 -0
  34. package/skills/chain-insights-dex/SKILL.md +104 -96
  35. package/skills/chain-insights-dex/agents/openai.yaml +1 -1
  36. package/skills/chain-insights-dex/reference.md +8 -27
  37. package/skills/chain-insights-dex-gauge/SKILL.md +6 -4
  38. package/skills/chain-insights-dex-launchpad/SKILL.md +6 -3
  39. package/skills/chain-insights-dex-vault/SKILL.md +4 -2
  40. package/skills/chain-insights-virtuals/SKILL.md +8 -4
  41. package/dist/format-DB2IH2U5.mjs.map +0 -1
  42. package/dist/graph-schema-DHd2fGbr.mjs.map +0 -1
  43. package/dist/tool-visibility-kclgGKL5.mjs.map +0 -1
@@ -2,12 +2,14 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
3
3
  const require_print_result = require("./print-result-qVhhuSdo.cjs");
4
4
  const require_client = require("./client-Ypw9BNbn.cjs");
5
- const require_tool_visibility = require("./tool-visibility-B4RAFMaB.cjs");
5
+ const require_tool_visibility = require("./tool-visibility-BopFnGsT.cjs");
6
6
  const require_usage_status = require("./usage-status-DonwoLR3.cjs");
7
7
  const require_subscription_status = require("./subscription-status-ru99UCPZ.cjs");
8
8
  const require_capabilities = require("./capabilities-DGavTSoW.cjs");
9
- const require_graph_schema = require("./graph-schema-C_7aZ8RL.cjs");
9
+ const require_graph_schema = require("./graph-schema-DHZi7kUu.cjs");
10
10
  const require_action_log = require("./action-log-HniMMF7f.cjs");
11
+ const require_dex_tool = require("./dex-tool-DIKN4dXB.cjs");
12
+ const require_dex_registry = require("./dex-registry-KOTJhAQf.cjs");
11
13
  let node_url = require("node:url");
12
14
  let node_path = require("node:path");
13
15
  node_path = require_rolldown_runtime.__toESM(node_path, 1);
@@ -101,17 +103,17 @@ function rateLimitedResult(toolName, err) {
101
103
  const BUSY_CODE = "chain_busy";
102
104
  const BUSY_WAIT_MS = 1100;
103
105
  const defaultSleep = (ms) => new Promise((done) => setTimeout(done, ms));
104
- function isRecord$3(value) {
106
+ function isRecord$2(value) {
105
107
  return typeof value === "object" && value !== null && !Array.isArray(value);
106
108
  }
107
109
  function membersOf(result) {
108
- const facts = isRecord$3(result.structuredContent) ? result.structuredContent.facts : void 0;
109
- const queries = isRecord$3(facts) ? facts.queries : void 0;
110
- return Array.isArray(queries) && queries.every(isRecord$3) ? queries : null;
110
+ const facts = isRecord$2(result.structuredContent) ? result.structuredContent.facts : void 0;
111
+ const queries = isRecord$2(facts) ? facts.queries : void 0;
112
+ return Array.isArray(queries) && queries.every(isRecord$2) ? queries : null;
111
113
  }
112
114
  function isBusyMember(member) {
113
115
  const detail = member.error_detail;
114
- return isRecord$3(detail) && detail.code === BUSY_CODE;
116
+ return isRecord$2(detail) && detail.code === BUSY_CODE;
115
117
  }
116
118
  /** The ids of the members the server refused as chain_busy. */
117
119
  function busyMemberIds(result) {
@@ -142,7 +144,7 @@ function mergeBatchAnswers(first, again) {
142
144
  const merged = members.map((m) => isBusyMember(m) && byId.has(String(m.id)) ? byId.get(String(m.id)) : m);
143
145
  const structured = first.structuredContent;
144
146
  const facts = structured.facts;
145
- const batch = isRecord$3(facts.batch) ? recount(facts.batch, merged) : facts.batch;
147
+ const batch = isRecord$2(facts.batch) ? recount(facts.batch, merged) : facts.batch;
146
148
  const nextStructured = {
147
149
  ...structured,
148
150
  facts: {
@@ -186,7 +188,7 @@ async function withBusyMemberRetry(args, call, sleep = defaultSleep) {
186
188
  function isBusyResult(result) {
187
189
  if (!result.isError) return false;
188
190
  const first = Array.isArray(result.content) ? result.content[0] : void 0;
189
- const text = isRecord$3(first) && typeof first.text === "string" ? first.text : "";
191
+ const text = isRecord$2(first) && typeof first.text === "string" ? first.text : "";
190
192
  return /^(Query execution failed: )?chain_busy\b/.test(text.trim());
191
193
  }
192
194
  /**
@@ -271,7 +273,7 @@ function routingHintLines() {
271
273
  return [`- Pick the layer first. ${ROUTING_RULE} 1. ${ROUTING_LINES[0]} 2. ${ROUTING_LINES[1]} 3. ${ROUTING_LINES[2]} ${ROUTING_NOT_SERVED} ${ROUTING_ADDRESS_ON_CHAIN} ${ROUTING_TWO_FIT} ${ROUTING_HANDOFF} The lookups that USE chain serves are listed in chain_admission.lookups of meta_network_capabilities. Read every limit that the server publishes from meta_network_capabilities (chain_admission and, when the server sends them, topology_admission and facts_admission). Never write a limit down.`, `- Act on a refusal by its class. ${moveLines().join(" ")}`];
272
274
  }
273
275
  const VIEW_BODY_LIMIT_BYTES = 65536;
274
- const VIEW_PAGE_TOOLS = /* @__PURE__ */ new Set(["graph_expand"]);
276
+ const VIEW_PAGE_TOOLS = /* @__PURE__ */ new Set(["graph_expand", "meta_usage_status"]);
275
277
  /** A fresh answer id: 12 random bytes, URL-safe base64 (16 characters). */
276
278
  function newViewId() {
277
279
  return (0, node_crypto.randomBytes)(12).toString("base64url");
@@ -333,7 +335,7 @@ function send(res, status, contentType, body) {
333
335
  function sendJson(res, status, value) {
334
336
  send(res, status, "application/json; charset=utf-8", JSON.stringify(value));
335
337
  }
336
- function isRecord$2(value) {
338
+ function isRecord$1(value) {
337
339
  return !!value && typeof value === "object" && !Array.isArray(value);
338
340
  }
339
341
  var BodyTooLarge = class extends Error {};
@@ -424,8 +426,8 @@ async function startViewServer(options) {
424
426
  sendJson(res, 400, { error: "invalid JSON" });
425
427
  return;
426
428
  }
427
- const args = isRecord$2(body) ? body.arguments ?? {} : void 0;
428
- if (!isRecord$2(args)) {
429
+ const args = isRecord$1(body) ? body.arguments ?? {} : void 0;
430
+ if (!isRecord$1(args)) {
429
431
  sendJson(res, 400, { error: "arguments must be an object" });
430
432
  return;
431
433
  }
@@ -606,52 +608,6 @@ async function connectRemote(options) {
606
608
  };
607
609
  }
608
610
  //#endregion
609
- //#region src/mcp/answer-hint.ts
610
- /**
611
- * The two answer rules that still slip in long answers, carried on every
612
- * graph reply in the result's `hint` field. Claude Code has a Stop hook that
613
- * reads the answer; Codex and Claude Desktop have no such hook, and in the
614
- * loop's third prompt set they broke one of these two rules in three of
615
- * thirteen conversations. The reply is the one thing every host hands the
616
- * model right before it writes, so the rules ride on it. A `hint` the
617
- * server already set is kept.
618
- */
619
- const ANSWER_HINT = "Answer: write every address in full (0x plus 40 characters), also when it repeats one named earlier and also when the user asks for shorter ones (name them instead); a transfer moves tokens, so write \"tokens worth about N USD\", never \"sent N USD\" or a $ figure; never draw the flows in text, ASCII or Mermaid, the host draws them.";
620
- function isRecord$1(value) {
621
- return typeof value === "object" && value !== null && !Array.isArray(value);
622
- }
623
- /** The structured content with the hint set when the server left it empty. */
624
- function withAnswerHint(structuredContent) {
625
- if (!isRecord$1(structuredContent) || !isRecord$1(structuredContent.facts)) return structuredContent;
626
- if (typeof structuredContent.hint === "string" && structuredContent.hint.trim()) return structuredContent;
627
- return {
628
- ...structuredContent,
629
- hint: ANSWER_HINT
630
- };
631
- }
632
- /** A graph tool result whose structured content and single JSON text block both carry the hint. */
633
- function withAnswerHintResult(result) {
634
- const structured = withAnswerHint(result.structuredContent);
635
- if (structured === result.structuredContent) return result;
636
- const content = result.content ?? [];
637
- const only = content.length === 1 && content[0]?.type === "text" ? content[0] : null;
638
- let parsed = void 0;
639
- try {
640
- parsed = only?.text ? JSON.parse(only.text) : void 0;
641
- } catch {
642
- parsed = void 0;
643
- }
644
- const textIsStructured = parsed !== void 0 && JSON.stringify(parsed) === JSON.stringify(result.structuredContent);
645
- return {
646
- ...result,
647
- structuredContent: structured,
648
- content: textIsStructured ? [{
649
- ...only,
650
- text: JSON.stringify(structured)
651
- }] : content
652
- };
653
- }
654
- //#endregion
655
611
  //#region src/mcp/proxy.ts
656
612
  const LOCAL_TOOL_NAMES = /* @__PURE__ */ new Set([
657
613
  "meta_network_capabilities",
@@ -660,11 +616,14 @@ const LOCAL_TOOL_NAMES = /* @__PURE__ */ new Set([
660
616
  "meta_subscription_status",
661
617
  "meta_help",
662
618
  "meta_rules",
619
+ require_dex_tool.META_DEX_LOOKUP_TOOL,
663
620
  "wallet_balance",
664
621
  "wallet_topup",
665
622
  require_graph_schema.GRAPH_EXPAND_TOOL
666
623
  ]);
667
624
  const APP_ONLY_LOCAL_TOOL_NAMES = /* @__PURE__ */ new Set([require_graph_schema.GRAPH_EXPAND_TOOL]);
625
+ /** The structured refusal of a click refused for money; the view reads it (chain-insights-ui apps/claude-view/credits.ts). */
626
+ const REFUSAL_SCHEMA = "chain-insights.refusal.v1";
668
627
  const GRAPH_ARRAY_KEYS = [
669
628
  "nodes",
670
629
  "edges",
@@ -717,15 +676,17 @@ function resolveMcpProxyMode(env = process.env) {
717
676
  }
718
677
  const GRAPH_LAYERS_TEXT = "Use USE topology for topology (address/FLOWS_TO/OPERATED_BY/LINKED graph with SWAPPED, ADDED_LIQUIDITY, REMOVED_LIQUIDITY, BRIDGED and the Pool, Token and NFT labels, unified recent+historical) and USE facts for bounded TRANSFER, SWAP, LIQUIDITY_ADD, LIQUIDITY_REMOVE and BRIDGE_CROSSING rows and enrichment, and USE chain for the chain node's own record of one known transaction, block, address or the head.";
719
678
  const TOOL_RULES_FIRST = "Rules first: if the chain-insights-cypher skill is not loaded in this chat, call meta_rules once before this tool. For a graph, alias the columns from_address and to_address; the host draws the picture from the answer itself. Never draw it again with another tool, such as a visualize or widget tool.";
679
+ const GRAPH_QUERY_DEX_DOOR_SENTENCE = "A question that names an exchange and no address starts with meta_dex_lookup, never with a scan of :Protocol, :Pool or labels.";
720
680
  const KNOWN_PUBLIC_TOOL_DESCRIPTIONS = {
721
681
  meta_network_capabilities: "Return the current Chain Insights network and tool support matrix. Takes no arguments: send {}.",
722
682
  meta_schema: require_graph_schema.META_SCHEMA_DESCRIPTION,
683
+ [require_dex_tool.META_DEX_LOOKUP_TOOL]: require_dex_tool.META_DEX_LOOKUP_DESCRIPTION,
723
684
  meta_usage_status: "Return the caller's public free graph_query quota for the current UTC day.",
724
685
  meta_subscription_status: "Return the caller's CIA subscription window end, daily allowance, consumption, and tier.",
725
686
  meta_help: "Show a short guide to Chain Insights tools and workflow.",
726
687
  meta_rules: "Return the Chain Insights rules: how to write graph_query and graph_query_batch reads that are served, how to name columns so the answer is drawn as a graph, a time series or a table, and how to write the answer. Call it once per chat, before the first graph query, when the chain-insights-cypher skill is not loaded. Takes no arguments: send {}.",
727
688
  wallet_balance: "Show the local Chain Insights payment wallet address, payment network, token, and amount.",
728
- graph_query: `${TOOL_RULES_FIRST} Run a read-only GQL/Cypher query through the Chain Insights graph endpoint. ${GRAPH_LAYERS_TEXT} ${ROUTING_NOT_SERVED} Preserve full addresses exactly, and write every address in full, all 42 characters, in your answer: never shorten one with ... or ….`,
689
+ graph_query: `${TOOL_RULES_FIRST} Run a read-only GQL/Cypher query through the Chain Insights graph endpoint. ${GRAPH_LAYERS_TEXT} ${GRAPH_QUERY_DEX_DOOR_SENTENCE} ${ROUTING_NOT_SERVED} Preserve full addresses exactly, and write every address in full, all 42 characters, in your answer: never shorten one with ... or ….`,
729
690
  graph_query_batch: `${TOOL_RULES_FIRST} Run multiple read-only GQL/Cypher queries through the Chain Insights graph endpoint in one paid batch. Prefer this for related topology/facts reads. For a time series across days, send one USE facts total per day with the query id set to the day, "YYYY-MM-DD": the view joins them into one series. Write every address in full in your answer, all 42 characters.`
730
691
  };
731
692
  const KNOWN_PUBLIC_TOOL_TITLES = {
@@ -1184,7 +1145,7 @@ function normalizeRemoteToolResult(toolName, result) {
1184
1145
  _meta: sanitizeRemoteMeta(result._meta),
1185
1146
  isError: result.isError
1186
1147
  };
1187
- return toolName === "graph_query" || toolName === "graph_query_batch" ? require_print_result.withTimestampTextResult(withAnswerHintResult(normalized)) : normalized;
1148
+ return toolName === "graph_query" || toolName === "graph_query_batch" ? require_print_result.withTimestampTextResult(require_dex_tool.withAnswerHintResult(normalized)) : normalized;
1188
1149
  }
1189
1150
  function cleanNetworkCapabilities(value) {
1190
1151
  const structuredContent = isRecord(value) ? value.structuredContent : void 0;
@@ -1339,22 +1300,56 @@ async function createProxy() {
1339
1300
  });
1340
1301
  }
1341
1302
  const remoteToolNames = new Set((tools ?? []).map((tool) => tool.name));
1342
- async function paymentFailureText(toolName, err) {
1303
+ async function paymentRefusal(toolName, err) {
1343
1304
  const text = remoteCallFailureText(toolName, err);
1344
- if (!(err instanceof require_client.PaymentRequiredError || /\b402\b|payment/i.test(err.message ?? "")) || !remoteConnected || !remoteToolNames.has("usage_status")) return text;
1305
+ const isPayment = err instanceof require_client.PaymentRequiredError || /\b402\b|payment/i.test(err.message ?? "");
1306
+ if (!isPayment || !remoteConnected || !remoteToolNames.has("usage_status")) return {
1307
+ text,
1308
+ payment: isPayment,
1309
+ spent: false
1310
+ };
1345
1311
  try {
1346
1312
  const result = await remoteClient.callTool({
1347
1313
  name: "usage_status",
1348
1314
  arguments: {}
1349
1315
  });
1350
1316
  const facts = isRecord(result.structuredContent) ? result.structuredContent["facts"] : void 0;
1351
- const usage = isRecord(facts) ? facts["usage"] : void 0;
1317
+ const usage = isRecord(facts) && isRecord(facts["usage"]) ? facts["usage"] : void 0;
1352
1318
  const spent = require_usage_status.freeTierSpentText(usage);
1353
- return spent ? `${spent} ${text}` : text;
1319
+ return {
1320
+ text: spent ? `${spent} ${text}` : text,
1321
+ payment: true,
1322
+ usage,
1323
+ spent: Boolean(spent)
1324
+ };
1354
1325
  } catch {
1355
- return text;
1326
+ return {
1327
+ text,
1328
+ payment: true,
1329
+ spent: false
1330
+ };
1356
1331
  }
1357
1332
  }
1333
+ async function paymentFailureText(toolName, err) {
1334
+ return (await paymentRefusal(toolName, err)).text;
1335
+ }
1336
+ async function clickRefusal(toolName, err) {
1337
+ const refusal = await paymentRefusal(toolName, err);
1338
+ const structuredContent = refusal.payment ? {
1339
+ schema: REFUSAL_SCHEMA,
1340
+ tool: toolName,
1341
+ code: refusal.spent ? "free_tier_spent" : "payment_failed",
1342
+ ...refusal.usage ? { usage: refusal.usage } : {}
1343
+ } : void 0;
1344
+ return {
1345
+ content: [{
1346
+ type: "text",
1347
+ text: refusal.text
1348
+ }],
1349
+ isError: true,
1350
+ ...structuredContent ? { structuredContent } : {}
1351
+ };
1352
+ }
1358
1353
  const server = new _modelcontextprotocol_sdk_server_mcp_js.McpServer({
1359
1354
  name: "chain-insights",
1360
1355
  version: require_print_result.PACKAGE_VERSION
@@ -1421,18 +1416,38 @@ async function createProxy() {
1421
1416
  openWorldHint: true
1422
1417
  }
1423
1418
  }, async (args) => require_graph_schema.handleMetaSchema(args, schemaDependencies));
1424
- server.registerTool("meta_usage_status", {
1425
- title: "Usage Status",
1426
- description: KNOWN_PUBLIC_TOOL_DESCRIPTIONS.meta_usage_status,
1427
- inputSchema: EMPTY_INPUT_SCHEMA,
1428
- _meta: VIEW_TOOL_META,
1429
- annotations: {
1430
- readOnlyHint: true,
1431
- destructiveHint: false,
1432
- idempotentHint: true,
1433
- openWorldHint: true
1434
- }
1435
- }, async () => {
1419
+ const dexDependencies = {
1420
+ loadRegistry: (network) => require_dex_registry.loadRegistry(network, { log: (line) => {
1421
+ logger.info("dex_registry.fault", { line });
1422
+ } }),
1423
+ graphQueryBatch: async (args) => {
1424
+ const options = remoteToolRequestOptions("graph_query_batch");
1425
+ const call = (requestArgs) => withRateLimitRetry(() => options ? remoteClient.callTool({
1426
+ name: "graph_query_batch",
1427
+ arguments: requestArgs
1428
+ }, void 0, options) : remoteClient.callTool({
1429
+ name: "graph_query_batch",
1430
+ arguments: requestArgs
1431
+ }));
1432
+ return await withBusyMemberRetry(args, call);
1433
+ },
1434
+ unavailable: async () => {
1435
+ await ensureRemote();
1436
+ return remoteConnected ? void 0 : `${remoteUnavailableMessage ?? `Chain Insights Graph is not connected at ${graphMcpEndpoint}`}.`;
1437
+ },
1438
+ describeFailure: (err) => remoteCallFailureText("graph_query_batch", err)
1439
+ };
1440
+ server.registerTool(require_dex_tool.META_DEX_LOOKUP_TOOL, {
1441
+ title: require_dex_tool.META_DEX_LOOKUP_TITLE,
1442
+ description: KNOWN_PUBLIC_TOOL_DESCRIPTIONS[require_dex_tool.META_DEX_LOOKUP_TOOL],
1443
+ inputSchema: {
1444
+ network: NETWORK_SCHEMA,
1445
+ name: zod.string().optional().describe("The exchange as the user wrote it: Aero, Aerodrome, uni v4. With no name, every covered exchange is listed."),
1446
+ pools: zod.boolean().optional().describe("Read the biggest pools of the exchange (default true). false sends only Head and the contract reads.")
1447
+ },
1448
+ annotations: require_dex_tool.META_DEX_LOOKUP_ANNOTATIONS
1449
+ }, async (args) => require_dex_tool.handleMetaDexLookup(args, dexDependencies));
1450
+ const readUsageStatus = async () => {
1436
1451
  try {
1437
1452
  await ensureRemote();
1438
1453
  if (!remoteConnected) return {
@@ -1469,7 +1484,19 @@ async function createProxy() {
1469
1484
  isError: true
1470
1485
  };
1471
1486
  }
1472
- });
1487
+ };
1488
+ server.registerTool("meta_usage_status", {
1489
+ title: "Usage Status",
1490
+ description: KNOWN_PUBLIC_TOOL_DESCRIPTIONS.meta_usage_status,
1491
+ inputSchema: EMPTY_INPUT_SCHEMA,
1492
+ _meta: VIEW_TOOL_META,
1493
+ annotations: {
1494
+ readOnlyHint: true,
1495
+ destructiveHint: false,
1496
+ idempotentHint: true,
1497
+ openWorldHint: true
1498
+ }
1499
+ }, async () => readUsageStatus());
1473
1500
  server.registerTool("meta_subscription_status", {
1474
1501
  title: "Subscription Status",
1475
1502
  description: KNOWN_PUBLIC_TOOL_DESCRIPTIONS.meta_subscription_status,
@@ -1555,6 +1582,7 @@ async function createProxy() {
1555
1582
  }, void 0, options));
1556
1583
  },
1557
1584
  describeFailure: (err) => remoteCallFailureText("graph_query", err),
1585
+ refusal: (err) => clickRefusal("graph_query", err),
1558
1586
  unavailable: () => remoteConnected ? void 0 : `${remoteUnavailableMessage ?? `Chain Insights Graph is not connected at ${graphMcpEndpoint}`}. Restart the Chain Insights MCP proxy after the endpoint is reachable.`
1559
1587
  };
1560
1588
  const runGraphExpand = (args) => require_graph_schema.handleGraphExpand(args, flowsDependencies);
@@ -1564,6 +1592,7 @@ async function createProxy() {
1564
1592
  html: readClaudeViewHtml,
1565
1593
  runTool: async (name, args) => {
1566
1594
  if (name === "graph_expand") return runGraphExpand(args);
1595
+ if (name === "meta_usage_status") return readUsageStatus();
1567
1596
  throw new Error(`The browser page cannot call ${name}`);
1568
1597
  },
1569
1598
  log: (event, fields) => {
@@ -1664,6 +1693,7 @@ async function createProxy() {
1664
1693
  "Investigation tools:",
1665
1694
  "- meta_network_capabilities: supported networks and available tools. Takes no arguments.",
1666
1695
  "- meta_schema: read the live graph schema of one network: labels, link types and field names. Cached for 24 hours.",
1696
+ "- meta_dex_lookup: turn an exchange name (Aero, Uniswap, Virtuals) into its factories, routers, pools and first reads. Call it first when a question names an exchange and gives no address.",
1667
1697
  "- meta_usage_status: check the caller public free graph_query quota.",
1668
1698
  "- meta_subscription_status: check the caller CIA subscription window end, daily allowance, consumption, and tier.",
1669
1699
  "- graph_query: run read-only GQL/Cypher through the universal graph endpoint. Use USE topology or USE facts.",
@@ -1681,6 +1711,7 @@ async function createProxy() {
1681
1711
  "Available graph-backed tools:",
1682
1712
  "- meta_network_capabilities: supported networks and available tools. Takes no arguments.",
1683
1713
  "- meta_schema: read the live graph schema of one network: labels, link types and field names. Cached for 24 hours.",
1714
+ "- meta_dex_lookup: turn an exchange name (Aero, Uniswap, Virtuals) into its factories, routers, pools and first reads. Call it first when a question names an exchange and gives no address.",
1684
1715
  "- meta_usage_status: check the caller public free graph_query quota.",
1685
1716
  "- meta_subscription_status: check the caller CIA subscription window end, daily allowance, consumption, and tier.",
1686
1717
  "- graph_query: run read-only GQL/Cypher through the universal graph endpoint. Use USE topology or USE facts.",
@@ -1792,9 +1823,12 @@ if (process.argv[1] && require("url").pathToFileURL(__filename).href.includes(pr
1792
1823
  //#endregion
1793
1824
  exports.APP_ONLY_LOCAL_TOOL_NAMES = APP_ONLY_LOCAL_TOOL_NAMES;
1794
1825
  exports.CLAUDE_VIEW_URI = CLAUDE_VIEW_URI;
1826
+ exports.GRAPH_QUERY_DEX_DOOR_SENTENCE = GRAPH_QUERY_DEX_DOOR_SENTENCE;
1827
+ exports.KNOWN_PUBLIC_TOOL_DESCRIPTIONS = KNOWN_PUBLIC_TOOL_DESCRIPTIONS;
1795
1828
  exports.LOCAL_TOOL_NAMES = LOCAL_TOOL_NAMES;
1796
1829
  exports.MCP_APP_MIME_TYPE = MCP_APP_MIME_TYPE;
1797
1830
  exports.PICTURE_RULES = PICTURE_RULES;
1831
+ exports.REFUSAL_SCHEMA = REFUSAL_SCHEMA;
1798
1832
  exports.createProxy = createProxy;
1799
1833
  exports.knownPublicToolInputSchema = knownPublicToolInputSchema;
1800
1834
  exports.readClaudeViewHtml = readClaudeViewHtml;
@@ -2,6 +2,8 @@ import * as z from "zod";
2
2
  //#region src/mcp/proxy.d.ts
3
3
  export declare const LOCAL_TOOL_NAMES: Set<string>;
4
4
  export declare const APP_ONLY_LOCAL_TOOL_NAMES: Set<string>;
5
+ /** The structured refusal of a click refused for money; the view reads it (chain-insights-ui apps/claude-view/credits.ts). */
6
+ export declare const REFUSAL_SCHEMA = "chain-insights.refusal.v1";
5
7
  export declare const CLAUDE_VIEW_URI = "ui://chain-insights/view";
6
8
  export declare const MCP_APP_MIME_TYPE = "text/html;profile=mcp-app";
7
9
  /**
@@ -11,6 +13,8 @@ export declare const MCP_APP_MIME_TYPE = "text/html;profile=mcp-app";
11
13
  export declare function readClaudeViewHtml(): string;
12
14
  export type McpProxyMode = 'workspace' | 'stateless';
13
15
  export declare function resolveMcpProxyMode(env?: NodeJS.ProcessEnv): McpProxyMode;
16
+ export declare const GRAPH_QUERY_DEX_DOOR_SENTENCE = "A question that names an exchange and no address starts with meta_dex_lookup, never with a scan of :Protocol, :Pool or labels.";
17
+ export declare const KNOWN_PUBLIC_TOOL_DESCRIPTIONS: Record<string, string>;
14
18
  type ToolInputShape = Record<string, z.ZodTypeAny>;
15
19
  export declare const PICTURE_RULES: string;
16
20
  export declare function knownPublicToolInputSchema(toolName: string): ToolInputShape | null;
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-proxy.d.cts","names":[],"sources":["../src/mcp/proxy.ts"],"mappings":";;qBAkDa,kBAAgB;qBAYhB,2BAAyB;qBAUzB;qBACA;;;;;wBAyBG;YAkBJ;wBAEI,oBAAoB,MAAK,OAAO,aAA2B;KAsCtE,iBAAiB,eAAe,EAAE;qBAgB1B;wBA2GG,2BAA2B,mBAAmB;;;;;;;;wBAomBxC,eAAe"}
1
+ {"version":3,"file":"mcp-proxy.d.cts","names":[],"sources":["../src/mcp/proxy.ts"],"mappings":";;qBA6Da,kBAAgB;qBAahB,2BAAyB;;qBAEzB;qBAUA;qBACA;;;;;wBAyBG;YAkBJ;wBAEI,oBAAoB,MAAK,OAAO,aAA2B;qBAiB9D;qBAGA,gCAAgC;KAuBxC,iBAAiB,eAAe,EAAE;qBAgB1B;wBA2GG,2BAA2B,mBAAmB;;;;;;;;wBAomBxC,eAAe"}
@@ -2,6 +2,8 @@ import * as z from "zod";
2
2
  //#region src/mcp/proxy.d.ts
3
3
  export declare const LOCAL_TOOL_NAMES: Set<string>;
4
4
  export declare const APP_ONLY_LOCAL_TOOL_NAMES: Set<string>;
5
+ /** The structured refusal of a click refused for money; the view reads it (chain-insights-ui apps/claude-view/credits.ts). */
6
+ export declare const REFUSAL_SCHEMA = "chain-insights.refusal.v1";
5
7
  export declare const CLAUDE_VIEW_URI = "ui://chain-insights/view";
6
8
  export declare const MCP_APP_MIME_TYPE = "text/html;profile=mcp-app";
7
9
  /**
@@ -11,6 +13,8 @@ export declare const MCP_APP_MIME_TYPE = "text/html;profile=mcp-app";
11
13
  export declare function readClaudeViewHtml(): string;
12
14
  export type McpProxyMode = 'workspace' | 'stateless';
13
15
  export declare function resolveMcpProxyMode(env?: NodeJS.ProcessEnv): McpProxyMode;
16
+ export declare const GRAPH_QUERY_DEX_DOOR_SENTENCE = "A question that names an exchange and no address starts with meta_dex_lookup, never with a scan of :Protocol, :Pool or labels.";
17
+ export declare const KNOWN_PUBLIC_TOOL_DESCRIPTIONS: Record<string, string>;
14
18
  type ToolInputShape = Record<string, z.ZodTypeAny>;
15
19
  export declare const PICTURE_RULES: string;
16
20
  export declare function knownPublicToolInputSchema(toolName: string): ToolInputShape | null;
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-proxy.d.mts","names":[],"sources":["../src/mcp/proxy.ts"],"mappings":";;qBAkDa,kBAAgB;qBAYhB,2BAAyB;qBAUzB;qBACA;;;;;wBAyBG;YAkBJ;wBAEI,oBAAoB,MAAK,OAAO,aAA2B;KAsCtE,iBAAiB,eAAe,EAAE;qBAgB1B;wBA2GG,2BAA2B,mBAAmB;;;;;;;;wBAomBxC,eAAe"}
1
+ {"version":3,"file":"mcp-proxy.d.mts","names":[],"sources":["../src/mcp/proxy.ts"],"mappings":";;qBA6Da,kBAAgB;qBAahB,2BAAyB;;qBAEzB;qBAUA;qBACA;;;;;wBAyBG;YAkBJ;wBAEI,oBAAoB,MAAK,OAAO,aAA2B;qBAiB9D;qBAGA,gCAAgC;KAuBxC,iBAAiB,eAAe,EAAE;qBAgB1B;wBA2GG,2BAA2B,mBAAmB;;;;;;;;wBAomBxC,eAAe"}