diff --git a/cmd/dev.go b/cmd/dev.go index 87f617be..710bc0c9 100644 --- a/cmd/dev.go +++ b/cmd/dev.go @@ -203,7 +203,7 @@ func displayLocalInstructions(port int, agents []project.AgentConfig, devModeUrl sampleAgentID = agents[0].ID } - curlCommand := fmt.Sprintf("curl -v http://localhost:%d/%s --json '{\"input\": \"Hello, world!\"}'", port, sampleAgentID) + curlCommand := fmt.Sprintf("curl -v http://127.0.0.1:%d/%s --json '{\"input\": \"Hello, world!\"}'", port, sampleAgentID) fmt.Println() fmt.Println(tui.Text("To interact with your agents locally, you can use:")) diff --git a/go.mod b/go.mod index 722dfc16..5409d4fe 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.24.2 require ( github.com/Masterminds/semver v1.5.0 - github.com/agentuity/go-common v1.0.38 + github.com/agentuity/go-common v1.0.39 github.com/agentuity/mcp-golang/v2 v2.0.2 github.com/bmatcuk/doublestar/v4 v4.8.1 github.com/charmbracelet/bubbles v0.20.0 diff --git a/go.sum b/go.sum index 0be6b61e..2f029a1b 100644 --- a/go.sum +++ b/go.sum @@ -9,8 +9,8 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/ProtonMail/go-crypto v1.1.5 h1:eoAQfK2dwL+tFSFpr7TbOaPNUbPiJj4fLYwwGE1FQO4= github.com/ProtonMail/go-crypto v1.1.5/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= -github.com/agentuity/go-common v1.0.38 h1:ngx67t1H095HfY/2RdsDeezjTT0M3327eKDRYYzJYkY= -github.com/agentuity/go-common v1.0.38/go.mod h1:QBpIuVfB3s+t4edGydNCvVUkJsL8NROovBhkZGzNNoY= +github.com/agentuity/go-common v1.0.39 h1:SZEn351+2JMdYBA/aoOUoSuPI8lTDSIKICnu17mrYo4= +github.com/agentuity/go-common v1.0.39/go.mod h1:cy1EPYpZUkp3JSMgTb+Sa3sLnS7vQQupj/RwO4An6L4= github.com/agentuity/mcp-golang/v2 v2.0.2 h1:wZqS/aHWZsQoU/nd1E1/iMsVY2dywWT9+PFlf+3YJxo= github.com/agentuity/mcp-golang/v2 v2.0.2/go.mod h1:U105tZXyTatxxOBlcObRgLb/ULvGgT2DJ1nq/8++P6Q= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= diff --git a/internal/dev/websocket.go b/internal/dev/websocket.go index dd2c378e..7526d104 100644 --- a/internal/dev/websocket.go +++ b/internal/dev/websocket.go @@ -81,7 +81,7 @@ func (c *Websocket) Done() <-chan struct{} { } func (c *Websocket) getAgentProtocol(ctx context.Context, port int) (bool, error) { - url := fmt.Sprintf("http://localhost:%d/_health", port) + url := fmt.Sprintf("http://127.0.0.1:%d/_health", port) for i := 0; i < 5; i++ { req, err := http.NewRequestWithContext(ctx, "GET", url, nil) if err != nil { @@ -104,7 +104,7 @@ func (c *Websocket) getAgentProtocol(ctx context.Context, port int) (bool, error } func (c *Websocket) getAgentWelcome(ctx context.Context, port int) (map[string]Welcome, error) { - url := fmt.Sprintf("http://localhost:%d/welcome", port) + url := fmt.Sprintf("http://127.0.0.1:%d/welcome", port) for i := 0; i < 5; i++ { req, err := http.NewRequestWithContext(ctx, "GET", url, nil) if err != nil { @@ -538,7 +538,7 @@ func processInputMessage(plogger logger.Logger, c *Websocket, m []byte, port int } var inputPayload []byte - url := fmt.Sprintf("http://localhost:%d/%s", port, inputMsg.Payload.AgentID) + url := fmt.Sprintf("http://127.0.0.1:%d/%s", port, inputMsg.Payload.AgentID) contentType := "application/json" if !c.binaryProtocol { diff --git a/internal/util/api.go b/internal/util/api.go index 7d2e48f1..609ff85f 100644 --- a/internal/util/api.go +++ b/internal/util/api.go @@ -233,7 +233,7 @@ var testInside bool func TransformUrl(urlString string) string { // NOTE: these urls are special cases for local development inside a container - if strings.Contains(urlString, "api.agentuity.dev") || strings.Contains(urlString, "localhost:") { + if strings.Contains(urlString, "api.agentuity.dev") || strings.Contains(urlString, "localhost:") || strings.Contains(urlString, "127.0.0.1:") { if sys.Exists("/.dockerenv") || sys.Exists("/proc/1/cgroup") || testInside { if strings.HasPrefix(urlString, "https://api.agentuity.dev") { u, _ := url.Parse(urlString) @@ -264,14 +264,14 @@ func GetURLs(logger logger.Logger) (string, string, string) { appUrl = "https://app.agentuity.com" } else if apiUrl == "https://api.agentuity.dev" && appUrl == "https://app.agentuity.com" { logger.Debug("switching app url to dev since the api url is dev") - appUrl = "http://localhost:3000" + appUrl = "http://127.0.0.1:3000" } if apiUrl == "https://api.agentuity.com" && transportUrl != "https://agentuity.api" { 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" { logger.Debug("switching transport url to dev since the api url is dev") - transportUrl = "http://localhost:3939" + transportUrl = "http://127.0.0.1:3939" } return TransformUrl(apiUrl), TransformUrl(appUrl), TransformUrl(transportUrl) }