tinybird 0.0.1.dev266__py3-none-any.whl → 0.0.1.dev267__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 tinybird might be problematic. Click here for more details.
- tinybird/tb/__cli__.py +2 -2
- tinybird/tb/modules/agent/agent.py +24 -23
- tinybird/tb/modules/agent/banner.py +8 -25
- tinybird/tb/modules/cli.py +2 -4
- tinybird/tb/modules/deployment_common.py +4 -1
- {tinybird-0.0.1.dev266.dist-info → tinybird-0.0.1.dev267.dist-info}/METADATA +1 -1
- {tinybird-0.0.1.dev266.dist-info → tinybird-0.0.1.dev267.dist-info}/RECORD +10 -10
- {tinybird-0.0.1.dev266.dist-info → tinybird-0.0.1.dev267.dist-info}/WHEEL +0 -0
- {tinybird-0.0.1.dev266.dist-info → tinybird-0.0.1.dev267.dist-info}/entry_points.txt +0 -0
- {tinybird-0.0.1.dev266.dist-info → tinybird-0.0.1.dev267.dist-info}/top_level.txt +0 -0
tinybird/tb/__cli__.py
CHANGED
|
@@ -4,5 +4,5 @@ __description__ = 'Tinybird Command Line Tool'
|
|
|
4
4
|
__url__ = 'https://www.tinybird.co/docs/forward/commands'
|
|
5
5
|
__author__ = 'Tinybird'
|
|
6
6
|
__author_email__ = 'support@tinybird.co'
|
|
7
|
-
__version__ = '0.0.1.
|
|
8
|
-
__revision__ = '
|
|
7
|
+
__version__ = '0.0.1.dev267'
|
|
8
|
+
__revision__ = '8c3d4f6'
|
|
@@ -11,7 +11,6 @@ from typing import Any, Optional
|
|
|
11
11
|
import click
|
|
12
12
|
import humanfriendly
|
|
13
13
|
from pydantic_ai import Agent, RunContext, Tool
|
|
14
|
-
from pydantic_ai.agent import AgentRunResult
|
|
15
14
|
from pydantic_ai.messages import ModelMessage, ModelRequest, UserPromptPart
|
|
16
15
|
from requests import Response
|
|
17
16
|
|
|
@@ -255,7 +254,7 @@ class TinybirdAgent:
|
|
|
255
254
|
save_messages(new_messages)
|
|
256
255
|
self.thinking_animation.stop()
|
|
257
256
|
click.echo(result.output)
|
|
258
|
-
self.
|
|
257
|
+
self.echo_usage(config)
|
|
259
258
|
|
|
260
259
|
async def run_iter(self, user_prompt: str, config: dict[str, Any], model: Any) -> None:
|
|
261
260
|
user_prompt = f"{user_prompt}\n\n{load_custom_project_rules(self.project.folder)}"
|
|
@@ -279,31 +278,28 @@ class TinybirdAgent:
|
|
|
279
278
|
self.messages.extend(new_messages)
|
|
280
279
|
save_messages(new_messages)
|
|
281
280
|
self.thinking_animation.stop()
|
|
282
|
-
self.
|
|
281
|
+
self.echo_usage(config)
|
|
283
282
|
|
|
284
|
-
def
|
|
283
|
+
def echo_usage(self, config: dict[str, Any]) -> None:
|
|
285
284
|
try:
|
|
286
285
|
client = _get_tb_client(config["user_token"], config["host"])
|
|
287
286
|
workspace_id = config.get("id", "")
|
|
288
287
|
workspace = client.workspace(workspace_id, with_organization=True, version="v1")
|
|
289
288
|
limits_data = client.organization_limits(workspace["organization"]["id"])
|
|
290
289
|
ai_requests_limits = limits_data.get("limits", {}).get("ai_requests", {})
|
|
291
|
-
current_ai_requests = ai_requests_limits.get("quantity"
|
|
292
|
-
max_ai_requests = ai_requests_limits.get("max"
|
|
290
|
+
current_ai_requests = ai_requests_limits.get("quantity") or 0
|
|
291
|
+
max_ai_requests = ai_requests_limits.get("max") or 0
|
|
292
|
+
remaining_requests = max(max_ai_requests - current_ai_requests, 0)
|
|
293
|
+
current_ai_requests = min(max_ai_requests, current_ai_requests)
|
|
293
294
|
if not max_ai_requests:
|
|
294
295
|
return
|
|
295
|
-
remaining_requests = max(max_ai_requests - current_ai_requests, 0)
|
|
296
296
|
warning_threshold = max_ai_requests * 0.8
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
message_color = FeedbackManager.gray
|
|
301
|
-
|
|
302
|
-
current_ai_requests = min(max_ai_requests, current_ai_requests)
|
|
303
|
-
|
|
297
|
+
message_color = (
|
|
298
|
+
FeedbackManager.warning if current_ai_requests >= warning_threshold else FeedbackManager.gray
|
|
299
|
+
)
|
|
304
300
|
click.echo(
|
|
305
301
|
message_color(
|
|
306
|
-
message=f"{remaining_requests}
|
|
302
|
+
message=f"{remaining_requests} requests left ({current_ai_requests}/{max_ai_requests}). You can continue using Tinybird Code. Limits will be enforced soon."
|
|
307
303
|
)
|
|
308
304
|
)
|
|
309
305
|
except Exception:
|
|
@@ -339,7 +335,7 @@ def run_agent(
|
|
|
339
335
|
workspace_id = cli_config.get("id", "")
|
|
340
336
|
workspace_name = cli_config.get("name", "")
|
|
341
337
|
|
|
342
|
-
if not token or not host or not user_token:
|
|
338
|
+
if not token or not host or not user_token or not workspace_id:
|
|
343
339
|
click.echo(
|
|
344
340
|
FeedbackManager.error(message="Tinybird Code requires authentication. Run 'tb login' first.")
|
|
345
341
|
)
|
|
@@ -383,8 +379,17 @@ def run_agent(
|
|
|
383
379
|
|
|
384
380
|
# Interactive mode: show banner and enter interactive loop
|
|
385
381
|
display_banner()
|
|
386
|
-
click.echo(
|
|
387
|
-
|
|
382
|
+
click.echo(
|
|
383
|
+
FeedbackManager.info(
|
|
384
|
+
message="""Tips for getting started:
|
|
385
|
+
- Describe what you want to build or ask for specific resources.
|
|
386
|
+
- Run tb commands directly without leaving interactive mode.
|
|
387
|
+
- Create a TINYBIRD.md file to customize your interactions.
|
|
388
|
+
"""
|
|
389
|
+
)
|
|
390
|
+
)
|
|
391
|
+
agent.echo_usage(config)
|
|
392
|
+
click.echo()
|
|
388
393
|
|
|
389
394
|
except Exception as e:
|
|
390
395
|
click.echo(FeedbackManager.error(message=f"Failed to initialize agent: {e}"))
|
|
@@ -431,11 +436,7 @@ def run_agent(
|
|
|
431
436
|
|
|
432
437
|
continue
|
|
433
438
|
elif user_input.lower() == "/help":
|
|
434
|
-
|
|
435
|
-
click.echo("• Ask for specific resources: 'Create a pipe to aggregate daily clicks'")
|
|
436
|
-
click.echo("• Connect to external services: 'Set up a Kafka connection for events'")
|
|
437
|
-
click.echo("• Type '/exit' or '/quit' to leave")
|
|
438
|
-
|
|
439
|
+
subprocess.run(["tb", "--help"], check=True)
|
|
439
440
|
continue
|
|
440
441
|
elif user_input.strip() == "":
|
|
441
442
|
continue
|
|
@@ -41,31 +41,14 @@ def display_banner():
|
|
|
41
41
|
|
|
42
42
|
click.echo("\n")
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
" ██║ ██║██║ ╚████║ ██║ ██████╔╝██║██║ ██║██████╔╝ ╚██████╗╚██████╔╝██████╔╝███████╗",
|
|
53
|
-
" ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚═════╝ ╚═╝╚═╝ ╚═╝╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝",
|
|
54
|
-
]
|
|
55
|
-
else:
|
|
56
|
-
# ASCII fallback banner
|
|
57
|
-
banner = [
|
|
58
|
-
" ████████T██I███N ██N██ ██Y██████B ██I██████B ██████B ██████C ██████O ██████D ███████E",
|
|
59
|
-
" ╚══██╔══╝██║████╗ ██║╚██╗ ██╔╝██╔══██╗██║██╔══██╗██╔══██╗ ██╔════╝██╔═══██╗██╔══██╗██╔════╝",
|
|
60
|
-
" ██║ ██║██╔██╗ ██║ ╚████╔╝ ██████╔╝██║██████╔╝██║ ██║ ██║ ██║ ██║██║ ██║█████╗ ",
|
|
61
|
-
" ██║ ██║██║╚██╗██║ ╚██╔╝ ██╔══██╗██║██╔══██╗██║ ██║ ██║ ██║ ██║██║ ██║██╔══╝ ",
|
|
62
|
-
" ██║ ██║██║ ╚████║ ██║ ██████╔╝██║██║ ██║██████╔╝ ╚██████╗╚██████╔╝██████╔╝███████╗",
|
|
63
|
-
" ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚═════╝ ╚═╝╚═╝ ╚═╝╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝",
|
|
64
|
-
]
|
|
65
|
-
|
|
66
|
-
def interpolate_color(start_rgb, end_rgb, factor):
|
|
67
|
-
"""Interpolate between two RGB colors"""
|
|
68
|
-
return [int(start_rgb[i] + (end_rgb[i] - start_rgb[i]) * factor) for i in range(3)]
|
|
44
|
+
banner = [
|
|
45
|
+
" ████████╗██╗███╗ ██╗██╗ ██╗██████╗ ██╗██████╗ ██████╗ ██████╗ ██████╗ ██████╗ ███████╗",
|
|
46
|
+
" ╚══██╔══╝██║████╗ ██║╚██╗ ██╔╝██╔══██╗██║██╔══██╗██╔══██╗ ██╔════╝██╔═══██╗██╔══██╗██╔════╝",
|
|
47
|
+
" ██║ ██║██╔██╗ ██║ ╚████╔╝ ██████╔╝██║██████╔╝██║ ██║ ██║ ██║ ██║██║ ██║█████╗ ",
|
|
48
|
+
" ██║ ██║██║╚██╗██║ ╚██╔╝ ██╔══██╗██║██╔══██╗██║ ██║ ██║ ██║ ██║██║ ██║██╔══╝ ",
|
|
49
|
+
" ██║ ██║██║ ╚████║ ██║ ██████╔╝██║██║ ██║██████╔╝ ╚██████╗╚██████╔╝██████╔╝███████╗",
|
|
50
|
+
" ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚═════╝ ╚═╝╚═╝ ╚═╝╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝",
|
|
51
|
+
]
|
|
69
52
|
|
|
70
53
|
def rgb_to_ansi(r: int, g: int, b: int, use_truecolor: bool):
|
|
71
54
|
"""Convert RGB values to ANSI escape code"""
|
tinybird/tb/modules/cli.py
CHANGED
|
@@ -47,8 +47,6 @@ DEFAULT_PATTERNS: List[Tuple[str, Union[str, Callable[[str], str]]]] = [
|
|
|
47
47
|
]
|
|
48
48
|
VERSION = f"{__cli__.__version__} (rev {__cli__.__revision__})"
|
|
49
49
|
|
|
50
|
-
agent_mode_flag = os.environ.get("TB_AGENT_MODE", "false") == "true"
|
|
51
|
-
|
|
52
50
|
|
|
53
51
|
@click.group(
|
|
54
52
|
cls=CatchAuthExceptions,
|
|
@@ -56,7 +54,7 @@ agent_mode_flag = os.environ.get("TB_AGENT_MODE", "false") == "true"
|
|
|
56
54
|
"help_option_names": ["-h", "--help"],
|
|
57
55
|
"max_content_width": shutil.get_terminal_size().columns - 10,
|
|
58
56
|
},
|
|
59
|
-
invoke_without_command=
|
|
57
|
+
invoke_without_command=True,
|
|
60
58
|
)
|
|
61
59
|
@click.option(
|
|
62
60
|
"--debug/--no-debug",
|
|
@@ -208,7 +206,7 @@ def cli(
|
|
|
208
206
|
ctx.ensure_object(dict)["env"] = get_target_env(cloud)
|
|
209
207
|
ctx.ensure_object(dict)["output"] = output
|
|
210
208
|
|
|
211
|
-
is_agent_mode =
|
|
209
|
+
is_agent_mode = ctx.invoked_subcommand is None
|
|
212
210
|
is_prompt_mode = prompt is not None
|
|
213
211
|
|
|
214
212
|
if is_agent_mode or is_prompt_mode:
|
|
@@ -254,9 +254,12 @@ def create_deployment(
|
|
|
254
254
|
elif verbose and f.get("level", "").upper() == "INFO":
|
|
255
255
|
feedback_func = FeedbackManager.info
|
|
256
256
|
feedback_icon = ""
|
|
257
|
+
else:
|
|
258
|
+
feedback_func = None
|
|
257
259
|
resource = f.get("resource")
|
|
258
260
|
resource_bit = f"{resource}: " if resource else ""
|
|
259
|
-
|
|
261
|
+
if feedback_func is not None:
|
|
262
|
+
click.echo(feedback_func(message=f"{feedback_icon}{f.get('level')}: {resource_bit}{f.get('message')}"))
|
|
260
263
|
|
|
261
264
|
deploy_errors = deployment.get("errors")
|
|
262
265
|
for deploy_error in deploy_errors:
|
|
@@ -17,7 +17,7 @@ tinybird/datafile/exceptions.py,sha256=8rw2umdZjtby85QbuRKFO5ETz_eRHwUY5l7eHsy1w
|
|
|
17
17
|
tinybird/datafile/parse_connection.py,sha256=tRyn2Rpr1TeWet5BXmMoQgaotbGdYep1qiTak_OqC5E,1825
|
|
18
18
|
tinybird/datafile/parse_datasource.py,sha256=ssW8QeFSgglVFi3sDZj_HgkJiTJ2069v2JgqnH3CkDE,1825
|
|
19
19
|
tinybird/datafile/parse_pipe.py,sha256=xf4m0Tw44QWJzHzAm7Z7FwUoUUtr7noMYjU1NiWnX0k,3880
|
|
20
|
-
tinybird/tb/__cli__.py,sha256=
|
|
20
|
+
tinybird/tb/__cli__.py,sha256=V9cRl0xsyU-hm_0lGu2QorOI9Mdck-XRwVjBngDbFZ8,247
|
|
21
21
|
tinybird/tb/check_pypi.py,sha256=Gp0HkHHDFMSDL6nxKlOY51z7z1Uv-2LRexNTZSHHGmM,552
|
|
22
22
|
tinybird/tb/cli.py,sha256=FdDFEIayjmsZEVsVSSvRiVYn_FHOVg_zWQzchnzfWho,1008
|
|
23
23
|
tinybird/tb/client.py,sha256=OVNlCXI16kpD-Ph8BDhkyKbR68TdZcR_j4ng91Iiybg,54706
|
|
@@ -25,7 +25,7 @@ tinybird/tb/config.py,sha256=mhMTGnMB5KcxGoh3dewIr2Jjsa6pHE183gCPAQWyp6o,3973
|
|
|
25
25
|
tinybird/tb/modules/build.py,sha256=efD-vamK1NPaDo9R86Hn8be2DYoW0Hh5bZiH7knK5dk,7790
|
|
26
26
|
tinybird/tb/modules/build_common.py,sha256=dthlaDn_CuwZnedQcUi7iIdDoHWfSbbbGQwiDgNcmC0,13062
|
|
27
27
|
tinybird/tb/modules/cicd.py,sha256=0KLKccha9IP749QvlXBmzdWv1On3mFwMY4DUcJlBxiE,7326
|
|
28
|
-
tinybird/tb/modules/cli.py,sha256=
|
|
28
|
+
tinybird/tb/modules/cli.py,sha256=2sw4W3sQyhAo474Mnq3hUN2QZUpEb9cU1NYnVB0qHl0,16877
|
|
29
29
|
tinybird/tb/modules/common.py,sha256=tj6DR2yOqMMQ0PILwFGXmMogxdrbQCgj36HdSM611rs,82657
|
|
30
30
|
tinybird/tb/modules/config.py,sha256=gK7rgaWTDd4ZKCrNEg_Uemr26EQjqWt6TjyQKujxOws,11462
|
|
31
31
|
tinybird/tb/modules/connection.py,sha256=-MY56NUAai6EMC4-wpi7bT0_nz_SA8QzTmHkV7HB1IQ,17810
|
|
@@ -33,7 +33,7 @@ tinybird/tb/modules/copy.py,sha256=dPZkcIDvxjJrlQUIvToO0vsEEEs4EYumbNV77-BzNoU,4
|
|
|
33
33
|
tinybird/tb/modules/create.py,sha256=pJxHXG69c9Z_21s-7VuJ3RZOF_nJU51LEwiAkvI3dZY,23251
|
|
34
34
|
tinybird/tb/modules/datasource.py,sha256=pae-ENeHYIF1HHYRSOziFC-2FPLUFa0KS60YpdlKCS8,41725
|
|
35
35
|
tinybird/tb/modules/deployment.py,sha256=EDEVOqFk5fp0fvvs2jV0mT5POFd-i_8uZIUREwzAbEk,13199
|
|
36
|
-
tinybird/tb/modules/deployment_common.py,sha256=
|
|
36
|
+
tinybird/tb/modules/deployment_common.py,sha256=6Ws3YTtEyVl9Id7gyxXkEhe0GJpUJeibS-XGTtTA9DI,19076
|
|
37
37
|
tinybird/tb/modules/deprecations.py,sha256=rrszC1f_JJeJ8mUxGoCxckQTJFBCR8wREf4XXXN-PRc,4507
|
|
38
38
|
tinybird/tb/modules/dev_server.py,sha256=57FCKuWpErwYUYgHspYDkLWEm9F4pbvVOtMrFXX1fVU,10129
|
|
39
39
|
tinybird/tb/modules/endpoint.py,sha256=ksRj6mfDb9Xv63PhTkV_uKSosgysHElqagg3RTt21Do,11958
|
|
@@ -69,9 +69,9 @@ tinybird/tb/modules/watch.py,sha256=No0bK1M1_3CYuMaIgylxf7vYFJ72lTJe3brz6xQ-mJo,
|
|
|
69
69
|
tinybird/tb/modules/workspace.py,sha256=Q_8HcxMsNg8QG9aBlwcWS2umrDP5IkTIHqqz3sfmGuc,11341
|
|
70
70
|
tinybird/tb/modules/workspace_members.py,sha256=5JdkJgfuEwbq-t6vxkBhYwgsiTDxF790wsa6Xfif9nk,8608
|
|
71
71
|
tinybird/tb/modules/agent/__init__.py,sha256=i3oe3vDIWWPaicdCM0zs7D7BJ1W0k7th93ooskHAV00,54
|
|
72
|
-
tinybird/tb/modules/agent/agent.py,sha256=
|
|
72
|
+
tinybird/tb/modules/agent/agent.py,sha256=vr2a5lSAhmJer1702gVmECUjbrjg2_MUYMlEy5o0iE4,28773
|
|
73
73
|
tinybird/tb/modules/agent/animations.py,sha256=4WOC5_2BracttmMCrV0H91tXfWcUzQHBUaIJc5FA7tE,3490
|
|
74
|
-
tinybird/tb/modules/agent/banner.py,sha256=
|
|
74
|
+
tinybird/tb/modules/agent/banner.py,sha256=l6cO5Fi7lbVKp-GsBP8jf3IkjOWxg2jpAt9NBCy0WR8,4085
|
|
75
75
|
tinybird/tb/modules/agent/command_agent.py,sha256=Q4M5qV9j3aETrXswoWZ02ZWQZhJm42HGHO1ymJrfDnw,2665
|
|
76
76
|
tinybird/tb/modules/agent/memory.py,sha256=O6Kumn9AyKxcTkhI45yjAUZ3ZIAibLOcNWoiEuLYeqY,3245
|
|
77
77
|
tinybird/tb/modules/agent/models.py,sha256=IAxqlnHy8c2OeSnDrrSp2Mg38W9_r0GsDM87Wv-YNfM,925
|
|
@@ -116,8 +116,8 @@ tinybird/tb_cli_modules/config.py,sha256=IsgdtFRnUrkY8-Zo32lmk6O7u3bHie1QCxLwgp4
|
|
|
116
116
|
tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
|
|
117
117
|
tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
|
|
118
118
|
tinybird/tb_cli_modules/telemetry.py,sha256=Hh2Io8ZPROSunbOLuMvuIFU4TqwWPmQTqal4WS09K1A,10449
|
|
119
|
-
tinybird-0.0.1.
|
|
120
|
-
tinybird-0.0.1.
|
|
121
|
-
tinybird-0.0.1.
|
|
122
|
-
tinybird-0.0.1.
|
|
123
|
-
tinybird-0.0.1.
|
|
119
|
+
tinybird-0.0.1.dev267.dist-info/METADATA,sha256=EzrJCbpmOzBD7DT9HjC9ggTCcuXx-mSoyrJodo0JTRk,1733
|
|
120
|
+
tinybird-0.0.1.dev267.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
121
|
+
tinybird-0.0.1.dev267.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
|
|
122
|
+
tinybird-0.0.1.dev267.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
|
|
123
|
+
tinybird-0.0.1.dev267.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|