chain-insights 0.22.2 → 0.23.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 (89) hide show
  1. package/README.md +29 -50
  2. package/dist/cli.cjs +21 -83
  3. package/dist/cli.mjs +21 -83
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/{config-BVFf3v8-.cjs → config-B542AM4w.cjs} +2 -3
  6. package/dist/{config-CnNMdt4M.mjs → config-DbbPiGk0.mjs} +2 -3
  7. package/dist/{config-CnNMdt4M.mjs.map → config-DbbPiGk0.mjs.map} +1 -1
  8. package/dist/html-generator-BCDtYcGs.mjs +16 -0
  9. package/dist/{html-generator-D2BDzLED.mjs.map → html-generator-BCDtYcGs.mjs.map} +1 -1
  10. package/dist/html-generator-DFwMRWN3.cjs +16 -0
  11. package/dist/index.cjs +2 -8
  12. package/dist/index.d.cts +1 -99
  13. package/dist/index.d.cts.map +1 -1
  14. package/dist/index.d.mts +1 -99
  15. package/dist/index.d.mts.map +1 -1
  16. package/dist/index.mjs +3 -6
  17. package/dist/mcp-proxy.cjs +35 -156
  18. package/dist/mcp-proxy.d.cts.map +1 -1
  19. package/dist/mcp-proxy.d.mts.map +1 -1
  20. package/dist/mcp-proxy.mjs +35 -156
  21. package/dist/mcp-proxy.mjs.map +1 -1
  22. package/dist/{public-tools-BFs_7U_Z.cjs → public-tools-Bou25cki.cjs} +153 -5
  23. package/dist/{public-tools-BjqZGGAC.mjs → public-tools-CpOLkME5.mjs} +152 -4
  24. package/dist/public-tools-CpOLkME5.mjs.map +1 -0
  25. package/dist/{schema-DOJA2nNi.mjs → schema-B0OuHW_l.mjs} +64 -5
  26. package/dist/schema-B0OuHW_l.mjs.map +1 -0
  27. package/dist/{schema-BpeV3xDV.cjs → schema-CtFWYoJz.cjs} +72 -7
  28. package/dist/{tool-visibility-DZBAP62b.cjs → tool-visibility-C8F9Yoxy.cjs} +1 -2
  29. package/dist/{tool-visibility-C0ALejXI.mjs → tool-visibility-CXbwfKhv.mjs} +2 -3
  30. package/dist/tool-visibility-CXbwfKhv.mjs.map +1 -0
  31. package/dist/{topup-server-rqI7bqem.mjs → topup-server-BLdF1SFQ.mjs} +2 -2
  32. package/dist/topup-server-BLdF1SFQ.mjs.map +1 -0
  33. package/dist/{topup-server-DAqmAuu1.cjs → topup-server-YN3iHrHW.cjs} +1 -1
  34. package/dist/{update-CJUfGCxs.mjs → update-MsoEFbhn.mjs} +2 -36
  35. package/dist/{update-CJUfGCxs.mjs.map → update-MsoEFbhn.mjs.map} +1 -1
  36. package/dist/{update-BJoXYucO.cjs → update-RKd0UW90.cjs} +0 -35
  37. package/docs/architecture.md +16 -46
  38. package/docs/contributing.md +0 -3
  39. package/docs/development.md +3 -5
  40. package/docs/graph-tools.md +4 -29
  41. package/docs/mcp-proxy.md +10 -36
  42. package/docs/stability.md +0 -12
  43. package/package.json +3 -4
  44. package/skills/chain-insights-address-risk/SKILL.md +0 -1
  45. package/dist/app-7NRCqx_Q.mjs +0 -140
  46. package/dist/app-7NRCqx_Q.mjs.map +0 -1
  47. package/dist/app-l9JE6bt3.cjs +0 -145
  48. package/dist/artifact-server-CH-asxF5.cjs +0 -47
  49. package/dist/artifact-server-DoxJr0z8.mjs +0 -49
  50. package/dist/artifact-server-DoxJr0z8.mjs.map +0 -1
  51. package/dist/graph-normalizer-B2Q2lgVy.cjs +0 -130
  52. package/dist/graph-normalizer-BA3Rbd6l.mjs +0 -127
  53. package/dist/graph-normalizer-BA3Rbd6l.mjs.map +0 -1
  54. package/dist/graph-reports-B6yoYbPq.mjs +0 -63
  55. package/dist/graph-reports-B6yoYbPq.mjs.map +0 -1
  56. package/dist/graph-reports-_gqzxvvs.cjs +0 -64
  57. package/dist/html-generator-B9f_GIi2.cjs +0 -86
  58. package/dist/html-generator-D2BDzLED.mjs +0 -70
  59. package/dist/init-Djhml4ih.mjs +0 -319
  60. package/dist/init-Djhml4ih.mjs.map +0 -1
  61. package/dist/init-DvrKxK15.cjs +0 -319
  62. package/dist/limits-D3Mn-gig.mjs +0 -94
  63. package/dist/limits-D3Mn-gig.mjs.map +0 -1
  64. package/dist/limits-km3pmmL3.cjs +0 -115
  65. package/dist/mcp-endpoint-BIWrUOFG.cjs +0 -56
  66. package/dist/mcp-endpoint-DbWtLcba.mjs +0 -41
  67. package/dist/mcp-endpoint-DbWtLcba.mjs.map +0 -1
  68. package/dist/output-root-BK4pdjyz.mjs +0 -36
  69. package/dist/output-root-BK4pdjyz.mjs.map +0 -1
  70. package/dist/output-root-BewoQaTx.cjs +0 -46
  71. package/dist/public-tools-BjqZGGAC.mjs.map +0 -1
  72. package/dist/resolve-port-CbaEoODz.cjs +0 -18
  73. package/dist/resolve-port-DxPK7Ipx.mjs +0 -20
  74. package/dist/resolve-port-DxPK7Ipx.mjs.map +0 -1
  75. package/dist/schema-DOJA2nNi.mjs.map +0 -1
  76. package/dist/server-CmvzYu7v.cjs +0 -55
  77. package/dist/server-mDSRgk1X.mjs +0 -46
  78. package/dist/server-mDSRgk1X.mjs.map +0 -1
  79. package/dist/templates/graph.html +0 -1450
  80. package/dist/tool-visibility-C0ALejXI.mjs.map +0 -1
  81. package/dist/topup-server-rqI7bqem.mjs.map +0 -1
  82. package/dist/viz-BJ_kyRjI.cjs +0 -217
  83. package/dist/viz-Uh_EF-qB.mjs +0 -206
  84. package/dist/viz-Uh_EF-qB.mjs.map +0 -1
  85. package/docs/images/graph-mcp-iframe.png +0 -0
  86. package/docs/images/graph-visualization.png +0 -0
  87. package/docs/images/quickstart-demo.svg +0 -1
  88. package/docs/investigation-workspaces.md +0 -108
  89. package/docs/search-limits.md +0 -73
package/dist/cli.mjs CHANGED
@@ -48,7 +48,7 @@ function runInstaller(flag) {
48
48
  }
49
49
  }
50
50
  async function withGraphMcpClient(name, fn) {
51
- const { loadConfig } = await import("./config-CnNMdt4M.mjs").then((n) => n.t);
51
+ const { loadConfig } = await import("./config-DbbPiGk0.mjs").then((n) => n.t);
52
52
  const config = await loadConfig();
53
53
  const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } = await import("./client-D4aM4bzP.mjs").then((n) => n.r);
54
54
  const paymentFetch = await createConfiguredGraphMcpFetch(config);
@@ -68,7 +68,7 @@ async function withGraphMcpClient(name, fn) {
68
68
  }
69
69
  }
70
70
  async function printNetworkCapabilities(opts) {
71
- const { loadConfig } = await import("./config-CnNMdt4M.mjs").then((n) => n.t);
71
+ const { loadConfig } = await import("./config-DbbPiGk0.mjs").then((n) => n.t);
72
72
  const { fetchNetworkCapabilities, formatNetworkCapabilities } = await import("./capabilities-BZI6qROg.mjs").then((n) => n.t);
73
73
  const document = await fetchNetworkCapabilities(await loadConfig());
74
74
  if (opts.json) console.log(JSON.stringify(document, null, 2));
@@ -82,37 +82,17 @@ program.command("networks").alias("network").description("List supported graph n
82
82
  process.exit(1);
83
83
  }
84
84
  });
85
- program.command("serve").description("Start local visualization server").option("-p, --port <number>", "Port to bind (defaults to the configured serverPort)").action(async (opts) => {
86
- try {
87
- const { requireWorkspaceRoot } = await import("./output-root-BK4pdjyz.mjs").then((n) => n.t);
88
- const workspaceRoot = requireWorkspaceRoot();
89
- const { loadConfig } = await import("./config-CnNMdt4M.mjs").then((n) => n.t);
90
- const { resolveServerPort } = await import("./resolve-port-DxPK7Ipx.mjs");
91
- const config = await loadConfig();
92
- const port = resolveServerPort(opts.port, config.serverPort);
93
- const { startServer } = await import("./server-mDSRgk1X.mjs").then((n) => n.t);
94
- console.log(`Workspace: ${workspaceRoot}`);
95
- startServer(port);
96
- } catch (err) {
97
- console.error(err.message);
98
- process.exit(1);
99
- }
100
- });
101
85
  program.command("status").description("Show toolkit status and configuration").action(async () => {
102
- const { loadConfig } = await import("./config-CnNMdt4M.mjs").then((n) => n.t);
103
- const { findActiveWorkspace, activeDataDir } = await import("./active-BQopLul8.mjs").then((n) => n.t);
86
+ const { loadConfig } = await import("./config-DbbPiGk0.mjs").then((n) => n.t);
104
87
  const config = await loadConfig();
105
- const workspace = findActiveWorkspace();
106
88
  const graphMcpStatus = config.graphMcpMode === "debug" && config.graphMcpAuthToken?.trim() ? "bearer access mode" : `${config.graphMcpMode} mode`;
107
- console.log("Config: ", activeDataDir(config.dataDir));
108
- if (workspace) console.log("Workspace:", workspace.root);
109
- console.log("Server: ", `http://127.0.0.1:${config.serverPort}`);
89
+ console.log("Config: ", config.dataDir);
110
90
  console.log("Chain Insights Graph:", graphMcpStatus);
111
91
  console.log("Graph endpoint:", config.graphMcpEndpoint);
112
92
  });
113
93
  program.command("update").description("Check npmjs for a newer Chain Insights release and update this CLI").option("--check", "Only check for a newer release").option("--dry-run", "Print the update command without running it").action(async (opts) => {
114
94
  try {
115
- const { checkForUpdate, runPackageUpdate } = await import("./update-CJUfGCxs.mjs");
95
+ const { checkForUpdate, runPackageUpdate } = await import("./update-MsoEFbhn.mjs");
116
96
  const result = await checkForUpdate();
117
97
  if (result.error) throw new Error(`Could not check npmjs for updates: ${result.error}`);
118
98
  if (!result.updateAvailable || !result.latestVersion) {
@@ -137,7 +117,7 @@ program.command("update").description("Check npmjs for a newer Chain Insights re
137
117
  });
138
118
  program.command("debug").description("Configure Chain Insights Graph debug mode").addCommand(new Command("on").description("Enable Chain Insights Graph debug mode without x402 payments").requiredOption("--token <token>", "Debug bearer token").option("--endpoint <url>", "Chain Insights Graph endpoint").action(async (opts) => {
139
119
  try {
140
- const { saveConfig } = await import("./config-CnNMdt4M.mjs").then((n) => n.t);
120
+ const { saveConfig } = await import("./config-DbbPiGk0.mjs").then((n) => n.t);
141
121
  await saveConfig({
142
122
  graphMcpMode: "debug",
143
123
  graphMcpAuthToken: opts.token,
@@ -152,7 +132,7 @@ program.command("debug").description("Configure Chain Insights Graph debug mode"
152
132
  }
153
133
  })).addCommand(new Command("off").description("Disable Chain Insights Graph debug mode and use paid x402 calls").action(async () => {
154
134
  try {
155
- const { saveConfig } = await import("./config-CnNMdt4M.mjs").then((n) => n.t);
135
+ const { saveConfig } = await import("./config-DbbPiGk0.mjs").then((n) => n.t);
156
136
  await saveConfig({
157
137
  graphMcpMode: "paid",
158
138
  graphMcpAuthToken: ""
@@ -165,7 +145,7 @@ program.command("debug").description("Configure Chain Insights Graph debug mode"
165
145
  }
166
146
  })).addCommand(new Command("status").description("Show Chain Insights Graph payment/debug mode").action(async () => {
167
147
  try {
168
- const { loadConfig } = await import("./config-CnNMdt4M.mjs").then((n) => n.t);
148
+ const { loadConfig } = await import("./config-DbbPiGk0.mjs").then((n) => n.t);
169
149
  const config = await loadConfig();
170
150
  console.log(`Chain Insights Graph mode: ${config.graphMcpMode}`);
171
151
  console.log(`Graph endpoint: ${config.graphMcpEndpoint}`);
@@ -180,7 +160,7 @@ program.command("access-key").description("Configure Chain Insights Graph test a
180
160
  try {
181
161
  const normalizedKey = key.trim();
182
162
  if (!normalizedKey) throw new Error("Test access key is required");
183
- const { saveConfig } = await import("./config-CnNMdt4M.mjs").then((n) => n.t);
163
+ const { saveConfig } = await import("./config-DbbPiGk0.mjs").then((n) => n.t);
184
164
  await saveConfig({
185
165
  graphMcpMode: "debug",
186
166
  graphMcpAuthToken: normalizedKey,
@@ -195,7 +175,7 @@ program.command("access-key").description("Configure Chain Insights Graph test a
195
175
  }
196
176
  })).addCommand(new Command("clear").description("Remove the Chain Insights Graph test access key and use paid x402 calls").action(async () => {
197
177
  try {
198
- const { saveConfig } = await import("./config-CnNMdt4M.mjs").then((n) => n.t);
178
+ const { saveConfig } = await import("./config-DbbPiGk0.mjs").then((n) => n.t);
199
179
  await saveConfig({
200
180
  graphMcpMode: "paid",
201
181
  graphMcpAuthToken: ""
@@ -208,7 +188,7 @@ program.command("access-key").description("Configure Chain Insights Graph test a
208
188
  }
209
189
  })).addCommand(new Command("status").description("Show Chain Insights Graph test access key status").action(async () => {
210
190
  try {
211
- const { loadConfig } = await import("./config-CnNMdt4M.mjs").then((n) => n.t);
191
+ const { loadConfig } = await import("./config-DbbPiGk0.mjs").then((n) => n.t);
212
192
  const config = await loadConfig();
213
193
  console.log(`Graph endpoint: ${config.graphMcpEndpoint}`);
214
194
  console.log(`Access key: ${config.graphMcpAuthToken?.trim() ? "configured" : "not configured"}`);
@@ -218,22 +198,6 @@ program.command("access-key").description("Configure Chain Insights Graph test a
218
198
  process.exit(1);
219
199
  }
220
200
  }));
221
- program.command("init").description("Initialize an investigation workspace").argument("[dir]", "Workspace directory to initialize", ".").option("--force", "Overwrite existing workspace files").action(async (dir, opts) => {
222
- try {
223
- const { initWorkspace } = await import("./init-Djhml4ih.mjs");
224
- const result = await initWorkspace({
225
- targetDir: dir,
226
- force: opts.force
227
- });
228
- console.log(`Workspace initialized: ${result.workspaceRoot}`);
229
- console.log(`Files written: ${result.filesWritten.length}`);
230
- const { maybePromptForUpdate } = await import("./update-CJUfGCxs.mjs");
231
- await maybePromptForUpdate();
232
- } catch (err) {
233
- console.error(err.message);
234
- process.exit(1);
235
- }
236
- });
237
201
  program.command("setup").description("Configure external MCP clients").addCommand(new Command("claude-code").alias("claude").description("Install Claude Code skills and register the MCP proxy").action(() => {
238
202
  runInstaller("--claude");
239
203
  })).addCommand(new Command("codex").description("Install Codex skills and register the MCP proxy").action(() => {
@@ -242,8 +206,8 @@ program.command("setup").description("Configure external MCP clients").addComman
242
206
  runInstaller("--hermes");
243
207
  }));
244
208
  program.command("config").description("Read or write configuration values").addCommand(new Command("get").argument("<key>", "Config key to read").action(async (key) => {
245
- const { loadConfig } = await import("./config-CnNMdt4M.mjs").then((n) => n.t);
246
- const { CONFIG_KEYS } = await import("./schema-DOJA2nNi.mjs").then((n) => n.r);
209
+ const { loadConfig } = await import("./config-DbbPiGk0.mjs").then((n) => n.t);
210
+ const { CONFIG_KEYS } = await import("./schema-B0OuHW_l.mjs").then((n) => n.r);
247
211
  if (!CONFIG_KEYS.includes(key)) {
248
212
  console.error(`Unknown config key: ${key}`);
249
213
  process.exit(1);
@@ -263,8 +227,8 @@ program.command("config").description("Read or write configuration values").addC
263
227
  }
264
228
  return;
265
229
  }
266
- const { loadConfig, saveConfig } = await import("./config-CnNMdt4M.mjs").then((n) => n.t);
267
- const { CONFIG_KEYS, DEFAULT_CONFIG } = await import("./schema-DOJA2nNi.mjs").then((n) => n.r);
230
+ const { loadConfig, saveConfig } = await import("./config-DbbPiGk0.mjs").then((n) => n.t);
231
+ const { CONFIG_KEYS, DEFAULT_CONFIG } = await import("./schema-B0OuHW_l.mjs").then((n) => n.r);
268
232
  const current = await loadConfig();
269
233
  if (!CONFIG_KEYS.includes(key)) {
270
234
  console.error(`Unknown config key: ${key}`);
@@ -325,7 +289,7 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
325
289
  })).addCommand(new Command("topup").description("Open a local browser page to top up the payment wallet").option("--no-open", "Print the top-up URL without opening a browser").option("--json", "Print machine-readable top-up metadata").action(async (opts) => {
326
290
  try {
327
291
  const { buildTopupInfo, getWalletAccount } = await import("./tools-BKLnlBG1.mjs").then((n) => n.p);
328
- const { startTopupServer } = await import("./topup-server-rqI7bqem.mjs").then((n) => n.r);
292
+ const { startTopupServer } = await import("./topup-server-BLdF1SFQ.mjs").then((n) => n.r);
329
293
  const account = await getWalletAccount();
330
294
  const url = await startTopupServer(account);
331
295
  const info = buildTopupInfo(account.address, url);
@@ -357,8 +321,8 @@ program.command("mcp").description("Interact with the Chain Insights MCP endpoin
357
321
  try {
358
322
  const { loadSchema, saveSchema } = await import("./schema-cache-DJdU4MIP.mjs");
359
323
  const { formatToolsTable } = await import("./format-Bq94jSyw.mjs");
360
- const { visibleRemoteTools } = await import("./tool-visibility-C0ALejXI.mjs").then((n) => n.i);
361
- const { loadConfig } = await import("./config-CnNMdt4M.mjs").then((n) => n.t);
324
+ const { visibleRemoteTools } = await import("./tool-visibility-CXbwfKhv.mjs").then((n) => n.i);
325
+ const { loadConfig } = await import("./config-DbbPiGk0.mjs").then((n) => n.t);
362
326
  const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } = await import("./client-D4aM4bzP.mjs").then((n) => n.r);
363
327
  const config = await loadConfig();
364
328
  const graphMcpEndpoint = resolveGraphMcpEndpoint(config);
@@ -387,7 +351,7 @@ program.command("mcp").description("Interact with the Chain Insights MCP endpoin
387
351
  })).addCommand(new Command("aml-address-risk").description("Screen an address for AML risk, exchange behavior, and optional comparison with another address").requiredOption("--address <address>", "Full blockchain address to screen").requiredOption("--network <network>", "Network to query. Run `cia mcp networks` for supported networks.").option("--compare-address <address>", "Optional second address to compare against the screened address").action(async (opts) => {
388
352
  try {
389
353
  await withGraphMcpClient("chain-insights-cli-aml-address-risk", async (client) => {
390
- const { addressRisk } = await import("./public-tools-BjqZGGAC.mjs");
354
+ const { addressRisk } = await import("./public-tools-CpOLkME5.mjs");
391
355
  const result = await addressRisk(client, {
392
356
  address: opts.address,
393
357
  network: opts.network,
@@ -402,7 +366,7 @@ program.command("mcp").description("Interact with the Chain Insights MCP endpoin
402
366
  })).addCommand(new Command("call").description("Call an MCP tool directly (debug)").argument("<tool>", "Tool name to call").argument("[args...]", "Key=value arguments (e.g. address=0x1234... network=robinhood)").action(async (tool, rawArgs) => {
403
367
  try {
404
368
  const { parseMcpCallArgs } = await import("./call-args-ysbB_xdA.mjs");
405
- const { assertPublicMcpToolName, validatePublicMcpToolArguments } = await import("./tool-visibility-C0ALejXI.mjs").then((n) => n.i);
369
+ const { assertPublicMcpToolName, validatePublicMcpToolArguments } = await import("./tool-visibility-CXbwfKhv.mjs").then((n) => n.i);
406
370
  const args = parseMcpCallArgs(rawArgs);
407
371
  assertPublicMcpToolName(tool);
408
372
  validatePublicMcpToolArguments(tool, args);
@@ -435,7 +399,7 @@ program.command("mcp").description("Interact with the Chain Insights MCP endpoin
435
399
  return;
436
400
  }
437
401
  if (tool === "aml_address_risk") {
438
- const { addressRisk } = await import("./public-tools-BjqZGGAC.mjs");
402
+ const { addressRisk } = await import("./public-tools-CpOLkME5.mjs");
439
403
  const result = await addressRisk(client, {
440
404
  address: String(args["address"] ?? ""),
441
405
  network: String(args["network"] ?? ""),
@@ -454,32 +418,6 @@ program.command("mcp").description("Interact with the Chain Insights MCP endpoin
454
418
  process.exit(1);
455
419
  }
456
420
  }));
457
- program.command("viz").description("Generate a workspace visualization").argument("[source-id]", "Workspace graph report ID to render").option("--data <file>", "Raw transaction JSON file for ad-hoc visualization").option("-p, --port <number>", "Server port (defaults to the configured serverPort)").action(async (sourceId, opts) => {
458
- try {
459
- if (!sourceId && !opts.data) {
460
- console.error("Provide either a visualization source ID or --data <file.json>");
461
- process.exit(1);
462
- }
463
- const { loadConfig } = await import("./config-CnNMdt4M.mjs").then((n) => n.t);
464
- const { resolveServerPort } = await import("./resolve-port-DxPK7Ipx.mjs");
465
- const config = await loadConfig();
466
- const port = resolveServerPort(opts.port, config.serverPort);
467
- const { generateVisualization } = await import("./viz-Uh_EF-qB.mjs").then((n) => n.n);
468
- const result = await generateVisualization({
469
- sourceId,
470
- dataFile: opts.data
471
- });
472
- const { startServer } = await import("./server-mDSRgk1X.mjs").then((n) => n.t);
473
- startServer(port);
474
- const url = `http://127.0.0.1:${port}/viz/${result.vizId}`;
475
- console.log(`Visualization: ${url}`);
476
- const open = (await import("open")).default;
477
- await open(url);
478
- } catch (err) {
479
- console.error(err.message);
480
- process.exit(1);
481
- }
482
- });
483
421
  program.parseAsync(process.argv).catch((err) => {
484
422
  console.error(err.message);
485
423
  process.exit(1);
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":[],"sources":["../src/mcp/print-result.ts","../src/cli.ts"],"sourcesContent":["export interface McpTextResult {\n content?: Array<{ type: string; text?: string }>\n isError?: boolean\n}\n\n/**\n * Prints the text blocks of an MCP tool result to stdout. When the result is\n * flagged `isError`, throws with the tool's error text instead — MCP `callTool`\n * returns tool errors as ordinary results (it does not reject), so callers must\n * surface them as failures (non-zero exit) rather than printing to stdout and\n * exiting 0.\n */\nexport function printMcpTextContent(result: McpTextResult): void {\n const texts = (result.content ?? [])\n .filter((item) => item.type === 'text')\n .map((item) => item.text ?? '')\n\n if (result.isError) {\n throw new Error(texts.join('\\n').trim() || 'MCP tool returned an error')\n }\n\n for (const text of texts) console.log(text)\n}\n","import { Command, Option } from 'commander'\nimport { execFileSync } from 'node:child_process'\nimport { fileURLToPath } from 'node:url'\nimport path from 'node:path'\nimport { PACKAGE_INFO, PACKAGE_VERSION } from './version.js'\nimport { printMcpTextContent } from './mcp/print-result.js'\n\n// Resolve bin/install.cjs relative to this file's location in dist/\nconst __dirname = path.dirname(fileURLToPath(import.meta.url))\nconst installerPath = path.resolve(__dirname, '..', 'bin', 'install.cjs')\n\nconst program = new Command()\n\nprogram\n .name('chain-insights')\n .description('AML investigation toolkit for blockchain analysis')\n .version(PACKAGE_INFO.version)\n .option('--claude', 'Install Claude Code skills globally to ~/.claude/skills/')\n .option('--codex', 'Install Codex skills globally to ~/.codex/skills/ and register MCP')\n .option(\n '--hermes',\n 'Install Hermes skills globally to ~/.hermes/skills/chain-insights/ and register MCP'\n )\n\n// Handle installer flags when invoked with no subcommand (bare `chain-insights --claude`)\nconst rawArgs = process.argv.slice(2)\nconst installerFlags = rawArgs.filter(\n (a) => a === '--claude' || a === '--codex' || a === '--hermes'\n)\n// A help/version request must never trigger a global install side effect — let\n// commander handle it and print help/version instead.\nconst wantsHelpOrVersion = rawArgs.some(\n (a) => a === '--help' || a === '-h' || a === '--version' || a === '-V'\n)\nif (installerFlags.length > 0 && !wantsHelpOrVersion && !rawArgs.some((a) => !a.startsWith('-'))) {\n try {\n execFileSync(process.execPath, [installerPath, ...installerFlags], { stdio: 'inherit' })\n } catch (err) {\n console.error('Installation failed:', (err as Error).message)\n process.exit(1)\n }\n process.exit(0)\n}\n\n// Legacy mcp aliases for retired graph tools are not commands; reject them\n// before Commander can mis-parse them. Members are built by concatenation so\n// retired names never appear as literal source strings.\nconst retiredMcpAliases = new Set([['trace', '-funds'].join(''), ['track', '-funds'].join('')])\nif (rawArgs[0] === 'mcp' && retiredMcpAliases.has(rawArgs[1] ?? '')) {\n console.error(`error: unknown command '${rawArgs[1]}'`)\n process.exit(1)\n}\n\nfunction runInstaller(flag: '--claude' | '--codex' | '--hermes'): void {\n try {\n execFileSync(process.execPath, [installerPath, flag], { stdio: 'inherit' })\n } catch (err) {\n console.error('Installation failed:', (err as Error).message)\n process.exit(1)\n }\n}\n\nfunction optionalNumber(value: string | undefined): number | undefined {\n if (value === undefined) return undefined\n const parsed = Number(value)\n if (!Number.isFinite(parsed)) throw new Error(`Invalid number: ${value}`)\n return parsed\n}\n\nfunction optionalNumberArg(value: unknown, name: string): number | undefined {\n if (value === undefined) return undefined\n if (typeof value === 'number' && Number.isFinite(value)) return value\n if (typeof value === 'string') return optionalNumber(value)\n throw new Error(`Invalid number for ${name}: ${String(value)}`)\n}\n\nasync function withGraphMcpClient<T>(\n name: string,\n fn: (\n client: import('@modelcontextprotocol/sdk/client/index.js').Client,\n config: Awaited<ReturnType<typeof import('./config/index.js').loadConfig>>\n ) => Promise<T>\n): Promise<T> {\n const { loadConfig } = await import('./config/index.js')\n const config = await loadConfig()\n const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } = await import('./mcp/client.js')\n const paymentFetch = await createConfiguredGraphMcpFetch(config)\n const { Client } = await import('@modelcontextprotocol/sdk/client/index.js')\n const { StreamableHTTPClientTransport } =\n await import('@modelcontextprotocol/sdk/client/streamableHttp.js')\n const client = new Client({ name, version: PACKAGE_VERSION })\n await client.connect(\n new StreamableHTTPClientTransport(new URL(resolveGraphMcpEndpoint(config)), {\n fetch: paymentFetch,\n })\n )\n // Every CLI command builds its own client, separate from the MCP proxy's\n // one, so unattended scheduled CLI runs also write to the action log.\n const { installActionLogging } = await import('./mcp/action-log.js')\n installActionLogging(client)\n try {\n return await fn(client, config)\n } finally {\n await client.close()\n }\n}\n\nasync function printNetworkCapabilities(opts: { json?: boolean }): Promise<void> {\n const { loadConfig } = await import('./config/index.js')\n const { fetchNetworkCapabilities, formatNetworkCapabilities } =\n await import('./mcp/capabilities.js')\n const document = await fetchNetworkCapabilities(await loadConfig())\n if (opts.json) {\n console.log(JSON.stringify(document, null, 2))\n } else {\n console.log(formatNetworkCapabilities(document))\n }\n}\n\nprogram\n .command('networks')\n .alias('network')\n .description('List supported graph networks, capability layers, and available tools')\n .option('--json', 'Print raw capability JSON')\n .action(async (opts: { json?: boolean }) => {\n try {\n await printNetworkCapabilities(opts)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n\nprogram\n .command('serve')\n .description('Start local visualization server')\n .option('-p, --port <number>', 'Port to bind (defaults to the configured serverPort)')\n .action(async (opts: { port?: string }) => {\n try {\n const { requireWorkspaceRoot } = await import('./workspace/output-root.js')\n const workspaceRoot = requireWorkspaceRoot()\n const { loadConfig } = await import('./config/index.js')\n const { resolveServerPort } = await import('./server/resolve-port.js')\n const config = await loadConfig()\n const port = resolveServerPort(opts.port, config.serverPort)\n const { startServer } = await import('./server/index.js')\n console.log(`Workspace: ${workspaceRoot}`)\n startServer(port)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n\nprogram\n .command('status')\n .description('Show toolkit status and configuration')\n .action(async () => {\n const { loadConfig } = await import('./config/index.js')\n const { findActiveWorkspace, activeDataDir } = await import('./workspace/active.js')\n const config = await loadConfig()\n const workspace = findActiveWorkspace()\n const graphMcpStatus =\n config.graphMcpMode === 'debug' && config.graphMcpAuthToken?.trim()\n ? 'bearer access mode'\n : `${config.graphMcpMode} mode`\n console.log('Config: ', activeDataDir(config.dataDir))\n if (workspace) console.log('Workspace:', workspace.root)\n console.log('Server: ', `http://127.0.0.1:${config.serverPort}`)\n console.log('Chain Insights Graph:', graphMcpStatus)\n console.log('Graph endpoint:', config.graphMcpEndpoint)\n })\n\nprogram\n .command('update')\n .description('Check npmjs for a newer Chain Insights release and update this CLI')\n .option('--check', 'Only check for a newer release')\n .option('--dry-run', 'Print the update command without running it')\n .action(async (opts: { check?: boolean; dryRun?: boolean }) => {\n try {\n const { checkForUpdate, runPackageUpdate } = await import('./update.js')\n const result = await checkForUpdate()\n if (result.error) {\n throw new Error(`Could not check npmjs for updates: ${result.error}`)\n }\n if (!result.updateAvailable || !result.latestVersion) {\n console.log(`Chain Insights is up to date (${result.currentVersion}).`)\n return\n }\n\n console.log(\n `Chain Insights ${result.latestVersion} is available (current ${result.currentVersion}).`\n )\n if (opts.check) {\n console.log(`Run: ${result.updateCommand}`)\n return\n }\n if (opts.dryRun) {\n console.log(`Would run: ${result.updateCommand}`)\n return\n }\n\n console.log(`Running: ${result.updateCommand}`)\n runPackageUpdate(result.packageName)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n\nprogram\n .command('debug')\n .description('Configure Chain Insights Graph debug mode')\n .addCommand(\n new Command('on')\n .description('Enable Chain Insights Graph debug mode without x402 payments')\n .requiredOption('--token <token>', 'Debug bearer token')\n .option('--endpoint <url>', 'Chain Insights Graph endpoint')\n .action(async (opts: { token: string; endpoint?: string }) => {\n try {\n const { saveConfig } = await import('./config/index.js')\n await saveConfig({\n graphMcpMode: 'debug',\n graphMcpAuthToken: opts.token,\n ...(opts.endpoint ? { graphMcpEndpoint: opts.endpoint } : {}),\n })\n console.log('Chain Insights Graph debug mode enabled')\n if (opts.endpoint) console.log(`Graph endpoint: ${opts.endpoint}`)\n console.log('Payments: disabled for Chain Insights Graph calls')\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('off')\n .description('Disable Chain Insights Graph debug mode and use paid x402 calls')\n .action(async () => {\n try {\n const { saveConfig } = await import('./config/index.js')\n await saveConfig({ graphMcpMode: 'paid', graphMcpAuthToken: '' })\n console.log('Chain Insights Graph debug mode disabled')\n console.log('Payments: enabled for Chain Insights Graph calls')\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('status')\n .description('Show Chain Insights Graph payment/debug mode')\n .action(async () => {\n try {\n const { loadConfig } = await import('./config/index.js')\n const config = await loadConfig()\n console.log(`Chain Insights Graph mode: ${config.graphMcpMode}`)\n console.log(`Graph endpoint: ${config.graphMcpEndpoint}`)\n console.log(\n `Debug token: ${config.graphMcpAuthToken?.trim() ? 'configured' : 'not configured'}`\n )\n console.log(`Payments: ${config.graphMcpMode === 'debug' ? 'disabled' : 'enabled'}`)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n\nprogram\n .command('access-key')\n .description('Configure Chain Insights Graph test access key mode')\n .addCommand(\n new Command('set')\n .description('Use a Chain Insights Graph test access key without x402 payments')\n .argument('<key>', 'Test access key')\n .option('--endpoint <url>', 'Chain Insights Graph endpoint')\n .action(async (key: string, opts: { endpoint?: string }) => {\n try {\n const normalizedKey = key.trim()\n if (!normalizedKey) throw new Error('Test access key is required')\n const { saveConfig } = await import('./config/index.js')\n await saveConfig({\n graphMcpMode: 'debug',\n graphMcpAuthToken: normalizedKey,\n ...(opts.endpoint ? { graphMcpEndpoint: opts.endpoint } : {}),\n })\n console.log('Chain Insights Graph test access key configured')\n if (opts.endpoint) console.log(`Graph endpoint: ${opts.endpoint}`)\n console.log('Payments: disabled when the server accepts this key')\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('clear')\n .description('Remove the Chain Insights Graph test access key and use paid x402 calls')\n .action(async () => {\n try {\n const { saveConfig } = await import('./config/index.js')\n await saveConfig({ graphMcpMode: 'paid', graphMcpAuthToken: '' })\n console.log('Chain Insights Graph test access key cleared')\n console.log('Payments: enabled for Chain Insights Graph calls')\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('status')\n .description('Show Chain Insights Graph test access key status')\n .action(async () => {\n try {\n const { loadConfig } = await import('./config/index.js')\n const config = await loadConfig()\n console.log(`Graph endpoint: ${config.graphMcpEndpoint}`)\n console.log(\n `Access key: ${config.graphMcpAuthToken?.trim() ? 'configured' : 'not configured'}`\n )\n console.log(\n `Payments: ${config.graphMcpAuthToken?.trim() ? 'disabled when accepted by server' : 'enabled'}`\n )\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n\nprogram\n .command('init')\n .description('Initialize an investigation workspace')\n .argument('[dir]', 'Workspace directory to initialize', '.')\n .option('--force', 'Overwrite existing workspace files')\n .action(async (dir: string, opts: { force?: boolean }) => {\n try {\n const { initWorkspace } = await import('./workspace/init.js')\n const result = await initWorkspace({ targetDir: dir, force: opts.force })\n console.log(`Workspace initialized: ${result.workspaceRoot}`)\n console.log(`Files written: ${result.filesWritten.length}`)\n const { maybePromptForUpdate } = await import('./update.js')\n await maybePromptForUpdate()\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n\nprogram\n .command('setup')\n .description('Configure external MCP clients')\n .addCommand(\n new Command('claude-code')\n .alias('claude')\n .description('Install Claude Code skills and register the MCP proxy')\n .action(() => {\n runInstaller('--claude')\n })\n )\n .addCommand(\n new Command('codex')\n .description('Install Codex skills and register the MCP proxy')\n .action(() => {\n runInstaller('--codex')\n })\n )\n .addCommand(\n new Command('hermes')\n .description('Install Hermes skills and register the MCP proxy')\n .action(() => {\n runInstaller('--hermes')\n })\n )\n\nprogram\n .command('config')\n .description('Read or write configuration values')\n .addCommand(\n new Command('get').argument('<key>', 'Config key to read').action(async (key: string) => {\n const { loadConfig } = await import('./config/index.js')\n const { CONFIG_KEYS } = await import('./config/schema.js')\n if (!CONFIG_KEYS.includes(key as (typeof CONFIG_KEYS)[number])) {\n console.error(`Unknown config key: ${key}`)\n process.exit(1)\n }\n const config = await loadConfig()\n const value = (config as Record<string, unknown>)[key]\n console.log(value ?? '')\n })\n )\n .addCommand(\n new Command('set')\n .argument('<key>', 'Config key to write')\n .argument('<value>', 'Value to set')\n .action(async (key: string, value: string) => {\n // D-01: walletPrivateKey is intercepted before saveConfig — the raw private key\n // must NEVER be written to config.json.\n if (key === 'walletPrivateKey') {\n try {\n const { setWalletPrivateKey } = await import('./wallet/index.js')\n const address = await setWalletPrivateKey(value)\n console.log('Wallet private key encrypted and stored in ~/.chain-insights/wallet.json')\n console.log(`Wallet address: ${address}`)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n return // MUST return — walletPrivateKey must never reach saveConfig or config.json\n }\n const { loadConfig, saveConfig } = await import('./config/index.js')\n const { CONFIG_KEYS, DEFAULT_CONFIG } = await import('./config/schema.js')\n const current = await loadConfig()\n if (!CONFIG_KEYS.includes(key as (typeof CONFIG_KEYS)[number])) {\n console.error(`Unknown config key: ${key}`)\n process.exit(1)\n }\n const existing = (current as Record<string, unknown>)[key]\n const defaultValue = (DEFAULT_CONFIG as Record<string, unknown>)[key]\n const coerced =\n typeof existing === 'number' || typeof defaultValue === 'number' ? Number(value) : value\n await saveConfig({ [key]: coerced } as Parameters<typeof saveConfig>[0])\n const displayed = key.toLowerCase().includes('token') ? '[redacted]' : coerced\n console.log(`Set ${key} = ${displayed}`)\n })\n )\n\nprogram\n .command('wallet')\n .description('Manage the local Base USDC payment wallet')\n .addCommand(\n new Command('import')\n .description('Import a Base payment wallet')\n .argument('<private-key>', '0x-prefixed EVM private key')\n .option(\n '--force',\n 'Replace an existing wallet (the previous key is backed up next to wallet.json)'\n )\n .action(async (privateKey: string, opts: { force?: boolean }) => {\n try {\n const { setWalletPrivateKey, isWalletConfigured } = await import('./wallet/index.js')\n const replacing = opts.force === true && (await isWalletConfigured())\n const address = await setWalletPrivateKey(privateKey, { force: opts.force })\n if (replacing) {\n console.log('Previous wallet key backed up next to ~/.chain-insights/wallet.json')\n }\n console.log(`Wallet imported: ${address}`)\n console.log('Next: run `chain-insights wallet ready`')\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('address')\n .description('Print the local payment wallet address')\n .action(async () => {\n try {\n const { getWalletAccount } = await import('./wallet/tools.js')\n const account = await getWalletAccount()\n console.log(account.address)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('balance')\n .description('Show the local payment wallet Base USDC balance')\n .action(async () => {\n try {\n const { getWalletBalanceText } = await import('./wallet/tools.js')\n console.log(await getWalletBalanceText())\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('ready')\n .description('Check and prepare the wallet for paid Chain Insights Graph calls')\n .option('--check-only', 'Only check readiness; do not submit the one-time payment setup')\n .addOption(new Option('--no-approve', 'Deprecated alias for --check-only').hideHelp())\n .option('--payment-usdc <amount>', 'USDC setup cap to prepare for paid calls', '1')\n .addOption(\n new Option('--approval-usdc <amount>', 'Deprecated alias for --payment-usdc').hideHelp()\n )\n .option('--json', 'Print machine-readable readiness metadata')\n .action(\n async (opts: {\n checkOnly?: boolean\n approve?: boolean\n paymentUsdc?: string\n approvalUsdc?: string\n json?: boolean\n }) => {\n try {\n const { formatWalletReadiness, parsePaymentApprovalUnits, prepareWalletForPaidCalls } =\n await import('./wallet/tools.js')\n const minimumApprovalUnits = parsePaymentApprovalUnits(\n opts.paymentUsdc ?? opts.approvalUsdc ?? '1'\n )\n const result = await prepareWalletForPaidCalls({\n minimumApprovalUnits,\n approve: opts.checkOnly ? false : opts.approve !== false,\n })\n\n if (opts.json) {\n console.log(\n JSON.stringify(\n result,\n (_key, value) => (typeof value === 'bigint' ? value.toString() : value),\n 2\n )\n )\n return\n }\n\n console.log(formatWalletReadiness(result.readiness, result.approval))\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n }\n )\n )\n .addCommand(\n new Command('topup')\n .description('Open a local browser page to top up the payment wallet')\n .option('--no-open', 'Print the top-up URL without opening a browser')\n .option('--json', 'Print machine-readable top-up metadata')\n .action(async (opts: { open?: boolean; json?: boolean }) => {\n try {\n const { buildTopupInfo, getWalletAccount } = await import('./wallet/tools.js')\n const { startTopupServer } = await import('./wallet/topup-server.js')\n const account = await getWalletAccount()\n const url = await startTopupServer(account)\n const info = buildTopupInfo(account.address, url)\n\n if (opts.json) {\n console.log(JSON.stringify(info, null, 2))\n } else {\n console.log(`Top-up URL: ${url}`)\n console.log(`Wallet: ${account.address}`)\n console.log('Network: Base')\n console.log('Token: USDC')\n console.log('Press Ctrl+C to stop the top-up server.')\n }\n\n if (opts.open !== false) {\n const open = (await import('open')).default\n await open(url)\n }\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n\nprogram\n .command('mcp')\n .description('Interact with the Chain Insights MCP endpoint')\n .allowExcessArguments(false)\n .addCommand(\n new Command('networks')\n .description(\n 'List supported graph networks, capability layers, dataset coverage, and available tools'\n )\n .option('--json', 'Print raw capability JSON')\n .action(async (opts: { json?: boolean }) => {\n try {\n await printNetworkCapabilities(opts)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('tools')\n .description('List available MCP tools (cached 24h)')\n .option('--refresh', 'Force refresh schema cache')\n .action(async (opts: { refresh?: boolean }) => {\n try {\n const { loadSchema, saveSchema } = await import('./mcp/schema-cache.js')\n const { formatToolsTable } = await import('./mcp/format.js')\n const { visibleRemoteTools } = await import('./mcp/tool-visibility.js')\n const { loadConfig } = await import('./config/index.js')\n const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } =\n await import('./mcp/client.js')\n const config = await loadConfig()\n const graphMcpEndpoint = resolveGraphMcpEndpoint(config)\n let tools = opts.refresh ? null : await loadSchema(graphMcpEndpoint)\n if (!tools) {\n const paymentFetch = await createConfiguredGraphMcpFetch(config)\n const { Client } = await import('@modelcontextprotocol/sdk/client/index.js')\n const { StreamableHTTPClientTransport } =\n await import('@modelcontextprotocol/sdk/client/streamableHttp.js')\n const client = new Client({ name: 'chain-insights-cli', version: PACKAGE_VERSION })\n await client.connect(\n new StreamableHTTPClientTransport(new URL(graphMcpEndpoint), { fetch: paymentFetch })\n )\n try {\n const result = await client.listTools()\n tools = result.tools as Array<{ name: string; description?: string }>\n await saveSchema(tools, graphMcpEndpoint)\n } finally {\n await client.close()\n }\n }\n console.log(formatToolsTable(visibleRemoteTools(tools)))\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('aml-address-risk')\n .description(\n 'Screen an address for AML risk, exchange behavior, and optional comparison with another address'\n )\n .requiredOption('--address <address>', 'Full blockchain address to screen')\n .requiredOption(\n '--network <network>',\n 'Network to query. Run `cia mcp networks` for supported networks.'\n )\n .option(\n '--compare-address <address>',\n 'Optional second address to compare against the screened address'\n )\n .action(async (opts: { address: string; network: string; compareAddress?: string }) => {\n try {\n await withGraphMcpClient('chain-insights-cli-aml-address-risk', async (client) => {\n const { addressRisk } = await import('./investigation/public-tools.js')\n const result = await addressRisk(client, {\n address: opts.address,\n network: opts.network,\n compareAddress: opts.compareAddress,\n })\n console.log(result.summaryText)\n })\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('call')\n .description('Call an MCP tool directly (debug)')\n .argument('<tool>', 'Tool name to call')\n .argument('[args...]', 'Key=value arguments (e.g. address=0x1234... network=robinhood)')\n .action(async (tool: string, rawArgs: string[]) => {\n try {\n const { parseMcpCallArgs } = await import('./mcp/call-args.js')\n const { assertPublicMcpToolName, validatePublicMcpToolArguments } =\n await import('./mcp/tool-visibility.js')\n const args = parseMcpCallArgs(rawArgs)\n assertPublicMcpToolName(tool)\n validatePublicMcpToolArguments(tool, args)\n\n if (tool === 'wallet_balance') {\n const { getWalletBalanceText } = await import('./wallet/tools.js')\n console.log(await getWalletBalanceText())\n return\n }\n\n if (tool === 'meta_network_capabilities') {\n await printNetworkCapabilities({ json: true })\n return\n }\n\n if (tool === 'meta_help') {\n console.log(\n 'Chain Insights tools: aml_*, graph_query, graph_query_batch, meta_*, and wallet_balance.'\n )\n return\n }\n\n await withGraphMcpClient('chain-insights-cli-call', async (client, config) => {\n if (tool === 'meta_usage_status') {\n try {\n const result = await client.callTool({ name: 'usage_status', arguments: {} })\n printMcpTextContent(result as { content?: Array<{ type: string; text?: string }> })\n } catch (err) {\n const {\n isMissingUsageStatusToolError,\n primitiveBackendUsageStatus,\n usageStatusText,\n } = await import('./mcp/usage-status.js')\n if (!isMissingUsageStatusToolError(err)) throw err\n const { resolveGraphMcpEndpoint } = await import('./mcp/client.js')\n console.log(\n usageStatusText(primitiveBackendUsageStatus(resolveGraphMcpEndpoint(config)))\n )\n }\n return\n }\n if (tool === 'aml_address_risk') {\n const { addressRisk } = await import('./investigation/public-tools.js')\n const result = await addressRisk(client, {\n address: String(args['address'] ?? ''),\n network: String(args['network'] ?? ''),\n compareAddress:\n args['compare_address'] === undefined\n ? undefined\n : String(args['compare_address']),\n })\n console.log(result.summaryText)\n return\n }\n const result = await client.callTool({ name: tool, arguments: args })\n printMcpTextContent(result as { content?: Array<{ type: string; text?: string }> })\n })\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n\nprogram\n .command('viz')\n .description('Generate a workspace visualization')\n .argument('[source-id]', 'Workspace graph report ID to render')\n .option('--data <file>', 'Raw transaction JSON file for ad-hoc visualization')\n .option('-p, --port <number>', 'Server port (defaults to the configured serverPort)')\n .action(async (sourceId: string | undefined, opts: { data?: string; port?: string }) => {\n try {\n if (!sourceId && !opts.data) {\n console.error('Provide either a visualization source ID or --data <file.json>')\n process.exit(1)\n }\n const { loadConfig } = await import('./config/index.js')\n const { resolveServerPort } = await import('./server/resolve-port.js')\n const config = await loadConfig()\n const port = resolveServerPort(opts.port, config.serverPort)\n const { generateVisualization } = await import('./viz/index.js')\n const result = await generateVisualization({ sourceId, dataFile: opts.data })\n const { startServer } = await import('./server/index.js')\n startServer(port)\n const url = `http://127.0.0.1:${port}/viz/${result.vizId}`\n console.log(`Visualization: ${url}`)\n const open = (await import('open')).default\n await open(url)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n\n// parseAsync (not parse) so a rejected async action surfaces as a clean\n// one-line error and a non-zero exit, instead of an unhandled-rejection stack\n// trace. Commands with their own try/catch still exit(1) before this fires.\nprogram.parseAsync(process.argv).catch((err) => {\n console.error((err as Error).message)\n process.exit(1)\n})\n"],"mappings":";;;;;;;;;;;;;A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TextResult {\n content?: Array<{ type: string; text?: string }>\n isError?: boolean\n}\n\n/**\n * Prints the text blocks of an MCP tool result to stdout. When the result is\n * flagged `isError`, throws with the tool's error text instead — MCP `callTool`\n * returns tool errors as ordinary results (it does not reject), so callers must\n * surface them as failures (non-zero exit) rather than printing to stdout and\n * exiting 0.\n */\nexport function printMcpTextContent(result: McpTextResult): void {\n const texts = (result.content ?? [])\n .filter((item) => item.type === 'text')\n .map((item) => item.text ?? '')\n\n if (result.isError) {\n throw new Error(texts.join('\\n').trim() || 'MCP tool returned an error')\n }\n\n for (const text of texts) console.log(text)\n}\n","import { Command, Option } from 'commander'\nimport { execFileSync } from 'node:child_process'\nimport { fileURLToPath } from 'node:url'\nimport path from 'node:path'\nimport { PACKAGE_INFO, PACKAGE_VERSION } from './version.js'\nimport { printMcpTextContent } from './mcp/print-result.js'\n\n// Resolve bin/install.cjs relative to this file's location in dist/\nconst __dirname = path.dirname(fileURLToPath(import.meta.url))\nconst installerPath = path.resolve(__dirname, '..', 'bin', 'install.cjs')\n\nconst program = new Command()\n\nprogram\n .name('chain-insights')\n .description('AML investigation toolkit for blockchain analysis')\n .version(PACKAGE_INFO.version)\n .option('--claude', 'Install Claude Code skills globally to ~/.claude/skills/')\n .option('--codex', 'Install Codex skills globally to ~/.codex/skills/ and register MCP')\n .option(\n '--hermes',\n 'Install Hermes skills globally to ~/.hermes/skills/chain-insights/ and register MCP'\n )\n\n// Handle installer flags when invoked with no subcommand (bare `chain-insights --claude`)\nconst rawArgs = process.argv.slice(2)\nconst installerFlags = rawArgs.filter(\n (a) => a === '--claude' || a === '--codex' || a === '--hermes'\n)\n// A help/version request must never trigger a global install side effect — let\n// commander handle it and print help/version instead.\nconst wantsHelpOrVersion = rawArgs.some(\n (a) => a === '--help' || a === '-h' || a === '--version' || a === '-V'\n)\nif (installerFlags.length > 0 && !wantsHelpOrVersion && !rawArgs.some((a) => !a.startsWith('-'))) {\n try {\n execFileSync(process.execPath, [installerPath, ...installerFlags], { stdio: 'inherit' })\n } catch (err) {\n console.error('Installation failed:', (err as Error).message)\n process.exit(1)\n }\n process.exit(0)\n}\n\n// Legacy mcp aliases for retired graph tools are not commands; reject them\n// before Commander can mis-parse them. Members are built by concatenation so\n// retired names never appear as literal source strings.\nconst retiredMcpAliases = new Set([['trace', '-funds'].join(''), ['track', '-funds'].join('')])\nif (rawArgs[0] === 'mcp' && retiredMcpAliases.has(rawArgs[1] ?? '')) {\n console.error(`error: unknown command '${rawArgs[1]}'`)\n process.exit(1)\n}\n\nfunction runInstaller(flag: '--claude' | '--codex' | '--hermes'): void {\n try {\n execFileSync(process.execPath, [installerPath, flag], { stdio: 'inherit' })\n } catch (err) {\n console.error('Installation failed:', (err as Error).message)\n process.exit(1)\n }\n}\n\nasync function withGraphMcpClient<T>(\n name: string,\n fn: (\n client: import('@modelcontextprotocol/sdk/client/index.js').Client,\n config: Awaited<ReturnType<typeof import('./config/index.js').loadConfig>>\n ) => Promise<T>\n): Promise<T> {\n const { loadConfig } = await import('./config/index.js')\n const config = await loadConfig()\n const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } = await import('./mcp/client.js')\n const paymentFetch = await createConfiguredGraphMcpFetch(config)\n const { Client } = await import('@modelcontextprotocol/sdk/client/index.js')\n const { StreamableHTTPClientTransport } =\n await import('@modelcontextprotocol/sdk/client/streamableHttp.js')\n const client = new Client({ name, version: PACKAGE_VERSION })\n await client.connect(\n new StreamableHTTPClientTransport(new URL(resolveGraphMcpEndpoint(config)), {\n fetch: paymentFetch,\n })\n )\n // Every CLI command builds its own client, separate from the MCP proxy's\n // one, so unattended scheduled CLI runs also write to the action log.\n const { installActionLogging } = await import('./mcp/action-log.js')\n installActionLogging(client)\n try {\n return await fn(client, config)\n } finally {\n await client.close()\n }\n}\n\nasync function printNetworkCapabilities(opts: { json?: boolean }): Promise<void> {\n const { loadConfig } = await import('./config/index.js')\n const { fetchNetworkCapabilities, formatNetworkCapabilities } =\n await import('./mcp/capabilities.js')\n const document = await fetchNetworkCapabilities(await loadConfig())\n if (opts.json) {\n console.log(JSON.stringify(document, null, 2))\n } else {\n console.log(formatNetworkCapabilities(document))\n }\n}\n\nprogram\n .command('networks')\n .alias('network')\n .description('List supported graph networks, capability layers, and available tools')\n .option('--json', 'Print raw capability JSON')\n .action(async (opts: { json?: boolean }) => {\n try {\n await printNetworkCapabilities(opts)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n\nprogram\n .command('status')\n .description('Show toolkit status and configuration')\n .action(async () => {\n const { loadConfig } = await import('./config/index.js')\n const config = await loadConfig()\n const graphMcpStatus =\n config.graphMcpMode === 'debug' && config.graphMcpAuthToken?.trim()\n ? 'bearer access mode'\n : `${config.graphMcpMode} mode`\n console.log('Config: ', config.dataDir)\n console.log('Chain Insights Graph:', graphMcpStatus)\n console.log('Graph endpoint:', config.graphMcpEndpoint)\n })\n\nprogram\n .command('update')\n .description('Check npmjs for a newer Chain Insights release and update this CLI')\n .option('--check', 'Only check for a newer release')\n .option('--dry-run', 'Print the update command without running it')\n .action(async (opts: { check?: boolean; dryRun?: boolean }) => {\n try {\n const { checkForUpdate, runPackageUpdate } = await import('./update.js')\n const result = await checkForUpdate()\n if (result.error) {\n throw new Error(`Could not check npmjs for updates: ${result.error}`)\n }\n if (!result.updateAvailable || !result.latestVersion) {\n console.log(`Chain Insights is up to date (${result.currentVersion}).`)\n return\n }\n\n console.log(\n `Chain Insights ${result.latestVersion} is available (current ${result.currentVersion}).`\n )\n if (opts.check) {\n console.log(`Run: ${result.updateCommand}`)\n return\n }\n if (opts.dryRun) {\n console.log(`Would run: ${result.updateCommand}`)\n return\n }\n\n console.log(`Running: ${result.updateCommand}`)\n runPackageUpdate(result.packageName)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n\nprogram\n .command('debug')\n .description('Configure Chain Insights Graph debug mode')\n .addCommand(\n new Command('on')\n .description('Enable Chain Insights Graph debug mode without x402 payments')\n .requiredOption('--token <token>', 'Debug bearer token')\n .option('--endpoint <url>', 'Chain Insights Graph endpoint')\n .action(async (opts: { token: string; endpoint?: string }) => {\n try {\n const { saveConfig } = await import('./config/index.js')\n await saveConfig({\n graphMcpMode: 'debug',\n graphMcpAuthToken: opts.token,\n ...(opts.endpoint ? { graphMcpEndpoint: opts.endpoint } : {}),\n })\n console.log('Chain Insights Graph debug mode enabled')\n if (opts.endpoint) console.log(`Graph endpoint: ${opts.endpoint}`)\n console.log('Payments: disabled for Chain Insights Graph calls')\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('off')\n .description('Disable Chain Insights Graph debug mode and use paid x402 calls')\n .action(async () => {\n try {\n const { saveConfig } = await import('./config/index.js')\n await saveConfig({ graphMcpMode: 'paid', graphMcpAuthToken: '' })\n console.log('Chain Insights Graph debug mode disabled')\n console.log('Payments: enabled for Chain Insights Graph calls')\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('status')\n .description('Show Chain Insights Graph payment/debug mode')\n .action(async () => {\n try {\n const { loadConfig } = await import('./config/index.js')\n const config = await loadConfig()\n console.log(`Chain Insights Graph mode: ${config.graphMcpMode}`)\n console.log(`Graph endpoint: ${config.graphMcpEndpoint}`)\n console.log(\n `Debug token: ${config.graphMcpAuthToken?.trim() ? 'configured' : 'not configured'}`\n )\n console.log(`Payments: ${config.graphMcpMode === 'debug' ? 'disabled' : 'enabled'}`)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n\nprogram\n .command('access-key')\n .description('Configure Chain Insights Graph test access key mode')\n .addCommand(\n new Command('set')\n .description('Use a Chain Insights Graph test access key without x402 payments')\n .argument('<key>', 'Test access key')\n .option('--endpoint <url>', 'Chain Insights Graph endpoint')\n .action(async (key: string, opts: { endpoint?: string }) => {\n try {\n const normalizedKey = key.trim()\n if (!normalizedKey) throw new Error('Test access key is required')\n const { saveConfig } = await import('./config/index.js')\n await saveConfig({\n graphMcpMode: 'debug',\n graphMcpAuthToken: normalizedKey,\n ...(opts.endpoint ? { graphMcpEndpoint: opts.endpoint } : {}),\n })\n console.log('Chain Insights Graph test access key configured')\n if (opts.endpoint) console.log(`Graph endpoint: ${opts.endpoint}`)\n console.log('Payments: disabled when the server accepts this key')\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('clear')\n .description('Remove the Chain Insights Graph test access key and use paid x402 calls')\n .action(async () => {\n try {\n const { saveConfig } = await import('./config/index.js')\n await saveConfig({ graphMcpMode: 'paid', graphMcpAuthToken: '' })\n console.log('Chain Insights Graph test access key cleared')\n console.log('Payments: enabled for Chain Insights Graph calls')\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('status')\n .description('Show Chain Insights Graph test access key status')\n .action(async () => {\n try {\n const { loadConfig } = await import('./config/index.js')\n const config = await loadConfig()\n console.log(`Graph endpoint: ${config.graphMcpEndpoint}`)\n console.log(\n `Access key: ${config.graphMcpAuthToken?.trim() ? 'configured' : 'not configured'}`\n )\n console.log(\n `Payments: ${config.graphMcpAuthToken?.trim() ? 'disabled when accepted by server' : 'enabled'}`\n )\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n\nprogram\n .command('setup')\n .description('Configure external MCP clients')\n .addCommand(\n new Command('claude-code')\n .alias('claude')\n .description('Install Claude Code skills and register the MCP proxy')\n .action(() => {\n runInstaller('--claude')\n })\n )\n .addCommand(\n new Command('codex')\n .description('Install Codex skills and register the MCP proxy')\n .action(() => {\n runInstaller('--codex')\n })\n )\n .addCommand(\n new Command('hermes')\n .description('Install Hermes skills and register the MCP proxy')\n .action(() => {\n runInstaller('--hermes')\n })\n )\n\nprogram\n .command('config')\n .description('Read or write configuration values')\n .addCommand(\n new Command('get').argument('<key>', 'Config key to read').action(async (key: string) => {\n const { loadConfig } = await import('./config/index.js')\n const { CONFIG_KEYS } = await import('./config/schema.js')\n if (!CONFIG_KEYS.includes(key as (typeof CONFIG_KEYS)[number])) {\n console.error(`Unknown config key: ${key}`)\n process.exit(1)\n }\n const config = await loadConfig()\n const value = (config as Record<string, unknown>)[key]\n console.log(value ?? '')\n })\n )\n .addCommand(\n new Command('set')\n .argument('<key>', 'Config key to write')\n .argument('<value>', 'Value to set')\n .action(async (key: string, value: string) => {\n // D-01: walletPrivateKey is intercepted before saveConfig — the raw private key\n // must NEVER be written to config.json.\n if (key === 'walletPrivateKey') {\n try {\n const { setWalletPrivateKey } = await import('./wallet/index.js')\n const address = await setWalletPrivateKey(value)\n console.log('Wallet private key encrypted and stored in ~/.chain-insights/wallet.json')\n console.log(`Wallet address: ${address}`)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n return // MUST return — walletPrivateKey must never reach saveConfig or config.json\n }\n const { loadConfig, saveConfig } = await import('./config/index.js')\n const { CONFIG_KEYS, DEFAULT_CONFIG } = await import('./config/schema.js')\n const current = await loadConfig()\n if (!CONFIG_KEYS.includes(key as (typeof CONFIG_KEYS)[number])) {\n console.error(`Unknown config key: ${key}`)\n process.exit(1)\n }\n const existing = (current as Record<string, unknown>)[key]\n const defaultValue = (DEFAULT_CONFIG as Record<string, unknown>)[key]\n const coerced =\n typeof existing === 'number' || typeof defaultValue === 'number' ? Number(value) : value\n await saveConfig({ [key]: coerced } as Parameters<typeof saveConfig>[0])\n const displayed = key.toLowerCase().includes('token') ? '[redacted]' : coerced\n console.log(`Set ${key} = ${displayed}`)\n })\n )\n\nprogram\n .command('wallet')\n .description('Manage the local Base USDC payment wallet')\n .addCommand(\n new Command('import')\n .description('Import a Base payment wallet')\n .argument('<private-key>', '0x-prefixed EVM private key')\n .option(\n '--force',\n 'Replace an existing wallet (the previous key is backed up next to wallet.json)'\n )\n .action(async (privateKey: string, opts: { force?: boolean }) => {\n try {\n const { setWalletPrivateKey, isWalletConfigured } = await import('./wallet/index.js')\n const replacing = opts.force === true && (await isWalletConfigured())\n const address = await setWalletPrivateKey(privateKey, { force: opts.force })\n if (replacing) {\n console.log('Previous wallet key backed up next to ~/.chain-insights/wallet.json')\n }\n console.log(`Wallet imported: ${address}`)\n console.log('Next: run `chain-insights wallet ready`')\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('address')\n .description('Print the local payment wallet address')\n .action(async () => {\n try {\n const { getWalletAccount } = await import('./wallet/tools.js')\n const account = await getWalletAccount()\n console.log(account.address)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('balance')\n .description('Show the local payment wallet Base USDC balance')\n .action(async () => {\n try {\n const { getWalletBalanceText } = await import('./wallet/tools.js')\n console.log(await getWalletBalanceText())\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('ready')\n .description('Check and prepare the wallet for paid Chain Insights Graph calls')\n .option('--check-only', 'Only check readiness; do not submit the one-time payment setup')\n .addOption(new Option('--no-approve', 'Deprecated alias for --check-only').hideHelp())\n .option('--payment-usdc <amount>', 'USDC setup cap to prepare for paid calls', '1')\n .addOption(\n new Option('--approval-usdc <amount>', 'Deprecated alias for --payment-usdc').hideHelp()\n )\n .option('--json', 'Print machine-readable readiness metadata')\n .action(\n async (opts: {\n checkOnly?: boolean\n approve?: boolean\n paymentUsdc?: string\n approvalUsdc?: string\n json?: boolean\n }) => {\n try {\n const { formatWalletReadiness, parsePaymentApprovalUnits, prepareWalletForPaidCalls } =\n await import('./wallet/tools.js')\n const minimumApprovalUnits = parsePaymentApprovalUnits(\n opts.paymentUsdc ?? opts.approvalUsdc ?? '1'\n )\n const result = await prepareWalletForPaidCalls({\n minimumApprovalUnits,\n approve: opts.checkOnly ? false : opts.approve !== false,\n })\n\n if (opts.json) {\n console.log(\n JSON.stringify(\n result,\n (_key, value) => (typeof value === 'bigint' ? value.toString() : value),\n 2\n )\n )\n return\n }\n\n console.log(formatWalletReadiness(result.readiness, result.approval))\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n }\n )\n )\n .addCommand(\n new Command('topup')\n .description('Open a local browser page to top up the payment wallet')\n .option('--no-open', 'Print the top-up URL without opening a browser')\n .option('--json', 'Print machine-readable top-up metadata')\n .action(async (opts: { open?: boolean; json?: boolean }) => {\n try {\n const { buildTopupInfo, getWalletAccount } = await import('./wallet/tools.js')\n const { startTopupServer } = await import('./wallet/topup-server.js')\n const account = await getWalletAccount()\n const url = await startTopupServer(account)\n const info = buildTopupInfo(account.address, url)\n\n if (opts.json) {\n console.log(JSON.stringify(info, null, 2))\n } else {\n console.log(`Top-up URL: ${url}`)\n console.log(`Wallet: ${account.address}`)\n console.log('Network: Base')\n console.log('Token: USDC')\n console.log('Press Ctrl+C to stop the top-up server.')\n }\n\n if (opts.open !== false) {\n const open = (await import('open')).default\n await open(url)\n }\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n\nprogram\n .command('mcp')\n .description('Interact with the Chain Insights MCP endpoint')\n .allowExcessArguments(false)\n .addCommand(\n new Command('networks')\n .description(\n 'List supported graph networks, capability layers, dataset coverage, and available tools'\n )\n .option('--json', 'Print raw capability JSON')\n .action(async (opts: { json?: boolean }) => {\n try {\n await printNetworkCapabilities(opts)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('tools')\n .description('List available MCP tools (cached 24h)')\n .option('--refresh', 'Force refresh schema cache')\n .action(async (opts: { refresh?: boolean }) => {\n try {\n const { loadSchema, saveSchema } = await import('./mcp/schema-cache.js')\n const { formatToolsTable } = await import('./mcp/format.js')\n const { visibleRemoteTools } = await import('./mcp/tool-visibility.js')\n const { loadConfig } = await import('./config/index.js')\n const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } =\n await import('./mcp/client.js')\n const config = await loadConfig()\n const graphMcpEndpoint = resolveGraphMcpEndpoint(config)\n let tools = opts.refresh ? null : await loadSchema(graphMcpEndpoint)\n if (!tools) {\n const paymentFetch = await createConfiguredGraphMcpFetch(config)\n const { Client } = await import('@modelcontextprotocol/sdk/client/index.js')\n const { StreamableHTTPClientTransport } =\n await import('@modelcontextprotocol/sdk/client/streamableHttp.js')\n const client = new Client({ name: 'chain-insights-cli', version: PACKAGE_VERSION })\n await client.connect(\n new StreamableHTTPClientTransport(new URL(graphMcpEndpoint), { fetch: paymentFetch })\n )\n try {\n const result = await client.listTools()\n tools = result.tools as Array<{ name: string; description?: string }>\n await saveSchema(tools, graphMcpEndpoint)\n } finally {\n await client.close()\n }\n }\n console.log(formatToolsTable(visibleRemoteTools(tools)))\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('aml-address-risk')\n .description(\n 'Screen an address for AML risk, exchange behavior, and optional comparison with another address'\n )\n .requiredOption('--address <address>', 'Full blockchain address to screen')\n .requiredOption(\n '--network <network>',\n 'Network to query. Run `cia mcp networks` for supported networks.'\n )\n .option(\n '--compare-address <address>',\n 'Optional second address to compare against the screened address'\n )\n .action(async (opts: { address: string; network: string; compareAddress?: string }) => {\n try {\n await withGraphMcpClient('chain-insights-cli-aml-address-risk', async (client) => {\n const { addressRisk } = await import('./investigation/public-tools.js')\n const result = await addressRisk(client, {\n address: opts.address,\n network: opts.network,\n compareAddress: opts.compareAddress,\n })\n console.log(result.summaryText)\n })\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('call')\n .description('Call an MCP tool directly (debug)')\n .argument('<tool>', 'Tool name to call')\n .argument('[args...]', 'Key=value arguments (e.g. address=0x1234... network=robinhood)')\n .action(async (tool: string, rawArgs: string[]) => {\n try {\n const { parseMcpCallArgs } = await import('./mcp/call-args.js')\n const { assertPublicMcpToolName, validatePublicMcpToolArguments } =\n await import('./mcp/tool-visibility.js')\n const args = parseMcpCallArgs(rawArgs)\n assertPublicMcpToolName(tool)\n validatePublicMcpToolArguments(tool, args)\n\n if (tool === 'wallet_balance') {\n const { getWalletBalanceText } = await import('./wallet/tools.js')\n console.log(await getWalletBalanceText())\n return\n }\n\n if (tool === 'meta_network_capabilities') {\n await printNetworkCapabilities({ json: true })\n return\n }\n\n if (tool === 'meta_help') {\n console.log(\n 'Chain Insights tools: aml_*, graph_query, graph_query_batch, meta_*, and wallet_balance.'\n )\n return\n }\n\n await withGraphMcpClient('chain-insights-cli-call', async (client, config) => {\n if (tool === 'meta_usage_status') {\n try {\n const result = await client.callTool({ name: 'usage_status', arguments: {} })\n printMcpTextContent(result as { content?: Array<{ type: string; text?: string }> })\n } catch (err) {\n const {\n isMissingUsageStatusToolError,\n primitiveBackendUsageStatus,\n usageStatusText,\n } = await import('./mcp/usage-status.js')\n if (!isMissingUsageStatusToolError(err)) throw err\n const { resolveGraphMcpEndpoint } = await import('./mcp/client.js')\n console.log(\n usageStatusText(primitiveBackendUsageStatus(resolveGraphMcpEndpoint(config)))\n )\n }\n return\n }\n if (tool === 'aml_address_risk') {\n const { addressRisk } = await import('./investigation/public-tools.js')\n const result = await addressRisk(client, {\n address: String(args['address'] ?? ''),\n network: String(args['network'] ?? ''),\n compareAddress:\n args['compare_address'] === undefined\n ? undefined\n : String(args['compare_address']),\n })\n console.log(result.summaryText)\n return\n }\n const result = await client.callTool({ name: tool, arguments: args })\n printMcpTextContent(result as { content?: Array<{ type: string; text?: string }> })\n })\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n\n// parseAsync (not parse) so a rejected async action surfaces as a clean\n// one-line error and a non-zero exit, instead of an unhandled-rejection stack\n// trace. Commands with their own try/catch still exit(1) before this fires.\nprogram.parseAsync(process.argv).catch((err) => {\n console.error((err as Error).message)\n process.exit(1)\n})\n"],"mappings":";;;;;;;;;;;;;AAYA,SAAgB,oBAAoB,QAA6B;CAC/D,MAAM,SAAS,OAAO,WAAW,CAAC,EAAA,CAC/B,QAAQ,SAAS,KAAK,SAAS,MAAM,CAAC,CACtC,KAAK,SAAS,KAAK,QAAQ,EAAE;CAEhC,IAAI,O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BAAmB,2BAA2B,OAAO,QAAQ,WAAW;GAC5E,IAAI,SAAS,qBAAqB;IAChC,IAAI;KAEF,oBAAoB,MADC,OAAO,SAAS;MAAE,MAAM;MAAgB,WAAW,CAAC;KAAE,CAAC,CACM;IACpF,SAAS,KAAK;KACZ,MAAM,EACJ,+BACA,6BACA,oBACE,MAAM,OAAO,8BAAwB,CAAA,MAAA,MAAA,EAAA,CAAA;KACzC,IAAI,CAAC,8BAA8B,GAAG,GAAG,MAAM;KAC/C,MAAM,EAAE,4BAA4B,MAAM,OAAO,wBAAkB,CAAA,MAAA,MAAA,EAAA,CAAA;KACnE,QAAQ,IACN,gBAAgB,4BAA4B,wBAAwB,MAAM,CAAC,CAAC,CAC9E;IACF;IACA;GACF;GACA,IAAI,SAAS,oBAAoB;IAC/B,MAAM,EAAE,gBAAgB,MAAM,OAAO;IACrC,MAAM,SAAS,MAAM,YAAY,QAAQ;KACvC,SAAS,OAAO,KAAK,cAAc,EAAE;KACrC,SAAS,OAAO,KAAK,cAAc,EAAE;KACrC,gBACE,KAAK,uBAAuB,KAAA,IACxB,KAAA,IACA,OAAO,KAAK,kBAAkB;IACtC,CAAC;IACD,QAAQ,IAAI,OAAO,WAAW;IAC9B;GACF;GAEA,oBAAoB,MADC,OAAO,SAAS;IAAE,MAAM;IAAM,WAAW;GAAK,CAAC,CACc;EACpF,CAAC;CACH,SAAS,KAAK;EACZ,QAAQ,MAAO,IAAc,OAAO;EACpC,QAAQ,KAAK,CAAC;CAChB;AACF,CAAC,CACL;AAKF,QAAQ,WAAW,QAAQ,IAAI,CAAC,CAAC,OAAO,QAAQ;CAC9C,QAAQ,MAAO,IAAc,OAAO;CACpC,QAAQ,KAAK,CAAC;AAChB,CAAC"}
@@ -1,6 +1,5 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
2
- const require_mcp_endpoint = require("./mcp-endpoint-BIWrUOFG.cjs");
3
- const require_schema = require("./schema-BpeV3xDV.cjs");
2
+ const require_schema = require("./schema-CtFWYoJz.cjs");
4
3
  let node_path = require("node:path");
5
4
  node_path = require_rolldown_runtime.__toESM(node_path, 1);
6
5
  let node_fs_promises = require("node:fs/promises");
@@ -19,7 +18,7 @@ let _cached = null;
19
18
  function applyRuntimeEnvOverrides(config) {
20
19
  let graphMcpEndpoint;
21
20
  try {
22
- graphMcpEndpoint = require_mcp_endpoint.graphMcpEndpointEnvOverride();
21
+ graphMcpEndpoint = require_schema.graphMcpEndpointEnvOverride();
23
22
  } catch (err) {
24
23
  throw new Error(`Invalid configuration in environment: ${err.message}`);
25
24
  }
@@ -1,6 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
- import { n as graphMcpEndpointEnvOverride } from "./mcp-endpoint-DbWtLcba.mjs";
3
- import { n as parseInvestigatorConfig, t as DEFAULT_CONFIG } from "./schema-DOJA2nNi.mjs";
2
+ import { i as graphMcpEndpointEnvOverride, n as parseInvestigatorConfig, t as DEFAULT_CONFIG } from "./schema-B0OuHW_l.mjs";
4
3
  import path from "node:path";
5
4
  import { mkdir, readFile, writeFile } from "node:fs/promises";
6
5
  import os from "node:os";
@@ -74,4 +73,4 @@ async function resetConfigCache() {
74
73
  //#endregion
75
74
  export { saveConfig as i, loadConfig as n, resetConfigCache as r, config_exports as t };
76
75
 
77
- //# sourceMappingURL=config-CnNMdt4M.mjs.map
76
+ //# sourceMappingURL=config-DbbPiGk0.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-CnNMdt4M.mjs","names":[],"sources":["../src/config/index.ts"],"sourcesContent":["import { readFile, writeFile, mkdir } from 'node:fs/promises'\nimport path from 'node:path'\nimport os from 'node:os'\nimport { DEFAULT_CONFIG, parseInvestigatorConfig, type InvestigatorConfig } from './schema.js'\nimport { graphMcpEndpointEnvOverride } from './mcp-endpoint.js'\n\n// Config path derived from HOME at call time so tests can override HOME.\nfunction configPath(): string {\n return path.join(os.homedir(), '.chain-insights', 'config.json')\n}\n\nlet _cached: InvestigatorConfig | null = null\n\nfunction applyRuntimeEnvOverrides(config: InvestigatorConfig): InvestigatorConfig {\n let graphMcpEndpoint: string | undefined\n try {\n graphMcpEndpoint = graphMcpEndpointEnvOverride()\n } catch (err) {\n throw new Error(`Invalid configuration in environment: ${(err as Error).message}`)\n }\n return graphMcpEndpoint ? parseInvestigatorConfig({ ...config, graphMcpEndpoint }) : config\n}\n\nasync function loadStoredConfig(): Promise<InvestigatorConfig> {\n const cfgPath = configPath()\n let raw: string\n try {\n raw = await readFile(cfgPath, 'utf8')\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') {\n return DEFAULT_CONFIG\n }\n throw new Error(`Unable to read config ${cfgPath}: ${(err as Error).message}`)\n }\n\n let parsedJson: unknown\n try {\n parsedJson = JSON.parse(raw) as unknown\n } catch (err) {\n throw new Error(`Invalid JSON in ${cfgPath}: ${(err as Error).message}`)\n }\n\n try {\n return parseInvestigatorConfig(parsedJson)\n } catch (err) {\n throw new Error(`Invalid configuration in ${cfgPath}: ${(err as Error).message}`)\n }\n}\n\nexport async function loadConfig(): Promise<InvestigatorConfig> {\n if (_cached) return _cached\n _cached = applyRuntimeEnvOverrides(await loadStoredConfig())\n return _cached\n}\n\nexport async function saveConfig(updates: Partial<InvestigatorConfig>): Promise<void> {\n const current = await loadStoredConfig()\n let next: InvestigatorConfig\n try {\n next = parseInvestigatorConfig({ ...current, ...updates })\n } catch (err) {\n throw new Error(`Invalid configuration update: ${(err as Error).message}`)\n }\n const p = configPath()\n await mkdir(path.dirname(p), { recursive: true })\n await writeFile(p, JSON.stringify(next, null, 2) + '\\n', { mode: 0o600 })\n _cached = applyRuntimeEnvOverrides(next)\n}\n\nexport async function resetConfigCache(): Promise<void> {\n _cached = null\n}\n"],"mappings":";;;;;;;;;;;;AAOA,SAAS,aAAqB;CAC5B,OAAO,KAAK,KAAK,GAAG,QAAQ,GAAG,mBAAmB,aAAa;AACjE;AAEA,IAAI,UAAqC;AAEzC,SAAS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mBAAkC;CACtD,UAAU;AACZ"}
1
+ {"version":3,"file":"config-DbbPiGk0.mjs","names":[],"sources":["../src/config/index.ts"],"sourcesContent":["import { readFile, writeFile, mkdir } from 'node:fs/promises'\nimport path from 'node:path'\nimport os from 'node:os'\nimport { DEFAULT_CONFIG, parseInvestigatorConfig, type InvestigatorConfig } from './schema.js'\nimport { graphMcpEndpointEnvOverride } from './mcp-endpoint.js'\n\n// Config path derived from HOME at call time so tests can override HOME.\nfunction configPath(): string {\n return path.join(os.homedir(), '.chain-insights', 'config.json')\n}\n\nlet _cached: InvestigatorConfig | null = null\n\nfunction applyRuntimeEnvOverrides(config: InvestigatorConfig): InvestigatorConfig {\n let graphMcpEndpoint: string | undefined\n try {\n graphMcpEndpoint = graphMcpEndpointEnvOverride()\n } catch (err) {\n throw new Error(`Invalid configuration in environment: ${(err as Error).message}`)\n }\n return graphMcpEndpoint ? parseInvestigatorConfig({ ...config, graphMcpEndpoint }) : config\n}\n\nasync function loadStoredConfig(): Promise<InvestigatorConfig> {\n const cfgPath = configPath()\n let raw: string\n try {\n raw = await readFile(cfgPath, 'utf8')\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') {\n return DEFAULT_CONFIG\n }\n throw new Error(`Unable to read config ${cfgPath}: ${(err as Error).message}`)\n }\n\n let parsedJson: unknown\n try {\n parsedJson = JSON.parse(raw) as unknown\n } catch (err) {\n throw new Error(`Invalid JSON in ${cfgPath}: ${(err as Error).message}`)\n }\n\n try {\n return parseInvestigatorConfig(parsedJson)\n } catch (err) {\n throw new Error(`Invalid configuration in ${cfgPath}: ${(err as Error).message}`)\n }\n}\n\nexport async function loadConfig(): Promise<InvestigatorConfig> {\n if (_cached) return _cached\n _cached = applyRuntimeEnvOverrides(await loadStoredConfig())\n return _cached\n}\n\nexport async function saveConfig(updates: Partial<InvestigatorConfig>): Promise<void> {\n const current = await loadStoredConfig()\n let next: InvestigatorConfig\n try {\n next = parseInvestigatorConfig({ ...current, ...updates })\n } catch (err) {\n throw new Error(`Invalid configuration update: ${(err as Error).message}`)\n }\n const p = configPath()\n await mkdir(path.dirname(p), { recursive: true })\n await writeFile(p, JSON.stringify(next, null, 2) + '\\n', { mode: 0o600 })\n _cached = applyRuntimeEnvOverrides(next)\n}\n\nexport async function resetConfigCache(): Promise<void> {\n _cached = null\n}\n"],"mappings":";;;;;;;;;;;AAOA,SAAS,aAAqB;CAC5B,OAAO,KAAK,KAAK,GAAG,QAAQ,GAAG,mBAAmB,aAAa;AACjE;AAEA,IAAI,UAAqC;AAEzC,SAAS,yBAAyB,QAAgD;CAChF,IAAI;CACJ,IAAI;EACF,mBAAmB,4BAA4B;CACjD,SAAS,KAAK;EACZ,MAAM,IAAI,MAAM,yCAA0C,IAAc,SAAS;CACnF;CACA,OAAO,mBAAmB,wBAAwB;EAAE,GAAG;EAAQ;CAAiB,CAAC,IAAI;AACvF;AAEA,eAAe,mBAAgD;CAC7D,MAAM,UAAU,WAAW;CAC3B,IAAI;CACJ,IAAI;EACF,MAAM,MAAM,SAAS,SAAS,MAAM;CACtC,SAAS,KAAK;EACZ,IAAK,IAA8B,SAAS,UAC1C,OAAO;EAET,MAAM,IAAI,MAAM,yBAAyB,QAAQ,IAAK,IAAc,SAAS;CAC/E;CAEA,IAAI;CACJ,IAAI;EACF,aAAa,KAAK,MAAM,GAAG;CAC7B,SAAS,KAAK;EACZ,MAAM,IAAI,MAAM,mBAAmB,QAAQ,IAAK,IAAc,SAAS;CACzE;CAEA,IAAI;EACF,OAAO,wBAAwB,UAAU;CAC3C,SAAS,KAAK;EACZ,MAAM,IAAI,MAAM,4BAA4B,QAAQ,IAAK,IAAc,SAAS;CAClF;AACF;AAEA,eAAsB,aAA0C;CAC9D,IAAI,SAAS,OAAO;CACpB,UAAU,yBAAyB,MAAM,iBAAiB,CAAC;CAC3D,OAAO;AACT;AAEA,eAAsB,WAAW,SAAqD;CACpF,MAAM,UAAU,MAAM,iBAAiB;CACvC,IAAI;CACJ,IAAI;EACF,OAAO,wBAAwB;GAAE,GAAG;GAAS,GAAG;EAAQ,CAAC;CAC3D,SAAS,KAAK;EACZ,MAAM,IAAI,MAAM,iCAAkC,IAAc,SAAS;CAC3E;CACA,MAAM,IAAI,WAAW;CACrB,MAAM,MAAM,KAAK,QAAQ,CAAC,GAAG,EAAE,WAAW,KAAK,CAAC;CAChD,MAAM,UAAU,GAAG,KAAK,UAAU,MAAM,MAAM,CAAC,IAAI,MAAM,EAAE,MAAM,IAAM,CAAC;CACxE,UAAU,yBAAyB,IAAI;AACzC;AAEA,eAAsB,mBAAkC;CACtD,UAAU;AACZ"}
@@ -0,0 +1,16 @@
1
+ import { fileURLToPath } from "node:url";
2
+ import path from "node:path";
3
+ import { readFileSync } from "node:fs";
4
+ import "node:fs/promises";
5
+ //#region src/viz/html-generator.ts
6
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
+ const templatePath = path.resolve(__dirname, "templates", "graph.html");
8
+ const template = readFileSync(templatePath, "utf-8");
9
+ function generateInlineGraphHtml(data) {
10
+ const inlineScript = `<script>var INLINE_DATA = ${JSON.stringify(data).replaceAll("<\/script>", "<\\/script>")};<\/script>`;
11
+ return template.replace("</body>", `${inlineScript}\n</body>`);
12
+ }
13
+ //#endregion
14
+ export { generateInlineGraphHtml };
15
+
16
+ //# sourceMappingURL=html-generator-BCDtYcGs.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"html-generator-D2BDzLED.mjs","names":[],"sources":["../src/viz/html-generator.ts"],"sourcesContent":["import { readFileSync } from 'node:fs'\nimport { writeFile, mkdir } from 'node:fs/promises'\nimport { fileURLToPath } from 'node:url'\nimport path from 'node:path'\nimport type { GraphData } from './graph-model.js'\nimport { workspaceOutputPaths } from '../workspace/output-root.js'\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url))\nconst templatePath = path.resolve(__dirname, 'templates', 'graph.html')\nconst template = readFileSync(templatePath, 'utf-8')\n\ninterface GraphHtmlNode {\n address: string\n node_kind: string\n labels: string[]\n flow_in_usd: number\n flow_out_usd: number\n role: string | null\n risk_level: string | null\n pattern_flags: string[]\n}\n\ninterface GraphHtmlEdge {\n source: string\n target: string\n usd_amount: number\n tx_count: number\n edge_type: string\n}\n\ninterface GraphHtmlData {\n nodes: GraphHtmlNode[]\n edges: GraphHtmlEdge[]\n metadata?: { seed_address?: string; title?: string }\n}\n\nconst ENTITY_TO_ROLE: Record<string, string | null> = {\n eoa: 'search',\n contract: 'intermediary',\n exchange: 'exchange',\n mixer: 'intermediary',\n hub: 'intermediary',\n unknown: null,\n}\n\nexport function transformToGraphHtml(data: GraphData): GraphHtmlData {\n const nodes: GraphHtmlNode[] = data.nodes.map((n) => ({\n address: n.id,\n node_kind: n.entityType === 'exchange' ? 'exchange' : 'wallet',\n labels: n.label ? [n.label] : [],\n flow_in_usd: n.totalIn,\n flow_out_usd: n.totalOut,\n role: ENTITY_TO_ROLE[n.entityType] ?? null,\n risk_level: n.riskLevel === 'unknown' ? null : n.riskLevel,\n pattern_flags: [],\n }))\n\n const edges: GraphHtmlEdge[] = data.edges.map((e) => ({\n source: e.source,\n target: e.target,\n usd_amount: e.value,\n tx_count: 1,\n edge_type: e.edgeType,\n }))\n\n return {\n nodes,\n edges,\n metadata: {\n title: data.metadata.title,\n },\n }\n}\n\nexport function generateHtml(data: GraphData, _title: string): string {\n const graphHtmlData = transformToGraphHtml(data)\n return generateInlineGraphHtml(graphHtmlData)\n}\n\nexport function generateInlineGraphHtml(data: unknown): string {\n const dataJson = JSON.stringify(data).replaceAll('</script>', '<\\\\/script>')\n const inlineScript = `<script>var INLINE_DATA = ${dataJson};</script>`\n\n return template.replace('</body>', `${inlineScript}\\n</body>`)\n}\n\nfunction sanitizePathSegment(segment: string): string {\n if (/[/\\\\]|^\\.\\.?$/.test(segment)) throw new Error(`Invalid path segment: ${segment}`)\n return segment\n}\n\nexport async function writeVizHtml(vizId: string, html: string): Promise<string> {\n const paths = workspaceOutputPaths()\n const vizDir = path.join(paths.publishedRoot, 'viz')\n sanitizePathSegment(vizId)\n await mkdir(vizDir, { recursive: true })\n const filePath = path.join(vizDir, `${vizId}.html`)\n await writeFile(filePath, html, { mode: 0o600 })\n return filePath\n}\n"],"mappings":";;;;;;;;;;;;;AAOA,MAAM,YAAY,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC;AAC7D,MAAM,eAAe,KAAK,QAAQ,WAAW,aAAa,YAAY;AACtE,MAAM,WAAW,aAAa,cAAc,OAAO;AA2BnD,MAAM,iBAAgD;CACpD,KAAK;CACL,UAAU;CACV,UAAU;CACV,OAAO;CACP,KAAK;CACL,SAAS;AACX;AAEA,SAAgB,qBAAqB,MAAgC;CAoBnE,OAAO;EACL,OApB6B,KAAK,MAAM,KAAK,OAAO;GACpD,SAAS,EAAE;GACX,WAAW,EAAE,eAAe,aAAa,aAAa;GACtD,QAAQ,EAAE,QAAQ,CAAC,EAAE,KAAK,IAAI,CAAC;GAC/B,aAAa,EAAE;GACf,cAAc,EAAE;GAChB,MAAM,eAAe,EAAE,eAAe;GACtC,YAAY,EAAE,cAAc,YAAY,OAAO,EAAE;GACjD,eAAe,CAAC;EAClB,EAWM;EACJ,OAV6B,KAAK,MAAM,KAAK,OAAO;GACpD,QAAQ,EAAE;GACV,QAAQ,EAAE;GACV,YAAY,EAAE;GACd,UAAU;GACV,WAAW,EAAE;EACf,EAIM;EACJ,UAAU,EACR,OAAO,KAAK,SAAS,MACvB;CACF;AACF;AAEA,SAAgB,aAAa,MAAiB,QAAwB;CAEpE,OAAO,wBADe,qBAAqB,IACA,CAAC;AAC9C;AAEA,SAAgB,wBAAwB,MAAuB;CAE7D,MAAM,eAAe,6BADJ,KAAK,UAAU,IAAI,CAAC,CAAC,WAAW,cAAa,aACL,EAAE;CAE3D,OAAO,SAAS,QAAQ,WAAW,GAAG,aAAa,UAAU;AAC/D;AAEA,SAAS,oBAAoB,SAAyB;CACpD,IAAI,gBAAgB,KAAK,OAAO,GAAG,MAAM,IAAI,MAAM,yBAAyB,SAAS;CACrF,OAAO;AACT;AAEA,eAAsB,aAAa,OAAe,MAA+B;CAC/E,MAAM,QAAQ,qBAAqB;CACnC,MAAM,SAAS,KAAK,KAAK,MAAM,eAAe,KAAK;CACnD,oBAAoB,KAAK;CACzB,MAAM,MAAM,QAAQ,EAAE,WAAW,KAAK,CAAC;CACvC,MAAM,WAAW,KAAK,KAAK,QAAQ,GAAG,MAAM,MAAM;CAClD,MAAM,UAAU,UAAU,MAAM,EAAE,MAAM,IAAM,CAAC;CAC/C,OAAO;AACT"}
1
+ {"version":3,"file":"html-generator-BCDtYcGs.mjs","names":[],"sources":["../src/viz/html-generator.ts"],"sourcesContent":["import { readFileSync } from 'node:fs'\nimport { writeFile, mkdir } from 'node:fs/promises'\nimport { fileURLToPath } from 'node:url'\nimport path from 'node:path'\nimport type { GraphData } from './graph-model.js'\nimport { workspaceOutputPaths } from '../workspace/output-root.js'\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url))\nconst templatePath = path.resolve(__dirname, 'templates', 'graph.html')\nconst template = readFileSync(templatePath, 'utf-8')\n\ninterface GraphHtmlNode {\n address: string\n node_kind: string\n labels: string[]\n flow_in_usd: number\n flow_out_usd: number\n role: string | null\n risk_level: string | null\n pattern_flags: string[]\n}\n\ninterface GraphHtmlEdge {\n source: string\n target: string\n usd_amount: number\n tx_count: number\n edge_type: string\n}\n\ninterface GraphHtmlData {\n nodes: GraphHtmlNode[]\n edges: GraphHtmlEdge[]\n metadata?: { seed_address?: string; title?: string }\n}\n\nconst ENTITY_TO_ROLE: Record<string, string | null> = {\n eoa: 'search',\n contract: 'intermediary',\n exchange: 'exchange',\n mixer: 'intermediary',\n hub: 'intermediary',\n unknown: null,\n}\n\nexport function transformToGraphHtml(data: GraphData): GraphHtmlData {\n const nodes: GraphHtmlNode[] = data.nodes.map((n) => ({\n address: n.id,\n node_kind: n.entityType === 'exchange' ? 'exchange' : 'wallet',\n labels: n.label ? [n.label] : [],\n flow_in_usd: n.totalIn,\n flow_out_usd: n.totalOut,\n role: ENTITY_TO_ROLE[n.entityType] ?? null,\n risk_level: n.riskLevel === 'unknown' ? null : n.riskLevel,\n pattern_flags: [],\n }))\n\n const edges: GraphHtmlEdge[] = data.edges.map((e) => ({\n source: e.source,\n target: e.target,\n usd_amount: e.value,\n tx_count: 1,\n edge_type: e.edgeType,\n }))\n\n return {\n nodes,\n edges,\n metadata: {\n title: data.metadata.title,\n },\n }\n}\n\nexport function generateHtml(data: GraphData, _title: string): string {\n const graphHtmlData = transformToGraphHtml(data)\n return generateInlineGraphHtml(graphHtmlData)\n}\n\nexport function generateInlineGraphHtml(data: unknown): string {\n const dataJson = JSON.stringify(data).replaceAll('</script>', '<\\\\/script>')\n const inlineScript = `<script>var INLINE_DATA = ${dataJson};</script>`\n\n return template.replace('</body>', `${inlineScript}\\n</body>`)\n}\n\nfunction sanitizePathSegment(segment: string): string {\n if (/[/\\\\]|^\\.\\.?$/.test(segment)) throw new Error(`Invalid path segment: ${segment}`)\n return segment\n}\n\nexport async function writeVizHtml(vizId: string, html: string): Promise<string> {\n const paths = workspaceOutputPaths()\n const vizDir = path.join(paths.publishedRoot, 'viz')\n sanitizePathSegment(vizId)\n await mkdir(vizDir, { recursive: true })\n const filePath = path.join(vizDir, `${vizId}.html`)\n await writeFile(filePath, html, { mode: 0o600 })\n return filePath\n}\n"],"mappings":";;;;;AAOA,MAAM,YAAY,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC;AAC7D,MAAM,eAAe,KAAK,QAAQ,WAAW,aAAa,YAAY;AACtE,MAAM,WAAW,aAAa,cAAc,OAAO;AAsEnD,SAAgB,wBAAwB,MAAuB;CAE7D,MAAM,eAAe,6BADJ,KAAK,UAAU,IAAI,CAAC,CAAC,WAAW,cAAa,aACL,EAAE;CAE3D,OAAO,SAAS,QAAQ,WAAW,GAAG,aAAa,UAAU;AAC/D"}
@@ -0,0 +1,16 @@
1
+ const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
2
+ let node_url = require("node:url");
3
+ let node_path = require("node:path");
4
+ node_path = require_rolldown_runtime.__toESM(node_path, 1);
5
+ let node_fs = require("node:fs");
6
+ require("node:fs/promises");
7
+ //#region src/viz/html-generator.ts
8
+ const __dirname$1 = node_path.default.dirname((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
9
+ const templatePath = node_path.default.resolve(__dirname$1, "templates", "graph.html");
10
+ const template = (0, node_fs.readFileSync)(templatePath, "utf-8");
11
+ function generateInlineGraphHtml(data) {
12
+ const inlineScript = `<script>var INLINE_DATA = ${JSON.stringify(data).replaceAll("<\/script>", "<\\/script>")};<\/script>`;
13
+ return template.replace("</body>", `${inlineScript}\n</body>`);
14
+ }
15
+ //#endregion
16
+ exports.generateInlineGraphHtml = generateInlineGraphHtml;
package/dist/index.cjs CHANGED
@@ -1,22 +1,17 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_config = require("./config-BVFf3v8-.cjs");
3
- const require_app = require("./app-l9JE6bt3.cjs");
4
- const require_server = require("./server-CmvzYu7v.cjs");
2
+ const require_config = require("./config-B542AM4w.cjs");
5
3
  const require_wallet = require("./wallet-BEvHrHi3.cjs");
6
4
  const require_tools = require("./tools-lPY6k-vJ.cjs");
7
- const require_topup_server = require("./topup-server-DAqmAuu1.cjs");
5
+ const require_topup_server = require("./topup-server-YN3iHrHW.cjs");
8
6
  const require_client = require("./client-CqAzD519.cjs");
9
7
  const require_merge = require("./merge-C52eaAGU.cjs");
10
- const require_viz = require("./viz-BJ_kyRjI.cjs");
11
8
  exports.buildTopupInfo = require_tools.buildTopupInfo;
12
- exports.createApp = require_app.createApp;
13
9
  exports.createMcpFetchClient = require_client.createMcpFetchClient;
14
10
  exports.decryptKey = require_wallet.decryptKey;
15
11
  exports.encryptKey = require_wallet.encryptKey;
16
12
  exports.formatWalletBalance = require_tools.formatWalletBalance;
17
13
  exports.formatWalletBalanceResult = require_tools.formatWalletBalanceResult;
18
14
  exports.generateArtifactHtml = require_topup_server.generateArtifactHtml;
19
- exports.generateVisualization = require_viz.generateVisualization;
20
15
  exports.getBalanceEth = require_tools.getBalanceEth;
21
16
  exports.getBalanceUsdc = require_tools.getBalanceUsdc;
22
17
  exports.getTopupUrl = require_topup_server.getTopupUrl;
@@ -30,6 +25,5 @@ exports.normalizeWalletPrivateKey = require_wallet.normalizeWalletPrivateKey;
30
25
  exports.resetConfigCache = require_config.resetConfigCache;
31
26
  exports.saveConfig = require_config.saveConfig;
32
27
  exports.setWalletPrivateKey = require_wallet.setWalletPrivateKey;
33
- exports.startServer = require_server.startServer;
34
28
  exports.startTopupServer = require_topup_server.startTopupServer;
35
29
  exports.walletAddressFromPrivateKey = require_wallet.walletAddressFromPrivateKey;