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
4 changes: 3 additions & 1 deletion providers/app-studio/api/assistant_eino_tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ func projectAssistantTurnNeedsInfrastructureMCP(history []store.Message) bool {
}
content := strings.ToLower(strings.TrimSpace(history[i].Content))
return containsProjectAssistantTurnKeyword(content, []string{
"infrastructure", "infra", "template", "templates", "provision", "database", "postgres", "redis", "supporting resource", "provider",
"infrastructure", "infra", "template", "templates", "provision",
"instance", "instances", "database", "postgres", "redis",
"supporting resource", "provider", "platform", "mcp",
})
}
return false
Expand Down
26 changes: 26 additions & 0 deletions providers/app-studio/api/assistant_eino_tool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,35 @@ import (
"testing"

aiv1alpha1 "github.com/faroshq/provider-app-studio/apis/ai/v1alpha1"
"github.com/faroshq/provider-app-studio/store"
"github.com/faroshq/provider-app-studio/workspace"
)

func TestProjectAssistantTurnNeedsInfrastructureMCP(t *testing.T) {
for _, tc := range []struct {
name string
content string
want bool
}{
{"list instances", "list instances via mcp", true},
{"single instance", "show me the status of my instance", true},
{"platform vocabulary", "what platform resources do I have?", true},
{"mcp mention", "call mcp to enumerate things", true},
{"templates", "what templates are available?", true},
{"unrelated", "fix the button styling in app.js", false},
} {
t.Run(tc.name, func(t *testing.T) {
history := []store.Message{{
Role: aiv1alpha1.ProjectMessageRoleUser,
Content: tc.content,
}}
if got := projectAssistantTurnNeedsInfrastructureMCP(history); got != tc.want {
t.Fatalf("projectAssistantTurnNeedsInfrastructureMCP(%q) = %v, want %v", tc.content, got, tc.want)
}
})
}
}

func TestEinoApprovePlanToolRejectsMissingAllowedOperations(t *testing.T) {
runState := newProjectEinoAssistantRunState()
tool := projectEinoAssistantTool{runState: runState}
Expand Down
1 change: 1 addition & 0 deletions providers/app-studio/api/assistant_turn_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ func fallbackProjectAssistantTurnDecisionForMessage(content string) projectAssis
}
if containsProjectAssistantTurnKeyword(normalized, []string{
"build", "add", "change", "update", "implement", "write", "make the app", "create", "remove", "delete", "ship", "commit", "deploy", "provision",
"git", "push", "pull request", "branch", "merge",
}) {
return fallbackProjectAssistantTurnDecisionWithProfile(projectAssistantTurnProfileImplementation)
}
Expand Down
3 changes: 3 additions & 0 deletions providers/app-studio/api/assistant_turn_profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ func TestProjectAssistantTurnProfileClassifier(t *testing.T) {
{name: "debug fix", message: "Fix the failed fetch error and make it work", want: projectAssistantTurnProfileDebugFix},
{name: "fix only fallback", message: "Please fix the login form", want: projectAssistantTurnProfileDebugFix},
{name: "implementation", message: "Add a search field to the todo app", want: projectAssistantTurnProfileImplementation},
{name: "git push", message: "push my changes to git", want: projectAssistantTurnProfileImplementation},
{name: "pull request", message: "open a pull request for this branch", want: projectAssistantTurnProfileImplementation},
{name: "merge", message: "merge the feature branch", want: projectAssistantTurnProfileImplementation},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
Loading