Files
kandev/apps/backend/internal/agentctl/server/adapter/e2e/amp_test.go
T
Carlos Florêncio 1556dfeda8 feat: improve amp
2026-02-21 22:05:25 +00:00

36 lines
1.0 KiB
Go

//go:build e2e
package e2e
import (
"testing"
"github.com/kandev/kandev/pkg/agent"
)
// ampCommand is the CLI command for Amp in stream-json mode.
// Derived from internal/agent/agents/amp.go.
const ampCommand = "amp --execute --stream-json --stream-json-input"
// ampContinueCommand is the command for follow-up prompts (thread ID appended at runtime).
// Amp is one-shot: each process exits after responding, so a new process must be spawned.
const ampContinueCommand = "amp threads continue --execute --stream-json --stream-json-input"
func TestAmp_BasicPrompt(t *testing.T) {
result := RunAgent(t, AgentSpec{
Name: "amp",
Command: ampCommand,
ContinueCommand: ampContinueCommand,
Protocol: agent.ProtocolAmp,
DefaultPrompt: "What is 2 + 2? Reply with just the number.",
AutoApprove: true,
})
defer DumpEventsOnFailure(t, result)
AssertTurnCompleted(t, result)
AssertSessionIDConsistent(t, result.Events)
counts := CountEventsByType(result.Events)
t.Logf("amp completed in %s: %v", result.Duration, counts)
}