agent-passport-system 1.28.0 → 1.29.1
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 +42 -8
- package/dist/src/adapters/openshell.d.ts +64 -0
- package/dist/src/adapters/openshell.d.ts.map +1 -0
- package/dist/src/adapters/openshell.js +126 -0
- package/dist/src/adapters/openshell.js.map +1 -0
- package/dist/src/core/anchor-state.d.ts +46 -0
- package/dist/src/core/anchor-state.d.ts.map +1 -0
- package/dist/src/core/anchor-state.js +80 -0
- package/dist/src/core/anchor-state.js.map +1 -0
- package/dist/src/core/attestation.d.ts +35 -0
- package/dist/src/core/attestation.d.ts.map +1 -0
- package/dist/src/core/attestation.js +233 -0
- package/dist/src/core/attestation.js.map +1 -0
- package/dist/src/core/canonical-jcs.d.ts +23 -0
- package/dist/src/core/canonical-jcs.d.ts.map +1 -0
- package/dist/src/core/canonical-jcs.js +125 -0
- package/dist/src/core/canonical-jcs.js.map +1 -0
- package/dist/src/core/data-narrowing.d.ts +43 -0
- package/dist/src/core/data-narrowing.d.ts.map +1 -0
- package/dist/src/core/data-narrowing.js +97 -0
- package/dist/src/core/data-narrowing.js.map +1 -0
- package/dist/src/core/denial-domains.d.ts +43 -0
- package/dist/src/core/denial-domains.d.ts.map +1 -0
- package/dist/src/core/denial-domains.js +153 -0
- package/dist/src/core/denial-domains.js.map +1 -0
- package/dist/src/core/fidelity-probe.d.ts +45 -0
- package/dist/src/core/fidelity-probe.d.ts.map +1 -1
- package/dist/src/core/fidelity-probe.js +39 -1
- package/dist/src/core/fidelity-probe.js.map +1 -1
- package/dist/src/core/governance-posture.d.ts +72 -0
- package/dist/src/core/governance-posture.d.ts.map +1 -0
- package/dist/src/core/governance-posture.js +173 -0
- package/dist/src/core/governance-posture.js.map +1 -0
- package/dist/src/core/passport.d.ts +15 -0
- package/dist/src/core/passport.d.ts.map +1 -1
- package/dist/src/core/passport.js +45 -1
- package/dist/src/core/passport.js.map +1 -1
- package/dist/src/core/reputation-authority.d.ts +13 -4
- package/dist/src/core/reputation-authority.d.ts.map +1 -1
- package/dist/src/core/reputation-authority.js +29 -5
- package/dist/src/core/reputation-authority.js.map +1 -1
- package/dist/src/index.d.ts +18 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +15 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/types/attestation.d.ts +160 -0
- package/dist/src/types/attestation.d.ts.map +1 -0
- package/dist/src/types/attestation.js +20 -0
- package/dist/src/types/attestation.js.map +1 -0
- package/dist/src/types/passport.d.ts +9 -0
- package/dist/src/types/passport.d.ts.map +1 -1
- package/dist/src/types/passport.js.map +1 -1
- package/dist/src/types/reputation-authority.d.ts +4 -0
- package/dist/src/types/reputation-authority.d.ts.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/agent-passport-system)
|
|
4
4
|
[](https://github.com/aeoess/agent-passport-system/blob/main/LICENSE)
|
|
5
|
-
[](https://github.com/aeoess/agent-passport-system)
|
|
6
6
|
[](https://doi.org/10.5281/zenodo.18749779)
|
|
7
|
+
[-blue)](https://doi.org/10.5281/zenodo.19323172)
|
|
7
8
|
|
|
8
|
-
> **For AI agents:** visit [aeoess.com/llms.txt](https://aeoess.com/llms.txt) for machine-readable docs or [llms-full.txt](https://aeoess.com/llms-full.txt) for the complete reference.
|
|
9
|
+
> **For AI agents:** visit [aeoess.com/llms.txt](https://aeoess.com/llms.txt) for machine-readable docs or [llms-full.txt](https://aeoess.com/llms-full.txt) for the complete reference. MCP discovery: [.well-known/mcp.json](https://aeoess.com/.well-known/mcp.json).
|
|
9
10
|
|
|
10
|
-
**
|
|
11
|
+
**Enforcement infrastructure for the agent economy.** Every action evaluated in under 2ms. 15 constraint dimensions. 403 ops/sec. Sub-millisecond denial. Feeless Nano payments. 95 modules. 1,919 tests. Not just identity — the full enforcement stack.
|
|
11
12
|
|
|
12
|
-
AI agents represent companies and people. They spend real money, access sensitive data, negotiate contracts, and talk to other agents. APS answers: what is this agent allowed to do? How much can it spend? Is it trustworthy? What happens when it violates a constraint? And can you prove all of this cryptographically?
|
|
13
|
+
AI agents represent companies and people. They spend real money, access sensitive data, negotiate contracts, and talk to other agents. APS is the enforcement layer that answers: what is this agent allowed to do? How much can it spend? Is it trustworthy? What happens when it violates a constraint? And can you prove all of this cryptographically? Independently validated by [PDR in Production (Nanook & Gerundium, UBC)](https://doi.org/10.5281/zenodo.19323172).
|
|
13
14
|
|
|
14
15
|
```bash
|
|
15
16
|
npm install agent-passport-system
|
|
@@ -27,6 +28,21 @@ npm install agent-passport-system
|
|
|
27
28
|
|
|
28
29
|
**Revoke authority instantly** — cascade revocation propagates through delegation chains. Revoke a parent, all children are automatically revoked. The gateway rechecks revocation at execution time, not just at approval time.
|
|
29
30
|
|
|
31
|
+
## Benchmarks
|
|
32
|
+
|
|
33
|
+
| Metric | Value | Notes |
|
|
34
|
+
|--------|------:|-------|
|
|
35
|
+
| Policy eval p50 | <2ms | Full 15-dimension constraint check |
|
|
36
|
+
| Policy eval p95 | <5ms | Including reputation lookup |
|
|
37
|
+
| Policy eval p99 | <10ms | Worst case with cold cache |
|
|
38
|
+
| Denial latency | <1ms | Fail-fast on first constraint violation |
|
|
39
|
+
| Throughput | 403 ops/sec | Single-threaded gateway |
|
|
40
|
+
| Cascade revocation | <5ms | Chains up to 100 deep |
|
|
41
|
+
| Receipt generation | <1ms | Ed25519 signed, hash-chained |
|
|
42
|
+
| Nano transaction | <1s | Feeless, delegation-scoped |
|
|
43
|
+
|
|
44
|
+
15 constraint dimensions: scope, spend, tier, values, revocation, taint, anomaly, circuit, approval, temporal, jurisdiction, purpose, combination, retention, terms. [Full benchmarks →](https://aeoess.com/benchmarks.html)
|
|
45
|
+
|
|
30
46
|
## Quick Example: Enforce, Don't Just Identify
|
|
31
47
|
|
|
32
48
|
```typescript
|
|
@@ -124,7 +140,7 @@ const agent = joinSocialContract({ name: 'my-agent', owner: 'alice', floor: floo
|
|
|
124
140
|
|
|
125
141
|
## The Stack
|
|
126
142
|
|
|
127
|
-
|
|
143
|
+
63 core modules + 32 v2 constitutional modules. 1919 tests. Zero heavy dependencies.
|
|
128
144
|
|
|
129
145
|
| Layer | What it does | Key primitive |
|
|
130
146
|
|-------|-------------|---------------|
|
|
@@ -143,7 +159,7 @@ const agent = joinSocialContract({ name: 'my-agent', owner: 'alice', floor: floo
|
|
|
143
159
|
|
|
144
160
|
## MCP Server
|
|
145
161
|
|
|
146
|
-
|
|
162
|
+
124 tools across all modules. Any MCP client connects agents directly.
|
|
147
163
|
|
|
148
164
|
```bash
|
|
149
165
|
npm install -g agent-passport-system-mcp
|
|
@@ -178,7 +194,7 @@ npx agent-passport audit --floor values/floor.yaml
|
|
|
178
194
|
|
|
179
195
|
```bash
|
|
180
196
|
npm test
|
|
181
|
-
#
|
|
197
|
+
# 1919 tests across 98 files, 484 suites, 0 failures
|
|
182
198
|
```
|
|
183
199
|
|
|
184
200
|
50 adversarial tests: Merkle tampering, attribution gaming, compliance violations, floor negotiation attacks, cross-chain confused deputy, taint laundering, authority probing.
|
|
@@ -196,7 +212,7 @@ npm test
|
|
|
196
212
|
| Signed receipts | 3-sig chain | Proposed | Logs | General | — |
|
|
197
213
|
| Values enforcement | 8 principles, graduated | — | Rules | — | — |
|
|
198
214
|
| Coordination | Task lifecycle + MCP | — | — | — | — |
|
|
199
|
-
| Tests |
|
|
215
|
+
| Tests | 1852 (50 adversarial) | None | Limited | None | None |
|
|
200
216
|
|
|
201
217
|
## Recognition
|
|
202
218
|
|
|
@@ -228,6 +244,24 @@ Protocol: [aeoess.com/protocol.html](https://aeoess.com/protocol.html) · Agora:
|
|
|
228
244
|
- Quick start: [aeoess.com/llms/quickstart.txt](https://aeoess.com/llms/quickstart.txt)
|
|
229
245
|
- API reference: [aeoess.com/llms/api.txt](https://aeoess.com/llms/api.txt)
|
|
230
246
|
|
|
247
|
+
## Passport Issuer (CA Model)
|
|
248
|
+
|
|
249
|
+
Passports issued through official AEOESS infrastructure are countersigned with the AEOESS issuer key. Self-signed passports are cryptographically valid but won't pass issuer verification.
|
|
250
|
+
|
|
251
|
+
```typescript
|
|
252
|
+
import { countersignPassport, verifyIssuerSignature } from 'agent-passport-system'
|
|
253
|
+
|
|
254
|
+
// Issuer countersigns after agent self-signs
|
|
255
|
+
const issued = countersignPassport(signedPassport, issuerPrivateKey, 'aeoess')
|
|
256
|
+
|
|
257
|
+
// Anyone can verify against the published public key
|
|
258
|
+
const AEOESS_KEY = 'e11f46f5831432d17852189d5df10ed21d5774797ae9ee52dbab8c650fec16ae'
|
|
259
|
+
const trusted = verifyIssuerSignature(issued, AEOESS_KEY) // true
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Published key: [aeoess.com/.well-known/aeoess-issuer.json](https://aeoess.com/.well-known/aeoess-issuer.json)
|
|
263
|
+
MCP tool: `verify_issuer`
|
|
264
|
+
|
|
231
265
|
## License
|
|
232
266
|
|
|
233
267
|
Apache-2.0 — see [LICENSE](LICENSE)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NVIDIA OpenShell Adapter
|
|
3
|
+
*
|
|
4
|
+
* Maps APS delegation scopes to OpenShell sandbox policy YAML.
|
|
5
|
+
* An agent's delegation chain determines what the sandbox can access.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* const policy = delegationToPolicy(delegation, basePolicy)
|
|
9
|
+
* // Write policy to YAML, pass to: openshell sandbox create --policy ./policy.yaml
|
|
10
|
+
*/
|
|
11
|
+
import type { Delegation } from '../types/passport.js';
|
|
12
|
+
export interface OpenShellPolicy {
|
|
13
|
+
version: 1;
|
|
14
|
+
identity_policy?: {
|
|
15
|
+
agent_public_key: string;
|
|
16
|
+
issuer_public_key?: string;
|
|
17
|
+
delegation_chain_depth: number;
|
|
18
|
+
};
|
|
19
|
+
filesystem_policy?: {
|
|
20
|
+
read_only: string[];
|
|
21
|
+
read_write: string[];
|
|
22
|
+
};
|
|
23
|
+
network_policies?: Record<string, NetworkPolicyEntry>;
|
|
24
|
+
process?: {
|
|
25
|
+
run_as_user: string;
|
|
26
|
+
run_as_group: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface NetworkPolicyEntry {
|
|
30
|
+
name: string;
|
|
31
|
+
endpoints: Array<{
|
|
32
|
+
host: string;
|
|
33
|
+
port: number;
|
|
34
|
+
protocol?: string;
|
|
35
|
+
}>;
|
|
36
|
+
binaries?: Array<{
|
|
37
|
+
path: string;
|
|
38
|
+
}>;
|
|
39
|
+
}
|
|
40
|
+
export interface ScopeMapping {
|
|
41
|
+
scope: string;
|
|
42
|
+
filesystemRead?: string[];
|
|
43
|
+
filesystemWrite?: string[];
|
|
44
|
+
networkAllow?: Array<{
|
|
45
|
+
host: string;
|
|
46
|
+
port: number;
|
|
47
|
+
}>;
|
|
48
|
+
inferenceLocal?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Extract effective scopes from a delegation, applying monotonic narrowing.
|
|
52
|
+
*/
|
|
53
|
+
export declare function extractEffectiveScopes(delegation: Delegation): string[];
|
|
54
|
+
/**
|
|
55
|
+
* Map APS delegation scopes to OpenShell policy sections.
|
|
56
|
+
* The output policy is the intersection of the delegation scope and the base policy.
|
|
57
|
+
*/
|
|
58
|
+
export declare function delegationToPolicy(delegation: Delegation, agentPublicKey: string, issuerPublicKey?: string, customMappings?: Record<string, Partial<ScopeMapping>>): OpenShellPolicy;
|
|
59
|
+
/**
|
|
60
|
+
* Serialize an OpenShell policy to YAML string.
|
|
61
|
+
* Minimal YAML serializer — no external deps.
|
|
62
|
+
*/
|
|
63
|
+
export declare function policyToYaml(policy: OpenShellPolicy): string;
|
|
64
|
+
//# sourceMappingURL=openshell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openshell.d.ts","sourceRoot":"","sources":["../../../src/adapters/openshell.ts"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CAEvE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,MAAM,EACtB,eAAe,CAAC,EAAE,MAAM,EACxB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,GACrD,eAAe,CA4CjB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAwC5D"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// Copyright 2024-2026 Tymofii Pidlisnyi. Apache-2.0 license. See LICENSE.
|
|
2
|
+
/**
|
|
3
|
+
* NVIDIA OpenShell Adapter
|
|
4
|
+
*
|
|
5
|
+
* Maps APS delegation scopes to OpenShell sandbox policy YAML.
|
|
6
|
+
* An agent's delegation chain determines what the sandbox can access.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* const policy = delegationToPolicy(delegation, basePolicy)
|
|
10
|
+
* // Write policy to YAML, pass to: openshell sandbox create --policy ./policy.yaml
|
|
11
|
+
*/
|
|
12
|
+
const DEFAULT_SCOPE_MAPPINGS = {
|
|
13
|
+
'filesystem:read': { filesystemRead: ['/sandbox', '/tmp'] },
|
|
14
|
+
'filesystem:write': { filesystemWrite: ['/sandbox', '/tmp'] },
|
|
15
|
+
'network:*': { networkAllow: [] },
|
|
16
|
+
'commerce:*': { networkAllow: [{ host: 'gateway.aeoess.com', port: 443 }] },
|
|
17
|
+
'inference:local': { inferenceLocal: true },
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Check if a delegation scope covers a target scope.
|
|
21
|
+
* Supports wildcards: 'commerce:*' covers 'commerce:send'.
|
|
22
|
+
*/
|
|
23
|
+
function scopeCovers(granted, target) {
|
|
24
|
+
if (granted === target)
|
|
25
|
+
return true;
|
|
26
|
+
if (granted.endsWith(':*')) {
|
|
27
|
+
const prefix = granted.slice(0, -1);
|
|
28
|
+
return target.startsWith(prefix);
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Extract effective scopes from a delegation, applying monotonic narrowing.
|
|
34
|
+
*/
|
|
35
|
+
export function extractEffectiveScopes(delegation) {
|
|
36
|
+
return delegation.scope || [];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Map APS delegation scopes to OpenShell policy sections.
|
|
40
|
+
* The output policy is the intersection of the delegation scope and the base policy.
|
|
41
|
+
*/
|
|
42
|
+
export function delegationToPolicy(delegation, agentPublicKey, issuerPublicKey, customMappings) {
|
|
43
|
+
const mappings = { ...DEFAULT_SCOPE_MAPPINGS, ...customMappings };
|
|
44
|
+
const scopes = extractEffectiveScopes(delegation);
|
|
45
|
+
const readPaths = new Set(['/usr', '/lib', '/etc']);
|
|
46
|
+
const writePaths = new Set();
|
|
47
|
+
const networkEntries = [];
|
|
48
|
+
for (const scope of scopes) {
|
|
49
|
+
for (const [pattern, mapping] of Object.entries(mappings)) {
|
|
50
|
+
if (scopeCovers(pattern, scope)) {
|
|
51
|
+
if (mapping.filesystemRead)
|
|
52
|
+
mapping.filesystemRead.forEach(p => readPaths.add(p));
|
|
53
|
+
if (mapping.filesystemWrite)
|
|
54
|
+
mapping.filesystemWrite.forEach(p => writePaths.add(p));
|
|
55
|
+
if (mapping.networkAllow)
|
|
56
|
+
networkEntries.push(...mapping.networkAllow);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const policy = {
|
|
61
|
+
version: 1,
|
|
62
|
+
identity_policy: {
|
|
63
|
+
agent_public_key: agentPublicKey,
|
|
64
|
+
issuer_public_key: issuerPublicKey,
|
|
65
|
+
delegation_chain_depth: delegation.currentDepth || 0,
|
|
66
|
+
},
|
|
67
|
+
filesystem_policy: {
|
|
68
|
+
read_only: [...readPaths],
|
|
69
|
+
read_write: [...writePaths],
|
|
70
|
+
},
|
|
71
|
+
process: { run_as_user: 'sandbox', run_as_group: 'sandbox' },
|
|
72
|
+
};
|
|
73
|
+
if (networkEntries.length > 0) {
|
|
74
|
+
policy.network_policies = {};
|
|
75
|
+
networkEntries.forEach((entry, i) => {
|
|
76
|
+
const key = `aps_${entry.host.replace(/\./g, '_')}`;
|
|
77
|
+
policy.network_policies[key] = {
|
|
78
|
+
name: `APS: ${entry.host}`,
|
|
79
|
+
endpoints: [{ host: entry.host, port: entry.port, protocol: 'rest' }],
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return policy;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Serialize an OpenShell policy to YAML string.
|
|
87
|
+
* Minimal YAML serializer — no external deps.
|
|
88
|
+
*/
|
|
89
|
+
export function policyToYaml(policy) {
|
|
90
|
+
const lines = [`version: ${policy.version}`];
|
|
91
|
+
if (policy.identity_policy) {
|
|
92
|
+
lines.push('', 'identity_policy:');
|
|
93
|
+
lines.push(` agent_public_key: "${policy.identity_policy.agent_public_key}"`);
|
|
94
|
+
if (policy.identity_policy.issuer_public_key)
|
|
95
|
+
lines.push(` issuer_public_key: "${policy.identity_policy.issuer_public_key}"`);
|
|
96
|
+
lines.push(` delegation_chain_depth: ${policy.identity_policy.delegation_chain_depth}`);
|
|
97
|
+
}
|
|
98
|
+
if (policy.filesystem_policy) {
|
|
99
|
+
lines.push('', 'filesystem_policy:');
|
|
100
|
+
lines.push(' read_only:');
|
|
101
|
+
policy.filesystem_policy.read_only.forEach(p => lines.push(` - ${p}`));
|
|
102
|
+
lines.push(' read_write:');
|
|
103
|
+
policy.filesystem_policy.read_write.forEach(p => lines.push(` - ${p}`));
|
|
104
|
+
}
|
|
105
|
+
if (policy.process) {
|
|
106
|
+
lines.push('', 'process:');
|
|
107
|
+
lines.push(` run_as_user: ${policy.process.run_as_user}`);
|
|
108
|
+
lines.push(` run_as_group: ${policy.process.run_as_group}`);
|
|
109
|
+
}
|
|
110
|
+
if (policy.network_policies) {
|
|
111
|
+
lines.push('', 'network_policies:');
|
|
112
|
+
for (const [key, entry] of Object.entries(policy.network_policies)) {
|
|
113
|
+
lines.push(` ${key}:`);
|
|
114
|
+
lines.push(` name: "${entry.name}"`);
|
|
115
|
+
lines.push(' endpoints:');
|
|
116
|
+
entry.endpoints.forEach(ep => {
|
|
117
|
+
lines.push(` - host: ${ep.host}`);
|
|
118
|
+
lines.push(` port: ${ep.port}`);
|
|
119
|
+
if (ep.protocol)
|
|
120
|
+
lines.push(` protocol: ${ep.protocol}`);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return lines.join('\n') + '\n';
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=openshell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openshell.js","sourceRoot":"","sources":["../../../src/adapters/openshell.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E;;;;;;;;;GASG;AAoCH,MAAM,sBAAsB,GAA0C;IACpE,iBAAiB,EAAE,EAAE,cAAc,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC,EAAE;IAC3D,kBAAkB,EAAE,EAAE,eAAe,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC,EAAE;IAC7D,WAAW,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE;IACjC,YAAY,EAAE,EAAE,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE;IAC3E,iBAAiB,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE;CAC5C,CAAA;AAED;;;GAGG;AACH,SAAS,WAAW,CAAC,OAAe,EAAE,MAAc;IAClD,IAAI,OAAO,KAAK,MAAM;QAAE,OAAO,IAAI,CAAA;IACnC,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,C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CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC;YACnE,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAA;YACvB,KAAK,CAAC,IAAI,CAAC,cAAc,KAAK,CAAC,IAAI,GAAG,CAAC,CAAA;YACvC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;YAC5B,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;gBAC3B,KAAK,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,CAAC,CAAA;gBACtC,KAAK,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,CAAC,CAAA;gBACtC,IAAI,EAAE,CAAC,QAAQ;oBAAE,KAAK,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAA;YACjE,CAAC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;AAChC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** External anchor state for a receipt or batch.
|
|
2
|
+
* unanchored: exists only in gateway memory
|
|
3
|
+
* batched_pending: included in a Merkle batch, root not yet anchored externally
|
|
4
|
+
* anchored: Merkle root published to external log (Rekor, Solana, etc.)
|
|
5
|
+
* critical_direct_anchor: individual receipt anchored directly (bypass batching) */
|
|
6
|
+
export type AnchorState = 'unanchored' | 'batched_pending' | 'anchored' | 'critical_direct_anchor';
|
|
7
|
+
/** Anchor metadata on a receipt */
|
|
8
|
+
export interface AnchorMetadata {
|
|
9
|
+
state: AnchorState;
|
|
10
|
+
/** Batch ID if batched_pending or anchored */
|
|
11
|
+
batchId?: string;
|
|
12
|
+
/** External anchor reference (URL, transaction ID, etc.) */
|
|
13
|
+
anchorRef?: string;
|
|
14
|
+
/** When the anchor was confirmed */
|
|
15
|
+
anchoredAt?: string;
|
|
16
|
+
/** Which anchor backend was used */
|
|
17
|
+
anchorBackend?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Auto-batch configuration */
|
|
20
|
+
export interface AutoBatchConfig {
|
|
21
|
+
/** Maximum seconds between batch commits (0 = disabled) */
|
|
22
|
+
maxIntervalSeconds: number;
|
|
23
|
+
/** Maximum receipts before auto-commit (0 = disabled) */
|
|
24
|
+
maxReceiptsPerBatch: number;
|
|
25
|
+
/** Whether critical/irreversible actions get direct anchor */
|
|
26
|
+
directAnchorCritical: boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare const DEFAULT_AUTO_BATCH_CONFIG: AutoBatchConfig;
|
|
29
|
+
/** Create initial anchor metadata for a new receipt */
|
|
30
|
+
export declare function createAnchorMetadata(critical?: boolean): AnchorMetadata;
|
|
31
|
+
/** Transition anchor state when receipt is added to a batch */
|
|
32
|
+
export declare function markBatched(anchor: AnchorMetadata, batchId: string): AnchorMetadata;
|
|
33
|
+
/** Transition anchor state when batch root is externally anchored */
|
|
34
|
+
export declare function markAnchored(anchor: AnchorMetadata, anchorRef: string, anchorBackend: string): AnchorMetadata;
|
|
35
|
+
/** Check if auto-batch should fire based on config and current state */
|
|
36
|
+
export declare function shouldAutoBatch(pendingCount: number, lastBatchTime: string | null, config?: AutoBatchConfig): {
|
|
37
|
+
trigger: boolean;
|
|
38
|
+
reason: 'max_receipts' | 'max_interval' | null;
|
|
39
|
+
};
|
|
40
|
+
/** Check if an anchor state meets a minimum requirement */
|
|
41
|
+
export declare function meetsAnchorRequirement(current: AnchorState, minimum: AnchorState): boolean;
|
|
42
|
+
/** Check if anchor state transition is valid (can only move forward) */
|
|
43
|
+
export declare function isValidAnchorTransition(from: AnchorState, to: AnchorState): boolean;
|
|
44
|
+
/** Exported ordering for cross-language verification */
|
|
45
|
+
export declare const ANCHOR_STATE_ORDER: Record<AnchorState, number>;
|
|
46
|
+
//# sourceMapp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,cAAc,GAAG,cAAc,GAAG,IAAI,CAAA;CAAE,CAsBtE;AAUD,2DAA2D;AAC3D,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,GACnB,OAAO,CAET;AAED,wEAAwE;AACxE,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,WAAW,GAAG,OAAO,CAEnF;AAED,wDAAwD;AACxD,eAAO,MAAM,kBAAkB,6BAAe,CAAA"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// ══════════════════════════════════════════════════════════════════
|
|
2
|
+
// Anchor States — External verifiability tracking for receipts
|
|
3
|
+
// ══════════════════════════════════════════════════════════════════
|
|
4
|
+
// Consilium Priority 6. Gemini: "explicit receipt anchor states."
|
|
5
|
+
// desiorac (A2A #1672): batch commitment lags individual receipts.
|
|
6
|
+
//
|
|
7
|
+
// Every receipt and batch carries an anchor state:
|
|
8
|
+
// unanchored → batched_pending → anchored → critical_direct_anchor
|
|
9
|
+
//
|
|
10
|
+
// Auto-batching: configurable window (N seconds or N receipts).
|
|
11
|
+
// ══════════════════════════════════════════════════════════════════
|
|
12
|
+
export const DEFAULT_AUTO_BATCH_CONFIG = {
|
|
13
|
+
maxIntervalSeconds: 300, // 5 minutes
|
|
14
|
+
maxReceiptsPerBatch: 100,
|
|
15
|
+
directAnchorCritical: true,
|
|
16
|
+
};
|
|
17
|
+
/** Create initial anchor metadata for a new receipt */
|
|
18
|
+
export function createAnchorMetadata(critical = false) {
|
|
19
|
+
return {
|
|
20
|
+
state: critical ? 'critical_direct_anchor' : 'unanchored',
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/** Transition anchor state when receipt is added to a batch */
|
|
24
|
+
export function markBatched(anchor, batchId) {
|
|
25
|
+
if (anchor.state === 'critical_direct_anchor')
|
|
26
|
+
return anchor; // already anchored
|
|
27
|
+
if (anchor.state === 'anchored')
|
|
28
|
+
return anchor; // already anchored
|
|
29
|
+
return { ...anchor, state: 'batched_pending', batchId };
|
|
30
|
+
}
|
|
31
|
+
/** Transition anchor state when batch root is externally anchored */
|
|
32
|
+
export function markAnchored(anchor, anchorRef, anchorBackend) {
|
|
33
|
+
if (anchor.state === 'critical_direct_anchor')
|
|
34
|
+
return anchor;
|
|
35
|
+
return {
|
|
36
|
+
...anchor,
|
|
37
|
+
state: 'anchored',
|
|
38
|
+
anchorRef, anchorBackend,
|
|
39
|
+
anchoredAt: new Date().toISOString(),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/** Check if auto-batch should fire based on config and current state */
|
|
43
|
+
export function shouldAutoBatch(pendingCount, lastBatchTime, config = DEFAULT_AUTO_BATCH_CONFIG) {
|
|
44
|
+
if (pendingCount === 0)
|
|
45
|
+
return { trigger: false, reason: null };
|
|
46
|
+
// Receipt count trigger
|
|
47
|
+
if (config.maxReceiptsPerBatch > 0 && pendingCount >= config.maxReceiptsPerBatch) {
|
|
48
|
+
return { trigger: true, reason: 'max_receipts' };
|
|
49
|
+
}
|
|
50
|
+
// Time interval trigger
|
|
51
|
+
if (config.maxIntervalSeconds > 0 && lastBatchTime) {
|
|
52
|
+
const elapsed = (Date.now() - new Date(lastBatchTime).getTime()) / 1000;
|
|
53
|
+
if (elapsed >= config.maxIntervalSeconds) {
|
|
54
|
+
return { trigger: true, reason: 'max_interval' };
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// First batch ever — trigger on interval if no previous batch
|
|
58
|
+
if (config.maxIntervalSeconds > 0 && !lastBatchTime && pendingCount > 0) {
|
|
59
|
+
return { trigger: true, reason: 'max_interval' };
|
|
60
|
+
}
|
|
61
|
+
return { trigger: false, reason: null };
|
|
62
|
+
}
|
|
63
|
+
/** Anchor state ordering — higher number = more externally verifiable */
|
|
64
|
+
const ANCHOR_ORDER = {
|
|
65
|
+
unanchored: 0,
|
|
66
|
+
batched_pending: 1,
|
|
67
|
+
anchored: 2,
|
|
68
|
+
critical_direct_anchor: 3,
|
|
69
|
+
};
|
|
70
|
+
/** Check if an anchor state meets a minimum requirement */
|
|
71
|
+
export function meetsAnchorRequirement(current, minimum) {
|
|
72
|
+
return ANCHOR_ORDER[current] >= ANCHOR_ORDER[minimum];
|
|
73
|
+
}
|
|
74
|
+
/** Check if anchor state transition is valid (can only move forward) */
|
|
75
|
+
export function isValidAnchorTransition(from, to) {
|
|
76
|
+
return ANCHOR_ORDER[to] >= ANCHOR_ORDER[from];
|
|
77
|
+
}
|
|
78
|
+
/** Exported ordering for cross-language verification */
|
|
79
|
+
export const ANCHOR_STATE_ORDER = ANCHOR_ORDER;
|
|
80
|
+
//# sourceMappingURL=anchor-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anchor-state.js","sourceRoot":"","sources":["../../../src/core/anchor-state.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,+DAA+D;AAC/D,qEAAqE;AACrE,kEAAkE;AAClE,mEAAmE;AACnE,EAAE;AACF,mDAAmD;AACnD,qEAAqE;AACrE,EAAE;AACF,gEAAgE;AAChE,qEAAqE;AAgCrE,MAAM,CAAC,MAAM,yBAAyB,GAAoB;IACxD,kBAAkB,EAAE,GAAG,EAAI,YAAY;IACvC,mBAAmB,EAAE,GAAG;IACxB,oBAAoB,EAAE,IAAI;CAC3B,CAAA;AAED,uDAAuD;AACvD,MAAM,UAAU,oBAAoB,CAAC,WAAoB,KAAK;IAC5D,OAAO;QACL,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,YAAY;KAC1D,CAAA;AACH,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,WAAW,CAAC,MAAsB,EAAE,OAAe;IACjE,IAAI,MAAM,CAAC,KAAK,KAAK,wBAAwB;QAAE,OAAO,MAAM,CAAA,CAAC,mBAAmB;IAChF,IAAI,MAAM,CAAC,KAAK,KAAK,UAAU;QAAE,OAAO,MAAM,CAAA,CAAC,mBAAmB;IAClE,OA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CAAC,EAAE,CAAC;QACxE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA;IAClD,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;AACzC,CAAC;AAED,yEAAyE;AACzE,MAAM,YAAY,GAAgC;IAChD,UAAU,EAAE,CAAC;IACb,eAAe,EAAE,CAAC;IAClB,QAAQ,EAAE,CAAC;IACX,sBAAsB,EAAE,CAAC;CAC1B,CAAA;AAED,2DAA2D;AAC3D,MAAM,UAAU,sBAAsB,CACpC,OAAoB,EACpB,OAAoB;IAEpB,OAAO,YAAY,CAAC,OAAO,CAAC,IAAI,YAAY,CAAC,OAAO,CAAC,CAAA;AACvD,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,uBAAuB,CAAC,IAAiB,EAAE,EAAe;IACxE,OAAO,YAAY,CAAC,EAAE,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,CAAA;AAC/C,CAAC;AAED,wDAAwD;AACxD,MAAM,CAAC,MAAM,kBAAkB,GAAG,YAAY,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { PassportGrade, AttestationFlag, IssuanceChallenge, IssuanceEvidenceRecord, IssuanceContext, PassportAttestationSummary, RuntimeAttestation, ObservedContext, SignalVerificationResult, DerivedSignal, AttestationClass, WorkspaceManifest } from '../types/attestation.js';
|
|
2
|
+
import type { SignedPassport } from '../types/passport.js';
|
|
3
|
+
export declare function createIssuanceChallenge(publicKeyHash: string, options?: {
|
|
4
|
+
requestedClasses?: AttestationClass[];
|
|
5
|
+
expiresInSeconds?: number;
|
|
6
|
+
}): IssuanceChallenge;
|
|
7
|
+
export declare function verifyRuntimeAttestation(attestation: RuntimeAttestation, challenge: IssuanceChallenge, trustedAttesterKeys: Map<string, string>): SignalVerificationResult;
|
|
8
|
+
export declare function computePassportGrade(evidence: IssuanceEvidenceRecord, options?: {
|
|
9
|
+
hasIssuerSignature?: boolean;
|
|
10
|
+
hasVerifiedRuntime?: boolean;
|
|
11
|
+
hasVerifiedProvider?: boolean;
|
|
12
|
+
hasPrincipalEndorsement?: boolean;
|
|
13
|
+
}): PassportGrade;
|
|
14
|
+
export declare function computeAttestationFlags(grade: PassportGrade, evidence: IssuanceEvidenceRecord): AttestationFlag[];
|
|
15
|
+
export declare function computeAttestationBundleHash(evidence: IssuanceEvidenceRecord): string;
|
|
16
|
+
export declare function createIssuanceContext(evidence: IssuanceEvidenceRecord, options?: {
|
|
17
|
+
hasIssuerSignature?: boolean;
|
|
18
|
+
hasVerifiedRuntime?: boolean;
|
|
19
|
+
hasVerifiedProvider?: boolean;
|
|
20
|
+
hasPrincipalEndorsement?: boolean;
|
|
21
|
+
verificationResults?: SignalVerificationResult[];
|
|
22
|
+
derivedSignals?: DerivedSignal[];
|
|
23
|
+
}): IssuanceContext;
|
|
24
|
+
export declare function bindAttestation(signedPassport: SignedPassport, context: IssuanceContext): SignedPassport & {
|
|
25
|
+
attestation: PassportAttestationSummary;
|
|
26
|
+
};
|
|
27
|
+
export declare function createWorkspaceManifest(entries: Array<{
|
|
28
|
+
path: string;
|
|
29
|
+
sizeBytes: number;
|
|
30
|
+
lastModified: Date;
|
|
31
|
+
}>): WorkspaceManifest;
|
|
32
|
+
export declare function createEmptyEvidenceRecord(observed?: Partial<ObservedContext>): IssuanceEvidenceRecord;
|
|
33
|
+
export declare function isChallengeFresh(challenge: IssuanceChallenge): boolean;
|
|
34
|
+
export declare function isGradeAtLeast(grade: PassportGrade, minimum: PassportGrade): boolean;
|
|
35
|
+
//# sourceMappingURL=attestation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attestation.d.ts","sourceRoot":"","sources":["../../../src/core/attestation.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,aAAa,EAAE,eAAe,EAC9B,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EAAE,0BAA0B,EAC3C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