Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GEN-93: sim-engine migration follow-ups #36

Merged
merged 4 commits into from
Sep 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions .github/licenses/LICENSE-ELASTIC.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Elastic License 2.0

_&lt;<https://www.elastic.co/licensing/elastic-license>&gt;_

## Acceptance

By using the software, you agree to all of the terms and conditions below.

## Copyright License

The licensor grants you a non-exclusive, royalty-free, worldwide,
non-sublicensable, non-transferable license to use, copy, distribute, make
available, and prepare derivative works of the software, in each case subject to
the limitations and conditions below.

## Limitations

You may not provide the software to third parties as a hosted or managed
service, where the service provides users with access to any substantial set of
the features or functionality of the software.

You may not move, change, disable, or circumvent the license key functionality
in the software, and you may not remove or obscure any functionality in the
software that is protected by the license key.

You may not alter, remove, or obscure any licensing, copyright, or other notices
of the licensor in the software. Any use of the licensor’s trademarks is subject
to applicable law.

## Patents

The licensor grants you a license, under any patent claims the licensor can
license, or becomes able to license, to make, have made, use, sell, offer for
sale, import and have imported the software, in each case subject to the
limitations and conditions in this license. This license does not cover any
patent claims that you cause to be infringed by modifications or additions to
the software. If you or your company make any written claim that the software
infringes or contributes to infringement of any patent, your patent license for
the software granted under these terms ends immediately. If your company makes
such a claim, your patent license ends immediately for work on behalf of your
company.

## Notices

You must ensure that anyone who gets a copy of any part of the software from you
also gets a copy of these terms.

If you modify the software, you must include in any modified copies of the
software prominent notices stating that you have modified the software.

## No Other Rights

These terms do not imply any licenses other than those expressly granted in
these terms.

## Termination

If you use the software in violation of these terms, such use is not licensed,
and your licenses will automatically terminate. If the licensor provides you
with a notice of your violation, and you cease all violation of this license no
later than 30 days after you receive that notice, your licenses will be
reinstated retroactively. However, if you violate these terms after such
reinstatement, any additional violation of these terms will cause your licenses
to terminate automatically and permanently.

## No Liability

_As far as the law allows, the software comes as is, without any warranty or
condition, and the licensor will not be liable to you for any damages arising
out of these terms or the use or nature of the software, under any kind of
legal claim._

## Definitions

The **licensor** is the entity offering these terms, and the **software** is the
software the licensor makes available under these terms, including any portion
of it.

**you** refers to the individual or entity agreeing to these terms.

**your company** is any legal entity, sole proprietorship, or other kind of
organization that you work for, plus all organizations that have control over,
are under the control of, or are under common control with that
organization. **control** means ownership of substantially all the assets of an
entity, or the power to direct its management and policies by vote, contract, or
otherwise. Control can be direct or indirect.

**your licenses** are all the licenses granted to you for the software under
these terms.

**use** means anything you do with the software requiring one of your licenses.

**trademark** means trademarks, service marks, and similar rights.
34 changes: 22 additions & 12 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
[apache license 2.0]: https://github.com/hashintel/hash/blob/main/.github/licenses/LICENSE-APACHE.md
[contact us]: https://hash.ai/contact?utm_medium=organic&utm_source=github_license_repo-root-file
[elastic license 2.0]: https://github.com/hashintel/labs/blob/main/.github/licenses/LICENSE-ELASTIC.md
[gnu affero general public license 3.0]: https://github.com/hashintel/hash/blob/main/.github/licenses/LICENSE-AGPL.md
[mit license]: https://github.com/hashintel/hash/blob/main/.github/licenses/LICENSE-MIT.md
[hash license]: https://github.com/hashintel/hash/blob/main/.github/licenses/LICENSE-HASH.md

# License

The `labs` monorepo relies upon multiple different licenses. Source code in this repository is variously licensed under either:
- the [MIT License](https://github.com/hashintel/hash/blob/main/.github/licenses/LICENSE-MIT.md) and [Apache License 2.0](https://github.com/hashintel/hash/blob/main/.github/licenses/LICENSE-APACHE.md) dually (default);
- the [GNU Affero General Public License 3.0](https://github.com/hashintel/hash/blob/main/.github/licenses/LICENSE-AGPL.md); or
- the [Elastic License 2.0](https://github.com/hashintel/hash/blob/main/.github/licenses/LICENSE-ELASTIC.md).
Our `labs` monorepo contains **open-source code** variously licensed under either:
- the [MIT License] and [Apache License 2.0] dually (default);
- the [GNU Affero General Public License 3.0]; or
- the [Elastic License 2.0].

## 1. License Determination

## License Determination
**The following rules apply on the `main` branch only.** The license for a particular work is defined in accordance with the following prioritized rules (precedence established first-to-last):

The license for a particular work is defined with following prioritized rules:
1. **If present:** license information directly present in the work file defines its license;
1. **Else, if:** the work exists directly or indirectly inside a directory titled `_h`, the file is available under the [HASH License] only;
1. **Else, if:** a `LICENSE`, `LICENSE.md` or `LICENSE.txt` file exists in the same directory as the work, this defines its license;
1. **Else, if:** a `LICENSE`, `LICENSE.md` or `LICENSE.txt` file is found when exploring parent directories of the work up to the project top level directory, the first one encountered defines the license applicable to the work;
1. **Otherwise:** by default, the work is dually available under both the [MIT License] and [Apache License 2.0], at your option.

1. License information directly present in the file
1. `LICENSE`, `LICENSE.md` or `LICENSE.txt` file in the same directory as the work
1. First `LICENSE`, `LICENSE.md` or `LICENSE.txt` file found when exploring parent directories up to the project top level directory
1. **On the `main` branch only:** otherwise defaults to dual-release under the MIT License and Apache License 2.0, at your option
No license is granted by HASH to work or files on branches other than `main`.

## Questions
## 2. Questions

If you have any questions please [contact us](https://hash.ai/contact).
If you require an alternative license, or have any other questions, please [contact us].
31 changes: 12 additions & 19 deletions apps/sim-engine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

# HASH Engine

[HASH Engine](https://hash.ai/platform/engine?utm_medium=organic&utm_source=github_readme_engine) (**hEngine**) is the computational simulation engine at the heart of [HASH](https://hash.ai/simulations?utm_medium=organic&utm_source=github_readme_engine). It is publicly and freely available here under the Elastic License.
[HASH Engine](https://hash.ai/platform/engine?utm_medium=organic&utm_source=github_readme_labs-repo_apps-sim-engine) (**hEngine**) is the computational simulation engine at the heart of [HASH](https://hash.ai/simulations?utm_medium=organic&utm_source=github_readme_labs-repo_apps-sim-engine). It is publicly and freely available here under the Elastic License.

This public version of hEngine is our 'alpha' engine whose architecture and performance characteristics differ significantly to the stable engine powering [hCore](https://hash.ai/platform/core?utm_medium=organic&utm_source=github_readme_engine), our in-browser simulation envrionment; and [hCloud](https://hash.ai/platform/cloud?utm_medium=organic&utm_source=github_readme_engine), our cloud simulation compute service. It is not yet stable.
This public version of hEngine is our 'alpha' engine whose architecture and performance characteristics differ significantly to the stable engine powering [hCore](https://hash.ai/platform/core?utm_medium=organic&utm_source=github_readme_labs-repo_apps-sim-engine), our in-browser simulation envrionment; and [hCloud](https://hash.ai/platform/cloud?utm_medium=organic&utm_source=github_readme_labs-repo_apps-sim-engine), our cloud simulation compute service. It is not yet stable.

Our ultimate intention is to migrate both hCore and hCloud to use the engine under development here (upon its first stable release).

Expand Down Expand Up @@ -44,21 +44,21 @@ Our ultimate intention is to migrate both hCore and hCloud to use the engine und

## Issue Tracking

We use [GitHub Issues](https://github.com/hashintel/labs/issues) to help prioritize and track bugs and feature requests. Please use the [HASH Engine Issue form](https://github.com/hashintel/labs/issues/new?assignees=&labels=A-engine%2CC-bug&template=bug-report-hash-engine.yml) to help us deal with your report most effectively. If you're unsure about something or need help, you can also ask questions and get support on our public [Discord server](https://hash.ai/discord?utm_medium=organic&utm_source=github_readme_engine).
We use [GitHub Issues](https://github.com/hashintel/labs/issues) to help prioritize and track bugs and feature requests. Please use the [HASH Engine Issue form](https://github.com/hashintel/labs/issues/new?assignees=&labels=A-engine%2CC-bug&template=bug-report-hash-engine.yml) to help us deal with your report most effectively. If you're unsure about something or need help, you can also ask questions and get support on our public [Discord server](https://hash.ai/discord?utm_medium=organic&utm_source=github_readme_labs-repo_apps-sim-engine).

## Additional Documentation

Our [user guide for simulation](https://hash.ai/docs/simulation?utm_medium=organic&utm_source=github_readme_engine) contains a beginner's introduction as well as in-depth tutorials for **hCore** today.
Our [user guide for simulation](https://hash.ai/docs/simulation?utm_medium=organic&utm_source=github_readme_labs-repo_apps-sim-engine) contains a beginner's introduction as well as in-depth tutorials for **hCore** today.

The [HASH glossary](https://hash.ai/glossary?utm_medium=organic&utm_source=github_readme_engine) contains helpful explainers around key modeling, simulation and AI-related terms and concepts.
The [HASH glossary](https://hash.ai/glossary?utm_medium=organic&utm_source=github_readme_labs-repo_apps-sim-engine) contains helpful explainers around key modeling, simulation and AI-related terms and concepts.

## Questions & Support

We're building a community of people who care about enabling better decision-making through modeling and simulation. Our [support forum](https://hash.community/?utm_medium=organic&utm_source=github_readme_engine) and [HASH community Discord server](https://hash.ai/discord?utm_medium=organic&utm_source=github_readme_engine) (requires login) are both great places to meet other modelers and get help.
We're building a community of people who care about enabling better decision-making through modeling and simulation. Our [support forum](https://hash.community/?utm_medium=organic&utm_source=github_readme_labs-repo_apps-sim-engine) and [HASH community Discord server](https://hash.ai/discord?utm_medium=organic&utm_source=github_readme_labs-repo_apps-sim-engine) (requires login) are both great places to meet other modelers and get help.

## The State of Development

As outlined above, this project is the next-generation of our simulation engine, and differs from the one currently powering [hCore](https://hash.ai/platform/core?utm_medium=organic&utm_source=github_readme_engine) and [hCloud](https://hash.ai/platform/cloud?utm_medium=organic&utm_source=github_readme_engine). It's published here as a pre-release technology preview, and as such the feature-set and codebase should be considered unstable until it's released. That means that there are a number of features you may use on the HASH platform that at present may not be supported by this project, notably:
As outlined above, this project is the next-generation of our simulation engine, and differs from the one currently powering [hCore](https://hash.ai/platform/core?utm_medium=organic&utm_source=github_readme_labs-repo_apps-sim-engine) and [hCloud](https://hash.ai/platform/cloud?utm_medium=organic&utm_source=github_readme_labs-repo_apps-sim-engine). It's published here as a pre-release technology preview, and as such the feature-set and codebase should be considered unstable until it's released. That means that there are a number of features you may use on the HASH platform that at present may not be supported by this project, notably:

- Rust runners, and therefore **Rust behaviors** (which are generally a subset of the @hash behaviors found within hIndex) are currently **disabled**. This is a high-priority item for us and will be one of the main items of development focused on in the near future. A large part of the implementation is finished and can be found in this repository, if you are interested in exploring it (Although as it is _not_ completely finished, expect to find bugs).

Expand Down Expand Up @@ -176,7 +176,7 @@ The ageing simulation increases the age of each agent by one every step. Looking

**Congratulations!** 🎉 , you just ran your first simulation with the hEngine!

[demo simulation]: https://core.hash.ai/@hash/ageing-agents?utm_medium=organic&utm_source=github_readme_engine
[demo simulation]: https://core.hash.ai/@hash/ageing-agents?utm_medium=organic&utm_source=github_readme_labs-repo_apps-sim-engine

## Usage

Expand All @@ -194,7 +194,7 @@ If one of the environment variables shown in the help page is passed, it will ov

> **Warning** - Rust runners are currently not supported. Within your simulation project, you should only see `.js` files within dependencies (for example, dependencies/@hash/age/src/behaviors/age.js). Files ending in `.rs` will be ignored and the run will possibly fail in unclear ways.
>
> Currently, the easiest way to create a project is by using [HASH Core](https://core.hash.ai). In the future, an in-depth description of the expected project structure will be given here instead.
> Currently, the easiest way to create a project is by using [HASH Core](https://hash.ai/platform/core?utm_medium=organic&utm_source=github_readme_labs-repo_apps-sim-engine). In the future, an in-depth description of the expected project structure will be given here instead.

In order to download and run a simulation from HASH Core, use `File -> Export Project` (this is available in the toolbar at the top of the page). For help in finding or creating, and editing, simulations in HASH Core, take a look at our [online documentation][docs]. Then save and unzip the downloaded project to a location of your choice, for example by

Expand Down Expand Up @@ -234,15 +234,15 @@ export GN_ARGS = "v8_enable_pointer_compression=false v8_enable_shared_ro_heap=t
- `v8_enable_pointer_compression` is an optimization reducing RAM usage but limits the heap size to 4 gigabytes.
- `v8_enable_shared_ro_heap` enables read-only memory sharing by V8 isolates. This means, that read-only memory may be shared across different workers for JavaScript. Enabling this is required to compile V8 without pointer compression.

[docs]: https://hash.ai/docs/simulation?utm_medium=organic&utm_source=github_readme_engine
[docs]: https://hash.ai/docs/simulation?utm_medium=organic&utm_source=github_readme_labs-repo_apps-sim-engine

### Simulation Inputs

> **WIP** - This section is a work-in-progress. More in-depth documentation is in the works for describing all input formats and options, and expected project structure. For now, we recommend that you create your simulations within [hCore] and use the "Export Project" functionality.

#### Behavior keys

Behavior keys define the fields, and their respective **data type**, that a behavior accesses on an agent's state. See the [docs](https://hash.ai/docs/simulation/creating-simulations/behaviors/behavior-keys?utm_medium=organic&utm_source=github_readme_engine) for an explanation of behavior keys in general.
Behavior keys define the fields, and their respective **data type**, that a behavior accesses on an agent's state. See the [docs](https://hash.ai/docs/simulation/creating-simulations/behaviors/behavior-keys?utm_medium=organic&utm_source=github_readme_labs-repo_apps-sim-engine) for an explanation of behavior keys in general.

If you haven't created and exported a project from [hCore], it's also possible to manually create the file that specifies the behaviors keys. Generally, every user-defined variable on state (i.e. a behavior key) requires it to be specified within the accompanying `.json` file. The top level JSON object has up to three members, `"keys"`, `"built_in_key_use"`, and `"dynamic_access"`, while the latter two are neither required, nor used currently:

Expand Down Expand Up @@ -353,7 +353,7 @@ The engine (and CLI) currently logs to both stderr, and to the `./log` directory

## Main Concepts

Being familiar with running experiments and simulations on the HASH platform will help a lot with understanding the Engine. The [docs](https://hash.ai/docs/simulation/?utm_medium=organic&utm_source=github_readme_engine) are also a good place to search for clarification on some terms used below when unclear.
Being familiar with running experiments and simulations on the HASH platform will help a lot with understanding the Engine. The [docs](https://hash.ai/docs/simulation/?utm_medium=organic&utm_source=github_readme_labs-repo_apps-sim-engine) are also a good place to search for clarification on some terms used below when unclear.

## The Project Layout

Expand All @@ -373,10 +373,3 @@ Located within [`./bin/cli`](bin/cli), the CLI binary is responsible for the orc
### The Engine Process(es)

Located within [`./bin/hash_engine`](bin/hash_engine), the HASH Engine binary implements all of the logic required for running a single experiment and its one or more simulations.

## Contributors

hEngine is under active development. Its primary contributors are:

- [Tim Diekmann](https://hash.ai/@timdiekmann) - HASH
- [Alfie Mountfield](https://hash.ai/@alfie) - HASH