open-index/open-npm huggingface dataset:
npm package: @strawci/interpreter
Description: Action interpreter for StrawCI
Latest version: 1.0.1

# 🍓 StrawCI Interpreter

This package is responsible for interpreting actions in JSON format. It is made specifically for StrawCI.

## 👷 Constructor

```javascript
const Interpreter = require("@strawci/interpreter");
const interpreter = new Interpreter();
```

## 📝 Action Body

```json
{
    "type": "bash",
    "arg": "Command to be executed"
}
```

### 💻 Functions

```javascript
// Run a single action
interpreter
    .runAction({
        type: "bash",
        arg: "echo Hello world",
    })
    .then(({ stdout, stderr }) => {
        console.log(stdout || stderr);
        console.log("Finished");
    });

// Run multiple actions
const actions = [
    { type: "bash", arg: "echo First command" },
    { type: "bash", arg: "echo Second command" },
    { type: "bash", arg: "echo Third command" },
    { type: "bash", arg: "echo Fourth command" },
];

interpreter
    .runActions(actions, (err, stdout, stderr) => {
        console.log(stdout || stderr);
    })
    .catch((e) => {
        console.error("Failed running command: " + e);
    })
    .then(() => {
        console.log("Finished.");
    });
```

### ❤️ The End

Made with Love by [Sammwy](https://twitter.com/sammwy)</a>
npm package: @strax/lambdapack
Description: Creates a Lambda deployment package for Node.js applications
Author: Sami Kukkonen
Latest version: 0.1.0

# `lambdapack`

`lambdapack` is an unopinionated tool to package Node.js applications for [AWS Lambda][1] deployment. It packages the files specified in the `files` field of `package.json` and production dependencies into a single zip file which can then be provided to AWS Lambda.

Note that this tool does not, by design, perform any compilation, minification or processing to the source files. You can however use `lambdapack` as a part of a more complex build pipeline.

## Usage

```
npx -p @strax/lambdapack lambdapack <path>
```

Lambdapack will output the zip file to stdout, so a typical use-case would be to write the generated archive to a file:

```
npx -p @strax/lambdapack lambdapack . > artifact.zip
```

[1]: https://aws.amazon.com/lambda/
npm package: @strayl/backend
Description: Official Strayl BaaS SDK for auth, database, and storage
Author: Strayl
Latest version: 0.1.3

﻿# strayl/backend

TypeScript SDK for Strayl BaaS. Provides a single client with auth, database, and storage helpers that talk to `auth.strayl.dev`, `db.strayl.dev`, and `storage.strayl.dev`.

```ts
import { createStraylBackendClient } from "strayl/backend";

const strayl = createStraylBackendClient({ tenant: "owner-slug" });

await strayl.auth.signIn({ email: "user@example.com", password: "secret" });
const todos = await strayl.db.from("todos").select("*").eq("done", false);
const upload = await strayl.storage.from("user-files").upload("avatar.png", file);
```

See `src/` for API details. Run `npm run build` to emit `dist/`.
npm package: @strc/utf16-to-any-base
Description: Encode JavaScript UTF-16 strings to arbitrary bases (Base64, Base32, etc.) and decode them back.
Author: JustDeveloper
Latest version: 2.0.2

# `@strc/utf16-to-any-base`
A simple, small, fast, ES lib to convert UTF-16 to any base. <br>

> ## Warning
> This library does NOT implement standard Base64. <br>
> Encoded strings are NOT compatible with `atob`, `btoa`,
> `Buffer.from(..., 'base64')`, or other Base64 tools.
>
> **This library mainly supports UTF-16 to Base64 and Base64 to UTF-16 conversions only. Other bases are unstable and experemental, in most cases they wont be decodable!**

```
npm i @strc/utf16-to-any-base
```

This is an internal module of [`JSSC` (`strc`)](https://www.npmjs.com/package/strc).

```
npm i strc
```

## Usage
```js
import { encode, decode } from "@strc/utf16-to-any-base";

const encoded = encode("Hello, world!", 64);
console.log("Base64:", encoded, "\nUTF-16:", decode(encoded, 64));
```

## License
[MIT © 2026 JustDeveloper](https://github.com/justdevw/UTF-16-to-any-Base/blob/main/LICENSE)
npm package: @strdr4605/react-native-rename
Description: Rename react-native app with just one command
Author: Dragoș Străinu
Latest version: 2.5.0
Deprecated: use npm.im/react-native-rename @2.7.0

# @strdr4605/react-native-rename

Rename react-native app with just one command

:warning::warning::warning:
**NOTE:** This package is a fork of [react-native-rename](https://github.com/junedomingo/react-native-rename) with several improvements.
- [Validate bundleID to match requirements for Android](https://github.com/junedomingo/react-native-rename/pull/93)
- [Change package name for other java files](https://github.com/junedomingo/react-native-rename/issues/95)

:warning::warning::warning: Probable will be depricated in future if original package will implement these changes  

![react-native-rename](https://cloud.githubusercontent.com/assets/5106887/24444940/cbcb0a58-149a-11e7-9714-2c7bf5254b0d.gif)

> This package assumes that you created your react-native project using `react-native init`.

**Note:** This package does not attempt to properly rename build artifacts such as `ios/build` or Cocoa Pod installation targets. After renaming your project you should clean, build, and reinstall third party dependencies to get it running properly with the new name.

## Installation
```
npm install @strdr4605/react-native-rename -g
```

Switch to new branch first
> better to have back-up

```
git checkout -b rename-app
```

## Usage
```
react-native-rename "<newName>"
# or
npx @strdr4605/react-native-rename "<newName>"
```

> With custom Bundle Identifier (Android only. For iOS, please use Xcode)
```
react-native-rename "<newName>" -b <bundleIdentifier>
```

## Example
```
npx @strdr4605/react-native-rename "Travel App"
```
> With custom Bundle Identifier
```
npx @strdr4605/react-native-rename "Travel App" -b io.github.strdr4605.travelapp
```

<a href="https://www.buymeacoffee.com/strdr4605"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;"  target="_blank"></a>
npm package: @stread/sample-electron-preload
Description: 让你的electron请求更加简单
Latest version: 0.0.6

# SampleElectronPreload

让你的electron请求更加简单

## 使用案例

````typescript
// FileHandler.ts
import {Request} from "@stread/sample-electron-preload/main"

export class FileHandler {
    @Request()
    openFileDialog(event: IpcMainInvokeEvent) {
        return {test: 1}
    }
}
````

````typescript
// Loader.ts
import {getSingletonInstance} from "@stread/sample-electron-preload/main";
import {FileHandler} from "example/FileHandler";

export const LoaderHandler = [
    getSingletonInstance(FileHandler),
]
````

````typescript
// 请求端
import {ElectronRequest} from "@stread/sample-electron-preload/renderer";

const res = await ElectronRequest("FileHandler.openFileDialog", config);
console.log(res) //{test: 1}
````

## 先决条件

### 安装
``` npm install @stread/sample-electron-preload```

### 增加loader文件

这个文件用于初始化handler, 文件的位置随意, 建议放到 electron-main文件附近  
内容如下:

````typescript
    // 所有用户自定义的handler应该都在这里
export const LoaderHandler = [
    XXX
]
````

### 在main文件中引入代码

你可以将下面的代码放到 app.whenReady() 之后, 或者then 回调中

````typescript
// 这里主要是监听请求接口
import {StartListen} from "@stread/sample-electron-preload/main"

StartListen();
// 然后引入 Loader.ts 的内容, 做一次初始化
console.log(`Handler Number: `, LoaderHandler.length)
````

### 在preload中引入路由声明

````
export * from "@stread/sample-electron-preload/preload"
````
npm package: @stream-io/escape-string-regexp
Description: Escape RegExp special characters
Author: Sindre Sorhus
Latest version: 5.0.1

# escape-string-regexp

> Escape RegExp special characters

## Install

```
$ npm install escape-string-regexp
```

## Usage

```js
import escapeStringRegexp from 'escape-string-regexp';

const escapedString = escapeStringRegexp('How much $ for a 🦄?');
//=> 'How much \\$ for a 🦄\\?'

new RegExp(escapedString);
```

You can also use this to escape a string that is inserted into the middle of a regex, for example, into a character class.

---

<div align="center">
	<b>
		<a href="https://tidelift.com/subscription/pkg/npm-escape-string-regexp?utm_source=npm-escape-string-regexp&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
	</b>
	<br>
	<sub>
		Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
	</sub>
</div>
npm package: @stream-io/flat-list-mvcp
Description: `maintainVisibleContentPosition` support for Android react-native
Author: vishtree
Latest version: 0.10.3

# `maintainVisibleContentPosition` prop support for Android react-native.

[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/GetStream/flat-list-mvcp/blob/main/LICENSE)
[![Npm Package](https://img.shields.io/badge/npm--package-v0.0.8-blue)](https://www.npmjs.com/package/@stream-io/flat-list-mvcp)
[![Compatibility](https://img.shields.io/badge/react--native%20--%20android%20%7C%20iOS-compatible-brightgreen)](https://reactnative.dev/)

**[** Built with ♥ at [Stream](https://getstream.io/) **]**

In react-native, [ScrollView](https://reactnative.dev/docs/scrollview) (and [FlatList](https://reactnative.dev/docs/flatlist)) component have support for a prop [`maintainVisibleContentPosition`](https://reactnative.dev/docs/scrollview#maintainvisiblecontentposition), which is really useful for chat-like applications where you want to see new messages scroll into place. Also you might need it in other applications where you need bi-directional infinite scroll. Although currently its only supported on iOS. So here we have built a simple wrapper for FlatList and ScrollView to add support for this prop for android.  On iOS, we simply return FlatList and ScrollView from react-native package.

We built this wrapper for our in-house [react-native chat sdk](https://github.com/GetStream/stream-chat-react-native), but we are making it public, in case it helps other devs from react-native community.

Before you proceed, please don't forget to also check other relevant packages, built at Stream:

- [react-native-bidirectional-infinite-scroll](https://github.com/GetStream/react-native-bidirectional-infinite-scroll)
- [stream-chat-react-native](https://github.com/GetStream/stream-chat-react-native)

> ⚠️ Horizontal list is currently not supported on this package.

## Example

```sh
#  clone the repo
git clone https://github.com/GetStream/flat-list-mvcp.git
cd flat-list-mvcp/Example

# Install npm and pod dependencies
yarn; npx pod-install;

# run the app
npx react-native run-android
```
## Installation

```sh
yarn add @stream-io/flat-list-mvcp
```

## Usage

```js
import { FlatList, ScrollView } from '@stream-io/flat-list-mvcp';

<FlatList
    maintainVisibleContentPosition={{
        autoscrollToTopThreshold: 10,
        minIndexForVisible: 1,
    }}
    ...
/>

<ScrollView
    maintainVisibleContentPosition={{
        autoscrollToTopThreshold: 10,
        minIndexForVisible: 1,
    }}
    ...
/>

```

## Expo support

This package doesn't support [Expo managed workflow](https://docs.expo.io/introduction/managed-vs-bare/#managed-workflow). There is a feature request open for expo - https://expo.canny.io/feature-requests/p/android-maintainvisiblecontentposition-on-flatlist (please upvote)


## Credits

Thanks to [stackia](https://github.com/stackia) for https://github.com/facebook/react-native/pull/29466#issuecomment-664367382

## Contributing

PRs for improvement are welcome :) 
## License

MIT
npm package: @stream-io/transliterate
Description: Convert Unicode characters to Latin characters using transliteration
Author: Sindre Sorhus
Latest version: 1.5.5

# transliterate

> Convert Unicode characters to Latin characters using [transliteration](https://en.wikipedia.org/wiki/Transliteration)

Can be useful for [slugification](https://github.com/sindresorhus/slugify) purposes and other times you cannot use Unicode.

## Install

```
$ npm install @sindresorhus/transliterate
```

## Usage

```js
import transliterate from '@sindresorhus/transliterate';

transliterate('Fußgängerübergänge');
//=> 'Fussgaengeruebergaenge'

transliterate('Я люблю единорогов');
//=> 'Ya lyublyu edinorogov'

transliterate('أنا أحب حيدات');
//=> 'ana ahb hydat'

transliterate('tôi yêu những chú kỳ lân');
//=> 'toi yeu nhung chu ky lan'
```

## API

### transliterate(string, options?)

#### string

Type: `string`

String to transliterate.

#### options

Type: `object`

##### customReplacements

Type: `Array<string[]>`\
Default: `[]`

Add your own custom replacements.

The replacements are run on the original string before any other transformations.

This only overrides a default replacement if you set an item with the same key.

```js
import transliterate from '@sindresorhus/transliterate';

transliterate('Я люблю единорогов', {
	customReplacements: [
		['единорогов', '🦄']
	]
})
//=> 'Ya lyublyu 🦄'
```

## Supported languages

Most major languages are supported.

This includes special handling for:

- Arabic
- Armenian
- Czech
- Danish
- Dhivehi
- Georgian
- German (umlauts)
- Greek
- Hungarian
- Latin
- Latvian
- Lithuanian
- Macedonian
- Pashto
- Persian
- Polish
- Romanian
- Russian
- Serbian
- Slovak
- Swedish
- Turkish
- Ukrainian
- Urdu
- Vietnamese

However, Chinese is [currently not supported](https://github.com/sindresorhus/transliterate/issues/1).

## Related

- [slugify](https://github.com/sindresorhus/slugify) - Slugify a string
npm package: @stream-mdx/core
Description: Core types, snapshot utilities, and perf helpers for the Streaming Markdown V2 stack
Latest version: 0.4.0

# `@stream-mdx/core`

Core types + utilities shared across the StreamMDX stack.

This package is intentionally React-free. It contains structured-clone-safe types and helpers used by both the worker and the renderer.

Most consumers should install `stream-mdx` and follow the main docs. Use `@stream-mdx/core` directly if you’re building tooling or customizing lower-level behavior.

## Install

```bash
npm install @stream-mdx/core
```

## Entry points

- `@stream-mdx/core` (root)
- `@stream-mdx/core/types`
- `@stream-mdx/core/utils`
- `@stream-mdx/core/code-highlighting`
- `@stream-mdx/core/inline-parser`
- `@stream-mdx/core/mixed-content`
- `@stream-mdx/core/worker-html-sanitizer`
- `@stream-mdx/core/security`
- `@stream-mdx/core/perf/backpressure`
- `@stream-mdx/core/perf/patch-batching`
- `@stream-mdx/core/perf/patch-coalescing`
- `@stream-mdx/core/streaming/custom-matcher`

## Example

```ts
import { DEFAULT_BACKPRESSURE_CONFIG } from "@stream-mdx/core/perf/backpressure";

export function makeConfig(overrides?: Partial<typeof DEFAULT_BACKPRESSURE_CONFIG>) {
  return { ...DEFAULT_BACKPRESSURE_CONFIG, ...overrides };
}
```

## Docs

- API reference: https://github.com/kmccleary3301/stream-mdx/blob/main/docs/PUBLIC_API.md
- Security model: https://github.com/kmccleary3301/stream-mdx/blob/main/docs/SECURITY_MODEL.md
- Protocol spec (for typed stream events): https://github.com/kmccleary3301/stream-mdx/blob/main/docs/STREAMMDX_JSON_DIFF_SPEC.md

## Related packages

- `@stream-mdx/react` for the React renderer
- `@stream-mdx/worker` for hosted worker bundles
- `@stream-mdx/plugins` for worker-side plugin primitives (advanced)
- `@stream-mdx/protocol` for stable protocol/event types (e.g. TUIs)
- `@stream-mdx/tui` for NDJSON helpers + a snapshot store (terminal UIs)
- `@stream-mdx/mermaid` for Mermaid diagram rendering (optional)
- `@stream-mdx/theme-tailwind` for an optional Tailwind-friendly theme (optional)
npm package: @stream-mdx/mermaid
Description: Mermaid diagram rendering addon for StreamMDX (Streaming Markdown V2)
Latest version: 0.4.0

# @stream-mdx/mermaid

Mermaid diagram rendering addon for StreamMDX.

This package is **opt-in**. Install it and register the `mermaid` block component so ` ```mermaid ` code fences render as diagrams (with a Diagram/Code toggle).

## Install

```bash
npm install @stream-mdx/mermaid
```

## Usage

```tsx
import { StreamingMarkdown } from "@stream-mdx/react";
import { MermaidBlock } from "@stream-mdx/mermaid";

export function Demo() {
  return (
    <StreamingMarkdown
      text={"```mermaid\\ngraph TD; A-->B;\\n```"}
      components={{
        mermaid: MermaidBlock,
      }}
    />
  );
}
```

## Customization

If you want to tune debounce or default view, wrap the component:

```tsx
components={{
  mermaid: (props) => <MermaidBlock {...props} debounceMs={250} defaultView="diagram" />,
}}
```

## Docs

- Mermaid guide: https://github.com/kmccleary3301/stream-mdx/blob/main/docs/STREAMING_MARKDOWN_PLUGINS_COOKBOOK.md#mermaid-addon-optional
- Docs site walkthrough: https://kmccleary3301.github.io/stream-mdx/docs/guides/mermaid-diagrams
npm package: @stream-mdx/plugins
Description: Streaming Markdown V2 plugin suite (math, MDX, tables, callouts, footnotes, HTML helpers)
Latest version: 0.4.0

# `@stream-mdx/plugins`

Plugin primitives and registries used by StreamMDX.

Most app consumers **do not** need to import this package directly. Start with:

- `stream-mdx` (recommended)
- https://github.com/kmccleary3301/stream-mdx/blob/main/docs/GETTING_STARTED.md

Use `@stream-mdx/plugins` when you are:

- building a **custom worker bundle** (custom tokenizers, extra document plugins, custom streaming matchers)
- integrating StreamMDX into another library and you want explicit control over the worker-side feature set

## Install

```bash
npm install @stream-mdx/plugins
```

## Entry points

- `@stream-mdx/plugins` (root)
- `@stream-mdx/plugins/registry`
- `@stream-mdx/plugins/base`
- `@stream-mdx/plugins/document`
- `@stream-mdx/plugins/tables`
- `@stream-mdx/plugins/html`
- `@stream-mdx/plugins/math`
- `@stream-mdx/plugins/math/renderer`
- `@stream-mdx/plugins/mdx`
- `@stream-mdx/plugins/footnotes`
- `@stream-mdx/plugins/callouts`

## Important note about “plugins”

The primary way to enable/disable capabilities in StreamMDX is the `features` prop on `<StreamingMarkdown />`:

```tsx
<StreamingMarkdown features={{ tables: true, html: true, math: true, mdx: true }} />
```

If you need **custom syntax**, you generally need a **custom worker bundle** rather than “passing plugins as a prop”.

## Addons

- `@stream-mdx/mermaid` is an opt-in diagram renderer that plugs in at the component layer.

## Docs

- Plugins & worker cookbook: https://github.com/kmccleary3301/stream-mdx/blob/main/docs/STREAMING_MARKDOWN_PLUGINS_COOKBOOK.md
- Public API: https://github.com/kmccleary3301/stream-mdx/blob/main/docs/PUBLIC_API.md
- Full docs site: https://kmccleary3301.github.io/stream-mdx/
npm package: @stream-mdx/protocol
Description: StreamMDX protocol types and event envelope for JSON/object streaming
Latest version: 0.4.0

# @stream-mdx/protocol

Protocol types for StreamMDX JSON/object streaming.

This package defines the event envelope, capability metadata, and token
structures used by StreamMDX Protocol v1. It is intended for consumers that
need a stable, versioned contract (e.g., terminal UIs).

Most web-only consumers do not need this package directly. Start with `stream-mdx`
or `@stream-mdx/react` for the React renderer.

## Install

```bash
npm install @stream-mdx/protocol
```

## What this provides

- Shared protocol types for streaming events and capability negotiation.
- Token / block payload shapes intended for structured-clone-safe transport.

## Typical usage (TUI/CLI)

Pair it with `@stream-mdx/tui` for NDJSON helpers + a lightweight snapshot store:

```bash
npm install @stream-mdx/tui @stream-mdx/protocol @stream-mdx/core
```

## Docs

- Public API: https://github.com/kmccleary3301/stream-mdx/blob/main/docs/PUBLIC_API.md
- CLI usage: https://github.com/kmccleary3301/stream-mdx/blob/main/docs/CLI_USAGE.md
- Protocol spec: https://github.com/kmccleary3301/stream-mdx/blob/main/docs/STREAMMDX_JSON_DIFF_SPEC.md
npm package: @stream-mdx/react
Description: React renderer, scheduler, and worker wiring for the Streaming Markdown V2 pipeline
Latest version: 0.4.0

# `@stream-mdx/react`

React renderer for StreamMDX. Exposes the `<StreamingMarkdown />` component, scheduling/backpressure hooks, and the public types used by consumers.

Most apps should install `stream-mdx` instead of this package directly. Use `@stream-mdx/react` when you want the React surface without the unscoped wrapper.

## Install

```bash
npm install @stream-mdx/react @stream-mdx/worker
```

`react` and `react-dom` are peer dependencies.

## Quickstart

Copy the hosted worker bundle into your app’s static assets:

```bash
mkdir -p public/workers
cp node_modules/@stream-mdx/worker/dist/hosted/markdown-worker.js public/workers/markdown-worker.js
```

Render streaming markdown from a client component:

```tsx
"use client";

import { StreamingMarkdown } from "@stream-mdx/react";

export function Demo({ text }: { text: string }) {
  return (
    <StreamingMarkdown
      text={text}
      worker="/workers/markdown-worker.js"
      features={{ html: true, tables: true, math: true, mdx: true }}
      mdxCompileMode="worker"
    />
  );
}
```

## Docs

- API reference: https://github.com/kmccleary3301/stream-mdx/blob/main/docs/PUBLIC_API.md
- React integration guide: https://github.com/kmccleary3301/stream-mdx/blob/main/docs/REACT_INTEGRATION_GUIDE.md
- Plugins & worker customization: https://github.com/kmccleary3301/stream-mdx/blob/main/docs/STREAMING_MARKDOWN_PLUGINS_COOKBOOK.md
- Full docs site: https://kmccleary3301.github.io/stream-mdx/

## Addons

- `@stream-mdx/mermaid` (optional Mermaid diagram renderer)
npm package: @stream-mdx/theme-tailwind
Description: Optional Tailwind theme styles for StreamMDX streaming Markdown output
Latest version: 0.4.0

# @stream-mdx/theme-tailwind

Optional Tailwind-friendly theme for StreamMDX output. This package ships a single CSS file with:

- `.markdown-v2-output` streaming-specific layout tweaks
- `.markdown` base Markdown typography helpers
- `.prose` adjustments (compatible with `@tailwindcss/typography`)

## Install

```bash
npm install @stream-mdx/theme-tailwind
```

## Usage

Import the CSS after your Tailwind directives so the layers merge cleanly:

```css
@tailwind base;
@tailwind components;
@tailwind utilities;

@import "@stream-mdx/theme-tailwind/theme.css";
```

Then apply the recommended structure:

```tsx
import { StreamingMarkdown } from "stream-mdx";

export function Article({ content }: { content: string }) {
  return (
    <div className="prose markdown">
      <StreamingMarkdown className="markdown-v2-output" text={content} />
    </div>
  );
}
```

## Notes

- If you want the `prose` base styles, install `@tailwindcss/typography` and enable it in `tailwind.config.ts`.
- The theme references CSS variables like `--foreground` and `--border`; define them in your design system or replace them with your own values.
- You can always override elements via StreamMDX `components`, `inlineComponents`, and `tableElements`.

## Docs

- Styling guide: https://github.com/kmccleary3301/stream-mdx/blob/main/docs/STYLING_PARITY.md
- React integration: https://github.com/kmccleary3301/stream-mdx/blob/main/docs/REACT_INTEGRATION_GUIDE.md
npm package: @stream-mdx/tui
Description: StreamMDX TUI helpers (NDJSON parsing and snapshot store)
Latest version: 0.4.0

# @stream-mdx/tui

Reference utilities for terminal and CLI integrations.

## Features
- NDJSON encoder/decoder helpers for StreamMDX protocol events.
- Lightweight snapshot store that applies patches and yields blocks.

## Install
```bash
npm install @stream-mdx/tui @stream-mdx/core @stream-mdx/protocol
```

## NDJSON
```ts
import { NdjsonDecoder, encodeNdjsonEvent } from "@stream-mdx/tui";

const decoder = new NdjsonDecoder();
const chunk = encodeNdjsonEvent({ event: "done" } as any);
const events = decoder.push(chunk);
```

## Snapshot Store
```ts
import { createSnapshotStore } from "@stream-mdx/tui";

const store = createSnapshotStore();
store.applyEvents(events);
const blocks = store.getBlocks();
```

## Notes
- Token output is gated by the worker output mode ("tokens" or "both").
- The store is intended for non-React environments (TUIs, CLIs).

## Docs

- CLI usage: https://github.com/kmccleary3301/stream-mdx/blob/main/docs/CLI_USAGE.md
- Protocol spec: https://github.com/kmccleary3301/stream-mdx/blob/main/docs/STREAMMDX_JSON_DIFF_SPEC.md
- Public API: https://github.com/kmccleary3301/stream-mdx/blob/main/docs/PUBLIC_API.md
npm package: @stream-mdx/worker
Description: Worker client utilities and shared worker helpers for the Streaming Markdown V2 pipeline
Latest version: 0.4.0

# `@stream-mdx/worker`

Worker client utilities and hosted worker bundle used by StreamMDX.

Most consumers interact with this package indirectly via `<StreamingMarkdown />`. You only need `@stream-mdx/worker` directly if you want explicit control over worker instantiation, MDX compilation parity helpers, or strict CSP setups.

## Install

```bash
npm install @stream-mdx/worker
```

## Hosted worker bundle (recommended)

For production, host the worker bundle from static assets (avoids `blob:` CSP requirements):

```bash
mkdir -p public/workers
cp node_modules/@stream-mdx/worker/dist/hosted/markdown-worker.js public/workers/markdown-worker.js
```

Then point StreamMDX at it:

```tsx
<StreamingMarkdown worker="/workers/markdown-worker.js" />
```

## Node / CLI worker threads

To run the hosted worker bundle in Node (e.g., Ink TUIs), use:

```ts
import { createWorkerThread } from "@stream-mdx/worker/node";
```

This spawns a `worker_threads` worker and installs WebWorker-like shims so the hosted bundle can run under Node.

## MDX compilation parity helper

If you compile MDX on the server (e.g. Next.js API route), use the same compilation logic as the worker:

```ts
import { compileMdxContent } from "@stream-mdx/worker/mdx-compile";
```

See the React integration guide for full wiring and parity notes:
https://github.com/kmccleary3301/stream-mdx/blob/main/docs/REACT_INTEGRATION_GUIDE.md

## Docs

- React integration guide: https://github.com/kmccleary3301/stream-mdx/blob/main/docs/REACT_INTEGRATION_GUIDE.md
- Security model / CSP: https://github.com/kmccleary3301/stream-mdx/blob/main/docs/SECURITY_MODEL.md
- Plugins & custom worker bundles: https://github.com/kmccleary3301/stream-mdx/blob/main/docs/STREAMING_MARKDOWN_PLUGINS_COOKBOOK.md
- CLI usage + worker-thread integration: https://github.com/kmccleary3301/stream-mdx/blob/main/docs/CLI_USAGE.md