@leverageaiapps/locus 1.0.3
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/LICENSE +21 -0
- package/README.md +153 -0
- package/dist/capture.d.ts +3 -0
- package/dist/capture.d.ts.map +1 -0
- package/dist/capture.js +134 -0
- package/dist/capture.js.map +1 -0
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +84 -0
- package/dist/config.js.map +1 -0
- package/dist/context-extractor.d.ts +17 -0
- package/dist/context-extractor.d.ts.map +1 -0
- package/dist/context-extractor.js +118 -0
- package/dist/context-extractor.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +83 -0
- package/dist/index.js.map +1 -0
- package/dist/pty.d.ts +20 -0
- package/dist/pty.d.ts.map +1 -0
- package/dist/pty.js +148 -0
- package/dist/pty.js.map +1 -0
- package/dist/relay.d.ts +5 -0
- package/dist/relay.d.ts.map +1 -0
- package/dist/relay.js +131 -0
- package/dist/relay.js.map +1 -0
- package/dist/session.d.ts +6 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +250 -0
- package/dist/session.js.map +1 -0
- package/dist/voice-recognition-modelscope.d.ts +50 -0
- package/dist/voice-recognition-modelscope.d.ts.map +1 -0
- package/dist/voice-recognition-modelscope.js +171 -0
- package/dist/voice-recognition-modelscope.js.map +1 -0
- package/dist/vortex-tunnel.d.ts +9 -0
- package/dist/vortex-tunnel.d.ts.map +1 -0
- package/dist/vortex-tunnel.js +355 -0
- package/dist/vortex-tunnel.js.map +1 -0
- package/dist/web-server.d.ts +6 -0
- package/dist/web-server.d.ts.map +1 -0
- package/dist/web-server.js +2029 -0
- package/dist/web-server.js.map +1 -0
- package/install.sh +329 -0
- package/package.json +67 -0
- package/public/index.html +639 -0
- package/public/js/terminal-asr.js +435 -0
- package/public/js/terminal.js +517 -0
- package/public/js/voice-input.js +422 -0
- package/scripts/postinstall.js +66 -0
- package/scripts/verify-install.js +128 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.VoiceRecognitionModelScope = void 0;
|
|
7
|
+
const events_1 = require("events");
|
|
8
|
+
const axios_1 = __importDefault(require("axios"));
|
|
9
|
+
class VoiceRecognitionModelScope extends events_1.EventEmitter {
|
|
10
|
+
constructor(config = {}) {
|
|
11
|
+
super();
|
|
12
|
+
this.audioBuffer = [];
|
|
13
|
+
this.isRecording = false;
|
|
14
|
+
this.streamingSession = null;
|
|
15
|
+
this.contextText = '';
|
|
16
|
+
this.apiKey = config.apiKey || process.env.MODELSCOPE_API_KEY || '';
|
|
17
|
+
this.apiUrl = config.apiUrl || 'https://api-inference.modelscope.cn/v1/';
|
|
18
|
+
this.model = config.model || 'qwen3-asr-flash';
|
|
19
|
+
this.language = config.language || 'zh';
|
|
20
|
+
this.maxContextLength = config.maxContextLength || 2000;
|
|
21
|
+
if (!this.apiKey) {
|
|
22
|
+
console.warn('[ModelScope ASR] API key not configured. Set MODELSCOPE_API_KEY environment variable.');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Update the context for better recognition accuracy
|
|
27
|
+
*/
|
|
28
|
+
updateContext(terminalOutput) {
|
|
29
|
+
// Extract the most recent terminal output as context
|
|
30
|
+
const recentOutput = terminalOutput.slice(-50).join('\n');
|
|
31
|
+
// Truncate to max context length
|
|
32
|
+
if (recentOutput.length > this.maxContextLength) {
|
|
33
|
+
this.contextText = recentOutput.slice(-this.maxContextLength);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this.contextText = recentOutput;
|
|
37
|
+
}
|
|
38
|
+
console.log('[ModelScope ASR] Context updated, length:', this.contextText.length);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Start streaming recognition
|
|
42
|
+
*/
|
|
43
|
+
async startStreamingRecognition() {
|
|
44
|
+
if (!this.apiKey) {
|
|
45
|
+
this.emit('error', new Error('ModelScope API key not configured'));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
this.isRecording = true;
|
|
49
|
+
this.audioBuffer = [];
|
|
50
|
+
try {
|
|
51
|
+
// Initialize streaming session with ModelScope
|
|
52
|
+
const response = await axios_1.default.post(`${this.apiUrl}audio/transcriptions/stream`, {
|
|
53
|
+
model: this.model,
|
|
54
|
+
language: this.language,
|
|
55
|
+
stream: true,
|
|
56
|
+
context: this.contextText,
|
|
57
|
+
enable_itn: false, // Disable inverse text normalization
|
|
58
|
+
response_format: 'json'
|
|
59
|
+
}, {
|
|
60
|
+
headers: {
|
|
61
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
62
|
+
'Content-Type': 'application/json',
|
|
63
|
+
'X-DashScope-SSE': 'enable' // Enable server-sent events for streaming
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
this.streamingSession = response.data;
|
|
67
|
+
console.log('[ModelScope ASR] Streaming session started');
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
console.error('[ModelScope ASR] Failed to start streaming:', error);
|
|
71
|
+
this.emit('error', error);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Send audio chunk for recognition
|
|
76
|
+
*/
|
|
77
|
+
async sendAudioChunk(audioData) {
|
|
78
|
+
if (!this.isRecording || !this.apiKey) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
this.audioBuffer.push(audioData);
|
|
82
|
+
// Accumulate some audio before sending (e.g., 100ms worth)
|
|
83
|
+
if (this.audioBuffer.length >= 3) {
|
|
84
|
+
const combinedBuffer = Buffer.concat(this.audioBuffer);
|
|
85
|
+
this.audioBuffer = [];
|
|
86
|
+
try {
|
|
87
|
+
// Convert audio to base64
|
|
88
|
+
const base64Audio = combinedBuffer.toString('base64');
|
|
89
|
+
// Send to ModelScope API
|
|
90
|
+
const response = await axios_1.default.post(`${this.apiUrl}audio/transcriptions`, {
|
|
91
|
+
model: this.model,
|
|
92
|
+
audio: base64Audio,
|
|
93
|
+
language: this.language,
|
|
94
|
+
context: this.contextText,
|
|
95
|
+
stream: true,
|
|
96
|
+
response_format: 'json'
|
|
97
|
+
}, {
|
|
98
|
+
headers: {
|
|
99
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
100
|
+
'Content-Type': 'application/json'
|
|
101
|
+
},
|
|
102
|
+
responseType: 'stream'
|
|
103
|
+
});
|
|
104
|
+
// Handle streaming response
|
|
105
|
+
response.data.on('data', (chunk) => {
|
|
106
|
+
try {
|
|
107
|
+
const lines = chunk.toString().split('\n').filter(line => line.trim());
|
|
108
|
+
for (const line of lines) {
|
|
109
|
+
if (line.startsWith('data: ')) {
|
|
110
|
+
const data = line.slice(6);
|
|
111
|
+
if (data === '[DONE]') {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
const parsed = JSON.parse(data);
|
|
115
|
+
if (parsed.text) {
|
|
116
|
+
const result = {
|
|
117
|
+
text: parsed.text,
|
|
118
|
+
isFinal: parsed.is_final || false,
|
|
119
|
+
timestamp: Date.now()
|
|
120
|
+
};
|
|
121
|
+
if (result.isFinal) {
|
|
122
|
+
this.emit('final', result.text);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
this.emit('partial', result.text);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
console.error('[ModelScope ASR] Error parsing stream data:', err);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
console.error('[ModelScope ASR] Failed to send audio chunk:', error);
|
|
138
|
+
this.emit('error', error);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Stop recognition
|
|
144
|
+
*/
|
|
145
|
+
stopRecognition() {
|
|
146
|
+
this.isRecording = false;
|
|
147
|
+
this.audioBuffer = [];
|
|
148
|
+
this.streamingSession = null;
|
|
149
|
+
console.log('[ModelScope ASR] Recognition stopped');
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Check if API is properly configured
|
|
153
|
+
*/
|
|
154
|
+
isConfigured() {
|
|
155
|
+
return !!this.apiKey;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Get current context
|
|
159
|
+
*/
|
|
160
|
+
getContext() {
|
|
161
|
+
return this.contextText;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Set maximum context length
|
|
165
|
+
*/
|
|
166
|
+
setMaxContextLength(length) {
|
|
167
|
+
this.maxContextLength = Math.min(Math.max(100, length), 10000);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
exports.VoiceRecognitionModelScope = VoiceRecognitionModelScope;
|
|
171
|
+
//# sourceMappingURL=voice-recognition-modelscope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voice-recognition-modelscope.js","sourceRoot":"","sources":["../src/voice-recognition-modelscope.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAsC;AACtC,kDAA0B;AAiB1B,MAAa,0BAA2B,SAAQ,qBAAY;IAWxD,YAAY,SAA2B,EAAE;QACrC,KAAK,EAAE,CAAC;QANJ,gBAAW,GAAa,EAAE,CAAC;QAC3B,gBAAW,GAAY,KAAK,CAAC;QAC7B,qBAAgB,GAAQ,IAAI,CAAC;QAC7B,gBAAW,GAAW,EAAE,CAAC;QAI7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,EAAE,CAAC;QACpE,IAAI,CAAC,MAAM,GAAG,MAAM,CA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+1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Start Vortex tunnel
|
|
3
|
+
* Creates a session with the gateway and establishes WebSocket connection
|
|
4
|
+
*/
|
|
5
|
+
export declare function startTunnel(port?: number, gateway?: string): Promise<string>;
|
|
6
|
+
export declare function stopTunnel(): void;
|
|
7
|
+
export declare function getTunnelUrl(): string | null;
|
|
8
|
+
export declare function isTunnelRunning(): boolean;
|
|
9
|
+
//# sourceMappingURL=vortex-tunnel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vortex-tunnel.d.ts","sourceRoot":"","sources":["../src/vortex-tunnel.ts"],"names":[],"mappings":"AAmBA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,GAAE,MAAa,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAqElF;AA+PD,wBAAgB,UAAU,IAAI,IAAI,CAQjC;AAED,wBAAgB,YAAY,IAAI,MAAM,GAAG,IAAI,CAE5C;AAED,wBAAgB,eAAe,IAAI,OAAO,CAEzC"}
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.startTunnel = startTunnel;
|
|
40
|
+
exports.stopTunnel = stopTunnel;
|
|
41
|
+
exports.getTunnelUrl = getTunnelUrl;
|
|
42
|
+
exports.isTunnelRunning = isTunnelRunning;
|
|
43
|
+
const axios_1 = __importDefault(require("axios"));
|
|
44
|
+
const ws_1 = __importDefault(require("ws"));
|
|
45
|
+
const http = __importStar(require("http"));
|
|
46
|
+
let tunnelWs = null;
|
|
47
|
+
let tunnelUrl = null;
|
|
48
|
+
let sessionId = null;
|
|
49
|
+
let gatewayUrl = null;
|
|
50
|
+
let localPort = null;
|
|
51
|
+
// Map to store pending HTTP requests
|
|
52
|
+
const pendingRequests = new Map();
|
|
53
|
+
/**
|
|
54
|
+
* Start Vortex tunnel
|
|
55
|
+
* Creates a session with the gateway and establishes WebSocket connection
|
|
56
|
+
*/
|
|
57
|
+
function startTunnel(port = 4020, gateway) {
|
|
58
|
+
return new Promise(async (resolve, reject) => {
|
|
59
|
+
try {
|
|
60
|
+
localPort = port;
|
|
61
|
+
gatewayUrl = gateway || process.env.VORTEX_GATEWAY || 'https://vortex.futuretech.social';
|
|
62
|
+
console.log(` [Vortex] Connecting to gateway: ${gatewayUrl}`);
|
|
63
|
+
// Step 1: Create session on gateway
|
|
64
|
+
const response = await axios_1.default.post(`${gatewayUrl}/api/session`, {
|
|
65
|
+
client_info: {
|
|
66
|
+
name: 'LeverageAI-Agent',
|
|
67
|
+
platform: process.platform,
|
|
68
|
+
type: 'http_proxy'
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
const { session_id, tunnel_url: sessionUrl, ws_url, expires_in } = response.data;
|
|
72
|
+
sessionId = session_id;
|
|
73
|
+
tunnelUrl = sessionUrl;
|
|
74
|
+
console.log(` [Vortex] Session created: ${session_id.substring(0, 8)}...`);
|
|
75
|
+
console.log(` [Vortex] Session expires in: ${expires_in}s`);
|
|
76
|
+
// Step 2: Register tunnel with gateway
|
|
77
|
+
await axios_1.default.post(`${gatewayUrl}/api/tunnel/register`, {
|
|
78
|
+
session_id: session_id,
|
|
79
|
+
});
|
|
80
|
+
// Step 3: Connect WebSocket to gateway
|
|
81
|
+
const wsUrl = gatewayUrl.replace('https://', 'wss://').replace('http://', 'ws://') + `/tunnel/${session_id}`;
|
|
82
|
+
console.log(` [Vortex] Establishing WebSocket tunnel...`);
|
|
83
|
+
tunnelWs = new ws_1.default(wsUrl);
|
|
84
|
+
tunnelWs.on('open', () => {
|
|
85
|
+
console.log(` [Vortex] Tunnel connected`);
|
|
86
|
+
resolve(tunnelUrl);
|
|
87
|
+
});
|
|
88
|
+
tunnelWs.on('message', (data) => {
|
|
89
|
+
try {
|
|
90
|
+
const msg = JSON.parse(data.toString());
|
|
91
|
+
handleGatewayMessage(msg);
|
|
92
|
+
}
|
|
93
|
+
catch (e) {
|
|
94
|
+
// Not JSON, might be binary data
|
|
95
|
+
console.error('[Vortex] Invalid message from gateway:', e);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
tunnelWs.on('close', () => {
|
|
99
|
+
console.log(' [Vortex] Tunnel disconnected');
|
|
100
|
+
tunnelWs = null;
|
|
101
|
+
cleanup();
|
|
102
|
+
});
|
|
103
|
+
tunnelWs.on('error', (err) => {
|
|
104
|
+
console.error(' [Vortex] Tunnel error:', err.message);
|
|
105
|
+
reject(err);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
console.error(' [Vortex] Failed to start tunnel:', error.message);
|
|
110
|
+
if (error.response) {
|
|
111
|
+
console.error(' [Vortex] Response:', error.response.data);
|
|
112
|
+
}
|
|
113
|
+
reject(error);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
// Map of WebSocket connections
|
|
118
|
+
const websocketConnections = new Map();
|
|
119
|
+
/**
|
|
120
|
+
* Handle messages from the gateway
|
|
121
|
+
*/
|
|
122
|
+
function handleGatewayMessage(msg) {
|
|
123
|
+
switch (msg.type) {
|
|
124
|
+
case 'http_request':
|
|
125
|
+
// Gateway forwarded an HTTP request from browser
|
|
126
|
+
handleHttpRequest(msg);
|
|
127
|
+
break;
|
|
128
|
+
case 'websocket_connect':
|
|
129
|
+
// New WebSocket connection from browser
|
|
130
|
+
handleWebSocketConnect(msg.conn_id);
|
|
131
|
+
break;
|
|
132
|
+
case 'websocket_message':
|
|
133
|
+
// WebSocket message from browser
|
|
134
|
+
handleWebSocketMessage(msg.conn_id, msg.data);
|
|
135
|
+
break;
|
|
136
|
+
case 'websocket_binary':
|
|
137
|
+
// WebSocket binary data from browser
|
|
138
|
+
handleWebSocketBinary(msg.conn_id, msg.data);
|
|
139
|
+
break;
|
|
140
|
+
case 'websocket_disconnect':
|
|
141
|
+
// WebSocket disconnection from browser
|
|
142
|
+
handleWebSocketDisconnect(msg.conn_id);
|
|
143
|
+
break;
|
|
144
|
+
case 'client_connected':
|
|
145
|
+
console.log(` [Vortex] Client connected`);
|
|
146
|
+
break;
|
|
147
|
+
case 'client_disconnected':
|
|
148
|
+
console.log(` [Vortex] Client disconnected`);
|
|
149
|
+
break;
|
|
150
|
+
default:
|
|
151
|
+
// Unknown message type
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Handle HTTP request forwarded from gateway
|
|
157
|
+
* Forward it to the local server and send response back
|
|
158
|
+
*/
|
|
159
|
+
async function handleHttpRequest(msg) {
|
|
160
|
+
const { request_id, method, path, headers, body } = msg;
|
|
161
|
+
if (!localPort) {
|
|
162
|
+
sendToGateway({
|
|
163
|
+
type: 'http_response',
|
|
164
|
+
request_id,
|
|
165
|
+
status: 503,
|
|
166
|
+
headers: { 'Content-Type': 'text/plain' },
|
|
167
|
+
body: 'Local server not configured'
|
|
168
|
+
});
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
try {
|
|
172
|
+
// Remove host header to avoid conflicts
|
|
173
|
+
const requestHeaders = { ...headers };
|
|
174
|
+
delete requestHeaders.host;
|
|
175
|
+
delete requestHeaders.Host;
|
|
176
|
+
// Make request to local server
|
|
177
|
+
const options = {
|
|
178
|
+
hostname: 'localhost',
|
|
179
|
+
port: localPort,
|
|
180
|
+
path: path,
|
|
181
|
+
method: method,
|
|
182
|
+
headers: requestHeaders
|
|
183
|
+
};
|
|
184
|
+
const localReq = http.request(options, (localRes) => {
|
|
185
|
+
const chunks = [];
|
|
186
|
+
localRes.on('data', (chunk) => {
|
|
187
|
+
chunks.push(chunk);
|
|
188
|
+
});
|
|
189
|
+
localRes.on('end', () => {
|
|
190
|
+
const responseBody = Buffer.concat(chunks);
|
|
191
|
+
// Send response back to gateway
|
|
192
|
+
sendToGateway({
|
|
193
|
+
type: 'http_response',
|
|
194
|
+
request_id,
|
|
195
|
+
status: localRes.statusCode || 200,
|
|
196
|
+
headers: localRes.headers,
|
|
197
|
+
body: responseBody.toString('base64'),
|
|
198
|
+
encoding: 'base64'
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
localReq.on('error', (err) => {
|
|
203
|
+
console.error('[Vortex] Local request error:', err.message);
|
|
204
|
+
sendToGateway({
|
|
205
|
+
type: 'http_response',
|
|
206
|
+
request_id,
|
|
207
|
+
status: 502,
|
|
208
|
+
headers: { 'Content-Type': 'text/plain' },
|
|
209
|
+
body: `Failed to connect to local server: ${err.message}`
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
// Send request body if present
|
|
213
|
+
if (body) {
|
|
214
|
+
// Decode base64 body if encoded
|
|
215
|
+
const bodyBuffer = msg.encoding === 'base64' ? Buffer.from(body, 'base64') : body;
|
|
216
|
+
localReq.write(bodyBuffer);
|
|
217
|
+
}
|
|
218
|
+
localReq.end();
|
|
219
|
+
}
|
|
220
|
+
catch (error) {
|
|
221
|
+
sendToGateway({
|
|
222
|
+
type: 'http_response',
|
|
223
|
+
request_id,
|
|
224
|
+
status: 500,
|
|
225
|
+
headers: { 'Content-Type': 'text/plain' },
|
|
226
|
+
body: `Internal error: ${error.message}`
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Handle new WebSocket connection
|
|
232
|
+
*/
|
|
233
|
+
function handleWebSocketConnect(connId) {
|
|
234
|
+
if (!localPort) {
|
|
235
|
+
sendToGateway({
|
|
236
|
+
type: 'websocket_close',
|
|
237
|
+
conn_id: connId
|
|
238
|
+
});
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
// Create WebSocket connection to local server
|
|
242
|
+
const localWs = new ws_1.default(`ws://localhost:${localPort}/ws`);
|
|
243
|
+
localWs.on('open', () => {
|
|
244
|
+
console.log(`[Vortex] Local WebSocket connected for ${connId.substring(0, 8)}...`);
|
|
245
|
+
websocketConnections.set(connId, localWs);
|
|
246
|
+
});
|
|
247
|
+
localWs.on('message', (data) => {
|
|
248
|
+
// Forward data from local server to browser through gateway
|
|
249
|
+
// Local server sends JSON text, we need to preserve it
|
|
250
|
+
if (Buffer.isBuffer(data)) {
|
|
251
|
+
sendToGateway({
|
|
252
|
+
type: 'websocket_data',
|
|
253
|
+
conn_id: connId,
|
|
254
|
+
data: data.toString('base64'),
|
|
255
|
+
binary: true
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
// data is already a string (JSON), send it as-is
|
|
260
|
+
sendToGateway({
|
|
261
|
+
type: 'websocket_data',
|
|
262
|
+
conn_id: connId,
|
|
263
|
+
data: data.toString(),
|
|
264
|
+
binary: false
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
localWs.on('close', () => {
|
|
269
|
+
console.log(`[Vortex] Local WebSocket closed for ${connId.substring(0, 8)}...`);
|
|
270
|
+
websocketConnections.delete(connId);
|
|
271
|
+
sendToGateway({
|
|
272
|
+
type: 'websocket_close',
|
|
273
|
+
conn_id: connId
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
localWs.on('error', (err) => {
|
|
277
|
+
console.error(`[Vortex] Local WebSocket error for ${connId.substring(0, 8)}...`, err.message);
|
|
278
|
+
websocketConnections.delete(connId);
|
|
279
|
+
sendToGateway({
|
|
280
|
+
type: 'websocket_close',
|
|
281
|
+
conn_id: connId
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Handle WebSocket message from browser
|
|
287
|
+
*/
|
|
288
|
+
function handleWebSocketMessage(connId, data) {
|
|
289
|
+
const localWs = websocketConnections.get(connId);
|
|
290
|
+
if (localWs && localWs.readyState === ws_1.default.OPEN) {
|
|
291
|
+
localWs.send(data);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Handle WebSocket binary data from browser
|
|
296
|
+
*/
|
|
297
|
+
function handleWebSocketBinary(connId, data) {
|
|
298
|
+
const localWs = websocketConnections.get(connId);
|
|
299
|
+
if (localWs && localWs.readyState === ws_1.default.OPEN) {
|
|
300
|
+
// Decode base64 and send as binary
|
|
301
|
+
const buffer = Buffer.from(data, 'base64');
|
|
302
|
+
localWs.send(buffer);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Handle WebSocket disconnection from browser
|
|
307
|
+
*/
|
|
308
|
+
function handleWebSocketDisconnect(connId) {
|
|
309
|
+
const localWs = websocketConnections.get(connId);
|
|
310
|
+
if (localWs) {
|
|
311
|
+
localWs.close();
|
|
312
|
+
websocketConnections.delete(connId);
|
|
313
|
+
console.log(`[Vortex] WebSocket disconnected for ${connId.substring(0, 8)}...`);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Send message to gateway
|
|
318
|
+
*/
|
|
319
|
+
function sendToGateway(msg) {
|
|
320
|
+
if (tunnelWs && tunnelWs.readyState === ws_1.default.OPEN) {
|
|
321
|
+
tunnelWs.send(JSON.stringify(msg));
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Clean up resources
|
|
326
|
+
*/
|
|
327
|
+
function cleanup() {
|
|
328
|
+
// Clear any pending requests
|
|
329
|
+
pendingRequests.forEach(({ reject, timeout }) => {
|
|
330
|
+
clearTimeout(timeout);
|
|
331
|
+
reject(new Error('Tunnel closed'));
|
|
332
|
+
});
|
|
333
|
+
pendingRequests.clear();
|
|
334
|
+
// Close all WebSocket connections
|
|
335
|
+
websocketConnections.forEach(ws => {
|
|
336
|
+
ws.close();
|
|
337
|
+
});
|
|
338
|
+
websocketConnections.clear();
|
|
339
|
+
}
|
|
340
|
+
function stopTunnel() {
|
|
341
|
+
if (tunnelWs) {
|
|
342
|
+
tunnelWs.close();
|
|
343
|
+
tunnelWs = null;
|
|
344
|
+
}
|
|
345
|
+
cleanup();
|
|
346
|
+
tunnelUrl = null;
|
|
347
|
+
sessionId = null;
|
|
348
|
+
}
|
|
349
|
+
function getTunnelUrl() {
|
|
350
|
+
return tunnelUrl;
|
|
351
|
+
}
|
|
352
|
+
function isTunnelRunning() {
|
|
353
|
+
return tunnelWs !== null && tunnelWs.readyState === ws_1.default.OPEN;
|
|
354
|
+
}
|
|
355
|
+
//# sourceMappingURL=vortex-tunnel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vortex-tunnel.js","sourceRoot":"","sources":["../src/vortex-tunnel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,kCAqEC;AA+PD,gCAQC;AAED,oCAEC;AAED,0CAEC;AA3WD,kDAA0B;AAC1B,4CAA2B;AAC3B,2CAA6B;AAI7B,IAAI,QAAQ,GAAqB,IAAI,CAAC;AACtC,IAAI,SAAS,GAAkB,IAAI,CAAC;AACpC,IAAI,SAAS,GAAkB,IAAI,CAAC;AACpC,IAAI,UAAU,GAAkB,IAAI,CAAC;AACrC,IAAI,SAAS,GAAkB,IAAI,CAAC;AAEpC,qCAAqC;AACrC,MAAM,eAAe,GAAG,IAAI,GAAG,EAI3B,CAAC;AAEL;;;GAGG;AACH,SAAgB,WAAW,CAAC,OAAe,IAAI,EAAE,OAAgB;IAC7D,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;QACzC,IAAI,CAAC;YACD,SAAS,GAAG,IAAI,CAAC;YACjB,UAAU,GAAG,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,kCAAkC,CAAC;YAEzF,OAAO,CAAC,GAAG,CAAC,qCAAqC,UAAU,EAAE,CAAC,CAAC;YAE/D,oCAAoC;YACpC,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,IAAI,CAAC,GAAG,UAAU,cAAc,EAAE;gBAC3D,WAAW,EAAE;oBACT,IAAI,EAAE,kBAAkB;oBACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;oBAC1B,IAAI,EAAE,YAAY;iBACrB;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