tinybird 0.0.1.dev289__tar.gz → 0.0.1.dev290__tar.gz
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-0.0.1.dev289 → tinybird-0.0.1.dev290}/PKG-INFO +1 -1
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/__cli__.py +2 -2
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/agent.py +24 -0
- tinybird-0.0.1.dev290/tinybird/tb/modules/agent/file_agent.py +64 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/tools/append.py +2 -1
- tinybird-0.0.1.dev290/tinybird/tb/modules/agent/tools/file.py +82 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird.egg-info/PKG-INFO +1 -1
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird.egg-info/SOURCES.txt +2 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/setup.cfg +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/__cli__.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/ch_utils/constants.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/ch_utils/engine.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/check_pypi.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/client.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/config.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/connectors.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/context.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/datafile/common.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/datafile/exceptions.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/datafile/parse_connection.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/datafile/parse_datasource.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/datafile/parse_pipe.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/datatypes.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/feedback_manager.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/git_settings.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/prompts.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/service_datasources.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/sql.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/sql_template.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/sql_template_fmt.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/sql_toolset.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/syncasync.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/check_pypi.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/cli.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/client.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/config.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/__init__.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/animations.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/banner.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/command_agent.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/compactor.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/explore_agent.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/memory.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/mock_agent.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/models.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/prompts.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/testing_agent.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/tools/__init__.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/tools/analyze.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/tools/build.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/tools/datafile.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/tools/deploy.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/tools/deploy_check.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/tools/diff_resource.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/tools/execute_query.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/tools/get_endpoint_stats.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/tools/get_openapi_definition.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/tools/mock.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/tools/plan.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/tools/request_endpoint.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/tools/run_command.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/tools/secret.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/tools/test.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/utils.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/build.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/build_common.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/cicd.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/cli.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/common.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/config.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/connection.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/copy.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/create.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/datafile/build.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/datafile/build_common.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/datafile/build_datasource.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/datafile/build_pipe.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/datafile/diff.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/datafile/fixture.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/datafile/format_common.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/datafile/format_datasource.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/datafile/format_pipe.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/datafile/pipe_checker.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/datafile/playground.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/datafile/pull.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/datasource.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/deployment.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/deployment_common.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/deprecations.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/dev_server.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/endpoint.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/exceptions.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/feedback_manager.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/info.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/infra.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/job.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/llm.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/llm_utils.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/local.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/local_common.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/login.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/login_common.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/logout.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/materialization.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/mock.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/mock_common.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/open.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/pipe.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/project.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/regions.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/secret.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/secret_common.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/shell.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/sink.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/table.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/telemetry.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/test.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/test_common.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/tinyunit/tinyunit.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/token.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/watch.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/workspace.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/workspace_members.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb_cli.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb_cli_modules/auth.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb_cli_modules/branch.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb_cli_modules/cicd.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb_cli_modules/cli.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb_cli_modules/common.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb_cli_modules/config.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb_cli_modules/connection.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb_cli_modules/datasource.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb_cli_modules/exceptions.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb_cli_modules/fmt.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb_cli_modules/job.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb_cli_modules/pipe.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb_cli_modules/regions.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb_cli_modules/tag.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb_cli_modules/telemetry.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb_cli_modules/test.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb_cli_modules/workspace.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb_cli_modules/workspace_members.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tornado_template.py +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird.egg-info/dependency_links.txt +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird.egg-info/entry_points.txt +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird.egg-info/requires.txt +0 -0
- {tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird.egg-info/top_level.txt +0 -0
|
@@ -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.dev290'
|
|
8
|
+
__revision__ = '4d1cca4'
|
|
@@ -23,6 +23,7 @@ from tinybird.tb.modules.agent.banner import display_banner
|
|
|
23
23
|
from tinybird.tb.modules.agent.command_agent import CommandAgent
|
|
24
24
|
from tinybird.tb.modules.agent.compactor import compact_messages
|
|
25
25
|
from tinybird.tb.modules.agent.explore_agent import ExploreAgent
|
|
26
|
+
from tinybird.tb.modules.agent.file_agent import FileAgent
|
|
26
27
|
from tinybird.tb.modules.agent.memory import (
|
|
27
28
|
clear_history,
|
|
28
29
|
clear_messages,
|
|
@@ -185,6 +186,16 @@ class TinybirdAgent:
|
|
|
185
186
|
workspace_id=workspace_id,
|
|
186
187
|
project=self.project,
|
|
187
188
|
)
|
|
189
|
+
self.file_agent = FileAgent(
|
|
190
|
+
dangerously_skip_permissions=self.dangerously_skip_permissions,
|
|
191
|
+
prompt_mode=prompt_mode,
|
|
192
|
+
thinking_animation=self.thinking_animation,
|
|
193
|
+
token=self.token,
|
|
194
|
+
user_token=self.user_token,
|
|
195
|
+
host=self.host,
|
|
196
|
+
workspace_id=workspace_id,
|
|
197
|
+
project=self.project,
|
|
198
|
+
)
|
|
188
199
|
|
|
189
200
|
@self.agent.tool
|
|
190
201
|
def manage_tests(ctx: RunContext[TinybirdAgentContext], task: str) -> str:
|
|
@@ -251,6 +262,19 @@ class TinybirdAgent:
|
|
|
251
262
|
result = self.mock_agent.run(user_input, deps=ctx.deps, usage=ctx.usage)
|
|
252
263
|
return result.output or "No result returned"
|
|
253
264
|
|
|
265
|
+
@self.agent.tool
|
|
266
|
+
def manage_files(ctx: RunContext[TinybirdAgentContext], task: str) -> str:
|
|
267
|
+
"""List file/folders and read any type of file in the current directory. Use this tool when you need to list or read non Tinybird project files (e.g. .txt, .md).
|
|
268
|
+
|
|
269
|
+
Args:
|
|
270
|
+
task (str): The task to solve. Required.
|
|
271
|
+
|
|
272
|
+
Returns:
|
|
273
|
+
str: The result of the task.
|
|
274
|
+
"""
|
|
275
|
+
result = self.file_agent.run(task, deps=ctx.deps, usage=ctx.usage)
|
|
276
|
+
return result.output or "No result returned"
|
|
277
|
+
|
|
254
278
|
@self.agent.instructions
|
|
255
279
|
def get_local_host(ctx: RunContext[TinybirdAgentContext]) -> str:
|
|
256
280
|
return f"""
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
from pydantic_ai import Agent, Tool
|
|
2
|
+
from pydantic_ai.messages import ModelMessage
|
|
3
|
+
from pydantic_ai.usage import Usage
|
|
4
|
+
|
|
5
|
+
from tinybird.tb.modules.agent.animations import ThinkingAnimation
|
|
6
|
+
from tinybird.tb.modules.agent.models import create_model
|
|
7
|
+
from tinybird.tb.modules.agent.prompts import tone_and_style_instructions
|
|
8
|
+
from tinybird.tb.modules.agent.tools.file import list_files, read_file
|
|
9
|
+
from tinybird.tb.modules.agent.utils import TinybirdAgentContext
|
|
10
|
+
from tinybird.tb.modules.project import Project
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class FileAgent:
|
|
14
|
+
def __init__(
|
|
15
|
+
self,
|
|
16
|
+
token: str,
|
|
17
|
+
user_token: str,
|
|
18
|
+
host: str,
|
|
19
|
+
workspace_id: str,
|
|
20
|
+
project: Project,
|
|
21
|
+
dangerously_skip_permissions: bool,
|
|
22
|
+
prompt_mode: bool,
|
|
23
|
+
thinking_animation: ThinkingAnimation,
|
|
24
|
+
):
|
|
25
|
+
self.token = token
|
|
26
|
+
self.user_token = user_token
|
|
27
|
+
self.host = host
|
|
28
|
+
self.workspace_id = workspace_id
|
|
29
|
+
self.dangerously_skip_permissions = dangerously_skip_permissions or prompt_mode
|
|
30
|
+
self.project = project
|
|
31
|
+
self.thinking_animation = thinking_animation
|
|
32
|
+
self.messages: list[ModelMessage] = []
|
|
33
|
+
self.agent = Agent(
|
|
34
|
+
model=create_model(user_token, host, workspace_id),
|
|
35
|
+
deps_type=TinybirdAgentContext,
|
|
36
|
+
instructions=[
|
|
37
|
+
"""
|
|
38
|
+
You are part of Tinybird Code, an agentic CLI that can help users to work with Tinybird.
|
|
39
|
+
You are a sub-agent of the main Tinybird Code agent. You are responsible for managing files.
|
|
40
|
+
You can do the following:
|
|
41
|
+
- List files in a directory.
|
|
42
|
+
- Read a file.
|
|
43
|
+
|
|
44
|
+
IMPORTANT: Use the `list_files` tool always before `read_file` to get the correct file path.
|
|
45
|
+
""",
|
|
46
|
+
tone_and_style_instructions,
|
|
47
|
+
],
|
|
48
|
+
tools=[
|
|
49
|
+
Tool(list_files, docstring_format="google", require_parameter_descriptions=True, takes_ctx=True),
|
|
50
|
+
Tool(read_file, docstring_format="google", require_parameter_descriptions=True, takes_ctx=True),
|
|
51
|
+
],
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
def run(self, task: str, deps: TinybirdAgentContext, usage: Usage):
|
|
55
|
+
result = self.agent.run_sync(
|
|
56
|
+
task,
|
|
57
|
+
deps=deps,
|
|
58
|
+
usage=usage,
|
|
59
|
+
message_history=self.messages,
|
|
60
|
+
model=create_model(self.user_token, self.host, self.workspace_id, run_id=deps.run_id),
|
|
61
|
+
)
|
|
62
|
+
new_messages = result.new_messages()
|
|
63
|
+
self.messages.extend(new_messages)
|
|
64
|
+
return result
|
|
@@ -24,7 +24,7 @@ def append_file(
|
|
|
24
24
|
Args:
|
|
25
25
|
datasource_name: Name of the datasource to append fixture to
|
|
26
26
|
fixture_pathname: Path to the fixture file to append
|
|
27
|
-
cloud: Whether to append the fixture to the cloud or local environment. If None (user didn't specify), will ask user to clarify. Defaults to local (False) in dangerous skip permissions mode.
|
|
27
|
+
cloud: Whether to append the fixture to the cloud or local environment. If None (user didn't specify in a previous step), will ask user to clarify. Defaults to local (False) in dangerous skip permissions mode.
|
|
28
28
|
|
|
29
29
|
Returns:
|
|
30
30
|
str: Message indicating the success or failure of the appending
|
|
@@ -54,6 +54,7 @@ def append_file(
|
|
|
54
54
|
|
|
55
55
|
cloud_or_local = "Cloud" if cloud else "Local"
|
|
56
56
|
active_plan = ctx.deps.get_plan() is not None and not cloud
|
|
57
|
+
ctx.deps.thinking_animation.stop()
|
|
57
58
|
confirmation = show_confirmation(
|
|
58
59
|
title=f"Append fixture {fixture_pathname} to datasource '{datasource_name}' in Tinybird {cloud_or_local}?",
|
|
59
60
|
skip_confirmation=ctx.deps.dangerously_skip_permissions or active_plan,
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
from glob import glob
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
import click
|
|
5
|
+
from pydantic_ai import RunContext
|
|
6
|
+
|
|
7
|
+
from tinybird.tb.modules.agent.utils import TinybirdAgentContext
|
|
8
|
+
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def list_files(
|
|
12
|
+
ctx: RunContext[TinybirdAgentContext],
|
|
13
|
+
folder_path: str = ".",
|
|
14
|
+
search_pattern: str = "*",
|
|
15
|
+
) -> str:
|
|
16
|
+
"""Lists all files and folders in a directory.
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
folder_path (str): The path to the directory to list. If not provided, it will list the files in the current directory. Default: "."
|
|
20
|
+
search_pattern (str): The pattern to search for in the files and folders. Default: "*"
|
|
21
|
+
Returns:
|
|
22
|
+
str: The list of files in the directory.
|
|
23
|
+
"""
|
|
24
|
+
try:
|
|
25
|
+
ctx.deps.thinking_animation.stop()
|
|
26
|
+
if folder_path:
|
|
27
|
+
path = Path(folder_path)
|
|
28
|
+
else:
|
|
29
|
+
path = Path.cwd()
|
|
30
|
+
|
|
31
|
+
display_folder = "current directory" if (folder_path == "." or not folder_path) else folder_path
|
|
32
|
+
|
|
33
|
+
click.echo(
|
|
34
|
+
FeedbackManager.highlight(message=f"» Searching in {display_folder} with pattern '{search_pattern}'")
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
if not path.exists():
|
|
38
|
+
ctx.deps.thinking_animation.start()
|
|
39
|
+
return f"Folder {folder_path} does not exist"
|
|
40
|
+
|
|
41
|
+
result = glob(f"{path}/**/{search_pattern}", recursive=True)
|
|
42
|
+
folders = [f for f in result if Path(f).is_dir()]
|
|
43
|
+
files = [f for f in result if Path(f).is_file()]
|
|
44
|
+
|
|
45
|
+
ctx.deps.thinking_animation.start()
|
|
46
|
+
return f"Folders: {folders}\nFiles: {files}"
|
|
47
|
+
except Exception as e:
|
|
48
|
+
ctx.deps.thinking_animation.start()
|
|
49
|
+
return f"Error listing files: {e}"
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def read_file(ctx: RunContext[TinybirdAgentContext], file_path: str) -> str:
|
|
53
|
+
"""Reads a file from the local filesystem. The file_path parameter must be an absolute path, not a relative path. Any lines longer than 2000 characters will be truncated.
|
|
54
|
+
|
|
55
|
+
Args:
|
|
56
|
+
file_path (str): The path to the file to read.
|
|
57
|
+
|
|
58
|
+
Returns:
|
|
59
|
+
str: The content of the file.
|
|
60
|
+
"""
|
|
61
|
+
try:
|
|
62
|
+
ctx.deps.thinking_animation.stop()
|
|
63
|
+
click.echo(FeedbackManager.highlight(message=f"» Reading file {file_path}"))
|
|
64
|
+
path = Path(file_path)
|
|
65
|
+
|
|
66
|
+
if not path.exists():
|
|
67
|
+
ctx.deps.thinking_animation.start()
|
|
68
|
+
return f"File {file_path} does not exist"
|
|
69
|
+
|
|
70
|
+
content = path.read_text()
|
|
71
|
+
chunks = content.split("\n")
|
|
72
|
+
|
|
73
|
+
if len(chunks) > 2000:
|
|
74
|
+
first_2000 = "\n".join(chunks[0:2000])
|
|
75
|
+
ctx.deps.thinking_animation.start()
|
|
76
|
+
return f"This file is too large to be read by the agent. Showing first 2000 lines instead:\n\n{first_2000}"
|
|
77
|
+
|
|
78
|
+
ctx.deps.thinking_animation.start()
|
|
79
|
+
return content
|
|
80
|
+
except Exception as e:
|
|
81
|
+
ctx.deps.thinking_animation.start()
|
|
82
|
+
return f"Error reading file: {e}"
|
|
@@ -87,6 +87,7 @@ tinybird/tb/modules/agent/banner.py
|
|
|
87
87
|
tinybird/tb/modules/agent/command_agent.py
|
|
88
88
|
tinybird/tb/modules/agent/compactor.py
|
|
89
89
|
tinybird/tb/modules/agent/explore_agent.py
|
|
90
|
+
tinybird/tb/modules/agent/file_agent.py
|
|
90
91
|
tinybird/tb/modules/agent/memory.py
|
|
91
92
|
tinybird/tb/modules/agent/mock_agent.py
|
|
92
93
|
tinybird/tb/modules/agent/models.py
|
|
@@ -102,6 +103,7 @@ tinybird/tb/modules/agent/tools/deploy.py
|
|
|
102
103
|
tinybird/tb/modules/agent/tools/deploy_check.py
|
|
103
104
|
tinybird/tb/modules/agent/tools/diff_resource.py
|
|
104
105
|
tinybird/tb/modules/agent/tools/execute_query.py
|
|
106
|
+
tinybird/tb/modules/agent/tools/file.py
|
|
105
107
|
tinybird/tb/modules/agent/tools/get_endpoint_stats.py
|
|
106
108
|
tinybird/tb/modules/agent/tools/get_openapi_definition.py
|
|
107
109
|
tinybird/tb/modules/agent/tools/mock.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/tools/deploy_check.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/tools/diff_resource.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/tools/execute_query.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/tools/request_endpoint.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/agent/tools/run_command.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/datafile/build_common.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/datafile/build_datasource.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/datafile/format_common.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/datafile/format_datasource.py
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/datafile/pipe_checker.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb/modules/tinyunit/tinyunit_lib.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb_cli_modules/tinyunit/tinyunit.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev289 → tinybird-0.0.1.dev290}/tinybird/tb_cli_modules/workspace_members.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|