zrb 1.7.3__py3-none-any.whl → 1.7.4__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.
@@ -201,11 +201,11 @@ def read_from_file(
201
201
  Raises:
202
202
  Exception: If an error occurs.
203
203
  """
204
+ abs_path = os.path.abspath(os.path.expanduser(path))
205
+ # Check if file exists
206
+ if not os.path.exists(abs_path):
207
+ raise FileNotFoundError(f"File not found: {path}")
204
208
  try:
205
- abs_path = os.path.abspath(os.path.expanduser(path))
206
- # Check if file exists
207
- if not os.path.exists(abs_path):
208
- return json.dumps({"error": f"File {path} does not exist"})
209
209
  content = read_file_with_line_numbers(abs_path)
210
210
  lines = content.splitlines()
211
211
  total_lines = len(lines)
@@ -402,24 +402,15 @@ def apply_diff(
402
402
  Raises:
403
403
  Exception: If an error occurs.
404
404
  """
405
+ abs_path = os.path.abspath(os.path.expanduser(path))
406
+ if not os.path.exists(abs_path):
407
+ raise FileNotFoundError(f"File not found: {path}")
405
408
  try:
406
- abs_path = os.path.abspath(os.path.expanduser(path))
407
- if not os.path.exists(abs_path):
408
- return json.dumps(
409
- {"success": False, "path": path, "error": f"File not found at {path}"}
410
- )
411
409
  content = read_file(abs_path)
412
410
  lines = content.splitlines()
413
411
  if start_line < 1 or end_line > len(lines) or start_line > end_line:
414
- return json.dumps(
415
- {
416
- "success": False,
417
- "path": path,
418
- "error": (
419
- f"Invalid line range {start_line}-{end_line} "
420
- f"for file with {len(lines)} lines."
421
- ),
422
- }
412
+ raise ValueError(
413
+ f"Invalid line range {start_line}-{end_line} for file with {len(lines)} lines"
423
414
  )
424
415
  original_content = "\n".join(lines[start_line - 1 : end_line])
425
416
  if original_content != search_content:
@@ -465,9 +456,8 @@ async def analyze_file(ctx: AnyContext, path: str, query: str) -> str:
465
456
  """
466
457
  abs_path = os.path.abspath(os.path.expanduser(path))
467
458
  if not os.path.exists(abs_path):
468
- return json.dumps(
469
- {"success": False, "path": path, "error": f"File not found at {path}"}
470
- )
459
+ raise FileNotFoundError(f"File not found: {path}")
460
+ file_content = read_file(abs_path)
471
461
  _analyze_file = create_sub_agent_tool(
472
462
  tool_name="analyze_file",
473
463
  tool_description="analyze file with LLM capability",
@@ -484,10 +474,12 @@ async def analyze_file(ctx: AnyContext, path: str, query: str) -> str:
484
474
  ctx,
485
475
  "\n".join(
486
476
  [
487
- "# File path",
488
- abs_path,
477
+ file_content,
489
478
  "# Instruction",
490
479
  query,
480
+ "# File path",
481
+ abs_path,
482
+ "# File content",
491
483
  ]
492
484
  ),
493
485
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: zrb
3
- Version: 1.7.3
3
+ Version: 1.7.4
4
4
  Summary: Your Automation Powerhouse
5
5
  Home-page: https://github.com/state-alchemists/zrb
6
6
  License: AGPL-3.0-or-later
@@ -17,7 +17,7 @@ zrb/builtin/llm/previous-session.js,sha256=xMKZvJoAbrwiyHS0OoPrWuaKxWYLoyR5sgueP
17
17
  zrb/builtin/llm/tool/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  zrb/builtin/llm/tool/api.py,sha256=yR9I0ZsI96OeQl9pgwORMASVuXsAL0a89D_iPS4C8Dc,1699
19
19
  zrb/builtin/llm/tool/cli.py,sha256=_CNEmEc6K2Z0i9ppYeM7jGpqaEdT3uxaWQatmxP3jKE,858
20
- zrb/builtin/llm/tool/file.py,sha256=4bbgsE2aCDR6Y4HbkMM--Q_ohmJW3KPqLbhuoJrrd8M,18173
20
+ zrb/builtin/llm/tool/file.py,sha256=nCY74VtruTr9LgAq5mroSr4zF0g6LA_uXMI5sh9c8OE,17909
21
21
  zrb/builtin/llm/tool/rag.py,sha256=VUyRBvnSeDf8T_lKY--c5HVTfccNgiEJU3QpwssJF8E,8182
22
22
  zrb/builtin/llm/tool/sub_agent.py,sha256=7n14KzUSFe5Bjf2lpluKlLyL-b1Mehj2QekkuDzo0ik,5091
23
23
  zrb/builtin/llm/tool/web.py,sha256=pXRLhcB_Y6z-2w4C4WezH8n-pg3PSMgt_bwn3aaqi6g,5479
@@ -370,7 +370,7 @@ zrb/util/string/name.py,sha256=SXEfxJ1-tDOzHqmSV8kvepRVyMqs2XdV_vyoh_9XUu0,1584
370
370
  zrb/util/todo.py,sha256=VGISej2KQZERpornK-8X7bysp4JydMrMUTnG8B0-liI,20708
371
371
  zrb/xcom/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
372
372
  zrb/xcom/xcom.py,sha256=o79rxR9wphnShrcIushA0Qt71d_p3ZTxjNf7x9hJB78,1571
373
- zrb-1.7.3.dist-info/METADATA,sha256=XgHOTXqZlnfTnKGLWhWJvkl4K5cz5_-5OPz0GS2zrSM,8385
374
- zrb-1.7.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
375
- zrb-1.7.3.dist-info/entry_points.txt,sha256=-Pg3ElWPfnaSM-XvXqCxEAa-wfVI6BEgcs386s8C8v8,46
376
- zrb-1.7.3.dist-info/RECORD,,
373
+ zrb-1.7.4.dist-info/METADATA,sha256=-C9uLHUST6zakEUGga9poKISERqL6VWDctrjCU6f8h8,8385
374
+ zrb-1.7.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
375
+ zrb-1.7.4.dist-info/entry_points.txt,sha256=-Pg3ElWPfnaSM-XvXqCxEAa-wfVI6BEgcs386s8C8v8,46
376
+ zrb-1.7.4.dist-info/RECORD,,
File without changes