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
6 changes: 4 additions & 2 deletions common/types/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ type AgentInstanceFilter struct {
type UpdateAgentInstanceRequest struct {
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
Public *bool `json:"public,omitempty"`
Metadata *map[string]any `json:"metadata,omitempty"`
}

Expand Down Expand Up @@ -334,8 +335,9 @@ type AgentStreamEvent struct {
type CodeAgentSyncOperation string

const (
CodeAgentSyncOperationUpdate CodeAgentSyncOperation = "update"
CodeAgentSyncOperationDelete CodeAgentSyncOperation = "delete"
CodeAgentSyncOperationUpdate CodeAgentSyncOperation = "update"
CodeAgentSyncOperationDelete CodeAgentSyncOperation = "delete"
CodeAgentSyncOperationVisibility CodeAgentSyncOperation = "visibility"
)

func (o CodeAgentSyncOperation) String() string {
Expand Down
4 changes: 4 additions & 0 deletions component/space.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,10 @@ func (c *spaceComponentImpl) Update(ctx context.Context, req *types.UpdateSpaceR
return nil, fmt.Errorf("failed to update database space, error: %w", err)
}

if req.Private != nil {
c.syncCodeAgentIfExists(dbRepo.User.UUID, dbRepo.User.Username, dbRepo.Path, types.CodeAgentSyncOperationVisibility)
}

resDataset := &types.Space{
ID: space.ID,
Name: dbRepo.Name,
Expand Down
11 changes: 9 additions & 2 deletions component/space_ce_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,14 @@ func TestSpaceComponent_Update(t *testing.T) {
RepoType: types.SpaceRepo,
}).Return(
&database.Repository{
ID: 123,
Name: "repo",
ID: 123,
Name: "repo",
Path: "ns/n",
Private: false,
User: database.User{
UUID: "user-uuid",
Username: "user",
},
}, nil,
)
sc.mocks.stores.SpaceMock().EXPECT().ByRepoID(ctx, int64(123)).Return(&database.Space{
Expand All @@ -176,6 +182,7 @@ func TestSpaceComponent_Update(t *testing.T) {
require.Equal(t, &types.Space{
ID: 321,
Name: "repo",
Path: "ns/n",
Hardware: `{"memory": "foo"}`,
SKU: "12",
}, space)
Expand Down
Loading