@uipath/llmgw-tool 1.197.0-preview.65 → 1.197.0-preview.67
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 +578 -9
- 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.197.0-preview.
|
|
7
|
+
version: "1.197.0-preview.67",
|
|
8
8
|
description: "CLI plugin for UiPath AI Trust Layer Bring-Your-Own LLM connections.",
|
|
9
9
|
private: false,
|
|
10
10
|
repository: {
|
|
@@ -6189,9 +6189,228 @@ function getOutputFilter() {
|
|
|
6189
6189
|
return filterSlot.get();
|
|
6190
6190
|
}
|
|
6191
6191
|
|
|
6192
|
+
// ../../common/src/telemetry/command-terminal.ts
|
|
6193
|
+
var recordedFailureSlot = singleton("CommandTelemetryFailure");
|
|
6194
|
+
var AUTH_ERROR_CODES = new Set([
|
|
6195
|
+
"authentication_required",
|
|
6196
|
+
"permission_denied"
|
|
6197
|
+
]);
|
|
6198
|
+
var VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
|
|
6199
|
+
var NETWORK_HTTP_ERROR_CODES = new Set([
|
|
6200
|
+
"network_error",
|
|
6201
|
+
"rate_limited",
|
|
6202
|
+
"server_error",
|
|
6203
|
+
"not_found",
|
|
6204
|
+
"method_not_allowed"
|
|
6205
|
+
]);
|
|
6206
|
+
var TIMEOUT_ERROR_CODES = new Set(["timeout"]);
|
|
6207
|
+
var NETWORK_OS_ERROR_CODES = new Set([
|
|
6208
|
+
"ECONNREFUSED",
|
|
6209
|
+
"ECONNRESET",
|
|
6210
|
+
"ENOTFOUND",
|
|
6211
|
+
"EAI_AGAIN",
|
|
6212
|
+
"EPIPE",
|
|
6213
|
+
"EHOSTUNREACH",
|
|
6214
|
+
"ENETUNREACH",
|
|
6215
|
+
"EAI_FAIL"
|
|
6216
|
+
]);
|
|
6217
|
+
var TIMEOUT_OS_ERROR_CODES = new Set(["ETIMEDOUT", "ESOCKETTIMEDOUT"]);
|
|
6218
|
+
var TLS_ERROR_CODES2 = new Set([
|
|
6219
|
+
"SELF_SIGNED_CERT_IN_CHAIN",
|
|
6220
|
+
"DEPTH_ZERO_SELF_SIGNED_CERT",
|
|
6221
|
+
"UNABLE_TO_VERIFY_LEAF_SIGNATURE",
|
|
6222
|
+
"UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
|
|
6223
|
+
"UNABLE_TO_GET_ISSUER_CERT",
|
|
6224
|
+
"CERT_HAS_EXPIRED",
|
|
6225
|
+
"CERT_UNTRUSTED",
|
|
6226
|
+
"ERR_TLS_CERT_ALTNAME_INVALID"
|
|
6227
|
+
]);
|
|
6228
|
+
var MISSING_DEPENDENCY_CODES = new Set([
|
|
6229
|
+
"MODULE_NOT_FOUND",
|
|
6230
|
+
"ERR_MODULE_NOT_FOUND"
|
|
6231
|
+
]);
|
|
6232
|
+
var INTERNAL_ERROR_NAMES = new Set([
|
|
6233
|
+
"TypeError",
|
|
6234
|
+
"ReferenceError",
|
|
6235
|
+
"SyntaxError",
|
|
6236
|
+
"RangeError"
|
|
6237
|
+
]);
|
|
6238
|
+
function isRecord(value) {
|
|
6239
|
+
return value !== null && typeof value === "object";
|
|
6240
|
+
}
|
|
6241
|
+
function stringField(value, field) {
|
|
6242
|
+
if (!isRecord(value)) {
|
|
6243
|
+
return;
|
|
6244
|
+
}
|
|
6245
|
+
const raw = value[field];
|
|
6246
|
+
return typeof raw === "string" ? raw : undefined;
|
|
6247
|
+
}
|
|
6248
|
+
function numberField(value, field) {
|
|
6249
|
+
if (!isRecord(value)) {
|
|
6250
|
+
return;
|
|
6251
|
+
}
|
|
6252
|
+
const raw = value[field];
|
|
6253
|
+
return typeof raw === "number" ? raw : undefined;
|
|
6254
|
+
}
|
|
6255
|
+
function findStringInCauseChain(error, field) {
|
|
6256
|
+
let current = error;
|
|
6257
|
+
for (let depth = 0;depth < 5 && current !== null && typeof current === "object"; depth++) {
|
|
6258
|
+
const value = stringField(current, field);
|
|
6259
|
+
if (value) {
|
|
6260
|
+
return value;
|
|
6261
|
+
}
|
|
6262
|
+
current = current.cause;
|
|
6263
|
+
}
|
|
6264
|
+
return;
|
|
6265
|
+
}
|
|
6266
|
+
function findCodeInCauseChain(error) {
|
|
6267
|
+
return findStringInCauseChain(error, "code");
|
|
6268
|
+
}
|
|
6269
|
+
function isSpawnEnoent(error) {
|
|
6270
|
+
const code = findCodeInCauseChain(error);
|
|
6271
|
+
if (code !== "ENOENT") {
|
|
6272
|
+
return false;
|
|
6273
|
+
}
|
|
6274
|
+
const syscall = findStringInCauseChain(error, "syscall");
|
|
6275
|
+
return syscall?.startsWith("spawn") === true;
|
|
6276
|
+
}
|
|
6277
|
+
function isCancellationError(error, exitCode, pollSignal) {
|
|
6278
|
+
if (exitCode === 130) {
|
|
6279
|
+
return true;
|
|
6280
|
+
}
|
|
6281
|
+
if (!isRecord(error)) {
|
|
6282
|
+
return false;
|
|
6283
|
+
}
|
|
6284
|
+
if (numberField(error, "exitCode") === 130) {
|
|
6285
|
+
return true;
|
|
6286
|
+
}
|
|
6287
|
+
const name = stringField(error, "name");
|
|
6288
|
+
if (name === "ExitPromptError") {
|
|
6289
|
+
return true;
|
|
6290
|
+
}
|
|
6291
|
+
if (name === "AbortError" && pollSignal?.aborted) {
|
|
6292
|
+
return true;
|
|
6293
|
+
}
|
|
6294
|
+
const message = stringField(error, "message");
|
|
6295
|
+
return message?.includes("SIGINT") === true;
|
|
6296
|
+
}
|
|
6297
|
+
function terminalSignalFor(input, outcome) {
|
|
6298
|
+
if (input.recordedFailure?.terminalSignal) {
|
|
6299
|
+
return input.recordedFailure.terminalSignal;
|
|
6300
|
+
}
|
|
6301
|
+
const explicit = findStringInCauseChain(input.error, "terminalSignal") ?? findStringInCauseChain(input.error, "signal");
|
|
6302
|
+
if (explicit) {
|
|
6303
|
+
return explicit;
|
|
6304
|
+
}
|
|
6305
|
+
return outcome === "cancelled" ? "SIGINT" : undefined;
|
|
6306
|
+
}
|
|
6307
|
+
function classifyHttpStatus(status) {
|
|
6308
|
+
if (status === 401 || status === 403) {
|
|
6309
|
+
return "auth";
|
|
6310
|
+
}
|
|
6311
|
+
if (status === 400 || status === 409 || status === 422) {
|
|
6312
|
+
return "validation";
|
|
6313
|
+
}
|
|
6314
|
+
if (status === 408) {
|
|
6315
|
+
return "timeout";
|
|
6316
|
+
}
|
|
6317
|
+
return "network_http";
|
|
6318
|
+
}
|
|
6319
|
+
function classifyFromResult(result) {
|
|
6320
|
+
switch (result) {
|
|
6321
|
+
case "AuthenticationError":
|
|
6322
|
+
return "auth";
|
|
6323
|
+
case "ValidationError":
|
|
6324
|
+
return "validation";
|
|
6325
|
+
case "TimeoutError":
|
|
6326
|
+
return "timeout";
|
|
6327
|
+
default:
|
|
6328
|
+
return;
|
|
6329
|
+
}
|
|
6330
|
+
}
|
|
6331
|
+
function classifyFromErrorCode(errorCode) {
|
|
6332
|
+
if (!errorCode) {
|
|
6333
|
+
return;
|
|
6334
|
+
}
|
|
6335
|
+
if (AUTH_ERROR_CODES.has(errorCode)) {
|
|
6336
|
+
return "auth";
|
|
6337
|
+
}
|
|
6338
|
+
if (VALIDATION_ERROR_CODES.has(errorCode)) {
|
|
6339
|
+
return "validation";
|
|
6340
|
+
}
|
|
6341
|
+
if (TIMEOUT_ERROR_CODES.has(errorCode)) {
|
|
6342
|
+
return "timeout";
|
|
6343
|
+
}
|
|
6344
|
+
if (NETWORK_HTTP_ERROR_CODES.has(errorCode)) {
|
|
6345
|
+
return "network_http";
|
|
6346
|
+
}
|
|
6347
|
+
return;
|
|
6348
|
+
}
|
|
6349
|
+
function classifyFromError(error) {
|
|
6350
|
+
const code = findCodeInCauseChain(error);
|
|
6351
|
+
if (code) {
|
|
6352
|
+
if (code.startsWith("commander.")) {
|
|
6353
|
+
return "validation";
|
|
6354
|
+
}
|
|
6355
|
+
if (NETWORK_OS_ERROR_CODES.has(code) || TLS_ERROR_CODES2.has(code)) {
|
|
6356
|
+
return "network_http";
|
|
6357
|
+
}
|
|
6358
|
+
if (TIMEOUT_OS_ERROR_CODES.has(code)) {
|
|
6359
|
+
return "timeout";
|
|
6360
|
+
}
|
|
6361
|
+
if (MISSING_DEPENDENCY_CODES.has(code) || isSpawnEnoent(error)) {
|
|
6362
|
+
return "missing_dependency";
|
|
6363
|
+
}
|
|
6364
|
+
}
|
|
6365
|
+
const message = stringField(error, "message");
|
|
6366
|
+
if (message?.includes("fetch failed") === true) {
|
|
6367
|
+
return "network_http";
|
|
6368
|
+
}
|
|
6369
|
+
const name = stringField(error, "name");
|
|
6370
|
+
if (name && INTERNAL_ERROR_NAMES.has(name)) {
|
|
6371
|
+
return "internal";
|
|
6372
|
+
}
|
|
6373
|
+
return;
|
|
6374
|
+
}
|
|
6375
|
+
function classifyError2(input) {
|
|
6376
|
+
const recorded = input.recordedFailure;
|
|
6377
|
+
if (recorded?.errorClass) {
|
|
6378
|
+
return recorded.errorClass;
|
|
6379
|
+
}
|
|
6380
|
+
const status = recorded?.context?.httpStatus;
|
|
6381
|
+
if (status !== undefined) {
|
|
6382
|
+
return classifyHttpStatus(status);
|
|
6383
|
+
}
|
|
6384
|
+
return classifyFromResult(recorded?.result) ?? classifyFromErrorCode(recorded?.errorCode) ?? classifyFromError(input.error) ?? "unknown";
|
|
6385
|
+
}
|
|
6386
|
+
function recordCommandFailureTelemetry(failure) {
|
|
6387
|
+
recordedFailureSlot.set(failure);
|
|
6388
|
+
}
|
|
6389
|
+
function clearRecordedCommandFailureTelemetry() {
|
|
6390
|
+
recordedFailureSlot.clear();
|
|
6391
|
+
}
|
|
6392
|
+
function takeRecordedCommandFailureTelemetry() {
|
|
6393
|
+
const failure = recordedFailureSlot.get();
|
|
6394
|
+
recordedFailureSlot.clear();
|
|
6395
|
+
return failure;
|
|
6396
|
+
}
|
|
6397
|
+
function buildCommandTerminalTelemetryProperties(input) {
|
|
6398
|
+
const cancelled = isCancellationError(input.error, input.exitCode, input.pollSignal);
|
|
6399
|
+
const outcome = input.recordedFailure?.terminalOutcome ?? (input.exitCode === 0 ? "success" : cancelled ? "cancelled" : "failure");
|
|
6400
|
+
const errorClass = outcome === "success" || outcome === "no_op" ? undefined : outcome === "cancelled" ? "user_cancelled" : classifyError2(input);
|
|
6401
|
+
const terminalSignal = terminalSignalFor(input, outcome);
|
|
6402
|
+
return {
|
|
6403
|
+
exit_code: input.exitCode,
|
|
6404
|
+
terminal_outcome: outcome,
|
|
6405
|
+
...errorClass ? { error_class: errorClass } : {},
|
|
6406
|
+
...terminalSignal ? { terminal_signal: terminalSignal } : {}
|
|
6407
|
+
};
|
|
6408
|
+
}
|
|
6409
|
+
|
|
6192
6410
|
// ../../common/src/telemetry/telemetry-events.ts
|
|
6193
6411
|
var CommonTelemetryEvents = {
|
|
6194
|
-
Error: "uip.error"
|
|
6412
|
+
Error: "uip.error",
|
|
6413
|
+
ShipSucceeded: "ship_succeeded"
|
|
6195
6414
|
};
|
|
6196
6415
|
|
|
6197
6416
|
// ../../common/src/registry.ts
|
|
@@ -6258,6 +6477,136 @@ function formatMessage(category, name, properties) {
|
|
|
6258
6477
|
}
|
|
6259
6478
|
return message;
|
|
6260
6479
|
}
|
|
6480
|
+
// ../../common/src/telemetry/detect-agent.ts
|
|
6481
|
+
var KNOWN_AGENTS = [
|
|
6482
|
+
{ envVar: "CLAUDECODE", value: "1", id: "claude-code" },
|
|
6483
|
+
{ envVar: "CURSOR_AGENT", value: "1", id: "cursor" },
|
|
6484
|
+
{ envVar: "GEMINI_CLI", value: "1", id: "gemini-cli" },
|
|
6485
|
+
{ envVar: "CODEX_THREAD_ID", id: "codex" },
|
|
6486
|
+
{ envVar: "CODEX_SANDBOX", id: "codex" },
|
|
6487
|
+
{ envVar: "AUGMENT_AGENT", value: "1", id: "augment" },
|
|
6488
|
+
{ envVar: "CLINE_ACTIVE", value: "true", id: "cline" }
|
|
6489
|
+
];
|
|
6490
|
+
function detectAgentFromEnv(env) {
|
|
6491
|
+
for (const agent of KNOWN_AGENTS) {
|
|
6492
|
+
const envValue = env[agent.envVar];
|
|
6493
|
+
if (agent.value !== undefined) {
|
|
6494
|
+
if (envValue === agent.value)
|
|
6495
|
+
return agent.id;
|
|
6496
|
+
} else {
|
|
6497
|
+
if (envValue)
|
|
6498
|
+
return agent.id;
|
|
6499
|
+
}
|
|
6500
|
+
}
|
|
6501
|
+
const agentEnv = env.AGENT;
|
|
6502
|
+
if (agentEnv) {
|
|
6503
|
+
if (agentEnv === "1" || agentEnv === "true")
|
|
6504
|
+
return "unknown";
|
|
6505
|
+
if (agentEnv.length <= 32)
|
|
6506
|
+
return agentEnv.toLowerCase();
|
|
6507
|
+
}
|
|
6508
|
+
return;
|
|
6509
|
+
}
|
|
6510
|
+
// ../../common/src/telemetry/environment-info.ts
|
|
6511
|
+
var LOCAL_HOSTS = new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
|
|
6512
|
+
// ../../common/src/telemetry/execution-context.ts
|
|
6513
|
+
var authSignalSlot = singleton("TelemetryExecutionContextAuthSignal");
|
|
6514
|
+
var isTruthy = (value) => value !== undefined && value !== "" && value !== "0" && value.toLowerCase() !== "false";
|
|
6515
|
+
var isEqual = (value, expected) => value?.toLowerCase() === expected;
|
|
6516
|
+
var CI_SIGNATURES = [
|
|
6517
|
+
{
|
|
6518
|
+
provider: "github_actions",
|
|
6519
|
+
matches: (env) => isTruthy(env.GITHUB_ACTIONS),
|
|
6520
|
+
isScheduler: (env) => env.GITHUB_EVENT_NAME === "schedule"
|
|
6521
|
+
},
|
|
6522
|
+
{
|
|
6523
|
+
provider: "azure_devops",
|
|
6524
|
+
matches: (env) => isTruthy(env.TF_BUILD),
|
|
6525
|
+
isScheduler: (env) => isEqual(env.BUILD_REASON, "schedule")
|
|
6526
|
+
},
|
|
6527
|
+
{
|
|
6528
|
+
provider: "gitlab",
|
|
6529
|
+
matches: (env) => isTruthy(env.GITLAB_CI),
|
|
6530
|
+
isScheduler: (env) => env.CI_PIPELINE_SOURCE === "schedule"
|
|
6531
|
+
},
|
|
6532
|
+
{
|
|
6533
|
+
provider: "circleci",
|
|
6534
|
+
matches: (env) => isTruthy(env.CIRCLECI),
|
|
6535
|
+
isScheduler: (env) => env.CIRCLE_PIPELINE_TRIGGER_SOURCE === "scheduled_pipeline"
|
|
6536
|
+
},
|
|
6537
|
+
{
|
|
6538
|
+
provider: "jenkins",
|
|
6539
|
+
matches: (env) => isTruthy(env.JENKINS_URL) || isTruthy(env.JENKINS_HOME)
|
|
6540
|
+
},
|
|
6541
|
+
{
|
|
6542
|
+
provider: "teamcity",
|
|
6543
|
+
matches: (env) => isTruthy(env.TEAMCITY_VERSION)
|
|
6544
|
+
},
|
|
6545
|
+
{
|
|
6546
|
+
provider: "buildkite",
|
|
6547
|
+
matches: (env) => isTruthy(env.BUILDKITE),
|
|
6548
|
+
isScheduler: (env) => env.BUILDKITE_SOURCE === "schedule"
|
|
6549
|
+
},
|
|
6550
|
+
{
|
|
6551
|
+
provider: "bitbucket",
|
|
6552
|
+
matches: (env) => isTruthy(env.BITBUCKET_BUILD_NUMBER)
|
|
6553
|
+
},
|
|
6554
|
+
{
|
|
6555
|
+
provider: "travis",
|
|
6556
|
+
matches: (env) => isTruthy(env.TRAVIS)
|
|
6557
|
+
},
|
|
6558
|
+
{
|
|
6559
|
+
provider: "appveyor",
|
|
6560
|
+
matches: (env) => isTruthy(env.APPVEYOR)
|
|
6561
|
+
},
|
|
6562
|
+
{
|
|
6563
|
+
provider: "generic",
|
|
6564
|
+
matches: (env) => isTruthy(env.CI)
|
|
6565
|
+
}
|
|
6566
|
+
];
|
|
6567
|
+
function currentEnv() {
|
|
6568
|
+
return typeof process === "undefined" ? {} : process.env;
|
|
6569
|
+
}
|
|
6570
|
+
function currentTtyState() {
|
|
6571
|
+
if (typeof process === "undefined")
|
|
6572
|
+
return false;
|
|
6573
|
+
return Boolean(process.stdout?.isTTY || process.stdin?.isTTY || process.stderr?.isTTY);
|
|
6574
|
+
}
|
|
6575
|
+
function detectCi(env) {
|
|
6576
|
+
const signature = CI_SIGNATURES.find((candidate) => candidate.matches(env));
|
|
6577
|
+
if (!signature)
|
|
6578
|
+
return;
|
|
6579
|
+
return {
|
|
6580
|
+
executionContext: signature.isScheduler?.(env) ? "scheduler" : "ci",
|
|
6581
|
+
ciProvider: signature.provider
|
|
6582
|
+
};
|
|
6583
|
+
}
|
|
6584
|
+
function detectExecutionContext(options = {}) {
|
|
6585
|
+
const env = options.env ?? currentEnv();
|
|
6586
|
+
const ci = detectCi(env);
|
|
6587
|
+
if (ci)
|
|
6588
|
+
return ci;
|
|
6589
|
+
const agent = options.agent ?? detectAgentFromEnv(env);
|
|
6590
|
+
if (agent) {
|
|
6591
|
+
return { executionContext: "agent" };
|
|
6592
|
+
}
|
|
6593
|
+
const authSignal = options.authSignal ?? authSignalSlot.get();
|
|
6594
|
+
if (authSignal === "service_account") {
|
|
6595
|
+
return { executionContext: "service_account" };
|
|
6596
|
+
}
|
|
6597
|
+
const isTty = options.isTty ?? currentTtyState();
|
|
6598
|
+
if (isTty) {
|
|
6599
|
+
return { executionContext: "manual" };
|
|
6600
|
+
}
|
|
6601
|
+
return { executionContext: "unknown" };
|
|
6602
|
+
}
|
|
6603
|
+
function getExecutionContextTelemetryProperties() {
|
|
6604
|
+
const detected = detectExecutionContext();
|
|
6605
|
+
return {
|
|
6606
|
+
execution_context: detected.executionContext,
|
|
6607
|
+
...detected.ciProvider ? { ci_provider: detected.ciProvider } : {}
|
|
6608
|
+
};
|
|
6609
|
+
}
|
|
6261
6610
|
// ../../common/src/telemetry/node-context-storage.ts
|
|
6262
6611
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6263
6612
|
|
|
@@ -6270,6 +6619,26 @@ class NodeContextStorage {
|
|
|
6270
6619
|
return this.storage.getStore();
|
|
6271
6620
|
}
|
|
6272
6621
|
}
|
|
6622
|
+
// ../../common/src/telemetry/session-id.ts
|
|
6623
|
+
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
6624
|
+
var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
|
|
6625
|
+
var telemetrySessionIdSlot = singleton("TelemetrySessionId");
|
|
6626
|
+
function getProcessEnv() {
|
|
6627
|
+
return globalThis.process?.env;
|
|
6628
|
+
}
|
|
6629
|
+
function normalizeSessionId(value) {
|
|
6630
|
+
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
|
|
6631
|
+
return;
|
|
6632
|
+
}
|
|
6633
|
+
const trimmed = String(value).trim();
|
|
6634
|
+
return trimmed || undefined;
|
|
6635
|
+
}
|
|
6636
|
+
function getConfiguredTelemetrySessionId() {
|
|
6637
|
+
return normalizeSessionId(getProcessEnv()?.[TELEMETRY_SESSION_ID_ENV]);
|
|
6638
|
+
}
|
|
6639
|
+
function resolveTelemetrySessionId(existingSessionId) {
|
|
6640
|
+
return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
|
|
6641
|
+
}
|
|
6273
6642
|
// ../../common/src/telemetry/global-telemetry-properties.ts
|
|
6274
6643
|
var telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
6275
6644
|
function getGlobalTelemetryProperties() {
|
|
@@ -6354,12 +6723,22 @@ class TelemetryService {
|
|
|
6354
6723
|
return this.contextStorage.getContext();
|
|
6355
6724
|
}
|
|
6356
6725
|
enrichPropertiesWithContext(properties, context) {
|
|
6357
|
-
|
|
6358
|
-
|
|
6726
|
+
const globalProperties = getGlobalTelemetryProperties();
|
|
6727
|
+
const existingSessionId = properties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? this.defaultProperties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? globalProperties?.[TELEMETRY_SESSION_ID_PROPERTY];
|
|
6728
|
+
const sessionId = resolveTelemetrySessionId(existingSessionId);
|
|
6729
|
+
const enriched = {
|
|
6730
|
+
...getExecutionContextTelemetryProperties(),
|
|
6731
|
+
...globalProperties,
|
|
6359
6732
|
...this.defaultProperties,
|
|
6360
6733
|
...properties,
|
|
6361
6734
|
...context
|
|
6362
6735
|
};
|
|
6736
|
+
if (sessionId === undefined) {
|
|
6737
|
+
delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
|
|
6738
|
+
} else {
|
|
6739
|
+
enriched[TELEMETRY_SESSION_ID_PROPERTY] = sessionId;
|
|
6740
|
+
}
|
|
6741
|
+
return enriched;
|
|
6363
6742
|
}
|
|
6364
6743
|
generateId() {
|
|
6365
6744
|
return crypto.randomUUID().replaceAll("-", "");
|
|
@@ -6829,8 +7208,24 @@ var OutputFormatter;
|
|
|
6829
7208
|
data.ErrorCode ??= defaultErrorCodeForFailure(data);
|
|
6830
7209
|
data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
|
|
6831
7210
|
process.exitCode = EXIT_CODES[data.Result] ?? 1;
|
|
6832
|
-
|
|
6833
|
-
|
|
7211
|
+
recordCommandFailureTelemetry({
|
|
7212
|
+
result: data.Result,
|
|
7213
|
+
errorCode: data.ErrorCode,
|
|
7214
|
+
retry: data.Retry,
|
|
7215
|
+
message: data.Message,
|
|
7216
|
+
context: data.Context,
|
|
7217
|
+
exitCode: process.exitCode,
|
|
7218
|
+
errorClass: data.TelemetryErrorClass,
|
|
7219
|
+
terminalOutcome: data.TelemetryTerminalOutcome,
|
|
7220
|
+
terminalSignal: data.TelemetryTerminalSignal
|
|
7221
|
+
});
|
|
7222
|
+
const suppressTelemetry = data.SuppressTelemetry === true;
|
|
7223
|
+
const envelope = { ...data };
|
|
7224
|
+
delete envelope.SuppressTelemetry;
|
|
7225
|
+
delete envelope.TelemetryErrorClass;
|
|
7226
|
+
delete envelope.TelemetryTerminalOutcome;
|
|
7227
|
+
delete envelope.TelemetryTerminalSignal;
|
|
7228
|
+
if (!suppressTelemetry) {
|
|
6834
7229
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
6835
7230
|
result: data.Result,
|
|
6836
7231
|
errorCode: data.ErrorCode,
|
|
@@ -6896,6 +7291,158 @@ var OutputFormatter;
|
|
|
6896
7291
|
// ../../common/src/trackedAction.ts
|
|
6897
7292
|
import { Command as Command2 } from "commander";
|
|
6898
7293
|
|
|
7294
|
+
// ../../common/src/telemetry/command-attribution.ts
|
|
7295
|
+
var LEGACY_SKILL_NAMESPACE = "uipath:";
|
|
7296
|
+
var MAX_SKILL_NAME_LENGTH = 80;
|
|
7297
|
+
var SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
|
|
7298
|
+
function productMode(productArea, mode) {
|
|
7299
|
+
return { product_area: productArea, mode };
|
|
7300
|
+
}
|
|
7301
|
+
function attributionRecord(groups) {
|
|
7302
|
+
const record = {};
|
|
7303
|
+
for (const [productArea, mode, names] of groups) {
|
|
7304
|
+
const attribution = productMode(productArea, mode);
|
|
7305
|
+
for (const name of names) {
|
|
7306
|
+
record[name] = attribution;
|
|
7307
|
+
}
|
|
7308
|
+
}
|
|
7309
|
+
return record;
|
|
7310
|
+
}
|
|
7311
|
+
function commandAttribution(groups) {
|
|
7312
|
+
const entries = [];
|
|
7313
|
+
for (const [productArea, mode, prefixes] of groups) {
|
|
7314
|
+
const attribution = productMode(productArea, mode);
|
|
7315
|
+
for (const prefix of prefixes) {
|
|
7316
|
+
entries.push({ prefix, attribution });
|
|
7317
|
+
}
|
|
7318
|
+
}
|
|
7319
|
+
return entries;
|
|
7320
|
+
}
|
|
7321
|
+
var SKILL_ATTRIBUTION = attributionRecord([
|
|
7322
|
+
["admin", "operate", ["uipath-admin"]],
|
|
7323
|
+
["agents", "build", ["uipath-agents"]],
|
|
7324
|
+
["api-workflow", "build", ["uipath-api-workflow"]],
|
|
7325
|
+
["automation-discovery", "build", ["uipath-automation-discovery"]],
|
|
7326
|
+
["coded-apps", "build", ["uipath-coded-apps"]],
|
|
7327
|
+
["data-fabric", "operate", ["uipath-data-fabric"]],
|
|
7328
|
+
["cli", "troubleshoot", ["uipath-feedback"]],
|
|
7329
|
+
["governance", "operate", ["uipath-governance"]],
|
|
7330
|
+
["action-center", "build", ["uipath-human-in-the-loop"]],
|
|
7331
|
+
["document-understanding", "build", ["uipath-ixp"]],
|
|
7332
|
+
[
|
|
7333
|
+
"maestro",
|
|
7334
|
+
"build",
|
|
7335
|
+
["uipath-maestro-bpmn", "uipath-maestro-case", "uipath-maestro-flow"]
|
|
7336
|
+
],
|
|
7337
|
+
["agenthub", "build", ["uipath-mcp-servers"]],
|
|
7338
|
+
["solution", "build", ["uipath-planner", "uipath-solution"]],
|
|
7339
|
+
["platform", "operate", ["uipath-platform"]],
|
|
7340
|
+
["quality", "troubleshoot", ["uipath-review"]],
|
|
7341
|
+
["rpa", "build", ["uipath-rpa"]],
|
|
7342
|
+
["cli", "operate", ["uipath-skill-catalog"]],
|
|
7343
|
+
["action-center", "operate", ["uipath-tasks"]],
|
|
7344
|
+
["test-manager", "operate", ["uipath-test"]],
|
|
7345
|
+
["platform", "troubleshoot", ["uipath-troubleshoot"]]
|
|
7346
|
+
]);
|
|
7347
|
+
var KNOWN_SKILL_NAMES = new Set(Object.keys(SKILL_ATTRIBUTION));
|
|
7348
|
+
var COMMAND_ATTRIBUTION = commandAttribution([
|
|
7349
|
+
["cli", "troubleshoot", ["uip.feedback"]],
|
|
7350
|
+
["llm-gateway", "operate", ["uip.llm-configuration", "uip.model-hub"]],
|
|
7351
|
+
["context-grounding", "build", ["uip.context-grounding"]],
|
|
7352
|
+
["api-workflow", "build", ["uip.api-workflow"]],
|
|
7353
|
+
["rpa", "build", ["uip.rpa-legacy"]],
|
|
7354
|
+
["conversational", "operate", ["uip.conversational"]],
|
|
7355
|
+
["agents", "build", ["uip.codedagent", "uip.agent"]],
|
|
7356
|
+
["agenthub", "build", ["uip.agenthub"]],
|
|
7357
|
+
["coded-apps", "build", ["uip.codedapp"]],
|
|
7358
|
+
["functions", "build", ["uip.functions"]],
|
|
7359
|
+
["solution", "build", ["uip.solution"]],
|
|
7360
|
+
["maestro", "build", ["uip.maestro", "uip.case", "uip.flow"]],
|
|
7361
|
+
["llm-observability", "troubleshoot", ["uip.traces"]],
|
|
7362
|
+
["platform", "operate", ["uip.platform"]],
|
|
7363
|
+
["admin", "operate", ["uip.admin"]],
|
|
7364
|
+
["automation-ops", "operate", ["uip.aops"]],
|
|
7365
|
+
["documentation", "troubleshoot", ["uip.docsai"]],
|
|
7366
|
+
["governance", "operate", ["uip.gov"]],
|
|
7367
|
+
["insights", "operate", ["uip.insights"]],
|
|
7368
|
+
["document-understanding", "build", ["uip.ixp"]],
|
|
7369
|
+
["process-mining", "operate", ["uip.pm"]],
|
|
7370
|
+
["action-center", "operate", ["uip.tasks"]],
|
|
7371
|
+
["test-manager", "operate", ["uip.tm"]],
|
|
7372
|
+
["vertical-solutions", "build", ["uip.vss"]],
|
|
7373
|
+
["data-fabric", "operate", ["uip.df"]],
|
|
7374
|
+
["integration-service", "build", ["uip.is"]],
|
|
7375
|
+
["orchestrator", "operate", ["uip.or"]],
|
|
7376
|
+
[
|
|
7377
|
+
"cli",
|
|
7378
|
+
"operate",
|
|
7379
|
+
[
|
|
7380
|
+
"uip.login",
|
|
7381
|
+
"uip.logout",
|
|
7382
|
+
"uip.user",
|
|
7383
|
+
"uip.config",
|
|
7384
|
+
"uip.tools",
|
|
7385
|
+
"uip.skills",
|
|
7386
|
+
"uip.completion",
|
|
7387
|
+
"uip.update",
|
|
7388
|
+
"uip.mcp",
|
|
7389
|
+
"uip.track"
|
|
7390
|
+
]
|
|
7391
|
+
]
|
|
7392
|
+
]).sort((a, b) => b.prefix.length - a.prefix.length);
|
|
7393
|
+
function normalizeCommandPath(value) {
|
|
7394
|
+
if (typeof value !== "string") {
|
|
7395
|
+
return;
|
|
7396
|
+
}
|
|
7397
|
+
const trimmed = value.trim().toLowerCase();
|
|
7398
|
+
if (!trimmed) {
|
|
7399
|
+
return;
|
|
7400
|
+
}
|
|
7401
|
+
const tokens = trimmed.includes(" ") ? trimmed.split(/\s+/).filter((token) => token.length > 0).filter((token) => !token.startsWith("-")) : trimmed.split(".").filter((token) => token.length > 0);
|
|
7402
|
+
if (tokens.length === 0) {
|
|
7403
|
+
return;
|
|
7404
|
+
}
|
|
7405
|
+
const commandTokens = tokens[0] === "uip" ? tokens : ["uip", ...tokens];
|
|
7406
|
+
return commandTokens.join(".");
|
|
7407
|
+
}
|
|
7408
|
+
function getCommandProductModeAttribution(commandPath) {
|
|
7409
|
+
const normalized = normalizeCommandPath(commandPath);
|
|
7410
|
+
if (!normalized) {
|
|
7411
|
+
return;
|
|
7412
|
+
}
|
|
7413
|
+
return COMMAND_ATTRIBUTION.find(({ prefix }) => normalized === prefix || normalized.startsWith(`${prefix}.`))?.attribution;
|
|
7414
|
+
}
|
|
7415
|
+
function normalizeSkillNameWithOptions(value, options) {
|
|
7416
|
+
if (typeof value !== "string") {
|
|
7417
|
+
return;
|
|
7418
|
+
}
|
|
7419
|
+
const normalized = value.trim().toLowerCase();
|
|
7420
|
+
if (!normalized) {
|
|
7421
|
+
return;
|
|
7422
|
+
}
|
|
7423
|
+
const hasLegacyNamespace = normalized.startsWith(LEGACY_SKILL_NAMESPACE);
|
|
7424
|
+
if (hasLegacyNamespace && !options.allowLegacyNamespace) {
|
|
7425
|
+
return;
|
|
7426
|
+
}
|
|
7427
|
+
const skillName = hasLegacyNamespace ? normalized.slice(LEGACY_SKILL_NAMESPACE.length) : normalized;
|
|
7428
|
+
if (skillName.length > MAX_SKILL_NAME_LENGTH || !SKILL_NAME_PATTERN.test(skillName) || !KNOWN_SKILL_NAMES.has(skillName)) {
|
|
7429
|
+
return;
|
|
7430
|
+
}
|
|
7431
|
+
return skillName;
|
|
7432
|
+
}
|
|
7433
|
+
function normalizeSkillName(value) {
|
|
7434
|
+
return normalizeSkillNameWithOptions(value, {
|
|
7435
|
+
allowLegacyNamespace: false
|
|
7436
|
+
});
|
|
7437
|
+
}
|
|
7438
|
+
function buildCommandTelemetryAttribution(commandPath, skillSource) {
|
|
7439
|
+
const skillName = normalizeSkillName(skillSource);
|
|
7440
|
+
return {
|
|
7441
|
+
...skillName ? { skill_name: skillName } : {},
|
|
7442
|
+
...getCommandProductModeAttribution(commandPath)
|
|
7443
|
+
};
|
|
7444
|
+
}
|
|
7445
|
+
|
|
6899
7446
|
// ../../common/src/telemetry/pii-redactor.ts
|
|
6900
7447
|
var REDACTED = "[REDACTED]";
|
|
6901
7448
|
var MAX_VALUE_LENGTH = 200;
|
|
@@ -7081,6 +7628,12 @@ function commandHelpHint(commandPath) {
|
|
|
7081
7628
|
const command = commandPath.replace(/\./g, " ");
|
|
7082
7629
|
return `An unexpected error occurred. Run '${command} --help' to verify command syntax, or run with --log-level debug for details.`;
|
|
7083
7630
|
}
|
|
7631
|
+
function isPromptCancellation(error) {
|
|
7632
|
+
return error instanceof Error && error.name === "ExitPromptError";
|
|
7633
|
+
}
|
|
7634
|
+
function exitCodeFromProcess(fallback) {
|
|
7635
|
+
return typeof process.exitCode === "number" ? process.exitCode : fallback;
|
|
7636
|
+
}
|
|
7084
7637
|
Command2.prototype.trackedAction = function(context, fn, properties) {
|
|
7085
7638
|
const command = this;
|
|
7086
7639
|
return this.action(async (...args) => {
|
|
@@ -7088,6 +7641,8 @@ Command2.prototype.trackedAction = function(context, fn, properties) {
|
|
|
7088
7641
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
7089
7642
|
const startTime = performance.now();
|
|
7090
7643
|
let errorMessage;
|
|
7644
|
+
let fallbackExitCode = EXIT_CODES.Success;
|
|
7645
|
+
clearRecordedCommandFailureTelemetry();
|
|
7091
7646
|
const [error] = await catchError(fn(...args));
|
|
7092
7647
|
if (error) {
|
|
7093
7648
|
errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -7102,6 +7657,8 @@ Command2.prototype.trackedAction = function(context, fn, properties) {
|
|
|
7102
7657
|
const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
|
|
7103
7658
|
const typedContext = typed.context ?? typed.Context;
|
|
7104
7659
|
const customContext = isErrorContext(typedContext) ? typedContext : undefined;
|
|
7660
|
+
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
7661
|
+
fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
|
|
7105
7662
|
OutputFormatter.error({
|
|
7106
7663
|
Result: finalResult,
|
|
7107
7664
|
...customErrorCode ? { ErrorCode: customErrorCode } : {},
|
|
@@ -7110,16 +7667,26 @@ Command2.prototype.trackedAction = function(context, fn, properties) {
|
|
|
7110
7667
|
...customRetry ? { Retry: customRetry } : {},
|
|
7111
7668
|
...customContext ? { Context: customContext } : {}
|
|
7112
7669
|
});
|
|
7113
|
-
context.exit(
|
|
7670
|
+
context.exit(fallbackExitCode);
|
|
7114
7671
|
}
|
|
7115
7672
|
const durationMs = performance.now() - startTime;
|
|
7116
|
-
const
|
|
7673
|
+
const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
|
|
7674
|
+
const recordedFailure = takeRecordedCommandFailureTelemetry();
|
|
7675
|
+
const success = !error && exitCode === 0;
|
|
7676
|
+
const terminalTelemetry = buildCommandTerminalTelemetryProperties({
|
|
7677
|
+
error,
|
|
7678
|
+
exitCode,
|
|
7679
|
+
recordedFailure,
|
|
7680
|
+
pollSignal: context.pollSignal
|
|
7681
|
+
});
|
|
7117
7682
|
telemetry.trackEvent(telemetryName, redactProperties({
|
|
7118
7683
|
...extractCommandParams(command),
|
|
7119
7684
|
...props,
|
|
7685
|
+
...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
|
|
7120
7686
|
command: "true",
|
|
7121
7687
|
duration: String(durationMs),
|
|
7122
7688
|
success: String(success),
|
|
7689
|
+
...terminalTelemetry,
|
|
7123
7690
|
...errorMessage ? { errorMessage } : {}
|
|
7124
7691
|
}));
|
|
7125
7692
|
});
|
|
@@ -7192,6 +7759,8 @@ var ScreenLogger;
|
|
|
7192
7759
|
})(ScreenLogger ||= {});
|
|
7193
7760
|
// ../../common/src/sdk-user-agent.ts
|
|
7194
7761
|
var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
|
|
7762
|
+
// ../../common/src/telemetry/ship-succeeded.ts
|
|
7763
|
+
var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
|
|
7195
7764
|
// ../../common/src/tool-provider.ts
|
|
7196
7765
|
var factorySlot = singleton("PackagerFactoryProvider");
|
|
7197
7766
|
// ../llmgw-sdk/dist/index.js
|
|
@@ -28463,4 +29032,4 @@ export {
|
|
|
28463
29032
|
metadata
|
|
28464
29033
|
};
|
|
28465
29034
|
|
|
28466
|
-
//# debugId=
|
|
29035
|
+
//# debugId=73A19CF135F1708B64756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/llmgw-tool",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.197.0-preview.
|
|
4
|
+
"version": "1.197.0-preview.67",
|
|
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": "579e7d41cb100fcb8130eec8ed1c9b5b55feaf0b"
|
|
27
27
|
}
|