From 982ebb5876345b16117953db7e6a60716ec51492 Mon Sep 17 00:00:00 2001 From: Chao Liu Date: Sat, 16 Aug 2025 14:13:32 +0800 Subject: [PATCH] chore: generate protobuf code for AI settings - Update generated Go protobuf files for workspace service - Add AI settings to OpenAPI specification - Generate TypeScript types for AI settings frontend Signed-off-by: Chao Liu --- proto/gen/api/v1/workspace_service.pb.go | 172 ++++++++++--- proto/gen/openapi.yaml | 22 ++ proto/gen/store/workspace_setting.pb.go | 141 +++++++++-- .../types/proto/api/v1/workspace_service.ts | 138 ++++++++++- .../types/proto/google/protobuf/descriptor.ts | 225 +++++++++++++++++- 5 files changed, 653 insertions(+), 45 deletions(-) diff --git a/proto/gen/api/v1/workspace_service.pb.go b/proto/gen/api/v1/workspace_service.pb.go index 60f577086..9c9f9a896 100644 --- a/proto/gen/api/v1/workspace_service.pb.go +++ b/proto/gen/api/v1/workspace_service.pb.go @@ -34,6 +34,8 @@ const ( WorkspaceSetting_STORAGE WorkspaceSetting_Key = 2 // MEMO_RELATED is the key for memo related settings. WorkspaceSetting_MEMO_RELATED WorkspaceSetting_Key = 3 + // AI is the key for AI settings. + WorkspaceSetting_AI WorkspaceSetting_Key = 4 ) // Enum value maps for WorkspaceSetting_Key. @@ -43,12 +45,14 @@ var ( 1: "GENERAL", 2: "STORAGE", 3: "MEMO_RELATED", + 4: "AI", } WorkspaceSetting_Key_value = map[string]int32{ "KEY_UNSPECIFIED": 0, "GENERAL": 1, "STORAGE": 2, "MEMO_RELATED": 3, + "AI": 4, } ) @@ -257,6 +261,7 @@ type WorkspaceSetting struct { // *WorkspaceSetting_GeneralSetting_ // *WorkspaceSetting_StorageSetting_ // *WorkspaceSetting_MemoRelatedSetting_ + // *WorkspaceSetting_AiSetting_ Value isWorkspaceSetting_Value `protobuf_oneof:"value"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -333,6 +338,15 @@ func (x *WorkspaceSetting) GetMemoRelatedSetting() *WorkspaceSetting_MemoRelated return nil } +func (x *WorkspaceSetting) GetAiSetting() *WorkspaceSetting_AiSetting { + if x != nil { + if x, ok := x.Value.(*WorkspaceSetting_AiSetting_); ok { + return x.AiSetting + } + } + return nil +} + type isWorkspaceSetting_Value interface { isWorkspaceSetting_Value() } @@ -349,12 +363,18 @@ type WorkspaceSetting_MemoRelatedSetting_ struct { MemoRelatedSetting *WorkspaceSetting_MemoRelatedSetting `protobuf:"bytes,4,opt,name=memo_related_setting,json=memoRelatedSetting,proto3,oneof"` } +type WorkspaceSetting_AiSetting_ struct { + AiSetting *WorkspaceSetting_AiSetting `protobuf:"bytes,5,opt,name=ai_setting,json=aiSetting,proto3,oneof"` +} + func (*WorkspaceSetting_GeneralSetting_) isWorkspaceSetting_Value() {} func (*WorkspaceSetting_StorageSetting_) isWorkspaceSetting_Value() {} func (*WorkspaceSetting_MemoRelatedSetting_) isWorkspaceSetting_Value() {} +func (*WorkspaceSetting_AiSetting_) isWorkspaceSetting_Value() {} + // Request message for GetWorkspaceSetting method. type GetWorkspaceSettingRequest struct { state protoimpl.MessageState `protogen:"open.v1"` @@ -770,6 +790,88 @@ func (x *WorkspaceSetting_MemoRelatedSetting) GetNsfwTags() []string { return nil } +// AI configuration settings for workspace AI features. +type WorkspaceSetting_AiSetting struct { + state protoimpl.MessageState `protogen:"open.v1"` + // enable_ai enables AI features. + EnableAi bool `protobuf:"varint,1,opt,name=enable_ai,json=enableAi,proto3" json:"enable_ai,omitempty"` + // base_url is the base URL for AI API. + BaseUrl string `protobuf:"bytes,2,opt,name=base_url,json=baseUrl,proto3" json:"base_url,omitempty"` + // api_key is the API key for AI service. + ApiKey string `protobuf:"bytes,3,opt,name=api_key,json=apiKey,proto3" json:"api_key,omitempty"` + // model is the AI model to use. + Model string `protobuf:"bytes,4,opt,name=model,proto3" json:"model,omitempty"` + // timeout_seconds is the timeout for AI requests in seconds. + TimeoutSeconds int32 `protobuf:"varint,5,opt,name=timeout_seconds,json=timeoutSeconds,proto3" json:"timeout_seconds,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WorkspaceSetting_AiSetting) Reset() { + *x = WorkspaceSetting_AiSetting{} + mi := &file_api_v1_workspace_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WorkspaceSetting_AiSetting) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WorkspaceSetting_AiSetting) ProtoMessage() {} + +func (x *WorkspaceSetting_AiSetting) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_workspace_service_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WorkspaceSetting_AiSetting.ProtoReflect.Descriptor instead. +func (*WorkspaceSetting_AiSetting) Descriptor() ([]byte, []int) { + return file_api_v1_workspace_service_proto_rawDescGZIP(), []int{2, 3} +} + +func (x *WorkspaceSetting_AiSetting) GetEnableAi() bool { + if x != nil { + return x.EnableAi + } + return false +} + +func (x *WorkspaceSetting_AiSetting) GetBaseUrl() string { + if x != nil { + return x.BaseUrl + } + return "" +} + +func (x *WorkspaceSetting_AiSetting) GetApiKey() string { + if x != nil { + return x.ApiKey + } + return "" +} + +func (x *WorkspaceSetting_AiSetting) GetModel() string { + if x != nil { + return x.Model + } + return "" +} + +func (x *WorkspaceSetting_AiSetting) GetTimeoutSeconds() int32 { + if x != nil { + return x.TimeoutSeconds + } + return 0 +} + // Custom profile configuration for workspace branding. type WorkspaceSetting_GeneralSetting_CustomProfile struct { state protoimpl.MessageState `protogen:"open.v1"` @@ -783,7 +885,7 @@ type WorkspaceSetting_GeneralSetting_CustomProfile struct { func (x *WorkspaceSetting_GeneralSetting_CustomProfile) Reset() { *x = WorkspaceSetting_GeneralSetting_CustomProfile{} - mi := &file_api_v1_workspace_service_proto_msgTypes[8] + mi := &file_api_v1_workspace_service_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -795,7 +897,7 @@ func (x *WorkspaceSetting_GeneralSetting_CustomProfile) String() string { func (*WorkspaceSetting_GeneralSetting_CustomProfile) ProtoMessage() {} func (x *WorkspaceSetting_GeneralSetting_CustomProfile) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_workspace_service_proto_msgTypes[8] + mi := &file_api_v1_workspace_service_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -855,7 +957,7 @@ type WorkspaceSetting_StorageSetting_S3Config struct { func (x *WorkspaceSetting_StorageSetting_S3Config) Reset() { *x = WorkspaceSetting_StorageSetting_S3Config{} - mi := &file_api_v1_workspace_service_proto_msgTypes[9] + mi := &file_api_v1_workspace_service_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -867,7 +969,7 @@ func (x *WorkspaceSetting_StorageSetting_S3Config) String() string { func (*WorkspaceSetting_StorageSetting_S3Config) ProtoMessage() {} func (x *WorkspaceSetting_StorageSetting_S3Config) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_workspace_service_proto_msgTypes[9] + mi := &file_api_v1_workspace_service_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -935,12 +1037,14 @@ const file_api_v1_workspace_service_proto_rawDesc = "" + "\aversion\x18\x02 \x01(\tR\aversion\x12\x12\n" + "\x04mode\x18\x03 \x01(\tR\x04mode\x12!\n" + "\finstance_url\x18\x06 \x01(\tR\vinstanceUrl\"\x1c\n" + - "\x1aGetWorkspaceProfileRequest\"\x97\x11\n" + + "\x1aGetWorkspaceProfileRequest\"\x88\x13\n" + "\x10WorkspaceSetting\x12\x17\n" + "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12X\n" + "\x0fgeneral_setting\x18\x02 \x01(\v2-.memos.api.v1.WorkspaceSetting.GeneralSettingH\x00R\x0egeneralSetting\x12X\n" + "\x0fstorage_setting\x18\x03 \x01(\v2-.memos.api.v1.WorkspaceSetting.StorageSettingH\x00R\x0estorageSetting\x12e\n" + - "\x14memo_related_setting\x18\x04 \x01(\v21.memos.api.v1.WorkspaceSetting.MemoRelatedSettingH\x00R\x12memoRelatedSetting\x1a\xf9\x04\n" + + "\x14memo_related_setting\x18\x04 \x01(\v21.memos.api.v1.WorkspaceSetting.MemoRelatedSettingH\x00R\x12memoRelatedSetting\x12I\n" + + "\n" + + "ai_setting\x18\x05 \x01(\v2(.memos.api.v1.WorkspaceSetting.AiSettingH\x00R\taiSetting\x1a\xf9\x04\n" + "\x0eGeneralSetting\x12\x14\n" + "\x05theme\x18\x01 \x01(\tR\x05theme\x12<\n" + "\x1adisallow_user_registration\x18\x02 \x01(\bR\x18disallowUserRegistration\x124\n" + @@ -983,12 +1087,19 @@ const file_api_v1_workspace_service_proto_rawDesc = "" + "\x1adisable_markdown_shortcuts\x18\b \x01(\bR\x18disableMarkdownShortcuts\x127\n" + "\x18enable_blur_nsfw_content\x18\t \x01(\bR\x15enableBlurNsfwContent\x12\x1b\n" + "\tnsfw_tags\x18\n" + - " \x03(\tR\bnsfwTags\"F\n" + + " \x03(\tR\bnsfwTags\x1a\x9b\x01\n" + + "\tAiSetting\x12\x1b\n" + + "\tenable_ai\x18\x01 \x01(\bR\benableAi\x12\x19\n" + + "\bbase_url\x18\x02 \x01(\tR\abaseUrl\x12\x17\n" + + "\aapi_key\x18\x03 \x01(\tR\x06apiKey\x12\x14\n" + + "\x05model\x18\x04 \x01(\tR\x05model\x12'\n" + + "\x0ftimeout_seconds\x18\x05 \x01(\x05R\x0etimeoutSeconds\"N\n" + "\x03Key\x12\x13\n" + "\x0fKEY_UNSPECIFIED\x10\x00\x12\v\n" + "\aGENERAL\x10\x01\x12\v\n" + "\aSTORAGE\x10\x02\x12\x10\n" + - "\fMEMO_RELATED\x10\x03:f\xeaAc\n" + + "\fMEMO_RELATED\x10\x03\x12\x06\n" + + "\x02AI\x10\x04:f\xeaAc\n" + "\x1eapi.memos.dev/WorkspaceSetting\x12\x1cworkspace/settings/{setting}*\x11workspaceSettings2\x10workspaceSettingB\a\n" + "\x05value\"X\n" + "\x1aGetWorkspaceSettingRequest\x12:\n" + @@ -1017,7 +1128,7 @@ func file_api_v1_workspace_service_proto_rawDescGZIP() []byte { } var file_api_v1_workspace_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_api_v1_workspace_service_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_api_v1_workspace_service_proto_msgTypes = make([]protoimpl.MessageInfo, 11) var file_api_v1_workspace_service_proto_goTypes = []any{ (WorkspaceSetting_Key)(0), // 0: memos.api.v1.WorkspaceSetting.Key (WorkspaceSetting_StorageSetting_StorageType)(0), // 1: memos.api.v1.WorkspaceSetting.StorageSetting.StorageType @@ -1029,30 +1140,32 @@ var file_api_v1_workspace_service_proto_goTypes = []any{ (*WorkspaceSetting_GeneralSetting)(nil), // 7: memos.api.v1.WorkspaceSetting.GeneralSetting (*WorkspaceSetting_StorageSetting)(nil), // 8: memos.api.v1.WorkspaceSetting.StorageSetting (*WorkspaceSetting_MemoRelatedSetting)(nil), // 9: memos.api.v1.WorkspaceSetting.MemoRelatedSetting - (*WorkspaceSetting_GeneralSetting_CustomProfile)(nil), // 10: memos.api.v1.WorkspaceSetting.GeneralSetting.CustomProfile - (*WorkspaceSetting_StorageSetting_S3Config)(nil), // 11: memos.api.v1.WorkspaceSetting.StorageSetting.S3Config - (*fieldmaskpb.FieldMask)(nil), // 12: google.protobuf.FieldMask + (*WorkspaceSetting_AiSetting)(nil), // 10: memos.api.v1.WorkspaceSetting.AiSetting + (*WorkspaceSetting_GeneralSetting_CustomProfile)(nil), // 11: memos.api.v1.WorkspaceSetting.GeneralSetting.CustomProfile + (*WorkspaceSetting_StorageSetting_S3Config)(nil), // 12: memos.api.v1.WorkspaceSetting.StorageSetting.S3Config + (*fieldmaskpb.FieldMask)(nil), // 13: google.protobuf.FieldMask } var file_api_v1_workspace_service_proto_depIdxs = []int32{ 7, // 0: memos.api.v1.WorkspaceSetting.general_setting:type_name -> memos.api.v1.WorkspaceSetting.GeneralSetting 8, // 1: memos.api.v1.WorkspaceSetting.storage_setting:type_name -> memos.api.v1.WorkspaceSetting.StorageSetting 9, // 2: memos.api.v1.WorkspaceSetting.memo_related_setting:type_name -> memos.api.v1.WorkspaceSetting.MemoRelatedSetting - 4, // 3: memos.api.v1.UpdateWorkspaceSettingRequest.setting:type_name -> memos.api.v1.WorkspaceSetting - 12, // 4: memos.api.v1.UpdateWorkspaceSettingRequest.update_mask:type_name -> google.protobuf.FieldMask - 10, // 5: memos.api.v1.WorkspaceSetting.GeneralSetting.custom_profile:type_name -> memos.api.v1.WorkspaceSetting.GeneralSetting.CustomProfile - 1, // 6: memos.api.v1.WorkspaceSetting.StorageSetting.storage_type:type_name -> memos.api.v1.WorkspaceSetting.StorageSetting.StorageType - 11, // 7: memos.api.v1.WorkspaceSetting.StorageSetting.s3_config:type_name -> memos.api.v1.WorkspaceSetting.StorageSetting.S3Config - 3, // 8: memos.api.v1.WorkspaceService.GetWorkspaceProfile:input_type -> memos.api.v1.GetWorkspaceProfileRequest - 5, // 9: memos.api.v1.WorkspaceService.GetWorkspaceSetting:input_type -> memos.api.v1.GetWorkspaceSettingRequest - 6, // 10: memos.api.v1.WorkspaceService.UpdateWorkspaceSetting:input_type -> memos.api.v1.UpdateWorkspaceSettingRequest - 2, // 11: memos.api.v1.WorkspaceService.GetWorkspaceProfile:output_type -> memos.api.v1.WorkspaceProfile - 4, // 12: memos.api.v1.WorkspaceService.GetWorkspaceSetting:output_type -> memos.api.v1.WorkspaceSetting - 4, // 13: memos.api.v1.WorkspaceService.UpdateWorkspaceSetting:output_type -> memos.api.v1.WorkspaceSetting - 11, // [11:14] is the sub-list for method output_type - 8, // [8:11] is the sub-list for method input_type - 8, // [8:8] is the sub-list for extension type_name - 8, // [8:8] is the sub-list for extension extendee - 0, // [0:8] is the sub-list for field type_name + 10, // 3: memos.api.v1.WorkspaceSetting.ai_setting:type_name -> memos.api.v1.WorkspaceSetting.AiSetting + 4, // 4: memos.api.v1.UpdateWorkspaceSettingRequest.setting:type_name -> memos.api.v1.WorkspaceSetting + 13, // 5: memos.api.v1.UpdateWorkspaceSettingRequest.update_mask:type_name -> google.protobuf.FieldMask + 11, // 6: memos.api.v1.WorkspaceSetting.GeneralSetting.custom_profile:type_name -> memos.api.v1.WorkspaceSetting.GeneralSetting.CustomProfile + 1, // 7: memos.api.v1.WorkspaceSetting.StorageSetting.storage_type:type_name -> memos.api.v1.WorkspaceSetting.StorageSetting.StorageType + 12, // 8: memos.api.v1.WorkspaceSetting.StorageSetting.s3_config:type_name -> memos.api.v1.WorkspaceSetting.StorageSetting.S3Config + 3, // 9: memos.api.v1.WorkspaceService.GetWorkspaceProfile:input_type -> memos.api.v1.GetWorkspaceProfileRequest + 5, // 10: memos.api.v1.WorkspaceService.GetWorkspaceSetting:input_type -> memos.api.v1.GetWorkspaceSettingRequest + 6, // 11: memos.api.v1.WorkspaceService.UpdateWorkspaceSetting:input_type -> memos.api.v1.UpdateWorkspaceSettingRequest + 2, // 12: memos.api.v1.WorkspaceService.GetWorkspaceProfile:output_type -> memos.api.v1.WorkspaceProfile + 4, // 13: memos.api.v1.WorkspaceService.GetWorkspaceSetting:output_type -> memos.api.v1.WorkspaceSetting + 4, // 14: memos.api.v1.WorkspaceService.UpdateWorkspaceSetting:output_type -> memos.api.v1.WorkspaceSetting + 12, // [12:15] is the sub-list for method output_type + 9, // [9:12] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name } func init() { file_api_v1_workspace_service_proto_init() } @@ -1064,6 +1177,7 @@ func file_api_v1_workspace_service_proto_init() { (*WorkspaceSetting_GeneralSetting_)(nil), (*WorkspaceSetting_StorageSetting_)(nil), (*WorkspaceSetting_MemoRelatedSetting_)(nil), + (*WorkspaceSetting_AiSetting_)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -1071,7 +1185,7 @@ func file_api_v1_workspace_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_v1_workspace_service_proto_rawDesc), len(file_api_v1_workspace_service_proto_rawDesc)), NumEnums: 2, - NumMessages: 10, + NumMessages: 11, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/gen/openapi.yaml b/proto/gen/openapi.yaml index 10fa5425e..e6e109c60 100644 --- a/proto/gen/openapi.yaml +++ b/proto/gen/openapi.yaml @@ -3766,7 +3766,29 @@ components: $ref: '#/components/schemas/WorkspaceSetting_StorageSetting' memoRelatedSetting: $ref: '#/components/schemas/WorkspaceSetting_MemoRelatedSetting' + aiSetting: + $ref: '#/components/schemas/WorkspaceSetting_AiSetting' description: A workspace setting resource. + WorkspaceSetting_AiSetting: + type: object + properties: + enableAi: + type: boolean + description: enable_ai enables AI features. + baseUrl: + type: string + description: base_url is the base URL for AI API. + apiKey: + type: string + description: api_key is the API key for AI service. + model: + type: string + description: model is the AI model to use. + timeoutSeconds: + type: integer + description: timeout_seconds is the timeout for AI requests in seconds. + format: int32 + description: AI configuration settings for workspace AI features. WorkspaceSetting_GeneralSetting: type: object properties: diff --git a/proto/gen/store/workspace_setting.pb.go b/proto/gen/store/workspace_setting.pb.go index b1c5fcb86..f95de9cd5 100644 --- a/proto/gen/store/workspace_setting.pb.go +++ b/proto/gen/store/workspace_setting.pb.go @@ -33,6 +33,8 @@ const ( WorkspaceSettingKey_STORAGE WorkspaceSettingKey = 3 // MEMO_RELATED is the key for memo related settings. WorkspaceSettingKey_MEMO_RELATED WorkspaceSettingKey = 4 + // AI is the key for AI settings. + WorkspaceSettingKey_AI WorkspaceSettingKey = 5 ) // Enum value maps for WorkspaceSettingKey. @@ -43,6 +45,7 @@ var ( 2: "GENERAL", 3: "STORAGE", 4: "MEMO_RELATED", + 5: "AI", } WorkspaceSettingKey_value = map[string]int32{ "WORKSPACE_SETTING_KEY_UNSPECIFIED": 0, @@ -50,6 +53,7 @@ var ( "GENERAL": 2, "STORAGE": 3, "MEMO_RELATED": 4, + "AI": 5, } ) @@ -144,6 +148,7 @@ type WorkspaceSetting struct { // *WorkspaceSetting_GeneralSetting // *WorkspaceSetting_StorageSetting // *WorkspaceSetting_MemoRelatedSetting + // *WorkspaceSetting_AiSetting Value isWorkspaceSetting_Value `protobuf_oneof:"value"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -229,6 +234,15 @@ func (x *WorkspaceSetting) GetMemoRelatedSetting() *WorkspaceMemoRelatedSetting return nil } +func (x *WorkspaceSetting) GetAiSetting() *WorkspaceAISetting { + if x != nil { + if x, ok := x.Value.(*WorkspaceSetting_AiSetting); ok { + return x.AiSetting + } + } + return nil +} + type isWorkspaceSetting_Value interface { isWorkspaceSetting_Value() } @@ -249,6 +263,10 @@ type WorkspaceSetting_MemoRelatedSetting struct { MemoRelatedSetting *WorkspaceMemoRelatedSetting `protobuf:"bytes,5,opt,name=memo_related_setting,json=memoRelatedSetting,proto3,oneof"` } +type WorkspaceSetting_AiSetting struct { + AiSetting *WorkspaceAISetting `protobuf:"bytes,6,opt,name=ai_setting,json=aiSetting,proto3,oneof"` +} + func (*WorkspaceSetting_BasicSetting) isWorkspaceSetting_Value() {} func (*WorkspaceSetting_GeneralSetting) isWorkspaceSetting_Value() {} @@ -257,6 +275,8 @@ func (*WorkspaceSetting_StorageSetting) isWorkspaceSetting_Value() {} func (*WorkspaceSetting_MemoRelatedSetting) isWorkspaceSetting_Value() {} +func (*WorkspaceSetting_AiSetting) isWorkspaceSetting_Value() {} + type WorkspaceBasicSetting struct { state protoimpl.MessageState `protogen:"open.v1"` // The secret key for workspace. Mainly used for session management. @@ -774,17 +794,100 @@ func (x *WorkspaceMemoRelatedSetting) GetNsfwTags() []string { return nil } +type WorkspaceAISetting struct { + state protoimpl.MessageState `protogen:"open.v1"` + // enable_ai enables AI features. + EnableAi bool `protobuf:"varint,1,opt,name=enable_ai,json=enableAi,proto3" json:"enable_ai,omitempty"` + // base_url is the base URL for AI API. + BaseUrl string `protobuf:"bytes,2,opt,name=base_url,json=baseUrl,proto3" json:"base_url,omitempty"` + // api_key is the API key for AI service. + ApiKey string `protobuf:"bytes,3,opt,name=api_key,json=apiKey,proto3" json:"api_key,omitempty"` + // model is the AI model to use. + Model string `protobuf:"bytes,4,opt,name=model,proto3" json:"model,omitempty"` + // timeout_seconds is the timeout for AI requests in seconds. + TimeoutSeconds int32 `protobuf:"varint,5,opt,name=timeout_seconds,json=timeoutSeconds,proto3" json:"timeout_seconds,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WorkspaceAISetting) Reset() { + *x = WorkspaceAISetting{} + mi := &file_store_workspace_setting_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WorkspaceAISetting) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WorkspaceAISetting) ProtoMessage() {} + +func (x *WorkspaceAISetting) ProtoReflect() protoreflect.Message { + mi := &file_store_workspace_setting_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WorkspaceAISetting.ProtoReflect.Descriptor instead. +func (*WorkspaceAISetting) Descriptor() ([]byte, []int) { + return file_store_workspace_setting_proto_rawDescGZIP(), []int{7} +} + +func (x *WorkspaceAISetting) GetEnableAi() bool { + if x != nil { + return x.EnableAi + } + return false +} + +func (x *WorkspaceAISetting) GetBaseUrl() string { + if x != nil { + return x.BaseUrl + } + return "" +} + +func (x *WorkspaceAISetting) GetApiKey() string { + if x != nil { + return x.ApiKey + } + return "" +} + +func (x *WorkspaceAISetting) GetModel() string { + if x != nil { + return x.Model + } + return "" +} + +func (x *WorkspaceAISetting) GetTimeoutSeconds() int32 { + if x != nil { + return x.TimeoutSeconds + } + return 0 +} + var File_store_workspace_setting_proto protoreflect.FileDescriptor const file_store_workspace_setting_proto_rawDesc = "" + "\n" + - "\x1dstore/workspace_setting.proto\x12\vmemos.store\"\x9a\x03\n" + + "\x1dstore/workspace_setting.proto\x12\vmemos.store\"\xdc\x03\n" + "\x10WorkspaceSetting\x122\n" + "\x03key\x18\x01 \x01(\x0e2 .memos.store.WorkspaceSettingKeyR\x03key\x12I\n" + "\rbasic_setting\x18\x02 \x01(\v2\".memos.store.WorkspaceBasicSettingH\x00R\fbasicSetting\x12O\n" + "\x0fgeneral_setting\x18\x03 \x01(\v2$.memos.store.WorkspaceGeneralSettingH\x00R\x0egeneralSetting\x12O\n" + "\x0fstorage_setting\x18\x04 \x01(\v2$.memos.store.WorkspaceStorageSettingH\x00R\x0estorageSetting\x12\\\n" + - "\x14memo_related_setting\x18\x05 \x01(\v2(.memos.store.WorkspaceMemoRelatedSettingH\x00R\x12memoRelatedSettingB\a\n" + + "\x14memo_related_setting\x18\x05 \x01(\v2(.memos.store.WorkspaceMemoRelatedSettingH\x00R\x12memoRelatedSetting\x12@\n" + + "\n" + + "ai_setting\x18\x06 \x01(\v2\x1f.memos.store.WorkspaceAISettingH\x00R\taiSettingB\a\n" + "\x05value\"]\n" + "\x15WorkspaceBasicSetting\x12\x1d\n" + "\n" + @@ -832,13 +935,20 @@ const file_store_workspace_setting_proto_rawDesc = "" + "\x1adisable_markdown_shortcuts\x18\b \x01(\bR\x18disableMarkdownShortcuts\x127\n" + "\x18enable_blur_nsfw_content\x18\t \x01(\bR\x15enableBlurNsfwContent\x12\x1b\n" + "\tnsfw_tags\x18\n" + - " \x03(\tR\bnsfwTags*s\n" + + " \x03(\tR\bnsfwTags\"\xa4\x01\n" + + "\x12WorkspaceAISetting\x12\x1b\n" + + "\tenable_ai\x18\x01 \x01(\bR\benableAi\x12\x19\n" + + "\bbase_url\x18\x02 \x01(\tR\abaseUrl\x12\x17\n" + + "\aapi_key\x18\x03 \x01(\tR\x06apiKey\x12\x14\n" + + "\x05model\x18\x04 \x01(\tR\x05model\x12'\n" + + "\x0ftimeout_seconds\x18\x05 \x01(\x05R\x0etimeoutSeconds*{\n" + "\x13WorkspaceSettingKey\x12%\n" + "!WORKSPACE_SETTING_KEY_UNSPECIFIED\x10\x00\x12\t\n" + "\x05BASIC\x10\x01\x12\v\n" + "\aGENERAL\x10\x02\x12\v\n" + "\aSTORAGE\x10\x03\x12\x10\n" + - "\fMEMO_RELATED\x10\x04B\xa0\x01\n" + + "\fMEMO_RELATED\x10\x04\x12\x06\n" + + "\x02AI\x10\x05B\xa0\x01\n" + "\x0fcom.memos.storeB\x15WorkspaceSettingProtoP\x01Z)github.com/usememos/memos/proto/gen/store\xa2\x02\x03MSX\xaa\x02\vMemos.Store\xca\x02\vMemos\\Store\xe2\x02\x17Memos\\Store\\GPBMetadata\xea\x02\fMemos::Storeb\x06proto3" var ( @@ -854,7 +964,7 @@ func file_store_workspace_setting_proto_rawDescGZIP() []byte { } var file_store_workspace_setting_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_store_workspace_setting_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_store_workspace_setting_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_store_workspace_setting_proto_goTypes = []any{ (WorkspaceSettingKey)(0), // 0: memos.store.WorkspaceSettingKey (WorkspaceStorageSetting_StorageType)(0), // 1: memos.store.WorkspaceStorageSetting.StorageType @@ -865,6 +975,7 @@ var file_store_workspace_setting_proto_goTypes = []any{ (*WorkspaceStorageSetting)(nil), // 6: memos.store.WorkspaceStorageSetting (*StorageS3Config)(nil), // 7: memos.store.StorageS3Config (*WorkspaceMemoRelatedSetting)(nil), // 8: memos.store.WorkspaceMemoRelatedSetting + (*WorkspaceAISetting)(nil), // 9: memos.store.WorkspaceAISetting } var file_store_workspace_setting_proto_depIdxs = []int32{ 0, // 0: memos.store.WorkspaceSetting.key:type_name -> memos.store.WorkspaceSettingKey @@ -872,14 +983,15 @@ var file_store_workspace_setting_proto_depIdxs = []int32{ 4, // 2: memos.store.WorkspaceSetting.general_setting:type_name -> memos.store.WorkspaceGeneralSetting 6, // 3: memos.store.WorkspaceSetting.storage_setting:type_name -> memos.store.WorkspaceStorageSetting 8, // 4: memos.store.WorkspaceSetting.memo_related_setting:type_name -> memos.store.WorkspaceMemoRelatedSetting - 5, // 5: memos.store.WorkspaceGeneralSetting.custom_profile:type_name -> memos.store.WorkspaceCustomProfile - 1, // 6: memos.store.WorkspaceStorageSetting.storage_type:type_name -> memos.store.WorkspaceStorageSetting.StorageType - 7, // 7: memos.store.WorkspaceStorageSetting.s3_config:type_name -> memos.store.StorageS3Config - 8, // [8:8] is the sub-list for method output_type - 8, // [8:8] is the sub-list for method input_type - 8, // [8:8] is the sub-list for extension type_name - 8, // [8:8] is the sub-list for extension extendee - 0, // [0:8] is the sub-list for field type_name + 9, // 5: memos.store.WorkspaceSetting.ai_setting:type_name -> memos.store.WorkspaceAISetting + 5, // 6: memos.store.WorkspaceGeneralSetting.custom_profile:type_name -> memos.store.WorkspaceCustomProfile + 1, // 7: memos.store.WorkspaceStorageSetting.storage_type:type_name -> memos.store.WorkspaceStorageSetting.StorageType + 7, // 8: memos.store.WorkspaceStorageSetting.s3_config:type_name -> memos.store.StorageS3Config + 9, // [9:9] is the sub-list for method output_type + 9, // [9:9] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name } func init() { file_store_workspace_setting_proto_init() } @@ -892,6 +1004,7 @@ func file_store_workspace_setting_proto_init() { (*WorkspaceSetting_GeneralSetting)(nil), (*WorkspaceSetting_StorageSetting)(nil), (*WorkspaceSetting_MemoRelatedSetting)(nil), + (*WorkspaceSetting_AiSetting)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -899,7 +1012,7 @@ func file_store_workspace_setting_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_store_workspace_setting_proto_rawDesc), len(file_store_workspace_setting_proto_rawDesc)), NumEnums: 2, - NumMessages: 7, + NumMessages: 8, NumExtensions: 0, NumServices: 0, }, diff --git a/web/src/types/proto/api/v1/workspace_service.ts b/web/src/types/proto/api/v1/workspace_service.ts index b17c252dc..5c2952547 100644 --- a/web/src/types/proto/api/v1/workspace_service.ts +++ b/web/src/types/proto/api/v1/workspace_service.ts @@ -39,6 +39,7 @@ export interface WorkspaceSetting { generalSetting?: WorkspaceSetting_GeneralSetting | undefined; storageSetting?: WorkspaceSetting_StorageSetting | undefined; memoRelatedSetting?: WorkspaceSetting_MemoRelatedSetting | undefined; + aiSetting?: WorkspaceSetting_AiSetting | undefined; } /** Enumeration of workspace setting keys. */ @@ -50,6 +51,8 @@ export enum WorkspaceSetting_Key { STORAGE = "STORAGE", /** MEMO_RELATED - MEMO_RELATED is the key for memo related settings. */ MEMO_RELATED = "MEMO_RELATED", + /** AI - AI is the key for AI settings. */ + AI = "AI", UNRECOGNIZED = "UNRECOGNIZED", } @@ -67,6 +70,9 @@ export function workspaceSetting_KeyFromJSON(object: any): WorkspaceSetting_Key case 3: case "MEMO_RELATED": return WorkspaceSetting_Key.MEMO_RELATED; + case 4: + case "AI": + return WorkspaceSetting_Key.AI; case -1: case "UNRECOGNIZED": default: @@ -84,6 +90,8 @@ export function workspaceSetting_KeyToNumber(object: WorkspaceSetting_Key): numb return 2; case WorkspaceSetting_Key.MEMO_RELATED: return 3; + case WorkspaceSetting_Key.AI: + return 4; case WorkspaceSetting_Key.UNRECOGNIZED: default: return -1; @@ -232,6 +240,20 @@ export interface WorkspaceSetting_MemoRelatedSetting { nsfwTags: string[]; } +/** AI configuration settings for workspace AI features. */ +export interface WorkspaceSetting_AiSetting { + /** enable_ai enables AI features. */ + enableAi: boolean; + /** base_url is the base URL for AI API. */ + baseUrl: string; + /** api_key is the API key for AI service. */ + apiKey: string; + /** model is the AI model to use. */ + model: string; + /** timeout_seconds is the timeout for AI requests in seconds. */ + timeoutSeconds: number; +} + /** Request message for GetWorkspaceSetting method. */ export interface GetWorkspaceSettingRequest { /** @@ -368,7 +390,13 @@ export const GetWorkspaceProfileRequest: MessageFns }; function createBaseWorkspaceSetting(): WorkspaceSetting { - return { name: "", generalSetting: undefined, storageSetting: undefined, memoRelatedSetting: undefined }; + return { + name: "", + generalSetting: undefined, + storageSetting: undefined, + memoRelatedSetting: undefined, + aiSetting: undefined, + }; } export const WorkspaceSetting: MessageFns = { @@ -385,6 +413,9 @@ export const WorkspaceSetting: MessageFns = { if (message.memoRelatedSetting !== undefined) { WorkspaceSetting_MemoRelatedSetting.encode(message.memoRelatedSetting, writer.uint32(34).fork()).join(); } + if (message.aiSetting !== undefined) { + WorkspaceSetting_AiSetting.encode(message.aiSetting, writer.uint32(42).fork()).join(); + } return writer; }, @@ -427,6 +458,14 @@ export const WorkspaceSetting: MessageFns = { message.memoRelatedSetting = WorkspaceSetting_MemoRelatedSetting.decode(reader, reader.uint32()); continue; } + case 5: { + if (tag !== 42) { + break; + } + + message.aiSetting = WorkspaceSetting_AiSetting.decode(reader, reader.uint32()); + continue; + } } if ((tag & 7) === 4 || tag === 0) { break; @@ -451,6 +490,9 @@ export const WorkspaceSetting: MessageFns = { message.memoRelatedSetting = (object.memoRelatedSetting !== undefined && object.memoRelatedSetting !== null) ? WorkspaceSetting_MemoRelatedSetting.fromPartial(object.memoRelatedSetting) : undefined; + message.aiSetting = (object.aiSetting !== undefined && object.aiSetting !== null) + ? WorkspaceSetting_AiSetting.fromPartial(object.aiSetting) + : undefined; return message; }, }; @@ -1046,6 +1088,100 @@ export const WorkspaceSetting_MemoRelatedSetting: MessageFns = { + encode(message: WorkspaceSetting_AiSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.enableAi !== false) { + writer.uint32(8).bool(message.enableAi); + } + if (message.baseUrl !== "") { + writer.uint32(18).string(message.baseUrl); + } + if (message.apiKey !== "") { + writer.uint32(26).string(message.apiKey); + } + if (message.model !== "") { + writer.uint32(34).string(message.model); + } + if (message.timeoutSeconds !== 0) { + writer.uint32(40).int32(message.timeoutSeconds); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WorkspaceSetting_AiSetting { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWorkspaceSetting_AiSetting(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.enableAi = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.baseUrl = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.apiKey = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.model = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.timeoutSeconds = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): WorkspaceSetting_AiSetting { + return WorkspaceSetting_AiSetting.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): WorkspaceSetting_AiSetting { + const message = createBaseWorkspaceSetting_AiSetting(); + message.enableAi = object.enableAi ?? false; + message.baseUrl = object.baseUrl ?? ""; + message.apiKey = object.apiKey ?? ""; + message.model = object.model ?? ""; + message.timeoutSeconds = object.timeoutSeconds ?? 0; + return message; + }, +}; + function createBaseGetWorkspaceSettingRequest(): GetWorkspaceSettingRequest { return { name: "" }; } diff --git a/web/src/types/proto/google/protobuf/descriptor.ts b/web/src/types/proto/google/protobuf/descriptor.ts index 89514564e..db1d2d4a3 100644 --- a/web/src/types/proto/google/protobuf/descriptor.ts +++ b/web/src/types/proto/google/protobuf/descriptor.ts @@ -128,6 +128,52 @@ export function editionToNumber(object: Edition): number { } } +/** + * Describes the 'visibility' of a symbol with respect to the proto import + * system. Symbols can only be imported when the visibility rules do not prevent + * it (ex: local symbols cannot be imported). Visibility modifiers can only set + * on `message` and `enum` as they are the only types available to be referenced + * from other files. + */ +export enum SymbolVisibility { + VISIBILITY_UNSET = "VISIBILITY_UNSET", + VISIBILITY_LOCAL = "VISIBILITY_LOCAL", + VISIBILITY_EXPORT = "VISIBILITY_EXPORT", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function symbolVisibilityFromJSON(object: any): SymbolVisibility { + switch (object) { + case 0: + case "VISIBILITY_UNSET": + return SymbolVisibility.VISIBILITY_UNSET; + case 1: + case "VISIBILITY_LOCAL": + return SymbolVisibility.VISIBILITY_LOCAL; + case 2: + case "VISIBILITY_EXPORT": + return SymbolVisibility.VISIBILITY_EXPORT; + case -1: + case "UNRECOGNIZED": + default: + return SymbolVisibility.UNRECOGNIZED; + } +} + +export function symbolVisibilityToNumber(object: SymbolVisibility): number { + switch (object) { + case SymbolVisibility.VISIBILITY_UNSET: + return 0; + case SymbolVisibility.VISIBILITY_LOCAL: + return 1; + case SymbolVisibility.VISIBILITY_EXPORT: + return 2; + case SymbolVisibility.UNRECOGNIZED: + default: + return -1; + } +} + /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -155,6 +201,11 @@ export interface FileDescriptorProto { * For Google-internal migration only. Do not use. */ weakDependency: number[]; + /** + * Names of files imported by this file purely for the purpose of providing + * option extensions. These are excluded from the dependency list above. + */ + optionDependency: string[]; /** All top-level definitions in this file. */ messageType: DescriptorProto[]; enumType: EnumDescriptorProto[]; @@ -209,6 +260,8 @@ export interface DescriptorProto { * A given name may only be reserved once. */ reservedName: string[]; + /** Support for `export` and `local` keywords on enums. */ + visibility?: SymbolVisibility | undefined; } export interface DescriptorProto_ExtensionRange { @@ -632,6 +685,8 @@ export interface EnumDescriptorProto { * be reserved once. */ reservedName: string[]; + /** Support for `export` and `local` keywords on enums. */ + visibility?: SymbolVisibility | undefined; } /** @@ -1594,6 +1649,7 @@ export interface FeatureSet { messageEncoding?: FeatureSet_MessageEncoding | undefined; jsonFormat?: FeatureSet_JsonFormat | undefined; enforceNamingStyle?: FeatureSet_EnforceNamingStyle | undefined; + defaultSymbolVisibility?: FeatureSet_VisibilityFeature_DefaultSymbolVisibility | undefined; } export enum FeatureSet_FieldPresence { @@ -1875,6 +1931,72 @@ export function featureSet_EnforceNamingStyleToNumber(object: FeatureSet_Enforce } } +export interface FeatureSet_VisibilityFeature { +} + +export enum FeatureSet_VisibilityFeature_DefaultSymbolVisibility { + DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN", + /** EXPORT_ALL - Default pre-EDITION_2024, all UNSET visibility are export. */ + EXPORT_ALL = "EXPORT_ALL", + /** EXPORT_TOP_LEVEL - All top-level symbols default to export, nested default to local. */ + EXPORT_TOP_LEVEL = "EXPORT_TOP_LEVEL", + /** LOCAL_ALL - All symbols default to local. */ + LOCAL_ALL = "LOCAL_ALL", + /** + * STRICT - All symbols local by default. Nested types cannot be exported. + * With special case caveat for message { enum {} reserved 1 to max; } + * This is the recommended setting for new protos. + */ + STRICT = "STRICT", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function featureSet_VisibilityFeature_DefaultSymbolVisibilityFromJSON( + object: any, +): FeatureSet_VisibilityFeature_DefaultSymbolVisibility { + switch (object) { + case 0: + case "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": + return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN; + case 1: + case "EXPORT_ALL": + return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.EXPORT_ALL; + case 2: + case "EXPORT_TOP_LEVEL": + return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.EXPORT_TOP_LEVEL; + case 3: + case "LOCAL_ALL": + return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.LOCAL_ALL; + case 4: + case "STRICT": + return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.STRICT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.UNRECOGNIZED; + } +} + +export function featureSet_VisibilityFeature_DefaultSymbolVisibilityToNumber( + object: FeatureSet_VisibilityFeature_DefaultSymbolVisibility, +): number { + switch (object) { + case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN: + return 0; + case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.EXPORT_ALL: + return 1; + case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.EXPORT_TOP_LEVEL: + return 2; + case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.LOCAL_ALL: + return 3; + case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.STRICT: + return 4; + case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.UNRECOGNIZED: + default: + return -1; + } +} + /** * A compiled specification for the defaults of a set of features. These * messages are generated from FeatureSet extensions and can be used to seed @@ -2195,6 +2317,7 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { dependency: [], publicDependency: [], weakDependency: [], + optionDependency: [], messageType: [], enumType: [], service: [], @@ -2227,6 +2350,9 @@ export const FileDescriptorProto: MessageFns = { writer.int32(v); } writer.join(); + for (const v of message.optionDependency) { + writer.uint32(122).string(v!); + } for (const v of message.messageType) { DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); } @@ -2321,6 +2447,14 @@ export const FileDescriptorProto: MessageFns = { break; } + case 15: { + if (tag !== 122) { + break; + } + + message.optionDependency.push(reader.string()); + continue; + } case 4: { if (tag !== 34) { break; @@ -2404,6 +2538,7 @@ export const FileDescriptorProto: MessageFns = { message.dependency = object.dependency?.map((e) => e) || []; message.publicDependency = object.publicDependency?.map((e) => e) || []; message.weakDependency = object.weakDependency?.map((e) => e) || []; + message.optionDependency = object.optionDependency?.map((e) => e) || []; message.messageType = object.messageType?.map((e) => DescriptorProto.fromPartial(e)) || []; message.enumType = object.enumType?.map((e) => EnumDescriptorProto.fromPartial(e)) || []; message.service = object.service?.map((e) => ServiceDescriptorProto.fromPartial(e)) || []; @@ -2432,6 +2567,7 @@ function createBaseDescriptorProto(): DescriptorProto { options: undefined, reservedRange: [], reservedName: [], + visibility: SymbolVisibility.VISIBILITY_UNSET, }; } @@ -2467,6 +2603,9 @@ export const DescriptorProto: MessageFns = { for (const v of message.reservedName) { writer.uint32(82).string(v!); } + if (message.visibility !== undefined && message.visibility !== SymbolVisibility.VISIBILITY_UNSET) { + writer.uint32(88).int32(symbolVisibilityToNumber(message.visibility)); + } return writer; }, @@ -2557,6 +2696,14 @@ export const DescriptorProto: MessageFns = { message.reservedName.push(reader.string()); continue; } + case 11: { + if (tag !== 88) { + break; + } + + message.visibility = symbolVisibilityFromJSON(reader.int32()); + continue; + } } if ((tag & 7) === 4 || tag === 0) { break; @@ -2583,6 +2730,7 @@ export const DescriptorProto: MessageFns = { : undefined; message.reservedRange = object.reservedRange?.map((e) => DescriptorProto_ReservedRange.fromPartial(e)) || []; message.reservedName = object.reservedName?.map((e) => e) || []; + message.visibility = object.visibility ?? SymbolVisibility.VISIBILITY_UNSET; return message; }, }; @@ -3143,7 +3291,14 @@ export const OneofDescriptorProto: MessageFns = { }; function createBaseEnumDescriptorProto(): EnumDescriptorProto { - return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; + return { + name: "", + value: [], + options: undefined, + reservedRange: [], + reservedName: [], + visibility: SymbolVisibility.VISIBILITY_UNSET, + }; } export const EnumDescriptorProto: MessageFns = { @@ -3163,6 +3318,9 @@ export const EnumDescriptorProto: MessageFns = { for (const v of message.reservedName) { writer.uint32(42).string(v!); } + if (message.visibility !== undefined && message.visibility !== SymbolVisibility.VISIBILITY_UNSET) { + writer.uint32(48).int32(symbolVisibilityToNumber(message.visibility)); + } return writer; }, @@ -3213,6 +3371,14 @@ export const EnumDescriptorProto: MessageFns = { message.reservedName.push(reader.string()); continue; } + case 6: { + if (tag !== 48) { + break; + } + + message.visibility = symbolVisibilityFromJSON(reader.int32()); + continue; + } } if ((tag & 7) === 4 || tag === 0) { break; @@ -3235,6 +3401,7 @@ export const EnumDescriptorProto: MessageFns = { message.reservedRange = object.reservedRange?.map((e) => EnumDescriptorProto_EnumReservedRange.fromPartial(e)) || []; message.reservedName = object.reservedName?.map((e) => e) || []; + message.visibility = object.visibility ?? SymbolVisibility.VISIBILITY_UNSET; return message; }, }; @@ -4999,6 +5166,7 @@ function createBaseFeatureSet(): FeatureSet { messageEncoding: FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN, jsonFormat: FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN, enforceNamingStyle: FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN, + defaultSymbolVisibility: FeatureSet_VisibilityFeature_DefaultSymbolVisibility.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN, }; } @@ -5039,6 +5207,15 @@ export const FeatureSet: MessageFns = { ) { writer.uint32(56).int32(featureSet_EnforceNamingStyleToNumber(message.enforceNamingStyle)); } + if ( + message.defaultSymbolVisibility !== undefined && + message.defaultSymbolVisibility !== + FeatureSet_VisibilityFeature_DefaultSymbolVisibility.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN + ) { + writer.uint32(64).int32( + featureSet_VisibilityFeature_DefaultSymbolVisibilityToNumber(message.defaultSymbolVisibility), + ); + } return writer; }, @@ -5105,6 +5282,16 @@ export const FeatureSet: MessageFns = { message.enforceNamingStyle = featureSet_EnforceNamingStyleFromJSON(reader.int32()); continue; } + case 8: { + if (tag !== 64) { + break; + } + + message.defaultSymbolVisibility = featureSet_VisibilityFeature_DefaultSymbolVisibilityFromJSON( + reader.int32(), + ); + continue; + } } if ((tag & 7) === 4 || tag === 0) { break; @@ -5128,6 +5315,42 @@ export const FeatureSet: MessageFns = { message.jsonFormat = object.jsonFormat ?? FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; message.enforceNamingStyle = object.enforceNamingStyle ?? FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN; + message.defaultSymbolVisibility = object.defaultSymbolVisibility ?? + FeatureSet_VisibilityFeature_DefaultSymbolVisibility.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN; + return message; + }, +}; + +function createBaseFeatureSet_VisibilityFeature(): FeatureSet_VisibilityFeature { + return {}; +} + +export const FeatureSet_VisibilityFeature: MessageFns = { + encode(_: FeatureSet_VisibilityFeature, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet_VisibilityFeature { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet_VisibilityFeature(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): FeatureSet_VisibilityFeature { + return FeatureSet_VisibilityFeature.fromPartial(base ?? {}); + }, + fromPartial(_: DeepPartial): FeatureSet_VisibilityFeature { + const message = createBaseFeatureSet_VisibilityFeature(); return message; }, };