@uipath/api-workflow-tool 1.205.0-preview.277 → 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 (30) hide show
  1. package/README.md +41 -0
  2. package/dist/THIRD-PARTY-NOTICES.md +64 -3
  3. package/dist/applicationinsights-web-8m26566f.js +17209 -0
  4. package/dist/executor-tool.js +7 -9
  5. package/dist/index-1wp4j95a.js +10 -0
  6. package/dist/index-3d09whjq.js +11 -0
  7. package/dist/{index-waq4trz1.js → index-njewr1c3.js} +5040 -2961
  8. package/dist/{index-h8cph72k.js → index-nzr4mx5p.js} +2 -22
  9. package/dist/index.js +14 -15
  10. package/dist/index.umd.min-ttg1qc0x.js +7814 -0
  11. package/dist/{jmespath-e4a59c8w.js → jmespath-wwym30dp.js} +1 -1
  12. package/dist/js-yaml-0c4svjwq.js +36 -0
  13. package/dist/{node-0aex431z.js → node-zecqtv6e.js} +13 -90
  14. package/dist/{packager-tool-bgy9gdsp.js → packager-tool-2ckhrf4j.js} +128 -15
  15. package/dist/{packager-tool-kh3aq9n7.js → packager-tool-2wwd7kp4.js} +920 -903
  16. package/dist/{packager-tool-xak3m9vd.js → packager-tool-3hcrfsc1.js} +762 -384
  17. package/dist/{packager-tool-0aacqssr.js → packager-tool-5b6vjjp3.js} +371 -371
  18. package/dist/{packager-tool-d3w0wn6k.js → packager-tool-5gce5wfd.js} +16 -16
  19. package/dist/{packager-tool-f7zta1kg.js → packager-tool-61bdk9sn.js} +203 -156
  20. package/dist/{packager-tool-1yh8g550.js → packager-tool-6an893wm.js} +12 -3
  21. package/dist/{packager-tool-646qm7dh.js → packager-tool-km68yge6.js} +62 -586
  22. package/dist/{packager-tool-evd1kzq2.js → packager-tool-qhv22qaj.js} +809 -380
  23. package/dist/packager-tool-rqprykf5.js +15 -0
  24. package/dist/{packager-tool-h29ph2zm.js → packager-tool-w1asrkzg.js} +361 -205
  25. package/dist/packager-tool.js +6 -6
  26. package/dist/tool.js +13 -14
  27. package/package.json +2 -2
  28. package/dist/index-a8veczhw.js +0 -72
  29. package/dist/index.umd.min-fqefd9kn.js +0 -7814
  30. package/dist/js-yaml-69tsdrrf.js +0 -37
@@ -1,67 +1,6 @@
1
1
  import {
2
2
  __require
3
- } from "./packager-tool-1yh8g550.js";
4
-
5
- // ../common/src/singleton.ts
6
- var PREFIX = "@uipath/common/";
7
- var _g = globalThis;
8
- function singleton(ctorOrName) {
9
- const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
10
- const key = Symbol.for(PREFIX + name);
11
- return {
12
- get(fallback) {
13
- return _g[key] ?? fallback;
14
- },
15
- set(value) {
16
- _g[key] = value;
17
- },
18
- clear() {
19
- delete _g[key];
20
- },
21
- getOrInit(factory, guard) {
22
- const existing = _g[key];
23
- if (existing != null && typeof existing === "object") {
24
- if (!guard || guard(existing)) {
25
- return existing;
26
- }
27
- }
28
- const instance = factory();
29
- _g[key] = instance;
30
- return instance;
31
- }
32
- };
33
- }
34
-
35
- // ../common/src/telemetry/detect-agent.ts
36
- var KNOWN_AGENTS = [
37
- { envVar: "CLAUDECODE", value: "1", id: "claude-code" },
38
- { envVar: "CURSOR_AGENT", value: "1", id: "cursor" },
39
- { envVar: "GEMINI_CLI", value: "1", id: "gemini-cli" },
40
- { envVar: "CODEX_THREAD_ID", id: "codex" },
41
- { envVar: "CODEX_SANDBOX", id: "codex" },
42
- { envVar: "AUGMENT_AGENT", value: "1", id: "augment" },
43
- { envVar: "CLINE_ACTIVE", value: "true", id: "cline" }
44
- ];
45
- function detectAgentFromEnv(env) {
46
- for (const agent of KNOWN_AGENTS) {
47
- const envValue = env[agent.envVar];
48
- if (agent.value !== undefined) {
49
- if (envValue === agent.value)
50
- return agent.id;
51
- } else {
52
- if (envValue)
53
- return agent.id;
54
- }
55
- }
56
- const agentEnv = env.AGENT;
57
- if (agentEnv) {
58
- if (agentEnv === "1" || agentEnv === "true")
59
- return "unknown";
60
- if (agentEnv.length <= 32)
61
- return agentEnv.toLowerCase();
62
- }
63
- return;
64
- }
3
+ } from "./packager-tool-6an893wm.js";
65
4
 
66
5
  // ../common/src/telemetry/telemetry-dimensions.ts
67
6
  var BaseDimensions = {
@@ -98,6 +37,21 @@ var CommandDimensions = {
98
37
  ProductArea: "ProductArea",
99
38
  Mode: "Mode"
100
39
  };
40
+ var ProjectDimensions = {
41
+ ProjectKey: "ProjectKey",
42
+ ProjectType: "ProjectType",
43
+ ProjectIdentityStatus: "ProjectIdentityStatus",
44
+ SolutionKey: "SolutionKey",
45
+ SolutionProjectKey: "SolutionProjectKey",
46
+ SolutionIdentityStatus: "SolutionIdentityStatus",
47
+ PreviousSolutionKey: "PreviousSolutionKey"
48
+ };
49
+ var GUID_KEY_DIMENSIONS = new Set([
50
+ ProjectDimensions.ProjectKey,
51
+ ProjectDimensions.SolutionKey,
52
+ ProjectDimensions.SolutionProjectKey,
53
+ ProjectDimensions.PreviousSolutionKey
54
+ ]);
101
55
  var ShipDimensions = {
102
56
  ShipKind: "ShipKind",
103
57
  Target: "Target",
@@ -166,6 +120,7 @@ var RESERVED_DIMENSION_NAMES = new Set([
166
120
  ...Object.values(BaseDimensions),
167
121
  ...Object.values(CommandDimensions),
168
122
  ...Object.values(ShipDimensions),
123
+ ...Object.values(ProjectDimensions),
169
124
  ...Object.values(ErrorDimensions),
170
125
  ...Object.values(AuthDimensions),
171
126
  ...Object.values(SkillsDimensions),
@@ -191,7 +146,8 @@ var CURATED_DIMENSIONS = new Set([
191
146
  BaseDimensions.SessionIdSource,
192
147
  BaseDimensions.SessionId,
193
148
  ...Object.values(CommandDimensions),
194
- ...Object.values(ShipDimensions)
149
+ ...Object.values(ShipDimensions),
150
+ ...Object.values(ProjectDimensions)
195
151
  ]);
196
152
  function lowercaseIdDimensionValues(properties) {
197
153
  let changed = false;
@@ -212,109 +168,40 @@ function lowercaseIdDimensionValues(properties) {
212
168
  return changed ? result : properties;
213
169
  }
214
170
 
215
- // ../common/src/telemetry/execution-context.ts
216
- var authSignalSlot = singleton("TelemetryExecutionContextAuthSignal");
217
- var isTruthy = (value) => value !== undefined && value !== "" && value !== "0" && value.toLowerCase() !== "false";
218
- var isEqual = (value, expected) => value?.toLowerCase() === expected;
219
- var CI_SIGNATURES = [
220
- {
221
- provider: "github_actions",
222
- matches: (env) => isTruthy(env.GITHUB_ACTIONS),
223
- isScheduler: (env) => env.GITHUB_EVENT_NAME === "schedule"
224
- },
225
- {
226
- provider: "azure_devops",
227
- matches: (env) => isTruthy(env.TF_BUILD),
228
- isScheduler: (env) => isEqual(env.BUILD_REASON, "schedule")
229
- },
230
- {
231
- provider: "gitlab",
232
- matches: (env) => isTruthy(env.GITLAB_CI),
233
- isScheduler: (env) => env.CI_PIPELINE_SOURCE === "schedule"
234
- },
235
- {
236
- provider: "circleci",
237
- matches: (env) => isTruthy(env.CIRCLECI),
238
- isScheduler: (env) => env.CIRCLE_PIPELINE_TRIGGER_SOURCE === "scheduled_pipeline"
239
- },
240
- {
241
- provider: "jenkins",
242
- matches: (env) => isTruthy(env.JENKINS_URL) || isTruthy(env.JENKINS_HOME)
243
- },
244
- {
245
- provider: "teamcity",
246
- matches: (env) => isTruthy(env.TEAMCITY_VERSION)
247
- },
248
- {
249
- provider: "buildkite",
250
- matches: (env) => isTruthy(env.BUILDKITE),
251
- isScheduler: (env) => env.BUILDKITE_SOURCE === "schedule"
252
- },
253
- {
254
- provider: "bitbucket",
255
- matches: (env) => isTruthy(env.BITBUCKET_BUILD_NUMBER)
256
- },
257
- {
258
- provider: "travis",
259
- matches: (env) => isTruthy(env.TRAVIS)
260
- },
261
- {
262
- provider: "appveyor",
263
- matches: (env) => isTruthy(env.APPVEYOR)
264
- },
265
- {
266
- provider: "generic",
267
- matches: (env) => isTruthy(env.CI)
268
- }
269
- ];
270
- function currentEnv() {
271
- return typeof process === "undefined" ? {} : process.env;
272
- }
273
- function currentTtyState() {
274
- if (typeof process === "undefined")
275
- return false;
276
- return Boolean(process.stdout?.isTTY || process.stdin?.isTTY || process.stderr?.isTTY);
277
- }
278
- function detectCi(env) {
279
- const signature = CI_SIGNATURES.find((candidate) => candidate.matches(env));
280
- if (!signature)
171
+ // ../common/src/telemetry/project-identity.ts
172
+ function projectKey(id) {
173
+ if (typeof id !== "string")
281
174
  return;
282
- return {
283
- executionContext: signature.isScheduler?.(env) ? "scheduler" : "ci",
284
- ciProvider: signature.provider
285
- };
286
- }
287
- function detectExecutionContext(options = {}) {
288
- const env = options.env ?? currentEnv();
289
- const ci = detectCi(env);
290
- if (ci)
291
- return ci;
292
- const agent = options.agent ?? detectAgentFromEnv(env);
293
- if (agent) {
294
- return { executionContext: "agent" };
295
- }
296
- const authSignal = options.authSignal ?? authSignalSlot.get();
297
- if (authSignal === "service_account") {
298
- return { executionContext: "service_account" };
299
- }
300
- const isTty = options.isTty ?? currentTtyState();
301
- if (isTty) {
302
- return { executionContext: "manual" };
303
- }
304
- return { executionContext: "unknown" };
175
+ const key = id.trim().toLowerCase().replaceAll("-", "");
176
+ return /^[0-9a-f]{32}$/.test(key) ? key : undefined;
305
177
  }
306
- function getExecutionContextTelemetryProperties() {
307
- const detected = detectExecutionContext();
178
+ function projectIdentityProperties(identity) {
179
+ const key = identity.id ? projectKey(identity.id) : undefined;
308
180
  return {
309
- [BaseDimensions.ExecutionContext]: detected.executionContext,
310
- ...detected.ciProvider ? { [BaseDimensions.CiProvider]: detected.ciProvider } : {}
181
+ [ProjectDimensions.ProjectIdentityStatus]: identity.status === "resolved" && !key ? "invalid" : identity.status,
182
+ [ProjectDimensions.ProjectType]: identity.projectType,
183
+ ...identity.status === "resolved" && key ? {
184
+ [ProjectDimensions.ProjectKey]: key
185
+ } : {}
311
186
  };
312
187
  }
313
-
314
- // ../common/src/telemetry/global-telemetry-properties.ts
315
- var telemetryPropsSlot = singleton("TelemetryDefaultProps");
316
- function getGlobalTelemetryProperties() {
317
- return telemetryPropsSlot.get();
188
+ var PROJECT_IDENTITY_LOOKUP_BUDGET_MS = 1000;
189
+ async function withinProjectIdentityBudget(work, onTimeout) {
190
+ work.catch(() => {
191
+ return;
192
+ });
193
+ let timer;
194
+ const expired = new Promise((resolve) => {
195
+ timer = setTimeout(() => {
196
+ onTimeout?.();
197
+ resolve(undefined);
198
+ }, PROJECT_IDENTITY_LOOKUP_BUDGET_MS);
199
+ });
200
+ try {
201
+ return await Promise.race([work, expired]);
202
+ } finally {
203
+ clearTimeout(timer);
204
+ }
318
205
  }
319
206
 
320
207
  // ../common/src/telemetry/pseudonymize.ts
@@ -483,6 +370,36 @@ function pseudonymize(input) {
483
370
  return digest(`${PSEUDONYM_DOMAIN}${input}`).slice(0, PSEUDONYM_HEX_LENGTH);
484
371
  }
485
372
 
373
+ // ../common/src/singleton.ts
374
+ var PREFIX = "@uipath/common/";
375
+ var _g = globalThis;
376
+ function singleton(ctorOrName) {
377
+ const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
378
+ const key = Symbol.for(PREFIX + name);
379
+ return {
380
+ get(fallback) {
381
+ return _g[key] ?? fallback;
382
+ },
383
+ set(value) {
384
+ _g[key] = value;
385
+ },
386
+ clear() {
387
+ delete _g[key];
388
+ },
389
+ getOrInit(factory, guard) {
390
+ const existing = _g[key];
391
+ if (existing != null && typeof existing === "object") {
392
+ if (!guard || guard(existing)) {
393
+ return existing;
394
+ }
395
+ }
396
+ const instance = factory();
397
+ _g[key] = instance;
398
+ return instance;
399
+ }
400
+ };
401
+ }
402
+
486
403
  // ../common/src/telemetry/supplied-values.ts
487
404
  var suppliedValuesSlot = singleton("TelemetrySuppliedArgumentValues");
488
405
  function activeEntries() {
@@ -750,6 +667,8 @@ function redactProperty(name, value) {
750
667
  if (isSensitiveName(name)) {
751
668
  return REDACTED;
752
669
  }
670
+ if (GUID_KEY_DIMENSIONS.has(name))
671
+ return projectKey(value);
753
672
  if (typeof value === "boolean" || typeof value === "number") {
754
673
  return value;
755
674
  }
@@ -769,42 +688,727 @@ function redactProperties(properties) {
769
688
  return out;
770
689
  }
771
690
 
772
- // ../common/src/telemetry/trace-context.ts
773
- var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
774
- var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
775
- function getProcessEnv() {
776
- return globalThis.process?.env;
691
+ // ../common/src/catch-error.ts
692
+ var MAX_SERIALIZED_LENGTH = 500;
693
+ var TRUNCATION_SUFFIX = "…(truncated)";
694
+ var REDACTED2 = "[REDACTED]";
695
+ function cap(text) {
696
+ return text.length > MAX_SERIALIZED_LENGTH ? `${text.slice(0, MAX_SERIALIZED_LENGTH)}${TRUNCATION_SUFFIX}` : text;
777
697
  }
778
- function parseInboundTraceparent(value) {
779
- if (!value) {
780
- return;
698
+ function omitSensitive(key, value) {
699
+ return key.length > 0 && isSensitiveName(key) ? REDACTED2 : value;
700
+ }
701
+ function describeThrownValue(value) {
702
+ if (typeof value !== "object" || value === null) {
703
+ return String(value);
781
704
  }
782
- const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
783
- if (!match) {
784
- return;
705
+ let message;
706
+ try {
707
+ message = value.message;
708
+ } catch {
709
+ message = undefined;
785
710
  }
786
- const [, traceId, parentSpanId] = match;
787
- if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
788
- return;
711
+ if (typeof message === "string" && message.length > 0) {
712
+ return cap(message);
789
713
  }
790
- return { traceId, parentSpanId };
714
+ try {
715
+ const json = JSON.stringify(value, omitSensitive);
716
+ if (json !== undefined) {
717
+ return cap(json);
718
+ }
719
+ } catch {}
720
+ return String(value);
791
721
  }
792
- function getInboundTraceContext() {
793
- return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
722
+ function toError(error) {
723
+ return error instanceof Error ? error : new Error(describeThrownValue(error), { cause: error });
794
724
  }
795
-
796
- // ../common/src/telemetry/session-id.ts
797
- var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
798
- var SESSION_ID_MAX_LENGTH = 64;
799
- var RANDOM_SESSION_ID_LENGTH = 32;
800
- var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
801
- var CONTROL_CHARACTERS = /\p{Cc}/gu;
802
- var INHERITED_SESSION_SOURCES = [
803
- { envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
804
- { envVar: "CODEX_THREAD_ID", source: "codex" },
805
- { envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
806
- { envVar: "TERM_SESSION_ID", source: "terminal" },
807
- { envVar: "WT_SESSION", source: "terminal" }
725
+ function isPromiseLike(value) {
726
+ return value !== null && typeof value === "object" && typeof value.then === "function";
727
+ }
728
+ function catchError(fnOrPromise) {
729
+ if (isPromiseLike(fnOrPromise)) {
730
+ return settlePromiseLike(fnOrPromise);
731
+ }
732
+ try {
733
+ const result = fnOrPromise();
734
+ if (isPromiseLike(result)) {
735
+ return settlePromiseLike(result);
736
+ }
737
+ return [undefined, result];
738
+ } catch (error) {
739
+ return [toError(error), undefined];
740
+ }
741
+ }
742
+ function settlePromiseLike(thenable) {
743
+ return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
744
+ }
745
+
746
+ // ../common/src/http-status.ts
747
+ function classifyHttpStatus(status) {
748
+ if (status === undefined)
749
+ return;
750
+ if (status === 400 || status === 409 || status === 413 || status === 422) {
751
+ return { errorCode: "invalid_argument", retry: "RetryWillNotFix" };
752
+ }
753
+ if (status === 401) {
754
+ return {
755
+ errorCode: "authentication_required",
756
+ retry: "RetryWillNotFix"
757
+ };
758
+ }
759
+ if (status === 403) {
760
+ return { errorCode: "permission_denied", retry: "RetryWillNotFix" };
761
+ }
762
+ if (status === 404) {
763
+ return { errorCode: "not_found", retry: "RetryWillNotFix" };
764
+ }
765
+ if (status === 405) {
766
+ return { errorCode: "method_not_allowed", retry: "RetryWillNotFix" };
767
+ }
768
+ if (status === 408) {
769
+ return { errorCode: "timeout", retry: "RetryLater" };
770
+ }
771
+ if (status === 429) {
772
+ return { errorCode: "rate_limited", retry: "RetryLater" };
773
+ }
774
+ if (status >= 500 && status < 600) {
775
+ return { errorCode: "server_error", retry: "RetryLater" };
776
+ }
777
+ return;
778
+ }
779
+
780
+ // ../common/src/error-codes.ts
781
+ var CLI_ERROR_CODES = [
782
+ "invalid_argument",
783
+ "authentication_required",
784
+ "permission_denied",
785
+ "local_permission_denied",
786
+ "not_found",
787
+ "rate_limited",
788
+ "network_error",
789
+ "timeout",
790
+ "server_error",
791
+ "method_not_allowed",
792
+ "not_supported",
793
+ "configuration_error",
794
+ "execution_failed",
795
+ "unknown_error"
796
+ ];
797
+ var RETRY_HINTS = [
798
+ "RetryWillNotFix",
799
+ "RetryLater",
800
+ "RetryAfter1Second",
801
+ "RetryAfter10Seconds",
802
+ "RetryAfter30Seconds",
803
+ "RetryAfter60Seconds"
804
+ ];
805
+ var CLI_ERROR_CODE_VALUES = new Set(CLI_ERROR_CODES);
806
+ var RETRY_HINT_VALUES = new Set(RETRY_HINTS);
807
+ function isCliErrorCode(value) {
808
+ return typeof value === "string" && CLI_ERROR_CODE_VALUES.has(value);
809
+ }
810
+ function isRetryHint(value) {
811
+ return typeof value === "string" && RETRY_HINT_VALUES.has(value);
812
+ }
813
+ function carriedErrorCode(error) {
814
+ if (!error || typeof error !== "object")
815
+ return;
816
+ const code = error.errorCode;
817
+ return isCliErrorCode(code) ? code : undefined;
818
+ }
819
+ function carriedRetry(error) {
820
+ if (!error || typeof error !== "object")
821
+ return;
822
+ const retry = error.retry;
823
+ return isRetryHint(retry) ? retry : undefined;
824
+ }
825
+ function defaultRetryForErrorCode(errorCode) {
826
+ switch (errorCode) {
827
+ case "network_error":
828
+ case "rate_limited":
829
+ case "server_error":
830
+ case "timeout":
831
+ return "RetryLater";
832
+ default:
833
+ return "RetryWillNotFix";
834
+ }
835
+ }
836
+
837
+ // ../common/src/error-graph.ts
838
+ function* walkErrorGraph(error) {
839
+ const queue = [error];
840
+ const seen = new Set;
841
+ for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
842
+ const current = queue.shift();
843
+ if (current === null || typeof current !== "object")
844
+ continue;
845
+ if (seen.has(current))
846
+ continue;
847
+ seen.add(current);
848
+ const cur = current;
849
+ yield cur;
850
+ if (cur.cause !== undefined)
851
+ queue.push(cur.cause);
852
+ if (Array.isArray(cur.errors))
853
+ queue.push(...cur.errors);
854
+ }
855
+ return;
856
+ }
857
+ function parseHttpStatusFromMessage(message) {
858
+ const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
859
+ if (!match)
860
+ return;
861
+ const status = Number(match[1]);
862
+ return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
863
+ }
864
+ function findHttpStatusInGraph(error) {
865
+ for (const node of walkErrorGraph(error)) {
866
+ const response = node.response;
867
+ const explicit = typeof node.status === "number" ? node.status : response?.status;
868
+ if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
869
+ return explicit;
870
+ }
871
+ if (typeof node.message === "string") {
872
+ const parsed = parseHttpStatusFromMessage(node.message);
873
+ if (parsed !== undefined && parsed >= 400) {
874
+ return parsed;
875
+ }
876
+ }
877
+ }
878
+ return;
879
+ }
880
+
881
+ // ../common/src/local-permission-codes.ts
882
+ var LOCAL_PERMISSION_ERROR_CODES = new Set([
883
+ "EACCES",
884
+ "EPERM",
885
+ "EROFS"
886
+ ]);
887
+
888
+ // ../common/src/error-handler.ts
889
+ var DEFAULT_401 = "Unauthorized (401). The session is missing or expired, or its token carries no scope for this API. Run `uip login status --detailed` to see the session and its scopes.";
890
+ 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.";
891
+ var DEFAULT_405 = "Method Not Allowed (405). The endpoint may not exist or the base URL may be incorrect.";
892
+ 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.";
893
+ 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.";
894
+ 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.";
895
+ var HTML_RESPONSE_MESSAGE = "Received HTML instead of the expected JSON response.";
896
+ var NETWORK_ERROR_CODES = new Set([
897
+ "ECONNREFUSED",
898
+ "ECONNRESET",
899
+ "ENOTFOUND",
900
+ "EAI_AGAIN",
901
+ "ETIMEDOUT",
902
+ "EPIPE",
903
+ "EHOSTUNREACH",
904
+ "ENETUNREACH",
905
+ "EAI_FAIL"
906
+ ]);
907
+ var TLS_ERROR_CODES = new Set([
908
+ "SELF_SIGNED_CERT_IN_CHAIN",
909
+ "DEPTH_ZERO_SELF_SIGNED_CERT",
910
+ "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
911
+ "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
912
+ "UNABLE_TO_GET_ISSUER_CERT",
913
+ "CERT_HAS_EXPIRED",
914
+ "CERT_UNTRUSTED",
915
+ "ERR_TLS_CERT_ALTNAME_INVALID"
916
+ ]);
917
+ var TLS_INSTRUCTIONS = "The server's TLS certificate could not be verified. Most often a " + "corporate proxy/firewall re-signs HTTPS with a root CA that Node does " + "not trust — set NODE_EXTRA_CA_CERTS to that CA's PEM file (and HTTPS_PROXY " + "if you connect through a proxy). If the certificate is instead expired or " + "its hostname does not match, fix the endpoint URL or the system clock. " + "Then retry.";
918
+ var NETWORK_INSTRUCTIONS = "Could not reach the UiPath service. Check your network connection and " + "VPN, confirm any HTTP_PROXY/HTTPS_PROXY/NO_PROXY settings are correct, " + "then retry.";
919
+ var LOCAL_PERMISSION_MESSAGE_PATTERN = new RegExp(`\\b(${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})\\b`);
920
+ function localPermissionInstructions(code, path) {
921
+ const target = path !== undefined ? `'${path}'` : "a local file or resource";
922
+ if (code === "EROFS") {
923
+ return `The filesystem containing ${target} is read-only (EROFS), so the ` + "CLI could not write to it. This is a local environment problem, " + "not a UiPath service error — retrying will not help. Use a " + "writable location, or give this environment write access to the " + "path.";
924
+ }
925
+ const onWindows = typeof process !== "undefined" && process.platform === "win32";
926
+ const remedy = onWindows ? "Re-run from an elevated terminal, close any program holding " + "the file open, or grant your user access to the path." : "Grant this user (or the sandbox the command runs in) access " + "to the path, or run the command outside the sandbox.";
927
+ return `The operating system denied access to ${target} (${code}). This is ` + "a local permission problem, not a UiPath service error — retrying " + `without a permission change will not help. ${remedy}`;
928
+ }
929
+ function carriedInstructions(error) {
930
+ if (!error || typeof error !== "object")
931
+ return;
932
+ const e = error;
933
+ return typeof e.instructions === "string" ? e.instructions : undefined;
934
+ }
935
+ function describeConnectivityError(error) {
936
+ for (const cur of walkErrorGraph(error)) {
937
+ const code = typeof cur.code === "string" ? cur.code : undefined;
938
+ const message = typeof cur.message === "string" ? cur.message : undefined;
939
+ if (code && TLS_ERROR_CODES.has(code)) {
940
+ return {
941
+ code,
942
+ kind: "tls",
943
+ message: message ?? code,
944
+ instructions: TLS_INSTRUCTIONS
945
+ };
946
+ }
947
+ if (code && NETWORK_ERROR_CODES.has(code)) {
948
+ return {
949
+ code,
950
+ kind: "network",
951
+ message: message ?? code,
952
+ instructions: NETWORK_INSTRUCTIONS
953
+ };
954
+ }
955
+ }
956
+ return;
957
+ }
958
+ function describePermissionError(error) {
959
+ for (const cur of walkErrorGraph(error)) {
960
+ const message = typeof cur.message === "string" ? cur.message : undefined;
961
+ const code = matchLocalPermissionCode(cur.code, message);
962
+ if (!code)
963
+ continue;
964
+ const path = localPermissionPath(cur.path, message);
965
+ return {
966
+ code,
967
+ message: message ?? code,
968
+ ...path !== undefined ? { path } : {},
969
+ instructions: localPermissionInstructions(code, path)
970
+ };
971
+ }
972
+ return;
973
+ }
974
+ function matchLocalPermissionCode(code, message) {
975
+ if (typeof code === "string" && LOCAL_PERMISSION_ERROR_CODES.has(code)) {
976
+ return code;
977
+ }
978
+ const match = message ? LOCAL_PERMISSION_MESSAGE_PATTERN.exec(message) : null;
979
+ return match ? match[1] : undefined;
980
+ }
981
+ function localPermissionPath(path, message) {
982
+ if (typeof path === "string")
983
+ return path;
984
+ return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
985
+ }
986
+ function readHeader(response, name) {
987
+ const headers = response?.headers;
988
+ if (!headers || typeof headers !== "object")
989
+ return;
990
+ if (typeof headers.get === "function") {
991
+ const value = headers.get(name);
992
+ if (value)
993
+ return value;
994
+ }
995
+ const plain = headers;
996
+ const key = Object.keys(plain).find((k) => k.toLowerCase() === name.toLowerCase());
997
+ const value = key === undefined ? undefined : plain[key];
998
+ return typeof value === "string" && value !== "" ? value : undefined;
999
+ }
1000
+ function isHtmlDocument(body) {
1001
+ return /^\s*(<!doctype html|<html\b)/i.test(body);
1002
+ }
1003
+ function retryHintForRetryAfter(seconds) {
1004
+ if (seconds <= 1) {
1005
+ return "RetryAfter1Second";
1006
+ }
1007
+ if (seconds <= 10) {
1008
+ return "RetryAfter10Seconds";
1009
+ }
1010
+ if (seconds <= 30) {
1011
+ return "RetryAfter30Seconds";
1012
+ }
1013
+ return "RetryAfter60Seconds";
1014
+ }
1015
+ function classifyError(status, error) {
1016
+ const byStatus = classifyHttpStatus(status);
1017
+ if (byStatus)
1018
+ return byStatus;
1019
+ if (status === undefined && describePermissionError(error)) {
1020
+ return {
1021
+ errorCode: "local_permission_denied",
1022
+ retry: "RetryWillNotFix"
1023
+ };
1024
+ }
1025
+ const connectivity = describeConnectivityError(error);
1026
+ if (connectivity) {
1027
+ return {
1028
+ errorCode: "network_error",
1029
+ retry: connectivity.kind === "tls" ? "RetryWillNotFix" : "RetryLater"
1030
+ };
1031
+ }
1032
+ return { errorCode: "unknown_error", retry: "RetryWillNotFix" };
1033
+ }
1034
+ function withCarriedClass(inferred, error) {
1035
+ const errorCode = carriedErrorCode(error);
1036
+ const retry = carriedRetry(error);
1037
+ if (errorCode === undefined || errorCode === inferred.errorCode) {
1038
+ return {
1039
+ errorCode: inferred.errorCode,
1040
+ retry: retry ?? inferred.retry
1041
+ };
1042
+ }
1043
+ return { errorCode, retry: retry ?? defaultRetryForErrorCode(errorCode) };
1044
+ }
1045
+ function formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus) {
1046
+ if (extractedMessage) {
1047
+ return `HTTP ${status}: ${extractedMessage}`;
1048
+ }
1049
+ return inferredStatus !== undefined ? rawMessage : `HTTP ${status}: ${rawMessage}`;
1050
+ }
1051
+ async function extractErrorDetails(error, options) {
1052
+ const err = error !== null && error !== undefined && typeof error === "object" ? error : {};
1053
+ const response = err.response;
1054
+ const rawMessage = typeof err.message === "string" ? err.message : "Unknown error";
1055
+ const explicitStatus = err.status ?? response?.status;
1056
+ const inferredStatus = explicitStatus === undefined ? parseHttpStatusFromMessage(rawMessage) : undefined;
1057
+ const status = explicitStatus ?? inferredStatus;
1058
+ const isSuccessfulResponse = status !== undefined && status >= 200 && status < 300;
1059
+ let rawBody;
1060
+ let extractedMessage;
1061
+ let parsedBody;
1062
+ const textFn = response?.text?.bind(response);
1063
+ if (textFn) {
1064
+ const [bodyError, body] = await catchError((async () => textFn())());
1065
+ if (!bodyError && body) {
1066
+ rawBody = body;
1067
+ const [parseError, parsed] = catchError(() => JSON.parse(body));
1068
+ if (!parseError && parsed && typeof parsed === "object") {
1069
+ parsedBody = parsed;
1070
+ if (parsedBody.errors && typeof parsedBody.errors === "object") {
1071
+ for (const field of Object.values(parsedBody.errors)) {
1072
+ if (Array.isArray(field) && field.length > 0) {
1073
+ const first = field[0];
1074
+ if (first && typeof first.message === "string") {
1075
+ extractedMessage = first.message;
1076
+ break;
1077
+ }
1078
+ }
1079
+ }
1080
+ }
1081
+ if (!extractedMessage) {
1082
+ extractedMessage = typeof parsedBody.message === "string" ? parsedBody.message : typeof parsedBody.errorMessage === "string" ? parsedBody.errorMessage : typeof parsedBody.title === "string" ? parsedBody.title : undefined;
1083
+ }
1084
+ if (!extractedMessage) {
1085
+ extractedMessage = body;
1086
+ }
1087
+ if (extractedMessage && typeof parsedBody.detail === "string" && parsedBody.detail.length > 0 && !extractedMessage.includes(parsedBody.detail)) {
1088
+ extractedMessage = `${extractedMessage}: ${parsedBody.detail}`;
1089
+ }
1090
+ } else {
1091
+ extractedMessage = isHtmlDocument(body) ? HTML_RESPONSE_MESSAGE : body;
1092
+ }
1093
+ }
1094
+ }
1095
+ let message;
1096
+ let result = "Failure";
1097
+ const classificationStatus = status ?? findHttpStatusInGraph(error);
1098
+ const classification = classifyError(classificationStatus, error);
1099
+ let retry = classification.retry;
1100
+ const htmlForbidden = status === 403 && rawBody !== undefined && isHtmlDocument(rawBody);
1101
+ const rayId = htmlForbidden ? readHeader(response, "cf-ray") : undefined;
1102
+ const cloudflareBlock = htmlForbidden && (rayId !== undefined || /\bcloudflare\b/i.test(readHeader(response, "server") ?? ""));
1103
+ if (status === 401) {
1104
+ message = DEFAULT_401;
1105
+ result = "AuthenticationError";
1106
+ } else if (cloudflareBlock) {
1107
+ message = rayId ? `${CLOUDFLARE_BLOCK_403} Cloudflare Ray ID: ${rayId}.` : CLOUDFLARE_BLOCK_403;
1108
+ } else if (status === 403) {
1109
+ message = options?.forbiddenMessage ?? DEFAULT_403;
1110
+ result = "AuthenticationError";
1111
+ } else if (status === 405) {
1112
+ message = DEFAULT_405;
1113
+ } else if (status === 413) {
1114
+ message = DEFAULT_413;
1115
+ } else if (status === 400 || status === 422) {
1116
+ message = formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus);
1117
+ result = "ValidationError";
1118
+ } else if (status === 429) {
1119
+ message = formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus);
1120
+ } else if (extractedMessage) {
1121
+ if (isSuccessfulResponse && rawMessage !== "Unknown error") {
1122
+ message = rawMessage;
1123
+ } else {
1124
+ message = status ? `HTTP ${status}: ${extractedMessage}` : extractedMessage;
1125
+ }
1126
+ } else if (status) {
1127
+ if (inferredStatus !== undefined) {
1128
+ message = rawMessage;
1129
+ } else if (rawMessage === "Unknown error" && response) {
1130
+ const statusText = response.statusText;
1131
+ message = statusText ? `HTTP ${status} ${statusText}` : `HTTP ${status} - request failed`;
1132
+ } else {
1133
+ message = `HTTP ${status}: ${rawMessage}`;
1134
+ }
1135
+ } else {
1136
+ message = rawMessage;
1137
+ }
1138
+ if (status === undefined) {
1139
+ const connectivity = describeConnectivityError(error);
1140
+ if (connectivity && connectivity.message !== message && !message.includes(connectivity.message)) {
1141
+ message = `${message}: ${connectivity.message}`;
1142
+ }
1143
+ }
1144
+ const permission = status === undefined ? describePermissionError(error) : undefined;
1145
+ if (permission) {
1146
+ if (permission.message !== message && !message.includes(permission.message)) {
1147
+ message = `${message}: ${permission.message}`;
1148
+ }
1149
+ if (!message.includes(permission.instructions)) {
1150
+ const punctuated = message.endsWith(".") ? message : `${message}.`;
1151
+ message = `${punctuated} ${permission.instructions}`;
1152
+ }
1153
+ }
1154
+ let details = rawMessage;
1155
+ if (htmlForbidden) {
1156
+ details = cloudflareBlock ? CLOUDFLARE_BLOCK_403_INSTRUCTIONS : HTML_RESPONSE_MESSAGE;
1157
+ } else if (rawBody) {
1158
+ if (parsedBody) {
1159
+ const extra = {};
1160
+ if (parsedBody.errorCode)
1161
+ extra.errorCode = parsedBody.errorCode;
1162
+ if (parsedBody.detail)
1163
+ extra.detail = parsedBody.detail;
1164
+ if (parsedBody.details)
1165
+ extra.details = parsedBody.details;
1166
+ if (parsedBody.errors != null)
1167
+ extra.errors = parsedBody.errors;
1168
+ if (parsedBody.data && typeof parsedBody.data === "object" && Object.keys(parsedBody.data).length > 0) {
1169
+ extra.data = parsedBody.data;
1170
+ }
1171
+ details = Object.keys(extra).length > 0 ? JSON.stringify(extra) : rawBody;
1172
+ } else {
1173
+ details = rawBody;
1174
+ }
1175
+ } else if (typeof err.message === "string") {
1176
+ details = err.message;
1177
+ } else {
1178
+ details = describeThrownValue(error);
1179
+ }
1180
+ const context = {};
1181
+ if (classificationStatus) {
1182
+ context.httpStatus = classificationStatus;
1183
+ }
1184
+ if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
1185
+ context.errorCode = parsedBody.errorCode;
1186
+ } else if (parsedBody?.code && typeof parsedBody.code === "string") {
1187
+ context.errorCode = parsedBody.code;
1188
+ }
1189
+ if (parsedBody?.requestId && typeof parsedBody.requestId === "string") {
1190
+ context.requestId = parsedBody.requestId;
1191
+ } else if (cloudflareBlock && rayId) {
1192
+ context.requestId = rayId;
1193
+ }
1194
+ if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
1195
+ context.traceId = parsedBody.traceId;
1196
+ }
1197
+ if (permission?.path !== undefined) {
1198
+ context.path = permission.path;
1199
+ }
1200
+ if (status === 429) {
1201
+ const retryAfterValue = readHeader(response, "retry-after");
1202
+ if (retryAfterValue) {
1203
+ const seconds = Number(retryAfterValue);
1204
+ if (!Number.isNaN(seconds)) {
1205
+ context.retryAfter = seconds;
1206
+ retry = retryHintForRetryAfter(seconds);
1207
+ }
1208
+ }
1209
+ }
1210
+ const hasContext = Object.keys(context).length > 0;
1211
+ let parsedErrors;
1212
+ if (parsedBody?.errors && typeof parsedBody.errors === "object") {
1213
+ const errors = {};
1214
+ for (const [field, raw] of Object.entries(parsedBody.errors)) {
1215
+ if (Array.isArray(raw)) {
1216
+ const messages = raw.map((entry) => {
1217
+ if (typeof entry === "string")
1218
+ return entry;
1219
+ if (entry && typeof entry === "object" && typeof entry.message === "string") {
1220
+ return entry.message;
1221
+ }
1222
+ return String(entry);
1223
+ }).filter(Boolean);
1224
+ if (messages.length > 0)
1225
+ errors[field] = messages;
1226
+ } else if (typeof raw === "string") {
1227
+ errors[field] = [raw];
1228
+ }
1229
+ }
1230
+ if (Object.keys(errors).length > 0)
1231
+ parsedErrors = errors;
1232
+ }
1233
+ return {
1234
+ result,
1235
+ ...withCarriedClass({ errorCode: classification.errorCode, retry }, error),
1236
+ message,
1237
+ details,
1238
+ ...hasContext ? { context } : {},
1239
+ ...parsedErrors ? { parsedErrors } : {}
1240
+ };
1241
+ }
1242
+
1243
+ // ../common/src/telemetry/environment-info.ts
1244
+ var LOCAL_HOSTS = new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
1245
+
1246
+ // ../common/src/telemetry/detect-agent.ts
1247
+ var KNOWN_AGENTS = [
1248
+ { envVar: "CLAUDECODE", value: "1", id: "claude-code" },
1249
+ { envVar: "CURSOR_AGENT", value: "1", id: "cursor" },
1250
+ { envVar: "GEMINI_CLI", value: "1", id: "gemini-cli" },
1251
+ { envVar: "CODEX_THREAD_ID", id: "codex" },
1252
+ { envVar: "CODEX_SANDBOX", id: "codex" },
1253
+ { envVar: "AUGMENT_AGENT", value: "1", id: "augment" },
1254
+ { envVar: "CLINE_ACTIVE", value: "true", id: "cline" }
1255
+ ];
1256
+ function detectAgentFromEnv(env) {
1257
+ for (const agent of KNOWN_AGENTS) {
1258
+ const envValue = env[agent.envVar];
1259
+ if (agent.value !== undefined) {
1260
+ if (envValue === agent.value)
1261
+ return agent.id;
1262
+ } else {
1263
+ if (envValue)
1264
+ return agent.id;
1265
+ }
1266
+ }
1267
+ const agentEnv = env.AGENT;
1268
+ if (agentEnv) {
1269
+ if (agentEnv === "1" || agentEnv === "true")
1270
+ return "unknown";
1271
+ if (agentEnv.length <= 32)
1272
+ return agentEnv.toLowerCase();
1273
+ }
1274
+ return;
1275
+ }
1276
+
1277
+ // ../common/src/telemetry/execution-context.ts
1278
+ var authSignalSlot = singleton("TelemetryExecutionContextAuthSignal");
1279
+ var isTruthy = (value) => value !== undefined && value !== "" && value !== "0" && value.toLowerCase() !== "false";
1280
+ var isEqual = (value, expected) => value?.toLowerCase() === expected;
1281
+ var CI_SIGNATURES = [
1282
+ {
1283
+ provider: "github_actions",
1284
+ matches: (env) => isTruthy(env.GITHUB_ACTIONS),
1285
+ isScheduler: (env) => env.GITHUB_EVENT_NAME === "schedule"
1286
+ },
1287
+ {
1288
+ provider: "azure_devops",
1289
+ matches: (env) => isTruthy(env.TF_BUILD),
1290
+ isScheduler: (env) => isEqual(env.BUILD_REASON, "schedule")
1291
+ },
1292
+ {
1293
+ provider: "gitlab",
1294
+ matches: (env) => isTruthy(env.GITLAB_CI),
1295
+ isScheduler: (env) => env.CI_PIPELINE_SOURCE === "schedule"
1296
+ },
1297
+ {
1298
+ provider: "circleci",
1299
+ matches: (env) => isTruthy(env.CIRCLECI),
1300
+ isScheduler: (env) => env.CIRCLE_PIPELINE_TRIGGER_SOURCE === "scheduled_pipeline"
1301
+ },
1302
+ {
1303
+ provider: "jenkins",
1304
+ matches: (env) => isTruthy(env.JENKINS_URL) || isTruthy(env.JENKINS_HOME)
1305
+ },
1306
+ {
1307
+ provider: "teamcity",
1308
+ matches: (env) => isTruthy(env.TEAMCITY_VERSION)
1309
+ },
1310
+ {
1311
+ provider: "buildkite",
1312
+ matches: (env) => isTruthy(env.BUILDKITE),
1313
+ isScheduler: (env) => env.BUILDKITE_SOURCE === "schedule"
1314
+ },
1315
+ {
1316
+ provider: "bitbucket",
1317
+ matches: (env) => isTruthy(env.BITBUCKET_BUILD_NUMBER)
1318
+ },
1319
+ {
1320
+ provider: "travis",
1321
+ matches: (env) => isTruthy(env.TRAVIS)
1322
+ },
1323
+ {
1324
+ provider: "appveyor",
1325
+ matches: (env) => isTruthy(env.APPVEYOR)
1326
+ },
1327
+ {
1328
+ provider: "generic",
1329
+ matches: (env) => isTruthy(env.CI)
1330
+ }
1331
+ ];
1332
+ function currentEnv() {
1333
+ return typeof process === "undefined" ? {} : process.env;
1334
+ }
1335
+ function currentTtyState() {
1336
+ if (typeof process === "undefined")
1337
+ return false;
1338
+ return Boolean(process.stdout?.isTTY || process.stdin?.isTTY || process.stderr?.isTTY);
1339
+ }
1340
+ function detectCi(env) {
1341
+ const signature = CI_SIGNATURES.find((candidate) => candidate.matches(env));
1342
+ if (!signature)
1343
+ return;
1344
+ return {
1345
+ executionContext: signature.isScheduler?.(env) ? "scheduler" : "ci",
1346
+ ciProvider: signature.provider
1347
+ };
1348
+ }
1349
+ function detectExecutionContext(options = {}) {
1350
+ const env = options.env ?? currentEnv();
1351
+ const ci = detectCi(env);
1352
+ if (ci)
1353
+ return ci;
1354
+ const agent = options.agent ?? detectAgentFromEnv(env);
1355
+ if (agent) {
1356
+ return { executionContext: "agent" };
1357
+ }
1358
+ const authSignal = options.authSignal ?? authSignalSlot.get();
1359
+ if (authSignal === "service_account") {
1360
+ return { executionContext: "service_account" };
1361
+ }
1362
+ const isTty = options.isTty ?? currentTtyState();
1363
+ if (isTty) {
1364
+ return { executionContext: "manual" };
1365
+ }
1366
+ return { executionContext: "unknown" };
1367
+ }
1368
+ function getExecutionContextTelemetryProperties() {
1369
+ const detected = detectExecutionContext();
1370
+ return {
1371
+ [BaseDimensions.ExecutionContext]: detected.executionContext,
1372
+ ...detected.ciProvider ? { [BaseDimensions.CiProvider]: detected.ciProvider } : {}
1373
+ };
1374
+ }
1375
+
1376
+ // ../common/src/telemetry/trace-context.ts
1377
+ var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
1378
+ var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
1379
+ function getProcessEnv() {
1380
+ return globalThis.process?.env;
1381
+ }
1382
+ function parseInboundTraceparent(value) {
1383
+ if (!value) {
1384
+ return;
1385
+ }
1386
+ const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
1387
+ if (!match) {
1388
+ return;
1389
+ }
1390
+ const [, traceId, parentSpanId] = match;
1391
+ if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
1392
+ return;
1393
+ }
1394
+ return { traceId, parentSpanId };
1395
+ }
1396
+ function getInboundTraceContext() {
1397
+ return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
1398
+ }
1399
+
1400
+ // ../common/src/telemetry/session-id.ts
1401
+ var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
1402
+ var SESSION_ID_MAX_LENGTH = 64;
1403
+ var RANDOM_SESSION_ID_LENGTH = 32;
1404
+ var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
1405
+ var CONTROL_CHARACTERS = /\p{Cc}/gu;
1406
+ var INHERITED_SESSION_SOURCES = [
1407
+ { envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
1408
+ { envVar: "CODEX_THREAD_ID", source: "codex" },
1409
+ { envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
1410
+ { envVar: "TERM_SESSION_ID", source: "terminal" },
1411
+ { envVar: "WT_SESSION", source: "terminal" }
808
1412
  ];
809
1413
  var telemetrySessionSlot = singleton("TelemetrySession");
810
1414
  var telemetryOperationIdSlot = singleton("TelemetryOperationId");
@@ -866,6 +1470,12 @@ function getTelemetryOperationId() {
866
1470
  return generated;
867
1471
  }
868
1472
 
1473
+ // ../common/src/telemetry/global-telemetry-properties.ts
1474
+ var telemetryPropsSlot = singleton("TelemetryDefaultProps");
1475
+ function getGlobalTelemetryProperties() {
1476
+ return telemetryPropsSlot.get();
1477
+ }
1478
+
869
1479
  // ../common/src/telemetry/span-clock.ts
870
1480
  function startSpanClock() {
871
1481
  const started = performance.now();
@@ -1058,196 +1668,15 @@ class TelemetryService {
1058
1668
  }
1059
1669
  }
1060
1670
 
1061
- // ../common/src/telemetry/browser-context-storage.ts
1062
- class BrowserContextStorage {
1063
- contextStack = [];
1064
- run(context, fn) {
1065
- this.contextStack.push(context);
1066
- try {
1067
- const result = fn();
1068
- if (result !== null && typeof result === "object" && typeof result.then === "function") {
1069
- return result.finally(() => {
1070
- this.contextStack.pop();
1071
- });
1072
- }
1073
- this.contextStack.pop();
1074
- return result;
1075
- } catch (error) {
1076
- this.contextStack.pop();
1077
- throw error;
1078
- }
1079
- }
1080
- getContext() {
1081
- return this.contextStack.length > 0 ? this.contextStack[this.contextStack.length - 1] : undefined;
1082
- }
1083
- }
1084
-
1085
- // ../common/src/telemetry/console-telemetry-provider.ts
1086
- class ConsoleTelemetryProvider {
1087
- async trackEvent({ name }) {
1088
- console.debug(`[Telemetry] Event: ${name}`);
1089
- }
1090
- async trackException({ error }) {
1091
- console.error(`[Telemetry] Exception: ${error.message}`);
1092
- }
1093
- async trackRequest({
1094
- name,
1095
- durationMs,
1096
- success
1097
- }) {
1098
- console.debug(`[Telemetry] Request: ${name} (${durationMs}ms, ${success ? "ok" : "fail"})`);
1099
- }
1100
- async trackDependency({
1101
- name,
1102
- type,
1103
- durationMs,
1104
- success
1105
- }) {
1106
- console.debug(`[Telemetry] Dependency: ${name} [${type}] (${durationMs}ms, ${success ? "ok" : "fail"})`);
1107
- }
1108
- }
1109
-
1110
- // ../common/src/catch-error.ts
1111
- var MAX_SERIALIZED_LENGTH = 500;
1112
- var TRUNCATION_SUFFIX = "…(truncated)";
1113
- var REDACTED2 = "[REDACTED]";
1114
- function cap(text) {
1115
- return text.length > MAX_SERIALIZED_LENGTH ? `${text.slice(0, MAX_SERIALIZED_LENGTH)}${TRUNCATION_SUFFIX}` : text;
1116
- }
1117
- function omitSensitive(key, value) {
1118
- return key.length > 0 && isSensitiveName(key) ? REDACTED2 : value;
1119
- }
1120
- function describeThrownValue(value) {
1121
- if (typeof value !== "object" || value === null) {
1122
- return String(value);
1123
- }
1124
- let message;
1125
- try {
1126
- message = value.message;
1127
- } catch {
1128
- message = undefined;
1129
- }
1130
- if (typeof message === "string" && message.length > 0) {
1131
- return cap(message);
1132
- }
1133
- try {
1134
- const json = JSON.stringify(value, omitSensitive);
1135
- if (json !== undefined) {
1136
- return cap(json);
1137
- }
1138
- } catch {}
1139
- return String(value);
1140
- }
1141
- function toError(error) {
1142
- return error instanceof Error ? error : new Error(describeThrownValue(error), { cause: error });
1143
- }
1144
- function isPromiseLike(value) {
1145
- return value !== null && typeof value === "object" && typeof value.then === "function";
1146
- }
1147
- function catchError(fnOrPromise) {
1148
- if (isPromiseLike(fnOrPromise)) {
1149
- return settlePromiseLike(fnOrPromise);
1150
- }
1151
- try {
1152
- const result = fnOrPromise();
1153
- if (isPromiseLike(result)) {
1154
- return settlePromiseLike(result);
1155
- }
1156
- return [undefined, result];
1157
- } catch (error) {
1158
- return [toError(error), undefined];
1159
- }
1160
- }
1161
- function settlePromiseLike(thenable) {
1162
- return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
1163
- }
1164
-
1165
- // ../common/src/error-graph.ts
1166
- function* walkErrorGraph(error) {
1167
- const queue = [error];
1168
- const seen = new Set;
1169
- for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
1170
- const current = queue.shift();
1171
- if (current === null || typeof current !== "object")
1172
- continue;
1173
- if (seen.has(current))
1174
- continue;
1175
- seen.add(current);
1176
- const cur = current;
1177
- yield cur;
1178
- if (cur.cause !== undefined)
1179
- queue.push(cur.cause);
1180
- if (Array.isArray(cur.errors))
1181
- queue.push(...cur.errors);
1182
- }
1183
- return;
1671
+ // ../common/src/telemetry/telemetry-config.ts
1672
+ function isTelemetryDisabled() {
1673
+ const value = process.env.UIPATH_TELEMETRY_DISABLED;
1674
+ return value === "1" || value === "true";
1184
1675
  }
1185
- function parseHttpStatusFromMessage(message) {
1186
- const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
1187
- if (!match)
1188
- return;
1189
- const status = Number(match[1]);
1190
- return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
1191
- }
1192
- function findHttpStatusInGraph(error) {
1193
- for (const node of walkErrorGraph(error)) {
1194
- const response = node.response;
1195
- const explicit = typeof node.status === "number" ? node.status : response?.status;
1196
- if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
1197
- return explicit;
1198
- }
1199
- if (typeof node.message === "string") {
1200
- const parsed = parseHttpStatusFromMessage(node.message);
1201
- if (parsed !== undefined && parsed >= 400) {
1202
- return parsed;
1203
- }
1204
- }
1205
- }
1206
- return;
1207
- }
1208
-
1209
- // ../common/src/local-permission-codes.ts
1210
- var LOCAL_PERMISSION_ERROR_CODES = new Set([
1211
- "EACCES",
1212
- "EPERM",
1213
- "EROFS"
1214
- ]);
1215
-
1216
- // ../common/src/error-handler.ts
1217
- var NETWORK_ERROR_CODES = new Set([
1218
- "ECONNREFUSED",
1219
- "ECONNRESET",
1220
- "ENOTFOUND",
1221
- "EAI_AGAIN",
1222
- "ETIMEDOUT",
1223
- "EPIPE",
1224
- "EHOSTUNREACH",
1225
- "ENETUNREACH",
1226
- "EAI_FAIL"
1227
- ]);
1228
- var TLS_ERROR_CODES = new Set([
1229
- "SELF_SIGNED_CERT_IN_CHAIN",
1230
- "DEPTH_ZERO_SELF_SIGNED_CERT",
1231
- "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
1232
- "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
1233
- "UNABLE_TO_GET_ISSUER_CERT",
1234
- "CERT_HAS_EXPIRED",
1235
- "CERT_UNTRUSTED",
1236
- "ERR_TLS_CERT_ALTNAME_INVALID"
1237
- ]);
1238
- var TLS_INSTRUCTIONS = "The server's TLS certificate could not be verified. Most often a " + "corporate proxy/firewall re-signs HTTPS with a root CA that Node does " + "not trust — set NODE_EXTRA_CA_CERTS to that CA's PEM file (and HTTPS_PROXY " + "if you connect through a proxy). If the certificate is instead expired or " + "its hostname does not match, fix the endpoint URL or the system clock. " + "Then retry.";
1239
- var NETWORK_INSTRUCTIONS = "Could not reach the UiPath service. Check your network connection and " + "VPN, confirm any HTTP_PROXY/HTTPS_PROXY/NO_PROXY settings are correct, " + "then retry.";
1240
- var LOCAL_PERMISSION_MESSAGE_PATTERN = new RegExp(`\\b(${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})\\b`);
1241
- function carriedInstructions(error) {
1242
- if (!error || typeof error !== "object")
1243
- return;
1244
- const e = error;
1245
- return typeof e.instructions === "string" ? e.instructions : undefined;
1676
+ function isProjectTelemetryDisabled() {
1677
+ return isTelemetryDisabled() || process.env.UIPATH_PROJECT_TELEMETRY_DISABLED === "1" || process.env.UIPATH_PROJECT_TELEMETRY_DISABLED === "true";
1246
1678
  }
1247
1679
 
1248
- // ../common/src/telemetry/environment-info.ts
1249
- var LOCAL_HOSTS = new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
1250
-
1251
1680
  // ../common/src/telemetry/command-attribution.ts
1252
1681
  var LEGACY_SKILL_NAMESPACE = "uipath:";
1253
1682
  var MAX_SKILL_NAME_LENGTH = 80;
@@ -1500,6 +1929,6 @@ function installSdkUserAgentHeader(BaseApiClass, userAgent) {
1500
1929
  installRequestHeaderForwarding(BaseApiClass, userAgentPatchKey(userAgent), (headers) => addSdkUserAgentHeader(headers, userAgent));
1501
1930
  }
1502
1931
 
1503
- export { singleton, recordSuppliedArgumentValues, releaseSuppliedArgumentValues, redactProperties, catchError, walkErrorGraph, findHttpStatusInGraph, LOCAL_PERMISSION_ERROR_CODES, carriedInstructions, CommandDimensions, ErrorDimensions, PackagerDimensions, TelemetryService, buildCommandTelemetryAttribution, buildAgentSessionTelemetry, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, BrowserContextStorage, ConsoleTelemetryProvider };
1932
+ export { CommandDimensions, ProjectDimensions, ErrorDimensions, PackagerDimensions, projectKey, projectIdentityProperties, PROJECT_IDENTITY_LOOKUP_BUDGET_MS, withinProjectIdentityBudget, singleton, recordSuppliedArgumentValues, releaseSuppliedArgumentValues, redactProperties, catchError, isCliErrorCode, isRetryHint, defaultRetryForErrorCode, walkErrorGraph, parseHttpStatusFromMessage, findHttpStatusInGraph, classifyHttpStatus, LOCAL_PERMISSION_ERROR_CODES, carriedInstructions, extractErrorDetails, TelemetryService, isProjectTelemetryDisabled, buildCommandTelemetryAttribution, buildAgentSessionTelemetry, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader };
1504
1933
 
1505
- //# debugId=8C69C1220DFF780C64756E2164756E21
1934
+ //# debugId=0F0FDCC01FD6327464756E2164756E21