@peac/kernel 0.11.0 → 0.11.2
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.
- package/README.md +9 -0
- package/dist/__tests__/carrier.test.d.ts +2 -0
- package/dist/__tests__/carrier.test.d.ts.map +1 -0
- package/dist/carrier.d.ts +113 -0
- package/dist/carrier.d.ts.map +1 -0
- package/dist/error-categories.generated.d.ts +1 -1
- package/dist/errors.cjs +343 -143
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.generated.d.ts +9 -3
- package/dist/errors.generated.d.ts.map +1 -1
- package/dist/errors.mjs +343 -143
- package/dist/errors.mjs.map +1 -1
- package/dist/index.cjs +349 -143
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +347 -143
- package/dist/index.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.ts +10 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,6 +12,15 @@ pnpm add @peac/kernel
|
|
|
12
12
|
|
|
13
13
|
See [peacprotocol.org](https://www.peacprotocol.org) for full documentation.
|
|
14
14
|
|
|
15
|
+
## For Agent Developers
|
|
16
|
+
|
|
17
|
+
If you are building an AI agent or MCP server that needs evidence receipts:
|
|
18
|
+
|
|
19
|
+
- Start with [`@peac/mcp-server`](https://www.npmjs.com/package/@peac/mcp-server) for a ready-to-use MCP tool server
|
|
20
|
+
- See the [llms.txt](https://github.com/peacprotocol/peac/blob/main/llms.txt) for a concise overview of all packages
|
|
21
|
+
- Use `@peac/protocol` for programmatic receipt issuance and verification
|
|
22
|
+
- Use `@peac/kernel` types (`PeacEvidenceCarrier`, `ErrorDefinition`) for type-safe integration
|
|
23
|
+
|
|
15
24
|
## License
|
|
16
25
|
|
|
17
26
|
Apache-2.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carrier.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/carrier.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evidence Carrier Contract types (DD-124)
|
|
3
|
+
*
|
|
4
|
+
* Pure TypeScript types for the universal evidence carry interface.
|
|
5
|
+
* Zero runtime dependencies: this module exports only types.
|
|
6
|
+
*
|
|
7
|
+
* The Evidence Carrier Contract defines how any protocol (MCP, A2A, ACP,
|
|
8
|
+
* UCP, x402, HTTP) carries PEAC receipts without kernel changes.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Canonical HTTP header name for PEAC receipts (DD-127).
|
|
12
|
+
*
|
|
13
|
+
* The wire token is exactly "PEAC-Receipt" (mixed-case, hyphenated).
|
|
14
|
+
* This is the only valid spelling in conformance fixtures and attach() output.
|
|
15
|
+
* HTTP header lookups SHOULD be case-insensitive per RFC 9110, but conformance
|
|
16
|
+
* fixtures and attach() output MUST use this exact spelling.
|
|
17
|
+
*/
|
|
18
|
+
export declare const PEAC_RECEIPT_HEADER: "PEAC-Receipt";
|
|
19
|
+
/**
|
|
20
|
+
* Canonical HTTP header name for receipt URL locator hint (DD-135).
|
|
21
|
+
*
|
|
22
|
+
* HTTPS-only, max 2048 chars, no credentials.
|
|
23
|
+
* MUST NOT trigger implicit fetch (DD-55).
|
|
24
|
+
*/
|
|
25
|
+
export declare const PEAC_RECEIPT_URL_HEADER: "PEAC-Receipt-URL";
|
|
26
|
+
/** Content-addressed receipt reference: SHA-256 of the compact JWS bytes */
|
|
27
|
+
export type ReceiptRef = `sha256:${string}`;
|
|
28
|
+
/** Carrier format: embed (inline) or reference (URL/pointer) */
|
|
29
|
+
export type CarrierFormat = 'embed' | 'reference';
|
|
30
|
+
/**
|
|
31
|
+
* Universal evidence carrier.
|
|
32
|
+
*
|
|
33
|
+
* Every protocol-specific adapter produces and consumes this shape.
|
|
34
|
+
* Fields marked optional are SHOULD or MAY per the carrier contract spec.
|
|
35
|
+
*/
|
|
36
|
+
export interface PeacEvidenceCarrier {
|
|
37
|
+
/** Content-addressed receipt reference (MUST): sha256:<hex64> */
|
|
38
|
+
receipt_ref: ReceiptRef;
|
|
39
|
+
/** Compact JWS of the signed receipt (SHOULD for embed format) */
|
|
40
|
+
receipt_jws?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Locator hint for detached receipt resolution (DD-135).
|
|
43
|
+
* HTTPS-only, max 2048 chars, no credentials.
|
|
44
|
+
* MUST NOT trigger implicit fetch (DD-55).
|
|
45
|
+
* If a caller fetches, it MUST verify sha256(receipt_jws) == receipt_ref.
|
|
46
|
+
*/
|
|
47
|
+
receipt_url?: string;
|
|
48
|
+
/** Policy binding hash for verification (MAY) */
|
|
49
|
+
policy_binding?: string;
|
|
50
|
+
/** Actor binding identifier (MAY) */
|
|
51
|
+
actor_binding?: string;
|
|
52
|
+
/** Request nonce for replay protection (MAY) */
|
|
53
|
+
request_nonce?: string;
|
|
54
|
+
/** Reference to a verification report (MAY) */
|
|
55
|
+
verification_report_ref?: string;
|
|
56
|
+
/** Reference to a use policy (MAY) */
|
|
57
|
+
use_policy_ref?: string;
|
|
58
|
+
/** Reference to a representation (MAY) */
|
|
59
|
+
representation_ref?: string;
|
|
60
|
+
/** Reference to an attestation (MAY) */
|
|
61
|
+
attestation_ref?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Transport-level metadata describing how a carrier is placed.
|
|
65
|
+
*
|
|
66
|
+
* Used by validateConstraints() to enforce transport-specific size limits
|
|
67
|
+
* and format requirements (DD-127).
|
|
68
|
+
*/
|
|
69
|
+
export interface CarrierMeta {
|
|
70
|
+
/** Transport identifier (e.g. 'mcp', 'a2a', 'acp', 'ucp', 'x402', 'http') */
|
|
71
|
+
transport: string;
|
|
72
|
+
/** Carrier format: embed or reference */
|
|
73
|
+
format: CarrierFormat;
|
|
74
|
+
/** Maximum carrier size in bytes for this transport */
|
|
75
|
+
max_size: number;
|
|
76
|
+
/** Fields that have been redacted (MAY) */
|
|
77
|
+
redaction?: string[];
|
|
78
|
+
}
|
|
79
|
+
/** Result of carrier constraint validation */
|
|
80
|
+
export interface CarrierValidationResult {
|
|
81
|
+
valid: boolean;
|
|
82
|
+
violations: string[];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Protocol-specific carrier adapter (DD-124).
|
|
86
|
+
*
|
|
87
|
+
* Each protocol mapping implements this interface to attach/extract
|
|
88
|
+
* PEAC evidence carriers in the protocol's native format.
|
|
89
|
+
*
|
|
90
|
+
* @typeParam TInput - The protocol-specific input type (e.g. A2A TaskStatus)
|
|
91
|
+
* @typeParam TOutput - The protocol-specific output type
|
|
92
|
+
*/
|
|
93
|
+
export interface CarrierAdapter<TInput, TOutput> {
|
|
94
|
+
/**
|
|
95
|
+
* Extract PEAC evidence carriers from a protocol message.
|
|
96
|
+
* Returns null if no carrier is present.
|
|
97
|
+
*/
|
|
98
|
+
extract(input: TInput): {
|
|
99
|
+
receipts: PeacEvidenceCarrier[];
|
|
100
|
+
meta: CarrierMeta;
|
|
101
|
+
} | null;
|
|
102
|
+
/**
|
|
103
|
+
* Attach PEAC evidence carriers to a protocol message.
|
|
104
|
+
* Returns the modified output with carriers placed per protocol conventions.
|
|
105
|
+
*/
|
|
106
|
+
attach(output: TOutput, carriers: PeacEvidenceCarrier[], meta?: CarrierMeta): TOutput;
|
|
107
|
+
/**
|
|
108
|
+
* Validate a carrier against transport-specific constraints (DD-127, DD-129).
|
|
109
|
+
* Takes CarrierMeta for transport-aware size and format validation.
|
|
110
|
+
*/
|
|
111
|
+
validateConstraints(carrier: PeacEvidenceCarrier, meta: CarrierMeta): CarrierValidationResult;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=carrier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carrier.d.ts","sourceRoot":"","sources":["../src/carrier.ts"],"names":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