Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion internal/dev/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ type ConnectionResponse struct {
func (s *Server) Close() error {
s.logger.Debug("closing connection")
s.once.Do(func() {
s.closeConnection()
s.cancel()
s.wg.Wait()
if s.conn != nil {
Expand All @@ -119,6 +120,12 @@ func (s *Server) Close() error {
return nil
}

func (s *Server) closeConnection() {
if err := s.apiclient.Do("DELETE", "/cli/devmode/"+s.Project.Project.ProjectId+"/"+s.ID, nil, nil); err != nil {
s.logger.Error("failed to send close connection: %s", err)
}
}

func (s *Server) refreshConnection() error {
var resp ConnectionResponse
if err := s.apiclient.Do("GET", "/cli/devmode/"+s.Project.Project.ProjectId+"/"+s.ID, nil, &resp); err != nil {
Expand Down Expand Up @@ -660,7 +667,7 @@ func New(args ServerArgs) (*Server, error) {
tracer: tracer,
version: args.Version,
port: args.Port,
apiclient: util.NewAPIClient(ctx, args.Logger, args.APIURL, args.APIKey),
apiclient: util.NewAPIClient(context.WithoutCancel(ctx), args.Logger, args.APIURL, args.APIKey),
connected: make(chan error, 1),
}

Expand Down
10 changes: 5 additions & 5 deletions internal/util/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,16 @@ func GetURLs(logger logger.Logger) (string, string, string) {
if apiUrl == "https://api.agentuity.com" && appUrl != "https://app.agentuity.com" {
logger.Debug("switching app url to production since the api url is production")
appUrl = "https://app.agentuity.com"
} else if apiUrl == "https://api.agentuity.dev" && appUrl == "https://app.agentuity.com" {
} else if apiUrl == "https://api.agentuity.io" && appUrl == "https://app.agentuity.com" {
logger.Debug("switching app url to dev since the api url is dev")
appUrl = "http://127.0.0.1:3000"
appUrl = "https://app.agentuity.io"
}
if apiUrl == "https://api.agentuity.com" && transportUrl != "https://agentuity.api" {
if apiUrl == "https://api.agentuity.com" && transportUrl != "https://agentuity.ai" {
logger.Debug("switching transport url to production since the api url is production")
transportUrl = "https://agentuity.ai"
} else if apiUrl == "https://api.agentuity.dev" && transportUrl == "https://agentuity.ai" {
} else if apiUrl == "https://api.agentuity.io" && transportUrl == "https://agentuity.ai" {
logger.Debug("switching transport url to dev since the api url is dev")
transportUrl = "http://127.0.0.1:3939"
transportUrl = "https://ai.agentuity.io"
}
return TransformUrl(apiUrl), TransformUrl(appUrl), TransformUrl(transportUrl)
}
Expand Down