Skip to content

Commit a6a1de3

Browse files
authored
chore: v0.9.8.1 to 0.9.8.2: SSOT, JWKS, OpenAPI (#44)
- Wire SSOT=0.9.8 - README samples lowercase - MCP discovery gated - JWKS If-None-Match list handling - OpenAPI license Apache-2.0 - Jest CJS - explicit server→schema dep.
1 parent 164da3e commit a6a1de3

File tree

21 files changed

+158
-102
lines changed

21 files changed

+158
-102
lines changed

README.md

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Autonomous clients need predictable, auditable policy and trust rails. With well
3737
## At a glance
3838

3939
- **Discovery:** `/.well-known/peac.txt` (fallback `/peac.txt`)
40-
- **Wire version:** `0.9.11` (set header `X-PEAC-Protocol: 0.9.11`; emit lowercase on wire if you prefer)
40+
- **Wire version:** `0.9.8` (set header `x-peac-protocol: 0.9.8`)
4141
- **Headers:** lowercase `x-peac-*`; parsers MUST treat header names case-insensitively
4242
- **Media:** `application/peac+json` (content), `application/problem+json` (errors), `application/jwk-set+json` (JWKS)
4343
- **Receipts:** detached JWS (`typ: application/peac-receipt+jws`) using JCS
@@ -76,7 +76,7 @@ Autonomous clients need predictable, auditable policy and trust rails. With well
7676
pnpm add -g @peacprotocol/cli @peacprotocol/core
7777

7878
npx peac init # scaffold peac.txt with defaults
79-
npx peac validate peac.txt # Expected: Valid PEAC 0.9.11 policy
79+
npx peac validate peac.txt # Expected: Valid PEAC 0.9.8 policy
8080

8181
# Preferred path
8282
# /.well-known/peac.txt
@@ -117,7 +117,7 @@ Common pitfalls: invalid schema returns `application/problem+json` 400.
117117

118118
---
119119

120-
## Minimal `peac.txt` (0.9.11 wire)
120+
## Minimal `peac.txt` (docs train 0.9.11, wire 0.9.8)
121121

122122
```txt
123123
# /.well-known/peac.txt
@@ -171,14 +171,14 @@ More examples: [docs/examples.md](docs/examples.md)
171171

172172
Adapters bridge PEAC to payment rails, agent protocols, provenance, and chains. Lifecycle: simulation → staging → production.
173173

174-
| Adapter | Status (0.9.11) | Notes |
175-
| ---------- | --------------- | ------------------------------ |
176-
| **MCP** | Beta | Agent protocol adapter |
177-
| **A2A** | Beta | Agent-to-Agent negotiation |
178-
| **x402** | Stable | Payment rail |
179-
| **Stripe** | Stable | Payment rail |
180-
| Chainlink | Preview | Oracle/provenance integrations |
181-
| peaq | Preview | DePIN/IoT sharing + receipts |
174+
| Adapter | Status (0.9.11 docs) | Notes |
175+
| ---------- | -------------------- | ------------------------------ |
176+
| **MCP** | Beta | Agent protocol adapter |
177+
| **A2A** | Beta | Agent-to-Agent negotiation |
178+
| **x402** | Stable | Payment rail |
179+
| **Stripe** | Stable | Payment rail |
180+
| Chainlink | Preview | Oracle/provenance integrations |
181+
| peaq | Preview | DePIN/IoT sharing + receipts |
182182

183183
Details & examples: [docs/interop.md](docs/interop.md) · Propose new adapters via [PEIPs](docs/peips.md)
184184

@@ -221,6 +221,38 @@ if (access.granted) {
221221

222222
## HTTP semantics & samples
223223

224+
**Example API request with curl:**
225+
226+
```bash
227+
curl -X POST https://demo.peac.dev/peac/agreements \
228+
-H "x-peac-protocol: 0.9.8" \
229+
-H "content-type: application/json" \
230+
-H "x-api-key: your-key" \
231+
-d '{
232+
"capabilities": ["read", "summarize"],
233+
"max_charge": "5.00",
234+
"currency": "USD"
235+
}'
236+
```
237+
238+
**JavaScript example:**
239+
240+
```javascript
241+
const response = await fetch('https://demo.peac.dev/peac/agreements', {
242+
method: 'POST',
243+
headers: {
244+
'x-peac-protocol': '0.9.8',
245+
'content-type': 'application/json',
246+
'x-api-key': apiKey,
247+
},
248+
body: JSON.stringify({
249+
capabilities: ['read', 'summarize'],
250+
max_charge: '5.00',
251+
currency: 'USD',
252+
}),
253+
});
254+
```
255+
224256
**400 Bad Request** (validation error)
225257

226258
```json

openapi/openapi.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ info:
55
x-release: 0.9.8
66
description: Agreement-first API for PEAC Protocol v0.9.8 with payment binding and secure webhooks
77
license:
8-
name: MIT
9-
url: https://opensource.org/licenses/MIT
8+
name: Apache-2.0
9+
url: https://www.apache.org/licenses/LICENSE-2.0
1010
contact:
1111
name: PEAC Protocol Team
1212
url: https://github.com/peacprotocol/peac

package-lock.json

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/schema/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export * from './schemas';
22
export * from './types';
3+
export { WIRE_VERSION, DOCS_TRAIN } from './version';

packages/schema/src/schemas.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
// PEAC Protocol v0.9.5 Schema definitions
2-
export const PEAC_VERSION = '0.9.5';
3-
export const SCHEMA_VERSION = '0.9.5';
1+
import { WIRE_VERSION } from './version';
2+
3+
export const PEAC_VERSION = WIRE_VERSION;
4+
export const SCHEMA_VERSION = WIRE_VERSION;

packages/schema/src/version.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const WIRE_VERSION = '0.9.8';
2+
export const DOCS_TRAIN = '0.9.11';

packages/server/.env.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ REDIS_URL=redis://localhost:6379
99
SESSION_PRIVATE_KEY_PATH=./keys/session-private.pem
1010
SESSION_PUBLIC_KEY_PATH=./keys/session-public.pem
1111

12+
# MCP discovery (exposed only when enabled)
13+
PEAC_MCP_ENABLED=false
14+
MCP_ENDPOINT=https://your-mcp-endpoint.com
15+
16+
# Existing payment config unchanged
17+
PAYMENT_PROVIDER=x402 # or credits
18+
1219
# Optional
1320
LOG_LEVEL=info
1421
RATE_LIMIT_WINDOW=60000

packages/server/jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @type {import('jest').Config} */
2-
export default {
2+
module.exports = {
33
preset: 'ts-jest',
44
testEnvironment: 'node',
55

packages/server/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"prepublishOnly": "npm run build && npm run test:coverage && npm run sbom"
4848
},
4949
"dependencies": {
50+
"@peacprotocol/schema": "file:../schema",
5051
"bullmq": "^5.1.0",
5152
"canonicalize": "^2.0.0",
5253
"cors": "^2.8.5",
@@ -72,11 +73,11 @@
7273
"@types/cors": "^2.8.17",
7374
"@types/express": "^4.17.21",
7475
"@types/jest": "^29.5.11",
75-
"chokidar": "^3.6.0",
7676
"@types/node": "^20.11.0",
7777
"@types/supertest": "^6.0.2",
7878
"@typescript-eslint/eslint-plugin": "^6.21.0",
7979
"@typescript-eslint/parser": "^6.21.0",
80+
"chokidar": "^3.6.0",
8081
"eslint": "^8.57.1",
8182
"ioredis-mock": "^8.9.0",
8283
"jest": "^29.7.0",

packages/server/src/discovery/v1.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as crypto from 'crypto';
33
import pino from 'pino';
44
import { AdapterRegistry } from '../adapters/registry';
55
import { deepMerge } from '../utils/deep-merge';
6+
import { WIRE_VERSION } from '@peacprotocol/schema';
67

78
const logger = pino({ name: 'discovery' });
89

@@ -39,8 +40,8 @@ export class DiscoveryService {
3940

4041
const base = {
4142
protocol: 'PEAC',
42-
version: this.config.version,
43-
'x-release': this.config.x_release,
43+
version: WIRE_VERSION,
44+
'x-release': WIRE_VERSION,
4445

4546
endpoints: {
4647
agreements: {
@@ -129,14 +130,26 @@ export class DiscoveryService {
129130
},
130131

131132
version_negotiation: {
132-
request_header: 'X-PEAC-Protocol',
133-
current: this.config.x_release,
134-
supported: [this.config.x_release],
133+
request_header: 'x-peac-protocol',
134+
current: WIRE_VERSION,
135+
supported: [WIRE_VERSION],
135136
},
136137
};
137138

138139
const adapterFragments = this.adapterRegistry.composeDiscovery();
139-
const document = deepMerge(base, adapterFragments);
140+
let document = deepMerge(base, adapterFragments);
141+
142+
if (process.env.PEAC_MCP_ENABLED === 'true') {
143+
document = deepMerge(document, {
144+
adapters: {
145+
mcp: {
146+
enabled: true,
147+
tools: ['peac.negotiate', 'peac.pay', 'peac.verify'],
148+
endpoint: process.env.MCP_ENDPOINT,
149+
},
150+
},
151+
});
152+
}
140153

141154
const content = JSON.stringify(document);
142155
const etag = `"${crypto.createHash('sha256').update(content).digest('hex')}"`;

0 commit comments

Comments
 (0)