Commit Graph
226 Commits
Author SHA1 Message Date
Hugh Kaznowski c040e16587 Merge branch 'worktree-agent-a184a6929a356b613'
# Conflicts:
#	src/engine.rs
2026-09-05 13:12:35 +01:00
Hugh Kaznowski 313b3950a0 Merge branch 'worktree-agent-ab342356b0191d35f'
# Conflicts:
#	src/engine.rs
2026-09-05 13:11:43 +01:00
Hugh KaznowskiandClaude Sonnet 5 86a1a40243 Wire FilterBar query AST into logs/timeline queries (ticket 007)
Adds a filter evaluator in engine.rs that compiles a parsed FilterExpr
against the current index once per query (regex compiled once,
sequence/timestamp compared directly against IngestedLog fields,
other metric comparisons resolved to a HashSet<u64> of matching
sequences via a bucket scan) and evaluates it per log line with no
further index access. Wires this into EngineQuery::Logs/Timeline via
a new LogsParams::filter/TimelineParams::filter field, and adds
EngineResponse::Error so a malformed filter string surfaces as a
query-level error (mapped to 400 in api.rs).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XFUNZwCvz3kcod3352ZR2o
2026-09-05 13:10:50 +01:00
Hugh KaznowskiandClaude Sonnet 5 ac67f9e120 Add PromQL query support for dashboard visualizations (ticket 013)
Hand-rolls a minimal PromQL parser (src/promql.rs) for metric-name +
label-matcher selection, optional [range] selectors, and top-level
sum()/avg()/rate() wrapping, rather than pulling in a full PromQL parser
crate — the required subset is small and a hand-rolled parser stays fully
engine-independent (mirrors filter_parser.rs) with no unused-AST overhead.

Adds EngineQuery::Promql/EngineResponse::Promql (engine parses + evaluates
in place against the index, no copying) and GET /api/query, returning
Vec<PromqlSeriesDto> (labels + (timestamp_ms, f64) points) for charting,
with malformed queries surfaced as 400 + ErrorDto.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XFUNZwCvz3kcod3352ZR2o
2026-09-05 13:10:41 +01:00
Hugh KaznowskiandClaude Sonnet 5 7514052048 Add selectable declared-param columns to LogPreview (ticket 015)
Extend GET /api/logs to derive each declared param's value per log line
(regex + capture group + kind, matching that line's text) and include it as
a params map on LogEntryDto, omitting entries that don't match rather than
sending nulls. Add GET /api/params (list_params, mirroring list_metrics) so
the frontend can discover currently-declared param names. In LogPreview, add
a column-picker popover backed by that list, with the selection persisted in
localStorage under `ottyl.logPreview.visibleParamColumns`.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XFUNZwCvz3kcod3352ZR2o
2026-09-05 13:09:25 +01:00
Hugh Kaznowski e48c03218f Profiles and docs readme 2026-09-05 13:06:13 +01:00
Hugh KaznowskiandClaude Sonnet 5 49e8590cf3 Add Metrics API: declare/list params and metrics, query bucket values (ticket 004)
Exposes param/metric declarations and derived bucket data over HTTP:
POST /api/params and POST /api/metrics validate and declare against the
engine, persisting into the active profile (if any) so declarations survive
a restart; GET /api/metrics lists declarations; GET /api/metrics/:name
queries bucket values with label, time-range, sequence, and limit filters.
Adds a new EngineQuery::BucketValues variant that layers this filtering on
top of ticket 003's bucket_values helper.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XFUNZwCvz3kcod3352ZR2o
2026-09-05 13:05:00 +01:00
Hugh Kaznowski f0348589f5 Merge branch 'worktree-agent-a050e355d6c42f2c2' 2026-09-05 12:57:40 +01:00
Hugh KaznowskiandClaude Sonnet 5 4c8918ec8c Add profile (preset) CRUD and startup replay (ticket 009)
Introduces `src/profile.rs`: a `Profile` bundles param/metric declarations
plus a placeholder dashboards field, and `ProfileStore` persists all
profiles as a single profiles.json file, resolved relative to the settings
file's directory (same convention as ticket 010's CSS storage). Adds CRUD
(create/list/get/delete/set_active) that keeps Settings.profiles.names and
active_profile in sync, plus record_param_declaration/record_metric_declaration
hooks that ticket 004's HTTP API will call to persist newly-declared
params/metrics into the active profile.

Wires main.rs to replay the active profile's declarations into the engine
before spawning the ingest task, so backfill/live-derivation semantics
apply uniformly to every ingested line.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XFUNZwCvz3kcod3352ZR2o
2026-09-05 12:57:20 +01:00
Hugh KaznowskiandClaude Sonnet 5 af4517ea2c Populate metric buckets from declarations and log ingest (ticket 003)
Runs each declared metric's regex against log text both retroactively
(backfill on DeclareMetric) and going forward (on each Ingest), appending
(sequence, timestamp, value) entries to IndexKey::Bucket/DataValue::BucketValue.

All of a metric's declared params become the Bucket key's labels (the only
structured place for them), and the stored value is a fixed presence marker
(Number::Int(1)) — a bucket's values are an occurrence timeseries for that
label combination, not the captured values themselves. A param whose capture
doesn't match or fails to parse under its declared kind skips the whole match
rather than storing a partially-labeled bucket.

Exposes an internal bucket_values(index, metric_name, labels_filter) helper
for the upcoming metrics-API ticket to build on.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XFUNZwCvz3kcod3352ZR2o
2026-09-05 12:55:17 +01:00
Hugh Kaznowski f259bdc49b Merge branch 'worktree-agent-a58c59406199f7d11'
# Conflicts:
#	src/dto.rs
2026-09-05 12:51:54 +01:00
Hugh KaznowskiandClaude Sonnet 5 71aaa4ebb4 Add CSS import/link/list/delete/content API (ticket 010)
Wires up Settings.css_entries behind a small settings API: import raw CSS
content to a file stored alongside settings.json, link external CSS
paths/URLs by reference (never deletable/copied), list all entries, delete
imported entries, and serve back imported content. CSS storage logic lives
on Settings (import_css/link_css/remove_css/css_content) with api.rs
handlers staying thin, matching the existing engine-query pattern.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XFUNZwCvz3kcod3352ZR2o
2026-09-05 12:51:22 +01:00
Hugh KaznowskiandClaude Sonnet 5 d37c35772d Add metric declaration storage and validation to engine index (ticket 002)
Adds IndexKey::MetricDeclaration handling: DeclareMetric/RemoveMetricDeclaration
engine messages and a MetricDeclarations query, mirroring the pattern from ticket
001's param declarations. Params are derived from inline named capture groups on
the metric's own regex for v1 (referencing existing ParamDeclarations is left for
a future ticket). Validates the regex and every RegexToMetricPrimitiveMatcher's
capture-group reference at declaration time, reporting all bad matchers at once.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XFUNZwCvz3kcod3352ZR2o
2026-09-05 12:49:29 +01:00
Hugh KaznowskiandClaude Sonnet 5 faca2af328 Stop tracking agent worktree dirs as embedded repos
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XFUNZwCvz3kcod3352ZR2o
2026-09-05 12:47:01 +01:00
Hugh Kaznowski 1d3bc0d0d6 Merge branch 'worktree-agent-a63474e92b05425a5'
# Conflicts:
#	Cargo.lock
#	Cargo.toml
2026-09-05 12:46:45 +01:00
Hugh Kaznowski 5b1e2fd5af Merge branch 'worktree-agent-a25bd4a44da9f00b3'
# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	src/main.rs
2026-09-05 12:46:31 +01:00
Hugh Kaznowski f08c82c6ea Merge branch 'worktree-agent-a350079668e05192f'
# Conflicts:
#	Cargo.lock
#	Cargo.toml
2026-09-05 12:46:14 +01:00
Hugh KaznowskiandClaude Sonnet 5 202b1dcf9f Add FilterBar query language parser (pest grammar)
Introduces a standalone src/filter_parser.rs module (no dependency on
engine/index types) that parses the FilterBar query language into a
FilterExpr AST using a pest grammar (src/filter_parser.pest). Supports
regex("...") searches, metric_name[param] <op> value comparisons,
reserved sequence/timestamp metrics, and and/or combinators with
correct precedence (and binds tighter than or) and parenthesized
sub-expressions. Evaluation against real log data is left to a later
integration ticket.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XFUNZwCvz3kcod3352ZR2o
2026-09-05 12:45:31 +01:00
Hugh KaznowskiandClaude Sonnet 5 22647620fa Add process-wide Settings model (ticket 008)
Introduces src/settings.rs with a single, process-wide Settings struct
(colour scheme, CSS entries shaped for imported-vs-linked, and a
profiles placeholder for ticket 009), JSON-serialized via serde_json to
keep deps minimal. Default settings path is computed with the
directories crate (ProjectDirs::from("", "", "ottyl")) and overridable
via a new --settings-path CLI arg. Settings::load creates and persists
a default file on first run; Settings::save persists changes.

Wires a single Arc<Mutex<Settings>> into main() and threads it through
api::router as an additive ApiState field for tickets 010/011 to build
on.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XFUNZwCvz3kcod3352ZR2o
2026-09-05 12:42:53 +01:00
Hugh KaznowskiandClaude Sonnet 5 0311eeb712 Add filter_datetime module for FilterBar timestamp parsing
Standalone module (no engine/index/filter-grammar deps) that normalizes
relative humantime (5h, -3m), absolute time-of-day (12:00, resolved to
today in UTC), and full date/RFC3339 literals (2024-01-15,
2024-01-15T12:00:00Z) into a single Timestamp, given a passed-in `now`
for testability. Adds humantime and chrono dependencies.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XFUNZwCvz3kcod3352ZR2o
2026-09-05 12:42:51 +01:00
Hugh KaznowskiandClaude Sonnet 5 f62830d8f7 Add param declaration storage and validation to engine index
Implements the ParamDeclaration slice of the primary index: DataValue::ParamDeclaration
holds a regex + named capture group + MetricPrimitiveKind, stored under
IndexKey::ParamDeclaration{name} between LogParamSplit and ParamMetricSplit.
EngineMessage gains DeclareParam (validates the regex compiles and the capture
group exists before storing, returning a clear error otherwise) and
RemoveParamDeclaration; EngineQuery gains ParamDeclarations to list them back out
as ParamDeclarationDto. No API wiring yet (separate ticket).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XFUNZwCvz3kcod3352ZR2o
2026-09-05 12:42:38 +01:00
Hugh Kaznowski 1fb564d06b Remove note about range scan ops 2026-09-05 12:28:56 +01:00
Hugh Kaznowski 68548911bc Webapp 2026-09-05 12:23:46 +01:00
Hugh Kaznowski 818f8d09ea Update readme and add some deps 2026-09-05 12:12:28 +01:00
Hugh Kaznowski cbdb145f68 Initial readme/spec 2026-09-05 11:58:01 +01:00
phughk a6ffeb8d06 Initial commit 2026-09-05 09:37:02 +00:00