tinybird 0.0.1.dev287__tar.gz → 0.0.1.dev288__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 (149) hide show
  1. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/PKG-INFO +1 -1
  2. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/__cli__.py +2 -2
  3. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/agent.py +22 -3
  4. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/prompts.py +2 -0
  5. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/tools/append.py +4 -2
  6. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/tools/datafile.py +6 -4
  7. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/tools/mock.py +3 -2
  8. tinybird-0.0.1.dev288/tinybird/tb/modules/agent/tools/plan.py +86 -0
  9. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/tools/secret.py +2 -1
  10. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/utils.py +5 -2
  11. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/deployment_common.py +5 -1
  12. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird.egg-info/PKG-INFO +1 -1
  13. tinybird-0.0.1.dev287/tinybird/tb/modules/agent/tools/plan.py +0 -29
  14. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/setup.cfg +0 -0
  15. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/__cli__.py +0 -0
  16. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/ch_utils/constants.py +0 -0
  17. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/ch_utils/engine.py +0 -0
  18. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/check_pypi.py +0 -0
  19. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/client.py +0 -0
  20. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/config.py +0 -0
  21. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/connectors.py +0 -0
  22. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/context.py +0 -0
  23. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/datafile/common.py +0 -0
  24. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/datafile/exceptions.py +0 -0
  25. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/datafile/parse_connection.py +0 -0
  26. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/datafile/parse_datasource.py +0 -0
  27. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/datafile/parse_pipe.py +0 -0
  28. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/datatypes.py +0 -0
  29. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/feedback_manager.py +0 -0
  30. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/git_settings.py +0 -0
  31. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/prompts.py +0 -0
  32. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/service_datasources.py +0 -0
  33. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/sql.py +0 -0
  34. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/sql_template.py +0 -0
  35. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/sql_template_fmt.py +0 -0
  36. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/sql_toolset.py +0 -0
  37. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/syncasync.py +0 -0
  38. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/check_pypi.py +0 -0
  39. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/cli.py +0 -0
  40. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/client.py +0 -0
  41. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/config.py +0 -0
  42. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/__init__.py +0 -0
  43. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/animations.py +0 -0
  44. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/banner.py +0 -0
  45. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/command_agent.py +0 -0
  46. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/compactor.py +0 -0
  47. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/explore_agent.py +0 -0
  48. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/memory.py +0 -0
  49. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/mock_agent.py +0 -0
  50. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/models.py +0 -0
  51. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/testing_agent.py +0 -0
  52. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/tools/__init__.py +0 -0
  53. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/tools/analyze.py +0 -0
  54. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/tools/build.py +0 -0
  55. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/tools/deploy.py +0 -0
  56. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/tools/deploy_check.py +0 -0
  57. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/tools/diff_resource.py +0 -0
  58. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/tools/execute_query.py +0 -0
  59. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/tools/get_endpoint_stats.py +0 -0
  60. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/tools/get_openapi_definition.py +0 -0
  61. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/tools/request_endpoint.py +0 -0
  62. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/tools/run_command.py +0 -0
  63. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/agent/tools/test.py +0 -0
  64. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/build.py +0 -0
  65. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/build_common.py +0 -0
  66. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/cicd.py +0 -0
  67. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/cli.py +0 -0
  68. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/common.py +0 -0
  69. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/config.py +0 -0
  70. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/connection.py +0 -0
  71. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/copy.py +0 -0
  72. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/create.py +0 -0
  73. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/datafile/build.py +0 -0
  74. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/datafile/build_common.py +0 -0
  75. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/datafile/build_datasource.py +0 -0
  76. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/datafile/build_pipe.py +0 -0
  77. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/datafile/diff.py +0 -0
  78. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/datafile/fixture.py +0 -0
  79. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/datafile/format_common.py +0 -0
  80. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/datafile/format_datasource.py +0 -0
  81. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/datafile/format_pipe.py +0 -0
  82. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/datafile/pipe_checker.py +0 -0
  83. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/datafile/playground.py +0 -0
  84. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/datafile/pull.py +0 -0
  85. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/datasource.py +0 -0
  86. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/deployment.py +0 -0
  87. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/deprecations.py +0 -0
  88. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/dev_server.py +0 -0
  89. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/endpoint.py +0 -0
  90. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/exceptions.py +0 -0
  91. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/feedback_manager.py +0 -0
  92. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/info.py +0 -0
  93. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/infra.py +0 -0
  94. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/job.py +0 -0
  95. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/llm.py +0 -0
  96. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/llm_utils.py +0 -0
  97. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/local.py +0 -0
  98. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/local_common.py +0 -0
  99. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/login.py +0 -0
  100. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/login_common.py +0 -0
  101. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/logout.py +0 -0
  102. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/materialization.py +0 -0
  103. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/mock.py +0 -0
  104. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/mock_common.py +0 -0
  105. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/open.py +0 -0
  106. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/pipe.py +0 -0
  107. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/project.py +0 -0
  108. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/regions.py +0 -0
  109. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/secret.py +0 -0
  110. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/secret_common.py +0 -0
  111. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/shell.py +0 -0
  112. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/sink.py +0 -0
  113. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/table.py +0 -0
  114. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/telemetry.py +0 -0
  115. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/test.py +0 -0
  116. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/test_common.py +0 -0
  117. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/tinyunit/tinyunit.py +0 -0
  118. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/tinyunit/tinyunit_lib.py +0 -0
  119. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/token.py +0 -0
  120. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/watch.py +0 -0
  121. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/workspace.py +0 -0
  122. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb/modules/workspace_members.py +0 -0
  123. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb_cli.py +0 -0
  124. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb_cli_modules/auth.py +0 -0
  125. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb_cli_modules/branch.py +0 -0
  126. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb_cli_modules/cicd.py +0 -0
  127. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb_cli_modules/cli.py +0 -0
  128. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb_cli_modules/common.py +0 -0
  129. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb_cli_modules/config.py +0 -0
  130. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb_cli_modules/connection.py +0 -0
  131. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb_cli_modules/datasource.py +0 -0
  132. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb_cli_modules/exceptions.py +0 -0
  133. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb_cli_modules/fmt.py +0 -0
  134. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb_cli_modules/job.py +0 -0
  135. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb_cli_modules/pipe.py +0 -0
  136. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb_cli_modules/regions.py +0 -0
  137. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb_cli_modules/tag.py +0 -0
  138. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb_cli_modules/telemetry.py +0 -0
  139. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb_cli_modules/test.py +0 -0
  140. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
  141. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
  142. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb_cli_modules/workspace.py +0 -0
  143. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tb_cli_modules/workspace_members.py +0 -0
  144. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird/tornado_template.py +0 -0
  145. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird.egg-info/SOURCES.txt +0 -0
  146. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird.egg-info/dependency_links.txt +0 -0
  147. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird.egg-info/entry_points.txt +0 -0
  148. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/tinybird.egg-info/requires.txt +0 -0
  149. {tinybird-0.0.1.dev287 → tinybird-0.0.1.dev288}/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.dev287
3
+ Version: 0.0.1.dev288
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.dev287'
8
- __revision__ = 'f35d4e1'
7
+ __version__ = '0.0.1.dev288'
8
+ __revision__ = '6cd5b6c'
@@ -1,4 +1,5 @@
1
1
  import asyncio
2
+ import hashlib
2
3
  import shlex
3
4
  import subprocess
4
5
  import sys
@@ -47,7 +48,7 @@ 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
53
  from tinybird.tb.modules.agent.utils import AgentRunCancelled, TinybirdAgentContext, show_confirmation, show_input
53
54
  from tinybird.tb.modules.build_common import process as build_process
@@ -89,6 +90,7 @@ class TinybirdAgent:
89
90
  self.dangerously_skip_permissions = dangerously_skip_permissions or prompt_mode
90
91
  self.project = project
91
92
  self.thinking_animation = ThinkingAnimation()
93
+ self.confirmed_plan_id: Optional[str] = None
92
94
  if prompt_mode:
93
95
  self.messages: list[ModelMessage] = get_last_messages_from_last_user_prompt()
94
96
  else:
@@ -109,6 +111,7 @@ class TinybirdAgent:
109
111
  takes_ctx=True,
110
112
  ),
111
113
  Tool(plan, docstring_format="google", require_parameter_descriptions=True, takes_ctx=True),
114
+ Tool(complete_plan, docstring_format="google", require_parameter_descriptions=True, takes_ctx=True),
112
115
  Tool(build, docstring_format="google", require_parameter_descriptions=True, takes_ctx=True),
113
116
  Tool(deploy, docstring_format="google", require_parameter_descriptions=True, takes_ctx=True),
114
117
  Tool(deploy_check, docstring_format="google", require_parameter_descriptions=True, takes_ctx=True),
@@ -297,6 +300,18 @@ class TinybirdAgent:
297
300
  def add_message(self, message: ModelMessage) -> None:
298
301
  self.messages.append(message)
299
302
 
303
+ def start_plan(self, plan) -> str:
304
+ self.confirmed_plan_id = hashlib.sha256(plan.encode()).hexdigest()[:16]
305
+ return self.confirmed_plan_id
306
+
307
+ def cancel_plan(self) -> Optional[str]:
308
+ plan_id = self.confirmed_plan_id
309
+ self.confirmed_plan_id = None
310
+ return plan_id
311
+
312
+ def get_plan(self) -> Optional[str]:
313
+ return self.confirmed_plan_id
314
+
300
315
  def _build_agent_deps(self, config: dict[str, Any], run_id: Optional[str] = None) -> TinybirdAgentContext:
301
316
  project = self.project
302
317
  folder = self.project.folder
@@ -336,6 +351,9 @@ class TinybirdAgent:
336
351
  local_host=local_client.host,
337
352
  local_token=local_client.token,
338
353
  run_id=run_id,
354
+ get_plan=self.get_plan,
355
+ start_plan=self.start_plan,
356
+ cancel_plan=self.cancel_plan,
339
357
  )
340
358
 
341
359
  def run(self, user_prompt: str, config: dict[str, Any]) -> None:
@@ -389,8 +407,8 @@ class TinybirdAgent:
389
407
  ai_credits_limits = limits_data.get("limits", {}).get("ai_credits", {})
390
408
  current_ai_credits = ai_credits_limits.get("quantity") or 0
391
409
  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)
410
+ remaining_credits = round(max(ai_credits - current_ai_credits, 0), 2)
411
+ current_ai_credits = round(min(ai_credits, current_ai_credits), 2)
394
412
  if not ai_credits:
395
413
  return
396
414
  warning_threshold = ai_credits * 0.8
@@ -569,6 +587,7 @@ def run_agent(
569
587
  ]
570
588
  )
571
589
  )
590
+ agent.cancel_plan()
572
591
  continue
573
592
  except KeyboardInterrupt:
574
593
  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)
@@ -0,0 +1,86 @@
1
+ from typing import Literal
2
+
3
+ import click
4
+ from pydantic_ai import RunContext
5
+
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}")
43
+
44
+
45
+ def plan(ctx: RunContext[TinybirdAgentContext], plan: str) -> str:
46
+ """Given a plan, ask the user for confirmation to implement it
47
+
48
+ Args:
49
+ plan (str): The plan to implement. Required.
50
+
51
+ Returns:
52
+ str: If the plan was implemented or not.
53
+ """
54
+ ctx.deps.thinking_animation.stop()
55
+ plan = plan.strip()
56
+
57
+ click.echo(plan)
58
+ confirmation = show_plan_confirmation(skip_confirmation=ctx.deps.dangerously_skip_permissions)
59
+
60
+ if confirmation == "review":
61
+ feedback = show_input(ctx.deps.workspace_name)
62
+ ctx.deps.thinking_animation.start()
63
+ ctx.deps.cancel_plan()
64
+ return f"User did not confirm the proposed plan and gave the following feedback: {feedback}"
65
+
66
+ ctx.deps.thinking_animation.start()
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"
@@ -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(
@@ -778,10 +781,10 @@ def copy_fixture_to_project_folder_if_needed(
778
781
  if input_path.exists() and not _is_path_inside_project(input_path, project_folder):
779
782
  # Ask for confirmation to copy the file
780
783
  click.echo(FeedbackManager.highlight(message=f"» File {fixture_pathname} is outside the project folder."))
781
-
784
+ active_plan = ctx.deps.get_plan() is not None
782
785
  confirmation = show_confirmation(
783
786
  title=f"Copy {input_path.name} to project folder for analysis?",
784
- skip_confirmation=ctx.deps.dangerously_skip_permissions,
787
+ skip_confirmation=ctx.deps.dangerously_skip_permissions or active_plan,
785
788
  )
786
789
 
787
790
  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.get("status") == "deleted":
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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev287
3
+ Version: 0.0.1.dev288
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird
@@ -1,29 +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
- 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..."