Skip to content

Commit b7ae996

Browse files
changes
1 parent beef9f5 commit b7ae996

File tree

8 files changed

+181
-2
lines changed

8 files changed

+181
-2
lines changed

.codebolt/chat.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]

.codebolt/debug.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]

.codebolt/projectState.json

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
{
2+
"0": "{",
3+
"1": "\n",
4+
"2": " ",
5+
"3": " ",
6+
"4": "\"",
7+
"5": "a",
8+
"6": "c",
9+
"7": "t",
10+
"8": "i",
11+
"9": "v",
12+
"10": "e",
13+
"11": "A",
14+
"12": "g",
15+
"13": "e",
16+
"14": "n",
17+
"15": "t",
18+
"16": "\"",
19+
"17": ":",
20+
"18": " ",
21+
"19": "f",
22+
"20": "a",
23+
"21": "l",
24+
"22": "s",
25+
"23": "e",
26+
"24": ",",
27+
"25": "\n",
28+
"26": " ",
29+
"27": " ",
30+
"28": "\"",
31+
"29": "p",
32+
"30": "i",
33+
"31": "n",
34+
"32": "n",
35+
"33": "e",
36+
"34": "d",
37+
"35": "A",
38+
"36": "g",
39+
"37": "e",
40+
"38": "n",
41+
"39": "t",
42+
"40": "\"",
43+
"41": ":",
44+
"42": " ",
45+
"43": "[",
46+
"44": "]",
47+
"45": "\n",
48+
"46": "}",
49+
"currentLayout": {
50+
"grid": {
51+
"root": {
52+
"type": "branch",
53+
"data": [
54+
{
55+
"type": "leaf",
56+
"data": {
57+
"views": [
58+
"Code"
59+
],
60+
"activeView": "Code",
61+
"id": "1"
62+
},
63+
"size": 735
64+
},
65+
{
66+
"type": "branch",
67+
"data": [
68+
{
69+
"type": "leaf",
70+
"data": {
71+
"views": [
72+
"Chat"
73+
],
74+
"activeView": "Chat",
75+
"id": "2"
76+
},
77+
"size": 577
78+
},
79+
{
80+
"type": "leaf",
81+
"data": {
82+
"views": [
83+
"Preview"
84+
],
85+
"activeView": "Preview",
86+
"id": "3"
87+
},
88+
"size": 283
89+
}
90+
],
91+
"size": 735
92+
}
93+
],
94+
"size": 860
95+
},
96+
"width": 1470,
97+
"height": 860,
98+
"orientation": "HORIZONTAL"
99+
},
100+
"panels": {
101+
"Code": {
102+
"id": "Code",
103+
"contentComponent": "Code",
104+
"tabComponent": "props.defaultTabComponent",
105+
"title": "Code",
106+
"renderer": "always"
107+
},
108+
"Chat": {
109+
"id": "Chat",
110+
"contentComponent": "Chat",
111+
"tabComponent": "props.defaultTabComponent",
112+
"title": "Chat",
113+
"renderer": "always"
114+
},
115+
"Preview": {
116+
"id": "Preview",
117+
"contentComponent": "Preview",
118+
"tabComponent": "props.defaultTabComponent",
119+
"title": "Preview",
120+
"renderer": "always"
121+
}
122+
},
123+
"activeGroup": "1"
124+
},
125+
"pinnedAgent": [],
126+
"activeAgent": false
127+
}

.codebolt/tasks.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]

index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ declare class Codebolt {
201201
getApplicationState: () => Promise<import("@codebolt/types").ApplicationState>;
202202
addToAgentState: (key: string, value: string) => Promise<import("@codebolt/types").AddToAgentStateResponse>;
203203
getAgentState: () => Promise<import("@codebolt/types").GetAgentStateResponse>;
204+
getProjectState: () => Promise<any>;
205+
updateProjectState: () => Promise<any>;
204206
};
205207
taskplaner: {
206208
addTask: (task: string) => Promise<any>;

modules/state.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,15 @@ declare const cbstate: {
1717
* @returns {Promise<GetAgentStateResponse>} A promise that resolves with the agent's state.
1818
*/
1919
getAgentState: () => Promise<GetAgentStateResponse>;
20+
/**
21+
* Retrieves the current project state from the server via WebSocket.
22+
* @returns {Promise<GetProjectStateResponse>} A promise that resolves with the project's state.
23+
*/
24+
getProjectState: () => Promise<any>;
25+
/**
26+
* Updates the project state on the server via WebSocket.
27+
* @returns {Promise<UpdateProjectStateResponse>} A promise that resolves with the response to the update request.
28+
*/
29+
updateProjectState: () => Promise<any>;
2030
};
2131
export default cbstate;

modules/state.js

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ const cbstate = {
1212
getApplicationState: async () => {
1313
return new Promise((resolve, reject) => {
1414
websocket_1.default.getWebsocket.send(JSON.stringify({
15-
"type": "getAppState",
15+
"type": "projectStateEvent",
16+
"action": "getAppState",
1617
}));
1718
websocket_1.default.getWebsocket.on('message', (data) => {
1819
const response = JSON.parse(data);
@@ -63,6 +64,42 @@ const cbstate = {
6364
}
6465
});
6566
});
67+
},
68+
/**
69+
* Retrieves the current project state from the server via WebSocket.
70+
* @returns {Promise<GetProjectStateResponse>} A promise that resolves with the project's state.
71+
*/
72+
getProjectState: async () => {
73+
return new Promise((resolve, reject) => {
74+
websocket_1.default.getWebsocket.send(JSON.stringify({
75+
"type": "projectStateEvent",
76+
"action": "getProjectState",
77+
}));
78+
websocket_1.default.getWebsocket.on('message', (data) => {
79+
const response = JSON.parse(data);
80+
if (response.type === "getProjectStateResponse") {
81+
resolve(response); // Resolve the Promise with the response data
82+
}
83+
});
84+
});
85+
},
86+
/**
87+
* Updates the project state on the server via WebSocket.
88+
* @returns {Promise<UpdateProjectStateResponse>} A promise that resolves with the response to the update request.
89+
*/
90+
updateProjectState: async () => {
91+
return new Promise((resolve, reject) => {
92+
websocket_1.default.getWebsocket.send(JSON.stringify({
93+
"type": "projectStateEvent",
94+
"action": "updateProjectState",
95+
}));
96+
websocket_1.default.getWebsocket.on('message', (data) => {
97+
const response = JSON.parse(data);
98+
if (response.type === "updateProjectStateResponse") {
99+
resolve(response); // Resolve the Promise with the response data
100+
}
101+
});
102+
});
66103
}
67104
};
68105
exports.default = cbstate;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codebolt/codeboltjs",
3-
"version": "1.1.86",
3+
"version": "1.1.87",
44
"description": "",
55
"keywords": [],
66
"author": "",

0 commit comments

Comments
 (0)