apowerb 0.2.87__tar.gz → 0.2.89__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.
Files changed (468) hide show
  1. {apowerb-0.2.87 → apowerb-0.2.89}/PKG-INFO +1 -1
  2. {apowerb-0.2.87 → apowerb-0.2.89}/pyproject.toml +1 -1
  3. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/agent_utils.py +29 -1
  4. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/callbacks.py +41 -2
  5. apowerb-0.2.89/src/apowerb/core/agent_helpers/chart_from_question_tool.py +83 -0
  6. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/default_llm_usage.py +2 -2
  7. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/llm_model_builder.py +13 -6
  8. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/run_gate.py +2 -1
  9. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/superagents/templates/dashboard.py +3 -0
  10. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/superagents/templates/data.py +16 -16
  11. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/usage_quota.py +38 -1
  12. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/sqlgen/schema_format.py +12 -5
  13. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/bi_datasets.py +4 -1
  14. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/business_intelligence.py +4 -1
  15. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/text_to_sql.py +113 -33
  16. {apowerb-0.2.87 → apowerb-0.2.89}/LICENSE +0 -0
  17. {apowerb-0.2.87 → apowerb-0.2.89}/NOTICE +0 -0
  18. {apowerb-0.2.87 → apowerb-0.2.89}/README.md +0 -0
  19. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/__init__.py +0 -0
  20. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/admin/__init__.py +0 -0
  21. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/admin/guard.py +0 -0
  22. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/admin/migration.py +0 -0
  23. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/admin/permissions.py +0 -0
  24. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/admin/router.py +0 -0
  25. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/agent_store/__init__.py +0 -0
  26. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/agent_store/agent_manager.py +0 -0
  27. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/agent_store/api_key_store.py +0 -0
  28. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/agent_store/hub_manager.py +0 -0
  29. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/agent_store/run_store.py +0 -0
  30. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/agent_store/workflow_store.py +0 -0
  31. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/agent_store/workflow_trigger_seen_file_store.py +0 -0
  32. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/agent_store/workflow_trigger_store.py +0 -0
  33. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/artifacts/__init__.py +0 -0
  34. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/artifacts/agent_uploads.py +0 -0
  35. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/artifacts/file_lookup.py +0 -0
  36. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/artifacts/input_scope.py +0 -0
  37. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/artifacts/languages.py +0 -0
  38. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/artifacts/library.py +0 -0
  39. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/artifacts/s3_artifact_service.py +0 -0
  40. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/artifacts/upload_mirror.py +0 -0
  41. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/auth/__init__.py +0 -0
  42. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/auth/dependencies.py +0 -0
  43. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/auth/exceptions.py +0 -0
  44. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/auth/middleware.py +0 -0
  45. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/auth/router.py +0 -0
  46. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/auth/schemas.py +0 -0
  47. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/auth/service.py +0 -0
  48. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/__init__.py +0 -0
  49. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/chart_refresh_router.py +0 -0
  50. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/charts/__init__.py +0 -0
  51. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/charts/core.py +0 -0
  52. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/charts/router.py +0 -0
  53. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/charts/schemas.py +0 -0
  54. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/charts/service.py +0 -0
  55. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/dashboard_digest.py +0 -0
  56. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/dashboards/__init__.py +0 -0
  57. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/dashboards/access.py +0 -0
  58. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/dashboards/core.py +0 -0
  59. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/dashboards/router.py +0 -0
  60. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/dashboards/schema.py +0 -0
  61. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/dashboards/service.py +0 -0
  62. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/data/__init__.py +0 -0
  63. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/data/_bi_storage.py +0 -0
  64. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/data/agent_executor.py +0 -0
  65. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/data/csv_executor.py +0 -0
  66. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/data/dataset_router.py +0 -0
  67. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/data/db_executor.py +0 -0
  68. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/data/fec_import.py +0 -0
  69. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/data/google_drive_executor.py +0 -0
  70. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/data/onedrive_excel_executor.py +0 -0
  71. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/data/router.py +0 -0
  72. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/data/schema.py +0 -0
  73. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/data/service.py +0 -0
  74. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/data/tabular_import.py +0 -0
  75. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/data/tool_executor.py +0 -0
  76. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/data/upload_router.py +0 -0
  77. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/db_stores.py +0 -0
  78. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/dependencies.py +0 -0
  79. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/forecast_alerts.py +0 -0
  80. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/forecast_dashboard.py +0 -0
  81. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/forecast_snapshot_store.py +0 -0
  82. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/forecast_tracking.py +0 -0
  83. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/refresh_router.py +0 -0
  84. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/__init__.py +0 -0
  85. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/cache.py +0 -0
  86. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/catalog.py +0 -0
  87. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/duck.py +0 -0
  88. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/engine.py +0 -0
  89. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/errors.py +0 -0
  90. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/filters.py +0 -0
  91. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/formatting.py +0 -0
  92. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/frames.py +0 -0
  93. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/lifecycle.py +0 -0
  94. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/models.py +0 -0
  95. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/ops.py +0 -0
  96. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/router.py +0 -0
  97. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/sources.py +0 -0
  98. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/sql_guard.py +0 -0
  99. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/templates.py +0 -0
  100. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/templates_cash.py +0 -0
  101. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/templates_common.py +0 -0
  102. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/templates_construction.py +0 -0
  103. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/templates_ecommerce.py +0 -0
  104. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/templates_finance.py +0 -0
  105. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/templates_forecast.py +0 -0
  106. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/templates_hr.py +0 -0
  107. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/templates_otif.py +0 -0
  108. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/templates_purchasing.py +0 -0
  109. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/templates_quality.py +0 -0
  110. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/templates_receivables.py +0 -0
  111. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/templates_restaurant.py +0 -0
  112. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/templates_sales.py +0 -0
  113. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/templates_services.py +0 -0
  114. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/templates_support.py +0 -0
  115. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/transforms.py +0 -0
  116. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/user_templates.py +0 -0
  117. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/validate.py +0 -0
  118. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/spec/visuals.py +0 -0
  119. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bi/stats_router.py +0 -0
  120. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bug_reports/__init__.py +0 -0
  121. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bug_reports/areas.py +0 -0
  122. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bug_reports/fingerprint.py +0 -0
  123. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bug_reports/issue_body.py +0 -0
  124. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bug_reports/log_buffer.py +0 -0
  125. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bug_reports/redaction.py +0 -0
  126. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bug_reports/screenshot.py +0 -0
  127. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bug_reports/service.py +0 -0
  128. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bug_reports/sinks/__init__.py +0 -0
  129. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bug_reports/sinks/github.py +0 -0
  130. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/bug_reports/tracking.py +0 -0
  131. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/cli/agents.py +0 -0
  132. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/cli/config.py +0 -0
  133. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/cli/main.py +0 -0
  134. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/cli/migrate_integrations.py +0 -0
  135. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/cli/runs.py +0 -0
  136. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/cli/runtime_config.py +0 -0
  137. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/cli/tools.py +0 -0
  138. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/configs/__init__.py +0 -0
  139. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/configs/artifact_service_config.py +0 -0
  140. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/configs/model_pricing.yaml +0 -0
  141. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/configs/models.py +0 -0
  142. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/configs/observability.py +0 -0
  143. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/configs/paths.py +0 -0
  144. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/configs/settings.py +0 -0
  145. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/configs/th2logger.py +0 -0
  146. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/__init__.py +0 -0
  147. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/adk_agent_builder.py +0 -0
  148. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/adk_runner.py +0 -0
  149. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_flow.py +0 -0
  150. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/__init__.py +0 -0
  151. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/anthropic_prompt_cache.py +0 -0
  152. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/callback_chain.py +0 -0
  153. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/chat_action_tools.py +0 -0
  154. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/default_llm.py +0 -0
  155. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/extras_loader.py +0 -0
  156. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/file_readers.py +0 -0
  157. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/gemini_prompt_cache.py +0 -0
  158. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/ingest_file_tool.py +0 -0
  159. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/mcp_loader.py +0 -0
  160. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/pdf_to_images_tool.py +0 -0
  161. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/pdf_writer.py +0 -0
  162. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/read_file_tool.py +0 -0
  163. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/reasoning_strip.py +0 -0
  164. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/run_config_patch.py +0 -0
  165. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/text_utils.py +0 -0
  166. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/tool_catalog.py +0 -0
  167. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/tool_creator.py +0 -0
  168. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/tool_factories.py +0 -0
  169. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/tools_binder.py +0 -0
  170. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_helpers/usage_recorder.py +0 -0
  171. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_main.py +0 -0
  172. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_runtime_sync.py +0 -0
  173. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/agent_seeds.py +0 -0
  174. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/api_key_main.py +0 -0
  175. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/artifact_executor.py +0 -0
  176. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/audio_streaming.py +0 -0
  177. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/config_admin/__init__.py +0 -0
  178. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/config_admin/catalog.py +0 -0
  179. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/config_admin/migration.py +0 -0
  180. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/config_admin/overlay.py +0 -0
  181. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/config_admin/router.py +0 -0
  182. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/config_admin/store.py +0 -0
  183. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/db/__init__.py +0 -0
  184. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/db/write_config.py +0 -0
  185. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/extensions/__init__.py +0 -0
  186. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/extensions/loader.py +0 -0
  187. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/extensions/registry.py +0 -0
  188. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/flow_scheduler.py +0 -0
  189. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/forecast_context.py +0 -0
  190. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/guardrails.py +0 -0
  191. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/history_compaction.py +0 -0
  192. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/hub_main.py +0 -0
  193. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/invocation_context.py +0 -0
  194. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/knowledge_map.py +0 -0
  195. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/provider_errors.py +0 -0
  196. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/rag_streaming.py +0 -0
  197. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/run_main.py +0 -0
  198. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/setup_status.py +0 -0
  199. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/sse_heartbeat.py +0 -0
  200. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/superagents/__init__.py +0 -0
  201. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/superagents/schemas/__init__.py +0 -0
  202. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/superagents/templates/__init__.py +0 -0
  203. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/superagents/templates/audio.py +0 -0
  204. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/superagents/templates/image.py +0 -0
  205. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/superagents/templates/jev.py +0 -0
  206. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/superagents/templates/marketing.py +0 -0
  207. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/superagents/templates/rag.py +0 -0
  208. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/tool_declarations.py +0 -0
  209. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/tool_images.py +0 -0
  210. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/usage_wiring.py +0 -0
  211. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/validation/__init__.py +0 -0
  212. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/validation/prompt_safety.py +0 -0
  213. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/workflow_agent_tools.py +0 -0
  214. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/workflow_attachments.py +0 -0
  215. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/workflow_email_triggers.py +0 -0
  216. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/workflow_engine.py +0 -0
  217. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/workflow_file_triggers.py +0 -0
  218. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/workflow_form_triggers.py +0 -0
  219. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/workflow_graph.py +0 -0
  220. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/workflow_mail_subscriptions.py +0 -0
  221. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/workflow_main.py +0 -0
  222. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/workflow_mcp.py +0 -0
  223. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/workflow_runtime.py +0 -0
  224. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/workflow_suggest.py +0 -0
  225. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/workflow_suggest_stats.py +0 -0
  226. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/core/workflow_triggers.py +0 -0
  227. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/__init__.py +0 -0
  228. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/api_schema.py +0 -0
  229. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/audit_log.py +0 -0
  230. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/bug_report_migration.py +0 -0
  231. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/business_intelligence_migration.py +0 -0
  232. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/core_tables.py +0 -0
  233. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/data_lake.py +0 -0
  234. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/database.py +0 -0
  235. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/database_connection.py +0 -0
  236. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/default_superadmin.py +0 -0
  237. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/email_sender.py +0 -0
  238. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/email_text.py +0 -0
  239. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/emails.py +0 -0
  240. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/encryptor.py +0 -0
  241. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/env_scope.py +0 -0
  242. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/error_responses.py +0 -0
  243. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/google_oidc.py +0 -0
  244. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/integrations_migration.py +0 -0
  245. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/jsonify.py +0 -0
  246. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/litellm_config.py +0 -0
  247. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/llm_usage_migration.py +0 -0
  248. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/metrics.py +0 -0
  249. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/metrics_middleware.py +0 -0
  250. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/model_pricing.py +0 -0
  251. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/notification_bus.py +0 -0
  252. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/notification_migration.py +0 -0
  253. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/notifier_health.py +0 -0
  254. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/notify_etl.py +0 -0
  255. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/oauth_state_store.py +0 -0
  256. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/oauth_states_migration.py +0 -0
  257. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/ownership.py +0 -0
  258. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/pagination.py +0 -0
  259. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/quota_guard.py +0 -0
  260. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/request_id_middleware.py +0 -0
  261. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/safe_paths.py +0 -0
  262. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/security.py +0 -0
  263. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/security_headers.py +0 -0
  264. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/share_migration.py +0 -0
  265. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/store_migrations.py +0 -0
  266. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/sync_engine.py +0 -0
  267. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/system_mailer.py +0 -0
  268. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/tabular_loader.py +0 -0
  269. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/title_generator.py +0 -0
  270. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/user_migration.py +0 -0
  271. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/webhook_log_migration.py +0 -0
  272. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/helpers/webhook_migration.py +0 -0
  273. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/integrations/__init__.py +0 -0
  274. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/integrations/github.py +0 -0
  275. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/integrations/gmail_webhook.py +0 -0
  276. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/integrations/google.py +0 -0
  277. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/integrations/helpers.py +0 -0
  278. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/integrations/jev_client.py +0 -0
  279. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/integrations/microsoft.py +0 -0
  280. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/integrations/odoo.py +0 -0
  281. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/integrations/outlook_webhook.py +0 -0
  282. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/integrations/slack.py +0 -0
  283. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/integrations/teams.py +0 -0
  284. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/integrations/th2forecast_client.py +0 -0
  285. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/main.py +0 -0
  286. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/memory/__init__.py +0 -0
  287. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/memory/retention.py +0 -0
  288. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/memory/service.py +0 -0
  289. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/middleware/__init__.py +0 -0
  290. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/middleware/adk_identity.py +0 -0
  291. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/middleware/auth.py +0 -0
  292. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/models.py +0 -0
  293. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/__init__.py +0 -0
  294. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/adk_runner.py +0 -0
  295. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/agent_memory.py +0 -0
  296. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/agent_reload.py +0 -0
  297. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/agents.py +0 -0
  298. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/api_keys.py +0 -0
  299. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/artifacts.py +0 -0
  300. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/audio_stream.py +0 -0
  301. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/bi_digest.py +0 -0
  302. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/bug_reports.py +0 -0
  303. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/config.py +0 -0
  304. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/data_lake.py +0 -0
  305. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/emailing.py +0 -0
  306. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/files.py +0 -0
  307. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/forecast.py +0 -0
  308. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/google_drive_browser.py +0 -0
  309. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/health.py +0 -0
  310. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/hooks.py +0 -0
  311. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/hub.py +0 -0
  312. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/integrations.py +0 -0
  313. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/models.py +0 -0
  314. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/notifications.py +0 -0
  315. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/onedrive_browser.py +0 -0
  316. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/rag/__init__.py +0 -0
  317. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/rag/index_db.py +0 -0
  318. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/rag/index_files.py +0 -0
  319. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/rag/index_s3.py +0 -0
  320. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/rag/index_url.py +0 -0
  321. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/rag/schemas.py +0 -0
  322. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/rag/status.py +0 -0
  323. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/rag/stream.py +0 -0
  324. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/rag/validators.py +0 -0
  325. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/rag/webhook.py +0 -0
  326. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/runs.py +0 -0
  327. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/scheduler.py +0 -0
  328. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/share.py +0 -0
  329. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/skills.py +0 -0
  330. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/superagents.py +0 -0
  331. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/tools.py +0 -0
  332. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/webhook_handlers/__init__.py +0 -0
  333. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/webhook_handlers/_common.py +0 -0
  334. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/webhook_handlers/gmail.py +0 -0
  335. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/webhook_handlers/outlook.py +0 -0
  336. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/webhooks.py +0 -0
  337. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/workflow_defs.py +0 -0
  338. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/workflow_triggers.py +0 -0
  339. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/routers/workflows.py +0 -0
  340. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/scheduler/backlog_migrations.py +0 -0
  341. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/scheduler/backlog_status_tool.py +0 -0
  342. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/scheduler/backlog_worker.py +0 -0
  343. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/scheduler/bi_digest.py +0 -0
  344. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/scheduler/events_retention.py +0 -0
  345. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/scheduler/mage.py +0 -0
  346. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/scheduler/notifier_watch.py +0 -0
  347. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/scheduler/outage.py +0 -0
  348. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/scheduler/run_agent_background/__init__.py +0 -0
  349. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/scheduler/run_agent_background/agent_runner.py +0 -0
  350. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/scheduler/run_agent_background/schedule_helpers.py +0 -0
  351. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/scheduler/run_agent_background/scheduler_api.py +0 -0
  352. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/scheduler/run_agent_background/token_issuer.py +0 -0
  353. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/scheduler/th2etl_client.py +0 -0
  354. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/scheduler/webhook_renewal.py +0 -0
  355. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/schema/__init__.py +0 -0
  356. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/schema/adk_runner_schema.py +0 -0
  357. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/schema/agent_schema.py +0 -0
  358. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/schema/api_key_schema.py +0 -0
  359. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/schema/bug_report_schema.py +0 -0
  360. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/schema/data_lake_schema.py +0 -0
  361. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/schema/forecast_schema.py +0 -0
  362. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/schema/hub_schema.py +0 -0
  363. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/schema/notification_schema.py +0 -0
  364. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/schema/share_schema.py +0 -0
  365. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/schema/skill_schema.py +0 -0
  366. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/schema/tool_config_schema.py +0 -0
  367. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/schema/usage_schema.py +0 -0
  368. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/schema/webhook_schema.py +0 -0
  369. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/skills_store/__init__.py +0 -0
  370. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/skills_store/portfolio/dashboard-builder/SKILL.md +0 -0
  371. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/skills_store/portfolio/data-visualization/SKILL.md +0 -0
  372. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/skills_store/portfolio/data-visualization/references/chart-guide.md +0 -0
  373. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/skills_store/portfolio/email-campaign/SKILL.md +0 -0
  374. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/skills_store/portfolio/email-campaign/references/templates_en.md +0 -0
  375. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/skills_store/portfolio/email-campaign/references/templates_fr.md +0 -0
  376. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/skills_store/portfolio/error-recovery/SKILL.md +0 -0
  377. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/skills_store/portfolio/error-recovery/references/common-errors.md +0 -0
  378. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/skills_store/portfolio/forecasting/SKILL.md +0 -0
  379. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/skills_store/portfolio/onedrive-navigation/SKILL.md +0 -0
  380. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/skills_store/portfolio/onedrive-navigation/references/path-patterns.md +0 -0
  381. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/skills_store/portfolio/rag-search/SKILL.md +0 -0
  382. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/skills_store/portfolio/rag-search/references/rag-workflow.md +0 -0
  383. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/skills_store/portfolio/report-generation/SKILL.md +0 -0
  384. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/skills_store/portfolio/text-to-sql/SKILL.md +0 -0
  385. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/skills_store/portfolio/text-to-sql/references/sql-patterns.md +0 -0
  386. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/skills_store/skill_manager.py +0 -0
  387. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/skills_store/skills_loader.py +0 -0
  388. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/sqlgen/__init__.py +0 -0
  389. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/sqlgen/analyst.py +0 -0
  390. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/sqlgen/analyst_prompts.py +0 -0
  391. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/sqlgen/generator.py +0 -0
  392. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/sqlgen/readonly.py +0 -0
  393. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/sqlgen/safety.py +0 -0
  394. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/sqlgen/table_selection.py +0 -0
  395. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/storage/__init__.py +0 -0
  396. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/storage/filename.py +0 -0
  397. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/storage/s3.py +0 -0
  398. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/storage/storage_service.py +0 -0
  399. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/storage/test.py +0 -0
  400. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/storage/test.txt +0 -0
  401. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/storage/webhook_attachments.py +0 -0
  402. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/__init__.py +0 -0
  403. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/bi_source.py +0 -0
  404. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/api_call.py +0 -0
  405. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/artifacts/__init__.py +0 -0
  406. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/artifacts/save_code_artifact.py +0 -0
  407. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/audio.py +0 -0
  408. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/basic.py +0 -0
  409. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/bi_dashboard_tools.py +0 -0
  410. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/bigquery.py +0 -0
  411. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/data_handler.py +0 -0
  412. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/database.py +0 -0
  413. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/database_mcp.py +0 -0
  414. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/databricks.py +0 -0
  415. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/datadog.py +0 -0
  416. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/db_to_rag.py +0 -0
  417. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/dynamics365.py +0 -0
  418. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/github.py +0 -0
  419. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/google_auth.py +0 -0
  420. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/google_calendar.py +0 -0
  421. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/google_docs.py +0 -0
  422. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/google_drive.py +0 -0
  423. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/google_gmail.py +0 -0
  424. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/google_sheets.py +0 -0
  425. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/http_errors.py +0 -0
  426. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/hubspot.py +0 -0
  427. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/image_generation.py +0 -0
  428. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/integration_status.py +0 -0
  429. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/internal/data_handler.py +0 -0
  430. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/jev.py +0 -0
  431. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/marketing.py +0 -0
  432. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/memory.py +0 -0
  433. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/microsoft_auth.py +0 -0
  434. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/mongodb.py +0 -0
  435. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/notion.py +0 -0
  436. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/ocr.py +0 -0
  437. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/odoo.py +0 -0
  438. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/onedrive_core.py +0 -0
  439. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/onedrive_read.py +0 -0
  440. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/onedrive_write.py +0 -0
  441. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/oracle.py +0 -0
  442. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/outlook_mail.py +0 -0
  443. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/pipedrive.py +0 -0
  444. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/python_script.py +0 -0
  445. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/rag.py +0 -0
  446. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/redshift.py +0 -0
  447. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/s3_tools.py +0 -0
  448. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/salesforce.py +0 -0
  449. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/sharepoint.py +0 -0
  450. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/snowflake.py +0 -0
  451. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/tabpfn.py +0 -0
  452. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/teams.py +0 -0
  453. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/thaink2.py +0 -0
  454. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/visualization.py +0 -0
  455. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/warehouse_core.py +0 -0
  456. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/portfolio/web_search_mcp.py +0 -0
  457. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/schema/__init__.py +0 -0
  458. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/schema/basic.py +0 -0
  459. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/schema/text_to_sql.py +0 -0
  460. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/tool_config.py +0 -0
  461. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/tool_env.py +0 -0
  462. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/tool_manager.py +0 -0
  463. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/tools_store/tools_helpers.py +0 -0
  464. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/users/dependencies.py +0 -0
  465. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/users/exceptions.py +0 -0
  466. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/users/router.py +0 -0
  467. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/users/schemas.py +0 -0
  468. {apowerb-0.2.87 → apowerb-0.2.89}/src/apowerb/users/service.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apowerb
3
- Version: 0.2.87
3
+ Version: 0.2.89
4
4
  Summary: Agentic framework for building and deploying AI agents with flexible orchestration, custom tool integration, RAG, Text-to-SQL, webhooks, and scheduled runs.
5
5
  Keywords: agents,adk,llm,rag,text-to-sql,fastapi,postgresql,orchestration,multi-agent,llmops,mcp,self-hosted,helm,business-intelligence
6
6
  Author: Farid Azouaou
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "apowerb"
3
- version = "0.2.87"
3
+ version = "0.2.89"
4
4
  description = "Agentic framework for building and deploying AI agents with flexible orchestration, custom tool integration, RAG, Text-to-SQL, webhooks, and scheduled runs."
5
5
  readme = "README.md"
6
6
  authors = [
@@ -34,6 +34,7 @@ from apowerb.core.agent_helpers.mcp_loader import (
34
34
  build_mcp_instruction_preamble,
35
35
  load_mcp_servers,
36
36
  )
37
+ from apowerb.core.agent_helpers.chart_from_question_tool import bind_chart_from_question
37
38
  from apowerb.core.agent_helpers.llm_model_builder import (
38
39
  build_litellm_model,
39
40
  apply_output_schema,
@@ -112,6 +113,19 @@ def _suppressed_auto_tools(superagent_template_id) -> frozenset:
112
113
  return frozenset(_template_setting(superagent_template_id, "suppressed_auto_tools", ()) or ())
113
114
 
114
115
 
116
+ def _guardrails_block(agent_details: dict, tool_names) -> bool:
117
+ """True when the agent's guardrails ``blocked_tools`` names one of ``tool_names``."""
118
+ raw = agent_details.get("guardrails_config")
119
+ if not raw or raw in ("null", "None"):
120
+ return False
121
+ try:
122
+ config = json.loads(raw) if isinstance(raw, str) else raw
123
+ blocked = {str(t).strip().lower() for t in (config or {}).get("blocked_tools", [])}
124
+ except (ValueError, AttributeError, TypeError):
125
+ return False
126
+ return any(name.lower() in blocked for name in tool_names)
127
+
128
+
115
129
  def _template_setting(superagent_template_id, key: str, default):
116
130
  """A runtime setting of the agent's SuperAgent template, ``default`` without one."""
117
131
  if not superagent_template_id:
@@ -643,6 +657,15 @@ def to_agent(agent_name: str) -> LlmAgent:
643
657
  for _tool_name, _rebinder in _ext_registry.tool_rebinders().items():
644
658
  tools_funcs = _rebinder(agent_name, tools_ids, tools_funcs, owner_id)
645
659
 
660
+ # Query + saved chart in one call, for templates that opt in. After
661
+ # every rebind, so it wraps the agent's final tools; never when the
662
+ # guardrails block one of the two (the composite would bypass them).
663
+ tools_funcs = bind_chart_from_question(
664
+ agent_name, tools_funcs,
665
+ _template_setting(superagent_template_id, "chart_from_question", False)
666
+ and not _guardrails_block(agent_details, ("tool_text_to_sql", "tool_create_chart")),
667
+ )
668
+
646
669
  # Auto-add shared runtime tools. Vertex AI / Gemini rejects duplicate
647
670
  # function declarations, so we dedup by function __name__ against any
648
671
  # tool that was already loaded from the agent's own config.
@@ -784,7 +807,12 @@ def to_agent(agent_name: str) -> LlmAgent:
784
807
  # Levier 1 : troncature historique (adapte au contexte 32k OVHcloud)
785
808
  # Chaine AVANT le strip-images : la troncature reduit le nombre de
786
809
  # messages, le strip nettoie ensuite les base64 dans les messages restants.
787
- truncate_cb = create_truncate_history_callback(keep_recent=14)
810
+ truncate_cb = create_truncate_history_callback(
811
+ keep_recent=14,
812
+ keep_text_chars=int(
813
+ _template_setting(superagent_template_id, "keep_truncated_turn_text_chars", 0) or 0
814
+ ),
815
+ )
788
816
  if before_model_cb:
789
817
  _existing_for_truncate = before_model_cb
790
818
 
@@ -578,9 +578,42 @@ def _content_has_function_response(content) -> bool:
578
578
  return any(getattr(p, "function_response", None) is not None for p in parts)
579
579
 
580
580
 
581
- def create_truncate_history_callback(keep_recent: int = 14):
581
+ def _text_only(content) -> bool:
582
+ """True when every part of *content* is plain text (no tool call/result,
583
+ no model thought)."""
584
+ parts = getattr(content, "parts", None) or []
585
+ return bool(parts) and all(
586
+ getattr(p, "text", None)
587
+ and not getattr(p, "thought", False)
588
+ and getattr(p, "function_call", None) is None
589
+ and getattr(p, "function_response", None) is None
590
+ for p in parts
591
+ )
592
+
593
+
594
+ def _recent_texts(dropped: list, budget: int) -> list:
595
+ """The newest text-only contents of *dropped* within *budget* chars, in order."""
596
+ kept, used = [], 0
597
+ for content in reversed(dropped):
598
+ if not _text_only(content):
599
+ continue
600
+ size = sum(len(p.text) for p in content.parts)
601
+ if used + size > budget:
602
+ break
603
+ kept.append(content)
604
+ used += size
605
+ return list(reversed(kept))
606
+
607
+
608
+ def create_truncate_history_callback(keep_recent: int = 14, keep_text_chars: int = 0):
582
609
  """Retourne un before_model_callback qui tronque l'historique ADK.
583
610
 
611
+ ``keep_text_chars`` > 0 : les messages texte seuls (questions, reponses du
612
+ modele) que la fenetre fait sortir reviennent devant elle, les plus
613
+ recents d'abord dans la limite de ce nombre de caracteres, sans leurs
614
+ appels ni resultats d'outils. La fenetre compte les messages d'outils :
615
+ quelques tours charges en outils en font sortir les reponses precedentes.
616
+
584
617
  Conserve : le 1er message user (payload webhook initial) + les
585
618
  ``keep_recent`` derniers messages, en eliminant les tool_responses
586
619
  orphelins en tete de fenetre (evite l'erreur 400 OVH quand un
@@ -651,7 +684,13 @@ def create_truncate_history_callback(keep_recent: int = 14):
651
684
  if user_initial_idx >= total - keep_recent:
652
685
  result = window
653
686
  else:
654
- result = [user_initial] + window
687
+ texts = []
688
+ if keep_text_chars > 0:
689
+ window_start = total - len(window)
690
+ texts = _recent_texts(
691
+ list(contents[user_initial_idx + 1:window_start]), keep_text_chars
692
+ )
693
+ result = [user_initial] + texts + window
655
694
 
656
695
  _logger.info(
657
696
  "[TRUNCATE_HISTORY] truncated %d -> %d messages (keep_recent=%d)",
@@ -0,0 +1,83 @@
1
+ """``tool_chart_from_question``: a data question answered AND saved as a chart.
2
+
3
+ An inline chart took three tool calls in a row -- ``tool_text_to_sql``,
4
+ ``tool_create_chart(query=<its sql_query>)``, then ``embed_chart`` -- and each
5
+ one is a full model call that re-sends the instruction and every tool
6
+ declaration. This composite runs the first two in one call, with the agent's
7
+ own bound tools, so the agent goes straight to ``embed_chart``.
8
+
9
+ Opt-in per SuperAgent template (``chart_from_question``), and only when the
10
+ agent has both tools: the separate tools stay for every other path.
11
+ """
12
+ from __future__ import annotations
13
+
14
+ import inspect
15
+ import re
16
+ import unicodedata
17
+
18
+ from apowerb.configs.th2logger import setup_logging
19
+
20
+ logger = setup_logging(__name__)
21
+
22
+
23
+ def _chart_name(title: str) -> str:
24
+ ascii_title = unicodedata.normalize("NFKD", title or "").encode("ascii", "ignore").decode()
25
+ slug = re.sub(r"[^a-z0-9]+", "-", ascii_title.lower()).strip("-")
26
+ return slug[:60] or "chart"
27
+
28
+
29
+ def _make_chart_from_question(text_to_sql, create_chart):
30
+ # The agent-bound tool_text_to_sql records its SQL generator's usage
31
+ # against the session through tool_context; the unbound one has no such
32
+ # parameter.
33
+ pass_context = "tool_context" in inspect.signature(text_to_sql).parameters
34
+
35
+ def tool_chart_from_question(
36
+ question: str, chart_type: str, title: str, tool_context=None
37
+ ) -> dict:
38
+ """Answers a data question AND saves the result as a chart, in one call.
39
+
40
+ Same query as tool_text_to_sql, saved like tool_create_chart. Next step:
41
+ embed_chart(chart_id) to show it, then describe the data in words.
42
+
43
+ Args:
44
+ question: The data question in natural language (what to plot).
45
+ chart_type: bar, line, pie, donut, scatter, area, stat, table or histogram.
46
+ title: Describes the content (e.g. "Parcels by department").
47
+
48
+ Returns:
49
+ dict with chart_id, sql_query, row_count and data (the plotted rows);
50
+ on failure success is false with the error, and no chart is saved.
51
+ """
52
+ extra = {"tool_context": tool_context} if pass_context else {}
53
+ result = text_to_sql(question=question, include_sql=True, **extra)
54
+ if not result.get("success"):
55
+ return result
56
+ chart = create_chart(
57
+ name=_chart_name(title), title=title, chart_type=chart_type,
58
+ query=result["sql_query"],
59
+ )
60
+ if not chart.get("success"):
61
+ return {**result, "success": False,
62
+ "error": f"Query ran but the chart was not saved: {chart.get('error')}"}
63
+ return {
64
+ **result,
65
+ "chart_id": chart["chart_id"],
66
+ "title": chart.get("title", title),
67
+ "chart_type": chart.get("chart_type", chart_type),
68
+ "message": "Chart saved. Call embed_chart(chart_id) to show it, then describe the data in words.",
69
+ }
70
+
71
+ return tool_chart_from_question
72
+
73
+
74
+ def bind_chart_from_question(agent_name: str, tools_funcs: list, enabled: bool) -> list:
75
+ """Add ``tool_chart_from_question`` when enabled and both building blocks are bound."""
76
+ if not enabled:
77
+ return tools_funcs
78
+ by_name = {getattr(f, "__name__", ""): f for f in tools_funcs}
79
+ text_to_sql, create_chart = by_name.get("tool_text_to_sql"), by_name.get("tool_create_chart")
80
+ if not (text_to_sql and create_chart) or "tool_chart_from_question" in by_name:
81
+ return tools_funcs
82
+ logger.info("[TO_AGENT] tool_chart_from_question added for %s", agent_name)
83
+ return [*tools_funcs, _make_chart_from_question(text_to_sql, create_chart)]
@@ -107,10 +107,10 @@ async def used_tokens_this_month(
107
107
  """
108
108
  from sqlalchemy import func, select
109
109
 
110
- from apowerb.core.usage_quota import usage_counted_since
110
+ from apowerb.core.usage_quota import counted_tokens_sum, usage_counted_since
111
111
  from apowerb.models import LlmUsage
112
112
 
113
- stmt = select(func.coalesce(func.sum(LlmUsage.total_tokens), 0)).where(
113
+ stmt = select(counted_tokens_sum()).where(
114
114
  LlmUsage.owner_id == owner_id,
115
115
  LlmUsage.billed_to_thaink2.is_(True),
116
116
  LlmUsage.created_at
@@ -23,6 +23,18 @@ from apowerb.helpers.encryptor import decrypt_value_in_dict
23
23
  logger = setup_logging(__name__)
24
24
 
25
25
 
26
+ def openai_compat_model_name(model: str) -> str:
27
+ """Model name to call litellm with on a custom OpenAI-compat api_base.
28
+
29
+ Forces the openai/ provider prefix so litellm uses the OpenAI tool-calling
30
+ path instead of the provider SDK path (Mistral SDK, Azure deployment route).
31
+ Azure AI Foundry has its own LiteLLM provider and keeps its prefix.
32
+ """
33
+ if model.startswith(("openai/", "azure_ai/")):
34
+ return model
35
+ return "openai/" + model.split("/", 1)[-1]
36
+
37
+
26
38
  def build_litellm_model(agent_details: dict, temperature: float | None) -> LiteLlm:
27
39
  """Construct a ``LiteLlm`` instance from the agent's model config.
28
40
 
@@ -74,12 +86,7 @@ def build_litellm_model(agent_details: dict, temperature: float | None) -> LiteL
74
86
  )
75
87
 
76
88
  if model_api_base:
77
- _model_name = agent_details["agent_model"]
78
- # When using a custom OpenAI-compat api_base, force the openai/ provider prefix
79
- # so litellm uses the OpenAI tool-calling path instead of the Mistral SDK path.
80
- # Azure AI Foundry has its own LiteLLM provider and must keep its prefix.
81
- if not _model_name.startswith(("openai/", "azure_ai/")):
82
- _model_name = "openai/" + _model_name.split("/", 1)[-1]
89
+ _model_name = openai_compat_model_name(agent_details["agent_model"])
83
90
  _endpoint_kwargs = {
84
91
  "api_base": model_api_base,
85
92
  "api_key": model_api_key,
@@ -146,6 +146,7 @@ async def _core_token_cap(*, agent_name: str, owner_id: str) -> None:
146
146
  try:
147
147
  from sqlalchemy import func, select
148
148
 
149
+ from apowerb.core.usage_quota import counted_tokens_sum
149
150
  from apowerb.helpers.database import sessionmanager
150
151
  from apowerb.models import LlmUsage
151
152
 
@@ -161,7 +162,7 @@ async def _core_token_cap(*, agent_name: str, owner_id: str) -> None:
161
162
  row = (
162
163
  await db.execute(
163
164
  select(
164
- func.coalesce(func.sum(LlmUsage.total_tokens), 0),
165
+ counted_tokens_sum(),
165
166
  func.min(LlmUsage.created_at),
166
167
  ).where(*conditions, *extra)
167
168
  )
@@ -199,6 +199,9 @@ DASHBOARD_TEMPLATES = [
199
199
  "tabular_file_preview_rows": 20,
200
200
  # historique : gros résultats d'outils des tours précédents raccourcis
201
201
  "compact_previous_turn_results": True,
202
+ # truncation: the answers of turns pushed out of the 14-message
203
+ # window come back as text (no tool payloads), within this budget
204
+ "keep_truncated_turn_text_chars": 6000,
202
205
  "memory_enabled": True,
203
206
  "artifacts_enabled": True,
204
207
  "guardrails_config": None,
@@ -26,26 +26,26 @@ DATA_TEMPLATES = [
26
26
  - tool_run_sql — only when the user supplies raw SQL.
27
27
  - tool_get_database_schema — to explore tables/columns, or to get correct names before retrying a failed query.
28
28
  - tool_text_to_sql_explain — when asked to "explain" a query.
29
- - tool_create_chart(query=<sql_query>, chart_type, name, title) — persist a chart; `title` DESCRIBES THE CONTENT (e.g. "Colis par département"); returns chart_id (UUID).
29
+ - tool_chart_from_question(question, chart_type, title) — for a chart of data NOT queried yet: runs the query AND saves the chart in one call; `title` DESCRIBES THE CONTENT (e.g. "Colis par département"); returns chart_id (UUID) and the plotted rows.
30
+ - tool_create_chart(query=<sql_query>, chart_type, name, title) — persist a chart from a `sql_query` a tool already returned; returns chart_id (UUID).
30
31
  - embed_chart(chart_id) — render a chart INLINE. Does NOT add it to any dashboard.
31
32
  - tool_visualize_data(query=<sql_query>, chart_type, filename) — a DOWNLOADABLE chart FILE; returns a link. Use for "in HTML / downloadable / export the chart". `query` MUST be the `sql_query` a tool returned, never hand-typed SQL.
32
33
  - tool_create_dashboard(title) → dashboard_id. tool_list_dashboards() → existing boards (id+title). tool_add_chart_to_dashboard(dashboard_id, chart_id). tool_add_kpi_to_dashboard(dashboard_id, label, value, unit). tool_send_chart_to_dashboard(chart_id) — quick path to the default chat dashboard.
33
34
  - tool_update_chart(chart_id, title, chart_type, query) — modify an existing chart's title/type/query. tool_remove_chart_from_dashboard(chart_id, dashboard_id) — take a chart OFF a dashboard (detaches the widget, KEEPS the chart). In a dashboard's own chat, dashboard_id defaults to that dashboard.
34
- - tool_bi_list_dashboard_templates / tool_bi_create_dashboard_from_template — ready-made dashboards (delivery OTIF, production quality...) on a dataset: list the templates, map their columns, create in one call. Pass language ("fr" or "en") in the language of the conversation, also to tool_bi_create_stock_dashboard.
35
- - tool_bi_create_dashboard / tool_bi_create_stock_dashboard — build a dashboard with global filters and KPIs with thresholds on a DATASET (find it with tool_list_datasets / tool_describe_dataset; for a file attached to the chat, call tool_bi_import_attachment(filename) first and pass the dataset_id it returns). To modify it: tool_bi_describe_dashboard then tool_bi_patch_dashboard; to read its numbers: tool_bi_query_dashboard.
35
+ - Dashboards with global filters, ready-made BI templates (OTIF, stock...) or built from an attached file are the BI Assistant agent's job: say so and suggest it.
36
36
  - create_downloadable_file — export DATA (e.g. CSV). Never use it to hand-write HTML or fake a chart.
37
37
  - tool_send_outlook_email(to, subject, body, attachments=<exact /api/files path>) — Outlook only.
38
38
 
39
39
  ## Workflows
40
40
  - Data question: tool_text_to_sql → markdown table + plain-language summary. Show the SQL only if explicitly asked.
41
- - Inline chart (default for "make a chart"): tool_text_to_sql → tool_create_chart(query=<sql_query>, …) → embed_chart(<that exact chart_id>) → describe it in words. Do all three every time, even if a similar chart exists — never reply it was "already created".
41
+ - Inline chart (ONLY when the user asks for a chart): data not queried yet → tool_chart_from_question(question, chart_type, title); data you just got from tool_text_to_sql → tool_create_chart(query=<that sql_query>, …). Then embed_chart(<that exact chart_id>) → describe it in words. Do it every time, even if a similar chart exists — never reply it was "already created".
42
42
  - Send a chart/KPI to a dashboard (ONLY when asked): let the user choose NEW or EXISTING; if unspecified, ASK. NEW → tool_create_dashboard(title) then add; if the title exists, say so and ask for another. EXISTING → tool_list_dashboards(), use the EXACT id the user picks (never invent one). KPI → get the number with tool_text_to_sql, resolve the board the SAME way (NEW via tool_create_dashboard or EXISTING via tool_list_dashboards with the exact id), then tool_add_kpi_to_dashboard(dashboard_id, label, value, unit). Confirm with the board's name. If the user just says "add to dashboard" without naming one, use tool_send_chart_to_dashboard. Never add to a dashboard on your own.
43
43
  - Modify or remove a chart (ONLY when asked): change a chart's title/type/query with tool_update_chart; take a chart off a dashboard with tool_remove_chart_from_dashboard — this detaches the widget, it does NOT delete the chart. In a dashboard's own chat both default to that dashboard.
44
44
  - Downloadable chart: tool_visualize_data → give the returned link. Never invent the link. CSV: tool_text_to_sql → create_downloadable_file.
45
45
  - Email (ONLY when explicitly asked — never on your own, and never to round off a task you weren't asked to): make the file (tool_visualize_data / create_downloadable_file), then tool_send_outlook_email with attachments=<exact /api/files path>. If Outlook isn't connected the tool returns a connect prompt — relay it, don't retry.
46
46
 
47
47
  ## Errors
48
- tool_text_to_sql fails → show the exact error, call tool_get_database_schema, retry; after 2 retries show the real error (never "try again later" alone). Chart/tool fails → report the exact error. Empty result → "No data found for this query."
48
+ tool_text_to_sql / tool_chart_from_question already repair a query the database rejects once on their own; if one still fails, call tool_get_database_schema and retry once with the right names, then show the real error (never "try again later" alone). Chart/tool fails → report the exact error. Empty result → "No data found for this query."
49
49
 
50
50
  ## Hard rules
51
51
  - Never fabricate data, charts, files, links, dashboard ids, or rows — return only what tools produce.
@@ -82,17 +82,9 @@ tool_text_to_sql fails → show the exact error, call tool_get_database_schema,
82
82
  # chart off a dashboard (detach the widget; the chart is kept).
83
83
  "business_intelligence.tool_update_chart",
84
84
  "business_intelligence.tool_remove_chart_from_dashboard",
85
- # spec dashboards (filters, KPIs with thresholds) built on a dataset.
86
- "bi_datasets.tool_list_datasets",
87
- "bi_datasets.tool_describe_dataset",
88
- "bi_dashboard_tools.tool_bi_import_attachment",
89
- "bi_dashboard_tools.tool_bi_create_dashboard",
90
- "bi_dashboard_tools.tool_bi_create_stock_dashboard",
91
- "bi_dashboard_tools.tool_bi_list_dashboard_templates",
92
- "bi_dashboard_tools.tool_bi_create_dashboard_from_template",
93
- "bi_dashboard_tools.tool_bi_patch_dashboard",
94
- "bi_dashboard_tools.tool_bi_query_dashboard",
95
- "bi_dashboard_tools.tool_bi_describe_dashboard",
85
+ # one dashboard family only: the chart-based tools above. The spec
86
+ # dashboards (tool_bi_*, datasets) live in the BI templates; here
87
+ # they cost 4,239 tokens on every model call (Data Analyst bench).
96
88
  # visualization: produces a DOWNLOADABLE Plotly HTML chart file
97
89
  # (for "chart in HTML / downloadable" requests; NOT inline).
98
90
  "visualization.tool_visualize_data",
@@ -111,6 +103,11 @@ tool_text_to_sql fails → show the exact error, call tool_get_database_schema,
111
103
  "suppressed_auto_tools": BI_SUPPRESSED_AUTO_TOOLS,
112
104
  # historique : gros résultats d'outils des tours précédents raccourcis
113
105
  "compact_previous_turn_results": True,
106
+ # requête + graphique enregistré en un seul appel d'outil
107
+ "chart_from_question": True,
108
+ # truncation: the answers of turns pushed out of the 14-message
109
+ # window come back as text (no tool payloads), within this budget
110
+ "keep_truncated_turn_text_chars": 6000,
114
111
  "tags": ["sql", "database", "text-to-sql", "analytics", "data"],
115
112
  "readme": (
116
113
  "# Data Analyst\n\n"
@@ -349,6 +346,9 @@ tool_text_to_sql fails → show the exact error, call tool_get_database_schema,
349
346
  "tabular_file_preview_rows": 20,
350
347
  # historique : gros résultats d'outils des tours précédents raccourcis
351
348
  "compact_previous_turn_results": True,
349
+ # truncation: the answers of turns pushed out of the 14-message
350
+ # window come back as text (no tool payloads), within this budget
351
+ "keep_truncated_turn_text_chars": 6000,
352
352
  "memory_enabled": False,
353
353
  "artifacts_enabled": True,
354
354
  "guardrails_config": None,
@@ -24,6 +24,7 @@ from __future__ import annotations
24
24
 
25
25
  from dataclasses import dataclass
26
26
  from datetime import datetime, timezone
27
+ import os
27
28
  from logging import getLogger
28
29
  from typing import Optional
29
30
  from zoneinfo import ZoneInfo
@@ -34,6 +35,42 @@ logger = getLogger(__name__)
34
35
 
35
36
  BILLING_TZ = ZoneInfo("Europe/Paris")
36
37
 
38
+ # Cached input tokens. Every provider we run bills a cache read 75 to 90 %
39
+ # below fresh input (OpenAI/Azure, Anthropic, Gemini), and an agent re-sends
40
+ # the same instruction + tool declarations on every call of a turn: counted in
41
+ # full, that cached prefix ate the quota as if it were new input. They now
42
+ # count at CACHED_TOKEN_PERCENT of a token -- 25 by default, the dearest
43
+ # provider rate, so the quota never counts less than what thaink2 pays.
44
+ CACHED_TOKEN_PERCENT_ENV = "APOWERB_QUOTA_CACHED_TOKEN_PERCENT"
45
+ DEFAULT_CACHED_TOKEN_PERCENT = 25
46
+
47
+
48
+ def cached_token_percent() -> int:
49
+ """Weight of a cached input token in the quota, 0-100 (25 if unset or invalid)."""
50
+ try:
51
+ value = int(os.environ.get(CACHED_TOKEN_PERCENT_ENV, "").strip())
52
+ except ValueError:
53
+ return DEFAULT_CACHED_TOKEN_PERCENT
54
+ return min(100, max(0, value))
55
+
56
+
57
+ def counted_tokens_sum():
58
+ """SQL aggregate of the tokens a quota counts over ``llm_usage`` rows.
59
+
60
+ ``cached_tokens`` is a subset of ``total_tokens``; only its weighted part
61
+ stays counted. One expression for every counter (gauge, monthly guard,
62
+ rolling cap), so they keep showing the same number.
63
+ """
64
+ from sqlalchemy import func
65
+
66
+ from apowerb.models import LlmUsage
67
+
68
+ discount = 100 - cached_token_percent()
69
+ total = func.coalesce(func.sum(LlmUsage.total_tokens), 0)
70
+ cached = func.coalesce(func.sum(LlmUsage.cached_tokens), 0)
71
+ return total - (cached * discount) // 100
72
+
73
+
37
74
  # Quota top-up providers. The billing extension registers one (purchased
38
75
  # credits become tokens); without it the list stays empty and the quota is
39
76
  # the plan's alone.
@@ -211,7 +248,7 @@ async def get_quota_status(db, owner_id: str, plan: Optional[str]) -> QuotaStatu
211
248
  from apowerb.models import LlmUsage
212
249
 
213
250
  now = datetime.now(timezone.utc)
214
- stmt = select(func.coalesce(func.sum(LlmUsage.total_tokens), 0)).where(
251
+ stmt = select(counted_tokens_sum()).where(
215
252
  LlmUsage.owner_id == owner_id,
216
253
  LlmUsage.billed_to_thaink2.is_(True),
217
254
  LlmUsage.created_at
@@ -61,10 +61,11 @@ def build_schema_prompt(
61
61
  ) -> str:
62
62
  """Render a compact schema description, capped at ``max_chars``.
63
63
 
64
- Tables are ordered by relevance to ``question`` then added greedily until
65
- the budget is hit; the rest are listed by name only so the model can ask
66
- for their columns via tool_get_database_schema. The single most relevant
67
- table is always included even if it alone exceeds the budget.
64
+ Tables are ranked by relevance to ``question`` then added greedily until
65
+ the budget is hit, and written in name order; the rest are listed by name
66
+ only so the model can ask for their columns via tool_get_database_schema.
67
+ The single most relevant table is always included even if it alone
68
+ exceeds the budget.
68
69
  """
69
70
  tables = schema_info.get("tables", {})
70
71
  db_schema = schema_info.get("schema", "public")
@@ -85,8 +86,14 @@ def build_schema_prompt(
85
86
  selected.append(name)
86
87
  used += cost
87
88
 
89
+ # Selection follows relevance; the rendering does not. Written in name
90
+ # order, the schema is the same text for every question that selects the
91
+ # same tables -- all of them, when the budget fits the database -- so the
92
+ # system prompt + schema prefix of the request is identical from one
93
+ # question to the next and provider prompt caches (OpenAI/Azure automatic
94
+ # prefix cache, Gemini implicit cache) can reuse it.
88
95
  lines = [header]
89
- for name in selected:
96
+ for name in sorted(selected):
90
97
  lines.append(_render_table(name, tables[name], include_samples, sample_rows))
91
98
  if omitted:
92
99
  lines.append("")
@@ -9,6 +9,7 @@ couplage inter-modules (même choix que ``dataset_router._resolve_path_from_id``
9
9
  from __future__ import annotations
10
10
 
11
11
  import asyncio
12
+ import contextvars
12
13
  import contextlib
13
14
  import csv
14
15
  import hashlib
@@ -63,7 +64,9 @@ def _run_async(coro):
63
64
  except Exception as e:
64
65
  exception = e
65
66
 
66
- t = threading.Thread(target=_run)
67
+ # A new thread starts with an empty context: run in a copy of ours so
68
+ # the coroutine sees the invocation's agent identity (ContextVars).
69
+ t = threading.Thread(target=contextvars.copy_context().run, args=(_run,))
67
70
  t.start()
68
71
  t.join(timeout=30)
69
72
  if t.is_alive():
@@ -12,6 +12,7 @@ internally via ``_run_async``.
12
12
  from __future__ import annotations
13
13
 
14
14
  import asyncio
15
+ import contextvars
15
16
  import contextlib
16
17
  import json
17
18
  import threading
@@ -117,7 +118,9 @@ def _run_async(coro):
117
118
  except Exception as e:
118
119
  exception = e
119
120
 
120
- t = threading.Thread(target=_run)
121
+ # A new thread starts with an empty context: run in a copy of ours so
122
+ # the coroutine sees the invocation's agent identity (ContextVars).
123
+ t = threading.Thread(target=contextvars.copy_context().run, args=(_run,))
121
124
  t.start()
122
125
  t.join(timeout=30)
123
126
  if t.is_alive():