-
Notifications
You must be signed in to change notification settings - Fork 7
feat: add agent catalog/auth API and safer orchestrator switching #276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nikhilachale
wants to merge
9
commits into
aoagents:main
Choose a base branch
from
nikhilachale:agent-switcher
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
36cf91f
feat: add agent catalog API and integrate with project settings
nikhilachale 8088d6c
Implement agent authorization status checks and update frontend to re…
nikhilachale 70a76bc
fix: simplify orchestrator replacement retry flow
nikhilachale f4389f1
fix: improve orchestrator agent change detection logic
nikhilachale 1b8595c
refactor: standardize import formatting and improve route definitions
nikhilachale 4110613
Merge branch 'main' into agent-switcher
nikhilachale a6ee5af
refactor: cache agent catalog ,remove AgentCounts schema and related…
nikhilachale 6a6c484
fix: clarify orchestrator replacement recovery state
nikhilachale 194b52c
Merge branch 'main' into agent-switcher
nikhilachale File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package agy | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/aoagents/agent-orchestrator/backend/internal/adapters/agent/authprobe" | ||
| "github.com/aoagents/agent-orchestrator/backend/internal/ports" | ||
| ) | ||
|
|
||
| var _ ports.AgentAuthChecker = (*Plugin)(nil) | ||
|
|
||
| func (p *Plugin) AuthStatus(ctx context.Context) (ports.AgentAuthStatus, error) { | ||
| cmd, err := p.GetLaunchCommand(ctx, ports.LaunchConfig{}) | ||
| if err != nil || len(cmd) == 0 { | ||
| return ports.AgentAuthStatusUnknown, err | ||
| } | ||
| return authprobe.CLIStatus(ctx, cmd[0], nil) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package aider | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/aoagents/agent-orchestrator/backend/internal/adapters/agent/authprobe" | ||
| "github.com/aoagents/agent-orchestrator/backend/internal/ports" | ||
| ) | ||
|
|
||
| var _ ports.AgentAuthChecker = (*Plugin)(nil) | ||
|
|
||
| func (p *Plugin) AuthStatus(ctx context.Context) (ports.AgentAuthStatus, error) { | ||
| cmd, err := p.GetLaunchCommand(ctx, ports.LaunchConfig{}) | ||
| if err != nil || len(cmd) == 0 { | ||
| return ports.AgentAuthStatusUnknown, err | ||
| } | ||
| return authprobe.CLIStatus(ctx, cmd[0], nil) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package amp | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/aoagents/agent-orchestrator/backend/internal/adapters/agent/authprobe" | ||
| "github.com/aoagents/agent-orchestrator/backend/internal/ports" | ||
| ) | ||
|
|
||
| var _ ports.AgentAuthChecker = (*Plugin)(nil) | ||
|
|
||
| func (p *Plugin) AuthStatus(ctx context.Context) (ports.AgentAuthStatus, error) { | ||
| cmd, err := p.GetLaunchCommand(ctx, ports.LaunchConfig{}) | ||
| if err != nil || len(cmd) == 0 { | ||
| return ports.AgentAuthStatusUnknown, err | ||
| } | ||
| return authprobe.CLIStatus(ctx, cmd[0], nil) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package auggie | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/aoagents/agent-orchestrator/backend/internal/adapters/agent/authprobe" | ||
| "github.com/aoagents/agent-orchestrator/backend/internal/ports" | ||
| ) | ||
|
|
||
| var _ ports.AgentAuthChecker = (*Plugin)(nil) | ||
|
|
||
| func (p *Plugin) AuthStatus(ctx context.Context) (ports.AgentAuthStatus, error) { | ||
| cmd, err := p.GetLaunchCommand(ctx, ports.LaunchConfig{}) | ||
| if err != nil || len(cmd) == 0 { | ||
| return ports.AgentAuthStatusUnknown, err | ||
| } | ||
| return authprobe.CLIStatus(ctx, cmd[0], nil) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| package authprobe | ||
|
|
||
| import ( | ||
| "context" | ||
| "os/exec" | ||
| "strings" | ||
| "time" | ||
|
|
||
| "github.com/aoagents/agent-orchestrator/backend/internal/ports" | ||
| ) | ||
|
|
||
| // DefaultCommands are cheap local auth/status probes common across agent CLIs. | ||
| // Unsupported commands usually exit quickly with help text and are treated as | ||
| // unknown rather than unauthorized. | ||
| var DefaultCommands = [][]string{ | ||
| {"auth", "status"}, | ||
| {"login", "status"}, | ||
| {"providers", "list"}, | ||
| } | ||
|
|
||
| // CLIStatus runs bounded local CLI probes and classifies their output. | ||
| func CLIStatus(ctx context.Context, binary string, commands [][]string) (ports.AgentAuthStatus, error) { | ||
| if err := ctx.Err(); err != nil { | ||
| return ports.AgentAuthStatusUnknown, err | ||
| } | ||
| if binary == "" { | ||
| return ports.AgentAuthStatusUnknown, nil | ||
| } | ||
| if len(commands) == 0 { | ||
| commands = DefaultCommands | ||
| } | ||
| for _, args := range commands { | ||
| status, err := commandStatus(ctx, binary, args) | ||
| if err != nil { | ||
| return ports.AgentAuthStatusUnknown, err | ||
| } | ||
| if status != ports.AgentAuthStatusUnknown { | ||
| return status, nil | ||
| } | ||
| } | ||
| return ports.AgentAuthStatusUnknown, nil | ||
| } | ||
|
|
||
| func commandStatus(ctx context.Context, binary string, args []string) (ports.AgentAuthStatus, error) { | ||
| probeCtx, cancel := context.WithTimeout(ctx, 3*time.Second) | ||
| defer cancel() | ||
|
|
||
| out, err := exec.CommandContext(probeCtx, binary, args...).CombinedOutput() | ||
| if probeCtx.Err() != nil { | ||
| return ports.AgentAuthStatusUnknown, probeCtx.Err() | ||
| } | ||
| text := strings.ToLower(string(out)) | ||
| if hasAny(text, | ||
| "not logged in", | ||
| "logged out", | ||
| "not authenticated", | ||
| "unauthenticated", | ||
| "authentication required", | ||
| "not authorized", | ||
| "unauthorized", | ||
| "login required", | ||
| "no credentials", | ||
| "0 credentials", | ||
| "no api key", | ||
| "no token", | ||
| `"loggedin": false`, | ||
| `"loggedin":false`, | ||
| ) { | ||
| return ports.AgentAuthStatusUnauthorized, nil | ||
| } | ||
| if hasAny(text, | ||
| "logged in", | ||
| "authenticated", | ||
| "authorized", | ||
| "token valid", | ||
| "api key found", | ||
| "credentials found", | ||
| `"loggedin": true`, | ||
| `"loggedin":true`, | ||
| ) { | ||
| return ports.AgentAuthStatusAuthorized, nil | ||
| } | ||
| if err != nil { | ||
| return ports.AgentAuthStatusUnknown, nil | ||
| } | ||
| return ports.AgentAuthStatusUnknown, nil | ||
| } | ||
|
|
||
| func hasAny(text string, needles ...string) bool { | ||
| for _, needle := range needles { | ||
| if strings.Contains(text, needle) { | ||
| return true | ||
| } | ||
| } | ||
| return false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package autohand | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/aoagents/agent-orchestrator/backend/internal/adapters/agent/authprobe" | ||
| "github.com/aoagents/agent-orchestrator/backend/internal/ports" | ||
| ) | ||
|
|
||
| var _ ports.AgentAuthChecker = (*Plugin)(nil) | ||
|
|
||
| func (p *Plugin) AuthStatus(ctx context.Context) (ports.AgentAuthStatus, error) { | ||
| cmd, err := p.GetLaunchCommand(ctx, ports.LaunchConfig{}) | ||
| if err != nil || len(cmd) == 0 { | ||
| return ports.AgentAuthStatusUnknown, err | ||
| } | ||
| return authprobe.CLIStatus(ctx, cmd[0], nil) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package cline | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/aoagents/agent-orchestrator/backend/internal/adapters/agent/authprobe" | ||
| "github.com/aoagents/agent-orchestrator/backend/internal/ports" | ||
| ) | ||
|
|
||
| var _ ports.AgentAuthChecker = (*Plugin)(nil) | ||
|
|
||
| func (p *Plugin) AuthStatus(ctx context.Context) (ports.AgentAuthStatus, error) { | ||
| cmd, err := p.GetLaunchCommand(ctx, ports.LaunchConfig{}) | ||
| if err != nil || len(cmd) == 0 { | ||
| return ports.AgentAuthStatusUnknown, err | ||
| } | ||
| return authprobe.CLIStatus(ctx, cmd[0], nil) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package continueagent | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/aoagents/agent-orchestrator/backend/internal/adapters/agent/authprobe" | ||
| "github.com/aoagents/agent-orchestrator/backend/internal/ports" | ||
| ) | ||
|
|
||
| var _ ports.AgentAuthChecker = (*Plugin)(nil) | ||
|
|
||
| func (p *Plugin) AuthStatus(ctx context.Context) (ports.AgentAuthStatus, error) { | ||
| cmd, err := p.GetLaunchCommand(ctx, ports.LaunchConfig{}) | ||
| if err != nil || len(cmd) == 0 { | ||
| return ports.AgentAuthStatusUnknown, err | ||
| } | ||
| return authprobe.CLIStatus(ctx, cmd[0], nil) | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`nvmNodeBinCandidates` is missing its closing brace — the function body never terminates before `func resolveNativeWindowsCodex(...)` starts on the next line, which nests a named function declaration inside another function. This is not valid Go and the package will not compile as currently pushed:
```go
func nvmNodeBinCandidates(home, binary string) []string {
matches, err := filepath.Glob(filepath.Join(home, ".nvm", "versions", "node", "*", "bin", binary))
if err != nil || len(matches) == 0 {
return nil
}
sort.Sort(sort.Reverse(sort.StringSlice(matches)))
return matches
func resolveNativeWindowsCodex(path string) string { // <-- missing
}above