agentselect

package
v2.33.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

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:

  1. Filter to root agents only (ParentID is null).
  2. Sort stably and deterministically by DisplayOrder ASC, then Name ASC (case-insensitive), then Name ASC, then ID ASC.
  3. If exactly one root agent name ends with Suffix (case-insensitive), return it.
  4. If zero root agents match the suffix, return the first root agent after sorting (deterministic fallback).
  5. If more than one root agent matches the suffix, return an error with an actionable message.
  6. If no root agents exist at all, return an error.

func IsChatAgent

func IsChatAgent(name string) bool

IsChatAgent reports whether name uses the chat-agent suffix convention.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL