@agenticprimitives/agent-profile 1.0.0-alpha.21 → 1.0.0-alpha.23
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 +54 -6
- 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 +312 -0
- package/dist/a2a/types.d.ts.map +1 -0
- package/dist/a2a/types.js +32 -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 +477 -0
- package/dist/a2a/validation.js.map +1 -0
- package/dist/calls.d.ts +12 -0
- package/dist/calls.d.ts.map +1 -1
- package/dist/calls.js +16 -0
- package/dist/calls.js.map +1 -1
- package/dist/card.d.ts +12 -6
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +12 -6
- package/dist/card.js.map +1 -1
- package/dist/client.d.ts +4 -4
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +20 -2
- package/dist/client.js.map +1 -1
- package/dist/constants.d.ts +23 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +30 -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 +7 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -5
- 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 +12 -1
- package/dist/profile.js.map +1 -1
- package/dist/types.d.ts +104 -7
- package/dist/types.d.ts.map +1 -1
- package/package.json +13 -6
- package/spec.md +5 -1
package/dist/card.d.ts
CHANGED
|
@@ -15,11 +15,13 @@
|
|
|
15
15
|
* It is descriptive evidence only and carries NO authority to act.
|
|
16
16
|
*/
|
|
17
17
|
import { type Address, type Hex } from 'viem';
|
|
18
|
-
import type {
|
|
18
|
+
import type { CanonicalAgentProfileV1, Sha256, SignedCanonicalProfileBundleV1 } from './types.js';
|
|
19
19
|
/** sha256 over the canonical-JSON encoding of a card → `sha256:<hex>`. Deterministic across runtimes
|
|
20
20
|
* (UTF-8 byte-level). Reuses {@link canonicalProfileJson} so the bytes hashed here match the package's
|
|
21
21
|
* one canonical card encoding. */
|
|
22
|
-
export declare function
|
|
22
|
+
export declare function hashCanonicalProfile(profile: CanonicalAgentProfileV1): Sha256;
|
|
23
|
+
/** @deprecated Renamed `hashCanonicalProfile` (spec 347 §0.3). Same bytes, same hash. */
|
|
24
|
+
export declare const hashAgentCard: typeof hashCanonicalProfile;
|
|
23
25
|
/** Injected ERC-1271 read — `verifyingContract.isValidSignature(hash, signature)` resolved to a bool.
|
|
24
26
|
* Satisfied structurally by a viem `PublicClient` (`verifyHash`). */
|
|
25
27
|
export interface Erc1271Verifier {
|
|
@@ -32,7 +34,7 @@ export interface Erc1271Verifier {
|
|
|
32
34
|
/** Injected Smart-Agent signer: signs the 32-byte digest, returning the ERC-1271-validatable signature. */
|
|
33
35
|
export type SmartAgentCardSigner = (digest: Hex) => Promise<Hex>;
|
|
34
36
|
export interface BuildSignedAgentCardInput {
|
|
35
|
-
card:
|
|
37
|
+
card: CanonicalAgentProfileV1;
|
|
36
38
|
/** The canonical Smart Agent the card describes. Also the signer + verifying contract in V1. */
|
|
37
39
|
subjectAgent: Address;
|
|
38
40
|
chainId: number;
|
|
@@ -43,12 +45,14 @@ export interface BuildSignedAgentCardInput {
|
|
|
43
45
|
}
|
|
44
46
|
/** Build a signed card bundle: hash the card, have the subject SA sign the digest (ERC-1271), return the
|
|
45
47
|
* signed {@link SignedAgentCardBundleV1}. */
|
|
46
|
-
export declare function
|
|
48
|
+
export declare function buildSignedCanonicalProfileBundle(input: BuildSignedAgentCardInput, sign: SmartAgentCardSigner): Promise<SignedCanonicalProfileBundleV1>;
|
|
49
|
+
/** @deprecated Renamed `buildSignedCanonicalProfileBundle` (spec 347 §0.3). */
|
|
50
|
+
export declare const buildSignedAgentCardBundle: typeof buildSignedCanonicalProfileBundle;
|
|
47
51
|
export type VerifySignedAgentCardResult = {
|
|
48
52
|
ok: true;
|
|
49
53
|
subjectAgent: Address;
|
|
50
54
|
cardHash: Sha256;
|
|
51
|
-
card:
|
|
55
|
+
card: CanonicalAgentProfileV1;
|
|
52
56
|
} | {
|
|
53
57
|
ok: false;
|
|
54
58
|
reason: 'bad_shape' | 'card_hash_mismatch' | 'subject_mismatch' | 'expired' | 'signature_invalid';
|
|
@@ -57,8 +61,10 @@ export type VerifySignedAgentCardResult = {
|
|
|
57
61
|
* (catches a card tamper that left the hash stale), confirm the proof is self-asserted by the subject SA
|
|
58
62
|
* (signer == verifyingContract == subjectAgent — V1), enforce expiry, then re-check the subject SA's
|
|
59
63
|
* ERC-1271 signature over the digest (authoritative). Fail-closed: any anomaly → `ok:false`. */
|
|
60
|
-
export declare function
|
|
64
|
+
export declare function verifySignedCanonicalProfileBundle(bundle: SignedCanonicalProfileBundleV1, opts: {
|
|
61
65
|
verifier: Erc1271Verifier;
|
|
62
66
|
now?: number;
|
|
63
67
|
}): Promise<VerifySignedAgentCardResult>;
|
|
68
|
+
/** @deprecated Renamed `verifySignedCanonicalProfileBundle` (spec 347 §0.3). */
|
|
69
|
+
export declare const verifySignedAgentCardBundle: typeof verifySignedCanonicalProfileBundle;
|
|
64
70
|
//# sourceMappingURL=card.d.ts.map
|
package/dist/card.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../src/card.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAA+B,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAE3E,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../src/card.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAA+B,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;A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kBAAkB,GAAG,SAAS,GAAG,mBAAmB,CAAA;CAAE,CAAC;AAErH;;;iGAGiG;AACjG,wBAAsB,kCAAkC,CACtD,MAAM,EAAE,8BAA8B,EACtC,IAAI,EAAE;IAAE,QAAQ,EAAE,eAAe,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAChD,OAAO,CAAC,2BAA2B,CAAC,CAkDtC;AAED,gFAAgF;AAChF,eAAO,MAAM,2BAA2B,2CAAqC,CAAC"}
|
package/dist/card.js
CHANGED
|
@@ -23,9 +23,11 @@ import { canonicalizeJson as canonicalize } from '@agenticprimitives/types';
|
|
|
23
23
|
/** sha256 over the canonical-JSON encoding of a card → `sha256:<hex>`. Deterministic across runtimes
|
|
24
24
|
* (UTF-8 byte-level). Reuses {@link canonicalProfileJson} so the bytes hashed here match the package's
|
|
25
25
|
* one canonical card encoding. */
|
|
26
|
-
export function
|
|
27
|
-
return `sha256:${viemSha256(toHex(canonicalProfileJson(
|
|
26
|
+
export function hashCanonicalProfile(profile) {
|
|
27
|
+
return `sha256:${viemSha256(toHex(canonicalProfileJson(profile))).slice(2)}`;
|
|
28
28
|
}
|
|
29
|
+
/** @deprecated Renamed `hashCanonicalProfile` (spec 347 §0.3). Same bytes, same hash. */
|
|
30
|
+
export const hashAgentCard = hashCanonicalProfile;
|
|
29
31
|
/** The 32-byte digest (0x-hex) the subject SA signs / the ERC-1271 read validates over. Binds the card
|
|
30
32
|
* hash to the subject + chain + verifying contract, so a card cannot be replayed for another SA/chain. */
|
|
31
33
|
function cardDigest(b) {
|
|
@@ -40,9 +42,9 @@ function cardDigest(b) {
|
|
|
40
42
|
}
|
|
41
43
|
/** Build a signed card bundle: hash the card, have the subject SA sign the digest (ERC-1271), return the
|
|
42
44
|
* signed {@link SignedAgentCardBundleV1}. */
|
|
43
|
-
export async function
|
|
45
|
+
export async function buildSignedCanonicalProfileBundle(input, sign) {
|
|
44
46
|
const verifyingContract = input.verifyingContract ?? input.subjectAgent;
|
|
45
|
-
const cardHash =
|
|
47
|
+
const cardHash = hashCanonicalProfile(input.card);
|
|
46
48
|
const signature = await sign(cardDigest({
|
|
47
49
|
cardHash,
|
|
48
50
|
subjectAgent: input.subjectAgent,
|
|
@@ -67,11 +69,13 @@ export async function buildSignedAgentCardBundle(input, sign) {
|
|
|
67
69
|
},
|
|
68
70
|
};
|
|
69
71
|
}
|
|
72
|
+
/** @deprecated Renamed `buildSignedCanonicalProfileBundle` (spec 347 §0.3). */
|
|
73
|
+
export const buildSignedAgentCardBundle = buildSignedCanonicalProfileBundle;
|
|
70
74
|
/** Verify a signed card bundle WITHOUT trusting whoever served it: recompute `cardHash` from the card
|
|
71
75
|
* (catches a card tamper that left the hash stale), confirm the proof is self-asserted by the subject SA
|
|
72
76
|
* (signer == verifyingContract == subjectAgent — V1), enforce expiry, then re-check the subject SA's
|
|
73
77
|
* ERC-1271 signature over the digest (authoritative). Fail-closed: any anomaly → `ok:false`. */
|
|
74
|
-
export async function
|
|
78
|
+
export async function verifySignedCanonicalProfileBundle(bundle, opts) {
|
|
75
79
|
if (!bundle ||
|
|
76
80
|
bundle.type !== 'SignedAgentCardBundleV1' ||
|
|
77
81
|
!bundle.card ||
|
|
@@ -81,7 +85,7 @@ export async function verifySignedAgentCardBundle(bundle, opts) {
|
|
|
81
85
|
}
|
|
82
86
|
let recomputed;
|
|
83
87
|
try {
|
|
84
|
-
recomputed =
|
|
88
|
+
recomputed = hashCanonicalProfile(bundle.card);
|
|
85
89
|
}
|
|
86
90
|
catch {
|
|
87
91
|
return { ok: false, reason: 'bad_shape' }; // invalid card shape
|
|
@@ -121,4 +125,6 @@ export async function verifySignedAgentCardBundle(bundle, opts) {
|
|
|
121
125
|
return { ok: false, reason: 'signature_invalid' };
|
|
122
126
|
return { ok: true, subjectAgent: bundle.subjectAgent, cardHash: bundle.cardHash, card: bundle.card };
|
|
123
127
|
}
|
|
128
|
+
/** @deprecated Renamed `verifySignedCanonicalProfileBundle` (spec 347 §0.3). */
|
|
129
|
+
export const verifySignedAgentCardBundle = verifySignedCanonicalProfileBundle;
|
|
124
130
|
//# sourceMappingURL=card.js.map
|
package/dist/card.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.js","sourceRoot":"","sources":["../src/card.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,KAAK,EAA0B,MAAM,MAAM,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,6FAA6F;AAC7F,+FAA+F;AAC/F,4DAA4D;AAC5D,OAAO,EAAE,gBAAgB,IAAI,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE5E;;mCAEmC;AACnC,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"card.js","sourceRoot":"","sources":["../src/card.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,KAAK,EAA0B,MAAM,MAAM,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,6FAA6F;AAC7F,+FAA+F;AAC/F,4DAA4D;AAC5D,OAAO,EAAE,gBAAgB,IAAI,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE5E;;mCAEmC;AACnC,MAAM,UAAU,oBAAoB,CAAC,OAAgC;IACnE,OAAO,UAAU,UAAU,CAAC,KAAK,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAY,CAAC;AACzF,CAAC;AAED,yFAAyF;AACzF,MAAM,CAAC,MAAM,aAAa,GAAG,oBAAoB,CAAC;AAIlD;2GAC2G;AAC3G,SAAS,UAAU,CAAC,CAOnB;IACC,OAAO,UAAU,CACf,KAAK,CACH,YAAY,CAAC;QACX,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,YAAY,EA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GAAG,GAAG;YAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IAC/E,CAAC;IAED,IAAI,KAAc,CAAC;IACnB,IAAI,CAAC;QACH,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;YACrC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,iBAAiB;YACvC,IAAI,EAAE,UAAU,CAAC;gBACf,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,YAAY,EAAE,MAAM,CAAC,YAAY;gBACjC,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;gBAC7B,iBAAiB,EAAE,MAAM,CAAC,KAAK,CAAC,iBAAiB;aAClD,CAAC;YACF,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,SAAS;SAClC,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC;IACpD,CAAC;IACD,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9D,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;AACvG,CAAC;AAED,gFAAgF;AAChF,MAAM,CAAC,MAAM,2BAA2B,GAAG,kCAAkC,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.
|
|
@@ -43,7 +43,7 @@ export declare class AgentIdentityClient {
|
|
|
43
43
|
*/
|
|
44
44
|
fetchProfile(agent: Address, opts?: {
|
|
45
45
|
allowUnanchored?: boolean;
|
|
46
|
-
}): Promise<
|
|
46
|
+
}): Promise<CanonicalAgentProfileV1 | null>;
|
|
47
47
|
/**
|
|
48
48
|
* Verify endpoint control for an MCP server profile. Phase 2
|
|
49
49
|
* scope: shape-only (caller declares which method). Real
|
|
@@ -53,7 +53,7 @@ export declare class AgentIdentityClient {
|
|
|
53
53
|
verifyEndpoint(agent: Address, endpoint: string, methods: VerificationMethod[]): Promise<VerificationMethod | null>;
|
|
54
54
|
/**
|
|
55
55
|
* Publish a profile by:
|
|
56
|
-
* 1. Validating the
|
|
56
|
+
* 1. Validating the CanonicalAgentProfileV1 + computing its canonical
|
|
57
57
|
* content-hash.
|
|
58
58
|
* 2. (If `expectedHash` set) asserting it matches our computed
|
|
59
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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-type.js';
|
|
3
|
+
import { ProfileTypeMismatchError } from './errors.js';
|
|
4
|
+
const ZERO_BYTES32 = '0x0000000000000000000000000000000000000000000000000000000000000000';
|
|
1
5
|
import { createPublicClient, http, keccak256, toHex } from 'viem';
|
|
2
6
|
import { agentProfileResolverAbi } from './abis.js';
|
|
3
7
|
import { profileContentHash, canonicalProfileJson } from './profile.js';
|
|
@@ -70,7 +74,7 @@ export class AgentIdentityClient {
|
|
|
70
74
|
}
|
|
71
75
|
// ─── Reads (Phase 2 — live) ─────────────────────────────────────
|
|
72
76
|
/**
|
|
73
|
-
* Fetch the
|
|
77
|
+
* Fetch the CanonicalAgentProfileV1 for `agent`:
|
|
74
78
|
* 1. Read `atl:metadataURI` + `atl:metadataHash` from the
|
|
75
79
|
* AgentProfileResolver (on-chain anchor).
|
|
76
80
|
* 2. HTTP-fetch the JSON at metadataURI.
|
|
@@ -141,7 +145,7 @@ export class AgentIdentityClient {
|
|
|
141
145
|
// ─── Writes (Phase 4 — live) ─────────────────────────────────────
|
|
142
146
|
/**
|
|
143
147
|
* Publish a profile by:
|
|
144
|
-
* 1. Validating the
|
|
148
|
+
* 1. Validating the CanonicalAgentProfileV1 + computing its canonical
|
|
145
149
|
* content-hash.
|
|
146
150
|
* 2. (If `expectedHash` set) asserting it matches our computed
|
|
147
151
|
* hash — anti-spoof self-check.
|
|
@@ -168,6 +172,20 @@ export class AgentIdentityClient {
|
|
|
168
172
|
if (input.expectedHash && input.expectedHash.toLowerCase() !== computed.toLowerCase()) {
|
|
169
173
|
throw new ProfileHashMismatchError(input.expectedHash, computed);
|
|
170
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
|
+
}
|
|
171
189
|
// Register first if needed.
|
|
172
190
|
const isRegistered = await this.publicClient.readContract({
|
|
173
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,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;IAC3C,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;IACrE,IAAI,CAAC,EAAE,CAAC;QACN,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvB,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAA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,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;oBAC/D,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;oBAC9C,SAAS;gBACX,CAAC;gBACD,MAAM,GAAG,CAAC;YACZ,CAAC;QACH,CAAC;QACD,MAAM,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IACpG,CAAC;CACF"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -22,9 +22,31 @@ export declare const AUTH_ORIGIN: Hex;
|
|
|
22
22
|
*/
|
|
23
23
|
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 six platform keys an `AgentDistributionV1.binary` map may carry — verbatim from the ACP registry
|
|
49
|
+
* `agent.schema.json` (`binaryDistribution.propertyNames.enum`). Any other key fails validation.
|
|
50
|
+
*/
|
|
51
|
+
export declare const ACP_PLATFORMS: readonly ["darwin-aarch64", "darwin-x86_64", "linux-aarch64", "linux-x86_64", "windows-aarch64", "windows-x86_64"];
|
|
30
52
|
//# 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;;;GAGG;AACH,eAAO,MAAM,aAAa,oHAOhB,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -26,9 +26,38 @@ 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 six platform keys an `AgentDistributionV1.binary` map may carry — verbatim from the ACP registry
|
|
53
|
+
* `agent.schema.json` (`binaryDistribution.propertyNames.enum`). Any other key fails validation.
|
|
54
|
+
*/
|
|
55
|
+
export const ACP_PLATFORMS = [
|
|
56
|
+
'darwin-aarch64',
|
|
57
|
+
'darwin-x86_64',
|
|
58
|
+
'linux-aarch64',
|
|
59
|
+
'linux-x86_64',
|
|
60
|
+
'windows-aarch64',
|
|
61
|
+
'windows-x86_64',
|
|
62
|
+
];
|
|
34
63
|
//# 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;;;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"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { keccak256, toHex } from 'viem';
|
|
2
|
+
import { DERIVED_AGENT_TYPES } from '@agenticprimitives/types';
|
|
3
|
+
/** `keccak256(<DerivedAgentType>)` — the enum value stored under `atl:agentType` (mirrors agent-naming `AGENT_TYPE_ID`). */
|
|
4
|
+
export function derivedTypeId(t) {
|
|
5
|
+
return keccak256(toHex(t));
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Encodings a chain already carries for a type this package has since RENAMED. Reading is where the
|
|
9
|
+
* past has to be honoured: `.workspace` agents declared before 2026-08-31 hold
|
|
10
|
+
* `keccak256("workspace-coordinator")`, and refusing to decode that would report a correctly typed
|
|
11
|
+
* agent as untyped. WRITING always uses the current name — `derivedTypeId` never consults this map,
|
|
12
|
+
* so nothing new is minted under a legacy encoding. Append only; never remove an entry.
|
|
13
|
+
*/
|
|
14
|
+
const LEGACY_TYPE_IDS = Object.freeze({
|
|
15
|
+
[keccak256(toHex('workspace-coordinator')).toLowerCase()]: 'workspace',
|
|
16
|
+
});
|
|
17
|
+
export function decodeDerivedTypeId(id) {
|
|
18
|
+
const lower = id.toLowerCase();
|
|
19
|
+
for (const t of DERIVED_AGENT_TYPES)
|
|
20
|
+
if (derivedTypeId(t).toLowerCase() === lower)
|
|
21
|
+
return t;
|
|
22
|
+
return LEGACY_TYPE_IDS[lower] ?? null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Which derived types a `ProfileType` may describe (spec 346 §6.2 — publish refuses a profileType
|
|
26
|
+
* inconsistent with the SA's declared `atl:agentType`). `mcpServer` / `multisig` are technology/structure
|
|
27
|
+
* profiles that may sit on any service- or org-rooted agent.
|
|
28
|
+
*/
|
|
29
|
+
export function profileTypesForDerivedType(t) {
|
|
30
|
+
switch (t) {
|
|
31
|
+
case 'person':
|
|
32
|
+
return ['person'];
|
|
33
|
+
case 'org':
|
|
34
|
+
return ['org', 'alliance', 'multisig'];
|
|
35
|
+
case 'team':
|
|
36
|
+
return ['team', 'multisig'];
|
|
37
|
+
case 'service':
|
|
38
|
+
return ['service', 'mcpServer', 'multisig'];
|
|
39
|
+
case 'workspace':
|
|
40
|
+
return ['service', 'mcpServer'];
|
|
41
|
+
case 'treasury':
|
|
42
|
+
return ['treasury', 'multisig'];
|
|
43
|
+
case 'registry':
|
|
44
|
+
return ['service', 'mcpServer'];
|
|
45
|
+
case 'church':
|
|
46
|
+
return ['church', 'multisig'];
|
|
47
|
+
case 'circle':
|
|
48
|
+
return ['circle', 'multisig'];
|
|
49
|
+
case 'household':
|
|
50
|
+
return ['household', 'multisig'];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export function isProfileTypeConsistent(profileType, declared) {
|
|
54
|
+
return profileTypesForDerivedType(declared).includes(profileType);
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=derived-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derived-type.js","sourceRoot":"","sources":["../src/derived-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAY,MAAM,MAAM,CAAC;AAElD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAG/D,4HAA4H;AAC5H,MAAM,UAAU,aAAa,CAAC,CAAmB;IAC/C,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,eAAe,GAA+C,MAAM,CAAC,MAAM,CAAC;IAChF,CAAC,SAAS,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,EAAE,WAAW;CACvE,CAAC,CAAC;AAEH,MAAM,UAAU,mBAAmB,CAAC,EAAO;IACzC,MAAM,KAAK,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC;IAC/B,KAAK,MAAM,CAAC,IAAI,mBAAmB;QAAE,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,KAAK;YAAE,OAAO,CAAC,CAAC;IAC5F,OAAO,eAAe,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC;AACxC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,CAAmB;IAC5D,QAAQ,CAAC,EAAE,CAAC;QACV,KAAK,QAAQ;YACX,OAAO,CAAC,QAAQ,CAAC,CAAC;QACpB,KAAK,KAAK;YACR,OAAO,CAAC,KAAK,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;QACzC,KAAK,MAAM;YACT,OAAO,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QAC9B,KAAK,SAAS;YACZ,OAAO,CAAC,SAAS,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;QAC9C,KAAK,WAAW;YACd,OAAO,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAClC,KAAK,UAAU;YACb,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAClC,KAAK,UAAU;YACb,OAAO,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAClC,KAAK,QAAQ;YACX,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QAChC,KAAK,QAAQ;YACX,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QAChC,KAAK,WAAW;YACd,OAAO,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACrC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,WAAwB,EAAE,QAA0B;IAC1F,OAAO,0BAA0B,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `AgentDistributionV1` — validation + on-chain string encoding (spec 347 §8.5;
|
|
3
|
+
* `docs/architecture/ard-acp-crosswalk.md` §2–§3).
|
|
4
|
+
*
|
|
5
|
+
* Pure. The wire form is the RFC 8785 (JCS) canonical JSON string of the object, stored as the SA-keyed
|
|
6
|
+
* `atl:distribution` string property; two semantically-equal distributions encode to identical bytes.
|
|
7
|
+
* The rules mirror the ACP registry `agent.schema.json` `distribution` definitions exactly (field names,
|
|
8
|
+
* platform enum, `additionalProperties:false`, `minProperties:1`, sha256 pattern) plus the two AP-owned
|
|
9
|
+
* fields (`acp`, `version`) and the schema's prose rule that installer archives are unsupported.
|
|
10
|
+
*
|
|
11
|
+
* `decodeDistribution` is fail-closed: anything that is not a valid `AgentDistributionV1` is `null` —
|
|
12
|
+
* an unreadable record is an answer, never a trigger to guess (ADR-0013).
|
|
13
|
+
*/
|
|
14
|
+
import type { AgentDistributionV1 } from './types.js';
|
|
15
|
+
/**
|
|
16
|
+
* Validate a candidate `AgentDistributionV1`. Returns `[]` when valid, else one human-readable issue per
|
|
17
|
+
* violation (JSON-pointer-ish `path: reason`). Never throws; accepts `unknown` so a decoded record can be
|
|
18
|
+
* checked before it is trusted as the type.
|
|
19
|
+
*/
|
|
20
|
+
export declare function validateDistribution(d: unknown): string[];
|
|
21
|
+
/**
|
|
22
|
+
* The on-chain string form: RFC 8785 JCS of the validated object (sorted keys, no whitespace,
|
|
23
|
+
* `undefined` members omitted). Throws `InvalidProfileError` on any validation issue — the write path is
|
|
24
|
+
* fail-loud, so an invalid distribution never reaches the chain.
|
|
25
|
+
*/
|
|
26
|
+
export declare function encodeDistribution(d: AgentDistributionV1): string;
|
|
27
|
+
/**
|
|
28
|
+
* Parse an on-chain / KB `atl:distribution` string. Fail-closed: not JSON, not an object, or any
|
|
29
|
+
* validation issue ⇒ `null`. Never throws.
|
|
30
|
+
*/
|
|
31
|
+
export declare function decodeDistribution(s: string | null | undefined): AgentDistributionV1 | null;
|
|
32
|
+
//# sourceMappingURL=distribution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"distribution.d.ts","sourceRoot":"","sources":["../src/distribution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AActD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAmBzD;AA8DD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAIjE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,mBAAmB,GAAG,IAAI,CAM3F"}
|