@uipath/traces-tool 0.9.1 → 1.0.2

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.
Files changed (2) hide show
  1. package/dist/tool.js +748 -103
  2. package/package.json +7 -7
package/dist/tool.js CHANGED
@@ -1,7 +1,9 @@
1
+ import { createRequire } from "node:module";
2
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
1
3
  // package.json
2
4
  var package_default = {
3
5
  name: "@uipath/traces-tool",
4
- version: "0.9.1",
6
+ version: "1.0.2",
5
7
  description: "Fetch LLM Observability traces for UiPath jobs",
6
8
  private: false,
7
9
  keywords: [
@@ -30,24 +32,731 @@ var package_default = {
30
32
  "@uipath/auth": "workspace:*",
31
33
  "@uipath/common": "workspace:*",
32
34
  "@uipath/orchestrator-sdk": "workspace:*",
33
- "@types/node": "^25.5.0",
35
+ "@types/node": "^25.5.2",
34
36
  commander: "^14.0.3",
35
- typescript: "^5"
37
+ typescript: "^6.0.2"
36
38
  }
37
39
  };
38
40
 
39
- // src/commands/spans.ts
41
+ // src/commands/feedback/create.ts
40
42
  import {
41
43
  catchError as catchError2,
42
- extractErrorMessage,
43
44
  OutputFormatter,
44
45
  processContext,
45
46
  RESULTS
46
47
  } from "@uipath/common";
47
48
 
48
- // src/services/traces-service.ts
49
+ // src/services/feedback-service.ts
49
50
  import { getLoginStatusAsync } from "@uipath/auth";
50
51
  import { catchError } from "@uipath/common";
52
+ var GUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
53
+ var ZERO_GUID = "00000000-0000-0000-0000-000000000000";
54
+ async function resolveAuth(tenant) {
55
+ const [loginError, loginStatus] = await catchError(getLoginStatusAsync());
56
+ if (loginError) {
57
+ throw new Error(loginError.message);
58
+ }
59
+ if (loginStatus.loginStatus !== "Logged in" || !loginStatus.baseUrl) {
60
+ throw new Error("Not authenticated. Run 'uip auth login' first.");
61
+ }
62
+ const tenantName = tenant ?? loginStatus.tenantName;
63
+ if (!tenantName || !loginStatus.organizationId) {
64
+ throw new Error("Missing tenant or organization info.");
65
+ }
66
+ return {
67
+ baseUrl: loginStatus.baseUrl,
68
+ orgId: loginStatus.organizationId,
69
+ tenantName,
70
+ token: loginStatus.accessToken ?? ""
71
+ };
72
+ }
73
+ function feedbackBaseUrl(baseUrl, orgId, tenantName) {
74
+ return `${baseUrl}/${orgId}/${encodeURIComponent(tenantName)}/llmopstenant_/api/Feedback`;
75
+ }
76
+ async function apiFetch(url, token, folderKey, method = "GET", body) {
77
+ const headers = {
78
+ Authorization: `Bearer ${token}`,
79
+ "Content-Type": "application/json",
80
+ Accept: "application/json"
81
+ };
82
+ if (folderKey) {
83
+ headers["X-UiPath-FolderKey"] = folderKey;
84
+ }
85
+ return fetch(url, {
86
+ method,
87
+ headers,
88
+ body: body !== undefined ? JSON.stringify(body) : undefined
89
+ });
90
+ }
91
+ async function handleErrorResponse(response, context) {
92
+ if (response.status === 401) {
93
+ throw new Error("Not authenticated. Run 'uip auth login' first.");
94
+ }
95
+ if (response.status === 403) {
96
+ throw new Error("Insufficient permissions. Ensure you have Logs.View / Logs.Create / Logs.Delete on this folder.");
97
+ }
98
+ if (response.status === 404) {
99
+ throw new Error(`${context} not found.`);
100
+ }
101
+ const text = await response.text();
102
+ throw new Error(`Feedback API failed: ${response.status} ${response.statusText} - ${text}`);
103
+ }
104
+ async function createFeedback(req, opts) {
105
+ const { baseUrl, orgId, tenantName, token } = await resolveAuth(opts.tenant);
106
+ const url = feedbackBaseUrl(baseUrl, orgId, tenantName);
107
+ const body = {
108
+ TraceId: req.traceId,
109
+ SpanId: req.spanId,
110
+ IsPositive: req.isPositive,
111
+ Comment: req.comment,
112
+ AgentId: req.agentId,
113
+ AgentVersion: req.agentVersion,
114
+ Categories: req.categories.map((c) => ({
115
+ Id: ZERO_GUID,
116
+ Category: c.Category
117
+ }))
118
+ };
119
+ const response = await apiFetch(url, token, opts.folderKey, "POST", body);
120
+ if (!response.ok) {
121
+ await handleErrorResponse(response, "Feedback");
122
+ }
123
+ return response.json();
124
+ }
125
+ async function getFeedback(id, opts) {
126
+ if (!GUID_RE.test(id)) {
127
+ throw new Error(`Invalid feedback ID format: ${id}`);
128
+ }
129
+ const { baseUrl, orgId, tenantName, token } = await resolveAuth(opts.tenant);
130
+ const url = `${feedbackBaseUrl(baseUrl, orgId, tenantName)}/${id}`;
131
+ const response = await apiFetch(url, token, opts.folderKey);
132
+ if (!response.ok) {
133
+ await handleErrorResponse(response, `Feedback ${id}`);
134
+ }
135
+ return response.json();
136
+ }
137
+ async function listFeedback(filters, opts) {
138
+ const { baseUrl, orgId, tenantName, token } = await resolveAuth(opts.tenant);
139
+ const params = new URLSearchParams;
140
+ if (filters.agentId)
141
+ params.set("agentId", filters.agentId);
142
+ if (filters.agentVersion)
143
+ params.set("agentVersion", filters.agentVersion);
144
+ if (filters.traceId)
145
+ params.set("traceId", filters.traceId);
146
+ if (filters.spanId)
147
+ params.set("spanId", filters.spanId);
148
+ if (filters.statuses) {
149
+ for (const s of filters.statuses)
150
+ params.append("status", s);
151
+ }
152
+ if (filters.isPositive !== undefined)
153
+ params.set("isPositive", String(filters.isPositive));
154
+ params.set("skip", String(filters.skip ?? 0));
155
+ params.set("take", String(Math.min(filters.limit ?? 20, 100)));
156
+ const url = `${feedbackBaseUrl(baseUrl, orgId, tenantName)}?${params.toString()}`;
157
+ const response = await apiFetch(url, token, opts.folderKey);
158
+ if (!response.ok) {
159
+ await handleErrorResponse(response, "Feedback list");
160
+ }
161
+ return response.json();
162
+ }
163
+ async function listDetailedFeedback(filters, opts) {
164
+ const { baseUrl, orgId, tenantName, token } = await resolveAuth(opts.tenant);
165
+ const params = new URLSearchParams;
166
+ if (filters.agentId)
167
+ params.set("agentId", filters.agentId);
168
+ if (filters.agentVersion)
169
+ params.set("agentVersion", filters.agentVersion);
170
+ if (filters.traceId)
171
+ params.set("traceId", filters.traceId);
172
+ if (filters.spanId)
173
+ params.set("spanId", filters.spanId);
174
+ if (filters.statuses) {
175
+ for (const s of filters.statuses)
176
+ params.append("status", s);
177
+ }
178
+ if (filters.isPositive !== undefined)
179
+ params.set("isPositive", String(filters.isPositive));
180
+ if (filters.categoryIds) {
181
+ for (const cid of filters.categoryIds)
182
+ params.append("categoryIds", cid);
183
+ }
184
+ if (filters.after)
185
+ params.set("absoluteStartTime", String(Date.parse(filters.after)));
186
+ if (filters.before)
187
+ params.set("absoluteEndTime", String(Date.parse(filters.before)));
188
+ if (filters.sortBy)
189
+ params.set("sortBy", filters.sortBy);
190
+ if (filters.sortDir)
191
+ params.set("sortDir", filters.sortDir);
192
+ params.set("skip", String(filters.skip ?? 0));
193
+ params.set("take", String(Math.min(filters.limit ?? 20, 200)));
194
+ const url = `${feedbackBaseUrl(baseUrl, orgId, tenantName)}/detailed?${params.toString()}`;
195
+ const response = await apiFetch(url, token, opts.folderKey);
196
+ if (!response.ok) {
197
+ await handleErrorResponse(response, "Feedback list");
198
+ }
199
+ return response.json();
200
+ }
201
+ async function updateFeedback(id, req, opts) {
202
+ if (!GUID_RE.test(id)) {
203
+ throw new Error(`Invalid feedback ID format: ${id}`);
204
+ }
205
+ const { baseUrl, orgId, tenantName, token } = await resolveAuth(opts.tenant);
206
+ const url = `${feedbackBaseUrl(baseUrl, orgId, tenantName)}/${id}`;
207
+ const body = {
208
+ IsPositive: req.isPositive,
209
+ Comment: req.comment,
210
+ Categories: req.categories.map((c) => ({
211
+ Id: ZERO_GUID,
212
+ Category: c.Category
213
+ }))
214
+ };
215
+ const response = await apiFetch(url, token, opts.folderKey, "POST", body);
216
+ if (!response.ok) {
217
+ await handleErrorResponse(response, `Feedback ${id}`);
218
+ }
219
+ return response.json();
220
+ }
221
+ async function deleteFeedback(id, opts) {
222
+ if (!GUID_RE.test(id)) {
223
+ throw new Error(`Invalid feedback ID format: ${id}`);
224
+ }
225
+ const { baseUrl, orgId, tenantName, token } = await resolveAuth(opts.tenant);
226
+ const url = `${feedbackBaseUrl(baseUrl, orgId, tenantName)}/${id}`;
227
+ const response = await apiFetch(url, token, opts.folderKey, "DELETE");
228
+ if (!response.ok) {
229
+ await handleErrorResponse(response, `Feedback ${id}`);
230
+ }
231
+ }
232
+
233
+ // src/commands/feedback/_shared.ts
234
+ function collect(val, prev) {
235
+ return [...prev, val];
236
+ }
237
+ async function readCommentFile(filePath) {
238
+ if (filePath === "-") {
239
+ const chunks = [];
240
+ for await (const chunk of process.stdin) {
241
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
242
+ }
243
+ return Buffer.concat(chunks).toString("utf8");
244
+ }
245
+ const { readFile } = await import("node:fs/promises");
246
+ return readFile(filePath, "utf8");
247
+ }
248
+
249
+ // src/commands/feedback/create.ts
250
+ var FEEDBACK_CREATE_EXAMPLES = [
251
+ {
252
+ Description: "Create positive feedback for a trace",
253
+ Command: "uip traces feedback create --trace-id 4bf92f3577b34da6a3ce929d0e0e4736 --positive --folder-key a1b2c3d4-0000-0000-0000-000000000001",
254
+ Output: {
255
+ Code: "FeedbackCreate",
256
+ Data: { Id: "a1b2c3d4-0000-0000-0000-000000000002" }
257
+ }
258
+ }
259
+ ];
260
+ function registerCreateCommand(program) {
261
+ program.command("create").description("Create feedback for a trace").examples(FEEDBACK_CREATE_EXAMPLES).option("--trace-id <id>", "Trace ID (32-char hex or GUID)").option("--positive", "Mark as positive feedback").option("--negative", "Mark as negative feedback").option("--span-id <id>", "Span ID (defaults to root span of trace)").option("--comment <text>", "Free-text annotation (max 4000 chars)").option("--comment-file <file>", "Read comment from file; use '-' for stdin").option("--category <tag>", 'Category tag, repeatable. Built-in defaults: "Output", "Agent Error", "Agent Plan Execution"', collect, []).option("--agent-id <guid>", "Agent reference ID").option("--agent-version <str>", "Agent version (max 100 chars)").option("--folder-key <guid>", "Folder key (required for write ops)").option("--tenant <name>", "Tenant name (defaults to authenticated tenant)").trackedAction(processContext, async (opts) => {
262
+ if (!opts.traceId) {
263
+ OutputFormatter.error({
264
+ Result: RESULTS.Failure,
265
+ Code: "FeedbackCreate",
266
+ Message: "--trace-id is required",
267
+ Instructions: "Run 'uip traces feedback create --help' for usage"
268
+ });
269
+ processContext.exit(1);
270
+ return;
271
+ }
272
+ if (!opts.folderKey) {
273
+ OutputFormatter.error({
274
+ Result: RESULTS.Failure,
275
+ Code: "FeedbackCreate",
276
+ Message: "--folder-key is required",
277
+ Instructions: "Run 'uip traces feedback create --help' for usage"
278
+ });
279
+ processContext.exit(1);
280
+ return;
281
+ }
282
+ if (opts.positive && opts.negative) {
283
+ OutputFormatter.error({
284
+ Result: RESULTS.Failure,
285
+ Code: "FeedbackCreate",
286
+ Message: "--positive and --negative are mutually exclusive",
287
+ Instructions: "Provide either --positive or --negative"
288
+ });
289
+ processContext.exit(1);
290
+ return;
291
+ }
292
+ if (!opts.positive && !opts.negative) {
293
+ OutputFormatter.error({
294
+ Result: RESULTS.Failure,
295
+ Code: "FeedbackCreate",
296
+ Message: "Either --positive or --negative is required",
297
+ Instructions: "Provide either --positive or --negative"
298
+ });
299
+ processContext.exit(1);
300
+ return;
301
+ }
302
+ if (opts.comment && opts.commentFile) {
303
+ OutputFormatter.error({
304
+ Result: RESULTS.Failure,
305
+ Code: "FeedbackCreate",
306
+ Message: "--comment and --comment-file are mutually exclusive",
307
+ Instructions: "Provide either --comment or --comment-file"
308
+ });
309
+ processContext.exit(1);
310
+ return;
311
+ }
312
+ let comment = opts.comment;
313
+ if (opts.commentFile) {
314
+ const [readError, text] = await catchError2(readCommentFile(opts.commentFile));
315
+ if (readError) {
316
+ OutputFormatter.error({
317
+ Result: RESULTS.Failure,
318
+ Code: "FeedbackCreate",
319
+ Message: readError.message
320
+ });
321
+ processContext.exit(1);
322
+ return;
323
+ }
324
+ comment = text;
325
+ }
326
+ const [error, result] = await catchError2(createFeedback({
327
+ traceId: opts.traceId,
328
+ spanId: opts.spanId,
329
+ isPositive: !!opts.positive,
330
+ comment,
331
+ agentId: opts.agentId,
332
+ agentVersion: opts.agentVersion,
333
+ categories: opts.category.map((c) => ({
334
+ Id: "00000000-0000-0000-0000-000000000000",
335
+ Category: c
336
+ }))
337
+ }, { tenant: opts.tenant, folderKey: opts.folderKey }));
338
+ if (error) {
339
+ OutputFormatter.error({
340
+ Result: RESULTS.Failure,
341
+ Code: "FeedbackCreate",
342
+ Message: error.message
343
+ });
344
+ processContext.exit(1);
345
+ return;
346
+ }
347
+ OutputFormatter.success({
348
+ Result: RESULTS.Success,
349
+ Code: "FeedbackCreate",
350
+ Data: result
351
+ });
352
+ });
353
+ }
354
+
355
+ // src/commands/feedback/delete.ts
356
+ import {
357
+ catchError as catchError3,
358
+ OutputFormatter as OutputFormatter2,
359
+ processContext as processContext2,
360
+ RESULTS as RESULTS2
361
+ } from "@uipath/common";
362
+ var FEEDBACK_DELETE_EXAMPLES = [
363
+ {
364
+ Description: "Delete feedback by ID",
365
+ Command: "uip traces feedback delete a1b2c3d4-0000-0000-0000-000000000002 --folder-key a1b2c3d4-0000-0000-0000-000000000001",
366
+ Output: {
367
+ Code: "FeedbackDelete",
368
+ Data: { Id: "a1b2c3d4-0000-0000-0000-000000000002" }
369
+ }
370
+ }
371
+ ];
372
+ function registerDeleteCommand(program) {
373
+ program.command("delete [id]").description("Delete feedback by ID").examples(FEEDBACK_DELETE_EXAMPLES).option("--folder-key <guid>", "Folder key (required)").option("--tenant <name>", "Tenant name (defaults to authenticated tenant)").trackedAction(processContext2, async (id, opts) => {
374
+ if (!id) {
375
+ OutputFormatter2.error({
376
+ Result: RESULTS2.Failure,
377
+ Code: "FeedbackDelete",
378
+ Message: "Feedback ID is required",
379
+ Instructions: "Run 'uip traces feedback delete --help' for usage"
380
+ });
381
+ processContext2.exit(1);
382
+ return;
383
+ }
384
+ if (!opts.folderKey) {
385
+ OutputFormatter2.error({
386
+ Result: RESULTS2.Failure,
387
+ Code: "FeedbackDelete",
388
+ Message: "--folder-key is required",
389
+ Instructions: "Run 'uip traces feedback delete --help' for usage"
390
+ });
391
+ processContext2.exit(1);
392
+ return;
393
+ }
394
+ const [error] = await catchError3(deleteFeedback(id, {
395
+ tenant: opts.tenant,
396
+ folderKey: opts.folderKey
397
+ }));
398
+ if (error) {
399
+ OutputFormatter2.error({
400
+ Result: RESULTS2.Failure,
401
+ Code: "FeedbackDelete",
402
+ Message: error.message
403
+ });
404
+ processContext2.exit(1);
405
+ return;
406
+ }
407
+ OutputFormatter2.success({
408
+ Result: RESULTS2.Success,
409
+ Code: "FeedbackDelete",
410
+ Data: { Id: id }
411
+ });
412
+ });
413
+ }
414
+
415
+ // src/commands/feedback/get.ts
416
+ import {
417
+ catchError as catchError4,
418
+ OutputFormatter as OutputFormatter3,
419
+ processContext as processContext3,
420
+ RESULTS as RESULTS3
421
+ } from "@uipath/common";
422
+ var FEEDBACK_GET_EXAMPLES = [
423
+ {
424
+ Description: "Get feedback by ID",
425
+ Command: "uip traces feedback get a1b2c3d4-0000-0000-0000-000000000002",
426
+ Output: {
427
+ Code: "FeedbackGet",
428
+ Data: {
429
+ Id: "a1b2c3d4-0000-0000-0000-000000000002",
430
+ IsPositive: true
431
+ }
432
+ }
433
+ }
434
+ ];
435
+ function registerGetCommand(program) {
436
+ program.command("get [id]").description("Get feedback by ID").examples(FEEDBACK_GET_EXAMPLES).option("--folder-key <guid>", "Folder key (required)").option("--tenant <name>", "Tenant name (defaults to authenticated tenant)").trackedAction(processContext3, async (id, opts) => {
437
+ if (!id) {
438
+ OutputFormatter3.error({
439
+ Result: RESULTS3.Failure,
440
+ Code: "FeedbackGet",
441
+ Message: "Feedback ID is required",
442
+ Instructions: "Run 'uip traces feedback get --help' for usage"
443
+ });
444
+ processContext3.exit(1);
445
+ return;
446
+ }
447
+ const [error, result] = await catchError4(getFeedback(id, {
448
+ tenant: opts.tenant,
449
+ folderKey: opts.folderKey
450
+ }));
451
+ if (error) {
452
+ OutputFormatter3.error({
453
+ Result: RESULTS3.Failure,
454
+ Code: "FeedbackGet",
455
+ Message: error.message
456
+ });
457
+ processContext3.exit(1);
458
+ return;
459
+ }
460
+ OutputFormatter3.success({
461
+ Result: RESULTS3.Success,
462
+ Code: "FeedbackGet",
463
+ Data: result
464
+ });
465
+ });
466
+ }
467
+
468
+ // src/commands/feedback/list.ts
469
+ import {
470
+ catchError as catchError5,
471
+ OutputFormatter as OutputFormatter4,
472
+ processContext as processContext4,
473
+ RESULTS as RESULTS4
474
+ } from "@uipath/common";
475
+ var FEEDBACK_LIST_EXAMPLES = [
476
+ {
477
+ Description: "List feedback for a specific trace",
478
+ Command: "uip traces feedback list --trace-id 4bf92f3577b34da6a3ce929d0e0e4736",
479
+ Output: {
480
+ Code: "FeedbackList",
481
+ Data: [
482
+ {
483
+ Id: "a1b2c3d4-0000-0000-0000-000000000002",
484
+ IsPositive: true
485
+ }
486
+ ]
487
+ }
488
+ }
489
+ ];
490
+ function registerListCommand(program) {
491
+ program.command("list").enablePositionalOptions().description("List feedback entries").examples(FEEDBACK_LIST_EXAMPLES).option("--agent-id <guid>", "Filter by agent ID").option("--agent-version <str>", "Filter by agent version").option("--trace-id <id>", "Filter by trace ID").option("--span-id <id>", "Filter by span ID").option("--status <value>", "Filter by status: Pending, Approved, Dismissed (repeatable)", collect, []).option("--positive", "Return positive feedback only").option("--negative", "Return negative feedback only").option("--limit <n>", "Max results (default: 20, max: 100)", parseInt).option("--skip <n>", "Results to skip (default: 0)", parseInt).option("--folder-key <guid>", "Folder key").option("--tenant <name>", "Tenant name (defaults to authenticated tenant)").trackedAction(processContext4, async (opts) => {
492
+ if (opts.positive && opts.negative) {
493
+ OutputFormatter4.error({
494
+ Result: RESULTS4.Failure,
495
+ Code: "FeedbackList",
496
+ Message: "--positive and --negative are mutually exclusive",
497
+ Instructions: "Provide either --positive or --negative"
498
+ });
499
+ processContext4.exit(1);
500
+ return;
501
+ }
502
+ const isPositive = opts.positive ? true : opts.negative ? false : undefined;
503
+ const [error, result] = await catchError5(listFeedback({
504
+ agentId: opts.agentId,
505
+ agentVersion: opts.agentVersion,
506
+ traceId: opts.traceId,
507
+ spanId: opts.spanId,
508
+ statuses: opts.status.length > 0 ? opts.status : undefined,
509
+ isPositive,
510
+ limit: opts.limit,
511
+ skip: opts.skip
512
+ }, { tenant: opts.tenant, folderKey: opts.folderKey }));
513
+ if (error) {
514
+ OutputFormatter4.error({
515
+ Result: RESULTS4.Failure,
516
+ Code: "FeedbackList",
517
+ Message: error.message
518
+ });
519
+ processContext4.exit(1);
520
+ return;
521
+ }
522
+ OutputFormatter4.emitList("FeedbackList", result, {
523
+ emptyInstructions: "No feedback found. Use 'uip traces feedback create' to add feedback."
524
+ });
525
+ });
526
+ }
527
+
528
+ // src/commands/feedback/list-detailed.ts
529
+ import {
530
+ catchError as catchError6,
531
+ OutputFormatter as OutputFormatter5,
532
+ processContext as processContext5,
533
+ RESULTS as RESULTS5
534
+ } from "@uipath/common";
535
+ var FEEDBACK_LIST_DETAILED_EXAMPLES = [
536
+ {
537
+ Description: "List detailed feedback for the last 24 hours",
538
+ Command: "uip traces feedback list detailed --since 24h",
539
+ Output: {
540
+ Code: "FeedbackListDetailed",
541
+ Data: [
542
+ {
543
+ Id: "a1b2c3d4-0000-0000-0000-000000000002",
544
+ IsPositive: true,
545
+ TraceId: "4bf92f3577b34da6a3ce929d0e0e4736"
546
+ }
547
+ ]
548
+ }
549
+ }
550
+ ];
551
+ function registerListDetailedCommand(program) {
552
+ const listCmd = program.commands.find((c) => c.name() === "list");
553
+ if (!listCmd) {
554
+ throw new Error("registerListDetailedCommand must be called after registerListCommand");
555
+ }
556
+ listCmd.passThroughOptions();
557
+ listCmd.command("detailed").description("List feedback with span context and extended filters (max 200 items)").examples(FEEDBACK_LIST_DETAILED_EXAMPLES).option("--agent-id <guid>", "Filter by agent ID").option("--agent-version <str>", "Filter by agent version").option("--trace-id <id>", "Filter by trace ID").option("--span-id <id>", "Filter by span ID").option("--status <value>", "Filter by status: Pending, Approved, Dismissed (repeatable)", collect, []).option("--positive", "Return positive feedback only").option("--negative", "Return negative feedback only").option("--category-id <guid>", "Filter by category ID (repeatable)", collect, []).option("--after <iso>", "Created after this time (ISO 8601)").option("--before <iso>", "Created before this time (ISO 8601)").option("--since <duration>", "Relative lookback: 1h, 24h, 7d (shorthand for --after)").option("--sort <field>", "Sort field: createdAt, updatedAt (default: createdAt)").option("--sort-dir <dir>", "Sort direction: asc, desc (default: desc)").option("--limit <n>", "Max results (default: 20, max: 200)", parseInt).option("--skip <n>", "Results to skip (default: 0)", parseInt).option("--folder-key <guid>", "Folder key").option("--tenant <name>", "Tenant name (defaults to authenticated tenant)").trackedAction(processContext5, async (opts) => {
558
+ if (opts.positive && opts.negative) {
559
+ OutputFormatter5.error({
560
+ Result: RESULTS5.Failure,
561
+ Code: "FeedbackListDetailed",
562
+ Message: "--positive and --negative are mutually exclusive",
563
+ Instructions: "Provide either --positive or --negative"
564
+ });
565
+ processContext5.exit(1);
566
+ return;
567
+ }
568
+ const isPositive = opts.positive ? true : opts.negative ? false : undefined;
569
+ let after = opts.after;
570
+ if (opts.since) {
571
+ const sinceMs = parseDuration(opts.since);
572
+ if (sinceMs === null) {
573
+ OutputFormatter5.error({
574
+ Result: RESULTS5.Failure,
575
+ Code: "FeedbackListDetailed",
576
+ Message: `Invalid --since value: ${opts.since}. Use format like 1h, 24h, 7d.`,
577
+ Instructions: "Supported units: h (hours), d (days). Example: --since 24h"
578
+ });
579
+ processContext5.exit(1);
580
+ return;
581
+ }
582
+ after = new Date(Date.now() - sinceMs).toISOString();
583
+ }
584
+ const [error, result] = await catchError6(listDetailedFeedback({
585
+ agentId: opts.agentId,
586
+ agentVersion: opts.agentVersion,
587
+ traceId: opts.traceId,
588
+ spanId: opts.spanId,
589
+ statuses: opts.status.length > 0 ? opts.status : undefined,
590
+ isPositive,
591
+ categoryIds: opts.categoryId.length > 0 ? opts.categoryId : undefined,
592
+ after,
593
+ before: opts.before,
594
+ sortBy: opts.sort,
595
+ sortDir: opts.sortDir,
596
+ limit: opts.limit,
597
+ skip: opts.skip
598
+ }, { tenant: opts.tenant, folderKey: opts.folderKey }));
599
+ if (error) {
600
+ OutputFormatter5.error({
601
+ Result: RESULTS5.Failure,
602
+ Code: "FeedbackListDetailed",
603
+ Message: error.message
604
+ });
605
+ processContext5.exit(1);
606
+ return;
607
+ }
608
+ OutputFormatter5.emitList("FeedbackListDetailed", result.items, {
609
+ emptyInstructions: "No feedback found. Use 'uip traces feedback create' to add feedback."
610
+ });
611
+ });
612
+ }
613
+ function parseDuration(value) {
614
+ const match = value.match(/^(\d+)(h|d)$/);
615
+ if (!match)
616
+ return null;
617
+ const n = parseInt(match[1], 10);
618
+ const unit = match[2];
619
+ if (unit === "h")
620
+ return n * 60 * 60 * 1000;
621
+ if (unit === "d")
622
+ return n * 24 * 60 * 60 * 1000;
623
+ return null;
624
+ }
625
+
626
+ // src/commands/feedback/update.ts
627
+ import {
628
+ catchError as catchError7,
629
+ OutputFormatter as OutputFormatter6,
630
+ processContext as processContext6,
631
+ RESULTS as RESULTS6
632
+ } from "@uipath/common";
633
+ var FEEDBACK_UPDATE_EXAMPLES = [
634
+ {
635
+ Description: "Update feedback to negative with a comment",
636
+ Command: 'uip traces feedback update a1b2c3d4-0000-0000-0000-000000000002 --negative --comment "Wrong output" --folder-key a1b2c3d4-0000-0000-0000-000000000001',
637
+ Output: {
638
+ Code: "FeedbackUpdate",
639
+ Data: {
640
+ Id: "a1b2c3d4-0000-0000-0000-000000000002",
641
+ IsPositive: false
642
+ }
643
+ }
644
+ }
645
+ ];
646
+ function registerUpdateCommand(program) {
647
+ program.command("update [id]").description("Update feedback (isPositive, comment, categories)").examples(FEEDBACK_UPDATE_EXAMPLES).option("--positive", "Change to positive feedback").option("--negative", "Change to negative feedback").option("--comment <text>", "Updated comment (max 4000 chars)").option("--comment-file <file>", "Read updated comment from file; use '-' for stdin").option("--category <tag>", "Replacement category tags (repeatable)", collect, []).option("--folder-key <guid>", "Folder key (required)").option("--tenant <name>", "Tenant name (defaults to authenticated tenant)").trackedAction(processContext6, async (id, opts) => {
648
+ if (!id) {
649
+ OutputFormatter6.error({
650
+ Result: RESULTS6.Failure,
651
+ Code: "FeedbackUpdate",
652
+ Message: "Feedback ID is required",
653
+ Instructions: "Run 'uip traces feedback update --help' for usage"
654
+ });
655
+ processContext6.exit(1);
656
+ return;
657
+ }
658
+ if (!opts.folderKey) {
659
+ OutputFormatter6.error({
660
+ Result: RESULTS6.Failure,
661
+ Code: "FeedbackUpdate",
662
+ Message: "--folder-key is required",
663
+ Instructions: "Run 'uip traces feedback update --help' for usage"
664
+ });
665
+ processContext6.exit(1);
666
+ return;
667
+ }
668
+ if (opts.positive && opts.negative) {
669
+ OutputFormatter6.error({
670
+ Result: RESULTS6.Failure,
671
+ Code: "FeedbackUpdate",
672
+ Message: "--positive and --negative are mutually exclusive",
673
+ Instructions: "Provide either --positive or --negative"
674
+ });
675
+ processContext6.exit(1);
676
+ return;
677
+ }
678
+ if (!opts.positive && !opts.negative) {
679
+ OutputFormatter6.error({
680
+ Result: RESULTS6.Failure,
681
+ Code: "FeedbackUpdate",
682
+ Message: "Either --positive or --negative is required",
683
+ Instructions: "Provide either --positive or --negative"
684
+ });
685
+ processContext6.exit(1);
686
+ return;
687
+ }
688
+ if (opts.comment && opts.commentFile) {
689
+ OutputFormatter6.error({
690
+ Result: RESULTS6.Failure,
691
+ Code: "FeedbackUpdate",
692
+ Message: "--comment and --comment-file are mutually exclusive",
693
+ Instructions: "Provide either --comment or --comment-file"
694
+ });
695
+ processContext6.exit(1);
696
+ return;
697
+ }
698
+ let comment = opts.comment;
699
+ if (opts.commentFile) {
700
+ const [readError, text] = await catchError7(readCommentFile(opts.commentFile));
701
+ if (readError) {
702
+ OutputFormatter6.error({
703
+ Result: RESULTS6.Failure,
704
+ Code: "FeedbackUpdate",
705
+ Message: readError.message
706
+ });
707
+ processContext6.exit(1);
708
+ return;
709
+ }
710
+ comment = text;
711
+ }
712
+ const [error, result] = await catchError7(updateFeedback(id, {
713
+ isPositive: !!opts.positive,
714
+ comment,
715
+ categories: opts.category.map((c) => ({
716
+ Id: "00000000-0000-0000-0000-000000000000",
717
+ Category: c
718
+ }))
719
+ }, { tenant: opts.tenant, folderKey: opts.folderKey }));
720
+ if (error) {
721
+ OutputFormatter6.error({
722
+ Result: RESULTS6.Failure,
723
+ Code: "FeedbackUpdate",
724
+ Message: error.message
725
+ });
726
+ processContext6.exit(1);
727
+ return;
728
+ }
729
+ OutputFormatter6.success({
730
+ Result: RESULTS6.Success,
731
+ Code: "FeedbackUpdate",
732
+ Data: result
733
+ });
734
+ });
735
+ }
736
+
737
+ // src/commands/feedback/index.ts
738
+ function registerFeedbackCommand(program) {
739
+ const feedback = program.command("feedback").enablePositionalOptions().description("Manage LLM Observability feedback for traces and spans");
740
+ registerCreateCommand(feedback);
741
+ registerGetCommand(feedback);
742
+ registerListCommand(feedback);
743
+ registerListDetailedCommand(feedback);
744
+ registerUpdateCommand(feedback);
745
+ registerDeleteCommand(feedback);
746
+ }
747
+
748
+ // src/commands/spans.ts
749
+ import {
750
+ catchError as catchError9,
751
+ extractErrorMessage,
752
+ OutputFormatter as OutputFormatter7,
753
+ processContext as processContext7,
754
+ RESULTS as RESULTS7
755
+ } from "@uipath/common";
756
+
757
+ // src/services/traces-service.ts
758
+ import { getLoginStatusAsync as getLoginStatusAsync2 } from "@uipath/auth";
759
+ import { catchError as catchError8 } from "@uipath/common";
51
760
 
52
761
  // ../orchestrator-sdk/generated/src/runtime.ts
53
762
  var BASE_PATH = "https://alpha.uipath.com/uipattycyrhx/abizon_1/orchestrator_".replace(/\/+$/, "");
@@ -314,7 +1023,6 @@ class TextApiResponse {
314
1023
  return await this.raw.text();
315
1024
  }
316
1025
  }
317
-
318
1026
  // ../orchestrator-sdk/generated/src/models/SimpleFolderDto.ts
319
1027
  function SimpleFolderDtoFromJSON(json) {
320
1028
  return SimpleFolderDtoFromJSONTyped(json, false);
@@ -329,7 +1037,6 @@ function SimpleFolderDtoFromJSONTyped(json, ignoreDiscriminator) {
329
1037
  id: json["Id"] == null ? undefined : json["Id"]
330
1038
  };
331
1039
  }
332
-
333
1040
  // ../orchestrator-sdk/generated/src/models/AgentSettings.ts
334
1041
  function AgentSettingsFromJSON(json) {
335
1042
  return AgentSettingsFromJSONTyped(json, false);
@@ -342,7 +1049,6 @@ function AgentSettingsFromJSONTyped(json, ignoreDiscriminator) {
342
1049
  memory: json["Memory"] == null ? undefined : json["Memory"]
343
1050
  };
344
1051
  }
345
-
346
1052
  // ../orchestrator-sdk/generated/src/models/TagDto.ts
347
1053
  function TagDtoFromJSON(json) {
348
1054
  return TagDtoFromJSONTyped(json, false);
@@ -358,7 +1064,6 @@ function TagDtoFromJSONTyped(json, ignoreDiscriminator) {
358
1064
  displayValue: json["DisplayValue"] == null ? undefined : json["DisplayValue"]
359
1065
  };
360
1066
  }
361
-
362
1067
  // ../orchestrator-sdk/generated/src/models/ArgumentMetadata.ts
363
1068
  function ArgumentMetadataFromJSON(json) {
364
1069
  return ArgumentMetadataFromJSONTyped(json, false);
@@ -372,7 +1077,6 @@ function ArgumentMetadataFromJSONTyped(json, ignoreDiscriminator) {
372
1077
  output: json["Output"] == null ? undefined : json["Output"]
373
1078
  };
374
1079
  }
375
-
376
1080
  // ../orchestrator-sdk/generated/src/models/AutopilotForRobotsSettingsDto.ts
377
1081
  function AutopilotForRobotsSettingsDtoFromJSON(json) {
378
1082
  return AutopilotForRobotsSettingsDtoFromJSONTyped(json, false);
@@ -398,7 +1102,6 @@ function AutopilotForRobotsSettingsDtoToJSONTyped(value, ignoreDiscriminator = f
398
1102
  HealingEnabled: value["healingEnabled"]
399
1103
  };
400
1104
  }
401
-
402
1105
  // ../orchestrator-sdk/generated/src/models/BaseRoleDto.ts
403
1106
  function BaseRoleDtoFromJSON(json) {
404
1107
  return BaseRoleDtoFromJSONTyped(json, false);
@@ -412,7 +1115,6 @@ function BaseRoleDtoFromJSONTyped(json, ignoreDiscriminator) {
412
1115
  id: json["Id"] == null ? undefined : json["Id"]
413
1116
  };
414
1117
  }
415
-
416
1118
  // ../orchestrator-sdk/generated/src/models/NameValueDto.ts
417
1119
  function NameValueDtoFromJSON(json) {
418
1120
  return NameValueDtoFromJSONTyped(json, false);
@@ -445,7 +1147,6 @@ function ResourceOverwriteDtoFromJSONTyped(json, ignoreDiscriminator) {
445
1147
  entityFolderId: json["EntityFolderId"] == null ? undefined : json["EntityFolderId"]
446
1148
  };
447
1149
  }
448
-
449
1150
  // ../orchestrator-sdk/generated/src/models/VideoRecordingSettingsDto.ts
450
1151
  function VideoRecordingSettingsDtoFromJSON(json) {
451
1152
  return VideoRecordingSettingsDtoFromJSONTyped(json, false);
@@ -513,7 +1214,6 @@ function CreateTestAutomationJobsRequestToJSONTyped(value, ignoreDiscriminator =
513
1214
  jobs: value["jobs"] == null ? undefined : value["jobs"].map(TestAutomationJobDtoToJSON)
514
1215
  };
515
1216
  }
516
-
517
1217
  // ../orchestrator-sdk/generated/src/models/CurrentUserFolderDto.ts
518
1218
  function CurrentUserFolderDtoFromJSON(json) {
519
1219
  return CurrentUserFolderDtoFromJSONTyped(json, false);
@@ -533,7 +1233,6 @@ function CurrentUserFolderDtoFromJSONTyped(json, ignoreDiscriminator) {
533
1233
  id: json["Id"] == null ? undefined : json["Id"]
534
1234
  };
535
1235
  }
536
-
537
1236
  // ../orchestrator-sdk/generated/src/models/UserJobDto.ts
538
1237
  function UserJobDtoFromJSON(json) {
539
1238
  return UserJobDtoFromJSONTyped(json, false);
@@ -578,7 +1277,6 @@ function CursorPaginationResultOfUserJobDtoFromJSONTyped(json, ignoreDiscriminat
578
1277
  prevCursor: json["prevCursor"] == null ? undefined : json["prevCursor"]
579
1278
  };
580
1279
  }
581
-
582
1280
  // ../orchestrator-sdk/generated/src/models/FolderRolesDto.ts
583
1281
  function FolderRolesDtoToJSON(json) {
584
1282
  return FolderRolesDtoToJSONTyped(json, false);
@@ -609,7 +1307,6 @@ function DomainUserAssignmentDtoToJSONTyped(value, ignoreDiscriminator = false)
609
1307
  RolesPerFolder: value["rolesPerFolder"] == null ? undefined : value["rolesPerFolder"].map(FolderRolesDtoToJSON)
610
1308
  };
611
1309
  }
612
-
613
1310
  // ../orchestrator-sdk/generated/src/models/EntityCountDto.ts
614
1311
  function EntityCountDtoFromJSON(json) {
615
1312
  return EntityCountDtoFromJSONTyped(json, false);
@@ -624,7 +1321,6 @@ function EntityCountDtoFromJSONTyped(json, ignoreDiscriminator) {
624
1321
  count: json["Count"] == null ? undefined : json["Count"]
625
1322
  };
626
1323
  }
627
-
628
1324
  // ../orchestrator-sdk/generated/src/models/EntityHasExecutionMedia.ts
629
1325
  function EntityHasExecutionMediaFromJSON(json) {
630
1326
  return EntityHasExecutionMediaFromJSONTyped(json, false);
@@ -638,7 +1334,6 @@ function EntityHasExecutionMediaFromJSONTyped(json, ignoreDiscriminator) {
638
1334
  hasVideoRecorded: json["hasVideoRecorded"] == null ? undefined : json["hasVideoRecorded"]
639
1335
  };
640
1336
  }
641
-
642
1337
  // ../orchestrator-sdk/generated/src/models/EntitySummaryDto.ts
643
1338
  function EntitySummaryDtoFromJSON(json) {
644
1339
  return EntitySummaryDtoFromJSONTyped(json, false);
@@ -655,7 +1350,6 @@ function EntitySummaryDtoFromJSONTyped(json, ignoreDiscriminator) {
655
1350
  id: json["Id"] == null ? undefined : json["Id"]
656
1351
  };
657
1352
  }
658
-
659
1353
  // ../orchestrator-sdk/generated/src/models/EntryPointDataVariationDto.ts
660
1354
  function EntryPointDataVariationDtoFromJSON(json) {
661
1355
  return EntryPointDataVariationDtoFromJSONTyped(json, false);
@@ -670,7 +1364,6 @@ function EntryPointDataVariationDtoFromJSONTyped(json, ignoreDiscriminator) {
670
1364
  id: json["Id"] == null ? undefined : json["Id"]
671
1365
  };
672
1366
  }
673
-
674
1367
  // ../orchestrator-sdk/generated/src/models/EntryPointDto.ts
675
1368
  function EntryPointDtoFromJSON(json) {
676
1369
  return EntryPointDtoFromJSONTyped(json, false);
@@ -688,7 +1381,6 @@ function EntryPointDtoFromJSONTyped(json, ignoreDiscriminator) {
688
1381
  id: json["Id"] == null ? undefined : json["Id"]
689
1382
  };
690
1383
  }
691
-
692
1384
  // ../orchestrator-sdk/generated/src/models/SimpleRobotDto.ts
693
1385
  function SimpleRobotDtoFromJSON(json) {
694
1386
  return SimpleRobotDtoFromJSONTyped(json, false);
@@ -742,7 +1434,6 @@ function EnvironmentDtoFromJSONTyped2(json, ignoreDiscriminator) {
742
1434
  id: json["id"] == null ? undefined : json["id"]
743
1435
  };
744
1436
  }
745
-
746
1437
  // ../orchestrator-sdk/generated/src/models/UpdatePolicyDto.ts
747
1438
  function UpdatePolicyDtoFromJSON(json) {
748
1439
  return UpdatePolicyDtoFromJSONTyped(json, false);
@@ -756,7 +1447,6 @@ function UpdatePolicyDtoFromJSONTyped(json, ignoreDiscriminator) {
756
1447
  specificVersion: json["SpecificVersion"] == null ? undefined : json["SpecificVersion"]
757
1448
  };
758
1449
  }
759
-
760
1450
  // ../orchestrator-sdk/generated/src/models/ExportModel.ts
761
1451
  function ExportModelFromJSON(json) {
762
1452
  return ExportModelFromJSONTyped(json, false);
@@ -775,7 +1465,6 @@ function ExportModelFromJSONTyped(json, ignoreDiscriminator) {
775
1465
  size: json["Size"] == null ? undefined : json["Size"]
776
1466
  };
777
1467
  }
778
-
779
1468
  // ../orchestrator-sdk/generated/src/models/ExtendedFolderDto.ts
780
1469
  function ExtendedFolderDtoFromJSON(json) {
781
1470
  return ExtendedFolderDtoFromJSONTyped(json, false);
@@ -802,7 +1491,6 @@ function ExtendedFolderDtoFromJSONTyped(json, ignoreDiscriminator) {
802
1491
  id: json["Id"] == null ? undefined : json["Id"]
803
1492
  };
804
1493
  }
805
-
806
1494
  // ../orchestrator-sdk/generated/src/models/MachineVpnSettingsDto.ts
807
1495
  function MachineVpnSettingsDtoFromJSON(json) {
808
1496
  return MachineVpnSettingsDtoFromJSONTyped(json, false);
@@ -880,7 +1568,6 @@ function RobotUserDtoFromJSONTyped(json, ignoreDiscriminator) {
880
1568
  hasTriggers: json["HasTriggers"] == null ? undefined : json["HasTriggers"]
881
1569
  };
882
1570
  }
883
-
884
1571
  // ../orchestrator-sdk/generated/src/models/UserRoleDto.ts
885
1572
  function UserRoleDtoFromJSON(json) {
886
1573
  return UserRoleDtoFromJSONTyped(json, false);
@@ -898,7 +1585,6 @@ function UserRoleDtoFromJSONTyped(json, ignoreDiscriminator) {
898
1585
  id: json["Id"] == null ? undefined : json["Id"]
899
1586
  };
900
1587
  }
901
-
902
1588
  // ../orchestrator-sdk/generated/src/models/FolderDto.ts
903
1589
  function FolderDtoFromJSON(json) {
904
1590
  return FolderDtoFromJSONTyped(json, false);
@@ -943,7 +1629,6 @@ function FolderDtoToJSONTyped(value, ignoreDiscriminator = false) {
943
1629
  Id: value["id"]
944
1630
  };
945
1631
  }
946
-
947
1632
  // ../orchestrator-sdk/generated/src/models/FireTriggersForTasksRequest.ts
948
1633
  function FireTriggersForTasksRequestToJSON(json) {
949
1634
  return FireTriggersForTasksRequestToJSONTyped(json, false);
@@ -956,7 +1641,6 @@ function FireTriggersForTasksRequestToJSONTyped(value, ignoreDiscriminator = fal
956
1641
  identifiers: value["identifiers"]
957
1642
  };
958
1643
  }
959
-
960
1644
  // ../orchestrator-sdk/generated/src/models/Folder.ts
961
1645
  function FolderFromJSON(json) {
962
1646
  return FolderFromJSONTyped(json, false);
@@ -977,7 +1661,6 @@ function FolderFromJSONTyped(json, ignoreDiscriminator) {
977
1661
  isDeleted: json["isDeleted"] == null ? undefined : json["isDeleted"]
978
1662
  };
979
1663
  }
980
-
981
1664
  // ../orchestrator-sdk/generated/src/models/FolderAssignDomainUserRequest.ts
982
1665
  function FolderAssignDomainUserRequestToJSON(json) {
983
1666
  return FolderAssignDomainUserRequestToJSONTyped(json, false);
@@ -990,7 +1673,6 @@ function FolderAssignDomainUserRequestToJSONTyped(value, ignoreDiscriminator = f
990
1673
  assignment: DomainUserAssignmentDtoToJSON(value["assignment"])
991
1674
  };
992
1675
  }
993
-
994
1676
  // ../orchestrator-sdk/generated/src/models/MachineAssignmentsDto.ts
995
1677
  function MachineAssignmentsDtoToJSON(json) {
996
1678
  return MachineAssignmentsDtoToJSONTyped(json, false);
@@ -1017,7 +1699,6 @@ function FolderAssignMachinesRequestToJSONTyped(value, ignoreDiscriminator = fal
1017
1699
  assignments: MachineAssignmentsDtoToJSON(value["assignments"])
1018
1700
  };
1019
1701
  }
1020
-
1021
1702
  // ../orchestrator-sdk/generated/src/models/UserAssignmentsDto.ts
1022
1703
  function UserAssignmentsDtoToJSON(json) {
1023
1704
  return UserAssignmentsDtoToJSONTyped(json, false);
@@ -1044,7 +1725,6 @@ function FolderAssignUsersRequestToJSONTyped(value, ignoreDiscriminator = false)
1044
1725
  assignments: UserAssignmentsDtoToJSON(value["assignments"])
1045
1726
  };
1046
1727
  }
1047
-
1048
1728
  // ../orchestrator-sdk/generated/src/models/SimpleUserEntityDto.ts
1049
1729
  function SimpleUserEntityDtoFromJSON(json) {
1050
1730
  return SimpleUserEntityDtoFromJSONTyped(json, false);
@@ -1095,7 +1775,6 @@ function FolderAssignmentsDtoFromJSONTyped(json, ignoreDiscriminator) {
1095
1775
  roles: json["Roles"] == null ? undefined : json["Roles"].map(RoleUsersDtoFromJSON)
1096
1776
  };
1097
1777
  }
1098
-
1099
1778
  // ../orchestrator-sdk/generated/src/models/FolderIdentifier.ts
1100
1779
  function FolderIdentifierFromJSON(json) {
1101
1780
  return FolderIdentifierFromJSONTyped(json, false);
@@ -1110,7 +1789,6 @@ function FolderIdentifierFromJSONTyped(json, ignoreDiscriminator) {
1110
1789
  path: json["path"] == null ? undefined : json["path"]
1111
1790
  };
1112
1791
  }
1113
-
1114
1792
  // ../orchestrator-sdk/generated/src/models/FolderMachineInheritDto.ts
1115
1793
  function FolderMachineInheritDtoToJSON(json) {
1116
1794
  return FolderMachineInheritDtoToJSONTyped(json, false);
@@ -1125,7 +1803,6 @@ function FolderMachineInheritDtoToJSONTyped(value, ignoreDiscriminator = false)
1125
1803
  InheritEnabled: value["inheritEnabled"]
1126
1804
  };
1127
1805
  }
1128
-
1129
1806
  // ../orchestrator-sdk/generated/src/models/FolderMachineRobotsDto.ts
1130
1807
  function FolderMachineRobotsDtoToJSON(json) {
1131
1808
  return FolderMachineRobotsDtoToJSONTyped(json, false);
@@ -1141,7 +1818,6 @@ function FolderMachineRobotsDtoToJSONTyped(value, ignoreDiscriminator = false) {
1141
1818
  RemovedRobotIds: value["removedRobotIds"]
1142
1819
  };
1143
1820
  }
1144
-
1145
1821
  // ../orchestrator-sdk/generated/src/models/FolderUpdateNameDescriptionRequest.ts
1146
1822
  function FolderUpdateNameDescriptionRequestToJSON(json) {
1147
1823
  return FolderUpdateNameDescriptionRequestToJSONTyped(json, false);
@@ -1155,7 +1831,6 @@ function FolderUpdateNameDescriptionRequestToJSONTyped(value, ignoreDiscriminato
1155
1831
  description: value["description"]
1156
1832
  };
1157
1833
  }
1158
-
1159
1834
  // ../orchestrator-sdk/generated/src/models/JobErrorDto.ts
1160
1835
  function JobErrorDtoFromJSON(json) {
1161
1836
  return JobErrorDtoFromJSONTyped(json, false);
@@ -1206,7 +1881,6 @@ function ForceStopJobsRequestToJSONTyped(value, ignoreDiscriminator = false) {
1206
1881
  setFaulted: value["setFaulted"]
1207
1882
  };
1208
1883
  }
1209
-
1210
1884
  // ../orchestrator-sdk/generated/src/models/HierarchyJobDto.ts
1211
1885
  function HierarchyJobDtoFromJSON(json) {
1212
1886
  return HierarchyJobDtoFromJSONTyped(json, false);
@@ -1238,7 +1912,6 @@ function HierarchyJobDtoFromJSONTyped(json, ignoreDiscriminator) {
1238
1912
  releaseKey: json["releaseKey"] == null ? undefined : json["releaseKey"]
1239
1913
  };
1240
1914
  }
1241
-
1242
1915
  // ../orchestrator-sdk/generated/src/models/JobArgumentsSchemaDto.ts
1243
1916
  function JobArgumentsSchemaDtoFromJSON(json) {
1244
1917
  return JobArgumentsSchemaDtoFromJSONTyped(json, false);
@@ -1254,7 +1927,6 @@ function JobArgumentsSchemaDtoFromJSONTyped(json, ignoreDiscriminator) {
1254
1927
  outputArgumentsJsonSchema: json["OutputArgumentsJsonSchema"] == null ? undefined : json["OutputArgumentsJsonSchema"]
1255
1928
  };
1256
1929
  }
1257
-
1258
1930
  // ../orchestrator-sdk/generated/src/models/JobAttachmentDto.ts
1259
1931
  function JobAttachmentDtoToJSON(json) {
1260
1932
  return JobAttachmentDtoToJSONTyped(json, false);
@@ -1275,7 +1947,6 @@ function JobAttachmentDtoToJSONTyped(value, ignoreDiscriminator = false) {
1275
1947
  id: value["id"]
1276
1948
  };
1277
1949
  }
1278
-
1279
1950
  // ../orchestrator-sdk/generated/src/models/ReleaseVersionDto.ts
1280
1951
  function ReleaseVersionDtoFromJSON(json) {
1281
1952
  return ReleaseVersionDtoFromJSONTyped(json, false);
@@ -1490,7 +2161,6 @@ function JobDtoFromJSONTyped(json, ignoreDiscriminator) {
1490
2161
  id: json["Id"] == null ? undefined : json["Id"]
1491
2162
  };
1492
2163
  }
1493
-
1494
2164
  // ../orchestrator-sdk/generated/src/models/JobMachineInfraTargetDto.ts
1495
2165
  function JobMachineInfraTargetDtoToJSON(json) {
1496
2166
  return JobMachineInfraTargetDtoToJSONTyped(json, false);
@@ -1505,7 +2175,6 @@ function JobMachineInfraTargetDtoToJSONTyped(value, ignoreDiscriminator = false)
1505
2175
  ServiceUserName: value["serviceUserName"]
1506
2176
  };
1507
2177
  }
1508
-
1509
2178
  // ../orchestrator-sdk/generated/src/models/JobStateChangeDto.ts
1510
2179
  function JobStateChangeDtoFromJSON(json) {
1511
2180
  return JobStateChangeDtoFromJSONTyped(json, false);
@@ -1524,7 +2193,6 @@ function JobStateChangeDtoFromJSONTyped(json, ignoreDiscriminator) {
1524
2193
  resumeItemType: json["resumeItemType"] == null ? undefined : json["resumeItemType"]
1525
2194
  };
1526
2195
  }
1527
-
1528
2196
  // ../orchestrator-sdk/generated/src/models/JobStatusOutputInfo.ts
1529
2197
  function JobStatusOutputInfoFromJSON(json) {
1530
2198
  return JobStatusOutputInfoFromJSONTyped(json, false);
@@ -1555,7 +2223,6 @@ function JobStatusOutputInfoFromJSONTyped(json, ignoreDiscriminator) {
1555
2223
  creatorUserKey: json["creatorUserKey"] == null ? undefined : json["creatorUserKey"]
1556
2224
  };
1557
2225
  }
1558
-
1559
2226
  // ../orchestrator-sdk/generated/src/models/JobsHaveExecutionMediaRequest.ts
1560
2227
  function JobsHaveExecutionMediaRequestToJSON(json) {
1561
2228
  return JobsHaveExecutionMediaRequestToJSONTyped(json, false);
@@ -1569,7 +2236,6 @@ function JobsHaveExecutionMediaRequestToJSONTyped(value, ignoreDiscriminator = f
1569
2236
  format: value["format"]
1570
2237
  };
1571
2238
  }
1572
-
1573
2239
  // ../orchestrator-sdk/generated/src/models/MachineFolderDto.ts
1574
2240
  function MachineFolderDtoFromJSON(json) {
1575
2241
  return MachineFolderDtoFromJSONTyped(json, false);
@@ -1616,7 +2282,6 @@ function MachineFolderDtoFromJSONTyped(json, ignoreDiscriminator) {
1616
2282
  updateInfo: json["UpdateInfo"] == null ? undefined : UpdateInfoDtoFromJSON(json["UpdateInfo"])
1617
2283
  };
1618
2284
  }
1619
-
1620
2285
  // ../orchestrator-sdk/generated/src/models/MachineRobotDto.ts
1621
2286
  function MachineRobotDtoToJSON(json) {
1622
2287
  return MachineRobotDtoToJSONTyped(json, false);
@@ -1632,7 +2297,6 @@ function MachineRobotDtoToJSONTyped(value, ignoreDiscriminator = false) {
1632
2297
  RobotUserName: value["robotUserName"]
1633
2298
  };
1634
2299
  }
1635
-
1636
2300
  // ../orchestrator-sdk/generated/src/models/MachinesFolderAssociationsDto.ts
1637
2301
  function MachinesFolderAssociationsDtoToJSON(json) {
1638
2302
  return MachinesFolderAssociationsDtoToJSONTyped(json, false);
@@ -1647,7 +2311,6 @@ function MachinesFolderAssociationsDtoToJSONTyped(value, ignoreDiscriminator = f
1647
2311
  RemovedMachineIds: value["removedMachineIds"]
1648
2312
  };
1649
2313
  }
1650
-
1651
2314
  // ../orchestrator-sdk/generated/src/models/MoveFolderMachineChange.ts
1652
2315
  function MoveFolderMachineChangeFromJSON(json) {
1653
2316
  return MoveFolderMachineChangeFromJSONTyped(json, false);
@@ -1663,7 +2326,6 @@ function MoveFolderMachineChangeFromJSONTyped(json, ignoreDiscriminator) {
1663
2326
  newMachineFolderState: json["NewMachineFolderState"] == null ? undefined : json["NewMachineFolderState"]
1664
2327
  };
1665
2328
  }
1666
-
1667
2329
  // ../orchestrator-sdk/generated/src/models/ODataValueOfIEnumerableOfExtendedFolderDto.ts
1668
2330
  function ODataValueOfIEnumerableOfExtendedFolderDtoFromJSON(json) {
1669
2331
  return ODataValueOfIEnumerableOfExtendedFolderDtoFromJSONTyped(json, false);
@@ -1676,7 +2338,6 @@ function ODataValueOfIEnumerableOfExtendedFolderDtoFromJSONTyped(json, ignoreDis
1676
2338
  value: json["value"] == null ? undefined : json["value"].map(ExtendedFolderDtoFromJSON)
1677
2339
  };
1678
2340
  }
1679
-
1680
2341
  // ../orchestrator-sdk/generated/src/models/ODataValueOfIEnumerableOfFolderDto.ts
1681
2342
  function ODataValueOfIEnumerableOfFolderDtoFromJSON(json) {
1682
2343
  return ODataValueOfIEnumerableOfFolderDtoFromJSONTyped(json, false);
@@ -1689,7 +2350,6 @@ function ODataValueOfIEnumerableOfFolderDtoFromJSONTyped(json, ignoreDiscriminat
1689
2350
  value: json["value"] == null ? undefined : json["value"].map(FolderDtoFromJSON)
1690
2351
  };
1691
2352
  }
1692
-
1693
2353
  // ../orchestrator-sdk/generated/src/models/ODataValueOfIEnumerableOfJobDto.ts
1694
2354
  function ODataValueOfIEnumerableOfJobDtoFromJSON(json) {
1695
2355
  return ODataValueOfIEnumerableOfJobDtoFromJSONTyped(json, false);
@@ -1702,7 +2362,6 @@ function ODataValueOfIEnumerableOfJobDtoFromJSONTyped(json, ignoreDiscriminator)
1702
2362
  value: json["value"] == null ? undefined : json["value"].map(JobDtoFromJSON)
1703
2363
  };
1704
2364
  }
1705
-
1706
2365
  // ../orchestrator-sdk/generated/src/models/ODataValueOfIEnumerableOfMachineFolderDto.ts
1707
2366
  function ODataValueOfIEnumerableOfMachineFolderDtoFromJSON(json) {
1708
2367
  return ODataValueOfIEnumerableOfMachineFolderDtoFromJSONTyped(json, false);
@@ -1715,7 +2374,6 @@ function ODataValueOfIEnumerableOfMachineFolderDtoFromJSONTyped(json, ignoreDisc
1715
2374
  value: json["value"] == null ? undefined : json["value"].map(MachineFolderDtoFromJSON)
1716
2375
  };
1717
2376
  }
1718
-
1719
2377
  // ../orchestrator-sdk/generated/src/models/ODataValueOfIEnumerableOfMoveFolderMachineChange.ts
1720
2378
  function ODataValueOfIEnumerableOfMoveFolderMachineChangeFromJSON(json) {
1721
2379
  return ODataValueOfIEnumerableOfMoveFolderMachineChangeFromJSONTyped(json, false);
@@ -1728,7 +2386,6 @@ function ODataValueOfIEnumerableOfMoveFolderMachineChangeFromJSONTyped(json, ign
1728
2386
  value: json["value"] == null ? undefined : json["value"].map(MoveFolderMachineChangeFromJSON)
1729
2387
  };
1730
2388
  }
1731
-
1732
2389
  // ../orchestrator-sdk/generated/src/models/ODataValueOfIEnumerableOfRobotUserDto.ts
1733
2390
  function ODataValueOfIEnumerableOfRobotUserDtoFromJSON(json) {
1734
2391
  return ODataValueOfIEnumerableOfRobotUserDtoFromJSONTyped(json, false);
@@ -1741,7 +2398,6 @@ function ODataValueOfIEnumerableOfRobotUserDtoFromJSONTyped(json, ignoreDiscrimi
1741
2398
  value: json["value"] == null ? undefined : json["value"].map(RobotUserDtoFromJSON)
1742
2399
  };
1743
2400
  }
1744
-
1745
2401
  // ../orchestrator-sdk/generated/src/models/RunningJobForSessisonDto.ts
1746
2402
  function RunningJobForSessisonDtoFromJSON(json) {
1747
2403
  return RunningJobForSessisonDtoFromJSONTyped(json, false);
@@ -1776,7 +2432,6 @@ function ODataValueOfIEnumerableOfRunningJobForSessisonDtoFromJSONTyped(json, ig
1776
2432
  value: json["value"] == null ? undefined : json["value"].map(RunningJobForSessisonDtoFromJSON)
1777
2433
  };
1778
2434
  }
1779
-
1780
2435
  // ../orchestrator-sdk/generated/src/models/SearchUserDto.ts
1781
2436
  function SearchUserDtoFromJSON(json) {
1782
2437
  return SearchUserDtoFromJSONTyped(json, false);
@@ -1805,7 +2460,6 @@ function ODataValueOfIEnumerableOfSearchUserDtoFromJSONTyped(json, ignoreDiscrim
1805
2460
  value: json["value"] == null ? undefined : json["value"].map(SearchUserDtoFromJSON)
1806
2461
  };
1807
2462
  }
1808
-
1809
2463
  // ../orchestrator-sdk/generated/src/models/UserRolesChangesDto.ts
1810
2464
  function UserRolesChangesDtoFromJSON(json) {
1811
2465
  return UserRolesChangesDtoFromJSONTyped(json, false);
@@ -1833,7 +2487,6 @@ function ODataValueOfIEnumerableOfUserRolesChangesDtoFromJSONTyped(json, ignoreD
1833
2487
  value: json["value"] == null ? undefined : json["value"].map(UserRolesChangesDtoFromJSON)
1834
2488
  };
1835
2489
  }
1836
-
1837
2490
  // ../orchestrator-sdk/generated/src/models/UserEntityDto.ts
1838
2491
  function UserEntityDtoFromJSON(json) {
1839
2492
  return UserEntityDtoFromJSONTyped(json, false);
@@ -1903,7 +2556,6 @@ function ODataValueOfIEnumerableOfUserRolesDtoFromJSONTyped(json, ignoreDiscrimi
1903
2556
  value: json["value"] == null ? undefined : json["value"].map(UserRolesDtoFromJSON)
1904
2557
  };
1905
2558
  }
1906
-
1907
2559
  // ../orchestrator-sdk/generated/src/models/PageResultDtoOfCurrentUserFolderDto.ts
1908
2560
  function PageResultDtoOfCurrentUserFolderDtoFromJSON(json) {
1909
2561
  return PageResultDtoOfCurrentUserFolderDtoFromJSONTyped(json, false);
@@ -1917,7 +2569,6 @@ function PageResultDtoOfCurrentUserFolderDtoFromJSONTyped(json, ignoreDiscrimina
1917
2569
  count: json["Count"] == null ? undefined : json["Count"]
1918
2570
  };
1919
2571
  }
1920
-
1921
2572
  // ../orchestrator-sdk/generated/src/models/RemoveMachinesFromFolderRequest.ts
1922
2573
  function RemoveMachinesFromFolderRequestToJSON(json) {
1923
2574
  return RemoveMachinesFromFolderRequestToJSONTyped(json, false);
@@ -1930,7 +2581,6 @@ function RemoveMachinesFromFolderRequestToJSONTyped(value, ignoreDiscriminator =
1930
2581
  machineIds: value["machineIds"]
1931
2582
  };
1932
2583
  }
1933
-
1934
2584
  // ../orchestrator-sdk/generated/src/models/RemoveUserByKeyFromFolderRequest.ts
1935
2585
  function RemoveUserByKeyFromFolderRequestToJSON(json) {
1936
2586
  return RemoveUserByKeyFromFolderRequestToJSONTyped(json, false);
@@ -1943,7 +2593,6 @@ function RemoveUserByKeyFromFolderRequestToJSONTyped(value, ignoreDiscriminator
1943
2593
  userKey: value["userKey"]
1944
2594
  };
1945
2595
  }
1946
-
1947
2596
  // ../orchestrator-sdk/generated/src/models/RemoveUserFromFolderRequest.ts
1948
2597
  function RemoveUserFromFolderRequestToJSON(json) {
1949
2598
  return RemoveUserFromFolderRequestToJSONTyped(json, false);
@@ -1956,7 +2605,6 @@ function RemoveUserFromFolderRequestToJSONTyped(value, ignoreDiscriminator = fal
1956
2605
  userId: value["userId"]
1957
2606
  };
1958
2607
  }
1959
-
1960
2608
  // ../orchestrator-sdk/generated/src/models/ResourcePaginationResultOfFolder.ts
1961
2609
  function ResourcePaginationResultOfFolderFromJSON(json) {
1962
2610
  return ResourcePaginationResultOfFolderFromJSONTyped(json, false);
@@ -1971,7 +2619,6 @@ function ResourcePaginationResultOfFolderFromJSONTyped(json, ignoreDiscriminator
1971
2619
  cursor: json["cursor"] == null ? undefined : json["cursor"]
1972
2620
  };
1973
2621
  }
1974
-
1975
2622
  // ../orchestrator-sdk/generated/src/models/RestartJobRequest.ts
1976
2623
  function RestartJobRequestToJSON(json) {
1977
2624
  return RestartJobRequestToJSONTyped(json, false);
@@ -1984,7 +2631,6 @@ function RestartJobRequestToJSONTyped(value, ignoreDiscriminator = false) {
1984
2631
  jobId: value["jobId"]
1985
2632
  };
1986
2633
  }
1987
-
1988
2634
  // ../orchestrator-sdk/generated/src/models/ResumeJobRequest.ts
1989
2635
  function ResumeJobRequestToJSON(json) {
1990
2636
  return ResumeJobRequestToJSONTyped(json, false);
@@ -1999,7 +2645,6 @@ function ResumeJobRequestToJSONTyped(value, ignoreDiscriminator = false) {
1999
2645
  inputArguments: value["inputArguments"]
2000
2646
  };
2001
2647
  }
2002
-
2003
2648
  // ../orchestrator-sdk/generated/src/models/RootFolderDto.ts
2004
2649
  function RootFolderDtoFromJSON(json) {
2005
2650
  return RootFolderDtoFromJSONTyped(json, false);
@@ -2012,7 +2657,6 @@ function RootFolderDtoFromJSONTyped(json, ignoreDiscriminator) {
2012
2657
  key: json["key"] == null ? undefined : json["key"]
2013
2658
  };
2014
2659
  }
2015
-
2016
2660
  // ../orchestrator-sdk/generated/src/models/StartProcessDto.ts
2017
2661
  function StartProcessDtoToJSON(json) {
2018
2662
  return StartProcessDtoToJSONTyped(json, false);
@@ -2077,7 +2721,6 @@ function StartJobsRequestToJSONTyped(value, ignoreDiscriminator = false) {
2077
2721
  startInfo: StartProcessDtoToJSON(value["startInfo"])
2078
2722
  };
2079
2723
  }
2080
-
2081
2724
  // ../orchestrator-sdk/generated/src/models/StopJobRequest.ts
2082
2725
  function StopJobRequestToJSON(json) {
2083
2726
  return StopJobRequestToJSONTyped(json, false);
@@ -2090,7 +2733,6 @@ function StopJobRequestToJSONTyped(value, ignoreDiscriminator = false) {
2090
2733
  strategy: value["strategy"]
2091
2734
  };
2092
2735
  }
2093
-
2094
2736
  // ../orchestrator-sdk/generated/src/models/StopJobsRequest.ts
2095
2737
  function StopJobsRequestToJSON(json) {
2096
2738
  return StopJobsRequestToJSONTyped(json, false);
@@ -2105,7 +2747,6 @@ function StopJobsRequestToJSONTyped(value, ignoreDiscriminator = false) {
2105
2747
  batchExecutionKey: value["batchExecutionKey"]
2106
2748
  };
2107
2749
  }
2108
-
2109
2750
  // ../orchestrator-sdk/generated/src/models/UpdateMachinesToFolderAssociationsRequest.ts
2110
2751
  function UpdateMachinesToFolderAssociationsRequestToJSON(json) {
2111
2752
  return UpdateMachinesToFolderAssociationsRequestToJSONTyped(json, false);
@@ -2118,7 +2759,6 @@ function UpdateMachinesToFolderAssociationsRequestToJSONTyped(value, ignoreDiscr
2118
2759
  associations: MachinesFolderAssociationsDtoToJSON(value["associations"])
2119
2760
  };
2120
2761
  }
2121
-
2122
2762
  // ../orchestrator-sdk/generated/src/models/UserRoleAssignmentsDto.ts
2123
2763
  function UserRoleAssignmentsDtoFromJSON(json) {
2124
2764
  return UserRoleAssignmentsDtoFromJSONTyped(json, false);
@@ -2134,7 +2774,6 @@ function UserRoleAssignmentsDtoFromJSONTyped(json, ignoreDiscriminator) {
2134
2774
  id: json["Id"] == null ? undefined : json["Id"]
2135
2775
  };
2136
2776
  }
2137
-
2138
2777
  // ../orchestrator-sdk/generated/src/models/ValidationResultDto.ts
2139
2778
  function ValidationResultDtoFromJSON(json) {
2140
2779
  return ValidationResultDtoFromJSONTyped(json, false);
@@ -2149,7 +2788,6 @@ function ValidationResultDtoFromJSONTyped(json, ignoreDiscriminator) {
2149
2788
  errorCodes: json["ErrorCodes"] == null ? undefined : json["ErrorCodes"]
2150
2789
  };
2151
2790
  }
2152
-
2153
2791
  // ../orchestrator-sdk/generated/src/apis/FoldersApi.ts
2154
2792
  class FoldersApi extends BaseAPI {
2155
2793
  async foldersAssignDirectoryUserRaw(requestParameters, initOverrides) {
@@ -3295,7 +3933,6 @@ class FoldersApi extends BaseAPI {
3295
3933
  await this.foldersUpdateMachinesToFolderAssociationsRaw(requestParameters, initOverrides);
3296
3934
  }
3297
3935
  }
3298
-
3299
3936
  // ../orchestrator-sdk/generated/src/apis/JobsApi.ts
3300
3937
  class JobsApi extends BaseAPI {
3301
3938
  async jobsCreateTestAutomationJobsRaw(requestParameters, initOverrides) {
@@ -4101,23 +4738,31 @@ async function resolveByPath(foldersApi, folderPath) {
4101
4738
  displayName: folder.displayName
4102
4739
  };
4103
4740
  }
4741
+ // ../orchestrator-sdk/src/odata.ts
4742
+ var ODATA_STRING_LITERAL_PATTERN = /^'(?:[^']|'')*'$/;
4743
+ function quoteODataStringLiteral(value) {
4744
+ if (ODATA_STRING_LITERAL_PATTERN.test(value)) {
4745
+ return value;
4746
+ }
4747
+ return `'${value.replace(/'/g, "''")}'`;
4748
+ }
4104
4749
  // src/services/traces-service.ts
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;
4750
+ var GUID_RE2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
4106
4751
  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;
4107
4752
  async function getTraceIdForJob(jobKey, options) {
4108
- if (!GUID_RE.test(jobKey)) {
4753
+ if (!GUID_RE2.test(jobKey)) {
4109
4754
  throw new Error(`Invalid job key format: ${jobKey}`);
4110
4755
  }
4111
4756
  const folder = await resolveFolder({ folderPath: options.folderPath, folderKey: options.folderKey }, { tenant: options.tenant });
4112
- const [apiError, api] = await catchError(createApiClient(JobsApi, {
4757
+ const [apiError, api] = await catchError8(createApiClient(JobsApi, {
4113
4758
  tenant: options.tenant,
4114
4759
  folderId: folder?.id.toString()
4115
4760
  }));
4116
4761
  if (apiError) {
4117
4762
  throw new Error(apiError.message);
4118
4763
  }
4119
- const [jobsError, response] = await catchError(api.jobsGet({
4120
- $filter: `Key eq ${jobKey}`,
4764
+ const [jobsError, response] = await catchError8(api.jobsGet({
4765
+ $filter: `Key eq ${quoteODataStringLiteral(jobKey)}`,
4121
4766
  $top: 1
4122
4767
  }));
4123
4768
  if (jobsError) {
@@ -4127,13 +4772,12 @@ async function getTraceIdForJob(jobKey, options) {
4127
4772
  throw new Error(`Job not found: ${jobKey}`);
4128
4773
  }
4129
4774
  const job = response.value[0];
4130
- if (!job.traceId) {
4131
- throw new Error(`Job ${jobKey} has no associated trace ID`);
4132
- }
4133
- return job.traceId;
4775
+ const jobTraceId = typeof job.traceId === "string" && job.traceId.length > 0 ? job.traceId : undefined;
4776
+ const resolvedJobKey = typeof job.key === "string" && job.key.length > 0 ? job.key : jobKey;
4777
+ return jobTraceId ?? resolvedJobKey;
4134
4778
  }
4135
4779
  async function getSpansForTrace(traceId, options) {
4136
- const [loginError, loginStatus] = await catchError(getLoginStatusAsync());
4780
+ const [loginError, loginStatus] = await catchError8(getLoginStatusAsync2());
4137
4781
  if (loginError) {
4138
4782
  throw new Error(loginError.message);
4139
4783
  }
@@ -4148,7 +4792,7 @@ async function getSpansForTrace(traceId, options) {
4148
4792
  throw new Error(`Invalid trace ID format: ${traceId}. Must be a 32-char hex string or GUID.`);
4149
4793
  }
4150
4794
  const traceIdNoHyphens = traceId.replaceAll("-", "");
4151
- const url = `${loginStatus.baseUrl}/${loginStatus.organizationId}/${encodeURIComponent(tenantName)}/llmopstenant_/api/Traces/v2/spans/otel?traceId=${encodeURIComponent(traceIdNoHyphens)}`;
4795
+ const url = `${loginStatus.baseUrl}/${encodeURIComponent(loginStatus.organizationId)}/${encodeURIComponent(tenantName)}/llmopstenant_/api/Traces/v2/spans/otel?traceId=${encodeURIComponent(traceIdNoHyphens)}`;
4152
4796
  const response = await fetch(url, {
4153
4797
  method: "GET",
4154
4798
  headers: {
@@ -4190,43 +4834,43 @@ var SPANS_GET_EXAMPLES = [
4190
4834
  ];
4191
4835
  var registerSpansCommand = (program) => {
4192
4836
  const spans = program.command("spans").description("Manage LLM Observability spans");
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) => {
4837
+ 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(processContext7, async (traceId, options) => {
4194
4838
  let resolvedTraceId;
4195
4839
  if (options.jobKey) {
4196
- const [traceIdError, tid] = await catchError2(getTraceIdForJob(options.jobKey, options));
4840
+ const [traceIdError, tid] = await catchError9(getTraceIdForJob(options.jobKey, options));
4197
4841
  if (traceIdError) {
4198
- OutputFormatter.error({
4199
- Result: RESULTS.Failure,
4842
+ OutputFormatter7.error({
4843
+ Result: RESULTS7.Failure,
4200
4844
  Message: "Error retrieving trace ID for job",
4201
4845
  Instructions: await extractErrorMessage(traceIdError)
4202
4846
  });
4203
- processContext.exit(1);
4847
+ processContext7.exit(1);
4204
4848
  return;
4205
4849
  }
4206
4850
  resolvedTraceId = tid;
4207
4851
  } else if (traceId) {
4208
4852
  resolvedTraceId = traceId;
4209
4853
  } else {
4210
- OutputFormatter.error({
4211
- Result: RESULTS.Failure,
4854
+ OutputFormatter7.error({
4855
+ Result: RESULTS7.Failure,
4212
4856
  Message: "Missing required argument",
4213
4857
  Instructions: "Provide either a trace-id argument or --job-key option"
4214
4858
  });
4215
- processContext.exit(1);
4859
+ processContext7.exit(1);
4216
4860
  return;
4217
4861
  }
4218
- const [spansError, spans2] = await catchError2(getSpansForTrace(resolvedTraceId, options));
4862
+ const [spansError, spans2] = await catchError9(getSpansForTrace(resolvedTraceId, options));
4219
4863
  if (spansError) {
4220
- OutputFormatter.error({
4221
- Result: RESULTS.Failure,
4864
+ OutputFormatter7.error({
4865
+ Result: RESULTS7.Failure,
4222
4866
  Message: "Error retrieving spans for trace",
4223
4867
  Instructions: await extractErrorMessage(spansError)
4224
4868
  });
4225
- processContext.exit(1);
4869
+ processContext7.exit(1);
4226
4870
  return;
4227
4871
  }
4228
- OutputFormatter.success({
4229
- Result: RESULTS.Success,
4872
+ OutputFormatter7.success({
4873
+ Result: RESULTS7.Success,
4230
4874
  Code: "TraceSpans",
4231
4875
  Data: spans2
4232
4876
  });
@@ -4242,6 +4886,7 @@ var metadata = {
4242
4886
  };
4243
4887
  var registerCommands = async (program) => {
4244
4888
  registerSpansCommand(program);
4889
+ registerFeedbackCommand(program);
4245
4890
  };
4246
4891
  export {
4247
4892
  registerCommands,