jvserve 2.0.0__py3-none-any.whl → 2.0.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.

Potentially problematic release.


This version of jvserve might be problematic. Click here for more details.

jvserve/__init__.py CHANGED
@@ -4,5 +4,5 @@ jvserve package initialization.
4
4
  This package provides the webserver for loading and interacting with JIVAS agents.
5
5
  """
6
6
 
7
- __version__ = "2.0.0"
7
+ __version__ = "2.0.2"
8
8
  __supported__jivas__versions__ = ["2.0.0"]
@@ -35,7 +35,7 @@ class AgentInterface:
35
35
  PORT = 8000
36
36
  ROOT_ID = ""
37
37
  TOKEN = ""
38
- EXPIRATION = ""
38
+ EXPIRATION = None
39
39
  LOGGER = logging.getLogger(__name__)
40
40
 
41
41
  @staticmethod
@@ -43,7 +43,42 @@ class AgentInterface:
43
43
  walker_name: str, module_name: str, attributes: dict
44
44
  ) -> _Jac.Walker:
45
45
  """Spawn any walker by name, located in module"""
46
- return JacMachine.get().spawn_walker(walker_name, attributes, module_name)
46
+ # Get the list of modules
47
+ modules = JacMachine.get().list_modules()
48
+
49
+ # Search for the exact module name in the list of modules
50
+ for mod in modules:
51
+ if mod.endswith(module_name):
52
+ module_name = mod
53
+ break
54
+
55
+ try:
56
+ walker = JacMachine.get().spawn_walker(walker_name, attributes, module_name)
57
+ return walker
58
+ except Exception as e:
59
+ raise ValueError(
60
+ f"Unable to spawn walker {walker_name} in module {module_name}: {e}"
61
+ )
62
+
63
+ @staticmethod
64
+ def spawn_node(node_name: str, module_name: str, attributes: dict) -> _Jac.Node:
65
+ """Spawn any node by name, located in module"""
66
+ # Get the list of modules
67
+ modules = JacMachine.get().list_modules()
68
+
69
+ # Search for the exact module name in the list of modules
70
+ for mod in modules:
71
+ if mod.endswith(module_name):
72
+ module_name = mod
73
+ break
74
+
75
+ try:
76
+ node = JacMachine.get().spawn_node(node_name, attributes, module_name)
77
+ return node
78
+ except Exception as e:
79
+ raise ValueError(
80
+ f"Unable to spawn node {node_name} in module {module_name}: {e}"
81
+ )
47
82
 
48
83
  @staticmethod
49
84
  async def webhook_exec(key: str, request: Request) -> JSONResponse:
@@ -110,7 +145,7 @@ class AgentInterface:
110
145
  )
111
146
 
112
147
  except Exception as e:
113
- AgentInterface.EXPIRATION = ""
148
+ AgentInterface.EXPIRATION = None
114
149
  AgentInterface.LOGGER.error(
115
150
  f"an exception occurred: {e}, {traceback.format_exc()}"
116
151
  )
@@ -183,7 +218,7 @@ class AgentInterface:
183
218
  ).response
184
219
 
185
220
  except Exception as e:
186
- AgentInterface.EXPIRATION = ""
221
+ AgentInterface.EXPIRATION = None
187
222
  AgentInterface.LOGGER.error(
188
223
  f"an exception occurred: {e}, {traceback.format_exc()}"
189
224
  )
@@ -231,11 +266,11 @@ class AgentInterface:
231
266
  "verbose": payload.verbose,
232
267
  "reporting": False,
233
268
  },
234
- module_name="agent.action.interact",
269
+ module_name="jivas.agent.action.interact",
235
270
  ),
236
271
  ).response
237
272
  except Exception as e:
238
- AgentInterface.EXPIRATION = ""
273
+ AgentInterface.EXPIRATION = None
239
274
  AgentInterface.LOGGER.error(
240
275
  f"an exception occurred: {e}, {traceback.format_exc()}"
241
276
  )
@@ -277,7 +312,7 @@ class AgentInterface:
277
312
  ),
278
313
  ).response
279
314
  except Exception as e:
280
- AgentInterface.EXPIRATION = ""
315
+ AgentInterface.EXPIRATION = None
281
316
  AgentInterface.LOGGER.error(
282
317
  f"an exception occurred: {e}, {traceback.format_exc()}"
283
318
  )
@@ -318,11 +353,11 @@ class AgentInterface:
318
353
  return result.get("reports", {})
319
354
 
320
355
  if response.status_code == 401:
321
- AgentInterface.EXPIRATION = ""
356
+ AgentInterface.EXPIRATION = None
322
357
  return {}
323
358
 
324
359
  except Exception as e:
325
- AgentInterface.EXPIRATION = ""
360
+ AgentInterface.EXPIRATION = None
326
361
  AgentInterface.LOGGER.error(
327
362
  f"an exception occurred: {e}, {traceback.format_exc()}"
328
363
  )
@@ -362,11 +397,11 @@ class AgentInterface:
362
397
  return result["reports"]
363
398
 
364
399
  if response.status_code == 401:
365
- AgentInterface.EXPIRATION = ""
400
+ AgentInterface.EXPIRATION = None
366
401
  return {}
367
402
 
368
403
  except Exception as e:
369
- AgentInterface.EXPIRATION = ""
404
+ AgentInterface.EXPIRATION = None
370
405
  AgentInterface.LOGGER.error(
371
406
  f"an exception occurred: {e}, {traceback.format_exc()}"
372
407
  )
@@ -376,6 +411,7 @@ class AgentInterface:
376
411
  @staticmethod
377
412
  def load_context(entry: NodeAnchor | None = None) -> Optional[ExecutionContext]:
378
413
  """Load the execution context synchronously."""
414
+ AgentInterface.get_user_context()
379
415
  return AgentInterface.get_jaseci_context(entry, AgentInterface.ROOT_ID)
380
416
 
381
417
  @staticmethod
@@ -443,11 +479,7 @@ class AgentInterface:
443
479
 
444
480
  # if user context still active, return it
445
481
  now = int(time.time())
446
- if (
447
- AgentInterface.EXPIRATION
448
- and AgentInterface.EXPIRATION.isdigit()
449
- and int(AgentInterface.EXPIRATION) > now
450
- ):
482
+ if AgentInterface.EXPIRATION and AgentInterface.EXPIRATION > now:
451
483
  return {
452
484
  "root_id": AgentInterface.ROOT_ID,
453
485
  "token": AgentInterface.TOKEN,
@@ -516,7 +548,7 @@ class AgentInterface:
516
548
  )
517
549
 
518
550
  except Exception as e:
519
- AgentInterface.EXPIRATION = ""
551
+ AgentInterface.EXPIRATION = None
520
552
  AgentInterface.LOGGER.error(
521
553
  f"an exception occurred: {e}, {traceback.format_exc()}"
522
554
  )
@@ -608,7 +640,7 @@ class AgentInterface:
608
640
  )
609
641
 
610
642
  except Exception as e:
611
- AgentInterface.EXPIRATION = ""
643
+ AgentInterface.EXPIRATION = None
612
644
  AgentInterface.LOGGER.error(
613
645
  f"an exception occurred: {e}, {traceback.format_exc()}"
614
646
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: jvserve
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: FastAPI webserver for loading and interaction with JIVAS agents.
5
5
  Home-page: https://github.com/TrueSelph/jvserve
6
6
  Author: TrueSelph Inc.
@@ -0,0 +1,12 @@
1
+ jvserve/__init__.py,sha256=zlHBOIzb_NwAkzEGHhTKYSrlQdnlIxyyLFcAj5nEJ6Q,190
2
+ jvserve/cli.py,sha256=KVWuGPlAt6Vzti-J8CbB4YsgTCc6gS3HaC2OElGqMD0,4392
3
+ jvserve/lib/__init__.py,sha256=cnzfSHLoTWG9Ygut2nOpDys5aPlQz-m0BSkB-nd7OMs,31
4
+ jvserve/lib/agent_interface.py,sha256=Ob8E2z8kJYIoJ5X1ijInC00yBmv6ri7zLJKQJ5oyp_8,25862
5
+ jvserve/lib/agent_pulse.py,sha256=6hBF6KQYr6Z9Mi_yoWKGfdnW7gg84kK20Slu-bLR_m8,2067
6
+ jvserve/lib/jvlogger.py,sha256=RNiB9PHuBzTvNIQWhxoDgrDlNYA0PYm1SVpvzlqu8mE,4180
7
+ jvserve-2.0.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
8
+ jvserve-2.0.2.dist-info/METADATA,sha256=_8FBj6wu6ym2ByxcMVsNM8iHAFsGLW5Fo29xWlKtQpI,4738
9
+ jvserve-2.0.2.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
10
+ jvserve-2.0.2.dist-info/entry_points.txt,sha256=HYyg1QXoLs0JRb004L300VeLOZyDLY27ynD1tnTnEN4,35
11
+ jvserve-2.0.2.dist-info/top_level.txt,sha256=afoCXZv-zXNBuhVIvfJGjafXKEiJl_ooy4BtgQwAG4Q,8
12
+ jvserve-2.0.2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (75.8.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,12 +0,0 @@
1
- jvserve/__init__.py,sha256=ifcLIbr9j3YGzOq3rQ26IAeOxhhG-RJY2-Y8rhn6k84,190
2
- jvserve/cli.py,sha256=KVWuGPlAt6Vzti-J8CbB4YsgTCc6gS3HaC2OElGqMD0,4392
3
- jvserve/lib/__init__.py,sha256=cnzfSHLoTWG9Ygut2nOpDys5aPlQz-m0BSkB-nd7OMs,31
4
- jvserve/lib/agent_interface.py,sha256=uPPB3C-CWoRZvE1amNzbTqzN9CJb1wTzjro7k8kZrs4,24688
5
- jvserve/lib/agent_pulse.py,sha256=6hBF6KQYr6Z9Mi_yoWKGfdnW7gg84kK20Slu-bLR_m8,2067
6
- jvserve/lib/jvlogger.py,sha256=RNiB9PHuBzTvNIQWhxoDgrDlNYA0PYm1SVpvzlqu8mE,4180
7
- jvserve-2.0.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
8
- jvserve-2.0.0.dist-info/METADATA,sha256=CQROaFwAdhQkuPewdj0_9VE6YNg88F5BwX5j-LlWiv4,4738
9
- jvserve-2.0.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
10
- jvserve-2.0.0.dist-info/entry_points.txt,sha256=HYyg1QXoLs0JRb004L300VeLOZyDLY27ynD1tnTnEN4,35
11
- jvserve-2.0.0.dist-info/top_level.txt,sha256=afoCXZv-zXNBuhVIvfJGjafXKEiJl_ooy4BtgQwAG4Q,8
12
- jvserve-2.0.0.dist-info/RECORD,,