Skip to content

Commit 228f115

Browse files
denishacquinDen
and
Den
authored
feat: rename simulator to studio and handle hosted environment (#592)
* update copy * update plausible domain * simplify router * add catch all route to handle redirects * disabled validator add/edit/delete if not on localnetwork * use hostname for condition, add unit test * normalize use of capital S for Studio * fix url in unit text to avoid security flag * re-update studio url in env example * setup hosted env variable for frontend and use it instead of URL detection * remove whitespace failing pre-commit --------- Co-authored-by: Den <den@Deniss-MacBook-Pro.local>
1 parent 69d16e2 commit 228f115

File tree

24 files changed

+104
-46
lines changed

24 files changed

+104
-46
lines changed

.env.example

+3-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ HEURISTAIAPIKEY = '<add_your_heuristai_api_key_here>'
6060
# Front end container details
6161
VITE_JSON_RPC_SERVER_URL = 'http://127.0.0.1:4000/api' # if VITE_PROXY_ENABLED = 'true' change to '/api'
6262
VITE_WS_SERVER_URL = 'ws://127.0.0.1:4000' # if VITE_PROXY_ENABLED = 'true' change to '/'
63-
VITE_PLAUSIBLE_DOMAIN = 'simulator.genlayer.com'
63+
VITE_PLAUSIBLE_DOMAIN = 'studio.genlayer.com'
64+
VITE_IS_HOSTED=false
65+
6466
FRONTEND_PORT = '8080'
6567
FRONTEND_BUILD_TARGET = 'final' # change to 'dev' to run in dev mode
6668

.github/workflows/openhands.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
if: |
1919
${{
2020
github.event.label.name == 'fix-me' ||
21-
(github.event_name == 'issue_comment' &&
21+
(github.event_name == 'issue_comment' &&
2222
startsWith(github.event.comment.body, vars.OPENHANDS_MACRO || '@openhands-agent') &&
2323
(github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'COLLABORATOR' || github.event.comment.author_association == 'MEMBER'))
2424
}}

CONTRIBUTING.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
# Contributing to GenLayer Simulator
1+
# Contributing to GenLayer Studio
22

3-
We're thrilled that you're interested in contributing to the GenLayer Simulator! This document will guide you through the contribution process.
3+
We're thrilled that you're interested in contributing to the GenLayer Studio! This document will guide you through the contribution process.
44

5-
## What is the GenLayer Simulator?
5+
## What is the GenLayer Studio?
66

7-
The GenLayer Simulator is an interactive sandbox designed for developers to explore the potential of GenLayer's Intelligent Contracts. It replicates the GenLayer network's execution environment and consensus algorithm, providing a controlled and local environment to test different ideas and behaviors.
7+
The GenLayer Studio is an interactive sandbox designed for developers to explore the potential of GenLayer's Intelligent Contracts. It replicates the GenLayer network's execution environment and consensus algorithm, providing a controlled and local environment to test different ideas and behaviors.
88

99
## How You Can Contribute?
1010

11-
Contributions to the GenLayer Simulator are welcome in several forms:
11+
Contributions to the GenLayer Studio are welcome in several forms:
1212

13-
### Testing the Simulator and Providing Feedback
13+
### Testing the Studio and Providing Feedback
1414

15-
Help us make the simulator better by testing and giving feedback:
15+
Help us make the Studio better by testing and giving feedback:
1616

17-
- Start installing the simulator using the GenLayer [CLI](https://github.com/yeagerai/genlayer-simulator?tab=readme-ov-file#quick-install).
18-
- Try out the Simulator features and tell us what you think through our [feedback form](https://docs.google.com/forms/d/1IVNsZwm936kSNCiXmlAP8bgJnbik7Bqaoc3I6UYhr-o/viewform) or on our [Discord Channel](https://discord.gg/8Jm4v89VAu).
17+
- Start installing the Studio using the GenLayer [CLI](https://github.com/yeagerai/genlayer-simulator?tab=readme-ov-file#quick-install).
18+
- Try out the Studio features and tell us what you think through our [feedback form](https://docs.google.com/forms/d/1IVNsZwm936kSNCiXmlAP8bgJnbik7Bqaoc3I6UYhr-o/viewform) or on our [Discord Channel](https://discord.gg/8Jm4v89VAu).
1919
- If you find any issues, please report them on our [GitHub issues page](https://github.com/yeagerai/genlayer-simulator/issues).
2020

2121
### Sharing New Ideas and Use Cases
2222

2323
Have ideas for new features or use cases? We're eager to hear them! But first:
2424

25-
- Ensure you have the [Simulator installed](https://github.com/yeagerai/genlayer-simulator?tab=readme-ov-file#quick-install) first to explore existing use cases.
26-
- After familiarizing yourself with the simulator, contribute your unique use case and share your ideas in our [Discord channel](https://discord.gg/8Jm4v89VAu).
25+
- Ensure you have the [Studio installed](https://github.com/yeagerai/genlayer-simulator?tab=readme-ov-file#quick-install) first to explore existing use cases.
26+
- After familiarizing yourself with the Studio, contribute your unique use case and share your ideas in our [Discord channel](https://discord.gg/8Jm4v89VAu).
2727

2828
### Bug fixing and Feature development
2929

@@ -33,7 +33,7 @@ Have ideas for new features or use cases? We're eager to hear them! But first:
3333

3434
- **1.2. Create a branch**: create the branch that you will work on by using the link provided in the issue details page (right panel at the bottom - section "Development")
3535

36-
- **1.3. Setup the Simulator locally**: launch the simulator's frontend and backend by running the docker compose command (Please note that you must have docker, node, and npm installed)
36+
- **1.3. Setup the Studio locally**: launch the Studio's frontend and backend by running the docker compose command (Please note that you must have docker, node, and npm installed)
3737

3838
```sh
3939
$ cp .env.example .env
@@ -90,4 +90,4 @@ Connect with the GenLayer community to discuss, collaborate, and share insights:
9090
- **[Discord Channel](https://discord.gg/8Jm4v89VAu)**: Our primary hub for discussions, support, and announcements.
9191
- **[Telegram Group](https://t.me/genlayer)**: For more informal chats and quick updates.
9292

93-
Your continuous feedback drives better product development. Please engage with us regularly to test, discuss, and improve the GenLayer Simulator.
93+
Your continuous feedback drives better product development. Please engage with us regularly to test, discuss, and improve the GenLayer Studio.

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# GenLayer Simulator
1+
# GenLayer Studio
22

33
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/license/mit/) [![Discord](https://dcbadge.vercel.app/api/server/8Jm4v89VAu?compact=true&style=flat)](https://discord.gg/VpfmXEMN66) [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/yeagerai.svg?style=social&label=Follow%20%40GenLayer)](https://x.com/GenLayer) [![GitHub star chart](https://img.shields.io/github/stars/yeagerai/genlayer-simulator?style=social)](https://star-history.com/#yeagerai/genlayer-simulator)
44

55
## 👀 About
66

7-
This Simulator is an interactive sandbox designed for developers to explore the potential of the [GenLayer Protocol](https://genlayer.com/). It replicates the GenLayer network's execution environment and consensus algorithm, but offers a controlled and local environment to test different ideas and behaviors.
7+
This Studio is an interactive sandbox designed for developers to explore the potential of the [GenLayer Protocol](https://genlayer.com/). It replicates the GenLayer network's execution environment and consensus algorithm, but offers a controlled and local environment to test different ideas and behaviors.
88

99
## Prerequisites
1010
Before installing the GenLayer CLI, ensure you have the following prerequisites installed:
@@ -24,18 +24,18 @@ To run genlayer again just run:
2424
```
2525
$ genlayer up
2626
```
27-
After executing those commands a new tab will open in your browser with the GenLayer Simulator. Additional installation instructions can be found [here](https://docs.genlayer.com/simulator/installation)
27+
After executing those commands a new tab will open in your browser with the GenLayer Studio. Additional installation instructions can be found [here](https://docs.genlayer.com/simulator/installation)
2828

2929
## 🚀 Key Features
3030
* 🖥️ **Test Locally:** Developers can test Intelligent Contracts in a local environment, replicating the GenLayer network without the need for deployment. This speeds up the development cycle and reduces the risk of errors in the live environment.
3131

32-
* 🧪 **Versatile Scenario Testing:** The simulator allows developers to create and test contracts under various simulated network conditions. This includes stress testing under high transaction loads, simulating network delays, and testing different consensus outcomes.
32+
* 🧪 **Versatile Scenario Testing:** The Studio allows developers to create and test contracts under various simulated network conditions. This includes stress testing under high transaction loads, simulating network delays, and testing different consensus outcomes.
3333

34-
* 🔄 **Changeable LLM Validators:** Developers can modify the large language models (LLMs) used by validators within the simulator. This allows for testing of security, efficiency, and accuracy by running different LLMs to validate transactions.
34+
* 🔄 **Changeable LLM Validators:** Developers can modify the large language models (LLMs) used by validators within the Studio. This allows for testing of security, efficiency, and accuracy by running different LLMs to validate transactions.
3535

3636

3737
## 📖 The Docs
38-
Detailed information of how to use the simulator can be found at [GenLayer Docs](https://docs.genlayer.com/).
38+
Detailed information of how to use the Studio can be found at [GenLayer Docs](https://docs.genlayer.com/).
3939

4040

4141
## Contributing

backend/database_handler/migration/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
### Window One
44

5-
1. Launch the simulator
5+
1. Launch the Studio
66

77
### Window Two
88

backend/node/create_nodes/providers_schema.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"type": "object"
1515
},
1616
"plugin": {
17-
"$comment": "plugin to be loaded by the simulator to interact with the provider",
17+
"$comment": "Plugin to be loaded by the Studio to interact with the provider",
1818
"enum": ["openai", "ollama", "anthropic"]
1919
},
2020
"plugin_config": {

decisions/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Decisions documentation
22

3-
Greatly inspired by ADRs, this directory contains important decisions about the `simulator` code.
3+
Greatly inspired by ADRs, this directory contains important decisions about the `Studio` code.
44

55
# Index
66

docker-compose.yml

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ services:
44
context: ./
55
dockerfile: ./docker/Dockerfile.frontend
66
target: ${FRONTEND_BUILD_TARGET:-final}
7+
args:
8+
- VITE_*
79
ports:
810
- "${FRONTEND_PORT}:8080"
911
volumes:
@@ -14,6 +16,8 @@ services:
1416
condition: service_healthy
1517
expose:
1618
- "${FRONTEND_PORT}"
19+
environment:
20+
- VITE_*
1721

1822
jsonrpc:
1923
build:

docker/Dockerfile.frontend

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ COPY ./frontend/package*.json .
55
RUN --mount=type=cache,target=/root/.npm npm ci
66
COPY ./frontend .
77
COPY ./examples src/assets/examples
8-
COPY ./.env .
8+
COPY ./.env ./.env
99
COPY ../backend/node/create_nodes/providers_schema.json /app/src/assets/schemas/providers_schema.json
1010

1111

frontend/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# genlayer-simulator
1+
# genlayer-studio
22

33
This template should help get you started developing with Vue 3 in Vite.
44

frontend/src/assets/main.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
@layer components {
1818
.input-style {
19-
@apply flex w-full rounded-md border-0 py-1.5 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-accent hover:focus:ring-accent sm:text-sm sm:leading-6 dark:bg-zinc-800 dark:text-white;
19+
@apply flex w-full rounded-md border-0 py-1.5 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-accent hover:focus:ring-accent disabled:opacity-50 sm:text-sm sm:leading-6 dark:bg-zinc-800 dark:text-white;
2020
}
2121
}
2222

frontend/src/assets/schemas/providers_schema.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"type": "object"
1515
},
1616
"plugin": {
17-
"$comment": "plugin to be loaded by the simulator to interact with the provider",
17+
"$comment": "Plugin to be loaded by the Studio to interact with the provider",
1818
"enum": ["openai", "ollama", "anthropic"]
1919
},
2020
"plugin_config": {

frontend/src/components/Simulator/HomeTab.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const hasAnySampleContract = computed(() => {
5656
class="rounded-md bg-slate-50 p-4 @[1024px]:p-8 dark:bg-slate-600 dark:bg-opacity-10"
5757
>
5858
<h1 class="mb-4 text-lg font-semibold">
59-
Welcome to the GenLayer Simulator
59+
Welcome to the GenLayer Studio
6060
</h1>
6161

6262
<div class="text-sm">
@@ -66,7 +66,7 @@ const hasAnySampleContract = computed(() => {
6666
natural language.
6767
</p>
6868
<p class="my-2">
69-
This Simulator is an interactive sandbox for developers to explore
69+
This Studio is an interactive sandbox for developers to explore
7070
GenLayer’s Intelligent Contracts. It mirrors the GenLayer
7171
network’s environment and consensus, allowing you to test ideas
7272
locally.
@@ -107,7 +107,7 @@ const hasAnySampleContract = computed(() => {
107107

108108
<div class="text-sm">
109109
<Alert info class="mt-4">
110-
The simulator currently does not support token transfers,
110+
The Studio currently does not support token transfers,
111111
contract-to-contract interactions, or gas consumption. These
112112
features will be added in future updates.
113113
</Alert>

frontend/src/components/Simulator/ValidatorItem.vue

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ import ValidatorModal from '@/components/Simulator/ValidatorModal.vue';
1010
import { ref } from 'vue';
1111
import { useNodeStore } from '@/stores';
1212
import { notify } from '@kyvg/vue3-notification';
13+
import { useConfig } from '@/hooks';
1314
1415
const nodeStore = useNodeStore();
16+
const { canUpdateValidators } = useConfig();
1517
1618
const isUpdateModalMopen = ref(false);
1719
const showConfirmDelete = ref(false);
@@ -75,7 +77,10 @@ async function handleDeleteValidator() {
7577
</span>
7678
</div>
7779

78-
<div class="hidden flex-row gap-1 group-hover:flex">
80+
<div
81+
v-if="canUpdateValidators"
82+
class="hidden flex-row gap-1 group-hover:flex"
83+
>
7984
<button
8085
@click.stop="isUpdateModalMopen = true"
8186
v-tooltip="'Update Validator'"

frontend/src/components/Simulator/ValidatorModal.vue

+8-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import NumberInput from '@/components/global/inputs/NumberInput.vue';
1212
import TextAreaInput from '@/components/global/inputs/TextAreaInput.vue';
1313
import FieldError from '@/components/global/fields/FieldError.vue';
1414
import FieldLabel from '@/components/global/fields/FieldLabel.vue';
15-
import { useEventTracking } from '@/hooks';
15+
import { useEventTracking, useConfig } from '@/hooks';
1616
import CopyTextButton from '../global/CopyTextButton.vue';
1717
import { uniqBy } from 'lodash-es';
1818
import Alert from '../global/Alert.vue';
@@ -22,6 +22,7 @@ const { trackEvent } = useEventTracking();
2222
const emit = defineEmits(['close']);
2323
const error = ref('');
2424
const isLoading = ref(false);
25+
const { canUpdateValidators } = useConfig();
2526
2627
const props = defineProps<{
2728
validator?: ValidatorModel;
@@ -294,6 +295,7 @@ const isStakeValid = computed(() => {
294295
v-model="newValidatorData.stake"
295296
required
296297
testId="input-stake"
298+
:disabled="!canUpdateValidators"
297299
/>
298300

299301
<FieldError v-if="!isStakeValid"
@@ -310,14 +312,17 @@ const isStakeValid = computed(() => {
310312
:cols="60"
311313
v-model="newValidatorData.config"
312314
:invalid="!isConfigValid"
315+
:disabled="!canUpdateValidators"
313316
/>
314317
<FieldError v-if="!isConfigValid">Please enter valid JSON.</FieldError>
315318
</div>
316319

317320
<Alert error v-if="error" type="error">{{ error }}</Alert>
318321

322+
<Btn v-if="!canUpdateValidators" @click="emit('close')">Close</Btn>
323+
319324
<Btn
320-
v-if="isCreateMode"
325+
v-else-if="isCreateMode"
321326
@click="handleCreateValidator"
322327
:disabled="!validatorModelValid"
323328
testId="btn-create-validator"
@@ -327,7 +332,7 @@ const isStakeValid = computed(() => {
327332
</Btn>
328333

329334
<Btn
330-
v-if="!isCreateMode && validator"
335+
v-else-if="!isCreateMode && validator"
331336
@click="handleUpdateValidator(validator)"
332337
:disabled="!validatorModelValid"
333338
testId="btn-update-validator"

frontend/src/components/Simulator/settings/SimulatorSection.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const handleResetStorage = async () => {
5858
:dangerous="true"
5959
:confirming="isResetting"
6060
>
61-
<template #title>Reset Simulator Storage</template>
61+
<template #title>Reset Studio Storage</template>
6262
<template #description
6363
>Are you sure? All the examples will be restored, and the following
6464
intelligent contracts will be removed.</template

frontend/src/components/Tutorial/TutorialContainer.vue

+7-4
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,21 @@ import { DEFAULT_OPTIONS, KEYS } from './constants';
44
import TutorialStep from './TutorialStep.vue';
55
import { useContractsStore, useTutorialStore, useUIStore } from '@/stores';
66
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
7+
import { useConfig } from '@/hooks';
78
89
const contractsStore = useContractsStore();
910
const tutorialStore = useTutorialStore();
1011
const uiStore = useUIStore();
1112
const router = useRouter();
13+
const { canUpdateValidators } = useConfig();
1214
1315
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
1416
1517
const steps = ref([
1618
{
1719
target: '#tutorial-welcome',
1820
header: {
19-
title: 'Welcome to the GenLayer Simulator!',
21+
title: 'Welcome to the GenLayer Studio!',
2022
},
2123
content: 'This tutorial will guide you through the basics.',
2224
@@ -101,8 +103,9 @@ const steps = ref([
101103
title: 'Validators',
102104
},
103105
target: '#tutorial-validators',
104-
content:
105-
'Configure the number of validators and set up their parameters here.',
106+
content: canUpdateValidators
107+
? 'Configure the number of validators and set up their parameters here.'
108+
: 'Here you can see the validators that are currently running on the network.',
106109
placement: 'right',
107110
},
108111
{
@@ -111,7 +114,7 @@ const steps = ref([
111114
},
112115
target: '#tutorial-end',
113116
content:
114-
"You've completed the GenLayer Simulator tutorial. Feel free to revisit any step or start experimenting with your own contracts. Happy coding!",
117+
"You've completed the GenLayer Studio tutorial. Feel free to revisit any step or start experimenting with your own contracts. Happy coding!",
115118
},
116119
]);
117120

frontend/src/hooks/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ export * from './useInputMap';
88
export * from './useContractQueries';
99
export * from './useFileName';
1010
export * from './useSetupStores';
11+
export * from './useConfig';
1112
export * from './useTransactionListener';

frontend/src/hooks/useConfig.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export const useConfig = () => {
2+
const isHostedEnvironment = import.meta.env.VITE_IS_HOSTED === 'true';
3+
const canUpdateValidators = !isHostedEnvironment;
4+
5+
return {
6+
canUpdateValidators,
7+
};
8+
};

frontend/src/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ app.use(VueSpinnersPlugin);
3535

3636
const plausible = createPlausible({
3737
init: {
38-
domain: import.meta.env.VITE_PLAUSIBLE_DOMAIN || 'simulator.genlayer.com',
38+
domain: import.meta.env.VITE_PLAUSIBLE_DOMAIN || 'studio.genlayer.com',
3939
trackLocalhost: true,
4040
},
4141
settings: {

frontend/src/router/index.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ import SettingsView from '@/views/Simulator/SettingsView.vue';
88
const router = createRouter({
99
history: createWebHistory(import.meta.env.BASE_URL),
1010
routes: [
11-
{ path: '/', redirect: { name: 'contracts' } },
1211
{
13-
path: '/simulator',
12+
path: '/',
13+
redirect: { name: 'contracts' },
1414
component: SimulatorView,
1515
children: [
16-
{ path: '', redirect: { name: 'contracts' } },
1716
{
1817
path: 'contracts',
1918
name: 'contracts',
@@ -40,6 +39,10 @@ const router = createRouter({
4039
},
4140
],
4241
},
42+
{
43+
path: '/:pathMatch(.*)*',
44+
redirect: '/',
45+
},
4346
],
4447
});
4548

0 commit comments

Comments
 (0)