@uipath/cli 1.197.0-preview.65 → 1.197.0-preview.66
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/index.browser.js +419 -419
- package/dist/index.js +954 -45
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -8216,11 +8216,234 @@ var init_output_format_context = __esm(() => {
|
|
|
8216
8216
|
filterSlot = singleton("OutputFilter");
|
|
8217
8217
|
});
|
|
8218
8218
|
|
|
8219
|
+
// ../common/src/telemetry/command-terminal.ts
|
|
8220
|
+
function isRecord(value) {
|
|
8221
|
+
return value !== null && typeof value === "object";
|
|
8222
|
+
}
|
|
8223
|
+
function stringField(value, field) {
|
|
8224
|
+
if (!isRecord(value)) {
|
|
8225
|
+
return;
|
|
8226
|
+
}
|
|
8227
|
+
const raw = value[field];
|
|
8228
|
+
return typeof raw === "string" ? raw : undefined;
|
|
8229
|
+
}
|
|
8230
|
+
function numberField(value, field) {
|
|
8231
|
+
if (!isRecord(value)) {
|
|
8232
|
+
return;
|
|
8233
|
+
}
|
|
8234
|
+
const raw = value[field];
|
|
8235
|
+
return typeof raw === "number" ? raw : undefined;
|
|
8236
|
+
}
|
|
8237
|
+
function findStringInCauseChain(error, field) {
|
|
8238
|
+
let current = error;
|
|
8239
|
+
for (let depth = 0;depth < 5 && current !== null && typeof current === "object"; depth++) {
|
|
8240
|
+
const value = stringField(current, field);
|
|
8241
|
+
if (value) {
|
|
8242
|
+
return value;
|
|
8243
|
+
}
|
|
8244
|
+
current = current.cause;
|
|
8245
|
+
}
|
|
8246
|
+
return;
|
|
8247
|
+
}
|
|
8248
|
+
function findCodeInCauseChain(error) {
|
|
8249
|
+
return findStringInCauseChain(error, "code");
|
|
8250
|
+
}
|
|
8251
|
+
function isSpawnEnoent(error) {
|
|
8252
|
+
const code = findCodeInCauseChain(error);
|
|
8253
|
+
if (code !== "ENOENT") {
|
|
8254
|
+
return false;
|
|
8255
|
+
}
|
|
8256
|
+
const syscall = findStringInCauseChain(error, "syscall");
|
|
8257
|
+
return syscall?.startsWith("spawn") === true;
|
|
8258
|
+
}
|
|
8259
|
+
function isCancellationError(error, exitCode, pollSignal) {
|
|
8260
|
+
if (exitCode === 130) {
|
|
8261
|
+
return true;
|
|
8262
|
+
}
|
|
8263
|
+
if (!isRecord(error)) {
|
|
8264
|
+
return false;
|
|
8265
|
+
}
|
|
8266
|
+
if (numberField(error, "exitCode") === 130) {
|
|
8267
|
+
return true;
|
|
8268
|
+
}
|
|
8269
|
+
const name = stringField(error, "name");
|
|
8270
|
+
if (name === "ExitPromptError") {
|
|
8271
|
+
return true;
|
|
8272
|
+
}
|
|
8273
|
+
if (name === "AbortError" && pollSignal?.aborted) {
|
|
8274
|
+
return true;
|
|
8275
|
+
}
|
|
8276
|
+
const message = stringField(error, "message");
|
|
8277
|
+
return message?.includes("SIGINT") === true;
|
|
8278
|
+
}
|
|
8279
|
+
function terminalSignalFor(input, outcome) {
|
|
8280
|
+
if (input.recordedFailure?.terminalSignal) {
|
|
8281
|
+
return input.recordedFailure.terminalSignal;
|
|
8282
|
+
}
|
|
8283
|
+
const explicit = findStringInCauseChain(input.error, "terminalSignal") ?? findStringInCauseChain(input.error, "signal");
|
|
8284
|
+
if (explicit) {
|
|
8285
|
+
return explicit;
|
|
8286
|
+
}
|
|
8287
|
+
return outcome === "cancelled" ? "SIGINT" : undefined;
|
|
8288
|
+
}
|
|
8289
|
+
function classifyHttpStatus(status) {
|
|
8290
|
+
if (status === 401 || status === 403) {
|
|
8291
|
+
return "auth";
|
|
8292
|
+
}
|
|
8293
|
+
if (status === 400 || status === 409 || status === 422) {
|
|
8294
|
+
return "validation";
|
|
8295
|
+
}
|
|
8296
|
+
if (status === 408) {
|
|
8297
|
+
return "timeout";
|
|
8298
|
+
}
|
|
8299
|
+
return "network_http";
|
|
8300
|
+
}
|
|
8301
|
+
function classifyFromResult(result) {
|
|
8302
|
+
switch (result) {
|
|
8303
|
+
case "AuthenticationError":
|
|
8304
|
+
return "auth";
|
|
8305
|
+
case "ValidationError":
|
|
8306
|
+
return "validation";
|
|
8307
|
+
case "TimeoutError":
|
|
8308
|
+
return "timeout";
|
|
8309
|
+
default:
|
|
8310
|
+
return;
|
|
8311
|
+
}
|
|
8312
|
+
}
|
|
8313
|
+
function classifyFromErrorCode(errorCode) {
|
|
8314
|
+
if (!errorCode) {
|
|
8315
|
+
return;
|
|
8316
|
+
}
|
|
8317
|
+
if (AUTH_ERROR_CODES.has(errorCode)) {
|
|
8318
|
+
return "auth";
|
|
8319
|
+
}
|
|
8320
|
+
if (VALIDATION_ERROR_CODES.has(errorCode)) {
|
|
8321
|
+
return "validation";
|
|
8322
|
+
}
|
|
8323
|
+
if (TIMEOUT_ERROR_CODES.has(errorCode)) {
|
|
8324
|
+
return "timeout";
|
|
8325
|
+
}
|
|
8326
|
+
if (NETWORK_HTTP_ERROR_CODES.has(errorCode)) {
|
|
8327
|
+
return "network_http";
|
|
8328
|
+
}
|
|
8329
|
+
return;
|
|
8330
|
+
}
|
|
8331
|
+
function classifyFromError(error) {
|
|
8332
|
+
const code = findCodeInCauseChain(error);
|
|
8333
|
+
if (code) {
|
|
8334
|
+
if (code.startsWith("commander.")) {
|
|
8335
|
+
return "validation";
|
|
8336
|
+
}
|
|
8337
|
+
if (NETWORK_OS_ERROR_CODES.has(code) || TLS_ERROR_CODES2.has(code)) {
|
|
8338
|
+
return "network_http";
|
|
8339
|
+
}
|
|
8340
|
+
if (TIMEOUT_OS_ERROR_CODES.has(code)) {
|
|
8341
|
+
return "timeout";
|
|
8342
|
+
}
|
|
8343
|
+
if (MISSING_DEPENDENCY_CODES.has(code) || isSpawnEnoent(error)) {
|
|
8344
|
+
return "missing_dependency";
|
|
8345
|
+
}
|
|
8346
|
+
}
|
|
8347
|
+
const message = stringField(error, "message");
|
|
8348
|
+
if (message?.includes("fetch failed") === true) {
|
|
8349
|
+
return "network_http";
|
|
8350
|
+
}
|
|
8351
|
+
const name = stringField(error, "name");
|
|
8352
|
+
if (name && INTERNAL_ERROR_NAMES.has(name)) {
|
|
8353
|
+
return "internal";
|
|
8354
|
+
}
|
|
8355
|
+
return;
|
|
8356
|
+
}
|
|
8357
|
+
function classifyError(input) {
|
|
8358
|
+
const recorded = input.recordedFailure;
|
|
8359
|
+
if (recorded?.errorClass) {
|
|
8360
|
+
return recorded.errorClass;
|
|
8361
|
+
}
|
|
8362
|
+
const status = recorded?.context?.httpStatus;
|
|
8363
|
+
if (status !== undefined) {
|
|
8364
|
+
return classifyHttpStatus(status);
|
|
8365
|
+
}
|
|
8366
|
+
return classifyFromResult(recorded?.result) ?? classifyFromErrorCode(recorded?.errorCode) ?? classifyFromError(input.error) ?? "unknown";
|
|
8367
|
+
}
|
|
8368
|
+
function recordCommandFailureTelemetry(failure) {
|
|
8369
|
+
recordedFailureSlot.set(failure);
|
|
8370
|
+
}
|
|
8371
|
+
function clearRecordedCommandFailureTelemetry() {
|
|
8372
|
+
recordedFailureSlot.clear();
|
|
8373
|
+
}
|
|
8374
|
+
function takeRecordedCommandFailureTelemetry() {
|
|
8375
|
+
const failure = recordedFailureSlot.get();
|
|
8376
|
+
recordedFailureSlot.clear();
|
|
8377
|
+
return failure;
|
|
8378
|
+
}
|
|
8379
|
+
function buildCommandTerminalTelemetryProperties(input) {
|
|
8380
|
+
const cancelled = isCancellationError(input.error, input.exitCode, input.pollSignal);
|
|
8381
|
+
const outcome = input.recordedFailure?.terminalOutcome ?? (input.exitCode === 0 ? "success" : cancelled ? "cancelled" : "failure");
|
|
8382
|
+
const errorClass = outcome === "success" || outcome === "no_op" ? undefined : outcome === "cancelled" ? "user_cancelled" : classifyError(input);
|
|
8383
|
+
const terminalSignal = terminalSignalFor(input, outcome);
|
|
8384
|
+
return {
|
|
8385
|
+
exit_code: input.exitCode,
|
|
8386
|
+
terminal_outcome: outcome,
|
|
8387
|
+
...errorClass ? { error_class: errorClass } : {},
|
|
8388
|
+
...terminalSignal ? { terminal_signal: terminalSignal } : {}
|
|
8389
|
+
};
|
|
8390
|
+
}
|
|
8391
|
+
var recordedFailureSlot, AUTH_ERROR_CODES, VALIDATION_ERROR_CODES, NETWORK_HTTP_ERROR_CODES, TIMEOUT_ERROR_CODES, NETWORK_OS_ERROR_CODES, TIMEOUT_OS_ERROR_CODES, TLS_ERROR_CODES2, MISSING_DEPENDENCY_CODES, INTERNAL_ERROR_NAMES;
|
|
8392
|
+
var init_command_terminal = __esm(() => {
|
|
8393
|
+
init_singleton();
|
|
8394
|
+
recordedFailureSlot = singleton("CommandTelemetryFailure");
|
|
8395
|
+
AUTH_ERROR_CODES = new Set([
|
|
8396
|
+
"authentication_required",
|
|
8397
|
+
"permission_denied"
|
|
8398
|
+
]);
|
|
8399
|
+
VALIDATION_ERROR_CODES = new Set(["invalid_argument"]);
|
|
8400
|
+
NETWORK_HTTP_ERROR_CODES = new Set([
|
|
8401
|
+
"network_error",
|
|
8402
|
+
"rate_limited",
|
|
8403
|
+
"server_error",
|
|
8404
|
+
"not_found",
|
|
8405
|
+
"method_not_allowed"
|
|
8406
|
+
]);
|
|
8407
|
+
TIMEOUT_ERROR_CODES = new Set(["timeout"]);
|
|
8408
|
+
NETWORK_OS_ERROR_CODES = new Set([
|
|
8409
|
+
"ECONNREFUSED",
|
|
8410
|
+
"ECONNRESET",
|
|
8411
|
+
"ENOTFOUND",
|
|
8412
|
+
"EAI_AGAIN",
|
|
8413
|
+
"EPIPE",
|
|
8414
|
+
"EHOSTUNREACH",
|
|
8415
|
+
"ENETUNREACH",
|
|
8416
|
+
"EAI_FAIL"
|
|
8417
|
+
]);
|
|
8418
|
+
TIMEOUT_OS_ERROR_CODES = new Set(["ETIMEDOUT", "ESOCKETTIMEDOUT"]);
|
|
8419
|
+
TLS_ERROR_CODES2 = new Set([
|
|
8420
|
+
"SELF_SIGNED_CERT_IN_CHAIN",
|
|
8421
|
+
"DEPTH_ZERO_SELF_SIGNED_CERT",
|
|
8422
|
+
"UNABLE_TO_VERIFY_LEAF_SIGNATURE",
|
|
8423
|
+
"UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
|
|
8424
|
+
"UNABLE_TO_GET_ISSUER_CERT",
|
|
8425
|
+
"CERT_HAS_EXPIRED",
|
|
8426
|
+
"CERT_UNTRUSTED",
|
|
8427
|
+
"ERR_TLS_CERT_ALTNAME_INVALID"
|
|
8428
|
+
]);
|
|
8429
|
+
MISSING_DEPENDENCY_CODES = new Set([
|
|
8430
|
+
"MODULE_NOT_FOUND",
|
|
8431
|
+
"ERR_MODULE_NOT_FOUND"
|
|
8432
|
+
]);
|
|
8433
|
+
INTERNAL_ERROR_NAMES = new Set([
|
|
8434
|
+
"TypeError",
|
|
8435
|
+
"ReferenceError",
|
|
8436
|
+
"SyntaxError",
|
|
8437
|
+
"RangeError"
|
|
8438
|
+
]);
|
|
8439
|
+
});
|
|
8440
|
+
|
|
8219
8441
|
// ../common/src/telemetry/telemetry-events.ts
|
|
8220
8442
|
var CommonTelemetryEvents;
|
|
8221
8443
|
var init_telemetry_events = __esm(() => {
|
|
8222
8444
|
CommonTelemetryEvents = {
|
|
8223
|
-
Error: "uip.error"
|
|
8445
|
+
Error: "uip.error",
|
|
8446
|
+
ShipSucceeded: "ship_succeeded"
|
|
8224
8447
|
};
|
|
8225
8448
|
});
|
|
8226
8449
|
|
|
@@ -8301,8 +8524,21 @@ var init_debug_telemetry_provider = __esm(() => {
|
|
|
8301
8524
|
|
|
8302
8525
|
// ../common/src/telemetry/detect-agent.ts
|
|
8303
8526
|
function detectAgent() {
|
|
8527
|
+
return detectAgentFromEnv(process.env);
|
|
8528
|
+
}
|
|
8529
|
+
function detectAgentVersion() {
|
|
8530
|
+
return detectAgentVersionFromEnv(process.env);
|
|
8531
|
+
}
|
|
8532
|
+
function detectAgentVersionFromEnv(env) {
|
|
8533
|
+
const raw = env.AI_AGENT;
|
|
8534
|
+
if (!raw || raw.length > 64)
|
|
8535
|
+
return;
|
|
8536
|
+
const version = AI_AGENT_PATTERN.exec(raw)?.[1];
|
|
8537
|
+
return version?.replace(/-/g, ".");
|
|
8538
|
+
}
|
|
8539
|
+
function detectAgentFromEnv(env) {
|
|
8304
8540
|
for (const agent of KNOWN_AGENTS) {
|
|
8305
|
-
const envValue =
|
|
8541
|
+
const envValue = env[agent.envVar];
|
|
8306
8542
|
if (agent.value !== undefined) {
|
|
8307
8543
|
if (envValue === agent.value)
|
|
8308
8544
|
return agent.id;
|
|
@@ -8311,7 +8547,7 @@ function detectAgent() {
|
|
|
8311
8547
|
return agent.id;
|
|
8312
8548
|
}
|
|
8313
8549
|
}
|
|
8314
|
-
const agentEnv =
|
|
8550
|
+
const agentEnv = env.AGENT;
|
|
8315
8551
|
if (agentEnv) {
|
|
8316
8552
|
if (agentEnv === "1" || agentEnv === "true")
|
|
8317
8553
|
return "unknown";
|
|
@@ -8320,7 +8556,7 @@ function detectAgent() {
|
|
|
8320
8556
|
}
|
|
8321
8557
|
return;
|
|
8322
8558
|
}
|
|
8323
|
-
var KNOWN_AGENTS;
|
|
8559
|
+
var KNOWN_AGENTS, AI_AGENT_PATTERN;
|
|
8324
8560
|
var init_detect_agent = __esm(() => {
|
|
8325
8561
|
KNOWN_AGENTS = [
|
|
8326
8562
|
{ envVar: "CLAUDECODE", value: "1", id: "claude-code" },
|
|
@@ -8331,6 +8567,173 @@ var init_detect_agent = __esm(() => {
|
|
|
8331
8567
|
{ envVar: "AUGMENT_AGENT", value: "1", id: "augment" },
|
|
8332
8568
|
{ envVar: "CLINE_ACTIVE", value: "true", id: "cline" }
|
|
8333
8569
|
];
|
|
8570
|
+
AI_AGENT_PATTERN = /^[a-z0-9-]+_([0-9]+(?:-[0-9]+)*)_agent$/;
|
|
8571
|
+
});
|
|
8572
|
+
|
|
8573
|
+
// ../common/src/telemetry/environment-info.ts
|
|
8574
|
+
function parseHost(baseUrl) {
|
|
8575
|
+
if (!baseUrl)
|
|
8576
|
+
return;
|
|
8577
|
+
try {
|
|
8578
|
+
return new URL(baseUrl).hostname.toLowerCase();
|
|
8579
|
+
} catch {
|
|
8580
|
+
return;
|
|
8581
|
+
}
|
|
8582
|
+
}
|
|
8583
|
+
function normalizeEnvironment(baseUrl) {
|
|
8584
|
+
const host = parseHost(baseUrl);
|
|
8585
|
+
if (!host)
|
|
8586
|
+
return "unknown";
|
|
8587
|
+
if (LOCAL_HOSTS.has(host) || host.endsWith(".local"))
|
|
8588
|
+
return "local";
|
|
8589
|
+
if (host.includes("alpha"))
|
|
8590
|
+
return "alpha";
|
|
8591
|
+
if (host.includes("staging") || host.includes("stage"))
|
|
8592
|
+
return "staging";
|
|
8593
|
+
if (host === "cloud.uipath.com" || host.endsWith(".uipath.us")) {
|
|
8594
|
+
return "prod";
|
|
8595
|
+
}
|
|
8596
|
+
return "unknown";
|
|
8597
|
+
}
|
|
8598
|
+
function normalizeBaseUrl(baseUrl) {
|
|
8599
|
+
if (!baseUrl)
|
|
8600
|
+
return;
|
|
8601
|
+
try {
|
|
8602
|
+
return new URL(baseUrl).origin;
|
|
8603
|
+
} catch {
|
|
8604
|
+
return;
|
|
8605
|
+
}
|
|
8606
|
+
}
|
|
8607
|
+
function deriveRegion(baseUrl) {
|
|
8608
|
+
const host = parseHost(baseUrl);
|
|
8609
|
+
if (host?.endsWith(".uipath.us"))
|
|
8610
|
+
return "gov";
|
|
8611
|
+
return;
|
|
8612
|
+
}
|
|
8613
|
+
function buildEnvironmentProperties(baseUrl) {
|
|
8614
|
+
const props = {
|
|
8615
|
+
environment: normalizeEnvironment(baseUrl)
|
|
8616
|
+
};
|
|
8617
|
+
const normalized = normalizeBaseUrl(baseUrl);
|
|
8618
|
+
if (normalized)
|
|
8619
|
+
props.base_url = normalized;
|
|
8620
|
+
const region = deriveRegion(baseUrl);
|
|
8621
|
+
if (region)
|
|
8622
|
+
props.region = region;
|
|
8623
|
+
return props;
|
|
8624
|
+
}
|
|
8625
|
+
var LOCAL_HOSTS;
|
|
8626
|
+
var init_environment_info = __esm(() => {
|
|
8627
|
+
LOCAL_HOSTS = new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
|
|
8628
|
+
});
|
|
8629
|
+
|
|
8630
|
+
// ../common/src/telemetry/execution-context.ts
|
|
8631
|
+
function currentEnv() {
|
|
8632
|
+
return typeof process === "undefined" ? {} : process.env;
|
|
8633
|
+
}
|
|
8634
|
+
function currentTtyState() {
|
|
8635
|
+
if (typeof process === "undefined")
|
|
8636
|
+
return false;
|
|
8637
|
+
return Boolean(process.stdout?.isTTY || process.stdin?.isTTY || process.stderr?.isTTY);
|
|
8638
|
+
}
|
|
8639
|
+
function detectCi(env) {
|
|
8640
|
+
const signature = CI_SIGNATURES.find((candidate) => candidate.matches(env));
|
|
8641
|
+
if (!signature)
|
|
8642
|
+
return;
|
|
8643
|
+
return {
|
|
8644
|
+
executionContext: signature.isScheduler?.(env) ? "scheduler" : "ci",
|
|
8645
|
+
ciProvider: signature.provider
|
|
8646
|
+
};
|
|
8647
|
+
}
|
|
8648
|
+
function setExecutionContextAuthSignal(signal) {
|
|
8649
|
+
if (signal === undefined) {
|
|
8650
|
+
authSignalSlot.clear();
|
|
8651
|
+
return;
|
|
8652
|
+
}
|
|
8653
|
+
authSignalSlot.set(signal);
|
|
8654
|
+
}
|
|
8655
|
+
function detectExecutionContext(options = {}) {
|
|
8656
|
+
const env = options.env ?? currentEnv();
|
|
8657
|
+
const ci = detectCi(env);
|
|
8658
|
+
if (ci)
|
|
8659
|
+
return ci;
|
|
8660
|
+
const agent = options.agent ?? detectAgentFromEnv(env);
|
|
8661
|
+
if (agent) {
|
|
8662
|
+
return { executionContext: "agent" };
|
|
8663
|
+
}
|
|
8664
|
+
const authSignal = options.authSignal ?? authSignalSlot.get();
|
|
8665
|
+
if (authSignal === "service_account") {
|
|
8666
|
+
return { executionContext: "service_account" };
|
|
8667
|
+
}
|
|
8668
|
+
const isTty = options.isTty ?? currentTtyState();
|
|
8669
|
+
if (isTty) {
|
|
8670
|
+
return { executionContext: "manual" };
|
|
8671
|
+
}
|
|
8672
|
+
return { executionContext: "unknown" };
|
|
8673
|
+
}
|
|
8674
|
+
function getExecutionContextTelemetryProperties() {
|
|
8675
|
+
const detected = detectExecutionContext();
|
|
8676
|
+
return {
|
|
8677
|
+
execution_context: detected.executionContext,
|
|
8678
|
+
...detected.ciProvider ? { ci_provider: detected.ciProvider } : {}
|
|
8679
|
+
};
|
|
8680
|
+
}
|
|
8681
|
+
var authSignalSlot, isTruthy = (value) => value !== undefined && value !== "" && value !== "0" && value.toLowerCase() !== "false", isEqual = (value, expected) => value?.toLowerCase() === expected, CI_SIGNATURES;
|
|
8682
|
+
var init_execution_context = __esm(() => {
|
|
8683
|
+
init_singleton();
|
|
8684
|
+
init_detect_agent();
|
|
8685
|
+
authSignalSlot = singleton("TelemetryExecutionContextAuthSignal");
|
|
8686
|
+
CI_SIGNATURES = [
|
|
8687
|
+
{
|
|
8688
|
+
provider: "github_actions",
|
|
8689
|
+
matches: (env) => isTruthy(env.GITHUB_ACTIONS),
|
|
8690
|
+
isScheduler: (env) => env.GITHUB_EVENT_NAME === "schedule"
|
|
8691
|
+
},
|
|
8692
|
+
{
|
|
8693
|
+
provider: "azure_devops",
|
|
8694
|
+
matches: (env) => isTruthy(env.TF_BUILD),
|
|
8695
|
+
isScheduler: (env) => isEqual(env.BUILD_REASON, "schedule")
|
|
8696
|
+
},
|
|
8697
|
+
{
|
|
8698
|
+
provider: "gitlab",
|
|
8699
|
+
matches: (env) => isTruthy(env.GITLAB_CI),
|
|
8700
|
+
isScheduler: (env) => env.CI_PIPELINE_SOURCE === "schedule"
|
|
8701
|
+
},
|
|
8702
|
+
{
|
|
8703
|
+
provider: "circleci",
|
|
8704
|
+
matches: (env) => isTruthy(env.CIRCLECI),
|
|
8705
|
+
isScheduler: (env) => env.CIRCLE_PIPELINE_TRIGGER_SOURCE === "scheduled_pipeline"
|
|
8706
|
+
},
|
|
8707
|
+
{
|
|
8708
|
+
provider: "jenkins",
|
|
8709
|
+
matches: (env) => isTruthy(env.JENKINS_URL) || isTruthy(env.JENKINS_HOME)
|
|
8710
|
+
},
|
|
8711
|
+
{
|
|
8712
|
+
provider: "teamcity",
|
|
8713
|
+
matches: (env) => isTruthy(env.TEAMCITY_VERSION)
|
|
8714
|
+
},
|
|
8715
|
+
{
|
|
8716
|
+
provider: "buildkite",
|
|
8717
|
+
matches: (env) => isTruthy(env.BUILDKITE),
|
|
8718
|
+
isScheduler: (env) => env.BUILDKITE_SOURCE === "schedule"
|
|
8719
|
+
},
|
|
8720
|
+
{
|
|
8721
|
+
provider: "bitbucket",
|
|
8722
|
+
matches: (env) => isTruthy(env.BITBUCKET_BUILD_NUMBER)
|
|
8723
|
+
},
|
|
8724
|
+
{
|
|
8725
|
+
provider: "travis",
|
|
8726
|
+
matches: (env) => isTruthy(env.TRAVIS)
|
|
8727
|
+
},
|
|
8728
|
+
{
|
|
8729
|
+
provider: "appveyor",
|
|
8730
|
+
matches: (env) => isTruthy(env.APPVEYOR)
|
|
8731
|
+
},
|
|
8732
|
+
{
|
|
8733
|
+
provider: "generic",
|
|
8734
|
+
matches: (env) => isTruthy(env.CI)
|
|
8735
|
+
}
|
|
8736
|
+
];
|
|
8334
8737
|
});
|
|
8335
8738
|
|
|
8336
8739
|
// ../common/src/telemetry/node-context-storage.ts
|
|
@@ -8347,6 +8750,42 @@ class NodeContextStorage {
|
|
|
8347
8750
|
}
|
|
8348
8751
|
var init_node_context_storage = () => {};
|
|
8349
8752
|
|
|
8753
|
+
// ../common/src/telemetry/session-id.ts
|
|
8754
|
+
function getProcessEnv() {
|
|
8755
|
+
return globalThis.process?.env;
|
|
8756
|
+
}
|
|
8757
|
+
function normalizeSessionId(value) {
|
|
8758
|
+
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
|
|
8759
|
+
return;
|
|
8760
|
+
}
|
|
8761
|
+
const trimmed = String(value).trim();
|
|
8762
|
+
return trimmed || undefined;
|
|
8763
|
+
}
|
|
8764
|
+
function getConfiguredTelemetrySessionId() {
|
|
8765
|
+
return normalizeSessionId(getProcessEnv()?.[TELEMETRY_SESSION_ID_ENV]);
|
|
8766
|
+
}
|
|
8767
|
+
function getTelemetrySessionId() {
|
|
8768
|
+
const envSessionId = getConfiguredTelemetrySessionId();
|
|
8769
|
+
if (envSessionId) {
|
|
8770
|
+
return envSessionId;
|
|
8771
|
+
}
|
|
8772
|
+
const existing = telemetrySessionIdSlot.get();
|
|
8773
|
+
if (existing) {
|
|
8774
|
+
return existing;
|
|
8775
|
+
}
|
|
8776
|
+
const generated = crypto.randomUUID();
|
|
8777
|
+
telemetrySessionIdSlot.set(generated);
|
|
8778
|
+
return generated;
|
|
8779
|
+
}
|
|
8780
|
+
function resolveTelemetrySessionId(existingSessionId) {
|
|
8781
|
+
return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
|
|
8782
|
+
}
|
|
8783
|
+
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID", TELEMETRY_SESSION_ID_PROPERTY = "session_id", telemetrySessionIdSlot;
|
|
8784
|
+
var init_session_id = __esm(() => {
|
|
8785
|
+
init_singleton();
|
|
8786
|
+
telemetrySessionIdSlot = singleton("TelemetrySessionId");
|
|
8787
|
+
});
|
|
8788
|
+
|
|
8350
8789
|
// ../common/src/telemetry/global-telemetry-properties.ts
|
|
8351
8790
|
function setGlobalTelemetryProperties(properties) {
|
|
8352
8791
|
const existing = getGlobalTelemetryProperties();
|
|
@@ -8439,26 +8878,41 @@ class TelemetryService {
|
|
|
8439
8878
|
return this.contextStorage.getContext();
|
|
8440
8879
|
}
|
|
8441
8880
|
enrichPropertiesWithContext(properties, context) {
|
|
8442
|
-
|
|
8443
|
-
|
|
8881
|
+
const globalProperties = getGlobalTelemetryProperties();
|
|
8882
|
+
const existingSessionId = properties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? this.defaultProperties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? globalProperties?.[TELEMETRY_SESSION_ID_PROPERTY];
|
|
8883
|
+
const sessionId = resolveTelemetrySessionId(existingSessionId);
|
|
8884
|
+
const enriched = {
|
|
8885
|
+
...getExecutionContextTelemetryProperties(),
|
|
8886
|
+
...globalProperties,
|
|
8444
8887
|
...this.defaultProperties,
|
|
8445
8888
|
...properties,
|
|
8446
8889
|
...context
|
|
8447
8890
|
};
|
|
8891
|
+
if (sessionId === undefined) {
|
|
8892
|
+
delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
|
|
8893
|
+
} else {
|
|
8894
|
+
enriched[TELEMETRY_SESSION_ID_PROPERTY] = sessionId;
|
|
8895
|
+
}
|
|
8896
|
+
return enriched;
|
|
8448
8897
|
}
|
|
8449
8898
|
generateId() {
|
|
8450
8899
|
return crypto.randomUUID().replaceAll("-", "");
|
|
8451
8900
|
}
|
|
8452
8901
|
}
|
|
8453
8902
|
var init_telemetry_service = __esm(() => {
|
|
8903
|
+
init_execution_context();
|
|
8454
8904
|
init_global_telemetry_properties();
|
|
8905
|
+
init_session_id();
|
|
8455
8906
|
});
|
|
8456
8907
|
|
|
8457
8908
|
// ../common/src/telemetry/node.ts
|
|
8458
8909
|
var init_node2 = __esm(() => {
|
|
8459
8910
|
init_debug_telemetry_provider();
|
|
8460
8911
|
init_detect_agent();
|
|
8912
|
+
init_environment_info();
|
|
8913
|
+
init_execution_context();
|
|
8461
8914
|
init_node_context_storage();
|
|
8915
|
+
init_session_id();
|
|
8462
8916
|
init_telemetry_service();
|
|
8463
8917
|
});
|
|
8464
8918
|
|
|
@@ -43670,7 +44124,7 @@ function toOperationUrn(name) {
|
|
|
43670
44124
|
const sanitized = encodeURIComponent(name).replace(/%2F/g, "/");
|
|
43671
44125
|
return `urn:uip:${sanitized}`;
|
|
43672
44126
|
}
|
|
43673
|
-
function
|
|
44127
|
+
function isRecord2(value) {
|
|
43674
44128
|
return value !== null && typeof value === "object";
|
|
43675
44129
|
}
|
|
43676
44130
|
function formatFlushJsonError(error) {
|
|
@@ -43678,7 +44132,7 @@ function formatFlushJsonError(error) {
|
|
|
43678
44132
|
return error.message;
|
|
43679
44133
|
if (typeof error === "string")
|
|
43680
44134
|
return error;
|
|
43681
|
-
if (!
|
|
44135
|
+
if (!isRecord2(error))
|
|
43682
44136
|
return String(error);
|
|
43683
44137
|
const parts = [];
|
|
43684
44138
|
if (error.index !== undefined) {
|
|
@@ -43720,7 +44174,7 @@ function normalizeFlushCallbackError(response) {
|
|
|
43720
44174
|
return;
|
|
43721
44175
|
const [parseError, parsed] = catchError(() => JSON.parse(text));
|
|
43722
44176
|
if (!parseError) {
|
|
43723
|
-
const errors =
|
|
44177
|
+
const errors = isRecord2(parsed) ? parsed.errors : undefined;
|
|
43724
44178
|
if (Array.isArray(errors) && errors.length > 0) {
|
|
43725
44179
|
return errors.map(formatFlushJsonError).join("; ");
|
|
43726
44180
|
}
|
|
@@ -43772,7 +44226,7 @@ class NodeAppInsightsTelemetryProvider {
|
|
|
43772
44226
|
initialized = false;
|
|
43773
44227
|
constructor(connectionString) {
|
|
43774
44228
|
this.connectionString = connectionString;
|
|
43775
|
-
this._sessionId =
|
|
44229
|
+
this._sessionId = getTelemetrySessionId();
|
|
43776
44230
|
}
|
|
43777
44231
|
async initialize() {
|
|
43778
44232
|
if (this.initialized)
|
|
@@ -43931,6 +44385,7 @@ var init_node_appinsights_telemetry_provider = __esm(() => {
|
|
|
43931
44385
|
init_logger();
|
|
43932
44386
|
init_singleton();
|
|
43933
44387
|
init_global_telemetry_properties();
|
|
44388
|
+
init_session_id();
|
|
43934
44389
|
init_global_telemetry_properties();
|
|
43935
44390
|
providerSlot = singleton("TelemetryProvider");
|
|
43936
44391
|
});
|
|
@@ -44437,6 +44892,7 @@ var init_formatter = __esm(() => {
|
|
|
44437
44892
|
init_logger();
|
|
44438
44893
|
init_output_context();
|
|
44439
44894
|
init_output_format_context();
|
|
44895
|
+
init_command_terminal();
|
|
44440
44896
|
init_telemetry_events();
|
|
44441
44897
|
init_telemetry_init();
|
|
44442
44898
|
CLI_ERROR_CODES = [
|
|
@@ -44511,8 +44967,24 @@ var init_formatter = __esm(() => {
|
|
|
44511
44967
|
data.ErrorCode ??= defaultErrorCodeForFailure(data);
|
|
44512
44968
|
data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
|
|
44513
44969
|
process.exitCode = EXIT_CODES[data.Result] ?? 1;
|
|
44514
|
-
|
|
44515
|
-
|
|
44970
|
+
recordCommandFailureTelemetry({
|
|
44971
|
+
result: data.Result,
|
|
44972
|
+
errorCode: data.ErrorCode,
|
|
44973
|
+
retry: data.Retry,
|
|
44974
|
+
message: data.Message,
|
|
44975
|
+
context: data.Context,
|
|
44976
|
+
exitCode: process.exitCode,
|
|
44977
|
+
errorClass: data.TelemetryErrorClass,
|
|
44978
|
+
terminalOutcome: data.TelemetryTerminalOutcome,
|
|
44979
|
+
terminalSignal: data.TelemetryTerminalSignal
|
|
44980
|
+
});
|
|
44981
|
+
const suppressTelemetry = data.SuppressTelemetry === true;
|
|
44982
|
+
const envelope = { ...data };
|
|
44983
|
+
delete envelope.SuppressTelemetry;
|
|
44984
|
+
delete envelope.TelemetryErrorClass;
|
|
44985
|
+
delete envelope.TelemetryTerminalOutcome;
|
|
44986
|
+
delete envelope.TelemetryTerminalSignal;
|
|
44987
|
+
if (!suppressTelemetry) {
|
|
44516
44988
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
44517
44989
|
result: data.Result,
|
|
44518
44990
|
errorCode: data.ErrorCode,
|
|
@@ -44576,6 +45048,174 @@ var init_formatter = __esm(() => {
|
|
|
44576
45048
|
})(OutputFormatter ||= {});
|
|
44577
45049
|
});
|
|
44578
45050
|
|
|
45051
|
+
// ../common/src/telemetry/command-attribution.ts
|
|
45052
|
+
function productMode(productArea, mode) {
|
|
45053
|
+
return { product_area: productArea, mode };
|
|
45054
|
+
}
|
|
45055
|
+
function attributionRecord(groups) {
|
|
45056
|
+
const record = {};
|
|
45057
|
+
for (const [productArea, mode, names] of groups) {
|
|
45058
|
+
const attribution = productMode(productArea, mode);
|
|
45059
|
+
for (const name of names) {
|
|
45060
|
+
record[name] = attribution;
|
|
45061
|
+
}
|
|
45062
|
+
}
|
|
45063
|
+
return record;
|
|
45064
|
+
}
|
|
45065
|
+
function commandAttribution(groups) {
|
|
45066
|
+
const entries = [];
|
|
45067
|
+
for (const [productArea, mode, prefixes] of groups) {
|
|
45068
|
+
const attribution = productMode(productArea, mode);
|
|
45069
|
+
for (const prefix of prefixes) {
|
|
45070
|
+
entries.push({ prefix, attribution });
|
|
45071
|
+
}
|
|
45072
|
+
}
|
|
45073
|
+
return entries;
|
|
45074
|
+
}
|
|
45075
|
+
function normalizeCommandPath(value) {
|
|
45076
|
+
if (typeof value !== "string") {
|
|
45077
|
+
return;
|
|
45078
|
+
}
|
|
45079
|
+
const trimmed = value.trim().toLowerCase();
|
|
45080
|
+
if (!trimmed) {
|
|
45081
|
+
return;
|
|
45082
|
+
}
|
|
45083
|
+
const tokens = trimmed.includes(" ") ? trimmed.split(/\s+/).filter((token) => token.length > 0).filter((token) => !token.startsWith("-")) : trimmed.split(".").filter((token) => token.length > 0);
|
|
45084
|
+
if (tokens.length === 0) {
|
|
45085
|
+
return;
|
|
45086
|
+
}
|
|
45087
|
+
const commandTokens = tokens[0] === "uip" ? tokens : ["uip", ...tokens];
|
|
45088
|
+
return commandTokens.join(".");
|
|
45089
|
+
}
|
|
45090
|
+
function getCommandProductModeAttribution(commandPath) {
|
|
45091
|
+
const normalized = normalizeCommandPath(commandPath);
|
|
45092
|
+
if (!normalized) {
|
|
45093
|
+
return;
|
|
45094
|
+
}
|
|
45095
|
+
return COMMAND_ATTRIBUTION.find(({ prefix }) => normalized === prefix || normalized.startsWith(`${prefix}.`))?.attribution;
|
|
45096
|
+
}
|
|
45097
|
+
function normalizeSkillNameWithOptions(value, options) {
|
|
45098
|
+
if (typeof value !== "string") {
|
|
45099
|
+
return;
|
|
45100
|
+
}
|
|
45101
|
+
const normalized = value.trim().toLowerCase();
|
|
45102
|
+
if (!normalized) {
|
|
45103
|
+
return;
|
|
45104
|
+
}
|
|
45105
|
+
const hasLegacyNamespace = normalized.startsWith(LEGACY_SKILL_NAMESPACE);
|
|
45106
|
+
if (hasLegacyNamespace && !options.allowLegacyNamespace) {
|
|
45107
|
+
return;
|
|
45108
|
+
}
|
|
45109
|
+
const skillName = hasLegacyNamespace ? normalized.slice(LEGACY_SKILL_NAMESPACE.length) : normalized;
|
|
45110
|
+
if (skillName.length > MAX_SKILL_NAME_LENGTH || !SKILL_NAME_PATTERN.test(skillName) || !KNOWN_SKILL_NAMES.has(skillName)) {
|
|
45111
|
+
return;
|
|
45112
|
+
}
|
|
45113
|
+
return skillName;
|
|
45114
|
+
}
|
|
45115
|
+
function normalizeSkillName(value) {
|
|
45116
|
+
return normalizeSkillNameWithOptions(value, {
|
|
45117
|
+
allowLegacyNamespace: false
|
|
45118
|
+
});
|
|
45119
|
+
}
|
|
45120
|
+
function normalizeLegacySkillName(value) {
|
|
45121
|
+
return normalizeSkillNameWithOptions(value, {
|
|
45122
|
+
allowLegacyNamespace: true
|
|
45123
|
+
});
|
|
45124
|
+
}
|
|
45125
|
+
function buildCommandTelemetryAttribution(commandPath, skillSource) {
|
|
45126
|
+
const skillName = normalizeSkillName(skillSource);
|
|
45127
|
+
return {
|
|
45128
|
+
...skillName ? { skill_name: skillName } : {},
|
|
45129
|
+
...getCommandProductModeAttribution(commandPath)
|
|
45130
|
+
};
|
|
45131
|
+
}
|
|
45132
|
+
function buildSkillEventTelemetryAttribution(skillSource, uipSubcommand) {
|
|
45133
|
+
const skillName = normalizeLegacySkillName(skillSource);
|
|
45134
|
+
const skillAttribution = skillName ? SKILL_ATTRIBUTION[skillName] : {};
|
|
45135
|
+
const commandAttribution2 = getCommandProductModeAttribution(uipSubcommand);
|
|
45136
|
+
return {
|
|
45137
|
+
...skillAttribution,
|
|
45138
|
+
...commandAttribution2,
|
|
45139
|
+
...skillName ? { skill_name: skillName } : {}
|
|
45140
|
+
};
|
|
45141
|
+
}
|
|
45142
|
+
var LEGACY_SKILL_NAMESPACE = "uipath:", MAX_SKILL_NAME_LENGTH = 80, SKILL_NAME_PATTERN, SKILL_ATTRIBUTION, KNOWN_SKILL_NAMES, COMMAND_ATTRIBUTION;
|
|
45143
|
+
var init_command_attribution = __esm(() => {
|
|
45144
|
+
SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
|
|
45145
|
+
SKILL_ATTRIBUTION = attributionRecord([
|
|
45146
|
+
["admin", "operate", ["uipath-admin"]],
|
|
45147
|
+
["agents", "build", ["uipath-agents"]],
|
|
45148
|
+
["api-workflow", "build", ["uipath-api-workflow"]],
|
|
45149
|
+
["automation-discovery", "build", ["uipath-automation-discovery"]],
|
|
45150
|
+
["coded-apps", "build", ["uipath-coded-apps"]],
|
|
45151
|
+
["data-fabric", "operate", ["uipath-data-fabric"]],
|
|
45152
|
+
["cli", "troubleshoot", ["uipath-feedback"]],
|
|
45153
|
+
["governance", "operate", ["uipath-governance"]],
|
|
45154
|
+
["action-center", "build", ["uipath-human-in-the-loop"]],
|
|
45155
|
+
["document-understanding", "build", ["uipath-ixp"]],
|
|
45156
|
+
[
|
|
45157
|
+
"maestro",
|
|
45158
|
+
"build",
|
|
45159
|
+
["uipath-maestro-bpmn", "uipath-maestro-case", "uipath-maestro-flow"]
|
|
45160
|
+
],
|
|
45161
|
+
["agenthub", "build", ["uipath-mcp-servers"]],
|
|
45162
|
+
["solution", "build", ["uipath-planner", "uipath-solution"]],
|
|
45163
|
+
["platform", "operate", ["uipath-platform"]],
|
|
45164
|
+
["quality", "troubleshoot", ["uipath-review"]],
|
|
45165
|
+
["rpa", "build", ["uipath-rpa"]],
|
|
45166
|
+
["cli", "operate", ["uipath-skill-catalog"]],
|
|
45167
|
+
["action-center", "operate", ["uipath-tasks"]],
|
|
45168
|
+
["test-manager", "operate", ["uipath-test"]],
|
|
45169
|
+
["platform", "troubleshoot", ["uipath-troubleshoot"]]
|
|
45170
|
+
]);
|
|
45171
|
+
KNOWN_SKILL_NAMES = new Set(Object.keys(SKILL_ATTRIBUTION));
|
|
45172
|
+
COMMAND_ATTRIBUTION = commandAttribution([
|
|
45173
|
+
["cli", "troubleshoot", ["uip.feedback"]],
|
|
45174
|
+
["llm-gateway", "operate", ["uip.llm-configuration", "uip.model-hub"]],
|
|
45175
|
+
["context-grounding", "build", ["uip.context-grounding"]],
|
|
45176
|
+
["api-workflow", "build", ["uip.api-workflow"]],
|
|
45177
|
+
["rpa", "build", ["uip.rpa-legacy"]],
|
|
45178
|
+
["conversational", "operate", ["uip.conversational"]],
|
|
45179
|
+
["agents", "build", ["uip.codedagent", "uip.agent"]],
|
|
45180
|
+
["agenthub", "build", ["uip.agenthub"]],
|
|
45181
|
+
["coded-apps", "build", ["uip.codedapp"]],
|
|
45182
|
+
["functions", "build", ["uip.functions"]],
|
|
45183
|
+
["solution", "build", ["uip.solution"]],
|
|
45184
|
+
["maestro", "build", ["uip.maestro", "uip.case", "uip.flow"]],
|
|
45185
|
+
["llm-observability", "troubleshoot", ["uip.traces"]],
|
|
45186
|
+
["platform", "operate", ["uip.platform"]],
|
|
45187
|
+
["admin", "operate", ["uip.admin"]],
|
|
45188
|
+
["automation-ops", "operate", ["uip.aops"]],
|
|
45189
|
+
["documentation", "troubleshoot", ["uip.docsai"]],
|
|
45190
|
+
["governance", "operate", ["uip.gov"]],
|
|
45191
|
+
["insights", "operate", ["uip.insights"]],
|
|
45192
|
+
["document-understanding", "build", ["uip.ixp"]],
|
|
45193
|
+
["process-mining", "operate", ["uip.pm"]],
|
|
45194
|
+
["action-center", "operate", ["uip.tasks"]],
|
|
45195
|
+
["test-manager", "operate", ["uip.tm"]],
|
|
45196
|
+
["vertical-solutions", "build", ["uip.vss"]],
|
|
45197
|
+
["data-fabric", "operate", ["uip.df"]],
|
|
45198
|
+
["integration-service", "build", ["uip.is"]],
|
|
45199
|
+
["orchestrator", "operate", ["uip.or"]],
|
|
45200
|
+
[
|
|
45201
|
+
"cli",
|
|
45202
|
+
"operate",
|
|
45203
|
+
[
|
|
45204
|
+
"uip.login",
|
|
45205
|
+
"uip.logout",
|
|
45206
|
+
"uip.user",
|
|
45207
|
+
"uip.config",
|
|
45208
|
+
"uip.tools",
|
|
45209
|
+
"uip.skills",
|
|
45210
|
+
"uip.completion",
|
|
45211
|
+
"uip.update",
|
|
45212
|
+
"uip.mcp",
|
|
45213
|
+
"uip.track"
|
|
45214
|
+
]
|
|
45215
|
+
]
|
|
45216
|
+
]).sort((a, b) => b.prefix.length - a.prefix.length);
|
|
45217
|
+
});
|
|
45218
|
+
|
|
44579
45219
|
// ../common/src/telemetry/pii-redactor.ts
|
|
44580
45220
|
function shortHash(input) {
|
|
44581
45221
|
let hash = 2166136261;
|
|
@@ -44754,12 +45394,20 @@ function commandHelpHint(commandPath) {
|
|
|
44754
45394
|
const command = commandPath.replace(/\./g, " ");
|
|
44755
45395
|
return `An unexpected error occurred. Run '${command} --help' to verify command syntax, or run with --log-level debug for details.`;
|
|
44756
45396
|
}
|
|
45397
|
+
function isPromptCancellation(error) {
|
|
45398
|
+
return error instanceof Error && error.name === "ExitPromptError";
|
|
45399
|
+
}
|
|
45400
|
+
function exitCodeFromProcess(fallback) {
|
|
45401
|
+
return typeof process.exitCode === "number" ? process.exitCode : fallback;
|
|
45402
|
+
}
|
|
44757
45403
|
var pollSignalSlot, cliErrorCodeValues, retryHintValues, processContext;
|
|
44758
45404
|
var init_trackedAction = __esm(() => {
|
|
44759
45405
|
init_esm();
|
|
44760
45406
|
init_formatter();
|
|
44761
45407
|
init_logger();
|
|
44762
45408
|
init_singleton();
|
|
45409
|
+
init_command_attribution();
|
|
45410
|
+
init_command_terminal();
|
|
44763
45411
|
init_pii_redactor();
|
|
44764
45412
|
init_telemetry_init();
|
|
44765
45413
|
pollSignalSlot = singleton("PollSignal");
|
|
@@ -44780,6 +45428,8 @@ var init_trackedAction = __esm(() => {
|
|
|
44780
45428
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
44781
45429
|
const startTime = performance.now();
|
|
44782
45430
|
let errorMessage;
|
|
45431
|
+
let fallbackExitCode = EXIT_CODES.Success;
|
|
45432
|
+
clearRecordedCommandFailureTelemetry();
|
|
44783
45433
|
const [error] = await catchError(fn(...args));
|
|
44784
45434
|
if (error) {
|
|
44785
45435
|
errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -44794,6 +45444,8 @@ var init_trackedAction = __esm(() => {
|
|
|
44794
45444
|
const customRetry = isRetryHint(typedRetry) ? typedRetry : undefined;
|
|
44795
45445
|
const typedContext = typed.context ?? typed.Context;
|
|
44796
45446
|
const customContext = isErrorContext(typedContext) ? typedContext : undefined;
|
|
45447
|
+
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
45448
|
+
fallbackExitCode = cancellationExitCode ?? EXIT_CODES[finalResult];
|
|
44797
45449
|
OutputFormatter.error({
|
|
44798
45450
|
Result: finalResult,
|
|
44799
45451
|
...customErrorCode ? { ErrorCode: customErrorCode } : {},
|
|
@@ -44802,16 +45454,26 @@ var init_trackedAction = __esm(() => {
|
|
|
44802
45454
|
...customRetry ? { Retry: customRetry } : {},
|
|
44803
45455
|
...customContext ? { Context: customContext } : {}
|
|
44804
45456
|
});
|
|
44805
|
-
context.exit(
|
|
45457
|
+
context.exit(fallbackExitCode);
|
|
44806
45458
|
}
|
|
44807
45459
|
const durationMs = performance.now() - startTime;
|
|
44808
|
-
const
|
|
45460
|
+
const exitCode = fallbackExitCode === 130 ? fallbackExitCode : exitCodeFromProcess(fallbackExitCode);
|
|
45461
|
+
const recordedFailure = takeRecordedCommandFailureTelemetry();
|
|
45462
|
+
const success = !error && exitCode === 0;
|
|
45463
|
+
const terminalTelemetry = buildCommandTerminalTelemetryProperties({
|
|
45464
|
+
error,
|
|
45465
|
+
exitCode,
|
|
45466
|
+
recordedFailure,
|
|
45467
|
+
pollSignal: context.pollSignal
|
|
45468
|
+
});
|
|
44809
45469
|
telemetry.trackEvent(telemetryName, redactProperties({
|
|
44810
45470
|
...extractCommandParams(command),
|
|
44811
45471
|
...props,
|
|
45472
|
+
...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
|
|
44812
45473
|
command: "true",
|
|
44813
45474
|
duration: String(durationMs),
|
|
44814
45475
|
success: String(success),
|
|
45476
|
+
...terminalTelemetry,
|
|
44815
45477
|
...errorMessage ? { errorMessage } : {}
|
|
44816
45478
|
}));
|
|
44817
45479
|
});
|
|
@@ -45141,6 +45803,16 @@ async function readStdin() {
|
|
|
45141
45803
|
process.stdin.on("error", reject);
|
|
45142
45804
|
});
|
|
45143
45805
|
}
|
|
45806
|
+
// ../common/src/telemetry/ship-succeeded.ts
|
|
45807
|
+
var shippedKeysSlot;
|
|
45808
|
+
var init_ship_succeeded = __esm(() => {
|
|
45809
|
+
init_singleton();
|
|
45810
|
+
init_pii_redactor();
|
|
45811
|
+
init_telemetry_events();
|
|
45812
|
+
init_telemetry_init();
|
|
45813
|
+
shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
|
|
45814
|
+
});
|
|
45815
|
+
|
|
45144
45816
|
// ../common/src/tool-provider.ts
|
|
45145
45817
|
function setPackagerFactoryProvider(provider) {
|
|
45146
45818
|
factorySlot.set(provider);
|
|
@@ -45155,6 +45827,8 @@ var init_tool_provider = __esm(() => {
|
|
|
45155
45827
|
var init_src2 = __esm(() => {
|
|
45156
45828
|
init_console_guard();
|
|
45157
45829
|
init_node_appinsights_telemetry_provider();
|
|
45830
|
+
init_pii_redactor();
|
|
45831
|
+
init_ship_succeeded();
|
|
45158
45832
|
init_attachment_binding();
|
|
45159
45833
|
init_command_examples();
|
|
45160
45834
|
init_command_help();
|
|
@@ -45177,6 +45851,8 @@ var init_src2 = __esm(() => {
|
|
|
45177
45851
|
init_screen_logger();
|
|
45178
45852
|
init_sdk_user_agent();
|
|
45179
45853
|
init_singleton();
|
|
45854
|
+
init_command_attribution();
|
|
45855
|
+
init_command_terminal();
|
|
45180
45856
|
init_node2();
|
|
45181
45857
|
init_telemetry_events();
|
|
45182
45858
|
init_telemetry_init();
|
|
@@ -45190,7 +45866,7 @@ var init_package = __esm(() => {
|
|
|
45190
45866
|
package_default = {
|
|
45191
45867
|
name: "@uipath/cli",
|
|
45192
45868
|
license: "MIT",
|
|
45193
|
-
version: "1.197.0-preview.
|
|
45869
|
+
version: "1.197.0-preview.66",
|
|
45194
45870
|
description: "Cross platform CLI for UiPath",
|
|
45195
45871
|
repository: {
|
|
45196
45872
|
type: "git",
|
|
@@ -80425,6 +81101,9 @@ var init_selectTenant = __esm(() => {
|
|
|
80425
81101
|
]);
|
|
80426
81102
|
});
|
|
80427
81103
|
|
|
81104
|
+
// ../auth/src/types.ts
|
|
81105
|
+
var AUTH_FLOW_ENV_VAR = "UIPATH_AUTH_FLOW";
|
|
81106
|
+
|
|
80428
81107
|
// ../auth/src/interactive.ts
|
|
80429
81108
|
var interactiveLoginWithDeps = async (options, deps) => {
|
|
80430
81109
|
const {
|
|
@@ -80474,6 +81153,7 @@ var interactiveLoginWithDeps = async (options, deps) => {
|
|
|
80474
81153
|
if (noBrowser && !resolvedSecret && !onEvent) {
|
|
80475
81154
|
throw new Error("noBrowser login requires an onEvent subscriber to receive the " + "auth-url event — the authorize URL is delivered through it.");
|
|
80476
81155
|
}
|
|
81156
|
+
const authFlow = resolvedSecret ? "client_credentials" : "authorization_code";
|
|
80477
81157
|
const authPromise = resolvedSecret ? (async () => {
|
|
80478
81158
|
return await clientCredentials({
|
|
80479
81159
|
clientId: config2.clientId,
|
|
@@ -80504,7 +81184,8 @@ var interactiveLoginWithDeps = async (options, deps) => {
|
|
|
80504
81184
|
issuerAsserter(tokens.UIPATH_ACCESS_TOKEN, config2.baseUrl);
|
|
80505
81185
|
const credentials = {
|
|
80506
81186
|
...tokens,
|
|
80507
|
-
UIPATH_URL: config2.baseUrl
|
|
81187
|
+
UIPATH_URL: config2.baseUrl,
|
|
81188
|
+
[AUTH_FLOW_ENV_VAR]: authFlow
|
|
80508
81189
|
};
|
|
80509
81190
|
try {
|
|
80510
81191
|
const tokenData = jwtParser(tokens.UIPATH_ACCESS_TOKEN);
|
|
@@ -81098,7 +81779,8 @@ __export(exports_src2, {
|
|
|
81098
81779
|
DEFAULT_AUTH_FILENAME: () => DEFAULT_AUTH_FILENAME,
|
|
81099
81780
|
ClientCredentialsAuthenticationError: () => ClientCredentialsAuthenticationError,
|
|
81100
81781
|
AuthProfileValidationError: () => AuthProfileValidationError,
|
|
81101
|
-
AUTH_TIMEOUT_ERROR_CODE: () => AUTH_TIMEOUT_ERROR_CODE
|
|
81782
|
+
AUTH_TIMEOUT_ERROR_CODE: () => AUTH_TIMEOUT_ERROR_CODE,
|
|
81783
|
+
AUTH_FLOW_ENV_VAR: () => AUTH_FLOW_ENV_VAR
|
|
81102
81784
|
});
|
|
81103
81785
|
var authenticate = async ({
|
|
81104
81786
|
baseUrl,
|
|
@@ -81848,7 +82530,7 @@ var init_helpFormatter = __esm(() => {
|
|
|
81848
82530
|
});
|
|
81849
82531
|
|
|
81850
82532
|
// src/utils/parseError.ts
|
|
81851
|
-
function
|
|
82533
|
+
function commandPartsFromArgs(cleanedArgs) {
|
|
81852
82534
|
const commandParts = [];
|
|
81853
82535
|
const userArgs = cleanedArgs.slice(2);
|
|
81854
82536
|
for (let i = 0;i < userArgs.length; i++) {
|
|
@@ -81864,6 +82546,13 @@ function helpInstructions(cleanedArgs) {
|
|
|
81864
82546
|
}
|
|
81865
82547
|
commandParts.push(arg);
|
|
81866
82548
|
}
|
|
82549
|
+
return commandParts;
|
|
82550
|
+
}
|
|
82551
|
+
function commandEventNameFromArgs(cleanedArgs) {
|
|
82552
|
+
return ["uip", ...commandPartsFromArgs(cleanedArgs)].join(".");
|
|
82553
|
+
}
|
|
82554
|
+
function helpInstructions(cleanedArgs) {
|
|
82555
|
+
const commandParts = commandPartsFromArgs(cleanedArgs);
|
|
81867
82556
|
const command = ["uip", ...commandParts].join(" ");
|
|
81868
82557
|
return `Run '${command} --help' for usage information.`;
|
|
81869
82558
|
}
|
|
@@ -81875,7 +82564,21 @@ function instructionsForUnknownCommand(cleanedArgs) {
|
|
|
81875
82564
|
}
|
|
81876
82565
|
return "Run 'uip --help' to list available commands.";
|
|
81877
82566
|
}
|
|
81878
|
-
|
|
82567
|
+
function trackCommandFailure(error51, cleanedArgs, exitCode, context, options) {
|
|
82568
|
+
const recordedFailure = takeRecordedCommandFailureTelemetry();
|
|
82569
|
+
telemetry.trackEvent(options?.eventName ?? commandEventNameFromArgs(cleanedArgs), {
|
|
82570
|
+
command: "true",
|
|
82571
|
+
duration: String(options?.durationMs ?? 0),
|
|
82572
|
+
success: "false",
|
|
82573
|
+
...buildCommandTerminalTelemetryProperties({
|
|
82574
|
+
error: error51,
|
|
82575
|
+
exitCode,
|
|
82576
|
+
recordedFailure,
|
|
82577
|
+
pollSignal: context.pollSignal
|
|
82578
|
+
})
|
|
82579
|
+
});
|
|
82580
|
+
}
|
|
82581
|
+
async function handleParseError(error51, cleanedArgs, context, telemetryOptions) {
|
|
81879
82582
|
const isObj = error51 !== null && typeof error51 === "object";
|
|
81880
82583
|
const e = isObj ? error51 : {};
|
|
81881
82584
|
const code = typeof e.code === "string" ? e.code : undefined;
|
|
@@ -81898,10 +82601,13 @@ async function handleParseError(error51, cleanedArgs, context) {
|
|
|
81898
82601
|
Instructions: instructions,
|
|
81899
82602
|
Retry: "RetryWillNotFix"
|
|
81900
82603
|
});
|
|
82604
|
+
const finalExitCode = process.exitCode ? Number(process.exitCode) : 1;
|
|
82605
|
+
trackCommandFailure(error51, cleanedArgs, finalExitCode, context, telemetryOptions);
|
|
81901
82606
|
await telemetryFlushAndShutdown();
|
|
81902
|
-
context.exit(
|
|
82607
|
+
context.exit(finalExitCode);
|
|
81903
82608
|
return;
|
|
81904
82609
|
}
|
|
82610
|
+
trackCommandFailure(error51, cleanedArgs, process.exitCode ? Number(process.exitCode) : 1, context, telemetryOptions);
|
|
81905
82611
|
await telemetryFlushAndShutdown();
|
|
81906
82612
|
context.exit(process.exitCode ? Number(process.exitCode) : 1);
|
|
81907
82613
|
}
|
|
@@ -81935,6 +82641,53 @@ function findUnknownHelpCommand(root, positionals, allArgs) {
|
|
|
81935
82641
|
}
|
|
81936
82642
|
|
|
81937
82643
|
// cli.core.ts
|
|
82644
|
+
function findSubcommand(command, token) {
|
|
82645
|
+
return command.commands.find((subcommand) => subcommand.name() === token || subcommand.aliases().includes(token));
|
|
82646
|
+
}
|
|
82647
|
+
function commandEventNameFromProgram(program2, cleanedArgs) {
|
|
82648
|
+
const parts = [];
|
|
82649
|
+
let current = program2;
|
|
82650
|
+
const userArgs = cleanedArgs.slice(2);
|
|
82651
|
+
for (let i = 0;i < userArgs.length; i++) {
|
|
82652
|
+
const token = userArgs[i];
|
|
82653
|
+
if (token === "--") {
|
|
82654
|
+
break;
|
|
82655
|
+
}
|
|
82656
|
+
if (token.startsWith("-")) {
|
|
82657
|
+
if (!token.includes("=") && i + 1 < userArgs.length && !userArgs[i + 1].startsWith("-")) {
|
|
82658
|
+
i++;
|
|
82659
|
+
}
|
|
82660
|
+
continue;
|
|
82661
|
+
}
|
|
82662
|
+
const subcommand = findSubcommand(current, token);
|
|
82663
|
+
if (!subcommand) {
|
|
82664
|
+
if (parts.length === 0) {
|
|
82665
|
+
parts.push(token);
|
|
82666
|
+
}
|
|
82667
|
+
break;
|
|
82668
|
+
}
|
|
82669
|
+
parts.push(subcommand.name());
|
|
82670
|
+
current = subcommand;
|
|
82671
|
+
}
|
|
82672
|
+
return ["uip", ...parts].join(".");
|
|
82673
|
+
}
|
|
82674
|
+
function trackRecordedCommandFailure(eventName, exitCode, durationMs, context, error51) {
|
|
82675
|
+
const recordedFailure = takeRecordedCommandFailureTelemetry();
|
|
82676
|
+
if (!recordedFailure) {
|
|
82677
|
+
return;
|
|
82678
|
+
}
|
|
82679
|
+
telemetry.trackEvent(eventName, {
|
|
82680
|
+
command: "true",
|
|
82681
|
+
duration: String(durationMs),
|
|
82682
|
+
success: "false",
|
|
82683
|
+
...buildCommandTerminalTelemetryProperties({
|
|
82684
|
+
error: error51,
|
|
82685
|
+
exitCode,
|
|
82686
|
+
recordedFailure,
|
|
82687
|
+
pollSignal: context.pollSignal
|
|
82688
|
+
})
|
|
82689
|
+
});
|
|
82690
|
+
}
|
|
81938
82691
|
function errorMessage2(error51) {
|
|
81939
82692
|
return error51 instanceof Error ? error51.message : String(error51);
|
|
81940
82693
|
}
|
|
@@ -82039,10 +82792,20 @@ async function initProgram(context, hooks = {}) {
|
|
|
82039
82792
|
}
|
|
82040
82793
|
})();
|
|
82041
82794
|
const agent = detectAgent();
|
|
82795
|
+
const defaultTelemetryProperties = {
|
|
82796
|
+
cli_version: package_default.version
|
|
82797
|
+
};
|
|
82798
|
+
if (agent !== undefined) {
|
|
82799
|
+
defaultTelemetryProperties.agent = agent;
|
|
82800
|
+
const agentVersion = detectAgentVersion();
|
|
82801
|
+
if (agentVersion !== undefined) {
|
|
82802
|
+
defaultTelemetryProperties.agent_version = agentVersion;
|
|
82803
|
+
}
|
|
82804
|
+
}
|
|
82042
82805
|
await Promise.all([
|
|
82043
82806
|
telemetryInit({
|
|
82044
82807
|
version: package_default.version,
|
|
82045
|
-
|
|
82808
|
+
defaultProperties: defaultTelemetryProperties
|
|
82046
82809
|
}).then(() => logger.debug("Telemetry initialized")).then(async () => {
|
|
82047
82810
|
if (hooks.afterTelemetryInit) {
|
|
82048
82811
|
await hooks.afterTelemetryInit();
|
|
@@ -82064,22 +82827,35 @@ function finalizeProgram(args) {
|
|
|
82064
82827
|
}
|
|
82065
82828
|
async function parseAndExit(program2, cleanedArgs, context) {
|
|
82066
82829
|
logger.debug(`Parsing args: ${cleanedArgs.slice(2).join(" ")}`);
|
|
82830
|
+
const startTime = performance.now();
|
|
82831
|
+
const initialCommandEventName = commandEventNameFromProgram(program2, cleanedArgs);
|
|
82067
82832
|
const userArgs = cleanedArgs.slice(2);
|
|
82068
82833
|
const firstToken = userArgs.find((a) => !a.startsWith("-"));
|
|
82069
82834
|
const unknownRoot = firstToken && findUnknownHelpCommand(program2, [firstToken], userArgs);
|
|
82070
82835
|
if (unknownRoot) {
|
|
82836
|
+
const message = `error: unknown command '${unknownRoot}'`;
|
|
82071
82837
|
OutputFormatter.error({
|
|
82072
82838
|
Result: RESULTS.ValidationError,
|
|
82073
|
-
Message:
|
|
82839
|
+
Message: message,
|
|
82074
82840
|
Instructions: "Check command arguments and options. Run 'uip --help' for available commands."
|
|
82075
82841
|
});
|
|
82842
|
+
const exitCode = process.exitCode ? Number(process.exitCode) : 1;
|
|
82843
|
+
trackRecordedCommandFailure(initialCommandEventName, exitCode, performance.now() - startTime, context, { code: "commander.unknownCommand", message });
|
|
82076
82844
|
await telemetryFlushAndShutdown();
|
|
82077
|
-
context.exit(
|
|
82845
|
+
context.exit(exitCode);
|
|
82078
82846
|
return;
|
|
82079
82847
|
}
|
|
82080
82848
|
const [parseError] = await catchError(program2.parseAsync(cleanedArgs));
|
|
82081
82849
|
if (parseError) {
|
|
82082
|
-
await handleParseError(parseError, cleanedArgs, context
|
|
82850
|
+
await handleParseError(parseError, cleanedArgs, context, {
|
|
82851
|
+
eventName: commandEventNameFromProgram(program2, cleanedArgs),
|
|
82852
|
+
durationMs: performance.now() - startTime
|
|
82853
|
+
});
|
|
82854
|
+
} else {
|
|
82855
|
+
const exitCode = process.exitCode ? Number(process.exitCode) : 0;
|
|
82856
|
+
if (exitCode !== 0) {
|
|
82857
|
+
trackRecordedCommandFailure(commandEventNameFromProgram(program2, cleanedArgs), exitCode, performance.now() - startTime, context);
|
|
82858
|
+
}
|
|
82083
82859
|
}
|
|
82084
82860
|
if (!process.exitCode || process.exitCode === 0) {
|
|
82085
82861
|
logger.debug("Command completed — flushing telemetry");
|
|
@@ -89341,7 +90117,12 @@ var promptSelect = async (options, message) => {
|
|
|
89341
90117
|
});
|
|
89342
90118
|
} catch (error51) {
|
|
89343
90119
|
if (error51 instanceof Error && error51.name === "ExitPromptError") {
|
|
89344
|
-
|
|
90120
|
+
const cancellation = Object.assign(new Error("Selection cancelled by user"), {
|
|
90121
|
+
exitCode: 130,
|
|
90122
|
+
terminalSignal: "SIGINT"
|
|
90123
|
+
});
|
|
90124
|
+
cancellation.name = "ExitPromptError";
|
|
90125
|
+
throw cancellation;
|
|
89345
90126
|
}
|
|
89346
90127
|
throw error51;
|
|
89347
90128
|
}
|
|
@@ -89426,7 +90207,9 @@ var init_auth = __esm(() => {
|
|
|
89426
90207
|
});
|
|
89427
90208
|
|
|
89428
90209
|
// src/services/authTelemetry.ts
|
|
89429
|
-
var AuthTelemetryEvents,
|
|
90210
|
+
var AuthTelemetryEvents, readAuthFlow = (value) => {
|
|
90211
|
+
return value === "authorization_code" || value === "client_credentials" ? value : undefined;
|
|
90212
|
+
}, UIPATH_EMAIL_DOMAIN = "uipath.com", decodeTokenClaims = (accessToken) => {
|
|
89430
90213
|
try {
|
|
89431
90214
|
const parts = accessToken.split(".");
|
|
89432
90215
|
if (parts.length !== 3) {
|
|
@@ -89436,11 +90219,23 @@ var AuthTelemetryEvents, getUserIdFromToken = (accessToken) => {
|
|
|
89436
90219
|
const base643 = payload.replace(/-/g, "+").replace(/_/g, "/");
|
|
89437
90220
|
const padded = base643 + "=".repeat((4 - base643.length % 4) % 4);
|
|
89438
90221
|
const decoded = atob(padded);
|
|
89439
|
-
|
|
89440
|
-
return claims.sub;
|
|
90222
|
+
return JSON.parse(decoded);
|
|
89441
90223
|
} catch {
|
|
89442
90224
|
return;
|
|
89443
90225
|
}
|
|
90226
|
+
}, isInternalUserEmail = (email3) => {
|
|
90227
|
+
const at = email3.lastIndexOf("@");
|
|
90228
|
+
if (at < 0) {
|
|
90229
|
+
return false;
|
|
90230
|
+
}
|
|
90231
|
+
const domain2 = email3.slice(at + 1).trim().toLowerCase();
|
|
90232
|
+
return domain2 === UIPATH_EMAIL_DOMAIN || domain2.endsWith(`.${UIPATH_EMAIL_DOMAIN}`);
|
|
90233
|
+
}, getInternalUserFlag = (claims) => {
|
|
90234
|
+
const email3 = claims?.email ?? claims?.preferred_username;
|
|
90235
|
+
if (typeof email3 !== "string" || !email3.includes("@")) {
|
|
90236
|
+
return;
|
|
90237
|
+
}
|
|
90238
|
+
return String(isInternalUserEmail(email3));
|
|
89444
90239
|
}, readAuthIdentity = async (deps) => {
|
|
89445
90240
|
const envAuthEnabled = deps.isEnvAuthEnabled ?? isEnvAuthEnabled;
|
|
89446
90241
|
const readEnv = deps.readAuthFromEnv ?? readAuthFromEnv;
|
|
@@ -89454,7 +90249,8 @@ var AuthTelemetryEvents, getUserIdFromToken = (accessToken) => {
|
|
|
89454
90249
|
return {
|
|
89455
90250
|
accessToken: status.accessToken,
|
|
89456
90251
|
tenantId: status.tenantId,
|
|
89457
|
-
organizationId: status.organizationId
|
|
90252
|
+
organizationId: status.organizationId,
|
|
90253
|
+
baseUrl: status.baseUrl
|
|
89458
90254
|
};
|
|
89459
90255
|
}
|
|
89460
90256
|
const [resolveError, resolved] = await catchError(resolveEnvFilePath(getProfileFilePath() ?? DEFAULT_ENV_FILENAME));
|
|
@@ -89465,18 +90261,28 @@ var AuthTelemetryEvents, getUserIdFromToken = (accessToken) => {
|
|
|
89465
90261
|
return;
|
|
89466
90262
|
return {
|
|
89467
90263
|
accessToken: credentials.UIPATH_ACCESS_TOKEN,
|
|
90264
|
+
authFlow: readAuthFlow(credentials[AUTH_FLOW_ENV_VAR]),
|
|
89468
90265
|
tenantId: credentials.UIPATH_TENANT_ID,
|
|
89469
|
-
organizationId: credentials.UIPATH_ORGANIZATION_ID
|
|
90266
|
+
organizationId: credentials.UIPATH_ORGANIZATION_ID,
|
|
90267
|
+
baseUrl: credentials.UIPATH_URL
|
|
89470
90268
|
};
|
|
89471
90269
|
}, populateTelemetryAuthContext = async (deps = {}) => {
|
|
89472
90270
|
const identity = await readAuthIdentity(deps);
|
|
89473
|
-
if (!identity)
|
|
90271
|
+
if (!identity) {
|
|
90272
|
+
setExecutionContextAuthSignal(undefined);
|
|
89474
90273
|
return;
|
|
89475
|
-
|
|
90274
|
+
}
|
|
90275
|
+
setExecutionContextAuthSignal(identity.authFlow === "client_credentials" ? "service_account" : undefined);
|
|
90276
|
+
const claims = identity.accessToken ? decodeTokenClaims(identity.accessToken) : undefined;
|
|
90277
|
+
const userId = claims?.sub;
|
|
90278
|
+
const isInternalUser = getInternalUserFlag(claims);
|
|
90279
|
+
const envProps = identity.baseUrl ? buildEnvironmentProperties(identity.baseUrl) : {};
|
|
89476
90280
|
const defaultProps = {
|
|
89477
90281
|
...userId ? { CloudUserId: userId } : {},
|
|
89478
90282
|
...identity.tenantId ? { CloudTenantId: identity.tenantId } : {},
|
|
89479
|
-
...identity.organizationId ? { CloudOrganizationId: identity.organizationId } : {}
|
|
90283
|
+
...identity.organizationId ? { CloudOrganizationId: identity.organizationId } : {},
|
|
90284
|
+
...envProps,
|
|
90285
|
+
...isInternalUser !== undefined ? { IsInternalUser: isInternalUser } : {}
|
|
89480
90286
|
};
|
|
89481
90287
|
if (Object.keys(defaultProps).length === 0)
|
|
89482
90288
|
return;
|
|
@@ -89624,6 +90430,7 @@ function buildLoginData(credentials) {
|
|
|
89624
90430
|
const {
|
|
89625
90431
|
UIPATH_ACCESS_TOKEN: _token,
|
|
89626
90432
|
UIPATH_REFRESH_TOKEN: _refresh,
|
|
90433
|
+
[AUTH_FLOW_ENV_VAR]: _authFlow,
|
|
89627
90434
|
...safeCredentials
|
|
89628
90435
|
} = credentials;
|
|
89629
90436
|
if (getOutputFormat() === "table") {
|
|
@@ -89675,6 +90482,13 @@ function emitRefreshFailure(status) {
|
|
|
89675
90482
|
...status.refreshTelemetrySuppressed ? { SuppressTelemetry: true } : {}
|
|
89676
90483
|
});
|
|
89677
90484
|
}
|
|
90485
|
+
function isUserCancellationError(error51) {
|
|
90486
|
+
if (!(error51 instanceof Error)) {
|
|
90487
|
+
return false;
|
|
90488
|
+
}
|
|
90489
|
+
const exitCode = error51.exitCode;
|
|
90490
|
+
return error51.name === "ExitPromptError" || exitCode === 130 || error51.message === "Selection cancelled by user";
|
|
90491
|
+
}
|
|
89678
90492
|
function defaultRefreshFailureInstructions(status) {
|
|
89679
90493
|
switch (status.loginStatus) {
|
|
89680
90494
|
case "Refresh Failed":
|
|
@@ -89757,6 +90571,9 @@ Open this URL in a browser to sign in:
|
|
|
89757
90571
|
onEvent: handleAuthEvent
|
|
89758
90572
|
}));
|
|
89759
90573
|
if (error51) {
|
|
90574
|
+
if (isUserCancellationError(error51)) {
|
|
90575
|
+
throw error51;
|
|
90576
|
+
}
|
|
89760
90577
|
if (isTenantSelectionError(error51)) {
|
|
89761
90578
|
trackAuthLogin(authFlow, { success: true });
|
|
89762
90579
|
trackTenantSelection({
|
|
@@ -112888,6 +113705,14 @@ var init_tools = __esm(() => {
|
|
|
112888
113705
|
});
|
|
112889
113706
|
|
|
112890
113707
|
// src/commands/track.ts
|
|
113708
|
+
function isParsableJson(raw) {
|
|
113709
|
+
try {
|
|
113710
|
+
JSON.parse(raw);
|
|
113711
|
+
return true;
|
|
113712
|
+
} catch {
|
|
113713
|
+
return false;
|
|
113714
|
+
}
|
|
113715
|
+
}
|
|
112891
113716
|
async function readStdinWithTimeout(timeoutMs) {
|
|
112892
113717
|
let timer;
|
|
112893
113718
|
const timeout = new Promise((resolve2) => {
|
|
@@ -112903,6 +113728,21 @@ async function readStdinWithTimeout(timeoutMs) {
|
|
|
112903
113728
|
clearTimeout(timer);
|
|
112904
113729
|
}
|
|
112905
113730
|
}
|
|
113731
|
+
function resolveSkillsEventName(raw) {
|
|
113732
|
+
let token;
|
|
113733
|
+
try {
|
|
113734
|
+
token = JSON.parse(raw)?.eventName;
|
|
113735
|
+
} catch {
|
|
113736
|
+
return null;
|
|
113737
|
+
}
|
|
113738
|
+
if (token === undefined || token === "") {
|
|
113739
|
+
return SKILLS_EVENTS[DEFAULT_EVENT_TOKEN];
|
|
113740
|
+
}
|
|
113741
|
+
if (typeof token !== "string") {
|
|
113742
|
+
return null;
|
|
113743
|
+
}
|
|
113744
|
+
return SKILLS_EVENTS[token] ?? null;
|
|
113745
|
+
}
|
|
112906
113746
|
function buildEventProperties(raw) {
|
|
112907
113747
|
let payload;
|
|
112908
113748
|
try {
|
|
@@ -112919,10 +113759,26 @@ function buildEventProperties(raw) {
|
|
|
112919
113759
|
continue;
|
|
112920
113760
|
}
|
|
112921
113761
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
112922
|
-
|
|
113762
|
+
const propertyKey = key === LEGACY_SESSION_ID_PROPERTY ? TELEMETRY_SESSION_ID_PROPERTY : key;
|
|
113763
|
+
if (key === LEGACY_SESSION_ID_PROPERTY && properties[TELEMETRY_SESSION_ID_PROPERTY] !== undefined) {
|
|
113764
|
+
continue;
|
|
113765
|
+
}
|
|
113766
|
+
properties[propertyKey] = String(value);
|
|
112923
113767
|
}
|
|
112924
113768
|
}
|
|
112925
|
-
|
|
113769
|
+
let attribution = buildSkillEventTelemetryAttribution(properties.skill_name ?? properties.skillName, properties.uipSubcommand);
|
|
113770
|
+
if (!attribution.skill_name && properties.skillName !== undefined) {
|
|
113771
|
+
attribution = buildSkillEventTelemetryAttribution(properties.skillName, properties.uipSubcommand);
|
|
113772
|
+
}
|
|
113773
|
+
delete properties.skill_name;
|
|
113774
|
+
Object.assign(properties, attribution);
|
|
113775
|
+
if (Object.keys(properties).length === 0) {
|
|
113776
|
+
return null;
|
|
113777
|
+
}
|
|
113778
|
+
if (process.env[TELEMETRY_SESSION_ID_ENV]?.trim()) {
|
|
113779
|
+
properties[TELEMETRY_SESSION_ID_PROPERTY] = getTelemetrySessionId();
|
|
113780
|
+
}
|
|
113781
|
+
return properties;
|
|
112926
113782
|
}
|
|
112927
113783
|
function registerTrackCommand(program2) {
|
|
112928
113784
|
program2.command("track", { hidden: true }).description("Ingest a skills-plugin telemetry event from stdin").action(async () => {
|
|
@@ -112936,39 +113792,53 @@ function registerTrackCommand(program2) {
|
|
|
112936
113792
|
logger.debug("[track] no payload on stdin.");
|
|
112937
113793
|
return;
|
|
112938
113794
|
}
|
|
113795
|
+
const eventName = resolveSkillsEventName(raw);
|
|
113796
|
+
if (!eventName) {
|
|
113797
|
+
logger.debug(isParsableJson(raw) ? "[track] unknown or invalid eventName; dropping event." : "[track] malformed JSON payload; dropping event.");
|
|
113798
|
+
return;
|
|
113799
|
+
}
|
|
112939
113800
|
const properties = buildEventProperties(raw);
|
|
112940
113801
|
if (!properties) {
|
|
112941
113802
|
logger.debug("[track] no usable fields; dropping event.");
|
|
112942
113803
|
return;
|
|
112943
113804
|
}
|
|
112944
113805
|
properties[SOURCE_DIMENSION_KEY] = SOURCE_DIMENSION_VALUE;
|
|
112945
|
-
telemetry.trackEvent(
|
|
113806
|
+
telemetry.trackEvent(eventName, redactProperties(properties));
|
|
112946
113807
|
} catch (error52) {
|
|
112947
113808
|
logger.debug(`[track] dropping event: ${String(error52)}`);
|
|
112948
113809
|
}
|
|
112949
113810
|
});
|
|
112950
113811
|
}
|
|
112951
|
-
var
|
|
113812
|
+
var SKILLS_EVENTS, DEFAULT_EVENT_TOKEN = "tool-use", SOURCE_DIMENSION_KEY = "source", SOURCE_DIMENSION_VALUE = "skills-plugin", LEGACY_SESSION_ID_PROPERTY = "sessionId", STDIN_TIMEOUT_MS = 1e4, ALLOWED_FIELDS;
|
|
112952
113813
|
var init_track = __esm(() => {
|
|
112953
113814
|
init_src2();
|
|
113815
|
+
SKILLS_EVENTS = {
|
|
113816
|
+
"tool-use": "uip.skills.tool-use",
|
|
113817
|
+
"session-start": "uip.skills.session-start",
|
|
113818
|
+
"session-end": "uip.skills.session-end",
|
|
113819
|
+
completion: "uip.skills.completion"
|
|
113820
|
+
};
|
|
112954
113821
|
ALLOWED_FIELDS = new Set([
|
|
112955
113822
|
"schemaVersion",
|
|
112956
113823
|
"toolName",
|
|
112957
113824
|
"skillName",
|
|
113825
|
+
"skill_name",
|
|
112958
113826
|
"uipSubcommand",
|
|
112959
113827
|
"fileExtension",
|
|
112960
|
-
"environment",
|
|
112961
|
-
"baseUrl",
|
|
112962
113828
|
"outcome",
|
|
112963
113829
|
"permissionMode",
|
|
112964
113830
|
"effortLevel",
|
|
112965
113831
|
"skillsVersion",
|
|
112966
113832
|
"toolUseId",
|
|
112967
|
-
|
|
113833
|
+
TELEMETRY_SESSION_ID_PROPERTY,
|
|
113834
|
+
LEGACY_SESSION_ID_PROPERTY,
|
|
112968
113835
|
"subagentModel",
|
|
112969
113836
|
"subagentType",
|
|
112970
113837
|
"agentType",
|
|
112971
|
-
"durationMs"
|
|
113838
|
+
"durationMs",
|
|
113839
|
+
"session_source",
|
|
113840
|
+
"reason",
|
|
113841
|
+
"agent_model"
|
|
112972
113842
|
]);
|
|
112973
113843
|
});
|
|
112974
113844
|
|
|
@@ -113583,6 +114453,38 @@ var init_installPath = __esm(() => {
|
|
|
113583
114453
|
init_localWorkspace();
|
|
113584
114454
|
});
|
|
113585
114455
|
|
|
114456
|
+
// src/services/installTelemetry.ts
|
|
114457
|
+
function shouldPopulateTelemetryInstallContext(args) {
|
|
114458
|
+
const separatorIndex = args.indexOf("--");
|
|
114459
|
+
const parsedArgs = separatorIndex === -1 ? args : args.slice(0, separatorIndex);
|
|
114460
|
+
return !parsedArgs.some((arg) => NO_COMMAND_TELEMETRY_FLAGS.has(arg));
|
|
114461
|
+
}
|
|
114462
|
+
var INSTALL_ID_TELEMETRY_KEY = "install_id", NO_COMMAND_TELEMETRY_FLAGS, populateTelemetryInstallContext = async (deps = {}) => {
|
|
114463
|
+
const telemetryDisabled = deps.isTelemetryDisabled ?? isTelemetryDisabled;
|
|
114464
|
+
if (telemetryDisabled()) {
|
|
114465
|
+
return;
|
|
114466
|
+
}
|
|
114467
|
+
const resolveDeviceId = deps.getOrCreateDeviceId ?? getOrCreateDeviceId;
|
|
114468
|
+
const [error52, deviceId] = await catchError(resolveDeviceId);
|
|
114469
|
+
if (error52 || !deviceId?.trim()) {
|
|
114470
|
+
if (error52) {
|
|
114471
|
+
logger.debug(`[Telemetry] install context unavailable: ${error52.message}`);
|
|
114472
|
+
}
|
|
114473
|
+
return;
|
|
114474
|
+
}
|
|
114475
|
+
const defaultProps = {
|
|
114476
|
+
[INSTALL_ID_TELEMETRY_KEY]: deviceId.trim()
|
|
114477
|
+
};
|
|
114478
|
+
setGlobalTelemetryProperties(defaultProps);
|
|
114479
|
+
telemetry.setDefaultProperties(defaultProps);
|
|
114480
|
+
logger.debug("[Telemetry] install context populated at startup");
|
|
114481
|
+
};
|
|
114482
|
+
var init_installTelemetry = __esm(() => {
|
|
114483
|
+
init_src2();
|
|
114484
|
+
init_deviceId();
|
|
114485
|
+
NO_COMMAND_TELEMETRY_FLAGS = new Set(["-h", "--help", "-v", "--version"]);
|
|
114486
|
+
});
|
|
114487
|
+
|
|
113586
114488
|
// src/services/tool-manager.ts
|
|
113587
114489
|
class ToolManager {
|
|
113588
114490
|
toolsDirs;
|
|
@@ -114122,7 +115024,8 @@ function registerToolCommands(program2, discovered, context) {
|
|
|
114122
115024
|
OutputFormatter.error({
|
|
114123
115025
|
Result: RESULTS.ConfigError,
|
|
114124
115026
|
Message: `Failed to load tool '${entry.toolName}' (version: ${entry.version || "unknown"}, path: ${entry.toolPath}).`,
|
|
114125
|
-
Instructions: `Try reinstalling with 'uip tools install ${entry.commandPrefix}'
|
|
115027
|
+
Instructions: `Try reinstalling with 'uip tools install ${entry.commandPrefix}'.`,
|
|
115028
|
+
TelemetryErrorClass: "missing_dependency"
|
|
114126
115029
|
});
|
|
114127
115030
|
return;
|
|
114128
115031
|
}
|
|
@@ -114142,7 +115045,8 @@ function registerToolCommands(program2, discovered, context) {
|
|
|
114142
115045
|
OutputFormatter.error({
|
|
114143
115046
|
Result: RESULTS.Failure,
|
|
114144
115047
|
Message: `Failed to register commands from tool '${tool.metadata.name}': ${regError.message}`,
|
|
114145
|
-
Instructions: "This might be due to a command name conflict with existing commands."
|
|
115048
|
+
Instructions: "This might be due to a command name conflict with existing commands.",
|
|
115049
|
+
TelemetryErrorClass: "internal"
|
|
114146
115050
|
});
|
|
114147
115051
|
return;
|
|
114148
115052
|
}
|
|
@@ -114156,7 +115060,8 @@ function registerToolCommands(program2, discovered, context) {
|
|
|
114156
115060
|
OutputFormatter.error({
|
|
114157
115061
|
Result: RESULTS.ValidationError,
|
|
114158
115062
|
Message: `error: unknown command '${unknownSub}'`,
|
|
114159
|
-
Instructions: `Check command arguments and options. Run 'uip ${entry.commandPrefix} --help' for available subcommands
|
|
115063
|
+
Instructions: `Check command arguments and options. Run 'uip ${entry.commandPrefix} --help' for available subcommands.`,
|
|
115064
|
+
TelemetryErrorClass: "validation"
|
|
114160
115065
|
});
|
|
114161
115066
|
context.exit(process.exitCode ? Number(process.exitCode) : 1);
|
|
114162
115067
|
return;
|
|
@@ -114214,6 +115119,9 @@ async function buildNodeProgram(context) {
|
|
|
114214
115119
|
logLevelWasExplicit,
|
|
114215
115120
|
profile
|
|
114216
115121
|
}) => {
|
|
115122
|
+
if (shouldPopulateTelemetryInstallContext(context.args)) {
|
|
115123
|
+
await populateTelemetryInstallContext();
|
|
115124
|
+
}
|
|
114217
115125
|
const { setActiveAuthProfile: setActiveAuthProfile2, setAuthFileConfig: setAuthFileConfig2 } = await Promise.resolve().then(() => (init_src3(), exports_src2));
|
|
114218
115126
|
setActiveAuthProfile2(profile);
|
|
114219
115127
|
const [configErr, config2] = await catchError(loadConfigAsync());
|
|
@@ -114318,6 +115226,7 @@ var init_cli_node = __esm(() => {
|
|
|
114318
115226
|
init_loadConfig();
|
|
114319
115227
|
init_authTelemetry();
|
|
114320
115228
|
init_installPath();
|
|
115229
|
+
init_installTelemetry();
|
|
114321
115230
|
init_tool_manager();
|
|
114322
115231
|
init_versionSync();
|
|
114323
115232
|
init_autoInstall();
|
|
@@ -114452,4 +115361,4 @@ export {
|
|
|
114452
115361
|
ready
|
|
114453
115362
|
};
|
|
114454
115363
|
|
|
114455
|
-
//# debugId=
|
|
115364
|
+
//# debugId=08E496A669D4128264756E2164756E21
|