diff --git a/common/types/agent.go b/common/types/agent.go index 3976bd66..37ac626d 100644 --- a/common/types/agent.go +++ b/common/types/agent.go @@ -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"` } @@ -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 { diff --git a/component/space.go b/component/space.go index 45900338..6132245b 100644 --- a/component/space.go +++ b/component/space.go @@ -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, diff --git a/component/space_ce_test.go b/component/space_ce_test.go index f47c53d6..36d713f5 100644 --- a/component/space_ce_test.go +++ b/component/space_ce_test.go @@ -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{ @@ -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)