@uipath/solution-tool 1.202.0-preview.137 → 1.202.0-preview.139

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.
Files changed (27) hide show
  1. package/dist/deploy.js +5 -5
  2. package/dist/index.js +13 -13
  3. package/dist/init.js +5 -5
  4. package/dist/{list-484rd8hx.js → list-ag3027x1.js} +3 -3
  5. package/dist/pack.js +6 -6
  6. package/dist/{packager-tool-kjjkk63a.js → packager-tool-12pcyrmh.js} +91 -24
  7. package/dist/{packager-tool-sba5cptt.js → packager-tool-1x1cc4qh.js} +8 -2
  8. package/dist/{packager-tool-fjr8yn4g.js → packager-tool-29bj4s4t.js} +1 -1
  9. package/dist/{packager-tool-6d4e44g7.js → packager-tool-5e69wxe2.js} +104 -31
  10. package/dist/{packager-tool-vxthsps3.js → packager-tool-6bhx9vfz.js} +1 -1
  11. package/dist/{packager-tool-xfg2cveb.js → packager-tool-8t3sjyk9.js} +1 -1
  12. package/dist/{packager-tool-3hbsdwjm.js → packager-tool-9dx65z2d.js} +3 -4
  13. package/dist/{packager-tool-zz9cxrqw.js → packager-tool-9ez6mf86.js} +4 -4
  14. package/dist/{packager-tool-8cw7djz6.js → packager-tool-ar7ae24x.js} +4 -4
  15. package/dist/{packager-tool-m7vg7dwj.js → packager-tool-n3ch3v36.js} +3 -3
  16. package/dist/{packager-tool-x3ehbhsn.js → packager-tool-nzghfa48.js} +2 -3
  17. package/dist/{packager-tool-n41f88jn.js → packager-tool-pc4hb3pv.js} +89 -7
  18. package/dist/{packager-tool-56b5tnnr.js → packager-tool-qpfkpph4.js} +108 -7
  19. package/dist/packager-tool.js +2 -2
  20. package/dist/publish.js +5 -5
  21. package/dist/resource.js +4 -4
  22. package/dist/services/governance-options.d.ts +4 -2
  23. package/dist/services/pack-command-service.d.ts +15 -0
  24. package/dist/services/packager-tool-resolver.d.ts +17 -0
  25. package/dist/templates/AGENTS.md +7 -1
  26. package/dist/tool.js +13 -13
  27. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  catchError,
3
3
  getFileSystem
4
- } from "./packager-tool-sba5cptt.js";
4
+ } from "./packager-tool-1x1cc4qh.js";
5
5
 
6
6
  // src/services/solution-init-service.ts
7
7
  var AGENTS_FILENAME = "AGENTS.md";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  toolsFactoryRepository
3
- } from "./packager-tool-x3ehbhsn.js";
3
+ } from "./packager-tool-nzghfa48.js";
4
4
  import {
5
5
  unzipSync,
6
6
  zipSync
@@ -1420,8 +1420,7 @@ class ToolsFactoryRepository {
1420
1420
  getProjectToolFactory(projectType) {
1421
1421
  const factory = this.projectFactoryMap.get(projectType);
1422
1422
  if (!factory) {
1423
- const known = [...this.projectFactoryMap.keys()].join(", ");
1424
- throw new Error(`Cannot pack project type '${projectType}': no packager is installed for it. ` + `Project types that can be packed: ${known || "none"}.`);
1423
+ throw new Error(`Cannot pack project type '${projectType}': no packager is installed for it.`);
1425
1424
  }
1426
1425
  return factory;
1427
1426
  }
@@ -2270,4 +2269,4 @@ function registerPackagerFactories() {
2270
2269
 
2271
2270
  export { Path, TemporaryStorageService, ZipService, I18nManager, translate, BuildConfiguration, LogLevel, LogMessage, TargetFramework, ToolErrorCodes, ToolResult, toolsFactoryRepository2 as toolsFactoryRepository, registerPackagerFactories };
2272
2271
 
2273
- //# debugId=FCA9CE604FDEAF2C64756E2164756E21
2272
+ //# debugId=1698A45CAE5F631764756E2164756E21
@@ -3,14 +3,14 @@ import {
3
3
  PipelinesApi,
4
4
  feedScopeInitOverride,
5
5
  resolveFeedScope
6
- } from "./packager-tool-m7vg7dwj.js";
6
+ } from "./packager-tool-n3ch3v36.js";
7
7
  import {
8
8
  Configuration as Configuration2,
9
9
  PackagesApi
10
- } from "./packager-tool-56b5tnnr.js";
10
+ } from "./packager-tool-qpfkpph4.js";
11
11
  import {
12
12
  getSolutionAuthContext
13
- } from "./packager-tool-fjr8yn4g.js";
13
+ } from "./packager-tool-29bj4s4t.js";
14
14
  import {
15
15
  PollOutcome,
16
16
  catchError,
@@ -19,7 +19,7 @@ import {
19
19
  logger,
20
20
  mapPollFailure,
21
21
  pollUntil
22
- } from "./packager-tool-sba5cptt.js";
22
+ } from "./packager-tool-1x1cc4qh.js";
23
23
  import {
24
24
  strFromU8,
25
25
  strToU8,
@@ -7,7 +7,7 @@ import {
7
7
  listSelectablePublishLocations,
8
8
  resolveFeedScope,
9
9
  resolvePersonalWorkspace
10
- } from "./packager-tool-m7vg7dwj.js";
10
+ } from "./packager-tool-n3ch3v36.js";
11
11
  import {
12
12
  Configuration as Configuration2,
13
13
  DeploymentOperationStatus,
@@ -16,11 +16,11 @@ import {
16
16
  SolutionDeploymentAction,
17
17
  deploymentsAutoInstall,
18
18
  searchPackageVersions
19
- } from "./packager-tool-56b5tnnr.js";
19
+ } from "./packager-tool-qpfkpph4.js";
20
20
  import {
21
21
  getSolutionAuthContext,
22
22
  resolveFolder
23
- } from "./packager-tool-fjr8yn4g.js";
23
+ } from "./packager-tool-29bj4s4t.js";
24
24
  import {
25
25
  DEFAULT_PAGE_SIZE,
26
26
  PollOutcome,
@@ -31,7 +31,7 @@ import {
31
31
  mapPollFailure,
32
32
  pollUntil,
33
33
  processContext
34
- } from "./packager-tool-sba5cptt.js";
34
+ } from "./packager-tool-1x1cc4qh.js";
35
35
  import {
36
36
  __commonJS,
37
37
  __require
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  getAvailablePublishLocationsV2
3
- } from "./packager-tool-56b5tnnr.js";
3
+ } from "./packager-tool-qpfkpph4.js";
4
4
  import {
5
5
  PersonalWorkspacesApi,
6
6
  createOrchestratorConfig
7
- } from "./packager-tool-fjr8yn4g.js";
7
+ } from "./packager-tool-29bj4s4t.js";
8
8
  import {
9
9
  getLoginStatusAsync,
10
10
  getSdkUserAgentToken,
11
11
  installSdkUserAgentHeader
12
- } from "./packager-tool-sba5cptt.js";
12
+ } from "./packager-tool-1x1cc4qh.js";
13
13
 
14
14
  // ../pipelines-sdk/generated/src/runtime.ts
15
15
  var BASE_PATH = "https://alpha.uipath.com/uipattycyrhx/abizon_1/automationsolutions_".replace(/\/+$/, "");
@@ -29,8 +29,7 @@ class ToolsFactoryRepository {
29
29
  getProjectToolFactory(projectType) {
30
30
  const factory = this.projectFactoryMap.get(projectType);
31
31
  if (!factory) {
32
- const known = [...this.projectFactoryMap.keys()].join(", ");
33
- throw new Error(`Cannot pack project type '${projectType}': no packager is installed for it. ` + `Project types that can be packed: ${known || "none"}.`);
32
+ throw new Error(`Cannot pack project type '${projectType}': no packager is installed for it.`);
34
33
  }
35
34
  return factory;
36
35
  }
@@ -893,4 +892,4 @@ I18nManager.registerTranslations("zu", zu);
893
892
  I18nManager.setLocale("en");
894
893
  export { ToolResult, toolsFactoryRepository };
895
894
 
896
- //# debugId=EE7F0622AB4476C164756E2164756E21
895
+ //# debugId=C6B394D3F76A061364756E2164756E21
@@ -2,7 +2,7 @@ import {
2
2
  UsersApi,
3
3
  createApiClient,
4
4
  getSolutionAuthContext
5
- } from "./packager-tool-fjr8yn4g.js";
5
+ } from "./packager-tool-29bj4s4t.js";
6
6
  import {
7
7
  catchError,
8
8
  extractErrorMessage,
@@ -12,7 +12,7 @@ import {
12
12
  isGuid,
13
13
  logger,
14
14
  normalizeProjectType
15
- } from "./packager-tool-sba5cptt.js";
15
+ } from "./packager-tool-1x1cc4qh.js";
16
16
  import {
17
17
  __commonJS,
18
18
  __toESM
@@ -15558,6 +15558,59 @@ class FileSystemFileStorageProviderFactory {
15558
15558
  }
15559
15559
  }
15560
15560
 
15561
+ // ../solution-sdk/src/resources/providers/resource-builder-logger.ts
15562
+ var PLACEHOLDER = /\{(\w+)\}|%[sdifoOj]/g;
15563
+ function render(value) {
15564
+ if (typeof value === "string")
15565
+ return value;
15566
+ if (value === null || value === undefined)
15567
+ return String(value);
15568
+ if (typeof value !== "object")
15569
+ return String(value);
15570
+ try {
15571
+ return JSON.stringify(value) ?? String(value);
15572
+ } catch {
15573
+ return String(value);
15574
+ }
15575
+ }
15576
+ function interpolate(message, args) {
15577
+ const fields = args[0] !== null && typeof args[0] === "object" && !Array.isArray(args[0]) ? args[0] : undefined;
15578
+ const consumed = new Set;
15579
+ let positional = 0;
15580
+ const filled = message.replace(PLACEHOLDER, (match, name) => {
15581
+ if (name !== undefined) {
15582
+ if (fields && name in fields) {
15583
+ consumed.add(0);
15584
+ return render(fields[name]);
15585
+ }
15586
+ return match;
15587
+ }
15588
+ const index = positional;
15589
+ positional += 1;
15590
+ if (index >= args.length)
15591
+ return match;
15592
+ consumed.add(index);
15593
+ return render(args[index]);
15594
+ });
15595
+ const extra = args.filter((_, index) => !consumed.has(index)).map(render).filter((text) => text.length > 0);
15596
+ return extra.length > 0 ? `${filled} ${extra.join(" ")}` : filled;
15597
+ }
15598
+
15599
+ class CliResourceBuilderLoggerFactory {
15600
+ create(target) {
15601
+ const name = typeof target === "string" ? target : target.name;
15602
+ const line = (message, args) => `[${name}] ${interpolate(message, args)}`;
15603
+ return {
15604
+ trace: (message, ...args) => logger.debug(line(message, args)),
15605
+ debug: (message, ...args) => logger.debug(line(message, args)),
15606
+ info: (message, ...args) => logger.info(line(message, args)),
15607
+ warn: (message, ...args) => logger.warn(line(message, args)),
15608
+ error: (message, error, ...args) => logger.error(error ? `${line(message, args)}: ${error.message}` : line(message, args)),
15609
+ fatal: (message, ...args) => logger.error(line(message, args))
15610
+ };
15611
+ }
15612
+ }
15613
+
15561
15614
  // ../solution-sdk/src/resources/providers/solution-access-provider.ts
15562
15615
  var ORG_SCOPED_SERVICES = new Set(["apps", "authz"]);
15563
15616
 
@@ -15626,7 +15679,7 @@ class SolutionAccessProvider {
15626
15679
 
15627
15680
  // ../solution-sdk/src/resources/providers/resource-builder-init.ts
15628
15681
  async function createResourceBuilderServices() {
15629
- return await createResourceBuilderConfiguration().addAccessProvider(new SolutionAccessProvider).addFileStorageProviderFactory(new FileSystemFileStorageProviderFactory).addArtifactResourceSpecEnhancer(new EntryPointSpecEnhancer).build();
15682
+ return await createResourceBuilderConfiguration().addAccessProvider(new SolutionAccessProvider).addFileStorageProviderFactory(new FileSystemFileStorageProviderFactory).addArtifactResourceSpecEnhancer(new EntryPointSpecEnhancer).addLoggerFactory(new CliResourceBuilderLoggerFactory).build();
15630
15683
  }
15631
15684
 
15632
15685
  // ../solution-sdk/src/resources/commands/project-utils.ts
@@ -15670,6 +15723,26 @@ async function findProjectFile(projectDir) {
15670
15723
  null
15671
15724
  ];
15672
15725
  }
15726
+
15727
+ class ProjectManifestError extends Error {
15728
+ __projectManifestError = true;
15729
+ reason;
15730
+ constructor(message, reason) {
15731
+ super(message);
15732
+ this.name = "ProjectManifestError";
15733
+ this.reason = reason;
15734
+ }
15735
+ }
15736
+ function isProjectManifestError(error) {
15737
+ return !!error && typeof error === "object" && error.__projectManifestError === true;
15738
+ }
15739
+ function isMissingProjectTypeError(error) {
15740
+ return isProjectManifestError(error) && error.reason === "no-project-type";
15741
+ }
15742
+ function lastPathSegment(filePath) {
15743
+ const parts = filePath.split(/[/\\]/);
15744
+ return parts[parts.length - 1] ?? filePath;
15745
+ }
15673
15746
  async function readProjectFile(filePath, useProjectJson) {
15674
15747
  const fs = getFileSystem();
15675
15748
  const [readError, rawContent] = await catchError(fs.readFile(filePath, "utf-8"));
@@ -15679,7 +15752,7 @@ async function readProjectFile(filePath, useProjectJson) {
15679
15752
  const [parseError, content] = catchError(() => JSON.parse(rawContent));
15680
15753
  if (parseError) {
15681
15754
  return [
15682
- new Error(`Invalid JSON in project file: ${parseError.message}`),
15755
+ new ProjectManifestError(`Invalid JSON in project file: ${parseError.message}`, "invalid-json"),
15683
15756
  null
15684
15757
  ];
15685
15758
  }
@@ -15694,7 +15767,16 @@ async function readProjectFile(filePath, useProjectJson) {
15694
15767
  }
15695
15768
  ];
15696
15769
  }
15697
- return [new Error(`ProjectType not found in ${filePath}`), null];
15770
+ if (lastPathSegment(filePath) === "uipath.json") {
15771
+ return [
15772
+ new ProjectManifestError(`${filePath} has no 'ProjectType'. A uipath.json is only read as a code-first Functions project, which also needs a 'functions' entry. Other project types are registered from project.uiproj or project.json, not from uipath.json.`, "no-project-type"),
15773
+ null
15774
+ ];
15775
+ }
15776
+ return [
15777
+ new ProjectManifestError(`ProjectType not found in ${filePath}`, "no-project-type"),
15778
+ null
15779
+ ];
15698
15780
  }
15699
15781
  return [null, { content, projectType: normalizeProjectType(projectType) }];
15700
15782
  }
@@ -16513,6 +16595,6 @@ async function resourceRefreshAsync(solutionPath = ".", options = {}) {
16513
16595
  warnings: result.warnings
16514
16596
  };
16515
16597
  }
16516
- export { Tokens, models_BindingsResourceType, getResourceName, getFolderPathProperty, getResourceKindForBinding, applyEntryPointEnhancementAsync, createResourceBuilderServices, findProjectFile, readProjectFile, readSolutionFile, resolveSolutionFilePath, writeSolutionFile, restoreSolutionFile, createProjectInSolutionBuilder, normalizeFolderPath, findMatchingLocalResource, addProjectArtifactsToSolutionAsync, assertSolutionManifest, syncResourcesFromBindings, findResourceByKeyInRcs, searchRcsResources, findResourceInRcs, createResourceKindMetadataResolver, createLocalResource, readUipxProjects, syncAndLog, resourceRefreshAsync };
16598
+ export { Tokens, models_BindingsResourceType, getResourceName, getFolderPathProperty, getResourceKindForBinding, applyEntryPointEnhancementAsync, createResourceBuilderServices, findProjectFile, isProjectManifestError, isMissingProjectTypeError, readProjectFile, readSolutionFile, resolveSolutionFilePath, writeSolutionFile, restoreSolutionFile, createProjectInSolutionBuilder, normalizeFolderPath, findMatchingLocalResource, addProjectArtifactsToSolutionAsync, assertSolutionManifest, syncResourcesFromBindings, findResourceByKeyInRcs, searchRcsResources, findResourceInRcs, createResourceKindMetadataResolver, createLocalResource, readUipxProjects, syncAndLog, resourceRefreshAsync };
16517
16599
 
16518
- //# debugId=BC3A09192B8885E064756E2164756E21
16600
+ //# debugId=1B68275F5B7B34D164756E2164756E21
@@ -1,11 +1,13 @@
1
1
  import {
2
+ RESULTS,
2
3
  addSdkUserAgentHeader,
3
4
  catchError,
4
5
  getSdkUserAgentToken,
5
6
  installSdkUserAgentHeader,
6
7
  logger,
7
- readUipxFile
8
- } from "./packager-tool-sba5cptt.js";
8
+ readUipxFile,
9
+ summarizePlatformBody
10
+ } from "./packager-tool-1x1cc4qh.js";
9
11
  import {
10
12
  zipSync
11
13
  } from "./packager-tool-dfrk01gn.js";
@@ -3103,7 +3105,7 @@ async function listStudioWebSolutions(config, organizationName, options = {}) {
3103
3105
  var package_default = {
3104
3106
  name: "@uipath/solution-sdk",
3105
3107
  license: "MIT",
3106
- version: "1.202.0-preview.137",
3108
+ version: "1.202.0-preview.139",
3107
3109
  repository: {
3108
3110
  type: "git",
3109
3111
  url: "https://github.com/UiPath/cli.git",
@@ -3170,9 +3172,11 @@ installSdkUserAgentHeader(BaseAPI, SDK_USER_AGENT);
3170
3172
  // ../solution-sdk/src/upload-service.ts
3171
3173
  class HttpError extends Error {
3172
3174
  status;
3173
- constructor(status, message) {
3175
+ authChallenge;
3176
+ constructor(status, message, authChallenge) {
3174
3177
  super(message);
3175
3178
  this.status = status;
3179
+ this.authChallenge = authChallenge;
3176
3180
  }
3177
3181
  }
3178
3182
 
@@ -3186,6 +3190,7 @@ class SolutionUploadHttpError extends Error {
3186
3190
  solutionId;
3187
3191
  parsedErrorCode;
3188
3192
  parsedErrorMessage;
3193
+ authChallenge;
3189
3194
  constructor(details) {
3190
3195
  super(details.message);
3191
3196
  this.name = "SolutionUploadHttpError";
@@ -3198,6 +3203,7 @@ class SolutionUploadHttpError extends Error {
3198
3203
  if (details.operation === "overwrite") {
3199
3204
  this.solutionId = details.solutionId;
3200
3205
  }
3206
+ this.authChallenge = details.authChallenge;
3201
3207
  const parsed = parseUploadErrorBody(details.body);
3202
3208
  this.parsedErrorCode = parsed.code;
3203
3209
  this.parsedErrorMessage = parsed.message;
@@ -3214,10 +3220,101 @@ function parseUploadErrorBody(body) {
3214
3220
  message: typeof rawMessage === "string" && rawMessage.trim() ? rawMessage : undefined
3215
3221
  };
3216
3222
  }
3223
+ function isSolutionUploadHttpError(error) {
3224
+ return error instanceof Error && error.name === "SolutionUploadHttpError" && "operation" in error && (error.operation === "import" || error.operation === "overwrite") && "status" in error && typeof error.status === "number" && "body" in error && typeof error.body === "string";
3225
+ }
3217
3226
  function requestPath(url) {
3218
3227
  const [, parsed] = catchError(() => new URL(url));
3219
3228
  return parsed ? `${parsed.pathname}${parsed.search}` : url;
3220
3229
  }
3230
+ 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;
3231
+ function redactTokens(text) {
3232
+ return text.replace(TOKEN_SHAPED, "[REDACTED]");
3233
+ }
3234
+ var MAX_CHALLENGE_DESCRIPTION = 200;
3235
+ function parseAuthChallenge(header) {
3236
+ if (!header)
3237
+ return {};
3238
+ const code = /\berror="([^"]*)"/.exec(header)?.[1]?.trim();
3239
+ const raw = /\berror_description="([^"]*)"/.exec(header)?.[1]?.trim();
3240
+ const description = raw ? redactTokens(raw).slice(0, MAX_CHALLENGE_DESCRIPTION) : undefined;
3241
+ return {
3242
+ error: code || undefined,
3243
+ description: description || undefined
3244
+ };
3245
+ }
3246
+ function summarizeAuthRefusalBody(body) {
3247
+ return summarizePlatformBody(redactTokens(body));
3248
+ }
3249
+ function isAuthRefusal(status) {
3250
+ return status === 401 || status === 403;
3251
+ }
3252
+ function buildAuthRefusalInstructions({
3253
+ err,
3254
+ subject,
3255
+ target,
3256
+ bodySuffix,
3257
+ identityType,
3258
+ clientId
3259
+ }) {
3260
+ const refusal = err.status === 401 ? "rejected the call as unauthorized (401)" : "forbade the call (403)";
3261
+ const what = err.operation === "overwrite" ? `replacing the contents of solution ${target}` : "importing the solution package";
3262
+ 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. `;
3263
+ 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. `;
3264
+ const challenge = parseAuthChallenge(err.authChallenge);
3265
+ const quoted = challenge.description ? ` ("${challenge.description}")` : "";
3266
+ if (challenge.error === "invalid_token") {
3267
+ 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}`;
3268
+ }
3269
+ 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. `;
3270
+ 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;
3271
+ 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.`;
3272
+ return `Studio Web ${refusal} while ${what}. ${diagnosis}${actor}${tenant}` + `Nothing was uploaded and nothing ran, so the ${subject} is not the ` + `cause. ${closing}`;
3273
+ }
3274
+ function buildSolutionUploadFailureOutput(err, options = {}) {
3275
+ const stage = err.operation === "overwrite" ? "overwrite-solution" : "import-solution";
3276
+ const authRefusal = isAuthRefusal(err.status);
3277
+ const parsedMessage = authRefusal && err.parsedErrorMessage ? redactTokens(err.parsedErrorMessage) : err.parsedErrorMessage;
3278
+ const detail = parsedMessage ? ` — ${parsedMessage}` : "";
3279
+ const Message = `Failed during ${stage}: HTTP ${err.status} on ${err.method} ` + `${err.endpoint}${detail}`;
3280
+ const quote = authRefusal ? summarizeAuthRefusalBody : summarizePlatformBody;
3281
+ const body = err.parsedErrorMessage ? "" : quote(err.body);
3282
+ const bodySuffix = body ? ` Platform response: "${body}".` : "";
3283
+ const importHint = options.importCheckHint ? ` ${options.importCheckHint}` : "";
3284
+ const subject = options.subject ?? "project";
3285
+ const target = err.solutionId ?? `the solution at ${err.endpoint}`;
3286
+ const authInstructions = isAuthRefusal(err.status) ? buildAuthRefusalInstructions({
3287
+ err,
3288
+ subject,
3289
+ target,
3290
+ bodySuffix,
3291
+ identityType: options.identityType,
3292
+ clientId: options.clientId
3293
+ }) : undefined;
3294
+ 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}`);
3295
+ const Context = {
3296
+ httpStatus: err.status,
3297
+ stage,
3298
+ endpoint: err.endpoint,
3299
+ method: err.method
3300
+ };
3301
+ if (err.parsedErrorCode !== undefined) {
3302
+ Context.errorCode = err.parsedErrorCode;
3303
+ }
3304
+ const output = {
3305
+ Result: RESULTS.Failure,
3306
+ Message,
3307
+ Instructions,
3308
+ Context
3309
+ };
3310
+ if (err.status === 401 && options.identityType === "Application") {
3311
+ output.ErrorCode = "permission_denied";
3312
+ }
3313
+ if (err.operation === "overwrite" && err.status >= 500 && err.status < 600) {
3314
+ output.Retry = "RetryAfter30Seconds";
3315
+ }
3316
+ return output;
3317
+ }
3221
3318
  var DEFAULT_UPLOAD_TIMEOUT_MS = 120000;
3222
3319
  function resolveUploadTimeoutMs() {
3223
3320
  const raw = Number(process.env?.UIPATH_SOLUTION_UPLOAD_TIMEOUT_MS);
@@ -3263,8 +3360,10 @@ async function solutionExistsOnStudioWeb(config, organizationName, solutionId) {
3263
3360
  if (error.response.status === 404) {
3264
3361
  return false;
3265
3362
  }
3363
+ const status = error.response.status;
3266
3364
  const text = await error.response.text().catch(() => "");
3267
- throw new HttpError(error.response.status, `Studio Web solution existence probe failed (${error.response.status}): ${text}`);
3365
+ const body = isAuthRefusal(status) ? summarizeAuthRefusalBody(text) : text;
3366
+ throw new HttpError(status, `Studio Web solution existence probe failed (${status}): ${body}`, parseAuthChallenge(error.response.headers?.get("www-authenticate") ?? undefined));
3268
3367
  }
3269
3368
  throw error;
3270
3369
  }
@@ -3293,6 +3392,7 @@ async function importSolution(config, organizationName, fileBuffer, fileName) {
3293
3392
  endpoint: requestPath(importUrl),
3294
3393
  url: importUrl,
3295
3394
  body: text,
3395
+ authChallenge: response.headers?.get("www-authenticate") ?? undefined,
3296
3396
  message: `Import failed (${response.status}): ${text}`
3297
3397
  });
3298
3398
  }
@@ -3324,6 +3424,7 @@ async function overwriteSolution(config, organizationName, fileBuffer, fileName,
3324
3424
  endpoint: requestPath(overwriteUrl),
3325
3425
  url: overwriteUrl,
3326
3426
  body: text,
3427
+ authChallenge: response.headers?.get("www-authenticate") ?? undefined,
3327
3428
  message: `Overwrite failed (${response.status}): ${text}`,
3328
3429
  solutionId
3329
3430
  });
@@ -3392,6 +3493,6 @@ async function searchPackageVersions(config, packageKey, filter, feedFolderKey)
3392
3493
  const raw = await response.json();
3393
3494
  return { count: raw.count, values: raw.values ?? [] };
3394
3495
  }
3395
- export { Configuration, getAvailablePublishLocationsV2, DeploymentActivationStatus, DeploymentOperationStatus, SolutionDeploymentAction, DeploymentsApi, PackagesApi, SearchApi, StudioWebIncompatibleProjectError, bundleSolution, deploymentsAutoInstall, isDebugProvisioningTerminal, isDebugProvisioningSucceeded, getProjectDebugStatus, searchPackageVersions, getStudioWebSolutionProjects, listStudioWebSolutions, solutionExistsOnStudioWeb, importSolution, overwriteSolution };
3496
+ export { Configuration, getAvailablePublishLocationsV2, DeploymentActivationStatus, DeploymentOperationStatus, SolutionDeploymentAction, DeploymentsApi, PackagesApi, SearchApi, StudioWebIncompatibleProjectError, bundleSolution, deploymentsAutoInstall, isDebugProvisioningTerminal, isDebugProvisioningSucceeded, getProjectDebugStatus, searchPackageVersions, getStudioWebSolutionProjects, listStudioWebSolutions, isSolutionUploadHttpError, buildSolutionUploadFailureOutput, solutionExistsOnStudioWeb, importSolution, overwriteSolution };
3396
3497
 
3397
- //# debugId=1DF7E23CF3FEEFE764756E2164756E21
3498
+ //# debugId=2E318348F3A8BF3E64756E2164756E21
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  registerPackagerFactories
3
- } from "./packager-tool-3hbsdwjm.js";
4
- import"./packager-tool-x3ehbhsn.js";
3
+ } from "./packager-tool-9dx65z2d.js";
4
+ import"./packager-tool-nzghfa48.js";
5
5
  import"./packager-tool-dfrk01gn.js";
6
6
  import"./packager-tool-1de529jm.js";
7
7
  export {
package/dist/publish.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  publishSolutionAsync
3
- } from "./packager-tool-zz9cxrqw.js";
4
- import"./packager-tool-m7vg7dwj.js";
5
- import"./packager-tool-56b5tnnr.js";
6
- import"./packager-tool-fjr8yn4g.js";
7
- import"./packager-tool-sba5cptt.js";
3
+ } from "./packager-tool-9ez6mf86.js";
4
+ import"./packager-tool-n3ch3v36.js";
5
+ import"./packager-tool-qpfkpph4.js";
6
+ import"./packager-tool-29bj4s4t.js";
7
+ import"./packager-tool-1x1cc4qh.js";
8
8
  import"./packager-tool-dfrk01gn.js";
9
9
  import"./packager-tool-1de529jm.js";
10
10
  export {
package/dist/resource.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  resourceRefreshAsync
3
- } from "./packager-tool-n41f88jn.js";
4
- import"./packager-tool-x3ehbhsn.js";
5
- import"./packager-tool-fjr8yn4g.js";
6
- import"./packager-tool-sba5cptt.js";
3
+ } from "./packager-tool-pc4hb3pv.js";
4
+ import"./packager-tool-nzghfa48.js";
5
+ import"./packager-tool-29bj4s4t.js";
6
+ import"./packager-tool-1x1cc4qh.js";
7
7
  import"./packager-tool-dfrk01gn.js";
8
8
  import"./packager-tool-1de529jm.js";
9
9
  export {
@@ -18,7 +18,9 @@ export declare const GOVERNANCE_OPTION_INSTRUCTIONS: string;
18
18
  *
19
19
  * Returns the message rather than throwing because the two callers report
20
20
  * failures differently: the command builds an `OutputFormatter.error` envelope,
21
- * while `executeAsync` returns a `ToolResult` and never throws for an expected
22
- * failure. Owning the wording here keeps the two paths from drifting apart.
21
+ * while `executeAsync` returns a `ToolResult` for an expected failure — except
22
+ * `UnpackableProjectTypeError`, which it rethrows so the CLI can split
23
+ * `Message` from `Instructions`. Owning the wording here keeps the two paths
24
+ * from drifting apart.
23
25
  */
24
26
  export declare function validateGovernanceOptions(options: Pick<PackCommandOptions, "governanceFilePath" | "automationOpsProfile">): string | null;
@@ -8,12 +8,27 @@ export declare class PackCommandService {
8
8
  private packager;
9
9
  private readonly fs;
10
10
  constructor();
11
+ /**
12
+ * Report an error thrown out of the pack pipeline, then leave the exit to
13
+ * the caller. Split out of `execute` so the classification and the
14
+ * stack-trace decision do not add to that method's cognitive complexity,
15
+ * which is already well over budget for reasons that predate this.
16
+ */
17
+ private reportPackThrow;
11
18
  /**
12
19
  * Execute the pack command with formatted CLI output and process exit handling.
13
20
  * When `options.dryRun` is true, the pipeline writes to a temporary directory
14
21
  * which is discarded on exit — useful as a pre-deploy validation gate.
15
22
  */
16
23
  execute(solutionPath: string, options: PackCommandOptions, context: CommandContext): Promise<void>;
24
+ /**
25
+ * The entry guards `executeAsync` runs before it touches a packager:
26
+ * a missing output path, bad governance options, and a solution path that
27
+ * is absent or unreadable. Split out so `executeAsync` stays inside the
28
+ * cognitive-complexity budget; each one still returns the `ToolResult`
29
+ * that caller expects rather than throwing.
30
+ */
31
+ private checkPackInputs;
17
32
  /**
18
33
  * Execute the pack command and return result (for programmatic usage and testing)
19
34
  */
@@ -1,4 +1,21 @@
1
1
  import type { IFileSystem } from "@uipath/filesystem";
2
+ /**
3
+ * A `.uipx` names a project type nothing can pack, and no tool provides one.
4
+ *
5
+ * Thrown before the packager runs so the user gets the real problem — the
6
+ * manifest declares a type this CLI does not have — instead of the packager's
7
+ * "install the tool that packs it", which for a type that does not exist
8
+ * sends them looking for a tool that is not there. `instructions` follows the
9
+ * repo-wide convention `carriedInstructions` reads, and `__unpackableType`
10
+ * lets callers duck-type across bundle boundaries where `instanceof` fails.
11
+ */
12
+ export declare class UnpackableProjectTypeError extends Error {
13
+ readonly __unpackableType = true;
14
+ readonly instructions: string;
15
+ constructor(projectType: string, projectPath: string);
16
+ }
17
+ /** True when `error` is an {@link UnpackableProjectTypeError}, duck-typed. */
18
+ export declare function isUnpackableProjectTypeError(error: unknown): boolean;
2
19
  /**
3
20
  * Puts every factory this pack needs in `toolsFactoryRepository`: registers
4
21
  * the ones solution-tool owns, then reads project types from the .uipx and
@@ -77,7 +77,9 @@ Install the skills with `uip skills install`. The general-purpose `uipath-platfo
77
77
 
78
78
  **`Library` is not a project type here.** A library is a reusable `.nupkg` consumed as a NuGet dependency, so `projects add` / `import` reject it and auto-registration returns `SolutionRegistration.Status: "Skipped"`. Publish it on its own (`uip rpa pack <project-dir> <output-path>`, then `uip or libraries upload --file <nupkg-path>`) and either reference it from a project's dependencies or attach it to this solution as a resource: `uip solution resources add --source remote --kind Library --name <library-name>`.
79
79
 
80
- The type lives in either `project.uiproj` (top-level `ProjectType`) or `project.json` (`designOptions.outputType`, falling back to top-level `ProjectType` when `outputType` is absent — read or write either field). The `init` scaffolders above auto-register when run inside a solution directory (unless `--skip-solution-registration` is passed). For other scaffolders, register the project with the solution after scaffolding: use `uip solution projects add <project-path> [<solution-file>]` when the project already lives inside the solution directory (registers in place, no copy), or `uip solution projects import <path>` to copy a project from outside the solution dir into it and register it. If you pass an unknown type to those commands, they reject with the exhaustive accepted list — trust that error over this table.
80
+ The type lives in either `project.uiproj` (top-level `ProjectType`) or `project.json` (`designOptions.outputType`, falling back to top-level `ProjectType` when `outputType` is absent — read or write either field). A third form exists but is narrow: `uipath.json` is read as a project manifest **only** for a code-first Functions project, which is recognised by a `functions` map inside it. Other project kinds keep a `uipath.json` for their own config — a coded app stores its SDK settings there — and that file is not what registers them: a coded app is registered from the `project.uiproj` that `uip codedapp init <path>` writes. Pointing a solution at a coded app's `uipath.json` (or at its `package.json`) fails, because neither carries a `ProjectType`.
81
+
82
+ The `init` scaffolders above auto-register when run inside a solution directory (unless `--skip-solution-registration` is passed). For other scaffolders, register the project with the solution after scaffolding: use `uip solution projects add <project-path> [<solution-file>]` when the project already lives inside the solution directory (registers in place, no copy), or `uip solution projects import <path>` to copy a project from outside the solution dir into it and register it. If you pass an unknown type to those commands, they reject with the exhaustive accepted list — trust that error over this table. `uip solution pack` rejects the same way: a `Projects[]` entry whose `Type` no packager handles fails with `ErrorCode: invalid_argument`, naming the project, the accepted types, and how to drop the entry, rather than attempting the pack.
81
83
 
82
84
  ## End-to-End Lifecycle
83
85
 
@@ -261,6 +263,8 @@ uip solution delete <solution-id> --yes # remove a solution from Studio Web (
261
263
 
262
264
  `Data.Action` is `Imported` or `Overwritten`, so you can tell which ran. `--force` skips the existence check and overwrites directly; it is not normally needed, it fails rather than importing if that solution is gone, and it has no effect when no `SolutionId` is bundled (the upload imports as new). To upload a copy as an unrelated cloud solution instead of updating, scaffold a fresh solution with `uip solution init`, or replace the `SolutionId` in the local `.uipx` with a fresh GUID and re-run upload (removing the field entirely fails `.uipx` validation).
263
265
 
266
+ If Studio Web refuses the upload with 401 or 403, read `Instructions` before you do anything — the answer is one of two, and they are opposites. In almost every case do **not** re-run `uip login`: the CLI checks the session and its token expiry before it calls, so the token was valid and re-authenticating produces the same one. The failure is then about what the acting identity may do in Studio Web (for a CI pipeline: the external application's `StudioWebS2S` grants) or about the tenant the bundled `SolutionId` belongs to, and an application 401 is reported as `ErrorCode: permission_denied` rather than `authentication_required`. The exception is when `Instructions` quote `invalid_token`: that is Studio Web rejecting the credential itself rather than the permissions behind it, so a fresh `uip login` — or a newly minted client-credentials token — is worth trying, and the error code stays `authentication_required`.
267
+
264
268
  `download` writes the `.uis` archive and nothing else — extraction is opt-in. Pass `--extract` to also unzip it into a sibling directory named after the archive; that directory is a working solution tree, with the `.uipx` manifest at its root. `--extract` also drops `AGENTS.md` and `CLAUDE.md` there so an agent picking the solution up has the same briefing `uip solution init` writes. It only fills gaps: a file the archive already carried is left alone, and the paths actually written come back in `Data.BriefingFiles`. Without `--extract` you get the zip only, and no briefing files — there is no solution directory to put them in.
265
269
 
266
270
  Two more verbs act on a **cloud** solution project rather than the local tree — do not confuse them with the local `projects add` / `import` / `remove` / `list` membership commands above:
@@ -445,6 +449,8 @@ Adjacent groups commonly used alongside solutions:
445
449
  | Symptom | First thing to check |
446
450
  |---|---|
447
451
  | `Not authenticated` / 401 | `uip login`, then re-run |
452
+ | `upload` fails with 401/403 and `ErrorCode: permission_denied` | Not a login problem — the token was valid when the call went out, so `uip login` mints the same one. Read `Instructions`: for a session on an external application, check that the app has the Studio Web (`StudioWebS2S`) grants, not only the Orchestrator and Solutions ones; for a user, check Studio Web access in the tenant. Then confirm the `SolutionId` in the `.uipx` belongs to the tenant you are logged into — an id this session cannot see at all is reported separately, as nothing to overwrite, so a refusal here points at the grants first |
453
+ | `upload` fails with 401 and `Instructions` quote `invalid_token` | The opposite case: Studio Web rejected the credential itself, not the grants behind it. Re-run `uip login`, or mint a fresh client-credentials token in a pipeline. Check too that the token was issued for the organization and tenant being called — one minted against another environment or audience is refused this way. The error code stays `authentication_required` |
448
454
  | Command targets the wrong tenant | `uip login tenant set <tenant>`; verify with `uip login status` |
449
455
  | Pack succeeds but publish 409s | Version conflict — bump the version (`uip solution pack . ./out -v <new-version>`) or delete the colliding version with `uip solution packages delete <package-name> <version> --yes` (only if intentional; `--yes` required) |
450
456
  | `deploy run` stops because the package is already deployed | Upgrade it in place with `uip solution deploy upgrade <deployment-key>` (running `deploy run` again does not upgrade it), or `uip solution deploy uninstall <name> --yes` first, or pass `--yes` to create a second, separate deployment |