@uipath/function-tool 1.205.0-preview.281 → 1.206.0-preview.282

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.
@@ -1,5 +1,3 @@
1
- import"./packager-tool-1de529jm.js";
2
-
3
1
  // ../../node_modules/open/index.js
4
2
  import process7 from "node:process";
5
3
  import path from "node:path";
@@ -548,22 +546,6 @@ var open = (target, options) => {
548
546
  target
549
547
  });
550
548
  };
551
- var openApp = (name, options) => {
552
- if (typeof name !== "string" && !Array.isArray(name)) {
553
- throw new TypeError("Expected a valid `name`");
554
- }
555
- const { arguments: appArguments = [] } = options ?? {};
556
- if (appArguments !== undefined && appArguments !== null && !Array.isArray(appArguments)) {
557
- throw new TypeError("Expected `appArguments` as Array type");
558
- }
559
- return baseOpen({
560
- ...options,
561
- app: {
562
- name,
563
- arguments: appArguments
564
- }
565
- });
566
- };
567
549
  function detectArchBinary(binary) {
568
550
  if (typeof binary === "string" || Array.isArray(binary)) {
569
551
  return binary;
@@ -626,9 +608,7 @@ defineLazyProperty(apps, "safari", () => detectPlatformBinary({
626
608
  }));
627
609
  var open_default = open;
628
610
  export {
629
- apps,
630
- open_default as default,
631
- openApp
611
+ open_default as default
632
612
  };
633
613
 
634
- //# debugId=42C9AEC59ECC644E64756E2164756E21
614
+ //# debugId=6F288C058A3A412164756E2164756E21
@@ -1,48 +1,93 @@
1
1
  import {
2
- getAuthEnv
3
- } from "./packager-tool-1shggyya.js";
4
- import"./packager-tool-qa9gftnj.js";
5
- import {
6
- OutputFormatter,
2
+ getFileSystem,
3
+ catchError2,
7
4
  RESULTS,
8
- UIPATH_HOME_DIR,
9
- catchError,
10
- getOutputFormat,
11
- getOutputFormatExplicit,
12
5
  getOutputSink,
13
6
  logger,
14
- processContext
15
- } from "./packager-tool-f7enb48c.js";
7
+ getOutputFormat,
8
+ getOutputFormatExplicit,
9
+ OutputFormatter,
10
+ UIPATH_HOME_DIR
11
+ } from "./packager-tool-cmtxbmhx.js";
16
12
  import {
17
- getFileSystem
18
- } from "./packager-tool-y4vgqz1w.js";
19
- import"./packager-tool-0gctz400.js";
20
- import"./packager-tool-yc4kw997.js";
21
- import"./packager-tool-1de529jm.js";
13
+ getAuthEnv2
14
+ } from "./packager-tool-qjerhjyd.js";
22
15
 
23
16
  // ../uipath-python-bridge/src/cache.ts
24
17
  async function readCache(cacheFile) {
25
18
  const fs = getFileSystem();
26
- const [existsError, exists] = await catchError(fs.exists(cacheFile));
19
+ const [existsError, exists] = await catchError2(fs.exists(cacheFile));
27
20
  if (existsError || !exists)
28
21
  return null;
29
- const [readError, content] = await catchError(fs.readFile(cacheFile, "utf-8"));
22
+ const [readError, content] = await catchError2(fs.readFile(cacheFile, "utf-8"));
30
23
  if (readError) {
31
24
  logger.warn(`Failed to load cache: ${readError}`);
32
25
  return null;
33
26
  }
34
- const [parseError, cache] = catchError(() => JSON.parse(content));
27
+ const [parseError, cache] = catchError2(() => JSON.parse(content));
35
28
  if (parseError) {
36
29
  logger.warn(`Failed to parse cache: ${parseError}`);
37
30
  return null;
38
31
  }
39
32
  return cache;
40
33
  }
34
+ // ../uipath-python-bridge/package.json
35
+ var package_default = {
36
+ name: "@uipath/uipath-python-bridge",
37
+ author: "UiPath",
38
+ license: "SEE LICENSE IN LICENSE.txt",
39
+ version: "1.206.0-preview.282",
40
+ description: "Shared Python detection, caching, and CLI bridge for UiPath Python SDK tools.",
41
+ keywords: [
42
+ "uip",
43
+ "python",
44
+ "bridge"
45
+ ],
46
+ uipath: {
47
+ requires: {
48
+ uipath: ">=2.14.41"
49
+ }
50
+ },
51
+ type: "module",
52
+ main: "./dist/index.js",
53
+ exports: {
54
+ ".": "./dist/index.js"
55
+ },
56
+ files: [
57
+ "dist"
58
+ ],
59
+ repository: {
60
+ type: "git",
61
+ url: "https://github.com/UiPath/cli.git",
62
+ directory: "packages/uipath-python-bridge"
63
+ },
64
+ publishConfig: {
65
+ registry: "https://npm.pkg.github.com/@uipath"
66
+ },
67
+ scripts: {
68
+ build: "bun build ./src/index.ts --outdir dist --format esm --target node --external applicationinsights --sourcemap=linked",
69
+ typecheck: "tsc --noEmit",
70
+ test: "vitest run",
71
+ "test:coverage": "vitest run --coverage",
72
+ lint: "biome check .",
73
+ "lint:fix": "biome check --write ."
74
+ },
75
+ devDependencies: {
76
+ "@uipath/auth": "workspace:*",
77
+ "@uipath/common": "workspace:*",
78
+ "@uipath/filesystem": "workspace:*",
79
+ "@types/bun": "^1.3.11",
80
+ commander: "^14.0.3",
81
+ typescript: "^7.0.2"
82
+ }
83
+ };
84
+
41
85
  // ../uipath-python-bridge/src/config.ts
42
86
  var DEFAULT_CONFIG = {
43
- allowedPythonVersions: ["3.14", "3.13", "3.12", "3.11"],
87
+ allowedPythonVersions: ["3.14", "3.13", "3.12", "3.11", "3.15"],
44
88
  packageName: "uipath",
45
- cacheFileName: ".uipath-python-cache.json"
89
+ cacheFileName: ".uipath-python-cache.json",
90
+ uipathVersionRequirement: package_default.uipath.requires.uipath
46
91
  };
47
92
  function getAllowedPythonVersions() {
48
93
  const envVersions = process.env.PYTHON_TOOL_PYTHON_VERSIONS;
@@ -57,6 +102,9 @@ function getPackageName() {
57
102
  function getCacheFileName() {
58
103
  return DEFAULT_CONFIG.cacheFileName;
59
104
  }
105
+ function getUipathVersionRequirement() {
106
+ return DEFAULT_CONFIG.uipathVersionRequirement;
107
+ }
60
108
  function matchesPattern(args, pattern) {
61
109
  if (typeof pattern === "string") {
62
110
  return args.includes(pattern);
@@ -136,6 +184,132 @@ async function supportsNewTypeOption(exePath, cwd, env = {}, signal) {
136
184
  });
137
185
  }
138
186
 
187
+ // ../uipath-python-bridge/src/uipath-version.ts
188
+ import { execFile as execFile2 } from "node:child_process";
189
+
190
+ // ../uipath-python-bridge/src/package-version.ts
191
+ var VERSION_RE = /^v?(\d+)\.(\d+)(?:\.(\d+))?/;
192
+ function parseSimpleVersion(raw) {
193
+ const match = raw.trim().match(VERSION_RE);
194
+ if (!match)
195
+ return null;
196
+ return {
197
+ major: Number(match[1]),
198
+ minor: Number(match[2]),
199
+ patch: match[3] === undefined ? 0 : Number(match[3])
200
+ };
201
+ }
202
+ function compareSimpleVersion(a, b) {
203
+ return a.major - b.major || a.minor - b.minor || a.patch - b.patch;
204
+ }
205
+ var MINIMUM_RE = /^>=\s*(\d+)\.(\d+)\.(\d+)$/;
206
+ function parseMinimumVersion(specifier) {
207
+ const match = specifier.trim().match(MINIMUM_RE);
208
+ if (!match)
209
+ return null;
210
+ return {
211
+ major: Number(match[1]),
212
+ minor: Number(match[2]),
213
+ patch: Number(match[3])
214
+ };
215
+ }
216
+ function formatSimpleVersion(version) {
217
+ return `${version.major}.${version.minor}.${version.patch}`;
218
+ }
219
+
220
+ // ../uipath-python-bridge/src/uipath-version.ts
221
+ var VERSION_LINE = /uipath\s+version\s+(\S+)/i;
222
+ async function probeUipathVersion(exePath, options = {}) {
223
+ return new Promise((resolve) => {
224
+ execFile2(exePath, ["--version"], {
225
+ cwd: options.cwd,
226
+ encoding: "utf-8",
227
+ windowsHide: true,
228
+ signal: options.signal
229
+ }, (error, stdout, stderr) => {
230
+ const out = typeof stdout === "string" ? stdout.trim() : "";
231
+ const err = typeof stderr === "string" ? stderr.trim() : "";
232
+ if (error) {
233
+ resolve({ error: describeProbeError(exePath, error, err) });
234
+ return;
235
+ }
236
+ const match = out.match(VERSION_LINE);
237
+ if (!match) {
238
+ resolve({
239
+ error: `Could not parse version from '${exePath} --version' output: ${out || "<empty>"}`
240
+ });
241
+ return;
242
+ }
243
+ resolve({ version: match[1] });
244
+ });
245
+ });
246
+ }
247
+ function describeProbeError(exePath, error, stderr) {
248
+ if (typeof error.code === "number") {
249
+ return `'${exePath} --version' exited with code ${error.code}${stderr ? `: ${stderr}` : ""}`;
250
+ }
251
+ return `Failed to run '${exePath} --version': ${error.message}`;
252
+ }
253
+ function resolveRequirement() {
254
+ const requirement = getUipathVersionRequirement();
255
+ const minimum = parseMinimumVersion(requirement);
256
+ if (!minimum) {
257
+ return {
258
+ requirement,
259
+ invalid: {
260
+ ok: false,
261
+ kind: "unverifiable",
262
+ requirement,
263
+ message: `Invalid uipath version requirement '${requirement}' declared by @uipath/uipath-python-bridge.`
264
+ }
265
+ };
266
+ }
267
+ return { requirement, minimum };
268
+ }
269
+ function judge(version, exePath, requirement, minimum) {
270
+ const parsed = parseSimpleVersion(version);
271
+ if (!parsed) {
272
+ return {
273
+ ok: false,
274
+ kind: "unverifiable",
275
+ requirement,
276
+ message: `Could not read uipath version '${version}' reported by ${exePath}.`
277
+ };
278
+ }
279
+ if (compareSimpleVersion(parsed, minimum) < 0) {
280
+ return {
281
+ ok: false,
282
+ kind: "unsupported",
283
+ version,
284
+ requirement,
285
+ message: `uipath ${version} found at ${exePath}; ${formatSimpleVersion(minimum)} or later is required.`
286
+ };
287
+ }
288
+ return { ok: true, version, requirement };
289
+ }
290
+ async function checkUipathVersion(exePath, options = {}) {
291
+ const resolved = resolveRequirement();
292
+ if ("invalid" in resolved)
293
+ return resolved.invalid;
294
+ const probe = await probeUipathVersion(exePath, options);
295
+ if ("error" in probe) {
296
+ return {
297
+ ok: false,
298
+ kind: "unverifiable",
299
+ requirement: resolved.requirement,
300
+ message: probe.error
301
+ };
302
+ }
303
+ return judge(probe.version, exePath, resolved.requirement, resolved.minimum);
304
+ }
305
+ function uipathVersionInstructions(check, toolName) {
306
+ const setupHint = `then re-run 'uip ${toolName} setup --force'`;
307
+ if (check.kind === "unverifiable") {
308
+ return `Make sure the uipath package is installed and runnable in that environment, ${setupHint}.`;
309
+ }
310
+ return `Upgrade uipath, ${setupHint}.`;
311
+ }
312
+
139
313
  // ../uipath-python-bridge/src/execute.ts
140
314
  var ENV_FILE_NAME = ".env";
141
315
  function isHelpCommand(args) {
@@ -162,8 +336,8 @@ function envValueFromFile(content, name) {
162
336
  if (!line || line.startsWith("#")) {
163
337
  return false;
164
338
  }
165
- const [key, ...valueParts2] = line.split("=");
166
- return key.trim() === name && valueParts2.join("=").trim().length > 0;
339
+ const [key, ...valueParts] = line.split("=");
340
+ return key.trim() === name && valueParts.join("=").trim().length > 0;
167
341
  });
168
342
  if (!envLine) {
169
343
  return null;
@@ -180,7 +354,7 @@ async function getConfiguredEnvValue(fs, name) {
180
354
  if (!await fs.exists(envPath)) {
181
355
  return null;
182
356
  }
183
- const [readError, content] = await catchError(fs.readFile(envPath, "utf-8"));
357
+ const [readError, content] = await catchError2(fs.readFile(envPath, "utf-8"));
184
358
  return !readError && typeof content === "string" ? envValueFromFile(content, name) : null;
185
359
  }
186
360
  var fail = (reason, message, instructions, extras = {}) => ({
@@ -235,13 +409,13 @@ async function runUipathPythonCommand(args, options = {}) {
235
409
  }
236
410
  requiredEnv[requirement.name] = value;
237
411
  }
238
- const { authEnv, loginStatus } = await getAuthEnv();
412
+ const { authEnv, loginStatus } = await getAuthEnv2();
239
413
  if (!loginStatus) {
240
414
  logger.debug("Auth unavailable, continuing without credentials.");
241
415
  }
242
416
  if (options.commandPreflight) {
243
417
  const preflight = options.commandPreflight;
244
- const [preflightError, preflightResult] = await catchError(Promise.resolve().then(() => preflight({
418
+ const [preflightError, preflightResult] = await catchError2(Promise.resolve().then(() => preflight({
245
419
  args: commandArgs,
246
420
  loginStatus,
247
421
  authEnv
@@ -255,6 +429,14 @@ async function runUipathPythonCommand(args, options = {}) {
255
429
  }
256
430
  const stdio = options.stdio ?? "inherit";
257
431
  const cwd = options.cwd ?? fs.env.cwd();
432
+ const versionCheck = await checkUipathVersion(cache.uipathExePath, {
433
+ cwd,
434
+ signal: options.signal
435
+ });
436
+ if (!versionCheck.ok) {
437
+ return fail(versionCheck.kind === "unsupported" ? "uipath_version_unsupported" : "uipath_version_unverifiable", versionCheck.message, uipathVersionInstructions(versionCheck, toolLabel));
438
+ }
439
+ logger.debug(`Using uipath ${versionCheck.version} at ${cache.uipathExePath} (source: ${cache.source ?? "unknown"}; requires uipath${versionCheck.requirement})`);
258
440
  if (options.pinNewType && processed.args[0] === "new" && !isHelpCommand(processed.args) && await supportsNewTypeOption(cache.uipathExePath, cwd, { ...authEnv, ...requiredEnv }, options.signal)) {
259
441
  commandArgs.push("--type", options.pinNewType);
260
442
  }
@@ -285,7 +467,7 @@ async function runUipathPythonCommand(args, options = {}) {
285
467
  getOutputSink().writeErr(chunk);
286
468
  });
287
469
  }
288
- const [spawnError, exitCode] = await catchError(new Promise((resolve, reject) => {
470
+ const [spawnError, exitCode] = await catchError2(new Promise((resolve, reject) => {
289
471
  proc.on("close", (code) => resolve(code ?? 1));
290
472
  proc.on("error", reject);
291
473
  }));
@@ -303,6 +485,7 @@ async function runUipathPythonCommand(args, options = {}) {
303
485
  return {
304
486
  ok: true,
305
487
  pythonExePath: cache.uipathExePath,
488
+ uipathVersion: versionCheck.version,
306
489
  exitCode: 0,
307
490
  stdout: stdio === "pipe" ? stdout : undefined,
308
491
  stderr: stdio === "pipe" ? stderr : undefined
@@ -311,6 +494,8 @@ async function runUipathPythonCommand(args, options = {}) {
311
494
  var CLI_RESULT_BY_REASON = {
312
495
  python_not_configured: RESULTS.ConfigError,
313
496
  uipath_exe_missing: RESULTS.ConfigError,
497
+ uipath_version_unsupported: RESULTS.ConfigError,
498
+ uipath_version_unverifiable: RESULTS.ConfigError,
314
499
  command_disabled: RESULTS.ValidationError,
315
500
  new_type_not_allowed: RESULTS.ValidationError,
316
501
  required_env_missing: RESULTS.ConfigError,
@@ -328,31 +513,6 @@ function reportUipathPythonFailure(result) {
328
513
  }
329
514
  return result.exitCode;
330
515
  }
331
- function createExecuteCommand(config) {
332
- const executeCommand = async (rawArgs, _options) => {
333
- const runIndex = rawArgs.indexOf("exec");
334
- const actualArgs = runIndex >= 0 ? rawArgs.slice(runIndex + 1) : [];
335
- const result = await runUipathPythonCommand(actualArgs, {
336
- commandPrefix: config.commandPrefix,
337
- toolName: config.toolName,
338
- pinNewType: config.pinNewType,
339
- commandRules: config.commandRules,
340
- commandPreflight: config.commandPreflight,
341
- requiredEnvironmentVariables: config.requiredEnvironmentVariables,
342
- outputFormatOption: config.outputFormatOption,
343
- outputFormats: config.outputFormats,
344
- stdio: "inherit"
345
- });
346
- processContext.exit(reportUipathPythonFailure(result));
347
- return result;
348
- };
349
- const registerExecCommand = (program) => {
350
- program.command("exec", { hidden: true }).description("Execute the uipath package with provided arguments").allowUnknownOption(true).allowExcessArguments(true).trackedAction(processContext, async (_options, cmd) => {
351
- await executeCommand(["_", "_", "exec", ...cmd.args], {});
352
- });
353
- };
354
- return { executeCommand, registerExecCommand };
355
- }
356
516
  // ../uipath-python-bridge/src/python-service.ts
357
517
  import { spawn as spawn2 } from "node:child_process";
358
518
  import { platform } from "node:os";
@@ -360,14 +520,13 @@ class PythonService {
360
520
  cacheFile;
361
521
  config;
362
522
  uipathExePath;
363
- packageVersion;
364
523
  constructor(config) {
365
524
  const fs = getFileSystem();
366
525
  this.config = config;
367
526
  this.cacheFile = config.cacheFile || fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR, getCacheFileName());
368
527
  }
369
528
  async setup(packageName, force = false) {
370
- const [error, result] = await catchError(this._setupInternal(packageName, force));
529
+ const [error, result] = await catchError2(this._setupInternal(packageName, force));
371
530
  if (error) {
372
531
  return { success: false, error: error.message };
373
532
  }
@@ -420,26 +579,20 @@ To install the package, run:
420
579
  ${pythonPath} -m pip install ${packageName}`
421
580
  };
422
581
  }
423
- const versionResult = await this.getUipathVersion(this.uipathExePath);
424
- if ("error" in versionResult) {
425
- return {
426
- success: false,
582
+ const versionCheck = await checkUipathVersion(this.uipathExePath);
583
+ if (!versionCheck.ok) {
584
+ return this.rejectVersion(versionCheck, {
427
585
  pythonPath,
428
586
  pythonVersion: version,
429
- packageInstalled: true,
430
- uipathExePath: this.uipathExePath,
431
- source,
432
- error: versionResult.error
433
- };
587
+ source
588
+ });
434
589
  }
435
- this.packageVersion = versionResult.version;
436
590
  await this.saveCache({
437
591
  pythonPath,
438
592
  version,
439
593
  lastValidated: new Date().toISOString(),
440
594
  packageName,
441
595
  uipathExePath: this.uipathExePath,
442
- packageVersion: this.packageVersion,
443
596
  source
444
597
  });
445
598
  return {
@@ -447,7 +600,7 @@ To install the package, run:
447
600
  pythonPath,
448
601
  pythonVersion: version,
449
602
  packageInstalled: true,
450
- packageVersion: this.packageVersion,
603
+ packageVersion: versionCheck.version,
451
604
  uipathExePath: this.uipathExePath,
452
605
  source
453
606
  };
@@ -471,21 +624,13 @@ To install the package, run:
471
624
  this.uipathExePath = cached.uipathExePath;
472
625
  const source = cached.source ?? (virtualEnv ? "venv" : "path");
473
626
  logger.info(`Using cached uipath executable: ${this.uipathExePath}`);
474
- this.packageVersion = cached.packageVersion;
475
- if (!this.packageVersion) {
476
- const versionResult = await this.getUipathVersion(this.uipathExePath);
477
- if ("error" in versionResult) {
478
- return {
479
- success: false,
480
- pythonPath,
481
- pythonVersion: version,
482
- packageInstalled: true,
483
- uipathExePath: this.uipathExePath,
484
- source,
485
- error: versionResult.error
486
- };
487
- }
488
- this.packageVersion = versionResult.version;
627
+ const versionCheck = await checkUipathVersion(this.uipathExePath);
628
+ if (!versionCheck.ok) {
629
+ return this.rejectVersion(versionCheck, {
630
+ pythonPath,
631
+ pythonVersion: version,
632
+ source
633
+ });
489
634
  }
490
635
  await this.saveCache({
491
636
  pythonPath,
@@ -493,7 +638,6 @@ To install the package, run:
493
638
  lastValidated: new Date().toISOString(),
494
639
  packageName,
495
640
  uipathExePath: this.uipathExePath,
496
- packageVersion: this.packageVersion,
497
641
  source
498
642
  });
499
643
  return {
@@ -501,7 +645,7 @@ To install the package, run:
501
645
  pythonPath,
502
646
  pythonVersion: version,
503
647
  packageInstalled: true,
504
- packageVersion: this.packageVersion,
648
+ packageVersion: versionCheck.version,
505
649
  uipathExePath: this.uipathExePath,
506
650
  source
507
651
  };
@@ -594,7 +738,7 @@ To install the package, run:
594
738
  const stderrChunks = [];
595
739
  versionProc.stdout.on("data", (chunk) => stdoutChunks.push(chunk));
596
740
  versionProc.stderr.on("data", (chunk) => stderrChunks.push(chunk));
597
- const [versionError, exitCode] = await catchError(new Promise((resolve, reject) => {
741
+ const [versionError, exitCode] = await catchError2(new Promise((resolve, reject) => {
598
742
  versionProc.on("exit", (code) => resolve(code ?? 1));
599
743
  versionProc.on("error", (error) => reject(error));
600
744
  }));
@@ -677,7 +821,7 @@ sys.exit(3)
677
821
  const stderrChunks = [];
678
822
  proc.stdout.on("data", (chunk) => stdoutChunks.push(chunk));
679
823
  proc.stderr.on("data", (chunk) => stderrChunks.push(chunk));
680
- const [error, exitCode] = await catchError(new Promise((resolve, reject) => {
824
+ const [error, exitCode] = await catchError2(new Promise((resolve, reject) => {
681
825
  proc.on("exit", (code) => resolve(code ?? 1));
682
826
  proc.on("error", (err) => reject(err));
683
827
  }));
@@ -708,7 +852,7 @@ sys.exit(3)
708
852
  });
709
853
  const stdoutChunks = [];
710
854
  proc.stdout.on("data", (chunk) => stdoutChunks.push(chunk));
711
- const [error, exitCode] = await catchError(new Promise((resolve, reject) => {
855
+ const [error, exitCode] = await catchError2(new Promise((resolve, reject) => {
712
856
  proc.on("exit", (code) => resolve(code ?? 1));
713
857
  proc.on("error", (err) => reject(err));
714
858
  }));
@@ -721,37 +865,18 @@ sys.exit(3)
721
865
  const prefix = Buffer.concat(stdoutChunks).toString("utf-8").trim();
722
866
  return prefix || undefined;
723
867
  }
724
- async getUipathVersion(exePath) {
725
- const proc = spawn2(exePath, ["--version"], {
726
- stdio: ["ignore", "pipe", "pipe"]
727
- });
728
- const stdoutChunks = [];
729
- const stderrChunks = [];
730
- proc.stdout.on("data", (chunk) => stdoutChunks.push(chunk));
731
- proc.stderr.on("data", (chunk) => stderrChunks.push(chunk));
732
- const [spawnError, exitCode] = await catchError(new Promise((resolve, reject) => {
733
- proc.on("exit", (code) => resolve(code ?? 1));
734
- proc.on("error", (err) => reject(err));
735
- }));
736
- if (spawnError) {
737
- return {
738
- error: `Failed to run '${exePath} --version': ${spawnError.message}`
739
- };
740
- }
741
- const stdout = Buffer.concat(stdoutChunks).toString("utf-8").trim();
742
- const stderr = Buffer.concat(stderrChunks).toString("utf-8").trim();
743
- if (exitCode !== 0) {
744
- return {
745
- error: `'${exePath} --version' exited with code ${exitCode}${stderr ? `: ${stderr}` : ""}`
746
- };
747
- }
748
- const match = stdout.match(/uipath\s+version\s+(\S+)/i);
749
- if (!match) {
750
- return {
751
- error: `Could not parse version from '${exePath} --version' output: ${stdout || "<empty>"}`
752
- };
753
- }
754
- return { version: match[1] };
868
+ rejectVersion(check, context) {
869
+ return {
870
+ success: false,
871
+ pythonPath: context.pythonPath,
872
+ pythonVersion: context.pythonVersion,
873
+ packageInstalled: true,
874
+ packageVersion: check.kind === "unsupported" ? check.version : undefined,
875
+ uipathExePath: this.uipathExePath,
876
+ source: context.source,
877
+ error: check.message,
878
+ instructions: uipathVersionInstructions(check, this.config.toolName ?? "codedagent")
879
+ };
755
880
  }
756
881
  getPathUipathCandidates(fs, isWindows) {
757
882
  const pathValue = process.env.PATH || (isWindows ? process.env.Path : undefined);
@@ -838,12 +963,12 @@ Please install one of the required Python versions:
838
963
  async saveCache(cache) {
839
964
  const fs = getFileSystem();
840
965
  const dir = fs.path.dirname(this.cacheFile);
841
- const [mkdirError] = await catchError(fs.mkdir(dir));
966
+ const [mkdirError] = await catchError2(fs.mkdir(dir));
842
967
  if (mkdirError) {
843
968
  logger.warn(`Failed to create cache directory: ${mkdirError}`);
844
969
  return;
845
970
  }
846
- const [writeError] = await catchError(fs.writeFile(this.cacheFile, JSON.stringify(cache, null, 2)));
971
+ const [writeError] = await catchError2(fs.writeFile(this.cacheFile, JSON.stringify(cache, null, 2)));
847
972
  if (writeError) {
848
973
  logger.warn(`Failed to save cache: ${writeError}`);
849
974
  return;
@@ -862,100 +987,13 @@ function isPathInside(target, root) {
862
987
  const normalizedRoot = normalize(root);
863
988
  return normalizedTarget === normalizedRoot || normalizedTarget.startsWith(`${normalizedRoot}/`);
864
989
  }
865
- // ../uipath-python-bridge/src/register.ts
866
- function createSetupCommand(config) {
867
- return (program) => {
868
- program.command("setup").description("Detect Python installation and verify package is installed").option("--force", "Force re-detection of Python even if cached", false).trackedAction(processContext, async (options) => {
869
- const packageName = config.packageName || getPackageName();
870
- const allowedVersions = getAllowedPythonVersions();
871
- if (allowedVersions.length === 0) {
872
- OutputFormatter.error({
873
- Result: RESULTS.Failure,
874
- Message: "Invalid configuration. Allowed Python list misconfigured.",
875
- Instructions: "Check env variable PYTHON_TOOL_PYTHON_VERSIONS"
876
- });
877
- processContext.exit(1);
878
- return;
879
- }
880
- logger.info(`
881
- Searching for Python installations: ${allowedVersions}`);
882
- const service = new PythonService({
883
- allowedVersions,
884
- packageName,
885
- toolName: config.toolName
886
- });
887
- const result = await service.setup(packageName, options.force);
888
- if (!result.success) {
889
- OutputFormatter.error({
890
- Result: RESULTS.Failure,
891
- Message: result.error || "Setup failed with no error.",
892
- Instructions: result.instructions || `Install a supported Python version and the '${packageName}' tool, then re-run setup. For uv installs, run 'uv tool install ${packageName}' and ensure the uv tool directory is on PATH.`
893
- });
894
- processContext.exit(1);
895
- return;
896
- }
897
- OutputFormatter.success({
898
- Result: RESULTS.Success,
899
- Code: config.successCode,
900
- Data: {
901
- PythonPath: result.pythonPath,
902
- Package: packageName,
903
- PackageInstalled: result.packageInstalled ? "Yes" : "No",
904
- PackageVersion: result.packageVersion ?? "N/A",
905
- UipathPath: result.uipathExePath,
906
- Source: result.source
907
- }
908
- });
909
- processContext.exit(0);
910
- });
911
- };
912
- }
913
- function createDefaultAction(executeCommand) {
914
- return (program) => {
915
- program.trackedAction(processContext, async () => {
916
- const userArgs = program.args.length > 0 ? normalizeDefaultActionArgs(program.args) : [];
917
- const extra = userArgs.length > 0 ? userArgs : ["--help"];
918
- await executeCommand(["_", "_", "exec", ...extra], {});
919
- });
920
- };
921
- }
922
- function normalizeDefaultActionArgs(args) {
923
- return args.length === 1 && args[0] === "-h" ? ["--help"] : args;
924
- }
925
- function createHelpCommand(executeCommand) {
926
- return (program) => {
927
- program.command("help").description("Display help for the python tool").trackedAction(processContext, async () => {
928
- await executeCommand(["_", "_", "exec", "--help"], {});
929
- });
930
- };
931
- }
932
- function createCommandForwarder(executeCommand) {
933
- return (program) => {
934
- program.on("command:*", async (operands) => {
935
- const unknownCommand = operands[0];
936
- if (!program.commands.some((c) => c.name() === unknownCommand)) {
937
- await executeCommand(["_", "_", "exec", ...operands], {});
938
- }
939
- });
940
- };
941
- }
942
990
  export {
943
991
  PythonService,
944
- createCommandForwarder,
945
- createDefaultAction,
946
- createExecuteCommand,
947
- createHelpCommand,
948
- createSetupCommand,
949
992
  getAllowedPythonVersions,
950
- getCacheFileName,
951
993
  getPackageName,
952
- hasTypeOption,
953
- isPathInside,
954
- processCommandArgs,
955
- readCache,
994
+ getUipathVersionRequirement,
956
995
  reportUipathPythonFailure,
957
- runUipathPythonCommand,
958
- supportsNewTypeOption
996
+ runUipathPythonCommand
959
997
  };
960
998
 
961
- //# debugId=A5A08FE74545D89264756E2164756E21
999
+ //# debugId=EB43C467CA61EDA464756E2164756E21