@quantish/agent 0.1.39 → 0.1.40

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 +31 -79
  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;
@@ -3635,39 +3586,40 @@ var DEFAULT_SYSTEM_PROMPT = `You are Quantish, an AI coding and trading agent.
3635
3586
 
3636
3587
  ## MCP Architecture (3 servers)
3637
3588
 
3638
- **Discovery MCP** - For searching/finding markets:
3589
+ **Discovery MCP** - ALWAYS use for searching/finding markets:
3639
3590
  - search_markets(query) - Search across Polymarket, Kalshi, Limitless
3591
+ - get_trending_markets() - Find hot markets
3640
3592
  - get_market_details(platform, marketId) - Get details for any market
3593
+ - find_arbitrage() - Find arbitrage opportunities
3641
3594
 
3642
- **Polymarket MCP** - For Polymarket trading:
3595
+ **Polymarket MCP** - Use for Polymarket trading:
3643
3596
  - place_order, cancel_order, get_orders
3644
- - get_balances, get_positions, get_price, get_orderbook
3597
+ - get_balances, get_positions
3645
3598
  - get_wallet_status, setup_wallet
3646
3599
 
3647
- **Kalshi MCP** - For Kalshi trading via DFlow on Solana:
3600
+ **Kalshi MCP** - Use for Kalshi trading via DFlow on Solana:
3648
3601
  - kalshi_buy_yes, kalshi_buy_no, kalshi_sell_position
3649
3602
  - kalshi_get_balances, kalshi_get_positions
3650
-
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.
3603
+ - kalshi_search_markets (backup if Discovery unavailable)
3656
3604
 
3657
3605
  ## 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
3606
+ 1. Use Discovery MCP to find markets (search_markets)
3607
+ 2. From results, get the platform (polymarket/kalshi) and market ID
3608
+ 3. Use the appropriate trading MCP to execute trades
3661
3609
 
3662
3610
  ## Coding Tools (local)
3663
3611
  - read_file, write_file, edit_file, list_dir
3664
3612
  - grep (search), find_files
3665
3613
  - run_command (blocking), start_background_process (non-blocking)
3666
3614
 
3615
+ ## Background vs Blocking Commands
3616
+ Use \`start_background_process\` for dev servers, watch mode, long-running processes.
3617
+ Use \`run_command\` for quick commands that complete immediately.
3618
+
3667
3619
  ## Guidelines
3668
- - Be concise. One search is usually enough.
3620
+ - Be concise
3669
3621
  - Prices on Polymarket are 0.01-0.99 (probabilities)
3670
- - For dangerous operations, explain first`;
3622
+ - For dangerous operations (rm, sudo), explain first`;
3671
3623
  var Agent = class {
3672
3624
  anthropic;
3673
3625
  llmProvider;
@@ -5487,7 +5439,7 @@ Stopped ${count} background process${count > 1 ? "es" : ""}.`);
5487
5439
  }
5488
5440
 
5489
5441
  // src/index.ts
5490
- var VERSION = "0.1.39";
5442
+ var VERSION = "0.1.36";
5491
5443
  function cleanup() {
5492
5444
  if (processManager.hasRunning()) {
5493
5445
  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.40",
4
4
  "description": "AI-powered agent for trading on Polymarket and Kalshi",
5
5
  "type": "module",
6
6
  "bin": {