detectkit 0.73.0__tar.gz → 0.74.0__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 (212) hide show
  1. {detectkit-0.73.0/detectkit.egg-info → detectkit-0.74.0}/PKG-INFO +1 -1
  2. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/__init__.py +1 -1
  3. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/assets/claude/rules/cli.md +4 -1
  4. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/assets/claude/rules/metrics.md +4 -0
  5. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/config/project_config.py +47 -0
  6. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/control/events.py +8 -2
  7. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/control/queries.py +71 -10
  8. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/control/relations.py +60 -9
  9. detectkit-0.74.0/detectkit/reporting/assets/report.js +84 -0
  10. {detectkit-0.73.0 → detectkit-0.74.0/detectkit.egg-info}/PKG-INFO +1 -1
  11. detectkit-0.73.0/detectkit/reporting/assets/report.js +0 -80
  12. {detectkit-0.73.0 → detectkit-0.74.0}/LICENSE +0 -0
  13. {detectkit-0.73.0 → detectkit-0.74.0}/MANIFEST.in +0 -0
  14. {detectkit-0.73.0 → detectkit-0.74.0}/README.md +0 -0
  15. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/alerting/__init__.py +0 -0
  16. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/alerting/channels/__init__.py +0 -0
  17. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/alerting/channels/base.py +0 -0
  18. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/alerting/channels/branding.py +0 -0
  19. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/alerting/channels/discord.py +0 -0
  20. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/alerting/channels/email.py +0 -0
  21. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/alerting/channels/factory.py +0 -0
  22. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/alerting/channels/googlechat.py +0 -0
  23. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/alerting/channels/mattermost.py +0 -0
  24. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/alerting/channels/ntfy.py +0 -0
  25. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/alerting/channels/slack.py +0 -0
  26. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/alerting/channels/teams.py +0 -0
  27. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/alerting/channels/telegram.py +0 -0
  28. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/alerting/channels/webhook.py +0 -0
  29. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/alerting/orchestrator/__init__.py +0 -0
  30. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/alerting/orchestrator/_base.py +0 -0
  31. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/alerting/orchestrator/_cooldown.py +0 -0
  32. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/alerting/orchestrator/_decision.py +0 -0
  33. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/alerting/orchestrator/_dispatch.py +0 -0
  34. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/alerting/orchestrator/_recovery.py +0 -0
  35. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/alerting/orchestrator/_replay.py +0 -0
  36. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/alerting/orchestrator/_types.py +0 -0
  37. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/alerting/orchestrator/orchestrator.py +0 -0
  38. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/autotune/__init__.py +0 -0
  39. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/autotune/_base.py +0 -0
  40. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/autotune/_types.py +0 -0
  41. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/autotune/alert_sim.py +0 -0
  42. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/autotune/autotuner.py +0 -0
  43. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/autotune/axis_spec.py +0 -0
  44. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/autotune/config_emitter.py +0 -0
  45. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/autotune/crossval.py +0 -0
  46. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/autotune/detector_select.py +0 -0
  47. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/autotune/distribution.py +0 -0
  48. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/autotune/grid_search.py +0 -0
  49. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/autotune/key_select.py +0 -0
  50. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/autotune/labels.py +0 -0
  51. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/autotune/profile_engine.py +0 -0
  52. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/autotune/result.py +0 -0
  53. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/autotune/runner.py +0 -0
  54. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/autotune/scoring.py +0 -0
  55. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/autotune/seasonality_search.py +0 -0
  56. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/autotune/settings.py +0 -0
  57. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/autotune/window_select.py +0 -0
  58. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/__init__.py +0 -0
  59. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/_output.py +0 -0
  60. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/assets/claude/CLAUDE.section.md +0 -0
  61. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/assets/claude/rules/alerting.md +0 -0
  62. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/assets/claude/rules/autotune.md +0 -0
  63. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/assets/claude/rules/detectors.md +0 -0
  64. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/assets/claude/rules/overview.md +0 -0
  65. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/assets/claude/rules/project.md +0 -0
  66. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/assets/claude/skills/dtk-autotune/SKILL.md +0 -0
  67. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/assets/claude/skills/dtk-feedback/SKILL.md +0 -0
  68. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/assets/claude/skills/dtk-new-metric/SKILL.md +0 -0
  69. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/assets/claude/skills/dtk-setup-project/SKILL.md +0 -0
  70. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/assets/claude/skills/dtk-tune/SKILL.md +0 -0
  71. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/commands/__init__.py +0 -0
  72. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/commands/autotune.py +0 -0
  73. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/commands/clean.py +0 -0
  74. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/commands/init.py +0 -0
  75. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/commands/init_claude.py +0 -0
  76. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/commands/lineage.py +0 -0
  77. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/commands/mcp.py +0 -0
  78. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/commands/osi.py +0 -0
  79. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/commands/run.py +0 -0
  80. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/commands/serve.py +0 -0
  81. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/commands/test_alert.py +0 -0
  82. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/commands/tune.py +0 -0
  83. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/commands/ui.py +0 -0
  84. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/commands/unlock.py +0 -0
  85. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/cli/main.py +0 -0
  86. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/config/__init__.py +0 -0
  87. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/config/lineage.py +0 -0
  88. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/config/metric_config.py +0 -0
  89. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/config/metric_io.py +0 -0
  90. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/config/profile.py +0 -0
  91. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/config/validator.py +0 -0
  92. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/control/__init__.py +0 -0
  93. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/control/actions.py +0 -0
  94. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/control/actor.py +0 -0
  95. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/control/advise.py +0 -0
  96. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/control/commands.py +0 -0
  97. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/control/confirm.py +0 -0
  98. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/control/drafts.py +0 -0
  99. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/control/errors.py +0 -0
  100. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/control/health.py +0 -0
  101. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/control/jobs.py +0 -0
  102. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/control/metric_files.py +0 -0
  103. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/control/overview.py +0 -0
  104. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/control/project.py +0 -0
  105. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/control/proposals.py +0 -0
  106. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/control/registry.py +0 -0
  107. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/control/roles.py +0 -0
  108. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/control/serialize.py +0 -0
  109. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/control/yaml_patch.py +0 -0
  110. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/core/__init__.py +0 -0
  111. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/core/interval.py +0 -0
  112. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/core/models.py +0 -0
  113. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/database/__init__.py +0 -0
  114. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/database/_sql_manager.py +0 -0
  115. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/database/bigquery_manager.py +0 -0
  116. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/database/clickhouse_manager.py +0 -0
  117. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/database/duckdb_manager.py +0 -0
  118. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/database/internal_tables/__init__.py +0 -0
  119. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/database/internal_tables/_alert_states.py +0 -0
  120. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/database/internal_tables/_autotune_runs.py +0 -0
  121. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/database/internal_tables/_base.py +0 -0
  122. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/database/internal_tables/_datapoints.py +0 -0
  123. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/database/internal_tables/_detections.py +0 -0
  124. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/database/internal_tables/_maintenance.py +0 -0
  125. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/database/internal_tables/_metrics.py +0 -0
  126. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/database/internal_tables/_platform.py +0 -0
  127. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/database/internal_tables/_schema.py +0 -0
  128. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/database/internal_tables/_tasks.py +0 -0
  129. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/database/internal_tables/manager.py +0 -0
  130. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/database/manager.py +0 -0
  131. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/database/mysql_manager.py +0 -0
  132. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/database/postgres_manager.py +0 -0
  133. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/database/snowflake_manager.py +0 -0
  134. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/database/source_manager.py +0 -0
  135. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/database/tables.py +0 -0
  136. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/detectors/__init__.py +0 -0
  137. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/detectors/base.py +0 -0
  138. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/detectors/factory.py +0 -0
  139. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/detectors/seasonality.py +0 -0
  140. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/detectors/statistical/__init__.py +0 -0
  141. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/detectors/statistical/_baseline.py +0 -0
  142. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/detectors/statistical/_windowed.py +0 -0
  143. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/detectors/statistical/autoreg.py +0 -0
  144. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/detectors/statistical/iqr.py +0 -0
  145. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/detectors/statistical/mad.py +0 -0
  146. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/detectors/statistical/manual_bounds.py +0 -0
  147. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/detectors/statistical/zscore.py +0 -0
  148. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/loaders/__init__.py +0 -0
  149. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/loaders/errors.py +0 -0
  150. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/loaders/metric_loader.py +0 -0
  151. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/loaders/query_template.py +0 -0
  152. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/mcp/__init__.py +0 -0
  153. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/mcp/context.py +0 -0
  154. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/mcp/descriptions.py +0 -0
  155. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/mcp/errors.py +0 -0
  156. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/mcp/server.py +0 -0
  157. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/mcp/tools.py +0 -0
  158. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/orchestration/__init__.py +0 -0
  159. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/orchestration/error_dispatch.py +0 -0
  160. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/orchestration/task_manager/__init__.py +0 -0
  161. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/orchestration/task_manager/_alert_step.py +0 -0
  162. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/orchestration/task_manager/_base.py +0 -0
  163. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/orchestration/task_manager/_detect_step.py +0 -0
  164. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/orchestration/task_manager/_load_step.py +0 -0
  165. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/orchestration/task_manager/_types.py +0 -0
  166. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/orchestration/task_manager/manager.py +0 -0
  167. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/reporting/__init__.py +0 -0
  168. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/reporting/builder.py +0 -0
  169. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/reporting/html_report.py +0 -0
  170. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/semantic/__init__.py +0 -0
  171. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/semantic/errors.py +0 -0
  172. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/semantic/exporter.py +0 -0
  173. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/semantic/importer.py +0 -0
  174. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/semantic/osi_model.py +0 -0
  175. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/semantic/query_gen.py +0 -0
  176. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/semantic/sources.py +0 -0
  177. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/serve/__init__.py +0 -0
  178. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/serve/api_v1.py +0 -0
  179. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/serve/app.py +0 -0
  180. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/serve/errors.py +0 -0
  181. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/serve/forge.py +0 -0
  182. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/serve/mcp_app.py +0 -0
  183. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/serve/platform.py +0 -0
  184. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/serve/projects.py +0 -0
  185. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/serve/server.py +0 -0
  186. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/serve/settings.py +0 -0
  187. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/serve/web.py +0 -0
  188. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/serve/write_tools.py +0 -0
  189. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/tuning/__init__.py +0 -0
  190. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/tuning/assets/tune.js +0 -0
  191. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/tuning/config_writer.py +0 -0
  192. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/tuning/html.py +0 -0
  193. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/tuning/payload.py +0 -0
  194. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/tuning/server.py +0 -0
  195. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/ui/__init__.py +0 -0
  196. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/ui/assets/ui.js +0 -0
  197. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/ui/html.py +0 -0
  198. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/ui/server.py +0 -0
  199. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/utils/__init__.py +0 -0
  200. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/utils/datetime_utils.py +0 -0
  201. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/utils/env_interpolation.py +0 -0
  202. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/utils/json_utils.py +0 -0
  203. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit/utils/stats.py +0 -0
  204. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit.egg-info/SOURCES.txt +0 -0
  205. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit.egg-info/dependency_links.txt +0 -0
  206. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit.egg-info/entry_points.txt +0 -0
  207. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit.egg-info/requires.txt +0 -0
  208. {detectkit-0.73.0 → detectkit-0.74.0}/detectkit.egg-info/top_level.txt +0 -0
  209. {detectkit-0.73.0 → detectkit-0.74.0}/pyproject.toml +0 -0
  210. {detectkit-0.73.0 → detectkit-0.74.0}/requirements.txt +0 -0
  211. {detectkit-0.73.0 → detectkit-0.74.0}/setup.cfg +0 -0
  212. {detectkit-0.73.0 → detectkit-0.74.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: detectkit
3
- Version: 0.73.0
3
+ Version: 0.74.0
4
4
  Summary: Metric monitoring with automatic anomaly detection
5
5
  Author: detectkit team
6
6
  License: MIT
@@ -4,7 +4,7 @@ detectk - Anomaly Detection for Time-Series Metrics
4
4
  A Python library for data analysts and engineers to monitor metrics with automatic anomaly detection.
5
5
  """
6
6
 
7
- __version__ = "0.73.0"
7
+ __version__ = "0.74.0"
8
8
 
9
9
  from detectkit.core.interval import Interval
10
10
  from detectkit.core.models import ColumnDefinition, TableModel
@@ -412,7 +412,10 @@ dispatches), `get_autotune_history`, `get_incidents`, `get_related_metrics`
412
412
  (a metric's family by declared `lineage` + metrics reading the same table),
413
413
  `list_anomaly_events` / `get_anomaly_event` (what broke, grouped into events
414
414
  across metrics by `lineage` and shared source tables — metrics that only
415
- overlapped in time are listed as `also_anomalous`, never merged),
415
+ overlapped in time are listed as `also_anomalous`, never merged; the project's
416
+ `correlation.scope_tags` limits same-source/neighbour reads to metrics sharing a
417
+ scope, and the `dtk ui` / `dtk serve` per-metric report shows a "Part of anomaly
418
+ events" section),
416
419
  `get_server_info`.
417
420
  Channel connection details/secrets in `profiles.yml` are never exposed —
418
421
  `get_metric` lists alerting channels by name only.
@@ -79,6 +79,10 @@ guarantee for generated metrics. `dtk lineage` checks the whole project and prin
79
79
  the families. The MCP tool `get_related_metrics` returns a metric's family plus the
80
80
  metrics reading the same source table. Metadata only: no id changes, and the pipeline
81
81
  never reads it. When the user generates metrics in bulk, write `lineage` on each one.
82
+ On a big project, the project-level `correlation: {scope_tags: [product_a, ...]}`
83
+ splits same-source relations and event neighbours into scopes: a metric belongs to the
84
+ scope of each listed tag in its `tags` (none listed = one shared "rest" scope).
85
+ Declared `lineage` crosses scopes. Metadata only.
82
86
 
83
87
  `false_alert_budget` is a per-metric **target false-alert rate** (a fraction in
84
88
  `(0, 1]`) the `dtk tune` cockpit gently flags when exceeded. It overrides the
@@ -129,6 +129,47 @@ class ProjectErrorAlertingConfig(BaseModel):
129
129
  )
130
130
 
131
131
 
132
+ class ProjectCorrelationConfig(BaseModel):
133
+ """How metrics are grouped for cross-metric reads (RFC 0002).
134
+
135
+ ``scope_tags`` splits the project into **scopes**: a metric belongs to the
136
+ scope of each listed tag it carries, and a metric carrying none of them
137
+ belongs to one shared "rest" scope. Same-source relations (and the "also
138
+ anomalous" neighbours of an anomaly event) are found only between metrics
139
+ that share a scope, and a shared-dimension table is judged per scope.
140
+ Declared ``lineage`` crosses scopes: it is a statement, not an inference.
141
+ Unset or empty, the whole project is one scope (the default).
142
+ """
143
+
144
+ scope_tags: list[str] = Field(
145
+ default_factory=list,
146
+ description=(
147
+ "Metric tags that split the project into correlation scopes. Unset: "
148
+ "the whole project is one scope."
149
+ ),
150
+ )
151
+
152
+ @field_validator("scope_tags")
153
+ @classmethod
154
+ def validate_scope_tags(cls, v: list[str]) -> list[str]:
155
+ """Tags are non-empty strings; order is kept, duplicates dropped."""
156
+ out: list[str] = []
157
+ for tag in v:
158
+ tag = tag.strip() if isinstance(tag, str) else tag
159
+ if not isinstance(tag, str) or not tag:
160
+ raise ValueError("correlation.scope_tags entries must be non-empty tag names")
161
+ if tag not in out:
162
+ out.append(tag)
163
+ return out
164
+
165
+ def scopes_of(self, tags: "list[str] | None") -> frozenset[str]:
166
+ """The scopes a metric with *tags* belongs to (``""`` = the rest scope)."""
167
+ if not self.scope_tags:
168
+ return frozenset({""})
169
+ mine = frozenset(t for t in self.scope_tags if t in (tags or []))
170
+ return mine or frozenset({""})
171
+
172
+
132
173
  class ProjectConfig(BaseModel):
133
174
  """
134
175
  Project configuration loaded from detectkit_project.yml.
@@ -223,6 +264,12 @@ class ProjectConfig(BaseModel):
223
264
  "project fails to load. Default `optional`."
224
265
  ),
225
266
  )
267
+ # Correlation scopes for the cross-metric reads (RFC 0002): anomaly events and
268
+ # get_related_metrics. Read-only metadata — the pipeline never consults it.
269
+ correlation: ProjectCorrelationConfig = Field(
270
+ default_factory=ProjectCorrelationConfig,
271
+ description="Cross-metric correlation settings (scope_tags).",
272
+ )
226
273
  # Project-wide default data-maturity delay. Useful when every metric reads
227
274
  # from the same upstream pipeline (e.g. one dbt project that finishes a few
228
275
  # minutes after each interval closes). A per-metric ``loading_delay``
@@ -21,7 +21,7 @@ alert replay: no state, no writes.
21
21
  from __future__ import annotations
22
22
 
23
23
  import hashlib
24
- from collections.abc import Iterable
24
+ from collections.abc import Callable, Iterable
25
25
  from dataclasses import dataclass, field
26
26
  from datetime import datetime, timedelta
27
27
  from typing import Any
@@ -213,12 +213,15 @@ def build_events(
213
213
  pairs: dict[frozenset[str], dict[str, Any]],
214
214
  roles: dict[str, dict[str, str]],
215
215
  totals: set[str],
216
+ same_scope: Callable[[str, str], bool] | None = None,
216
217
  ) -> list[Event]:
217
218
  """Group *episodes* into events along structural edges; newest first.
218
219
 
219
220
  *pairs* is :func:`~detectkit.control.relations.relation_pairs`; *roles* maps a
220
221
  metric to ``{other: relation}`` from its own point of view (``total``, ``slice``,
221
222
  ``sibling``, …); *totals* are the metrics that are a family's total.
223
+ *same_scope* (``correlation.scope_tags``) limits the ``also_anomalous``
224
+ neighbours to metrics sharing a scope with a member; ``None`` = one scope.
222
225
  """
223
226
  n = len(episodes)
224
227
  uf = _Union(n)
@@ -302,7 +305,10 @@ def build_events(
302
305
  for k, other in enumerate(episodes):
303
306
  if comp_of[k] == root or other.metric in metrics:
304
307
  continue
305
- if any(other.overlaps(e) for e in eps):
308
+ if any(
309
+ other.overlaps(e) and (same_scope is None or same_scope(e.metric, other.metric))
310
+ for e in eps
311
+ ):
306
312
  neighbours.append(
307
313
  {
308
314
  "metric": other.metric,
@@ -505,24 +505,31 @@ def get_incidents(project: ProjectHandle, metric: str) -> dict[str, Any]:
505
505
  def get_related_metrics(project: ProjectHandle, name: str) -> dict[str, Any]:
506
506
  """How the other in-scope metrics relate to *name* by structure (declared + SQL)."""
507
507
  from detectkit.config.lineage import structural_relations # noqa: PLC0415
508
- from detectkit.control.relations import source_index # noqa: PLC0415
508
+ from detectkit.control.relations import metric_scopes, scope_source_indexes # noqa: PLC0415
509
509
 
510
510
  _path, me = project.require_metric(name)
511
511
  configs = [config for _p, config in project.metrics]
512
- index = source_index(project, configs)
513
- my_tables, my_error = index.sources[name]
514
- same_source = [
515
- {"metric": other, "tables": tables} for other, tables in index.same_source(name).items()
516
- ]
512
+ indexes = scope_source_indexes(project, configs)
513
+ mine = [indexes[scope] for scope in sorted(metric_scopes(project, me))]
514
+ my_tables, my_error = mine[0].sources[name]
515
+ found: dict[str, set[str]] = {}
516
+ shared: set[str] = set()
517
+ peers: set[str] = set()
518
+ for index in mine:
519
+ for other, tables in index.same_source(name).items():
520
+ found.setdefault(other, set()).update(tables)
521
+ shared.update(index.shared)
522
+ peers.update(index.sources)
523
+ same_source = [{"metric": other, "tables": sorted(found[other])} for other in sorted(found)]
517
524
  return {
518
525
  "metric": name,
519
526
  "lineage": me.lineage.to_public() if me.lineage else None,
520
527
  "structural": structural_relations(name, configs),
521
528
  "sources": my_tables,
522
529
  "sources_error": my_error,
523
- "shared_tables": [t for t in index.shared if t in set(my_tables or [])],
530
+ "shared_tables": sorted(t for t in shared if t in set(my_tables or [])),
524
531
  "same_source": same_source,
525
- "scope_metrics": len(configs),
532
+ "scope_metrics": len(peers),
526
533
  }
527
534
 
528
535
 
@@ -606,7 +613,7 @@ def _event_episodes(
606
613
  def _anomaly_events(project: ProjectHandle, window: str, selector: str) -> tuple[list[Any], int]:
607
614
  from detectkit.config.lineage import structural_relations # noqa: PLC0415
608
615
  from detectkit.control.events import build_events # noqa: PLC0415
609
- from detectkit.control.relations import relation_pairs # noqa: PLC0415
616
+ from detectkit.control.relations import relation_pairs, scope_peers # noqa: PLC0415
610
617
 
611
618
  episodes, configs, scanned = _event_episodes(project, window, selector)
612
619
  pairs = relation_pairs(project, configs)
@@ -619,7 +626,10 @@ def _anomaly_events(project: ProjectHandle, window: str, selector: str) -> tuple
619
626
  for c in configs
620
627
  if c.lineage is not None and c.lineage.measure is not None and not c.lineage.slice
621
628
  }
622
- return build_events(episodes, pairs, roles, totals), scanned
629
+ same_scope = (
630
+ scope_peers(project, configs) if project.project_config.correlation.scope_tags else None
631
+ )
632
+ return build_events(episodes, pairs, roles, totals, same_scope), scanned
623
633
 
624
634
 
625
635
  def _event_public(event: Any, *, full: bool) -> dict[str, Any]:
@@ -691,6 +701,48 @@ def get_anomaly_event(project: ProjectHandle, event_id: str, window: str = "7d")
691
701
  )
692
702
 
693
703
 
704
+ def metric_report_events(project: ProjectHandle, name: str, window: str) -> list[dict[str, Any]]:
705
+ """The anomaly events *name* took part in with other metrics, shaped for its report.
706
+
707
+ Only events the listing would show (a member alerted) that involve another
708
+ metric — as a member or as an ``also_anomalous`` neighbour; a metric alone
709
+ is already told by the report's own alerts. Timestamps are ms epoch, the
710
+ report payload's unit. Newest first.
711
+ """
712
+ events, _scanned = _anomaly_events(project, window, "*")
713
+ out: list[dict[str, Any]] = []
714
+ for event in events:
715
+ mine = [m for m in event.members if m["metric"] == name]
716
+ if not mine or not any(m["alerted"] for m in event.members):
717
+ continue
718
+ others = []
719
+ seen: set[str] = {name}
720
+ for m in event.members:
721
+ if m["metric"] in seen:
722
+ continue
723
+ seen.add(m["metric"])
724
+ others.append({"metric": m["metric"], "role": m["role"], "alerted": m["alerted"]})
725
+ also = sorted({n["metric"] for n in event.also_anomalous})
726
+ if not others and not also:
727
+ continue
728
+ me = mine[0]
729
+ out.append(
730
+ {
731
+ "id": event.id,
732
+ "start": _ms(event.start),
733
+ "end": _ms(event.end),
734
+ "open": event.open,
735
+ "headline": event.headline,
736
+ "role": me["role"],
737
+ "deviation": num_or_none(me.get("deviation")),
738
+ "share_of_headline_deviation": num_or_none(me.get("share_of_headline_deviation")),
739
+ "with": others,
740
+ "also_anomalous": also,
741
+ }
742
+ )
743
+ return out
744
+
745
+
694
746
  def get_server_info(project: ProjectHandle) -> dict[str, Any]:
695
747
  profiles = project.profiles_config
696
748
  profile = profiles.get_profile(project.profile_name) if profiles is not None else None
@@ -812,6 +864,15 @@ def metric_report_html(project: ProjectHandle, name: str, window: str) -> str:
812
864
  generated_at=now_utc_naive().strftime("%Y-%m-%d %H:%M UTC"),
813
865
  project_loading_delay=project.project_config.loading_delay,
814
866
  )
867
+ period = payload.get("period") or {}
868
+ if period.get("end"):
869
+ try:
870
+ events = metric_report_events(project, name, window)
871
+ except Exception: # noqa: BLE001 - the report never fails over its events line
872
+ events = []
873
+ events = [e for e in events if e["end"] >= period["start"] and e["start"] <= period["end"]]
874
+ if events:
875
+ payload["events"] = events
815
876
  return render_report_html(payload)
816
877
 
817
878
 
@@ -6,6 +6,11 @@ other's measure), and by **same source** when their SQL reads a common table tha
6
6
  not a shared dimension. A table read by more than half of the scope (and by at least
7
7
  :data:`SHARED_TABLE_MIN` metrics) is a shared dimension — a calendar grid, a users
8
8
  table — and relates nothing.
9
+
10
+ ``correlation.scope_tags`` (project config) splits the project into **scopes**:
11
+ same-source relations and shared dimensions are worked out inside each scope, and
12
+ two metrics in no common scope are never same-source related. Declared lineage
13
+ ignores scopes. Without ``scope_tags`` the whole project is one scope.
9
14
  """
10
15
 
11
16
  from __future__ import annotations
@@ -76,8 +81,16 @@ class SourceIndex:
76
81
  return out
77
82
 
78
83
 
79
- def source_index(project: ProjectHandle, configs: list[MetricConfig]) -> SourceIndex:
80
- sources = {config.name: metric_sources(project, config) for config in configs}
84
+ def source_index(
85
+ project: ProjectHandle,
86
+ configs: list[MetricConfig],
87
+ sources: dict[str, tuple[list[str] | None, str | None]] | None = None,
88
+ ) -> SourceIndex:
89
+ """The source index over *configs* (one scope); *sources* reuses parsed SQL."""
90
+ if sources is None:
91
+ sources = {config.name: metric_sources(project, config) for config in configs}
92
+ else:
93
+ sources = {config.name: sources[config.name] for config in configs}
81
94
  readers: dict[str, set[str]] = {}
82
95
  for metric, (tables, _err) in sources.items():
83
96
  for table in tables or []:
@@ -87,23 +100,61 @@ def source_index(project: ProjectHandle, configs: list[MetricConfig]) -> SourceI
87
100
  return SourceIndex(sources=sources, shared=shared)
88
101
 
89
102
 
103
+ def metric_scopes(project: ProjectHandle, config: MetricConfig) -> frozenset[str]:
104
+ """The correlation scopes *config* belongs to (``""`` = the rest scope)."""
105
+ return project.project_config.correlation.scopes_of(config.tags)
106
+
107
+
108
+ def scoped_configs(
109
+ project: ProjectHandle, configs: list[MetricConfig]
110
+ ) -> dict[str, list[MetricConfig]]:
111
+ """*configs* grouped by scope; one ``""`` scope when no ``scope_tags`` are set."""
112
+ groups: dict[str, list[MetricConfig]] = {}
113
+ for config in configs:
114
+ for scope in sorted(metric_scopes(project, config)):
115
+ groups.setdefault(scope, []).append(config)
116
+ return groups
117
+
118
+
119
+ def scope_peers(project: ProjectHandle, configs: list[MetricConfig]) -> Any:
120
+ """A ``same_scope(a, b) -> bool`` predicate over metric names in *configs*."""
121
+ scopes = {config.name: metric_scopes(project, config) for config in configs}
122
+
123
+ def same_scope(a: str, b: str) -> bool:
124
+ return bool(scopes.get(a, frozenset({""})) & scopes.get(b, frozenset({""})))
125
+
126
+ return same_scope
127
+
128
+
129
+ def scope_source_indexes(
130
+ project: ProjectHandle, configs: list[MetricConfig]
131
+ ) -> dict[str, SourceIndex]:
132
+ """One :class:`SourceIndex` per scope, every metric's SQL parsed once."""
133
+ sources = {config.name: metric_sources(project, config) for config in configs}
134
+ return {
135
+ scope: source_index(project, members, sources)
136
+ for scope, members in scoped_configs(project, configs).items()
137
+ }
138
+
139
+
90
140
  def relation_pairs(
91
141
  project: ProjectHandle, configs: list[MetricConfig]
92
142
  ) -> dict[frozenset[str], dict[str, Any]]:
93
143
  """Every related pair in *configs*: ``{frozenset({a, b}): {reason, detail}}``.
94
144
 
95
145
  ``reason`` is ``lineage`` (one family, or a ratio and its parts) or
96
- ``same_source`` (a common non-shared table); lineage wins when both hold.
146
+ ``same_source`` (a common non-shared table, within a scope); lineage wins when
147
+ both hold.
97
148
  """
98
149
  from detectkit.config.lineage import structural_relations # noqa: PLC0415
99
150
 
100
151
  pairs: dict[frozenset[str], dict[str, Any]] = {}
101
- index = source_index(project, configs)
102
- for config in configs:
103
- for other, tables in index.same_source(config.name).items():
104
- pairs.setdefault(
105
- frozenset({config.name, other}), {"reason": "same_source", "tables": tables}
106
- )
152
+ for index in scope_source_indexes(project, configs).values():
153
+ for name in index.sources:
154
+ for other, tables in index.same_source(name).items():
155
+ pairs.setdefault(
156
+ frozenset({name, other}), {"reason": "same_source", "tables": tables}
157
+ )
107
158
  for config in configs:
108
159
  for rel in structural_relations(config.name, configs):
109
160
  key = frozenset({config.name, rel["metric"]})
@@ -0,0 +1,84 @@
1
+ "use strict";(()=>{var ye={"--term-bg":"#211e1a","--clay":"#d15b36","--st-anomaly":"#d63232","--st-recovery":"#36a64f","--st-nodata":"#f0ad4e","--st-error":"#5a7a8c","--faint":"#9a9384","--muted":"#6e675b","--border":"#332f29","--term-border":"#332f29"};function C(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()||ye[e]||"#888"}function $e(e){let t=e.replace("#","").trim();t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);let n=parseInt(t,16);return t.length!==6||Number.isNaN(n)?[209,91,54]:[n>>16&255,n>>8&255,n&255]}function N(e,t){let[n,i,s]=$e(e);return`rgba(${n},${i},${s},${t})`}function te(e){let t=Math.max(1,window.devicePixelRatio||1),n=e.clientWidth||e.offsetWidth||0,i=e.clientHeight||e.offsetHeight||0;return e.width=Math.round(n*t),e.height=Math.round(i*t),t}function ne(e,t,n,i){let s=()=>e.width-(t.l+t.r)*i,l=()=>e.height-(t.t+t.b)*i,r=()=>n.tmax-n.tmin||1,a=()=>n.vmax-n.vmin||1;return{px:f=>t.l*i+(f-n.tmin)/r()*s(),py:f=>e.height-t.b*i-(f-n.vmin)/a()*l(),tAt:f=>n.tmin+(f-t.l*i)/(s()||1)*r(),vAt:f=>n.vmin+(e.height-t.b*i-f)/(l()||1)*a(),plotW:s,plotH:l,tspan:r}}var B=Number.isFinite;function re(e,t,n,i,s,l,r,a,h,b,v,m){let f=t.length,T=Math.max(1,Math.round(r)),S=s-i||1,_=0;for(let g=0;g<f;g++){let u=n[g];!B(u)||t[g]<i||t[g]>s||_++}if(e.strokeStyle=b,e.lineWidth=v*m,e.lineJoin="round",e.beginPath(),_<=T){let g=!1;for(let u=0;u<f;u++){let p=n[u],$=t[u];if(!B(p)||$<i||$>s){g=!1;continue}let E=a($),R=h(p);g?e.lineTo(E,R):(e.moveTo(E,R),g=!0)}}else{let g=new Array(T).fill(null),u=new Array(T).fill(null);for(let $=0;$<f;$++){let E=n[$],R=t[$];if(!B(E)||R<i||R>s)continue;let A=Math.floor((R-i)/S*(T-1));A=A<0?0:A>T-1?T-1:A,(g[A]===null||E<g[A])&&(g[A]=E),(u[A]===null||E>u[A])&&(u[A]=E)}let p=!1;for(let $=0;$<T;$++){if(u[$]===null){p=!1;continue}let E=l+$,R=h(u[$]),A=h(g[$]);p?e.lineTo(E,R):(e.moveTo(E,R),p=!0),e.lineTo(E,A)}}e.stroke()}function oe(e){let t=[],n=-1;for(let i=0;i<e.length;i++){let s=e[i];s.lo!==null&&s.hi!==null&&B(s.lo)&&B(s.hi)?n===-1&&(n=i):n!==-1&&(t.push([n,i-1]),n=-1)}return n!==-1&&t.push([n,e.length-1]),t}function ie(e,t,n,i,s,l,r,a,h){e.fillStyle=N(l,r);for(let[b,v]of n){e.beginPath(),e.moveTo(i(t[b].t),s(t[b].hi));for(let m=b+1;m<=v;m++)e.lineTo(i(t[m].t),s(t[m].hi));for(let m=v;m>=b;m--)e.lineTo(i(t[m].t),s(t[m].lo));e.closePath(),e.fill()}e.strokeStyle=N(l,a),e.lineWidth=1*h;for(let[b,v]of n)for(let m of["hi","lo"]){e.beginPath();for(let f=b;f<=v;f++){let T=i(t[f].t),S=s(t[f][m]);f===b?e.moveTo(T,S):e.lineTo(T,S)}e.stroke()}}function se(e,t,n,i,s,l,r,a){for(let h=0;h<t.length;h++){let b=t[h];if(!B(b.v)||b.t<n||b.t>i)continue;let v=s(b.t),m=l(b.v);e.fillStyle=N(r,.18),e.beginPath(),e.arc(v,m,6*a,0,Math.PI*2),e.fill(),e.fillStyle=r,e.beginPath(),e.arc(v,m,3*a,0,Math.PI*2),e.fill()}}function ae(e,t,n,i,s,l,r,a,h,b,v){e.font=`${11*v}px ui-monospace, 'JetBrains Mono', monospace`,e.textBaseline="middle";for(let f=0;f<=4;f++){let T=i.vmin+(i.vmax-i.vmin)*f/4,S=l(T);e.strokeStyle=N(h,.1),e.lineWidth=1*v,e.beginPath(),e.moveTo(n.l*v,S),e.lineTo(t.width-n.r*v,S),e.stroke(),e.fillStyle=b,e.textAlign="right",e.fillText(W(T),(n.l-8)*v,S)}e.textBaseline="top";let m=a-r||1;for(let f=0;f<=5;f++){let T=r+m*f/5,S=s(T);e.fillStyle=b,e.textAlign=f===0?"left":f===5?"right":"center",e.fillText(Me(T,m),S,(t.height-n.b+7)*v)}}function W(e){let t=Math.abs(e);return t>=1e3?e.toFixed(0):t>=10?e.toFixed(1):t>=1?e.toFixed(2):e.toFixed(3)}function Me(e,t){let n=new Date(e).toISOString();return t<2*864e5?n.slice(5,16).replace("T"," "):n.slice(5,10)}function V(e){return new Date(e).toISOString().slice(0,19).replace("T"," ")}function G(e){let t=Math.round(e/6e4);if(t<60)return t+"m";let n=Math.floor(t/60),i=t%60;if(n<24)return n+"h"+(i?" "+i+"m":"");let s=Math.floor(n/24),l=n%24;return s+"d"+(l?" "+l+"h":"")}function le(e,t,n){return{left:t.l*n,top:t.t*n,right:e.width-t.r*n,bottom:e.height-t.b*n}}function ce(e,t,n,i,s,l,r){let a=le(t,n,i),h=Math.max(a.left,Math.min(s(l),a.right));h<=a.left+.5||(e.save(),e.fillStyle="rgba(17,15,13,0.42)",e.fillRect(a.left,a.top,h-a.left,a.bottom-a.top),e.strokeStyle=N(C("--faint"),.7),e.lineWidth=1*i,e.setLineDash([4*i,4*i]),e.beginPath(),e.moveTo(h,a.top),e.lineTo(h,a.bottom),e.stroke(),e.setLineDash([]),e.fillStyle=N(C("--faint"),.95),e.font=`${10*i}px ui-monospace, monospace`,e.textAlign="left",e.textBaseline="top",e.fillText(r,h+6*i,a.top+5*i),e.restore())}function de(e,t,n,i,s,l,r){let a=le(t,n,i),h=5*i;e.save();for(let b=0;b<l.length;b++){let v=l[b],m=s(v.t);if(m<a.left-1||m>a.right+1)continue;let f=r(v.kind);e.strokeStyle=N(f,.45),e.lineWidth=1*i,e.beginPath(),e.moveTo(m,a.top),e.lineTo(m,a.bottom),e.stroke(),e.fillStyle=f,e.beginPath(),e.moveTo(m-h,a.top),e.lineTo(m+h,a.top),e.lineTo(m,a.top+h*1.4),e.closePath(),e.fill()}e.restore()}var L={l:56,r:16,t:14,b:28},Te=300*1e3,d="dtk-report";function Z(e){return e==="recovery"?C("--st-recovery"):e==="no_data"?C("--st-nodata"):C("--st-anomaly")}function Ae(e){return e==="recovery"?"recovery":e==="no_data"?"no-data":"anomaly"}var y=e=>String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),j=(e,t,n)=>Math.max(t,Math.min(n,e)),ue=["--clay","--st-error","--st-recovery","--st-nodata"];function Se(e,t){_e(),t.classList.add(d),t.innerHTML="";let n=document.createElement("div");n.className="dtk-report-root",t.appendChild(n);let i=new Map;for(let u of e.points)u.v!==null&&i.set(u.t,u.v);let s=e.detectors.map((u,p)=>{let $=u.effective_start,E=u.points.map(A=>$!==null&&A.t<$?{t:A.t,lo:null,hi:null}:{t:A.t,lo:A.lo,hi:A.hi}),R=[];for(let A of u.points)if(A.a===1&&($===null||A.t>=$)){let I=i.get(A.t);I!==void 0&&R.push({t:A.t,v:I})}return{det:u,band:E,anomalies:R,effectiveStart:$,color:C(ue[p%ue.length]),shown:p===0}});s.length===1&&(s[0].shown=!0),n.appendChild(Ee(e));let l=null;s.length>1&&(l=Ce(s,()=>m.repaint()),n.appendChild(l));let r=document.createElement("div");r.className="dtk-bar",n.appendChild(r);let a=document.createElement("div");a.className="dtk-presets",r.appendChild(a);let h=document.createElement("div");h.className="dtk-readout",h.textContent="hover the chart for a point readout",r.appendChild(h);let b=document.createElement("div");b.className="dtk-chart";let v=document.createElement("canvas");b.appendChild(v),n.appendChild(b);let m=De(v,e,s,i,u=>{h.innerHTML=u}),f=[{label:"24h",ms:24*3600*1e3},{label:"7d",ms:7*86400*1e3},{label:"30d",ms:30*86400*1e3},{label:"All",ms:null}];for(let u of f){let p=document.createElement("button");p.className="dtk-preset",p.textContent=u.label,p.onclick=()=>{u.ms===null?m.resetView():m.setView(e.period.end-u.ms,e.period.end),Ne(a,p)},a.appendChild(p)}let T=document.createElement("label");T.className="dtk-zero",T.title="Draw a horizontal line at y = 0 and scale the chart to include zero.";let S=document.createElement("input");S.type="checkbox",S.onchange=()=>m.setZeroLine(S.checked),T.appendChild(S),T.appendChild(document.createTextNode(" y = 0")),a.appendChild(T),e.events&&e.events.length>0&&n.appendChild(Pe(e.events,u=>{let p=Math.max(6*e.interval_seconds*1e3,.2*(u.end-u.start));m.setView(u.start-p,u.end+p),a.querySelectorAll(".dtk-preset").forEach($=>$.classList.remove("active"))})),n.appendChild(Le(e,u=>m.focusAlert(u))),m.resize();let _=0,g=()=>{_||(_=requestAnimationFrame(()=>{_=0,m.resize()}))};window.addEventListener("resize",g)}function Ee(e){let t=document.createElement("div");t.className="dtk-header";let n=e.interval_seconds/60,i=e.interval_seconds>=86400?e.interval_seconds/86400+"d":e.interval_seconds>=3600?e.interval_seconds/3600+"h":n>=1?n+"min":e.interval_seconds+"s",s=e.project?`${y(e.project)} \xB7 ${y(e.metric)}`:y(e.metric),l=e.summary;return t.innerHTML=`<div class="dtk-h-top"><h1 class="dtk-title">${s}</h1><div class="dtk-meta">${y(V(e.period.start))} \u2013 ${y(V(e.period.end))} \xB7 interval ${y(i)}${e.generated_at?` \xB7 generated ${y(e.generated_at)}`:""}</div></div>`+(e.description?`<p class="dtk-desc">${y(e.description)}</p>`:"")+'<div class="dtk-chips">'+K("anomalies",l.anomalies,"--st-anomaly")+K("alerts",l.alerts,"--clay")+K("recoveries",l.recoveries,"--st-recovery")+K("no-data",l.no_data,"--st-nodata")+"</div>",t}function K(e,t,n){let i=C(n);return`<span class="dtk-chip"><span class="dtk-dot" style="background:${y(i)}"></span><span class="dtk-chip-n">${t}</span><span class="dtk-chip-l">${y(e)}</span></span>`}function Ce(e,t){let n=document.createElement("div");return n.className="dtk-legend",e.forEach(i=>{let s=document.createElement("button");s.className="dtk-legend-item"+(i.shown?"":" off"),s.innerHTML=`<span class="dtk-swatch" style="background:${y(i.color)}"></span><span class="dtk-legend-name">${y(i.det.name)}</span><span class="dtk-legend-id">${y(i.det.id.slice(0,8))}</span><span class="dtk-legend-n">${i.det.anomaly_count}</span>`,s.onclick=()=>{i.shown=!i.shown,s.classList.toggle("off",!i.shown),t()},n.appendChild(s)}),n}function Le(e,t){let n=document.createElement("div");n.className="dtk-alerts";let i=document.createElement("div");if(i.className="dtk-alerts-head",i.textContent=`Alerts (${e.alerts.length})`,n.appendChild(i),e.alerts.length===0){let r=document.createElement("div");return r.className="dtk-alerts-empty",r.textContent="No alerts fired in this period.",n.appendChild(r),n}let s=document.createElement("div");s.className="dtk-alerts-list";let l=[...e.alerts].sort((r,a)=>a.t-r.t);for(let r of l){let a=document.createElement("button");a.className="dtk-alert-row";let h=Z(r.kind),b=r.direction!=="none"?` \xB7 ${y(r.direction)}`:"",v=r.severity>0?` \xB7 sev ${r.severity.toFixed(2)}`:"",m=r.value!==null?` \xB7 value ${W(r.value)}`:"",f=r.onset!==null&&r.kind!=="no_data"?` \xB7 ${G(Math.max(0,r.t-r.onset))} (${r.consecutive} pts)`:"";a.innerHTML=`<span class="dtk-alert-time">${y(V(r.t))}</span><span class="dtk-badge" style="background:${y(N(h,.18))};color:${y(h)};border-color:${y(N(h,.5))}">${y(Ae(r.kind))}</span><span class="dtk-alert-body"><span class="dtk-alert-rule">${y(r.rule)}</span><span class="dtk-alert-sub">${y(r.detector)}${b}${v}${m}${y(f)}</span></span>`,a.onclick=()=>t(r),s.appendChild(a)}return n.appendChild(s),n}function me(e){return e.replace(/_/g," ")}function Re(e){let t=e*100;return(t>0?"+":"")+(Math.abs(t)<10?t.toFixed(1):t.toFixed(0))+"%"}function Pe(e,t){let n=document.createElement("div");n.className="dtk-alerts dtk-events";let i=document.createElement("div");i.className="dtk-alerts-head",i.textContent=`Part of anomaly events with other metrics (${e.length})`,n.appendChild(i);let s=document.createElement("div");s.className="dtk-alerts-list";for(let l of[...e].sort((r,a)=>a.start-r.start)){let r=document.createElement("button");r.className="dtk-alert-row",r.title=`event ${l.id} \u2014 click to zoom the chart to it`;let a=l.share_of_headline_deviation,h=l.role!=="headline"?`${me(l.role)} of ${l.headline}`+(a!==null?` \xB7 ${Math.round(a*100)}% of its deviation`:""):l.with.length?"leads the event":"no related metric broke with it",b=l.deviation!==null?` \xB7 ${Re(l.deviation)} off the band center`:"",v=l.with.length?"with "+l.with.map(S=>`${S.metric} (${me(S.role)}${S.alerted?", alerted":""})`).join(", "):"",m=l.also_anomalous.length?`also anomalous, unrelated: ${l.also_anomalous.join(", ")}`:"",f=[v,m].filter(Boolean).join(" \xB7 "),T=`${V(l.start)} \xB7 ${G(Math.max(0,l.end-l.start))}${l.open?" \xB7 ongoing":""}`;r.innerHTML=`<span class="dtk-alert-time">${y(T)}</span><span class="dtk-alert-body"><span class="dtk-alert-rule">${y(h+b)}</span><span class="dtk-alert-sub">${y(f)}</span></span>`,r.onclick=()=>t(l),s.appendChild(r)}return n.appendChild(s),n}function Ne(e,t){e.querySelectorAll(".dtk-preset").forEach(n=>n.classList.remove("active")),t.classList.add("active")}function De(e,t,n,i,s){let l=e.getContext("2d");if(!l)throw new Error("report: 2D context unavailable");let r=l,a=t.points.map(o=>o.t),h=t.points.map(o=>o.v===null?NaN:o.v),b=t.period.start,v=t.period.end,m=v-b||1,f=Math.min(Te,m),T=0,S=1,_=!1;E();let g=b,u=v,p=1,$=null;function E(){let o=1/0,c=-1/0;for(let w of h)Number.isFinite(w)&&(w<o&&(o=w),w>c&&(c=w));for(let w of n)for(let k of w.band)k.lo!==null&&Number.isFinite(k.lo)&&k.lo<o&&(o=k.lo),k.hi!==null&&Number.isFinite(k.hi)&&k.hi>c&&(c=k.hi);(!Number.isFinite(o)||!Number.isFinite(c))&&(o=0,c=1),_&&(o>0&&(o=0),c<0&&(c=0)),c<=o&&(c=o+1);let x=(c-o)*.06;T=o-x,S=c+x}function R(o){_!==o&&(_=o,E(),O())}function A(){for(let o of n)if(o.shown&&o.effectiveStart!==null)return o.effectiveStart;for(let o of n)if(o.effectiveStart!==null)return o.effectiveStart;return null}function I(){return{tmin:g,tmax:u,vmin:T,vmax:S}}function pe(){return ne(e,L,I(),p)}function X(o,c){let x=c-o;if(x<f){let w=(o+c)/2;o=w-f/2,c=w+f/2,x=f}x>=m&&(o=b,c=v),o<b&&(c+=b-o,o=b),c>v&&(o-=c-v,c=v),g=j(o,b,v),u=j(c,b,v),O()}function J(){g=b,u=v,O()}function be(o){let c=o.onset!==null?Math.min(o.onset,o.t):o.t,x=o.t,k=Math.max(x-c,f)*1.5+f;X(c-k,x+k)}let Y=0;function q(){Y===0&&(Y=requestAnimationFrame(O))}function O(){if(Y=0,e.width===0||e.height===0)return;let o=pe(),c=C("--faint"),x=C("--muted"),w=C("--clay");if(r.fillStyle=C("--term-bg"),r.fillRect(0,0,e.width,e.height),a.length===0)return;if(ae(r,e,L,I(),o.px,o.py,g,u,c,x,p),_&&T<=0&&S>=0){let M=o.py(0);r.strokeStyle=N(x,.6),r.lineWidth=1.25*p,r.beginPath(),r.moveTo(L.l*p,M),r.lineTo(e.width-L.r*p,M),r.stroke(),r.fillStyle=x,r.textAlign="right",r.textBaseline="middle",r.fillText("0",(L.l-8)*p,M)}r.save(),r.beginPath(),r.rect(L.l*p,L.t*p,o.plotW(),o.plotH()),r.clip();let k=L.t*p,D=o.plotH();for(let M of t.alerts){if(M.onset===null||M.kind==="no_data")continue;let F=Math.min(M.onset,M.t),Q=Math.max(M.onset,M.t);if(Q<g||F>u)continue;let ge=Z(M.kind),ee=o.px(F),we=o.px(Q);r.fillStyle=N(ge,.08),r.fillRect(ee,k,Math.max(we-ee,1*p),D)}for(let M of n){if(!M.shown)continue;let F=oe(M.band);ie(r,M.band,F,o.px,o.py,M.color,.13,.4,p)}re(r,a,h,g,u,L.l*p,o.plotW(),o.px,o.py,w,1.5,p);for(let M of n)M.shown&&se(r,M.anomalies,g,u,o.px,o.py,C("--st-anomaly"),p);let P=A();P!==null&&P>g&&ce(r,e,L,p,o.px,P,"detection at full power \u2192");let H=t.alerts.map(M=>({t:M.t,kind:M.kind}));de(r,e,L,p,o.px,H,M=>Z(M)),$!==null&&ve(o,k,D,c),r.restore()}function he(o){let c=a;if(c.length===0)return-1;let x=0,w=c.length-1;for(;x<w;){let k=x+w>>1;c[k]<o?x=k+1:w=k}return x>0&&o-c[x-1]<c[x]-o&&(x-=1),x}function ve(o,c,x,w){let k=he($);if(k<0)return;let D=a[k];if(D<g||D>u){s("hover the chart for a point readout");return}let P=o.px(D);r.strokeStyle=N(w,.45),r.lineWidth=1*p,r.setLineDash([2*p,2*p]),r.beginPath(),r.moveTo(P,c),r.lineTo(P,c+x),r.stroke(),r.setLineDash([]);let H=h[k];if(Number.isFinite(H)){let M=o.py(H);r.fillStyle=C("--term-bg"),r.beginPath(),r.arc(P,M,4*p,0,Math.PI*2),r.fill(),r.strokeStyle=C("--clay"),r.lineWidth=2*p,r.beginPath(),r.arc(P,M,4*p,0,Math.PI*2),r.stroke()}xe(k)}function xe(o){let c=a[o],x=h[o],w=`<span class="dtk-ro-t">${y(V(c))}</span>`;w+=`<span class="dtk-ro-v">value ${Number.isFinite(x)?W(x):"\u2014"}</span>`;for(let k of n){if(!k.shown)continue;let D=k.band[o],P=k.det.points[o];if(D&&D.lo!==null&&D.hi!==null){let H=P&&P.a===1,M=H&&P.sev!==null?` sev ${P.sev.toFixed(2)}`:"",F=H?`<span class="dtk-ro-anom" style="color:${y(C("--st-anomaly"))}">anomaly${y(M)}</span>`:'<span class="dtk-ro-ok">ok</span>';w+=`<span class="dtk-ro-det"><span class="dtk-swatch" style="background:${y(k.color)}"></span>${y(k.det.name)}: [${W(D.lo)}, ${W(D.hi)}] ${F}</span>`}}s(w)}function U(o){let c=e.getBoundingClientRect(),x=(o-c.left-L.l)/(c.width-(L.l+L.r)||1);return g+j(x,0,1)*(u-g)}e.addEventListener("wheel",o=>{o.preventDefault();let c=U(o.clientX),x=u-g,w=j(x*Math.pow(1.0015,o.deltaY),f,m),k=(c-g)/(x||1);X(c-k*w,c-k*w+w)},{passive:!1});let z=null;e.addEventListener("mousedown",o=>{z={x:o.clientX,vMin:g,vMax:u},e.style.cursor="grabbing"}),window.addEventListener("mousemove",o=>{if(!z)return;let c=e.getBoundingClientRect(),x=(z.vMax-z.vMin)/(c.width-(L.l+L.r)||1),w=(o.clientX-z.x)*x;X(z.vMin-w,z.vMax-w)}),window.addEventListener("mouseup",()=>{z&&(z=null,e.style.cursor="crosshair")}),e.addEventListener("mousemove",o=>{z||($=U(o.clientX),q())}),e.addEventListener("mouseleave",()=>{$!==null&&($=null,s("hover the chart for a point readout"),q())}),e.addEventListener("dblclick",()=>J()),e.style.cursor="crosshair";function ke(){p=te(e),O()}return{repaint:()=>q(),resize:ke,setView:X,resetView:J,focusAlert:be,setZeroLine:R}}var fe=!1;function _e(){if(fe)return;fe=!0;let e=`
2
+ .${d}{--term-bg:#211e1a;--term-border:#332f29;--term-text:#c9c2b4;
3
+ --clay:#d15b36;--clay-700:#b4471f;--ink:#1b1916;--paper:#f5f1e8;--surface:#fbf9f3;
4
+ --border:#e6e0d4;--muted:#6e675b;--faint:#9a9384;
5
+ --anom:#d63232;--rec:#36a64f;--nod:#f0ad4e;
6
+ --sans:'Schibsted Grotesk',ui-sans-serif,system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
7
+ --mono:'JetBrains Mono',ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
8
+ font-family:var(--sans);color:var(--ink);}
9
+ .${d} *{box-sizing:border-box;}
10
+ .${d} .dtk-report-root{max-width:1100px;margin:0 auto;padding:20px 18px 40px;}
11
+ /* --- header row ----------------------------------------------------------- */
12
+ .${d} .dtk-header{margin-bottom:16px;padding-left:12px;
13
+ border-left:3px solid var(--clay);}
14
+ .${d} .dtk-h-top{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 14px;}
15
+ .${d} .dtk-title{font-size:21px;font-weight:700;margin:0;color:var(--ink);
16
+ font-family:var(--sans);letter-spacing:-0.01em;}
17
+ .${d} .dtk-meta{font-size:12px;color:var(--muted);font-family:var(--mono);}
18
+ .${d} .dtk-desc{margin:8px 0 0;font-size:13px;color:var(--muted);max-width:760px;
19
+ line-height:1.5;}
20
+ /* --- summary chips (surface cards) ---------------------------------------- */
21
+ .${d} .dtk-chips{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px;}
22
+ .${d} .dtk-chip{display:inline-flex;align-items:center;gap:7px;padding:5px 11px;
23
+ background:var(--surface);border:1px solid var(--border);border-radius:10px;font-size:12px;}
24
+ .${d} .dtk-dot{width:8px;height:8px;border-radius:50%;display:inline-block;}
25
+ .${d} .dtk-chip-n{font-weight:700;font-family:var(--mono);color:var(--ink);}
26
+ .${d} .dtk-chip-l{color:var(--faint);font-family:var(--mono);font-size:11px;
27
+ text-transform:uppercase;letter-spacing:0.05em;}
28
+ /* --- detector legend ------------------------------------------------------ */
29
+ .${d} .dtk-legend{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:10px;}
30
+ .${d} .dtk-legend-item{display:inline-flex;align-items:center;gap:7px;padding:5px 11px;
31
+ background:var(--surface);border:1px solid var(--border);border-radius:8px;cursor:pointer;
32
+ color:var(--ink);font-size:12px;font-family:var(--sans);transition:border-color .12s ease;}
33
+ .${d} .dtk-legend-item:hover{border-color:var(--clay);}
34
+ .${d} .dtk-legend-item.off{opacity:0.45;}
35
+ .${d} .dtk-legend-id{color:var(--faint);font-family:var(--mono);font-size:11px;}
36
+ .${d} .dtk-legend-n{color:var(--anom);font-weight:700;font-family:var(--mono);}
37
+ .${d} .dtk-swatch{width:10px;height:10px;border-radius:2px;display:inline-block;}
38
+ /* --- toolbar (presets + readout) ------------------------------------------ */
39
+ .${d} .dtk-bar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;
40
+ gap:8px;margin-bottom:8px;}
41
+ .${d} .dtk-presets{display:flex;gap:5px;}
42
+ .${d} .dtk-preset{padding:5px 13px;background:var(--surface);
43
+ border:1px solid var(--border);border-radius:8px;color:var(--muted);cursor:pointer;
44
+ font-size:12px;font-family:var(--sans);transition:border-color .12s ease,color .12s ease;}
45
+ .${d} .dtk-preset:hover{border-color:var(--clay);color:var(--ink);}
46
+ .${d} .dtk-preset.active{background:var(--clay);color:#fff;border-color:var(--clay);}
47
+ .${d} .dtk-zero{display:inline-flex;align-items:center;gap:5px;margin-left:6px;
48
+ font-size:12px;color:var(--muted);font-family:var(--sans);cursor:pointer;user-select:none;}
49
+ .${d} .dtk-zero input{accent-color:var(--clay);cursor:pointer;}
50
+ .${d} .dtk-readout{font-size:11px;color:var(--muted);
51
+ font-family:var(--mono);display:flex;flex-wrap:wrap;gap:4px 12px;align-items:center;}
52
+ .${d} .dtk-readout .dtk-swatch{margin-right:4px;}
53
+ .${d} .dtk-ro-t{font-weight:700;color:var(--ink);}
54
+ /* --- chart panel (dark terminal surface) ---------------------------------- */
55
+ .${d} .dtk-chart{position:relative;width:100%;height:360px;background:var(--term-bg);
56
+ border:1px solid var(--term-border);border-radius:12px;overflow:hidden;
57
+ box-shadow:0 24px 60px -30px rgba(27,25,22,.45);}
58
+ .${d} .dtk-chart canvas{width:100%;height:100%;display:block;}
59
+ /* --- alerts list (surface cards) ------------------------------------------ */
60
+ .${d} .dtk-alerts{margin-top:18px;}
61
+ .${d} .dtk-alerts-head{font-size:12px;font-weight:600;color:var(--faint);
62
+ margin-bottom:9px;font-family:var(--mono);text-transform:uppercase;letter-spacing:0.06em;}
63
+ .${d} .dtk-alerts-empty{font-size:13px;color:var(--muted);padding:8px 0;}
64
+ .${d} .dtk-alerts-list{display:flex;flex-direction:column;gap:5px;
65
+ max-height:340px;overflow:auto;}
66
+ .${d} .dtk-alert-row{display:flex;align-items:center;gap:10px;width:100%;text-align:left;
67
+ padding:8px 11px;background:var(--surface);border:1px solid var(--border);
68
+ border-radius:8px;cursor:pointer;color:var(--ink);font-family:var(--sans);
69
+ transition:border-color .12s ease,box-shadow .12s ease;}
70
+ .${d} .dtk-alert-row:hover{border-color:var(--clay);
71
+ box-shadow:0 4px 14px -8px rgba(27,25,22,.35);}
72
+ .${d} .dtk-alert-time{font-size:11px;color:var(--muted);
73
+ font-family:var(--mono);white-space:nowrap;min-width:142px;}
74
+ .${d} .dtk-badge{display:inline-block;padding:1px 8px;border-radius:10px;font-size:11px;
75
+ font-weight:700;border:1px solid;text-transform:uppercase;letter-spacing:0.03em;white-space:nowrap;}
76
+ .${d} .dtk-alert-body{display:flex;flex-direction:column;gap:2px;min-width:0;}
77
+ .${d} .dtk-alert-rule{font-size:12px;color:var(--ink);
78
+ font-family:var(--mono);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
79
+ .${d} .dtk-alert-sub{font-size:11px;color:var(--muted);}
80
+ .${d} .dtk-events .dtk-alert-row{flex-direction:column;align-items:flex-start;gap:3px;}
81
+ .${d} .dtk-events .dtk-alert-time{min-width:0;}
82
+ .${d} .dtk-events .dtk-alert-rule,.${d} .dtk-events .dtk-alert-sub{
83
+ white-space:normal;}
84
+ `,t=document.createElement("style");t.setAttribute("data-dtk-report",""),t.textContent=e,document.head.appendChild(t)}window.__DTK_REPORT__={render:Se};})();
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: detectkit
3
- Version: 0.73.0
3
+ Version: 0.74.0
4
4
  Summary: Metric monitoring with automatic anomaly detection
5
5
  Author: detectkit team
6
6
  License: MIT
@@ -1,80 +0,0 @@
1
- "use strict";(()=>{var ye={"--term-bg":"#211e1a","--clay":"#d15b36","--st-anomaly":"#d63232","--st-recovery":"#36a64f","--st-nodata":"#f0ad4e","--st-error":"#5a7a8c","--faint":"#9a9384","--muted":"#6e675b","--border":"#332f29","--term-border":"#332f29"};function E(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()||ye[e]||"#888"}function we(e){let t=e.replace("#","").trim();t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);let n=parseInt(t,16);return t.length!==6||Number.isNaN(n)?[209,91,54]:[n>>16&255,n>>8&255,n&255]}function D(e,t){let[n,i,s]=we(e);return`rgba(${n},${i},${s},${t})`}function ee(e){let t=Math.max(1,window.devicePixelRatio||1),n=e.clientWidth||e.offsetWidth||0,i=e.clientHeight||e.offsetHeight||0;return e.width=Math.round(n*t),e.height=Math.round(i*t),t}function te(e,t,n,i){let s=()=>e.width-(t.l+t.r)*i,v=()=>e.height-(t.t+t.b)*i,r=()=>n.tmax-n.tmin||1,a=()=>n.vmax-n.vmin||1;return{px:u=>t.l*i+(u-n.tmin)/r()*s(),py:u=>e.height-t.b*i-(u-n.vmin)/a()*v(),tAt:u=>n.tmin+(u-t.l*i)/(s()||1)*r(),vAt:u=>n.vmin+(e.height-t.b*i-u)/(v()||1)*a(),plotW:s,plotH:v,tspan:r}}var F=Number.isFinite;function ne(e,t,n,i,s,v,r,a,b,f,h,d){let u=t.length,A=Math.max(1,Math.round(r)),S=s-i||1,z=0;for(let g=0;g<u;g++){let m=n[g];!F(m)||t[g]<i||t[g]>s||z++}if(e.strokeStyle=f,e.lineWidth=h*d,e.lineJoin="round",e.beginPath(),z<=A){let g=!1;for(let m=0;m<u;m++){let p=n[m],$=t[m];if(!F(p)||$<i||$>s){g=!1;continue}let C=a($),R=b(p);g?e.lineTo(C,R):(e.moveTo(C,R),g=!0)}}else{let g=new Array(A).fill(null),m=new Array(A).fill(null);for(let $=0;$<u;$++){let C=n[$],R=t[$];if(!F(C)||R<i||R>s)continue;let T=Math.floor((R-i)/S*(A-1));T=T<0?0:T>A-1?A-1:T,(g[T]===null||C<g[T])&&(g[T]=C),(m[T]===null||C>m[T])&&(m[T]=C)}let p=!1;for(let $=0;$<A;$++){if(m[$]===null){p=!1;continue}let C=v+$,R=b(m[$]),T=b(g[$]);p?e.lineTo(C,R):(e.moveTo(C,R),p=!0),e.lineTo(C,T)}}e.stroke()}function re(e){let t=[],n=-1;for(let i=0;i<e.length;i++){let s=e[i];s.lo!==null&&s.hi!==null&&F(s.lo)&&F(s.hi)?n===-1&&(n=i):n!==-1&&(t.push([n,i-1]),n=-1)}return n!==-1&&t.push([n,e.length-1]),t}function oe(e,t,n,i,s,v,r,a,b){e.fillStyle=D(v,r);for(let[f,h]of n){e.beginPath(),e.moveTo(i(t[f].t),s(t[f].hi));for(let d=f+1;d<=h;d++)e.lineTo(i(t[d].t),s(t[d].hi));for(let d=h;d>=f;d--)e.lineTo(i(t[d].t),s(t[d].lo));e.closePath(),e.fill()}e.strokeStyle=D(v,a),e.lineWidth=1*b;for(let[f,h]of n)for(let d of["hi","lo"]){e.beginPath();for(let u=f;u<=h;u++){let A=i(t[u].t),S=s(t[u][d]);u===f?e.moveTo(A,S):e.lineTo(A,S)}e.stroke()}}function ie(e,t,n,i,s,v,r,a){for(let b=0;b<t.length;b++){let f=t[b];if(!F(f.v)||f.t<n||f.t>i)continue;let h=s(f.t),d=v(f.v);e.fillStyle=D(r,.18),e.beginPath(),e.arc(h,d,6*a,0,Math.PI*2),e.fill(),e.fillStyle=r,e.beginPath(),e.arc(h,d,3*a,0,Math.PI*2),e.fill()}}function se(e,t,n,i,s,v,r,a,b,f,h){e.font=`${11*h}px ui-monospace, 'JetBrains Mono', monospace`,e.textBaseline="middle";for(let u=0;u<=4;u++){let A=i.vmin+(i.vmax-i.vmin)*u/4,S=v(A);e.strokeStyle=D(b,.1),e.lineWidth=1*h,e.beginPath(),e.moveTo(n.l*h,S),e.lineTo(t.width-n.r*h,S),e.stroke(),e.fillStyle=f,e.textAlign="right",e.fillText(W(A),(n.l-8)*h,S)}e.textBaseline="top";let d=a-r||1;for(let u=0;u<=5;u++){let A=r+d*u/5,S=s(A);e.fillStyle=f,e.textAlign=u===0?"left":u===5?"right":"center",e.fillText($e(A,d),S,(t.height-n.b+7)*h)}}function W(e){let t=Math.abs(e);return t>=1e3?e.toFixed(0):t>=10?e.toFixed(1):t>=1?e.toFixed(2):e.toFixed(3)}function $e(e,t){let n=new Date(e).toISOString();return t<2*864e5?n.slice(5,16).replace("T"," "):n.slice(5,10)}function O(e){return new Date(e).toISOString().slice(0,19).replace("T"," ")}function ae(e){let t=Math.round(e/6e4);if(t<60)return t+"m";let n=Math.floor(t/60),i=t%60;if(n<24)return n+"h"+(i?" "+i+"m":"");let s=Math.floor(n/24),v=n%24;return s+"d"+(v?" "+v+"h":"")}function le(e,t,n){return{left:t.l*n,top:t.t*n,right:e.width-t.r*n,bottom:e.height-t.b*n}}function ce(e,t,n,i,s,v,r){let a=le(t,n,i),b=Math.max(a.left,Math.min(s(v),a.right));b<=a.left+.5||(e.save(),e.fillStyle="rgba(17,15,13,0.42)",e.fillRect(a.left,a.top,b-a.left,a.bottom-a.top),e.strokeStyle=D(E("--faint"),.7),e.lineWidth=1*i,e.setLineDash([4*i,4*i]),e.beginPath(),e.moveTo(b,a.top),e.lineTo(b,a.bottom),e.stroke(),e.setLineDash([]),e.fillStyle=D(E("--faint"),.95),e.font=`${10*i}px ui-monospace, monospace`,e.textAlign="left",e.textBaseline="top",e.fillText(r,b+6*i,a.top+5*i),e.restore())}function de(e,t,n,i,s,v,r){let a=le(t,n,i),b=5*i;e.save();for(let f=0;f<v.length;f++){let h=v[f],d=s(h.t);if(d<a.left-1||d>a.right+1)continue;let u=r(h.kind);e.strokeStyle=D(u,.45),e.lineWidth=1*i,e.beginPath(),e.moveTo(d,a.top),e.lineTo(d,a.bottom),e.stroke(),e.fillStyle=u,e.beginPath(),e.moveTo(d-b,a.top),e.lineTo(d+b,a.top),e.lineTo(d,a.top+b*1.4),e.closePath(),e.fill()}e.restore()}var L={l:56,r:16,t:14,b:28},Me=300*1e3,c="dtk-report";function G(e){return e==="recovery"?E("--st-recovery"):e==="no_data"?E("--st-nodata"):E("--st-anomaly")}function Ae(e){return e==="recovery"?"recovery":e==="no_data"?"no-data":"anomaly"}var M=e=>String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),K=(e,t,n)=>Math.max(t,Math.min(n,e)),ue=["--clay","--st-error","--st-recovery","--st-nodata"];function Te(e,t){Pe(),t.classList.add(c),t.innerHTML="";let n=document.createElement("div");n.className="dtk-report-root",t.appendChild(n);let i=new Map;for(let m of e.points)m.v!==null&&i.set(m.t,m.v);let s=e.detectors.map((m,p)=>{let $=m.effective_start,C=m.points.map(T=>$!==null&&T.t<$?{t:T.t,lo:null,hi:null}:{t:T.t,lo:T.lo,hi:T.hi}),R=[];for(let T of m.points)if(T.a===1&&($===null||T.t>=$)){let I=i.get(T.t);I!==void 0&&R.push({t:T.t,v:I})}return{det:m,band:C,anomalies:R,effectiveStart:$,color:E(ue[p%ue.length]),shown:p===0}});s.length===1&&(s[0].shown=!0),n.appendChild(Se(e));let v=null;s.length>1&&(v=Ce(s,()=>d.repaint()),n.appendChild(v));let r=document.createElement("div");r.className="dtk-bar",n.appendChild(r);let a=document.createElement("div");a.className="dtk-presets",r.appendChild(a);let b=document.createElement("div");b.className="dtk-readout",b.textContent="hover the chart for a point readout",r.appendChild(b);let f=document.createElement("div");f.className="dtk-chart";let h=document.createElement("canvas");f.appendChild(h),n.appendChild(f);let d=Re(h,e,s,i,m=>{b.innerHTML=m}),u=[{label:"24h",ms:24*3600*1e3},{label:"7d",ms:7*86400*1e3},{label:"30d",ms:30*86400*1e3},{label:"All",ms:null}];for(let m of u){let p=document.createElement("button");p.className="dtk-preset",p.textContent=m.label,p.onclick=()=>{m.ms===null?d.resetView():d.setView(e.period.end-m.ms,e.period.end),Le(a,p)},a.appendChild(p)}let A=document.createElement("label");A.className="dtk-zero",A.title="Draw a horizontal line at y = 0 and scale the chart to include zero.";let S=document.createElement("input");S.type="checkbox",S.onchange=()=>d.setZeroLine(S.checked),A.appendChild(S),A.appendChild(document.createTextNode(" y = 0")),a.appendChild(A),n.appendChild(Ee(e,m=>d.focusAlert(m))),d.resize();let z=0,g=()=>{z||(z=requestAnimationFrame(()=>{z=0,d.resize()}))};window.addEventListener("resize",g)}function Se(e){let t=document.createElement("div");t.className="dtk-header";let n=e.interval_seconds/60,i=e.interval_seconds>=86400?e.interval_seconds/86400+"d":e.interval_seconds>=3600?e.interval_seconds/3600+"h":n>=1?n+"min":e.interval_seconds+"s",s=e.project?`${M(e.project)} \xB7 ${M(e.metric)}`:M(e.metric),v=e.summary;return t.innerHTML=`<div class="dtk-h-top"><h1 class="dtk-title">${s}</h1><div class="dtk-meta">${M(O(e.period.start))} \u2013 ${M(O(e.period.end))} \xB7 interval ${M(i)}${e.generated_at?` \xB7 generated ${M(e.generated_at)}`:""}</div></div>`+(e.description?`<p class="dtk-desc">${M(e.description)}</p>`:"")+'<div class="dtk-chips">'+Y("anomalies",v.anomalies,"--st-anomaly")+Y("alerts",v.alerts,"--clay")+Y("recoveries",v.recoveries,"--st-recovery")+Y("no-data",v.no_data,"--st-nodata")+"</div>",t}function Y(e,t,n){let i=E(n);return`<span class="dtk-chip"><span class="dtk-dot" style="background:${M(i)}"></span><span class="dtk-chip-n">${t}</span><span class="dtk-chip-l">${M(e)}</span></span>`}function Ce(e,t){let n=document.createElement("div");return n.className="dtk-legend",e.forEach(i=>{let s=document.createElement("button");s.className="dtk-legend-item"+(i.shown?"":" off"),s.innerHTML=`<span class="dtk-swatch" style="background:${M(i.color)}"></span><span class="dtk-legend-name">${M(i.det.name)}</span><span class="dtk-legend-id">${M(i.det.id.slice(0,8))}</span><span class="dtk-legend-n">${i.det.anomaly_count}</span>`,s.onclick=()=>{i.shown=!i.shown,s.classList.toggle("off",!i.shown),t()},n.appendChild(s)}),n}function Ee(e,t){let n=document.createElement("div");n.className="dtk-alerts";let i=document.createElement("div");if(i.className="dtk-alerts-head",i.textContent=`Alerts (${e.alerts.length})`,n.appendChild(i),e.alerts.length===0){let r=document.createElement("div");return r.className="dtk-alerts-empty",r.textContent="No alerts fired in this period.",n.appendChild(r),n}let s=document.createElement("div");s.className="dtk-alerts-list";let v=[...e.alerts].sort((r,a)=>a.t-r.t);for(let r of v){let a=document.createElement("button");a.className="dtk-alert-row";let b=G(r.kind),f=r.direction!=="none"?` \xB7 ${M(r.direction)}`:"",h=r.severity>0?` \xB7 sev ${r.severity.toFixed(2)}`:"",d=r.value!==null?` \xB7 value ${W(r.value)}`:"",u=r.onset!==null&&r.kind!=="no_data"?` \xB7 ${ae(Math.max(0,r.t-r.onset))} (${r.consecutive} pts)`:"";a.innerHTML=`<span class="dtk-alert-time">${M(O(r.t))}</span><span class="dtk-badge" style="background:${M(D(b,.18))};color:${M(b)};border-color:${M(D(b,.5))}">${M(Ae(r.kind))}</span><span class="dtk-alert-body"><span class="dtk-alert-rule">${M(r.rule)}</span><span class="dtk-alert-sub">${M(r.detector)}${f}${h}${d}${M(u)}</span></span>`,a.onclick=()=>t(r),s.appendChild(a)}return n.appendChild(s),n}function Le(e,t){e.querySelectorAll(".dtk-preset").forEach(n=>n.classList.remove("active")),t.classList.add("active")}function Re(e,t,n,i,s){let v=e.getContext("2d");if(!v)throw new Error("report: 2D context unavailable");let r=v,a=t.points.map(o=>o.t),b=t.points.map(o=>o.v===null?NaN:o.v),f=t.period.start,h=t.period.end,d=h-f||1,u=Math.min(Me,d),A=0,S=1,z=!1;C();let g=f,m=h,p=1,$=null;function C(){let o=1/0,l=-1/0;for(let y of b)Number.isFinite(y)&&(y<o&&(o=y),y>l&&(l=y));for(let y of n)for(let k of y.band)k.lo!==null&&Number.isFinite(k.lo)&&k.lo<o&&(o=k.lo),k.hi!==null&&Number.isFinite(k.hi)&&k.hi>l&&(l=k.hi);(!Number.isFinite(o)||!Number.isFinite(l))&&(o=0,l=1),z&&(o>0&&(o=0),l<0&&(l=0)),l<=o&&(l=o+1);let x=(l-o)*.06;A=o-x,S=l+x}function R(o){z!==o&&(z=o,C(),V())}function T(){for(let o of n)if(o.shown&&o.effectiveStart!==null)return o.effectiveStart;for(let o of n)if(o.effectiveStart!==null)return o.effectiveStart;return null}function I(){return{tmin:g,tmax:m,vmin:A,vmax:S}}function fe(){return te(e,L,I(),p)}function X(o,l){let x=l-o;if(x<u){let y=(o+l)/2;o=y-u/2,l=y+u/2,x=u}x>=d&&(o=f,l=h),o<f&&(l+=f-o,o=f),l>h&&(o-=l-h,l=h),g=K(o,f,h),m=K(l,f,h),V()}function Z(){g=f,m=h,V()}function pe(o){let l=o.onset!==null?Math.min(o.onset,o.t):o.t,x=o.t,k=Math.max(x-l,u)*1.5+u;X(l-k,x+k)}let j=0;function q(){j===0&&(j=requestAnimationFrame(V))}function V(){if(j=0,e.width===0||e.height===0)return;let o=fe(),l=E("--faint"),x=E("--muted"),y=E("--clay");if(r.fillStyle=E("--term-bg"),r.fillRect(0,0,e.width,e.height),a.length===0)return;if(se(r,e,L,I(),o.px,o.py,g,m,l,x,p),z&&A<=0&&S>=0){let w=o.py(0);r.strokeStyle=D(x,.6),r.lineWidth=1.25*p,r.beginPath(),r.moveTo(L.l*p,w),r.lineTo(e.width-L.r*p,w),r.stroke(),r.fillStyle=x,r.textAlign="right",r.textBaseline="middle",r.fillText("0",(L.l-8)*p,w)}r.save(),r.beginPath(),r.rect(L.l*p,L.t*p,o.plotW(),o.plotH()),r.clip();let k=L.t*p,N=o.plotH();for(let w of t.alerts){if(w.onset===null||w.kind==="no_data")continue;let B=Math.min(w.onset,w.t),U=Math.max(w.onset,w.t);if(U<g||B>m)continue;let ke=G(w.kind),Q=o.px(B),ge=o.px(U);r.fillStyle=D(ke,.08),r.fillRect(Q,k,Math.max(ge-Q,1*p),N)}for(let w of n){if(!w.shown)continue;let B=re(w.band);oe(r,w.band,B,o.px,o.py,w.color,.13,.4,p)}ne(r,a,b,g,m,L.l*p,o.plotW(),o.px,o.py,y,1.5,p);for(let w of n)w.shown&&ie(r,w.anomalies,g,m,o.px,o.py,E("--st-anomaly"),p);let P=T();P!==null&&P>g&&ce(r,e,L,p,o.px,P,"detection at full power \u2192");let H=t.alerts.map(w=>({t:w.t,kind:w.kind}));de(r,e,L,p,o.px,H,w=>G(w)),$!==null&&he(o,k,N,l),r.restore()}function be(o){let l=a;if(l.length===0)return-1;let x=0,y=l.length-1;for(;x<y;){let k=x+y>>1;l[k]<o?x=k+1:y=k}return x>0&&o-l[x-1]<l[x]-o&&(x-=1),x}function he(o,l,x,y){let k=be($);if(k<0)return;let N=a[k];if(N<g||N>m){s("hover the chart for a point readout");return}let P=o.px(N);r.strokeStyle=D(y,.45),r.lineWidth=1*p,r.setLineDash([2*p,2*p]),r.beginPath(),r.moveTo(P,l),r.lineTo(P,l+x),r.stroke(),r.setLineDash([]);let H=b[k];if(Number.isFinite(H)){let w=o.py(H);r.fillStyle=E("--term-bg"),r.beginPath(),r.arc(P,w,4*p,0,Math.PI*2),r.fill(),r.strokeStyle=E("--clay"),r.lineWidth=2*p,r.beginPath(),r.arc(P,w,4*p,0,Math.PI*2),r.stroke()}ve(k)}function ve(o){let l=a[o],x=b[o],y=`<span class="dtk-ro-t">${M(O(l))}</span>`;y+=`<span class="dtk-ro-v">value ${Number.isFinite(x)?W(x):"\u2014"}</span>`;for(let k of n){if(!k.shown)continue;let N=k.band[o],P=k.det.points[o];if(N&&N.lo!==null&&N.hi!==null){let H=P&&P.a===1,w=H&&P.sev!==null?` sev ${P.sev.toFixed(2)}`:"",B=H?`<span class="dtk-ro-anom" style="color:${M(E("--st-anomaly"))}">anomaly${M(w)}</span>`:'<span class="dtk-ro-ok">ok</span>';y+=`<span class="dtk-ro-det"><span class="dtk-swatch" style="background:${M(k.color)}"></span>${M(k.det.name)}: [${W(N.lo)}, ${W(N.hi)}] ${B}</span>`}}s(y)}function J(o){let l=e.getBoundingClientRect(),x=(o-l.left-L.l)/(l.width-(L.l+L.r)||1);return g+K(x,0,1)*(m-g)}e.addEventListener("wheel",o=>{o.preventDefault();let l=J(o.clientX),x=m-g,y=K(x*Math.pow(1.0015,o.deltaY),u,d),k=(l-g)/(x||1);X(l-k*y,l-k*y+y)},{passive:!1});let _=null;e.addEventListener("mousedown",o=>{_={x:o.clientX,vMin:g,vMax:m},e.style.cursor="grabbing"}),window.addEventListener("mousemove",o=>{if(!_)return;let l=e.getBoundingClientRect(),x=(_.vMax-_.vMin)/(l.width-(L.l+L.r)||1),y=(o.clientX-_.x)*x;X(_.vMin-y,_.vMax-y)}),window.addEventListener("mouseup",()=>{_&&(_=null,e.style.cursor="crosshair")}),e.addEventListener("mousemove",o=>{_||($=J(o.clientX),q())}),e.addEventListener("mouseleave",()=>{$!==null&&($=null,s("hover the chart for a point readout"),q())}),e.addEventListener("dblclick",()=>Z()),e.style.cursor="crosshair";function xe(){p=ee(e),V()}return{repaint:()=>q(),resize:xe,setView:X,resetView:Z,focusAlert:pe,setZeroLine:R}}var me=!1;function Pe(){if(me)return;me=!0;let e=`
2
- .${c}{--term-bg:#211e1a;--term-border:#332f29;--term-text:#c9c2b4;
3
- --clay:#d15b36;--clay-700:#b4471f;--ink:#1b1916;--paper:#f5f1e8;--surface:#fbf9f3;
4
- --border:#e6e0d4;--muted:#6e675b;--faint:#9a9384;
5
- --anom:#d63232;--rec:#36a64f;--nod:#f0ad4e;
6
- --sans:'Schibsted Grotesk',ui-sans-serif,system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
7
- --mono:'JetBrains Mono',ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
8
- font-family:var(--sans);color:var(--ink);}
9
- .${c} *{box-sizing:border-box;}
10
- .${c} .dtk-report-root{max-width:1100px;margin:0 auto;padding:20px 18px 40px;}
11
- /* --- header row ----------------------------------------------------------- */
12
- .${c} .dtk-header{margin-bottom:16px;padding-left:12px;
13
- border-left:3px solid var(--clay);}
14
- .${c} .dtk-h-top{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 14px;}
15
- .${c} .dtk-title{font-size:21px;font-weight:700;margin:0;color:var(--ink);
16
- font-family:var(--sans);letter-spacing:-0.01em;}
17
- .${c} .dtk-meta{font-size:12px;color:var(--muted);font-family:var(--mono);}
18
- .${c} .dtk-desc{margin:8px 0 0;font-size:13px;color:var(--muted);max-width:760px;
19
- line-height:1.5;}
20
- /* --- summary chips (surface cards) ---------------------------------------- */
21
- .${c} .dtk-chips{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px;}
22
- .${c} .dtk-chip{display:inline-flex;align-items:center;gap:7px;padding:5px 11px;
23
- background:var(--surface);border:1px solid var(--border);border-radius:10px;font-size:12px;}
24
- .${c} .dtk-dot{width:8px;height:8px;border-radius:50%;display:inline-block;}
25
- .${c} .dtk-chip-n{font-weight:700;font-family:var(--mono);color:var(--ink);}
26
- .${c} .dtk-chip-l{color:var(--faint);font-family:var(--mono);font-size:11px;
27
- text-transform:uppercase;letter-spacing:0.05em;}
28
- /* --- detector legend ------------------------------------------------------ */
29
- .${c} .dtk-legend{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:10px;}
30
- .${c} .dtk-legend-item{display:inline-flex;align-items:center;gap:7px;padding:5px 11px;
31
- background:var(--surface);border:1px solid var(--border);border-radius:8px;cursor:pointer;
32
- color:var(--ink);font-size:12px;font-family:var(--sans);transition:border-color .12s ease;}
33
- .${c} .dtk-legend-item:hover{border-color:var(--clay);}
34
- .${c} .dtk-legend-item.off{opacity:0.45;}
35
- .${c} .dtk-legend-id{color:var(--faint);font-family:var(--mono);font-size:11px;}
36
- .${c} .dtk-legend-n{color:var(--anom);font-weight:700;font-family:var(--mono);}
37
- .${c} .dtk-swatch{width:10px;height:10px;border-radius:2px;display:inline-block;}
38
- /* --- toolbar (presets + readout) ------------------------------------------ */
39
- .${c} .dtk-bar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;
40
- gap:8px;margin-bottom:8px;}
41
- .${c} .dtk-presets{display:flex;gap:5px;}
42
- .${c} .dtk-preset{padding:5px 13px;background:var(--surface);
43
- border:1px solid var(--border);border-radius:8px;color:var(--muted);cursor:pointer;
44
- font-size:12px;font-family:var(--sans);transition:border-color .12s ease,color .12s ease;}
45
- .${c} .dtk-preset:hover{border-color:var(--clay);color:var(--ink);}
46
- .${c} .dtk-preset.active{background:var(--clay);color:#fff;border-color:var(--clay);}
47
- .${c} .dtk-zero{display:inline-flex;align-items:center;gap:5px;margin-left:6px;
48
- font-size:12px;color:var(--muted);font-family:var(--sans);cursor:pointer;user-select:none;}
49
- .${c} .dtk-zero input{accent-color:var(--clay);cursor:pointer;}
50
- .${c} .dtk-readout{font-size:11px;color:var(--muted);
51
- font-family:var(--mono);display:flex;flex-wrap:wrap;gap:4px 12px;align-items:center;}
52
- .${c} .dtk-readout .dtk-swatch{margin-right:4px;}
53
- .${c} .dtk-ro-t{font-weight:700;color:var(--ink);}
54
- /* --- chart panel (dark terminal surface) ---------------------------------- */
55
- .${c} .dtk-chart{position:relative;width:100%;height:360px;background:var(--term-bg);
56
- border:1px solid var(--term-border);border-radius:12px;overflow:hidden;
57
- box-shadow:0 24px 60px -30px rgba(27,25,22,.45);}
58
- .${c} .dtk-chart canvas{width:100%;height:100%;display:block;}
59
- /* --- alerts list (surface cards) ------------------------------------------ */
60
- .${c} .dtk-alerts{margin-top:18px;}
61
- .${c} .dtk-alerts-head{font-size:12px;font-weight:600;color:var(--faint);
62
- margin-bottom:9px;font-family:var(--mono);text-transform:uppercase;letter-spacing:0.06em;}
63
- .${c} .dtk-alerts-empty{font-size:13px;color:var(--muted);padding:8px 0;}
64
- .${c} .dtk-alerts-list{display:flex;flex-direction:column;gap:5px;
65
- max-height:340px;overflow:auto;}
66
- .${c} .dtk-alert-row{display:flex;align-items:center;gap:10px;width:100%;text-align:left;
67
- padding:8px 11px;background:var(--surface);border:1px solid var(--border);
68
- border-radius:8px;cursor:pointer;color:var(--ink);font-family:var(--sans);
69
- transition:border-color .12s ease,box-shadow .12s ease;}
70
- .${c} .dtk-alert-row:hover{border-color:var(--clay);
71
- box-shadow:0 4px 14px -8px rgba(27,25,22,.35);}
72
- .${c} .dtk-alert-time{font-size:11px;color:var(--muted);
73
- font-family:var(--mono);white-space:nowrap;min-width:142px;}
74
- .${c} .dtk-badge{display:inline-block;padding:1px 8px;border-radius:10px;font-size:11px;
75
- font-weight:700;border:1px solid;text-transform:uppercase;letter-spacing:0.03em;white-space:nowrap;}
76
- .${c} .dtk-alert-body{display:flex;flex-direction:column;gap:2px;min-width:0;}
77
- .${c} .dtk-alert-rule{font-size:12px;color:var(--ink);
78
- font-family:var(--mono);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
79
- .${c} .dtk-alert-sub{font-size:11px;color:var(--muted);}
80
- `,t=document.createElement("style");t.setAttribute("data-dtk-report",""),t.textContent=e,document.head.appendChild(t)}window.__DTK_REPORT__={render:Te};})();
File without changes
File without changes
File without changes