@uipath/codedagent-tool 1.199.0-preview.91 → 1.199.0-preview.97
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.
- package/dist/init.js +256 -149
- package/dist/tool.js +257 -150
- package/package.json +2 -2
package/dist/init.js
CHANGED
|
@@ -27089,11 +27089,36 @@ class NodeContextStorage {
|
|
|
27089
27089
|
return this.storage.getStore();
|
|
27090
27090
|
}
|
|
27091
27091
|
}
|
|
27092
|
+
// ../common/src/telemetry/trace-context.ts
|
|
27093
|
+
var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
|
|
27094
|
+
var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
27095
|
+
function getProcessEnv() {
|
|
27096
|
+
return globalThis.process?.env;
|
|
27097
|
+
}
|
|
27098
|
+
function parseInboundTraceparent(value) {
|
|
27099
|
+
if (!value) {
|
|
27100
|
+
return;
|
|
27101
|
+
}
|
|
27102
|
+
const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
|
|
27103
|
+
if (!match) {
|
|
27104
|
+
return;
|
|
27105
|
+
}
|
|
27106
|
+
const [, traceId, parentSpanId] = match;
|
|
27107
|
+
if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
|
|
27108
|
+
return;
|
|
27109
|
+
}
|
|
27110
|
+
return { traceId, parentSpanId };
|
|
27111
|
+
}
|
|
27112
|
+
function getInboundTraceContext() {
|
|
27113
|
+
return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
|
|
27114
|
+
}
|
|
27115
|
+
|
|
27092
27116
|
// ../common/src/telemetry/session-id.ts
|
|
27093
27117
|
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
27094
27118
|
var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
|
|
27095
27119
|
var telemetrySessionIdSlot = singleton("TelemetrySessionId");
|
|
27096
|
-
|
|
27120
|
+
var telemetryOperationIdSlot = singleton("TelemetryOperationId");
|
|
27121
|
+
function getProcessEnv2() {
|
|
27097
27122
|
return globalThis.process?.env;
|
|
27098
27123
|
}
|
|
27099
27124
|
function normalizeSessionId(value) {
|
|
@@ -27104,18 +27129,165 @@ function normalizeSessionId(value) {
|
|
|
27104
27129
|
return trimmed || undefined;
|
|
27105
27130
|
}
|
|
27106
27131
|
function getConfiguredTelemetrySessionId() {
|
|
27107
|
-
return normalizeSessionId(
|
|
27132
|
+
return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
|
|
27108
27133
|
}
|
|
27109
27134
|
function resolveTelemetrySessionId(existingSessionId) {
|
|
27110
27135
|
return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
|
|
27111
27136
|
}
|
|
27137
|
+
function getTelemetryOperationId() {
|
|
27138
|
+
const existing = telemetryOperationIdSlot.get();
|
|
27139
|
+
if (existing) {
|
|
27140
|
+
return existing;
|
|
27141
|
+
}
|
|
27142
|
+
const inboundTraceId = getInboundTraceContext()?.traceId;
|
|
27143
|
+
const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
|
|
27144
|
+
telemetryOperationIdSlot.set(generated);
|
|
27145
|
+
return generated;
|
|
27146
|
+
}
|
|
27112
27147
|
// ../common/src/telemetry/global-telemetry-properties.ts
|
|
27113
27148
|
var telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
27114
27149
|
function getGlobalTelemetryProperties() {
|
|
27115
27150
|
return telemetryPropsSlot.get();
|
|
27116
27151
|
}
|
|
27117
27152
|
|
|
27153
|
+
// ../common/src/telemetry/pii-redactor.ts
|
|
27154
|
+
var REDACTED = "[REDACTED]";
|
|
27155
|
+
var MAX_VALUE_LENGTH = 200;
|
|
27156
|
+
var SENSITIVE_NAME_TOKENS = new Set([
|
|
27157
|
+
"token",
|
|
27158
|
+
"tokens",
|
|
27159
|
+
"secret",
|
|
27160
|
+
"secrets",
|
|
27161
|
+
"password",
|
|
27162
|
+
"passwords",
|
|
27163
|
+
"pwd",
|
|
27164
|
+
"credential",
|
|
27165
|
+
"credentials",
|
|
27166
|
+
"auth",
|
|
27167
|
+
"authentication",
|
|
27168
|
+
"authorization",
|
|
27169
|
+
"authority",
|
|
27170
|
+
"cert",
|
|
27171
|
+
"certificate",
|
|
27172
|
+
"certificates"
|
|
27173
|
+
]);
|
|
27174
|
+
var SENSITIVE_KEY_PREFIXES = new Set([
|
|
27175
|
+
"api",
|
|
27176
|
+
"access",
|
|
27177
|
+
"client",
|
|
27178
|
+
"private",
|
|
27179
|
+
"public",
|
|
27180
|
+
"signing",
|
|
27181
|
+
"encryption",
|
|
27182
|
+
"session",
|
|
27183
|
+
"master",
|
|
27184
|
+
"shared",
|
|
27185
|
+
"root",
|
|
27186
|
+
"ssh",
|
|
27187
|
+
"rsa",
|
|
27188
|
+
"aes",
|
|
27189
|
+
"hmac",
|
|
27190
|
+
"oauth"
|
|
27191
|
+
]);
|
|
27192
|
+
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;
|
|
27193
|
+
var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
27194
|
+
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
27195
|
+
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
27196
|
+
var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
|
|
27197
|
+
var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
|
|
27198
|
+
var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
|
|
27199
|
+
function shortHash(input) {
|
|
27200
|
+
let hash = 2166136261;
|
|
27201
|
+
for (let i = 0;i < input.length; i++) {
|
|
27202
|
+
hash ^= input.charCodeAt(i);
|
|
27203
|
+
hash = Math.imul(hash, 16777619);
|
|
27204
|
+
}
|
|
27205
|
+
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
27206
|
+
}
|
|
27207
|
+
function redactUrl(raw) {
|
|
27208
|
+
try {
|
|
27209
|
+
const url = new URL(raw);
|
|
27210
|
+
return `${url.protocol}//${url.host}`;
|
|
27211
|
+
} catch {
|
|
27212
|
+
return `url#${shortHash(raw)}`;
|
|
27213
|
+
}
|
|
27214
|
+
}
|
|
27215
|
+
function redactValueDetectors(value) {
|
|
27216
|
+
let out = value;
|
|
27217
|
+
out = out.replace(JWT_PATTERN, () => REDACTED);
|
|
27218
|
+
out = out.replace(URL_PATTERN, (match) => {
|
|
27219
|
+
const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
|
|
27220
|
+
const core2 = trailing ? match.slice(0, -trailing.length) : match;
|
|
27221
|
+
return `${redactUrl(core2)}${trailing}`;
|
|
27222
|
+
});
|
|
27223
|
+
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
27224
|
+
out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
|
|
27225
|
+
out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
|
|
27226
|
+
out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
|
|
27227
|
+
if (out.length > MAX_VALUE_LENGTH) {
|
|
27228
|
+
out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
|
|
27229
|
+
}
|
|
27230
|
+
return out;
|
|
27231
|
+
}
|
|
27232
|
+
function redactValue(value) {
|
|
27233
|
+
return redactValueDetectors(value);
|
|
27234
|
+
}
|
|
27235
|
+
function redactError(error) {
|
|
27236
|
+
const safe = new Error(redactValueDetectors(error.message ?? ""));
|
|
27237
|
+
safe.name = error.name;
|
|
27238
|
+
safe.stack = typeof error.stack === "string" ? redactValueDetectors(error.stack) : undefined;
|
|
27239
|
+
return safe;
|
|
27240
|
+
}
|
|
27241
|
+
function nameTokens(name) {
|
|
27242
|
+
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);
|
|
27243
|
+
}
|
|
27244
|
+
function isSensitiveName(name) {
|
|
27245
|
+
const tokens = nameTokens(name);
|
|
27246
|
+
for (let i = 0;i < tokens.length; i++) {
|
|
27247
|
+
const token = tokens[i];
|
|
27248
|
+
if (SENSITIVE_NAME_TOKENS.has(token)) {
|
|
27249
|
+
return true;
|
|
27250
|
+
}
|
|
27251
|
+
if (token === "key" || token === "keys") {
|
|
27252
|
+
const prev = tokens[i - 1];
|
|
27253
|
+
if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
|
|
27254
|
+
return true;
|
|
27255
|
+
}
|
|
27256
|
+
}
|
|
27257
|
+
}
|
|
27258
|
+
return false;
|
|
27259
|
+
}
|
|
27260
|
+
function redactProperty(name, value) {
|
|
27261
|
+
if (value === undefined || value === null) {
|
|
27262
|
+
return;
|
|
27263
|
+
}
|
|
27264
|
+
if (isSensitiveName(name)) {
|
|
27265
|
+
return REDACTED;
|
|
27266
|
+
}
|
|
27267
|
+
if (typeof value === "boolean" || typeof value === "number") {
|
|
27268
|
+
return value;
|
|
27269
|
+
}
|
|
27270
|
+
if (typeof value !== "string") {
|
|
27271
|
+
return "[OBJECT]";
|
|
27272
|
+
}
|
|
27273
|
+
return redactValueDetectors(value);
|
|
27274
|
+
}
|
|
27275
|
+
function redactProperties(properties) {
|
|
27276
|
+
const out = {};
|
|
27277
|
+
for (const [name, value] of Object.entries(properties)) {
|
|
27278
|
+
const redacted = redactProperty(name, value);
|
|
27279
|
+
if (redacted !== undefined) {
|
|
27280
|
+
out[name] = redacted;
|
|
27281
|
+
}
|
|
27282
|
+
}
|
|
27283
|
+
return out;
|
|
27284
|
+
}
|
|
27285
|
+
|
|
27118
27286
|
// ../common/src/telemetry/telemetry-service.ts
|
|
27287
|
+
var TELEMETRY_OPERATION_ID_PROPERTY = "uip.trace.operation_id";
|
|
27288
|
+
var TELEMETRY_PARENT_ID_PROPERTY = "uip.trace.parent_id";
|
|
27289
|
+
var TELEMETRY_SPAN_ID_PROPERTY = "uip.trace.span_id";
|
|
27290
|
+
|
|
27119
27291
|
class TelemetryService {
|
|
27120
27292
|
telemetryProvider;
|
|
27121
27293
|
contextStorage;
|
|
@@ -27142,11 +27314,15 @@ class TelemetryService {
|
|
|
27142
27314
|
trackException(error, properties) {
|
|
27143
27315
|
const context = this.getCurrentContext();
|
|
27144
27316
|
const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
|
|
27145
|
-
this.telemetryProvider.trackException(error, enrichedProperties);
|
|
27317
|
+
this.telemetryProvider.trackException(redactError(error), enrichedProperties);
|
|
27146
27318
|
}
|
|
27147
27319
|
async trackRequest(name, fn, properties) {
|
|
27320
|
+
const parentContext = this.getCurrentContext();
|
|
27321
|
+
const operationId = parentContext?.operationId ?? this.operationId ?? getTelemetryOperationId();
|
|
27322
|
+
const parentId = parentContext ? parentContext.id : this.inboundParentIdFor(operationId);
|
|
27148
27323
|
const context = {
|
|
27149
|
-
operationId
|
|
27324
|
+
operationId,
|
|
27325
|
+
...parentId !== undefined ? { parentId } : {},
|
|
27150
27326
|
id: this.generateId()
|
|
27151
27327
|
};
|
|
27152
27328
|
const startTime = performance.now();
|
|
@@ -27164,6 +27340,45 @@ class TelemetryService {
|
|
|
27164
27340
|
throw error;
|
|
27165
27341
|
}
|
|
27166
27342
|
}
|
|
27343
|
+
trackRequestResult(name, durationMs, success, properties, context) {
|
|
27344
|
+
const requestContext = context ?? {
|
|
27345
|
+
operationId: this.operationId ?? getTelemetryOperationId(),
|
|
27346
|
+
id: this.generateId()
|
|
27347
|
+
};
|
|
27348
|
+
const enrichedProperties = this.enrichPropertiesWithContext(properties, requestContext);
|
|
27349
|
+
this.telemetryProvider.trackRequest(name, durationMs, success, enrichedProperties);
|
|
27350
|
+
}
|
|
27351
|
+
createRequestContext() {
|
|
27352
|
+
const operationId = this.operationId ?? getTelemetryOperationId();
|
|
27353
|
+
const parentId = this.inboundParentIdFor(operationId);
|
|
27354
|
+
return {
|
|
27355
|
+
operationId,
|
|
27356
|
+
...parentId !== undefined ? { parentId } : {},
|
|
27357
|
+
id: this.generateId()
|
|
27358
|
+
};
|
|
27359
|
+
}
|
|
27360
|
+
inboundParentIdFor(operationId) {
|
|
27361
|
+
const inbound = getInboundTraceContext();
|
|
27362
|
+
return inbound && inbound.traceId === operationId ? inbound.parentSpanId : undefined;
|
|
27363
|
+
}
|
|
27364
|
+
runWithContext(context, fn) {
|
|
27365
|
+
return this.contextStorage.run(context, fn);
|
|
27366
|
+
}
|
|
27367
|
+
createDependencyContext() {
|
|
27368
|
+
const parentContext = this.getCurrentContext();
|
|
27369
|
+
if (!parentContext) {
|
|
27370
|
+
return;
|
|
27371
|
+
}
|
|
27372
|
+
return {
|
|
27373
|
+
operationId: parentContext.operationId,
|
|
27374
|
+
parentId: parentContext.id,
|
|
27375
|
+
id: this.generateId()
|
|
27376
|
+
};
|
|
27377
|
+
}
|
|
27378
|
+
trackDependencyResult(name, type2, durationMs, success, properties, context, resultCode) {
|
|
27379
|
+
const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
|
|
27380
|
+
this.telemetryProvider.trackDependency(redactValue(name), type2, durationMs, success, enrichedProperties, resultCode);
|
|
27381
|
+
}
|
|
27167
27382
|
async trackDependencyOperation(name, type2, fn, properties) {
|
|
27168
27383
|
const parentContext = this.getCurrentContext();
|
|
27169
27384
|
if (!parentContext) {
|
|
@@ -27200,8 +27415,12 @@ class TelemetryService {
|
|
|
27200
27415
|
...getExecutionContextTelemetryProperties(),
|
|
27201
27416
|
...globalProperties,
|
|
27202
27417
|
...this.defaultProperties,
|
|
27203
|
-
...properties,
|
|
27204
|
-
...context
|
|
27418
|
+
...redactProperties(properties ?? {}),
|
|
27419
|
+
...context ? {
|
|
27420
|
+
[TELEMETRY_OPERATION_ID_PROPERTY]: context.operationId,
|
|
27421
|
+
...context.parentId !== undefined ? { [TELEMETRY_PARENT_ID_PROPERTY]: context.parentId } : {},
|
|
27422
|
+
[TELEMETRY_SPAN_ID_PROPERTY]: context.id
|
|
27423
|
+
} : {}
|
|
27205
27424
|
};
|
|
27206
27425
|
if (sessionId === undefined) {
|
|
27207
27426
|
delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
|
|
@@ -27211,7 +27430,16 @@ class TelemetryService {
|
|
|
27211
27430
|
return enriched;
|
|
27212
27431
|
}
|
|
27213
27432
|
generateId() {
|
|
27214
|
-
|
|
27433
|
+
const bytes = new Uint8Array(8);
|
|
27434
|
+
let hex = "";
|
|
27435
|
+
do {
|
|
27436
|
+
crypto.getRandomValues(bytes);
|
|
27437
|
+
hex = "";
|
|
27438
|
+
for (const byte of bytes) {
|
|
27439
|
+
hex += byte.toString(16).padStart(2, "0");
|
|
27440
|
+
}
|
|
27441
|
+
} while (/^0+$/.test(hex));
|
|
27442
|
+
return hex;
|
|
27215
27443
|
}
|
|
27216
27444
|
}
|
|
27217
27445
|
// ../common/src/telemetry/node-appinsights-telemetry-provider.ts
|
|
@@ -27914,152 +28142,25 @@ function buildCommandTelemetryAttribution(commandPath, skillSource) {
|
|
|
27914
28142
|
};
|
|
27915
28143
|
}
|
|
27916
28144
|
|
|
27917
|
-
// ../common/src/telemetry/pii-redactor.ts
|
|
27918
|
-
var REDACTED = "[REDACTED]";
|
|
27919
|
-
var MAX_VALUE_LENGTH = 200;
|
|
27920
|
-
var SENSITIVE_NAME_TOKENS = new Set([
|
|
27921
|
-
"token",
|
|
27922
|
-
"tokens",
|
|
27923
|
-
"secret",
|
|
27924
|
-
"secrets",
|
|
27925
|
-
"password",
|
|
27926
|
-
"passwords",
|
|
27927
|
-
"pwd",
|
|
27928
|
-
"credential",
|
|
27929
|
-
"credentials",
|
|
27930
|
-
"auth",
|
|
27931
|
-
"authentication",
|
|
27932
|
-
"authorization",
|
|
27933
|
-
"authority",
|
|
27934
|
-
"cert",
|
|
27935
|
-
"certificate",
|
|
27936
|
-
"certificates"
|
|
27937
|
-
]);
|
|
27938
|
-
var SENSITIVE_KEY_PREFIXES = new Set([
|
|
27939
|
-
"api",
|
|
27940
|
-
"access",
|
|
27941
|
-
"client",
|
|
27942
|
-
"private",
|
|
27943
|
-
"public",
|
|
27944
|
-
"signing",
|
|
27945
|
-
"encryption",
|
|
27946
|
-
"session",
|
|
27947
|
-
"master",
|
|
27948
|
-
"shared",
|
|
27949
|
-
"root",
|
|
27950
|
-
"ssh",
|
|
27951
|
-
"rsa",
|
|
27952
|
-
"aes",
|
|
27953
|
-
"hmac",
|
|
27954
|
-
"oauth"
|
|
27955
|
-
]);
|
|
27956
|
-
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;
|
|
27957
|
-
var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
27958
|
-
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
27959
|
-
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
27960
|
-
var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
|
|
27961
|
-
var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
|
|
27962
|
-
var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
|
|
27963
|
-
function shortHash(input) {
|
|
27964
|
-
let hash = 2166136261;
|
|
27965
|
-
for (let i = 0;i < input.length; i++) {
|
|
27966
|
-
hash ^= input.charCodeAt(i);
|
|
27967
|
-
hash = Math.imul(hash, 16777619);
|
|
27968
|
-
}
|
|
27969
|
-
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
27970
|
-
}
|
|
27971
|
-
function redactUrl(raw) {
|
|
27972
|
-
try {
|
|
27973
|
-
const url = new URL(raw);
|
|
27974
|
-
return `${url.protocol}//${url.host}`;
|
|
27975
|
-
} catch {
|
|
27976
|
-
return `url#${shortHash(raw)}`;
|
|
27977
|
-
}
|
|
27978
|
-
}
|
|
27979
|
-
function redactValueDetectors(value) {
|
|
27980
|
-
let out = value;
|
|
27981
|
-
out = out.replace(JWT_PATTERN, () => REDACTED);
|
|
27982
|
-
out = out.replace(URL_PATTERN, (match) => {
|
|
27983
|
-
const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
|
|
27984
|
-
const core2 = trailing ? match.slice(0, -trailing.length) : match;
|
|
27985
|
-
return `${redactUrl(core2)}${trailing}`;
|
|
27986
|
-
});
|
|
27987
|
-
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
27988
|
-
out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
|
|
27989
|
-
out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
|
|
27990
|
-
out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
|
|
27991
|
-
if (out.length > MAX_VALUE_LENGTH) {
|
|
27992
|
-
out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
|
|
27993
|
-
}
|
|
27994
|
-
return out;
|
|
27995
|
-
}
|
|
27996
|
-
function nameTokens(name) {
|
|
27997
|
-
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);
|
|
27998
|
-
}
|
|
27999
|
-
function isSensitiveName(name) {
|
|
28000
|
-
const tokens = nameTokens(name);
|
|
28001
|
-
for (let i = 0;i < tokens.length; i++) {
|
|
28002
|
-
const token = tokens[i];
|
|
28003
|
-
if (SENSITIVE_NAME_TOKENS.has(token)) {
|
|
28004
|
-
return true;
|
|
28005
|
-
}
|
|
28006
|
-
if (token === "key" || token === "keys") {
|
|
28007
|
-
const prev = tokens[i - 1];
|
|
28008
|
-
if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
|
|
28009
|
-
return true;
|
|
28010
|
-
}
|
|
28011
|
-
}
|
|
28012
|
-
}
|
|
28013
|
-
return false;
|
|
28014
|
-
}
|
|
28015
|
-
function redactProperty(name, value) {
|
|
28016
|
-
if (value === undefined || value === null) {
|
|
28017
|
-
return;
|
|
28018
|
-
}
|
|
28019
|
-
if (isSensitiveName(name)) {
|
|
28020
|
-
return REDACTED;
|
|
28021
|
-
}
|
|
28022
|
-
if (typeof value === "boolean" || typeof value === "number") {
|
|
28023
|
-
return value;
|
|
28024
|
-
}
|
|
28025
|
-
if (typeof value !== "string") {
|
|
28026
|
-
return "[OBJECT]";
|
|
28027
|
-
}
|
|
28028
|
-
return redactValueDetectors(value);
|
|
28029
|
-
}
|
|
28030
|
-
function redactProperties(properties) {
|
|
28031
|
-
const out = {};
|
|
28032
|
-
for (const [name, value] of Object.entries(properties)) {
|
|
28033
|
-
const redacted = redactProperty(name, value);
|
|
28034
|
-
if (redacted !== undefined) {
|
|
28035
|
-
out[name] = redacted;
|
|
28036
|
-
}
|
|
28037
|
-
}
|
|
28038
|
-
return out;
|
|
28039
|
-
}
|
|
28040
|
-
|
|
28041
28145
|
// ../common/src/trackedAction.ts
|
|
28042
28146
|
var pollSignalSlot = singleton("PollSignal");
|
|
28043
28147
|
var cliErrorCodeValues = new Set(CLI_ERROR_CODES);
|
|
28044
28148
|
var retryHintValues = new Set(RETRY_HINTS);
|
|
28149
|
+
var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
|
|
28045
28150
|
function extractCommandParams(cmd) {
|
|
28046
28151
|
const params = {};
|
|
28152
|
+
const add2 = (name, value) => {
|
|
28153
|
+
if (name && value !== undefined) {
|
|
28154
|
+
params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = value;
|
|
28155
|
+
}
|
|
28156
|
+
};
|
|
28047
28157
|
const registered = cmd.registeredArguments ?? [];
|
|
28048
28158
|
const processed = cmd.processedArgs ?? [];
|
|
28049
28159
|
for (let i = 0;i < registered.length; i++) {
|
|
28050
|
-
|
|
28051
|
-
if (value === undefined) {
|
|
28052
|
-
continue;
|
|
28053
|
-
}
|
|
28054
|
-
const name = registered[i].name();
|
|
28055
|
-
if (name) {
|
|
28056
|
-
params[name] = value;
|
|
28057
|
-
}
|
|
28160
|
+
add2(registered[i].name(), processed[i]);
|
|
28058
28161
|
}
|
|
28059
28162
|
for (const [key, value] of Object.entries(cmd.opts())) {
|
|
28060
|
-
|
|
28061
|
-
params[key] = value;
|
|
28062
|
-
}
|
|
28163
|
+
add2(key, value);
|
|
28063
28164
|
}
|
|
28064
28165
|
return params;
|
|
28065
28166
|
}
|
|
@@ -28102,11 +28203,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
28102
28203
|
return this.action(async (...args) => {
|
|
28103
28204
|
const telemetryName = deriveCommandPath(command);
|
|
28104
28205
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
28206
|
+
const requestContext = telemetry.createRequestContext();
|
|
28105
28207
|
const startTime = performance.now();
|
|
28106
28208
|
let errorMessage;
|
|
28107
28209
|
let fallbackExitCode = EXIT_CODES.Success;
|
|
28108
28210
|
clearRecordedCommandFailureTelemetry();
|
|
28109
|
-
const [error] = await catchError(fn(...args));
|
|
28211
|
+
const [error] = await catchError(telemetry.runWithContext(requestContext, () => fn(...args)));
|
|
28110
28212
|
if (error) {
|
|
28111
28213
|
errorMessage = error instanceof Error ? error.message : String(error);
|
|
28112
28214
|
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
@@ -28142,16 +28244,21 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
28142
28244
|
recordedFailure,
|
|
28143
28245
|
pollSignal: context.pollSignal
|
|
28144
28246
|
});
|
|
28145
|
-
|
|
28146
|
-
|
|
28247
|
+
const commandParams = extractCommandParams(command);
|
|
28248
|
+
if (props) {
|
|
28249
|
+
for (const key of Object.keys(props)) {
|
|
28250
|
+
delete commandParams[`${TELEMETRY_COMMAND_ARG_PREFIX}${key}`];
|
|
28251
|
+
}
|
|
28252
|
+
}
|
|
28253
|
+
const baseProperties = redactProperties({
|
|
28254
|
+
...commandParams,
|
|
28147
28255
|
...props,
|
|
28148
28256
|
...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
|
|
28149
28257
|
command: "true",
|
|
28150
|
-
duration: String(durationMs),
|
|
28151
|
-
success: String(success),
|
|
28152
28258
|
...terminalTelemetry,
|
|
28153
28259
|
...errorMessage ? { errorMessage } : {}
|
|
28154
|
-
})
|
|
28260
|
+
});
|
|
28261
|
+
telemetry.trackRequestResult(telemetryName, durationMs, success, baseProperties, requestContext);
|
|
28155
28262
|
});
|
|
28156
28263
|
};
|
|
28157
28264
|
// ../common/src/console-guard.ts
|
|
@@ -29777,4 +29884,4 @@ export {
|
|
|
29777
29884
|
codedagentInitAsync
|
|
29778
29885
|
};
|
|
29779
29886
|
|
|
29780
|
-
//# debugId=
|
|
29887
|
+
//# debugId=913912A00D26106764756E2164756E21
|
package/dist/tool.js
CHANGED
|
@@ -27104,11 +27104,36 @@ class NodeContextStorage {
|
|
|
27104
27104
|
return this.storage.getStore();
|
|
27105
27105
|
}
|
|
27106
27106
|
}
|
|
27107
|
+
// ../common/src/telemetry/trace-context.ts
|
|
27108
|
+
var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
|
|
27109
|
+
var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
27110
|
+
function getProcessEnv() {
|
|
27111
|
+
return globalThis.process?.env;
|
|
27112
|
+
}
|
|
27113
|
+
function parseInboundTraceparent(value) {
|
|
27114
|
+
if (!value) {
|
|
27115
|
+
return;
|
|
27116
|
+
}
|
|
27117
|
+
const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
|
|
27118
|
+
if (!match) {
|
|
27119
|
+
return;
|
|
27120
|
+
}
|
|
27121
|
+
const [, traceId, parentSpanId] = match;
|
|
27122
|
+
if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
|
|
27123
|
+
return;
|
|
27124
|
+
}
|
|
27125
|
+
return { traceId, parentSpanId };
|
|
27126
|
+
}
|
|
27127
|
+
function getInboundTraceContext() {
|
|
27128
|
+
return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
|
|
27129
|
+
}
|
|
27130
|
+
|
|
27107
27131
|
// ../common/src/telemetry/session-id.ts
|
|
27108
27132
|
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
27109
27133
|
var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
|
|
27110
27134
|
var telemetrySessionIdSlot = singleton("TelemetrySessionId");
|
|
27111
|
-
|
|
27135
|
+
var telemetryOperationIdSlot = singleton("TelemetryOperationId");
|
|
27136
|
+
function getProcessEnv2() {
|
|
27112
27137
|
return globalThis.process?.env;
|
|
27113
27138
|
}
|
|
27114
27139
|
function normalizeSessionId(value) {
|
|
@@ -27119,18 +27144,165 @@ function normalizeSessionId(value) {
|
|
|
27119
27144
|
return trimmed || undefined;
|
|
27120
27145
|
}
|
|
27121
27146
|
function getConfiguredTelemetrySessionId() {
|
|
27122
|
-
return normalizeSessionId(
|
|
27147
|
+
return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
|
|
27123
27148
|
}
|
|
27124
27149
|
function resolveTelemetrySessionId(existingSessionId) {
|
|
27125
27150
|
return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
|
|
27126
27151
|
}
|
|
27152
|
+
function getTelemetryOperationId() {
|
|
27153
|
+
const existing = telemetryOperationIdSlot.get();
|
|
27154
|
+
if (existing) {
|
|
27155
|
+
return existing;
|
|
27156
|
+
}
|
|
27157
|
+
const inboundTraceId = getInboundTraceContext()?.traceId;
|
|
27158
|
+
const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
|
|
27159
|
+
telemetryOperationIdSlot.set(generated);
|
|
27160
|
+
return generated;
|
|
27161
|
+
}
|
|
27127
27162
|
// ../common/src/telemetry/global-telemetry-properties.ts
|
|
27128
27163
|
var telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
27129
27164
|
function getGlobalTelemetryProperties() {
|
|
27130
27165
|
return telemetryPropsSlot.get();
|
|
27131
27166
|
}
|
|
27132
27167
|
|
|
27168
|
+
// ../common/src/telemetry/pii-redactor.ts
|
|
27169
|
+
var REDACTED = "[REDACTED]";
|
|
27170
|
+
var MAX_VALUE_LENGTH = 200;
|
|
27171
|
+
var SENSITIVE_NAME_TOKENS = new Set([
|
|
27172
|
+
"token",
|
|
27173
|
+
"tokens",
|
|
27174
|
+
"secret",
|
|
27175
|
+
"secrets",
|
|
27176
|
+
"password",
|
|
27177
|
+
"passwords",
|
|
27178
|
+
"pwd",
|
|
27179
|
+
"credential",
|
|
27180
|
+
"credentials",
|
|
27181
|
+
"auth",
|
|
27182
|
+
"authentication",
|
|
27183
|
+
"authorization",
|
|
27184
|
+
"authority",
|
|
27185
|
+
"cert",
|
|
27186
|
+
"certificate",
|
|
27187
|
+
"certificates"
|
|
27188
|
+
]);
|
|
27189
|
+
var SENSITIVE_KEY_PREFIXES = new Set([
|
|
27190
|
+
"api",
|
|
27191
|
+
"access",
|
|
27192
|
+
"client",
|
|
27193
|
+
"private",
|
|
27194
|
+
"public",
|
|
27195
|
+
"signing",
|
|
27196
|
+
"encryption",
|
|
27197
|
+
"session",
|
|
27198
|
+
"master",
|
|
27199
|
+
"shared",
|
|
27200
|
+
"root",
|
|
27201
|
+
"ssh",
|
|
27202
|
+
"rsa",
|
|
27203
|
+
"aes",
|
|
27204
|
+
"hmac",
|
|
27205
|
+
"oauth"
|
|
27206
|
+
]);
|
|
27207
|
+
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;
|
|
27208
|
+
var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
27209
|
+
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
27210
|
+
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
27211
|
+
var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
|
|
27212
|
+
var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
|
|
27213
|
+
var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
|
|
27214
|
+
function shortHash(input) {
|
|
27215
|
+
let hash = 2166136261;
|
|
27216
|
+
for (let i = 0;i < input.length; i++) {
|
|
27217
|
+
hash ^= input.charCodeAt(i);
|
|
27218
|
+
hash = Math.imul(hash, 16777619);
|
|
27219
|
+
}
|
|
27220
|
+
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
27221
|
+
}
|
|
27222
|
+
function redactUrl(raw) {
|
|
27223
|
+
try {
|
|
27224
|
+
const url = new URL(raw);
|
|
27225
|
+
return `${url.protocol}//${url.host}`;
|
|
27226
|
+
} catch {
|
|
27227
|
+
return `url#${shortHash(raw)}`;
|
|
27228
|
+
}
|
|
27229
|
+
}
|
|
27230
|
+
function redactValueDetectors(value) {
|
|
27231
|
+
let out = value;
|
|
27232
|
+
out = out.replace(JWT_PATTERN, () => REDACTED);
|
|
27233
|
+
out = out.replace(URL_PATTERN, (match) => {
|
|
27234
|
+
const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
|
|
27235
|
+
const core2 = trailing ? match.slice(0, -trailing.length) : match;
|
|
27236
|
+
return `${redactUrl(core2)}${trailing}`;
|
|
27237
|
+
});
|
|
27238
|
+
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
27239
|
+
out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
|
|
27240
|
+
out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
|
|
27241
|
+
out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
|
|
27242
|
+
if (out.length > MAX_VALUE_LENGTH) {
|
|
27243
|
+
out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
|
|
27244
|
+
}
|
|
27245
|
+
return out;
|
|
27246
|
+
}
|
|
27247
|
+
function redactValue(value) {
|
|
27248
|
+
return redactValueDetectors(value);
|
|
27249
|
+
}
|
|
27250
|
+
function redactError(error) {
|
|
27251
|
+
const safe = new Error(redactValueDetectors(error.message ?? ""));
|
|
27252
|
+
safe.name = error.name;
|
|
27253
|
+
safe.stack = typeof error.stack === "string" ? redactValueDetectors(error.stack) : undefined;
|
|
27254
|
+
return safe;
|
|
27255
|
+
}
|
|
27256
|
+
function nameTokens(name) {
|
|
27257
|
+
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);
|
|
27258
|
+
}
|
|
27259
|
+
function isSensitiveName(name) {
|
|
27260
|
+
const tokens = nameTokens(name);
|
|
27261
|
+
for (let i = 0;i < tokens.length; i++) {
|
|
27262
|
+
const token = tokens[i];
|
|
27263
|
+
if (SENSITIVE_NAME_TOKENS.has(token)) {
|
|
27264
|
+
return true;
|
|
27265
|
+
}
|
|
27266
|
+
if (token === "key" || token === "keys") {
|
|
27267
|
+
const prev = tokens[i - 1];
|
|
27268
|
+
if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
|
|
27269
|
+
return true;
|
|
27270
|
+
}
|
|
27271
|
+
}
|
|
27272
|
+
}
|
|
27273
|
+
return false;
|
|
27274
|
+
}
|
|
27275
|
+
function redactProperty(name, value) {
|
|
27276
|
+
if (value === undefined || value === null) {
|
|
27277
|
+
return;
|
|
27278
|
+
}
|
|
27279
|
+
if (isSensitiveName(name)) {
|
|
27280
|
+
return REDACTED;
|
|
27281
|
+
}
|
|
27282
|
+
if (typeof value === "boolean" || typeof value === "number") {
|
|
27283
|
+
return value;
|
|
27284
|
+
}
|
|
27285
|
+
if (typeof value !== "string") {
|
|
27286
|
+
return "[OBJECT]";
|
|
27287
|
+
}
|
|
27288
|
+
return redactValueDetectors(value);
|
|
27289
|
+
}
|
|
27290
|
+
function redactProperties(properties) {
|
|
27291
|
+
const out = {};
|
|
27292
|
+
for (const [name, value] of Object.entries(properties)) {
|
|
27293
|
+
const redacted = redactProperty(name, value);
|
|
27294
|
+
if (redacted !== undefined) {
|
|
27295
|
+
out[name] = redacted;
|
|
27296
|
+
}
|
|
27297
|
+
}
|
|
27298
|
+
return out;
|
|
27299
|
+
}
|
|
27300
|
+
|
|
27133
27301
|
// ../common/src/telemetry/telemetry-service.ts
|
|
27302
|
+
var TELEMETRY_OPERATION_ID_PROPERTY = "uip.trace.operation_id";
|
|
27303
|
+
var TELEMETRY_PARENT_ID_PROPERTY = "uip.trace.parent_id";
|
|
27304
|
+
var TELEMETRY_SPAN_ID_PROPERTY = "uip.trace.span_id";
|
|
27305
|
+
|
|
27134
27306
|
class TelemetryService {
|
|
27135
27307
|
telemetryProvider;
|
|
27136
27308
|
contextStorage;
|
|
@@ -27157,11 +27329,15 @@ class TelemetryService {
|
|
|
27157
27329
|
trackException(error, properties) {
|
|
27158
27330
|
const context = this.getCurrentContext();
|
|
27159
27331
|
const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
|
|
27160
|
-
this.telemetryProvider.trackException(error, enrichedProperties);
|
|
27332
|
+
this.telemetryProvider.trackException(redactError(error), enrichedProperties);
|
|
27161
27333
|
}
|
|
27162
27334
|
async trackRequest(name, fn, properties) {
|
|
27335
|
+
const parentContext = this.getCurrentContext();
|
|
27336
|
+
const operationId = parentContext?.operationId ?? this.operationId ?? getTelemetryOperationId();
|
|
27337
|
+
const parentId = parentContext ? parentContext.id : this.inboundParentIdFor(operationId);
|
|
27163
27338
|
const context = {
|
|
27164
|
-
operationId
|
|
27339
|
+
operationId,
|
|
27340
|
+
...parentId !== undefined ? { parentId } : {},
|
|
27165
27341
|
id: this.generateId()
|
|
27166
27342
|
};
|
|
27167
27343
|
const startTime = performance.now();
|
|
@@ -27179,6 +27355,45 @@ class TelemetryService {
|
|
|
27179
27355
|
throw error;
|
|
27180
27356
|
}
|
|
27181
27357
|
}
|
|
27358
|
+
trackRequestResult(name, durationMs, success, properties, context) {
|
|
27359
|
+
const requestContext = context ?? {
|
|
27360
|
+
operationId: this.operationId ?? getTelemetryOperationId(),
|
|
27361
|
+
id: this.generateId()
|
|
27362
|
+
};
|
|
27363
|
+
const enrichedProperties = this.enrichPropertiesWithContext(properties, requestContext);
|
|
27364
|
+
this.telemetryProvider.trackRequest(name, durationMs, success, enrichedProperties);
|
|
27365
|
+
}
|
|
27366
|
+
createRequestContext() {
|
|
27367
|
+
const operationId = this.operationId ?? getTelemetryOperationId();
|
|
27368
|
+
const parentId = this.inboundParentIdFor(operationId);
|
|
27369
|
+
return {
|
|
27370
|
+
operationId,
|
|
27371
|
+
...parentId !== undefined ? { parentId } : {},
|
|
27372
|
+
id: this.generateId()
|
|
27373
|
+
};
|
|
27374
|
+
}
|
|
27375
|
+
inboundParentIdFor(operationId) {
|
|
27376
|
+
const inbound = getInboundTraceContext();
|
|
27377
|
+
return inbound && inbound.traceId === operationId ? inbound.parentSpanId : undefined;
|
|
27378
|
+
}
|
|
27379
|
+
runWithContext(context, fn) {
|
|
27380
|
+
return this.contextStorage.run(context, fn);
|
|
27381
|
+
}
|
|
27382
|
+
createDependencyContext() {
|
|
27383
|
+
const parentContext = this.getCurrentContext();
|
|
27384
|
+
if (!parentContext) {
|
|
27385
|
+
return;
|
|
27386
|
+
}
|
|
27387
|
+
return {
|
|
27388
|
+
operationId: parentContext.operationId,
|
|
27389
|
+
parentId: parentContext.id,
|
|
27390
|
+
id: this.generateId()
|
|
27391
|
+
};
|
|
27392
|
+
}
|
|
27393
|
+
trackDependencyResult(name, type2, durationMs, success, properties, context, resultCode) {
|
|
27394
|
+
const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
|
|
27395
|
+
this.telemetryProvider.trackDependency(redactValue(name), type2, durationMs, success, enrichedProperties, resultCode);
|
|
27396
|
+
}
|
|
27182
27397
|
async trackDependencyOperation(name, type2, fn, properties) {
|
|
27183
27398
|
const parentContext = this.getCurrentContext();
|
|
27184
27399
|
if (!parentContext) {
|
|
@@ -27215,8 +27430,12 @@ class TelemetryService {
|
|
|
27215
27430
|
...getExecutionContextTelemetryProperties(),
|
|
27216
27431
|
...globalProperties,
|
|
27217
27432
|
...this.defaultProperties,
|
|
27218
|
-
...properties,
|
|
27219
|
-
...context
|
|
27433
|
+
...redactProperties(properties ?? {}),
|
|
27434
|
+
...context ? {
|
|
27435
|
+
[TELEMETRY_OPERATION_ID_PROPERTY]: context.operationId,
|
|
27436
|
+
...context.parentId !== undefined ? { [TELEMETRY_PARENT_ID_PROPERTY]: context.parentId } : {},
|
|
27437
|
+
[TELEMETRY_SPAN_ID_PROPERTY]: context.id
|
|
27438
|
+
} : {}
|
|
27220
27439
|
};
|
|
27221
27440
|
if (sessionId === undefined) {
|
|
27222
27441
|
delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
|
|
@@ -27226,7 +27445,16 @@ class TelemetryService {
|
|
|
27226
27445
|
return enriched;
|
|
27227
27446
|
}
|
|
27228
27447
|
generateId() {
|
|
27229
|
-
|
|
27448
|
+
const bytes = new Uint8Array(8);
|
|
27449
|
+
let hex = "";
|
|
27450
|
+
do {
|
|
27451
|
+
crypto.getRandomValues(bytes);
|
|
27452
|
+
hex = "";
|
|
27453
|
+
for (const byte of bytes) {
|
|
27454
|
+
hex += byte.toString(16).padStart(2, "0");
|
|
27455
|
+
}
|
|
27456
|
+
} while (/^0+$/.test(hex));
|
|
27457
|
+
return hex;
|
|
27230
27458
|
}
|
|
27231
27459
|
}
|
|
27232
27460
|
// ../common/src/telemetry/node-appinsights-telemetry-provider.ts
|
|
@@ -27929,134 +28157,11 @@ function buildCommandTelemetryAttribution(commandPath, skillSource) {
|
|
|
27929
28157
|
};
|
|
27930
28158
|
}
|
|
27931
28159
|
|
|
27932
|
-
// ../common/src/telemetry/pii-redactor.ts
|
|
27933
|
-
var REDACTED = "[REDACTED]";
|
|
27934
|
-
var MAX_VALUE_LENGTH = 200;
|
|
27935
|
-
var SENSITIVE_NAME_TOKENS = new Set([
|
|
27936
|
-
"token",
|
|
27937
|
-
"tokens",
|
|
27938
|
-
"secret",
|
|
27939
|
-
"secrets",
|
|
27940
|
-
"password",
|
|
27941
|
-
"passwords",
|
|
27942
|
-
"pwd",
|
|
27943
|
-
"credential",
|
|
27944
|
-
"credentials",
|
|
27945
|
-
"auth",
|
|
27946
|
-
"authentication",
|
|
27947
|
-
"authorization",
|
|
27948
|
-
"authority",
|
|
27949
|
-
"cert",
|
|
27950
|
-
"certificate",
|
|
27951
|
-
"certificates"
|
|
27952
|
-
]);
|
|
27953
|
-
var SENSITIVE_KEY_PREFIXES = new Set([
|
|
27954
|
-
"api",
|
|
27955
|
-
"access",
|
|
27956
|
-
"client",
|
|
27957
|
-
"private",
|
|
27958
|
-
"public",
|
|
27959
|
-
"signing",
|
|
27960
|
-
"encryption",
|
|
27961
|
-
"session",
|
|
27962
|
-
"master",
|
|
27963
|
-
"shared",
|
|
27964
|
-
"root",
|
|
27965
|
-
"ssh",
|
|
27966
|
-
"rsa",
|
|
27967
|
-
"aes",
|
|
27968
|
-
"hmac",
|
|
27969
|
-
"oauth"
|
|
27970
|
-
]);
|
|
27971
|
-
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;
|
|
27972
|
-
var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
27973
|
-
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
27974
|
-
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
27975
|
-
var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
|
|
27976
|
-
var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
|
|
27977
|
-
var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
|
|
27978
|
-
function shortHash(input) {
|
|
27979
|
-
let hash = 2166136261;
|
|
27980
|
-
for (let i = 0;i < input.length; i++) {
|
|
27981
|
-
hash ^= input.charCodeAt(i);
|
|
27982
|
-
hash = Math.imul(hash, 16777619);
|
|
27983
|
-
}
|
|
27984
|
-
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
27985
|
-
}
|
|
27986
|
-
function redactUrl(raw) {
|
|
27987
|
-
try {
|
|
27988
|
-
const url = new URL(raw);
|
|
27989
|
-
return `${url.protocol}//${url.host}`;
|
|
27990
|
-
} catch {
|
|
27991
|
-
return `url#${shortHash(raw)}`;
|
|
27992
|
-
}
|
|
27993
|
-
}
|
|
27994
|
-
function redactValueDetectors(value) {
|
|
27995
|
-
let out = value;
|
|
27996
|
-
out = out.replace(JWT_PATTERN, () => REDACTED);
|
|
27997
|
-
out = out.replace(URL_PATTERN, (match) => {
|
|
27998
|
-
const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
|
|
27999
|
-
const core2 = trailing ? match.slice(0, -trailing.length) : match;
|
|
28000
|
-
return `${redactUrl(core2)}${trailing}`;
|
|
28001
|
-
});
|
|
28002
|
-
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
28003
|
-
out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
|
|
28004
|
-
out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
|
|
28005
|
-
out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
|
|
28006
|
-
if (out.length > MAX_VALUE_LENGTH) {
|
|
28007
|
-
out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
|
|
28008
|
-
}
|
|
28009
|
-
return out;
|
|
28010
|
-
}
|
|
28011
|
-
function nameTokens(name) {
|
|
28012
|
-
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);
|
|
28013
|
-
}
|
|
28014
|
-
function isSensitiveName(name) {
|
|
28015
|
-
const tokens = nameTokens(name);
|
|
28016
|
-
for (let i = 0;i < tokens.length; i++) {
|
|
28017
|
-
const token = tokens[i];
|
|
28018
|
-
if (SENSITIVE_NAME_TOKENS.has(token)) {
|
|
28019
|
-
return true;
|
|
28020
|
-
}
|
|
28021
|
-
if (token === "key" || token === "keys") {
|
|
28022
|
-
const prev = tokens[i - 1];
|
|
28023
|
-
if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
|
|
28024
|
-
return true;
|
|
28025
|
-
}
|
|
28026
|
-
}
|
|
28027
|
-
}
|
|
28028
|
-
return false;
|
|
28029
|
-
}
|
|
28030
|
-
function redactProperty(name, value) {
|
|
28031
|
-
if (value === undefined || value === null) {
|
|
28032
|
-
return;
|
|
28033
|
-
}
|
|
28034
|
-
if (isSensitiveName(name)) {
|
|
28035
|
-
return REDACTED;
|
|
28036
|
-
}
|
|
28037
|
-
if (typeof value === "boolean" || typeof value === "number") {
|
|
28038
|
-
return value;
|
|
28039
|
-
}
|
|
28040
|
-
if (typeof value !== "string") {
|
|
28041
|
-
return "[OBJECT]";
|
|
28042
|
-
}
|
|
28043
|
-
return redactValueDetectors(value);
|
|
28044
|
-
}
|
|
28045
|
-
function redactProperties(properties) {
|
|
28046
|
-
const out = {};
|
|
28047
|
-
for (const [name, value] of Object.entries(properties)) {
|
|
28048
|
-
const redacted = redactProperty(name, value);
|
|
28049
|
-
if (redacted !== undefined) {
|
|
28050
|
-
out[name] = redacted;
|
|
28051
|
-
}
|
|
28052
|
-
}
|
|
28053
|
-
return out;
|
|
28054
|
-
}
|
|
28055
|
-
|
|
28056
28160
|
// ../common/src/trackedAction.ts
|
|
28057
28161
|
var pollSignalSlot = singleton("PollSignal");
|
|
28058
28162
|
var cliErrorCodeValues = new Set(CLI_ERROR_CODES);
|
|
28059
28163
|
var retryHintValues = new Set(RETRY_HINTS);
|
|
28164
|
+
var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
|
|
28060
28165
|
var processContext = {
|
|
28061
28166
|
exit: (code) => {
|
|
28062
28167
|
process.exitCode = code;
|
|
@@ -28067,22 +28172,18 @@ var processContext = {
|
|
|
28067
28172
|
};
|
|
28068
28173
|
function extractCommandParams(cmd) {
|
|
28069
28174
|
const params = {};
|
|
28175
|
+
const add2 = (name, value) => {
|
|
28176
|
+
if (name && value !== undefined) {
|
|
28177
|
+
params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = value;
|
|
28178
|
+
}
|
|
28179
|
+
};
|
|
28070
28180
|
const registered = cmd.registeredArguments ?? [];
|
|
28071
28181
|
const processed = cmd.processedArgs ?? [];
|
|
28072
28182
|
for (let i = 0;i < registered.length; i++) {
|
|
28073
|
-
|
|
28074
|
-
if (value === undefined) {
|
|
28075
|
-
continue;
|
|
28076
|
-
}
|
|
28077
|
-
const name = registered[i].name();
|
|
28078
|
-
if (name) {
|
|
28079
|
-
params[name] = value;
|
|
28080
|
-
}
|
|
28183
|
+
add2(registered[i].name(), processed[i]);
|
|
28081
28184
|
}
|
|
28082
28185
|
for (const [key, value] of Object.entries(cmd.opts())) {
|
|
28083
|
-
|
|
28084
|
-
params[key] = value;
|
|
28085
|
-
}
|
|
28186
|
+
add2(key, value);
|
|
28086
28187
|
}
|
|
28087
28188
|
return params;
|
|
28088
28189
|
}
|
|
@@ -28125,11 +28226,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
28125
28226
|
return this.action(async (...args) => {
|
|
28126
28227
|
const telemetryName = deriveCommandPath(command);
|
|
28127
28228
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
28229
|
+
const requestContext = telemetry.createRequestContext();
|
|
28128
28230
|
const startTime = performance.now();
|
|
28129
28231
|
let errorMessage;
|
|
28130
28232
|
let fallbackExitCode = EXIT_CODES.Success;
|
|
28131
28233
|
clearRecordedCommandFailureTelemetry();
|
|
28132
|
-
const [error] = await catchError(fn(...args));
|
|
28234
|
+
const [error] = await catchError(telemetry.runWithContext(requestContext, () => fn(...args)));
|
|
28133
28235
|
if (error) {
|
|
28134
28236
|
errorMessage = error instanceof Error ? error.message : String(error);
|
|
28135
28237
|
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
@@ -28165,16 +28267,21 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
28165
28267
|
recordedFailure,
|
|
28166
28268
|
pollSignal: context.pollSignal
|
|
28167
28269
|
});
|
|
28168
|
-
|
|
28169
|
-
|
|
28270
|
+
const commandParams = extractCommandParams(command);
|
|
28271
|
+
if (props) {
|
|
28272
|
+
for (const key of Object.keys(props)) {
|
|
28273
|
+
delete commandParams[`${TELEMETRY_COMMAND_ARG_PREFIX}${key}`];
|
|
28274
|
+
}
|
|
28275
|
+
}
|
|
28276
|
+
const baseProperties = redactProperties({
|
|
28277
|
+
...commandParams,
|
|
28170
28278
|
...props,
|
|
28171
28279
|
...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
|
|
28172
28280
|
command: "true",
|
|
28173
|
-
duration: String(durationMs),
|
|
28174
|
-
success: String(success),
|
|
28175
28281
|
...terminalTelemetry,
|
|
28176
28282
|
...errorMessage ? { errorMessage } : {}
|
|
28177
|
-
})
|
|
28283
|
+
});
|
|
28284
|
+
telemetry.trackRequestResult(telemetryName, durationMs, success, baseProperties, requestContext);
|
|
28178
28285
|
});
|
|
28179
28286
|
};
|
|
28180
28287
|
// ../common/src/console-guard.ts
|
|
@@ -30238,7 +30345,7 @@ Searching for Python installations: ${allowedVersions}`);
|
|
|
30238
30345
|
var package_default = {
|
|
30239
30346
|
name: "@uipath/codedagent-tool",
|
|
30240
30347
|
license: "MIT",
|
|
30241
|
-
version: "1.199.0-preview.
|
|
30348
|
+
version: "1.199.0-preview.97",
|
|
30242
30349
|
description: "Build, run, deploy, and manage AI Agents.",
|
|
30243
30350
|
keywords: [
|
|
30244
30351
|
"cli-tool",
|
|
@@ -51207,4 +51314,4 @@ export {
|
|
|
51207
51314
|
metadata
|
|
51208
51315
|
};
|
|
51209
51316
|
|
|
51210
|
-
//# debugId=
|
|
51317
|
+
//# debugId=DFEA67C5CCA04E4964756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/codedagent-tool",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.199.0-preview.
|
|
4
|
+
"version": "1.199.0-preview.97",
|
|
5
5
|
"description": "Build, run, deploy, and manage AI Agents.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"cli-tool",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"registry": "https://registry.npmjs.org/"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "087ae21e842f27bde5eb0013892c9487bfe60568"
|
|
36
36
|
}
|