zrb 1.8.10__py3-none-any.whl → 1.21.29__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.

Files changed (147) hide show
  1. zrb/__init__.py +126 -113
  2. zrb/__main__.py +1 -1
  3. zrb/attr/type.py +10 -7
  4. zrb/builtin/__init__.py +2 -50
  5. zrb/builtin/git.py +12 -1
  6. zrb/builtin/group.py +31 -15
  7. zrb/builtin/http.py +7 -8
  8. zrb/builtin/llm/attachment.py +40 -0
  9. zrb/builtin/llm/chat_completion.py +274 -0
  10. zrb/builtin/llm/chat_session.py +152 -85
  11. zrb/builtin/llm/chat_session_cmd.py +288 -0
  12. zrb/builtin/llm/chat_trigger.py +79 -0
  13. zrb/builtin/llm/history.py +7 -9
  14. zrb/builtin/llm/llm_ask.py +221 -98
  15. zrb/builtin/llm/tool/api.py +74 -52
  16. zrb/builtin/llm/tool/cli.py +46 -17
  17. zrb/builtin/llm/tool/code.py +71 -90
  18. zrb/builtin/llm/tool/file.py +301 -241
  19. zrb/builtin/llm/tool/note.py +84 -0
  20. zrb/builtin/llm/tool/rag.py +38 -8
  21. zrb/builtin/llm/tool/sub_agent.py +67 -50
  22. zrb/builtin/llm/tool/web.py +146 -122
  23. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/add_entity_util.py +7 -7
  24. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/add_module_util.py +5 -5
  25. zrb/builtin/project/add/fastapp/fastapp_util.py +1 -1
  26. zrb/builtin/searxng/config/settings.yml +5671 -0
  27. zrb/builtin/searxng/start.py +21 -0
  28. zrb/builtin/setup/latex/ubuntu.py +1 -0
  29. zrb/builtin/setup/ubuntu.py +1 -1
  30. zrb/builtin/shell/autocomplete/bash.py +4 -3
  31. zrb/builtin/shell/autocomplete/zsh.py +4 -3
  32. zrb/builtin/todo.py +13 -2
  33. zrb/config/config.py +614 -0
  34. zrb/config/default_prompt/file_extractor_system_prompt.md +112 -0
  35. zrb/config/default_prompt/interactive_system_prompt.md +29 -0
  36. zrb/config/default_prompt/persona.md +1 -0
  37. zrb/config/default_prompt/repo_extractor_system_prompt.md +112 -0
  38. zrb/config/default_prompt/repo_summarizer_system_prompt.md +29 -0
  39. zrb/config/default_prompt/summarization_prompt.md +57 -0
  40. zrb/config/default_prompt/system_prompt.md +38 -0
  41. zrb/config/llm_config.py +339 -0
  42. zrb/config/llm_context/config.py +166 -0
  43. zrb/config/llm_context/config_parser.py +40 -0
  44. zrb/config/llm_context/workflow.py +81 -0
  45. zrb/config/llm_rate_limitter.py +190 -0
  46. zrb/{runner → config}/web_auth_config.py +17 -22
  47. zrb/context/any_shared_context.py +17 -1
  48. zrb/context/context.py +16 -2
  49. zrb/context/shared_context.py +18 -8
  50. zrb/group/any_group.py +12 -5
  51. zrb/group/group.py +67 -3
  52. zrb/input/any_input.py +5 -1
  53. zrb/input/base_input.py +18 -6
  54. zrb/input/option_input.py +13 -1
  55. zrb/input/text_input.py +8 -25
  56. zrb/runner/cli.py +25 -23
  57. zrb/runner/common_util.py +24 -19
  58. zrb/runner/web_app.py +3 -3
  59. zrb/runner/web_route/docs_route.py +1 -1
  60. zrb/runner/web_route/error_page/serve_default_404.py +1 -1
  61. zrb/runner/web_route/error_page/show_error_page.py +1 -1
  62. zrb/runner/web_route/home_page/home_page_route.py +2 -2
  63. zrb/runner/web_route/login_api_route.py +1 -1
  64. zrb/runner/web_route/login_page/login_page_route.py +2 -2
  65. zrb/runner/web_route/logout_api_route.py +1 -1
  66. zrb/runner/web_route/logout_page/logout_page_route.py +2 -2
  67. zrb/runner/web_route/node_page/group/show_group_page.py +1 -1
  68. zrb/runner/web_route/node_page/node_page_route.py +1 -1
  69. zrb/runner/web_route/node_page/task/show_task_page.py +1 -1
  70. zrb/runner/web_route/refresh_token_api_route.py +1 -1
  71. zrb/runner/web_route/static/static_route.py +1 -1
  72. zrb/runner/web_route/task_input_api_route.py +6 -6
  73. zrb/runner/web_route/task_session_api_route.py +20 -12
  74. zrb/runner/web_util/cookie.py +1 -1
  75. zrb/runner/web_util/token.py +1 -1
  76. zrb/runner/web_util/user.py +8 -4
  77. zrb/session/any_session.py +24 -17
  78. zrb/session/session.py +50 -25
  79. zrb/session_state_logger/any_session_state_logger.py +9 -4
  80. zrb/session_state_logger/file_session_state_logger.py +16 -6
  81. zrb/session_state_logger/session_state_logger_factory.py +1 -1
  82. zrb/task/any_task.py +30 -9
  83. zrb/task/base/context.py +17 -9
  84. zrb/task/base/execution.py +15 -8
  85. zrb/task/base/lifecycle.py +8 -4
  86. zrb/task/base/monitoring.py +12 -7
  87. zrb/task/base_task.py +69 -5
  88. zrb/task/base_trigger.py +12 -5
  89. zrb/task/cmd_task.py +1 -1
  90. zrb/task/llm/agent.py +154 -161
  91. zrb/task/llm/agent_runner.py +152 -0
  92. zrb/task/llm/config.py +47 -18
  93. zrb/task/llm/conversation_history.py +209 -0
  94. zrb/task/llm/conversation_history_model.py +67 -0
  95. zrb/task/llm/default_workflow/coding/workflow.md +41 -0
  96. zrb/task/llm/default_workflow/copywriting/workflow.md +68 -0
  97. zrb/task/llm/default_workflow/git/workflow.md +118 -0
  98. zrb/task/llm/default_workflow/golang/workflow.md +128 -0
  99. zrb/task/llm/default_workflow/html-css/workflow.md +135 -0
  100. zrb/task/llm/default_workflow/java/workflow.md +146 -0
  101. zrb/task/llm/default_workflow/javascript/workflow.md +158 -0
  102. zrb/task/llm/default_workflow/python/workflow.md +160 -0
  103. zrb/task/llm/default_workflow/researching/workflow.md +153 -0
  104. zrb/task/llm/default_workflow/rust/workflow.md +162 -0
  105. zrb/task/llm/default_workflow/shell/workflow.md +299 -0
  106. zrb/task/llm/error.py +24 -10
  107. zrb/task/llm/file_replacement.py +206 -0
  108. zrb/task/llm/file_tool_model.py +57 -0
  109. zrb/task/llm/history_processor.py +206 -0
  110. zrb/task/llm/history_summarization.py +11 -166
  111. zrb/task/llm/print_node.py +193 -69
  112. zrb/task/llm/prompt.py +242 -45
  113. zrb/task/llm/subagent_conversation_history.py +41 -0
  114. zrb/task/llm/tool_wrapper.py +260 -57
  115. zrb/task/llm/workflow.py +76 -0
  116. zrb/task/llm_task.py +182 -171
  117. zrb/task/make_task.py +2 -3
  118. zrb/task/rsync_task.py +26 -11
  119. zrb/task/scheduler.py +4 -4
  120. zrb/util/attr.py +54 -39
  121. zrb/util/callable.py +23 -0
  122. zrb/util/cli/markdown.py +12 -0
  123. zrb/util/cli/text.py +30 -0
  124. zrb/util/file.py +29 -11
  125. zrb/util/git.py +8 -11
  126. zrb/util/git_diff_model.py +10 -0
  127. zrb/util/git_subtree.py +9 -14
  128. zrb/util/git_subtree_model.py +32 -0
  129. zrb/util/init_path.py +1 -1
  130. zrb/util/markdown.py +62 -0
  131. zrb/util/string/conversion.py +2 -2
  132. zrb/util/todo.py +17 -50
  133. zrb/util/todo_model.py +46 -0
  134. zrb/util/truncate.py +23 -0
  135. zrb/util/yaml.py +204 -0
  136. zrb/xcom/xcom.py +10 -0
  137. zrb-1.21.29.dist-info/METADATA +270 -0
  138. {zrb-1.8.10.dist-info → zrb-1.21.29.dist-info}/RECORD +140 -98
  139. {zrb-1.8.10.dist-info → zrb-1.21.29.dist-info}/WHEEL +1 -1
  140. zrb/config.py +0 -335
  141. zrb/llm_config.py +0 -411
  142. zrb/llm_rate_limitter.py +0 -125
  143. zrb/task/llm/context.py +0 -102
  144. zrb/task/llm/context_enrichment.py +0 -199
  145. zrb/task/llm/history.py +0 -211
  146. zrb-1.8.10.dist-info/METADATA +0 -264
  147. {zrb-1.8.10.dist-info → zrb-1.21.29.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,270 @@
1
+ Metadata-Version: 2.4
2
+ Name: zrb
3
+ Version: 1.21.29
4
+ Summary: Your Automation Powerhouse
5
+ License: AGPL-3.0-or-later
6
+ Keywords: Automation,Task Runner,Code Generator,Monorepo,Low Code
7
+ Author: Go Frendi Gunawan
8
+ Author-email: gofrendiasgard@gmail.com
9
+ Requires-Python: >=3.11.0,<4.0.0
10
+ Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Provides-Extra: all
17
+ Provides-Extra: anthropic
18
+ Provides-Extra: bedrock
19
+ Provides-Extra: cohere
20
+ Provides-Extra: google
21
+ Provides-Extra: groq
22
+ Provides-Extra: huggingface
23
+ Provides-Extra: mistral
24
+ Provides-Extra: playwright
25
+ Provides-Extra: rag
26
+ Provides-Extra: vertexai
27
+ Requires-Dist: anthropic (>=0.70.0) ; extra == "anthropic" or extra == "all"
28
+ Requires-Dist: beautifulsoup4 (>=4.14.2,<5.0.0)
29
+ Requires-Dist: black (>=25.11.0,<26.0.0)
30
+ Requires-Dist: boto3 (>=1.40.14) ; extra == "bedrock"
31
+ Requires-Dist: chromadb (>=1.3.5,<2.0.0) ; extra == "rag" or extra == "all"
32
+ Requires-Dist: cohere (>=5.18.0) ; extra == "cohere" or extra == "all"
33
+ Requires-Dist: fastapi[standard] (>=0.123.9,<0.124.0)
34
+ Requires-Dist: google-auth (>=2.36.0) ; extra == "vertexai" or extra == "all"
35
+ Requires-Dist: google-genai (>=1.51.0) ; extra == "google" or extra == "all"
36
+ Requires-Dist: groq (>=0.25.0) ; extra == "groq" or extra == "all"
37
+ Requires-Dist: huggingface-hub[inference] (>=0.33.5,<1.0.0) ; extra == "huggingface"
38
+ Requires-Dist: isort (>=7.0.0,<8.0.0)
39
+ Requires-Dist: libcst (>=1.8.6,<2.0.0)
40
+ Requires-Dist: markdownify (>=1.2.2,<2.0.0)
41
+ Requires-Dist: mcp (>1.18.0)
42
+ Requires-Dist: mistralai (>=1.9.10) ; extra == "mistral"
43
+ Requires-Dist: openai (>=2.11.0)
44
+ Requires-Dist: pdfplumber (>=0.11.7,<0.12.0)
45
+ Requires-Dist: playwright (>=1.56.0,<2.0.0) ; extra == "playwright" or extra == "all"
46
+ Requires-Dist: prompt-toolkit (>=3)
47
+ Requires-Dist: psutil (>=7.0.0,<8.0.0)
48
+ Requires-Dist: pydantic-ai-slim (>=1.32.0,<1.33.0)
49
+ Requires-Dist: pyjwt (>=2.10.1,<3.0.0)
50
+ Requires-Dist: python-dotenv (>=1.1.1,<2.0.0)
51
+ Requires-Dist: python-jose[cryptography] (>=3.5.0,<4.0.0)
52
+ Requires-Dist: pyyaml (>=6.0.3,<7.0.0)
53
+ Requires-Dist: requests (>=2.32.5,<3.0.0)
54
+ Requires-Dist: rich (>=13)
55
+ Requires-Dist: tiktoken (>=0.12.0,<0.13.0)
56
+ Requires-Dist: ulid-py (>=1.1.0,<2.0.0)
57
+ Project-URL: Documentation, https://github.com/state-alchemists/zrb
58
+ Project-URL: Homepage, https://github.com/state-alchemists/zrb
59
+ Project-URL: Repository, https://github.com/state-alchemists/zrb
60
+ Description-Content-Type: text/markdown
61
+
62
+ ![](https://raw.githubusercontent.com/state-alchemists/zrb/main/_images/zrb/android-chrome-192x192.png)
63
+
64
+ # 🤖 Zrb: Your Automation Powerhouse
65
+
66
+ **Zrb (Zaruba) is a Python-based tool that makes it easy to create, organize, and run automation tasks.** Think of it as a command-line sidekick, ready to handle everything from simple scripts to complex, AI-powered workflows.
67
+
68
+ Whether you're running tasks from the terminal or a sleek web UI, Zrb streamlines your process with task dependencies, environment management, and even inter-task communication.
69
+
70
+ [Documentation](https://github.com/state-alchemists/zrb/blob/main/docs/README.md) | [Contribution Guidelines](https://github.com/state-alchemists/zrb/pulls) | [Report an Issue](https://github.com/state-alchemists/zrb/issues)
71
+
72
+ ---
73
+
74
+ ## 🔥 Why Choose Zrb?
75
+
76
+ Zrb is designed to be powerful yet intuitive, offering a unique blend of features:
77
+
78
+ - 🤖 **Built-in LLM Integration:** Go beyond simple automation. Leverage Large Language Models to generate code, create diagrams, produce documentation, and more.
79
+ - 🐍 **Pure Python:** Write your tasks in Python. No complex DSLs or YAML configurations to learn.
80
+ - 🔗 **Smart Task Chaining:** Define dependencies between tasks to build sophisticated, ordered workflows.
81
+ - 💻 **Dual-Mode Execution:** Run tasks from the command line for speed or use the built-in web UI for a more visual experience.
82
+ - ⚙️ **Flexible Configuration:** Manage inputs with defaults, prompts, or command-line arguments. Handle secrets and settings with environment variables from the system or `.env` files.
83
+ - 🗣️ **Cross-Communication (XCom):** Allow tasks to safely exchange small pieces of data.
84
+ - 🌍 **Open & Extensible:** Zrb is open-source. Feel free to contribute, customize, or extend it to meet your needs.
85
+
86
+ ---
87
+
88
+ ## 🚀 Quick Start: Your First AI-Powered Workflow in 5 Minutes
89
+
90
+ Let's create a two-step workflow that uses an LLM to analyze your code and generate a Mermaid diagram, then converts that diagram into a PNG image.
91
+
92
+ ### 1. Prerequisites: Get Your Tools Ready
93
+
94
+ Before you start, make sure you have the following:
95
+
96
+ - **An LLM API Key:** Zrb needs an API key to talk to an AI model.
97
+ ```bash
98
+ export OPENAI_API_KEY="your-key-here"
99
+ ```
100
+ > Zrb defaults to OpenAI, but you can easily configure it for other providers like **Deepseek, Ollama, etc.** See the [LLM Integration Guide](https://github.com/state-alchemists/zrb/blob/main/docs/installation-and-configuration/configuration/llm-integration.md) for details.
101
+
102
+ - **Mermaid CLI:** This tool converts Mermaid diagram scripts into images.
103
+ ```bash
104
+ npm install -g @mermaid-js/mermaid-cli
105
+ ```
106
+
107
+ ### 2. Install Zrb
108
+
109
+ The easiest way to get Zrb is with `pip`.
110
+
111
+ ```bash
112
+ pip install zrb
113
+ # Or for the latest pre-release version:
114
+ # pip install --pre zrb
115
+ ```
116
+
117
+ Alternatively, you can use an installation script that handles all prerequisites:
118
+ ```bash
119
+ bash -c "$(curl -fsSL https://raw.githubusercontent.com/state-alchemists/zrb/main/install.sh)"
120
+ ```
121
+
122
+ > For other installation methods, including **Docker 🐋** and **Android 📱**, check out the full [Installation Guide](https://github.com/state-alchemists/zrb/blob/main/docs/installation-and-configuration/README.md).
123
+
124
+ ### 3. Define Your Tasks
125
+
126
+ Create a file named `zrb_init.py` in your project directory. Zrb automatically discovers this file.
127
+
128
+ > **💡 Pro Tip:** You can place `zrb_init.py` in your home directory (`~/zrb_init.py`), and the tasks you define will be available globally across all your projects!
129
+
130
+ Add the following Python code to your `zrb_init.py`:
131
+
132
+ ```python
133
+ from zrb import cli, LLMTask, CmdTask, StrInput, Group
134
+ from zrb.builtin.llm.tool.code import analyze_repo
135
+ from zrb.builtin.llm.tool.file import write_to_file
136
+
137
+
138
+ # Create a group for Mermaid-related tasks
139
+ mermaid_group = cli.add_group(Group(
140
+ name="mermaid",
141
+ description="🧜 Mermaid diagram related tasks"
142
+ ))
143
+
144
+ # Task 1: Generate a Mermaid script from your source code
145
+ make_mermaid_script = mermaid_group.add_task(
146
+ LLMTask(
147
+ name="make-script",
148
+ description="Create a mermaid diagram from source code in the current directory",
149
+ input=[
150
+ StrInput(name="dir", default="./"),
151
+ StrInput(name="diagram", default="state-diagram"),
152
+ ],
153
+ message=(
154
+ "Read all necessary files in {ctx.input.dir}, "
155
+ "make a {ctx.input.diagram} in mermaid format. "
156
+ "Write the script into `{ctx.input.dir}/{ctx.input.diagram}.mmd`"
157
+ ),
158
+ tools=[
159
+ analyze_repo, write_to_file
160
+ ],
161
+ )
162
+ )
163
+
164
+ # Task 2: Convert the Mermaid script into a PNG image
165
+ make_mermaid_image = mermaid_group.add_task(
166
+ CmdTask(
167
+ name="make-image",
168
+ description="Create a PNG from a mermaid script",
169
+ input=[
170
+ StrInput(name="dir", default="./"),
171
+ StrInput(name="diagram", default="state-diagram"),
172
+ ],
173
+ cmd="mmdc -i '{ctx.input.diagram}.mmd' -o '{ctx.input.diagram}.png'",
174
+ cwd="{ctx.input.dir}",
175
+ )
176
+ )
177
+
178
+ # Set up the dependency: the image task runs after the script is created
179
+ make_mermaid_script >> make_mermaid_image
180
+ ```
181
+
182
+ ### 4. Run Your Workflow!
183
+
184
+ Now, navigate to any project with source code. For example:
185
+
186
+ ```bash
187
+ git clone git@github.com:jjinux/gotetris.git
188
+ cd gotetris
189
+ ```
190
+
191
+ Run your new task to generate the diagram:
192
+
193
+ ```bash
194
+ zrb mermaid make-image --diagram "state-diagram" --dir ./
195
+ ```
196
+
197
+ You can also run it interactively and let Zrb prompt you for inputs:
198
+ ```bash
199
+ zrb mermaid make-image
200
+ ```
201
+ Zrb will ask for the directory and diagram name—just press **Enter** to accept the defaults.
202
+
203
+ In moments, you'll have a beautiful state diagram of your code!
204
+
205
+ ![State Diagram](https://raw.githubusercontent.com/state-alchemists/zrb/main/_images/state-diagram.png)
206
+
207
+ ---
208
+
209
+ ## 🖥️ Try the Web UI
210
+
211
+ Prefer a graphical interface? Zrb has you covered. Start the web server:
212
+
213
+ ```bash
214
+ zrb server start
215
+ ```
216
+
217
+ Then open your browser to `http://localhost:21213` to see your tasks in a clean, user-friendly interface.
218
+
219
+ ![Zrb Web UI](https://raw.githubusercontent.com/state-alchemists/zrb/main/_images/zrb-web-ui.png)
220
+
221
+ ---
222
+
223
+ ## 💬 Interact with an LLM Directly
224
+
225
+ Zrb brings AI capabilities right to your command line.
226
+
227
+ ### Interactive Chat
228
+
229
+ Start a chat session with an LLM to ask questions, brainstorm ideas, or get coding help.
230
+
231
+ ```bash
232
+ zrb llm chat
233
+ ```
234
+
235
+ ### Quick Questions
236
+
237
+ For a single question, use the `ask` command for a fast response.
238
+
239
+ ```bash
240
+ zrb llm ask "What is the capital of Indonesia?"
241
+ ```
242
+
243
+ ---
244
+
245
+ ## 🎥 Demo & Documentation
246
+
247
+ - **Dive Deeper:** [**Explore the Full Zrb Documentation**](https://github.com/state-alchemists/zrb/blob/main/docs/README.md)
248
+ - **Watch the Video Demo:**
249
+
250
+ [![Video Title](https://img.youtube.com/vi/W7dgk96l__o/0.jpg)](https://www.youtube.com/watch?v=W7dgk96l__o)
251
+
252
+ ---
253
+
254
+ ## 🤝 Join the Community & Support the Project
255
+
256
+ - **Bugs & Feature Requests:** Found a bug or have a great idea? [Open an issue](https://github.com/state-alchemists/zrb/issues). Please include your Zrb version (`zrb version`) and steps to reproduce the issue.
257
+ - **Contributions:** We love pull requests! See our [contribution guidelines](https://github.com/state-alchemists/zrb/pulls) to get started.
258
+ - **Support Zrb:** If you find Zrb valuable, please consider showing your support.
259
+
260
+ [![](https://raw.githubusercontent.com/state-alchemists/zrb/main/_images/donator.png)](https://stalchmst.com)
261
+
262
+ ---
263
+
264
+ ## 🎉 Fun Fact
265
+
266
+ **Did you know?** Zrb is named after `Zaruba`, a powerful, sentient Madou Ring that acts as a guide and support tool in the *Garo* universe.
267
+
268
+ > *Madou Ring Zaruba (魔導輪ザルバ, Madōrin Zaruba) is a Madougu which supports bearers of the Garo Armor.* [(Garo Wiki | Fandom)](https://garo.fandom.com/wiki/Zaruba)
269
+
270
+ ![Madou Ring Zaruba on Kouga's Hand](https://raw.githubusercontent.com/state-alchemists/zrb/main/_images/madou-ring-zaruba.jpg)