databricks-tellr-app 0.5.2.dev7__tar.gz → 0.5.2.dev9__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 (248) hide show
  1. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/PKG-INFO +1 -1
  2. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/databricks_tellr_app.egg-info/PKG-INFO +1 -1
  3. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/databricks_tellr_app.egg-info/SOURCES.txt +2 -0
  4. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/pyproject.toml +1 -1
  5. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/mcp_server.py +2 -0
  6. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/chat.py +35 -0
  7. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/sessions.py +2 -0
  8. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/services/chat_service.py +13 -0
  9. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/services/session_manager.py +83 -0
  10. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/skills/__init__.py +14 -8
  11. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/skills/architect.py +35 -11
  12. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/skills/builder.py +62 -14
  13. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/skills/fixer.py +35 -2
  14. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/domain/deck_style.py +44 -2
  15. databricks_tellr_app-0.5.2.dev9/src/services/agent_definition_manifest_v1.py +3 -0
  16. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/agent_runtime.py +188 -12
  17. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/design_system_service.py +27 -0
  18. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/graph/nodes.py +148 -4
  19. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/utils/ds_asset_utils.py +51 -1
  20. databricks_tellr_app-0.5.2.dev9/src/utils/slide_number_tokens.py +109 -0
  21. databricks_tellr_app-0.5.2.dev7/src/services/agent_definition_manifest_v1.py +0 -3
  22. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/README.md +0 -0
  23. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/databricks_tellr_app/__init__.py +0 -0
  24. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/databricks_tellr_app/run.py +0 -0
  25. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/databricks_tellr_app.egg-info/dependency_links.txt +0 -0
  26. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/databricks_tellr_app.egg-info/requires.txt +0 -0
  27. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/databricks_tellr_app.egg-info/top_level.txt +0 -0
  28. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/setup.cfg +0 -0
  29. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/setup.py +0 -0
  30. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/__init__.py +0 -0
  31. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/__init__.py +0 -0
  32. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/_otel_bootstrap.py +0 -0
  33. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/fixtures/tour_demo_deck.json +0 -0
  34. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/main.py +0 -0
  35. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/mcp_auth.py +0 -0
  36. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/middleware/__init__.py +0 -0
  37. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/middleware/csrf.py +0 -0
  38. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/middleware/request_logging.py +0 -0
  39. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/middleware/security_headers.py +0 -0
  40. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/__init__.py +0 -0
  41. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/_authz.py +0 -0
  42. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/admin.py +0 -0
  43. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/admin_usage.py +0 -0
  44. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/agent_config.py +0 -0
  45. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/agent_definitions.py +0 -0
  46. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/deck_contributors.py +0 -0
  47. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/export.py +0 -0
  48. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/feedback.py +0 -0
  49. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/google_slides.py +0 -0
  50. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/images.py +0 -0
  51. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/local_version.py +0 -0
  52. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/profiles.py +0 -0
  53. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/settings/__init__.py +0 -0
  54. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/settings/contributors.py +0 -0
  55. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/settings/deck_prompts.py +0 -0
  56. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/settings/design_systems.py +0 -0
  57. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/settings/identities.py +0 -0
  58. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/settings/slide_styles.py +0 -0
  59. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/setup.py +0 -0
  60. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/slides.py +0 -0
  61. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/tools.py +0 -0
  62. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/tour.py +0 -0
  63. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/verification.py +0 -0
  64. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/routes/version.py +0 -0
  65. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/schemas/__init__.py +0 -0
  66. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/schemas/agent_config.py +0 -0
  67. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/schemas/agent_definitions.py +0 -0
  68. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/schemas/feedback.py +0 -0
  69. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/schemas/graph_release_history.py +0 -0
  70. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/schemas/graph_releases.py +0 -0
  71. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/schemas/requests.py +0 -0
  72. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/schemas/responses.py +0 -0
  73. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/schemas/settings/__init__.py +0 -0
  74. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/schemas/settings/requests.py +0 -0
  75. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/schemas/settings/responses.py +0 -0
  76. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/schemas/streaming.py +0 -0
  77. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/services/__init__.py +0 -0
  78. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/services/deck_level_writer.py +0 -0
  79. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/services/export_job_queue.py +0 -0
  80. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/services/feedback_service.py +0 -0
  81. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/services/job_queue.py +0 -0
  82. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/services/session_naming.py +0 -0
  83. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/services/slide_repository.py +0 -0
  84. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/services/slide_style_preview_queue.py +0 -0
  85. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/services/usage_events.py +0 -0
  86. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/services/usage_service.py +0 -0
  87. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/utils/__init__.py +0 -0
  88. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/api/utils/validation.py +0 -0
  89. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/__init__.py +0 -0
  90. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/backfill_session_slides_startup.py +0 -0
  91. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/checkpointer.py +0 -0
  92. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/config_loader.py +0 -0
  93. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/context_utils.py +0 -0
  94. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/database.py +0 -0
  95. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/databricks_client.py +0 -0
  96. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/defaults.py +0 -0
  97. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/encryption.py +0 -0
  98. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/init_default_profile.py +0 -0
  99. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/lakebase.py +0 -0
  100. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/migrate_profiles_to_agent_config.py +0 -0
  101. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/mlflow_agent_spans.py +0 -0
  102. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/mlflow_tracing.py +0 -0
  103. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/otel_logging.py +0 -0
  104. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/permission_context.py +0 -0
  105. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/prompt_modules.py +0 -0
  106. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/settings_db.py +0 -0
  107. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/skills/build_reviewer.py +0 -0
  108. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/skills/data_analyst.py +0 -0
  109. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/skills/deck_reviewer.py +0 -0
  110. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/skills/fix_reviewer.py +0 -0
  111. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/strip_retired_prompt_keys.py +0 -0
  112. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/core/user_context.py +0 -0
  113. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/__init__.py +0 -0
  114. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/models/__init__.py +0 -0
  115. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/models/data_migration.py +0 -0
  116. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/models/deck_contributor.py +0 -0
  117. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/models/deck_review.py +0 -0
  118. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/models/design_system.py +0 -0
  119. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/models/encryption_key.py +0 -0
  120. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/models/feedback.py +0 -0
  121. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/models/genie_space.py +0 -0
  122. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/models/google_global_credentials.py +0 -0
  123. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/models/google_oauth_token.py +0 -0
  124. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/models/graph_checkpoint.py +0 -0
  125. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/models/graph_configuration.py +0 -0
  126. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/models/identity.py +0 -0
  127. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/models/image.py +0 -0
  128. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/models/profile.py +0 -0
  129. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/models/profile_contributor.py +0 -0
  130. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/models/prompts.py +0 -0
  131. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/models/request_log.py +0 -0
  132. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/models/session.py +0 -0
  133. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/models/slide_deck_prompt.py +0 -0
  134. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/models/slide_style_library.py +0 -0
  135. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/models/slide_style_preview.py +0 -0
  136. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/models/usage_event.py +0 -0
  137. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/models/user_preference.py +0 -0
  138. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/database/types.py +0 -0
  139. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/domain/__init__.py +0 -0
  140. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/domain/conversation_engine.py +0 -0
  141. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/domain/conversation_turns.py +0 -0
  142. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/domain/deck_spec.py +0 -0
  143. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/domain/deck_spec_slides.py +0 -0
  144. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/domain/finding.py +0 -0
  145. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/domain/finding_copy.py +0 -0
  146. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/domain/skill_io.py +0 -0
  147. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/domain/slide.py +0 -0
  148. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/domain/slide_alignment.py +0 -0
  149. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/domain/slide_deck.py +0 -0
  150. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/domain/slide_numbering.py +0 -0
  151. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/domain/slide_operations.py +0 -0
  152. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/__init__.py +0 -0
  153. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/agent.py +0 -0
  154. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/agent_factory.py +0 -0
  155. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/agent_model_payload.py +0 -0
  156. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/agent_resolution.py +0 -0
  157. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/agent_runtime_identity.py +0 -0
  158. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/agent_schema_registry.py +0 -0
  159. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/agent_schema_types.py +0 -0
  160. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/agent_test_workbench.py +0 -0
  161. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/collaboration_history.py +0 -0
  162. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/config_service.py +0 -0
  163. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/config_validator.py +0 -0
  164. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/conversation_pins.py +0 -0
  165. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/converter_jail/__init__.py +0 -0
  166. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/converter_jail/ast_guard.py +0 -0
  167. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/converter_jail/codeprep.py +0 -0
  168. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/converter_jail/gslides_runner.py +0 -0
  169. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/converter_jail/jail.py +0 -0
  170. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/converter_jail/pptx_runner.py +0 -0
  171. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/converter_jail/protocol.py +0 -0
  172. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/deck_css_aggregator.py +0 -0
  173. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/deck_review_store.py +0 -0
  174. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/design_system_compiler.py +0 -0
  175. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/design_system_templates.py +0 -0
  176. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/drive_uploader.py +0 -0
  177. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/evaluation/__init__.py +0 -0
  178. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/evaluation/llm_judge.py +0 -0
  179. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/foreman_service.py +0 -0
  180. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/gateway_openai.py +0 -0
  181. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/genie_service.py +0 -0
  182. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/google_slides_auth.py +0 -0
  183. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/google_slides_prompts_defaults.py +0 -0
  184. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/graph/__init__.py +0 -0
  185. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/graph/builder.py +0 -0
  186. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/graph/event_emitter.py +0 -0
  187. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/graph/progress.py +0 -0
  188. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/graph/routers.py +0 -0
  189. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/graph/state.py +0 -0
  190. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/graph/user_notices.py +0 -0
  191. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/graph_configuration.py +0 -0
  192. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/graph_configuration_bootstrap.py +0 -0
  193. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/graph_configuration_content.py +0 -0
  194. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/graph_configuration_draft.py +0 -0
  195. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/graph_configuration_publication.py +0 -0
  196. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/graph_configuration_rollback.py +0 -0
  197. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/graph_configuration_seed.py +0 -0
  198. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/graph_configuration_workbench.py +0 -0
  199. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/graph_definition_manifest.py +0 -0
  200. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/graph_release_evidence.py +0 -0
  201. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/graph_release_history.py +0 -0
  202. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/html_to_google_slides.py +0 -0
  203. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/html_to_pptx.py +0 -0
  204. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/identity_provider.py +0 -0
  205. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/identity_providers/__init__.py +0 -0
  206. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/identity_providers/account_provider.py +0 -0
  207. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/identity_providers/local_provider.py +0 -0
  208. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/identity_providers/scim_filter.py +0 -0
  209. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/identity_providers/workspace_provider.py +0 -0
  210. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/image_service.py +0 -0
  211. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/image_tools.py +0 -0
  212. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/model_endpoint_catalog.py +0 -0
  213. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/model_endpoint_probe.py +0 -0
  214. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/permission_service.py +0 -0
  215. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/persisted_graph_release.py +0 -0
  216. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/pptx_from_html_huashu.py +0 -0
  217. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/pptx_from_records.py +0 -0
  218. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/pptx_prompts_defaults.py +0 -0
  219. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/profile_service.py +0 -0
  220. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/prompt_assembler.py +0 -0
  221. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/shared_deck_attribution.py +0 -0
  222. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/slide_style_preview_fixture.py +0 -0
  223. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/slide_style_preview_storage.py +0 -0
  224. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/spec_sync.py +0 -0
  225. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/streaming_callback.py +0 -0
  226. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/svg_sanitizer.py +0 -0
  227. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/template_sections.py +0 -0
  228. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/tools/__init__.py +0 -0
  229. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/tools/agent_bricks_tool.py +0 -0
  230. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/tools/ds_asset_tool.py +0 -0
  231. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/tools/genie_tool.py +0 -0
  232. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/tools/mcp_tool.py +0 -0
  233. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/tools/model_endpoint_tool.py +0 -0
  234. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/tools/vector_tool.py +0 -0
  235. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/services/validator.py +0 -0
  236. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/utils/__init__.py +0 -0
  237. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/utils/css_utils.py +0 -0
  238. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/utils/error_handling.py +0 -0
  239. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/utils/graph_safety.py +0 -0
  240. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/utils/html_safety.py +0 -0
  241. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/utils/html_utils.py +0 -0
  242. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/utils/image_utils.py +0 -0
  243. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/utils/js_validator.py +0 -0
  244. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/utils/logging_config.py +0 -0
  245. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/utils/pi_filter.py +0 -0
  246. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/utils/slide_hash.py +0 -0
  247. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/utils/spotlight.py +0 -0
  248. {databricks_tellr_app-0.5.2.dev7 → databricks_tellr_app-0.5.2.dev9}/src/utils/text_caps.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: databricks-tellr-app
3
- Version: 0.5.2.dev7
3
+ Version: 0.5.2.dev9
4
4
  Summary: Tellr application package for Databricks Apps
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: databricks-tellr-app
3
- Version: 0.5.2.dev7
3
+ Version: 0.5.2.dev9
4
4
  Summary: Tellr application package for Databricks Apps
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
@@ -235,6 +235,7 @@ setup.py
235
235
  ./src/utils/logging_config.py
236
236
  ./src/utils/pi_filter.py
237
237
  ./src/utils/slide_hash.py
238
+ ./src/utils/slide_number_tokens.py
238
239
  ./src/utils/spotlight.py
239
240
  ./src/utils/text_caps.py
240
241
  databricks_tellr_app/__init__.py
@@ -476,5 +477,6 @@ src/utils/js_validator.py
476
477
  src/utils/logging_config.py
477
478
  src/utils/pi_filter.py
478
479
  src/utils/slide_hash.py
480
+ src/utils/slide_number_tokens.py
479
481
  src/utils/spotlight.py
480
482
  src/utils/text_caps.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "databricks-tellr-app"
7
- version = "0.5.2.dev7"
7
+ version = "0.5.2.dev9"
8
8
  description = "Tellr application package for Databricks Apps"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -617,7 +617,9 @@ def _render_deck_response(
617
617
  from src.api.services.chat_service import resolve_active_design_system_id
618
618
  from src.utils.ds_asset_utils import substitute_deck_dict_ds_assets
619
619
  from src.utils.image_utils import substitute_deck_dict_images
620
+ from src.utils.slide_number_tokens import substitute_deck_slide_numbers
620
621
 
622
+ substitute_deck_slide_numbers(deck_dict)
621
623
  design_system_id = resolve_active_design_system_id(session_id)
622
624
  with get_db_session() as db:
623
625
  substitute_deck_dict_images(deck_dict, db)
@@ -27,6 +27,7 @@ from src.api.schemas.agent_config import normalize_style_source_exclusivity
27
27
  from src.api.schemas.requests import ChatRequest
28
28
  from src.api.schemas.responses import ChatResponse
29
29
  from src.api.schemas.streaming import StreamEvent, StreamEventType
30
+ from src.utils.slide_number_tokens import substitute_slide_numbers
30
31
  from src.api.services.chat_service import (
31
32
  get_chat_service,
32
33
  resolve_engine_mode_or_unavailable,
@@ -1036,6 +1037,40 @@ async def poll_chat(
1036
1037
  )
1037
1038
  ]
1038
1039
 
1040
+ # Live page-number tokens: the count is the persisted spec's slide count (the
1041
+ # deck's slide_count is stale mid-build). Read it once, and only when some
1042
+ # row carries a token, so a legacy deck's 3-second poll costs nothing extra.
1043
+ _all_rows = [*released_slides, *slide_revisions]
1044
+ _token_rows = [r for r in _all_rows if "{{slide:" in (r["html"] or "")]
1045
+ if _token_rows:
1046
+ count = None
1047
+ try:
1048
+ from src.api.services.deck_level_writer import read_deck_spec
1049
+
1050
+ spec = await asyncio.to_thread(read_deck_spec, session_id)
1051
+ if spec and isinstance(spec.get("slides"), list):
1052
+ count = len(spec["slides"])
1053
+ except Exception:
1054
+ logger.warning("Could not read deck spec for page numbers", exc_info=True)
1055
+ if count is None:
1056
+ # No readable spec: highest released position + 1, so no literal
1057
+ # token ships.
1058
+ count = max(r["position"] for r in _all_rows) + 1
1059
+ for r in _token_rows:
1060
+ r["html"] = substitute_slide_numbers(r["html"], r["position"] + 1, count)
1061
+
1062
+ # Brand assets after the page tokens, as the REST readers order them: one asset
1063
+ # read for every row this poll returns, and none when no row carries a handle.
1064
+ _asset_rows = [r for r in _all_rows if "{{ds-asset:" in (r["html"] or "")]
1065
+ if _asset_rows:
1066
+ from src.api.services.session_manager import resolve_streamed_ds_assets
1067
+
1068
+ resolved = await asyncio.to_thread(
1069
+ resolve_streamed_ds_assets, session_id, [r["html"] for r in _asset_rows]
1070
+ )
1071
+ for r, html in zip(_asset_rows, resolved):
1072
+ r["html"] = html
1073
+
1039
1074
  return {
1040
1075
  "status": chat_request["status"],
1041
1076
  "events": events,
@@ -84,7 +84,9 @@ def _substitute_deck_images(deck_dict: dict, session_id: str) -> None:
84
84
  from src.core.database import get_db_session
85
85
  from src.utils.ds_asset_utils import substitute_deck_dict_ds_assets
86
86
  from src.utils.image_utils import substitute_deck_dict_images
87
+ from src.utils.slide_number_tokens import substitute_deck_slide_numbers
87
88
 
89
+ substitute_deck_slide_numbers(deck_dict)
88
90
  ds_id = resolve_active_design_system_id(session_id)
89
91
  with get_db_session() as db:
90
92
  substitute_deck_dict_images(deck_dict, db)
@@ -69,6 +69,10 @@ from src.utils.ds_asset_utils import (
69
69
  )
70
70
  from src.utils.image_utils import substitute_deck_dict_images, substitute_image_placeholders
71
71
  from src.utils.slide_hash import compute_slide_hash
72
+ from src.utils.slide_number_tokens import (
73
+ retokenise_slide_numbers,
74
+ substitute_deck_slide_numbers,
75
+ )
72
76
 
73
77
  logger = logging.getLogger(__name__)
74
78
 
@@ -368,6 +372,11 @@ class ChatService:
368
372
  """
369
373
  from src.core.database import get_db_session
370
374
 
375
+ # Page tokens need no DB, so they sit outside the asset gate below. The
376
+ # knitted raw_html / html_content stay unsubstituted (see slide_number_tokens).
377
+ if deck_dict:
378
+ substitute_deck_slide_numbers(deck_dict)
379
+
371
380
  needs_deck = deck_dict and any(
372
381
  "{{image:" in s.get("html", "") for s in deck_dict.get("slides", [])
373
382
  )
@@ -3670,6 +3679,8 @@ class ChatService:
3670
3679
  # substring match on otherwise-valid slides.
3671
3680
  if not has_slide_wrapper(html):
3672
3681
  raise ValueError("HTML must contain <div class='slide'> wrapper")
3682
+ # Page-number markers a reader rendered go back to tokens before storing.
3683
+ html = retokenise_slide_numbers(html)
3673
3684
 
3674
3685
  # Preserve original slide's metadata and scripts before updating
3675
3686
  original_slide = current_deck.slides[index]
@@ -3940,6 +3951,8 @@ class ChatService:
3940
3951
  if html is not None
3941
3952
  else blank_slide_shell([s.html for s in current_deck.slides], landed)
3942
3953
  )
3954
+ if html is not None:
3955
+ slide_html = retokenise_slide_numbers(slide_html)
3943
3956
  if not has_slide_wrapper(slide_html):
3944
3957
  raise ValueError("HTML must contain <div class='slide'> wrapper")
3945
3958
 
@@ -1021,6 +1021,81 @@ class VersionConflictError(Exception):
1021
1021
  )
1022
1022
 
1023
1023
 
1024
+ def _restore_response_deck(deck_dict: Dict[str, Any], session_id: str) -> Dict[str, Any]:
1025
+ """The restored deck as the client receives it: a copy rendered as ``get_version``
1026
+ renders a preview of the same save point.
1027
+
1028
+ Page tokens, then ``{{image:ID}}``, then ``{{ds-asset:ID}}`` scoped to the
1029
+ session's active design system. The client renders this response directly,
1030
+ with no refetch, so a handle left here would show as a broken image. The
1031
+ slides are copied first, so the stored rows and the snapshot keep their tokens
1032
+ and handles.
1033
+
1034
+ Called AFTER the restore's transaction has committed, in a session of its own:
1035
+ the reads here (the session's design system, the asset bytes) must not share
1036
+ the restore's write transaction. A failed read must not undo a restore that
1037
+ has been written either: the response then carries the page numbers alone, and
1038
+ the handles resolve on the next read.
1039
+ """
1040
+ from src.api.services.chat_service import resolve_active_design_system_id
1041
+ from src.utils.ds_asset_utils import substitute_deck_dict_ds_assets
1042
+ from src.utils.image_utils import substitute_deck_dict_images
1043
+ from src.utils.slide_number_tokens import substitute_deck_slide_numbers
1044
+
1045
+ def _copy() -> Dict[str, Any]:
1046
+ out = dict(deck_dict)
1047
+ if isinstance(out.get("slides"), list):
1048
+ out["slides"] = [dict(s) if isinstance(s, dict) else s for s in out["slides"]]
1049
+ return substitute_deck_slide_numbers(out)
1050
+
1051
+ out = _copy()
1052
+ try:
1053
+ design_system_id = resolve_active_design_system_id(session_id)
1054
+ with get_db_session() as db:
1055
+ substitute_deck_dict_images(out, db)
1056
+ substitute_deck_dict_ds_assets(out, db, design_system_id=design_system_id)
1057
+ except Exception:
1058
+ logger.warning(
1059
+ "Could not resolve images for the restore response", exc_info=True
1060
+ )
1061
+ return _copy()
1062
+ return out
1063
+
1064
+
1065
+ def resolve_streamed_ds_assets(session_id: Optional[str], htmls: Sequence[str]) -> List[str]:
1066
+ """``{{ds-asset:ID}}`` handles in slides shipped mid-build, resolved as REST reads resolve them.
1067
+
1068
+ For ``slide_ready`` (the foreman's release) and ``/chat/poll``. The caller has
1069
+ already rendered the page tokens: page tokens first, then assets, the REST
1070
+ readers' order. Assets are scoped to the session's active design system
1071
+ (``resolve_active_design_system_id``), so a foreign or unknown handle stays in
1072
+ place and no design system means nothing resolves. Every slide of the batch is
1073
+ served by ONE asset read. The output is base64 ``data:`` URIs, so a streamed
1074
+ slide grows by its assets' bytes exactly as a REST read of it does.
1075
+
1076
+ HTML with no handle (an old deck, a deck with no design system) comes back
1077
+ unchanged and costs no read at all. It never raises: on any failure the slides
1078
+ ship with their handles and the COMPLETE refetch resolves them, as before,
1079
+ because streaming is a side channel. Nothing is kept between calls, so every
1080
+ worker resolves from the database alike.
1081
+ """
1082
+ htmls = list(htmls)
1083
+ if not any(html and "{{ds-asset:" in html for html in htmls):
1084
+ return htmls
1085
+ try:
1086
+ from src.api.services.chat_service import resolve_active_design_system_id
1087
+ from src.utils.ds_asset_utils import substitute_ds_assets_in_many
1088
+
1089
+ design_system_id = resolve_active_design_system_id(session_id)
1090
+ with get_db_session() as db:
1091
+ return substitute_ds_assets_in_many(
1092
+ htmls, db, design_system_id=design_system_id
1093
+ )
1094
+ except Exception:
1095
+ logger.warning("Could not resolve brand assets for streamed slides", exc_info=True)
1096
+ return htmls
1097
+
1098
+
1024
1099
  class SessionManager:
1025
1100
  """Manager for database-backed session operations.
1026
1101
 
@@ -3459,6 +3534,9 @@ class SessionManager:
3459
3534
  from src.utils.ds_asset_utils import substitute_deck_dict_ds_assets
3460
3535
  from src.utils.image_utils import substitute_deck_dict_images
3461
3536
 
3537
+ from src.utils.slide_number_tokens import substitute_deck_slide_numbers
3538
+
3539
+ substitute_deck_slide_numbers(deck_dict)
3462
3540
  ds_id = resolve_active_design_system_id(session_id)
3463
3541
  substitute_deck_dict_images(deck_dict, db)
3464
3542
  substitute_deck_dict_ds_assets(deck_dict, db, design_system_id=ds_id)
@@ -3661,6 +3739,7 @@ class SessionManager:
3661
3739
  _restore_result = {
3662
3740
  "version_number": version_number,
3663
3741
  "description": version.description,
3742
+ # Rendered once the restore has committed (below).
3664
3743
  "deck": deck_dict,
3665
3744
  "verification_map": verification_map,
3666
3745
  "chat_history": chat_history,
@@ -3668,6 +3747,10 @@ class SessionManager:
3668
3747
  "deleted_messages": deleted_messages,
3669
3748
  }
3670
3749
 
3750
+ # The client's copy, read in its own session after the commit: the rows and
3751
+ # the snapshot keep their tokens and handles.
3752
+ _restore_result["deck"] = _restore_response_deck(deck_dict, session_id)
3753
+
3671
3754
  # D6a: discard the pending spec-review marker unconditionally, AFTER the
3672
3755
  # restore has committed. The deck those pending edits described no longer
3673
3756
  # exists; the restored version carries its own authoritative deck_spec_json
@@ -17,10 +17,14 @@ and the tool grants.
17
17
 
18
18
  Tool grants
19
19
  -----------
20
- ``data_analyst`` is the ONLY skill with non-empty ``tool_grants`` (§16, Ruling
21
- C-11). Spec §5.2.2's rationale: the analyst is the OBO boundary where
22
- user-scoped data access is concentrated; the architect's work (conversation,
23
- arc, section assignment) reaches no tool. The other six declare ``[]``.
20
+ ``data_analyst`` declares the data tools (§16, Ruling C-11). Spec §5.2.2's
21
+ rationale: the analyst is the OBO boundary where user-scoped data access is
22
+ concentrated; the architect's work (conversation, arc, section assignment)
23
+ reaches no tool. ``builder`` and ``fixer`` declare ``search_brand_assets``
24
+ (deck style addendum A): a read-only search of the deck's own design system,
25
+ bound by ``builder_node``/``fixer_node`` only when a design system is active and
26
+ the deck has a deck style. The architect and the three reviewers declare
27
+ ``[]``. The grants are documentation only: no ``src`` module reads them.
24
28
  """
25
29
 
26
30
  from __future__ import annotations
@@ -50,9 +54,10 @@ class Skill:
50
54
  placeholder strings with the authored prose; the graph runs on
51
55
  placeholders until then.
52
56
  output_schema: The pydantic class the model must produce.
53
- tool_grants: Tool names this skill is allowed to invoke. Only
54
- ``data_analyst`` carries a non-empty list; all others declare ``[]``
55
- (§5.2.2 / Ruling C-11).
57
+ tool_grants: Tool names this skill is allowed to invoke (documentation
58
+ only). ``data_analyst`` carries the data tools; ``builder`` and
59
+ ``fixer`` carry ``search_brand_assets`` (deck style addendum A); the
60
+ architect and the reviewers declare ``[]`` (§5.2.2 / Ruling C-11).
56
61
  """
57
62
 
58
63
  name: str
@@ -96,7 +101,8 @@ def _register(
96
101
  # 3. No body may contain the safe-area literals 88px, 72px, 56px or 1280x720
97
102
  # — those numbers are owned by _SLIDE_FRAME_CONSTRAINTS and must come
98
103
  # from exactly one source so they can never drift.
99
- # 4. data_analyst is the ONLY skill with non-empty tool_grants.
104
+ # 4. Only data_analyst, builder and fixer have non-empty tool_grants; the
105
+ # builder's and fixer's are ["search_brand_assets"] (deck style addendum A).
100
106
  # ---------------------------------------------------------------------------
101
107
 
102
108
  from .architect import INSTRUCTIONS as _architect_instructions
@@ -1,14 +1,17 @@
1
1
  """Skill body for the architect.
2
2
 
3
3
  PR-3 GAPS (recorded, not defects — closing any requires a declared channel):
4
- - Brand assets are unreachable on the graph path. ``search_brand_assets`` gating
5
- stays in ``agent_factory`` (monolith-only); no graph skill holds the tool, so a
6
- graph deck can embed no brand asset at all.
7
- - User-uploaded images are in the same position — no ``GraphState`` key and no
8
- payload field carries an image-id list.
4
+ - User-uploaded images are unreachable on the graph path — no ``GraphState`` key and
5
+ no payload field carries an image-id list.
9
6
 
10
- Closing either requires a declared channel (a new ``GraphState`` key or a field on
7
+ Closing it requires a declared channel (a new ``GraphState`` key or a field on
11
8
  ``SlideSpec``), which is a scope addition, not a local edit.
9
+
10
+ Brand assets are no longer a gap (deck style addendum A). The architect has no
11
+ tool: ``deck_style_context.logos`` hands it the design system's logo handles, and
12
+ it puts one in the deck style's footer piece. Builders and fixers hold
13
+ ``search_brand_assets`` (see their modules), bound only when a design system is
14
+ active and the deck has a deck style.
12
15
  """
13
16
 
14
17
  TOOL_GRANTS: list[str] = []
@@ -179,8 +182,9 @@ INSTRUCTIONS: str = (
179
182
  "rather than leaving it unset; an empty template means an empty "
180
183
  "`template_sections` list.\n"
181
184
  "`content_brief` names the exhibit when the slide carries numbers. Brand "
182
- "furniture such as a logo or lockup comes from the selected section's "
183
- "markup. Style assets are identity, not evidence.\n"
185
+ "furniture in the selected section's markup, such as a lockup on a cover, stays as it "
186
+ "ships; the footer's logo comes from deck_style_context.logos and icons from the "
187
+ "builders' own search (see DECK STYLE). Style assets are identity, not evidence.\n"
184
188
  "Do not plan exhibits onto missing data; prefer `ask_data`.\n\n"
185
189
  "DECK STYLE (deck_style and look):\n"
186
190
  "On a build, write deck_style once, after you plan the slides: the deck's thin house style, "
@@ -224,11 +228,29 @@ INSTRUCTIONS: str = (
224
228
  " - no at-rules, so no @media or @keyframes; no @import or @font-face; no nested rules\n"
225
229
  " - no url() except data: URIs, and no remote addresses (http:, https:, //)\n"
226
230
  " - no image functions such as image-set or cross-fade\n"
227
- "No page numbers: a number baked into a slide goes stale when slides move, so a footer piece "
228
- "may style the footer but never numbers the slides.\n"
231
+ "On a build, the deck style always includes a footer piece, named footer with the class "
232
+ "dk-footer, styled to match the template's footer. Its example_html holds a logo handle "
233
+ "from deck_style_context.logos and both page tokens, {{slide:number}} / {{slide:count}}, "
234
+ "which are filled in with the slide's number and the deck's slide count wherever the deck "
235
+ "is shown, so they stay right when slides move. When template_classes has a footer class "
236
+ "(such as slide-footer), reuse it and keep its two slots: the logo, with any label, in the "
237
+ "first and the page tokens in the second, never a third child; a number in the template's "
238
+ "sample footer is placeholder.\n"
239
+ "Choose two logo handles from deck_style_context.logos: one for light grounds, and a "
240
+ "light-on-dark one (a reverse or white variant) for dark slides, named in the footer "
241
+ "piece's use line. Use only handles from logos: with one variant, use it on every ground; "
242
+ "with none, the footer holds the page tokens alone.\n"
243
+ "Every slide except the cover carries one footer: a bound slide fills its template's own "
244
+ "footer (the logo, its label and the page tokens), an unbound slide uses the footer piece, "
245
+ "and no slide carries two footers. Each look except the cover's names its footer, and a "
246
+ "dark slide's look (a divider, a dark closing slide) says it uses the light-on-dark logo.\n"
247
+ "Content slides share the deck's one default light ground, so a look never asks for a "
248
+ "white or other light ground of its own; dark sections (the cover, dividers) stay dark.\n"
229
249
  "Write a look for every slide: one or two sentences naming the layout of its body and the "
230
250
  "pieces it uses, deck-style or template, such as \"two columns: three bullets on the left, a "
231
- "dk-code listing on the right\". Name only pieces that exist.\n"
251
+ "dk-code listing on the right\". Name only pieces that exist. A look may ask for icons "
252
+ "(\"an icon on each card\") but never names an icon handle: builders search the design "
253
+ "system for icons themselves.\n"
232
254
  "On an edit:\n"
233
255
  " - A deck-wide style request (\"make the code blocks dark\", \"bigger table text\") is "
234
256
  "deck_changes.deck_style holding the whole revised style (all its css and every component, "
@@ -245,6 +267,8 @@ INSTRUCTIONS: str = (
245
267
  "slide's operation: the one deck-level change you make unasked.\n"
246
268
  " - A confirmed design-contract change (a new design system or template) rebuilds every "
247
269
  "slide, so write a fresh deck style for the new contract in the same answer.\n"
270
+ " - A deck style without a footer piece gains one only when the user asks for a footer, "
271
+ "page numbers or a full rebuild.\n"
248
272
  " - An older deck with no deck style keeps none unless the user asks for a style change or "
249
273
  "a full rebuild.\n\n"
250
274
  "SLIDE NUMBERS\n"
@@ -1,17 +1,23 @@
1
1
  """Skill body for the slide builder.
2
2
 
3
- PR-3 GAPS (recorded, not defects — closing any requires a declared channel):
4
- - Brand assets are unreachable on the graph path. ``search_brand_assets`` gating
5
- stays in ``agent_factory`` (monolith-only).
6
- - User-uploaded images are in the same position — no ``GraphState`` key and no
7
- payload field carries an image-id list.
3
+ Brand assets (deck style addendum A): ``builder_node`` binds a
4
+ ``search_brand_assets`` tool, scoped to the deck's design system, when a design
5
+ system is active and the deck has a deck style. ``TOOL_GRANTS`` records that;
6
+ it is documentation only — nothing reads it, and the binding decision is code
7
+ in ``builder_node``. An old deck (no deck style) binds no tool.
8
8
 
9
- Both gaps degrade gracefully to "no image" rather than a fabricated handle: the
10
- prose keeps the embedding syntax (``{{image:ID}}``) but carries no instruction to
11
- call a tool, so a builder that receives no image id builds the slide without images.
9
+ PR-3 GAP (recorded, not a defect — closing it requires a declared channel):
10
+ user-uploaded images are unreachable on the graph path — no ``GraphState`` key and
11
+ no payload field carries an image-id list. It degrades gracefully to "no image"
12
+ rather than a fabricated handle: the prose keeps the embedding syntax
13
+ (``{{image:ID}}``) but carries no instruction to call an image tool, so a builder
14
+ that receives no image id builds the slide without user images. Its only tool
15
+ instruction is the brand-asset search in the DECK STYLE block, conditioned on the
16
+ tool being available; that block takes precedence over IMAGE RULES, so brand
17
+ assets are still placed on a slide with no image ids.
12
18
  """
13
19
 
14
- TOOL_GRANTS: list[str] = []
20
+ TOOL_GRANTS: list[str] = ["search_brand_assets"]
15
21
 
16
22
  INSTRUCTIONS: str = (
17
23
  "You are a slide builder. Build ONE slide as an HTML fragment.\n"
@@ -52,8 +58,8 @@ INSTRUCTIONS: str = (
52
58
  "CHART RULES (only when resolved_data.figures is present and non-empty):\n"
53
59
  " - Use Chart.js: line for trends, bar for categories, area for cumulative\n"
54
60
  " - Wrap every canvas in an explicit-height div:\n"
55
- " <div style=\"position:relative;height:300px\"><canvas "
56
- "id=\"chartId\"></canvas></div>\n"
61
+ ' <div style="position:relative;height:300px"><canvas '
62
+ 'id="chartId"></canvas></div>\n'
57
63
  " - Set responsive: true, maintainAspectRatio: false\n"
58
64
  " - Guard existence before init:\n"
59
65
  " const c = document.getElementById('chartId'); if (c) { new Chart(c, ...); }\n"
@@ -101,10 +107,14 @@ INSTRUCTIONS: str = (
101
107
  "and background: styles are permitted because there is no deck CSS\n"
102
108
  "\n"
103
109
  "DECK STYLE (when deck_style is present):\n"
110
+ " Apply this whole block only when the payload carries deck_style; without deck_style, "
111
+ "skip every rule in it (its footer, page-token, ground and icon rules included) and follow "
112
+ "the other blocks as written.\n"
104
113
  " deck_style is the deck's house style: css that the deck CSS already carries, and a "
105
114
  "components catalogue whose entries give each piece's name, class_names, use and "
106
115
  "example_html. slide_spec.look says what this slide looks like. With a deck style, these "
107
- "rules take precedence over BOUND TEMPLATE SECTION and NO BOUND SECTION where they differ.\n"
116
+ "rules take precedence over BOUND TEMPLATE SECTION, NO BOUND SECTION and IMAGE RULES where "
117
+ "they differ.\n"
108
118
  " - Build the slide to its look: lay out the body as the look says, with the pieces it "
109
119
  "names\n"
110
120
  " - Use the catalogue's pieces exactly as their example_html shows: the same tags, classes "
@@ -130,6 +140,44 @@ INSTRUCTIONS: str = (
130
140
  " - Use no class that the deck style, the bound section or the design system does not "
131
141
  "define\n"
132
142
  " - deck_style.css is context only, like section_css; never copy it into the html\n"
143
+ " - Brand assets: place the brand assets that the catalogue's pieces name, such as the logo "
144
+ "in the footer piece, keeping each {{ds-asset:ID}} handle exactly as written. The logo "
145
+ "comes from the footer piece alone, so it is the same on every slide: never search for a "
146
+ "logo. IMAGE RULES govern {{image:ID}} images only, so a slide with no image ids still "
147
+ "carries its brand assets\n"
148
+ " - Icons: when the search_brand_assets tool is available, search when the look asks for "
149
+ "icons or the slide shows products or concepts (a product, a feature, a workflow step). The "
150
+ 'query matches file names, so search by kind (kind "icon") or by one short file-name '
151
+ "word, never by a phrase; one search is usually enough. Then place the icons it returns "
152
+ 'that fit, one per item, each as <img src="{{ds-asset:ID}}" alt="what it shows"/> '
153
+ "sized with inline width and height only. If no returned icon fits an item, leave that "
154
+ "item without one\n"
155
+ " - Never invent a handle: every {{ds-asset:ID}} on the slide comes from the catalogue, the "
156
+ "bound section or a search result. Never hand-draw an icon either (no emoji, inline svg or "
157
+ "lettered badge in its place)\n"
158
+ " - Footers (deck-style decks only; without deck_style, write no {{slide:number}} or "
159
+ "{{slide:count}}): every slide except the cover carries exactly one footer, and a slide "
160
+ "never carries two footers. When the catalogue has no footer piece, a slide without a footer "
161
+ "of its own gets none: never hand-build one\n"
162
+ " - The cover gets no page tokens and no footer piece; a footer its section ships stays in "
163
+ "place, with no page tokens in it\n"
164
+ " - A bound slide whose section has a footer fills its template's own footer: its label "
165
+ "slot keeps a short label that "
166
+ "fits the deck, its number slot holds {{slide:number}} / {{slide:count}} in place of the "
167
+ "template's sample number (that number is placeholder), and the logo the footer piece "
168
+ "holds goes inside the label's span, never as a third child of the footer row\n"
169
+ " - A bound slide whose section has a footer never adds the deck style's footer piece, even "
170
+ "when the piece's use line says every slide: the footer piece is only for slides without a "
171
+ "footer of their own\n"
172
+ " - A bound slide whose section lacks a footer uses the deck style's footer piece, exactly "
173
+ "as an unbound slide does: copied as its example_html shows, with the page tokens as "
174
+ "written\n"
175
+ " - On a dark slide (a divider or a dark closing slide), the footer uses the light-on-dark "
176
+ "logo that the footer piece's use line names, in place of the light-ground one\n"
177
+ " - One ground: a light template section (white or the default) renders on the deck's "
178
+ "default ground, so content slides carry no white token and a bound section's white is "
179
+ "dropped. Dark and event treatments are never changed, and the cover keeps the treatment "
180
+ "it ships in. This is the one change a deck style makes to a bound section's frame\n"
133
181
  " - Without a deck style (deck_style absent), skip this block: the other rules apply as "
134
182
  "written\n"
135
183
  "\n"
@@ -139,8 +187,8 @@ INSTRUCTIONS: str = (
139
187
  " - DO NOT put <script> tags in the html field\n"
140
188
  "\n"
141
189
  "IMAGE RULES:\n"
142
- " - If the brief supplies image ids, embed them using: <img src=\"{{image:ID}}\" "
143
- "alt=\"description\" />\n"
190
+ ' - If the brief supplies image ids, embed them using: <img src="{{image:ID}}" '
191
+ 'alt="description" />\n'
144
192
  " - For CSS backgrounds: background-image: url('{{image:ID}}')\n"
145
193
  " - The system replaces {{image:ID}} with the real image data at render time\n"
146
194
  " - NEVER guess or fabricate an image ID\n"
@@ -7,9 +7,13 @@ once WYSIWYG lands, a user's manual edits. This prose preserves that distinctio
7
7
  Note on dimensions: the fixer's prose omits the "Maintain 1280x720 dimensions" line
8
8
  present in EDITING_RULES (§L5). Safe-area numbers are owned by
9
9
  ``_SLIDE_FRAME_CONSTRAINTS`` and must not be duplicated in skill bodies.
10
+
11
+ Brand assets (deck style addendum A): ``fixer_node`` binds the same scoped
12
+ ``search_brand_assets`` tool as the builder, decided on the builder record the
13
+ fix entry carries. ``TOOL_GRANTS`` records that and is read by nothing.
10
14
  """
11
15
 
12
- TOOL_GRANTS: list[str] = []
16
+ TOOL_GRANTS: list[str] = ["search_brand_assets"]
13
17
 
14
18
  INSTRUCTIONS: str = (
15
19
  "You are a slide fixer. Apply ONE reported finding to the slide HTML.\n\n"
@@ -40,7 +44,7 @@ INSTRUCTIONS: str = (
40
44
  " - Return ONLY the slide fragment, not the entire deck\n"
41
45
  " - Keep the outer root tag of the input html exactly (a <section> wrapping "
42
46
  "div.slide is allowed). Do not unwrap a bound section into a lone "
43
- "<div class=\"slide\">\n"
47
+ '<div class="slide">\n'
44
48
  " - Keep the class tokens on that outer root; do not drop treatment classes\n"
45
49
  " - The slide must be complete and self-contained\n"
46
50
  " - If charts changed, update scripts accordingly\n"
@@ -58,6 +62,8 @@ INSTRUCTIONS: str = (
58
62
  " - If the HTML cannot be parsed, return changed=False and explain in "
59
63
  "change_summary\n\n"
60
64
  "DECK STYLE (when deck_style is present):\n"
65
+ " Apply this whole block only when the payload carries deck_style; without deck_style, "
66
+ "skip every rule in it and fix by the other rules as written.\n"
61
67
  " deck_style is the deck's house style: css that the deck CSS already carries, and a "
62
68
  "components catalogue whose entries give each piece's name, class_names, use and "
63
69
  "example_html. slide_spec.look says what the slide looks like. MINIMAL CHANGE still "
@@ -77,6 +83,33 @@ INSTRUCTIONS: str = (
77
83
  " - Never use a dk- class that the payload's deck_style does not define\n"
78
84
  " - Use no class that the deck style, the template (section_css) or the design system "
79
85
  "does not define\n"
86
+ " - Brand assets: keep the brand assets that the catalogue's pieces name, such as the logo "
87
+ "in the footer piece, with each {{ds-asset:ID}} handle exactly as written. The logo comes "
88
+ "from the footer piece alone: never search for a logo\n"
89
+ " - When the search_brand_assets tool is available, search only when the finding requires "
90
+ "a brand asset that neither the slide nor the catalogue holds, such as a brand icon in "
91
+ 'place of a hand-drawn glyph. Search by kind (kind "icon") or by one short '
92
+ "file-name word, then place the handle it returns. Do not search for icons the finding "
93
+ "does not ask for\n"
94
+ " - Never invent a handle: every {{ds-asset:ID}} comes from the slide, the catalogue or a "
95
+ "search result\n"
96
+ " - Footers, only when the finding concerns a footer:\n"
97
+ " - every slide except the cover carries exactly one footer, and a slide never carries "
98
+ "two footers\n"
99
+ " - the cover gets no page tokens and no footer piece; a footer its section ships stays "
100
+ "in place\n"
101
+ " - a bound slide whose section has a footer fills its template's own footer: its label "
102
+ "slot keeps its label, its number slot holds {{slide:number}} / {{slide:count}} in place of "
103
+ "the template's sample number (that number is placeholder), and the logo goes inside the "
104
+ "label's span, never as a third child of the footer row\n"
105
+ " - a bound slide whose section has a footer never adds the deck style's footer piece, "
106
+ "even when the piece's use line says every slide: the footer piece is only for slides "
107
+ "without a footer of their own. Remove a second footer rather than add one\n"
108
+ " - a bound slide whose section lacks a footer uses the deck style's footer piece, "
109
+ "exactly as an unbound slide does, as its example_html shows\n"
110
+ " - on a dark slide (a divider or a dark closing slide), the footer uses the "
111
+ "light-on-dark logo that the footer piece's use line names\n"
112
+ " - Do not drop white or any other treatment class from the outer root\n"
80
113
  " - Without a deck style (deck_style absent), skip this block: the other rules apply as "
81
114
  "written"
82
115
  )
@@ -633,14 +633,56 @@ def _root_tokens(css: str) -> dict[str, str]:
633
633
  return tokens
634
634
 
635
635
 
636
- def deck_style_context(token_css: str, style_block: str) -> dict:
636
+ _MAX_LOGOS = 12
637
+ _LOGO_KINDS = {"logo": 0, "lockup": 1}
638
+ # Filename markers of a reverse (dark-ground) variant. Bare "dark" is left out: it
639
+ # often names the dark-coloured mark for a light ground.
640
+ _REVERSE_MARKERS = ("reverse", "reversed", "inverse", "white", "negative", "knockout", "on-dark")
641
+
642
+
643
+ def rank_logos(rows: Any) -> list[dict]:
644
+ """The brand marks the architect is shown: ``{handle, filename}`` rows, at most 12.
645
+
646
+ ``rows`` are mappings with ``handle``, ``filename``, ``kind`` and optionally
647
+ ``mime``. Only kinds ``logo`` and ``lockup`` are kept. There is no ground
648
+ metadata, so the order is a filename heuristic. The rows split by ground:
649
+ reverse variants carry a marker in :data:`_REVERSE_MARKERS`, the rest are
650
+ default-ground. Each ground is ordered ``logo`` before ``lockup``, then SVG
651
+ (by mime or extension) before raster, then filename. The two grounds then
652
+ alternate, default first (best default, best reverse, next default, ...),
653
+ and the cap applies last. A real library holds hundreds of product lockups,
654
+ so without the alternation the cap would keep no mark for a dark ground.
655
+ """
656
+
657
+ def _key(row: Mapping) -> tuple:
658
+ name = str(row.get("filename") or "")
659
+ low = name.lower()
660
+ is_svg = str(row.get("mime") or "").lower() == "image/svg+xml" or low.endswith(".svg")
661
+ return (_LOGO_KINDS[str(row.get("kind") or "").lower()], not is_svg, name)
662
+
663
+ def _is_reverse(row: Mapping) -> bool:
664
+ low = str(row.get("filename") or "").lower()
665
+ return any(marker in low for marker in _REVERSE_MARKERS)
666
+
667
+ kept = [r for r in rows if str(r.get("kind") or "").lower() in _LOGO_KINDS]
668
+ default = sorted((r for r in kept if not _is_reverse(r)), key=_key)
669
+ reverse = sorted((r for r in kept if _is_reverse(r)), key=_key)
670
+ ranked: list = []
671
+ for i in range(max(len(default), len(reverse))):
672
+ ranked += default[i : i + 1] + reverse[i : i + 1]
673
+ return [{"handle": r["handle"], "filename": r["filename"]} for r in ranked[:_MAX_LOGOS]]
674
+
675
+
676
+ def deck_style_context(token_css: str, style_block: str, logos: Any = ()) -> dict:
637
677
  """Design tokens and template classes the architect may reference.
638
678
 
639
679
  ``design_tokens`` are the ``:root`` custom properties of both inputs.
640
680
  ``template_classes`` are the sorted unique classes of ``style_block``, capped
641
- at 300. Font data never appears.
681
+ at 300. ``logos`` are the rows given (see :func:`rank_logos`), unchanged.
682
+ Font data never appears.
642
683
  """
643
684
  return {
644
685
  "design_tokens": {**_root_tokens(token_css), **_root_tokens(style_block)},
645
686
  "template_classes": sorted(css_class_names(style_block))[:_MAX_TEMPLATE_CLASSES],
687
+ "logos": list(logos),
646
688
  }