Documentation
¶
Index ¶
Constants ¶
View Source
const Suffix = "-coderd-chat"
Suffix marks chat-designated agents during the current PoC. This naming convention is an implementation detail, not a stable contract.
Variables ¶
This section is empty.
Functions ¶
func FindChatAgent ¶
func FindChatAgent( agents []database.WorkspaceAgent, ) (database.WorkspaceAgent, error)
FindChatAgent picks the best workspace agent for a chat session from the provided candidates. It applies these rules in order:
- Filter to root agents only (ParentID is null).
- Sort stably and deterministically by DisplayOrder ASC, then Name ASC (case-insensitive), then Name ASC, then ID ASC.
- If exactly one root agent name ends with Suffix (case-insensitive), return it.
- If zero root agents match the suffix, return the first root agent after sorting (deterministic fallback).
- If more than one root agent matches the suffix, return an error with an actionable message.
- If no root agents exist at all, return an error.
func IsChatAgent ¶
IsChatAgent reports whether name uses the chat-agent suffix convention.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.