@uipath/api-workflow-tool 1.203.0-preview.212 → 1.204.0-preview.211

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.
@@ -0,0 +1,1501 @@
1
+ import {
2
+ __require
3
+ } from "./packager-tool-1de529jm.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
+ }
65
+
66
+ // ../common/src/telemetry/telemetry-dimensions.ts
67
+ var BaseDimensions = {
68
+ ApplicationName: "ApplicationName",
69
+ ProductVersion: "ProductVersion",
70
+ InstallationId: "InstallationId",
71
+ CloudUserId: "CloudUserId",
72
+ CloudTenantId: "CloudTenantId",
73
+ CloudOrganizationId: "CloudOrganizationId",
74
+ IsInternalUser: "IsInternalUser",
75
+ Environment: "Environment",
76
+ BaseUrl: "BaseUrl",
77
+ Region: "Region",
78
+ Agent: "Agent",
79
+ AgentVersion: "AgentVersion",
80
+ AgentModel: "AgentModel",
81
+ ToolName: "ToolName",
82
+ ToolVersion: "ToolVersion",
83
+ ExecutionContext: "ExecutionContext",
84
+ CiProvider: "CiProvider",
85
+ SessionIdSource: "SessionIdSource",
86
+ SessionId: "SessionId"
87
+ };
88
+ var CommandDimensions = {
89
+ IsCommand: "IsCommand",
90
+ IsReexec: "IsReexec",
91
+ CommandName: "CommandName",
92
+ ExitCode: "ExitCode",
93
+ TerminalOutcome: "TerminalOutcome",
94
+ ErrorClass: "ErrorClass",
95
+ TerminalSignal: "TerminalSignal",
96
+ ErrorMessage: "ErrorMessage",
97
+ SkillName: "SkillName",
98
+ ProductArea: "ProductArea",
99
+ Mode: "Mode"
100
+ };
101
+ var ShipDimensions = {
102
+ ShipKind: "ShipKind",
103
+ Target: "Target",
104
+ ProjectType: "ProjectType",
105
+ ProjectTypes: "ProjectTypes",
106
+ ArtifactCorrelationKey: "ArtifactCorrelationKey",
107
+ PackageName: "PackageName",
108
+ PackageVersion: "PackageVersion",
109
+ PackageVersionKey: "PackageVersionKey",
110
+ DeploymentKey: "DeploymentKey",
111
+ SolutionId: "SolutionId",
112
+ FolderKey: "FolderKey",
113
+ FeedId: "FeedId"
114
+ };
115
+ var ErrorDimensions = {
116
+ Result: "Result",
117
+ ErrorCode: "ErrorCode",
118
+ Retry: "Retry",
119
+ ErrorMessage: "ErrorMessage"
120
+ };
121
+ var AuthDimensions = {
122
+ AuthenticationMethod: "AuthenticationMethod",
123
+ Success: "Success",
124
+ Reason: "Reason"
125
+ };
126
+ var SkillsDimensions = {
127
+ SchemaVersion: "SchemaVersion",
128
+ AgentType: "AgentType",
129
+ SkillsVersion: "SkillsVersion",
130
+ UipSubcommand: "UipSubcommand",
131
+ FileExtension: "FileExtension",
132
+ SubagentModel: "SubagentModel",
133
+ SubagentType: "SubagentType",
134
+ PermissionMode: "PermissionMode",
135
+ EffortLevel: "EffortLevel",
136
+ SessionSource: "SessionSource",
137
+ Outcome: "Outcome",
138
+ DurationMs: "DurationMs",
139
+ Source: "Source"
140
+ };
141
+ var PackagerDimensions = {
142
+ ProjectId: "ProjectId",
143
+ ProjectType: "ProjectType",
144
+ SolutionId: "SolutionId"
145
+ };
146
+ var ScopeDimensions = {
147
+ FolderId: "FolderId"
148
+ };
149
+ var ID_DIMENSIONS = new Set([
150
+ BaseDimensions.CloudUserId,
151
+ BaseDimensions.CloudTenantId,
152
+ BaseDimensions.CloudOrganizationId,
153
+ BaseDimensions.InstallationId,
154
+ ShipDimensions.ArtifactCorrelationKey,
155
+ ShipDimensions.PackageVersionKey,
156
+ ShipDimensions.DeploymentKey,
157
+ ShipDimensions.SolutionId,
158
+ ShipDimensions.FolderKey,
159
+ ShipDimensions.FeedId,
160
+ PackagerDimensions.ProjectId
161
+ ]);
162
+ var NON_IDENTIFIER_PLACEHOLDER_PATTERN = /^(?:\[[A-Z_]+\]|<[^>]+>)$/;
163
+ var RESERVED_DIMENSION_NAMES = new Set([
164
+ ...Object.values(BaseDimensions),
165
+ ...Object.values(CommandDimensions),
166
+ ...Object.values(ShipDimensions),
167
+ ...Object.values(ErrorDimensions),
168
+ ...Object.values(AuthDimensions),
169
+ ...Object.values(SkillsDimensions),
170
+ ...Object.values(PackagerDimensions),
171
+ ...Object.values(ScopeDimensions)
172
+ ]);
173
+ var CURATED_DIMENSIONS = new Set([
174
+ BaseDimensions.ApplicationName,
175
+ BaseDimensions.ProductVersion,
176
+ BaseDimensions.InstallationId,
177
+ BaseDimensions.CloudUserId,
178
+ BaseDimensions.CloudTenantId,
179
+ BaseDimensions.CloudOrganizationId,
180
+ BaseDimensions.IsInternalUser,
181
+ BaseDimensions.Environment,
182
+ BaseDimensions.BaseUrl,
183
+ BaseDimensions.Region,
184
+ BaseDimensions.Agent,
185
+ BaseDimensions.AgentVersion,
186
+ BaseDimensions.ToolVersion,
187
+ BaseDimensions.ExecutionContext,
188
+ BaseDimensions.CiProvider,
189
+ BaseDimensions.SessionIdSource,
190
+ BaseDimensions.SessionId,
191
+ ...Object.values(CommandDimensions),
192
+ ...Object.values(ShipDimensions)
193
+ ]);
194
+ function lowercaseIdDimensionValues(properties) {
195
+ let changed = false;
196
+ const result = {
197
+ ...properties
198
+ };
199
+ for (const key of Object.keys(result)) {
200
+ const value = result[key];
201
+ if (!ID_DIMENSIONS.has(key) || typeof value !== "string" || NON_IDENTIFIER_PLACEHOLDER_PATTERN.test(value)) {
202
+ continue;
203
+ }
204
+ const lowered = value.toLowerCase();
205
+ if (lowered !== value) {
206
+ result[key] = lowered;
207
+ changed = true;
208
+ }
209
+ }
210
+ return changed ? result : properties;
211
+ }
212
+
213
+ // ../common/src/telemetry/execution-context.ts
214
+ var authSignalSlot = singleton("TelemetryExecutionContextAuthSignal");
215
+ var isTruthy = (value) => value !== undefined && value !== "" && value !== "0" && value.toLowerCase() !== "false";
216
+ var isEqual = (value, expected) => value?.toLowerCase() === expected;
217
+ var CI_SIGNATURES = [
218
+ {
219
+ provider: "github_actions",
220
+ matches: (env) => isTruthy(env.GITHUB_ACTIONS),
221
+ isScheduler: (env) => env.GITHUB_EVENT_NAME === "schedule"
222
+ },
223
+ {
224
+ provider: "azure_devops",
225
+ matches: (env) => isTruthy(env.TF_BUILD),
226
+ isScheduler: (env) => isEqual(env.BUILD_REASON, "schedule")
227
+ },
228
+ {
229
+ provider: "gitlab",
230
+ matches: (env) => isTruthy(env.GITLAB_CI),
231
+ isScheduler: (env) => env.CI_PIPELINE_SOURCE === "schedule"
232
+ },
233
+ {
234
+ provider: "circleci",
235
+ matches: (env) => isTruthy(env.CIRCLECI),
236
+ isScheduler: (env) => env.CIRCLE_PIPELINE_TRIGGER_SOURCE === "scheduled_pipeline"
237
+ },
238
+ {
239
+ provider: "jenkins",
240
+ matches: (env) => isTruthy(env.JENKINS_URL) || isTruthy(env.JENKINS_HOME)
241
+ },
242
+ {
243
+ provider: "teamcity",
244
+ matches: (env) => isTruthy(env.TEAMCITY_VERSION)
245
+ },
246
+ {
247
+ provider: "buildkite",
248
+ matches: (env) => isTruthy(env.BUILDKITE),
249
+ isScheduler: (env) => env.BUILDKITE_SOURCE === "schedule"
250
+ },
251
+ {
252
+ provider: "bitbucket",
253
+ matches: (env) => isTruthy(env.BITBUCKET_BUILD_NUMBER)
254
+ },
255
+ {
256
+ provider: "travis",
257
+ matches: (env) => isTruthy(env.TRAVIS)
258
+ },
259
+ {
260
+ provider: "appveyor",
261
+ matches: (env) => isTruthy(env.APPVEYOR)
262
+ },
263
+ {
264
+ provider: "generic",
265
+ matches: (env) => isTruthy(env.CI)
266
+ }
267
+ ];
268
+ function currentEnv() {
269
+ return typeof process === "undefined" ? {} : process.env;
270
+ }
271
+ function currentTtyState() {
272
+ if (typeof process === "undefined")
273
+ return false;
274
+ return Boolean(process.stdout?.isTTY || process.stdin?.isTTY || process.stderr?.isTTY);
275
+ }
276
+ function detectCi(env) {
277
+ const signature = CI_SIGNATURES.find((candidate) => candidate.matches(env));
278
+ if (!signature)
279
+ return;
280
+ return {
281
+ executionContext: signature.isScheduler?.(env) ? "scheduler" : "ci",
282
+ ciProvider: signature.provider
283
+ };
284
+ }
285
+ function detectExecutionContext(options = {}) {
286
+ const env = options.env ?? currentEnv();
287
+ const ci = detectCi(env);
288
+ if (ci)
289
+ return ci;
290
+ const agent = options.agent ?? detectAgentFromEnv(env);
291
+ if (agent) {
292
+ return { executionContext: "agent" };
293
+ }
294
+ const authSignal = options.authSignal ?? authSignalSlot.get();
295
+ if (authSignal === "service_account") {
296
+ return { executionContext: "service_account" };
297
+ }
298
+ const isTty = options.isTty ?? currentTtyState();
299
+ if (isTty) {
300
+ return { executionContext: "manual" };
301
+ }
302
+ return { executionContext: "unknown" };
303
+ }
304
+ function getExecutionContextTelemetryProperties() {
305
+ const detected = detectExecutionContext();
306
+ return {
307
+ [BaseDimensions.ExecutionContext]: detected.executionContext,
308
+ ...detected.ciProvider ? { [BaseDimensions.CiProvider]: detected.ciProvider } : {}
309
+ };
310
+ }
311
+
312
+ // ../common/src/telemetry/global-telemetry-properties.ts
313
+ var telemetryPropsSlot = singleton("TelemetryDefaultProps");
314
+ function getGlobalTelemetryProperties() {
315
+ return telemetryPropsSlot.get();
316
+ }
317
+
318
+ // ../common/src/telemetry/pseudonymize.ts
319
+ var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
320
+ var PSEUDONYM_HEX_LENGTH = 32;
321
+ var SHA256_K = new Uint32Array([
322
+ 1116352408,
323
+ 1899447441,
324
+ 3049323471,
325
+ 3921009573,
326
+ 961987163,
327
+ 1508970993,
328
+ 2453635748,
329
+ 2870763221,
330
+ 3624381080,
331
+ 310598401,
332
+ 607225278,
333
+ 1426881987,
334
+ 1925078388,
335
+ 2162078206,
336
+ 2614888103,
337
+ 3248222580,
338
+ 3835390401,
339
+ 4022224774,
340
+ 264347078,
341
+ 604807628,
342
+ 770255983,
343
+ 1249150122,
344
+ 1555081692,
345
+ 1996064986,
346
+ 2554220882,
347
+ 2821834349,
348
+ 2952996808,
349
+ 3210313671,
350
+ 3336571891,
351
+ 3584528711,
352
+ 113926993,
353
+ 338241895,
354
+ 666307205,
355
+ 773529912,
356
+ 1294757372,
357
+ 1396182291,
358
+ 1695183700,
359
+ 1986661051,
360
+ 2177026350,
361
+ 2456956037,
362
+ 2730485921,
363
+ 2820302411,
364
+ 3259730800,
365
+ 3345764771,
366
+ 3516065817,
367
+ 3600352804,
368
+ 4094571909,
369
+ 275423344,
370
+ 430227734,
371
+ 506948616,
372
+ 659060556,
373
+ 883997877,
374
+ 958139571,
375
+ 1322822218,
376
+ 1537002063,
377
+ 1747873779,
378
+ 1955562222,
379
+ 2024104815,
380
+ 2227730452,
381
+ 2361852424,
382
+ 2428436474,
383
+ 2756734187,
384
+ 3204031479,
385
+ 3329325298
386
+ ]);
387
+ var SHA256_INITIAL_STATE = new Uint32Array([
388
+ 1779033703,
389
+ 3144134277,
390
+ 1013904242,
391
+ 2773480762,
392
+ 1359893119,
393
+ 2600822924,
394
+ 528734635,
395
+ 1541459225
396
+ ]);
397
+ function rotr(value, bits) {
398
+ return (value >>> bits | value << 32 - bits) >>> 0;
399
+ }
400
+ function sha256Hex(input) {
401
+ const bytes = new TextEncoder().encode(input);
402
+ const paddedLength = bytes.length + 9 + 63 >> 6 << 6;
403
+ const buffer = new Uint8Array(paddedLength);
404
+ buffer.set(bytes);
405
+ buffer[bytes.length] = 128;
406
+ const view = new DataView(buffer.buffer);
407
+ const bitLength = bytes.length * 8;
408
+ view.setUint32(paddedLength - 8, Math.floor(bitLength / 4294967296));
409
+ view.setUint32(paddedLength - 4, bitLength >>> 0);
410
+ const state = SHA256_INITIAL_STATE.slice();
411
+ const schedule = new Uint32Array(64);
412
+ for (let offset = 0;offset < paddedLength; offset += 64) {
413
+ for (let i = 0;i < 16; i++) {
414
+ schedule[i] = view.getUint32(offset + i * 4);
415
+ }
416
+ for (let i = 16;i < 64; i++) {
417
+ const x = schedule[i - 15];
418
+ const y = schedule[i - 2];
419
+ const s0 = (rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3) >>> 0;
420
+ const s1 = (rotr(y, 17) ^ rotr(y, 19) ^ y >>> 10) >>> 0;
421
+ schedule[i] = schedule[i - 16] + s0 + schedule[i - 7] + s1 >>> 0;
422
+ }
423
+ let a = state[0];
424
+ let b = state[1];
425
+ let c = state[2];
426
+ let d = state[3];
427
+ let e = state[4];
428
+ let f = state[5];
429
+ let g = state[6];
430
+ let h = state[7];
431
+ for (let i = 0;i < 64; i++) {
432
+ const s1 = (rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25)) >>> 0;
433
+ const ch = (e & f ^ ~e & g) >>> 0;
434
+ const temp1 = h + s1 + ch + SHA256_K[i] + schedule[i] >>> 0;
435
+ const s0 = (rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) >>> 0;
436
+ const maj = (a & b ^ a & c ^ b & c) >>> 0;
437
+ const temp2 = s0 + maj >>> 0;
438
+ h = g;
439
+ g = f;
440
+ f = e;
441
+ e = d + temp1 >>> 0;
442
+ d = c;
443
+ c = b;
444
+ b = a;
445
+ a = temp1 + temp2 >>> 0;
446
+ }
447
+ state[0] = state[0] + a >>> 0;
448
+ state[1] = state[1] + b >>> 0;
449
+ state[2] = state[2] + c >>> 0;
450
+ state[3] = state[3] + d >>> 0;
451
+ state[4] = state[4] + e >>> 0;
452
+ state[5] = state[5] + f >>> 0;
453
+ state[6] = state[6] + g >>> 0;
454
+ state[7] = state[7] + h >>> 0;
455
+ }
456
+ let hex = "";
457
+ for (const word of state) {
458
+ hex += word.toString(16).padStart(8, "0");
459
+ }
460
+ return hex;
461
+ }
462
+ function resolveSha256Hex() {
463
+ try {
464
+ const nodeCrypto = __require("node:crypto");
465
+ const createHash = nodeCrypto?.createHash;
466
+ if (typeof createHash !== "function") {
467
+ return sha256Hex;
468
+ }
469
+ const native = (input) => createHash("sha256").update(input, "utf8").digest("hex");
470
+ return native("abc") === sha256Hex("abc") ? native : sha256Hex;
471
+ } catch {
472
+ return sha256Hex;
473
+ }
474
+ }
475
+ var cachedSha256Hex;
476
+ function digest(input) {
477
+ cachedSha256Hex ??= resolveSha256Hex();
478
+ return cachedSha256Hex(input);
479
+ }
480
+ function pseudonymize(input) {
481
+ return digest(`${PSEUDONYM_DOMAIN}${input}`).slice(0, PSEUDONYM_HEX_LENGTH);
482
+ }
483
+
484
+ // ../common/src/telemetry/supplied-values.ts
485
+ var suppliedValuesSlot = singleton("TelemetrySuppliedArgumentValues");
486
+ function activeEntries() {
487
+ const existing = suppliedValuesSlot.get();
488
+ return Array.isArray(existing) ? existing : [];
489
+ }
490
+ var MIN_SCRUBBABLE_LENGTH = 4;
491
+ function recordSuppliedArgumentValues(values) {
492
+ const flat = [];
493
+ const push = (value) => {
494
+ if (Array.isArray(value)) {
495
+ for (const item of value) {
496
+ push(item);
497
+ }
498
+ return;
499
+ }
500
+ if (typeof value === "string" && value.length >= MIN_SCRUBBABLE_LENGTH) {
501
+ flat.push(value);
502
+ }
503
+ };
504
+ push(values);
505
+ const entry = { values: flat };
506
+ suppliedValuesSlot.set([...activeEntries(), entry]);
507
+ return entry;
508
+ }
509
+ function releaseSuppliedArgumentValues(entry) {
510
+ suppliedValuesSlot.set(activeEntries().filter((held) => held !== entry));
511
+ }
512
+ function getSuppliedArgumentValues() {
513
+ const all = new Set;
514
+ for (const entry of activeEntries()) {
515
+ for (const value of entry.values) {
516
+ all.add(value);
517
+ }
518
+ }
519
+ return [...all].sort((a, b) => b.length - a.length);
520
+ }
521
+
522
+ // ../common/src/telemetry/pii-redactor.ts
523
+ var REDACTED = "[REDACTED]";
524
+ var MAX_VALUE_LENGTH = 280;
525
+ var MAX_STACK_LENGTH = 4096;
526
+ var MAX_SCAN_LENGTH = MAX_STACK_LENGTH;
527
+ function truncate(value, maxLength) {
528
+ return value.length > maxLength ? `${value.slice(0, maxLength)}…` : value;
529
+ }
530
+ var SENSITIVE_NAME_TOKENS = new Set([
531
+ "token",
532
+ "tokens",
533
+ "secret",
534
+ "secrets",
535
+ "password",
536
+ "passwords",
537
+ "pwd",
538
+ "credential",
539
+ "credentials",
540
+ "auth",
541
+ "authentication",
542
+ "authorization",
543
+ "authority",
544
+ "cert",
545
+ "certificate",
546
+ "certificates"
547
+ ]);
548
+ var SENSITIVE_KEY_PREFIXES = new Set([
549
+ "api",
550
+ "access",
551
+ "client",
552
+ "private",
553
+ "public",
554
+ "signing",
555
+ "encryption",
556
+ "session",
557
+ "master",
558
+ "shared",
559
+ "root",
560
+ "ssh",
561
+ "rsa",
562
+ "aes",
563
+ "hmac",
564
+ "oauth"
565
+ ]);
566
+ var UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
567
+ var EMAIL_PATTERN = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
568
+ var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
569
+ var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
570
+ var PADDED_BASE64_PATTERN = /(?<![A-Za-z0-9+/])[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
571
+ var BASE64_WITH_PLUS_PATTERN = /[A-Za-z0-9+/]{40,}/g;
572
+ var USER_HOME_PATTERN = /(?<![A-Za-z0-9._-])([/\\])(Users|home|Profiles)([/\\])([^/\\]+)/gi;
573
+ var UNC_PATH_PATTERN = /(^|[\s"'<>|=,;([{])(\\\\[^\s"'<>|]+)/g;
574
+ var HOST_PORT_PATTERN = /(?<![/@.\w-])(?!\d+\.\d+\.\d+\.\d+:)[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?(?:\.[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?)+:\d{1,5}\b/g;
575
+ var SOURCE_FILE_EXTENSIONS = new Set([
576
+ "ts",
577
+ "tsx",
578
+ "js",
579
+ "jsx",
580
+ "mjs",
581
+ "cjs",
582
+ "cts",
583
+ "mts",
584
+ "py",
585
+ "cs",
586
+ "java",
587
+ "go",
588
+ "rs",
589
+ "rb",
590
+ "php",
591
+ "sh",
592
+ "ps1",
593
+ "json",
594
+ "jsonc",
595
+ "yaml",
596
+ "yml",
597
+ "xml",
598
+ "xaml",
599
+ "md",
600
+ "txt",
601
+ "log",
602
+ "css",
603
+ "html",
604
+ "htm",
605
+ "csproj",
606
+ "nuspec",
607
+ "sql"
608
+ ]);
609
+ var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
610
+ var QUOTED_LITERAL_MAX_SPAN = 200;
611
+ var QUOTED_LITERAL_PATTERN = new RegExp([
612
+ `(?<![A-Za-z0-9])'(?:[^\\
613
+ ]|\\.){2,${QUOTED_LITERAL_MAX_SPAN}}?'(?![A-Za-z0-9])`,
614
+ `(?<![A-Za-z0-9])"(?:[^\\
615
+ ]|\\.){2,${QUOTED_LITERAL_MAX_SPAN}}?"(?![A-Za-z0-9])`
616
+ ].join("|"), "g");
617
+ var JSON_BODY_PATTERN = /[{[][^{}[\]:,]*[:,][^{}[\]]*[\]}]/g;
618
+ var COLLAPSED_BODY = "{…}";
619
+ var COLLAPSED_BODY_MARKER = "\x01body\x01";
620
+ var MAX_BODY_NESTING = 8;
621
+ function collapseJsonBodies(text) {
622
+ let out = text;
623
+ for (let pass = 0;pass < MAX_BODY_NESTING; pass++) {
624
+ const next = out.replace(JSON_BODY_PATTERN, COLLAPSED_BODY_MARKER);
625
+ if (next === out) {
626
+ break;
627
+ }
628
+ out = next;
629
+ }
630
+ return out.split(COLLAPSED_BODY_MARKER).join(COLLAPSED_BODY);
631
+ }
632
+ var TRAILING_PROSE_PUNCT = `.,;:!?)]}>'"`;
633
+ function peelTrailingPunctuation(match) {
634
+ let end = match.length;
635
+ while (end > 0 && TRAILING_PROSE_PUNCT.includes(match[end - 1])) {
636
+ end -= 1;
637
+ }
638
+ return [match.slice(0, end), match.slice(end)];
639
+ }
640
+ function redactUrl(raw) {
641
+ try {
642
+ const url = new URL(raw);
643
+ return `${url.protocol}//${url.host}`;
644
+ } catch {
645
+ return `url#${pseudonymize(raw)}`;
646
+ }
647
+ }
648
+ function redactValueDetectors(value, maxLength = MAX_VALUE_LENGTH) {
649
+ let out = truncate(value, MAX_SCAN_LENGTH);
650
+ out = out.replace(JWT_PATTERN, () => REDACTED);
651
+ out = out.replace(URL_PATTERN, (match) => {
652
+ const [core, trailing] = peelTrailingPunctuation(match);
653
+ return `${redactUrl(core)}${trailing}`;
654
+ });
655
+ out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
656
+ out = out.replace(UNC_PATH_PATTERN, (_match, before, path) => {
657
+ const [core, trailing] = peelTrailingPunctuation(path);
658
+ return `${before}unc#${pseudonymize(core)}${trailing}`;
659
+ });
660
+ out = out.replace(EMAIL_PATTERN, (match) => `email#${pseudonymize(match)}`);
661
+ out = out.replace(UUID_PATTERN, (match) => `uuid#${pseudonymize(match)}`);
662
+ out = out.replace(HOST_PORT_PATTERN, (match) => {
663
+ const split = match.lastIndexOf(":");
664
+ const host = match.slice(0, split);
665
+ const extension = host.slice(host.lastIndexOf(".") + 1).toLowerCase();
666
+ if (SOURCE_FILE_EXTENSIONS.has(extension)) {
667
+ return match;
668
+ }
669
+ return `host#${pseudonymize(host)}:${match.slice(split + 1)}`;
670
+ });
671
+ out = out.replace(PADDED_BASE64_PATTERN, () => REDACTED);
672
+ out = out.replace(BASE64_WITH_PLUS_PATTERN, (match) => match.includes("+") ? REDACTED : match);
673
+ out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
674
+ return truncate(out, maxLength);
675
+ }
676
+ function redactSpanName(name) {
677
+ return redactValueDetectors(truncate(name, MAX_SCAN_LENGTH).replace(QUOTED_LITERAL_PATTERN, (match) => `${match[0]}<redacted>${match[0]}`));
678
+ }
679
+ var HTTP_DEPENDENCY_NAME = /^([A-Z]+) (\/.*)$/s;
680
+ function redactHttpDependencyName(name) {
681
+ const parts = HTTP_DEPENDENCY_NAME.exec(name);
682
+ if (!parts) {
683
+ return redactMessage(name);
684
+ }
685
+ return `${parts[1]} ${redactMessage(parts[2])}`;
686
+ }
687
+ function redactMessage(value) {
688
+ let out = collapseJsonBodies(truncate(value, MAX_SCAN_LENGTH)).replace(QUOTED_LITERAL_PATTERN, (match) => `${match[0]}<redacted>${match[0]}`);
689
+ for (const supplied of getSuppliedArgumentValues()) {
690
+ out = out.split(supplied).join(REDACTED);
691
+ }
692
+ return redactValueDetectors(out);
693
+ }
694
+ var MESSAGE_NAMES = new Set([
695
+ "message",
696
+ "errormessage",
697
+ "errmessage",
698
+ "error_message",
699
+ "msg",
700
+ "detail",
701
+ "details",
702
+ "reason",
703
+ "instructions",
704
+ "warning"
705
+ ]);
706
+ function isFreeFormValue(name, value) {
707
+ return MESSAGE_NAMES.has(name.toLowerCase()) || /['"{[]/.test(value);
708
+ }
709
+ function redactError(error) {
710
+ const safe = new Error(redactMessage(error.message ?? ""));
711
+ safe.name = error.name;
712
+ safe.stack = typeof error.stack === "string" ? redactStack(error.stack) : undefined;
713
+ return safe;
714
+ }
715
+ function redactStack(stack) {
716
+ const bounded = truncate(stack, MAX_STACK_LENGTH);
717
+ const firstBreak = bounded.indexOf(`
718
+ `);
719
+ if (firstBreak === -1) {
720
+ return redactMessage(bounded);
721
+ }
722
+ return `${redactMessage(bounded.slice(0, firstBreak))}
723
+ ${redactValueDetectors(bounded.slice(firstBreak + 1), MAX_STACK_LENGTH)}`;
724
+ }
725
+ function nameTokens(name) {
726
+ return name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[\s._-]+/).map((t) => t.toLowerCase()).filter(Boolean);
727
+ }
728
+ function isSensitiveName(name) {
729
+ const tokens = nameTokens(name);
730
+ for (let i = 0;i < tokens.length; i++) {
731
+ const token = tokens[i];
732
+ if (SENSITIVE_NAME_TOKENS.has(token)) {
733
+ return true;
734
+ }
735
+ if (token === "key" || token === "keys") {
736
+ const prev = tokens[i - 1];
737
+ if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
738
+ return true;
739
+ }
740
+ }
741
+ }
742
+ return false;
743
+ }
744
+ function redactProperty(name, value) {
745
+ if (value === undefined || value === null) {
746
+ return;
747
+ }
748
+ if (isSensitiveName(name)) {
749
+ return REDACTED;
750
+ }
751
+ if (typeof value === "boolean" || typeof value === "number") {
752
+ return value;
753
+ }
754
+ if (typeof value !== "string") {
755
+ return "[OBJECT]";
756
+ }
757
+ return isFreeFormValue(name, value) ? redactMessage(value) : redactValueDetectors(value);
758
+ }
759
+ function redactProperties(properties) {
760
+ const out = {};
761
+ for (const [name, value] of Object.entries(properties)) {
762
+ const redacted = redactProperty(name, value);
763
+ if (redacted !== undefined) {
764
+ out[name] = redacted;
765
+ }
766
+ }
767
+ return out;
768
+ }
769
+
770
+ // ../common/src/telemetry/trace-context.ts
771
+ var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
772
+ var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
773
+ function getProcessEnv() {
774
+ return globalThis.process?.env;
775
+ }
776
+ function parseInboundTraceparent(value) {
777
+ if (!value) {
778
+ return;
779
+ }
780
+ const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
781
+ if (!match) {
782
+ return;
783
+ }
784
+ const [, traceId, parentSpanId] = match;
785
+ if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
786
+ return;
787
+ }
788
+ return { traceId, parentSpanId };
789
+ }
790
+ function getInboundTraceContext() {
791
+ return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
792
+ }
793
+
794
+ // ../common/src/telemetry/session-id.ts
795
+ var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
796
+ var SESSION_ID_MAX_LENGTH = 64;
797
+ var RANDOM_SESSION_ID_LENGTH = 32;
798
+ var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
799
+ var CONTROL_CHARACTERS = /\p{Cc}/gu;
800
+ var INHERITED_SESSION_SOURCES = [
801
+ { envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
802
+ { envVar: "CODEX_THREAD_ID", source: "codex" },
803
+ { envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
804
+ { envVar: "TERM_SESSION_ID", source: "terminal" },
805
+ { envVar: "WT_SESSION", source: "terminal" }
806
+ ];
807
+ var telemetrySessionSlot = singleton("TelemetrySession");
808
+ var telemetryOperationIdSlot = singleton("TelemetryOperationId");
809
+ function getProcessEnv2() {
810
+ return globalThis.process?.env;
811
+ }
812
+ function normalizeSessionId(value) {
813
+ if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
814
+ return;
815
+ }
816
+ const cleaned = String(value).replace(CONTROL_CHARACTERS, "").trim().slice(0, SESSION_ID_MAX_LENGTH);
817
+ return cleaned || undefined;
818
+ }
819
+ function getConfiguredTelemetrySessionId() {
820
+ return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
821
+ }
822
+ function getInheritedSession(env) {
823
+ for (const candidate of INHERITED_SESSION_SOURCES) {
824
+ const handle = normalizeSessionId(env[candidate.envVar]);
825
+ if (handle) {
826
+ return { id: handle, source: candidate.source };
827
+ }
828
+ }
829
+ return;
830
+ }
831
+ function generateRandomSession() {
832
+ const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
833
+ crypto.getRandomValues(bytes);
834
+ let hex = "";
835
+ for (const byte of bytes) {
836
+ hex += byte.toString(16).padStart(2, "0");
837
+ }
838
+ return { id: hex, source: "random" };
839
+ }
840
+ function resolveTelemetrySession() {
841
+ const existing = telemetrySessionSlot.get();
842
+ if (existing) {
843
+ return existing;
844
+ }
845
+ const declaredHandle = getConfiguredTelemetrySessionId();
846
+ const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
847
+ telemetrySessionSlot.set(resolved);
848
+ return resolved;
849
+ }
850
+ function getTelemetrySessionId() {
851
+ return resolveTelemetrySession().id;
852
+ }
853
+ function getTelemetrySessionSource() {
854
+ return resolveTelemetrySession().source;
855
+ }
856
+ function getTelemetryOperationId() {
857
+ const existing = telemetryOperationIdSlot.get();
858
+ if (existing) {
859
+ return existing;
860
+ }
861
+ const inboundTraceId = getInboundTraceContext()?.traceId;
862
+ const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
863
+ telemetryOperationIdSlot.set(generated);
864
+ return generated;
865
+ }
866
+
867
+ // ../common/src/telemetry/span-clock.ts
868
+ function startSpanClock() {
869
+ const started = performance.now();
870
+ return {
871
+ startedAt: new Date(performance.timeOrigin + started),
872
+ elapsedMs: () => performance.now() - started
873
+ };
874
+ }
875
+
876
+ // ../common/src/telemetry/telemetry-service.ts
877
+ class TelemetryService {
878
+ telemetryProvider;
879
+ contextStorage;
880
+ operationId;
881
+ defaultProperties;
882
+ constructor(telemetryProvider, contextStorage) {
883
+ this.telemetryProvider = telemetryProvider;
884
+ this.contextStorage = contextStorage;
885
+ }
886
+ setOperationId(operationId) {
887
+ this.operationId = operationId;
888
+ }
889
+ setProvider(provider) {
890
+ this.telemetryProvider = provider;
891
+ }
892
+ setDefaultProperties(properties) {
893
+ this.defaultProperties = properties === undefined ? undefined : { ...this.defaultProperties, ...properties };
894
+ }
895
+ trackEvent(name, properties) {
896
+ this.telemetryProvider.trackEvent({
897
+ name: redactSpanName(name),
898
+ properties: this.enrichProperties(properties),
899
+ ...this.leafCorrelation()
900
+ });
901
+ }
902
+ trackException(error, properties, context) {
903
+ this.telemetryProvider.trackException({
904
+ error: redactError(error),
905
+ properties: this.enrichProperties(properties),
906
+ ...this.leafCorrelation(context)
907
+ });
908
+ }
909
+ async trackRequest(name, fn, properties) {
910
+ const parentContext = this.getActiveContext();
911
+ const operationId = parentContext?.operationId ?? this.operationId ?? getTelemetryOperationId();
912
+ const parentId = parentContext ? parentContext.id : this.inboundParentIdFor(operationId);
913
+ const clock = startSpanClock();
914
+ const context = {
915
+ operationId,
916
+ ...parentId !== undefined ? { parentId } : {},
917
+ id: this.generateId(),
918
+ startedAt: clock.startedAt
919
+ };
920
+ try {
921
+ const result = await this.contextStorage.run(context, fn);
922
+ const durationMs = clock.elapsedMs();
923
+ await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, true, properties, context));
924
+ return result;
925
+ } catch (error) {
926
+ const durationMs = clock.elapsedMs();
927
+ const err = error instanceof Error ? error : new Error(String(error));
928
+ await this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, false, {
929
+ ...properties,
930
+ [CommandDimensions.ErrorMessage]: err.message
931
+ }, context));
932
+ throw error;
933
+ }
934
+ }
935
+ trackRequestResult(name, durationMs, success, properties, context) {
936
+ const requestContext = context ?? {
937
+ operationId: this.operationId ?? getTelemetryOperationId(),
938
+ id: this.generateId()
939
+ };
940
+ this.telemetryProvider.trackRequest(this.spanFor(name, durationMs, success, properties, requestContext));
941
+ }
942
+ createRequestContext() {
943
+ const operationId = this.operationId ?? getTelemetryOperationId();
944
+ const parentId = this.inboundParentIdFor(operationId);
945
+ return {
946
+ operationId,
947
+ ...parentId !== undefined ? { parentId } : {},
948
+ id: this.generateId(),
949
+ startedAt: startSpanClock().startedAt
950
+ };
951
+ }
952
+ inboundParentIdFor(operationId) {
953
+ const inbound = getInboundTraceContext();
954
+ return inbound && inbound.traceId === operationId ? inbound.parentSpanId : undefined;
955
+ }
956
+ runWithContext(context, fn) {
957
+ return this.contextStorage.run(context, fn);
958
+ }
959
+ createDependencyContext() {
960
+ const parentContext = this.getActiveContext();
961
+ if (!parentContext) {
962
+ return;
963
+ }
964
+ return {
965
+ operationId: parentContext.operationId,
966
+ parentId: parentContext.id,
967
+ id: this.generateId(),
968
+ startedAt: startSpanClock().startedAt
969
+ };
970
+ }
971
+ trackDependencyResult(name, type, durationMs, success, properties, context, resultCode) {
972
+ this.telemetryProvider.trackDependency({
973
+ ...this.spanFor(redactHttpDependencyName(name), durationMs, success, properties, context),
974
+ type,
975
+ ...resultCode !== undefined ? { resultCode } : {}
976
+ });
977
+ }
978
+ async trackDependencyOperation(name, type, fn, properties) {
979
+ const clock = startSpanClock();
980
+ const parentContext = this.getActiveContext();
981
+ const childContext = parentContext !== undefined ? {
982
+ operationId: parentContext.operationId,
983
+ parentId: parentContext.id,
984
+ id: this.generateId(),
985
+ startedAt: clock.startedAt
986
+ } : {
987
+ ...this.createRequestContext(),
988
+ startedAt: clock.startedAt
989
+ };
990
+ try {
991
+ const result = await this.contextStorage.run(childContext, fn);
992
+ const durationMs = clock.elapsedMs();
993
+ await this.telemetryProvider.trackDependency({
994
+ ...this.spanFor(name, durationMs, true, properties, childContext),
995
+ type
996
+ });
997
+ return result;
998
+ } catch (error) {
999
+ const durationMs = clock.elapsedMs();
1000
+ const err = error instanceof Error ? error : new Error(String(error));
1001
+ await this.telemetryProvider.trackDependency({
1002
+ ...this.spanFor(name, durationMs, false, {
1003
+ ...properties,
1004
+ [CommandDimensions.ErrorMessage]: err.message
1005
+ }, childContext),
1006
+ type
1007
+ });
1008
+ throw error;
1009
+ }
1010
+ }
1011
+ getActiveContext() {
1012
+ return this.contextStorage.getContext();
1013
+ }
1014
+ leafCorrelation(explicit) {
1015
+ const context = explicit ?? this.getActiveContext();
1016
+ return {
1017
+ operationId: context?.operationId ?? this.operationId ?? getTelemetryOperationId(),
1018
+ ...context !== undefined ? { parentId: context.id } : {}
1019
+ };
1020
+ }
1021
+ spanFor(name, durationMs, success, properties, context) {
1022
+ return {
1023
+ name: redactSpanName(name),
1024
+ durationMs,
1025
+ success,
1026
+ properties: this.enrichProperties(properties),
1027
+ operationId: context.operationId,
1028
+ ...context.parentId !== undefined ? { parentId: context.parentId } : {},
1029
+ id: context.id,
1030
+ ...context.startedAt !== undefined ? { startedAt: context.startedAt } : {}
1031
+ };
1032
+ }
1033
+ enrichProperties(properties) {
1034
+ const globalProperties = getGlobalTelemetryProperties();
1035
+ const enriched = {
1036
+ ...getExecutionContextTelemetryProperties(),
1037
+ ...globalProperties,
1038
+ ...this.defaultProperties,
1039
+ ...redactProperties(properties ?? {}),
1040
+ [TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
1041
+ [BaseDimensions.SessionId]: this.telemetryProvider.getSessionId?.() ?? getTelemetrySessionId()
1042
+ };
1043
+ return lowercaseIdDimensionValues(enriched);
1044
+ }
1045
+ generateId() {
1046
+ const bytes = new Uint8Array(8);
1047
+ let hex = "";
1048
+ do {
1049
+ crypto.getRandomValues(bytes);
1050
+ hex = "";
1051
+ for (const byte of bytes) {
1052
+ hex += byte.toString(16).padStart(2, "0");
1053
+ }
1054
+ } while (/^0+$/.test(hex));
1055
+ return hex;
1056
+ }
1057
+ }
1058
+
1059
+ // ../common/src/telemetry/browser-context-storage.ts
1060
+ class BrowserContextStorage {
1061
+ contextStack = [];
1062
+ run(context, fn) {
1063
+ this.contextStack.push(context);
1064
+ try {
1065
+ const result = fn();
1066
+ if (result !== null && typeof result === "object" && typeof result.then === "function") {
1067
+ return result.finally(() => {
1068
+ this.contextStack.pop();
1069
+ });
1070
+ }
1071
+ this.contextStack.pop();
1072
+ return result;
1073
+ } catch (error) {
1074
+ this.contextStack.pop();
1075
+ throw error;
1076
+ }
1077
+ }
1078
+ getContext() {
1079
+ return this.contextStack.length > 0 ? this.contextStack[this.contextStack.length - 1] : undefined;
1080
+ }
1081
+ }
1082
+
1083
+ // ../common/src/telemetry/console-telemetry-provider.ts
1084
+ class ConsoleTelemetryProvider {
1085
+ async trackEvent({ name }) {
1086
+ console.debug(`[Telemetry] Event: ${name}`);
1087
+ }
1088
+ async trackException({ error }) {
1089
+ console.error(`[Telemetry] Exception: ${error.message}`);
1090
+ }
1091
+ async trackRequest({
1092
+ name,
1093
+ durationMs,
1094
+ success
1095
+ }) {
1096
+ console.debug(`[Telemetry] Request: ${name} (${durationMs}ms, ${success ? "ok" : "fail"})`);
1097
+ }
1098
+ async trackDependency({
1099
+ name,
1100
+ type,
1101
+ durationMs,
1102
+ success
1103
+ }) {
1104
+ console.debug(`[Telemetry] Dependency: ${name} [${type}] (${durationMs}ms, ${success ? "ok" : "fail"})`);
1105
+ }
1106
+ }
1107
+
1108
+ // ../common/src/catch-error.ts
1109
+ var MAX_SERIALIZED_LENGTH = 500;
1110
+ var TRUNCATION_SUFFIX = "…(truncated)";
1111
+ var REDACTED2 = "[REDACTED]";
1112
+ function cap(text) {
1113
+ return text.length > MAX_SERIALIZED_LENGTH ? `${text.slice(0, MAX_SERIALIZED_LENGTH)}${TRUNCATION_SUFFIX}` : text;
1114
+ }
1115
+ function omitSensitive(key, value) {
1116
+ return key.length > 0 && isSensitiveName(key) ? REDACTED2 : value;
1117
+ }
1118
+ function describeThrownValue(value) {
1119
+ if (typeof value !== "object" || value === null) {
1120
+ return String(value);
1121
+ }
1122
+ let message;
1123
+ try {
1124
+ message = value.message;
1125
+ } catch {
1126
+ message = undefined;
1127
+ }
1128
+ if (typeof message === "string" && message.length > 0) {
1129
+ return cap(message);
1130
+ }
1131
+ try {
1132
+ const json = JSON.stringify(value, omitSensitive);
1133
+ if (json !== undefined) {
1134
+ return cap(json);
1135
+ }
1136
+ } catch {}
1137
+ return String(value);
1138
+ }
1139
+ function toError(error) {
1140
+ return error instanceof Error ? error : new Error(describeThrownValue(error), { cause: error });
1141
+ }
1142
+ function isPromiseLike(value) {
1143
+ return value !== null && typeof value === "object" && typeof value.then === "function";
1144
+ }
1145
+ function catchError(fnOrPromise) {
1146
+ if (isPromiseLike(fnOrPromise)) {
1147
+ return settlePromiseLike(fnOrPromise);
1148
+ }
1149
+ try {
1150
+ const result = fnOrPromise();
1151
+ if (isPromiseLike(result)) {
1152
+ return settlePromiseLike(result);
1153
+ }
1154
+ return [undefined, result];
1155
+ } catch (error) {
1156
+ return [toError(error), undefined];
1157
+ }
1158
+ }
1159
+ function settlePromiseLike(thenable) {
1160
+ return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
1161
+ }
1162
+
1163
+ // ../common/src/error-graph.ts
1164
+ function* walkErrorGraph(error) {
1165
+ const queue = [error];
1166
+ const seen = new Set;
1167
+ for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
1168
+ const current = queue.shift();
1169
+ if (current === null || typeof current !== "object")
1170
+ continue;
1171
+ if (seen.has(current))
1172
+ continue;
1173
+ seen.add(current);
1174
+ const cur = current;
1175
+ yield cur;
1176
+ if (cur.cause !== undefined)
1177
+ queue.push(cur.cause);
1178
+ if (Array.isArray(cur.errors))
1179
+ queue.push(...cur.errors);
1180
+ }
1181
+ return;
1182
+ }
1183
+ function parseHttpStatusFromMessage(message) {
1184
+ const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
1185
+ if (!match)
1186
+ return;
1187
+ const status = Number(match[1]);
1188
+ return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
1189
+ }
1190
+ function findHttpStatusInGraph(error) {
1191
+ for (const node of walkErrorGraph(error)) {
1192
+ const response = node.response;
1193
+ const explicit = typeof node.status === "number" ? node.status : response?.status;
1194
+ if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
1195
+ return explicit;
1196
+ }
1197
+ if (typeof node.message === "string") {
1198
+ const parsed = parseHttpStatusFromMessage(node.message);
1199
+ if (parsed !== undefined && parsed >= 400) {
1200
+ return parsed;
1201
+ }
1202
+ }
1203
+ }
1204
+ return;
1205
+ }
1206
+
1207
+ // ../common/src/local-permission-codes.ts
1208
+ var LOCAL_PERMISSION_ERROR_CODES = new Set([
1209
+ "EACCES",
1210
+ "EPERM",
1211
+ "EROFS"
1212
+ ]);
1213
+
1214
+ // ../common/src/error-handler.ts
1215
+ var NETWORK_ERROR_CODES = new Set([
1216
+ "ECONNREFUSED",
1217
+ "ECONNRESET",
1218
+ "ENOTFOUND",
1219
+ "EAI_AGAIN",
1220
+ "ETIMEDOUT",
1221
+ "EPIPE",
1222
+ "EHOSTUNREACH",
1223
+ "ENETUNREACH",
1224
+ "EAI_FAIL"
1225
+ ]);
1226
+ var TLS_ERROR_CODES = new Set([
1227
+ "SELF_SIGNED_CERT_IN_CHAIN",
1228
+ "DEPTH_ZERO_SELF_SIGNED_CERT",
1229
+ "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
1230
+ "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
1231
+ "UNABLE_TO_GET_ISSUER_CERT",
1232
+ "CERT_HAS_EXPIRED",
1233
+ "CERT_UNTRUSTED",
1234
+ "ERR_TLS_CERT_ALTNAME_INVALID"
1235
+ ]);
1236
+ 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.";
1237
+ 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.";
1238
+ var LOCAL_PERMISSION_MESSAGE_PATTERN = new RegExp(`\\b(${[...LOCAL_PERMISSION_ERROR_CODES].join("|")})\\b`);
1239
+ function carriedInstructions(error) {
1240
+ if (!error || typeof error !== "object")
1241
+ return;
1242
+ const e = error;
1243
+ return typeof e.instructions === "string" ? e.instructions : undefined;
1244
+ }
1245
+
1246
+ // ../common/src/telemetry/environment-info.ts
1247
+ var LOCAL_HOSTS = new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
1248
+
1249
+ // ../common/src/telemetry/command-attribution.ts
1250
+ var LEGACY_SKILL_NAMESPACE = "uipath:";
1251
+ var MAX_SKILL_NAME_LENGTH = 80;
1252
+ var SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
1253
+ function productMode(productArea, mode) {
1254
+ return { ProductArea: productArea, Mode: mode };
1255
+ }
1256
+ function attributionRecord(groups) {
1257
+ const record = {};
1258
+ for (const [productArea, mode, names] of groups) {
1259
+ const attribution = productMode(productArea, mode);
1260
+ for (const name of names) {
1261
+ record[name] = attribution;
1262
+ }
1263
+ }
1264
+ return record;
1265
+ }
1266
+ function commandAttribution(groups) {
1267
+ const entries = [];
1268
+ for (const [productArea, mode, prefixes] of groups) {
1269
+ const attribution = productMode(productArea, mode);
1270
+ for (const prefix of prefixes) {
1271
+ entries.push({ prefix, attribution });
1272
+ }
1273
+ }
1274
+ return entries;
1275
+ }
1276
+ var SKILL_ATTRIBUTION = attributionRecord([
1277
+ ["admin", "operate", ["uipath-admin"]],
1278
+ ["agents", "build", ["uipath-agents"]],
1279
+ ["api-workflow", "build", ["uipath-api-workflow"]],
1280
+ ["automation-discovery", "build", ["uipath-automation-discovery"]],
1281
+ ["coded-apps", "build", ["uipath-coded-apps"]],
1282
+ ["data-fabric", "operate", ["uipath-data-fabric"]],
1283
+ ["cli", "troubleshoot", ["uipath-feedback"]],
1284
+ ["governance", "operate", ["uipath-governance"]],
1285
+ ["action-center", "build", ["uipath-human-in-the-loop"]],
1286
+ ["document-understanding", "build", ["uipath-ixp"]],
1287
+ [
1288
+ "maestro",
1289
+ "build",
1290
+ ["uipath-maestro-bpmn", "uipath-maestro-case", "uipath-maestro-flow"]
1291
+ ],
1292
+ ["agenthub", "build", ["uipath-mcp-servers"]],
1293
+ ["solution", "build", ["uipath-planner", "uipath-solution"]],
1294
+ ["platform", "operate", ["uipath-platform"]],
1295
+ ["quality", "troubleshoot", ["uipath-review"]],
1296
+ ["rpa", "build", ["uipath-rpa"]],
1297
+ ["cli", "operate", ["uipath-skill-catalog"]],
1298
+ ["action-center", "operate", ["uipath-tasks"]],
1299
+ ["test-manager", "operate", ["uipath-test"]],
1300
+ ["platform", "troubleshoot", ["uipath-troubleshoot"]]
1301
+ ]);
1302
+ var KNOWN_SKILL_NAMES = new Set(Object.keys(SKILL_ATTRIBUTION));
1303
+ var COMMAND_ATTRIBUTION = commandAttribution([
1304
+ ["cli", "troubleshoot", ["uip.feedback"]],
1305
+ ["llm-gateway", "operate", ["uip.llm-gateway"]],
1306
+ ["llm-gateway", "operate", ["uip.llm-configuration", "uip.model-hub"]],
1307
+ ["context-grounding", "build", ["uip.context-grounding"]],
1308
+ ["api-workflow", "build", ["uip.api-workflow"]],
1309
+ ["rpa", "build", ["uip.rpa-legacy"]],
1310
+ ["conversational", "operate", ["uip.conversational"]],
1311
+ ["agents", "build", ["uip.codedagent", "uip.agent"]],
1312
+ ["coding-agents", "build", ["uip.coder"]],
1313
+ ["agenthub", "build", ["uip.agenthub"]],
1314
+ ["coded-apps", "build", ["uip.codedapp"]],
1315
+ ["functions", "build", ["uip.function", "uip.functions"]],
1316
+ ["solution", "build", ["uip.solution"]],
1317
+ ["maestro", "build", ["uip.maestro", "uip.case", "uip.flow"]],
1318
+ ["llm-observability", "troubleshoot", ["uip.traces"]],
1319
+ ["platform", "operate", ["uip.platform"]],
1320
+ ["admin", "operate", ["uip.admin"]],
1321
+ ["automation-ops", "operate", ["uip.aops"]],
1322
+ ["documentation", "troubleshoot", ["uip.docsai"]],
1323
+ ["governance", "operate", ["uip.gov"]],
1324
+ ["insights", "operate", ["uip.insights"]],
1325
+ ["document-understanding", "build", ["uip.ixp"]],
1326
+ ["process-mining", "operate", ["uip.pm"]],
1327
+ ["action-center", "operate", ["uip.tasks"]],
1328
+ ["test-manager", "operate", ["uip.tm"]],
1329
+ ["vertical-solutions", "build", ["uip.vss"]],
1330
+ ["data-fabric", "operate", ["uip.df"]],
1331
+ ["integration-service", "build", ["uip.is"]],
1332
+ ["orchestrator", "operate", ["uip.or"]],
1333
+ [
1334
+ "cli",
1335
+ "operate",
1336
+ [
1337
+ "uip.login",
1338
+ "uip.logout",
1339
+ "uip.user",
1340
+ "uip.config",
1341
+ "uip.tools",
1342
+ "uip.skills",
1343
+ "uip.completion",
1344
+ "uip.update",
1345
+ "uip.mcp",
1346
+ "uip.track"
1347
+ ]
1348
+ ]
1349
+ ]).sort((a, b) => b.prefix.length - a.prefix.length);
1350
+ function normalizeCommandPath(value) {
1351
+ if (typeof value !== "string") {
1352
+ return;
1353
+ }
1354
+ const trimmed = value.trim().toLowerCase();
1355
+ if (!trimmed) {
1356
+ return;
1357
+ }
1358
+ const tokens = trimmed.includes(" ") ? trimmed.split(/\s+/).filter((token) => token.length > 0).filter((token) => !token.startsWith("-")) : trimmed.split(".").filter((token) => token.length > 0);
1359
+ if (tokens.length === 0) {
1360
+ return;
1361
+ }
1362
+ const commandTokens = tokens[0] === "uip" ? tokens : ["uip", ...tokens];
1363
+ return commandTokens.join(".");
1364
+ }
1365
+ function getCommandProductModeAttribution(commandPath) {
1366
+ const normalized = normalizeCommandPath(commandPath);
1367
+ if (!normalized) {
1368
+ return;
1369
+ }
1370
+ return COMMAND_ATTRIBUTION.find(({ prefix }) => normalized === prefix || normalized.startsWith(`${prefix}.`))?.attribution;
1371
+ }
1372
+ function normalizeSkillNameWithOptions(value, options) {
1373
+ if (typeof value !== "string") {
1374
+ return;
1375
+ }
1376
+ const normalized = value.trim().toLowerCase();
1377
+ if (!normalized) {
1378
+ return;
1379
+ }
1380
+ const hasLegacyNamespace = normalized.startsWith(LEGACY_SKILL_NAMESPACE);
1381
+ if (hasLegacyNamespace && !options.allowLegacyNamespace) {
1382
+ return;
1383
+ }
1384
+ const skillName = hasLegacyNamespace ? normalized.slice(LEGACY_SKILL_NAMESPACE.length) : normalized;
1385
+ if (skillName.length > MAX_SKILL_NAME_LENGTH || !SKILL_NAME_PATTERN.test(skillName) || !KNOWN_SKILL_NAMES.has(skillName)) {
1386
+ return;
1387
+ }
1388
+ return skillName;
1389
+ }
1390
+ function normalizeSkillName(value) {
1391
+ return normalizeSkillNameWithOptions(value, {
1392
+ allowLegacyNamespace: false
1393
+ });
1394
+ }
1395
+ function buildCommandTelemetryAttribution(commandPath, skillSource) {
1396
+ const skillName = normalizeSkillName(skillSource);
1397
+ return {
1398
+ ...skillName ? { SkillName: skillName } : {},
1399
+ ...getCommandProductModeAttribution(commandPath)
1400
+ };
1401
+ }
1402
+ var AGENT_SESSION_ENV = {
1403
+ [BaseDimensions.AgentModel]: "UIPATH_AGENT_MODEL",
1404
+ [SkillsDimensions.PermissionMode]: "UIPATH_PERMISSION_MODE",
1405
+ [SkillsDimensions.EffortLevel]: "UIPATH_EFFORT_LEVEL",
1406
+ [SkillsDimensions.SkillsVersion]: "UIPATH_SKILLS_VERSION"
1407
+ };
1408
+ var MAX_TELEMETRY_TOKEN_LENGTH = 120;
1409
+ function sanitizeTelemetryToken(value) {
1410
+ return value.replace(/[^A-Za-z0-9:._/ -]/g, "_").slice(0, MAX_TELEMETRY_TOKEN_LENGTH);
1411
+ }
1412
+ function buildAgentSessionTelemetry(env) {
1413
+ const dimensions = {};
1414
+ for (const [key, variable] of Object.entries(AGENT_SESSION_ENV)) {
1415
+ const value = env[variable]?.trim();
1416
+ if (value) {
1417
+ dimensions[key] = sanitizeTelemetryToken(value);
1418
+ }
1419
+ }
1420
+ return dimensions;
1421
+ }
1422
+
1423
+ // ../common/src/sdk-user-agent.ts
1424
+ var USER_AGENT_HEADER = "User-Agent";
1425
+ var AGENT_PROPERTY = BaseDimensions.Agent;
1426
+ var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
1427
+ function userAgentPatchKey(userAgent) {
1428
+ return Symbol.for(`@uipath/common/sdk-user-agent/${userAgent}`);
1429
+ }
1430
+ function splitUserAgentTokens(value) {
1431
+ return value?.trim().split(/\s+/).filter(Boolean) ?? [];
1432
+ }
1433
+ function appendUserAgentToken(value, userAgent) {
1434
+ const tokens = splitUserAgentTokens(value);
1435
+ const seen = new Set(tokens);
1436
+ for (const token of splitUserAgentTokens(userAgent)) {
1437
+ if (!seen.has(token)) {
1438
+ tokens.push(token);
1439
+ seen.add(token);
1440
+ }
1441
+ }
1442
+ return tokens.join(" ");
1443
+ }
1444
+ function getEffectiveUserAgent(userAgent) {
1445
+ return appendUserAgentToken(sdkUserAgentHostToken.get(), userAgent);
1446
+ }
1447
+ function getHeaderName(headers, headerName) {
1448
+ return Object.keys(headers).find((key) => key.toLowerCase() === headerName.toLowerCase());
1449
+ }
1450
+ function getSdkUserAgentToken(pkg) {
1451
+ const packageName = pkg.name.replace(/^@uipath\//, "");
1452
+ return getEffectiveUserAgent(`${packageName}/${pkg.version}`);
1453
+ }
1454
+ function addSdkUserAgentHeader(headers, userAgent) {
1455
+ const result = { ...headers ?? {} };
1456
+ const headerName = getHeaderName(result, USER_AGENT_HEADER);
1457
+ result[headerName ?? USER_AGENT_HEADER] = appendUserAgentToken(headerName ? result[headerName] : undefined, getEffectiveUserAgent(userAgent));
1458
+ return result;
1459
+ }
1460
+ function asHeaderRecord(headers) {
1461
+ return typeof headers === "object" && headers !== null ? { ...headers } : {};
1462
+ }
1463
+ function withForwardedHeadersInitOverride(initOverrides, forward) {
1464
+ return async (requestContext) => {
1465
+ const initWithHeaders = {
1466
+ ...requestContext.init,
1467
+ headers: forward(asHeaderRecord(requestContext.init.headers))
1468
+ };
1469
+ const override = typeof initOverrides === "function" ? await initOverrides({
1470
+ ...requestContext,
1471
+ init: initWithHeaders
1472
+ }) : initOverrides;
1473
+ return {
1474
+ ...override ?? {},
1475
+ headers: forward(asHeaderRecord(override?.headers ?? initWithHeaders.headers))
1476
+ };
1477
+ };
1478
+ }
1479
+ function installRequestHeaderForwarding(BaseApiClass, patchKey, forward) {
1480
+ const prototype = BaseApiClass.prototype;
1481
+ if (prototype[patchKey]) {
1482
+ return;
1483
+ }
1484
+ if (typeof prototype.request !== "function") {
1485
+ throw new Error("Generated BaseAPI request function not found.");
1486
+ }
1487
+ const originalRequest = prototype.request;
1488
+ prototype.request = function requestWithForwardedHeaders(context, initOverrides) {
1489
+ return originalRequest.call(this, context, withForwardedHeadersInitOverride(initOverrides, forward));
1490
+ };
1491
+ Object.defineProperty(prototype, patchKey, {
1492
+ value: true
1493
+ });
1494
+ }
1495
+ function installSdkUserAgentHeader(BaseApiClass, userAgent) {
1496
+ installRequestHeaderForwarding(BaseApiClass, userAgentPatchKey(userAgent), (headers) => addSdkUserAgentHeader(headers, userAgent));
1497
+ }
1498
+
1499
+ export { singleton, recordSuppliedArgumentValues, releaseSuppliedArgumentValues, redactProperties, catchError, walkErrorGraph, findHttpStatusInGraph, LOCAL_PERMISSION_ERROR_CODES, carriedInstructions, CommandDimensions, ErrorDimensions, PackagerDimensions, TelemetryService, buildCommandTelemetryAttribution, buildAgentSessionTelemetry, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, BrowserContextStorage, ConsoleTelemetryProvider };
1500
+
1501
+ //# debugId=11CC1EDA75016DA264756E2164756E21