@codebolt/codeboltjs 1.1.20 → 1.1.21
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/index.js +2 -0
- package/modules/debug.d.ts +9 -0
- package/modules/debug.js +33 -0
- package/package.json +1 -1
- package/src/index.ts +2 -1
- package/src/modules/debug.ts +36 -0
package/index.js
CHANGED
|
@@ -23,6 +23,7 @@ const dbmemory_1 = __importDefault(require("./modules/dbmemory"));
|
|
|
23
23
|
const state_1 = __importDefault(require("./modules/state"));
|
|
24
24
|
const task_1 = __importDefault(require("./modules/task"));
|
|
25
25
|
const vectordb_1 = __importDefault(require("./modules/vectordb"));
|
|
26
|
+
const debug_1 = __importDefault(require("./modules/debug"));
|
|
26
27
|
const ws_1 = __importDefault(require("ws"));
|
|
27
28
|
/**
|
|
28
29
|
* @class Codebolt
|
|
@@ -54,6 +55,7 @@ class Codebolt {
|
|
|
54
55
|
this.cbstate = state_1.default;
|
|
55
56
|
this.taskplaner = task_1.default;
|
|
56
57
|
this.vectordb = vectordb_1.default;
|
|
58
|
+
this.debug = debug_1.default;
|
|
57
59
|
this.websocket = websocket_1.default.getWebsocket;
|
|
58
60
|
}
|
|
59
61
|
/**
|
package/modules/debug.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
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.debug = void 0;
|
|
7
|
+
const websocket_1 = __importDefault(require("./websocket"));
|
|
8
|
+
var logType;
|
|
9
|
+
(function (logType) {
|
|
10
|
+
logType["info"] = "info";
|
|
11
|
+
logType["error"] = "error";
|
|
12
|
+
logType["warning"] = "warning";
|
|
13
|
+
})(logType || (logType = {}));
|
|
14
|
+
exports.debug = {
|
|
15
|
+
debug(log, type) {
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
websocket_1.default.getWebsocket.send(JSON.stringify({
|
|
18
|
+
"type": "debugEvent",
|
|
19
|
+
message: {
|
|
20
|
+
log,
|
|
21
|
+
type
|
|
22
|
+
}
|
|
23
|
+
}));
|
|
24
|
+
websocket_1.default.getWebsocket.on('message', (data) => {
|
|
25
|
+
const response = JSON.parse(data);
|
|
26
|
+
if (response.type === "debugEventResponse") {
|
|
27
|
+
resolve(response); // Resolve the Promise with the response data
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
exports.default = exports.debug;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -17,8 +17,8 @@ import git from './modules/git';
|
|
|
17
17
|
import dbmemory from './modules/dbmemory';
|
|
18
18
|
import cbstate from './modules/state';
|
|
19
19
|
import task from './modules/task';
|
|
20
|
-
|
|
21
20
|
import vectorDB from './modules/vectordb';
|
|
21
|
+
import debug from './modules/debug'
|
|
22
22
|
import WebSocket from 'ws';
|
|
23
23
|
|
|
24
24
|
|
|
@@ -94,6 +94,7 @@ class Codebolt {
|
|
|
94
94
|
cbstate=cbstate;
|
|
95
95
|
taskplaner=task;
|
|
96
96
|
vectordb=vectorDB;
|
|
97
|
+
debug=debug;
|
|
97
98
|
}
|
|
98
99
|
|
|
99
100
|
// export default new Codebolt();
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import cbws from './websocket';
|
|
2
|
+
|
|
3
|
+
enum logType{
|
|
4
|
+
info="info",
|
|
5
|
+
error="error",
|
|
6
|
+
warning="warning"
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export const debug={
|
|
11
|
+
debug(log:string,type:logType) {
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
cbws.getWebsocket.send(JSON.stringify({
|
|
14
|
+
"type": "debugEvent",
|
|
15
|
+
message:{
|
|
16
|
+
log,
|
|
17
|
+
type
|
|
18
|
+
}
|
|
19
|
+
}));
|
|
20
|
+
cbws.getWebsocket.on('message', (data: string) => {
|
|
21
|
+
const response = JSON.parse(data);
|
|
22
|
+
if (response.type === "debugEventResponse") {
|
|
23
|
+
resolve(response); // Resolve the Promise with the response data
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
export default debug;
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|