@uipath/agent-tool 1.206.0-preview.295 → 1.206.0-preview.297

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,8 +1,8 @@
1
1
  import {
2
- parseJWT,
3
- getLoginStatusAsync,
4
- getAuthContext
5
- } from "./packager-tool-qr8dtv3r.js";
2
+ parseJWT2,
3
+ getLoginStatusAsync2,
4
+ getAuthContext2
5
+ } from "./packager-tool-9xrkfzn1.js";
6
6
  import {
7
7
  getFileSystem
8
8
  } from "./packager-tool-0ajs8pnk.js";
@@ -13,8 +13,12 @@ import {
13
13
  extractErrorMessageSync,
14
14
  appendOption,
15
15
  ATTACHMENT_UPLOAD_INSTRUCTIONS,
16
+ redactTokens,
17
+ parseAuthChallenge,
16
18
  RESULTS,
19
+ classifiedFailure,
17
20
  authContextFailure,
21
+ summarizePlatformBody,
18
22
  logger,
19
23
  OutputFormatter,
20
24
  processContext,
@@ -22,16 +26,16 @@ import {
22
26
  getSdkUserAgentToken,
23
27
  addSdkUserAgentHeader,
24
28
  installSdkUserAgentHeader
25
- } from "./packager-tool-21r3phhc.js";
29
+ } from "./packager-tool-dy6gcgks.js";
26
30
  import {
27
31
  JobAttachmentUploadError2
28
- } from "./packager-tool-z6a5nr2d.js";
32
+ } from "./packager-tool-2dd1qswc.js";
29
33
  import {
30
34
  StudioWebIncompatibleProjectError2,
31
35
  UipignoreExcludesProjectError2,
32
36
  isSolutionUploadHttpError2,
33
37
  buildSolutionUploadFailureOutput2
34
- } from "./packager-tool-nn9yhedj.js";
38
+ } from "./packager-tool-xt86c1ek.js";
35
39
  import {
36
40
  migrateLegacyToolGuardrailPolicies,
37
41
  AgentProjectService,
@@ -43,7 +47,7 @@ import {
43
47
  AgentDebugAttachmentUploadError,
44
48
  AgentDebugStartOutcomeUnknownError,
45
49
  AgentDebugService
46
- } from "./packager-tool-c0et0svf.js";
50
+ } from "./packager-tool-b0fh39zt.js";
47
51
  import {
48
52
  string,
49
53
  uuid,
@@ -75,7 +79,7 @@ import {
75
79
  import {
76
80
  prepareProjectLocation2,
77
81
  tryRegisterProjectInParentSolution2
78
- } from "./packager-tool-4j09ztk2.js";
82
+ } from "./packager-tool-3t6d1zdz.js";
79
83
  import {
80
84
  __toESM,
81
85
  __commonJS
@@ -7077,7 +7081,7 @@ var package_default = {
7077
7081
  name: "@uipath/agent-tool",
7078
7082
  author: "UiPath",
7079
7083
  license: "SEE LICENSE IN LICENSE.txt",
7080
- version: "1.206.0-preview.295",
7084
+ version: "1.206.0-preview.297",
7081
7085
  description: "cli plugin for creating and managing UiPath low-code agents",
7082
7086
  private: false,
7083
7087
  repository: {
@@ -7183,7 +7187,7 @@ function parsePositiveNumber(value, flag) {
7183
7187
  }
7184
7188
  var registerDebugCommand = (program) => {
7185
7189
  program.command("debug").description("Debug a low-code agent by running it on Studio Web and streaming the result. Job-attachment inputs can be supplied from local files with --attachment field=path.").argument("<project-path>", "Path to the agent project directory (containing agent.json)").option("-i, --inputs <json>", `Input arguments as JSON string (e.g. '{"input":"hello"}'). For a job-attachment field pass an existing Orchestrator attachment reference {"ID": "<attachment-id>"} (Data.Attachments of a previous --attachment run lists the IDs), or use --attachment to upload a local file.`).option("--attachment <field=path>", 'Upload a local file into a job-attachment input field of agent.json (repeatable). Format: field=path, e.g. --attachment fileIn=./invoice.pdf. The field must be declared as {"$ref": "#/definitions/job-attachment"} in inputSchema. Uploaded attachment IDs are returned in Data.Attachments.', appendOption, []).option("--poll-interval <ms>", "Polling interval in milliseconds", "2000").option("--timeout <seconds>", "Maximum seconds to wait for the debug run to finish").option("--login-validity <minutes>", "Minimum minutes before token expiration", (v) => Number.parseInt(v, 10), 10).examples(AGENT_DEBUG_EXAMPLES).trackedAction(processContext, async (projectPath, options) => {
7186
- const [authError, authContext] = await catchError(getAuthContext({
7190
+ const [authError, authContext] = await catchError(getAuthContext2({
7187
7191
  ensureTokenValidityMinutes: options.loginValidity,
7188
7192
  requireOrganizationId: true,
7189
7193
  requireTenantName: true
@@ -7606,7 +7610,7 @@ var package_default2 = {
7606
7610
  name: "@uipath/agent-sdk",
7607
7611
  author: "UiPath",
7608
7612
  license: "SEE LICENSE IN LICENSE.txt",
7609
- version: "1.206.0-preview.295",
7613
+ version: "1.206.0-preview.297",
7610
7614
  description: "SDK for the UiPath Agent Runtime API — evaluation execution and debug sessions.",
7611
7615
  repository: {
7612
7616
  type: "git",
@@ -8909,7 +8913,7 @@ class EvalsTenantExecutionApi extends BaseAPI {
8909
8913
  }
8910
8914
  // ../agent-sdk/src/client-factory.ts
8911
8915
  async function createAgentRuntimeConfig(options) {
8912
- const ctx = await getAuthContext({
8916
+ const ctx = await getAuthContext2({
8913
8917
  ensureTokenValidityMinutes: options?.loginValidity,
8914
8918
  requireOrganizationId: true,
8915
8919
  requireTenantId: true
@@ -9239,6 +9243,50 @@ class EvalService {
9239
9243
  }
9240
9244
  }
9241
9245
 
9246
+ // src/commands/eval/runtime-failure.ts
9247
+ async function evalRuntimeFailure(message, error) {
9248
+ const response = error?.response;
9249
+ const status = response?.status;
9250
+ const responseCopy = status === 401 || status === 403 ? cloneResponse(response) : undefined;
9251
+ const failure = await classifiedFailure(message, error);
9252
+ if (!response || status !== 401 && status !== 403 || failure.Result !== RESULTS.AuthenticationError) {
9253
+ return failure;
9254
+ }
9255
+ const challenge = parseAuthChallenge(response.headers?.get?.("www-authenticate") ?? undefined);
9256
+ const challengeReason = challenge.error ? `${challenge.error}${challenge.description ? `: ${challenge.description}` : ""}` : challenge.description;
9257
+ const bodyReason = await refusalBody(responseCopy);
9258
+ const reason = challengeReason ?? bodyReason;
9259
+ const refusal = status === 401 ? "The Agents runtime rejected this session's token (HTTP 401)" : "The Agents runtime forbade the call (HTTP 403)";
9260
+ const said = reason ? `${refusal}: ${reason}.` : `${refusal}.`;
9261
+ const invalidAudience = status === 401 && challenge.error?.toLowerCase() === "invalid_token" && /\baudience\b/i.test(challenge.description ?? "") && /\binvalid\b/i.test(challenge.description ?? "");
9262
+ const identity = invalidAudience ? await sessionIdentity() : undefined;
9263
+ if (identity?.type === "Application") {
9264
+ return {
9265
+ ...failure,
9266
+ Instructions: `${said} This session acts as external application ` + `${identity.clientId ?? "(client id unknown)"}, and the ` + `Agents runtime rejected that application's token audience. ` + `Confirm with the Agents runtime owner whether evaluation ` + `runs support client credentials and which token audience ` + `and scopes they require before changing the login ` + `configuration.`
9267
+ };
9268
+ }
9269
+ return { ...failure, Instructions: `${said} ${failure.Instructions}` };
9270
+ }
9271
+ function cloneResponse(response) {
9272
+ const [error, copy] = catchError(() => response?.clone?.());
9273
+ return error ? undefined : copy;
9274
+ }
9275
+ async function refusalBody(response) {
9276
+ const text = response?.text?.bind(response);
9277
+ if (!text)
9278
+ return;
9279
+ const [error, body] = await catchError(text());
9280
+ if (error || !body?.trim())
9281
+ return;
9282
+ return summarizePlatformBody(redactTokens(body));
9283
+ }
9284
+ async function sessionIdentity() {
9285
+ const { getAuthContext } = await import("./index-kvhrzcvf.js");
9286
+ const [, ctx] = await catchError(getAuthContext());
9287
+ return ctx?.identity;
9288
+ }
9289
+
9242
9290
  // src/commands/eval/eval-run.ts
9243
9291
  var EVAL_RUN_START_EXAMPLES = [
9244
9292
  {
@@ -9600,9 +9648,7 @@ var registerEvalRunCommands = (evalCmd) => {
9600
9648
  evalSetMultipleEvaluatorsStartRequest: payload
9601
9649
  }));
9602
9650
  if (startError) {
9603
- const resp = startError.response;
9604
- const body = resp?.text ? await resp.text() : "";
9605
- throw new Error(`API error starting eval: ${body || startError.message}`);
9651
+ throw startError;
9606
9652
  }
9607
9653
  const result = await rawResponse.raw.json();
9608
9654
  OutputFormatter.success({
@@ -9651,11 +9697,23 @@ var registerEvalRunCommands = (evalCmd) => {
9651
9697
  }
9652
9698
  })());
9653
9699
  if (error) {
9654
- OutputFormatter.error({
9655
- Result: RESULTS.Failure,
9656
- Message: "Failed to start evaluation run",
9657
- Instructions: error.message
9658
- });
9700
+ const {
9701
+ buildSolutionUploadFailureOutput,
9702
+ isSolutionUploadHttpError
9703
+ } = await import("./index-gsagrm9w.js");
9704
+ if (isSolutionUploadHttpError(error)) {
9705
+ const failure = buildSolutionUploadFailureOutput(error, {
9706
+ subject: "agent",
9707
+ importCheckHint: "Run 'uip agent validate' to confirm the project is well-formed."
9708
+ });
9709
+ OutputFormatter.error({
9710
+ ...failure,
9711
+ Message: "Failed to start evaluation run",
9712
+ Instructions: `${failure.Message}. ${failure.Instructions}`
9713
+ });
9714
+ return;
9715
+ }
9716
+ OutputFormatter.error(await evalRuntimeFailure("Failed to start evaluation run", error));
9659
9717
  processContext.exit(1);
9660
9718
  }
9661
9719
  });
@@ -9695,11 +9753,7 @@ var registerEvalRunCommands = (evalCmd) => {
9695
9753
  });
9696
9754
  })());
9697
9755
  if (error) {
9698
- OutputFormatter.error({
9699
- Result: RESULTS.Failure,
9700
- Message: "Failed to get evaluation run status",
9701
- Instructions: error.message
9702
- });
9756
+ OutputFormatter.error(await evalRuntimeFailure("Failed to get evaluation run status", error));
9703
9757
  processContext.exit(1);
9704
9758
  }
9705
9759
  });
@@ -9789,11 +9843,7 @@ var registerEvalRunCommands = (evalCmd) => {
9789
9843
  });
9790
9844
  })());
9791
9845
  if (error) {
9792
- OutputFormatter.error({
9793
- Result: RESULTS.Failure,
9794
- Message: "Failed to get evaluation results",
9795
- Instructions: error.message
9796
- });
9846
+ OutputFormatter.error(await evalRuntimeFailure("Failed to get evaluation results", error));
9797
9847
  processContext.exit(1);
9798
9848
  }
9799
9849
  });
@@ -9839,11 +9889,7 @@ var registerEvalRunCommands = (evalCmd) => {
9839
9889
  });
9840
9890
  })());
9841
9891
  if (error) {
9842
- OutputFormatter.error({
9843
- Result: RESULTS.Failure,
9844
- Message: "Failed to list evaluation runs",
9845
- Instructions: error.message
9846
- });
9892
+ OutputFormatter.error(await evalRuntimeFailure("Failed to list evaluation runs", error));
9847
9893
  processContext.exit(1);
9848
9894
  }
9849
9895
  });
@@ -9927,11 +9973,7 @@ var registerEvalRunCommands = (evalCmd) => {
9927
9973
  });
9928
9974
  })());
9929
9975
  if (error) {
9930
- OutputFormatter.error({
9931
- Result: RESULTS.Failure,
9932
- Message: "Failed to compare evaluation runs",
9933
- Instructions: error.message
9934
- });
9976
+ OutputFormatter.error(await evalRuntimeFailure("Failed to compare evaluation runs", error));
9935
9977
  processContext.exit(1);
9936
9978
  }
9937
9979
  });
@@ -10370,7 +10412,7 @@ var SERVICE_PATH = {
10370
10412
  };
10371
10413
  var REQUESTING_PRODUCT = "uipath-cli";
10372
10414
  async function resolveAuth(options) {
10373
- const auth = await getAuthContext({
10415
+ const auth = await getAuthContext2({
10374
10416
  ensureTokenValidityMinutes: options?.loginValidity,
10375
10417
  requireOrganizationId: true
10376
10418
  });
@@ -10493,12 +10535,12 @@ async function getDiscoveryModels(options) {
10493
10535
  if (options.operationCode) {
10494
10536
  extraHeaders["X-UiPath-LlmGateway-OperationCode"] = options.operationCode;
10495
10537
  }
10496
- const status = await getLoginStatusAsync({
10538
+ const status = await getLoginStatusAsync2({
10497
10539
  ensureTokenValidityMinutes: options.loginValidity
10498
10540
  });
10499
10541
  if (status.accessToken) {
10500
10542
  try {
10501
- const claims = parseJWT(status.accessToken);
10543
+ const claims = parseJWT2(status.accessToken);
10502
10544
  if (typeof claims.sub === "string") {
10503
10545
  extraHeaders["X-UiPath-LlmGateway-UserId"] = claims.sub;
10504
10546
  }
@@ -10802,7 +10844,7 @@ var registerGuardrailCommands = (program) => {
10802
10844
 
10803
10845
  // src/services/project-artifacts.ts
10804
10846
  async function ensureProjectArtifacts(args) {
10805
- const { addProjectArtifactsToSolutionAsync } = await import("./index-41ykvvtr.js");
10847
+ const { addProjectArtifactsToSolutionAsync } = await import("./index-r7ff4pb0.js");
10806
10848
  return addProjectArtifactsToSolutionAsync(args);
10807
10849
  }
10808
10850
 
@@ -11302,7 +11344,7 @@ var SOLUTION_FOLDER = "solution_folder";
11302
11344
  // src/services/memory-space-solution-link.ts
11303
11345
  async function findEnclosingSolutionFile(projectPath) {
11304
11346
  const fs = getFileSystem();
11305
- const { findSolutionFileUpward } = await import("./index-2nhvaec5.js");
11347
+ const { findSolutionFileUpward } = await import("./index-gsagrm9w.js");
11306
11348
  const [error, solutionFile] = await catchError(findSolutionFileUpward(fs, fs.path.resolve(projectPath)));
11307
11349
  if (error) {
11308
11350
  if (error.message.startsWith("No .uipx solution file found")) {
@@ -11346,13 +11388,13 @@ async function readImportedResourceFolders(fs, solutionDir, tenantId) {
11346
11388
  return folders;
11347
11389
  }
11348
11390
  async function activeTenantId() {
11349
- const [error, status] = await catchError(getLoginStatusAsync());
11391
+ const [error, status] = await catchError(getLoginStatusAsync2());
11350
11392
  if (error || status.loginStatus !== "Logged in")
11351
11393
  return;
11352
11394
  return status.tenantId ?? undefined;
11353
11395
  }
11354
11396
  async function openSolution(solutionDir) {
11355
- const engine = await import("./index-41ykvvtr.js");
11397
+ const engine = await import("./index-r7ff4pb0.js");
11356
11398
  const services = await engine.createResourceBuilderServices();
11357
11399
  await engine.normalizeResourceFileCasing(solutionDir);
11358
11400
  const builder = await services.getSolutionBuilder(solutionDir);
@@ -11862,7 +11904,7 @@ async function resolveRuntimeTarget(memoryName, options) {
11862
11904
  if (options.folderKey === undefined && folderPath.toLowerCase() === SOLUTION_FOLDER) {
11863
11905
  throw new Error(`Feature "${feature.name}" points at ${SOLUTION_FOLDER}, the placeholder the deploy replaces with the deployment folder. Pass --folder-path <deployed folder path> or --folder-key <key> for the folder the solution is deployed to ('uip solution deploy list' shows it).`);
11864
11906
  }
11865
- const { findRuntimeMemorySpace, resolveRuntimeFolder } = await import("./memory-runtime-service-cp5eqzvz.js");
11907
+ const { findRuntimeMemorySpace, resolveRuntimeFolder } = await import("./memory-runtime-service-tt5y1af6.js");
11866
11908
  const folder = await resolveRuntimeFolder(options.folderKey !== undefined ? { folderKey: options.folderKey } : { folderPath });
11867
11909
  if (folder === undefined) {
11868
11910
  throw new Error("Memory items are not available in this build; use the uip CLI.");
@@ -12003,7 +12045,7 @@ var registerMemoryCommands = (program) => {
12003
12045
  const memoryType = parseMemoryType(options.memoryType);
12004
12046
  const request = buildItemRequest(memoryType, options);
12005
12047
  const target = await resolveRuntimeTarget(memoryName, options);
12006
- const { addRuntimeMemoryItem } = await import("./memory-runtime-service-cp5eqzvz.js");
12048
+ const { addRuntimeMemoryItem } = await import("./memory-runtime-service-tt5y1af6.js");
12007
12049
  const item = await addRuntimeMemoryItem(target.space.id, target.folder.key, request);
12008
12050
  OutputFormatter.success({
12009
12051
  Result: RESULTS.Success,
@@ -12036,7 +12078,7 @@ var registerMemoryCommands = (program) => {
12036
12078
  const [error] = await catchError((async () => {
12037
12079
  const memoryType = options.memoryType === undefined ? undefined : parseMemoryType(options.memoryType);
12038
12080
  const target = await resolveRuntimeTarget(memoryName, options);
12039
- const { listRuntimeMemoryItems } = await import("./memory-runtime-service-cp5eqzvz.js");
12081
+ const { listRuntimeMemoryItems } = await import("./memory-runtime-service-tt5y1af6.js");
12040
12082
  const items = await listRuntimeMemoryItems(target.space.id, target.folder.key, memoryType);
12041
12083
  OutputFormatter.success({
12042
12084
  Result: RESULTS.Success,
@@ -17926,7 +17968,7 @@ var package_default3 = {
17926
17968
  name: "@uipath/integrationservice-sdk",
17927
17969
  author: "UiPath",
17928
17970
  license: "SEE LICENSE IN LICENSE.txt",
17929
- version: "1.206.0-preview.295",
17971
+ version: "1.206.0-preview.297",
17930
17972
  repository: {
17931
17973
  type: "git",
17932
17974
  url: "https://github.com/UiPath/cli.git",
@@ -23699,7 +23741,7 @@ function resolveApiDomain(ApiClass) {
23699
23741
  return API_DOMAIN_MAP.get(ApiClass) ?? API_DOMAIN_BY_NAME.get(baseApiClassName(ApiClass.name));
23700
23742
  }
23701
23743
  async function getValidatedAuthContext(options) {
23702
- const ctx = await getAuthContext({
23744
+ const ctx = await getAuthContext2({
23703
23745
  tenant: options?.tenant,
23704
23746
  ensureTokenValidityMinutes: options?.loginValidity,
23705
23747
  requireOrganizationId: true,
@@ -28266,4 +28308,4 @@ var registerCommands2 = async (program) => {
28266
28308
 
28267
28309
  export { metadata2, registerCommands2 };
28268
28310
 
28269
- //# debugId=9C6F2514B1347BF964756E2164756E21
28311
+ //# debugId=64244DB26EE8B6C364756E2164756E21
@@ -3,7 +3,7 @@ import {
3
3
  logger,
4
4
  quoteForShell,
5
5
  unsupportedSolutionProjectType
6
- } from "./packager-tool-21r3phhc.js";
6
+ } from "./packager-tool-dy6gcgks.js";
7
7
 
8
8
  // ../solution-sdk/src/solution-file.ts
9
9
  var STUDIO_WEB_PROJECT_TYPE_OVERRIDES = {
@@ -1,10 +1,10 @@
1
1
  import {
2
- getAuthContext
3
- } from "./packager-tool-qr8dtv3r.js";
2
+ getAuthContext2
3
+ } from "./packager-tool-9xrkfzn1.js";
4
4
 
5
5
  // ../solution-sdk/src/solution-auth.ts
6
6
  async function getSolutionAuthContext2(options) {
7
- const ctx = await getAuthContext({
7
+ const ctx = await getAuthContext2({
8
8
  tenant: options.tenant,
9
9
  ensureTokenValidityMinutes: options.loginValidity ?? 10,
10
10
  envFilePath: options.envFilePath,
@@ -24,4 +24,4 @@ async function getSolutionAuthContext2(options) {
24
24
 
25
25
  export { getSolutionAuthContext2 };
26
26
 
27
- //# debugId=720557DFC760A35C64756E2164756E21
27
+ //# debugId=59B6698CEFEA9F4764756E2164756E21