Skip to content

Commit f258f4e

Browse files
committed
added uuid
1 parent e971bce commit f258f4e

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

package-lock.json

Lines changed: 23 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"@codebolt/types": "^1.0.10",
3333
"@modelcontextprotocol/sdk": "^1.4.1",
3434
"@types/pdf-parse": "^1.1.5",
35+
"@types/uuid": "^10.0.0",
3536
"buffer": "^6.0.3",
3637
"execa": "^9.5.2",
3738
"file-type": "^19.6.0",
@@ -48,6 +49,7 @@
4849
"undici": "^7.4.0",
4950
"uri-templates": "^0.2.0",
5051
"util": "^0.12.5",
52+
"uuid": "^11.1.0",
5153
"web-tree-sitter": "^0.24.1",
5254
"ws": "^8.17.0",
5355
"yargs": "^17.7.2",

src/core/messageManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import WebSocket from 'ws';
22
import { EventEmitter } from 'events';
3+
import { v4 as uuidv4 } from 'uuid';
34
import type { PendingRequest } from '../types/commonTypes';
45

56
/**
@@ -8,7 +9,6 @@ import type { PendingRequest } from '../types/commonTypes';
89
export class MessageManager extends EventEmitter {
910
public pendingRequests: Map<string, PendingRequest> = new Map();
1011
public websocket: WebSocket | null = null;
11-
public requestCounter = 0;
1212

1313
/**
1414
* Initialize the message manager with a WebSocket instance
@@ -78,7 +78,7 @@ export class MessageManager extends EventEmitter {
7878
return;
7979
}
8080

81-
const requestId = `req_${++this.requestCounter}_${Date.now()}`;
81+
const requestId = uuidv4();
8282

8383
// Add requestId to the message if it doesn't have one
8484
const messageWithId = { ...message, requestId };

0 commit comments

Comments
 (0)