open-index/open-npm huggingface dataset:
npm package: @fluencelabs/avm-runner-background
Description: AVM runner implementation which executed in the background
Author: Fluence Labs
Latest version: 0.2.0

# AVM runner implementation which executes in the background.

`AvmRunnerBackground` is the implementation of AVM Runner which doesn't block main thread and runs in the background.

AVM Runner is the abstraction over Aqua Virtual Machine (AVM). It is allows to run AVM in different contexts, e.g. web workers in browsers or worker threads on nodejs.

## Getting started

To use `AvmRunnerBackground` with Fluence JS refer to the [documentation](https://doc.fluence.dev/docs/fluence-js)

## Overview

The project relies heavily on [threads.js](https://github.com/andywer/threads.js). It takes advantage of the unified abstraction to run the same script in both web workers and worker threads. Two script versions (one for nodejs and one for web) are embedded as base64 in code. The hosts pick one corresponding to the environment and loads it as blob URLs.

The worker script source can be found in the [runner-script](../runner-script/README.md) directory

AVM wasm file is required to run worker. It is not bundled and provided by `@fluencelabs/avm` package. The loading methods are different for nodejs and web environments:

-   node: wasm file is loaded from the filesystem. By default the runner locates in the node_modules.
-   web: wasm file is loaded from the server via http request. The end-user is responsible for web server configuration. `@fluencelabs/avm` provides `copyAvm` binary which helps distributing the wasm file.

## Building

First you need to build the runner script:

```
./build_runner.sh
```

Then build the npm package:

```
npm install
npm run build
```

## License

[Apache 2.0](LICENSE)
npm package: @fluencelabs/avm-runner-node
Description: AVM runner implementation for nodejs based on worker threads
Author: Fluence Labs
Latest version: 0.3.0

# AVM runner implementation for nodejs

AVM runner is the abstraction over Aqua virtual machine (AVM) interpreter designed to allow run it in different contexts such as web workers in browsers or worker threads on nodejs.

The package provides implementation for nodejs based on worker threads.

## Usage

To use `AvmRunnerBackground` with Fluence JS refer to the official [documentation](https://doc.fluence.dev/docs/fluence-js/3_in_depth#running-avm-in-background)

## Building

First you need to build the runner script:

```
./build_runner.sh
```

Then build the npm package:

```
npm install
npm run build
```

## Running test

Tests are located in the same package. To run tests:

```
npm run test
```

## License

[Apache 2.0](LICENSE)
npm package: @fluencelabs/avm-runner-web
Description: AVM runner implementation for browsers based on web workers
Author: Fluence Labs
Latest version: 0.3.0

# AVM runner implementation for web browsers

AVM runner is the abstraction over Aqua virtual machine (AVM) interpreter designed to allow run it in different contexts such as web workers in browsers or worker threads on nodejs.

The package provides implementation for web browsers based on web workers.

## Usage

To use `AvmRunnerBackground` with Fluence JS refer to the official [documentation](https://doc.fluence.dev/docs/fluence-js/3_in_depth#running-avm-in-background)

## Building

First you need to build the runner script:

```
./build_runner.sh
```

Then build the npm package:

```
npm install
npm run build
```

## Running tests

The browser tests are run with puppeteer to insure they are executed in the same environment as browser itself

First, build the avm-runner-web (see Building)

Go to the test project:

```
cd ../avm-runner-web-test
```

Build the browser script with the tests:

```
./build_browser_script.sh
```

Run the tests:

```
npm install
npm run test
```

## License

[Apache 2.0](LICENSE)
npm package: @fluencelabs/avm-worker-common
Description: Commons for AVM Worker
Author: Fluence Labs
Latest version: 0.1.0

# AVM Worker common types

[![npm](https://img.shields.io/npm/v/@fluencelabs/avm-worker-common)](https://www.npmjs.com/package/@fluencelabs/avm-worker-common)

AVM Worker is the abstraction over Aqua virtual machine (AVM) interpreter designed to allow run it in different contexts such as web workers in browsers or worker threads on nodejs. 

The package provides common interface for AVM worker implementation as well as necessary TypeScript definitions.

## Getting started

The main exports of the package is the AVM worker type :

```typescript
export type AvmWorker = {
    init: (logLevel: LogLevel) => Promise<void>;
    terminate: () => Promise<void>;
    run: (
        air: string,
        prevData: Uint8Array,
        data: Uint8Array,
        params: {
            initPeerId: string;
            currentPeerId: string;
        },
        callResults: CallResultsArray,
    ) => Promise<InterpreterResult>;
};
```

To make a custom AVM worker three functions has to be implemented:

* init - should allocate any resources needed for AVM worker (such as AVM interpreter memory or background worker state)
* terminate - should deallocate all the resources used by the AVM worker
* run - should pass the particle execution to actual AVM interpreter running in the context of implementation

## Available implementations:

-   Single-threaded, ui-blocking: [@fluencelabs/avm-worker](https://github.com/fluencelabs/avm-worker)
-   Web workers based for browsers: [@fluencelabs/avm-worker-web](https://github.com/fluencelabs/avm-worker-background/tree/main/avm-worker-node)
-   Worker threads based for nodejs: [@fluencelabs/avm-worker-node](https://github.com/fluencelabs/avm-worker-background/tree/main/avm-worker-node)

## Contributing

While the project is still in the early stages of development, you are welcome to track progress and contribute. As the project is undergoing rapid changes, interested contributors should contact the team before embarking on larger pieces of work. All contributors should consult with and agree to our [basic contributing rules](CONTRIBUTING.md).

## License

[Apache 2.0](LICENSE)
npm package: @fluencelabs/avm-worker-node
Description: AVM Worker implementation with worker threads
Author: Fluence Labs
Latest version: 0.2.0

# AVM Worker implementation for nodejs

AVM Worker is the abstraction over Aqua virtual machine (AVM) interpreter designed to allow run it in different contexts such as web workers in browsers or worker threads on nodejs.

The package provides implementation for nodejs based on worker threads.

## Usage

To use `BackgroundWorker` with Fluence JS refer to the official [documentation](https://doc.fluence.dev/docs/fluence-js/3_in_depth#running-avm-in-background)

## Building

First you need to build the worker script:

```
./build_worker.sh
```

Then build the npm package:

```
npm install
npm run build
```

## Running test

Tests are located in the same package. To run tests:

```
npm run test
```

## License

[Apache 2.0](LICENSE)
npm package: @fluencelabs/connection
Description: Fluence connection
Author: Fluence Labs
Latest version: 0.2.0

# FluenceJS connection

This package is a part of FluenceJS, the official implementation of the Fluence Peer in typescript. See the [FluenceJS repo](https://github.com/fluencelabs/fluence-js) for more info

## Contributing

While the project is still in the early stages of development, you are welcome to track progress and contribute. As the project is undergoing rapid changes, interested contributors should contact the team before embarking on larger pieces of work. All contributors should consult with and agree to our [basic contributing rules](CONTRIBUTING.md).

## License

[Apache 2.0](LICENSE)