From e81be8aed7fb108dac7d4a5bfbae175c0c0f97f9 Mon Sep 17 00:00:00 2001 From: Alexander Payne Date: Thu, 26 Feb 2026 12:15:30 -0500 Subject: [PATCH] feat: Self-Coding Dashboard HTMX Templates Add complete UI for self-coding dashboard: Templates: - self_coding.html - Main dashboard page with layout - partials/self_coding_stats.html - Stats cards (total, success rate, etc) - partials/journal_entries.html - List of modification attempts - partials/journal_entry_detail.html - Expanded view of single attempt - partials/execute_form.html - Task execution form - partials/execute_result.html - Execution result display - partials/error.html - Error message display Features: - HTMX-powered dynamic updates - Real-time journal filtering (all/success/failure) - Modal dialog for task execution - Responsive Bootstrap 5 styling - Automatic refresh after successful execution --- src/dashboard/templates/partials/error.html | 7 + .../templates/partials/execute_form.html | 45 +++++ .../templates/partials/execute_result.html | 58 ++++++ .../templates/partials/journal_entries.html | 64 ++++++ .../partials/journal_entry_detail.html | 54 +++++ .../templates/partials/self_coding_stats.html | 71 +++++++ src/dashboard/templates/self_coding.html | 184 ++++++++++++++++++ 7 files changed, 483 insertions(+) create mode 100644 src/dashboard/templates/partials/error.html create mode 100644 src/dashboard/templates/partials/execute_form.html create mode 100644 src/dashboard/templates/partials/execute_result.html create mode 100644 src/dashboard/templates/partials/journal_entries.html create mode 100644 src/dashboard/templates/partials/journal_entry_detail.html create mode 100644 src/dashboard/templates/partials/self_coding_stats.html create mode 100644 src/dashboard/templates/self_coding.html diff --git a/src/dashboard/templates/partials/error.html b/src/dashboard/templates/partials/error.html new file mode 100644 index 00000000..c2c73cf4 --- /dev/null +++ b/src/dashboard/templates/partials/error.html @@ -0,0 +1,7 @@ +{# Error partial #} +
+
+ ⚠️ + {{ message }} +
+
diff --git a/src/dashboard/templates/partials/execute_form.html b/src/dashboard/templates/partials/execute_form.html new file mode 100644 index 00000000..c8c1dd86 --- /dev/null +++ b/src/dashboard/templates/partials/execute_form.html @@ -0,0 +1,45 @@ +{# Execute task form partial #} +
+
+ + +
+ Be specific. Include what to change and what the expected behavior should be. +
+
+ +
+ ⚠️ + + Warning: This will modify source code. Changes will be tested and committed. + Safety constraints: max 3 files, only files with tests, protected files cannot be modified. + +
+ +
+ + +
+
+ +
+
+
+ Executing self-edit task... This may take a few minutes. +
+
+ +
diff --git a/src/dashboard/templates/partials/execute_result.html b/src/dashboard/templates/partials/execute_result.html new file mode 100644 index 00000000..bcead9ab --- /dev/null +++ b/src/dashboard/templates/partials/execute_result.html @@ -0,0 +1,58 @@ +{# Execute task result partial #} +
+
+ {% if result.success %}✅{% else %}❌{% endif %} +
+
+ {% if result.success %}Success!{% else %}Failed{% endif %} +
+

{{ result.message }}

+ + {% if result.success %} + {% if result.files_modified %} +
+ Files modified: +
    + {% for file in result.files_modified %} +
  • {{ file }}
  • + {% endfor %} +
+
+ {% endif %} + + {% if result.commit_hash %} +
+ Commit: + {{ result.commit_hash[:8] }} +
+ {% endif %} + + {% if result.attempt_id %} + + {% endif %} + {% else %} + {% if result.test_results %} +
+ Test output: +
{{ result.test_results[:500] }}{% if result.test_results|length > 500 %}...{% endif %}
+
+ {% endif %} + {% endif %} +
+
+
+ +{# Refresh journal and stats after execution #} +{% if result.success %} + +{% endif %} diff --git a/src/dashboard/templates/partials/journal_entries.html b/src/dashboard/templates/partials/journal_entries.html new file mode 100644 index 00000000..2c7e171a --- /dev/null +++ b/src/dashboard/templates/partials/journal_entries.html @@ -0,0 +1,64 @@ +{# Journal entries list partial #} +{% if entries %} +
+ {% for entry in entries %} +
+ +
+
+ {# Outcome icon #} + {% if entry.outcome.value == 'success' %} + + {% elif entry.outcome.value == 'failure' %} + + {% else %} + + {% endif %} + + + #{{ entry.id }} + +
+ + + {{ entry.timestamp.strftime('%Y-%m-%d %H:%M') if entry.timestamp else 'Unknown' }} + +
+ +

{{ entry.task_description }}

+ +
+
+ {% if entry.files_modified %} + 📁 {{ entry.files_modified|length }} file(s) + {% endif %} + + {% if entry.retry_count > 0 %} + 🔄 {{ entry.retry_count }} retries + {% endif %} + + {% if entry.reflection %} + 💡 + {% endif %} +
+ + + {{ entry.outcome.value|upper }} + +
+ + {# Detail container - populated on click #} +
+
+ {% endfor %} +
+{% else %} +
+

No journal entries found.

+ Self-edit attempts will appear here. +
+{% endif %} diff --git a/src/dashboard/templates/partials/journal_entry_detail.html b/src/dashboard/templates/partials/journal_entry_detail.html new file mode 100644 index 00000000..a54f5f51 --- /dev/null +++ b/src/dashboard/templates/partials/journal_entry_detail.html @@ -0,0 +1,54 @@ +{# Journal entry detail partial #} +
+
+
Attempt Details
+ + {% if entry.approach %} +
+ Approach: +

{{ entry.approach }}

+
+ {% endif %} + + {% if entry.files_modified %} +
+ Files Modified: +
    + {% for file in entry.files_modified %} +
  • {{ file }}
  • + {% endfor %} +
+
+ {% endif %} + + {% if entry.diff %} +
+ Diff: +
{{ entry.diff[:500] }}{% if entry.diff|length > 500 %}...{% endif %}
+
+ {% endif %} + + {% if entry.test_results %} +
+ Test Results: +
{{ entry.test_results[:500] }}{% if entry.test_results|length > 500 %}...{% endif %}
+
+ {% endif %} + + {% if entry.failure_analysis %} +
+ Failure Analysis: +

{{ entry.failure_analysis }}

+
+ {% endif %} + + {% if entry.reflection %} +
+ Reflection: +
+ {{ entry.reflection|markdown }} +
+
+ {% endif %} +
+
diff --git a/src/dashboard/templates/partials/self_coding_stats.html b/src/dashboard/templates/partials/self_coding_stats.html new file mode 100644 index 00000000..93d4eadd --- /dev/null +++ b/src/dashboard/templates/partials/self_coding_stats.html @@ -0,0 +1,71 @@ +{# Stats cards partial for self-coding dashboard #} +
+ +
+
+
+
+
+
Total Attempts
+

{{ metrics.total }}

+
+ 📝 +
+
+
+
+ + +
+
+
+
+
+
Success Rate
+

+ {{ "%.0f"|format(metrics.overall * 100) }}% +

+
+ 📊 +
+
+
+
+
+
+
+ + +
+
+
+
+
+
Successes
+

{{ metrics.success }}

+
+ +
+
+
+
+ + +
+
+
+
+
+
Failures
+

{{ metrics.failure + metrics.rollback }}

+
+ +
+ + {{ metrics.failure }} fail / {{ metrics.rollback }} rollback + +
+
+
+
diff --git a/src/dashboard/templates/self_coding.html b/src/dashboard/templates/self_coding.html new file mode 100644 index 00000000..39bea5cf --- /dev/null +++ b/src/dashboard/templates/self_coding.html @@ -0,0 +1,184 @@ +{% extends "base.html" %} + +{% block title %}Self-Coding — Timmy Time{% endblock %} + +{% block content %} +
+ +
+
+

Self-Coding

+

Timmy's ability to modify its own source code

+
+
+ + +
+
+ + +
+
+
+
+ Loading stats... +
+
+
+
+ + +
+ +
+
+
+
Modification Journal
+
+ + + +
+
+
+
+
+
+ Loading journal... +
+
+
+
+
+
+ + +
+ +
+
+
Quick Actions
+
+
+
+ + + 📄 View Codebase Summary + +
+
+
+ + +
+
+
Safety Constraints
+
+
+
    +
  • ✓ Max 3 files per commit
  • +
  • ✓ Max 100 lines changed
  • +
  • ✓ Only files with test coverage
  • +
  • ✓ Max 3 retries on failure
  • +
  • ✓ Protected files cannot be modified
  • +
  • ✓ All changes on feature branches
  • +
+
+
+ + +
+
+
How It Works
+
+
+
    +
  1. Receive task description
  2. +
  3. Find relevant files via indexer
  4. +
  5. Check journal for similar attempts
  6. +
  7. Create feature branch
  8. +
  9. Plan edit with LLM
  10. +
  11. Execute via Aider or direct edit
  12. +
  13. Run tests
  14. +
  15. Commit on success, rollback on failure
  16. +
  17. Log attempt and reflect
  18. +
+
+
+
+
+
+ + + +
+
+
Execute Self-Edit Task
+ +
+
+ +
+
+
+ + +{% endblock %}