New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@ai-operations/ops-policy

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ai-operations/ops-policy

Policy engine for AI Operations OS — rule evaluation, autonomy levels, budget enforcement, escalation logic

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

@ai-operations/ops-policy

Business rules, autonomy levels, escalation paths, and budget tracking for AI Operations OS.

Part of AI Operations OS — autonomous business workflow orchestration with safety enforcement.

Install

npm install @ai-operations/ops-policy

Quick Start

import { AutonomyManager, BudgetTracker } from '@ai-operations/ops-policy';
import { DEFAULT_POLICY } from '@ai-operations/shared-types';

const manager = new AutonomyManager(DEFAULT_POLICY);
const decision = manager.canExecute('gmail', 'send', { source: 'email' });

if (decision.allowed && !decision.requiresApproval) {
  // Safe to execute autonomously
  manager.recordAction();
}

API

RuleEngine

Evaluates policy rules against connector operations. Rules are checked in priority order (highest first); the first matching rule wins.

constructor(config: PolicyConfig)
evaluate(connector: string, operation: string, context?: EvaluationContext): EvaluationResult
  • EvaluationContext{ source?: string; intent?: string; amount?: number }
  • EvaluationResult{ autonomy: AutonomyLevel; risk: RiskLevel; matchedRule?: PolicyRule; reason: string }

AutonomyManager

Wraps RuleEngine with rate limiting (hourly action counts, daily spend limits). Provides the primary canExecute interface for the orchestration layer.

constructor(config: PolicyConfig)
canExecute(connector: string, operation: string, context?: EvaluationContext): AutonomyDecision
recordAction(amount?: number): void
resetCounters(): void
getDailySpend(): number
getHourlyActionCount(): number
  • AutonomyDecision{ allowed: boolean; requiresApproval: boolean; reason: string }

EscalationManager

Tracks denial counts per task and determines when and to whom issues should be escalated. Prevents tasks from being silently stuck in denial loops.

constructor(config?: EscalationConfig)
shouldEscalate(taskId: string, denialCount: number): boolean
getEscalationTarget(taskId: string): EscalationTarget | undefined
recordDenial(taskId: string): void
recordEscalation(taskId: string, target: EscalationTarget): void
clearState(taskId: string): void
  • EscalationTarget{ role: string; channel: string; urgency: 'low' | 'normal' | 'high' | 'critical' }

BudgetTracker

Fine-grained spending management with global daily limits and per-connector breakdowns. Auto-resets at midnight.

constructor(dailyLimit?: number, connectorLimits?: Record<string, number>)
canSpend(amount: number, connector: string): { allowed: boolean; reason: string }
recordSpend(amount: number, connector: string): void
getDailyTotal(): number
getConnectorTotal(connector: string): number
getBreakdown(): Record<string, number>
getRemainingBudget(): number
setConnectorLimit(connector: string, limit: number): void

License

MIT

Keywords

ai-ops

FAQs

Package last updated on 10 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts