Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

Merge remote-tracking branch 'origin/main' into feat/github-pr-ci-cards

review9465554607da
diff --cc src/renderer/components/kanban/KanbanView.tsx
index 1d6aa6844,3baf7843a..348e8bea8
--- a/src/renderer/components/kanban/KanbanView.tsx
+++ b/src/renderer/components/kanban/KanbanView.tsx
@@@ -136,20 -135,26 +147,39 @@@ const isProviderDrag = (drag: CardDrag)
/** Shared empty results — stable identities so memoized cards/columns see "no change". */
const NO_LABELS: KanbanLabel[] = []
const NO_CARDS: KanbanSession[] = []
+const NO_PULLS: GitHubPullStatus[] = []
+
+/** Re-renders once a minute while `active`, so a stale pull status greys on time even when nothing
+ * else changes (a failing read that stays failing announces nothing new). */
+function useMinuteTick(active: boolean): number {
+ const [now, setNow] = useState(() => Date.now())
+ useEffect(() => {
+ if (!active) return
+ const timer = setInterval(() => setNow(Date.now()), 60_000)
+ return () => clearInterval(timer)
+ }, [active])
+ return now
+}
+ /** The card the board's keys act FROM: the focused card, else the one under the pointer. */
+ function currentBoardCard(active: Element | null): string | null {
+ const focused = active?.closest?.('[data-kanban-card]')?.getAttribute('data-kanban-card')
+ if (focused) return focused
+ const hovered = [...document.querySelectorAll('[data-kanban-card]')].filter((el) => el.matches(':hover'))
+ return hovered.at(-1)?.getAttribute('data-kanban-card') ?? null
+ }
+
+ /** Focus a card and bring it into view. Compared by attribute, never interpolated into a selector:
+ * node ids come from a git-shared file. */
+ function focusBoardCard(id: string): void {
+ const el = [...document.querySelectorAll<HTMLElement>('[data-kanban-card]')].find(
+ (c) => c.getAttribute('data-kanban-card') === id
+ )
+ if (!el) return
+ el.focus({ preventScroll: true })
+ el.scrollIntoView?.({ block: 'nearest', inline: 'nearest' })
+ }
+
/** Full-page session board OVER the canvas. The canvas stays mounted underneath (its
* agent-status listeners must keep running, and display:none would 0×0-resize every
* terminal into a tmux SIGWINCH) — this is an opaque overlay, nothing more.
@@@ -198,11 -202,15 +231,18 @@@ export const KanbanView = memo(functio
const projectId = useProjects((s) => s.activeProjectId)
const projectName = useProjects((s) => s.projects.find((p) => p.id === s.activeProjectId)?.name)
const projectColor = useProjects((s) => s.projects.find((p) => p.id === s.activeProjectId)?.color)
+ // Per-user display: whether `closed` columns are on screen (localStorage, never the board).
+ const showClosed = useKanbanDisplay((s) => s.byProject[projectId]?.showClosed === true)
+ const setShowClosed = useKanbanDisplay((s) => s.setShowClosed)
+ // A category change that would re-mean cards waits here for an explicit confirmation.
+ const [pendingCategory, setPendingCategory] = useState<
+ { columnId: string; category: KanbanColumnCategory | undefined; message: string } | null
+ >(null)
const github = useGitHubIssues((state) => state.projects[projectId])
const githubReadOnly = Object.values(github?.pages ?? {}).some((page) => page.readOnly)
+ const githubMappingNotApproved = Object.values(github?.pages ?? {}).some((page) => page.mappingNotApproved)
+ // Every page of one project carries the same identity's throttle; any one of them answers.
+ const githubThrottle = Object.values(github?.pages ?? {}).find((page) => page.throttle)?.throttle
// Pull requests are evicted first when a repository outgrows the cache bounds, so the lane can
// legitimately be a subset. Say so — a silently short list reads as "this repo has few PRs".
const pullsTruncated = Object.values(github?.pullPages ?? {}).some((page) => page.partial)
@@@ -331,32 -328,15 +372,41 @@@
)
const byId = useMemo(() => new Map(sessions.map((s) => [s.id, s])), [sessions])
const sessionIds = useMemo(() => sessions.map((s) => s.id), [sessions])
+ // Stable per-card PR arrays (SessionCard is memoized): rebuilt only when the pull board, the
+ // cards or the board's own link tombstones change.
+ const pullLinksKey = JSON.stringify(board.pullLinks ?? null)
+ const pullsByCard = useMemo(() => {
+ const byCard = new Map<string, GitHubPullStatus[]>()
+ if (!board.github) return byCard
+ for (const session of sessions) {
+ const linked = pullsForCard(session, pullBoard, board).linked
+ if (linked.length) byCard.set(session.id, linked)
+ }
+ return byCard
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [sessions, pullBoard, pullLinksKey, !!board.github])
+ usePullChase(api.githubIssues, projectId, !!board.github && !!pullBoard?.undecided)
+ const autoMove = useCallback(
+ (cardId: string, fromColumnId: string | null, toColumnId: string, note: string) =>
+ onAutoMoveFromPulls?.(projectId, cardId, fromColumnId, toColumnId, note),
+ [onAutoMoveFromPulls, projectId]
+ )
+ usePullAutoMove({
+ projectId,
+ cards: sessions,
+ board,
+ pullBoard: board.github ? pullBoard : undefined,
+ ...(onAutoMoveFromPulls ? { onAutoMove: autoMove } : {})
+ })
+ // The chips' facts through a DERIVED SIGNATURE (a primitive that changes only when a card's
+ // running / needs-you / unread fact does) — never `byId`, which changes on every hook event of
+ // every node and would re-render the whole board each time.
+ const chipCards = useMemo<StatusChipCard[]>(() => sessions.map((s) => ({ id: s.id, kind: s.kind })), [sessions])
+ const statusSig = useAgentStatus((st) => statusChipSig(st.byId, chipCards))
+ const statusFacts = useMemo(() => parseStatusChipSig(statusSig), [statusSig])
+ const statusCounts = useMemo(() => chipCounts(statusFacts), [statusFacts])
+ const toggleStatusChip = (chip: StatusChip): void =>
+ setStatusChips((cur) => (cur.includes(chip) ? cur.filter((c) => c !== chip) : [...cur, chip]))
// Stable per-card label arrays: labelsForCard allocates a fresh array per call, and that
// identity churn alone would defeat SessionCard's memo. Recomputed only on a board change.
@@@ -790,13 -884,21 +970,26 @@@
status={github?.issueStatus[modalIssue.item.number]}
onMove={(columnId) => handleMoveGitHub(modalIssue.item, columnId)}
onClose={() => setModalIssue(null)}
+ projectId={projectId}
+ pullStatus={modalIssue.kind === 'pull' ? pullByNumber.get(modalIssue.item.number) : undefined}
+ closingPulls={modalIssue.kind === 'issue' ? pullsByIssue.get(modalIssue.item.number) : undefined}
+ pullFreshness={pullFreshness}
+ pullObservedAt={pullBoard?.observedAt}
/>
)}
+ {pendingCategory && (
+ <ConfirmDialog
+ message={pendingCategory.message}
+ confirmLabel="Change category"
+ onCancel={() => setPendingCategory(null)}
+ onConfirm={() => {
+ const { columnId, category } = pendingCategory
+ setPendingCategory(null)
+ const next = setColumnCategory(board, columnId, category)
+ if (next !== board) commit(next)
+ }}
+ />
+ )}
{pendingGitHubMove && (
<ConfirmDialog
message={pendingGitHubMove.confirmation.message}
diff --cc src/renderer/components/kanban/SessionCard.tsx
index fff07b1ad,54717d02d..3edaf12be
--- a/src/renderer/components/kanban/SessionCard.tsx
+++ b/src/renderer/components/kanban/SessionCard.tsx
@@@ -8,8 -8,7 +8,9 @@@ import { NodeIconView } from '../NodeIc
import { LabelChips } from './LabelChips'
import { PRIORITIES } from './CardMetaBar'
import type { KanbanSession } from './KanbanView'
+import type { GitHubPullStatus, PullStatusFreshness } from '@shared/github-pull-status'
+import { PullRefChip } from './PullStatusBadges'
+ import { cardBadge } from '../../lib/kanbanStatusChips'
const PRIO_COLOR = Object.fromEntries(PRIORITIES.map((p) => [p.id, p.color])) as Record<KanbanPriority, string>
diff --cc src/renderer/components/settings/sections/GitHubIssuesSection.tsx
index 13f93bf4d,4889bf39b..f81d82bc2
--- a/src/renderer/components/settings/sections/GitHubIssuesSection.tsx
+++ b/src/renderer/components/settings/sections/GitHubIssuesSection.tsx
@@@ -5,11 -5,10 +5,13 @@@ import type
GitHubControlView,
ProjectKanbanGitHub
} from '@shared/github-issues'
+ import type { KanbanColumn } from '@shared/types'
+ import { defaultCompletionColumnId } from '@shared/kanban-category'
import { useProjects } from '../../../state/projects'
+import { useSettings } from '../../../state/settings'
+import { prunePullAutoMove, sanitizeKanbanPullAutoMove } from '@shared/kanban-pull-links'
import { markWorkspaceDirty } from '../../../state/workspaceDirty'
+import { SAVE_DEBOUNCE_MS } from '../../../lib/savePersistence'
import { SettingsSection } from '../SettingsSection'
import { SearchableRow } from '../SearchableRow'
import { useSettingsSearch } from '../context'
diff --cc src/renderer/lib/kanban.ts
index 502c56782,b11d6d704..bb940f27d
--- a/src/renderer/lib/kanban.ts
+++ b/src/renderer/lib/kanban.ts
@@@ -1,8 -1,10 +1,11 @@@
- import type { CanvasNodeState, KanbanAssignment, KanbanColumn, Project, ProjectKanban } from '@shared/types'
+ import type {
+ CanvasNodeState, KanbanAssignment, KanbanColumn, KanbanColumnCategory, Project, ProjectKanban
+ } from '@shared/types'
+ import { columnCategory } from '@shared/kanban-category'
import { SYSTEM_NODE_COLORS } from '../state/workspace'
- import { DEFAULT_BOARD_COLUMNS, makeColumnId } from '@shared/kanban-default-board'
+ import { defaultBoardColumns } from '@shared/kanban-default-board'
import { autoLabelColor, boardLabels, cardMeta, createLabel, metaList, setCardLabels } from '@shared/kanban-labels'
+import { prunePullLinks } from '@shared/kanban-pull-links'
// The card-meta + label transforms live in `@shared/kanban-labels` (the host core applies the
// same ones for the phone's label verb); re-exported so every renderer import stays as it was.