@codebolt/codeboltjs 1.1.28 → 1.1.30
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.d.ts +5 -1
- package/modules/codeutils.d.ts +3 -1
- package/modules/codeutils.js +36 -6
- package/modules/state.d.ts +2 -0
- package/modules/state.js +32 -0
- package/package.json +1 -1
- package/src/modules/codeutils.ts +39 -6
- package/src/modules/state.ts +34 -0
package/index.d.ts
CHANGED
|
@@ -99,7 +99,9 @@ declare class Codebolt {
|
|
|
99
99
|
getCodeTree: () => Promise<any>;
|
|
100
100
|
getJsTree: (filePath: string) => Promise<any>;
|
|
101
101
|
getAllFilesAsMarkDown: () => Promise<unknown>;
|
|
102
|
-
|
|
102
|
+
performMatch: (matcherDefinition: object, problemPatterns: [], problems: []) => Promise<unknown>;
|
|
103
|
+
getMatcherList: () => Promise<unknown>;
|
|
104
|
+
matchDetail: (matcher: string) => Promise<unknown>;
|
|
103
105
|
};
|
|
104
106
|
docutils: {
|
|
105
107
|
pdf_to_text: (pdf_path: any) => Promise<string>;
|
|
@@ -145,6 +147,8 @@ declare class Codebolt {
|
|
|
145
147
|
};
|
|
146
148
|
cbstate: {
|
|
147
149
|
getApplicationState: () => Promise<any>;
|
|
150
|
+
addToAgentState: (key: string, value: string) => Promise<void>;
|
|
151
|
+
getAgentState: () => Promise<any>;
|
|
148
152
|
};
|
|
149
153
|
taskplaner: {
|
|
150
154
|
addTask: (task: string) => Promise<any>;
|
package/modules/codeutils.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ declare const cbcodeutils: {
|
|
|
5
5
|
getCodeTree: () => Promise<any>;
|
|
6
6
|
getJsTree: (filePath: string) => Promise<any>;
|
|
7
7
|
getAllFilesAsMarkDown: () => Promise<unknown>;
|
|
8
|
-
|
|
8
|
+
performMatch: (matcherDefinition: object, problemPatterns: [], problems: []) => Promise<unknown>;
|
|
9
|
+
getMatcherList: () => Promise<unknown>;
|
|
10
|
+
matchDetail: (matcher: string) => Promise<unknown>;
|
|
9
11
|
};
|
|
10
12
|
export default cbcodeutils;
|
package/modules/codeutils.js
CHANGED
|
@@ -33,8 +33,8 @@ const cbcodeutils = {
|
|
|
33
33
|
}));
|
|
34
34
|
websocket_1.default.getWebsocket.on('message', (data) => {
|
|
35
35
|
const response = JSON.parse(data);
|
|
36
|
-
if (response.type === "
|
|
37
|
-
resolve(
|
|
36
|
+
if (response.type === "getJsTreeResponse") {
|
|
37
|
+
resolve(resolve); // Resolve the Promise with the response data
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
});
|
|
@@ -53,21 +53,51 @@ const cbcodeutils = {
|
|
|
53
53
|
});
|
|
54
54
|
});
|
|
55
55
|
},
|
|
56
|
-
|
|
56
|
+
performMatch: (matcherDefinition, problemPatterns, problems) => {
|
|
57
57
|
return new Promise((resolve, reject) => {
|
|
58
58
|
websocket_1.default.getWebsocket.send(JSON.stringify({
|
|
59
59
|
"type": "codeEvent",
|
|
60
|
-
"action": "
|
|
60
|
+
"action": "performMatch",
|
|
61
61
|
payload: {
|
|
62
62
|
matcherDefinition,
|
|
63
63
|
problemPatterns,
|
|
64
|
-
problems
|
|
65
64
|
}
|
|
66
65
|
}));
|
|
67
66
|
websocket_1.default.getWebsocket.on('message', (data) => {
|
|
68
67
|
const response = JSON.parse(data);
|
|
69
68
|
if (response.type === "getgetJsTreeResponse") {
|
|
70
|
-
resolve(
|
|
69
|
+
resolve(resolve); // Resolve the Promise with the response data
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
getMatcherList: () => {
|
|
75
|
+
return new Promise((resolve, reject) => {
|
|
76
|
+
websocket_1.default.getWebsocket.send(JSON.stringify({
|
|
77
|
+
"type": "codeEvent",
|
|
78
|
+
"action": "getMatcherList",
|
|
79
|
+
}));
|
|
80
|
+
websocket_1.default.getWebsocket.on('message', (data) => {
|
|
81
|
+
const response = JSON.parse(data);
|
|
82
|
+
if (response.type === "getMatcherListTreeResponse") {
|
|
83
|
+
resolve(resolve); // Resolve the Promise with the response data
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
matchDetail: (matcher) => {
|
|
89
|
+
return new Promise((resolve, reject) => {
|
|
90
|
+
websocket_1.default.getWebsocket.send(JSON.stringify({
|
|
91
|
+
"type": "codeEvent",
|
|
92
|
+
"action": "getMatchDetail",
|
|
93
|
+
payload: {
|
|
94
|
+
match: matcher
|
|
95
|
+
}
|
|
96
|
+
}));
|
|
97
|
+
websocket_1.default.getWebsocket.on('message', (data) => {
|
|
98
|
+
const response = JSON.parse(data);
|
|
99
|
+
if (response.type === "matchDetailTreeResponse") {
|
|
100
|
+
resolve(resolve); // Resolve the Promise with the response data
|
|
71
101
|
}
|
|
72
102
|
});
|
|
73
103
|
});
|
package/modules/state.d.ts
CHANGED
package/modules/state.js
CHANGED
|
@@ -21,6 +21,38 @@ const cbstate = {
|
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
});
|
|
24
|
+
},
|
|
25
|
+
addToAgentState: async (key, value) => {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
websocket_1.default.getWebsocket.send(JSON.stringify({
|
|
28
|
+
"type": "agentStateEvent",
|
|
29
|
+
"action": "addToAgentState",
|
|
30
|
+
payload: {
|
|
31
|
+
key,
|
|
32
|
+
value
|
|
33
|
+
}
|
|
34
|
+
}));
|
|
35
|
+
websocket_1.default.getWebsocket.on('message', (data) => {
|
|
36
|
+
const response = JSON.parse(data);
|
|
37
|
+
if (response.type === "addToAgentStateResponse") {
|
|
38
|
+
resolve(response); // Resolve the Promise with the response data
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
getAgentState: async () => {
|
|
44
|
+
return new Promise((resolve, reject) => {
|
|
45
|
+
websocket_1.default.getWebsocket.send(JSON.stringify({
|
|
46
|
+
"type": "agentStateEvent",
|
|
47
|
+
"action": "getAgentState",
|
|
48
|
+
}));
|
|
49
|
+
websocket_1.default.getWebsocket.on('message', (data) => {
|
|
50
|
+
const response = JSON.parse(data);
|
|
51
|
+
if (response.type === "getAgentStateResponse") {
|
|
52
|
+
resolve(response); // Resolve the Promise with the response data
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
});
|
|
24
56
|
}
|
|
25
57
|
};
|
|
26
58
|
exports.default = cbstate;
|
package/package.json
CHANGED
package/src/modules/codeutils.ts
CHANGED
|
@@ -31,8 +31,8 @@ const cbcodeutils = {
|
|
|
31
31
|
}));
|
|
32
32
|
cbws.getWebsocket.on('message', (data: string) => {
|
|
33
33
|
const response = JSON.parse(data);
|
|
34
|
-
if (response.type === "
|
|
35
|
-
resolve(
|
|
34
|
+
if (response.type === "getJsTreeResponse") {
|
|
35
|
+
resolve(resolve); // Resolve the Promise with the response data
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
});
|
|
@@ -51,25 +51,58 @@ const cbcodeutils = {
|
|
|
51
51
|
});
|
|
52
52
|
});
|
|
53
53
|
},
|
|
54
|
-
|
|
54
|
+
performMatch:(matcherDefinition:object, problemPatterns:[], problems:[])=>{
|
|
55
55
|
return new Promise((resolve, reject) => {
|
|
56
56
|
cbws.getWebsocket.send(JSON.stringify({
|
|
57
57
|
"type": "codeEvent",
|
|
58
|
-
"action":"
|
|
58
|
+
"action":"performMatch",
|
|
59
59
|
payload:{
|
|
60
60
|
matcherDefinition,
|
|
61
61
|
problemPatterns,
|
|
62
|
-
problems
|
|
63
62
|
}
|
|
64
63
|
}));
|
|
65
64
|
cbws.getWebsocket.on('message', (data: string) => {
|
|
66
65
|
const response = JSON.parse(data);
|
|
67
66
|
if (response.type === "getgetJsTreeResponse") {
|
|
68
|
-
resolve(
|
|
67
|
+
resolve(resolve); // Resolve the Promise with the response data
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
getMatcherList:()=>{
|
|
73
|
+
return new Promise((resolve, reject) => {
|
|
74
|
+
cbws.getWebsocket.send(JSON.stringify({
|
|
75
|
+
"type": "codeEvent",
|
|
76
|
+
"action":"getMatcherList",
|
|
77
|
+
|
|
78
|
+
}));
|
|
79
|
+
cbws.getWebsocket.on('message', (data: string) => {
|
|
80
|
+
const response = JSON.parse(data);
|
|
81
|
+
if (response.type === "getMatcherListTreeResponse") {
|
|
82
|
+
resolve(resolve); // Resolve the Promise with the response data
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
matchDetail:(matcher:string)=>{
|
|
88
|
+
return new Promise((resolve, reject) => {
|
|
89
|
+
cbws.getWebsocket.send(JSON.stringify({
|
|
90
|
+
"type": "codeEvent",
|
|
91
|
+
"action":"getMatchDetail",
|
|
92
|
+
payload:{
|
|
93
|
+
match:matcher
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
}));
|
|
97
|
+
cbws.getWebsocket.on('message', (data: string) => {
|
|
98
|
+
const response = JSON.parse(data);
|
|
99
|
+
if (response.type === "matchDetailTreeResponse") {
|
|
100
|
+
resolve(resolve); // Resolve the Promise with the response data
|
|
69
101
|
}
|
|
70
102
|
});
|
|
71
103
|
});
|
|
72
104
|
}
|
|
105
|
+
|
|
73
106
|
};
|
|
74
107
|
|
|
75
108
|
export default cbcodeutils;
|
package/src/modules/state.ts
CHANGED
|
@@ -18,6 +18,40 @@ const cbstate = {
|
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
});
|
|
21
|
+
},
|
|
22
|
+
addToAgentState: async (key: string, value: string): Promise<void> => {
|
|
23
|
+
return new Promise((resolve, reject) => {
|
|
24
|
+
cbws.getWebsocket.send(JSON.stringify({
|
|
25
|
+
"type": "agentStateEvent",
|
|
26
|
+
"action":"addToAgentState",
|
|
27
|
+
payload:{
|
|
28
|
+
key,
|
|
29
|
+
value
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
}));
|
|
33
|
+
cbws.getWebsocket.on('message', (data: string) => {
|
|
34
|
+
const response = JSON.parse(data);
|
|
35
|
+
if (response.type === "addToAgentStateResponse") {
|
|
36
|
+
resolve(response); // Resolve the Promise with the response data
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
getAgentState: async (): Promise<any> => {
|
|
42
|
+
return new Promise((resolve, reject) => {
|
|
43
|
+
cbws.getWebsocket.send(JSON.stringify({
|
|
44
|
+
"type": "agentStateEvent",
|
|
45
|
+
"action":"getAgentState",
|
|
46
|
+
|
|
47
|
+
}));
|
|
48
|
+
cbws.getWebsocket.on('message', (data: string) => {
|
|
49
|
+
const response = JSON.parse(data);
|
|
50
|
+
if (response.type === "getAgentStateResponse") {
|
|
51
|
+
resolve(response); // Resolve the Promise with the response data
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
21
55
|
}
|
|
22
56
|
};
|
|
23
57
|
|