@quantish/agent 0.1.30 → 0.1.32

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 +28 -59
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -251,27 +251,17 @@ var MCPClient = class {
251
251
  if (this.toolsCache) {
252
252
  return this.toolsCache;
253
253
  }
254
+ const headers = {
255
+ "Content-Type": "application/json",
256
+ "x-api-key": this.apiKey
257
+ };
254
258
  if (this.source === "discovery") {
255
- const response2 = await fetch(`${this.baseUrl}/tools`, {
256
- method: "GET",
257
- headers: {
258
- "Content-Type": "application/json",
259
- "X-API-Key": this.apiKey
260
- }
261
- });
262
- if (!response2.ok) {
263
- throw new Error(`MCP server error: ${response2.status} ${response2.statusText}`);
264
- }
265
- const data2 = await response2.json();
266
- this.toolsCache = data2.tools || [];
267
- return this.toolsCache;
259
+ headers["Accept"] = "application/json, text/event-stream";
260
+ headers["X-API-Key"] = this.apiKey;
268
261
  }
269
262
  const response = await fetch(this.baseUrl, {
270
263
  method: "POST",
271
- headers: {
272
- "Content-Type": "application/json",
273
- "x-api-key": this.apiKey
274
- },
264
+ headers,
275
265
  body: JSON.stringify({
276
266
  jsonrpc: "2.0",
277
267
  method: "tools/list",
@@ -292,45 +282,20 @@ var MCPClient = class {
292
282
  }
293
283
  /**
294
284
  * Call a tool on the MCP server
295
- * Discovery MCP uses REST endpoints, Trading MCP uses JSON-RPC
285
+ * All MCPs use JSON-RPC format
296
286
  */
297
287
  async callTool(name, args) {
288
+ const headers = {
289
+ "Content-Type": "application/json",
290
+ "x-api-key": this.apiKey
291
+ };
298
292
  if (this.source === "discovery") {
299
- const response2 = await fetch(`${this.baseUrl}/execute`, {
300
- method: "POST",
301
- headers: {
302
- "Content-Type": "application/json",
303
- "X-API-Key": this.apiKey
304
- },
305
- body: JSON.stringify({
306
- name,
307
- arguments: args
308
- })
309
- });
310
- if (!response2.ok) {
311
- return {
312
- success: false,
313
- error: `MCP server error: ${response2.status} ${response2.statusText}`
314
- };
315
- }
316
- const data2 = await response2.json();
317
- if (data2.error) {
318
- return {
319
- success: false,
320
- error: typeof data2.error === "string" ? data2.error : JSON.stringify(data2.error)
321
- };
322
- }
323
- return {
324
- success: true,
325
- data: data2.data ?? data2.result ?? data2
326
- };
293
+ headers["Accept"] = "application/json, text/event-stream";
294
+ headers["X-API-Key"] = this.apiKey;
327
295
  }
328
296
  const response = await fetch(this.baseUrl, {
329
297
  method: "POST",
330
- headers: {
331
- "Content-Type": "application/json",
332
- "x-api-key": this.apiKey
333
- },
298
+ headers,
334
299
  body: JSON.stringify({
335
300
  jsonrpc: "2.0",
336
301
  method: "tools/call",
@@ -630,15 +595,18 @@ async function runSetup() {
630
595
  console.log();
631
596
  console.log(chalk.bold("Step 1: Choose your LLM Provider"));
632
597
  console.log(chalk.dim("The AI that powers the agent.\n"));
633
- console.log(" 1. " + chalk.cyan("Anthropic") + chalk.dim(" (Claude models - Opus, Sonnet, Haiku)"));
634
- console.log(" 2. " + chalk.green("OpenRouter") + chalk.dim(" (Access 100+ models - MiniMax, DeepSeek, etc.)\n"));
635
- const providerChoice = await prompt("Choose (1 or 2): ");
636
- const useOpenRouter = providerChoice === "2";
598
+ console.log(" 1. " + chalk.green.bold("OpenRouter") + chalk.green(" (Recommended)") + chalk.dim(" - Uses GLM 4.7, fastest & cheapest"));
599
+ console.log(" 2. " + chalk.cyan("Anthropic") + chalk.dim(" (Claude models - Opus, Sonnet, Haiku)\n"));
600
+ console.log(chalk.dim("OpenRouter gives you access to GLM 4.7 - the best price/performance model available."));
601
+ console.log(chalk.dim("Get started free: ") + chalk.underline.cyan("https://openrouter.ai/keys\n"));
602
+ const providerChoice = await prompt("Choose (1 or 2, default 1): ");
603
+ const useOpenRouter = providerChoice !== "2";
637
604
  if (useOpenRouter) {
638
605
  config.setProvider("openrouter");
639
606
  console.log();
640
607
  console.log(chalk.bold("OpenRouter API Key"));
641
- console.log(chalk.dim("Get yours at https://openrouter.ai/keys\n"));
608
+ console.log(chalk.dim("Sign up and get your key at: ") + chalk.underline.cyan("https://openrouter.ai/keys"));
609
+ console.log(chalk.dim("Default model: GLM 4.7 (fast, accurate, low cost)\n"));
642
610
  let openrouterKey = config.getOpenRouterApiKey();
643
611
  if (openrouterKey) {
644
612
  console.log(chalk.dim(`Current: ${openrouterKey.slice(0, 10)}...`));
@@ -657,12 +625,13 @@ async function runSetup() {
657
625
  console.log(chalk.yellow("Warning: Key doesn't look like an OpenRouter key (should start with sk-or-)"));
658
626
  }
659
627
  config.setOpenRouterApiKey(openrouterKey);
660
- console.log(chalk.green("\u2713 OpenRouter API key saved\n"));
628
+ console.log(chalk.green("\u2713 OpenRouter API key saved"));
629
+ console.log(chalk.dim(" Using model: z-ai/glm-4.7\n"));
661
630
  } else {
662
631
  config.setProvider("anthropic");
663
632
  console.log();
664
633
  console.log(chalk.bold("Anthropic API Key"));
665
- console.log(chalk.dim("Get yours at https://console.anthropic.com/\n"));
634
+ console.log(chalk.dim("Get yours at: ") + chalk.underline.cyan("https://console.anthropic.com/\n"));
666
635
  let anthropicKey = config.getAnthropicApiKey();
667
636
  if (anthropicKey) {
668
637
  console.log(chalk.dim(`Current: ${anthropicKey.slice(0, 10)}...`));
@@ -4338,7 +4307,7 @@ ${chalk2.yellow(" \u2588\u2588\u2551\u2584\u2584 \u2588\u2588\u2551")}${chalk2.
4338
4307
  ${chalk2.yellow(" \u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D")}${chalk2.hex("#FFD700")("\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D")}${chalk2.hex("#FFC000")("\u2588\u2588\u2551 \u2588\u2588\u2551")}${chalk2.hex("#FFB000")("\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551")}${chalk2.hex("#FFA000")(" \u2588\u2588\u2551 ")}${chalk2.hex("#FF9000")("\u2588\u2588\u2551")}${chalk2.hex("#FF8000")("\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551")}${chalk2.hex("#FF7000")("\u2588\u2588\u2551 \u2588\u2588\u2551")}
4339
4308
  ${chalk2.yellow(" \u255A\u2550\u2550\u2580\u2580\u2550\u255D ")}${chalk2.hex("#FFD700")(" \u255A\u2550\u2550\u2550\u2550\u2550\u255D ")}${chalk2.hex("#FFC000")("\u255A\u2550\u255D \u255A\u2550\u255D")}${chalk2.hex("#FFB000")("\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D")}${chalk2.hex("#FFA000")(" \u255A\u2550\u255D ")}${chalk2.hex("#FF9000")("\u255A\u2550\u255D")}${chalk2.hex("#FF8000")("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D")}${chalk2.hex("#FF7000")("\u255A\u2550\u255D \u255A\u2550\u255D")}
4340
4309
  `;
4341
- var TAGLINE = chalk2.dim(" AI-powered trading agent for Polymarket");
4310
+ var TAGLINE = chalk2.dim(" AI-powered trading agent for Polymarket & Kalshi");
4342
4311
  function printHeader() {
4343
4312
  console.log(BANNER);
4344
4313
  console.log(TAGLINE);
@@ -5452,7 +5421,7 @@ Stopped ${count} background process${count > 1 ? "es" : ""}.`);
5452
5421
  }
5453
5422
 
5454
5423
  // src/index.ts
5455
- var VERSION = "0.1.30";
5424
+ var VERSION = "0.1.32";
5456
5425
  function cleanup() {
5457
5426
  if (processManager.hasRunning()) {
5458
5427
  const count = processManager.runningCount();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantish/agent",
3
- "version": "0.1.30",
3
+ "version": "0.1.32",
4
4
  "description": "AI-powered agent for trading on Polymarket and Kalshi",
5
5
  "type": "module",
6
6
  "bin": {