@uipath/rpa-tool 1.201.0 → 1.202.0-preview.20260907.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13268,12 +13268,6 @@ Details: ${errorDesc}${troubleshooting}`, status);
13268
13268
  params,
13269
13269
  buildError: buildFederatedError
13270
13270
  });
13271
- }, LOGIN_STATUS_HINT = "Run 'uip login status' to see the organization the CLI is signed in to.", organizationHint = (organizationId) => `The request used '${organizationId}' as the organization. ${LOGIN_STATUS_HINT}`, IDENTIFIER_STATUSES, describeNonJsonResponse = (organizationId, response, parseError) => {
13272
- if (response.redirected) {
13273
- return `Could not find organization '${organizationId}': the request was redirected to a sign-in page instead of the organization's tenant list. ${LOGIN_STATUS_HINT}`;
13274
- }
13275
- const contentType = response.headers.get("content-type") ?? "unknown";
13276
- return `The organization service returned a '${contentType}' response instead of JSON: ${parseError.message}. ${organizationHint(organizationId)}`;
13277
13271
  }, fetchTenantsAndOrganizations = async (baseUrl, accessToken, organizationId) => {
13278
13272
  const url = `${baseUrl}/${organizationId}/portal_/api/filtering/leftnav/tenantsAndOrganizationInfo`;
13279
13273
  const response = await fetch(url, {
@@ -13283,16 +13277,12 @@ Details: ${errorDesc}${troubleshooting}`, status);
13283
13277
  });
13284
13278
  if (!response.ok) {
13285
13279
  if (response.status === 401) {
13286
- throw new Error(`Unauthorized: the access token was rejected, it was not issued for organization '${organizationId}', or '${organizationId}' was not accepted as an organization URL segment in this environment. ` + LOGIN_STATUS_HINT);
13280
+ throw new Error("Unauthorized: Invalid or expired access token");
13287
13281
  }
13288
13282
  const errorText = await response.text();
13289
- const message = `Failed to get tenants and organizations: ${response.status} ${errorText}`;
13290
- throw new Error(IDENTIFIER_STATUSES.has(response.status) ? `${message}. ${organizationHint(organizationId)}` : message);
13291
- }
13292
- const [parseError, data] = await catchError(response.json());
13293
- if (parseError) {
13294
- throw new Error(describeNonJsonResponse(organizationId, response, parseError));
13283
+ throw new Error(`Failed to get tenants and organizations: ${response.status} ${errorText}`);
13295
13284
  }
13285
+ const data = await response.json();
13296
13286
  return data;
13297
13287
  }, TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED", INVALID_TENANT_CODE = "INVALID_TENANT", TenantSelectionError, TenantSelectionRequiredError, InvalidTenantError, TENANT_SELECTION_CODES, selectTenantWithDeps = async (baseUrl, accessToken, organizationId, targetTenantName, interactive, deps = {}) => {
13298
13288
  const {
@@ -14043,7 +14033,6 @@ The identity server that issued this token is not the one you pointed --authorit
14043
14033
  }
14044
14034
  };
14045
14035
  init_src();
14046
- IDENTIFIER_STATUSES = new Set([400, 403, 404]);
14047
14036
  TenantSelectionError = class TenantSelectionError extends Error {
14048
14037
  availableTenants;
14049
14038
  organizationName;
@@ -14078,6 +14067,9 @@ Available tenants: ${availableTenants.join(", ")}`, organizationName, availableT
14078
14067
  init_src();
14079
14068
  });
14080
14069
 
14070
+ // src/executor/rpa-project-executor.ts
14071
+ import * as os5 from "node:os";
14072
+
14081
14073
  // node_modules/@uipath/project-executor/dist/index.js
14082
14074
  var RunTarget;
14083
14075
  ((RunTarget2) => {
@@ -15228,16 +15220,23 @@ class HelmAuthContextServiceProxy {
15228
15220
  ProvideAuthContext(context) {
15229
15221
  throw null;
15230
15222
  }
15223
+ ClearAuthContext() {
15224
+ throw null;
15225
+ }
15231
15226
  }
15232
15227
  __legacyDecorateClassTS([
15233
15228
  import_coreipc4.ipc.$operation
15234
15229
  ], HelmAuthContextServiceProxy.prototype, "ProvideAuthContext", null);
15230
+ __legacyDecorateClassTS([
15231
+ import_coreipc4.ipc.$operation
15232
+ ], HelmAuthContextServiceProxy.prototype, "ClearAuthContext", null);
15235
15233
  HelmAuthContextServiceProxy = __legacyDecorateClassTS([
15236
15234
  import_coreipc4.ipc.$service({ endpoint: "IHelmAuthContextService" })
15237
15235
  ], HelmAuthContextServiceProxy);
15238
15236
  function adaptHelmAuthContextServiceProxy(proxy) {
15239
15237
  return {
15240
- provideAuthContext: (context) => proxy.ProvideAuthContext(context)
15238
+ provideAuthContext: (context) => proxy.ProvideAuthContext(context),
15239
+ clearAuthContext: () => proxy.ClearAuthContext()
15241
15240
  };
15242
15241
  }
15243
15242
 
@@ -24366,7 +24365,6 @@ var TLS_ERROR_CODES = new Set([
24366
24365
  ]);
24367
24366
  var TLS_INSTRUCTIONS = "The server's TLS certificate could not be verified. Most often a " + "corporate proxy/firewall re-signs HTTPS with a root CA that Node does " + "not trust — set NODE_EXTRA_CA_CERTS to that CA's PEM file (and HTTPS_PROXY " + "if you connect through a proxy). If the certificate is instead expired or " + "its hostname does not match, fix the endpoint URL or the system clock. " + "Then retry.";
24368
24367
  var NETWORK_INSTRUCTIONS = "Could not reach the UiPath service. Check your network connection and " + "VPN, confirm any HTTP_PROXY/HTTPS_PROXY/NO_PROXY settings are correct, " + "then retry.";
24369
- var LOCAL_PERMISSION_ERROR_CODES = new Set(["EACCES", "EPERM", "EROFS"]);
24370
24368
  var import__ = __toESM2(require_commander(), 1);
24371
24369
  var {
24372
24370
  program,
@@ -24414,16 +24412,6 @@ function singleton(ctorOrName) {
24414
24412
  }
24415
24413
  };
24416
24414
  }
24417
- var previewSlot = singleton("PreviewBuild");
24418
- function isPreviewBuild() {
24419
- return previewSlot.get(false) ?? false;
24420
- }
24421
- Command.prototype.previewCommand = function(nameAndArgs, opts) {
24422
- if (isPreviewBuild()) {
24423
- return this.command(nameAndArgs, opts);
24424
- }
24425
- return new Command(nameAndArgs.split(/\s+/)[0] ?? nameAndArgs);
24426
- };
24427
24415
  function createStorage() {
24428
24416
  const [error, mod2] = catchError2(() => __require3("node:async_hooks"));
24429
24417
  if (error || typeof mod2?.AsyncLocalStorage !== "function") {
@@ -24453,6 +24441,7 @@ var CONSOLE_FALLBACK = {
24453
24441
  function getOutputSink() {
24454
24442
  return outputStorage.getStore() ?? sinkSlot.get() ?? CONSOLE_FALLBACK;
24455
24443
  }
24444
+ var COMPLETER_SYMBOL = Symbol.for("@uipath/common/completer");
24456
24445
  var logFilePathSlot = singleton("logFilePath");
24457
24446
  function setGlobalLogFilePath(path32) {
24458
24447
  logFilePathSlot.set(path32);
@@ -25507,7 +25496,6 @@ var CLI_ERROR_CODES = [
25507
25496
  "invalid_argument",
25508
25497
  "authentication_required",
25509
25498
  "permission_denied",
25510
- "local_permission_denied",
25511
25499
  "not_found",
25512
25500
  "rate_limited",
25513
25501
  "network_error",
@@ -25943,16 +25931,12 @@ function defaultErrorCodeForHttpStatus(status) {
25943
25931
  return "server_error";
25944
25932
  return;
25945
25933
  }
25946
- var LOCAL_PERMISSION_TEXT_PATTERN = /(?:\b|\()(?:EACCES|EPERM|EROFS)(?::\s|\))/;
25947
25934
  function defaultErrorCodeForFailure(data) {
25948
25935
  if (data.Result === RESULTS.Failure) {
25949
25936
  const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
25950
25937
  const errorCode2 = defaultErrorCodeForHttpStatus(status);
25951
25938
  if (errorCode2)
25952
25939
  return errorCode2;
25953
- if (status === undefined && (LOCAL_PERMISSION_TEXT_PATTERN.test(data.Message) || LOCAL_PERMISSION_TEXT_PATTERN.test(data.Instructions))) {
25954
- return "local_permission_denied";
25955
- }
25956
25940
  }
25957
25941
  return defaultErrorCodeForResult(data.Result);
25958
25942
  }
@@ -26359,7 +26343,6 @@ Command.prototype.trackedAction = function(context, fn, properties) {
26359
26343
  telemetry.trackRequestResult(telemetryName, durationMs, success, baseProperties, requestContext);
26360
26344
  });
26361
26345
  };
26362
- var COMPLETER_SYMBOL = Symbol.for("@uipath/common/completer");
26363
26346
  var guardInstalledSlot = singleton("ConsoleGuardInstalled");
26364
26347
  var savedOriginalsSlot = singleton("ConsoleGuardOriginals");
26365
26348
  var DEFAULT_AUTH_TIMEOUT_MS2 = 5 * 60 * 1000;
@@ -26409,6 +26392,16 @@ var FAILURE_STATUSES = new Set([
26409
26392
  "canceled",
26410
26393
  "stopped"
26411
26394
  ]);
26395
+ var previewSlot = singleton("PreviewBuild");
26396
+ function isPreviewBuild() {
26397
+ return previewSlot.get(false) ?? false;
26398
+ }
26399
+ Command.prototype.previewCommand = function(nameAndArgs, opts) {
26400
+ if (isPreviewBuild()) {
26401
+ return this.command(nameAndArgs, opts);
26402
+ }
26403
+ return new Command(nameAndArgs.split(/\s+/)[0] ?? nameAndArgs);
26404
+ };
26412
26405
  var ScreenLogger;
26413
26406
  ((ScreenLogger2) => {
26414
26407
  function progress(message) {
@@ -26418,8 +26411,9 @@ var ScreenLogger;
26418
26411
  ScreenLogger2.progress = progress;
26419
26412
  })(ScreenLogger ||= {});
26420
26413
  var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
26421
- var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
26422
26414
  var factorySlot = singleton("PackagerFactoryProvider");
26415
+ var moduleSlot = singleton("ToolModuleProvider");
26416
+ var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
26423
26417
 
26424
26418
  // src/resolution/robot-bin-resolver.ts
26425
26419
  import { join as join10, posix, win32 as win322 } from "node:path";
@@ -26952,28 +26946,39 @@ function isAuthPushDisabled() {
26952
26946
 
26953
26947
  class HelmAuthContextProvider {
26954
26948
  session;
26955
- pushedToInstance = null;
26956
- pushing = false;
26949
+ syncedState = new Map;
26950
+ syncTail = Promise.resolve();
26957
26951
  constructor(session) {
26958
26952
  this.session = session;
26959
26953
  }
26960
26954
  async tryPushAuthContext(instanceId, authContextService) {
26955
+ const previous = this.syncTail;
26956
+ let release = () => {};
26957
+ this.syncTail = new Promise((resolve3) => {
26958
+ release = resolve3;
26959
+ });
26960
+ await previous;
26961
+ try {
26962
+ await this.synchronize(instanceId, authContextService);
26963
+ } finally {
26964
+ release();
26965
+ }
26966
+ }
26967
+ async synchronize(instanceId, authContextService) {
26961
26968
  if (isAuthPushDisabled()) {
26962
26969
  console.error(`[HelmAuthContextProvider] auth context push disabled via ` + `${DISABLE_AUTH_PUSH_ENV}; Helm will fall back to Robot/RobotType licensing.`);
26963
26970
  return;
26964
26971
  }
26965
- if (this.pushing)
26966
- return;
26967
- if (this.pushedToInstance === instanceId)
26968
- return;
26969
- this.pushedToInstance = instanceId;
26970
- this.pushing = true;
26971
26972
  try {
26972
26973
  const auth = await Promise.resolve().then(() => (init_dist(), exports_dist));
26973
26974
  const status = await auth.getLoginStatusAsync({
26974
26975
  ensureTokenValidityMinutes: 5
26975
26976
  });
26976
26977
  if (status.loginStatus !== "Logged in" || !status.accessToken || !status.baseUrl) {
26978
+ if (this.syncedState.get(instanceId) !== "logged-out") {
26979
+ await authContextService.clearAuthContext();
26980
+ this.syncedState.set(instanceId, "logged-out");
26981
+ }
26977
26982
  this.session.log(`[HelmAuthContextProvider] not pushing auth context: loginStatus=${status.loginStatus} baseUrl=${status.baseUrl ?? "<missing>"}` + (status.hint ? ` hint=${status.hint}` : ""));
26978
26983
  return;
26979
26984
  }
@@ -26992,7 +26997,7 @@ class HelmAuthContextProvider {
26992
26997
  orchestrator: buildOrchestratorUrl(status),
26993
26998
  identity: status.issuer ?? `${baseUrl}/identity`
26994
26999
  };
26995
- await authContextService.provideAuthContext({
27000
+ const context = {
26996
27001
  accessToken: status.accessToken,
26997
27002
  baseUrl,
26998
27003
  organizationId: orgId,
@@ -27001,11 +27006,14 @@ class HelmAuthContextProvider {
27001
27006
  tenantName,
27002
27007
  serviceUrls,
27003
27008
  orgScopedServices: ORG_SCOPED_SERVICES
27004
- });
27009
+ };
27010
+ const fingerprint = JSON.stringify(context);
27011
+ if (this.syncedState.get(instanceId) === fingerprint)
27012
+ return;
27013
+ await authContextService.provideAuthContext(context);
27014
+ this.syncedState.set(instanceId, fingerprint);
27005
27015
  } catch (err) {
27006
27016
  console.error(`[HelmAuthContextProvider] failed to push auth context: ${err instanceof Error ? err.message : String(err)}`);
27007
- } finally {
27008
- this.pushing = false;
27009
27017
  }
27010
27018
  }
27011
27019
  }
@@ -27018,6 +27026,8 @@ var ToolName = {
27018
27026
  CloseProject: "close-project",
27019
27027
  ConfigureRemoteRobot: "configure-remote-robot",
27020
27028
  ShowRemoteConnection: "show-remote-connection",
27029
+ EnableRemoteUia: "enable-remote-uia",
27030
+ DisableRemoteUia: "disable-remote-uia",
27021
27031
  CreateProject: "create-project",
27022
27032
  Diff: "diff",
27023
27033
  DownloadFile: "download-file",
@@ -27085,7 +27095,9 @@ var CLI_ALIASES = {
27085
27095
  [ToolName.TmClearDefaultProject]: ["tm", "clear-default-project"],
27086
27096
  [ToolName.TmStatus]: ["tm", "status"],
27087
27097
  [ToolName.ConfigureRemoteRobot]: ["remote", "configure"],
27088
- [ToolName.ShowRemoteConnection]: ["remote", "show"],
27098
+ [ToolName.ShowRemoteConnection]: ["remote", "status"],
27099
+ [ToolName.EnableRemoteUia]: ["remote", "start"],
27100
+ [ToolName.DisableRemoteUia]: ["remote", "stop"],
27089
27101
  [ToolName.ExecuteProcess]: ["remote", "exec"],
27090
27102
  [ToolName.UploadFile]: ["remote", "upload-file"],
27091
27103
  [ToolName.DownloadFile]: ["remote", "download-file"]
@@ -27688,6 +27700,94 @@ class HelmRunService {
27688
27700
  }
27689
27701
  }
27690
27702
 
27703
+ // src/executor/jit-fps.ts
27704
+ var FPS_DEBUG_MASTER = "debug.master";
27705
+ var FPS_DEBUG_EXECUTOR = "debug.executor";
27706
+ var FPS_DEBUG_SOURCE = "debug.source";
27707
+ var DEBUG_SOURCE_STUDIO_WEB = "studioweb";
27708
+ var JIT_DEBUG_VERSION = "1.0.0-debug";
27709
+ var DEFAULT_PROTOCOL_VERSIONS = ["2.2"];
27710
+ function buildRpaExecutorInfo(project, context) {
27711
+ const entryPoint = project.entryPointPath ?? "Main.xaml";
27712
+ const projectStorage = project.localProjectPath ? { path: project.localProjectPath } : {
27713
+ projectId: project.cloudProjectId,
27714
+ solutionId: context.solutionId
27715
+ };
27716
+ return {
27717
+ aliveIntervalMilliseconds: 0,
27718
+ isAutoPauseEnabled: false,
27719
+ startOptions: {
27720
+ jobModel: {
27721
+ id: crypto.randomUUID(),
27722
+ projectName: project.name,
27723
+ rootProjectDirectory: ".",
27724
+ folderId: context.folderId,
27725
+ initiatedBy: "Studio",
27726
+ workflowFilePath: `./${entryPoint.replace(/^\.?\//, "")}`,
27727
+ InputArguments: project.inputArguments ?? {},
27728
+ targetSession: "main"
27729
+ },
27730
+ breakpoints: {},
27731
+ isSlowStepping: false,
27732
+ isTrackingEnabled: false,
27733
+ projectStorage,
27734
+ serializationFormat: 0
27735
+ },
27736
+ studioWebOptions: {
27737
+ feeds: (context.feeds ?? []).filter((f) => /^http/i.test(f)),
27738
+ workflowCompilerVersion: context.workflowCompilerVersion ?? ""
27739
+ },
27740
+ supportedProtocolVersions: context.supportedProtocolVersions ?? DEFAULT_PROTOCOL_VERSIONS
27741
+ };
27742
+ }
27743
+ function buildRpaJitProcessEntry(project, context) {
27744
+ return {
27745
+ name: project.name,
27746
+ projectType: project.projectType ?? "Process",
27747
+ executorInfo: JSON.stringify(buildRpaExecutorInfo(project, context)),
27748
+ projectId: project.cloudProjectId
27749
+ };
27750
+ }
27751
+ function assembleJitFpsProperties(args) {
27752
+ const toWireEntry = ({ projectId: _, ...wire }) => wire;
27753
+ const master = {
27754
+ projectId: args.leadEntry.projectId ?? crypto.randomUUID(),
27755
+ solutionName: args.solutionName,
27756
+ version: JIT_DEBUG_VERSION,
27757
+ processes: [
27758
+ toWireEntry(args.leadEntry),
27759
+ ...args.siblingEntries.map(toWireEntry)
27760
+ ]
27761
+ };
27762
+ return JSON.stringify({
27763
+ [FPS_DEBUG_MASTER]: JSON.stringify(master),
27764
+ [FPS_DEBUG_EXECUTOR]: args.leadEntry.executorInfo,
27765
+ [FPS_DEBUG_SOURCE]: DEBUG_SOURCE_STUDIO_WEB
27766
+ });
27767
+ }
27768
+ function buildBeginSessionRequest(fpsProperties, reference, target = {}) {
27769
+ return {
27770
+ JobsCount: 1,
27771
+ JobPriority: null,
27772
+ SpecificPriorityValue: null,
27773
+ Strategy: "ModernJobsCount",
27774
+ ResumeOnSameContext: false,
27775
+ RunAsMe: true,
27776
+ RuntimeType: "Development",
27777
+ Source: "StudioWeb",
27778
+ Reference: reference,
27779
+ RobotIds: null,
27780
+ NoOfRobots: 0,
27781
+ MachineRobots: null,
27782
+ RequiresUserInteraction: target.requiresUserInteraction ?? false,
27783
+ TargetFramework: "Portable",
27784
+ ...target.machineSessionIds?.length ? { MachineSessionIds: target.machineSessionIds } : {},
27785
+ RemoteControlAccess: "None",
27786
+ InputArguments: JSON.stringify(target.inputArguments ?? {}),
27787
+ FpsProperties: fpsProperties
27788
+ };
27789
+ }
27790
+
27691
27791
  // src/tools/common/run-result.ts
27692
27792
  function resultHasErrors(rawResult) {
27693
27793
  try {
@@ -27753,6 +27853,174 @@ function asString2(value) {
27753
27853
  return typeof value === "string" ? value : undefined;
27754
27854
  }
27755
27855
 
27856
+ // src/executor/jit-online-run.ts
27857
+ var DEFAULT_POLL_INTERVAL_MS = 5000;
27858
+ var DEFAULT_TIMEOUT_MS3 = 10 * 60 * 1000;
27859
+ var TERMINAL_STATES = new Set(["Successful", "Faulted", "Stopped"]);
27860
+ async function runJitOnlineAsync(options, deps, cancellationToken) {
27861
+ const { connection, project } = options;
27862
+ if (!connection?.accessToken || !connection.baseUrl || !connection.organizationName || !connection.tenantName) {
27863
+ return RunResult.failed(RunErrorCode.Unauthorized, "An online run starts an Orchestrator job, which needs a signed-in session with a tenant. Run 'uip login' first.");
27864
+ }
27865
+ if (!project.projectPath) {
27866
+ return RunResult.failed(RunErrorCode.InvalidInput, "An online run of local source needs the project directory.");
27867
+ }
27868
+ const fetchFn = deps.fetchFn ?? fetch;
27869
+ const orchestrator = `${connection.baseUrl.replace(/\/$/, "")}/` + `${connection.organizationName}/${connection.tenantName}/orchestrator_`;
27870
+ const authHeaders = (folderId) => ({
27871
+ Authorization: `Bearer ${connection.accessToken}`,
27872
+ "Content-Type": "application/json",
27873
+ ...folderId !== undefined ? { "X-UIPATH-OrganizationUnitId": `${folderId}` } : {}
27874
+ });
27875
+ async function getJson(url, folderId) {
27876
+ const response = await fetchFn(url, {
27877
+ headers: authHeaders(folderId)
27878
+ });
27879
+ const text = await response.text();
27880
+ if (!response.ok) {
27881
+ throw new Error(`GET ${url} -> ${response.status}: ${text.substring(0, 800)}`);
27882
+ }
27883
+ return text ? JSON.parse(text) : undefined;
27884
+ }
27885
+ try {
27886
+ const folderId = connection.organizationUnitId ?? (await getJson(`${orchestrator}/odata/PersonalWorkspaces/UiPath.Server.Configuration.OData.GetPersonalWorkspace`))?.Id;
27887
+ if (folderId === undefined) {
27888
+ return RunResult.failed(RunErrorCode.PrepareFailed, "Orchestrator returned no personal workspace; an online run executes there.");
27889
+ }
27890
+ const sessionsUrl = `${orchestrator}/odata/Sessions/UiPath.Server.Configuration.OData.GetMachineSessionRuntimesByFolderId(folderId=${folderId})` + `?runtimeType=Development&$filter=${encodeURIComponent(`HostMachineName eq '${deps.hostName.replace(/'/g, "''")}' and IsUnresponsive eq false and Status eq 'Available'`)}`;
27891
+ const sessions = await getJson(sessionsUrl, folderId);
27892
+ const machineSessionId = sessions?.value?.[0]?.SessionId;
27893
+ if (machineSessionId === undefined) {
27894
+ return RunResult.failed(RunErrorCode.PrepareFailed, `No available Development robot session for '${deps.hostName}' in the personal workspace. ` + "Sign in to the UiPath Assistant on this machine and try again.");
27895
+ }
27896
+ const fpsProperties = options.fpsProperties ?? buildStandaloneFpsProperties(options, folderId);
27897
+ const sessionId = crypto.randomUUID();
27898
+ const body = buildBeginSessionRequest(fpsProperties, sessionId, {
27899
+ machineSessionIds: [machineSessionId],
27900
+ inputArguments: options.inputArguments
27901
+ });
27902
+ const beginResponse = await fetchFn(`${orchestrator}/api/RobotDebug/BeginSession`, {
27903
+ method: "POST",
27904
+ headers: authHeaders(folderId),
27905
+ body: JSON.stringify(body)
27906
+ });
27907
+ const beginText = await beginResponse.text();
27908
+ if (!beginResponse.ok) {
27909
+ return RunResult.failed(RunErrorCode.StartFailed, `Orchestrator did not start the just-in-time job (${beginResponse.status}): ${beginText.substring(0, 800)}`);
27910
+ }
27911
+ const jobKey = JSON.parse(beginText).jobKey;
27912
+ if (!jobKey) {
27913
+ return RunResult.failed(RunErrorCode.StartFailed, `Orchestrator returned no job key for the just-in-time run: ${beginText.substring(0, 400)}`);
27914
+ }
27915
+ deps.logger.info(`Started just-in-time job ${jobKey} for '${project.name}' in folder ${folderId}.`);
27916
+ options.callbacks?.onStatusChange?.(RunStatus.Running);
27917
+ if (options.wait === false) {
27918
+ const result = new RunResult(RunStatus.Running);
27919
+ result.rawStatus = "Running";
27920
+ result.details = { jobKey, sessionId, folderId };
27921
+ return result;
27922
+ }
27923
+ try {
27924
+ return await pollUntilTerminalAsync({
27925
+ orchestrator,
27926
+ folderId,
27927
+ jobKey,
27928
+ options,
27929
+ deps,
27930
+ getJson
27931
+ });
27932
+ } finally {
27933
+ await fetchFn(`${orchestrator}/api/RobotDebug/EndSession?sessionId=${sessionId}`, { method: "POST", headers: authHeaders(folderId) }).catch(() => {});
27934
+ }
27935
+ } catch (error) {
27936
+ if (cancellationToken?.aborted) {
27937
+ return RunResult.failed(RunErrorCode.Cancelled, "Run cancelled.");
27938
+ }
27939
+ const message = error instanceof Error ? error.message : String(error);
27940
+ return RunResult.failed(RunErrorCode.StartFailed, `Could not run '${project.name}' just-in-time: ${message}`);
27941
+ }
27942
+ }
27943
+ function buildStandaloneFpsProperties(options, folderId) {
27944
+ const context = {
27945
+ solutionName: options.solutionName ?? options.project.name,
27946
+ folderId,
27947
+ solutionId: options.solutionId
27948
+ };
27949
+ const leadEntry = buildRpaJitProcessEntry({
27950
+ name: options.project.name,
27951
+ projectType: options.project.projectType,
27952
+ entryPointPath: options.entryPoint,
27953
+ localProjectPath: options.project.projectPath,
27954
+ cloudProjectId: options.project.cloudProjectId
27955
+ }, context);
27956
+ const siblingEntries = (options.siblingProjects ?? []).filter((sibling) => RPA_PROJECT_TYPES.includes(sibling.projectType)).map((sibling) => buildRpaJitProcessEntry({
27957
+ name: sibling.name,
27958
+ projectType: sibling.projectType,
27959
+ localProjectPath: sibling.projectPath,
27960
+ cloudProjectId: sibling.cloudProjectId
27961
+ }, context));
27962
+ return assembleJitFpsProperties({
27963
+ leadEntry,
27964
+ siblingEntries,
27965
+ solutionName: context.solutionName
27966
+ });
27967
+ }
27968
+ async function pollUntilTerminalAsync(args) {
27969
+ const { orchestrator, folderId, jobKey, options, deps, getJson } = args;
27970
+ const pollIntervalMs = deps.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
27971
+ const deadline = Date.now() + (options.timeoutMs ?? DEFAULT_TIMEOUT_MS3);
27972
+ const reported = new Map;
27973
+ let masterRow;
27974
+ while (Date.now() < deadline) {
27975
+ await new Promise((resolve3) => setTimeout(resolve3, pollIntervalMs));
27976
+ const jobs = await getJson(`${orchestrator}/odata/Jobs?$orderby=CreationTime desc&$top=15`, folderId);
27977
+ for (const job of jobs?.value ?? []) {
27978
+ const isMaster = job.Key === jobKey;
27979
+ const isChild = job.ParentJobKey === jobKey;
27980
+ if (!isMaster && !isChild)
27981
+ continue;
27982
+ if (reported.get(job.Key) !== job.State) {
27983
+ reported.set(job.Key, job.State);
27984
+ options.callbacks?.onLog?.(`${isMaster ? "job" : "child job"} ${job.Key}: ${job.State}` + `${job.HostMachineName ? ` on ${job.HostMachineName}` : ""}` + `${job.Info ? ` — ${job.Info.substring(0, 200)}` : ""}`);
27985
+ }
27986
+ if (isMaster)
27987
+ masterRow = job;
27988
+ }
27989
+ if (masterRow && TERMINAL_STATES.has(masterRow.State))
27990
+ break;
27991
+ }
27992
+ if (!masterRow || !TERMINAL_STATES.has(masterRow.State)) {
27993
+ return RunResult.failed(RunErrorCode.Timeout, `The just-in-time job ${jobKey} did not finish in time (last state: ${masterRow?.State ?? "unknown"}).`);
27994
+ }
27995
+ if (masterRow.Id !== undefined) {
27996
+ masterRow = await getJson(`${orchestrator}/odata/Jobs(${masterRow.Id})`, folderId) ?? masterRow;
27997
+ }
27998
+ const details = {
27999
+ jobKey,
28000
+ entryPoint: options.entryPoint,
28001
+ rawResult: JSON.stringify(masterRow)
28002
+ };
28003
+ if (masterRow.State === "Successful") {
28004
+ const result2 = RunResult.succeeded({ details });
28005
+ result2.rawStatus = "Successful";
28006
+ result2.output = parseOutputArguments(masterRow.OutputArguments);
28007
+ return result2;
28008
+ }
28009
+ const result = RunResult.failed(RunErrorCode.ExecutionFailed, masterRow.Info || `The just-in-time job ended ${masterRow.State}.`, { details });
28010
+ result.rawStatus = masterRow.State;
28011
+ return result;
28012
+ }
28013
+ function parseOutputArguments(raw) {
28014
+ if (!raw)
28015
+ return;
28016
+ try {
28017
+ const parsed = JSON.parse(raw);
28018
+ return parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : undefined;
28019
+ } catch {
28020
+ return;
28021
+ }
28022
+ }
28023
+
27756
28024
  // src/executor/rpa-project-executor.ts
27757
28025
  var FALLBACK_ENTRY_POINT = "Main.xaml";
27758
28026
  var START_EXECUTION = "StartExecution";
@@ -27764,12 +28032,17 @@ var defaultRunnerFactory = (projectDir, timeoutMs) => new HelmRunService(new Stu
27764
28032
 
27765
28033
  class RpaProjectExecutor extends ProjectExecutor {
27766
28034
  createRunner;
27767
- constructor(fileSystem, logger2, createRunner = defaultRunnerFactory) {
28035
+ runOnline;
28036
+ constructor(fileSystem, logger2, createRunner = defaultRunnerFactory, runOnline = runJitOnlineAsync) {
27768
28037
  super(fileSystem, logger2);
27769
28038
  this.createRunner = createRunner;
28039
+ this.runOnline = runOnline;
27770
28040
  }
27771
28041
  async runAsync(options, cancellationToken) {
27772
28042
  const { project } = options;
28043
+ if (String(options.target) === "Online") {
28044
+ return this.runOnline(options, { logger: this.logger, hostName: os5.hostname() }, cancellationToken);
28045
+ }
27773
28046
  if (options.target !== RunTarget.Local) {
27774
28047
  return RunResult.failed(RunErrorCode.InvalidInput, `RPA projects execute on this machine through Studio, so they need target '${RunTarget.Local}'; got '${options.target}'.`);
27775
28048
  }
@@ -27814,6 +28087,32 @@ class RpaProjectExecutor extends ProjectExecutor {
27814
28087
  cancellationToken.removeEventListener("abort", onAbort);
27815
28088
  }
27816
28089
  }
28090
+ async buildJitProcessEntriesAsync(projects, context) {
28091
+ const entries = [];
28092
+ for (const project of projects) {
28093
+ if (!RPA_PROJECT_TYPES.includes(project.projectType)) {
28094
+ this.logger.info(`Skipping '${project.name}' (${project.projectType}): not an RPA project type.`);
28095
+ continue;
28096
+ }
28097
+ const useCloud = Boolean(project.cloudProjectId && context.solutionId);
28098
+ if (!useCloud && !project.projectPath) {
28099
+ this.logger.warn(`Skipping '${project.name}': no local directory and no snapshot id to run just-in-time from.`);
28100
+ continue;
28101
+ }
28102
+ const entryPoint = project.projectPath ? await this.resolveDefaultEntryPoint(project.projectPath) ?? FALLBACK_ENTRY_POINT : FALLBACK_ENTRY_POINT;
28103
+ entries.push(buildRpaJitProcessEntry({
28104
+ name: project.name,
28105
+ projectType: project.projectType,
28106
+ entryPointPath: entryPoint,
28107
+ ...useCloud ? { cloudProjectId: project.cloudProjectId } : { localProjectPath: project.projectPath }
28108
+ }, {
28109
+ solutionName: context.solutionName,
28110
+ folderId: context.folderId,
28111
+ solutionId: context.solutionId
28112
+ }));
28113
+ }
28114
+ return entries;
28115
+ }
27817
28116
  async resolveDefaultEntryPoint(projectPath) {
27818
28117
  return await this.mainFromProjectFile(projectPath) ?? await super.resolveDefaultEntryPoint(projectPath);
27819
28118
  }
@@ -27859,7 +28158,7 @@ class RpaProjectExecutor extends ProjectExecutor {
27859
28158
  }
27860
28159
  const result = RunResult.succeeded({ details });
27861
28160
  result.rawStatus = "Completed";
27862
- result.output = parseOutputArguments(parsed.output);
28161
+ result.output = parseOutputArguments2(parsed.output);
27863
28162
  return result;
27864
28163
  }
27865
28164
  }
@@ -27869,7 +28168,7 @@ function messageOf(error) {
27869
28168
  function serializeInputArguments(inputArguments) {
27870
28169
  return inputArguments && Object.keys(inputArguments).length > 0 ? JSON.stringify(inputArguments) : "";
27871
28170
  }
27872
- function parseOutputArguments(output) {
28171
+ function parseOutputArguments2(output) {
27873
28172
  if (!output) {
27874
28173
  return;
27875
28174
  }
package/dist/index.js CHANGED
@@ -10533,7 +10533,6 @@ var TLS_ERROR_CODES = new Set([
10533
10533
  ]);
10534
10534
  var TLS_INSTRUCTIONS = "The server's TLS certificate could not be verified. Most often a " + "corporate proxy/firewall re-signs HTTPS with a root CA that Node does " + "not trust — set NODE_EXTRA_CA_CERTS to that CA's PEM file (and HTTPS_PROXY " + "if you connect through a proxy). If the certificate is instead expired or " + "its hostname does not match, fix the endpoint URL or the system clock. " + "Then retry.";
10535
10535
  var NETWORK_INSTRUCTIONS = "Could not reach the UiPath service. Check your network connection and " + "VPN, confirm any HTTP_PROXY/HTTPS_PROXY/NO_PROXY settings are correct, " + "then retry.";
10536
- var LOCAL_PERMISSION_ERROR_CODES = new Set(["EACCES", "EPERM", "EROFS"]);
10537
10536
  var import__2 = __toESM2(require_commander2(), 1);
10538
10537
  var {
10539
10538
  program: program2,
@@ -10581,16 +10580,6 @@ function singleton(ctorOrName) {
10581
10580
  }
10582
10581
  };
10583
10582
  }
10584
- var previewSlot = singleton("PreviewBuild");
10585
- function isPreviewBuild() {
10586
- return previewSlot.get(false) ?? false;
10587
- }
10588
- Command2.prototype.previewCommand = function(nameAndArgs, opts) {
10589
- if (isPreviewBuild()) {
10590
- return this.command(nameAndArgs, opts);
10591
- }
10592
- return new Command2(nameAndArgs.split(/\s+/)[0] ?? nameAndArgs);
10593
- };
10594
10583
  function createStorage() {
10595
10584
  const [error, mod2] = catchError(() => __require2("node:async_hooks"));
10596
10585
  if (error || typeof mod2?.AsyncLocalStorage !== "function") {
@@ -10620,6 +10609,7 @@ var CONSOLE_FALLBACK = {
10620
10609
  function getOutputSink() {
10621
10610
  return outputStorage.getStore() ?? sinkSlot.get() ?? CONSOLE_FALLBACK;
10622
10611
  }
10612
+ var COMPLETER_SYMBOL = Symbol.for("@uipath/common/completer");
10623
10613
  var logFilePathSlot = singleton("logFilePath");
10624
10614
  function setGlobalLogFilePath(path3) {
10625
10615
  logFilePathSlot.set(path3);
@@ -12214,7 +12204,6 @@ var CLI_ERROR_CODES = [
12214
12204
  "invalid_argument",
12215
12205
  "authentication_required",
12216
12206
  "permission_denied",
12217
- "local_permission_denied",
12218
12207
  "not_found",
12219
12208
  "rate_limited",
12220
12209
  "network_error",
@@ -12650,16 +12639,12 @@ function defaultErrorCodeForHttpStatus(status) {
12650
12639
  return "server_error";
12651
12640
  return;
12652
12641
  }
12653
- var LOCAL_PERMISSION_TEXT_PATTERN = /(?:\b|\()(?:EACCES|EPERM|EROFS)(?::\s|\))/;
12654
12642
  function defaultErrorCodeForFailure(data) {
12655
12643
  if (data.Result === RESULTS.Failure) {
12656
12644
  const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
12657
12645
  const errorCode = defaultErrorCodeForHttpStatus(status);
12658
12646
  if (errorCode)
12659
12647
  return errorCode;
12660
- if (status === undefined && (LOCAL_PERMISSION_TEXT_PATTERN.test(data.Message) || LOCAL_PERMISSION_TEXT_PATTERN.test(data.Instructions))) {
12661
- return "local_permission_denied";
12662
- }
12663
12648
  }
12664
12649
  return defaultErrorCodeForResult(data.Result);
12665
12650
  }
@@ -13066,7 +13051,6 @@ Command2.prototype.trackedAction = function(context, fn, properties) {
13066
13051
  telemetry.trackRequestResult(telemetryName, durationMs, success, baseProperties, requestContext);
13067
13052
  });
13068
13053
  };
13069
- var COMPLETER_SYMBOL = Symbol.for("@uipath/common/completer");
13070
13054
  var guardInstalledSlot = singleton("ConsoleGuardInstalled");
13071
13055
  var savedOriginalsSlot = singleton("ConsoleGuardOriginals");
13072
13056
  var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
@@ -13116,6 +13100,16 @@ var FAILURE_STATUSES = new Set([
13116
13100
  "canceled",
13117
13101
  "stopped"
13118
13102
  ]);
13103
+ var previewSlot = singleton("PreviewBuild");
13104
+ function isPreviewBuild() {
13105
+ return previewSlot.get(false) ?? false;
13106
+ }
13107
+ Command2.prototype.previewCommand = function(nameAndArgs, opts) {
13108
+ if (isPreviewBuild()) {
13109
+ return this.command(nameAndArgs, opts);
13110
+ }
13111
+ return new Command2(nameAndArgs.split(/\s+/)[0] ?? nameAndArgs);
13112
+ };
13119
13113
  var ScreenLogger;
13120
13114
  ((ScreenLogger2) => {
13121
13115
  function progress(message) {
@@ -13125,8 +13119,9 @@ var ScreenLogger;
13125
13119
  ScreenLogger2.progress = progress;
13126
13120
  })(ScreenLogger ||= {});
13127
13121
  var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
13128
- var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
13129
13122
  var factorySlot = singleton("PackagerFactoryProvider");
13123
+ var moduleSlot = singleton("ToolModuleProvider");
13124
+ var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
13130
13125
 
13131
13126
  // src/argv.ts
13132
13127
  function extractArg(argv, name, defaultValue) {