@quantish/agent 0.1.39 → 0.1.42

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 (2) hide show
  1. package/dist/index.js +54 -93
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -424,10 +424,22 @@ var MCPClientManager = class {
424
424
  } catch (error2) {
425
425
  console.warn("Failed to fetch Discovery MCP tools:", error2);
426
426
  }
427
+ const discoverySearchTools = /* @__PURE__ */ new Set([
428
+ "search_markets",
429
+ "get_market_details",
430
+ "get_trending_markets",
431
+ "get_categories",
432
+ "get_market_stats",
433
+ "get_search_status",
434
+ "find_arbitrage"
435
+ ]);
427
436
  if (this.tradingClient) {
428
437
  try {
429
438
  const tradingTools = await this.tradingClient.listTools();
430
439
  for (const tool of tradingTools) {
440
+ if (discoverySearchTools.has(tool.name)) {
441
+ continue;
442
+ }
431
443
  allTools.push({ ...tool, source: "trading" });
432
444
  this.toolSourceMap.set(tool.name, "trading");
433
445
  }
@@ -662,40 +674,9 @@ async function runSetup() {
662
674
  let skipTrading = false;
663
675
  if (quantishKey) {
664
676
  console.log(chalk.dim(`Current trading key: ${quantishKey.slice(0, 12)}...`));
665
- const action = await prompt("Keep (Enter), new key (n), create wallet (c), or disable (d): ");
677
+ const action = await prompt("Keep current key (Enter), enter new key (n), or disable trading (d): ");
666
678
  if (action.toLowerCase() === "n") {
667
679
  quantishKey = await prompt("Enter your Quantish Trading API key: ", true);
668
- } else if (action.toLowerCase() === "c") {
669
- console.log(chalk.dim("\nCreating a new wallet on Quantish Signing Server..."));
670
- const externalId = await prompt("Enter a unique identifier (e.g., email or username): ");
671
- if (!externalId) {
672
- console.log(chalk.red("Identifier is required to create an account."));
673
- console.log(chalk.dim("Keeping current key.\n"));
674
- } else {
675
- try {
676
- const mcpClient = createMCPClient(config.getTradingMcpUrl(), "");
677
- const result = await mcpClient.callTool("request_api_key", { externalId });
678
- if (result.success && typeof result.data === "object" && result.data !== null) {
679
- const data = result.data;
680
- quantishKey = data.apiKey;
681
- console.log(chalk.green("\n\u2713 New wallet created!"));
682
- console.log(chalk.dim(` EOA Address: ${data.eoaAddress}`));
683
- console.log(chalk.dim(" (Your Safe wallet will deploy on first trade)\n"));
684
- if (data.apiSecret) {
685
- console.log(chalk.yellow("\u26A0\uFE0F Save your API secret (shown only once):"));
686
- console.log(chalk.bold.yellow(` ${String(data.apiSecret)}`));
687
- console.log();
688
- }
689
- } else {
690
- console.log(chalk.red("Failed to create wallet: " + (result.error || "Unknown error")));
691
- console.log(chalk.dim("Keeping current key.\n"));
692
- }
693
- } catch (error2) {
694
- console.log(chalk.red("Failed to connect to Quantish Trading Server."));
695
- console.log(chalk.dim(String(error2)));
696
- console.log(chalk.dim("Keeping current key.\n"));
697
- }
698
- }
699
680
  } else if (action.toLowerCase() === "d") {
700
681
  quantishKey = void 0;
701
682
  skipTrading = true;
@@ -759,39 +740,9 @@ async function runSetup() {
759
740
  let skipKalshi = false;
760
741
  if (kalshiKey) {
761
742
  console.log(chalk.dim(`Current Kalshi key: ${kalshiKey.slice(0, 12)}...`));
762
- const action = await prompt("Keep (Enter), new key (n), create wallet (c), or disable (d): ");
743
+ const action = await prompt("Keep current key (Enter), enter new key (n), or disable Kalshi (d): ");
763
744
  if (action.toLowerCase() === "n") {
764
745
  kalshiKey = await prompt("Enter your Kalshi API key: ", true);
765
- } else if (action.toLowerCase() === "c") {
766
- console.log(chalk.dim("\nCreating a new Solana wallet on Kalshi MCP..."));
767
- const externalId = await prompt("Enter a unique identifier (e.g., email or username): ");
768
- if (!externalId) {
769
- console.log(chalk.red("Identifier is required to create an account."));
770
- console.log(chalk.dim("Keeping current key.\n"));
771
- } else {
772
- try {
773
- const kalshiClient = createMCPClient(KALSHI_MCP_URL, "", "kalshi");
774
- const result = await kalshiClient.callTool("kalshi_signup", { externalId });
775
- if (result.success && typeof result.data === "object" && result.data !== null) {
776
- const data = result.data;
777
- kalshiKey = data.apiKey;
778
- console.log(chalk.green("\n\u2713 New Kalshi wallet created!"));
779
- console.log(chalk.dim(` Solana Address: ${data.walletAddress}`));
780
- if (data.apiSecret) {
781
- console.log(chalk.yellow("\n\u26A0\uFE0F Save your API secret (shown only once):"));
782
- console.log(chalk.bold.yellow(` ${String(data.apiSecret)}`));
783
- console.log();
784
- }
785
- } else {
786
- console.log(chalk.red("Failed to create wallet: " + (result.error || "Unknown error")));
787
- console.log(chalk.dim("Keeping current key.\n"));
788
- }
789
- } catch (error2) {
790
- console.log(chalk.red("Failed to connect to Kalshi MCP."));
791
- console.log(chalk.dim(String(error2)));
792
- console.log(chalk.dim("Keeping current key.\n"));
793
- }
794
- }
795
746
  } else if (action.toLowerCase() === "d") {
796
747
  kalshiKey = void 0;
797
748
  skipKalshi = true;
@@ -3631,43 +3582,53 @@ function extractTokenInfo(token) {
3631
3582
  price: token.price ?? token.probability
3632
3583
  };
3633
3584
  }
3634
- var DEFAULT_SYSTEM_PROMPT = `You are Quantish, an AI coding and trading agent.
3585
+ var DEFAULT_SYSTEM_PROMPT = `You are Quantish, an AI trading agent for prediction markets.
3586
+
3587
+ ## CRITICAL: Efficient Market Searching
3588
+
3589
+ When user asks to find markets:
3590
+ 1. Call search_markets ONCE with a good query
3591
+ 2. Present results in a clean table
3592
+ 3. STOP. Wait for user to ask for more.
3593
+
3594
+ **DO NOT** make multiple searches or call get_market_details on every result.
3595
+ search_markets already returns prices, volume, and liquidity.
3596
+
3597
+ ## Tools Available
3635
3598
 
3636
- ## MCP Architecture (3 servers)
3599
+ **Discovery MCP** (market data):
3600
+ - search_markets(query, limit=10) \u2192 Markets with prices from Polymarket/Kalshi/Limitless
3601
+ - get_market_details(platform, marketId) \u2192 Only when user asks about ONE specific market
3602
+ - get_trending_markets(limit=10) \u2192 Hot markets by volume
3637
3603
 
3638
- **Discovery MCP** - For searching/finding markets:
3639
- - search_markets(query) - Search across Polymarket, Kalshi, Limitless
3640
- - get_market_details(platform, marketId) - Get details for any market
3604
+ **Polymarket Trading**:
3605
+ - place_order, cancel_order, get_orders, get_positions, get_balances, get_price, get_orderbook
3641
3606
 
3642
- **Polymarket MCP** - For Polymarket trading:
3643
- - place_order, cancel_order, get_orders
3644
- - get_balances, get_positions, get_price, get_orderbook
3645
- - get_wallet_status, setup_wallet
3607
+ **Kalshi Trading** (via DFlow):
3608
+ - kalshi_buy_yes, kalshi_buy_no, kalshi_get_positions, kalshi_get_balances
3646
3609
 
3647
- **Kalshi MCP** - For Kalshi trading via DFlow on Solana:
3648
- - kalshi_buy_yes, kalshi_buy_no, kalshi_sell_position
3649
- - kalshi_get_balances, kalshi_get_positions
3610
+ **Coding Tools** (for building apps/bots):
3611
+ - read_file, write_file, edit_file, list_dir, grep, find_files
3612
+ - run_command (blocking) - for npm install, build commands
3613
+ - start_background_process (non-blocking) - for dev servers, watch mode
3614
+ - get_process_output, list_processes, stop_process
3615
+ - git operations: status, diff, add, commit
3650
3616
 
3651
- ## CRITICAL: Efficient Searching
3652
- - Make ONE search call first. Present results to user.
3653
- - Do NOT make multiple parallel searches for the same request.
3654
- - Only search again if user asks for different results or first search returned nothing.
3655
- - get_price and get_orderbook accept conditionId (0x...) directly - no need to look up tokenIds.
3617
+ ## Building Trading Bots
3656
3618
 
3657
- ## Workflow for trading:
3658
- 1. Use Discovery search_markets to find markets (ONE call)
3659
- 2. Present results to user
3660
- 3. If user wants to trade, use appropriate trading MCP
3619
+ When user wants to build an app or bot:
3620
+ 1. Use coding tools to create files (write_file, edit_file)
3621
+ 2. The MCP servers are HTTP APIs - apps can call them directly
3622
+ 3. Use start_background_process for dev servers
3623
+ 4. API endpoints:
3624
+ - Discovery: https://discovery-mcp-production.up.railway.app (read-only, public)
3625
+ - Trading: https://quantish-mcp-production.up.railway.app (requires API key)
3661
3626
 
3662
- ## Coding Tools (local)
3663
- - read_file, write_file, edit_file, list_dir
3664
- - grep (search), find_files
3665
- - run_command (blocking), start_background_process (non-blocking)
3627
+ ## Prices
3628
+ - Polymarket: 0.01-0.99 (probability)
3629
+ - Kalshi: percentages like 5% YES
3666
3630
 
3667
- ## Guidelines
3668
- - Be concise. One search is usually enough.
3669
- - Prices on Polymarket are 0.01-0.99 (probabilities)
3670
- - For dangerous operations, explain first`;
3631
+ Be concise. Present results clearly. Wait for user input.`;
3671
3632
  var Agent = class {
3672
3633
  anthropic;
3673
3634
  llmProvider;
@@ -5487,7 +5448,7 @@ Stopped ${count} background process${count > 1 ? "es" : ""}.`);
5487
5448
  }
5488
5449
 
5489
5450
  // src/index.ts
5490
- var VERSION = "0.1.39";
5451
+ var VERSION = "0.1.36";
5491
5452
  function cleanup() {
5492
5453
  if (processManager.hasRunning()) {
5493
5454
  const count = processManager.runningCount();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantish/agent",
3
- "version": "0.1.39",
3
+ "version": "0.1.42",
4
4
  "description": "AI-powered agent for trading on Polymarket and Kalshi",
5
5
  "type": "module",
6
6
  "bin": {