jvserve 2.0.15__py3-none-any.whl → 2.0.16__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 +7 -71
- {jvserve-2.0.15.dist-info → jvserve-2.0.16.dist-info}/METADATA +1 -1
- jvserve-2.0.16.dist-info/RECORD +13 -0
- jvserve-2.0.15.dist-info/RECORD +0 -13
- {jvserve-2.0.15.dist-info → jvserve-2.0.16.dist-info}/WHEEL +0 -0
- {jvserve-2.0.15.dist-info → jvserve-2.0.16.dist-info}/entry_points.txt +0 -0
- {jvserve-2.0.15.dist-info → jvserve-2.0.16.dist-info}/licenses/LICENSE +0 -0
- {jvserve-2.0.15.dist-info → jvserve-2.0.16.dist-info}/top_level.txt +0 -0
jvserve/__init__.py
CHANGED
jvserve/lib/agent_interface.py
CHANGED
|
@@ -200,9 +200,9 @@ class AgentInterface:
|
|
|
200
200
|
return action_data
|
|
201
201
|
|
|
202
202
|
@staticmethod
|
|
203
|
-
|
|
203
|
+
def action_walker_exec(
|
|
204
204
|
agent_id: Optional[str] = Form(None), # noqa: B008
|
|
205
|
-
|
|
205
|
+
module_root: Optional[str] = Form(None), # noqa: B008
|
|
206
206
|
walker: Optional[str] = Form(None), # noqa: B008
|
|
207
207
|
args: Optional[str] = Form(None), # noqa: B008
|
|
208
208
|
attachments: List[UploadFile] = File(default_factory=list), # noqa: B008
|
|
@@ -224,45 +224,15 @@ class AgentInterface:
|
|
|
224
224
|
ctx = None
|
|
225
225
|
try:
|
|
226
226
|
# Validate required parameters
|
|
227
|
-
if walker is None or agent_id is None or
|
|
227
|
+
if walker is None or agent_id is None or module_root is None:
|
|
228
228
|
AgentInterface.LOGGER.error("Missing required parameters")
|
|
229
229
|
return JSONResponse(
|
|
230
230
|
status_code=400, # 400 (Bad Request)
|
|
231
231
|
content={"error": "Missing required parameters"},
|
|
232
232
|
)
|
|
233
233
|
|
|
234
|
-
# Get action data to resolve module
|
|
235
|
-
if agent_id is None or action is None:
|
|
236
|
-
AgentInterface.LOGGER.error("agent_id and action must not be None")
|
|
237
|
-
return JSONResponse(
|
|
238
|
-
status_code=400,
|
|
239
|
-
content={"error": "agent_id and action must not be None"},
|
|
240
|
-
)
|
|
241
|
-
|
|
242
|
-
action_data = AgentInterface.get_action_data(agent_id, action)
|
|
243
|
-
if not action_data:
|
|
244
|
-
AgentInterface.LOGGER.error(
|
|
245
|
-
f"Action {action} not found for agent {agent_id}"
|
|
246
|
-
)
|
|
247
|
-
return JSONResponse(
|
|
248
|
-
status_code=404,
|
|
249
|
-
content={"error": "Action not found"},
|
|
250
|
-
)
|
|
251
|
-
|
|
252
|
-
module_root = (
|
|
253
|
-
action_data.get("_package", {}).get("config", {}).get("module_root", "")
|
|
254
|
-
)
|
|
255
|
-
if not module_root:
|
|
256
|
-
AgentInterface.LOGGER.error(
|
|
257
|
-
f"Module not found for action {action} of agent {agent_id}"
|
|
258
|
-
)
|
|
259
|
-
return JSONResponse(
|
|
260
|
-
status_code=404,
|
|
261
|
-
content={"error": "Module not found"},
|
|
262
|
-
)
|
|
263
|
-
|
|
264
234
|
# Load execution context
|
|
265
|
-
ctx =
|
|
235
|
+
ctx = AgentInterface.load_context()
|
|
266
236
|
if not ctx:
|
|
267
237
|
AgentInterface.LOGGER.error(f"Unable to execute {walker}")
|
|
268
238
|
return JSONResponse(
|
|
@@ -293,7 +263,7 @@ class AgentInterface:
|
|
|
293
263
|
{
|
|
294
264
|
"name": file.filename,
|
|
295
265
|
"type": file.content_type,
|
|
296
|
-
"content":
|
|
266
|
+
"content": file.file.read(),
|
|
297
267
|
}
|
|
298
268
|
)
|
|
299
269
|
except Exception as e:
|
|
@@ -311,43 +281,9 @@ class AgentInterface:
|
|
|
311
281
|
module_name=f"{module_root}.{walker}",
|
|
312
282
|
),
|
|
313
283
|
).response
|
|
284
|
+
ctx.close()
|
|
314
285
|
|
|
315
|
-
|
|
316
|
-
try:
|
|
317
|
-
# If it's already a proper Response object, return as-is
|
|
318
|
-
if isinstance(walker_response, requests.Response):
|
|
319
|
-
return walker_response
|
|
320
|
-
|
|
321
|
-
# If it's a Pydantic model or similar complex object with dict representation
|
|
322
|
-
if hasattr(walker_response, "dict"):
|
|
323
|
-
return JSONResponse(status_code=200, content=walker_response.dict())
|
|
324
|
-
|
|
325
|
-
# If it's a list of complex objects
|
|
326
|
-
if (
|
|
327
|
-
isinstance(walker_response, list)
|
|
328
|
-
and len(walker_response) > 0
|
|
329
|
-
and hasattr(walker_response[0], "dict")
|
|
330
|
-
):
|
|
331
|
-
return JSONResponse(
|
|
332
|
-
status_code=200,
|
|
333
|
-
content=[item.dict() for item in walker_response],
|
|
334
|
-
)
|
|
335
|
-
|
|
336
|
-
# For other JSON-serializable types
|
|
337
|
-
try:
|
|
338
|
-
return JSONResponse(status_code=200, content=walker_response)
|
|
339
|
-
except TypeError:
|
|
340
|
-
# Fallback to string representation if not directly JSON-serializable
|
|
341
|
-
return JSONResponse(
|
|
342
|
-
status_code=200, content={"result": str(walker_response)}
|
|
343
|
-
)
|
|
344
|
-
|
|
345
|
-
except Exception as e:
|
|
346
|
-
AgentInterface.LOGGER.error(f"Failed to format walker response: {e}")
|
|
347
|
-
return JSONResponse(
|
|
348
|
-
status_code=500,
|
|
349
|
-
content={"error": "Failed to format response", "details": str(e)},
|
|
350
|
-
)
|
|
286
|
+
return walker_response
|
|
351
287
|
|
|
352
288
|
except Exception as e:
|
|
353
289
|
AgentInterface.EXPIRATION = None
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
jvserve/__init__.py,sha256=pq6aKUL15KaEDAIo2zlj2RtTFVdN-vXUx3UVdOZxOeM,191
|
|
2
|
+
jvserve/cli.py,sha256=NJD4ehtKnhOvsz-vrFh9lz3P4bnxqz-uqTr8QItljZc,8897
|
|
3
|
+
jvserve/lib/__init__.py,sha256=cnzfSHLoTWG9Ygut2nOpDys5aPlQz-m0BSkB-nd7OMs,31
|
|
4
|
+
jvserve/lib/agent_interface.py,sha256=-uewEL_M4cZpZVl0rIOXnVpZI-3O9aGKLljoCgKSW0M,34955
|
|
5
|
+
jvserve/lib/agent_pulse.py,sha256=6hBF6KQYr6Z9Mi_yoWKGfdnW7gg84kK20Slu-bLR_m8,2067
|
|
6
|
+
jvserve/lib/file_interface.py,sha256=sqwTmBnZsVFQUGt7mE1EWA-jHnZlRtBAFeb4Rb_QgQ8,6079
|
|
7
|
+
jvserve/lib/jvlogger.py,sha256=RNiB9PHuBzTvNIQWhxoDgrDlNYA0PYm1SVpvzlqu8mE,4180
|
|
8
|
+
jvserve-2.0.16.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
9
|
+
jvserve-2.0.16.dist-info/METADATA,sha256=kRy2uTRK7zZBau0hAOt5BunMHO0m2OHHQPUzY9BGUOY,4791
|
|
10
|
+
jvserve-2.0.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
11
|
+
jvserve-2.0.16.dist-info/entry_points.txt,sha256=HYyg1QXoLs0JRb004L300VeLOZyDLY27ynD1tnTnEN4,35
|
|
12
|
+
jvserve-2.0.16.dist-info/top_level.txt,sha256=afoCXZv-zXNBuhVIvfJGjafXKEiJl_ooy4BtgQwAG4Q,8
|
|
13
|
+
jvserve-2.0.16.dist-info/RECORD,,
|
jvserve-2.0.15.dist-info/RECORD
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
jvserve/__init__.py,sha256=S9zx3emgI3a17M2NmUFp3sdzrZ9SDFwDKYAUR_TjDxE,191
|
|
2
|
-
jvserve/cli.py,sha256=NJD4ehtKnhOvsz-vrFh9lz3P4bnxqz-uqTr8QItljZc,8897
|
|
3
|
-
jvserve/lib/__init__.py,sha256=cnzfSHLoTWG9Ygut2nOpDys5aPlQz-m0BSkB-nd7OMs,31
|
|
4
|
-
jvserve/lib/agent_interface.py,sha256=d2trRXgLjUzciGSRwYD2Rl-TPnyJVpUKrgG1iU7CGyw,37768
|
|
5
|
-
jvserve/lib/agent_pulse.py,sha256=6hBF6KQYr6Z9Mi_yoWKGfdnW7gg84kK20Slu-bLR_m8,2067
|
|
6
|
-
jvserve/lib/file_interface.py,sha256=sqwTmBnZsVFQUGt7mE1EWA-jHnZlRtBAFeb4Rb_QgQ8,6079
|
|
7
|
-
jvserve/lib/jvlogger.py,sha256=RNiB9PHuBzTvNIQWhxoDgrDlNYA0PYm1SVpvzlqu8mE,4180
|
|
8
|
-
jvserve-2.0.15.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
9
|
-
jvserve-2.0.15.dist-info/METADATA,sha256=eXjQb1zag7Si-czz5V4wX60-6wr9E2eyz3yIETUF9i0,4791
|
|
10
|
-
jvserve-2.0.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
11
|
-
jvserve-2.0.15.dist-info/entry_points.txt,sha256=HYyg1QXoLs0JRb004L300VeLOZyDLY27ynD1tnTnEN4,35
|
|
12
|
-
jvserve-2.0.15.dist-info/top_level.txt,sha256=afoCXZv-zXNBuhVIvfJGjafXKEiJl_ooy4BtgQwAG4Q,8
|
|
13
|
-
jvserve-2.0.15.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|