naeural-client 3.2.0__py3-none-any.whl → 3.2.2__py3-none-any.whl

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.
naeural_client/_ver.py CHANGED
@@ -1,4 +1,4 @@
1
- __VER__ = "3.2.0"
1
+ __VER__ = "3.2.2"
2
2
 
3
3
  if __name__ == "__main__":
4
4
  with open("pyproject.toml", "rt") as fd:
@@ -19,7 +19,7 @@ from time import sleep
19
19
  from time import time as tm
20
20
 
21
21
  from ..base_decentra_object import BaseDecentrAIObject
22
- from ..bc import DefaultBlockEngine, _DotDict
22
+ from ..bc import DefaultBlockEngine, _DotDict, EE_VPN_IMPL
23
23
  from ..const import (
24
24
  COMMANDS, ENVIRONMENT, HB, PAYLOAD_DATA, STATUS_TYPE,
25
25
  PLUGIN_SIGNATURES, DEFAULT_PIPELINES,
@@ -229,14 +229,10 @@ class GenericSession(BaseDecentrAIObject):
229
229
 
230
230
  # TODO: maybe read config from file?
231
231
  self._config = {**self.default_config, **config}
232
-
233
- if root_topic is not None:
234
- for key in self._config.keys():
235
- if isinstance(self._config[key], dict) and 'TOPIC' in self._config[key]:
236
- if isinstance(self._config[key]["TOPIC"], str) and self._config[key]["TOPIC"].startswith("{}"):
237
- nr_empty = self._config[key]["TOPIC"].count("{}")
238
- self._config[key]["TOPIC"] = self._config[key]["TOPIC"].format(root_topic, *(["{}"] * (nr_empty - 1)))
239
- # end if root_topic
232
+
233
+
234
+
235
+ self.comms_root_topic = root_topic
240
236
 
241
237
  self.__auto_configuration = auto_configuration
242
238
 
@@ -245,8 +241,8 @@ class GenericSession(BaseDecentrAIObject):
245
241
 
246
242
  self.name = name
247
243
  self.silent = silent
248
-
249
- self.__eth_enabled = eth_enabled
244
+
245
+ self._eth_enabled = eth_enabled
250
246
 
251
247
  self.encrypt_comms = encrypt_comms
252
248
 
@@ -354,6 +350,22 @@ class GenericSession(BaseDecentrAIObject):
354
350
  # end bc_engine
355
351
  # END TODO
356
352
 
353
+
354
+ str_topic = os.environ.get(ENVIRONMENT.EE_ROOT_TOPIC_ENV_KEY, self.comms_root_topic)
355
+
356
+ if str_topic != self.comms_root_topic:
357
+ self.P(f"Changing root topic from '{self.comms_root_topic}' to '{str_topic}'", color='y')
358
+ self.comms_root_topic = str_topic
359
+
360
+ if self.comms_root_topic is not None:
361
+ for key in self._config.keys():
362
+ if isinstance(self._config[key], dict) and 'TOPIC' in self._config[key]:
363
+ if isinstance(self._config[key]["TOPIC"], str) and self._config[key]["TOPIC"].startswith("{}"):
364
+ nr_empty = self._config[key]["TOPIC"].count("{}")
365
+ self._config[key]["TOPIC"] = self._config[key]["TOPIC"].format(self.comms_root_topic, *(["{}"] * (nr_empty - 1)))
366
+ # end if root_topic
367
+
368
+
357
369
  ## last config step
358
370
  self.__fill_config(
359
371
  host=self.__host,
@@ -830,8 +842,12 @@ class GenericSession(BaseDecentrAIObject):
830
842
  # this is for legacy and custom implementation where heartbeats still contain
831
843
  # the pipeline configuration.
832
844
  pipeline_names = [x.get(PAYLOAD_DATA.NAME, None) for x in msg_active_configs]
845
+ received_plugins = dict_msg.get(HB.ACTIVE_PLUGINS, [])
833
846
  self.D(f'<HB> Processing pipelines from <{short_addr}>:{pipeline_names}', color='y')
834
- self.__process_node_pipelines(msg_node_addr, msg_active_configs)
847
+ new_pipeliens = self.__process_node_pipelines(
848
+ node_addr=msg_node_addr, pipelines=msg_active_configs,
849
+ plugins_statuses=received_plugins,
850
+ )
835
851
 
836
852
  # TODO: move this call in `__on_message_default_callback`
837
853
  if self.__maybe_ignore_message(msg_node_addr):
@@ -1113,19 +1129,23 @@ class GenericSession(BaseDecentrAIObject):
1113
1129
  return
1114
1130
 
1115
1131
  try:
1132
+ if EE_VPN_IMPL and self._eth_enabled:
1133
+ self.P("Disabling ETH for VPN implementation", color='r')
1134
+ self._eth_enabled = False
1135
+
1116
1136
  self.bc_engine = DefaultBlockEngine(
1117
1137
  log=self.log,
1118
1138
  name=self.name,
1119
1139
  config=blockchain_config,
1120
1140
  verbosity=self._verbosity,
1121
1141
  user_config=user_config,
1122
- eth_enabled=self.__eth_enabled,
1142
+ eth_enabled=self._eth_enabled,
1123
1143
  )
1124
1144
  except:
1125
1145
  raise ValueError("Failure in private blockchain setup:\n{}".format(traceback.format_exc()))
1126
1146
 
1127
1147
  # extra setup flag for re-connections with same multiton instance
1128
- self.bc_engine.set_eth_flag(self.__eth_enabled)
1148
+ self.bc_engine.set_eth_flag(self._eth_enabled)
1129
1149
  return
1130
1150
 
1131
1151
  def __start_main_loop_thread(self):
@@ -2868,8 +2888,8 @@ class GenericSession(BaseDecentrAIObject):
2868
2888
  telegram_bot_token=None,
2869
2889
  telegram_bot_token_env_key=ENVIRONMENT.TELEGRAM_BOT_TOKEN_ENV_KEY,
2870
2890
  telegram_bot_name=None,
2871
- telegram_bot_name_env_key=ENVIRONMENT.TELEGRAM_BOT_NAME_ENV_KEY,
2872
-
2891
+ telegram_bot_name_env_key=ENVIRONMENT.TELEGRAM_BOT_NAME_ENV_KEY,
2892
+ processor_handler=None,
2873
2893
  system_prompt=None,
2874
2894
  agent_type="API",
2875
2895
  api_token_env_key=ENVIRONMENT.TELEGRAM_API_AGENT_TOKEN_ENV_KEY,
@@ -2943,6 +2963,7 @@ class GenericSession(BaseDecentrAIObject):
2943
2963
  if telegram_bot_name is None:
2944
2964
  message = f"Warning! No Telegram bot name provided as via env {ENVIRONMENT.TELEGRAM_BOT_NAME_ENV_KEY} or explicitly as `telegram_bot_name` param."
2945
2965
  raise ValueError(message)
2966
+
2946
2967
 
2947
2968
 
2948
2969
  pipeline: Pipeline = self.create_pipeline(
@@ -2950,6 +2971,10 @@ class GenericSession(BaseDecentrAIObject):
2950
2971
  name=name,
2951
2972
  # default TYPE is "Void"
2952
2973
  )
2974
+
2975
+ proc_func_args, proc_func_base64_code =[], None
2976
+ if processor_handler is not None:
2977
+ _, proc_func_args, proc_func_base64_code = pipeline._get_method_data(processor_handler)
2953
2978
 
2954
2979
 
2955
2980
  obfuscated_token = telegram_bot_token[:4] + "*" * (len(telegram_bot_token) - 4)
@@ -2957,8 +2982,13 @@ class GenericSession(BaseDecentrAIObject):
2957
2982
  instance = pipeline.create_plugin_instance(
2958
2983
  signature=signature,
2959
2984
  instance_id=self.log.get_unique_id(),
2985
+
2960
2986
  telegram_bot_token=telegram_bot_token,
2961
2987
  telegram_bot_name=telegram_bot_name,
2988
+
2989
+ processor_handler=proc_func_base64_code, # not mandatory
2990
+ processor_handler_args=proc_func_args, # not mandatory
2991
+
2962
2992
  system_prompt=system_prompt,
2963
2993
  agent_type=agent_type,
2964
2994
  api_token=api_token,
@@ -1,3 +1,3 @@
1
1
  from .ec import BaseBCEllipticCurveEngine
2
- from .base import BCct, _DotDict, _ComplexJsonEncoder, VerifyMessage
2
+ from .base import BCct, _DotDict, _ComplexJsonEncoder, VerifyMessage, EE_VPN_IMPL
3
3
  DefaultBlockEngine = BaseBCEllipticCurveEngine
naeural_client/bc/base.py CHANGED
@@ -319,7 +319,7 @@ class BaseBlockEngine(_EVMMixin):
319
319
  self.__config = config
320
320
  self.__ensure_ascii_payloads = ensure_ascii_payloads
321
321
 
322
- self.__eth_enabled = eth_enabled
322
+ self._eth_enabled = eth_enabled
323
323
 
324
324
  if user_config:
325
325
  user_folder = get_user_folder()
@@ -350,12 +350,12 @@ class BaseBlockEngine(_EVMMixin):
350
350
 
351
351
  @property
352
352
  def eth_enabled(self):
353
- return self.__eth_enabled
353
+ return self._eth_enabled
354
354
 
355
355
 
356
356
  def set_eth_flag(self, value):
357
- if value != self.__eth_enabled:
358
- self.__eth_enabled = value
357
+ if value != self._eth_enabled:
358
+ self._eth_enabled = value
359
359
  self.log.P("Changed eth_enabled to {}".format(value), color='d')
360
360
  return
361
361
 
@@ -377,7 +377,7 @@ class BaseBlockEngine(_EVMMixin):
377
377
 
378
378
  def _init(self):
379
379
  self.P(
380
- f"Initializing BC-engine (ETH_ENABLED={self.__eth_enabled})...", verbosity=1
380
+ f"Initializing BC-engine (ETH_ENABLED={self._eth_enabled})...", verbosity=1
381
381
  )
382
382
 
383
383
  if True:
@@ -414,7 +414,7 @@ class BaseBlockEngine(_EVMMixin):
414
414
  self.__eth_address = self._get_eth_address()
415
415
  self.__eth_account = self._get_eth_account()
416
416
  ### end Ethereum
417
- if self.__eth_enabled:
417
+ if self._eth_enabled:
418
418
  self.P(
419
419
  "{} / ETH: {} ({})".format(self.address, self.eth_address, self.evm_network), boxed=True, verbosity=1,
420
420
  color='g'
@@ -1212,7 +1212,7 @@ class BaseBlockEngine(_EVMMixin):
1212
1212
  dct_data[BCct.SIGN] = result
1213
1213
  dct_data[BCct.SENDER] = self.address
1214
1214
 
1215
- if self.__eth_enabled:
1215
+ if self._eth_enabled:
1216
1216
  dct_data[BCct.ETH_SENDER] = self.eth_address
1217
1217
  ### add eth signature
1218
1218
  dct_data[BCct.ETH_SIGN] = "0xBEEF"
@@ -28,8 +28,11 @@ class ENVIRONMENT:
28
28
 
29
29
  EE_SECURED = 'EE_SECURED'
30
30
  AIXP_SECURED = 'AIXP_SECURED'
31
+ EE_MQTT_SECURED = 'EE_MQTT_SECURED'
31
32
 
32
33
  TELEGRAM_BOT_TOKEN_ENV_KEY = 'EE_TELEGRAM_BOT_TOKEN'
33
34
  TELEGRAM_BOT_NAME_ENV_KEY = 'EE_TELEGRAM_BOT_NAME'
34
35
 
35
36
  TELEGRAM_API_AGENT_TOKEN_ENV_KEY = 'EE_TELEGRAM_API_AGENT_TOKEN'
37
+
38
+ EE_ROOT_TOPIC_ENV_KEY = 'EE_ROOT_TOPIC'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: naeural_client
3
- Version: 3.2.0
3
+ Version: 3.2.2
4
4
  Summary: `naeural_client` is the Python SDK required for client app development for the Naeural Edge Protocol Edge Protocol framework
5
5
  Project-URL: Homepage, https://github.com/NaeuralEdgeProtocol/naeural_client
6
6
  Project-URL: Bug Tracker, https://github.com/NaeuralEdgeProtocol/naeural_client/issues
@@ -1,10 +1,10 @@
1
1
  naeural_client/__init__.py,sha256=YimqgDbjLuywsf8zCWE0EaUXH4MBUrqLxt0TDV558hQ,632
2
- naeural_client/_ver.py,sha256=h-YXIHfRG6iypN8HxYHzNAfDy4s1G_Ya6Dxc-hkJH2w,330
2
+ naeural_client/_ver.py,sha256=NOz7aEJ1WJsh43U4LtIYy2q2MqQlpRN564G-nIQDATM,330
3
3
  naeural_client/base_decentra_object.py,sha256=iXvAAf6wPnGWzeeiRfwLojVoan-m1e_VsyPzjUQuENo,4492
4
4
  naeural_client/plugins_manager_mixin.py,sha256=X1JdGLDz0gN1rPnTN_5mJXR8JmqoBFQISJXmPR9yvCo,11106
5
5
  naeural_client/base/__init__.py,sha256=hACh83_cIv7-PwYMM3bQm2IBmNqiHw-3PAfDfAEKz9A,259
6
6
  naeural_client/base/distributed_custom_code_presets.py,sha256=cvz5R88P6Z5V61Ce1vHVVh8bOkgXd6gve_vdESDNAsg,2544
7
- naeural_client/base/generic_session.py,sha256=O27iuTTs-w1_fTSCfr8dgdK29kE7Yst4IJ_EUpvImHQ,126644
7
+ naeural_client/base/generic_session.py,sha256=ATB1k_mQ_efvek_ZgsYYex3G4ouhXds3CHRz1_lOKZM,127702
8
8
  naeural_client/base/instance.py,sha256=annR9qt6zqzIyf_AVzAIfxWHF8Y_zEjviels2MNfcPM,21916
9
9
  naeural_client/base/pipeline.py,sha256=5IJnb8SRiCDJ3IRl02gEMXxjugGedyhu6xESP33GMpo,62521
10
10
  naeural_client/base/plugin_template.py,sha256=7YAFaND2iXoZLgtunjYkFf_TBGieFr3VdNLO3vCqzmM,138795
@@ -13,8 +13,8 @@ naeural_client/base/transaction.py,sha256=bfs6td5M0fINgPQNxhrl_AUjb1YiilLDQ-Cd_o
13
13
  naeural_client/base/webapp_pipeline.py,sha256=ZNGqZ36DY076XVDfGu2Q61kCt3kxIJ4Mi4QbPZuDVn0,2791
14
14
  naeural_client/base/payload/__init__.py,sha256=y8fBI8tG2ObNfaXFWjyWZXwu878FRYj_I8GIbHT4GKE,29
15
15
  naeural_client/base/payload/payload.py,sha256=x-au7l67Z_vfn_4R2C_pjZCaFuUVXHngJiGOfIAYVdE,2690
16
- naeural_client/bc/__init__.py,sha256=FQj23D1PrY06NUOARiKQi4cdj0-VxnoYgYDEht8lpr8,158
17
- naeural_client/bc/base.py,sha256=qjeRWF1b67eX0RtGbO7FU_zhTS8JCMSNWjPE5D17xSk,44762
16
+ naeural_client/bc/__init__.py,sha256=BI5pcqHdhwnMdbWTYDLW1cVP_844VtLra-lz7xprgsk,171
17
+ naeural_client/bc/base.py,sha256=zFrBp2zI1EdDYOP9NVrVAga-guDhx2n5taEGWfdqnW8,44755
18
18
  naeural_client/bc/chain.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  naeural_client/bc/ec.py,sha256=FwlkWmJvQ9aHuf_BZX1CWSUAxw6OZ9jBparLIWcs_e4,18933
20
20
  naeural_client/bc/evm.py,sha256=knccBb8Whdo2V1E_kmxJVHGV10-_Eoj2AFV7FVjJwj4,26508
@@ -38,7 +38,7 @@ naeural_client/const/__init__.py,sha256=MM6Zib6i7M2qWcMkLtLx14zqU-lE-u2uPHjNvbh2
38
38
  naeural_client/const/apps.py,sha256=ePBiJXLuPfFOKuw-LJrT9OWbaodU7QApfDurIPNDoB4,655
39
39
  naeural_client/const/base.py,sha256=3Q8Mn3LE4jte1ubBEas3z-ukw8ix_FrvsegY820P6do,5739
40
40
  naeural_client/const/comms.py,sha256=La6JXWHexH8CfcBCKyT4fCIoeaoZlcm7KtZ57ab4ZgU,2201
41
- naeural_client/const/environment.py,sha256=RpdDhDgB8NgRoFTk28eODigf9y0WcT9lul6mBOD029w,879
41
+ naeural_client/const/environment.py,sha256=o02BhlrRR4gOOedZtK94FSyZ1dlmDL-BwcDG91CiogQ,962
42
42
  naeural_client/const/evm_net.py,sha256=oU_c6jUjWsFlslt2JFD1-bTOS06N7EGv88Rb6gF9xIQ,3221
43
43
  naeural_client/const/formatter.py,sha256=AW3bWlqf39uaqV4BBUuW95qKYfF2OkkU4f9hy3kSVhM,200
44
44
  naeural_client/const/heartbeat.py,sha256=xHZBX_NzHTklwA2_AEKR0SGdlbavMT4nirqjQg8WlTU,2550
@@ -97,8 +97,8 @@ naeural_client/utils/comm_utils.py,sha256=4cS9llRr_pK_3rNgDcRMCQwYPO0kcNU7AdWy_L
97
97
  naeural_client/utils/config.py,sha256=ohZFdIaRLwcWK0sh0loDD7JS9bsC9mqsFYairWZSVNg,9814
98
98
  naeural_client/utils/dotenv.py,sha256=_AgSo35n7EnQv5yDyu7C7i0kHragLJoCGydHjvOkrYY,2008
99
99
  naeural_client/utils/oracle_sync/oracle_tester.py,sha256=QwfBqXxPIOTVT6WVySkkxPnU3eJVvoyOEbq1ZQRuPRw,27245
100
- naeural_client-3.2.0.dist-info/METADATA,sha256=CO4L4denSKNW67KAkJ2jmdmmnwJERg-1-PkJvvaFbNs,12363
101
- naeural_client-3.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
102
- naeural_client-3.2.0.dist-info/entry_points.txt,sha256=CTua17GUrRa4aXeafezGC9TiWKGKQzwTjQmB2jyj22g,91
103
- naeural_client-3.2.0.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
104
- naeural_client-3.2.0.dist-info/RECORD,,
100
+ naeural_client-3.2.2.dist-info/METADATA,sha256=uj-o5GbwAvg3Uxx9MKKVUiLYkfCNX2WV8vnkn9aPWTk,12363
101
+ naeural_client-3.2.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
102
+ naeural_client-3.2.2.dist-info/entry_points.txt,sha256=CTua17GUrRa4aXeafezGC9TiWKGKQzwTjQmB2jyj22g,91
103
+ naeural_client-3.2.2.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
104
+ naeural_client-3.2.2.dist-info/RECORD,,