@uipath/rpa-tool 1.198.0 → 1.198.1

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.
@@ -43996,6 +43996,16 @@ function ensureSymlink(linkPath, target) {
43996
43996
  function withTrailingSeparator(p) {
43997
43997
  return p.endsWith("/") || p.endsWith("\\") ? p : `${p}/`;
43998
43998
  }
43999
+ // src/process-liveness.ts
44000
+ function isProcessAlive(pid) {
44001
+ try {
44002
+ process.kill(pid, 0);
44003
+ return true;
44004
+ } catch (err) {
44005
+ return err.code === "EPERM";
44006
+ }
44007
+ }
44008
+
43999
44009
  // src/discovery/StudioDiscoveryService.ts
44000
44010
  function getStatusFilePath(processId) {
44001
44011
  return join2(safeTmpDir(), "UiPath", "Studio", `Studio_${processId}.status`);
@@ -44014,14 +44024,6 @@ function parseStatusFileNames(fileNames) {
44014
44024
  }
44015
44025
  return pids;
44016
44026
  }
44017
- function isProcessAlive(pid) {
44018
- try {
44019
- process.kill(pid, 0);
44020
- return true;
44021
- } catch {
44022
- return false;
44023
- }
44024
- }
44025
44027
  function readStatusFile(filePath) {
44026
44028
  let fd;
44027
44029
  try {
@@ -45017,6 +45019,7 @@ var defaultResolverDeps = {
45017
45019
  activeToolName: status.ActiveToolName ?? null
45018
45020
  };
45019
45021
  },
45022
+ isProcessAlive,
45020
45023
  discoverInstances,
45021
45024
  executeCommand(command, args) {
45022
45025
  return execFileSync4(command, args, {
package/dist/tool.js CHANGED
@@ -59091,7 +59091,7 @@ var {
59091
59091
  // package.json
59092
59092
  var package_default = {
59093
59093
  name: "@uipath/rpa-tool",
59094
- version: "1.198.0",
59094
+ version: "1.198.1",
59095
59095
  description: "Tool for creating and managing UiPath RPA projects",
59096
59096
  keywords: [
59097
59097
  "uipcli-tool",
@@ -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 {
@@ -60342,6 +60345,7 @@ var defaultResolverDeps = {
60342
60345
  activeToolName: status.ActiveToolName ?? null
60343
60346
  };
60344
60347
  },
60348
+ isProcessAlive,
60345
60349
  discoverInstances,
60346
60350
  executeCommand(command, args) {
60347
60351
  return execFileSync5(command, args, {
@@ -62253,14 +62257,6 @@ function slotName(version) {
62253
62257
  function helmSlotDir(root, version) {
62254
62258
  return join12(root, slotName(version));
62255
62259
  }
62256
- function isProcessAlive2(pid) {
62257
- try {
62258
- process.kill(pid, 0);
62259
- return true;
62260
- } catch {
62261
- return false;
62262
- }
62263
- }
62264
62260
  function touch(path4) {
62265
62261
  try {
62266
62262
  const now = new Date;
@@ -62277,7 +62273,7 @@ function tryAcquireLock(lockPath, log) {
62277
62273
  try {
62278
62274
  const raw = readFileSync4(lockPath, "utf-8");
62279
62275
  const { pid, ts } = JSON.parse(raw);
62280
- const dead = typeof pid === "number" && !isProcessAlive2(pid);
62276
+ const dead = typeof pid === "number" && !isProcessAlive(pid);
62281
62277
  const old = typeof ts === "number" && Date.now() - ts > STALE_LOCK_MS;
62282
62278
  if (dead || old) {
62283
62279
  log(`Stealing stale Helm slot lock: ${lockPath}`);
@@ -62358,7 +62354,7 @@ function cleanupStale(root) {
62358
62354
  const pid = Number.parseInt(parts[parts.length - 2] ?? "", 10);
62359
62355
  try {
62360
62356
  const age = now - statSync2(dir).mtimeMs;
62361
- const ownerDead = Number.isNaN(pid) || !isProcessAlive2(pid);
62357
+ const ownerDead = Number.isNaN(pid) || !isProcessAlive(pid);
62362
62358
  if (ownerDead && age > STALE_STAGING_MS) {
62363
62359
  rmSync3(dir, { recursive: true, force: true });
62364
62360
  }
@@ -62731,16 +62727,19 @@ async function tryMatchInstance(instances, options, requiresProject, deps) {
62731
62727
  }
62732
62728
  return null;
62733
62729
  }
62730
+ function staleHostPidMessage(pid) {
62731
+ 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.`;
62732
+ }
62734
62733
  async function resolveStudioInstance(options, deps = defaultResolverDeps) {
62735
62734
  const requiresProject = options.requiresProject !== false;
62736
62735
  deps.log(`Resolving Studio instance for project: ${options.projectDir} ` + `(requiresProject=${requiresProject})`);
62737
62736
  if (options.targetPid != null) {
62738
62737
  if (options.excludePids?.has(options.targetPid)) {
62739
- throw new Error(`Studio instance PID ${options.targetPid} was excluded. ` + `The host Studio session may have ended.`);
62738
+ throw new Error(staleHostPidMessage(options.targetPid));
62740
62739
  }
62741
62740
  const target = deps.readInstanceStatus(options.targetPid);
62742
- if (!target?.ipcEndpointName) {
62743
- throw new Error(`Studio instance PID ${options.targetPid} is not reachable. ` + `The host Studio session may have ended.`);
62741
+ if (!target?.ipcEndpointName || !deps.isProcessAlive(options.targetPid)) {
62742
+ throw new Error(staleHostPidMessage(options.targetPid));
62744
62743
  }
62745
62744
  if (target.executionStatus === "Available" /* Available */) {
62746
62745
  deps.log(`Using target PID ${target.processId}: pipe=${target.ipcEndpointName}`);
@@ -63107,9 +63106,15 @@ class StudioSession {
63107
63106
  }
63108
63107
  if (this.options.hostStudioPid && !this.options.useStudio && opts.toolName) {
63109
63108
  let target = getHostRouteTarget(opts.toolName);
63110
- if (target === "host" /* Host */ && opts.toolName === ToolName.RunFile && opts.projectDir && this.hostHasDifferentProjectOpen(opts.projectDir)) {
63111
- this.deps.log(`Host Studio has a different project open; diverting ${opts.toolName} to Helm to preserve the session.`);
63112
- target = "helm" /* Helm */;
63109
+ if (target === "host" /* Host */ && opts.toolName === ToolName.RunFile) {
63110
+ const hostStatus = this.deps.readInstanceStatus(this.options.hostStudioPid);
63111
+ if (!hostStatus?.ipcEndpointName || !this.deps.isProcessAlive(this.options.hostStudioPid)) {
63112
+ 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.`);
63113
+ target = "helm" /* Helm */;
63114
+ } else if (opts.projectDir && this.hostHasDifferentProjectOpen(opts.projectDir, hostStatus)) {
63115
+ this.deps.log(`Host Studio has a different project open; diverting ${opts.toolName} to Helm to preserve the session.`);
63116
+ target = "helm" /* Helm */;
63117
+ }
63113
63118
  }
63114
63119
  this.deps.log(`Host PID routing: ${opts.toolName} -> ${target}`);
63115
63120
  if (target === "host" /* Host */) {
@@ -63214,13 +63219,8 @@ class StudioSession {
63214
63219
  deps.log(`Failed to pause Studio DB access: ${e instanceof Error ? e.message : e}`);
63215
63220
  }
63216
63221
  }
63217
- hostHasDifferentProjectOpen(projectDir) {
63218
- const hostPid = this.options.hostStudioPid;
63219
- if (hostPid == null) {
63220
- return false;
63221
- }
63222
- const status = this.deps.readInstanceStatus(hostPid);
63223
- return !!status?.projectDirectory && normalizePath(status.projectDirectory) !== normalizePath(projectDir);
63222
+ hostHasDifferentProjectOpen(projectDir, hostStatus) {
63223
+ return !!hostStatus.projectDirectory && normalizePath(hostStatus.projectDirectory) !== normalizePath(projectDir);
63224
63224
  }
63225
63225
  forTool(toolName) {
63226
63226
  return Object.create(this, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/rpa-tool",
3
- "version": "1.198.0",
3
+ "version": "1.198.1",
4
4
  "description": "Tool for creating and managing UiPath RPA projects",
5
5
  "keywords": [
6
6
  "uipcli-tool",
@@ -59,11 +59,11 @@
59
59
  "typescript": "^5.7.2"
60
60
  },
61
61
  "optionalDependencies": {
62
- "@uipath/studio-helm-win32-x64": "1.198.0",
63
- "@uipath/studio-helm-win32-arm64": "1.198.0",
64
- "@uipath/studio-helm-linux-x64": "1.198.0",
65
- "@uipath/studio-helm-linux-arm64": "1.198.0",
66
- "@uipath/studio-helm-darwin-x64": "1.198.0",
67
- "@uipath/studio-helm-darwin-arm64": "1.198.0"
62
+ "@uipath/studio-helm-win32-x64": "1.198.1",
63
+ "@uipath/studio-helm-win32-arm64": "1.198.1",
64
+ "@uipath/studio-helm-linux-x64": "1.198.1",
65
+ "@uipath/studio-helm-linux-arm64": "1.198.1",
66
+ "@uipath/studio-helm-darwin-x64": "1.198.1",
67
+ "@uipath/studio-helm-darwin-arm64": "1.198.1"
68
68
  }
69
69
  }