@agenticprimitives/agent-profile 1.0.0-alpha.4 → 1.0.0-alpha.41
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 +91 -37
- package/dist/a2a/binding.d.ts +99 -0
- package/dist/a2a/binding.d.ts.map +1 -0
- package/dist/a2a/binding.js +142 -0
- package/dist/a2a/binding.js.map +1 -0
- package/dist/a2a/canonical.d.ts +31 -0
- package/dist/a2a/canonical.d.ts.map +1 -0
- package/dist/a2a/canonical.js +43 -0
- package/dist/a2a/canonical.js.map +1 -0
- package/dist/a2a/field-binding.d.ts +125 -0
- package/dist/a2a/field-binding.d.ts.map +1 -0
- package/dist/a2a/field-binding.js +242 -0
- package/dist/a2a/field-binding.js.map +1 -0
- package/dist/a2a/import.d.ts +39 -0
- package/dist/a2a/import.d.ts.map +1 -0
- package/dist/a2a/import.js +134 -0
- package/dist/a2a/import.js.map +1 -0
- package/dist/a2a/index.d.ts +13 -0
- package/dist/a2a/index.d.ts.map +1 -0
- package/dist/a2a/index.js +24 -0
- package/dist/a2a/index.js.map +1 -0
- package/dist/a2a/jws.d.ts +76 -0
- package/dist/a2a/jws.d.ts.map +1 -0
- package/dist/a2a/jws.js +186 -0
- package/dist/a2a/jws.js.map +1 -0
- package/dist/a2a/playbook-binding.d.ts +29 -0
- package/dist/a2a/playbook-binding.d.ts.map +1 -0
- package/dist/a2a/playbook-binding.js +65 -0
- package/dist/a2a/playbook-binding.js.map +1 -0
- package/dist/a2a/pointer.d.ts +13 -0
- package/dist/a2a/pointer.d.ts.map +1 -0
- package/dist/a2a/pointer.js +78 -0
- package/dist/a2a/pointer.js.map +1 -0
- package/dist/a2a/release.d.ts +77 -0
- package/dist/a2a/release.d.ts.map +1 -0
- package/dist/a2a/release.js +197 -0
- package/dist/a2a/release.js.map +1 -0
- package/dist/a2a/types.d.ts +327 -0
- package/dist/a2a/types.d.ts.map +1 -0
- package/dist/a2a/types.js +49 -0
- package/dist/a2a/types.js.map +1 -0
- package/dist/a2a/validation.d.ts +81 -0
- package/dist/a2a/validation.d.ts.map +1 -0
- package/dist/a2a/validation.js +506 -0
- package/dist/a2a/validation.js.map +1 -0
- package/dist/caip10.d.ts +4 -3
- package/dist/caip10.d.ts.map +1 -1
- package/dist/caip10.js +8 -5
- package/dist/caip10.js.map +1 -1
- package/dist/calls.d.ts +23 -0
- package/dist/calls.d.ts.map +1 -1
- package/dist/calls.js +31 -1
- package/dist/calls.js.map +1 -1
- package/dist/card.d.ts +70 -0
- package/dist/card.d.ts.map +1 -0
- package/dist/card.js +130 -0
- package/dist/card.js.map +1 -0
- package/dist/client-key-binding.d.ts +196 -0
- package/dist/client-key-binding.d.ts.map +1 -0
- package/dist/client-key-binding.js +282 -0
- package/dist/client-key-binding.js.map +1 -0
- package/dist/client.d.ts +6 -4
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +79 -8
- package/dist/client.js.map +1 -1
- package/dist/constants.d.ts +31 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +38 -1
- package/dist/constants.js.map +1 -1
- package/dist/derived-type.d.ts +14 -0
- package/dist/derived-type.d.ts.map +1 -0
- package/dist/derived-type.js +56 -0
- package/dist/derived-type.js.map +1 -0
- package/dist/distribution.d.ts +32 -0
- package/dist/distribution.d.ts.map +1 -0
- package/dist/distribution.js +167 -0
- package/dist/distribution.js.map +1 -0
- package/dist/errors.d.ts +6 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +11 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +12 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -7
- package/dist/index.js.map +1 -1
- package/dist/profile.d.ts +4 -4
- package/dist/profile.d.ts.map +1 -1
- package/dist/profile.js +25 -3
- package/dist/profile.js.map +1 -1
- package/dist/types.d.ts +135 -9
- package/dist/types.d.ts.map +1 -1
- package/package.json +32 -12
- package/spec.md +5 -1
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ClientKeyBindingV1` — the Smart Agent's EIP-712 statement that ONE public key (a JWK, by RFC 7638
|
|
3
|
+
* thumbprint) may PRESENT for it at external doors — OAuth `private_key_jwt`, DPoP, RFC 9421 HTTP signatures,
|
|
4
|
+
* a TAP key directory — under one custody epoch, between `notBefore` and `notAfter`, published under one
|
|
5
|
+
* `clientId` (spec 442 §3; ontology `ap:ClientKeyBinding`; on-chain record `atl:clientKeys`).
|
|
6
|
+
*
|
|
7
|
+
* The service-agent-signing rule, applied to the doors the field runs: the service never holds the identity's
|
|
8
|
+
* key; it holds a DELEGATE (a custodied P-256 / Ed25519 key behind `JwsSignerPort`) and presents this binding beside
|
|
9
|
+
* it. Those doors cannot verify an ERC-7710 wire, so the binding takes the form they can carry: a signed
|
|
10
|
+
* statement the SA stands behind, validated through ERC-1271 by anyone who wants more than OAuth's trust.
|
|
11
|
+
*
|
|
12
|
+
* WHAT IT IS NOT. It is not an authority wire: it grants the key NO authority to act. Signatures under this key are the
|
|
13
|
+
* agent's PRESENTATIONS; what the agent may do at a door is still a mandate, verified per step (spec 350 §3.6).
|
|
14
|
+
* Revoked by a custody-epoch bump (every binding under the old epoch is dead — rotation re-approves, recovery
|
|
15
|
+
* does not; spec 410 §1) or by an explicit `atl:clientKeys` write. Short `notAfter` (≤ 90 days) is the default.
|
|
16
|
+
*
|
|
17
|
+
* Domain: `{ name:'AgenticPrimitivesClientKey', version:'1', chainId, verifyingContract: <SA> }`. The ERC-1271
|
|
18
|
+
* read and the custody-epoch read are INJECTED so this module stays network-free (same ports as `a2a/binding`).
|
|
19
|
+
*/
|
|
20
|
+
import { hashTypedData } from 'viem';
|
|
21
|
+
import { jcsCanonicalize } from '@agenticprimitives/types';
|
|
22
|
+
import { thumbprintToBytes32 } from './a2a/binding.js';
|
|
23
|
+
import { CLIENT_KEYS } from './constants.js';
|
|
24
|
+
import { InvalidProfileError } from './errors.js';
|
|
25
|
+
export const CLIENT_KEY_ALGS = ['ES256', 'EdDSA'];
|
|
26
|
+
// ─── EIP-712 ─────────────────────────────────────────────────────────────────────────────────────────
|
|
27
|
+
export const CLIENT_KEY_BINDING_DOMAIN_NAME = 'AgenticPrimitivesClientKey';
|
|
28
|
+
export const CLIENT_KEY_BINDING_DOMAIN_VERSION = '1';
|
|
29
|
+
export const CLIENT_KEY_BINDING_TYPES = {
|
|
30
|
+
ClientKeyBinding: [
|
|
31
|
+
{ name: 'canonicalAgentId', type: 'string' },
|
|
32
|
+
{ name: 'scope', type: 'string' },
|
|
33
|
+
{ name: 'clientId', type: 'string' },
|
|
34
|
+
{ name: 'jwkThumbprint', type: 'bytes32' },
|
|
35
|
+
{ name: 'alg', type: 'string' },
|
|
36
|
+
{ name: 'custodyEpoch', type: 'uint64' },
|
|
37
|
+
{ name: 'notBefore', type: 'uint64' },
|
|
38
|
+
{ name: 'notAfter', type: 'uint64' },
|
|
39
|
+
],
|
|
40
|
+
};
|
|
41
|
+
/** The EIP-712 type string (for TYPEHASH parity checks). Off-chain only today: no contract consumes it. */
|
|
42
|
+
export const CLIENT_KEY_BINDING_TYPE_STRING = 'ClientKeyBinding(string canonicalAgentId,string scope,string clientId,bytes32 jwkThumbprint,string alg,uint64 custodyEpoch,uint64 notBefore,uint64 notAfter)';
|
|
43
|
+
/** The default validity a Home signs for: 90 days. Longer is allowed and visible; it is never silently extended. */
|
|
44
|
+
export const CLIENT_KEY_BINDING_DEFAULT_TTL_SECONDS = 90 * 24 * 3600;
|
|
45
|
+
export function clientKeyBindingDomain(chainId, smartAgent) {
|
|
46
|
+
return {
|
|
47
|
+
name: CLIENT_KEY_BINDING_DOMAIN_NAME,
|
|
48
|
+
version: CLIENT_KEY_BINDING_DOMAIN_VERSION,
|
|
49
|
+
chainId,
|
|
50
|
+
verifyingContract: smartAgent,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const CAIP10_EVM = /^eip155:(\d+):(0x[0-9a-fA-F]{40})$/;
|
|
54
|
+
const HTTPS_URL = /^https:\/\/[^\s/?#]+(\/[^\s?#]*)?$/;
|
|
55
|
+
/**
|
|
56
|
+
* Validate a candidate binding. Returns `[]` when well-formed, else one issue per violation. Shape only — the
|
|
57
|
+
* posture rule is `assertClientKeyScopeAllowed`, the epoch rule is `verifySignedClientKeyBinding`.
|
|
58
|
+
*/
|
|
59
|
+
export function validateClientKeyBinding(b) {
|
|
60
|
+
const issues = [];
|
|
61
|
+
if (typeof b !== 'object' || b === null || Array.isArray(b))
|
|
62
|
+
return ['binding: must be an object'];
|
|
63
|
+
const x = b;
|
|
64
|
+
if (typeof x.canonicalAgentId !== 'string' || !CAIP10_EVM.test(x.canonicalAgentId))
|
|
65
|
+
issues.push('binding.canonicalAgentId: must be eip155:<chainId>:<address>');
|
|
66
|
+
if (x.scope !== 'service' && x.scope !== 'person')
|
|
67
|
+
issues.push('binding.scope: must be service | person');
|
|
68
|
+
if (typeof x.clientId !== 'string' || !HTTPS_URL.test(x.clientId))
|
|
69
|
+
issues.push('binding.clientId: must be an https URL');
|
|
70
|
+
if (typeof x.jwkThumbprint !== 'string')
|
|
71
|
+
issues.push('binding.jwkThumbprint: required');
|
|
72
|
+
else {
|
|
73
|
+
try {
|
|
74
|
+
thumbprintToBytes32(x.jwkThumbprint);
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
issues.push('binding.jwkThumbprint: must be a base64url sha256 (RFC 7638)');
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (typeof x.alg !== 'string' || !CLIENT_KEY_ALGS.includes(x.alg)) {
|
|
81
|
+
issues.push(`binding.alg: must be one of ${CLIENT_KEY_ALGS.join(' | ')} — the field verifies no other (ES256K is not verifiable at these doors)`);
|
|
82
|
+
}
|
|
83
|
+
for (const k of ['custodyEpoch', 'notBefore', 'notAfter']) {
|
|
84
|
+
if (!Number.isInteger(x[k]) || x[k] < 0)
|
|
85
|
+
issues.push(`binding.${k}: must be a non-negative integer`);
|
|
86
|
+
}
|
|
87
|
+
if (Number.isInteger(x.notBefore) && Number.isInteger(x.notAfter) && x.notAfter <= x.notBefore) {
|
|
88
|
+
issues.push('binding.notAfter: must be after notBefore (an open-ended client key is not a thing)');
|
|
89
|
+
}
|
|
90
|
+
return issues;
|
|
91
|
+
}
|
|
92
|
+
/** The EIP-712 message as signed: the thumbprint as bytes32, the integers as uint64. */
|
|
93
|
+
export function clientKeyBindingMessage(b) {
|
|
94
|
+
const issues = validateClientKeyBinding(b);
|
|
95
|
+
if (issues.length)
|
|
96
|
+
throw new InvalidProfileError(`ClientKeyBindingV1: ${issues.join('; ')}`);
|
|
97
|
+
return {
|
|
98
|
+
canonicalAgentId: b.canonicalAgentId,
|
|
99
|
+
scope: b.scope,
|
|
100
|
+
clientId: b.clientId,
|
|
101
|
+
jwkThumbprint: thumbprintToBytes32(b.jwkThumbprint),
|
|
102
|
+
alg: b.alg,
|
|
103
|
+
custodyEpoch: BigInt(b.custodyEpoch),
|
|
104
|
+
notBefore: BigInt(b.notBefore),
|
|
105
|
+
notAfter: BigInt(b.notAfter),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/** The 32-byte EIP-712 digest the SA signs and ERC-1271 validates. */
|
|
109
|
+
export function clientKeyBindingDigest(binding, chainId, smartAgent) {
|
|
110
|
+
return hashTypedData({
|
|
111
|
+
domain: clientKeyBindingDomain(chainId, smartAgent),
|
|
112
|
+
types: CLIENT_KEY_BINDING_TYPES,
|
|
113
|
+
primaryType: 'ClientKeyBinding',
|
|
114
|
+
message: clientKeyBindingMessage(binding),
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
// ─── posture ─────────────────────────────────────────────────────────────────────────────────────────
|
|
118
|
+
/**
|
|
119
|
+
* Spec 442 §7: a `scope: 'person'` binding publishes a per-person client document, which names the person to
|
|
120
|
+
* every company and is enumerable — allowed only when the person's naming posture is already `public`. The
|
|
121
|
+
* posture is the agent's `AgentDiscoveryPolicyV1.naming` (agent-resolution); passed structurally so this module
|
|
122
|
+
* depends on nothing. The estate's personal-agent SERVICE (`scope: 'service'`) is the client for everyone else.
|
|
123
|
+
*/
|
|
124
|
+
export function clientKeyScopeRefusal(binding, posture) {
|
|
125
|
+
if (binding.scope === 'person' && posture.naming !== 'public') {
|
|
126
|
+
return `a scope:'person' client key is refused for naming posture '${posture.naming}' — the person would be the client_id at every company (spec 442 §7); present through the estate's personal-agent service instead`;
|
|
127
|
+
}
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
export function assertClientKeyScopeAllowed(binding, posture) {
|
|
131
|
+
const refusal = clientKeyScopeRefusal(binding, posture);
|
|
132
|
+
if (refusal)
|
|
133
|
+
throw new InvalidProfileError(refusal);
|
|
134
|
+
}
|
|
135
|
+
/** Validate → posture → sign. The binding names this SA on this chain or it is refused before signing. */
|
|
136
|
+
export async function buildSignedClientKeyBinding(input) {
|
|
137
|
+
const { binding, chainId, smartAgent } = input;
|
|
138
|
+
const issues = validateClientKeyBinding(binding);
|
|
139
|
+
if (issues.length)
|
|
140
|
+
throw new InvalidProfileError(`ClientKeyBindingV1: ${issues.join('; ')}`);
|
|
141
|
+
const m = CAIP10_EVM.exec(binding.canonicalAgentId);
|
|
142
|
+
if (Number(m[1]) !== chainId || m[2].toLowerCase() !== smartAgent.toLowerCase()) {
|
|
143
|
+
throw new InvalidProfileError('ClientKeyBindingV1: canonicalAgentId does not name this Smart Agent on this chain');
|
|
144
|
+
}
|
|
145
|
+
assertClientKeyScopeAllowed(binding, input.posture);
|
|
146
|
+
const digest = clientKeyBindingDigest(binding, chainId, smartAgent);
|
|
147
|
+
const signature = await input.signer(digest);
|
|
148
|
+
return { binding, chainId, verifyingContract: smartAgent, signature };
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Fail-closed: shape → alg the field verifies → names this SA on this chain → expected key → posture → custody
|
|
152
|
+
* epoch is CURRENT → validity window → ERC-1271 over the EIP-712 digest. Any anomaly ⇒ `ok:false`.
|
|
153
|
+
*/
|
|
154
|
+
export async function verifySignedClientKeyBinding(signed, opts) {
|
|
155
|
+
const b = signed?.binding;
|
|
156
|
+
if (!b || typeof signed.chainId !== 'number' || typeof signed.verifyingContract !== 'string' || typeof signed.signature !== 'string') {
|
|
157
|
+
return { ok: false, reason: 'bad_shape' };
|
|
158
|
+
}
|
|
159
|
+
const issues = validateClientKeyBinding(b);
|
|
160
|
+
if (issues.length) {
|
|
161
|
+
const alg = issues.find((i) => i.startsWith('binding.alg'));
|
|
162
|
+
return alg ? { ok: false, reason: 'alg_not_field_verifiable', detail: alg } : { ok: false, reason: 'bad_shape', detail: issues.join('; ') };
|
|
163
|
+
}
|
|
164
|
+
const m = CAIP10_EVM.exec(b.canonicalAgentId);
|
|
165
|
+
if (Number(m[1]) !== signed.chainId || m[2].toLowerCase() !== signed.verifyingContract.toLowerCase()) {
|
|
166
|
+
return { ok: false, reason: 'agent_mismatch' };
|
|
167
|
+
}
|
|
168
|
+
if (opts.expectThumbprint !== undefined && opts.expectThumbprint !== b.jwkThumbprint)
|
|
169
|
+
return { ok: false, reason: 'thumbprint_mismatch' };
|
|
170
|
+
if (opts.posture) {
|
|
171
|
+
const refusal = clientKeyScopeRefusal(b, opts.posture);
|
|
172
|
+
if (refusal)
|
|
173
|
+
return { ok: false, reason: 'scope_refused', detail: refusal };
|
|
174
|
+
}
|
|
175
|
+
if (!Number.isInteger(opts.currentCustodyEpoch) || opts.currentCustodyEpoch < 0)
|
|
176
|
+
return { ok: false, reason: 'bad_shape', detail: 'currentCustodyEpoch must be a non-negative integer' };
|
|
177
|
+
if (b.custodyEpoch !== opts.currentCustodyEpoch) {
|
|
178
|
+
return { ok: false, reason: 'stale_custody_epoch', detail: `bound under epoch ${b.custodyEpoch}; the account is at ${opts.currentCustodyEpoch}` };
|
|
179
|
+
}
|
|
180
|
+
const now = opts.now ?? Math.floor(Date.now() / 1000);
|
|
181
|
+
if (now < b.notBefore)
|
|
182
|
+
return { ok: false, reason: 'not_yet_valid' };
|
|
183
|
+
if (now > b.notAfter)
|
|
184
|
+
return { ok: false, reason: 'expired' };
|
|
185
|
+
let digest;
|
|
186
|
+
try {
|
|
187
|
+
digest = clientKeyBindingDigest(b, signed.chainId, signed.verifyingContract);
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
return { ok: false, reason: 'bad_shape' };
|
|
191
|
+
}
|
|
192
|
+
let valid;
|
|
193
|
+
try {
|
|
194
|
+
valid = await opts.erc1271Verifier.verifyHash({ address: signed.verifyingContract, hash: digest, signature: signed.signature });
|
|
195
|
+
}
|
|
196
|
+
catch {
|
|
197
|
+
return { ok: false, reason: 'signature_invalid' };
|
|
198
|
+
}
|
|
199
|
+
if (!valid)
|
|
200
|
+
return { ok: false, reason: 'signature_invalid' };
|
|
201
|
+
return { ok: true, smartAgent: signed.verifyingContract, digest };
|
|
202
|
+
}
|
|
203
|
+
export function clientKeyRecordRow(b) {
|
|
204
|
+
return { thumbprint: b.jwkThumbprint, alg: b.alg, scope: b.scope, clientId: b.clientId, custodyEpoch: b.custodyEpoch, notAfter: b.notAfter };
|
|
205
|
+
}
|
|
206
|
+
/** Validate a candidate record. `[]` when valid. */
|
|
207
|
+
export function validateClientKeysRecord(r) {
|
|
208
|
+
const issues = [];
|
|
209
|
+
if (typeof r !== 'object' || r === null || Array.isArray(r))
|
|
210
|
+
return ['clientKeys: must be an object'];
|
|
211
|
+
const x = r;
|
|
212
|
+
for (const k of Object.keys(x))
|
|
213
|
+
if (k !== 'v' && k !== 'keys')
|
|
214
|
+
issues.push(`clientKeys.${k}: unknown property`);
|
|
215
|
+
if (x.v !== 1)
|
|
216
|
+
issues.push('clientKeys.v: must be 1');
|
|
217
|
+
if (!Array.isArray(x.keys))
|
|
218
|
+
return [...issues, 'clientKeys.keys: must be an array'];
|
|
219
|
+
const seen = new Set();
|
|
220
|
+
x.keys.forEach((row, i) => {
|
|
221
|
+
const p = `clientKeys.keys[${i}]`;
|
|
222
|
+
if (typeof row !== 'object' || row === null || Array.isArray(row)) {
|
|
223
|
+
issues.push(`${p}: must be an object`);
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
const y = row;
|
|
227
|
+
for (const k of Object.keys(y))
|
|
228
|
+
if (!['thumbprint', 'alg', 'scope', 'clientId', 'custodyEpoch', 'notAfter'].includes(k))
|
|
229
|
+
issues.push(`${p}.${k}: unknown property`);
|
|
230
|
+
if (typeof y.thumbprint !== 'string')
|
|
231
|
+
issues.push(`${p}.thumbprint: required`);
|
|
232
|
+
else {
|
|
233
|
+
try {
|
|
234
|
+
thumbprintToBytes32(y.thumbprint);
|
|
235
|
+
}
|
|
236
|
+
catch {
|
|
237
|
+
issues.push(`${p}.thumbprint: must be a base64url sha256`);
|
|
238
|
+
}
|
|
239
|
+
if (seen.has(y.thumbprint))
|
|
240
|
+
issues.push(`${p}.thumbprint: duplicate`);
|
|
241
|
+
seen.add(y.thumbprint);
|
|
242
|
+
}
|
|
243
|
+
if (typeof y.alg !== 'string' || !CLIENT_KEY_ALGS.includes(y.alg))
|
|
244
|
+
issues.push(`${p}.alg: must be one of ${CLIENT_KEY_ALGS.join(' | ')}`);
|
|
245
|
+
if (y.scope !== 'service' && y.scope !== 'person')
|
|
246
|
+
issues.push(`${p}.scope: must be service | person`);
|
|
247
|
+
if (typeof y.clientId !== 'string' || !HTTPS_URL.test(y.clientId))
|
|
248
|
+
issues.push(`${p}.clientId: must be an https URL`);
|
|
249
|
+
if (!Number.isInteger(y.custodyEpoch) || y.custodyEpoch < 0)
|
|
250
|
+
issues.push(`${p}.custodyEpoch: must be a non-negative integer`);
|
|
251
|
+
if (!Number.isInteger(y.notAfter) || y.notAfter < 0)
|
|
252
|
+
issues.push(`${p}.notAfter: must be a non-negative integer`);
|
|
253
|
+
});
|
|
254
|
+
return issues;
|
|
255
|
+
}
|
|
256
|
+
/** RFC 8785 canonical JSON — two equal records encode to identical bytes (as `atl:distribution`). */
|
|
257
|
+
export function encodeClientKeys(record) {
|
|
258
|
+
const issues = validateClientKeysRecord(record);
|
|
259
|
+
if (issues.length)
|
|
260
|
+
throw new InvalidProfileError(`ClientKeysRecordV1: ${issues.join('; ')}`);
|
|
261
|
+
return jcsCanonicalize(record);
|
|
262
|
+
}
|
|
263
|
+
/** Fail-closed: anything that is not a valid record is `null` — an unreadable record is an answer, never a guess (ADR-0013). */
|
|
264
|
+
export function decodeClientKeys(value) {
|
|
265
|
+
if (!value)
|
|
266
|
+
return null;
|
|
267
|
+
let parsed;
|
|
268
|
+
try {
|
|
269
|
+
parsed = JSON.parse(value);
|
|
270
|
+
}
|
|
271
|
+
catch {
|
|
272
|
+
return null;
|
|
273
|
+
}
|
|
274
|
+
return validateClientKeysRecord(parsed).length ? null : parsed;
|
|
275
|
+
}
|
|
276
|
+
/** The rows a verifier treats as LIVE now: current epoch, not past `notAfter`. Stale rows are dead, not pruned here. */
|
|
277
|
+
export function liveClientKeys(record, opts) {
|
|
278
|
+
const now = opts.now ?? Math.floor(Date.now() / 1000);
|
|
279
|
+
return record.keys.filter((k) => k.custodyEpoch === opts.currentCustodyEpoch && k.notAfter > now);
|
|
280
|
+
}
|
|
281
|
+
export { CLIENT_KEYS };
|
|
282
|
+
//# sourceMappingURL=client-key-binding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-key-binding.js","sourceRoot":"","sources":["../src/client-key-binding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,aAAa,EAA0B,MAAM,MAAM,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAMlD,MAAM,CAAC,MAAM,eAAe,GAA4B,CAAC,OAAO,EAAE,OAAO,CAAU,CAAC;AAkCpF,wGAAwG;AAExG,MAAM,CAAC,MAAM,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K,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IACtD,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,KAAK,IAAI,CAAC,mBAAmB,IAAI,CAAC,CAAC,QAAQ,GAAG,GAAG,CAAC,CAAC;AACpG,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Address, type Hex, type WalletClient } from 'viem';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CanonicalAgentProfileV1, AgentIdentityClientOpts, PublishProfileInput, VerificationMethod } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Optional per-call submission context. Required for write methods.
|
|
5
5
|
*/
|
|
@@ -29,7 +29,7 @@ export declare class AgentIdentityClient {
|
|
|
29
29
|
private readonly fetcher;
|
|
30
30
|
constructor(opts: AgentIdentityClientOptsLive);
|
|
31
31
|
/**
|
|
32
|
-
* Fetch the
|
|
32
|
+
* Fetch the CanonicalAgentProfileV1 for `agent`:
|
|
33
33
|
* 1. Read `atl:metadataURI` + `atl:metadataHash` from the
|
|
34
34
|
* AgentProfileResolver (on-chain anchor).
|
|
35
35
|
* 2. HTTP-fetch the JSON at metadataURI.
|
|
@@ -41,7 +41,9 @@ export declare class AgentIdentityClient {
|
|
|
41
41
|
* `atl:metadataURI` record (treated equivalently — the on-chain
|
|
42
42
|
* anchor is absent).
|
|
43
43
|
*/
|
|
44
|
-
fetchProfile(agent: Address
|
|
44
|
+
fetchProfile(agent: Address, opts?: {
|
|
45
|
+
allowUnanchored?: boolean;
|
|
46
|
+
}): Promise<CanonicalAgentProfileV1 | null>;
|
|
45
47
|
/**
|
|
46
48
|
* Verify endpoint control for an MCP server profile. Phase 2
|
|
47
49
|
* scope: shape-only (caller declares which method). Real
|
|
@@ -51,7 +53,7 @@ export declare class AgentIdentityClient {
|
|
|
51
53
|
verifyEndpoint(agent: Address, endpoint: string, methods: VerificationMethod[]): Promise<VerificationMethod | null>;
|
|
52
54
|
/**
|
|
53
55
|
* Publish a profile by:
|
|
54
|
-
* 1. Validating the
|
|
56
|
+
* 1. Validating the CanonicalAgentProfileV1 + computing its canonical
|
|
55
57
|
* content-hash.
|
|
56
58
|
* 2. (If `expectedHash` set) asserting it matches our computed
|
|
57
59
|
* hash — anti-spoof self-check.
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAIA,OAAO,EAA8C,KAAK,OAAO,EAAE,KAAK,GAAG,EAAqB,KAAK,YAAY,EAAE,MAAM,MAAM,CAAC;AAQhI,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,YAAY,EAAE,YAAY,CAAC;CAC5B;AAwCD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,2BAA4B,SAAQ,uBAAuB;IAC1E,eAAe,EAAE,OAAO,CAAC;IACzB,uEAAuE;IACvE,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED,qBAAa,mBAAmB;IAKlB,QAAQ,CAAC,IAAI,EAAE,2BAA2B;IAJtD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAC5C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAU;IAC1C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;gBAElB,IAAI,EAAE,2BAA2B;IAetD;;;;;;;;;;;;OAYG;IACG,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC;IAyCjH;;;;;OAKG;IACG,cAAc,CAClB,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,kBAAkB,EAAE,GAC5B,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAYrC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,cAAc,CAAC,KAAK,EAAE,mBAAmB,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC;IA+DjF;;;OAGG;YACW,OAAO;CAiCtB"}
|
package/dist/client.js
CHANGED
|
@@ -1,9 +1,56 @@
|
|
|
1
|
+
import { AGENT_TYPE } from './constants.js';
|
|
2
|
+
import { decodeDerivedTypeId, isProfileTypeConsistent } from './derived-type.js';
|
|
3
|
+
import { ProfileTypeMismatchError } from './errors.js';
|
|
4
|
+
const ZERO_BYTES32 = '0x0000000000000000000000000000000000000000000000000000000000000000';
|
|
1
5
|
import { createPublicClient, http, keccak256, toHex } from 'viem';
|
|
2
|
-
import { agentProfileResolverAbi } from './abis';
|
|
3
|
-
import { profileContentHash, canonicalProfileJson } from './profile';
|
|
4
|
-
import { ProfileHashMismatchError } from './errors';
|
|
5
|
-
import { buildRegisterProfileCall, buildSetProfileMetadataCall, } from './calls';
|
|
6
|
+
import { agentProfileResolverAbi } from './abis.js';
|
|
7
|
+
import { profileContentHash, canonicalProfileJson } from './profile.js';
|
|
8
|
+
import { ProfileHashMismatchError, InvalidProfileError } from './errors.js';
|
|
9
|
+
import { buildRegisterProfileCall, buildSetProfileMetadataCall, } from './calls.js';
|
|
6
10
|
const ZERO_NODE = '0x0000000000000000000000000000000000000000000000000000000000000000';
|
|
11
|
+
// NEW-AP-2 (2026-07-05 completeness audit): the profile metadata URI is ATTACKER-CONTROLLED on-chain state
|
|
12
|
+
// (any agent sets its own ATL_METADATA_URI). fetchProfile runs server-side (indexer / Worker), so an
|
|
13
|
+
// unguarded fetch is an SSRF — an attacker points the URI at http://169.254.169.254/ (cloud metadata),
|
|
14
|
+
// loopback, or a private host. Allow ONLY https to a public host.
|
|
15
|
+
function isPrivateOrReservedHost(host) {
|
|
16
|
+
const m = host.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);
|
|
17
|
+
if (m) {
|
|
18
|
+
const a = Number(m[1]);
|
|
19
|
+
const b = Number(m[2]);
|
|
20
|
+
if (a === 0 || a === 127 || a === 10)
|
|
21
|
+
return true; // this-network / loopback / private
|
|
22
|
+
if (a === 172 && b >= 16 && b <= 31)
|
|
23
|
+
return true; // private
|
|
24
|
+
if (a === 192 && b === 168)
|
|
25
|
+
return true; // private
|
|
26
|
+
if (a === 169 && b === 254)
|
|
27
|
+
return true; // link-local incl 169.254.169.254 cloud metadata
|
|
28
|
+
if (a >= 224)
|
|
29
|
+
return true; // multicast / reserved
|
|
30
|
+
}
|
|
31
|
+
if (host === '::1' || host === '[::1]')
|
|
32
|
+
return true; // ipv6 loopback
|
|
33
|
+
if (host.startsWith('fe80:') || host.startsWith('[fe80:'))
|
|
34
|
+
return true; // ipv6 link-local
|
|
35
|
+
if (/^\[?f[cd][0-9a-f]{2}:/.test(host))
|
|
36
|
+
return true; // ipv6 ULA
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
function assertSafeProfileUri(uri) {
|
|
40
|
+
let u;
|
|
41
|
+
try {
|
|
42
|
+
u = new URL(uri);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
throw new InvalidProfileError(`profile URI is not a valid URL: ${uri}`);
|
|
46
|
+
}
|
|
47
|
+
if (u.protocol !== 'https:')
|
|
48
|
+
throw new InvalidProfileError(`profile URI must be https (SSRF guard); got ${u.protocol}`);
|
|
49
|
+
const host = u.hostname.toLowerCase().replace(/^\[|\]$/g, '');
|
|
50
|
+
if (host === 'localhost' || host.endsWith('.localhost') || host === '' || isPrivateOrReservedHost(host)) {
|
|
51
|
+
throw new InvalidProfileError(`profile URI host not allowed (SSRF guard): ${host}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
7
54
|
const ATL_METADATA_URI = keccak256(toHex('atl:metadataURI'));
|
|
8
55
|
const ATL_METADATA_HASH = keccak256(toHex('atl:metadataHash'));
|
|
9
56
|
export class AgentIdentityClient {
|
|
@@ -27,7 +74,7 @@ export class AgentIdentityClient {
|
|
|
27
74
|
}
|
|
28
75
|
// ─── Reads (Phase 2 — live) ─────────────────────────────────────
|
|
29
76
|
/**
|
|
30
|
-
* Fetch the
|
|
77
|
+
* Fetch the CanonicalAgentProfileV1 for `agent`:
|
|
31
78
|
* 1. Read `atl:metadataURI` + `atl:metadataHash` from the
|
|
32
79
|
* AgentProfileResolver (on-chain anchor).
|
|
33
80
|
* 2. HTTP-fetch the JSON at metadataURI.
|
|
@@ -39,7 +86,7 @@ export class AgentIdentityClient {
|
|
|
39
86
|
* `atl:metadataURI` record (treated equivalently — the on-chain
|
|
40
87
|
* anchor is absent).
|
|
41
88
|
*/
|
|
42
|
-
async fetchProfile(agent) {
|
|
89
|
+
async fetchProfile(agent, opts) {
|
|
43
90
|
const [uri, anchorHash] = await Promise.all([
|
|
44
91
|
this.publicClient.readContract({
|
|
45
92
|
address: this.profileResolver,
|
|
@@ -56,6 +103,8 @@ export class AgentIdentityClient {
|
|
|
56
103
|
]);
|
|
57
104
|
if (!uri || uri === '')
|
|
58
105
|
return null;
|
|
106
|
+
// NEW-AP-2: reject non-https / private / loopback / metadata hosts before touching the network.
|
|
107
|
+
assertSafeProfileUri(uri);
|
|
59
108
|
const response = await this.fetcher(uri);
|
|
60
109
|
if (!response.ok) {
|
|
61
110
|
throw new Error(`[agent-profile] failed to fetch profile JSON: HTTP ${response.status}`);
|
|
@@ -67,7 +116,15 @@ export class AgentIdentityClient {
|
|
|
67
116
|
const canonical = canonicalProfileJson(parsed);
|
|
68
117
|
void canonical; // forces validation
|
|
69
118
|
const computed = profileContentHash(parsed);
|
|
70
|
-
if (anchorHash
|
|
119
|
+
if (anchorHash === ZERO_NODE) {
|
|
120
|
+
// NEW-AP-1: a URI set with NO on-chain hash anchor cannot be integrity-checked — the fetched content is
|
|
121
|
+
// whatever the (mutable, off-chain) host returns. Fail-closed by default: the package's core invariant
|
|
122
|
+
// is `content-hash === anchor`, so treat an unanchored profile as no verifiable profile. Callers that
|
|
123
|
+
// genuinely accept unanchored content opt in explicitly (greppable, audit-worthy).
|
|
124
|
+
if (!opts?.allowUnanchored)
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
else if (computed !== anchorHash) {
|
|
71
128
|
throw new ProfileHashMismatchError(anchorHash, computed);
|
|
72
129
|
}
|
|
73
130
|
return parsed;
|
|
@@ -88,7 +145,7 @@ export class AgentIdentityClient {
|
|
|
88
145
|
// ─── Writes (Phase 4 — live) ─────────────────────────────────────
|
|
89
146
|
/**
|
|
90
147
|
* Publish a profile by:
|
|
91
|
-
* 1. Validating the
|
|
148
|
+
* 1. Validating the CanonicalAgentProfileV1 + computing its canonical
|
|
92
149
|
* content-hash.
|
|
93
150
|
* 2. (If `expectedHash` set) asserting it matches our computed
|
|
94
151
|
* hash — anti-spoof self-check.
|
|
@@ -115,6 +172,20 @@ export class AgentIdentityClient {
|
|
|
115
172
|
if (input.expectedHash && input.expectedHash.toLowerCase() !== computed.toLowerCase()) {
|
|
116
173
|
throw new ProfileHashMismatchError(input.expectedHash, computed);
|
|
117
174
|
}
|
|
175
|
+
// spec 346 §3.6 step 5: the card's `type` MUST agree with the SA-keyed `atl:agentType` when one is
|
|
176
|
+
// declared. One read; an undeclared type is an answer (no check), never a trigger for a second path.
|
|
177
|
+
const declaredId = (await this.publicClient.readContract({
|
|
178
|
+
address: this.profileResolver,
|
|
179
|
+
abi: agentProfileResolverAbi,
|
|
180
|
+
functionName: 'getBytes32Property',
|
|
181
|
+
args: [input.agent, AGENT_TYPE],
|
|
182
|
+
}));
|
|
183
|
+
if (declaredId !== ZERO_BYTES32) {
|
|
184
|
+
const declared = decodeDerivedTypeId(declaredId);
|
|
185
|
+
if (!declared || !isProfileTypeConsistent(input.profile.type, declared)) {
|
|
186
|
+
throw new ProfileTypeMismatchError(input.profile.type, declared ?? declaredId);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
118
189
|
// Register first if needed.
|
|
119
190
|
const isRegistered = await this.publicClient.readContract({
|
|
120
191
|
address: this.profileResolver,
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAgE,MAAM,MAAM,CAAC;AAChI,OAAO,EAAE,uBAAuB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACvD,MAAM,YAAY,GAAG,oEAAoE,CAAC;AAC1F,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAgE,MAAM,MAAM,CAAC;AAChI,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EACL,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,YAAY,CAAC;AAepB,MAAM,SAAS,GAAG,oEAA6E,CAAC;AAEhG,2GAA2G;AAC3G,qGAAqG;AACrG,uGAAuG;AACvG,kEAAkE;AAClE,SAAS,uBAAuB,CAAC,IAAY;IAC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|
export declare const CAIP10_NAMESPACE_ALLOWLIST: ReadonlySet<string>;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* CanonicalAgentProfileV1 schema version. Bump on any breaking change to the typed
|
|
26
26
|
* profile shape; canonical-JSON content-hash incorporates this field
|
|
27
27
|
* so old + new profiles never collide.
|
|
28
28
|
*/
|
|
29
29
|
export declare const AGENT_CARD_SCHEMA_VERSION: 1;
|
|
30
|
+
/**
|
|
31
|
+
* The SA-keyed DERIVED-TYPE record (spec 346 §2.3; ADR-0061). `getBytes32Property(agent, AGENT_TYPE)` →
|
|
32
|
+
* `keccak256(<DerivedAgentType>)`; `getStringProperty(agent, SERVICE_ROLE)` → the open-set role. Written by
|
|
33
|
+
* the SA itself (bootstrap step 1b), read by the naming plane to validate a typed claim, and by
|
|
34
|
+
* `publishProfile` to refuse a `profileType` that disagrees with it. Predicate ids mirror
|
|
35
|
+
* `AgentNamePredicates.sol` (`atl:agentType` / `atl:serviceRole`) and `agent-naming/records`.
|
|
36
|
+
*/
|
|
37
|
+
export declare const AGENT_TYPE: Hex;
|
|
38
|
+
export declare const SERVICE_ROLE: Hex;
|
|
39
|
+
/**
|
|
40
|
+
* The SA-keyed DISTRIBUTION record (spec 347 §8.5; `docs/architecture/ard-acp-crosswalk.md` §2–§3).
|
|
41
|
+
* `getStringProperty(agent, DISTRIBUTION)` → the JCS-canonical JSON of an `AgentDistributionV1`
|
|
42
|
+
* (`encodeDistribution` / `decodeDistribution`). Mirrors `AgentProfilePredicates.ATL_DISTRIBUTION`
|
|
43
|
+
* (`keccak256("atl:distribution")`); the indexer projects it to `approf:distribution`. Written by the SA
|
|
44
|
+
* itself (`buildSetDistributionCall`), never by a registry — a registry file is a PROJECTION of it.
|
|
45
|
+
*/
|
|
46
|
+
export declare const DISTRIBUTION: Hex;
|
|
47
|
+
/**
|
|
48
|
+
* The SA-keyed CLIENT KEYS record (spec 442 §3; `client-key-binding.ts`). `getStringProperty(agent, CLIENT_KEYS)`
|
|
49
|
+
* → the JCS-canonical JSON of a `ClientKeysRecordV1`: the public half of every live `ClientKeyBindingV1`
|
|
50
|
+
* (thumbprint · alg · scope · clientId · custody epoch · notAfter). Written by the SA itself
|
|
51
|
+
* (`buildSetClientKeysCall`); what a JWKS / client metadata document / TAP key directory is PROJECTED from
|
|
52
|
+
* (ap-federation spec 443) and what a verifier checks a presented binding against. Never a signature, never a key.
|
|
53
|
+
*/
|
|
54
|
+
export declare const CLIENT_KEYS: Hex;
|
|
55
|
+
/**
|
|
56
|
+
* The six platform keys an `AgentDistributionV1.binary` map may carry — verbatim from the ACP registry
|
|
57
|
+
* `agent.schema.json` (`binaryDistribution.propertyNames.enum`). Any other key fails validation.
|
|
58
|
+
*/
|
|
59
|
+
export declare const ACP_PLATFORMS: readonly ["darwin-aarch64", "darwin-x86_64", "linux-aarch64", "linux-x86_64", "windows-aarch64", "windows-x86_64"];
|
|
30
60
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,EAAE,GAAoC,CAAC;AAE/D;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,EAAE,WAAW,CAAC,MAAM,CAIzD,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAG,CAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,EAAE,GAAoC,CAAC;AAE/D;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,EAAE,WAAW,CAAC,MAAM,CAIzD,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAG,CAAU,CAAC;AAEpD;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,EAAE,GAAuC,CAAC;AACjE,eAAO,MAAM,YAAY,EAAE,GAAyC,CAAC;AAErE;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,EAAE,GAA0C,CAAC;AAEtE;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,EAAE,GAAwC,CAAC;AAEnE;;;GAGG;AACH,eAAO,MAAM,aAAa,oHAOhB,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -26,9 +26,46 @@ export const CAIP10_NAMESPACE_ALLOWLIST = new Set([
|
|
|
26
26
|
'solana', // Solana
|
|
27
27
|
]);
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* CanonicalAgentProfileV1 schema version. Bump on any breaking change to the typed
|
|
30
30
|
* profile shape; canonical-JSON content-hash incorporates this field
|
|
31
31
|
* so old + new profiles never collide.
|
|
32
32
|
*/
|
|
33
33
|
export const AGENT_CARD_SCHEMA_VERSION = 1;
|
|
34
|
+
/**
|
|
35
|
+
* The SA-keyed DERIVED-TYPE record (spec 346 §2.3; ADR-0061). `getBytes32Property(agent, AGENT_TYPE)` →
|
|
36
|
+
* `keccak256(<DerivedAgentType>)`; `getStringProperty(agent, SERVICE_ROLE)` → the open-set role. Written by
|
|
37
|
+
* the SA itself (bootstrap step 1b), read by the naming plane to validate a typed claim, and by
|
|
38
|
+
* `publishProfile` to refuse a `profileType` that disagrees with it. Predicate ids mirror
|
|
39
|
+
* `AgentNamePredicates.sol` (`atl:agentType` / `atl:serviceRole`) and `agent-naming/records`.
|
|
40
|
+
*/
|
|
41
|
+
export const AGENT_TYPE = keccak256(toHex('atl:agentType'));
|
|
42
|
+
export const SERVICE_ROLE = keccak256(toHex('atl:serviceRole'));
|
|
43
|
+
/**
|
|
44
|
+
* The SA-keyed DISTRIBUTION record (spec 347 §8.5; `docs/architecture/ard-acp-crosswalk.md` §2–§3).
|
|
45
|
+
* `getStringProperty(agent, DISTRIBUTION)` → the JCS-canonical JSON of an `AgentDistributionV1`
|
|
46
|
+
* (`encodeDistribution` / `decodeDistribution`). Mirrors `AgentProfilePredicates.ATL_DISTRIBUTION`
|
|
47
|
+
* (`keccak256("atl:distribution")`); the indexer projects it to `approf:distribution`. Written by the SA
|
|
48
|
+
* itself (`buildSetDistributionCall`), never by a registry — a registry file is a PROJECTION of it.
|
|
49
|
+
*/
|
|
50
|
+
export const DISTRIBUTION = keccak256(toHex('atl:distribution'));
|
|
51
|
+
/**
|
|
52
|
+
* The SA-keyed CLIENT KEYS record (spec 442 §3; `client-key-binding.ts`). `getStringProperty(agent, CLIENT_KEYS)`
|
|
53
|
+
* → the JCS-canonical JSON of a `ClientKeysRecordV1`: the public half of every live `ClientKeyBindingV1`
|
|
54
|
+
* (thumbprint · alg · scope · clientId · custody epoch · notAfter). Written by the SA itself
|
|
55
|
+
* (`buildSetClientKeysCall`); what a JWKS / client metadata document / TAP key directory is PROJECTED from
|
|
56
|
+
* (ap-federation spec 443) and what a verifier checks a presented binding against. Never a signature, never a key.
|
|
57
|
+
*/
|
|
58
|
+
export const CLIENT_KEYS = keccak256(toHex('atl:clientKeys'));
|
|
59
|
+
/**
|
|
60
|
+
* The six platform keys an `AgentDistributionV1.binary` map may carry — verbatim from the ACP registry
|
|
61
|
+
* `agent.schema.json` (`binaryDistribution.propertyNames.enum`). Any other key fails validation.
|
|
62
|
+
*/
|
|
63
|
+
export const ACP_PLATFORMS = [
|
|
64
|
+
'darwin-aarch64',
|
|
65
|
+
'darwin-x86_64',
|
|
66
|
+
'linux-aarch64',
|
|
67
|
+
'linux-x86_64',
|
|
68
|
+
'windows-aarch64',
|
|
69
|
+
'windows-x86_64',
|
|
70
|
+
];
|
|
34
71
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAY,MAAM,MAAM,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,WAAW,GAAQ,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;AAE/D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAwB,IAAI,GAAG,CAAC;IACrE,QAAQ,EAAE,aAAa;IACvB,QAAQ,EAAE,mBAAmB;IAC7B,QAAQ,EAAE,SAAS;CACpB,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAY,MAAM,MAAM,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,WAAW,GAAQ,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;AAE/D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAwB,IAAI,GAAG,CAAC;IACrE,QAAQ,EAAE,aAAa;IACvB,QAAQ,EAAE,mBAAmB;IAC7B,QAAQ,EAAE,SAAS;CACpB,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAU,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAQ,SAAS,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,YAAY,GAAQ,SAAS,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC;AAErE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAQ,SAAS,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC;AAEtE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAQ,SAAS,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAEnE;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,gBAAgB;IAChB,eAAe;IACf,eAAe;IACf,cAAc;IACd,iBAAiB;IACjB,gBAAgB;CACR,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Hex } from 'viem';
|
|
2
|
+
import type { DerivedAgentType } from '@agenticprimitives/types';
|
|
3
|
+
import type { ProfileType } from './types.js';
|
|
4
|
+
/** `keccak256(<DerivedAgentType>)` — the enum value stored under `atl:agentType` (mirrors agent-naming `AGENT_TYPE_ID`). */
|
|
5
|
+
export declare function derivedTypeId(t: DerivedAgentType): Hex;
|
|
6
|
+
export declare function decodeDerivedTypeId(id: Hex): DerivedAgentType | null;
|
|
7
|
+
/**
|
|
8
|
+
* Which derived types a `ProfileType` may describe (spec 346 §6.2 — publish refuses a profileType
|
|
9
|
+
* inconsistent with the SA's declared `atl:agentType`). `mcpServer` / `multisig` are technology/structure
|
|
10
|
+
* profiles that may sit on any service- or org-rooted agent.
|
|
11
|
+
*/
|
|
12
|
+
export declare function profileTypesForDerivedType(t: DerivedAgentType): readonly ProfileType[];
|
|
13
|
+
export declare function isProfileTypeConsistent(profileType: ProfileType, declared: DerivedAgentType): boolean;
|
|
14
|
+
//# sourceMappingURL=derived-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derived-type.d.ts","sourceRoot":"","sources":["../src/derived-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,4HAA4H;AAC5H,wBAAgB,aAAa,CAAC,CAAC,EAAE,gBAAgB,GAAG,GAAG,CAEtD;AAaD,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,GAAG,GAAG,gBAAgB,GAAG,IAAI,CAIpE;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,gBAAgB,GAAG,SAAS,WAAW,EAAE,CAuBtF;AAED,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAErG"}
|