@quantish/agent 0.1.37 → 0.1.39

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 +79 -19
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -662,9 +662,40 @@ async function runSetup() {
662
662
  let skipTrading = false;
663
663
  if (quantishKey) {
664
664
  console.log(chalk.dim(`Current trading key: ${quantishKey.slice(0, 12)}...`));
665
- const action = await prompt("Keep current key (Enter), enter new key (n), or disable trading (d): ");
665
+ const action = await prompt("Keep (Enter), new key (n), create wallet (c), or disable (d): ");
666
666
  if (action.toLowerCase() === "n") {
667
667
  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
+ }
668
699
  } else if (action.toLowerCase() === "d") {
669
700
  quantishKey = void 0;
670
701
  skipTrading = true;
@@ -728,9 +759,39 @@ async function runSetup() {
728
759
  let skipKalshi = false;
729
760
  if (kalshiKey) {
730
761
  console.log(chalk.dim(`Current Kalshi key: ${kalshiKey.slice(0, 12)}...`));
731
- const action = await prompt("Keep current key (Enter), enter new key (n), or disable Kalshi (d): ");
762
+ const action = await prompt("Keep (Enter), new key (n), create wallet (c), or disable (d): ");
732
763
  if (action.toLowerCase() === "n") {
733
764
  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
+ }
734
795
  } else if (action.toLowerCase() === "d") {
735
796
  kalshiKey = void 0;
736
797
  skipKalshi = true;
@@ -3574,40 +3635,39 @@ var DEFAULT_SYSTEM_PROMPT = `You are Quantish, an AI coding and trading agent.
3574
3635
 
3575
3636
  ## MCP Architecture (3 servers)
3576
3637
 
3577
- **Discovery MCP** - ALWAYS use for searching/finding markets:
3638
+ **Discovery MCP** - For searching/finding markets:
3578
3639
  - search_markets(query) - Search across Polymarket, Kalshi, Limitless
3579
- - get_trending_markets() - Find hot markets
3580
3640
  - get_market_details(platform, marketId) - Get details for any market
3581
- - find_arbitrage() - Find arbitrage opportunities
3582
3641
 
3583
- **Polymarket MCP** - Use for Polymarket trading:
3642
+ **Polymarket MCP** - For Polymarket trading:
3584
3643
  - place_order, cancel_order, get_orders
3585
- - get_balances, get_positions
3644
+ - get_balances, get_positions, get_price, get_orderbook
3586
3645
  - get_wallet_status, setup_wallet
3587
3646
 
3588
- **Kalshi MCP** - Use for Kalshi trading via DFlow on Solana:
3647
+ **Kalshi MCP** - For Kalshi trading via DFlow on Solana:
3589
3648
  - kalshi_buy_yes, kalshi_buy_no, kalshi_sell_position
3590
3649
  - kalshi_get_balances, kalshi_get_positions
3591
- - kalshi_search_markets (backup if Discovery unavailable)
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.
3592
3656
 
3593
3657
  ## Workflow for trading:
3594
- 1. Use Discovery MCP to find markets (search_markets)
3595
- 2. From results, get the platform (polymarket/kalshi) and market ID
3596
- 3. Use the appropriate trading MCP to execute trades
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
3597
3661
 
3598
3662
  ## Coding Tools (local)
3599
3663
  - read_file, write_file, edit_file, list_dir
3600
3664
  - grep (search), find_files
3601
3665
  - run_command (blocking), start_background_process (non-blocking)
3602
3666
 
3603
- ## Background vs Blocking Commands
3604
- Use \`start_background_process\` for dev servers, watch mode, long-running processes.
3605
- Use \`run_command\` for quick commands that complete immediately.
3606
-
3607
3667
  ## Guidelines
3608
- - Be concise
3668
+ - Be concise. One search is usually enough.
3609
3669
  - Prices on Polymarket are 0.01-0.99 (probabilities)
3610
- - For dangerous operations (rm, sudo), explain first`;
3670
+ - For dangerous operations, explain first`;
3611
3671
  var Agent = class {
3612
3672
  anthropic;
3613
3673
  llmProvider;
@@ -5427,7 +5487,7 @@ Stopped ${count} background process${count > 1 ? "es" : ""}.`);
5427
5487
  }
5428
5488
 
5429
5489
  // src/index.ts
5430
- var VERSION = "0.1.37";
5490
+ var VERSION = "0.1.39";
5431
5491
  function cleanup() {
5432
5492
  if (processManager.hasRunning()) {
5433
5493
  const count = processManager.runningCount();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantish/agent",
3
- "version": "0.1.37",
3
+ "version": "0.1.39",
4
4
  "description": "AI-powered agent for trading on Polymarket and Kalshi",
5
5
  "type": "module",
6
6
  "bin": {