@inline-chat/hermes-agent-adapter 0.0.8-alpha.0 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5690,6 +5690,7 @@ var RpcError_Code;
5690
5690
  RpcError_Code2[RpcError_Code2["USERNAME_TAKEN"] = 16] = "USERNAME_TAKEN";
5691
5691
  RpcError_Code2[RpcError_Code2["FIRST_NAME_INVALID"] = 17] = "FIRST_NAME_INVALID";
5692
5692
  RpcError_Code2[RpcError_Code2["URL_PREVIEW_UNAVAILABLE"] = 18] = "URL_PREVIEW_UNAVAILABLE";
5693
+ RpcError_Code2[RpcError_Code2["AGENT_SESSION_MESSAGE_IMMUTABLE"] = 19] = "AGENT_SESSION_MESSAGE_IMMUTABLE";
5693
5694
  })(RpcError_Code || (RpcError_Code = {}));
5694
5695
  var SyncSkippedSequence_Reason;
5695
5696
  (function(SyncSkippedSequence_Reason2) {
@@ -5811,11 +5812,56 @@ var DialogFollowMode;
5811
5812
  DialogFollowMode2[DialogFollowMode2["FOLLOWING"] = 1] = "FOLLOWING";
5812
5813
  DialogFollowMode2[DialogFollowMode2["UNFOLLOWED"] = 2] = "UNFOLLOWED";
5813
5814
  })(DialogFollowMode || (DialogFollowMode = {}));
5815
+ var AgentSessionProvider;
5816
+ (function(AgentSessionProvider2) {
5817
+ AgentSessionProvider2[AgentSessionProvider2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
5818
+ AgentSessionProvider2[AgentSessionProvider2["CODEX"] = 1] = "CODEX";
5819
+ AgentSessionProvider2[AgentSessionProvider2["CODEX_CLOUD"] = 2] = "CODEX_CLOUD";
5820
+ AgentSessionProvider2[AgentSessionProvider2["CLAUDE"] = 3] = "CLAUDE";
5821
+ AgentSessionProvider2[AgentSessionProvider2["OPEN_CODE"] = 4] = "OPEN_CODE";
5822
+ AgentSessionProvider2[AgentSessionProvider2["AMP"] = 5] = "AMP";
5823
+ })(AgentSessionProvider || (AgentSessionProvider = {}));
5824
+ var AgentSessionMessageRole;
5825
+ (function(AgentSessionMessageRole2) {
5826
+ AgentSessionMessageRole2[AgentSessionMessageRole2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
5827
+ AgentSessionMessageRole2[AgentSessionMessageRole2["USER"] = 1] = "USER";
5828
+ AgentSessionMessageRole2[AgentSessionMessageRole2["ASSISTANT"] = 2] = "ASSISTANT";
5829
+ })(AgentSessionMessageRole || (AgentSessionMessageRole = {}));
5830
+ var AgentSessionMessageRelation;
5831
+ (function(AgentSessionMessageRelation2) {
5832
+ AgentSessionMessageRelation2[AgentSessionMessageRelation2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
5833
+ AgentSessionMessageRelation2[AgentSessionMessageRelation2["IMPORTED"] = 1] = "IMPORTED";
5834
+ AgentSessionMessageRelation2[AgentSessionMessageRelation2["LINKED"] = 2] = "LINKED";
5835
+ })(AgentSessionMessageRelation || (AgentSessionMessageRelation = {}));
5814
5836
  var MessageSendMode;
5815
5837
  (function(MessageSendMode2) {
5816
5838
  MessageSendMode2[MessageSendMode2["MODE_UNSPECIFIED"] = 0] = "MODE_UNSPECIFIED";
5817
5839
  MessageSendMode2[MessageSendMode2["MODE_SILENT"] = 1] = "MODE_SILENT";
5818
5840
  })(MessageSendMode || (MessageSendMode = {}));
5841
+ var ConnectAgentSessionState;
5842
+ (function(ConnectAgentSessionState2) {
5843
+ ConnectAgentSessionState2[ConnectAgentSessionState2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
5844
+ ConnectAgentSessionState2[ConnectAgentSessionState2["CREATED"] = 1] = "CREATED";
5845
+ ConnectAgentSessionState2[ConnectAgentSessionState2["ALREADY_CONNECTED"] = 2] = "ALREADY_CONNECTED";
5846
+ ConnectAgentSessionState2[ConnectAgentSessionState2["CONNECTED_ELSEWHERE"] = 3] = "CONNECTED_ELSEWHERE";
5847
+ })(ConnectAgentSessionState || (ConnectAgentSessionState = {}));
5848
+ var AgentSessionSyncMode;
5849
+ (function(AgentSessionSyncMode2) {
5850
+ AgentSessionSyncMode2[AgentSessionSyncMode2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
5851
+ AgentSessionSyncMode2[AgentSessionSyncMode2["HISTORY"] = 1] = "HISTORY";
5852
+ AgentSessionSyncMode2[AgentSessionSyncMode2["LIVE"] = 2] = "LIVE";
5853
+ })(AgentSessionSyncMode || (AgentSessionSyncMode = {}));
5854
+ var AgentSessionMessageSyncState;
5855
+ (function(AgentSessionMessageSyncState2) {
5856
+ AgentSessionMessageSyncState2[AgentSessionMessageSyncState2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
5857
+ AgentSessionMessageSyncState2[AgentSessionMessageSyncState2["CREATED"] = 1] = "CREATED";
5858
+ AgentSessionMessageSyncState2[AgentSessionMessageSyncState2["EDITED"] = 2] = "EDITED";
5859
+ AgentSessionMessageSyncState2[AgentSessionMessageSyncState2["LINKED"] = 3] = "LINKED";
5860
+ AgentSessionMessageSyncState2[AgentSessionMessageSyncState2["UNCHANGED"] = 4] = "UNCHANGED";
5861
+ AgentSessionMessageSyncState2[AgentSessionMessageSyncState2["STALE"] = 5] = "STALE";
5862
+ AgentSessionMessageSyncState2[AgentSessionMessageSyncState2["TOMBSTONED"] = 6] = "TOMBSTONED";
5863
+ AgentSessionMessageSyncState2[AgentSessionMessageSyncState2["CONFLICT"] = 7] = "CONFLICT";
5864
+ })(AgentSessionMessageSyncState || (AgentSessionMessageSyncState = {}));
5819
5865
  var Method;
5820
5866
  (function(Method2) {
5821
5867
  Method2[Method2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
@@ -5945,6 +5991,11 @@ var Method;
5945
5991
  Method2[Method2["UPDATE_DIALOG_FOLDER"] = 125] = "UPDATE_DIALOG_FOLDER";
5946
5992
  Method2[Method2["DELETE_DIALOG_FOLDER"] = 126] = "DELETE_DIALOG_FOLDER";
5947
5993
  Method2[Method2["GET_SPACE"] = 127] = "GET_SPACE";
5994
+ Method2[Method2["CONNECT_AGENT_SESSION"] = 128] = "CONNECT_AGENT_SESSION";
5995
+ Method2[Method2["SYNC_AGENT_SESSION_MESSAGES"] = 129] = "SYNC_AGENT_SESSION_MESSAGES";
5996
+ Method2[Method2["GET_AGENT_SESSION"] = 130] = "GET_AGENT_SESSION";
5997
+ Method2[Method2["UPDATE_BOT_AGENT"] = 131] = "UPDATE_BOT_AGENT";
5998
+ Method2[Method2["DELETE_BOT_AGENT"] = 132] = "DELETE_BOT_AGENT";
5948
5999
  })(Method || (Method = {}));
5949
6000
  var GridConnectionUnavailableReason;
5950
6001
  (function(GridConnectionUnavailableReason2) {
@@ -7741,7 +7792,9 @@ class DialogFolder$Type extends import_runtime4.MessageType {
7741
7792
  super("DialogFolder", [
7742
7793
  { no: 1, name: "id", kind: "scalar", T: 3, L: 0 },
7743
7794
  { no: 2, name: "title", kind: "scalar", opt: true, T: 9 },
7744
- { no: 3, name: "order", kind: "scalar", T: 9 }
7795
+ { no: 3, name: "order", kind: "scalar", T: 9 },
7796
+ { no: 4, name: "emoji", kind: "scalar", opt: true, T: 9 },
7797
+ { no: 5, name: "pinned_order", kind: "scalar", opt: true, T: 9 }
7745
7798
  ]);
7746
7799
  }
7747
7800
  create(value) {
@@ -7766,6 +7819,12 @@ class DialogFolder$Type extends import_runtime4.MessageType {
7766
7819
  case 3:
7767
7820
  message.order = reader.string();
7768
7821
  break;
7822
+ case 4:
7823
+ message.emoji = reader.string();
7824
+ break;
7825
+ case 5:
7826
+ message.pinnedOrder = reader.string();
7827
+ break;
7769
7828
  default:
7770
7829
  let u = options.readUnknownField;
7771
7830
  if (u === "throw")
@@ -7784,6 +7843,10 @@ class DialogFolder$Type extends import_runtime4.MessageType {
7784
7843
  writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.title);
7785
7844
  if (message.order !== "")
7786
7845
  writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.order);
7846
+ if (message.emoji !== undefined)
7847
+ writer.tag(4, import_runtime.WireType.LengthDelimited).string(message.emoji);
7848
+ if (message.pinnedOrder !== undefined)
7849
+ writer.tag(5, import_runtime.WireType.LengthDelimited).string(message.pinnedOrder);
7787
7850
  let u = options.writeUnknownFields;
7788
7851
  if (u !== false)
7789
7852
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -9484,7 +9547,8 @@ class Message$Type extends import_runtime4.MessageType {
9484
9547
  { no: 20, name: "actions", kind: "message", T: () => MessageActions },
9485
9548
  { no: 21, name: "rev", kind: "scalar", opt: true, T: 3, L: 0 },
9486
9549
  { no: 22, name: "service_message", kind: "message", T: () => MessageService },
9487
- { no: 23, name: "block_content", kind: "message", T: () => BlockContent }
9550
+ { no: 23, name: "block_content", kind: "message", T: () => BlockContent },
9551
+ { no: 24, name: "agent_session", kind: "message", T: () => AgentSessionMessageInfo }
9488
9552
  ]);
9489
9553
  }
9490
9554
  create(value) {
@@ -9575,6 +9639,9 @@ class Message$Type extends import_runtime4.MessageType {
9575
9639
  case 23:
9576
9640
  message.blockContent = BlockContent.internalBinaryRead(reader, reader.uint32(), options, message.blockContent);
9577
9641
  break;
9642
+ case 24:
9643
+ message.agentSession = AgentSessionMessageInfo.internalBinaryRead(reader, reader.uint32(), options, message.agentSession);
9644
+ break;
9578
9645
  default:
9579
9646
  let u = options.readUnknownField;
9580
9647
  if (u === "throw")
@@ -9635,6 +9702,8 @@ class Message$Type extends import_runtime4.MessageType {
9635
9702
  MessageService.internalBinaryWrite(message.serviceMessage, writer.tag(22, import_runtime.WireType.LengthDelimited).fork(), options).join();
9636
9703
  if (message.blockContent)
9637
9704
  BlockContent.internalBinaryWrite(message.blockContent, writer.tag(23, import_runtime.WireType.LengthDelimited).fork(), options).join();
9705
+ if (message.agentSession)
9706
+ AgentSessionMessageInfo.internalBinaryWrite(message.agentSession, writer.tag(24, import_runtime.WireType.LengthDelimited).fork(), options).join();
9638
9707
  let u = options.writeUnknownFields;
9639
9708
  if (u !== false)
9640
9709
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -9643,6 +9712,70 @@ class Message$Type extends import_runtime4.MessageType {
9643
9712
  }
9644
9713
  var Message = new Message$Type;
9645
9714
 
9715
+ class AgentSessionMessageInfo$Type extends import_runtime4.MessageType {
9716
+ constructor() {
9717
+ super("AgentSessionMessageInfo", [
9718
+ { no: 1, name: "agent_session_id", kind: "scalar", T: 3, L: 0 },
9719
+ { no: 2, name: "provider", kind: "enum", T: () => ["AgentSessionProvider", AgentSessionProvider, "AGENT_SESSION_PROVIDER_"] },
9720
+ { no: 3, name: "role", kind: "enum", T: () => ["AgentSessionMessageRole", AgentSessionMessageRole, "AGENT_SESSION_MESSAGE_ROLE_"] },
9721
+ { no: 4, name: "relation", kind: "enum", T: () => ["AgentSessionMessageRelation", AgentSessionMessageRelation, "AGENT_SESSION_MESSAGE_RELATION_"] }
9722
+ ]);
9723
+ }
9724
+ create(value) {
9725
+ const message = globalThis.Object.create(this.messagePrototype);
9726
+ message.agentSessionId = 0n;
9727
+ message.provider = 0;
9728
+ message.role = 0;
9729
+ message.relation = 0;
9730
+ if (value !== undefined)
9731
+ import_runtime3.reflectionMergePartial(this, message, value);
9732
+ return message;
9733
+ }
9734
+ internalBinaryRead(reader, length, options, target) {
9735
+ let message = target ?? this.create(), end = reader.pos + length;
9736
+ while (reader.pos < end) {
9737
+ let [fieldNo, wireType] = reader.tag();
9738
+ switch (fieldNo) {
9739
+ case 1:
9740
+ message.agentSessionId = reader.int64().toBigInt();
9741
+ break;
9742
+ case 2:
9743
+ message.provider = reader.int32();
9744
+ break;
9745
+ case 3:
9746
+ message.role = reader.int32();
9747
+ break;
9748
+ case 4:
9749
+ message.relation = reader.int32();
9750
+ break;
9751
+ default:
9752
+ let u = options.readUnknownField;
9753
+ if (u === "throw")
9754
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
9755
+ let d = reader.skip(wireType);
9756
+ if (u !== false)
9757
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
9758
+ }
9759
+ }
9760
+ return message;
9761
+ }
9762
+ internalBinaryWrite(message, writer, options) {
9763
+ if (message.agentSessionId !== 0n)
9764
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.agentSessionId);
9765
+ if (message.provider !== 0)
9766
+ writer.tag(2, import_runtime.WireType.Varint).int32(message.provider);
9767
+ if (message.role !== 0)
9768
+ writer.tag(3, import_runtime.WireType.Varint).int32(message.role);
9769
+ if (message.relation !== 0)
9770
+ writer.tag(4, import_runtime.WireType.Varint).int32(message.relation);
9771
+ let u = options.writeUnknownFields;
9772
+ if (u !== false)
9773
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
9774
+ return writer;
9775
+ }
9776
+ }
9777
+ var AgentSessionMessageInfo = new AgentSessionMessageInfo$Type;
9778
+
9646
9779
  class MessageFwdHeader$Type extends import_runtime4.MessageType {
9647
9780
  constructor() {
9648
9781
  super("MessageFwdHeader", [
@@ -10547,6 +10680,718 @@ class GetSpaceResult$Type extends import_runtime4.MessageType {
10547
10680
  }
10548
10681
  var GetSpaceResult = new GetSpaceResult$Type;
10549
10682
 
10683
+ class AgentSession$Type extends import_runtime4.MessageType {
10684
+ constructor() {
10685
+ super("AgentSession", [
10686
+ { no: 1, name: "id", kind: "scalar", T: 3, L: 0 },
10687
+ { no: 2, name: "peer_id", kind: "message", T: () => Peer },
10688
+ { no: 3, name: "bot_user_id", kind: "scalar", T: 3, L: 0 },
10689
+ { no: 4, name: "provider", kind: "enum", T: () => ["AgentSessionProvider", AgentSessionProvider, "AGENT_SESSION_PROVIDER_"] },
10690
+ { no: 5, name: "status_message_id", kind: "scalar", opt: true, T: 3, L: 0 }
10691
+ ]);
10692
+ }
10693
+ create(value) {
10694
+ const message = globalThis.Object.create(this.messagePrototype);
10695
+ message.id = 0n;
10696
+ message.botUserId = 0n;
10697
+ message.provider = 0;
10698
+ if (value !== undefined)
10699
+ import_runtime3.reflectionMergePartial(this, message, value);
10700
+ return message;
10701
+ }
10702
+ internalBinaryRead(reader, length, options, target) {
10703
+ let message = target ?? this.create(), end = reader.pos + length;
10704
+ while (reader.pos < end) {
10705
+ let [fieldNo, wireType] = reader.tag();
10706
+ switch (fieldNo) {
10707
+ case 1:
10708
+ message.id = reader.int64().toBigInt();
10709
+ break;
10710
+ case 2:
10711
+ message.peerId = Peer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
10712
+ break;
10713
+ case 3:
10714
+ message.botUserId = reader.int64().toBigInt();
10715
+ break;
10716
+ case 4:
10717
+ message.provider = reader.int32();
10718
+ break;
10719
+ case 5:
10720
+ message.statusMessageId = reader.int64().toBigInt();
10721
+ break;
10722
+ default:
10723
+ let u = options.readUnknownField;
10724
+ if (u === "throw")
10725
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
10726
+ let d = reader.skip(wireType);
10727
+ if (u !== false)
10728
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
10729
+ }
10730
+ }
10731
+ return message;
10732
+ }
10733
+ internalBinaryWrite(message, writer, options) {
10734
+ if (message.id !== 0n)
10735
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.id);
10736
+ if (message.peerId)
10737
+ Peer.internalBinaryWrite(message.peerId, writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
10738
+ if (message.botUserId !== 0n)
10739
+ writer.tag(3, import_runtime.WireType.Varint).int64(message.botUserId);
10740
+ if (message.provider !== 0)
10741
+ writer.tag(4, import_runtime.WireType.Varint).int32(message.provider);
10742
+ if (message.statusMessageId !== undefined)
10743
+ writer.tag(5, import_runtime.WireType.Varint).int64(message.statusMessageId);
10744
+ let u = options.writeUnknownFields;
10745
+ if (u !== false)
10746
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
10747
+ return writer;
10748
+ }
10749
+ }
10750
+ var AgentSession = new AgentSession$Type;
10751
+
10752
+ class ConnectAgentSessionInput$Type extends import_runtime4.MessageType {
10753
+ constructor() {
10754
+ super("ConnectAgentSessionInput", [
10755
+ { no: 1, name: "peer_id", kind: "message", T: () => InputPeer },
10756
+ { no: 2, name: "bot_user_id", kind: "scalar", T: 3, L: 0 },
10757
+ { no: 3, name: "provider", kind: "enum", T: () => ["AgentSessionProvider", AgentSessionProvider, "AGENT_SESSION_PROVIDER_"] },
10758
+ { no: 4, name: "instance_ref", kind: "scalar", T: 9 },
10759
+ { no: 5, name: "session_ref", kind: "scalar", T: 9 },
10760
+ { no: 6, name: "project_ref", kind: "scalar", opt: true, T: 9 },
10761
+ { no: 7, name: "status_message_id", kind: "scalar", opt: true, T: 3, L: 0 }
10762
+ ]);
10763
+ }
10764
+ create(value) {
10765
+ const message = globalThis.Object.create(this.messagePrototype);
10766
+ message.botUserId = 0n;
10767
+ message.provider = 0;
10768
+ message.instanceRef = "";
10769
+ message.sessionRef = "";
10770
+ if (value !== undefined)
10771
+ import_runtime3.reflectionMergePartial(this, message, value);
10772
+ return message;
10773
+ }
10774
+ internalBinaryRead(reader, length, options, target) {
10775
+ let message = target ?? this.create(), end = reader.pos + length;
10776
+ while (reader.pos < end) {
10777
+ let [fieldNo, wireType] = reader.tag();
10778
+ switch (fieldNo) {
10779
+ case 1:
10780
+ message.peerId = InputPeer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
10781
+ break;
10782
+ case 2:
10783
+ message.botUserId = reader.int64().toBigInt();
10784
+ break;
10785
+ case 3:
10786
+ message.provider = reader.int32();
10787
+ break;
10788
+ case 4:
10789
+ message.instanceRef = reader.string();
10790
+ break;
10791
+ case 5:
10792
+ message.sessionRef = reader.string();
10793
+ break;
10794
+ case 6:
10795
+ message.projectRef = reader.string();
10796
+ break;
10797
+ case 7:
10798
+ message.statusMessageId = reader.int64().toBigInt();
10799
+ break;
10800
+ default:
10801
+ let u = options.readUnknownField;
10802
+ if (u === "throw")
10803
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
10804
+ let d = reader.skip(wireType);
10805
+ if (u !== false)
10806
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
10807
+ }
10808
+ }
10809
+ return message;
10810
+ }
10811
+ internalBinaryWrite(message, writer, options) {
10812
+ if (message.peerId)
10813
+ InputPeer.internalBinaryWrite(message.peerId, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
10814
+ if (message.botUserId !== 0n)
10815
+ writer.tag(2, import_runtime.WireType.Varint).int64(message.botUserId);
10816
+ if (message.provider !== 0)
10817
+ writer.tag(3, import_runtime.WireType.Varint).int32(message.provider);
10818
+ if (message.instanceRef !== "")
10819
+ writer.tag(4, import_runtime.WireType.LengthDelimited).string(message.instanceRef);
10820
+ if (message.sessionRef !== "")
10821
+ writer.tag(5, import_runtime.WireType.LengthDelimited).string(message.sessionRef);
10822
+ if (message.projectRef !== undefined)
10823
+ writer.tag(6, import_runtime.WireType.LengthDelimited).string(message.projectRef);
10824
+ if (message.statusMessageId !== undefined)
10825
+ writer.tag(7, import_runtime.WireType.Varint).int64(message.statusMessageId);
10826
+ let u = options.writeUnknownFields;
10827
+ if (u !== false)
10828
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
10829
+ return writer;
10830
+ }
10831
+ }
10832
+ var ConnectAgentSessionInput = new ConnectAgentSessionInput$Type;
10833
+
10834
+ class ConnectAgentSessionResult$Type extends import_runtime4.MessageType {
10835
+ constructor() {
10836
+ super("ConnectAgentSessionResult", [
10837
+ { no: 1, name: "agent_session", kind: "message", T: () => AgentSession },
10838
+ { no: 2, name: "state", kind: "enum", T: () => ["ConnectAgentSessionState", ConnectAgentSessionState, "CONNECT_AGENT_SESSION_STATE_"] }
10839
+ ]);
10840
+ }
10841
+ create(value) {
10842
+ const message = globalThis.Object.create(this.messagePrototype);
10843
+ message.state = 0;
10844
+ if (value !== undefined)
10845
+ import_runtime3.reflectionMergePartial(this, message, value);
10846
+ return message;
10847
+ }
10848
+ internalBinaryRead(reader, length, options, target) {
10849
+ let message = target ?? this.create(), end = reader.pos + length;
10850
+ while (reader.pos < end) {
10851
+ let [fieldNo, wireType] = reader.tag();
10852
+ switch (fieldNo) {
10853
+ case 1:
10854
+ message.agentSession = AgentSession.internalBinaryRead(reader, reader.uint32(), options, message.agentSession);
10855
+ break;
10856
+ case 2:
10857
+ message.state = reader.int32();
10858
+ break;
10859
+ default:
10860
+ let u = options.readUnknownField;
10861
+ if (u === "throw")
10862
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
10863
+ let d = reader.skip(wireType);
10864
+ if (u !== false)
10865
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
10866
+ }
10867
+ }
10868
+ return message;
10869
+ }
10870
+ internalBinaryWrite(message, writer, options) {
10871
+ if (message.agentSession)
10872
+ AgentSession.internalBinaryWrite(message.agentSession, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
10873
+ if (message.state !== 0)
10874
+ writer.tag(2, import_runtime.WireType.Varint).int32(message.state);
10875
+ let u = options.writeUnknownFields;
10876
+ if (u !== false)
10877
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
10878
+ return writer;
10879
+ }
10880
+ }
10881
+ var ConnectAgentSessionResult = new ConnectAgentSessionResult$Type;
10882
+
10883
+ class AgentSessionConnection$Type extends import_runtime4.MessageType {
10884
+ constructor() {
10885
+ super("AgentSessionConnection", [
10886
+ { no: 1, name: "agent_session", kind: "message", T: () => AgentSession },
10887
+ { no: 2, name: "instance_ref", kind: "scalar", T: 9 },
10888
+ { no: 3, name: "session_ref", kind: "scalar", T: 9 },
10889
+ { no: 4, name: "project_ref", kind: "scalar", opt: true, T: 9 }
10890
+ ]);
10891
+ }
10892
+ create(value) {
10893
+ const message = globalThis.Object.create(this.messagePrototype);
10894
+ message.instanceRef = "";
10895
+ message.sessionRef = "";
10896
+ if (value !== undefined)
10897
+ import_runtime3.reflectionMergePartial(this, message, value);
10898
+ return message;
10899
+ }
10900
+ internalBinaryRead(reader, length, options, target) {
10901
+ let message = target ?? this.create(), end = reader.pos + length;
10902
+ while (reader.pos < end) {
10903
+ let [fieldNo, wireType] = reader.tag();
10904
+ switch (fieldNo) {
10905
+ case 1:
10906
+ message.agentSession = AgentSession.internalBinaryRead(reader, reader.uint32(), options, message.agentSession);
10907
+ break;
10908
+ case 2:
10909
+ message.instanceRef = reader.string();
10910
+ break;
10911
+ case 3:
10912
+ message.sessionRef = reader.string();
10913
+ break;
10914
+ case 4:
10915
+ message.projectRef = reader.string();
10916
+ break;
10917
+ default:
10918
+ let u = options.readUnknownField;
10919
+ if (u === "throw")
10920
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
10921
+ let d = reader.skip(wireType);
10922
+ if (u !== false)
10923
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
10924
+ }
10925
+ }
10926
+ return message;
10927
+ }
10928
+ internalBinaryWrite(message, writer, options) {
10929
+ if (message.agentSession)
10930
+ AgentSession.internalBinaryWrite(message.agentSession, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
10931
+ if (message.instanceRef !== "")
10932
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.instanceRef);
10933
+ if (message.sessionRef !== "")
10934
+ writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.sessionRef);
10935
+ if (message.projectRef !== undefined)
10936
+ writer.tag(4, import_runtime.WireType.LengthDelimited).string(message.projectRef);
10937
+ let u = options.writeUnknownFields;
10938
+ if (u !== false)
10939
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
10940
+ return writer;
10941
+ }
10942
+ }
10943
+ var AgentSessionConnection = new AgentSessionConnection$Type;
10944
+
10945
+ class GetAgentSessionInput$Type extends import_runtime4.MessageType {
10946
+ constructor() {
10947
+ super("GetAgentSessionInput", [
10948
+ { no: 1, name: "peer_id", kind: "message", T: () => InputPeer },
10949
+ { no: 2, name: "bot_user_id", kind: "scalar", T: 3, L: 0 }
10950
+ ]);
10951
+ }
10952
+ create(value) {
10953
+ const message = globalThis.Object.create(this.messagePrototype);
10954
+ message.botUserId = 0n;
10955
+ if (value !== undefined)
10956
+ import_runtime3.reflectionMergePartial(this, message, value);
10957
+ return message;
10958
+ }
10959
+ internalBinaryRead(reader, length, options, target) {
10960
+ let message = target ?? this.create(), end = reader.pos + length;
10961
+ while (reader.pos < end) {
10962
+ let [fieldNo, wireType] = reader.tag();
10963
+ switch (fieldNo) {
10964
+ case 1:
10965
+ message.peerId = InputPeer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
10966
+ break;
10967
+ case 2:
10968
+ message.botUserId = reader.int64().toBigInt();
10969
+ break;
10970
+ default:
10971
+ let u = options.readUnknownField;
10972
+ if (u === "throw")
10973
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
10974
+ let d = reader.skip(wireType);
10975
+ if (u !== false)
10976
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
10977
+ }
10978
+ }
10979
+ return message;
10980
+ }
10981
+ internalBinaryWrite(message, writer, options) {
10982
+ if (message.peerId)
10983
+ InputPeer.internalBinaryWrite(message.peerId, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
10984
+ if (message.botUserId !== 0n)
10985
+ writer.tag(2, import_runtime.WireType.Varint).int64(message.botUserId);
10986
+ let u = options.writeUnknownFields;
10987
+ if (u !== false)
10988
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
10989
+ return writer;
10990
+ }
10991
+ }
10992
+ var GetAgentSessionInput = new GetAgentSessionInput$Type;
10993
+
10994
+ class GetAgentSessionResult$Type extends import_runtime4.MessageType {
10995
+ constructor() {
10996
+ super("GetAgentSessionResult", [
10997
+ { no: 1, name: "connection", kind: "message", T: () => AgentSessionConnection }
10998
+ ]);
10999
+ }
11000
+ create(value) {
11001
+ const message = globalThis.Object.create(this.messagePrototype);
11002
+ if (value !== undefined)
11003
+ import_runtime3.reflectionMergePartial(this, message, value);
11004
+ return message;
11005
+ }
11006
+ internalBinaryRead(reader, length, options, target) {
11007
+ let message = target ?? this.create(), end = reader.pos + length;
11008
+ while (reader.pos < end) {
11009
+ let [fieldNo, wireType] = reader.tag();
11010
+ switch (fieldNo) {
11011
+ case 1:
11012
+ message.connection = AgentSessionConnection.internalBinaryRead(reader, reader.uint32(), options, message.connection);
11013
+ break;
11014
+ default:
11015
+ let u = options.readUnknownField;
11016
+ if (u === "throw")
11017
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
11018
+ let d = reader.skip(wireType);
11019
+ if (u !== false)
11020
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
11021
+ }
11022
+ }
11023
+ return message;
11024
+ }
11025
+ internalBinaryWrite(message, writer, options) {
11026
+ if (message.connection)
11027
+ AgentSessionConnection.internalBinaryWrite(message.connection, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
11028
+ let u = options.writeUnknownFields;
11029
+ if (u !== false)
11030
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
11031
+ return writer;
11032
+ }
11033
+ }
11034
+ var GetAgentSessionResult = new GetAgentSessionResult$Type;
11035
+
11036
+ class AgentSessionMessageUpsert$Type extends import_runtime4.MessageType {
11037
+ constructor() {
11038
+ super("AgentSessionMessageUpsert", [
11039
+ { no: 1, name: "text", kind: "scalar", T: 9 },
11040
+ { no: 2, name: "entities", kind: "message", T: () => MessageEntities },
11041
+ { no: 3, name: "assistant_random_id", kind: "scalar", opt: true, T: 3, L: 0 }
11042
+ ]);
11043
+ }
11044
+ create(value) {
11045
+ const message = globalThis.Object.create(this.messagePrototype);
11046
+ message.text = "";
11047
+ if (value !== undefined)
11048
+ import_runtime3.reflectionMergePartial(this, message, value);
11049
+ return message;
11050
+ }
11051
+ internalBinaryRead(reader, length, options, target) {
11052
+ let message = target ?? this.create(), end = reader.pos + length;
11053
+ while (reader.pos < end) {
11054
+ let [fieldNo, wireType] = reader.tag();
11055
+ switch (fieldNo) {
11056
+ case 1:
11057
+ message.text = reader.string();
11058
+ break;
11059
+ case 2:
11060
+ message.entities = MessageEntities.internalBinaryRead(reader, reader.uint32(), options, message.entities);
11061
+ break;
11062
+ case 3:
11063
+ message.assistantRandomId = reader.int64().toBigInt();
11064
+ break;
11065
+ default:
11066
+ let u = options.readUnknownField;
11067
+ if (u === "throw")
11068
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
11069
+ let d = reader.skip(wireType);
11070
+ if (u !== false)
11071
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
11072
+ }
11073
+ }
11074
+ return message;
11075
+ }
11076
+ internalBinaryWrite(message, writer, options) {
11077
+ if (message.text !== "")
11078
+ writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.text);
11079
+ if (message.entities)
11080
+ MessageEntities.internalBinaryWrite(message.entities, writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
11081
+ if (message.assistantRandomId !== undefined)
11082
+ writer.tag(3, import_runtime.WireType.Varint).int64(message.assistantRandomId);
11083
+ let u = options.writeUnknownFields;
11084
+ if (u !== false)
11085
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
11086
+ return writer;
11087
+ }
11088
+ }
11089
+ var AgentSessionMessageUpsert = new AgentSessionMessageUpsert$Type;
11090
+
11091
+ class AgentSessionMessageLink$Type extends import_runtime4.MessageType {
11092
+ constructor() {
11093
+ super("AgentSessionMessageLink", [
11094
+ { no: 1, name: "message_id", kind: "scalar", T: 3, L: 0 }
11095
+ ]);
11096
+ }
11097
+ create(value) {
11098
+ const message = globalThis.Object.create(this.messagePrototype);
11099
+ message.messageId = 0n;
11100
+ if (value !== undefined)
11101
+ import_runtime3.reflectionMergePartial(this, message, value);
11102
+ return message;
11103
+ }
11104
+ internalBinaryRead(reader, length, options, target) {
11105
+ let message = target ?? this.create(), end = reader.pos + length;
11106
+ while (reader.pos < end) {
11107
+ let [fieldNo, wireType] = reader.tag();
11108
+ switch (fieldNo) {
11109
+ case 1:
11110
+ message.messageId = reader.int64().toBigInt();
11111
+ break;
11112
+ default:
11113
+ let u = options.readUnknownField;
11114
+ if (u === "throw")
11115
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
11116
+ let d = reader.skip(wireType);
11117
+ if (u !== false)
11118
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
11119
+ }
11120
+ }
11121
+ return message;
11122
+ }
11123
+ internalBinaryWrite(message, writer, options) {
11124
+ if (message.messageId !== 0n)
11125
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.messageId);
11126
+ let u = options.writeUnknownFields;
11127
+ if (u !== false)
11128
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
11129
+ return writer;
11130
+ }
11131
+ }
11132
+ var AgentSessionMessageLink = new AgentSessionMessageLink$Type;
11133
+
11134
+ class AgentSessionMessageSync$Type extends import_runtime4.MessageType {
11135
+ constructor() {
11136
+ super("AgentSessionMessageSync", [
11137
+ { no: 1, name: "role", kind: "enum", T: () => ["AgentSessionMessageRole", AgentSessionMessageRole, "AGENT_SESSION_MESSAGE_ROLE_"] },
11138
+ { no: 2, name: "item_ref", kind: "scalar", opt: true, T: 9 },
11139
+ { no: 3, name: "correlation_ref", kind: "scalar", opt: true, T: 9 },
11140
+ { no: 4, name: "source_date", kind: "scalar", opt: true, T: 3, L: 0 },
11141
+ { no: 5, name: "revision_ref", kind: "scalar", opt: true, T: 9 },
11142
+ { no: 6, name: "base_revision_ref", kind: "scalar", opt: true, T: 9 },
11143
+ { no: 7, name: "complete", kind: "scalar", T: 8 },
11144
+ { no: 8, name: "upsert", kind: "message", oneof: "operation", T: () => AgentSessionMessageUpsert },
11145
+ { no: 9, name: "link", kind: "message", oneof: "operation", T: () => AgentSessionMessageLink }
11146
+ ]);
11147
+ }
11148
+ create(value) {
11149
+ const message = globalThis.Object.create(this.messagePrototype);
11150
+ message.role = 0;
11151
+ message.complete = false;
11152
+ message.operation = { oneofKind: undefined };
11153
+ if (value !== undefined)
11154
+ import_runtime3.reflectionMergePartial(this, message, value);
11155
+ return message;
11156
+ }
11157
+ internalBinaryRead(reader, length, options, target) {
11158
+ let message = target ?? this.create(), end = reader.pos + length;
11159
+ while (reader.pos < end) {
11160
+ let [fieldNo, wireType] = reader.tag();
11161
+ switch (fieldNo) {
11162
+ case 1:
11163
+ message.role = reader.int32();
11164
+ break;
11165
+ case 2:
11166
+ message.itemRef = reader.string();
11167
+ break;
11168
+ case 3:
11169
+ message.correlationRef = reader.string();
11170
+ break;
11171
+ case 4:
11172
+ message.sourceDate = reader.int64().toBigInt();
11173
+ break;
11174
+ case 5:
11175
+ message.revisionRef = reader.string();
11176
+ break;
11177
+ case 6:
11178
+ message.baseRevisionRef = reader.string();
11179
+ break;
11180
+ case 7:
11181
+ message.complete = reader.bool();
11182
+ break;
11183
+ case 8:
11184
+ message.operation = {
11185
+ oneofKind: "upsert",
11186
+ upsert: AgentSessionMessageUpsert.internalBinaryRead(reader, reader.uint32(), options, message.operation.upsert)
11187
+ };
11188
+ break;
11189
+ case 9:
11190
+ message.operation = {
11191
+ oneofKind: "link",
11192
+ link: AgentSessionMessageLink.internalBinaryRead(reader, reader.uint32(), options, message.operation.link)
11193
+ };
11194
+ break;
11195
+ default:
11196
+ let u = options.readUnknownField;
11197
+ if (u === "throw")
11198
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
11199
+ let d = reader.skip(wireType);
11200
+ if (u !== false)
11201
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
11202
+ }
11203
+ }
11204
+ return message;
11205
+ }
11206
+ internalBinaryWrite(message, writer, options) {
11207
+ if (message.role !== 0)
11208
+ writer.tag(1, import_runtime.WireType.Varint).int32(message.role);
11209
+ if (message.itemRef !== undefined)
11210
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.itemRef);
11211
+ if (message.correlationRef !== undefined)
11212
+ writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.correlationRef);
11213
+ if (message.sourceDate !== undefined)
11214
+ writer.tag(4, import_runtime.WireType.Varint).int64(message.sourceDate);
11215
+ if (message.revisionRef !== undefined)
11216
+ writer.tag(5, import_runtime.WireType.LengthDelimited).string(message.revisionRef);
11217
+ if (message.baseRevisionRef !== undefined)
11218
+ writer.tag(6, import_runtime.WireType.LengthDelimited).string(message.baseRevisionRef);
11219
+ if (message.complete !== false)
11220
+ writer.tag(7, import_runtime.WireType.Varint).bool(message.complete);
11221
+ if (message.operation.oneofKind === "upsert")
11222
+ AgentSessionMessageUpsert.internalBinaryWrite(message.operation.upsert, writer.tag(8, import_runtime.WireType.LengthDelimited).fork(), options).join();
11223
+ if (message.operation.oneofKind === "link")
11224
+ AgentSessionMessageLink.internalBinaryWrite(message.operation.link, writer.tag(9, import_runtime.WireType.LengthDelimited).fork(), options).join();
11225
+ let u = options.writeUnknownFields;
11226
+ if (u !== false)
11227
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
11228
+ return writer;
11229
+ }
11230
+ }
11231
+ var AgentSessionMessageSync = new AgentSessionMessageSync$Type;
11232
+
11233
+ class SyncAgentSessionMessagesInput$Type extends import_runtime4.MessageType {
11234
+ constructor() {
11235
+ super("SyncAgentSessionMessagesInput", [
11236
+ { no: 1, name: "agent_session_id", kind: "scalar", T: 3, L: 0 },
11237
+ { no: 2, name: "mode", kind: "enum", T: () => ["AgentSessionSyncMode", AgentSessionSyncMode, "AGENT_SESSION_SYNC_MODE_"] },
11238
+ { no: 3, name: "messages", kind: "message", repeat: 1, T: () => AgentSessionMessageSync }
11239
+ ]);
11240
+ }
11241
+ create(value) {
11242
+ const message = globalThis.Object.create(this.messagePrototype);
11243
+ message.agentSessionId = 0n;
11244
+ message.mode = 0;
11245
+ message.messages = [];
11246
+ if (value !== undefined)
11247
+ import_runtime3.reflectionMergePartial(this, message, value);
11248
+ return message;
11249
+ }
11250
+ internalBinaryRead(reader, length, options, target) {
11251
+ let message = target ?? this.create(), end = reader.pos + length;
11252
+ while (reader.pos < end) {
11253
+ let [fieldNo, wireType] = reader.tag();
11254
+ switch (fieldNo) {
11255
+ case 1:
11256
+ message.agentSessionId = reader.int64().toBigInt();
11257
+ break;
11258
+ case 2:
11259
+ message.mode = reader.int32();
11260
+ break;
11261
+ case 3:
11262
+ message.messages.push(AgentSessionMessageSync.internalBinaryRead(reader, reader.uint32(), options));
11263
+ break;
11264
+ default:
11265
+ let u = options.readUnknownField;
11266
+ if (u === "throw")
11267
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
11268
+ let d = reader.skip(wireType);
11269
+ if (u !== false)
11270
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
11271
+ }
11272
+ }
11273
+ return message;
11274
+ }
11275
+ internalBinaryWrite(message, writer, options) {
11276
+ if (message.agentSessionId !== 0n)
11277
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.agentSessionId);
11278
+ if (message.mode !== 0)
11279
+ writer.tag(2, import_runtime.WireType.Varint).int32(message.mode);
11280
+ for (let i = 0;i < message.messages.length; i++)
11281
+ AgentSessionMessageSync.internalBinaryWrite(message.messages[i], writer.tag(3, import_runtime.WireType.LengthDelimited).fork(), options).join();
11282
+ let u = options.writeUnknownFields;
11283
+ if (u !== false)
11284
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
11285
+ return writer;
11286
+ }
11287
+ }
11288
+ var SyncAgentSessionMessagesInput = new SyncAgentSessionMessagesInput$Type;
11289
+
11290
+ class AgentSessionMessageSyncResult$Type extends import_runtime4.MessageType {
11291
+ constructor() {
11292
+ super("AgentSessionMessageSyncResult", [
11293
+ { no: 1, name: "index", kind: "scalar", T: 5 },
11294
+ { no: 2, name: "state", kind: "enum", T: () => ["AgentSessionMessageSyncState", AgentSessionMessageSyncState, "AGENT_SESSION_MESSAGE_SYNC_STATE_"] },
11295
+ { no: 3, name: "message_id", kind: "scalar", opt: true, T: 3, L: 0 },
11296
+ { no: 4, name: "current_revision_ref", kind: "scalar", opt: true, T: 9 }
11297
+ ]);
11298
+ }
11299
+ create(value) {
11300
+ const message = globalThis.Object.create(this.messagePrototype);
11301
+ message.index = 0;
11302
+ message.state = 0;
11303
+ if (value !== undefined)
11304
+ import_runtime3.reflectionMergePartial(this, message, value);
11305
+ return message;
11306
+ }
11307
+ internalBinaryRead(reader, length, options, target) {
11308
+ let message = target ?? this.create(), end = reader.pos + length;
11309
+ while (reader.pos < end) {
11310
+ let [fieldNo, wireType] = reader.tag();
11311
+ switch (fieldNo) {
11312
+ case 1:
11313
+ message.index = reader.int32();
11314
+ break;
11315
+ case 2:
11316
+ message.state = reader.int32();
11317
+ break;
11318
+ case 3:
11319
+ message.messageId = reader.int64().toBigInt();
11320
+ break;
11321
+ case 4:
11322
+ message.currentRevisionRef = reader.string();
11323
+ break;
11324
+ default:
11325
+ let u = options.readUnknownField;
11326
+ if (u === "throw")
11327
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
11328
+ let d = reader.skip(wireType);
11329
+ if (u !== false)
11330
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
11331
+ }
11332
+ }
11333
+ return message;
11334
+ }
11335
+ internalBinaryWrite(message, writer, options) {
11336
+ if (message.index !== 0)
11337
+ writer.tag(1, import_runtime.WireType.Varint).int32(message.index);
11338
+ if (message.state !== 0)
11339
+ writer.tag(2, import_runtime.WireType.Varint).int32(message.state);
11340
+ if (message.messageId !== undefined)
11341
+ writer.tag(3, import_runtime.WireType.Varint).int64(message.messageId);
11342
+ if (message.currentRevisionRef !== undefined)
11343
+ writer.tag(4, import_runtime.WireType.LengthDelimited).string(message.currentRevisionRef);
11344
+ let u = options.writeUnknownFields;
11345
+ if (u !== false)
11346
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
11347
+ return writer;
11348
+ }
11349
+ }
11350
+ var AgentSessionMessageSyncResult = new AgentSessionMessageSyncResult$Type;
11351
+
11352
+ class SyncAgentSessionMessagesResult$Type extends import_runtime4.MessageType {
11353
+ constructor() {
11354
+ super("SyncAgentSessionMessagesResult", [
11355
+ { no: 1, name: "messages", kind: "message", repeat: 1, T: () => AgentSessionMessageSyncResult }
11356
+ ]);
11357
+ }
11358
+ create(value) {
11359
+ const message = globalThis.Object.create(this.messagePrototype);
11360
+ message.messages = [];
11361
+ if (value !== undefined)
11362
+ import_runtime3.reflectionMergePartial(this, message, value);
11363
+ return message;
11364
+ }
11365
+ internalBinaryRead(reader, length, options, target) {
11366
+ let message = target ?? this.create(), end = reader.pos + length;
11367
+ while (reader.pos < end) {
11368
+ let [fieldNo, wireType] = reader.tag();
11369
+ switch (fieldNo) {
11370
+ case 1:
11371
+ message.messages.push(AgentSessionMessageSyncResult.internalBinaryRead(reader, reader.uint32(), options));
11372
+ break;
11373
+ default:
11374
+ let u = options.readUnknownField;
11375
+ if (u === "throw")
11376
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
11377
+ let d = reader.skip(wireType);
11378
+ if (u !== false)
11379
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
11380
+ }
11381
+ }
11382
+ return message;
11383
+ }
11384
+ internalBinaryWrite(message, writer, options) {
11385
+ for (let i = 0;i < message.messages.length; i++)
11386
+ AgentSessionMessageSyncResult.internalBinaryWrite(message.messages[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
11387
+ let u = options.writeUnknownFields;
11388
+ if (u !== false)
11389
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
11390
+ return writer;
11391
+ }
11392
+ }
11393
+ var SyncAgentSessionMessagesResult = new SyncAgentSessionMessagesResult$Type;
11394
+
10550
11395
  class JoinPublicSpaceInput$Type extends import_runtime4.MessageType {
10551
11396
  constructor() {
10552
11397
  super("JoinPublicSpaceInput", [
@@ -12419,7 +13264,12 @@ class RpcCall$Type extends import_runtime4.MessageType {
12419
13264
  { no: 125, name: "createDialogFolder", kind: "message", oneof: "input", T: () => CreateDialogFolderInput },
12420
13265
  { no: 126, name: "updateDialogFolder", kind: "message", oneof: "input", T: () => UpdateDialogFolderInput },
12421
13266
  { no: 127, name: "deleteDialogFolder", kind: "message", oneof: "input", T: () => DeleteDialogFolderInput },
12422
- { no: 128, name: "getSpace", kind: "message", oneof: "input", T: () => GetSpaceInput }
13267
+ { no: 128, name: "getSpace", kind: "message", oneof: "input", T: () => GetSpaceInput },
13268
+ { no: 129, name: "connectAgentSession", kind: "message", oneof: "input", T: () => ConnectAgentSessionInput },
13269
+ { no: 130, name: "syncAgentSessionMessages", kind: "message", oneof: "input", T: () => SyncAgentSessionMessagesInput },
13270
+ { no: 131, name: "getAgentSession", kind: "message", oneof: "input", T: () => GetAgentSessionInput },
13271
+ { no: 132, name: "updateBotAgent", kind: "message", oneof: "input", T: () => UpdateBotAgentInput },
13272
+ { no: 133, name: "deleteBotAgent", kind: "message", oneof: "input", T: () => DeleteBotAgentInput }
12423
13273
  ]);
12424
13274
  }
12425
13275
  create(value) {
@@ -13194,6 +14044,36 @@ class RpcCall$Type extends import_runtime4.MessageType {
13194
14044
  getSpace: GetSpaceInput.internalBinaryRead(reader, reader.uint32(), options, message.input.getSpace)
13195
14045
  };
13196
14046
  break;
14047
+ case 129:
14048
+ message.input = {
14049
+ oneofKind: "connectAgentSession",
14050
+ connectAgentSession: ConnectAgentSessionInput.internalBinaryRead(reader, reader.uint32(), options, message.input.connectAgentSession)
14051
+ };
14052
+ break;
14053
+ case 130:
14054
+ message.input = {
14055
+ oneofKind: "syncAgentSessionMessages",
14056
+ syncAgentSessionMessages: SyncAgentSessionMessagesInput.internalBinaryRead(reader, reader.uint32(), options, message.input.syncAgentSessionMessages)
14057
+ };
14058
+ break;
14059
+ case 131:
14060
+ message.input = {
14061
+ oneofKind: "getAgentSession",
14062
+ getAgentSession: GetAgentSessionInput.internalBinaryRead(reader, reader.uint32(), options, message.input.getAgentSession)
14063
+ };
14064
+ break;
14065
+ case 132:
14066
+ message.input = {
14067
+ oneofKind: "updateBotAgent",
14068
+ updateBotAgent: UpdateBotAgentInput.internalBinaryRead(reader, reader.uint32(), options, message.input.updateBotAgent)
14069
+ };
14070
+ break;
14071
+ case 133:
14072
+ message.input = {
14073
+ oneofKind: "deleteBotAgent",
14074
+ deleteBotAgent: DeleteBotAgentInput.internalBinaryRead(reader, reader.uint32(), options, message.input.deleteBotAgent)
14075
+ };
14076
+ break;
13197
14077
  default:
13198
14078
  let u = options.readUnknownField;
13199
14079
  if (u === "throw")
@@ -13460,6 +14340,16 @@ class RpcCall$Type extends import_runtime4.MessageType {
13460
14340
  DeleteDialogFolderInput.internalBinaryWrite(message.input.deleteDialogFolder, writer.tag(127, import_runtime.WireType.LengthDelimited).fork(), options).join();
13461
14341
  if (message.input.oneofKind === "getSpace")
13462
14342
  GetSpaceInput.internalBinaryWrite(message.input.getSpace, writer.tag(128, import_runtime.WireType.LengthDelimited).fork(), options).join();
14343
+ if (message.input.oneofKind === "connectAgentSession")
14344
+ ConnectAgentSessionInput.internalBinaryWrite(message.input.connectAgentSession, writer.tag(129, import_runtime.WireType.LengthDelimited).fork(), options).join();
14345
+ if (message.input.oneofKind === "syncAgentSessionMessages")
14346
+ SyncAgentSessionMessagesInput.internalBinaryWrite(message.input.syncAgentSessionMessages, writer.tag(130, import_runtime.WireType.LengthDelimited).fork(), options).join();
14347
+ if (message.input.oneofKind === "getAgentSession")
14348
+ GetAgentSessionInput.internalBinaryWrite(message.input.getAgentSession, writer.tag(131, import_runtime.WireType.LengthDelimited).fork(), options).join();
14349
+ if (message.input.oneofKind === "updateBotAgent")
14350
+ UpdateBotAgentInput.internalBinaryWrite(message.input.updateBotAgent, writer.tag(132, import_runtime.WireType.LengthDelimited).fork(), options).join();
14351
+ if (message.input.oneofKind === "deleteBotAgent")
14352
+ DeleteBotAgentInput.internalBinaryWrite(message.input.deleteBotAgent, writer.tag(133, import_runtime.WireType.LengthDelimited).fork(), options).join();
13463
14353
  let u = options.writeUnknownFields;
13464
14354
  if (u !== false)
13465
14355
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -13597,7 +14487,12 @@ class RpcResult$Type extends import_runtime4.MessageType {
13597
14487
  { no: 125, name: "createDialogFolder", kind: "message", oneof: "result", T: () => CreateDialogFolderResult },
13598
14488
  { no: 126, name: "updateDialogFolder", kind: "message", oneof: "result", T: () => UpdateDialogFolderResult },
13599
14489
  { no: 127, name: "deleteDialogFolder", kind: "message", oneof: "result", T: () => DeleteDialogFolderResult },
13600
- { no: 128, name: "getSpace", kind: "message", oneof: "result", T: () => GetSpaceResult }
14490
+ { no: 128, name: "getSpace", kind: "message", oneof: "result", T: () => GetSpaceResult },
14491
+ { no: 129, name: "connectAgentSession", kind: "message", oneof: "result", T: () => ConnectAgentSessionResult },
14492
+ { no: 130, name: "syncAgentSessionMessages", kind: "message", oneof: "result", T: () => SyncAgentSessionMessagesResult },
14493
+ { no: 131, name: "getAgentSession", kind: "message", oneof: "result", T: () => GetAgentSessionResult },
14494
+ { no: 132, name: "updateBotAgent", kind: "message", oneof: "result", T: () => UpdateBotAgentResult },
14495
+ { no: 133, name: "deleteBotAgent", kind: "message", oneof: "result", T: () => DeleteBotAgentResult }
13601
14496
  ]);
13602
14497
  }
13603
14498
  create(value) {
@@ -14372,6 +15267,36 @@ class RpcResult$Type extends import_runtime4.MessageType {
14372
15267
  getSpace: GetSpaceResult.internalBinaryRead(reader, reader.uint32(), options, message.result.getSpace)
14373
15268
  };
14374
15269
  break;
15270
+ case 129:
15271
+ message.result = {
15272
+ oneofKind: "connectAgentSession",
15273
+ connectAgentSession: ConnectAgentSessionResult.internalBinaryRead(reader, reader.uint32(), options, message.result.connectAgentSession)
15274
+ };
15275
+ break;
15276
+ case 130:
15277
+ message.result = {
15278
+ oneofKind: "syncAgentSessionMessages",
15279
+ syncAgentSessionMessages: SyncAgentSessionMessagesResult.internalBinaryRead(reader, reader.uint32(), options, message.result.syncAgentSessionMessages)
15280
+ };
15281
+ break;
15282
+ case 131:
15283
+ message.result = {
15284
+ oneofKind: "getAgentSession",
15285
+ getAgentSession: GetAgentSessionResult.internalBinaryRead(reader, reader.uint32(), options, message.result.getAgentSession)
15286
+ };
15287
+ break;
15288
+ case 132:
15289
+ message.result = {
15290
+ oneofKind: "updateBotAgent",
15291
+ updateBotAgent: UpdateBotAgentResult.internalBinaryRead(reader, reader.uint32(), options, message.result.updateBotAgent)
15292
+ };
15293
+ break;
15294
+ case 133:
15295
+ message.result = {
15296
+ oneofKind: "deleteBotAgent",
15297
+ deleteBotAgent: DeleteBotAgentResult.internalBinaryRead(reader, reader.uint32(), options, message.result.deleteBotAgent)
15298
+ };
15299
+ break;
14375
15300
  default:
14376
15301
  let u = options.readUnknownField;
14377
15302
  if (u === "throw")
@@ -14638,6 +15563,16 @@ class RpcResult$Type extends import_runtime4.MessageType {
14638
15563
  DeleteDialogFolderResult.internalBinaryWrite(message.result.deleteDialogFolder, writer.tag(127, import_runtime.WireType.LengthDelimited).fork(), options).join();
14639
15564
  if (message.result.oneofKind === "getSpace")
14640
15565
  GetSpaceResult.internalBinaryWrite(message.result.getSpace, writer.tag(128, import_runtime.WireType.LengthDelimited).fork(), options).join();
15566
+ if (message.result.oneofKind === "connectAgentSession")
15567
+ ConnectAgentSessionResult.internalBinaryWrite(message.result.connectAgentSession, writer.tag(129, import_runtime.WireType.LengthDelimited).fork(), options).join();
15568
+ if (message.result.oneofKind === "syncAgentSessionMessages")
15569
+ SyncAgentSessionMessagesResult.internalBinaryWrite(message.result.syncAgentSessionMessages, writer.tag(130, import_runtime.WireType.LengthDelimited).fork(), options).join();
15570
+ if (message.result.oneofKind === "getAgentSession")
15571
+ GetAgentSessionResult.internalBinaryWrite(message.result.getAgentSession, writer.tag(131, import_runtime.WireType.LengthDelimited).fork(), options).join();
15572
+ if (message.result.oneofKind === "updateBotAgent")
15573
+ UpdateBotAgentResult.internalBinaryWrite(message.result.updateBotAgent, writer.tag(132, import_runtime.WireType.LengthDelimited).fork(), options).join();
15574
+ if (message.result.oneofKind === "deleteBotAgent")
15575
+ DeleteBotAgentResult.internalBinaryWrite(message.result.deleteBotAgent, writer.tag(133, import_runtime.WireType.LengthDelimited).fork(), options).join();
14641
15576
  let u = options.writeUnknownFields;
14642
15577
  if (u !== false)
14643
15578
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -16105,7 +17040,8 @@ var GetGridHomeResult = new GetGridHomeResult$Type;
16105
17040
  class CreateGridRoomInput$Type extends import_runtime4.MessageType {
16106
17041
  constructor() {
16107
17042
  super("CreateGridRoomInput", [
16108
- { no: 1, name: "space_id", kind: "scalar", T: 3, L: 0 }
17043
+ { no: 1, name: "space_id", kind: "scalar", T: 3, L: 0 },
17044
+ { no: 2, name: "microphone_enabled", kind: "scalar", opt: true, T: 8 }
16109
17045
  ]);
16110
17046
  }
16111
17047
  create(value) {
@@ -16123,6 +17059,9 @@ class CreateGridRoomInput$Type extends import_runtime4.MessageType {
16123
17059
  case 1:
16124
17060
  message.spaceId = reader.int64().toBigInt();
16125
17061
  break;
17062
+ case 2:
17063
+ message.microphoneEnabled = reader.bool();
17064
+ break;
16126
17065
  default:
16127
17066
  let u = options.readUnknownField;
16128
17067
  if (u === "throw")
@@ -16137,6 +17076,8 @@ class CreateGridRoomInput$Type extends import_runtime4.MessageType {
16137
17076
  internalBinaryWrite(message, writer, options) {
16138
17077
  if (message.spaceId !== 0n)
16139
17078
  writer.tag(1, import_runtime.WireType.Varint).int64(message.spaceId);
17079
+ if (message.microphoneEnabled !== undefined)
17080
+ writer.tag(2, import_runtime.WireType.Varint).bool(message.microphoneEnabled);
16140
17081
  let u = options.writeUnknownFields;
16141
17082
  if (u !== false)
16142
17083
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -16197,7 +17138,8 @@ var CreateGridRoomResult = new CreateGridRoomResult$Type;
16197
17138
  class JoinGridRoomInput$Type extends import_runtime4.MessageType {
16198
17139
  constructor() {
16199
17140
  super("JoinGridRoomInput", [
16200
- { no: 1, name: "room_id", kind: "scalar", T: 3, L: 0 }
17141
+ { no: 1, name: "room_id", kind: "scalar", T: 3, L: 0 },
17142
+ { no: 2, name: "microphone_enabled", kind: "scalar", opt: true, T: 8 }
16201
17143
  ]);
16202
17144
  }
16203
17145
  create(value) {
@@ -16215,6 +17157,9 @@ class JoinGridRoomInput$Type extends import_runtime4.MessageType {
16215
17157
  case 1:
16216
17158
  message.roomId = reader.int64().toBigInt();
16217
17159
  break;
17160
+ case 2:
17161
+ message.microphoneEnabled = reader.bool();
17162
+ break;
16218
17163
  default:
16219
17164
  let u = options.readUnknownField;
16220
17165
  if (u === "throw")
@@ -16229,6 +17174,8 @@ class JoinGridRoomInput$Type extends import_runtime4.MessageType {
16229
17174
  internalBinaryWrite(message, writer, options) {
16230
17175
  if (message.roomId !== 0n)
16231
17176
  writer.tag(1, import_runtime.WireType.Varint).int64(message.roomId);
17177
+ if (message.microphoneEnabled !== undefined)
17178
+ writer.tag(2, import_runtime.WireType.Varint).bool(message.microphoneEnabled);
16232
17179
  let u = options.writeUnknownFields;
16233
17180
  if (u !== false)
16234
17181
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -18622,6 +19569,81 @@ class BotAgent$Type extends import_runtime4.MessageType {
18622
19569
  }
18623
19570
  var BotAgent = new BotAgent$Type;
18624
19571
 
19572
+ class BotAgentProfile$Type extends import_runtime4.MessageType {
19573
+ constructor() {
19574
+ super("BotAgentProfile", [
19575
+ { no: 1, name: "id", kind: "scalar", T: 3, L: 0 },
19576
+ { no: 2, name: "bot_user_id", kind: "scalar", T: 3, L: 0 },
19577
+ { no: 3, name: "name", kind: "scalar", T: 9 },
19578
+ { no: 4, name: "handle", kind: "scalar", opt: true, T: 9 },
19579
+ { no: 5, name: "emoji", kind: "scalar", opt: true, T: 9 },
19580
+ { no: 6, name: "description", kind: "scalar", opt: true, T: 9 }
19581
+ ]);
19582
+ }
19583
+ create(value) {
19584
+ const message = globalThis.Object.create(this.messagePrototype);
19585
+ message.id = 0n;
19586
+ message.botUserId = 0n;
19587
+ message.name = "";
19588
+ if (value !== undefined)
19589
+ import_runtime3.reflectionMergePartial(this, message, value);
19590
+ return message;
19591
+ }
19592
+ internalBinaryRead(reader, length, options, target) {
19593
+ let message = target ?? this.create(), end = reader.pos + length;
19594
+ while (reader.pos < end) {
19595
+ let [fieldNo, wireType] = reader.tag();
19596
+ switch (fieldNo) {
19597
+ case 1:
19598
+ message.id = reader.int64().toBigInt();
19599
+ break;
19600
+ case 2:
19601
+ message.botUserId = reader.int64().toBigInt();
19602
+ break;
19603
+ case 3:
19604
+ message.name = reader.string();
19605
+ break;
19606
+ case 4:
19607
+ message.handle = reader.string();
19608
+ break;
19609
+ case 5:
19610
+ message.emoji = reader.string();
19611
+ break;
19612
+ case 6:
19613
+ message.description = reader.string();
19614
+ break;
19615
+ default:
19616
+ let u = options.readUnknownField;
19617
+ if (u === "throw")
19618
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
19619
+ let d = reader.skip(wireType);
19620
+ if (u !== false)
19621
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
19622
+ }
19623
+ }
19624
+ return message;
19625
+ }
19626
+ internalBinaryWrite(message, writer, options) {
19627
+ if (message.id !== 0n)
19628
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.id);
19629
+ if (message.botUserId !== 0n)
19630
+ writer.tag(2, import_runtime.WireType.Varint).int64(message.botUserId);
19631
+ if (message.name !== "")
19632
+ writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.name);
19633
+ if (message.handle !== undefined)
19634
+ writer.tag(4, import_runtime.WireType.LengthDelimited).string(message.handle);
19635
+ if (message.emoji !== undefined)
19636
+ writer.tag(5, import_runtime.WireType.LengthDelimited).string(message.emoji);
19637
+ if (message.description !== undefined)
19638
+ writer.tag(6, import_runtime.WireType.LengthDelimited).string(message.description);
19639
+ let u = options.writeUnknownFields;
19640
+ if (u !== false)
19641
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
19642
+ return writer;
19643
+ }
19644
+ }
19645
+ var BotAgentProfile = new BotAgentProfile$Type;
19646
+
18625
19647
  class CreateBotAgentInput$Type extends import_runtime4.MessageType {
18626
19648
  constructor() {
18627
19649
  super("CreateBotAgentInput", [
@@ -18921,6 +19943,213 @@ class ListBotAgentsResult$Type extends import_runtime4.MessageType {
18921
19943
  }
18922
19944
  var ListBotAgentsResult = new ListBotAgentsResult$Type;
18923
19945
 
19946
+ class UpdateBotAgentInput$Type extends import_runtime4.MessageType {
19947
+ constructor() {
19948
+ super("UpdateBotAgentInput", [
19949
+ { no: 1, name: "agent_id", kind: "scalar", T: 3, L: 0 },
19950
+ { no: 2, name: "name", kind: "scalar", opt: true, T: 9 },
19951
+ { no: 3, name: "handle", kind: "scalar", opt: true, T: 9 },
19952
+ { no: 4, name: "emoji", kind: "scalar", opt: true, T: 9 },
19953
+ { no: 5, name: "description", kind: "scalar", opt: true, T: 9 },
19954
+ { no: 6, name: "skill_key", kind: "scalar", opt: true, T: 9 },
19955
+ { no: 7, name: "instructions", kind: "scalar", opt: true, T: 9 }
19956
+ ]);
19957
+ }
19958
+ create(value) {
19959
+ const message = globalThis.Object.create(this.messagePrototype);
19960
+ message.agentId = 0n;
19961
+ if (value !== undefined)
19962
+ import_runtime3.reflectionMergePartial(this, message, value);
19963
+ return message;
19964
+ }
19965
+ internalBinaryRead(reader, length, options, target) {
19966
+ let message = target ?? this.create(), end = reader.pos + length;
19967
+ while (reader.pos < end) {
19968
+ let [fieldNo, wireType] = reader.tag();
19969
+ switch (fieldNo) {
19970
+ case 1:
19971
+ message.agentId = reader.int64().toBigInt();
19972
+ break;
19973
+ case 2:
19974
+ message.name = reader.string();
19975
+ break;
19976
+ case 3:
19977
+ message.handle = reader.string();
19978
+ break;
19979
+ case 4:
19980
+ message.emoji = reader.string();
19981
+ break;
19982
+ case 5:
19983
+ message.description = reader.string();
19984
+ break;
19985
+ case 6:
19986
+ message.skillKey = reader.string();
19987
+ break;
19988
+ case 7:
19989
+ message.instructions = reader.string();
19990
+ break;
19991
+ default:
19992
+ let u = options.readUnknownField;
19993
+ if (u === "throw")
19994
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
19995
+ let d = reader.skip(wireType);
19996
+ if (u !== false)
19997
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
19998
+ }
19999
+ }
20000
+ return message;
20001
+ }
20002
+ internalBinaryWrite(message, writer, options) {
20003
+ if (message.agentId !== 0n)
20004
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.agentId);
20005
+ if (message.name !== undefined)
20006
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.name);
20007
+ if (message.handle !== undefined)
20008
+ writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.handle);
20009
+ if (message.emoji !== undefined)
20010
+ writer.tag(4, import_runtime.WireType.LengthDelimited).string(message.emoji);
20011
+ if (message.description !== undefined)
20012
+ writer.tag(5, import_runtime.WireType.LengthDelimited).string(message.description);
20013
+ if (message.skillKey !== undefined)
20014
+ writer.tag(6, import_runtime.WireType.LengthDelimited).string(message.skillKey);
20015
+ if (message.instructions !== undefined)
20016
+ writer.tag(7, import_runtime.WireType.LengthDelimited).string(message.instructions);
20017
+ let u = options.writeUnknownFields;
20018
+ if (u !== false)
20019
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
20020
+ return writer;
20021
+ }
20022
+ }
20023
+ var UpdateBotAgentInput = new UpdateBotAgentInput$Type;
20024
+
20025
+ class UpdateBotAgentResult$Type extends import_runtime4.MessageType {
20026
+ constructor() {
20027
+ super("UpdateBotAgentResult", [
20028
+ { no: 1, name: "agent", kind: "message", T: () => BotAgent }
20029
+ ]);
20030
+ }
20031
+ create(value) {
20032
+ const message = globalThis.Object.create(this.messagePrototype);
20033
+ if (value !== undefined)
20034
+ import_runtime3.reflectionMergePartial(this, message, value);
20035
+ return message;
20036
+ }
20037
+ internalBinaryRead(reader, length, options, target) {
20038
+ let message = target ?? this.create(), end = reader.pos + length;
20039
+ while (reader.pos < end) {
20040
+ let [fieldNo, wireType] = reader.tag();
20041
+ switch (fieldNo) {
20042
+ case 1:
20043
+ message.agent = BotAgent.internalBinaryRead(reader, reader.uint32(), options, message.agent);
20044
+ break;
20045
+ default:
20046
+ let u = options.readUnknownField;
20047
+ if (u === "throw")
20048
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
20049
+ let d = reader.skip(wireType);
20050
+ if (u !== false)
20051
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
20052
+ }
20053
+ }
20054
+ return message;
20055
+ }
20056
+ internalBinaryWrite(message, writer, options) {
20057
+ if (message.agent)
20058
+ BotAgent.internalBinaryWrite(message.agent, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
20059
+ let u = options.writeUnknownFields;
20060
+ if (u !== false)
20061
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
20062
+ return writer;
20063
+ }
20064
+ }
20065
+ var UpdateBotAgentResult = new UpdateBotAgentResult$Type;
20066
+
20067
+ class DeleteBotAgentInput$Type extends import_runtime4.MessageType {
20068
+ constructor() {
20069
+ super("DeleteBotAgentInput", [
20070
+ { no: 1, name: "agent_id", kind: "scalar", T: 3, L: 0 }
20071
+ ]);
20072
+ }
20073
+ create(value) {
20074
+ const message = globalThis.Object.create(this.messagePrototype);
20075
+ message.agentId = 0n;
20076
+ if (value !== undefined)
20077
+ import_runtime3.reflectionMergePartial(this, message, value);
20078
+ return message;
20079
+ }
20080
+ internalBinaryRead(reader, length, options, target) {
20081
+ let message = target ?? this.create(), end = reader.pos + length;
20082
+ while (reader.pos < end) {
20083
+ let [fieldNo, wireType] = reader.tag();
20084
+ switch (fieldNo) {
20085
+ case 1:
20086
+ message.agentId = reader.int64().toBigInt();
20087
+ break;
20088
+ default:
20089
+ let u = options.readUnknownField;
20090
+ if (u === "throw")
20091
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
20092
+ let d = reader.skip(wireType);
20093
+ if (u !== false)
20094
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
20095
+ }
20096
+ }
20097
+ return message;
20098
+ }
20099
+ internalBinaryWrite(message, writer, options) {
20100
+ if (message.agentId !== 0n)
20101
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.agentId);
20102
+ let u = options.writeUnknownFields;
20103
+ if (u !== false)
20104
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
20105
+ return writer;
20106
+ }
20107
+ }
20108
+ var DeleteBotAgentInput = new DeleteBotAgentInput$Type;
20109
+
20110
+ class DeleteBotAgentResult$Type extends import_runtime4.MessageType {
20111
+ constructor() {
20112
+ super("DeleteBotAgentResult", [
20113
+ { no: 1, name: "agent_id", kind: "scalar", T: 3, L: 0 }
20114
+ ]);
20115
+ }
20116
+ create(value) {
20117
+ const message = globalThis.Object.create(this.messagePrototype);
20118
+ message.agentId = 0n;
20119
+ if (value !== undefined)
20120
+ import_runtime3.reflectionMergePartial(this, message, value);
20121
+ return message;
20122
+ }
20123
+ internalBinaryRead(reader, length, options, target) {
20124
+ let message = target ?? this.create(), end = reader.pos + length;
20125
+ while (reader.pos < end) {
20126
+ let [fieldNo, wireType] = reader.tag();
20127
+ switch (fieldNo) {
20128
+ case 1:
20129
+ message.agentId = reader.int64().toBigInt();
20130
+ break;
20131
+ default:
20132
+ let u = options.readUnknownField;
20133
+ if (u === "throw")
20134
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
20135
+ let d = reader.skip(wireType);
20136
+ if (u !== false)
20137
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
20138
+ }
20139
+ }
20140
+ return message;
20141
+ }
20142
+ internalBinaryWrite(message, writer, options) {
20143
+ if (message.agentId !== 0n)
20144
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.agentId);
20145
+ let u = options.writeUnknownFields;
20146
+ if (u !== false)
20147
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
20148
+ return writer;
20149
+ }
20150
+ }
20151
+ var DeleteBotAgentResult = new DeleteBotAgentResult$Type;
20152
+
18924
20153
  class ListBotsInput$Type extends import_runtime4.MessageType {
18925
20154
  constructor() {
18926
20155
  super("ListBotsInput", []);
@@ -22317,7 +23546,8 @@ class CreateDialogFolderInput$Type extends import_runtime4.MessageType {
22317
23546
  super("CreateDialogFolderInput", [
22318
23547
  { no: 1, name: "title", kind: "scalar", opt: true, T: 9 },
22319
23548
  { no: 2, name: "peers", kind: "message", repeat: 1, T: () => InputPeer },
22320
- { no: 3, name: "order", kind: "scalar", opt: true, T: 9 }
23549
+ { no: 3, name: "order", kind: "scalar", opt: true, T: 9 },
23550
+ { no: 4, name: "pinned_order", kind: "scalar", opt: true, T: 9 }
22321
23551
  ]);
22322
23552
  }
22323
23553
  create(value) {
@@ -22341,6 +23571,9 @@ class CreateDialogFolderInput$Type extends import_runtime4.MessageType {
22341
23571
  case 3:
22342
23572
  message.order = reader.string();
22343
23573
  break;
23574
+ case 4:
23575
+ message.pinnedOrder = reader.string();
23576
+ break;
22344
23577
  default:
22345
23578
  let u = options.readUnknownField;
22346
23579
  if (u === "throw")
@@ -22359,6 +23592,8 @@ class CreateDialogFolderInput$Type extends import_runtime4.MessageType {
22359
23592
  InputPeer.internalBinaryWrite(message.peers[i], writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
22360
23593
  if (message.order !== undefined)
22361
23594
  writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.order);
23595
+ if (message.pinnedOrder !== undefined)
23596
+ writer.tag(4, import_runtime.WireType.LengthDelimited).string(message.pinnedOrder);
22362
23597
  let u = options.writeUnknownFields;
22363
23598
  if (u !== false)
22364
23599
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -22422,13 +23657,19 @@ class UpdateDialogFolderInput$Type extends import_runtime4.MessageType {
22422
23657
  { no: 1, name: "folder_id", kind: "scalar", T: 3, L: 0 },
22423
23658
  { no: 2, name: "title", kind: "scalar", oneof: "titleUpdate", T: 9 },
22424
23659
  { no: 3, name: "clear_title", kind: "scalar", oneof: "titleUpdate", T: 8 },
22425
- { no: 4, name: "order", kind: "scalar", opt: true, T: 9 }
23660
+ { no: 4, name: "order", kind: "scalar", opt: true, T: 9 },
23661
+ { no: 5, name: "emoji", kind: "scalar", oneof: "emojiUpdate", T: 9 },
23662
+ { no: 6, name: "clear_emoji", kind: "scalar", oneof: "emojiUpdate", T: 8 },
23663
+ { no: 7, name: "pinned_order", kind: "scalar", oneof: "pinnedOrderUpdate", T: 9 },
23664
+ { no: 8, name: "clear_pinned_order", kind: "scalar", oneof: "pinnedOrderUpdate", T: 8 }
22426
23665
  ]);
22427
23666
  }
22428
23667
  create(value) {
22429
23668
  const message = globalThis.Object.create(this.messagePrototype);
22430
23669
  message.folderId = 0n;
22431
23670
  message.titleUpdate = { oneofKind: undefined };
23671
+ message.emojiUpdate = { oneofKind: undefined };
23672
+ message.pinnedOrderUpdate = { oneofKind: undefined };
22432
23673
  if (value !== undefined)
22433
23674
  import_runtime3.reflectionMergePartial(this, message, value);
22434
23675
  return message;
@@ -22456,6 +23697,30 @@ class UpdateDialogFolderInput$Type extends import_runtime4.MessageType {
22456
23697
  case 4:
22457
23698
  message.order = reader.string();
22458
23699
  break;
23700
+ case 5:
23701
+ message.emojiUpdate = {
23702
+ oneofKind: "emoji",
23703
+ emoji: reader.string()
23704
+ };
23705
+ break;
23706
+ case 6:
23707
+ message.emojiUpdate = {
23708
+ oneofKind: "clearEmoji",
23709
+ clearEmoji: reader.bool()
23710
+ };
23711
+ break;
23712
+ case 7:
23713
+ message.pinnedOrderUpdate = {
23714
+ oneofKind: "pinnedOrder",
23715
+ pinnedOrder: reader.string()
23716
+ };
23717
+ break;
23718
+ case 8:
23719
+ message.pinnedOrderUpdate = {
23720
+ oneofKind: "clearPinnedOrder",
23721
+ clearPinnedOrder: reader.bool()
23722
+ };
23723
+ break;
22459
23724
  default:
22460
23725
  let u = options.readUnknownField;
22461
23726
  if (u === "throw")
@@ -22476,6 +23741,14 @@ class UpdateDialogFolderInput$Type extends import_runtime4.MessageType {
22476
23741
  writer.tag(3, import_runtime.WireType.Varint).bool(message.titleUpdate.clearTitle);
22477
23742
  if (message.order !== undefined)
22478
23743
  writer.tag(4, import_runtime.WireType.LengthDelimited).string(message.order);
23744
+ if (message.emojiUpdate.oneofKind === "emoji")
23745
+ writer.tag(5, import_runtime.WireType.LengthDelimited).string(message.emojiUpdate.emoji);
23746
+ if (message.emojiUpdate.oneofKind === "clearEmoji")
23747
+ writer.tag(6, import_runtime.WireType.Varint).bool(message.emojiUpdate.clearEmoji);
23748
+ if (message.pinnedOrderUpdate.oneofKind === "pinnedOrder")
23749
+ writer.tag(7, import_runtime.WireType.LengthDelimited).string(message.pinnedOrderUpdate.pinnedOrder);
23750
+ if (message.pinnedOrderUpdate.oneofKind === "clearPinnedOrder")
23751
+ writer.tag(8, import_runtime.WireType.Varint).bool(message.pinnedOrderUpdate.clearPinnedOrder);
22479
23752
  let u = options.writeUnknownFields;
22480
23753
  if (u !== false)
22481
23754
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -26300,7 +27573,8 @@ class CreateChatInput$Type extends import_runtime4.MessageType {
26300
27573
  { no: 4, name: "emoji", kind: "scalar", opt: true, T: 9 },
26301
27574
  { no: 5, name: "is_public", kind: "scalar", T: 8 },
26302
27575
  { no: 6, name: "participants", kind: "message", repeat: 1, T: () => InputChatParticipant },
26303
- { no: 7, name: "reserved_chat_id", kind: "scalar", opt: true, T: 3, L: 0 }
27576
+ { no: 7, name: "reserved_chat_id", kind: "scalar", opt: true, T: 3, L: 0 },
27577
+ { no: 8, name: "placeholder_title", kind: "scalar", opt: true, T: 9 }
26304
27578
  ]);
26305
27579
  }
26306
27580
  create(value) {
@@ -26337,6 +27611,9 @@ class CreateChatInput$Type extends import_runtime4.MessageType {
26337
27611
  case 7:
26338
27612
  message.reservedChatId = reader.int64().toBigInt();
26339
27613
  break;
27614
+ case 8:
27615
+ message.placeholderTitle = reader.string();
27616
+ break;
26340
27617
  default:
26341
27618
  let u = options.readUnknownField;
26342
27619
  if (u === "throw")
@@ -26363,6 +27640,8 @@ class CreateChatInput$Type extends import_runtime4.MessageType {
26363
27640
  InputChatParticipant.internalBinaryWrite(message.participants[i], writer.tag(6, import_runtime.WireType.LengthDelimited).fork(), options).join();
26364
27641
  if (message.reservedChatId !== undefined)
26365
27642
  writer.tag(7, import_runtime.WireType.Varint).int64(message.reservedChatId);
27643
+ if (message.placeholderTitle !== undefined)
27644
+ writer.tag(8, import_runtime.WireType.LengthDelimited).string(message.placeholderTitle);
26366
27645
  let u = options.writeUnknownFields;
26367
27646
  if (u !== false)
26368
27647
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -31371,12 +32650,14 @@ class PeerBot$Type extends import_runtime4.MessageType {
31371
32650
  constructor() {
31372
32651
  super("PeerBot", [
31373
32652
  { no: 1, name: "bot", kind: "message", T: () => User },
31374
- { no: 2, name: "capabilities", kind: "message", repeat: 1, T: () => BotCapability }
32653
+ { no: 2, name: "capabilities", kind: "message", repeat: 1, T: () => BotCapability },
32654
+ { no: 3, name: "agents", kind: "message", repeat: 1, T: () => BotAgentProfile }
31375
32655
  ]);
31376
32656
  }
31377
32657
  create(value) {
31378
32658
  const message = globalThis.Object.create(this.messagePrototype);
31379
32659
  message.capabilities = [];
32660
+ message.agents = [];
31380
32661
  if (value !== undefined)
31381
32662
  import_runtime3.reflectionMergePartial(this, message, value);
31382
32663
  return message;
@@ -31392,6 +32673,9 @@ class PeerBot$Type extends import_runtime4.MessageType {
31392
32673
  case 2:
31393
32674
  message.capabilities.push(BotCapability.internalBinaryRead(reader, reader.uint32(), options));
31394
32675
  break;
32676
+ case 3:
32677
+ message.agents.push(BotAgentProfile.internalBinaryRead(reader, reader.uint32(), options));
32678
+ break;
31395
32679
  default:
31396
32680
  let u = options.readUnknownField;
31397
32681
  if (u === "throw")
@@ -31408,6 +32692,8 @@ class PeerBot$Type extends import_runtime4.MessageType {
31408
32692
  User.internalBinaryWrite(message.bot, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
31409
32693
  for (let i = 0;i < message.capabilities.length; i++)
31410
32694
  BotCapability.internalBinaryWrite(message.capabilities[i], writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
32695
+ for (let i = 0;i < message.agents.length; i++)
32696
+ BotAgentProfile.internalBinaryWrite(message.agents[i], writer.tag(3, import_runtime.WireType.LengthDelimited).fork(), options).join();
31411
32697
  let u = options.writeUnknownFields;
31412
32698
  if (u !== false)
31413
32699
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -35355,6 +36641,7 @@ var HASH_READ_SIZE = 1024 * 1024;
35355
36641
  var MAX_NEGOTIATED_PART_SIZE = 16 * 1024 * 1024;
35356
36642
  var DEFAULT_GLOBAL_CONCURRENCY = 3;
35357
36643
  var DEFAULT_UPLOAD_CONCURRENCY = 2;
36644
+ var MAX_PART_ATTEMPTS = 2;
35358
36645
  var MAX_FINISH_RECONCILIATION_ATTEMPTS = 3;
35359
36646
  var FINISH_RECONCILIATION_DELAY_SECONDS = 1;
35360
36647
  var MAX_PROCESSING_RETRY_SECONDS = 30;
@@ -35376,7 +36663,10 @@ var sourceHash = async (source, signal) => {
35376
36663
  if (signal?.aborted)
35377
36664
  throw new NativeUploadError("canceled", "Upload was canceled");
35378
36665
  const length = Math.min(HASH_READ_SIZE, source.byteCount - offset);
35379
- hash.update(await exactRead(source, offset, length));
36666
+ const bytes = await exactRead(source, offset, length);
36667
+ if (signal?.aborted)
36668
+ throw new NativeUploadError("canceled", "Upload was canceled");
36669
+ hash.update(bytes);
35380
36670
  }
35381
36671
  return hash.digest();
35382
36672
  };
@@ -35459,9 +36749,19 @@ class NativeUploadClient {
35459
36749
  settled: false
35460
36750
  };
35461
36751
  this.#jobs.push(job);
36752
+ const signal = input.signal;
36753
+ if (signal) {
36754
+ const onAbort = () => this.#abort(job);
36755
+ signal.addEventListener("abort", onAbort, { once: true });
36756
+ job.removeAbortListener = () => signal.removeEventListener("abort", onAbort);
36757
+ }
36758
+ if (signal?.aborted) {
36759
+ this.#abort(job);
36760
+ return;
36761
+ }
35462
36762
  input.onProgress?.({ acceptedBytes: acceptedBytes(job), totalBytes: input.source.byteCount });
35463
- input.signal?.addEventListener("abort", () => void this.#abort(job), { once: true });
35464
- this.#pump();
36763
+ if (!job.settled)
36764
+ this.#pump();
35465
36765
  });
35466
36766
  }
35467
36767
  #pump() {
@@ -35506,22 +36806,16 @@ class NativeUploadClient {
35506
36806
  const offset = partIndex * job.upload.partSize;
35507
36807
  const length = Math.min(job.upload.partSize, job.input.source.byteCount - offset);
35508
36808
  const data = await exactRead(job.input.source, offset, length);
35509
- await this.rpc.savePart({ uploadId: job.upload.uploadId, partIndex, data });
36809
+ if (job.settled)
36810
+ return;
36811
+ await this.#savePart(job, partIndex, data);
36812
+ if (job.settled)
36813
+ return;
35510
36814
  job.accepted.add(partIndex);
35511
36815
  job.input.onProgress?.({ acceptedBytes: acceptedBytes(job), totalBytes: job.input.source.byteCount });
35512
36816
  } catch (error) {
35513
36817
  if (!job.settled && !job.input.signal?.aborted) {
35514
- try {
35515
- const state = await this.rpc.state({ uploadId: job.upload.uploadId });
35516
- if (state.acceptedParts.includes(partIndex)) {
35517
- job.accepted.add(partIndex);
35518
- job.input.onProgress?.({ acceptedBytes: acceptedBytes(job), totalBytes: job.input.source.byteCount });
35519
- } else {
35520
- this.#reject(job, error);
35521
- }
35522
- } catch {
35523
- this.#reject(job, error);
35524
- }
36818
+ this.#reject(job, error);
35525
36819
  }
35526
36820
  } finally {
35527
36821
  job.queued.delete(partIndex);
@@ -35532,6 +36826,32 @@ class NativeUploadClient {
35532
36826
  this.#finish(job);
35533
36827
  }
35534
36828
  }
36829
+ async#savePart(job, partIndex, data) {
36830
+ for (let attempt = 0;attempt < MAX_PART_ATTEMPTS; attempt += 1) {
36831
+ if (job.settled || job.input.signal?.aborted) {
36832
+ throw new NativeUploadError("canceled", "Upload was canceled");
36833
+ }
36834
+ try {
36835
+ await this.rpc.savePart({ uploadId: job.upload.uploadId, partIndex, data });
36836
+ return;
36837
+ } catch (error) {
36838
+ if (job.settled || job.input.signal?.aborted) {
36839
+ throw new NativeUploadError("canceled", "Upload was canceled");
36840
+ }
36841
+ let state;
36842
+ try {
36843
+ state = await this.rpc.state({ uploadId: job.upload.uploadId });
36844
+ } catch {
36845
+ throw error;
36846
+ }
36847
+ validatePartIndices(state.acceptedParts, job.upload.partCount);
36848
+ if (state.acceptedParts.includes(partIndex))
36849
+ return;
36850
+ if (state.status !== UploadStatus.UPLOADING || attempt + 1 === MAX_PART_ATTEMPTS)
36851
+ throw error;
36852
+ }
36853
+ }
36854
+ }
35535
36855
  async#finish(job) {
35536
36856
  if (job.settled || job.active > 0)
35537
36857
  return;
@@ -35610,11 +36930,11 @@ class NativeUploadClient {
35610
36930
  this.#reject(job, error);
35611
36931
  }
35612
36932
  }
35613
- async#abort(job) {
36933
+ #abort(job) {
35614
36934
  if (job.settled)
35615
36935
  return;
35616
- await this.rpc.cancel({ uploadId: job.upload.uploadId }).catch(() => {});
35617
36936
  this.#reject(job, new NativeUploadError("canceled", "Upload was canceled"));
36937
+ this.rpc.cancel({ uploadId: job.upload.uploadId }).catch(() => {});
35618
36938
  }
35619
36939
  #reject(job, error) {
35620
36940
  if (job.settled)
@@ -35624,6 +36944,8 @@ class NativeUploadClient {
35624
36944
  job.reject(error instanceof Error ? error : new Error(String(error)));
35625
36945
  }
35626
36946
  #remove(job) {
36947
+ job.removeAbortListener?.();
36948
+ job.removeAbortListener = undefined;
35627
36949
  const index = this.#jobs.indexOf(job);
35628
36950
  if (index >= 0)
35629
36951
  this.#jobs.splice(index, 1);
@@ -41053,12 +42375,17 @@ var rpcInputKindByMethod = {
41053
42375
  79: "requestBotChatSettings",
41054
42376
  80: "invokeBotChatSettingsItem",
41055
42377
  81: "answerBotChatSettings",
42378
+ 106: "createBotAgent",
42379
+ 107: "getBotAgent",
42380
+ 108: "listBotAgents",
41056
42381
  117: "createUpload",
41057
42382
  118: "saveUploadPart",
41058
42383
  119: "getUploadState",
41059
42384
  120: "finishUpload",
41060
42385
  121: "cancelUpload",
41061
- 127: "getSpace"
42386
+ 127: "getSpace",
42387
+ 131: "updateBotAgent",
42388
+ 132: "deleteBotAgent"
41062
42389
  };
41063
42390
  var rpcResultKindByMethod = {
41064
42391
  0: undefined,
@@ -41117,12 +42444,17 @@ var rpcResultKindByMethod = {
41117
42444
  79: "requestBotChatSettings",
41118
42445
  80: "invokeBotChatSettingsItem",
41119
42446
  81: "answerBotChatSettings",
42447
+ 106: "createBotAgent",
42448
+ 107: "getBotAgent",
42449
+ 108: "listBotAgents",
41120
42450
  117: "createUpload",
41121
42451
  118: "saveUploadPart",
41122
42452
  119: "getUploadState",
41123
42453
  120: "finishUpload",
41124
42454
  121: "cancelUpload",
41125
- 127: "getSpace"
42455
+ 127: "getSpace",
42456
+ 131: "updateBotAgent",
42457
+ 132: "deleteBotAgent"
41126
42458
  };
41127
42459
 
41128
42460
  // node_modules/@inline-chat/realtime-sdk/dist/sdk/logger.js
@@ -43469,6 +44801,15 @@ function toInputMedia(media) {
43469
44801
  }
43470
44802
  }
43471
44803
  };
44804
+ case "voice":
44805
+ return {
44806
+ media: {
44807
+ oneofKind: "voice",
44808
+ voice: {
44809
+ voiceId: asInlineId(media.voiceId, "voiceId")
44810
+ }
44811
+ }
44812
+ };
43472
44813
  }
43473
44814
  }
43474
44815
  function normalizeHttpBaseUrl(baseUrl) {
@@ -43942,7 +45283,9 @@ function normalizeUploadKind(raw, filePath) {
43942
45283
  return "photo";
43943
45284
  if (raw === "video")
43944
45285
  return "video";
43945
- if (raw === "document" || raw === "file" || raw === "voice")
45286
+ if (raw === "voice")
45287
+ return "voice";
45288
+ if (raw === "document" || raw === "file")
43946
45289
  return "document";
43947
45290
  const lower = filePath.toLowerCase();
43948
45291
  if (/\.(png|jpg|jpeg|gif|webp|heic|heif)$/.test(lower))
@@ -44230,19 +45573,40 @@ class InlineUserDirectory {
44230
45573
  this.onError = options.onError;
44231
45574
  }
44232
45575
  async resolve(params) {
44233
- const userId = params.userId.toString();
44234
- const cached2 = this.getFresh(userId);
45576
+ const cached2 = this.getFresh(params.userId.toString());
44235
45577
  if (hasDisplayIdentity(cached2))
44236
45578
  return cached2;
45579
+ return (await this.resolveWithProvenance(params)).profile;
45580
+ }
45581
+ async resolveWithProvenance(params) {
45582
+ const userId = params.userId.toString();
45583
+ const cached2 = this.getFresh(userId);
45584
+ if (hasDisplayIdentity(cached2) && cached2.bot != null) {
45585
+ return { profile: cached2, provenanceVerified: true };
45586
+ }
44237
45587
  if (params.direct) {
44238
- await this.hydrateDirectory();
45588
+ const directoryHydrated = await this.hydrateDirectory();
45589
+ const resolved = this.getFresh(userId);
45590
+ return {
45591
+ ...hasDisplayIdentity(resolved) ? { profile: resolved } : {},
45592
+ provenanceVerified: directoryHydrated
45593
+ };
44239
45594
  } else {
44240
- await this.hydrateChat(params.chatId);
44241
- if (!hasDisplayIdentity(this.getFresh(userId)))
44242
- await this.hydrateDirectory();
45595
+ const chatHydrated = await this.hydrateChat(params.chatId);
45596
+ const participant = this.getFresh(userId);
45597
+ if (hasDisplayIdentity(participant)) {
45598
+ return {
45599
+ profile: participant,
45600
+ provenanceVerified: chatHydrated || participant.bot != null
45601
+ };
45602
+ }
45603
+ const directoryHydrated = await this.hydrateDirectory();
45604
+ const resolved = this.getFresh(userId);
45605
+ return {
45606
+ ...hasDisplayIdentity(resolved) ? { profile: resolved } : {},
45607
+ provenanceVerified: directoryHydrated && (chatHydrated || hasDisplayIdentity(resolved))
45608
+ };
44243
45609
  }
44244
- const resolved = this.getFresh(userId);
44245
- return hasDisplayIdentity(resolved) ? resolved : undefined;
44246
45610
  }
44247
45611
  remember(users) {
44248
45612
  const expiresAt = this.now() + this.ttlMs;
@@ -44255,7 +45619,8 @@ class InlineUserDirectory {
44255
45619
  id,
44256
45620
  ...readProfileField(user.firstName, previous?.firstName, "firstName"),
44257
45621
  ...readProfileField(user.lastName, previous?.lastName, "lastName"),
44258
- ...readProfileField(user.username, previous?.username, "username")
45622
+ ...readProfileField(user.username, previous?.username, "username"),
45623
+ ...readBooleanProfileField(user.bot, previous?.bot, "bot")
44259
45624
  };
44260
45625
  this.profiles.delete(id);
44261
45626
  this.profiles.set(id, { profile, expiresAt });
@@ -44291,7 +45656,7 @@ class InlineUserDirectory {
44291
45656
  if (hydratedUntil > this.now()) {
44292
45657
  this.hydratedChats.delete(key);
44293
45658
  this.hydratedChats.set(key, hydratedUntil);
44294
- return;
45659
+ return true;
44295
45660
  }
44296
45661
  this.hydratedChats.delete(key);
44297
45662
  const existing = this.chatFetches.get(key);
@@ -44311,13 +45676,17 @@ class InlineUserDirectory {
44311
45676
  break;
44312
45677
  this.hydratedChats.delete(oldest);
44313
45678
  }
44314
- })().catch((error) => this.onError?.("getChatParticipants", error)).finally(() => this.chatFetches.delete(key));
45679
+ return true;
45680
+ })().catch((error) => {
45681
+ this.onError?.("getChatParticipants", error);
45682
+ return false;
45683
+ }).finally(() => this.chatFetches.delete(key));
44315
45684
  this.chatFetches.set(key, fetch2);
44316
- await fetch2;
45685
+ return await fetch2;
44317
45686
  }
44318
45687
  async hydrateDirectory() {
44319
45688
  if (this.directoryExpiresAt > this.now())
44320
- return;
45689
+ return true;
44321
45690
  if (this.directoryFetch)
44322
45691
  return this.directoryFetch;
44323
45692
  const fetch2 = (async () => {
@@ -44327,21 +45696,29 @@ class InlineUserDirectory {
44327
45696
  });
44328
45697
  this.remember(readUsers(result, "getChats"));
44329
45698
  this.directoryExpiresAt = this.now() + this.ttlMs;
44330
- })().catch((error) => this.onError?.("getChats", error)).finally(() => {
45699
+ return true;
45700
+ })().catch((error) => {
45701
+ this.onError?.("getChats", error);
45702
+ return false;
45703
+ }).finally(() => {
44331
45704
  this.directoryFetch = null;
44332
45705
  });
44333
45706
  this.directoryFetch = fetch2;
44334
- await fetch2;
45707
+ return await fetch2;
44335
45708
  }
44336
45709
  }
44337
45710
  function hasDisplayIdentity(profile) {
44338
- return Boolean(profile?.firstName || profile?.lastName || profile?.username);
45711
+ return Boolean(profile?.firstName || profile?.lastName || profile?.username || profile?.bot != null);
44339
45712
  }
44340
45713
  function readProfileField(value, previous, key) {
44341
45714
  const normalized = typeof value === "string" ? value.trim() : "";
44342
45715
  const resolved = normalized || previous;
44343
45716
  return resolved ? { [key]: resolved } : {};
44344
45717
  }
45718
+ function readBooleanProfileField(value, previous, key) {
45719
+ const resolved = value ?? previous;
45720
+ return resolved == null ? {} : { [key]: resolved };
45721
+ }
44345
45722
  function readUsers(result, kind) {
44346
45723
  if (!result || typeof result !== "object")
44347
45724
  return [];
@@ -44451,8 +45828,9 @@ async function connectClientLoop() {
44451
45828
  async function consumeEvents() {
44452
45829
  try {
44453
45830
  for await (const event of client.events()) {
44454
- const sender = await resolveInboundSender(event);
44455
- await deliver(normalizeInboundEvent(event, meId, sender, meUsername));
45831
+ const senderResolution = await resolveInboundSender(event);
45832
+ const normalized = normalizeInboundEvent(event, meId, senderResolution.profile, meUsername);
45833
+ await deliver(senderResolution.provenanceVerified ? normalized : { ...asRecord(normalized), _inlineSenderProvenanceVerified: false });
44456
45834
  }
44457
45835
  } catch (error) {
44458
45836
  if (!stopping) {
@@ -44570,6 +45948,15 @@ async function handleRequest(req, res) {
44570
45948
  case "/get-agent":
44571
45949
  await endpointGetAgent(res, body);
44572
45950
  return;
45951
+ case "/list-agents":
45952
+ await endpointListAgents(res);
45953
+ return;
45954
+ case "/update-agent":
45955
+ await endpointUpdateAgent(res, body);
45956
+ return;
45957
+ case "/delete-agent":
45958
+ await endpointDeleteAgent(res, body);
45959
+ return;
44573
45960
  case "/answer-action":
44574
45961
  await endpointAnswerAction(res, body);
44575
45962
  return;
@@ -44597,10 +45984,9 @@ async function endpointSend(res, body) {
44597
45984
  throw new SidecarError("send requires text or media", "bad_format");
44598
45985
  }
44599
45986
  const params = {
44600
- ...text ? { text } : {},
45987
+ ...text ? { text, parseMarkdown } : {},
44601
45988
  ...media ? { media } : {},
44602
45989
  ...replyToMsgId ? { replyToMsgId } : {},
44603
- parseMarkdown,
44604
45990
  ...actions ? { actions } : {},
44605
45991
  ...sendMode === "silent" ? { sendMode: "silent" } : {}
44606
45992
  };
@@ -44668,6 +46054,7 @@ async function endpointSendAttachment(res, body) {
44668
46054
  const filePath = readRequiredString(record2, "path");
44669
46055
  const kind = normalizeUploadKind(readOptionalString(record2, "kind"), filePath);
44670
46056
  const caption = readOptionalString(record2, "caption");
46057
+ const parseMarkdown = readOptionalBoolean(record2, "parseMarkdown") ?? true;
44671
46058
  const replyToMsgId = readOptionalInlineId(record2, "replyToMsgId");
44672
46059
  const fileName = readOptionalString(record2, "fileName") || path.basename(filePath);
44673
46060
  const contentType = readOptionalString(record2, "mimeType");
@@ -44681,12 +46068,12 @@ async function endpointSendAttachment(res, body) {
44681
46068
  fileName,
44682
46069
  ...contentType ? { contentType } : {}
44683
46070
  });
44684
- const media = kind === "photo" && upload.photoId != null ? { kind: "photo", photoId: upload.photoId } : kind === "video" && upload.videoId != null ? { kind: "video", videoId: upload.videoId } : upload.documentId != null ? { kind: "document", documentId: upload.documentId } : null;
46071
+ const media = kind === "photo" && upload.photoId != null ? { kind: "photo", photoId: upload.photoId } : kind === "video" && upload.videoId != null ? { kind: "video", videoId: upload.videoId } : kind === "voice" && upload.voiceId != null ? { kind: "voice", voiceId: upload.voiceId } : upload.documentId != null ? { kind: "document", documentId: upload.documentId } : null;
44685
46072
  if (!media)
44686
46073
  throw new SidecarError("upload did not return a sendable media id", "unknown");
44687
46074
  const sendParams = {
44688
46075
  media,
44689
- ...caption ? { text: caption, parseMarkdown: true } : {},
46076
+ ...caption ? { text: caption, parseMarkdown } : {},
44690
46077
  ...replyToMsgId ? { replyToMsgId } : {}
44691
46078
  };
44692
46079
  const sent = "chatId" in target ? await client.sendMessage({ chatId: target.chatId, ...sendParams }) : await client.sendMessage({ userId: target.userId, ...sendParams });
@@ -45023,6 +46410,56 @@ async function endpointGetAgent(res, body) {
45023
46410
  }
45024
46411
  writeJson(res, 200, { ok: true, result: safeJson(result) });
45025
46412
  }
46413
+ async function endpointListAgents(res) {
46414
+ const result = await callBotApi("getMyAgents", "GET");
46415
+ writeJson(res, 200, { ok: true, result: safeJson(result) });
46416
+ }
46417
+ function readAgentPatchString(record2, key) {
46418
+ if (!(key in record2))
46419
+ return;
46420
+ const value = record2[key];
46421
+ if (typeof value !== "string") {
46422
+ throw new SidecarError(`${key} must be a string`, "bad_format");
46423
+ }
46424
+ return value.trim();
46425
+ }
46426
+ async function endpointUpdateAgent(res, body) {
46427
+ const record2 = asRecord(body);
46428
+ const agentId = readRequiredInlineId(record2, "agentId");
46429
+ const name = readAgentPatchString(record2, "name");
46430
+ if (name !== undefined && !name) {
46431
+ throw new SidecarError("name cannot be empty", "bad_format");
46432
+ }
46433
+ const patch = {
46434
+ ...name !== undefined ? { name } : {},
46435
+ ...agentPatchField(record2, "handle"),
46436
+ ...agentPatchField(record2, "emoji"),
46437
+ ...agentPatchField(record2, "description"),
46438
+ ...agentPatchField(record2, "skill_key"),
46439
+ ...agentPatchField(record2, "instructions")
46440
+ };
46441
+ if (Object.keys(patch).length === 0) {
46442
+ throw new SidecarError("update-agent requires at least one field", "bad_format");
46443
+ }
46444
+ const result = await callBotApi("updateAgent", "POST", {
46445
+ agent_id: String(agentId),
46446
+ ...patch
46447
+ });
46448
+ const agent = asOptionalRecord(result.agent);
46449
+ if (!agent)
46450
+ throw new SidecarError("update-agent returned no Agent", "unknown");
46451
+ writeJson(res, 200, { ok: true, result: { agent: safeJson(agent) } });
46452
+ }
46453
+ function agentPatchField(record2, key) {
46454
+ const value = readAgentPatchString(record2, key);
46455
+ return value === undefined ? {} : { [key]: value };
46456
+ }
46457
+ async function endpointDeleteAgent(res, body) {
46458
+ const record2 = asRecord(body);
46459
+ const agentId = readRequiredInlineId(record2, "agentId");
46460
+ const result = await callBotApi("deleteAgent", "POST", { agent_id: String(agentId) });
46461
+ writeJson(res, 200, { ok: true, result: safeJson(result) });
46462
+ }
45026
46463
  async function getRawChatSnapshot(chatId) {
45027
46464
  const result = await client.invoke(Method.GET_CHAT, {
45028
46465
  oneofKind: "getChat",
@@ -45093,8 +46530,8 @@ async function resolveInboundSender(event) {
45093
46530
  const userId = asPositiveBigInt(message?.fromId ?? event.actorUserId ?? reaction?.userId ?? event.userId ?? participant?.userId);
45094
46531
  const chatId = asPositiveBigInt(event.chatId ?? message?.chatId ?? reaction?.chatId);
45095
46532
  if (!userId || !chatId || userId.toString() === meId)
45096
- return;
45097
- return userDirectory.resolve({
46533
+ return { provenanceVerified: true };
46534
+ return userDirectory.resolveWithProvenance({
45098
46535
  userId,
45099
46536
  chatId,
45100
46537
  direct: message ? messagePeerIsDirect(message) : false
@@ -45298,6 +46735,8 @@ class MockInlineClient {
45298
46735
  return { fileUniqueId, photoId: this.uploadId };
45299
46736
  if (params.type === "video")
45300
46737
  return { fileUniqueId, videoId: this.uploadId };
46738
+ if (params.type === "voice")
46739
+ return { fileUniqueId, voiceId: this.uploadId };
45301
46740
  return { fileUniqueId, documentId: this.uploadId };
45302
46741
  }
45303
46742
  async sendTyping(params) {
@@ -45570,6 +47009,8 @@ function parseSendMedia(value) {
45570
47009
  return { kind, videoId: readRequiredInlineId(media, "videoId") };
45571
47010
  if (kind === "document")
45572
47011
  return { kind, documentId: readRequiredInlineId(media, "documentId") };
47012
+ if (kind === "voice")
47013
+ return { kind, voiceId: readRequiredInlineId(media, "voiceId") };
45573
47014
  throw new SidecarError(`unsupported media kind: ${kind}`, "bad_format");
45574
47015
  }
45575
47016
  function parseActions(value) {