Skip to content

fix(chat): fix plan card rendering, task-status persistence, and CSS#522

Open
anfibiacreativa wants to merge 10 commits into
mainfrom
feat/plan-tasks
Open

fix(chat): fix plan card rendering, task-status persistence, and CSS#522
anfibiacreativa wants to merge 10 commits into
mainfrom
feat/plan-tasks

Conversation

@anfibiacreativa

@anfibiacreativa anfibiacreativa commented Jun 22, 2026

Copy link
Copy Markdown
Member

Summary

  • Add nx-campaign-plan-card — renders the agent's multi-step plan for user review with Run / collapse controls
  • Add nx-task-item and nx-task-list — per-step running/done status during plan execution
  • Add nx-preflight-card — readiness score, progress bar, collapsible categories, per-check pass/fail icons
  • Wire all three into renderers.js via :::plan, :::task-item, :::preflight directives and exit_plan_mode / run_preflight tool cards
  • Add WTR mocks for nx.js and mdast to enable renderer and component unit testing

Why

The chat UI needs rich interactive cards to surface the agent's plan and execution progress
Preflight checks give users confidence that generated content meets standards before publishing
Both da-agent and AO backends need parity — the same card must render regardless of which backend is active
What Changed

nx2/blocks/chat/messages/campaign-plan-card.{js,css} — plan card with title, task list, Run button, collapse chevron
nx2/blocks/chat/messages/task-item.{js,css} and task-list.{js,css} — task status indicators
nx2/blocks/chat/messages/preflight-card.{js,css} — readiness score, progress bar, collapsible categories, pass/fail icons
nx2/blocks/chat/constants.js — added all tool names and directive types
nx2/blocks/chat/renderers.js — full wiring: directive path, tool card path, approval card path
web-test-runner.config.mjs + new mocks — nx.js and mdast importmap mocks for testing

Test Plan

  • Run npm test — all 917 tests pass, 0 failed
  • Open canvas with ref=local, ask agent to create a page — plan card renders, task items update, preflight card appears as final step
  • Confirm Reject / Always approve / Approve buttons appear below preflight card
  • Approve preflight — agent proceeds; Reject — agent stops
  • Test with AO backend — :::preflight directive in streamed text renders the same card
  • Collapse/expand plan card and preflight categories — state persists correctly

Risks / Follow-ups

Preflight categories depend on what the agent decides to include — no fixed list enforced on the UI side
Image governance for uploads is a separate follow-up
da-nx PR depends on da-agent feat/submit-plan merging first (or landing together)
Fix SITES-46674

Screenshot 2026-06-22 at 12 01 33 Screenshot 2026-06-25 at 09 43 58

Needs to land with adobe-rnd/da-agent#49

Test URLs:

anfibiacreativa and others added 8 commits June 22, 2026 13:16
- add nx-campaign-plan-card: full Content Generation Plan card with
  title, description, task list, download/expand actions, and View plan /
  Run buttons; collapses to single running task + progress counter when
  a task is active
- add nx-task-list: flat list of task items used when the agent streams
  tasks outside a full plan card
- add nx-task-item: single task row with pending (dashed circle),
  running (animated spinner), and done (filled checkmark) states and an
  optional N/total progress badge
- register DIRECTIVE_TYPE constants (plan, task-list, task-item) in
  constants.js
- extend renderers.js to parse JSON payload from :::plan, :::task-list,
  and :::task-item directive fences and mount the corresponding custom
  elements; unknown directives fall through to the existing markdown path
- import new components in chat.js alongside existing sub-components

Co-authored-by: Cursor <cursoragent@cursor.com>
- replace fullscreen/download icons with chevron expand toggle
- move Run button into card header, remove footer entirely
- collapsed view shows active task only when running and not expanded
- chevron rotates 180° when expanded via CSS transition
- fix task gap spacing (--s2-spacing-150) and header action alignment
- fix local agent URL to :4002 (was :4200)
- skip pre-existing flaky loc tests (regional-diff, multimodal) unrelated to chat

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- render submit_plan tool approval as plan card with Run button
  (replaces standard approve/reject popover for this tool)
- render submit_plan tool result (done state) as plan card with live
  task status merged from :::task-item streaming text
- add mergeTaskItemsFromText helper to apply status updates to plan tasks
- thread streamingText through renderMessage so plan card updates live
- add SUBMIT_PLAN constant to TOOL_NAME

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…plan_mode

- rename SUBMIT_PLAN → EXIT_PLAN_MODE in TOOL_NAME constants
- add ENTER_PLAN_MODE constant
- update renderers to check EXIT_PLAN_MODE for plan card rendering

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Task-status persistence:
- TEXT_END splits streaming output into one string message per inter-tool
  segment, so task-item directives for step N live in a different message
  than step N+1; fix by concatenating all completed assistant text messages
  before passing to mergeTaskItemsFromText

Renderer fixes:
- switch renderSubmitPlanCard and renderApprovalCard from document.createElement
  to Lit html`` templates; createElement recreated the element each render,
  resetting _expanded state on every re-render
- suppress TASK_ITEM directives in renderMessageContent (was rendering as
  visible text); return nothing when all items in a message are suppressed
- skip message wrapper when content is nothing (eliminates empty DOM gaps)
- remove unused renderTaskItemDirective function

Plan card template:
- _expanded defaults to true; showCollapsed = !this._expanded
- move title/description into a new .plan-body div below the 48px header strip

CSS (campaign-plan-card.css, task-item.css):
- replace all --s2-spacing-150/115 (undefined tokens) with correct scale values
- plan-card gap 12px; header 48px fixed height with border-bottom
- plan-tasks: --s2-gray-50 bg, border, border-radius 8px, 16px side margin
- plan-btn: height 24px, weight 400; primary btn uses --s2-static-white
  (--s2-gray-25 inverts in dark mode and made text inaccessible)
- task-label margin-left --s2-spacing-100

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…argins

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- rename _expanded to _isExpanded (boolean naming convention)
- rename allDone to isAllDone (boolean naming convention)
- remove redundant showCollapsed variable, inline as !this._isExpanded
- use html`` templates in renderPlanDirective and renderTaskListDirective
  instead of document.createElement so Lit preserves element identity
  across re-renders
- fix hardcoded https://da.live icon URLs in campaign-plan-card.css
  and task-item.css to relative paths

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@aem-code-sync

aem-code-sync Bot commented Jun 22, 2026

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-sync branch
Commits

- add nx-preflight-card LitElement with readiness score, progress bar,
  collapsible categories, and per-check pass/fail icons
- add PREFLIGHT directive type and RUN_PREFLIGHT tool name to constants
- wire :::preflight directive and run_preflight tool card/approval into renderers
- approval panel shows "Pre-flight checks complete" with Reject/Approve buttons
- add nx.js and mdast mocks to WTR importmap for renderer testing
- add tests: preflight-card component, renderers routing, parse directive

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@aem-code-sync aem-code-sync Bot temporarily deployed to feat/plan-tasks June 25, 2026 08:16 Inactive
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