mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-09 16:02:36 +01:00
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work.
> - Agent pages expose identity files, reporting relationships, and
runtime settings.
> - Several controls had inconsistent spacing, weak navigation, or
misleading save feedback.
> - Empty task-row detail slots also reduced the title width before
truncation.
> - This pull request fixes those behaviors and aligns the reviewed UI
details.
> - The result is clearer agent editing and more readable task and agent
lists.
## Linked Issues or Issue Description
**What happened?**
Agent headers and file controls had inconsistent layout. The Identity
footer appeared without edits and did not provide clear save
confirmation. File names could wrap or omit the Markdown suffix. Task
titles truncated while empty detail slots occupied the row.
**Expected behavior**
Keep headers and actions aligned. Reveal the Identity footer only for
changes or save feedback. Use valid Markdown file names and actual file
dates. Let titles use available space.
**Steps to reproduce**
1. Open an agent overview, then its Identity tab.
2. Edit, undo, save, copy, and add an instruction file.
3. Resize the file panel and inspect file names and date labels.
4. Hover an agent row and inspect the Chat action and tooltip.
5. Open a task list with no recovery or external details and inspect
title width.
Related: #18716 is the prior UI bundle. #16934 and #14483 concern role
editing; this change does not add a role picker.
## What Changed
- Refine the character header, inline title and name editing, crown
position, runtime shortcut, and Chat/New task actions.
- Align profile metadata and manager selection; hide empty direct
reports.
- Refine Identity panels, Markdown filename validation, file-row hover,
truncation, Paper Mono typography, and copy feedback.
- Add a viewport-bound save footer with dirty, saving, and saved states.
Keep undo/discard separate from successful saves.
- Return recorded creation or modification dates for instruction files.
Reuse the active file transaction for metadata reads to avoid exhausting
the small connection pool.
- Reveal the agent-row Chat icon and label on hover, with a standard
delayed tooltip.
- Collapse empty task-row details so titles can use the available width.
## Verification
- Browser checks covered the local overview and Identity flows, narrow
file panels, successful file creation/update, undo/discard, header
navigation, row hover, tooltip delayed-open state, and full task titles.
- Focused instruction, save-footer, date, font-asset, and task-row tests
passed during development. After review, 55 file/instruction tests
passed, including cold restoration with recorded and unknown dates;
server typecheck and 18 immediate-save response tests also passed.
- Full `pnpm -r typecheck` and `pnpm build` passed after rebase onto
current master. The complete `pnpm test:run` attempt hit a 15-second
timeout in the existing chat Retry HTTP integration test; that case
passed in isolation (1 test passed). A second full attempt hit timeouts
in two other chat integration cases (GitHub webhook draining and
delivery retry budget); both passed in isolation without increasing
timeouts. All 55 remote checks passed on f31405a730, including the full
test matrix, build, typecheck, and final verification gate.
- `pnpm check:token-gates`, `node scripts/check-maps.mjs`, and `git diff
--check` passed on the submitted revision.
## Risks
- File dates are optional. Managed files require recorded dates because
restored projections have synthetic filesystem timestamps. External
files can use modification time; unknown dates are omitted.
- Save-footer timing depends on animation completion; reduced-motion and
failed-save paths have tests.
- Global Paper Mono typography can change text widths. Browser checks
covered the edited surfaces.
- No schema migration or new execution permissions are introduced.
## Model Used
OpenAI Codex, GPT-6, with repository tools, code execution, and browser
verification. The exact serving model ID and context-window size are not
exposed in this session.
## Checklist
- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes:` / `Closes:`
/ `Refs:` OR (b) described the issue in-PR following the relevant issue
template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub references)
- [x] My branch name describes the change and contains no internal
Paperclip ticket id or instance-derived details
- [x] I have run the relevant tests locally and they pass; full-run
timeout limitations and successful isolated reruns are documented above
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge
---------
Co-authored-by: Paperclip <noreply@paperclip.ing>
140 lines
5.2 KiB
TypeScript
140 lines
5.2 KiB
TypeScript
import { AgentAvatar } from "@/components/AgentAvatar";
|
|
import { useState, type ReactElement } from "react";
|
|
import type { Agent } from "@paperclipai/shared";
|
|
import {
|
|
Popover,
|
|
PopoverContent,
|
|
PopoverTrigger,
|
|
} from "@/components/ui/popover";
|
|
import { FlyoutAppearanceProvider, FlyoutHeader, FlyoutOptions } from "./ui/flyout";
|
|
import { Check, User } from "lucide-react";
|
|
import { cn } from "../lib/utils";
|
|
|
|
export function ReportsToPicker({
|
|
agents,
|
|
value,
|
|
onChange,
|
|
disabled = false,
|
|
excludeAgentIds = [],
|
|
disabledEmptyLabel = "Reports to: N/A (CEO)",
|
|
chooseLabel = "Reports to...",
|
|
trigger,
|
|
disabledAgentIds = [],
|
|
}: {
|
|
agents: Agent[];
|
|
value: string | null;
|
|
onChange: (id: string | null) => void;
|
|
disabled?: boolean;
|
|
excludeAgentIds?: string[];
|
|
disabledEmptyLabel?: string;
|
|
chooseLabel?: string;
|
|
trigger?: ReactElement;
|
|
disabledAgentIds?: string[];
|
|
}) {
|
|
const [open, setOpen] = useState(false);
|
|
const exclude = new Set(excludeAgentIds);
|
|
const rows = agents.filter(
|
|
(a) => a.status !== "terminated" && !exclude.has(a.id),
|
|
);
|
|
const current = value ? agents.find((a) => a.id === value) : null;
|
|
const terminatedManager = current?.status === "terminated";
|
|
const unknownManager = Boolean(value && !current);
|
|
|
|
return (
|
|
<FlyoutAppearanceProvider><Popover open={open} onOpenChange={setOpen}>
|
|
<PopoverTrigger asChild>
|
|
{trigger ?? <button
|
|
type="button"
|
|
className={cn(
|
|
"inline-flex max-w-full min-w-0 items-center gap-1.5 overflow-hidden rounded-md border border-border px-2 py-1 text-xs hover:bg-accent/50 transition-colors",
|
|
terminatedManager && "border-amber-600/45 bg-amber-500/5",
|
|
disabled && "opacity-60 cursor-not-allowed",
|
|
)}
|
|
disabled={disabled}
|
|
>
|
|
{unknownManager ? (
|
|
<>
|
|
<User className="h-3 w-3 shrink-0 text-muted-foreground" />
|
|
<span className="min-w-0 truncate text-muted-foreground">Unknown manager (stale ID)</span>
|
|
</>
|
|
) : current ? (
|
|
<>
|
|
<AgentAvatar agent={current} size={16} className="h-3 w-3 shrink-0 text-muted-foreground"/>
|
|
<span
|
|
className={cn(
|
|
"min-w-0 truncate",
|
|
terminatedManager && "text-amber-900 dark:text-amber-200",
|
|
)}
|
|
>
|
|
{`Reports to ${current.name}${terminatedManager ? " (terminated)" : ""}`}
|
|
</span>
|
|
</>
|
|
) : (
|
|
<>
|
|
<User className="h-3 w-3 shrink-0 text-muted-foreground" />
|
|
<span className="min-w-0 truncate">
|
|
{disabled ? disabledEmptyLabel : chooseLabel}
|
|
</span>
|
|
</>
|
|
)}
|
|
</button>}
|
|
</PopoverTrigger>
|
|
<PopoverContent className="w-64" align="start" aria-label="Choose manager">
|
|
<FlyoutHeader>Reports to</FlyoutHeader>
|
|
<FlyoutOptions className="max-h-80 overflow-y-auto">
|
|
<button
|
|
type="button"
|
|
aria-pressed={value === null}
|
|
className={cn(
|
|
"flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-accent/50",
|
|
value === null && "bg-accent",
|
|
)}
|
|
onClick={() => {
|
|
onChange(null);
|
|
setOpen(false);
|
|
}}
|
|
>
|
|
<User className="size-5 shrink-0" aria-hidden />
|
|
<span className="min-w-0 flex-1 text-left">No manager</span>
|
|
{value === null && <Check className="size-4 shrink-0" aria-hidden />}
|
|
</button>
|
|
{terminatedManager && (
|
|
<div className="flex min-w-0 items-center gap-2 overflow-hidden px-2 py-1.5 text-xs text-muted-foreground border-b border-border mb-0.5">
|
|
<AgentAvatar agent={current} size={16} className="shrink-0 h-3 w-3"/>
|
|
<span className="min-w-0 truncate">
|
|
Current: {current.name} (terminated)
|
|
</span>
|
|
</div>
|
|
)}
|
|
{unknownManager && (
|
|
<div className="px-2 py-1.5 text-xs text-muted-foreground border-b border-border mb-0.5">
|
|
Saved manager is missing from this organization. Choose a new manager or clear.
|
|
</div>
|
|
)}
|
|
{rows.map((a) => (
|
|
<button
|
|
type="button"
|
|
key={a.id}
|
|
aria-pressed={a.id === value}
|
|
disabled={disabledAgentIds.includes(a.id)}
|
|
title={disabledAgentIds.includes(a.id) ? "Would create a reporting loop" : undefined}
|
|
className={cn(
|
|
"flex items-center gap-2 w-full min-w-0 px-2 py-1.5 text-xs rounded hover:bg-accent/50 overflow-hidden disabled:opacity-50 disabled:cursor-not-allowed",
|
|
a.id === value && "bg-accent",
|
|
)}
|
|
onClick={() => {
|
|
onChange(a.id);
|
|
setOpen(false);
|
|
}}
|
|
>
|
|
<AgentAvatar agent={a} size={24} className="size-6 shrink-0"/>
|
|
<span className="min-w-0 flex-1 truncate text-left">{a.name}</span>
|
|
{a.id === value && <Check className="size-4 shrink-0" aria-hidden />}
|
|
</button>
|
|
))}
|
|
</FlyoutOptions>
|
|
</PopoverContent>
|
|
</Popover></FlyoutAppearanceProvider>
|
|
);
|
|
}
|