aotrautils-srv 0.0.1032 → 0.0.1034

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.
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
- /*utils COMMONS library associated with aotra version : «1_29072022-2359 (28/09/2024-21:47:33)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (12/10/2024-15:45:08)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -5259,7 +5259,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
5259
5259
 
5260
5260
 
5261
5261
 
5262
- /*utils AI library associated with aotra version : «1_29072022-2359 (28/09/2024-21:47:33)»*/
5262
+ /*utils AI library associated with aotra version : «1_29072022-2359 (12/10/2024-15:45:08)»*/
5263
5263
  /*-----------------------------------------------------------------------------*/
5264
5264
 
5265
5265
 
@@ -5403,7 +5403,7 @@ getOpenAIAPIClient=(modelName, apiURL, agentRole, defaultPrompt)=>{
5403
5403
 
5404
5404
 
5405
5405
 
5406
- /*utils SERVER library associated with aotra version : «1_29072022-2359 (28/09/2024-21:47:33)»*/
5406
+ /*utils SERVER library associated with aotra version : «1_29072022-2359 (12/10/2024-15:45:08)»*/
5407
5407
  /*-----------------------------------------------------------------------------*/
5408
5408
 
5409
5409
 
@@ -7294,6 +7294,98 @@ appendGetParameters=function(apiURL, namedArgs){
7294
7294
  };
7295
7295
 
7296
7296
 
7297
+
7298
+ //*********************************** AUTO-ORGANIZING REAL-TIME AORTAC CLUSTERIZATION (AORTAC) *********************************** */
7299
+
7300
+ class AORTACNode{
7301
+ constructor(selfOrigin="127.0.0.1:40000",outcomingNodesOrigins=[], model, controller, sslConfig={/*OPTIONAL*/port:null,/*OPTIONAL*/certPath:null,/*OPTIONAL*/keyPath:null}){
7302
+ this.selfOrigin=selfOrigin;
7303
+ this.outcomingNodesOrigins=outcomingNodesOrigins;
7304
+
7305
+ this.model=model; // must implement function
7306
+ this.controller=controller; // Must implement function
7307
+ this.serverId=getUUID();
7308
+
7309
+ this.server=null;
7310
+ this.clients={};
7311
+ this.incomingServers={};
7312
+ this.outcomingServers={};
7313
+
7314
+ }
7315
+
7316
+ start(){
7317
+
7318
+ const self=this;
7319
+ this.server = initNodeServerInfrastructureWrapper(
7320
+ // On each client connection :
7321
+ null,
7322
+ // On client finalization :
7323
+ function(server){
7324
+
7325
+ self.server=server;
7326
+
7327
+ server.receive("protocol", (message, clientSocket)=>{
7328
+
7329
+ // TRACE
7330
+ console.log("INFO : SERVER : Client has sent a protocol message: ", message);
7331
+
7332
+ // ============== OTHER SERVER / CLIENT REGISTRATION PHASE ==============
7333
+
7334
+ if(message.type==="registerOtherServer"){
7335
+ const incomingServerId=message.serverId;
7336
+
7337
+ self.incomingServers[incomingServerId]={clientSocket:clientSocket};
7338
+
7339
+ }else if(message.type==="registerClient"){
7340
+ const clientId=message.clientId;
7341
+
7342
+ self.clients[incomingServerId]={clientSocket:clientSocket};
7343
+ }
7344
+
7345
+ });
7346
+
7347
+
7348
+ // We try to connect to all the other outcoming servers :
7349
+ foreach(self.outcomingNodesOrigins, outcomingNodeOrigin=>{
7350
+ let outcomingNodeHost;
7351
+ let outcomingNodePort;
7352
+ if(contains(outcomingNodeOrigin,":")){
7353
+ const splits=outcomingNodeOrigin.split(":");
7354
+ outcomingNodeHost=splits[0];
7355
+ outcomingNodePort=splits[1];
7356
+ }
7357
+ const isSecure=(contains(outcomingNodeOrigin,"wss"));
7358
+ const clientInstance=connectToServer:(outcomingNodeHost,outcomingNodePort, isSecure, 5000);
7359
+
7360
+ self.outcomingServers[]={clientInstanceToServer:clientInstance};
7361
+
7362
+ });
7363
+
7364
+
7365
+
7366
+
7367
+ ////
7368
+ // CURRENT AORTAC
7369
+
7370
+
7371
+ },this.sslConfig.port, this.sslConfig.certPath, this.sslConfig.keyPath);
7372
+
7373
+
7374
+ }
7375
+
7376
+ }
7377
+
7378
+ getAORTACNode=function(selfOrigin="127.0.0.1:40000",outcomingNodesOrigins=[]){
7379
+ return new AORTACNode(selfOrigin,outcomingNodesOrigins);
7380
+ }
7381
+
7382
+
7383
+
7384
+
7385
+
7386
+
7387
+
7388
+
7297
7389
  /* INCLUDED EXTERNAL LIBRAIRIES
7298
7390
  */
7299
7391
  "use strict";var sjcl={cipher:{},hash:{},keyexchange:{},mode:{},misc:{},codec:{},exception:{corrupt:function(a){this.toString=function(){return"CORRUPT: "+this.message};this.message=a},invalid:function(a){this.toString=function(){return"INVALID: "+this.message};this.message=a},bug:function(a){this.toString=function(){return"BUG: "+this.message};this.message=a},notReady:function(a){this.toString=function(){return"NOT READY: "+this.message};this.message=a}}};
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils-srv",
3
- "version": "0.0.1032",
3
+ "version": "0.0.1034",
4
4
  "main": "aotrautils-srv.build.js",
5
5
  "description": "A library for vanilla javascript utils (server-side) used in aotra javascript CMS",
6
6
  "author": "Jeremie Ratomposon <info@alqemia.com> (https://alqemia.com)",