@uipath/agent-tool 1.202.0-preview.138 → 1.202.0-preview.140

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,7 +1,7 @@
1
1
  import {
2
2
  AgentDebugCancelledError,
3
3
  AgentDebugService
4
- } from "./packager-tool-093sw7vs.js";
4
+ } from "./packager-tool-08m4qeqw.js";
5
5
  import"./packager-tool-d1dzjvm7.js";
6
6
  import"./packager-tool-b098y4a2.js";
7
7
  import"./packager-tool-1yh8g550.js";
@@ -16425,6 +16425,59 @@ class FileSystemFileStorageProviderFactory {
16425
16425
  }
16426
16426
  }
16427
16427
 
16428
+ // ../solution-sdk/src/resources/providers/resource-builder-logger.ts
16429
+ var PLACEHOLDER = /\{(\w+)\}|%[sdifoOj]/g;
16430
+ function render(value) {
16431
+ if (typeof value === "string")
16432
+ return value;
16433
+ if (value === null || value === undefined)
16434
+ return String(value);
16435
+ if (typeof value !== "object")
16436
+ return String(value);
16437
+ try {
16438
+ return JSON.stringify(value) ?? String(value);
16439
+ } catch {
16440
+ return String(value);
16441
+ }
16442
+ }
16443
+ function interpolate(message, args) {
16444
+ const fields = args[0] !== null && typeof args[0] === "object" && !Array.isArray(args[0]) ? args[0] : undefined;
16445
+ const consumed = new Set;
16446
+ let positional = 0;
16447
+ const filled = message.replace(PLACEHOLDER, (match, name) => {
16448
+ if (name !== undefined) {
16449
+ if (fields && name in fields) {
16450
+ consumed.add(0);
16451
+ return render(fields[name]);
16452
+ }
16453
+ return match;
16454
+ }
16455
+ const index = positional;
16456
+ positional += 1;
16457
+ if (index >= args.length)
16458
+ return match;
16459
+ consumed.add(index);
16460
+ return render(args[index]);
16461
+ });
16462
+ const extra = args.filter((_, index) => !consumed.has(index)).map(render).filter((text) => text.length > 0);
16463
+ return extra.length > 0 ? `${filled} ${extra.join(" ")}` : filled;
16464
+ }
16465
+
16466
+ class CliResourceBuilderLoggerFactory {
16467
+ create(target) {
16468
+ const name = typeof target === "string" ? target : target.name;
16469
+ const line = (message, args) => `[${name}] ${interpolate(message, args)}`;
16470
+ return {
16471
+ trace: (message, ...args) => logger.debug(line(message, args)),
16472
+ debug: (message, ...args) => logger.debug(line(message, args)),
16473
+ info: (message, ...args) => logger.info(line(message, args)),
16474
+ warn: (message, ...args) => logger.warn(line(message, args)),
16475
+ error: (message, error, ...args) => logger.error(error ? `${line(message, args)}: ${error.message}` : line(message, args)),
16476
+ fatal: (message, ...args) => logger.error(line(message, args))
16477
+ };
16478
+ }
16479
+ }
16480
+
16428
16481
  // ../solution-sdk/src/resources/providers/solution-access-provider.ts
16429
16482
  var ORG_SCOPED_SERVICES = new Set(["apps", "authz"]);
16430
16483
 
@@ -16493,7 +16546,7 @@ class SolutionAccessProvider {
16493
16546
 
16494
16547
  // ../solution-sdk/src/resources/providers/resource-builder-init.ts
16495
16548
  async function createResourceBuilderServices() {
16496
- return await createResourceBuilderConfiguration().addAccessProvider(new SolutionAccessProvider).addFileStorageProviderFactory(new FileSystemFileStorageProviderFactory).addArtifactResourceSpecEnhancer(new EntryPointSpecEnhancer).build();
16549
+ return await createResourceBuilderConfiguration().addAccessProvider(new SolutionAccessProvider).addFileStorageProviderFactory(new FileSystemFileStorageProviderFactory).addArtifactResourceSpecEnhancer(new EntryPointSpecEnhancer).addLoggerFactory(new CliResourceBuilderLoggerFactory).build();
16497
16550
  }
16498
16551
 
16499
16552
  // ../solution-sdk/src/resources/commands/project-utils.ts
@@ -17459,4 +17512,4 @@ export {
17459
17512
  writeSolutionFile
17460
17513
  };
17461
17514
 
17462
- //# debugId=D95D95BCB702789864756E2164756E21
17515
+ //# debugId=E38E3CC0ECFF4F5B64756E2164756E21
package/dist/index.js CHANGED
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  metadata,
4
4
  registerCommands
5
- } from "./packager-tool-zr68gy0n.js";
5
+ } from "./packager-tool-vryzbaey.js";
6
6
  import"./packager-tool-a42jnpy5.js";
7
7
  import"./packager-tool-c23zrhj8.js";
8
- import"./packager-tool-093sw7vs.js";
8
+ import"./packager-tool-08m4qeqw.js";
9
9
  import {
10
10
  Command
11
11
  } from "./packager-tool-d1dzjvm7.js";
@@ -2971,7 +2971,7 @@ function querystringSingleKey2(key, value, keyPrefix = "") {
2971
2971
  var package_default = {
2972
2972
  name: "@uipath/solution-sdk",
2973
2973
  license: "MIT",
2974
- version: "1.202.0-preview.138",
2974
+ version: "1.202.0-preview.140",
2975
2975
  repository: {
2976
2976
  type: "git",
2977
2977
  url: "https://github.com/UiPath/cli.git",
@@ -3046,6 +3046,7 @@ class SolutionUploadHttpError extends Error {
3046
3046
  solutionId;
3047
3047
  parsedErrorCode;
3048
3048
  parsedErrorMessage;
3049
+ authChallenge;
3049
3050
  constructor(details) {
3050
3051
  super(details.message);
3051
3052
  this.name = "SolutionUploadHttpError";
@@ -3058,6 +3059,7 @@ class SolutionUploadHttpError extends Error {
3058
3059
  if (details.operation === "overwrite") {
3059
3060
  this.solutionId = details.solutionId;
3060
3061
  }
3062
+ this.authChallenge = details.authChallenge;
3061
3063
  const parsed = parseUploadErrorBody(details.body);
3062
3064
  this.parsedErrorCode = parsed.code;
3063
3065
  this.parsedErrorMessage = parsed.message;
@@ -3081,16 +3083,71 @@ function requestPath(url) {
3081
3083
  const [, parsed] = catchError(() => new URL(url));
3082
3084
  return parsed ? `${parsed.pathname}${parsed.search}` : url;
3083
3085
  }
3086
+ var TOKEN_SHAPED = /\beyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]*)?|\bBearer\s+[A-Za-z0-9._~+/=-]{8,}/gi;
3087
+ function redactTokens(text) {
3088
+ return text.replace(TOKEN_SHAPED, "[REDACTED]");
3089
+ }
3090
+ var MAX_CHALLENGE_DESCRIPTION = 200;
3091
+ function parseAuthChallenge(header) {
3092
+ if (!header)
3093
+ return {};
3094
+ const code = /\berror="([^"]*)"/.exec(header)?.[1]?.trim();
3095
+ const raw = /\berror_description="([^"]*)"/.exec(header)?.[1]?.trim();
3096
+ const description = raw ? redactTokens(raw).slice(0, MAX_CHALLENGE_DESCRIPTION) : undefined;
3097
+ return {
3098
+ error: code || undefined,
3099
+ description: description || undefined
3100
+ };
3101
+ }
3102
+ function summarizeAuthRefusalBody(body) {
3103
+ return summarizePlatformBody(redactTokens(body));
3104
+ }
3105
+ function isAuthRefusal(status) {
3106
+ return status === 401 || status === 403;
3107
+ }
3108
+ function buildAuthRefusalInstructions({
3109
+ err,
3110
+ subject,
3111
+ target,
3112
+ bodySuffix,
3113
+ identityType,
3114
+ clientId
3115
+ }) {
3116
+ const refusal = err.status === 401 ? "rejected the call as unauthorized (401)" : "forbade the call (403)";
3117
+ const what = err.operation === "overwrite" ? `replacing the contents of solution ${target}` : "importing the solution package";
3118
+ const actor = identityType === "Application" ? `This session acts as external application ${clientId ?? "(client id unknown)"}, so ` + `check what that application is allowed to do: it needs the Studio ` + `Web scopes that cover writing a solution (the StudioWebS2S grants ` + `on the external application), not just the Orchestrator or ` + `Solutions ones. ` : identityType === "User" ? `This session acts as a user, so check that your account has ` + `Studio Web access in this tenant. ` : `Check what this session is allowed to do in Studio Web — an ` + `external application needs the StudioWebS2S grants that cover ` + `writing a solution, a user needs Studio Web access in the tenant. `;
3119
+ const tenant = err.operation === "overwrite" ? `Also confirm that ${target} is the solution this project should ` + `publish to, and that it lives in the organization and tenant ` + `this session logged into — the id comes from the SolutionId ` + `recorded in the enclosing solution file. An id this session ` + `cannot see at all is reported separately, as nothing to ` + `overwrite, so a refusal here points at the grants first. ` : `Also confirm you are logged into the organization and tenant the ` + `solution should land in. `;
3120
+ const challenge = parseAuthChallenge(err.authChallenge);
3121
+ const quoted = challenge.description ? ` ("${challenge.description}")` : "";
3122
+ if (challenge.error === "invalid_token") {
3123
+ return `Studio Web ${refusal} while ${what}, and rejected the credential ` + `itself with the reason \`invalid_token\`${quoted}. That is the ` + `platform refusing this token rather than the permissions behind ` + `it, so unlike a grants refusal this one is worth a fresh ` + `\`uip login\` — or, in a pipeline, a newly minted ` + `client-credentials token. Check too that the token was issued for ` + `the organization being called: one minted against a different ` + `environment or audience is refused this way. Nothing was uploaded ` + `and nothing ran, so the ${subject} is not the cause.${bodySuffix}`;
3124
+ }
3125
+ const authenticated = `The session is authenticated — the token was issued and had not ` + `expired when the call went out — so re-running \`uip login\` mints ` + `the same token and fails the same way. `;
3126
+ const diagnosis = challenge.error === "insufficient_scope" ? `Studio Web reported \`insufficient_scope\`${quoted}, so the ` + `token is valid and simply not allowed to do this: logging in ` + `again will not change it. ` : challenge.error ? `${authenticated}Studio Web gave the reason ` + `\`${challenge.error}\`${quoted}. ` : authenticated;
3127
+ const closing = bodySuffix ? `If the grants and the tenant are already right, report the platform ` + `response, including its traceId.${bodySuffix}` : challenge.error ? `If the grants and the tenant are already right, report that reason ` + `together with the request path and status above.` : `If the grants and the tenant are already right, report the request ` + `path and status above — Studio Web returned no response body and ` + `no authentication challenge, so there is nothing further to quote.`;
3128
+ return `Studio Web ${refusal} while ${what}. ${diagnosis}${actor}${tenant}` + `Nothing was uploaded and nothing ran, so the ${subject} is not the ` + `cause. ${closing}`;
3129
+ }
3084
3130
  function buildSolutionUploadFailureOutput(err, options = {}) {
3085
3131
  const stage = err.operation === "overwrite" ? "overwrite-solution" : "import-solution";
3086
- const detail = err.parsedErrorMessage ? ` — ${err.parsedErrorMessage}` : "";
3132
+ const authRefusal = isAuthRefusal(err.status);
3133
+ const parsedMessage = authRefusal && err.parsedErrorMessage ? redactTokens(err.parsedErrorMessage) : err.parsedErrorMessage;
3134
+ const detail = parsedMessage ? ` — ${parsedMessage}` : "";
3087
3135
  const Message = `Failed during ${stage}: HTTP ${err.status} on ${err.method} ` + `${err.endpoint}${detail}`;
3088
- const body = err.parsedErrorMessage ? "" : summarizePlatformBody(err.body);
3136
+ const quote = authRefusal ? summarizeAuthRefusalBody : summarizePlatformBody;
3137
+ const body = err.parsedErrorMessage ? "" : quote(err.body);
3089
3138
  const bodySuffix = body ? ` Platform response: "${body}".` : "";
3090
3139
  const importHint = options.importCheckHint ? ` ${options.importCheckHint}` : "";
3091
3140
  const subject = options.subject ?? "project";
3092
3141
  const target = err.solutionId ?? `the solution at ${err.endpoint}`;
3093
- const Instructions = err.operation === "overwrite" ? `Studio Web refused to replace the contents of solution ` + `${target}. Nothing was uploaded and nothing ran, so the ` + `${subject} is not the cause: do not re-author it, and do not ` + `copy the project into another solution. Confirm that ${target} ` + `is a solution you can still write to, and that it is the one ` + `this project should publish to — it comes from the SolutionId ` + `recorded in the enclosing solution file. If it is right, report ` + `the platform response.${bodySuffix}` : `Studio Web refused to import the solution package. Nothing was ` + `uploaded and nothing ran, so no part of the ${subject} executed ` + `— but the package itself may be what was rejected.${importHint} ` + `Report the platform response if the ${subject} is ` + `well-formed.${bodySuffix}`;
3142
+ const authInstructions = isAuthRefusal(err.status) ? buildAuthRefusalInstructions({
3143
+ err,
3144
+ subject,
3145
+ target,
3146
+ bodySuffix,
3147
+ identityType: options.identityType,
3148
+ clientId: options.clientId
3149
+ }) : undefined;
3150
+ const Instructions = authInstructions ?? (err.operation === "overwrite" ? `Studio Web refused to replace the contents of solution ` + `${target}. Nothing was uploaded and nothing ran, so the ` + `${subject} is not the cause: do not re-author it, and do not ` + `copy the project into another solution. Confirm that ${target} ` + `is a solution you can still write to, and that it is the one ` + `this project should publish to — it comes from the SolutionId ` + `recorded in the enclosing solution file. If it is right, report ` + `the platform response.${bodySuffix}` : `Studio Web refused to import the solution package. Nothing was ` + `uploaded and nothing ran, so no part of the ${subject} executed ` + `— but the package itself may be what was rejected.${importHint} ` + `Report the platform response if the ${subject} is ` + `well-formed.${bodySuffix}`);
3094
3151
  const Context = {
3095
3152
  httpStatus: err.status,
3096
3153
  stage,
@@ -3106,6 +3163,9 @@ function buildSolutionUploadFailureOutput(err, options = {}) {
3106
3163
  Instructions,
3107
3164
  Context
3108
3165
  };
3166
+ if (err.status === 401 && options.identityType === "Application") {
3167
+ output.ErrorCode = "permission_denied";
3168
+ }
3109
3169
  if (err.operation === "overwrite" && err.status >= 500 && err.status < 600) {
3110
3170
  output.Retry = "RetryAfter30Seconds";
3111
3171
  }
@@ -3166,6 +3226,7 @@ async function importSolution(config, organizationName, fileBuffer, fileName) {
3166
3226
  endpoint: requestPath(importUrl),
3167
3227
  url: importUrl,
3168
3228
  body: text,
3229
+ authChallenge: response.headers?.get("www-authenticate") ?? undefined,
3169
3230
  message: `Import failed (${response.status}): ${text}`
3170
3231
  });
3171
3232
  }
@@ -3197,6 +3258,7 @@ async function overwriteSolution(config, organizationName, fileBuffer, fileName,
3197
3258
  endpoint: requestPath(overwriteUrl),
3198
3259
  url: overwriteUrl,
3199
3260
  body: text,
3261
+ authChallenge: response.headers?.get("www-authenticate") ?? undefined,
3200
3262
  message: `Overwrite failed (${response.status}): ${text}`,
3201
3263
  solutionId
3202
3264
  });
@@ -4176,4 +4238,4 @@ function parseOutput(outputArguments) {
4176
4238
 
4177
4239
  export { StudioWebIncompatibleProjectError, isSolutionUploadHttpError, buildSolutionUploadFailureOutput, migrateLegacyToolGuardrailPolicies, AgentProjectService, resolveStudioWebConfig, AgentLocalWorkspaceEvalPreparer, AgentDebugCancelledError, AgentDebugService };
4178
4240
 
4179
- //# debugId=218744BFB32146DD64756E2164756E21
4241
+ //# debugId=521D939E8859D73C64756E2164756E21
@@ -13,7 +13,7 @@ import {
13
13
  isSolutionUploadHttpError,
14
14
  migrateLegacyToolGuardrailPolicies,
15
15
  resolveStudioWebConfig
16
- } from "./packager-tool-093sw7vs.js";
16
+ } from "./packager-tool-08m4qeqw.js";
17
17
  import {
18
18
  OutputFormatter,
19
19
  RESULTS,
@@ -6989,7 +6989,7 @@ var require_index_cjs = __commonJS(function(exports, module) {
6989
6989
  var package_default = {
6990
6990
  name: "@uipath/agent-tool",
6991
6991
  license: "MIT",
6992
- version: "1.202.0-preview.138",
6992
+ version: "1.202.0-preview.140",
6993
6993
  description: "cli plugin for creating and managing UiPath low-code agents",
6994
6994
  private: false,
6995
6995
  repository: {
@@ -7432,7 +7432,7 @@ class VoidApiResponse {
7432
7432
  var package_default2 = {
7433
7433
  name: "@uipath/agent-sdk",
7434
7434
  license: "MIT",
7435
- version: "1.202.0-preview.138",
7435
+ version: "1.202.0-preview.140",
7436
7436
  description: "SDK for the UiPath Agent Runtime API — evaluation execution and debug sessions.",
7437
7437
  repository: {
7438
7438
  type: "git",
@@ -12793,7 +12793,7 @@ var registerGuardrailCommands = (program) => {
12793
12793
 
12794
12794
  // src/services/project-artifacts.ts
12795
12795
  async function ensureProjectArtifacts(args) {
12796
- const { addProjectArtifactsToSolutionAsync } = await import("./index-ttrh2gr5.js");
12796
+ const { addProjectArtifactsToSolutionAsync } = await import("./index-jwjhhxdx.js");
12797
12797
  return addProjectArtifactsToSolutionAsync(args);
12798
12798
  }
12799
12799
 
@@ -35285,7 +35285,7 @@ class TextApiResponse {
35285
35285
  var package_default3 = {
35286
35286
  name: "@uipath/integrationservice-sdk",
35287
35287
  license: "MIT",
35288
- version: "1.202.0-preview.138",
35288
+ version: "1.202.0-preview.140",
35289
35289
  repository: {
35290
35290
  type: "git",
35291
35291
  url: "https://github.com/UiPath/cli.git",
@@ -45222,4 +45222,4 @@ var registerCommands = async (program) => {
45222
45222
 
45223
45223
  export { metadata, registerCommands };
45224
45224
 
45225
- //# debugId=669594ECC629ACED64756E2164756E21
45225
+ //# debugId=EDB9AFAC2867FC5164756E2164756E21
package/dist/tool.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  metadata,
3
3
  registerCommands
4
- } from "./packager-tool-zr68gy0n.js";
4
+ } from "./packager-tool-vryzbaey.js";
5
5
  import"./packager-tool-a42jnpy5.js";
6
6
  import"./packager-tool-c23zrhj8.js";
7
- import"./packager-tool-093sw7vs.js";
7
+ import"./packager-tool-08m4qeqw.js";
8
8
  import"./packager-tool-d1dzjvm7.js";
9
9
  import"./packager-tool-0srzfhdr.js";
10
10
  import"./packager-tool-b098y4a2.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/agent-tool",
3
3
  "license": "MIT",
4
- "version": "1.202.0-preview.138",
4
+ "version": "1.202.0-preview.140",
5
5
  "description": "cli plugin for creating and managing UiPath low-code agents",
6
6
  "private": false,
7
7
  "repository": {
@@ -28,5 +28,5 @@
28
28
  "files": [
29
29
  "dist"
30
30
  ],
31
- "gitHead": "46372d5c4c4ae9352e9457a99e9d5efc1890cb48"
31
+ "gitHead": "1861498d8a158a710a718c04614523ba59c93781"
32
32
  }