zrb 1.5.14__py3-none-any.whl → 1.5.16__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/builtin/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- from zrb.builtin.base64 import decode_base64, encode_base64
1
+ from zrb.builtin.base64 import decode_base64, encode_base64, validate_base64
2
2
  from zrb.builtin.git import (
3
3
  get_git_diff,
4
4
  git_commit,
@@ -7,8 +7,10 @@ from zrb.builtin.git import (
7
7
  prune_local_branches,
8
8
  )
9
9
  from zrb.builtin.git_subtree import git_add_subtree, git_pull_subtree, git_push_subtree
10
+ from zrb.builtin.http import generate_curl, http_request
11
+ from zrb.builtin.jwt import decode_jwt, encode_jwt, validate_jwt
10
12
  from zrb.builtin.llm.llm_chat import llm_chat
11
- from zrb.builtin.md5 import hash_md5, sum_md5
13
+ from zrb.builtin.md5 import hash_md5, sum_md5, validate_md5
12
14
  from zrb.builtin.project.add.fastapp.fastapp_task import add_fastapp_to_project
13
15
  from zrb.builtin.project.create.project_task import create_project
14
16
  from zrb.builtin.python import format_python_code
@@ -30,6 +32,17 @@ from zrb.builtin.todo import (
30
32
  log_todo,
31
33
  show_todo,
32
34
  )
35
+ from zrb.builtin.uuid import (
36
+ generate_uuid_v1,
37
+ generate_uuid_v3,
38
+ generate_uuid_v4,
39
+ generate_uuid_v5,
40
+ validate_uuid,
41
+ validate_uuid_v1,
42
+ validate_uuid_v3,
43
+ validate_uuid_v4,
44
+ validate_uuid_v5,
45
+ )
33
46
 
34
47
  assert create_project
35
48
  assert add_fastapp_to_project
@@ -38,9 +51,14 @@ assert make_bash_autocomplete
38
51
  assert make_zsh_autocomplete
39
52
  assert encode_base64
40
53
  assert decode_base64
54
+ assert validate_base64
55
+ assert encode_jwt
56
+ assert decode_jwt
57
+ assert validate_jwt
41
58
  assert llm_chat
42
59
  assert hash_md5
43
60
  assert sum_md5
61
+ assert validate_md5
44
62
  assert get_git_diff
45
63
  assert prune_local_branches
46
64
  assert format_python_code
@@ -64,3 +82,14 @@ assert setup_latex_on_ubuntu
64
82
  assert setup_asdf
65
83
  assert setup_tmux
66
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/base64.py CHANGED
@@ -32,3 +32,27 @@ def decode_base64(ctx: AnyContext) -> str:
32
32
  result = base64.b64decode(ctx.input.text.encode()).decode()
33
33
  ctx.print(result)
34
34
  return result
35
+
36
+
37
+ @make_task(
38
+ name="validate-base64",
39
+ input=StrInput(
40
+ name="text",
41
+ description="Text to validate",
42
+ prompt="Enter text to validate as base64",
43
+ ),
44
+ description="✅ Validate base64 text",
45
+ group=base64_group,
46
+ alias="validate",
47
+ )
48
+ def validate_base64(ctx: AnyContext) -> bool:
49
+ import base64
50
+ import binascii
51
+
52
+ try:
53
+ base64.b64decode(ctx.input.text.encode()).decode()
54
+ ctx.print("Valid base64")
55
+ return True
56
+ except (binascii.Error, UnicodeDecodeError):
57
+ ctx.print("Invalid base64")
58
+ return False
zrb/builtin/group.py CHANGED
@@ -2,6 +2,15 @@ from zrb.group.group import Group
2
2
  from zrb.runner.cli import cli
3
3
 
4
4
  base64_group = cli.add_group(Group(name="base64", description="📄 Base64 operations"))
5
+ uuid_group = cli.add_group(Group(name="uuid", description="🆔 UUID operations"))
6
+ uuid_v1_group = uuid_group.add_group(Group(name="v1", description="UUID V1 operations"))
7
+ uuid_v3_group = uuid_group.add_group(Group(name="v3", description="UUID V3 operations"))
8
+ uuid_v4_group = uuid_group.add_group(Group(name="v4", description="UUID V4 operations"))
9
+ uuid_v5_group = uuid_group.add_group(Group(name="v5", description="UUID V5 operations"))
10
+ ulid_group = cli.add_group(Group(name="ulid", description="🔢 ULID operations"))
11
+ jwt_group = cli.add_group(Group(name="jwt", description="🔒 JWT encode/decode"))
12
+ http_group = cli.add_group(Group(name="http", description="🌐 HTTP request operations"))
13
+
5
14
  random_group = cli.add_group(Group(name="random", description="🔀 Random operation"))
6
15
  git_group = cli.add_group(Group(name="git", description="🌱 Git related commands"))
7
16
  git_branch_group = git_group.add_group(
zrb/builtin/http.py ADDED
@@ -0,0 +1,152 @@
1
+ from typing import Any
2
+
3
+ from zrb.builtin.group import http_group
4
+ from zrb.context.any_context import AnyContext
5
+ from zrb.input.option_input import OptionInput
6
+ from zrb.input.str_input import StrInput
7
+ from zrb.task.make_task import make_task
8
+
9
+
10
+ @make_task(
11
+ name="http-request",
12
+ description="🌐 Send HTTP request (Postman-like)",
13
+ group=http_group,
14
+ alias="request",
15
+ input=[
16
+ OptionInput(
17
+ name="method",
18
+ default="GET",
19
+ options=["GET", "POST", "PUT", "DELETE", "PATCH"],
20
+ prompt="HTTP method",
21
+ ),
22
+ StrInput(name="url", description="Target URL", prompt="Enter request URL"),
23
+ StrInput(
24
+ name="headers",
25
+ description="Request headers (JSON)",
26
+ prompt="Enter headers as JSON",
27
+ default="{}",
28
+ ),
29
+ StrInput(
30
+ name="body",
31
+ description="Request body (JSON)",
32
+ prompt="Enter body as JSON",
33
+ default="{}",
34
+ ),
35
+ OptionInput(
36
+ name="verify_ssl",
37
+ default="true",
38
+ options=["true", "false"],
39
+ description="Verify SSL certificate",
40
+ ),
41
+ ],
42
+ )
43
+ def http_request(ctx: AnyContext) -> Any:
44
+ import json
45
+
46
+ import requests
47
+
48
+ try:
49
+ # Prepare headers
50
+ headers = json.loads(ctx.input.headers)
51
+
52
+ # Prepare body
53
+ body = None
54
+ if ctx.input.body != "{}":
55
+ body = json.loads(ctx.input.body)
56
+
57
+ # Make request
58
+ verify = ctx.input.verify_ssl.lower() == "true"
59
+ response = requests.request(
60
+ method=ctx.input.method,
61
+ url=ctx.input.url,
62
+ headers=headers,
63
+ json=body,
64
+ verify=verify,
65
+ )
66
+
67
+ # Print request/response details
68
+ ctx.print("🌐 Request:")
69
+ ctx.print(f" Method: {ctx.input.method}")
70
+ ctx.print(f" URL: {ctx.input.url}")
71
+ ctx.print(f" Headers: {headers}")
72
+ ctx.print(f" Body: {body}")
73
+ ctx.print(f" Verify SSL: {verify}")
74
+ ctx.print("📥 Response:")
75
+ ctx.print(f" Status: {response.status_code}")
76
+ ctx.print(f" Headers: {dict(response.headers)}")
77
+ ctx.print(f" Body: {response.text}")
78
+
79
+ return response
80
+ except Exception as e:
81
+ ctx.print_err(f"HTTP request failed: {e}")
82
+ raise
83
+
84
+
85
+ @make_task(
86
+ name="generate-curl",
87
+ description="🔄 Generate curl command",
88
+ group=http_group,
89
+ alias="curl",
90
+ input=[
91
+ OptionInput(
92
+ name="method",
93
+ default="GET",
94
+ options=["GET", "POST", "PUT", "DELETE", "PATCH"],
95
+ prompt="HTTP method",
96
+ ),
97
+ StrInput(name="url", description="Target URL", prompt="Enter request URL"),
98
+ StrInput(
99
+ name="headers",
100
+ description="Request headers (JSON)",
101
+ prompt="Enter headers as JSON",
102
+ default="{}",
103
+ ),
104
+ StrInput(
105
+ name="body",
106
+ description="Request body (JSON)",
107
+ prompt="Enter body as JSON",
108
+ default="{}",
109
+ ),
110
+ OptionInput(
111
+ name="verify_ssl",
112
+ default="true",
113
+ options=["true", "false"],
114
+ description="Verify SSL certificate",
115
+ ),
116
+ ],
117
+ )
118
+ def generate_curl(ctx: AnyContext) -> str:
119
+ import json
120
+ import shlex
121
+
122
+ try:
123
+ # Prepare curl command parts
124
+ parts = ["curl"]
125
+
126
+ # Add method
127
+ parts.extend(["-X", ctx.input.method])
128
+
129
+ # Add headers
130
+ if ctx.input.headers != "{}":
131
+ headers = json.loads(ctx.input.headers)
132
+ for key, value in headers.items():
133
+ parts.extend(["-H", f"{key}: {value}"])
134
+
135
+ # Add body
136
+ if ctx.input.body != "{}":
137
+ parts.extend(["--data-raw", shlex.quote(ctx.input.body)])
138
+
139
+ # Add SSL verification
140
+ if ctx.input.verify_ssl.lower() == "false":
141
+ parts.append("--insecure")
142
+
143
+ # Add URL
144
+ parts.append(shlex.quote(ctx.input.url))
145
+
146
+ # Join parts into command string
147
+ curl_command = " ".join(parts)
148
+ ctx.print(f"🔄 Curl command: {curl_command}")
149
+ return curl_command
150
+ except Exception as e:
151
+ ctx.print_err(f"Failed to generate curl command: {e}")
152
+ raise
zrb/builtin/jwt.py ADDED
@@ -0,0 +1,104 @@
1
+ from typing import Any, Dict
2
+
3
+ from zrb.builtin.group import jwt_group
4
+ from zrb.context.any_context import AnyContext
5
+ from zrb.input.option_input import OptionInput
6
+ from zrb.input.str_input import StrInput
7
+ from zrb.task.make_task import make_task
8
+
9
+
10
+ @make_task(
11
+ name="encode-jwt",
12
+ description="🔒 Encode JWT token",
13
+ group=jwt_group,
14
+ alias="encode",
15
+ input=[
16
+ StrInput(name="secret", prompt="Secret", default=""),
17
+ StrInput(name="payload", prompt="Payload (JSON format)", default="{}"),
18
+ OptionInput(
19
+ name="algorithm",
20
+ prompt="Algorithm",
21
+ default="HS256",
22
+ options=["HS256", "HS384", "HS512"],
23
+ ),
24
+ ],
25
+ )
26
+ def encode_jwt(ctx: AnyContext) -> str:
27
+ import jwt
28
+
29
+ try:
30
+ payload = eval(ctx.input.payload)
31
+ token = jwt.encode(
32
+ payload=payload, key=ctx.input.secret, algorithm=ctx.input.algorithm
33
+ )
34
+ ctx.print(token)
35
+ return token
36
+ except Exception as e:
37
+ ctx.print_err(f"Failed to encode JWT: {e}")
38
+ raise
39
+
40
+
41
+ @make_task(
42
+ name="decode-jwt",
43
+ description="🔓 Decode JWT token",
44
+ group=jwt_group,
45
+ alias="decode",
46
+ input=[
47
+ StrInput(name="token", prompt="Token", default=""),
48
+ StrInput(name="secret", prompt="Secret", default=""),
49
+ OptionInput(
50
+ name="algorithm",
51
+ prompt="Algorithm",
52
+ default="HS256",
53
+ options=["HS256", "HS384", "HS512"],
54
+ ),
55
+ ],
56
+ )
57
+ def decode_jwt(ctx: AnyContext) -> Dict[str, Any]:
58
+ import jwt
59
+
60
+ try:
61
+ payload = jwt.decode(
62
+ jwt=ctx.input.token, key=ctx.input.secret, algorithms=[ctx.input.algorithm]
63
+ )
64
+ ctx.print(payload)
65
+ return payload
66
+ except Exception as e:
67
+ ctx.print_err(f"Failed to decode JWT: {e}")
68
+ raise
69
+
70
+
71
+ @make_task(
72
+ name="validate-jwt",
73
+ description="✅ Validate JWT token",
74
+ group=jwt_group,
75
+ alias="validate",
76
+ input=[
77
+ StrInput(name="token", prompt="Token", default=""),
78
+ StrInput(name="secret", prompt="Secret", default=""),
79
+ OptionInput(
80
+ name="algorithm",
81
+ prompt="Algorithm",
82
+ default="HS256",
83
+ options=["HS256", "HS384", "HS512"],
84
+ ),
85
+ ],
86
+ )
87
+ def validate_jwt(ctx: AnyContext) -> bool:
88
+ import jwt
89
+
90
+ try:
91
+ jwt.decode(
92
+ jwt=ctx.input.token, key=ctx.input.secret, algorithms=[ctx.input.algorithm]
93
+ )
94
+ ctx.print("✅ Token is valid")
95
+ return True
96
+ except jwt.ExpiredSignatureError:
97
+ ctx.print_err("❌ Token has expired")
98
+ return False
99
+ except jwt.InvalidTokenError:
100
+ ctx.print_err("❌ Invalid token")
101
+ return False
102
+ except Exception as e:
103
+ ctx.print_err(f"❌ Validation failed: {e}")
104
+ return False
zrb/builtin/md5.py CHANGED
@@ -34,3 +34,26 @@ def sum_md5(ctx: AnyContext) -> str:
34
34
  result = hashlib.md5(content).hexdigest()
35
35
  ctx.print(result)
36
36
  return result
37
+
38
+
39
+ @make_task(
40
+ name="validate-md5",
41
+ input=StrInput(
42
+ name="hash",
43
+ description="Hash to validate",
44
+ prompt="Enter hash to validate as MD5",
45
+ ),
46
+ description="✅ Validate MD5 hash",
47
+ group=md5_group,
48
+ alias="validate",
49
+ )
50
+ def validate_md5(ctx: AnyContext) -> bool:
51
+ import re
52
+
53
+ pattern = r"^[a-f0-9]{32}$"
54
+ is_valid = bool(re.fullmatch(pattern, ctx.input.hash))
55
+ if is_valid:
56
+ ctx.print("Valid MD5 hash")
57
+ else:
58
+ ctx.print("Invalid MD5 hash")
59
+ return is_valid
zrb/builtin/todo.py CHANGED
@@ -215,7 +215,7 @@ def archive_todo(ctx: AnyContext):
215
215
  # Save the new todo list and add the archived ones
216
216
  save_todo_list(archive_file_path, archived_todo_list)
217
217
  save_todo_list(todo_file_path, working_todo_list)
218
- return get_visual_todo_list(todo_list, filter=ctx.input.filter)
218
+ return get_visual_todo_list(working_todo_list, filter=ctx.input.filter)
219
219
 
220
220
 
221
221
  @make_task(
zrb/builtin/uuid.py ADDED
@@ -0,0 +1,224 @@
1
+ from zrb.builtin.group import (
2
+ uuid_group,
3
+ uuid_v1_group,
4
+ uuid_v3_group,
5
+ uuid_v4_group,
6
+ uuid_v5_group,
7
+ )
8
+ from zrb.context.any_context import AnyContext
9
+ from zrb.input.option_input import OptionInput
10
+ from zrb.input.str_input import StrInput
11
+ from zrb.task.make_task import make_task
12
+
13
+
14
+ @make_task(
15
+ name="generate-uuid-v1",
16
+ description="🔨 Generate UUID V1",
17
+ input=[
18
+ StrInput(
19
+ name="node",
20
+ description="48-bit hardware address as integer (leave empty for random)",
21
+ prompt="Enter node address (48-bit integer)",
22
+ allow_empty=True,
23
+ ),
24
+ StrInput(
25
+ name="clock-seq",
26
+ description="14-bit sequence number as integer (leave empty for random)",
27
+ prompt="Enter clock sequence (14-bit integer)",
28
+ allow_empty=True,
29
+ ),
30
+ ],
31
+ group=uuid_v1_group,
32
+ alias="generate",
33
+ )
34
+ def generate_uuid_v1(ctx: AnyContext) -> str:
35
+ import uuid
36
+
37
+ result = str(
38
+ uuid.uuid1(
39
+ node=int(ctx.input.node) if ctx.input.node != "" else None,
40
+ clock_seq=int(ctx.input.clock_seq) if ctx.input.clock_seq != "" else None,
41
+ )
42
+ )
43
+ ctx.print(result)
44
+ return result
45
+
46
+
47
+ @make_task(
48
+ name="generate-uuid-v3",
49
+ description="🔨 Generate UUID v3 (MD5 namespace-based)",
50
+ input=[
51
+ OptionInput(
52
+ name="namespace",
53
+ description="Namespace for v3",
54
+ prompt="Select a namespace",
55
+ options=["dns", "url", "oid", "x500"],
56
+ ),
57
+ StrInput(
58
+ name="name",
59
+ description="Name string",
60
+ prompt="Enter the name to namespace-hash",
61
+ ),
62
+ ],
63
+ group=uuid_v3_group,
64
+ alias="generate",
65
+ )
66
+ def generate_uuid_v3(ctx: AnyContext) -> str:
67
+ import uuid
68
+
69
+ ns_map = {
70
+ "dns": uuid.NAMESPACE_DNS,
71
+ "url": uuid.NAMESPACE_URL,
72
+ "oid": uuid.NAMESPACE_OID,
73
+ "x500": uuid.NAMESPACE_X500,
74
+ }
75
+ namespace = ns_map[ctx.input.namespace]
76
+ result = str(uuid.uuid3(namespace, ctx.input.name))
77
+ ctx.print(result)
78
+ return result
79
+
80
+
81
+ @make_task(
82
+ name="generate-uuid-v4",
83
+ description="🔨 Generate UUID v4 (random)",
84
+ group=uuid_v4_group,
85
+ alias="generate",
86
+ )
87
+ def generate_uuid_v4(ctx: AnyContext) -> str:
88
+ import uuid
89
+
90
+ result = str(uuid.uuid4())
91
+ ctx.print(result)
92
+ return result
93
+
94
+
95
+ uuid_group.add_task(generate_uuid_v4, alias="generate")
96
+
97
+
98
+ @make_task(
99
+ name="generate-uuid-v5",
100
+ description="🔨 Generate UUID v5 (SHA1 namespace-based)",
101
+ input=[
102
+ OptionInput(
103
+ name="namespace",
104
+ description="Namespace for v5",
105
+ prompt="Select a namespace",
106
+ options=["dns", "url", "oid", "x500"],
107
+ ),
108
+ StrInput(
109
+ name="name",
110
+ description="Name string",
111
+ prompt="Enter the name to namespace-hash",
112
+ ),
113
+ ],
114
+ group=uuid_v5_group,
115
+ alias="generate",
116
+ )
117
+ def generate_uuid_v5(ctx: AnyContext) -> str:
118
+ import uuid
119
+
120
+ ns_map = {
121
+ "dns": uuid.NAMESPACE_DNS,
122
+ "url": uuid.NAMESPACE_URL,
123
+ "oid": uuid.NAMESPACE_OID,
124
+ "x500": uuid.NAMESPACE_X500,
125
+ }
126
+ namespace = ns_map[ctx.input.namespace]
127
+ result = str(uuid.uuid5(namespace, ctx.input.name))
128
+ ctx.print(result)
129
+ return result
130
+
131
+
132
+ @make_task(
133
+ name="validate-uuid",
134
+ description="✅ Validate UUID",
135
+ input=StrInput(name="id"),
136
+ group=uuid_group,
137
+ alias="validate",
138
+ )
139
+ def validate_uuid(ctx: AnyContext) -> bool:
140
+ import uuid
141
+
142
+ try:
143
+ uuid.UUID(ctx.input.id, version=1)
144
+ ctx.print("Valid UUID")
145
+ return True
146
+ except Exception:
147
+ ctx.print("Invalid UUID")
148
+ return False
149
+
150
+
151
+ @make_task(
152
+ name="validate-uuid-v1",
153
+ description="✅ Validate UUID V1",
154
+ input=StrInput(name="id"),
155
+ group=uuid_v1_group,
156
+ alias="validate",
157
+ )
158
+ def validate_uuid_v1(ctx: AnyContext) -> bool:
159
+ import uuid
160
+
161
+ try:
162
+ uuid.UUID(ctx.input.id, version=1)
163
+ ctx.print("Valid UUID V1")
164
+ return True
165
+ except Exception:
166
+ ctx.print("Invalid UUID V1")
167
+ return False
168
+
169
+
170
+ @make_task(
171
+ name="validate-uuid-v3",
172
+ description="✅ Validate UUID V3",
173
+ input=StrInput(name="id"),
174
+ group=uuid_v3_group,
175
+ alias="validate",
176
+ )
177
+ def validate_uuid_v3(ctx: AnyContext) -> bool:
178
+ import uuid
179
+
180
+ try:
181
+ uuid.UUID(ctx.input.id, version=3)
182
+ ctx.print("Valid UUID V3")
183
+ return True
184
+ except Exception:
185
+ ctx.print("Invalid UUID V3")
186
+ return False
187
+
188
+
189
+ @make_task(
190
+ name="validate-uuid-v4",
191
+ description="✅ Validate UUID V4",
192
+ input=StrInput(name="id"),
193
+ group=uuid_v4_group,
194
+ alias="validate",
195
+ )
196
+ def validate_uuid_v4(ctx: AnyContext) -> bool:
197
+ import uuid
198
+
199
+ try:
200
+ uuid.UUID(ctx.input.id, version=4)
201
+ ctx.print("Valid UUID V4")
202
+ return True
203
+ except Exception:
204
+ ctx.print("Invalid UUID V4")
205
+ return False
206
+
207
+
208
+ @make_task(
209
+ name="validate-uuid-v5",
210
+ description="✅ Validate UUID V5",
211
+ input=StrInput(name="id"),
212
+ group=uuid_v5_group,
213
+ alias="validate",
214
+ )
215
+ def validate_uuid_v5(ctx: AnyContext) -> bool:
216
+ import uuid
217
+
218
+ try:
219
+ uuid.UUID(ctx.input.id, version=5)
220
+ ctx.print("Valid UUID V5")
221
+ return True
222
+ except Exception:
223
+ ctx.print("Invalid UUID V5")
224
+ return False
@@ -1,10 +1,10 @@
1
1
  from abc import ABC, abstractmethod
2
2
  from typing import Any
3
3
 
4
- from zrb.context.any_shared_context import AnySharedContext
4
+ from zrb.session.any_session import AnySession
5
5
 
6
6
 
7
7
  class AnyCallback(ABC):
8
8
  @abstractmethod
9
- async def async_run(self, parent_ctx: AnySharedContext) -> Any:
9
+ async def async_run(self, session: AnySession) -> Any:
10
10
  pass
zrb/runner/cli.py CHANGED
@@ -4,6 +4,7 @@ from typing import Any
4
4
  from zrb.config import BANNER, VERSION, WEB_HTTP_PORT
5
5
  from zrb.context.any_context import AnyContext
6
6
  from zrb.context.shared_context import SharedContext
7
+ from zrb.group.any_group import AnyGroup
7
8
  from zrb.group.group import Group
8
9
  from zrb.runner.common_util import get_run_kwargs
9
10
  from zrb.runner.web_app import create_web_app
@@ -25,7 +26,7 @@ class Cli(Group):
25
26
  def run(self, args: list[str] = []):
26
27
  kwargs, args = self._extract_kwargs_from_args(args)
27
28
  node, node_path, args = extract_node_from_args(self, args)
28
- if isinstance(node, Group):
29
+ if isinstance(node, AnyGroup):
29
30
  self._show_group_info(node)
30
31
  return
31
32
  if "h" in kwargs or "help" in kwargs:
@@ -88,7 +89,7 @@ class Cli(Group):
88
89
  print(f" --{task_input_name}: {task_input.description}")
89
90
  print()
90
91
 
91
- def _show_group_info(self, group: Group):
92
+ def _show_group_info(self, group: AnyGroup):
92
93
  if group.banner != "":
93
94
  print(group.banner)
94
95
  print()
zrb/runner/common_util.py CHANGED
@@ -6,7 +6,7 @@ from zrb.task.any_task import AnyTask
6
6
 
7
7
  def get_run_kwargs(
8
8
  task: AnyTask, args: list[str], kwargs: dict[str, str], cli_mode: bool
9
- ) -> tuple[Any]:
9
+ ) -> dict[str, str]:
10
10
  arg_index = 0
11
11
  str_kwargs = {key: f"{val}" for key, val in kwargs.items()}
12
12
  run_kwargs = {**str_kwargs}
@@ -13,11 +13,9 @@ from zrb.task.llm.typing import ListOfDict
13
13
  from zrb.util.attr import get_bool_attr, get_int_attr
14
14
 
15
15
  if TYPE_CHECKING:
16
- from pydantic_ai import Agent
17
16
  from pydantic_ai.models import Model
18
17
  from pydantic_ai.settings import ModelSettings
19
18
  else:
20
- Agent = Any
21
19
  Model = Any
22
20
  ModelSettings = Any
23
21
 
@@ -41,6 +39,8 @@ async def enrich_context(
41
39
  history_list: ListOfDict,
42
40
  ) -> dict[str, Any]:
43
41
  """Runs an LLM call to extract key info and merge it into the context."""
42
+ from pydantic_ai import Agent
43
+
44
44
  ctx.log_info("Attempting to enrich conversation context...")
45
45
  # Prepare context and history for the enrichment prompt
46
46
  try:
@@ -166,7 +166,6 @@ async def maybe_enrich_context(
166
166
  context_enrichment_threshold_attr,
167
167
  render_context_enrichment_threshold,
168
168
  ):
169
- # Use the enrich_context function now defined in this file
170
169
  return await enrich_context(
171
170
  ctx=ctx,
172
171
  config=EnrichmentConfig(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: zrb
3
- Version: 1.5.14
3
+ Version: 1.5.16
4
4
  Summary: Your Automation Powerhouse
5
5
  Home-page: https://github.com/state-alchemists/zrb
6
6
  License: AGPL-3.0-or-later
@@ -27,6 +27,7 @@ Requires-Dist: pdfplumber (>=0.11.6,<0.12.0) ; extra == "rag" or extra == "all"
27
27
  Requires-Dist: playwright (>=1.51.0,<2.0.0) ; extra == "playwright" or extra == "all"
28
28
  Requires-Dist: psutil (>=7.0.0,<8.0.0)
29
29
  Requires-Dist: pydantic-ai (>=0.1.6,<0.2.0)
30
+ Requires-Dist: pyjwt (>=2.10.1,<3.0.0)
30
31
  Requires-Dist: python-dotenv (>=1.1.0,<2.0.0)
31
32
  Requires-Dist: python-jose[cryptography] (>=3.4.0,<4.0.0)
32
33
  Requires-Dist: requests (>=2.32.3,<3.0.0)
@@ -2,11 +2,13 @@ zrb/__init__.py,sha256=P_oc0u0y0ZVtwvG9wj8kbfcLW9ZUUlzdEtko6AneBN8,3108
2
2
  zrb/__main__.py,sha256=mV-XpuArhRQzUqTvRPQTnV0tfZlZuhioMjhHTGaqJK8,2796
3
3
  zrb/attr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  zrb/attr/type.py,sha256=4TV5gPYMMrKh5V-yB6iRYKCbsXAH_AvGXMsjxKLHcUs,568
5
- zrb/builtin/__init__.py,sha256=oXG4Zm_rIp3G81Y7hiSe38jeS2sGZAnADoP_yxxhYEc,1926
6
- zrb/builtin/base64.py,sha256=1YnSwASp7OEAvQcsnHZGpJEvYoI1Z2zTIJ1bCDHfcPQ,921
5
+ zrb/builtin/__init__.py,sha256=Fbd-4rkqOcufzitziu99jdDc0r3sIgSG27fQMMhHXN8,2660
6
+ zrb/builtin/base64.py,sha256=UjaFttE2oRx0T7_RpKtKfgMtWfiQXfJBAJmA16ek8Ic,1507
7
7
  zrb/builtin/git.py,sha256=8_qVE_2lVQEVXQ9vhiw8Tn4Prj1VZB78ZjEJJS5Ab3M,5461
8
8
  zrb/builtin/git_subtree.py,sha256=7BKwOkVTWDrR0DXXQ4iJyHqeR6sV5VYRt8y_rEB0EHg,3505
9
- zrb/builtin/group.py,sha256=-phJfVpTX3_gUwS1u8-RbZUHe-X41kxDBSmrVh4rq8E,1682
9
+ zrb/builtin/group.py,sha256=t008xLM4_fgbjfZrPoi_fQAnSHIo6MOiQSCHBO4GDYU,2379
10
+ zrb/builtin/http.py,sha256=sLqEczuSxGYXWzyJR6frGOHkPTviu4BeyroUr3-ZuAI,4322
11
+ zrb/builtin/jwt.py,sha256=kjCf8qt7tkW9BpBDRAVTMJaEPQGzCbO1wo9xt5JoM8A,2836
10
12
  zrb/builtin/llm/history.py,sha256=J_x1JMG-aUKlRUkrw2YTg-x7dJrbVABwCOl3A9IqAUc,3071
11
13
  zrb/builtin/llm/input.py,sha256=Nw-26uTWp2QhUgKJcP_IMHmtk-b542CCSQ_vCOjhvhM,877
12
14
  zrb/builtin/llm/llm_chat.py,sha256=NcsFNrM9ygmFTB7lW0xaaikSmCOQZcaW3G8iQzQS5eo,4224
@@ -18,7 +20,7 @@ zrb/builtin/llm/tool/file.py,sha256=ig4tZGYnGjE96U9KgOpbANmyAgFmTcQzym1wVAsZYRM,
18
20
  zrb/builtin/llm/tool/rag.py,sha256=45t0o88l7F62oq2P61NnC1hsZJ4h72dZsVQfcsOIUc8,7521
19
21
  zrb/builtin/llm/tool/sub_agent.py,sha256=7KaxWfFcT-3_fyqQyd4qA2ipzmVFG71iPzRl7wISM5M,4885
20
22
  zrb/builtin/llm/tool/web.py,sha256=pXRLhcB_Y6z-2w4C4WezH8n-pg3PSMgt_bwn3aaqi6g,5479
21
- zrb/builtin/md5.py,sha256=0pNlrfZA0wlZlHvFHLgyqN0JZJWGKQIF5oXxO44_OJk,949
23
+ zrb/builtin/md5.py,sha256=690RV2LbW7wQeTFxY-lmmqTSVEEZv3XZbjEUW1Q3XpE,1480
22
24
  zrb/builtin/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
25
  zrb/builtin/project/add/fastapp/fastapp_input.py,sha256=MKlWR_LxWhM_DcULCtLfL_IjTxpDnDBkn9KIqNmajFs,310
24
26
  zrb/builtin/project/add/fastapp/fastapp_task.py,sha256=z6hZ3j-dxUG7F3IH40rQAOvyhmemfF-3KU-XcYEuTlI,2697
@@ -205,9 +207,10 @@ zrb/builtin/shell/autocomplete/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
205
207
  zrb/builtin/shell/autocomplete/bash.py,sha256=-7YDVV7txgJH9mAYSYN0jmvUEeDIzWFvVNY-cY0myF8,1181
206
208
  zrb/builtin/shell/autocomplete/subcmd.py,sha256=WZI6cGWJcn80zSyxOHG7sCMO3Ucix3mZf4xm_xyB_Y0,606
207
209
  zrb/builtin/shell/autocomplete/zsh.py,sha256=9hlq0Wt3fhRz326mAQTypEd4_4lZdrbBx_3A-Ti3mvw,1022
208
- zrb/builtin/todo.py,sha256=qxQb0EjWk5Eg4lZIOIGDQVw3wz_Bb9wzG2J38b9iCig,11463
210
+ zrb/builtin/todo.py,sha256=S-H0Zqbh6KkliRmL4z_Edo9GsuKXgEf6XADE2W5A3m8,11471
211
+ zrb/builtin/uuid.py,sha256=lIdhSGzPQ1rixRzMXxQDcgFgV7W-gUduHIudZXlzZzg,5393
209
212
  zrb/callback/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
210
- zrb/callback/any_callback.py,sha256=Yhdv5UWHAZSVzj5K2JdxcVQx8x8VX8aZJEivj3NTfZc,247
213
+ zrb/callback/any_callback.py,sha256=apWvuQhak6Rxlpk0rmsvhLoE5OY-37JBHRsDIKULkqw,225
211
214
  zrb/callback/callback.py,sha256=hKefB_Jd1XGjPSLQdMKDsGLHPzEGO2dqrIArLl_EmD0,848
212
215
  zrb/cmd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
213
216
  zrb/cmd/cmd_result.py,sha256=L8bQJzWCpcYexIxHBNsXj2pT3BtLmWex0iJSMkvimOA,597
@@ -243,8 +246,8 @@ zrb/input/str_input.py,sha256=NevZHX9rf1g8eMatPyy-kUX3DglrVAQpzvVpKAzf7bA,81
243
246
  zrb/input/text_input.py,sha256=shvVbc2U8Is36h23M5lcW8IEwKc9FR-4uEPZZroj3rU,3377
244
247
  zrb/llm_config.py,sha256=alAdk23Hnd4JnEQsLcquBjz4PWn-QGaVG5NCrzF5XrI,9702
245
248
  zrb/runner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
246
- zrb/runner/cli.py,sha256=0mT0oO_yEhc8N4nYCJNujhgLjVykZ0B-kAOFXyAvAqM,6672
247
- zrb/runner/common_util.py,sha256=0zhZn1Jdmr194_nsL5_L-Kn9-_NDpMTI2z6_LXUQJ-U,1369
249
+ zrb/runner/cli.py,sha256=8G-o12jrj-zCFtuEpnqA_9sU-3vPfa29cNFx1lHNV-M,6719
250
+ zrb/runner/common_util.py,sha256=JDMcwvQ8cxnv9kQrAoKVLA40Q1omfv-u5_d5MvvwHeE,1373
248
251
  zrb/runner/web_app.py,sha256=Ji2AWeFpJu5guXmur7mAAbjMToyjgmPDdfYu8047FFI,2616
249
252
  zrb/runner/web_config/config.py,sha256=0wR58KreAmawGGfamm0GLZY344HaXs7qfDgHLavBDwo,3125
250
253
  zrb/runner/web_config/config_factory.py,sha256=GNByKviNhQF5qG2ypmC_mV2xglzWHLVQC0x2SQJjrbA,894
@@ -314,7 +317,7 @@ zrb/task/llm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
314
317
  zrb/task/llm/agent.py,sha256=pZAbn0vQOXFkJqnHBo8rfFq3OZD3yePr39jzcRqn43A,5248
315
318
  zrb/task/llm/config.py,sha256=R6mkbm4d5ecN4KjjZaXbqNq9-8bXfdUGl_BML8hUWqY,3205
316
319
  zrb/task/llm/context.py,sha256=s313jXooOp8ht7j2sc3-d8xyW7oWs9bFv4KEyjicwys,3893
317
- zrb/task/llm/context_enrichment.py,sha256=um-uI16HLUQz5GxPwHZefp9dw9x1VcFimv2Fqa9lsB8,6045
320
+ zrb/task/llm/context_enrichment.py,sha256=lLPCtSSdB0jyReB3rk5taNvFPpXMmjDZ_Ro_Fz5GX68,5963
318
321
  zrb/task/llm/error.py,sha256=27DQXSG8SH1-XuvXFdZQKzP39wZDWmd_YnSTz6DJKKI,3690
319
322
  zrb/task/llm/history.py,sha256=LnrJdXLyo2qz-bNCwLorhoqGmgSiPTUU0bzY63w67-E,9257
320
323
  zrb/task/llm/history_summarization.py,sha256=0cWChp4OE_OiaNDhHRWi4rwHKTHsqWLYy3pS5IAIHpQ,6293
@@ -363,7 +366,7 @@ zrb/util/string/name.py,sha256=SXEfxJ1-tDOzHqmSV8kvepRVyMqs2XdV_vyoh_9XUu0,1584
363
366
  zrb/util/todo.py,sha256=VGISej2KQZERpornK-8X7bysp4JydMrMUTnG8B0-liI,20708
364
367
  zrb/xcom/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
365
368
  zrb/xcom/xcom.py,sha256=o79rxR9wphnShrcIushA0Qt71d_p3ZTxjNf7x9hJB78,1571
366
- zrb-1.5.14.dist-info/METADATA,sha256=pYeLSb24lcrPCcnBfinqz3kM0aEuGFxWv03Ad6Ci1V8,8347
367
- zrb-1.5.14.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
368
- zrb-1.5.14.dist-info/entry_points.txt,sha256=-Pg3ElWPfnaSM-XvXqCxEAa-wfVI6BEgcs386s8C8v8,46
369
- zrb-1.5.14.dist-info/RECORD,,
369
+ zrb-1.5.16.dist-info/METADATA,sha256=BY-OgdZco37EJKwLBYKzpnPqOEbgY3_SUsR51kKQGvo,8386
370
+ zrb-1.5.16.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
371
+ zrb-1.5.16.dist-info/entry_points.txt,sha256=-Pg3ElWPfnaSM-XvXqCxEAa-wfVI6BEgcs386s8C8v8,46
372
+ zrb-1.5.16.dist-info/RECORD,,
File without changes