jvserve 2.0.1__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 +1 -1
- jvserve/lib/agent_interface.py +49 -18
- {jvserve-2.0.1.dist-info → jvserve-2.0.2.dist-info}/METADATA +1 -1
- jvserve-2.0.2.dist-info/RECORD +12 -0
- jvserve-2.0.1.dist-info/RECORD +0 -12
- {jvserve-2.0.1.dist-info → jvserve-2.0.2.dist-info}/LICENSE +0 -0
- {jvserve-2.0.1.dist-info → jvserve-2.0.2.dist-info}/WHEEL +0 -0
- {jvserve-2.0.1.dist-info → jvserve-2.0.2.dist-info}/entry_points.txt +0 -0
- {jvserve-2.0.1.dist-info → jvserve-2.0.2.dist-info}/top_level.txt +0 -0
jvserve/__init__.py
CHANGED
jvserve/lib/agent_interface.py
CHANGED
|
@@ -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
|
-
|
|
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
|
)
|
|
@@ -444,11 +479,7 @@ class AgentInterface:
|
|
|
444
479
|
|
|
445
480
|
# if user context still active, return it
|
|
446
481
|
now = int(time.time())
|
|
447
|
-
if
|
|
448
|
-
AgentInterface.EXPIRATION
|
|
449
|
-
and AgentInterface.EXPIRATION.isdigit()
|
|
450
|
-
and int(AgentInterface.EXPIRATION) > now
|
|
451
|
-
):
|
|
482
|
+
if AgentInterface.EXPIRATION and AgentInterface.EXPIRATION > now:
|
|
452
483
|
return {
|
|
453
484
|
"root_id": AgentInterface.ROOT_ID,
|
|
454
485
|
"token": AgentInterface.TOKEN,
|
|
@@ -517,7 +548,7 @@ class AgentInterface:
|
|
|
517
548
|
)
|
|
518
549
|
|
|
519
550
|
except Exception as e:
|
|
520
|
-
AgentInterface.EXPIRATION =
|
|
551
|
+
AgentInterface.EXPIRATION = None
|
|
521
552
|
AgentInterface.LOGGER.error(
|
|
522
553
|
f"an exception occurred: {e}, {traceback.format_exc()}"
|
|
523
554
|
)
|
|
@@ -609,7 +640,7 @@ class AgentInterface:
|
|
|
609
640
|
)
|
|
610
641
|
|
|
611
642
|
except Exception as e:
|
|
612
|
-
AgentInterface.EXPIRATION =
|
|
643
|
+
AgentInterface.EXPIRATION = None
|
|
613
644
|
AgentInterface.LOGGER.error(
|
|
614
645
|
f"an exception occurred: {e}, {traceback.format_exc()}"
|
|
615
646
|
)
|
|
@@ -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,,
|
jvserve-2.0.1.dist-info/RECORD
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
jvserve/__init__.py,sha256=NHdfSKJe30vlgruM7iYAOJRbA8ZJsYy_i0Z5j-29JpQ,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=hExwiE4YC4VqseqM-nyb4S4ap74kB1YNLEBAC-tDmsE,24730
|
|
5
|
-
jvserve/lib/agent_pulse.py,sha256=6hBF6KQYr6Z9Mi_yoWKGfdnW7gg84kK20Slu-bLR_m8,2067
|
|
6
|
-
jvserve/lib/jvlogger.py,sha256=RNiB9PHuBzTvNIQWhxoDgrDlNYA0PYm1SVpvzlqu8mE,4180
|
|
7
|
-
jvserve-2.0.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
8
|
-
jvserve-2.0.1.dist-info/METADATA,sha256=6iRaZVleExA--Lfy3kMc-fRw9QTYRFoRIpvacN6Bers,4738
|
|
9
|
-
jvserve-2.0.1.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
|
10
|
-
jvserve-2.0.1.dist-info/entry_points.txt,sha256=HYyg1QXoLs0JRb004L300VeLOZyDLY27ynD1tnTnEN4,35
|
|
11
|
-
jvserve-2.0.1.dist-info/top_level.txt,sha256=afoCXZv-zXNBuhVIvfJGjafXKEiJl_ooy4BtgQwAG4Q,8
|
|
12
|
-
jvserve-2.0.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|