@agenticprimitives/agent-naming 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.
Files changed (66) hide show
  1. package/CLAUDE.md +34 -50
  2. package/README.md +7 -0
  3. package/dist/abis.d.ts +99 -0
  4. package/dist/abis.d.ts.map +1 -1
  5. package/dist/abis.js +40 -0
  6. package/dist/abis.js.map +1 -1
  7. package/dist/claim.d.ts +71 -0
  8. package/dist/claim.d.ts.map +1 -0
  9. package/dist/claim.js +73 -0
  10. package/dist/claim.js.map +1 -0
  11. package/dist/client.d.ts +24 -1
  12. package/dist/client.d.ts.map +1 -1
  13. package/dist/client.js +133 -3
  14. package/dist/client.js.map +1 -1
  15. package/dist/constants.d.ts +55 -5
  16. package/dist/constants.d.ts.map +1 -1
  17. package/dist/constants.js +128 -4
  18. package/dist/constants.js.map +1 -1
  19. package/dist/custody.d.ts +42 -0
  20. package/dist/custody.d.ts.map +1 -1
  21. package/dist/custody.js +98 -1
  22. package/dist/custody.js.map +1 -1
  23. package/dist/dns.d.ts +91 -0
  24. package/dist/dns.d.ts.map +1 -0
  25. package/dist/dns.js +196 -0
  26. package/dist/dns.js.map +1 -0
  27. package/dist/grammar.d.ts +62 -0
  28. package/dist/grammar.d.ts.map +1 -0
  29. package/dist/grammar.js +165 -0
  30. package/dist/grammar.js.map +1 -0
  31. package/dist/hash.d.ts +14 -0
  32. package/dist/hash.d.ts.map +1 -0
  33. package/dist/hash.js +22 -0
  34. package/dist/hash.js.map +1 -0
  35. package/dist/index.d.ts +10 -5
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +11 -4
  38. package/dist/index.js.map +1 -1
  39. package/dist/issuance.d.ts +70 -0
  40. package/dist/issuance.d.ts.map +1 -0
  41. package/dist/issuance.js +65 -0
  42. package/dist/issuance.js.map +1 -0
  43. package/dist/label.d.ts +10 -0
  44. package/dist/label.d.ts.map +1 -0
  45. package/dist/label.js +39 -0
  46. package/dist/label.js.map +1 -0
  47. package/dist/namehash.d.ts +10 -23
  48. package/dist/namehash.d.ts.map +1 -1
  49. package/dist/namehash.js +11 -35
  50. package/dist/namehash.js.map +1 -1
  51. package/dist/normalize.d.ts +9 -26
  52. package/dist/normalize.d.ts.map +1 -1
  53. package/dist/normalize.js +11 -67
  54. package/dist/normalize.js.map +1 -1
  55. package/dist/records.d.ts +12 -0
  56. package/dist/records.d.ts.map +1 -1
  57. package/dist/records.js +62 -2
  58. package/dist/records.js.map +1 -1
  59. package/dist/types.d.ts +60 -1
  60. package/dist/types.d.ts.map +1 -1
  61. package/dist/vertical.d.ts +43 -0
  62. package/dist/vertical.d.ts.map +1 -0
  63. package/dist/vertical.js +40 -0
  64. package/dist/vertical.js.map +1 -0
  65. package/docs/api.md +13 -1
  66. package/package.json +6 -6
package/dist/custody.js CHANGED
@@ -18,7 +18,12 @@
18
18
  import { encodeFunctionData } from 'viem';
19
19
  import { normalizeLabel } from './normalize.js';
20
20
  import { agentNameAttributeResolverAbi, agentNameRegistryAbi, permissionlessSubregistryAbi, } from './abis.js';
21
- import { PREDICATE_ID, AGENT_KIND_ID } from './records.js';
21
+ import { PREDICATE_ID, AGENT_KIND_ID, AGENT_TYPE_ID } from './records.js';
22
+ import { agentProfileResolverTypeAbi } from './abis.js';
23
+ import { rootClassForDerivedType } from '@agenticprimitives/types';
24
+ import { parseAgentName } from './grammar.js';
25
+ import { ROLE_TYPED } from './claim.js';
26
+ import { derivedTypeForTld } from './constants.js';
22
27
  // ─── Registry writes ───────────────────────────────────────────────
23
28
  /**
24
29
  * Build a call to register `<label>.<parent>` under the parent
@@ -205,6 +210,13 @@ export function buildRecordCalls(args) {
205
210
  if (records.nativeId !== undefined) {
206
211
  out.push(buildSetStringAttributeCall({ resolver, node, predicate: PREDICATE_ID.nativeId, value: records.nativeId }));
207
212
  }
213
+ // spec 347 §8.3 — released A2A card publication records (mirrors `encodeRecords`).
214
+ if (records.cardDigest !== undefined) {
215
+ out.push(buildSetBytes32AttributeCall({ resolver, node, predicate: PREDICATE_ID.cardDigest, value: records.cardDigest }));
216
+ }
217
+ if (records.cardUri !== undefined) {
218
+ out.push(buildSetStringAttributeCall({ resolver, node, predicate: PREDICATE_ID.cardUri, value: records.cardUri }));
219
+ }
208
220
  return out;
209
221
  }
210
222
  // ─── PermissionlessSubregistry ─────────────────────────────────────
@@ -231,4 +243,89 @@ export function buildSubregistryRegisterCall(args) {
231
243
  }),
232
244
  };
233
245
  }
246
+ // ─── Typed naming (spec 346) ────────────────────────────────────────
247
+ /**
248
+ * Step 1b of the bootstrap (spec 346 §3.6): declare the SA's derived type on its OWN profile subject.
249
+ * `msg.sender` MUST be the SA (`AgentProfileResolver.onlyAgent`) — compose these into the SA's execute
250
+ * batch. Registers the profile mirror first when `registered` is false (the typed setters require it),
251
+ * writing the ROOT kind there; then `atl:agentType` (+ `atl:serviceRole` when given, REQUIRED and equal
252
+ * to the type name for `workspace` and `registry`).
253
+ */
254
+ export function buildDeclareAgentTypeCalls(args) {
255
+ if (ROLE_TYPED.has(args.agentType) && args.serviceRole !== args.agentType) {
256
+ throw new Error(`[agent-naming] ${args.agentType} requires serviceRole = '${args.agentType}'`);
257
+ }
258
+ const calls = [];
259
+ if (!args.registered) {
260
+ calls.push({
261
+ to: args.profileResolver,
262
+ value: 0n,
263
+ data: encodeFunctionData({
264
+ abi: agentProfileResolverTypeAbi,
265
+ functionName: 'register',
266
+ args: [args.agent, args.displayName ?? '', '', AGENT_KIND_ID[rootClassForDerivedType(args.agentType)], ''],
267
+ }),
268
+ });
269
+ }
270
+ calls.push({
271
+ to: args.profileResolver,
272
+ value: 0n,
273
+ data: encodeFunctionData({
274
+ abi: agentProfileResolverTypeAbi,
275
+ functionName: 'setBytes32Property',
276
+ args: [args.agent, PREDICATE_ID.agentType, AGENT_TYPE_ID[args.agentType]],
277
+ }),
278
+ });
279
+ if (args.serviceRole !== undefined) {
280
+ calls.push({
281
+ to: args.profileResolver,
282
+ value: 0n,
283
+ data: encodeFunctionData({
284
+ abi: agentProfileResolverTypeAbi,
285
+ functionName: 'setStringProperty',
286
+ args: [args.agent, PREDICATE_ID.serviceRole, args.serviceRole],
287
+ }),
288
+ });
289
+ }
290
+ if (args.subtype !== undefined) {
291
+ calls.push({
292
+ to: args.profileResolver,
293
+ value: 0n,
294
+ data: encodeFunctionData({
295
+ abi: agentProfileResolverTypeAbi,
296
+ functionName: 'setStringProperty',
297
+ args: [args.agent, PREDICATE_ID.agentSubtype, args.subtype],
298
+ }),
299
+ });
300
+ }
301
+ return calls;
302
+ }
303
+ /**
304
+ * Steps 2–3 of the bootstrap for a CANONICAL (root-level) typed name (spec 346 §3.3): claim
305
+ * `<label>.<tld>` through that root's `PermissionlessSubregistry`, write the root kind + optional records
306
+ * on the new node, and set the primary name. The caller MUST have run `validateTypedClaim` (or
307
+ * `AgentNamingClient.checkTypedName`) — this builder only refuses a suffix/type disagreement it can see
308
+ * locally. `setPrimaryName` requires `msg.sender == owner`; the subregistry claim may be sent by anyone.
309
+ */
310
+ export function buildTypedClaimCalls(args) {
311
+ const p = parseAgentName(args.name);
312
+ if (p.kind !== 'canonical') {
313
+ throw new Error(`[agent-naming] buildTypedClaimCalls handles canonical names only (got ${p.kind} "${p.normalized}")`);
314
+ }
315
+ const expected = derivedTypeForTld(p.handle.tld);
316
+ if (expected !== args.agentType) {
317
+ throw new Error(`[agent-naming] type_mismatch: ".${p.handle.tld}" names ${expected}, subject declares ${args.agentType}`);
318
+ }
319
+ const subregistry = args.subregistries[p.handle.tld];
320
+ if (!subregistry)
321
+ throw new Error(`[agent-naming] no PermissionlessSubregistry configured for ".${p.handle.tld}"`);
322
+ const claim = buildSubregistryRegisterCall({ subregistry, label: p.handle.label, newOwner: args.owner });
323
+ const records = buildRecordCalls({
324
+ resolver: args.resolver,
325
+ node: p.node,
326
+ records: { ...(args.records ?? {}), addr: args.owner, agentKind: rootClassForDerivedType(args.agentType) },
327
+ });
328
+ const primaryName = buildSetPrimaryNameCall({ registry: args.registry, node: p.node });
329
+ return { claim, records, primaryName, node: p.node };
330
+ }
234
331
  //# sourceMappingURL=custody.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"custody.js","sourceRoot":"","sources":["../src/custody.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EACL,6BAA6B,EAC7B,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAsB,MAAM,cAAc,CAAC;AAU/E,sEAAsE;AAEtE;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,IAOxC;IACC,wFAAwF;IACxF,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzC,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,QAAQ;QACjB,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,kBAAkB,CAAC;YACvB,GAAG,EAAE,oBAAoB;YACzB,YAAY,EAAE,UAAU;YACxB,IAAI,EAAE;gBACJ,IAAI,CAAC,UAAU;gBACf,KAAK;gBACL,IAAI,CAAC,QAAQ;gBACb,IAAI,CAAC,QAAQ,IAAK,4CAAwD;gBAC1E,IAAI,CAAC,MAAM,IAAI,EAAE;aAClB;SACF,CAAC;KACH,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CAAC,IAIxC;IACC,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,QAAQ;QACjB,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,kBAAkB,CAAC;YACvB,GAAG,EAAE,oBAAoB;YACzB,YAAY,EAAE,UAAU;YACxB,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC;SACjC,CA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C,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACvF,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AACvD,CAAC"}
package/dist/dns.d.ts ADDED
@@ -0,0 +1,91 @@
1
+ /**
2
+ * DNS subdomain + A2A endpoint convention (spec 346 §5) — a PURE projection of a handle onto a zone
3
+ * the caller supplies. No hostname, zone or provider is baked in (ADR-0021): packages own the two
4
+ * protocol paths; apps/deployments own the zone.
5
+ *
6
+ * | handle | host | rule |
7
+ * | richcanvas.org | richcanvas.org | org = zone apex |
8
+ * | rpedersen.me (ownsDomain) | rpedersen.me | the real .me domain |
9
+ * | rpedersen.me (hosted) | rpedersen.<homeZone> | <label>.<home-zone> |
10
+ * | rpedersen.me@richcanvas.org | rpedersen.richcanvas.org | <person-label>.<zone> — no type |
11
+ * | architecture.team@richcanvas.org | architecture-team.richcanvas.org | <label>-<type>.<zone> |
12
+ * | northern-colorado.team (root) | northern-colorado-team.<zone> | hosted under the registry/governor zone |
13
+ *
14
+ * THE TYPE IS A HYPHENATED SUFFIX ON ONE LABEL, NOT ITS OWN LABEL (changed 2026-08-30). A DNS wildcard
15
+ * matches exactly one label, so `<label>.<type>.<zone>` needs a wildcard per type — and a cert per type,
16
+ * which public CAs (Cloudflare Universal SSL included) do not issue below `*.zone` without a paid add-on.
17
+ * Every agent under a zone at `<label>-<type>.<zone>` is covered by the one `*.<zone>` wildcard the zone
18
+ * already has. Folding the type into the label instead of dropping it keeps two properties the dotted form
19
+ * had: the type is legible in the host, and the projection stays REVERSIBLE — `alice.me` and `alice.org`
20
+ * would both want `alice.<zone>` if the type were simply dropped, forcing an inbound host to guess which
21
+ * root it meant. Persons and legacy roots keep the bare `<label>.<zone>` form, so a label ending in
22
+ * `-<agent-type>` is refused for them at claim time (`validateTypedClaim`) — the ambiguity is removed by
23
+ * construction rather than resolved by precedence.
24
+ *
25
+ * The type in DNS is still a fixed projection of the suffix and is NEVER parsed as authority.
26
+ */
27
+ import { type ParsedAgentName } from './grammar.js';
28
+ /** A2A JSON-RPC path (must equal `@agenticprimitives/a2a` `A2A_JSONRPC_PATH` — golden-vector tested, no import edge). */
29
+ export declare const A2A_JSONRPC_PATH: "/api/a2a";
30
+ /** A2A agent-card discovery path (origin-scoped — why every agent gets its own host). */
31
+ export declare const A2A_AGENT_CARD_PATH: "/.well-known/agent-card.json";
32
+ export interface DnsHostOptions {
33
+ /** The zone the context principal controls: an org apex (`richcanvas.org`) or a Home/registry zone. */
34
+ zone: string;
35
+ /** For hosted persons: the Home zone (e.g. `home.example`). Defaults to `zone`. */
36
+ homeZone?: string;
37
+ /** The person owns the real `.me` domain matching the handle — the host IS the handle. */
38
+ ownsDomain?: boolean;
39
+ }
40
+ /** Project a handle onto a DNS host per the §5 table. Root / type-node / legacy names have no host. */
41
+ export declare function dnsHostForHandle(name: string | ParsedAgentName, opts: DnsHostOptions): string;
42
+ /**
43
+ * The inverse of `dnsHostForHandle` for a hosted zone: `<label>-<type>.<zone>` → `<label>.<type>`, and a
44
+ * bare `<label>.<zone>` → null (a person/legacy label, whose root the deployment decides from its ordered
45
+ * root list). Pure; never guesses a type that is not in the closed suffix set.
46
+ */
47
+ export declare function handleForDnsHost(host: string, zone: string): {
48
+ label: string;
49
+ tld: string;
50
+ name: string;
51
+ } | null;
52
+ export declare function agentCardUrlForHost(host: string): string;
53
+ export declare function a2aEndpointForHost(host: string): string;
54
+ /** Edge-addressed alternative (spec 346 §5): `POST <edge>/api/a2a/<handle>` when a zone cannot mint subdomains. */
55
+ export declare function edgeA2aPathForHandle(edgeBase: string, name: string | ParsedAgentName): string;
56
+ /**
57
+ * The single-label subdomain of `zone`: `alice.<zone>` → `alice`. The apex, deeper nesting, a non-matching host
58
+ * and any label in `exclude` (a Home passes `['www']`) → null. Port suffixes are ignored.
59
+ */
60
+ export declare function parseSubdomainLabel(hostname: string | undefined, zone: string, exclude?: readonly string[]): string | null;
61
+ /** `<label>-<type>` → the typed name it projects (`alice-home-church` → `alice-home.church`), or null when the
62
+ * label carries no known type suffix. A CANDIDATE — the caller resolves it against the chain. */
63
+ export declare function typedNameForLabel(rest: string): string | null;
64
+ /**
65
+ * The inbound host → the name it projects, for the two shapes ONE base zone serves:
66
+ * `<label>.<zone>` → `<label>-<type>` reads as `<label>.<type>`; otherwise `<label>.<legacyParent>`
67
+ * `<label>.<type>.<zone>` → `<label>.<type>` — the dotted form served until 2026-08-30, kept because cards
68
+ * published under it carry that URL in signed bytes; nothing emits it (`hostForName`).
69
+ * The DNS label is returned RAW as `label`: a label may read BOTH ways (`alice-home-church` is `alice-home.church`
70
+ * and also the legacy `alice-home-church.<legacyParent>`), so the choice belongs to the caller, which resolves an
71
+ * ORDERED candidate set against the chain — one mechanism, ordered candidates, not a fallback (ADR-0013).
72
+ * Apex, deeper nesting, an unknown type level → null.
73
+ */
74
+ export declare function parseTypedAgentHost(hostname: string | undefined, zone: string, legacyParent: string): {
75
+ label: string;
76
+ name: string;
77
+ } | null;
78
+ /**
79
+ * The inverse: the public host a deployment serves an on-chain name at. `<label>.<parent>` for any parent in
80
+ * `legacyParents` (the ordered person / legacy roots an estate serves — a list, because an estate mid-migration
81
+ * serves several) → `<label>.<zone>`; `<label>.<tld>` for any other agent type → `<label>-<tld>.<zone>`. Deeper or
82
+ * untyped → null (no host to publish at). A projection of the name, never authority.
83
+ */
84
+ export declare function hostForName(name: string, zone: string, legacyParents: readonly string[]): string | null;
85
+ /**
86
+ * The on-chain name for an explicit handle (an edge path `POST /api/a2a/<handle>`, an injected subdomain header).
87
+ * A bare label is `<label>.<legacyParent>`; a typed handle (`x.t`, `x.t@c.u`, `c.u/x.t`) or a legacy dotted name
88
+ * is parsed by the grammar. Root and type-node forms name no subject → null. One grammar, no guessing.
89
+ */
90
+ export declare function agentNameForHandle(handle: string, legacyParent: string): string | null;
91
+ //# sourceMappingURL=dns.d.ts.map
@@ -0,0 +1 @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AiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM7D;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAU5I;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAOvG;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAWtF"}
package/dist/dns.js ADDED
@@ -0,0 +1,196 @@
1
+ /**
2
+ * DNS subdomain + A2A endpoint convention (spec 346 §5) — a PURE projection of a handle onto a zone
3
+ * the caller supplies. No hostname, zone or provider is baked in (ADR-0021): packages own the two
4
+ * protocol paths; apps/deployments own the zone.
5
+ *
6
+ * | handle | host | rule |
7
+ * | richcanvas.org | richcanvas.org | org = zone apex |
8
+ * | rpedersen.me (ownsDomain) | rpedersen.me | the real .me domain |
9
+ * | rpedersen.me (hosted) | rpedersen.<homeZone> | <label>.<home-zone> |
10
+ * | rpedersen.me@richcanvas.org | rpedersen.richcanvas.org | <person-label>.<zone> — no type |
11
+ * | architecture.team@richcanvas.org | architecture-team.richcanvas.org | <label>-<type>.<zone> |
12
+ * | northern-colorado.team (root) | northern-colorado-team.<zone> | hosted under the registry/governor zone |
13
+ *
14
+ * THE TYPE IS A HYPHENATED SUFFIX ON ONE LABEL, NOT ITS OWN LABEL (changed 2026-08-30). A DNS wildcard
15
+ * matches exactly one label, so `<label>.<type>.<zone>` needs a wildcard per type — and a cert per type,
16
+ * which public CAs (Cloudflare Universal SSL included) do not issue below `*.zone` without a paid add-on.
17
+ * Every agent under a zone at `<label>-<type>.<zone>` is covered by the one `*.<zone>` wildcard the zone
18
+ * already has. Folding the type into the label instead of dropping it keeps two properties the dotted form
19
+ * had: the type is legible in the host, and the projection stays REVERSIBLE — `alice.me` and `alice.org`
20
+ * would both want `alice.<zone>` if the type were simply dropped, forcing an inbound host to guess which
21
+ * root it meant. Persons and legacy roots keep the bare `<label>.<zone>` form, so a label ending in
22
+ * `-<agent-type>` is refused for them at claim time (`validateTypedClaim`) — the ambiguity is removed by
23
+ * construction rather than resolved by precedence.
24
+ *
25
+ * The type in DNS is still a fixed projection of the suffix and is NEVER parsed as authority.
26
+ */
27
+ import { parseAgentName } from './grammar.js';
28
+ import { allAgentTlds, derivedTypeForTld, isAgentTld } from './constants.js';
29
+ import { InvalidNameError } from './errors.js';
30
+ /** A2A JSON-RPC path (must equal `@agenticprimitives/a2a` `A2A_JSONRPC_PATH` — golden-vector tested, no import edge). */
31
+ export const A2A_JSONRPC_PATH = '/api/a2a';
32
+ /** A2A agent-card discovery path (origin-scoped — why every agent gets its own host). */
33
+ export const A2A_AGENT_CARD_PATH = '/.well-known/agent-card.json';
34
+ const HOSTNAME_RE = /^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z][a-z0-9-]{0,62}$/;
35
+ function assertZone(zone, what) {
36
+ const z = zone.trim().toLowerCase().replace(/\.$/, '');
37
+ if (!HOSTNAME_RE.test(z))
38
+ throw new InvalidNameError(zone, `${what} must be a DNS zone (got "${zone}")`);
39
+ return z;
40
+ }
41
+ /** Project a handle onto a DNS host per the §5 table. Root / type-node / legacy names have no host. */
42
+ export function dnsHostForHandle(name, opts) {
43
+ const p = typeof name === 'string' ? parseAgentName(name) : name;
44
+ const zone = assertZone(opts.zone, 'zone');
45
+ if (p.kind !== 'canonical' && p.kind !== 'scoped') {
46
+ throw new InvalidNameError(p.normalized, `no DNS host for a ${p.kind} name`);
47
+ }
48
+ const { label, tld } = p.handle;
49
+ const type = p.derivedType;
50
+ if (p.kind === 'canonical') {
51
+ if (type === 'org')
52
+ return zone;
53
+ if (type === 'person') {
54
+ if (opts.ownsDomain)
55
+ return `${label}.${tld}`;
56
+ return `${label}.${assertZone(opts.homeZone ?? opts.zone, 'homeZone')}`;
57
+ }
58
+ return `${label}-${tld}.${zone}`;
59
+ }
60
+ // scoped / contextual
61
+ if (type === 'person')
62
+ return `${label}.${zone}`;
63
+ return `${label}-${tld}.${zone}`;
64
+ }
65
+ /**
66
+ * The inverse of `dnsHostForHandle` for a hosted zone: `<label>-<type>.<zone>` → `<label>.<type>`, and a
67
+ * bare `<label>.<zone>` → null (a person/legacy label, whose root the deployment decides from its ordered
68
+ * root list). Pure; never guesses a type that is not in the closed suffix set.
69
+ */
70
+ export function handleForDnsHost(host, zone) {
71
+ const h = host.trim().toLowerCase().replace(/\.$/, '');
72
+ const z = zone.trim().toLowerCase().replace(/\.$/, '');
73
+ if (!h.endsWith(`.${z}`))
74
+ return null;
75
+ const rest = h.slice(0, h.length - z.length - 1);
76
+ if (!rest || rest.includes('.'))
77
+ return null;
78
+ for (const tld of allAgentTlds()) {
79
+ const suffix = `-${tld}`;
80
+ if (rest.endsWith(suffix) && rest.length > suffix.length) {
81
+ const label = rest.slice(0, -suffix.length);
82
+ const canonical = derivedTypeForTld(tld) === null ? tld : tld;
83
+ return { label, tld: canonical, name: `${label}.${canonical}` };
84
+ }
85
+ }
86
+ return null;
87
+ }
88
+ export function agentCardUrlForHost(host) {
89
+ return `https://${assertZone(host, 'host')}${A2A_AGENT_CARD_PATH}`;
90
+ }
91
+ export function a2aEndpointForHost(host) {
92
+ return `https://${assertZone(host, 'host')}${A2A_JSONRPC_PATH}`;
93
+ }
94
+ /** Edge-addressed alternative (spec 346 §5): `POST <edge>/api/a2a/<handle>` when a zone cannot mint subdomains. */
95
+ export function edgeA2aPathForHandle(edgeBase, name) {
96
+ const p = typeof name === 'string' ? parseAgentName(name) : name;
97
+ if (p.kind !== 'canonical' && p.kind !== 'scoped') {
98
+ throw new InvalidNameError(p.normalized, `no edge path for a ${p.kind} name`);
99
+ }
100
+ return `${edgeBase.replace(/\/+$/, '')}${A2A_JSONRPC_PATH}/${p.normalized}`;
101
+ }
102
+ // ── The deployment-zone projection (spec 346 §5, promoted from the agent runtime's host-context in spec 399
103
+ // §4): a Home and its runtime both serve names under ONE base zone and both had a copy of these — the Card
104
+ // Studio's "MUST match hostForName in demo-a2a" comment was the two-literal drift this closes. Every zone, root
105
+ // and parent is a PARAMETER; the deployment binds its own (ADR-0021). None of these is authority: a host is a
106
+ // projection of a name, and an inbound label is a CANDIDATE the caller resolves against the chain. ──────────
107
+ /**
108
+ * The single-label subdomain of `zone`: `alice.<zone>` → `alice`. The apex, deeper nesting, a non-matching host
109
+ * and any label in `exclude` (a Home passes `['www']`) → null. Port suffixes are ignored.
110
+ */
111
+ export function parseSubdomainLabel(hostname, zone, exclude = []) {
112
+ if (!hostname)
113
+ return null;
114
+ const host = (hostname.split(':')[0] ?? '').toLowerCase();
115
+ const base = zone.trim().toLowerCase().replace(/\.$/, '');
116
+ if (host === base || !host.endsWith('.' + base))
117
+ return null;
118
+ const label = host.slice(0, host.length - base.length - 1);
119
+ if (!label || label.includes('.') || exclude.includes(label))
120
+ return null;
121
+ return label;
122
+ }
123
+ /** `<label>-<type>` → the typed name it projects (`alice-home-church` → `alice-home.church`), or null when the
124
+ * label carries no known type suffix. A CANDIDATE — the caller resolves it against the chain. */
125
+ export function typedNameForLabel(rest) {
126
+ for (const tld of allAgentTlds()) {
127
+ const suffix = `-${tld}`;
128
+ if (rest.endsWith(suffix) && rest.length > suffix.length)
129
+ return `${rest.slice(0, -suffix.length)}.${tld}`;
130
+ }
131
+ return null;
132
+ }
133
+ /**
134
+ * The inbound host → the name it projects, for the two shapes ONE base zone serves:
135
+ * `<label>.<zone>` → `<label>-<type>` reads as `<label>.<type>`; otherwise `<label>.<legacyParent>`
136
+ * `<label>.<type>.<zone>` → `<label>.<type>` — the dotted form served until 2026-08-30, kept because cards
137
+ * published under it carry that URL in signed bytes; nothing emits it (`hostForName`).
138
+ * The DNS label is returned RAW as `label`: a label may read BOTH ways (`alice-home-church` is `alice-home.church`
139
+ * and also the legacy `alice-home-church.<legacyParent>`), so the choice belongs to the caller, which resolves an
140
+ * ORDERED candidate set against the chain — one mechanism, ordered candidates, not a fallback (ADR-0013).
141
+ * Apex, deeper nesting, an unknown type level → null.
142
+ */
143
+ export function parseTypedAgentHost(hostname, zone, legacyParent) {
144
+ if (!hostname)
145
+ return null;
146
+ const host = (hostname.split(':')[0] ?? '').toLowerCase();
147
+ const base = zone.trim().toLowerCase().replace(/\.$/, '');
148
+ if (host === base || !host.endsWith('.' + base))
149
+ return null;
150
+ const rest = host.slice(0, host.length - base.length - 1);
151
+ const parts = rest.split('.');
152
+ if (parts.length === 1 && parts[0])
153
+ return { label: parts[0], name: typedNameForLabel(parts[0]) ?? `${parts[0]}.${legacyParent}` };
154
+ if (parts.length === 2 && parts[0] && isAgentTld(parts[1]))
155
+ return { label: `${parts[0]}.${parts[1]}`, name: `${parts[0]}.${parts[1]}` };
156
+ return null;
157
+ }
158
+ /**
159
+ * The inverse: the public host a deployment serves an on-chain name at. `<label>.<parent>` for any parent in
160
+ * `legacyParents` (the ordered person / legacy roots an estate serves — a list, because an estate mid-migration
161
+ * serves several) → `<label>.<zone>`; `<label>.<tld>` for any other agent type → `<label>-<tld>.<zone>`. Deeper or
162
+ * untyped → null (no host to publish at). A projection of the name, never authority.
163
+ */
164
+ export function hostForName(name, zone, legacyParents) {
165
+ const parts = name.trim().toLowerCase().split('.');
166
+ if (parts.length !== 2 || !parts[0] || !parts[1])
167
+ return null;
168
+ const [label, tld] = parts;
169
+ if (legacyParents.includes(tld))
170
+ return `${label}.${zone}`;
171
+ if (isAgentTld(tld))
172
+ return `${label}-${tld}.${zone}`;
173
+ return null;
174
+ }
175
+ /**
176
+ * The on-chain name for an explicit handle (an edge path `POST /api/a2a/<handle>`, an injected subdomain header).
177
+ * A bare label is `<label>.<legacyParent>`; a typed handle (`x.t`, `x.t@c.u`, `c.u/x.t`) or a legacy dotted name
178
+ * is parsed by the grammar. Root and type-node forms name no subject → null. One grammar, no guessing.
179
+ */
180
+ export function agentNameForHandle(handle, legacyParent) {
181
+ const h = handle.trim().toLowerCase();
182
+ if (!h)
183
+ return null;
184
+ if (!h.includes('.') && !h.includes('@') && !h.includes('/'))
185
+ return `${h}.${legacyParent}`;
186
+ try {
187
+ const p = parseAgentName(h);
188
+ return p.kind === 'canonical' || p.kind === 'scoped' || p.kind === 'legacy' ? p.normalized : null;
189
+ }
190
+ catch (e) {
191
+ if (e instanceof InvalidNameError)
192
+ return null;
193
+ throw e;
194
+ }
195
+ }
196
+ //# sourceMappingURL=dns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dns.js","sourceRoot":"","sources":["../src/dns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,cAAc,EAAwB,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,yHAAyH;AACzH,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAmB,CAAC;AACpD,yFAAyF;AACzF,MAAM,CAAC,MAAM,mBAAmB,GAAG,8BAAuC,CAAC;AAW3E,MAAM,WAAW,GAAG,4EAA4E,CAAC;AAEjG,SAAS,UAAU,CAAC,IAAY,EAAE,IAAY;IAC5C,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACvD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,MAAM,IAAI,gBAAgB,CAAC,IAAI,EAAE,GAAG,IAAI,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G,CAAC,GAAG,KAAyB,CAAC;IAC/C,IAAI,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,KAAK,IAAI,IAAI,EAAE,CAAC;IAC3D,IAAI,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,KAAK,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;IACtD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc,EAAE,YAAoB;IACrE,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACtC,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACpB,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC,IAAI,YAAY,EAAE,CAAC;IAC5F,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;QAC5B,OAAO,CAAC,CAAC,IAAI,KAAK,WAAW,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;IACpG,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,YAAY,gBAAgB;YAAE,OAAO,IAAI,CAAC;QAC/C,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Typed name grammar (spec 346 §3). Pure — no I/O.
3
+ *
4
+ * label := normalizeLabel rules ([a-z0-9-], no edge hyphens, ≤ 63)
5
+ * tld := me | org | team | svc | workspace | treasury (alias ws → workspace)
6
+ * handle := label '.' tld canonical, root-level: rpedersen.me
7
+ * x@ctx := handle '@' handle context-issued name: vault.svc@richcanvas.org
8
+ * ctx/x := handle '/' handle URL-safe rendering of x@ctx
9
+ * dotted := x.t.c.u the on-chain form of x.t@c.u
10
+ * type-node := t.c.u the intermediate node an issuing context owns
11
+ * root := tld | legacy-tld a bare root node (namehash('me'), namehash('agent'))
12
+ * legacy := <anything>.impact | <anything>.agent untyped, never validated (spec 346 §3.5)
13
+ *
14
+ * The derived type of ANY name is the tld of the part before the first `@`. The context (after `@`)
15
+ * MUST be an org / team / workspace handle. v1: one level of context.
16
+ */
17
+ import type { Hex, DerivedAgentType } from '@agenticprimitives/types';
18
+ import { type AnyAgentTld, type LegacyTld } from './constants.js';
19
+ export type ParsedAgentNameKind = 'root' | 'canonical' | 'scoped' | 'type-node' | 'legacy';
20
+ export interface ParsedAgentName {
21
+ kind: ParsedAgentNameKind;
22
+ /** Canonical display form: `x.t` / `x.t@c.u` / dotted for root, type-node and legacy. */
23
+ normalized: string;
24
+ /** Dotted on-chain form (`x.t.c.u`); `namehash` is computed over this. */
25
+ onChainName: string;
26
+ /** Normalized labels of `onChainName`, leaf first. */
27
+ labels: readonly string[];
28
+ /** `namehash(onChainName)`. */
29
+ node: Hex;
30
+ /** The root suffix of the on-chain name (`u` for scoped, `t` for canonical). `null` for root kind. */
31
+ tld: AnyAgentTld | LegacyTld | null;
32
+ legacy: boolean;
33
+ /** The subject handle (canonical + scoped only). */
34
+ handle?: {
35
+ label: string;
36
+ tld: AnyAgentTld;
37
+ };
38
+ /** GENERIC derived type the name's suffix names (a vertical suffix reports its parent). `null` for root / type-node / legacy. */
39
+ derivedType: DerivedAgentType | null;
40
+ /** The vertical subtype a registered vertical suffix names (spec 346 §2.4); absent for generic suffixes. */
41
+ subtype?: string;
42
+ /** The issuing context (scoped + type-node only). */
43
+ context?: {
44
+ label: string;
45
+ tld: AnyAgentTld;
46
+ derivedType: DerivedAgentType;
47
+ };
48
+ }
49
+ /** `PermissionlessSubregistry.MIN_LABEL_LENGTH` — root-level claims only. */
50
+ export declare const MIN_ROOT_LABEL_LENGTH = 3;
51
+ /**
52
+ * Parse any accepted form into its canonical structure. Throws `InvalidNameError` with a
53
+ * `reason` prefixed by a stable code (`context_depth`, `reserved_label`, `unknown_tld`, `context_type`,
54
+ * `handle_shape`, `context_shape`, `structure`, `label_too_short`).
55
+ */
56
+ export declare function parseAgentName(input: string): ParsedAgentName;
57
+ export type AgentNameForm = 'at' | 'path' | 'dotted';
58
+ /** Render a parsed name. `at` (default) is the canonical display form; `path` is URL-safe; `dotted` is on-chain. */
59
+ export declare function formatAgentName(p: ParsedAgentName, form?: AgentNameForm): string;
60
+ /** The dotted on-chain form of any accepted input (what `namehash` hashes). */
61
+ export declare function onChainNameOf(input: string): string;
62
+ //# sourceMappingURL=grammar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grammar.d.ts","sourceRoot":"","sources":["../src/grammar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAQL,KAAK,WAAW,EAChB,KAAK,SAAS,EACf,MAAM,gBAAgB,CAAC;AAKxB,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE3F,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,mBAAmB,CAAC;IAC1B,yFAAyF;IACzF,UAAU,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,WAAW,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,+BAA+B;IAC/B,IAAI,EAAE,GAAG,CAAC;IACV,sGAAsG;IACtG,GAAG,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,CAAC;IACpC,MAAM,EAAE,OAAO,CAAC;IAChB,oDAAoD;I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