[![logo][]](https://xyo.network)

# @xyo-network/xl1-system-status

[![npm-badge][]][npm-link]
[![license-badge][]][license-link]

> Console and HTTP system-status publishers for XL1 services.

## Description

XL1 is the XYO Layer One blockchain protocol. This package publishes
`SystemStatusRunner` state to operational sinks: console logs and HTTP health
endpoints.

It does not own the status model itself. The runner, viewer, and protocol
interfaces live in `@xyo-network/xl1-protocol/protocol-lib`.

## Install

Using npm:

```sh
npm i --save @xyo-network/xl1-system-status
```

Using yarn:

```sh
yarn add @xyo-network/xl1-system-status
```

Using pnpm:

```sh
pnpm add @xyo-network/xl1-system-status
```

Using bun:

```sh
bun add @xyo-network/xl1-system-status
```

## Usage

Publish status to Kubernetes-style HTTP probes:

```ts
import { HttpSystemStatusPublisher } from '@xyo-network/xl1-system-status'

const publisher = new HttpSystemStatusPublisher(statusRunner, { port: 8081 })

await publisher.start()
```

Available HTTP endpoints:

- `/healthz` - 200 when global status is `started`.
- `/livez` - 200 while the process is running.
- `/readyz` - 200 when ready, 503 during startup or shutdown.
- `/status` - JSON status snapshot.

## Documentation

Exports include:

- `ConsoleSystemStatusPublisher` - logs global status transitions.
- `HttpSystemStatusPublisher` - serves health endpoints and logs transitions.
- `resolveStatusProbe` - pure probe routing helper for tests and alternate servers.

Publishers are plain start/stop observers. They do not report their own
lifecycle into the runner, so they cannot make `/healthz` pass before the real
service stack has started.

## AI Agent Skills

Install the recommended XL1/XYO skills with [Skills.sh](https://skills.sh):

```sh
npx skills add XYOracleNetwork/xyo-skills --all
```

In XY toolchain repos, the equivalent convenience command is:

```sh
pnpm xy skills defaults
pnpm xy skills lint --fix
```

For XL1 work, ask your agent to use `xyo-knowledge`, `xl1-knowledge`, and
`xl1-patterns`. These skills cover XYO primitives, XL1 chain and gateway APIs,
and application patterns for XL1 dApps.

## Building Locally

```sh
pnpm xy build @xyo-network/xl1-system-status
pnpm xy test @xyo-network/xl1-system-status
pnpm xy lint @xyo-network/xl1-system-status
```

## License

See the [LICENSE](./LICENSE) file for license rights and limitations
(LGPL-3.0-only).

## Credits

[Made with 🔥 and ❄️ by XYO Foundation](https://xyo.network)

[npm-badge]: https://img.shields.io/npm/v/@xyo-network/xl1-system-status.svg
[npm-link]: https://www.npmjs.com/package/@xyo-network/xl1-system-status
[license-badge]: https://img.shields.io/npm/l/@xyo-network/xl1-system-status.svg
[license-link]: ./LICENSE
[logo]: https://cdn.xy.company/img/brand/XYO_full_colored.png
