new(all): Alpha Word Debugger for 3.0.
This commit is contained in:
parent
b5da93b5cf
commit
48644060da
3 changed files with 38 additions and 19 deletions
25
package-lock.json
generated
25
package-lock.json
generated
|
@ -43,6 +43,7 @@
|
|||
"botframework-connector": "4.11.0",
|
||||
"botlib": "1.10.9",
|
||||
"c3-chart-maker": "^0.2.8",
|
||||
"cd": "^0.3.3",
|
||||
"chrome-remote-interface": "^0.31.3",
|
||||
"cli-progress": "^3.11.2",
|
||||
"cli-spinner": "0.2.10",
|
||||
|
@ -59,7 +60,6 @@
|
|||
"google-libphonenumber": "3.2.21",
|
||||
"googleapis": "75.0.0",
|
||||
"ibm-watson": "6.1.1",
|
||||
"indent": "^0.0.2",
|
||||
"indent.js": "^0.3.5",
|
||||
"js-beautify": "1.13.13",
|
||||
"keyv": "^4.5.0",
|
||||
|
@ -8645,6 +8645,14 @@
|
|||
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
|
||||
"integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw=="
|
||||
},
|
||||
"node_modules/cd": {
|
||||
"version": "0.3.3",
|
||||
"resolved": "https://registry.npmjs.org/cd/-/cd-0.3.3.tgz",
|
||||
"integrity": "sha512-X2y0Ssu48ucdkrNgCdg6k3EZWjWVy/dsEywUUTeZEIW31f3bQfq65Svm+TzU1Hz+qqhdmyCdjGhUvRsSKHl/mw==",
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/center-align": {
|
||||
"version": "0.1.3",
|
||||
"resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz",
|
||||
|
@ -16297,11 +16305,6 @@
|
|||
"node": ">=0.8.19"
|
||||
}
|
||||
},
|
||||
"node_modules/indent": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "https://registry.npmjs.org/indent/-/indent-0.0.2.tgz",
|
||||
"integrity": "sha512-/F1w9/msSQCfXDTvEU8rKBObcv4cBN6m8hujC/zwVc8vOuf4b76AwBVGChbg+3o0M3kp1XDjoMDQR5Nh6SAHfA=="
|
||||
},
|
||||
"node_modules/indent-string": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz",
|
||||
|
@ -41046,6 +41049,11 @@
|
|||
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
|
||||
"integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw=="
|
||||
},
|
||||
"cd": {
|
||||
"version": "0.3.3",
|
||||
"resolved": "https://registry.npmjs.org/cd/-/cd-0.3.3.tgz",
|
||||
"integrity": "sha512-X2y0Ssu48ucdkrNgCdg6k3EZWjWVy/dsEywUUTeZEIW31f3bQfq65Svm+TzU1Hz+qqhdmyCdjGhUvRsSKHl/mw=="
|
||||
},
|
||||
"center-align": {
|
||||
"version": "0.1.3",
|
||||
"resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz",
|
||||
|
@ -47140,11 +47148,6 @@
|
|||
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
|
||||
"integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA=="
|
||||
},
|
||||
"indent": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "https://registry.npmjs.org/indent/-/indent-0.0.2.tgz",
|
||||
"integrity": "sha512-/F1w9/msSQCfXDTvEU8rKBObcv4cBN6m8hujC/zwVc8vOuf4b76AwBVGChbg+3o0M3kp1XDjoMDQR5Nh6SAHfA=="
|
||||
},
|
||||
"indent-string": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz",
|
||||
|
|
|
@ -207,22 +207,32 @@ export class DebuggerService {
|
|||
}
|
||||
|
||||
public async resume({ botId, botApiKey, force }) {
|
||||
const client = GBServer.globals.debuggers[botId].client;
|
||||
await client.Debugger.resume();
|
||||
if (GBServer.globals.debuggers[botId].state === 2) {
|
||||
const client = GBServer.globals.debuggers[botId].client;
|
||||
await client.Debugger.resume();
|
||||
GBServer.globals.debuggers[botId].state = 1;
|
||||
return {status: 'OK'};
|
||||
} else {
|
||||
const error = 'Invalid call to resume and state not being debug(2).';
|
||||
return {error: error};
|
||||
}
|
||||
}
|
||||
|
||||
public async stop({ botId, botApiKey, force }) {
|
||||
GBServer.globals.debuggers[botId].state = 0;
|
||||
const client = GBServer.globals.debuggers[botId].client;
|
||||
await client.close();
|
||||
await client.Debugger.close();
|
||||
return {status: 'OK'};
|
||||
}
|
||||
|
||||
public async step({ botId, botApiKey }) {
|
||||
if (GBServer.globals.debuggers[botId].state === 2) {
|
||||
const client = GBServer.globals.debuggers[botId].client;
|
||||
await client.stepOver();
|
||||
await client.Debugger.stepOver();
|
||||
return {status: 'OK'};
|
||||
} else {
|
||||
throw new GBError(new Error('Invalid call to stepOver and state not being debug(2).'));
|
||||
const error = 'Invalid call to stepOver and state not being debug(2).';
|
||||
return {error: error};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,6 +261,7 @@ export class DebuggerService {
|
|||
let messagesText = messages.join('\n');
|
||||
|
||||
return {
|
||||
status: 'OK',
|
||||
state: GBServer.globals.debuggers[botId].state,
|
||||
messagesText,
|
||||
scope: GBServer.globals.debuggers[botId].scope
|
||||
|
@ -258,11 +269,14 @@ export class DebuggerService {
|
|||
}
|
||||
|
||||
public async debug({ botId, botApiKey, scriptName }) {
|
||||
let error;
|
||||
if (GBServer.globals.debuggers[botId].state === 1) {
|
||||
throw new Error(`Cannot DEBUG an already running process. ${botId}`);
|
||||
error = `Cannot DEBUG an already running process. ${botId}`;
|
||||
return {error: error};
|
||||
} else if (GBServer.globals.debuggers[botId].state === 2) {
|
||||
GBLog.info(`BASIC: Releasing execution ${botId} in DEBUG mode.`);
|
||||
return await this.continueRun({ botId, botApiKey, force: false });
|
||||
await this.resume({ botId, botApiKey, force: false });
|
||||
return {status: 'OK'};
|
||||
} else {
|
||||
GBLog.info(`BASIC: Running ${botId} in DEBUG mode.`);
|
||||
|
||||
|
@ -295,6 +309,8 @@ export class DebuggerService {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
return {status: 'OK'};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,6 +111,7 @@ const createVm2Pool = ({ min, max, ...limits }) => {
|
|||
}
|
||||
});
|
||||
}
|
||||
GBServer.globals.debuggers[limits.botId].scope = variablesText;
|
||||
GBLog.info(`BASIC: Breakpoint variables: ${variablesText}`); // (zero-based)
|
||||
|
||||
// Processes breakpoint hits.
|
||||
|
@ -118,7 +119,6 @@ const createVm2Pool = ({ min, max, ...limits }) => {
|
|||
if (hitBreakpoints.length >= 1) {
|
||||
GBLog.info(`BASIC: Break at line ${frame.location.lineNumber + 1}`); // (zero-based)
|
||||
|
||||
GBServer.globals.debuggers[limits.botId].scope = variablesText;
|
||||
GBServer.globals.debuggers[limits.botId].state = 2;
|
||||
} else {
|
||||
GBLog.info(`BASIC: Configuring breakpoints if any for ${limits.botId}`);
|
||||
|
|
Loading…
Add table
Reference in a new issue