mirror of
https://github.com/codeflash-ai/codeflash-agent.git
synced 2026-05-04 18:25:19 +00:00
* feat(blackbox): add package with models, CLI, and HTMX dashboard * test(blackbox): add comprehensive test coverage for dashboard * feat(blackbox): cache session scanning via watcher invalidation * docs(blackbox): add README and use fastapi[standard] for dev server * refactor(blackbox): extract presentation logic into formatter classes * refactor(blackbox): extract classify_error helpers * feat(blackbox): wire analytics into session detail view Show token usage, tool breakdowns, and session stats in a collapsible panel when viewing a session. * feat(blackbox): add codeflash plugin detection Detect codeflash agent names, skills, and commands in transcripts. Surface language, optimization domain, and capability badges in the analytics panel. * refactor(blackbox): remove underscore prefixes from internal functions * chore: add ty python-version to root pyproject.toml * chore(blackbox): fix lint errors in test files * style(blackbox): apply ruff formatting to analytics * feat(blackbox): add Playwright E2E tests for dashboard Refactor app.py to expose create_app() factory accepting a projects_dir override, enabling tests to run against fixture data instead of the real ~/.claude/projects/ directory. Routes now read projects_dir from app.state instead of the module-level constant. Add 26 Playwright tests across 5 files covering dashboard loading, session list, session detail with filters and analytics, sidebar collapse/localStorage persistence, and SSE log streaming. All tests pass on chromium, firefox, and webkit (78 total). CI gets a new e2e-blackbox job with a browser matrix strategy running all three engines in parallel, conditional on blackbox path changes, with trace upload on failure. * fix(ci): sync only blackbox package in e2e job * fix(ci): exclude e2e tests from unit test job The test job doesn't install Playwright browsers, so e2e tests error when pytest collects them. Ignore tests/e2e/ directories in the test job — those are handled by the dedicated e2e-blackbox job.
38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from blackbox.models import SessionAudit, SessionMeta
|
|
|
|
|
|
def make_meta(**kw: Any) -> SessionMeta:
|
|
defaults: dict[str, Any] = {
|
|
"session_id": "abcd1234-5678-9012-3456-789012345678",
|
|
"project_path": "/tmp/project",
|
|
"transcript_path": "/tmp/project/.claude/sessions/abc.jsonl",
|
|
"start_time": 1700000000.0,
|
|
"end_time": 1700003600.0,
|
|
"duration_s": 3600.0,
|
|
"user_messages": 10,
|
|
"assistant_messages": 12,
|
|
"tool_calls": 25,
|
|
}
|
|
defaults.update(kw)
|
|
return SessionMeta(**defaults)
|
|
|
|
|
|
def make_audit(**kw: Any) -> SessionAudit:
|
|
defaults: dict[str, Any] = {
|
|
"session_id": "abcd1234-5678-9012-3456-789012345678",
|
|
"outcome": "mostly_achieved",
|
|
"satisfaction": "satisfied",
|
|
}
|
|
defaults.update(kw)
|
|
return SessionAudit(**defaults)
|
|
|
|
|
|
def pair(
|
|
meta_kw: dict[str, Any] | None = None,
|
|
audit_kw: dict[str, Any] | None = None,
|
|
) -> tuple[SessionMeta, SessionAudit]:
|
|
return make_meta(**(meta_kw or {})), make_audit(**(audit_kw or {}))
|