@inline-openclaw/inline 0.0.62 → 0.0.64

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.
@@ -2695,7 +2695,7 @@ var require_commonjs = __commonJS((exports) => {
2695
2695
  } });
2696
2696
  });
2697
2697
 
2698
- // ../node_modules/.bun/ws@8.21.0/node_modules/ws/lib/constants.js
2698
+ // ../node_modules/.bun/ws@8.21.3/node_modules/ws/lib/constants.js
2699
2699
  var require_constants = __commonJS((exports, module) => {
2700
2700
  var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
2701
2701
  var hasBlob = typeof Blob !== "undefined";
@@ -2715,7 +2715,7 @@ var require_constants = __commonJS((exports, module) => {
2715
2715
  };
2716
2716
  });
2717
2717
 
2718
- // ../node_modules/.bun/ws@8.21.0/node_modules/ws/lib/buffer-util.js
2718
+ // ../node_modules/.bun/ws@8.21.3/node_modules/ws/lib/buffer-util.js
2719
2719
  var require_buffer_util = __commonJS((exports, module) => {
2720
2720
  var { EMPTY_BUFFER } = require_constants();
2721
2721
  var FastBuffer = Buffer[Symbol.species];
@@ -2793,7 +2793,7 @@ var require_buffer_util = __commonJS((exports, module) => {
2793
2793
  }
2794
2794
  });
2795
2795
 
2796
- // ../node_modules/.bun/ws@8.21.0/node_modules/ws/lib/limiter.js
2796
+ // ../node_modules/.bun/ws@8.21.3/node_modules/ws/lib/limiter.js
2797
2797
  var require_limiter = __commonJS((exports, module) => {
2798
2798
  var kDone = Symbol("kDone");
2799
2799
  var kRun = Symbol("kRun");
@@ -2825,7 +2825,7 @@ var require_limiter = __commonJS((exports, module) => {
2825
2825
  module.exports = Limiter;
2826
2826
  });
2827
2827
 
2828
- // ../node_modules/.bun/ws@8.21.0/node_modules/ws/lib/permessage-deflate.js
2828
+ // ../node_modules/.bun/ws@8.21.3/node_modules/ws/lib/permessage-deflate.js
2829
2829
  var require_permessage_deflate = __commonJS((exports, module) => {
2830
2830
  var zlib = __require("zlib");
2831
2831
  var bufferUtil = require_buffer_util();
@@ -2897,7 +2897,7 @@ var require_permessage_deflate = __commonJS((exports, module) => {
2897
2897
  acceptAsServer(offers) {
2898
2898
  const opts = this._options;
2899
2899
  const accepted = offers.find((params) => {
2900
- if (opts.serverNoContextTakeover === false && params.server_no_context_takeover || params.server_max_window_bits && (opts.serverMaxWindowBits === false || typeof opts.serverMaxWindowBits === "number" && opts.serverMaxWindowBits > params.server_max_window_bits) || typeof opts.clientMaxWindowBits === "number" && !params.client_max_window_bits) {
2900
+ if (opts.serverNoContextTakeover === false && params.server_no_context_takeover || params.server_max_window_bits && (opts.serverMaxWindowBits === false || typeof opts.serverMaxWindowBits === "number" && opts.serverMaxWindowBits > params.server_max_window_bits) || typeof opts.clientMaxWindowBits === "number" && (typeof params.client_max_window_bits === "number" ? opts.clientMaxWindowBits > params.client_max_window_bits : !params.client_max_window_bits)) {
2901
2901
  return false;
2902
2902
  }
2903
2903
  return true;
@@ -3089,7 +3089,7 @@ var require_permessage_deflate = __commonJS((exports, module) => {
3089
3089
  }
3090
3090
  });
3091
3091
 
3092
- // ../node_modules/.bun/ws@8.21.0/node_modules/ws/lib/validation.js
3092
+ // ../node_modules/.bun/ws@8.21.3/node_modules/ws/lib/validation.js
3093
3093
  var require_validation = __commonJS((exports, module) => {
3094
3094
  var { isUtf8 } = __require("buffer");
3095
3095
  var { hasBlob } = require_constants();
@@ -3276,7 +3276,7 @@ var require_validation = __commonJS((exports, module) => {
3276
3276
  }
3277
3277
  });
3278
3278
 
3279
- // ../node_modules/.bun/ws@8.21.0/node_modules/ws/lib/receiver.js
3279
+ // ../node_modules/.bun/ws@8.21.3/node_modules/ws/lib/receiver.js
3280
3280
  var require_receiver = __commonJS((exports, module) => {
3281
3281
  var { Writable } = __require("stream");
3282
3282
  var PerMessageDeflate = require_permessage_deflate();
@@ -3320,6 +3320,7 @@ var require_receiver = __commonJS((exports, module) => {
3320
3320
  this._opcode = 0;
3321
3321
  this._totalPayloadLength = 0;
3322
3322
  this._messageLength = 0;
3323
+ this._numFragments = 0;
3323
3324
  this._fragments = [];
3324
3325
  this._errored = false;
3325
3326
  this._loop = false;
@@ -3529,17 +3530,17 @@ var require_receiver = __commonJS((exports, module) => {
3529
3530
  this.controlMessage(data, cb);
3530
3531
  return;
3531
3532
  }
3533
+ if (this._maxFragments > 0 && ++this._numFragments > this._maxFragments) {
3534
+ const error = this.createError(RangeError, "Too many message fragments", false, 1008, "WS_ERR_TOO_MANY_BUFFERED_PARTS");
3535
+ cb(error);
3536
+ return;
3537
+ }
3532
3538
  if (this._compressed) {
3533
3539
  this._state = INFLATING;
3534
3540
  this.decompress(data, cb);
3535
3541
  return;
3536
3542
  }
3537
3543
  if (data.length) {
3538
- if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
3539
- const error = this.createError(RangeError, "Too many message fragments", false, 1008, "WS_ERR_TOO_MANY_BUFFERED_PARTS");
3540
- cb(error);
3541
- return;
3542
- }
3543
3544
  this._messageLength = this._totalPayloadLength;
3544
3545
  this._fragments.push(data);
3545
3546
  }
@@ -3557,11 +3558,6 @@ var require_receiver = __commonJS((exports, module) => {
3557
3558
  cb(error);
3558
3559
  return;
3559
3560
  }
3560
- if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
3561
- const error = this.createError(RangeError, "Too many message fragments", false, 1008, "WS_ERR_TOO_MANY_BUFFERED_PARTS");
3562
- cb(error);
3563
- return;
3564
- }
3565
3561
  this._fragments.push(buf);
3566
3562
  }
3567
3563
  this.dataMessage(cb);
@@ -3579,6 +3575,7 @@ var require_receiver = __commonJS((exports, module) => {
3579
3575
  this._totalPayloadLength = 0;
3580
3576
  this._messageLength = 0;
3581
3577
  this._fragmented = 0;
3578
+ this._numFragments = 0;
3582
3579
  this._fragments = [];
3583
3580
  if (this._opcode === 2) {
3584
3581
  let data;
@@ -3673,7 +3670,7 @@ var require_receiver = __commonJS((exports, module) => {
3673
3670
  module.exports = Receiver;
3674
3671
  });
3675
3672
 
3676
- // ../node_modules/.bun/ws@8.21.0/node_modules/ws/lib/sender.js
3673
+ // ../node_modules/.bun/ws@8.21.3/node_modules/ws/lib/sender.js
3677
3674
  var require_sender = __commonJS((exports, module) => {
3678
3675
  var { Duplex } = __require("stream");
3679
3676
  var { randomFillSync } = __require("crypto");
@@ -4032,7 +4029,7 @@ var require_sender = __commonJS((exports, module) => {
4032
4029
  }
4033
4030
  });
4034
4031
 
4035
- // ../node_modules/.bun/ws@8.21.0/node_modules/ws/lib/event-target.js
4032
+ // ../node_modules/.bun/ws@8.21.3/node_modules/ws/lib/event-target.js
4036
4033
  var require_event_target = __commonJS((exports, module) => {
4037
4034
  var { kForOnEventAttribute, kListener } = require_constants();
4038
4035
  var kCode = Symbol("kCode");
@@ -4183,7 +4180,7 @@ var require_event_target = __commonJS((exports, module) => {
4183
4180
  }
4184
4181
  });
4185
4182
 
4186
- // ../node_modules/.bun/ws@8.21.0/node_modules/ws/lib/extension.js
4183
+ // ../node_modules/.bun/ws@8.21.3/node_modules/ws/lib/extension.js
4187
4184
  var require_extension = __commonJS((exports, module) => {
4188
4185
  var { tokenChars } = require_validation();
4189
4186
  function push(dest, name, elem) {
@@ -4348,7 +4345,7 @@ var require_extension = __commonJS((exports, module) => {
4348
4345
  module.exports = { format, parse };
4349
4346
  });
4350
4347
 
4351
- // ../node_modules/.bun/ws@8.21.0/node_modules/ws/lib/websocket.js
4348
+ // ../node_modules/.bun/ws@8.21.3/node_modules/ws/lib/websocket.js
4352
4349
  var require_websocket = __commonJS((exports, module) => {
4353
4350
  var EventEmitter = __require("events");
4354
4351
  var https = __require("https");
@@ -4713,8 +4710,8 @@ var require_websocket = __commonJS((exports, module) => {
4713
4710
  autoPong: true,
4714
4711
  closeTimeout: CLOSE_TIMEOUT,
4715
4712
  protocolVersion: protocolVersions[1],
4716
- maxBufferedChunks: 1024 * 1024,
4717
- maxFragments: 128 * 1024,
4713
+ maxBufferedChunks: 256 * 1024,
4714
+ maxFragments: 16 * 1024,
4718
4715
  maxPayload: 100 * 1024 * 1024,
4719
4716
  skipUTF8Validation: false,
4720
4717
  perMessageDeflate: true,
@@ -5120,7 +5117,7 @@ var require_websocket = __commonJS((exports, module) => {
5120
5117
  }
5121
5118
  });
5122
5119
 
5123
- // ../node_modules/.bun/ws@8.21.0/node_modules/ws/lib/stream.js
5120
+ // ../node_modules/.bun/ws@8.21.3/node_modules/ws/lib/stream.js
5124
5121
  var require_stream = __commonJS((exports, module) => {
5125
5122
  var WebSocket = require_websocket();
5126
5123
  var { Duplex } = __require("stream");
@@ -5223,7 +5220,7 @@ var require_stream = __commonJS((exports, module) => {
5223
5220
  module.exports = createWebSocketStream;
5224
5221
  });
5225
5222
 
5226
- // ../node_modules/.bun/ws@8.21.0/node_modules/ws/lib/subprotocol.js
5223
+ // ../node_modules/.bun/ws@8.21.3/node_modules/ws/lib/subprotocol.js
5227
5224
  var require_subprotocol = __commonJS((exports, module) => {
5228
5225
  var { tokenChars } = require_validation();
5229
5226
  function parse(header) {
@@ -5268,7 +5265,7 @@ var require_subprotocol = __commonJS((exports, module) => {
5268
5265
  module.exports = { parse };
5269
5266
  });
5270
5267
 
5271
- // ../node_modules/.bun/ws@8.21.0/node_modules/ws/lib/websocket-server.js
5268
+ // ../node_modules/.bun/ws@8.21.3/node_modules/ws/lib/websocket-server.js
5272
5269
  var require_websocket_server = __commonJS((exports, module) => {
5273
5270
  var EventEmitter = __require("events");
5274
5271
  var http = __require("http");
@@ -5290,8 +5287,8 @@ var require_websocket_server = __commonJS((exports, module) => {
5290
5287
  options = {
5291
5288
  allowSynchronousEvents: true,
5292
5289
  autoPong: true,
5293
- maxBufferedChunks: 1024 * 1024,
5294
- maxFragments: 128 * 1024,
5290
+ maxBufferedChunks: 256 * 1024,
5291
+ maxFragments: 16 * 1024,
5295
5292
  maxPayload: 100 * 1024 * 1024,
5296
5293
  skipUTF8Validation: false,
5297
5294
  perMessageDeflate: false,
@@ -5608,6 +5605,12 @@ var BotPresenceState_Kind;
5608
5605
  BotPresenceState_Kind2[BotPresenceState_Kind2["RUNNING"] = 8] = "RUNNING";
5609
5606
  BotPresenceState_Kind2[BotPresenceState_Kind2["REVIEW"] = 9] = "REVIEW";
5610
5607
  })(BotPresenceState_Kind || (BotPresenceState_Kind = {}));
5608
+ var MessageSubthread_Kind;
5609
+ (function(MessageSubthread_Kind2) {
5610
+ MessageSubthread_Kind2[MessageSubthread_Kind2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
5611
+ MessageSubthread_Kind2[MessageSubthread_Kind2["REPLY"] = 1] = "REPLY";
5612
+ MessageSubthread_Kind2[MessageSubthread_Kind2["SUBTHREAD"] = 2] = "SUBTHREAD";
5613
+ })(MessageSubthread_Kind || (MessageSubthread_Kind = {}));
5611
5614
  var BlockList_Kind;
5612
5615
  (function(BlockList_Kind2) {
5613
5616
  BlockList_Kind2[BlockList_Kind2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
@@ -5643,6 +5646,10 @@ var MessageEntity_Type;
5643
5646
  MessageEntity_Type2[MessageEntity_Type2["THREAD_TITLE"] = 12] = "THREAD_TITLE";
5644
5647
  MessageEntity_Type2[MessageEntity_Type2["BOT_COMMAND"] = 13] = "BOT_COMMAND";
5645
5648
  MessageEntity_Type2[MessageEntity_Type2["GROUP_MENTION"] = 14] = "GROUP_MENTION";
5649
+ MessageEntity_Type2[MessageEntity_Type2["UNDERLINE"] = 15] = "UNDERLINE";
5650
+ MessageEntity_Type2[MessageEntity_Type2["STRIKETHROUGH"] = 16] = "STRIKETHROUGH";
5651
+ MessageEntity_Type2[MessageEntity_Type2["HIGHLIGHT"] = 17] = "HIGHLIGHT";
5652
+ MessageEntity_Type2[MessageEntity_Type2["MATH"] = 18] = "MATH";
5646
5653
  })(MessageEntity_Type || (MessageEntity_Type = {}));
5647
5654
  var Member_Role;
5648
5655
  (function(Member_Role2) {
@@ -5696,6 +5703,7 @@ var RpcError_Code;
5696
5703
  RpcError_Code2[RpcError_Code2["FIRST_NAME_INVALID"] = 17] = "FIRST_NAME_INVALID";
5697
5704
  RpcError_Code2[RpcError_Code2["URL_PREVIEW_UNAVAILABLE"] = 18] = "URL_PREVIEW_UNAVAILABLE";
5698
5705
  RpcError_Code2[RpcError_Code2["AGENT_SESSION_MESSAGE_IMMUTABLE"] = 19] = "AGENT_SESSION_MESSAGE_IMMUTABLE";
5706
+ RpcError_Code2[RpcError_Code2["SPACE_INVITE_INVALID"] = 20] = "SPACE_INVITE_INVALID";
5699
5707
  })(RpcError_Code || (RpcError_Code = {}));
5700
5708
  var SyncSkippedSequence_Reason;
5701
5709
  (function(SyncSkippedSequence_Reason2) {
@@ -5779,6 +5787,7 @@ var BotCapability_Kind;
5779
5787
  (function(BotCapability_Kind2) {
5780
5788
  BotCapability_Kind2[BotCapability_Kind2["KIND_UNSPECIFIED"] = 0] = "KIND_UNSPECIFIED";
5781
5789
  BotCapability_Kind2[BotCapability_Kind2["CHAT_SETTINGS"] = 1] = "CHAT_SETTINGS";
5790
+ BotCapability_Kind2[BotCapability_Kind2["AGENT_CONFIGURATION"] = 2] = "AGENT_CONFIGURATION";
5782
5791
  })(BotCapability_Kind || (BotCapability_Kind = {}));
5783
5792
  var BotChatSettingsInfo_Tone;
5784
5793
  (function(BotChatSettingsInfo_Tone2) {
@@ -6001,6 +6010,14 @@ var Method;
6001
6010
  Method2[Method2["GET_AGENT_SESSION"] = 130] = "GET_AGENT_SESSION";
6002
6011
  Method2[Method2["UPDATE_BOT_AGENT"] = 131] = "UPDATE_BOT_AGENT";
6003
6012
  Method2[Method2["DELETE_BOT_AGENT"] = 132] = "DELETE_BOT_AGENT";
6013
+ Method2[Method2["JOIN_SPACE_BY_INVITE_TOKEN"] = 133] = "JOIN_SPACE_BY_INVITE_TOKEN";
6014
+ Method2[Method2["GET_SPACE_INVITE_LINK"] = 134] = "GET_SPACE_INVITE_LINK";
6015
+ Method2[Method2["SET_SPACE_INVITE_LINK_ENABLED"] = 135] = "SET_SPACE_INVITE_LINK_ENABLED";
6016
+ Method2[Method2["GET_FILE_PART"] = 136] = "GET_FILE_PART";
6017
+ Method2[Method2["ACKNOWLEDGE_MESSAGES"] = 137] = "ACKNOWLEDGE_MESSAGES";
6018
+ Method2[Method2["GET_USERS"] = 138] = "GET_USERS";
6019
+ Method2[Method2["GET_BOT_SKILLS"] = 139] = "GET_BOT_SKILLS";
6020
+ Method2[Method2["GET_BOT_CONFIGURATION_CATALOG"] = 140] = "GET_BOT_CONFIGURATION_CATALOG";
6004
6021
  })(Method || (Method = {}));
6005
6022
  var GridConnectionUnavailableReason;
6006
6023
  (function(GridConnectionUnavailableReason2) {
@@ -7903,6 +7920,115 @@ class ChatPermissions$Type extends import_runtime4.MessageType {
7903
7920
  }
7904
7921
  var ChatPermissions = new ChatPermissions$Type;
7905
7922
 
7923
+ class AgentThreadContext$Type extends import_runtime4.MessageType {
7924
+ constructor() {
7925
+ super("AgentThreadContext", [
7926
+ { no: 1, name: "bot_user_id", kind: "scalar", T: 3, L: 0 },
7927
+ { no: 2, name: "agent_id", kind: "scalar", opt: true, T: 3, L: 0 },
7928
+ { no: 3, name: "configuration", kind: "message", T: () => AgentThreadConfiguration }
7929
+ ]);
7930
+ }
7931
+ create(value) {
7932
+ const message = globalThis.Object.create(this.messagePrototype);
7933
+ message.botUserId = 0n;
7934
+ if (value !== undefined)
7935
+ import_runtime3.reflectionMergePartial(this, message, value);
7936
+ return message;
7937
+ }
7938
+ internalBinaryRead(reader, length, options, target) {
7939
+ let message = target ?? this.create(), end = reader.pos + length;
7940
+ while (reader.pos < end) {
7941
+ let [fieldNo, wireType] = reader.tag();
7942
+ switch (fieldNo) {
7943
+ case 1:
7944
+ message.botUserId = reader.int64().toBigInt();
7945
+ break;
7946
+ case 2:
7947
+ message.agentId = reader.int64().toBigInt();
7948
+ break;
7949
+ case 3:
7950
+ message.configuration = AgentThreadConfiguration.internalBinaryRead(reader, reader.uint32(), options, message.configuration);
7951
+ break;
7952
+ default:
7953
+ let u = options.readUnknownField;
7954
+ if (u === "throw")
7955
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
7956
+ let d = reader.skip(wireType);
7957
+ if (u !== false)
7958
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
7959
+ }
7960
+ }
7961
+ return message;
7962
+ }
7963
+ internalBinaryWrite(message, writer, options) {
7964
+ if (message.botUserId !== 0n)
7965
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.botUserId);
7966
+ if (message.agentId !== undefined)
7967
+ writer.tag(2, import_runtime.WireType.Varint).int64(message.agentId);
7968
+ if (message.configuration)
7969
+ AgentThreadConfiguration.internalBinaryWrite(message.configuration, writer.tag(3, import_runtime.WireType.LengthDelimited).fork(), options).join();
7970
+ let u = options.writeUnknownFields;
7971
+ if (u !== false)
7972
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
7973
+ return writer;
7974
+ }
7975
+ }
7976
+ var AgentThreadContext = new AgentThreadContext$Type;
7977
+
7978
+ class AgentThreadConfiguration$Type extends import_runtime4.MessageType {
7979
+ constructor() {
7980
+ super("AgentThreadConfiguration", [
7981
+ { no: 1, name: "project_id", kind: "scalar", opt: true, T: 9 },
7982
+ { no: 2, name: "model_id", kind: "scalar", opt: true, T: 9 },
7983
+ { no: 3, name: "reasoning_effort_id", kind: "scalar", opt: true, T: 9 }
7984
+ ]);
7985
+ }
7986
+ create(value) {
7987
+ const message = globalThis.Object.create(this.messagePrototype);
7988
+ if (value !== undefined)
7989
+ import_runtime3.reflectionMergePartial(this, message, value);
7990
+ return message;
7991
+ }
7992
+ internalBinaryRead(reader, length, options, target) {
7993
+ let message = target ?? this.create(), end = reader.pos + length;
7994
+ while (reader.pos < end) {
7995
+ let [fieldNo, wireType] = reader.tag();
7996
+ switch (fieldNo) {
7997
+ case 1:
7998
+ message.projectId = reader.string();
7999
+ break;
8000
+ case 2:
8001
+ message.modelId = reader.string();
8002
+ break;
8003
+ case 3:
8004
+ message.reasoningEffortId = reader.string();
8005
+ break;
8006
+ default:
8007
+ let u = options.readUnknownField;
8008
+ if (u === "throw")
8009
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
8010
+ let d = reader.skip(wireType);
8011
+ if (u !== false)
8012
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
8013
+ }
8014
+ }
8015
+ return message;
8016
+ }
8017
+ internalBinaryWrite(message, writer, options) {
8018
+ if (message.projectId !== undefined)
8019
+ writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.projectId);
8020
+ if (message.modelId !== undefined)
8021
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.modelId);
8022
+ if (message.reasoningEffortId !== undefined)
8023
+ writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.reasoningEffortId);
8024
+ let u = options.writeUnknownFields;
8025
+ if (u !== false)
8026
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
8027
+ return writer;
8028
+ }
8029
+ }
8030
+ var AgentThreadConfiguration = new AgentThreadConfiguration$Type;
8031
+
7906
8032
  class Chat$Type extends import_runtime4.MessageType {
7907
8033
  constructor() {
7908
8034
  super("Chat", [
@@ -7921,7 +8047,9 @@ class Chat$Type extends import_runtime4.MessageType {
7921
8047
  { no: 13, name: "untitled", kind: "scalar", opt: true, T: 8 },
7922
8048
  { no: 14, name: "number", kind: "scalar", opt: true, T: 5 },
7923
8049
  { no: 15, name: "permissions", kind: "message", T: () => ChatPermissions },
7924
- { no: 16, name: "seq", kind: "scalar", opt: true, T: 5 }
8050
+ { no: 16, name: "seq", kind: "scalar", opt: true, T: 5 },
8051
+ { no: 17, name: "acknowledgements", kind: "message", T: () => ChatAcknowledgements },
8052
+ { no: 18, name: "agent_context", kind: "message", T: () => AgentThreadContext }
7925
8053
  ]);
7926
8054
  }
7927
8055
  create(value) {
@@ -7985,6 +8113,12 @@ class Chat$Type extends import_runtime4.MessageType {
7985
8113
  case 16:
7986
8114
  message.seq = reader.int32();
7987
8115
  break;
8116
+ case 17:
8117
+ message.acknowledgements = ChatAcknowledgements.internalBinaryRead(reader, reader.uint32(), options, message.acknowledgements);
8118
+ break;
8119
+ case 18:
8120
+ message.agentContext = AgentThreadContext.internalBinaryRead(reader, reader.uint32(), options, message.agentContext);
8121
+ break;
7988
8122
  default:
7989
8123
  let u = options.readUnknownField;
7990
8124
  if (u === "throw")
@@ -8029,6 +8163,10 @@ class Chat$Type extends import_runtime4.MessageType {
8029
8163
  ChatPermissions.internalBinaryWrite(message.permissions, writer.tag(15, import_runtime.WireType.LengthDelimited).fork(), options).join();
8030
8164
  if (message.seq !== undefined)
8031
8165
  writer.tag(16, import_runtime.WireType.Varint).int32(message.seq);
8166
+ if (message.acknowledgements)
8167
+ ChatAcknowledgements.internalBinaryWrite(message.acknowledgements, writer.tag(17, import_runtime.WireType.LengthDelimited).fork(), options).join();
8168
+ if (message.agentContext)
8169
+ AgentThreadContext.internalBinaryWrite(message.agentContext, writer.tag(18, import_runtime.WireType.LengthDelimited).fork(), options).join();
8032
8170
  let u = options.writeUnknownFields;
8033
8171
  if (u !== false)
8034
8172
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -8109,6 +8247,91 @@ class MessageReplies$Type extends import_runtime4.MessageType {
8109
8247
  }
8110
8248
  var MessageReplies = new MessageReplies$Type;
8111
8249
 
8250
+ class MessageSubthread$Type extends import_runtime4.MessageType {
8251
+ constructor() {
8252
+ super("MessageSubthread", [
8253
+ { no: 1, name: "chat_id", kind: "scalar", T: 3, L: 0 },
8254
+ { no: 2, name: "kind", kind: "enum", T: () => ["MessageSubthread.Kind", MessageSubthread_Kind, "KIND_"] },
8255
+ { no: 3, name: "title", kind: "scalar", opt: true, T: 9 },
8256
+ { no: 4, name: "message_count", kind: "scalar", T: 5 },
8257
+ { no: 5, name: "has_unread", kind: "scalar", T: 8 },
8258
+ { no: 6, name: "recent_author_user_ids", kind: "scalar", repeat: 1, T: 3, L: 0 }
8259
+ ]);
8260
+ }
8261
+ create(value) {
8262
+ const message = globalThis.Object.create(this.messagePrototype);
8263
+ message.chatId = 0n;
8264
+ message.kind = 0;
8265
+ message.messageCount = 0;
8266
+ message.hasUnread = false;
8267
+ message.recentAuthorUserIds = [];
8268
+ if (value !== undefined)
8269
+ import_runtime3.reflectionMergePartial(this, message, value);
8270
+ return message;
8271
+ }
8272
+ internalBinaryRead(reader, length, options, target) {
8273
+ let message = target ?? this.create(), end = reader.pos + length;
8274
+ while (reader.pos < end) {
8275
+ let [fieldNo, wireType] = reader.tag();
8276
+ switch (fieldNo) {
8277
+ case 1:
8278
+ message.chatId = reader.int64().toBigInt();
8279
+ break;
8280
+ case 2:
8281
+ message.kind = reader.int32();
8282
+ break;
8283
+ case 3:
8284
+ message.title = reader.string();
8285
+ break;
8286
+ case 4:
8287
+ message.messageCount = reader.int32();
8288
+ break;
8289
+ case 5:
8290
+ message.hasUnread = reader.bool();
8291
+ break;
8292
+ case 6:
8293
+ if (wireType === import_runtime.WireType.LengthDelimited)
8294
+ for (let e = reader.int32() + reader.pos;reader.pos < e; )
8295
+ message.recentAuthorUserIds.push(reader.int64().toBigInt());
8296
+ else
8297
+ message.recentAuthorUserIds.push(reader.int64().toBigInt());
8298
+ break;
8299
+ default:
8300
+ let u = options.readUnknownField;
8301
+ if (u === "throw")
8302
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
8303
+ let d = reader.skip(wireType);
8304
+ if (u !== false)
8305
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
8306
+ }
8307
+ }
8308
+ return message;
8309
+ }
8310
+ internalBinaryWrite(message, writer, options) {
8311
+ if (message.chatId !== 0n)
8312
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.chatId);
8313
+ if (message.kind !== 0)
8314
+ writer.tag(2, import_runtime.WireType.Varint).int32(message.kind);
8315
+ if (message.title !== undefined)
8316
+ writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.title);
8317
+ if (message.messageCount !== 0)
8318
+ writer.tag(4, import_runtime.WireType.Varint).int32(message.messageCount);
8319
+ if (message.hasUnread !== false)
8320
+ writer.tag(5, import_runtime.WireType.Varint).bool(message.hasUnread);
8321
+ if (message.recentAuthorUserIds.length) {
8322
+ writer.tag(6, import_runtime.WireType.LengthDelimited).fork();
8323
+ for (let i = 0;i < message.recentAuthorUserIds.length; i++)
8324
+ writer.int64(message.recentAuthorUserIds[i]);
8325
+ writer.join();
8326
+ }
8327
+ let u = options.writeUnknownFields;
8328
+ if (u !== false)
8329
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
8330
+ return writer;
8331
+ }
8332
+ }
8333
+ var MessageSubthread = new MessageSubthread$Type;
8334
+
8112
8335
  class MessageActions$Type extends import_runtime4.MessageType {
8113
8336
  constructor() {
8114
8337
  super("MessageActions", [
@@ -8696,7 +8919,8 @@ class Block$Type extends import_runtime4.MessageType {
8696
8919
  { no: 8, name: "disclosure", kind: "message", oneof: "kind", T: () => BlockDisclosure },
8697
8920
  { no: 9, name: "footer", kind: "message", oneof: "kind", T: () => BlockText },
8698
8921
  { no: 10, name: "quote", kind: "message", oneof: "kind", T: () => BlockQuote },
8699
- { no: 11, name: "table", kind: "message", oneof: "kind", T: () => BlockTable }
8922
+ { no: 11, name: "table", kind: "message", oneof: "kind", T: () => BlockTable },
8923
+ { no: 12, name: "math", kind: "message", oneof: "kind", T: () => BlockText }
8700
8924
  ]);
8701
8925
  }
8702
8926
  create(value) {
@@ -8777,6 +9001,12 @@ class Block$Type extends import_runtime4.MessageType {
8777
9001
  table: BlockTable.internalBinaryRead(reader, reader.uint32(), options, message.kind.table)
8778
9002
  };
8779
9003
  break;
9004
+ case 12:
9005
+ message.kind = {
9006
+ oneofKind: "math",
9007
+ math: BlockText.internalBinaryRead(reader, reader.uint32(), options, message.kind.math)
9008
+ };
9009
+ break;
8780
9010
  default:
8781
9011
  let u = options.readUnknownField;
8782
9012
  if (u === "throw")
@@ -8811,6 +9041,8 @@ class Block$Type extends import_runtime4.MessageType {
8811
9041
  BlockQuote.internalBinaryWrite(message.kind.quote, writer.tag(10, import_runtime.WireType.LengthDelimited).fork(), options).join();
8812
9042
  if (message.kind.oneofKind === "table")
8813
9043
  BlockTable.internalBinaryWrite(message.kind.table, writer.tag(11, import_runtime.WireType.LengthDelimited).fork(), options).join();
9044
+ if (message.kind.oneofKind === "math")
9045
+ BlockText.internalBinaryWrite(message.kind.math, writer.tag(12, import_runtime.WireType.LengthDelimited).fork(), options).join();
8814
9046
  let u = options.writeUnknownFields;
8815
9047
  if (u !== false)
8816
9048
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -9553,7 +9785,8 @@ class Message$Type extends import_runtime4.MessageType {
9553
9785
  { no: 21, name: "rev", kind: "scalar", opt: true, T: 3, L: 0 },
9554
9786
  { no: 22, name: "service_message", kind: "message", T: () => MessageService },
9555
9787
  { no: 23, name: "block_content", kind: "message", T: () => BlockContent },
9556
- { no: 24, name: "agent_session", kind: "message", T: () => AgentSessionMessageInfo }
9788
+ { no: 24, name: "agent_session", kind: "message", T: () => AgentSessionMessageInfo },
9789
+ { no: 25, name: "subthread", kind: "message", T: () => MessageSubthread }
9557
9790
  ]);
9558
9791
  }
9559
9792
  create(value) {
@@ -9647,6 +9880,9 @@ class Message$Type extends import_runtime4.MessageType {
9647
9880
  case 24:
9648
9881
  message.agentSession = AgentSessionMessageInfo.internalBinaryRead(reader, reader.uint32(), options, message.agentSession);
9649
9882
  break;
9883
+ case 25:
9884
+ message.subthread = MessageSubthread.internalBinaryRead(reader, reader.uint32(), options, message.subthread);
9885
+ break;
9650
9886
  default:
9651
9887
  let u = options.readUnknownField;
9652
9888
  if (u === "throw")
@@ -9709,6 +9945,8 @@ class Message$Type extends import_runtime4.MessageType {
9709
9945
  BlockContent.internalBinaryWrite(message.blockContent, writer.tag(23, import_runtime.WireType.LengthDelimited).fork(), options).join();
9710
9946
  if (message.agentSession)
9711
9947
  AgentSessionMessageInfo.internalBinaryWrite(message.agentSession, writer.tag(24, import_runtime.WireType.LengthDelimited).fork(), options).join();
9948
+ if (message.subthread)
9949
+ MessageSubthread.internalBinaryWrite(message.subthread, writer.tag(25, import_runtime.WireType.LengthDelimited).fork(), options).join();
9712
9950
  let u = options.writeUnknownFields;
9713
9951
  if (u !== false)
9714
9952
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -9892,7 +10130,8 @@ class MessageEntity$Type extends import_runtime4.MessageType {
9892
10130
  { no: 7, name: "thread", kind: "message", oneof: "entity", T: () => MessageEntity_MessageEntityThread },
9893
10131
  { no: 8, name: "thread_title", kind: "message", oneof: "entity", T: () => MessageEntity_MessageEntityThreadTitle },
9894
10132
  { no: 9, name: "group_mention", kind: "message", oneof: "entity", T: () => MessageEntity_MessageEntityGroupMention },
9895
- { no: 10, name: "bot_command", kind: "message", oneof: "entity", T: () => MessageEntity_MessageEntityBotCommand }
10133
+ { no: 10, name: "bot_command", kind: "message", oneof: "entity", T: () => MessageEntity_MessageEntityBotCommand },
10134
+ { no: 11, name: "math", kind: "message", oneof: "entity", T: () => MessageEntity_MessageEntityMath }
9896
10135
  ]);
9897
10136
  }
9898
10137
  create(value) {
@@ -9961,6 +10200,12 @@ class MessageEntity$Type extends import_runtime4.MessageType {
9961
10200
  botCommand: MessageEntity_MessageEntityBotCommand.internalBinaryRead(reader, reader.uint32(), options, message.entity.botCommand)
9962
10201
  };
9963
10202
  break;
10203
+ case 11:
10204
+ message.entity = {
10205
+ oneofKind: "math",
10206
+ math: MessageEntity_MessageEntityMath.internalBinaryRead(reader, reader.uint32(), options, message.entity.math)
10207
+ };
10208
+ break;
9964
10209
  default:
9965
10210
  let u = options.readUnknownField;
9966
10211
  if (u === "throw")
@@ -9993,6 +10238,8 @@ class MessageEntity$Type extends import_runtime4.MessageType {
9993
10238
  MessageEntity_MessageEntityGroupMention.internalBinaryWrite(message.entity.groupMention, writer.tag(9, import_runtime.WireType.LengthDelimited).fork(), options).join();
9994
10239
  if (message.entity.oneofKind === "botCommand")
9995
10240
  MessageEntity_MessageEntityBotCommand.internalBinaryWrite(message.entity.botCommand, writer.tag(10, import_runtime.WireType.LengthDelimited).fork(), options).join();
10241
+ if (message.entity.oneofKind === "math")
10242
+ MessageEntity_MessageEntityMath.internalBinaryWrite(message.entity.math, writer.tag(11, import_runtime.WireType.LengthDelimited).fork(), options).join();
9996
10243
  let u = options.writeUnknownFields;
9997
10244
  if (u !== false)
9998
10245
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -10315,6 +10562,49 @@ class MessageEntity_MessageEntityBotCommand$Type extends import_runtime4.Message
10315
10562
  }
10316
10563
  var MessageEntity_MessageEntityBotCommand = new MessageEntity_MessageEntityBotCommand$Type;
10317
10564
 
10565
+ class MessageEntity_MessageEntityMath$Type extends import_runtime4.MessageType {
10566
+ constructor() {
10567
+ super("MessageEntity.MessageEntityMath", [
10568
+ { no: 1, name: "display", kind: "scalar", T: 8 }
10569
+ ]);
10570
+ }
10571
+ create(value) {
10572
+ const message = globalThis.Object.create(this.messagePrototype);
10573
+ message.display = false;
10574
+ if (value !== undefined)
10575
+ import_runtime3.reflectionMergePartial(this, message, value);
10576
+ return message;
10577
+ }
10578
+ internalBinaryRead(reader, length, options, target) {
10579
+ let message = target ?? this.create(), end = reader.pos + length;
10580
+ while (reader.pos < end) {
10581
+ let [fieldNo, wireType] = reader.tag();
10582
+ switch (fieldNo) {
10583
+ case 1:
10584
+ message.display = reader.bool();
10585
+ break;
10586
+ default:
10587
+ let u = options.readUnknownField;
10588
+ if (u === "throw")
10589
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
10590
+ let d = reader.skip(wireType);
10591
+ if (u !== false)
10592
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
10593
+ }
10594
+ }
10595
+ return message;
10596
+ }
10597
+ internalBinaryWrite(message, writer, options) {
10598
+ if (message.display !== false)
10599
+ writer.tag(1, import_runtime.WireType.Varint).bool(message.display);
10600
+ let u = options.writeUnknownFields;
10601
+ if (u !== false)
10602
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
10603
+ return writer;
10604
+ }
10605
+ }
10606
+ var MessageEntity_MessageEntityMath = new MessageEntity_MessageEntityMath$Type;
10607
+
10318
10608
  class MessageReactions$Type extends import_runtime4.MessageType {
10319
10609
  constructor() {
10320
10610
  super("MessageReactions", [
@@ -10692,7 +10982,8 @@ class AgentSession$Type extends import_runtime4.MessageType {
10692
10982
  { no: 2, name: "peer_id", kind: "message", T: () => Peer },
10693
10983
  { no: 3, name: "bot_user_id", kind: "scalar", T: 3, L: 0 },
10694
10984
  { no: 4, name: "provider", kind: "enum", T: () => ["AgentSessionProvider", AgentSessionProvider, "AGENT_SESSION_PROVIDER_"] },
10695
- { no: 5, name: "status_message_id", kind: "scalar", opt: true, T: 3, L: 0 }
10985
+ { no: 5, name: "status_message_id", kind: "scalar", opt: true, T: 3, L: 0 },
10986
+ { no: 6, name: "parent_chat_id", kind: "scalar", opt: true, T: 3, L: 0 }
10696
10987
  ]);
10697
10988
  }
10698
10989
  create(value) {
@@ -10724,6 +11015,9 @@ class AgentSession$Type extends import_runtime4.MessageType {
10724
11015
  case 5:
10725
11016
  message.statusMessageId = reader.int64().toBigInt();
10726
11017
  break;
11018
+ case 6:
11019
+ message.parentChatId = reader.int64().toBigInt();
11020
+ break;
10727
11021
  default:
10728
11022
  let u = options.readUnknownField;
10729
11023
  if (u === "throw")
@@ -10746,6 +11040,8 @@ class AgentSession$Type extends import_runtime4.MessageType {
10746
11040
  writer.tag(4, import_runtime.WireType.Varint).int32(message.provider);
10747
11041
  if (message.statusMessageId !== undefined)
10748
11042
  writer.tag(5, import_runtime.WireType.Varint).int64(message.statusMessageId);
11043
+ if (message.parentChatId !== undefined)
11044
+ writer.tag(6, import_runtime.WireType.Varint).int64(message.parentChatId);
10749
11045
  let u = options.writeUnknownFields;
10750
11046
  if (u !== false)
10751
11047
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -11495,6 +11791,330 @@ class JoinPublicSpaceResult$Type extends import_runtime4.MessageType {
11495
11791
  }
11496
11792
  var JoinPublicSpaceResult = new JoinPublicSpaceResult$Type;
11497
11793
 
11794
+ class SpaceInviteLink$Type extends import_runtime4.MessageType {
11795
+ constructor() {
11796
+ super("SpaceInviteLink", [
11797
+ { no: 1, name: "url", kind: "scalar", T: 9 },
11798
+ { no: 2, name: "expires_at", kind: "scalar", opt: true, T: 3, L: 0 }
11799
+ ]);
11800
+ }
11801
+ create(value) {
11802
+ const message = globalThis.Object.create(this.messagePrototype);
11803
+ message.url = "";
11804
+ if (value !== undefined)
11805
+ import_runtime3.reflectionMergePartial(this, message, value);
11806
+ return message;
11807
+ }
11808
+ internalBinaryRead(reader, length, options, target) {
11809
+ let message = target ?? this.create(), end = reader.pos + length;
11810
+ while (reader.pos < end) {
11811
+ let [fieldNo, wireType] = reader.tag();
11812
+ switch (fieldNo) {
11813
+ case 1:
11814
+ message.url = reader.string();
11815
+ break;
11816
+ case 2:
11817
+ message.expiresAt = reader.int64().toBigInt();
11818
+ break;
11819
+ default:
11820
+ let u = options.readUnknownField;
11821
+ if (u === "throw")
11822
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
11823
+ let d = reader.skip(wireType);
11824
+ if (u !== false)
11825
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
11826
+ }
11827
+ }
11828
+ return message;
11829
+ }
11830
+ internalBinaryWrite(message, writer, options) {
11831
+ if (message.url !== "")
11832
+ writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.url);
11833
+ if (message.expiresAt !== undefined)
11834
+ writer.tag(2, import_runtime.WireType.Varint).int64(message.expiresAt);
11835
+ let u = options.writeUnknownFields;
11836
+ if (u !== false)
11837
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
11838
+ return writer;
11839
+ }
11840
+ }
11841
+ var SpaceInviteLink = new SpaceInviteLink$Type;
11842
+
11843
+ class JoinSpaceByInviteTokenInput$Type extends import_runtime4.MessageType {
11844
+ constructor() {
11845
+ super("JoinSpaceByInviteTokenInput", [
11846
+ { no: 1, name: "token", kind: "scalar", T: 9 }
11847
+ ]);
11848
+ }
11849
+ create(value) {
11850
+ const message = globalThis.Object.create(this.messagePrototype);
11851
+ message.token = "";
11852
+ if (value !== undefined)
11853
+ import_runtime3.reflectionMergePartial(this, message, value);
11854
+ return message;
11855
+ }
11856
+ internalBinaryRead(reader, length, options, target) {
11857
+ let message = target ?? this.create(), end = reader.pos + length;
11858
+ while (reader.pos < end) {
11859
+ let [fieldNo, wireType] = reader.tag();
11860
+ switch (fieldNo) {
11861
+ case 1:
11862
+ message.token = reader.string();
11863
+ break;
11864
+ default:
11865
+ let u = options.readUnknownField;
11866
+ if (u === "throw")
11867
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
11868
+ let d = reader.skip(wireType);
11869
+ if (u !== false)
11870
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
11871
+ }
11872
+ }
11873
+ return message;
11874
+ }
11875
+ internalBinaryWrite(message, writer, options) {
11876
+ if (message.token !== "")
11877
+ writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.token);
11878
+ let u = options.writeUnknownFields;
11879
+ if (u !== false)
11880
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
11881
+ return writer;
11882
+ }
11883
+ }
11884
+ var JoinSpaceByInviteTokenInput = new JoinSpaceByInviteTokenInput$Type;
11885
+
11886
+ class JoinSpaceByInviteTokenResult$Type extends import_runtime4.MessageType {
11887
+ constructor() {
11888
+ super("JoinSpaceByInviteTokenResult", [
11889
+ { no: 1, name: "space", kind: "message", T: () => Space },
11890
+ { no: 2, name: "member", kind: "message", T: () => Member },
11891
+ { no: 3, name: "already_member", kind: "scalar", T: 8 }
11892
+ ]);
11893
+ }
11894
+ create(value) {
11895
+ const message = globalThis.Object.create(this.messagePrototype);
11896
+ message.alreadyMember = false;
11897
+ if (value !== undefined)
11898
+ import_runtime3.reflectionMergePartial(this, message, value);
11899
+ return message;
11900
+ }
11901
+ internalBinaryRead(reader, length, options, target) {
11902
+ let message = target ?? this.create(), end = reader.pos + length;
11903
+ while (reader.pos < end) {
11904
+ let [fieldNo, wireType] = reader.tag();
11905
+ switch (fieldNo) {
11906
+ case 1:
11907
+ message.space = Space.internalBinaryRead(reader, reader.uint32(), options, message.space);
11908
+ break;
11909
+ case 2:
11910
+ message.member = Member.internalBinaryRead(reader, reader.uint32(), options, message.member);
11911
+ break;
11912
+ case 3:
11913
+ message.alreadyMember = reader.bool();
11914
+ break;
11915
+ default:
11916
+ let u = options.readUnknownField;
11917
+ if (u === "throw")
11918
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
11919
+ let d = reader.skip(wireType);
11920
+ if (u !== false)
11921
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
11922
+ }
11923
+ }
11924
+ return message;
11925
+ }
11926
+ internalBinaryWrite(message, writer, options) {
11927
+ if (message.space)
11928
+ Space.internalBinaryWrite(message.space, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
11929
+ if (message.member)
11930
+ Member.internalBinaryWrite(message.member, writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
11931
+ if (message.alreadyMember !== false)
11932
+ writer.tag(3, import_runtime.WireType.Varint).bool(message.alreadyMember);
11933
+ let u = options.writeUnknownFields;
11934
+ if (u !== false)
11935
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
11936
+ return writer;
11937
+ }
11938
+ }
11939
+ var JoinSpaceByInviteTokenResult = new JoinSpaceByInviteTokenResult$Type;
11940
+
11941
+ class GetSpaceInviteLinkInput$Type extends import_runtime4.MessageType {
11942
+ constructor() {
11943
+ super("GetSpaceInviteLinkInput", [
11944
+ { no: 1, name: "space_id", kind: "scalar", T: 3, L: 0 }
11945
+ ]);
11946
+ }
11947
+ create(value) {
11948
+ const message = globalThis.Object.create(this.messagePrototype);
11949
+ message.spaceId = 0n;
11950
+ if (value !== undefined)
11951
+ import_runtime3.reflectionMergePartial(this, message, value);
11952
+ return message;
11953
+ }
11954
+ internalBinaryRead(reader, length, options, target) {
11955
+ let message = target ?? this.create(), end = reader.pos + length;
11956
+ while (reader.pos < end) {
11957
+ let [fieldNo, wireType] = reader.tag();
11958
+ switch (fieldNo) {
11959
+ case 1:
11960
+ message.spaceId = reader.int64().toBigInt();
11961
+ break;
11962
+ default:
11963
+ let u = options.readUnknownField;
11964
+ if (u === "throw")
11965
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
11966
+ let d = reader.skip(wireType);
11967
+ if (u !== false)
11968
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
11969
+ }
11970
+ }
11971
+ return message;
11972
+ }
11973
+ internalBinaryWrite(message, writer, options) {
11974
+ if (message.spaceId !== 0n)
11975
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.spaceId);
11976
+ let u = options.writeUnknownFields;
11977
+ if (u !== false)
11978
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
11979
+ return writer;
11980
+ }
11981
+ }
11982
+ var GetSpaceInviteLinkInput = new GetSpaceInviteLinkInput$Type;
11983
+
11984
+ class GetSpaceInviteLinkResult$Type extends import_runtime4.MessageType {
11985
+ constructor() {
11986
+ super("GetSpaceInviteLinkResult", [
11987
+ { no: 1, name: "link", kind: "message", T: () => SpaceInviteLink }
11988
+ ]);
11989
+ }
11990
+ create(value) {
11991
+ const message = globalThis.Object.create(this.messagePrototype);
11992
+ if (value !== undefined)
11993
+ import_runtime3.reflectionMergePartial(this, message, value);
11994
+ return message;
11995
+ }
11996
+ internalBinaryRead(reader, length, options, target) {
11997
+ let message = target ?? this.create(), end = reader.pos + length;
11998
+ while (reader.pos < end) {
11999
+ let [fieldNo, wireType] = reader.tag();
12000
+ switch (fieldNo) {
12001
+ case 1:
12002
+ message.link = SpaceInviteLink.internalBinaryRead(reader, reader.uint32(), options, message.link);
12003
+ break;
12004
+ default:
12005
+ let u = options.readUnknownField;
12006
+ if (u === "throw")
12007
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
12008
+ let d = reader.skip(wireType);
12009
+ if (u !== false)
12010
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
12011
+ }
12012
+ }
12013
+ return message;
12014
+ }
12015
+ internalBinaryWrite(message, writer, options) {
12016
+ if (message.link)
12017
+ SpaceInviteLink.internalBinaryWrite(message.link, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
12018
+ let u = options.writeUnknownFields;
12019
+ if (u !== false)
12020
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
12021
+ return writer;
12022
+ }
12023
+ }
12024
+ var GetSpaceInviteLinkResult = new GetSpaceInviteLinkResult$Type;
12025
+
12026
+ class SetSpaceInviteLinkEnabledInput$Type extends import_runtime4.MessageType {
12027
+ constructor() {
12028
+ super("SetSpaceInviteLinkEnabledInput", [
12029
+ { no: 1, name: "space_id", kind: "scalar", T: 3, L: 0 },
12030
+ { no: 2, name: "enabled", kind: "scalar", T: 8 }
12031
+ ]);
12032
+ }
12033
+ create(value) {
12034
+ const message = globalThis.Object.create(this.messagePrototype);
12035
+ message.spaceId = 0n;
12036
+ message.enabled = false;
12037
+ if (value !== undefined)
12038
+ import_runtime3.reflectionMergePartial(this, message, value);
12039
+ return message;
12040
+ }
12041
+ internalBinaryRead(reader, length, options, target) {
12042
+ let message = target ?? this.create(), end = reader.pos + length;
12043
+ while (reader.pos < end) {
12044
+ let [fieldNo, wireType] = reader.tag();
12045
+ switch (fieldNo) {
12046
+ case 1:
12047
+ message.spaceId = reader.int64().toBigInt();
12048
+ break;
12049
+ case 2:
12050
+ message.enabled = reader.bool();
12051
+ break;
12052
+ default:
12053
+ let u = options.readUnknownField;
12054
+ if (u === "throw")
12055
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
12056
+ let d = reader.skip(wireType);
12057
+ if (u !== false)
12058
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
12059
+ }
12060
+ }
12061
+ return message;
12062
+ }
12063
+ internalBinaryWrite(message, writer, options) {
12064
+ if (message.spaceId !== 0n)
12065
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.spaceId);
12066
+ if (message.enabled !== false)
12067
+ writer.tag(2, import_runtime.WireType.Varint).bool(message.enabled);
12068
+ let u = options.writeUnknownFields;
12069
+ if (u !== false)
12070
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
12071
+ return writer;
12072
+ }
12073
+ }
12074
+ var SetSpaceInviteLinkEnabledInput = new SetSpaceInviteLinkEnabledInput$Type;
12075
+
12076
+ class SetSpaceInviteLinkEnabledResult$Type extends import_runtime4.MessageType {
12077
+ constructor() {
12078
+ super("SetSpaceInviteLinkEnabledResult", [
12079
+ { no: 1, name: "link", kind: "message", T: () => SpaceInviteLink }
12080
+ ]);
12081
+ }
12082
+ create(value) {
12083
+ const message = globalThis.Object.create(this.messagePrototype);
12084
+ if (value !== undefined)
12085
+ import_runtime3.reflectionMergePartial(this, message, value);
12086
+ return message;
12087
+ }
12088
+ internalBinaryRead(reader, length, options, target) {
12089
+ let message = target ?? this.create(), end = reader.pos + length;
12090
+ while (reader.pos < end) {
12091
+ let [fieldNo, wireType] = reader.tag();
12092
+ switch (fieldNo) {
12093
+ case 1:
12094
+ message.link = SpaceInviteLink.internalBinaryRead(reader, reader.uint32(), options, message.link);
12095
+ break;
12096
+ default:
12097
+ let u = options.readUnknownField;
12098
+ if (u === "throw")
12099
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
12100
+ let d = reader.skip(wireType);
12101
+ if (u !== false)
12102
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
12103
+ }
12104
+ }
12105
+ return message;
12106
+ }
12107
+ internalBinaryWrite(message, writer, options) {
12108
+ if (message.link)
12109
+ SpaceInviteLink.internalBinaryWrite(message.link, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
12110
+ let u = options.writeUnknownFields;
12111
+ if (u !== false)
12112
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
12113
+ return writer;
12114
+ }
12115
+ }
12116
+ var SetSpaceInviteLinkEnabledResult = new SetSpaceInviteLinkEnabledResult$Type;
12117
+
11498
12118
  class UserGroup$Type extends import_runtime4.MessageType {
11499
12119
  constructor() {
11500
12120
  super("UserGroup", [
@@ -12673,7 +13293,8 @@ class Video$Type extends import_runtime4.MessageType {
12673
13293
  { no: 7, name: "photo", kind: "message", T: () => Photo },
12674
13294
  { no: 8, name: "cdn_url", kind: "scalar", opt: true, T: 9 },
12675
13295
  { no: 9, name: "is_animated", kind: "scalar", opt: true, T: 8 },
12676
- { no: 10, name: "has_audio", kind: "scalar", opt: true, T: 8 }
13296
+ { no: 10, name: "has_audio", kind: "scalar", opt: true, T: 8 },
13297
+ { no: 100, name: "file_unique_id", kind: "scalar", opt: true, T: 9 }
12677
13298
  ]);
12678
13299
  }
12679
13300
  create(value) {
@@ -12723,6 +13344,9 @@ class Video$Type extends import_runtime4.MessageType {
12723
13344
  case 10:
12724
13345
  message.hasAudio = reader.bool();
12725
13346
  break;
13347
+ case 100:
13348
+ message.fileUniqueId = reader.string();
13349
+ break;
12726
13350
  default:
12727
13351
  let u = options.readUnknownField;
12728
13352
  if (u === "throw")
@@ -12755,6 +13379,8 @@ class Video$Type extends import_runtime4.MessageType {
12755
13379
  writer.tag(9, import_runtime.WireType.Varint).bool(message.isAnimated);
12756
13380
  if (message.hasAudio !== undefined)
12757
13381
  writer.tag(10, import_runtime.WireType.Varint).bool(message.hasAudio);
13382
+ if (message.fileUniqueId !== undefined)
13383
+ writer.tag(100, import_runtime.WireType.LengthDelimited).string(message.fileUniqueId);
12758
13384
  let u = options.writeUnknownFields;
12759
13385
  if (u !== false)
12760
13386
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -12772,7 +13398,8 @@ class Document$Type extends import_runtime4.MessageType {
12772
13398
  { no: 4, name: "size", kind: "scalar", T: 5 },
12773
13399
  { no: 5, name: "cdn_url", kind: "scalar", opt: true, T: 9 },
12774
13400
  { no: 6, name: "date", kind: "scalar", T: 3, L: 0 },
12775
- { no: 7, name: "photo", kind: "message", T: () => Photo }
13401
+ { no: 7, name: "photo", kind: "message", T: () => Photo },
13402
+ { no: 100, name: "file_unique_id", kind: "scalar", opt: true, T: 9 }
12776
13403
  ]);
12777
13404
  }
12778
13405
  create(value) {
@@ -12812,6 +13439,9 @@ class Document$Type extends import_runtime4.MessageType {
12812
13439
  case 7:
12813
13440
  message.photo = Photo.internalBinaryRead(reader, reader.uint32(), options, message.photo);
12814
13441
  break;
13442
+ case 100:
13443
+ message.fileUniqueId = reader.string();
13444
+ break;
12815
13445
  default:
12816
13446
  let u = options.readUnknownField;
12817
13447
  if (u === "throw")
@@ -12838,6 +13468,8 @@ class Document$Type extends import_runtime4.MessageType {
12838
13468
  writer.tag(6, import_runtime.WireType.Varint).int64(message.date);
12839
13469
  if (message.photo)
12840
13470
  Photo.internalBinaryWrite(message.photo, writer.tag(7, import_runtime.WireType.LengthDelimited).fork(), options).join();
13471
+ if (message.fileUniqueId !== undefined)
13472
+ writer.tag(100, import_runtime.WireType.LengthDelimited).string(message.fileUniqueId);
12841
13473
  let u = options.writeUnknownFields;
12842
13474
  if (u !== false)
12843
13475
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -12855,7 +13487,8 @@ class Voice$Type extends import_runtime4.MessageType {
12855
13487
  { no: 4, name: "size", kind: "scalar", T: 5 },
12856
13488
  { no: 5, name: "mime_type", kind: "scalar", T: 9 },
12857
13489
  { no: 6, name: "cdn_url", kind: "scalar", opt: true, T: 9 },
12858
- { no: 7, name: "waveform", kind: "scalar", T: 12 }
13490
+ { no: 7, name: "waveform", kind: "scalar", T: 12 },
13491
+ { no: 100, name: "file_unique_id", kind: "scalar", opt: true, T: 9 }
12859
13492
  ]);
12860
13493
  }
12861
13494
  create(value) {
@@ -12896,6 +13529,9 @@ class Voice$Type extends import_runtime4.MessageType {
12896
13529
  case 7:
12897
13530
  message.waveform = reader.bytes();
12898
13531
  break;
13532
+ case 100:
13533
+ message.fileUniqueId = reader.string();
13534
+ break;
12899
13535
  default:
12900
13536
  let u = options.readUnknownField;
12901
13537
  if (u === "throw")
@@ -12922,6 +13558,8 @@ class Voice$Type extends import_runtime4.MessageType {
12922
13558
  writer.tag(6, import_runtime.WireType.LengthDelimited).string(message.cdnUrl);
12923
13559
  if (message.waveform.length)
12924
13560
  writer.tag(7, import_runtime.WireType.LengthDelimited).bytes(message.waveform);
13561
+ if (message.fileUniqueId !== undefined)
13562
+ writer.tag(100, import_runtime.WireType.LengthDelimited).string(message.fileUniqueId);
12925
13563
  let u = options.writeUnknownFields;
12926
13564
  if (u !== false)
12927
13565
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -13003,6 +13641,7 @@ var Photo = new Photo$Type;
13003
13641
  class PhotoSize$Type extends import_runtime4.MessageType {
13004
13642
  constructor() {
13005
13643
  super("PhotoSize", [
13644
+ { no: 100, name: "file_unique_id", kind: "scalar", opt: true, T: 9 },
13006
13645
  { no: 1, name: "type", kind: "scalar", T: 9 },
13007
13646
  { no: 2, name: "w", kind: "scalar", T: 5 },
13008
13647
  { no: 3, name: "h", kind: "scalar", T: 5 },
@@ -13026,6 +13665,9 @@ class PhotoSize$Type extends import_runtime4.MessageType {
13026
13665
  while (reader.pos < end) {
13027
13666
  let [fieldNo, wireType] = reader.tag();
13028
13667
  switch (fieldNo) {
13668
+ case 100:
13669
+ message.fileUniqueId = reader.string();
13670
+ break;
13029
13671
  case 1:
13030
13672
  message.type = reader.string();
13031
13673
  break;
@@ -13056,6 +13698,8 @@ class PhotoSize$Type extends import_runtime4.MessageType {
13056
13698
  return message;
13057
13699
  }
13058
13700
  internalBinaryWrite(message, writer, options) {
13701
+ if (message.fileUniqueId !== undefined)
13702
+ writer.tag(100, import_runtime.WireType.LengthDelimited).string(message.fileUniqueId);
13059
13703
  if (message.type !== "")
13060
13704
  writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.type);
13061
13705
  if (message.w !== 0)
@@ -13274,7 +13918,15 @@ class RpcCall$Type extends import_runtime4.MessageType {
13274
13918
  { no: 130, name: "syncAgentSessionMessages", kind: "message", oneof: "input", T: () => SyncAgentSessionMessagesInput },
13275
13919
  { no: 131, name: "getAgentSession", kind: "message", oneof: "input", T: () => GetAgentSessionInput },
13276
13920
  { no: 132, name: "updateBotAgent", kind: "message", oneof: "input", T: () => UpdateBotAgentInput },
13277
- { no: 133, name: "deleteBotAgent", kind: "message", oneof: "input", T: () => DeleteBotAgentInput }
13921
+ { no: 133, name: "deleteBotAgent", kind: "message", oneof: "input", T: () => DeleteBotAgentInput },
13922
+ { no: 134, name: "joinSpaceByInviteToken", kind: "message", oneof: "input", T: () => JoinSpaceByInviteTokenInput },
13923
+ { no: 135, name: "getSpaceInviteLink", kind: "message", oneof: "input", T: () => GetSpaceInviteLinkInput },
13924
+ { no: 136, name: "setSpaceInviteLinkEnabled", kind: "message", oneof: "input", T: () => SetSpaceInviteLinkEnabledInput },
13925
+ { no: 137, name: "getFilePart", kind: "message", oneof: "input", T: () => GetFilePartInput },
13926
+ { no: 138, name: "acknowledgeMessages", kind: "message", oneof: "input", T: () => AcknowledgeMessagesInput },
13927
+ { no: 139, name: "getUsers", kind: "message", oneof: "input", T: () => GetUsersInput },
13928
+ { no: 140, name: "getBotSkills", kind: "message", oneof: "input", T: () => GetBotSkillsInput },
13929
+ { no: 141, name: "getBotConfigurationCatalog", kind: "message", oneof: "input", T: () => GetBotConfigurationCatalogInput }
13278
13930
  ]);
13279
13931
  }
13280
13932
  create(value) {
@@ -14079,6 +14731,54 @@ class RpcCall$Type extends import_runtime4.MessageType {
14079
14731
  deleteBotAgent: DeleteBotAgentInput.internalBinaryRead(reader, reader.uint32(), options, message.input.deleteBotAgent)
14080
14732
  };
14081
14733
  break;
14734
+ case 134:
14735
+ message.input = {
14736
+ oneofKind: "joinSpaceByInviteToken",
14737
+ joinSpaceByInviteToken: JoinSpaceByInviteTokenInput.internalBinaryRead(reader, reader.uint32(), options, message.input.joinSpaceByInviteToken)
14738
+ };
14739
+ break;
14740
+ case 135:
14741
+ message.input = {
14742
+ oneofKind: "getSpaceInviteLink",
14743
+ getSpaceInviteLink: GetSpaceInviteLinkInput.internalBinaryRead(reader, reader.uint32(), options, message.input.getSpaceInviteLink)
14744
+ };
14745
+ break;
14746
+ case 136:
14747
+ message.input = {
14748
+ oneofKind: "setSpaceInviteLinkEnabled",
14749
+ setSpaceInviteLinkEnabled: SetSpaceInviteLinkEnabledInput.internalBinaryRead(reader, reader.uint32(), options, message.input.setSpaceInviteLinkEnabled)
14750
+ };
14751
+ break;
14752
+ case 137:
14753
+ message.input = {
14754
+ oneofKind: "getFilePart",
14755
+ getFilePart: GetFilePartInput.internalBinaryRead(reader, reader.uint32(), options, message.input.getFilePart)
14756
+ };
14757
+ break;
14758
+ case 138:
14759
+ message.input = {
14760
+ oneofKind: "acknowledgeMessages",
14761
+ acknowledgeMessages: AcknowledgeMessagesInput.internalBinaryRead(reader, reader.uint32(), options, message.input.acknowledgeMessages)
14762
+ };
14763
+ break;
14764
+ case 139:
14765
+ message.input = {
14766
+ oneofKind: "getUsers",
14767
+ getUsers: GetUsersInput.internalBinaryRead(reader, reader.uint32(), options, message.input.getUsers)
14768
+ };
14769
+ break;
14770
+ case 140:
14771
+ message.input = {
14772
+ oneofKind: "getBotSkills",
14773
+ getBotSkills: GetBotSkillsInput.internalBinaryRead(reader, reader.uint32(), options, message.input.getBotSkills)
14774
+ };
14775
+ break;
14776
+ case 141:
14777
+ message.input = {
14778
+ oneofKind: "getBotConfigurationCatalog",
14779
+ getBotConfigurationCatalog: GetBotConfigurationCatalogInput.internalBinaryRead(reader, reader.uint32(), options, message.input.getBotConfigurationCatalog)
14780
+ };
14781
+ break;
14082
14782
  default:
14083
14783
  let u = options.readUnknownField;
14084
14784
  if (u === "throw")
@@ -14355,6 +15055,22 @@ class RpcCall$Type extends import_runtime4.MessageType {
14355
15055
  UpdateBotAgentInput.internalBinaryWrite(message.input.updateBotAgent, writer.tag(132, import_runtime.WireType.LengthDelimited).fork(), options).join();
14356
15056
  if (message.input.oneofKind === "deleteBotAgent")
14357
15057
  DeleteBotAgentInput.internalBinaryWrite(message.input.deleteBotAgent, writer.tag(133, import_runtime.WireType.LengthDelimited).fork(), options).join();
15058
+ if (message.input.oneofKind === "joinSpaceByInviteToken")
15059
+ JoinSpaceByInviteTokenInput.internalBinaryWrite(message.input.joinSpaceByInviteToken, writer.tag(134, import_runtime.WireType.LengthDelimited).fork(), options).join();
15060
+ if (message.input.oneofKind === "getSpaceInviteLink")
15061
+ GetSpaceInviteLinkInput.internalBinaryWrite(message.input.getSpaceInviteLink, writer.tag(135, import_runtime.WireType.LengthDelimited).fork(), options).join();
15062
+ if (message.input.oneofKind === "setSpaceInviteLinkEnabled")
15063
+ SetSpaceInviteLinkEnabledInput.internalBinaryWrite(message.input.setSpaceInviteLinkEnabled, writer.tag(136, import_runtime.WireType.LengthDelimited).fork(), options).join();
15064
+ if (message.input.oneofKind === "getFilePart")
15065
+ GetFilePartInput.internalBinaryWrite(message.input.getFilePart, writer.tag(137, import_runtime.WireType.LengthDelimited).fork(), options).join();
15066
+ if (message.input.oneofKind === "acknowledgeMessages")
15067
+ AcknowledgeMessagesInput.internalBinaryWrite(message.input.acknowledgeMessages, writer.tag(138, import_runtime.WireType.LengthDelimited).fork(), options).join();
15068
+ if (message.input.oneofKind === "getUsers")
15069
+ GetUsersInput.internalBinaryWrite(message.input.getUsers, writer.tag(139, import_runtime.WireType.LengthDelimited).fork(), options).join();
15070
+ if (message.input.oneofKind === "getBotSkills")
15071
+ GetBotSkillsInput.internalBinaryWrite(message.input.getBotSkills, writer.tag(140, import_runtime.WireType.LengthDelimited).fork(), options).join();
15072
+ if (message.input.oneofKind === "getBotConfigurationCatalog")
15073
+ GetBotConfigurationCatalogInput.internalBinaryWrite(message.input.getBotConfigurationCatalog, writer.tag(141, import_runtime.WireType.LengthDelimited).fork(), options).join();
14358
15074
  let u = options.writeUnknownFields;
14359
15075
  if (u !== false)
14360
15076
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -14497,7 +15213,15 @@ class RpcResult$Type extends import_runtime4.MessageType {
14497
15213
  { no: 130, name: "syncAgentSessionMessages", kind: "message", oneof: "result", T: () => SyncAgentSessionMessagesResult },
14498
15214
  { no: 131, name: "getAgentSession", kind: "message", oneof: "result", T: () => GetAgentSessionResult },
14499
15215
  { no: 132, name: "updateBotAgent", kind: "message", oneof: "result", T: () => UpdateBotAgentResult },
14500
- { no: 133, name: "deleteBotAgent", kind: "message", oneof: "result", T: () => DeleteBotAgentResult }
15216
+ { no: 133, name: "deleteBotAgent", kind: "message", oneof: "result", T: () => DeleteBotAgentResult },
15217
+ { no: 134, name: "joinSpaceByInviteToken", kind: "message", oneof: "result", T: () => JoinSpaceByInviteTokenResult },
15218
+ { no: 135, name: "getSpaceInviteLink", kind: "message", oneof: "result", T: () => GetSpaceInviteLinkResult },
15219
+ { no: 136, name: "setSpaceInviteLinkEnabled", kind: "message", oneof: "result", T: () => SetSpaceInviteLinkEnabledResult },
15220
+ { no: 137, name: "getFilePart", kind: "message", oneof: "result", T: () => GetFilePartResult },
15221
+ { no: 138, name: "acknowledgeMessages", kind: "message", oneof: "result", T: () => AcknowledgeMessagesResult },
15222
+ { no: 139, name: "getUsers", kind: "message", oneof: "result", T: () => GetUsersResult },
15223
+ { no: 140, name: "getBotSkills", kind: "message", oneof: "result", T: () => GetBotSkillsResult },
15224
+ { no: 141, name: "getBotConfigurationCatalog", kind: "message", oneof: "result", T: () => GetBotConfigurationCatalogResult }
14501
15225
  ]);
14502
15226
  }
14503
15227
  create(value) {
@@ -15302,6 +16026,54 @@ class RpcResult$Type extends import_runtime4.MessageType {
15302
16026
  deleteBotAgent: DeleteBotAgentResult.internalBinaryRead(reader, reader.uint32(), options, message.result.deleteBotAgent)
15303
16027
  };
15304
16028
  break;
16029
+ case 134:
16030
+ message.result = {
16031
+ oneofKind: "joinSpaceByInviteToken",
16032
+ joinSpaceByInviteToken: JoinSpaceByInviteTokenResult.internalBinaryRead(reader, reader.uint32(), options, message.result.joinSpaceByInviteToken)
16033
+ };
16034
+ break;
16035
+ case 135:
16036
+ message.result = {
16037
+ oneofKind: "getSpaceInviteLink",
16038
+ getSpaceInviteLink: GetSpaceInviteLinkResult.internalBinaryRead(reader, reader.uint32(), options, message.result.getSpaceInviteLink)
16039
+ };
16040
+ break;
16041
+ case 136:
16042
+ message.result = {
16043
+ oneofKind: "setSpaceInviteLinkEnabled",
16044
+ setSpaceInviteLinkEnabled: SetSpaceInviteLinkEnabledResult.internalBinaryRead(reader, reader.uint32(), options, message.result.setSpaceInviteLinkEnabled)
16045
+ };
16046
+ break;
16047
+ case 137:
16048
+ message.result = {
16049
+ oneofKind: "getFilePart",
16050
+ getFilePart: GetFilePartResult.internalBinaryRead(reader, reader.uint32(), options, message.result.getFilePart)
16051
+ };
16052
+ break;
16053
+ case 138:
16054
+ message.result = {
16055
+ oneofKind: "acknowledgeMessages",
16056
+ acknowledgeMessages: AcknowledgeMessagesResult.internalBinaryRead(reader, reader.uint32(), options, message.result.acknowledgeMessages)
16057
+ };
16058
+ break;
16059
+ case 139:
16060
+ message.result = {
16061
+ oneofKind: "getUsers",
16062
+ getUsers: GetUsersResult.internalBinaryRead(reader, reader.uint32(), options, message.result.getUsers)
16063
+ };
16064
+ break;
16065
+ case 140:
16066
+ message.result = {
16067
+ oneofKind: "getBotSkills",
16068
+ getBotSkills: GetBotSkillsResult.internalBinaryRead(reader, reader.uint32(), options, message.result.getBotSkills)
16069
+ };
16070
+ break;
16071
+ case 141:
16072
+ message.result = {
16073
+ oneofKind: "getBotConfigurationCatalog",
16074
+ getBotConfigurationCatalog: GetBotConfigurationCatalogResult.internalBinaryRead(reader, reader.uint32(), options, message.result.getBotConfigurationCatalog)
16075
+ };
16076
+ break;
15305
16077
  default:
15306
16078
  let u = options.readUnknownField;
15307
16079
  if (u === "throw")
@@ -15578,6 +16350,22 @@ class RpcResult$Type extends import_runtime4.MessageType {
15578
16350
  UpdateBotAgentResult.internalBinaryWrite(message.result.updateBotAgent, writer.tag(132, import_runtime.WireType.LengthDelimited).fork(), options).join();
15579
16351
  if (message.result.oneofKind === "deleteBotAgent")
15580
16352
  DeleteBotAgentResult.internalBinaryWrite(message.result.deleteBotAgent, writer.tag(133, import_runtime.WireType.LengthDelimited).fork(), options).join();
16353
+ if (message.result.oneofKind === "joinSpaceByInviteToken")
16354
+ JoinSpaceByInviteTokenResult.internalBinaryWrite(message.result.joinSpaceByInviteToken, writer.tag(134, import_runtime.WireType.LengthDelimited).fork(), options).join();
16355
+ if (message.result.oneofKind === "getSpaceInviteLink")
16356
+ GetSpaceInviteLinkResult.internalBinaryWrite(message.result.getSpaceInviteLink, writer.tag(135, import_runtime.WireType.LengthDelimited).fork(), options).join();
16357
+ if (message.result.oneofKind === "setSpaceInviteLinkEnabled")
16358
+ SetSpaceInviteLinkEnabledResult.internalBinaryWrite(message.result.setSpaceInviteLinkEnabled, writer.tag(136, import_runtime.WireType.LengthDelimited).fork(), options).join();
16359
+ if (message.result.oneofKind === "getFilePart")
16360
+ GetFilePartResult.internalBinaryWrite(message.result.getFilePart, writer.tag(137, import_runtime.WireType.LengthDelimited).fork(), options).join();
16361
+ if (message.result.oneofKind === "acknowledgeMessages")
16362
+ AcknowledgeMessagesResult.internalBinaryWrite(message.result.acknowledgeMessages, writer.tag(138, import_runtime.WireType.LengthDelimited).fork(), options).join();
16363
+ if (message.result.oneofKind === "getUsers")
16364
+ GetUsersResult.internalBinaryWrite(message.result.getUsers, writer.tag(139, import_runtime.WireType.LengthDelimited).fork(), options).join();
16365
+ if (message.result.oneofKind === "getBotSkills")
16366
+ GetBotSkillsResult.internalBinaryWrite(message.result.getBotSkills, writer.tag(140, import_runtime.WireType.LengthDelimited).fork(), options).join();
16367
+ if (message.result.oneofKind === "getBotConfigurationCatalog")
16368
+ GetBotConfigurationCatalogResult.internalBinaryWrite(message.result.getBotConfigurationCatalog, writer.tag(141, import_runtime.WireType.LengthDelimited).fork(), options).join();
15581
16369
  let u = options.writeUnknownFields;
15582
16370
  if (u !== false)
15583
16371
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -16035,13 +16823,15 @@ class DeleteMemberInput$Type extends import_runtime4.MessageType {
16035
16823
  constructor() {
16036
16824
  super("DeleteMemberInput", [
16037
16825
  { no: 1, name: "space_id", kind: "scalar", T: 3, L: 0 },
16038
- { no: 2, name: "user_id", kind: "scalar", T: 3, L: 0 }
16826
+ { no: 2, name: "user_id", kind: "scalar", T: 3, L: 0 },
16827
+ { no: 3, name: "block_join", kind: "scalar", T: 8 }
16039
16828
  ]);
16040
16829
  }
16041
16830
  create(value) {
16042
16831
  const message = globalThis.Object.create(this.messagePrototype);
16043
16832
  message.spaceId = 0n;
16044
16833
  message.userId = 0n;
16834
+ message.blockJoin = false;
16045
16835
  if (value !== undefined)
16046
16836
  import_runtime3.reflectionMergePartial(this, message, value);
16047
16837
  return message;
@@ -16057,6 +16847,9 @@ class DeleteMemberInput$Type extends import_runtime4.MessageType {
16057
16847
  case 2:
16058
16848
  message.userId = reader.int64().toBigInt();
16059
16849
  break;
16850
+ case 3:
16851
+ message.blockJoin = reader.bool();
16852
+ break;
16060
16853
  default:
16061
16854
  let u = options.readUnknownField;
16062
16855
  if (u === "throw")
@@ -16073,6 +16866,8 @@ class DeleteMemberInput$Type extends import_runtime4.MessageType {
16073
16866
  writer.tag(1, import_runtime.WireType.Varint).int64(message.spaceId);
16074
16867
  if (message.userId !== 0n)
16075
16868
  writer.tag(2, import_runtime.WireType.Varint).int64(message.userId);
16869
+ if (message.blockJoin !== false)
16870
+ writer.tag(3, import_runtime.WireType.Varint).bool(message.blockJoin);
16076
16871
  let u = options.writeUnknownFields;
16077
16872
  if (u !== false)
16078
16873
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -18530,11 +19325,13 @@ var GetUpdatesStateResult = new GetUpdatesStateResult$Type;
18530
19325
  class GetChatInput$Type extends import_runtime4.MessageType {
18531
19326
  constructor() {
18532
19327
  super("GetChatInput", [
18533
- { no: 1, name: "peer_id", kind: "message", T: () => InputPeer }
19328
+ { no: 1, name: "peer_id", kind: "message", T: () => InputPeer },
19329
+ { no: 2, name: "include_recent_messages", kind: "scalar", T: 8 }
18534
19330
  ]);
18535
19331
  }
18536
19332
  create(value) {
18537
19333
  const message = globalThis.Object.create(this.messagePrototype);
19334
+ message.includeRecentMessages = false;
18538
19335
  if (value !== undefined)
18539
19336
  import_runtime3.reflectionMergePartial(this, message, value);
18540
19337
  return message;
@@ -18547,6 +19344,9 @@ class GetChatInput$Type extends import_runtime4.MessageType {
18547
19344
  case 1:
18548
19345
  message.peerId = InputPeer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
18549
19346
  break;
19347
+ case 2:
19348
+ message.includeRecentMessages = reader.bool();
19349
+ break;
18550
19350
  default:
18551
19351
  let u = options.readUnknownField;
18552
19352
  if (u === "throw")
@@ -18561,6 +19361,8 @@ class GetChatInput$Type extends import_runtime4.MessageType {
18561
19361
  internalBinaryWrite(message, writer, options) {
18562
19362
  if (message.peerId)
18563
19363
  InputPeer.internalBinaryWrite(message.peerId, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
19364
+ if (message.includeRecentMessages !== false)
19365
+ writer.tag(2, import_runtime.WireType.Varint).bool(message.includeRecentMessages);
18564
19366
  let u = options.writeUnknownFields;
18565
19367
  if (u !== false)
18566
19368
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -18576,12 +19378,14 @@ class GetChatResult$Type extends import_runtime4.MessageType {
18576
19378
  { no: 2, name: "dialog", kind: "message", T: () => Dialog },
18577
19379
  { no: 3, name: "pinned_message_ids", kind: "scalar", repeat: 1, T: 3, L: 0 },
18578
19380
  { no: 4, name: "anchor_message", kind: "message", T: () => Message },
18579
- { no: 5, name: "user", kind: "message", T: () => User }
19381
+ { no: 5, name: "user", kind: "message", T: () => User },
19382
+ { no: 6, name: "messages", kind: "message", repeat: 1, T: () => Message }
18580
19383
  ]);
18581
19384
  }
18582
19385
  create(value) {
18583
19386
  const message = globalThis.Object.create(this.messagePrototype);
18584
19387
  message.pinnedMessageIds = [];
19388
+ message.messages = [];
18585
19389
  if (value !== undefined)
18586
19390
  import_runtime3.reflectionMergePartial(this, message, value);
18587
19391
  return message;
@@ -18610,6 +19414,9 @@ class GetChatResult$Type extends import_runtime4.MessageType {
18610
19414
  case 5:
18611
19415
  message.user = User.internalBinaryRead(reader, reader.uint32(), options, message.user);
18612
19416
  break;
19417
+ case 6:
19418
+ message.messages.push(Message.internalBinaryRead(reader, reader.uint32(), options));
19419
+ break;
18613
19420
  default:
18614
19421
  let u = options.readUnknownField;
18615
19422
  if (u === "throw")
@@ -18636,6 +19443,8 @@ class GetChatResult$Type extends import_runtime4.MessageType {
18636
19443
  Message.internalBinaryWrite(message.anchorMessage, writer.tag(4, import_runtime.WireType.LengthDelimited).fork(), options).join();
18637
19444
  if (message.user)
18638
19445
  User.internalBinaryWrite(message.user, writer.tag(5, import_runtime.WireType.LengthDelimited).fork(), options).join();
19446
+ for (let i = 0;i < message.messages.length; i++)
19447
+ Message.internalBinaryWrite(message.messages[i], writer.tag(6, import_runtime.WireType.LengthDelimited).fork(), options).join();
18639
19448
  let u = options.writeUnknownFields;
18640
19449
  if (u !== false)
18641
19450
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -18739,7 +19548,8 @@ class UpdateDialogOpenInput$Type extends import_runtime4.MessageType {
18739
19548
  super("UpdateDialogOpenInput", [
18740
19549
  { no: 1, name: "peer_id", kind: "message", T: () => InputPeer },
18741
19550
  { no: 2, name: "open", kind: "scalar", T: 8 },
18742
- { no: 3, name: "order", kind: "scalar", opt: true, T: 9 }
19551
+ { no: 3, name: "order", kind: "scalar", opt: true, T: 9 },
19552
+ { no: 4, name: "folder_id", kind: "scalar", opt: true, T: 3, L: 0 }
18743
19553
  ]);
18744
19554
  }
18745
19555
  create(value) {
@@ -18763,6 +19573,9 @@ class UpdateDialogOpenInput$Type extends import_runtime4.MessageType {
18763
19573
  case 3:
18764
19574
  message.order = reader.string();
18765
19575
  break;
19576
+ case 4:
19577
+ message.folderId = reader.int64().toBigInt();
19578
+ break;
18766
19579
  default:
18767
19580
  let u = options.readUnknownField;
18768
19581
  if (u === "throw")
@@ -18781,6 +19594,8 @@ class UpdateDialogOpenInput$Type extends import_runtime4.MessageType {
18781
19594
  writer.tag(2, import_runtime.WireType.Varint).bool(message.open);
18782
19595
  if (message.order !== undefined)
18783
19596
  writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.order);
19597
+ if (message.folderId !== undefined)
19598
+ writer.tag(4, import_runtime.WireType.Varint).int64(message.folderId);
18784
19599
  let u = options.writeUnknownFields;
18785
19600
  if (u !== false)
18786
19601
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -21339,6 +22154,68 @@ class BotCommand$Type extends import_runtime4.MessageType {
21339
22154
  }
21340
22155
  var BotCommand = new BotCommand$Type;
21341
22156
 
22157
+ class BotSkill$Type extends import_runtime4.MessageType {
22158
+ constructor() {
22159
+ super("BotSkill", [
22160
+ { no: 1, name: "key", kind: "scalar", T: 9 },
22161
+ { no: 2, name: "name", kind: "scalar", T: 9 },
22162
+ { no: 3, name: "description", kind: "scalar", opt: true, T: 9 },
22163
+ { no: 4, name: "sort_order", kind: "scalar", opt: true, T: 5 }
22164
+ ]);
22165
+ }
22166
+ create(value) {
22167
+ const message = globalThis.Object.create(this.messagePrototype);
22168
+ message.key = "";
22169
+ message.name = "";
22170
+ if (value !== undefined)
22171
+ import_runtime3.reflectionMergePartial(this, message, value);
22172
+ return message;
22173
+ }
22174
+ internalBinaryRead(reader, length, options, target) {
22175
+ let message = target ?? this.create(), end = reader.pos + length;
22176
+ while (reader.pos < end) {
22177
+ let [fieldNo, wireType] = reader.tag();
22178
+ switch (fieldNo) {
22179
+ case 1:
22180
+ message.key = reader.string();
22181
+ break;
22182
+ case 2:
22183
+ message.name = reader.string();
22184
+ break;
22185
+ case 3:
22186
+ message.description = reader.string();
22187
+ break;
22188
+ case 4:
22189
+ message.sortOrder = reader.int32();
22190
+ break;
22191
+ default:
22192
+ let u = options.readUnknownField;
22193
+ if (u === "throw")
22194
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
22195
+ let d = reader.skip(wireType);
22196
+ if (u !== false)
22197
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
22198
+ }
22199
+ }
22200
+ return message;
22201
+ }
22202
+ internalBinaryWrite(message, writer, options) {
22203
+ if (message.key !== "")
22204
+ writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.key);
22205
+ if (message.name !== "")
22206
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.name);
22207
+ if (message.description !== undefined)
22208
+ writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.description);
22209
+ if (message.sortOrder !== undefined)
22210
+ writer.tag(4, import_runtime.WireType.Varint).int32(message.sortOrder);
22211
+ let u = options.writeUnknownFields;
22212
+ if (u !== false)
22213
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
22214
+ return writer;
22215
+ }
22216
+ }
22217
+ var BotSkill = new BotSkill$Type;
22218
+
21342
22219
  class PeerBotCommands$Type extends import_runtime4.MessageType {
21343
22220
  constructor() {
21344
22221
  super("PeerBotCommands", [
@@ -21567,6 +22444,183 @@ class SetBotCommandsResult$Type extends import_runtime4.MessageType {
21567
22444
  }
21568
22445
  var SetBotCommandsResult = new SetBotCommandsResult$Type;
21569
22446
 
22447
+ class GetBotSkillsInput$Type extends import_runtime4.MessageType {
22448
+ constructor() {
22449
+ super("GetBotSkillsInput", [
22450
+ { no: 1, name: "bot_user_id", kind: "scalar", T: 3, L: 0 }
22451
+ ]);
22452
+ }
22453
+ create(value) {
22454
+ const message = globalThis.Object.create(this.messagePrototype);
22455
+ message.botUserId = 0n;
22456
+ if (value !== undefined)
22457
+ import_runtime3.reflectionMergePartial(this, message, value);
22458
+ return message;
22459
+ }
22460
+ internalBinaryRead(reader, length, options, target) {
22461
+ let message = target ?? this.create(), end = reader.pos + length;
22462
+ while (reader.pos < end) {
22463
+ let [fieldNo, wireType] = reader.tag();
22464
+ switch (fieldNo) {
22465
+ case 1:
22466
+ message.botUserId = reader.int64().toBigInt();
22467
+ break;
22468
+ default:
22469
+ let u = options.readUnknownField;
22470
+ if (u === "throw")
22471
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
22472
+ let d = reader.skip(wireType);
22473
+ if (u !== false)
22474
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
22475
+ }
22476
+ }
22477
+ return message;
22478
+ }
22479
+ internalBinaryWrite(message, writer, options) {
22480
+ if (message.botUserId !== 0n)
22481
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.botUserId);
22482
+ let u = options.writeUnknownFields;
22483
+ if (u !== false)
22484
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
22485
+ return writer;
22486
+ }
22487
+ }
22488
+ var GetBotSkillsInput = new GetBotSkillsInput$Type;
22489
+
22490
+ class GetBotSkillsResult$Type extends import_runtime4.MessageType {
22491
+ constructor() {
22492
+ super("GetBotSkillsResult", [
22493
+ { no: 1, name: "skills", kind: "message", repeat: 1, T: () => BotSkill }
22494
+ ]);
22495
+ }
22496
+ create(value) {
22497
+ const message = globalThis.Object.create(this.messagePrototype);
22498
+ message.skills = [];
22499
+ if (value !== undefined)
22500
+ import_runtime3.reflectionMergePartial(this, message, value);
22501
+ return message;
22502
+ }
22503
+ internalBinaryRead(reader, length, options, target) {
22504
+ let message = target ?? this.create(), end = reader.pos + length;
22505
+ while (reader.pos < end) {
22506
+ let [fieldNo, wireType] = reader.tag();
22507
+ switch (fieldNo) {
22508
+ case 1:
22509
+ message.skills.push(BotSkill.internalBinaryRead(reader, reader.uint32(), options));
22510
+ break;
22511
+ default:
22512
+ let u = options.readUnknownField;
22513
+ if (u === "throw")
22514
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
22515
+ let d = reader.skip(wireType);
22516
+ if (u !== false)
22517
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
22518
+ }
22519
+ }
22520
+ return message;
22521
+ }
22522
+ internalBinaryWrite(message, writer, options) {
22523
+ for (let i = 0;i < message.skills.length; i++)
22524
+ BotSkill.internalBinaryWrite(message.skills[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
22525
+ let u = options.writeUnknownFields;
22526
+ if (u !== false)
22527
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
22528
+ return writer;
22529
+ }
22530
+ }
22531
+ var GetBotSkillsResult = new GetBotSkillsResult$Type;
22532
+
22533
+ class GetBotConfigurationCatalogInput$Type extends import_runtime4.MessageType {
22534
+ constructor() {
22535
+ super("GetBotConfigurationCatalogInput", [
22536
+ { no: 1, name: "bot_user_id", kind: "scalar", T: 3, L: 0 },
22537
+ { no: 2, name: "peer_id", kind: "message", T: () => InputPeer }
22538
+ ]);
22539
+ }
22540
+ create(value) {
22541
+ const message = globalThis.Object.create(this.messagePrototype);
22542
+ message.botUserId = 0n;
22543
+ if (value !== undefined)
22544
+ import_runtime3.reflectionMergePartial(this, message, value);
22545
+ return message;
22546
+ }
22547
+ internalBinaryRead(reader, length, options, target) {
22548
+ let message = target ?? this.create(), end = reader.pos + length;
22549
+ while (reader.pos < end) {
22550
+ let [fieldNo, wireType] = reader.tag();
22551
+ switch (fieldNo) {
22552
+ case 1:
22553
+ message.botUserId = reader.int64().toBigInt();
22554
+ break;
22555
+ case 2:
22556
+ message.peerId = InputPeer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
22557
+ break;
22558
+ default:
22559
+ let u = options.readUnknownField;
22560
+ if (u === "throw")
22561
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
22562
+ let d = reader.skip(wireType);
22563
+ if (u !== false)
22564
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
22565
+ }
22566
+ }
22567
+ return message;
22568
+ }
22569
+ internalBinaryWrite(message, writer, options) {
22570
+ if (message.botUserId !== 0n)
22571
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.botUserId);
22572
+ if (message.peerId)
22573
+ InputPeer.internalBinaryWrite(message.peerId, writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
22574
+ let u = options.writeUnknownFields;
22575
+ if (u !== false)
22576
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
22577
+ return writer;
22578
+ }
22579
+ }
22580
+ var GetBotConfigurationCatalogInput = new GetBotConfigurationCatalogInput$Type;
22581
+
22582
+ class GetBotConfigurationCatalogResult$Type extends import_runtime4.MessageType {
22583
+ constructor() {
22584
+ super("GetBotConfigurationCatalogResult", [
22585
+ { no: 1, name: "catalog", kind: "message", T: () => AgentConfigurationCatalog }
22586
+ ]);
22587
+ }
22588
+ create(value) {
22589
+ const message = globalThis.Object.create(this.messagePrototype);
22590
+ if (value !== undefined)
22591
+ import_runtime3.reflectionMergePartial(this, message, value);
22592
+ return message;
22593
+ }
22594
+ internalBinaryRead(reader, length, options, target) {
22595
+ let message = target ?? this.create(), end = reader.pos + length;
22596
+ while (reader.pos < end) {
22597
+ let [fieldNo, wireType] = reader.tag();
22598
+ switch (fieldNo) {
22599
+ case 1:
22600
+ message.catalog = AgentConfigurationCatalog.internalBinaryRead(reader, reader.uint32(), options, message.catalog);
22601
+ break;
22602
+ default:
22603
+ let u = options.readUnknownField;
22604
+ if (u === "throw")
22605
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
22606
+ let d = reader.skip(wireType);
22607
+ if (u !== false)
22608
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
22609
+ }
22610
+ }
22611
+ return message;
22612
+ }
22613
+ internalBinaryWrite(message, writer, options) {
22614
+ if (message.catalog)
22615
+ AgentConfigurationCatalog.internalBinaryWrite(message.catalog, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
22616
+ let u = options.writeUnknownFields;
22617
+ if (u !== false)
22618
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
22619
+ return writer;
22620
+ }
22621
+ }
22622
+ var GetBotConfigurationCatalogResult = new GetBotConfigurationCatalogResult$Type;
22623
+
21570
22624
  class GetPeerBotCommandsInput$Type extends import_runtime4.MessageType {
21571
22625
  constructor() {
21572
22626
  super("GetPeerBotCommandsInput", [
@@ -24969,7 +26023,9 @@ class SendMessageInput$Type extends import_runtime4.MessageType {
24969
26023
  { no: 7, name: "entities", kind: "message", T: () => MessageEntities },
24970
26024
  { no: 8, name: "parse_markdown", kind: "scalar", opt: true, T: 8 },
24971
26025
  { no: 9, name: "send_mode", kind: "enum", opt: true, T: () => ["MessageSendMode", MessageSendMode] },
24972
- { no: 10, name: "actions", kind: "message", T: () => MessageActions }
26026
+ { no: 10, name: "actions", kind: "message", T: () => MessageActions },
26027
+ { no: 11, name: "initial_agent_context", kind: "message", T: () => AgentThreadContext },
26028
+ { no: 12, name: "source_chat_id", kind: "scalar", opt: true, T: 3, L: 0 }
24973
26029
  ]);
24974
26030
  }
24975
26031
  create(value) {
@@ -25019,6 +26075,12 @@ class SendMessageInput$Type extends import_runtime4.MessageType {
25019
26075
  case 10:
25020
26076
  message.actions = MessageActions.internalBinaryRead(reader, reader.uint32(), options, message.actions);
25021
26077
  break;
26078
+ case 11:
26079
+ message.initialAgentContext = AgentThreadContext.internalBinaryRead(reader, reader.uint32(), options, message.initialAgentContext);
26080
+ break;
26081
+ case 12:
26082
+ message.sourceChatId = reader.int64().toBigInt();
26083
+ break;
25022
26084
  default:
25023
26085
  let u = options.readUnknownField;
25024
26086
  if (u === "throw")
@@ -25055,6 +26117,10 @@ class SendMessageInput$Type extends import_runtime4.MessageType {
25055
26117
  writer.tag(9, import_runtime.WireType.Varint).int32(message.sendMode);
25056
26118
  if (message.actions)
25057
26119
  MessageActions.internalBinaryWrite(message.actions, writer.tag(10, import_runtime.WireType.LengthDelimited).fork(), options).join();
26120
+ if (message.initialAgentContext)
26121
+ AgentThreadContext.internalBinaryWrite(message.initialAgentContext, writer.tag(11, import_runtime.WireType.LengthDelimited).fork(), options).join();
26122
+ if (message.sourceChatId !== undefined)
26123
+ writer.tag(12, import_runtime.WireType.Varint).int64(message.sourceChatId);
25058
26124
  let u = options.writeUnknownFields;
25059
26125
  if (u !== false)
25060
26126
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -25487,7 +26553,8 @@ var GetChatHistoryInput = new GetChatHistoryInput$Type;
25487
26553
  class GetChatHistoryResult$Type extends import_runtime4.MessageType {
25488
26554
  constructor() {
25489
26555
  super("GetChatHistoryResult", [
25490
- { no: 1, name: "messages", kind: "message", repeat: 1, T: () => Message }
26556
+ { no: 1, name: "messages", kind: "message", repeat: 1, T: () => Message },
26557
+ { no: 2, name: "acknowledgements", kind: "message", T: () => ChatAcknowledgements }
25491
26558
  ]);
25492
26559
  }
25493
26560
  create(value) {
@@ -25505,6 +26572,9 @@ class GetChatHistoryResult$Type extends import_runtime4.MessageType {
25505
26572
  case 1:
25506
26573
  message.messages.push(Message.internalBinaryRead(reader, reader.uint32(), options));
25507
26574
  break;
26575
+ case 2:
26576
+ message.acknowledgements = ChatAcknowledgements.internalBinaryRead(reader, reader.uint32(), options, message.acknowledgements);
26577
+ break;
25508
26578
  default:
25509
26579
  let u = options.readUnknownField;
25510
26580
  if (u === "throw")
@@ -25519,6 +26589,8 @@ class GetChatHistoryResult$Type extends import_runtime4.MessageType {
25519
26589
  internalBinaryWrite(message, writer, options) {
25520
26590
  for (let i = 0;i < message.messages.length; i++)
25521
26591
  Message.internalBinaryWrite(message.messages[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
26592
+ if (message.acknowledgements)
26593
+ ChatAcknowledgements.internalBinaryWrite(message.acknowledgements, writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
25522
26594
  let u = options.writeUnknownFields;
25523
26595
  if (u !== false)
25524
26596
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -27579,7 +28651,8 @@ class CreateChatInput$Type extends import_runtime4.MessageType {
27579
28651
  { no: 5, name: "is_public", kind: "scalar", T: 8 },
27580
28652
  { no: 6, name: "participants", kind: "message", repeat: 1, T: () => InputChatParticipant },
27581
28653
  { no: 7, name: "reserved_chat_id", kind: "scalar", opt: true, T: 3, L: 0 },
27582
- { no: 8, name: "placeholder_title", kind: "scalar", opt: true, T: 9 }
28654
+ { no: 8, name: "placeholder_title", kind: "scalar", opt: true, T: 9 },
28655
+ { no: 9, name: "agent_context", kind: "message", T: () => AgentThreadContext }
27583
28656
  ]);
27584
28657
  }
27585
28658
  create(value) {
@@ -27619,6 +28692,9 @@ class CreateChatInput$Type extends import_runtime4.MessageType {
27619
28692
  case 8:
27620
28693
  message.placeholderTitle = reader.string();
27621
28694
  break;
28695
+ case 9:
28696
+ message.agentContext = AgentThreadContext.internalBinaryRead(reader, reader.uint32(), options, message.agentContext);
28697
+ break;
27622
28698
  default:
27623
28699
  let u = options.readUnknownField;
27624
28700
  if (u === "throw")
@@ -27647,6 +28723,8 @@ class CreateChatInput$Type extends import_runtime4.MessageType {
27647
28723
  writer.tag(7, import_runtime.WireType.Varint).int64(message.reservedChatId);
27648
28724
  if (message.placeholderTitle !== undefined)
27649
28725
  writer.tag(8, import_runtime.WireType.LengthDelimited).string(message.placeholderTitle);
28726
+ if (message.agentContext)
28727
+ AgentThreadContext.internalBinaryWrite(message.agentContext, writer.tag(9, import_runtime.WireType.LengthDelimited).fork(), options).join();
27650
28728
  let u = options.writeUnknownFields;
27651
28729
  if (u !== false)
27652
28730
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -27711,7 +28789,8 @@ class CreateSubthreadInput$Type extends import_runtime4.MessageType {
27711
28789
  { no: 3, name: "title", kind: "scalar", opt: true, T: 9 },
27712
28790
  { no: 4, name: "description", kind: "scalar", opt: true, T: 9 },
27713
28791
  { no: 5, name: "emoji", kind: "scalar", opt: true, T: 9 },
27714
- { no: 6, name: "participants", kind: "message", repeat: 1, T: () => InputChatParticipant }
28792
+ { no: 6, name: "participants", kind: "message", repeat: 1, T: () => InputChatParticipant },
28793
+ { no: 7, name: "agent_context", kind: "message", T: () => AgentThreadContext }
27715
28794
  ]);
27716
28795
  }
27717
28796
  create(value) {
@@ -27745,6 +28824,9 @@ class CreateSubthreadInput$Type extends import_runtime4.MessageType {
27745
28824
  case 6:
27746
28825
  message.participants.push(InputChatParticipant.internalBinaryRead(reader, reader.uint32(), options));
27747
28826
  break;
28827
+ case 7:
28828
+ message.agentContext = AgentThreadContext.internalBinaryRead(reader, reader.uint32(), options, message.agentContext);
28829
+ break;
27748
28830
  default:
27749
28831
  let u = options.readUnknownField;
27750
28832
  if (u === "throw")
@@ -27769,6 +28851,8 @@ class CreateSubthreadInput$Type extends import_runtime4.MessageType {
27769
28851
  writer.tag(5, import_runtime.WireType.LengthDelimited).string(message.emoji);
27770
28852
  for (let i = 0;i < message.participants.length; i++)
27771
28853
  InputChatParticipant.internalBinaryWrite(message.participants[i], writer.tag(6, import_runtime.WireType.LengthDelimited).fork(), options).join();
28854
+ if (message.agentContext)
28855
+ AgentThreadContext.internalBinaryWrite(message.agentContext, writer.tag(7, import_runtime.WireType.LengthDelimited).fork(), options).join();
27772
28856
  let u = options.writeUnknownFields;
27773
28857
  if (u !== false)
27774
28858
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -28371,7 +29455,8 @@ class Update$Type extends import_runtime4.MessageType {
28371
29455
  { no: 45, name: "dialog_collapsed_max_id", kind: "message", oneof: "update", T: () => UpdateDialogCollapsedMaxId },
28372
29456
  { no: 46, name: "dialog_folder", kind: "message", oneof: "update", T: () => UpdateDialogFolder },
28373
29457
  { no: 47, name: "user_added_to_chat", kind: "message", oneof: "update", T: () => UpdateUserAddedToChat },
28374
- { no: 48, name: "user_removed_from_chat", kind: "message", oneof: "update", T: () => UpdateUserRemovedFromChat }
29458
+ { no: 48, name: "user_removed_from_chat", kind: "message", oneof: "update", T: () => UpdateUserRemovedFromChat },
29459
+ { no: 49, name: "acknowledgement", kind: "message", oneof: "update", T: () => ChatAcknowledgement }
28375
29460
  ]);
28376
29461
  }
28377
29462
  create(value) {
@@ -28662,6 +29747,12 @@ class Update$Type extends import_runtime4.MessageType {
28662
29747
  userRemovedFromChat: UpdateUserRemovedFromChat.internalBinaryRead(reader, reader.uint32(), options, message.update.userRemovedFromChat)
28663
29748
  };
28664
29749
  break;
29750
+ case 49:
29751
+ message.update = {
29752
+ oneofKind: "acknowledgement",
29753
+ acknowledgement: ChatAcknowledgement.internalBinaryRead(reader, reader.uint32(), options, message.update.acknowledgement)
29754
+ };
29755
+ break;
28665
29756
  default:
28666
29757
  let u = options.readUnknownField;
28667
29758
  if (u === "throw")
@@ -28768,6 +29859,8 @@ class Update$Type extends import_runtime4.MessageType {
28768
29859
  UpdateUserAddedToChat.internalBinaryWrite(message.update.userAddedToChat, writer.tag(47, import_runtime.WireType.LengthDelimited).fork(), options).join();
28769
29860
  if (message.update.oneofKind === "userRemovedFromChat")
28770
29861
  UpdateUserRemovedFromChat.internalBinaryWrite(message.update.userRemovedFromChat, writer.tag(48, import_runtime.WireType.LengthDelimited).fork(), options).join();
29862
+ if (message.update.oneofKind === "acknowledgement")
29863
+ ChatAcknowledgement.internalBinaryWrite(message.update.acknowledgement, writer.tag(49, import_runtime.WireType.LengthDelimited).fork(), options).join();
28771
29864
  let u = options.writeUnknownFields;
28772
29865
  if (u !== false)
28773
29866
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -29043,7 +30136,8 @@ class UpdateChatInfo$Type extends import_runtime4.MessageType {
29043
30136
  { no: 1, name: "chat_id", kind: "scalar", T: 3, L: 0 },
29044
30137
  { no: 2, name: "title", kind: "scalar", opt: true, T: 9 },
29045
30138
  { no: 3, name: "emoji", kind: "scalar", opt: true, T: 9 },
29046
- { no: 4, name: "untitled", kind: "scalar", opt: true, T: 8 }
30139
+ { no: 4, name: "untitled", kind: "scalar", opt: true, T: 8 },
30140
+ { no: 5, name: "agent_context", kind: "message", T: () => AgentThreadContext }
29047
30141
  ]);
29048
30142
  }
29049
30143
  create(value) {
@@ -29070,6 +30164,9 @@ class UpdateChatInfo$Type extends import_runtime4.MessageType {
29070
30164
  case 4:
29071
30165
  message.untitled = reader.bool();
29072
30166
  break;
30167
+ case 5:
30168
+ message.agentContext = AgentThreadContext.internalBinaryRead(reader, reader.uint32(), options, message.agentContext);
30169
+ break;
29073
30170
  default:
29074
30171
  let u = options.readUnknownField;
29075
30172
  if (u === "throw")
@@ -29090,6 +30187,8 @@ class UpdateChatInfo$Type extends import_runtime4.MessageType {
29090
30187
  writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.emoji);
29091
30188
  if (message.untitled !== undefined)
29092
30189
  writer.tag(4, import_runtime.WireType.Varint).bool(message.untitled);
30190
+ if (message.agentContext)
30191
+ AgentThreadContext.internalBinaryWrite(message.agentContext, writer.tag(5, import_runtime.WireType.LengthDelimited).fork(), options).join();
29093
30192
  let u = options.writeUnknownFields;
29094
30193
  if (u !== false)
29095
30194
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -31748,6 +32847,100 @@ class SearchUsersResult$Type extends import_runtime4.MessageType {
31748
32847
  }
31749
32848
  var SearchUsersResult = new SearchUsersResult$Type;
31750
32849
 
32850
+ class GetUsersInput$Type extends import_runtime4.MessageType {
32851
+ constructor() {
32852
+ super("GetUsersInput", [
32853
+ { no: 1, name: "user_ids", kind: "scalar", repeat: 1, T: 3, L: 0 }
32854
+ ]);
32855
+ }
32856
+ create(value) {
32857
+ const message = globalThis.Object.create(this.messagePrototype);
32858
+ message.userIds = [];
32859
+ if (value !== undefined)
32860
+ import_runtime3.reflectionMergePartial(this, message, value);
32861
+ return message;
32862
+ }
32863
+ internalBinaryRead(reader, length, options, target) {
32864
+ let message = target ?? this.create(), end = reader.pos + length;
32865
+ while (reader.pos < end) {
32866
+ let [fieldNo, wireType] = reader.tag();
32867
+ switch (fieldNo) {
32868
+ case 1:
32869
+ if (wireType === import_runtime.WireType.LengthDelimited)
32870
+ for (let e = reader.int32() + reader.pos;reader.pos < e; )
32871
+ message.userIds.push(reader.int64().toBigInt());
32872
+ else
32873
+ message.userIds.push(reader.int64().toBigInt());
32874
+ break;
32875
+ default:
32876
+ let u = options.readUnknownField;
32877
+ if (u === "throw")
32878
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
32879
+ let d = reader.skip(wireType);
32880
+ if (u !== false)
32881
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
32882
+ }
32883
+ }
32884
+ return message;
32885
+ }
32886
+ internalBinaryWrite(message, writer, options) {
32887
+ if (message.userIds.length) {
32888
+ writer.tag(1, import_runtime.WireType.LengthDelimited).fork();
32889
+ for (let i = 0;i < message.userIds.length; i++)
32890
+ writer.int64(message.userIds[i]);
32891
+ writer.join();
32892
+ }
32893
+ let u = options.writeUnknownFields;
32894
+ if (u !== false)
32895
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
32896
+ return writer;
32897
+ }
32898
+ }
32899
+ var GetUsersInput = new GetUsersInput$Type;
32900
+
32901
+ class GetUsersResult$Type extends import_runtime4.MessageType {
32902
+ constructor() {
32903
+ super("GetUsersResult", [
32904
+ { no: 1, name: "users", kind: "message", repeat: 1, T: () => User }
32905
+ ]);
32906
+ }
32907
+ create(value) {
32908
+ const message = globalThis.Object.create(this.messagePrototype);
32909
+ message.users = [];
32910
+ if (value !== undefined)
32911
+ import_runtime3.reflectionMergePartial(this, message, value);
32912
+ return message;
32913
+ }
32914
+ internalBinaryRead(reader, length, options, target) {
32915
+ let message = target ?? this.create(), end = reader.pos + length;
32916
+ while (reader.pos < end) {
32917
+ let [fieldNo, wireType] = reader.tag();
32918
+ switch (fieldNo) {
32919
+ case 1:
32920
+ message.users.push(User.internalBinaryRead(reader, reader.uint32(), options));
32921
+ break;
32922
+ default:
32923
+ let u = options.readUnknownField;
32924
+ if (u === "throw")
32925
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
32926
+ let d = reader.skip(wireType);
32927
+ if (u !== false)
32928
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
32929
+ }
32930
+ }
32931
+ return message;
32932
+ }
32933
+ internalBinaryWrite(message, writer, options) {
32934
+ for (let i = 0;i < message.users.length; i++)
32935
+ User.internalBinaryWrite(message.users[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
32936
+ let u = options.writeUnknownFields;
32937
+ if (u !== false)
32938
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
32939
+ return writer;
32940
+ }
32941
+ }
32942
+ var GetUsersResult = new GetUsersResult$Type;
32943
+
31751
32944
  class InviteToInlineInput$Type extends import_runtime4.MessageType {
31752
32945
  constructor() {
31753
32946
  super("InviteToInlineInput", [
@@ -32263,19 +33456,214 @@ class UpdateChatVisibilityResult$Type extends import_runtime4.MessageType {
32263
33456
  return writer;
32264
33457
  }
32265
33458
  }
32266
- var UpdateChatVisibilityResult = new UpdateChatVisibilityResult$Type;
33459
+ var UpdateChatVisibilityResult = new UpdateChatVisibilityResult$Type;
33460
+
33461
+ class UpdateChatInfoInput$Type extends import_runtime4.MessageType {
33462
+ constructor() {
33463
+ super("UpdateChatInfoInput", [
33464
+ { no: 1, name: "chat_id", kind: "scalar", T: 3, L: 0 },
33465
+ { no: 2, name: "title", kind: "scalar", opt: true, T: 9 },
33466
+ { no: 3, name: "emoji", kind: "scalar", opt: true, T: 9 },
33467
+ { no: 4, name: "agent_context", kind: "message", T: () => AgentThreadContext }
33468
+ ]);
33469
+ }
33470
+ create(value) {
33471
+ const message = globalThis.Object.create(this.messagePrototype);
33472
+ message.chatId = 0n;
33473
+ if (value !== undefined)
33474
+ import_runtime3.reflectionMergePartial(this, message, value);
33475
+ return message;
33476
+ }
33477
+ internalBinaryRead(reader, length, options, target) {
33478
+ let message = target ?? this.create(), end = reader.pos + length;
33479
+ while (reader.pos < end) {
33480
+ let [fieldNo, wireType] = reader.tag();
33481
+ switch (fieldNo) {
33482
+ case 1:
33483
+ message.chatId = reader.int64().toBigInt();
33484
+ break;
33485
+ case 2:
33486
+ message.title = reader.string();
33487
+ break;
33488
+ case 3:
33489
+ message.emoji = reader.string();
33490
+ break;
33491
+ case 4:
33492
+ message.agentContext = AgentThreadContext.internalBinaryRead(reader, reader.uint32(), options, message.agentContext);
33493
+ break;
33494
+ default:
33495
+ let u = options.readUnknownField;
33496
+ if (u === "throw")
33497
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
33498
+ let d = reader.skip(wireType);
33499
+ if (u !== false)
33500
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
33501
+ }
33502
+ }
33503
+ return message;
33504
+ }
33505
+ internalBinaryWrite(message, writer, options) {
33506
+ if (message.chatId !== 0n)
33507
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.chatId);
33508
+ if (message.title !== undefined)
33509
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.title);
33510
+ if (message.emoji !== undefined)
33511
+ writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.emoji);
33512
+ if (message.agentContext)
33513
+ AgentThreadContext.internalBinaryWrite(message.agentContext, writer.tag(4, import_runtime.WireType.LengthDelimited).fork(), options).join();
33514
+ let u = options.writeUnknownFields;
33515
+ if (u !== false)
33516
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
33517
+ return writer;
33518
+ }
33519
+ }
33520
+ var UpdateChatInfoInput = new UpdateChatInfoInput$Type;
33521
+
33522
+ class UpdateChatInfoResult$Type extends import_runtime4.MessageType {
33523
+ constructor() {
33524
+ super("UpdateChatInfoResult", [
33525
+ { no: 1, name: "chat", kind: "message", T: () => Chat }
33526
+ ]);
33527
+ }
33528
+ create(value) {
33529
+ const message = globalThis.Object.create(this.messagePrototype);
33530
+ if (value !== undefined)
33531
+ import_runtime3.reflectionMergePartial(this, message, value);
33532
+ return message;
33533
+ }
33534
+ internalBinaryRead(reader, length, options, target) {
33535
+ let message = target ?? this.create(), end = reader.pos + length;
33536
+ while (reader.pos < end) {
33537
+ let [fieldNo, wireType] = reader.tag();
33538
+ switch (fieldNo) {
33539
+ case 1:
33540
+ message.chat = Chat.internalBinaryRead(reader, reader.uint32(), options, message.chat);
33541
+ break;
33542
+ default:
33543
+ let u = options.readUnknownField;
33544
+ if (u === "throw")
33545
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
33546
+ let d = reader.skip(wireType);
33547
+ if (u !== false)
33548
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
33549
+ }
33550
+ }
33551
+ return message;
33552
+ }
33553
+ internalBinaryWrite(message, writer, options) {
33554
+ if (message.chat)
33555
+ Chat.internalBinaryWrite(message.chat, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
33556
+ let u = options.writeUnknownFields;
33557
+ if (u !== false)
33558
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
33559
+ return writer;
33560
+ }
33561
+ }
33562
+ var UpdateChatInfoResult = new UpdateChatInfoResult$Type;
33563
+
33564
+ class MoveThreadInput$Type extends import_runtime4.MessageType {
33565
+ constructor() {
33566
+ super("MoveThreadInput", [
33567
+ { no: 1, name: "chat_id", kind: "scalar", T: 3, L: 0 },
33568
+ { no: 2, name: "space_id", kind: "scalar", opt: true, T: 3, L: 0 }
33569
+ ]);
33570
+ }
33571
+ create(value) {
33572
+ const message = globalThis.Object.create(this.messagePrototype);
33573
+ message.chatId = 0n;
33574
+ if (value !== undefined)
33575
+ import_runtime3.reflectionMergePartial(this, message, value);
33576
+ return message;
33577
+ }
33578
+ internalBinaryRead(reader, length, options, target) {
33579
+ let message = target ?? this.create(), end = reader.pos + length;
33580
+ while (reader.pos < end) {
33581
+ let [fieldNo, wireType] = reader.tag();
33582
+ switch (fieldNo) {
33583
+ case 1:
33584
+ message.chatId = reader.int64().toBigInt();
33585
+ break;
33586
+ case 2:
33587
+ message.spaceId = reader.int64().toBigInt();
33588
+ break;
33589
+ default:
33590
+ let u = options.readUnknownField;
33591
+ if (u === "throw")
33592
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
33593
+ let d = reader.skip(wireType);
33594
+ if (u !== false)
33595
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
33596
+ }
33597
+ }
33598
+ return message;
33599
+ }
33600
+ internalBinaryWrite(message, writer, options) {
33601
+ if (message.chatId !== 0n)
33602
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.chatId);
33603
+ if (message.spaceId !== undefined)
33604
+ writer.tag(2, import_runtime.WireType.Varint).int64(message.spaceId);
33605
+ let u = options.writeUnknownFields;
33606
+ if (u !== false)
33607
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
33608
+ return writer;
33609
+ }
33610
+ }
33611
+ var MoveThreadInput = new MoveThreadInput$Type;
33612
+
33613
+ class MoveThreadResult$Type extends import_runtime4.MessageType {
33614
+ constructor() {
33615
+ super("MoveThreadResult", [
33616
+ { no: 1, name: "chat", kind: "message", T: () => Chat }
33617
+ ]);
33618
+ }
33619
+ create(value) {
33620
+ const message = globalThis.Object.create(this.messagePrototype);
33621
+ if (value !== undefined)
33622
+ import_runtime3.reflectionMergePartial(this, message, value);
33623
+ return message;
33624
+ }
33625
+ internalBinaryRead(reader, length, options, target) {
33626
+ let message = target ?? this.create(), end = reader.pos + length;
33627
+ while (reader.pos < end) {
33628
+ let [fieldNo, wireType] = reader.tag();
33629
+ switch (fieldNo) {
33630
+ case 1:
33631
+ message.chat = Chat.internalBinaryRead(reader, reader.uint32(), options, message.chat);
33632
+ break;
33633
+ default:
33634
+ let u = options.readUnknownField;
33635
+ if (u === "throw")
33636
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
33637
+ let d = reader.skip(wireType);
33638
+ if (u !== false)
33639
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
33640
+ }
33641
+ }
33642
+ return message;
33643
+ }
33644
+ internalBinaryWrite(message, writer, options) {
33645
+ if (message.chat)
33646
+ Chat.internalBinaryWrite(message.chat, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
33647
+ let u = options.writeUnknownFields;
33648
+ if (u !== false)
33649
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
33650
+ return writer;
33651
+ }
33652
+ }
33653
+ var MoveThreadResult = new MoveThreadResult$Type;
32267
33654
 
32268
- class UpdateChatInfoInput$Type extends import_runtime4.MessageType {
33655
+ class PinMessageInput$Type extends import_runtime4.MessageType {
32269
33656
  constructor() {
32270
- super("UpdateChatInfoInput", [
32271
- { no: 1, name: "chat_id", kind: "scalar", T: 3, L: 0 },
32272
- { no: 2, name: "title", kind: "scalar", opt: true, T: 9 },
32273
- { no: 3, name: "emoji", kind: "scalar", opt: true, T: 9 }
33657
+ super("PinMessageInput", [
33658
+ { no: 1, name: "peer_id", kind: "message", T: () => InputPeer },
33659
+ { no: 2, name: "message_id", kind: "scalar", T: 3, L: 0 },
33660
+ { no: 3, name: "unpin", kind: "scalar", T: 8 }
32274
33661
  ]);
32275
33662
  }
32276
33663
  create(value) {
32277
33664
  const message = globalThis.Object.create(this.messagePrototype);
32278
- message.chatId = 0n;
33665
+ message.messageId = 0n;
33666
+ message.unpin = false;
32279
33667
  if (value !== undefined)
32280
33668
  import_runtime3.reflectionMergePartial(this, message, value);
32281
33669
  return message;
@@ -32286,13 +33674,13 @@ class UpdateChatInfoInput$Type extends import_runtime4.MessageType {
32286
33674
  let [fieldNo, wireType] = reader.tag();
32287
33675
  switch (fieldNo) {
32288
33676
  case 1:
32289
- message.chatId = reader.int64().toBigInt();
33677
+ message.peerId = InputPeer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
32290
33678
  break;
32291
33679
  case 2:
32292
- message.title = reader.string();
33680
+ message.messageId = reader.int64().toBigInt();
32293
33681
  break;
32294
33682
  case 3:
32295
- message.emoji = reader.string();
33683
+ message.unpin = reader.bool();
32296
33684
  break;
32297
33685
  default:
32298
33686
  let u = options.readUnknownField;
@@ -32306,28 +33694,29 @@ class UpdateChatInfoInput$Type extends import_runtime4.MessageType {
32306
33694
  return message;
32307
33695
  }
32308
33696
  internalBinaryWrite(message, writer, options) {
32309
- if (message.chatId !== 0n)
32310
- writer.tag(1, import_runtime.WireType.Varint).int64(message.chatId);
32311
- if (message.title !== undefined)
32312
- writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.title);
32313
- if (message.emoji !== undefined)
32314
- writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.emoji);
33697
+ if (message.peerId)
33698
+ InputPeer.internalBinaryWrite(message.peerId, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
33699
+ if (message.messageId !== 0n)
33700
+ writer.tag(2, import_runtime.WireType.Varint).int64(message.messageId);
33701
+ if (message.unpin !== false)
33702
+ writer.tag(3, import_runtime.WireType.Varint).bool(message.unpin);
32315
33703
  let u = options.writeUnknownFields;
32316
33704
  if (u !== false)
32317
33705
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
32318
33706
  return writer;
32319
33707
  }
32320
33708
  }
32321
- var UpdateChatInfoInput = new UpdateChatInfoInput$Type;
33709
+ var PinMessageInput = new PinMessageInput$Type;
32322
33710
 
32323
- class UpdateChatInfoResult$Type extends import_runtime4.MessageType {
33711
+ class PinMessageResult$Type extends import_runtime4.MessageType {
32324
33712
  constructor() {
32325
- super("UpdateChatInfoResult", [
32326
- { no: 1, name: "chat", kind: "message", T: () => Chat }
33713
+ super("PinMessageResult", [
33714
+ { no: 1, name: "updates", kind: "message", repeat: 1, T: () => Update }
32327
33715
  ]);
32328
33716
  }
32329
33717
  create(value) {
32330
33718
  const message = globalThis.Object.create(this.messagePrototype);
33719
+ message.updates = [];
32331
33720
  if (value !== undefined)
32332
33721
  import_runtime3.reflectionMergePartial(this, message, value);
32333
33722
  return message;
@@ -32338,7 +33727,7 @@ class UpdateChatInfoResult$Type extends import_runtime4.MessageType {
32338
33727
  let [fieldNo, wireType] = reader.tag();
32339
33728
  switch (fieldNo) {
32340
33729
  case 1:
32341
- message.chat = Chat.internalBinaryRead(reader, reader.uint32(), options, message.chat);
33730
+ message.updates.push(Update.internalBinaryRead(reader, reader.uint32(), options));
32342
33731
  break;
32343
33732
  default:
32344
33733
  let u = options.readUnknownField;
@@ -32352,26 +33741,26 @@ class UpdateChatInfoResult$Type extends import_runtime4.MessageType {
32352
33741
  return message;
32353
33742
  }
32354
33743
  internalBinaryWrite(message, writer, options) {
32355
- if (message.chat)
32356
- Chat.internalBinaryWrite(message.chat, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
33744
+ for (let i = 0;i < message.updates.length; i++)
33745
+ Update.internalBinaryWrite(message.updates[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
32357
33746
  let u = options.writeUnknownFields;
32358
33747
  if (u !== false)
32359
33748
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
32360
33749
  return writer;
32361
33750
  }
32362
33751
  }
32363
- var UpdateChatInfoResult = new UpdateChatInfoResult$Type;
33752
+ var PinMessageResult = new PinMessageResult$Type;
32364
33753
 
32365
- class MoveThreadInput$Type extends import_runtime4.MessageType {
33754
+ class DraftMessage$Type extends import_runtime4.MessageType {
32366
33755
  constructor() {
32367
- super("MoveThreadInput", [
32368
- { no: 1, name: "chat_id", kind: "scalar", T: 3, L: 0 },
32369
- { no: 2, name: "space_id", kind: "scalar", opt: true, T: 3, L: 0 }
33756
+ super("DraftMessage", [
33757
+ { no: 1, name: "text", kind: "scalar", T: 9 },
33758
+ { no: 2, name: "entities", kind: "message", T: () => MessageEntities }
32370
33759
  ]);
32371
33760
  }
32372
33761
  create(value) {
32373
33762
  const message = globalThis.Object.create(this.messagePrototype);
32374
- message.chatId = 0n;
33763
+ message.text = "";
32375
33764
  if (value !== undefined)
32376
33765
  import_runtime3.reflectionMergePartial(this, message, value);
32377
33766
  return message;
@@ -32382,10 +33771,10 @@ class MoveThreadInput$Type extends import_runtime4.MessageType {
32382
33771
  let [fieldNo, wireType] = reader.tag();
32383
33772
  switch (fieldNo) {
32384
33773
  case 1:
32385
- message.chatId = reader.int64().toBigInt();
33774
+ message.text = reader.string();
32386
33775
  break;
32387
33776
  case 2:
32388
- message.spaceId = reader.int64().toBigInt();
33777
+ message.entities = MessageEntities.internalBinaryRead(reader, reader.uint32(), options, message.entities);
32389
33778
  break;
32390
33779
  default:
32391
33780
  let u = options.readUnknownField;
@@ -32399,26 +33788,30 @@ class MoveThreadInput$Type extends import_runtime4.MessageType {
32399
33788
  return message;
32400
33789
  }
32401
33790
  internalBinaryWrite(message, writer, options) {
32402
- if (message.chatId !== 0n)
32403
- writer.tag(1, import_runtime.WireType.Varint).int64(message.chatId);
32404
- if (message.spaceId !== undefined)
32405
- writer.tag(2, import_runtime.WireType.Varint).int64(message.spaceId);
33791
+ if (message.text !== "")
33792
+ writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.text);
33793
+ if (message.entities)
33794
+ MessageEntities.internalBinaryWrite(message.entities, writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
32406
33795
  let u = options.writeUnknownFields;
32407
33796
  if (u !== false)
32408
33797
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
32409
33798
  return writer;
32410
33799
  }
32411
33800
  }
32412
- var MoveThreadInput = new MoveThreadInput$Type;
33801
+ var DraftMessage = new DraftMessage$Type;
32413
33802
 
32414
- class MoveThreadResult$Type extends import_runtime4.MessageType {
33803
+ class AgentProjectOption$Type extends import_runtime4.MessageType {
32415
33804
  constructor() {
32416
- super("MoveThreadResult", [
32417
- { no: 1, name: "chat", kind: "message", T: () => Chat }
33805
+ super("AgentProjectOption", [
33806
+ { no: 1, name: "id", kind: "scalar", T: 9 },
33807
+ { no: 2, name: "label", kind: "scalar", T: 9 },
33808
+ { no: 3, name: "description", kind: "scalar", opt: true, T: 9 }
32418
33809
  ]);
32419
33810
  }
32420
33811
  create(value) {
32421
33812
  const message = globalThis.Object.create(this.messagePrototype);
33813
+ message.id = "";
33814
+ message.label = "";
32422
33815
  if (value !== undefined)
32423
33816
  import_runtime3.reflectionMergePartial(this, message, value);
32424
33817
  return message;
@@ -32429,7 +33822,13 @@ class MoveThreadResult$Type extends import_runtime4.MessageType {
32429
33822
  let [fieldNo, wireType] = reader.tag();
32430
33823
  switch (fieldNo) {
32431
33824
  case 1:
32432
- message.chat = Chat.internalBinaryRead(reader, reader.uint32(), options, message.chat);
33825
+ message.id = reader.string();
33826
+ break;
33827
+ case 2:
33828
+ message.label = reader.string();
33829
+ break;
33830
+ case 3:
33831
+ message.description = reader.string();
32433
33832
  break;
32434
33833
  default:
32435
33834
  let u = options.readUnknownField;
@@ -32443,28 +33842,30 @@ class MoveThreadResult$Type extends import_runtime4.MessageType {
32443
33842
  return message;
32444
33843
  }
32445
33844
  internalBinaryWrite(message, writer, options) {
32446
- if (message.chat)
32447
- Chat.internalBinaryWrite(message.chat, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
33845
+ if (message.id !== "")
33846
+ writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.id);
33847
+ if (message.label !== "")
33848
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.label);
33849
+ if (message.description !== undefined)
33850
+ writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.description);
32448
33851
  let u = options.writeUnknownFields;
32449
33852
  if (u !== false)
32450
33853
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
32451
33854
  return writer;
32452
33855
  }
32453
33856
  }
32454
- var MoveThreadResult = new MoveThreadResult$Type;
33857
+ var AgentProjectOption = new AgentProjectOption$Type;
32455
33858
 
32456
- class PinMessageInput$Type extends import_runtime4.MessageType {
33859
+ class AgentProjectCatalog$Type extends import_runtime4.MessageType {
32457
33860
  constructor() {
32458
- super("PinMessageInput", [
32459
- { no: 1, name: "peer_id", kind: "message", T: () => InputPeer },
32460
- { no: 2, name: "message_id", kind: "scalar", T: 3, L: 0 },
32461
- { no: 3, name: "unpin", kind: "scalar", T: 8 }
33861
+ super("AgentProjectCatalog", [
33862
+ { no: 1, name: "options", kind: "message", repeat: 1, T: () => AgentProjectOption },
33863
+ { no: 2, name: "can_select_folder", kind: "scalar", opt: true, T: 8 }
32462
33864
  ]);
32463
33865
  }
32464
33866
  create(value) {
32465
33867
  const message = globalThis.Object.create(this.messagePrototype);
32466
- message.messageId = 0n;
32467
- message.unpin = false;
33868
+ message.options = [];
32468
33869
  if (value !== undefined)
32469
33870
  import_runtime3.reflectionMergePartial(this, message, value);
32470
33871
  return message;
@@ -32475,13 +33876,64 @@ class PinMessageInput$Type extends import_runtime4.MessageType {
32475
33876
  let [fieldNo, wireType] = reader.tag();
32476
33877
  switch (fieldNo) {
32477
33878
  case 1:
32478
- message.peerId = InputPeer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
33879
+ message.options.push(AgentProjectOption.internalBinaryRead(reader, reader.uint32(), options));
32479
33880
  break;
32480
33881
  case 2:
32481
- message.messageId = reader.int64().toBigInt();
33882
+ message.canSelectFolder = reader.bool();
33883
+ break;
33884
+ default:
33885
+ let u = options.readUnknownField;
33886
+ if (u === "throw")
33887
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
33888
+ let d = reader.skip(wireType);
33889
+ if (u !== false)
33890
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
33891
+ }
33892
+ }
33893
+ return message;
33894
+ }
33895
+ internalBinaryWrite(message, writer, options) {
33896
+ for (let i = 0;i < message.options.length; i++)
33897
+ AgentProjectOption.internalBinaryWrite(message.options[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
33898
+ if (message.canSelectFolder !== undefined)
33899
+ writer.tag(2, import_runtime.WireType.Varint).bool(message.canSelectFolder);
33900
+ let u = options.writeUnknownFields;
33901
+ if (u !== false)
33902
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
33903
+ return writer;
33904
+ }
33905
+ }
33906
+ var AgentProjectCatalog = new AgentProjectCatalog$Type;
33907
+
33908
+ class AgentReasoningEffortOption$Type extends import_runtime4.MessageType {
33909
+ constructor() {
33910
+ super("AgentReasoningEffortOption", [
33911
+ { no: 1, name: "id", kind: "scalar", T: 9 },
33912
+ { no: 2, name: "label", kind: "scalar", T: 9 },
33913
+ { no: 3, name: "description", kind: "scalar", opt: true, T: 9 }
33914
+ ]);
33915
+ }
33916
+ create(value) {
33917
+ const message = globalThis.Object.create(this.messagePrototype);
33918
+ message.id = "";
33919
+ message.label = "";
33920
+ if (value !== undefined)
33921
+ import_runtime3.reflectionMergePartial(this, message, value);
33922
+ return message;
33923
+ }
33924
+ internalBinaryRead(reader, length, options, target) {
33925
+ let message = target ?? this.create(), end = reader.pos + length;
33926
+ while (reader.pos < end) {
33927
+ let [fieldNo, wireType] = reader.tag();
33928
+ switch (fieldNo) {
33929
+ case 1:
33930
+ message.id = reader.string();
33931
+ break;
33932
+ case 2:
33933
+ message.label = reader.string();
32482
33934
  break;
32483
33935
  case 3:
32484
- message.unpin = reader.bool();
33936
+ message.description = reader.string();
32485
33937
  break;
32486
33938
  default:
32487
33939
  let u = options.readUnknownField;
@@ -32495,29 +33947,29 @@ class PinMessageInput$Type extends import_runtime4.MessageType {
32495
33947
  return message;
32496
33948
  }
32497
33949
  internalBinaryWrite(message, writer, options) {
32498
- if (message.peerId)
32499
- InputPeer.internalBinaryWrite(message.peerId, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
32500
- if (message.messageId !== 0n)
32501
- writer.tag(2, import_runtime.WireType.Varint).int64(message.messageId);
32502
- if (message.unpin !== false)
32503
- writer.tag(3, import_runtime.WireType.Varint).bool(message.unpin);
33950
+ if (message.id !== "")
33951
+ writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.id);
33952
+ if (message.label !== "")
33953
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.label);
33954
+ if (message.description !== undefined)
33955
+ writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.description);
32504
33956
  let u = options.writeUnknownFields;
32505
33957
  if (u !== false)
32506
33958
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
32507
33959
  return writer;
32508
33960
  }
32509
33961
  }
32510
- var PinMessageInput = new PinMessageInput$Type;
33962
+ var AgentReasoningEffortOption = new AgentReasoningEffortOption$Type;
32511
33963
 
32512
- class PinMessageResult$Type extends import_runtime4.MessageType {
33964
+ class AgentReasoningCatalog$Type extends import_runtime4.MessageType {
32513
33965
  constructor() {
32514
- super("PinMessageResult", [
32515
- { no: 1, name: "updates", kind: "message", repeat: 1, T: () => Update }
33966
+ super("AgentReasoningCatalog", [
33967
+ { no: 1, name: "options", kind: "message", repeat: 1, T: () => AgentReasoningEffortOption }
32516
33968
  ]);
32517
33969
  }
32518
33970
  create(value) {
32519
33971
  const message = globalThis.Object.create(this.messagePrototype);
32520
- message.updates = [];
33972
+ message.options = [];
32521
33973
  if (value !== undefined)
32522
33974
  import_runtime3.reflectionMergePartial(this, message, value);
32523
33975
  return message;
@@ -32528,7 +33980,7 @@ class PinMessageResult$Type extends import_runtime4.MessageType {
32528
33980
  let [fieldNo, wireType] = reader.tag();
32529
33981
  switch (fieldNo) {
32530
33982
  case 1:
32531
- message.updates.push(Update.internalBinaryRead(reader, reader.uint32(), options));
33983
+ message.options.push(AgentReasoningEffortOption.internalBinaryRead(reader, reader.uint32(), options));
32532
33984
  break;
32533
33985
  default:
32534
33986
  let u = options.readUnknownField;
@@ -32542,26 +33994,30 @@ class PinMessageResult$Type extends import_runtime4.MessageType {
32542
33994
  return message;
32543
33995
  }
32544
33996
  internalBinaryWrite(message, writer, options) {
32545
- for (let i = 0;i < message.updates.length; i++)
32546
- Update.internalBinaryWrite(message.updates[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
33997
+ for (let i = 0;i < message.options.length; i++)
33998
+ AgentReasoningEffortOption.internalBinaryWrite(message.options[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
32547
33999
  let u = options.writeUnknownFields;
32548
34000
  if (u !== false)
32549
34001
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
32550
34002
  return writer;
32551
34003
  }
32552
34004
  }
32553
- var PinMessageResult = new PinMessageResult$Type;
34005
+ var AgentReasoningCatalog = new AgentReasoningCatalog$Type;
32554
34006
 
32555
- class DraftMessage$Type extends import_runtime4.MessageType {
34007
+ class AgentModelOption$Type extends import_runtime4.MessageType {
32556
34008
  constructor() {
32557
- super("DraftMessage", [
32558
- { no: 1, name: "text", kind: "scalar", T: 9 },
32559
- { no: 2, name: "entities", kind: "message", T: () => MessageEntities }
34009
+ super("AgentModelOption", [
34010
+ { no: 1, name: "id", kind: "scalar", T: 9 },
34011
+ { no: 2, name: "label", kind: "scalar", T: 9 },
34012
+ { no: 3, name: "description", kind: "scalar", opt: true, T: 9 },
34013
+ { no: 4, name: "reasoning_effort_ids", kind: "scalar", repeat: 2, T: 9 }
32560
34014
  ]);
32561
34015
  }
32562
34016
  create(value) {
32563
34017
  const message = globalThis.Object.create(this.messagePrototype);
32564
- message.text = "";
34018
+ message.id = "";
34019
+ message.label = "";
34020
+ message.reasoningEffortIds = [];
32565
34021
  if (value !== undefined)
32566
34022
  import_runtime3.reflectionMergePartial(this, message, value);
32567
34023
  return message;
@@ -32572,10 +34028,16 @@ class DraftMessage$Type extends import_runtime4.MessageType {
32572
34028
  let [fieldNo, wireType] = reader.tag();
32573
34029
  switch (fieldNo) {
32574
34030
  case 1:
32575
- message.text = reader.string();
34031
+ message.id = reader.string();
32576
34032
  break;
32577
34033
  case 2:
32578
- message.entities = MessageEntities.internalBinaryRead(reader, reader.uint32(), options, message.entities);
34034
+ message.label = reader.string();
34035
+ break;
34036
+ case 3:
34037
+ message.description = reader.string();
34038
+ break;
34039
+ case 4:
34040
+ message.reasoningEffortIds.push(reader.string());
32579
34041
  break;
32580
34042
  default:
32581
34043
  let u = options.readUnknownField;
@@ -32589,23 +34051,125 @@ class DraftMessage$Type extends import_runtime4.MessageType {
32589
34051
  return message;
32590
34052
  }
32591
34053
  internalBinaryWrite(message, writer, options) {
32592
- if (message.text !== "")
32593
- writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.text);
32594
- if (message.entities)
32595
- MessageEntities.internalBinaryWrite(message.entities, writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
34054
+ if (message.id !== "")
34055
+ writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.id);
34056
+ if (message.label !== "")
34057
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.label);
34058
+ if (message.description !== undefined)
34059
+ writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.description);
34060
+ for (let i = 0;i < message.reasoningEffortIds.length; i++)
34061
+ writer.tag(4, import_runtime.WireType.LengthDelimited).string(message.reasoningEffortIds[i]);
32596
34062
  let u = options.writeUnknownFields;
32597
34063
  if (u !== false)
32598
34064
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
32599
34065
  return writer;
32600
34066
  }
32601
34067
  }
32602
- var DraftMessage = new DraftMessage$Type;
34068
+ var AgentModelOption = new AgentModelOption$Type;
34069
+
34070
+ class AgentModelCatalog$Type extends import_runtime4.MessageType {
34071
+ constructor() {
34072
+ super("AgentModelCatalog", [
34073
+ { no: 1, name: "options", kind: "message", repeat: 1, T: () => AgentModelOption }
34074
+ ]);
34075
+ }
34076
+ create(value) {
34077
+ const message = globalThis.Object.create(this.messagePrototype);
34078
+ message.options = [];
34079
+ if (value !== undefined)
34080
+ import_runtime3.reflectionMergePartial(this, message, value);
34081
+ return message;
34082
+ }
34083
+ internalBinaryRead(reader, length, options, target) {
34084
+ let message = target ?? this.create(), end = reader.pos + length;
34085
+ while (reader.pos < end) {
34086
+ let [fieldNo, wireType] = reader.tag();
34087
+ switch (fieldNo) {
34088
+ case 1:
34089
+ message.options.push(AgentModelOption.internalBinaryRead(reader, reader.uint32(), options));
34090
+ break;
34091
+ default:
34092
+ let u = options.readUnknownField;
34093
+ if (u === "throw")
34094
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
34095
+ let d = reader.skip(wireType);
34096
+ if (u !== false)
34097
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
34098
+ }
34099
+ }
34100
+ return message;
34101
+ }
34102
+ internalBinaryWrite(message, writer, options) {
34103
+ for (let i = 0;i < message.options.length; i++)
34104
+ AgentModelOption.internalBinaryWrite(message.options[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
34105
+ let u = options.writeUnknownFields;
34106
+ if (u !== false)
34107
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
34108
+ return writer;
34109
+ }
34110
+ }
34111
+ var AgentModelCatalog = new AgentModelCatalog$Type;
34112
+
34113
+ class AgentConfigurationCatalog$Type extends import_runtime4.MessageType {
34114
+ constructor() {
34115
+ super("AgentConfigurationCatalog", [
34116
+ { no: 1, name: "projects", kind: "message", T: () => AgentProjectCatalog },
34117
+ { no: 2, name: "models", kind: "message", T: () => AgentModelCatalog },
34118
+ { no: 3, name: "reasoning", kind: "message", T: () => AgentReasoningCatalog }
34119
+ ]);
34120
+ }
34121
+ create(value) {
34122
+ const message = globalThis.Object.create(this.messagePrototype);
34123
+ if (value !== undefined)
34124
+ import_runtime3.reflectionMergePartial(this, message, value);
34125
+ return message;
34126
+ }
34127
+ internalBinaryRead(reader, length, options, target) {
34128
+ let message = target ?? this.create(), end = reader.pos + length;
34129
+ while (reader.pos < end) {
34130
+ let [fieldNo, wireType] = reader.tag();
34131
+ switch (fieldNo) {
34132
+ case 1:
34133
+ message.projects = AgentProjectCatalog.internalBinaryRead(reader, reader.uint32(), options, message.projects);
34134
+ break;
34135
+ case 2:
34136
+ message.models = AgentModelCatalog.internalBinaryRead(reader, reader.uint32(), options, message.models);
34137
+ break;
34138
+ case 3:
34139
+ message.reasoning = AgentReasoningCatalog.internalBinaryRead(reader, reader.uint32(), options, message.reasoning);
34140
+ break;
34141
+ default:
34142
+ let u = options.readUnknownField;
34143
+ if (u === "throw")
34144
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
34145
+ let d = reader.skip(wireType);
34146
+ if (u !== false)
34147
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
34148
+ }
34149
+ }
34150
+ return message;
34151
+ }
34152
+ internalBinaryWrite(message, writer, options) {
34153
+ if (message.projects)
34154
+ AgentProjectCatalog.internalBinaryWrite(message.projects, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
34155
+ if (message.models)
34156
+ AgentModelCatalog.internalBinaryWrite(message.models, writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
34157
+ if (message.reasoning)
34158
+ AgentReasoningCatalog.internalBinaryWrite(message.reasoning, writer.tag(3, import_runtime.WireType.LengthDelimited).fork(), options).join();
34159
+ let u = options.writeUnknownFields;
34160
+ if (u !== false)
34161
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
34162
+ return writer;
34163
+ }
34164
+ }
34165
+ var AgentConfigurationCatalog = new AgentConfigurationCatalog$Type;
32603
34166
 
32604
34167
  class BotCapability$Type extends import_runtime4.MessageType {
32605
34168
  constructor() {
32606
34169
  super("BotCapability", [
32607
34170
  { no: 1, name: "kind", kind: "enum", T: () => ["BotCapability.Kind", BotCapability_Kind] },
32608
- { no: 2, name: "version", kind: "scalar", T: 13 }
34171
+ { no: 2, name: "version", kind: "scalar", T: 13 },
34172
+ { no: 3, name: "agent_configuration", kind: "message", T: () => AgentConfigurationCatalog }
32609
34173
  ]);
32610
34174
  }
32611
34175
  create(value) {
@@ -32627,6 +34191,9 @@ class BotCapability$Type extends import_runtime4.MessageType {
32627
34191
  case 2:
32628
34192
  message.version = reader.uint32();
32629
34193
  break;
34194
+ case 3:
34195
+ message.agentConfiguration = AgentConfigurationCatalog.internalBinaryRead(reader, reader.uint32(), options, message.agentConfiguration);
34196
+ break;
32630
34197
  default:
32631
34198
  let u = options.readUnknownField;
32632
34199
  if (u === "throw")
@@ -32643,6 +34210,8 @@ class BotCapability$Type extends import_runtime4.MessageType {
32643
34210
  writer.tag(1, import_runtime.WireType.Varint).int32(message.kind);
32644
34211
  if (message.version !== 0)
32645
34212
  writer.tag(2, import_runtime.WireType.Varint).uint32(message.version);
34213
+ if (message.agentConfiguration)
34214
+ AgentConfigurationCatalog.internalBinaryWrite(message.agentConfiguration, writer.tag(3, import_runtime.WireType.LengthDelimited).fork(), options).join();
32646
34215
  let u = options.writeUnknownFields;
32647
34216
  if (u !== false)
32648
34217
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -36058,17 +37627,229 @@ class FinishUploadInput$Type extends import_runtime4.MessageType {
36058
37627
  return writer;
36059
37628
  }
36060
37629
  }
36061
- var FinishUploadInput = new FinishUploadInput$Type;
37630
+ var FinishUploadInput = new FinishUploadInput$Type;
37631
+
37632
+ class UploadMissingParts$Type extends import_runtime4.MessageType {
37633
+ constructor() {
37634
+ super("UploadMissingParts", [
37635
+ { no: 1, name: "part_indices", kind: "scalar", repeat: 1, T: 13 }
37636
+ ]);
37637
+ }
37638
+ create(value) {
37639
+ const message = globalThis.Object.create(this.messagePrototype);
37640
+ message.partIndices = [];
37641
+ if (value !== undefined)
37642
+ import_runtime3.reflectionMergePartial(this, message, value);
37643
+ return message;
37644
+ }
37645
+ internalBinaryRead(reader, length, options, target) {
37646
+ let message = target ?? this.create(), end = reader.pos + length;
37647
+ while (reader.pos < end) {
37648
+ let [fieldNo, wireType] = reader.tag();
37649
+ switch (fieldNo) {
37650
+ case 1:
37651
+ if (wireType === import_runtime.WireType.LengthDelimited)
37652
+ for (let e = reader.int32() + reader.pos;reader.pos < e; )
37653
+ message.partIndices.push(reader.uint32());
37654
+ else
37655
+ message.partIndices.push(reader.uint32());
37656
+ break;
37657
+ default:
37658
+ let u = options.readUnknownField;
37659
+ if (u === "throw")
37660
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
37661
+ let d = reader.skip(wireType);
37662
+ if (u !== false)
37663
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
37664
+ }
37665
+ }
37666
+ return message;
37667
+ }
37668
+ internalBinaryWrite(message, writer, options) {
37669
+ if (message.partIndices.length) {
37670
+ writer.tag(1, import_runtime.WireType.LengthDelimited).fork();
37671
+ for (let i = 0;i < message.partIndices.length; i++)
37672
+ writer.uint32(message.partIndices[i]);
37673
+ writer.join();
37674
+ }
37675
+ let u = options.writeUnknownFields;
37676
+ if (u !== false)
37677
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
37678
+ return writer;
37679
+ }
37680
+ }
37681
+ var UploadMissingParts = new UploadMissingParts$Type;
37682
+
37683
+ class UploadProcessing$Type extends import_runtime4.MessageType {
37684
+ constructor() {
37685
+ super("UploadProcessing", [
37686
+ { no: 1, name: "retry_after_seconds", kind: "scalar", T: 13 }
37687
+ ]);
37688
+ }
37689
+ create(value) {
37690
+ const message = globalThis.Object.create(this.messagePrototype);
37691
+ message.retryAfterSeconds = 0;
37692
+ if (value !== undefined)
37693
+ import_runtime3.reflectionMergePartial(this, message, value);
37694
+ return message;
37695
+ }
37696
+ internalBinaryRead(reader, length, options, target) {
37697
+ let message = target ?? this.create(), end = reader.pos + length;
37698
+ while (reader.pos < end) {
37699
+ let [fieldNo, wireType] = reader.tag();
37700
+ switch (fieldNo) {
37701
+ case 1:
37702
+ message.retryAfterSeconds = reader.uint32();
37703
+ break;
37704
+ default:
37705
+ let u = options.readUnknownField;
37706
+ if (u === "throw")
37707
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
37708
+ let d = reader.skip(wireType);
37709
+ if (u !== false)
37710
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
37711
+ }
37712
+ }
37713
+ return message;
37714
+ }
37715
+ internalBinaryWrite(message, writer, options) {
37716
+ if (message.retryAfterSeconds !== 0)
37717
+ writer.tag(1, import_runtime.WireType.Varint).uint32(message.retryAfterSeconds);
37718
+ let u = options.writeUnknownFields;
37719
+ if (u !== false)
37720
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
37721
+ return writer;
37722
+ }
37723
+ }
37724
+ var UploadProcessing = new UploadProcessing$Type;
37725
+
37726
+ class FinishUploadResult$Type extends import_runtime4.MessageType {
37727
+ constructor() {
37728
+ super("FinishUploadResult", [
37729
+ { no: 1, name: "missing", kind: "message", oneof: "state", T: () => UploadMissingParts },
37730
+ { no: 2, name: "processing", kind: "message", oneof: "state", T: () => UploadProcessing },
37731
+ { no: 3, name: "complete", kind: "message", oneof: "state", T: () => UploadComplete },
37732
+ { no: 4, name: "failed", kind: "message", oneof: "state", T: () => UploadFailure }
37733
+ ]);
37734
+ }
37735
+ create(value) {
37736
+ const message = globalThis.Object.create(this.messagePrototype);
37737
+ message.state = { oneofKind: undefined };
37738
+ if (value !== undefined)
37739
+ import_runtime3.reflectionMergePartial(this, message, value);
37740
+ return message;
37741
+ }
37742
+ internalBinaryRead(reader, length, options, target) {
37743
+ let message = target ?? this.create(), end = reader.pos + length;
37744
+ while (reader.pos < end) {
37745
+ let [fieldNo, wireType] = reader.tag();
37746
+ switch (fieldNo) {
37747
+ case 1:
37748
+ message.state = {
37749
+ oneofKind: "missing",
37750
+ missing: UploadMissingParts.internalBinaryRead(reader, reader.uint32(), options, message.state.missing)
37751
+ };
37752
+ break;
37753
+ case 2:
37754
+ message.state = {
37755
+ oneofKind: "processing",
37756
+ processing: UploadProcessing.internalBinaryRead(reader, reader.uint32(), options, message.state.processing)
37757
+ };
37758
+ break;
37759
+ case 3:
37760
+ message.state = {
37761
+ oneofKind: "complete",
37762
+ complete: UploadComplete.internalBinaryRead(reader, reader.uint32(), options, message.state.complete)
37763
+ };
37764
+ break;
37765
+ case 4:
37766
+ message.state = {
37767
+ oneofKind: "failed",
37768
+ failed: UploadFailure.internalBinaryRead(reader, reader.uint32(), options, message.state.failed)
37769
+ };
37770
+ break;
37771
+ default:
37772
+ let u = options.readUnknownField;
37773
+ if (u === "throw")
37774
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
37775
+ let d = reader.skip(wireType);
37776
+ if (u !== false)
37777
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
37778
+ }
37779
+ }
37780
+ return message;
37781
+ }
37782
+ internalBinaryWrite(message, writer, options) {
37783
+ if (message.state.oneofKind === "missing")
37784
+ UploadMissingParts.internalBinaryWrite(message.state.missing, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
37785
+ if (message.state.oneofKind === "processing")
37786
+ UploadProcessing.internalBinaryWrite(message.state.processing, writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
37787
+ if (message.state.oneofKind === "complete")
37788
+ UploadComplete.internalBinaryWrite(message.state.complete, writer.tag(3, import_runtime.WireType.LengthDelimited).fork(), options).join();
37789
+ if (message.state.oneofKind === "failed")
37790
+ UploadFailure.internalBinaryWrite(message.state.failed, writer.tag(4, import_runtime.WireType.LengthDelimited).fork(), options).join();
37791
+ let u = options.writeUnknownFields;
37792
+ if (u !== false)
37793
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
37794
+ return writer;
37795
+ }
37796
+ }
37797
+ var FinishUploadResult = new FinishUploadResult$Type;
37798
+
37799
+ class CancelUploadInput$Type extends import_runtime4.MessageType {
37800
+ constructor() {
37801
+ super("CancelUploadInput", [
37802
+ { no: 1, name: "upload_id", kind: "scalar", T: 12 }
37803
+ ]);
37804
+ }
37805
+ create(value) {
37806
+ const message = globalThis.Object.create(this.messagePrototype);
37807
+ message.uploadId = new Uint8Array(0);
37808
+ if (value !== undefined)
37809
+ import_runtime3.reflectionMergePartial(this, message, value);
37810
+ return message;
37811
+ }
37812
+ internalBinaryRead(reader, length, options, target) {
37813
+ let message = target ?? this.create(), end = reader.pos + length;
37814
+ while (reader.pos < end) {
37815
+ let [fieldNo, wireType] = reader.tag();
37816
+ switch (fieldNo) {
37817
+ case 1:
37818
+ message.uploadId = reader.bytes();
37819
+ break;
37820
+ default:
37821
+ let u = options.readUnknownField;
37822
+ if (u === "throw")
37823
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
37824
+ let d = reader.skip(wireType);
37825
+ if (u !== false)
37826
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
37827
+ }
37828
+ }
37829
+ return message;
37830
+ }
37831
+ internalBinaryWrite(message, writer, options) {
37832
+ if (message.uploadId.length)
37833
+ writer.tag(1, import_runtime.WireType.LengthDelimited).bytes(message.uploadId);
37834
+ let u = options.writeUnknownFields;
37835
+ if (u !== false)
37836
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
37837
+ return writer;
37838
+ }
37839
+ }
37840
+ var CancelUploadInput = new CancelUploadInput$Type;
36062
37841
 
36063
- class UploadMissingParts$Type extends import_runtime4.MessageType {
37842
+ class CancelUploadResult$Type extends import_runtime4.MessageType {
36064
37843
  constructor() {
36065
- super("UploadMissingParts", [
36066
- { no: 1, name: "part_indices", kind: "scalar", repeat: 1, T: 13 }
37844
+ super("CancelUploadResult", [
37845
+ { no: 1, name: "canceled", kind: "scalar", T: 8 },
37846
+ { no: 2, name: "already_terminal", kind: "scalar", T: 8 }
36067
37847
  ]);
36068
37848
  }
36069
37849
  create(value) {
36070
37850
  const message = globalThis.Object.create(this.messagePrototype);
36071
- message.partIndices = [];
37851
+ message.canceled = false;
37852
+ message.alreadyTerminal = false;
36072
37853
  if (value !== undefined)
36073
37854
  import_runtime3.reflectionMergePartial(this, message, value);
36074
37855
  return message;
@@ -36079,11 +37860,10 @@ class UploadMissingParts$Type extends import_runtime4.MessageType {
36079
37860
  let [fieldNo, wireType] = reader.tag();
36080
37861
  switch (fieldNo) {
36081
37862
  case 1:
36082
- if (wireType === import_runtime.WireType.LengthDelimited)
36083
- for (let e = reader.int32() + reader.pos;reader.pos < e; )
36084
- message.partIndices.push(reader.uint32());
36085
- else
36086
- message.partIndices.push(reader.uint32());
37863
+ message.canceled = reader.bool();
37864
+ break;
37865
+ case 2:
37866
+ message.alreadyTerminal = reader.bool();
36087
37867
  break;
36088
37868
  default:
36089
37869
  let u = options.readUnknownField;
@@ -36097,29 +37877,82 @@ class UploadMissingParts$Type extends import_runtime4.MessageType {
36097
37877
  return message;
36098
37878
  }
36099
37879
  internalBinaryWrite(message, writer, options) {
36100
- if (message.partIndices.length) {
36101
- writer.tag(1, import_runtime.WireType.LengthDelimited).fork();
36102
- for (let i = 0;i < message.partIndices.length; i++)
36103
- writer.uint32(message.partIndices[i]);
36104
- writer.join();
37880
+ if (message.canceled !== false)
37881
+ writer.tag(1, import_runtime.WireType.Varint).bool(message.canceled);
37882
+ if (message.alreadyTerminal !== false)
37883
+ writer.tag(2, import_runtime.WireType.Varint).bool(message.alreadyTerminal);
37884
+ let u = options.writeUnknownFields;
37885
+ if (u !== false)
37886
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
37887
+ return writer;
37888
+ }
37889
+ }
37890
+ var CancelUploadResult = new CancelUploadResult$Type;
37891
+
37892
+ class FileMessageLocation$Type extends import_runtime4.MessageType {
37893
+ constructor() {
37894
+ super("FileMessageLocation", [
37895
+ { no: 1, name: "chat_id", kind: "scalar", T: 3, L: 0 },
37896
+ { no: 2, name: "message_id", kind: "scalar", T: 3, L: 0 }
37897
+ ]);
37898
+ }
37899
+ create(value) {
37900
+ const message = globalThis.Object.create(this.messagePrototype);
37901
+ message.chatId = 0n;
37902
+ message.messageId = 0n;
37903
+ if (value !== undefined)
37904
+ import_runtime3.reflectionMergePartial(this, message, value);
37905
+ return message;
37906
+ }
37907
+ internalBinaryRead(reader, length, options, target) {
37908
+ let message = target ?? this.create(), end = reader.pos + length;
37909
+ while (reader.pos < end) {
37910
+ let [fieldNo, wireType] = reader.tag();
37911
+ switch (fieldNo) {
37912
+ case 1:
37913
+ message.chatId = reader.int64().toBigInt();
37914
+ break;
37915
+ case 2:
37916
+ message.messageId = reader.int64().toBigInt();
37917
+ break;
37918
+ default:
37919
+ let u = options.readUnknownField;
37920
+ if (u === "throw")
37921
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
37922
+ let d = reader.skip(wireType);
37923
+ if (u !== false)
37924
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
37925
+ }
36105
37926
  }
37927
+ return message;
37928
+ }
37929
+ internalBinaryWrite(message, writer, options) {
37930
+ if (message.chatId !== 0n)
37931
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.chatId);
37932
+ if (message.messageId !== 0n)
37933
+ writer.tag(2, import_runtime.WireType.Varint).int64(message.messageId);
36106
37934
  let u = options.writeUnknownFields;
36107
37935
  if (u !== false)
36108
37936
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
36109
37937
  return writer;
36110
37938
  }
36111
37939
  }
36112
- var UploadMissingParts = new UploadMissingParts$Type;
37940
+ var FileMessageLocation = new FileMessageLocation$Type;
36113
37941
 
36114
- class UploadProcessing$Type extends import_runtime4.MessageType {
37942
+ class GetFilePartInput$Type extends import_runtime4.MessageType {
36115
37943
  constructor() {
36116
- super("UploadProcessing", [
36117
- { no: 1, name: "retry_after_seconds", kind: "scalar", T: 13 }
37944
+ super("GetFilePartInput", [
37945
+ { no: 1, name: "file_unique_id", kind: "scalar", T: 9 },
37946
+ { no: 2, name: "offset", kind: "scalar", T: 4, L: 0 },
37947
+ { no: 3, name: "limit", kind: "scalar", T: 13 },
37948
+ { no: 4, name: "message", kind: "message", T: () => FileMessageLocation }
36118
37949
  ]);
36119
37950
  }
36120
37951
  create(value) {
36121
37952
  const message = globalThis.Object.create(this.messagePrototype);
36122
- message.retryAfterSeconds = 0;
37953
+ message.fileUniqueId = "";
37954
+ message.offset = 0n;
37955
+ message.limit = 0;
36123
37956
  if (value !== undefined)
36124
37957
  import_runtime3.reflectionMergePartial(this, message, value);
36125
37958
  return message;
@@ -36130,7 +37963,16 @@ class UploadProcessing$Type extends import_runtime4.MessageType {
36130
37963
  let [fieldNo, wireType] = reader.tag();
36131
37964
  switch (fieldNo) {
36132
37965
  case 1:
36133
- message.retryAfterSeconds = reader.uint32();
37966
+ message.fileUniqueId = reader.string();
37967
+ break;
37968
+ case 2:
37969
+ message.offset = reader.uint64().toBigInt();
37970
+ break;
37971
+ case 3:
37972
+ message.limit = reader.uint32();
37973
+ break;
37974
+ case 4:
37975
+ message.message = FileMessageLocation.internalBinaryRead(reader, reader.uint32(), options, message.message);
36134
37976
  break;
36135
37977
  default:
36136
37978
  let u = options.readUnknownField;
@@ -36144,28 +37986,37 @@ class UploadProcessing$Type extends import_runtime4.MessageType {
36144
37986
  return message;
36145
37987
  }
36146
37988
  internalBinaryWrite(message, writer, options) {
36147
- if (message.retryAfterSeconds !== 0)
36148
- writer.tag(1, import_runtime.WireType.Varint).uint32(message.retryAfterSeconds);
37989
+ if (message.fileUniqueId !== "")
37990
+ writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.fileUniqueId);
37991
+ if (message.offset !== 0n)
37992
+ writer.tag(2, import_runtime.WireType.Varint).uint64(message.offset);
37993
+ if (message.limit !== 0)
37994
+ writer.tag(3, import_runtime.WireType.Varint).uint32(message.limit);
37995
+ if (message.message)
37996
+ FileMessageLocation.internalBinaryWrite(message.message, writer.tag(4, import_runtime.WireType.LengthDelimited).fork(), options).join();
36149
37997
  let u = options.writeUnknownFields;
36150
37998
  if (u !== false)
36151
37999
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
36152
38000
  return writer;
36153
38001
  }
36154
38002
  }
36155
- var UploadProcessing = new UploadProcessing$Type;
38003
+ var GetFilePartInput = new GetFilePartInput$Type;
36156
38004
 
36157
- class FinishUploadResult$Type extends import_runtime4.MessageType {
38005
+ class GetFilePartResult$Type extends import_runtime4.MessageType {
36158
38006
  constructor() {
36159
- super("FinishUploadResult", [
36160
- { no: 1, name: "missing", kind: "message", oneof: "state", T: () => UploadMissingParts },
36161
- { no: 2, name: "processing", kind: "message", oneof: "state", T: () => UploadProcessing },
36162
- { no: 3, name: "complete", kind: "message", oneof: "state", T: () => UploadComplete },
36163
- { no: 4, name: "failed", kind: "message", oneof: "state", T: () => UploadFailure }
38007
+ super("GetFilePartResult", [
38008
+ { no: 1, name: "offset", kind: "scalar", T: 4, L: 0 },
38009
+ { no: 2, name: "total_size", kind: "scalar", T: 4, L: 0 },
38010
+ { no: 3, name: "data", kind: "scalar", T: 12 },
38011
+ { no: 4, name: "sha256", kind: "scalar", T: 12 }
36164
38012
  ]);
36165
38013
  }
36166
38014
  create(value) {
36167
38015
  const message = globalThis.Object.create(this.messagePrototype);
36168
- message.state = { oneofKind: undefined };
38016
+ message.offset = 0n;
38017
+ message.totalSize = 0n;
38018
+ message.data = new Uint8Array(0);
38019
+ message.sha256 = new Uint8Array(0);
36169
38020
  if (value !== undefined)
36170
38021
  import_runtime3.reflectionMergePartial(this, message, value);
36171
38022
  return message;
@@ -36176,28 +38027,16 @@ class FinishUploadResult$Type extends import_runtime4.MessageType {
36176
38027
  let [fieldNo, wireType] = reader.tag();
36177
38028
  switch (fieldNo) {
36178
38029
  case 1:
36179
- message.state = {
36180
- oneofKind: "missing",
36181
- missing: UploadMissingParts.internalBinaryRead(reader, reader.uint32(), options, message.state.missing)
36182
- };
38030
+ message.offset = reader.uint64().toBigInt();
36183
38031
  break;
36184
38032
  case 2:
36185
- message.state = {
36186
- oneofKind: "processing",
36187
- processing: UploadProcessing.internalBinaryRead(reader, reader.uint32(), options, message.state.processing)
36188
- };
38033
+ message.totalSize = reader.uint64().toBigInt();
36189
38034
  break;
36190
38035
  case 3:
36191
- message.state = {
36192
- oneofKind: "complete",
36193
- complete: UploadComplete.internalBinaryRead(reader, reader.uint32(), options, message.state.complete)
36194
- };
38036
+ message.data = reader.bytes();
36195
38037
  break;
36196
38038
  case 4:
36197
- message.state = {
36198
- oneofKind: "failed",
36199
- failed: UploadFailure.internalBinaryRead(reader, reader.uint32(), options, message.state.failed)
36200
- };
38039
+ message.sha256 = reader.bytes();
36201
38040
  break;
36202
38041
  default:
36203
38042
  let u = options.readUnknownField;
@@ -36211,31 +38050,41 @@ class FinishUploadResult$Type extends import_runtime4.MessageType {
36211
38050
  return message;
36212
38051
  }
36213
38052
  internalBinaryWrite(message, writer, options) {
36214
- if (message.state.oneofKind === "missing")
36215
- UploadMissingParts.internalBinaryWrite(message.state.missing, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
36216
- if (message.state.oneofKind === "processing")
36217
- UploadProcessing.internalBinaryWrite(message.state.processing, writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
36218
- if (message.state.oneofKind === "complete")
36219
- UploadComplete.internalBinaryWrite(message.state.complete, writer.tag(3, import_runtime.WireType.LengthDelimited).fork(), options).join();
36220
- if (message.state.oneofKind === "failed")
36221
- UploadFailure.internalBinaryWrite(message.state.failed, writer.tag(4, import_runtime.WireType.LengthDelimited).fork(), options).join();
38053
+ if (message.offset !== 0n)
38054
+ writer.tag(1, import_runtime.WireType.Varint).uint64(message.offset);
38055
+ if (message.totalSize !== 0n)
38056
+ writer.tag(2, import_runtime.WireType.Varint).uint64(message.totalSize);
38057
+ if (message.data.length)
38058
+ writer.tag(3, import_runtime.WireType.LengthDelimited).bytes(message.data);
38059
+ if (message.sha256.length)
38060
+ writer.tag(4, import_runtime.WireType.LengthDelimited).bytes(message.sha256);
36222
38061
  let u = options.writeUnknownFields;
36223
38062
  if (u !== false)
36224
38063
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
36225
38064
  return writer;
36226
38065
  }
36227
38066
  }
36228
- var FinishUploadResult = new FinishUploadResult$Type;
38067
+ var GetFilePartResult = new GetFilePartResult$Type;
36229
38068
 
36230
- class CancelUploadInput$Type extends import_runtime4.MessageType {
38069
+ class ChatAcknowledgement$Type extends import_runtime4.MessageType {
36231
38070
  constructor() {
36232
- super("CancelUploadInput", [
36233
- { no: 1, name: "upload_id", kind: "scalar", T: 12 }
38071
+ super("ChatAcknowledgement", [
38072
+ { no: 1, name: "chat_id", kind: "scalar", T: 3, L: 0 },
38073
+ { no: 2, name: "user_id", kind: "scalar", T: 3, L: 0 },
38074
+ { no: 3, name: "max_id", kind: "scalar", T: 3, L: 0 },
38075
+ { no: 4, name: "user", kind: "message", T: () => User },
38076
+ { no: 5, name: "peer_id", kind: "message", T: () => Peer },
38077
+ { no: 6, name: "revision", kind: "scalar", T: 3, L: 0 },
38078
+ { no: 7, name: "cleared", kind: "scalar", T: 8 }
36234
38079
  ]);
36235
38080
  }
36236
38081
  create(value) {
36237
38082
  const message = globalThis.Object.create(this.messagePrototype);
36238
- message.uploadId = new Uint8Array(0);
38083
+ message.chatId = 0n;
38084
+ message.userId = 0n;
38085
+ message.maxId = 0n;
38086
+ message.revision = 0n;
38087
+ message.cleared = false;
36239
38088
  if (value !== undefined)
36240
38089
  import_runtime3.reflectionMergePartial(this, message, value);
36241
38090
  return message;
@@ -36246,7 +38095,25 @@ class CancelUploadInput$Type extends import_runtime4.MessageType {
36246
38095
  let [fieldNo, wireType] = reader.tag();
36247
38096
  switch (fieldNo) {
36248
38097
  case 1:
36249
- message.uploadId = reader.bytes();
38098
+ message.chatId = reader.int64().toBigInt();
38099
+ break;
38100
+ case 2:
38101
+ message.userId = reader.int64().toBigInt();
38102
+ break;
38103
+ case 3:
38104
+ message.maxId = reader.int64().toBigInt();
38105
+ break;
38106
+ case 4:
38107
+ message.user = User.internalBinaryRead(reader, reader.uint32(), options, message.user);
38108
+ break;
38109
+ case 5:
38110
+ message.peerId = Peer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
38111
+ break;
38112
+ case 6:
38113
+ message.revision = reader.int64().toBigInt();
38114
+ break;
38115
+ case 7:
38116
+ message.cleared = reader.bool();
36250
38117
  break;
36251
38118
  default:
36252
38119
  let u = options.readUnknownField;
@@ -36260,27 +38127,42 @@ class CancelUploadInput$Type extends import_runtime4.MessageType {
36260
38127
  return message;
36261
38128
  }
36262
38129
  internalBinaryWrite(message, writer, options) {
36263
- if (message.uploadId.length)
36264
- writer.tag(1, import_runtime.WireType.LengthDelimited).bytes(message.uploadId);
38130
+ if (message.chatId !== 0n)
38131
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.chatId);
38132
+ if (message.userId !== 0n)
38133
+ writer.tag(2, import_runtime.WireType.Varint).int64(message.userId);
38134
+ if (message.maxId !== 0n)
38135
+ writer.tag(3, import_runtime.WireType.Varint).int64(message.maxId);
38136
+ if (message.user)
38137
+ User.internalBinaryWrite(message.user, writer.tag(4, import_runtime.WireType.LengthDelimited).fork(), options).join();
38138
+ if (message.peerId)
38139
+ Peer.internalBinaryWrite(message.peerId, writer.tag(5, import_runtime.WireType.LengthDelimited).fork(), options).join();
38140
+ if (message.revision !== 0n)
38141
+ writer.tag(6, import_runtime.WireType.Varint).int64(message.revision);
38142
+ if (message.cleared !== false)
38143
+ writer.tag(7, import_runtime.WireType.Varint).bool(message.cleared);
36265
38144
  let u = options.writeUnknownFields;
36266
38145
  if (u !== false)
36267
38146
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
36268
38147
  return writer;
36269
38148
  }
36270
38149
  }
36271
- var CancelUploadInput = new CancelUploadInput$Type;
38150
+ var ChatAcknowledgement = new ChatAcknowledgement$Type;
36272
38151
 
36273
- class CancelUploadResult$Type extends import_runtime4.MessageType {
38152
+ class AcknowledgeMessagesInput$Type extends import_runtime4.MessageType {
36274
38153
  constructor() {
36275
- super("CancelUploadResult", [
36276
- { no: 1, name: "canceled", kind: "scalar", T: 8 },
36277
- { no: 2, name: "already_terminal", kind: "scalar", T: 8 }
38154
+ super("AcknowledgeMessagesInput", [
38155
+ { no: 1, name: "peer_id", kind: "message", T: () => InputPeer },
38156
+ { no: 2, name: "max_id", kind: "scalar", T: 3, L: 0 },
38157
+ { no: 3, name: "clear", kind: "scalar", T: 8 },
38158
+ { no: 4, name: "expected_revision", kind: "scalar", T: 3, L: 0 }
36278
38159
  ]);
36279
38160
  }
36280
38161
  create(value) {
36281
38162
  const message = globalThis.Object.create(this.messagePrototype);
36282
- message.canceled = false;
36283
- message.alreadyTerminal = false;
38163
+ message.maxId = 0n;
38164
+ message.clear = false;
38165
+ message.expectedRevision = 0n;
36284
38166
  if (value !== undefined)
36285
38167
  import_runtime3.reflectionMergePartial(this, message, value);
36286
38168
  return message;
@@ -36291,10 +38173,16 @@ class CancelUploadResult$Type extends import_runtime4.MessageType {
36291
38173
  let [fieldNo, wireType] = reader.tag();
36292
38174
  switch (fieldNo) {
36293
38175
  case 1:
36294
- message.canceled = reader.bool();
38176
+ message.peerId = InputPeer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
36295
38177
  break;
36296
38178
  case 2:
36297
- message.alreadyTerminal = reader.bool();
38179
+ message.maxId = reader.int64().toBigInt();
38180
+ break;
38181
+ case 3:
38182
+ message.clear = reader.bool();
38183
+ break;
38184
+ case 4:
38185
+ message.expectedRevision = reader.int64().toBigInt();
36298
38186
  break;
36299
38187
  default:
36300
38188
  let u = options.readUnknownField;
@@ -36308,17 +38196,107 @@ class CancelUploadResult$Type extends import_runtime4.MessageType {
36308
38196
  return message;
36309
38197
  }
36310
38198
  internalBinaryWrite(message, writer, options) {
36311
- if (message.canceled !== false)
36312
- writer.tag(1, import_runtime.WireType.Varint).bool(message.canceled);
36313
- if (message.alreadyTerminal !== false)
36314
- writer.tag(2, import_runtime.WireType.Varint).bool(message.alreadyTerminal);
38199
+ if (message.peerId)
38200
+ InputPeer.internalBinaryWrite(message.peerId, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
38201
+ if (message.maxId !== 0n)
38202
+ writer.tag(2, import_runtime.WireType.Varint).int64(message.maxId);
38203
+ if (message.clear !== false)
38204
+ writer.tag(3, import_runtime.WireType.Varint).bool(message.clear);
38205
+ if (message.expectedRevision !== 0n)
38206
+ writer.tag(4, import_runtime.WireType.Varint).int64(message.expectedRevision);
36315
38207
  let u = options.writeUnknownFields;
36316
38208
  if (u !== false)
36317
38209
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
36318
38210
  return writer;
36319
38211
  }
36320
38212
  }
36321
- var CancelUploadResult = new CancelUploadResult$Type;
38213
+ var AcknowledgeMessagesInput = new AcknowledgeMessagesInput$Type;
38214
+
38215
+ class AcknowledgeMessagesResult$Type extends import_runtime4.MessageType {
38216
+ constructor() {
38217
+ super("AcknowledgeMessagesResult", [
38218
+ { no: 1, name: "updates", kind: "message", repeat: 1, T: () => Update }
38219
+ ]);
38220
+ }
38221
+ create(value) {
38222
+ const message = globalThis.Object.create(this.messagePrototype);
38223
+ message.updates = [];
38224
+ if (value !== undefined)
38225
+ import_runtime3.reflectionMergePartial(this, message, value);
38226
+ return message;
38227
+ }
38228
+ internalBinaryRead(reader, length, options, target) {
38229
+ let message = target ?? this.create(), end = reader.pos + length;
38230
+ while (reader.pos < end) {
38231
+ let [fieldNo, wireType] = reader.tag();
38232
+ switch (fieldNo) {
38233
+ case 1:
38234
+ message.updates.push(Update.internalBinaryRead(reader, reader.uint32(), options));
38235
+ break;
38236
+ default:
38237
+ let u = options.readUnknownField;
38238
+ if (u === "throw")
38239
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
38240
+ let d = reader.skip(wireType);
38241
+ if (u !== false)
38242
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
38243
+ }
38244
+ }
38245
+ return message;
38246
+ }
38247
+ internalBinaryWrite(message, writer, options) {
38248
+ for (let i = 0;i < message.updates.length; i++)
38249
+ Update.internalBinaryWrite(message.updates[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
38250
+ let u = options.writeUnknownFields;
38251
+ if (u !== false)
38252
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
38253
+ return writer;
38254
+ }
38255
+ }
38256
+ var AcknowledgeMessagesResult = new AcknowledgeMessagesResult$Type;
38257
+
38258
+ class ChatAcknowledgements$Type extends import_runtime4.MessageType {
38259
+ constructor() {
38260
+ super("ChatAcknowledgements", [
38261
+ { no: 1, name: "cursors", kind: "message", repeat: 1, T: () => ChatAcknowledgement }
38262
+ ]);
38263
+ }
38264
+ create(value) {
38265
+ const message = globalThis.Object.create(this.messagePrototype);
38266
+ message.cursors = [];
38267
+ if (value !== undefined)
38268
+ import_runtime3.reflectionMergePartial(this, message, value);
38269
+ return message;
38270
+ }
38271
+ internalBinaryRead(reader, length, options, target) {
38272
+ let message = target ?? this.create(), end = reader.pos + length;
38273
+ while (reader.pos < end) {
38274
+ let [fieldNo, wireType] = reader.tag();
38275
+ switch (fieldNo) {
38276
+ case 1:
38277
+ message.cursors.push(ChatAcknowledgement.internalBinaryRead(reader, reader.uint32(), options));
38278
+ break;
38279
+ default:
38280
+ let u = options.readUnknownField;
38281
+ if (u === "throw")
38282
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
38283
+ let d = reader.skip(wireType);
38284
+ if (u !== false)
38285
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
38286
+ }
38287
+ }
38288
+ return message;
38289
+ }
38290
+ internalBinaryWrite(message, writer, options) {
38291
+ for (let i = 0;i < message.cursors.length; i++)
38292
+ ChatAcknowledgement.internalBinaryWrite(message.cursors[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
38293
+ let u = options.writeUnknownFields;
38294
+ if (u !== false)
38295
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
38296
+ return writer;
38297
+ }
38298
+ }
38299
+ var ChatAcknowledgements = new ChatAcknowledgements$Type;
36322
38300
 
36323
38301
  // ../node_modules/.bun/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/utils.js
36324
38302
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
@@ -36641,23 +38619,37 @@ class SHA256 extends HashMD {
36641
38619
  }
36642
38620
  var sha256 = /* @__PURE__ */ createHasher(() => new SHA256);
36643
38621
 
38622
+ // ../packages/protocol/dist/transfers.js
38623
+ var INLINE_TRANSFER_PART_SIZE = 512 * 1024;
38624
+ var INLINE_UPLOAD_MAX_PARTS = 1000;
38625
+
36644
38626
  // ../packages/protocol/dist/uploads.js
36645
38627
  var HASH_READ_SIZE = 1024 * 1024;
36646
- var MAX_NEGOTIATED_PART_SIZE = 16 * 1024 * 1024;
36647
38628
  var DEFAULT_GLOBAL_CONCURRENCY = 3;
36648
38629
  var DEFAULT_UPLOAD_CONCURRENCY = 2;
36649
38630
  var MAX_PART_ATTEMPTS = 2;
36650
38631
  var MAX_FINISH_RECONCILIATION_ATTEMPTS = 3;
36651
38632
  var FINISH_RECONCILIATION_DELAY_SECONDS = 1;
36652
38633
  var MAX_PROCESSING_RETRY_SECONDS = 30;
38634
+ var CANCEL_RPC_TIMEOUT_MS = 5000;
38635
+ var MAX_UPLOAD_BYTES_BY_KIND = {
38636
+ [UploadKind.PHOTO]: 40000000,
38637
+ [UploadKind.VIDEO]: 200000000,
38638
+ [UploadKind.DOCUMENT]: 200000000,
38639
+ [UploadKind.VOICE]: 20000000
38640
+ };
36653
38641
  var boundedUploadProcessingRetrySeconds = (seconds) => Number.isNaN(seconds) ? 1 : Math.min(MAX_PROCESSING_RETRY_SECONDS, Math.max(1, Math.floor(seconds)));
36654
38642
  var randomUploadId = () => {
36655
38643
  const bytes = new Uint8Array(16);
36656
38644
  globalThis.crypto.getRandomValues(bytes);
36657
38645
  return bytes;
36658
38646
  };
36659
- var exactRead = async (source, offset, length) => {
36660
- const bytes = await source.read(offset, length);
38647
+ var exactRead = async (source, offset, length, signal) => {
38648
+ if (signal?.aborted)
38649
+ throw new NativeUploadError("canceled", "Upload was canceled");
38650
+ const bytes = await source.read(offset, length, signal);
38651
+ if (signal?.aborted)
38652
+ throw new NativeUploadError("canceled", "Upload was canceled");
36661
38653
  if (bytes.length !== length)
36662
38654
  throw new NativeUploadError("source_changed", "Upload source changed while it was being read");
36663
38655
  return bytes;
@@ -36668,7 +38660,7 @@ var sourceHash = async (source, signal) => {
36668
38660
  if (signal?.aborted)
36669
38661
  throw new NativeUploadError("canceled", "Upload was canceled");
36670
38662
  const length = Math.min(HASH_READ_SIZE, source.byteCount - offset);
36671
- const bytes = await exactRead(source, offset, length);
38663
+ const bytes = await exactRead(source, offset, length, signal);
36672
38664
  if (signal?.aborted)
36673
38665
  throw new NativeUploadError("canceled", "Upload was canceled");
36674
38666
  hash.update(bytes);
@@ -36688,12 +38680,18 @@ var validatePartIndices = (indices, partCount) => {
36688
38680
  throw new NativeUploadError("protocol", "Server returned an invalid upload-part index");
36689
38681
  }
36690
38682
  };
38683
+ var reportProgress = (job) => {
38684
+ try {
38685
+ job.input.onProgress?.({ acceptedBytes: acceptedBytes(job), totalBytes: job.input.source.byteCount });
38686
+ } catch {}
38687
+ };
36691
38688
  var delay = async (seconds, signal) => {
36692
38689
  if (signal?.aborted)
36693
38690
  throw new NativeUploadError("canceled", "Upload was canceled");
36694
38691
  await new Promise((resolve, reject) => {
36695
38692
  const onAbort = () => {
36696
38693
  clearTimeout(timeout);
38694
+ signal?.removeEventListener("abort", onAbort);
36697
38695
  reject(new NativeUploadError("canceled", "Upload was canceled"));
36698
38696
  };
36699
38697
  const timeout = setTimeout(() => {
@@ -36701,6 +38699,8 @@ var delay = async (seconds, signal) => {
36701
38699
  resolve();
36702
38700
  }, Math.max(1, seconds) * 1000);
36703
38701
  signal?.addEventListener("abort", onAbort, { once: true });
38702
+ if (signal?.aborted)
38703
+ onAbort();
36704
38704
  });
36705
38705
  };
36706
38706
 
@@ -36710,6 +38710,7 @@ class NativeUploadClient {
36710
38710
  uploadConcurrency;
36711
38711
  #jobs = [];
36712
38712
  #active = 0;
38713
+ #finishing = 0;
36713
38714
  #cursor = 0;
36714
38715
  constructor(rpc, globalConcurrency = DEFAULT_GLOBAL_CONCURRENCY, uploadConcurrency = DEFAULT_UPLOAD_CONCURRENCY) {
36715
38716
  this.rpc = rpc;
@@ -36723,13 +38724,17 @@ class NativeUploadClient {
36723
38724
  if (!Number.isSafeInteger(input.source.byteCount) || input.source.byteCount <= 0) {
36724
38725
  throw new NativeUploadError("invalid_source", "Upload source must have a positive safe byte count");
36725
38726
  }
38727
+ const maximumByteCount = MAX_UPLOAD_BYTES_BY_KIND[input.kind];
38728
+ if (maximumByteCount === undefined || input.source.byteCount > maximumByteCount) {
38729
+ throw new NativeUploadError("invalid_source", "Upload source exceeds the media size limit");
38730
+ }
36726
38731
  if (input.signal?.aborted)
36727
38732
  throw new NativeUploadError("canceled", "Upload was canceled");
36728
38733
  const clientUploadId = input.clientUploadId?.slice() ?? randomUploadId();
36729
38734
  if (clientUploadId.length !== 16)
36730
38735
  throw new NativeUploadError("invalid_source", "Client upload ID must be 16 bytes");
36731
38736
  const digest = await sourceHash(input.source, input.signal);
36732
- const created = await this.rpc.create({
38737
+ const createInput = {
36733
38738
  clientUploadId,
36734
38739
  fileName: input.fileName,
36735
38740
  mimeType: input.mimeType,
@@ -36738,8 +38743,24 @@ class NativeUploadClient {
36738
38743
  kind: input.kind,
36739
38744
  thumbnailFileUniqueId: input.thumbnailFileUniqueId,
36740
38745
  metadata: input.metadata?.kind === "video" ? { oneofKind: "video", video: input.metadata.value } : input.metadata?.kind === "voice" ? { oneofKind: "voice", voice: input.metadata.value } : { oneofKind: undefined }
36741
- });
36742
- if (created.uploadId.length !== 16 || created.partSize < 1 || created.partSize > MAX_NEGOTIATED_PART_SIZE || created.partCount < 1 || created.partCount !== Math.ceil(input.source.byteCount / created.partSize) || created.acceptedParts.some((index) => !Number.isInteger(index) || index < 0 || index >= created.partCount)) {
38746
+ };
38747
+ let created;
38748
+ try {
38749
+ created = await this.rpc.create(createInput, input.signal);
38750
+ } catch (error) {
38751
+ if (input.signal?.aborted)
38752
+ throw new NativeUploadError("canceled", "Upload was canceled");
38753
+ if (this.rpc.shouldReplayCreate?.(error) === false)
38754
+ throw error;
38755
+ try {
38756
+ created = await this.rpc.create(createInput, input.signal);
38757
+ } catch (replayError) {
38758
+ if (input.signal?.aborted)
38759
+ throw new NativeUploadError("canceled", "Upload was canceled");
38760
+ throw replayError;
38761
+ }
38762
+ }
38763
+ if (created.uploadId.length !== 16 || created.partSize !== INLINE_TRANSFER_PART_SIZE || !Number.isSafeInteger(created.partCount) || created.partCount < 1 || created.partCount > INLINE_UPLOAD_MAX_PARTS || created.partCount !== Math.ceil(input.source.byteCount / created.partSize) || created.acceptedParts.some((index) => !Number.isInteger(index) || index < 0 || index >= created.partCount)) {
36743
38764
  throw new NativeUploadError("protocol", "Server returned invalid upload geometry");
36744
38765
  }
36745
38766
  return await new Promise((resolve, reject) => {
@@ -36764,13 +38785,13 @@ class NativeUploadClient {
36764
38785
  this.#abort(job);
36765
38786
  return;
36766
38787
  }
36767
- input.onProgress?.({ acceptedBytes: acceptedBytes(job), totalBytes: input.source.byteCount });
38788
+ reportProgress(job);
36768
38789
  if (!job.settled)
36769
38790
  this.#pump();
36770
38791
  });
36771
38792
  }
36772
38793
  #pump() {
36773
- while (this.#active < this.globalConcurrency) {
38794
+ while (this.#active + this.#finishing < this.globalConcurrency) {
36774
38795
  const selected = this.#nextJob();
36775
38796
  if (!selected)
36776
38797
  break;
@@ -36785,6 +38806,10 @@ class NativeUploadClient {
36785
38806
  this.#active += 1;
36786
38807
  this.#sendPart(selected, partIndex);
36787
38808
  }
38809
+ for (const job of this.#jobs) {
38810
+ if (!job.settled && job.active === 0 && this.#nextPart(job) === undefined)
38811
+ this.#finish(job);
38812
+ }
36788
38813
  }
36789
38814
  #nextJob() {
36790
38815
  for (let offset = 0;offset < this.#jobs.length; offset += 1) {
@@ -36810,14 +38835,14 @@ class NativeUploadClient {
36810
38835
  throw new NativeUploadError("canceled", "Upload was canceled");
36811
38836
  const offset = partIndex * job.upload.partSize;
36812
38837
  const length = Math.min(job.upload.partSize, job.input.source.byteCount - offset);
36813
- const data = await exactRead(job.input.source, offset, length);
38838
+ const data = await exactRead(job.input.source, offset, length, job.input.signal);
36814
38839
  if (job.settled)
36815
38840
  return;
36816
38841
  await this.#savePart(job, partIndex, data);
36817
38842
  if (job.settled)
36818
38843
  return;
36819
38844
  job.accepted.add(partIndex);
36820
- job.input.onProgress?.({ acceptedBytes: acceptedBytes(job), totalBytes: job.input.source.byteCount });
38845
+ reportProgress(job);
36821
38846
  } catch (error) {
36822
38847
  if (!job.settled && !job.input.signal?.aborted) {
36823
38848
  this.#reject(job, error);
@@ -36837,7 +38862,7 @@ class NativeUploadClient {
36837
38862
  throw new NativeUploadError("canceled", "Upload was canceled");
36838
38863
  }
36839
38864
  try {
36840
- await this.rpc.savePart({ uploadId: job.upload.uploadId, partIndex, data });
38865
+ await this.rpc.savePart({ uploadId: job.upload.uploadId, partIndex, data }, job.input.signal);
36841
38866
  return;
36842
38867
  } catch (error) {
36843
38868
  if (job.settled || job.input.signal?.aborted) {
@@ -36845,7 +38870,7 @@ class NativeUploadClient {
36845
38870
  }
36846
38871
  let state;
36847
38872
  try {
36848
- state = await this.rpc.state({ uploadId: job.upload.uploadId });
38873
+ state = await this.rpc.state({ uploadId: job.upload.uploadId }, job.input.signal);
36849
38874
  } catch {
36850
38875
  throw error;
36851
38876
  }
@@ -36858,8 +38883,9 @@ class NativeUploadClient {
36858
38883
  }
36859
38884
  }
36860
38885
  async#finish(job) {
36861
- if (job.settled || job.active > 0)
38886
+ if (job.settled || job.active !== 0 || this.#active + this.#finishing >= this.globalConcurrency)
36862
38887
  return;
38888
+ this.#finishing += 1;
36863
38889
  job.active = -1;
36864
38890
  let reconciliationAttempts = 0;
36865
38891
  try {
@@ -36868,7 +38894,7 @@ class NativeUploadClient {
36868
38894
  throw new NativeUploadError("canceled", "Upload was canceled");
36869
38895
  let result;
36870
38896
  try {
36871
- result = await this.rpc.finish({ uploadId: job.upload.uploadId });
38897
+ result = await this.rpc.finish({ uploadId: job.upload.uploadId }, job.input.signal);
36872
38898
  } catch (error) {
36873
38899
  if (job.input.signal?.aborted)
36874
38900
  throw new NativeUploadError("canceled", "Upload was canceled");
@@ -36876,7 +38902,7 @@ class NativeUploadClient {
36876
38902
  throw error;
36877
38903
  let state;
36878
38904
  try {
36879
- state = await this.rpc.state({ uploadId: job.upload.uploadId });
38905
+ state = await this.rpc.state({ uploadId: job.upload.uploadId }, job.input.signal);
36880
38906
  } catch {
36881
38907
  throw error;
36882
38908
  }
@@ -36890,8 +38916,8 @@ class NativeUploadClient {
36890
38916
  job.resolve(state.complete);
36891
38917
  return;
36892
38918
  case UploadStatus.PROCESSING:
36893
- await delay(FINISH_RECONCILIATION_DELAY_SECONDS, job.input.signal);
36894
- continue;
38919
+ this.#resumeFinishAfter(job, FINISH_RECONCILIATION_DELAY_SECONDS);
38920
+ return;
36895
38921
  case UploadStatus.UPLOADING:
36896
38922
  job.accepted = new Set(state.acceptedParts);
36897
38923
  if (this.#nextPart(job) === undefined)
@@ -36918,6 +38944,9 @@ class NativeUploadClient {
36918
38944
  case "failed":
36919
38945
  throw new NativeUploadError(result.state.failed.retryable ? "retryable" : "rejected", `Upload finalization failed with code ${result.state.failed.code}`);
36920
38946
  case "missing":
38947
+ if (result.state.missing.partIndices.length === 0) {
38948
+ throw new NativeUploadError("protocol", "Server returned an empty missing-parts result");
38949
+ }
36921
38950
  validatePartIndices(result.state.missing.partIndices, job.upload.partCount);
36922
38951
  for (const index of result.state.missing.partIndices)
36923
38952
  job.accepted.delete(index);
@@ -36925,21 +38954,35 @@ class NativeUploadClient {
36925
38954
  this.#pump();
36926
38955
  return;
36927
38956
  case "processing":
36928
- await delay(boundedUploadProcessingRetrySeconds(result.state.processing.retryAfterSeconds), job.input.signal);
36929
- break;
38957
+ this.#resumeFinishAfter(job, boundedUploadProcessingRetrySeconds(result.state.processing.retryAfterSeconds));
38958
+ return;
36930
38959
  default:
36931
38960
  throw new NativeUploadError("protocol", "Server returned an empty finish result");
36932
38961
  }
36933
38962
  }
36934
38963
  } catch (error) {
36935
38964
  this.#reject(job, error);
38965
+ } finally {
38966
+ this.#finishing -= 1;
38967
+ this.#pump();
36936
38968
  }
36937
38969
  }
38970
+ #resumeFinishAfter(job, seconds) {
38971
+ delay(seconds, job.input.signal).then(() => {
38972
+ if (job.settled)
38973
+ return;
38974
+ job.active = 0;
38975
+ this.#finish(job);
38976
+ }, (error) => {
38977
+ if (!job.settled)
38978
+ this.#reject(job, error);
38979
+ });
38980
+ }
36938
38981
  #abort(job) {
36939
38982
  if (job.settled)
36940
38983
  return;
36941
38984
  this.#reject(job, new NativeUploadError("canceled", "Upload was canceled"));
36942
- this.rpc.cancel({ uploadId: job.upload.uploadId }).catch(() => {});
38985
+ this.rpc.cancel({ uploadId: job.upload.uploadId }, AbortSignal.timeout(CANCEL_RPC_TIMEOUT_MS)).catch(() => {});
36943
38986
  }
36944
38987
  #reject(job, error) {
36945
38988
  if (job.settled)
@@ -36970,33 +39013,34 @@ var uploadByteSource = (value) => {
36970
39013
  read: async (offset, length) => bytes.slice(offset, offset + length)
36971
39014
  };
36972
39015
  };
36973
- var rpcUploadTransport = (call) => ({
36974
- create: async (input) => {
36975
- const result = await call(Method.CREATE_UPLOAD, { oneofKind: "createUpload", createUpload: input });
39016
+ var rpcUploadTransport = (call, shouldReplayCreate) => ({
39017
+ shouldReplayCreate,
39018
+ create: async (input, signal) => {
39019
+ const result = await call(Method.CREATE_UPLOAD, { oneofKind: "createUpload", createUpload: input }, signal);
36976
39020
  if (result.oneofKind !== "createUpload")
36977
39021
  throw new NativeUploadError("protocol", "Unexpected createUpload result");
36978
39022
  return result.createUpload;
36979
39023
  },
36980
- savePart: async (input) => {
36981
- const result = await call(Method.SAVE_UPLOAD_PART, { oneofKind: "saveUploadPart", saveUploadPart: input });
39024
+ savePart: async (input, signal) => {
39025
+ const result = await call(Method.SAVE_UPLOAD_PART, { oneofKind: "saveUploadPart", saveUploadPart: input }, signal);
36982
39026
  if (result.oneofKind !== "saveUploadPart")
36983
39027
  throw new NativeUploadError("protocol", "Unexpected saveUploadPart result");
36984
39028
  return result.saveUploadPart;
36985
39029
  },
36986
- state: async (input) => {
36987
- const result = await call(Method.GET_UPLOAD_STATE, { oneofKind: "getUploadState", getUploadState: input });
39030
+ state: async (input, signal) => {
39031
+ const result = await call(Method.GET_UPLOAD_STATE, { oneofKind: "getUploadState", getUploadState: input }, signal);
36988
39032
  if (result.oneofKind !== "getUploadState")
36989
39033
  throw new NativeUploadError("protocol", "Unexpected getUploadState result");
36990
39034
  return result.getUploadState;
36991
39035
  },
36992
- finish: async (input) => {
36993
- const result = await call(Method.FINISH_UPLOAD, { oneofKind: "finishUpload", finishUpload: input });
39036
+ finish: async (input, signal) => {
39037
+ const result = await call(Method.FINISH_UPLOAD, { oneofKind: "finishUpload", finishUpload: input }, signal);
36994
39038
  if (result.oneofKind !== "finishUpload")
36995
39039
  throw new NativeUploadError("protocol", "Unexpected finishUpload result");
36996
39040
  return result.finishUpload;
36997
39041
  },
36998
- cancel: async (input) => {
36999
- const result = await call(Method.CANCEL_UPLOAD, { oneofKind: "cancelUpload", cancelUpload: input });
39042
+ cancel: async (input, signal) => {
39043
+ const result = await call(Method.CANCEL_UPLOAD, { oneofKind: "cancelUpload", cancelUpload: input }, signal);
37000
39044
  if (result.oneofKind !== "cancelUpload")
37001
39045
  throw new NativeUploadError("protocol", "Unexpected cancelUpload result");
37002
39046
  return result.cancelUpload;
@@ -37532,6 +39576,7 @@ class ProtocolClient {
37532
39576
  async callRpc(method, input = emptyRpcInput, options) {
37533
39577
  if (this.terminalAuthenticationError)
37534
39578
  throw this.terminalAuthenticationError;
39579
+ options?.signal?.throwIfAborted();
37535
39580
  assertValidRpcMethod(method);
37536
39581
  if (this.pendingRpcRequests.size >= this.maxPendingRpcRequests) {
37537
39582
  throw new ProtocolClientError("capacity-exceeded", {
@@ -37553,6 +39598,14 @@ class ProtocolClient {
37553
39598
  sending: false
37554
39599
  };
37555
39600
  this.pendingRpcRequests.set(message.id, pending);
39601
+ const onAbort = () => {
39602
+ const reason = options?.signal?.reason;
39603
+ this.failPendingRpcRequest(message.id, reason instanceof Error ? reason : new DOMException("The operation was aborted", "AbortError"));
39604
+ };
39605
+ options?.signal?.addEventListener("abort", onAbort, { once: true });
39606
+ pending.removeAbortListener = () => options?.signal?.removeEventListener("abort", onAbort);
39607
+ if (options?.signal?.aborted)
39608
+ onAbort();
37556
39609
  if (pending.timeoutMs !== null) {
37557
39610
  pending.timeout = setTimeout(() => {
37558
39611
  this.failPendingRpcRequest(message.id, pending.attempted && pending.reconnectPolicy === "never-replay" ? commitOutcomeUnknownError("RPC timed out after dispatch") : new ProtocolClientError("timeout"));
@@ -37801,6 +39854,7 @@ class ProtocolClient {
37801
39854
  return null;
37802
39855
  if (pending.timeout)
37803
39856
  clearTimeout(pending.timeout);
39857
+ pending.removeAbortListener?.();
37804
39858
  this.pendingRpcRequests.delete(msgId);
37805
39859
  return pending;
37806
39860
  }
@@ -37809,6 +39863,7 @@ class ProtocolClient {
37809
39863
  pending.reject(error);
37810
39864
  if (pending.timeout)
37811
39865
  clearTimeout(pending.timeout);
39866
+ pending.removeAbortListener?.();
37812
39867
  }
37813
39868
  this.pendingRpcRequests.clear();
37814
39869
  }
@@ -37925,7 +39980,7 @@ function describeConnectionError(error) {
37925
39980
  return `server connection error${suffix}: ${message}`;
37926
39981
  }
37927
39982
 
37928
- // ../node_modules/.bun/ws@8.21.0/node_modules/ws/wrapper.mjs
39983
+ // ../node_modules/.bun/ws@8.21.3/node_modules/ws/wrapper.mjs
37929
39984
  var import_stream = __toESM(require_stream(), 1);
37930
39985
  var import_extension = __toESM(require_extension(), 1);
37931
39986
  var import_permessage_deflate = __toESM(require_permessage_deflate(), 1);
@@ -39934,21 +41989,40 @@ class AcknowledgementQueue {
39934
41989
 
39935
41990
  class PendingMessageCache {
39936
41991
  capacity;
41992
+ byteCapacity;
39937
41993
  #messages = new Map;
39938
- constructor(capacity = 8192) {
41994
+ #retainedBytes = 0;
41995
+ constructor(capacity = 8192, byteCapacity = 32 * 1024 * 1024) {
39939
41996
  this.capacity = capacity;
41997
+ this.byteCapacity = byteCapacity;
39940
41998
  if (!Number.isSafeInteger(capacity) || capacity < 1 || capacity > 8192)
39941
41999
  throw new RangeError("Invalid pending-message capacity");
42000
+ if (!Number.isSafeInteger(byteCapacity) || byteCapacity < 1)
42001
+ throw new RangeError("Invalid pending-message byte capacity");
42002
+ }
42003
+ get retainedBytes() {
42004
+ return this.#retainedBytes;
39942
42005
  }
39943
42006
  retain(message) {
39944
42007
  if (this.#messages.size >= this.capacity && !this.#messages.has(message.messageId)) {
39945
42008
  throw new RangeError("Pending-message cache is full");
39946
42009
  }
39947
- this.#messages.set(message.messageId, { ...message, body: message.body.slice() });
42010
+ const previous = this.#messages.get(message.messageId);
42011
+ const nextBytes = this.#retainedBytes - (previous?.body.length ?? 0) + message.body.length;
42012
+ if (nextBytes > this.byteCapacity)
42013
+ throw new RangeError("Pending-message byte capacity exceeded");
42014
+ const body = message.body.slice();
42015
+ this.#messages.set(message.messageId, { ...message, body });
42016
+ this.#retainedBytes = nextBytes;
39948
42017
  }
39949
42018
  acknowledge(messageIds) {
39950
- for (const messageId of messageIds)
42019
+ for (const messageId of messageIds) {
42020
+ const message = this.#messages.get(messageId);
42021
+ if (!message)
42022
+ continue;
39951
42023
  this.#messages.delete(messageId);
42024
+ this.#retainedBytes -= message.body.length;
42025
+ }
39952
42026
  }
39953
42027
  resend(messageIds) {
39954
42028
  return messageIds.flatMap((messageId) => {
@@ -39967,6 +42041,7 @@ class PendingMessageCache {
39967
42041
  if (view.getUint32(0, true) !== 4082920705 || view.getBigInt64(4, true) !== requestMessageId)
39968
42042
  continue;
39969
42043
  this.#messages.delete(messageId);
42044
+ this.#retainedBytes -= message.body.length;
39970
42045
  return { ...message, body: message.body.slice() };
39971
42046
  }
39972
42047
  return;
@@ -41001,11 +43076,12 @@ class InlineProtocolServerSession {
41001
43076
  try {
41002
43077
  const resultObject = input.dispatched.kind === "result" ? encodeInlineResult(input.dispatched.payload) : encodeRpcError(input.dispatched.code, input.dispatched.message);
41003
43078
  const resultBody = encodeRpcResult(input.messageId, resultObject);
43079
+ const replayResultBody = input.dispatched.kind === "result" && input.dispatched.replayPayload ? encodeRpcResult(input.messageId, encodeInlineResult(input.dispatched.replayPayload)) : resultBody;
41004
43080
  const completion = await this.options.replay.complete({
41005
43081
  authKeyId: input.authKeyId,
41006
43082
  sessionId: input.sessionId,
41007
43083
  messageId: input.messageId,
41008
- resultBody
43084
+ resultBody: replayResultBody
41009
43085
  });
41010
43086
  const terminateAuthorization = input.dispatched.terminateAuthorization === true;
41011
43087
  if (terminateAuthorization) {
@@ -41349,7 +43425,7 @@ class InlineProtocolV3Connection {
41349
43425
  this.#sessionId = randomInt64(this.#random);
41350
43426
  this.#authorization = options.authorization ? cloneAuthorization(options.authorization) : undefined;
41351
43427
  this.#rsaKeys = options.authorization ? [] : decodePublicKeys(options.rsaPublicKeys);
41352
- this.#uploads = new NativeUploadClient(rpcUploadTransport((method, input) => this.callRpc({ method, input })));
43428
+ this.#uploads = new NativeUploadClient(rpcUploadTransport((method, input, signal) => this.callRpc({ method, input }, signal), (error) => error instanceof InlineProtocolV3Error && error.code === "commit-outcome-unknown"));
41353
43429
  }
41354
43430
  static async connect(options) {
41355
43431
  const connection = new InlineProtocolV3Connection(options);
@@ -41400,9 +43476,9 @@ class InlineProtocolV3Connection {
41400
43476
  async invoke(request) {
41401
43477
  return await this.#invoke(request);
41402
43478
  }
41403
- async#invoke(request, onDispatched) {
43479
+ async#invoke(request, onDispatched, signal) {
41404
43480
  const payload = RealtimeV3Request.toBinary(request);
41405
- const result = await this.#sendContent(encodeInlineInvoke(payload), onDispatched);
43481
+ const result = await this.#sendContent(encodeInlineInvoke(payload), onDispatched, signal);
41406
43482
  let application2;
41407
43483
  try {
41408
43484
  application2 = decodeInlineApplicationObject(result);
@@ -41439,9 +43515,9 @@ class InlineProtocolV3Connection {
41439
43515
  throw new InlineProtocolV3Error("protocol", "Unexpected auth.complete response");
41440
43516
  return response.body.authComplete;
41441
43517
  }
41442
- async callRpc(rpc) {
43518
+ async callRpc(rpc, signal) {
41443
43519
  const request = { body: { oneofKind: "rpc", rpc } };
41444
- const response = readOnlyRpcMethods.has(rpc.method) ? await this.#invoke(request) : await this.#invokeMutation(request);
43520
+ const response = readOnlyRpcMethods.has(rpc.method) ? await this.#invoke(request, undefined, signal) : await this.#invokeMutation(request, signal);
41445
43521
  if (response.body.oneofKind === "rpcError")
41446
43522
  throw new InlineProtocolV3Error("protocol", response.body.rpcError.message);
41447
43523
  if (response.body.oneofKind !== "rpcResult")
@@ -41544,12 +43620,12 @@ class InlineProtocolV3Connection {
41544
43620
  throw new InlineProtocolV3Error("protocol", "Unexpected upload response");
41545
43621
  return response.body.finishHttpUpload;
41546
43622
  }
41547
- async#invokeMutation(request) {
43623
+ async#invokeMutation(request, signal) {
41548
43624
  let dispatched = false;
41549
43625
  try {
41550
43626
  return await this.#invoke(request, () => {
41551
43627
  dispatched = true;
41552
- });
43628
+ }, signal);
41553
43629
  } catch (error) {
41554
43630
  if (dispatched && error instanceof InlineProtocolV3Error && ["closed", "protocol", "timeout", "unauthorized"].includes(error.code)) {
41555
43631
  throw new InlineProtocolV3Error("commit-outcome-unknown", "Mutation lost its authoritative result after Inline Protocol dispatch; the outcome is unknown", { cause: error });
@@ -41639,12 +43715,13 @@ class InlineProtocolV3Connection {
41639
43715
  return;
41640
43716
  }
41641
43717
  }
41642
- async#sendContent(body, onDispatched) {
43718
+ async#sendContent(body, onDispatched, signal) {
41643
43719
  const messageId = this.#nextClientMessageId();
41644
43720
  const sequenceNumber = this.#sequenceNumbers.next(true);
41645
- return (await this.#sendPreparedContent(messageId, sequenceNumber, body, onDispatched)).result;
43721
+ return (await this.#sendPreparedContent(messageId, sequenceNumber, body, onDispatched, signal)).result;
41646
43722
  }
41647
- async#sendPreparedContent(initialMessageId, sequenceNumber, body, onDispatched) {
43723
+ async#sendPreparedContent(initialMessageId, sequenceNumber, body, onDispatched, signal) {
43724
+ signal?.throwIfAborted();
41648
43725
  this.#admitPending(body);
41649
43726
  return await new Promise((resolve, reject) => {
41650
43727
  let pending;
@@ -41653,6 +43730,7 @@ class InlineProtocolV3Connection {
41653
43730
  return;
41654
43731
  this.#pendingContent.delete(pending.messageId);
41655
43732
  this.#releasePending(body);
43733
+ pending.removeAbortListener?.();
41656
43734
  reject(new InlineProtocolV3Error("timeout", `Inline Protocol response timed out after ${this.#options.requestTimeoutMs ?? REQUEST_TIMEOUT_MS}ms`));
41657
43735
  }, this.#options.requestTimeoutMs ?? REQUEST_TIMEOUT_MS);
41658
43736
  pending = {
@@ -41664,6 +43742,22 @@ class InlineProtocolV3Connection {
41664
43742
  timeout
41665
43743
  };
41666
43744
  this.#pendingContent.set(initialMessageId, pending);
43745
+ const onAbort = () => {
43746
+ if (this.#pendingContent.get(pending.messageId) !== pending)
43747
+ return;
43748
+ this.#pendingContent.delete(pending.messageId);
43749
+ this.#releasePending(body);
43750
+ clearTimeout(pending.timeout);
43751
+ pending.removeAbortListener?.();
43752
+ const reason = signal?.reason;
43753
+ reject(reason instanceof Error ? reason : new DOMException("The operation was aborted", "AbortError"));
43754
+ };
43755
+ signal?.addEventListener("abort", onAbort, { once: true });
43756
+ pending.removeAbortListener = () => signal?.removeEventListener("abort", onAbort);
43757
+ if (signal?.aborted)
43758
+ onAbort();
43759
+ if (this.#pendingContent.get(initialMessageId) !== pending)
43760
+ return;
41667
43761
  try {
41668
43762
  this.#sendEncrypted(initialMessageId, sequenceNumber, body, true);
41669
43763
  onDispatched?.();
@@ -41671,6 +43765,7 @@ class InlineProtocolV3Connection {
41671
43765
  this.#pendingContent.delete(initialMessageId);
41672
43766
  this.#releasePending(body);
41673
43767
  clearTimeout(pending.timeout);
43768
+ pending.removeAbortListener?.();
41674
43769
  reject(error instanceof Error ? error : new Error(String(error)));
41675
43770
  }
41676
43771
  });
@@ -41715,6 +43810,7 @@ class InlineProtocolV3Connection {
41715
43810
  this.#pendingContent.delete(result.requestMessageId);
41716
43811
  this.#releasePending(pending.body);
41717
43812
  clearTimeout(pending.timeout);
43813
+ pending.removeAbortListener?.();
41718
43814
  pending.resolve({ messageId: result.requestMessageId, result: result.result });
41719
43815
  continue;
41720
43816
  }
@@ -41763,6 +43859,8 @@ class InlineProtocolV3Connection {
41763
43859
  const rejected = pending ?? probeEntry[1];
41764
43860
  this.#releasePending(rejected.body);
41765
43861
  clearTimeout(rejected.timeout);
43862
+ if ("removeAbortListener" in rejected)
43863
+ rejected.removeAbortListener?.();
41766
43864
  rejected.reject(new InlineProtocolV3Error("protocol", `Server rejected the outgoing message (${bad.errorCode})`));
41767
43865
  return;
41768
43866
  }
@@ -41779,6 +43877,7 @@ class InlineProtocolV3Connection {
41779
43877
  this.#pendingContent.clear();
41780
43878
  for (const item of pending) {
41781
43879
  clearTimeout(item.timeout);
43880
+ item.removeAbortListener?.();
41782
43881
  item.reject(error);
41783
43882
  }
41784
43883
  const probes = [...this.#pendingProbes.values()];
@@ -42116,6 +44215,7 @@ class InlineProtocolV3Transport {
42116
44215
  throw new Error("Inline Protocol connection attempt was superseded");
42117
44216
  }
42118
44217
  let connection;
44218
+ let openingCloseError;
42119
44219
  const temporary = this.#credentials.temporary;
42120
44220
  if (temporary?.expiresAt !== undefined) {
42121
44221
  try {
@@ -42130,7 +44230,13 @@ class InlineProtocolV3Transport {
42130
44230
  this.#connectionFailed(generation, error instanceof Error ? error : new Error(String(error)));
42131
44231
  });
42132
44232
  },
42133
- onClose: (error) => this.#connectionFailed(generation, error),
44233
+ onClose: (error) => {
44234
+ if (cachedSource && this.#connection === cachedSource) {
44235
+ this.#connectionFailed(generation, error);
44236
+ } else {
44237
+ openingCloseError ??= error;
44238
+ }
44239
+ },
42134
44240
  onRotationDue: () => {
42135
44241
  setTimeout(() => {
42136
44242
  if (cachedSource)
@@ -42140,11 +44246,14 @@ class InlineProtocolV3Transport {
42140
44246
  });
42141
44247
  cachedSource = connection;
42142
44248
  await connection.probeTemporaryAuthorization();
44249
+ if (openingCloseError)
44250
+ throw openingCloseError;
42143
44251
  this.#requireCurrent(generation);
42144
44252
  if (connection.temporaryAuthorizationNeedsRotation()) {
42145
44253
  this.#log.info?.("Stored Inline Protocol temporary authorization reached its rotation boundary");
42146
44254
  await connection.close();
42147
44255
  connection = undefined;
44256
+ openingCloseError = undefined;
42148
44257
  }
42149
44258
  } catch (error) {
42150
44259
  await connection?.close();
@@ -42152,6 +44261,7 @@ class InlineProtocolV3Transport {
42152
44261
  if (!isAuthenticationInvalidated(error))
42153
44262
  throw error;
42154
44263
  this.#log.warn?.("Stored Inline Protocol temporary authorization was rejected; regenerating once", error);
44264
+ openingCloseError = undefined;
42155
44265
  }
42156
44266
  }
42157
44267
  if (!connection) {
@@ -42172,7 +44282,13 @@ class InlineProtocolV3Transport {
42172
44282
  this.#connectionFailed(generation, error instanceof Error ? error : new Error(String(error)));
42173
44283
  });
42174
44284
  },
42175
- onClose: (error) => this.#connectionFailed(generation, error),
44285
+ onClose: (error) => {
44286
+ if (replacementSource && this.#connection === replacementSource) {
44287
+ this.#connectionFailed(generation, error);
44288
+ } else {
44289
+ openingCloseError ??= error;
44290
+ }
44291
+ },
42176
44292
  onRotationDue: () => {
42177
44293
  setTimeout(() => {
42178
44294
  if (replacementSource)
@@ -42184,6 +44300,8 @@ class InlineProtocolV3Transport {
42184
44300
  try {
42185
44301
  await replacement.bindTemporary(this.#credentials.permanent);
42186
44302
  await replacement.ping();
44303
+ if (openingCloseError)
44304
+ throw openingCloseError;
42187
44305
  this.#requireCurrent(generation);
42188
44306
  connection = replacement;
42189
44307
  } catch (error) {
@@ -42195,6 +44313,8 @@ class InlineProtocolV3Transport {
42195
44313
  nextCredentials.temporary = connection.authorization;
42196
44314
  try {
42197
44315
  await this.#options.onCredentials?.(cloneCredentials(nextCredentials));
44316
+ if (openingCloseError)
44317
+ throw openingCloseError;
42198
44318
  this.#requireCurrent(generation);
42199
44319
  } catch (error) {
42200
44320
  await connection.close();
@@ -42498,6 +44618,7 @@ var defaultVideoHeight = 720;
42498
44618
  var defaultVideoDuration = 1;
42499
44619
  var defaultCatchUpPageLimit = 100;
42500
44620
  var defaultCatchUpTotalLimit = 1e4;
44621
+ var maxDatabaseUpdateSequence = 2147483647;
42501
44622
  var inboundEventCapacity = 256;
42502
44623
  var inboundEventCapacityBytes = 8 * 1024 * 1024;
42503
44624
  var closeJoinTimeoutMs = 2000;
@@ -42642,6 +44763,7 @@ class InlineSdkClient {
42642
44763
  byteLength: inboundEventByteLength
42643
44764
  });
42644
44765
  started = false;
44766
+ closed = false;
42645
44767
  openPromise = null;
42646
44768
  openResolver = null;
42647
44769
  openRejecter = null;
@@ -42705,12 +44827,16 @@ class InlineSdkClient {
42705
44827
  logger: options.logger,
42706
44828
  defaultRpcTimeoutMs: options.rpcTimeoutMs
42707
44829
  });
42708
- this.uploads = new NativeUploadClient(rpcUploadTransport((method, input) => this.invokeUncheckedRaw(method, input)));
44830
+ this.uploads = new NativeUploadClient(rpcUploadTransport((method, input, signal) => this.invokeUncheckedRaw(method, input, { signal }), (error) => error instanceof ProtocolClientError && (error.code === "commit-outcome-unknown" || error.code === "timeout")));
42709
44831
  this.startListeners();
42710
44832
  }
42711
44833
  async connect(signal) {
42712
44834
  if (this.authenticationError)
42713
44835
  throw this.authenticationError;
44836
+ if (this.logoutInProgress)
44837
+ throw new Error("logout in progress");
44838
+ if (this.closed)
44839
+ throw new Error("SDK client is closed; create a new InlineSdkClient to reconnect");
42714
44840
  if (signal?.aborted)
42715
44841
  throw new Error("aborted");
42716
44842
  if (this.started) {
@@ -42727,11 +44853,14 @@ class InlineSdkClient {
42727
44853
  openPromise.catch(() => {});
42728
44854
  const abortConnect = () => {
42729
44855
  this.rejectOpen(new Error("aborted"));
42730
- this.close();
44856
+ this.protocol.stopTransport().catch(() => {});
42731
44857
  };
42732
44858
  signal?.addEventListener("abort", abortConnect, { once: true });
42733
44859
  try {
42734
44860
  await this.loadState();
44861
+ if (this.closed || this.logoutInProgress || signal?.aborted) {
44862
+ throw new Error(this.closed ? "closed" : this.logoutInProgress ? "logout in progress" : "aborted");
44863
+ }
42735
44864
  await this.protocol.startTransport();
42736
44865
  await openPromise;
42737
44866
  } catch (error) {
@@ -42750,6 +44879,7 @@ class InlineSdkClient {
42750
44879
  async close() {
42751
44880
  if (!this.started)
42752
44881
  return;
44882
+ this.closed = true;
42753
44883
  this.started = false;
42754
44884
  this.rejectOpen(new Error("closed"));
42755
44885
  this.eventStream.close();
@@ -42771,6 +44901,7 @@ class InlineSdkClient {
42771
44901
  this.logoutInProgress = true;
42772
44902
  try {
42773
44903
  await owner.beginLogout();
44904
+ this.closed = true;
42774
44905
  let remoteOutcome = "notSent";
42775
44906
  if (this.started) {
42776
44907
  try {
@@ -42788,6 +44919,7 @@ class InlineSdkClient {
42788
44919
  }
42789
44920
  }
42790
44921
  await this.close();
44922
+ this.eventStream.close();
42791
44923
  await owner.clearCredentials();
42792
44924
  await owner.finishLogout();
42793
44925
  return { remoteOutcome };
@@ -42845,6 +44977,9 @@ class InlineSdkClient {
42845
44977
  const chat = result.getChat.chat;
42846
44978
  if (!chat)
42847
44979
  throw new Error("getChat: missing chat");
44980
+ if (chat.peerId != null && this.isReliableChatPeer(chat.peerId)) {
44981
+ this.rememberChatPeer(chat.id, chat.peerId);
44982
+ }
42848
44983
  const dialogFollowMode = result.getChat.dialog?.followMode;
42849
44984
  return {
42850
44985
  chatId: chat.id,
@@ -43157,6 +45292,8 @@ class InlineSdkClient {
43157
45292
  return result;
43158
45293
  }
43159
45294
  async callRpcWithSemanticPolicy(method, input, options) {
45295
+ if (this.closed)
45296
+ throw new Error("SDK client is closed; create a new InlineSdkClient to reconnect");
43160
45297
  if (this.logoutInProgress && method !== Method.LOG_OUT) {
43161
45298
  throw new Error("logout in progress");
43162
45299
  }
@@ -43215,6 +45352,7 @@ class InlineSdkClient {
43215
45352
  const failure = error instanceof Error ? error : new Error("listener-crashed");
43216
45353
  this.log.error?.("SDK listener crashed", failure);
43217
45354
  this.started = false;
45355
+ this.closed = true;
43218
45356
  this.rejectOpen(failure);
43219
45357
  this.eventStream.fail(failure);
43220
45358
  this.protocol.stopTransport().catch((stopError) => {
@@ -43444,6 +45582,9 @@ class InlineSdkClient {
43444
45582
  const message = update.update.newMessage.message;
43445
45583
  if (!message)
43446
45584
  return null;
45585
+ if (message.peerId != null && this.isReliableChatPeer(message.peerId)) {
45586
+ this.rememberChatPeer(message.chatId, message.peerId);
45587
+ }
43447
45588
  return deliver({
43448
45589
  kind: "message.new",
43449
45590
  chatId: message.chatId,
@@ -43456,6 +45597,9 @@ class InlineSdkClient {
43456
45597
  const message = update.update.editMessage.message;
43457
45598
  if (!message)
43458
45599
  return null;
45600
+ if (message.peerId != null && this.isReliableChatPeer(message.peerId)) {
45601
+ this.rememberChatPeer(message.chatId, message.peerId);
45602
+ }
43459
45603
  return deliver({
43460
45604
  kind: "message.edit",
43461
45605
  chatId: message.chatId,
@@ -43466,9 +45610,12 @@ class InlineSdkClient {
43466
45610
  }
43467
45611
  case "deleteMessages": {
43468
45612
  const payload = update.update.deleteMessages;
43469
- const chatId = payload.peerId?.type.oneofKind === "chat" ? payload.peerId.type.chat.chatId : null;
45613
+ const chatId = this.chatIdForPeerScopedUpdate(payload.peerId, options?.bucket);
43470
45614
  if (!chatId) {
43471
- this.log.warn?.("Skipping deleteMessages update without chat peer", payload.peerId);
45615
+ this.log.warn?.("Unable to resolve deleteMessages update to one chat bucket", {
45616
+ source: options?.source ?? "live",
45617
+ peerKind: payload.peerId?.type.oneofKind ?? "missing"
45618
+ });
43472
45619
  return null;
43473
45620
  }
43474
45621
  return deliver({
@@ -43500,8 +45647,15 @@ class InlineSdkClient {
43500
45647
  }, () => this.bumpSpaceSeq(spaceId, seq, options?.source));
43501
45648
  }
43502
45649
  const peerId = payload.target.oneofKind === "peerId" ? payload.target.peerId : undefined;
43503
- if (peerId?.type.oneofKind === "chat") {
43504
- const chatId = peerId.type.chat.chatId;
45650
+ if (peerId) {
45651
+ const chatId = this.chatIdForPeerScopedUpdate(peerId, options?.bucket);
45652
+ if (!chatId) {
45653
+ this.log.warn?.("Unable to resolve clearChatHistory update to one chat bucket", {
45654
+ source: options?.source ?? "live",
45655
+ peerKind: peerId.type.oneofKind ?? "missing"
45656
+ });
45657
+ return null;
45658
+ }
43505
45659
  return deliver({
43506
45660
  kind: "message.history.clear",
43507
45661
  chatId,
@@ -43514,19 +45668,6 @@ class InlineSdkClient {
43514
45668
  date
43515
45669
  }, () => this.bumpChatSeq(chatId, seq, options?.source));
43516
45670
  }
43517
- if (peerId?.type.oneofKind === "user") {
43518
- return deliver({
43519
- kind: "message.history.clear",
43520
- userId: peerId.type.user.userId,
43521
- ...payload.beforeDate != null ? { beforeDate: payload.beforeDate } : {},
43522
- deleteReplyThreads: payload.deleteReplyThreads,
43523
- deletedChatIds: payload.deletedChatIds,
43524
- orphanedChatIds: payload.orphanedChatIds,
43525
- detachedChatIds: payload.detachedChatIds,
43526
- seq,
43527
- date
43528
- }, () => this.bumpUserSeq(seq, options?.source));
43529
- }
43530
45671
  this.log.warn?.("Skipping clearChatHistory update without peer target", peerId);
43531
45672
  return null;
43532
45673
  }
@@ -43985,6 +46126,16 @@ class InlineSdkClient {
43985
46126
  }
43986
46127
  case "deleteChat":
43987
46128
  return this.chatBucketsForPeer(update.update.deleteChat.peerId);
46129
+ case "deleteMessages":
46130
+ return this.chatBucketsForPeer(update.update.deleteMessages.peerId);
46131
+ case "clearChatHistory": {
46132
+ const target = update.update.clearChatHistory.target;
46133
+ if (target?.oneofKind === "peerId")
46134
+ return this.chatBucketsForPeer(target.peerId);
46135
+ if (target?.oneofKind === "spaceId")
46136
+ return [{ kind: "space", spaceId: target.spaceId }];
46137
+ return [];
46138
+ }
43988
46139
  case "pinnedMessages":
43989
46140
  return this.chatBucketsForPeer(update.update.pinnedMessages.peerId);
43990
46141
  case "chatSkipPts":
@@ -44038,12 +46189,23 @@ class InlineSdkClient {
44038
46189
  matches.push({ kind: "chat", chatId, peer });
44039
46190
  } catch {}
44040
46191
  }
44041
- return matches;
46192
+ return matches.length === 1 ? matches : [];
44042
46193
  }
44043
46194
  default:
44044
46195
  return [];
44045
46196
  }
44046
46197
  }
46198
+ chatIdForPeerScopedUpdate(peer, catchUpBucket) {
46199
+ if (catchUpBucket) {
46200
+ if (catchUpBucket.kind !== "chat")
46201
+ return null;
46202
+ return catchUpBucket.chatId;
46203
+ }
46204
+ if (peer?.type.oneofKind === "chat")
46205
+ return peer.type.chat.chatId;
46206
+ const matches = this.chatBucketsForPeer(peer);
46207
+ return matches.length === 1 && matches[0]?.kind === "chat" ? matches[0].chatId : null;
46208
+ }
44047
46209
  peerFromEvent(event) {
44048
46210
  switch (event.kind) {
44049
46211
  case "message.new":
@@ -44129,6 +46291,7 @@ class InlineSdkClient {
44129
46291
  async doCatchUpUser(startSeq) {
44130
46292
  let cursor = startSeq;
44131
46293
  while (true) {
46294
+ const requestEndSeq = this.catchUpRequestEndSeq(cursor);
44132
46295
  const result = await this.invoke(Method.GET_UPDATES, {
44133
46296
  oneofKind: "getUpdates",
44134
46297
  getUpdates: GetUpdatesInput.create({
@@ -44139,6 +46302,7 @@ class InlineSdkClient {
44139
46302
  }
44140
46303
  }),
44141
46304
  startSeq: BigInt(cursor),
46305
+ ...requestEndSeq != null ? { seqEnd: BigInt(requestEndSeq) } : {},
44142
46306
  totalLimit: defaultCatchUpTotalLimit,
44143
46307
  limit: defaultCatchUpPageLimit
44144
46308
  })
@@ -44151,15 +46315,26 @@ class InlineSdkClient {
44151
46315
  return;
44152
46316
  }
44153
46317
  if (payload.resultType === GetUpdatesResult_ResultType.TOO_LONG) {
44154
- await this.repairUpdateBucketAuthoritatively({ kind: "user" }, deliveredSeq, payload.date);
46318
+ const shouldContinue = this.shouldContinueBoundedCatchUp(cursor, deliveredSeq, requestEndSeq);
46319
+ const repaired = await this.repairUpdateBucketAuthoritatively({ kind: "user" }, deliveredSeq, payload.date, !shouldContinue);
46320
+ if (repaired && shouldContinue) {
46321
+ cursor = deliveredSeq;
46322
+ continue;
46323
+ }
44155
46324
  return;
44156
46325
  }
44157
46326
  const requiresSnapshotRepair = this.validateCatchUpPage(payload, cursor, { kind: "user" });
44158
46327
  if (requiresSnapshotRepair == null)
44159
46328
  return;
44160
46329
  if (requiresSnapshotRepair) {
44161
- await this.repairUpdateBucketAuthoritatively({ kind: "user" }, deliveredSeq, payload.date);
44162
- return;
46330
+ if (this.options.repairUpdatesBucket) {
46331
+ await this.repairUpdateBucketAuthoritatively({ kind: "user" }, deliveredSeq, payload.date);
46332
+ return;
46333
+ }
46334
+ this.log.warn?.("GET_UPDATES advanced past a snapshot-repair marker without a host snapshot owner", {
46335
+ bucket: "user",
46336
+ deliveredSeq
46337
+ });
44163
46338
  }
44164
46339
  if (deliveredSeq <= cursor && !payload.final) {
44165
46340
  this.markUpdateBucketDegraded({ kind: "user" });
@@ -44174,6 +46349,10 @@ class InlineSdkClient {
44174
46349
  this.bumpUserSeq(deliveredSeq);
44175
46350
  this.scheduleStateSave();
44176
46351
  if (payload.final) {
46352
+ if (this.shouldContinueBoundedCatchUp(cursor, deliveredSeq, requestEndSeq)) {
46353
+ cursor = deliveredSeq;
46354
+ continue;
46355
+ }
44177
46356
  this.satisfyDiscoveryBucket({ kind: "user" }, deliveredSeq);
44178
46357
  this.clearUpdateBucketDegraded({ kind: "user" });
44179
46358
  return;
@@ -44239,8 +46418,8 @@ class InlineSdkClient {
44239
46418
  }
44240
46419
  async doCatchUpChat(chatId, peer, startSeq, endSeq) {
44241
46420
  let cursor = startSeq;
44242
- let requestEndSeq = endSeq;
44243
- while (requestEndSeq == null || cursor < requestEndSeq) {
46421
+ while (endSeq == null || cursor < endSeq) {
46422
+ const requestEndSeq = this.catchUpRequestEndSeq(cursor, endSeq);
44244
46423
  const result = await this.invoke(Method.GET_UPDATES, {
44245
46424
  oneofKind: "getUpdates",
44246
46425
  getUpdates: GetUpdatesInput.create({
@@ -44261,7 +46440,21 @@ class InlineSdkClient {
44261
46440
  const payload = result.getUpdates;
44262
46441
  if (payload.resultType === GetUpdatesResult_ResultType.TOO_LONG) {
44263
46442
  const deliveredSeq2 = Number(payload.seq ?? 0n);
44264
- await this.repairUpdateBucketAuthoritatively({ kind: "chat", chatId, peer }, deliveredSeq2, payload.date);
46443
+ if (endSeq != null && requestEndSeq != null && deliveredSeq2 !== requestEndSeq) {
46444
+ this.markUpdateBucketDegraded({ kind: "chat", chatId, peer });
46445
+ this.log.warn?.("GET_UPDATES TOO_LONG pointer did not cover the requested chat target", {
46446
+ chatId: chatId.toString(),
46447
+ requestedEndSeq: requestEndSeq,
46448
+ deliveredSeq: deliveredSeq2
46449
+ });
46450
+ return true;
46451
+ }
46452
+ const shouldContinue = this.shouldContinueBoundedCatchUp(cursor, deliveredSeq2, requestEndSeq, endSeq);
46453
+ const repaired = await this.repairUpdateBucketAuthoritatively({ kind: "chat", chatId, peer }, deliveredSeq2, payload.date, !shouldContinue);
46454
+ if (repaired && shouldContinue) {
46455
+ cursor = deliveredSeq2;
46456
+ continue;
46457
+ }
44265
46458
  return true;
44266
46459
  }
44267
46460
  const deliveredSeq = Number(payload.seq ?? 0n);
@@ -44274,8 +46467,14 @@ class InlineSdkClient {
44274
46467
  if (requiresSnapshotRepair == null)
44275
46468
  return true;
44276
46469
  if (requiresSnapshotRepair) {
44277
- await this.repairUpdateBucketAuthoritatively({ kind: "chat", chatId, peer }, deliveredSeq, payload.date);
44278
- return true;
46470
+ if (this.options.repairUpdatesBucket) {
46471
+ await this.repairUpdateBucketAuthoritatively({ kind: "chat", chatId, peer }, deliveredSeq, payload.date);
46472
+ return true;
46473
+ }
46474
+ this.log.warn?.("GET_UPDATES advanced past a snapshot-repair marker without a host snapshot owner", {
46475
+ bucket: this.updateBucketKey({ kind: "chat", chatId }),
46476
+ deliveredSeq
46477
+ });
44279
46478
  }
44280
46479
  if (deliveredSeq <= cursor && !payload.final) {
44281
46480
  this.markUpdateBucketDegraded({ kind: "chat", chatId, peer });
@@ -44291,6 +46490,19 @@ class InlineSdkClient {
44291
46490
  this.bumpChatSeq(chatId, deliveredSeq);
44292
46491
  this.scheduleStateSave();
44293
46492
  if (payload.final) {
46493
+ if (this.shouldContinueBoundedCatchUp(cursor, deliveredSeq, requestEndSeq, endSeq)) {
46494
+ cursor = deliveredSeq;
46495
+ continue;
46496
+ }
46497
+ if (endSeq != null && deliveredSeq < endSeq) {
46498
+ this.markUpdateBucketDegraded({ kind: "chat", chatId, peer });
46499
+ this.log.warn?.("GET_UPDATES final chat page remained behind the requested target", {
46500
+ chatId: chatId.toString(),
46501
+ requestedEndSeq: endSeq,
46502
+ deliveredSeq
46503
+ });
46504
+ return true;
46505
+ }
44294
46506
  this.satisfyDiscoveryBucket({ kind: "chat", chatId, peer }, deliveredSeq);
44295
46507
  this.clearUpdateBucketDegraded({ kind: "chat", chatId, peer });
44296
46508
  return true;
@@ -44354,8 +46566,8 @@ class InlineSdkClient {
44354
46566
  }
44355
46567
  async doCatchUpSpace(spaceId, startSeq, endSeq) {
44356
46568
  let cursor = startSeq;
44357
- let requestEndSeq = endSeq;
44358
- while (requestEndSeq == null || cursor < requestEndSeq) {
46569
+ while (endSeq == null || cursor < endSeq) {
46570
+ const requestEndSeq = this.catchUpRequestEndSeq(cursor, endSeq);
44359
46571
  const result = await this.invoke(Method.GET_UPDATES, {
44360
46572
  oneofKind: "getUpdates",
44361
46573
  getUpdates: GetUpdatesInput.create({
@@ -44376,7 +46588,21 @@ class InlineSdkClient {
44376
46588
  const payload = result.getUpdates;
44377
46589
  if (payload.resultType === GetUpdatesResult_ResultType.TOO_LONG) {
44378
46590
  const deliveredSeq2 = Number(payload.seq ?? 0n);
44379
- await this.repairUpdateBucketAuthoritatively({ kind: "space", spaceId }, deliveredSeq2, payload.date);
46591
+ if (endSeq != null && requestEndSeq != null && deliveredSeq2 !== requestEndSeq) {
46592
+ this.markUpdateBucketDegraded({ kind: "space", spaceId });
46593
+ this.log.warn?.("GET_UPDATES TOO_LONG pointer did not cover the requested space target", {
46594
+ spaceId: spaceId.toString(),
46595
+ requestedEndSeq: requestEndSeq,
46596
+ deliveredSeq: deliveredSeq2
46597
+ });
46598
+ return true;
46599
+ }
46600
+ const shouldContinue = this.shouldContinueBoundedCatchUp(cursor, deliveredSeq2, requestEndSeq, endSeq);
46601
+ const repaired = await this.repairUpdateBucketAuthoritatively({ kind: "space", spaceId }, deliveredSeq2, payload.date, !shouldContinue);
46602
+ if (repaired && shouldContinue) {
46603
+ cursor = deliveredSeq2;
46604
+ continue;
46605
+ }
44380
46606
  return true;
44381
46607
  }
44382
46608
  const deliveredSeq = Number(payload.seq ?? 0n);
@@ -44391,8 +46617,14 @@ class InlineSdkClient {
44391
46617
  if (requiresSnapshotRepair == null)
44392
46618
  return true;
44393
46619
  if (requiresSnapshotRepair) {
44394
- await this.repairUpdateBucketAuthoritatively({ kind: "space", spaceId }, deliveredSeq, payload.date);
44395
- return true;
46620
+ if (this.options.repairUpdatesBucket) {
46621
+ await this.repairUpdateBucketAuthoritatively({ kind: "space", spaceId }, deliveredSeq, payload.date);
46622
+ return true;
46623
+ }
46624
+ this.log.warn?.("GET_UPDATES advanced past a snapshot-repair marker without a host snapshot owner", {
46625
+ bucket: this.updateBucketKey({ kind: "space", spaceId }),
46626
+ deliveredSeq
46627
+ });
44396
46628
  }
44397
46629
  if (deliveredSeq <= cursor && !payload.final) {
44398
46630
  this.markUpdateBucketDegraded({ kind: "space", spaceId });
@@ -44408,6 +46640,19 @@ class InlineSdkClient {
44408
46640
  this.bumpSpaceSeq(spaceId, deliveredSeq);
44409
46641
  this.scheduleStateSave();
44410
46642
  if (payload.final) {
46643
+ if (this.shouldContinueBoundedCatchUp(cursor, deliveredSeq, requestEndSeq, endSeq)) {
46644
+ cursor = deliveredSeq;
46645
+ continue;
46646
+ }
46647
+ if (endSeq != null && deliveredSeq < endSeq) {
46648
+ this.markUpdateBucketDegraded({ kind: "space", spaceId });
46649
+ this.log.warn?.("GET_UPDATES final space page remained behind the requested target", {
46650
+ spaceId: spaceId.toString(),
46651
+ requestedEndSeq: endSeq,
46652
+ deliveredSeq
46653
+ });
46654
+ return true;
46655
+ }
44411
46656
  this.satisfyDiscoveryBucket({ kind: "space", spaceId }, deliveredSeq);
44412
46657
  this.clearUpdateBucketDegraded({ kind: "space", spaceId });
44413
46658
  return true;
@@ -44568,19 +46813,54 @@ class InlineSdkClient {
44568
46813
  }
44569
46814
  return requiresSnapshotRepair;
44570
46815
  }
44571
- async repairUpdateBucketAuthoritatively(bucket, serverSeq, serverDate) {
46816
+ catchUpRequestEndSeq(cursor, requestedEndSeq) {
46817
+ if (this.options.repairUpdatesBucket)
46818
+ return requestedEndSeq;
46819
+ return Math.min(requestedEndSeq ?? maxDatabaseUpdateSequence, cursor + defaultCatchUpTotalLimit);
46820
+ }
46821
+ shouldContinueBoundedCatchUp(previousCursor, deliveredSeq, requestEndSeq, requestedEndSeq) {
46822
+ if (this.options.repairUpdatesBucket || requestEndSeq == null)
46823
+ return false;
46824
+ if (deliveredSeq <= previousCursor || deliveredSeq !== requestEndSeq)
46825
+ return false;
46826
+ return requestedEndSeq == null ? requestEndSeq < maxDatabaseUpdateSequence : deliveredSeq < requestedEndSeq;
46827
+ }
46828
+ async repairUpdateBucketAuthoritatively(bucket, serverSeq, serverDate, finalize = true) {
44572
46829
  if (!Number.isSafeInteger(serverSeq) || serverSeq < 0) {
44573
46830
  this.markUpdateBucketDegraded(bucket);
44574
46831
  return false;
44575
46832
  }
44576
46833
  const repair = this.options.repairUpdatesBucket;
44577
46834
  if (!repair) {
44578
- this.markUpdateBucketDegraded(bucket);
44579
- this.log.warn?.("GET_UPDATES requires authoritative bucket repair; bucket remains degraded", {
46835
+ if (serverSeq <= this.bucketCursor(bucket)) {
46836
+ this.markUpdateBucketDegraded(bucket);
46837
+ this.log.warn?.("GET_UPDATES repair did not advance its bucket; bucket remains degraded", {
46838
+ bucket: this.updateBucketKey(bucket),
46839
+ serverSeq
46840
+ });
46841
+ return false;
46842
+ }
46843
+ switch (bucket.kind) {
46844
+ case "user":
46845
+ this.bumpUserSeq(serverSeq);
46846
+ break;
46847
+ case "chat":
46848
+ this.bumpChatSeq(bucket.chatId, serverSeq);
46849
+ break;
46850
+ case "space":
46851
+ this.bumpSpaceSeq(bucket.spaceId, serverSeq);
46852
+ break;
46853
+ }
46854
+ this.scheduleStateSave();
46855
+ if (finalize) {
46856
+ this.satisfyDiscoveryBucket(bucket, serverSeq);
46857
+ this.clearUpdateBucketDegraded(bucket);
46858
+ }
46859
+ this.log.warn?.("GET_UPDATES could not replay a bounded range; advanced to its server-authoritative cursor", {
44580
46860
  bucket: this.updateBucketKey(bucket),
44581
46861
  serverSeq
44582
46862
  });
44583
- return false;
46863
+ return true;
44584
46864
  }
44585
46865
  try {
44586
46866
  const request = { bucket, serverSeq, serverDate };
@@ -44620,9 +46900,17 @@ class InlineSdkClient {
44620
46900
  if (update.update.oneofKind === undefined) {
44621
46901
  continue;
44622
46902
  }
44623
- const accepted = await this.handleUpdate(update, { source });
46903
+ const accepted = await this.handleUpdate(update, { source, bucket });
44624
46904
  if (accepted === true)
44625
46905
  continue;
46906
+ if (accepted === false) {
46907
+ this.markUpdateBucketDegraded(bucket);
46908
+ this.log.warn?.("GET_UPDATES event was not acknowledged by the SDK host; cursor remains unchanged", {
46909
+ bucket: this.updateBucketKey(bucket),
46910
+ updateKind: update.update.oneofKind
46911
+ });
46912
+ return false;
46913
+ }
44626
46914
  if (!this.isProjectedUpdateKind(update)) {
44627
46915
  this.log.debug?.("GET_UPDATES advanced past an update this SDK does not project", {
44628
46916
  bucket: this.updateBucketKey(bucket),
@@ -44630,12 +46918,10 @@ class InlineSdkClient {
44630
46918
  });
44631
46919
  continue;
44632
46920
  }
44633
- this.markUpdateBucketDegraded(bucket);
44634
- this.log.warn?.("GET_UPDATES returned an update the SDK could not durably accept; cursor remains unchanged", {
46921
+ this.log.warn?.("GET_UPDATES authoritatively advanced past an update the SDK could not project", {
44635
46922
  bucket: this.updateBucketKey(bucket),
44636
46923
  updateKind: update.update.oneofKind
44637
46924
  });
44638
- return false;
44639
46925
  }
44640
46926
  return true;
44641
46927
  }
@@ -59631,6 +61917,13 @@ function resolveControlCommandGate(params) {
59631
61917
  shouldBlock: params.allowTextCommands && params.hasControlCommand && !commandAuthorized
59632
61918
  };
59633
61919
  }
61920
+ function resolveUseAccessGroups(cfg) {
61921
+ const commands = cfg.commands;
61922
+ if (!commands || typeof commands !== "object" || Array.isArray(commands)) {
61923
+ return true;
61924
+ }
61925
+ return commands.useAccessGroups !== false;
61926
+ }
59634
61927
  function resolveMentionGatingWithBypass(params) {
59635
61928
  const shouldBypassMention = params.isGroup && params.requireMention && !params.wasMentioned && !(params.hasAnyMention ?? false) && params.allowTextCommands && params.commandAuthorized && params.hasControlCommand;
59636
61929
  const effectiveWasMentioned = params.wasMentioned || params.implicitMention === true || shouldBypassMention;
@@ -60585,17 +62878,17 @@ function parseInlineTarget(raw, label) {
60585
62878
  function parseCurrentInlineSession(ctx) {
60586
62879
  if ((ctx.messageChannel ?? "").trim().toLowerCase() !== "inline")
60587
62880
  return null;
60588
- const sessionKey = ctx.sessionKey?.trim();
62881
+ const sessionKey = ctx.sessionKey?.trim().replace(/:inline-agent:[^:]+$/i, "");
60589
62882
  if (!sessionKey)
60590
62883
  return null;
60591
62884
  const explicitMatch = sessionKey.match(/^agent:[^:]+:inline:(chat|group|user|direct):([0-9]+)(?::thread:([0-9]+))?$/i);
60592
62885
  if (explicitMatch?.[1] && explicitMatch[2]) {
60593
62886
  const kind = explicitMatch[1].toLowerCase();
60594
62887
  const threadId = explicitMatch[3];
60595
- if ((kind === "chat" || kind === "group") && threadId) {
62888
+ if (threadId) {
60596
62889
  return {
60597
62890
  target: parseInlineTarget(threadId, "current chat"),
60598
- parentChatId: parseInlineId(explicitMatch[2], "current parent chat"),
62891
+ parentChatId: kind === "chat" || kind === "group" ? parseInlineId(explicitMatch[2], "current parent chat") : null,
60599
62892
  threadId: parseInlineId(threadId, "current thread")
60600
62893
  };
60601
62894
  }
@@ -61300,7 +63593,8 @@ async function loadChatSpaceId(params) {
61300
63593
  const result = await params.client.invokeRaw(GET_CHAT_METHOD, {
61301
63594
  oneofKind: "getChat",
61302
63595
  getChat: {
61303
- peerId: buildChatPeer(params.chatId)
63596
+ peerId: buildChatPeer(params.chatId),
63597
+ includeRecentMessages: false
61304
63598
  }
61305
63599
  });
61306
63600
  if (result.oneofKind !== "getChat") {
@@ -61839,6 +64133,20 @@ var GET_CHAT_METHOD2 = typeof Method.GET_CHAT === "number" && Number.isInteger(M
61839
64133
  var GET_CHAT_HISTORY_METHOD = typeof Method.GET_CHAT_HISTORY === "number" && Number.isInteger(Method.GET_CHAT_HISTORY) && Method.GET_CHAT_HISTORY > 0 ? Method.GET_CHAT_HISTORY : 5;
61840
64134
  var GET_MESSAGES_METHOD = typeof Method.GET_MESSAGES === "number" && Number.isInteger(Method.GET_MESSAGES) && Method.GET_MESSAGES > 0 ? Method.GET_MESSAGES : 38;
61841
64135
  var CREATE_SUBTHREAD_METHOD = typeof Method.CREATE_SUBTHREAD === "number" && Number.isInteger(Method.CREATE_SUBTHREAD) && Method.CREATE_SUBTHREAD > 0 ? Method.CREATE_SUBTHREAD : 42;
64136
+ function inlineErrorChainHasCode(error51, code) {
64137
+ const visited = new Set;
64138
+ let current = error51;
64139
+ while (current && typeof current === "object" && !visited.has(current)) {
64140
+ visited.add(current);
64141
+ if (current.code === code)
64142
+ return true;
64143
+ current = current.cause;
64144
+ }
64145
+ return false;
64146
+ }
64147
+ function isRetryableInlineCreateOutcomeUnknown(error51) {
64148
+ return inlineErrorChainHasCode(error51, "commit-outcome-unknown") || inlineErrorChainHasCode(error51, "timeout");
64149
+ }
61842
64150
  function buildChatPeer2(chatId) {
61843
64151
  return {
61844
64152
  type: {
@@ -61862,19 +64170,22 @@ function resolveInlineReplyThreadChatId(params) {
61862
64170
  if (params.threadId == null) {
61863
64171
  return params.parentChatId;
61864
64172
  }
61865
- const normalized = typeof params.threadId === "number" ? Number.isFinite(params.threadId) && Number.isInteger(params.threadId) && params.threadId >= 0 ? BigInt(params.threadId) : null : typeof params.threadId === "string" ? params.threadId.trim() ? (() => {
64173
+ const normalized = typeof params.threadId === "number" ? Number.isSafeInteger(params.threadId) && params.threadId > 0 ? BigInt(params.threadId) : null : typeof params.threadId === "string" ? /^[0-9]+$/.test(params.threadId.trim()) ? (() => {
61866
64174
  try {
61867
64175
  return BigInt(params.threadId.trim());
61868
64176
  } catch {
61869
64177
  return null;
61870
64178
  }
61871
64179
  })() : null : null;
61872
- return normalized ?? params.parentChatId;
64180
+ if (normalized == null || normalized <= 0n) {
64181
+ throw new Error("inline: invalid reply-thread chat id");
64182
+ }
64183
+ return normalized;
61873
64184
  }
61874
64185
  async function loadInlineReplyThreadMetadata(params) {
61875
64186
  const result = await params.client.invokeRaw(GET_CHAT_METHOD2, {
61876
64187
  oneofKind: "getChat",
61877
- getChat: { peerId: buildChatPeer2(params.chatId) }
64188
+ getChat: { peerId: buildChatPeer2(params.chatId), includeRecentMessages: false }
61878
64189
  }).catch(() => null);
61879
64190
  if (result?.oneofKind !== "getChat") {
61880
64191
  return null;
@@ -61919,14 +64230,23 @@ async function loadInlineReplyThreadAnchorMessage(params) {
61919
64230
  return (historyResult.getChatHistory.messages ?? []).find((item) => item.id === params.parentMessageId) ?? null;
61920
64231
  }
61921
64232
  async function createInlineReplyThreadForMessage(params) {
61922
- const result = await params.client.invokeRaw(CREATE_SUBTHREAD_METHOD, {
64233
+ const input = {
61923
64234
  oneofKind: "createSubthread",
61924
64235
  createSubthread: {
61925
64236
  parentChatId: params.parentChatId,
61926
64237
  parentMessageId: params.parentMessageId,
61927
64238
  participants: []
61928
64239
  }
61929
- });
64240
+ };
64241
+ const invokeCreate = () => params.client.invokeRaw(CREATE_SUBTHREAD_METHOD, input);
64242
+ let result;
64243
+ try {
64244
+ result = await invokeCreate();
64245
+ } catch (error51) {
64246
+ if (!isRetryableInlineCreateOutcomeUnknown(error51))
64247
+ throw error51;
64248
+ result = await invokeCreate();
64249
+ }
61930
64250
  if (result.oneofKind !== "createSubthread") {
61931
64251
  return null;
61932
64252
  }
@@ -62263,7 +64583,8 @@ function createInlineParentContextTool(ctx) {
62263
64583
  const args = rawArgs;
62264
64584
  const currentSession = parseCurrentInlineSession(ctx);
62265
64585
  const explicitThreadId = readStringCandidate(args.threadId);
62266
- const threadId = explicitThreadId != null ? parseInlineId(explicitThreadId, "threadId") : currentSession?.threadId ?? null;
64586
+ const ambientThreadId = ctx.messageChannel?.trim().toLowerCase() === "inline" ? parseOptionalInlineId(ctx.deliveryContext?.threadId, "current thread") : null;
64587
+ const threadId = explicitThreadId != null ? parseInlineId(explicitThreadId, "threadId") : currentSession?.threadId ?? ambientThreadId;
62267
64588
  let parentChatId = parseOptionalChatId(readIdCandidate(args.parentChatId, args.chatId), "parentChatId") ?? currentSession?.parentChatId ?? null;
62268
64589
  let parentMessageId = parseOptionalInlineId(readIdCandidate(args.parentMessageId, args.anchorMessageId), "parentMessageId");
62269
64590
  const beforeMessageId = parseOptionalInlineId(readIdCandidate(args.beforeMessageId), "beforeMessageId");
@@ -62288,6 +64609,16 @@ function createInlineParentContextTool(ctx) {
62288
64609
  if (parentChatId == null) {
62289
64610
  throw new Error("inline_parent_context: parentChatId is required outside an Inline reply-thread session");
62290
64611
  }
64612
+ if (ctx.messageChannel?.trim().toLowerCase() === "inline") {
64613
+ const parent = await client.getChat({ chatId: parentChatId });
64614
+ const peer = parent.peer?.type;
64615
+ if (peer?.oneofKind !== "user" && peer?.oneofKind !== "chat") {
64616
+ throw new Error("inline_parent_context: parent chat identity is unavailable");
64617
+ }
64618
+ if (peer.oneofKind === "user" && ctx.requesterSenderId !== String(peer.user.userId)) {
64619
+ throw new Error("inline_parent_context: parent DM history is unavailable to this participant");
64620
+ }
64621
+ }
62291
64622
  const history = resolveParentContextHistoryRequest({
62292
64623
  parentMessageId,
62293
64624
  beforeMessageId,
@@ -62321,7 +64652,7 @@ function createInlineParentContextTool(ctx) {
62321
64652
  afterLimit: history.afterLimit,
62322
64653
  limit,
62323
64654
  includeAnchor,
62324
- usedCurrentThreadDefault: explicitThreadId == null && currentSession?.threadId != null,
64655
+ usedCurrentThreadDefault: explicitThreadId == null && threadId != null,
62325
64656
  nextBeforeMessageId: oldest?.id ?? null,
62326
64657
  nextAfterMessageId: newest?.id ?? null,
62327
64658
  messages
@@ -63584,6 +65915,10 @@ var MODE_LABELS = {
63584
65915
  main: "main"
63585
65916
  };
63586
65917
  var INLINE_THREADREPLY_NATIVE_NAME = "threadreply";
65918
+ var INLINE_LIVE_CONFIG_WRITE_AFTER_WRITE = {
65919
+ mode: "none",
65920
+ reason: "Inline reads the refreshed runtime config in-process."
65921
+ };
63587
65922
  var INLINE_THREADREPLY_COMMAND_SPEC = {
63588
65923
  name: "threadreply",
63589
65924
  nativeNames: { inline: INLINE_THREADREPLY_NATIVE_NAME },
@@ -63788,7 +66123,7 @@ async function handleInlineThreadReplyCommandWithConfigRuntime(configRuntime, ct
63788
66123
  };
63789
66124
  }
63790
66125
  const committed = await configRuntime.mutateConfigFile({
63791
- afterWrite: { mode: "auto" },
66126
+ afterWrite: INLINE_LIVE_CONFIG_WRITE_AFTER_WRITE,
63792
66127
  mutate: (draft) => {
63793
66128
  setGroupMode({
63794
66129
  draft,
@@ -64159,6 +66494,88 @@ async function syncInlineNativeCommands(params) {
64159
66494
  };
64160
66495
  }
64161
66496
 
66497
+ // src/inline/bot-skills-sync.ts
66498
+ import { resolveAgentRoute as resolveAgentRoute2 } from "openclaw/plugin-sdk/routing";
66499
+ import { listSkillCommandsForAgents as listSkillCommandsForAgents2 } from "openclaw/plugin-sdk/skill-commands-runtime";
66500
+ var INLINE_SKILL_LIMIT = 250;
66501
+ var INLINE_SKILL_NAME_LIMIT = 256;
66502
+ var INLINE_SKILL_DESCRIPTION_LIMIT = 4000;
66503
+ function truncateUtf16(value, maxLength) {
66504
+ if (value.length <= maxLength)
66505
+ return value;
66506
+ const truncated = value.slice(0, maxLength);
66507
+ const lastCodeUnit = truncated.charCodeAt(truncated.length - 1);
66508
+ return lastCodeUnit >= 55296 && lastCodeUnit <= 56319 ? truncated.slice(0, -1) : truncated;
66509
+ }
66510
+ function buildInlinePublishedSkills(params) {
66511
+ const route = resolveAgentRoute2({
66512
+ cfg: params.cfg,
66513
+ channel: "inline",
66514
+ accountId: params.accountId
66515
+ });
66516
+ const commands = listSkillCommandsForAgents2({
66517
+ cfg: params.cfg,
66518
+ agentIds: [route.agentId]
66519
+ });
66520
+ const seen = new Set;
66521
+ const skills = [];
66522
+ for (const command of commands) {
66523
+ if (skills.length >= INLINE_SKILL_LIMIT)
66524
+ break;
66525
+ const key = command.skillName.trim();
66526
+ if (!key || key.length > INLINE_SKILL_NAME_LIMIT || seen.has(key))
66527
+ continue;
66528
+ const displayName = command.displayName?.trim() || key;
66529
+ const name = truncateUtf16(displayName, INLINE_SKILL_NAME_LIMIT).trimEnd();
66530
+ if (!name)
66531
+ continue;
66532
+ const description = truncateUtf16(adaptInlineVisibleCopy(command.description).trim(), INLINE_SKILL_DESCRIPTION_LIMIT).trimEnd();
66533
+ seen.add(key);
66534
+ skills.push({
66535
+ key,
66536
+ name,
66537
+ ...description ? { description } : {},
66538
+ sort_order: skills.length
66539
+ });
66540
+ }
66541
+ return skills;
66542
+ }
66543
+ async function syncInlineAgentSkills(params) {
66544
+ const accountIds = listInlineAccountIds(params.cfg);
66545
+ let attempted = 0;
66546
+ let synced = 0;
66547
+ let failed = 0;
66548
+ for (const accountId of accountIds) {
66549
+ const account = resolveInlineAccount({ cfg: params.cfg, accountId });
66550
+ attempted += 1;
66551
+ if (!account.enabled || !account.configured || !account.baseUrl)
66552
+ continue;
66553
+ const ownerAccountId = findInlineTokenOwnerAccountId({ cfg: params.cfg, accountId });
66554
+ if (ownerAccountId) {
66555
+ failed += 1;
66556
+ params.logger?.warn?.(`[inline] bot skill sync skipped for account "${account.accountId}": ${formatDuplicateInlineTokenReason({ accountId: account.accountId, ownerAccountId })}`);
66557
+ continue;
66558
+ }
66559
+ try {
66560
+ const token = await resolveInlineToken(account);
66561
+ const skills = buildInlinePublishedSkills({ cfg: params.cfg, accountId: account.accountId });
66562
+ await callInlineBotApi({
66563
+ baseUrl: account.baseUrl,
66564
+ token,
66565
+ methodName: "setMySkills",
66566
+ method: "POST",
66567
+ body: { skills }
66568
+ });
66569
+ synced += 1;
66570
+ params.logger?.info?.(`[inline] bot skills synced for account "${account.accountId}" (${skills.length} skill${skills.length === 1 ? "" : "s"})`);
66571
+ } catch (error51) {
66572
+ failed += 1;
66573
+ params.logger?.warn?.(`[inline] bot skill sync failed for account "${account.accountId}": ${String(error51)}`);
66574
+ }
66575
+ }
66576
+ return { attempted, synced, failed };
66577
+ }
66578
+
64162
66579
  // src/runtime-register-api.ts
64163
66580
  function registerInlinePluginFull(api2) {
64164
66581
  api2.registerTool((ctx) => createInlineMembersTool(ctx), {
@@ -64211,11 +66628,15 @@ function registerInlinePluginFull(api2) {
64211
66628
  cfg: api2.config,
64212
66629
  logger: api2.logger
64213
66630
  });
66631
+ await syncInlineAgentSkills({
66632
+ cfg: api2.config,
66633
+ logger: api2.logger
66634
+ });
64214
66635
  });
64215
66636
  }
64216
66637
  export {
64217
66638
  registerInlinePluginFull
64218
66639
  };
64219
66640
 
64220
- //# debugId=1AAD126E4E7F191A64756E2164756E21
66641
+ //# debugId=F0E67BA4540686A364756E2164756E21
64221
66642
  //# sourceMappingURL=runtime-register-api.js.map