Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ agentapi server -- goose
```

> [!NOTE]
> When using Codex, Gemini or CursorCLI, always specify the agent type explicitly (eg: `agentapi server --type=codex -- codex`), or message formatting may break.
> When using Codex, Gemini, Amp or CursorCLI, always specify the agent type explicitly (eg: `agentapi server --type=codex -- codex`), or message formatting may break.

An OpenAPI schema is available in [openapi.json](openapi.json).

Expand Down
2 changes: 1 addition & 1 deletion chat/src/components/message-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export default function MessageList({ messages }: MessageListProps) {
{message.role !== "user" && message.content === "" ? (
<LoadingDots />
) : (
message.content.trim()
message.content.trimEnd()
)}
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions cmd/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ func runServer(ctx context.Context, logger *slog.Logger, argsToPass []string) er
ProgramArgs: argsToPass[1:],
TerminalWidth: termWidth,
TerminalHeight: termHeight,
AgentType: agentType,
})
if err != nil {
return xerrors.Errorf("failed to setup process: %w", err)
Expand Down
10 changes: 10 additions & 0 deletions lib/httpapi/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"time"

"github.com/coder/agentapi/lib/logctx"
mf "github.com/coder/agentapi/lib/msgfmt"
"github.com/coder/agentapi/lib/termexec"
)

Expand All @@ -18,6 +19,7 @@ type SetupProcessConfig struct {
ProgramArgs []string
TerminalWidth uint16
TerminalHeight uint16
AgentType mf.AgentType
}

func SetupProcess(ctx context.Context, config SetupProcessConfig) (*termexec.Process, error) {
Expand All @@ -36,6 +38,14 @@ func SetupProcess(ctx context.Context, config SetupProcessConfig) (*termexec.Pro
os.Exit(1)
}

// Hack for sourcegraph amp to stop the animation.
if config.AgentType == mf.AgentTypeAmp {
_, err = process.Write([]byte(" \b"))
if err != nil {
return nil, err
}
}

// Handle SIGINT (Ctrl+C) and send it to the process
signalCh := make(chan os.Signal, 1)
signal.Notify(signalCh, os.Interrupt, syscall.SIGTERM)
Expand Down