@uipath/llmgw-tool 1.198.0-preview.95 → 1.198.0
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/tool.js +257 -150
- package/package.json +2 -2
package/dist/tool.js
CHANGED
|
@@ -4,7 +4,7 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
|
4
4
|
var package_default = {
|
|
5
5
|
name: "@uipath/llmgw-tool",
|
|
6
6
|
license: "MIT",
|
|
7
|
-
version: "1.198.0
|
|
7
|
+
version: "1.198.0",
|
|
8
8
|
description: "CLI plugin for UiPath AI Trust Layer Bring-Your-Own LLM connections.",
|
|
9
9
|
private: false,
|
|
10
10
|
repository: {
|
|
@@ -7004,11 +7004,36 @@ class NodeContextStorage {
|
|
|
7004
7004
|
return this.storage.getStore();
|
|
7005
7005
|
}
|
|
7006
7006
|
}
|
|
7007
|
+
// ../../common/src/telemetry/trace-context.ts
|
|
7008
|
+
var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
|
|
7009
|
+
var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
7010
|
+
function getProcessEnv() {
|
|
7011
|
+
return globalThis.process?.env;
|
|
7012
|
+
}
|
|
7013
|
+
function parseInboundTraceparent(value) {
|
|
7014
|
+
if (!value) {
|
|
7015
|
+
return;
|
|
7016
|
+
}
|
|
7017
|
+
const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
|
|
7018
|
+
if (!match) {
|
|
7019
|
+
return;
|
|
7020
|
+
}
|
|
7021
|
+
const [, traceId, parentSpanId] = match;
|
|
7022
|
+
if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
|
|
7023
|
+
return;
|
|
7024
|
+
}
|
|
7025
|
+
return { traceId, parentSpanId };
|
|
7026
|
+
}
|
|
7027
|
+
function getInboundTraceContext() {
|
|
7028
|
+
return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
|
|
7029
|
+
}
|
|
7030
|
+
|
|
7007
7031
|
// ../../common/src/telemetry/session-id.ts
|
|
7008
7032
|
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
7009
7033
|
var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
|
|
7010
7034
|
var telemetrySessionIdSlot = singleton("TelemetrySessionId");
|
|
7011
|
-
|
|
7035
|
+
var telemetryOperationIdSlot = singleton("TelemetryOperationId");
|
|
7036
|
+
function getProcessEnv2() {
|
|
7012
7037
|
return globalThis.process?.env;
|
|
7013
7038
|
}
|
|
7014
7039
|
function normalizeSessionId(value) {
|
|
@@ -7019,18 +7044,165 @@ function normalizeSessionId(value) {
|
|
|
7019
7044
|
return trimmed || undefined;
|
|
7020
7045
|
}
|
|
7021
7046
|
function getConfiguredTelemetrySessionId() {
|
|
7022
|
-
return normalizeSessionId(
|
|
7047
|
+
return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
|
|
7023
7048
|
}
|
|
7024
7049
|
function resolveTelemetrySessionId(existingSessionId) {
|
|
7025
7050
|
return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
|
|
7026
7051
|
}
|
|
7052
|
+
function getTelemetryOperationId() {
|
|
7053
|
+
const existing = telemetryOperationIdSlot.get();
|
|
7054
|
+
if (existing) {
|
|
7055
|
+
return existing;
|
|
7056
|
+
}
|
|
7057
|
+
const inboundTraceId = getInboundTraceContext()?.traceId;
|
|
7058
|
+
const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
|
|
7059
|
+
telemetryOperationIdSlot.set(generated);
|
|
7060
|
+
return generated;
|
|
7061
|
+
}
|
|
7027
7062
|
// ../../common/src/telemetry/global-telemetry-properties.ts
|
|
7028
7063
|
var telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
7029
7064
|
function getGlobalTelemetryProperties() {
|
|
7030
7065
|
return telemetryPropsSlot.get();
|
|
7031
7066
|
}
|
|
7032
7067
|
|
|
7068
|
+
// ../../common/src/telemetry/pii-redactor.ts
|
|
7069
|
+
var REDACTED = "[REDACTED]";
|
|
7070
|
+
var MAX_VALUE_LENGTH = 200;
|
|
7071
|
+
var SENSITIVE_NAME_TOKENS = new Set([
|
|
7072
|
+
"token",
|
|
7073
|
+
"tokens",
|
|
7074
|
+
"secret",
|
|
7075
|
+
"secrets",
|
|
7076
|
+
"password",
|
|
7077
|
+
"passwords",
|
|
7078
|
+
"pwd",
|
|
7079
|
+
"credential",
|
|
7080
|
+
"credentials",
|
|
7081
|
+
"auth",
|
|
7082
|
+
"authentication",
|
|
7083
|
+
"authorization",
|
|
7084
|
+
"authority",
|
|
7085
|
+
"cert",
|
|
7086
|
+
"certificate",
|
|
7087
|
+
"certificates"
|
|
7088
|
+
]);
|
|
7089
|
+
var SENSITIVE_KEY_PREFIXES = new Set([
|
|
7090
|
+
"api",
|
|
7091
|
+
"access",
|
|
7092
|
+
"client",
|
|
7093
|
+
"private",
|
|
7094
|
+
"public",
|
|
7095
|
+
"signing",
|
|
7096
|
+
"encryption",
|
|
7097
|
+
"session",
|
|
7098
|
+
"master",
|
|
7099
|
+
"shared",
|
|
7100
|
+
"root",
|
|
7101
|
+
"ssh",
|
|
7102
|
+
"rsa",
|
|
7103
|
+
"aes",
|
|
7104
|
+
"hmac",
|
|
7105
|
+
"oauth"
|
|
7106
|
+
]);
|
|
7107
|
+
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;
|
|
7108
|
+
var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
7109
|
+
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
7110
|
+
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
7111
|
+
var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
|
|
7112
|
+
var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
|
|
7113
|
+
var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
|
|
7114
|
+
function shortHash(input) {
|
|
7115
|
+
let hash = 2166136261;
|
|
7116
|
+
for (let i = 0;i < input.length; i++) {
|
|
7117
|
+
hash ^= input.charCodeAt(i);
|
|
7118
|
+
hash = Math.imul(hash, 16777619);
|
|
7119
|
+
}
|
|
7120
|
+
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
7121
|
+
}
|
|
7122
|
+
function redactUrl(raw) {
|
|
7123
|
+
try {
|
|
7124
|
+
const url = new URL(raw);
|
|
7125
|
+
return `${url.protocol}//${url.host}`;
|
|
7126
|
+
} catch {
|
|
7127
|
+
return `url#${shortHash(raw)}`;
|
|
7128
|
+
}
|
|
7129
|
+
}
|
|
7130
|
+
function redactValueDetectors(value) {
|
|
7131
|
+
let out = value;
|
|
7132
|
+
out = out.replace(JWT_PATTERN, () => REDACTED);
|
|
7133
|
+
out = out.replace(URL_PATTERN, (match) => {
|
|
7134
|
+
const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
|
|
7135
|
+
const core2 = trailing ? match.slice(0, -trailing.length) : match;
|
|
7136
|
+
return `${redactUrl(core2)}${trailing}`;
|
|
7137
|
+
});
|
|
7138
|
+
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
7139
|
+
out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
|
|
7140
|
+
out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
|
|
7141
|
+
out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
|
|
7142
|
+
if (out.length > MAX_VALUE_LENGTH) {
|
|
7143
|
+
out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
|
|
7144
|
+
}
|
|
7145
|
+
return out;
|
|
7146
|
+
}
|
|
7147
|
+
function redactValue(value) {
|
|
7148
|
+
return redactValueDetectors(value);
|
|
7149
|
+
}
|
|
7150
|
+
function redactError(error) {
|
|
7151
|
+
const safe = new Error(redactValueDetectors(error.message ?? ""));
|
|
7152
|
+
safe.name = error.name;
|
|
7153
|
+
safe.stack = typeof error.stack === "string" ? redactValueDetectors(error.stack) : undefined;
|
|
7154
|
+
return safe;
|
|
7155
|
+
}
|
|
7156
|
+
function nameTokens(name) {
|
|
7157
|
+
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);
|
|
7158
|
+
}
|
|
7159
|
+
function isSensitiveName(name) {
|
|
7160
|
+
const tokens = nameTokens(name);
|
|
7161
|
+
for (let i = 0;i < tokens.length; i++) {
|
|
7162
|
+
const token = tokens[i];
|
|
7163
|
+
if (SENSITIVE_NAME_TOKENS.has(token)) {
|
|
7164
|
+
return true;
|
|
7165
|
+
}
|
|
7166
|
+
if (token === "key" || token === "keys") {
|
|
7167
|
+
const prev = tokens[i - 1];
|
|
7168
|
+
if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
|
|
7169
|
+
return true;
|
|
7170
|
+
}
|
|
7171
|
+
}
|
|
7172
|
+
}
|
|
7173
|
+
return false;
|
|
7174
|
+
}
|
|
7175
|
+
function redactProperty(name, value) {
|
|
7176
|
+
if (value === undefined || value === null) {
|
|
7177
|
+
return;
|
|
7178
|
+
}
|
|
7179
|
+
if (isSensitiveName(name)) {
|
|
7180
|
+
return REDACTED;
|
|
7181
|
+
}
|
|
7182
|
+
if (typeof value === "boolean" || typeof value === "number") {
|
|
7183
|
+
return value;
|
|
7184
|
+
}
|
|
7185
|
+
if (typeof value !== "string") {
|
|
7186
|
+
return "[OBJECT]";
|
|
7187
|
+
}
|
|
7188
|
+
return redactValueDetectors(value);
|
|
7189
|
+
}
|
|
7190
|
+
function redactProperties(properties) {
|
|
7191
|
+
const out = {};
|
|
7192
|
+
for (const [name, value] of Object.entries(properties)) {
|
|
7193
|
+
const redacted = redactProperty(name, value);
|
|
7194
|
+
if (redacted !== undefined) {
|
|
7195
|
+
out[name] = redacted;
|
|
7196
|
+
}
|
|
7197
|
+
}
|
|
7198
|
+
return out;
|
|
7199
|
+
}
|
|
7200
|
+
|
|
7033
7201
|
// ../../common/src/telemetry/telemetry-service.ts
|
|
7202
|
+
var TELEMETRY_OPERATION_ID_PROPERTY = "uip.trace.operation_id";
|
|
7203
|
+
var TELEMETRY_PARENT_ID_PROPERTY = "uip.trace.parent_id";
|
|
7204
|
+
var TELEMETRY_SPAN_ID_PROPERTY = "uip.trace.span_id";
|
|
7205
|
+
|
|
7034
7206
|
class TelemetryService {
|
|
7035
7207
|
telemetryProvider;
|
|
7036
7208
|
contextStorage;
|
|
@@ -7057,11 +7229,15 @@ class TelemetryService {
|
|
|
7057
7229
|
trackException(error, properties) {
|
|
7058
7230
|
const context = this.getCurrentContext();
|
|
7059
7231
|
const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
|
|
7060
|
-
this.telemetryProvider.trackException(error, enrichedProperties);
|
|
7232
|
+
this.telemetryProvider.trackException(redactError(error), enrichedProperties);
|
|
7061
7233
|
}
|
|
7062
7234
|
async trackRequest(name, fn, properties) {
|
|
7235
|
+
const parentContext = this.getCurrentContext();
|
|
7236
|
+
const operationId = parentContext?.operationId ?? this.operationId ?? getTelemetryOperationId();
|
|
7237
|
+
const parentId = parentContext ? parentContext.id : this.inboundParentIdFor(operationId);
|
|
7063
7238
|
const context = {
|
|
7064
|
-
operationId
|
|
7239
|
+
operationId,
|
|
7240
|
+
...parentId !== undefined ? { parentId } : {},
|
|
7065
7241
|
id: this.generateId()
|
|
7066
7242
|
};
|
|
7067
7243
|
const startTime = performance.now();
|
|
@@ -7079,6 +7255,45 @@ class TelemetryService {
|
|
|
7079
7255
|
throw error;
|
|
7080
7256
|
}
|
|
7081
7257
|
}
|
|
7258
|
+
trackRequestResult(name, durationMs, success, properties, context) {
|
|
7259
|
+
const requestContext = context ?? {
|
|
7260
|
+
operationId: this.operationId ?? getTelemetryOperationId(),
|
|
7261
|
+
id: this.generateId()
|
|
7262
|
+
};
|
|
7263
|
+
const enrichedProperties = this.enrichPropertiesWithContext(properties, requestContext);
|
|
7264
|
+
this.telemetryProvider.trackRequest(name, durationMs, success, enrichedProperties);
|
|
7265
|
+
}
|
|
7266
|
+
createRequestContext() {
|
|
7267
|
+
const operationId = this.operationId ?? getTelemetryOperationId();
|
|
7268
|
+
const parentId = this.inboundParentIdFor(operationId);
|
|
7269
|
+
return {
|
|
7270
|
+
operationId,
|
|
7271
|
+
...parentId !== undefined ? { parentId } : {},
|
|
7272
|
+
id: this.generateId()
|
|
7273
|
+
};
|
|
7274
|
+
}
|
|
7275
|
+
inboundParentIdFor(operationId) {
|
|
7276
|
+
const inbound = getInboundTraceContext();
|
|
7277
|
+
return inbound && inbound.traceId === operationId ? inbound.parentSpanId : undefined;
|
|
7278
|
+
}
|
|
7279
|
+
runWithContext(context, fn) {
|
|
7280
|
+
return this.contextStorage.run(context, fn);
|
|
7281
|
+
}
|
|
7282
|
+
createDependencyContext() {
|
|
7283
|
+
const parentContext = this.getCurrentContext();
|
|
7284
|
+
if (!parentContext) {
|
|
7285
|
+
return;
|
|
7286
|
+
}
|
|
7287
|
+
return {
|
|
7288
|
+
operationId: parentContext.operationId,
|
|
7289
|
+
parentId: parentContext.id,
|
|
7290
|
+
id: this.generateId()
|
|
7291
|
+
};
|
|
7292
|
+
}
|
|
7293
|
+
trackDependencyResult(name, type2, durationMs, success, properties, context, resultCode) {
|
|
7294
|
+
const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
|
|
7295
|
+
this.telemetryProvider.trackDependency(redactValue(name), type2, durationMs, success, enrichedProperties, resultCode);
|
|
7296
|
+
}
|
|
7082
7297
|
async trackDependencyOperation(name, type2, fn, properties) {
|
|
7083
7298
|
const parentContext = this.getCurrentContext();
|
|
7084
7299
|
if (!parentContext) {
|
|
@@ -7115,8 +7330,12 @@ class TelemetryService {
|
|
|
7115
7330
|
...getExecutionContextTelemetryProperties(),
|
|
7116
7331
|
...globalProperties,
|
|
7117
7332
|
...this.defaultProperties,
|
|
7118
|
-
...properties,
|
|
7119
|
-
...context
|
|
7333
|
+
...redactProperties(properties ?? {}),
|
|
7334
|
+
...context ? {
|
|
7335
|
+
[TELEMETRY_OPERATION_ID_PROPERTY]: context.operationId,
|
|
7336
|
+
...context.parentId !== undefined ? { [TELEMETRY_PARENT_ID_PROPERTY]: context.parentId } : {},
|
|
7337
|
+
[TELEMETRY_SPAN_ID_PROPERTY]: context.id
|
|
7338
|
+
} : {}
|
|
7120
7339
|
};
|
|
7121
7340
|
if (sessionId === undefined) {
|
|
7122
7341
|
delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
|
|
@@ -7126,7 +7345,16 @@ class TelemetryService {
|
|
|
7126
7345
|
return enriched;
|
|
7127
7346
|
}
|
|
7128
7347
|
generateId() {
|
|
7129
|
-
|
|
7348
|
+
const bytes = new Uint8Array(8);
|
|
7349
|
+
let hex = "";
|
|
7350
|
+
do {
|
|
7351
|
+
crypto.getRandomValues(bytes);
|
|
7352
|
+
hex = "";
|
|
7353
|
+
for (const byte of bytes) {
|
|
7354
|
+
hex += byte.toString(16).padStart(2, "0");
|
|
7355
|
+
}
|
|
7356
|
+
} while (/^0+$/.test(hex));
|
|
7357
|
+
return hex;
|
|
7130
7358
|
}
|
|
7131
7359
|
}
|
|
7132
7360
|
// ../../common/src/telemetry/node-appinsights-telemetry-provider.ts
|
|
@@ -7831,134 +8059,11 @@ function buildCommandTelemetryAttribution(commandPath, skillSource) {
|
|
|
7831
8059
|
};
|
|
7832
8060
|
}
|
|
7833
8061
|
|
|
7834
|
-
// ../../common/src/telemetry/pii-redactor.ts
|
|
7835
|
-
var REDACTED = "[REDACTED]";
|
|
7836
|
-
var MAX_VALUE_LENGTH = 200;
|
|
7837
|
-
var SENSITIVE_NAME_TOKENS = new Set([
|
|
7838
|
-
"token",
|
|
7839
|
-
"tokens",
|
|
7840
|
-
"secret",
|
|
7841
|
-
"secrets",
|
|
7842
|
-
"password",
|
|
7843
|
-
"passwords",
|
|
7844
|
-
"pwd",
|
|
7845
|
-
"credential",
|
|
7846
|
-
"credentials",
|
|
7847
|
-
"auth",
|
|
7848
|
-
"authentication",
|
|
7849
|
-
"authorization",
|
|
7850
|
-
"authority",
|
|
7851
|
-
"cert",
|
|
7852
|
-
"certificate",
|
|
7853
|
-
"certificates"
|
|
7854
|
-
]);
|
|
7855
|
-
var SENSITIVE_KEY_PREFIXES = new Set([
|
|
7856
|
-
"api",
|
|
7857
|
-
"access",
|
|
7858
|
-
"client",
|
|
7859
|
-
"private",
|
|
7860
|
-
"public",
|
|
7861
|
-
"signing",
|
|
7862
|
-
"encryption",
|
|
7863
|
-
"session",
|
|
7864
|
-
"master",
|
|
7865
|
-
"shared",
|
|
7866
|
-
"root",
|
|
7867
|
-
"ssh",
|
|
7868
|
-
"rsa",
|
|
7869
|
-
"aes",
|
|
7870
|
-
"hmac",
|
|
7871
|
-
"oauth"
|
|
7872
|
-
]);
|
|
7873
|
-
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;
|
|
7874
|
-
var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
7875
|
-
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
7876
|
-
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
7877
|
-
var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
|
|
7878
|
-
var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
|
|
7879
|
-
var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
|
|
7880
|
-
function shortHash(input) {
|
|
7881
|
-
let hash = 2166136261;
|
|
7882
|
-
for (let i = 0;i < input.length; i++) {
|
|
7883
|
-
hash ^= input.charCodeAt(i);
|
|
7884
|
-
hash = Math.imul(hash, 16777619);
|
|
7885
|
-
}
|
|
7886
|
-
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
7887
|
-
}
|
|
7888
|
-
function redactUrl(raw) {
|
|
7889
|
-
try {
|
|
7890
|
-
const url = new URL(raw);
|
|
7891
|
-
return `${url.protocol}//${url.host}`;
|
|
7892
|
-
} catch {
|
|
7893
|
-
return `url#${shortHash(raw)}`;
|
|
7894
|
-
}
|
|
7895
|
-
}
|
|
7896
|
-
function redactValueDetectors(value) {
|
|
7897
|
-
let out = value;
|
|
7898
|
-
out = out.replace(JWT_PATTERN, () => REDACTED);
|
|
7899
|
-
out = out.replace(URL_PATTERN, (match) => {
|
|
7900
|
-
const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
|
|
7901
|
-
const core2 = trailing ? match.slice(0, -trailing.length) : match;
|
|
7902
|
-
return `${redactUrl(core2)}${trailing}`;
|
|
7903
|
-
});
|
|
7904
|
-
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
7905
|
-
out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
|
|
7906
|
-
out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
|
|
7907
|
-
out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
|
|
7908
|
-
if (out.length > MAX_VALUE_LENGTH) {
|
|
7909
|
-
out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
|
|
7910
|
-
}
|
|
7911
|
-
return out;
|
|
7912
|
-
}
|
|
7913
|
-
function nameTokens(name) {
|
|
7914
|
-
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);
|
|
7915
|
-
}
|
|
7916
|
-
function isSensitiveName(name) {
|
|
7917
|
-
const tokens = nameTokens(name);
|
|
7918
|
-
for (let i = 0;i < tokens.length; i++) {
|
|
7919
|
-
const token = tokens[i];
|
|
7920
|
-
if (SENSITIVE_NAME_TOKENS.has(token)) {
|
|
7921
|
-
return true;
|
|
7922
|
-
}
|
|
7923
|
-
if (token === "key" || token === "keys") {
|
|
7924
|
-
const prev = tokens[i - 1];
|
|
7925
|
-
if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
|
|
7926
|
-
return true;
|
|
7927
|
-
}
|
|
7928
|
-
}
|
|
7929
|
-
}
|
|
7930
|
-
return false;
|
|
7931
|
-
}
|
|
7932
|
-
function redactProperty(name, value) {
|
|
7933
|
-
if (value === undefined || value === null) {
|
|
7934
|
-
return;
|
|
7935
|
-
}
|
|
7936
|
-
if (isSensitiveName(name)) {
|
|
7937
|
-
return REDACTED;
|
|
7938
|
-
}
|
|
7939
|
-
if (typeof value === "boolean" || typeof value === "number") {
|
|
7940
|
-
return value;
|
|
7941
|
-
}
|
|
7942
|
-
if (typeof value !== "string") {
|
|
7943
|
-
return "[OBJECT]";
|
|
7944
|
-
}
|
|
7945
|
-
return redactValueDetectors(value);
|
|
7946
|
-
}
|
|
7947
|
-
function redactProperties(properties) {
|
|
7948
|
-
const out = {};
|
|
7949
|
-
for (const [name, value] of Object.entries(properties)) {
|
|
7950
|
-
const redacted = redactProperty(name, value);
|
|
7951
|
-
if (redacted !== undefined) {
|
|
7952
|
-
out[name] = redacted;
|
|
7953
|
-
}
|
|
7954
|
-
}
|
|
7955
|
-
return out;
|
|
7956
|
-
}
|
|
7957
|
-
|
|
7958
8062
|
// ../../common/src/trackedAction.ts
|
|
7959
8063
|
var pollSignalSlot = singleton("PollSignal");
|
|
7960
8064
|
var cliErrorCodeValues = new Set(CLI_ERROR_CODES);
|
|
7961
8065
|
var retryHintValues = new Set(RETRY_HINTS);
|
|
8066
|
+
var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
|
|
7962
8067
|
var processContext = {
|
|
7963
8068
|
exit: (code) => {
|
|
7964
8069
|
process.exitCode = code;
|
|
@@ -7969,22 +8074,18 @@ var processContext = {
|
|
|
7969
8074
|
};
|
|
7970
8075
|
function extractCommandParams(cmd) {
|
|
7971
8076
|
const params = {};
|
|
8077
|
+
const add2 = (name, value) => {
|
|
8078
|
+
if (name && value !== undefined) {
|
|
8079
|
+
params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = value;
|
|
8080
|
+
}
|
|
8081
|
+
};
|
|
7972
8082
|
const registered = cmd.registeredArguments ?? [];
|
|
7973
8083
|
const processed = cmd.processedArgs ?? [];
|
|
7974
8084
|
for (let i = 0;i < registered.length; i++) {
|
|
7975
|
-
|
|
7976
|
-
if (value === undefined) {
|
|
7977
|
-
continue;
|
|
7978
|
-
}
|
|
7979
|
-
const name = registered[i].name();
|
|
7980
|
-
if (name) {
|
|
7981
|
-
params[name] = value;
|
|
7982
|
-
}
|
|
8085
|
+
add2(registered[i].name(), processed[i]);
|
|
7983
8086
|
}
|
|
7984
8087
|
for (const [key, value] of Object.entries(cmd.opts())) {
|
|
7985
|
-
|
|
7986
|
-
params[key] = value;
|
|
7987
|
-
}
|
|
8088
|
+
add2(key, value);
|
|
7988
8089
|
}
|
|
7989
8090
|
return params;
|
|
7990
8091
|
}
|
|
@@ -8027,11 +8128,12 @@ Command2.prototype.trackedAction = function(context, fn, properties) {
|
|
|
8027
8128
|
return this.action(async (...args) => {
|
|
8028
8129
|
const telemetryName = deriveCommandPath(command);
|
|
8029
8130
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
8131
|
+
const requestContext = telemetry.createRequestContext();
|
|
8030
8132
|
const startTime = performance.now();
|
|
8031
8133
|
let errorMessage;
|
|
8032
8134
|
let fallbackExitCode = EXIT_CODES.Success;
|
|
8033
8135
|
clearRecordedCommandFailureTelemetry();
|
|
8034
|
-
const [error] = await catchError(fn(...args));
|
|
8136
|
+
const [error] = await catchError(telemetry.runWithContext(requestContext, () => fn(...args)));
|
|
8035
8137
|
if (error) {
|
|
8036
8138
|
errorMessage = error instanceof Error ? error.message : String(error);
|
|
8037
8139
|
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
@@ -8067,16 +8169,21 @@ Command2.prototype.trackedAction = function(context, fn, properties) {
|
|
|
8067
8169
|
recordedFailure,
|
|
8068
8170
|
pollSignal: context.pollSignal
|
|
8069
8171
|
});
|
|
8070
|
-
|
|
8071
|
-
|
|
8172
|
+
const commandParams = extractCommandParams(command);
|
|
8173
|
+
if (props) {
|
|
8174
|
+
for (const key of Object.keys(props)) {
|
|
8175
|
+
delete commandParams[`${TELEMETRY_COMMAND_ARG_PREFIX}${key}`];
|
|
8176
|
+
}
|
|
8177
|
+
}
|
|
8178
|
+
const baseProperties = redactProperties({
|
|
8179
|
+
...commandParams,
|
|
8072
8180
|
...props,
|
|
8073
8181
|
...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
|
|
8074
8182
|
command: "true",
|
|
8075
|
-
duration: String(durationMs),
|
|
8076
|
-
success: String(success),
|
|
8077
8183
|
...terminalTelemetry,
|
|
8078
8184
|
...errorMessage ? { errorMessage } : {}
|
|
8079
|
-
})
|
|
8185
|
+
});
|
|
8186
|
+
telemetry.trackRequestResult(telemetryName, durationMs, success, baseProperties, requestContext);
|
|
8080
8187
|
});
|
|
8081
8188
|
};
|
|
8082
8189
|
// ../../common/src/console-guard.ts
|
|
@@ -29422,4 +29529,4 @@ export {
|
|
|
29422
29529
|
metadata
|
|
29423
29530
|
};
|
|
29424
29531
|
|
|
29425
|
-
//# debugId=
|
|
29532
|
+
//# debugId=26C349BEBC0C07BC64756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/llmgw-tool",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.198.0
|
|
4
|
+
"version": "1.198.0",
|
|
5
5
|
"description": "CLI plugin for UiPath AI Trust Layer Bring-Your-Own LLM connections.",
|
|
6
6
|
"private": false,
|
|
7
7
|
"repository": {
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"files": [
|
|
24
24
|
"dist"
|
|
25
25
|
],
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "1fadf03d7a8dd102742571dff569fdac11808afb"
|
|
27
27
|
}
|