@quantish/agent 0.1.18 → 0.1.19

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 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2542,6 +2542,22 @@ import Anthropic from "@anthropic-ai/sdk";
2542
2542
  // src/agent/openrouter.ts
2543
2543
  var OPENROUTER_BASE_URL = "https://openrouter.ai/api/v1";
2544
2544
  var OPENROUTER_MODELS2 = {
2545
+ // Z.AI GLM models
2546
+ "z-ai/glm-4.7": {
2547
+ id: "z-ai/glm-4.7",
2548
+ name: "glm-4.7",
2549
+ displayName: "GLM 4.7",
2550
+ provider: "Z.AI",
2551
+ pricing: {
2552
+ inputPerMTok: 0.4,
2553
+ outputPerMTok: 1.5
2554
+ },
2555
+ contextWindow: 202752,
2556
+ maxOutputTokens: 65536,
2557
+ supportsTools: true,
2558
+ supportsReasoning: true,
2559
+ description: "Z.AI flagship. Enhanced programming, multi-step reasoning, agent tasks."
2560
+ },
2545
2561
  // MiniMax models - very cost effective
2546
2562
  "minimax/minimax-m2.1": {
2547
2563
  id: "minimax/minimax-m2.1",
@@ -2734,6 +2750,9 @@ var OPENROUTER_MODELS2 = {
2734
2750
  }
2735
2751
  };
2736
2752
  var OPENROUTER_ALIASES = {
2753
+ // Z.AI GLM
2754
+ "glm": "z-ai/glm-4.7",
2755
+ "glm-4.7": "z-ai/glm-4.7",
2737
2756
  // MiniMax
2738
2757
  "minimax": "minimax/minimax-m2.1",
2739
2758
  "m2": "minimax/minimax-m2",
@@ -3242,10 +3261,17 @@ var OpenRouterProvider = class {
3242
3261
  const toolCalls = [];
3243
3262
  for (const [, tc] of toolCallsInProgress) {
3244
3263
  try {
3245
- const input = JSON.parse(tc.arguments || "{}");
3264
+ let args = tc.arguments?.trim() || "{}";
3265
+ if (args && !args.endsWith("}")) {
3266
+ args = args + "}";
3267
+ }
3268
+ const input = JSON.parse(args);
3246
3269
  toolCalls.push({ id: tc.id, name: tc.name, input });
3247
3270
  callbacks.onToolCall?.(tc.id, tc.name, input);
3248
- } catch {
3271
+ } catch (e) {
3272
+ console.error(`[OpenRouter] Failed to parse tool call "${tc.name}": ${tc.arguments}`);
3273
+ toolCalls.push({ id: tc.id, name: tc.name, input: {} });
3274
+ callbacks.onToolCall?.(tc.id, tc.name, {});
3249
3275
  }
3250
3276
  }
3251
3277
  const cost = calculateOpenRouterCost(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantish/agent",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "description": "AI-powered agent for building trading bots on Polymarket",
5
5
  "type": "module",
6
6
  "bin": {