zrb 1.15.3__py3-none-any.whl → 2.0.0a4__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 zrb might be problematic. Click here for more details.
- zrb/__init__.py +118 -133
- zrb/attr/type.py +10 -7
- zrb/builtin/__init__.py +55 -1
- zrb/builtin/git.py +12 -1
- zrb/builtin/group.py +31 -15
- zrb/builtin/llm/chat.py +147 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/add_entity_util.py +7 -7
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/add_module_util.py +5 -5
- zrb/builtin/project/add/fastapp/fastapp_util.py +1 -1
- zrb/builtin/searxng/config/settings.yml +5671 -0
- zrb/builtin/searxng/start.py +21 -0
- zrb/builtin/shell/autocomplete/bash.py +4 -3
- zrb/builtin/shell/autocomplete/zsh.py +4 -3
- zrb/callback/callback.py +8 -1
- zrb/cmd/cmd_result.py +2 -1
- zrb/config/config.py +555 -169
- zrb/config/helper.py +84 -0
- zrb/config/web_auth_config.py +50 -35
- zrb/context/any_shared_context.py +20 -3
- zrb/context/context.py +39 -5
- zrb/context/print_fn.py +13 -0
- zrb/context/shared_context.py +17 -8
- zrb/group/any_group.py +3 -3
- zrb/group/group.py +3 -3
- zrb/input/any_input.py +5 -1
- zrb/input/base_input.py +18 -6
- zrb/input/option_input.py +41 -1
- zrb/input/text_input.py +7 -24
- zrb/llm/agent/__init__.py +9 -0
- zrb/llm/agent/agent.py +215 -0
- zrb/llm/agent/summarizer.py +20 -0
- zrb/llm/app/__init__.py +10 -0
- zrb/llm/app/completion.py +281 -0
- zrb/llm/app/confirmation/allow_tool.py +66 -0
- zrb/llm/app/confirmation/handler.py +178 -0
- zrb/llm/app/confirmation/replace_confirmation.py +77 -0
- zrb/llm/app/keybinding.py +34 -0
- zrb/llm/app/layout.py +117 -0
- zrb/llm/app/lexer.py +155 -0
- zrb/llm/app/redirection.py +28 -0
- zrb/llm/app/style.py +16 -0
- zrb/llm/app/ui.py +733 -0
- zrb/llm/config/__init__.py +4 -0
- zrb/llm/config/config.py +122 -0
- zrb/llm/config/limiter.py +247 -0
- zrb/llm/history_manager/__init__.py +4 -0
- zrb/llm/history_manager/any_history_manager.py +23 -0
- zrb/llm/history_manager/file_history_manager.py +91 -0
- zrb/llm/history_processor/summarizer.py +108 -0
- zrb/llm/note/__init__.py +3 -0
- zrb/llm/note/manager.py +122 -0
- zrb/llm/prompt/__init__.py +29 -0
- zrb/llm/prompt/claude_compatibility.py +92 -0
- zrb/llm/prompt/compose.py +55 -0
- zrb/llm/prompt/default.py +51 -0
- zrb/llm/prompt/markdown/file_extractor.md +112 -0
- zrb/llm/prompt/markdown/mandate.md +23 -0
- zrb/llm/prompt/markdown/persona.md +3 -0
- zrb/llm/prompt/markdown/repo_extractor.md +112 -0
- zrb/llm/prompt/markdown/repo_summarizer.md +29 -0
- zrb/llm/prompt/markdown/summarizer.md +21 -0
- zrb/llm/prompt/note.py +41 -0
- zrb/llm/prompt/system_context.py +46 -0
- zrb/llm/prompt/zrb.py +41 -0
- zrb/llm/skill/__init__.py +3 -0
- zrb/llm/skill/manager.py +86 -0
- zrb/llm/task/__init__.py +4 -0
- zrb/llm/task/llm_chat_task.py +316 -0
- zrb/llm/task/llm_task.py +245 -0
- zrb/llm/tool/__init__.py +39 -0
- zrb/llm/tool/bash.py +75 -0
- zrb/llm/tool/code.py +266 -0
- zrb/llm/tool/file.py +419 -0
- zrb/llm/tool/note.py +70 -0
- zrb/{builtin/llm → llm}/tool/rag.py +33 -37
- zrb/llm/tool/search/brave.py +53 -0
- zrb/llm/tool/search/searxng.py +47 -0
- zrb/llm/tool/search/serpapi.py +47 -0
- zrb/llm/tool/skill.py +19 -0
- zrb/llm/tool/sub_agent.py +70 -0
- zrb/llm/tool/web.py +97 -0
- zrb/llm/tool/zrb_task.py +66 -0
- zrb/llm/util/attachment.py +101 -0
- zrb/llm/util/prompt.py +104 -0
- zrb/llm/util/stream_response.py +178 -0
- zrb/runner/cli.py +21 -20
- zrb/runner/common_util.py +24 -19
- zrb/runner/web_route/task_input_api_route.py +5 -5
- zrb/runner/web_util/user.py +7 -3
- zrb/session/any_session.py +12 -9
- zrb/session/session.py +38 -17
- zrb/task/any_task.py +24 -3
- zrb/task/base/context.py +42 -22
- zrb/task/base/execution.py +67 -55
- zrb/task/base/lifecycle.py +14 -7
- zrb/task/base/monitoring.py +12 -7
- zrb/task/base_task.py +113 -50
- zrb/task/base_trigger.py +16 -6
- zrb/task/cmd_task.py +6 -0
- zrb/task/http_check.py +11 -5
- zrb/task/make_task.py +5 -3
- zrb/task/rsync_task.py +30 -10
- zrb/task/scaffolder.py +7 -4
- zrb/task/scheduler.py +7 -4
- zrb/task/tcp_check.py +6 -4
- zrb/util/ascii_art/art/bee.txt +17 -0
- zrb/util/ascii_art/art/cat.txt +9 -0
- zrb/util/ascii_art/art/ghost.txt +16 -0
- zrb/util/ascii_art/art/panda.txt +17 -0
- zrb/util/ascii_art/art/rose.txt +14 -0
- zrb/util/ascii_art/art/unicorn.txt +15 -0
- zrb/util/ascii_art/banner.py +92 -0
- zrb/util/attr.py +54 -39
- zrb/util/cli/markdown.py +32 -0
- zrb/util/cli/text.py +30 -0
- zrb/util/cmd/command.py +33 -10
- zrb/util/file.py +61 -33
- zrb/util/git.py +2 -2
- zrb/util/{llm/prompt.py → markdown.py} +2 -3
- zrb/util/match.py +78 -0
- zrb/util/run.py +3 -3
- zrb/util/string/conversion.py +1 -1
- zrb/util/truncate.py +23 -0
- zrb/util/yaml.py +204 -0
- zrb/xcom/xcom.py +10 -0
- {zrb-1.15.3.dist-info → zrb-2.0.0a4.dist-info}/METADATA +41 -27
- {zrb-1.15.3.dist-info → zrb-2.0.0a4.dist-info}/RECORD +129 -131
- {zrb-1.15.3.dist-info → zrb-2.0.0a4.dist-info}/WHEEL +1 -1
- zrb/attr/__init__.py +0 -0
- zrb/builtin/llm/chat_session.py +0 -311
- zrb/builtin/llm/history.py +0 -71
- zrb/builtin/llm/input.py +0 -27
- zrb/builtin/llm/llm_ask.py +0 -187
- zrb/builtin/llm/previous-session.js +0 -21
- zrb/builtin/llm/tool/__init__.py +0 -0
- zrb/builtin/llm/tool/api.py +0 -71
- zrb/builtin/llm/tool/cli.py +0 -38
- zrb/builtin/llm/tool/code.py +0 -254
- zrb/builtin/llm/tool/file.py +0 -626
- zrb/builtin/llm/tool/sub_agent.py +0 -137
- zrb/builtin/llm/tool/web.py +0 -195
- zrb/builtin/project/__init__.py +0 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/__init__.py +0 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module/service/__init__.py +0 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/__init__.py +0 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/__init__.py +0 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/__init__.py +0 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/permission/__init__.py +0 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/role/__init__.py +0 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/user/__init__.py +0 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/schema/__init__.py +0 -0
- zrb/builtin/project/create/__init__.py +0 -0
- zrb/builtin/shell/__init__.py +0 -0
- zrb/builtin/shell/autocomplete/__init__.py +0 -0
- zrb/callback/__init__.py +0 -0
- zrb/cmd/__init__.py +0 -0
- zrb/config/default_prompt/file_extractor_system_prompt.md +0 -12
- zrb/config/default_prompt/interactive_system_prompt.md +0 -35
- zrb/config/default_prompt/persona.md +0 -1
- zrb/config/default_prompt/repo_extractor_system_prompt.md +0 -112
- zrb/config/default_prompt/repo_summarizer_system_prompt.md +0 -10
- zrb/config/default_prompt/summarization_prompt.md +0 -16
- zrb/config/default_prompt/system_prompt.md +0 -32
- zrb/config/llm_config.py +0 -243
- zrb/config/llm_context/config.py +0 -129
- zrb/config/llm_context/config_parser.py +0 -46
- zrb/config/llm_rate_limitter.py +0 -137
- zrb/content_transformer/__init__.py +0 -0
- zrb/context/__init__.py +0 -0
- zrb/dot_dict/__init__.py +0 -0
- zrb/env/__init__.py +0 -0
- zrb/group/__init__.py +0 -0
- zrb/input/__init__.py +0 -0
- zrb/runner/__init__.py +0 -0
- zrb/runner/web_route/__init__.py +0 -0
- zrb/runner/web_route/home_page/__init__.py +0 -0
- zrb/session/__init__.py +0 -0
- zrb/session_state_log/__init__.py +0 -0
- zrb/session_state_logger/__init__.py +0 -0
- zrb/task/__init__.py +0 -0
- zrb/task/base/__init__.py +0 -0
- zrb/task/llm/__init__.py +0 -0
- zrb/task/llm/agent.py +0 -243
- zrb/task/llm/config.py +0 -103
- zrb/task/llm/conversation_history.py +0 -128
- zrb/task/llm/conversation_history_model.py +0 -242
- zrb/task/llm/default_workflow/coding.md +0 -24
- zrb/task/llm/default_workflow/copywriting.md +0 -17
- zrb/task/llm/default_workflow/researching.md +0 -18
- zrb/task/llm/error.py +0 -95
- zrb/task/llm/history_summarization.py +0 -216
- zrb/task/llm/print_node.py +0 -101
- zrb/task/llm/prompt.py +0 -325
- zrb/task/llm/tool_wrapper.py +0 -220
- zrb/task/llm/typing.py +0 -3
- zrb/task/llm_task.py +0 -341
- zrb/task_status/__init__.py +0 -0
- zrb/util/__init__.py +0 -0
- zrb/util/cli/__init__.py +0 -0
- zrb/util/cmd/__init__.py +0 -0
- zrb/util/codemod/__init__.py +0 -0
- zrb/util/string/__init__.py +0 -0
- zrb/xcom/__init__.py +0 -0
- {zrb-1.15.3.dist-info → zrb-2.0.0a4.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
from zrb.builtin.group import searxng_group
|
|
4
|
+
from zrb.config.config import CFG
|
|
5
|
+
from zrb.input.int_input import IntInput
|
|
6
|
+
from zrb.task.cmd_task import CmdTask
|
|
7
|
+
from zrb.task.http_check import HttpCheck
|
|
8
|
+
|
|
9
|
+
start_searxng = searxng_group.add_task(
|
|
10
|
+
CmdTask(
|
|
11
|
+
name="start-searxng",
|
|
12
|
+
input=IntInput(name="port", default=CFG.SEARXNG_PORT),
|
|
13
|
+
cwd=os.path.dirname(__file__),
|
|
14
|
+
cmd="docker run --rm -p {ctx.input.port}:8080 -v ./config/:/etc/searxng/ docker.io/searxng/searxng:latest -d", # noqa
|
|
15
|
+
readiness_check=HttpCheck(
|
|
16
|
+
"check-searxng",
|
|
17
|
+
url="http://localhost:{ctx.input.port}",
|
|
18
|
+
),
|
|
19
|
+
),
|
|
20
|
+
alias="start",
|
|
21
|
+
)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from zrb.builtin.group import shell_autocomplete_group
|
|
2
|
-
from zrb.
|
|
2
|
+
from zrb.config.config import CFG
|
|
3
|
+
from zrb.context.context import AnyContext
|
|
3
4
|
from zrb.task.make_task import make_task
|
|
4
5
|
|
|
5
6
|
_COMPLETION_SCRIPT = """
|
|
@@ -36,5 +37,5 @@ complete -F _zrb_complete zrb
|
|
|
36
37
|
group=shell_autocomplete_group,
|
|
37
38
|
alias="bash",
|
|
38
39
|
)
|
|
39
|
-
def make_bash_autocomplete(ctx:
|
|
40
|
-
return _COMPLETION_SCRIPT
|
|
40
|
+
def make_bash_autocomplete(ctx: AnyContext):
|
|
41
|
+
return _COMPLETION_SCRIPT.replace("zrb", CFG.ROOT_GROUP_NAME)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from zrb.builtin.group import shell_autocomplete_group
|
|
2
|
-
from zrb.
|
|
2
|
+
from zrb.config.config import CFG
|
|
3
|
+
from zrb.context.context import AnyContext
|
|
3
4
|
from zrb.task.make_task import make_task
|
|
4
5
|
|
|
5
6
|
_COMPLETION_SCRIPT = """
|
|
@@ -33,5 +34,5 @@ compdef _zrb_complete zrb
|
|
|
33
34
|
group=shell_autocomplete_group,
|
|
34
35
|
alias="zsh",
|
|
35
36
|
)
|
|
36
|
-
def make_zsh_autocomplete(ctx:
|
|
37
|
-
return _COMPLETION_SCRIPT
|
|
37
|
+
def make_zsh_autocomplete(ctx: AnyContext):
|
|
38
|
+
return _COMPLETION_SCRIPT.replace("zrb", CFG.ROOT_GROUP_NAME)
|
zrb/callback/callback.py
CHANGED
|
@@ -6,7 +6,6 @@ from zrb.callback.any_callback import AnyCallback
|
|
|
6
6
|
from zrb.session.any_session import AnySession
|
|
7
7
|
from zrb.task.any_task import AnyTask
|
|
8
8
|
from zrb.util.attr import get_str_dict_attr
|
|
9
|
-
from zrb.util.cli.style import stylize_faint
|
|
10
9
|
from zrb.util.string.conversion import to_snake_case
|
|
11
10
|
from zrb.xcom.xcom import Xcom
|
|
12
11
|
|
|
@@ -24,6 +23,7 @@ class Callback(AnyCallback):
|
|
|
24
23
|
task: AnyTask,
|
|
25
24
|
input_mapping: StrDictAttr,
|
|
26
25
|
render_input_mapping: bool = True,
|
|
26
|
+
xcom_mapping: dict[str, str] | None = None,
|
|
27
27
|
result_queue: str | None = None,
|
|
28
28
|
error_queue: str | None = None,
|
|
29
29
|
session_name_queue: str | None = None,
|
|
@@ -36,6 +36,7 @@ class Callback(AnyCallback):
|
|
|
36
36
|
input_mapping: A dictionary or attribute mapping to prepare inputs for the task.
|
|
37
37
|
render_input_mapping: Whether to render the input mapping using
|
|
38
38
|
f-string like syntax.
|
|
39
|
+
xcom_mapping: Map of parent session's xcom names to current session's xcom names
|
|
39
40
|
result_queue: The name of the XCom queue in the parent session
|
|
40
41
|
to publish the task result.
|
|
41
42
|
result_queue: The name of the Xcom queue in the parent session
|
|
@@ -46,6 +47,7 @@ class Callback(AnyCallback):
|
|
|
46
47
|
self._task = task
|
|
47
48
|
self._input_mapping = input_mapping
|
|
48
49
|
self._render_input_mapping = render_input_mapping
|
|
50
|
+
self._xcom_mapping = xcom_mapping
|
|
49
51
|
self._result_queue = result_queue
|
|
50
52
|
self._error_queue = error_queue
|
|
51
53
|
self._session_name_queue = session_name_queue
|
|
@@ -63,6 +65,11 @@ class Callback(AnyCallback):
|
|
|
63
65
|
for name, value in inputs.items():
|
|
64
66
|
session.shared_ctx.input[name] = value
|
|
65
67
|
session.shared_ctx.input[to_snake_case(name)] = value
|
|
68
|
+
# map xcom
|
|
69
|
+
if self._xcom_mapping is not None:
|
|
70
|
+
for parent_xcom_name, current_xcom_name in self._xcom_mapping.items():
|
|
71
|
+
parent_xcom = parent_session.shared_ctx.xcom[parent_xcom_name]
|
|
72
|
+
session.shared_ctx.xcom[current_xcom_name] = parent_xcom
|
|
66
73
|
# run task and get result
|
|
67
74
|
try:
|
|
68
75
|
result = await self._task.async_run(session)
|
zrb/cmd/cmd_result.py
CHANGED