Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:777genius Agent teams ai KanbanLayoutEngine layout

From Leeroopedia
Knowledge Sources
Domains Visualization, Layout
Last Updated 2026-10-22 00:00 GMT

Overview

Concrete tool for positioning task nodes in kanban columns relative to their owner member nodes, provided by the Agent Teams agent-graph package.

Description

The KanbanLayoutEngine.layout() static method positions all task nodes in kanban columns (review, approved) beneath their owner. It runs after d3-force settles member positions and before canvas drawing. The engine reuses static internal collections (nodeMap, tasksByOwner, unassigned, colTasks) cleared per call to avoid GC pressure.

Key behaviors:

  • Post-simulation positioning: Reads member positions from the settled force simulation; positions tasks relative to their owner.
  • Slot frame geometry: Uses `SlotFrame` objects (ownerId, x, y, width) to determine column placement zones.
  • Lead slot: An optional `leadSlotFrame` positions the lead's tasks.
  • Unassigned tasks: Tasks without an owner slot are placed in `unassignedTaskRect`.
  • Zone metadata: Updates `KanbanLayoutEngine.zones` with `KanbanZoneInfo[]` for rendering column headers.
  • Empty placeholders: Optional `showEmptyTaskPlaceholders` controls whether empty columns render placeholder rects.

Usage

  • After force settle: Call `KanbanLayoutEngine.layout(nodes, options)` in the simulation tick after positions settle.
  • With slot frames: Pass `memberSlotFrames` from the stable slot layout snapshot to position tasks in owner slots.

Code Reference

Source Location

  • Repository: agent-teams
  • File: packages/agent-graph/src/layout/kanbanLayout.ts

Signature

export class KanbanLayoutEngine {
  static readonly zones: KanbanZoneInfo[];

  static layout(
    nodes: GraphNode[],
    options?: {
      memberSlotFrames?: readonly SlotFrame[];
      leadSlotFrame?: SlotFrame | null;
      unassignedTaskRect?: StableRect | null;
      showEmptyTaskPlaceholders?: boolean;
    }
  ): void;
}

Import

import { KanbanLayoutEngine } from '@agent-graph/layout/kanbanLayout';

I/O Contract

Inputs

Name Type Required Description
nodes GraphNode[] Yes All graph nodes (members, lead, tasks) with settled positions
options.memberSlotFrames readonly SlotFrame[] No Owner slot geometry for task placement
options.leadSlotFrame null No Lead slot geometry
options.unassignedTaskRect null No Rectangle for unassigned tasks
options.showEmptyTaskPlaceholders boolean No Whether to show empty column placeholders

Outputs

Name Type Description
return void Mutates task node positions in-place
KanbanLayoutEngine.zones KanbanZoneInfo[] Updated zone metadata for column header rendering

Usage Examples

Basic Layout After Simulation

import { KanbanLayoutEngine } from '@agent-graph/layout/kanbanLayout';

// After force simulation settles member positions
const nodes = simulation.stateRef.current.nodes;

KanbanLayoutEngine.layout(nodes, {
  memberSlotFrames: slotFrames,
  leadSlotFrame: leadFrame,
  unassignedTaskRect: { x: 0, y: 400, width: 200, height: 100 },
});

// Read zone info for header rendering
for (const zone of KanbanLayoutEngine.zones) {
  drawColumnHeader(ctx, zone.label, zone.x, zone.y, zone.width);
}

With Empty Task Placeholders

KanbanLayoutEngine.layout(nodes, {
  memberSlotFrames: slotFrames,
  showEmptyTaskPlaceholders: true,
  // Empty columns will render placeholder rectangles
});

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment