Skip to content

Commit 24b20cd

Browse files
authored
Merge pull request #966 from dgageot/big-cleanup-2
More cleanup
2 parents f2c5453 + d935db7 commit 24b20cd

41 files changed

Lines changed: 99 additions & 227 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44
!./**/*.template
55
!./**/*.go
66
!./**/*.txt
7-
!./**/*.txt
87
!/pkg/config/default-agent.yaml

cmd/root/build.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55

66
"github.com/docker/cagent/pkg/build"
77
"github.com/docker/cagent/pkg/cli"
8-
"github.com/docker/cagent/pkg/filesystem"
98
"github.com/docker/cagent/pkg/telemetry"
109
)
1110

@@ -44,5 +43,5 @@ func (f *buildFlags) runBuildCommand(cmd *cobra.Command, args []string) error {
4443
dockerImageName = args[1]
4544
}
4645

47-
return build.DockerImage(ctx, out, agentFilename, filesystem.AllowAll, dockerImageName, f.opts)
46+
return build.DockerImage(ctx, out, agentFilename, dockerImageName, f.opts)
4847
}

cmd/root/feedback.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ func newFeedbackCmd() *cobra.Command {
2222
func runFeedbackCommand(cmd *cobra.Command, args []string) error {
2323
telemetry.TrackCommand("feedback", args)
2424

25-
fmt.Fprintln(cmd.OutOrStdout(), "Feel free to give feedback:\n", feedback.FeedbackLink)
25+
fmt.Fprintln(cmd.OutOrStdout(), "Feel free to give feedback:\n", feedback.Link)
2626
return nil
2727
}

cmd/root/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ For any feedback, please visit: %s
119119
We collect anonymous usage data to help improve cagent. To disable:
120120
- Set environment variable: TELEMETRY_ENABLED=false
121121
122-
`, feedback.FeedbackLink)
122+
`, feedback.Link)
123123
fmt.Fprint(stderr, startupMsg)
124124
}
125125

docs/PROVIDERS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
## Add provider alias
44

5-
Add a new `Alias` to `ProviderAliases` [`pkg/model/provider/provider.go`](https://github.com/docker/cagent/blob/main/pkg/model/provider/provider.go)
5+
Add a new `Alias` to `Aliases` [`pkg/model/provider/provider.go`](https://github.com/docker/cagent/blob/main/pkg/model/provider/provider.go)
66

77
```go
8-
var ProviderAliases = map[string]Alias{
8+
var Aliases = map[string]Alias{
99
"requesty": {
1010
APIType: "openai",
1111
BaseURL: "https://router.requesty.ai/v1",

pkg/a2a/executor_wrapper_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ type mockQueue struct {
1515
events []a2a.Event
1616
}
1717

18-
func (m *mockQueue) Write(ctx context.Context, event a2a.Event) error {
18+
func (m *mockQueue) Write(_ context.Context, event a2a.Event) error {
1919
m.events = append(m.events, event)
2020
return nil
2121
}
2222

23-
func (m *mockQueue) Read(ctx context.Context) (a2a.Event, error) {
23+
func (m *mockQueue) Read(context.Context) (a2a.Event, error) {
2424
return nil, nil
2525
}
2626

pkg/acp/agent.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func (a *Agent) Initialize(ctx context.Context, params acp.InitializeRequest) (a
8989
}
9090

9191
// NewSession implements [acp.Agent]
92-
func (a *Agent) NewSession(ctx context.Context, params acp.NewSessionRequest) (acp.NewSessionResponse, error) {
92+
func (a *Agent) NewSession(context.Context, acp.NewSessionRequest) (acp.NewSessionResponse, error) {
9393
sid := uuid.New().String()
9494
slog.Debug("ACP NewSession called", "session_id", sid)
9595

@@ -110,19 +110,19 @@ func (a *Agent) NewSession(ctx context.Context, params acp.NewSessionRequest) (a
110110
}
111111

112112
// Authenticate implements [acp.Agent]
113-
func (a *Agent) Authenticate(ctx context.Context, params acp.AuthenticateRequest) (acp.AuthenticateResponse, error) {
113+
func (a *Agent) Authenticate(context.Context, acp.AuthenticateRequest) (acp.AuthenticateResponse, error) {
114114
slog.Debug("ACP Authenticate called")
115115
return acp.AuthenticateResponse{}, nil
116116
}
117117

118118
// LoadSession implements [acp.Agent] (optional, not supported)
119-
func (a *Agent) LoadSession(ctx context.Context, params acp.LoadSessionRequest) (acp.LoadSessionResponse, error) {
119+
func (a *Agent) LoadSession(context.Context, acp.LoadSessionRequest) (acp.LoadSessionResponse, error) {
120120
slog.Debug("ACP LoadSession called (not supported)")
121121
return acp.LoadSessionResponse{}, fmt.Errorf("load session not supported")
122122
}
123123

124124
// Cancel implements [acp.Agent]
125-
func (a *Agent) Cancel(ctx context.Context, params acp.CancelNotification) error {
125+
func (a *Agent) Cancel(_ context.Context, params acp.CancelNotification) error {
126126
sid := string(params.SessionId)
127127
slog.Debug("ACP Cancel called", "session_id", sid)
128128

@@ -138,7 +138,7 @@ func (a *Agent) Cancel(ctx context.Context, params acp.CancelNotification) error
138138
}
139139

140140
// Prompt implements [acp.Agent]
141-
func (a *Agent) Prompt(ctx context.Context, params acp.PromptRequest) (acp.PromptResponse, error) {
141+
func (a *Agent) Prompt(_ context.Context, params acp.PromptRequest) (acp.PromptResponse, error) {
142142
sid := string(params.SessionId)
143143
slog.Debug("ACP Prompt called", "session_id", sid)
144144

@@ -201,7 +201,7 @@ func (a *Agent) Prompt(ctx context.Context, params acp.PromptRequest) (acp.Promp
201201
}
202202

203203
// SetSessionMode implements acp.Agent (optional)
204-
func (a *Agent) SetSessionMode(ctx context.Context, params acp.SetSessionModeRequest) (acp.SetSessionModeResponse, error) {
204+
func (a *Agent) SetSessionMode(context.Context, acp.SetSessionModeRequest) (acp.SetSessionModeResponse, error) {
205205
// We don't implement session modes, cagent agents have only one mode (for now? ;) ).
206206
return acp.SetSessionModeResponse{}, nil
207207
}
@@ -325,7 +325,7 @@ func (a *Agent) handleMaxIterationsReached(ctx context.Context, acpSess *Session
325325
permResp, err := a.conn.RequestPermission(ctx, acp.RequestPermissionRequest{
326326
SessionId: acp.SessionId(acpSess.id),
327327
ToolCall: acp.RequestPermissionToolCall{
328-
ToolCallId: acp.ToolCallId("max_iterations"),
328+
ToolCallId: "max_iterations",
329329
Title: acp.Ptr(fmt.Sprintf("Maximum iterations (%d) reached", e.MaxIterations)),
330330
Kind: acp.Ptr(acp.ToolKindExecute),
331331
Status: acp.Ptr(acp.ToolCallStatusPending),
@@ -334,12 +334,12 @@ func (a *Agent) handleMaxIterationsReached(ctx context.Context, acpSess *Session
334334
{
335335
Kind: acp.PermissionOptionKindAllowOnce,
336336
Name: "Continue",
337-
OptionId: acp.PermissionOptionId("continue"),
337+
OptionId: "continue",
338338
},
339339
{
340340
Kind: acp.PermissionOptionKindRejectOnce,
341341
Name: "Stop",
342-
OptionId: acp.PermissionOptionId("stop"),
342+
OptionId: "stop",
343343
},
344344
},
345345
})

pkg/api/pagination_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func TestPaginateMessages_MaxLimit(t *testing.T) {
136136
}
137137

138138
func TestPaginateMessages_EmptyMessages(t *testing.T) {
139-
messages := []session.Message{}
139+
var messages []session.Message
140140

141141
params := PaginationParams{
142142
Limit: 10,

pkg/build/build.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"github.com/goccy/go-yaml"
1515

1616
"github.com/docker/cagent/pkg/config"
17-
"github.com/docker/cagent/pkg/filesystem"
1817
)
1918

2019
//go:embed Dockerfile.template
@@ -31,7 +30,7 @@ type Printer interface {
3130
Println(a ...any)
3231
}
3332

34-
func DockerImage(ctx context.Context, out Printer, agentFilename string, fs filesystem.FS, dockerImageName string, opts Options) error {
33+
func DockerImage(ctx context.Context, out Printer, agentFilename, dockerImageName string, opts Options) error {
3534
agentSource, err := config.Resolve(agentFilename)
3635
if err != nil {
3736
return err

pkg/config/auto_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type mockEnvProvider struct {
1111
envVars map[string]string
1212
}
1313

14-
func (m *mockEnvProvider) Get(ctx context.Context, name string) string {
14+
func (m *mockEnvProvider) Get(_ context.Context, name string) string {
1515
return m.envVars[name]
1616
}
1717

0 commit comments

Comments
 (0)