Admin
Operate Runtime Hosts and Tenants with @nylorun/admin.
@nylorun/admin is the operator client for Host status and Tenant lifecycle.
Application backends that only run agents use @nylorun/agents instead.
import { createAdmin } from "@nylorun/admin";
const admin = createAdmin();
const status = await admin.status();
const { tenant, applicationKey } = await admin.createTenant({ name: "my-app" });
await admin.listTenants();
await admin.getTenant(tenant.id);
await admin.deleteTenant(tenant.id, { activeWork: "refuse" });Persist the returned applicationKey: the Host stores only its hash and cannot
return the cleartext value later. createTenant generates its Tenant id,
principal, key, and idempotency key locally and retries transient failures with
the same values.
Connection resolution
createAdmin() resolves in this order:
- Explicit
createAdmin({ url, key }). NYLORUN_ADMIN_URLplusNYLORUN_ADMIN_KEY.- Local
host.jsonandhost-credentials.jsonunderNYLORUN_HOMEor~/.nylorun.
Use createAdmin({ home }) to select another local Host root. On POSIX, local
Host credentials must be owned by the current user and not be group- or
world-readable.
Methods
| Method | Admin route | Purpose |
|---|---|---|
status() | GET /v1/admin/status | Read Host version, protocol, readiness, and Tenant summary. |
listTenants() | GET /v1/admin/tenants | List known Tenant envelopes and state. |
getTenant(id) | GET /v1/admin/tenants/:id | Inspect one Tenant. |
createTenant({ name }) | POST /v1/admin/tenants | Create a Tenant and its first application principal. |
deleteTenant(id, { activeWork }) | DELETE /v1/admin/tenants/:id | Refuse, drain, or cancel active work according to operator policy. |
Host shutdown is launcher-private and is not part of the shared Admin API.
Errors and compatibility
The client checks /health once and sends Nylorun-Protocol. Incompatible
Hosts fail before an admin operation. Failures are AdminError instances with
a registry code; the package re-exports ERROR_CODES, PROTOCOL_FEATURES,
and compareVersions.
See Runtime reference for the Tenant API and Environment for connection variables.