MCPcopy Index your code
hub / github.com/coder/coder / latestWorkspaceAgentID

Method latestWorkspaceAgentID

coderd/x/chatd/chatd.go:885–910  ·  view source on GitHub ↗
(
	ctx context.Context,
	workspaceID uuid.UUID,
)

Source from the content-addressed store, hash-verified

883}
884
885func (c *turnWorkspaceContext) latestWorkspaceAgentID(
886 ctx context.Context,
887 workspaceID uuid.UUID,
888) (uuid.UUID, error) {
889 agents, err := c.server.db.GetWorkspaceAgentsInLatestBuildByWorkspaceID(
890 ctx,
891 workspaceID,
892 )
893 if err != nil {
894 return uuid.Nil, xerrors.Errorf(
895 "get workspace agents in latest build: %w",
896 err,
897 )
898 }
899 if len(agents) == 0 {
900 return uuid.Nil, errChatHasNoWorkspaceAgent
901 }
902 selected, err := agentselect.FindChatAgent(agents)
903 if err != nil {
904 return uuid.Nil, xerrors.Errorf(
905 "find chat agent: %w",
906 err,
907 )
908 }
909 return selected.ID, nil
910}
911
912func (c *turnWorkspaceContext) workspaceAgentIDForConn(
913 ctx context.Context,

Calls 3

FindChatAgentFunction · 0.92
ErrorfMethod · 0.45

Tested by

no test coverage detected