jvserve 2.1.16__py3-none-any.whl → 2.1.17__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.
@@ -15,6 +15,7 @@ class AgentInterface:
15
15
 
16
16
  _instance = None
17
17
  logger = logging.getLogger(__name__)
18
+ timeout = int(os.environ.get("JIVAS_REQUEST_TIMEOUT", 30))
18
19
 
19
20
  def __init__(self, host: str = "localhost", port: int = 8000) -> None:
20
21
  """Initialize the AgentInterface with JacInterface."""
@@ -49,8 +50,10 @@ class AgentInterface:
49
50
  def api_pulse(self, action_label: str, agent_id: str) -> dict:
50
51
  """Synchronous pulse API call"""
51
52
  if not self._jac.is_valid():
52
- self.logger.warning("Invalid API state for pulse")
53
- return {}
53
+ self.logger.warning(
54
+ "Invalid API state for pulse, attempting to reinstate it..."
55
+ )
56
+ self._jac._authenticate()
54
57
 
55
58
  # Clean parameters
56
59
  action_label = action_label.replace("action_label=", "")
@@ -62,7 +65,7 @@ class AgentInterface:
62
65
 
63
66
  try:
64
67
  response = requests.post(
65
- endpoint, json=payload, headers=headers, timeout=10
68
+ endpoint, json=payload, headers=headers, timeout=self.timeout
66
69
  )
67
70
  if response.status_code == 200:
68
71
  return response.json().get("reports", {})
@@ -25,6 +25,8 @@ from jaclang.runtimelib.machine import JacMachine
25
25
  class JacInterface:
26
26
  """Thread-safe connection and context state provider for Jac Runtime with auto-authentication."""
27
27
 
28
+ timeout = int(os.environ.get("JIVAS_REQUEST_TIMEOUT", 30))
29
+
28
30
  def __init__(self, host: str = "localhost", port: int = 8000) -> None:
29
31
  """Initialize JacInterface with host and port."""
30
32
  self.host = host
@@ -155,7 +157,9 @@ class JacInterface:
155
157
  try:
156
158
  # Try login first
157
159
  response = requests.post(
158
- login_url, json={"email": user, "password": password}, timeout=15
160
+ login_url,
161
+ json={"email": user, "password": password},
162
+ timeout=self.timeout,
159
163
  )
160
164
  self.logger.info(f"Login response status: {response.status_code}")
161
165
  if response.status_code == 200:
@@ -164,7 +168,9 @@ class JacInterface:
164
168
 
165
169
  # Register if login fails
166
170
  reg_response = requests.post(
167
- register_url, json={"email": user, "password": password}, timeout=15
171
+ register_url,
172
+ json={"email": user, "password": password},
173
+ timeout=self.timeout,
168
174
  )
169
175
  self.logger.info(
170
176
  f"Register response status: {reg_response.status_code}"
@@ -174,7 +180,7 @@ class JacInterface:
174
180
  login_response = requests.post(
175
181
  login_url,
176
182
  json={"email": user, "password": password},
177
- timeout=15,
183
+ timeout=self.timeout,
178
184
  )
179
185
  self.logger.info(
180
186
  f"Retry login response status: {login_response.status_code}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jvserve
3
- Version: 2.1.16
3
+ Version: 2.1.17
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.
@@ -1,14 +1,14 @@
1
1
  jvserve/__init__.py,sha256=Jd0pamSDn2wGTZkNk8I9qNYTFBHp7rasdYO0_Dvad_k,245
2
2
  jvserve/cli.py,sha256=b1AHsiJUsMVHZ7ZOKhrOJSvISPh5O5O020aoDJQJ0Rk,13910
3
3
  jvserve/lib/__init__.py,sha256=cnzfSHLoTWG9Ygut2nOpDys5aPlQz-m0BSkB-nd7OMs,31
4
- jvserve/lib/agent_interface.py,sha256=Igv5Jb7i9Aq_7IbLDZ6jnldGKssAWKeb6iXoolX8u4k,3478
4
+ jvserve/lib/agent_interface.py,sha256=p7Fofd5q6Fk-Q900qbvPu2gB4TemPJFkOPgSq1w-oyk,3628
5
5
  jvserve/lib/agent_pulse.py,sha256=6hBF6KQYr6Z9Mi_yoWKGfdnW7gg84kK20Slu-bLR_m8,2067
6
6
  jvserve/lib/file_interface.py,sha256=VO9RBCtJwaBxu5eZjc57-uRbsVXXZt86wVRVq9R3KXY,6079
7
- jvserve/lib/jac_interface.py,sha256=ydhXfYTsrhdvMXBTAd_vnAXJSSVBydQ3qavPU1-oodU,7973
7
+ jvserve/lib/jac_interface.py,sha256=7LuY_ddG9qANgRWk7i7Oum6cX_EzB_mYAH7YYRH7ytQ,8149
8
8
  jvserve/lib/jvlogger.py,sha256=RNiB9PHuBzTvNIQWhxoDgrDlNYA0PYm1SVpvzlqu8mE,4180
9
- jvserve-2.1.16.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
10
- jvserve-2.1.16.dist-info/METADATA,sha256=NY8quNVWCkDnV-zbXAfRunwL4WQ7PDxvs9JBQziSgW8,4821
11
- jvserve-2.1.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
12
- jvserve-2.1.16.dist-info/entry_points.txt,sha256=HYyg1QXoLs0JRb004L300VeLOZyDLY27ynD1tnTnEN4,35
13
- jvserve-2.1.16.dist-info/top_level.txt,sha256=afoCXZv-zXNBuhVIvfJGjafXKEiJl_ooy4BtgQwAG4Q,8
14
- jvserve-2.1.16.dist-info/RECORD,,
9
+ jvserve-2.1.17.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
10
+ jvserve-2.1.17.dist-info/METADATA,sha256=03dypxwccncxgYacVU4cPQ53ncrkMd4Gc9g425UmTNs,4821
11
+ jvserve-2.1.17.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
12
+ jvserve-2.1.17.dist-info/entry_points.txt,sha256=HYyg1QXoLs0JRb004L300VeLOZyDLY27ynD1tnTnEN4,35
13
+ jvserve-2.1.17.dist-info/top_level.txt,sha256=afoCXZv-zXNBuhVIvfJGjafXKEiJl_ooy4BtgQwAG4Q,8
14
+ jvserve-2.1.17.dist-info/RECORD,,