feat: Add RTK (Rust Token Killer) integration for token optimization

- Add RTK utility module (src/utils/rtk.js)
- Integrate RTK into BashTool for all bash commands
- Integrate RTK into GitTool for git operations
- Initialize RTK on bot startup
- Support 60+ command types (git, npm, cargo, pytest, docker, etc.)
- Track and report token savings per command
- Graceful fallback when RTK is not available

Expected savings: 60-90% token reduction for supported commands
This commit is contained in:
admin
2026-05-05 09:53:41 +00:00
Unverified
parent 875c7f9b91
commit f98c5ad3f6
4 changed files with 252 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ import { WebSocketServer } from 'ws';
import { spawn } from 'child_process';
import fs from 'fs-extra';
import path from 'path';
import { getRTK } from "../utils/rtk.js";
export async function initBot(config, api, tools, skills) {
const env = checkEnv();
@@ -24,6 +25,7 @@ export async function initBot(config, api, tools, skills) {
// WebSocket for real-time updates
const httpServer = createServer(app);
// Initialize RTK integration\n const rtk = getRTK();\n await rtk.init();
const wss = new WebSocketServer({ server: httpServer });
// Store active connections