@uipath/rpa-tool 1.198.0 → 1.198.2
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/dist/index.js +1 -1
- package/dist/packager-tool.js +11 -8
- package/dist/tool.js +549 -163
- package/package.json +7 -7
package/dist/tool.js
CHANGED
|
@@ -3245,8 +3245,8 @@ async function refreshTokenFingerprint(refreshToken) {
|
|
|
3245
3245
|
const digest = await globalThis.crypto.subtle.digest("SHA-256", bytes);
|
|
3246
3246
|
return Array.from(new Uint8Array(digest), (b) => b.toString(16).padStart(2, "0")).join("").slice(0, 16);
|
|
3247
3247
|
}
|
|
3248
|
-
const { createHash } = await import("node:crypto");
|
|
3249
|
-
return
|
|
3248
|
+
const { createHash: createHash2 } = await import("node:crypto");
|
|
3249
|
+
return createHash2("sha256").update(refreshToken).digest("hex").slice(0, 16);
|
|
3250
3250
|
}
|
|
3251
3251
|
function breakerPathFor(authPath) {
|
|
3252
3252
|
return `${authPath}${BREAKER_SUFFIX}`;
|
|
@@ -3986,19 +3986,19 @@ var __create3, __getProtoOf3, __defProp3, __getOwnPropNames3, __hasOwnProp3, __t
|
|
|
3986
3986
|
}
|
|
3987
3987
|
const subprocess = childProcess32.spawn(command, cliArguments, childProcessOptions);
|
|
3988
3988
|
if (options.wait) {
|
|
3989
|
-
return new Promise((
|
|
3989
|
+
return new Promise((resolve4, reject) => {
|
|
3990
3990
|
subprocess.once("error", reject);
|
|
3991
3991
|
subprocess.once("close", (exitCode) => {
|
|
3992
3992
|
if (!options.allowNonzeroExitCode && exitCode !== 0) {
|
|
3993
3993
|
reject(new Error(`Exited with code ${exitCode}`));
|
|
3994
3994
|
return;
|
|
3995
3995
|
}
|
|
3996
|
-
|
|
3996
|
+
resolve4(subprocess);
|
|
3997
3997
|
});
|
|
3998
3998
|
});
|
|
3999
3999
|
}
|
|
4000
4000
|
if (isFallbackAttempt) {
|
|
4001
|
-
return new Promise((
|
|
4001
|
+
return new Promise((resolve4, reject) => {
|
|
4002
4002
|
subprocess.once("error", reject);
|
|
4003
4003
|
subprocess.once("spawn", () => {
|
|
4004
4004
|
subprocess.once("close", (exitCode) => {
|
|
@@ -4008,17 +4008,17 @@ var __create3, __getProtoOf3, __defProp3, __getOwnPropNames3, __hasOwnProp3, __t
|
|
|
4008
4008
|
return;
|
|
4009
4009
|
}
|
|
4010
4010
|
subprocess.unref();
|
|
4011
|
-
|
|
4011
|
+
resolve4(subprocess);
|
|
4012
4012
|
});
|
|
4013
4013
|
});
|
|
4014
4014
|
});
|
|
4015
4015
|
}
|
|
4016
4016
|
subprocess.unref();
|
|
4017
|
-
return new Promise((
|
|
4017
|
+
return new Promise((resolve4, reject) => {
|
|
4018
4018
|
subprocess.once("error", reject);
|
|
4019
4019
|
subprocess.once("spawn", () => {
|
|
4020
4020
|
subprocess.off("error", reject);
|
|
4021
|
-
|
|
4021
|
+
resolve4(subprocess);
|
|
4022
4022
|
});
|
|
4023
4023
|
});
|
|
4024
4024
|
}, open2 = (target, options) => {
|
|
@@ -36901,19 +36901,19 @@ var isDockerCached3, cachedResult3, hasContainerEnv3 = () => {
|
|
|
36901
36901
|
}
|
|
36902
36902
|
const subprocess = childProcess33.spawn(command, cliArguments, childProcessOptions);
|
|
36903
36903
|
if (options.wait) {
|
|
36904
|
-
return new Promise((
|
|
36904
|
+
return new Promise((resolve5, reject) => {
|
|
36905
36905
|
subprocess.once("error", reject);
|
|
36906
36906
|
subprocess.once("close", (exitCode) => {
|
|
36907
36907
|
if (!options.allowNonzeroExitCode && exitCode !== 0) {
|
|
36908
36908
|
reject(new Error(`Exited with code ${exitCode}`));
|
|
36909
36909
|
return;
|
|
36910
36910
|
}
|
|
36911
|
-
|
|
36911
|
+
resolve5(subprocess);
|
|
36912
36912
|
});
|
|
36913
36913
|
});
|
|
36914
36914
|
}
|
|
36915
36915
|
if (isFallbackAttempt) {
|
|
36916
|
-
return new Promise((
|
|
36916
|
+
return new Promise((resolve5, reject) => {
|
|
36917
36917
|
subprocess.once("error", reject);
|
|
36918
36918
|
subprocess.once("spawn", () => {
|
|
36919
36919
|
subprocess.once("close", (exitCode) => {
|
|
@@ -36923,17 +36923,17 @@ var isDockerCached3, cachedResult3, hasContainerEnv3 = () => {
|
|
|
36923
36923
|
return;
|
|
36924
36924
|
}
|
|
36925
36925
|
subprocess.unref();
|
|
36926
|
-
|
|
36926
|
+
resolve5(subprocess);
|
|
36927
36927
|
});
|
|
36928
36928
|
});
|
|
36929
36929
|
});
|
|
36930
36930
|
}
|
|
36931
36931
|
subprocess.unref();
|
|
36932
|
-
return new Promise((
|
|
36932
|
+
return new Promise((resolve5, reject) => {
|
|
36933
36933
|
subprocess.once("error", reject);
|
|
36934
36934
|
subprocess.once("spawn", () => {
|
|
36935
36935
|
subprocess.off("error", reject);
|
|
36936
|
-
|
|
36936
|
+
resolve5(subprocess);
|
|
36937
36937
|
});
|
|
36938
36938
|
});
|
|
36939
36939
|
}, open3 = (target, options) => {
|
|
@@ -49534,7 +49534,7 @@ function withTrailingSeparator(p) {
|
|
|
49534
49534
|
}
|
|
49535
49535
|
|
|
49536
49536
|
// src/tool.ts
|
|
49537
|
-
import { resolve as
|
|
49537
|
+
import { resolve as resolve12 } from "node:path";
|
|
49538
49538
|
|
|
49539
49539
|
// node_modules/@uipath/common/dist/index.js
|
|
49540
49540
|
import { createRequire as createRequire2 } from "node:module";
|
|
@@ -59091,7 +59091,7 @@ var {
|
|
|
59091
59091
|
// package.json
|
|
59092
59092
|
var package_default = {
|
|
59093
59093
|
name: "@uipath/rpa-tool",
|
|
59094
|
-
version: "1.198.
|
|
59094
|
+
version: "1.198.2",
|
|
59095
59095
|
description: "Tool for creating and managing UiPath RPA projects",
|
|
59096
59096
|
keywords: [
|
|
59097
59097
|
"uipcli-tool",
|
|
@@ -59234,7 +59234,7 @@ function attachWrapperOptions(cmd) {
|
|
|
59234
59234
|
|
|
59235
59235
|
// src/commander-polyfill.ts
|
|
59236
59236
|
if (!Command2.prototype.trackedAction) {
|
|
59237
|
-
Command2.prototype.trackedAction = function(context, fn) {
|
|
59237
|
+
Command2.prototype.trackedAction = function(context, fn, _properties) {
|
|
59238
59238
|
return this.action(async (...args) => {
|
|
59239
59239
|
try {
|
|
59240
59240
|
await fn(...args);
|
|
@@ -59252,6 +59252,17 @@ Message: ${message}
|
|
|
59252
59252
|
// src/discovery/StudioDiscoveryService.ts
|
|
59253
59253
|
import { closeSync, openSync, readdirSync, readSync } from "node:fs";
|
|
59254
59254
|
import { join as join2 } from "node:path";
|
|
59255
|
+
// src/process-liveness.ts
|
|
59256
|
+
function isProcessAlive(pid) {
|
|
59257
|
+
try {
|
|
59258
|
+
process.kill(pid, 0);
|
|
59259
|
+
return true;
|
|
59260
|
+
} catch (err) {
|
|
59261
|
+
return err.code === "EPERM";
|
|
59262
|
+
}
|
|
59263
|
+
}
|
|
59264
|
+
|
|
59265
|
+
// src/discovery/StudioDiscoveryService.ts
|
|
59255
59266
|
function getStatusFilePath(processId) {
|
|
59256
59267
|
return join2(safeTmpDir(), "UiPath", "Studio", `Studio_${processId}.status`);
|
|
59257
59268
|
}
|
|
@@ -59269,14 +59280,6 @@ function parseStatusFileNames(fileNames) {
|
|
|
59269
59280
|
}
|
|
59270
59281
|
return pids;
|
|
59271
59282
|
}
|
|
59272
|
-
function isProcessAlive(pid) {
|
|
59273
|
-
try {
|
|
59274
|
-
process.kill(pid, 0);
|
|
59275
|
-
return true;
|
|
59276
|
-
} catch {
|
|
59277
|
-
return false;
|
|
59278
|
-
}
|
|
59279
|
-
}
|
|
59280
59283
|
function readStatusFile(filePath) {
|
|
59281
59284
|
let fd;
|
|
59282
59285
|
try {
|
|
@@ -59367,18 +59370,231 @@ var registerListInstancesCommand = (program3) => {
|
|
|
59367
59370
|
};
|
|
59368
59371
|
|
|
59369
59372
|
// src/commands/packager/analyze.ts
|
|
59370
|
-
import { isAbsolute as isAbsolute5, join as
|
|
59373
|
+
import { isAbsolute as isAbsolute5, join as join11 } from "node:path";
|
|
59374
|
+
|
|
59375
|
+
// src/telemetry/project-shape.ts
|
|
59376
|
+
import { readdirSync as readdirSync2, readFileSync } from "node:fs";
|
|
59377
|
+
import { dirname as dirname2, join as join4 } from "node:path";
|
|
59378
|
+
|
|
59379
|
+
// src/telemetry/project-json-path.ts
|
|
59380
|
+
import { statSync } from "node:fs";
|
|
59381
|
+
import { basename as basename2, join as join3, resolve as resolve2 } from "node:path";
|
|
59382
|
+
function resolveProjectJsonPath(input) {
|
|
59383
|
+
const abs = resolve2(input);
|
|
59384
|
+
let stats;
|
|
59385
|
+
try {
|
|
59386
|
+
stats = statSync(abs);
|
|
59387
|
+
} catch {
|
|
59388
|
+
return;
|
|
59389
|
+
}
|
|
59390
|
+
if (stats.isDirectory()) {
|
|
59391
|
+
return join3(abs, "project.json");
|
|
59392
|
+
}
|
|
59393
|
+
return basename2(abs).toLowerCase() === "project.json" ? abs : undefined;
|
|
59394
|
+
}
|
|
59395
|
+
|
|
59396
|
+
// src/telemetry/project-shape.ts
|
|
59397
|
+
var MAX_FILES = 500;
|
|
59398
|
+
var MAX_WALK_MS = 50;
|
|
59399
|
+
var SKIP_DIRS = new Set(["obj", "bin", "node_modules"]);
|
|
59400
|
+
function countActivities(xamlPath) {
|
|
59401
|
+
try {
|
|
59402
|
+
const matches = readFileSync(xamlPath, "utf8").match(/WorkflowViewState\.IdRef=/g);
|
|
59403
|
+
return matches ? matches.length : 0;
|
|
59404
|
+
} catch {
|
|
59405
|
+
return 0;
|
|
59406
|
+
}
|
|
59407
|
+
}
|
|
59408
|
+
function isTestCaseEntry(entry) {
|
|
59409
|
+
if (typeof entry !== "object" || entry === null) {
|
|
59410
|
+
return false;
|
|
59411
|
+
}
|
|
59412
|
+
const record = entry;
|
|
59413
|
+
if (record.isTestCase === true) {
|
|
59414
|
+
return true;
|
|
59415
|
+
}
|
|
59416
|
+
if (typeof record.testCaseId === "string" && record.testCaseId.length > 0) {
|
|
59417
|
+
return true;
|
|
59418
|
+
}
|
|
59419
|
+
for (const key of ["testCaseType", "editorType", "fileType", "type"]) {
|
|
59420
|
+
const value = record[key];
|
|
59421
|
+
if (typeof value === "string" && /test/i.test(value)) {
|
|
59422
|
+
return true;
|
|
59423
|
+
}
|
|
59424
|
+
}
|
|
59425
|
+
return false;
|
|
59426
|
+
}
|
|
59427
|
+
function readManifestCounts(jsonPath) {
|
|
59428
|
+
const counts = {};
|
|
59429
|
+
let project;
|
|
59430
|
+
try {
|
|
59431
|
+
project = JSON.parse(readFileSync(jsonPath, "utf8"));
|
|
59432
|
+
} catch {
|
|
59433
|
+
return counts;
|
|
59434
|
+
}
|
|
59435
|
+
if (project.dependencies && typeof project.dependencies === "object") {
|
|
59436
|
+
counts.dependencyCount = String(Object.keys(project.dependencies).length);
|
|
59437
|
+
}
|
|
59438
|
+
if (Array.isArray(project.entryPoints)) {
|
|
59439
|
+
counts.entryPointCount = String(project.entryPoints.length);
|
|
59440
|
+
}
|
|
59441
|
+
const fileInfo = project.designOptions?.fileInfoCollection;
|
|
59442
|
+
if (Array.isArray(fileInfo)) {
|
|
59443
|
+
counts.testCaseCount = String(fileInfo.filter(isTestCaseEntry).length);
|
|
59444
|
+
}
|
|
59445
|
+
return counts;
|
|
59446
|
+
}
|
|
59447
|
+
function getProjectShapeProps(projectDirInput) {
|
|
59448
|
+
if (!projectDirInput) {
|
|
59449
|
+
return {};
|
|
59450
|
+
}
|
|
59451
|
+
const jsonPath = resolveProjectJsonPath(projectDirInput);
|
|
59452
|
+
if (!jsonPath) {
|
|
59453
|
+
return {};
|
|
59454
|
+
}
|
|
59455
|
+
const projectDir = dirname2(jsonPath);
|
|
59456
|
+
const shape = readManifestCounts(jsonPath);
|
|
59457
|
+
let fileCount = 0;
|
|
59458
|
+
let workflowCount = 0;
|
|
59459
|
+
let codedWorkflowCount = 0;
|
|
59460
|
+
let activityCount = 0;
|
|
59461
|
+
let truncated = false;
|
|
59462
|
+
const start = performance.now();
|
|
59463
|
+
const stack = [projectDir];
|
|
59464
|
+
while (stack.length > 0 && !truncated) {
|
|
59465
|
+
const dir = stack.pop();
|
|
59466
|
+
if (dir === undefined) {
|
|
59467
|
+
break;
|
|
59468
|
+
}
|
|
59469
|
+
let entries;
|
|
59470
|
+
try {
|
|
59471
|
+
entries = readdirSync2(dir, { withFileTypes: true });
|
|
59472
|
+
} catch {
|
|
59473
|
+
continue;
|
|
59474
|
+
}
|
|
59475
|
+
for (const entry of entries) {
|
|
59476
|
+
if (fileCount >= MAX_FILES || performance.now() - start > MAX_WALK_MS) {
|
|
59477
|
+
truncated = true;
|
|
59478
|
+
break;
|
|
59479
|
+
}
|
|
59480
|
+
if (entry.isDirectory()) {
|
|
59481
|
+
if (!entry.name.startsWith(".") && !SKIP_DIRS.has(entry.name)) {
|
|
59482
|
+
stack.push(join4(dir, entry.name));
|
|
59483
|
+
}
|
|
59484
|
+
continue;
|
|
59485
|
+
}
|
|
59486
|
+
if (!entry.isFile()) {
|
|
59487
|
+
continue;
|
|
59488
|
+
}
|
|
59489
|
+
fileCount++;
|
|
59490
|
+
const lower2 = entry.name.toLowerCase();
|
|
59491
|
+
if (lower2.endsWith(".xaml")) {
|
|
59492
|
+
workflowCount++;
|
|
59493
|
+
activityCount += countActivities(join4(dir, entry.name));
|
|
59494
|
+
} else if (lower2.endsWith(".cs")) {
|
|
59495
|
+
codedWorkflowCount++;
|
|
59496
|
+
}
|
|
59497
|
+
}
|
|
59498
|
+
}
|
|
59499
|
+
shape.fileCount = String(fileCount);
|
|
59500
|
+
shape.workflowCount = String(workflowCount);
|
|
59501
|
+
shape.codedWorkflowCount = String(codedWorkflowCount);
|
|
59502
|
+
shape.activityCount = String(activityCount);
|
|
59503
|
+
if (truncated) {
|
|
59504
|
+
shape.shapeTruncated = "true";
|
|
59505
|
+
}
|
|
59506
|
+
return shape;
|
|
59507
|
+
}
|
|
59508
|
+
|
|
59509
|
+
// src/telemetry/studio-shaped-props.ts
|
|
59510
|
+
import { readFileSync as readFileSync2 } from "node:fs";
|
|
59511
|
+
|
|
59512
|
+
// src/telemetry/authoring-session.ts
|
|
59513
|
+
import { hostname } from "node:os";
|
|
59514
|
+
|
|
59515
|
+
// src/telemetry/identity-hash.ts
|
|
59516
|
+
import { createHash } from "node:crypto";
|
|
59517
|
+
function identityHash(value) {
|
|
59518
|
+
return createHash("sha256").update(value.trim().toLowerCase()).digest("hex").slice(0, 16);
|
|
59519
|
+
}
|
|
59520
|
+
|
|
59521
|
+
// src/telemetry/authoring-session.ts
|
|
59522
|
+
var SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
59523
|
+
function getAuthoringSessionProps() {
|
|
59524
|
+
const explicit = process.env[SESSION_ID_ENV];
|
|
59525
|
+
if (explicit && explicit.trim().length > 0) {
|
|
59526
|
+
return {
|
|
59527
|
+
authoringSessionId: identityHash(explicit),
|
|
59528
|
+
authoringSessionSource: "explicit"
|
|
59529
|
+
};
|
|
59530
|
+
}
|
|
59531
|
+
try {
|
|
59532
|
+
return {
|
|
59533
|
+
authoringSessionId: identityHash(`${process.ppid}:${hostname()}`),
|
|
59534
|
+
authoringSessionSource: "ppid"
|
|
59535
|
+
};
|
|
59536
|
+
} catch {
|
|
59537
|
+
return {};
|
|
59538
|
+
}
|
|
59539
|
+
}
|
|
59540
|
+
|
|
59541
|
+
// src/telemetry/studio-shaped-props.ts
|
|
59542
|
+
var TELEMETRY_SOURCE = "rpa-tool";
|
|
59543
|
+
function asNonEmptyString(value) {
|
|
59544
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
59545
|
+
}
|
|
59546
|
+
function readProjectFields(input) {
|
|
59547
|
+
const path3 = resolveProjectJsonPath(input);
|
|
59548
|
+
if (!path3) {
|
|
59549
|
+
return {};
|
|
59550
|
+
}
|
|
59551
|
+
let project;
|
|
59552
|
+
try {
|
|
59553
|
+
project = JSON.parse(readFileSync2(path3, "utf8"));
|
|
59554
|
+
} catch {
|
|
59555
|
+
return {};
|
|
59556
|
+
}
|
|
59557
|
+
const fields = {};
|
|
59558
|
+
const set = (key, value) => {
|
|
59559
|
+
const str = asNonEmptyString(value);
|
|
59560
|
+
if (str) {
|
|
59561
|
+
fields[key] = str;
|
|
59562
|
+
}
|
|
59563
|
+
};
|
|
59564
|
+
const projectId = asNonEmptyString(project.projectId);
|
|
59565
|
+
if (projectId) {
|
|
59566
|
+
fields.projectIdHash = identityHash(projectId);
|
|
59567
|
+
const noDash = projectId.trim().toLowerCase().replaceAll("-", "");
|
|
59568
|
+
if (/^[0-9a-f]{32}$/.test(noDash)) {
|
|
59569
|
+
fields.projectIdNoDash = noDash;
|
|
59570
|
+
}
|
|
59571
|
+
}
|
|
59572
|
+
set("targetFramework", project.targetFramework);
|
|
59573
|
+
set("expressionLanguage", project.expressionLanguage);
|
|
59574
|
+
set("projectType", project.designOptions?.outputType);
|
|
59575
|
+
set("projectVersion", project.projectVersion);
|
|
59576
|
+
return fields;
|
|
59577
|
+
}
|
|
59578
|
+
function buildStudioShapedProps(projectDir, extra) {
|
|
59579
|
+
const fields = projectDir ? readProjectFields(projectDir) : {};
|
|
59580
|
+
return {
|
|
59581
|
+
source: TELEMETRY_SOURCE,
|
|
59582
|
+
...getAuthoringSessionProps(),
|
|
59583
|
+
...fields,
|
|
59584
|
+
...extra
|
|
59585
|
+
};
|
|
59586
|
+
}
|
|
59371
59587
|
|
|
59372
59588
|
// src/commands/packager/packager-shared.ts
|
|
59373
59589
|
import {
|
|
59374
59590
|
mkdtempSync as mkdtempSync2,
|
|
59375
|
-
readFileSync as
|
|
59591
|
+
readFileSync as readFileSync4,
|
|
59376
59592
|
rmSync as rmSync2,
|
|
59377
|
-
statSync,
|
|
59593
|
+
statSync as statSync2,
|
|
59378
59594
|
writeFileSync as writeFileSync2
|
|
59379
59595
|
} from "node:fs";
|
|
59380
59596
|
import { tmpdir as tmpdir7 } from "node:os";
|
|
59381
|
-
import { basename as
|
|
59597
|
+
import { basename as basename6, dirname as dirname6, join as join10, resolve as resolve6 } from "node:path";
|
|
59382
59598
|
|
|
59383
59599
|
// src/load-packager-tool.ts
|
|
59384
59600
|
async function loadPackagerTool() {
|
|
@@ -59398,7 +59614,7 @@ async function loadPackagerTool() {
|
|
|
59398
59614
|
// src/resolution/orchestrator-restore-feeds.ts
|
|
59399
59615
|
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
59400
59616
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
59401
|
-
import { join as
|
|
59617
|
+
import { join as join6 } from "node:path";
|
|
59402
59618
|
var ORCHESTRATOR_RESTORE_FEEDS_ENV = "UIPATH_ORCHESTRATOR_RESTORE_FEEDS";
|
|
59403
59619
|
var FEEDS_TIMEOUT_MS = 1e4;
|
|
59404
59620
|
var LIBRARIES_PURPOSE = "Libraries";
|
|
@@ -59449,8 +59665,8 @@ async function fetchLibraryFeeds(orchestratorUrl, accessToken, tenantId, log) {
|
|
|
59449
59665
|
return feeds.filter((f) => f.purpose === LIBRARIES_PURPOSE && !!f.feedUrl).map((f) => ({ Url: f.feedUrl, AccessToken: accessToken }));
|
|
59450
59666
|
}
|
|
59451
59667
|
function writeFeedsFile(feeds) {
|
|
59452
|
-
const dir = mkdtempSync(
|
|
59453
|
-
const path4 =
|
|
59668
|
+
const dir = mkdtempSync(join6(tmpdir4(), "uip-rpa-feeds-"));
|
|
59669
|
+
const path4 = join6(dir, "nuget-feeds.json");
|
|
59454
59670
|
writeFileSync(path4, JSON.stringify(feeds));
|
|
59455
59671
|
process.on("exit", () => {
|
|
59456
59672
|
try {
|
|
@@ -59461,11 +59677,11 @@ function writeFeedsFile(feeds) {
|
|
|
59461
59677
|
}
|
|
59462
59678
|
|
|
59463
59679
|
// src/resolution/robot-bin-resolver.ts
|
|
59464
|
-
import { join as
|
|
59680
|
+
import { join as join7, posix, win32 } from "node:path";
|
|
59465
59681
|
|
|
59466
59682
|
// src/resolution/resolver-deps.ts
|
|
59467
59683
|
import { execFileSync as execFileSync5, spawn } from "node:child_process";
|
|
59468
|
-
import { existsSync as existsSync3, readdirSync as
|
|
59684
|
+
import { existsSync as existsSync3, readdirSync as readdirSync3, readFileSync as readFileSync3 } from "node:fs";
|
|
59469
59685
|
import { createRequire as createRequire4 } from "node:module";
|
|
59470
59686
|
|
|
59471
59687
|
// src/ipc/IpcCall.ts
|
|
@@ -60084,7 +60300,7 @@ class IpcCall {
|
|
|
60084
60300
|
const call = operation(this.proxy, this.ict);
|
|
60085
60301
|
if (this.timeoutMs == null)
|
|
60086
60302
|
return call;
|
|
60087
|
-
return new Promise((
|
|
60303
|
+
return new Promise((resolve4, reject) => {
|
|
60088
60304
|
let settled = false;
|
|
60089
60305
|
const timer = setTimeout(() => {
|
|
60090
60306
|
if (settled)
|
|
@@ -60097,7 +60313,7 @@ class IpcCall {
|
|
|
60097
60313
|
if (!settled) {
|
|
60098
60314
|
settled = true;
|
|
60099
60315
|
clearTimeout(timer);
|
|
60100
|
-
|
|
60316
|
+
resolve4(val);
|
|
60101
60317
|
}
|
|
60102
60318
|
}, (err) => {
|
|
60103
60319
|
if (!settled) {
|
|
@@ -60342,6 +60558,7 @@ var defaultResolverDeps = {
|
|
|
60342
60558
|
activeToolName: status.ActiveToolName ?? null
|
|
60343
60559
|
};
|
|
60344
60560
|
},
|
|
60561
|
+
isProcessAlive,
|
|
60345
60562
|
discoverInstances,
|
|
60346
60563
|
executeCommand(command, args) {
|
|
60347
60564
|
return execFileSync5(command, args, {
|
|
@@ -60353,10 +60570,10 @@ var defaultResolverDeps = {
|
|
|
60353
60570
|
return existsSync3(path4);
|
|
60354
60571
|
},
|
|
60355
60572
|
readFile(path4) {
|
|
60356
|
-
return
|
|
60573
|
+
return readFileSync3(path4, "utf-8");
|
|
60357
60574
|
},
|
|
60358
60575
|
readDir(path4) {
|
|
60359
|
-
return
|
|
60576
|
+
return readdirSync3(path4);
|
|
60360
60577
|
},
|
|
60361
60578
|
resolveModule(specifier) {
|
|
60362
60579
|
return createRequire4(import.meta.url).resolve(specifier);
|
|
@@ -60378,7 +60595,7 @@ var defaultResolverDeps = {
|
|
|
60378
60595
|
child.unref();
|
|
60379
60596
|
},
|
|
60380
60597
|
sleep(ms) {
|
|
60381
|
-
return new Promise((
|
|
60598
|
+
return new Promise((resolve4) => setTimeout(resolve4, ms));
|
|
60382
60599
|
},
|
|
60383
60600
|
log(_message) {},
|
|
60384
60601
|
fetchFeatures(pipeName) {
|
|
@@ -60405,7 +60622,7 @@ var HELM_EXE = process.platform === "win32" ? "UiPath.Studio.Helm.exe" : "UiPath
|
|
|
60405
60622
|
// src/resolution/robot-bin-resolver.ts
|
|
60406
60623
|
var LOCAL_ROBOT_FEEDS_ENV = "UIPATH_LOCAL_ROBOT_FEEDS";
|
|
60407
60624
|
function robotNugetConfigPath(robotDir) {
|
|
60408
|
-
return
|
|
60625
|
+
return join7(robotDir, "NuGet.config");
|
|
60409
60626
|
}
|
|
60410
60627
|
var ROBOT_WINDOWS_MARKER = "UiRobot.exe";
|
|
60411
60628
|
var ROBOT_MACOS_MARKER = "UiRobot.dll";
|
|
@@ -60473,7 +60690,7 @@ var MIN_BUNDLED_DOTNET_MAJOR = 8;
|
|
|
60473
60690
|
function detectDotnetRuntimeMajor(dotnetRoot, deps) {
|
|
60474
60691
|
let entries;
|
|
60475
60692
|
try {
|
|
60476
|
-
entries = deps.readDir(
|
|
60693
|
+
entries = deps.readDir(join7(dotnetRoot, "shared", "Microsoft.NETCore.App"));
|
|
60477
60694
|
} catch {
|
|
60478
60695
|
return;
|
|
60479
60696
|
}
|
|
@@ -60492,10 +60709,10 @@ function detectDotnetRuntimeMajor(dotnetRoot, deps) {
|
|
|
60492
60709
|
function resolveBundledDotnet(robotDir, deps) {
|
|
60493
60710
|
if (!robotDir)
|
|
60494
60711
|
return;
|
|
60495
|
-
const exePath = process.platform === "win32" ?
|
|
60712
|
+
const exePath = process.platform === "win32" ? join7(robotDir, "dotnet.exe") : join7(robotDir, "dotnet", "dotnet");
|
|
60496
60713
|
if (!deps.fileExists(exePath))
|
|
60497
60714
|
return;
|
|
60498
|
-
const dotnetRoot = process.platform === "win32" ? robotDir :
|
|
60715
|
+
const dotnetRoot = process.platform === "win32" ? robotDir : join7(robotDir, "dotnet");
|
|
60499
60716
|
const runtimeMajor = detectDotnetRuntimeMajor(dotnetRoot, deps);
|
|
60500
60717
|
if (runtimeMajor === undefined || runtimeMajor < MIN_BUNDLED_DOTNET_MAJOR) {
|
|
60501
60718
|
const reason = runtimeMajor === undefined ? "could not determine its .NET runtime version" : `highest .NET runtime major ${runtimeMajor} is below the required ${MIN_BUNDLED_DOTNET_MAJOR}`;
|
|
@@ -60566,6 +60783,55 @@ async function resolveSessionConnection() {
|
|
|
60566
60783
|
}
|
|
60567
60784
|
}
|
|
60568
60785
|
|
|
60786
|
+
// src/telemetry/failure-classification.ts
|
|
60787
|
+
var NUGET_MISSING = /\bNU110[12]\b/;
|
|
60788
|
+
var COMPILER_DIAGNOSTIC = /\b(?:CS|BC)[0-9]{3,5}\b/;
|
|
60789
|
+
function classifyFailure(signal) {
|
|
60790
|
+
if (signal.exitCode === 130) {
|
|
60791
|
+
return "user_cancelled";
|
|
60792
|
+
}
|
|
60793
|
+
if (signal.isFileLock || signal.errorCode === "permission_denied") {
|
|
60794
|
+
return "internal";
|
|
60795
|
+
}
|
|
60796
|
+
const codes = `${signal.errorCode ?? ""} ${signal.message ?? ""}`;
|
|
60797
|
+
if (NUGET_MISSING.test(codes)) {
|
|
60798
|
+
return "missing_dependency";
|
|
60799
|
+
}
|
|
60800
|
+
if (COMPILER_DIAGNOSTIC.test(codes)) {
|
|
60801
|
+
return "validation";
|
|
60802
|
+
}
|
|
60803
|
+
return "unknown";
|
|
60804
|
+
}
|
|
60805
|
+
function extractRunExceptionType(rawResult) {
|
|
60806
|
+
let parsed;
|
|
60807
|
+
try {
|
|
60808
|
+
parsed = JSON.parse(rawResult);
|
|
60809
|
+
} catch {
|
|
60810
|
+
return;
|
|
60811
|
+
}
|
|
60812
|
+
if (typeof parsed !== "object" || parsed === null) {
|
|
60813
|
+
return;
|
|
60814
|
+
}
|
|
60815
|
+
const record = parsed;
|
|
60816
|
+
const direct = asTypeName(record.ExceptionType ?? record.exceptionType);
|
|
60817
|
+
if (direct) {
|
|
60818
|
+
return direct;
|
|
60819
|
+
}
|
|
60820
|
+
const debugDetails = record.DebugDetails ?? record.debugDetails;
|
|
60821
|
+
if (typeof debugDetails === "string") {
|
|
60822
|
+
try {
|
|
60823
|
+
const details = JSON.parse(debugDetails);
|
|
60824
|
+
return asTypeName(details.ExceptionType ?? details.exceptionType);
|
|
60825
|
+
} catch {
|
|
60826
|
+
return;
|
|
60827
|
+
}
|
|
60828
|
+
}
|
|
60829
|
+
return;
|
|
60830
|
+
}
|
|
60831
|
+
function asTypeName(value) {
|
|
60832
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
60833
|
+
}
|
|
60834
|
+
|
|
60569
60835
|
// src/commands/packager/packager-shared.ts
|
|
60570
60836
|
var LOG_LEVEL_NAMES = ["Debug", "Info", "Warn", "Error"];
|
|
60571
60837
|
var GOVERNANCE_FILE_TYPES = ["Default", "AutomationOps", "Studio"];
|
|
@@ -60605,22 +60871,22 @@ async function buildBaseOptions(opts) {
|
|
|
60605
60871
|
return options;
|
|
60606
60872
|
}
|
|
60607
60873
|
function resolveProjectInput(projectDir) {
|
|
60608
|
-
const abs =
|
|
60874
|
+
const abs = resolve6(projectDir);
|
|
60609
60875
|
let stats;
|
|
60610
60876
|
try {
|
|
60611
|
-
stats =
|
|
60877
|
+
stats = statSync2(abs);
|
|
60612
60878
|
} catch {
|
|
60613
60879
|
return abs;
|
|
60614
60880
|
}
|
|
60615
60881
|
if (!stats.isFile()) {
|
|
60616
60882
|
return abs;
|
|
60617
60883
|
}
|
|
60618
|
-
const fileName =
|
|
60884
|
+
const fileName = basename6(abs).toLowerCase();
|
|
60619
60885
|
if (fileName === "project.json") {
|
|
60620
|
-
return
|
|
60886
|
+
return dirname6(abs);
|
|
60621
60887
|
}
|
|
60622
60888
|
if (fileName.endsWith(".uip")) {
|
|
60623
|
-
return new Uint8Array(
|
|
60889
|
+
return new Uint8Array(readFileSync4(abs));
|
|
60624
60890
|
}
|
|
60625
60891
|
throw new Error(`Unsupported project input: ${abs}. Provide a project directory, project.json file, or .uip archive.`);
|
|
60626
60892
|
}
|
|
@@ -60628,8 +60894,8 @@ function createTemporaryFeedsConfig(feeds) {
|
|
|
60628
60894
|
if (feeds.length === 0) {
|
|
60629
60895
|
return;
|
|
60630
60896
|
}
|
|
60631
|
-
const directory = mkdtempSync2(
|
|
60632
|
-
const path4 =
|
|
60897
|
+
const directory = mkdtempSync2(join10(tmpdir7(), "rpa-tool-nuget-"));
|
|
60898
|
+
const path4 = join10(directory, "nuget-feeds.json");
|
|
60633
60899
|
try {
|
|
60634
60900
|
writeFileSync2(path4, JSON.stringify(feeds));
|
|
60635
60901
|
} catch (error) {
|
|
@@ -60650,7 +60916,7 @@ function cleanupTemporaryFeedsConfig(config) {
|
|
|
60650
60916
|
function readFeedSourcesFromFile(path4) {
|
|
60651
60917
|
let raw;
|
|
60652
60918
|
try {
|
|
60653
|
-
raw =
|
|
60919
|
+
raw = readFileSync4(path4, "utf8");
|
|
60654
60920
|
} catch {
|
|
60655
60921
|
return null;
|
|
60656
60922
|
}
|
|
@@ -60713,7 +60979,7 @@ async function runPackagerCommand(opts, config) {
|
|
|
60713
60979
|
OutputFormatter.error(new FailureOutput("Failure", `${config.label} failed: project directory must not be empty.`, config.hint));
|
|
60714
60980
|
return false;
|
|
60715
60981
|
}
|
|
60716
|
-
const projectDir =
|
|
60982
|
+
const projectDir = resolve6(rawProjectDir);
|
|
60717
60983
|
opts = { ...opts, projectDir };
|
|
60718
60984
|
const LOGGER_LEVELS = {
|
|
60719
60985
|
Debug: LogLevel.DEBUG,
|
|
@@ -60750,11 +61016,24 @@ async function runPackagerCommand(opts, config) {
|
|
|
60750
61016
|
return true;
|
|
60751
61017
|
}
|
|
60752
61018
|
const rawFailure = result.message ?? (result.errorCode ? `Error code: ${result.errorCode}` : "Unknown error");
|
|
60753
|
-
|
|
61019
|
+
const lockFailure = detectLockedProjectFilesFailure(config.label, rawFailure);
|
|
61020
|
+
const failure = lockFailure ?? new FailureOutput("Failure", `${config.label} failed: ${rawFailure}`, config.hint);
|
|
61021
|
+
failure.TelemetryErrorClass = classifyFailure({
|
|
61022
|
+
errorCode: result.errorCode,
|
|
61023
|
+
message: rawFailure,
|
|
61024
|
+
isFileLock: lockFailure !== null
|
|
61025
|
+
});
|
|
61026
|
+
OutputFormatter.error(failure);
|
|
60754
61027
|
return false;
|
|
60755
61028
|
} catch (error) {
|
|
60756
61029
|
const rawFailure = error instanceof Error ? error.message : String(error);
|
|
60757
|
-
|
|
61030
|
+
const lockFailure = detectLockedProjectFilesFailure(config.label, rawFailure);
|
|
61031
|
+
const failure = lockFailure ?? new FailureOutput("Failure", `${config.label} failed: ${rawFailure}`, config.hint);
|
|
61032
|
+
failure.TelemetryErrorClass = classifyFailure({
|
|
61033
|
+
message: rawFailure,
|
|
61034
|
+
isFileLock: lockFailure !== null
|
|
61035
|
+
});
|
|
61036
|
+
OutputFormatter.error(failure);
|
|
60758
61037
|
return false;
|
|
60759
61038
|
} finally {
|
|
60760
61039
|
cleanupTemporaryFeedsConfig(temporaryFeedsConfig);
|
|
@@ -60793,22 +61072,30 @@ function registerAnalyzeCommand(program4) {
|
|
|
60793
61072
|
isSuccessfulResult: (result) => result.isSuccess || extractFindings(result).length > 0,
|
|
60794
61073
|
formatSuccess: (result) => {
|
|
60795
61074
|
const findings = extractFindings(result);
|
|
61075
|
+
const summary = summarizeFindings(findings);
|
|
61076
|
+
emitAnalyzeResult(opts.projectDir, findings, summary);
|
|
60796
61077
|
return {
|
|
60797
61078
|
Success: true,
|
|
60798
|
-
Summary:
|
|
61079
|
+
Summary: summary,
|
|
60799
61080
|
Findings: findings
|
|
60800
61081
|
};
|
|
60801
61082
|
}
|
|
60802
61083
|
});
|
|
60803
61084
|
if (!success)
|
|
60804
61085
|
processContext.exit(1);
|
|
61086
|
+
}, (projectDir, opts) => {
|
|
61087
|
+
const dir = resolveProjectDir(projectDir, opts);
|
|
61088
|
+
return buildStudioShapedProps(dir, {
|
|
61089
|
+
action: "analyze",
|
|
61090
|
+
...getProjectShapeProps(dir)
|
|
61091
|
+
});
|
|
60805
61092
|
});
|
|
60806
61093
|
}
|
|
60807
61094
|
function resolveProjectDir(projectDir, opts) {
|
|
60808
61095
|
if (!opts.repositoryPath || isAbsolute5(projectDir)) {
|
|
60809
61096
|
return projectDir;
|
|
60810
61097
|
}
|
|
60811
|
-
return
|
|
61098
|
+
return join11(opts.repositoryPath, projectDir);
|
|
60812
61099
|
}
|
|
60813
61100
|
function resolveGovernanceFileType(opts) {
|
|
60814
61101
|
if (opts.policyFileType)
|
|
@@ -60902,6 +61189,29 @@ function summarizeFindings(findings) {
|
|
|
60902
61189
|
}
|
|
60903
61190
|
return summary;
|
|
60904
61191
|
}
|
|
61192
|
+
function emitAnalyzeResult(projectDir, findings, summary) {
|
|
61193
|
+
try {
|
|
61194
|
+
const topRuleIds = distinctRuleIds(findings).slice(0, 10).join(",");
|
|
61195
|
+
telemetry.trackEvent("uip.rpa.analyze.result", redactProperties({
|
|
61196
|
+
...buildStudioShapedProps(projectDir, { action: "analyze" }),
|
|
61197
|
+
findingCount: String(findings.length),
|
|
61198
|
+
errorCount: String(summary.Critical + summary.Error),
|
|
61199
|
+
warningCount: String(summary.Warning),
|
|
61200
|
+
infoCount: String(summary.Information + summary.Verbose),
|
|
61201
|
+
...topRuleIds ? { topRuleIds } : {}
|
|
61202
|
+
}));
|
|
61203
|
+
} catch {}
|
|
61204
|
+
}
|
|
61205
|
+
function distinctRuleIds(findings) {
|
|
61206
|
+
const ids = new Set;
|
|
61207
|
+
for (const finding of findings) {
|
|
61208
|
+
const id = finding.ErrorCode || finding.RuleName;
|
|
61209
|
+
if (id) {
|
|
61210
|
+
ids.add(id);
|
|
61211
|
+
}
|
|
61212
|
+
}
|
|
61213
|
+
return [...ids];
|
|
61214
|
+
}
|
|
60905
61215
|
function normalizeLevel(value) {
|
|
60906
61216
|
switch (value.toLowerCase()) {
|
|
60907
61217
|
case "critical":
|
|
@@ -60960,11 +61270,14 @@ function registerBuildCommand(program4) {
|
|
|
60960
61270
|
});
|
|
60961
61271
|
if (!success)
|
|
60962
61272
|
processContext.exit(1);
|
|
60963
|
-
})
|
|
61273
|
+
}, (projectDir) => buildStudioShapedProps(projectDir, {
|
|
61274
|
+
action: "build",
|
|
61275
|
+
...getProjectShapeProps(projectDir)
|
|
61276
|
+
}));
|
|
60964
61277
|
}
|
|
60965
61278
|
|
|
60966
61279
|
// src/commands/packager/pack.ts
|
|
60967
|
-
import { isAbsolute as isAbsolute6, resolve as
|
|
61280
|
+
import { isAbsolute as isAbsolute6, resolve as resolve7 } from "node:path";
|
|
60968
61281
|
function registerPackCommand(program4) {
|
|
60969
61282
|
const cmd = program4.command("pack").description("Pack a UiPath project into a .nupkg (compiles, validates, and bundles).");
|
|
60970
61283
|
cmd.argument("<project-dir>", "Path to the UiPath project directory, project.json file, or .uip archive").argument("<output-path>", "Directory where .nupkg is written");
|
|
@@ -61025,6 +61338,7 @@ function registerPackCommand(program4) {
|
|
|
61025
61338
|
const firstPackage = packages[0] ?? "";
|
|
61026
61339
|
const packagePath = firstPackage ? absolutePath(firstPackage) : "";
|
|
61027
61340
|
const packageMetadata = inferPackageMetadata(packagePath, opts.packageVersion);
|
|
61341
|
+
emitPackResult(opts.projectDir, packageMetadata);
|
|
61028
61342
|
return {
|
|
61029
61343
|
Success: true,
|
|
61030
61344
|
Packages: packages,
|
|
@@ -61038,10 +61352,22 @@ function registerPackCommand(program4) {
|
|
|
61038
61352
|
});
|
|
61039
61353
|
if (!success)
|
|
61040
61354
|
processContext.exit(1);
|
|
61041
|
-
})
|
|
61355
|
+
}, (projectDir) => buildStudioShapedProps(projectDir, {
|
|
61356
|
+
action: "pack",
|
|
61357
|
+
...getProjectShapeProps(projectDir)
|
|
61358
|
+
}));
|
|
61042
61359
|
}
|
|
61043
61360
|
function absolutePath(filePath) {
|
|
61044
|
-
return isAbsolute6(filePath) ? filePath :
|
|
61361
|
+
return isAbsolute6(filePath) ? filePath : resolve7(filePath);
|
|
61362
|
+
}
|
|
61363
|
+
function emitPackResult(projectDir, meta) {
|
|
61364
|
+
try {
|
|
61365
|
+
telemetry.trackEvent("uip.rpa.pack.result", redactProperties({
|
|
61366
|
+
...buildStudioShapedProps(projectDir, { action: "pack" }),
|
|
61367
|
+
...meta.packageName ? { packageIdHash: identityHash(meta.packageName) } : {},
|
|
61368
|
+
...meta.packageVersion ? { packageVersion: meta.packageVersion } : {}
|
|
61369
|
+
}));
|
|
61370
|
+
} catch {}
|
|
61045
61371
|
}
|
|
61046
61372
|
function inferPackageMetadata(packagePath, explicitVersion) {
|
|
61047
61373
|
const packageVersion = explicitVersion || inferPackageVersion(packagePath);
|
|
@@ -61071,10 +61397,10 @@ function packageFileStem(packagePath) {
|
|
|
61071
61397
|
// src/commands/packager/restore.ts
|
|
61072
61398
|
import { mkdtempSync as mkdtempSync3 } from "node:fs";
|
|
61073
61399
|
import { tmpdir as tmpdir8 } from "node:os";
|
|
61074
|
-
import { isAbsolute as isAbsolute7, join as
|
|
61400
|
+
import { isAbsolute as isAbsolute7, join as join12, relative as relative5, resolve as resolve8 } from "node:path";
|
|
61075
61401
|
function isWithinOrEqual(parent, candidate) {
|
|
61076
61402
|
const norm = process.platform === "win32" ? (p) => p.toLowerCase() : (p) => p;
|
|
61077
|
-
const rel = relative5(norm(
|
|
61403
|
+
const rel = relative5(norm(resolve8(parent)), norm(resolve8(candidate)));
|
|
61078
61404
|
if (rel === "")
|
|
61079
61405
|
return true;
|
|
61080
61406
|
return !rel.startsWith("..") && !isAbsolute7(rel);
|
|
@@ -61093,7 +61419,7 @@ function registerRestoreCommand(program4) {
|
|
|
61093
61419
|
label: "Restore",
|
|
61094
61420
|
hint: "Check project path and NuGet configuration.",
|
|
61095
61421
|
execute: async (packager, options) => {
|
|
61096
|
-
options.outputPath = outputPath ?? mkdtempSync3(
|
|
61422
|
+
options.outputPath = outputPath ?? mkdtempSync3(join12(tmpdir8(), "rpa-tool-restore-"));
|
|
61097
61423
|
return packager.restoreProjectAsync(options);
|
|
61098
61424
|
}
|
|
61099
61425
|
});
|
|
@@ -61112,7 +61438,7 @@ function kebabToCamel(name) {
|
|
|
61112
61438
|
}
|
|
61113
61439
|
|
|
61114
61440
|
// src/cli/structured-input.ts
|
|
61115
|
-
import { readFileSync as
|
|
61441
|
+
import { readFileSync as readFileSync5 } from "node:fs";
|
|
61116
61442
|
|
|
61117
61443
|
class StructuredInputError extends Error {
|
|
61118
61444
|
constructor(message) {
|
|
@@ -61125,7 +61451,7 @@ var defaultStructuredValueReader = {
|
|
|
61125
61451
|
readText(path4) {
|
|
61126
61452
|
let bytes;
|
|
61127
61453
|
try {
|
|
61128
|
-
bytes =
|
|
61454
|
+
bytes = readFileSync5(path4);
|
|
61129
61455
|
} catch (cause) {
|
|
61130
61456
|
throw new StructuredInputError(`Cannot read file '${path4}': ${cause instanceof Error ? cause.message : String(cause)}. ` + `File paths resolve relative to the current directory.`);
|
|
61131
61457
|
}
|
|
@@ -61950,7 +62276,53 @@ var CLI_DERIVED_COMMANDS = [
|
|
|
61950
62276
|
}
|
|
61951
62277
|
];
|
|
61952
62278
|
|
|
62279
|
+
// src/telemetry/tool-enrichment.ts
|
|
62280
|
+
function asString(value) {
|
|
62281
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
62282
|
+
}
|
|
62283
|
+
function globalProjectDir() {
|
|
62284
|
+
return extractArg(process.argv, "project-dir", process.cwd()) ?? process.cwd();
|
|
62285
|
+
}
|
|
62286
|
+
var TOOL_ENRICHERS = {
|
|
62287
|
+
[ToolName.RunFile]: (opts, lockedCommand) => buildStudioShapedProps(globalProjectDir(), {
|
|
62288
|
+
action: "run",
|
|
62289
|
+
runKind: String(lockedCommand ?? opts.command ?? "StartExecution")
|
|
62290
|
+
}),
|
|
62291
|
+
[ToolName.CreateProject]: (opts) => {
|
|
62292
|
+
const extra = { action: "create" };
|
|
62293
|
+
const targetFramework = asString(opts.targetFramework);
|
|
62294
|
+
if (targetFramework)
|
|
62295
|
+
extra.targetFramework = targetFramework;
|
|
62296
|
+
const expressionLanguage = asString(opts.expressionLanguage);
|
|
62297
|
+
if (expressionLanguage)
|
|
62298
|
+
extra.expressionLanguage = expressionLanguage;
|
|
62299
|
+
const templateId = asString(opts.templateId);
|
|
62300
|
+
if (templateId)
|
|
62301
|
+
extra.templateId = templateId;
|
|
62302
|
+
return buildStudioShapedProps(undefined, extra);
|
|
62303
|
+
},
|
|
62304
|
+
[ToolName.OpenProject]: (opts) => buildStudioShapedProps(asString(opts.projectDir) ?? globalProjectDir(), {
|
|
62305
|
+
action: "handoff-to-studio"
|
|
62306
|
+
}),
|
|
62307
|
+
[ToolName.GetErrors]: () => buildStudioShapedProps(globalProjectDir(), { action: "diagnose" }),
|
|
62308
|
+
[ToolName.InstallOrUpdatePackages]: () => buildStudioShapedProps(globalProjectDir(), {
|
|
62309
|
+
action: "manage-dependencies"
|
|
62310
|
+
})
|
|
62311
|
+
};
|
|
62312
|
+
function hasToolEnricher(toolName) {
|
|
62313
|
+
return Object.hasOwn(TOOL_ENRICHERS, toolName);
|
|
62314
|
+
}
|
|
62315
|
+
function studioShapedPropsForTool(toolName, opts, lockedCommand) {
|
|
62316
|
+
return TOOL_ENRICHERS[toolName]?.(opts, lockedCommand);
|
|
62317
|
+
}
|
|
62318
|
+
|
|
61953
62319
|
// src/commands/register-mcp-commands.ts
|
|
62320
|
+
function studioShapedPropsCallback(toolName, lockedCommand) {
|
|
62321
|
+
if (!hasToolEnricher(toolName)) {
|
|
62322
|
+
return;
|
|
62323
|
+
}
|
|
62324
|
+
return (opts) => studioShapedPropsForTool(toolName, opts, lockedCommand) ?? {};
|
|
62325
|
+
}
|
|
61954
62326
|
async function registerMcpCommands(program4, client) {
|
|
61955
62327
|
const tools = await client.listTools();
|
|
61956
62328
|
const groupCache = new Map;
|
|
@@ -62007,7 +62379,7 @@ function registerDerivedCommand(program4, baseTool, derived, cache, client) {
|
|
|
62007
62379
|
if (output.exitCode !== 0) {
|
|
62008
62380
|
processContext.exit(output.exitCode);
|
|
62009
62381
|
}
|
|
62010
|
-
});
|
|
62382
|
+
}, studioShapedPropsCallback(baseTool.name, derived.lockedArgs.command));
|
|
62011
62383
|
}
|
|
62012
62384
|
function getOrCreateGroup(program4, segments, cache) {
|
|
62013
62385
|
let parent = program4;
|
|
@@ -62050,7 +62422,7 @@ function registerSubcommand(program4, tool, cliCmd, hidden, client) {
|
|
|
62050
62422
|
if (output.exitCode !== 0) {
|
|
62051
62423
|
processContext.exit(output.exitCode);
|
|
62052
62424
|
}
|
|
62053
|
-
});
|
|
62425
|
+
}, studioShapedPropsCallback(tool.name));
|
|
62054
62426
|
}
|
|
62055
62427
|
function applyStructuredArgErrorHint(sub3, flags) {
|
|
62056
62428
|
const structured = flags.filter((f) => f.typeHint === "json" || f.typeHint === "jsonArray");
|
|
@@ -62131,7 +62503,7 @@ function addFlagToCommand(sub3, flag) {
|
|
|
62131
62503
|
}
|
|
62132
62504
|
|
|
62133
62505
|
// src/resolution/helm-npm-resolver.ts
|
|
62134
|
-
import { dirname as
|
|
62506
|
+
import { dirname as dirname7, join as join13 } from "node:path";
|
|
62135
62507
|
function helmPackageName() {
|
|
62136
62508
|
const key = `${process.platform}-${process.arch}`;
|
|
62137
62509
|
switch (key) {
|
|
@@ -62154,7 +62526,7 @@ function helmPackageName() {
|
|
|
62154
62526
|
function resolveHelmFromNpm(deps) {
|
|
62155
62527
|
const localDir = process.env.HELM_LOCAL_DIR;
|
|
62156
62528
|
if (localDir) {
|
|
62157
|
-
const helmExePath2 =
|
|
62529
|
+
const helmExePath2 = join13(localDir, HELM_EXE);
|
|
62158
62530
|
if (deps.fileExists(helmExePath2)) {
|
|
62159
62531
|
deps.log(`Using local Helm from HELM_LOCAL_DIR: ${localDir}`);
|
|
62160
62532
|
return { toolsDir: localDir, helmExePath: helmExePath2 };
|
|
@@ -62170,8 +62542,8 @@ function resolveHelmFromNpm(deps) {
|
|
|
62170
62542
|
const detail = err2 instanceof Error ? err2.message : String(err2);
|
|
62171
62543
|
throw new Error(`Helm binary package '${packageName}' is not installed. It installs ` + "automatically as an optionalDependency of @uipath/rpa-tool for " + `${process.platform}/${process.arch}. If you installed with ` + "--omit=optional or --no-optional, reinstall without that flag, or " + `set HELM_LOCAL_DIR to a Helm tools directory. (${detail})`);
|
|
62172
62544
|
}
|
|
62173
|
-
const toolsDir =
|
|
62174
|
-
const helmExePath =
|
|
62545
|
+
const toolsDir = join13(dirname7(packageJsonPath), "tools");
|
|
62546
|
+
const helmExePath = join13(toolsDir, HELM_EXE);
|
|
62175
62547
|
if (!deps.fileExists(helmExePath)) {
|
|
62176
62548
|
throw new Error(`Helm binary not found at ${helmExePath} inside package ` + `'${packageName}'. The package may be corrupt or incomplete.`);
|
|
62177
62549
|
}
|
|
@@ -62214,17 +62586,17 @@ import {
|
|
|
62214
62586
|
existsSync as existsSync6,
|
|
62215
62587
|
mkdirSync as mkdirSync2,
|
|
62216
62588
|
openSync as openSync2,
|
|
62217
|
-
readdirSync as
|
|
62218
|
-
readFileSync as
|
|
62589
|
+
readdirSync as readdirSync4,
|
|
62590
|
+
readFileSync as readFileSync6,
|
|
62219
62591
|
renameSync,
|
|
62220
62592
|
rmSync as rmSync3,
|
|
62221
|
-
statSync as
|
|
62593
|
+
statSync as statSync3,
|
|
62222
62594
|
unlinkSync as unlinkSync2,
|
|
62223
62595
|
utimesSync,
|
|
62224
62596
|
writeSync
|
|
62225
62597
|
} from "node:fs";
|
|
62226
62598
|
import { homedir as homedir5 } from "node:os";
|
|
62227
|
-
import { join as
|
|
62599
|
+
import { join as join14 } from "node:path";
|
|
62228
62600
|
var DEFAULT_MAX_SLOTS = 3;
|
|
62229
62601
|
var READY_MARKER = ".ready";
|
|
62230
62602
|
var STAGING_DIR = ".staging";
|
|
@@ -62238,28 +62610,20 @@ function resolveHelmCacheRoot() {
|
|
|
62238
62610
|
if (override)
|
|
62239
62611
|
return override;
|
|
62240
62612
|
if (process.platform === "win32") {
|
|
62241
|
-
const base = process.env.LOCALAPPDATA ??
|
|
62242
|
-
return
|
|
62613
|
+
const base = process.env.LOCALAPPDATA ?? join14(homedir5(), "AppData", "Local");
|
|
62614
|
+
return join14(base, "UiPath", "Helm");
|
|
62243
62615
|
}
|
|
62244
62616
|
if (process.platform === "darwin") {
|
|
62245
|
-
return
|
|
62617
|
+
return join14(homedir5(), "Library", "Caches", "UiPath", "Helm");
|
|
62246
62618
|
}
|
|
62247
|
-
const xdg = process.env.XDG_CACHE_HOME ??
|
|
62248
|
-
return
|
|
62619
|
+
const xdg = process.env.XDG_CACHE_HOME ?? join14(homedir5(), ".cache");
|
|
62620
|
+
return join14(xdg, "uipath", "helm");
|
|
62249
62621
|
}
|
|
62250
62622
|
function slotName(version) {
|
|
62251
62623
|
return version.replace(/[\\/]/g, "_");
|
|
62252
62624
|
}
|
|
62253
62625
|
function helmSlotDir(root, version) {
|
|
62254
|
-
return
|
|
62255
|
-
}
|
|
62256
|
-
function isProcessAlive2(pid) {
|
|
62257
|
-
try {
|
|
62258
|
-
process.kill(pid, 0);
|
|
62259
|
-
return true;
|
|
62260
|
-
} catch {
|
|
62261
|
-
return false;
|
|
62262
|
-
}
|
|
62626
|
+
return join14(root, slotName(version));
|
|
62263
62627
|
}
|
|
62264
62628
|
function touch(path4) {
|
|
62265
62629
|
try {
|
|
@@ -62275,9 +62639,9 @@ function tryAcquireLock(lockPath, log) {
|
|
|
62275
62639
|
return true;
|
|
62276
62640
|
} catch {
|
|
62277
62641
|
try {
|
|
62278
|
-
const raw =
|
|
62642
|
+
const raw = readFileSync6(lockPath, "utf-8");
|
|
62279
62643
|
const { pid, ts } = JSON.parse(raw);
|
|
62280
|
-
const dead = typeof pid === "number" && !
|
|
62644
|
+
const dead = typeof pid === "number" && !isProcessAlive(pid);
|
|
62281
62645
|
const old = typeof ts === "number" && Date.now() - ts > STALE_LOCK_MS;
|
|
62282
62646
|
if (dead || old) {
|
|
62283
62647
|
log(`Stealing stale Helm slot lock: ${lockPath}`);
|
|
@@ -62294,14 +62658,14 @@ function releaseLock(lockPath) {
|
|
|
62294
62658
|
} catch {}
|
|
62295
62659
|
}
|
|
62296
62660
|
function publishSlot(sourceToolsDir, slot, root, version, log) {
|
|
62297
|
-
const stagingRoot =
|
|
62661
|
+
const stagingRoot = join14(root, STAGING_DIR);
|
|
62298
62662
|
mkdirSync2(stagingRoot, { recursive: true });
|
|
62299
|
-
const staging =
|
|
62663
|
+
const staging = join14(stagingRoot, `${slotName(version)}-${process.pid}-${Date.now().toString(36)}`);
|
|
62300
62664
|
rmSync3(staging, { recursive: true, force: true });
|
|
62301
62665
|
log(`Materializing Helm slot ${slot} from ${sourceToolsDir}`);
|
|
62302
62666
|
cpSync(sourceToolsDir, staging, { recursive: true });
|
|
62303
62667
|
const now = new Date;
|
|
62304
|
-
const markerFd = openSync2(
|
|
62668
|
+
const markerFd = openSync2(join14(staging, READY_MARKER), "w");
|
|
62305
62669
|
writeSync(markerFd, now.getTime().toString());
|
|
62306
62670
|
closeSync2(markerFd);
|
|
62307
62671
|
rmSync3(slot, { recursive: true, force: true });
|
|
@@ -62312,14 +62676,14 @@ function publishSlot(sourceToolsDir, slot, root, version, log) {
|
|
|
62312
62676
|
}
|
|
62313
62677
|
}
|
|
62314
62678
|
function evictSlots(root, targetSlot, liveBinDirs, maxSlots, log) {
|
|
62315
|
-
const entries =
|
|
62679
|
+
const entries = readdirSync4(root, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== STAGING_DIR).map((e) => join14(root, e.name)).filter((dir) => existsSync6(join14(dir, READY_MARKER)));
|
|
62316
62680
|
if (entries.length <= maxSlots)
|
|
62317
62681
|
return;
|
|
62318
62682
|
const targetNorm = normalizePath(targetSlot);
|
|
62319
62683
|
const now = Date.now();
|
|
62320
62684
|
const readyMtime = (dir) => {
|
|
62321
62685
|
try {
|
|
62322
|
-
return
|
|
62686
|
+
return statSync3(join14(dir, READY_MARKER)).mtimeMs;
|
|
62323
62687
|
} catch {
|
|
62324
62688
|
return 0;
|
|
62325
62689
|
}
|
|
@@ -62344,21 +62708,21 @@ function evictSlots(root, targetSlot, liveBinDirs, maxSlots, log) {
|
|
|
62344
62708
|
}
|
|
62345
62709
|
}
|
|
62346
62710
|
function cleanupStale(root) {
|
|
62347
|
-
const stagingRoot =
|
|
62711
|
+
const stagingRoot = join14(root, STAGING_DIR);
|
|
62348
62712
|
let entries;
|
|
62349
62713
|
try {
|
|
62350
|
-
entries =
|
|
62714
|
+
entries = readdirSync4(stagingRoot);
|
|
62351
62715
|
} catch {
|
|
62352
62716
|
return;
|
|
62353
62717
|
}
|
|
62354
62718
|
const now = Date.now();
|
|
62355
62719
|
for (const name of entries) {
|
|
62356
|
-
const dir =
|
|
62720
|
+
const dir = join14(stagingRoot, name);
|
|
62357
62721
|
const parts = name.split("-");
|
|
62358
62722
|
const pid = Number.parseInt(parts[parts.length - 2] ?? "", 10);
|
|
62359
62723
|
try {
|
|
62360
|
-
const age = now -
|
|
62361
|
-
const ownerDead = Number.isNaN(pid) || !
|
|
62724
|
+
const age = now - statSync3(dir).mtimeMs;
|
|
62725
|
+
const ownerDead = Number.isNaN(pid) || !isProcessAlive(pid);
|
|
62362
62726
|
if (ownerDead && age > STALE_STAGING_MS) {
|
|
62363
62727
|
rmSync3(dir, { recursive: true, force: true });
|
|
62364
62728
|
}
|
|
@@ -62371,14 +62735,14 @@ async function ensureHelmSlot(opts) {
|
|
|
62371
62735
|
const root = opts.cacheRoot ?? resolveHelmCacheRoot();
|
|
62372
62736
|
const maxSlots = opts.maxSlots ?? DEFAULT_MAX_SLOTS;
|
|
62373
62737
|
const slot = helmSlotDir(root, opts.version);
|
|
62374
|
-
const readyPath =
|
|
62738
|
+
const readyPath = join14(slot, READY_MARKER);
|
|
62375
62739
|
const fromSource = () => ({
|
|
62376
62740
|
toolsDir: opts.sourceToolsDir,
|
|
62377
|
-
helmExePath:
|
|
62741
|
+
helmExePath: join14(opts.sourceToolsDir, opts.helmExeName)
|
|
62378
62742
|
});
|
|
62379
62743
|
const fromSlot = () => {
|
|
62380
62744
|
touch(readyPath);
|
|
62381
|
-
return { toolsDir: slot, helmExePath:
|
|
62745
|
+
return { toolsDir: slot, helmExePath: join14(slot, opts.helmExeName) };
|
|
62382
62746
|
};
|
|
62383
62747
|
if (existsSync6(readyPath)) {
|
|
62384
62748
|
log(`Using cached Helm slot: ${slot}`);
|
|
@@ -62390,7 +62754,7 @@ async function ensureHelmSlot(opts) {
|
|
|
62390
62754
|
log(`Cannot create Helm cache root ${root}; running from source.`);
|
|
62391
62755
|
return fromSource();
|
|
62392
62756
|
}
|
|
62393
|
-
const lockPath =
|
|
62757
|
+
const lockPath = join14(root, `${slotName(opts.version)}.lock`);
|
|
62394
62758
|
const deadline = Date.now() + MAX_WAIT_MS;
|
|
62395
62759
|
while (true) {
|
|
62396
62760
|
if (existsSync6(readyPath))
|
|
@@ -62426,7 +62790,7 @@ async function ensureHelmSlot(opts) {
|
|
|
62426
62790
|
}
|
|
62427
62791
|
|
|
62428
62792
|
// src/resolution/studio-bin-resolver.ts
|
|
62429
|
-
import { join as
|
|
62793
|
+
import { join as join15, win32 as win322 } from "node:path";
|
|
62430
62794
|
function getProcessExecutablePath(pid, deps) {
|
|
62431
62795
|
const exePath = deps.executeCommand("powershell", [
|
|
62432
62796
|
"-NoProfile",
|
|
@@ -62521,7 +62885,7 @@ function getStudioFileVersion(binDir, deps) {
|
|
|
62521
62885
|
}
|
|
62522
62886
|
}
|
|
62523
62887
|
function readManifest(binDir, filename, deps) {
|
|
62524
|
-
const manifestPath =
|
|
62888
|
+
const manifestPath = join15(binDir, filename);
|
|
62525
62889
|
try {
|
|
62526
62890
|
const content = deps.readFile(manifestPath);
|
|
62527
62891
|
return JSON.parse(content);
|
|
@@ -62534,7 +62898,7 @@ function readInteropManifest(binDir, deps) {
|
|
|
62534
62898
|
return readManifest(binDir, INTEROP_MANIFEST, deps);
|
|
62535
62899
|
}
|
|
62536
62900
|
function validateInteropSupport(binDir, deps) {
|
|
62537
|
-
const manifestPath =
|
|
62901
|
+
const manifestPath = join15(binDir, INTEROP_MANIFEST);
|
|
62538
62902
|
if (!deps.fileExists(manifestPath)) {
|
|
62539
62903
|
const version = getStudioFileVersion(binDir, deps);
|
|
62540
62904
|
throw new Error(`Studio ${version} does not support rpa-tool. Please upgrade to the latest version of UiPath Studio.`);
|
|
@@ -62542,8 +62906,8 @@ function validateInteropSupport(binDir, deps) {
|
|
|
62542
62906
|
}
|
|
62543
62907
|
|
|
62544
62908
|
// src/resolution/studio-startup.ts
|
|
62545
|
-
import { chmodSync, statSync as
|
|
62546
|
-
import { join as
|
|
62909
|
+
import { chmodSync, statSync as statSync4 } from "node:fs";
|
|
62910
|
+
import { join as join16 } from "node:path";
|
|
62547
62911
|
async function waitForInstanceAvailability(processId, deps, timeoutMs = DEFAULT_TIMEOUT_MS2) {
|
|
62548
62912
|
const deadline = Date.now() + timeoutMs;
|
|
62549
62913
|
let pollCount = 0;
|
|
@@ -62572,7 +62936,7 @@ async function waitForInstanceAvailability(processId, deps, timeoutMs = DEFAULT_
|
|
|
62572
62936
|
async function startStudioAndWait(binDir, deps, timeoutMs = DEFAULT_TIMEOUT_MS2) {
|
|
62573
62937
|
const existingPids = new Set(deps.discoverInstances().instances.map((i2) => i2.processId));
|
|
62574
62938
|
deps.log(`Existing Studio PIDs: [${[...existingPids].join(", ")}]`);
|
|
62575
|
-
const exePath =
|
|
62939
|
+
const exePath = join16(binDir, STUDIO_EXE);
|
|
62576
62940
|
deps.log(`Starting Studio: ${exePath}`);
|
|
62577
62941
|
deps.spawnDetached(exePath, []);
|
|
62578
62942
|
const deadline = Date.now() + timeoutMs;
|
|
@@ -62607,7 +62971,7 @@ function ensureExecutable(exePath, log) {
|
|
|
62607
62971
|
if (process.platform === "win32")
|
|
62608
62972
|
return;
|
|
62609
62973
|
try {
|
|
62610
|
-
chmodSync(exePath,
|
|
62974
|
+
chmodSync(exePath, statSync4(exePath).mode | 73);
|
|
62611
62975
|
} catch (err2) {
|
|
62612
62976
|
log(`Could not set +x on ${exePath}: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
62613
62977
|
}
|
|
@@ -62731,16 +63095,19 @@ async function tryMatchInstance(instances, options, requiresProject, deps) {
|
|
|
62731
63095
|
}
|
|
62732
63096
|
return null;
|
|
62733
63097
|
}
|
|
63098
|
+
function staleHostPidMessage(pid) {
|
|
63099
|
+
return `Studio instance PID ${pid} is not reachable. ` + `The UIPATH_STUDIO_PID environment variable points to a Studio session ` + `that no longer exists - open a new terminal, or clear UIPATH_STUDIO_PID ` + `so the CLI resolves a running instance instead.`;
|
|
63100
|
+
}
|
|
62734
63101
|
async function resolveStudioInstance(options, deps = defaultResolverDeps) {
|
|
62735
63102
|
const requiresProject = options.requiresProject !== false;
|
|
62736
63103
|
deps.log(`Resolving Studio instance for project: ${options.projectDir} ` + `(requiresProject=${requiresProject})`);
|
|
62737
63104
|
if (options.targetPid != null) {
|
|
62738
63105
|
if (options.excludePids?.has(options.targetPid)) {
|
|
62739
|
-
throw new Error(
|
|
63106
|
+
throw new Error(staleHostPidMessage(options.targetPid));
|
|
62740
63107
|
}
|
|
62741
63108
|
const target = deps.readInstanceStatus(options.targetPid);
|
|
62742
|
-
if (!target?.ipcEndpointName) {
|
|
62743
|
-
throw new Error(
|
|
63109
|
+
if (!target?.ipcEndpointName || !deps.isProcessAlive(options.targetPid)) {
|
|
63110
|
+
throw new Error(staleHostPidMessage(options.targetPid));
|
|
62744
63111
|
}
|
|
62745
63112
|
if (target.executionStatus === "Available" /* Available */) {
|
|
62746
63113
|
deps.log(`Using target PID ${target.processId}: pipe=${target.ipcEndpointName}`);
|
|
@@ -63107,9 +63474,15 @@ class StudioSession {
|
|
|
63107
63474
|
}
|
|
63108
63475
|
if (this.options.hostStudioPid && !this.options.useStudio && opts.toolName) {
|
|
63109
63476
|
let target = getHostRouteTarget(opts.toolName);
|
|
63110
|
-
if (target === "host" /* Host */ && opts.toolName === ToolName.RunFile
|
|
63111
|
-
this.deps.
|
|
63112
|
-
|
|
63477
|
+
if (target === "host" /* Host */ && opts.toolName === ToolName.RunFile) {
|
|
63478
|
+
const hostStatus = this.deps.readInstanceStatus(this.options.hostStudioPid);
|
|
63479
|
+
if (!hostStatus?.ipcEndpointName || !this.deps.isProcessAlive(this.options.hostStudioPid)) {
|
|
63480
|
+
this.deps.log(`Host Studio (PID ${this.options.hostStudioPid}) is not reachable - the Studio session that set UIPATH_STUDIO_PID has ended; falling back to normal instance resolution.`);
|
|
63481
|
+
target = "helm" /* Helm */;
|
|
63482
|
+
} else if (opts.projectDir && this.hostHasDifferentProjectOpen(opts.projectDir, hostStatus)) {
|
|
63483
|
+
this.deps.log(`Host Studio has a different project open; diverting ${opts.toolName} to Helm to preserve the session.`);
|
|
63484
|
+
target = "helm" /* Helm */;
|
|
63485
|
+
}
|
|
63113
63486
|
}
|
|
63114
63487
|
this.deps.log(`Host PID routing: ${opts.toolName} -> ${target}`);
|
|
63115
63488
|
if (target === "host" /* Host */) {
|
|
@@ -63214,13 +63587,8 @@ class StudioSession {
|
|
|
63214
63587
|
deps.log(`Failed to pause Studio DB access: ${e instanceof Error ? e.message : e}`);
|
|
63215
63588
|
}
|
|
63216
63589
|
}
|
|
63217
|
-
hostHasDifferentProjectOpen(projectDir) {
|
|
63218
|
-
|
|
63219
|
-
if (hostPid == null) {
|
|
63220
|
-
return false;
|
|
63221
|
-
}
|
|
63222
|
-
const status = this.deps.readInstanceStatus(hostPid);
|
|
63223
|
-
return !!status?.projectDirectory && normalizePath(status.projectDirectory) !== normalizePath(projectDir);
|
|
63590
|
+
hostHasDifferentProjectOpen(projectDir, hostStatus) {
|
|
63591
|
+
return !!hostStatus.projectDirectory && normalizePath(hostStatus.projectDirectory) !== normalizePath(projectDir);
|
|
63224
63592
|
}
|
|
63225
63593
|
forTool(toolName) {
|
|
63226
63594
|
return Object.create(this, {
|
|
@@ -63279,8 +63647,8 @@ function createInterpolator(values) {
|
|
|
63279
63647
|
}
|
|
63280
63648
|
|
|
63281
63649
|
// src/external-cli/discovery.ts
|
|
63282
|
-
import { existsSync as existsSync7, readFileSync as
|
|
63283
|
-
import { join as
|
|
63650
|
+
import { existsSync as existsSync7, readFileSync as readFileSync7 } from "node:fs";
|
|
63651
|
+
import { join as join17 } from "node:path";
|
|
63284
63652
|
|
|
63285
63653
|
class MissingAllDependenciesError extends Error {
|
|
63286
63654
|
projectDir;
|
|
@@ -63312,10 +63680,10 @@ class PackageRootMissingError extends Error {
|
|
|
63312
63680
|
}
|
|
63313
63681
|
var defaultDeps = {
|
|
63314
63682
|
fileExists: existsSync7,
|
|
63315
|
-
readFile: (path4) =>
|
|
63683
|
+
readFile: (path4) => readFileSync7(path4, "utf-8")
|
|
63316
63684
|
};
|
|
63317
63685
|
function discoverPackageRoot(params, deps = defaultDeps) {
|
|
63318
|
-
const depsFile =
|
|
63686
|
+
const depsFile = join17(params.projectDir, ".local", "AllDependencies.json");
|
|
63319
63687
|
if (!deps.fileExists(depsFile)) {
|
|
63320
63688
|
throw new MissingAllDependenciesError(params.projectDir, depsFile);
|
|
63321
63689
|
}
|
|
@@ -63325,7 +63693,7 @@ function discoverPackageRoot(params, deps = defaultDeps) {
|
|
|
63325
63693
|
if (packageFolders.length === 0) {
|
|
63326
63694
|
throw new Error("No packageFolders found in AllDependencies.json.");
|
|
63327
63695
|
}
|
|
63328
|
-
const packageRoot =
|
|
63696
|
+
const packageRoot = join17(packageFolders[0], library.path);
|
|
63329
63697
|
if (!deps.fileExists(packageRoot)) {
|
|
63330
63698
|
throw new PackageRootMissingError(packageRoot);
|
|
63331
63699
|
}
|
|
@@ -63347,23 +63715,23 @@ function findLibraryEntry(allDeps, packageId) {
|
|
|
63347
63715
|
import {
|
|
63348
63716
|
existsSync as existsSync8,
|
|
63349
63717
|
mkdirSync as mkdirSync3,
|
|
63350
|
-
readFileSync as
|
|
63351
|
-
statSync as
|
|
63718
|
+
readFileSync as readFileSync8,
|
|
63719
|
+
statSync as statSync5,
|
|
63352
63720
|
writeFileSync as writeFileSync3
|
|
63353
63721
|
} from "node:fs";
|
|
63354
|
-
import { dirname as
|
|
63722
|
+
import { dirname as dirname8, join as join18 } from "node:path";
|
|
63355
63723
|
var defaultDeps2 = {
|
|
63356
63724
|
fileExists: existsSync8,
|
|
63357
|
-
readFile: (path4) =>
|
|
63725
|
+
readFile: (path4) => readFileSync8(path4, "utf-8"),
|
|
63358
63726
|
writeFile: (path4, content) => {
|
|
63359
|
-
mkdirSync3(
|
|
63727
|
+
mkdirSync3(dirname8(path4), { recursive: true });
|
|
63360
63728
|
writeFileSync3(path4, content, "utf-8");
|
|
63361
63729
|
},
|
|
63362
|
-
getModifiedTime: (path4) =>
|
|
63730
|
+
getModifiedTime: (path4) => statSync5(path4).mtimeMs
|
|
63363
63731
|
};
|
|
63364
63732
|
function discoverPackageRootCached(params, deps = defaultDeps2) {
|
|
63365
|
-
const cacheFilePath =
|
|
63366
|
-
const allDepsPath =
|
|
63733
|
+
const cacheFilePath = join18(params.projectDir, ".local", "rpa-tool", `${params.commandName}.json`);
|
|
63734
|
+
const allDepsPath = join18(params.projectDir, ".local", "AllDependencies.json");
|
|
63367
63735
|
let entry;
|
|
63368
63736
|
if (deps.fileExists(cacheFilePath)) {
|
|
63369
63737
|
try {
|
|
@@ -63419,7 +63787,7 @@ function mergeEnv(extra) {
|
|
|
63419
63787
|
return { ...process.env, ...extra };
|
|
63420
63788
|
}
|
|
63421
63789
|
function spawnForward(exePath, args, env) {
|
|
63422
|
-
return new Promise((
|
|
63790
|
+
return new Promise((resolve9, reject) => {
|
|
63423
63791
|
const child = spawn3(exePath, args, {
|
|
63424
63792
|
stdio: "inherit",
|
|
63425
63793
|
env: mergeEnv(env)
|
|
@@ -63428,12 +63796,12 @@ function spawnForward(exePath, args, env) {
|
|
|
63428
63796
|
reject(new Error(`Failed to spawn '${exePath}': ${err2.message}`));
|
|
63429
63797
|
});
|
|
63430
63798
|
child.on("close", (code) => {
|
|
63431
|
-
|
|
63799
|
+
resolve9(code ?? 1);
|
|
63432
63800
|
});
|
|
63433
63801
|
});
|
|
63434
63802
|
}
|
|
63435
63803
|
function spawnCapture(exePath, args, env) {
|
|
63436
|
-
return new Promise((
|
|
63804
|
+
return new Promise((resolve9, reject) => {
|
|
63437
63805
|
const child = spawn3(exePath, args, {
|
|
63438
63806
|
stdio: ["inherit", "pipe", "pipe"],
|
|
63439
63807
|
env: mergeEnv(env)
|
|
@@ -63449,7 +63817,7 @@ function spawnCapture(exePath, args, env) {
|
|
|
63449
63817
|
reject(new Error(`Failed to spawn '${exePath}': ${err2.message}`));
|
|
63450
63818
|
});
|
|
63451
63819
|
child.on("close", (code) => {
|
|
63452
|
-
|
|
63820
|
+
resolve9({
|
|
63453
63821
|
exitCode: code ?? 1,
|
|
63454
63822
|
stdout: Buffer.concat(stdoutChunks).toString("utf8"),
|
|
63455
63823
|
stderr: Buffer.concat(stderrChunks).toString("utf8")
|
|
@@ -63460,12 +63828,12 @@ function spawnCapture(exePath, args, env) {
|
|
|
63460
63828
|
|
|
63461
63829
|
// src/external-cli/manifest-reader.ts
|
|
63462
63830
|
import { execFileSync as execFileSync8 } from "node:child_process";
|
|
63463
|
-
import { existsSync as existsSync9, readFileSync as
|
|
63464
|
-
import { join as
|
|
63831
|
+
import { existsSync as existsSync9, readFileSync as readFileSync9 } from "node:fs";
|
|
63832
|
+
import { join as join19 } from "node:path";
|
|
63465
63833
|
var MANIFEST_FILENAME = "cli.manifest.json";
|
|
63466
63834
|
var defaultDeps3 = {
|
|
63467
63835
|
fileExists: existsSync9,
|
|
63468
|
-
readFile: (path4) =>
|
|
63836
|
+
readFile: (path4) => readFileSync9(path4, "utf-8")
|
|
63469
63837
|
};
|
|
63470
63838
|
function isRosettaTranslated() {
|
|
63471
63839
|
try {
|
|
@@ -63517,7 +63885,7 @@ function resolveExecutableRelativePath(manifest, manifestPath, platformKey) {
|
|
|
63517
63885
|
throw new Error(`Manifest ${manifestPath} declares neither 'tool.executable' nor 'tool.executables'.`);
|
|
63518
63886
|
}
|
|
63519
63887
|
function readCliManifest(packageRoot, deps = defaultDeps3) {
|
|
63520
|
-
const manifestPath =
|
|
63888
|
+
const manifestPath = join19(packageRoot, MANIFEST_FILENAME);
|
|
63521
63889
|
if (!deps.fileExists(manifestPath)) {
|
|
63522
63890
|
throw new Error(`CLI manifest not found at ${manifestPath}. ` + `Ensure the package includes a ${MANIFEST_FILENAME} file.`);
|
|
63523
63891
|
}
|
|
@@ -63532,7 +63900,7 @@ function readCliManifest(packageRoot, deps = defaultDeps3) {
|
|
|
63532
63900
|
}
|
|
63533
63901
|
const platformKey = (deps.getPlatformKey ?? getCurrentPlatformKey)();
|
|
63534
63902
|
const relExe = resolveExecutableRelativePath(manifest, manifestPath, platformKey);
|
|
63535
|
-
const exePath =
|
|
63903
|
+
const exePath = join19(packageRoot, relExe);
|
|
63536
63904
|
if (!deps.fileExists(exePath)) {
|
|
63537
63905
|
throw new Error(`Executable not found at ${exePath} as declared in ${manifestPath}.`);
|
|
63538
63906
|
}
|
|
@@ -67288,19 +67656,19 @@ var baseOpen5 = async (options) => {
|
|
|
67288
67656
|
}
|
|
67289
67657
|
const subprocess = childProcess35.spawn(command, cliArguments, childProcessOptions);
|
|
67290
67658
|
if (options.wait) {
|
|
67291
|
-
return new Promise((
|
|
67659
|
+
return new Promise((resolve10, reject) => {
|
|
67292
67660
|
subprocess.once("error", reject);
|
|
67293
67661
|
subprocess.once("close", (exitCode) => {
|
|
67294
67662
|
if (!options.allowNonzeroExitCode && exitCode !== 0) {
|
|
67295
67663
|
reject(new Error(`Exited with code ${exitCode}`));
|
|
67296
67664
|
return;
|
|
67297
67665
|
}
|
|
67298
|
-
|
|
67666
|
+
resolve10(subprocess);
|
|
67299
67667
|
});
|
|
67300
67668
|
});
|
|
67301
67669
|
}
|
|
67302
67670
|
if (isFallbackAttempt) {
|
|
67303
|
-
return new Promise((
|
|
67671
|
+
return new Promise((resolve10, reject) => {
|
|
67304
67672
|
subprocess.once("error", reject);
|
|
67305
67673
|
subprocess.once("spawn", () => {
|
|
67306
67674
|
subprocess.once("close", (exitCode) => {
|
|
@@ -67310,17 +67678,17 @@ var baseOpen5 = async (options) => {
|
|
|
67310
67678
|
return;
|
|
67311
67679
|
}
|
|
67312
67680
|
subprocess.unref();
|
|
67313
|
-
|
|
67681
|
+
resolve10(subprocess);
|
|
67314
67682
|
});
|
|
67315
67683
|
});
|
|
67316
67684
|
});
|
|
67317
67685
|
}
|
|
67318
67686
|
subprocess.unref();
|
|
67319
|
-
return new Promise((
|
|
67687
|
+
return new Promise((resolve10, reject) => {
|
|
67320
67688
|
subprocess.once("error", reject);
|
|
67321
67689
|
subprocess.once("spawn", () => {
|
|
67322
67690
|
subprocess.off("error", reject);
|
|
67323
|
-
|
|
67691
|
+
resolve10(subprocess);
|
|
67324
67692
|
});
|
|
67325
67693
|
});
|
|
67326
67694
|
};
|
|
@@ -75396,7 +75764,7 @@ function getDefaultActivityXamlTool(session) {
|
|
|
75396
75764
|
|
|
75397
75765
|
// src/tools/local/get-errors.ts
|
|
75398
75766
|
import { existsSync as existsSync11 } from "node:fs";
|
|
75399
|
-
import { isAbsolute as isAbsolute9, resolve as
|
|
75767
|
+
import { isAbsolute as isAbsolute9, resolve as resolve10 } from "node:path";
|
|
75400
75768
|
var SEVERITIES = ["error", "warning", "info", "verbose"];
|
|
75401
75769
|
var LEVEL_BY_NAME = Object.fromEntries(SEVERITIES.map((name, i3) => [name, i3 + 1]));
|
|
75402
75770
|
var NAME_BY_LEVEL = Object.fromEntries(SEVERITIES.map((name, i3) => [i3 + 1, name]));
|
|
@@ -75454,7 +75822,7 @@ function resolveTargetedFile(filePath, projectDir) {
|
|
|
75454
75822
|
if (isAbsolute9(filePath)) {
|
|
75455
75823
|
return filePath;
|
|
75456
75824
|
}
|
|
75457
|
-
return projectDir !== undefined ?
|
|
75825
|
+
return projectDir !== undefined ? resolve10(projectDir, filePath) : undefined;
|
|
75458
75826
|
}
|
|
75459
75827
|
function getErrorsTool(session) {
|
|
75460
75828
|
return createToolHandler(session, {
|
|
@@ -76688,6 +77056,22 @@ class HelmRunService {
|
|
|
76688
77056
|
}
|
|
76689
77057
|
|
|
76690
77058
|
// src/tools/local/run-file.ts
|
|
77059
|
+
function emitRunExceptionType(resultText, projectDir) {
|
|
77060
|
+
if (!resultText) {
|
|
77061
|
+
return;
|
|
77062
|
+
}
|
|
77063
|
+
try {
|
|
77064
|
+
const exceptionType = extractRunExceptionType(resultText);
|
|
77065
|
+
if (!exceptionType) {
|
|
77066
|
+
return;
|
|
77067
|
+
}
|
|
77068
|
+
const dir = projectDir ?? extractArg(process.argv, "project-dir", process.cwd());
|
|
77069
|
+
telemetry.trackEvent("uip.rpa.run.result", redactProperties({
|
|
77070
|
+
...buildStudioShapedProps(dir, { action: "run" }),
|
|
77071
|
+
exceptionType
|
|
77072
|
+
}));
|
|
77073
|
+
} catch {}
|
|
77074
|
+
}
|
|
76691
77075
|
var EXPRESSION_COMMANDS = new Set(["TestActivity", "StartDebuggingFromHere"]);
|
|
76692
77076
|
var START_COMMANDS2 = new Set([
|
|
76693
77077
|
"StartExecution",
|
|
@@ -76815,7 +77199,7 @@ function runFileTool(session) {
|
|
|
76815
77199
|
},
|
|
76816
77200
|
required: ["filePath"]
|
|
76817
77201
|
}
|
|
76818
|
-
}, async (session2, args,
|
|
77202
|
+
}, async (session2, args, projectDir) => {
|
|
76819
77203
|
const command = args.command || "StartExecution";
|
|
76820
77204
|
const filePath = args.filePath;
|
|
76821
77205
|
const inputArguments = toJsonText(args.inputArguments);
|
|
@@ -76868,6 +77252,7 @@ function runFileTool(session) {
|
|
|
76868
77252
|
}
|
|
76869
77253
|
const helmRun = new HelmRunService(session2);
|
|
76870
77254
|
const helmResult = await helmRun.runFile(filePath, inputArguments ?? "", logLevel, command, skipBuild, profiling, folderPath, waitTimeoutSeconds, breakpoints);
|
|
77255
|
+
emitRunExceptionType(helmResult.runResult, projectDir);
|
|
76871
77256
|
return {
|
|
76872
77257
|
content: [
|
|
76873
77258
|
{
|
|
@@ -76894,6 +77279,7 @@ function runFileTool(session) {
|
|
|
76894
77279
|
}
|
|
76895
77280
|
}
|
|
76896
77281
|
const result = await session2.execute((instance) => instance.services.run.executeCommand(command, filePath, inputArguments ?? "", inputVariables ?? "", logLevel, profiling), { requiresProject: true });
|
|
77282
|
+
emitRunExceptionType(result, projectDir);
|
|
76897
77283
|
return {
|
|
76898
77284
|
content: [
|
|
76899
77285
|
{
|
|
@@ -77080,18 +77466,18 @@ function stopExecutionTool(hostStudioPid) {
|
|
|
77080
77466
|
// src/tools/local/tm-config.ts
|
|
77081
77467
|
import { existsSync as existsSync12 } from "node:fs";
|
|
77082
77468
|
import { mkdir as mkdir6, readFile as readFile6, writeFile as writeFile6 } from "node:fs/promises";
|
|
77083
|
-
import { dirname as
|
|
77469
|
+
import { dirname as dirname10, join as join21, resolve as resolve11 } from "node:path";
|
|
77084
77470
|
var TM_DATA_DIR = ".tmh";
|
|
77085
77471
|
var TM_CONFIG_FILE = "config.json";
|
|
77086
77472
|
var PROJECT_FILE2 = "project.json";
|
|
77087
77473
|
function resolveProjectDir2(projectDir) {
|
|
77088
|
-
return
|
|
77474
|
+
return resolve11(projectDir ?? process.cwd());
|
|
77089
77475
|
}
|
|
77090
77476
|
function tmConfigPath(projectDir) {
|
|
77091
|
-
return
|
|
77477
|
+
return join21(projectDir, TM_DATA_DIR, TM_CONFIG_FILE);
|
|
77092
77478
|
}
|
|
77093
77479
|
function assertIsProject(projectDir) {
|
|
77094
|
-
if (!existsSync12(
|
|
77480
|
+
if (!existsSync12(join21(projectDir, PROJECT_FILE2))) {
|
|
77095
77481
|
throw new Error(`No UiPath project found at '${projectDir}' (missing ${PROJECT_FILE2}). ` + `Pass --project-dir pointing at the project root.`);
|
|
77096
77482
|
}
|
|
77097
77483
|
}
|
|
@@ -77109,7 +77495,7 @@ async function readTmSettings(projectDir) {
|
|
|
77109
77495
|
}
|
|
77110
77496
|
async function writeTmSettings(projectDir, settings) {
|
|
77111
77497
|
const path4 = tmConfigPath(projectDir);
|
|
77112
|
-
await mkdir6(
|
|
77498
|
+
await mkdir6(dirname10(path4), { recursive: true });
|
|
77113
77499
|
const text = JSON.stringify(settings, (_key, value) => value === null ? undefined : value, 2);
|
|
77114
77500
|
await writeFile6(path4, text, "utf8");
|
|
77115
77501
|
return path4;
|
|
@@ -77123,7 +77509,7 @@ function isSameTestManagerServer(a, b) {
|
|
|
77123
77509
|
}
|
|
77124
77510
|
var TM_LIVE_RELOAD_STUDIO_VERSION = "26.0.197";
|
|
77125
77511
|
function normalizeDir(path4) {
|
|
77126
|
-
return
|
|
77512
|
+
return resolve11(path4).replace(/[\\/]+$/, "").toLowerCase();
|
|
77127
77513
|
}
|
|
77128
77514
|
function findOpenStudioInstance(projectDir, instances) {
|
|
77129
77515
|
const target = normalizeDir(projectDir);
|
|
@@ -77606,7 +77992,7 @@ var registerCommands = async (program5, options) => {
|
|
|
77606
77992
|
hostStudioPid: process.env.UIPATH_STUDIO_PID ? parseInt(process.env.UIPATH_STUDIO_PID, 10) : undefined,
|
|
77607
77993
|
timeoutSeconds: parseInt(extractArg(process.argv, "timeout", "300") ?? "300", 10)
|
|
77608
77994
|
};
|
|
77609
|
-
resolved.projectDir =
|
|
77995
|
+
resolved.projectDir = resolve12(resolved.projectDir);
|
|
77610
77996
|
mirrorRobotDirToEnv(resolved.robotDir);
|
|
77611
77997
|
if (!options) {
|
|
77612
77998
|
const displayDefaults = {
|