@uipath/codedapp-tool 1.205.0-preview.276 → 1.206.0-preview.279

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 (35) hide show
  1. package/README.md +48 -0
  2. package/dist/{browser-strategy-6atc7v8s.js → browser-strategy-z97p0ezf.js} +5 -6
  3. package/dist/{embedded-file-reader-r66242ey.js → embedded-file-reader-0228j82a.js} +1 -4
  4. package/dist/first-party-service-ahcc6xc6.js +8 -0
  5. package/dist/{index-0k30knwv.js → index-0py5k2e9.js} +177 -2055
  6. package/dist/index-c3zcyvwz.js +20 -0
  7. package/dist/index-cw1j9s6d.js +3176 -0
  8. package/dist/{index-h8cph72k.js → index-nzr4mx5p.js} +2 -22
  9. package/dist/index-z2qk2qn6.js +24 -0
  10. package/dist/index.js +14 -17
  11. package/dist/{jmespath-e4a59c8w.js → jmespath-wwym30dp.js} +1 -1
  12. package/dist/{js-yaml-87cdx6bm.js → js-yaml-a2bk27p6.js} +1 -3
  13. package/dist/{node-strategy-myagr1zp.js → node-strategy-fk02jqd8.js} +9 -12
  14. package/dist/{packager-tool-5ebgtev7.js → packager-tool-06tdd0p9.js} +3168 -3092
  15. package/dist/{packager-tool-je2re4j6.js → packager-tool-0ajs8pnk.js} +53 -8
  16. package/dist/{packager-tool-vc19fcdp.js → packager-tool-19x86hb2.js} +3 -21
  17. package/dist/{packager-tool-0gctz400.js → packager-tool-2rwzcase.js} +2 -5
  18. package/dist/{packager-tool-s8h46737.js → packager-tool-3ss96mpk.js} +82 -709
  19. package/dist/{packager-tool-d94wjncg.js → packager-tool-5t7c439j.js} +97 -97
  20. package/dist/{packager-tool-1yh8g550.js → packager-tool-6an893wm.js} +12 -3
  21. package/dist/packager-tool-8pm90w77.js +6640 -0
  22. package/dist/{packager-tool-8zq6m3bp.js → packager-tool-9hsas3s8.js} +1676 -1451
  23. package/dist/{packager-tool-cmfktvbt.js → packager-tool-h9q8znad.js} +885 -439
  24. package/dist/{packager-tool-gdtpsdn7.js → packager-tool-mm1x18d6.js} +223 -28
  25. package/dist/{packager-tool-qa9gftnj.js → packager-tool-xd2w5pct.js} +3 -3
  26. package/dist/packager-tool.js +7 -8
  27. package/dist/tool.js +13 -16
  28. package/package.json +2 -2
  29. package/dist/first-party-service-srxaftkn.js +0 -27
  30. package/dist/index-78bnpdqb.js +0 -3177
  31. package/dist/index-kmp9fmhb.js +0 -25
  32. package/dist/index-wbp18pm0.js +0 -157
  33. package/dist/packager-tool-53w8skv5.js +0 -262
  34. package/dist/packager-tool-m7tmga2c.js +0 -20538
  35. /package/dist/{packager-tool-yc4kw997.js → packager-tool-1qg04b7q.js} +0 -0
@@ -1,11 +1,12 @@
1
1
  import {
2
2
  getFileSystem
3
- } from "./packager-tool-je2re4j6.js";
3
+ } from "./packager-tool-0ajs8pnk.js";
4
4
  import {
5
+ __toESM,
5
6
  __commonJS,
6
- __require,
7
- __toESM
8
- } from "./packager-tool-1yh8g550.js";
7
+ __exportCjs,
8
+ __require
9
+ } from "./packager-tool-6an893wm.js";
9
10
 
10
11
  // ../../node_modules/commander/lib/error.js
11
12
  var require_error = __commonJS(function(exports) {
@@ -127,7 +128,7 @@ var require_help = __commonJS(function(exports) {
127
128
  this.helpWidth = this.helpWidth ?? contextOptions.helpWidth ?? 80;
128
129
  }
129
130
  visibleCommands(cmd) {
130
- const visibleCommands = cmd.commands.filter((cmd2) => !cmd2._hidden);
131
+ const visibleCommands = cmd.commands.filter((cmd) => !cmd._hidden);
131
132
  const helpCommand = cmd._getHelpCommand();
132
133
  if (helpCommand && !helpCommand._hidden) {
133
134
  visibleCommands.push(helpCommand);
@@ -607,8 +608,8 @@ var require_option = __commonJS(function(exports) {
607
608
  }
608
609
  }
609
610
  function camelcase(str) {
610
- return str.split("-").reduce((str2, word) => {
611
- return str2 + word[0].toUpperCase() + word.slice(1);
611
+ return str.split("-").reduce((str, word) => {
612
+ return str + word[0].toUpperCase() + word.slice(1);
612
613
  });
613
614
  }
614
615
  function splitOptionFlags(flags) {
@@ -1179,44 +1180,44 @@ Expecting one of '${allowedValues.join("', '")}'`);
1179
1180
  });
1180
1181
  return source;
1181
1182
  }
1182
- _prepareUserArgs(argv, parseOptions) {
1183
- if (argv !== undefined && !Array.isArray(argv)) {
1183
+ _prepareUserArgs(argv2, parseOptions) {
1184
+ if (argv2 !== undefined && !Array.isArray(argv2)) {
1184
1185
  throw new Error("first parameter to parse must be array or undefined");
1185
1186
  }
1186
1187
  parseOptions = parseOptions || {};
1187
- if (argv === undefined && parseOptions.from === undefined) {
1188
+ if (argv2 === undefined && parseOptions.from === undefined) {
1188
1189
  if (process2.versions?.electron) {
1189
1190
  parseOptions.from = "electron";
1190
1191
  }
1191
- const execArgv = process2.execArgv ?? [];
1192
- if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) {
1192
+ const execArgv2 = process2.execArgv ?? [];
1193
+ if (execArgv2.includes("-e") || execArgv2.includes("--eval") || execArgv2.includes("-p") || execArgv2.includes("--print")) {
1193
1194
  parseOptions.from = "eval";
1194
1195
  }
1195
1196
  }
1196
- if (argv === undefined) {
1197
- argv = process2.argv;
1197
+ if (argv2 === undefined) {
1198
+ argv2 = process2.argv;
1198
1199
  }
1199
- this.rawArgs = argv.slice();
1200
+ this.rawArgs = argv2.slice();
1200
1201
  let userArgs;
1201
1202
  switch (parseOptions.from) {
1202
1203
  case undefined:
1203
1204
  case "node":
1204
- this._scriptPath = argv[1];
1205
- userArgs = argv.slice(2);
1205
+ this._scriptPath = argv2[1];
1206
+ userArgs = argv2.slice(2);
1206
1207
  break;
1207
1208
  case "electron":
1208
1209
  if (process2.defaultApp) {
1209
- this._scriptPath = argv[1];
1210
- userArgs = argv.slice(2);
1210
+ this._scriptPath = argv2[1];
1211
+ userArgs = argv2.slice(2);
1211
1212
  } else {
1212
- userArgs = argv.slice(1);
1213
+ userArgs = argv2.slice(1);
1213
1214
  }
1214
1215
  break;
1215
1216
  case "user":
1216
- userArgs = argv.slice(0);
1217
+ userArgs = argv2.slice(0);
1217
1218
  break;
1218
1219
  case "eval":
1219
- userArgs = argv.slice(1);
1220
+ userArgs = argv2.slice(1);
1220
1221
  break;
1221
1222
  default:
1222
1223
  throw new Error(`unexpected parse option { from: '${parseOptions.from}' }`);
@@ -1739,18 +1740,18 @@ Expecting one of '${allowedValues.join("', '")}'`);
1739
1740
  this.error(message, { code: "commander.missingMandatoryOptionValue" });
1740
1741
  }
1741
1742
  _conflictingOption(option, conflictingOption) {
1742
- const findBestOptionFromValue = (option2) => {
1743
- const optionKey = option2.attributeName();
1743
+ const findBestOptionFromValue = (option) => {
1744
+ const optionKey = option.attributeName();
1744
1745
  const optionValue = this.getOptionValue(optionKey);
1745
1746
  const negativeOption = this.options.find((target) => target.negate && optionKey === target.attributeName());
1746
1747
  const positiveOption = this.options.find((target) => !target.negate && optionKey === target.attributeName());
1747
1748
  if (negativeOption && (negativeOption.presetArg === undefined && optionValue === false || negativeOption.presetArg !== undefined && optionValue === negativeOption.presetArg)) {
1748
1749
  return negativeOption;
1749
1750
  }
1750
- return positiveOption || option2;
1751
+ return positiveOption || option;
1751
1752
  };
1752
- const getErrorMessage = (option2) => {
1753
- const bestOption = findBestOptionFromValue(option2);
1753
+ const getErrorMessage = (option) => {
1754
+ const bestOption = findBestOptionFromValue(option);
1754
1755
  const optionKey = bestOption.attributeName();
1755
1756
  const source = this.getOptionValueSource(optionKey);
1756
1757
  if (source === "env") {
@@ -1904,10 +1905,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
1904
1905
  this._name = path.basename(filename, path.extname(filename));
1905
1906
  return this;
1906
1907
  }
1907
- executableDir(path2) {
1908
- if (path2 === undefined)
1908
+ executableDir(path) {
1909
+ if (path === undefined)
1909
1910
  return this._executableDir;
1910
- this._executableDir = path2;
1911
+ this._executableDir = path;
1911
1912
  return this;
1912
1913
  }
1913
1914
  helpInformation(contextOptions) {
@@ -2004,11 +2005,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
2004
2005
  }
2005
2006
  help(contextOptions) {
2006
2007
  this.outputHelp(contextOptions);
2007
- let exitCode = Number(process2.exitCode ?? 0);
2008
- if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
2009
- exitCode = 1;
2008
+ let exitCode2 = Number(process2.exitCode ?? 0);
2009
+ if (exitCode2 === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
2010
+ exitCode2 = 1;
2010
2011
  }
2011
- this._exit(exitCode, "commander.help", "(outputHelp)");
2012
+ this._exit(exitCode2, "commander.help", "(outputHelp)");
2012
2013
  }
2013
2014
  addHelpText(position, text) {
2014
2015
  const allowedValues = ["beforeAll", "before", "after", "afterAll"];
@@ -2081,40 +2082,265 @@ Expecting one of '${allowedValues.join("', '")}'`);
2081
2082
  });
2082
2083
 
2083
2084
  // ../../node_modules/commander/index.js
2084
- var require_commander = __commonJS(function(exports) {
2085
- var { Argument } = require_argument();
2086
- var { Command } = require_command();
2087
- var { CommanderError, InvalidArgumentError } = require_error();
2088
- var { Help } = require_help();
2089
- var { Option } = require_option();
2090
- exports.program = new Command;
2091
- exports.createCommand = (name) => new Command(name);
2092
- exports.createOption = (flags, description) => new Option(flags, description);
2093
- exports.createArgument = (name, description) => new Argument(name, description);
2094
- exports.Command = Command;
2095
- exports.Option = Option;
2096
- exports.Argument = Argument;
2097
- exports.Help = Help;
2098
- exports.CommanderError = CommanderError;
2099
- exports.InvalidArgumentError = InvalidArgumentError;
2100
- exports.InvalidOptionArgumentError = InvalidArgumentError;
2085
+ var exports_commander = {};
2086
+ __exportCjs(exports_commander, {
2087
+ program: () => $program,
2088
+ createCommand: () => $createCommand,
2089
+ createOption: () => $createOption,
2090
+ createArgument: () => $createArgument,
2091
+ Command: () => $Command,
2092
+ Option: () => $Option,
2093
+ Argument: () => $Argument,
2094
+ Help: () => $Help,
2095
+ CommanderError: () => $CommanderError,
2096
+ InvalidArgumentError: () => $InvalidArgumentError,
2097
+ InvalidOptionArgumentError: () => $InvalidOptionArgumentError
2098
+ }, {
2099
+ program: (value) => $program = value,
2100
+ createCommand: (value) => $createCommand = value,
2101
+ createOption: (value) => $createOption = value,
2102
+ createArgument: (value) => $createArgument = value,
2103
+ Command: (value) => $Command = value,
2104
+ Option: (value) => $Option = value,
2105
+ Argument: (value) => $Argument = value,
2106
+ Help: (value) => $Help = value,
2107
+ CommanderError: (value) => $CommanderError = value,
2108
+ InvalidArgumentError: (value) => $InvalidArgumentError = value,
2109
+ InvalidOptionArgumentError: (value) => $InvalidOptionArgumentError = value
2101
2110
  });
2111
+ var { Argument } = require_argument();
2112
+ var { Command: Command2 } = require_command();
2113
+ var { CommanderError, InvalidArgumentError: InvalidArgumentError2 } = require_error();
2114
+ var { Help } = require_help();
2115
+ var { Option: Option2 } = require_option();
2116
+ var $program = new Command2;
2117
+ var $createCommand = (name) => new Command2(name);
2118
+ var $createOption = (flags, description) => new Option2(flags, description);
2119
+ var $createArgument = (name, description) => new Argument(name, description);
2120
+ var $Command = Command2;
2121
+ var $Option = Option2;
2122
+ var $Argument = Argument;
2123
+ var $Help = Help;
2124
+ var $CommanderError = CommanderError;
2125
+ var $InvalidArgumentError = InvalidArgumentError2;
2126
+ var $InvalidOptionArgumentError = InvalidArgumentError2;
2102
2127
 
2103
2128
  // ../../node_modules/commander/esm.mjs
2104
- var import__ = __toESM(require_commander(), 1);
2105
2129
  var {
2106
2130
  program,
2107
2131
  createCommand,
2108
2132
  createArgument,
2109
2133
  createOption,
2110
- CommanderError,
2134
+ CommanderError: CommanderError2,
2111
2135
  InvalidArgumentError,
2112
2136
  InvalidOptionArgumentError,
2113
2137
  Command,
2114
- Argument,
2138
+ Argument: Argument2,
2115
2139
  Option,
2116
- Help
2117
- } = import__.default;
2140
+ Help: Help2
2141
+ } = exports_commander;
2142
+
2143
+ // ../common/src/telemetry/telemetry-dimensions.ts
2144
+ var BaseDimensions = {
2145
+ ApplicationName: "ApplicationName",
2146
+ ProductVersion: "ProductVersion",
2147
+ InstallationId: "InstallationId",
2148
+ CloudUserId: "CloudUserId",
2149
+ CloudTenantId: "CloudTenantId",
2150
+ CloudOrganizationId: "CloudOrganizationId",
2151
+ IsInternalUser: "IsInternalUser",
2152
+ Environment: "Environment",
2153
+ BaseUrl: "BaseUrl",
2154
+ Region: "Region",
2155
+ Agent: "Agent",
2156
+ AgentVersion: "AgentVersion",
2157
+ AgentModel: "AgentModel",
2158
+ ToolName: "ToolName",
2159
+ ToolVersion: "ToolVersion",
2160
+ ExecutionContext: "ExecutionContext",
2161
+ CiProvider: "CiProvider",
2162
+ SessionIdSource: "SessionIdSource",
2163
+ SessionId: "SessionId"
2164
+ };
2165
+ var CommandDimensions = {
2166
+ IsCommand: "IsCommand",
2167
+ IsReexec: "IsReexec",
2168
+ CommandName: "CommandName",
2169
+ ExitCode: "ExitCode",
2170
+ TerminalOutcome: "TerminalOutcome",
2171
+ ErrorClass: "ErrorClass",
2172
+ TerminalSignal: "TerminalSignal",
2173
+ ErrorMessage: "ErrorMessage",
2174
+ SkillName: "SkillName",
2175
+ ProductArea: "ProductArea",
2176
+ Mode: "Mode"
2177
+ };
2178
+ var ProjectDimensions = {
2179
+ ProjectKey: "ProjectKey",
2180
+ ProjectType: "ProjectType",
2181
+ ProjectIdentityStatus: "ProjectIdentityStatus",
2182
+ SolutionKey: "SolutionKey",
2183
+ SolutionProjectKey: "SolutionProjectKey",
2184
+ SolutionIdentityStatus: "SolutionIdentityStatus",
2185
+ PreviousSolutionKey: "PreviousSolutionKey"
2186
+ };
2187
+ var GUID_KEY_DIMENSIONS = new Set([
2188
+ ProjectDimensions.ProjectKey,
2189
+ ProjectDimensions.SolutionKey,
2190
+ ProjectDimensions.SolutionProjectKey,
2191
+ ProjectDimensions.PreviousSolutionKey
2192
+ ]);
2193
+ var ShipDimensions = {
2194
+ ShipKind: "ShipKind",
2195
+ Target: "Target",
2196
+ ProjectType: "ProjectType",
2197
+ ProjectTypes: "ProjectTypes",
2198
+ ArtifactCorrelationKey: "ArtifactCorrelationKey",
2199
+ PackageName: "PackageName",
2200
+ PackageVersion: "PackageVersion",
2201
+ PackageVersionKey: "PackageVersionKey",
2202
+ DeploymentKey: "DeploymentKey",
2203
+ SolutionId: "SolutionId",
2204
+ FolderKey: "FolderKey",
2205
+ FeedId: "FeedId"
2206
+ };
2207
+ var ErrorDimensions = {
2208
+ Result: "Result",
2209
+ ErrorCode: "ErrorCode",
2210
+ Retry: "Retry",
2211
+ ErrorMessage: "ErrorMessage",
2212
+ HttpStatus: "HttpStatus",
2213
+ UpstreamErrorCode: "UpstreamErrorCode"
2214
+ };
2215
+ var AuthDimensions = {
2216
+ AuthenticationMethod: "AuthenticationMethod",
2217
+ Success: "Success",
2218
+ Reason: "Reason"
2219
+ };
2220
+ var SkillsDimensions = {
2221
+ SchemaVersion: "SchemaVersion",
2222
+ AgentType: "AgentType",
2223
+ SkillsVersion: "SkillsVersion",
2224
+ UipSubcommand: "UipSubcommand",
2225
+ FileExtension: "FileExtension",
2226
+ SubagentModel: "SubagentModel",
2227
+ SubagentType: "SubagentType",
2228
+ PermissionMode: "PermissionMode",
2229
+ EffortLevel: "EffortLevel",
2230
+ SessionSource: "SessionSource",
2231
+ Outcome: "Outcome",
2232
+ DurationMs: "DurationMs",
2233
+ Source: "Source"
2234
+ };
2235
+ var PackagerDimensions = {
2236
+ ProjectId: "ProjectId",
2237
+ ProjectType: "ProjectType",
2238
+ SolutionId: "SolutionId"
2239
+ };
2240
+ var ScopeDimensions = {
2241
+ FolderId: "FolderId"
2242
+ };
2243
+ var ID_DIMENSIONS = new Set([
2244
+ BaseDimensions.CloudUserId,
2245
+ BaseDimensions.CloudTenantId,
2246
+ BaseDimensions.CloudOrganizationId,
2247
+ BaseDimensions.InstallationId,
2248
+ ShipDimensions.ArtifactCorrelationKey,
2249
+ ShipDimensions.PackageVersionKey,
2250
+ ShipDimensions.DeploymentKey,
2251
+ ShipDimensions.SolutionId,
2252
+ ShipDimensions.FolderKey,
2253
+ ShipDimensions.FeedId,
2254
+ PackagerDimensions.ProjectId
2255
+ ]);
2256
+ var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
2257
+ var RESERVED_DIMENSION_NAMES = new Set([
2258
+ ...Object.values(BaseDimensions),
2259
+ ...Object.values(CommandDimensions),
2260
+ ...Object.values(ShipDimensions),
2261
+ ...Object.values(ProjectDimensions),
2262
+ ...Object.values(ErrorDimensions),
2263
+ ...Object.values(AuthDimensions),
2264
+ ...Object.values(SkillsDimensions),
2265
+ ...Object.values(PackagerDimensions),
2266
+ ...Object.values(ScopeDimensions)
2267
+ ]);
2268
+ var CURATED_DIMENSIONS = new Set([
2269
+ BaseDimensions.ApplicationName,
2270
+ BaseDimensions.ProductVersion,
2271
+ BaseDimensions.InstallationId,
2272
+ BaseDimensions.CloudUserId,
2273
+ BaseDimensions.CloudTenantId,
2274
+ BaseDimensions.CloudOrganizationId,
2275
+ BaseDimensions.IsInternalUser,
2276
+ BaseDimensions.Environment,
2277
+ BaseDimensions.BaseUrl,
2278
+ BaseDimensions.Region,
2279
+ BaseDimensions.Agent,
2280
+ BaseDimensions.AgentVersion,
2281
+ BaseDimensions.ToolVersion,
2282
+ BaseDimensions.ExecutionContext,
2283
+ BaseDimensions.CiProvider,
2284
+ BaseDimensions.SessionIdSource,
2285
+ BaseDimensions.SessionId,
2286
+ ...Object.values(CommandDimensions),
2287
+ ...Object.values(ShipDimensions),
2288
+ ...Object.values(ProjectDimensions)
2289
+ ]);
2290
+ function lowercaseIdDimensionValues(properties) {
2291
+ let changed = false;
2292
+ const result = {
2293
+ ...properties
2294
+ };
2295
+ for (const key of Object.keys(result)) {
2296
+ const value = result[key];
2297
+ if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
2298
+ continue;
2299
+ }
2300
+ const lowered = value.toLowerCase();
2301
+ if (lowered !== value) {
2302
+ result[key] = lowered;
2303
+ changed = true;
2304
+ }
2305
+ }
2306
+ return changed ? result : properties;
2307
+ }
2308
+
2309
+ // ../common/src/telemetry/project-identity.ts
2310
+ function projectKey(id) {
2311
+ if (typeof id !== "string")
2312
+ return;
2313
+ const key = id.trim().toLowerCase().replaceAll("-", "");
2314
+ return /^[0-9a-f]{32}$/.test(key) ? key : undefined;
2315
+ }
2316
+ function projectIdentityProperties(identity) {
2317
+ const key = identity.id ? projectKey(identity.id) : undefined;
2318
+ return {
2319
+ [ProjectDimensions.ProjectIdentityStatus]: identity.status === "resolved" && !key ? "invalid" : identity.status,
2320
+ [ProjectDimensions.ProjectType]: identity.projectType,
2321
+ ...identity.status === "resolved" && key ? {
2322
+ [ProjectDimensions.ProjectKey]: key
2323
+ } : {}
2324
+ };
2325
+ }
2326
+ var PROJECT_IDENTITY_LOOKUP_BUDGET_MS = 1000;
2327
+ async function withinProjectIdentityBudget(work, onTimeout) {
2328
+ work.catch(() => {
2329
+ return;
2330
+ });
2331
+ let timer;
2332
+ const expired = new Promise((resolve) => {
2333
+ timer = setTimeout(() => {
2334
+ onTimeout?.();
2335
+ resolve(undefined);
2336
+ }, PROJECT_IDENTITY_LOOKUP_BUDGET_MS);
2337
+ });
2338
+ try {
2339
+ return await Promise.race([work, expired]);
2340
+ } finally {
2341
+ clearTimeout(timer);
2342
+ }
2343
+ }
2118
2344
 
2119
2345
  // ../common/src/telemetry/pseudonymize.ts
2120
2346
  var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
@@ -2579,6 +2805,8 @@ function redactProperty(name, value) {
2579
2805
  if (isSensitiveName(name)) {
2580
2806
  return REDACTED;
2581
2807
  }
2808
+ if (GUID_KEY_DIMENSIONS.has(name))
2809
+ return projectKey(value);
2582
2810
  if (typeof value === "boolean" || typeof value === "number") {
2583
2811
  return value;
2584
2812
  }
@@ -2653,6 +2881,63 @@ function settlePromiseLike(thenable) {
2653
2881
  return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
2654
2882
  }
2655
2883
 
2884
+ // ../common/src/error-codes.ts
2885
+ var CLI_ERROR_CODES = [
2886
+ "invalid_argument",
2887
+ "authentication_required",
2888
+ "permission_denied",
2889
+ "local_permission_denied",
2890
+ "not_found",
2891
+ "rate_limited",
2892
+ "network_error",
2893
+ "timeout",
2894
+ "server_error",
2895
+ "method_not_allowed",
2896
+ "not_supported",
2897
+ "configuration_error",
2898
+ "execution_failed",
2899
+ "unknown_error"
2900
+ ];
2901
+ var RETRY_HINTS = [
2902
+ "RetryWillNotFix",
2903
+ "RetryLater",
2904
+ "RetryAfter1Second",
2905
+ "RetryAfter10Seconds",
2906
+ "RetryAfter30Seconds",
2907
+ "RetryAfter60Seconds"
2908
+ ];
2909
+ var CLI_ERROR_CODE_VALUES = new Set(CLI_ERROR_CODES);
2910
+ var RETRY_HINT_VALUES = new Set(RETRY_HINTS);
2911
+ function isCliErrorCode(value) {
2912
+ return typeof value === "string" && CLI_ERROR_CODE_VALUES.has(value);
2913
+ }
2914
+ function isRetryHint(value) {
2915
+ return typeof value === "string" && RETRY_HINT_VALUES.has(value);
2916
+ }
2917
+ function carriedErrorCode(error) {
2918
+ if (!error || typeof error !== "object")
2919
+ return;
2920
+ const code = error.errorCode;
2921
+ return isCliErrorCode(code) ? code : undefined;
2922
+ }
2923
+ function carriedRetry(error) {
2924
+ if (!error || typeof error !== "object")
2925
+ return;
2926
+ const retry = error.retry;
2927
+ return isRetryHint(retry) ? retry : undefined;
2928
+ }
2929
+ function defaultRetryForErrorCode(errorCode) {
2930
+ switch (errorCode) {
2931
+ case "network_error":
2932
+ case "rate_limited":
2933
+ case "server_error":
2934
+ case "timeout":
2935
+ return "RetryLater";
2936
+ default:
2937
+ return "RetryWillNotFix";
2938
+ }
2939
+ }
2940
+
2656
2941
  // ../common/src/error-graph.ts
2657
2942
  function* walkErrorGraph(error) {
2658
2943
  const queue = [error];
@@ -2697,6 +2982,40 @@ function findHttpStatusInGraph(error) {
2697
2982
  return;
2698
2983
  }
2699
2984
 
2985
+ // ../common/src/http-status.ts
2986
+ function classifyHttpStatus(status) {
2987
+ if (status === undefined)
2988
+ return;
2989
+ if (status === 400 || status === 409 || status === 413 || status === 422) {
2990
+ return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
2991
+ }
2992
+ if (status === 401) {
2993
+ return {
2994
+ errorCode: "authentication_required",
2995
+ retry: "RetryWillNotFix"
2996
+ };
2997
+ }
2998
+ if (status === 403) {
2999
+ return { errorCode: "permission_denied", retry: "RetryWillNotFix" };
3000
+ }
3001
+ if (status === 404) {
3002
+ return { errorCode: "not_found", retry: "RetryWillNotFix" };
3003
+ }
3004
+ if (status === 405) {
3005
+ return { errorCode: "method_not_allowed", retry: "RetryWillNotFix" };
3006
+ }
3007
+ if (status === 408) {
3008
+ return { errorCode: "timeout", retry: "RetryLater" };
3009
+ }
3010
+ if (status === 429) {
3011
+ return { errorCode: "rate_limited", retry: "RetryLater" };
3012
+ }
3013
+ if (status >= 500 && status < 600) {
3014
+ return { errorCode: "server_error", retry: "RetryLater" };
3015
+ }
3016
+ return;
3017
+ }
3018
+
2700
3019
  // ../common/src/local-permission-codes.ts
2701
3020
  var LOCAL_PERMISSION_ERROR_CODES = new Set([
2702
3021
  "EACCES",
@@ -2709,6 +3028,8 @@ var DEFAULT_401 = "Unauthorized (401). The session is missing or expired, or its
2709
3028
  var DEFAULT_403 = "Forbidden (403). The account lacks permission for this operation, or the token carries no scope for this API. Run `uip login status --detailed` to see the token's scopes.";
2710
3029
  var DEFAULT_405 = "Method Not Allowed (405). The endpoint may not exist or the base URL may be incorrect.";
2711
3030
  var DEFAULT_413 = "Payload too large (413). The upload exceeded the server or CDN size limit. Reduce the package size — for example, exclude unused dependencies or remove large files from the project — and try again.";
3031
+ var CLOUDFLARE_BLOCK_403 = "Forbidden (403) by Cloudflare, in front of the service: the answer is a Cloudflare HTML page, not the service's JSON, so the service did not see the request and did not check the account's roles or the token's scopes. Cloudflare blocks a request when its content matches a firewall rule (text that looks like SQL or script code, for example) or when it comes from a network the firewall does not allow.";
3032
+ var CLOUDFLARE_BLOCK_403_INSTRUCTIONS = "If the request carries text that looks like code, change that text and try again. Otherwise send the time of the request and the Cloudflare Ray ID, when the message gives one, to the owner of the service or UiPath support.";
2712
3033
  var HTML_RESPONSE_MESSAGE = "Received HTML instead of the expected JSON response.";
2713
3034
  var NETWORK_ERROR_CODES = new Set([
2714
3035
  "ECONNREFUSED",
@@ -2794,7 +3115,21 @@ function localPermissionPath(path, message) {
2794
3115
  return path;
2795
3116
  return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
2796
3117
  }
2797
- function isHtmlDocument(body) {
3118
+ function readHeader(response, name) {
3119
+ const headers = response?.headers;
3120
+ if (!headers || typeof headers !== "object")
3121
+ return;
3122
+ if (typeof headers.get === "function") {
3123
+ const value = headers.get(name);
3124
+ if (value)
3125
+ return value;
3126
+ }
3127
+ const plain = headers;
3128
+ const key = Object.keys(plain).find((k) => k.toLowerCase() === name.toLowerCase());
3129
+ const value = key === undefined ? undefined : plain[key];
3130
+ return typeof value === "string" && value !== "" ? value : undefined;
3131
+ }
3132
+ function isHtmlDocument(body) {
2798
3133
  return /^\s*(<!doctype html|<html\b)/i.test(body);
2799
3134
  }
2800
3135
  function retryHintForRetryAfter(seconds) {
@@ -2810,36 +3145,9 @@ function retryHintForRetryAfter(seconds) {
2810
3145
  return "RetryAfter60Seconds";
2811
3146
  }
2812
3147
  function classifyError(status, error) {
2813
- if (status === 400 || status === 409 || status === 422) {
2814
- return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
2815
- }
2816
- if (status === 401) {
2817
- return {
2818
- errorCode: "authentication_required",
2819
- retry: "RetryWillNotFix"
2820
- };
2821
- }
2822
- if (status === 403) {
2823
- return { errorCode: "permission_denied", retry: "RetryWillNotFix" };
2824
- }
2825
- if (status === 404) {
2826
- return { errorCode: "not_found", retry: "RetryWillNotFix" };
2827
- }
2828
- if (status === 405) {
2829
- return { errorCode: "method_not_allowed", retry: "RetryWillNotFix" };
2830
- }
2831
- if (status === 413) {
2832
- return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
2833
- }
2834
- if (status === 408) {
2835
- return { errorCode: "timeout", retry: "RetryLater" };
2836
- }
2837
- if (status === 429) {
2838
- return { errorCode: "rate_limited", retry: "RetryLater" };
2839
- }
2840
- if (status !== undefined && status >= 500 && status < 600) {
2841
- return { errorCode: "server_error", retry: "RetryLater" };
2842
- }
3148
+ const byStatus = classifyHttpStatus(status);
3149
+ if (byStatus)
3150
+ return byStatus;
2843
3151
  if (status === undefined && describePermissionError(error)) {
2844
3152
  return {
2845
3153
  errorCode: "local_permission_denied",
@@ -2855,6 +3163,17 @@ function classifyError(status, error) {
2855
3163
  }
2856
3164
  return { errorCode: "unknown_error", retry: "RetryWillNotFix" };
2857
3165
  }
3166
+ function withCarriedClass(inferred, error) {
3167
+ const errorCode = carriedErrorCode(error);
3168
+ const retry = carriedRetry(error);
3169
+ if (errorCode === undefined || errorCode === inferred.errorCode) {
3170
+ return {
3171
+ errorCode: inferred.errorCode,
3172
+ retry: retry ?? inferred.retry
3173
+ };
3174
+ }
3175
+ return { errorCode, retry: retry ?? defaultRetryForErrorCode(errorCode) };
3176
+ }
2858
3177
  function formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus) {
2859
3178
  if (extractedMessage) {
2860
3179
  return `HTTP ${status}: ${extractedMessage}`;
@@ -2910,9 +3229,14 @@ async function extractErrorDetails(error, options) {
2910
3229
  const classificationStatus = status ?? findHttpStatusInGraph(error);
2911
3230
  const classification = classifyError(classificationStatus, error);
2912
3231
  let retry = classification.retry;
3232
+ const htmlForbidden = status === 403 && rawBody !== undefined && isHtmlDocument(rawBody);
3233
+ const rayId = htmlForbidden ? readHeader(response, "cf-ray") : undefined;
3234
+ const cloudflareBlock = htmlForbidden && (rayId !== undefined || /\bcloudflare\b/i.test(readHeader(response, "server") ?? ""));
2913
3235
  if (status === 401) {
2914
3236
  message = DEFAULT_401;
2915
3237
  result = "AuthenticationError";
3238
+ } else if (cloudflareBlock) {
3239
+ message = rayId ? `${CLOUDFLARE_BLOCK_403} Cloudflare Ray ID: ${rayId}.` : CLOUDFLARE_BLOCK_403;
2916
3240
  } else if (status === 403) {
2917
3241
  message = options?.forbiddenMessage ?? DEFAULT_403;
2918
3242
  result = "AuthenticationError";
@@ -2960,7 +3284,9 @@ async function extractErrorDetails(error, options) {
2960
3284
  }
2961
3285
  }
2962
3286
  let details = rawMessage;
2963
- if (rawBody) {
3287
+ if (htmlForbidden) {
3288
+ details = cloudflareBlock ? CLOUDFLARE_BLOCK_403_INSTRUCTIONS : HTML_RESPONSE_MESSAGE;
3289
+ } else if (rawBody) {
2964
3290
  if (parsedBody) {
2965
3291
  const extra = {};
2966
3292
  if (parsedBody.errorCode)
@@ -2994,6 +3320,8 @@ async function extractErrorDetails(error, options) {
2994
3320
  }
2995
3321
  if (parsedBody?.requestId && typeof parsedBody.requestId === "string") {
2996
3322
  context.requestId = parsedBody.requestId;
3323
+ } else if (cloudflareBlock && rayId) {
3324
+ context.requestId = rayId;
2997
3325
  }
2998
3326
  if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
2999
3327
  context.traceId = parsedBody.traceId;
@@ -3002,16 +3330,7 @@ async function extractErrorDetails(error, options) {
3002
3330
  context.path = permission.path;
3003
3331
  }
3004
3332
  if (status === 429) {
3005
- const resp = response;
3006
- const headersObj = resp?.headers;
3007
- let retryAfterValue;
3008
- if (headersObj && typeof headersObj === "object" && typeof headersObj.get === "function") {
3009
- retryAfterValue = headersObj.get("retry-after") ?? undefined;
3010
- }
3011
- if (!retryAfterValue && headersObj && typeof headersObj === "object") {
3012
- const headers = headersObj;
3013
- retryAfterValue = headers["retry-after"] ?? headers["Retry-After"];
3014
- }
3333
+ const retryAfterValue = readHeader(response, "retry-after");
3015
3334
  if (retryAfterValue) {
3016
3335
  const seconds = Number(retryAfterValue);
3017
3336
  if (!Number.isNaN(seconds)) {
@@ -3045,9 +3364,8 @@ async function extractErrorDetails(error, options) {
3045
3364
  }
3046
3365
  return {
3047
3366
  result,
3048
- errorCode: classification.errorCode,
3367
+ ...withCarriedClass({ errorCode: classification.errorCode, retry }, error),
3049
3368
  message,
3050
- retry,
3051
3369
  details,
3052
3370
  ...hasContext ? { context } : {},
3053
3371
  ...parsedErrors ? { parsedErrors } : {}
@@ -3058,6 +3376,16 @@ async function extractErrorMessage(error, options) {
3058
3376
  return message;
3059
3377
  }
3060
3378
 
3379
+ // ../common/src/result-types.ts
3380
+ var RESULTS = {
3381
+ Success: "Success",
3382
+ Failure: "Failure",
3383
+ ConfigError: "ConfigError",
3384
+ AuthenticationError: "AuthenticationError",
3385
+ ValidationError: "ValidationError",
3386
+ TimeoutError: "TimeoutError"
3387
+ };
3388
+
3061
3389
  // ../common/src/output-context.ts
3062
3390
  function createStorage() {
3063
3391
  const [error, mod] = catchError(() => __require("node:async_hooks"));
@@ -3275,158 +3603,97 @@ function getLogFilePath() {
3275
3603
  return logger.getLogFilePath();
3276
3604
  }
3277
3605
 
3278
- // ../common/src/telemetry/telemetry-dimensions.ts
3279
- var BaseDimensions = {
3280
- ApplicationName: "ApplicationName",
3281
- ProductVersion: "ProductVersion",
3282
- InstallationId: "InstallationId",
3283
- CloudUserId: "CloudUserId",
3284
- CloudTenantId: "CloudTenantId",
3285
- CloudOrganizationId: "CloudOrganizationId",
3286
- IsInternalUser: "IsInternalUser",
3287
- Environment: "Environment",
3288
- BaseUrl: "BaseUrl",
3289
- Region: "Region",
3290
- Agent: "Agent",
3291
- AgentVersion: "AgentVersion",
3292
- AgentModel: "AgentModel",
3293
- ToolName: "ToolName",
3294
- ToolVersion: "ToolVersion",
3295
- ExecutionContext: "ExecutionContext",
3296
- CiProvider: "CiProvider",
3297
- SessionIdSource: "SessionIdSource",
3298
- SessionId: "SessionId"
3299
- };
3300
- var CommandDimensions = {
3301
- IsCommand: "IsCommand",
3302
- IsReexec: "IsReexec",
3303
- CommandName: "CommandName",
3304
- ExitCode: "ExitCode",
3305
- TerminalOutcome: "TerminalOutcome",
3306
- ErrorClass: "ErrorClass",
3307
- TerminalSignal: "TerminalSignal",
3308
- ErrorMessage: "ErrorMessage",
3309
- SkillName: "SkillName",
3310
- ProductArea: "ProductArea",
3311
- Mode: "Mode"
3312
- };
3313
- var ShipDimensions = {
3314
- ShipKind: "ShipKind",
3315
- Target: "Target",
3316
- ProjectType: "ProjectType",
3317
- ProjectTypes: "ProjectTypes",
3318
- ArtifactCorrelationKey: "ArtifactCorrelationKey",
3319
- PackageName: "PackageName",
3320
- PackageVersion: "PackageVersion",
3321
- PackageVersionKey: "PackageVersionKey",
3322
- DeploymentKey: "DeploymentKey",
3323
- SolutionId: "SolutionId",
3324
- FolderKey: "FolderKey",
3325
- FeedId: "FeedId"
3326
- };
3327
- var ErrorDimensions = {
3328
- Result: "Result",
3329
- ErrorCode: "ErrorCode",
3330
- Retry: "Retry",
3331
- ErrorMessage: "ErrorMessage",
3332
- HttpStatus: "HttpStatus",
3333
- UpstreamErrorCode: "UpstreamErrorCode"
3334
- };
3335
- var AuthDimensions = {
3336
- AuthenticationMethod: "AuthenticationMethod",
3337
- Success: "Success",
3338
- Reason: "Reason"
3339
- };
3340
- var SkillsDimensions = {
3341
- SchemaVersion: "SchemaVersion",
3342
- AgentType: "AgentType",
3343
- SkillsVersion: "SkillsVersion",
3344
- UipSubcommand: "UipSubcommand",
3345
- FileExtension: "FileExtension",
3346
- SubagentModel: "SubagentModel",
3347
- SubagentType: "SubagentType",
3348
- PermissionMode: "PermissionMode",
3349
- EffortLevel: "EffortLevel",
3350
- SessionSource: "SessionSource",
3351
- Outcome: "Outcome",
3352
- DurationMs: "DurationMs",
3353
- Source: "Source"
3354
- };
3355
- var PackagerDimensions = {
3356
- ProjectId: "ProjectId",
3357
- ProjectType: "ProjectType",
3358
- SolutionId: "SolutionId"
3359
- };
3360
- var ScopeDimensions = {
3361
- FolderId: "FolderId"
3362
- };
3363
- var ID_DIMENSIONS = new Set([
3364
- BaseDimensions.CloudUserId,
3365
- BaseDimensions.CloudTenantId,
3366
- BaseDimensions.CloudOrganizationId,
3367
- BaseDimensions.InstallationId,
3368
- ShipDimensions.ArtifactCorrelationKey,
3369
- ShipDimensions.PackageVersionKey,
3370
- ShipDimensions.DeploymentKey,
3371
- ShipDimensions.SolutionId,
3372
- ShipDimensions.FolderKey,
3373
- ShipDimensions.FeedId,
3374
- PackagerDimensions.ProjectId
3375
- ]);
3376
- var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
3377
- var RESERVED_DIMENSION_NAMES = new Set([
3378
- ...Object.values(BaseDimensions),
3379
- ...Object.values(CommandDimensions),
3380
- ...Object.values(ShipDimensions),
3381
- ...Object.values(ErrorDimensions),
3382
- ...Object.values(AuthDimensions),
3383
- ...Object.values(SkillsDimensions),
3384
- ...Object.values(PackagerDimensions),
3385
- ...Object.values(ScopeDimensions)
3386
- ]);
3387
- var CURATED_DIMENSIONS = new Set([
3388
- BaseDimensions.ApplicationName,
3389
- BaseDimensions.ProductVersion,
3390
- BaseDimensions.InstallationId,
3391
- BaseDimensions.CloudUserId,
3392
- BaseDimensions.CloudTenantId,
3393
- BaseDimensions.CloudOrganizationId,
3394
- BaseDimensions.IsInternalUser,
3395
- BaseDimensions.Environment,
3396
- BaseDimensions.BaseUrl,
3397
- BaseDimensions.Region,
3398
- BaseDimensions.Agent,
3399
- BaseDimensions.AgentVersion,
3400
- BaseDimensions.ToolVersion,
3401
- BaseDimensions.ExecutionContext,
3402
- BaseDimensions.CiProvider,
3403
- BaseDimensions.SessionIdSource,
3404
- BaseDimensions.SessionId,
3405
- ...Object.values(CommandDimensions),
3406
- ...Object.values(ShipDimensions)
3407
- ]);
3408
- function lowercaseIdDimensionValues(properties) {
3409
- let changed = false;
3410
- const result = {
3411
- ...properties
3412
- };
3413
- for (const key of Object.keys(result)) {
3414
- const value = result[key];
3415
- if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
3416
- continue;
3417
- }
3418
- const lowered = value.toLowerCase();
3419
- if (lowered !== value) {
3420
- result[key] = lowered;
3421
- changed = true;
3422
- }
3606
+ // ../common/src/timings.ts
3607
+ var TIMINGS_ENV_VAR = "UIP_TIMINGS";
3608
+ function createStorage2() {
3609
+ const [error, mod] = catchError(() => __require("node:async_hooks"));
3610
+ if (error || typeof mod?.AsyncLocalStorage !== "function") {
3611
+ return {
3612
+ getStore: () => {
3613
+ return;
3614
+ },
3615
+ run: (_store, fn) => fn()
3616
+ };
3423
3617
  }
3424
- return changed ? result : properties;
3618
+ return new mod.AsyncLocalStorage;
3619
+ }
3620
+ var storageSlot = singleton("TimingStorage");
3621
+ var stateSlot = singleton("Timings");
3622
+ var rootStartedSlot = singleton("TimingsRootStarted");
3623
+ var longLivedHostSlot = singleton("TimingsLongLivedHost");
3624
+ var storage = storageSlot.getOrInit(createStorage2, (value) => ("getStore" in value));
3625
+ function newState(baseline) {
3626
+ return { baseline, httpMs: 0, httpCalls: 0 };
3627
+ }
3628
+ function getState() {
3629
+ const scoped = storage.getStore();
3630
+ if (scoped) {
3631
+ return scoped;
3632
+ }
3633
+ const pinned = livePinnedState();
3634
+ if (pinned !== undefined) {
3635
+ return pinned;
3636
+ }
3637
+ return newState(processStartIsInvocationStart() ? 0 : performance.now());
3638
+ }
3639
+ function livePinnedState() {
3640
+ const pinned = stateSlot.get();
3641
+ return pinned !== undefined && "httpCalls" in pinned && !pinned.finished ? pinned : undefined;
3642
+ }
3643
+ function processStartIsInvocationStart() {
3644
+ return !rootStartedSlot.get(false) && !longLivedHostSlot.get(false);
3645
+ }
3646
+ function timingsEnabled() {
3647
+ if (typeof process === "undefined") {
3648
+ return false;
3649
+ }
3650
+ const value = process.env?.[TIMINGS_ENV_VAR];
3651
+ if (value === undefined) {
3652
+ return false;
3653
+ }
3654
+ const normalized = value.trim().toLowerCase();
3655
+ return normalized === "1" || normalized === "true";
3656
+ }
3657
+ function recordExitCode(exitCode) {
3658
+ if (!timingsEnabled()) {
3659
+ return;
3660
+ }
3661
+ getState().exitCode = exitCode;
3662
+ }
3663
+ function invocationStartedAt() {
3664
+ return new Date(performance.timeOrigin + getState().baseline);
3665
+ }
3666
+ function invocationElapsedMs() {
3667
+ return performance.now() - getState().baseline;
3668
+ }
3669
+ function markCommandStart() {
3670
+ if (!timingsEnabled()) {
3671
+ return;
3672
+ }
3673
+ getState().commandStart = performance.now();
3674
+ }
3675
+ function recordCommandDuration(durationMs) {
3676
+ if (!timingsEnabled()) {
3677
+ return;
3678
+ }
3679
+ getState().commandMs = durationMs;
3425
3680
  }
3426
3681
 
3427
3682
  // ../common/src/exit-code.ts
3428
3683
  function setExitCode(code) {
3429
3684
  process.exitCode = code;
3685
+ recordExitCode(code);
3686
+ }
3687
+ var GENERIC_FAILURE_EXIT_CODE = 1;
3688
+ function recordCommandExit(code) {
3689
+ if (code === GENERIC_FAILURE_EXIT_CODE && getExitCode() !== 0) {
3690
+ return;
3691
+ }
3692
+ setExitCode(code);
3693
+ }
3694
+ function getExitCode() {
3695
+ const code = process.exitCode;
3696
+ return typeof code === "number" ? code : 0;
3430
3697
  }
3431
3698
 
3432
3699
  // ../common/src/output-codecs.ts
@@ -3435,12 +3702,12 @@ var jmespathSlot = singleton("JmespathCodec");
3435
3702
  async function loadOutputCodecsAsync(needed) {
3436
3703
  const loads = [];
3437
3704
  if (needed.yaml && yamlSlot.get() === undefined) {
3438
- loads.push(import("./js-yaml-87cdx6bm.js").then((mod) => {
3705
+ loads.push(import("./js-yaml-a2bk27p6.js").then((mod) => {
3439
3706
  yamlSlot.set(mod);
3440
3707
  }));
3441
3708
  }
3442
3709
  if (needed.filter && jmespathSlot.get() === undefined) {
3443
- loads.push(import("./jmespath-e4a59c8w.js").then((m)=>__toESM(m.default,1)).then((mod) => {
3710
+ loads.push(import("./jmespath-wwym30dp.js").then((m)=>__toESM(m.default,1)).then((mod) => {
3444
3711
  jmespathSlot.set(mod);
3445
3712
  }));
3446
3713
  }
@@ -3583,17 +3850,8 @@ function terminalSignalFor(input, outcome) {
3583
3850
  }
3584
3851
  return outcome === "cancelled" ? "SIGINT" : undefined;
3585
3852
  }
3586
- function classifyHttpStatus(status) {
3587
- if (status === 401 || status === 403) {
3588
- return "auth";
3589
- }
3590
- if (status === 400 || status === 409 || status === 422) {
3591
- return "validation";
3592
- }
3593
- if (status === 408) {
3594
- return "timeout";
3595
- }
3596
- return "network_http";
3853
+ function classifyFailingHttpStatus(status) {
3854
+ return classifyFromErrorCode(classifyHttpStatus(status)?.errorCode) ?? "network_http";
3597
3855
  }
3598
3856
  function classifyFromResult(result) {
3599
3857
  switch (result) {
@@ -3673,7 +3931,7 @@ function classifyError2(input) {
3673
3931
  }
3674
3932
  const status = recorded?.context?.httpStatus ?? findHttpStatusInGraph(input.error);
3675
3933
  if (status !== undefined) {
3676
- return classifyHttpStatus(status);
3934
+ return classifyFailingHttpStatus(status);
3677
3935
  }
3678
3936
  return classifyFromResult(recorded?.result) ?? classifyFromErrorCode(recorded?.errorCode) ?? classifyFromError(input.error) ?? "unknown";
3679
3937
  }
@@ -3705,6 +3963,7 @@ function buildCommandTerminalTelemetryProperties(input) {
3705
3963
  var CommonTelemetryEvents = {
3706
3964
  Start: "Application.Start",
3707
3965
  Error: "Application.Error",
3966
+ ProjectActivity: "Cli.ProjectActivity",
3708
3967
  ShipSucceeded: "Cli.ShipSucceeded"
3709
3968
  };
3710
3969
 
@@ -4222,87 +4481,21 @@ class TelemetryService {
4222
4481
  return hex;
4223
4482
  }
4224
4483
  }
4225
- // ../common/src/timings.ts
4226
- var TIMINGS_ENV_VAR = "UIP_TIMINGS";
4227
- function createStorage2() {
4228
- const [error, mod] = catchError(() => __require("node:async_hooks"));
4229
- if (error || typeof mod?.AsyncLocalStorage !== "function") {
4230
- return {
4231
- getStore: () => {
4232
- return;
4233
- },
4234
- run: (_store, fn) => fn()
4235
- };
4236
- }
4237
- return new mod.AsyncLocalStorage;
4238
- }
4239
- var storageSlot = singleton("TimingStorage");
4240
- var stateSlot = singleton("Timings");
4241
- var rootStartedSlot = singleton("TimingsRootStarted");
4242
- var longLivedHostSlot = singleton("TimingsLongLivedHost");
4243
- var storage = storageSlot.getOrInit(createStorage2, (value) => ("getStore" in value));
4244
- function newState(baseline) {
4245
- return { baseline, httpMs: 0, httpCalls: 0 };
4246
- }
4247
- function getState() {
4248
- const scoped = storage.getStore();
4249
- if (scoped) {
4250
- return scoped;
4251
- }
4252
- const pinned = livePinnedState();
4253
- if (pinned !== undefined) {
4254
- return pinned;
4255
- }
4256
- return newState(processStartIsInvocationStart() ? 0 : performance.now());
4257
- }
4258
- function livePinnedState() {
4259
- const pinned = stateSlot.get();
4260
- return pinned !== undefined && "httpCalls" in pinned && !pinned.finished ? pinned : undefined;
4261
- }
4262
- function processStartIsInvocationStart() {
4263
- return !rootStartedSlot.get(false) && !longLivedHostSlot.get(false);
4264
- }
4265
- function timingsEnabled() {
4266
- if (typeof process === "undefined") {
4267
- return false;
4268
- }
4269
- const value = process.env?.[TIMINGS_ENV_VAR];
4270
- if (value === undefined) {
4271
- return false;
4272
- }
4273
- const normalized = value.trim().toLowerCase();
4274
- return normalized === "1" || normalized === "true";
4275
- }
4276
- function recordExitCode(exitCode) {
4277
- if (!timingsEnabled()) {
4278
- return;
4279
- }
4280
- getState().exitCode = exitCode;
4281
- }
4282
- function invocationStartedAt() {
4283
- return new Date(performance.timeOrigin + getState().baseline);
4284
- }
4285
- function invocationElapsedMs() {
4286
- return performance.now() - getState().baseline;
4287
- }
4288
- function markCommandStart() {
4289
- if (!timingsEnabled()) {
4290
- return;
4291
- }
4292
- getState().commandStart = performance.now();
4293
- }
4294
- function recordCommandDuration(durationMs) {
4295
- if (!timingsEnabled()) {
4296
- return;
4297
- }
4298
- getState().commandMs = durationMs;
4299
- }
4300
4484
  // ../common/src/telemetry/proxy-http-agent.ts
4301
4485
  var slot = singleton("ProxyAuthHttpsAgent");
4302
4486
 
4303
4487
  // ../common/src/telemetry/node-appinsights-telemetry-provider.ts
4304
4488
  var providerSlot = singleton("TelemetryProvider");
4305
4489
 
4490
+ // ../common/src/telemetry/telemetry-config.ts
4491
+ function isTelemetryDisabled() {
4492
+ const value = process.env.UIPATH_TELEMETRY_DISABLED;
4493
+ return value === "1" || value === "true";
4494
+ }
4495
+ function isProjectTelemetryDisabled() {
4496
+ return isTelemetryDisabled() || process.env.UIPATH_PROJECT_TELEMETRY_DISABLED === "1" || process.env.UIPATH_PROJECT_TELEMETRY_DISABLED === "true";
4497
+ }
4498
+
4306
4499
  // ../common/src/telemetry/telemetry-spool.ts
4307
4500
  var sidecarEntrySlot = singleton("TelemetrySidecarEntry");
4308
4501
  var MAX_SPOOL_AGE_MS = 72 * 60 * 60 * 1000;
@@ -4338,7 +4531,6 @@ var telemetry = new Proxy({}, {
4338
4531
  return typeof value === "function" ? value.bind(instance) : value;
4339
4532
  }
4340
4533
  });
4341
-
4342
4534
  // ../common/src/formatter.ts
4343
4535
  var ANSI_STYLES = {
4344
4536
  red: "\x1B[31m",
@@ -4348,52 +4540,6 @@ var ANSI_RESET = "\x1B[0m";
4348
4540
  function styleLine(line, style) {
4349
4541
  return style ? `${ANSI_STYLES[style]}${line}${ANSI_RESET}` : line;
4350
4542
  }
4351
- var CLI_ERROR_CODES = [
4352
- "invalid_argument",
4353
- "authentication_required",
4354
- "permission_denied",
4355
- "local_permission_denied",
4356
- "not_found",
4357
- "rate_limited",
4358
- "network_error",
4359
- "timeout",
4360
- "server_error",
4361
- "method_not_allowed",
4362
- "not_supported",
4363
- "configuration_error",
4364
- "execution_failed",
4365
- "unknown_error"
4366
- ];
4367
- var RETRY_HINTS = [
4368
- "RetryWillNotFix",
4369
- "RetryLater",
4370
- "RetryAfter1Second",
4371
- "RetryAfter10Seconds",
4372
- "RetryAfter30Seconds",
4373
- "RetryAfter60Seconds"
4374
- ];
4375
- var CLI_ERROR_CODE_VALUES = new Set(CLI_ERROR_CODES);
4376
- var RETRY_HINT_VALUES = new Set(RETRY_HINTS);
4377
- function isCliErrorCode(value) {
4378
- return typeof value === "string" && CLI_ERROR_CODE_VALUES.has(value);
4379
- }
4380
- function isRetryHint(value) {
4381
- return typeof value === "string" && RETRY_HINT_VALUES.has(value);
4382
- }
4383
- function carriedErrorCode(error) {
4384
- if (!error || typeof error !== "object")
4385
- return;
4386
- const code = error.errorCode;
4387
- return isCliErrorCode(code) ? code : undefined;
4388
- }
4389
- var RESULTS = {
4390
- Success: "Success",
4391
- Failure: "Failure",
4392
- ConfigError: "ConfigError",
4393
- AuthenticationError: "AuthenticationError",
4394
- ValidationError: "ValidationError",
4395
- TimeoutError: "TimeoutError"
4396
- };
4397
4543
  var EXIT_CODES = {
4398
4544
  Success: 0,
4399
4545
  Failure: 1,
@@ -4402,6 +4548,9 @@ var EXIT_CODES = {
4402
4548
  ValidationError: 3,
4403
4549
  TimeoutError: 4
4404
4550
  };
4551
+ function exitCodeForResult(result) {
4552
+ return EXIT_CODES[result] ?? EXIT_CODES.Failure;
4553
+ }
4405
4554
  function escapeNonAscii(jsonText) {
4406
4555
  return jsonText.replace(/[\u0080-\uffff]/g, (c) => {
4407
4556
  const hex = c.charCodeAt(0).toString(16).padStart(4, "0");
@@ -5094,8 +5243,8 @@ function carriesOnlyNulls(value) {
5094
5243
  }
5095
5244
  return false;
5096
5245
  }
5097
- function nameList(names, cap2 = 12) {
5098
- const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
5246
+ function nameList(names, cap = 12) {
5247
+ const shown = names.slice(0, cap).map((n) => `\`${n}\``);
5099
5248
  const rest = names.length - shown.length;
5100
5249
  return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
5101
5250
  }
@@ -5232,40 +5381,11 @@ function defaultErrorCodeForResult(result) {
5232
5381
  return "unknown_error";
5233
5382
  }
5234
5383
  }
5235
- function parseHttpStatusFromMessage2(message) {
5236
- const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
5237
- if (!match)
5238
- return;
5239
- const status = Number(match[1]);
5240
- return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
5241
- }
5242
- function defaultErrorCodeForHttpStatus(status) {
5243
- if (status === undefined)
5244
- return;
5245
- if (status === 400 || status === 409 || status === 422) {
5246
- return "invalid_argument";
5247
- }
5248
- if (status === 401)
5249
- return "authentication_required";
5250
- if (status === 403)
5251
- return "permission_denied";
5252
- if (status === 404)
5253
- return "not_found";
5254
- if (status === 405)
5255
- return "method_not_allowed";
5256
- if (status === 408)
5257
- return "timeout";
5258
- if (status === 429)
5259
- return "rate_limited";
5260
- if (status >= 500 && status < 600)
5261
- return "server_error";
5262
- return;
5263
- }
5264
5384
  var LOCAL_PERMISSION_TEXT_PATTERN = new RegExp(`(?:\\b|\\()(?:${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})(?::\\s|\\))`);
5265
5385
  function defaultErrorCodeForFailure(data) {
5266
5386
  if (data.Result === RESULTS.Failure) {
5267
- const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
5268
- const errorCode = defaultErrorCodeForHttpStatus(status);
5387
+ const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage(data.Message);
5388
+ const errorCode = classifyHttpStatus(status)?.errorCode;
5269
5389
  if (errorCode)
5270
5390
  return errorCode;
5271
5391
  if (status === undefined && (LOCAL_PERMISSION_TEXT_PATTERN.test(data.Message) || LOCAL_PERMISSION_TEXT_PATTERN.test(data.Instructions))) {
@@ -5274,17 +5394,6 @@ function defaultErrorCodeForFailure(data) {
5274
5394
  }
5275
5395
  return defaultErrorCodeForResult(data.Result);
5276
5396
  }
5277
- function defaultRetryForErrorCode(errorCode) {
5278
- switch (errorCode) {
5279
- case "network_error":
5280
- case "rate_limited":
5281
- case "server_error":
5282
- case "timeout":
5283
- return "RetryLater";
5284
- default:
5285
- return "RetryWillNotFix";
5286
- }
5287
- }
5288
5397
  var OutputFormatter;
5289
5398
  ((OutputFormatter) => {
5290
5399
  function success(data, options) {
@@ -5316,7 +5425,7 @@ var OutputFormatter;
5316
5425
  data.Log ??= getLogFilePath() || undefined;
5317
5426
  data.ErrorCode ??= defaultErrorCodeForFailure(data);
5318
5427
  data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
5319
- const exitCode = EXIT_CODES[data.Result] ?? 1;
5428
+ const exitCode = exitCodeForResult(data.Result);
5320
5429
  setExitCode(exitCode);
5321
5430
  recordCommandFailureTelemetry({
5322
5431
  result: data.Result,
@@ -5411,6 +5520,228 @@ var OutputFormatter;
5411
5520
  OutputFormatter.formatToString = formatToString;
5412
5521
  })(OutputFormatter ||= {});
5413
5522
 
5523
+ // ../common/src/pass-through-tail.ts
5524
+ function maybeOption(arg) {
5525
+ return arg.length > 1 && arg[0] === "-";
5526
+ }
5527
+ function tokenizeTail(cmd, tail) {
5528
+ const find = (flag) => cmd.options.find((option) => option.long === flag || option.short === flag);
5529
+ const digitShort = cmd.options.some((option) => option.short !== undefined && /^-\d$/.test(option.short));
5530
+ const negativeNumber = (arg) => !digitShort && /^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg);
5531
+ const tokens = [];
5532
+ let firstUnknown = -1;
5533
+ let sentinel = -1;
5534
+ let variadic;
5535
+ let group;
5536
+ let groupIndex = 0;
5537
+ let i = 0;
5538
+ while (i < tail.length || group !== undefined) {
5539
+ const index = group === undefined ? i : groupIndex;
5540
+ const arg = group ?? tail[i++];
5541
+ group = undefined;
5542
+ if (arg === "--") {
5543
+ sentinel = index;
5544
+ tokens.push({ kind: "sentinel", index });
5545
+ for (let j = i;j < tail.length; j++) {
5546
+ tokens.push({
5547
+ kind: "operand",
5548
+ index: j,
5549
+ text: tail[j],
5550
+ literal: true
5551
+ });
5552
+ }
5553
+ break;
5554
+ }
5555
+ if (variadic && (!maybeOption(arg) || negativeNumber(arg))) {
5556
+ tokens.push({
5557
+ kind: "option",
5558
+ index,
5559
+ text: arg,
5560
+ option: variadic,
5561
+ value: arg
5562
+ });
5563
+ continue;
5564
+ }
5565
+ variadic = undefined;
5566
+ if (maybeOption(arg)) {
5567
+ const option = find(arg);
5568
+ if (option) {
5569
+ let value;
5570
+ if (option.required) {
5571
+ value = tail[i];
5572
+ if (value !== undefined)
5573
+ i++;
5574
+ } else if (option.optional) {
5575
+ const next = tail[i];
5576
+ if (next !== undefined && (!maybeOption(next) || negativeNumber(next))) {
5577
+ value = next;
5578
+ i++;
5579
+ }
5580
+ }
5581
+ tokens.push({
5582
+ kind: "option",
5583
+ index,
5584
+ text: arg,
5585
+ option,
5586
+ ...value === undefined ? {} : { value }
5587
+ });
5588
+ variadic = option.variadic ? option : undefined;
5589
+ continue;
5590
+ }
5591
+ }
5592
+ if (arg.length > 2 && arg[0] === "-" && arg[1] !== "-") {
5593
+ const option = find(`-${arg[1]}`);
5594
+ if (option) {
5595
+ if (option.required || option.optional) {
5596
+ tokens.push({
5597
+ kind: "option",
5598
+ index,
5599
+ text: arg,
5600
+ option,
5601
+ value: arg.slice(2)
5602
+ });
5603
+ } else {
5604
+ tokens.push({ kind: "option", index, text: arg, option });
5605
+ group = `-${arg.slice(2)}`;
5606
+ groupIndex = index;
5607
+ }
5608
+ continue;
5609
+ }
5610
+ }
5611
+ if (/^--[^=]+=/.test(arg)) {
5612
+ const equals = arg.indexOf("=");
5613
+ const option = find(arg.slice(0, equals));
5614
+ if (option && (option.required || option.optional)) {
5615
+ tokens.push({
5616
+ kind: "option",
5617
+ index,
5618
+ text: arg,
5619
+ option,
5620
+ value: arg.slice(equals + 1)
5621
+ });
5622
+ continue;
5623
+ }
5624
+ }
5625
+ if (maybeOption(arg) && !negativeNumber(arg)) {
5626
+ const equals = arg.startsWith("--") ? arg.indexOf("=") : -1;
5627
+ if (firstUnknown === -1)
5628
+ firstUnknown = index;
5629
+ tokens.push({
5630
+ kind: "unknown",
5631
+ index,
5632
+ text: arg,
5633
+ flag: equals > 0 ? arg.slice(0, equals) : arg,
5634
+ ...equals > 0 ? { inlineValue: arg.slice(equals + 1) } : {}
5635
+ });
5636
+ continue;
5637
+ }
5638
+ tokens.push({ kind: "operand", index, text: arg, literal: false });
5639
+ }
5640
+ return { tokens, firstUnknown, sentinel };
5641
+ }
5642
+
5643
+ // ../common/src/project-telemetry.ts
5644
+ var RESOLVER = Symbol.for("@uipath/common/projectTelemetryResolver");
5645
+ var CAPTURE = Symbol.for("@uipath/common/projectTelemetryCapture");
5646
+ var CONTEXT_RESOLVER = Symbol.for("@uipath/common/projectContextTelemetryResolver");
5647
+ var RULES = Symbol.for("@uipath/common/projectTargetRules");
5648
+ function logSkipped(what, error) {
5649
+ logger.debug(`[project-telemetry] ${what} skipped: ${error instanceof Error ? error.message : String(error)}`);
5650
+ }
5651
+ function bounded(work, what) {
5652
+ return withinProjectIdentityBudget(work, () => logSkipped(what, `no answer within ${PROJECT_IDENTITY_LOOKUP_BUDGET_MS} ms`));
5653
+ }
5654
+ async function identityWithContext(command, identity) {
5655
+ const props = projectIdentityProperties(identity);
5656
+ if (!identity.projectDirectory || isProjectTelemetryDisabled())
5657
+ return props;
5658
+ for (let node = command;node; node = node.parent ?? undefined) {
5659
+ const resolver = node[CONTEXT_RESOLVER];
5660
+ if (typeof resolver !== "function")
5661
+ continue;
5662
+ try {
5663
+ return {
5664
+ ...await resolver(identity.projectDirectory),
5665
+ ...props
5666
+ };
5667
+ } catch (error) {
5668
+ logSkipped("solution context lookup", error);
5669
+ return props;
5670
+ }
5671
+ }
5672
+ return props;
5673
+ }
5674
+ function getProjectTelemetryResolver(command) {
5675
+ for (let node = command;node; node = node.parent) {
5676
+ const resolver = node[RESOLVER];
5677
+ if (typeof resolver === "function")
5678
+ return resolver;
5679
+ }
5680
+ return;
5681
+ }
5682
+ function attachProjectTelemetryCapture(command, capture) {
5683
+ command[CAPTURE] = capture;
5684
+ }
5685
+ class ProjectTelemetrySession {
5686
+ resolver;
5687
+ command;
5688
+ target;
5689
+ props = {};
5690
+ explicit = false;
5691
+ input;
5692
+ constructor(resolver, command) {
5693
+ this.resolver = resolver;
5694
+ this.command = command;
5695
+ }
5696
+ async setTarget(path) {
5697
+ this.target = path;
5698
+ if (this.input) {
5699
+ await this.resolve({
5700
+ ...this.input,
5701
+ phase: "after",
5702
+ success: true
5703
+ });
5704
+ this.explicit = true;
5705
+ }
5706
+ }
5707
+ async setIdentity(identity) {
5708
+ try {
5709
+ const props = await bounded(identityWithContext(this.command, identity), "project identity capture");
5710
+ if (props !== undefined)
5711
+ this.setProperties(props);
5712
+ } catch (error) {
5713
+ logSkipped("project identity capture", error);
5714
+ }
5715
+ }
5716
+ setProperties(properties) {
5717
+ try {
5718
+ this.props = { ...properties };
5719
+ this.explicit = true;
5720
+ } catch (error) {
5721
+ logSkipped("project identity properties", error);
5722
+ }
5723
+ }
5724
+ properties() {
5725
+ return { ...this.props };
5726
+ }
5727
+ async resolve(input) {
5728
+ this.input = input;
5729
+ if (this.explicit)
5730
+ return;
5731
+ try {
5732
+ const props = await bounded(this.resolver({
5733
+ ...input,
5734
+ target: this.target
5735
+ }), `project identity (${input.phase})`);
5736
+ if (props !== undefined) {
5737
+ this.props = props;
5738
+ }
5739
+ } catch (error) {
5740
+ logSkipped(`project identity (${input.phase})`, error);
5741
+ }
5742
+ }
5743
+ }
5744
+
5414
5745
  // ../common/src/telemetry/command-attribution.ts
5415
5746
  var LEGACY_SKILL_NAMESPACE = "uipath:";
5416
5747
  var MAX_SKILL_NAME_LENGTH = 80;
@@ -5655,8 +5986,7 @@ var pollSignalSlot = singleton("PollSignal");
5655
5986
  var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
5656
5987
  var processContext = {
5657
5988
  exit: (code) => {
5658
- recordExitCode(code);
5659
- setExitCode(code);
5989
+ recordCommandExit(code);
5660
5990
  },
5661
5991
  get pollSignal() {
5662
5992
  return pollSignalSlot.get();
@@ -5681,6 +6011,8 @@ function recordableArgValue(value, choices) {
5681
6011
  function extractCommandParams(cmd) {
5682
6012
  const params = {};
5683
6013
  forEachSuppliedArgument(cmd, (name, value, choices, defaulted) => {
6014
+ if (name === undefined)
6015
+ return;
5684
6016
  const recordable = recordableArgValue(value, choices);
5685
6017
  params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = recordable === TELEMETRY_ARG_VALUE_WITHHELD && defaulted ? TELEMETRY_ARG_VALUE_DEFAULTED : recordable;
5686
6018
  });
@@ -5696,7 +6028,8 @@ function isDefaultedPositional(cmd, index) {
5696
6028
  function forEachSuppliedArgument(cmd, visit) {
5697
6029
  const registered = cmd.registeredArguments ?? [];
5698
6030
  const processed = cmd.processedArgs ?? [];
5699
- for (let i = 0;i < registered.length; i++) {
6031
+ const bound = boundPositionalCount(cmd);
6032
+ for (let i = 0;i < bound; i++) {
5700
6033
  const name = registered[i].name();
5701
6034
  if (name && processed[i] !== undefined) {
5702
6035
  visit(name, processed[i], registered[i].argChoices, isDefaultedPositional(cmd, i));
@@ -5711,6 +6044,71 @@ function forEachSuppliedArgument(cmd, visit) {
5711
6044
  visit(key, value, choicesByAttribute.get(key), isDefaultedOption(cmd, key));
5712
6045
  }
5713
6046
  }
6047
+ forEachPassThroughToken(cmd, bound, (name, value) => {
6048
+ visit(name, value, name === undefined ? undefined : choicesByAttribute.get(name), false);
6049
+ });
6050
+ }
6051
+ function boundPositionalCount(cmd) {
6052
+ const registered = cmd.registeredArguments ?? [];
6053
+ if (registered.some((argument) => argument.variadic)) {
6054
+ return registered.length;
6055
+ }
6056
+ if ((cmd.args ?? []).length <= registered.length) {
6057
+ return registered.length;
6058
+ }
6059
+ const firstFlag = tokenizeTail(cmd, (cmd.args ?? []).slice(1)).tokens.find((token) => token.kind !== "operand")?.index ?? -1;
6060
+ return firstFlag === -1 ? registered.length : Math.min(registered.length, firstFlag + 1);
6061
+ }
6062
+ function forEachPassThroughToken(cmd, bound, visit) {
6063
+ const registered = cmd.registeredArguments ?? [];
6064
+ const fillsPositionals = !registered.some((argument) => argument.variadic);
6065
+ const { tokens, firstUnknown } = tokenizeTail(cmd, (cmd.args ?? []).slice(bound));
6066
+ const repeated = new Map;
6067
+ let nextPositional = bound;
6068
+ for (const token of tokens) {
6069
+ const pastUnknown = firstUnknown !== -1 && token.index > firstUnknown;
6070
+ if (token.kind === "sentinel")
6071
+ continue;
6072
+ if (token.kind === "operand") {
6073
+ const claimable = !pastUnknown && fillsPositionals && nextPositional < registered.length;
6074
+ const name = claimable ? registered[nextPositional++].name() : undefined;
6075
+ visit(name || undefined, token.text);
6076
+ continue;
6077
+ }
6078
+ if (token.kind === "unknown") {
6079
+ const bare = token.flag.replace(/^-+/, "");
6080
+ const key = bare.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
6081
+ const keyable = token.flag.startsWith("--") || token.flag.length === 2;
6082
+ if (!pastUnknown && keyable && /^[a-z][a-z0-9-]*$/i.test(bare) && key) {
6083
+ visit(key, token.inlineValue ?? true);
6084
+ } else {
6085
+ visit(undefined, token.text);
6086
+ if (token.inlineValue !== undefined) {
6087
+ visit(undefined, token.inlineValue);
6088
+ } else if (!token.flag.startsWith("--") && token.flag.length > 2) {
6089
+ visit(undefined, token.flag.slice(2));
6090
+ }
6091
+ }
6092
+ continue;
6093
+ }
6094
+ if (pastUnknown) {
6095
+ visit(undefined, token.text);
6096
+ if (token.value !== undefined)
6097
+ visit(undefined, token.value);
6098
+ continue;
6099
+ }
6100
+ const option = token.option;
6101
+ const name = option.attributeName();
6102
+ const value = option.negate ? false : option.required || option.optional ? token.value ?? true : true;
6103
+ const previous = repeated.get(name);
6104
+ if (previous) {
6105
+ previous.push(value);
6106
+ visit(name, previous);
6107
+ } else {
6108
+ repeated.set(name, [value]);
6109
+ visit(name, value);
6110
+ }
6111
+ }
5714
6112
  }
5715
6113
  function withheldArgumentValues(cmd) {
5716
6114
  const values = [];
@@ -5772,6 +6170,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
5772
6170
  const telemetryName = commandTelemetryName(commandParts);
5773
6171
  const commandPath = commandInvocationPath(commandParts);
5774
6172
  const props = typeof properties === "function" ? properties(...args) : properties;
6173
+ const projectResolver = getProjectTelemetryResolver(command);
6174
+ const projectSession = projectResolver && !isProjectTelemetryDisabled() ? new ProjectTelemetrySession(projectResolver, command) : undefined;
5775
6175
  markCommandStart();
5776
6176
  const supplied = recordSuppliedArgumentValues(withheldArgumentValues(command));
5777
6177
  try {
@@ -5784,6 +6184,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
5784
6184
  if (violation) {
5785
6185
  return Promise.reject(violation);
5786
6186
  }
6187
+ if (projectSession) {
6188
+ return projectSession.resolve({ command, args, phase: "before" }).then(() => {
6189
+ attachProjectTelemetryCapture(command, projectSession);
6190
+ return fn(...args);
6191
+ });
6192
+ }
5787
6193
  return fn(...args);
5788
6194
  }));
5789
6195
  if (error) {
@@ -5792,22 +6198,26 @@ Command.prototype.trackedAction = function(context, fn, properties) {
5792
6198
  const typed = error;
5793
6199
  const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
5794
6200
  const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
5795
- const finalResult = customResult ?? RESULTS.Failure;
6201
+ const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
6202
+ const classified = cancellationExitCode === undefined ? await extractErrorDetails(error) : undefined;
6203
+ const finalResult = customResult ?? classified?.result ?? RESULTS.Failure;
5796
6204
  const typedErrorCode = typed.errorCode ?? typed.ErrorCode;
5797
6205
  const customErrorCode = isCliErrorCode(typedErrorCode) ? typedErrorCode : undefined;
5798
6206
  const typedRetry = typed.retry ?? typed.Retry;
5799
6207
  const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
5800
6208
  const typedContext = typed.context ?? typed.Context;
5801
6209
  const customContext = isErrorContext(typedContext) ? typedContext : undefined;
5802
- const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
5803
6210
  fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
6211
+ const errorCode = customErrorCode ?? classified?.errorCode;
6212
+ const retry = customRetry ?? classified?.retry;
6213
+ const errorContext = customContext ?? classified?.context;
5804
6214
  OutputFormatter.error({
5805
6215
  Result: finalResult,
5806
- ...customErrorCode ? { ErrorCode: customErrorCode } : {},
6216
+ ...errorCode ? { ErrorCode: errorCode } : {},
5807
6217
  Message: errorMessage,
5808
6218
  Instructions: customInstructions ?? commandHelpHint(commandPath),
5809
- ...customRetry ? { Retry: customRetry } : {},
5810
- ...customContext ? { Context: customContext } : {}
6219
+ ...retry ? { Retry: retry } : {},
6220
+ ...errorContext ? { Context: errorContext } : {}
5811
6221
  });
5812
6222
  context.exit(fallbackExitCode);
5813
6223
  }
@@ -5816,6 +6226,14 @@ Command.prototype.trackedAction = function(context, fn, properties) {
5816
6226
  const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
5817
6227
  const recordedFailure = takeRecordedCommandFailureTelemetry();
5818
6228
  const success = !error && exitCode === 0;
6229
+ if (projectSession) {
6230
+ await projectSession.resolve({
6231
+ command,
6232
+ args,
6233
+ phase: "after",
6234
+ success
6235
+ });
6236
+ }
5819
6237
  const terminalTelemetry = buildCommandTerminalTelemetryProperties({
5820
6238
  error,
5821
6239
  exitCode,
@@ -5833,6 +6251,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
5833
6251
  }
5834
6252
  const baseProperties = redactProperties({
5835
6253
  ...commandParams,
6254
+ ...projectSession?.properties(),
5836
6255
  ...props,
5837
6256
  ...buildCommandTelemetryAttribution(commandPath, process.env.UIPATH_SKILL),
5838
6257
  ...buildAgentSessionTelemetry(process.env),
@@ -5843,6 +6262,8 @@ Command.prototype.trackedAction = function(context, fn, properties) {
5843
6262
  });
5844
6263
  emitInvocationRequest(telemetryName, success, baseProperties);
5845
6264
  } finally {
6265
+ if (projectSession)
6266
+ attachProjectTelemetryCapture(command, undefined);
5846
6267
  releaseSuppliedArgumentValues(supplied);
5847
6268
  }
5848
6269
  });
@@ -6041,14 +6462,39 @@ function withPseudonymizedIdentifiers(payload) {
6041
6462
  }
6042
6463
  };
6043
6464
  }
6044
- function trackShipSucceeded(payload) {
6465
+ function identityKeysOf(capture) {
6466
+ if (!capture) {
6467
+ return {};
6468
+ }
6469
+ try {
6470
+ const properties = capture.properties?.();
6471
+ if (typeof properties !== "object" || properties === null) {
6472
+ return {};
6473
+ }
6474
+ const keys = {};
6475
+ for (const key of GUID_KEY_DIMENSIONS) {
6476
+ const value = properties[key];
6477
+ if (value !== undefined) {
6478
+ keys[key] = value;
6479
+ }
6480
+ }
6481
+ return keys;
6482
+ } catch (error) {
6483
+ logSkipped("ship identity", error);
6484
+ return {};
6485
+ }
6486
+ }
6487
+ function trackShipSucceeded(payload, capture) {
6045
6488
  const keys = getShippedKeys();
6046
6489
  const key = dedupeKey(payload);
6047
6490
  if (keys.has(key)) {
6048
6491
  return false;
6049
6492
  }
6050
6493
  keys.add(key);
6051
- telemetry.trackEvent(CommonTelemetryEvents.ShipSucceeded, redactProperties(withPseudonymizedIdentifiers(payload)));
6494
+ telemetry.trackEvent(CommonTelemetryEvents.ShipSucceeded, redactProperties({
6495
+ ...withPseudonymizedIdentifiers(payload),
6496
+ ...identityKeysOf(capture)
6497
+ }));
6052
6498
  return true;
6053
6499
  }
6054
6500
  // ../common/src/command-examples.ts
@@ -6367,6 +6813,6 @@ function unsupportedSolutionProjectType(projectType) {
6367
6813
  }
6368
6814
  // ../common/src/tool-provider.ts
6369
6815
  var factorySlot = singleton("PackagerFactoryProvider");
6370
- export { catchError, describeConnectivityError, extractErrorDetails, extractErrorMessage, getOutputSink, logger, CommandDimensions, ShipDimensions, telemetry, carriedErrorCode, RESULTS, EXIT_CODES, pascalCaseDataKeys, ConfigurationError, isConfigurationError, OutputFormatter, InvalidArgumentError, Command, Option, processContext, requireConfirmation, isGuid, canPrompt, mimeTypeForFileName, registerPackageMetadataOptions, mapPackageMetadataOptions, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, quoteForShell, unsupportedSolutionProjectType, trackShipSucceeded };
6816
+ export { CommandDimensions, ShipDimensions, catchError, carriedErrorCode, carriedRetry, describeConnectivityError, extractErrorDetails, extractErrorMessage, RESULTS, InvalidArgumentError, Command, Option, getOutputSink, logger, telemetry, EXIT_CODES, pascalCaseDataKeys, ConfigurationError, isConfigurationError, OutputFormatter, processContext, requireConfirmation, isGuid, canPrompt, mimeTypeForFileName, registerPackageMetadataOptions, mapPackageMetadataOptions, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, quoteForShell, unsupportedSolutionProjectType, trackShipSucceeded };
6371
6817
 
6372
- //# debugId=9AF913DF9FDCBBFE64756E2164756E21
6818
+ //# debugId=089EA1B7CC6EC76464756E2164756E21