From d39220eac03fbc5b714bde989665ed1c92dd24a5 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Wed, 28 Jan 2026 23:32:26 -1000 Subject: Expand agent context API with completed log and calendar view - Add completed_tasks table to log task completions with title, due date, and completion timestamp - Extend agent context date range: 7 days back to 14 days forward - Add completed_log to API response (last 50 completed tasks) - Add day_section field to timeline items (overdue/today/tomorrow/later) - Add calendar-style view for today's schedule (6am-10pm hourly grid) - Add tabbed interface for Timeline vs Completed Log in HTML view Co-Authored-By: Claude Opus 4.5 --- SESSION_STATE.md | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'SESSION_STATE.md') diff --git a/SESSION_STATE.md b/SESSION_STATE.md index b4dd64d..cc637a7 100644 --- a/SESSION_STATE.md +++ b/SESSION_STATE.md @@ -8,14 +8,23 @@ Agent Context API - Refactored for simplicity and clarity - Status: [REVIEW_READY] Phase 1 Complete + Browser-Only Agent Endpoints + Refactored - Phase 2 (Write Operations) and Phase 3 (Create + Management) pending -### Recent Refactoring (agent.go) +### Recent Updates +**Refactoring (agent.go):** - Reused `BuildTimeline()` from timeline_logic.go instead of duplicating fetch logic -- Removed ~60 lines of duplicate timeline building code -- Added section headers for code organization: Constants, Types, Helpers, Auth Handlers, Context Handlers, Middleware, Web Handlers -- Extracted `isSessionExpired()` helper to reduce duplication -- Extracted `renderAgentTemplate()` helper to simplify template rendering -- Moved `AgentRequestPayload` from websocket.go to agent.go (agent-specific type) -- Used `config.Now()` and `config.Today()` for consistent timezone handling +- Added section headers for code organization +- Extracted helpers: `isSessionExpired()`, `renderAgentTemplate()` + +**Enhanced Context API:** +- Extended date range: 7 days back (overdue) to 14 days forward +- Added `completed_log` - tracks completed tasks with title, due date, completion date +- Added `day_section` field to timeline items (overdue/today/tomorrow/later) +- Calendar-style view for today (6am-10pm) in HTML template +- Tabs for Timeline vs Completed Log in web view + +**New Database:** +- `completed_tasks` table (migration 011) - logs completed task history +- `SaveCompletedTask()` / `GetCompletedTasks()` store methods +- `CompletedTask` model type ### Phase 1 Completed Items - [x] Migration `migrations/010_agent_tables.sql` — agents and agent_sessions tables -- cgit v1.2.3