Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

881 B
Raw Blame
import { AGENT_STATUS_STALE_AFTER_MS, type AgentStatusEntry } from '../agent-status-types'
import { isAgentStatusFresh } from '../agent-status-freshness'
import { agentEntryCompletionAt } from '../agent-completion-time'

/** Whether a pane's new row can move it in the Smart order, so the sort's settle window restarts. */
export function isSmartSortRelevantAgentChange(
  existing: AgentStatusEntry | undefined,
  entry: AgentStatusEntry,
  updatedAt: number
): boolean {
  if (!existing || existing.state !== entry.state) {
    return true
  }
  return (
    !isAgentStatusFresh(existing, updatedAt, AGENT_STATUS_STALE_AFTER_MS) ||
    existing.worktreeId !== entry.worktreeId ||
    existing.tabId !== entry.tabId ||
    entry.stateStartedAt !== existing.stateStartedAt ||
    (entry.state === 'done' && agentEntryCompletionAt(existing) !== agentEntryCompletionAt(entry))
  )
}