Skip to content

Commit 7fb47ba

Browse files
committed
feat: amp only hack
1 parent c488a55 commit 7fb47ba

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ agentapi server -- goose
6565
```
6666

6767
> [!NOTE]
68-
> When using Codex, Gemini or CursorCLI, always specify the agent type explicitly (eg: `agentapi server --type=codex -- codex`), or message formatting may break.
68+
> When using Codex, Gemini, Amp or CursorCLI, always specify the agent type explicitly (eg: `agentapi server --type=codex -- codex`), or message formatting may break.
6969
7070
An OpenAPI schema is available in [openapi.json](openapi.json).
7171

cmd/server/server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ func runServer(ctx context.Context, logger *slog.Logger, argsToPass []string) er
9494
ProgramArgs: argsToPass[1:],
9595
TerminalWidth: termWidth,
9696
TerminalHeight: termHeight,
97+
AgentType: agentType,
9798
})
9899
if err != nil {
99100
return xerrors.Errorf("failed to setup process: %w", err)

lib/httpapi/setup.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"time"
1111

1212
"github.com/coder/agentapi/lib/logctx"
13+
mf "github.com/coder/agentapi/lib/msgfmt"
1314
"github.com/coder/agentapi/lib/termexec"
1415
)
1516

@@ -18,6 +19,7 @@ type SetupProcessConfig struct {
1819
ProgramArgs []string
1920
TerminalWidth uint16
2021
TerminalHeight uint16
22+
AgentType mf.AgentType
2123
}
2224

2325
func SetupProcess(ctx context.Context, config SetupProcessConfig) (*termexec.Process, error) {
@@ -37,9 +39,11 @@ func SetupProcess(ctx context.Context, config SetupProcessConfig) (*termexec.Pro
3739
}
3840

3941
// Hack for sourcegraph amp to stop the animation.
40-
_, err = process.Write([]byte(" \b"))
41-
if err != nil {
42-
return nil, err
42+
if config.AgentType == mf.AgentTypeAmp {
43+
_, err = process.Write([]byte(" \b"))
44+
if err != nil {
45+
return nil, err
46+
}
4347
}
4448

4549
// Handle SIGINT (Ctrl+C) and send it to the process

0 commit comments

Comments
 (0)