tinybird 0.0.1.dev257__tar.gz → 0.0.1.dev258__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.

Files changed (141) hide show
  1. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/PKG-INFO +1 -1
  2. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/__cli__.py +2 -2
  3. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/agent/agent.py +17 -3
  4. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/agent/banner.py +1 -0
  5. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/agent/tools/analyze.py +3 -1
  6. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/agent/tools/append.py +5 -9
  7. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/agent/tools/build.py +2 -1
  8. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/agent/tools/create_datafile.py +3 -5
  9. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/agent/tools/deploy.py +2 -5
  10. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/agent/tools/deploy_check.py +2 -5
  11. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/agent/tools/mock.py +3 -5
  12. tinybird-0.0.1.dev258/tinybird/tb/modules/agent/tools/plan.py +29 -0
  13. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/agent/utils.py +9 -3
  14. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird.egg-info/PKG-INFO +1 -1
  15. tinybird-0.0.1.dev257/tinybird/tb/modules/agent/tools/plan.py +0 -37
  16. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/setup.cfg +0 -0
  17. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/__cli__.py +0 -0
  18. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/ch_utils/constants.py +0 -0
  19. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/ch_utils/engine.py +0 -0
  20. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/check_pypi.py +0 -0
  21. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/client.py +0 -0
  22. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/config.py +0 -0
  23. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/connectors.py +0 -0
  24. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/context.py +0 -0
  25. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/datafile/common.py +0 -0
  26. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/datafile/exceptions.py +0 -0
  27. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/datafile/parse_connection.py +0 -0
  28. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/datafile/parse_datasource.py +0 -0
  29. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/datafile/parse_pipe.py +0 -0
  30. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/datatypes.py +0 -0
  31. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/feedback_manager.py +0 -0
  32. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/git_settings.py +0 -0
  33. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/prompts.py +0 -0
  34. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/sql.py +0 -0
  35. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/sql_template.py +0 -0
  36. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/sql_template_fmt.py +0 -0
  37. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/sql_toolset.py +0 -0
  38. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/syncasync.py +0 -0
  39. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/check_pypi.py +0 -0
  40. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/cli.py +0 -0
  41. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/client.py +0 -0
  42. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/config.py +0 -0
  43. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/agent/__init__.py +0 -0
  44. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/agent/animations.py +0 -0
  45. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/agent/memory.py +0 -0
  46. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/agent/models.py +0 -0
  47. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/agent/prompts.py +0 -0
  48. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/agent/tools/__init__.py +0 -0
  49. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/agent/tools/diff_resource.py +0 -0
  50. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/agent/tools/execute_query.py +0 -0
  51. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/agent/tools/explore.py +0 -0
  52. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/agent/tools/get_endpoint_stats.py +0 -0
  53. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/agent/tools/get_openapi_definition.py +0 -0
  54. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/agent/tools/preview_datafile.py +0 -0
  55. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/agent/tools/request_endpoint.py +0 -0
  56. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/build.py +0 -0
  57. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/build_common.py +0 -0
  58. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/cicd.py +0 -0
  59. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/cli.py +0 -0
  60. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/common.py +0 -0
  61. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/config.py +0 -0
  62. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/connection.py +0 -0
  63. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/copy.py +0 -0
  64. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/create.py +0 -0
  65. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/datafile/build.py +0 -0
  66. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/datafile/build_common.py +0 -0
  67. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/datafile/build_datasource.py +0 -0
  68. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/datafile/build_pipe.py +0 -0
  69. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/datafile/diff.py +0 -0
  70. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/datafile/fixture.py +0 -0
  71. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/datafile/format_common.py +0 -0
  72. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/datafile/format_datasource.py +0 -0
  73. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/datafile/format_pipe.py +0 -0
  74. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/datafile/pipe_checker.py +0 -0
  75. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/datafile/playground.py +0 -0
  76. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/datafile/pull.py +0 -0
  77. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/datasource.py +0 -0
  78. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/deployment.py +0 -0
  79. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/deployment_common.py +0 -0
  80. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/deprecations.py +0 -0
  81. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/dev_server.py +0 -0
  82. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/endpoint.py +0 -0
  83. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/exceptions.py +0 -0
  84. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/feedback_manager.py +0 -0
  85. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/info.py +0 -0
  86. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/infra.py +0 -0
  87. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/job.py +0 -0
  88. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/llm.py +0 -0
  89. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/llm_utils.py +0 -0
  90. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/local.py +0 -0
  91. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/local_common.py +0 -0
  92. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/login.py +0 -0
  93. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/login_common.py +0 -0
  94. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/logout.py +0 -0
  95. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/materialization.py +0 -0
  96. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/mock.py +0 -0
  97. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/mock_common.py +0 -0
  98. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/open.py +0 -0
  99. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/pipe.py +0 -0
  100. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/project.py +0 -0
  101. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/regions.py +0 -0
  102. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/secret.py +0 -0
  103. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/secret_common.py +0 -0
  104. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/shell.py +0 -0
  105. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/sink.py +0 -0
  106. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/table.py +0 -0
  107. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/telemetry.py +0 -0
  108. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/test.py +0 -0
  109. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/tinyunit/tinyunit.py +0 -0
  110. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/tinyunit/tinyunit_lib.py +0 -0
  111. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/token.py +0 -0
  112. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/watch.py +0 -0
  113. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/workspace.py +0 -0
  114. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb/modules/workspace_members.py +0 -0
  115. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb_cli.py +0 -0
  116. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb_cli_modules/auth.py +0 -0
  117. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb_cli_modules/branch.py +0 -0
  118. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb_cli_modules/cicd.py +0 -0
  119. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb_cli_modules/cli.py +0 -0
  120. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb_cli_modules/common.py +0 -0
  121. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb_cli_modules/config.py +0 -0
  122. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb_cli_modules/connection.py +0 -0
  123. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb_cli_modules/datasource.py +0 -0
  124. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb_cli_modules/exceptions.py +0 -0
  125. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb_cli_modules/fmt.py +0 -0
  126. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb_cli_modules/job.py +0 -0
  127. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb_cli_modules/pipe.py +0 -0
  128. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb_cli_modules/regions.py +0 -0
  129. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb_cli_modules/tag.py +0 -0
  130. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb_cli_modules/telemetry.py +0 -0
  131. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb_cli_modules/test.py +0 -0
  132. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
  133. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
  134. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb_cli_modules/workspace.py +0 -0
  135. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tb_cli_modules/workspace_members.py +0 -0
  136. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird/tornado_template.py +0 -0
  137. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird.egg-info/SOURCES.txt +0 -0
  138. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird.egg-info/dependency_links.txt +0 -0
  139. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird.egg-info/entry_points.txt +0 -0
  140. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird.egg-info/requires.txt +0 -0
  141. {tinybird-0.0.1.dev257 → tinybird-0.0.1.dev258}/tinybird.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev257
3
+ Version: 0.0.1.dev258
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird
@@ -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.dev257'
8
- __revision__ = '249ae8d'
7
+ __version__ = '0.0.1.dev258'
8
+ __revision__ = 'ca57848'
@@ -10,7 +10,7 @@ import click
10
10
  import humanfriendly
11
11
  from pydantic_ai import Agent, RunContext, Tool
12
12
  from pydantic_ai.agent import AgentRunResult
13
- from pydantic_ai.messages import ModelMessage
13
+ from pydantic_ai.messages import ModelMessage, ModelRequest, UserPromptPart
14
14
 
15
15
  from tinybird.tb.client import TinyB
16
16
  from tinybird.tb.modules.agent.animations import ThinkingAnimation
@@ -32,7 +32,7 @@ from tinybird.tb.modules.agent.tools.mock import mock
32
32
  from tinybird.tb.modules.agent.tools.plan import plan
33
33
  from tinybird.tb.modules.agent.tools.preview_datafile import preview_datafile
34
34
  from tinybird.tb.modules.agent.tools.request_endpoint import request_endpoint
35
- from tinybird.tb.modules.agent.utils import TinybirdAgentContext, show_input
35
+ from tinybird.tb.modules.agent.utils import AgentRunCancelled, TinybirdAgentContext, show_input
36
36
  from tinybird.tb.modules.build_common import process as build_process
37
37
  from tinybird.tb.modules.common import _analyze, _get_tb_client, echo_safe_humanfriendly_tables_format_pretty_table
38
38
  from tinybird.tb.modules.config import CLIConfig
@@ -119,6 +119,9 @@ class TinybirdAgent:
119
119
 
120
120
  self.thinking_animation = ThinkingAnimation()
121
121
 
122
+ def add_message(self, message: ModelMessage) -> None:
123
+ self.messages.append(message)
124
+
122
125
  def _keep_recent_messages(self, messages: list[ModelMessage]) -> list[ModelMessage]:
123
126
  """Keep only the last 5 messages to manage token usage."""
124
127
  return messages[-5:] if len(messages) > 5 else messages
@@ -320,7 +323,18 @@ def run_agent(
320
323
  continue
321
324
  else:
322
325
  asyncio.run(agent.run_iter(user_input, config))
323
-
326
+ except AgentRunCancelled:
327
+ click.echo(FeedbackManager.info(message="User cancelled the operation"))
328
+ agent.add_message(
329
+ ModelRequest(
330
+ parts=[
331
+ UserPromptPart(
332
+ content="User cancelled the operation",
333
+ )
334
+ ]
335
+ )
336
+ )
337
+ continue
324
338
  except KeyboardInterrupt:
325
339
  click.echo(FeedbackManager.info(message="Goodbye!"))
326
340
  break
@@ -53,3 +53,4 @@ def display_banner():
53
53
  char_count += 1
54
54
 
55
55
  click.echo(colored_line + reset)
56
+ click.echo()
@@ -5,7 +5,7 @@ from urllib.parse import urlparse
5
5
  import click
6
6
  from pydantic_ai import RunContext
7
7
 
8
- from tinybird.tb.modules.agent.utils import TinybirdAgentContext
8
+ from tinybird.tb.modules.agent.utils import AgentRunCancelled, TinybirdAgentContext
9
9
  from tinybird.tb.modules.feedback_manager import FeedbackManager
10
10
 
11
11
 
@@ -37,6 +37,8 @@ def analyze_file(ctx: RunContext[TinybirdAgentContext], fixture_pathname: str):
37
37
  columns = response["analysis"]["columns"]
38
38
 
39
39
  return f"#Result of analysis of {fixture_pathname}:\n##Columns:\n{json.dumps(columns)}\n##Data sample:\n{json.dumps(data)}"
40
+ except AgentRunCancelled as e:
41
+ raise e
40
42
  except Exception as e:
41
43
  ctx.deps.thinking_animation.stop()
42
44
  click.echo(FeedbackManager.error(message=f"Error analyzing {fixture_pathname}: {e}"))
@@ -1,7 +1,7 @@
1
1
  import click
2
2
  from pydantic_ai import RunContext
3
3
 
4
- from tinybird.tb.modules.agent.utils import TinybirdAgentContext, show_confirmation, show_input
4
+ from tinybird.tb.modules.agent.utils import AgentRunCancelled, TinybirdAgentContext, show_confirmation, show_input
5
5
  from tinybird.tb.modules.feedback_manager import FeedbackManager
6
6
 
7
7
 
@@ -31,10 +31,6 @@ def append_file(
31
31
  ctx.deps.thinking_animation.start()
32
32
  return f"User did not confirm appending {fixture_pathname} fixture in Tinybird {cloud_or_local} and gave the following feedback: {feedback}"
33
33
 
34
- if confirmation == "cancel":
35
- ctx.deps.thinking_animation.start()
36
- return f"User rejected appending {fixture_pathname} fixture in Tinybird {cloud_or_local}. Skip this step"
37
-
38
34
  ctx.deps.thinking_animation.stop()
39
35
  click.echo(FeedbackManager.highlight(message=f"» Appending {fixture_pathname} to {datasource_name}..."))
40
36
  if cloud:
@@ -44,6 +40,8 @@ def append_file(
44
40
  click.echo(FeedbackManager.success(message=f"✓ Data appended to {datasource_name}"))
45
41
  ctx.deps.thinking_animation.start()
46
42
  return f"Data appended to {datasource_name} in Tinybird {cloud_or_local}"
43
+ except AgentRunCancelled as e:
44
+ raise e
47
45
  except Exception as e:
48
46
  error_message = str(e)
49
47
  ctx.deps.thinking_animation.stop()
@@ -79,10 +77,6 @@ def append_url(
79
77
  ctx.deps.thinking_animation.start()
80
78
  return f"User did not confirm appending URL {fixture_url} in Tinybird {cloud_or_local} and gave the following feedback: {feedback}"
81
79
 
82
- if confirmation == "cancel":
83
- ctx.deps.thinking_animation.start()
84
- return f"User rejected appending URL {fixture_url} in Tinybird {cloud_or_local}. Skip this step"
85
-
86
80
  ctx.deps.thinking_animation.stop()
87
81
  click.echo(FeedbackManager.highlight(message=f"» Appending {fixture_url} to {datasource_name}..."))
88
82
  if cloud:
@@ -92,6 +86,8 @@ def append_url(
92
86
  click.echo(FeedbackManager.success(message=f"✓ Data appended to {datasource_name}"))
93
87
  ctx.deps.thinking_animation.start()
94
88
  return f"Data appended to {datasource_name} in Tinybird {cloud_or_local}"
89
+ except AgentRunCancelled as e:
90
+ raise e
95
91
  except Exception as e:
96
92
  error_message = str(e)
97
93
  ctx.deps.thinking_animation.stop()
@@ -2,6 +2,7 @@ import click
2
2
  from pydantic_ai import RunContext
3
3
 
4
4
  from tinybird.tb.modules.agent.utils import TinybirdAgentContext
5
+ from tinybird.tb.modules.exceptions import CLIBuildException
5
6
  from tinybird.tb.modules.feedback_manager import FeedbackManager
6
7
 
7
8
 
@@ -13,7 +14,7 @@ def build(ctx: RunContext[TinybirdAgentContext]) -> str:
13
14
  ctx.deps.build_project(test=False, silent=False)
14
15
  ctx.deps.thinking_animation.start()
15
16
  return "Project built successfully"
16
- except Exception as e:
17
+ except CLIBuildException as e:
17
18
  ctx.deps.thinking_animation.stop()
18
19
  click.echo(FeedbackManager.error(message=e))
19
20
  ctx.deps.thinking_animation.start()
@@ -5,6 +5,7 @@ import click
5
5
  from pydantic_ai import RunContext
6
6
 
7
7
  from tinybird.tb.modules.agent.utils import (
8
+ AgentRunCancelled,
8
9
  Datafile,
9
10
  TinybirdAgentContext,
10
11
  create_terminal_box,
@@ -46,10 +47,6 @@ def create_datafile(ctx: RunContext[TinybirdAgentContext], resource: Datafile) -
46
47
  ctx.deps.thinking_animation.start()
47
48
  return f"User did not confirm the proposed changes and gave the following feedback: {feedback}"
48
49
 
49
- if confirmation == "cancel":
50
- ctx.deps.thinking_animation.start()
51
- return f"User cancelled {action} of {resource.pathname}. Stop resource creation."
52
-
53
50
  click.echo(FeedbackManager.highlight(message=f"» Building {resource.pathname}..."))
54
51
  folder_path = path.parent
55
52
  folder_path.mkdir(parents=True, exist_ok=True)
@@ -60,7 +57,8 @@ def create_datafile(ctx: RunContext[TinybirdAgentContext], resource: Datafile) -
60
57
  click.echo(FeedbackManager.success(message=f"✓ {resource.pathname} {action_text}"))
61
58
  ctx.deps.thinking_animation.start()
62
59
  return f"{action_text} {resource.pathname}"
63
-
60
+ except AgentRunCancelled as e:
61
+ raise e
64
62
  except CLIBuildException as e:
65
63
  ctx.deps.thinking_animation.stop()
66
64
  click.echo(FeedbackManager.error(message=e))
@@ -2,6 +2,7 @@ import click
2
2
  from pydantic_ai import RunContext
3
3
 
4
4
  from tinybird.tb.modules.agent.utils import TinybirdAgentContext, show_confirmation, show_input
5
+ from tinybird.tb.modules.exceptions import CLIDeploymentException
5
6
  from tinybird.tb.modules.feedback_manager import FeedbackManager
6
7
 
7
8
 
@@ -19,15 +20,11 @@ def deploy(ctx: RunContext[TinybirdAgentContext]) -> str:
19
20
  ctx.deps.thinking_animation.start()
20
21
  return f"User did not confirm deployment and gave the following feedback: {feedback}"
21
22
 
22
- if confirmation == "cancel":
23
- ctx.deps.thinking_animation.start()
24
- return "User cancelled deployment. Stop deployment."
25
-
26
23
  click.echo(FeedbackManager.highlight(message="» Deploying project..."))
27
24
  ctx.deps.deploy_project()
28
25
  click.echo(FeedbackManager.success(message="✓ Project deployed successfully"))
29
26
  ctx.deps.thinking_animation.start()
30
27
  return "Project deployed successfully"
31
- except Exception as e:
28
+ except CLIDeploymentException as e:
32
29
  ctx.deps.thinking_animation.start()
33
30
  return f"Error depoying project: {e}"
@@ -1,6 +1,7 @@
1
1
  from pydantic_ai import RunContext
2
2
 
3
3
  from tinybird.tb.modules.agent.utils import TinybirdAgentContext, show_confirmation, show_input
4
+ from tinybird.tb.modules.exceptions import CLIDeploymentException
4
5
 
5
6
 
6
7
  def deploy_check(ctx: RunContext[TinybirdAgentContext]) -> str:
@@ -17,13 +18,9 @@ def deploy_check(ctx: RunContext[TinybirdAgentContext]) -> str:
17
18
  ctx.deps.thinking_animation.start()
18
19
  return f"User did not confirm deployment check and gave the following feedback: {feedback}"
19
20
 
20
- if confirmation == "cancel":
21
- ctx.deps.thinking_animation.start()
22
- return "User cancelled deployment check. Stop deployment check."
23
-
24
21
  ctx.deps.deploy_check_project()
25
22
  ctx.deps.thinking_animation.start()
26
23
  return "Project can be deployed"
27
- except Exception as e:
24
+ except CLIDeploymentException as e:
28
25
  ctx.deps.thinking_animation.start()
29
26
  return f"Project cannot be deployed: {e}"
@@ -3,7 +3,7 @@ from typing import Optional
3
3
  import click
4
4
  from pydantic_ai import RunContext
5
5
 
6
- from tinybird.tb.modules.agent.utils import TinybirdAgentContext, show_confirmation, show_input
6
+ from tinybird.tb.modules.agent.utils import AgentRunCancelled, TinybirdAgentContext, show_confirmation, show_input
7
7
  from tinybird.tb.modules.datafile.fixture import persist_fixture
8
8
  from tinybird.tb.modules.feedback_manager import FeedbackManager
9
9
 
@@ -41,10 +41,6 @@ def mock(
41
41
  ctx.deps.thinking_animation.start()
42
42
  return f"User did not confirm mock data for datasource '{datasource_name}' in Tinybird {cloud_or_local} and gave the following feedback: {feedback}"
43
43
 
44
- if confirmation == "cancel":
45
- ctx.deps.thinking_animation.start()
46
- return f"User cancelled mock data for datasource '{datasource_name}' in Tinybird {cloud_or_local}. Stop mock data generation."
47
-
48
44
  click.echo(FeedbackManager.highlight(message=f"» Generating mock data for {datasource_name}..."))
49
45
  data = ctx.deps.mock_data(datasource_name=datasource_name, data_format=data_format, rows=rows, context=context)
50
46
  fixture_path = persist_fixture(datasource_name, data, ctx.deps.folder, format=data_format)
@@ -55,6 +51,8 @@ def mock(
55
51
  click.echo(FeedbackManager.success(message=f"✓ Data generated for {datasource_name}"))
56
52
  ctx.deps.thinking_animation.start()
57
53
  return f"Mock data generated successfully for datasource '{datasource_name}' in Tinybird {cloud_or_local}"
54
+ except AgentRunCancelled as e:
55
+ raise e
58
56
  except Exception as e:
59
57
  ctx.deps.thinking_animation.stop()
60
58
  error_message = str(e)
@@ -0,0 +1,29 @@
1
+ import click
2
+ from pydantic_ai import RunContext
3
+
4
+ from tinybird.tb.modules.agent.utils import TinybirdAgentContext, show_confirmation, show_input
5
+
6
+
7
+ def plan(ctx: RunContext[TinybirdAgentContext], plan: str) -> str:
8
+ """Given a plan, ask the user for confirmation to implement it
9
+
10
+ Args:
11
+ plan (str): The plan to implement. Required.
12
+
13
+ Returns:
14
+ str: If the plan was implemented or not.
15
+ """
16
+ ctx.deps.thinking_animation.stop()
17
+ plan = plan.strip()
18
+ click.echo(plan)
19
+ confirmation = show_confirmation(
20
+ title="Do you want to continue with the plan?", skip_confirmation=ctx.deps.dangerously_skip_permissions
21
+ )
22
+
23
+ if confirmation == "review":
24
+ feedback = show_input(ctx.deps.workspace_name)
25
+ ctx.deps.thinking_animation.start()
26
+ return f"User did not confirm the proposed plan and gave the following feedback: {feedback}"
27
+
28
+ ctx.deps.thinking_animation.start()
29
+ return "User confirmed the plan. Implementing..."
@@ -352,7 +352,7 @@ def show_options(options: List[str], title: str = "Select an option") -> Optiona
352
352
  return result["option"]
353
353
 
354
354
 
355
- ConfirmationResult = Literal["yes", "review", "cancel"]
355
+ ConfirmationResult = Literal["yes", "review"]
356
356
 
357
357
 
358
358
  def load_existing_resources(folder: str) -> str:
@@ -703,6 +703,12 @@ def show_input(workspace_name: str) -> str:
703
703
  )
704
704
 
705
705
 
706
+ class AgentRunCancelled(Exception):
707
+ """Exception raised when user cancels an operation"""
708
+
709
+ pass
710
+
711
+
706
712
  def show_confirmation(title: str, skip_confirmation: bool = False) -> ConfirmationResult:
707
713
  if skip_confirmation:
708
714
  return "yes"
@@ -714,11 +720,11 @@ def show_confirmation(title: str, skip_confirmation: bool = False) -> Confirmati
714
720
  )
715
721
 
716
722
  if result is None: # Cancelled
717
- return "cancel"
723
+ raise AgentRunCancelled(f"User cancelled the operation: {title}")
718
724
 
719
725
  if result.startswith("Yes"):
720
726
  return "yes"
721
727
  elif result.startswith("No"):
722
728
  return "review"
723
729
 
724
- return "cancel"
730
+ raise AgentRunCancelled(f"User cancelled the operation: {title}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev257
3
+ Version: 0.0.1.dev258
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird
@@ -1,37 +0,0 @@
1
- import click
2
- from pydantic_ai import RunContext
3
-
4
- from tinybird.tb.modules.agent.utils import TinybirdAgentContext, show_confirmation, show_input
5
-
6
-
7
- def plan(ctx: RunContext[TinybirdAgentContext], plan: str) -> str:
8
- """Given a plan, ask the user for confirmation to implement it
9
-
10
- Args:
11
- plan (str): The plan to implement. Required.
12
-
13
- Returns:
14
- str: If the plan was implemented or not.
15
- """
16
- try:
17
- ctx.deps.thinking_animation.stop()
18
- plan = plan.strip()
19
- click.echo(plan)
20
- confirmation = show_confirmation(
21
- title="Do you want to continue with the plan?", skip_confirmation=ctx.deps.dangerously_skip_permissions
22
- )
23
-
24
- if confirmation == "review":
25
- feedback = show_input(ctx.deps.workspace_name)
26
- ctx.deps.thinking_animation.start()
27
- return f"User did not confirm the proposed plan and gave the following feedback: {feedback}"
28
-
29
- ctx.deps.thinking_animation.start()
30
-
31
- if confirmation == "cancel":
32
- return "User cancelled the plan. Stop the process."
33
-
34
- return "User confirmed the plan. Implementing..."
35
-
36
- except Exception as e:
37
- return f"Error implementing the plan: {e}"