open-index/open-npm huggingface dataset:
npm package: @kairos28/hive-protocol
Description: Universal message envelope for KAIROS agent ecosystem
Latest version: 0.1.0

# @kairos/hive-protocol

Universal message envelope for the KAIROS agent ecosystem — typed, traceable, domain-tagged envelopes for multi-agent communication.

## Features

- **Typed envelopes** — `event | command | query | response | heartbeat`
- **Domain layers** — `infrastructure | agent | communication | business | world`
- **Trace chains** — link related messages across distributed workflows
- **Priority + TTL** — priority 0–9, optional expiry in seconds
- **Zero runtime dependencies** — pure TypeScript, ships ESM + CJS + `.d.ts`

## Install

```bash
npm install @kairos/hive-protocol
```

## Usage

```ts
import { createEnvelope, validateEnvelope, filterByDomain } from '@kairos/hive-protocol';

// Create a typed envelope
const envelope = createEnvelope({
  from: 'falcon',
  to: 'kairos',
  type: 'event',
  domain: 'agent',
  payload: { status: 'healthy', uptime: 99.9 },
});

// Validate an incoming message
const result = validateEnvelope(rawMessage);
if (result.ok) {
  console.log(result.envelope);
}

// Filter a stream by domain
const agentMessages = filterByDomain(envelopes, 'agent');
```

## Envelope Schema

```ts
interface Envelope {
  id: string;        // UUID v7 (time-sortable)
  ts: string;        // ISO 8601 timestamp
  from: string;      // Source: "falcon", "ollama", "hive-governor"
  to: string;        // Target: "kairos", "*" (broadcast), "cell:intelligence"
  type: EnvelopeType;
  domain: EnvelopeDomain;
  pri: number;       // Priority 0 (background) to 9 (critical)
  ttl: number;       // Seconds until expiry. 0 = no expiry
  trace: string;     // Links related messages across a workflow
  payload: unknown;
}
```

## API

### `createEnvelope(partial)`

Creates a valid envelope with auto-generated `id`, `ts`, and `trace` if not provided.

### `validateEnvelope(raw)`

Returns `{ ok: true, envelope }` or `{ ok: false, errors: string[] }`.

### `filterByDomain(envelopes, domain)`

Filters an envelope array to a specific domain layer.

### `groupByTrace(envelopes)`

Groups envelopes by their `trace` field — useful for reconstructing workflows.

### `getTraceChain(envelopes, traceId)`

Returns all envelopes belonging to a trace, sorted by timestamp.

## Domain Layers

| Domain | Use |
|--------|-----|
| `infrastructure` | Services, healthchecks, resource metrics |
| `agent` | Agent status, task events |
| `communication` | Telegram, Discord, voice |
| `business` | Revenue, spend, pipeline events |
| `world` | External integrations, APIs |

## License

Apache-2.0 — see [LICENSE](./LICENSE)
npm package: @kairos28/hive-runtime
Description: TypeScript SDK for KAIROS hive-runtime — WebSocket client, types, and utilities
Latest version: 0.1.0

# hive-runtime

Go binary — KAIROS event bus, resource governor, cascade engine, and health checker.

> **Status:** Production on VPS (`/root/hive/`). This directory is the open-source scaffold — the full binary ships separately.

## Architecture

```
hive-runtime/
├── cmd/hive/          Entry point (main.go)
├── internal/
│   ├── bus/           Event bus — envelope routing, fan-out
│   ├── governor/      Resource governor — RAM/CPU contracts
│   ├── cascade/       Cascade engine — BGP flap dampening, fallbacks
│   ├── health/        Health checker — 11 services, 5-second intervals
│   └── api/           WebSocket server (port 8765), HTTP health endpoint
└── cascade.toml       Service topology + cascade rules
```

## Specs

- **Binary size:** ~9.4 MB
- **Runtime RAM:** ~4 MB
- **WebSocket:** `127.0.0.1:8765` (nginx proxy: `/hive/ws`)
- **Envelope format (FROZEN):** `{id, from, to, type, priority, timestamp, payload}`

## Subsystems

### Event Bus
Routes envelopes between subsystems. Fan-out to all WebSocket clients on every envelope. Typed channels per domain layer (see `@kairos/hive-protocol`).

### Resource Governor
Reads `/proc/meminfo`, `/proc/stat` every 2 seconds. Tracks per-service RSS vs memory contracts. Emits `metric` envelopes when thresholds are crossed.

### Cascade Engine
State machine with 5 states: `nominal → degraded → cascade → recovering → recovered`. BGP flap dampening per [RFC 2439](https://datatracker.ietf.org/doc/html/rfc2439). Budget ceilings: `$1/h`, `$5/d`. Defined in `cascade.toml`.

### Health Checker
Polls 11 services every 5 seconds. Emits `heartbeat` envelopes. Colors topology graph nodes in the dashboard.

## cascade.toml

```toml
[service.groq_free]
priority = 1
budget_hourly_usd = 1.0

[service.ollama_local]
priority = 2
budget_hourly_usd = 0.0

[[cascade]]
name = "llm_inference"
primary = "groq_free"
fallback = "ollama_local"
trigger = "budget_exceeded"
```

## Dashboard Integration

The dashboard connects via `useHiveBus.ts` (WebSocket auto-reconnect with exponential backoff). Pages that use it:

- **Topologia** — 3D force graph, 23 nodes (11 services + 12 agents), health coloring
- **Presion** — RAM treemap per service, contract bars, governor metrics
- **Cascades** — Service state log, transition history, flap dampening
- **Timeline Hive** — Live envelope stream (filterable, pauseable)
- **Financiero** — LiteLLM spend, daily budget bar ($5/d)
- **Omniscient** — Unified 3x2 grid of all Omniscient views

## Building (Go 1.22+)

```bash
cd packages/hive-runtime
go build -o hive ./cmd/hive
```

## Systemd

```ini
[Unit]
Description=KAIROS Hive Runtime
After=network.target

[Service]
ExecStart=/root/hive/hive
Restart=always
OOMScoreAdjust=-500

[Install]
WantedBy=multi-user.target
```

## License

Apache-2.0 — see [LICENSE](./LICENSE)
npm package: @kairos28/particles
Description: GPU particle engine — WebGL shaders + React Three Fiber
Latest version: 0.1.0

# @kairos/particles

GPU particle engine for React Three Fiber — adaptive breathing, emergent geometry, and multi-shape WebGL shaders.

## Features

- **Adaptive breathing** — particle field breathes at 0.3–2.0 Hz based on real system load and RAM usage
- **Emergent geometry** — nodes cluster into geometric shapes driven by live data metrics
- **Multiple shapes** — sphere, cube, torus, DNA helix
- **4D Clifford rotation** — organs turn inside-out organically in the organism view
- **Zero dependencies beyond peer deps** — ships as ESM + CJS with full TypeScript types

## Install

```bash
npm install @kairos/particles
```

Peer dependencies:
```bash
npm install react react-dom three @react-three/fiber @react-three/drei
```

## Usage

```tsx
import { ParticleField, ParticleGraph } from '@kairos/particles';

// Basic adaptive breathing field
function Scene() {
  return (
    <Canvas>
      <ParticleField
        count={4000}
        size={0.015}
        systemLoad={65}   // 0-100: drives breath frequency
        ramPercent={42}   // 0-100: drives breath amplitude
      />
    </Canvas>
  );
}
```

```tsx
// Graph with emergent clusters
import { ParticleGraph } from '@kairos/particles';

function GraphScene({ nodes, edges }) {
  return (
    <Canvas>
      <ParticleGraph
        nodes={nodes}
        edges={edges}
        particleCount={2000}
        seed={42}
      />
    </Canvas>
  );
}
```

## API

### `ParticleField`

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `count` | `number` | `4000` | Number of particles |
| `size` | `number` | `0.015` | Point size |
| `systemLoad` | `number` | `0` | CPU load 0–100 → breath frequency |
| `ramPercent` | `number` | `0` | RAM % 0–100 → breath amplitude |

### `ParticleGraph`

Renders a force-directed graph as a particle system with emergent geometric clustering.

### Geometry utilities

```ts
import { sphere, cube, torus, dna, generatePositions } from '@kairos/particles';
import { generateEmergentPositions, calculateParticleCount } from '@kairos/particles';
```

## License

Apache-2.0 — see [LICENSE](./LICENSE)
npm package: @kairos_ds/buttons-language
Description: Lit-Element webcomponent buttons-language
Author: KairosDS Team
Latest version: 1.0.0

# buttons-language

Lit-Element web component description

## Demo

```
<h2>Basic buttons-language Demo</h2>
<h3>Demo</h3>
<buttons-language></buttons-language>

```
<!---
```
<custom-element-demo>
  <template>
    <link rel="import" href="buttons-language.html">
    <next-code-block></next-code-block>
  </template>
</custom-element-demo>
```
-->
```html
<buttons-language></buttons-language>

```
## Install the Polymer-CLI

First, make sure you have the [Polymer CLI](https://www.npmjs.com/package/polymer-cli) and npm (packaged with [Node.js](https://nodejs.org)) installed. Run `npm install` to install your element's dependencies, then run `polymer serve` to serve your element locally.

## Viewing Your Element

```
$ npm run start
```

## Running Tests

```
$ npm run test
```

## Build
```
$ npm run build
```

Your application is already set up to be tested via [web-component-tester](https://github.com/Polymer/web-component-tester). Run `polymer test` to run your application's test suite locally.

##Author
**KairósDS Team**

## License

This project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details