trellis
Version:
Agentic State Engine — event-sourced causal graph with branching, decision traces, and realtime sync for AI-native applications
54 lines • 1.71 kB
TypeScript
/**
* Governance Module
*
* DESIGN.md §6.3–6.4 — Policy nodes and governance enforcement.
*
* Policy rules are expressed as EAV entities. The governance engine evaluates
* ops against applicable policies before allowing them through.
*/
import type { VcsOp } from '../vcs/types.js';
import type { IdentityResolver } from './signing-middleware.js';
export interface PolicyRule {
id: string;
/** What this policy protects. */
target: 'branch' | 'path' | 'entityType';
targetPattern: string;
/** What action requires authorization. */
action: 'push' | 'merge' | 'createMilestone' | 'deleteBranch';
/** Who is authorized (identity entity IDs). */
requiredSigners: string[];
/** Minimum number of valid signatures required. */
minSignatures: number;
/** Optional: require CI attestation. */
requireAttestation?: {
type: 'test-pass' | 'build-pass' | 'review-approved';
from: string;
};
/** Whether this policy is active. */
enabled: boolean;
}
export interface PolicyViolation {
policyId: string;
op: VcsOp;
reason: string;
}
export interface GovernanceResult {
allowed: boolean;
violations: PolicyViolation[];
}
/**
* Evaluate an op against a set of policies.
*/
export declare function evaluatePolicy(op: VcsOp, policies: PolicyRule[], resolver: IdentityResolver): Promise<GovernanceResult>;
/**
* Create a new policy rule.
*/
export declare function createPolicy(opts: {
id: string;
target: PolicyRule['target'];
targetPattern: string;
action: PolicyRule['action'];
requiredSigners: string[];
minSignatures?: number;
}): PolicyRule;
//# sourceMappingURL=governance.d.ts.map