chain-insights 0.22.3 → 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.
- package/README.md +21 -43
- package/dist/cli.cjs +21 -83
- package/dist/cli.mjs +21 -83
- package/dist/cli.mjs.map +1 -1
- package/dist/{config-DYiUgdzg.cjs → config-B542AM4w.cjs} +2 -3
- package/dist/{config-DiQs0rQX.mjs → config-DbbPiGk0.mjs} +2 -3
- package/dist/{config-DiQs0rQX.mjs.map → config-DbbPiGk0.mjs.map} +1 -1
- package/dist/html-generator-BCDtYcGs.mjs +16 -0
- package/dist/{html-generator-D2BDzLED.mjs.map → html-generator-BCDtYcGs.mjs.map} +1 -1
- package/dist/html-generator-DFwMRWN3.cjs +16 -0
- package/dist/index.cjs +2 -8
- package/dist/index.d.cts +1 -99
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -99
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -6
- package/dist/mcp-proxy.cjs +35 -156
- package/dist/mcp-proxy.d.cts.map +1 -1
- package/dist/mcp-proxy.d.mts.map +1 -1
- package/dist/mcp-proxy.mjs +35 -156
- package/dist/mcp-proxy.mjs.map +1 -1
- package/dist/{public-tools-BFs_7U_Z.cjs → public-tools-Bou25cki.cjs} +153 -5
- package/dist/{public-tools-BjqZGGAC.mjs → public-tools-CpOLkME5.mjs} +152 -4
- package/dist/public-tools-CpOLkME5.mjs.map +1 -0
- package/dist/{schema-v5cwychf.mjs → schema-B0OuHW_l.mjs} +63 -4
- package/dist/schema-B0OuHW_l.mjs.map +1 -0
- package/dist/{schema-DepyuUEP.cjs → schema-CtFWYoJz.cjs} +72 -7
- package/dist/{tool-visibility-DZBAP62b.cjs → tool-visibility-C8F9Yoxy.cjs} +1 -2
- package/dist/{tool-visibility-C0ALejXI.mjs → tool-visibility-CXbwfKhv.mjs} +2 -3
- package/dist/tool-visibility-CXbwfKhv.mjs.map +1 -0
- package/dist/{topup-server-rqI7bqem.mjs → topup-server-BLdF1SFQ.mjs} +2 -2
- package/dist/topup-server-BLdF1SFQ.mjs.map +1 -0
- package/dist/{topup-server-DAqmAuu1.cjs → topup-server-YN3iHrHW.cjs} +1 -1
- package/dist/{update-CJUfGCxs.mjs → update-MsoEFbhn.mjs} +2 -36
- package/dist/{update-CJUfGCxs.mjs.map → update-MsoEFbhn.mjs.map} +1 -1
- package/dist/{update-BJoXYucO.cjs → update-RKd0UW90.cjs} +0 -35
- package/docs/architecture.md +13 -44
- package/docs/contributing.md +0 -3
- package/docs/development.md +3 -5
- package/docs/graph-tools.md +4 -29
- package/docs/mcp-proxy.md +3 -27
- package/docs/stability.md +0 -12
- package/package.json +3 -4
- package/skills/chain-insights-address-risk/SKILL.md +0 -1
- package/dist/app-BHRl5oDo.cjs +0 -145
- package/dist/app-BeZyCVuz.mjs +0 -140
- package/dist/app-BeZyCVuz.mjs.map +0 -1
- package/dist/artifact-server-B8WKXtXr.cjs +0 -47
- package/dist/artifact-server-C1fETWsc.mjs +0 -49
- package/dist/artifact-server-C1fETWsc.mjs.map +0 -1
- package/dist/graph-normalizer-B2Q2lgVy.cjs +0 -130
- package/dist/graph-normalizer-BA3Rbd6l.mjs +0 -127
- package/dist/graph-normalizer-BA3Rbd6l.mjs.map +0 -1
- package/dist/graph-reports-B6yoYbPq.mjs +0 -63
- package/dist/graph-reports-B6yoYbPq.mjs.map +0 -1
- package/dist/graph-reports-_gqzxvvs.cjs +0 -64
- package/dist/html-generator-B9f_GIi2.cjs +0 -86
- package/dist/html-generator-D2BDzLED.mjs +0 -70
- package/dist/init-C3AVZHFb.cjs +0 -319
- package/dist/init-CO-PRYhT.mjs +0 -319
- package/dist/init-CO-PRYhT.mjs.map +0 -1
- package/dist/limits-D3Mn-gig.mjs +0 -94
- package/dist/limits-D3Mn-gig.mjs.map +0 -1
- package/dist/limits-km3pmmL3.cjs +0 -115
- package/dist/mcp-endpoint-Bd3SvCkg.mjs +0 -41
- package/dist/mcp-endpoint-Bd3SvCkg.mjs.map +0 -1
- package/dist/mcp-endpoint-DdIVQKW5.cjs +0 -56
- package/dist/output-root-BK4pdjyz.mjs +0 -36
- package/dist/output-root-BK4pdjyz.mjs.map +0 -1
- package/dist/output-root-BewoQaTx.cjs +0 -46
- package/dist/public-tools-BjqZGGAC.mjs.map +0 -1
- package/dist/resolve-port-CbaEoODz.cjs +0 -18
- package/dist/resolve-port-DxPK7Ipx.mjs +0 -20
- package/dist/resolve-port-DxPK7Ipx.mjs.map +0 -1
- package/dist/schema-v5cwychf.mjs.map +0 -1
- package/dist/server-BDmHAF1w.mjs +0 -46
- package/dist/server-BDmHAF1w.mjs.map +0 -1
- package/dist/server-BjprY9Ef.cjs +0 -55
- package/dist/templates/graph.html +0 -1450
- package/dist/tool-visibility-C0ALejXI.mjs.map +0 -1
- package/dist/topup-server-rqI7bqem.mjs.map +0 -1
- package/dist/viz-BJ_kyRjI.cjs +0 -217
- package/dist/viz-Uh_EF-qB.mjs +0 -206
- package/dist/viz-Uh_EF-qB.mjs.map +0 -1
- package/docs/images/graph-mcp-iframe.png +0 -0
- package/docs/images/graph-visualization.png +0 -0
- package/docs/images/quickstart-demo.svg +0 -1
- package/docs/investigation-workspaces.md +0 -108
- package/docs/search-limits.md +0 -73
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":";;;;;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],"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\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,EA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
|
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 =
|
|
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 {
|
|
3
|
-
import { n as parseInvestigatorConfig, t as DEFAULT_CONFIG } from "./schema-v5cwychf.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-
|
|
76
|
+
//# sourceMappingURL=config-DbbPiGk0.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-
|
|
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":";;;;;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AAU,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-
|
|
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-
|
|
3
|
-
const require_app = require("./app-BHRl5oDo.cjs");
|
|
4
|
-
const require_server = require("./server-BjprY9Ef.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-
|
|
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;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
|
-
import { Hono } from "hono";
|
|
3
2
|
import { Address, Hex } from "viem";
|
|
4
3
|
//#region src/config/schema.d.ts
|
|
5
4
|
declare const ConfigSchema: z.ZodObject<{
|
|
@@ -26,12 +25,6 @@ declare function loadConfig(): Promise<InvestigatorConfig>;
|
|
|
26
25
|
declare function saveConfig(updates: Partial<InvestigatorConfig>): Promise<void>;
|
|
27
26
|
declare function resetConfigCache(): Promise<void>;
|
|
28
27
|
//#endregion
|
|
29
|
-
//#region src/server/app.d.ts
|
|
30
|
-
declare function createApp(): Hono;
|
|
31
|
-
//#endregion
|
|
32
|
-
//#region src/server/index.d.ts
|
|
33
|
-
declare function startServer(port?: number): () => void;
|
|
34
|
-
//#endregion
|
|
35
28
|
//#region src/wallet/index.d.ts
|
|
36
29
|
declare function normalizeWalletPrivateKey(value: string): Hex;
|
|
37
30
|
declare function walletAddressFromPrivateKey(privateKey: string): Address;
|
|
@@ -177,96 +170,5 @@ interface MergedResult {
|
|
|
177
170
|
}
|
|
178
171
|
declare function mergeShardRows(rows: ShardRow[], opts?: MergeOptions): MergedResult;
|
|
179
172
|
//#endregion
|
|
180
|
-
|
|
181
|
-
declare const GraphNode: z.ZodObject<{
|
|
182
|
-
id: z.ZodString;
|
|
183
|
-
label: z.ZodOptional<z.ZodString>;
|
|
184
|
-
entityType: z.ZodDefault<z.ZodEnum<{
|
|
185
|
-
contract: "contract";
|
|
186
|
-
eoa: "eoa";
|
|
187
|
-
exchange: "exchange";
|
|
188
|
-
hub: "hub";
|
|
189
|
-
mixer: "mixer";
|
|
190
|
-
unknown: "unknown";
|
|
191
|
-
}>>;
|
|
192
|
-
riskLevel: z.ZodDefault<z.ZodEnum<{
|
|
193
|
-
critical: "critical";
|
|
194
|
-
high: "high";
|
|
195
|
-
low: "low";
|
|
196
|
-
medium: "medium";
|
|
197
|
-
unknown: "unknown";
|
|
198
|
-
unscored: "unscored";
|
|
199
|
-
}>>;
|
|
200
|
-
totalIn: z.ZodDefault<z.ZodNumber>;
|
|
201
|
-
totalOut: z.ZodDefault<z.ZodNumber>;
|
|
202
|
-
txCount: z.ZodDefault<z.ZodNumber>;
|
|
203
|
-
firstSeen: z.ZodOptional<z.ZodString>;
|
|
204
|
-
lastSeen: z.ZodOptional<z.ZodString>;
|
|
205
|
-
}, z.core.$strip>;
|
|
206
|
-
type GraphNode = z.infer<typeof GraphNode>;
|
|
207
|
-
declare const GraphEdge: z.ZodObject<{
|
|
208
|
-
source: z.ZodString;
|
|
209
|
-
target: z.ZodString;
|
|
210
|
-
value: z.ZodNumber;
|
|
211
|
-
edgeType: z.ZodDefault<z.ZodString>;
|
|
212
|
-
txHash: z.ZodOptional<z.ZodString>;
|
|
213
|
-
blockNumber: z.ZodOptional<z.ZodNumber>;
|
|
214
|
-
timestamp: z.ZodOptional<z.ZodString>;
|
|
215
|
-
}, z.core.$strip>;
|
|
216
|
-
type GraphEdge = z.infer<typeof GraphEdge>;
|
|
217
|
-
declare const GraphData: z.ZodObject<{
|
|
218
|
-
nodes: z.ZodArray<z.ZodObject<{
|
|
219
|
-
id: z.ZodString;
|
|
220
|
-
label: z.ZodOptional<z.ZodString>;
|
|
221
|
-
entityType: z.ZodDefault<z.ZodEnum<{
|
|
222
|
-
contract: "contract";
|
|
223
|
-
eoa: "eoa";
|
|
224
|
-
exchange: "exchange";
|
|
225
|
-
hub: "hub";
|
|
226
|
-
mixer: "mixer";
|
|
227
|
-
unknown: "unknown";
|
|
228
|
-
}>>;
|
|
229
|
-
riskLevel: z.ZodDefault<z.ZodEnum<{
|
|
230
|
-
critical: "critical";
|
|
231
|
-
high: "high";
|
|
232
|
-
low: "low";
|
|
233
|
-
medium: "medium";
|
|
234
|
-
unknown: "unknown";
|
|
235
|
-
unscored: "unscored";
|
|
236
|
-
}>>;
|
|
237
|
-
totalIn: z.ZodDefault<z.ZodNumber>;
|
|
238
|
-
totalOut: z.ZodDefault<z.ZodNumber>;
|
|
239
|
-
txCount: z.ZodDefault<z.ZodNumber>;
|
|
240
|
-
firstSeen: z.ZodOptional<z.ZodString>;
|
|
241
|
-
lastSeen: z.ZodOptional<z.ZodString>;
|
|
242
|
-
}, z.core.$strip>>;
|
|
243
|
-
edges: z.ZodArray<z.ZodObject<{
|
|
244
|
-
source: z.ZodString;
|
|
245
|
-
target: z.ZodString;
|
|
246
|
-
value: z.ZodNumber;
|
|
247
|
-
edgeType: z.ZodDefault<z.ZodString>;
|
|
248
|
-
txHash: z.ZodOptional<z.ZodString>;
|
|
249
|
-
blockNumber: z.ZodOptional<z.ZodNumber>;
|
|
250
|
-
timestamp: z.ZodOptional<z.ZodString>;
|
|
251
|
-
}, z.core.$strip>>;
|
|
252
|
-
metadata: z.ZodObject<{
|
|
253
|
-
title: z.ZodDefault<z.ZodString>;
|
|
254
|
-
generatedAt: z.ZodString;
|
|
255
|
-
truncated: z.ZodDefault<z.ZodBoolean>;
|
|
256
|
-
totalNodes: z.ZodOptional<z.ZodNumber>;
|
|
257
|
-
hiddenNodes: z.ZodOptional<z.ZodNumber>;
|
|
258
|
-
}, z.core.$strip>;
|
|
259
|
-
}, z.core.$strip>;
|
|
260
|
-
type GraphData = z.infer<typeof GraphData>;
|
|
261
|
-
//#endregion
|
|
262
|
-
//#region src/viz/index.d.ts
|
|
263
|
-
declare function generateVisualization(opts: {
|
|
264
|
-
sourceId?: string;
|
|
265
|
-
dataFile?: string;
|
|
266
|
-
}): Promise<{
|
|
267
|
-
vizId: string;
|
|
268
|
-
htmlPath: string;
|
|
269
|
-
}>;
|
|
270
|
-
//#endregion
|
|
271
|
-
export { type GraphData as GraphDataType, type GraphEdge as GraphEdgeType, type GraphNode as GraphNodeType, type InvestigatorConfig, type MergeOptions, type MergedResult, type ShardRow, buildTopupInfo, createApp, createMcpFetchClient, decryptKey, encryptKey, formatWalletBalance, formatWalletBalanceResult, generateArtifactHtml, generateVisualization, getBalanceEth, getBalanceUsdc, getTopupUrl, getWalletAccount, getWalletBalanceResult, getWalletBalanceText, isWalletConfigured, loadConfig, mergeShardRows, normalizeWalletPrivateKey, resetConfigCache, saveConfig, setWalletPrivateKey, startServer, startTopupServer, walletAddressFromPrivateKey };
|
|
173
|
+
export { type InvestigatorConfig, type MergeOptions, type MergedResult, type ShardRow, buildTopupInfo, createMcpFetchClient, decryptKey, encryptKey, formatWalletBalance, formatWalletBalanceResult, generateArtifactHtml, getBalanceEth, getBalanceUsdc, getTopupUrl, getWalletAccount, getWalletBalanceResult, getWalletBalanceText, isWalletConfigured, loadConfig, mergeShardRows, normalizeWalletPrivateKey, resetConfigCache, saveConfig, setWalletPrivateKey, startTopupServer, walletAddressFromPrivateKey };
|
|
272
174
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/config/schema.ts","../src/config/index.ts","../src/
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/config/schema.ts","../src/config/index.ts","../src/wallet/index.ts","../src/wallet/tools.ts","../src/wallet/mcp-proxy/topup-server.ts","../src/wallet/topup-server.ts","../src/mcp/client.ts","../src/federation/merge.ts"],"mappings":";;;cA4Da,cAAY,EAAA;;;;;;;;;;;;;;;;GAcvB,EAAA,KAAA;KAEU,qBAAqB,EAAE,aAAa;;;iBC3B1B,cAAc,QAAQ;iBAMtB,WAAW,SAAS,QAAQ,sBAAsB;iBAclD,oBAAoB;;;iBC5C1B,0BAA0B,gBAAgB;iBAO1C,4BAA4B,qBAAqB;;;;;;;;iBAW3C,WAAW,qBAAqB;UAwBrC;;EAEf;;;;;;;;iBAuCoB,oBACpB,oBACA,UAAS,6BACR,QAAQ;;;;;;;iBA2BW,cAAc;;;;;iBAwCd,sBAAsB;;;cCpK/B;cACA;UAgDI;EACf,SAAS;EACT,YAAY;;UAGG;EACf;EACA;EACA,iBAAiB;EACjB;EACA,uBAAuB;EACvB;;UAoDe;EACf,SAAS;EACT;EACA;EACA,iBAAiB;EACjB;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;IACE,QAAQ;;;iBAIU,oBAAoB,QAAQ;iBAa5B,eACpB,SAAS,kBACT,8BACC;iBAsBmB,cACpB,SAAS,kBACT,8BACC;iBAsQa,oBACd,iBACA,qBACA;iBAaoB,uBACpB,UAAU,uBACT,QAAQ;iBAyBK,0BAA0B,QAAQ;iBAK5B,qBAAqB,UAAU,uBAAuB;iBAI5D,eAAe,iBAAiB,oBAAoB;;;iBCvWpD,qBAAqB,4BAA4B;;;iBCpCjD;iBAcM,iBAAiB,SAAS,gCAAgC;;;;;;;;;;;;;;;iBC4JhE,qBAAqB,2BAA2B,4BAAkB;;;;;;;;;;;;;;KCxQtE,WAAW;EAA4B;;UAElC;EACf;IAAY;IAAa;;EACzB;EACA,WAAW,MAAM;;;;;;;;EAQjB;;;;EAIA;;UAGe;EACf,MAAM,MAAM;;;;;EAKZ,UAAU,eAAe,MAAM;EAC/B;;iBA8Jc,eAAe,MAAM,YAAY,OAAM,eAAoB"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
|
-
import { Hono } from "hono";
|
|
3
2
|
import { Address, Hex } from "viem";
|
|
4
3
|
//#region src/config/schema.d.ts
|
|
5
4
|
declare const ConfigSchema: z.ZodObject<{
|
|
@@ -26,12 +25,6 @@ declare function loadConfig(): Promise<InvestigatorConfig>;
|
|
|
26
25
|
declare function saveConfig(updates: Partial<InvestigatorConfig>): Promise<void>;
|
|
27
26
|
declare function resetConfigCache(): Promise<void>;
|
|
28
27
|
//#endregion
|
|
29
|
-
//#region src/server/app.d.ts
|
|
30
|
-
declare function createApp(): Hono;
|
|
31
|
-
//#endregion
|
|
32
|
-
//#region src/server/index.d.ts
|
|
33
|
-
declare function startServer(port?: number): () => void;
|
|
34
|
-
//#endregion
|
|
35
28
|
//#region src/wallet/index.d.ts
|
|
36
29
|
declare function normalizeWalletPrivateKey(value: string): Hex;
|
|
37
30
|
declare function walletAddressFromPrivateKey(privateKey: string): Address;
|
|
@@ -177,96 +170,5 @@ interface MergedResult {
|
|
|
177
170
|
}
|
|
178
171
|
declare function mergeShardRows(rows: ShardRow[], opts?: MergeOptions): MergedResult;
|
|
179
172
|
//#endregion
|
|
180
|
-
|
|
181
|
-
declare const GraphNode: z.ZodObject<{
|
|
182
|
-
id: z.ZodString;
|
|
183
|
-
label: z.ZodOptional<z.ZodString>;
|
|
184
|
-
entityType: z.ZodDefault<z.ZodEnum<{
|
|
185
|
-
contract: "contract";
|
|
186
|
-
eoa: "eoa";
|
|
187
|
-
exchange: "exchange";
|
|
188
|
-
hub: "hub";
|
|
189
|
-
mixer: "mixer";
|
|
190
|
-
unknown: "unknown";
|
|
191
|
-
}>>;
|
|
192
|
-
riskLevel: z.ZodDefault<z.ZodEnum<{
|
|
193
|
-
critical: "critical";
|
|
194
|
-
high: "high";
|
|
195
|
-
low: "low";
|
|
196
|
-
medium: "medium";
|
|
197
|
-
unknown: "unknown";
|
|
198
|
-
unscored: "unscored";
|
|
199
|
-
}>>;
|
|
200
|
-
totalIn: z.ZodDefault<z.ZodNumber>;
|
|
201
|
-
totalOut: z.ZodDefault<z.ZodNumber>;
|
|
202
|
-
txCount: z.ZodDefault<z.ZodNumber>;
|
|
203
|
-
firstSeen: z.ZodOptional<z.ZodString>;
|
|
204
|
-
lastSeen: z.ZodOptional<z.ZodString>;
|
|
205
|
-
}, z.core.$strip>;
|
|
206
|
-
type GraphNode = z.infer<typeof GraphNode>;
|
|
207
|
-
declare const GraphEdge: z.ZodObject<{
|
|
208
|
-
source: z.ZodString;
|
|
209
|
-
target: z.ZodString;
|
|
210
|
-
value: z.ZodNumber;
|
|
211
|
-
edgeType: z.ZodDefault<z.ZodString>;
|
|
212
|
-
txHash: z.ZodOptional<z.ZodString>;
|
|
213
|
-
blockNumber: z.ZodOptional<z.ZodNumber>;
|
|
214
|
-
timestamp: z.ZodOptional<z.ZodString>;
|
|
215
|
-
}, z.core.$strip>;
|
|
216
|
-
type GraphEdge = z.infer<typeof GraphEdge>;
|
|
217
|
-
declare const GraphData: z.ZodObject<{
|
|
218
|
-
nodes: z.ZodArray<z.ZodObject<{
|
|
219
|
-
id: z.ZodString;
|
|
220
|
-
label: z.ZodOptional<z.ZodString>;
|
|
221
|
-
entityType: z.ZodDefault<z.ZodEnum<{
|
|
222
|
-
contract: "contract";
|
|
223
|
-
eoa: "eoa";
|
|
224
|
-
exchange: "exchange";
|
|
225
|
-
hub: "hub";
|
|
226
|
-
mixer: "mixer";
|
|
227
|
-
unknown: "unknown";
|
|
228
|
-
}>>;
|
|
229
|
-
riskLevel: z.ZodDefault<z.ZodEnum<{
|
|
230
|
-
critical: "critical";
|
|
231
|
-
high: "high";
|
|
232
|
-
low: "low";
|
|
233
|
-
medium: "medium";
|
|
234
|
-
unknown: "unknown";
|
|
235
|
-
unscored: "unscored";
|
|
236
|
-
}>>;
|
|
237
|
-
totalIn: z.ZodDefault<z.ZodNumber>;
|
|
238
|
-
totalOut: z.ZodDefault<z.ZodNumber>;
|
|
239
|
-
txCount: z.ZodDefault<z.ZodNumber>;
|
|
240
|
-
firstSeen: z.ZodOptional<z.ZodString>;
|
|
241
|
-
lastSeen: z.ZodOptional<z.ZodString>;
|
|
242
|
-
}, z.core.$strip>>;
|
|
243
|
-
edges: z.ZodArray<z.ZodObject<{
|
|
244
|
-
source: z.ZodString;
|
|
245
|
-
target: z.ZodString;
|
|
246
|
-
value: z.ZodNumber;
|
|
247
|
-
edgeType: z.ZodDefault<z.ZodString>;
|
|
248
|
-
txHash: z.ZodOptional<z.ZodString>;
|
|
249
|
-
blockNumber: z.ZodOptional<z.ZodNumber>;
|
|
250
|
-
timestamp: z.ZodOptional<z.ZodString>;
|
|
251
|
-
}, z.core.$strip>>;
|
|
252
|
-
metadata: z.ZodObject<{
|
|
253
|
-
title: z.ZodDefault<z.ZodString>;
|
|
254
|
-
generatedAt: z.ZodString;
|
|
255
|
-
truncated: z.ZodDefault<z.ZodBoolean>;
|
|
256
|
-
totalNodes: z.ZodOptional<z.ZodNumber>;
|
|
257
|
-
hiddenNodes: z.ZodOptional<z.ZodNumber>;
|
|
258
|
-
}, z.core.$strip>;
|
|
259
|
-
}, z.core.$strip>;
|
|
260
|
-
type GraphData = z.infer<typeof GraphData>;
|
|
261
|
-
//#endregion
|
|
262
|
-
//#region src/viz/index.d.ts
|
|
263
|
-
declare function generateVisualization(opts: {
|
|
264
|
-
sourceId?: string;
|
|
265
|
-
dataFile?: string;
|
|
266
|
-
}): Promise<{
|
|
267
|
-
vizId: string;
|
|
268
|
-
htmlPath: string;
|
|
269
|
-
}>;
|
|
270
|
-
//#endregion
|
|
271
|
-
export { type GraphData as GraphDataType, type GraphEdge as GraphEdgeType, type GraphNode as GraphNodeType, type InvestigatorConfig, type MergeOptions, type MergedResult, type ShardRow, buildTopupInfo, createApp, createMcpFetchClient, decryptKey, encryptKey, formatWalletBalance, formatWalletBalanceResult, generateArtifactHtml, generateVisualization, getBalanceEth, getBalanceUsdc, getTopupUrl, getWalletAccount, getWalletBalanceResult, getWalletBalanceText, isWalletConfigured, loadConfig, mergeShardRows, normalizeWalletPrivateKey, resetConfigCache, saveConfig, setWalletPrivateKey, startServer, startTopupServer, walletAddressFromPrivateKey };
|
|
173
|
+
export { type InvestigatorConfig, type MergeOptions, type MergedResult, type ShardRow, buildTopupInfo, createMcpFetchClient, decryptKey, encryptKey, formatWalletBalance, formatWalletBalanceResult, generateArtifactHtml, getBalanceEth, getBalanceUsdc, getTopupUrl, getWalletAccount, getWalletBalanceResult, getWalletBalanceText, isWalletConfigured, loadConfig, mergeShardRows, normalizeWalletPrivateKey, resetConfigCache, saveConfig, setWalletPrivateKey, startTopupServer, walletAddressFromPrivateKey };
|
|
272
174
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/config/schema.ts","../src/config/index.ts","../src/
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/config/schema.ts","../src/config/index.ts","../src/wallet/index.ts","../src/wallet/tools.ts","../src/wallet/mcp-proxy/topup-server.ts","../src/wallet/topup-server.ts","../src/mcp/client.ts","../src/federation/merge.ts"],"mappings":";;;cA4Da,cAAY,EAAA;;;;;;;;;;;;;;;;GAcvB,EAAA,KAAA;KAEU,qBAAqB,EAAE,aAAa;;;iBC3B1B,cAAc,QAAQ;iBAMtB,WAAW,SAAS,QAAQ,sBAAsB;iBAclD,oBAAoB;;;iBC5C1B,0BAA0B,gBAAgB;iBAO1C,4BAA4B,qBAAqB;;;;;;;;iBAW3C,WAAW,qBAAqB;UAwBrC;;EAEf;;;;;;;;iBAuCoB,oBACpB,oBACA,UAAS,6BACR,QAAQ;;;;;;;iBA2BW,cAAc;;;;;iBAwCd,sBAAsB;;;cCpK/B;cACA;UAgDI;EACf,SAAS;EACT,YAAY;;UAGG;EACf;EACA;EACA,iBAAiB;EACjB;EACA,uBAAuB;EACvB;;UAoDe;EACf,SAAS;EACT;EACA;EACA,iBAAiB;EACjB;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;IACE,QAAQ;;;iBAIU,oBAAoB,QAAQ;iBAa5B,eACpB,SAAS,kBACT,8BACC;iBAsBmB,cACpB,SAAS,kBACT,8BACC;iBAsQa,oBACd,iBACA,qBACA;iBAaoB,uBACpB,UAAU,uBACT,QAAQ;iBAyBK,0BAA0B,QAAQ;iBAK5B,qBAAqB,UAAU,uBAAuB;iBAI5D,eAAe,iBAAiB,oBAAoB;;;iBCvWpD,qBAAqB,4BAA4B;;;iBCpCjD;iBAcM,iBAAiB,SAAS,gCAAgC;;;;;;;;;;;;;;;iBC4JhE,qBAAqB,2BAA2B,4BAAkB;;;;;;;;;;;;;;KCxQtE,WAAW;EAA4B;;UAElC;EACf;IAAY;IAAa;;EACzB;EACA,WAAW,MAAM;;;;;;;;EAQjB;;;;EAIA;;UAGe;EACf,MAAM,MAAM;;;;;EAKZ,UAAU,eAAe,MAAM;EAC/B;;iBA8Jc,eAAe,MAAM,YAAY,OAAM,eAAoB"}
|