@uipath/apollo-react 6.53.0 → 6.55.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/canvas/components/Guardrails/centralized-guardrail-details.cjs +139 -0
  2. package/dist/canvas/components/Guardrails/centralized-guardrail-details.d.ts +14 -0
  3. package/dist/canvas/components/Guardrails/centralized-guardrail-details.d.ts.map +1 -0
  4. package/dist/canvas/components/Guardrails/centralized-guardrail-details.js +105 -0
  5. package/dist/canvas/components/Guardrails/centralized-guardrail-utils.cjs +233 -0
  6. package/dist/canvas/components/Guardrails/centralized-guardrail-utils.d.ts +33 -0
  7. package/dist/canvas/components/Guardrails/centralized-guardrail-utils.d.ts.map +1 -0
  8. package/dist/canvas/components/Guardrails/centralized-guardrail-utils.js +172 -0
  9. package/dist/canvas/components/Guardrails/centralized-guardrails-section.cjs +142 -0
  10. package/dist/canvas/components/Guardrails/centralized-guardrails-section.d.ts +19 -0
  11. package/dist/canvas/components/Guardrails/centralized-guardrails-section.d.ts.map +1 -0
  12. package/dist/canvas/components/Guardrails/centralized-guardrails-section.js +108 -0
  13. package/dist/canvas/components/Guardrails/centralized-types.cjs +18 -0
  14. package/dist/canvas/components/Guardrails/centralized-types.d.ts +51 -0
  15. package/dist/canvas/components/Guardrails/centralized-types.d.ts.map +1 -0
  16. package/dist/canvas/components/Guardrails/centralized-types.js +0 -0
  17. package/dist/canvas/components/Guardrails/components/centralized-detail-field.cjs +52 -0
  18. package/dist/canvas/components/Guardrails/components/centralized-detail-field.d.ts +8 -0
  19. package/dist/canvas/components/Guardrails/components/centralized-detail-field.d.ts.map +1 -0
  20. package/dist/canvas/components/Guardrails/components/centralized-detail-field.js +18 -0
  21. package/dist/canvas/components/Guardrails/components/centralized-guardrail-origin-chip.cjs +48 -0
  22. package/dist/canvas/components/Guardrails/components/centralized-guardrail-origin-chip.d.ts +7 -0
  23. package/dist/canvas/components/Guardrails/components/centralized-guardrail-origin-chip.d.ts.map +1 -0
  24. package/dist/canvas/components/Guardrails/components/centralized-guardrail-origin-chip.js +14 -0
  25. package/dist/canvas/components/Guardrails/components/centralized-guardrail-parameters.cjs +77 -0
  26. package/dist/canvas/components/Guardrails/components/centralized-guardrail-parameters.d.ts +7 -0
  27. package/dist/canvas/components/Guardrails/components/centralized-guardrail-parameters.d.ts.map +1 -0
  28. package/dist/canvas/components/Guardrails/components/centralized-guardrail-parameters.js +43 -0
  29. package/dist/canvas/components/Guardrails/components/centralized-guardrail-row.cjs +137 -0
  30. package/dist/canvas/components/Guardrails/components/centralized-guardrail-row.d.ts +14 -0
  31. package/dist/canvas/components/Guardrails/components/centralized-guardrail-row.d.ts.map +1 -0
  32. package/dist/canvas/components/Guardrails/components/centralized-guardrail-row.js +103 -0
  33. package/dist/canvas/components/Guardrails/i18n.cjs +180 -1
  34. package/dist/canvas/components/Guardrails/i18n.d.ts +41 -0
  35. package/dist/canvas/components/Guardrails/i18n.d.ts.map +1 -1
  36. package/dist/canvas/components/Guardrails/i18n.js +169 -2
  37. package/dist/canvas/components/Guardrails/index.cjs +56 -5
  38. package/dist/canvas/components/Guardrails/index.d.ts +9 -2
  39. package/dist/canvas/components/Guardrails/index.d.ts.map +1 -1
  40. package/dist/canvas/components/Guardrails/index.js +5 -2
  41. package/dist/canvas/components/StageNode/StageNode.types.d.ts +1 -0
  42. package/dist/canvas/components/StageNode/StageNode.types.d.ts.map +1 -1
  43. package/dist/canvas/components/StageNode/StageNodeHeader.cjs +16 -11
  44. package/dist/canvas/components/StageNode/StageNodeHeader.d.ts.map +1 -1
  45. package/dist/canvas/components/StageNode/StageNodeHeader.js +16 -11
  46. package/dist/canvas/locales/en.cjs +1 -1
  47. package/dist/canvas/locales/en.d.ts.map +1 -1
  48. package/dist/canvas/locales/en.js +1 -1
  49. package/dist/canvas/styles/tailwind.canvas.css +1 -1
  50. package/package.json +1 -1
@@ -0,0 +1,172 @@
1
+ function getApplicableCentralizedGuardrails(guardrails, { isConversational }) {
2
+ return guardrails.filter((guardrail)=>isConversational ? guardrail.appliesToConversationalAgents : guardrail.appliesToAutonomousAgents);
3
+ }
4
+ function getCentralizedGuardrailItemId(guardrail) {
5
+ return JSON.stringify([
6
+ guardrail.validator,
7
+ guardrail.executionStage,
8
+ guardrail.isByo ? guardrail.name ?? null : false
9
+ ]);
10
+ }
11
+ function findCentralizedByoDefinition(guardrail, definitions) {
12
+ if (!guardrail.isByo || null == guardrail.name) return;
13
+ return definitions?.find((definition)=>definition.byoValidatorName === guardrail.name && definition.validator === guardrail.validator);
14
+ }
15
+ function findCentralizedBuiltInDefinition(guardrail, definitions) {
16
+ if (guardrail.isByo) return;
17
+ return definitions?.find((definition)=>definition.validator === guardrail.validator && void 0 === definition.byoValidatorName);
18
+ }
19
+ function isCentralizedGuardrailConfigMissing(guardrail, definitions) {
20
+ if (!guardrail.isByo || void 0 === definitions) return false;
21
+ return void 0 === findCentralizedByoDefinition(guardrail, definitions);
22
+ }
23
+ function getCentralizedGuardrailDisplay(guardrail, { definition, copy } = {}) {
24
+ const curated = guardrail.isByo ? void 0 : copy?.[guardrail.validator];
25
+ const description = guardrail.isByo ? definition?.description : curated?.description;
26
+ return {
27
+ name: guardrail.name ?? curated?.displayName ?? guardrail.validator,
28
+ description: void 0 === description || '' === description ? void 0 : description
29
+ };
30
+ }
31
+ const isPlainObject = (value)=>null !== value && 'object' == typeof value && !Array.isArray(value);
32
+ const asStringArray = (value)=>Array.isArray(value) ? value.filter((item)=>'string' == typeof item) : [];
33
+ const asNumberRecord = (value)=>isPlainObject(value) ? Object.fromEntries(Object.entries(value).filter((entry)=>'number' == typeof entry[1])) : {};
34
+ function liftBuiltInConfiguration(guardrail, definition, labels) {
35
+ const declared = definition?.parameters ?? [];
36
+ const thresholdsDefinition = declared.find((parameter)=>'map-enum' === parameter.type);
37
+ const entitiesDefinition = thresholdsDefinition?.keySource ? declared.find((parameter)=>parameter.id === thresholdsDefinition.keySource) : declared.find((parameter)=>'enum-list' === parameter.type);
38
+ const entitiesId = entitiesDefinition?.id ?? 'entities';
39
+ const thresholdsId = thresholdsDefinition?.id ?? 'entityThresholds';
40
+ const parameters = [];
41
+ if (null != guardrail.entities) parameters.push({
42
+ id: entitiesId,
43
+ value: guardrail.entities
44
+ });
45
+ if (null != guardrail.entityThresholds) parameters.push({
46
+ id: thresholdsId,
47
+ value: guardrail.entityThresholds
48
+ });
49
+ const definitions = declared.length > 0 ? declared : [
50
+ {
51
+ id: entitiesId,
52
+ type: 'enum-list',
53
+ label: labels.entities
54
+ },
55
+ {
56
+ id: thresholdsId,
57
+ type: 'map-enum',
58
+ label: labels.thresholds,
59
+ keySource: entitiesId
60
+ }
61
+ ];
62
+ return {
63
+ parameters,
64
+ definitions
65
+ };
66
+ }
67
+ function resolveCentralizedGuardrailParameters(guardrail, { definition, labels }) {
68
+ const { parameters, definitions } = guardrail.isByo ? {
69
+ parameters: guardrail.parameters ?? [],
70
+ definitions: definition?.parameters ?? []
71
+ } : liftBuiltInConfiguration(guardrail, definition, labels);
72
+ const valuesById = new Map(parameters.map((parameter)=>[
73
+ parameter.id,
74
+ parameter.value
75
+ ]));
76
+ const definitionsById = new Map(definitions.map((parameterDefinition)=>[
77
+ parameterDefinition.id,
78
+ parameterDefinition
79
+ ]));
80
+ const rendersAsThresholds = (id)=>isPlainObject(valuesById.get(id));
81
+ const optionLabel = (parameterDefinition, option)=>{
82
+ const optionLabels = parameterDefinition?.optionLabels;
83
+ const label = void 0 !== optionLabels && Object.hasOwn(optionLabels, option) ? optionLabels[option] : void 0;
84
+ return 'string' == typeof label ? label : option;
85
+ };
86
+ const formatValue = (parameterDefinition, value)=>{
87
+ if ('boolean' == typeof value) return value ? labels.enabled : labels.disabled;
88
+ if (Array.isArray(value)) return asStringArray(value).map((item)=>optionLabel(parameterDefinition, item)).join(', ');
89
+ if (null == value) return '';
90
+ return 'string' == typeof value ? optionLabel(parameterDefinition, value) : String(value);
91
+ };
92
+ const consumedIds = new Set();
93
+ for (const parameterDefinition of definitions)if (void 0 !== parameterDefinition.keySource && rendersAsThresholds(parameterDefinition.id)) consumedIds.add(parameterDefinition.keySource);
94
+ const toThresholdRow = (id, parameterDefinition)=>{
95
+ const thresholds = asNumberRecord(valuesById.get(id));
96
+ const keySourceDefinition = parameterDefinition?.keySource !== void 0 ? definitionsById.get(parameterDefinition.keySource) : void 0;
97
+ const keySourceList = keySourceDefinition?.type === 'enum-list' ? keySourceDefinition : void 0;
98
+ const selectedKeys = keySourceList ? asStringArray(valuesById.get(keySourceList.id)) : [];
99
+ const keys = Array.from(new Set([
100
+ ...Object.keys(thresholds),
101
+ ...selectedKeys
102
+ ]));
103
+ if (0 === keys.length) return;
104
+ return {
105
+ id,
106
+ kind: 'thresholds',
107
+ label: parameterDefinition?.label ?? labels.thresholds,
108
+ thresholds: keys.map((key)=>({
109
+ key,
110
+ label: optionLabel(keySourceList, key),
111
+ value: Object.hasOwn(thresholds, key) ? thresholds[key] : void 0
112
+ }))
113
+ };
114
+ };
115
+ const toValueRow = (id, parameterDefinition)=>{
116
+ const value = formatValue(parameterDefinition, valuesById.get(id));
117
+ if ('' === value) return;
118
+ return {
119
+ id,
120
+ kind: 'value',
121
+ label: parameterDefinition?.label ?? id,
122
+ value
123
+ };
124
+ };
125
+ const orderedIds = Array.from(new Set([
126
+ ...definitions.map((parameterDefinition)=>parameterDefinition.id),
127
+ ...parameters.map((parameter)=>parameter.id)
128
+ ]));
129
+ return orderedIds.filter((id)=>!consumedIds.has(id) && valuesById.has(id)).map((id)=>{
130
+ const parameterDefinition = definitionsById.get(id);
131
+ return rendersAsThresholds(id) ? toThresholdRow(id, parameterDefinition) : toValueRow(id, parameterDefinition);
132
+ }).filter((row)=>void 0 !== row);
133
+ }
134
+ function formatCentralizedExecutionStage(executionStage, labels) {
135
+ switch(executionStage){
136
+ case 'Pre':
137
+ return labels.stagePre;
138
+ case 'Post':
139
+ return labels.stagePost;
140
+ case 'Both':
141
+ return labels.stageBoth;
142
+ default:
143
+ return executionStage;
144
+ }
145
+ }
146
+ function formatCentralizedScope(scope, labels) {
147
+ switch(scope){
148
+ case 'Agent':
149
+ return labels.scopeAgent;
150
+ case 'Llm':
151
+ return labels.scopeLlm;
152
+ case 'Tool':
153
+ return labels.scopeTool;
154
+ default:
155
+ return scope;
156
+ }
157
+ }
158
+ function formatCentralizedAction(action, labels) {
159
+ switch(action){
160
+ case 'block':
161
+ return labels.actionBlock;
162
+ case 'escalate':
163
+ return labels.actionEscalate;
164
+ case 'filter':
165
+ return labels.actionFilter;
166
+ case 'log':
167
+ return labels.actionLog;
168
+ default:
169
+ return action;
170
+ }
171
+ }
172
+ export { findCentralizedBuiltInDefinition, findCentralizedByoDefinition, formatCentralizedAction, formatCentralizedExecutionStage, formatCentralizedScope, getApplicableCentralizedGuardrails, getCentralizedGuardrailDisplay, getCentralizedGuardrailItemId, isCentralizedGuardrailConfigMissing, resolveCentralizedGuardrailParameters };
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ CentralizedGuardrailsSection: ()=>CentralizedGuardrailsSection
28
+ });
29
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
+ const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
31
+ const external_lucide_react_namespaceObject = require("lucide-react");
32
+ const external_centralized_guardrail_utils_cjs_namespaceObject = require("./centralized-guardrail-utils.cjs");
33
+ const centralized_guardrail_row_cjs_namespaceObject = require("./components/centralized-guardrail-row.cjs");
34
+ const external_definitions_copy_cjs_namespaceObject = require("./definitions-copy.cjs");
35
+ const external_i18n_cjs_namespaceObject = require("./i18n.cjs");
36
+ function PolicyCaption({ template, policyName }) {
37
+ const [before, after] = template.split('{{policyName}}');
38
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("p", {
39
+ className: "pl-6 text-xs text-muted-foreground",
40
+ "data-slot": "centralized-guardrails-policy",
41
+ children: [
42
+ before,
43
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("em", {
44
+ children: policyName
45
+ }),
46
+ after
47
+ ]
48
+ });
49
+ }
50
+ function CentralizedGuardrailsSection({ guardrails, policyName, definitions, onSelect, docsHref, formatScope, emptyState, unstyled = false, hideHeader = false, labels: labelOverrides, className }) {
51
+ const labels = (0, external_i18n_cjs_namespaceObject.useCentralizedGuardrailsLabels)(labelOverrides);
52
+ const copy = (0, external_definitions_copy_cjs_namespaceObject.useGuardrailDefinitionCopy)();
53
+ if (0 === guardrails.length) return void 0 === emptyState ? null : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {
54
+ children: emptyState
55
+ });
56
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
57
+ "data-slot": "centralized-guardrails-section",
58
+ className: (0, apollo_wind_namespaceObject.cn)(!unstyled && 'rounded-md border', className),
59
+ children: [
60
+ !hideHeader && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
61
+ className: (0, apollo_wind_namespaceObject.cn)('space-y-0.5', !unstyled && 'px-3 py-2'),
62
+ children: [
63
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
64
+ className: "flex items-center gap-2",
65
+ children: [
66
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ShieldCheck, {
67
+ className: "size-4 shrink-0 text-muted-foreground",
68
+ "aria-hidden": "true"
69
+ }),
70
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
71
+ className: "text-sm font-medium",
72
+ children: labels.title
73
+ }),
74
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.HoverCard, {
75
+ openDelay: 200,
76
+ children: [
77
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.HoverCardTrigger, {
78
+ asChild: true,
79
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Button, {
80
+ variant: "ghost",
81
+ size: "3xs",
82
+ icon: true,
83
+ className: "size-5 text-muted-foreground",
84
+ "aria-label": labels.info,
85
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Info, {})
86
+ })
87
+ }),
88
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.HoverCardContent, {
89
+ className: "max-w-xs space-y-2 text-left text-xs",
90
+ children: [
91
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
92
+ children: labels.info
93
+ }),
94
+ void 0 !== docsHref && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("a", {
95
+ href: docsHref,
96
+ target: "_blank",
97
+ rel: "noopener noreferrer",
98
+ className: "inline-block text-primary hover:underline",
99
+ children: labels.docsLink
100
+ })
101
+ ]
102
+ })
103
+ ]
104
+ })
105
+ ]
106
+ }),
107
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(PolicyCaption, {
108
+ template: labels.policyCaption,
109
+ policyName: policyName
110
+ })
111
+ ]
112
+ }),
113
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
114
+ className: (0, apollo_wind_namespaceObject.cn)('space-y-2', !unstyled && 'p-3'),
115
+ children: guardrails.map((guardrail)=>{
116
+ const definition = (0, external_centralized_guardrail_utils_cjs_namespaceObject.findCentralizedByoDefinition)(guardrail, definitions);
117
+ const { name, description } = (0, external_centralized_guardrail_utils_cjs_namespaceObject.getCentralizedGuardrailDisplay)(guardrail, {
118
+ definition,
119
+ copy
120
+ });
121
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(centralized_guardrail_row_cjs_namespaceObject.CentralizedGuardrailRow, {
122
+ guardrail: guardrail,
123
+ name: name,
124
+ description: description,
125
+ definition: definition,
126
+ isConfigMissing: (0, external_centralized_guardrail_utils_cjs_namespaceObject.isCentralizedGuardrailConfigMissing)(guardrail, definitions),
127
+ scopeNames: guardrail.scopes.map((scope)=>formatScope?.(scope) ?? (0, external_centralized_guardrail_utils_cjs_namespaceObject.formatCentralizedScope)(scope, labels)),
128
+ labels: labels,
129
+ onSelect: void 0 === onSelect ? void 0 : ()=>onSelect(guardrail)
130
+ }, (0, external_centralized_guardrail_utils_cjs_namespaceObject.getCentralizedGuardrailItemId)(guardrail));
131
+ })
132
+ })
133
+ ]
134
+ });
135
+ }
136
+ exports.CentralizedGuardrailsSection = __webpack_exports__.CentralizedGuardrailsSection;
137
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
138
+ "CentralizedGuardrailsSection"
139
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
140
+ Object.defineProperty(exports, '__esModule', {
141
+ value: true
142
+ });
@@ -0,0 +1,19 @@
1
+ import type * as React from 'react';
2
+ import type { GuardrailScope } from './builder-types';
3
+ import type { CentralizedGuardrail, CentralizedGuardrailDefinition } from './centralized-types';
4
+ import type { CentralizedGuardrailsLabels } from './i18n';
5
+ export interface CentralizedGuardrailsSectionProps<TDefinition extends CentralizedGuardrailDefinition = CentralizedGuardrailDefinition> {
6
+ guardrails: CentralizedGuardrail[];
7
+ policyName: string;
8
+ definitions?: TDefinition[];
9
+ onSelect?: (guardrail: CentralizedGuardrail) => void;
10
+ docsHref?: string;
11
+ formatScope?: (scope: GuardrailScope) => string;
12
+ emptyState?: React.ReactNode;
13
+ unstyled?: boolean;
14
+ hideHeader?: boolean;
15
+ labels?: Partial<CentralizedGuardrailsLabels>;
16
+ className?: string;
17
+ }
18
+ export declare function CentralizedGuardrailsSection<TDefinition extends CentralizedGuardrailDefinition = CentralizedGuardrailDefinition>({ guardrails, policyName, definitions, onSelect, docsHref, formatScope, emptyState, unstyled, hideHeader, labels: labelOverrides, className, }: CentralizedGuardrailsSectionProps<TDefinition>): import("react/jsx-runtime").JSX.Element | null;
19
+ //# sourceMappingURL=centralized-guardrails-section.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"centralized-guardrails-section.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Guardrails/centralized-guardrails-section.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAQtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAGhG,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,QAAQ,CAAC;AAG1D,MAAM,WAAW,iCAAiC,CAChD,WAAW,SAAS,8BAA8B,GAAG,8BAA8B;IAGnF,UAAU,EAAE,oBAAoB,EAAE,CAAC;IAEnC,UAAU,EAAE,MAAM,CAAC;IAEnB,WAAW,CAAC,EAAE,WAAW,EAAE,CAAC;IAE5B,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAErD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,MAAM,CAAC;IAEhD,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAgBD,wBAAgB,4BAA4B,CAC1C,WAAW,SAAS,8BAA8B,GAAG,8BAA8B,EACnF,EACA,UAAU,EACV,UAAU,EACV,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,UAAU,EACV,QAAgB,EAChB,UAAkB,EAClB,MAAM,EAAE,cAAc,EACtB,SAAS,GACV,EAAE,iCAAiC,CAAC,WAAW,CAAC,kDA2EhD"}
@@ -0,0 +1,108 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { Button, HoverCard, HoverCardContent, HoverCardTrigger, cn } from "@uipath/apollo-wind";
3
+ import { Info, ShieldCheck } from "lucide-react";
4
+ import { findCentralizedByoDefinition, formatCentralizedScope, getCentralizedGuardrailDisplay, getCentralizedGuardrailItemId, isCentralizedGuardrailConfigMissing } from "./centralized-guardrail-utils.js";
5
+ import { CentralizedGuardrailRow } from "./components/centralized-guardrail-row.js";
6
+ import { useGuardrailDefinitionCopy } from "./definitions-copy.js";
7
+ import { useCentralizedGuardrailsLabels } from "./i18n.js";
8
+ function PolicyCaption({ template, policyName }) {
9
+ const [before, after] = template.split('{{policyName}}');
10
+ return /*#__PURE__*/ jsxs("p", {
11
+ className: "pl-6 text-xs text-muted-foreground",
12
+ "data-slot": "centralized-guardrails-policy",
13
+ children: [
14
+ before,
15
+ /*#__PURE__*/ jsx("em", {
16
+ children: policyName
17
+ }),
18
+ after
19
+ ]
20
+ });
21
+ }
22
+ function CentralizedGuardrailsSection({ guardrails, policyName, definitions, onSelect, docsHref, formatScope, emptyState, unstyled = false, hideHeader = false, labels: labelOverrides, className }) {
23
+ const labels = useCentralizedGuardrailsLabels(labelOverrides);
24
+ const copy = useGuardrailDefinitionCopy();
25
+ if (0 === guardrails.length) return void 0 === emptyState ? null : /*#__PURE__*/ jsx(Fragment, {
26
+ children: emptyState
27
+ });
28
+ return /*#__PURE__*/ jsxs("div", {
29
+ "data-slot": "centralized-guardrails-section",
30
+ className: cn(!unstyled && 'rounded-md border', className),
31
+ children: [
32
+ !hideHeader && /*#__PURE__*/ jsxs("div", {
33
+ className: cn('space-y-0.5', !unstyled && 'px-3 py-2'),
34
+ children: [
35
+ /*#__PURE__*/ jsxs("div", {
36
+ className: "flex items-center gap-2",
37
+ children: [
38
+ /*#__PURE__*/ jsx(ShieldCheck, {
39
+ className: "size-4 shrink-0 text-muted-foreground",
40
+ "aria-hidden": "true"
41
+ }),
42
+ /*#__PURE__*/ jsx("span", {
43
+ className: "text-sm font-medium",
44
+ children: labels.title
45
+ }),
46
+ /*#__PURE__*/ jsxs(HoverCard, {
47
+ openDelay: 200,
48
+ children: [
49
+ /*#__PURE__*/ jsx(HoverCardTrigger, {
50
+ asChild: true,
51
+ children: /*#__PURE__*/ jsx(Button, {
52
+ variant: "ghost",
53
+ size: "3xs",
54
+ icon: true,
55
+ className: "size-5 text-muted-foreground",
56
+ "aria-label": labels.info,
57
+ children: /*#__PURE__*/ jsx(Info, {})
58
+ })
59
+ }),
60
+ /*#__PURE__*/ jsxs(HoverCardContent, {
61
+ className: "max-w-xs space-y-2 text-left text-xs",
62
+ children: [
63
+ /*#__PURE__*/ jsx("p", {
64
+ children: labels.info
65
+ }),
66
+ void 0 !== docsHref && /*#__PURE__*/ jsx("a", {
67
+ href: docsHref,
68
+ target: "_blank",
69
+ rel: "noopener noreferrer",
70
+ className: "inline-block text-primary hover:underline",
71
+ children: labels.docsLink
72
+ })
73
+ ]
74
+ })
75
+ ]
76
+ })
77
+ ]
78
+ }),
79
+ /*#__PURE__*/ jsx(PolicyCaption, {
80
+ template: labels.policyCaption,
81
+ policyName: policyName
82
+ })
83
+ ]
84
+ }),
85
+ /*#__PURE__*/ jsx("div", {
86
+ className: cn('space-y-2', !unstyled && 'p-3'),
87
+ children: guardrails.map((guardrail)=>{
88
+ const definition = findCentralizedByoDefinition(guardrail, definitions);
89
+ const { name, description } = getCentralizedGuardrailDisplay(guardrail, {
90
+ definition,
91
+ copy
92
+ });
93
+ return /*#__PURE__*/ jsx(CentralizedGuardrailRow, {
94
+ guardrail: guardrail,
95
+ name: name,
96
+ description: description,
97
+ definition: definition,
98
+ isConfigMissing: isCentralizedGuardrailConfigMissing(guardrail, definitions),
99
+ scopeNames: guardrail.scopes.map((scope)=>formatScope?.(scope) ?? formatCentralizedScope(scope, labels)),
100
+ labels: labels,
101
+ onSelect: void 0 === onSelect ? void 0 : ()=>onSelect(guardrail)
102
+ }, getCentralizedGuardrailItemId(guardrail));
103
+ })
104
+ })
105
+ ]
106
+ });
107
+ }
108
+ export { CentralizedGuardrailsSection };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.r = (exports1)=>{
5
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
6
+ value: 'Module'
7
+ });
8
+ Object.defineProperty(exports1, '__esModule', {
9
+ value: true
10
+ });
11
+ };
12
+ })();
13
+ var __webpack_exports__ = {};
14
+ __webpack_require__.r(__webpack_exports__);
15
+ for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
16
+ Object.defineProperty(exports, '__esModule', {
17
+ value: true
18
+ });
@@ -0,0 +1,51 @@
1
+ import type { GuardrailScope } from './builder-types';
2
+ export type CentralizedGuardrailActionType = 'block' | 'escalate' | 'filter' | 'log';
3
+ export interface CentralizedGuardrailParameter {
4
+ id: string;
5
+ parameterType?: string | null;
6
+ value?: unknown;
7
+ }
8
+ export interface CentralizedGuardrail {
9
+ validator: string;
10
+ name?: string | null;
11
+ isByo?: boolean | null;
12
+ executionStage: string;
13
+ appliesToAutonomousAgents: boolean;
14
+ appliesToConversationalAgents: boolean;
15
+ scopes: GuardrailScope[];
16
+ action: CentralizedGuardrailActionType;
17
+ entities?: string[] | null;
18
+ entityThresholds?: Record<string, number> | null;
19
+ parameters?: CentralizedGuardrailParameter[] | null;
20
+ }
21
+ export interface CentralizedGuardrailParameterDefinition {
22
+ id: string;
23
+ type: string;
24
+ label?: string;
25
+ optionLabels?: Record<string, string>;
26
+ keySource?: string;
27
+ }
28
+ export interface CentralizedGuardrailDefinition {
29
+ validator: string;
30
+ status?: string;
31
+ description?: string;
32
+ byoValidatorName?: string;
33
+ byoConnectorName?: string;
34
+ parameters?: CentralizedGuardrailParameterDefinition[];
35
+ }
36
+ export type CentralizedGuardrailParameterRow = {
37
+ id: string;
38
+ label: string;
39
+ kind: 'value';
40
+ value: string;
41
+ } | {
42
+ id: string;
43
+ label: string;
44
+ kind: 'thresholds';
45
+ thresholds: Array<{
46
+ key: string;
47
+ label: string;
48
+ value: number | undefined;
49
+ }>;
50
+ };
51
+ //# sourceMappingURL=centralized-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"centralized-types.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Guardrails/centralized-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAMtD,MAAM,MAAM,8BAA8B,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,KAAK,CAAC;AAGrF,MAAM,WAAW,6BAA6B;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAGD,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAElB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAEvB,cAAc,EAAE,MAAM,CAAC;IACvB,yBAAyB,EAAE,OAAO,CAAC;IACnC,6BAA6B,EAAE,OAAO,CAAC;IACvC,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,MAAM,EAAE,8BAA8B,CAAC;IAEvC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAEjD,UAAU,CAAC,EAAE,6BAA6B,EAAE,GAAG,IAAI,CAAC;CACrD;AAGD,MAAM,WAAW,uCAAuC;IACtD,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IAEb,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEtC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAGD,MAAM,WAAW,8BAA8B;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,uCAAuC,EAAE,CAAC;CACxD;AAGD,MAAM,MAAM,gCAAgC,GACxC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC3D;IACE,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC,CAAC;CAC9E,CAAC"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ CentralizedDetailField: ()=>CentralizedDetailField
28
+ });
29
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
+ const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
31
+ function CentralizedDetailField({ label, className, children }) {
32
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
33
+ className: (0, apollo_wind_namespaceObject.cn)('space-y-0.5', className),
34
+ children: [
35
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("dt", {
36
+ className: "text-xs font-medium text-foreground",
37
+ children: label
38
+ }),
39
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("dd", {
40
+ className: "text-sm text-muted-foreground",
41
+ children: children
42
+ })
43
+ ]
44
+ });
45
+ }
46
+ exports.CentralizedDetailField = __webpack_exports__.CentralizedDetailField;
47
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
48
+ "CentralizedDetailField"
49
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
50
+ Object.defineProperty(exports, '__esModule', {
51
+ value: true
52
+ });
@@ -0,0 +1,8 @@
1
+ import type * as React from 'react';
2
+ export interface CentralizedDetailFieldProps {
3
+ label: string;
4
+ className?: string;
5
+ children: React.ReactNode;
6
+ }
7
+ export declare function CentralizedDetailField({ label, className, children, }: CentralizedDetailFieldProps): import("react/jsx-runtime").JSX.Element;
8
+ //# sourceMappingURL=centralized-detail-field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"centralized-detail-field.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/Guardrails/components/centralized-detail-field.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAEpC,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAGD,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,SAAS,EACT,QAAQ,GACT,EAAE,2BAA2B,2CAO7B"}
@@ -0,0 +1,18 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { cn } from "@uipath/apollo-wind";
3
+ function CentralizedDetailField({ label, className, children }) {
4
+ return /*#__PURE__*/ jsxs("div", {
5
+ className: cn('space-y-0.5', className),
6
+ children: [
7
+ /*#__PURE__*/ jsx("dt", {
8
+ className: "text-xs font-medium text-foreground",
9
+ children: label
10
+ }),
11
+ /*#__PURE__*/ jsx("dd", {
12
+ className: "text-sm text-muted-foreground",
13
+ children: children
14
+ })
15
+ ]
16
+ });
17
+ }
18
+ export { CentralizedDetailField };
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ CentralizedGuardrailOriginChip: ()=>CentralizedGuardrailOriginChip
28
+ });
29
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
+ const external_guardrail_status_chip_cjs_namespaceObject = require("./guardrail-status-chip.cjs");
31
+ function CentralizedGuardrailOriginChip({ isByo, labels }) {
32
+ return isByo ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_guardrail_status_chip_cjs_namespaceObject.GuardrailStatusChip, {
33
+ tone: "success",
34
+ className: "shrink-0",
35
+ children: labels.originByo
36
+ }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_guardrail_status_chip_cjs_namespaceObject.GuardrailStatusChip, {
37
+ tone: "neutral",
38
+ className: "shrink-0",
39
+ children: labels.originUiPath
40
+ });
41
+ }
42
+ exports.CentralizedGuardrailOriginChip = __webpack_exports__.CentralizedGuardrailOriginChip;
43
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
44
+ "CentralizedGuardrailOriginChip"
45
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
46
+ Object.defineProperty(exports, '__esModule', {
47
+ value: true
48
+ });