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
5 changes: 4 additions & 1 deletion pkg/agent/server_ai_tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,22 @@
providerNames = append(providerNames, p.DisplayName)
}

sessionIn, sessionOut, todayIn, todayOut := s.tokens.GetUsage()
var sessionIn, sessionOut, todayIn, todayOut int
if s.tokens != nil {
sessionIn, sessionOut, todayIn, todayOut = s.tokens.GetUsage()

Check failure on line 29 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / build (macos-latest)

cannot use s.tokens.GetUsage() (value of type int64) as int value in assignment

Check failure on line 29 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / build (windows-latest)

cannot use s.tokens.GetUsage() (value of type int64) as int value in assignment

Check failure on line 29 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / pr-check

cannot use s.tokens.GetUsage() (value of type int64) as int value in assignment

Check failure on line 29 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / pr-check

cannot use s.tokens.GetUsage() (value of type int64) as int value in assignment

Check failure on line 29 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / pr-check

cannot use s.tokens.GetUsage() (value of type int64) as int value in assignment

Check failure on line 29 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / pr-check

cannot use s.tokens.GetUsage() (value of type int64) as int value in assignment

Check failure on line 29 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / pr-check

cannot use s.tokens.GetUsage() (value of type int64) as int value in assignment

Check failure on line 29 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / pr-check

cannot use s.tokens.GetUsage() (value of type int64) as int value in assignment

Check failure on line 29 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

cannot use s.tokens.GetUsage() (value of type int64) as int value in assignment

Check failure on line 29 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / API Contract Verification

cannot use s.tokens.GetUsage() (value of type int64) as int value in assignment

Check failure on line 29 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / Verify console starts successfully

cannot use s.tokens.GetUsage() (value of type int64) as int value in assignment

Check failure on line 29 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / fullstack-smoke

cannot use s.tokens.GetUsage() (value of type int64) as int value in assignment

Check failure on line 29 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / go test ./...

cannot use s.tokens.GetUsage() (value of type int64) as int value in assignment

Check failure on line 29 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / Verify build after merge

cannot use s.tokens.GetUsage() (value of type int64) as int value in assignment
}

return &protocol.ClaudeInfo{
Installed: true,
Version: fmt.Sprintf("Multi-agent: %s", strings.Join(providerNames, ", ")),
TokenUsage: protocol.TokenUsage{
Session: protocol.TokenCount{
Input: sessionIn,

Check failure on line 37 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / build (macos-latest)

cannot use sessionIn (variable of type int) as int64 value in struct literal

Check failure on line 37 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / build (windows-latest)

cannot use sessionIn (variable of type int) as int64 value in struct literal

Check failure on line 37 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / pr-check

cannot use sessionIn (variable of type int) as int64 value in struct literal

Check failure on line 37 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

cannot use sessionIn (variable of type int) as int64 value in struct literal

Check failure on line 37 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / API Contract Verification

cannot use sessionIn (variable of type int) as int64 value in struct literal

Check failure on line 37 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / Verify console starts successfully

cannot use sessionIn (variable of type int) as int64 value in struct literal

Check failure on line 37 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / fullstack-smoke

cannot use sessionIn (variable of type int) as int64 value in struct literal

Check failure on line 37 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / go test ./...

cannot use sessionIn (variable of type int) as int64 value in struct literal

Check failure on line 37 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / Verify build after merge

cannot use sessionIn (variable of type int) as int64 value in struct literal
Output: sessionOut,

Check failure on line 38 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / build (macos-latest)

cannot use sessionOut (variable of type int) as int64 value in struct literal

Check failure on line 38 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / build (windows-latest)

cannot use sessionOut (variable of type int) as int64 value in struct literal

Check failure on line 38 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / pr-check

cannot use sessionOut (variable of type int) as int64 value in struct literal

Check failure on line 38 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

cannot use sessionOut (variable of type int) as int64 value in struct literal

Check failure on line 38 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / API Contract Verification

cannot use sessionOut (variable of type int) as int64 value in struct literal

Check failure on line 38 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / Verify console starts successfully

cannot use sessionOut (variable of type int) as int64 value in struct literal

Check failure on line 38 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / fullstack-smoke

cannot use sessionOut (variable of type int) as int64 value in struct literal

Check failure on line 38 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / go test ./...

cannot use sessionOut (variable of type int) as int64 value in struct literal

Check failure on line 38 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / Verify build after merge

cannot use sessionOut (variable of type int) as int64 value in struct literal
},
Today: protocol.TokenCount{
Input: todayIn,

Check failure on line 41 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / build (macos-latest)

cannot use todayIn (variable of type int) as int64 value in struct literal

Check failure on line 41 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / build (windows-latest)

cannot use todayIn (variable of type int) as int64 value in struct literal

Check failure on line 41 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / pr-check

cannot use todayIn (variable of type int) as int64 value in struct literal

Check failure on line 41 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

cannot use todayIn (variable of type int) as int64 value in struct literal

Check failure on line 41 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / API Contract Verification

cannot use todayIn (variable of type int) as int64 value in struct literal

Check failure on line 41 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / Verify console starts successfully

cannot use todayIn (variable of type int) as int64 value in struct literal

Check failure on line 41 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / fullstack-smoke

cannot use todayIn (variable of type int) as int64 value in struct literal

Check failure on line 41 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / go test ./...

cannot use todayIn (variable of type int) as int64 value in struct literal

Check failure on line 41 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / Verify build after merge

cannot use todayIn (variable of type int) as int64 value in struct literal
Output: todayOut,

Check failure on line 42 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / build (macos-latest)

cannot use todayOut (variable of type int) as int64 value in struct literal

Check failure on line 42 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / build (windows-latest)

cannot use todayOut (variable of type int) as int64 value in struct literal

Check failure on line 42 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / pr-check

cannot use todayOut (variable of type int) as int64 value in struct literal

Check failure on line 42 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

cannot use todayOut (variable of type int) as int64 value in struct literal

Check failure on line 42 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / API Contract Verification

cannot use todayOut (variable of type int) as int64 value in struct literal

Check failure on line 42 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / Verify console starts successfully

cannot use todayOut (variable of type int) as int64 value in struct literal

Check failure on line 42 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / fullstack-smoke

cannot use todayOut (variable of type int) as int64 value in struct literal

Check failure on line 42 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / go test ./...

cannot use todayOut (variable of type int) as int64 value in struct literal

Check failure on line 42 in pkg/agent/server_ai_tokens.go

View workflow job for this annotation

GitHub Actions / Verify build after merge

cannot use todayOut (variable of type int) as int64 value in struct literal
},
},
}
Expand Down
6 changes: 6 additions & 0 deletions pkg/api/handlers/mcp/drasi_proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ func TestProxyDrasi_Server(t *testing.T) {
})
defer func() { drasiProxyClient.Transport = oldTransport }()

// Auth middleware to inject test user ID for RBAC checks
env.App.Use(func(c *fiber.Ctx) error {
c.Locals("userID", testAdminUserID)
return c.Next()
})

env.App.All("/api/drasi/proxy/*", h.ProxyDrasi)

req := httptest.NewRequest("GET", "/api/drasi/proxy/api/v1/sources?target=server&url=http://drasi-server&foo=bar", nil)
Expand Down
8 changes: 6 additions & 2 deletions pkg/api/handlers/stellar/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestRequireUser(t *testing.T) {
}{
{
name: "valid user ID",
userID: "user-123",
userID: "00000000-0000-0000-0000-000000000001",
wantError: false,
},
{
Expand All @@ -39,7 +39,11 @@ func TestRequireUser(t *testing.T) {
app := fiber.New()
app.Get("/test", func(c *fiber.Ctx) error {
if tt.userID != "" {
c.Locals("stellarUserID", tt.userID)
// resolveStellarUserID checks middleware.GetUserID which reads from "userID" Locals
parsedID, err := uuid.Parse(tt.userID)
if err == nil {
c.Locals("userID", parsedID)
}
}
userID, err := handler.requireUser(c)
if tt.wantError {
Expand Down
Loading