@highflame/policy 2.2.6 → 2.2.8

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.
@@ -0,0 +1,64 @@
1
+ /**
2
+ * AgentOps policy category identifiers.
3
+ * Maps to UI tab names in Studio.
4
+ */
5
+ export type AgentOpsCategory = 'threat-detection' | 'data-protection' | 'agent-security' | 'tool-permissioning' | 'code-security' | 'content-safety' | 'organization';
6
+ /**
7
+ * Category metadata for UI display.
8
+ */
9
+ export interface AgentOpsCategoryInfo {
10
+ id: AgentOpsCategory;
11
+ name: string;
12
+ description: string;
13
+ }
14
+ /**
15
+ * A default policy that is auto-created for new projects.
16
+ */
17
+ export interface AgentOpsDefaultPolicy {
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: AgentOpsCategory;
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 AgentOpsTemplate {
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: AgentOpsCategory;
47
+ /** Cedar policy text */
48
+ cedarText: string;
49
+ /** Severity level */
50
+ severity: string;
51
+ /** Tags for filtering */
52
+ tags: string[];
53
+ /** True when ensure-defaults should auto-seed this template at
54
+ * project creation. See schemas/*\/templates.json. Defaults to false. */
55
+ autoDeploy?: boolean;
56
+ }
57
+ export declare const AGENT_OPS_CATEGORIES: AgentOpsCategoryInfo[];
58
+ export declare const AGENT_OPS_DEFAULTS: AgentOpsDefaultPolicy[];
59
+ export declare const AGENT_OPS_TEMPLATES: AgentOpsTemplate[];
60
+ /** Raw templates.json metadata for the AgentOps service. */
61
+ export declare const AGENT_OPS_TEMPLATES_JSON: string;
62
+ export declare function getAgentOpsDefaultsByCategory(category: AgentOpsCategory): AgentOpsDefaultPolicy[];
63
+ export declare function getAgentOpsTemplatesByCategory(category: AgentOpsCategory): AgentOpsTemplate[];
64
+ export declare function getAgentOpsTemplateById(id: string): AgentOpsTemplate | undefined;
@@ -0,0 +1,156 @@
1
+ // Code generated by highflame-policy-codegen. DO NOT EDIT.
2
+ // Source: schemas/agent_ops/templates/templates.json
3
+ //
4
+ // AgentOps default policies and templates.
5
+ // Cedar text is embedded at build time. PolicyRule[] can be parsed at runtime
6
+ // using parseCedarToRules().
7
+ // =============================================================================
8
+ // EMBEDDED CEDAR POLICY TEXT
9
+ // =============================================================================
10
+ const AGENT_OPS_ORGANIZATION_PERMIT_BASELINE_CEDAR = `// =============================================================================
11
+ // Baseline Permit (Default)
12
+ // =============================================================================
13
+ // Permits all AgentOps actions by default. Threat-specific forbid policies
14
+ // override this when detectors fire. Cedar is default-deny: without at least
15
+ // one permit rule, every request is denied regardless of forbid rules.
16
+ //
17
+ // Category: organization
18
+ // Namespace: AgentOps
19
+ // =============================================================================
20
+
21
+ @id("organization.permit-baseline")
22
+ @name("Permit baseline")
23
+ @description("Permits all AgentOps actions.")
24
+ @severity("low")
25
+ @tags("category:organization,posture:permit-default")
26
+ permit (
27
+ principal,
28
+ action,
29
+ resource
30
+ );
31
+ `;
32
+ // =============================================================================
33
+ // CATEGORIES
34
+ // =============================================================================
35
+ export const AGENT_OPS_CATEGORIES = [
36
+ { id: 'threat-detection', name: 'Threat Detection', description: 'Detect and block injection, jailbreak, and adversarial attacks across all agent traffic.' },
37
+ { id: 'data-protection', name: 'Data Protection', description: 'Prevent secrets, PII, and sensitive data from leaking in prompts, responses, or tool calls.' },
38
+ { id: 'agent-security', name: 'Agent Security', description: 'Guard against tool poisoning, rug-pull attacks, and multi-agent delegation abuse.' },
39
+ { id: 'tool-permissioning', name: 'Tool Permissioning', description: 'Allow-list or block-list specific tools, MCP servers, and shell operations by risk tier.' },
40
+ { id: 'code-security', name: 'Code Security', description: 'Enforce safe coding patterns: no exfiltration commands, no destructive write operations.' },
41
+ { id: 'content-safety', name: 'Content Safety', description: 'Block harmful, toxic, or policy-violating content in agent inputs and outputs.' },
42
+ { id: 'organization', name: 'Organization', description: 'Organization-wide baselines and default permit/deny policies.' },
43
+ ];
44
+ // =============================================================================
45
+ // DEFAULT POLICIES
46
+ // =============================================================================
47
+ export const AGENT_OPS_DEFAULTS = [
48
+ {
49
+ id: 'organization.permit-baseline',
50
+ name: 'Baseline Permit',
51
+ description: 'Permits all AgentOps actions by default; threat-specific forbid policies override this when detectors fire.',
52
+ category: 'organization',
53
+ cedarText: AGENT_OPS_ORGANIZATION_PERMIT_BASELINE_CEDAR,
54
+ severity: 'low',
55
+ tags: ['category:organization', 'posture:permit-default'],
56
+ isActive: true,
57
+ },
58
+ ];
59
+ // =============================================================================
60
+ // ALL TEMPLATES
61
+ // =============================================================================
62
+ export const AGENT_OPS_TEMPLATES = [
63
+ {
64
+ id: 'organization.permit-baseline',
65
+ name: 'Baseline Permit',
66
+ description: 'Permits all AgentOps actions by default; threat-specific forbid policies override this when detectors fire.',
67
+ category: 'organization',
68
+ cedarText: AGENT_OPS_ORGANIZATION_PERMIT_BASELINE_CEDAR,
69
+ severity: 'low',
70
+ tags: ['category:organization', 'posture:permit-default'],
71
+ autoDeploy: true,
72
+ },
73
+ ];
74
+ // =============================================================================
75
+ // TEMPLATES METADATA
76
+ // =============================================================================
77
+ /** Raw templates.json metadata for the AgentOps service. */
78
+ export const AGENT_OPS_TEMPLATES_JSON = `{
79
+ "service": "agent_ops",
80
+ "version": "1.0.0",
81
+ "description": "AgentOps policy templates — unified agent guardrails for code agents, MCP tools, and AI Gateway traffic",
82
+ "categories": [
83
+ {
84
+ "id": "threat-detection",
85
+ "name": "Threat Detection",
86
+ "description": "Detect and block injection, jailbreak, and adversarial attacks across all agent traffic."
87
+ },
88
+ {
89
+ "id": "data-protection",
90
+ "name": "Data Protection",
91
+ "description": "Prevent secrets, PII, and sensitive data from leaking in prompts, responses, or tool calls."
92
+ },
93
+ {
94
+ "id": "agent-security",
95
+ "name": "Agent Security",
96
+ "description": "Guard against tool poisoning, rug-pull attacks, and multi-agent delegation abuse."
97
+ },
98
+ {
99
+ "id": "tool-permissioning",
100
+ "name": "Tool Permissioning",
101
+ "description": "Allow-list or block-list specific tools, MCP servers, and shell operations by risk tier."
102
+ },
103
+ {
104
+ "id": "code-security",
105
+ "name": "Code Security",
106
+ "description": "Enforce safe coding patterns: no exfiltration commands, no destructive write operations."
107
+ },
108
+ {
109
+ "id": "content-safety",
110
+ "name": "Content Safety",
111
+ "description": "Block harmful, toxic, or policy-violating content in agent inputs and outputs."
112
+ },
113
+ {
114
+ "id": "organization",
115
+ "name": "Organization",
116
+ "description": "Organization-wide baselines and default permit/deny policies."
117
+ }
118
+ ],
119
+ "defaults": [
120
+ {
121
+ "id": "organization.permit-baseline",
122
+ "name": "Baseline Permit",
123
+ "description": "Permits all AgentOps actions by default; threat-specific forbid policies override this when detectors fire.",
124
+ "category": "organization",
125
+ "file": "defaults/baseline.cedar",
126
+ "severity": "low",
127
+ "tags": ["category:organization", "posture:permit-default"],
128
+ "is_active": true
129
+ }
130
+ ],
131
+ "templates": [
132
+ {
133
+ "id": "organization.permit-baseline",
134
+ "name": "Baseline Permit",
135
+ "description": "Permits all AgentOps actions by default; threat-specific forbid policies override this when detectors fire.",
136
+ "category": "organization",
137
+ "file": "defaults/baseline.cedar",
138
+ "severity": "low",
139
+ "tags": ["category:organization", "posture:permit-default"],
140
+ "auto_deploy": true
141
+ }
142
+ ]
143
+ }
144
+ `;
145
+ // =============================================================================
146
+ // HELPER FUNCTIONS
147
+ // =============================================================================
148
+ export function getAgentOpsDefaultsByCategory(category) {
149
+ return AGENT_OPS_DEFAULTS.filter(d => d.category === category);
150
+ }
151
+ export function getAgentOpsTemplatesByCategory(category) {
152
+ return AGENT_OPS_TEMPLATES.filter(t => t.category === category);
153
+ }
154
+ export function getAgentOpsTemplateById(id) {
155
+ return AGENT_OPS_TEMPLATES.find(t => t.id === id);
156
+ }
@@ -0,0 +1,11 @@
1
+ import type { ServiceEntityMetadata, ActionEntityMetadata } from './entity-metadata-types.gen.js';
2
+ /**
3
+ * AgentOps entity metadata for UI components.
4
+ * Extracted from Cedar schema appliesTo blocks.
5
+ */
6
+ export declare const AGENT_OPS_ENTITIES: ServiceEntityMetadata;
7
+ /**
8
+ * Per-action entity mapping for AgentOps.
9
+ * Maps action names to their valid principals and resources.
10
+ */
11
+ export declare const AGENT_OPS_ACTION_ENTITIES: Record<string, ActionEntityMetadata>;
@@ -0,0 +1,37 @@
1
+ // Code generated by highflame-policy-codegen. DO NOT EDIT.
2
+ // Source: schemas/agent_ops/schema.cedarschema
3
+ /**
4
+ * AgentOps entity metadata for UI components.
5
+ * Extracted from Cedar schema appliesTo blocks.
6
+ */
7
+ export const AGENT_OPS_ENTITIES = {
8
+ principals: ['Agent', 'User'],
9
+ resources: ['Agent', 'App', 'Session'],
10
+ actions: ['call_tool', 'connect_server', 'process_prompt', 'read_file', 'write_file'],
11
+ };
12
+ /**
13
+ * Per-action entity mapping for AgentOps.
14
+ * Maps action names to their valid principals and resources.
15
+ */
16
+ export const AGENT_OPS_ACTION_ENTITIES = {
17
+ 'call_tool': {
18
+ principals: ['Agent', 'User'],
19
+ resources: ['Agent', 'Session'],
20
+ },
21
+ 'connect_server': {
22
+ principals: ['Agent', 'User'],
23
+ resources: ['Agent', 'Session'],
24
+ },
25
+ 'process_prompt': {
26
+ principals: ['Agent', 'User'],
27
+ resources: ['Agent', 'App', 'Session'],
28
+ },
29
+ 'read_file': {
30
+ principals: ['Agent', 'User'],
31
+ resources: ['Agent', 'Session'],
32
+ },
33
+ 'write_file': {
34
+ principals: ['Agent', 'User'],
35
+ resources: ['Agent', 'Session'],
36
+ },
37
+ };
@@ -149,7 +149,7 @@ export const GUARDRAILS_DETECTORS = [
149
149
  inhouse: false,
150
150
  model: null,
151
151
  latencyP50Ms: null,
152
- emits: [{ name: "budget_remaining_pct", type: "Long", modifiable: false, semantic: "severity_0_100", description: "Remaining token-budget percentage (0-100)." }, { name: "budget_exceeded", type: "Bool", modifiable: false, semantic: "boolean_flag", description: "True iff token budget for the session has been exceeded." }],
152
+ emits: [{ name: "budget_remaining_pct", type: "Long", modifiable: false, semantic: "severity_0_100", description: "Remaining token-budget percentage (0-100)." }, { name: "budget_exceeded", type: "Bool", modifiable: false, semantic: "boolean_flag", description: "True iff token budget for the session has been exceeded." }, { name: "rpm_remaining_pct", type: "Long", modifiable: false, semantic: "severity_0_100", description: "Remaining RPM percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)." }, { name: "rpm_exceeded", type: "Bool", modifiable: false, semantic: "boolean_flag", description: "True iff RPM limit has been exceeded." }, { name: "tpm_remaining_pct", type: "Long", modifiable: false, semantic: "severity_0_100", description: "Remaining TPM percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)." }, { name: "tpm_exceeded", type: "Bool", modifiable: false, semantic: "boolean_flag", description: "True iff TPM limit has been exceeded." }],
153
153
  supportedModes: ["enforce", "monitor", "alert"],
154
154
  defendsAgainst: ["unbounded_consumption"],
155
155
  exampleAttacks: [],
@@ -523,6 +523,8 @@ export const GUARDRAILS_FIELD_TO_DETECTORS = {
523
523
  "pii_types": ["pii", "dlp"],
524
524
  "profanity_score": ["toxicity"],
525
525
  "prompt_injection_score": ["deepcontext"],
526
+ "rpm_exceeded": ["budget_checker"],
527
+ "rpm_remaining_pct": ["budget_checker"],
526
528
  "rug_pull_detected": ["rug_pull"],
527
529
  "rug_pull_score": ["rug_pull"],
528
530
  "rug_pull_type": ["rug_pull"],
@@ -560,6 +562,8 @@ export const GUARDRAILS_FIELD_TO_DETECTORS = {
560
562
  "tool_poisoning_type": ["tool_poisoning"],
561
563
  "tool_risk_score": ["tool_risk"],
562
564
  "topic_confidence": ["topic"],
565
+ "tpm_exceeded": ["budget_checker"],
566
+ "tpm_remaining_pct": ["budget_checker"],
563
567
  "violence_score": ["toxicity"],
564
568
  "weapons_score": ["toxicity"],
565
569
  };
package/dist/index.d.ts CHANGED
@@ -13,19 +13,23 @@ export * from './errors.js';
13
13
  export * from './annotations.js';
14
14
  export * from './explain.js';
15
15
  export * from './condition-groups.js';
16
- export { AI_GATEWAY_SCHEMA, AI_GATEWAY_CONTEXT, GUARDRAILS_SCHEMA, GUARDRAILS_CONTEXT, OVERWATCH_SCHEMA, OVERWATCH_CONTEXT, PALISADE_SCHEMA, PALISADE_CONTEXT, SENTRY_SCHEMA, SENTRY_CONTEXT, } from './service-schemas.gen.js';
16
+ export { AGENT_OPS_SCHEMA, AGENT_OPS_CONTEXT, AI_GATEWAY_SCHEMA, AI_GATEWAY_CONTEXT, GUARDRAILS_SCHEMA, GUARDRAILS_CONTEXT, OVERWATCH_SCHEMA, OVERWATCH_CONTEXT, PALISADE_SCHEMA, PALISADE_CONTEXT, SENTRY_SCHEMA, SENTRY_CONTEXT, } from './service-schemas.gen.js';
17
17
  export type { ContextAttribute, ActionContext, ServiceContext, } from './service-schemas.gen.js';
18
+ export { AgentOpsContextKey, AgentOpsContextKeys } from './agent_ops-context.gen.js';
18
19
  export { AiGatewayContextKey, AiGatewayContextKeys } from './ai_gateway-context.gen.js';
19
20
  export { GuardrailsContextKey, GuardrailsContextKeys } from './guardrails-context.gen.js';
20
21
  export { OverwatchContextKey, OverwatchContextKeys } from './overwatch-context.gen.js';
21
22
  export { PalisadeContextKey, PalisadeContextKeys } from './palisade-context.gen.js';
22
23
  export { SentryContextKey, SentryContextKeys } from './sentry-context.gen.js';
24
+ export { AGENT_OPS_ENTITIES, AGENT_OPS_ACTION_ENTITIES, } from './agent_ops-entities.gen.js';
23
25
  export { AI_GATEWAY_ENTITIES, AI_GATEWAY_ACTION_ENTITIES, } from './ai_gateway-entities.gen.js';
24
26
  export { GUARDRAILS_ENTITIES, GUARDRAILS_ACTION_ENTITIES, } from './guardrails-entities.gen.js';
25
27
  export { OVERWATCH_ENTITIES, OVERWATCH_ACTION_ENTITIES, } from './overwatch-entities.gen.js';
26
28
  export { PALISADE_ENTITIES, PALISADE_ACTION_ENTITIES, } from './palisade-entities.gen.js';
27
29
  export { SENTRY_ENTITIES, SENTRY_ACTION_ENTITIES, } from './sentry-entities.gen.js';
28
30
  export type { ServiceEntityMetadata, ActionEntityMetadata } from './entity-metadata-types.gen.js';
31
+ export { AGENT_OPS_DEFAULTS, AGENT_OPS_TEMPLATES, AGENT_OPS_CATEGORIES, AGENT_OPS_TEMPLATES_JSON, getAgentOpsDefaultsByCategory, getAgentOpsTemplatesByCategory, getAgentOpsTemplateById, } from './agent_ops-defaults.gen.js';
32
+ export type { AgentOpsCategory, AgentOpsCategoryInfo, AgentOpsDefaultPolicy, AgentOpsTemplate, } from './agent_ops-defaults.gen.js';
29
33
  export { AI_GATEWAY_DEFAULTS, AI_GATEWAY_TEMPLATES, AI_GATEWAY_CATEGORIES, AI_GATEWAY_TEMPLATES_JSON, getAiGatewayDefaultsByCategory, getAiGatewayTemplatesByCategory, getAiGatewayTemplateById, } from './ai_gateway-defaults.gen.js';
30
34
  export type { AiGatewayCategory, AiGatewayCategoryInfo, AiGatewayDefaultPolicy, AiGatewayTemplate, } from './ai_gateway-defaults.gen.js';
31
35
  export { GUARDRAILS_DEFAULTS, GUARDRAILS_TEMPLATES, GUARDRAILS_CATEGORIES, GUARDRAILS_TEMPLATES_JSON, getGuardrailsDefaultsByCategory, getGuardrailsTemplatesByCategory, getGuardrailsTemplateById, } from './guardrails-defaults.gen.js';
package/dist/index.js CHANGED
@@ -30,20 +30,23 @@ export * from './explain.js';
30
30
  // Condition groups (AST ↔ flat UI groups)
31
31
  export * from './condition-groups.js';
32
32
  // Service-specific schemas and context (inlined)
33
- export { AI_GATEWAY_SCHEMA, AI_GATEWAY_CONTEXT, GUARDRAILS_SCHEMA, GUARDRAILS_CONTEXT, OVERWATCH_SCHEMA, OVERWATCH_CONTEXT, PALISADE_SCHEMA, PALISADE_CONTEXT, SENTRY_SCHEMA, SENTRY_CONTEXT, } from './service-schemas.gen.js';
33
+ export { AGENT_OPS_SCHEMA, AGENT_OPS_CONTEXT, AI_GATEWAY_SCHEMA, AI_GATEWAY_CONTEXT, GUARDRAILS_SCHEMA, GUARDRAILS_CONTEXT, OVERWATCH_SCHEMA, OVERWATCH_CONTEXT, PALISADE_SCHEMA, PALISADE_CONTEXT, SENTRY_SCHEMA, SENTRY_CONTEXT, } from './service-schemas.gen.js';
34
34
  // Service-specific context key enums
35
+ export { AgentOpsContextKey, AgentOpsContextKeys } from './agent_ops-context.gen.js';
35
36
  export { AiGatewayContextKey, AiGatewayContextKeys } from './ai_gateway-context.gen.js';
36
37
  export { GuardrailsContextKey, GuardrailsContextKeys } from './guardrails-context.gen.js';
37
38
  export { OverwatchContextKey, OverwatchContextKeys } from './overwatch-context.gen.js';
38
39
  export { PalisadeContextKey, PalisadeContextKeys } from './palisade-context.gen.js';
39
40
  export { SentryContextKey, SentryContextKeys } from './sentry-context.gen.js';
40
41
  // Service-specific entity metadata (for UI - principals, resources, actions)
42
+ export { AGENT_OPS_ENTITIES, AGENT_OPS_ACTION_ENTITIES, } from './agent_ops-entities.gen.js';
41
43
  export { AI_GATEWAY_ENTITIES, AI_GATEWAY_ACTION_ENTITIES, } from './ai_gateway-entities.gen.js';
42
44
  export { GUARDRAILS_ENTITIES, GUARDRAILS_ACTION_ENTITIES, } from './guardrails-entities.gen.js';
43
45
  export { OVERWATCH_ENTITIES, OVERWATCH_ACTION_ENTITIES, } from './overwatch-entities.gen.js';
44
46
  export { PALISADE_ENTITIES, PALISADE_ACTION_ENTITIES, } from './palisade-entities.gen.js';
45
47
  export { SENTRY_ENTITIES, SENTRY_ACTION_ENTITIES, } from './sentry-entities.gen.js';
46
48
  // Service-specific default policies, templates, and categories
49
+ export { AGENT_OPS_DEFAULTS, AGENT_OPS_TEMPLATES, AGENT_OPS_CATEGORIES, AGENT_OPS_TEMPLATES_JSON, getAgentOpsDefaultsByCategory, getAgentOpsTemplatesByCategory, getAgentOpsTemplateById, } from './agent_ops-defaults.gen.js';
47
50
  export { AI_GATEWAY_DEFAULTS, AI_GATEWAY_TEMPLATES, AI_GATEWAY_CATEGORIES, AI_GATEWAY_TEMPLATES_JSON, getAiGatewayDefaultsByCategory, getAiGatewayTemplatesByCategory, getAiGatewayTemplateById, } from './ai_gateway-defaults.gen.js';
48
51
  export { GUARDRAILS_DEFAULTS, GUARDRAILS_TEMPLATES, GUARDRAILS_CATEGORIES, GUARDRAILS_TEMPLATES_JSON, getGuardrailsDefaultsByCategory, getGuardrailsTemplatesByCategory, getGuardrailsTemplateById, } from './guardrails-defaults.gen.js';
49
52
  export { OVERWATCH_DEFAULTS, OVERWATCH_TEMPLATES, OVERWATCH_CATEGORIES, OVERWATCH_TEMPLATES_JSON, getOverwatchDefaultsByCategory, getOverwatchTemplatesByCategory, getOverwatchTemplateById, } from './overwatch-defaults.gen.js';