@dnsid-ai/registry

中文文档
0.37.0发布于 2026/11/12Apache-2.0TypeScriptESM + CJS构建来源已验证近 30 天下载 4666

DNSid registry client and TXT publishing helpers.

原始使用文档
文档目录4 节
  1. Install
  2. Example
  3. Notes
  4. Unified registration and recovery

@dnsid-ai/registry

Registry control-plane client and TXT publishing helpers for DNSid TypeScript packages.

This package owns the current DNSid registry API surface and registry-shaped lifecycle/status behavior. It intentionally keeps registry-specific states separate from protocol-strict @dnsid-ai/protocol agent status types.

Install

npm install @dnsid-ai/registry @dnsid-ai/protocol

Example

import { RegistryClient, publishClientControlledRecord } from '@dnsid-ai/registry';
import { createRegistryClientFromEnvironment } from '@dnsid-ai/sdk/node';

// Local by default: http://127.0.0.1:7755 from `dnsid local up`, no credential.
// Hosted: set DNSID_REGISTRY_URL and DNSID_API_KEY from the console.
const registryClient = await createRegistryClientFromEnvironment();
// Or explicitly: new RegistryClient({ baseUrl, token }). HTTPS required except on loopback.

await publishClientControlledRecord({
  config,
  entityKeyProvider,
  registryClient,
});

Notes

Registry workflow status is kept separate from protocol AgentStatus. Client-controlled identities publish with publishClientControlledRecord(); registry-managed identities use awaitRegistryManagedPublication(), which requires an observed and verified DNS record before succeeding. publishToRegistry() remains as a deprecated compatibility alias.

The client supports self-managed, zone-explicit, and Live registration workflows, authenticated/custom requests, verification/challenge helpers, typed preparation of C2SP issuance and key rotation, record signing, revoke, cancel, unregister, and retire helpers. registerLiveAgent() sets tier: "live" and managed: true internally, requires a separate idempotency key, and returns a distinct proof challenge rather than a normal registration. While challenge_pending, the response includes the assigned domain and validated challenge transcript. Sign the exact bytes decoded from the latest challengeMessage; a reissued challenge supersedes every earlier challenge and message. Preparation returns only untrusted exact response bytes; it does not submit or append them. Before signing, validate issuance against the reference in its signed lr and later events against the identity's verified log reference. The DNSID-Log-Reference response header is ignored. Registry-managed lifecycle operations are single-owner workflows: callers submit through the registry and must not append a duplicate local lifecycle event.

Unified registration and recovery

registerAgent({ publicKeyJwk }, idempotencyKey?) requests an assigned name under the registry's sandbox root without injecting legacy defaults. Optional domain, rootDomain, and governanceDomain select an exact FQDN, caller-owned active root, and expected accountable GI. domain and rootDomain are mutually exclusive. Assigned names require a public key; the registry decides hosting, ownership, admission, and whether an exact-domain request requires a key.

The client validates the creation response's immutable id, domain, and required publication_config, then reads authenticated management status to obtain publicationAuthority. The returned publicationConfig and oidcIssuerUrl are creation snapshots, not values inferred from selectors or replaced by later status defaults. Persist them; they do not grant counterparty trust.

Ordinary registration permits an omitted key. For retry safety, generate and persist the key and registration input before the first attempt, then reuse both for reconciliation. Existing input.idempotencyKey remains supported. Do not generate a fresh key on each retry: the POST may have created an agent even when its response or the subsequent status GET fails. Matching ordinary registration replays still require HTTP 201.

Request/response failures throw RegistrationError with idempotencyKey, the original input and cause, httpStatus and registry code when available, and creation containing any decoded creation facts (including ID, domain, publication configuration, and OIDC issuer). These facts remain untrusted if validation failed. domain is also exposed when parsed. If the domain is known, call getRegistration(error.domain) to recover status without another POST; otherwise replay only with the original key and complete input. Do not retry an unknown creation outcome without a key. Governance-unavailable or input-mismatch errors do not trigger fallback roots, replacement creation, or anonymous reads. An error does not prove creation succeeded or failed. No automatic retries are performed; resolve permanent request errors rather than blindly retrying them.

Automatic managed recovery requires permanent organization-scoped replay claims. Identical low-level key strings in different organizations are independent. Named SDK setup derives keys from organization ID, normalized name, and the initial key thumbprint; the server must validate those bindings before allocation, claim one nonterminal identity per organization/name atomically, and reject conflicting keys/input without mutation or disclosure. Matching hosts open the same immutable identity. Claims survive retirement/deletion: old replay returns the old identity or a terminal error, never a replacement. Explicit replacement uses a fresh key, ID, domain, and log stream, preserving history and rejecting all previously used keys.

getOrganizationOnboarding() reads the existing authenticated /api/v1/org/onboarding endpoint and validates account/GI domains and proof-domain consistency. Pass configured or saved organizationId and governanceId expectations to compare bindings. ready is true only when GI is verified and gate-authorized and entity-key delegation is verified. Missing and pending proofs remain available with ready: false; they must not authorize setup. Discovery does not return an entity JWKS URL or establish counterparty trust. Authorization errors and HTTP 503 remain errors; failed reads are never retried anonymously.

These are required server contracts, not claims of deployed support. Verify them with real server persistence/integration tests before enabling named recovery; the existing expiring store is insufficient, and an acknowledgement flag cannot establish safety.

Key-rotation preparation requires owner credentials: a session cookie or organization API key. An agent bearer token is not accepted.

Registry status semantics are still expected to align with ongoing registry server status work before this API is considered stable.

Legacy selectors environment, managed, and zoneId remain supported; explicit GI/root selectors are sent unchanged for server resolution. registerSelfManagedAgent({ domain }) and registerInZone({ zoneId, publicKeyJwk }) retain their production environment default. An exact domain does not guarantee client-controlled publication. Private JWK members and JWKS-shaped keys are rejected before any request is sent. Client-controlled publication validates every known TXT tag against the effective publication configuration. config.maxKeyAge controls the ka tag; when omitted, the helper expects ka to be omitted. Legacy callers may pass effectiveMaxKeyAge as an explicit override. Callers must configure the effective gi, ek, ku, lr, su, fl, and cu values exactly.

submitPreparedEvent() throws PreparedEventSubmissionError for structured product errors. Only TLOG_SUBMISSION_BUSY and TLOG_SUBMISSION_INDETERMINATE are marked retryable; callers must retain and retry the same idempotency key and exact entry bytes when retryWithSameBytes is true.

版本与发布记录

@dnsid-ai/registry 共发布 22 个版本,首次发布于 2026/09/22;过去 12 个月发布了 22 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.37.0latest2026/11/121 天前
0.36.02026/11/112 天前
0.35.02026/11/067 天前
0.34.02026/10/3014 天前
0.33.02026/10/2815 天前
0.32.02026/10/2716 天前

关于 @dnsid-ai/registry 的常见问题

@dnsid-ai/registry 是什么?

DNSid registry client and TXT publishing helpers.

如何安装 @dnsid-ai/registry?

在项目目录运行 npm install @dnsid-ai/registry,或使用 pnpm add / yarn add / bun add。

@dnsid-ai/registry 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@dnsid-ai/registry 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@dnsid-ai/registry 可以商用吗?

@dnsid-ai/registry 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@dnsid-ai/registry 的下载量有多少?

根据 npm 官方下载统计,@dnsid-ai/registry 在 2026/10/13 – 2026/11/11 这 30 天内被下载 4,666 次,日均约 156 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@dnsid-ai/registry 还在维护吗?

最新版本 0.37.0 发布于 2026/11/12(1 天前);至今共发布 22 个版本,其中过去 12 个月发布了 22 个;首次发布于 2026/09/22。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。