@uipath/uipath-typescript 1.4.2 → 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 (52) hide show
  1. package/README.md +7 -1
  2. package/dist/agent-memory/index.d.ts +4 -1
  3. package/dist/agents/index.cjs +341 -6
  4. package/dist/agents/index.d.ts +717 -16
  5. package/dist/agents/index.mjs +342 -7
  6. package/dist/assets/index.cjs +132 -15
  7. package/dist/assets/index.d.ts +12 -1
  8. package/dist/assets/index.mjs +132 -15
  9. package/dist/attachments/index.cjs +120 -12
  10. package/dist/attachments/index.mjs +120 -12
  11. package/dist/buckets/index.cjs +136 -15
  12. package/dist/buckets/index.d.ts +12 -1
  13. package/dist/buckets/index.mjs +136 -15
  14. package/dist/cases/index.cjs +1203 -938
  15. package/dist/cases/index.d.ts +325 -45
  16. package/dist/cases/index.mjs +1203 -938
  17. package/dist/conversational-agent/index.cjs +48 -10
  18. package/dist/conversational-agent/index.d.ts +117 -6
  19. package/dist/conversational-agent/index.mjs +48 -10
  20. package/dist/core/index.cjs +1 -1
  21. package/dist/core/index.mjs +1 -1
  22. package/dist/entities/index.cjs +448 -9
  23. package/dist/entities/index.d.ts +441 -1
  24. package/dist/entities/index.mjs +447 -10
  25. package/dist/feedback/index.cjs +25 -9
  26. package/dist/feedback/index.mjs +25 -9
  27. package/dist/index.cjs +1281 -330
  28. package/dist/index.d.ts +1988 -143
  29. package/dist/index.mjs +1282 -331
  30. package/dist/index.umd.js +1230 -279
  31. package/dist/jobs/index.cjs +141 -19
  32. package/dist/jobs/index.d.ts +22 -6
  33. package/dist/jobs/index.mjs +141 -19
  34. package/dist/maestro-processes/index.cjs +553 -354
  35. package/dist/maestro-processes/index.d.ts +376 -47
  36. package/dist/maestro-processes/index.mjs +553 -354
  37. package/dist/notifications/index.cjs +2012 -0
  38. package/dist/notifications/index.d.ts +615 -0
  39. package/dist/notifications/index.mjs +2010 -0
  40. package/dist/processes/index.cjs +118 -18
  41. package/dist/processes/index.d.ts +18 -2
  42. package/dist/processes/index.mjs +118 -18
  43. package/dist/queues/index.cjs +131 -14
  44. package/dist/queues/index.d.ts +12 -1
  45. package/dist/queues/index.mjs +131 -14
  46. package/dist/tasks/index.cjs +125 -13
  47. package/dist/tasks/index.d.ts +4 -1
  48. package/dist/tasks/index.mjs +125 -13
  49. package/dist/traces/index.cjs +220 -6
  50. package/dist/traces/index.d.ts +360 -25
  51. package/dist/traces/index.mjs +221 -7
  52. package/package.json +14 -4
@@ -946,6 +946,17 @@ const TRACEVIEW_SPANS_PAGINATION = {
946
946
  /** Total count path — same envelope location as the agents list. */
947
947
  TOTAL_COUNT_FIELD: AGENTS_PAGINATION.TOTAL_COUNT_FIELD
948
948
  };
949
+ /**
950
+ * Governance decisions pagination constants — decision rows sit directly
951
+ * under `items`. This endpoint returns no total-count field, so no
952
+ * `TOTAL_COUNT_FIELD` is defined; `hasNextPage` falls back to page-fullness
953
+ * (a full page implies there may be more). Request params reuse
954
+ * {@link AGENTS_OFFSET_PARAMS} (pageSize + 0-based pageNumber).
955
+ */
956
+ const GOVERNANCE_DECISIONS_PAGINATION = {
957
+ /** Field name for the decision-rows array in the response. */
958
+ ITEMS_FIELD: 'items',
959
+ };
949
960
  /**
950
961
  * OData OFFSET pagination parameter names (ODATA-style)
951
962
  */
@@ -1837,12 +1848,16 @@ const AGENT_TRACES_ENDPOINTS = {
1837
1848
  GET_ERRORS_TIMELINE: `${INSIGHTS_RTM_BASE}/Traceview/errorsTimeline`,
1838
1849
  /** Trace-level time-series of latency (decimal seconds per series). */
1839
1850
  GET_LATENCY_TIMELINE: `${INSIGHTS_RTM_BASE}/Traceview/latencyTimeline`,
1840
- /** Trace-level per-agent AGU/PLTU consumption totals. */
1851
+ /** Trace-level per-agent Agent Units and Platform Units consumption totals. */
1841
1852
  GET_UNIT_CONSUMPTION: `${INSIGHTS_RTM_BASE}/Traceview/unitConsumption`,
1842
1853
  /** All spans for a single trace (flat array, not paginated). */
1843
1854
  GET_SPANS_BY_TRACE_ID: (traceId) => `${INSIGHTS_RTM_BASE}/Traceview/spans/${traceId}`,
1844
1855
  /** Paginated spans whose reference hierarchy contains the given reference id. */
1845
1856
  GET_SPANS_BY_REFERENCE: (referenceId) => `${INSIGHTS_RTM_BASE}/Traceview/spans/reference/${referenceId}`,
1857
+ /** Paginated raw governance decision rows. */
1858
+ GET_GOVERNANCE_DECISIONS: `${INSIGHTS_RTM_BASE}/Governance/agentic/traces`,
1859
+ /** Aggregated governance posture (totals + top-N breakdowns). */
1860
+ GET_GOVERNANCE_SUMMARY: `${INSIGHTS_RTM_BASE}/Governance/agentic/summary`,
1846
1861
  };
1847
1862
 
1848
1863
  /**
@@ -1981,6 +1996,52 @@ __decorate([
1981
1996
  track('Traces.GetSpansByIds')
1982
1997
  ], TracesService.prototype, "getSpansByIds", null);
1983
1998
 
1999
+ // ─── Governance ─────────────────────────────────────────────────────
2000
+ /**
2001
+ * Evaluation mode of a governance decision.
2002
+ */
2003
+ var AgentGovernanceMode;
2004
+ (function (AgentGovernanceMode) {
2005
+ /** Policy evaluated and logged, but not enforced. */
2006
+ AgentGovernanceMode["Audit"] = "AUDIT";
2007
+ /** Policy evaluated and enforced. */
2008
+ AgentGovernanceMode["Enforce"] = "ENFORCE";
2009
+ /** Unrecognized or missing mode. */
2010
+ AgentGovernanceMode["Unknown"] = "Unknown";
2011
+ })(AgentGovernanceMode || (AgentGovernanceMode = {}));
2012
+ /**
2013
+ * Verdict of a governance decision (`Deny` = violation).
2014
+ */
2015
+ var AgentGovernanceVerdict;
2016
+ (function (AgentGovernanceVerdict) {
2017
+ /** Allowed — not a violation. */
2018
+ AgentGovernanceVerdict["Allow"] = "ALLOW";
2019
+ /** Denied — counts as a violation. */
2020
+ AgentGovernanceVerdict["Deny"] = "DENY";
2021
+ /** Unrecognized or missing verdict. */
2022
+ AgentGovernanceVerdict["Unknown"] = "Unknown";
2023
+ })(AgentGovernanceVerdict || (AgentGovernanceVerdict = {}));
2024
+ /**
2025
+ * Sections the governance summary can compute. `action` and `mode` are opt-in.
2026
+ */
2027
+ var AgentGovernanceSection;
2028
+ (function (AgentGovernanceSection) {
2029
+ /** Scalar totals (`total`, `violations`). */
2030
+ AgentGovernanceSection["Totals"] = "totals";
2031
+ /** Breakdown by governance hook. */
2032
+ AgentGovernanceSection["Hook"] = "hook";
2033
+ /** Breakdown by agent. */
2034
+ AgentGovernanceSection["Agent"] = "agent";
2035
+ /** Breakdown by policy. */
2036
+ AgentGovernanceSection["Policy"] = "policy";
2037
+ /** Breakdown by governance pack. */
2038
+ AgentGovernanceSection["Pack"] = "pack";
2039
+ /** Breakdown by enforcement action (opt-in). */
2040
+ AgentGovernanceSection["Action"] = "action";
2041
+ /** Breakdown by evaluation mode (opt-in). */
2042
+ AgentGovernanceSection["Mode"] = "mode";
2043
+ })(AgentGovernanceSection || (AgentGovernanceSection = {}));
2044
+
1984
2045
  /**
1985
2046
  * Maps a raw span record to a {@link AgentSpanGetResponse}
1986
2047
  */
@@ -1988,6 +2049,22 @@ const transformSpan = (span) => {
1988
2049
  const { expiryTimeUtc, ...rest } = span;
1989
2050
  return { ...rest, expiredTime: expiryTimeUtc };
1990
2051
  };
2052
+ // Case-insensitive lookups from a raw API value → enum member (keys upper-cased).
2053
+ const GOVERNANCE_MODE_BY_VALUE = new Map(Object.values(AgentGovernanceMode).map((mode) => [mode.toUpperCase(), mode]));
2054
+ const GOVERNANCE_VERDICT_BY_VALUE = new Map(Object.values(AgentGovernanceVerdict).map((verdict) => [verdict.toUpperCase(), verdict]));
2055
+ /** Maps a raw mode string to {@link AgentGovernanceMode}, case-insensitively; missing/unrecognized → `Unknown`. */
2056
+ const toGovernanceMode = (raw) => (raw != null ? GOVERNANCE_MODE_BY_VALUE.get(raw.toUpperCase()) : undefined) ?? AgentGovernanceMode.Unknown;
2057
+ /** Maps a raw verdict string to {@link AgentGovernanceVerdict}, case-insensitively; missing/unrecognized → `Unknown`. */
2058
+ const toGovernanceVerdict = (raw) => (raw != null ? GOVERNANCE_VERDICT_BY_VALUE.get(raw.toUpperCase()) : undefined) ?? AgentGovernanceVerdict.Unknown;
2059
+ /**
2060
+ * Normalizes a raw governance row, mapping the mode and verdict strings to
2061
+ * their enums while leaving the other fields untouched.
2062
+ */
2063
+ const transformGovernanceDecision = (row) => ({
2064
+ ...row,
2065
+ mode: toGovernanceMode(row.mode),
2066
+ evaluatorResult: toGovernanceVerdict(row.evaluatorResult),
2067
+ });
1991
2068
  /**
1992
2069
  * Service for retrieving UiPath Agent trace metrics.
1993
2070
  */
@@ -2076,7 +2153,7 @@ class AgentTracesService extends BaseService {
2076
2153
  * // Get per-agent unit consumption
2077
2154
  * const result = await trace.getUnitConsumption();
2078
2155
  * result.forEach((row) => {
2079
- * console.log(`${row.agentId}: ${row.agentUnitsConsumed} AGU, ${row.platformUnitsConsumed} PLTU`);
2156
+ * console.log(`${row.agentId}: ${row.agentUnitsConsumed} Agent Units, ${row.platformUnitsConsumed} Platform Units`);
2080
2157
  * });
2081
2158
  * ```
2082
2159
  * @example
@@ -2123,10 +2200,6 @@ class AgentTracesService extends BaseService {
2123
2200
  /**
2124
2201
  * Retrieves spans whose reference hierarchy contains the given reference id.
2125
2202
  *
2126
- * Returns a {@link PaginatedResponse} when pagination options (`pageSize`,
2127
- * `cursor`, or `jumpToPage`) are provided, otherwise a
2128
- * {@link NonPaginatedResponse}.
2129
- *
2130
2203
  * @param referenceId - Reference id matched against each span's reference hierarchy
2131
2204
  * @param options - Optional pagination and hierarchy/time filters
2132
2205
  * @returns Promise resolving to a paginated or non-paginated list of {@link AgentSpanGetResponse}
@@ -2187,6 +2260,141 @@ class AgentTracesService extends BaseService {
2187
2260
  },
2188
2261
  }, apiOptions);
2189
2262
  }
2263
+ /**
2264
+ * Lists individual governance decisions from agent execution traces — each
2265
+ * policy check's allow/deny outcome with its agent, policy, pack, hook, and
2266
+ * mode, plus the trace it belongs to — over the requested window. Filterable
2267
+ * and paginated.
2268
+ *
2269
+ * @remarks Requires the caller to be an organization admin. Non-admin callers get a `403` and the SDK throws an {@link AuthorizationError}.
2270
+ *
2271
+ * @param startTime - Inclusive lower bound for the query window
2272
+ * @param options - Optional window end, filters, and pagination
2273
+ * @returns Promise resolving to a paginated or non-paginated list of {@link AgentGovernanceDecisionGetResponse}
2274
+ * @example
2275
+ * ```typescript
2276
+ * import { AgentTraces } from '@uipath/uipath-typescript/traces';
2277
+ *
2278
+ * const trace = new AgentTraces(sdk);
2279
+ *
2280
+ * // Decision rows since a start time
2281
+ * const result = await trace.getGovernanceDecisions(new Date('2025-05-01T00:00:00Z'));
2282
+ * result.items.forEach((row) => {
2283
+ * console.log(`${row.hook} ${row.policyId}: ${row.evaluatorResult}`);
2284
+ * });
2285
+ * ```
2286
+ * @example
2287
+ * ```typescript
2288
+ * // Violations only, for one agent, paginated
2289
+ * const page = await trace.getGovernanceDecisions(new Date('2025-05-01T00:00:00Z'), {
2290
+ * endTime: new Date('2025-06-01T00:00:00Z'),
2291
+ * violationsOnly: true,
2292
+ * agentId: '<agentProjectKey>',
2293
+ * pageSize: 25,
2294
+ * });
2295
+ * if (page.hasNextPage && page.nextCursor) {
2296
+ * const next = await trace.getGovernanceDecisions(new Date('2025-05-01T00:00:00Z'), { cursor: page.nextCursor });
2297
+ * }
2298
+ * ```
2299
+ * @example
2300
+ * ```typescript
2301
+ * import { isAuthorizationError } from '@uipath/uipath-typescript/core';
2302
+ *
2303
+ * // Non-admin callers get a 403
2304
+ * try {
2305
+ * await trace.getGovernanceDecisions(new Date('2025-05-01T00:00:00Z'));
2306
+ * } catch (error) {
2307
+ * if (isAuthorizationError(error)) {
2308
+ * console.error('Governance data requires an organization admin.');
2309
+ * }
2310
+ * }
2311
+ * ```
2312
+ */
2313
+ async getGovernanceDecisions(startTime, options) {
2314
+ const { endTime, ...rest } = options ?? {};
2315
+ const apiOptions = {
2316
+ ...rest,
2317
+ startTime: startTime.toISOString(),
2318
+ ...(endTime !== undefined ? { endTime: endTime.toISOString() } : {}),
2319
+ };
2320
+ return PaginationHelpers.getAll({
2321
+ serviceAccess: this.createPaginationServiceAccess(),
2322
+ getEndpoint: () => AGENT_TRACES_ENDPOINTS.GET_GOVERNANCE_DECISIONS,
2323
+ method: HTTP_METHODS.POST,
2324
+ transformFn: transformGovernanceDecision,
2325
+ excludeFromPrefix: Object.keys(apiOptions),
2326
+ pagination: {
2327
+ paginationType: PaginationType.OFFSET,
2328
+ itemsField: GOVERNANCE_DECISIONS_PAGINATION.ITEMS_FIELD,
2329
+ paginationParams: {
2330
+ pageSizeParam: AGENTS_OFFSET_PARAMS.PAGE_SIZE_PARAM,
2331
+ offsetParam: AGENTS_OFFSET_PARAMS.OFFSET_PARAM,
2332
+ countParam: AGENTS_OFFSET_PARAMS.COUNT_PARAM,
2333
+ convertToSkip: false,
2334
+ zeroBased: true,
2335
+ },
2336
+ },
2337
+ }, apiOptions);
2338
+ }
2339
+ /**
2340
+ * Summarizes governance decisions across agent execution traces — total
2341
+ * decisions and violations, plus top breakdowns by hook, agent, policy, and
2342
+ * pack — over the requested window. Filterable.
2343
+ *
2344
+ * @remarks Requires the caller to be an organization admin. Non-admin callers get a `403` and the SDK throws an {@link AuthorizationError}.
2345
+ *
2346
+ * @param startTime - Inclusive lower bound for the query window
2347
+ * @param options - Optional window end, top-N, pack scope, and sections
2348
+ * @returns Promise resolving to {@link AgentGovernanceGetSummaryResponse}
2349
+ * @example
2350
+ * ```typescript
2351
+ * import { AgentTraces } from '@uipath/uipath-typescript/traces';
2352
+ *
2353
+ * const trace = new AgentTraces(sdk);
2354
+ *
2355
+ * // Default posture since a start time
2356
+ * const summary = await trace.getGovernanceSummary(new Date('2025-05-01T00:00:00Z'));
2357
+ * console.log(`${summary.violations} / ${summary.total} violations`);
2358
+ * summary.byPolicy.forEach((p) => console.log(`${p.key}: ${p.violationCount}`));
2359
+ * ```
2360
+ * @example
2361
+ * ```typescript
2362
+ * import { AgentGovernanceSection } from '@uipath/uipath-typescript/traces';
2363
+ *
2364
+ * // Top 5 per breakdown, scoped to a pack, including the opt-in action/mode sections
2365
+ * const summary = await trace.getGovernanceSummary(new Date('2025-05-01T00:00:00Z'), {
2366
+ * topN: 5,
2367
+ * packName: 'ISO/IEC 42001:2023 Runtime',
2368
+ * sections: [AgentGovernanceSection.Action, AgentGovernanceSection.Mode],
2369
+ * });
2370
+ * ```
2371
+ * @example
2372
+ * ```typescript
2373
+ * import { isAuthorizationError } from '@uipath/uipath-typescript/core';
2374
+ *
2375
+ * // Non-admin callers get a 403
2376
+ * try {
2377
+ * await trace.getGovernanceSummary(new Date('2025-05-01T00:00:00Z'));
2378
+ * } catch (error) {
2379
+ * if (isAuthorizationError(error)) {
2380
+ * console.error('Governance data requires an organization admin.');
2381
+ * }
2382
+ * }
2383
+ * ```
2384
+ */
2385
+ async getGovernanceSummary(startTime, options) {
2386
+ const body = { startTime: startTime.toISOString() };
2387
+ if (options?.endTime !== undefined)
2388
+ body.endTime = options.endTime.toISOString();
2389
+ if (options?.topN !== undefined)
2390
+ body.topN = options.topN;
2391
+ if (options?.packName !== undefined)
2392
+ body.packName = options.packName;
2393
+ if (options?.sections !== undefined)
2394
+ body.sections = options.sections;
2395
+ const response = await this.post(AGENT_TRACES_ENDPOINTS.GET_GOVERNANCE_SUMMARY, body);
2396
+ return response.data;
2397
+ }
2190
2398
  buildTraceFilterBody(options) {
2191
2399
  const body = {};
2192
2400
  if (options?.startTime !== undefined)
@@ -2219,5 +2427,11 @@ __decorate([
2219
2427
  __decorate([
2220
2428
  track('AgentTraces.GetSpansByReference')
2221
2429
  ], AgentTracesService.prototype, "getSpansByReference", null);
2430
+ __decorate([
2431
+ track('AgentTraces.GetGovernanceDecisions')
2432
+ ], AgentTracesService.prototype, "getGovernanceDecisions", null);
2433
+ __decorate([
2434
+ track('AgentTraces.GetGovernanceSummary')
2435
+ ], AgentTracesService.prototype, "getGovernanceSummary", null);
2222
2436
 
2223
- export { SpanExecutionType as AgentTraceExecutionType, AgentTracesService as AgentTraces, SpanAttachmentDirection, SpanAttachmentProvider, SpanExecutionType, SpanPermissionStatus, SpanSource, SpanStatus, SpanVerbosityLevel, TracesService as Traces };
2437
+ export { AgentGovernanceMode, AgentGovernanceSection, AgentGovernanceVerdict, SpanExecutionType as AgentTraceExecutionType, AgentTracesService as AgentTraces, SpanAttachmentDirection, SpanAttachmentProvider, SpanExecutionType, SpanPermissionStatus, SpanSource, SpanStatus, SpanVerbosityLevel, TracesService as Traces };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/uipath-typescript",
3
- "version": "1.4.2",
3
+ "version": "1.5.1",
4
4
  "description": "UiPath TypeScript SDK",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -215,6 +215,16 @@
215
215
  "types": "./dist/governance/index.d.ts",
216
216
  "default": "./dist/governance/index.cjs"
217
217
  }
218
+ },
219
+ "./notifications": {
220
+ "import": {
221
+ "types": "./dist/notifications/index.d.ts",
222
+ "default": "./dist/notifications/index.mjs"
223
+ },
224
+ "require": {
225
+ "types": "./dist/notifications/index.d.ts",
226
+ "default": "./dist/notifications/index.cjs"
227
+ }
218
228
  }
219
229
  },
220
230
  "files": [
@@ -260,8 +270,8 @@
260
270
  "@rollup/plugin-typescript": "^11.1.0",
261
271
  "@types/node": "^20.11.19",
262
272
  "@types/uuid": "^9.0.8",
263
- "@vitest/coverage-v8": "^3.2.4",
264
- "@vitest/ui": "^3.2.4",
273
+ "@vitest/coverage-v8": "^4.1.9",
274
+ "@vitest/ui": "^4.1.9",
265
275
  "builtin-modules": "^3.3.0",
266
276
  "dotenv": "^17.2.0",
267
277
  "oxlint": "^1.43.0",
@@ -272,7 +282,7 @@
272
282
  "typedoc": "^0.28.13",
273
283
  "typedoc-plugin-markdown": "^4.8.1",
274
284
  "typescript": "^5.3.3",
275
- "vitest": "^3.2.4"
285
+ "vitest": "^4.1.9"
276
286
  },
277
287
  "repository": {
278
288
  "type": "git",