@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.
Files changed (75) hide show
  1. package/AUDIT.md +52 -2
  2. package/CLAUDE.md +43 -64
  3. package/README.md +57 -54
  4. package/dist/abis.d.ts +1113 -11
  5. package/dist/abis.d.ts.map +1 -1
  6. package/dist/abis.js +184 -0
  7. package/dist/abis.js.map +1 -1
  8. package/dist/claim.d.ts +103 -0
  9. package/dist/claim.d.ts.map +1 -0
  10. package/dist/claim.js +131 -0
  11. package/dist/claim.js.map +1 -0
  12. package/dist/client.d.ts +36 -1
  13. package/dist/client.d.ts.map +1 -1
  14. package/dist/client.js +197 -10
  15. package/dist/client.js.map +1 -1
  16. package/dist/constants.d.ts +75 -5
  17. package/dist/constants.d.ts.map +1 -1
  18. package/dist/constants.js +156 -4
  19. package/dist/constants.js.map +1 -1
  20. package/dist/custody.d.ts +149 -10
  21. package/dist/custody.d.ts.map +1 -1
  22. package/dist/custody.js +243 -13
  23. package/dist/custody.js.map +1 -1
  24. package/dist/dns.d.ts +186 -0
  25. package/dist/dns.d.ts.map +1 -0
  26. package/dist/dns.js +296 -0
  27. package/dist/dns.js.map +1 -0
  28. package/dist/federated.d.ts +31 -0
  29. package/dist/federated.d.ts.map +1 -0
  30. package/dist/federated.js +54 -0
  31. package/dist/federated.js.map +1 -0
  32. package/dist/grammar.d.ts +62 -0
  33. package/dist/grammar.d.ts.map +1 -0
  34. package/dist/grammar.js +165 -0
  35. package/dist/grammar.js.map +1 -0
  36. package/dist/hash.d.ts +14 -0
  37. package/dist/hash.d.ts.map +1 -0
  38. package/dist/hash.js +22 -0
  39. package/dist/hash.js.map +1 -0
  40. package/dist/index.d.ts +17 -9
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +23 -8
  43. package/dist/index.js.map +1 -1
  44. package/dist/issuance.d.ts +70 -0
  45. package/dist/issuance.d.ts.map +1 -0
  46. package/dist/issuance.js +65 -0
  47. package/dist/issuance.js.map +1 -0
  48. package/dist/label.d.ts +10 -0
  49. package/dist/label.d.ts.map +1 -0
  50. package/dist/label.js +39 -0
  51. package/dist/label.js.map +1 -0
  52. package/dist/namehash.d.ts +10 -23
  53. package/dist/namehash.d.ts.map +1 -1
  54. package/dist/namehash.js +11 -35
  55. package/dist/namehash.js.map +1 -1
  56. package/dist/normalize.d.ts +9 -17
  57. package/dist/normalize.d.ts.map +1 -1
  58. package/dist/normalize.js +11 -48
  59. package/dist/normalize.js.map +1 -1
  60. package/dist/price.d.ts +74 -0
  61. package/dist/price.d.ts.map +1 -0
  62. package/dist/price.js +65 -0
  63. package/dist/price.js.map +1 -0
  64. package/dist/records.d.ts +44 -3
  65. package/dist/records.d.ts.map +1 -1
  66. package/dist/records.js +203 -4
  67. package/dist/records.js.map +1 -1
  68. package/dist/types.d.ts +108 -3
  69. package/dist/types.d.ts.map +1 -1
  70. package/dist/vertical.d.ts +43 -0
  71. package/dist/vertical.d.ts.map +1 -0
  72. package/dist/vertical.js +44 -0
  73. package/dist/vertical.js.map +1 -0
  74. package/docs/api.md +15 -1
  75. package/package.json +22 -13
package/dist/custody.js CHANGED
@@ -15,16 +15,32 @@
15
15
  * Phase 4 lands the encoders; the client (`AgentNamingClient`) layers
16
16
  * walletClient submission on top.
17
17
  */
18
- import { encodeFunctionData } from 'viem';
19
- import { agentNameAttributeResolverAbi, agentNameRegistryAbi, permissionlessSubregistryAbi, } from './abis';
20
- import { PREDICATE_ID, AGENT_KIND_ID } from './records';
18
+ import { encodeAbiParameters, encodeFunctionData, keccak256, toBytes, toHex } from 'viem';
19
+ import { normalizeLabel } from './normalize.js';
20
+ import { agentNameAttributeResolverAbi, agentNameRegistryAbi, permissionlessSubregistryAbi, } from './abis.js';
21
+ import { PREDICATE_ID, AGENT_KIND_ID, AGENT_TYPE_ID, encodeAccounts } 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, assertClaimableLabel, knownRootOfNode } from './claim.js';
26
+ import { derivedTypeForTld } from './constants.js';
21
27
  // ─── Registry writes ───────────────────────────────────────────────
22
28
  /**
23
29
  * Build a call to register `<label>.<parent>` under the parent
24
30
  * namespace. Caller MUST be the parent's owner OR subregistry
25
31
  * delegate (msg.sender check on chain).
32
+ *
33
+ * Spec 445 / NAME-8: when `parentNode` is a ROOT this process knows (a typed, legacy or vertical root) the label is
34
+ * an agent's and the claim rule applies (`labelClaimViolation`): reserved labels refused, and under a bare-host
35
+ * root a label ending in `-<type>` refused. Any other parent (a context registering its type-nodes, an app's own
36
+ * subtree) is not judged here — a type word IS the label of a type-node.
26
37
  */
27
38
  export function buildRegisterSubnameCall(args) {
39
+ // AN-1: normalize + reject on the WRITE path (homoglyph/case/zero-width squat defense).
40
+ const label = normalizeLabel(args.label);
41
+ const root = knownRootOfNode(args.parentNode);
42
+ if (root)
43
+ assertClaimableLabel(label, { root });
28
44
  return {
29
45
  to: args.registry,
30
46
  value: 0n,
@@ -33,7 +49,7 @@ export function buildRegisterSubnameCall(args) {
33
49
  functionName: 'register',
34
50
  args: [
35
51
  args.parentNode,
36
- args.label,
52
+ label,
37
53
  args.newOwner,
38
54
  args.resolver ?? '0x0000000000000000000000000000000000000000',
39
55
  args.expiry ?? 0n,
@@ -43,7 +59,13 @@ export function buildRegisterSubnameCall(args) {
43
59
  }
44
60
  /**
45
61
  * Build a call to rotate the owner Smart Agent for a name.
46
- * Caller MUST be the current owner.
62
+ * Caller MUST be the current owner, and the name must not be expired (`NameExpired`).
63
+ *
64
+ * Spec 445 / generation 4 / B2 (REG-4): RECORDS DO NOT CARRY OVER. Moving the name to a DIFFERENT owner bumps its
65
+ * record epoch (`RecordEpochBumped`), and `AgentNameAttributeResolver` keys every record by `(node, epoch)` — so
66
+ * after this call `atl:addr`, `atl:agentType` and every other record of the node read empty, and transferring back
67
+ * does not resurrect them. The new owner writes its own records. The `resolver` and `subregistry` POINTERS are not
68
+ * reset: a receiver of a transferred name must check them.
47
69
  */
48
70
  export function buildRotateNameOwnerCall(args) {
49
71
  return {
@@ -118,6 +140,21 @@ export function buildSetStringAttributeCall(args) {
118
140
  };
119
141
  }
120
142
  /** Build a typed `setAddressAttribute(node, predicate, value)` call. */
143
+ /**
144
+ * `string[]` attribute write (`atl:accounts` — spec 346 §3.8 / ap-federation spec 440 §C). The resolver validates the
145
+ * predicate's datatype on chain; the caller validates the VALUES with `encodeAccounts` first, as `buildRecordCalls` does.
146
+ */
147
+ export function buildSetStringArrayAttributeCall(args) {
148
+ return {
149
+ to: args.resolver,
150
+ value: 0n,
151
+ data: encodeFunctionData({
152
+ abi: agentNameAttributeResolverAbi,
153
+ functionName: 'setStringArrayAttribute',
154
+ args: [args.node, args.predicate, [...args.values]],
155
+ }),
156
+ };
157
+ }
121
158
  export function buildSetAddressAttributeCall(args) {
122
159
  return {
123
160
  to: args.resolver,
@@ -172,6 +209,21 @@ export function buildRecordCalls(args) {
172
209
  if (records.mcpEndpoint !== undefined) {
173
210
  out.push(buildSetStringAttributeCall({ resolver, node, predicate: PREDICATE_ID.mcpEndpoint, value: records.mcpEndpoint }));
174
211
  }
212
+ if (records.appContext !== undefined) {
213
+ out.push(buildSetStringAttributeCall({ resolver, node, predicate: PREDICATE_ID.appContext, value: records.appContext }));
214
+ }
215
+ if (records.orgRole !== undefined) {
216
+ out.push(buildSetStringAttributeCall({ resolver, node, predicate: PREDICATE_ID.orgRole, value: records.orgRole }));
217
+ }
218
+ if (records.serviceUrl !== undefined) {
219
+ out.push(buildSetStringAttributeCall({ resolver, node, predicate: PREDICATE_ID.serviceUrl, value: records.serviceUrl }));
220
+ }
221
+ if (records.siteUrl !== undefined) {
222
+ out.push(buildSetStringAttributeCall({ resolver, node, predicate: PREDICATE_ID.siteUrl, value: records.siteUrl }));
223
+ }
224
+ if (records.description !== undefined) {
225
+ out.push(buildSetStringAttributeCall({ resolver, node, predicate: PREDICATE_ID.description, value: records.description }));
226
+ }
175
227
  if (records.metadataUri !== undefined) {
176
228
  out.push(buildSetStringAttributeCall({ resolver, node, predicate: PREDICATE_ID.metadataUri, value: records.metadataUri }));
177
229
  }
@@ -187,28 +239,206 @@ export function buildRecordCalls(args) {
187
239
  if (records.nativeId !== undefined) {
188
240
  out.push(buildSetStringAttributeCall({ resolver, node, predicate: PREDICATE_ID.nativeId, value: records.nativeId }));
189
241
  }
242
+ // One account per chain, CAIP-10, sorted — validated by `encodeAccounts` BEFORE any signature (mirrors `encodeRecords`).
243
+ if (records.accounts !== undefined) {
244
+ out.push(buildSetStringArrayAttributeCall({ resolver, node, predicate: PREDICATE_ID.accounts, values: encodeAccounts(records.accounts) }));
245
+ }
246
+ // spec 347 §8.3 — released A2A card publication records (mirrors `encodeRecords`).
247
+ if (records.cardDigest !== undefined) {
248
+ out.push(buildSetBytes32AttributeCall({ resolver, node, predicate: PREDICATE_ID.cardDigest, value: records.cardDigest }));
249
+ }
250
+ if (records.cardUri !== undefined) {
251
+ out.push(buildSetStringAttributeCall({ resolver, node, predicate: PREDICATE_ID.cardUri, value: records.cardUri }));
252
+ }
190
253
  return out;
191
254
  }
192
255
  // ─── PermissionlessSubregistry ─────────────────────────────────────
193
256
  /**
194
- * Build a call to claim `<label>.<parent>` through a deployed
195
- * PermissionlessSubregistry instance. The caller pays gas; the
196
- * registered child name is owned by `newOwner` (typically the
197
- * caller's own PSA OR an account they control).
257
+ * Spec 445 / generation 4 / B2 (REG-5) — the PermissionlessSubregistry claim is COMMIT-REVEAL. The two windows are
258
+ * contract constants (`MIN_COMMIT_AGE()` / `MAX_COMMIT_AGE()`); they are mirrored here so a client can schedule the
259
+ * reveal without a read, and a test pins them to the contract.
260
+ */
261
+ export const SUBREGISTRY_MIN_COMMIT_AGE_SECONDS = 10;
262
+ export const SUBREGISTRY_MAX_COMMIT_AGE_SECONDS = 86_400;
263
+ /** 32 fresh random bytes for one claim. The CLIENT keeps it between the commit and the reveal, and never sends it
264
+ * anywhere before the reveal — whoever learns it before the reveal can reveal for the same owner, nothing more
265
+ * (the commitment binds `newOwner`, so a copied secret never yields the name to anyone else). */
266
+ export function generateClaimSecret() {
267
+ return toHex(crypto.getRandomValues(new Uint8Array(32)));
268
+ }
269
+ /**
270
+ * The commitment `PermissionlessSubregistry.makeCommitment(label, newOwner, secret)` computes, off chain:
271
+ * `keccak256(abi.encode(subregistry, chainId, keccak256(bytes(label)), newOwner, secret))`. The label is normalized
272
+ * first — the reveal sends the normalized label, so the commitment must be over the same bytes.
273
+ */
274
+ export function subregistryCommitment(args) {
275
+ const label = normalizeLabel(args.label);
276
+ return keccak256(encodeAbiParameters([{ type: 'address' }, { type: 'uint256' }, { type: 'bytes32' }, { type: 'address' }, { type: 'bytes32' }], [args.subregistry, BigInt(args.chainId), keccak256(toBytes(label)), args.newOwner, args.secret]));
277
+ }
278
+ /**
279
+ * STEP 1 of a PermissionlessSubregistry claim: `commit(commitment)`. The label is NOT visible on chain until the
280
+ * reveal, so a watcher of the mempool cannot take the name first.
281
+ *
282
+ * THE WAITING PERIOD. The reveal (`buildSubregistryRegisterCall`, same label / owner / secret) must land in a LATER
283
+ * transaction at least `SUBREGISTRY_MIN_COMMIT_AGE_SECONDS` (10 s of chain time) after this one is mined, and no more
284
+ * than `SUBREGISTRY_MAX_COMMIT_AGE_SECONDS` (1 day) after it — too early reverts `CommitmentTooNew(commitment,
285
+ * matureAt)`, too late `CommitmentExpired`. Both calls therefore can NOT share one user operation or one batch: a
286
+ * flow that claimed a name in one transaction is now two, with a wait between. The commitment is single-use, and a
287
+ * live one cannot be re-committed (`CommitmentPending`); after it expires, commit again (a fresh secret is best).
288
+ *
289
+ * The label is validated here exactly as at the reveal (normalization + NAME-8), so a claim the reveal would refuse
290
+ * never spends a commit.
291
+ */
292
+ export function buildSubregistryCommitCall(args) {
293
+ const label = normalizeLabel(args.label);
294
+ assertClaimableLabel(label, { root: args.root ?? null });
295
+ assertSecret(args.secret);
296
+ const commitment = subregistryCommitment({ ...args, label });
297
+ return {
298
+ to: args.subregistry,
299
+ value: 0n,
300
+ data: encodeFunctionData({ abi: permissionlessSubregistryAbi, functionName: 'commit', args: [commitment] }),
301
+ commitment,
302
+ };
303
+ }
304
+ function assertSecret(secret) {
305
+ if (typeof secret !== 'string' || !/^0x[0-9a-fA-F]{64}$/.test(secret))
306
+ throw new Error('[agent-naming] a claim secret is 32 bytes (0x + 64 hex) — generateClaimSecret()');
307
+ if (/^0x0{64}$/.test(secret))
308
+ throw new Error('[agent-naming] a claim secret must not be zero — anyone could compute the commitment');
309
+ }
310
+ /**
311
+ * STEP 2 — the REVEAL: `register(label, newOwner, secret)` through a deployed PermissionlessSubregistry. It succeeds
312
+ * only against a MATURED commitment from `buildSubregistryCommitCall` with the same label, owner and secret (see the
313
+ * waiting period there). The caller pays gas; any account may send the reveal (a relayer) — the name goes to
314
+ * `newOwner`, which the commitment fixed.
198
315
  *
199
- * Anti-spam: one claim per `msg.sender` is enforced on chain; the
200
- * call reverts with `AlreadyClaimed(existingNode)` if the caller
201
- * has previously claimed a name through this subregistry instance.
316
+ * One reveal per `msg.sender` is enforced on chain (`AlreadyClaimed(existingNode)`) — a courtesy limit, not sybil
317
+ * resistance. The chain also refuses reserved labels (`ReservedLabel`) and, under a bare-host root, labels that read
318
+ * as a typed name (`LabelReadsAsTypedName`); the same rule is checked here first.
202
319
  */
203
320
  export function buildSubregistryRegisterCall(args) {
321
+ // AN-1: normalize + reject on the WRITE path (homoglyph/case/zero-width squat defense).
322
+ const label = normalizeLabel(args.label);
323
+ // NAME-8: reserved labels and (under a bare-host root) labels that read as a typed name are not claimable here.
324
+ assertClaimableLabel(label, { root: args.root ?? null });
325
+ assertSecret(args.secret);
204
326
  return {
205
327
  to: args.subregistry,
206
328
  value: 0n,
207
329
  data: encodeFunctionData({
208
330
  abi: permissionlessSubregistryAbi,
209
331
  functionName: 'register',
210
- args: [args.label, args.newOwner],
332
+ args: [label, args.newOwner, args.secret],
211
333
  }),
212
334
  };
213
335
  }
336
+ /**
337
+ * `renew(node, newExpiry)` — spec 445 / generation 4 / B2 (REG-6). Expiry is the PARENT's term: the caller MUST be
338
+ * the parent authority (the parent node's owner or its subregistry), never the name's holder. Extension only:
339
+ * `newExpiry` is `0` (make permanent) or later than both the current expiry and now, else `ExpiryNotExtended()`. A
340
+ * root has no parent and cannot be renewed. Every shipped path registers permanent names (expiry 0).
341
+ */
342
+ export function buildRenewNameCall(args) {
343
+ const newExpiry = BigInt(args.newExpiry);
344
+ if (newExpiry < 0n || newExpiry >= 1n << 64n)
345
+ throw new Error('[agent-naming] newExpiry is a uint64 (0 = permanent)');
346
+ return {
347
+ to: args.registry,
348
+ value: 0n,
349
+ data: encodeFunctionData({ abi: agentNameRegistryAbi, functionName: 'renew', args: [args.node, newExpiry] }),
350
+ };
351
+ }
352
+ // ─── Typed naming (spec 346) ────────────────────────────────────────
353
+ /**
354
+ * Step 1b of the bootstrap (spec 346 §3.6): declare the SA's derived type on its OWN profile subject.
355
+ * `msg.sender` MUST be the SA (`AgentProfileResolver.onlyAgent`) — compose these into the SA's execute
356
+ * batch. Registers the profile mirror first when `registered` is false (the typed setters require it),
357
+ * writing the ROOT kind there; then `atl:agentType` (+ `atl:serviceRole` when given, REQUIRED and equal
358
+ * to the type name for `workspace` and `registry`).
359
+ */
360
+ export function buildDeclareAgentTypeCalls(args) {
361
+ if (ROLE_TYPED.has(args.agentType) && args.serviceRole !== args.agentType) {
362
+ throw new Error(`[agent-naming] ${args.agentType} requires serviceRole = '${args.agentType}'`);
363
+ }
364
+ const calls = [];
365
+ if (!args.registered) {
366
+ calls.push({
367
+ to: args.profileResolver,
368
+ value: 0n,
369
+ data: encodeFunctionData({
370
+ abi: agentProfileResolverTypeAbi,
371
+ functionName: 'register',
372
+ args: [args.agent, args.displayName ?? '', '', AGENT_KIND_ID[rootClassForDerivedType(args.agentType)], ''],
373
+ }),
374
+ });
375
+ }
376
+ calls.push({
377
+ to: args.profileResolver,
378
+ value: 0n,
379
+ data: encodeFunctionData({
380
+ abi: agentProfileResolverTypeAbi,
381
+ functionName: 'setBytes32Property',
382
+ args: [args.agent, PREDICATE_ID.agentType, AGENT_TYPE_ID[args.agentType]],
383
+ }),
384
+ });
385
+ if (args.serviceRole !== undefined) {
386
+ calls.push({
387
+ to: args.profileResolver,
388
+ value: 0n,
389
+ data: encodeFunctionData({
390
+ abi: agentProfileResolverTypeAbi,
391
+ functionName: 'setStringProperty',
392
+ args: [args.agent, PREDICATE_ID.serviceRole, args.serviceRole],
393
+ }),
394
+ });
395
+ }
396
+ if (args.subtype !== undefined) {
397
+ calls.push({
398
+ to: args.profileResolver,
399
+ value: 0n,
400
+ data: encodeFunctionData({
401
+ abi: agentProfileResolverTypeAbi,
402
+ functionName: 'setStringProperty',
403
+ args: [args.agent, PREDICATE_ID.agentSubtype, args.subtype],
404
+ }),
405
+ });
406
+ }
407
+ return calls;
408
+ }
409
+ /**
410
+ * Steps 2–3 of the bootstrap for a CANONICAL (root-level) typed name (spec 346 §3.3): claim
411
+ * `<label>.<tld>` through that root's `PermissionlessSubregistry`, write the root kind + optional records
412
+ * on the new node, and set the primary name. The caller MUST have run `validateTypedClaim` (or
413
+ * `AgentNamingClient.checkTypedName`) — this builder only refuses a suffix/type disagreement it can see
414
+ * locally. `setPrimaryName` requires `msg.sender == owner`; the subregistry claim may be sent by anyone.
415
+ *
416
+ * Spec 445 / generation 4 / B2 (REG-5): the claim is TWO transactions. Send `commit` first; after it is mined, wait
417
+ * at least `SUBREGISTRY_MIN_COMMIT_AGE_SECONDS` (and at most a day — see `buildSubregistryCommitCall`), then send
418
+ * `claim` (the reveal) followed by `records` and `primaryName`. `secret` is the client's (`generateClaimSecret()`),
419
+ * kept between the two; `chainId` is the subregistry's chain, part of the commitment.
420
+ */
421
+ export function buildTypedClaimCalls(args) {
422
+ const p = parseAgentName(args.name);
423
+ if (p.kind !== 'canonical') {
424
+ throw new Error(`[agent-naming] buildTypedClaimCalls handles canonical names only (got ${p.kind} "${p.normalized}")`);
425
+ }
426
+ const expected = derivedTypeForTld(p.handle.tld);
427
+ if (expected !== args.agentType) {
428
+ throw new Error(`[agent-naming] type_mismatch: ".${p.handle.tld}" names ${expected}, subject declares ${args.agentType}`);
429
+ }
430
+ const subregistry = args.subregistries[p.handle.tld];
431
+ if (!subregistry)
432
+ throw new Error(`[agent-naming] no PermissionlessSubregistry configured for ".${p.handle.tld}"`);
433
+ const claimArgs = { subregistry, label: p.handle.label, newOwner: args.owner, root: p.handle.tld, secret: args.secret };
434
+ const { commitment, ...commit } = buildSubregistryCommitCall({ ...claimArgs, chainId: args.chainId });
435
+ const claim = buildSubregistryRegisterCall(claimArgs);
436
+ const records = buildRecordCalls({
437
+ resolver: args.resolver,
438
+ node: p.node,
439
+ records: { ...(args.records ?? {}), addr: args.owner, agentKind: rootClassForDerivedType(args.agentType) },
440
+ });
441
+ const primaryName = buildSetPrimaryNameCall({ registry: args.registry, node: p.node });
442
+ return { commit, commitment, claim, records, primaryName, node: p.node };
443
+ }
214
444
  //# 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,EACL,6BAA6B,EAC7B,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAsB,MAAM,WAAW,CAAC;AAU5E,sEAAsE;AAEtE;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,IAOxC;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,E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I,CAAC,QAAQ;QACvB,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,OAAO,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,uBAAuB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;KAC3G,CAAC,CAAC;IACH,MAAM,WAAW,GAAG,uBAAuB,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACvF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AAC3E,CAAC"}
package/dist/dns.d.ts ADDED
@@ -0,0 +1,186 @@
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.
22
+ *
23
+ * THE PROJECTION IS INJECTIVE, AND THIS IS THE WHOLE RULE (spec 445, audit NAME-8). Two shapes share one zone —
24
+ * typed `<label>-<type>.<zone>` and bare `<label>.<zone>` (persons and untyped roots) — so three things hold, each
25
+ * enforced where the host is MADE and where it is READ, not only at claim time:
26
+ *
27
+ * 1. a bare label that ends in `-<type>` HAS NO HOST. `foo-org` under a person or legacy root would be
28
+ * `foo-org.<zone>`, the host of the typed `foo.org`; the forward functions refuse it (throw / null) and the
29
+ * claim helpers refuse to register it (`labelClaimViolation`). It is refused for LEGACY roots as well as
30
+ * persons — before 2026-11-10 only `validateTypedClaim` knew the rule, and only for persons.
31
+ * 2. a type suffix is one hyphen-free word (`registerVerticalAgentTypes` refuses a hyphen), so a typed label
32
+ * splits exactly one way: the type is the segment after the last hyphen (`typeSuffixOfLabel`).
33
+ * 3. a reserved label (`www`, `api`, `mtls`, `edge`, `well-known`, the type words) has no host and reads back
34
+ * as no name.
35
+ *
36
+ * So for one zone and ONE bare root, no two distinct names share a host and host → name is a function. An estate
37
+ * that serves SEVERAL bare roots (mid-migration: `alice.me` and `alice.agent` are both `alice.<zone>`) is the one
38
+ * place two names share a host by configuration; `confirmDnsHost` reports it unless both resolve to one agent.
39
+ *
40
+ * WHAT THIS FILE CANNOT DO: stop a name being registered. The chain enforces charset and length only, so a label
41
+ * this SDK refuses can exist on chain (registered before the rule, or by a direct contract call). Every inverse
42
+ * here is therefore a HINT about which name a host means — routing confirms it against the chain
43
+ * (`confirmDnsHost`: every reading is resolved, and two readings held by different agents is an explicit
44
+ * `ambiguous` result the router refuses, never a precedence pick).
45
+ *
46
+ * The type in DNS is still a fixed projection of the suffix and is NEVER parsed as authority.
47
+ */
48
+ import { type ParsedAgentName } from './grammar.js';
49
+ import type { Address } from '@agenticprimitives/types';
50
+ /** A2A JSON-RPC path (must equal `@agenticprimitives/a2a` `A2A_JSONRPC_PATH` — golden-vector tested, no import edge). */
51
+ export declare const A2A_JSONRPC_PATH: "/api/a2a";
52
+ /** A2A agent-card discovery path (origin-scoped — why every agent gets its own host). */
53
+ export declare const A2A_AGENT_CARD_PATH: "/.well-known/agent-card.json";
54
+ export interface DnsHostOptions {
55
+ /** The zone the context principal controls: an org apex (`richcanvas.org`) or a Home/registry zone. */
56
+ zone: string;
57
+ /** For hosted persons: the Home zone (e.g. `home.example`). Defaults to `zone`. */
58
+ homeZone?: string;
59
+ /** The person owns the real `.me` domain matching the handle — the host IS the handle. */
60
+ ownsDomain?: boolean;
61
+ }
62
+ /**
63
+ * Project a handle onto a DNS host per the §5 table. Root / type-node / legacy names have no host — and neither
64
+ * does a hosted person whose label ends in `-<type>` (rule 1: throws `label_reads_as_type`, never the colliding
65
+ * host). A person on their OWN domain (`ownsDomain`) is not on a shared zone and is not affected.
66
+ */
67
+ export declare function dnsHostForHandle(name: string | ParsedAgentName, opts: DnsHostOptions): string;
68
+ /**
69
+ * The inverse of `dnsHostForHandle` for a hosted zone: `<label>-<type>.<zone>` → `<label>.<type>`, and a
70
+ * bare `<label>.<zone>` → null (a person/legacy label, whose root the deployment decides from its root list).
71
+ * Pure and single-valued: exactly one handle or null — the split is unique (rule 2), a reserved or malformed
72
+ * label reads as nothing (rule 3), and no bare name projects onto a typed host (rule 1).
73
+ *
74
+ * A HINT, NOT AN ANSWER. It says which name this SDK would have projected here; it cannot know that the chain
75
+ * also holds a bare-root name with the same label. Confirm with `confirmDnsHost` (or resolve the name and check
76
+ * its records) before routing — resolution is by records, never by parsing a subdomain.
77
+ */
78
+ export declare function handleForDnsHost(host: string, zone: string): {
79
+ label: string;
80
+ tld: string;
81
+ name: string;
82
+ } | null;
83
+ export declare function agentCardUrlForHost(host: string): string;
84
+ export declare function a2aEndpointForHost(host: string): string;
85
+ /** Edge-addressed alternative (spec 346 §5): `POST <edge>/api/a2a/<handle>` when a zone cannot mint subdomains. */
86
+ export declare function edgeA2aPathForHandle(edgeBase: string, name: string | ParsedAgentName): string;
87
+ /**
88
+ * The single-label subdomain of `zone`: `alice.<zone>` → `alice`. The apex, deeper nesting, a non-matching host
89
+ * and any label in `exclude` (a Home passes `['www']`) → null. Port suffixes are ignored.
90
+ */
91
+ export declare function parseSubdomainLabel(hostname: string | undefined, zone: string, exclude?: readonly string[]): string | null;
92
+ /** `<label>-<type>` → the typed name it projects (`alice-home-church` → `alice-home.church`), or null when the
93
+ * label carries no known type suffix. A CANDIDATE — the caller resolves it against the chain. */
94
+ export declare function typedNameForLabel(rest: string): string | null;
95
+ /**
96
+ * The inbound host → the name it projects, for the two shapes ONE base zone serves:
97
+ * `<label>.<zone>` → `<label>-<type>` reads as `<label>.<type>`; otherwise `<label>.<legacyParent>`
98
+ * `<label>.<type>.<zone>` → `<label>.<type>` — the dotted form served until 2026-08-30, kept because cards
99
+ * published under it carry that URL in signed bytes; nothing emits it (`hostForName`).
100
+ * The DNS label is returned RAW as `label`: a label may read BOTH ways (`alice-home-church` is `alice-home.church`
101
+ * and also the legacy `alice-home-church.<legacyParent>`), so the choice belongs to the caller, which resolves an
102
+ * ORDERED candidate set against the chain — one mechanism, ordered candidates, not a fallback (ADR-0013).
103
+ * Apex, deeper nesting, an unknown type level, a reserved label (`www`, `api`, … — rule 3) → null.
104
+ *
105
+ * `name` IS THE TYPED READING WHEN THERE IS ONE, AND THAT IS A HINT (spec 445 / NAME-8). This function is pure; it
106
+ * cannot see that the legacy `<label>.<legacyParent>` is ALSO registered. A router that takes `name` and stops has
107
+ * let a later typed claim take an existing legacy name's host. Route through `confirmDnsHost`, which resolves
108
+ * every reading and refuses when two agents hold one host.
109
+ */
110
+ export declare function parseTypedAgentHost(hostname: string | undefined, zone: string, legacyParent: string): {
111
+ label: string;
112
+ name: string;
113
+ } | null;
114
+ /**
115
+ * The inverse: the public host a deployment serves an on-chain name at. `<label>.<parent>` for any parent in
116
+ * `legacyParents` (the ordered person / legacy roots an estate serves — a list, because an estate mid-migration
117
+ * serves several) → `<label>.<zone>`; `<label>.<tld>` for any other agent type → `<label>-<tld>.<zone>`. Deeper or
118
+ * untyped → null (no host to publish at). A projection of the name, never authority.
119
+ *
120
+ * NULL ALSO MEANS "this name has no host on a shared zone" (spec 445 / NAME-8): a malformed or reserved label
121
+ * (`www.me` is not `www.<zone>`), and a bare-root label ending in `-<type>` (`foo-org.agent` is NOT
122
+ * `foo-org.<zone>` — that is `foo.org`'s host). Never the colliding host.
123
+ */
124
+ export declare function hostForName(name: string, zone: string, legacyParents: readonly string[]): string | null;
125
+ /** One reading of a host: a name it could mean. `projectable` — would `hostForName` put that name at this host? */
126
+ export interface DnsHostReading {
127
+ name: string;
128
+ projectable: boolean;
129
+ }
130
+ /**
131
+ * EVERY name a single-label host under `zone` could mean, in a fixed order: the typed reading (`<label>-<type>`
132
+ * → `<label>.<type>`), then `<label>.<root>` for each bare root. The bare readings of a label that ends in
133
+ * `-<type>` are included with `projectable: false`: this SDK gives them no host, but the chain may hold one
134
+ * (registered before the rule, or by a direct call), and a router has to know to look. Pure. Apex, nesting,
135
+ * a foreign host, a reserved or malformed label → `[]`.
136
+ */
137
+ export declare function dnsHostReadings(hostname: string | undefined, zone: string, bareRoots: readonly string[]): DnsHostReading[];
138
+ /** The read `confirmDnsHost` needs — one `readContract` per name (ADR-0012). `AgentNamingClient` satisfies it. */
139
+ export interface DnsHostReads {
140
+ resolveName(name: string): Promise<Address | null>;
141
+ }
142
+ export type DnsHostConfirmation =
143
+ /** No reading of this host is registered (or the host is not an agent host at all). */
144
+ {
145
+ status: 'none';
146
+ }
147
+ /** Exactly one AGENT holds this host. `names` are the readings that resolve to it (several when one agent
148
+ * holds `alice.me` and `alice.agent`); `name` is the first in reading order; `projectable` is false when the
149
+ * host answers only for a grandfathered bare name the SDK no longer projects. */
150
+ | {
151
+ status: 'confirmed';
152
+ address: Address;
153
+ name: string;
154
+ names: string[];
155
+ projectable: boolean;
156
+ }
157
+ /** Two or more DIFFERENT agents hold names that read as this host. The router refuses; it does not pick. */
158
+ | {
159
+ status: 'ambiguous';
160
+ candidates: Array<{
161
+ name: string;
162
+ address: Address;
163
+ projectable: boolean;
164
+ }>;
165
+ };
166
+ /**
167
+ * Host → agent, CONFIRMED BY RECORDS (spec 445 / NAME-8). Resolves EVERY reading of the host on chain — one
168
+ * mechanism over the whole candidate set, not a first-hit walk (ADR-0013) — and answers:
169
+ * - none registered → `none`
170
+ * - all registered readings resolve to one agent → `confirmed`
171
+ * - two agents → `ambiguous` — a typed claim made after a legacy name of the same host existed
172
+ * (or the reverse) lands here; the existing holder's host stops answering rather than answering as the
173
+ * claimant. That is a denial an operator can see and settle, where a precedence pick was an impersonation.
174
+ * A read that throws propagates: "could not read" is not "not registered".
175
+ */
176
+ export declare function confirmDnsHost(hostname: string | undefined, zone: string, ports: {
177
+ bareRoots: readonly string[];
178
+ reads: DnsHostReads;
179
+ }): Promise<DnsHostConfirmation>;
180
+ /**
181
+ * The on-chain name for an explicit handle (an edge path `POST /api/a2a/<handle>`, an injected subdomain header).
182
+ * A bare label is `<label>.<legacyParent>`; a typed handle (`x.t`, `x.t@c.u`, `c.u/x.t`) or a legacy dotted name
183
+ * is parsed by the grammar. Root and type-node forms name no subject → null. One grammar, no guessing.
184
+ */
185
+ export declare function agentNameForHandle(handle: string, legacyParent: string): string | null;
186
+ //# sourceMappingURL=dns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dns.d.ts","sourceRoot":"","sources":["../src/dns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM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