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
20 changes: 20 additions & 0 deletions backend/internal/adapters/agent/kiro/kiro.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,26 @@ func (p *Plugin) Manifest() adapters.Manifest {
}
}

// GetConfigSpec reports the per-project agent config keys Kiro understands:
// a model override. Kiro already forwards agentConfig.Model into its
// workspace-local custom agent config (see setKiroAgentDefaults in
// hooks.go); this declares that support so it is discoverable/validated
// through the config-spec surface, matching claude-code and codex.
func (p *Plugin) GetConfigSpec(ctx context.Context) (ports.ConfigSpec, error) {
if err := ctx.Err(); err != nil {
return ports.ConfigSpec{}, err
}
return ports.ConfigSpec{
Fields: []ports.ConfigField{
{
Key: "model",
Type: ports.ConfigFieldString,
Description: "Model override written into Kiro's workspace-local agent config.",
Comment thread
Pulkit7070 marked this conversation as resolved.
},
},
}, nil
}

// GetLaunchCommand builds the argv to start a new Kiro session:
// `kiro-cli chat [--agent ao] --agent ao [trust flags] [-- <prompt>]`.
//
Expand Down
48 changes: 36 additions & 12 deletions backend/internal/adapters/agent/kiro/kiro_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,18 +337,6 @@ func TestPromptReadinessHints(t *testing.T) {
}
}

func TestGetConfigSpecHasNoCustomFieldsYet(t *testing.T) {
plugin := &Plugin{}

spec, err := plugin.GetConfigSpec(context.Background())
if err != nil {
t.Fatal(err)
}
if len(spec.Fields) != 0 {
t.Fatalf("unexpected config fields: %#v", spec.Fields)
}
}

func TestAuthStatusUsesKiroWhoami(t *testing.T) {
restore := stubKiroAuthRunner(t, func(_ context.Context, name string, arg ...string) ([]byte, error) {
if name != "kiro-cli" {
Expand All @@ -371,6 +359,42 @@ func TestAuthStatusUsesKiroWhoami(t *testing.T) {
}
}

func TestGetConfigSpecReportsModelField(t *testing.T) {
p := New()

spec, err := p.GetConfigSpec(context.Background())
if err != nil {
t.Fatalf("GetConfigSpec: %v", err)
}

var found bool
for _, f := range spec.Fields {
if f.Key != "model" {
continue
}
found = true
if f.Type != ports.ConfigFieldString {
t.Errorf("model field Type = %v, want %v", f.Type, ports.ConfigFieldString)
}
if f.Description == "" {
t.Error("model field Description is empty")
}
}
if !found {
t.Fatal("GetConfigSpec did not report a \"model\" field")
}
}

func TestGetConfigSpecHonorsContextCancellation(t *testing.T) {
p := New()
ctx, cancel := context.WithCancel(context.Background())
cancel()

_, err := p.GetConfigSpec(ctx)
if err == nil {
t.Fatal("GetConfigSpec with canceled context: want error, got nil")
}
}
func TestAuthStatusUnauthorizedFromKiroWhoami(t *testing.T) {
Comment thread
Pulkit7070 marked this conversation as resolved.
restore := stubKiroAuthRunner(t, func(_ context.Context, _ string, _ ...string) ([]byte, error) {
return []byte("Not logged in\n"), nil
Expand Down
Loading