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
2 changes: 1 addition & 1 deletion cmd/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Examples:

project, err := theproject.Project.GetProject(ctx, log, theproject.APIURL, apiKey)
if err != nil {
errsystem.New(errsystem.ErrInvalidConfiguration, err, errsystem.WithUserMessage("Failed to validate project (%s) using the provided API key from the .env file in %s. This is most likely due to the API key being invalid or the project has been deleted.", theproject.Project.ProjectId, dir), errsystem.WithContextMessage(fmt.Sprintf("Failed to get project: %s", err))).ShowErrorAndExit()
errsystem.New(errsystem.ErrInvalidConfiguration, err, errsystem.WithUserMessage("Failed to validate project (%s) using the provided API key from the .env file in %s. This is most likely due to the API key being invalid or the project has been deleted.\n\nYou can import this project using the following command:\n\n"+tui.Command("project import"), theproject.Project.ProjectId, dir), errsystem.WithContextMessage(fmt.Sprintf("Failed to get project: %s", err))).ShowErrorAndExit()
}

orgId := project.OrgId
Expand Down
38 changes: 23 additions & 15 deletions internal/dev/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,30 +537,39 @@ func processInputMessage(plogger logger.Logger, c *Websocket, m []byte, port int
return
}

var inputPayload []byte
url := fmt.Sprintf("http://localhost:%d/%s", port, inputMsg.Payload.AgentID)
contentType := "application/json"

// make a json object with the payload
payload := map[string]any{
"contentType": inputMsg.Payload.ContentType,
"payload": inputMsg.Payload.Payload,
"trigger": "manual",
}
if !c.binaryProtocol {
// TODO: remove this once were all off the old protocol
// make a json object with the payload
payload := map[string]any{
"contentType": inputMsg.Payload.ContentType,
"payload": inputMsg.Payload.Payload,
"trigger": "manual",
}

jsonPayload, lerr := json.Marshal(payload)
if lerr != nil {
logger.Error("failed to marshal payload: %s", lerr)
err = fmt.Errorf("failed to marshal payload: %w", lerr)
return
var lerr error
inputPayload, lerr = json.Marshal(payload)
if lerr != nil {
logger.Error("failed to marshal payload: %s", lerr)
err = fmt.Errorf("failed to marshal payload: %w", lerr)
return
}
} else {
contentType = inputMsg.Payload.ContentType
inputPayload = inputMsg.Payload.Payload
}
logger.Debug("sending payload: %s to %s", string(jsonPayload), url)
logger.Debug("sending payload: %s to %s", string(inputPayload), url)

req, lerr := http.NewRequestWithContext(ctx, "POST", url, bytes.NewBuffer(jsonPayload))
req, lerr := http.NewRequestWithContext(ctx, "POST", url, bytes.NewBuffer(inputPayload))
if lerr != nil {
logger.Error("failed to create request: %s", lerr)
err = fmt.Errorf("failed to create HTTP request: %w", lerr)
return
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Content-Type", contentType)
req.Header.Set("User-Agent", "Agentuity CLI/"+c.version)
propagator.Inject(ctx, propagation.HeaderCarrier(req.Header))

Expand Down Expand Up @@ -615,7 +624,6 @@ func processInputMessage(plogger logger.Logger, c *Websocket, m []byte, port int
logger.Debug("response: %s (status code: %d)", string(body), resp.StatusCode)

var trigger string
var contentType string
if c.binaryProtocol {
trigger = resp.Header.Get("x-agentuity-trigger")
contentType = resp.Header.Get("content-type")
Expand Down
Loading