open-index/open-npm huggingface dataset:
npm package: @silverwind/vue-tsc
Description: Install: `npm i vue-tsc -D`
Latest version: 2.1.13

# vue-tsc

Install: `npm i vue-tsc -D`

Usage: `vue-tsc --noEmit && vite build`

Vue 3 command line Type-Checking tool base on IDE plugin [Volar](https://github.com/vuejs/language-tools).

Roadmap:

- [x] Type-Checking with `--noEmit`
- [x] Use released LSP module
- [x] Make `typescript` as peerDependencies
- [x] Cleaner dependencies (remove `prettyhtml`, `prettier` etc.) (with `vscode-vue-languageservice` version >= 0.26.4)
- [x] dts emit support
- [x] Watch mode support

## Usage

Type check:

`vue-tsc --noEmit`

Build dts:

`vue-tsc --declaration --emitDeclarationOnly`

Check out https://github.com/vuejs/language-tools/discussions/640#discussioncomment-1555479 for example repo.

## Sponsors

<p align="center">
  <a href="https://cdn.jsdelivr.net/gh/johnsoncodehk/sponsors/sponsors.svg">
    <img src="https://cdn.jsdelivr.net/gh/johnsoncodehk/sponsors/sponsors.svg"/>
  </a>
</p>
npm package: @silverwind/vue3-calendar-heatmap
Description: A lightweight calendar heatmap Vue 3 component built on SVG, inspired by julienr114's vue-calendar-heatmap ans github's contribution calendar graph
Author: Volker Nauruhn
Latest version: 2.1.1

# vue3-calendar-heatmap

![](https://user-images.githubusercontent.com/684302/142281760-eaeccf78-5cc8-450d-8407-6208aafb63a2.png)

[![npm](https://img.shields.io/npm/v/vue3-calendar-heatmap.svg?style=flat-square)](https://www.npmjs.com/package/vue3-calendar-heatmap)
[![npm](https://img.shields.io/npm/dm/vue3-calendar-heatmap?style=flat-square)](https://www.npmjs.com/package/vue3-calendar-heatmap)
[![size](https://img.shields.io/bundlephobia/minzip/vue3-calendar-heatmap?label=size&style=flat-square)](https://www.npmjs.com/package/vue3-calendar-heatmap)
[![TypeScript](https://img.shields.io/badge/-Typescript-informational?style=flat-square)](https://www.typescriptlang.org/)
[![vue2](https://img.shields.io/badge/vue-3.x-brightgreen.svg?style=flat-square)](https://vuejs.org/)

A lightweight calendar heatmap Vuejs component built on SVG, inspired by github's contribution calendar graph. With vertical mode, tooltip powered
by [Tippy.js](https://github.com/atomiks/tippyjs).

## Documentation

[https://razorness.github.io/vue3-calendar-heatmap](https://razorness.github.io/vue3-calendar-heatmap)

## Examples

![](https://user-images.githubusercontent.com/684302/142281986-17d96753-dfd9-41e0-baf7-f411cec32167.png)
![](https://user-images.githubusercontent.com/684302/142281712-8cdaf65e-221d-413c-b367-f4c43f2fe98b.png)


## License

[MIT](http://opensource.org/licenses/MIT)
npm package: @silvery/ag
Description: Core types and infrastructure for silvery (internal — use silvery instead)
Author: Bjørn Stabell
Latest version: 0.5.0

# @silvery/ag

Core types and infrastructure for silvery (internal package).

> **Note:** This is an internal package. Use [`silvery`](https://github.com/beorn/silvery) instead.

```console
$ npm install silvery
```
npm package: @silvery/ag-react
Description: Core React reconciler and runtime for silvery (internal — use silvery instead)
Author: Bjørn Stabell
Latest version: 0.5.0

# @silvery/ag-react

Core React reconciler and runtime for silvery (internal package).

> **Note:** This is an internal package. Use [`silvery`](https://github.com/beorn/silvery) instead.

```console
$ npm install silvery
```
npm package: @silvery/ag-term
Description: Terminal rendering target for silvery (internal — use silvery instead)
Author: Bjørn Stabell
Latest version: 0.5.0

# @silvery/ag-term

Terminal rendering target for silvery (internal package).

> **Note:** This is an internal package. Use [`silvery`](https://github.com/beorn/silvery) instead — it re-exports the public API via `silvery/runtime`.

```console
$ npm install silvery
```
npm package: @silvery/create
Description: App composition and state management for silvery
Author: Bjørn Stabell
Latest version: 0.5.1

# @silvery/create

App composition for silvery — `pipe()`, providers, TEA store, and structured state management.

```console
$ npm install @silvery/create
```

## pipe() Composition

`pipe()` composes providers left-to-right. Each provider is a function `(app) => enhancedApp` that adds one capability — terminal I/O, React rendering, focus navigation, mouse dispatch, etc.

```typescript
import { pipe, createApp, withReact, withTerminal, withFocus, withDomEvents } from '@silvery/create'

const app = pipe(
  createApp(store),
  withReact(<Board />),
  withTerminal(process),
  withFocus(),
  withDomEvents(),
)
await app.run()
```

The `AppPlugin<A, B>` type is just `(app: A) => B`. TypeScript infers the accumulating type through the chain.

### Built-in Providers

All follow the `with-*` naming convention (file) / `with*` (export):

| Provider                | What                                                   |
| ----------------------- | ------------------------------------------------------ |
| `withApp()`             | Domain state registry, command tree, keymaps           |
| `withReact(element)`    | React reconciler mount, virtual buffer                 |
| `withRender(term)`      | Render pipeline from term capabilities                 |
| `withTerminal(process)` | Terminal I/O — alternate screen, raw mode, resize      |
| `withFocus()`           | Tab/Shift+Tab/Escape focus navigation                  |
| `withDomEvents()`       | Mouse dispatch — hit testing, bubbling, click-to-focus |
| `withDiagnostics()`     | Debug overlays — incremental vs fresh render checks    |
| `withLinks()`           | Hyperlink event routing                                |

### Why `with-*`?

The prefix makes providers instantly recognizable in imports and `pipe()` chains. It reads naturally: "create an app _with_ terminal, _with_ focus, _with_ mouse events." File names use kebab-case (`with-dom-events.ts`); exports use camelCase (`withDomEvents`).

## TEA Store

Optional structured state management for complex apps — pure `(action, state) -> [state, effects]` with serializable actions and effects. See the [silvery docs](https://silvery.dev/guide/runtime-layers) for full TEA store documentation.
npm package: @silvery/ink
Description: Ink and Chalk API compatibility layer (not published separately)
Author: Bjørn Stabell
Latest version: 0.5.0

# @silvery/ink

Ink and Chalk API compatibility layer for migrating existing Ink applications to silvery.

> **Note:** This is an internal package. Use `silvery/ink` and `silvery/chalk` imports instead.

```console
$ npm install silvery
```

```tsx
import { render, Box, Text } from "silvery/ink"
import chalk from "silvery/chalk"
```
npm package: @silvery/test
Description: Testing utilities for silvery — virtual renderer, locators, assertions
Author: Bjørn Stabell
Latest version: 0.5.1

# @silvery/test

Testing utilities for silvery — virtual renderer, locators, and assertions.

```console
$ npm install @silvery/test
```

```tsx
import { createTermless } from "@silvery/test"
import { run } from "silvery/runtime"

using term = createTermless({ cols: 80, rows: 24 })
const handle = await run(<App />, term)

expect(term.screen).toContainText("Hello")
await handle.press("j")
```
npm package: @silvery/theme
Description: Theming system with semantic color tokens for silvery (internal — use silvery/theme instead)
Author: Bjørn Stabell
Latest version: 0.5.0

# @silvery/theme

Theming system with semantic color tokens and 38 palettes for silvery (internal package).

> **Note:** This is an internal package. Use `silvery/theme` imports instead.

```console
$ npm install silvery
```

```tsx
import { ThemeProvider, useTheme } from "silvery/theme"
```
npm package: @silvestre/cjk-unihan
Description: Node.js interface to Unihan database of CJK characters
Author: Jarrod Linahan
Latest version: 0.0.3-4

## cjk-unihan
[![npm version](https://badge.fury.io/js/cjk-unihan.svg)](https://www.npmjs.com/package/cjk-unihan)

Simple interface to Unihan database for Node.js. Created for use on [HanziPal](https://www.hanzipal.com) & available on [NPM](https://www.npmjs.com/package/cjk-unihan)

This library comes with:
  - The simple to use node.js module for query Unihan data
  - An SQLite3 database populated with data from the Unihan database
  - Perl/bash scripts to generate said database, should you wish to update it, etc

## Usage
````javascript
var cjk_unihan = require("cjk-unihan");

// Query a single field for a specified character
cjk_unihan.get("我", "kTotalStrokes", function(err, result){
  console.log("Single field lookup all done:", result);
  // Single field lookup all done: 7
});

// Get all available information about a character
cjk_unihan.get("我", function(err, result){
  console.log("Full lookup all done:", result);
  // Full lookup all done: { character: '我',
  //   SUnicode: '62.3',
  //   kIRGKangXi: '0412.010',
  //   ...
  //   ...
  // }
});
````

## Generating a fresh SQLite3 database
````bash
cd parser

# parser/data should contain a file which contains all the concatenated files downloaded from http://www.unicode.org/Public/UCD/latest/
# This file should be sorted by the first column, otherwise shit will break.

perl parse.pl < data/Unihan.sorted.txt > unihan.parsed

# Then we run the shell script to recreate the database file
create_db.sh
````

After this we should be set to go.
Ideally I will wrap this all up in some simple package that will download the latest copy from the web and automate all this fiddling around

## TODO
  - Tidy up database generation scripts
  - Automate download, concatenation, sorting of downloaded unihan txt files
  - Tests would be nice. Real ones and such
  - Tidy up the format of some data stored (Should currently be a 1:1 dump of the Unihan data)
    - ie, kHanyuPinyin should probably return an array of monosyllabic pronunciations, the rest of this field can be ignored when inserting to database
    - etc etc

# Danger, Will Robinson!
It's very early days here. I'm sure there was another module that I used to use for this purpose, but I can't find it for the life of me so here this is.
I expect the API calls to remain much the same as I work on this - it's a simple wrapper around a database to 'get' certain information, and doesn't need to do anything more.

The data returned however will be tidied up, change, prodded, poked, tweaked and modified until I am happier with it. If this happens I will increment version numbers accordingly, but I thought I'd add the Buyer Beware sticker before putting this out in the world.
npm package: @silvio2402/elysia
Description: Ergonomic Framework for Human
Author: saltyAom
Latest version: 0.7.32

<br>
<p align=center>
  <img width=480 src=https://user-images.githubusercontent.com/35027979/205498891-b75dc404-3232-4929-b216-823aa7373b71.png alt='Elysia label' />
</p>

<p align=center>Ergonomic Framework for Humans</p>

<p align=center>
    <a href=https://elysiajs.com>Documentation</a> | <a href=https://discord.gg/eaFJ2KDJck>Discord</a>
</p>

## Philosophies
Building on top of 3 philosophies:

- Performance
    - You shall not worry about the underlying performance
- Simplicity
    - Simple building blocks to create an abstraction, not repeating yourself
- Flexibility
    - You shall be able to customize most of the library to fit your needs

Designed with TypeScript in mind, you don't need to understand TypeScript to gain the benefit of TypeScript with Elysia. The library understands what you want and automatically infers the type from your code.

⚡️ Elysia is [one of the fastest Bun web frameworks](https://github.com/SaltyAom/bun-http-framework-benchmark)

## Documentation
The documentation is available on [elysiajs.com](https://elysiajs.com).

## Contributing
See [Contributing Guide](CONTRIBUTING.md) and please follow our [Code of Conduct](CODE_OF_CONDUCT.md).

## Discord
Come join the [Discord channel~](https://discord.gg/eaFJ2KDJck)
npm package: @silvio2402/kml-to-geojson
Description: Convert KML content to GeoJSON, preserving style and folder data
Author: Kyle Rummens
Latest version: 1.1.17

# kml-to-geojson

Convert KML content to GeoJSON, preserving style and folder data

## Installation

```
npm install kml-to-geojson
```

This project was built in Typescript, so typing is supported out of the box

## Usage

```typescript
import { KmlToGeojson } from "kml-to-geojson";
import * as fs from "fs";

const kmlToGeojson = new KmlToGeojson();
const kmlContent = fs.readFileSync("./my-file.kml", "utf-8");

const { folders, geojson } = kmlToGeojson.parse(kmlContent);
```
npm package: @silviu123/design-system
Description: Una librería modular de componentes CSS con variables de color
Author: Tu Nombre
Latest version: 1.0.0

# Design System

Una librería modular de componentes CSS con variables de color personalizables.

## Instalación

```bash
npm install @tuusuario/design-system
```

## Uso

1. Importa los estilos en tu proyecto:

```javascript
// Si usas un bundler (webpack, parcel, etc)
import '@tuusuario/design-system';

// O en tu HTML
<link rel="stylesheet" href="node_modules/@tuusuario/design-system/dist/index.css">
```

2. Usa los componentes en tu HTML:

```html
<button class="btn btn-primary">Botón Primario</button>
<div class="card">
  <h2>Título de la tarjeta</h2>
  <p>Contenido...</p>
</div>
```

## Personalización

Puedes sobrescribir las variables CSS para personalizar los colores y otros valores:

```css
:root {
  --color-primary: #your-color;
  --color-secondary: #your-color;
  /* ... */
}
```

## Componentes Disponibles

- Botones (`.btn`, `.btn-primary`, `.btn-secondary`)
- Tarjetas (`.card`)
- Campos de entrada (`.input`)
- Layout Grid (`.layout-grid`)
- Utilidades Flex (`.flex`, `.flex-col`, `.gap-*`)

## Licencia

MIT
npm package: @silviu123/react-design-system
Description: Una librería de componentes React con estilos personalizables
Author: Tu Nombre
Latest version: 1.0.0

# Design System

Una librería modular de componentes CSS con variables de color personalizables.

## Instalación

```bash
npm install @tuusuario/design-system
```

## Uso

1. Importa los estilos en tu proyecto:

```javascript
// Si usas un bundler (webpack, parcel, etc)
import '@tuusuario/design-system';

// O en tu HTML
<link rel="stylesheet" href="node_modules/@tuusuario/design-system/dist/index.css">
```

2. Usa los componentes en tu HTML:

```html
<button class="btn btn-primary">Botón Primario</button>
<div class="card">
  <h2>Título de la tarjeta</h2>
  <p>Contenido...</p>
</div>
```

## Personalización

Puedes sobrescribir las variables CSS para personalizar los colores y otros valores:

```css
:root {
  --color-primary: #your-color;
  --color-secondary: #your-color;
  /* ... */
}
```

## Componentes Disponibles

- Botones (`.btn`, `.btn-primary`, `.btn-secondary`)
- Tarjetas (`.card`)
- Campos de entrada (`.input`)
- Layout Grid (`.layout-grid`)
- Utilidades Flex (`.flex`, `.flex-col`, `.gap-*`)

## Licencia

MIT
npm package: @silvmind/ops-ui
Description: ops-ui
Latest version: 1.0.23

# ops-ui

[![NPM version](https://img.shields.io/npm/v/ops-ui.svg?style=flat)](https://npmjs.com/package/ops-ui)
[![NPM downloads](http://img.shields.io/npm/dm/ops-ui.svg?style=flat)](https://npmjs.com/package/ops-ui)

## Install

```bash
$ pnpm install
```

```bash
$ npm run dev
$ npm run build
```

## Options

TODO

## LICENSE

MIT
npm package: @silyze/async-audio-format-alaw
Description: A-law format for @silyze/async-audio-stream
Author: Mihail Mojsoski
Latest version: 1.0.0

# Async Audio Format A‑law (G.711)

`@silyze/async-audio-format-alaw` adds **A‑law (G.711) support** to the \
[`@silyze/async-audio-stream`](https://www.npmjs.com/package/@silyze/async-audio-stream) \
ecosystem.  
It performs in‑memory conversion between 8‑bit A‑law and 16‑bit little‑endian PCM, \
streaming‑friendly and fully async.

---

## Install

```bash
npm install @silyze/async-audio-format-alaw
```

> Depends on [`alawmulaw`](https://www.npmjs.com/package/alawmulaw) for the actual codec maths (bundled as a normal dependency).

---

## Usage

```ts
import ALawFormat from "@silyze/async-audio-format-alaw";

// Typically, G.711 A‑law telephony audio is 8 kHz mono:
const format = new ALawFormat(8000);

// Encode raw PCM → A‑law:
const alawStream = format.encode(pcmStream);

// Decode A‑law → raw PCM:
const pcmStream = format.decode(alawStream);
```

---

## Available Format

| Class         | Container | Codec     | Channels | Notes                                 |
| ------------- | --------- | --------- | -------- | ------------------------------------- |
| `ALawFormat`  | Raw bytes | **A‑law** | Mono     | Bidirectional encode / decode streams |

### API

```ts
class ALawFormat extends AudioFormat {
  constructor(sampleRate: number); // e.g. 8000

  readonly name: string; // "alaw"
  readonly pcmSampleRate: number; // constructor value

  /** PCM‑16‑LE → A‑law (8‑bit) */
  encode(input: AsyncReadStream<Buffer>): AsyncReadStream<Buffer>;

  /** A‑law (8‑bit) → PCM‑16‑LE */
  decode(input: AsyncReadStream<Buffer>): AsyncReadStream<Buffer>;
}
```

Both `encode()` and `decode()` are implemented with the \
[`alawmulaw`](https://www.npmjs.com/package/alawmulaw) library (using its `alaw` codec) \
and run inside stream `map()` transforms, so they start processing as soon as data arrives.

---

## Implementation Notes

- **Sample‑rate‑agnostic** – although typical G.711 A‑law telephony audio is 8 kHz, you \
  may instantiate `ALawFormat` with any sample rate if your pipeline uses \
  different values.
- **Lossy** – A‑law is a companded 8‑bit representation; converting back to PCM \
  cannot fully restore the original 16‑bit dynamic range.
npm package: @silyze/async-audio-format-pcm
Description: Raw PCM format for @silyze/async-audio-stream
Author: Mihail Mojsoski
Latest version: 1.0.0

# Async Audio Format PCM

**Raw PCM audio format** (`pcm16le`) for [`@silyze/async-audio-stream`](https://www.npmjs.com/package/@silyze/async-audio-stream).  
Zero processing, zero latency — ideal for pipelines that already work with 16-bit little-endian PCM.

---

## Install

```bash
npm install @silyze/async-audio-format-pcm
```

---

## Usage

```ts
import PcmFormat from "@silyze/async-audio-format-pcm";

// Use for raw PCM audio at 16 kHz:
const format = new PcmFormat(16000);

console.log(format.name); // "pcm16le"
console.log(format.pcmSampleRate); // 16000
```

Both `encode()` and `decode()` are pass-throughs. No conversion is applied.

---

## API

```ts
class PcmFormat extends AudioFormat {
  constructor(sampleRate: number);

  readonly name: string; // "pcm16le"
  readonly pcmSampleRate: number;

  encode(input: AsyncReadStream<Buffer>): AsyncReadStream<Buffer>;
  decode(input: AsyncReadStream<Buffer>): AsyncReadStream<Buffer>;
}
```

---

## Format Details

- **Encoding:** 16-bit signed little-endian PCM
- **Channels:** Mono (1 channel)
- **Sample Rate:** User-defined at instantiation
- **Streaming:** Fully async (via `@mojsoski/async-stream`)
npm package: @silyze/async-audio-format-ulaw
Description: μ-law format for @silyze/async-audio-stream
Author: Mihail Mojsoski
Latest version: 1.0.1

# Async Audio Format µ‑law (G.711)

`@silyze/async-audio-format-ulaw` adds **µ‑law (G.711) support** to the \
[`@silyze/async-audio-stream`](https://www.npmjs.com/package/@silyze/async-audio-stream) \
ecosystem.  
It performs in‑memory conversion between 8‑bit µ‑law and 16‑bit little‑endian PCM, \
streaming‑friendly and fully async.

---

## Install

```bash
npm install @silyze/async-audio-format-ulaw
```

> Depends on [`alawmulaw`](https://www.npmjs.com/package/alawmulaw) for the actual codec maths (bundled as a normal dependency).

---

## Usage

```ts
import ULawFormat from "@silyze/async-audio-format-ulaw";

// Typically, µ‑law is 8 kHz mono:
const format = new ULawFormat(8000);

// Encode raw PCM → µ‑law:
const ulawStream = format.encode(pcmStream);

// Decode µ‑law → raw PCM:
const pcmStream = format.decode(ulawStream);
```

---

## Available Format

| Class        | Container | Codec     | Channels | Notes                                 |
| ------------ | --------- | --------- | -------- | ------------------------------------- |
| `ULawFormat` | Raw bytes | **µ‑law** | Mono     | Bidirectional encode / decode streams |

### API

```ts
class ULawFormat extends AudioFormat {
  constructor(sampleRate: number); // e.g. 8000

  readonly name: string; // "ulaw"
  readonly pcmSampleRate: number; // constructor value

  /** PCM‑16‑LE → µ‑law (8‑bit) */
  encode(input: AsyncReadStream<Buffer>): AsyncReadStream<Buffer>;

  /** µ‑law (8‑bit) → PCM‑16‑LE */
  decode(input: AsyncReadStream<Buffer>): AsyncReadStream<Buffer>;
}
```

Both `encode()` and `decode()` are implemented with the \
[`alawmulaw`](https://www.npmjs.com/package/alawmulaw) library and run inside \
stream `map()` transforms, so they start processing as soon as data arrives.

---

## Implementation Notes

- **Sample‑rate‑agnostic** – although typical µ‑law telephony audio is 8 kHz, you \
  may instantiate `ULawFormat` with any sample rate if your pipeline uses \
  different values.
- **Lossy** – µ‑law is a companded 8‑bit representation; converting back to PCM \
  cannot fully restore the original 16‑bit dynamic range.
npm package: @silyze/async-audio-format-wav
Description: WAV format for @silyze/async-audio-stream
Author: Mihail Mojsoski
Latest version: 1.0.0

# Async Audio Format WAV

`@silyze/async-audio-format-wav` provides a **WAV (RIFF) wrapper** around raw 16‑bit little‑endian PCM for use with [`@silyze/async-audio-stream`](https://www.npmjs.com/package/@silyze/async-audio-stream).

- Adds a **minimal 44‑byte WAV header** in‑place as the stream starts.
- Keeps the rest of the data untouched & streaming‑friendly (no file‑length seek).
- Perfect when you need a quick WAV stream for players, APIs, or debugging.

---

## Install

```bash
npm install @silyze/async-audio-format-wav
```

> No external dependencies — everything is pure TypeScript.

---

## Usage

```ts
import WavFormat from "@silyze/async-audio-format-wav";

// Create a WAV format for 16 kHz mono PCM:
const format = new WavFormat(16000);

console.log(format.name); // "wav-pcm"
console.log(format.pcmSampleRate); // 16000

// Encode a raw PCM AsyncReadStream<Buffer> to WAV on‑the‑fly:
const wavStream = format.encode(pcmStream);
```

---

## Available Format

| Class       | Container | Codec     | Channels | Notes                             |
| ----------- | --------- | --------- | -------- | --------------------------------- |
| `WavFormat` | **WAV**   | PCM‑16‑LE | Mono     | `decode()` throws (not supported) |

### API

```ts
class WavFormat extends AudioFormat {
  constructor(sampleRate: number);

  readonly name: string; // "wav-pcm"
  readonly pcmSampleRate: number;

  /** Adds the WAV header then streams the original PCM bytes. */
  encode(input: AsyncReadStream<Buffer>): AsyncReadStream<Buffer>;

  /** Not implemented — throws an Error. */
  decode(_: AsyncReadStream<Buffer>): never;
}
```

---

## Why no `decode()`?

In many live/streaming scenarios you already have raw PCM from an upstream capture or decode stage.  
`@silyze/async-audio-format-wav` focuses on _wrapping_ that data for consumer compatibility.  
If you need WAV → PCM, use `@silyze/async-audio-ffmpeg` with a suitable format instead.
npm package: @silyze/async-audio-format-webm
Description: WebM format for @silyze/async-audio-stream
Author: Mihail Mojsoski
Latest version: 1.0.0

# Async Audio Format WebM

Prebuilt **WebM/Opus audio format** for use with [`@silyze/async-audio-stream`](https://www.npmjs.com/package/@silyze/async-audio-stream), powered by FFmpeg.

This package wraps `@silyze/async-audio-ffmpeg` and provides a ready-to-use `AudioFormat` for WebM/Opus encoding and decoding.

---

## Install

```bash
npm install @silyze/async-audio-format-webm
```

> Requires FFmpeg to be installed and available in your system `PATH`.

---

## Usage

```ts
import { OpusFormat } from "@silyze/async-audio-format-webm";

// Create an instance for 8 kHz PCM audio
const format = new OpusFormat(8000);

console.log(format.name); // "webm-opus"
console.log(format.pcmSampleRate); // 8000
```

You can use this format directly with any system based on `@silyze/async-audio-stream`.

---

## Available Formats

### `OpusFormat`

WebM container with Opus audio codec.  
Defaults to 24kbps mono output.

```ts
export const OpusFormat: new (sampleRate: number) => AudioFormat;
```
npm package: @silyze/async-audio-stream
Description: Async audio stream interface
Author: Mihail Mojsoski
Latest version: 1.0.1

# Async Audio Stream

**Async Audio Stream** defines abstract interfaces for streaming audio data in an asynchronous, format-agnostic way. This is ideal for real-time audio processing pipelines, including transcoding, streaming, and speech recognition workflows.

## Install

```bash
npm install @silyze/async-audio-stream
```

## Usage

Import and use it in your project:

```ts
import { AudioFormat, AudioStream } from "@silyze/async-audio-stream";

// Example: Implement your custom audio format
class MyFormat extends AudioFormat {
  get name() {
    return "my-format";
  }

  get pcmSampleRate() {
    return 48000;
  }

  decode(input: AsyncReadStream<Buffer>): AsyncReadStream<Buffer> {
    // return a PCM stream
    throw new Error("Not implemented");
  }

  encode(input: AsyncReadStream<Buffer>): AsyncReadStream<Buffer> {
    // return an encoded stream
    throw new Error("Not implemented");
  }
}
```

## Interfaces

### `AudioFormat`

Represents an audio encoding format. You must implement:

```ts
abstract class AudioFormat {
  abstract decode(input: AsyncReadStream<Buffer>): AsyncReadStream<Buffer>;
  abstract encode(input: AsyncReadStream<Buffer>): AsyncReadStream<Buffer>;

  abstract get name(): string;
  abstract get pcmSampleRate(): number;
}
```

- `decode()` — Converts from this format to PCM.
- `encode()` — Converts from PCM to this format.
- `name` — Human-readable identifier.
- `pcmSampleRate` — The PCM sample rate used in `decode`/`encode`.

### `AudioOutputStream`

```ts
interface AudioOutputStream extends AsyncReadStream<Buffer> {
  get format(): AudioFormat;
}
```

Represents a readable audio stream with associated format metadata.

### `AudioInputStream`

```ts
interface AudioInputStream extends AsyncWriteStream<Buffer> {
  get format(): AudioFormat;
}
```

Represents a writable audio stream with associated format metadata.

### `AudioStream`

```ts
interface AudioStream extends AudioInputStream, AudioOutputStream {
  get ready(): Promise<void>;
}
```

Bidirectional stream that supports both input and output. Useful for transcoders or duplex pipelines.

- `ready` — A promise that resolves when the stream is ready to use.

### `Transcript`

```ts
interface Transcript {
  source: string;
  content: string;
}
```

Represents a unit of transcription output.

## Implementation Guide

To implement a custom format or stream:

1. **Implement `AudioFormat`** for your codec.
2. **Use `AsyncReadStream` and `AsyncWriteStream`** (from `@mojsoski/async-stream`) for streaming behavior.
3. **Wrap `AudioStream`** if you need to create a full duplex audio processor or transcoder.
npm package: @silyze/async-audio-tts
Description: Async audio text-to-speach interface
Author: Mihail Mojsoski
Latest version: 1.1.0

# Async Audio TTS

Minimal TypeScript interface for Text-to-Speech engines that output audio as an asynchronous stream. Built to interoperate with `@silyze/async-audio-stream`.

## Install

```bash
npm install @silyze/async-audio-tts
```

This package depends on `@silyze/async-audio-stream` and re-exports its types (e.g., `AudioOutputStream`, `AudioFormat`).

## Quick Start

`@silyze/async-audio-tts` exports a single interface describing a TTS engine that produces audio you can read asynchronously.

```ts
import TextToSpeachModel from "@silyze/async-audio-tts";
import { AudioFormat } from "@silyze/async-audio-stream";

class YourEngine implements TextToSpeachModel {
  // AudioOutputStream requirement
  get format(): AudioFormat {
    // Return the format of emitted audio (e.g., PCM 16kHz mono)
    throw new Error("Not implemented");
  }

  // TTS-specific lifecycle
  get ready(): Promise<void> {
    // Resolve when the engine is initialized and ready
    return Promise.resolve();
  }

  async speak(text: string): Promise<void> {
    // Enqueue synthesized audio for the provided text into the output stream
    throw new Error("Not implemented");
  }

  async close(): Promise<void> {
    // Release internal resources and stop emitting audio
    throw new Error("Not implemented");
  }

  // Provide async iteration of audio chunks (Buffer)
  async *[Symbol.asyncIterator](): AsyncIterator<Buffer> {
    // Yield audio buffers as they become available
    // yield chunk
  }
}
```

Consume audio from any `TextToSpeachModel` implementation:

```ts
const tts = new YourEngine();
await tts.ready;
await tts.speak("Hello world");

for await (const chunk of tts) {
  // Handle PCM/encoded audio Buffer chunks (e.g., write to a file or stream to a player)
}

await tts.close();
```

## API

- Default export `TextToSpeachModel` extends `AudioOutputStream` and adds:
  - `ready: Promise<void>` - resolves when the engine is initialized and ready to synthesize.
  - `speak(text: string): Promise<void>` - synthesizes and enqueues audio for `text` onto the output stream.
  - `close(): Promise<void>` - stops synthesis and releases any resources used by the engine.

From `@silyze/async-audio-stream`:

- `AudioOutputStream` - an async readable stream of `Buffer` chunks with a `format: AudioFormat` getter.
- `AudioFormat` - describes the encoding of the emitted audio (e.g., PCM sample rate, encoding name).

## Type Definition

```ts
import { AudioOutputStream } from "@silyze/async-audio-stream";

export default interface TextToSpeachModel extends AudioOutputStream {
  get ready(): Promise<void>;
  speak(text: string): Promise<void>;
  close(): Promise<void>;
}
```

## Notes

- Multiple `speak()` calls may enqueue additional audio onto the same output stream.
- Consumers should continuously read from the stream to avoid backpressure.
- Call `tts.close()` when finished to free resources and stop audio production.
- The emitted audio format is discoverable via `tts.format`.
npm package: @silyze/async-audio-twilio
Description: Twilio wrapper for @silyze/async-audio-stream
Author: Mihail Mojsoski
Latest version: 1.0.1

# Async Audio Twilio

Twilio wrapper for [`@silyze/async-audio-stream`](https://www.npmjs.com/package/@silyze/async-audio-stream)

## Install

```bash
npm install @silyze/async-audio-twilio
```

## Usage

Import and use it in your project:

```ts
import TwilioStream from "@silyze/async-audio-twilio";

// Use with a WebSocket connection from Twilio Media Streams
const stream = await TwilioStream.from(ws);

// Wait for stream to be ready (after "start" event)
await stream.ready;

// Read audio (u-law format)
for await (const chunk of stream.read()) {
  // process chunk (Buffer)
}

// Write audio (must be u-law encoded)
await stream.write(ulawBuffer);

// Listen for DTMF tones
for await (const digit of stream.dtmf.read()) {
  console.log("DTMF:", digit);
}

// Access Twilio metadata
const startEvent = await stream.startEvent;
console.log("Call SID:", startEvent.start.callSid);

const stopEvent = await stream.stopEvent;
console.log("Call ended for SID:", stopEvent.stop.callSid);
```

## API

### `TwilioStream.from(websocket: WebSocket): Promise<TwilioStream>`

Wraps a Twilio Media Stream WebSocket into an `AudioStream` interface.

### `stream.read(signal?: AbortSignal): AsyncIterable<Buffer>`

Yields u-law audio buffers from the Twilio media stream.

### `stream.write(input: Buffer): Promise<void>`

Sends u-law audio buffer into the WebSocket stream.

### `stream.dtmf: AsyncReadStream<string>`

Yields detected DTMF digits (as strings).

### `stream.startEvent: Promise<TwilioStartEvent>`

Resolves to the Twilio `start` event, containing metadata such as `callSid`, `streamSid`, and `customParameters`.

### `stream.stopEvent: Promise<TwilioStopEvent>`

Resolves to the Twilio `stop` event.

### `stream.ready: Promise<void>`

Resolves when the `start` event is received — useful for waiting before sending/receiving audio.

### `stream.format: AudioFormat`

Returns `ULawFormat(8000)` — used by Twilio Media Streams.
npm package: @silyze/async-duplex
Description: A pair of connected async streams where one acts as reader and the other as writer, and reverse() swaps their roles
Author: Mihail Mojsoski
Latest version: 1.0.0

# Async Duplex

A pair of connected async streams where one acts as reader and the other as writer, and `reverse()` swaps their roles.

## Install

```bash
npm install @silyze/async-duplex
```

## Overview

`AsyncDuplex<TOutput, TInput = TOutput>` provides a simple duplex abstraction over two connected asynchronous streams. It supports:

- Reading from one stream and writing to the other.
- Flipping roles using `reverse()` — useful for building symmetrical or bidirectional systems.
- Composing with `AsyncTransform` for streaming transformations.

## API

### `new AsyncDuplex<TOutput, TInput>()`

Creates a new duplex stream with output type `TOutput` and input type `TInput`.

### `read(signal?: AbortSignal): AsyncIterable<TOutput>`

Returns an async iterable for reading from the output side.

### `write(input: TInput): Promise<void>`

Writes data to the input side.

### `transform(): AsyncTransform<TOutput>`

Returns a transform object for piping or modifying output data.

### `reverse(): AsyncStream<TInput, TOutput>`

Returns a new `AsyncStream` where the original input becomes readable and the original output becomes writable — reversing the flow.

## Example: Duplex Console Echo

```ts
import { AsyncDuplex } from "@silyze/async-duplex";
import { AsyncTransform } from "@mojsoski/async-stream";
import readline from "readline";

// Create a duplex console
const console = new AsyncDuplex<string>();
const consoleImpl = console.reverse(); // reversed interface

// Set up signal aborts on process exit
const stdoutAbortController = new AbortController();
process.stdout.once("close", () => stdoutAbortController.abort());

const stdinAbortController = new AbortController();
process.stdin.once("close", () => stdinAbortController.abort());

// Pipe data written to the duplex into stdout
consoleImpl.transform().pipe(
  {
    async write(input) {
      await new Promise<void>((resolve, reject) => {
        process.stdout.write(input, (err) => (err ? reject(err) : resolve()));
      });
    },
  },
  { signal: stdoutAbortController.signal }
);

// Read from stdin using readline and pipe into the duplex
const inputInterface = readline.promises.createInterface(process.stdin);
AsyncTransform.from(inputInterface).pipe(consoleImpl, {
  signal: stdinAbortController.signal,
});

// Read from the duplex, prefix the input, and write it back to the stream
console
  .transform()
  .map((item) => `prefix: ${item}\n`)
  .pipe(console, { signal: stdinAbortController.signal })
  .then(() => process.exit(0));
```
npm package: @silyze/async-pipe
Description: Asynchronous pipe (channel) implementation for @mojsoski/async-stream
Author: Mihail Mojsoski
Latest version: 1.0.0

# Async Pipe

An asynchronous, single-producer single-consumer channel implementation built on top of `@mojsoski/async-stream`.

`AsyncPipe<T>` allows you to write data asynchronously into the pipe and asynchronously read it out in order. Internally, it manages flow control using promises and resolver locks, providing a backpressure-aware, event-driven mechanism to stream data between asynchronous producers and consumers.

This makes it ideal for scenarios where you want to:

- Connect asynchronous data producers and consumers with minimal overhead
- Stream data in an ordered, sequential fashion
- Use async iteration (`for await`) to process streamed items
- Integrate smoothly with `@mojsoski/async-stream` transforms and utilities

---

## Install

```bash
npm install @silyze/async-pipe
```

## Usage

```ts
import { AsyncPipe } from "@silyze/async-pipe";

const pipe = new AsyncPipe<string>();

pipe.transform().forEach((item) => console.log(item));

pipe.write("Hello, World!");
```

## Notes on Readers

`AsyncPipe<T>` implements the interface `AsyncStream<T>`, combining:

- `write(input: T): Promise<void>` to push data into the pipe
- `read(signal?: AbortSignal): AsyncIterable<T>` to consume data asynchronously
- `transform(): AsyncTransform<T>` to get a transform stream wrapper over the pipe

### Single Reader Limitation

`AsyncPipe` is designed for **a single active reader**. Only one consumer should call `.read()` or consume `.transform()` at a time.

Multiple simultaneous readers will cause internal resolver conflicts and potentially lost or duplicated data.

### Supporting Multiple Readers

To safely share the data stream with multiple readers, use `.buffer()` on the transform stream:

```ts
const buffered = pipe.transform().buffer({
  clear: "all-read", // clears buffer only after all readers have consumed
});

buffered.forEach((item) => {
  console.log("Reader 1:", item);
});

buffered.forEach((item) => {
  console.log("Reader 2:", item);
});

buffered.forEach((item) => {
  console.log("Reader 3:", item);
});
```

- `.buffer()` creates a buffered stream that caches data internally for multiple consumers.
- You can configure buffering and clearing policies with `AsyncBufferConfig`.

Using `.buffer()` enables multiple consumers to independently and concurrently read from the pipe without conflicts, at the cost of extra memory to hold buffered data.
npm package: @silyze/async-process-stream
Description: A duplex async stream wrapper for child processes with transform support and separate stderr handling
Author: Mihail Mojsoski
Latest version: 1.0.0

# Async Process Stream

A duplex async stream wrapper for child processes with transform support and separate stderr handling.

## Install

```bash
npm install @silyze/async-process-stream
```

## Usage

Import and use it in your project:

```ts
import { spawnAsync } from "@silyze/async-process-stream";

const { stream } = spawnAsync("echo", ["Hello, World!"]);

const stdoutAbortController = new AbortController();
process.stdout.once("close", () => stdoutAbortController.abort());

stream
  .transform()
  .pipe(
    {
      async write(input) {
        await new Promise<void>((resolve, reject) => {
          process.stdout.write(input, (err) => (err ? reject(err) : resolve()));
        });
      },
    },
    { signal: stdoutAbortController.signal }
  )
  .then(() => process.exit(0));
```

This example runs the `echo` command and streams its stdout to the current process's stdout using `AsyncTransform.pipe()`.

## API

### `spawnAsync(path: string, args: string[], options?: SpawnOptionsWithoutStdio)`

Spawns a child process and returns:

```ts
{
  stream: AsyncProcessStream,
  process: ChildProcess
}
```

### `class AsyncProcessStream implements AsyncStream<Buffer, Buffer>`

- `read(signal?: AbortSignal): AsyncIterable<Buffer>` – reads from `stdout`
- `write(input: Buffer): Promise<void>` – writes to `stdin`
- `transform(): AsyncTransform<Buffer>` – transforms `stdout` as a stream
- `error: AsyncReadStream<Buffer>` – reads from `stderr` only
npm package: @silyze/batch-repository
Description: Batch extensions for @mojsoski/ormm
Author: Mihail Mojsoski
Latest version: 1.0.1

# Batch Repository

Batch extensions for `@mojsoski/ormm` to perform bulk create, update, and delete operations efficiently.

## Installation

```bash
npm install @silyze/batch-repository
```

## Usage

Import and extend `BatchRepository` in your project:

```ts
import BatchRepository from "@silyze/batch-repository";
import { IModel } from "@mojsoski/ormm";

interface UserModel extends IModel {
  id: string;
  name: string;
  email: string;
}

class UserBatchRepository extends BatchRepository<"users", UserModel> {
  ...
}

const repo = new UserBatchRepository(databaseService);
```

## API Reference

### `class BatchRepository<Table extends string, T extends IModel>`

Extends `ModelRepository<Table, T>` and adds batch operations.

#### `createBatch(items: CreateFilter<T>[]): Promise<string[]>`

Insert multiple records in a single SQL `INSERT` statement.

- **Parameters**:

  - `items`: Array of objects conforming to `CreateFilter<T>` (fields to insert).

- **Returns**: Promise resolving to an array of created record IDs (`string[]`).

**Example**:

```ts
const newIds = await repo.createBatch([
  { name: "Alice", email: "alice@example.com" },
  { name: "Bob", email: "bob@example.com" },
]);
console.log(newIds); // e.g. ["1", "2"]
```

---

#### `updateBatch(items: (UpdateFilter<T> & Index)[]): Promise<string[]>`

Update multiple records concurrently by mapping individual `UPDATE` queries over the input array.

- **Parameters**:

  - `items`: Array of objects combining `UpdateFilter<T>` (fields to update) and `Index` (must include an `id` field).

- **Returns**: Promise resolving to an array of affected record IDs (`string[]`).

**Example**:

```ts
const updatedIds = await repo.updateBatch([
  { id: "1", email: "alice@newdomain.com" },
  { id: "2", name: "Robert" },
]);
console.log(updatedIds); // ["1", "2"]
```

---

#### `removeBatch(ids: string[]): Promise<string[]>`

Delete multiple records in a single SQL `DELETE` statement using an `IN` clause.

- **Parameters**:

  - `ids`: Array of record IDs (`string[]`) to delete.

- **Returns**: Promise resolving to an array of deleted record IDs (`string[]`).

**Example**:

```ts
const deletedIds = await repo.removeBatch(["1", "2", "3"]);
console.log(deletedIds); // ["1", "2", "3"]
```

## Notes

- `createBatch` constructs a single bulk `INSERT` for performance.
- `updateBatch` uses `concurrentMap` under the hood, issuing parallel `UPDATE` queries.
- `removeBatch` constructs a bulk `DELETE` with `RETURNING "id"`.
npm package: @silyze/browsary-pipeline-agent
Description: Browsary Pipeline AI Agent
Author: Mihail Mojsoski
Latest version: 1.0.2

# Browsary Pipeline Agent

An AI-driven pipeline evaluator that runs browser automation functions via Puppeteer and the Browsary AI Provider.

## Installation

```bash
npm install @silyze/browsary-pipeline-agent
```

## Usage

```ts
import { PipelineAgent, AgentConfig } from "@silyze/browsary-pipeline-agent";
import { URLBrowserProvider } from "@silyze/browser-provider";
import { createJsonLogger } from "@silyze/logger";
import OpenAI from "openai";
import { OpenAiProvider } from "@silyze/browsary-ai-provider";

// 1. Provide a BrowserProvider or Puppeteer Browser

const agentConfig: AgentConfig = {
  browser: new URLBrowserProvider(),
  viewport: { width: 1280, height: 800 },
};

// 2. Instantiate the agent
const agent = new PipelineAgent(agentConfig);

// 3. Create an AI context for evaluation
const context = agent.createContext(OpenAiProvider, {
  openAi: new OpenAI({ apiKey: process.env.OPENAI_API_KEY }),
  pipelineProvider: new PipelineProvider(),
  logger: createJsonLogger(console.log),
});

// 4. Evaluate a function within the browser page context
const result = await agent.evaluate(async (page: Page) => {
  await page.goto("https://example.com");
  return page.url();
});
```

## API Reference

### Class: `PipelineAgent`

Extends `AiEvaluator<Page>`, enabling evaluation of browser-based functions with AI contexts.

#### `constructor(config: AgentConfig)`

- **config**: Configuration for browser provider and optional viewport.

#### `createContext(constructor, config)`

```ts
createContext<TConfig>(
  constructor: new (
    config: TConfig,
    functionCall: (context: Page, name: string, params: any) => Promise<unknown>
  ) => AiProvider<Page, TConfig>,
  config: TConfig
): AiEvaluationContext<Page>
```

- Instantiates the provided `AiProvider` subclass.
- Binds internal function-call dispatcher.
- Returns an evaluation context with `{ provider, agent }`.

#### `evaluate(fn, ...args)`

```ts
evaluate<TArgs extends any[], TResult>(
  fn: (context: Page, ...args: TArgs) => TResult,
  ...args: TArgs
): Promise<Awaited<TResult>>
```

- Acquires a browser instance via `AgentConfig.browser`.
- Opens a new `Page` and applies optional `viewport` settings.
- Executes `fn(page, ...args)` and returns its result.
- Ensures the page is closed and the browser is released.

---

### Internal Function Calls

AI-driven function calls (`querySelector`, `goto`, `click`, `type`, `url`) are dispatched through `#functionCall`, which invokes private methods:

- `#querySelector` / `#querySelectorAll` — Returns parsed and compressed HTML nodes.
- `#goto` — Navigates to the given URL with a Puppeteer lifecycle event.
- `#click` — Clicks elements, optionally waiting for navigation.
- `#type` — Types text into an element with configurable delay.
- `#url` — Retrieves the current page URL.

## Environment Variables

- `OPENAI_API_KEY` — API key for OpenAI client (used by `OpenAiProvider`).
npm package: @silyze/browser-provider
Description: An abstract interface that represents a Puppeteer browser provider
Author: Mihail Mojsoski
Latest version: 1.0.0

# Browser Provider

A flexible abstraction for managing Puppeteer browser connections.

This library provides a consistent interface (`BrowserProvider`) for working with remote or mock Puppeteer-compatible browser instances. It is particularly useful when you want to separate browser connection logic from business logic, or support different environments (e.g. mock/testing vs production).

## Install

```bash
npm install @silyze/browser-provider
```

## Overview

`@silyze/browser-provider` helps decouple browser acquisition and lifecycle management from how you use the browser. Instead of hardcoding browser connection logic in your application, you can rely on a `BrowserProvider` implementation.

This makes it easy to:

- Swap real browsers with mocks for testing
- Connect to remote browsers (e.g. via Chrome DevTools Protocol)
- Centralize browser connection logic across your app

## Exports

```ts
import {
  BrowserProvider,
  UrlBrowserProvider,
  NullBrowserProvider,
  type BrowserFactory,
  type BaseBrowserConfig,
  type ViewportConfig,
} from "@silyze/browser-provider";
```

## Usage

```ts
import { BrowserProvider, UrlBrowserProvider } from "@silyze/browser-provider";

async function goToUrl(url: string, provider: BrowserProvider) {
  const browser = await provider.getBrowser();

  const [page] = await browser.pages();
  await page.goto(url);

  await new Promise((resolve) => setTimeout(resolve, 1000));

  await provider.releaseBrowser(browser);
}

goToUrl(
  "https://example.com",
  new UrlBrowserProvider({}, "http://localhost:9222/")
);
```

## Providers

### `BrowserProvider`

Abstract base class for all providers.

Implementations must define:

```ts
abstract getBrowser(config?: TConfig): Promise<Browser> | Browser;
abstract releaseBrowser(browser: Browser): Promise<void> | void;
```

### `UrlBrowserProvider`

Connects to a remote browser via a URL (e.g. from a `puppeteer-core` compatible remote endpoint).

```ts
const provider = new UrlBrowserProvider({}, "http://localhost:9222/");
const browser = await provider.getBrowser();
```

### `NullBrowserProvider`

A no-op provider useful for disabling browser behavior in some environments (e.g. local development or unit tests).

```ts
const browser = NullBrowserProvider.default.getBrowser(); // returns null
```

## Advanced: Custom Connection Factory

You can customize how remote browsers are connected using a `factory` function:

```ts
import puppeteer from "puppeteer-core";

const factory = async (url: string) => {
  return await puppeteer.connect({ browserURL: url });
};

const provider = new UrlBrowserProvider(
  { factory },
  "http://my-remote-host:9222/"
);
```