@uipath/rpa-tool 1.198.1 → 1.198.3
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/tool.js +593 -134
- 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.3",
|
|
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);
|
|
@@ -59370,18 +59370,255 @@ var registerListInstancesCommand = (program3) => {
|
|
|
59370
59370
|
};
|
|
59371
59371
|
|
|
59372
59372
|
// src/commands/packager/analyze.ts
|
|
59373
|
-
import { isAbsolute as isAbsolute5, join as
|
|
59373
|
+
import { isAbsolute as isAbsolute5, join as join11 } from "node:path";
|
|
59374
|
+
|
|
59375
|
+
// src/telemetry/studio-shaped-props.ts
|
|
59376
|
+
import { readFileSync } from "node:fs";
|
|
59377
|
+
|
|
59378
|
+
// src/telemetry/authoring-session.ts
|
|
59379
|
+
import { hostname } from "node:os";
|
|
59380
|
+
|
|
59381
|
+
// src/telemetry/identity-hash.ts
|
|
59382
|
+
import { createHash } from "node:crypto";
|
|
59383
|
+
function identityHash(value) {
|
|
59384
|
+
return createHash("sha256").update(value.trim().toLowerCase()).digest("hex").slice(0, 16);
|
|
59385
|
+
}
|
|
59386
|
+
|
|
59387
|
+
// src/telemetry/authoring-session.ts
|
|
59388
|
+
var SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
59389
|
+
function getAuthoringSessionProps() {
|
|
59390
|
+
const explicit = process.env[SESSION_ID_ENV];
|
|
59391
|
+
if (explicit && explicit.trim().length > 0) {
|
|
59392
|
+
return {
|
|
59393
|
+
authoringSessionId: identityHash(explicit),
|
|
59394
|
+
authoringSessionSource: "explicit"
|
|
59395
|
+
};
|
|
59396
|
+
}
|
|
59397
|
+
try {
|
|
59398
|
+
return {
|
|
59399
|
+
authoringSessionId: identityHash(`${process.ppid}:${hostname()}`),
|
|
59400
|
+
authoringSessionSource: "ppid"
|
|
59401
|
+
};
|
|
59402
|
+
} catch {
|
|
59403
|
+
return {};
|
|
59404
|
+
}
|
|
59405
|
+
}
|
|
59406
|
+
|
|
59407
|
+
// src/telemetry/project-json-path.ts
|
|
59408
|
+
import { statSync } from "node:fs";
|
|
59409
|
+
import { basename as basename2, join as join3, resolve as resolve2 } from "node:path";
|
|
59410
|
+
function resolveProjectJsonPath(input) {
|
|
59411
|
+
const abs = resolve2(input);
|
|
59412
|
+
let stats;
|
|
59413
|
+
try {
|
|
59414
|
+
stats = statSync(abs);
|
|
59415
|
+
} catch {
|
|
59416
|
+
return;
|
|
59417
|
+
}
|
|
59418
|
+
if (stats.isDirectory()) {
|
|
59419
|
+
return join3(abs, "project.json");
|
|
59420
|
+
}
|
|
59421
|
+
return basename2(abs).toLowerCase() === "project.json" ? abs : undefined;
|
|
59422
|
+
}
|
|
59423
|
+
|
|
59424
|
+
// src/telemetry/studio-shaped-props.ts
|
|
59425
|
+
var TELEMETRY_SOURCE = "rpa-tool";
|
|
59426
|
+
function asNonEmptyString(value) {
|
|
59427
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
59428
|
+
}
|
|
59429
|
+
function readProjectFields(input) {
|
|
59430
|
+
const path3 = resolveProjectJsonPath(input);
|
|
59431
|
+
if (!path3) {
|
|
59432
|
+
return {};
|
|
59433
|
+
}
|
|
59434
|
+
let project;
|
|
59435
|
+
try {
|
|
59436
|
+
project = JSON.parse(readFileSync(path3, "utf8"));
|
|
59437
|
+
} catch {
|
|
59438
|
+
return {};
|
|
59439
|
+
}
|
|
59440
|
+
const fields = {};
|
|
59441
|
+
const set = (key, value) => {
|
|
59442
|
+
const str = asNonEmptyString(value);
|
|
59443
|
+
if (str) {
|
|
59444
|
+
fields[key] = str;
|
|
59445
|
+
}
|
|
59446
|
+
};
|
|
59447
|
+
const projectId = asNonEmptyString(project.projectId);
|
|
59448
|
+
if (projectId) {
|
|
59449
|
+
fields.projectIdHash = identityHash(projectId);
|
|
59450
|
+
const noDash = projectId.trim().toLowerCase().replaceAll("-", "");
|
|
59451
|
+
if (/^[0-9a-f]{32}$/.test(noDash)) {
|
|
59452
|
+
fields.projectIdNoDash = noDash;
|
|
59453
|
+
}
|
|
59454
|
+
}
|
|
59455
|
+
set("targetFramework", project.targetFramework);
|
|
59456
|
+
set("expressionLanguage", project.expressionLanguage);
|
|
59457
|
+
set("projectType", project.designOptions?.outputType);
|
|
59458
|
+
set("projectVersion", project.projectVersion);
|
|
59459
|
+
return fields;
|
|
59460
|
+
}
|
|
59461
|
+
function buildStudioShapedProps(projectDir, extra) {
|
|
59462
|
+
const fields = projectDir ? readProjectFields(projectDir) : {};
|
|
59463
|
+
return {
|
|
59464
|
+
source: TELEMETRY_SOURCE,
|
|
59465
|
+
...getAuthoringSessionProps(),
|
|
59466
|
+
...fields,
|
|
59467
|
+
...extra
|
|
59468
|
+
};
|
|
59469
|
+
}
|
|
59470
|
+
|
|
59471
|
+
// src/telemetry/analyze-result-telemetry.ts
|
|
59472
|
+
function emitAnalyzeResult(projectDir, action, counts, ruleIds) {
|
|
59473
|
+
try {
|
|
59474
|
+
const topRuleIds = [...new Set(ruleIds)].slice(0, 10).join(",");
|
|
59475
|
+
telemetry.trackEvent("uip.rpa.analyze.result", redactProperties({
|
|
59476
|
+
...buildStudioShapedProps(projectDir, { action }),
|
|
59477
|
+
errorCount: String(counts.errorCount),
|
|
59478
|
+
...counts.findingCount !== undefined ? { findingCount: String(counts.findingCount) } : {},
|
|
59479
|
+
...counts.warningCount !== undefined ? { warningCount: String(counts.warningCount) } : {},
|
|
59480
|
+
...counts.infoCount !== undefined ? { infoCount: String(counts.infoCount) } : {},
|
|
59481
|
+
...topRuleIds ? { topRuleIds } : {}
|
|
59482
|
+
}));
|
|
59483
|
+
} catch {}
|
|
59484
|
+
}
|
|
59485
|
+
var ANALYZER_ERROR_LINE = /\bAnalyzer error: ([A-Z]+-[A-Z]+-\d+)\b/g;
|
|
59486
|
+
function parseAnalyzerErrorSummary(message) {
|
|
59487
|
+
if (!message) {
|
|
59488
|
+
return;
|
|
59489
|
+
}
|
|
59490
|
+
const ruleIds = [...message.matchAll(ANALYZER_ERROR_LINE)].map((match) => match[1]);
|
|
59491
|
+
if (ruleIds.length === 0) {
|
|
59492
|
+
return;
|
|
59493
|
+
}
|
|
59494
|
+
return { errorCount: ruleIds.length, ruleIds };
|
|
59495
|
+
}
|
|
59496
|
+
|
|
59497
|
+
// src/telemetry/project-shape.ts
|
|
59498
|
+
import { readdirSync as readdirSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
59499
|
+
import { dirname as dirname2, join as join4 } from "node:path";
|
|
59500
|
+
var MAX_FILES = 500;
|
|
59501
|
+
var MAX_WALK_MS = 50;
|
|
59502
|
+
var SKIP_DIRS = new Set(["obj", "bin", "node_modules"]);
|
|
59503
|
+
function countActivities(xamlPath) {
|
|
59504
|
+
try {
|
|
59505
|
+
const matches = readFileSync2(xamlPath, "utf8").match(/WorkflowViewState\.IdRef=/g);
|
|
59506
|
+
return matches ? matches.length : 0;
|
|
59507
|
+
} catch {
|
|
59508
|
+
return 0;
|
|
59509
|
+
}
|
|
59510
|
+
}
|
|
59511
|
+
function isTestCaseEntry(entry) {
|
|
59512
|
+
if (typeof entry !== "object" || entry === null) {
|
|
59513
|
+
return false;
|
|
59514
|
+
}
|
|
59515
|
+
const record = entry;
|
|
59516
|
+
if (record.isTestCase === true) {
|
|
59517
|
+
return true;
|
|
59518
|
+
}
|
|
59519
|
+
if (typeof record.testCaseId === "string" && record.testCaseId.length > 0) {
|
|
59520
|
+
return true;
|
|
59521
|
+
}
|
|
59522
|
+
for (const key of ["testCaseType", "editorType", "fileType", "type"]) {
|
|
59523
|
+
const value = record[key];
|
|
59524
|
+
if (typeof value === "string" && /test/i.test(value)) {
|
|
59525
|
+
return true;
|
|
59526
|
+
}
|
|
59527
|
+
}
|
|
59528
|
+
return false;
|
|
59529
|
+
}
|
|
59530
|
+
function readManifestCounts(jsonPath) {
|
|
59531
|
+
const counts = {};
|
|
59532
|
+
let project;
|
|
59533
|
+
try {
|
|
59534
|
+
project = JSON.parse(readFileSync2(jsonPath, "utf8"));
|
|
59535
|
+
} catch {
|
|
59536
|
+
return counts;
|
|
59537
|
+
}
|
|
59538
|
+
if (project.dependencies && typeof project.dependencies === "object") {
|
|
59539
|
+
counts.dependencyCount = String(Object.keys(project.dependencies).length);
|
|
59540
|
+
}
|
|
59541
|
+
if (Array.isArray(project.entryPoints)) {
|
|
59542
|
+
counts.entryPointCount = String(project.entryPoints.length);
|
|
59543
|
+
}
|
|
59544
|
+
const fileInfo = project.designOptions?.fileInfoCollection;
|
|
59545
|
+
if (Array.isArray(fileInfo)) {
|
|
59546
|
+
counts.testCaseCount = String(fileInfo.filter(isTestCaseEntry).length);
|
|
59547
|
+
}
|
|
59548
|
+
return counts;
|
|
59549
|
+
}
|
|
59550
|
+
function getProjectShapeProps(projectDirInput) {
|
|
59551
|
+
if (!projectDirInput) {
|
|
59552
|
+
return {};
|
|
59553
|
+
}
|
|
59554
|
+
const jsonPath = resolveProjectJsonPath(projectDirInput);
|
|
59555
|
+
if (!jsonPath) {
|
|
59556
|
+
return {};
|
|
59557
|
+
}
|
|
59558
|
+
const projectDir = dirname2(jsonPath);
|
|
59559
|
+
const shape = readManifestCounts(jsonPath);
|
|
59560
|
+
let fileCount = 0;
|
|
59561
|
+
let workflowCount = 0;
|
|
59562
|
+
let codedWorkflowCount = 0;
|
|
59563
|
+
let activityCount = 0;
|
|
59564
|
+
let truncated = false;
|
|
59565
|
+
const start = performance.now();
|
|
59566
|
+
const stack = [projectDir];
|
|
59567
|
+
while (stack.length > 0 && !truncated) {
|
|
59568
|
+
const dir = stack.pop();
|
|
59569
|
+
if (dir === undefined) {
|
|
59570
|
+
break;
|
|
59571
|
+
}
|
|
59572
|
+
let entries;
|
|
59573
|
+
try {
|
|
59574
|
+
entries = readdirSync2(dir, { withFileTypes: true });
|
|
59575
|
+
} catch {
|
|
59576
|
+
continue;
|
|
59577
|
+
}
|
|
59578
|
+
for (const entry of entries) {
|
|
59579
|
+
if (fileCount >= MAX_FILES || performance.now() - start > MAX_WALK_MS) {
|
|
59580
|
+
truncated = true;
|
|
59581
|
+
break;
|
|
59582
|
+
}
|
|
59583
|
+
if (entry.isDirectory()) {
|
|
59584
|
+
if (!entry.name.startsWith(".") && !SKIP_DIRS.has(entry.name)) {
|
|
59585
|
+
stack.push(join4(dir, entry.name));
|
|
59586
|
+
}
|
|
59587
|
+
continue;
|
|
59588
|
+
}
|
|
59589
|
+
if (!entry.isFile()) {
|
|
59590
|
+
continue;
|
|
59591
|
+
}
|
|
59592
|
+
fileCount++;
|
|
59593
|
+
const lower2 = entry.name.toLowerCase();
|
|
59594
|
+
if (lower2.endsWith(".xaml")) {
|
|
59595
|
+
workflowCount++;
|
|
59596
|
+
activityCount += countActivities(join4(dir, entry.name));
|
|
59597
|
+
} else if (lower2.endsWith(".cs")) {
|
|
59598
|
+
codedWorkflowCount++;
|
|
59599
|
+
}
|
|
59600
|
+
}
|
|
59601
|
+
}
|
|
59602
|
+
shape.fileCount = String(fileCount);
|
|
59603
|
+
shape.workflowCount = String(workflowCount);
|
|
59604
|
+
shape.codedWorkflowCount = String(codedWorkflowCount);
|
|
59605
|
+
shape.activityCount = String(activityCount);
|
|
59606
|
+
if (truncated) {
|
|
59607
|
+
shape.shapeTruncated = "true";
|
|
59608
|
+
}
|
|
59609
|
+
return shape;
|
|
59610
|
+
}
|
|
59374
59611
|
|
|
59375
59612
|
// src/commands/packager/packager-shared.ts
|
|
59376
59613
|
import {
|
|
59377
59614
|
mkdtempSync as mkdtempSync2,
|
|
59378
|
-
readFileSync as
|
|
59615
|
+
readFileSync as readFileSync4,
|
|
59379
59616
|
rmSync as rmSync2,
|
|
59380
|
-
statSync,
|
|
59617
|
+
statSync as statSync2,
|
|
59381
59618
|
writeFileSync as writeFileSync2
|
|
59382
59619
|
} from "node:fs";
|
|
59383
59620
|
import { tmpdir as tmpdir7 } from "node:os";
|
|
59384
|
-
import { basename as
|
|
59621
|
+
import { basename as basename6, dirname as dirname6, join as join10, resolve as resolve6 } from "node:path";
|
|
59385
59622
|
|
|
59386
59623
|
// src/load-packager-tool.ts
|
|
59387
59624
|
async function loadPackagerTool() {
|
|
@@ -59401,7 +59638,7 @@ async function loadPackagerTool() {
|
|
|
59401
59638
|
// src/resolution/orchestrator-restore-feeds.ts
|
|
59402
59639
|
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
59403
59640
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
59404
|
-
import { join as
|
|
59641
|
+
import { join as join6 } from "node:path";
|
|
59405
59642
|
var ORCHESTRATOR_RESTORE_FEEDS_ENV = "UIPATH_ORCHESTRATOR_RESTORE_FEEDS";
|
|
59406
59643
|
var FEEDS_TIMEOUT_MS = 1e4;
|
|
59407
59644
|
var LIBRARIES_PURPOSE = "Libraries";
|
|
@@ -59452,8 +59689,8 @@ async function fetchLibraryFeeds(orchestratorUrl, accessToken, tenantId, log) {
|
|
|
59452
59689
|
return feeds.filter((f) => f.purpose === LIBRARIES_PURPOSE && !!f.feedUrl).map((f) => ({ Url: f.feedUrl, AccessToken: accessToken }));
|
|
59453
59690
|
}
|
|
59454
59691
|
function writeFeedsFile(feeds) {
|
|
59455
|
-
const dir = mkdtempSync(
|
|
59456
|
-
const path4 =
|
|
59692
|
+
const dir = mkdtempSync(join6(tmpdir4(), "uip-rpa-feeds-"));
|
|
59693
|
+
const path4 = join6(dir, "nuget-feeds.json");
|
|
59457
59694
|
writeFileSync(path4, JSON.stringify(feeds));
|
|
59458
59695
|
process.on("exit", () => {
|
|
59459
59696
|
try {
|
|
@@ -59464,11 +59701,11 @@ function writeFeedsFile(feeds) {
|
|
|
59464
59701
|
}
|
|
59465
59702
|
|
|
59466
59703
|
// src/resolution/robot-bin-resolver.ts
|
|
59467
|
-
import { join as
|
|
59704
|
+
import { join as join7, posix, win32 } from "node:path";
|
|
59468
59705
|
|
|
59469
59706
|
// src/resolution/resolver-deps.ts
|
|
59470
59707
|
import { execFileSync as execFileSync5, spawn } from "node:child_process";
|
|
59471
|
-
import { existsSync as existsSync3, readdirSync as
|
|
59708
|
+
import { existsSync as existsSync3, readdirSync as readdirSync3, readFileSync as readFileSync3 } from "node:fs";
|
|
59472
59709
|
import { createRequire as createRequire4 } from "node:module";
|
|
59473
59710
|
|
|
59474
59711
|
// src/ipc/IpcCall.ts
|
|
@@ -60087,7 +60324,7 @@ class IpcCall {
|
|
|
60087
60324
|
const call = operation(this.proxy, this.ict);
|
|
60088
60325
|
if (this.timeoutMs == null)
|
|
60089
60326
|
return call;
|
|
60090
|
-
return new Promise((
|
|
60327
|
+
return new Promise((resolve4, reject) => {
|
|
60091
60328
|
let settled = false;
|
|
60092
60329
|
const timer = setTimeout(() => {
|
|
60093
60330
|
if (settled)
|
|
@@ -60100,7 +60337,7 @@ class IpcCall {
|
|
|
60100
60337
|
if (!settled) {
|
|
60101
60338
|
settled = true;
|
|
60102
60339
|
clearTimeout(timer);
|
|
60103
|
-
|
|
60340
|
+
resolve4(val);
|
|
60104
60341
|
}
|
|
60105
60342
|
}, (err) => {
|
|
60106
60343
|
if (!settled) {
|
|
@@ -60357,10 +60594,10 @@ var defaultResolverDeps = {
|
|
|
60357
60594
|
return existsSync3(path4);
|
|
60358
60595
|
},
|
|
60359
60596
|
readFile(path4) {
|
|
60360
|
-
return
|
|
60597
|
+
return readFileSync3(path4, "utf-8");
|
|
60361
60598
|
},
|
|
60362
60599
|
readDir(path4) {
|
|
60363
|
-
return
|
|
60600
|
+
return readdirSync3(path4);
|
|
60364
60601
|
},
|
|
60365
60602
|
resolveModule(specifier) {
|
|
60366
60603
|
return createRequire4(import.meta.url).resolve(specifier);
|
|
@@ -60382,7 +60619,7 @@ var defaultResolverDeps = {
|
|
|
60382
60619
|
child.unref();
|
|
60383
60620
|
},
|
|
60384
60621
|
sleep(ms) {
|
|
60385
|
-
return new Promise((
|
|
60622
|
+
return new Promise((resolve4) => setTimeout(resolve4, ms));
|
|
60386
60623
|
},
|
|
60387
60624
|
log(_message) {},
|
|
60388
60625
|
fetchFeatures(pipeName) {
|
|
@@ -60409,7 +60646,7 @@ var HELM_EXE = process.platform === "win32" ? "UiPath.Studio.Helm.exe" : "UiPath
|
|
|
60409
60646
|
// src/resolution/robot-bin-resolver.ts
|
|
60410
60647
|
var LOCAL_ROBOT_FEEDS_ENV = "UIPATH_LOCAL_ROBOT_FEEDS";
|
|
60411
60648
|
function robotNugetConfigPath(robotDir) {
|
|
60412
|
-
return
|
|
60649
|
+
return join7(robotDir, "NuGet.config");
|
|
60413
60650
|
}
|
|
60414
60651
|
var ROBOT_WINDOWS_MARKER = "UiRobot.exe";
|
|
60415
60652
|
var ROBOT_MACOS_MARKER = "UiRobot.dll";
|
|
@@ -60477,7 +60714,7 @@ var MIN_BUNDLED_DOTNET_MAJOR = 8;
|
|
|
60477
60714
|
function detectDotnetRuntimeMajor(dotnetRoot, deps) {
|
|
60478
60715
|
let entries;
|
|
60479
60716
|
try {
|
|
60480
|
-
entries = deps.readDir(
|
|
60717
|
+
entries = deps.readDir(join7(dotnetRoot, "shared", "Microsoft.NETCore.App"));
|
|
60481
60718
|
} catch {
|
|
60482
60719
|
return;
|
|
60483
60720
|
}
|
|
@@ -60496,10 +60733,10 @@ function detectDotnetRuntimeMajor(dotnetRoot, deps) {
|
|
|
60496
60733
|
function resolveBundledDotnet(robotDir, deps) {
|
|
60497
60734
|
if (!robotDir)
|
|
60498
60735
|
return;
|
|
60499
|
-
const exePath = process.platform === "win32" ?
|
|
60736
|
+
const exePath = process.platform === "win32" ? join7(robotDir, "dotnet.exe") : join7(robotDir, "dotnet", "dotnet");
|
|
60500
60737
|
if (!deps.fileExists(exePath))
|
|
60501
60738
|
return;
|
|
60502
|
-
const dotnetRoot = process.platform === "win32" ? robotDir :
|
|
60739
|
+
const dotnetRoot = process.platform === "win32" ? robotDir : join7(robotDir, "dotnet");
|
|
60503
60740
|
const runtimeMajor = detectDotnetRuntimeMajor(dotnetRoot, deps);
|
|
60504
60741
|
if (runtimeMajor === undefined || runtimeMajor < MIN_BUNDLED_DOTNET_MAJOR) {
|
|
60505
60742
|
const reason = runtimeMajor === undefined ? "could not determine its .NET runtime version" : `highest .NET runtime major ${runtimeMajor} is below the required ${MIN_BUNDLED_DOTNET_MAJOR}`;
|
|
@@ -60570,6 +60807,59 @@ async function resolveSessionConnection() {
|
|
|
60570
60807
|
}
|
|
60571
60808
|
}
|
|
60572
60809
|
|
|
60810
|
+
// src/telemetry/failure-classification.ts
|
|
60811
|
+
var NUGET_MISSING = /\bNU110[12]\b/;
|
|
60812
|
+
var COMPILER_DIAGNOSTIC = /\b(?:CS|BC)[0-9]{3,5}\b/;
|
|
60813
|
+
var COMPILER_PROJECT_INVALID_CODES = new Set(["4", "5", "7"]);
|
|
60814
|
+
function classifyFailure(signal) {
|
|
60815
|
+
if (signal.exitCode === 130) {
|
|
60816
|
+
return "user_cancelled";
|
|
60817
|
+
}
|
|
60818
|
+
if (signal.isFileLock || signal.errorCode === "permission_denied") {
|
|
60819
|
+
return "internal";
|
|
60820
|
+
}
|
|
60821
|
+
if (signal.errorCode !== undefined && COMPILER_PROJECT_INVALID_CODES.has(signal.errorCode)) {
|
|
60822
|
+
return "validation";
|
|
60823
|
+
}
|
|
60824
|
+
const codes = `${signal.errorCode ?? ""} ${signal.message ?? ""}`;
|
|
60825
|
+
if (NUGET_MISSING.test(codes)) {
|
|
60826
|
+
return "missing_dependency";
|
|
60827
|
+
}
|
|
60828
|
+
if (COMPILER_DIAGNOSTIC.test(codes)) {
|
|
60829
|
+
return "validation";
|
|
60830
|
+
}
|
|
60831
|
+
return "unknown";
|
|
60832
|
+
}
|
|
60833
|
+
function extractRunExceptionType(rawResult) {
|
|
60834
|
+
let parsed;
|
|
60835
|
+
try {
|
|
60836
|
+
parsed = JSON.parse(rawResult);
|
|
60837
|
+
} catch {
|
|
60838
|
+
return;
|
|
60839
|
+
}
|
|
60840
|
+
if (typeof parsed !== "object" || parsed === null) {
|
|
60841
|
+
return;
|
|
60842
|
+
}
|
|
60843
|
+
const record = parsed;
|
|
60844
|
+
const direct = asTypeName(record.ExceptionType ?? record.exceptionType);
|
|
60845
|
+
if (direct) {
|
|
60846
|
+
return direct;
|
|
60847
|
+
}
|
|
60848
|
+
const debugDetails = record.DebugDetails ?? record.debugDetails;
|
|
60849
|
+
if (typeof debugDetails === "string") {
|
|
60850
|
+
try {
|
|
60851
|
+
const details = JSON.parse(debugDetails);
|
|
60852
|
+
return asTypeName(details.ExceptionType ?? details.exceptionType);
|
|
60853
|
+
} catch {
|
|
60854
|
+
return;
|
|
60855
|
+
}
|
|
60856
|
+
}
|
|
60857
|
+
return;
|
|
60858
|
+
}
|
|
60859
|
+
function asTypeName(value) {
|
|
60860
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
60861
|
+
}
|
|
60862
|
+
|
|
60573
60863
|
// src/commands/packager/packager-shared.ts
|
|
60574
60864
|
var LOG_LEVEL_NAMES = ["Debug", "Info", "Warn", "Error"];
|
|
60575
60865
|
var GOVERNANCE_FILE_TYPES = ["Default", "AutomationOps", "Studio"];
|
|
@@ -60608,23 +60898,30 @@ async function buildBaseOptions(opts) {
|
|
|
60608
60898
|
}
|
|
60609
60899
|
return options;
|
|
60610
60900
|
}
|
|
60901
|
+
function emitAnalyzerFailureResult(projectDir, action, result) {
|
|
60902
|
+
const summary = parseAnalyzerErrorSummary(result.message);
|
|
60903
|
+
if (!summary) {
|
|
60904
|
+
return;
|
|
60905
|
+
}
|
|
60906
|
+
emitAnalyzeResult(projectDir, action, { errorCount: summary.errorCount }, summary.ruleIds);
|
|
60907
|
+
}
|
|
60611
60908
|
function resolveProjectInput(projectDir) {
|
|
60612
|
-
const abs =
|
|
60909
|
+
const abs = resolve6(projectDir);
|
|
60613
60910
|
let stats;
|
|
60614
60911
|
try {
|
|
60615
|
-
stats =
|
|
60912
|
+
stats = statSync2(abs);
|
|
60616
60913
|
} catch {
|
|
60617
60914
|
return abs;
|
|
60618
60915
|
}
|
|
60619
60916
|
if (!stats.isFile()) {
|
|
60620
60917
|
return abs;
|
|
60621
60918
|
}
|
|
60622
|
-
const fileName =
|
|
60919
|
+
const fileName = basename6(abs).toLowerCase();
|
|
60623
60920
|
if (fileName === "project.json") {
|
|
60624
|
-
return
|
|
60921
|
+
return dirname6(abs);
|
|
60625
60922
|
}
|
|
60626
60923
|
if (fileName.endsWith(".uip")) {
|
|
60627
|
-
return new Uint8Array(
|
|
60924
|
+
return new Uint8Array(readFileSync4(abs));
|
|
60628
60925
|
}
|
|
60629
60926
|
throw new Error(`Unsupported project input: ${abs}. Provide a project directory, project.json file, or .uip archive.`);
|
|
60630
60927
|
}
|
|
@@ -60632,8 +60929,8 @@ function createTemporaryFeedsConfig(feeds) {
|
|
|
60632
60929
|
if (feeds.length === 0) {
|
|
60633
60930
|
return;
|
|
60634
60931
|
}
|
|
60635
|
-
const directory = mkdtempSync2(
|
|
60636
|
-
const path4 =
|
|
60932
|
+
const directory = mkdtempSync2(join10(tmpdir7(), "rpa-tool-nuget-"));
|
|
60933
|
+
const path4 = join10(directory, "nuget-feeds.json");
|
|
60637
60934
|
try {
|
|
60638
60935
|
writeFileSync2(path4, JSON.stringify(feeds));
|
|
60639
60936
|
} catch (error) {
|
|
@@ -60654,7 +60951,7 @@ function cleanupTemporaryFeedsConfig(config) {
|
|
|
60654
60951
|
function readFeedSourcesFromFile(path4) {
|
|
60655
60952
|
let raw;
|
|
60656
60953
|
try {
|
|
60657
|
-
raw =
|
|
60954
|
+
raw = readFileSync4(path4, "utf8");
|
|
60658
60955
|
} catch {
|
|
60659
60956
|
return null;
|
|
60660
60957
|
}
|
|
@@ -60717,7 +61014,7 @@ async function runPackagerCommand(opts, config) {
|
|
|
60717
61014
|
OutputFormatter.error(new FailureOutput("Failure", `${config.label} failed: project directory must not be empty.`, config.hint));
|
|
60718
61015
|
return false;
|
|
60719
61016
|
}
|
|
60720
|
-
const projectDir =
|
|
61017
|
+
const projectDir = resolve6(rawProjectDir);
|
|
60721
61018
|
opts = { ...opts, projectDir };
|
|
60722
61019
|
const LOGGER_LEVELS = {
|
|
60723
61020
|
Debug: LogLevel.DEBUG,
|
|
@@ -60753,12 +61050,28 @@ async function runPackagerCommand(opts, config) {
|
|
|
60753
61050
|
OutputFormatter.success(new SuccessOutput(config.label, data));
|
|
60754
61051
|
return true;
|
|
60755
61052
|
}
|
|
61053
|
+
try {
|
|
61054
|
+
await config.onFailure?.(result);
|
|
61055
|
+
} catch {}
|
|
60756
61056
|
const rawFailure = result.message ?? (result.errorCode ? `Error code: ${result.errorCode}` : "Unknown error");
|
|
60757
|
-
|
|
61057
|
+
const lockFailure = detectLockedProjectFilesFailure(config.label, rawFailure);
|
|
61058
|
+
const failure = lockFailure ?? new FailureOutput("Failure", `${config.label} failed: ${rawFailure}`, config.hint);
|
|
61059
|
+
failure.TelemetryErrorClass = classifyFailure({
|
|
61060
|
+
errorCode: result.errorCode,
|
|
61061
|
+
message: rawFailure,
|
|
61062
|
+
isFileLock: lockFailure !== null
|
|
61063
|
+
});
|
|
61064
|
+
OutputFormatter.error(failure);
|
|
60758
61065
|
return false;
|
|
60759
61066
|
} catch (error) {
|
|
60760
61067
|
const rawFailure = error instanceof Error ? error.message : String(error);
|
|
60761
|
-
|
|
61068
|
+
const lockFailure = detectLockedProjectFilesFailure(config.label, rawFailure);
|
|
61069
|
+
const failure = lockFailure ?? new FailureOutput("Failure", `${config.label} failed: ${rawFailure}`, config.hint);
|
|
61070
|
+
failure.TelemetryErrorClass = classifyFailure({
|
|
61071
|
+
message: rawFailure,
|
|
61072
|
+
isFileLock: lockFailure !== null
|
|
61073
|
+
});
|
|
61074
|
+
OutputFormatter.error(failure);
|
|
60762
61075
|
return false;
|
|
60763
61076
|
} finally {
|
|
60764
61077
|
cleanupTemporaryFeedsConfig(temporaryFeedsConfig);
|
|
@@ -60797,22 +61110,35 @@ function registerAnalyzeCommand(program4) {
|
|
|
60797
61110
|
isSuccessfulResult: (result) => result.isSuccess || extractFindings(result).length > 0,
|
|
60798
61111
|
formatSuccess: (result) => {
|
|
60799
61112
|
const findings = extractFindings(result);
|
|
61113
|
+
const summary = summarizeFindings(findings);
|
|
61114
|
+
emitAnalyzeResult(opts.projectDir, "analyze", {
|
|
61115
|
+
errorCount: summary.Critical + summary.Error,
|
|
61116
|
+
findingCount: findings.length,
|
|
61117
|
+
warningCount: summary.Warning,
|
|
61118
|
+
infoCount: summary.Information + summary.Verbose
|
|
61119
|
+
}, distinctRuleIds(findings));
|
|
60800
61120
|
return {
|
|
60801
61121
|
Success: true,
|
|
60802
|
-
Summary:
|
|
61122
|
+
Summary: summary,
|
|
60803
61123
|
Findings: findings
|
|
60804
61124
|
};
|
|
60805
61125
|
}
|
|
60806
61126
|
});
|
|
60807
61127
|
if (!success)
|
|
60808
61128
|
processContext.exit(1);
|
|
61129
|
+
}, (projectDir, opts) => {
|
|
61130
|
+
const dir = resolveProjectDir(projectDir, opts);
|
|
61131
|
+
return buildStudioShapedProps(dir, {
|
|
61132
|
+
action: "analyze",
|
|
61133
|
+
...getProjectShapeProps(dir)
|
|
61134
|
+
});
|
|
60809
61135
|
});
|
|
60810
61136
|
}
|
|
60811
61137
|
function resolveProjectDir(projectDir, opts) {
|
|
60812
61138
|
if (!opts.repositoryPath || isAbsolute5(projectDir)) {
|
|
60813
61139
|
return projectDir;
|
|
60814
61140
|
}
|
|
60815
|
-
return
|
|
61141
|
+
return join11(opts.repositoryPath, projectDir);
|
|
60816
61142
|
}
|
|
60817
61143
|
function resolveGovernanceFileType(opts) {
|
|
60818
61144
|
if (opts.policyFileType)
|
|
@@ -60906,6 +61232,16 @@ function summarizeFindings(findings) {
|
|
|
60906
61232
|
}
|
|
60907
61233
|
return summary;
|
|
60908
61234
|
}
|
|
61235
|
+
function distinctRuleIds(findings) {
|
|
61236
|
+
const ids = new Set;
|
|
61237
|
+
for (const finding of findings) {
|
|
61238
|
+
const id = finding.ErrorCode || finding.RuleName;
|
|
61239
|
+
if (id) {
|
|
61240
|
+
ids.add(id);
|
|
61241
|
+
}
|
|
61242
|
+
}
|
|
61243
|
+
return [...ids];
|
|
61244
|
+
}
|
|
60909
61245
|
function normalizeLevel(value) {
|
|
60910
61246
|
switch (value.toLowerCase()) {
|
|
60911
61247
|
case "critical":
|
|
@@ -60960,15 +61296,19 @@ function registerBuildCommand(program4) {
|
|
|
60960
61296
|
options.detailedLogPath = opts2.detailedLogPath;
|
|
60961
61297
|
}
|
|
60962
61298
|
return packager.buildProjectAsync(options);
|
|
60963
|
-
}
|
|
61299
|
+
},
|
|
61300
|
+
onFailure: (result) => emitAnalyzerFailureResult(opts.projectDir, "build", result)
|
|
60964
61301
|
});
|
|
60965
61302
|
if (!success)
|
|
60966
61303
|
processContext.exit(1);
|
|
60967
|
-
})
|
|
61304
|
+
}, (projectDir) => buildStudioShapedProps(projectDir, {
|
|
61305
|
+
action: "build",
|
|
61306
|
+
...getProjectShapeProps(projectDir)
|
|
61307
|
+
}));
|
|
60968
61308
|
}
|
|
60969
61309
|
|
|
60970
61310
|
// src/commands/packager/pack.ts
|
|
60971
|
-
import { isAbsolute as isAbsolute6, resolve as
|
|
61311
|
+
import { isAbsolute as isAbsolute6, resolve as resolve7 } from "node:path";
|
|
60972
61312
|
function registerPackCommand(program4) {
|
|
60973
61313
|
const cmd = program4.command("pack").description("Pack a UiPath project into a .nupkg (compiles, validates, and bundles).");
|
|
60974
61314
|
cmd.argument("<project-dir>", "Path to the UiPath project directory, project.json file, or .uip archive").argument("<output-path>", "Directory where .nupkg is written");
|
|
@@ -61029,6 +61369,7 @@ function registerPackCommand(program4) {
|
|
|
61029
61369
|
const firstPackage = packages[0] ?? "";
|
|
61030
61370
|
const packagePath = firstPackage ? absolutePath(firstPackage) : "";
|
|
61031
61371
|
const packageMetadata = inferPackageMetadata(packagePath, opts.packageVersion);
|
|
61372
|
+
emitPackResult(opts.projectDir, packageMetadata);
|
|
61032
61373
|
return {
|
|
61033
61374
|
Success: true,
|
|
61034
61375
|
Packages: packages,
|
|
@@ -61038,14 +61379,27 @@ function registerPackCommand(program4) {
|
|
|
61038
61379
|
OutputPath: absoluteOutputPath,
|
|
61039
61380
|
OutputType: opts.outputType ?? ""
|
|
61040
61381
|
};
|
|
61041
|
-
}
|
|
61382
|
+
},
|
|
61383
|
+
onFailure: (result) => emitAnalyzerFailureResult(opts.projectDir, "pack", result)
|
|
61042
61384
|
});
|
|
61043
61385
|
if (!success)
|
|
61044
61386
|
processContext.exit(1);
|
|
61045
|
-
})
|
|
61387
|
+
}, (projectDir) => buildStudioShapedProps(projectDir, {
|
|
61388
|
+
action: "pack",
|
|
61389
|
+
...getProjectShapeProps(projectDir)
|
|
61390
|
+
}));
|
|
61046
61391
|
}
|
|
61047
61392
|
function absolutePath(filePath) {
|
|
61048
|
-
return isAbsolute6(filePath) ? filePath :
|
|
61393
|
+
return isAbsolute6(filePath) ? filePath : resolve7(filePath);
|
|
61394
|
+
}
|
|
61395
|
+
function emitPackResult(projectDir, meta) {
|
|
61396
|
+
try {
|
|
61397
|
+
telemetry.trackEvent("uip.rpa.pack.result", redactProperties({
|
|
61398
|
+
...buildStudioShapedProps(projectDir, { action: "pack" }),
|
|
61399
|
+
...meta.packageName ? { packageIdHash: identityHash(meta.packageName) } : {},
|
|
61400
|
+
...meta.packageVersion ? { packageVersion: meta.packageVersion } : {}
|
|
61401
|
+
}));
|
|
61402
|
+
} catch {}
|
|
61049
61403
|
}
|
|
61050
61404
|
function inferPackageMetadata(packagePath, explicitVersion) {
|
|
61051
61405
|
const packageVersion = explicitVersion || inferPackageVersion(packagePath);
|
|
@@ -61075,10 +61429,10 @@ function packageFileStem(packagePath) {
|
|
|
61075
61429
|
// src/commands/packager/restore.ts
|
|
61076
61430
|
import { mkdtempSync as mkdtempSync3 } from "node:fs";
|
|
61077
61431
|
import { tmpdir as tmpdir8 } from "node:os";
|
|
61078
|
-
import { isAbsolute as isAbsolute7, join as
|
|
61432
|
+
import { isAbsolute as isAbsolute7, join as join12, relative as relative5, resolve as resolve8 } from "node:path";
|
|
61079
61433
|
function isWithinOrEqual(parent, candidate) {
|
|
61080
61434
|
const norm = process.platform === "win32" ? (p) => p.toLowerCase() : (p) => p;
|
|
61081
|
-
const rel = relative5(norm(
|
|
61435
|
+
const rel = relative5(norm(resolve8(parent)), norm(resolve8(candidate)));
|
|
61082
61436
|
if (rel === "")
|
|
61083
61437
|
return true;
|
|
61084
61438
|
return !rel.startsWith("..") && !isAbsolute7(rel);
|
|
@@ -61097,7 +61451,7 @@ function registerRestoreCommand(program4) {
|
|
|
61097
61451
|
label: "Restore",
|
|
61098
61452
|
hint: "Check project path and NuGet configuration.",
|
|
61099
61453
|
execute: async (packager, options) => {
|
|
61100
|
-
options.outputPath = outputPath ?? mkdtempSync3(
|
|
61454
|
+
options.outputPath = outputPath ?? mkdtempSync3(join12(tmpdir8(), "rpa-tool-restore-"));
|
|
61101
61455
|
return packager.restoreProjectAsync(options);
|
|
61102
61456
|
}
|
|
61103
61457
|
});
|
|
@@ -61116,7 +61470,7 @@ function kebabToCamel(name) {
|
|
|
61116
61470
|
}
|
|
61117
61471
|
|
|
61118
61472
|
// src/cli/structured-input.ts
|
|
61119
|
-
import { readFileSync as
|
|
61473
|
+
import { readFileSync as readFileSync5 } from "node:fs";
|
|
61120
61474
|
|
|
61121
61475
|
class StructuredInputError extends Error {
|
|
61122
61476
|
constructor(message) {
|
|
@@ -61129,7 +61483,7 @@ var defaultStructuredValueReader = {
|
|
|
61129
61483
|
readText(path4) {
|
|
61130
61484
|
let bytes;
|
|
61131
61485
|
try {
|
|
61132
|
-
bytes =
|
|
61486
|
+
bytes = readFileSync5(path4);
|
|
61133
61487
|
} catch (cause) {
|
|
61134
61488
|
throw new StructuredInputError(`Cannot read file '${path4}': ${cause instanceof Error ? cause.message : String(cause)}. ` + `File paths resolve relative to the current directory.`);
|
|
61135
61489
|
}
|
|
@@ -61954,7 +62308,53 @@ var CLI_DERIVED_COMMANDS = [
|
|
|
61954
62308
|
}
|
|
61955
62309
|
];
|
|
61956
62310
|
|
|
62311
|
+
// src/telemetry/tool-enrichment.ts
|
|
62312
|
+
function asString(value) {
|
|
62313
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
62314
|
+
}
|
|
62315
|
+
function globalProjectDir() {
|
|
62316
|
+
return extractArg(process.argv, "project-dir", process.cwd()) ?? process.cwd();
|
|
62317
|
+
}
|
|
62318
|
+
var TOOL_ENRICHERS = {
|
|
62319
|
+
[ToolName.RunFile]: (opts, lockedCommand) => buildStudioShapedProps(globalProjectDir(), {
|
|
62320
|
+
action: "run",
|
|
62321
|
+
runKind: String(lockedCommand ?? opts.command ?? "StartExecution")
|
|
62322
|
+
}),
|
|
62323
|
+
[ToolName.CreateProject]: (opts) => {
|
|
62324
|
+
const extra = { action: "create" };
|
|
62325
|
+
const targetFramework = asString(opts.targetFramework);
|
|
62326
|
+
if (targetFramework)
|
|
62327
|
+
extra.targetFramework = targetFramework;
|
|
62328
|
+
const expressionLanguage = asString(opts.expressionLanguage);
|
|
62329
|
+
if (expressionLanguage)
|
|
62330
|
+
extra.expressionLanguage = expressionLanguage;
|
|
62331
|
+
const templateId = asString(opts.templateId);
|
|
62332
|
+
if (templateId)
|
|
62333
|
+
extra.templateId = templateId;
|
|
62334
|
+
return buildStudioShapedProps(undefined, extra);
|
|
62335
|
+
},
|
|
62336
|
+
[ToolName.OpenProject]: (opts) => buildStudioShapedProps(asString(opts.projectDir) ?? globalProjectDir(), {
|
|
62337
|
+
action: "handoff-to-studio"
|
|
62338
|
+
}),
|
|
62339
|
+
[ToolName.GetErrors]: () => buildStudioShapedProps(globalProjectDir(), { action: "diagnose" }),
|
|
62340
|
+
[ToolName.InstallOrUpdatePackages]: () => buildStudioShapedProps(globalProjectDir(), {
|
|
62341
|
+
action: "manage-dependencies"
|
|
62342
|
+
})
|
|
62343
|
+
};
|
|
62344
|
+
function hasToolEnricher(toolName) {
|
|
62345
|
+
return Object.hasOwn(TOOL_ENRICHERS, toolName);
|
|
62346
|
+
}
|
|
62347
|
+
function studioShapedPropsForTool(toolName, opts, lockedCommand) {
|
|
62348
|
+
return TOOL_ENRICHERS[toolName]?.(opts, lockedCommand);
|
|
62349
|
+
}
|
|
62350
|
+
|
|
61957
62351
|
// src/commands/register-mcp-commands.ts
|
|
62352
|
+
function studioShapedPropsCallback(toolName, lockedCommand) {
|
|
62353
|
+
if (!hasToolEnricher(toolName)) {
|
|
62354
|
+
return;
|
|
62355
|
+
}
|
|
62356
|
+
return (opts) => studioShapedPropsForTool(toolName, opts, lockedCommand) ?? {};
|
|
62357
|
+
}
|
|
61958
62358
|
async function registerMcpCommands(program4, client) {
|
|
61959
62359
|
const tools = await client.listTools();
|
|
61960
62360
|
const groupCache = new Map;
|
|
@@ -62011,7 +62411,7 @@ function registerDerivedCommand(program4, baseTool, derived, cache, client) {
|
|
|
62011
62411
|
if (output.exitCode !== 0) {
|
|
62012
62412
|
processContext.exit(output.exitCode);
|
|
62013
62413
|
}
|
|
62014
|
-
});
|
|
62414
|
+
}, studioShapedPropsCallback(baseTool.name, derived.lockedArgs.command));
|
|
62015
62415
|
}
|
|
62016
62416
|
function getOrCreateGroup(program4, segments, cache) {
|
|
62017
62417
|
let parent = program4;
|
|
@@ -62054,7 +62454,7 @@ function registerSubcommand(program4, tool, cliCmd, hidden, client) {
|
|
|
62054
62454
|
if (output.exitCode !== 0) {
|
|
62055
62455
|
processContext.exit(output.exitCode);
|
|
62056
62456
|
}
|
|
62057
|
-
});
|
|
62457
|
+
}, studioShapedPropsCallback(tool.name));
|
|
62058
62458
|
}
|
|
62059
62459
|
function applyStructuredArgErrorHint(sub3, flags) {
|
|
62060
62460
|
const structured = flags.filter((f) => f.typeHint === "json" || f.typeHint === "jsonArray");
|
|
@@ -62135,7 +62535,7 @@ function addFlagToCommand(sub3, flag) {
|
|
|
62135
62535
|
}
|
|
62136
62536
|
|
|
62137
62537
|
// src/resolution/helm-npm-resolver.ts
|
|
62138
|
-
import { dirname as
|
|
62538
|
+
import { dirname as dirname7, join as join13 } from "node:path";
|
|
62139
62539
|
function helmPackageName() {
|
|
62140
62540
|
const key = `${process.platform}-${process.arch}`;
|
|
62141
62541
|
switch (key) {
|
|
@@ -62158,7 +62558,7 @@ function helmPackageName() {
|
|
|
62158
62558
|
function resolveHelmFromNpm(deps) {
|
|
62159
62559
|
const localDir = process.env.HELM_LOCAL_DIR;
|
|
62160
62560
|
if (localDir) {
|
|
62161
|
-
const helmExePath2 =
|
|
62561
|
+
const helmExePath2 = join13(localDir, HELM_EXE);
|
|
62162
62562
|
if (deps.fileExists(helmExePath2)) {
|
|
62163
62563
|
deps.log(`Using local Helm from HELM_LOCAL_DIR: ${localDir}`);
|
|
62164
62564
|
return { toolsDir: localDir, helmExePath: helmExePath2 };
|
|
@@ -62174,8 +62574,8 @@ function resolveHelmFromNpm(deps) {
|
|
|
62174
62574
|
const detail = err2 instanceof Error ? err2.message : String(err2);
|
|
62175
62575
|
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})`);
|
|
62176
62576
|
}
|
|
62177
|
-
const toolsDir =
|
|
62178
|
-
const helmExePath =
|
|
62577
|
+
const toolsDir = join13(dirname7(packageJsonPath), "tools");
|
|
62578
|
+
const helmExePath = join13(toolsDir, HELM_EXE);
|
|
62179
62579
|
if (!deps.fileExists(helmExePath)) {
|
|
62180
62580
|
throw new Error(`Helm binary not found at ${helmExePath} inside package ` + `'${packageName}'. The package may be corrupt or incomplete.`);
|
|
62181
62581
|
}
|
|
@@ -62218,17 +62618,17 @@ import {
|
|
|
62218
62618
|
existsSync as existsSync6,
|
|
62219
62619
|
mkdirSync as mkdirSync2,
|
|
62220
62620
|
openSync as openSync2,
|
|
62221
|
-
readdirSync as
|
|
62222
|
-
readFileSync as
|
|
62621
|
+
readdirSync as readdirSync4,
|
|
62622
|
+
readFileSync as readFileSync6,
|
|
62223
62623
|
renameSync,
|
|
62224
62624
|
rmSync as rmSync3,
|
|
62225
|
-
statSync as
|
|
62625
|
+
statSync as statSync3,
|
|
62226
62626
|
unlinkSync as unlinkSync2,
|
|
62227
62627
|
utimesSync,
|
|
62228
62628
|
writeSync
|
|
62229
62629
|
} from "node:fs";
|
|
62230
62630
|
import { homedir as homedir5 } from "node:os";
|
|
62231
|
-
import { join as
|
|
62631
|
+
import { join as join14 } from "node:path";
|
|
62232
62632
|
var DEFAULT_MAX_SLOTS = 3;
|
|
62233
62633
|
var READY_MARKER = ".ready";
|
|
62234
62634
|
var STAGING_DIR = ".staging";
|
|
@@ -62242,20 +62642,20 @@ function resolveHelmCacheRoot() {
|
|
|
62242
62642
|
if (override)
|
|
62243
62643
|
return override;
|
|
62244
62644
|
if (process.platform === "win32") {
|
|
62245
|
-
const base = process.env.LOCALAPPDATA ??
|
|
62246
|
-
return
|
|
62645
|
+
const base = process.env.LOCALAPPDATA ?? join14(homedir5(), "AppData", "Local");
|
|
62646
|
+
return join14(base, "UiPath", "Helm");
|
|
62247
62647
|
}
|
|
62248
62648
|
if (process.platform === "darwin") {
|
|
62249
|
-
return
|
|
62649
|
+
return join14(homedir5(), "Library", "Caches", "UiPath", "Helm");
|
|
62250
62650
|
}
|
|
62251
|
-
const xdg = process.env.XDG_CACHE_HOME ??
|
|
62252
|
-
return
|
|
62651
|
+
const xdg = process.env.XDG_CACHE_HOME ?? join14(homedir5(), ".cache");
|
|
62652
|
+
return join14(xdg, "uipath", "helm");
|
|
62253
62653
|
}
|
|
62254
62654
|
function slotName(version) {
|
|
62255
62655
|
return version.replace(/[\\/]/g, "_");
|
|
62256
62656
|
}
|
|
62257
62657
|
function helmSlotDir(root, version) {
|
|
62258
|
-
return
|
|
62658
|
+
return join14(root, slotName(version));
|
|
62259
62659
|
}
|
|
62260
62660
|
function touch(path4) {
|
|
62261
62661
|
try {
|
|
@@ -62271,7 +62671,7 @@ function tryAcquireLock(lockPath, log) {
|
|
|
62271
62671
|
return true;
|
|
62272
62672
|
} catch {
|
|
62273
62673
|
try {
|
|
62274
|
-
const raw =
|
|
62674
|
+
const raw = readFileSync6(lockPath, "utf-8");
|
|
62275
62675
|
const { pid, ts } = JSON.parse(raw);
|
|
62276
62676
|
const dead = typeof pid === "number" && !isProcessAlive(pid);
|
|
62277
62677
|
const old = typeof ts === "number" && Date.now() - ts > STALE_LOCK_MS;
|
|
@@ -62290,14 +62690,14 @@ function releaseLock(lockPath) {
|
|
|
62290
62690
|
} catch {}
|
|
62291
62691
|
}
|
|
62292
62692
|
function publishSlot(sourceToolsDir, slot, root, version, log) {
|
|
62293
|
-
const stagingRoot =
|
|
62693
|
+
const stagingRoot = join14(root, STAGING_DIR);
|
|
62294
62694
|
mkdirSync2(stagingRoot, { recursive: true });
|
|
62295
|
-
const staging =
|
|
62695
|
+
const staging = join14(stagingRoot, `${slotName(version)}-${process.pid}-${Date.now().toString(36)}`);
|
|
62296
62696
|
rmSync3(staging, { recursive: true, force: true });
|
|
62297
62697
|
log(`Materializing Helm slot ${slot} from ${sourceToolsDir}`);
|
|
62298
62698
|
cpSync(sourceToolsDir, staging, { recursive: true });
|
|
62299
62699
|
const now = new Date;
|
|
62300
|
-
const markerFd = openSync2(
|
|
62700
|
+
const markerFd = openSync2(join14(staging, READY_MARKER), "w");
|
|
62301
62701
|
writeSync(markerFd, now.getTime().toString());
|
|
62302
62702
|
closeSync2(markerFd);
|
|
62303
62703
|
rmSync3(slot, { recursive: true, force: true });
|
|
@@ -62308,14 +62708,14 @@ function publishSlot(sourceToolsDir, slot, root, version, log) {
|
|
|
62308
62708
|
}
|
|
62309
62709
|
}
|
|
62310
62710
|
function evictSlots(root, targetSlot, liveBinDirs, maxSlots, log) {
|
|
62311
|
-
const entries =
|
|
62711
|
+
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)));
|
|
62312
62712
|
if (entries.length <= maxSlots)
|
|
62313
62713
|
return;
|
|
62314
62714
|
const targetNorm = normalizePath(targetSlot);
|
|
62315
62715
|
const now = Date.now();
|
|
62316
62716
|
const readyMtime = (dir) => {
|
|
62317
62717
|
try {
|
|
62318
|
-
return
|
|
62718
|
+
return statSync3(join14(dir, READY_MARKER)).mtimeMs;
|
|
62319
62719
|
} catch {
|
|
62320
62720
|
return 0;
|
|
62321
62721
|
}
|
|
@@ -62340,20 +62740,20 @@ function evictSlots(root, targetSlot, liveBinDirs, maxSlots, log) {
|
|
|
62340
62740
|
}
|
|
62341
62741
|
}
|
|
62342
62742
|
function cleanupStale(root) {
|
|
62343
|
-
const stagingRoot =
|
|
62743
|
+
const stagingRoot = join14(root, STAGING_DIR);
|
|
62344
62744
|
let entries;
|
|
62345
62745
|
try {
|
|
62346
|
-
entries =
|
|
62746
|
+
entries = readdirSync4(stagingRoot);
|
|
62347
62747
|
} catch {
|
|
62348
62748
|
return;
|
|
62349
62749
|
}
|
|
62350
62750
|
const now = Date.now();
|
|
62351
62751
|
for (const name of entries) {
|
|
62352
|
-
const dir =
|
|
62752
|
+
const dir = join14(stagingRoot, name);
|
|
62353
62753
|
const parts = name.split("-");
|
|
62354
62754
|
const pid = Number.parseInt(parts[parts.length - 2] ?? "", 10);
|
|
62355
62755
|
try {
|
|
62356
|
-
const age = now -
|
|
62756
|
+
const age = now - statSync3(dir).mtimeMs;
|
|
62357
62757
|
const ownerDead = Number.isNaN(pid) || !isProcessAlive(pid);
|
|
62358
62758
|
if (ownerDead && age > STALE_STAGING_MS) {
|
|
62359
62759
|
rmSync3(dir, { recursive: true, force: true });
|
|
@@ -62367,14 +62767,14 @@ async function ensureHelmSlot(opts) {
|
|
|
62367
62767
|
const root = opts.cacheRoot ?? resolveHelmCacheRoot();
|
|
62368
62768
|
const maxSlots = opts.maxSlots ?? DEFAULT_MAX_SLOTS;
|
|
62369
62769
|
const slot = helmSlotDir(root, opts.version);
|
|
62370
|
-
const readyPath =
|
|
62770
|
+
const readyPath = join14(slot, READY_MARKER);
|
|
62371
62771
|
const fromSource = () => ({
|
|
62372
62772
|
toolsDir: opts.sourceToolsDir,
|
|
62373
|
-
helmExePath:
|
|
62773
|
+
helmExePath: join14(opts.sourceToolsDir, opts.helmExeName)
|
|
62374
62774
|
});
|
|
62375
62775
|
const fromSlot = () => {
|
|
62376
62776
|
touch(readyPath);
|
|
62377
|
-
return { toolsDir: slot, helmExePath:
|
|
62777
|
+
return { toolsDir: slot, helmExePath: join14(slot, opts.helmExeName) };
|
|
62378
62778
|
};
|
|
62379
62779
|
if (existsSync6(readyPath)) {
|
|
62380
62780
|
log(`Using cached Helm slot: ${slot}`);
|
|
@@ -62386,7 +62786,7 @@ async function ensureHelmSlot(opts) {
|
|
|
62386
62786
|
log(`Cannot create Helm cache root ${root}; running from source.`);
|
|
62387
62787
|
return fromSource();
|
|
62388
62788
|
}
|
|
62389
|
-
const lockPath =
|
|
62789
|
+
const lockPath = join14(root, `${slotName(opts.version)}.lock`);
|
|
62390
62790
|
const deadline = Date.now() + MAX_WAIT_MS;
|
|
62391
62791
|
while (true) {
|
|
62392
62792
|
if (existsSync6(readyPath))
|
|
@@ -62422,7 +62822,7 @@ async function ensureHelmSlot(opts) {
|
|
|
62422
62822
|
}
|
|
62423
62823
|
|
|
62424
62824
|
// src/resolution/studio-bin-resolver.ts
|
|
62425
|
-
import { join as
|
|
62825
|
+
import { join as join15, win32 as win322 } from "node:path";
|
|
62426
62826
|
function getProcessExecutablePath(pid, deps) {
|
|
62427
62827
|
const exePath = deps.executeCommand("powershell", [
|
|
62428
62828
|
"-NoProfile",
|
|
@@ -62517,7 +62917,7 @@ function getStudioFileVersion(binDir, deps) {
|
|
|
62517
62917
|
}
|
|
62518
62918
|
}
|
|
62519
62919
|
function readManifest(binDir, filename, deps) {
|
|
62520
|
-
const manifestPath =
|
|
62920
|
+
const manifestPath = join15(binDir, filename);
|
|
62521
62921
|
try {
|
|
62522
62922
|
const content = deps.readFile(manifestPath);
|
|
62523
62923
|
return JSON.parse(content);
|
|
@@ -62530,7 +62930,7 @@ function readInteropManifest(binDir, deps) {
|
|
|
62530
62930
|
return readManifest(binDir, INTEROP_MANIFEST, deps);
|
|
62531
62931
|
}
|
|
62532
62932
|
function validateInteropSupport(binDir, deps) {
|
|
62533
|
-
const manifestPath =
|
|
62933
|
+
const manifestPath = join15(binDir, INTEROP_MANIFEST);
|
|
62534
62934
|
if (!deps.fileExists(manifestPath)) {
|
|
62535
62935
|
const version = getStudioFileVersion(binDir, deps);
|
|
62536
62936
|
throw new Error(`Studio ${version} does not support rpa-tool. Please upgrade to the latest version of UiPath Studio.`);
|
|
@@ -62538,8 +62938,8 @@ function validateInteropSupport(binDir, deps) {
|
|
|
62538
62938
|
}
|
|
62539
62939
|
|
|
62540
62940
|
// src/resolution/studio-startup.ts
|
|
62541
|
-
import { chmodSync, statSync as
|
|
62542
|
-
import { join as
|
|
62941
|
+
import { chmodSync, statSync as statSync4 } from "node:fs";
|
|
62942
|
+
import { join as join16 } from "node:path";
|
|
62543
62943
|
async function waitForInstanceAvailability(processId, deps, timeoutMs = DEFAULT_TIMEOUT_MS2) {
|
|
62544
62944
|
const deadline = Date.now() + timeoutMs;
|
|
62545
62945
|
let pollCount = 0;
|
|
@@ -62568,7 +62968,7 @@ async function waitForInstanceAvailability(processId, deps, timeoutMs = DEFAULT_
|
|
|
62568
62968
|
async function startStudioAndWait(binDir, deps, timeoutMs = DEFAULT_TIMEOUT_MS2) {
|
|
62569
62969
|
const existingPids = new Set(deps.discoverInstances().instances.map((i2) => i2.processId));
|
|
62570
62970
|
deps.log(`Existing Studio PIDs: [${[...existingPids].join(", ")}]`);
|
|
62571
|
-
const exePath =
|
|
62971
|
+
const exePath = join16(binDir, STUDIO_EXE);
|
|
62572
62972
|
deps.log(`Starting Studio: ${exePath}`);
|
|
62573
62973
|
deps.spawnDetached(exePath, []);
|
|
62574
62974
|
const deadline = Date.now() + timeoutMs;
|
|
@@ -62603,7 +63003,7 @@ function ensureExecutable(exePath, log) {
|
|
|
62603
63003
|
if (process.platform === "win32")
|
|
62604
63004
|
return;
|
|
62605
63005
|
try {
|
|
62606
|
-
chmodSync(exePath,
|
|
63006
|
+
chmodSync(exePath, statSync4(exePath).mode | 73);
|
|
62607
63007
|
} catch (err2) {
|
|
62608
63008
|
log(`Could not set +x on ${exePath}: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
62609
63009
|
}
|
|
@@ -63279,8 +63679,8 @@ function createInterpolator(values) {
|
|
|
63279
63679
|
}
|
|
63280
63680
|
|
|
63281
63681
|
// src/external-cli/discovery.ts
|
|
63282
|
-
import { existsSync as existsSync7, readFileSync as
|
|
63283
|
-
import { join as
|
|
63682
|
+
import { existsSync as existsSync7, readFileSync as readFileSync7 } from "node:fs";
|
|
63683
|
+
import { join as join17 } from "node:path";
|
|
63284
63684
|
|
|
63285
63685
|
class MissingAllDependenciesError extends Error {
|
|
63286
63686
|
projectDir;
|
|
@@ -63312,10 +63712,10 @@ class PackageRootMissingError extends Error {
|
|
|
63312
63712
|
}
|
|
63313
63713
|
var defaultDeps = {
|
|
63314
63714
|
fileExists: existsSync7,
|
|
63315
|
-
readFile: (path4) =>
|
|
63715
|
+
readFile: (path4) => readFileSync7(path4, "utf-8")
|
|
63316
63716
|
};
|
|
63317
63717
|
function discoverPackageRoot(params, deps = defaultDeps) {
|
|
63318
|
-
const depsFile =
|
|
63718
|
+
const depsFile = join17(params.projectDir, ".local", "AllDependencies.json");
|
|
63319
63719
|
if (!deps.fileExists(depsFile)) {
|
|
63320
63720
|
throw new MissingAllDependenciesError(params.projectDir, depsFile);
|
|
63321
63721
|
}
|
|
@@ -63325,7 +63725,7 @@ function discoverPackageRoot(params, deps = defaultDeps) {
|
|
|
63325
63725
|
if (packageFolders.length === 0) {
|
|
63326
63726
|
throw new Error("No packageFolders found in AllDependencies.json.");
|
|
63327
63727
|
}
|
|
63328
|
-
const packageRoot =
|
|
63728
|
+
const packageRoot = join17(packageFolders[0], library.path);
|
|
63329
63729
|
if (!deps.fileExists(packageRoot)) {
|
|
63330
63730
|
throw new PackageRootMissingError(packageRoot);
|
|
63331
63731
|
}
|
|
@@ -63347,23 +63747,23 @@ function findLibraryEntry(allDeps, packageId) {
|
|
|
63347
63747
|
import {
|
|
63348
63748
|
existsSync as existsSync8,
|
|
63349
63749
|
mkdirSync as mkdirSync3,
|
|
63350
|
-
readFileSync as
|
|
63351
|
-
statSync as
|
|
63750
|
+
readFileSync as readFileSync8,
|
|
63751
|
+
statSync as statSync5,
|
|
63352
63752
|
writeFileSync as writeFileSync3
|
|
63353
63753
|
} from "node:fs";
|
|
63354
|
-
import { dirname as
|
|
63754
|
+
import { dirname as dirname8, join as join18 } from "node:path";
|
|
63355
63755
|
var defaultDeps2 = {
|
|
63356
63756
|
fileExists: existsSync8,
|
|
63357
|
-
readFile: (path4) =>
|
|
63757
|
+
readFile: (path4) => readFileSync8(path4, "utf-8"),
|
|
63358
63758
|
writeFile: (path4, content) => {
|
|
63359
|
-
mkdirSync3(
|
|
63759
|
+
mkdirSync3(dirname8(path4), { recursive: true });
|
|
63360
63760
|
writeFileSync3(path4, content, "utf-8");
|
|
63361
63761
|
},
|
|
63362
|
-
getModifiedTime: (path4) =>
|
|
63762
|
+
getModifiedTime: (path4) => statSync5(path4).mtimeMs
|
|
63363
63763
|
};
|
|
63364
63764
|
function discoverPackageRootCached(params, deps = defaultDeps2) {
|
|
63365
|
-
const cacheFilePath =
|
|
63366
|
-
const allDepsPath =
|
|
63765
|
+
const cacheFilePath = join18(params.projectDir, ".local", "rpa-tool", `${params.commandName}.json`);
|
|
63766
|
+
const allDepsPath = join18(params.projectDir, ".local", "AllDependencies.json");
|
|
63367
63767
|
let entry;
|
|
63368
63768
|
if (deps.fileExists(cacheFilePath)) {
|
|
63369
63769
|
try {
|
|
@@ -63419,7 +63819,7 @@ function mergeEnv(extra) {
|
|
|
63419
63819
|
return { ...process.env, ...extra };
|
|
63420
63820
|
}
|
|
63421
63821
|
function spawnForward(exePath, args, env) {
|
|
63422
|
-
return new Promise((
|
|
63822
|
+
return new Promise((resolve9, reject) => {
|
|
63423
63823
|
const child = spawn3(exePath, args, {
|
|
63424
63824
|
stdio: "inherit",
|
|
63425
63825
|
env: mergeEnv(env)
|
|
@@ -63428,12 +63828,12 @@ function spawnForward(exePath, args, env) {
|
|
|
63428
63828
|
reject(new Error(`Failed to spawn '${exePath}': ${err2.message}`));
|
|
63429
63829
|
});
|
|
63430
63830
|
child.on("close", (code) => {
|
|
63431
|
-
|
|
63831
|
+
resolve9(code ?? 1);
|
|
63432
63832
|
});
|
|
63433
63833
|
});
|
|
63434
63834
|
}
|
|
63435
63835
|
function spawnCapture(exePath, args, env) {
|
|
63436
|
-
return new Promise((
|
|
63836
|
+
return new Promise((resolve9, reject) => {
|
|
63437
63837
|
const child = spawn3(exePath, args, {
|
|
63438
63838
|
stdio: ["inherit", "pipe", "pipe"],
|
|
63439
63839
|
env: mergeEnv(env)
|
|
@@ -63449,7 +63849,7 @@ function spawnCapture(exePath, args, env) {
|
|
|
63449
63849
|
reject(new Error(`Failed to spawn '${exePath}': ${err2.message}`));
|
|
63450
63850
|
});
|
|
63451
63851
|
child.on("close", (code) => {
|
|
63452
|
-
|
|
63852
|
+
resolve9({
|
|
63453
63853
|
exitCode: code ?? 1,
|
|
63454
63854
|
stdout: Buffer.concat(stdoutChunks).toString("utf8"),
|
|
63455
63855
|
stderr: Buffer.concat(stderrChunks).toString("utf8")
|
|
@@ -63460,12 +63860,12 @@ function spawnCapture(exePath, args, env) {
|
|
|
63460
63860
|
|
|
63461
63861
|
// src/external-cli/manifest-reader.ts
|
|
63462
63862
|
import { execFileSync as execFileSync8 } from "node:child_process";
|
|
63463
|
-
import { existsSync as existsSync9, readFileSync as
|
|
63464
|
-
import { join as
|
|
63863
|
+
import { existsSync as existsSync9, readFileSync as readFileSync9 } from "node:fs";
|
|
63864
|
+
import { join as join19 } from "node:path";
|
|
63465
63865
|
var MANIFEST_FILENAME = "cli.manifest.json";
|
|
63466
63866
|
var defaultDeps3 = {
|
|
63467
63867
|
fileExists: existsSync9,
|
|
63468
|
-
readFile: (path4) =>
|
|
63868
|
+
readFile: (path4) => readFileSync9(path4, "utf-8")
|
|
63469
63869
|
};
|
|
63470
63870
|
function isRosettaTranslated() {
|
|
63471
63871
|
try {
|
|
@@ -63517,7 +63917,7 @@ function resolveExecutableRelativePath(manifest, manifestPath, platformKey) {
|
|
|
63517
63917
|
throw new Error(`Manifest ${manifestPath} declares neither 'tool.executable' nor 'tool.executables'.`);
|
|
63518
63918
|
}
|
|
63519
63919
|
function readCliManifest(packageRoot, deps = defaultDeps3) {
|
|
63520
|
-
const manifestPath =
|
|
63920
|
+
const manifestPath = join19(packageRoot, MANIFEST_FILENAME);
|
|
63521
63921
|
if (!deps.fileExists(manifestPath)) {
|
|
63522
63922
|
throw new Error(`CLI manifest not found at ${manifestPath}. ` + `Ensure the package includes a ${MANIFEST_FILENAME} file.`);
|
|
63523
63923
|
}
|
|
@@ -63532,7 +63932,7 @@ function readCliManifest(packageRoot, deps = defaultDeps3) {
|
|
|
63532
63932
|
}
|
|
63533
63933
|
const platformKey = (deps.getPlatformKey ?? getCurrentPlatformKey)();
|
|
63534
63934
|
const relExe = resolveExecutableRelativePath(manifest, manifestPath, platformKey);
|
|
63535
|
-
const exePath =
|
|
63935
|
+
const exePath = join19(packageRoot, relExe);
|
|
63536
63936
|
if (!deps.fileExists(exePath)) {
|
|
63537
63937
|
throw new Error(`Executable not found at ${exePath} as declared in ${manifestPath}.`);
|
|
63538
63938
|
}
|
|
@@ -67288,19 +67688,19 @@ var baseOpen5 = async (options) => {
|
|
|
67288
67688
|
}
|
|
67289
67689
|
const subprocess = childProcess35.spawn(command, cliArguments, childProcessOptions);
|
|
67290
67690
|
if (options.wait) {
|
|
67291
|
-
return new Promise((
|
|
67691
|
+
return new Promise((resolve10, reject) => {
|
|
67292
67692
|
subprocess.once("error", reject);
|
|
67293
67693
|
subprocess.once("close", (exitCode) => {
|
|
67294
67694
|
if (!options.allowNonzeroExitCode && exitCode !== 0) {
|
|
67295
67695
|
reject(new Error(`Exited with code ${exitCode}`));
|
|
67296
67696
|
return;
|
|
67297
67697
|
}
|
|
67298
|
-
|
|
67698
|
+
resolve10(subprocess);
|
|
67299
67699
|
});
|
|
67300
67700
|
});
|
|
67301
67701
|
}
|
|
67302
67702
|
if (isFallbackAttempt) {
|
|
67303
|
-
return new Promise((
|
|
67703
|
+
return new Promise((resolve10, reject) => {
|
|
67304
67704
|
subprocess.once("error", reject);
|
|
67305
67705
|
subprocess.once("spawn", () => {
|
|
67306
67706
|
subprocess.once("close", (exitCode) => {
|
|
@@ -67310,17 +67710,17 @@ var baseOpen5 = async (options) => {
|
|
|
67310
67710
|
return;
|
|
67311
67711
|
}
|
|
67312
67712
|
subprocess.unref();
|
|
67313
|
-
|
|
67713
|
+
resolve10(subprocess);
|
|
67314
67714
|
});
|
|
67315
67715
|
});
|
|
67316
67716
|
});
|
|
67317
67717
|
}
|
|
67318
67718
|
subprocess.unref();
|
|
67319
|
-
return new Promise((
|
|
67719
|
+
return new Promise((resolve10, reject) => {
|
|
67320
67720
|
subprocess.once("error", reject);
|
|
67321
67721
|
subprocess.once("spawn", () => {
|
|
67322
67722
|
subprocess.off("error", reject);
|
|
67323
|
-
|
|
67723
|
+
resolve10(subprocess);
|
|
67324
67724
|
});
|
|
67325
67725
|
});
|
|
67326
67726
|
};
|
|
@@ -75396,7 +75796,7 @@ function getDefaultActivityXamlTool(session) {
|
|
|
75396
75796
|
|
|
75397
75797
|
// src/tools/local/get-errors.ts
|
|
75398
75798
|
import { existsSync as existsSync11 } from "node:fs";
|
|
75399
|
-
import { isAbsolute as isAbsolute9, resolve as
|
|
75799
|
+
import { isAbsolute as isAbsolute9, resolve as resolve10 } from "node:path";
|
|
75400
75800
|
var SEVERITIES = ["error", "warning", "info", "verbose"];
|
|
75401
75801
|
var LEVEL_BY_NAME = Object.fromEntries(SEVERITIES.map((name, i3) => [name, i3 + 1]));
|
|
75402
75802
|
var NAME_BY_LEVEL = Object.fromEntries(SEVERITIES.map((name, i3) => [i3 + 1, name]));
|
|
@@ -75454,7 +75854,7 @@ function resolveTargetedFile(filePath, projectDir) {
|
|
|
75454
75854
|
if (isAbsolute9(filePath)) {
|
|
75455
75855
|
return filePath;
|
|
75456
75856
|
}
|
|
75457
|
-
return projectDir !== undefined ?
|
|
75857
|
+
return projectDir !== undefined ? resolve10(projectDir, filePath) : undefined;
|
|
75458
75858
|
}
|
|
75459
75859
|
function getErrorsTool(session) {
|
|
75460
75860
|
return createToolHandler(session, {
|
|
@@ -76687,7 +77087,63 @@ class HelmRunService {
|
|
|
76687
77087
|
}
|
|
76688
77088
|
}
|
|
76689
77089
|
|
|
77090
|
+
// src/telemetry/run-result-telemetry.ts
|
|
77091
|
+
var TERMINAL_RUN_COMMAND = "StartExecution";
|
|
77092
|
+
function buildRunResultTelemetry(input) {
|
|
77093
|
+
const exceptionType = input.resultText ? extractRunExceptionType(input.resultText) : undefined;
|
|
77094
|
+
if (input.command !== TERMINAL_RUN_COMMAND) {
|
|
77095
|
+
return exceptionType ? { runKind: input.command, exceptionType } : undefined;
|
|
77096
|
+
}
|
|
77097
|
+
const failed = input.resultText == null || resultHasErrors(input.resultText);
|
|
77098
|
+
const props2 = {
|
|
77099
|
+
runKind: input.command,
|
|
77100
|
+
success: String(!failed)
|
|
77101
|
+
};
|
|
77102
|
+
if (exceptionType) {
|
|
77103
|
+
props2.exceptionType = exceptionType;
|
|
77104
|
+
}
|
|
77105
|
+
if (failed) {
|
|
77106
|
+
props2.errorClass = classifyFailure({
|
|
77107
|
+
message: classificationText(input)
|
|
77108
|
+
});
|
|
77109
|
+
}
|
|
77110
|
+
return props2;
|
|
77111
|
+
}
|
|
77112
|
+
function classificationText(input) {
|
|
77113
|
+
const parts = [];
|
|
77114
|
+
if (input.errorText) {
|
|
77115
|
+
parts.push(input.errorText);
|
|
77116
|
+
}
|
|
77117
|
+
if (input.resultText) {
|
|
77118
|
+
try {
|
|
77119
|
+
const parsed = JSON.parse(input.resultText);
|
|
77120
|
+
const errorMessage3 = parsed?.ErrorMessage ?? parsed?.errorMessage;
|
|
77121
|
+
if (typeof errorMessage3 === "string") {
|
|
77122
|
+
parts.push(errorMessage3);
|
|
77123
|
+
}
|
|
77124
|
+
} catch {}
|
|
77125
|
+
}
|
|
77126
|
+
return parts.length > 0 ? parts.join(" ") : undefined;
|
|
77127
|
+
}
|
|
77128
|
+
|
|
76690
77129
|
// src/tools/local/run-file.ts
|
|
77130
|
+
function emitRunResult(command, resultText, errorText, projectDir) {
|
|
77131
|
+
try {
|
|
77132
|
+
const outcome = buildRunResultTelemetry({
|
|
77133
|
+
command,
|
|
77134
|
+
resultText,
|
|
77135
|
+
errorText
|
|
77136
|
+
});
|
|
77137
|
+
if (!outcome) {
|
|
77138
|
+
return;
|
|
77139
|
+
}
|
|
77140
|
+
const dir = projectDir ?? extractArg(process.argv, "project-dir", process.cwd());
|
|
77141
|
+
telemetry.trackEvent("uip.rpa.run.result", redactProperties({
|
|
77142
|
+
...buildStudioShapedProps(dir, { action: "run" }),
|
|
77143
|
+
...outcome
|
|
77144
|
+
}));
|
|
77145
|
+
} catch {}
|
|
77146
|
+
}
|
|
76691
77147
|
var EXPRESSION_COMMANDS = new Set(["TestActivity", "StartDebuggingFromHere"]);
|
|
76692
77148
|
var START_COMMANDS2 = new Set([
|
|
76693
77149
|
"StartExecution",
|
|
@@ -76815,7 +77271,7 @@ function runFileTool(session) {
|
|
|
76815
77271
|
},
|
|
76816
77272
|
required: ["filePath"]
|
|
76817
77273
|
}
|
|
76818
|
-
}, async (session2, args,
|
|
77274
|
+
}, async (session2, args, projectDir) => {
|
|
76819
77275
|
const command = args.command || "StartExecution";
|
|
76820
77276
|
const filePath = args.filePath;
|
|
76821
77277
|
const inputArguments = toJsonText(args.inputArguments);
|
|
@@ -76868,6 +77324,7 @@ function runFileTool(session) {
|
|
|
76868
77324
|
}
|
|
76869
77325
|
const helmRun = new HelmRunService(session2);
|
|
76870
77326
|
const helmResult = await helmRun.runFile(filePath, inputArguments ?? "", logLevel, command, skipBuild, profiling, folderPath, waitTimeoutSeconds, breakpoints);
|
|
77327
|
+
emitRunResult(command, helmResult.runResult, helmResult.error, projectDir);
|
|
76871
77328
|
return {
|
|
76872
77329
|
content: [
|
|
76873
77330
|
{
|
|
@@ -76894,6 +77351,7 @@ function runFileTool(session) {
|
|
|
76894
77351
|
}
|
|
76895
77352
|
}
|
|
76896
77353
|
const result = await session2.execute((instance) => instance.services.run.executeCommand(command, filePath, inputArguments ?? "", inputVariables ?? "", logLevel, profiling), { requiresProject: true });
|
|
77354
|
+
emitRunResult(command, result, undefined, projectDir);
|
|
76897
77355
|
return {
|
|
76898
77356
|
content: [
|
|
76899
77357
|
{
|
|
@@ -76905,6 +77363,7 @@ function runFileTool(session) {
|
|
|
76905
77363
|
};
|
|
76906
77364
|
} catch (e) {
|
|
76907
77365
|
const errorMessage3 = e instanceof Error ? e.message : String(e);
|
|
77366
|
+
emitRunResult(command, null, errorMessage3, projectDir);
|
|
76908
77367
|
console.error(`[run-file] error:`, errorMessage3);
|
|
76909
77368
|
return {
|
|
76910
77369
|
content: [
|
|
@@ -77080,18 +77539,18 @@ function stopExecutionTool(hostStudioPid) {
|
|
|
77080
77539
|
// src/tools/local/tm-config.ts
|
|
77081
77540
|
import { existsSync as existsSync12 } from "node:fs";
|
|
77082
77541
|
import { mkdir as mkdir6, readFile as readFile6, writeFile as writeFile6 } from "node:fs/promises";
|
|
77083
|
-
import { dirname as
|
|
77542
|
+
import { dirname as dirname10, join as join21, resolve as resolve11 } from "node:path";
|
|
77084
77543
|
var TM_DATA_DIR = ".tmh";
|
|
77085
77544
|
var TM_CONFIG_FILE = "config.json";
|
|
77086
77545
|
var PROJECT_FILE2 = "project.json";
|
|
77087
77546
|
function resolveProjectDir2(projectDir) {
|
|
77088
|
-
return
|
|
77547
|
+
return resolve11(projectDir ?? process.cwd());
|
|
77089
77548
|
}
|
|
77090
77549
|
function tmConfigPath(projectDir) {
|
|
77091
|
-
return
|
|
77550
|
+
return join21(projectDir, TM_DATA_DIR, TM_CONFIG_FILE);
|
|
77092
77551
|
}
|
|
77093
77552
|
function assertIsProject(projectDir) {
|
|
77094
|
-
if (!existsSync12(
|
|
77553
|
+
if (!existsSync12(join21(projectDir, PROJECT_FILE2))) {
|
|
77095
77554
|
throw new Error(`No UiPath project found at '${projectDir}' (missing ${PROJECT_FILE2}). ` + `Pass --project-dir pointing at the project root.`);
|
|
77096
77555
|
}
|
|
77097
77556
|
}
|
|
@@ -77109,7 +77568,7 @@ async function readTmSettings(projectDir) {
|
|
|
77109
77568
|
}
|
|
77110
77569
|
async function writeTmSettings(projectDir, settings) {
|
|
77111
77570
|
const path4 = tmConfigPath(projectDir);
|
|
77112
|
-
await mkdir6(
|
|
77571
|
+
await mkdir6(dirname10(path4), { recursive: true });
|
|
77113
77572
|
const text = JSON.stringify(settings, (_key, value) => value === null ? undefined : value, 2);
|
|
77114
77573
|
await writeFile6(path4, text, "utf8");
|
|
77115
77574
|
return path4;
|
|
@@ -77123,7 +77582,7 @@ function isSameTestManagerServer(a, b) {
|
|
|
77123
77582
|
}
|
|
77124
77583
|
var TM_LIVE_RELOAD_STUDIO_VERSION = "26.0.197";
|
|
77125
77584
|
function normalizeDir(path4) {
|
|
77126
|
-
return
|
|
77585
|
+
return resolve11(path4).replace(/[\\/]+$/, "").toLowerCase();
|
|
77127
77586
|
}
|
|
77128
77587
|
function findOpenStudioInstance(projectDir, instances) {
|
|
77129
77588
|
const target = normalizeDir(projectDir);
|
|
@@ -77606,7 +78065,7 @@ var registerCommands = async (program5, options) => {
|
|
|
77606
78065
|
hostStudioPid: process.env.UIPATH_STUDIO_PID ? parseInt(process.env.UIPATH_STUDIO_PID, 10) : undefined,
|
|
77607
78066
|
timeoutSeconds: parseInt(extractArg(process.argv, "timeout", "300") ?? "300", 10)
|
|
77608
78067
|
};
|
|
77609
|
-
resolved.projectDir =
|
|
78068
|
+
resolved.projectDir = resolve12(resolved.projectDir);
|
|
77610
78069
|
mirrorRobotDirToEnv(resolved.robotDir);
|
|
77611
78070
|
if (!options) {
|
|
77612
78071
|
const displayDefaults = {
|