zrb 1.9.4__py3-none-any.whl → 1.9.6__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.
- zrb/__init__.py +8 -8
- zrb/__main__.py +1 -1
- zrb/builtin/__init__.py +0 -50
- zrb/builtin/llm/chat_session.py +1 -1
- zrb/builtin/llm/history.py +1 -1
- zrb/builtin/llm/llm_ask.py +3 -3
- zrb/builtin/llm/tool/api.py +19 -9
- zrb/builtin/llm/tool/cli.py +11 -5
- zrb/builtin/llm/tool/code.py +20 -20
- zrb/builtin/llm/tool/file.py +107 -155
- zrb/builtin/llm/tool/rag.py +28 -5
- zrb/builtin/llm/tool/sub_agent.py +12 -14
- zrb/builtin/llm/tool/web.py +46 -14
- zrb/builtin/todo.py +1 -1
- zrb/{llm_config.py → config/llm_config.py} +143 -158
- zrb/{llm_rate_limitter.py → config/llm_rate_limitter.py} +1 -1
- zrb/{runner → config}/web_auth_config.py +1 -1
- zrb/context/shared_context.py +1 -1
- zrb/input/text_input.py +1 -1
- zrb/runner/cli.py +2 -2
- zrb/runner/web_app.py +2 -2
- zrb/runner/web_route/docs_route.py +1 -1
- zrb/runner/web_route/error_page/serve_default_404.py +1 -1
- zrb/runner/web_route/error_page/show_error_page.py +1 -1
- zrb/runner/web_route/home_page/home_page_route.py +2 -2
- zrb/runner/web_route/login_api_route.py +1 -1
- zrb/runner/web_route/login_page/login_page_route.py +2 -2
- zrb/runner/web_route/logout_api_route.py +1 -1
- zrb/runner/web_route/logout_page/logout_page_route.py +2 -2
- zrb/runner/web_route/node_page/group/show_group_page.py +1 -1
- zrb/runner/web_route/node_page/node_page_route.py +1 -1
- zrb/runner/web_route/node_page/task/show_task_page.py +1 -1
- zrb/runner/web_route/refresh_token_api_route.py +1 -1
- zrb/runner/web_route/static/static_route.py +1 -1
- zrb/runner/web_route/task_input_api_route.py +1 -1
- zrb/runner/web_route/task_session_api_route.py +1 -1
- zrb/runner/web_util/cookie.py +1 -1
- zrb/runner/web_util/token.py +1 -1
- zrb/runner/web_util/user.py +1 -1
- zrb/session_state_logger/session_state_logger_factory.py +1 -1
- zrb/task/cmd_task.py +1 -1
- zrb/task/llm/agent.py +1 -1
- zrb/task/llm/config.py +1 -1
- zrb/task/llm/context_enrichment.py +2 -2
- zrb/task/llm/history_summarization.py +2 -2
- zrb/task/llm/prompt.py +1 -1
- zrb/task/llm_task.py +1 -1
- zrb/util/init_path.py +1 -1
- zrb-1.9.6.dist-info/METADATA +250 -0
- {zrb-1.9.4.dist-info → zrb-1.9.6.dist-info}/RECORD +53 -53
- zrb-1.9.4.dist-info/METADATA +0 -245
- /zrb/{config.py → config/config.py} +0 -0
- {zrb-1.9.4.dist-info → zrb-1.9.6.dist-info}/WHEEL +0 -0
- {zrb-1.9.4.dist-info → zrb-1.9.6.dist-info}/entry_points.txt +0 -0
zrb/__init__.py
CHANGED
@@ -14,7 +14,7 @@ _LAZY_LOAD = {
|
|
14
14
|
"CmdResult": "zrb.cmd.cmd_result",
|
15
15
|
"Cmd": "zrb.cmd.cmd_val",
|
16
16
|
"CmdPath": "zrb.cmd.cmd_val",
|
17
|
-
"CFG": "zrb.config",
|
17
|
+
"CFG": "zrb.config.config",
|
18
18
|
"AnyContentTransformer": "zrb.content_transformer.any_content_transformer",
|
19
19
|
"ContentTransformer": "zrb.content_transformer.content_transformer",
|
20
20
|
"AnyContext": "zrb.context.any_context",
|
@@ -36,10 +36,10 @@ _LAZY_LOAD = {
|
|
36
36
|
"PasswordInput": "zrb.input.password_input",
|
37
37
|
"StrInput": "zrb.input.str_input",
|
38
38
|
"TextInput": "zrb.input.text_input",
|
39
|
-
"llm_config": "zrb.llm_config",
|
40
|
-
"llm_rate_limitter": "zrb.llm_rate_limitter",
|
39
|
+
"llm_config": "zrb.config.llm_config",
|
40
|
+
"llm_rate_limitter": "zrb.config.llm_rate_limitter",
|
41
41
|
"cli": "zrb.runner.cli",
|
42
|
-
"web_auth_config": "zrb.
|
42
|
+
"web_auth_config": "zrb.config.web_auth_config",
|
43
43
|
"User": "zrb.runner.web_schema.user",
|
44
44
|
"Session": "zrb.session.session",
|
45
45
|
"AnyTask": "zrb.task.any_task",
|
@@ -74,7 +74,10 @@ if TYPE_CHECKING:
|
|
74
74
|
from zrb.callback.callback import Callback
|
75
75
|
from zrb.cmd.cmd_result import CmdResult
|
76
76
|
from zrb.cmd.cmd_val import Cmd, CmdPath
|
77
|
-
from zrb.config import CFG
|
77
|
+
from zrb.config.config import CFG
|
78
|
+
from zrb.config.llm_config import llm_config
|
79
|
+
from zrb.config.llm_rate_limitter import llm_rate_limitter
|
80
|
+
from zrb.config.web_auth_config import web_auth_config
|
78
81
|
from zrb.content_transformer.any_content_transformer import AnyContentTransformer
|
79
82
|
from zrb.content_transformer.content_transformer import ContentTransformer
|
80
83
|
from zrb.context.any_context import AnyContext
|
@@ -96,10 +99,7 @@ if TYPE_CHECKING:
|
|
96
99
|
from zrb.input.password_input import PasswordInput
|
97
100
|
from zrb.input.str_input import StrInput
|
98
101
|
from zrb.input.text_input import TextInput
|
99
|
-
from zrb.llm_config import llm_config
|
100
|
-
from zrb.llm_rate_limitter import llm_rate_limitter
|
101
102
|
from zrb.runner.cli import cli
|
102
|
-
from zrb.runner.web_auth_config import web_auth_config
|
103
103
|
from zrb.runner.web_schema.user import User
|
104
104
|
from zrb.session.session import Session
|
105
105
|
from zrb.task.any_task import AnyTask
|
zrb/__main__.py
CHANGED
zrb/builtin/__init__.py
CHANGED
@@ -43,53 +43,3 @@ from zrb.builtin.uuid import (
|
|
43
43
|
validate_uuid_v4,
|
44
44
|
validate_uuid_v5,
|
45
45
|
)
|
46
|
-
|
47
|
-
assert create_project
|
48
|
-
assert add_fastapp_to_project
|
49
|
-
assert get_shell_subcommands
|
50
|
-
assert make_bash_autocomplete
|
51
|
-
assert make_zsh_autocomplete
|
52
|
-
assert encode_base64
|
53
|
-
assert decode_base64
|
54
|
-
assert validate_base64
|
55
|
-
assert encode_jwt
|
56
|
-
assert decode_jwt
|
57
|
-
assert validate_jwt
|
58
|
-
assert llm_ask
|
59
|
-
assert hash_md5
|
60
|
-
assert sum_md5
|
61
|
-
assert validate_md5
|
62
|
-
assert get_git_diff
|
63
|
-
assert prune_local_branches
|
64
|
-
assert format_python_code
|
65
|
-
assert git_commit
|
66
|
-
assert git_pull
|
67
|
-
assert git_push
|
68
|
-
assert git_add_subtree
|
69
|
-
assert git_pull_subtree
|
70
|
-
assert git_push_subtree
|
71
|
-
assert list_todo
|
72
|
-
assert add_todo
|
73
|
-
assert archive_todo
|
74
|
-
assert edit_todo
|
75
|
-
assert complete_todo
|
76
|
-
assert log_todo
|
77
|
-
assert show_todo
|
78
|
-
assert throw_dice
|
79
|
-
assert shuffle_values
|
80
|
-
assert setup_ubuntu
|
81
|
-
assert setup_latex_on_ubuntu
|
82
|
-
assert setup_asdf
|
83
|
-
assert setup_tmux
|
84
|
-
assert setup_zsh
|
85
|
-
assert validate_uuid
|
86
|
-
assert validate_uuid_v1
|
87
|
-
assert validate_uuid_v3
|
88
|
-
assert validate_uuid_v4
|
89
|
-
assert validate_uuid_v5
|
90
|
-
assert generate_uuid_v1
|
91
|
-
assert generate_uuid_v3
|
92
|
-
assert generate_uuid_v4
|
93
|
-
assert generate_uuid_v5
|
94
|
-
assert http_request
|
95
|
-
assert generate_curl
|
zrb/builtin/llm/chat_session.py
CHANGED
@@ -7,8 +7,8 @@ conversation flow via XCom.
|
|
7
7
|
|
8
8
|
import asyncio
|
9
9
|
|
10
|
+
from zrb.config.llm_config import llm_config
|
10
11
|
from zrb.context.any_context import AnyContext
|
11
|
-
from zrb.llm_config import llm_config
|
12
12
|
from zrb.util.cli.style import stylize_bold_yellow, stylize_faint
|
13
13
|
|
14
14
|
|
zrb/builtin/llm/history.py
CHANGED
@@ -2,7 +2,7 @@ import json
|
|
2
2
|
import os
|
3
3
|
from typing import Any
|
4
4
|
|
5
|
-
from zrb.config import CFG
|
5
|
+
from zrb.config.config import CFG
|
6
6
|
from zrb.context.any_shared_context import AnySharedContext
|
7
7
|
from zrb.task.llm.history import ConversationHistoryData
|
8
8
|
from zrb.util.file import read_file, write_file
|
zrb/builtin/llm/llm_ask.py
CHANGED
@@ -7,10 +7,10 @@ from zrb.builtin.llm.tool.cli import run_shell_command
|
|
7
7
|
from zrb.builtin.llm.tool.code import analyze_repo
|
8
8
|
from zrb.builtin.llm.tool.file import (
|
9
9
|
analyze_file,
|
10
|
-
apply_diff,
|
11
10
|
list_files,
|
12
11
|
read_from_file,
|
13
12
|
read_many_files,
|
13
|
+
replace_in_file,
|
14
14
|
search_files,
|
15
15
|
write_many_files,
|
16
16
|
write_to_file,
|
@@ -22,7 +22,7 @@ from zrb.builtin.llm.tool.web import (
|
|
22
22
|
search_wikipedia,
|
23
23
|
)
|
24
24
|
from zrb.callback.callback import Callback
|
25
|
-
from zrb.config import CFG
|
25
|
+
from zrb.config.config import CFG
|
26
26
|
from zrb.input.bool_input import BoolInput
|
27
27
|
from zrb.input.str_input import StrInput
|
28
28
|
from zrb.input.text_input import TextInput
|
@@ -135,7 +135,7 @@ if CFG.LLM_ALLOW_ACCESS_LOCAL_FILE:
|
|
135
135
|
list_files,
|
136
136
|
read_from_file,
|
137
137
|
read_many_files,
|
138
|
-
|
138
|
+
replace_in_file,
|
139
139
|
write_to_file,
|
140
140
|
write_many_files,
|
141
141
|
)
|
zrb/builtin/llm/tool/api.py
CHANGED
@@ -3,11 +3,16 @@ from typing import Literal
|
|
3
3
|
|
4
4
|
|
5
5
|
def get_current_location() -> str:
|
6
|
-
"""
|
6
|
+
"""
|
7
|
+
Fetches the user's current geographical location (latitude and longitude) based on their IP address.
|
8
|
+
|
9
|
+
Use this tool when the user asks "Where am I?", "What is my current location?", or has a query that requires knowing their location to be answered.
|
10
|
+
|
7
11
|
Returns:
|
8
|
-
str: JSON string
|
12
|
+
str: A JSON string containing the 'lat' and 'lon' of the current location.
|
13
|
+
Example: '{"lat": 48.8584, "lon": 2.2945}'
|
9
14
|
Raises:
|
10
|
-
requests.RequestException: If the API request fails.
|
15
|
+
requests.RequestException: If the API request to the location service fails.
|
11
16
|
"""
|
12
17
|
import requests
|
13
18
|
|
@@ -24,15 +29,20 @@ def get_current_weather(
|
|
24
29
|
longitude: float,
|
25
30
|
temperature_unit: Literal["celsius", "fahrenheit"],
|
26
31
|
) -> str:
|
27
|
-
"""
|
32
|
+
"""
|
33
|
+
Retrieves the current weather conditions for a given geographical location.
|
34
|
+
|
35
|
+
Use this tool when the user asks about the weather. If the user does not provide a location, first use the `get_current_location` tool to determine their location.
|
36
|
+
|
28
37
|
Args:
|
29
|
-
latitude (float):
|
30
|
-
longitude (float):
|
31
|
-
temperature_unit (Literal["celsius", "fahrenheit"]):
|
38
|
+
latitude (float): The latitude of the location.
|
39
|
+
longitude (float): The longitude of the location.
|
40
|
+
temperature_unit (Literal["celsius", "fahrenheit"]): The desired unit for the temperature reading.
|
41
|
+
|
32
42
|
Returns:
|
33
|
-
str: JSON string
|
43
|
+
str: A JSON string containing detailed weather data, including temperature, wind speed, and weather code.
|
34
44
|
Raises:
|
35
|
-
requests.RequestException: If the API request fails.
|
45
|
+
requests.RequestException: If the API request to the weather service fails.
|
36
46
|
"""
|
37
47
|
import requests
|
38
48
|
|
zrb/builtin/llm/tool/cli.py
CHANGED
@@ -2,14 +2,20 @@ import subprocess
|
|
2
2
|
|
3
3
|
|
4
4
|
def run_shell_command(command: str) -> str:
|
5
|
-
"""
|
5
|
+
"""
|
6
|
+
Executes a shell command on the user's local machine and returns the output.
|
7
|
+
|
8
|
+
This tool is powerful and should be used for tasks that require interacting with the command line, such as running scripts, managing system processes, or using command-line tools.
|
9
|
+
|
10
|
+
**Security Warning:** This tool executes commands with the same permissions as the user running the assistant. Before executing any command that could modify files or system state (e.g., `git`, `npm`, `pip`, `docker`), you MUST explain what the command does and ask the user for confirmation.
|
11
|
+
|
6
12
|
Args:
|
7
|
-
command (str):
|
13
|
+
command (str): The exact shell command to execute.
|
14
|
+
|
8
15
|
Returns:
|
9
|
-
str: The
|
16
|
+
str: The combined standard output (stdout) and standard error (stderr) from the command. If the command fails, this will contain the error message.
|
10
17
|
Raises:
|
11
|
-
subprocess.CalledProcessError: If the command returns a non-zero exit code.
|
12
|
-
subprocess.SubprocessError: If there's an issue with subprocess execution.
|
18
|
+
subprocess.CalledProcessError: If the command returns a non-zero exit code, indicating an error.
|
13
19
|
"""
|
14
20
|
try:
|
15
21
|
output = subprocess.check_output(
|
zrb/builtin/llm/tool/code.py
CHANGED
@@ -3,8 +3,8 @@ import os
|
|
3
3
|
|
4
4
|
from zrb.builtin.llm.tool.file import DEFAULT_EXCLUDED_PATTERNS, is_excluded
|
5
5
|
from zrb.builtin.llm.tool.sub_agent import create_sub_agent_tool
|
6
|
+
from zrb.config.llm_rate_limitter import llm_rate_limitter
|
6
7
|
from zrb.context.any_context import AnyContext
|
7
|
-
from zrb.llm_rate_limitter import llm_rate_limitter
|
8
8
|
|
9
9
|
_EXTRACT_INFO_FROM_REPO_SYSTEM_PROMPT = """
|
10
10
|
You are an extraction info agent.
|
@@ -86,29 +86,29 @@ async def analyze_repo(
|
|
86
86
|
summarization_token_limit: int = 40000,
|
87
87
|
) -> str:
|
88
88
|
"""
|
89
|
-
|
90
|
-
|
89
|
+
Performs a deep, goal-oriented analysis of a code repository or directory.
|
90
|
+
|
91
|
+
This powerful tool recursively reads all relevant files in a directory, extracts key information, and then summarizes that information in relation to a specific goal. It uses intelligent sub-agents for extraction and summarization, making it ideal for complex tasks that require a holistic understanding of a codebase.
|
92
|
+
|
91
93
|
Use this tool for:
|
92
|
-
-
|
93
|
-
-
|
94
|
-
- code review
|
95
|
-
-
|
96
|
-
-
|
94
|
+
- Understanding a large or unfamiliar codebase.
|
95
|
+
- Generating high-level summaries of a project's architecture.
|
96
|
+
- Performing a preliminary code review.
|
97
|
+
- Creating documentation or diagrams (e.g., "Generate a Mermaid C4 diagram for this service").
|
98
|
+
- Answering broad questions like "How does the authentication in this project work?".
|
99
|
+
|
97
100
|
Args:
|
98
|
-
path (str):
|
99
|
-
goal(str):
|
100
|
-
extensions(
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
the extraction assistant able to handle. Defaults to 150000
|
106
|
-
summarization_token_limit(Optional[int]): Max resource content char length
|
107
|
-
the summarization assistant able to handle. Defaults to 150000
|
101
|
+
path (str): The path to the directory or repository to analyze.
|
102
|
+
goal (str): A clear and specific description of what you want to achieve. A good goal is critical for getting a useful result. For example: "Understand the database schema by analyzing all the .sql files" or "Create a summary of all the API endpoints defined in the 'api' directory".
|
103
|
+
extensions (list[str], optional): A list of file extensions to include in the analysis. Defaults to a comprehensive list of common code and configuration files.
|
104
|
+
exclude_patterns (list[str], optional): A list of glob patterns for files and directories to exclude from the analysis. Defaults to common patterns like '.git', 'node_modules', and '.venv'.
|
105
|
+
extraction_token_limit (int, optional): The maximum token limit for the extraction sub-agent.
|
106
|
+
summarization_token_limit (int, optional): The maximum token limit for the summarization sub-agent.
|
107
|
+
|
108
108
|
Returns:
|
109
|
-
str:
|
109
|
+
str: A detailed, markdown-formatted analysis and summary of the repository, tailored to the specified goal.
|
110
110
|
Raises:
|
111
|
-
Exception: If an error occurs.
|
111
|
+
Exception: If an error occurs during the analysis.
|
112
112
|
"""
|
113
113
|
abs_path = os.path.abspath(os.path.expanduser(path))
|
114
114
|
file_metadatas = _get_file_metadatas(abs_path, extensions, exclude_patterns)
|