genlayer 0.0.27 → 0.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
 
2
2
 
3
+ ## 0.0.28 (2024-05-13)
4
+
3
5
  ## 0.0.27 (2024-05-08)
4
6
 
5
7
  ## 0.0.26 (2024-05-07)
package/dist/index.js CHANGED
@@ -39896,7 +39896,7 @@ var {
39896
39896
  } = import_index.default;
39897
39897
 
39898
39898
  // package.json
39899
- var version = "0.0.27";
39899
+ var version = "0.0.28";
39900
39900
 
39901
39901
  // src/lib/config/text.ts
39902
39902
  var CLI_DESCRIPTION = "GenLayer CLI is a development environment for the GenLayer ecosystem. It allows developers to interact with the protocol by creating accounts, sending transactions, and working with Intelligent Contracts by testing, debugging, and deploying them.";
@@ -42497,16 +42497,16 @@ var DEFAULT_RUN_SIMULATOR_COMMAND = (simulatorLocation) => ({
42497
42497
  linux: `x-terminal-emulator -e bash -c 'cd ${simulatorLocation} && docker compose build && docker compose up; echo "Press enter to exit"; read'`
42498
42498
  });
42499
42499
  var DEFAULT_PULL_OLLAMA_COMMAND = (simulatorLocation) => ({
42500
- darwin: `osascript -e 'tell application "Terminal" to do script "cd ${simulatorLocation} && docker exec ollama ollama pull llama2"'`,
42501
- win32: `start cmd.exe /c "cd /d ${simulatorLocation} && docker exec ollama ollama pull llama2"`,
42502
- linux: `x-terminal-emulator -e bash -c 'cd ${simulatorLocation} && docker exec ollama ollama pull llama2'`
42500
+ darwin: `cd ${simulatorLocation} && docker exec ollama ollama pull llama3`,
42501
+ win32: `cd /d ${simulatorLocation} && docker exec ollama ollama pull llama3`,
42502
+ linux: `cd ${simulatorLocation} && docker exec ollama ollama pull llama3`
42503
42503
  });
42504
42504
  var AVAILABLE_PLATFORMS = ["darwin", "win32", "linux"];
42505
42505
  var STARTING_TIMEOUT_WAIT_CYLCE = 2e3;
42506
42506
  var STARTING_TIMEOUT_ATTEMPTS = 120;
42507
42507
  var AI_PROVIDERS_CONFIG = {
42508
42508
  ollama: {
42509
- name: "Ollama (This will download and run a local instance of Llama 2)",
42509
+ name: "Ollama (This will download and run a local instance of Llama 3)",
42510
42510
  cliOptionValue: "ollama"
42511
42511
  },
42512
42512
  openai: {
@@ -44381,7 +44381,6 @@ function checkCommand(command, toolName) {
44381
44381
  if (stderr) {
44382
44382
  throw new MissingRequirementError(toolName);
44383
44383
  }
44384
- console.log(`${toolName} is installed.`);
44385
44384
  });
44386
44385
  }
44387
44386
  function executeCommand(cmdsByPlatform, toolName) {
@@ -44529,7 +44528,7 @@ function waitForSimulatorToBeReady() {
44529
44528
  return waitForSimulatorToBeReady(retries - 1);
44530
44529
  }
44531
44530
  } catch (error) {
44532
- if ((error.message.includes("ECONNREFUSED") || error.message.includes("socket hang up")) && retries > 0) {
44531
+ if ((error.message.includes("ECONNRESET") || error.message.includes("ECONNREFUSED") || error.message.includes("socket hang up")) && retries > 0) {
44533
44532
  yield sleep(STARTING_TIMEOUT_WAIT_CYLCE * 2);
44534
44533
  return waitForSimulatorToBeReady(retries - 1);
44535
44534
  }
@@ -44548,8 +44547,8 @@ function initializeDatabase() {
44548
44547
  return { createResponse, tablesResponse };
44549
44548
  });
44550
44549
  }
44551
- function createRandomValidators() {
44552
- return rpcClient.request({ method: "create_random_validators", params: [10, 1, 10] });
44550
+ function createRandomValidators(numValidators) {
44551
+ return rpcClient.request({ method: "create_random_validators", params: [numValidators, 1, 10] });
44553
44552
  }
44554
44553
  function deleteAllValidators() {
44555
44554
  return rpcClient.request({ method: "delete_all_validators", params: [] });
@@ -44691,7 +44690,7 @@ function initAction(options) {
44691
44690
  return;
44692
44691
  }
44693
44692
  if (selectedLlmProviders.includes("ollama")) {
44694
- console.log("Pulling llama2 from Ollama...");
44693
+ console.log("Pulling llama3 from Ollama...");
44695
44694
  yield pullOllamaModel();
44696
44695
  }
44697
44696
  console.log("Initializing the database...");
@@ -44709,7 +44708,7 @@ function initAction(options) {
44709
44708
  console.log("Initializing validators...");
44710
44709
  try {
44711
44710
  yield deleteAllValidators();
44712
- yield createRandomValidators();
44711
+ yield createRandomValidators(Number(options.numValidators));
44713
44712
  } catch (error) {
44714
44713
  console.error("Unable to initialize the validators.");
44715
44714
  console.error(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genlayer",
3
- "version": "0.0.27",
3
+ "version": "0.0.28",
4
4
  "description": "GenLayer Command Line Tool",
5
5
  "main": "src/index.ts",
6
6
  "bin": {
@@ -162,7 +162,7 @@ export async function initAction(options: InitActionOptions) {
162
162
 
163
163
  // Ollama doesn't need changes in configuration, we just run it
164
164
  if (selectedLlmProviders.includes("ollama")) {
165
- console.log("Pulling llama2 from Ollama...");
165
+ console.log("Pulling llama3 from Ollama...");
166
166
  await pullOllamaModel();
167
167
  }
168
168
 
@@ -188,7 +188,7 @@ export async function initAction(options: InitActionOptions) {
188
188
  //remove all validators
189
189
  await deleteAllValidators();
190
190
  // create random validators
191
- await createRandomValidators();
191
+ await createRandomValidators(Number(options.numValidators));
192
192
  } catch (error) {
193
193
  console.error("Unable to initialize the validators.");
194
194
  console.error(error);
@@ -13,7 +13,6 @@ export async function checkCommand(command: string, toolName: string): Promise<v
13
13
  if (stderr) {
14
14
  throw new MissingRequirementError(toolName);
15
15
  }
16
- console.log(`${toolName} is installed.`);
17
16
  }
18
17
 
19
18
  type ExecuteCommandResult = {
@@ -6,9 +6,9 @@ export const DEFAULT_RUN_SIMULATOR_COMMAND = (simulatorLocation: string) => ({
6
6
  linux: `x-terminal-emulator -e bash -c 'cd ${simulatorLocation} && docker compose build && docker compose up; echo "Press enter to exit"; read'`,
7
7
  });
8
8
  export const DEFAULT_PULL_OLLAMA_COMMAND = (simulatorLocation: string) => ({
9
- darwin: `osascript -e 'tell application "Terminal" to do script "cd ${simulatorLocation} && docker exec ollama ollama pull llama2"'`,
10
- win32: `start cmd.exe /c "cd /d ${simulatorLocation} && docker exec ollama ollama pull llama2"`,
11
- linux: `x-terminal-emulator -e bash -c 'cd ${simulatorLocation} && docker exec ollama ollama pull llama2'`,
9
+ darwin: `cd ${simulatorLocation} && docker exec ollama ollama pull llama3`,
10
+ win32: `cd /d ${simulatorLocation} && docker exec ollama ollama pull llama3`,
11
+ linux: `cd ${simulatorLocation} && docker exec ollama ollama pull llama3`,
12
12
  });
13
13
  export const AVAILABLE_PLATFORMS = ["darwin", "win32", "linux"] as const;
14
14
  export type RunningPlatform = (typeof AVAILABLE_PLATFORMS)[number];
@@ -23,7 +23,7 @@ export type AiProvidersConfigType = {
23
23
 
24
24
  export const AI_PROVIDERS_CONFIG: AiProvidersConfigType = {
25
25
  ollama: {
26
- name: "Ollama (This will download and run a local instance of Llama 2)",
26
+ name: "Ollama (This will download and run a local instance of Llama 3)",
27
27
  cliOptionValue: "ollama",
28
28
  },
29
29
  openai: {
@@ -159,7 +159,12 @@ export async function waitForSimulatorToBeReady(
159
159
  return waitForSimulatorToBeReady(retries - 1);
160
160
  }
161
161
  } catch (error: any) {
162
- if ((error.message.includes("ECONNREFUSED") || error.message.includes("socket hang up")) && retries > 0) {
162
+ if (
163
+ (error.message.includes("ECONNRESET") ||
164
+ error.message.includes("ECONNREFUSED") ||
165
+ error.message.includes("socket hang up")) &&
166
+ retries > 0
167
+ ) {
163
168
  await sleep(STARTING_TIMEOUT_WAIT_CYLCE * 2);
164
169
  return waitForSimulatorToBeReady(retries - 1);
165
170
  }
@@ -184,8 +189,8 @@ export async function initializeDatabase(): Promise<InitializeDatabaseResultType
184
189
  return {createResponse, tablesResponse};
185
190
  }
186
191
 
187
- export function createRandomValidators(): Promise<any> {
188
- return rpcClient.request({method: "create_random_validators", params: [10, 1, 10]});
192
+ export function createRandomValidators(numValidators: number): Promise<any> {
193
+ return rpcClient.request({method: "create_random_validators", params: [numValidators, 1, 10]});
189
194
  }
190
195
 
191
196
  export function deleteAllValidators(): Promise<any> {