Skip to content

feat(phase35-step11): Project mode UI (chat composer + status pills)#24

Merged
AVADSA25 merged 1 commit into
mainfrom
feat/phase35-step11-ui
May 3, 2026
Merged

feat(phase35-step11): Project mode UI (chat composer + status pills)#24
AVADSA25 merged 1 commit into
mainfrom
feat/phase35-step11-ui

Conversation

@AVADSA25
Copy link
Copy Markdown
Owner

@AVADSA25 AVADSA25 commented May 3, 2026

Summary

Phase 3.5 Step 11 — Project mode UI for the existing chat composer. Closes the gap from Phase 3 Step 10 (which deferred PWA HTML to Phase 3.5).

You can now drop a project from the chat composer without curl. Status pills above input poll /api/agents every 5s and render running/blocked/paused/awaiting agents with inline action links.

What changes

HTML (single file: codec_dashboard.html):

  1. Mode toggle chips above chat input: [💬 Chat | 🎯 Project]
  2. Agent status pills container (hidden when no active agents)
  3. JS handlers: setChatMode(), refreshAgentStatusPills(), abortAgent() / pauseAgent() / resumeAgent() / approveAgent()
  4. sendCmd() dispatch branch: Project mode → POST /api/agents (Step 8 endpoint)

No Python changes. All backend support (POST /api/agents, GET /api/agents, abort/pause/resume/approve/grant endpoints) shipped in Phase 3 Step 8 + Step 9.

Pill states + actions

Status Pill color Inline actions
running green pause, abort
paused orange resume, abort
awaiting_approval yellow approve, abort
draft_pending grey abort
blocked_on_permission / blocked_on_destructive red abort
crashed_resumed orange abort

Polls /api/agents every 5 s; refreshes immediately after any action click. Silent on 401/403 (pills hide; no auth = no UI).

Test plan

  • No code changes outside codec_dashboard.html; no Python tests impacted
  • Existing helpers escHtml and showToast reused (verified at lines 778, 1919)
  • Post-merge deploy: pm2 restart codec-dashboard (HTML is served by FastAPI; restart picks up the new template)
  • Real-world test:
    1. Open dashboard → verify mode chips render (Chat highlighted by default)
    2. Click 🎯 Project → placeholder changes to "Drop your project here…"
    3. Type "Build me a Telegram bot for Marbella property listings" → Send
    4. Verify response shows agent_id=agent_xxx + instructions
    5. Status pill appears with agent_xxx in awaiting_approval state
    6. Click [approve] → confirm → pill flips to running
    7. Watch ~/.codec/audit.log for agent_started + agent_checkpoint_* events

Phase 3.5 next steps

After this:

  • Step 12: Anchor example end-to-end run (drop the Marbella bot project, document the run in docs/PHASE35-ANCHOR-EXAMPLE-RUN.md)
  • Step 13: Proactive intelligence overlay (full design + ship)

🤖 Generated with Claude Code

…s pills)

Adds 3 things to the existing chat composer in codec_dashboard.html:

1. Mode toggle chips above input — [💬 Chat | 🎯 Project]. Default: chat.
   Selecting Project changes the placeholder to "Drop your project here..."
   and routes sendCmd() to POST /api/agents instead of /api/command.

2. Agent status pills above input — polls /api/agents every 5s and renders
   one pill per agent in (running, paused, blocked_*, awaiting_approval,
   draft_pending, crashed_resumed) state. Inline action links per status:
     running     → [pause] [abort]
     paused      → [resume] [abort]
     awaiting_approval → [approve] [abort]
     blocked_*   → [abort]   (grant requires kind+value, deferred)
     draft_pending     → [abort]

   401/403 silently hides pills (no auth = no UI, by design).

3. sendCmd() dispatch branch: when window._chatMode === 'project', POSTs
   the user text to /api/agents (Step 8 endpoint) and shows agent_id +
   instructions in the result panel. Falls through to existing chat
   path when mode === 'chat' (default).

Reuses existing escHtml + showToast + var(--accent)/var(--border) CSS
tokens. No new CSS classes, no new dependencies. Pure HTML/JS additions
to codec_dashboard.html.

No Python changes — backend (POST /api/agents, GET /api/agents,
abort/pause/resume/approve endpoints) all shipped in Phase 3 Steps 8+9.
This PR is the user-facing affordance that makes those endpoints usable
without curl.

Test plan: load dashboard, verify mode chips render, click Project →
verify placeholder updates, type "Build me a property bot" + send →
verify drafts appear in /api/agents response and pill renders. Approve
via [approve] inline link → verify codec-agent-runner picks up.
@AVADSA25 AVADSA25 merged commit 495714a into main May 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants