@mablhq/mabl-cli 2.76.0 → 2.76.5
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/commands/config/config_cmds/install.js +1 -1
- package/commands/mcp/mcp_cmds/tools/createMablTest.js +12 -1
- package/commands/mcp/mcp_cmds/tools/createMablTestFromPlan.js +10 -4
- package/commands/mcp/mcp_cmds/tools/planNewTest.js +4 -3
- package/core/trainer/openUtils.js +14 -8
- package/core/trainer/trainingSessions.js +3 -3
- package/execution/index.js +1 -1
- package/package.json +1 -1
|
@@ -41,7 +41,7 @@ const path = __importStar(require("path"));
|
|
|
41
41
|
const resourceUtil_1 = require("../../../util/resourceUtil");
|
|
42
42
|
const OperatingSystemDescriptor_1 = require("../../../mablscript/types/OperatingSystemDescriptor");
|
|
43
43
|
const UI_AUTOMATOR_VERSION = '4.2.3';
|
|
44
|
-
const XCUITEST_VERSION = '9.
|
|
44
|
+
const XCUITEST_VERSION = '9.9.6';
|
|
45
45
|
const addOnConfigKey = 'add-on';
|
|
46
46
|
var AddOnOptions;
|
|
47
47
|
(function (AddOnOptions) {
|
|
@@ -7,6 +7,7 @@ const messaging_1 = require("../../../../core/messaging/messaging");
|
|
|
7
7
|
const mablApi_1 = require("../../../../mablApi");
|
|
8
8
|
const common_1 = require("../utils/common");
|
|
9
9
|
const featureSet_1 = require("../../../../api/featureSet");
|
|
10
|
+
const openUtils_1 = require("../../../../core/trainer/openUtils");
|
|
10
11
|
const createMablTest = (0, mcpMablTool_1.defineTool)({
|
|
11
12
|
schema: {
|
|
12
13
|
name: 'create_mabl_test',
|
|
@@ -110,7 +111,7 @@ const createMablTest = (0, mcpMablTool_1.defineTool)({
|
|
|
110
111
|
if (params.apiSpec) {
|
|
111
112
|
fullIntent += `\n\nAPI spec: ${params.apiSpec}`;
|
|
112
113
|
}
|
|
113
|
-
await (0, trainingSessions_1.trainNewTest)({
|
|
114
|
+
const trainerUrl = await (0, trainingSessions_1.trainNewTest)({
|
|
114
115
|
environmentId: params.environmentId,
|
|
115
116
|
applicationId: params.applicationId,
|
|
116
117
|
credentialsId: params.credentialsId,
|
|
@@ -123,6 +124,16 @@ const createMablTest = (0, mcpMablTool_1.defineTool)({
|
|
|
123
124
|
testType: params.isApiTest ? mablApi_1.TestTypeEnum.Api : mablApi_1.TestTypeEnum.Browser,
|
|
124
125
|
apiDescription: params.apiSpec,
|
|
125
126
|
}, mablApiClient, false);
|
|
127
|
+
if (process.platform === openUtils_1.WIN32_PLATFORM) {
|
|
128
|
+
return {
|
|
129
|
+
content: [
|
|
130
|
+
{
|
|
131
|
+
type: 'text',
|
|
132
|
+
text: `Tell the user to open the following URL to launch the mabl trainer: ${trainerUrl}. Show it using a link, trying to hide the URL full url. If you have a tool that can open a link use it.`,
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
};
|
|
136
|
+
}
|
|
126
137
|
return {
|
|
127
138
|
content: [
|
|
128
139
|
{
|
|
@@ -5,6 +5,7 @@ const mcpMablTool_1 = require("./mcpMablTool");
|
|
|
5
5
|
const trainingSessions_1 = require("../../../../core/trainer/trainingSessions");
|
|
6
6
|
const mablApi_1 = require("../../../../mablApi");
|
|
7
7
|
const common_1 = require("../utils/common");
|
|
8
|
+
const featureSet_1 = require("../../../../api/featureSet");
|
|
8
9
|
const createMablTestFromPlan = (0, mcpMablTool_1.defineTool)({
|
|
9
10
|
schema: {
|
|
10
11
|
name: 'create_mabl_test_from_plan',
|
|
@@ -14,19 +15,24 @@ const createMablTestFromPlan = (0, mcpMablTool_1.defineTool)({
|
|
|
14
15
|
type: 'readOnly',
|
|
15
16
|
},
|
|
16
17
|
handle: async (_, context) => {
|
|
17
|
-
const { mablApiClient, workspaceId,
|
|
18
|
-
if (!
|
|
19
|
-
return (0, common_1.stringToToolResult)('
|
|
18
|
+
const { mablApiClient, workspaceId, planHistory } = context.getCurrentContext();
|
|
19
|
+
if (!context.featureIsAvailable(featureSet_1.GENERATIVE_AI_FEATURE_FLAG)) {
|
|
20
|
+
return (0, common_1.stringToToolResult)('Generative AI is not available for your account. Please contact your workspace owner or mabl support for assistance in activating this feature.', true);
|
|
20
21
|
}
|
|
21
22
|
const { lastArtifact: artifact } = planHistory.getPlanHistoryState();
|
|
22
23
|
if (!artifact) {
|
|
23
24
|
return (0, common_1.stringToToolResult)('No artifact found. Please call #plan_new_test first to create a plan artifact.', true);
|
|
24
25
|
}
|
|
26
|
+
let url = artifact?.test_information?.url_override;
|
|
27
|
+
if (!url && artifact?.test_information?.deployment_id) {
|
|
28
|
+
const deployment = await mablApiClient.getDeploymentEntity(artifact?.test_information?.deployment_id);
|
|
29
|
+
url = deployment.uri;
|
|
30
|
+
}
|
|
25
31
|
await (0, trainingSessions_1.trainNewTest)({
|
|
26
32
|
environmentId: artifact?.test_information?.environment_id,
|
|
27
33
|
applicationId: artifact?.test_information?.application_id,
|
|
28
34
|
credentialsId: artifact?.test_information?.credentials_id,
|
|
29
|
-
url:
|
|
35
|
+
url: url ?? '',
|
|
30
36
|
testName: artifact?.test_information?.name ?? 'New Test',
|
|
31
37
|
autoBranch: false,
|
|
32
38
|
autoLogin: false,
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const zod_1 = require("zod");
|
|
4
4
|
const mcpMablTool_1 = require("./mcpMablTool");
|
|
5
5
|
const mablApi_1 = require("../../../../mablApi");
|
|
6
|
+
const featureSet_1 = require("../../../../api/featureSet");
|
|
6
7
|
const common_1 = require("../utils/common");
|
|
7
8
|
const planNewTest = (0, mcpMablTool_1.defineTool)({
|
|
8
9
|
schema: {
|
|
@@ -28,9 +29,9 @@ const planNewTest = (0, mcpMablTool_1.defineTool)({
|
|
|
28
29
|
},
|
|
29
30
|
handle: async (params, context) => {
|
|
30
31
|
const { originalIntent, requestedChanges, issueOrTicket } = params;
|
|
31
|
-
const { mablApiClient, workspaceId,
|
|
32
|
-
if (!
|
|
33
|
-
return (0, common_1.stringToToolResult)('
|
|
32
|
+
const { mablApiClient, workspaceId, planHistory } = context.getCurrentContext();
|
|
33
|
+
if (!context.featureIsAvailable(featureSet_1.GENERATIVE_AI_FEATURE_FLAG)) {
|
|
34
|
+
return (0, common_1.stringToToolResult)('Generative AI is not available for your account. Please contact your workspace owner or mabl support for assistance in activating this feature.', true);
|
|
34
35
|
}
|
|
35
36
|
if (!requestedChanges) {
|
|
36
37
|
planHistory.reset();
|
|
@@ -36,6 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.WIN32_PLATFORM = void 0;
|
|
39
40
|
exports.openUrlInDesktopApp = openUrlInDesktopApp;
|
|
40
41
|
exports.logSessionStarted = logSessionStarted;
|
|
41
42
|
const open_1 = __importDefault(require("open"));
|
|
@@ -46,6 +47,7 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
46
47
|
const encodingUtil_1 = require("../../util/encodingUtil");
|
|
47
48
|
const http = __importStar(require("http"));
|
|
48
49
|
const MAX_URL_LENGTH = 1_500;
|
|
50
|
+
exports.WIN32_PLATFORM = 'win32';
|
|
49
51
|
async function createConfigServer(config) {
|
|
50
52
|
const server = http.createServer((req, res) => {
|
|
51
53
|
if (req.url === '/config') {
|
|
@@ -61,13 +63,8 @@ async function createConfigServer(config) {
|
|
|
61
63
|
return new Promise((resolve, reject) => {
|
|
62
64
|
server.listen(0, () => {
|
|
63
65
|
const port = server.address().port;
|
|
64
|
-
const requestPromise = new Promise((resolveRequest
|
|
65
|
-
const timeout = (0, timers_1.setTimeout)(() => {
|
|
66
|
-
server.close();
|
|
67
|
-
rejectRequest(new Error('No request received within 1 minute'));
|
|
68
|
-
}, 60_000);
|
|
66
|
+
const requestPromise = new Promise((resolveRequest) => {
|
|
69
67
|
server.on('close', () => {
|
|
70
|
-
global.clearTimeout(timeout);
|
|
71
68
|
resolveRequest();
|
|
72
69
|
});
|
|
73
70
|
});
|
|
@@ -80,14 +77,19 @@ async function openUrlInDesktopApp(url, trainingSessionOptions, waitProcessToExi
|
|
|
80
77
|
let server;
|
|
81
78
|
let childProcess;
|
|
82
79
|
const params = (0, encodingUtil_1.encodeTestConfigAsParamsForParsedUrlProtocol)(trainingSessionOptions, encodingUtil_1.b64EncodeUnicodeInNode, false);
|
|
83
|
-
|
|
80
|
+
let trainerUrl = `${env_1.ELECTRON_PROTOCOL}://${url}/${params}`;
|
|
81
|
+
const urlLength = trainerUrl.length;
|
|
84
82
|
if (urlLength > MAX_URL_LENGTH) {
|
|
85
83
|
try {
|
|
86
84
|
const serverResult = await createConfigServer({
|
|
87
85
|
[encodingUtil_1.TEST_CONFIG_URL_PARAM_KEY]: (0, encodingUtil_1.b64EncodeUnicodeInNode)(JSON.stringify(trainingSessionOptions)),
|
|
88
86
|
});
|
|
89
87
|
server = serverResult.server;
|
|
90
|
-
|
|
88
|
+
trainerUrl = `${env_1.ELECTRON_PROTOCOL}://${url}/configPort=${serverResult.port}`;
|
|
89
|
+
if (process.platform === exports.WIN32_PLATFORM) {
|
|
90
|
+
return trainerUrl;
|
|
91
|
+
}
|
|
92
|
+
childProcess = await (0, open_1.default)(trainerUrl);
|
|
91
93
|
try {
|
|
92
94
|
await serverResult.requestPromise;
|
|
93
95
|
}
|
|
@@ -101,6 +103,9 @@ async function openUrlInDesktopApp(url, trainingSessionOptions, waitProcessToExi
|
|
|
101
103
|
childProcess = await (0, open_1.default)(`${env_1.ELECTRON_PROTOCOL}://${url}/${params}`);
|
|
102
104
|
}
|
|
103
105
|
}
|
|
106
|
+
else if (process.platform === exports.WIN32_PLATFORM) {
|
|
107
|
+
return trainerUrl;
|
|
108
|
+
}
|
|
104
109
|
else {
|
|
105
110
|
childProcess = await (0, open_1.default)(`${env_1.ELECTRON_PROTOCOL}://${url}/${params}`);
|
|
106
111
|
}
|
|
@@ -131,6 +136,7 @@ async function openUrlInDesktopApp(url, trainingSessionOptions, waitProcessToExi
|
|
|
131
136
|
logInstallDesktopApp();
|
|
132
137
|
}
|
|
133
138
|
}
|
|
139
|
+
return trainerUrl;
|
|
134
140
|
}
|
|
135
141
|
function logSessionStarted() {
|
|
136
142
|
messaging_1.mablEventEmitter.log(chalk_1.default.yellowBright('Session started in the desktop app'));
|
|
@@ -14,8 +14,8 @@ const util_2 = require("../../commands/commandUtil/util");
|
|
|
14
14
|
const loggingProvider_1 = require("../../providers/logging/loggingProvider");
|
|
15
15
|
const rbacUtils_1 = require("../../util/rbacUtils");
|
|
16
16
|
const chalk = require('chalk');
|
|
17
|
-
exports.DEFAULT_HEIGHT =
|
|
18
|
-
exports.DEFAULT_WIDTH =
|
|
17
|
+
exports.DEFAULT_HEIGHT = 1440;
|
|
18
|
+
exports.DEFAULT_WIDTH = 1080;
|
|
19
19
|
exports.SENDER = 'cli';
|
|
20
20
|
var ElectronProtocolUrl;
|
|
21
21
|
(function (ElectronProtocolUrl) {
|
|
@@ -75,7 +75,7 @@ async function trainNewTest(trainingSessionOptions, mablApiClient, waitProcessTo
|
|
|
75
75
|
sender: exports.SENDER,
|
|
76
76
|
width: width ?? exports.DEFAULT_WIDTH,
|
|
77
77
|
};
|
|
78
|
-
|
|
78
|
+
return (0, openUtils_1.openUrlInDesktopApp)(ElectronProtocolUrl.TRAIN_NEW_TEST, scriptConfig, waitProcessToExit);
|
|
79
79
|
}
|
|
80
80
|
async function getInitialFlows(apiClient, autoLogin, workspaceId) {
|
|
81
81
|
const initialFlows = [];
|