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

@peac/control

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@peac/control

PEAC Protocol Control - control engine interfaces and validation

next
latest
Source
npmnpm
Version
0.12.6
Version published
Maintainers
1
Created
Source

@peac/control

PEAC protocol control engine: constraint enforcement, control block validation, and state management.

Installation

pnpm add @peac/control

What It Does

@peac/control provides the Control Abstraction Layer (CAL) for the PEAC protocol. It defines vendor-neutral control engine interfaces, constraint types (temporal, usage, budget), enforcement logic, and state management for tracking receipt usage over time. Control engines evaluate whether a receipt's constraints are satisfied before granting access.

How Do I Use It?

Enforce a temporal constraint

import { enforceTemporalConstraint } from '@peac/control';

const result = enforceTemporalConstraint({
  type: 'temporal',
  valid_from: 1700000000,
  valid_until: 1700086400,
});

console.log(result.allowed); // true or false
console.log(result.remaining?.seconds); // seconds until expiry

Track usage state across multiple interactions

import { createControlState, updateStateAfterUse, isStateExpired } from '@peac/control';

const state = createControlState('receipt-123', {
  type: 'usage',
  max_uses: 10,
});

const updated = updateStateAfterUse(state);
console.log(updated.usage_count); // 1
console.log(isStateExpired(updated)); // false

Register a custom control engine adapter

import { ControlEngineRegistry } from '@peac/control';
import type { ControlEngineAdapter } from '@peac/control';

const myEngine: ControlEngineAdapter = {
  name: 'my-engine',
  evaluate: async (context) => ({
    result: 'allow',
    evidence: { engine: 'my-engine', checked_at: new Date().toISOString() },
  }),
};

const registry = new ControlEngineRegistry();
registry.register(myEngine);

Integrates With

  • @peac/schema (Layer 1): Control block and constraint Zod schemas
  • @peac/protocol (Layer 3): Receipt issuance with embedded control blocks
  • @peac/kernel (Layer 0): Types and constants used by control logic

For Agent Developers

If you are building an AI agent or MCP server that needs evidence receipts:

  • Start with @peac/mcp-server for a ready-to-use MCP tool server
  • Use @peac/protocol for programmatic receipt issuance and verification
  • See the llms.txt for a concise overview

License

Apache-2.0

PEAC Protocol is an open source project stewarded by Originary and community contributors.

Docs | GitHub | Originary

Keywords

peac

FAQs

Package last updated on 01 Apr 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