@peac/control 0.12.5 → 0.12.7

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.
Files changed (2) hide show
  1. package/README.md +67 -3
  2. package/package.json +20 -4
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @peac/control
2
2
 
3
- PEAC Protocol Control - control engine interfaces and validation
3
+ PEAC protocol control engine: constraint enforcement, control block validation, and state management.
4
4
 
5
5
  ## Installation
6
6
 
@@ -8,9 +8,73 @@ PEAC Protocol Control - control engine interfaces and validation
8
8
  pnpm add @peac/control
9
9
  ```
10
10
 
11
- ## Documentation
11
+ ## What It Does
12
12
 
13
- See [peacprotocol.org](https://www.peacprotocol.org) for full documentation.
13
+ `@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.
14
+
15
+ ## How Do I Use It?
16
+
17
+ ### Enforce a temporal constraint
18
+
19
+ ```typescript
20
+ import { enforceTemporalConstraint } from '@peac/control';
21
+
22
+ const result = enforceTemporalConstraint({
23
+ type: 'temporal',
24
+ valid_from: 1700000000,
25
+ valid_until: 1700086400,
26
+ });
27
+
28
+ console.log(result.allowed); // true or false
29
+ console.log(result.remaining?.seconds); // seconds until expiry
30
+ ```
31
+
32
+ ### Track usage state across multiple interactions
33
+
34
+ ```typescript
35
+ import { createControlState, updateStateAfterUse, isStateExpired } from '@peac/control';
36
+
37
+ const state = createControlState('receipt-123', {
38
+ type: 'usage',
39
+ max_uses: 10,
40
+ });
41
+
42
+ const updated = updateStateAfterUse(state);
43
+ console.log(updated.usage_count); // 1
44
+ console.log(isStateExpired(updated)); // false
45
+ ```
46
+
47
+ ### Register a custom control engine adapter
48
+
49
+ ```typescript
50
+ import { ControlEngineRegistry } from '@peac/control';
51
+ import type { ControlEngineAdapter } from '@peac/control';
52
+
53
+ const myEngine: ControlEngineAdapter = {
54
+ name: 'my-engine',
55
+ evaluate: async (context) => ({
56
+ result: 'allow',
57
+ evidence: { engine: 'my-engine', checked_at: new Date().toISOString() },
58
+ }),
59
+ };
60
+
61
+ const registry = new ControlEngineRegistry();
62
+ registry.register(myEngine);
63
+ ```
64
+
65
+ ## Integrates With
66
+
67
+ - `@peac/schema` (Layer 1): Control block and constraint Zod schemas
68
+ - `@peac/protocol` (Layer 3): Receipt issuance with embedded control blocks
69
+ - `@peac/kernel` (Layer 0): Types and constants used by control logic
70
+
71
+ ## For Agent Developers
72
+
73
+ If you are building an AI agent or MCP server that needs evidence receipts:
74
+
75
+ - Start with [`@peac/mcp-server`](https://www.npmjs.com/package/@peac/mcp-server) for a ready-to-use MCP tool server
76
+ - Use `@peac/protocol` for programmatic receipt issuance and verification
77
+ - See the [llms.txt](https://github.com/peacprotocol/peac/blob/main/llms.txt) for a concise overview
14
78
 
15
79
  ## License
16
80
 
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@peac/control",
3
- "version": "0.12.5",
3
+ "version": "0.12.7",
4
4
  "description": "PEAC Protocol Control - control engine interfaces and validation",
5
5
  "main": "dist/index.cjs",
6
6
  "types": "dist/index.d.ts",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/peacprotocol/peac.git",
9
+ "url": "git+https://github.com/peacprotocol/peac.git",
10
10
  "directory": "packages/control"
11
11
  },
12
- "author": "jithinraj <7850727+jithinraj@users.noreply.github.com>",
12
+ "author": "PEAC Protocol Contributors",
13
13
  "license": "Apache-2.0",
14
14
  "files": [
15
15
  "dist",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "zod": "^4.3.6",
23
- "@peac/schema": "0.12.5"
23
+ "@peac/schema": "0.12.7"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "^22.19.11",
@@ -37,6 +37,22 @@
37
37
  },
38
38
  "./package.json": "./package.json"
39
39
  },
40
+ "bugs": {
41
+ "url": "https://github.com/peacprotocol/peac/issues"
42
+ },
43
+ "homepage": "https://github.com/peacprotocol/peac#readme",
44
+ "keywords": [
45
+ "peac",
46
+ "peacprotocol",
47
+ "interaction-records",
48
+ "signed-records",
49
+ "receipts",
50
+ "originary",
51
+ "policy",
52
+ "enforcement",
53
+ "decision",
54
+ "access-control"
55
+ ],
40
56
  "scripts": {
41
57
  "prebuild": "rm -rf dist",
42
58
  "build": "pnpm run build:js && pnpm run build:types",