← All proposals

Context: AgentTree

A tree of agent cards: the lead on top, its sub-agents side by side below, their helpers under them, joined by thin connectors.

Net-new componentOpen in Storybook

proposals/AgentTree/custom.md42 lines · View on GitHub

Custom and net-new: AgentTree

Everything in this proposal that is not plain PDS v2. npm run check:tokens reads this file: each net-new class, custom CSS variable and raw value found in the code must appear here in backticks.

Net-new components

  • .pds-agent-tree — A lead agent and its sub-agents as one live tree of cards, joined by connectors, with a details panel and a handoff animation.
    • Layout and connectors: .pds-agent-tree__bar, .pds-agent-tree__projects, .pds-agent-tree__tree, .pds-agent-tree__probe, .pds-agent-tree__probe-card, .pds-agent-tree__probe-gap, .pds-agent-tree__probe-indent, .pds-agent-tree__root, .pds-agent-tree__level, .pds-agent-tree__hang, .pds-agent-tree__below, .pds-agent-tree__link (a connector, drawn in the default border color), .pds-agent-tree__ring (the hollow dot's ring), .pds-agent-tree__lines (the AI gradient seen through a mask of the connectors between two working agents), .pds-agent-tree__arrival (a soft band that sweeps down a card a handoff reaches) and .pds-agent-tree__arrival-ring (the gradient border it reveals), .pds-agent-tree__links, .pds-agent-tree__dots, .pds-agent-tree__dot, .pds-agent-tree__light
    • Card (the tree item; its surface is the package Panel): .pds-agent-tree__node, .pds-agent-tree__card, .pds-agent-tree__item (the tree item inside the card, which the keyboard focuses), .pds-agent-tree__avatar, .pds-agent-tree__title-row, .pds-agent-tree__heading, .pds-agent-tree__name, .pds-agent-tree__subtitle, .pds-agent-tree__chevron, .pds-agent-tree__state, .pds-agent-tree__time, .pds-agent-tree__activity, .pds-agent-tree__context, .pds-agent-tree__tokens, .pds-agent-tree__foot, .pds-agent-tree__tools (a row of package IconButtons), .pds-agent-tree__tools-more, .pds-agent-tree__last
    • Details (under a divider inside the open card, the Agent Inbox pattern): .pds-agent-tree__details, .pds-agent-tree__details-head, .pds-agent-tree__details-name, .pds-agent-tree__details-task, .pds-agent-tree__details-usage, .pds-agent-tree__details-chips (a row of package Badges, silver-muted), .pds-agent-tree__details-logo (the model maker's logo inside the badge), .pds-agent-tree__details-actions, .pds-agent-tree__details-say
    • Floating message bar (the compact Composer in a top-layer popover over the middle of the screen): .pds-agent-tree__message
    • State is by data attribute, not modifier class: data-layout (wide / narrow) on the root, data-status, data-small and data-open on the node, data-live on the activity line, data-rest on connectors and dots, data-depth on a column,

Additions to existing PDS components

None.

Net-new props

All, on a net-new component. AgentTree: formatCost, formatDuration, handoffs, heading, isAnimated, labelStrings, onAgentSelect, onHandoffArrive, onProjectChange, onSteer, project, projects, root. Data types: AgentTreeAgent (activity, children, context, contextLimit, cost, ended, iconName, id, last, model, modelLogo, name, started, status, task, tools), AgentTreeHandoff, AgentTreeProject, AgentTreeTool, AgentTreeStatus and AgentTreeSteer.

Custom CSS variables

  • --agent-tree-arrival-duration — set on .pds-agent-tree; how long the stroke takes to sweep down a card a handoff reaches (800ms, half the PDS shimmer duration).
  • --agent-tree-card-width — set on .pds-agent-tree; the card's width in the wide layout. Also read from a hidden probe by the script.
  • --agent-tree-col — set on .pds-agent-tree and on .pds-agent-tree__hang; how many indents wide a sub-agent's column is (its deepest helper level), so a column fits its helpers.
  • --agent-tree-gap — set on .pds-agent-tree; the space between cards (--pds-spacing-xs), and between a connector and the card it enters.
  • --agent-tree-message-width — set on .pds-agent-tree; the width of the floating message bar (36rem, capped to the viewport minus a margin on each side).
  • --agent-tree-indent — set on .pds-agent-tree; how far each level is indented under its parent (three times --pds-spacing-xs: the card padding, the avatar's half and a gap), and the reserve on the lead so it sits over its sub-agents. Also read from the hidden probe.

Raw values kept on purpose

  • 36rem (--agent-tree-message-width) — the message bar's width. No PDS token is this wide. The port keeps it, or lets the Composer's own width rule.
  • 15rem (--agent-tree-card-width) — a card's width. No PDS token is this wide (the spacing scale ends at 9xl, used for layout, not for a component width). The port keeps it, or sets it from the container.
  • 800ms (--agent-tree-arrival-duration), 520ms, 380ms, 200ms, 2s and the easing curves — animation timings with no motion token. The handoff light's hop length (HOP_DURATION, 520ms), its length and layer count (LIGHT_LENGTH 44, LAYERS 8) are constants in AgentTreeLight.tsx.
  • CORNER (8) and DOT_RADIUS (3) in AgentTree.tsx — SVG user units for the connector's rounded corners and the hollow dot where a connector leaves its parent. They are not CSS lengths.
  • 0.2, 0.8, 0.4 and 0.5 percentages in the connector color-mix() — mix ratios of PDS tokens, not new colors.
  • 60% — the most of the last-handoff line a long sender may take, so the message still shows.
  • 1 (LINE_WIDTH) in AgentTree.tsx — the connector's width in SVG user units (the CSS --pds-border-width-default). The connectors between working agents are drawn into an SVG data URL used as a mask, where a CSS variable cannot reach. stroke='black' there is the mask's alpha only, not a visible color.
  • Inline style on the lines layer (width, height, maskImage): the mask is the connector geometry, measured from the cards at run time.
  • Inline style on the details (left, top, width, visibility) and on the handoff light's paths (strokeDasharray, and the Web Animations it runs): measured at run time from the card, so they cannot be a class. The package ProgressBar does the same for its width.