chain-insights 0.82.0 → 0.83.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.
@@ -83,41 +83,6 @@ const GRAPH_QUERY_CONTRACT_READ_SENTENCE = `"What is this contract" and "what ca
83
83
  /** The graph hint of the read: its key, its properties, its words and how to answer from them. */
84
84
  const CONTRACT_READ_HINT = `- One contract by its address on USE facts, with a RETURN of c.<property> items: ${CONTRACT_READ_EXAMPLE}. One node, no relationship, no day, no WHERE and no \$parameter; the address is a 42-character literal in either case, and LIMIT is optional and only 1. One row or none. Properties: ${CONTRACT_READ_PROPERTIES.join(", ")}. ${CONTRACT_READ_LISTS.join(", ")} are lists of words, [] when empty. capabilities is what the code lets its owner do: ${CONTRACT_CAPABILITY_WORDS.join(", ")}. For a proxy it already holds what the implementation allows. observed is what the chain shows happened: owner_minted (the contract's creator minted new supply after its creation day), issuer_froze (the issuer froze or wiped a holder), taxed_transfer (the token is proven as taxed from its transfers), traded_as_pool (the contract is the pool of a trade). standards holds words such as erc20, erc4626 and eip1967_proxy, roles words such as pair_pool, vault and router, listings ${CONTRACT_LISTING_WORDS.join(", ")}. Can is not did: a capability says the code allows it, an observed word says it happened. Zero rows means the contract is not classified yet, never that it has no capability and never that it is safe. Any other form is refused with facts_no_anchor, and its example is the read above: the address is the only key. Each word of a list is one billed element. Answer with what the bytecode allows, in plain words, never a verdict: no "scam", "rug pull", "safe" or score from these words, and upgradeable is a capability like every other. ${CONTRACT_PLAIN_WORDS}`;
85
85
  // src/mcp/flows.ts
86
- /**
87
- * graph_expand, the one dedicated tool of the local proxy, called by the Chain
88
- * Insights view (ui://chain-insights/view) when the investigator clicks. Its
89
- * _meta says visibility ["app"], so a host keeps it away from the model: the
90
- * model writes its own graph_query, and the view draws the rows by their column
91
- * names.
92
- *
93
- * Two forms, told apart by the arguments:
94
- *
95
- * - node, {network, address, in_offset?, out_offset?}: one address with up to
96
- * 250 newest senders and 250 newest receivers, a text summary and
97
- * chain-insights.flows.v1 in structuredContent. Composed from at most five
98
- * anchored graph_query reads on the topology graph: the node, then its
99
- * outgoing and its incoming FLOWED_TO, newest first, two reads a side because
100
- * a reply holds at most 200 rows.
101
- * - link, {network, from, to, day}: the transfers between two known addresses
102
- * on one UTC day, newest first, at most 50, a short text summary and
103
- * chain-insights.transfers.v1 in structuredContent. One anchored USE facts
104
- * graph_query read.
105
- * - link page, {network, from, to, day, limit, skip?, first_day?}: a page of
106
- * `limit` transfers (1 to 50) newest first, read from `day` back one UTC day
107
- * at a time, at most TRANSFERS_MAX_DAYS (a week of) reads a call, never before
108
- * first_day. The answer carries `next` ({day, skip}, or null when every
109
- * transfer back to first_day is listed) which the next call sends back as
110
- * day and skip. The view's "More transfers".
111
- * - details, {network, address, details: true}: the lifetime totals, counts,
112
- * role and labels of one address, chain-insights.address.v1, one anchored
113
- * topology read. The view fills its panel with it when the rows of a query
114
- * carried no totals.
115
- *
116
- * Every read goes through the proxy's remote client, the same path and payment
117
- * wrapping a graph_query call takes, and is billed as a graph_query. Every
118
- * argument is checked before the first read, so a refused call reaches no graph
119
- * endpoint and costs nothing.
120
- */
121
86
  const FLOWS_SCHEMA = "chain-insights.flows.v1";
122
87
  const GRAPH_EXPAND_TOOL = "graph_expand";
123
88
  const FLOWS_NETWORK = "robinhood";
@@ -235,13 +200,18 @@ function addressSummary(view) {
235
200
  const NODE_FIELDS = "b.address AS address, b.labels AS labels, b.is_exchange AS is_exchange, b.is_sanctioned AS is_sanctioned, b.is_scam AS is_scam, b.is_victim AS is_victim, b:Pool AS pool, b.total_in_usd AS total_in_usd, b.total_out_usd AS total_out_usd, b.degree_in AS degree_in, b.degree_out AS degree_out";
236
201
  const PARTY_FIELDS = NODE_FIELDS + ", f.amount_usd_sum AS usd, f.tx_count AS tx_count, " + "f.first_seen_timestamp AS first_seen, f.last_seen_timestamp AS last_seen";
237
202
  const PAGE_ORDER = " ORDER BY f.last_seen_timestamp DESC, b.address";
203
+ const LEVELS_PARTY_FIELDS = PARTY_FIELDS + ", type(f) AS link_kind, f.bought_usd_sum AS bought_usd, f.swap_count AS swap_count";
204
+ const LEVELS_PAGE_ORDER = PAGE_ORDER + ", link_kind";
238
205
  /**
239
206
  * The anchored reads of one page: the node, then the receivers, then the
240
207
  * senders. Each side asks for one row more than it shows: the extra row says
241
208
  * another page exists. A reply holds at most FLOWS_READ_ROWS rows, so a side
242
209
  * is read in chunks on the same order, each starting where the last one ends.
243
210
  */
244
- function flowsReadsFor(address, inOffset, outOffset) {
211
+ function flowsReadsFor(address, inOffset, outOffset, shape = "route") {
212
+ const levels = shape === "levels";
213
+ const fields = levels ? LEVELS_PARTY_FIELDS : PARTY_FIELDS;
214
+ const order = levels ? LEVELS_PAGE_ORDER : PAGE_ORDER;
245
215
  const side = (id, offset, match) => {
246
216
  const reads = [];
247
217
  for (let done = 0; done < 251; done += FLOWS_READ_ROWS) {
@@ -249,23 +219,19 @@ function flowsReadsFor(address, inOffset, outOffset) {
249
219
  const limit = Math.min(FLOWS_READ_ROWS, 251 - done);
250
220
  reads.push({
251
221
  id,
252
- query: `USE topology MATCH ${match} RETURN ${PARTY_FIELDS}${PAGE_ORDER}${skip > 0 ? ` SKIP ${skip}` : ""} LIMIT ${limit}`,
222
+ query: `USE topology MATCH ${match} RETURN ${fields}${order}${skip > 0 ? ` SKIP ${skip}` : ""} LIMIT ${limit}`,
253
223
  skip,
254
224
  limit
255
225
  });
256
226
  }
257
227
  return reads;
258
228
  };
259
- return [
260
- {
261
- id: "node",
262
- query: `USE topology MATCH (b:Address {address: '${address}'}) RETURN ${NODE_FIELDS} LIMIT 1`,
263
- skip: 0,
264
- limit: 1
265
- },
266
- ...side("out", outOffset, `(a:Address {address: '${address}'})-[f:FLOWED_TO]->(b:Address)`),
267
- ...side("in", inOffset, `(b:Address)-[f:FLOWED_TO]->(a:Address {address: '${address}'})`)
268
- ];
229
+ return [{
230
+ id: "node",
231
+ query: `USE topology MATCH (b:Address {address: '${address}'}) RETURN ${NODE_FIELDS} LIMIT 1`,
232
+ skip: 0,
233
+ limit: 1
234
+ }, ...levels ? [...side("out", outOffset, `(a:Address {address: '${address}'})-[f:FLOWED_TO|ROUTED_TO]->(b:Address)`), ...side("in", inOffset, `(b:Address)-[f:FLOWED_TO|ROUTED_TO]->(a:Address {address: '${address}'}) WHERE b.address <> '${address}'`)] : [...side("out", outOffset, `(a:Address {address: '${address}'})-[f:FLOWED_TO]->(b:Address)`), ...side("in", inOffset, `(b:Address)-[f:FLOWED_TO]->(a:Address {address: '${address}'})`)]];
269
235
  }
270
236
  /** The role word of an address, first match wins. */
271
237
  function flowsRole(row) {
@@ -301,10 +267,12 @@ function flowsNodeOf(row) {
301
267
  }
302
268
  function assembleFlowView(network, page, senders, receivers, truncated) {
303
269
  const center = flowsNodeOf(page.center);
270
+ const levels = page.shape === "levels";
304
271
  const cursor = {
305
272
  in_offset: page.inOffset + senders.length,
306
273
  out_offset: page.outOffset + receivers.length
307
274
  };
275
+ const remainingOf = (degree, next, more) => levels ? more ? Math.max(1, degree - next) : 0 : Math.max(0, degree - next);
308
276
  const view = {
309
277
  schema: FLOWS_SCHEMA,
310
278
  network,
@@ -313,26 +281,52 @@ function assembleFlowView(network, page, senders, receivers, truncated) {
313
281
  edges: [],
314
282
  cursor,
315
283
  truncated,
284
+ ...levels ? { link_kinds: ["FLOWED_TO", "ROUTED_TO"] } : {},
316
285
  remaining: {
317
- senders: Math.max(0, center.degree_in - cursor.in_offset),
318
- receivers: Math.max(0, center.degree_out - cursor.out_offset)
286
+ senders: remainingOf(center.degree_in, cursor.in_offset, page.senders.length > senders.length),
287
+ receivers: remainingOf(center.degree_out, cursor.out_offset, page.receivers.length > receivers.length)
319
288
  }
320
289
  };
321
290
  const seen = /* @__PURE__ */ new Set([center.address]);
291
+ const edgeAt = /* @__PURE__ */ new Map();
322
292
  const add = (row, incoming) => {
323
293
  const node = flowsNodeOf(row);
324
294
  if (!seen.has(node.address)) {
325
295
  seen.add(node.address);
326
296
  view.nodes.push(node);
327
297
  }
328
- view.edges.push({
298
+ const edge = {
329
299
  from: incoming ? node.address : center.address,
330
300
  to: incoming ? center.address : node.address,
331
301
  usd: flowsFloat(row.usd),
332
302
  tx_count: flowsInt(row.tx_count),
333
303
  first_seen_ms: flowsInt(row.first_seen),
334
304
  last_seen_ms: flowsInt(row.last_seen)
335
- });
305
+ };
306
+ if (!levels) {
307
+ view.edges.push(edge);
308
+ return;
309
+ }
310
+ const kind = row.link_kind === "ROUTED_TO" ? "ROUTED_TO" : "FLOWED_TO";
311
+ edge.link_kind = kind;
312
+ if (kind === "ROUTED_TO") {
313
+ edge.bought_usd = flowsFloat(row.bought_usd);
314
+ edge.swap_count = flowsInt(row.swap_count);
315
+ }
316
+ const key = `${edge.from}->${edge.to}`;
317
+ const kept = edgeAt.get(key);
318
+ if (!kept) {
319
+ edgeAt.set(key, edge);
320
+ view.edges.push(edge);
321
+ return;
322
+ }
323
+ kept.usd += edge.usd;
324
+ kept.tx_count += edge.tx_count;
325
+ kept.first_seen_ms = Math.min(kept.first_seen_ms, edge.first_seen_ms);
326
+ kept.last_seen_ms = Math.max(kept.last_seen_ms, edge.last_seen_ms);
327
+ kept.link_kind = [kept.link_kind, kind].filter(Boolean).sort().join(", ");
328
+ if (edge.bought_usd !== void 0) kept.bought_usd = edge.bought_usd;
329
+ if (edge.swap_count !== void 0) kept.swap_count = edge.swap_count;
336
330
  };
337
331
  for (const row of senders) add(row, true);
338
332
  for (const row of receivers) add(row, false);
@@ -416,6 +410,7 @@ function sideLines(title, parties) {
416
410
  * date and age. At most FLOWS_SUMMARY_MAX_LINES lines.
417
411
  */
418
412
  function flowsSummary(view, now) {
413
+ if (view.link_kinds) return levelsSummary(view, now);
419
414
  const nodes = new Map(view.nodes.map((node) => [node.address, node]));
420
415
  const center = nodes.get(view.center);
421
416
  const party = (address, edge) => `${address} ${roleText(nodes.get(address))}, ${formatFlowsUsd(edge.usd)} in ${edge.tx_count} tx, last seen ${formatFlowsAge(edge.last_seen_ms, now)}`;
@@ -431,6 +426,37 @@ function flowsSummary(view, now) {
431
426
  const footer = pagingLines(view, senders.length, receivers.length, center);
432
427
  return [...body, ...footer].join("\n");
433
428
  }
429
+ /** What one edge of a lane with the levels moved: funds, a swap route, or both. */
430
+ function levelsAmount(edge) {
431
+ if (edge.link_kind === "ROUTED_TO") return `swap route, ${formatFlowsUsd(edge.usd)} paid and ${formatFlowsUsd(edge.bought_usd ?? 0)} got in ${edge.swap_count ?? 0} swaps`;
432
+ if (edge.link_kind === "FLOWED_TO") return `${formatFlowsUsd(edge.usd)} in ${edge.tx_count} tx`;
433
+ return `funds and a swap route, ${formatFlowsUsd(edge.usd)} in ${edge.tx_count} tx`;
434
+ }
435
+ /**
436
+ * The text of a node answer on a lane with the levels: the same lines, each
437
+ * counterparty saying whether it is funds or a swap route, and the address's
438
+ * swap for itself (its self link) on a line of its own.
439
+ */
440
+ function levelsSummary(view, now) {
441
+ const nodes = new Map(view.nodes.map((node) => [node.address, node]));
442
+ const center = nodes.get(view.center);
443
+ const party = (address, edge) => `${address} ${roleText(nodes.get(address))}, ${levelsAmount(edge)}, last seen ${formatFlowsAge(edge.last_seen_ms, now)}`;
444
+ const senders = [];
445
+ const receivers = [];
446
+ const self = [];
447
+ for (const edge of view.edges) if (edge.from === view.center && edge.to === view.center) self.push(`Swapped for itself: ${levelsAmount(edge)}, last seen ${formatFlowsAge(edge.last_seen_ms, now)}.`);
448
+ else if (edge.to === view.center) senders.push(party(edge.from, edge));
449
+ else receivers.push(party(edge.to, edge));
450
+ const body = [
451
+ `Money flows of ${view.center} on ${view.network}: ${roleText(center)}; lifetime ${formatFlowsUsd(center?.total_in_usd ?? 0)} in, ${formatFlowsUsd(center?.total_out_usd ?? 0)} out in funds between addresses; ${center?.degree_in ?? 0} senders and ${center?.degree_out ?? 0} receivers of funds, swap routes not counted.`,
452
+ ...self,
453
+ ...sideLines("Recent senders and payers through a swap", senders),
454
+ ...sideLines("Recent receivers and receivers through a swap", receivers)
455
+ ].slice(0, 18);
456
+ const where = `Showing ${senders.length} senders and ${receivers.length} receivers on this page, funds and swap routes together, newest first.`;
457
+ const footer = view.truncated || (view.remaining?.senders ?? 0) + (view.remaining?.receivers ?? 0) > 0 ? [where, "More senders and receivers load when an address in the picture is double-clicked."] : [where];
458
+ return [...body, ...footer].join("\n");
459
+ }
434
460
  /** Where this page sits, and that the picture loads the rest when an address is clicked. */
435
461
  function pagingLines(view, shownSenders, shownReceivers, center) {
436
462
  const totalIn = center?.degree_in ?? 0;
@@ -588,13 +614,19 @@ function checkOffset(value) {
588
614
  async function runNode(deps, network, address, inOffset, outOffset) {
589
615
  const unavailable = deps.unavailable?.();
590
616
  if (unavailable) return errorResult$1(unavailable);
617
+ let shape = "route";
618
+ if (deps.linkShape) try {
619
+ shape = await deps.linkShape(network);
620
+ } catch {
621
+ shape = "route";
622
+ }
591
623
  const rows = {
592
624
  node: [],
593
625
  out: [],
594
626
  in: []
595
627
  };
596
628
  const ended = /* @__PURE__ */ new Set();
597
- for (const read of flowsReadsFor(address, inOffset, outOffset)) {
629
+ for (const read of flowsReadsFor(address, inOffset, outOffset, shape)) {
598
630
  if (ended.has(read.id)) continue;
599
631
  let answer;
600
632
  try {
@@ -617,7 +649,8 @@ async function runNode(deps, network, address, inOffset, outOffset) {
617
649
  senders: rows.in,
618
650
  receivers: rows.out,
619
651
  inOffset,
620
- outOffset
652
+ outOffset,
653
+ ...shape === "levels" ? { shape } : {}
621
654
  });
622
655
  return {
623
656
  content: [{
@@ -840,7 +873,7 @@ async function handleGraphExpand(args, deps) {
840
873
  return runNode(deps, network, address, inOffset, outOffset);
841
874
  }
842
875
  const GRAPH_EXPAND_TITLE = "Expand a node or a link in the picture";
843
- const GRAPH_EXPAND_DESCRIPTION = "Expand an open Chain Insights picture. Called by the view when the investigator clicks, never by the model. A node, {network, address, in_offset?, out_offset?}, loads the newest senders and receivers of one address (up to 250 a side, from the offsets); billed as at most five graph_query topology reads. A link, {network, from, to, day}, lists the transfers between two addresses on one UTC day (YYYY-MM-DD), newest first, at most 50; billed as one graph_query facts read. A link page, {network, from, to, day, limit, skip?, first_day?}, lists `limit` (1-50) transfers from `day` back across days, newest first, and answers a `next` cursor ({day, skip}) while older ones remain; billed as at most seven facts reads (a week). Details, {network, address, details: true}, answer the lifetime totals, counts, role and labels of one address; billed as one topology read. Read-only; an argument refused before a read costs nothing.";
876
+ const GRAPH_EXPAND_DESCRIPTION = "Expand an open Chain Insights picture. Called by the view when the investigator clicks, never by the model. A node, {network, address, in_offset?, out_offset?}, loads the newest senders and receivers of one address (up to 250 a side, from the offsets); on a lane whose money family lists ROUTED_TO a side holds its swap routes too, each one step that changes the asset with link_kind ROUTED_TO, never a router or a pool as a holder; billed as at most five graph_query topology reads. A link, {network, from, to, day}, lists the transfers between two addresses on one UTC day (YYYY-MM-DD), newest first, at most 50; billed as one graph_query facts read. A link page, {network, from, to, day, limit, skip?, first_day?}, lists `limit` (1-50) transfers from `day` back across days, newest first, and answers a `next` cursor ({day, skip}) while older ones remain; billed as at most seven facts reads (a week). Details, {network, address, details: true}, answer the lifetime totals, counts, role and labels of one address; billed as one topology read. Read-only; an argument refused before a read costs nothing.";
844
877
  // src/mcp/graph-schema-cache.ts
845
878
  /** How long a schema with a failed read stays fresh. */
846
879
  const PARTIAL_SCHEMA_TTL_MS = 6e5;
@@ -8,15 +8,15 @@ const require_subscription_status = require("./subscription-status-w4zI2KCK.cjs"
8
8
  const require_rules = require("./rules-BKwfmNsJ.cjs");
9
9
  const require_capabilities = require("./capabilities-DgNUpRa-.cjs");
10
10
  const require_layer_routing = require("./layer-routing-D9KbTKUj.cjs");
11
- const require_graph_schema = require("./graph-schema-DNvmR6iP.cjs");
11
+ const require_graph_schema = require("./graph-schema-u0TipQPl.cjs");
12
12
  const require_action_log = require("./action-log-WMW6xFMx.cjs");
13
13
  const require_answer_hint = require("./answer-hint-BlYEBq_Y.cjs");
14
14
  const require_dex_tool = require("./dex-tool-BDERiT5t.cjs");
15
15
  const require_dex_registry = require("./dex-registry-BhGJUG9_.cjs");
16
16
  const require_token_lookup = require("./token-lookup-D-5GBEwF.cjs");
17
- const require_deployer_screen = require("./deployer-screen-BomgSBcq.cjs");
17
+ const require_deployer_screen = require("./deployer-screen-DQw3pC0E.cjs");
18
18
  const require_exchange_tool = require("./exchange-tool-B2SMeC5f.cjs");
19
- const require_exchange_deposit_check = require("./exchange-deposit-check-5e5UwqTn.cjs");
19
+ const require_exchange_deposit_check = require("./exchange-deposit-check-B9_fPt3E.cjs");
20
20
  const require_exchange_registry = require("./exchange-registry-CT0rRW__.cjs");
21
21
  let node_url = require("node:url");
22
22
  let node_path = require("node:path");
@@ -1586,6 +1586,7 @@ async function createProxy() {
1586
1586
  openWorldHint: true
1587
1587
  }
1588
1588
  }, async (args) => require_graph_schema.handleMetaSchema(args, schemaDependencies));
1589
+ const linkShape = require_capabilities.keptSwapLinkShape(async (network) => remoteToolNames.has("network_capabilities") ? require_capabilities.readSwapLinkShape(remoteClient, network) : void 0, LINK_SHAPE_TTL_MS);
1589
1590
  const dexDependencies = {
1590
1591
  loadRegistry: (network) => require_dex_registry.loadRegistry(network, { log: (line) => {
1591
1592
  logger.info("dex_registry.fault", { line });
@@ -1606,7 +1607,7 @@ async function createProxy() {
1606
1607
  return remoteConnected ? void 0 : `${remoteUnavailableMessage ?? `Chain Insights Graph is not connected at ${graphMcpEndpoint}`}.`;
1607
1608
  },
1608
1609
  describeFailure: (err) => remoteCallFailureText("graph_query_batch", err),
1609
- linkShape: require_capabilities.keptSwapLinkShape(async (network) => remoteToolNames.has("network_capabilities") ? require_capabilities.readSwapLinkShape(remoteClient, network) : void 0, LINK_SHAPE_TTL_MS)
1610
+ linkShape
1610
1611
  };
1611
1612
  server.registerTool(require_dex_tool.META_DEX_LOOKUP_TOOL, {
1612
1613
  title: require_dex_tool.META_DEX_LOOKUP_TITLE,
@@ -1651,7 +1652,10 @@ async function createProxy() {
1651
1652
  address: zod.string().min(1).describe("The token contract or the wallet to screen: 0x plus 40 hex characters, any case. A ticker is not an address: call meta_token_lookup first.")
1652
1653
  },
1653
1654
  annotations: require_deployer_screen.AML_DEPLOYER_SCREEN_ANNOTATIONS
1654
- }, async (args) => require_deployer_screen.handleAmlDeployerScreen(args, tokenDependencies));
1655
+ }, async (args) => require_deployer_screen.handleAmlDeployerScreen(args, {
1656
+ ...tokenDependencies,
1657
+ linkShape
1658
+ }));
1655
1659
  const loadExchanges = (network) => require_exchange_registry.loadExchangeRegistry(network, { log: (line) => {
1656
1660
  logger.info("exchange_registry.fault", { line });
1657
1661
  } });
@@ -1816,6 +1820,7 @@ async function createProxy() {
1816
1820
  },
1817
1821
  describeFailure: (err) => remoteCallFailureText("graph_query", err),
1818
1822
  refusal: (err) => clickRefusal("graph_query", err),
1823
+ linkShape,
1819
1824
  unavailable: () => remoteConnected ? void 0 : `${remoteUnavailableMessage ?? `Chain Insights Graph is not connected at ${graphMcpEndpoint}`}. Restart the Chain Insights MCP proxy after the endpoint is reachable.`
1820
1825
  };
1821
1826
  const runGraphExpand = (args) => require_graph_schema.handleGraphExpand(args, flowsDependencies);
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-proxy.d.cts","names":[],"sources":["../src/mcp/proxy.ts"],"mappings":";qBA8Ga,kBAAgB;qBAkBhB,2BAAyB;;qBAEzB;qBAUA;qBACA;;;;;wBAyBG;YAkBJ;wBAEI,oBAAoB,MAAK,OAAO,aAA2B;qBAiB9D;qBAIA;qBAIA;qBAKA;qBAGA,gCAAgC;KA4BxC,iBAAiB,eAAe,EAAE;qBAgB1B;wBA4GG,2BAA2B,mBAAmB;;;;;;;;wBAomBxC,eAAe"}
1
+ {"version":3,"file":"mcp-proxy.d.cts","names":[],"sources":["../src/mcp/proxy.ts"],"mappings":";qBA8Ga,kBAAgB;qBAkBhB,2BAAyB;;qBAEzB;qBAUA;qBACA;;;;;wBAyBG;YAkBJ;wBAEI,oBAAoB,MAAK,OAAO,aAA2B;qBAiB9D;qBAIA;qBAIA;qBAKA;qBAGA,gCAAgC;KA6BxC,iBAAiB,eAAe,EAAE;qBAgB1B;wBA4GG,2BAA2B,mBAAmB;;;;;;;;wBAomBxC,eAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-proxy.d.mts","names":[],"sources":["../src/mcp/proxy.ts"],"mappings":";qBA8Ga,kBAAgB;qBAkBhB,2BAAyB;;qBAEzB;qBAUA;qBACA;;;;;wBAyBG;YAkBJ;wBAEI,oBAAoB,MAAK,OAAO,aAA2B;qBAiB9D;qBAIA;qBAIA;qBAKA;qBAGA,gCAAgC;KA4BxC,iBAAiB,eAAe,EAAE;qBAgB1B;wBA4GG,2BAA2B,mBAAmB;;;;;;;;wBAomBxC,eAAe"}
1
+ {"version":3,"file":"mcp-proxy.d.mts","names":[],"sources":["../src/mcp/proxy.ts"],"mappings":";qBA8Ga,kBAAgB;qBAkBhB,2BAAyB;;qBAEzB;qBAUA;qBACA;;;;;wBAyBG;YAkBJ;wBAEI,oBAAoB,MAAK,OAAO,aAA2B;qBAiB9D;qBAIA;qBAIA;qBAKA;qBAGA,gCAAgC;KA6BxC,iBAAiB,eAAe,EAAE;qBAgB1B;wBA4GG,2BAA2B,mBAAmB;;;;;;;;wBAomBxC,eAAe"}
@@ -6,15 +6,15 @@ import { i as unavailableSubscriptionStatus, n as subscriptionStatusNeedsWallet,
6
6
  import { r as SUBSCRIPTION_TOPUP_TOOL, t as META_SUBSCRIPTION_STATUS_DESCRIPTION } from "./rules-B3w9pCeQ.mjs";
7
7
  import { a as readSwapLinkShape, i as mirrorGraphNetworkCapabilities, r as keptSwapLinkShape } from "./capabilities-BniH7lxt.mjs";
8
8
  import { a as routingHintLines, i as routingHead, n as ROUTING_NOT_SERVED, r as levelLines } from "./layer-routing-CM99KYhc.mjs";
9
- import { c as GRAPH_EXPAND_DESCRIPTION, d as TRANSFERS_MAX, f as handleGraphExpand, i as META_SCHEMA_TITLE, l as GRAPH_EXPAND_TITLE, m as GRAPH_QUERY_CONTRACT_READ_SENTENCE, n as GraphSchemaError, o as handleMetaSchema, p as CONTRACT_READ_HINT, r as META_SCHEMA_DESCRIPTION, s as FLOWS_MAX_OFFSET, u as GRAPH_EXPAND_TOOL } from "./graph-schema-0eYvShs7.mjs";
9
+ import { c as GRAPH_EXPAND_DESCRIPTION, d as TRANSFERS_MAX, f as handleGraphExpand, i as META_SCHEMA_TITLE, l as GRAPH_EXPAND_TITLE, m as GRAPH_QUERY_CONTRACT_READ_SENTENCE, n as GraphSchemaError, o as handleMetaSchema, p as CONTRACT_READ_HINT, r as META_SCHEMA_DESCRIPTION, s as FLOWS_MAX_OFFSET, u as GRAPH_EXPAND_TOOL } from "./graph-schema-BZTzy0XV.mjs";
10
10
  import { r as appendActionLog, t as actionLogSignalsFromResult } from "./action-log-Byv9Ln_6.mjs";
11
11
  import { n as withAnswerHintResult } from "./answer-hint-vOE1O6Lf.mjs";
12
12
  import { i as META_DEX_LOOKUP_TOOL, n as META_DEX_LOOKUP_DESCRIPTION, o as handleMetaDexLookup, r as META_DEX_LOOKUP_TITLE, t as META_DEX_LOOKUP_ANNOTATIONS } from "./dex-tool-25510SNo.mjs";
13
13
  import { c as loadRegistry } from "./dex-registry-BY67f4Ul.mjs";
14
14
  import { a as SYMBOL_MAX, i as META_TOKEN_LOOKUP_TOOL, n as META_TOKEN_LOOKUP_DESCRIPTION, o as handleMetaTokenLookup, r as META_TOKEN_LOOKUP_TITLE, t as META_TOKEN_LOOKUP_ANNOTATIONS } from "./token-lookup-QpIv77P2.mjs";
15
- import { i as AML_DEPLOYER_SCREEN_TOOL, n as AML_DEPLOYER_SCREEN_DESCRIPTION, o as handleAmlDeployerScreen, r as AML_DEPLOYER_SCREEN_TITLE, t as AML_DEPLOYER_SCREEN_ANNOTATIONS } from "./deployer-screen-ByQBZEsg.mjs";
15
+ import { i as AML_DEPLOYER_SCREEN_TOOL, n as AML_DEPLOYER_SCREEN_DESCRIPTION, o as handleAmlDeployerScreen, r as AML_DEPLOYER_SCREEN_TITLE, t as AML_DEPLOYER_SCREEN_ANNOTATIONS } from "./deployer-screen-e3IbG1Y_.mjs";
16
16
  import { a as META_EXCHANGE_LOOKUP_TOOL, i as META_EXCHANGE_LOOKUP_TITLE, n as META_EXCHANGE_LOOKUP_ANNOTATIONS, r as META_EXCHANGE_LOOKUP_DESCRIPTION, s as handleMetaExchangeLookup } from "./exchange-tool-Dc46SJ49.mjs";
17
- import { i as AML_EXCHANGE_DEPOSIT_CHECK_TOOL, n as AML_EXCHANGE_DEPOSIT_CHECK_DESCRIPTION, o as handleAmlExchangeDepositCheck, r as AML_EXCHANGE_DEPOSIT_CHECK_TITLE, t as AML_EXCHANGE_DEPOSIT_CHECK_ANNOTATIONS } from "./exchange-deposit-check-DPU8W3vK.mjs";
17
+ import { i as AML_EXCHANGE_DEPOSIT_CHECK_TOOL, n as AML_EXCHANGE_DEPOSIT_CHECK_DESCRIPTION, o as handleAmlExchangeDepositCheck, r as AML_EXCHANGE_DEPOSIT_CHECK_TITLE, t as AML_EXCHANGE_DEPOSIT_CHECK_ANNOTATIONS } from "./exchange-deposit-check-B1yebGBt.mjs";
18
18
  import { i as loadExchangeRegistry } from "./exchange-registry-CoLgHw6d.mjs";
19
19
  import { fileURLToPath } from "node:url";
20
20
  import path from "node:path";
@@ -1582,6 +1582,7 @@ async function createProxy() {
1582
1582
  openWorldHint: true
1583
1583
  }
1584
1584
  }, async (args) => handleMetaSchema(args, schemaDependencies));
1585
+ const linkShape = keptSwapLinkShape(async (network) => remoteToolNames.has("network_capabilities") ? readSwapLinkShape(remoteClient, network) : void 0, LINK_SHAPE_TTL_MS);
1585
1586
  const dexDependencies = {
1586
1587
  loadRegistry: (network) => loadRegistry(network, { log: (line) => {
1587
1588
  logger.info("dex_registry.fault", { line });
@@ -1602,7 +1603,7 @@ async function createProxy() {
1602
1603
  return remoteConnected ? void 0 : `${remoteUnavailableMessage ?? `Chain Insights Graph is not connected at ${graphMcpEndpoint}`}.`;
1603
1604
  },
1604
1605
  describeFailure: (err) => remoteCallFailureText("graph_query_batch", err),
1605
- linkShape: keptSwapLinkShape(async (network) => remoteToolNames.has("network_capabilities") ? readSwapLinkShape(remoteClient, network) : void 0, LINK_SHAPE_TTL_MS)
1606
+ linkShape
1606
1607
  };
1607
1608
  server.registerTool(META_DEX_LOOKUP_TOOL, {
1608
1609
  title: META_DEX_LOOKUP_TITLE,
@@ -1647,7 +1648,10 @@ async function createProxy() {
1647
1648
  address: z.string().min(1).describe("The token contract or the wallet to screen: 0x plus 40 hex characters, any case. A ticker is not an address: call meta_token_lookup first.")
1648
1649
  },
1649
1650
  annotations: AML_DEPLOYER_SCREEN_ANNOTATIONS
1650
- }, async (args) => handleAmlDeployerScreen(args, tokenDependencies));
1651
+ }, async (args) => handleAmlDeployerScreen(args, {
1652
+ ...tokenDependencies,
1653
+ linkShape
1654
+ }));
1651
1655
  const loadExchanges = (network) => loadExchangeRegistry(network, { log: (line) => {
1652
1656
  logger.info("exchange_registry.fault", { line });
1653
1657
  } });
@@ -1812,6 +1816,7 @@ async function createProxy() {
1812
1816
  },
1813
1817
  describeFailure: (err) => remoteCallFailureText("graph_query", err),
1814
1818
  refusal: (err) => clickRefusal("graph_query", err),
1819
+ linkShape,
1815
1820
  unavailable: () => remoteConnected ? void 0 : `${remoteUnavailableMessage ?? `Chain Insights Graph is not connected at ${graphMcpEndpoint}`}. Restart the Chain Insights MCP proxy after the endpoint is reachable.`
1816
1821
  };
1817
1822
  const runGraphExpand = (args) => handleGraphExpand(args, flowsDependencies);