detectkit 0.69.0__tar.gz → 0.70.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.
- {detectkit-0.69.0/detectkit.egg-info → detectkit-0.70.0}/PKG-INFO +1 -1
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/__init__.py +1 -1
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/assets/claude/rules/cli.md +1 -1
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/serve/app.py +12 -4
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/serve/server.py +1 -1
- detectkit-0.70.0/detectkit/serve/web.py +162 -0
- detectkit-0.70.0/detectkit/ui/assets/ui.js +569 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/ui/html.py +3 -1
- {detectkit-0.69.0 → detectkit-0.70.0/detectkit.egg-info}/PKG-INFO +1 -1
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit.egg-info/SOURCES.txt +1 -0
- detectkit-0.69.0/detectkit/ui/assets/ui.js +0 -564
- {detectkit-0.69.0 → detectkit-0.70.0}/LICENSE +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/MANIFEST.in +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/README.md +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/alerting/__init__.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/alerting/channels/__init__.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/alerting/channels/base.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/alerting/channels/branding.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/alerting/channels/discord.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/alerting/channels/email.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/alerting/channels/factory.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/alerting/channels/googlechat.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/alerting/channels/mattermost.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/alerting/channels/ntfy.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/alerting/channels/slack.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/alerting/channels/teams.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/alerting/channels/telegram.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/alerting/channels/webhook.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/alerting/orchestrator/__init__.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/alerting/orchestrator/_base.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/alerting/orchestrator/_cooldown.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/alerting/orchestrator/_decision.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/alerting/orchestrator/_dispatch.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/alerting/orchestrator/_recovery.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/alerting/orchestrator/_replay.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/alerting/orchestrator/_types.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/alerting/orchestrator/orchestrator.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/autotune/__init__.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/autotune/_base.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/autotune/_types.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/autotune/alert_sim.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/autotune/autotuner.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/autotune/axis_spec.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/autotune/config_emitter.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/autotune/crossval.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/autotune/detector_select.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/autotune/distribution.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/autotune/grid_search.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/autotune/key_select.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/autotune/labels.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/autotune/profile_engine.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/autotune/result.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/autotune/runner.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/autotune/scoring.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/autotune/seasonality_search.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/autotune/settings.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/autotune/window_select.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/__init__.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/_output.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/assets/claude/CLAUDE.section.md +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/assets/claude/rules/alerting.md +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/assets/claude/rules/autotune.md +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/assets/claude/rules/detectors.md +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/assets/claude/rules/metrics.md +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/assets/claude/rules/overview.md +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/assets/claude/rules/project.md +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/assets/claude/skills/dtk-autotune/SKILL.md +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/assets/claude/skills/dtk-feedback/SKILL.md +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/assets/claude/skills/dtk-new-metric/SKILL.md +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/assets/claude/skills/dtk-setup-project/SKILL.md +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/assets/claude/skills/dtk-tune/SKILL.md +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/commands/__init__.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/commands/autotune.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/commands/clean.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/commands/init.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/commands/init_claude.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/commands/mcp.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/commands/osi.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/commands/run.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/commands/serve.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/commands/test_alert.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/commands/tune.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/commands/ui.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/commands/unlock.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/cli/main.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/config/__init__.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/config/metric_config.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/config/metric_io.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/config/profile.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/config/project_config.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/config/validator.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/control/__init__.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/control/actions.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/control/actor.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/control/advise.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/control/commands.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/control/confirm.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/control/drafts.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/control/errors.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/control/health.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/control/jobs.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/control/metric_files.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/control/overview.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/control/project.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/control/proposals.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/control/queries.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/control/registry.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/control/roles.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/control/serialize.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/control/yaml_patch.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/core/__init__.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/core/interval.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/core/models.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/database/__init__.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/database/_sql_manager.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/database/bigquery_manager.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/database/clickhouse_manager.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/database/duckdb_manager.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/database/internal_tables/__init__.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/database/internal_tables/_alert_states.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/database/internal_tables/_autotune_runs.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/database/internal_tables/_base.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/database/internal_tables/_datapoints.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/database/internal_tables/_detections.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/database/internal_tables/_maintenance.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/database/internal_tables/_metrics.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/database/internal_tables/_platform.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/database/internal_tables/_schema.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/database/internal_tables/_tasks.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/database/internal_tables/manager.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/database/manager.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/database/mysql_manager.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/database/postgres_manager.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/database/snowflake_manager.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/database/source_manager.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/database/tables.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/detectors/__init__.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/detectors/base.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/detectors/factory.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/detectors/seasonality.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/detectors/statistical/__init__.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/detectors/statistical/_baseline.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/detectors/statistical/_windowed.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/detectors/statistical/autoreg.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/detectors/statistical/iqr.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/detectors/statistical/mad.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/detectors/statistical/manual_bounds.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/detectors/statistical/zscore.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/loaders/__init__.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/loaders/errors.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/loaders/metric_loader.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/loaders/query_template.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/mcp/__init__.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/mcp/context.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/mcp/descriptions.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/mcp/errors.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/mcp/server.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/mcp/tools.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/orchestration/__init__.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/orchestration/error_dispatch.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/orchestration/task_manager/__init__.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/orchestration/task_manager/_alert_step.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/orchestration/task_manager/_base.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/orchestration/task_manager/_detect_step.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/orchestration/task_manager/_load_step.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/orchestration/task_manager/_types.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/orchestration/task_manager/manager.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/reporting/__init__.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/reporting/assets/report.js +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/reporting/builder.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/reporting/html_report.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/semantic/__init__.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/semantic/errors.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/semantic/exporter.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/semantic/importer.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/semantic/osi_model.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/semantic/query_gen.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/serve/__init__.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/serve/api_v1.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/serve/errors.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/serve/forge.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/serve/mcp_app.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/serve/platform.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/serve/projects.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/serve/settings.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/serve/write_tools.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/tuning/__init__.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/tuning/assets/tune.js +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/tuning/config_writer.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/tuning/html.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/tuning/payload.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/tuning/server.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/ui/__init__.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/ui/server.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/utils/__init__.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/utils/datetime_utils.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/utils/env_interpolation.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/utils/json_utils.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit/utils/stats.py +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit.egg-info/dependency_links.txt +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit.egg-info/entry_points.txt +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit.egg-info/requires.txt +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/detectkit.egg-info/top_level.txt +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/pyproject.toml +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/requirements.txt +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/setup.cfg +0 -0
- {detectkit-0.69.0 → detectkit-0.70.0}/setup.py +0 -0
|
@@ -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.
|
|
7
|
+
__version__ = "0.70.0"
|
|
8
8
|
|
|
9
9
|
from detectkit.core.interval import Interval
|
|
10
10
|
from detectkit.core.models import ColumnDefinition, TableModel
|
|
@@ -19,7 +19,7 @@ Run all commands from a project directory (the one containing
|
|
|
19
19
|
| `dtk osi import <model>` | Scaffold a native metric from an OSI semantic-model metric (see "OSI interop") |
|
|
20
20
|
| `dtk osi export` | Publish metrics into an OSI fragment (config in `custom_extensions[detectkit]`) |
|
|
21
21
|
| `dtk mcp` | Serve a **read-only** MCP server for an AI assistant (metrics, data, alerts, autotune history — no writes) |
|
|
22
|
-
| `dtk serve` | Hosted platform: the same read-only MCP tools over HTTP for a team, across several projects, behind an MCP gateway — plus the same reads as a JSON API at `/api/v1` |
|
|
22
|
+
| `dtk serve` | Hosted platform: the same read-only MCP tools over HTTP for a team, across several projects, behind an MCP gateway — plus the same reads as a JSON API at `/api/v1` and a read-only web app at `/ui` |
|
|
23
23
|
| `dtk --version` | Show installed detectkit version |
|
|
24
24
|
|
|
25
25
|
## Selectors (`--select` / `-s`)
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
One process, one address. Phase 2 of RFC 0001 serves the read-only MCP endpoint;
|
|
4
4
|
phase 4a adds ``/api/v1``, the same reads as JSON over plain HTTP
|
|
5
|
-
(:mod:`detectkit.serve.api_v1`), behind the same bearer
|
|
6
|
-
|
|
5
|
+
(:mod:`detectkit.serve.api_v1`), behind the same bearer; phase 4b adds ``/ui``,
|
|
6
|
+
the ``dtk ui`` frontend reading that API (:mod:`detectkit.serve.web`).
|
|
7
7
|
|
|
8
|
-
**Auth: the trusted gateway.** ``/mcp
|
|
8
|
+
**Auth: the trusted gateway.** ``/mcp``, ``/api/v1`` and ``/ui`` require ``Authorization: Bearer <token>``
|
|
9
9
|
matching ``DTK_SERVE_MCP_TOKEN`` (compared in constant time) — the credential the
|
|
10
10
|
MCP gateway presents. The gateway authenticates the *person* and forwards their
|
|
11
11
|
identity in the configured header, which this service then trusts. That is safe
|
|
@@ -30,6 +30,8 @@ from detectkit.serve.api_v1 import PREFIX as API_PREFIX
|
|
|
30
30
|
from detectkit.serve.api_v1 import ApiV1
|
|
31
31
|
from detectkit.serve.mcp_app import build_hosted_mcp
|
|
32
32
|
from detectkit.serve.settings import ServeSettings
|
|
33
|
+
from detectkit.serve.web import PREFIX as WEB_PREFIX
|
|
34
|
+
from detectkit.serve.web import Web
|
|
33
35
|
|
|
34
36
|
if TYPE_CHECKING:
|
|
35
37
|
from detectkit.serve.platform import Platform
|
|
@@ -60,9 +62,11 @@ class _Gate:
|
|
|
60
62
|
*,
|
|
61
63
|
writes: bool,
|
|
62
64
|
api: ASGIApp | None = None,
|
|
65
|
+
web: ASGIApp | None = None,
|
|
63
66
|
) -> None:
|
|
64
67
|
self._app = app
|
|
65
68
|
self._api = api
|
|
69
|
+
self._web = web
|
|
66
70
|
self._registry = registry
|
|
67
71
|
self._expected = f"Bearer {token}".encode() if token else None
|
|
68
72
|
self._writes = writes
|
|
@@ -97,6 +101,9 @@ class _Gate:
|
|
|
97
101
|
if self._api is not None and (path == API_PREFIX or path.startswith(API_PREFIX + "/")):
|
|
98
102
|
await self._api(scope, receive, send)
|
|
99
103
|
return
|
|
104
|
+
if self._web is not None and (path == WEB_PREFIX or path.startswith(WEB_PREFIX + "/")):
|
|
105
|
+
await self._web(scope, receive, send)
|
|
106
|
+
return
|
|
100
107
|
await self._app(scope, receive, send)
|
|
101
108
|
|
|
102
109
|
|
|
@@ -136,7 +143,8 @@ def build_app(
|
|
|
136
143
|
inner.router.lifespan_context = lifespan
|
|
137
144
|
token = None if settings.insecure_no_auth else settings.token
|
|
138
145
|
api = ApiV1(registry, settings, platform=platform, log=log)
|
|
139
|
-
|
|
146
|
+
web = Web(registry, settings, log=log)
|
|
147
|
+
return _Gate(inner, registry, token, writes=platform is not None, api=api, web=web)
|
|
140
148
|
|
|
141
149
|
|
|
142
150
|
def _build_platform(
|
|
@@ -33,7 +33,7 @@ def run_serve(settings: ServeSettings, *, echo: Callable[[str], None] | None = N
|
|
|
33
33
|
auth = "none (insecure, loopback only)" if settings.insecure_no_auth else "bearer"
|
|
34
34
|
mode = "writes enabled" if settings.enable_writes else "read-only"
|
|
35
35
|
say(
|
|
36
|
-
f"dtk serve: http://{settings.host}:{settings.port} /mcp ({mode}) /api/v1 (read-only) /health "
|
|
36
|
+
f"dtk serve: http://{settings.host}:{settings.port} /mcp ({mode}) /api/v1 (read-only) /ui (read-only) /health "
|
|
37
37
|
f"projects={','.join(registry.names)} auth={auth} "
|
|
38
38
|
f"identity_header={settings.identity_header or '-'}"
|
|
39
39
|
)
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"""The platform's web pages (RFC 0001 phase 4b, read side).
|
|
2
|
+
|
|
3
|
+
``dtk serve`` serves the ``dtk ui`` frontend — the same committed bundle — in its
|
|
4
|
+
*platform* mode: the page reads ``/api/v1`` instead of the local ``dtk ui``
|
|
5
|
+
routes, switches between projects, and offers no write action (writes reach the
|
|
6
|
+
web in phase 4c). One page per project, so a link names what it shows::
|
|
7
|
+
|
|
8
|
+
GET /ui -> 307 to the first project's page
|
|
9
|
+
GET /ui/{project} the overview + detail for one project (?window= presets)
|
|
10
|
+
|
|
11
|
+
The page sits behind the same bearer gate as ``/mcp`` and ``/api/v1``, and every
|
|
12
|
+
read it makes goes through ``/api/v1``: a browser reaches it through a front
|
|
13
|
+
proxy that adds the bearer (or with ``--insecure-no-auth`` on loopback, for a
|
|
14
|
+
trial). The person's own identity is phase 4e.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import functools
|
|
20
|
+
from collections.abc import Callable, MutableMapping
|
|
21
|
+
from typing import Any
|
|
22
|
+
from urllib.parse import parse_qsl, quote, unquote
|
|
23
|
+
|
|
24
|
+
from detectkit import __version__
|
|
25
|
+
from detectkit.control import queries as q
|
|
26
|
+
from detectkit.control.errors import ControlError, NotFoundError
|
|
27
|
+
from detectkit.control.overview import ALL_WINDOW_PRESETS
|
|
28
|
+
from detectkit.control.registry import ProjectRegistry
|
|
29
|
+
from detectkit.serve.api_v1 import PREFIX as API_PREFIX
|
|
30
|
+
from detectkit.serve.settings import ServeSettings
|
|
31
|
+
from detectkit.utils.datetime_utils import now_utc_naive
|
|
32
|
+
|
|
33
|
+
Scope = MutableMapping[str, Any]
|
|
34
|
+
|
|
35
|
+
PREFIX = "/ui"
|
|
36
|
+
DEFAULT_WINDOW = "7d"
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def boot_payload(registry: ProjectRegistry, project: str, window: str) -> dict[str, Any]:
|
|
40
|
+
"""The page's boot data: the project's metric list plus where its reads live.
|
|
41
|
+
|
|
42
|
+
Built from :func:`~detectkit.control.queries.list_metrics` — config only, no
|
|
43
|
+
state database — so the page renders its table at once and fills each row
|
|
44
|
+
from ``/api/v1/…/status``.
|
|
45
|
+
"""
|
|
46
|
+
handle = registry.get(project)
|
|
47
|
+
listing = q.list_metrics(handle)
|
|
48
|
+
metrics = [
|
|
49
|
+
{
|
|
50
|
+
"name": m["name"],
|
|
51
|
+
"dir": m["dir"],
|
|
52
|
+
"file": m["file"],
|
|
53
|
+
"tags": m["tags"],
|
|
54
|
+
"interval_seconds": m["interval_seconds"],
|
|
55
|
+
"enabled": m["enabled"],
|
|
56
|
+
}
|
|
57
|
+
for m in listing["metrics"]
|
|
58
|
+
]
|
|
59
|
+
return {
|
|
60
|
+
"project": project,
|
|
61
|
+
"initial_window": window,
|
|
62
|
+
"version": __version__,
|
|
63
|
+
"metrics": metrics,
|
|
64
|
+
"generated_at": int(now_utc_naive().timestamp() * 1000),
|
|
65
|
+
"platform": {
|
|
66
|
+
"projects": list(registry.names),
|
|
67
|
+
"api_base": f"{API_PREFIX}/projects/{quote(project, safe='')}",
|
|
68
|
+
"ui_base": f"{PREFIX}/",
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def _window(query_string: bytes) -> str:
|
|
74
|
+
"""``?window=`` when it names a preset; anything else falls back to the default."""
|
|
75
|
+
for key, value in parse_qsl(query_string.decode("latin-1")):
|
|
76
|
+
if key == "window" and value in ALL_WINDOW_PRESETS:
|
|
77
|
+
return value
|
|
78
|
+
return DEFAULT_WINDOW
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class Web:
|
|
82
|
+
"""The ``/ui`` ASGI handler (mounted behind the bearer gate)."""
|
|
83
|
+
|
|
84
|
+
def __init__(
|
|
85
|
+
self,
|
|
86
|
+
registry: ProjectRegistry,
|
|
87
|
+
settings: ServeSettings,
|
|
88
|
+
*,
|
|
89
|
+
log: Callable[[str], None] | None = None,
|
|
90
|
+
) -> None:
|
|
91
|
+
self._registry = registry
|
|
92
|
+
self._settings = settings
|
|
93
|
+
self._log = log or (lambda _line: None)
|
|
94
|
+
|
|
95
|
+
def _identity(self, scope: Scope) -> str | None:
|
|
96
|
+
key = self._settings.identity_header_key
|
|
97
|
+
if key is None:
|
|
98
|
+
return None
|
|
99
|
+
raw = dict(scope.get("headers") or []).get(key.encode("latin-1"))
|
|
100
|
+
return (raw.decode("latin-1").strip() or None) if raw else None
|
|
101
|
+
|
|
102
|
+
async def __call__(self, scope: Scope, receive: Any, send: Any) -> None:
|
|
103
|
+
import anyio # noqa: PLC0415 - a dependency of the serve extra
|
|
104
|
+
|
|
105
|
+
from detectkit.ui.html import render_ui_html # noqa: PLC0415
|
|
106
|
+
|
|
107
|
+
path: str = scope.get("path") or ""
|
|
108
|
+
if scope.get("method") != "GET":
|
|
109
|
+
await _reply(send, 405, b"method not allowed", "text/plain", allow="GET")
|
|
110
|
+
return
|
|
111
|
+
raw = scope.get("raw_path") or path.encode("utf-8")
|
|
112
|
+
rest = raw.decode("latin-1").split("?", 1)[0][len(PREFIX) :].strip("/")
|
|
113
|
+
segments = [unquote(s) for s in rest.split("/")] if rest else []
|
|
114
|
+
query = scope.get("query_string") or b""
|
|
115
|
+
self._log(f" [serve] GET {path} actor={self._identity(scope) or 'anonymous'}")
|
|
116
|
+
|
|
117
|
+
if not segments:
|
|
118
|
+
names = self._registry.names
|
|
119
|
+
if not names:
|
|
120
|
+
await _reply(send, 404, b"no projects are served", "text/plain")
|
|
121
|
+
return
|
|
122
|
+
target = f"{PREFIX}/{quote(names[0], safe='')}"
|
|
123
|
+
if query:
|
|
124
|
+
target += "?" + query.decode("latin-1")
|
|
125
|
+
await _reply(send, 307, b"", "text/plain", location=target)
|
|
126
|
+
return
|
|
127
|
+
if len(segments) != 1:
|
|
128
|
+
await _reply(send, 404, f"no such page: {path}".encode(), "text/plain")
|
|
129
|
+
return
|
|
130
|
+
|
|
131
|
+
project = segments[0]
|
|
132
|
+
try:
|
|
133
|
+
with anyio.fail_after(self._settings.tool_timeout):
|
|
134
|
+
payload = await anyio.to_thread.run_sync(
|
|
135
|
+
functools.partial(boot_payload, self._registry, project, _window(query)),
|
|
136
|
+
abandon_on_cancel=True,
|
|
137
|
+
)
|
|
138
|
+
except NotFoundError as exc:
|
|
139
|
+
await _reply(send, 404, str(exc).encode(), "text/plain; charset=utf-8")
|
|
140
|
+
return
|
|
141
|
+
except ControlError as exc:
|
|
142
|
+
await _reply(send, exc.http_status, str(exc).encode(), "text/plain; charset=utf-8")
|
|
143
|
+
return
|
|
144
|
+
except TimeoutError:
|
|
145
|
+
await _reply(send, 504, b"the page did not build in time", "text/plain")
|
|
146
|
+
return
|
|
147
|
+
except Exception as exc: # noqa: BLE001 - a page must answer, not drop the connection
|
|
148
|
+
self._log(f" [serve] 500 {path}: {type(exc).__name__}: {exc}")
|
|
149
|
+
await _reply(send, 500, f"internal error: {type(exc).__name__}".encode(), "text/plain")
|
|
150
|
+
return
|
|
151
|
+
await _reply(send, 200, render_ui_html(payload).encode("utf-8"), "text/html; charset=utf-8")
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
async def _reply(send: Any, status: int, body: bytes, content_type: str, **extra: str) -> None:
|
|
155
|
+
headers = [
|
|
156
|
+
(b"content-type", content_type.encode()),
|
|
157
|
+
(b"content-length", str(len(body)).encode()),
|
|
158
|
+
(b"cache-control", b"no-store"),
|
|
159
|
+
]
|
|
160
|
+
headers += [(k.encode(), v.encode("latin-1")) for k, v in extra.items()]
|
|
161
|
+
await send({"type": "http.response.start", "status": status, "headers": headers})
|
|
162
|
+
await send({"type": "http.response.body", "body": body})
|