@agenticprimitives/agent-naming 1.0.0-alpha.5 → 1.0.0-alpha.50
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/AUDIT.md +52 -2
- package/CLAUDE.md +43 -64
- package/README.md +57 -54
- package/dist/abis.d.ts +1113 -11
- package/dist/abis.d.ts.map +1 -1
- package/dist/abis.js +184 -0
- package/dist/abis.js.map +1 -1
- package/dist/claim.d.ts +103 -0
- package/dist/claim.d.ts.map +1 -0
- package/dist/claim.js +131 -0
- package/dist/claim.js.map +1 -0
- package/dist/client.d.ts +36 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +197 -10
- package/dist/client.js.map +1 -1
- package/dist/constants.d.ts +75 -5
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +156 -4
- package/dist/constants.js.map +1 -1
- package/dist/custody.d.ts +149 -10
- package/dist/custody.d.ts.map +1 -1
- package/dist/custody.js +243 -13
- package/dist/custody.js.map +1 -1
- package/dist/dns.d.ts +186 -0
- package/dist/dns.d.ts.map +1 -0
- package/dist/dns.js +296 -0
- package/dist/dns.js.map +1 -0
- package/dist/federated.d.ts +31 -0
- package/dist/federated.d.ts.map +1 -0
- package/dist/federated.js +54 -0
- package/dist/federated.js.map +1 -0
- package/dist/grammar.d.ts +62 -0
- package/dist/grammar.d.ts.map +1 -0
- package/dist/grammar.js +165 -0
- package/dist/grammar.js.map +1 -0
- package/dist/hash.d.ts +14 -0
- package/dist/hash.d.ts.map +1 -0
- package/dist/hash.js +22 -0
- package/dist/hash.js.map +1 -0
- package/dist/index.d.ts +17 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -8
- package/dist/index.js.map +1 -1
- package/dist/issuance.d.ts +70 -0
- package/dist/issuance.d.ts.map +1 -0
- package/dist/issuance.js +65 -0
- package/dist/issuance.js.map +1 -0
- package/dist/label.d.ts +10 -0
- package/dist/label.d.ts.map +1 -0
- package/dist/label.js +39 -0
- package/dist/label.js.map +1 -0
- package/dist/namehash.d.ts +10 -23
- package/dist/namehash.d.ts.map +1 -1
- package/dist/namehash.js +11 -35
- package/dist/namehash.js.map +1 -1
- package/dist/normalize.d.ts +9 -17
- package/dist/normalize.d.ts.map +1 -1
- package/dist/normalize.js +11 -48
- package/dist/normalize.js.map +1 -1
- package/dist/price.d.ts +74 -0
- package/dist/price.d.ts.map +1 -0
- package/dist/price.js +65 -0
- package/dist/price.js.map +1 -0
- package/dist/records.d.ts +44 -3
- package/dist/records.d.ts.map +1 -1
- package/dist/records.js +203 -4
- package/dist/records.js.map +1 -1
- package/dist/types.d.ts +108 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/vertical.d.ts +43 -0
- package/dist/vertical.d.ts.map +1 -0
- package/dist/vertical.js +44 -0
- package/dist/vertical.js.map +1 -0
- package/docs/api.md +15 -1
- package/package.json +22 -13
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { Address, Hex } from '@agenticprimitives/types';
|
|
1
|
+
import type { Address, Hex, AgentType, DerivedAgentType } from '@agenticprimitives/types';
|
|
2
|
+
import type { AgentTld, LegacyTld } from './constants.js';
|
|
2
3
|
/**
|
|
3
4
|
* Discriminator for the KIND of Smart Agent a name points to. Three kinds only
|
|
4
5
|
* — mirrors `@agenticprimitives/types` `AgentType` and the on-chain
|
|
@@ -9,6 +10,17 @@ import type { Address, Hex } from '@agenticprimitives/types';
|
|
|
9
10
|
* forensics can filter "all events involving a service agent."
|
|
10
11
|
*/
|
|
11
12
|
export type AgentKind = 'person' | 'org' | 'service';
|
|
13
|
+
/**
|
|
14
|
+
* How a Smart Agent is connectable — the credential KIND a returning person
|
|
15
|
+
* presents to bootstrap a connection by name (spec 280). `multi` = more than
|
|
16
|
+
* one connectable credential is published. Distinct from {@link AgentKind}
|
|
17
|
+
* (what the agent IS) — this is HOW you authenticate to it.
|
|
18
|
+
*/
|
|
19
|
+
export type ConnectionKind = 'wallet' | 'google' | 'youversion' | 'passkey' | 'multi' | 'email' | 'phone';
|
|
20
|
+
/** Public app-level discovery context. Not authority; consumers still verify grants/delegations. */
|
|
21
|
+
export type AppContext = 'uupg' | (string & {});
|
|
22
|
+
/** Public organization role within an app context. */
|
|
23
|
+
export type OrgRole = 'organization' | 'alliance' | (string & {});
|
|
12
24
|
/**
|
|
13
25
|
* The typed bag of records a resolver may hold for a name. Every
|
|
14
26
|
* field is optional; an unresolved record is `undefined`. Encoders
|
|
@@ -29,8 +41,26 @@ export interface AgentNameRecords {
|
|
|
29
41
|
a2aEndpoint?: string;
|
|
30
42
|
/** MCP service endpoint URL. */
|
|
31
43
|
mcpEndpoint?: string;
|
|
44
|
+
/** Public app/discovery context, e.g. `uupg`. */
|
|
45
|
+
appContext?: AppContext;
|
|
46
|
+
/** Public role within the app context, e.g. `alliance` or `organization`. */
|
|
47
|
+
orgRole?: OrgRole;
|
|
48
|
+
/** Public service URL for the agent's app-specific surface. */
|
|
49
|
+
serviceUrl?: string;
|
|
50
|
+
/** Public website URL for the agent. */
|
|
51
|
+
siteUrl?: string;
|
|
52
|
+
/** Public description for search/discovery. */
|
|
53
|
+
description?: string;
|
|
32
54
|
/** Off-chain JSON manifest URL. */
|
|
33
55
|
metadataUri?: string;
|
|
56
|
+
/**
|
|
57
|
+
* sha256 of the RELEASED A2A Agent Card this name currently publishes (spec 347 §8.3), as bytes32.
|
|
58
|
+
* Content-addresses the card served at the a2aEndpoint host's `/.well-known/agent-card.json`
|
|
59
|
+
* (or at `cardUri`). Evidence for verifiers, never authority.
|
|
60
|
+
*/
|
|
61
|
+
cardDigest?: Hex;
|
|
62
|
+
/** Explicit released-card URI when it is not at the default well-known path (spec 347 §8.3). */
|
|
63
|
+
cardUri?: string;
|
|
34
64
|
/**
|
|
35
65
|
* Public-safe identifier for the controlling passkey
|
|
36
66
|
* (`keccak256(credentialId)` — NEVER raw credentialId).
|
|
@@ -40,6 +70,31 @@ export interface AgentNameRecords {
|
|
|
40
70
|
passkeyCredentialDigest?: Hex;
|
|
41
71
|
/** Address of the CustodyPolicy governing the owner Smart Agent. */
|
|
42
72
|
custodyPolicy?: Address;
|
|
73
|
+
/**
|
|
74
|
+
* The name's accounts BY CHAIN (ap-federation spec 440 §C; spec 346 §3.8; the ENSIP-9 pattern): CAIP-10 ids,
|
|
75
|
+
* at most one per CAIP-2 chain, sorted by chain. `addr` stays the root-chain forward record and `nativeId`
|
|
76
|
+
* the home account; this lists home and satellites so a reader on another chain finds the account that
|
|
77
|
+
* stands there. A reverse claim on that chain is honoured only when the entry here agrees. Evidence, never
|
|
78
|
+
* authority.
|
|
79
|
+
*/
|
|
80
|
+
accounts?: string[];
|
|
81
|
+
/**
|
|
82
|
+
* Connection-bootstrap KIND (spec 280) — `wallet|google|youversion|passkey|multi`.
|
|
83
|
+
* OPT-IN, owner-set, PUBLIC: advertises which credential flow a returning person
|
|
84
|
+
* should use to connect to this SA by name. Never set automatically. Distinct from
|
|
85
|
+
* `agentKind` (what the agent is) — this is how you authenticate to it.
|
|
86
|
+
*/
|
|
87
|
+
connectionKind?: ConnectionKind;
|
|
88
|
+
/**
|
|
89
|
+
* Connection-bootstrap ADDRESS (spec 280) — the controlling EOA (wallet/SIWE) or the
|
|
90
|
+
* social control address (the per-subject C_sub) — published ONLY as an explicit,
|
|
91
|
+
* owner-set, PUBLIC convenience so the wallet picker can pre-select. That EOA is already
|
|
92
|
+
* public on-chain (it appears in the account's control-credential add log); this is a
|
|
93
|
+
* deliberate, opt-in name→credential index (ADR-0040 amendment). NOT required to connect
|
|
94
|
+
* (on-chain control validation + discoverable-passkey/OIDC re-derive already work) —
|
|
95
|
+
* purely a pre-select hint. NEVER set automatically.
|
|
96
|
+
*/
|
|
97
|
+
connectionAddress?: Address;
|
|
43
98
|
/**
|
|
44
99
|
* Off-chain JSON profile content-hash
|
|
45
100
|
* (matches `agent-profile.profileContentHash(profile)`). Stored
|
|
@@ -51,8 +106,8 @@ export interface AgentNameRecords {
|
|
|
51
106
|
/**
|
|
52
107
|
* CAIP-10 chain-agnostic account identifier (e.g.
|
|
53
108
|
* `eip155:84532:0xabc...`). Per ADR-0008, this enables low-cost
|
|
54
|
-
*
|
|
55
|
-
*
|
|
109
|
+
* external resolver/card/registry projections without us generating
|
|
110
|
+
* protocol-specific IDs. Consumers MAY derive external IDs locally
|
|
56
111
|
* by canonical-JSON-hashing this with their own context.
|
|
57
112
|
*/
|
|
58
113
|
nativeId?: string;
|
|
@@ -113,5 +168,55 @@ export interface AgentNamingClientOpts {
|
|
|
113
168
|
registry: Address;
|
|
114
169
|
/** AgentNameUniversalResolver contract address for this chain. */
|
|
115
170
|
universalResolver: Address;
|
|
171
|
+
/**
|
|
172
|
+
* AgentProfileResolver address — where the SA-keyed `atl:agentType` / `atl:serviceRole` records live
|
|
173
|
+
* (spec 346 §2.3). Required by `resolveTyped` / `readDerivedType`; those throw a configuration error
|
|
174
|
+
* when it is absent (never a silent downgrade to an untyped read — ADR-0013).
|
|
175
|
+
*/
|
|
176
|
+
profileResolver?: Address;
|
|
177
|
+
/** Per-suffix `PermissionlessSubregistry` addresses (deployment JSON `permissionlessSubregistries`), generic + vertical. */
|
|
178
|
+
subregistries?: Partial<Record<string, Address>>;
|
|
179
|
+
}
|
|
180
|
+
/** The SA-keyed derived-type declaration (spec 346 §2.3). */
|
|
181
|
+
export interface DerivedTypeRecord {
|
|
182
|
+
agentType: DerivedAgentType | null;
|
|
183
|
+
serviceRole: string | null;
|
|
184
|
+
/** `atl:agentSubtype` — the vertical subtype (spec 346 §2.4), when declared. */
|
|
185
|
+
agentSubtype: string | null;
|
|
186
|
+
/** `atl:agentKind` on the profile subject (root), when set. */
|
|
187
|
+
agentKind: AgentKind | null;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Result of `AgentNamingClient.resolveTyped`: a name whose suffix, on-chain derived-type record and root
|
|
191
|
+
* kind all agree (`typeConsistent: true`). Legacy names carry `legacy: true` and whatever derived type the
|
|
192
|
+
* record declares (possibly `null`) — they are never suffix-validated (spec 346 §3.5).
|
|
193
|
+
*/
|
|
194
|
+
export interface TypedNameRecord {
|
|
195
|
+
/** Canonical display form (`x.t` / `x.t@c.u`). */
|
|
196
|
+
name: string;
|
|
197
|
+
onChainName: string;
|
|
198
|
+
node: Hex;
|
|
199
|
+
address: Address;
|
|
200
|
+
tld: AgentTld | LegacyTld | (string & {}) | null;
|
|
201
|
+
derivedType: DerivedAgentType | null;
|
|
202
|
+
/** Vertical subtype named by the suffix (spec 346 §2.4), when any. */
|
|
203
|
+
subtype: string | null;
|
|
204
|
+
root: AgentType | null;
|
|
205
|
+
serviceRole: string | null;
|
|
206
|
+
legacy: boolean;
|
|
207
|
+
typeConsistent: boolean;
|
|
208
|
+
/** Present for scoped / contextual names. */
|
|
209
|
+
context?: {
|
|
210
|
+
name: string;
|
|
211
|
+
derivedType: DerivedAgentType;
|
|
212
|
+
};
|
|
116
213
|
}
|
|
214
|
+
export type TypedNameCheck = {
|
|
215
|
+
ok: true;
|
|
216
|
+
record: TypedNameRecord;
|
|
217
|
+
} | {
|
|
218
|
+
ok: false;
|
|
219
|
+
reason: 'unregistered' | 'type_mismatch' | 'type_undeclared' | 'kind_mismatch' | 'role_required' | 'subtype_mismatch' | 'not_typed' | 'label_reads_as_type';
|
|
220
|
+
detail?: string;
|
|
221
|
+
};
|
|
117
222
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC1F,OAAO,KAAK,EAA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qBAAqB,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vertical (app-registered) agent types — spec 346 §2.4.
|
|
3
|
+
*
|
|
4
|
+
* Ring 0 ships the seven GENERIC derived types (`AGENT_TLDS`). A vertical deployment may need finer,
|
|
5
|
+
* domain-specific kinds ("a gathered-community-shaped organization", "a small-group-shaped organization"). Those
|
|
6
|
+
* are SUBTYPES of a generic derived type, registered by the APP layer's white-label config (ADR-0021: no
|
|
7
|
+
* vertical vocabulary in packages), and the naming plane treats them uniformly:
|
|
8
|
+
*
|
|
9
|
+
* - the suffix names the vertical subtype (`<label>.<tld>`)
|
|
10
|
+
* - the on-chain derived-type record stays the GENERIC type (`atl:agentType` = the parent, e.g. `org`)
|
|
11
|
+
* - the vertical refinement is its own SA-keyed record (`atl:agentSubtype` = the subtype slug)
|
|
12
|
+
* - claim/resolution validate suffix ↔ subtype ↔ generic type ↔ root, fail-closed
|
|
13
|
+
*
|
|
14
|
+
* Every consumer typed with `DerivedAgentType` keeps working (it sees the generic parent); consumers that
|
|
15
|
+
* care about the vertical read `subtype`. Registration is process-global and idempotent by tld; a conflicting
|
|
16
|
+
* re-registration throws (a tld names exactly one subtype).
|
|
17
|
+
*/
|
|
18
|
+
import type { DerivedAgentType, Hex } from '@agenticprimitives/types';
|
|
19
|
+
export interface VerticalAgentTypeDefinition {
|
|
20
|
+
/** The suffix (one hyphen-free word: `[a-z0-9]`, 2–63 chars). Must not collide with a generic suffix or alias. */
|
|
21
|
+
tld: string;
|
|
22
|
+
/** The subtype slug stored under `atl:agentSubtype` (defaults to `tld`). */
|
|
23
|
+
subtype?: string;
|
|
24
|
+
/** The GENERIC derived type this vertical refines (what `atl:agentType` stores). */
|
|
25
|
+
derivedType: DerivedAgentType;
|
|
26
|
+
/** Human label for UI grouping (never authority). */
|
|
27
|
+
label?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface VerticalAgentType extends Required<Pick<VerticalAgentTypeDefinition, 'tld' | 'subtype' | 'derivedType'>> {
|
|
30
|
+
label?: string;
|
|
31
|
+
}
|
|
32
|
+
/** Register vertical agent types (app startup / white-label config). Idempotent per identical definition. */
|
|
33
|
+
export declare function registerVerticalAgentTypes(defs: readonly VerticalAgentTypeDefinition[], guards: {
|
|
34
|
+
reserved: readonly string[];
|
|
35
|
+
}): void;
|
|
36
|
+
/** Test/dev only — drop every registered vertical type. */
|
|
37
|
+
export declare function clearVerticalAgentTypes(): void;
|
|
38
|
+
export declare function verticalAgentTypeForTld(tld: string): VerticalAgentType | null;
|
|
39
|
+
export declare function verticalAgentTypeForSubtype(subtype: string): VerticalAgentType | null;
|
|
40
|
+
export declare function verticalAgentTlds(): readonly string[];
|
|
41
|
+
/** The per-root `rootKind` tag for a vertical root: `keccak256("namespace:vertical:<tld>")` (mirrors AddVerticalRoots.s.sol). */
|
|
42
|
+
export declare function verticalRootKindForTld(tld: string): Hex;
|
|
43
|
+
//# sourceMappingURL=vertical.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vertical.d.ts","sourceRoot":"","sources":["../src/vertical.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAGtE,MAAM,WAAW,2BAA2B;IAC1C,kHAAkH;IAClH,GAAG,EAAE,MAAM,CAAC;IACZ,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oFAAoF;IACpF,WAAW,EAAE,gBAAgB,CAAC;IAC9B,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,iBAAkB,SAAQ,QAAQ,CAAC,IAAI,CAAC,2BAA2B,EAAE,KAAK,GAAG,SAAS,GAAG,aAAa,CAAC,CAAC;IACvH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAKD,6GAA6G;AAC7G,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,SAAS,2BAA2B,EAAE,EAAE,MAAM,EAAE;IAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAAG,IAAI,CAetI;AAED,2DAA2D;AAC3D,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAE7E;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAGrF;AAED,wBAAgB,iBAAiB,IAAI,SAAS,MAAM,EAAE,CAErD;AAED,iIAAiI;AACjI,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAEvD"}
|
package/dist/vertical.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { keccak256, toHex } from 'viem';
|
|
2
|
+
const REGISTRY = new Map();
|
|
3
|
+
const TLD_RE = /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
4
|
+
/** Register vertical agent types (app startup / white-label config). Idempotent per identical definition. */
|
|
5
|
+
export function registerVerticalAgentTypes(defs, guards) {
|
|
6
|
+
for (const d of defs) {
|
|
7
|
+
const tld = d.tld.trim().toLowerCase();
|
|
8
|
+
if (!TLD_RE.test(tld) || tld.length < 2)
|
|
9
|
+
throw new Error(`[agent-naming] vertical tld "${d.tld}" is not a valid label`);
|
|
10
|
+
// Spec 445 / audit NAME-8: a suffix with a hyphen makes the DNS projection `<label>-<suffix>.<zone>` read two
|
|
11
|
+
// ways (`x` + `house-guild` and `x-house` + `guild` are one host). A suffix is ONE hyphen-free word.
|
|
12
|
+
if (tld.includes('-'))
|
|
13
|
+
throw new Error(`[agent-naming] vertical tld "${tld}" must not contain a hyphen — "<label>-${tld}" would read back as two different names`);
|
|
14
|
+
if (guards.reserved.includes(tld))
|
|
15
|
+
throw new Error(`[agent-naming] vertical tld "${tld}" collides with a generic suffix, alias or reserved label`);
|
|
16
|
+
const v = { tld, subtype: (d.subtype ?? tld).trim().toLowerCase(), derivedType: d.derivedType, ...(d.label ? { label: d.label } : {}) };
|
|
17
|
+
const prev = REGISTRY.get(tld);
|
|
18
|
+
if (prev && (prev.subtype !== v.subtype || prev.derivedType !== v.derivedType)) {
|
|
19
|
+
throw new Error(`[agent-naming] vertical tld "${tld}" already registered as ${prev.subtype} ⊑ ${prev.derivedType}`);
|
|
20
|
+
}
|
|
21
|
+
REGISTRY.set(tld, v);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/** Test/dev only — drop every registered vertical type. */
|
|
25
|
+
export function clearVerticalAgentTypes() {
|
|
26
|
+
REGISTRY.clear();
|
|
27
|
+
}
|
|
28
|
+
export function verticalAgentTypeForTld(tld) {
|
|
29
|
+
return REGISTRY.get(tld) ?? null;
|
|
30
|
+
}
|
|
31
|
+
export function verticalAgentTypeForSubtype(subtype) {
|
|
32
|
+
for (const v of REGISTRY.values())
|
|
33
|
+
if (v.subtype === subtype)
|
|
34
|
+
return v;
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
export function verticalAgentTlds() {
|
|
38
|
+
return [...REGISTRY.keys()];
|
|
39
|
+
}
|
|
40
|
+
/** The per-root `rootKind` tag for a vertical root: `keccak256("namespace:vertical:<tld>")` (mirrors AddVerticalRoots.s.sol). */
|
|
41
|
+
export function verticalRootKindForTld(tld) {
|
|
42
|
+
return keccak256(toHex(`namespace:vertical:${tld}`));
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=vertical.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vertical.js","sourceRoot":"","sources":["../src/vertical.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAiBxC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA6B,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IAAI,KAAK,CAAC,gCAAgC,GAAG,2BAA2B,IAAI,CAAC,OAAO,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QACtH,CAAC;QACD,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACvB,CAAC;AACH,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,uBAAuB;IACrC,QAAQ,CAAC,KAAK,EAAE,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,GAAW;IACjD,OAAO,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,OAAe;IACzD,KAAK,MAAM,CAAC,IAAI,QAAQ,CAAC,MAAM,EAAE;QAAE,IAAI,CAAC,CAAC,OAAO,KAAK,OAAO;YAAE,OAAO,CAAC,CAAC;IACvE,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;AAC9B,CAAC;AAED,iIAAiI;AACjI,MAAM,UAAU,sBAAsB,CAAC,GAAW;IAChD,OAAO,SAAS,CAAC,KAAK,CAAC,sBAAsB,GAAG,EAAE,CAAC,CAAC,CAAC;AACvD,CAAC"}
|
package/docs/api.md
CHANGED
|
@@ -3,9 +3,23 @@
|
|
|
3
3
|
This is the human-readable guide to the public exports in
|
|
4
4
|
`capability.manifest.json`. Keep it in sync with `src/index.ts`.
|
|
5
5
|
|
|
6
|
+
## Typed naming (spec 346)
|
|
7
|
+
|
|
8
|
+
| Export | Purpose |
|
|
9
|
+
| --- | --- |
|
|
10
|
+
| `AGENT_TLDS`, `AGENT_TLD_ALIASES`, `LEGACY_TLDS`, `RESERVED_LABELS` | The six canonical suffixes (`me org team svc workspace treasury registry church circle`), the `ws → workspace` alias, the untyped legacy roots, the labels no one may claim. |
|
|
11
|
+
| `derivedTypeForTld`, `tldForDerivedType`, `rootClassForTld`, `rootClassForDerivedType`, `rootKindForTld` | suffix → derived type → root; the per-root `rootKind` tag (`keccak256("namespace:<Type>")`). |
|
|
12
|
+
| `parseAgentName`, `formatAgentName`, `onChainNameOf`, `normalizeAgentName` | The grammar: `x.t`, `x.t@c.u`, `c.u/x.t`, dotted `x.t.c.u`, type-nodes, roots, legacy. |
|
|
13
|
+
| `dnsHostForHandle`, `agentCardUrlForHost`, `a2aEndpointForHost`, `edgeA2aPathForHandle` | The §5 deployment-binding projection; the zone is always caller-supplied. |
|
|
14
|
+
| `hostForName`, `handleForDnsHost`, `dnsHostReadings`, `confirmDnsHost` | Name ↔ host on a shared zone. The projection is injective (a bare-root label ending in `-<type>`, and a reserved label, have no host); every inverse is a hint, and `confirmDnsHost` resolves every reading on chain and returns `ambiguous` rather than picking. |
|
|
15
|
+
| `labelClaimViolation`, `assertClaimableLabel` | The claim-side rule the call builders apply (reserved labels; `-<type>` under a bare-host root). |
|
|
16
|
+
| `findUniqueLabel`, `childNodeOf`, `validateTypedClaim` | Forced-unique labels (spec 220 §5) and the suffix ↔ `atl:agentType` ↔ root invariant. |
|
|
17
|
+
| `buildDeclareAgentTypeCalls`, `buildTypedClaimCalls` | Pure call builders for bootstrap steps 1b and 2–3 (compose into the SA's execute batch). |
|
|
18
|
+
| `AgentNamingClient.resolveTyped` / `checkTypedName` / `readDerivedType` / `findUniqueLabel` / `subregistryFor` | Typed reads; require `opts.profileResolver` (+ `opts.subregistries` for claims). |
|
|
19
|
+
|
|
6
20
|
## Constants
|
|
7
21
|
|
|
8
|
-
- `
|
|
22
|
+
- `AGENT_TLDS`: the six typed suffixes (`me org team svc workspace treasury registry church circle`); `LEGACY_TLDS` = `agent` (untyped, resolvable, closed to new claims after app adoption). `.impact` is retired (2026-11-10): a `.impact` name is refused as `unknown_tld`.
|
|
9
23
|
- `AgentTld`: type of the canonical top-level label.
|
|
10
24
|
- `ZERO_NODE`: the all-zero root node.
|
|
11
25
|
|
package/package.json
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agenticprimitives/agent-naming",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
4
|
-
"description": "Agent Naming Service SDK: hierarchical naming for Smart Agents (.agent
|
|
3
|
+
"version": "1.0.0-alpha.50",
|
|
4
|
+
"description": "Agent Naming Service SDK: typed hierarchical naming for Smart Agents (.me .org .team .svc .workspace .treasury — a suffix names the derived agent type; spec 346). Owns name grammar + normalization, namehash/labelhash, records schemas, the DNS/A2A endpoint projection, claim validation, and the AgentNamingClient (resolve / typed resolve / reverse / registry). Speaks naming-domain vocabulary only — no delegation / caveat / custody concepts.",
|
|
5
|
+
"homepage": "https://agenticprimitives.dev",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/agentictrustlabs/agenticprimitives/issues"
|
|
8
|
+
},
|
|
9
|
+
"author": {
|
|
10
|
+
"name": "Agentic Trust Labs",
|
|
11
|
+
"url": "https://agenticprimitives.dev"
|
|
12
|
+
},
|
|
5
13
|
"license": "MIT",
|
|
6
14
|
"repository": {
|
|
7
15
|
"type": "git",
|
|
8
16
|
"url": "git+https://github.com/agentictrustlabs/agenticprimitives.git",
|
|
9
17
|
"directory": "packages/agent-naming"
|
|
10
18
|
},
|
|
11
|
-
"homepage": "https://github.com/agentictrustlabs/agenticprimitives/tree/master/packages/agent-naming",
|
|
12
|
-
"bugs": {
|
|
13
|
-
"url": "https://github.com/agentictrustlabs/agenticprimitives/issues"
|
|
14
|
-
},
|
|
15
19
|
"type": "module",
|
|
16
20
|
"main": "./dist/index.js",
|
|
17
21
|
"types": "./dist/index.d.ts",
|
|
@@ -44,27 +48,32 @@
|
|
|
44
48
|
},
|
|
45
49
|
"peerDependencies": {
|
|
46
50
|
"viem": "^2.52.2",
|
|
47
|
-
"@agenticprimitives/agent-account": "1.0.0-alpha.
|
|
48
|
-
"@agenticprimitives/connect-auth": "1.0.0-alpha.
|
|
49
|
-
"@agenticprimitives/types": "1.0.0-alpha.
|
|
51
|
+
"@agenticprimitives/agent-account": "^1.0.0-alpha.50",
|
|
52
|
+
"@agenticprimitives/connect-auth": "^1.0.0-alpha.50",
|
|
53
|
+
"@agenticprimitives/types": "^1.0.0-alpha.50"
|
|
50
54
|
},
|
|
51
55
|
"devDependencies": {
|
|
52
56
|
"@types/node": "^22.7.0",
|
|
53
|
-
"vitest": "^4.1.
|
|
57
|
+
"vitest": "^4.1.11"
|
|
54
58
|
},
|
|
55
59
|
"keywords": [
|
|
56
60
|
"agent",
|
|
57
61
|
"naming",
|
|
58
62
|
"namehash",
|
|
59
63
|
"smart-agent",
|
|
60
|
-
"agentic"
|
|
64
|
+
"agentic",
|
|
65
|
+
"agentic-primitives",
|
|
66
|
+
"agenticprimitives",
|
|
67
|
+
"ai-agents",
|
|
68
|
+
"agent-authority",
|
|
69
|
+
"agentic-trust"
|
|
61
70
|
],
|
|
62
71
|
"scripts": {
|
|
63
72
|
"build": "tsc -p tsconfig.build.json",
|
|
64
73
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
65
74
|
"test": "vitest run",
|
|
66
|
-
"test:unit": "vitest run test/normalize.test.ts test/namehash.test.ts test/records.test.ts",
|
|
67
|
-
"test:integration": "vitest run test/integration.test.ts",
|
|
75
|
+
"test:unit": "vitest run test/normalize.test.ts test/namehash.test.ts test/records.test.ts test/grammar.test.ts test/dns.test.ts test/claim.test.ts test/custody.test.ts test/issuance.test.ts test/vertical.test.ts test/federated.test.ts --passWithNoTests",
|
|
76
|
+
"test:integration": "vitest run test/integration.test.ts --passWithNoTests",
|
|
68
77
|
"test:watch": "vitest",
|
|
69
78
|
"clean": "rm -rf dist"
|
|
70
79
|
}
|