@uipath/uipath-typescript 1.5.0 → 1.5.1

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 (45) hide show
  1. package/README.md +7 -1
  2. package/dist/assets/index.cjs +107 -6
  3. package/dist/assets/index.d.ts +12 -1
  4. package/dist/assets/index.mjs +107 -6
  5. package/dist/attachments/index.cjs +95 -3
  6. package/dist/attachments/index.mjs +95 -3
  7. package/dist/buckets/index.cjs +111 -6
  8. package/dist/buckets/index.d.ts +12 -1
  9. package/dist/buckets/index.mjs +111 -6
  10. package/dist/cases/index.cjs +434 -266
  11. package/dist/cases/index.d.ts +140 -3
  12. package/dist/cases/index.mjs +434 -266
  13. package/dist/conversational-agent/index.cjs +23 -1
  14. package/dist/conversational-agent/index.d.ts +117 -6
  15. package/dist/conversational-agent/index.mjs +23 -1
  16. package/dist/core/index.cjs +1 -1
  17. package/dist/core/index.mjs +1 -1
  18. package/dist/entities/index.cjs +423 -0
  19. package/dist/entities/index.d.ts +441 -1
  20. package/dist/entities/index.mjs +422 -1
  21. package/dist/index.cjs +974 -293
  22. package/dist/index.d.ts +1150 -43
  23. package/dist/index.mjs +975 -294
  24. package/dist/index.umd.js +974 -293
  25. package/dist/jobs/index.cjs +12 -5
  26. package/dist/jobs/index.d.ts +12 -1
  27. package/dist/jobs/index.mjs +12 -5
  28. package/dist/maestro-processes/index.cjs +344 -243
  29. package/dist/maestro-processes/index.d.ts +189 -5
  30. package/dist/maestro-processes/index.mjs +344 -243
  31. package/dist/notifications/index.cjs +2012 -0
  32. package/dist/notifications/index.d.ts +615 -0
  33. package/dist/notifications/index.mjs +2010 -0
  34. package/dist/processes/index.cjs +93 -9
  35. package/dist/processes/index.d.ts +12 -1
  36. package/dist/processes/index.mjs +93 -9
  37. package/dist/queues/index.cjs +106 -5
  38. package/dist/queues/index.d.ts +12 -1
  39. package/dist/queues/index.mjs +106 -5
  40. package/dist/tasks/index.cjs +100 -4
  41. package/dist/tasks/index.mjs +100 -4
  42. package/dist/traces/index.cjs +218 -4
  43. package/dist/traces/index.d.ts +357 -22
  44. package/dist/traces/index.mjs +219 -5
  45. package/package.json +14 -4
@@ -948,6 +948,17 @@ const TRACEVIEW_SPANS_PAGINATION = {
948
948
  /** Total count path — same envelope location as the agents list. */
949
949
  TOTAL_COUNT_FIELD: AGENTS_PAGINATION.TOTAL_COUNT_FIELD
950
950
  };
951
+ /**
952
+ * Governance decisions pagination constants — decision rows sit directly
953
+ * under `items`. This endpoint returns no total-count field, so no
954
+ * `TOTAL_COUNT_FIELD` is defined; `hasNextPage` falls back to page-fullness
955
+ * (a full page implies there may be more). Request params reuse
956
+ * {@link AGENTS_OFFSET_PARAMS} (pageSize + 0-based pageNumber).
957
+ */
958
+ const GOVERNANCE_DECISIONS_PAGINATION = {
959
+ /** Field name for the decision-rows array in the response. */
960
+ ITEMS_FIELD: 'items',
961
+ };
951
962
  /**
952
963
  * OData OFFSET pagination parameter names (ODATA-style)
953
964
  */
@@ -1845,6 +1856,10 @@ const AGENT_TRACES_ENDPOINTS = {
1845
1856
  GET_SPANS_BY_TRACE_ID: (traceId) => `${INSIGHTS_RTM_BASE}/Traceview/spans/${traceId}`,
1846
1857
  /** Paginated spans whose reference hierarchy contains the given reference id. */
1847
1858
  GET_SPANS_BY_REFERENCE: (referenceId) => `${INSIGHTS_RTM_BASE}/Traceview/spans/reference/${referenceId}`,
1859
+ /** Paginated raw governance decision rows. */
1860
+ GET_GOVERNANCE_DECISIONS: `${INSIGHTS_RTM_BASE}/Governance/agentic/traces`,
1861
+ /** Aggregated governance posture (totals + top-N breakdowns). */
1862
+ GET_GOVERNANCE_SUMMARY: `${INSIGHTS_RTM_BASE}/Governance/agentic/summary`,
1848
1863
  };
1849
1864
 
1850
1865
  /**
@@ -1983,6 +1998,52 @@ __decorate([
1983
1998
  track('Traces.GetSpansByIds')
1984
1999
  ], TracesService.prototype, "getSpansByIds", null);
1985
2000
 
2001
+ // ─── Governance ─────────────────────────────────────────────────────
2002
+ /**
2003
+ * Evaluation mode of a governance decision.
2004
+ */
2005
+ exports.AgentGovernanceMode = void 0;
2006
+ (function (AgentGovernanceMode) {
2007
+ /** Policy evaluated and logged, but not enforced. */
2008
+ AgentGovernanceMode["Audit"] = "AUDIT";
2009
+ /** Policy evaluated and enforced. */
2010
+ AgentGovernanceMode["Enforce"] = "ENFORCE";
2011
+ /** Unrecognized or missing mode. */
2012
+ AgentGovernanceMode["Unknown"] = "Unknown";
2013
+ })(exports.AgentGovernanceMode || (exports.AgentGovernanceMode = {}));
2014
+ /**
2015
+ * Verdict of a governance decision (`Deny` = violation).
2016
+ */
2017
+ exports.AgentGovernanceVerdict = void 0;
2018
+ (function (AgentGovernanceVerdict) {
2019
+ /** Allowed — not a violation. */
2020
+ AgentGovernanceVerdict["Allow"] = "ALLOW";
2021
+ /** Denied — counts as a violation. */
2022
+ AgentGovernanceVerdict["Deny"] = "DENY";
2023
+ /** Unrecognized or missing verdict. */
2024
+ AgentGovernanceVerdict["Unknown"] = "Unknown";
2025
+ })(exports.AgentGovernanceVerdict || (exports.AgentGovernanceVerdict = {}));
2026
+ /**
2027
+ * Sections the governance summary can compute. `action` and `mode` are opt-in.
2028
+ */
2029
+ exports.AgentGovernanceSection = void 0;
2030
+ (function (AgentGovernanceSection) {
2031
+ /** Scalar totals (`total`, `violations`). */
2032
+ AgentGovernanceSection["Totals"] = "totals";
2033
+ /** Breakdown by governance hook. */
2034
+ AgentGovernanceSection["Hook"] = "hook";
2035
+ /** Breakdown by agent. */
2036
+ AgentGovernanceSection["Agent"] = "agent";
2037
+ /** Breakdown by policy. */
2038
+ AgentGovernanceSection["Policy"] = "policy";
2039
+ /** Breakdown by governance pack. */
2040
+ AgentGovernanceSection["Pack"] = "pack";
2041
+ /** Breakdown by enforcement action (opt-in). */
2042
+ AgentGovernanceSection["Action"] = "action";
2043
+ /** Breakdown by evaluation mode (opt-in). */
2044
+ AgentGovernanceSection["Mode"] = "mode";
2045
+ })(exports.AgentGovernanceSection || (exports.AgentGovernanceSection = {}));
2046
+
1986
2047
  /**
1987
2048
  * Maps a raw span record to a {@link AgentSpanGetResponse}
1988
2049
  */
@@ -1990,6 +2051,22 @@ const transformSpan = (span) => {
1990
2051
  const { expiryTimeUtc, ...rest } = span;
1991
2052
  return { ...rest, expiredTime: expiryTimeUtc };
1992
2053
  };
2054
+ // Case-insensitive lookups from a raw API value → enum member (keys upper-cased).
2055
+ const GOVERNANCE_MODE_BY_VALUE = new Map(Object.values(exports.AgentGovernanceMode).map((mode) => [mode.toUpperCase(), mode]));
2056
+ const GOVERNANCE_VERDICT_BY_VALUE = new Map(Object.values(exports.AgentGovernanceVerdict).map((verdict) => [verdict.toUpperCase(), verdict]));
2057
+ /** Maps a raw mode string to {@link AgentGovernanceMode}, case-insensitively; missing/unrecognized → `Unknown`. */
2058
+ const toGovernanceMode = (raw) => (raw != null ? GOVERNANCE_MODE_BY_VALUE.get(raw.toUpperCase()) : undefined) ?? exports.AgentGovernanceMode.Unknown;
2059
+ /** Maps a raw verdict string to {@link AgentGovernanceVerdict}, case-insensitively; missing/unrecognized → `Unknown`. */
2060
+ const toGovernanceVerdict = (raw) => (raw != null ? GOVERNANCE_VERDICT_BY_VALUE.get(raw.toUpperCase()) : undefined) ?? exports.AgentGovernanceVerdict.Unknown;
2061
+ /**
2062
+ * Normalizes a raw governance row, mapping the mode and verdict strings to
2063
+ * their enums while leaving the other fields untouched.
2064
+ */
2065
+ const transformGovernanceDecision = (row) => ({
2066
+ ...row,
2067
+ mode: toGovernanceMode(row.mode),
2068
+ evaluatorResult: toGovernanceVerdict(row.evaluatorResult),
2069
+ });
1993
2070
  /**
1994
2071
  * Service for retrieving UiPath Agent trace metrics.
1995
2072
  */
@@ -2125,10 +2202,6 @@ class AgentTracesService extends BaseService {
2125
2202
  /**
2126
2203
  * Retrieves spans whose reference hierarchy contains the given reference id.
2127
2204
  *
2128
- * Returns a {@link PaginatedResponse} when pagination options (`pageSize`,
2129
- * `cursor`, or `jumpToPage`) are provided, otherwise a
2130
- * {@link NonPaginatedResponse}.
2131
- *
2132
2205
  * @param referenceId - Reference id matched against each span's reference hierarchy
2133
2206
  * @param options - Optional pagination and hierarchy/time filters
2134
2207
  * @returns Promise resolving to a paginated or non-paginated list of {@link AgentSpanGetResponse}
@@ -2189,6 +2262,141 @@ class AgentTracesService extends BaseService {
2189
2262
  },
2190
2263
  }, apiOptions);
2191
2264
  }
2265
+ /**
2266
+ * Lists individual governance decisions from agent execution traces — each
2267
+ * policy check's allow/deny outcome with its agent, policy, pack, hook, and
2268
+ * mode, plus the trace it belongs to — over the requested window. Filterable
2269
+ * and paginated.
2270
+ *
2271
+ * @remarks Requires the caller to be an organization admin. Non-admin callers get a `403` and the SDK throws an {@link AuthorizationError}.
2272
+ *
2273
+ * @param startTime - Inclusive lower bound for the query window
2274
+ * @param options - Optional window end, filters, and pagination
2275
+ * @returns Promise resolving to a paginated or non-paginated list of {@link AgentGovernanceDecisionGetResponse}
2276
+ * @example
2277
+ * ```typescript
2278
+ * import { AgentTraces } from '@uipath/uipath-typescript/traces';
2279
+ *
2280
+ * const trace = new AgentTraces(sdk);
2281
+ *
2282
+ * // Decision rows since a start time
2283
+ * const result = await trace.getGovernanceDecisions(new Date('2025-05-01T00:00:00Z'));
2284
+ * result.items.forEach((row) => {
2285
+ * console.log(`${row.hook} ${row.policyId}: ${row.evaluatorResult}`);
2286
+ * });
2287
+ * ```
2288
+ * @example
2289
+ * ```typescript
2290
+ * // Violations only, for one agent, paginated
2291
+ * const page = await trace.getGovernanceDecisions(new Date('2025-05-01T00:00:00Z'), {
2292
+ * endTime: new Date('2025-06-01T00:00:00Z'),
2293
+ * violationsOnly: true,
2294
+ * agentId: '<agentProjectKey>',
2295
+ * pageSize: 25,
2296
+ * });
2297
+ * if (page.hasNextPage && page.nextCursor) {
2298
+ * const next = await trace.getGovernanceDecisions(new Date('2025-05-01T00:00:00Z'), { cursor: page.nextCursor });
2299
+ * }
2300
+ * ```
2301
+ * @example
2302
+ * ```typescript
2303
+ * import { isAuthorizationError } from '@uipath/uipath-typescript/core';
2304
+ *
2305
+ * // Non-admin callers get a 403
2306
+ * try {
2307
+ * await trace.getGovernanceDecisions(new Date('2025-05-01T00:00:00Z'));
2308
+ * } catch (error) {
2309
+ * if (isAuthorizationError(error)) {
2310
+ * console.error('Governance data requires an organization admin.');
2311
+ * }
2312
+ * }
2313
+ * ```
2314
+ */
2315
+ async getGovernanceDecisions(startTime, options) {
2316
+ const { endTime, ...rest } = options ?? {};
2317
+ const apiOptions = {
2318
+ ...rest,
2319
+ startTime: startTime.toISOString(),
2320
+ ...(endTime !== undefined ? { endTime: endTime.toISOString() } : {}),
2321
+ };
2322
+ return PaginationHelpers.getAll({
2323
+ serviceAccess: this.createPaginationServiceAccess(),
2324
+ getEndpoint: () => AGENT_TRACES_ENDPOINTS.GET_GOVERNANCE_DECISIONS,
2325
+ method: HTTP_METHODS.POST,
2326
+ transformFn: transformGovernanceDecision,
2327
+ excludeFromPrefix: Object.keys(apiOptions),
2328
+ pagination: {
2329
+ paginationType: PaginationType.OFFSET,
2330
+ itemsField: GOVERNANCE_DECISIONS_PAGINATION.ITEMS_FIELD,
2331
+ paginationParams: {
2332
+ pageSizeParam: AGENTS_OFFSET_PARAMS.PAGE_SIZE_PARAM,
2333
+ offsetParam: AGENTS_OFFSET_PARAMS.OFFSET_PARAM,
2334
+ countParam: AGENTS_OFFSET_PARAMS.COUNT_PARAM,
2335
+ convertToSkip: false,
2336
+ zeroBased: true,
2337
+ },
2338
+ },
2339
+ }, apiOptions);
2340
+ }
2341
+ /**
2342
+ * Summarizes governance decisions across agent execution traces — total
2343
+ * decisions and violations, plus top breakdowns by hook, agent, policy, and
2344
+ * pack — over the requested window. Filterable.
2345
+ *
2346
+ * @remarks Requires the caller to be an organization admin. Non-admin callers get a `403` and the SDK throws an {@link AuthorizationError}.
2347
+ *
2348
+ * @param startTime - Inclusive lower bound for the query window
2349
+ * @param options - Optional window end, top-N, pack scope, and sections
2350
+ * @returns Promise resolving to {@link AgentGovernanceGetSummaryResponse}
2351
+ * @example
2352
+ * ```typescript
2353
+ * import { AgentTraces } from '@uipath/uipath-typescript/traces';
2354
+ *
2355
+ * const trace = new AgentTraces(sdk);
2356
+ *
2357
+ * // Default posture since a start time
2358
+ * const summary = await trace.getGovernanceSummary(new Date('2025-05-01T00:00:00Z'));
2359
+ * console.log(`${summary.violations} / ${summary.total} violations`);
2360
+ * summary.byPolicy.forEach((p) => console.log(`${p.key}: ${p.violationCount}`));
2361
+ * ```
2362
+ * @example
2363
+ * ```typescript
2364
+ * import { AgentGovernanceSection } from '@uipath/uipath-typescript/traces';
2365
+ *
2366
+ * // Top 5 per breakdown, scoped to a pack, including the opt-in action/mode sections
2367
+ * const summary = await trace.getGovernanceSummary(new Date('2025-05-01T00:00:00Z'), {
2368
+ * topN: 5,
2369
+ * packName: 'ISO/IEC 42001:2023 Runtime',
2370
+ * sections: [AgentGovernanceSection.Action, AgentGovernanceSection.Mode],
2371
+ * });
2372
+ * ```
2373
+ * @example
2374
+ * ```typescript
2375
+ * import { isAuthorizationError } from '@uipath/uipath-typescript/core';
2376
+ *
2377
+ * // Non-admin callers get a 403
2378
+ * try {
2379
+ * await trace.getGovernanceSummary(new Date('2025-05-01T00:00:00Z'));
2380
+ * } catch (error) {
2381
+ * if (isAuthorizationError(error)) {
2382
+ * console.error('Governance data requires an organization admin.');
2383
+ * }
2384
+ * }
2385
+ * ```
2386
+ */
2387
+ async getGovernanceSummary(startTime, options) {
2388
+ const body = { startTime: startTime.toISOString() };
2389
+ if (options?.endTime !== undefined)
2390
+ body.endTime = options.endTime.toISOString();
2391
+ if (options?.topN !== undefined)
2392
+ body.topN = options.topN;
2393
+ if (options?.packName !== undefined)
2394
+ body.packName = options.packName;
2395
+ if (options?.sections !== undefined)
2396
+ body.sections = options.sections;
2397
+ const response = await this.post(AGENT_TRACES_ENDPOINTS.GET_GOVERNANCE_SUMMARY, body);
2398
+ return response.data;
2399
+ }
2192
2400
  buildTraceFilterBody(options) {
2193
2401
  const body = {};
2194
2402
  if (options?.startTime !== undefined)
@@ -2221,6 +2429,12 @@ __decorate([
2221
2429
  __decorate([
2222
2430
  track('AgentTraces.GetSpansByReference')
2223
2431
  ], AgentTracesService.prototype, "getSpansByReference", null);
2432
+ __decorate([
2433
+ track('AgentTraces.GetGovernanceDecisions')
2434
+ ], AgentTracesService.prototype, "getGovernanceDecisions", null);
2435
+ __decorate([
2436
+ track('AgentTraces.GetGovernanceSummary')
2437
+ ], AgentTracesService.prototype, "getGovernanceSummary", null);
2224
2438
 
2225
2439
  exports.AgentTraceExecutionType = exports.SpanExecutionType;
2226
2440
  exports.AgentTraces = AgentTracesService;