@uipath/traces-tool 0.1.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tool.js +86 -38
- package/package.json +7 -8
package/dist/tool.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "@uipath/traces-tool",
|
|
4
|
-
version: "0.
|
|
4
|
+
version: "0.9.0",
|
|
5
5
|
description: "Fetch LLM Observability traces for UiPath jobs",
|
|
6
6
|
private: false,
|
|
7
7
|
keywords: [
|
|
@@ -26,14 +26,12 @@ var package_default = {
|
|
|
26
26
|
test: "vitest run",
|
|
27
27
|
"test:coverage": "vitest run --coverage"
|
|
28
28
|
},
|
|
29
|
-
peerDependencies: {
|
|
30
|
-
commander: "^14.0.3",
|
|
31
|
-
"@uipath/common": "^0.1.7",
|
|
32
|
-
"@uipath/auth": "^0.1.6"
|
|
33
|
-
},
|
|
34
29
|
devDependencies: {
|
|
30
|
+
"@uipath/auth": "workspace:*",
|
|
31
|
+
"@uipath/common": "workspace:*",
|
|
35
32
|
"@uipath/orchestrator-sdk": "workspace:*",
|
|
36
33
|
"@types/node": "^25.5.0",
|
|
34
|
+
commander: "^14.0.3",
|
|
37
35
|
typescript: "^5"
|
|
38
36
|
}
|
|
39
37
|
};
|
|
@@ -43,11 +41,12 @@ import {
|
|
|
43
41
|
catchError as catchError2,
|
|
44
42
|
extractErrorMessage,
|
|
45
43
|
OutputFormatter,
|
|
46
|
-
processContext
|
|
44
|
+
processContext,
|
|
45
|
+
RESULTS
|
|
47
46
|
} from "@uipath/common";
|
|
48
47
|
|
|
49
48
|
// src/services/traces-service.ts
|
|
50
|
-
import { getLoginStatusAsync
|
|
49
|
+
import { getLoginStatusAsync } from "@uipath/auth";
|
|
51
50
|
import { catchError } from "@uipath/common";
|
|
52
51
|
|
|
53
52
|
// ../orchestrator-sdk/generated/src/runtime.ts
|
|
@@ -496,7 +495,8 @@ function TestAutomationJobDtoToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
496
495
|
serviceUserName: value["serviceUserName"],
|
|
497
496
|
remoteControlAccess: value["remoteControlAccess"],
|
|
498
497
|
autopilotForRobots: AutopilotForRobotsSettingsDtoToJSON(value["autopilotForRobots"]),
|
|
499
|
-
videoRecordingSettings: VideoRecordingSettingsDtoToJSON(value["videoRecordingSettings"])
|
|
498
|
+
videoRecordingSettings: VideoRecordingSettingsDtoToJSON(value["videoRecordingSettings"]),
|
|
499
|
+
enableCoverageCalculation: value["enableCoverageCalculation"]
|
|
500
500
|
};
|
|
501
501
|
}
|
|
502
502
|
|
|
@@ -1398,6 +1398,7 @@ function MachineDtoFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
1398
1398
|
hostingSlots: json["HostingSlots"] == null ? undefined : json["HostingSlots"],
|
|
1399
1399
|
appTestSlots: json["AppTestSlots"] == null ? undefined : json["AppTestSlots"],
|
|
1400
1400
|
performanceTestSlots: json["PerformanceTestSlots"] == null ? undefined : json["PerformanceTestSlots"],
|
|
1401
|
+
agentSlots: json["AgentSlots"] == null ? undefined : json["AgentSlots"],
|
|
1401
1402
|
automationCloudSlots: json["AutomationCloudSlots"] == null ? undefined : json["AutomationCloudSlots"],
|
|
1402
1403
|
automationCloudTestAutomationSlots: json["AutomationCloudTestAutomationSlots"] == null ? undefined : json["AutomationCloudTestAutomationSlots"],
|
|
1403
1404
|
key: json["Key"] == null ? undefined : json["Key"],
|
|
@@ -1590,6 +1591,7 @@ function MachineFolderDtoFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
1590
1591
|
hostingSlots: json["HostingSlots"] == null ? undefined : json["HostingSlots"],
|
|
1591
1592
|
appTestSlots: json["AppTestSlots"] == null ? undefined : json["AppTestSlots"],
|
|
1592
1593
|
performanceTestSlots: json["PerformanceTestSlots"] == null ? undefined : json["PerformanceTestSlots"],
|
|
1594
|
+
agentSlots: json["AgentSlots"] == null ? undefined : json["AgentSlots"],
|
|
1593
1595
|
automationCloudSlots: json["AutomationCloudSlots"] == null ? undefined : json["AutomationCloudSlots"],
|
|
1594
1596
|
automationCloudTestAutomationSlots: json["AutomationCloudTestAutomationSlots"] == null ? undefined : json["AutomationCloudTestAutomationSlots"],
|
|
1595
1597
|
key: json["Key"] == null ? undefined : json["Key"],
|
|
@@ -2099,7 +2101,8 @@ function StopJobsRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
2099
2101
|
}
|
|
2100
2102
|
return {
|
|
2101
2103
|
strategy: value["strategy"],
|
|
2102
|
-
jobIds: value["jobIds"]
|
|
2104
|
+
jobIds: value["jobIds"],
|
|
2105
|
+
batchExecutionKey: value["batchExecutionKey"]
|
|
2103
2106
|
};
|
|
2104
2107
|
}
|
|
2105
2108
|
|
|
@@ -3006,6 +3009,47 @@ class FoldersApi extends BaseAPI {
|
|
|
3006
3009
|
const response = await this.foldersGetUsersToAssignByFolderidRaw(requestParameters, initOverrides);
|
|
3007
3010
|
return await response.value();
|
|
3008
3011
|
}
|
|
3012
|
+
async foldersIsAccessibleToUserRaw(requestParameters, initOverrides) {
|
|
3013
|
+
if (requestParameters["username"] == null) {
|
|
3014
|
+
throw new RequiredError("username", 'Required parameter "username" was null or undefined when calling foldersIsAccessibleToUser().');
|
|
3015
|
+
}
|
|
3016
|
+
if (requestParameters["type"] == null) {
|
|
3017
|
+
throw new RequiredError("type", 'Required parameter "type" was null or undefined when calling foldersIsAccessibleToUser().');
|
|
3018
|
+
}
|
|
3019
|
+
if (requestParameters["folderKey"] == null) {
|
|
3020
|
+
throw new RequiredError("folderKey", 'Required parameter "folderKey" was null or undefined when calling foldersIsAccessibleToUser().');
|
|
3021
|
+
}
|
|
3022
|
+
const queryParameters = {};
|
|
3023
|
+
if (requestParameters["username"] != null) {
|
|
3024
|
+
queryParameters["username"] = requestParameters["username"];
|
|
3025
|
+
}
|
|
3026
|
+
if (requestParameters["type"] != null) {
|
|
3027
|
+
queryParameters["type"] = requestParameters["type"];
|
|
3028
|
+
}
|
|
3029
|
+
if (requestParameters["folderKey"] != null) {
|
|
3030
|
+
queryParameters["folderKey"] = requestParameters["folderKey"];
|
|
3031
|
+
}
|
|
3032
|
+
const headerParameters = {};
|
|
3033
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
3034
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
|
|
3035
|
+
}
|
|
3036
|
+
let urlPath = `/api/Folders/IsAccessibleToUser`;
|
|
3037
|
+
const response = await this.request({
|
|
3038
|
+
path: urlPath,
|
|
3039
|
+
method: "GET",
|
|
3040
|
+
headers: headerParameters,
|
|
3041
|
+
query: queryParameters
|
|
3042
|
+
}, initOverrides);
|
|
3043
|
+
if (this.isJsonMime(response.headers.get("content-type"))) {
|
|
3044
|
+
return new JSONApiResponse(response);
|
|
3045
|
+
} else {
|
|
3046
|
+
return new TextApiResponse(response);
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
async foldersIsAccessibleToUser(requestParameters, initOverrides) {
|
|
3050
|
+
const response = await this.foldersIsAccessibleToUserRaw(requestParameters, initOverrides);
|
|
3051
|
+
return await response.value();
|
|
3052
|
+
}
|
|
3009
3053
|
async foldersMoveFolderByFolderidRaw(requestParameters, initOverrides) {
|
|
3010
3054
|
if (requestParameters["folderId"] == null) {
|
|
3011
3055
|
throw new RequiredError("folderId", 'Required parameter "folderId" was null or undefined when calling foldersMoveFolderByFolderid().');
|
|
@@ -3981,25 +4025,17 @@ class JobsApi extends BaseAPI {
|
|
|
3981
4025
|
}
|
|
3982
4026
|
}
|
|
3983
4027
|
// ../orchestrator-sdk/src/client-factory.ts
|
|
3984
|
-
import {
|
|
4028
|
+
import { getAuthContext } from "@uipath/auth";
|
|
3985
4029
|
async function createOrchestratorConfig(options) {
|
|
3986
|
-
const
|
|
3987
|
-
|
|
4030
|
+
const ctx = await getAuthContext({
|
|
4031
|
+
tenant: options?.tenant,
|
|
4032
|
+
ensureTokenValidityMinutes: options?.loginValidity,
|
|
4033
|
+
requireOrganizationId: true,
|
|
4034
|
+
requireTenantName: true
|
|
3988
4035
|
});
|
|
3989
|
-
|
|
3990
|
-
const message = status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.";
|
|
3991
|
-
throw new Error(message);
|
|
3992
|
-
}
|
|
3993
|
-
const tenantName = options?.tenant || status.tenantName;
|
|
3994
|
-
if (!tenantName) {
|
|
3995
|
-
throw new Error("Tenant not provided and UIPATH_TENANT_NAME not set. Please provide a tenant argument or set UIPATH_TENANT_NAME.");
|
|
3996
|
-
}
|
|
3997
|
-
if (!status.organizationId) {
|
|
3998
|
-
throw new Error("Organization ID not available from login status. Please ensure you are logged in with an organization context.");
|
|
3999
|
-
}
|
|
4000
|
-
const orchestratorBasePath = `${status.baseUrl}/${status.organizationId}/${tenantName}/orchestrator_`;
|
|
4036
|
+
const orchestratorBasePath = `${ctx.baseUrl}/${ctx.organizationId}/${ctx.tenantName}/orchestrator_`;
|
|
4001
4037
|
const headers = {
|
|
4002
|
-
Authorization: `Bearer ${
|
|
4038
|
+
Authorization: `Bearer ${ctx.accessToken}`
|
|
4003
4039
|
};
|
|
4004
4040
|
if (options?.folderId) {
|
|
4005
4041
|
headers["X-UIPATH-OrganizationUnitId"] = options.folderId;
|
|
@@ -4065,12 +4101,6 @@ async function resolveByPath(foldersApi, folderPath) {
|
|
|
4065
4101
|
displayName: folder.displayName
|
|
4066
4102
|
};
|
|
4067
4103
|
}
|
|
4068
|
-
// ../orchestrator-sdk/src/scripts/generate-sdk.ts
|
|
4069
|
-
import { join } from "node:path";
|
|
4070
|
-
var OUTPUT_DIR = join(process.cwd(), "generated");
|
|
4071
|
-
var TEMP_DIR = join(process.cwd(), "temp");
|
|
4072
|
-
var GENRATE_DIR = join(process.cwd(), "swagger");
|
|
4073
|
-
if (false) {}
|
|
4074
4104
|
// src/services/traces-service.ts
|
|
4075
4105
|
var GUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
4076
4106
|
var TRACE_ID_RE = /^([0-9a-f]{32}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/i;
|
|
@@ -4103,7 +4133,7 @@ async function getTraceIdForJob(jobKey, options) {
|
|
|
4103
4133
|
return job.traceId;
|
|
4104
4134
|
}
|
|
4105
4135
|
async function getSpansForTrace(traceId, options) {
|
|
4106
|
-
const [loginError, loginStatus] = await catchError(
|
|
4136
|
+
const [loginError, loginStatus] = await catchError(getLoginStatusAsync());
|
|
4107
4137
|
if (loginError) {
|
|
4108
4138
|
throw new Error(loginError.message);
|
|
4109
4139
|
}
|
|
@@ -4140,15 +4170,33 @@ async function getSpansForTrace(traceId, options) {
|
|
|
4140
4170
|
}
|
|
4141
4171
|
|
|
4142
4172
|
// src/commands/spans.ts
|
|
4173
|
+
var SPANS_GET_EXAMPLES = [
|
|
4174
|
+
{
|
|
4175
|
+
Description: "Get spans for a trace by job key",
|
|
4176
|
+
Command: "uip traces spans get --job-key a1b2c3d4-0000-0000-0000-000000000001",
|
|
4177
|
+
Output: {
|
|
4178
|
+
Code: "TraceSpans",
|
|
4179
|
+
Data: [
|
|
4180
|
+
{
|
|
4181
|
+
spanId: "00f067aa0ba902b7",
|
|
4182
|
+
traceId: "4bf92f3577b34da6a3ce929d0e0e4736",
|
|
4183
|
+
name: "llm.completion",
|
|
4184
|
+
startTime: "2025-04-15T10:30:00.123Z",
|
|
4185
|
+
endTime: "2025-04-15T10:30:01.456Z"
|
|
4186
|
+
}
|
|
4187
|
+
]
|
|
4188
|
+
}
|
|
4189
|
+
}
|
|
4190
|
+
];
|
|
4143
4191
|
var registerSpansCommand = (program) => {
|
|
4144
4192
|
const spans = program.command("spans").description("Manage LLM Observability spans");
|
|
4145
|
-
spans.command("get").description("Get all spans by trace ID, or by job key as an alternative").argument("[trace-id]", "Trace ID (32-char hex or GUID format)").option("--job-key <guid>", "Orchestrator job key (GUID) — alternative to trace-id").option("-t, --tenant <name>", "Tenant name (optional, defaults to authenticated tenant)").option("--folder-path <path>", "Orchestrator folder path").option("--folder-key <guid>", "Orchestrator folder key (GUID)").trackedAction(processContext, async (traceId, options) => {
|
|
4193
|
+
spans.command("get").description("Get all spans by trace ID, or by job key as an alternative").argument("[trace-id]", "Trace ID (32-char hex or GUID format)").option("--job-key <guid>", "Orchestrator job key (GUID) — alternative to trace-id").option("-t, --tenant <name>", "Tenant name (optional, defaults to authenticated tenant)").option("--folder-path <path>", "Orchestrator folder path").option("--folder-key <guid>", "Orchestrator folder key (GUID)").examples(SPANS_GET_EXAMPLES).trackedAction(processContext, async (traceId, options) => {
|
|
4146
4194
|
let resolvedTraceId;
|
|
4147
4195
|
if (options.jobKey) {
|
|
4148
4196
|
const [traceIdError, tid] = await catchError2(getTraceIdForJob(options.jobKey, options));
|
|
4149
4197
|
if (traceIdError) {
|
|
4150
4198
|
OutputFormatter.error({
|
|
4151
|
-
Result:
|
|
4199
|
+
Result: RESULTS.Failure,
|
|
4152
4200
|
Message: "Error retrieving trace ID for job",
|
|
4153
4201
|
Instructions: await extractErrorMessage(traceIdError)
|
|
4154
4202
|
});
|
|
@@ -4160,7 +4208,7 @@ var registerSpansCommand = (program) => {
|
|
|
4160
4208
|
resolvedTraceId = traceId;
|
|
4161
4209
|
} else {
|
|
4162
4210
|
OutputFormatter.error({
|
|
4163
|
-
Result:
|
|
4211
|
+
Result: RESULTS.Failure,
|
|
4164
4212
|
Message: "Missing required argument",
|
|
4165
4213
|
Instructions: "Provide either a trace-id argument or --job-key option"
|
|
4166
4214
|
});
|
|
@@ -4170,7 +4218,7 @@ var registerSpansCommand = (program) => {
|
|
|
4170
4218
|
const [spansError, spans2] = await catchError2(getSpansForTrace(resolvedTraceId, options));
|
|
4171
4219
|
if (spansError) {
|
|
4172
4220
|
OutputFormatter.error({
|
|
4173
|
-
Result:
|
|
4221
|
+
Result: RESULTS.Failure,
|
|
4174
4222
|
Message: "Error retrieving spans for trace",
|
|
4175
4223
|
Instructions: await extractErrorMessage(spansError)
|
|
4176
4224
|
});
|
|
@@ -4178,7 +4226,7 @@ var registerSpansCommand = (program) => {
|
|
|
4178
4226
|
return;
|
|
4179
4227
|
}
|
|
4180
4228
|
OutputFormatter.success({
|
|
4181
|
-
Result:
|
|
4229
|
+
Result: RESULTS.Success,
|
|
4182
4230
|
Code: "TraceSpans",
|
|
4183
4231
|
Data: spans2
|
|
4184
4232
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/traces-tool",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Fetch LLM Observability traces for UiPath jobs",
|
|
5
5
|
"private": false,
|
|
6
6
|
"keywords": [
|
|
@@ -25,17 +25,16 @@
|
|
|
25
25
|
"test": "vitest run",
|
|
26
26
|
"test:coverage": "vitest run --coverage"
|
|
27
27
|
},
|
|
28
|
-
"peerDependencies": {
|
|
29
|
-
"commander": "^14.0.3",
|
|
30
|
-
"@uipath/common": "^0.1.7",
|
|
31
|
-
"@uipath/auth": "^0.1.6"
|
|
32
|
-
},
|
|
33
28
|
"devDependencies": {
|
|
34
|
-
"@uipath/
|
|
29
|
+
"@uipath/auth": "0.9.0",
|
|
30
|
+
"@uipath/common": "0.9.0",
|
|
31
|
+
"@uipath/orchestrator-sdk": "0.9.0",
|
|
35
32
|
"@types/node": "^25.5.0",
|
|
33
|
+
"commander": "^14.0.3",
|
|
36
34
|
"typescript": "^5"
|
|
37
35
|
},
|
|
38
36
|
"publishConfig": {
|
|
39
37
|
"registry": "https://registry.npmjs.org/"
|
|
40
|
-
}
|
|
38
|
+
},
|
|
39
|
+
"gitHead": "3f1b4d8e9f910be81e4cab956537f21dbd5d63ac"
|
|
41
40
|
}
|