standaloneAgent.ts 803 B

1234567891011121314151617181920212223
  1. /**
  2. * Standalone agent utilities for sessions with custom names/colors
  3. *
  4. * These helpers provide access to standalone agent context (name and color)
  5. * for sessions that are NOT part of a swarm team. When a session is part
  6. * of a swarm, these functions return undefined to let swarm context take
  7. * precedence.
  8. */
  9. import type { AppState } from '../state/AppState.js'
  10. import { getTeamName } from './teammate.js'
  11. /**
  12. * Returns the standalone agent name if set and not a swarm teammate.
  13. * Uses getTeamName() for consistency with isTeammate() swarm detection.
  14. */
  15. export function getStandaloneAgentName(appState: AppState): string | undefined {
  16. // If in a team (swarm), don't return standalone name
  17. if (getTeamName()) {
  18. return undefined
  19. }
  20. return appState.standaloneAgentContext?.name
  21. }