janito 2.32.0__py3-none-any.whl → 2.33.0__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.
@@ -155,6 +155,32 @@ def _prepare_template_context(role, profile, allowed_permissions, args=None):
155
155
  getattr(args, "emoji", False) if "args" in locals() else False
156
156
  )
157
157
 
158
+ # Add current date/time with timezone using standard library
159
+ from datetime import datetime, timezone
160
+ import time
161
+
162
+ # Get local time with timezone info
163
+ local_time = datetime.now()
164
+
165
+ # Get timezone offset
166
+ if time.daylight:
167
+ offset = time.altzone
168
+ else:
169
+ offset = time.timezone
170
+
171
+ # Format offset as +HHMM or -HHMM
172
+ offset_hours = -offset // 3600
173
+ offset_minutes = abs(offset) % 3600 // 60
174
+ offset_str = f"{offset_hours:+03d}{offset_minutes:02d}"
175
+
176
+ # Get timezone name
177
+ tz_name = time.tzname[time.daylight and time.daylight or 0]
178
+
179
+ context["current_datetime"] = local_time.strftime(
180
+ f"%Y-%m-%d %H:%M:%S {tz_name}{offset_str}"
181
+ )
182
+ context["timezone"] = f"{tz_name} (UTC{offset_str})"
183
+
158
184
  return context
159
185
 
160
186
 
@@ -4,6 +4,8 @@
4
4
  {% if description %}Description: {{ description }}{% endif %}
5
5
  {% if author %}Author: {{ author }}{% endif %}
6
6
  {% if tags %}Tags: {{ tags | join(', ') }}{% endif %}
7
+ {% if current_datetime %}Current Date/Time: {{ current_datetime }}{% endif %}
8
+ {% if timezone %}Timezone: {{ timezone }}{% endif %}
7
9
 
8
10
  {# General role setup
9
11
  ex. "Search in code" -> Python Developer -> find(*.py) | Java Developer -> find(*.java)
@@ -4,6 +4,8 @@
4
4
  {% if description %}Description: {{ description }}{% endif %}
5
5
  {% if author %}Author: {{ author }}{% endif %}
6
6
  {% if tags %}Tags: {{ tags | join(', ') }}{% endif %}
7
+ {% if current_datetime %}Current Date/Time: {{ current_datetime }}{% endif %}
8
+ {% if timezone %}Timezone: {{ timezone }}{% endif %}
7
9
 
8
10
  You are: {{ role | default('software developer') }}
9
11
 
@@ -4,6 +4,8 @@
4
4
  {% if description %}Description: {{ description }}{% endif %}
5
5
  {% if author %}Author: {{ author }}{% endif %}
6
6
  {% if tags %}Tags: {{ tags | join(', ') }}{% endif %}
7
+ {% if current_datetime %}Current Date/Time: {{ current_datetime }}{% endif %}
8
+ {% if timezone %}Timezone: {{ timezone }}{% endif %}
7
9
 
8
10
  You are: {{ role | default('market analyst specializing in financial markets, business intelligence, and economic research') }}
9
11
 
@@ -4,6 +4,8 @@
4
4
  {% if description %}Description: {{ description }}{% endif %}
5
5
  {% if author %}Author: {{ author }}{% endif %}
6
6
  {% if tags %}Tags: {{ tags | join(', ') }}{% endif %}
7
+ {% if current_datetime %}Current Date/Time: {{ current_datetime }}{% endif %}
8
+ {% if timezone %}Timezone: {{ timezone }}{% endif %}
7
9
 
8
10
  You are: {{ role | default('helpful assistant') }}
9
11
 
@@ -246,11 +246,11 @@ class FetchUrlTool(ToolBase):
246
246
  return content
247
247
  except requests.exceptions.HTTPError as http_err:
248
248
  status_code = http_err.response.status_code if http_err.response else None
249
-
249
+
250
250
  # Map status codes to descriptions
251
251
  status_descriptions = {
252
252
  400: "Bad Request",
253
- 401: "Unauthorized",
253
+ 401: "Unauthorized",
254
254
  403: "Forbidden",
255
255
  404: "Not Found",
256
256
  405: "Method Not Allowed",
@@ -266,50 +266,68 @@ class FetchUrlTool(ToolBase):
266
266
  502: "Bad Gateway",
267
267
  503: "Service Unavailable",
268
268
  504: "Gateway Timeout",
269
- 505: "HTTP Version Not Supported"
269
+ 505: "HTTP Version Not Supported",
270
270
  }
271
-
271
+
272
272
  if status_code and 400 <= status_code < 500:
273
273
  description = status_descriptions.get(status_code, "Client Error")
274
- error_message = tr(
275
- "HTTP Error {status_code} {description}",
276
- status_code=status_code,
277
- description=description,
278
- )
274
+ error_message = f"HTTP {status_code} {description}"
279
275
  # Cache 403 and 404 errors
280
276
  if status_code in [403, 404]:
281
277
  self._cache_error(url, status_code, error_message)
282
278
 
283
279
  self.report_error(
284
- tr(
285
- "❗ HTTP Error {status_code} {description}",
286
- status_code=status_code,
287
- description=description,
288
- ),
280
+ f"❗ HTTP {status_code} {description}",
289
281
  ReportAction.READ,
290
282
  )
291
283
  return error_message
292
- else:
293
- description = status_descriptions.get(status_code, "Server Error") if status_code else "Error"
284
+ elif status_code and 500 <= status_code < 600:
285
+ description = status_descriptions.get(status_code, "Server Error")
286
+ error_message = f"HTTP {status_code} {description}"
294
287
  self.report_error(
295
- tr(
296
- "❗ HTTP Error {status_code} {description}",
297
- status_code=status_code or "Error",
298
- description=description,
299
- ),
288
+ f"❗ HTTP {status_code} {description}",
300
289
  ReportAction.READ,
301
290
  )
302
- return tr(
303
- "HTTP Error {status_code} {description}",
304
- status_code=status_code or "Error",
305
- description=description,
291
+ return error_message
292
+ else:
293
+ status_code_str = str(status_code) if status_code else "Error"
294
+ description = status_descriptions.get(
295
+ status_code,
296
+ (
297
+ "Server Error"
298
+ if status_code and status_code >= 500
299
+ else "Client Error"
300
+ ),
306
301
  )
302
+ self.report_error(
303
+ f"❗ HTTP {status_code_str} {description}",
304
+ ReportAction.READ,
305
+ )
306
+ return f"HTTP {status_code_str} {description}"
307
+ except requests.exceptions.ConnectionError as conn_err:
308
+ self.report_error(
309
+ "❗ Network Error",
310
+ ReportAction.READ,
311
+ )
312
+ return f"Network Error: Failed to connect to {url}"
313
+ except requests.exceptions.Timeout as timeout_err:
314
+ self.report_error(
315
+ "❗ Timeout Error",
316
+ ReportAction.READ,
317
+ )
318
+ return f"Timeout Error: Request timed out after {timeout} seconds"
319
+ except requests.exceptions.RequestException as req_err:
320
+ self.report_error(
321
+ "❗ Request Error",
322
+ ReportAction.READ,
323
+ )
324
+ return f"Request Error: {str(req_err)}"
307
325
  except Exception as err:
308
326
  self.report_error(
309
- tr("❗ Error"),
327
+ "❗ Error fetching URL",
310
328
  ReportAction.READ,
311
329
  )
312
- return tr("Error")
330
+ return f"Error: {str(err)}"
313
331
 
314
332
  def _extract_and_clean_text(self, html_content: str) -> str:
315
333
  """Extract and clean text from HTML content."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: janito
3
- Version: 2.32.0
3
+ Version: 2.33.0
4
4
  Summary: A new Python package called janito.
5
5
  Author-email: João Pinto <janito@ikignosis.org>
6
6
  Project-URL: Homepage, https://github.com/ikignosis/janito
@@ -20,11 +20,11 @@ janito/provider_registry.py,sha256=IRNB35Cjn4PSXMWOxKBjPg0DfUEOoL4vh63OSPxhMtk,6
20
20
  janito/report_events.py,sha256=q4OR_jTZNfcqaQF_fzTjgqo6_VlUIxSGWfhpT4nJWcw,938
21
21
  janito/shell.bak.zip,sha256=hznHbmgfkAkjuQDJ3w73XPQh05yrtUZQxLmtGbanbYU,22
22
22
  janito/utils.py,sha256=eXSsMgM69YyzahgCNrJQLcEbB8ssLI1MQqaa20ONxbE,376
23
- janito/agent/setup_agent.py,sha256=Qo9fm9O5IUd65ao4KODOMd6f7baw_mEiluj1pBNxrIg,12228
24
- janito/agent/templates/profiles/system_prompt_template_Developer_with_Python_Tools.txt.j2,sha256=Q6p57GakGJv4damUITO0iq8rwfhPxVlek6y3I7nnkK8,3931
25
- janito/agent/templates/profiles/system_prompt_template_developer.txt.j2,sha256=lG6ihPRoGqJ0ho2jb1sgBPs9itwpSYpy9CrLjXwZxB0,3614
26
- janito/agent/templates/profiles/system_prompt_template_market_analyst.txt.j2,sha256=TCoZITPBOMvN3zA6QXg6UCNrHWj_iDKRxAREwYev5Ks,4123
27
- janito/agent/templates/profiles/system_prompt_template_model_conversation_without_tools_or_context.txt.j2,sha256=ynhuZESiVvmwHW0pKNUCu9wXexYkFxs6vf4AcC_r24g,1589
23
+ janito/agent/setup_agent.py,sha256=DIc8gcX41CHWg6YGVSqQJuQxl1iUYk9JIR07wTvHJyk,13012
24
+ janito/agent/templates/profiles/system_prompt_template_Developer_with_Python_Tools.txt.j2,sha256=gA_Br5UoM-CS8eyoYUtoPz4v2IXCjBcaRQmZ-chEEAI,4064
25
+ janito/agent/templates/profiles/system_prompt_template_developer.txt.j2,sha256=6cKS-UJ8pJX3voGsMFqMrJWCCYH0aX8ZWcToRCeEbI4,3747
26
+ janito/agent/templates/profiles/system_prompt_template_market_analyst.txt.j2,sha256=V9JAxdZcWkl53rmSRnrJCjHIsRM6GWEsNLno2hdKx7M,4256
27
+ janito/agent/templates/profiles/system_prompt_template_model_conversation_without_tools_or_context.txt.j2,sha256=Zgoa26AlR37rjYAPl-4ydA3NdHm8ylT831IaMiGTd5o,1722
28
28
  janito/cli/__init__.py,sha256=xaPDOrWphBbCR63Xpcx_yfpXSJIlCaaICc4j2qpWqrM,194
29
29
  janito/cli/config.py,sha256=HkZ14701HzIqrvaNyDcDhGlVHfpX_uHlLp2rHmhRm_k,872
30
30
  janito/cli/console.py,sha256=gJolqzWL7jEPLxeuH-CwBDRFpXt976KdZOEAB2tdBDs,64
@@ -214,7 +214,7 @@ janito/tools/adapters/local/copy_file.py,sha256=SBJm19Ipe5dqRE1Mxl6JSrn4bNmfObVn
214
214
  janito/tools/adapters/local/create_directory.py,sha256=LxwqQEsnOrEphCIoaMRRx9P9bu0MzidP3Fc5q6letxc,2584
215
215
  janito/tools/adapters/local/create_file.py,sha256=fLTVnMpDnHzzIVK3nS0DtawBT-I18Is-qa0Hg8y6TXY,6385
216
216
  janito/tools/adapters/local/delete_text_in_file.py,sha256=uEeedRxXAR7_CqUc_qhbEdM0OzRi_pgnP-iDjs2Zvjk,5087
217
- janito/tools/adapters/local/fetch_url.py,sha256=y_KL85y01VxOSPBBr9kQqJiPH3QNFnd248kVYfVKL0g,17401
217
+ janito/tools/adapters/local/fetch_url.py,sha256=QjoOZj06PjsU8uFjJ6O8Fy-WUvS4GhSaHAJQx2rAzoE,18212
218
218
  janito/tools/adapters/local/find_files.py,sha256=Zbag3aP34vc7ffJh8bOqAwXj3KiZhV--uzTVHtNb-fI,6250
219
219
  janito/tools/adapters/local/move_file.py,sha256=LMGm8bn3NNyIPJG4vrlO09smXQcgzA09EwoooZxkIA8,4695
220
220
  janito/tools/adapters/local/open_html_in_browser.py,sha256=XqICIwVx5vEE77gHkaNAC-bAeEEy0DBmDksATiL-sRY,2101
@@ -255,9 +255,9 @@ janito/tools/adapters/local/validate_file_syntax/ps1_validator.py,sha256=TeIkPt0
255
255
  janito/tools/adapters/local/validate_file_syntax/python_validator.py,sha256=BfCO_K18qy92m-2ZVvHsbEU5e11OPo1pO9Vz4G4616E,130
256
256
  janito/tools/adapters/local/validate_file_syntax/xml_validator.py,sha256=AijlsP_PgNuC8ZbGsC5vOTt3Jur76otQzkd_7qR0QFY,284
257
257
  janito/tools/adapters/local/validate_file_syntax/yaml_validator.py,sha256=TgyI0HRL6ug_gBcWEm5TGJJuA4E34ZXcIzMpAbv3oJs,155
258
- janito-2.32.0.dist-info/licenses/LICENSE,sha256=dXV4fOF2ZErugtN8l_Nrj5tsRTYgtjE3cgiya0UfBio,11356
259
- janito-2.32.0.dist-info/METADATA,sha256=6pd4z_QSOVCqudBl5Ox6xD-mUtDLK6Ja9OrltqjP_dk,2313
260
- janito-2.32.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
261
- janito-2.32.0.dist-info/entry_points.txt,sha256=wIo5zZxbmu4fC-ZMrsKD0T0vq7IqkOOLYhrqRGypkx4,48
262
- janito-2.32.0.dist-info/top_level.txt,sha256=m0NaVCq0-ivxbazE2-ND0EA9Hmuijj_OGkmCbnBcCig,7
263
- janito-2.32.0.dist-info/RECORD,,
258
+ janito-2.33.0.dist-info/licenses/LICENSE,sha256=dXV4fOF2ZErugtN8l_Nrj5tsRTYgtjE3cgiya0UfBio,11356
259
+ janito-2.33.0.dist-info/METADATA,sha256=VvNpRDQ9_KEcxzU3YvUh3dXFr6ja6XSEaxpBJ_ydEIU,2313
260
+ janito-2.33.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
261
+ janito-2.33.0.dist-info/entry_points.txt,sha256=wIo5zZxbmu4fC-ZMrsKD0T0vq7IqkOOLYhrqRGypkx4,48
262
+ janito-2.33.0.dist-info/top_level.txt,sha256=m0NaVCq0-ivxbazE2-ND0EA9Hmuijj_OGkmCbnBcCig,7
263
+ janito-2.33.0.dist-info/RECORD,,