-
Notifications
You must be signed in to change notification settings - Fork 23
feat: pin latest ACP plan above transcript #926
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,207 @@ | ||
| <!-- | ||
| PlanCard.svelte — the latest ACP plan, pinned above the chat transcript. | ||
|
|
||
| Renders a collapsible card summarizing the agent's current plan. The header | ||
| shows a caret, an overall status icon mirroring tool-call semantics, the | ||
| "Plan" title, and a muted completed/total progress summary. The body lists | ||
| each entry with a per-status icon. | ||
|
|
||
| Props: | ||
| entries — the plan entries (never empty; callers gate on latestPlan) | ||
| defaultExpanded — initial expansion; user toggles are respected afterwards | ||
| --> | ||
| <script lang="ts"> | ||
| import { slide } from 'svelte/transition'; | ||
| import CircleAlert from '@lucide/svelte/icons/circle-alert'; | ||
| import CircleCheck from '@lucide/svelte/icons/circle-check'; | ||
| import CircleDot from '@lucide/svelte/icons/circle-dot'; | ||
| import ChevronRight from '@lucide/svelte/icons/chevron-right'; | ||
| import Spinner from '../../shared/Spinner.svelte'; | ||
| import type { PlanEntry } from './acpTranscript'; | ||
|
|
||
| interface Props { | ||
| entries: PlanEntry[]; | ||
| defaultExpanded: boolean; | ||
| } | ||
|
|
||
| let { entries, defaultExpanded }: Props = $props(); | ||
|
|
||
| // Initialized once (capturing the initial value is intentional); new plan | ||
| // updates streaming in never override the user's explicit toggle. | ||
| // svelte-ignore state_referenced_locally | ||
| let expanded = $state(defaultExpanded); | ||
|
|
||
| let completedCount = $derived(entries.filter((entry) => entry.status === 'completed').length); | ||
| let overallStatus = $derived.by((): PlanEntry['status'] => { | ||
| if (entries.some((entry) => entry.status === 'failed')) return 'failed'; | ||
| if (entries.some((entry) => entry.status === 'in_progress')) return 'in_progress'; | ||
| if (entries.length > 0 && entries.every((entry) => entry.status === 'completed')) | ||
| return 'completed'; | ||
| return 'pending'; | ||
| }); | ||
| </script> | ||
|
|
||
| <div class="plan-card"> | ||
| <button | ||
| type="button" | ||
| class="plan-header" | ||
| aria-expanded={expanded} | ||
| onclick={() => (expanded = !expanded)} | ||
| > | ||
| <span class="plan-caret" class:plan-caret-expanded={expanded}> | ||
| <ChevronRight size={12} /> | ||
| </span> | ||
| <span | ||
| class="plan-status-icon" | ||
| class:status-running={overallStatus === 'in_progress'} | ||
| class:status-danger={overallStatus === 'failed'} | ||
| class:status-success={overallStatus === 'completed'} | ||
| > | ||
| {#if overallStatus === 'in_progress'} | ||
| <Spinner size={11} /> | ||
| {:else if overallStatus === 'failed'} | ||
| <CircleAlert size={11} /> | ||
| {:else if overallStatus === 'completed'} | ||
| <CircleCheck size={11} /> | ||
| {:else} | ||
| <CircleDot size={11} /> | ||
| {/if} | ||
| </span> | ||
| <span class="plan-title">Plan</span> | ||
| <span class="plan-progress">{completedCount}/{entries.length}</span> | ||
| </button> | ||
| {#if expanded} | ||
| <div class="plan-entries" transition:slide={{ duration: 150 }}> | ||
| {#each entries as entry} | ||
| <div class="plan-entry"> | ||
| <span | ||
| class="plan-entry-icon" | ||
| class:status-running={entry.status === 'in_progress'} | ||
| class:status-success={entry.status === 'completed'} | ||
| class:status-danger={entry.status === 'failed'} | ||
| > | ||
| {#if entry.status === 'in_progress'} | ||
| <Spinner size={11} /> | ||
| {:else if entry.status === 'completed'} | ||
| <CircleCheck size={11} /> | ||
| {:else if entry.status === 'failed'} | ||
| <CircleAlert size={11} /> | ||
| {:else} | ||
| <CircleDot size={11} /> | ||
| {/if} | ||
| </span> | ||
| <span class="plan-entry-text">{entry.content}</span> | ||
| </div> | ||
| {/each} | ||
| </div> | ||
| {/if} | ||
| </div> | ||
|
|
||
| <style> | ||
| .plan-card { | ||
| flex-shrink: 0; | ||
| border-bottom: 1px solid var(--border-subtle); | ||
| background: var(--bg-secondary); | ||
| padding: 6px 16px; | ||
| font-size: var(--size-xs); | ||
| } | ||
|
|
||
| .plan-header { | ||
| display: flex; | ||
| align-items: center; | ||
| gap: 4px; | ||
| width: 100%; | ||
| border: 0; | ||
| background: transparent; | ||
| color: var(--text-muted); | ||
| padding: 2px 0; | ||
| text-align: left; | ||
| font: inherit; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| .plan-header:hover .plan-title { | ||
| text-decoration: underline; | ||
| } | ||
|
|
||
| .plan-caret { | ||
| display: inline-flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| flex-shrink: 0; | ||
| width: 8px; | ||
| height: 12px; | ||
| color: var(--text-faint); | ||
| } | ||
|
|
||
| .plan-caret :global(svg) { | ||
| transition: transform 0.15s ease; | ||
| } | ||
|
|
||
| .plan-caret-expanded :global(svg) { | ||
| transform: rotate(90deg); | ||
| } | ||
|
|
||
| .plan-title { | ||
| flex-shrink: 0; | ||
| font-weight: 500; | ||
| line-height: 1; | ||
| transform: translateY(-0.5px); | ||
| } | ||
|
|
||
| .plan-progress { | ||
| color: var(--text-faint); | ||
| } | ||
|
|
||
| .plan-status-icon, | ||
| .plan-entry-icon { | ||
| display: inline-flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| width: 12px; | ||
| height: 12px; | ||
| flex-shrink: 0; | ||
| color: var(--text-faint); | ||
| } | ||
|
|
||
| .status-running { | ||
| color: var(--ui-warning); | ||
| } | ||
|
|
||
| .status-success { | ||
| color: var(--ui-success, var(--ui-accent)); | ||
| } | ||
|
|
||
| .status-danger { | ||
| color: var(--ui-danger); | ||
| } | ||
|
|
||
| .plan-entries { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 4px; | ||
| margin-top: 4px; | ||
| padding: 2px 0 4px; | ||
| max-height: min(240px, 40vh); | ||
| overflow-y: auto; | ||
| overscroll-behavior: contain; | ||
| } | ||
|
|
||
| .plan-entry { | ||
| display: flex; | ||
| gap: 6px; | ||
| align-items: flex-start; | ||
| color: var(--text-muted); | ||
| line-height: 1.35; | ||
| } | ||
|
|
||
| .plan-entry-icon { | ||
| /* Reserve the slot even for pending entries so text stays aligned. */ | ||
| margin-top: 2px; | ||
| } | ||
|
|
||
| .plan-entry-text { | ||
| min-width: 0; | ||
| overflow-wrap: anywhere; | ||
| } | ||
| </style> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When an ACP plan contains many entries or long wrapped descriptions, this non-shrinking card has no maximum height or internal scrolling, while
.session-chat-paneis an overflow-hidden flex column. The expanded plan can therefore consume the pane's entire height and leave the transcript and composer clipped in a zero-height scroll area; cap the card/body height and make the entries independently scrollable.Useful? React with 👍 / 👎.