@quantish/agent 0.1.18 → 0.1.20
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.
- package/dist/index.js +54 -19
- 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
|
-
|
|
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(
|
|
@@ -3460,31 +3486,40 @@ function extractTokenInfo(token) {
|
|
|
3460
3486
|
}
|
|
3461
3487
|
var DEFAULT_SYSTEM_PROMPT = `You are Quantish, an AI coding and trading agent.
|
|
3462
3488
|
|
|
3463
|
-
You have two sets of capabilities:
|
|
3464
|
-
|
|
3465
3489
|
## Trading Tools (via MCP)
|
|
3466
|
-
You can interact with Polymarket prediction markets:
|
|
3467
3490
|
- Check wallet balances and positions
|
|
3468
3491
|
- Place, cancel, and manage orders
|
|
3469
|
-
- Transfer funds and claim winnings
|
|
3470
3492
|
- Get market prices and orderbook data
|
|
3493
|
+
- Search markets on Polymarket, Kalshi, Limitless
|
|
3471
3494
|
|
|
3472
3495
|
## Coding Tools (local)
|
|
3473
|
-
|
|
3474
|
-
-
|
|
3475
|
-
-
|
|
3476
|
-
-
|
|
3477
|
-
- Use git for version control
|
|
3496
|
+
- read_file, write_file, edit_file, list_dir
|
|
3497
|
+
- grep (search), find_files
|
|
3498
|
+
- run_command (blocking), start_background_process (non-blocking)
|
|
3499
|
+
- git operations
|
|
3478
3500
|
|
|
3479
|
-
##
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
-
|
|
3483
|
-
-
|
|
3484
|
-
-
|
|
3485
|
-
-
|
|
3501
|
+
## IMPORTANT: Background vs Blocking Commands
|
|
3502
|
+
|
|
3503
|
+
Use \`start_background_process\` for:
|
|
3504
|
+
- Dev servers: npm start, npm run dev, yarn dev, vite, next dev
|
|
3505
|
+
- Watch mode: npm run watch, tsc --watch
|
|
3506
|
+
- Any server or long-running process
|
|
3507
|
+
- Returns immediately with a process ID
|
|
3508
|
+
|
|
3509
|
+
Use \`run_command\` for:
|
|
3510
|
+
- Quick commands: ls, cat, npm install, npm run build
|
|
3511
|
+
- One-time operations that complete quickly
|
|
3512
|
+
- Blocks until command finishes
|
|
3486
3513
|
|
|
3487
|
-
|
|
3514
|
+
After starting a background process:
|
|
3515
|
+
1. Use \`get_process_output(process_id)\` to check if it started correctly
|
|
3516
|
+
2. Use \`list_processes()\` to see all running processes
|
|
3517
|
+
3. Use \`stop_process(process_id)\` to stop when done
|
|
3518
|
+
|
|
3519
|
+
## Guidelines
|
|
3520
|
+
- Be concise
|
|
3521
|
+
- Prices on Polymarket are 0.01-0.99 (probabilities)
|
|
3522
|
+
- For dangerous operations (rm, sudo), explain first`;
|
|
3488
3523
|
var Agent = class {
|
|
3489
3524
|
anthropic;
|
|
3490
3525
|
llmProvider;
|