@highflame/policy 2.0.9 → 2.1.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/_schemas/guardrails/context.json +435 -0
  2. package/_schemas/guardrails/schema.cedarschema +225 -0
  3. package/_schemas/guardrails/templates/defaults/agentic_safety.cedar +94 -0
  4. package/_schemas/guardrails/templates/defaults/baseline.cedar +24 -0
  5. package/_schemas/guardrails/templates/defaults/injection.cedar +70 -0
  6. package/_schemas/guardrails/templates/defaults/pii.cedar +48 -0
  7. package/_schemas/guardrails/templates/defaults/secrets.cedar +40 -0
  8. package/_schemas/guardrails/templates/defaults/semantic.cedar +59 -0
  9. package/_schemas/guardrails/templates/defaults/tool_risk.cedar +58 -0
  10. package/_schemas/guardrails/templates/defaults/toxicity.cedar +76 -0
  11. package/_schemas/guardrails/templates/mcp_tool_permissions.cedar +84 -0
  12. package/_schemas/guardrails/templates/profiles/chat_assistant/privacy.cedar +22 -0
  13. package/_schemas/guardrails/templates/profiles/chat_assistant/security.cedar +35 -0
  14. package/_schemas/guardrails/templates/profiles/chat_assistant/trust_safety.cedar +43 -0
  15. package/_schemas/guardrails/templates/profiles/chat_assistant.cedar +85 -0
  16. package/_schemas/guardrails/templates/profiles/code_agent/agentic_security.cedar +109 -0
  17. package/_schemas/guardrails/templates/profiles/code_agent/security.cedar +22 -0
  18. package/_schemas/guardrails/templates/profiles/code_agent.cedar +125 -0
  19. package/_schemas/guardrails/templates/profiles/data_pipeline/agentic_security.cedar +38 -0
  20. package/_schemas/guardrails/templates/profiles/data_pipeline/privacy.cedar +40 -0
  21. package/_schemas/guardrails/templates/profiles/data_pipeline/security.cedar +49 -0
  22. package/_schemas/guardrails/templates/profiles/data_pipeline.cedar +111 -0
  23. package/_schemas/guardrails/templates/templates.json +213 -0
  24. package/_schemas/overwatch/context.json +54 -54
  25. package/_schemas/overwatch/schema.cedarschema +77 -68
  26. package/dist/builder.d.ts +106 -13
  27. package/dist/builder.js +103 -34
  28. package/dist/engine.d.ts +20 -2
  29. package/dist/engine.js +50 -20
  30. package/dist/entities.gen.d.ts +4 -0
  31. package/dist/entities.gen.js +4 -0
  32. package/dist/explain.d.ts +150 -0
  33. package/dist/explain.js +363 -0
  34. package/dist/guardrails-context.gen.d.ts +49 -0
  35. package/dist/guardrails-context.gen.js +50 -0
  36. package/dist/guardrails-defaults.gen.d.ts +61 -0
  37. package/dist/guardrails-defaults.gen.js +1278 -0
  38. package/dist/guardrails-entities.gen.d.ts +11 -0
  39. package/dist/guardrails-entities.gen.js +37 -0
  40. package/dist/index.d.ts +6 -1
  41. package/dist/index.js +6 -1
  42. package/dist/overwatch-defaults.gen.js +122 -2
  43. package/dist/parser.js +136 -4
  44. package/dist/schema.gen.d.ts +1 -1
  45. package/dist/schema.gen.js +6 -0
  46. package/dist/service-schemas.gen.d.ts +15 -11
  47. package/dist/service-schemas.gen.js +509 -84
  48. package/dist/types.d.ts +6 -1
  49. package/dist/types.js +6 -1
  50. package/package.json +5 -1
@@ -0,0 +1,363 @@
1
+ /**
2
+ * Policy Decision Explanation
3
+ *
4
+ * Provides structured explanations for Cedar policy decisions by matching
5
+ * determining policies against their structured conditions and the request context.
6
+ *
7
+ * Browser-safe — no WASM or Node.js dependencies.
8
+ */
9
+ // =============================================================================
10
+ // Main Function
11
+ // =============================================================================
12
+ /**
13
+ * Explain a policy decision by matching determining policies against their
14
+ * structured conditions and the request context.
15
+ *
16
+ * @param decision - The decision from PolicyEngine.evaluate()
17
+ * @param rules - The PolicyRule[] that were loaded (parsed or built)
18
+ * @param context - The context map that was passed to evaluate()
19
+ * @returns Structured explanation with per-condition match details
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * const decision = engine.evaluate(request);
24
+ * const explained = explainDecision(decision, rules, request.context);
25
+ *
26
+ * for (const explanation of explained.explanations) {
27
+ * console.log(explanation.summary);
28
+ * // "forbid process_prompt — threat_count (10) > 5"
29
+ * }
30
+ * ```
31
+ */
32
+ export function explainDecision(decision, rules, context) {
33
+ // Build lookup map: annotations.id → PolicyRule
34
+ const ruleMap = new Map();
35
+ for (const rule of rules) {
36
+ const id = rule.annotations?.id;
37
+ if (id) {
38
+ ruleMap.set(id, rule);
39
+ }
40
+ }
41
+ const explanations = [];
42
+ const unmatchedPolicies = [];
43
+ for (const dp of decision.determining_policies) {
44
+ const rule = ruleMap.get(dp.id);
45
+ if (!rule) {
46
+ unmatchedPolicies.push(dp.id);
47
+ continue;
48
+ }
49
+ // Recursive condition evaluation
50
+ let evaluatedExpression;
51
+ if (rule.conditionExpression) {
52
+ evaluatedExpression = evaluateExpression(rule.conditionExpression, context);
53
+ }
54
+ // Populate condition_results: prefer leaf extraction from expression tree,
55
+ // fall back to flat conditions[] for backward compat with simple policies
56
+ let conditionResults;
57
+ if (evaluatedExpression) {
58
+ conditionResults = collectLeafResults(evaluatedExpression);
59
+ }
60
+ else {
61
+ const conditions = rule.conditions || [];
62
+ conditionResults = conditions.map(cond => {
63
+ const actual = context[cond.field];
64
+ const matched = evaluateCondition(cond.operator, actual, cond.value);
65
+ return { field: cond.field, operator: cond.operator, expected: cond.value, actual, matched };
66
+ });
67
+ }
68
+ // Surface rawCondition when there are no structured conditions and no expression tree
69
+ const rawCondition = conditionResults.length === 0 && !evaluatedExpression && rule.rawCondition
70
+ ? rule.rawCondition
71
+ : undefined;
72
+ const summary = evaluatedExpression
73
+ ? buildTreeSummary(rule, evaluatedExpression)
74
+ : buildSummary(rule, conditionResults, rawCondition);
75
+ explanations.push({
76
+ policy_id: dp.id,
77
+ effect: rule.effect ?? "forbid",
78
+ summary,
79
+ evaluated_expression: evaluatedExpression,
80
+ condition_results: conditionResults,
81
+ raw_condition: rawCondition,
82
+ });
83
+ }
84
+ return {
85
+ effect: decision.effect,
86
+ explanations,
87
+ unmatched_policies: unmatchedPolicies,
88
+ };
89
+ }
90
+ // =============================================================================
91
+ // Recursive Expression Evaluation
92
+ // =============================================================================
93
+ /**
94
+ * Recursively evaluate a ConditionExpression tree against a context map.
95
+ * Returns an EvaluatedExpression tree with `matched` booleans and `actual` values.
96
+ */
97
+ export function evaluateExpression(expr, context) {
98
+ switch (expr.kind) {
99
+ case 'and': {
100
+ const children = expr.children.map(c => evaluateExpression(c, context));
101
+ return { kind: 'and', children, matched: children.every(c => c.matched) };
102
+ }
103
+ case 'or': {
104
+ const children = expr.children.map(c => evaluateExpression(c, context));
105
+ return { kind: 'or', children, matched: children.some(c => c.matched) };
106
+ }
107
+ case 'not': {
108
+ const child = evaluateExpression(expr.child, context);
109
+ return { kind: 'not', child, matched: !child.matched };
110
+ }
111
+ case 'has': {
112
+ const matched = expr.field in context && context[expr.field] !== undefined;
113
+ return { kind: 'has', field: expr.field, matched };
114
+ }
115
+ case 'comparison': {
116
+ const actual = context[expr.field];
117
+ const matched = evaluateCondition(expr.operator, actual, expr.value);
118
+ return { kind: 'comparison', field: expr.field, operator: expr.operator, expected: expr.value, actual, matched };
119
+ }
120
+ case 'contains': {
121
+ const actual = context[expr.field];
122
+ const matched = evaluateContains(actual, expr.value);
123
+ return { kind: 'contains', field: expr.field, expected: expr.value, actual, matched };
124
+ }
125
+ case 'like': {
126
+ const actual = context[expr.field];
127
+ const matched = evaluateLike(actual, expr.pattern);
128
+ return { kind: 'like', field: expr.field, pattern: expr.pattern, actual, matched };
129
+ }
130
+ case 'raw':
131
+ return { kind: 'raw', text: expr.text, matched: false };
132
+ }
133
+ }
134
+ // =============================================================================
135
+ // Condition Evaluation
136
+ // =============================================================================
137
+ /**
138
+ * Evaluate a single condition against an actual context value.
139
+ * Returns false for missing values, type mismatches, or unsupported operators.
140
+ */
141
+ function evaluateCondition(operator, actual, expected) {
142
+ if (actual === undefined || actual === null) {
143
+ return false;
144
+ }
145
+ switch (operator) {
146
+ case "eq":
147
+ return compareEqual(actual, expected);
148
+ case "neq":
149
+ return !compareEqual(actual, expected);
150
+ case "lt":
151
+ return compareNumeric(actual, expected, (a, b) => a < b);
152
+ case "lte":
153
+ return compareNumeric(actual, expected, (a, b) => a <= b);
154
+ case "gt":
155
+ return compareNumeric(actual, expected, (a, b) => a > b);
156
+ case "gte":
157
+ return compareNumeric(actual, expected, (a, b) => a >= b);
158
+ case "contains":
159
+ return evaluateContains(actual, expected);
160
+ case "in":
161
+ return evaluateIn(actual, expected);
162
+ case "like":
163
+ return evaluateLike(actual, expected);
164
+ default:
165
+ return false;
166
+ }
167
+ }
168
+ function compareEqual(actual, expected) {
169
+ if (typeof actual === "number" && typeof expected === "number") {
170
+ return actual === expected;
171
+ }
172
+ if (typeof actual === "string" && typeof expected === "string") {
173
+ return actual === expected;
174
+ }
175
+ if (typeof actual === "boolean" && typeof expected === "boolean") {
176
+ return actual === expected;
177
+ }
178
+ // Cross-type: try loose comparison for number/string
179
+ if (typeof actual === "number" && typeof expected === "string") {
180
+ return actual === Number(expected);
181
+ }
182
+ if (typeof actual === "string" && typeof expected === "number") {
183
+ return Number(actual) === expected;
184
+ }
185
+ return false;
186
+ }
187
+ function compareNumeric(actual, expected, comparator) {
188
+ const a = toNumber(actual);
189
+ const b = toNumber(expected);
190
+ if (a === null || b === null)
191
+ return false;
192
+ return comparator(a, b);
193
+ }
194
+ function toNumber(value) {
195
+ if (typeof value === "number")
196
+ return value;
197
+ if (typeof value === "string") {
198
+ const n = Number(value);
199
+ return Number.isNaN(n) ? null : n;
200
+ }
201
+ return null;
202
+ }
203
+ function evaluateContains(actual, expected) {
204
+ // String contains — substring match
205
+ if (typeof actual === "string" && typeof expected === "string") {
206
+ return actual.includes(expected);
207
+ }
208
+ // Array contains — type-aware element match
209
+ if (Array.isArray(actual)) {
210
+ return actual.some((item) => compareEqual(item, expected));
211
+ }
212
+ return false;
213
+ }
214
+ function evaluateIn(actual, expected) {
215
+ if (Array.isArray(expected)) {
216
+ return expected.some((item) => compareEqual(actual, item));
217
+ }
218
+ return false;
219
+ }
220
+ function evaluateLike(actual, expected) {
221
+ if (typeof actual !== "string" || typeof expected !== "string") {
222
+ return false;
223
+ }
224
+ const regex = likePatternToRegex(expected);
225
+ return regex.test(actual);
226
+ }
227
+ /**
228
+ * Convert a Cedar `like` pattern to a JavaScript RegExp.
229
+ * Cedar `like` uses `*` as a wildcard (zero or more characters).
230
+ * `\*` is a literal asterisk.
231
+ */
232
+ function likePatternToRegex(pattern) {
233
+ let regex = "^";
234
+ for (let i = 0; i < pattern.length; i++) {
235
+ const ch = pattern[i];
236
+ if (ch === "\\" && i + 1 < pattern.length && pattern[i + 1] === "*") {
237
+ regex += "\\*";
238
+ i++; // skip the escaped *
239
+ }
240
+ else if (ch === "*") {
241
+ regex += ".*";
242
+ }
243
+ else {
244
+ // Escape regex special characters
245
+ regex += ch.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
246
+ }
247
+ }
248
+ regex += "$";
249
+ return new RegExp(regex);
250
+ }
251
+ // =============================================================================
252
+ // Summary Generation
253
+ // =============================================================================
254
+ function buildSummary(rule, conditionResults, rawCondition) {
255
+ const effect = rule.effect ?? "forbid";
256
+ const action = getActionLabel(rule);
257
+ if (rawCondition) {
258
+ return `${effect} ${action} — (raw condition: ${rawCondition})`;
259
+ }
260
+ if (conditionResults.length === 0) {
261
+ return `${effect} ${action} — (no conditions)`;
262
+ }
263
+ const parts = conditionResults.map((cr) => {
264
+ const op = OPERATOR_SYMBOLS[cr.operator] ?? cr.operator;
265
+ const actualStr = formatValue(cr.actual);
266
+ const expectedStr = formatValue(cr.expected);
267
+ return `${cr.field} (${actualStr}) ${op} ${expectedStr}`;
268
+ });
269
+ return `${effect} ${action} — ${parts.join(", ")}`;
270
+ }
271
+ /**
272
+ * Build a human-readable summary from an evaluated expression tree.
273
+ * Skips 'has' nodes (they're just null-guards) and focuses on leaf conditions.
274
+ */
275
+ function buildTreeSummary(rule, evaluated) {
276
+ const effect = rule.effect ?? "forbid";
277
+ const action = getActionLabel(rule);
278
+ const parts = collectLeafSummaries(evaluated);
279
+ if (parts.length === 0) {
280
+ return `${effect} ${action} — (no conditions)`;
281
+ }
282
+ return `${effect} ${action} — ${parts.join(", ")}`;
283
+ }
284
+ /**
285
+ * Collect flat ConditionResult[] from leaf nodes in the evaluated expression tree.
286
+ * Skips 'has' (null-guards) and 'raw' (can't decompose) nodes.
287
+ * Recurses into and/or/not to reach all leaves.
288
+ */
289
+ function collectLeafResults(expr) {
290
+ switch (expr.kind) {
291
+ case 'and':
292
+ case 'or':
293
+ return expr.children.flatMap(collectLeafResults);
294
+ case 'not':
295
+ return collectLeafResults(expr.child);
296
+ case 'has':
297
+ case 'raw':
298
+ return [];
299
+ case 'comparison':
300
+ return [{ field: expr.field, operator: expr.operator, expected: expr.expected, actual: expr.actual, matched: expr.matched }];
301
+ case 'contains':
302
+ return [{ field: expr.field, operator: 'contains', expected: expr.expected, actual: expr.actual, matched: expr.matched }];
303
+ case 'like':
304
+ return [{ field: expr.field, operator: 'like', expected: expr.pattern, actual: expr.actual, matched: expr.matched }];
305
+ }
306
+ }
307
+ /**
308
+ * Collect human-readable summaries from leaf nodes in the evaluated tree.
309
+ * Skips 'has' and 'raw' nodes; recurses into and/or/not.
310
+ */
311
+ function collectLeafSummaries(expr) {
312
+ switch (expr.kind) {
313
+ case 'and':
314
+ case 'or':
315
+ return expr.children.flatMap(collectLeafSummaries);
316
+ case 'not':
317
+ return collectLeafSummaries(expr.child).map(s => `NOT (${s})`);
318
+ case 'has':
319
+ return []; // skip null-guards in summary
320
+ case 'comparison': {
321
+ const op = OPERATOR_SYMBOLS[expr.operator] ?? expr.operator;
322
+ return [`${expr.field}: ${formatValue(expr.actual)} ${op} ${formatValue(expr.expected)}`];
323
+ }
324
+ case 'contains':
325
+ return [`${expr.field}: ${formatValue(expr.actual)} contains ${formatValue(expr.expected)}`];
326
+ case 'like':
327
+ return [`${expr.field}: ${formatValue(expr.actual)} like ${formatValue(expr.pattern)}`];
328
+ case 'raw':
329
+ return [`(raw: ${expr.text})`];
330
+ }
331
+ }
332
+ function getActionLabel(rule) {
333
+ const action = rule.action;
334
+ if (!action)
335
+ return "*";
336
+ if (typeof action === "string") {
337
+ return action.replace(/^.*Action::"/, "").replace(/"$/, "");
338
+ }
339
+ if (Array.isArray(action) && action.length > 0) {
340
+ return action.map((a) => a.replace(/^.*Action::"/, "").replace(/"$/, "")).join(", ");
341
+ }
342
+ return "*";
343
+ }
344
+ function formatValue(value) {
345
+ if (value === undefined || value === null)
346
+ return "undefined";
347
+ if (typeof value === "string")
348
+ return JSON.stringify(value);
349
+ if (Array.isArray(value))
350
+ return `[${value.map((v) => JSON.stringify(v)).join(", ")}]`;
351
+ return String(value);
352
+ }
353
+ const OPERATOR_SYMBOLS = {
354
+ eq: "==",
355
+ neq: "!=",
356
+ lt: "<",
357
+ lte: "<=",
358
+ gt: ">",
359
+ gte: ">=",
360
+ contains: "contains",
361
+ in: "in",
362
+ like: "like",
363
+ };
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Context attribute keys for Guardrails Guardrails (Shield) content security & policy enforcement for LLM applications.
3
+ *
4
+ * These constants correspond to the context attributes defined in the
5
+ * Guardrails Cedar schema and are used at policy evaluation time.
6
+ */
7
+ export declare const GuardrailsContextKey: {
8
+ readonly BudgetExceeded: "budget_exceeded";
9
+ readonly BudgetRemainingPct: "budget_remaining_pct";
10
+ readonly ContainsInvisibleChars: "contains_invisible_chars";
11
+ readonly ContainsSecrets: "contains_secrets";
12
+ readonly ContentTopics: "content_topics";
13
+ readonly ContentType: "content_type";
14
+ readonly CrimeScore: "crime_score";
15
+ readonly DetectorCount: "detector_count";
16
+ readonly Direction: "direction";
17
+ readonly HateSpeechScore: "hate_speech_score";
18
+ readonly InjectionScore: "injection_score";
19
+ readonly InjectionType: "injection_type";
20
+ readonly InvisibleCharsScore: "invisible_chars_score";
21
+ readonly JailbreakScore: "jailbreak_score";
22
+ readonly LoopCount: "loop_count";
23
+ readonly LoopDetected: "loop_detected";
24
+ readonly LoopTool: "loop_tool";
25
+ readonly McpServer: "mcp_server";
26
+ readonly McpServerVerified: "mcp_server_verified";
27
+ readonly McpTool: "mcp_tool";
28
+ readonly PatternType: "pattern_type";
29
+ readonly PiiCount: "pii_count";
30
+ readonly PiiDetected: "pii_detected";
31
+ readonly PiiTypes: "pii_types";
32
+ readonly ProfanityScore: "profanity_score";
33
+ readonly RequestId: "request_id";
34
+ readonly SecretCount: "secret_count";
35
+ readonly SecretTypes: "secret_types";
36
+ readonly SequenceRisk: "sequence_risk";
37
+ readonly SexualScore: "sexual_score";
38
+ readonly SuspiciousPattern: "suspicious_pattern";
39
+ readonly Timestamp: "timestamp";
40
+ readonly ToolCategory: "tool_category";
41
+ readonly ToolIsBuiltin: "tool_is_builtin";
42
+ readonly ToolIsSensitive: "tool_is_sensitive";
43
+ readonly ToolName: "tool_name";
44
+ readonly ToolRiskScore: "tool_risk_score";
45
+ readonly TopicConfidence: "topic_confidence";
46
+ readonly ViolenceScore: "violence_score";
47
+ readonly WeaponsScore: "weapons_score";
48
+ };
49
+ export type GuardrailsContextKey = (typeof GuardrailsContextKey)[keyof typeof GuardrailsContextKey];
@@ -0,0 +1,50 @@
1
+ // Code generated by highflame-policy-codegen. DO NOT EDIT.
2
+ // Source: schemas/guardrails/context.json
3
+ /**
4
+ * Context attribute keys for Guardrails Guardrails (Shield) content security & policy enforcement for LLM applications.
5
+ *
6
+ * These constants correspond to the context attributes defined in the
7
+ * Guardrails Cedar schema and are used at policy evaluation time.
8
+ */
9
+ export const GuardrailsContextKey = {
10
+ BudgetExceeded: 'budget_exceeded',
11
+ BudgetRemainingPct: 'budget_remaining_pct',
12
+ ContainsInvisibleChars: 'contains_invisible_chars',
13
+ ContainsSecrets: 'contains_secrets',
14
+ ContentTopics: 'content_topics',
15
+ ContentType: 'content_type',
16
+ CrimeScore: 'crime_score',
17
+ DetectorCount: 'detector_count',
18
+ Direction: 'direction',
19
+ HateSpeechScore: 'hate_speech_score',
20
+ InjectionScore: 'injection_score',
21
+ InjectionType: 'injection_type',
22
+ InvisibleCharsScore: 'invisible_chars_score',
23
+ JailbreakScore: 'jailbreak_score',
24
+ LoopCount: 'loop_count',
25
+ LoopDetected: 'loop_detected',
26
+ LoopTool: 'loop_tool',
27
+ McpServer: 'mcp_server',
28
+ McpServerVerified: 'mcp_server_verified',
29
+ McpTool: 'mcp_tool',
30
+ PatternType: 'pattern_type',
31
+ PiiCount: 'pii_count',
32
+ PiiDetected: 'pii_detected',
33
+ PiiTypes: 'pii_types',
34
+ ProfanityScore: 'profanity_score',
35
+ RequestId: 'request_id',
36
+ SecretCount: 'secret_count',
37
+ SecretTypes: 'secret_types',
38
+ SequenceRisk: 'sequence_risk',
39
+ SexualScore: 'sexual_score',
40
+ SuspiciousPattern: 'suspicious_pattern',
41
+ Timestamp: 'timestamp',
42
+ ToolCategory: 'tool_category',
43
+ ToolIsBuiltin: 'tool_is_builtin',
44
+ ToolIsSensitive: 'tool_is_sensitive',
45
+ ToolName: 'tool_name',
46
+ ToolRiskScore: 'tool_risk_score',
47
+ TopicConfidence: 'topic_confidence',
48
+ ViolenceScore: 'violence_score',
49
+ WeaponsScore: 'weapons_score',
50
+ };
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Guardrails policy category identifiers.
3
+ * Maps to UI tab names in Studio.
4
+ */
5
+ export type GuardrailsCategory = 'security' | 'privacy' | 'trust_safety' | 'agentic_security' | 'organization';
6
+ /**
7
+ * Category metadata for UI display.
8
+ */
9
+ export interface GuardrailsCategoryInfo {
10
+ id: GuardrailsCategory;
11
+ name: string;
12
+ description: string;
13
+ }
14
+ /**
15
+ * A default policy that is auto-created for new projects.
16
+ */
17
+ export interface GuardrailsDefaultPolicy {
18
+ /** Template identifier */
19
+ id: string;
20
+ /** Human-readable name */
21
+ name: string;
22
+ /** Description for UI display */
23
+ description: string;
24
+ /** Policy category */
25
+ category: GuardrailsCategory;
26
+ /** Cedar policy text (source of truth) */
27
+ cedarText: string;
28
+ /** Severity level */
29
+ severity: string;
30
+ /** Tags for filtering */
31
+ tags: string[];
32
+ /** Whether this default should be activated immediately */
33
+ isActive: boolean;
34
+ }
35
+ /**
36
+ * A policy template available for users to create from.
37
+ */
38
+ export interface GuardrailsTemplate {
39
+ /** Template identifier */
40
+ id: string;
41
+ /** Human-readable name */
42
+ name: string;
43
+ /** Description for UI display */
44
+ description: string;
45
+ /** Policy category */
46
+ category: GuardrailsCategory;
47
+ /** Cedar policy text */
48
+ cedarText: string;
49
+ /** Severity level */
50
+ severity: string;
51
+ /** Tags for filtering */
52
+ tags: string[];
53
+ }
54
+ export declare const GUARDRAILS_CATEGORIES: GuardrailsCategoryInfo[];
55
+ export declare const GUARDRAILS_DEFAULTS: GuardrailsDefaultPolicy[];
56
+ export declare const GUARDRAILS_TEMPLATES: GuardrailsTemplate[];
57
+ /** Raw templates.json metadata for the Guardrails service. */
58
+ export declare const GUARDRAILS_TEMPLATES_JSON: string;
59
+ export declare function getGuardrailsDefaultsByCategory(category: GuardrailsCategory): GuardrailsDefaultPolicy[];
60
+ export declare function getGuardrailsTemplatesByCategory(category: GuardrailsCategory): GuardrailsTemplate[];
61
+ export declare function getGuardrailsTemplateById(id: string): GuardrailsTemplate | undefined;