mirror of https://github.com/microsoft/autogen.git
Update .net code to use CloudEvent, add Event back to proto definition (#530)
* remove OAgents lib from sln * add Event back to agent_worker_proto * regenerate python proto, remove RegisterAgent addition * add cloudevent.proto to the python generation task
This commit is contained in:
parent
bc8529d4fc
commit
3222632497
|
@ -86,15 +86,15 @@ public abstract class AgentBase
|
|||
{
|
||||
switch (msg.MessageCase)
|
||||
{
|
||||
case Message.MessageOneofCase.Event:
|
||||
case Message.MessageOneofCase.CloudEvent:
|
||||
{
|
||||
// TODO: fix activity extraction
|
||||
var activity = default(Activity); // ExtractActivity(msg.Event.Type, msg.Event.Attributes);
|
||||
await this.InvokeWithActivityAsync(
|
||||
static ((AgentBase Agent, CloudEvent Item) state) => state.Agent.CallHandler(state.Item),
|
||||
(this, msg.Event),
|
||||
(this, msg.CloudEvent),
|
||||
activity,
|
||||
msg.Event.Type).ConfigureAwait(false);
|
||||
msg.CloudEvent.Type).ConfigureAwait(false);
|
||||
}
|
||||
break;
|
||||
case Message.MessageOneofCase.Request:
|
||||
|
|
|
@ -86,7 +86,7 @@ public sealed class AgentWorkerRuntime : IHostedService, IDisposable, IAgentWork
|
|||
// where AgentId = (namespace: event.Namespace, name: agentType)
|
||||
// i.e, assume each agent type implicitly subscribes to each event.
|
||||
|
||||
var item = message.Event;
|
||||
var item = message.CloudEvent;
|
||||
|
||||
foreach (var (typeName, _) in _agentTypes)
|
||||
{
|
||||
|
@ -178,10 +178,10 @@ public sealed class AgentWorkerRuntime : IHostedService, IDisposable, IAgentWork
|
|||
{
|
||||
RegisterAgentType = new RegisterAgentType
|
||||
{
|
||||
AgentType = type,
|
||||
TopicTypes = { topicTypes },
|
||||
StateType = state?.Name,
|
||||
Events = { events }
|
||||
Type = type,
|
||||
//TopicTypes = { topicTypes },
|
||||
//StateType = state?.Name,
|
||||
//Events = { events }
|
||||
}
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ public sealed class AgentWorkerRuntime : IHostedService, IDisposable, IAgentWork
|
|||
|
||||
public async ValueTask PublishEvent(CloudEvent @event)
|
||||
{
|
||||
await WriteChannelAsync(new Message { Event = @event }).ConfigureAwait(false);
|
||||
await WriteChannelAsync(new Message { CloudEvent = @event }).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async Task WriteChannelAsync(Message message)
|
||||
|
|
|
@ -40,7 +40,7 @@ internal sealed class WorkerGateway : BackgroundService, IWorkerGateway
|
|||
var tasks = new List<Task>(_workers.Count);
|
||||
foreach (var (_, connection) in _workers)
|
||||
{
|
||||
tasks.Add(connection.SendMessage(new Message { Event = evt }));
|
||||
tasks.Add(connection.SendMessage(new Message { CloudEvent = evt }));
|
||||
}
|
||||
|
||||
await Task.WhenAll(tasks);
|
||||
|
@ -126,8 +126,8 @@ internal sealed class WorkerGateway : BackgroundService, IWorkerGateway
|
|||
case Message.MessageOneofCase.Response:
|
||||
DispatchResponse(connection, message.Response);
|
||||
break;
|
||||
case Message.MessageOneofCase.Event:
|
||||
await DispatchEventAsync(message.Event);
|
||||
case Message.MessageOneofCase.CloudEvent:
|
||||
await DispatchEventAsync(message.CloudEvent);
|
||||
break;
|
||||
case Message.MessageOneofCase.RegisterAgentType:
|
||||
await RegisterAgentTypeAsync(connection, message.RegisterAgentType);
|
||||
|
@ -139,10 +139,10 @@ internal sealed class WorkerGateway : BackgroundService, IWorkerGateway
|
|||
|
||||
async ValueTask RegisterAgentTypeAsync(WorkerProcessConnection connection, RegisterAgentType msg)
|
||||
{
|
||||
connection.AddSupportedType(msg.AgentType);
|
||||
_supportedAgentTypes.GetOrAdd(msg.AgentType, _ => []).Add(connection);
|
||||
connection.AddSupportedType(msg.Type);
|
||||
_supportedAgentTypes.GetOrAdd(msg.Type, _ => []).Add(connection);
|
||||
|
||||
await _gatewayRegistry.RegisterAgentType(msg.AgentType, _reference);
|
||||
await _gatewayRegistry.RegisterAgentType(msg.Type, _reference);
|
||||
}
|
||||
|
||||
async ValueTask DispatchEventAsync(CloudEvent evt)
|
||||
|
|
|
@ -46,10 +46,7 @@ message Event {
|
|||
}
|
||||
|
||||
message RegisterAgentType {
|
||||
string agentType = 1;
|
||||
repeated string topicTypes = 2;
|
||||
repeated string events = 3;
|
||||
string stateType = 4;
|
||||
string type = 1;
|
||||
}
|
||||
|
||||
message TypeSubscription {
|
||||
|
@ -75,9 +72,10 @@ message Message {
|
|||
oneof message {
|
||||
RpcRequest request = 1;
|
||||
RpcResponse response = 2;
|
||||
cloudevent.CloudEvent event = 3;
|
||||
Event event = 3;
|
||||
RegisterAgentType registerAgentType = 4;
|
||||
AddSubscription addSubscription = 5;
|
||||
cloudevent.CloudEvent cloudEvent = 6;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,9 +12,11 @@ from google.protobuf.internal import builder as _builder
|
|||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
import cloudevent_pb2 as cloudevent__pb2
|
||||
from google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x12\x61gent_worker.proto\x12\x06\x61gents\"$\n\x07\x41gentId\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\x0b\n\x03key\x18\x02 \x01(\t\"E\n\x07Payload\x12\x11\n\tdata_type\x18\x01 \x01(\t\x12\x19\n\x11\x64\x61ta_content_type\x18\x02 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\x0c\"\x89\x02\n\nRpcRequest\x12\x12\n\nrequest_id\x18\x01 \x01(\t\x12$\n\x06source\x18\x02 \x01(\x0b\x32\x0f.agents.AgentIdH\x00\x88\x01\x01\x12\x1f\n\x06target\x18\x03 \x01(\x0b\x32\x0f.agents.AgentId\x12\x0e\n\x06method\x18\x04 \x01(\t\x12 \n\x07payload\x18\x05 \x01(\x0b\x32\x0f.agents.Payload\x12\x32\n\x08metadata\x18\x06 \x03(\x0b\x32 .agents.RpcRequest.MetadataEntry\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\t\n\x07_source\"\xb8\x01\n\x0bRpcResponse\x12\x12\n\nrequest_id\x18\x01 \x01(\t\x12 \n\x07payload\x18\x02 \x01(\x0b\x32\x0f.agents.Payload\x12\r\n\x05\x65rror\x18\x03 \x01(\t\x12\x33\n\x08metadata\x18\x04 \x03(\x0b\x32!.agents.RpcResponse.MetadataEntry\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xe4\x01\n\x05\x45vent\x12\x12\n\ntopic_type\x18\x01 \x01(\t\x12\x14\n\x0ctopic_source\x18\x02 \x01(\t\x12$\n\x06source\x18\x03 \x01(\x0b\x32\x0f.agents.AgentIdH\x00\x88\x01\x01\x12 \n\x07payload\x18\x04 \x01(\x0b\x32\x0f.agents.Payload\x12-\n\x08metadata\x18\x05 \x03(\x0b\x32\x1b.agents.Event.MetadataEntry\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\t\n\x07_source\"!\n\x11RegisterAgentType\x12\x0c\n\x04type\x18\x01 \x01(\t\":\n\x10TypeSubscription\x12\x12\n\ntopic_type\x18\x01 \x01(\t\x12\x12\n\nagent_type\x18\x02 \x01(\t\"T\n\x0cSubscription\x12\x34\n\x10typeSubscription\x18\x01 \x01(\x0b\x32\x18.agents.TypeSubscriptionH\x00\x42\x0e\n\x0csubscription\"=\n\x0f\x41\x64\x64Subscription\x12*\n\x0csubscription\x18\x01 \x01(\x0b\x32\x14.agents.Subscription\"\xf0\x01\n\x07Message\x12%\n\x07request\x18\x01 \x01(\x0b\x32\x12.agents.RpcRequestH\x00\x12\'\n\x08response\x18\x02 \x01(\x0b\x32\x13.agents.RpcResponseH\x00\x12\x1e\n\x05\x65vent\x18\x03 \x01(\x0b\x32\r.agents.EventH\x00\x12\x36\n\x11registerAgentType\x18\x04 \x01(\x0b\x32\x19.agents.RegisterAgentTypeH\x00\x12\x32\n\x0f\x61\x64\x64Subscription\x18\x05 \x01(\x0b\x32\x17.agents.AddSubscriptionH\x00\x42\t\n\x07message2?\n\x08\x41gentRpc\x12\x33\n\x0bOpenChannel\x12\x0f.agents.Message\x1a\x0f.agents.Message(\x01\x30\x01\x62\x06proto3')
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x12\x61gent_worker.proto\x12\x06\x61gents\x1a\x10\x63loudevent.proto\x1a\x19google/protobuf/any.proto\"\'\n\x07TopicId\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\x0e\n\x06source\x18\x02 \x01(\t\"$\n\x07\x41gentId\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\x0b\n\x03key\x18\x02 \x01(\t\"E\n\x07Payload\x12\x11\n\tdata_type\x18\x01 \x01(\t\x12\x19\n\x11\x64\x61ta_content_type\x18\x02 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\x0c\"\x89\x02\n\nRpcRequest\x12\x12\n\nrequest_id\x18\x01 \x01(\t\x12$\n\x06source\x18\x02 \x01(\x0b\x32\x0f.agents.AgentIdH\x00\x88\x01\x01\x12\x1f\n\x06target\x18\x03 \x01(\x0b\x32\x0f.agents.AgentId\x12\x0e\n\x06method\x18\x04 \x01(\t\x12 \n\x07payload\x18\x05 \x01(\x0b\x32\x0f.agents.Payload\x12\x32\n\x08metadata\x18\x06 \x03(\x0b\x32 .agents.RpcRequest.MetadataEntry\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\t\n\x07_source\"\xb8\x01\n\x0bRpcResponse\x12\x12\n\nrequest_id\x18\x01 \x01(\t\x12 \n\x07payload\x18\x02 \x01(\x0b\x32\x0f.agents.Payload\x12\r\n\x05\x65rror\x18\x03 \x01(\t\x12\x33\n\x08metadata\x18\x04 \x03(\x0b\x32!.agents.RpcResponse.MetadataEntry\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xe4\x01\n\x05\x45vent\x12\x12\n\ntopic_type\x18\x01 \x01(\t\x12\x14\n\x0ctopic_source\x18\x02 \x01(\t\x12$\n\x06source\x18\x03 \x01(\x0b\x32\x0f.agents.AgentIdH\x00\x88\x01\x01\x12 \n\x07payload\x18\x04 \x01(\x0b\x32\x0f.agents.Payload\x12-\n\x08metadata\x18\x05 \x03(\x0b\x32\x1b.agents.Event.MetadataEntry\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\t\n\x07_source\"!\n\x11RegisterAgentType\x12\x0c\n\x04type\x18\x01 \x01(\t\":\n\x10TypeSubscription\x12\x12\n\ntopic_type\x18\x01 \x01(\t\x12\x12\n\nagent_type\x18\x02 \x01(\t\"T\n\x0cSubscription\x12\x34\n\x10typeSubscription\x18\x01 \x01(\x0b\x32\x18.agents.TypeSubscriptionH\x00\x42\x0e\n\x0csubscription\"=\n\x0f\x41\x64\x64Subscription\x12*\n\x0csubscription\x18\x01 \x01(\x0b\x32\x14.agents.Subscription\"\x9e\x02\n\x07Message\x12%\n\x07request\x18\x01 \x01(\x0b\x32\x12.agents.RpcRequestH\x00\x12\'\n\x08response\x18\x02 \x01(\x0b\x32\x13.agents.RpcResponseH\x00\x12\x1e\n\x05\x65vent\x18\x03 \x01(\x0b\x32\r.agents.EventH\x00\x12\x36\n\x11registerAgentType\x18\x04 \x01(\x0b\x32\x19.agents.RegisterAgentTypeH\x00\x12\x32\n\x0f\x61\x64\x64Subscription\x18\x05 \x01(\x0b\x32\x17.agents.AddSubscriptionH\x00\x12,\n\ncloudEvent\x18\x06 \x01(\x0b\x32\x16.cloudevent.CloudEventH\x00\x42\t\n\x07message2?\n\x08\x41gentRpc\x12\x33\n\x0bOpenChannel\x12\x0f.agents.Message\x1a\x0f.agents.Message(\x01\x30\x01\x62\x06proto3')
|
||||
|
||||
_globals = globals()
|
||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||
|
@ -27,32 +29,34 @@ if _descriptor._USE_C_DESCRIPTORS == False:
|
|||
_globals['_RPCRESPONSE_METADATAENTRY']._serialized_options = b'8\001'
|
||||
_globals['_EVENT_METADATAENTRY']._options = None
|
||||
_globals['_EVENT_METADATAENTRY']._serialized_options = b'8\001'
|
||||
_globals['_AGENTID']._serialized_start=30
|
||||
_globals['_AGENTID']._serialized_end=66
|
||||
_globals['_PAYLOAD']._serialized_start=68
|
||||
_globals['_PAYLOAD']._serialized_end=137
|
||||
_globals['_RPCREQUEST']._serialized_start=140
|
||||
_globals['_RPCREQUEST']._serialized_end=405
|
||||
_globals['_RPCREQUEST_METADATAENTRY']._serialized_start=347
|
||||
_globals['_RPCREQUEST_METADATAENTRY']._serialized_end=394
|
||||
_globals['_RPCRESPONSE']._serialized_start=408
|
||||
_globals['_RPCRESPONSE']._serialized_end=592
|
||||
_globals['_RPCRESPONSE_METADATAENTRY']._serialized_start=347
|
||||
_globals['_RPCRESPONSE_METADATAENTRY']._serialized_end=394
|
||||
_globals['_EVENT']._serialized_start=595
|
||||
_globals['_EVENT']._serialized_end=823
|
||||
_globals['_EVENT_METADATAENTRY']._serialized_start=347
|
||||
_globals['_EVENT_METADATAENTRY']._serialized_end=394
|
||||
_globals['_REGISTERAGENTTYPE']._serialized_start=825
|
||||
_globals['_REGISTERAGENTTYPE']._serialized_end=858
|
||||
_globals['_TYPESUBSCRIPTION']._serialized_start=860
|
||||
_globals['_TYPESUBSCRIPTION']._serialized_end=918
|
||||
_globals['_SUBSCRIPTION']._serialized_start=920
|
||||
_globals['_SUBSCRIPTION']._serialized_end=1004
|
||||
_globals['_ADDSUBSCRIPTION']._serialized_start=1006
|
||||
_globals['_ADDSUBSCRIPTION']._serialized_end=1067
|
||||
_globals['_MESSAGE']._serialized_start=1070
|
||||
_globals['_MESSAGE']._serialized_end=1310
|
||||
_globals['_AGENTRPC']._serialized_start=1312
|
||||
_globals['_AGENTRPC']._serialized_end=1375
|
||||
_globals['_TOPICID']._serialized_start=75
|
||||
_globals['_TOPICID']._serialized_end=114
|
||||
_globals['_AGENTID']._serialized_start=116
|
||||
_globals['_AGENTID']._serialized_end=152
|
||||
_globals['_PAYLOAD']._serialized_start=154
|
||||
_globals['_PAYLOAD']._serialized_end=223
|
||||
_globals['_RPCREQUEST']._serialized_start=226
|
||||
_globals['_RPCREQUEST']._serialized_end=491
|
||||
_globals['_RPCREQUEST_METADATAENTRY']._serialized_start=433
|
||||
_globals['_RPCREQUEST_METADATAENTRY']._serialized_end=480
|
||||
_globals['_RPCRESPONSE']._serialized_start=494
|
||||
_globals['_RPCRESPONSE']._serialized_end=678
|
||||
_globals['_RPCRESPONSE_METADATAENTRY']._serialized_start=433
|
||||
_globals['_RPCRESPONSE_METADATAENTRY']._serialized_end=480
|
||||
_globals['_EVENT']._serialized_start=681
|
||||
_globals['_EVENT']._serialized_end=909
|
||||
_globals['_EVENT_METADATAENTRY']._serialized_start=433
|
||||
_globals['_EVENT_METADATAENTRY']._serialized_end=480
|
||||
_globals['_REGISTERAGENTTYPE']._serialized_start=911
|
||||
_globals['_REGISTERAGENTTYPE']._serialized_end=944
|
||||
_globals['_TYPESUBSCRIPTION']._serialized_start=946
|
||||
_globals['_TYPESUBSCRIPTION']._serialized_end=1004
|
||||
_globals['_SUBSCRIPTION']._serialized_start=1006
|
||||
_globals['_SUBSCRIPTION']._serialized_end=1090
|
||||
_globals['_ADDSUBSCRIPTION']._serialized_start=1092
|
||||
_globals['_ADDSUBSCRIPTION']._serialized_end=1153
|
||||
_globals['_MESSAGE']._serialized_start=1156
|
||||
_globals['_MESSAGE']._serialized_end=1442
|
||||
_globals['_AGENTRPC']._serialized_start=1444
|
||||
_globals['_AGENTRPC']._serialized_end=1507
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
|
|
|
@ -4,6 +4,7 @@ isort:skip_file
|
|||
"""
|
||||
|
||||
import builtins
|
||||
import cloudevent_pb2
|
||||
import collections.abc
|
||||
import google.protobuf.descriptor
|
||||
import google.protobuf.internal.containers
|
||||
|
@ -12,6 +13,24 @@ import typing
|
|||
|
||||
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
|
||||
|
||||
@typing.final
|
||||
class TopicId(google.protobuf.message.Message):
|
||||
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
||||
|
||||
TYPE_FIELD_NUMBER: builtins.int
|
||||
SOURCE_FIELD_NUMBER: builtins.int
|
||||
type: builtins.str
|
||||
source: builtins.str
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
type: builtins.str = ...,
|
||||
source: builtins.str = ...,
|
||||
) -> None: ...
|
||||
def ClearField(self, field_name: typing.Literal["source", b"source", "type", b"type"]) -> None: ...
|
||||
|
||||
global___TopicId = TopicId
|
||||
|
||||
@typing.final
|
||||
class AgentId(google.protobuf.message.Message):
|
||||
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
||||
|
@ -271,6 +290,7 @@ class Message(google.protobuf.message.Message):
|
|||
EVENT_FIELD_NUMBER: builtins.int
|
||||
REGISTERAGENTTYPE_FIELD_NUMBER: builtins.int
|
||||
ADDSUBSCRIPTION_FIELD_NUMBER: builtins.int
|
||||
CLOUDEVENT_FIELD_NUMBER: builtins.int
|
||||
@property
|
||||
def request(self) -> global___RpcRequest: ...
|
||||
@property
|
||||
|
@ -281,6 +301,8 @@ class Message(google.protobuf.message.Message):
|
|||
def registerAgentType(self) -> global___RegisterAgentType: ...
|
||||
@property
|
||||
def addSubscription(self) -> global___AddSubscription: ...
|
||||
@property
|
||||
def cloudEvent(self) -> cloudevent_pb2.CloudEvent: ...
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
|
@ -289,9 +311,10 @@ class Message(google.protobuf.message.Message):
|
|||
event: global___Event | None = ...,
|
||||
registerAgentType: global___RegisterAgentType | None = ...,
|
||||
addSubscription: global___AddSubscription | None = ...,
|
||||
cloudEvent: cloudevent_pb2.CloudEvent | None = ...,
|
||||
) -> None: ...
|
||||
def HasField(self, field_name: typing.Literal["addSubscription", b"addSubscription", "event", b"event", "message", b"message", "registerAgentType", b"registerAgentType", "request", b"request", "response", b"response"]) -> builtins.bool: ...
|
||||
def ClearField(self, field_name: typing.Literal["addSubscription", b"addSubscription", "event", b"event", "message", b"message", "registerAgentType", b"registerAgentType", "request", b"request", "response", b"response"]) -> None: ...
|
||||
def WhichOneof(self, oneof_group: typing.Literal["message", b"message"]) -> typing.Literal["request", "response", "event", "registerAgentType", "addSubscription"] | None: ...
|
||||
def HasField(self, field_name: typing.Literal["addSubscription", b"addSubscription", "cloudEvent", b"cloudEvent", "event", b"event", "message", b"message", "registerAgentType", b"registerAgentType", "request", b"request", "response", b"response"]) -> builtins.bool: ...
|
||||
def ClearField(self, field_name: typing.Literal["addSubscription", b"addSubscription", "cloudEvent", b"cloudEvent", "event", b"event", "message", b"message", "registerAgentType", b"registerAgentType", "request", b"request", "response", b"response"]) -> None: ...
|
||||
def WhichOneof(self, oneof_group: typing.Literal["message", b"message"]) -> typing.Literal["request", "response", "event", "registerAgentType", "addSubscription", "cloudEvent"] | None: ...
|
||||
|
||||
global___Message = Message
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: cloudevent.proto
|
||||
# Protobuf Python Version: 4.25.1
|
||||
"""Generated protocol buffer code."""
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import builder as _builder
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
from google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2
|
||||
from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x10\x63loudevent.proto\x12\ncloudevent\x1a\x19google/protobuf/any.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xa2\x04\n\nCloudEvent\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0e\n\x06source\x18\x02 \x01(\t\x12\x14\n\x0cspec_version\x18\x03 \x01(\t\x12\x0c\n\x04type\x18\x04 \x01(\t\x12:\n\nattributes\x18\x05 \x03(\x0b\x32&.cloudevent.CloudEvent.AttributesEntry\x12\x15\n\x0b\x62inary_data\x18\x06 \x01(\x0cH\x00\x12\x13\n\ttext_data\x18\x07 \x01(\tH\x00\x12*\n\nproto_data\x18\x08 \x01(\x0b\x32\x14.google.protobuf.AnyH\x00\x1a\x62\n\x0f\x41ttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12>\n\x05value\x18\x02 \x01(\x0b\x32/.cloudevent.CloudEvent.CloudEventAttributeValue:\x02\x38\x01\x1a\xd3\x01\n\x18\x43loudEventAttributeValue\x12\x14\n\nce_boolean\x18\x01 \x01(\x08H\x00\x12\x14\n\nce_integer\x18\x02 \x01(\x05H\x00\x12\x13\n\tce_string\x18\x03 \x01(\tH\x00\x12\x12\n\x08\x63\x65_bytes\x18\x04 \x01(\x0cH\x00\x12\x10\n\x06\x63\x65_uri\x18\x05 \x01(\tH\x00\x12\x14\n\nce_uri_ref\x18\x06 \x01(\tH\x00\x12\x32\n\x0c\x63\x65_timestamp\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x42\x06\n\x04\x61ttrB\x06\n\x04\x64\x61taB\t\xaa\x02\x06\x41gentsb\x06proto3')
|
||||
|
||||
_globals = globals()
|
||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'cloudevent_pb2', _globals)
|
||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
||||
_globals['DESCRIPTOR']._options = None
|
||||
_globals['DESCRIPTOR']._serialized_options = b'\252\002\006Agents'
|
||||
_globals['_CLOUDEVENT_ATTRIBUTESENTRY']._options = None
|
||||
_globals['_CLOUDEVENT_ATTRIBUTESENTRY']._serialized_options = b'8\001'
|
||||
_globals['_CLOUDEVENT']._serialized_start=93
|
||||
_globals['_CLOUDEVENT']._serialized_end=639
|
||||
_globals['_CLOUDEVENT_ATTRIBUTESENTRY']._serialized_start=319
|
||||
_globals['_CLOUDEVENT_ATTRIBUTESENTRY']._serialized_end=417
|
||||
_globals['_CLOUDEVENT_CLOUDEVENTATTRIBUTEVALUE']._serialized_start=420
|
||||
_globals['_CLOUDEVENT_CLOUDEVENTATTRIBUTEVALUE']._serialized_end=631
|
||||
# @@protoc_insertion_point(module_scope)
|
|
@ -0,0 +1,119 @@
|
|||
"""
|
||||
@generated by mypy-protobuf. Do not edit manually!
|
||||
isort:skip_file
|
||||
"""
|
||||
|
||||
import builtins
|
||||
import collections.abc
|
||||
import google.protobuf.any_pb2
|
||||
import google.protobuf.descriptor
|
||||
import google.protobuf.internal.containers
|
||||
import google.protobuf.message
|
||||
import google.protobuf.timestamp_pb2
|
||||
import typing
|
||||
|
||||
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
|
||||
|
||||
@typing.final
|
||||
class CloudEvent(google.protobuf.message.Message):
|
||||
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
||||
|
||||
@typing.final
|
||||
class AttributesEntry(google.protobuf.message.Message):
|
||||
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
||||
|
||||
KEY_FIELD_NUMBER: builtins.int
|
||||
VALUE_FIELD_NUMBER: builtins.int
|
||||
key: builtins.str
|
||||
@property
|
||||
def value(self) -> global___CloudEvent.CloudEventAttributeValue: ...
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
key: builtins.str = ...,
|
||||
value: global___CloudEvent.CloudEventAttributeValue | None = ...,
|
||||
) -> None: ...
|
||||
def HasField(self, field_name: typing.Literal["value", b"value"]) -> builtins.bool: ...
|
||||
def ClearField(self, field_name: typing.Literal["key", b"key", "value", b"value"]) -> None: ...
|
||||
|
||||
@typing.final
|
||||
class CloudEventAttributeValue(google.protobuf.message.Message):
|
||||
"""*
|
||||
The CloudEvent specification defines
|
||||
seven attribute value types...
|
||||
"""
|
||||
|
||||
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
||||
|
||||
CE_BOOLEAN_FIELD_NUMBER: builtins.int
|
||||
CE_INTEGER_FIELD_NUMBER: builtins.int
|
||||
CE_STRING_FIELD_NUMBER: builtins.int
|
||||
CE_BYTES_FIELD_NUMBER: builtins.int
|
||||
CE_URI_FIELD_NUMBER: builtins.int
|
||||
CE_URI_REF_FIELD_NUMBER: builtins.int
|
||||
CE_TIMESTAMP_FIELD_NUMBER: builtins.int
|
||||
ce_boolean: builtins.bool
|
||||
ce_integer: builtins.int
|
||||
ce_string: builtins.str
|
||||
ce_bytes: builtins.bytes
|
||||
ce_uri: builtins.str
|
||||
ce_uri_ref: builtins.str
|
||||
@property
|
||||
def ce_timestamp(self) -> google.protobuf.timestamp_pb2.Timestamp: ...
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
ce_boolean: builtins.bool = ...,
|
||||
ce_integer: builtins.int = ...,
|
||||
ce_string: builtins.str = ...,
|
||||
ce_bytes: builtins.bytes = ...,
|
||||
ce_uri: builtins.str = ...,
|
||||
ce_uri_ref: builtins.str = ...,
|
||||
ce_timestamp: google.protobuf.timestamp_pb2.Timestamp | None = ...,
|
||||
) -> None: ...
|
||||
def HasField(self, field_name: typing.Literal["attr", b"attr", "ce_boolean", b"ce_boolean", "ce_bytes", b"ce_bytes", "ce_integer", b"ce_integer", "ce_string", b"ce_string", "ce_timestamp", b"ce_timestamp", "ce_uri", b"ce_uri", "ce_uri_ref", b"ce_uri_ref"]) -> builtins.bool: ...
|
||||
def ClearField(self, field_name: typing.Literal["attr", b"attr", "ce_boolean", b"ce_boolean", "ce_bytes", b"ce_bytes", "ce_integer", b"ce_integer", "ce_string", b"ce_string", "ce_timestamp", b"ce_timestamp", "ce_uri", b"ce_uri", "ce_uri_ref", b"ce_uri_ref"]) -> None: ...
|
||||
def WhichOneof(self, oneof_group: typing.Literal["attr", b"attr"]) -> typing.Literal["ce_boolean", "ce_integer", "ce_string", "ce_bytes", "ce_uri", "ce_uri_ref", "ce_timestamp"] | None: ...
|
||||
|
||||
ID_FIELD_NUMBER: builtins.int
|
||||
SOURCE_FIELD_NUMBER: builtins.int
|
||||
SPEC_VERSION_FIELD_NUMBER: builtins.int
|
||||
TYPE_FIELD_NUMBER: builtins.int
|
||||
ATTRIBUTES_FIELD_NUMBER: builtins.int
|
||||
BINARY_DATA_FIELD_NUMBER: builtins.int
|
||||
TEXT_DATA_FIELD_NUMBER: builtins.int
|
||||
PROTO_DATA_FIELD_NUMBER: builtins.int
|
||||
id: builtins.str
|
||||
"""-- CloudEvent Context Attributes
|
||||
|
||||
Required Attributes
|
||||
"""
|
||||
source: builtins.str
|
||||
"""URI-reference"""
|
||||
spec_version: builtins.str
|
||||
type: builtins.str
|
||||
binary_data: builtins.bytes
|
||||
text_data: builtins.str
|
||||
@property
|
||||
def attributes(self) -> google.protobuf.internal.containers.MessageMap[builtins.str, global___CloudEvent.CloudEventAttributeValue]:
|
||||
"""Optional & Extension Attributes"""
|
||||
|
||||
@property
|
||||
def proto_data(self) -> google.protobuf.any_pb2.Any: ...
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
id: builtins.str = ...,
|
||||
source: builtins.str = ...,
|
||||
spec_version: builtins.str = ...,
|
||||
type: builtins.str = ...,
|
||||
attributes: collections.abc.Mapping[builtins.str, global___CloudEvent.CloudEventAttributeValue] | None = ...,
|
||||
binary_data: builtins.bytes = ...,
|
||||
text_data: builtins.str = ...,
|
||||
proto_data: google.protobuf.any_pb2.Any | None = ...,
|
||||
) -> None: ...
|
||||
def HasField(self, field_name: typing.Literal["binary_data", b"binary_data", "data", b"data", "proto_data", b"proto_data", "text_data", b"text_data"]) -> builtins.bool: ...
|
||||
def ClearField(self, field_name: typing.Literal["attributes", b"attributes", "binary_data", b"binary_data", "data", b"data", "id", b"id", "proto_data", b"proto_data", "source", b"source", "spec_version", b"spec_version", "text_data", b"text_data", "type", b"type"]) -> None: ...
|
||||
def WhichOneof(self, oneof_group: typing.Literal["data", b"data"]) -> typing.Literal["binary_data", "text_data", "proto_data"] | None: ...
|
||||
|
||||
global___CloudEvent = CloudEvent
|
|
@ -0,0 +1,4 @@
|
|||
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
||||
"""Client and server classes corresponding to protobuf-defined services."""
|
||||
import grpc
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
"""
|
||||
@generated by mypy-protobuf. Do not edit manually!
|
||||
isort:skip_file
|
||||
"""
|
||||
|
||||
import abc
|
||||
import collections.abc
|
||||
import grpc
|
||||
import grpc.aio
|
||||
import typing
|
||||
|
||||
_T = typing.TypeVar("_T")
|
||||
|
||||
class _MaybeAsyncIterator(collections.abc.AsyncIterator[_T], collections.abc.Iterator[_T], metaclass=abc.ABCMeta): ...
|
||||
|
||||
class _ServicerContext(grpc.ServicerContext, grpc.aio.ServicerContext): # type: ignore[misc, type-arg]
|
||||
...
|
|
@ -74,4 +74,4 @@ test = "python run_task_in_pkgs_if_exist.py test"
|
|||
|
||||
check = ["fmt", "lint", "pyright", "mypy", "test"]
|
||||
|
||||
gen-proto = "python -m grpc_tools.protoc --python_out=./packages/autogen-core/src/autogen_core/application/protos --grpc_python_out=./packages/autogen-core/src/autogen_core/application/protos --mypy_out=./packages/autogen-core/src/autogen_core/application/protos --mypy_grpc_out=./packages/autogen-core/src/autogen_core/application/protos --proto_path ../protos/ agent_worker.proto"
|
||||
gen-proto = "python -m grpc_tools.protoc --python_out=./packages/autogen-core/src/autogen_core/application/protos --grpc_python_out=./packages/autogen-core/src/autogen_core/application/protos --mypy_out=./packages/autogen-core/src/autogen_core/application/protos --mypy_grpc_out=./packages/autogen-core/src/autogen_core/application/protos --proto_path ../protos/ agent_worker.proto --proto_path ../protos/ cloudevent.proto"
|
||||
|
|
Loading…
Reference in New Issue