tinybird 0.0.1.dev287__py3-none-any.whl → 0.0.1.dev289__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/datafile/common.py +0 -10
- tinybird/sql_toolset.py +2 -2
- tinybird/tb/__cli__.py +2 -2
- tinybird/tb/modules/agent/agent.py +34 -6
- tinybird/tb/modules/agent/prompts.py +2 -0
- tinybird/tb/modules/agent/tools/append.py +4 -2
- tinybird/tb/modules/agent/tools/datafile.py +6 -4
- tinybird/tb/modules/agent/tools/mock.py +3 -2
- tinybird/tb/modules/agent/tools/plan.py +62 -5
- tinybird/tb/modules/agent/tools/run_command.py +9 -3
- tinybird/tb/modules/agent/tools/secret.py +2 -1
- tinybird/tb/modules/agent/utils.py +11 -2
- tinybird/tb/modules/deployment_common.py +5 -1
- tinybird/tb/modules/local_common.py +2 -1
- {tinybird-0.0.1.dev287.dist-info → tinybird-0.0.1.dev289.dist-info}/METADATA +1 -1
- {tinybird-0.0.1.dev287.dist-info → tinybird-0.0.1.dev289.dist-info}/RECORD +19 -19
- {tinybird-0.0.1.dev287.dist-info → tinybird-0.0.1.dev289.dist-info}/WHEEL +0 -0
- {tinybird-0.0.1.dev287.dist-info → tinybird-0.0.1.dev289.dist-info}/entry_points.txt +0 -0
- {tinybird-0.0.1.dev287.dist-info → tinybird-0.0.1.dev289.dist-info}/top_level.txt +0 -0
tinybird/datafile/common.py
CHANGED
|
@@ -1877,16 +1877,6 @@ def parse(
|
|
|
1877
1877
|
doc.shared_with += workspaces
|
|
1878
1878
|
total_workspaces += len(workspaces)
|
|
1879
1879
|
|
|
1880
|
-
# Add warning once if any workspaces were found
|
|
1881
|
-
if total_workspaces > 0:
|
|
1882
|
-
warnings.append(
|
|
1883
|
-
DatafileParseWarning(
|
|
1884
|
-
message=(
|
|
1885
|
-
f"{kwargs['cmd'].upper()} is not fully implemented in Forward and will be ignored while this warning is present."
|
|
1886
|
-
)
|
|
1887
|
-
)
|
|
1888
|
-
)
|
|
1889
|
-
|
|
1890
1880
|
# Validate that at least one workspace was provided
|
|
1891
1881
|
if total_workspaces == 0:
|
|
1892
1882
|
raise DatafileSyntaxError(
|
tinybird/sql_toolset.py
CHANGED
|
@@ -144,7 +144,7 @@ def format_where_for_mutation_command(where_clause: str) -> str:
|
|
|
144
144
|
return f"DELETE WHERE {quoted_condition[1:-1]}"
|
|
145
145
|
|
|
146
146
|
|
|
147
|
-
@lru_cache(maxsize=2**
|
|
147
|
+
@lru_cache(maxsize=2**15)
|
|
148
148
|
def sql_get_used_tables_cached(
|
|
149
149
|
sql: str,
|
|
150
150
|
raising: bool = False,
|
|
@@ -301,7 +301,7 @@ def replacements_to_tuples(replacements: dict) -> dict:
|
|
|
301
301
|
return parsed_replacements
|
|
302
302
|
|
|
303
303
|
|
|
304
|
-
@lru_cache(maxsize=2**
|
|
304
|
+
@lru_cache(maxsize=2**15)
|
|
305
305
|
def replace_tables_chquery_cached(
|
|
306
306
|
sql: str,
|
|
307
307
|
sorted_replacements: Optional[tuple] = None,
|
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.dev289'
|
|
8
|
+
__revision__ = 'ac20837'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
+
import hashlib
|
|
2
3
|
import shlex
|
|
3
4
|
import subprocess
|
|
4
5
|
import sys
|
|
@@ -47,9 +48,15 @@ from tinybird.tb.modules.agent.tools.deploy_check import deploy_check
|
|
|
47
48
|
from tinybird.tb.modules.agent.tools.diff_resource import diff_resource
|
|
48
49
|
from tinybird.tb.modules.agent.tools.get_endpoint_stats import get_endpoint_stats
|
|
49
50
|
from tinybird.tb.modules.agent.tools.get_openapi_definition import get_openapi_definition
|
|
50
|
-
from tinybird.tb.modules.agent.tools.plan import plan
|
|
51
|
+
from tinybird.tb.modules.agent.tools.plan import complete_plan, plan
|
|
51
52
|
from tinybird.tb.modules.agent.tools.secret import create_or_update_secrets
|
|
52
|
-
from tinybird.tb.modules.agent.utils import
|
|
53
|
+
from tinybird.tb.modules.agent.utils import (
|
|
54
|
+
AgentRunCancelled,
|
|
55
|
+
SubAgentRunCancelled,
|
|
56
|
+
TinybirdAgentContext,
|
|
57
|
+
show_confirmation,
|
|
58
|
+
show_input,
|
|
59
|
+
)
|
|
53
60
|
from tinybird.tb.modules.build_common import process as build_process
|
|
54
61
|
from tinybird.tb.modules.common import (
|
|
55
62
|
_analyze,
|
|
@@ -89,6 +96,7 @@ class TinybirdAgent:
|
|
|
89
96
|
self.dangerously_skip_permissions = dangerously_skip_permissions or prompt_mode
|
|
90
97
|
self.project = project
|
|
91
98
|
self.thinking_animation = ThinkingAnimation()
|
|
99
|
+
self.confirmed_plan_id: Optional[str] = None
|
|
92
100
|
if prompt_mode:
|
|
93
101
|
self.messages: list[ModelMessage] = get_last_messages_from_last_user_prompt()
|
|
94
102
|
else:
|
|
@@ -109,6 +117,7 @@ class TinybirdAgent:
|
|
|
109
117
|
takes_ctx=True,
|
|
110
118
|
),
|
|
111
119
|
Tool(plan, docstring_format="google", require_parameter_descriptions=True, takes_ctx=True),
|
|
120
|
+
Tool(complete_plan, docstring_format="google", require_parameter_descriptions=True, takes_ctx=True),
|
|
112
121
|
Tool(build, docstring_format="google", require_parameter_descriptions=True, takes_ctx=True),
|
|
113
122
|
Tool(deploy, docstring_format="google", require_parameter_descriptions=True, takes_ctx=True),
|
|
114
123
|
Tool(deploy_check, docstring_format="google", require_parameter_descriptions=True, takes_ctx=True),
|
|
@@ -204,8 +213,11 @@ class TinybirdAgent:
|
|
|
204
213
|
Returns:
|
|
205
214
|
str: The result of the command.
|
|
206
215
|
"""
|
|
207
|
-
|
|
208
|
-
|
|
216
|
+
try:
|
|
217
|
+
result = self.command_agent.run(task, deps=ctx.deps, usage=ctx.usage)
|
|
218
|
+
return f"Result: {result.output}\nDo not repeat in your response the result again, because it is already displayed in the terminal."
|
|
219
|
+
except SubAgentRunCancelled as e:
|
|
220
|
+
return f"User does not want to continue with the proposed solution. Reason: {e}"
|
|
209
221
|
|
|
210
222
|
@self.agent.tool
|
|
211
223
|
def explore_data(ctx: RunContext[TinybirdAgentContext], task: str) -> str:
|
|
@@ -297,6 +309,18 @@ class TinybirdAgent:
|
|
|
297
309
|
def add_message(self, message: ModelMessage) -> None:
|
|
298
310
|
self.messages.append(message)
|
|
299
311
|
|
|
312
|
+
def start_plan(self, plan) -> str:
|
|
313
|
+
self.confirmed_plan_id = hashlib.sha256(plan.encode()).hexdigest()[:16]
|
|
314
|
+
return self.confirmed_plan_id
|
|
315
|
+
|
|
316
|
+
def cancel_plan(self) -> Optional[str]:
|
|
317
|
+
plan_id = self.confirmed_plan_id
|
|
318
|
+
self.confirmed_plan_id = None
|
|
319
|
+
return plan_id
|
|
320
|
+
|
|
321
|
+
def get_plan(self) -> Optional[str]:
|
|
322
|
+
return self.confirmed_plan_id
|
|
323
|
+
|
|
300
324
|
def _build_agent_deps(self, config: dict[str, Any], run_id: Optional[str] = None) -> TinybirdAgentContext:
|
|
301
325
|
project = self.project
|
|
302
326
|
folder = self.project.folder
|
|
@@ -336,6 +360,9 @@ class TinybirdAgent:
|
|
|
336
360
|
local_host=local_client.host,
|
|
337
361
|
local_token=local_client.token,
|
|
338
362
|
run_id=run_id,
|
|
363
|
+
get_plan=self.get_plan,
|
|
364
|
+
start_plan=self.start_plan,
|
|
365
|
+
cancel_plan=self.cancel_plan,
|
|
339
366
|
)
|
|
340
367
|
|
|
341
368
|
def run(self, user_prompt: str, config: dict[str, Any]) -> None:
|
|
@@ -389,8 +416,8 @@ class TinybirdAgent:
|
|
|
389
416
|
ai_credits_limits = limits_data.get("limits", {}).get("ai_credits", {})
|
|
390
417
|
current_ai_credits = ai_credits_limits.get("quantity") or 0
|
|
391
418
|
ai_credits = ai_credits_limits.get("max") or 0
|
|
392
|
-
remaining_credits = max(ai_credits - current_ai_credits, 0)
|
|
393
|
-
current_ai_credits = min(ai_credits, current_ai_credits)
|
|
419
|
+
remaining_credits = round(max(ai_credits - current_ai_credits, 0), 2)
|
|
420
|
+
current_ai_credits = round(min(ai_credits, current_ai_credits), 2)
|
|
394
421
|
if not ai_credits:
|
|
395
422
|
return
|
|
396
423
|
warning_threshold = ai_credits * 0.8
|
|
@@ -569,6 +596,7 @@ def run_agent(
|
|
|
569
596
|
]
|
|
570
597
|
)
|
|
571
598
|
)
|
|
599
|
+
agent.cancel_plan()
|
|
572
600
|
continue
|
|
573
601
|
except KeyboardInterrupt:
|
|
574
602
|
click.echo(FeedbackManager.info(message="Goodbye!"))
|
|
@@ -876,6 +876,7 @@ You have access to the following tools:
|
|
|
876
876
|
15. `run_command` - Run a command using the Tinybird CLI.
|
|
877
877
|
16. `diff_resource` - Diff the content of a resource in Tinybird Cloud vs Tinybird Local vs Project local file.
|
|
878
878
|
17. `rename_datafile_or_fixture` - Rename a datafile or fixture.
|
|
879
|
+
18. `complete_plan` - Complete a plan.
|
|
879
880
|
|
|
880
881
|
# When creating, updating, or deleting files:
|
|
881
882
|
1. Use `plan` tool to plan the creation, update, rename, or deletion of resources.
|
|
@@ -885,6 +886,7 @@ You have access to the following tools:
|
|
|
885
886
|
5. If the file was created or removed successfully, report the result to the user.
|
|
886
887
|
6. If the file was not created or removed, finish the process and just wait for a new user prompt.
|
|
887
888
|
7. If the file was created or removed successfully, but the build failed, try to fix the error and repeat the process.
|
|
889
|
+
8. If the plan is completed or cancelled, use the `complete_plan` tool to complete the plan.
|
|
888
890
|
|
|
889
891
|
# When creating a landing datasource given a .ndjson file:
|
|
890
892
|
- If the user does not specify anything about the desired schema, create a schema like this (sorting key not needed in this case)
|
|
@@ -53,9 +53,10 @@ def append_file(
|
|
|
53
53
|
return "Append operation cancelled by user."
|
|
54
54
|
|
|
55
55
|
cloud_or_local = "Cloud" if cloud else "Local"
|
|
56
|
+
active_plan = ctx.deps.get_plan() is not None and not cloud
|
|
56
57
|
confirmation = show_confirmation(
|
|
57
58
|
title=f"Append fixture {fixture_pathname} to datasource '{datasource_name}' in Tinybird {cloud_or_local}?",
|
|
58
|
-
skip_confirmation=ctx.deps.dangerously_skip_permissions,
|
|
59
|
+
skip_confirmation=ctx.deps.dangerously_skip_permissions or active_plan,
|
|
59
60
|
)
|
|
60
61
|
|
|
61
62
|
if confirmation == "review":
|
|
@@ -112,9 +113,10 @@ def append_url(
|
|
|
112
113
|
return "Append operation cancelled by user."
|
|
113
114
|
|
|
114
115
|
cloud_or_local = "Cloud" if cloud else "Local"
|
|
116
|
+
active_plan = ctx.deps.get_plan() is not None and not cloud
|
|
115
117
|
confirmation = show_confirmation(
|
|
116
118
|
title=f"Append URL {fixture_url} to datasource '{datasource_name}' in Tinybird {cloud_or_local}?",
|
|
117
|
-
skip_confirmation=ctx.deps.dangerously_skip_permissions,
|
|
119
|
+
skip_confirmation=ctx.deps.dangerously_skip_permissions or active_plan,
|
|
118
120
|
)
|
|
119
121
|
|
|
120
122
|
if confirmation == "review":
|
|
@@ -50,9 +50,10 @@ def create_datafile(
|
|
|
50
50
|
content = create_terminal_box(resource.content, title=resource.pathname)
|
|
51
51
|
click.echo(content)
|
|
52
52
|
action = "Create" if not exists else "Update"
|
|
53
|
+
active_plan = ctx.deps.get_plan() is not None
|
|
53
54
|
confirmation = show_confirmation(
|
|
54
55
|
title=f"{action} '{resource.pathname}'?",
|
|
55
|
-
skip_confirmation=ctx.deps.dangerously_skip_permissions,
|
|
56
|
+
skip_confirmation=ctx.deps.dangerously_skip_permissions or active_plan,
|
|
56
57
|
)
|
|
57
58
|
|
|
58
59
|
if confirmation == "review":
|
|
@@ -146,9 +147,10 @@ def rename_datafile_or_fixture(ctx: RunContext[TinybirdAgentContext], path: str,
|
|
|
146
147
|
"""
|
|
147
148
|
try:
|
|
148
149
|
ctx.deps.thinking_animation.stop()
|
|
150
|
+
active_plan = ctx.deps.get_plan() is not None
|
|
149
151
|
confirmation = show_confirmation(
|
|
150
152
|
title=f"Rename '{path}' to '{new_path}'?",
|
|
151
|
-
skip_confirmation=ctx.deps.dangerously_skip_permissions,
|
|
153
|
+
skip_confirmation=ctx.deps.dangerously_skip_permissions or active_plan,
|
|
152
154
|
)
|
|
153
155
|
|
|
154
156
|
if confirmation == "review":
|
|
@@ -211,10 +213,10 @@ def remove_file(ctx: RunContext[TinybirdAgentContext], path: str) -> str:
|
|
|
211
213
|
click.echo(FeedbackManager.error(message=f"Error: File {path} not found"))
|
|
212
214
|
ctx.deps.thinking_animation.start()
|
|
213
215
|
return f"Error: File {path} not found (double check the file path)"
|
|
214
|
-
|
|
216
|
+
active_plan = ctx.deps.get_plan() is not None
|
|
215
217
|
confirmation = show_confirmation(
|
|
216
218
|
title=f"Delete '{path}'?",
|
|
217
|
-
skip_confirmation=ctx.deps.dangerously_skip_permissions,
|
|
219
|
+
skip_confirmation=ctx.deps.dangerously_skip_permissions or active_plan,
|
|
218
220
|
)
|
|
219
221
|
|
|
220
222
|
if confirmation == "review":
|
|
@@ -70,9 +70,10 @@ def generate_mock_fixture(
|
|
|
70
70
|
content = create_terminal_box(preview_content, title=f"fixtures/{datasource_name}.{data_format}")
|
|
71
71
|
click.echo(content)
|
|
72
72
|
click.echo("Showing a preview of the file.\n")
|
|
73
|
+
active_plan = ctx.deps.get_plan() is not None
|
|
73
74
|
confirmation = show_confirmation(
|
|
74
75
|
title=f"Create fixture file for datasource '{datasource_name}'?",
|
|
75
|
-
skip_confirmation=ctx.deps.dangerously_skip_permissions,
|
|
76
|
+
skip_confirmation=ctx.deps.dangerously_skip_permissions or active_plan,
|
|
76
77
|
)
|
|
77
78
|
|
|
78
79
|
if confirmation == "review":
|
|
@@ -85,7 +86,7 @@ def generate_mock_fixture(
|
|
|
85
86
|
click.echo(FeedbackManager.success(message=f"✓ {fixture_path_name} created"))
|
|
86
87
|
confirmation = show_confirmation(
|
|
87
88
|
title=f"Append {fixture_path_name} to datasource '{datasource_name}'?",
|
|
88
|
-
skip_confirmation=ctx.deps.dangerously_skip_permissions,
|
|
89
|
+
skip_confirmation=ctx.deps.dangerously_skip_permissions or active_plan,
|
|
89
90
|
)
|
|
90
91
|
if confirmation == "review":
|
|
91
92
|
feedback = show_input(ctx.deps.workspace_name)
|
|
@@ -1,7 +1,45 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
1
3
|
import click
|
|
2
4
|
from pydantic_ai import RunContext
|
|
3
5
|
|
|
4
|
-
from tinybird.tb.modules.agent.utils import
|
|
6
|
+
from tinybird.tb.modules.agent.utils import (
|
|
7
|
+
AgentRunCancelled,
|
|
8
|
+
TinybirdAgentContext,
|
|
9
|
+
show_input,
|
|
10
|
+
show_options,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
PlanConfirmationResult = Literal["yes", "review", "yes_and_auto_implement"]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def show_plan_confirmation(skip_confirmation: bool = False) -> PlanConfirmationResult:
|
|
17
|
+
if skip_confirmation:
|
|
18
|
+
return "yes"
|
|
19
|
+
|
|
20
|
+
title = "Do you want to continue with the plan?"
|
|
21
|
+
while True:
|
|
22
|
+
result = show_options(
|
|
23
|
+
options=[
|
|
24
|
+
"Yes, continue",
|
|
25
|
+
"Yes, continue and implement all",
|
|
26
|
+
"No, tell Tinybird Code what to do",
|
|
27
|
+
"Cancel",
|
|
28
|
+
],
|
|
29
|
+
title=title,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
if result is None: # Cancelled
|
|
33
|
+
raise AgentRunCancelled(f"User cancelled the operation: {title}")
|
|
34
|
+
|
|
35
|
+
if result.startswith("Yes, continue and implement all"):
|
|
36
|
+
return "yes_and_auto_implement"
|
|
37
|
+
if result.startswith("Yes"):
|
|
38
|
+
return "yes"
|
|
39
|
+
elif result.startswith("No"):
|
|
40
|
+
return "review"
|
|
41
|
+
|
|
42
|
+
raise AgentRunCancelled(f"User cancelled the operation: {title}")
|
|
5
43
|
|
|
6
44
|
|
|
7
45
|
def plan(ctx: RunContext[TinybirdAgentContext], plan: str) -> str:
|
|
@@ -15,15 +53,34 @@ def plan(ctx: RunContext[TinybirdAgentContext], plan: str) -> str:
|
|
|
15
53
|
"""
|
|
16
54
|
ctx.deps.thinking_animation.stop()
|
|
17
55
|
plan = plan.strip()
|
|
56
|
+
|
|
18
57
|
click.echo(plan)
|
|
19
|
-
confirmation =
|
|
20
|
-
title="Do you want to continue with the plan?", skip_confirmation=ctx.deps.dangerously_skip_permissions
|
|
21
|
-
)
|
|
58
|
+
confirmation = show_plan_confirmation(skip_confirmation=ctx.deps.dangerously_skip_permissions)
|
|
22
59
|
|
|
23
60
|
if confirmation == "review":
|
|
24
61
|
feedback = show_input(ctx.deps.workspace_name)
|
|
25
62
|
ctx.deps.thinking_animation.start()
|
|
63
|
+
ctx.deps.cancel_plan()
|
|
26
64
|
return f"User did not confirm the proposed plan and gave the following feedback: {feedback}"
|
|
27
65
|
|
|
28
66
|
ctx.deps.thinking_animation.start()
|
|
29
|
-
|
|
67
|
+
|
|
68
|
+
if confirmation == "yes_and_auto_implement":
|
|
69
|
+
plan_id = ctx.deps.start_plan(plan=plan)
|
|
70
|
+
return f"User confirmed the plan {plan_id}. Implementing..."
|
|
71
|
+
else:
|
|
72
|
+
return "User confirmed the plan. Implementing..."
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def complete_plan(ctx: RunContext[TinybirdAgentContext]) -> str:
|
|
76
|
+
"""Given an ongoing plan, complete it
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
ctx (RunContext[TinybirdAgentContext]): The context of the agent.
|
|
80
|
+
|
|
81
|
+
Returns:
|
|
82
|
+
str: The result of the plan.
|
|
83
|
+
"""
|
|
84
|
+
|
|
85
|
+
plan_id = ctx.deps.cancel_plan()
|
|
86
|
+
return f"Plan {plan_id} completed"
|
|
@@ -3,7 +3,13 @@ import subprocess
|
|
|
3
3
|
import click
|
|
4
4
|
from pydantic_ai import RunContext
|
|
5
5
|
|
|
6
|
-
from tinybird.tb.modules.agent.utils import
|
|
6
|
+
from tinybird.tb.modules.agent.utils import (
|
|
7
|
+
AgentRunCancelled,
|
|
8
|
+
SubAgentRunCancelled,
|
|
9
|
+
TinybirdAgentContext,
|
|
10
|
+
show_confirmation,
|
|
11
|
+
show_input,
|
|
12
|
+
)
|
|
7
13
|
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
8
14
|
|
|
9
15
|
|
|
@@ -24,7 +30,7 @@ def run_command(ctx: RunContext[TinybirdAgentContext], command: str):
|
|
|
24
30
|
if confirmation == "review":
|
|
25
31
|
feedback = show_input(ctx.deps.workspace_name)
|
|
26
32
|
ctx.deps.thinking_animation.start()
|
|
27
|
-
|
|
33
|
+
raise SubAgentRunCancelled(f"""User did not confirm the command `{command}`. Reason: {feedback}.""")
|
|
28
34
|
|
|
29
35
|
click.echo(FeedbackManager.highlight(message=f"» Running command: {command}"))
|
|
30
36
|
command = command.replace("tb", "tb --no-version-warning")
|
|
@@ -32,7 +38,7 @@ def run_command(ctx: RunContext[TinybirdAgentContext], command: str):
|
|
|
32
38
|
click.echo(result.stdout)
|
|
33
39
|
ctx.deps.thinking_animation.start()
|
|
34
40
|
return result.stdout
|
|
35
|
-
except AgentRunCancelled as e:
|
|
41
|
+
except (AgentRunCancelled, SubAgentRunCancelled) as e:
|
|
36
42
|
raise e
|
|
37
43
|
except Exception as e:
|
|
38
44
|
click.echo(FeedbackManager.error(message=f"Error running command: {e}"))
|
|
@@ -70,9 +70,10 @@ def create_or_update_secrets(ctx: RunContext[TinybirdAgentContext], secrets: dic
|
|
|
70
70
|
preview_content = create_terminal_box(new_content, title=".env.local")
|
|
71
71
|
click.echo(preview_content)
|
|
72
72
|
|
|
73
|
+
active_plan = ctx.deps.get_plan() is not None
|
|
73
74
|
confirmation = show_confirmation(
|
|
74
75
|
title=f"{action} {len(secrets)} secret(s) in .env.local?",
|
|
75
|
-
skip_confirmation=ctx.deps.dangerously_skip_permissions,
|
|
76
|
+
skip_confirmation=ctx.deps.dangerously_skip_permissions or active_plan,
|
|
76
77
|
)
|
|
77
78
|
|
|
78
79
|
if confirmation == "review":
|
|
@@ -67,6 +67,9 @@ class TinybirdAgentContext(BaseModel):
|
|
|
67
67
|
local_host: str
|
|
68
68
|
local_token: str
|
|
69
69
|
run_id: Optional[str] = None
|
|
70
|
+
get_plan: Callable[..., Optional[str]]
|
|
71
|
+
start_plan: Callable[..., str]
|
|
72
|
+
cancel_plan: Callable[..., Optional[str]]
|
|
70
73
|
|
|
71
74
|
|
|
72
75
|
default_style = PromptStyle.from_dict(
|
|
@@ -718,6 +721,12 @@ class AgentRunCancelled(Exception):
|
|
|
718
721
|
pass
|
|
719
722
|
|
|
720
723
|
|
|
724
|
+
class SubAgentRunCancelled(Exception):
|
|
725
|
+
"""Exception raised when sub-agent cancels an operation"""
|
|
726
|
+
|
|
727
|
+
pass
|
|
728
|
+
|
|
729
|
+
|
|
721
730
|
def show_confirmation(title: str, skip_confirmation: bool = False, show_review: bool = True) -> ConfirmationResult:
|
|
722
731
|
if skip_confirmation:
|
|
723
732
|
return "yes"
|
|
@@ -778,10 +787,10 @@ def copy_fixture_to_project_folder_if_needed(
|
|
|
778
787
|
if input_path.exists() and not _is_path_inside_project(input_path, project_folder):
|
|
779
788
|
# Ask for confirmation to copy the file
|
|
780
789
|
click.echo(FeedbackManager.highlight(message=f"» File {fixture_pathname} is outside the project folder."))
|
|
781
|
-
|
|
790
|
+
active_plan = ctx.deps.get_plan() is not None
|
|
782
791
|
confirmation = show_confirmation(
|
|
783
792
|
title=f"Copy {input_path.name} to project folder for analysis?",
|
|
784
|
-
skip_confirmation=ctx.deps.dangerously_skip_permissions,
|
|
793
|
+
skip_confirmation=ctx.deps.dangerously_skip_permissions or active_plan,
|
|
785
794
|
)
|
|
786
795
|
|
|
787
796
|
if confirmation == "review":
|
|
@@ -134,7 +134,11 @@ def promote_deployment(host: Optional[str], headers: dict, wait: bool, ingest_hi
|
|
|
134
134
|
result = api_fetch(TINYBIRD_API_URL, headers=headers)
|
|
135
135
|
|
|
136
136
|
last_deployment = result.get("deployment")
|
|
137
|
-
if last_deployment
|
|
137
|
+
if not last_deployment:
|
|
138
|
+
click.echo(FeedbackManager.error(message="Error parsing deployment from response"))
|
|
139
|
+
sys_exit("deployment_error", "Error parsing deployment from response")
|
|
140
|
+
|
|
141
|
+
if last_deployment and last_deployment.get("status") == "deleted":
|
|
138
142
|
click.echo(FeedbackManager.success(message=f"✓ Deployment #{candidate_deployment.get('id')} is live!"))
|
|
139
143
|
break
|
|
140
144
|
|
|
@@ -24,6 +24,7 @@ from tinybird.tb.modules.telemetry import add_telemetry_event
|
|
|
24
24
|
TB_IMAGE_NAME = "tinybirdco/tinybird-local:latest"
|
|
25
25
|
TB_CONTAINER_NAME = "tinybird-local"
|
|
26
26
|
TB_LOCAL_PORT = int(os.getenv("TB_LOCAL_PORT", 7181))
|
|
27
|
+
TB_LOCAL_CLICKHOUSE_INTERFACE_PORT = int(os.getenv("TB_LOCAL_CLICKHOUSE_INTERFACE_PORT", 7182))
|
|
27
28
|
TB_LOCAL_HOST = re.sub(r"^https?://", "", os.getenv("TB_LOCAL_HOST", "localhost"))
|
|
28
29
|
TB_LOCAL_ADDRESS = f"http://{TB_LOCAL_HOST}:{TB_LOCAL_PORT}"
|
|
29
30
|
TB_LOCAL_DEFAULT_WORKSPACE_NAME = "Tinybird_Local_Testing"
|
|
@@ -269,7 +270,7 @@ def start_tinybird_local(
|
|
|
269
270
|
TB_IMAGE_NAME,
|
|
270
271
|
name=TB_CONTAINER_NAME,
|
|
271
272
|
detach=True,
|
|
272
|
-
ports={"7181/tcp": TB_LOCAL_PORT},
|
|
273
|
+
ports={"7181/tcp": TB_LOCAL_PORT, "7182/tcp": TB_LOCAL_CLICKHOUSE_INTERFACE_PORT},
|
|
273
274
|
remove=False,
|
|
274
275
|
platform="linux/amd64",
|
|
275
276
|
environment=environment,
|
|
@@ -8,17 +8,17 @@ tinybird/service_datasources.py,sha256=o6Az3T6OvcChR_7GXRu7sJH173KzGg1Gv-dNd0bI_
|
|
|
8
8
|
tinybird/sql.py,sha256=UZJLop6zA9tTPEaS-Fq7M-QyzmC5uV_tIeXZzkjnhso,48299
|
|
9
9
|
tinybird/sql_template.py,sha256=kaF5pi-f2JiWSYXEF8JsU1OIxvdu2homHnw4MYjq0n8,101953
|
|
10
10
|
tinybird/sql_template_fmt.py,sha256=KUHdj5rYCYm_rKKdXYSJAE9vIyXUQLB0YSZnUXHeBlY,10196
|
|
11
|
-
tinybird/sql_toolset.py,sha256=
|
|
11
|
+
tinybird/sql_toolset.py,sha256=Y2_fQrbk5GSNoRncAmRS_snpV61XQbiOy4uYkeF6pr4,19767
|
|
12
12
|
tinybird/syncasync.py,sha256=IPnOx6lMbf9SNddN1eBtssg8vCLHMt76SuZ6YNYm-Yk,27761
|
|
13
13
|
tinybird/tornado_template.py,sha256=jjNVDMnkYFWXflmT8KU_Ssbo5vR8KQq3EJMk5vYgXRw,41959
|
|
14
14
|
tinybird/ch_utils/constants.py,sha256=v5-nkXHUhysu4i9Z4WVv0-sBbh6xSYUH5q5xHSY2xTI,4194
|
|
15
15
|
tinybird/ch_utils/engine.py,sha256=4X1B-iuhdW_mxKnX_m3iCsxgP9RPVgR75g7yH1vsJ6A,40851
|
|
16
|
-
tinybird/datafile/common.py,sha256=
|
|
16
|
+
tinybird/datafile/common.py,sha256=Cj-CyO6TKa9_31Mao5qQffIDDtoLnKfe93cubGF5S-Y,105670
|
|
17
17
|
tinybird/datafile/exceptions.py,sha256=8rw2umdZjtby85QbuRKFO5ETz_eRHwUY5l7eHsy1wnI,556
|
|
18
18
|
tinybird/datafile/parse_connection.py,sha256=tRyn2Rpr1TeWet5BXmMoQgaotbGdYep1qiTak_OqC5E,1825
|
|
19
19
|
tinybird/datafile/parse_datasource.py,sha256=ssW8QeFSgglVFi3sDZj_HgkJiTJ2069v2JgqnH3CkDE,1825
|
|
20
20
|
tinybird/datafile/parse_pipe.py,sha256=xf4m0Tw44QWJzHzAm7Z7FwUoUUtr7noMYjU1NiWnX0k,3880
|
|
21
|
-
tinybird/tb/__cli__.py,sha256=
|
|
21
|
+
tinybird/tb/__cli__.py,sha256=mQDawLTa-oQDyZZZYyjnBrWWRtaViQL0ZaN2lmv4e1E,247
|
|
22
22
|
tinybird/tb/check_pypi.py,sha256=Gp0HkHHDFMSDL6nxKlOY51z7z1Uv-2LRexNTZSHHGmM,552
|
|
23
23
|
tinybird/tb/cli.py,sha256=FdDFEIayjmsZEVsVSSvRiVYn_FHOVg_zWQzchnzfWho,1008
|
|
24
24
|
tinybird/tb/client.py,sha256=IQRaInDjOwr9Fzaz3_xXc3aUGqh94tM2lew7IZbB9eM,53733
|
|
@@ -34,7 +34,7 @@ tinybird/tb/modules/copy.py,sha256=dPZkcIDvxjJrlQUIvToO0vsEEEs4EYumbNV77-BzNoU,4
|
|
|
34
34
|
tinybird/tb/modules/create.py,sha256=pJxHXG69c9Z_21s-7VuJ3RZOF_nJU51LEwiAkvI3dZY,23251
|
|
35
35
|
tinybird/tb/modules/datasource.py,sha256=kDFHdxckTnRosk2829icfltQvlJd8EY5c9oWB5eS5Xo,41797
|
|
36
36
|
tinybird/tb/modules/deployment.py,sha256=v0layOmG0IMnuXc3RT39mpGfa5M8yPlrL9F089fJFCo,15964
|
|
37
|
-
tinybird/tb/modules/deployment_common.py,sha256=
|
|
37
|
+
tinybird/tb/modules/deployment_common.py,sha256=8Cc0VyKthmTnULiTKgciPyOGtf1kaRghC3Q00bZJbD4,19897
|
|
38
38
|
tinybird/tb/modules/deprecations.py,sha256=rrszC1f_JJeJ8mUxGoCxckQTJFBCR8wREf4XXXN-PRc,4507
|
|
39
39
|
tinybird/tb/modules/dev_server.py,sha256=57FCKuWpErwYUYgHspYDkLWEm9F4pbvVOtMrFXX1fVU,10129
|
|
40
40
|
tinybird/tb/modules/endpoint.py,sha256=ksRj6mfDb9Xv63PhTkV_uKSosgysHElqagg3RTt21Do,11958
|
|
@@ -46,7 +46,7 @@ tinybird/tb/modules/job.py,sha256=wBsnu8UPTOha2rkLvucgmw4xYv73ubmui3eeSIF68ZM,31
|
|
|
46
46
|
tinybird/tb/modules/llm.py,sha256=fPBBCmM3KlCksLlgJkg4joDn6y3H5QjDzE-Pm4YNf7E,1782
|
|
47
47
|
tinybird/tb/modules/llm_utils.py,sha256=nS9r4FAElJw8yXtmdYrx-rtI2zXR8qXfi1QqUDCfxvg,3469
|
|
48
48
|
tinybird/tb/modules/local.py,sha256=kW3IHwJPvhBsa1eMh_xzow9Az3yYpHthkzsLSHeP5HE,6512
|
|
49
|
-
tinybird/tb/modules/local_common.py,sha256=
|
|
49
|
+
tinybird/tb/modules/local_common.py,sha256=PqNADrHRA5YPRfyDxeX9s8zTOMcSkFaC2R7Q8ie_qoA,17874
|
|
50
50
|
tinybird/tb/modules/login.py,sha256=zerXZqIv15pbFk5XRt746xGcVnp01YmL_403byBf4jQ,1245
|
|
51
51
|
tinybird/tb/modules/login_common.py,sha256=CKXD_BjivhGUmBtNbLTJwzQDr6885C72XPZjo0GLLvI,12010
|
|
52
52
|
tinybird/tb/modules/logout.py,sha256=sniI4JNxpTrVeRCp0oGJuQ3yRerG4hH5uz6oBmjv724,1009
|
|
@@ -70,7 +70,7 @@ tinybird/tb/modules/watch.py,sha256=No0bK1M1_3CYuMaIgylxf7vYFJ72lTJe3brz6xQ-mJo,
|
|
|
70
70
|
tinybird/tb/modules/workspace.py,sha256=tCP1zZMwBhLRGm22TGfpSd4cHvQLAS1o_azIXv_r6uw,11172
|
|
71
71
|
tinybird/tb/modules/workspace_members.py,sha256=5JdkJgfuEwbq-t6vxkBhYwgsiTDxF790wsa6Xfif9nk,8608
|
|
72
72
|
tinybird/tb/modules/agent/__init__.py,sha256=i3oe3vDIWWPaicdCM0zs7D7BJ1W0k7th93ooskHAV00,54
|
|
73
|
-
tinybird/tb/modules/agent/agent.py,sha256=
|
|
73
|
+
tinybird/tb/modules/agent/agent.py,sha256=wxLG84pYfNdQPB1TI6Nkv_8Y_bO5lmOX3ht87gnmrwY,36315
|
|
74
74
|
tinybird/tb/modules/agent/animations.py,sha256=4WOC5_2BracttmMCrV0H91tXfWcUzQHBUaIJc5FA7tE,3490
|
|
75
75
|
tinybird/tb/modules/agent/banner.py,sha256=l6cO5Fi7lbVKp-GsBP8jf3IkjOWxg2jpAt9NBCy0WR8,4085
|
|
76
76
|
tinybird/tb/modules/agent/command_agent.py,sha256=0Z08rQsir59zQAr-kkOvsKIFpIBsBSTGJJ1VgqqF5WA,3654
|
|
@@ -79,25 +79,25 @@ tinybird/tb/modules/agent/explore_agent.py,sha256=gyD5uV5TJwV24eeQiSwhkgfNPb4mtb
|
|
|
79
79
|
tinybird/tb/modules/agent/memory.py,sha256=vBewB_64L_wHoT4tLT6UX2uxcHwSY880QZ26F9rPqXs,3793
|
|
80
80
|
tinybird/tb/modules/agent/mock_agent.py,sha256=zbAZfAqdSLUtMr2VqO0erWpzjT2F1tTcuYjvHb-gvbA,8023
|
|
81
81
|
tinybird/tb/modules/agent/models.py,sha256=eokO8XlY-kVJOsbqiVporGUAOCyKAXCO5xgTEK9SM6Y,2208
|
|
82
|
-
tinybird/tb/modules/agent/prompts.py,sha256=
|
|
82
|
+
tinybird/tb/modules/agent/prompts.py,sha256=a8ZnOZCTGRnxa_dlrTSmeaM9snOI3sMx0nwUdv7aVGI,44165
|
|
83
83
|
tinybird/tb/modules/agent/testing_agent.py,sha256=AtwtJViH7805i7djyBgDb7SSUtDyJnw0TWJu6lBFsrg,2953
|
|
84
|
-
tinybird/tb/modules/agent/utils.py,sha256=
|
|
84
|
+
tinybird/tb/modules/agent/utils.py,sha256=alvRNtpPPRZP0sNdOXbzX3uQZHqqeh1daIAg3aquq24,32015
|
|
85
85
|
tinybird/tb/modules/agent/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
86
86
|
tinybird/tb/modules/agent/tools/analyze.py,sha256=CR5LXg4fou-zYEksqnjpJ0icvxJVoKnTctoI1NRvqCM,3873
|
|
87
|
-
tinybird/tb/modules/agent/tools/append.py,sha256=
|
|
87
|
+
tinybird/tb/modules/agent/tools/append.py,sha256=8UsGMzmv7GYbzp0gerOBqpxxocDbous_haSuwS3zuGU,8222
|
|
88
88
|
tinybird/tb/modules/agent/tools/build.py,sha256=Hm-xDAP9ckMiKquT-DmDg5H0yxZefLOaWKANyoVSaEQ,846
|
|
89
|
-
tinybird/tb/modules/agent/tools/datafile.py,sha256=
|
|
89
|
+
tinybird/tb/modules/agent/tools/datafile.py,sha256=kTob7G2TwCwIgwom0rERgXQ13rgPtZv3_ByLnrvpIdU,10881
|
|
90
90
|
tinybird/tb/modules/agent/tools/deploy.py,sha256=6Vmm0lCG8XKE2iUF_ZJrOqXbTFhoe3anPzYCFehQ3_E,2027
|
|
91
91
|
tinybird/tb/modules/agent/tools/deploy_check.py,sha256=pE3d9TPtXVKZjYbU0G6ORAGI86lN5K_4JKUriClERbM,1229
|
|
92
92
|
tinybird/tb/modules/agent/tools/diff_resource.py,sha256=_9xHcDzCTKk_E1wKQbuktVqV6U9sA0kqYaBxWvtliX0,2613
|
|
93
93
|
tinybird/tb/modules/agent/tools/execute_query.py,sha256=DL2jsZ0jaEqFIkGoiWfR-IUAwsgoF0D-_JUhq7xe4gA,9145
|
|
94
94
|
tinybird/tb/modules/agent/tools/get_endpoint_stats.py,sha256=r2FrXg1L1s_Llr1tPdJ6k_gu6qw7qLsAXOkbz3eTk1g,2307
|
|
95
95
|
tinybird/tb/modules/agent/tools/get_openapi_definition.py,sha256=4TIMO2XzHBMhpt9zIWRfjjPZbThT8r_iPS4CVHcItE0,2904
|
|
96
|
-
tinybird/tb/modules/agent/tools/mock.py,sha256=
|
|
97
|
-
tinybird/tb/modules/agent/tools/plan.py,sha256=
|
|
96
|
+
tinybird/tb/modules/agent/tools/mock.py,sha256=Seo4WcYNLL1-SmPXutoaX94_pfOdIb47JXo8dHtUVhg,7106
|
|
97
|
+
tinybird/tb/modules/agent/tools/plan.py,sha256=uAJEHZ-xXIq-EpURJYV7GUyY7IbIgactw9NWeCsIT9Y,2516
|
|
98
98
|
tinybird/tb/modules/agent/tools/request_endpoint.py,sha256=bsLWrMn-ofJM3nn9vm8j_U8fdopVd3H5L0ii6ji-Kuw,4359
|
|
99
|
-
tinybird/tb/modules/agent/tools/run_command.py,sha256=
|
|
100
|
-
tinybird/tb/modules/agent/tools/secret.py,sha256=
|
|
99
|
+
tinybird/tb/modules/agent/tools/run_command.py,sha256=EOHkyK9nktlt5jVz9sQcSt4CN40LO490FjmAy3CuNmE,1793
|
|
100
|
+
tinybird/tb/modules/agent/tools/secret.py,sha256=8AGTZgHLPg1bxCA2cPMnb-zNutWEwn4emHo7kLjJC5w,4323
|
|
101
101
|
tinybird/tb/modules/agent/tools/test.py,sha256=4XuEWVHLOTSO51Z9xJ08dTjk0j3IWY_JlPtSBO5aaUs,10373
|
|
102
102
|
tinybird/tb/modules/datafile/build.py,sha256=NFKBrusFLU0WJNCXePAFWiEDuTaXpwc0lHlOQWEJ43s,51117
|
|
103
103
|
tinybird/tb/modules/datafile/build_common.py,sha256=2yNdxe49IMA9wNvl25NemY2Iaz8L66snjOdT64dm1is,4511
|
|
@@ -119,8 +119,8 @@ tinybird/tb_cli_modules/config.py,sha256=IsgdtFRnUrkY8-Zo32lmk6O7u3bHie1QCxLwgp4
|
|
|
119
119
|
tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
|
|
120
120
|
tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
|
|
121
121
|
tinybird/tb_cli_modules/telemetry.py,sha256=Hh2Io8ZPROSunbOLuMvuIFU4TqwWPmQTqal4WS09K1A,10449
|
|
122
|
-
tinybird-0.0.1.
|
|
123
|
-
tinybird-0.0.1.
|
|
124
|
-
tinybird-0.0.1.
|
|
125
|
-
tinybird-0.0.1.
|
|
126
|
-
tinybird-0.0.1.
|
|
122
|
+
tinybird-0.0.1.dev289.dist-info/METADATA,sha256=ENjdQSJQH3QgYbGGAJddSYazWCBQ-ZJbpW6SyEqFGKE,1845
|
|
123
|
+
tinybird-0.0.1.dev289.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
124
|
+
tinybird-0.0.1.dev289.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
|
|
125
|
+
tinybird-0.0.1.dev289.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
|
|
126
|
+
tinybird-0.0.1.dev289.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|