@highflame/policy 1.1.3 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Parser unit tests
3
+ *
4
+ * Tests the Cedar text → PolicyRule conversion using the official Cedar engine.
5
+ * These tests demonstrate how a client like highflame-authz would use the parser.
6
+ */
7
+ import { describe, it, expect } from 'vitest';
8
+ import { parseCedarToRules } from './parser.js';
9
+ describe('parseCedarToRules', () => {
10
+ it('should parse a simple permit policy', () => {
11
+ const cedarText = `
12
+ @id("allow-read-files")
13
+ permit(
14
+ principal is User,
15
+ action == Action::"read_file",
16
+ resource is FilePath
17
+ );
18
+ `;
19
+ const result = parseCedarToRules(cedarText);
20
+ expect(result.errors).toHaveLength(0);
21
+ expect(result.rules).toHaveLength(1);
22
+ expect(result.unstructured).toHaveLength(0);
23
+ const rule = result.rules[0];
24
+ expect(rule.id).toBe('allow-read-files');
25
+ expect(rule.effect).toBe('permit');
26
+ expect(rule.principal).toEqual({ type: 'User' });
27
+ expect(rule.action).toBe('read_file');
28
+ expect(rule.resource).toEqual({ type: 'FilePath' });
29
+ expect(rule.enabled).toBe(true);
30
+ });
31
+ it('should parse a policy with when conditions', () => {
32
+ const cedarText = `
33
+ @id("block-high-risk")
34
+ forbid(
35
+ principal,
36
+ action == Action::"execute_tool",
37
+ resource
38
+ )
39
+ when {
40
+ context.threat_level == "high"
41
+ };
42
+ `;
43
+ const result = parseCedarToRules(cedarText);
44
+ expect(result.errors).toHaveLength(0);
45
+ expect(result.rules).toHaveLength(1);
46
+ const rule = result.rules[0];
47
+ expect(rule.id).toBe('block-high-risk');
48
+ expect(rule.effect).toBe('forbid');
49
+ expect(rule.action).toBe('execute_tool');
50
+ // Check condition was parsed
51
+ expect(rule.conditions.length).toBeGreaterThanOrEqual(0);
52
+ // If condition parsing works, it should have the condition
53
+ // If not, it should be in rawCondition
54
+ if (rule.conditions.length > 0) {
55
+ expect(rule.conditions[0].field).toBe('threat_level');
56
+ expect(rule.conditions[0].operator).toBe('eq');
57
+ expect(rule.conditions[0].value).toBe('high');
58
+ }
59
+ else {
60
+ expect(rule.rawCondition).toBeDefined();
61
+ }
62
+ });
63
+ it('should return errors for invalid Cedar syntax', () => {
64
+ const invalidCedar = `
65
+ permit(
66
+ principal is User
67
+ // missing comma and rest of policy
68
+ `;
69
+ const result = parseCedarToRules(invalidCedar);
70
+ expect(result.errors.length).toBeGreaterThan(0);
71
+ });
72
+ it('should handle multiple policies', () => {
73
+ const cedarText = `
74
+ @id("rule-1")
75
+ permit(principal, action == Action::"read", resource);
76
+
77
+ @id("rule-2")
78
+ forbid(principal, action == Action::"delete", resource);
79
+ `;
80
+ const result = parseCedarToRules(cedarText);
81
+ expect(result.errors).toHaveLength(0);
82
+ expect(result.rules).toHaveLength(2);
83
+ expect(result.rules[0].effect).toBe('permit');
84
+ expect(result.rules[1].effect).toBe('forbid');
85
+ });
86
+ it('should put policies with unless clauses in unstructured', () => {
87
+ const cedarText = `
88
+ permit(principal, action, resource)
89
+ unless {
90
+ context.is_blocked == true
91
+ };
92
+ `;
93
+ const result = parseCedarToRules(cedarText);
94
+ // Unless clauses can't be represented as PolicyRule
95
+ expect(result.rules).toHaveLength(0);
96
+ expect(result.unstructured.length).toBeGreaterThan(0);
97
+ });
98
+ });
99
+ //# sourceMappingURL=parser.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.test.js","sourceRoot":"","sources":["../src/parser.test.ts"],"names":[],"mappings":"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"}
@@ -2,5 +2,5 @@
2
2
  * Embedded Cedar schema for policy validation.
3
3
  * This is the Highflame Cedar schema used across all services.
4
4
  */
5
- export declare const CEDAR_SCHEMA = "// Highflame Cedar Schema\n// ======================\n// This is the SOURCE OF TRUTH for all entity types, actions, and their relationships\n// across the Highflame platform.\n//\n// All services (authz, Core, Guardian, Palisade) MUST use the types defined here.\n// The codegen tool parses this file and generates typed constants for Go, TypeScript,\n// and Python to ensure consistency.\n//\n// Usage:\n// - Policies are validated against this schema when created/updated\n// - Generated types prevent typos in application code\n// - Cedar CLI can validate: cedar validate --schema highflame.cedarschema --policies policy.cedar\n\n// =============================================================================\n// PRINCIPAL TYPES (Who is making the request)\n// =============================================================================\n\n// Human user or service account making requests\n// Well-known IDs: \"mcp_client\", \"threat_processor\"\nentity User {\n // User type: \"external\", \"internal\"\n user_type: String,\n};\n\n// AI agent or bot\nentity Agent {\n // Agent type: \"llm\", \"scanner\", \"bot\"\n agent_type: String,\n};\n\n// Security scanner service\n// Well-known IDs: \"ramparts\", \"palisade\"\nentity Scanner {\n // Scanner type: \"ramparts\", \"palisade\"\n scanner_type: String,\n // Scanner version\n version: String,\n};\n\n// Backend service account\nentity Service {\n // Service name\n service_name: String,\n // Environment: \"production\", \"staging\", \"development\"\n environment: String,\n};\n\n// =============================================================================\n// RESOURCE TYPES (What is being accessed)\n// =============================================================================\n\n// Generic resource\n// Well-known IDs: \"threat_analysis\", \"tools/list\", \"tools/call\", \"resources/list\",\n// \"resources/read\", \"prompts/list\", \"unknown\"\nentity Resource {};\n\n// LLM response data\n// Well-known IDs: \"response_data\"\nentity ResponseData {};\n\n// MCP tool that can be called\nentity Tool {\n // Tool name\n tool_name: String,\n // Risk level: \"safe\", \"moderate\", \"dangerous\"\n risk_level: String,\n // Category: \"file\", \"network\", \"shell\", \"api\"\n category: String,\n};\n\n// File system path\nentity FilePath {\n // Full path\n path: String,\n // File extension\n extension: String,\n // Whether file is sensitive (.env, credentials, etc.)\n is_sensitive: Bool,\n};\n\n// HTTP endpoint\nentity HttpEndpoint {\n // Hostname\n hostname: String,\n // Scheme: \"http\", \"https\"\n scheme: String,\n // Port number\n port: Long,\n // Whether endpoint is internal\n is_internal: Bool,\n};\n\n// MCP Server\nentity Server {\n // Server name\n server_name: String,\n};\n\n// ML model artifact (for Palisade)\nentity Artifact {\n // Format: \"safetensors\", \"pickle\", \"gguf\", \"onnx\"\n artifact_type: String,\n // Source URL or path\n source: String,\n // SHA256 hash\n hash: String,\n // Whether artifact is signed\n is_signed: Bool,\n};\n\n// Code repository\nentity Repository {\n // Repository URL\n url: String,\n};\n\n// Software package\nentity Package {\n // Package name\n name: String,\n // Package version\n version: String,\n};\n\n// =============================================================================\n// ACTIONS\n// =============================================================================\n\n// --- LLM/Guardrails Actions ---\n\n// Process an LLM prompt\n// Context: prompt_text, yara_threats, threat_count, max_threat_severity,\n// user_type, monitoring_enabled\naction process_prompt appliesTo {\n principal: [User, Agent],\n resource: [Resource],\n};\n\n// Process an LLM response\n// Context: response_size_mb\naction process_response appliesTo {\n principal: [User, Agent],\n resource: [ResponseData],\n};\n\n// --- MCP/Tool Actions ---\n\n// Call an MCP tool\n// Context: tool_name\naction call_tool appliesTo {\n principal: [User, Agent, Service],\n resource: [Tool, Resource],\n};\n\n// Connect to an MCP server\naction connect_server appliesTo {\n principal: [User, Agent, Service],\n resource: [Server, Resource],\n};\n\n// Access a server-specific resource\n// Context: tool_name, resource_name, prompt_name\naction access_server_resource appliesTo {\n principal: [User, Agent, Service],\n resource: [Resource],\n};\n\n// Skip guardrails for an operation\naction skip_guardrails appliesTo {\n principal: [User, Agent, Service],\n resource: [Resource],\n};\n\n// --- File System Actions ---\n\n// Read a file\n// Context: path\naction read_file appliesTo {\n principal: [User, Agent, Scanner],\n resource: [FilePath, Resource],\n};\n\n// Write a file\n// Context: path\naction write_file appliesTo {\n principal: [User, Agent],\n resource: [FilePath, Resource],\n};\n\n// --- HTTP Actions ---\n\n// Make an HTTP request\n// Context: hostname, ip_address, scheme, port\naction http_request appliesTo {\n principal: [User, Agent, Service],\n resource: [HttpEndpoint, Resource],\n};\n\n// --- Scanner Actions ---\n\n// Scan a target (MCP server, repository, etc.)\naction scan_target appliesTo {\n principal: [Scanner, Service],\n resource: [Resource, Repository, Server],\n};\n\n// Scan a software package\naction scan_package appliesTo {\n principal: [Scanner, Service],\n resource: [Package, Resource],\n};\n\n// --- Palisade/ML Actions ---\n\n// Scan an ML artifact\n// Context: environment, artifact_format, artifact_signed, severity, finding_type,\n// provenance_signer, pickle_exec_path_detected, metadata_malicious_pattern,\n// tokenizer_added_tokens_count, safetensors_integrity_violation,\n// gguf_suspicious_metadata, adapter_base_digest_mismatch,\n// metadata_cosai_level_numeric\naction scan_artifact appliesTo {\n principal: [Scanner, Service],\n resource: [Artifact, Resource],\n};\n\n// Validate artifact integrity\naction validate_integrity appliesTo {\n principal: [Scanner, Service],\n resource: [Artifact],\n};\n\n// Validate artifact provenance\naction validate_provenance appliesTo {\n principal: [Scanner, Service],\n resource: [Artifact],\n};\n\n// Quarantine an artifact\naction quarantine_artifact appliesTo {\n principal: [Scanner, Service],\n resource: [Artifact],\n};\n\n// Load an ML model\naction load_model appliesTo {\n principal: [User, Agent, Service],\n resource: [Artifact],\n};\n\n// Deploy an ML model\naction deploy_model appliesTo {\n principal: [User, Service],\n resource: [Artifact],\n};\n\n// =============================================================================\n// CONTEXT ATTRIBUTES REFERENCE (Documentation Only)\n// =============================================================================\n// Cedar context is dynamic and not enforced by schema, but these are the\n// standard attributes used across Highflame services:\n//\n// GUARDRAILS/CORE:\n// tool_name: String - Name of tool being called\n// resource_name: String - Name of resource being accessed\n// prompt_name: String - Name of prompt\n// prompt_text: String - Raw prompt text (for injection detection)\n// response_size_mb: Long - Response size in megabytes\n// yara_threats: Set<String> - Set of detected YARA threat names\n// threat_count: Long - Number of threats detected\n// max_threat_severity: Long - Highest severity (0=INFO, 4=CRITICAL)\n// user_type: String - \"external\" or \"internal\"\n// monitoring_enabled: Bool - Whether monitoring is active\n// path: String - File path\n// hostname: String - HTTP hostname\n// ip_address: String - IP address (for SSRF detection)\n// scheme: String - HTTP scheme\n// port: Long - Port number\n//\n// PALISADE:\n// environment: String - \"production\", \"development\", \"research\"\n// artifact_format: String - \"pickle\", \"safetensors\", \"gguf\", \"onnx\"\n// artifact_signed: Bool - Whether artifact has signature\n// severity: String - \"CRITICAL\", \"HIGH\", \"MEDIUM\", \"LOW\", \"INFO\"\n// finding_type: String - Type of security finding\n// provenance_signer: String - Who signed (\"unknown\", \"unsigned\", or name)\n// pickle_exec_path_detected: Bool - RCE path found in pickle\n// metadata_malicious_pattern: Bool - Malicious pattern in metadata\n// tokenizer_added_tokens_count: Long - Number of added tokens\n// safetensors_integrity_violation: Bool - Safetensors integrity failed\n// gguf_suspicious_metadata: Bool - Suspicious GGUF metadata\n// adapter_base_digest_mismatch: Bool - LoRA adapter digest mismatch\n// metadata_cosai_level_numeric: Long - CoSAI maturity level (0-5)\n";
5
+ export declare const CEDAR_SCHEMA = "// Highflame Cedar Schema\n// ======================\n// This is the SOURCE OF TRUTH for all entity types, actions, and their relationships\n// across the Highflame platform.\n//\n// All services (authz, Core, Guardian, Palisade) MUST use the types defined here.\n// The codegen tool parses this file and generates typed constants for Go, TypeScript,\n// and Python to ensure consistency.\n//\n// Usage:\n// - Policies are validated against this schema when created/updated\n// - Generated types prevent typos in application code\n// - Cedar CLI can validate: cedar validate --schema highflame.cedarschema --policies policy.cedar\n\n// =============================================================================\n// PRINCIPAL TYPES (Who is making the request)\n// =============================================================================\n\n// Human user or service account making requests\n// Well-known IDs: \"mcp_client\", \"threat_processor\"\nentity User {\n // User type: \"external\", \"internal\"\n user_type: String,\n};\n\n// AI agent or bot\nentity Agent {\n // Agent type: \"llm\", \"scanner\", \"bot\", \"coding_assistant\"\n agent_type: String,\n};\n\n// Security scanner service\n// Well-known IDs: \"ramparts\", \"palisade\"\nentity Scanner {\n // Scanner type: \"ramparts\", \"palisade\"\n scanner_type: String,\n // Scanner version\n version: String,\n};\n\n// Backend service account\nentity Service {\n // Service name\n service_name: String,\n // Environment: \"production\", \"staging\", \"development\"\n environment: String,\n};\n\n// =============================================================================\n// RESOURCE TYPES (What is being accessed)\n// =============================================================================\n\n// Generic resource\n// Well-known IDs: \"threat_analysis\", \"tools/list\", \"tools/call\", \"resources/list\",\n// \"resources/read\", \"prompts/list\", \"unknown\"\nentity Resource {};\n\n// LLM response data\n// Well-known IDs: \"response_data\"\nentity ResponseData {};\n\n// MCP tool that can be called\nentity Tool {\n // Tool name\n tool_name: String,\n // Risk level: \"safe\", \"moderate\", \"dangerous\"\n risk_level: String,\n // Category: \"file\", \"network\", \"shell\", \"api\"\n category: String,\n};\n\n// File system path\nentity FilePath {\n // Full path\n path: String,\n // File extension\n extension: String,\n // Whether file is sensitive (.env, credentials, etc.)\n is_sensitive: Bool,\n};\n\n// HTTP endpoint\nentity HttpEndpoint {\n // Hostname\n hostname: String,\n // Scheme: \"http\", \"https\"\n scheme: String,\n // Port number\n port: Long,\n // Whether endpoint is internal\n is_internal: Bool,\n};\n\n// MCP Server\nentity Server {\n // Server name\n server_name: String,\n};\n\n// ML model artifact (for Palisade)\nentity Artifact {\n // Format: \"safetensors\", \"pickle\", \"gguf\", \"onnx\"\n artifact_type: String,\n // Source URL or path\n source: String,\n // SHA256 hash\n hash: String,\n // Whether artifact is signed\n is_signed: Bool,\n};\n\n// Code repository\nentity Repository {\n // Repository URL\n url: String,\n};\n\n// Software package\nentity Package {\n // Package name\n name: String,\n // Package version\n version: String,\n};\n\n// Git branch (for branch protection policies)\nentity GitBranch {\n // Branch name (e.g., \"main\", \"develop\", \"feature/xyz\")\n branch_name: String,\n // Whether this is a protected branch\n is_protected: Bool,\n};\n\n// LLM Model (for model-specific policies)\nentity Model {\n // Model name (e.g., \"gpt-4\", \"claude-3-opus\")\n model_name: String,\n // Provider (e.g., \"openai\", \"anthropic\", \"google\")\n provider: String,\n // Whether model is in preview/beta\n is_preview: Bool,\n};\n\n// External API endpoint (for external service calls)\nentity ExternalAPI {\n // API name or identifier\n api_name: String,\n // Base URL or hostname\n base_url: String,\n // Whether the API is trusted/verified\n is_trusted: Bool,\n};\n\n// Agent memory or RAG storage\nentity Memory {\n // Memory type: \"short_term\", \"long_term\", \"rag\", \"vector_store\"\n memory_type: String,\n // Whether memory contains sensitive data\n is_sensitive: Bool,\n};\n\n// =============================================================================\n// ACTIONS - LLM/Guardrails\n// =============================================================================\n\n// Process an LLM prompt\n// Context: prompt_text, yara_threats, threat_count, max_threat_severity,\n// user_type, monitoring_enabled, injection_score, content_score\naction process_prompt appliesTo {\n principal: [User, Agent],\n resource: [Resource],\n};\n\n// Process an LLM response\n// Context: response_size_mb, contains_pii, pii_types, content_category\naction process_response appliesTo {\n principal: [User, Agent],\n resource: [ResponseData],\n};\n\n// Invoke an LLM model\n// Context: model_name, model_provider, is_preview_model, estimated_tokens,\n// max_tokens, temperature, top_p, is_streaming\naction invoke_model appliesTo {\n principal: [User, Agent, Service],\n resource: [Model, Resource],\n};\n\n// Filter content (apply content filtering policies)\n// Context: content_type, content_category, content_score, harm_categories,\n// language, is_harmful, filter_action\naction filter_content appliesTo {\n principal: [User, Agent, Service],\n resource: [Resource, ResponseData],\n};\n\n// =============================================================================\n// ACTIONS - MCP/Tool\n// =============================================================================\n\n// Call an MCP tool\n// Context: tool_name, tool_arguments, risk_level\naction call_tool appliesTo {\n principal: [User, Agent, Service],\n resource: [Tool, Resource],\n};\n\n// Connect to an MCP server\n// Context: server_name, server_url, transport_type\naction connect_server appliesTo {\n principal: [User, Agent, Service],\n resource: [Server, Resource],\n};\n\n// Access a server-specific resource\n// Context: tool_name, resource_name, prompt_name\naction access_server_resource appliesTo {\n principal: [User, Agent, Service],\n resource: [Resource],\n};\n\n// Skip guardrails for an operation\naction skip_guardrails appliesTo {\n principal: [User, Agent, Service],\n resource: [Resource],\n};\n\n// =============================================================================\n// ACTIONS - File System\n// =============================================================================\n\n// Read a file\n// Context: path, extension, is_sensitive\naction read_file appliesTo {\n principal: [User, Agent, Scanner],\n resource: [FilePath, Resource],\n};\n\n// Write a file\n// Context: path, extension, is_sensitive, file_size_bytes\naction write_file appliesTo {\n principal: [User, Agent],\n resource: [FilePath, Resource],\n};\n\n// Delete a file\n// Context: path, extension, is_sensitive\naction delete_file appliesTo {\n principal: [User, Agent],\n resource: [FilePath, Resource],\n};\n\n// =============================================================================\n// ACTIONS - HTTP/Network\n// =============================================================================\n\n// Make an HTTP request\n// Context: hostname, ip_address, scheme, port, method, is_internal\naction http_request appliesTo {\n principal: [User, Agent, Service],\n resource: [HttpEndpoint, Resource],\n};\n\n// Call an external API\n// Context: api_name, endpoint_path, method, is_trusted, request_size_bytes\naction call_external_api appliesTo {\n principal: [User, Agent, Service],\n resource: [ExternalAPI, HttpEndpoint, Resource],\n};\n\n// =============================================================================\n// ACTIONS - Code Execution\n// =============================================================================\n\n// Execute code in a sandbox or environment\n// Context: code_language, is_sandboxed, code_size_bytes, has_network_access,\n// has_filesystem_access, execution_timeout_ms\naction execute_code appliesTo {\n principal: [User, Agent],\n resource: [Resource],\n};\n\n// Run tests\n// Context: test_framework, test_count, is_sandboxed, code_language\naction run_tests appliesTo {\n principal: [User, Agent, Service],\n resource: [Repository, Resource],\n};\n\n// Run build process\n// Context: build_tool, is_sandboxed, code_language\naction run_build appliesTo {\n principal: [User, Agent, Service],\n resource: [Repository, Resource],\n};\n\n// =============================================================================\n// ACTIONS - Git Operations\n// =============================================================================\n\n// General git operation (use for policies that apply to all git actions)\n// Context: git_op, target_branch, source_branch, is_force, is_protected_branch,\n// changed_files_count, commit_message, remote_url\naction git_operation appliesTo {\n principal: [User, Agent],\n resource: [Repository, GitBranch, Resource],\n};\n\n// Clone a repository\n// Context: remote_url, is_shallow, depth\naction git_clone appliesTo {\n principal: [User, Agent],\n resource: [Repository, Resource],\n};\n\n// Create a commit\n// Context: commit_message, changed_files_count, author, is_amend\naction git_commit appliesTo {\n principal: [User, Agent],\n resource: [Repository, GitBranch, Resource],\n};\n\n// Push changes to remote\n// Context: target_branch, is_force_push, is_protected_branch, remote_url\naction git_push appliesTo {\n principal: [User, Agent],\n resource: [Repository, GitBranch, Resource],\n};\n\n// Pull changes from remote\n// Context: source_branch, remote_url, is_rebase\naction git_pull appliesTo {\n principal: [User, Agent],\n resource: [Repository, GitBranch, Resource],\n};\n\n// Merge branches\n// Context: source_branch, target_branch, is_protected_branch, merge_strategy\naction git_merge appliesTo {\n principal: [User, Agent],\n resource: [Repository, GitBranch, Resource],\n};\n\n// Checkout branch or commit\n// Context: target_branch, is_new_branch, commit_hash\naction git_checkout appliesTo {\n principal: [User, Agent],\n resource: [Repository, GitBranch, Resource],\n};\n\n// Reset changes (potentially destructive)\n// Context: reset_mode, target_commit, is_hard_reset\naction git_reset appliesTo {\n principal: [User, Agent],\n resource: [Repository, GitBranch, Resource],\n};\n\n// Rebase branch\n// Context: source_branch, target_branch, is_interactive\naction git_rebase appliesTo {\n principal: [User, Agent],\n resource: [Repository, GitBranch, Resource],\n};\n\n// =============================================================================\n// ACTIONS - Agent Orchestration\n// =============================================================================\n\n// Delegate task to another agent\n// Context: delegation_depth, parent_agent_id, task_type, is_autonomous\naction delegate_task appliesTo {\n principal: [Agent, Service],\n resource: [Resource],\n};\n\n// Spawn a subprocess or child process\n// Context: process_name, is_sandboxed, has_network_access, has_filesystem_access\naction spawn_subprocess appliesTo {\n principal: [User, Agent, Service],\n resource: [Resource],\n};\n\n// Access agent memory or RAG storage\n// Context: memory_type, operation (read, write, delete), is_sensitive\naction access_memory appliesTo {\n principal: [Agent, Service],\n resource: [Memory, Resource],\n};\n\n// =============================================================================\n// ACTIONS - Scanner\n// =============================================================================\n\n// Scan a target (MCP server, repository, etc.)\naction scan_target appliesTo {\n principal: [Scanner, Service],\n resource: [Resource, Repository, Server],\n};\n\n// Scan a software package\naction scan_package appliesTo {\n principal: [Scanner, Service],\n resource: [Package, Resource],\n};\n\n// =============================================================================\n// ACTIONS - Palisade/ML\n// =============================================================================\n\n// Scan an ML artifact\n// Context: environment, artifact_format, artifact_signed, severity, finding_type,\n// provenance_signer, pickle_exec_path_detected, metadata_malicious_pattern,\n// tokenizer_added_tokens_count, safetensors_integrity_violation,\n// gguf_suspicious_metadata, adapter_base_digest_mismatch,\n// metadata_cosai_level_numeric\naction scan_artifact appliesTo {\n principal: [Scanner, Service],\n resource: [Artifact, Resource],\n};\n\n// Validate artifact integrity\naction validate_integrity appliesTo {\n principal: [Scanner, Service],\n resource: [Artifact],\n};\n\n// Validate artifact provenance\naction validate_provenance appliesTo {\n principal: [Scanner, Service],\n resource: [Artifact],\n};\n\n// Quarantine an artifact\naction quarantine_artifact appliesTo {\n principal: [Scanner, Service],\n resource: [Artifact],\n};\n\n// Load an ML model\naction load_model appliesTo {\n principal: [User, Agent, Service],\n resource: [Artifact],\n};\n\n// Deploy an ML model\naction deploy_model appliesTo {\n principal: [User, Service],\n resource: [Artifact],\n};\n\n// =============================================================================\n// ACTIONS - Data Loss Prevention (DLP)\n// =============================================================================\n\n// Transfer data (for DLP policies)\n// Context: data_classification, destination_type, transfer_size_bytes,\n// contains_pii, pii_types, is_encrypted\naction transfer_data appliesTo {\n principal: [User, Agent, Service],\n resource: [Resource],\n};\n\n// Export data (for DLP policies)\n// Context: export_format, data_classification, destination_type, is_encrypted\naction export_data appliesTo {\n principal: [User, Agent, Service],\n resource: [Resource],\n};\n\n// =============================================================================\n// CONTEXT ATTRIBUTES REFERENCE (Documentation Only)\n// =============================================================================\n// Cedar context is dynamic and not enforced by schema, but these are the\n// standard attributes used across Highflame services:\n//\n// -----------------------------------------------------------------------------\n// GUARDRAILS/CORE\n// -----------------------------------------------------------------------------\n// tool_name: String - Name of tool being called\n// resource_name: String - Name of resource being accessed\n// prompt_name: String - Name of prompt\n// prompt_text: String - Raw prompt text (for injection detection)\n// response_size_mb: Long - Response size in megabytes\n// yara_threats: Set<String> - Set of detected YARA threat names\n// threat_count: Long - Number of threats detected\n// max_threat_severity: Long - Highest severity (0=INFO, 4=CRITICAL)\n// user_type: String - \"external\" or \"internal\"\n// monitoring_enabled: Bool - Whether monitoring is active\n// path: String - File path\n// hostname: String - HTTP hostname\n// ip_address: String - IP address (for SSRF detection)\n// scheme: String - HTTP scheme\n// port: Long - Port number\n//\n// -----------------------------------------------------------------------------\n// MODEL INVOCATION\n// -----------------------------------------------------------------------------\n// model_name: String - Name of the model (e.g., \"gpt-4\", \"claude-3-opus\")\n// model_provider: String - Provider name (e.g., \"openai\", \"anthropic\", \"google\", \"azure\", \"bedrock\")\n// is_preview_model: Bool - Whether model is in preview/beta\n// estimated_tokens: Long - Estimated input + output tokens\n// max_tokens: Long - Maximum tokens allowed for response\n// temperature: Long - Temperature setting (scaled by 100, e.g., 70 = 0.7)\n// top_p: Long - Top-p sampling (scaled by 100)\n// is_streaming: Bool - Whether response is streamed\n//\n// -----------------------------------------------------------------------------\n// CONTENT FILTERING\n// -----------------------------------------------------------------------------\n// content_type: String - Type of content (\"text\", \"code\", \"image\", \"audio\", \"video\")\n// content_category: String - Category (\"general\", \"adult\", \"violence\", \"hate\", etc.)\n// content_score: Long - Content risk score (0-100)\n// injection_score: Long - Prompt injection detection score (0-100)\n// jailbreak_score: Long - Jailbreak attempt detection score (0-100)\n// contains_pii: Bool - Whether content contains PII\n// pii_types: Set<String> - Types of PII detected (\"email\", \"phone\", \"ssn\", \"credit_card\", etc.)\n// language: String - Detected language code (e.g., \"en\", \"es\", \"zh\")\n// is_harmful: Bool - Whether content is harmful\n// harm_categories: Set<String> - Categories of harm (\"violence\", \"hate\", \"self_harm\", \"sexual\", etc.)\n// filter_action: String - Action to take (\"inspect\", \"mask\", \"redact\", \"replace\", \"anonymize\", \"reject\")\n// csam_detected: Bool - Whether CSAM was detected\n// hallucination_score: Long - Hallucination detection score (0-100)\n//\n// -----------------------------------------------------------------------------\n// RATE LIMITING\n// -----------------------------------------------------------------------------\n// concurrent_calls: Long - Current number of concurrent calls\n// requests_per_minute: Long - Current requests per minute\n// tokens_per_minute: Long - Current tokens per minute\n// rate_limit_bucket: String - Rate limit bucket identifier\n// is_rate_limited: Bool - Whether rate limit is exceeded\n//\n// -----------------------------------------------------------------------------\n// GIT OPERATIONS\n// -----------------------------------------------------------------------------\n// git_op: String - Type of git operation (\"clone\", \"commit\", \"push\", \"pull\", etc.)\n// target_branch: String - Target branch name\n// source_branch: String - Source branch name\n// is_force_push: Bool - Whether this is a force push\n// is_protected_branch: Bool - Whether target is a protected branch\n// changed_files_count: Long - Number of files changed\n// commit_message: String - Commit message text\n// remote_url: String - Remote repository URL\n// is_shallow: Bool - Whether clone is shallow\n// depth: Long - Clone depth for shallow clones\n// is_amend: Bool - Whether commit is an amend\n// merge_strategy: String - Merge strategy (\"merge\", \"rebase\", \"squash\")\n// is_hard_reset: Bool - Whether reset is hard (destructive)\n// reset_mode: String - Reset mode (\"soft\", \"mixed\", \"hard\")\n// is_interactive: Bool - Whether operation is interactive\n//\n// -----------------------------------------------------------------------------\n// CODE EXECUTION\n// -----------------------------------------------------------------------------\n// code_language: String - Programming language (\"python\", \"javascript\", \"go\", etc.)\n// is_sandboxed: Bool - Whether code runs in a sandbox\n// code_size_bytes: Long - Size of code in bytes\n// has_network_access: Bool - Whether code has network access\n// has_filesystem_access: Bool - Whether code has filesystem access\n// execution_timeout_ms: Long - Execution timeout in milliseconds\n// test_framework: String - Test framework being used\n// test_count: Long - Number of tests being run\n// build_tool: String - Build tool being used\n//\n// -----------------------------------------------------------------------------\n// AGENT ORCHESTRATION\n// -----------------------------------------------------------------------------\n// delegation_depth: Long - Current delegation nesting depth\n// parent_agent_id: String - ID of parent agent (if delegated)\n// task_type: String - Type of task being performed\n// is_autonomous: Bool - Whether agent is operating autonomously\n// session_id: String - Agent session identifier\n// process_name: String - Name of subprocess being spawned\n//\n// -----------------------------------------------------------------------------\n// MEMORY/RAG\n// -----------------------------------------------------------------------------\n// memory_type: String - Type of memory (\"short_term\", \"long_term\", \"rag\", \"vector_store\")\n// memory_operation: String - Operation being performed (\"read\", \"write\", \"delete\", \"search\")\n// memory_is_sensitive: Bool - Whether memory contains sensitive data\n//\n// -----------------------------------------------------------------------------\n// DATA LOSS PREVENTION (DLP)\n// -----------------------------------------------------------------------------\n// data_classification: String - Classification level (\"public\", \"internal\", \"confidential\", \"restricted\")\n// destination_type: String - Where data is going (\"internal\", \"external\", \"cloud\", \"email\")\n// transfer_size_bytes: Long - Size of data being transferred\n// is_encrypted: Bool - Whether data is encrypted\n// export_format: String - Format of exported data (\"json\", \"csv\", \"pdf\", etc.)\n//\n// -----------------------------------------------------------------------------\n// PALISADE/ML\n// -----------------------------------------------------------------------------\n// environment: String - \"production\", \"development\", \"research\"\n// artifact_format: String - \"pickle\", \"safetensors\", \"gguf\", \"onnx\"\n// artifact_signed: Bool - Whether artifact has signature\n// severity: String - \"CRITICAL\", \"HIGH\", \"MEDIUM\", \"LOW\", \"INFO\"\n// finding_type: String - Type of security finding\n// provenance_signer: String - Who signed (\"unknown\", \"unsigned\", or name)\n// pickle_exec_path_detected: Bool - RCE path found in pickle\n// metadata_malicious_pattern: Bool - Malicious pattern in metadata\n// tokenizer_added_tokens_count: Long - Number of added tokens\n// safetensors_integrity_violation: Bool - Safetensors integrity failed\n// gguf_suspicious_metadata: Bool - Suspicious GGUF metadata\n// adapter_base_digest_mismatch: Bool - LoRA adapter digest mismatch\n// metadata_cosai_level_numeric: Long - CoSAI maturity level (0-5)\n//\n";
6
6
  //# sourceMappingURL=schema.gen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.gen.d.ts","sourceRoot":"","sources":["../src/schema.gen.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,YAAY,27RAqSxB,CAAC"}
1
+ {"version":3,"file":"schema.gen.d.ts","sourceRoot":"","sources":["../src/schema.gen.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,YAAY,i9tBA+lBxB,CAAC"}
@@ -31,7 +31,7 @@ entity User {
31
31
 
32
32
  // AI agent or bot
33
33
  entity Agent {
34
- // Agent type: "llm", "scanner", "bot"
34
+ // Agent type: "llm", "scanner", "bot", "coding_assistant"
35
35
  agent_type: String,
36
36
  };
37
37
 
@@ -129,37 +129,90 @@ entity Package {
129
129
  version: String,
130
130
  };
131
131
 
132
+ // Git branch (for branch protection policies)
133
+ entity GitBranch {
134
+ // Branch name (e.g., "main", "develop", "feature/xyz")
135
+ branch_name: String,
136
+ // Whether this is a protected branch
137
+ is_protected: Bool,
138
+ };
139
+
140
+ // LLM Model (for model-specific policies)
141
+ entity Model {
142
+ // Model name (e.g., "gpt-4", "claude-3-opus")
143
+ model_name: String,
144
+ // Provider (e.g., "openai", "anthropic", "google")
145
+ provider: String,
146
+ // Whether model is in preview/beta
147
+ is_preview: Bool,
148
+ };
149
+
150
+ // External API endpoint (for external service calls)
151
+ entity ExternalAPI {
152
+ // API name or identifier
153
+ api_name: String,
154
+ // Base URL or hostname
155
+ base_url: String,
156
+ // Whether the API is trusted/verified
157
+ is_trusted: Bool,
158
+ };
159
+
160
+ // Agent memory or RAG storage
161
+ entity Memory {
162
+ // Memory type: "short_term", "long_term", "rag", "vector_store"
163
+ memory_type: String,
164
+ // Whether memory contains sensitive data
165
+ is_sensitive: Bool,
166
+ };
167
+
132
168
  // =============================================================================
133
- // ACTIONS
169
+ // ACTIONS - LLM/Guardrails
134
170
  // =============================================================================
135
171
 
136
- // --- LLM/Guardrails Actions ---
137
-
138
172
  // Process an LLM prompt
139
173
  // Context: prompt_text, yara_threats, threat_count, max_threat_severity,
140
- // user_type, monitoring_enabled
174
+ // user_type, monitoring_enabled, injection_score, content_score
141
175
  action process_prompt appliesTo {
142
176
  principal: [User, Agent],
143
177
  resource: [Resource],
144
178
  };
145
179
 
146
180
  // Process an LLM response
147
- // Context: response_size_mb
181
+ // Context: response_size_mb, contains_pii, pii_types, content_category
148
182
  action process_response appliesTo {
149
183
  principal: [User, Agent],
150
184
  resource: [ResponseData],
151
185
  };
152
186
 
153
- // --- MCP/Tool Actions ---
187
+ // Invoke an LLM model
188
+ // Context: model_name, model_provider, is_preview_model, estimated_tokens,
189
+ // max_tokens, temperature, top_p, is_streaming
190
+ action invoke_model appliesTo {
191
+ principal: [User, Agent, Service],
192
+ resource: [Model, Resource],
193
+ };
194
+
195
+ // Filter content (apply content filtering policies)
196
+ // Context: content_type, content_category, content_score, harm_categories,
197
+ // language, is_harmful, filter_action
198
+ action filter_content appliesTo {
199
+ principal: [User, Agent, Service],
200
+ resource: [Resource, ResponseData],
201
+ };
202
+
203
+ // =============================================================================
204
+ // ACTIONS - MCP/Tool
205
+ // =============================================================================
154
206
 
155
207
  // Call an MCP tool
156
- // Context: tool_name
208
+ // Context: tool_name, tool_arguments, risk_level
157
209
  action call_tool appliesTo {
158
210
  principal: [User, Agent, Service],
159
211
  resource: [Tool, Resource],
160
212
  };
161
213
 
162
214
  // Connect to an MCP server
215
+ // Context: server_name, server_url, transport_type
163
216
  action connect_server appliesTo {
164
217
  principal: [User, Agent, Service],
165
218
  resource: [Server, Resource],
@@ -178,32 +231,171 @@ action skip_guardrails appliesTo {
178
231
  resource: [Resource],
179
232
  };
180
233
 
181
- // --- File System Actions ---
234
+ // =============================================================================
235
+ // ACTIONS - File System
236
+ // =============================================================================
182
237
 
183
238
  // Read a file
184
- // Context: path
239
+ // Context: path, extension, is_sensitive
185
240
  action read_file appliesTo {
186
241
  principal: [User, Agent, Scanner],
187
242
  resource: [FilePath, Resource],
188
243
  };
189
244
 
190
245
  // Write a file
191
- // Context: path
246
+ // Context: path, extension, is_sensitive, file_size_bytes
192
247
  action write_file appliesTo {
193
248
  principal: [User, Agent],
194
249
  resource: [FilePath, Resource],
195
250
  };
196
251
 
197
- // --- HTTP Actions ---
252
+ // Delete a file
253
+ // Context: path, extension, is_sensitive
254
+ action delete_file appliesTo {
255
+ principal: [User, Agent],
256
+ resource: [FilePath, Resource],
257
+ };
258
+
259
+ // =============================================================================
260
+ // ACTIONS - HTTP/Network
261
+ // =============================================================================
198
262
 
199
263
  // Make an HTTP request
200
- // Context: hostname, ip_address, scheme, port
264
+ // Context: hostname, ip_address, scheme, port, method, is_internal
201
265
  action http_request appliesTo {
202
266
  principal: [User, Agent, Service],
203
267
  resource: [HttpEndpoint, Resource],
204
268
  };
205
269
 
206
- // --- Scanner Actions ---
270
+ // Call an external API
271
+ // Context: api_name, endpoint_path, method, is_trusted, request_size_bytes
272
+ action call_external_api appliesTo {
273
+ principal: [User, Agent, Service],
274
+ resource: [ExternalAPI, HttpEndpoint, Resource],
275
+ };
276
+
277
+ // =============================================================================
278
+ // ACTIONS - Code Execution
279
+ // =============================================================================
280
+
281
+ // Execute code in a sandbox or environment
282
+ // Context: code_language, is_sandboxed, code_size_bytes, has_network_access,
283
+ // has_filesystem_access, execution_timeout_ms
284
+ action execute_code appliesTo {
285
+ principal: [User, Agent],
286
+ resource: [Resource],
287
+ };
288
+
289
+ // Run tests
290
+ // Context: test_framework, test_count, is_sandboxed, code_language
291
+ action run_tests appliesTo {
292
+ principal: [User, Agent, Service],
293
+ resource: [Repository, Resource],
294
+ };
295
+
296
+ // Run build process
297
+ // Context: build_tool, is_sandboxed, code_language
298
+ action run_build appliesTo {
299
+ principal: [User, Agent, Service],
300
+ resource: [Repository, Resource],
301
+ };
302
+
303
+ // =============================================================================
304
+ // ACTIONS - Git Operations
305
+ // =============================================================================
306
+
307
+ // General git operation (use for policies that apply to all git actions)
308
+ // Context: git_op, target_branch, source_branch, is_force, is_protected_branch,
309
+ // changed_files_count, commit_message, remote_url
310
+ action git_operation appliesTo {
311
+ principal: [User, Agent],
312
+ resource: [Repository, GitBranch, Resource],
313
+ };
314
+
315
+ // Clone a repository
316
+ // Context: remote_url, is_shallow, depth
317
+ action git_clone appliesTo {
318
+ principal: [User, Agent],
319
+ resource: [Repository, Resource],
320
+ };
321
+
322
+ // Create a commit
323
+ // Context: commit_message, changed_files_count, author, is_amend
324
+ action git_commit appliesTo {
325
+ principal: [User, Agent],
326
+ resource: [Repository, GitBranch, Resource],
327
+ };
328
+
329
+ // Push changes to remote
330
+ // Context: target_branch, is_force_push, is_protected_branch, remote_url
331
+ action git_push appliesTo {
332
+ principal: [User, Agent],
333
+ resource: [Repository, GitBranch, Resource],
334
+ };
335
+
336
+ // Pull changes from remote
337
+ // Context: source_branch, remote_url, is_rebase
338
+ action git_pull appliesTo {
339
+ principal: [User, Agent],
340
+ resource: [Repository, GitBranch, Resource],
341
+ };
342
+
343
+ // Merge branches
344
+ // Context: source_branch, target_branch, is_protected_branch, merge_strategy
345
+ action git_merge appliesTo {
346
+ principal: [User, Agent],
347
+ resource: [Repository, GitBranch, Resource],
348
+ };
349
+
350
+ // Checkout branch or commit
351
+ // Context: target_branch, is_new_branch, commit_hash
352
+ action git_checkout appliesTo {
353
+ principal: [User, Agent],
354
+ resource: [Repository, GitBranch, Resource],
355
+ };
356
+
357
+ // Reset changes (potentially destructive)
358
+ // Context: reset_mode, target_commit, is_hard_reset
359
+ action git_reset appliesTo {
360
+ principal: [User, Agent],
361
+ resource: [Repository, GitBranch, Resource],
362
+ };
363
+
364
+ // Rebase branch
365
+ // Context: source_branch, target_branch, is_interactive
366
+ action git_rebase appliesTo {
367
+ principal: [User, Agent],
368
+ resource: [Repository, GitBranch, Resource],
369
+ };
370
+
371
+ // =============================================================================
372
+ // ACTIONS - Agent Orchestration
373
+ // =============================================================================
374
+
375
+ // Delegate task to another agent
376
+ // Context: delegation_depth, parent_agent_id, task_type, is_autonomous
377
+ action delegate_task appliesTo {
378
+ principal: [Agent, Service],
379
+ resource: [Resource],
380
+ };
381
+
382
+ // Spawn a subprocess or child process
383
+ // Context: process_name, is_sandboxed, has_network_access, has_filesystem_access
384
+ action spawn_subprocess appliesTo {
385
+ principal: [User, Agent, Service],
386
+ resource: [Resource],
387
+ };
388
+
389
+ // Access agent memory or RAG storage
390
+ // Context: memory_type, operation (read, write, delete), is_sensitive
391
+ action access_memory appliesTo {
392
+ principal: [Agent, Service],
393
+ resource: [Memory, Resource],
394
+ };
395
+
396
+ // =============================================================================
397
+ // ACTIONS - Scanner
398
+ // =============================================================================
207
399
 
208
400
  // Scan a target (MCP server, repository, etc.)
209
401
  action scan_target appliesTo {
@@ -217,7 +409,9 @@ action scan_package appliesTo {
217
409
  resource: [Package, Resource],
218
410
  };
219
411
 
220
- // --- Palisade/ML Actions ---
412
+ // =============================================================================
413
+ // ACTIONS - Palisade/ML
414
+ // =============================================================================
221
415
 
222
416
  // Scan an ML artifact
223
417
  // Context: environment, artifact_format, artifact_signed, severity, finding_type,
@@ -260,13 +454,34 @@ action deploy_model appliesTo {
260
454
  resource: [Artifact],
261
455
  };
262
456
 
457
+ // =============================================================================
458
+ // ACTIONS - Data Loss Prevention (DLP)
459
+ // =============================================================================
460
+
461
+ // Transfer data (for DLP policies)
462
+ // Context: data_classification, destination_type, transfer_size_bytes,
463
+ // contains_pii, pii_types, is_encrypted
464
+ action transfer_data appliesTo {
465
+ principal: [User, Agent, Service],
466
+ resource: [Resource],
467
+ };
468
+
469
+ // Export data (for DLP policies)
470
+ // Context: export_format, data_classification, destination_type, is_encrypted
471
+ action export_data appliesTo {
472
+ principal: [User, Agent, Service],
473
+ resource: [Resource],
474
+ };
475
+
263
476
  // =============================================================================
264
477
  // CONTEXT ATTRIBUTES REFERENCE (Documentation Only)
265
478
  // =============================================================================
266
479
  // Cedar context is dynamic and not enforced by schema, but these are the
267
480
  // standard attributes used across Highflame services:
268
481
  //
269
- // GUARDRAILS/CORE:
482
+ // -----------------------------------------------------------------------------
483
+ // GUARDRAILS/CORE
484
+ // -----------------------------------------------------------------------------
270
485
  // tool_name: String - Name of tool being called
271
486
  // resource_name: String - Name of resource being accessed
272
487
  // prompt_name: String - Name of prompt
@@ -283,7 +498,105 @@ action deploy_model appliesTo {
283
498
  // scheme: String - HTTP scheme
284
499
  // port: Long - Port number
285
500
  //
286
- // PALISADE:
501
+ // -----------------------------------------------------------------------------
502
+ // MODEL INVOCATION
503
+ // -----------------------------------------------------------------------------
504
+ // model_name: String - Name of the model (e.g., "gpt-4", "claude-3-opus")
505
+ // model_provider: String - Provider name (e.g., "openai", "anthropic", "google", "azure", "bedrock")
506
+ // is_preview_model: Bool - Whether model is in preview/beta
507
+ // estimated_tokens: Long - Estimated input + output tokens
508
+ // max_tokens: Long - Maximum tokens allowed for response
509
+ // temperature: Long - Temperature setting (scaled by 100, e.g., 70 = 0.7)
510
+ // top_p: Long - Top-p sampling (scaled by 100)
511
+ // is_streaming: Bool - Whether response is streamed
512
+ //
513
+ // -----------------------------------------------------------------------------
514
+ // CONTENT FILTERING
515
+ // -----------------------------------------------------------------------------
516
+ // content_type: String - Type of content ("text", "code", "image", "audio", "video")
517
+ // content_category: String - Category ("general", "adult", "violence", "hate", etc.)
518
+ // content_score: Long - Content risk score (0-100)
519
+ // injection_score: Long - Prompt injection detection score (0-100)
520
+ // jailbreak_score: Long - Jailbreak attempt detection score (0-100)
521
+ // contains_pii: Bool - Whether content contains PII
522
+ // pii_types: Set<String> - Types of PII detected ("email", "phone", "ssn", "credit_card", etc.)
523
+ // language: String - Detected language code (e.g., "en", "es", "zh")
524
+ // is_harmful: Bool - Whether content is harmful
525
+ // harm_categories: Set<String> - Categories of harm ("violence", "hate", "self_harm", "sexual", etc.)
526
+ // filter_action: String - Action to take ("inspect", "mask", "redact", "replace", "anonymize", "reject")
527
+ // csam_detected: Bool - Whether CSAM was detected
528
+ // hallucination_score: Long - Hallucination detection score (0-100)
529
+ //
530
+ // -----------------------------------------------------------------------------
531
+ // RATE LIMITING
532
+ // -----------------------------------------------------------------------------
533
+ // concurrent_calls: Long - Current number of concurrent calls
534
+ // requests_per_minute: Long - Current requests per minute
535
+ // tokens_per_minute: Long - Current tokens per minute
536
+ // rate_limit_bucket: String - Rate limit bucket identifier
537
+ // is_rate_limited: Bool - Whether rate limit is exceeded
538
+ //
539
+ // -----------------------------------------------------------------------------
540
+ // GIT OPERATIONS
541
+ // -----------------------------------------------------------------------------
542
+ // git_op: String - Type of git operation ("clone", "commit", "push", "pull", etc.)
543
+ // target_branch: String - Target branch name
544
+ // source_branch: String - Source branch name
545
+ // is_force_push: Bool - Whether this is a force push
546
+ // is_protected_branch: Bool - Whether target is a protected branch
547
+ // changed_files_count: Long - Number of files changed
548
+ // commit_message: String - Commit message text
549
+ // remote_url: String - Remote repository URL
550
+ // is_shallow: Bool - Whether clone is shallow
551
+ // depth: Long - Clone depth for shallow clones
552
+ // is_amend: Bool - Whether commit is an amend
553
+ // merge_strategy: String - Merge strategy ("merge", "rebase", "squash")
554
+ // is_hard_reset: Bool - Whether reset is hard (destructive)
555
+ // reset_mode: String - Reset mode ("soft", "mixed", "hard")
556
+ // is_interactive: Bool - Whether operation is interactive
557
+ //
558
+ // -----------------------------------------------------------------------------
559
+ // CODE EXECUTION
560
+ // -----------------------------------------------------------------------------
561
+ // code_language: String - Programming language ("python", "javascript", "go", etc.)
562
+ // is_sandboxed: Bool - Whether code runs in a sandbox
563
+ // code_size_bytes: Long - Size of code in bytes
564
+ // has_network_access: Bool - Whether code has network access
565
+ // has_filesystem_access: Bool - Whether code has filesystem access
566
+ // execution_timeout_ms: Long - Execution timeout in milliseconds
567
+ // test_framework: String - Test framework being used
568
+ // test_count: Long - Number of tests being run
569
+ // build_tool: String - Build tool being used
570
+ //
571
+ // -----------------------------------------------------------------------------
572
+ // AGENT ORCHESTRATION
573
+ // -----------------------------------------------------------------------------
574
+ // delegation_depth: Long - Current delegation nesting depth
575
+ // parent_agent_id: String - ID of parent agent (if delegated)
576
+ // task_type: String - Type of task being performed
577
+ // is_autonomous: Bool - Whether agent is operating autonomously
578
+ // session_id: String - Agent session identifier
579
+ // process_name: String - Name of subprocess being spawned
580
+ //
581
+ // -----------------------------------------------------------------------------
582
+ // MEMORY/RAG
583
+ // -----------------------------------------------------------------------------
584
+ // memory_type: String - Type of memory ("short_term", "long_term", "rag", "vector_store")
585
+ // memory_operation: String - Operation being performed ("read", "write", "delete", "search")
586
+ // memory_is_sensitive: Bool - Whether memory contains sensitive data
587
+ //
588
+ // -----------------------------------------------------------------------------
589
+ // DATA LOSS PREVENTION (DLP)
590
+ // -----------------------------------------------------------------------------
591
+ // data_classification: String - Classification level ("public", "internal", "confidential", "restricted")
592
+ // destination_type: String - Where data is going ("internal", "external", "cloud", "email")
593
+ // transfer_size_bytes: Long - Size of data being transferred
594
+ // is_encrypted: Bool - Whether data is encrypted
595
+ // export_format: String - Format of exported data ("json", "csv", "pdf", etc.)
596
+ //
597
+ // -----------------------------------------------------------------------------
598
+ // PALISADE/ML
599
+ // -----------------------------------------------------------------------------
287
600
  // environment: String - "production", "development", "research"
288
601
  // artifact_format: String - "pickle", "safetensors", "gguf", "onnx"
289
602
  // artifact_signed: Bool - Whether artifact has signature
@@ -297,5 +610,6 @@ action deploy_model appliesTo {
297
610
  // gguf_suspicious_metadata: Bool - Suspicious GGUF metadata
298
611
  // adapter_base_digest_mismatch: Bool - LoRA adapter digest mismatch
299
612
  // metadata_cosai_level_numeric: Long - CoSAI maturity level (0-5)
613
+ //
300
614
  `;
301
615
  //# sourceMappingURL=schema.gen.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.gen.js","sourceRoot":"","sources":["../src/schema.gen.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,uCAAuC;AAEvC;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqS3B,CAAC"}
1
+ {"version":3,"file":"schema.gen.js","sourceRoot":"","sources":["../src/schema.gen.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,uCAAuC;AAEvC;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+lB3B,CAAC"}