@highflame/policy 2.2.28 → 2.2.29

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.
@@ -199,6 +199,14 @@
199
199
  "required": false,
200
200
  "description": "Compartments the principal is admitted to (ADR 0020 D8), e.g. 'tenant:acme', 'customer:123'. A flow into a compartment the principal lacks is deniable independent of confidentiality tier. Set<String>."
201
201
  }
202
+ ],
203
+ "surface_keys": [
204
+ {
205
+ "key": "surface",
206
+ "type": "string",
207
+ "required": true,
208
+ "description": "Origin surface of the request (ADR 0012 D14.2) — REQUIRED; projected by Shield from the ingress product, never user-supplied. Values are the product identifiers: 'guardrails', 'overwatch', 'ai_gateway' ('sentry' joins at D17 phase 2). The 'Applies to' narrowing target: test with an ordinary condition (context.surface == 'ai_gateway'); no 'has' guard needed because it is required. A policy with no surface condition applies to every surface, including ones added later."
209
+ }
202
210
  ]
203
211
  },
204
212
  "actions": [
@@ -772,7 +780,8 @@
772
780
  },
773
781
  { "$ref": "session_keys" },
774
782
  { "$ref": "agent_identity_keys" },
775
- { "$ref": "flow_label_keys" }
783
+ { "$ref": "flow_label_keys" },
784
+ { "$ref": "surface_keys" }
776
785
  ]
777
786
  },
778
787
  {
@@ -1286,7 +1295,8 @@
1286
1295
  },
1287
1296
  { "$ref": "session_keys" },
1288
1297
  { "$ref": "agent_identity_keys" },
1289
- { "$ref": "flow_label_keys" }
1298
+ { "$ref": "flow_label_keys" },
1299
+ { "$ref": "surface_keys" }
1290
1300
  ]
1291
1301
  },
1292
1302
  {
@@ -1472,7 +1482,8 @@
1472
1482
  },
1473
1483
  { "$ref": "session_keys" },
1474
1484
  { "$ref": "agent_identity_keys" },
1475
- { "$ref": "flow_label_keys" }
1485
+ { "$ref": "flow_label_keys" },
1486
+ { "$ref": "surface_keys" }
1476
1487
  ]
1477
1488
  },
1478
1489
  {
@@ -1671,7 +1682,8 @@
1671
1682
  },
1672
1683
  { "$ref": "session_keys" },
1673
1684
  { "$ref": "agent_identity_keys" },
1674
- { "$ref": "flow_label_keys" }
1685
+ { "$ref": "flow_label_keys" },
1686
+ { "$ref": "surface_keys" }
1675
1687
  ]
1676
1688
  },
1677
1689
  {
@@ -1872,7 +1884,8 @@
1872
1884
  },
1873
1885
  { "$ref": "session_keys" },
1874
1886
  { "$ref": "agent_identity_keys" },
1875
- { "$ref": "flow_label_keys" }
1887
+ { "$ref": "flow_label_keys" },
1888
+ { "$ref": "surface_keys" }
1876
1889
  ]
1877
1890
  },
1878
1891
  {
@@ -246,6 +246,15 @@ namespace AgentOps {
246
246
  "session_original_request"?: String,
247
247
  "session_max_sensitivity"?: String,
248
248
 
249
+ // Origin Surface — REQUIRED (ADR 0012 D14.2). Projected by Shield from the
250
+ // ingress product; never user-supplied. The "Applies to" narrowing target:
251
+ // policies test it with an ordinary condition (context.surface == "ai_gateway")
252
+ // — no `has` guard needed precisely because it is required. Values are the
253
+ // product identifiers: "guardrails" | "overwatch" | "ai_gateway" ("sentry"
254
+ // joins at ADR 0012 D17 phase 2). A policy with no surface condition applies
255
+ // to every surface, including ones added later (inclusive default).
256
+ "surface": String,
257
+
249
258
  // Data-Flow Labels — per-value information-flow facts (ADR 0020, optional).
250
259
  // All optional: guard every access with `has` — an absent-attribute read is
251
260
  // a Cedar evaluation error and an errored forbid is silently skipped (fail-open).
@@ -425,6 +434,15 @@ namespace AgentOps {
425
434
  "session_original_request"?: String,
426
435
  "session_max_sensitivity"?: String,
427
436
 
437
+ // Origin Surface — REQUIRED (ADR 0012 D14.2). Projected by Shield from the
438
+ // ingress product; never user-supplied. The "Applies to" narrowing target:
439
+ // policies test it with an ordinary condition (context.surface == "ai_gateway")
440
+ // — no `has` guard needed precisely because it is required. Values are the
441
+ // product identifiers: "guardrails" | "overwatch" | "ai_gateway" ("sentry"
442
+ // joins at ADR 0012 D17 phase 2). A policy with no surface condition applies
443
+ // to every surface, including ones added later (inclusive default).
444
+ "surface": String,
445
+
428
446
  // Data-Flow Labels — per-value information-flow facts (ADR 0020, optional).
429
447
  // All optional: guard every access with `has` — an absent-attribute read is
430
448
  // a Cedar evaluation error and an errored forbid is silently skipped (fail-open).
@@ -532,6 +550,15 @@ namespace AgentOps {
532
550
  "session_original_request"?: String,
533
551
  "session_max_sensitivity"?: String,
534
552
 
553
+ // Origin Surface — REQUIRED (ADR 0012 D14.2). Projected by Shield from the
554
+ // ingress product; never user-supplied. The "Applies to" narrowing target:
555
+ // policies test it with an ordinary condition (context.surface == "ai_gateway")
556
+ // — no `has` guard needed precisely because it is required. Values are the
557
+ // product identifiers: "guardrails" | "overwatch" | "ai_gateway" ("sentry"
558
+ // joins at ADR 0012 D17 phase 2). A policy with no surface condition applies
559
+ // to every surface, including ones added later (inclusive default).
560
+ "surface": String,
561
+
535
562
  // Data-Flow Labels — per-value information-flow facts (ADR 0020, optional).
536
563
  // All optional: guard every access with `has` — an absent-attribute read is
537
564
  // a Cedar evaluation error and an errored forbid is silently skipped (fail-open).
@@ -635,6 +662,15 @@ namespace AgentOps {
635
662
  "session_original_request"?: String,
636
663
  "session_max_sensitivity"?: String,
637
664
 
665
+ // Origin Surface — REQUIRED (ADR 0012 D14.2). Projected by Shield from the
666
+ // ingress product; never user-supplied. The "Applies to" narrowing target:
667
+ // policies test it with an ordinary condition (context.surface == "ai_gateway")
668
+ // — no `has` guard needed precisely because it is required. Values are the
669
+ // product identifiers: "guardrails" | "overwatch" | "ai_gateway" ("sentry"
670
+ // joins at ADR 0012 D17 phase 2). A policy with no surface condition applies
671
+ // to every surface, including ones added later (inclusive default).
672
+ "surface": String,
673
+
638
674
  // Data-Flow Labels — per-value information-flow facts (ADR 0020, optional).
639
675
  // All optional: guard every access with `has` — an absent-attribute read is
640
676
  // a Cedar evaluation error and an errored forbid is silently skipped (fail-open).
@@ -738,6 +774,15 @@ namespace AgentOps {
738
774
  "session_original_request"?: String,
739
775
  "session_max_sensitivity"?: String,
740
776
 
777
+ // Origin Surface — REQUIRED (ADR 0012 D14.2). Projected by Shield from the
778
+ // ingress product; never user-supplied. The "Applies to" narrowing target:
779
+ // policies test it with an ordinary condition (context.surface == "ai_gateway")
780
+ // — no `has` guard needed precisely because it is required. Values are the
781
+ // product identifiers: "guardrails" | "overwatch" | "ai_gateway" ("sentry"
782
+ // joins at ADR 0012 D17 phase 2). A policy with no surface condition applies
783
+ // to every surface, including ones added later (inclusive default).
784
+ "surface": String,
785
+
741
786
  // Data-Flow Labels — per-value information-flow facts (ADR 0020, optional).
742
787
  // All optional: guard every access with `has` — an absent-attribute read is
743
788
  // a Cedar evaluation error and an errored forbid is silently skipped (fail-open).
@@ -137,6 +137,7 @@ export declare const AgentOpsContextKey: {
137
137
  readonly SqlInjectionDetected: "sql_injection_detected";
138
138
  readonly SqlInjectionScore: "sql_injection_score";
139
139
  readonly SqlInjectionType: "sql_injection_type";
140
+ readonly Surface: "surface";
140
141
  readonly SuspiciousPattern: "suspicious_pattern";
141
142
  readonly ThreatCategories: "threat_categories";
142
143
  readonly ThreatCount: "threat_count";
@@ -164,4 +165,4 @@ export type AgentOpsContextKey = (typeof AgentOpsContextKey)[keyof typeof AgentO
164
165
  * The full set of authorable context attribute keys for AgentOps.
165
166
  * Iterate this to enumerate the authorable surface (cockpit, conformance).
166
167
  */
167
- export declare const AgentOpsContextKeys: readonly ["agent_framework", "agent_id", "agent_publisher", "agent_trust_level", "agent_type", "budget_exceeded", "budget_remaining_pct", "code_languages", "code_ratio", "command_injection_detected", "command_injection_score", "command_injection_type", "contains_code", "contains_non_ascii", "content_safety_blocked", "content_safety_score", "content_topics", "content_type", "conversation_turn", "crime_score", "cross_origin_detected", "cross_origin_score", "cross_origin_type", "cwd", "detected_language", "detected_script", "detected_threats", "detector_count", "direction", "egress_hosts", "encoded_content_detected", "encoded_count", "encoded_score", "encoded_types", "event", "exec_allowlist", "factuality_score", "flow_compartments", "flow_confidentiality", "flow_data_types", "flow_integrity", "flow_origins", "flow_resolution_status", "flow_sink", "flow_sink_effects", "flow_sink_is_external", "hallucination_score", "hate_speech_score", "highest_severity", "identity_type", "indirect_injection_score", "indirect_injection_type", "injection_deep_context_score", "injection_pulse_score", "injection_score", "injection_type", "invisible_chars_detected", "invisible_chars_score", "is_english", "is_latin_script", "isolation_tier", "jailbreak_deep_context_score", "jailbreak_pulse_score", "jailbreak_score", "keyword_categories", "keyword_count", "keyword_matched", "language_confidence", "loop_count", "loop_detected", "loop_tool", "mcp_config_risk", "mcp_risk_score", "mcp_risk_type", "mcp_server", "mcp_server_verified", "mcp_tool", "mechanism_capabilities", "model_name", "model_provider", "multi_turn_detection", "network_egress", "param_type_violation", "param_type_violations", "path", "path_traversal_detected", "path_traversal_severity", "path_traversal_type", "pattern_type", "phishing_detected", "pii_count", "pii_detected", "pii_score", "pii_types", "principal", "principal_clearances", "principal_compartments", "privilege_scope", "profanity_score", "request_id", "role", "rpm_exceeded", "rpm_remaining_pct", "rug_pull_detected", "rug_pull_score", "rug_pull_type", "script_confidence", "secret_count", "secret_types", "secrets_detected", "sentiment_score", "sequence_risk", "session_command_injection", "session_cumulative_risk_score", "session_injection_detected", "session_max_command_injection_score", "session_max_injection_score", "session_max_jailbreak_score", "session_max_pii_score", "session_max_secret_score", "session_max_sensitivity", "session_original_request", "session_pii_detected", "session_pii_types", "session_secret_types", "session_secrets_detected", "session_threat_turns", "sexual_score", "source", "sql_injection_detected", "sql_injection_score", "sql_injection_type", "suspicious_pattern", "threat_categories", "threat_count", "timestamp", "tool_category", "tool_is_builtin", "tool_is_sensitive", "tool_name", "tool_operation_classes", "tool_poisoning_detected", "tool_poisoning_score", "tool_poisoning_type", "tool_risk_score", "topic_confidence", "tpm_exceeded", "tpm_remaining_pct", "user_email", "violence_score", "weapons_score", "workspace_root", "writable_paths"];
168
+ export declare const AgentOpsContextKeys: readonly ["agent_framework", "agent_id", "agent_publisher", "agent_trust_level", "agent_type", "budget_exceeded", "budget_remaining_pct", "code_languages", "code_ratio", "command_injection_detected", "command_injection_score", "command_injection_type", "contains_code", "contains_non_ascii", "content_safety_blocked", "content_safety_score", "content_topics", "content_type", "conversation_turn", "crime_score", "cross_origin_detected", "cross_origin_score", "cross_origin_type", "cwd", "detected_language", "detected_script", "detected_threats", "detector_count", "direction", "egress_hosts", "encoded_content_detected", "encoded_count", "encoded_score", "encoded_types", "event", "exec_allowlist", "factuality_score", "flow_compartments", "flow_confidentiality", "flow_data_types", "flow_integrity", "flow_origins", "flow_resolution_status", "flow_sink", "flow_sink_effects", "flow_sink_is_external", "hallucination_score", "hate_speech_score", "highest_severity", "identity_type", "indirect_injection_score", "indirect_injection_type", "injection_deep_context_score", "injection_pulse_score", "injection_score", "injection_type", "invisible_chars_detected", "invisible_chars_score", "is_english", "is_latin_script", "isolation_tier", "jailbreak_deep_context_score", "jailbreak_pulse_score", "jailbreak_score", "keyword_categories", "keyword_count", "keyword_matched", "language_confidence", "loop_count", "loop_detected", "loop_tool", "mcp_config_risk", "mcp_risk_score", "mcp_risk_type", "mcp_server", "mcp_server_verified", "mcp_tool", "mechanism_capabilities", "model_name", "model_provider", "multi_turn_detection", "network_egress", "param_type_violation", "param_type_violations", "path", "path_traversal_detected", "path_traversal_severity", "path_traversal_type", "pattern_type", "phishing_detected", "pii_count", "pii_detected", "pii_score", "pii_types", "principal", "principal_clearances", "principal_compartments", "privilege_scope", "profanity_score", "request_id", "role", "rpm_exceeded", "rpm_remaining_pct", "rug_pull_detected", "rug_pull_score", "rug_pull_type", "script_confidence", "secret_count", "secret_types", "secrets_detected", "sentiment_score", "sequence_risk", "session_command_injection", "session_cumulative_risk_score", "session_injection_detected", "session_max_command_injection_score", "session_max_injection_score", "session_max_jailbreak_score", "session_max_pii_score", "session_max_secret_score", "session_max_sensitivity", "session_original_request", "session_pii_detected", "session_pii_types", "session_secret_types", "session_secrets_detected", "session_threat_turns", "sexual_score", "source", "sql_injection_detected", "sql_injection_score", "sql_injection_type", "surface", "suspicious_pattern", "threat_categories", "threat_count", "timestamp", "tool_category", "tool_is_builtin", "tool_is_sensitive", "tool_name", "tool_operation_classes", "tool_poisoning_detected", "tool_poisoning_score", "tool_poisoning_type", "tool_risk_score", "topic_confidence", "tpm_exceeded", "tpm_remaining_pct", "user_email", "violence_score", "weapons_score", "workspace_root", "writable_paths"];
@@ -139,6 +139,7 @@ export const AgentOpsContextKey = {
139
139
  SqlInjectionDetected: 'sql_injection_detected',
140
140
  SqlInjectionScore: 'sql_injection_score',
141
141
  SqlInjectionType: 'sql_injection_type',
142
+ Surface: 'surface',
142
143
  SuspiciousPattern: 'suspicious_pattern',
143
144
  ThreatCategories: 'threat_categories',
144
145
  ThreatCount: 'threat_count',
@@ -298,6 +299,7 @@ export const AgentOpsContextKeys = [
298
299
  AgentOpsContextKey.SqlInjectionDetected,
299
300
  AgentOpsContextKey.SqlInjectionScore,
300
301
  AgentOpsContextKey.SqlInjectionType,
302
+ AgentOpsContextKey.Surface,
301
303
  AgentOpsContextKey.SuspiciousPattern,
302
304
  AgentOpsContextKey.ThreatCategories,
303
305
  AgentOpsContextKey.ThreatCount,
@@ -1,4 +1,4 @@
1
- export declare const PRIVILEGE_CATALOG_VERSION = "2026-06-08";
1
+ export declare const PRIVILEGE_CATALOG_VERSION = "2026-07-14";
2
2
  /** Every role in the catalog, in declaration order. */
3
3
  export declare const PRIVILEGE_CATALOG_ROLES: readonly string[];
4
4
  /** Every product the catalog applies to, in declaration order. */
@@ -15,3 +15,32 @@ export declare function privilegeScopeForProduct(role: string, product: string):
15
15
  * role (least privilege). The returned array is a copy.
16
16
  */
17
17
  export declare function privilegeScopeForRole(role: string): string[];
18
+ /**
19
+ * Coding-agent scope vocabulary, in declaration order (see
20
+ * products/code-agents-identity-design.md section 8). The canonical
21
+ * namespaced scope strings minted into code-agent tokens.
22
+ */
23
+ export declare const CODING_AGENT_SCOPES: readonly string[];
24
+ /**
25
+ * Reports whether `scope` is a declared vocabulary scope.
26
+ */
27
+ export declare function isCodingAgentScope(scope: string): boolean;
28
+ /**
29
+ * Human-readable description of a vocabulary scope, or `''` for an
30
+ * unknown scope.
31
+ */
32
+ export declare function scopeDescription(scope: string): string;
33
+ /**
34
+ * Pre-Cedar hard ceiling for one action: the canonical scope a token's
35
+ * `scopes` claim must carry. A `null` requiredScope means the action
36
+ * deliberately has no ceiling.
37
+ */
38
+ export interface ActionScopeRequirement {
39
+ readonly requiredScope: string | null;
40
+ }
41
+ /**
42
+ * The ceiling for (product, action), or `undefined` when the catalog
43
+ * defines none. `undefined` — or a defined entry with a `null`
44
+ * requiredScope — means the action has no scope requirement.
45
+ */
46
+ export declare function actionScopeRequirement(product: string, action: string): ActionScopeRequirement | undefined;
@@ -7,7 +7,7 @@
7
7
  // checked by role-conditioned Cedar policies. Grants are validated
8
8
  // against each product's Cedar action schema at codegen time.
9
9
  // See adrs/0006-privilege-scope-catalog.md.
10
- export const PRIVILEGE_CATALOG_VERSION = '2026-06-08';
10
+ export const PRIVILEGE_CATALOG_VERSION = '2026-07-14';
11
11
  /** Every role in the catalog, in declaration order. */
12
12
  export const PRIVILEGE_CATALOG_ROLES = [
13
13
  'auditor',
@@ -95,3 +95,56 @@ export function privilegeScopeForRole(role) {
95
95
  const caps = PRIVILEGE_SCOPE_BY_ROLE[role];
96
96
  return caps ? [...caps] : [];
97
97
  }
98
+ /**
99
+ * Coding-agent scope vocabulary, in declaration order (see
100
+ * products/code-agents-identity-design.md section 8). The canonical
101
+ * namespaced scope strings minted into code-agent tokens.
102
+ */
103
+ export const CODING_AGENT_SCOPES = [
104
+ 'tools:read',
105
+ 'tools:write',
106
+ 'tools:execute',
107
+ 'tools:network',
108
+ 'tools:agent',
109
+ 'tools:vcs',
110
+ ];
111
+ // Scope -> human-readable description. Read via scopeDescription.
112
+ const SCOPE_DESCRIPTIONS = {
113
+ 'tools:read': 'Read-side agent operations: read workspace files and feed prompts/context to the model.',
114
+ 'tools:write': 'Mutate the workspace: create, modify, or delete files.',
115
+ 'tools:execute': 'Execute behavior: MCP tool invocations, native IDE tools, and shell commands.',
116
+ 'tools:network': 'Reach the network beyond the model provider: outbound HTTP and connections to remote MCP servers.',
117
+ 'tools:agent': 'Spawn or delegate to subagents (delegation edges in the mission graph).',
118
+ 'tools:vcs': 'Version-control operations: commit, branch, push, open pull requests.',
119
+ };
120
+ /**
121
+ * Reports whether `scope` is a declared vocabulary scope.
122
+ */
123
+ export function isCodingAgentScope(scope) {
124
+ return CODING_AGENT_SCOPES.includes(scope);
125
+ }
126
+ /**
127
+ * Human-readable description of a vocabulary scope, or `''` for an
128
+ * unknown scope.
129
+ */
130
+ export function scopeDescription(scope) {
131
+ return SCOPE_DESCRIPTIONS[scope] ?? '';
132
+ }
133
+ // Product -> bare action -> ceiling. Read via actionScopeRequirement.
134
+ const ACTION_SCOPES_BY_PRODUCT = {
135
+ 'overwatch': {
136
+ 'process_prompt': { requiredScope: 'tools:read' },
137
+ 'read_file': { requiredScope: 'tools:read' },
138
+ 'call_tool': { requiredScope: 'tools:execute' },
139
+ 'write_file': { requiredScope: 'tools:write' },
140
+ 'connect_server': { requiredScope: null },
141
+ },
142
+ };
143
+ /**
144
+ * The ceiling for (product, action), or `undefined` when the catalog
145
+ * defines none. `undefined` — or a defined entry with a `null`
146
+ * requiredScope — means the action has no scope requirement.
147
+ */
148
+ export function actionScopeRequirement(product, action) {
149
+ return ACTION_SCOPES_BY_PRODUCT[product]?.[action];
150
+ }
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Full Cedar schema for agent_ops, embedded at codegen time.
5
5
  */
6
- export declare const AGENT_OPS_SCHEMA = "// =============================================================================\n// AgentOps Cedar Schema\n// =============================================================================\n// Unified schema for all agent guardrail policies. Covers every request path\n// where an AI agent touches the Highflame platform:\n// - LLM prompt/response (Guardrails path)\n// - IDE tool calls and file access (Overwatch path)\n// - MCP server connections (AI Gateway path)\n//\n// The context types are a superset of Guardrails, Overwatch, and AI Gateway\n// schemas. All extra fields are optional \u2014 Shield projects only what is present\n// in the request, Cedar ignores absent optional attributes.\n//\n// Service: highflame-shield (agent_ops product)\n// Namespace: AgentOps\n// =============================================================================\n\nnamespace AgentOps {\n // =========================================================================\n // Entity Types \u2014 ReBAC Hierarchy\n // =========================================================================\n // Entity hierarchy enables Cedar's `in` operator for policy scoping:\n // Account (org root)\n // \u2514\u2500\u2500 Project in [Account]\n // \u251C\u2500\u2500 App in [Project]\n // \u2502 \u2514\u2500\u2500 Session in [App, Agent]\n // \u2514\u2500\u2500 Agent in [Project]\n // \u2514\u2500\u2500 Session in [App, Agent]\n //\n // Policy scoping examples:\n // resource in AgentOps::Project::\"<uuid>\" \u2192 project-wide (all agents)\n // resource in AgentOps::Agent::\"<external_id>\" \u2192 named agent + its sessions\n // resource == AgentOps::Agent::\"<external_id>\" \u2192 named agent only (exact match)\n // resource in AgentOps::Account::\"<uuid>\" \u2192 org-wide\n // =========================================================================\n\n /// Account represents an organization (top-level tenant)\n entity Account;\n\n /// Project represents a project within an account\n entity Project in [Account];\n\n /// User represents a principal (human or service) making requests\n entity User;\n\n /// Agent represents an AI agent (Claude, Cursor, Copilot, MCP client, etc.)\n /// Used as both principal (who is acting) and resource (policy scoping target).\n /// Agent + sessions: resource in AgentOps::Agent::\"<external_id>\" (hierarchy match)\n /// Agent only: resource == AgentOps::Agent::\"<external_id>\" (exact match)\n entity Agent in [Project];\n\n /// App represents a protected application (guardrails-enabled LLM app)\n entity App in [Project];\n\n /// Session represents an agentic conversation session with state tracking.\n /// Sessions can belong to either an App or an Agent.\n entity Session in [App, Agent];\n\n // =========================================================================\n // Actions\n // =========================================================================\n\n /// Process user prompts and AI responses for security threats and content violations\n action \"process_prompt\" appliesTo {\n principal: [User, Agent],\n resource: [App, Agent, Session],\n context: ProcessPromptContext\n };\n\n /// Execute tool calls (shell, file operations, MCP tools)\n action \"call_tool\" appliesTo {\n principal: [User, Agent],\n resource: [Agent, Session],\n context: CallToolContext\n };\n\n /// Read file operations\n action \"read_file\" appliesTo {\n principal: [User, Agent],\n resource: [Agent, Session],\n context: FileReadContext\n };\n\n /// Write file operations\n action \"write_file\" appliesTo {\n principal: [User, Agent],\n resource: [Agent, Session],\n context: FileWriteContext\n };\n\n /// Connect to an MCP server\n action \"connect_server\" appliesTo {\n principal: [User, Agent],\n resource: [Agent, Session],\n context: ConnectServerContext\n };\n\n /// Provision a sandbox for the acting identity (Forge OS-layer envelope).\n /// The MANDATORY authorization gate for sandbox creation (ADR 0019 D1):\n /// Forge evaluates this action's AgentOps bundle at create-time; no decision\n /// means no sandbox. Context carries the requested capability envelope\n /// (writable paths, egress, exec allowlist, curated mechanism toggles,\n /// isolation tier). Raw syscalls are NEVER expressed here \u2014 the enforcement\n /// generators own the mechanism\u2192syscall translation (ADR 0017 D1).\n action \"provision_sandbox\" appliesTo {\n principal: [User, Agent],\n resource: [Agent, Session],\n context: ProvisionSandboxContext\n };\n\n // =========================================================================\n // Context Types (Action-Specific)\n // =========================================================================\n\n /// Context for process_prompt action (user prompts & AI responses)\n type ProcessPromptContext = {\n // Identity (AARM R6 / CAP-IDN-011) \u2014 projected from the principal's token; optional.\n \"role\"?: String,\n \"privilege_scope\"?: Set<String>,\n \"identity_type\"?: String, // Principal identity class: \"human\" | \"agent\" | \"service\" | \"mcp_server\"\n \"principal\"?: String, // Stable principal identifier (e.g. ZeroID / WIMSE URI or user id)\n // Core metadata (required)\n \"request_id\": String,\n \"timestamp\": Long,\n \"direction\": String, // \"input\" | \"output\"\n \"content_type\": String, // \"prompt\" | \"response\" | \"tool_call\" | \"file\"\n \"detector_count\": Long,\n\n // IDE / workspace context (optional \u2014 present for Overwatch/code-agent traffic)\n \"source\"?: String, // Traffic origin: \"ide\" | \"cli\" | \"api\" | \"browser\"\n \"event\"?: String, // Event type: \"prompt\" | \"tool_call\" | \"file_read\" | ...\n \"user_email\"?: String, // Human operator email (IDE sessions)\n \"cwd\"?: String, // Current working directory\n \"workspace_root\"?: String, // IDE workspace root path\n\n // Model context (optional \u2014 present for AI Gateway traffic)\n \"model_name\"?: String, // LLM model name: \"claude-3-5-sonnet\", \"gpt-4o\", ...\n \"model_provider\"?: String, // Model provider: \"anthropic\" | \"openai\" | \"google\" | ...\n\n // Security - Injection & Jailbreak (optional)\n \"injection_score\"?: Long, // Combined injection confidence: MAX(pulse, deep_context)\n \"jailbreak_score\"?: Long, // Combined jailbreak confidence: MAX(pulse, deep_context)\n \"injection_pulse_score\"?: Long, // 0-100 Pulse single-turn classifier\n \"injection_deep_context_score\"?: Long, // 0-100 DeepContext multi-turn\n \"jailbreak_pulse_score\"?: Long, // 0-100 Pulse single-turn classifier\n \"jailbreak_deep_context_score\"?: Long, // 0-100 DeepContext multi-turn\n \"injection_type\"?: String, // \"prompt\" | \"sql\" | \"command\" | \"none\"\n \"indirect_injection_score\"?: Long, // Indirect injection via tool outputs (0-100)\n\n // Privacy - Secrets (optional)\n \"secrets_detected\"?: Boolean,\n \"secret_count\"?: Long,\n \"secret_types\"?: Set<String>, // [\"aws_access_key\", \"github_token\", ...]\n\n // Privacy - PII (optional)\n \"pii_detected\"?: Boolean,\n \"pii_count\"?: Long,\n \"pii_types\"?: Set<String>, // [\"email\", \"phone\", \"ssn\", \"credit_card\", ...]\n \"pii_score\"?: Long, // PII ML classifier confidence (0-100)\n\n // Aggregated threat summary (optional \u2014 populated by aggregation detectors)\n \"highest_severity\"?: String, // \"critical\" | \"high\" | \"medium\" | \"low\" | \"none\"\n \"threat_count\"?: Long,\n \"threat_categories\"?: Set<String>,\n \"detected_threats\"?: Set<String>,\n\n // Trust & Safety - Toxicity (optional)\n \"violence_score\"?: Long, // 0-100\n \"hate_speech_score\"?: Long, // 0-100\n \"sexual_score\"?: Long, // 0-100\n \"weapons_score\"?: Long, // 0-100\n \"crime_score\"?: Long, // 0-100\n \"profanity_score\"?: Long, // 0-100\n\n // Semantic - Topic Classification (optional)\n \"content_topics\"?: Set<String>, // [\"controlled_substances\", \"weapons_manufacturing\", ...]\n \"topic_confidence\"?: Long, // 0-100\n\n // Security - Invisible Character Detection (optional)\n \"invisible_chars_detected\"?: Boolean,\n \"invisible_chars_score\"?: Long, // 0-100\n\n // Security - Pattern Detection (optional)\n \"command_injection_detected\"?: Boolean,\n \"command_injection_type\"?: String, // \"reverse_shell\" | \"privilege_escalation\" | ...\n \"command_injection_score\"?: Long, // 0-100\n \"path_traversal_detected\"?: Boolean,\n \"path_traversal_severity\"?: String, // \"critical\" | \"high\" | \"medium\" | \"low\" | \"none\"\n \"path_traversal_type\"?: String,\n \"sql_injection_detected\"?: Boolean,\n \"sql_injection_type\"?: String, // \"tautology\" | \"union_based\" | \"destructive\" | ...\n \"sql_injection_score\"?: Long, // 0-100\n\n // Security - Cross-Origin Escalation (optional)\n \"cross_origin_detected\"?: Boolean,\n \"cross_origin_type\"?: String, // \"cross_origin_tool\" | \"cross_origin_server\" | \"none\"\n \"cross_origin_score\"?: Long, // 0-100\n\n // Security - Encoded Injection (optional)\n \"encoded_content_detected\"?: Boolean,\n \"encoded_types\"?: Set<String>, // [\"base64\", \"hex\", \"unicode\", \"url\", ...]\n \"encoded_count\"?: Long,\n \"encoded_score\"?: Long, // 0-100\n\n // Language & Script Detection (optional)\n \"detected_language\"?: String, // ISO language code\n \"is_english\"?: Boolean,\n \"language_confidence\"?: Long, // 0-100\n \"detected_script\"?: String, // \"latin\" | \"cyrillic\" | \"arabic\" | \"unknown\" | ...\n \"is_latin_script\"?: Boolean,\n \"script_confidence\"?: Long, // 0-100\n\n // Content Analysis (optional)\n \"hallucination_score\"?: Long,\n \"factuality_score\"?: Long, // 0-100\n \"sentiment_score\"?: Long,\n \"contains_code\"?: Boolean,\n \"code_languages\"?: Set<String>,\n \"code_ratio\"?: Long, // 0-100\n \"keyword_matched\"?: Boolean,\n \"keyword_categories\"?: Set<String>,\n \"keyword_count\"?: Long,\n \"contains_non_ascii\"?: Boolean,\n \"phishing_detected\"?: Boolean,\n \"content_safety_score\"?: Long, // 0-100\n \"content_safety_blocked\"?: Boolean,\n\n // Agentic - Multi-Turn Context (optional)\n \"conversation_turn\"?: Long,\n \"multi_turn_detection\"?: Boolean,\n\n // Session Detection History \u2014 cross-turn sticky flags (optional)\n \"session_pii_detected\"?: Boolean,\n \"session_pii_types\"?: Set<String>,\n \"session_secrets_detected\"?: Boolean,\n \"session_secret_types\"?: Set<String>,\n \"session_injection_detected\"?: Boolean,\n \"session_command_injection\"?: Boolean,\n \"session_threat_turns\"?: Long,\n \"session_max_injection_score\"?: Long,\n \"session_max_jailbreak_score\"?: Long,\n \"session_max_command_injection_score\"?: Long,\n \"session_max_pii_score\"?: Long,\n \"session_max_secret_score\"?: Long,\n \"session_cumulative_risk_score\"?: Long,\n \"session_original_request\"?: String,\n \"session_max_sensitivity\"?: String,\n\n // Data-Flow Labels \u2014 per-value information-flow facts (ADR 0020, optional).\n // All optional: guard every access with `has` \u2014 an absent-attribute read is\n // a Cedar evaluation error and an errored forbid is silently skipped (fail-open).\n \"flow_confidentiality\"?: String, // \"public\" | \"internal\" | \"confidential\" | \"restricted\" | \"unknown\"\n \"flow_integrity\"?: String, // \"trusted\" | \"untrusted\" | \"mixed\" | \"unknown\"\n \"flow_data_types\"?: Set<String>, // \"pii\" | \"secrets\" | \"source_code\" | \"financial\" | \"health\" | ...\n \"flow_compartments\"?: Set<String>, // \"tenant:*\" | \"customer:*\" | \"project:*\"\n \"flow_resolution_status\"?: String, // \"known\" | \"inferred\" | \"unknown\" | \"conflicted\"\n \"flow_origins\"?: Set<String>, // \"mcp_tool_result\" | \"model\" | \"file\" | \"database\" | \"user\"\n \"flow_sink\"?: String, // \"external_model\" | \"local_model\" | \"external_mcp\" | \"trusted_mcp\" | \"user_secure_output\" | \"public_network\" | \"file\"\n \"flow_sink_is_external\"?: Boolean,\n \"flow_sink_effects\"?: Set<String>, // \"network.send\" | \"financial.transfer\" | \"filesystem.write\" | ...\n \"principal_clearances\"?: Set<String>, // ADR 0020 D8 \u2014 clearances AuthN mints for the principal\n \"principal_compartments\"?: Set<String>, // ADR 0020 D8 \u2014 compartments the principal is admitted to\n\n // Usage Budget \u2014 multi-window token & cost enforcement (optional)\n \"budget_remaining_pct\"?: Long,\n \"budget_exceeded\"?: Boolean,\n \"budget_cost_micros_this_turn\"?: Long,\n \"budget_model\"?: String,\n \"budget_tokens_pct_session\"?: Long,\n \"budget_tokens_pct_daily\"?: Long,\n \"budget_tokens_pct_monthly\"?: Long,\n \"budget_cost_pct_daily\"?: Long,\n \"budget_cost_pct_monthly\"?: Long,\n \"budget_exceeded_session\"?: Boolean,\n \"budget_exceeded_daily\"?: Boolean,\n \"budget_exceeded_monthly\"?: Boolean,\n\n // Rate Limiting \u2014 gateway-metered, Shield-decided (ADR 0014)\n \"rpm_remaining_pct\"?: Long,\n \"rpm_exceeded\"?: Boolean,\n \"tpm_remaining_pct\"?: Long,\n \"tpm_exceeded\"?: Boolean,\n\n // Agent Identity \u2014 authenticated agent principal metadata (optional)\n \"agent_id\"?: String,\n \"agent_type\"?: String, // \"orchestrator\" | \"autonomous\" | \"tool_agent\" | \"human_proxy\"\n \"agent_trust_level\"?: String, // \"first_party\" | \"verified_third_party\" | \"unverified\"\n \"agent_framework\"?: String,\n \"agent_publisher\"?: String,\n\n };\n\n /// Context for call_tool action (agentic tool execution)\n type CallToolContext = {\n // Identity (AARM R6 / CAP-IDN-011) \u2014 projected from the principal's token; optional.\n \"role\"?: String,\n \"privilege_scope\"?: Set<String>,\n \"identity_type\"?: String,\n \"principal\"?: String,\n // Core metadata (required)\n \"request_id\": String,\n \"timestamp\": Long,\n\n // IDE / workspace context (optional)\n \"source\"?: String,\n \"event\"?: String,\n \"user_email\"?: String,\n \"cwd\"?: String,\n \"workspace_root\"?: String,\n\n // Tool Risk (optional)\n \"tool_name\"?: String,\n \"tool_risk_score\"?: Long, // 0-100\n \"tool_is_sensitive\"?: Boolean,\n \"tool_category\"?: String, // \"safe\" | \"sensitive\" | \"dangerous\"\n \"tool_is_builtin\"?: Boolean,\n\n // AARM R3 (CAP-ENF-007) \u2014 Action Parameter Validation\n \"action_params\"?: {\n \"amount\"?: Long,\n \"count\"?: Long,\n \"command\"?: String,\n \"path\"?: String,\n \"url\"?: String,\n \"recipient\"?: String,\n \"target\"?: String,\n \"query\"?: String,\n },\n \"param_type_violation\"?: Boolean,\n \"param_type_violations\"?: Set<String>,\n\n // MCP context (optional)\n \"mcp_server\"?: String,\n \"mcp_tool\"?: String,\n \"mcp_server_verified\"?: Boolean,\n\n // Agentic - Behavioral Patterns (optional)\n \"suspicious_pattern\"?: Boolean,\n \"pattern_type\"?: String, // \"data_exfiltration\" | \"secret_exfiltration\" | ...\n \"sequence_risk\"?: Long, // 0-100\n\n // Agentic - Loop Detection (optional)\n \"loop_detected\"?: Boolean,\n \"loop_count\"?: Long,\n \"loop_tool\"?: String,\n\n // Security checks on tool arguments (optional)\n \"secrets_detected\"?: Boolean,\n \"secret_count\"?: Long,\n \"secret_types\"?: Set<String>,\n \"pii_detected\"?: Boolean,\n \"pii_types\"?: Set<String>,\n \"pii_count\"?: Long,\n \"pii_score\"?: Long,\n \"injection_score\"?: Long,\n \"injection_pulse_score\"?: Long,\n \"injection_deep_context_score\"?: Long,\n \"indirect_injection_score\"?: Long,\n \"indirect_injection_type\"?: String, // Type of indirect injection detected\n\n // Semantic - Topic Classification (optional)\n \"content_topics\"?: Set<String>, // [\"controlled_substances\", \"weapons_manufacturing\", ...]\n \"topic_confidence\"?: Long, // 0-100\n\n // Security - Pattern Detection (optional)\n \"command_injection_detected\"?: Boolean,\n \"command_injection_type\"?: String,\n \"command_injection_score\"?: Long,\n \"path_traversal_detected\"?: Boolean,\n \"path_traversal_severity\"?: String,\n \"path_traversal_type\"?: String,\n \"sql_injection_detected\"?: Boolean,\n \"sql_injection_type\"?: String,\n \"sql_injection_score\"?: Long,\n\n // Security - Cross-Origin Escalation (optional)\n \"cross_origin_detected\"?: Boolean,\n \"cross_origin_type\"?: String,\n \"cross_origin_score\"?: Long,\n\n // Security - Invisible Character Detection (optional)\n \"invisible_chars_detected\"?: Boolean,\n \"invisible_chars_score\"?: Long,\n\n // Security - Encoded Injection (optional)\n \"encoded_content_detected\"?: Boolean,\n \"encoded_types\"?: Set<String>,\n \"encoded_count\"?: Long,\n \"encoded_score\"?: Long,\n\n // Agentic - Agent Security (optional)\n \"tool_poisoning_detected\"?: Boolean,\n \"tool_poisoning_score\"?: Long,\n \"tool_poisoning_type\"?: String,\n \"rug_pull_detected\"?: Boolean,\n \"rug_pull_score\"?: Long,\n \"rug_pull_type\"?: String,\n\n // Agentic - MCP Risk (optional)\n \"mcp_config_risk\"?: Boolean,\n \"mcp_risk_type\"?: String,\n \"mcp_risk_score\"?: Long,\n\n // Tool Operation Classifier (optional)\n \"tool_operation_classes\"?: Set<String>,\n\n // Agentic - Multi-Turn Context (optional)\n \"conversation_turn\"?: Long,\n \"multi_turn_detection\"?: Boolean,\n\n // Session Detection History \u2014 cross-turn sticky flags (optional)\n \"session_pii_detected\"?: Boolean,\n \"session_pii_types\"?: Set<String>,\n \"session_secrets_detected\"?: Boolean,\n \"session_secret_types\"?: Set<String>,\n \"session_injection_detected\"?: Boolean,\n \"session_command_injection\"?: Boolean,\n \"session_threat_turns\"?: Long,\n \"session_max_injection_score\"?: Long,\n \"session_max_jailbreak_score\"?: Long,\n \"session_max_command_injection_score\"?: Long,\n \"session_max_pii_score\"?: Long,\n \"session_max_secret_score\"?: Long,\n \"session_cumulative_risk_score\"?: Long,\n \"session_original_request\"?: String,\n \"session_max_sensitivity\"?: String,\n\n // Data-Flow Labels \u2014 per-value information-flow facts (ADR 0020, optional).\n // All optional: guard every access with `has` \u2014 an absent-attribute read is\n // a Cedar evaluation error and an errored forbid is silently skipped (fail-open).\n \"flow_confidentiality\"?: String, // \"public\" | \"internal\" | \"confidential\" | \"restricted\" | \"unknown\"\n \"flow_integrity\"?: String, // \"trusted\" | \"untrusted\" | \"mixed\" | \"unknown\"\n \"flow_data_types\"?: Set<String>, // \"pii\" | \"secrets\" | \"source_code\" | \"financial\" | \"health\" | ...\n \"flow_compartments\"?: Set<String>, // \"tenant:*\" | \"customer:*\" | \"project:*\"\n \"flow_resolution_status\"?: String, // \"known\" | \"inferred\" | \"unknown\" | \"conflicted\"\n \"flow_origins\"?: Set<String>, // \"mcp_tool_result\" | \"model\" | \"file\" | \"database\" | \"user\"\n \"flow_sink\"?: String, // \"external_model\" | \"local_model\" | \"external_mcp\" | \"trusted_mcp\" | \"user_secure_output\" | \"public_network\" | \"file\"\n \"flow_sink_is_external\"?: Boolean,\n \"flow_sink_effects\"?: Set<String>, // \"network.send\" | \"financial.transfer\" | \"filesystem.write\" | ...\n \"principal_clearances\"?: Set<String>, // ADR 0020 D8 \u2014 clearances AuthN mints for the principal\n \"principal_compartments\"?: Set<String>, // ADR 0020 D8 \u2014 compartments the principal is admitted to\n\n // Usage Budget (optional)\n \"budget_remaining_pct\"?: Long,\n \"budget_exceeded\"?: Boolean,\n \"budget_cost_micros_this_turn\"?: Long,\n \"budget_model\"?: String,\n \"budget_tokens_pct_session\"?: Long,\n \"budget_tokens_pct_daily\"?: Long,\n \"budget_tokens_pct_monthly\"?: Long,\n \"budget_cost_pct_daily\"?: Long,\n \"budget_cost_pct_monthly\"?: Long,\n \"budget_exceeded_session\"?: Boolean,\n \"budget_exceeded_daily\"?: Boolean,\n \"budget_exceeded_monthly\"?: Boolean,\n\n // Rate Limiting \u2014 gateway-metered, Shield-decided (ADR 0014)\n \"rpm_remaining_pct\"?: Long,\n \"rpm_exceeded\"?: Boolean,\n \"tpm_remaining_pct\"?: Long,\n \"tpm_exceeded\"?: Boolean,\n\n // Aggregated threat summary (optional)\n \"highest_severity\"?: String,\n \"threat_count\"?: Long,\n \"detected_threats\"?: Set<String>,\n\n // Agent Identity (optional)\n \"agent_id\"?: String,\n \"agent_type\"?: String,\n \"agent_trust_level\"?: String,\n \"agent_framework\"?: String,\n \"agent_publisher\"?: String,\n\n // File & Path (optional)\n \"path\"?: String,\n\n };\n\n /// Context for read_file action\n type FileReadContext = {\n // Identity (optional)\n \"role\"?: String,\n \"privilege_scope\"?: Set<String>,\n \"identity_type\"?: String,\n \"principal\"?: String,\n // Core metadata (required)\n \"request_id\": String,\n \"timestamp\": Long,\n\n // IDE / workspace context (optional)\n \"source\"?: String,\n \"event\"?: String,\n \"user_email\"?: String,\n \"cwd\"?: String,\n \"workspace_root\"?: String,\n\n // File path (optional)\n \"path\"?: String,\n\n // Security checks on file content (optional)\n \"secrets_detected\"?: Boolean,\n \"secret_count\"?: Long,\n \"secret_types\"?: Set<String>,\n \"pii_detected\"?: Boolean,\n \"pii_types\"?: Set<String>,\n\n // Security - Path Traversal (optional)\n \"path_traversal_detected\"?: Boolean,\n \"path_traversal_severity\"?: String,\n \"path_traversal_type\"?: String,\n\n // Aggregated threat summary (optional)\n \"highest_severity\"?: String,\n \"threat_count\"?: Long,\n \"detected_threats\"?: Set<String>,\n\n // Session Detection History (optional)\n \"session_pii_detected\"?: Boolean,\n \"session_pii_types\"?: Set<String>,\n \"session_secrets_detected\"?: Boolean,\n \"session_secret_types\"?: Set<String>,\n \"session_injection_detected\"?: Boolean,\n \"session_command_injection\"?: Boolean,\n \"session_threat_turns\"?: Long,\n \"session_max_injection_score\"?: Long,\n \"session_max_jailbreak_score\"?: Long,\n \"session_max_command_injection_score\"?: Long,\n \"session_max_pii_score\"?: Long,\n \"session_max_secret_score\"?: Long,\n \"session_cumulative_risk_score\"?: Long,\n \"session_original_request\"?: String,\n \"session_max_sensitivity\"?: String,\n\n // Data-Flow Labels \u2014 per-value information-flow facts (ADR 0020, optional).\n // All optional: guard every access with `has` \u2014 an absent-attribute read is\n // a Cedar evaluation error and an errored forbid is silently skipped (fail-open).\n \"flow_confidentiality\"?: String, // \"public\" | \"internal\" | \"confidential\" | \"restricted\" | \"unknown\"\n \"flow_integrity\"?: String, // \"trusted\" | \"untrusted\" | \"mixed\" | \"unknown\"\n \"flow_data_types\"?: Set<String>, // \"pii\" | \"secrets\" | \"source_code\" | \"financial\" | \"health\" | ...\n \"flow_compartments\"?: Set<String>, // \"tenant:*\" | \"customer:*\" | \"project:*\"\n \"flow_resolution_status\"?: String, // \"known\" | \"inferred\" | \"unknown\" | \"conflicted\"\n \"flow_origins\"?: Set<String>, // \"mcp_tool_result\" | \"model\" | \"file\" | \"database\" | \"user\"\n \"flow_sink\"?: String, // \"external_model\" | \"local_model\" | \"external_mcp\" | \"trusted_mcp\" | \"user_secure_output\" | \"public_network\" | \"file\"\n \"flow_sink_is_external\"?: Boolean,\n \"flow_sink_effects\"?: Set<String>, // \"network.send\" | \"financial.transfer\" | \"filesystem.write\" | ...\n \"principal_clearances\"?: Set<String>, // ADR 0020 D8 \u2014 clearances AuthN mints for the principal\n \"principal_compartments\"?: Set<String>, // ADR 0020 D8 \u2014 compartments the principal is admitted to\n\n // Usage Budget (optional)\n \"budget_remaining_pct\"?: Long,\n \"budget_exceeded\"?: Boolean,\n \"budget_cost_micros_this_turn\"?: Long,\n \"budget_model\"?: String,\n \"budget_tokens_pct_session\"?: Long,\n \"budget_tokens_pct_daily\"?: Long,\n \"budget_tokens_pct_monthly\"?: Long,\n \"budget_cost_pct_daily\"?: Long,\n \"budget_cost_pct_monthly\"?: Long,\n \"budget_exceeded_session\"?: Boolean,\n \"budget_exceeded_daily\"?: Boolean,\n \"budget_exceeded_monthly\"?: Boolean,\n\n // Rate Limiting \u2014 gateway-metered, Shield-decided (ADR 0014)\n \"rpm_remaining_pct\"?: Long,\n \"rpm_exceeded\"?: Boolean,\n \"tpm_remaining_pct\"?: Long,\n \"tpm_exceeded\"?: Boolean,\n\n // Agent Identity (optional)\n \"agent_id\"?: String,\n \"agent_type\"?: String,\n \"agent_trust_level\"?: String,\n \"agent_framework\"?: String,\n \"agent_publisher\"?: String,\n\n };\n\n /// Context for write_file action\n type FileWriteContext = {\n // Identity (optional)\n \"role\"?: String,\n \"privilege_scope\"?: Set<String>,\n \"identity_type\"?: String,\n \"principal\"?: String,\n // Core metadata (required)\n \"request_id\": String,\n \"timestamp\": Long,\n\n // IDE / workspace context (optional)\n \"source\"?: String,\n \"event\"?: String,\n \"user_email\"?: String,\n \"cwd\"?: String,\n \"workspace_root\"?: String,\n\n // File path (optional)\n \"path\"?: String,\n\n // Security - Invisible Character Detection in write content (optional)\n \"invisible_chars_detected\"?: Boolean,\n \"invisible_chars_score\"?: Long,\n\n // Security checks on content being written (optional)\n \"secrets_detected\"?: Boolean,\n \"secret_count\"?: Long,\n \"secret_types\"?: Set<String>,\n \"pii_detected\"?: Boolean,\n \"pii_types\"?: Set<String>,\n\n // Security - Path Traversal (optional)\n \"path_traversal_detected\"?: Boolean,\n \"path_traversal_severity\"?: String,\n \"path_traversal_type\"?: String,\n\n // Aggregated threat summary (optional)\n \"highest_severity\"?: String,\n \"threat_count\"?: Long,\n \"detected_threats\"?: Set<String>,\n\n // Session Detection History (optional)\n \"session_pii_detected\"?: Boolean,\n \"session_pii_types\"?: Set<String>,\n \"session_secrets_detected\"?: Boolean,\n \"session_secret_types\"?: Set<String>,\n \"session_injection_detected\"?: Boolean,\n \"session_command_injection\"?: Boolean,\n \"session_threat_turns\"?: Long,\n \"session_max_injection_score\"?: Long,\n \"session_max_jailbreak_score\"?: Long,\n \"session_max_command_injection_score\"?: Long,\n \"session_max_pii_score\"?: Long,\n \"session_max_secret_score\"?: Long,\n \"session_cumulative_risk_score\"?: Long,\n \"session_original_request\"?: String,\n \"session_max_sensitivity\"?: String,\n\n // Data-Flow Labels \u2014 per-value information-flow facts (ADR 0020, optional).\n // All optional: guard every access with `has` \u2014 an absent-attribute read is\n // a Cedar evaluation error and an errored forbid is silently skipped (fail-open).\n \"flow_confidentiality\"?: String, // \"public\" | \"internal\" | \"confidential\" | \"restricted\" | \"unknown\"\n \"flow_integrity\"?: String, // \"trusted\" | \"untrusted\" | \"mixed\" | \"unknown\"\n \"flow_data_types\"?: Set<String>, // \"pii\" | \"secrets\" | \"source_code\" | \"financial\" | \"health\" | ...\n \"flow_compartments\"?: Set<String>, // \"tenant:*\" | \"customer:*\" | \"project:*\"\n \"flow_resolution_status\"?: String, // \"known\" | \"inferred\" | \"unknown\" | \"conflicted\"\n \"flow_origins\"?: Set<String>, // \"mcp_tool_result\" | \"model\" | \"file\" | \"database\" | \"user\"\n \"flow_sink\"?: String, // \"external_model\" | \"local_model\" | \"external_mcp\" | \"trusted_mcp\" | \"user_secure_output\" | \"public_network\" | \"file\"\n \"flow_sink_is_external\"?: Boolean,\n \"flow_sink_effects\"?: Set<String>, // \"network.send\" | \"financial.transfer\" | \"filesystem.write\" | ...\n \"principal_clearances\"?: Set<String>, // ADR 0020 D8 \u2014 clearances AuthN mints for the principal\n \"principal_compartments\"?: Set<String>, // ADR 0020 D8 \u2014 compartments the principal is admitted to\n\n // Usage Budget (optional)\n \"budget_remaining_pct\"?: Long,\n \"budget_exceeded\"?: Boolean,\n \"budget_cost_micros_this_turn\"?: Long,\n \"budget_model\"?: String,\n \"budget_tokens_pct_session\"?: Long,\n \"budget_tokens_pct_daily\"?: Long,\n \"budget_tokens_pct_monthly\"?: Long,\n \"budget_cost_pct_daily\"?: Long,\n \"budget_cost_pct_monthly\"?: Long,\n \"budget_exceeded_session\"?: Boolean,\n \"budget_exceeded_daily\"?: Boolean,\n \"budget_exceeded_monthly\"?: Boolean,\n\n // Rate Limiting \u2014 gateway-metered, Shield-decided (ADR 0014)\n \"rpm_remaining_pct\"?: Long,\n \"rpm_exceeded\"?: Boolean,\n \"tpm_remaining_pct\"?: Long,\n \"tpm_exceeded\"?: Boolean,\n\n // Agent Identity (optional)\n \"agent_id\"?: String,\n \"agent_type\"?: String,\n \"agent_trust_level\"?: String,\n \"agent_framework\"?: String,\n \"agent_publisher\"?: String,\n\n };\n\n /// Context for connect_server action (MCP server connections)\n type ConnectServerContext = {\n // Identity (optional)\n \"role\"?: String,\n \"privilege_scope\"?: Set<String>,\n \"identity_type\"?: String,\n \"principal\"?: String,\n // Core metadata (required)\n \"request_id\": String,\n \"timestamp\": Long,\n\n // IDE / workspace context (optional)\n \"source\"?: String,\n \"event\"?: String,\n \"user_email\"?: String,\n \"cwd\"?: String,\n \"workspace_root\"?: String,\n\n // MCP context (optional)\n \"mcp_server\"?: String,\n \"mcp_server_verified\"?: Boolean,\n\n // Agentic - Agent Security (optional)\n \"tool_poisoning_detected\"?: Boolean,\n \"tool_poisoning_score\"?: Long,\n \"tool_poisoning_type\"?: String,\n\n // Agentic - MCP Risk (optional)\n \"mcp_config_risk\"?: Boolean,\n \"mcp_risk_type\"?: String,\n \"mcp_risk_score\"?: Long,\n\n // Security - Cross-Origin Escalation (optional)\n \"cross_origin_detected\"?: Boolean,\n \"cross_origin_type\"?: String,\n \"cross_origin_score\"?: Long,\n\n // Aggregated threat summary (optional)\n \"highest_severity\"?: String,\n \"threat_count\"?: Long,\n \"detected_threats\"?: Set<String>,\n\n // Session Detection History (optional)\n \"session_pii_detected\"?: Boolean,\n \"session_pii_types\"?: Set<String>,\n \"session_secrets_detected\"?: Boolean,\n \"session_secret_types\"?: Set<String>,\n \"session_injection_detected\"?: Boolean,\n \"session_command_injection\"?: Boolean,\n \"session_threat_turns\"?: Long,\n \"session_max_injection_score\"?: Long,\n \"session_max_jailbreak_score\"?: Long,\n \"session_max_command_injection_score\"?: Long,\n \"session_max_pii_score\"?: Long,\n \"session_max_secret_score\"?: Long,\n \"session_cumulative_risk_score\"?: Long,\n \"session_original_request\"?: String,\n \"session_max_sensitivity\"?: String,\n\n // Data-Flow Labels \u2014 per-value information-flow facts (ADR 0020, optional).\n // All optional: guard every access with `has` \u2014 an absent-attribute read is\n // a Cedar evaluation error and an errored forbid is silently skipped (fail-open).\n \"flow_confidentiality\"?: String, // \"public\" | \"internal\" | \"confidential\" | \"restricted\" | \"unknown\"\n \"flow_integrity\"?: String, // \"trusted\" | \"untrusted\" | \"mixed\" | \"unknown\"\n \"flow_data_types\"?: Set<String>, // \"pii\" | \"secrets\" | \"source_code\" | \"financial\" | \"health\" | ...\n \"flow_compartments\"?: Set<String>, // \"tenant:*\" | \"customer:*\" | \"project:*\"\n \"flow_resolution_status\"?: String, // \"known\" | \"inferred\" | \"unknown\" | \"conflicted\"\n \"flow_origins\"?: Set<String>, // \"mcp_tool_result\" | \"model\" | \"file\" | \"database\" | \"user\"\n \"flow_sink\"?: String, // \"external_model\" | \"local_model\" | \"external_mcp\" | \"trusted_mcp\" | \"user_secure_output\" | \"public_network\" | \"file\"\n \"flow_sink_is_external\"?: Boolean,\n \"flow_sink_effects\"?: Set<String>, // \"network.send\" | \"financial.transfer\" | \"filesystem.write\" | ...\n \"principal_clearances\"?: Set<String>, // ADR 0020 D8 \u2014 clearances AuthN mints for the principal\n \"principal_compartments\"?: Set<String>, // ADR 0020 D8 \u2014 compartments the principal is admitted to\n\n // Usage Budget (optional)\n \"budget_remaining_pct\"?: Long,\n \"budget_exceeded\"?: Boolean,\n \"budget_cost_micros_this_turn\"?: Long,\n \"budget_model\"?: String,\n \"budget_tokens_pct_session\"?: Long,\n \"budget_tokens_pct_daily\"?: Long,\n \"budget_tokens_pct_monthly\"?: Long,\n \"budget_cost_pct_daily\"?: Long,\n \"budget_cost_pct_monthly\"?: Long,\n \"budget_exceeded_session\"?: Boolean,\n \"budget_exceeded_daily\"?: Boolean,\n \"budget_exceeded_monthly\"?: Boolean,\n\n // Rate Limiting \u2014 gateway-metered, Shield-decided (ADR 0014)\n \"rpm_remaining_pct\"?: Long,\n \"rpm_exceeded\"?: Boolean,\n \"tpm_remaining_pct\"?: Long,\n \"tpm_exceeded\"?: Boolean,\n\n // Agent Identity (optional)\n \"agent_id\"?: String,\n \"agent_type\"?: String,\n \"agent_trust_level\"?: String,\n \"agent_framework\"?: String,\n \"agent_publisher\"?: String,\n\n };\n\n /// Context for provision_sandbox action (Forge sandbox-create envelope).\n ///\n /// Every capability field below is OPTIONAL and describes the envelope the\n /// sandbox is being asked to provision with \u2014 Forge synthesizes it from the\n /// create request attenuated by the token's scope ceiling (ADR 0019 D1),\n /// then asks Cedar whether this identity may provision it. Profile templates\n /// `permit` provision_sandbox only when the requested envelope stays within\n /// the profile ceiling, and `forbid` any escalation beyond it.\n ///\n /// FAIL-OPEN WARNING (ADR 0019 D3): because these attributes are optional,\n /// accessing an absent one is a Cedar *evaluation error*, and an errored\n /// `forbid` is silently skipped \u2014 which fails OPEN. Every rule touching a\n /// field here MUST guard it first with `has` (e.g.\n /// `context has mechanism_capabilities && context.mechanism_capabilities.contains(\"sys:ptrace\")`).\n type ProvisionSandboxContext = {\n // Identity (AARM R6 / CAP-IDN-011) \u2014 projected from the principal's token; optional.\n \"role\"?: String,\n \"privilege_scope\"?: Set<String>,\n \"identity_type\"?: String, // Principal identity class: \"human\" | \"agent\" | \"service\" | \"mcp_server\"\n \"principal\"?: String, // Stable principal identifier (ZeroID / WIMSE URI or user id)\n \"agent_trust_level\"?: String, // \"untrusted\" | \"low\" | \"verified\" | \"trusted\"\n\n // Core metadata (required)\n \"request_id\": String,\n \"timestamp\": Long,\n\n // Requested isolation tier (required) \u2014 the OS-isolation tier the\n // sandbox will run at, as the lowercased Forge IsolationTier name (ADR\n // 0016 D1). Ordinal, weakest\u2192strongest: \"none\" (trusted-local) < \"os\"\n // (bwrap/seatbelt) < \"kernel\" (gVisor) < \"hardware\" (micro-VM + TEE).\n // Templates assert a floor via set membership (e.g. a KERNEL floor =\n // {\"kernel\",\"hardware\"}); Forge owns the ordering.\n \"isolation_tier\": String,\n\n // Requested capability envelope (all optional \u2014 has-guard mandatory).\n \"writable_paths\"?: Set<String>, // Writable path prefixes, e.g. {\"/scratch\"}\n // Master egress switch. Forge MUST set this true whenever ANY egress is\n // requested (i.e. whenever egress_hosts is non-empty), so a \"no network\"\n // profile can gate on this single boolean. egress_hosts then narrows the\n // host allowlist for profiles that DO permit egress.\n \"network_egress\"?: Boolean,\n \"egress_hosts\"?: Set<String>, // Host allowlist for egress, e.g. {\"pypi.org\"}\n \"exec_allowlist\"?: Set<String>, // Executables the sandbox may run, e.g. {\"python\", \"python3\"}\n // Curated mechanism toggles (ADR 0017 D1.3) \u2014 authorization facts only;\n // NEVER raw syscalls. Allowed members: \"sys:ptrace\", \"sys:bpf\",\n // \"sys:raw_socket\", \"dev:gpu\", \"virt:nested\".\n \"mechanism_capabilities\"?: Set<String>,\n };\n}\n";
6
+ export declare const AGENT_OPS_SCHEMA = "// =============================================================================\n// AgentOps Cedar Schema\n// =============================================================================\n// Unified schema for all agent guardrail policies. Covers every request path\n// where an AI agent touches the Highflame platform:\n// - LLM prompt/response (Guardrails path)\n// - IDE tool calls and file access (Overwatch path)\n// - MCP server connections (AI Gateway path)\n//\n// The context types are a superset of Guardrails, Overwatch, and AI Gateway\n// schemas. All extra fields are optional \u2014 Shield projects only what is present\n// in the request, Cedar ignores absent optional attributes.\n//\n// Service: highflame-shield (agent_ops product)\n// Namespace: AgentOps\n// =============================================================================\n\nnamespace AgentOps {\n // =========================================================================\n // Entity Types \u2014 ReBAC Hierarchy\n // =========================================================================\n // Entity hierarchy enables Cedar's `in` operator for policy scoping:\n // Account (org root)\n // \u2514\u2500\u2500 Project in [Account]\n // \u251C\u2500\u2500 App in [Project]\n // \u2502 \u2514\u2500\u2500 Session in [App, Agent]\n // \u2514\u2500\u2500 Agent in [Project]\n // \u2514\u2500\u2500 Session in [App, Agent]\n //\n // Policy scoping examples:\n // resource in AgentOps::Project::\"<uuid>\" \u2192 project-wide (all agents)\n // resource in AgentOps::Agent::\"<external_id>\" \u2192 named agent + its sessions\n // resource == AgentOps::Agent::\"<external_id>\" \u2192 named agent only (exact match)\n // resource in AgentOps::Account::\"<uuid>\" \u2192 org-wide\n // =========================================================================\n\n /// Account represents an organization (top-level tenant)\n entity Account;\n\n /// Project represents a project within an account\n entity Project in [Account];\n\n /// User represents a principal (human or service) making requests\n entity User;\n\n /// Agent represents an AI agent (Claude, Cursor, Copilot, MCP client, etc.)\n /// Used as both principal (who is acting) and resource (policy scoping target).\n /// Agent + sessions: resource in AgentOps::Agent::\"<external_id>\" (hierarchy match)\n /// Agent only: resource == AgentOps::Agent::\"<external_id>\" (exact match)\n entity Agent in [Project];\n\n /// App represents a protected application (guardrails-enabled LLM app)\n entity App in [Project];\n\n /// Session represents an agentic conversation session with state tracking.\n /// Sessions can belong to either an App or an Agent.\n entity Session in [App, Agent];\n\n // =========================================================================\n // Actions\n // =========================================================================\n\n /// Process user prompts and AI responses for security threats and content violations\n action \"process_prompt\" appliesTo {\n principal: [User, Agent],\n resource: [App, Agent, Session],\n context: ProcessPromptContext\n };\n\n /// Execute tool calls (shell, file operations, MCP tools)\n action \"call_tool\" appliesTo {\n principal: [User, Agent],\n resource: [Agent, Session],\n context: CallToolContext\n };\n\n /// Read file operations\n action \"read_file\" appliesTo {\n principal: [User, Agent],\n resource: [Agent, Session],\n context: FileReadContext\n };\n\n /// Write file operations\n action \"write_file\" appliesTo {\n principal: [User, Agent],\n resource: [Agent, Session],\n context: FileWriteContext\n };\n\n /// Connect to an MCP server\n action \"connect_server\" appliesTo {\n principal: [User, Agent],\n resource: [Agent, Session],\n context: ConnectServerContext\n };\n\n /// Provision a sandbox for the acting identity (Forge OS-layer envelope).\n /// The MANDATORY authorization gate for sandbox creation (ADR 0019 D1):\n /// Forge evaluates this action's AgentOps bundle at create-time; no decision\n /// means no sandbox. Context carries the requested capability envelope\n /// (writable paths, egress, exec allowlist, curated mechanism toggles,\n /// isolation tier). Raw syscalls are NEVER expressed here \u2014 the enforcement\n /// generators own the mechanism\u2192syscall translation (ADR 0017 D1).\n action \"provision_sandbox\" appliesTo {\n principal: [User, Agent],\n resource: [Agent, Session],\n context: ProvisionSandboxContext\n };\n\n // =========================================================================\n // Context Types (Action-Specific)\n // =========================================================================\n\n /// Context for process_prompt action (user prompts & AI responses)\n type ProcessPromptContext = {\n // Identity (AARM R6 / CAP-IDN-011) \u2014 projected from the principal's token; optional.\n \"role\"?: String,\n \"privilege_scope\"?: Set<String>,\n \"identity_type\"?: String, // Principal identity class: \"human\" | \"agent\" | \"service\" | \"mcp_server\"\n \"principal\"?: String, // Stable principal identifier (e.g. ZeroID / WIMSE URI or user id)\n // Core metadata (required)\n \"request_id\": String,\n \"timestamp\": Long,\n \"direction\": String, // \"input\" | \"output\"\n \"content_type\": String, // \"prompt\" | \"response\" | \"tool_call\" | \"file\"\n \"detector_count\": Long,\n\n // IDE / workspace context (optional \u2014 present for Overwatch/code-agent traffic)\n \"source\"?: String, // Traffic origin: \"ide\" | \"cli\" | \"api\" | \"browser\"\n \"event\"?: String, // Event type: \"prompt\" | \"tool_call\" | \"file_read\" | ...\n \"user_email\"?: String, // Human operator email (IDE sessions)\n \"cwd\"?: String, // Current working directory\n \"workspace_root\"?: String, // IDE workspace root path\n\n // Model context (optional \u2014 present for AI Gateway traffic)\n \"model_name\"?: String, // LLM model name: \"claude-3-5-sonnet\", \"gpt-4o\", ...\n \"model_provider\"?: String, // Model provider: \"anthropic\" | \"openai\" | \"google\" | ...\n\n // Security - Injection & Jailbreak (optional)\n \"injection_score\"?: Long, // Combined injection confidence: MAX(pulse, deep_context)\n \"jailbreak_score\"?: Long, // Combined jailbreak confidence: MAX(pulse, deep_context)\n \"injection_pulse_score\"?: Long, // 0-100 Pulse single-turn classifier\n \"injection_deep_context_score\"?: Long, // 0-100 DeepContext multi-turn\n \"jailbreak_pulse_score\"?: Long, // 0-100 Pulse single-turn classifier\n \"jailbreak_deep_context_score\"?: Long, // 0-100 DeepContext multi-turn\n \"injection_type\"?: String, // \"prompt\" | \"sql\" | \"command\" | \"none\"\n \"indirect_injection_score\"?: Long, // Indirect injection via tool outputs (0-100)\n\n // Privacy - Secrets (optional)\n \"secrets_detected\"?: Boolean,\n \"secret_count\"?: Long,\n \"secret_types\"?: Set<String>, // [\"aws_access_key\", \"github_token\", ...]\n\n // Privacy - PII (optional)\n \"pii_detected\"?: Boolean,\n \"pii_count\"?: Long,\n \"pii_types\"?: Set<String>, // [\"email\", \"phone\", \"ssn\", \"credit_card\", ...]\n \"pii_score\"?: Long, // PII ML classifier confidence (0-100)\n\n // Aggregated threat summary (optional \u2014 populated by aggregation detectors)\n \"highest_severity\"?: String, // \"critical\" | \"high\" | \"medium\" | \"low\" | \"none\"\n \"threat_count\"?: Long,\n \"threat_categories\"?: Set<String>,\n \"detected_threats\"?: Set<String>,\n\n // Trust & Safety - Toxicity (optional)\n \"violence_score\"?: Long, // 0-100\n \"hate_speech_score\"?: Long, // 0-100\n \"sexual_score\"?: Long, // 0-100\n \"weapons_score\"?: Long, // 0-100\n \"crime_score\"?: Long, // 0-100\n \"profanity_score\"?: Long, // 0-100\n\n // Semantic - Topic Classification (optional)\n \"content_topics\"?: Set<String>, // [\"controlled_substances\", \"weapons_manufacturing\", ...]\n \"topic_confidence\"?: Long, // 0-100\n\n // Security - Invisible Character Detection (optional)\n \"invisible_chars_detected\"?: Boolean,\n \"invisible_chars_score\"?: Long, // 0-100\n\n // Security - Pattern Detection (optional)\n \"command_injection_detected\"?: Boolean,\n \"command_injection_type\"?: String, // \"reverse_shell\" | \"privilege_escalation\" | ...\n \"command_injection_score\"?: Long, // 0-100\n \"path_traversal_detected\"?: Boolean,\n \"path_traversal_severity\"?: String, // \"critical\" | \"high\" | \"medium\" | \"low\" | \"none\"\n \"path_traversal_type\"?: String,\n \"sql_injection_detected\"?: Boolean,\n \"sql_injection_type\"?: String, // \"tautology\" | \"union_based\" | \"destructive\" | ...\n \"sql_injection_score\"?: Long, // 0-100\n\n // Security - Cross-Origin Escalation (optional)\n \"cross_origin_detected\"?: Boolean,\n \"cross_origin_type\"?: String, // \"cross_origin_tool\" | \"cross_origin_server\" | \"none\"\n \"cross_origin_score\"?: Long, // 0-100\n\n // Security - Encoded Injection (optional)\n \"encoded_content_detected\"?: Boolean,\n \"encoded_types\"?: Set<String>, // [\"base64\", \"hex\", \"unicode\", \"url\", ...]\n \"encoded_count\"?: Long,\n \"encoded_score\"?: Long, // 0-100\n\n // Language & Script Detection (optional)\n \"detected_language\"?: String, // ISO language code\n \"is_english\"?: Boolean,\n \"language_confidence\"?: Long, // 0-100\n \"detected_script\"?: String, // \"latin\" | \"cyrillic\" | \"arabic\" | \"unknown\" | ...\n \"is_latin_script\"?: Boolean,\n \"script_confidence\"?: Long, // 0-100\n\n // Content Analysis (optional)\n \"hallucination_score\"?: Long,\n \"factuality_score\"?: Long, // 0-100\n \"sentiment_score\"?: Long,\n \"contains_code\"?: Boolean,\n \"code_languages\"?: Set<String>,\n \"code_ratio\"?: Long, // 0-100\n \"keyword_matched\"?: Boolean,\n \"keyword_categories\"?: Set<String>,\n \"keyword_count\"?: Long,\n \"contains_non_ascii\"?: Boolean,\n \"phishing_detected\"?: Boolean,\n \"content_safety_score\"?: Long, // 0-100\n \"content_safety_blocked\"?: Boolean,\n\n // Agentic - Multi-Turn Context (optional)\n \"conversation_turn\"?: Long,\n \"multi_turn_detection\"?: Boolean,\n\n // Session Detection History \u2014 cross-turn sticky flags (optional)\n \"session_pii_detected\"?: Boolean,\n \"session_pii_types\"?: Set<String>,\n \"session_secrets_detected\"?: Boolean,\n \"session_secret_types\"?: Set<String>,\n \"session_injection_detected\"?: Boolean,\n \"session_command_injection\"?: Boolean,\n \"session_threat_turns\"?: Long,\n \"session_max_injection_score\"?: Long,\n \"session_max_jailbreak_score\"?: Long,\n \"session_max_command_injection_score\"?: Long,\n \"session_max_pii_score\"?: Long,\n \"session_max_secret_score\"?: Long,\n \"session_cumulative_risk_score\"?: Long,\n \"session_original_request\"?: String,\n \"session_max_sensitivity\"?: String,\n\n // Origin Surface \u2014 REQUIRED (ADR 0012 D14.2). Projected by Shield from the\n // ingress product; never user-supplied. The \"Applies to\" narrowing target:\n // policies test it with an ordinary condition (context.surface == \"ai_gateway\")\n // \u2014 no `has` guard needed precisely because it is required. Values are the\n // product identifiers: \"guardrails\" | \"overwatch\" | \"ai_gateway\" (\"sentry\"\n // joins at ADR 0012 D17 phase 2). A policy with no surface condition applies\n // to every surface, including ones added later (inclusive default).\n \"surface\": String,\n\n // Data-Flow Labels \u2014 per-value information-flow facts (ADR 0020, optional).\n // All optional: guard every access with `has` \u2014 an absent-attribute read is\n // a Cedar evaluation error and an errored forbid is silently skipped (fail-open).\n \"flow_confidentiality\"?: String, // \"public\" | \"internal\" | \"confidential\" | \"restricted\" | \"unknown\"\n \"flow_integrity\"?: String, // \"trusted\" | \"untrusted\" | \"mixed\" | \"unknown\"\n \"flow_data_types\"?: Set<String>, // \"pii\" | \"secrets\" | \"source_code\" | \"financial\" | \"health\" | ...\n \"flow_compartments\"?: Set<String>, // \"tenant:*\" | \"customer:*\" | \"project:*\"\n \"flow_resolution_status\"?: String, // \"known\" | \"inferred\" | \"unknown\" | \"conflicted\"\n \"flow_origins\"?: Set<String>, // \"mcp_tool_result\" | \"model\" | \"file\" | \"database\" | \"user\"\n \"flow_sink\"?: String, // \"external_model\" | \"local_model\" | \"external_mcp\" | \"trusted_mcp\" | \"user_secure_output\" | \"public_network\" | \"file\"\n \"flow_sink_is_external\"?: Boolean,\n \"flow_sink_effects\"?: Set<String>, // \"network.send\" | \"financial.transfer\" | \"filesystem.write\" | ...\n \"principal_clearances\"?: Set<String>, // ADR 0020 D8 \u2014 clearances AuthN mints for the principal\n \"principal_compartments\"?: Set<String>, // ADR 0020 D8 \u2014 compartments the principal is admitted to\n\n // Usage Budget \u2014 multi-window token & cost enforcement (optional)\n \"budget_remaining_pct\"?: Long,\n \"budget_exceeded\"?: Boolean,\n \"budget_cost_micros_this_turn\"?: Long,\n \"budget_model\"?: String,\n \"budget_tokens_pct_session\"?: Long,\n \"budget_tokens_pct_daily\"?: Long,\n \"budget_tokens_pct_monthly\"?: Long,\n \"budget_cost_pct_daily\"?: Long,\n \"budget_cost_pct_monthly\"?: Long,\n \"budget_exceeded_session\"?: Boolean,\n \"budget_exceeded_daily\"?: Boolean,\n \"budget_exceeded_monthly\"?: Boolean,\n\n // Rate Limiting \u2014 gateway-metered, Shield-decided (ADR 0014)\n \"rpm_remaining_pct\"?: Long,\n \"rpm_exceeded\"?: Boolean,\n \"tpm_remaining_pct\"?: Long,\n \"tpm_exceeded\"?: Boolean,\n\n // Agent Identity \u2014 authenticated agent principal metadata (optional)\n \"agent_id\"?: String,\n \"agent_type\"?: String, // \"orchestrator\" | \"autonomous\" | \"tool_agent\" | \"human_proxy\"\n \"agent_trust_level\"?: String, // \"first_party\" | \"verified_third_party\" | \"unverified\"\n \"agent_framework\"?: String,\n \"agent_publisher\"?: String,\n\n };\n\n /// Context for call_tool action (agentic tool execution)\n type CallToolContext = {\n // Identity (AARM R6 / CAP-IDN-011) \u2014 projected from the principal's token; optional.\n \"role\"?: String,\n \"privilege_scope\"?: Set<String>,\n \"identity_type\"?: String,\n \"principal\"?: String,\n // Core metadata (required)\n \"request_id\": String,\n \"timestamp\": Long,\n\n // IDE / workspace context (optional)\n \"source\"?: String,\n \"event\"?: String,\n \"user_email\"?: String,\n \"cwd\"?: String,\n \"workspace_root\"?: String,\n\n // Tool Risk (optional)\n \"tool_name\"?: String,\n \"tool_risk_score\"?: Long, // 0-100\n \"tool_is_sensitive\"?: Boolean,\n \"tool_category\"?: String, // \"safe\" | \"sensitive\" | \"dangerous\"\n \"tool_is_builtin\"?: Boolean,\n\n // AARM R3 (CAP-ENF-007) \u2014 Action Parameter Validation\n \"action_params\"?: {\n \"amount\"?: Long,\n \"count\"?: Long,\n \"command\"?: String,\n \"path\"?: String,\n \"url\"?: String,\n \"recipient\"?: String,\n \"target\"?: String,\n \"query\"?: String,\n },\n \"param_type_violation\"?: Boolean,\n \"param_type_violations\"?: Set<String>,\n\n // MCP context (optional)\n \"mcp_server\"?: String,\n \"mcp_tool\"?: String,\n \"mcp_server_verified\"?: Boolean,\n\n // Agentic - Behavioral Patterns (optional)\n \"suspicious_pattern\"?: Boolean,\n \"pattern_type\"?: String, // \"data_exfiltration\" | \"secret_exfiltration\" | ...\n \"sequence_risk\"?: Long, // 0-100\n\n // Agentic - Loop Detection (optional)\n \"loop_detected\"?: Boolean,\n \"loop_count\"?: Long,\n \"loop_tool\"?: String,\n\n // Security checks on tool arguments (optional)\n \"secrets_detected\"?: Boolean,\n \"secret_count\"?: Long,\n \"secret_types\"?: Set<String>,\n \"pii_detected\"?: Boolean,\n \"pii_types\"?: Set<String>,\n \"pii_count\"?: Long,\n \"pii_score\"?: Long,\n \"injection_score\"?: Long,\n \"injection_pulse_score\"?: Long,\n \"injection_deep_context_score\"?: Long,\n \"indirect_injection_score\"?: Long,\n \"indirect_injection_type\"?: String, // Type of indirect injection detected\n\n // Semantic - Topic Classification (optional)\n \"content_topics\"?: Set<String>, // [\"controlled_substances\", \"weapons_manufacturing\", ...]\n \"topic_confidence\"?: Long, // 0-100\n\n // Security - Pattern Detection (optional)\n \"command_injection_detected\"?: Boolean,\n \"command_injection_type\"?: String,\n \"command_injection_score\"?: Long,\n \"path_traversal_detected\"?: Boolean,\n \"path_traversal_severity\"?: String,\n \"path_traversal_type\"?: String,\n \"sql_injection_detected\"?: Boolean,\n \"sql_injection_type\"?: String,\n \"sql_injection_score\"?: Long,\n\n // Security - Cross-Origin Escalation (optional)\n \"cross_origin_detected\"?: Boolean,\n \"cross_origin_type\"?: String,\n \"cross_origin_score\"?: Long,\n\n // Security - Invisible Character Detection (optional)\n \"invisible_chars_detected\"?: Boolean,\n \"invisible_chars_score\"?: Long,\n\n // Security - Encoded Injection (optional)\n \"encoded_content_detected\"?: Boolean,\n \"encoded_types\"?: Set<String>,\n \"encoded_count\"?: Long,\n \"encoded_score\"?: Long,\n\n // Agentic - Agent Security (optional)\n \"tool_poisoning_detected\"?: Boolean,\n \"tool_poisoning_score\"?: Long,\n \"tool_poisoning_type\"?: String,\n \"rug_pull_detected\"?: Boolean,\n \"rug_pull_score\"?: Long,\n \"rug_pull_type\"?: String,\n\n // Agentic - MCP Risk (optional)\n \"mcp_config_risk\"?: Boolean,\n \"mcp_risk_type\"?: String,\n \"mcp_risk_score\"?: Long,\n\n // Tool Operation Classifier (optional)\n \"tool_operation_classes\"?: Set<String>,\n\n // Agentic - Multi-Turn Context (optional)\n \"conversation_turn\"?: Long,\n \"multi_turn_detection\"?: Boolean,\n\n // Session Detection History \u2014 cross-turn sticky flags (optional)\n \"session_pii_detected\"?: Boolean,\n \"session_pii_types\"?: Set<String>,\n \"session_secrets_detected\"?: Boolean,\n \"session_secret_types\"?: Set<String>,\n \"session_injection_detected\"?: Boolean,\n \"session_command_injection\"?: Boolean,\n \"session_threat_turns\"?: Long,\n \"session_max_injection_score\"?: Long,\n \"session_max_jailbreak_score\"?: Long,\n \"session_max_command_injection_score\"?: Long,\n \"session_max_pii_score\"?: Long,\n \"session_max_secret_score\"?: Long,\n \"session_cumulative_risk_score\"?: Long,\n \"session_original_request\"?: String,\n \"session_max_sensitivity\"?: String,\n\n // Origin Surface \u2014 REQUIRED (ADR 0012 D14.2). Projected by Shield from the\n // ingress product; never user-supplied. The \"Applies to\" narrowing target:\n // policies test it with an ordinary condition (context.surface == \"ai_gateway\")\n // \u2014 no `has` guard needed precisely because it is required. Values are the\n // product identifiers: \"guardrails\" | \"overwatch\" | \"ai_gateway\" (\"sentry\"\n // joins at ADR 0012 D17 phase 2). A policy with no surface condition applies\n // to every surface, including ones added later (inclusive default).\n \"surface\": String,\n\n // Data-Flow Labels \u2014 per-value information-flow facts (ADR 0020, optional).\n // All optional: guard every access with `has` \u2014 an absent-attribute read is\n // a Cedar evaluation error and an errored forbid is silently skipped (fail-open).\n \"flow_confidentiality\"?: String, // \"public\" | \"internal\" | \"confidential\" | \"restricted\" | \"unknown\"\n \"flow_integrity\"?: String, // \"trusted\" | \"untrusted\" | \"mixed\" | \"unknown\"\n \"flow_data_types\"?: Set<String>, // \"pii\" | \"secrets\" | \"source_code\" | \"financial\" | \"health\" | ...\n \"flow_compartments\"?: Set<String>, // \"tenant:*\" | \"customer:*\" | \"project:*\"\n \"flow_resolution_status\"?: String, // \"known\" | \"inferred\" | \"unknown\" | \"conflicted\"\n \"flow_origins\"?: Set<String>, // \"mcp_tool_result\" | \"model\" | \"file\" | \"database\" | \"user\"\n \"flow_sink\"?: String, // \"external_model\" | \"local_model\" | \"external_mcp\" | \"trusted_mcp\" | \"user_secure_output\" | \"public_network\" | \"file\"\n \"flow_sink_is_external\"?: Boolean,\n \"flow_sink_effects\"?: Set<String>, // \"network.send\" | \"financial.transfer\" | \"filesystem.write\" | ...\n \"principal_clearances\"?: Set<String>, // ADR 0020 D8 \u2014 clearances AuthN mints for the principal\n \"principal_compartments\"?: Set<String>, // ADR 0020 D8 \u2014 compartments the principal is admitted to\n\n // Usage Budget (optional)\n \"budget_remaining_pct\"?: Long,\n \"budget_exceeded\"?: Boolean,\n \"budget_cost_micros_this_turn\"?: Long,\n \"budget_model\"?: String,\n \"budget_tokens_pct_session\"?: Long,\n \"budget_tokens_pct_daily\"?: Long,\n \"budget_tokens_pct_monthly\"?: Long,\n \"budget_cost_pct_daily\"?: Long,\n \"budget_cost_pct_monthly\"?: Long,\n \"budget_exceeded_session\"?: Boolean,\n \"budget_exceeded_daily\"?: Boolean,\n \"budget_exceeded_monthly\"?: Boolean,\n\n // Rate Limiting \u2014 gateway-metered, Shield-decided (ADR 0014)\n \"rpm_remaining_pct\"?: Long,\n \"rpm_exceeded\"?: Boolean,\n \"tpm_remaining_pct\"?: Long,\n \"tpm_exceeded\"?: Boolean,\n\n // Aggregated threat summary (optional)\n \"highest_severity\"?: String,\n \"threat_count\"?: Long,\n \"detected_threats\"?: Set<String>,\n\n // Agent Identity (optional)\n \"agent_id\"?: String,\n \"agent_type\"?: String,\n \"agent_trust_level\"?: String,\n \"agent_framework\"?: String,\n \"agent_publisher\"?: String,\n\n // File & Path (optional)\n \"path\"?: String,\n\n };\n\n /// Context for read_file action\n type FileReadContext = {\n // Identity (optional)\n \"role\"?: String,\n \"privilege_scope\"?: Set<String>,\n \"identity_type\"?: String,\n \"principal\"?: String,\n // Core metadata (required)\n \"request_id\": String,\n \"timestamp\": Long,\n\n // IDE / workspace context (optional)\n \"source\"?: String,\n \"event\"?: String,\n \"user_email\"?: String,\n \"cwd\"?: String,\n \"workspace_root\"?: String,\n\n // File path (optional)\n \"path\"?: String,\n\n // Security checks on file content (optional)\n \"secrets_detected\"?: Boolean,\n \"secret_count\"?: Long,\n \"secret_types\"?: Set<String>,\n \"pii_detected\"?: Boolean,\n \"pii_types\"?: Set<String>,\n\n // Security - Path Traversal (optional)\n \"path_traversal_detected\"?: Boolean,\n \"path_traversal_severity\"?: String,\n \"path_traversal_type\"?: String,\n\n // Aggregated threat summary (optional)\n \"highest_severity\"?: String,\n \"threat_count\"?: Long,\n \"detected_threats\"?: Set<String>,\n\n // Session Detection History (optional)\n \"session_pii_detected\"?: Boolean,\n \"session_pii_types\"?: Set<String>,\n \"session_secrets_detected\"?: Boolean,\n \"session_secret_types\"?: Set<String>,\n \"session_injection_detected\"?: Boolean,\n \"session_command_injection\"?: Boolean,\n \"session_threat_turns\"?: Long,\n \"session_max_injection_score\"?: Long,\n \"session_max_jailbreak_score\"?: Long,\n \"session_max_command_injection_score\"?: Long,\n \"session_max_pii_score\"?: Long,\n \"session_max_secret_score\"?: Long,\n \"session_cumulative_risk_score\"?: Long,\n \"session_original_request\"?: String,\n \"session_max_sensitivity\"?: String,\n\n // Origin Surface \u2014 REQUIRED (ADR 0012 D14.2). Projected by Shield from the\n // ingress product; never user-supplied. The \"Applies to\" narrowing target:\n // policies test it with an ordinary condition (context.surface == \"ai_gateway\")\n // \u2014 no `has` guard needed precisely because it is required. Values are the\n // product identifiers: \"guardrails\" | \"overwatch\" | \"ai_gateway\" (\"sentry\"\n // joins at ADR 0012 D17 phase 2). A policy with no surface condition applies\n // to every surface, including ones added later (inclusive default).\n \"surface\": String,\n\n // Data-Flow Labels \u2014 per-value information-flow facts (ADR 0020, optional).\n // All optional: guard every access with `has` \u2014 an absent-attribute read is\n // a Cedar evaluation error and an errored forbid is silently skipped (fail-open).\n \"flow_confidentiality\"?: String, // \"public\" | \"internal\" | \"confidential\" | \"restricted\" | \"unknown\"\n \"flow_integrity\"?: String, // \"trusted\" | \"untrusted\" | \"mixed\" | \"unknown\"\n \"flow_data_types\"?: Set<String>, // \"pii\" | \"secrets\" | \"source_code\" | \"financial\" | \"health\" | ...\n \"flow_compartments\"?: Set<String>, // \"tenant:*\" | \"customer:*\" | \"project:*\"\n \"flow_resolution_status\"?: String, // \"known\" | \"inferred\" | \"unknown\" | \"conflicted\"\n \"flow_origins\"?: Set<String>, // \"mcp_tool_result\" | \"model\" | \"file\" | \"database\" | \"user\"\n \"flow_sink\"?: String, // \"external_model\" | \"local_model\" | \"external_mcp\" | \"trusted_mcp\" | \"user_secure_output\" | \"public_network\" | \"file\"\n \"flow_sink_is_external\"?: Boolean,\n \"flow_sink_effects\"?: Set<String>, // \"network.send\" | \"financial.transfer\" | \"filesystem.write\" | ...\n \"principal_clearances\"?: Set<String>, // ADR 0020 D8 \u2014 clearances AuthN mints for the principal\n \"principal_compartments\"?: Set<String>, // ADR 0020 D8 \u2014 compartments the principal is admitted to\n\n // Usage Budget (optional)\n \"budget_remaining_pct\"?: Long,\n \"budget_exceeded\"?: Boolean,\n \"budget_cost_micros_this_turn\"?: Long,\n \"budget_model\"?: String,\n \"budget_tokens_pct_session\"?: Long,\n \"budget_tokens_pct_daily\"?: Long,\n \"budget_tokens_pct_monthly\"?: Long,\n \"budget_cost_pct_daily\"?: Long,\n \"budget_cost_pct_monthly\"?: Long,\n \"budget_exceeded_session\"?: Boolean,\n \"budget_exceeded_daily\"?: Boolean,\n \"budget_exceeded_monthly\"?: Boolean,\n\n // Rate Limiting \u2014 gateway-metered, Shield-decided (ADR 0014)\n \"rpm_remaining_pct\"?: Long,\n \"rpm_exceeded\"?: Boolean,\n \"tpm_remaining_pct\"?: Long,\n \"tpm_exceeded\"?: Boolean,\n\n // Agent Identity (optional)\n \"agent_id\"?: String,\n \"agent_type\"?: String,\n \"agent_trust_level\"?: String,\n \"agent_framework\"?: String,\n \"agent_publisher\"?: String,\n\n };\n\n /// Context for write_file action\n type FileWriteContext = {\n // Identity (optional)\n \"role\"?: String,\n \"privilege_scope\"?: Set<String>,\n \"identity_type\"?: String,\n \"principal\"?: String,\n // Core metadata (required)\n \"request_id\": String,\n \"timestamp\": Long,\n\n // IDE / workspace context (optional)\n \"source\"?: String,\n \"event\"?: String,\n \"user_email\"?: String,\n \"cwd\"?: String,\n \"workspace_root\"?: String,\n\n // File path (optional)\n \"path\"?: String,\n\n // Security - Invisible Character Detection in write content (optional)\n \"invisible_chars_detected\"?: Boolean,\n \"invisible_chars_score\"?: Long,\n\n // Security checks on content being written (optional)\n \"secrets_detected\"?: Boolean,\n \"secret_count\"?: Long,\n \"secret_types\"?: Set<String>,\n \"pii_detected\"?: Boolean,\n \"pii_types\"?: Set<String>,\n\n // Security - Path Traversal (optional)\n \"path_traversal_detected\"?: Boolean,\n \"path_traversal_severity\"?: String,\n \"path_traversal_type\"?: String,\n\n // Aggregated threat summary (optional)\n \"highest_severity\"?: String,\n \"threat_count\"?: Long,\n \"detected_threats\"?: Set<String>,\n\n // Session Detection History (optional)\n \"session_pii_detected\"?: Boolean,\n \"session_pii_types\"?: Set<String>,\n \"session_secrets_detected\"?: Boolean,\n \"session_secret_types\"?: Set<String>,\n \"session_injection_detected\"?: Boolean,\n \"session_command_injection\"?: Boolean,\n \"session_threat_turns\"?: Long,\n \"session_max_injection_score\"?: Long,\n \"session_max_jailbreak_score\"?: Long,\n \"session_max_command_injection_score\"?: Long,\n \"session_max_pii_score\"?: Long,\n \"session_max_secret_score\"?: Long,\n \"session_cumulative_risk_score\"?: Long,\n \"session_original_request\"?: String,\n \"session_max_sensitivity\"?: String,\n\n // Origin Surface \u2014 REQUIRED (ADR 0012 D14.2). Projected by Shield from the\n // ingress product; never user-supplied. The \"Applies to\" narrowing target:\n // policies test it with an ordinary condition (context.surface == \"ai_gateway\")\n // \u2014 no `has` guard needed precisely because it is required. Values are the\n // product identifiers: \"guardrails\" | \"overwatch\" | \"ai_gateway\" (\"sentry\"\n // joins at ADR 0012 D17 phase 2). A policy with no surface condition applies\n // to every surface, including ones added later (inclusive default).\n \"surface\": String,\n\n // Data-Flow Labels \u2014 per-value information-flow facts (ADR 0020, optional).\n // All optional: guard every access with `has` \u2014 an absent-attribute read is\n // a Cedar evaluation error and an errored forbid is silently skipped (fail-open).\n \"flow_confidentiality\"?: String, // \"public\" | \"internal\" | \"confidential\" | \"restricted\" | \"unknown\"\n \"flow_integrity\"?: String, // \"trusted\" | \"untrusted\" | \"mixed\" | \"unknown\"\n \"flow_data_types\"?: Set<String>, // \"pii\" | \"secrets\" | \"source_code\" | \"financial\" | \"health\" | ...\n \"flow_compartments\"?: Set<String>, // \"tenant:*\" | \"customer:*\" | \"project:*\"\n \"flow_resolution_status\"?: String, // \"known\" | \"inferred\" | \"unknown\" | \"conflicted\"\n \"flow_origins\"?: Set<String>, // \"mcp_tool_result\" | \"model\" | \"file\" | \"database\" | \"user\"\n \"flow_sink\"?: String, // \"external_model\" | \"local_model\" | \"external_mcp\" | \"trusted_mcp\" | \"user_secure_output\" | \"public_network\" | \"file\"\n \"flow_sink_is_external\"?: Boolean,\n \"flow_sink_effects\"?: Set<String>, // \"network.send\" | \"financial.transfer\" | \"filesystem.write\" | ...\n \"principal_clearances\"?: Set<String>, // ADR 0020 D8 \u2014 clearances AuthN mints for the principal\n \"principal_compartments\"?: Set<String>, // ADR 0020 D8 \u2014 compartments the principal is admitted to\n\n // Usage Budget (optional)\n \"budget_remaining_pct\"?: Long,\n \"budget_exceeded\"?: Boolean,\n \"budget_cost_micros_this_turn\"?: Long,\n \"budget_model\"?: String,\n \"budget_tokens_pct_session\"?: Long,\n \"budget_tokens_pct_daily\"?: Long,\n \"budget_tokens_pct_monthly\"?: Long,\n \"budget_cost_pct_daily\"?: Long,\n \"budget_cost_pct_monthly\"?: Long,\n \"budget_exceeded_session\"?: Boolean,\n \"budget_exceeded_daily\"?: Boolean,\n \"budget_exceeded_monthly\"?: Boolean,\n\n // Rate Limiting \u2014 gateway-metered, Shield-decided (ADR 0014)\n \"rpm_remaining_pct\"?: Long,\n \"rpm_exceeded\"?: Boolean,\n \"tpm_remaining_pct\"?: Long,\n \"tpm_exceeded\"?: Boolean,\n\n // Agent Identity (optional)\n \"agent_id\"?: String,\n \"agent_type\"?: String,\n \"agent_trust_level\"?: String,\n \"agent_framework\"?: String,\n \"agent_publisher\"?: String,\n\n };\n\n /// Context for connect_server action (MCP server connections)\n type ConnectServerContext = {\n // Identity (optional)\n \"role\"?: String,\n \"privilege_scope\"?: Set<String>,\n \"identity_type\"?: String,\n \"principal\"?: String,\n // Core metadata (required)\n \"request_id\": String,\n \"timestamp\": Long,\n\n // IDE / workspace context (optional)\n \"source\"?: String,\n \"event\"?: String,\n \"user_email\"?: String,\n \"cwd\"?: String,\n \"workspace_root\"?: String,\n\n // MCP context (optional)\n \"mcp_server\"?: String,\n \"mcp_server_verified\"?: Boolean,\n\n // Agentic - Agent Security (optional)\n \"tool_poisoning_detected\"?: Boolean,\n \"tool_poisoning_score\"?: Long,\n \"tool_poisoning_type\"?: String,\n\n // Agentic - MCP Risk (optional)\n \"mcp_config_risk\"?: Boolean,\n \"mcp_risk_type\"?: String,\n \"mcp_risk_score\"?: Long,\n\n // Security - Cross-Origin Escalation (optional)\n \"cross_origin_detected\"?: Boolean,\n \"cross_origin_type\"?: String,\n \"cross_origin_score\"?: Long,\n\n // Aggregated threat summary (optional)\n \"highest_severity\"?: String,\n \"threat_count\"?: Long,\n \"detected_threats\"?: Set<String>,\n\n // Session Detection History (optional)\n \"session_pii_detected\"?: Boolean,\n \"session_pii_types\"?: Set<String>,\n \"session_secrets_detected\"?: Boolean,\n \"session_secret_types\"?: Set<String>,\n \"session_injection_detected\"?: Boolean,\n \"session_command_injection\"?: Boolean,\n \"session_threat_turns\"?: Long,\n \"session_max_injection_score\"?: Long,\n \"session_max_jailbreak_score\"?: Long,\n \"session_max_command_injection_score\"?: Long,\n \"session_max_pii_score\"?: Long,\n \"session_max_secret_score\"?: Long,\n \"session_cumulative_risk_score\"?: Long,\n \"session_original_request\"?: String,\n \"session_max_sensitivity\"?: String,\n\n // Origin Surface \u2014 REQUIRED (ADR 0012 D14.2). Projected by Shield from the\n // ingress product; never user-supplied. The \"Applies to\" narrowing target:\n // policies test it with an ordinary condition (context.surface == \"ai_gateway\")\n // \u2014 no `has` guard needed precisely because it is required. Values are the\n // product identifiers: \"guardrails\" | \"overwatch\" | \"ai_gateway\" (\"sentry\"\n // joins at ADR 0012 D17 phase 2). A policy with no surface condition applies\n // to every surface, including ones added later (inclusive default).\n \"surface\": String,\n\n // Data-Flow Labels \u2014 per-value information-flow facts (ADR 0020, optional).\n // All optional: guard every access with `has` \u2014 an absent-attribute read is\n // a Cedar evaluation error and an errored forbid is silently skipped (fail-open).\n \"flow_confidentiality\"?: String, // \"public\" | \"internal\" | \"confidential\" | \"restricted\" | \"unknown\"\n \"flow_integrity\"?: String, // \"trusted\" | \"untrusted\" | \"mixed\" | \"unknown\"\n \"flow_data_types\"?: Set<String>, // \"pii\" | \"secrets\" | \"source_code\" | \"financial\" | \"health\" | ...\n \"flow_compartments\"?: Set<String>, // \"tenant:*\" | \"customer:*\" | \"project:*\"\n \"flow_resolution_status\"?: String, // \"known\" | \"inferred\" | \"unknown\" | \"conflicted\"\n \"flow_origins\"?: Set<String>, // \"mcp_tool_result\" | \"model\" | \"file\" | \"database\" | \"user\"\n \"flow_sink\"?: String, // \"external_model\" | \"local_model\" | \"external_mcp\" | \"trusted_mcp\" | \"user_secure_output\" | \"public_network\" | \"file\"\n \"flow_sink_is_external\"?: Boolean,\n \"flow_sink_effects\"?: Set<String>, // \"network.send\" | \"financial.transfer\" | \"filesystem.write\" | ...\n \"principal_clearances\"?: Set<String>, // ADR 0020 D8 \u2014 clearances AuthN mints for the principal\n \"principal_compartments\"?: Set<String>, // ADR 0020 D8 \u2014 compartments the principal is admitted to\n\n // Usage Budget (optional)\n \"budget_remaining_pct\"?: Long,\n \"budget_exceeded\"?: Boolean,\n \"budget_cost_micros_this_turn\"?: Long,\n \"budget_model\"?: String,\n \"budget_tokens_pct_session\"?: Long,\n \"budget_tokens_pct_daily\"?: Long,\n \"budget_tokens_pct_monthly\"?: Long,\n \"budget_cost_pct_daily\"?: Long,\n \"budget_cost_pct_monthly\"?: Long,\n \"budget_exceeded_session\"?: Boolean,\n \"budget_exceeded_daily\"?: Boolean,\n \"budget_exceeded_monthly\"?: Boolean,\n\n // Rate Limiting \u2014 gateway-metered, Shield-decided (ADR 0014)\n \"rpm_remaining_pct\"?: Long,\n \"rpm_exceeded\"?: Boolean,\n \"tpm_remaining_pct\"?: Long,\n \"tpm_exceeded\"?: Boolean,\n\n // Agent Identity (optional)\n \"agent_id\"?: String,\n \"agent_type\"?: String,\n \"agent_trust_level\"?: String,\n \"agent_framework\"?: String,\n \"agent_publisher\"?: String,\n\n };\n\n /// Context for provision_sandbox action (Forge sandbox-create envelope).\n ///\n /// Every capability field below is OPTIONAL and describes the envelope the\n /// sandbox is being asked to provision with \u2014 Forge synthesizes it from the\n /// create request attenuated by the token's scope ceiling (ADR 0019 D1),\n /// then asks Cedar whether this identity may provision it. Profile templates\n /// `permit` provision_sandbox only when the requested envelope stays within\n /// the profile ceiling, and `forbid` any escalation beyond it.\n ///\n /// FAIL-OPEN WARNING (ADR 0019 D3): because these attributes are optional,\n /// accessing an absent one is a Cedar *evaluation error*, and an errored\n /// `forbid` is silently skipped \u2014 which fails OPEN. Every rule touching a\n /// field here MUST guard it first with `has` (e.g.\n /// `context has mechanism_capabilities && context.mechanism_capabilities.contains(\"sys:ptrace\")`).\n type ProvisionSandboxContext = {\n // Identity (AARM R6 / CAP-IDN-011) \u2014 projected from the principal's token; optional.\n \"role\"?: String,\n \"privilege_scope\"?: Set<String>,\n \"identity_type\"?: String, // Principal identity class: \"human\" | \"agent\" | \"service\" | \"mcp_server\"\n \"principal\"?: String, // Stable principal identifier (ZeroID / WIMSE URI or user id)\n \"agent_trust_level\"?: String, // \"untrusted\" | \"low\" | \"verified\" | \"trusted\"\n\n // Core metadata (required)\n \"request_id\": String,\n \"timestamp\": Long,\n\n // Requested isolation tier (required) \u2014 the OS-isolation tier the\n // sandbox will run at, as the lowercased Forge IsolationTier name (ADR\n // 0016 D1). Ordinal, weakest\u2192strongest: \"none\" (trusted-local) < \"os\"\n // (bwrap/seatbelt) < \"kernel\" (gVisor) < \"hardware\" (micro-VM + TEE).\n // Templates assert a floor via set membership (e.g. a KERNEL floor =\n // {\"kernel\",\"hardware\"}); Forge owns the ordering.\n \"isolation_tier\": String,\n\n // Requested capability envelope (all optional \u2014 has-guard mandatory).\n \"writable_paths\"?: Set<String>, // Writable path prefixes, e.g. {\"/scratch\"}\n // Master egress switch. Forge MUST set this true whenever ANY egress is\n // requested (i.e. whenever egress_hosts is non-empty), so a \"no network\"\n // profile can gate on this single boolean. egress_hosts then narrows the\n // host allowlist for profiles that DO permit egress.\n \"network_egress\"?: Boolean,\n \"egress_hosts\"?: Set<String>, // Host allowlist for egress, e.g. {\"pypi.org\"}\n \"exec_allowlist\"?: Set<String>, // Executables the sandbox may run, e.g. {\"python\", \"python3\"}\n // Curated mechanism toggles (ADR 0017 D1.3) \u2014 authorization facts only;\n // NEVER raw syscalls. Allowed members: \"sys:ptrace\", \"sys:bpf\",\n // \"sys:raw_socket\", \"dev:gpu\", \"virt:nested\".\n \"mechanism_capabilities\"?: Set<String>,\n };\n}\n";
7
7
  /**
8
8
  * AiGateway Cedar schema
9
9
  *
@@ -264,6 +264,15 @@ namespace AgentOps {
264
264
  "session_original_request"?: String,
265
265
  "session_max_sensitivity"?: String,
266
266
 
267
+ // Origin Surface — REQUIRED (ADR 0012 D14.2). Projected by Shield from the
268
+ // ingress product; never user-supplied. The "Applies to" narrowing target:
269
+ // policies test it with an ordinary condition (context.surface == "ai_gateway")
270
+ // — no \`has\` guard needed precisely because it is required. Values are the
271
+ // product identifiers: "guardrails" | "overwatch" | "ai_gateway" ("sentry"
272
+ // joins at ADR 0012 D17 phase 2). A policy with no surface condition applies
273
+ // to every surface, including ones added later (inclusive default).
274
+ "surface": String,
275
+
267
276
  // Data-Flow Labels — per-value information-flow facts (ADR 0020, optional).
268
277
  // All optional: guard every access with \`has\` — an absent-attribute read is
269
278
  // a Cedar evaluation error and an errored forbid is silently skipped (fail-open).
@@ -443,6 +452,15 @@ namespace AgentOps {
443
452
  "session_original_request"?: String,
444
453
  "session_max_sensitivity"?: String,
445
454
 
455
+ // Origin Surface — REQUIRED (ADR 0012 D14.2). Projected by Shield from the
456
+ // ingress product; never user-supplied. The "Applies to" narrowing target:
457
+ // policies test it with an ordinary condition (context.surface == "ai_gateway")
458
+ // — no \`has\` guard needed precisely because it is required. Values are the
459
+ // product identifiers: "guardrails" | "overwatch" | "ai_gateway" ("sentry"
460
+ // joins at ADR 0012 D17 phase 2). A policy with no surface condition applies
461
+ // to every surface, including ones added later (inclusive default).
462
+ "surface": String,
463
+
446
464
  // Data-Flow Labels — per-value information-flow facts (ADR 0020, optional).
447
465
  // All optional: guard every access with \`has\` — an absent-attribute read is
448
466
  // a Cedar evaluation error and an errored forbid is silently skipped (fail-open).
@@ -550,6 +568,15 @@ namespace AgentOps {
550
568
  "session_original_request"?: String,
551
569
  "session_max_sensitivity"?: String,
552
570
 
571
+ // Origin Surface — REQUIRED (ADR 0012 D14.2). Projected by Shield from the
572
+ // ingress product; never user-supplied. The "Applies to" narrowing target:
573
+ // policies test it with an ordinary condition (context.surface == "ai_gateway")
574
+ // — no \`has\` guard needed precisely because it is required. Values are the
575
+ // product identifiers: "guardrails" | "overwatch" | "ai_gateway" ("sentry"
576
+ // joins at ADR 0012 D17 phase 2). A policy with no surface condition applies
577
+ // to every surface, including ones added later (inclusive default).
578
+ "surface": String,
579
+
553
580
  // Data-Flow Labels — per-value information-flow facts (ADR 0020, optional).
554
581
  // All optional: guard every access with \`has\` — an absent-attribute read is
555
582
  // a Cedar evaluation error and an errored forbid is silently skipped (fail-open).
@@ -653,6 +680,15 @@ namespace AgentOps {
653
680
  "session_original_request"?: String,
654
681
  "session_max_sensitivity"?: String,
655
682
 
683
+ // Origin Surface — REQUIRED (ADR 0012 D14.2). Projected by Shield from the
684
+ // ingress product; never user-supplied. The "Applies to" narrowing target:
685
+ // policies test it with an ordinary condition (context.surface == "ai_gateway")
686
+ // — no \`has\` guard needed precisely because it is required. Values are the
687
+ // product identifiers: "guardrails" | "overwatch" | "ai_gateway" ("sentry"
688
+ // joins at ADR 0012 D17 phase 2). A policy with no surface condition applies
689
+ // to every surface, including ones added later (inclusive default).
690
+ "surface": String,
691
+
656
692
  // Data-Flow Labels — per-value information-flow facts (ADR 0020, optional).
657
693
  // All optional: guard every access with \`has\` — an absent-attribute read is
658
694
  // a Cedar evaluation error and an errored forbid is silently skipped (fail-open).
@@ -756,6 +792,15 @@ namespace AgentOps {
756
792
  "session_original_request"?: String,
757
793
  "session_max_sensitivity"?: String,
758
794
 
795
+ // Origin Surface — REQUIRED (ADR 0012 D14.2). Projected by Shield from the
796
+ // ingress product; never user-supplied. The "Applies to" narrowing target:
797
+ // policies test it with an ordinary condition (context.surface == "ai_gateway")
798
+ // — no \`has\` guard needed precisely because it is required. Values are the
799
+ // product identifiers: "guardrails" | "overwatch" | "ai_gateway" ("sentry"
800
+ // joins at ADR 0012 D17 phase 2). A policy with no surface condition applies
801
+ // to every surface, including ones added later (inclusive default).
802
+ "surface": String,
803
+
759
804
  // Data-Flow Labels — per-value information-flow facts (ADR 0020, optional).
760
805
  // All optional: guard every access with \`has\` — an absent-attribute read is
761
806
  // a Cedar evaluation error and an errored forbid is silently skipped (fail-open).
@@ -3141,7 +3186,8 @@ export const AGENT_OPS_CONTEXT = {
3141
3186
  { "key": "flow_sink_is_external", "type": "boolean", "required": false, "description": "Whether the destination is outside the tenant trust boundary (ADR 0020). Lets a single policy express \'confidential data MUST NOT leave to any external sink\' without enumerating sink ids." },
3142
3187
  { "key": "flow_sink_effects", "type": "array", "required": false, "description": "Side effects the destination can exercise (ADR 0020), e.g. \'network.send\', \'financial.transfer\', \'filesystem.write\'. Enables \'untrusted content MUST NOT reach a financial.transfer sink\'. Set<String>." },
3143
3188
  { "key": "principal_clearances", "type": "array", "required": false, "description": "Clearances AuthN/ZeroID mints for the principal (ADR 0020 D8), e.g. \'restricted\', \'pii\'. Coarse scopes gate the capability; clearances gate which protected data that capability may touch. Set<String>." },
3144
- { "key": "principal_compartments", "type": "array", "required": false, "description": "Compartments the principal is admitted to (ADR 0020 D8), e.g. \'tenant:acme\', \'customer:123\'. A flow into a compartment the principal lacks is deniable independent of confidentiality tier. Set<String>." }
3189
+ { "key": "principal_compartments", "type": "array", "required": false, "description": "Compartments the principal is admitted to (ADR 0020 D8), e.g. \'tenant:acme\', \'customer:123\'. A flow into a compartment the principal lacks is deniable independent of confidentiality tier. Set<String>." },
3190
+ { "key": "surface", "type": "string", "required": true, "description": "Origin surface of the request (ADR 0012 D14.2) — REQUIRED; projected by Shield from the ingress product, never user-supplied. Values are the product identifiers: \'guardrails\', \'overwatch\', \'ai_gateway\' (\'sentry\' joins at D17 phase 2). The \'Applies to\' narrowing target: test with an ordinary condition (context.surface == \'ai_gateway\'); no \'has\' guard needed because it is required. A policy with no surface condition applies to every surface, including ones added later." }
3145
3191
  ]
3146
3192
  },
3147
3193
  {
@@ -3259,7 +3305,8 @@ export const AGENT_OPS_CONTEXT = {
3259
3305
  { "key": "flow_sink_is_external", "type": "boolean", "required": false, "description": "Whether the destination is outside the tenant trust boundary (ADR 0020). Lets a single policy express \'confidential data MUST NOT leave to any external sink\' without enumerating sink ids." },
3260
3306
  { "key": "flow_sink_effects", "type": "array", "required": false, "description": "Side effects the destination can exercise (ADR 0020), e.g. \'network.send\', \'financial.transfer\', \'filesystem.write\'. Enables \'untrusted content MUST NOT reach a financial.transfer sink\'. Set<String>." },
3261
3307
  { "key": "principal_clearances", "type": "array", "required": false, "description": "Clearances AuthN/ZeroID mints for the principal (ADR 0020 D8), e.g. \'restricted\', \'pii\'. Coarse scopes gate the capability; clearances gate which protected data that capability may touch. Set<String>." },
3262
- { "key": "principal_compartments", "type": "array", "required": false, "description": "Compartments the principal is admitted to (ADR 0020 D8), e.g. \'tenant:acme\', \'customer:123\'. A flow into a compartment the principal lacks is deniable independent of confidentiality tier. Set<String>." }
3308
+ { "key": "principal_compartments", "type": "array", "required": false, "description": "Compartments the principal is admitted to (ADR 0020 D8), e.g. \'tenant:acme\', \'customer:123\'. A flow into a compartment the principal lacks is deniable independent of confidentiality tier. Set<String>." },
3309
+ { "key": "surface", "type": "string", "required": true, "description": "Origin surface of the request (ADR 0012 D14.2) — REQUIRED; projected by Shield from the ingress product, never user-supplied. Values are the product identifiers: \'guardrails\', \'overwatch\', \'ai_gateway\' (\'sentry\' joins at D17 phase 2). The \'Applies to\' narrowing target: test with an ordinary condition (context.surface == \'ai_gateway\'); no \'has\' guard needed because it is required. A policy with no surface condition applies to every surface, including ones added later." }
3263
3310
  ]
3264
3311
  },
3265
3312
  {
@@ -3325,7 +3372,8 @@ export const AGENT_OPS_CONTEXT = {
3325
3372
  { "key": "flow_sink_is_external", "type": "boolean", "required": false, "description": "Whether the destination is outside the tenant trust boundary (ADR 0020). Lets a single policy express \'confidential data MUST NOT leave to any external sink\' without enumerating sink ids." },
3326
3373
  { "key": "flow_sink_effects", "type": "array", "required": false, "description": "Side effects the destination can exercise (ADR 0020), e.g. \'network.send\', \'financial.transfer\', \'filesystem.write\'. Enables \'untrusted content MUST NOT reach a financial.transfer sink\'. Set<String>." },
3327
3374
  { "key": "principal_clearances", "type": "array", "required": false, "description": "Clearances AuthN/ZeroID mints for the principal (ADR 0020 D8), e.g. \'restricted\', \'pii\'. Coarse scopes gate the capability; clearances gate which protected data that capability may touch. Set<String>." },
3328
- { "key": "principal_compartments", "type": "array", "required": false, "description": "Compartments the principal is admitted to (ADR 0020 D8), e.g. \'tenant:acme\', \'customer:123\'. A flow into a compartment the principal lacks is deniable independent of confidentiality tier. Set<String>." }
3375
+ { "key": "principal_compartments", "type": "array", "required": false, "description": "Compartments the principal is admitted to (ADR 0020 D8), e.g. \'tenant:acme\', \'customer:123\'. A flow into a compartment the principal lacks is deniable independent of confidentiality tier. Set<String>." },
3376
+ { "key": "surface", "type": "string", "required": true, "description": "Origin surface of the request (ADR 0012 D14.2) — REQUIRED; projected by Shield from the ingress product, never user-supplied. Values are the product identifiers: \'guardrails\', \'overwatch\', \'ai_gateway\' (\'sentry\' joins at D17 phase 2). The \'Applies to\' narrowing target: test with an ordinary condition (context.surface == \'ai_gateway\'); no \'has\' guard needed because it is required. A policy with no surface condition applies to every surface, including ones added later." }
3329
3377
  ]
3330
3378
  },
3331
3379
  {
@@ -3393,7 +3441,8 @@ export const AGENT_OPS_CONTEXT = {
3393
3441
  { "key": "flow_sink_is_external", "type": "boolean", "required": false, "description": "Whether the destination is outside the tenant trust boundary (ADR 0020). Lets a single policy express \'confidential data MUST NOT leave to any external sink\' without enumerating sink ids." },
3394
3442
  { "key": "flow_sink_effects", "type": "array", "required": false, "description": "Side effects the destination can exercise (ADR 0020), e.g. \'network.send\', \'financial.transfer\', \'filesystem.write\'. Enables \'untrusted content MUST NOT reach a financial.transfer sink\'. Set<String>." },
3395
3443
  { "key": "principal_clearances", "type": "array", "required": false, "description": "Clearances AuthN/ZeroID mints for the principal (ADR 0020 D8), e.g. \'restricted\', \'pii\'. Coarse scopes gate the capability; clearances gate which protected data that capability may touch. Set<String>." },
3396
- { "key": "principal_compartments", "type": "array", "required": false, "description": "Compartments the principal is admitted to (ADR 0020 D8), e.g. \'tenant:acme\', \'customer:123\'. A flow into a compartment the principal lacks is deniable independent of confidentiality tier. Set<String>." }
3444
+ { "key": "principal_compartments", "type": "array", "required": false, "description": "Compartments the principal is admitted to (ADR 0020 D8), e.g. \'tenant:acme\', \'customer:123\'. A flow into a compartment the principal lacks is deniable independent of confidentiality tier. Set<String>." },
3445
+ { "key": "surface", "type": "string", "required": true, "description": "Origin surface of the request (ADR 0012 D14.2) — REQUIRED; projected by Shield from the ingress product, never user-supplied. Values are the product identifiers: \'guardrails\', \'overwatch\', \'ai_gateway\' (\'sentry\' joins at D17 phase 2). The \'Applies to\' narrowing target: test with an ordinary condition (context.surface == \'ai_gateway\'); no \'has\' guard needed because it is required. A policy with no surface condition applies to every surface, including ones added later." }
3397
3446
  ]
3398
3447
  },
3399
3448
  {
@@ -3461,7 +3510,8 @@ export const AGENT_OPS_CONTEXT = {
3461
3510
  { "key": "flow_sink_is_external", "type": "boolean", "required": false, "description": "Whether the destination is outside the tenant trust boundary (ADR 0020). Lets a single policy express \'confidential data MUST NOT leave to any external sink\' without enumerating sink ids." },
3462
3511
  { "key": "flow_sink_effects", "type": "array", "required": false, "description": "Side effects the destination can exercise (ADR 0020), e.g. \'network.send\', \'financial.transfer\', \'filesystem.write\'. Enables \'untrusted content MUST NOT reach a financial.transfer sink\'. Set<String>." },
3463
3512
  { "key": "principal_clearances", "type": "array", "required": false, "description": "Clearances AuthN/ZeroID mints for the principal (ADR 0020 D8), e.g. \'restricted\', \'pii\'. Coarse scopes gate the capability; clearances gate which protected data that capability may touch. Set<String>." },
3464
- { "key": "principal_compartments", "type": "array", "required": false, "description": "Compartments the principal is admitted to (ADR 0020 D8), e.g. \'tenant:acme\', \'customer:123\'. A flow into a compartment the principal lacks is deniable independent of confidentiality tier. Set<String>." }
3513
+ { "key": "principal_compartments", "type": "array", "required": false, "description": "Compartments the principal is admitted to (ADR 0020 D8), e.g. \'tenant:acme\', \'customer:123\'. A flow into a compartment the principal lacks is deniable independent of confidentiality tier. Set<String>." },
3514
+ { "key": "surface", "type": "string", "required": true, "description": "Origin surface of the request (ADR 0012 D14.2) — REQUIRED; projected by Shield from the ingress product, never user-supplied. Values are the product identifiers: \'guardrails\', \'overwatch\', \'ai_gateway\' (\'sentry\' joins at D17 phase 2). The \'Applies to\' narrowing target: test with an ordinary condition (context.surface == \'ai_gateway\'); no \'has\' guard needed because it is required. A policy with no surface condition applies to every surface, including ones added later." }
3465
3515
  ]
3466
3516
  },
3467
3517
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highflame/policy",
3
- "version": "2.2.28",
3
+ "version": "2.2.29",
4
4
  "engines": {
5
5
  "node": ">=18"
6
6
  },