@inline-openclaw/inline 0.0.66 → 0.0.68

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.
@@ -5834,6 +5834,20 @@ var UploadFailure_Code;
5834
5834
  UploadFailure_Code2[UploadFailure_Code2["UPLOAD_FAILURE_PROCESSING"] = 3] = "UPLOAD_FAILURE_PROCESSING";
5835
5835
  UploadFailure_Code2[UploadFailure_Code2["UPLOAD_FAILURE_STORAGE"] = 4] = "UPLOAD_FAILURE_STORAGE";
5836
5836
  })(UploadFailure_Code || (UploadFailure_Code = {}));
5837
+ var RequestBotFilesystemInput_Operation;
5838
+ (function(RequestBotFilesystemInput_Operation2) {
5839
+ RequestBotFilesystemInput_Operation2[RequestBotFilesystemInput_Operation2["OPERATION_UNSPECIFIED"] = 0] = "OPERATION_UNSPECIFIED";
5840
+ RequestBotFilesystemInput_Operation2[RequestBotFilesystemInput_Operation2["LIST"] = 1] = "LIST";
5841
+ RequestBotFilesystemInput_Operation2[RequestBotFilesystemInput_Operation2["REGISTER_FOLDER"] = 2] = "REGISTER_FOLDER";
5842
+ })(RequestBotFilesystemInput_Operation || (RequestBotFilesystemInput_Operation = {}));
5843
+ var BotFilesystemEntry_Kind;
5844
+ (function(BotFilesystemEntry_Kind2) {
5845
+ BotFilesystemEntry_Kind2[BotFilesystemEntry_Kind2["KIND_UNSPECIFIED"] = 0] = "KIND_UNSPECIFIED";
5846
+ BotFilesystemEntry_Kind2[BotFilesystemEntry_Kind2["FILE"] = 1] = "FILE";
5847
+ BotFilesystemEntry_Kind2[BotFilesystemEntry_Kind2["DIRECTORY"] = 2] = "DIRECTORY";
5848
+ BotFilesystemEntry_Kind2[BotFilesystemEntry_Kind2["SYMLINK"] = 3] = "SYMLINK";
5849
+ BotFilesystemEntry_Kind2[BotFilesystemEntry_Kind2["OTHER"] = 4] = "OTHER";
5850
+ })(BotFilesystemEntry_Kind || (BotFilesystemEntry_Kind = {}));
5837
5851
  var DialogFollowMode;
5838
5852
  (function(DialogFollowMode2) {
5839
5853
  DialogFollowMode2[DialogFollowMode2["DIALOG_FOLLOW_MODE_UNSPECIFIED"] = 0] = "DIALOG_FOLLOW_MODE_UNSPECIFIED";
@@ -6032,6 +6046,10 @@ var Method;
6032
6046
  Method2[Method2["GET_USERS"] = 138] = "GET_USERS";
6033
6047
  Method2[Method2["GET_BOT_SKILLS"] = 139] = "GET_BOT_SKILLS";
6034
6048
  Method2[Method2["GET_BOT_CONFIGURATION_CATALOG"] = 140] = "GET_BOT_CONFIGURATION_CATALOG";
6049
+ Method2[Method2["UPDATE_DIALOG_TRANSLATION"] = 141] = "UPDATE_DIALOG_TRANSLATION";
6050
+ Method2[Method2["TRANSCRIBE_VOICE_DRAFT"] = 142] = "TRANSCRIBE_VOICE_DRAFT";
6051
+ Method2[Method2["REQUEST_BOT_FILESYSTEM"] = 143] = "REQUEST_BOT_FILESYSTEM";
6052
+ Method2[Method2["ANSWER_BOT_FILESYSTEM"] = 144] = "ANSWER_BOT_FILESYSTEM";
6035
6053
  })(Method || (Method = {}));
6036
6054
  var GridConnectionUnavailableReason;
6037
6055
  (function(GridConnectionUnavailableReason2) {
@@ -6500,7 +6518,8 @@ class BotEvent$Type extends import_runtime4.MessageType {
6500
6518
  constructor() {
6501
6519
  super("BotEvent", [
6502
6520
  { no: 1, name: "chat_settings_requested", kind: "message", oneof: "event", T: () => BotChatSettingsRequested },
6503
- { no: 2, name: "chat_settings_item_invoked", kind: "message", oneof: "event", T: () => BotChatSettingsItemInvoked }
6521
+ { no: 2, name: "chat_settings_item_invoked", kind: "message", oneof: "event", T: () => BotChatSettingsItemInvoked },
6522
+ { no: 3, name: "filesystem_requested", kind: "message", oneof: "event", T: () => BotFilesystemRequested }
6504
6523
  ]);
6505
6524
  }
6506
6525
  create(value) {
@@ -6527,6 +6546,12 @@ class BotEvent$Type extends import_runtime4.MessageType {
6527
6546
  chatSettingsItemInvoked: BotChatSettingsItemInvoked.internalBinaryRead(reader, reader.uint32(), options, message.event.chatSettingsItemInvoked)
6528
6547
  };
6529
6548
  break;
6549
+ case 3:
6550
+ message.event = {
6551
+ oneofKind: "filesystemRequested",
6552
+ filesystemRequested: BotFilesystemRequested.internalBinaryRead(reader, reader.uint32(), options, message.event.filesystemRequested)
6553
+ };
6554
+ break;
6530
6555
  default:
6531
6556
  let u = options.readUnknownField;
6532
6557
  if (u === "throw")
@@ -6543,6 +6568,8 @@ class BotEvent$Type extends import_runtime4.MessageType {
6543
6568
  BotChatSettingsRequested.internalBinaryWrite(message.event.chatSettingsRequested, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
6544
6569
  if (message.event.oneofKind === "chatSettingsItemInvoked")
6545
6570
  BotChatSettingsItemInvoked.internalBinaryWrite(message.event.chatSettingsItemInvoked, writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
6571
+ if (message.event.oneofKind === "filesystemRequested")
6572
+ BotFilesystemRequested.internalBinaryWrite(message.event.filesystemRequested, writer.tag(3, import_runtime.WireType.LengthDelimited).fork(), options).join();
6546
6573
  let u = options.writeUnknownFields;
6547
6574
  if (u !== false)
6548
6575
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -7699,7 +7726,8 @@ class Dialog$Type extends import_runtime4.MessageType {
7699
7726
  { no: 15, name: "pinned_order", kind: "scalar", opt: true, T: 9 },
7700
7727
  { no: 16, name: "follow_mode", kind: "enum", opt: true, T: () => ["DialogFollowMode", DialogFollowMode] },
7701
7728
  { no: 17, name: "collapsed_max_id", kind: "scalar", opt: true, T: 3, L: 0 },
7702
- { no: 18, name: "folder_id", kind: "scalar", opt: true, T: 3, L: 0 }
7729
+ { no: 18, name: "folder_id", kind: "scalar", opt: true, T: 3, L: 0 },
7730
+ { no: 19, name: "translation_enabled", kind: "scalar", opt: true, T: 8 }
7703
7731
  ]);
7704
7732
  }
7705
7733
  create(value) {
@@ -7767,6 +7795,9 @@ class Dialog$Type extends import_runtime4.MessageType {
7767
7795
  case 18:
7768
7796
  message.folderId = reader.int64().toBigInt();
7769
7797
  break;
7798
+ case 19:
7799
+ message.translationEnabled = reader.bool();
7800
+ break;
7770
7801
  default:
7771
7802
  let u = options.readUnknownField;
7772
7803
  if (u === "throw")
@@ -7815,6 +7846,8 @@ class Dialog$Type extends import_runtime4.MessageType {
7815
7846
  writer.tag(17, import_runtime.WireType.Varint).int64(message.collapsedMaxId);
7816
7847
  if (message.folderId !== undefined)
7817
7848
  writer.tag(18, import_runtime.WireType.Varint).int64(message.folderId);
7849
+ if (message.translationEnabled !== undefined)
7850
+ writer.tag(19, import_runtime.WireType.Varint).bool(message.translationEnabled);
7818
7851
  let u = options.writeUnknownFields;
7819
7852
  if (u !== false)
7820
7853
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -13947,7 +13980,11 @@ class RpcCall$Type extends import_runtime4.MessageType {
13947
13980
  { no: 138, name: "acknowledgeMessages", kind: "message", oneof: "input", T: () => AcknowledgeMessagesInput },
13948
13981
  { no: 139, name: "getUsers", kind: "message", oneof: "input", T: () => GetUsersInput },
13949
13982
  { no: 140, name: "getBotSkills", kind: "message", oneof: "input", T: () => GetBotSkillsInput },
13950
- { no: 141, name: "getBotConfigurationCatalog", kind: "message", oneof: "input", T: () => GetBotConfigurationCatalogInput }
13983
+ { no: 141, name: "getBotConfigurationCatalog", kind: "message", oneof: "input", T: () => GetBotConfigurationCatalogInput },
13984
+ { no: 142, name: "updateDialogTranslation", kind: "message", oneof: "input", T: () => UpdateDialogTranslationInput },
13985
+ { no: 143, name: "transcribeVoiceDraft", kind: "message", oneof: "input", T: () => TranscribeVoiceDraftInput },
13986
+ { no: 144, name: "requestBotFilesystem", kind: "message", oneof: "input", T: () => RequestBotFilesystemInput },
13987
+ { no: 145, name: "answerBotFilesystem", kind: "message", oneof: "input", T: () => AnswerBotFilesystemInput }
13951
13988
  ]);
13952
13989
  }
13953
13990
  create(value) {
@@ -14800,6 +14837,30 @@ class RpcCall$Type extends import_runtime4.MessageType {
14800
14837
  getBotConfigurationCatalog: GetBotConfigurationCatalogInput.internalBinaryRead(reader, reader.uint32(), options, message.input.getBotConfigurationCatalog)
14801
14838
  };
14802
14839
  break;
14840
+ case 142:
14841
+ message.input = {
14842
+ oneofKind: "updateDialogTranslation",
14843
+ updateDialogTranslation: UpdateDialogTranslationInput.internalBinaryRead(reader, reader.uint32(), options, message.input.updateDialogTranslation)
14844
+ };
14845
+ break;
14846
+ case 143:
14847
+ message.input = {
14848
+ oneofKind: "transcribeVoiceDraft",
14849
+ transcribeVoiceDraft: TranscribeVoiceDraftInput.internalBinaryRead(reader, reader.uint32(), options, message.input.transcribeVoiceDraft)
14850
+ };
14851
+ break;
14852
+ case 144:
14853
+ message.input = {
14854
+ oneofKind: "requestBotFilesystem",
14855
+ requestBotFilesystem: RequestBotFilesystemInput.internalBinaryRead(reader, reader.uint32(), options, message.input.requestBotFilesystem)
14856
+ };
14857
+ break;
14858
+ case 145:
14859
+ message.input = {
14860
+ oneofKind: "answerBotFilesystem",
14861
+ answerBotFilesystem: AnswerBotFilesystemInput.internalBinaryRead(reader, reader.uint32(), options, message.input.answerBotFilesystem)
14862
+ };
14863
+ break;
14803
14864
  default:
14804
14865
  let u = options.readUnknownField;
14805
14866
  if (u === "throw")
@@ -15092,6 +15153,14 @@ class RpcCall$Type extends import_runtime4.MessageType {
15092
15153
  GetBotSkillsInput.internalBinaryWrite(message.input.getBotSkills, writer.tag(140, import_runtime.WireType.LengthDelimited).fork(), options).join();
15093
15154
  if (message.input.oneofKind === "getBotConfigurationCatalog")
15094
15155
  GetBotConfigurationCatalogInput.internalBinaryWrite(message.input.getBotConfigurationCatalog, writer.tag(141, import_runtime.WireType.LengthDelimited).fork(), options).join();
15156
+ if (message.input.oneofKind === "updateDialogTranslation")
15157
+ UpdateDialogTranslationInput.internalBinaryWrite(message.input.updateDialogTranslation, writer.tag(142, import_runtime.WireType.LengthDelimited).fork(), options).join();
15158
+ if (message.input.oneofKind === "transcribeVoiceDraft")
15159
+ TranscribeVoiceDraftInput.internalBinaryWrite(message.input.transcribeVoiceDraft, writer.tag(143, import_runtime.WireType.LengthDelimited).fork(), options).join();
15160
+ if (message.input.oneofKind === "requestBotFilesystem")
15161
+ RequestBotFilesystemInput.internalBinaryWrite(message.input.requestBotFilesystem, writer.tag(144, import_runtime.WireType.LengthDelimited).fork(), options).join();
15162
+ if (message.input.oneofKind === "answerBotFilesystem")
15163
+ AnswerBotFilesystemInput.internalBinaryWrite(message.input.answerBotFilesystem, writer.tag(145, import_runtime.WireType.LengthDelimited).fork(), options).join();
15095
15164
  let u = options.writeUnknownFields;
15096
15165
  if (u !== false)
15097
15166
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -15242,7 +15311,11 @@ class RpcResult$Type extends import_runtime4.MessageType {
15242
15311
  { no: 138, name: "acknowledgeMessages", kind: "message", oneof: "result", T: () => AcknowledgeMessagesResult },
15243
15312
  { no: 139, name: "getUsers", kind: "message", oneof: "result", T: () => GetUsersResult },
15244
15313
  { no: 140, name: "getBotSkills", kind: "message", oneof: "result", T: () => GetBotSkillsResult },
15245
- { no: 141, name: "getBotConfigurationCatalog", kind: "message", oneof: "result", T: () => GetBotConfigurationCatalogResult }
15314
+ { no: 141, name: "getBotConfigurationCatalog", kind: "message", oneof: "result", T: () => GetBotConfigurationCatalogResult },
15315
+ { no: 142, name: "updateDialogTranslation", kind: "message", oneof: "result", T: () => UpdateDialogTranslationResult },
15316
+ { no: 143, name: "transcribeVoiceDraft", kind: "message", oneof: "result", T: () => TranscribeVoiceDraftResult },
15317
+ { no: 144, name: "requestBotFilesystem", kind: "message", oneof: "result", T: () => RequestBotFilesystemResult },
15318
+ { no: 145, name: "answerBotFilesystem", kind: "message", oneof: "result", T: () => AnswerBotFilesystemResult }
15246
15319
  ]);
15247
15320
  }
15248
15321
  create(value) {
@@ -16095,6 +16168,30 @@ class RpcResult$Type extends import_runtime4.MessageType {
16095
16168
  getBotConfigurationCatalog: GetBotConfigurationCatalogResult.internalBinaryRead(reader, reader.uint32(), options, message.result.getBotConfigurationCatalog)
16096
16169
  };
16097
16170
  break;
16171
+ case 142:
16172
+ message.result = {
16173
+ oneofKind: "updateDialogTranslation",
16174
+ updateDialogTranslation: UpdateDialogTranslationResult.internalBinaryRead(reader, reader.uint32(), options, message.result.updateDialogTranslation)
16175
+ };
16176
+ break;
16177
+ case 143:
16178
+ message.result = {
16179
+ oneofKind: "transcribeVoiceDraft",
16180
+ transcribeVoiceDraft: TranscribeVoiceDraftResult.internalBinaryRead(reader, reader.uint32(), options, message.result.transcribeVoiceDraft)
16181
+ };
16182
+ break;
16183
+ case 144:
16184
+ message.result = {
16185
+ oneofKind: "requestBotFilesystem",
16186
+ requestBotFilesystem: RequestBotFilesystemResult.internalBinaryRead(reader, reader.uint32(), options, message.result.requestBotFilesystem)
16187
+ };
16188
+ break;
16189
+ case 145:
16190
+ message.result = {
16191
+ oneofKind: "answerBotFilesystem",
16192
+ answerBotFilesystem: AnswerBotFilesystemResult.internalBinaryRead(reader, reader.uint32(), options, message.result.answerBotFilesystem)
16193
+ };
16194
+ break;
16098
16195
  default:
16099
16196
  let u = options.readUnknownField;
16100
16197
  if (u === "throw")
@@ -16387,6 +16484,14 @@ class RpcResult$Type extends import_runtime4.MessageType {
16387
16484
  GetBotSkillsResult.internalBinaryWrite(message.result.getBotSkills, writer.tag(140, import_runtime.WireType.LengthDelimited).fork(), options).join();
16388
16485
  if (message.result.oneofKind === "getBotConfigurationCatalog")
16389
16486
  GetBotConfigurationCatalogResult.internalBinaryWrite(message.result.getBotConfigurationCatalog, writer.tag(141, import_runtime.WireType.LengthDelimited).fork(), options).join();
16487
+ if (message.result.oneofKind === "updateDialogTranslation")
16488
+ UpdateDialogTranslationResult.internalBinaryWrite(message.result.updateDialogTranslation, writer.tag(142, import_runtime.WireType.LengthDelimited).fork(), options).join();
16489
+ if (message.result.oneofKind === "transcribeVoiceDraft")
16490
+ TranscribeVoiceDraftResult.internalBinaryWrite(message.result.transcribeVoiceDraft, writer.tag(143, import_runtime.WireType.LengthDelimited).fork(), options).join();
16491
+ if (message.result.oneofKind === "requestBotFilesystem")
16492
+ RequestBotFilesystemResult.internalBinaryWrite(message.result.requestBotFilesystem, writer.tag(144, import_runtime.WireType.LengthDelimited).fork(), options).join();
16493
+ if (message.result.oneofKind === "answerBotFilesystem")
16494
+ AnswerBotFilesystemResult.internalBinaryWrite(message.result.answerBotFilesystem, writer.tag(145, import_runtime.WireType.LengthDelimited).fork(), options).join();
16390
16495
  let u = options.writeUnknownFields;
16391
16496
  if (u !== false)
16392
16497
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -19951,6 +20056,153 @@ class UpdateDialogFollowModeResult$Type extends import_runtime4.MessageType {
19951
20056
  }
19952
20057
  var UpdateDialogFollowModeResult = new UpdateDialogFollowModeResult$Type;
19953
20058
 
20059
+ class UpdateDialogTranslationInput$Type extends import_runtime4.MessageType {
20060
+ constructor() {
20061
+ super("UpdateDialogTranslationInput", [
20062
+ { no: 1, name: "peer_id", kind: "message", T: () => InputPeer },
20063
+ { no: 2, name: "enabled", kind: "scalar", opt: true, T: 8 },
20064
+ { no: 3, name: "import_legacy_enabled", kind: "scalar", T: 8 }
20065
+ ]);
20066
+ }
20067
+ create(value) {
20068
+ const message = globalThis.Object.create(this.messagePrototype);
20069
+ message.importLegacyEnabled = false;
20070
+ if (value !== undefined)
20071
+ import_runtime3.reflectionMergePartial(this, message, value);
20072
+ return message;
20073
+ }
20074
+ internalBinaryRead(reader, length, options, target) {
20075
+ let message = target ?? this.create(), end = reader.pos + length;
20076
+ while (reader.pos < end) {
20077
+ let [fieldNo, wireType] = reader.tag();
20078
+ switch (fieldNo) {
20079
+ case 1:
20080
+ message.peerId = InputPeer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
20081
+ break;
20082
+ case 2:
20083
+ message.enabled = reader.bool();
20084
+ break;
20085
+ case 3:
20086
+ message.importLegacyEnabled = reader.bool();
20087
+ break;
20088
+ default:
20089
+ let u = options.readUnknownField;
20090
+ if (u === "throw")
20091
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
20092
+ let d = reader.skip(wireType);
20093
+ if (u !== false)
20094
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
20095
+ }
20096
+ }
20097
+ return message;
20098
+ }
20099
+ internalBinaryWrite(message, writer, options) {
20100
+ if (message.peerId)
20101
+ InputPeer.internalBinaryWrite(message.peerId, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
20102
+ if (message.enabled !== undefined)
20103
+ writer.tag(2, import_runtime.WireType.Varint).bool(message.enabled);
20104
+ if (message.importLegacyEnabled !== false)
20105
+ writer.tag(3, import_runtime.WireType.Varint).bool(message.importLegacyEnabled);
20106
+ let u = options.writeUnknownFields;
20107
+ if (u !== false)
20108
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
20109
+ return writer;
20110
+ }
20111
+ }
20112
+ var UpdateDialogTranslationInput = new UpdateDialogTranslationInput$Type;
20113
+
20114
+ class UpdateDialogTranslationResult$Type extends import_runtime4.MessageType {
20115
+ constructor() {
20116
+ super("UpdateDialogTranslationResult", [
20117
+ { no: 1, name: "updates", kind: "message", repeat: 1, T: () => Update }
20118
+ ]);
20119
+ }
20120
+ create(value) {
20121
+ const message = globalThis.Object.create(this.messagePrototype);
20122
+ message.updates = [];
20123
+ if (value !== undefined)
20124
+ import_runtime3.reflectionMergePartial(this, message, value);
20125
+ return message;
20126
+ }
20127
+ internalBinaryRead(reader, length, options, target) {
20128
+ let message = target ?? this.create(), end = reader.pos + length;
20129
+ while (reader.pos < end) {
20130
+ let [fieldNo, wireType] = reader.tag();
20131
+ switch (fieldNo) {
20132
+ case 1:
20133
+ message.updates.push(Update.internalBinaryRead(reader, reader.uint32(), options));
20134
+ break;
20135
+ default:
20136
+ let u = options.readUnknownField;
20137
+ if (u === "throw")
20138
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
20139
+ let d = reader.skip(wireType);
20140
+ if (u !== false)
20141
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
20142
+ }
20143
+ }
20144
+ return message;
20145
+ }
20146
+ internalBinaryWrite(message, writer, options) {
20147
+ for (let i = 0;i < message.updates.length; i++)
20148
+ Update.internalBinaryWrite(message.updates[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
20149
+ let u = options.writeUnknownFields;
20150
+ if (u !== false)
20151
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
20152
+ return writer;
20153
+ }
20154
+ }
20155
+ var UpdateDialogTranslationResult = new UpdateDialogTranslationResult$Type;
20156
+
20157
+ class UpdateDialogTranslation$Type extends import_runtime4.MessageType {
20158
+ constructor() {
20159
+ super("UpdateDialogTranslation", [
20160
+ { no: 1, name: "peer_id", kind: "message", T: () => Peer },
20161
+ { no: 2, name: "enabled", kind: "scalar", T: 8 }
20162
+ ]);
20163
+ }
20164
+ create(value) {
20165
+ const message = globalThis.Object.create(this.messagePrototype);
20166
+ message.enabled = false;
20167
+ if (value !== undefined)
20168
+ import_runtime3.reflectionMergePartial(this, message, value);
20169
+ return message;
20170
+ }
20171
+ internalBinaryRead(reader, length, options, target) {
20172
+ let message = target ?? this.create(), end = reader.pos + length;
20173
+ while (reader.pos < end) {
20174
+ let [fieldNo, wireType] = reader.tag();
20175
+ switch (fieldNo) {
20176
+ case 1:
20177
+ message.peerId = Peer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
20178
+ break;
20179
+ case 2:
20180
+ message.enabled = reader.bool();
20181
+ break;
20182
+ default:
20183
+ let u = options.readUnknownField;
20184
+ if (u === "throw")
20185
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
20186
+ let d = reader.skip(wireType);
20187
+ if (u !== false)
20188
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
20189
+ }
20190
+ }
20191
+ return message;
20192
+ }
20193
+ internalBinaryWrite(message, writer, options) {
20194
+ if (message.peerId)
20195
+ Peer.internalBinaryWrite(message.peerId, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
20196
+ if (message.enabled !== false)
20197
+ writer.tag(2, import_runtime.WireType.Varint).bool(message.enabled);
20198
+ let u = options.writeUnknownFields;
20199
+ if (u !== false)
20200
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
20201
+ return writer;
20202
+ }
20203
+ }
20204
+ var UpdateDialogTranslation = new UpdateDialogTranslation$Type;
20205
+
19954
20206
  class CollapseHistoryInput$Type extends import_runtime4.MessageType {
19955
20207
  constructor() {
19956
20208
  super("CollapseHistoryInput", [
@@ -29477,7 +29729,8 @@ class Update$Type extends import_runtime4.MessageType {
29477
29729
  { no: 46, name: "dialog_folder", kind: "message", oneof: "update", T: () => UpdateDialogFolder },
29478
29730
  { no: 47, name: "user_added_to_chat", kind: "message", oneof: "update", T: () => UpdateUserAddedToChat },
29479
29731
  { no: 48, name: "user_removed_from_chat", kind: "message", oneof: "update", T: () => UpdateUserRemovedFromChat },
29480
- { no: 49, name: "acknowledgement", kind: "message", oneof: "update", T: () => ChatAcknowledgement }
29732
+ { no: 49, name: "acknowledgement", kind: "message", oneof: "update", T: () => ChatAcknowledgement },
29733
+ { no: 50, name: "dialog_translation", kind: "message", oneof: "update", T: () => UpdateDialogTranslation }
29481
29734
  ]);
29482
29735
  }
29483
29736
  create(value) {
@@ -29774,6 +30027,12 @@ class Update$Type extends import_runtime4.MessageType {
29774
30027
  acknowledgement: ChatAcknowledgement.internalBinaryRead(reader, reader.uint32(), options, message.update.acknowledgement)
29775
30028
  };
29776
30029
  break;
30030
+ case 50:
30031
+ message.update = {
30032
+ oneofKind: "dialogTranslation",
30033
+ dialogTranslation: UpdateDialogTranslation.internalBinaryRead(reader, reader.uint32(), options, message.update.dialogTranslation)
30034
+ };
30035
+ break;
29777
30036
  default:
29778
30037
  let u = options.readUnknownField;
29779
30038
  if (u === "throw")
@@ -29882,6 +30141,8 @@ class Update$Type extends import_runtime4.MessageType {
29882
30141
  UpdateUserRemovedFromChat.internalBinaryWrite(message.update.userRemovedFromChat, writer.tag(48, import_runtime.WireType.LengthDelimited).fork(), options).join();
29883
30142
  if (message.update.oneofKind === "acknowledgement")
29884
30143
  ChatAcknowledgement.internalBinaryWrite(message.update.acknowledgement, writer.tag(49, import_runtime.WireType.LengthDelimited).fork(), options).join();
30144
+ if (message.update.oneofKind === "dialogTranslation")
30145
+ UpdateDialogTranslation.internalBinaryWrite(message.update.dialogTranslation, writer.tag(50, import_runtime.WireType.LengthDelimited).fork(), options).join();
29885
30146
  let u = options.writeUnknownFields;
29886
30147
  if (u !== false)
29887
30148
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -33881,7 +34142,8 @@ class AgentProjectCatalog$Type extends import_runtime4.MessageType {
33881
34142
  constructor() {
33882
34143
  super("AgentProjectCatalog", [
33883
34144
  { no: 1, name: "options", kind: "message", repeat: 1, T: () => AgentProjectOption },
33884
- { no: 2, name: "can_select_folder", kind: "scalar", opt: true, T: 8 }
34145
+ { no: 2, name: "can_select_folder", kind: "scalar", opt: true, T: 8 },
34146
+ { no: 3, name: "default_project_id", kind: "scalar", opt: true, T: 9 }
33885
34147
  ]);
33886
34148
  }
33887
34149
  create(value) {
@@ -33902,6 +34164,9 @@ class AgentProjectCatalog$Type extends import_runtime4.MessageType {
33902
34164
  case 2:
33903
34165
  message.canSelectFolder = reader.bool();
33904
34166
  break;
34167
+ case 3:
34168
+ message.defaultProjectId = reader.string();
34169
+ break;
33905
34170
  default:
33906
34171
  let u = options.readUnknownField;
33907
34172
  if (u === "throw")
@@ -33918,6 +34183,8 @@ class AgentProjectCatalog$Type extends import_runtime4.MessageType {
33918
34183
  AgentProjectOption.internalBinaryWrite(message.options[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
33919
34184
  if (message.canSelectFolder !== undefined)
33920
34185
  writer.tag(2, import_runtime.WireType.Varint).bool(message.canSelectFolder);
34186
+ if (message.defaultProjectId !== undefined)
34187
+ writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.defaultProjectId);
33921
34188
  let u = options.writeUnknownFields;
33922
34189
  if (u !== false)
33923
34190
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -34031,7 +34298,8 @@ class AgentModelOption$Type extends import_runtime4.MessageType {
34031
34298
  { no: 1, name: "id", kind: "scalar", T: 9 },
34032
34299
  { no: 2, name: "label", kind: "scalar", T: 9 },
34033
34300
  { no: 3, name: "description", kind: "scalar", opt: true, T: 9 },
34034
- { no: 4, name: "reasoning_effort_ids", kind: "scalar", repeat: 2, T: 9 }
34301
+ { no: 4, name: "reasoning_effort_ids", kind: "scalar", repeat: 2, T: 9 },
34302
+ { no: 5, name: "default_reasoning_effort_id", kind: "scalar", opt: true, T: 9 }
34035
34303
  ]);
34036
34304
  }
34037
34305
  create(value) {
@@ -34060,6 +34328,9 @@ class AgentModelOption$Type extends import_runtime4.MessageType {
34060
34328
  case 4:
34061
34329
  message.reasoningEffortIds.push(reader.string());
34062
34330
  break;
34331
+ case 5:
34332
+ message.defaultReasoningEffortId = reader.string();
34333
+ break;
34063
34334
  default:
34064
34335
  let u = options.readUnknownField;
34065
34336
  if (u === "throw")
@@ -34080,6 +34351,8 @@ class AgentModelOption$Type extends import_runtime4.MessageType {
34080
34351
  writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.description);
34081
34352
  for (let i = 0;i < message.reasoningEffortIds.length; i++)
34082
34353
  writer.tag(4, import_runtime.WireType.LengthDelimited).string(message.reasoningEffortIds[i]);
34354
+ if (message.defaultReasoningEffortId !== undefined)
34355
+ writer.tag(5, import_runtime.WireType.LengthDelimited).string(message.defaultReasoningEffortId);
34083
34356
  let u = options.writeUnknownFields;
34084
34357
  if (u !== false)
34085
34358
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -34091,7 +34364,8 @@ var AgentModelOption = new AgentModelOption$Type;
34091
34364
  class AgentModelCatalog$Type extends import_runtime4.MessageType {
34092
34365
  constructor() {
34093
34366
  super("AgentModelCatalog", [
34094
- { no: 1, name: "options", kind: "message", repeat: 1, T: () => AgentModelOption }
34367
+ { no: 1, name: "options", kind: "message", repeat: 1, T: () => AgentModelOption },
34368
+ { no: 2, name: "default_model_id", kind: "scalar", opt: true, T: 9 }
34095
34369
  ]);
34096
34370
  }
34097
34371
  create(value) {
@@ -34109,6 +34383,9 @@ class AgentModelCatalog$Type extends import_runtime4.MessageType {
34109
34383
  case 1:
34110
34384
  message.options.push(AgentModelOption.internalBinaryRead(reader, reader.uint32(), options));
34111
34385
  break;
34386
+ case 2:
34387
+ message.defaultModelId = reader.string();
34388
+ break;
34112
34389
  default:
34113
34390
  let u = options.readUnknownField;
34114
34391
  if (u === "throw")
@@ -34123,6 +34400,8 @@ class AgentModelCatalog$Type extends import_runtime4.MessageType {
34123
34400
  internalBinaryWrite(message, writer, options) {
34124
34401
  for (let i = 0;i < message.options.length; i++)
34125
34402
  AgentModelOption.internalBinaryWrite(message.options[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
34403
+ if (message.defaultModelId !== undefined)
34404
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.defaultModelId);
34126
34405
  let u = options.writeUnknownFields;
34127
34406
  if (u !== false)
34128
34407
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -35009,7 +35288,8 @@ class BotChatSettingsFolder$Type extends import_runtime4.MessageType {
35009
35288
  { no: 4, name: "host_label", kind: "scalar", T: 9 },
35010
35289
  { no: 5, name: "allows_local_picker", kind: "scalar", T: 8 },
35011
35290
  { no: 6, name: "local_picker_port", kind: "scalar", opt: true, T: 13 },
35012
- { no: 7, name: "local_picker_capability", kind: "scalar", opt: true, T: 9 }
35291
+ { no: 7, name: "local_picker_capability", kind: "scalar", opt: true, T: 9 },
35292
+ { no: 8, name: "remote_browser_version", kind: "scalar", opt: true, T: 13 }
35013
35293
  ]);
35014
35294
  }
35015
35295
  create(value) {
@@ -35049,6 +35329,9 @@ class BotChatSettingsFolder$Type extends import_runtime4.MessageType {
35049
35329
  case 7:
35050
35330
  message.localPickerCapability = reader.string();
35051
35331
  break;
35332
+ case 8:
35333
+ message.remoteBrowserVersion = reader.uint32();
35334
+ break;
35052
35335
  default:
35053
35336
  let u = options.readUnknownField;
35054
35337
  if (u === "throw")
@@ -35075,6 +35358,8 @@ class BotChatSettingsFolder$Type extends import_runtime4.MessageType {
35075
35358
  writer.tag(6, import_runtime.WireType.Varint).uint32(message.localPickerPort);
35076
35359
  if (message.localPickerCapability !== undefined)
35077
35360
  writer.tag(7, import_runtime.WireType.LengthDelimited).string(message.localPickerCapability);
35361
+ if (message.remoteBrowserVersion !== undefined)
35362
+ writer.tag(8, import_runtime.WireType.Varint).uint32(message.remoteBrowserVersion);
35078
35363
  let u = options.writeUnknownFields;
35079
35364
  if (u !== false)
35080
35365
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -38319,6 +38604,542 @@ class ChatAcknowledgements$Type extends import_runtime4.MessageType {
38319
38604
  }
38320
38605
  var ChatAcknowledgements = new ChatAcknowledgements$Type;
38321
38606
 
38607
+ class TranscribeVoiceDraftInput$Type extends import_runtime4.MessageType {
38608
+ constructor() {
38609
+ super("TranscribeVoiceDraftInput", [
38610
+ { no: 1, name: "audio", kind: "scalar", T: 12 },
38611
+ { no: 2, name: "mime_type", kind: "scalar", T: 9 },
38612
+ { no: 3, name: "duration", kind: "scalar", T: 13 }
38613
+ ]);
38614
+ }
38615
+ create(value) {
38616
+ const message = globalThis.Object.create(this.messagePrototype);
38617
+ message.audio = new Uint8Array(0);
38618
+ message.mimeType = "";
38619
+ message.duration = 0;
38620
+ if (value !== undefined)
38621
+ import_runtime3.reflectionMergePartial(this, message, value);
38622
+ return message;
38623
+ }
38624
+ internalBinaryRead(reader, length, options, target) {
38625
+ let message = target ?? this.create(), end = reader.pos + length;
38626
+ while (reader.pos < end) {
38627
+ let [fieldNo, wireType] = reader.tag();
38628
+ switch (fieldNo) {
38629
+ case 1:
38630
+ message.audio = reader.bytes();
38631
+ break;
38632
+ case 2:
38633
+ message.mimeType = reader.string();
38634
+ break;
38635
+ case 3:
38636
+ message.duration = reader.uint32();
38637
+ break;
38638
+ default:
38639
+ let u = options.readUnknownField;
38640
+ if (u === "throw")
38641
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
38642
+ let d = reader.skip(wireType);
38643
+ if (u !== false)
38644
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
38645
+ }
38646
+ }
38647
+ return message;
38648
+ }
38649
+ internalBinaryWrite(message, writer, options) {
38650
+ if (message.audio.length)
38651
+ writer.tag(1, import_runtime.WireType.LengthDelimited).bytes(message.audio);
38652
+ if (message.mimeType !== "")
38653
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.mimeType);
38654
+ if (message.duration !== 0)
38655
+ writer.tag(3, import_runtime.WireType.Varint).uint32(message.duration);
38656
+ let u = options.writeUnknownFields;
38657
+ if (u !== false)
38658
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
38659
+ return writer;
38660
+ }
38661
+ }
38662
+ var TranscribeVoiceDraftInput = new TranscribeVoiceDraftInput$Type;
38663
+
38664
+ class TranscribeVoiceDraftResult$Type extends import_runtime4.MessageType {
38665
+ constructor() {
38666
+ super("TranscribeVoiceDraftResult", [
38667
+ { no: 1, name: "text", kind: "scalar", T: 9 }
38668
+ ]);
38669
+ }
38670
+ create(value) {
38671
+ const message = globalThis.Object.create(this.messagePrototype);
38672
+ message.text = "";
38673
+ if (value !== undefined)
38674
+ import_runtime3.reflectionMergePartial(this, message, value);
38675
+ return message;
38676
+ }
38677
+ internalBinaryRead(reader, length, options, target) {
38678
+ let message = target ?? this.create(), end = reader.pos + length;
38679
+ while (reader.pos < end) {
38680
+ let [fieldNo, wireType] = reader.tag();
38681
+ switch (fieldNo) {
38682
+ case 1:
38683
+ message.text = reader.string();
38684
+ break;
38685
+ default:
38686
+ let u = options.readUnknownField;
38687
+ if (u === "throw")
38688
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
38689
+ let d = reader.skip(wireType);
38690
+ if (u !== false)
38691
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
38692
+ }
38693
+ }
38694
+ return message;
38695
+ }
38696
+ internalBinaryWrite(message, writer, options) {
38697
+ if (message.text !== "")
38698
+ writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.text);
38699
+ let u = options.writeUnknownFields;
38700
+ if (u !== false)
38701
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
38702
+ return writer;
38703
+ }
38704
+ }
38705
+ var TranscribeVoiceDraftResult = new TranscribeVoiceDraftResult$Type;
38706
+
38707
+ class RequestBotFilesystemInput$Type extends import_runtime4.MessageType {
38708
+ constructor() {
38709
+ super("RequestBotFilesystemInput", [
38710
+ { no: 1, name: "peer_id", kind: "message", T: () => InputPeer },
38711
+ { no: 2, name: "bot_user_id", kind: "scalar", T: 3, L: 0 },
38712
+ { no: 3, name: "host_installation_id", kind: "scalar", T: 9 },
38713
+ { no: 4, name: "operation", kind: "enum", T: () => ["RequestBotFilesystemInput.Operation", RequestBotFilesystemInput_Operation] },
38714
+ { no: 5, name: "path", kind: "scalar", T: 9 },
38715
+ { no: 6, name: "after", kind: "scalar", T: 9 }
38716
+ ]);
38717
+ }
38718
+ create(value) {
38719
+ const message = globalThis.Object.create(this.messagePrototype);
38720
+ message.botUserId = 0n;
38721
+ message.hostInstallationId = "";
38722
+ message.operation = 0;
38723
+ message.path = "";
38724
+ message.after = "";
38725
+ if (value !== undefined)
38726
+ import_runtime3.reflectionMergePartial(this, message, value);
38727
+ return message;
38728
+ }
38729
+ internalBinaryRead(reader, length, options, target) {
38730
+ let message = target ?? this.create(), end = reader.pos + length;
38731
+ while (reader.pos < end) {
38732
+ let [fieldNo, wireType] = reader.tag();
38733
+ switch (fieldNo) {
38734
+ case 1:
38735
+ message.peerId = InputPeer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
38736
+ break;
38737
+ case 2:
38738
+ message.botUserId = reader.int64().toBigInt();
38739
+ break;
38740
+ case 3:
38741
+ message.hostInstallationId = reader.string();
38742
+ break;
38743
+ case 4:
38744
+ message.operation = reader.int32();
38745
+ break;
38746
+ case 5:
38747
+ message.path = reader.string();
38748
+ break;
38749
+ case 6:
38750
+ message.after = reader.string();
38751
+ break;
38752
+ default:
38753
+ let u = options.readUnknownField;
38754
+ if (u === "throw")
38755
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
38756
+ let d = reader.skip(wireType);
38757
+ if (u !== false)
38758
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
38759
+ }
38760
+ }
38761
+ return message;
38762
+ }
38763
+ internalBinaryWrite(message, writer, options) {
38764
+ if (message.peerId)
38765
+ InputPeer.internalBinaryWrite(message.peerId, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
38766
+ if (message.botUserId !== 0n)
38767
+ writer.tag(2, import_runtime.WireType.Varint).int64(message.botUserId);
38768
+ if (message.hostInstallationId !== "")
38769
+ writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.hostInstallationId);
38770
+ if (message.operation !== 0)
38771
+ writer.tag(4, import_runtime.WireType.Varint).int32(message.operation);
38772
+ if (message.path !== "")
38773
+ writer.tag(5, import_runtime.WireType.LengthDelimited).string(message.path);
38774
+ if (message.after !== "")
38775
+ writer.tag(6, import_runtime.WireType.LengthDelimited).string(message.after);
38776
+ let u = options.writeUnknownFields;
38777
+ if (u !== false)
38778
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
38779
+ return writer;
38780
+ }
38781
+ }
38782
+ var RequestBotFilesystemInput = new RequestBotFilesystemInput$Type;
38783
+
38784
+ class BotFilesystemEntry$Type extends import_runtime4.MessageType {
38785
+ constructor() {
38786
+ super("BotFilesystemEntry", [
38787
+ { no: 1, name: "name", kind: "scalar", T: 9 },
38788
+ { no: 2, name: "kind", kind: "enum", T: () => ["BotFilesystemEntry.Kind", BotFilesystemEntry_Kind] },
38789
+ { no: 3, name: "size", kind: "scalar", T: 4, L: 0 }
38790
+ ]);
38791
+ }
38792
+ create(value) {
38793
+ const message = globalThis.Object.create(this.messagePrototype);
38794
+ message.name = "";
38795
+ message.kind = 0;
38796
+ message.size = 0n;
38797
+ if (value !== undefined)
38798
+ import_runtime3.reflectionMergePartial(this, message, value);
38799
+ return message;
38800
+ }
38801
+ internalBinaryRead(reader, length, options, target) {
38802
+ let message = target ?? this.create(), end = reader.pos + length;
38803
+ while (reader.pos < end) {
38804
+ let [fieldNo, wireType] = reader.tag();
38805
+ switch (fieldNo) {
38806
+ case 1:
38807
+ message.name = reader.string();
38808
+ break;
38809
+ case 2:
38810
+ message.kind = reader.int32();
38811
+ break;
38812
+ case 3:
38813
+ message.size = reader.uint64().toBigInt();
38814
+ break;
38815
+ default:
38816
+ let u = options.readUnknownField;
38817
+ if (u === "throw")
38818
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
38819
+ let d = reader.skip(wireType);
38820
+ if (u !== false)
38821
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
38822
+ }
38823
+ }
38824
+ return message;
38825
+ }
38826
+ internalBinaryWrite(message, writer, options) {
38827
+ if (message.name !== "")
38828
+ writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.name);
38829
+ if (message.kind !== 0)
38830
+ writer.tag(2, import_runtime.WireType.Varint).int32(message.kind);
38831
+ if (message.size !== 0n)
38832
+ writer.tag(3, import_runtime.WireType.Varint).uint64(message.size);
38833
+ let u = options.writeUnknownFields;
38834
+ if (u !== false)
38835
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
38836
+ return writer;
38837
+ }
38838
+ }
38839
+ var BotFilesystemEntry = new BotFilesystemEntry$Type;
38840
+
38841
+ class BotFilesystemListing$Type extends import_runtime4.MessageType {
38842
+ constructor() {
38843
+ super("BotFilesystemListing", [
38844
+ { no: 1, name: "path", kind: "scalar", T: 9 },
38845
+ { no: 2, name: "parent_path", kind: "scalar", opt: true, T: 9 },
38846
+ { no: 3, name: "entries", kind: "message", repeat: 1, T: () => BotFilesystemEntry },
38847
+ { no: 4, name: "next_after", kind: "scalar", opt: true, T: 9 }
38848
+ ]);
38849
+ }
38850
+ create(value) {
38851
+ const message = globalThis.Object.create(this.messagePrototype);
38852
+ message.path = "";
38853
+ message.entries = [];
38854
+ if (value !== undefined)
38855
+ import_runtime3.reflectionMergePartial(this, message, value);
38856
+ return message;
38857
+ }
38858
+ internalBinaryRead(reader, length, options, target) {
38859
+ let message = target ?? this.create(), end = reader.pos + length;
38860
+ while (reader.pos < end) {
38861
+ let [fieldNo, wireType] = reader.tag();
38862
+ switch (fieldNo) {
38863
+ case 1:
38864
+ message.path = reader.string();
38865
+ break;
38866
+ case 2:
38867
+ message.parentPath = reader.string();
38868
+ break;
38869
+ case 3:
38870
+ message.entries.push(BotFilesystemEntry.internalBinaryRead(reader, reader.uint32(), options));
38871
+ break;
38872
+ case 4:
38873
+ message.nextAfter = reader.string();
38874
+ break;
38875
+ default:
38876
+ let u = options.readUnknownField;
38877
+ if (u === "throw")
38878
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
38879
+ let d = reader.skip(wireType);
38880
+ if (u !== false)
38881
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
38882
+ }
38883
+ }
38884
+ return message;
38885
+ }
38886
+ internalBinaryWrite(message, writer, options) {
38887
+ if (message.path !== "")
38888
+ writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.path);
38889
+ if (message.parentPath !== undefined)
38890
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.parentPath);
38891
+ for (let i = 0;i < message.entries.length; i++)
38892
+ BotFilesystemEntry.internalBinaryWrite(message.entries[i], writer.tag(3, import_runtime.WireType.LengthDelimited).fork(), options).join();
38893
+ if (message.nextAfter !== undefined)
38894
+ writer.tag(4, import_runtime.WireType.LengthDelimited).string(message.nextAfter);
38895
+ let u = options.writeUnknownFields;
38896
+ if (u !== false)
38897
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
38898
+ return writer;
38899
+ }
38900
+ }
38901
+ var BotFilesystemListing = new BotFilesystemListing$Type;
38902
+
38903
+ class BotFilesystemResponse$Type extends import_runtime4.MessageType {
38904
+ constructor() {
38905
+ super("BotFilesystemResponse", [
38906
+ { no: 1, name: "listing", kind: "message", oneof: "result", T: () => BotFilesystemListing },
38907
+ { no: 2, name: "workspace_id", kind: "scalar", oneof: "result", T: 9 },
38908
+ { no: 3, name: "problem", kind: "scalar", oneof: "result", T: 9 }
38909
+ ]);
38910
+ }
38911
+ create(value) {
38912
+ const message = globalThis.Object.create(this.messagePrototype);
38913
+ message.result = { oneofKind: undefined };
38914
+ if (value !== undefined)
38915
+ import_runtime3.reflectionMergePartial(this, message, value);
38916
+ return message;
38917
+ }
38918
+ internalBinaryRead(reader, length, options, target) {
38919
+ let message = target ?? this.create(), end = reader.pos + length;
38920
+ while (reader.pos < end) {
38921
+ let [fieldNo, wireType] = reader.tag();
38922
+ switch (fieldNo) {
38923
+ case 1:
38924
+ message.result = {
38925
+ oneofKind: "listing",
38926
+ listing: BotFilesystemListing.internalBinaryRead(reader, reader.uint32(), options, message.result.listing)
38927
+ };
38928
+ break;
38929
+ case 2:
38930
+ message.result = {
38931
+ oneofKind: "workspaceId",
38932
+ workspaceId: reader.string()
38933
+ };
38934
+ break;
38935
+ case 3:
38936
+ message.result = {
38937
+ oneofKind: "problem",
38938
+ problem: reader.string()
38939
+ };
38940
+ break;
38941
+ default:
38942
+ let u = options.readUnknownField;
38943
+ if (u === "throw")
38944
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
38945
+ let d = reader.skip(wireType);
38946
+ if (u !== false)
38947
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
38948
+ }
38949
+ }
38950
+ return message;
38951
+ }
38952
+ internalBinaryWrite(message, writer, options) {
38953
+ if (message.result.oneofKind === "listing")
38954
+ BotFilesystemListing.internalBinaryWrite(message.result.listing, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
38955
+ if (message.result.oneofKind === "workspaceId")
38956
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.result.workspaceId);
38957
+ if (message.result.oneofKind === "problem")
38958
+ writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.result.problem);
38959
+ let u = options.writeUnknownFields;
38960
+ if (u !== false)
38961
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
38962
+ return writer;
38963
+ }
38964
+ }
38965
+ var BotFilesystemResponse = new BotFilesystemResponse$Type;
38966
+
38967
+ class RequestBotFilesystemResult$Type extends import_runtime4.MessageType {
38968
+ constructor() {
38969
+ super("RequestBotFilesystemResult", [
38970
+ { no: 1, name: "response", kind: "message", T: () => BotFilesystemResponse }
38971
+ ]);
38972
+ }
38973
+ create(value) {
38974
+ const message = globalThis.Object.create(this.messagePrototype);
38975
+ if (value !== undefined)
38976
+ import_runtime3.reflectionMergePartial(this, message, value);
38977
+ return message;
38978
+ }
38979
+ internalBinaryRead(reader, length, options, target) {
38980
+ let message = target ?? this.create(), end = reader.pos + length;
38981
+ while (reader.pos < end) {
38982
+ let [fieldNo, wireType] = reader.tag();
38983
+ switch (fieldNo) {
38984
+ case 1:
38985
+ message.response = BotFilesystemResponse.internalBinaryRead(reader, reader.uint32(), options, message.response);
38986
+ break;
38987
+ default:
38988
+ let u = options.readUnknownField;
38989
+ if (u === "throw")
38990
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
38991
+ let d = reader.skip(wireType);
38992
+ if (u !== false)
38993
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
38994
+ }
38995
+ }
38996
+ return message;
38997
+ }
38998
+ internalBinaryWrite(message, writer, options) {
38999
+ if (message.response)
39000
+ BotFilesystemResponse.internalBinaryWrite(message.response, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
39001
+ let u = options.writeUnknownFields;
39002
+ if (u !== false)
39003
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
39004
+ return writer;
39005
+ }
39006
+ }
39007
+ var RequestBotFilesystemResult = new RequestBotFilesystemResult$Type;
39008
+
39009
+ class BotFilesystemRequested$Type extends import_runtime4.MessageType {
39010
+ constructor() {
39011
+ super("BotFilesystemRequested", [
39012
+ { no: 1, name: "request_id", kind: "scalar", T: 4, L: 0 },
39013
+ { no: 2, name: "actor_user_id", kind: "scalar", T: 3, L: 0 },
39014
+ { no: 3, name: "chat_id", kind: "scalar", T: 3, L: 0 },
39015
+ { no: 4, name: "input", kind: "message", T: () => RequestBotFilesystemInput }
39016
+ ]);
39017
+ }
39018
+ create(value) {
39019
+ const message = globalThis.Object.create(this.messagePrototype);
39020
+ message.requestId = 0n;
39021
+ message.actorUserId = 0n;
39022
+ message.chatId = 0n;
39023
+ if (value !== undefined)
39024
+ import_runtime3.reflectionMergePartial(this, message, value);
39025
+ return message;
39026
+ }
39027
+ internalBinaryRead(reader, length, options, target) {
39028
+ let message = target ?? this.create(), end = reader.pos + length;
39029
+ while (reader.pos < end) {
39030
+ let [fieldNo, wireType] = reader.tag();
39031
+ switch (fieldNo) {
39032
+ case 1:
39033
+ message.requestId = reader.uint64().toBigInt();
39034
+ break;
39035
+ case 2:
39036
+ message.actorUserId = reader.int64().toBigInt();
39037
+ break;
39038
+ case 3:
39039
+ message.chatId = reader.int64().toBigInt();
39040
+ break;
39041
+ case 4:
39042
+ message.input = RequestBotFilesystemInput.internalBinaryRead(reader, reader.uint32(), options, message.input);
39043
+ break;
39044
+ default:
39045
+ let u = options.readUnknownField;
39046
+ if (u === "throw")
39047
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
39048
+ let d = reader.skip(wireType);
39049
+ if (u !== false)
39050
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
39051
+ }
39052
+ }
39053
+ return message;
39054
+ }
39055
+ internalBinaryWrite(message, writer, options) {
39056
+ if (message.requestId !== 0n)
39057
+ writer.tag(1, import_runtime.WireType.Varint).uint64(message.requestId);
39058
+ if (message.actorUserId !== 0n)
39059
+ writer.tag(2, import_runtime.WireType.Varint).int64(message.actorUserId);
39060
+ if (message.chatId !== 0n)
39061
+ writer.tag(3, import_runtime.WireType.Varint).int64(message.chatId);
39062
+ if (message.input)
39063
+ RequestBotFilesystemInput.internalBinaryWrite(message.input, writer.tag(4, import_runtime.WireType.LengthDelimited).fork(), options).join();
39064
+ let u = options.writeUnknownFields;
39065
+ if (u !== false)
39066
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
39067
+ return writer;
39068
+ }
39069
+ }
39070
+ var BotFilesystemRequested = new BotFilesystemRequested$Type;
39071
+
39072
+ class AnswerBotFilesystemInput$Type extends import_runtime4.MessageType {
39073
+ constructor() {
39074
+ super("AnswerBotFilesystemInput", [
39075
+ { no: 1, name: "request_id", kind: "scalar", T: 4, L: 0 },
39076
+ { no: 2, name: "response", kind: "message", T: () => BotFilesystemResponse }
39077
+ ]);
39078
+ }
39079
+ create(value) {
39080
+ const message = globalThis.Object.create(this.messagePrototype);
39081
+ message.requestId = 0n;
39082
+ if (value !== undefined)
39083
+ import_runtime3.reflectionMergePartial(this, message, value);
39084
+ return message;
39085
+ }
39086
+ internalBinaryRead(reader, length, options, target) {
39087
+ let message = target ?? this.create(), end = reader.pos + length;
39088
+ while (reader.pos < end) {
39089
+ let [fieldNo, wireType] = reader.tag();
39090
+ switch (fieldNo) {
39091
+ case 1:
39092
+ message.requestId = reader.uint64().toBigInt();
39093
+ break;
39094
+ case 2:
39095
+ message.response = BotFilesystemResponse.internalBinaryRead(reader, reader.uint32(), options, message.response);
39096
+ break;
39097
+ default:
39098
+ let u = options.readUnknownField;
39099
+ if (u === "throw")
39100
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
39101
+ let d = reader.skip(wireType);
39102
+ if (u !== false)
39103
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
39104
+ }
39105
+ }
39106
+ return message;
39107
+ }
39108
+ internalBinaryWrite(message, writer, options) {
39109
+ if (message.requestId !== 0n)
39110
+ writer.tag(1, import_runtime.WireType.Varint).uint64(message.requestId);
39111
+ if (message.response)
39112
+ BotFilesystemResponse.internalBinaryWrite(message.response, writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
39113
+ let u = options.writeUnknownFields;
39114
+ if (u !== false)
39115
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
39116
+ return writer;
39117
+ }
39118
+ }
39119
+ var AnswerBotFilesystemInput = new AnswerBotFilesystemInput$Type;
39120
+
39121
+ class AnswerBotFilesystemResult$Type extends import_runtime4.MessageType {
39122
+ constructor() {
39123
+ super("AnswerBotFilesystemResult", []);
39124
+ }
39125
+ create(value) {
39126
+ const message = globalThis.Object.create(this.messagePrototype);
39127
+ if (value !== undefined)
39128
+ import_runtime3.reflectionMergePartial(this, message, value);
39129
+ return message;
39130
+ }
39131
+ internalBinaryRead(reader, length, options, target) {
39132
+ return target ?? this.create();
39133
+ }
39134
+ internalBinaryWrite(message, writer, options) {
39135
+ let u = options.writeUnknownFields;
39136
+ if (u !== false)
39137
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
39138
+ return writer;
39139
+ }
39140
+ }
39141
+ var AnswerBotFilesystemResult = new AnswerBotFilesystemResult$Type;
39142
+
38322
39143
  // ../node_modules/.bun/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/utils.js
38323
39144
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
38324
39145
  function isBytes(a) {
@@ -39097,6 +39918,13 @@ var asInlineId = (value, fieldName = "id") => {
39097
39918
  };
39098
39919
 
39099
39920
  // ../sdk/dist/utils/async-channel.js
39921
+ class ChannelConsumerError extends Error {
39922
+ constructor(message) {
39923
+ super(message);
39924
+ this.name = "ChannelConsumerError";
39925
+ }
39926
+ }
39927
+
39100
39928
  class AsyncChannelOverflowError extends Error {
39101
39929
  capacity;
39102
39930
  constructor(capacity) {
@@ -39206,6 +40034,7 @@ class AcknowledgedAsyncChannel {
39206
40034
  closed = false;
39207
40035
  failure = null;
39208
40036
  iteratorClaimed = false;
40037
+ consumption = null;
39209
40038
  constructor(capacity, byteLimit) {
39210
40039
  this.capacity = capacity;
39211
40040
  this.byteLimit = byteLimit;
@@ -39219,7 +40048,7 @@ class AcknowledgedAsyncChannel {
39219
40048
  send(value) {
39220
40049
  if (this.closed)
39221
40050
  return Promise.resolve(false);
39222
- if (!this.waiter && this.queue.length >= this.capacity) {
40051
+ if (!this.waiter && this.queue.length + (this.consumption?.active.size ?? 0) >= this.capacity) {
39223
40052
  throw new AsyncChannelOverflowError(this.capacity);
39224
40053
  }
39225
40054
  const bytes = this.byteLimit?.byteLength(value) ?? 0;
@@ -39239,6 +40068,7 @@ class AcknowledgedAsyncChannel {
39239
40068
  waiter.resolve({ value, done: false });
39240
40069
  } else {
39241
40070
  this.queue.push(item);
40071
+ this.pumpConsumption();
39242
40072
  }
39243
40073
  });
39244
40074
  }
@@ -39253,6 +40083,16 @@ class AcknowledgedAsyncChannel {
39253
40083
  return;
39254
40084
  this.closed = true;
39255
40085
  this.failure = error;
40086
+ const consumption = this.consumption;
40087
+ this.consumption = null;
40088
+ if (consumption) {
40089
+ for (const item of consumption.active.keys())
40090
+ item.acknowledge(false);
40091
+ if (error)
40092
+ consumption.reject(error);
40093
+ else
40094
+ consumption.resolve();
40095
+ }
39256
40096
  this.active?.acknowledge(false);
39257
40097
  this.active = null;
39258
40098
  for (const item of this.queue)
@@ -39268,6 +40108,65 @@ class AcknowledgedAsyncChannel {
39268
40108
  else
39269
40109
  waiter.resolve({ value: undefined, done: true });
39270
40110
  }
40111
+ consume(handler, key, concurrency = 8) {
40112
+ if (this.iteratorClaimed)
40113
+ return Promise.reject(new ChannelConsumerError("AcknowledgedAsyncChannel supports one consumer"));
40114
+ if (!Number.isSafeInteger(concurrency) || concurrency < 1) {
40115
+ return Promise.reject(new ChannelConsumerError("Consumer concurrency must be a positive safe integer"));
40116
+ }
40117
+ if (this.closed)
40118
+ return this.failure ? Promise.reject(this.failure) : Promise.resolve();
40119
+ this.iteratorClaimed = true;
40120
+ return new Promise((resolve, reject) => {
40121
+ this.consumption = { handler, key, concurrency, active: new Map, resolve, reject };
40122
+ this.pumpConsumption();
40123
+ });
40124
+ }
40125
+ pumpConsumption() {
40126
+ const owner = this.consumption;
40127
+ if (!owner || this.closed)
40128
+ return;
40129
+ try {
40130
+ while (owner.active.size < owner.concurrency && this.queue.length > 0) {
40131
+ if ([...owner.active.values()].includes(null))
40132
+ return;
40133
+ const keys = new Set(owner.active.values());
40134
+ let index = -1;
40135
+ let key = null;
40136
+ for (let i = 0;i < this.queue.length; i++) {
40137
+ const candidate = this.queue[i];
40138
+ const candidateKey = owner.key(candidate.value);
40139
+ if (candidateKey === null) {
40140
+ if (i === 0 && owner.active.size === 0)
40141
+ index = i;
40142
+ break;
40143
+ }
40144
+ if (!keys.has(candidateKey)) {
40145
+ index = i;
40146
+ key = candidateKey;
40147
+ break;
40148
+ }
40149
+ }
40150
+ if (index < 0)
40151
+ return;
40152
+ const item = this.queue.splice(index, 1)[0];
40153
+ owner.active.set(item, key);
40154
+ Promise.resolve().then(() => owner.handler(item.value)).then(() => {
40155
+ if (this.consumption !== owner)
40156
+ return;
40157
+ owner.active.delete(item);
40158
+ this.bufferedBytes -= item.bytes;
40159
+ item.acknowledge(true);
40160
+ this.pumpConsumption();
40161
+ }, (error) => {
40162
+ if (this.consumption === owner)
40163
+ this.fail(error instanceof Error ? error : new Error("Inbound handler failed"));
40164
+ });
40165
+ }
40166
+ } catch (error) {
40167
+ this.fail(error instanceof Error ? error : new Error("Inbound routing failed"));
40168
+ }
40169
+ }
39271
40170
  [Symbol.asyncIterator]() {
39272
40171
  if (this.iteratorClaimed) {
39273
40172
  return {
@@ -39275,8 +40174,11 @@ class AcknowledgedAsyncChannel {
39275
40174
  };
39276
40175
  }
39277
40176
  this.iteratorClaimed = true;
40177
+ let returned = false;
39278
40178
  return {
39279
40179
  next: () => {
40180
+ if (returned)
40181
+ return Promise.resolve({ value: undefined, done: true });
39280
40182
  if (this.active) {
39281
40183
  this.bufferedBytes -= this.active.bytes;
39282
40184
  this.active.acknowledge(true);
@@ -39300,6 +40202,11 @@ class AcknowledgedAsyncChannel {
39300
40202
  });
39301
40203
  },
39302
40204
  return: () => {
40205
+ if (returned)
40206
+ return Promise.resolve({ value: undefined, done: true });
40207
+ returned = true;
40208
+ this.waiter?.resolve({ value: undefined, done: true });
40209
+ this.waiter = null;
39303
40210
  if (this.active) {
39304
40211
  this.bufferedBytes -= this.active.bytes;
39305
40212
  this.active.acknowledge(false);
@@ -39978,10 +40885,12 @@ var normalizeRpcTimeoutMs = (timeoutMs, fallback) => {
39978
40885
 
39979
40886
  class ProtocolClientError extends Error {
39980
40887
  code;
40888
+ rpcCode;
39981
40889
  constructor(code, details) {
39982
40890
  super(details?.message ?? code);
39983
40891
  this.code = code;
39984
40892
  this.name = `ProtocolClientError:${code}`;
40893
+ this.rpcCode = details?.code;
39985
40894
  }
39986
40895
  }
39987
40896
  var commitOutcomeUnknownError = (message) => new ProtocolClientError("commit-outcome-unknown", { message });
@@ -44804,8 +45713,11 @@ class InlineSdkClient {
44804
45713
  peerResolutionRequestedByChatId = new Map;
44805
45714
  recoveryReconnectInFlight = null;
44806
45715
  degradedUpdateBuckets = new Map;
45716
+ discoveryRetry = null;
45717
+ recoveryRetries = new Map;
44807
45718
  liveCursorFences = new Set;
44808
45719
  liveAdmittedSeqByBucket = new Map;
45720
+ liveDeliveriesByBucket = new Map;
44809
45721
  discoveryRound = null;
44810
45722
  discoveryInFlight = null;
44811
45723
  discoveryCommitInFlight = null;
@@ -44898,12 +45810,14 @@ class InlineSdkClient {
44898
45810
  }
44899
45811
  }
44900
45812
  async close() {
44901
- if (!this.started)
44902
- return;
45813
+ const wasStarted = this.started;
44903
45814
  this.closed = true;
44904
45815
  this.started = false;
45816
+ this.cancelRecoveryRetries();
44905
45817
  this.rejectOpen(new Error("closed"));
44906
45818
  this.eventStream.close();
45819
+ if (!wasStarted)
45820
+ return;
44907
45821
  await settleWithin(this.protocol.stopTransport(), closeJoinTimeoutMs, () => this.log.warn?.("Timed out stopping SDK transport during close"));
44908
45822
  await settleWithin(Promise.allSettled([
44909
45823
  ...this.catchUpInFlightByChatId.values(),
@@ -44965,6 +45879,20 @@ class InlineSdkClient {
44965
45879
  events() {
44966
45880
  return this.eventStream;
44967
45881
  }
45882
+ consumeEvents(handler, options) {
45883
+ return this.eventStream.consume(handler, (event) => {
45884
+ const bucket = this.bucketForEvent(event);
45885
+ if (bucket?.kind === "user")
45886
+ return null;
45887
+ if (bucket)
45888
+ return this.updateBucketKey(bucket);
45889
+ return "chatId" in event && typeof event.chatId === "bigint" ? `chat:${event.chatId}` : null;
45890
+ }, options?.concurrency).catch(async (error) => {
45891
+ if (!(error instanceof ChannelConsumerError))
45892
+ await this.close();
45893
+ throw error;
45894
+ });
45895
+ }
44968
45896
  exportState() {
44969
45897
  return {
44970
45898
  version: 1,
@@ -45374,6 +46302,7 @@ class InlineSdkClient {
45374
46302
  this.log.error?.("SDK listener crashed", failure);
45375
46303
  this.started = false;
45376
46304
  this.closed = true;
46305
+ this.cancelRecoveryRetries();
45377
46306
  this.rejectOpen(failure);
45378
46307
  this.eventStream.fail(failure);
45379
46308
  this.protocol.stopTransport().catch((stopError) => {
@@ -45386,6 +46315,7 @@ class InlineSdkClient {
45386
46315
  return;
45387
46316
  this.authenticationError = error;
45388
46317
  this.started = false;
46318
+ this.cancelRecoveryRetries();
45389
46319
  this.rejectOpen(error);
45390
46320
  this.eventStream.close();
45391
46321
  try {
@@ -45395,6 +46325,7 @@ class InlineSdkClient {
45395
46325
  }
45396
46326
  }
45397
46327
  async onOpen() {
46328
+ this.cancelRecoveryRetries();
45398
46329
  this.requestCatchUpUser();
45399
46330
  for (const bucket of this.degradedUpdateBuckets.values()) {
45400
46331
  this.requestCatchUpForDegradedBucket(bucket);
@@ -45445,6 +46376,8 @@ class InlineSdkClient {
45445
46376
  return this.discoveryInFlight;
45446
46377
  if (this.discoveryCommitInFlight)
45447
46378
  return this.discoveryCommitInFlight;
46379
+ if (this.discoveryRetry?.timer)
46380
+ return;
45448
46381
  const round = {
45449
46382
  resultReceived: false,
45450
46383
  collectingHints: true,
@@ -45477,6 +46410,11 @@ class InlineSdkClient {
45477
46410
  this.log.warn?.("GET_UPDATES_STATE failed (continuing without date cursor)", error);
45478
46411
  if (this.discoveryRound === round)
45479
46412
  this.discoveryRound = null;
46413
+ if (error instanceof ProtocolClientError && (error.code === "timeout" || error.code === "not-connected" || error.code === "capacity-exceeded" || error.rpcCode === RpcError_Code.INTERNAL_ERROR || error.rpcCode === 500 || error.rpcCode === RpcError_Code.RATE_LIMIT || error.rpcCode === 429)) {
46414
+ this.scheduleDiscoveryRetry(error.rpcCode === RpcError_Code.RATE_LIMIT || error.rpcCode === 429 ? "rate_limited" : "discovery_failed");
46415
+ } else {
46416
+ this.log.error?.("Sync discovery unavailable", { reason: "request_rejected" });
46417
+ }
45480
46418
  }
45481
46419
  }
45482
46420
  tryCommitDiscoveryRound(round) {
@@ -45501,12 +46439,15 @@ class InlineSdkClient {
45501
46439
  return;
45502
46440
  if (saved) {
45503
46441
  this.discoveryRound = null;
46442
+ clearTimeout(this.discoveryRetry?.timer);
46443
+ this.discoveryRetry = null;
45504
46444
  return;
45505
46445
  }
45506
46446
  this.state.dateCursor = previousDateCursor;
45507
46447
  this.scheduleStateSave();
45508
46448
  this.discoveryRound = null;
45509
46449
  this.log.warn?.("Failed to persist discovery checkpoint; preserving previous date cursor");
46450
+ this.scheduleDiscoveryRetry("checkpoint_write_failed");
45510
46451
  }).finally(() => {
45511
46452
  if (this.discoveryCommitInFlight === commit)
45512
46453
  this.discoveryCommitInFlight = null;
@@ -45841,20 +46782,23 @@ class InlineSdkClient {
45841
46782
  try {
45842
46783
  acknowledged = this.eventStream.send(event);
45843
46784
  } catch (error) {
45844
- const bucket = this.bucketForEvent(event);
45845
- if (bucket) {
45846
- this.fenceLiveCursor(bucket);
45847
- this.markUpdateBucketDegraded(bucket);
45848
- this.requestCatchUpAfterEventOverflow(bucket, event);
46785
+ const bucket2 = this.bucketForEvent(event);
46786
+ if (bucket2) {
46787
+ this.fenceLiveCursor(bucket2);
46788
+ this.markUpdateBucketDegraded(bucket2);
46789
+ this.requestCatchUpAfterEventOverflow(bucket2, event);
45849
46790
  }
45850
46791
  this.log.warn?.("Inbound event buffer overflow; durable cursor remains unchanged and transport will recover", {
45851
- bucket: bucket ? this.updateBucketKey(bucket) : "none",
46792
+ bucket: bucket2 ? this.updateBucketKey(bucket2) : "none",
45852
46793
  error: extractErrorMessage(error)
45853
46794
  });
45854
46795
  this.requestRecoveryReconnect("inbound-event-buffer-overflow");
45855
46796
  return Promise.resolve(false);
45856
46797
  }
45857
- return acknowledged.then((applied) => {
46798
+ const bucket = source === "live" ? this.sequencedBucketForEvent(event) : undefined;
46799
+ const key = bucket ? this.updateBucketKey(bucket) : undefined;
46800
+ const deliveries = key ? this.liveDeliveriesByBucket.get(key) ?? new Set : undefined;
46801
+ const delivery = acknowledged.then((applied) => {
45858
46802
  if (applied) {
45859
46803
  onApplied?.();
45860
46804
  if (source === "live")
@@ -45862,8 +46806,16 @@ class InlineSdkClient {
45862
46806
  } else if (source === "live" && this.started) {
45863
46807
  this.recoverLiveEvent(event, "consumer-did-not-apply");
45864
46808
  }
46809
+ deliveries?.delete(delivery);
46810
+ if (key && deliveries?.size === 0)
46811
+ this.liveDeliveriesByBucket.delete(key);
45865
46812
  return applied;
45866
46813
  });
46814
+ if (key && deliveries) {
46815
+ deliveries.add(delivery);
46816
+ this.liveDeliveriesByBucket.set(key, deliveries);
46817
+ }
46818
+ return delivery;
45867
46819
  }
45868
46820
  bucketForEvent(event) {
45869
46821
  switch (event.kind) {
@@ -46041,20 +46993,25 @@ class InlineSdkClient {
46041
46993
  }
46042
46994
  requestCatchUpForDegradedBucket(bucket) {
46043
46995
  switch (bucket.kind) {
46044
- case "chat":
46045
- if (bucket.peer && this.isReliableChatPeer(bucket.peer)) {
46046
- this.requestCatchUpChat({ chatId: bucket.chatId, peer: bucket.peer });
46996
+ case "chat": {
46997
+ const request = this.catchUpRequestedByChatId.get(bucket.chatId) ?? this.peerResolutionRequestedByChatId.get(bucket.chatId);
46998
+ const updateSeq = request && !request.toLatest ? request.endSeq : undefined;
46999
+ const peer = bucket.peer ?? this.persistedChatPeer(bucket.chatId);
47000
+ if (peer && this.isReliableChatPeer(peer)) {
47001
+ this.requestCatchUpChat({ chatId: bucket.chatId, peer, updateSeq });
46047
47002
  } else {
46048
- const persistedPeer = this.persistedChatPeer(bucket.chatId);
46049
- if (persistedPeer)
46050
- this.requestCatchUpChat({ chatId: bucket.chatId, peer: persistedPeer });
46051
- else
46052
- this.resolvePersistedChatPeer(bucket.chatId);
47003
+ this.resolvePersistedChatPeer(bucket.chatId, updateSeq);
46053
47004
  }
46054
47005
  return;
46055
- case "space":
46056
- this.requestCatchUpSpace({ spaceId: bucket.spaceId });
47006
+ }
47007
+ case "space": {
47008
+ const request = this.catchUpRequestedBySpaceId.get(bucket.spaceId);
47009
+ this.requestCatchUpSpace({
47010
+ spaceId: bucket.spaceId,
47011
+ updateSeq: request && !request.toLatest ? request.endSeq : undefined
47012
+ });
46057
47013
  return;
47014
+ }
46058
47015
  case "user":
46059
47016
  this.requestCatchUpUser(true);
46060
47017
  return;
@@ -46239,7 +47196,7 @@ class InlineSdkClient {
46239
47196
  bumpChatSeq(chatId, seq, source) {
46240
47197
  if (source === "user" || source === "space" || source === "chat")
46241
47198
  return;
46242
- if (source === "live" && this.liveCursorFences.has(`chat:${chatId}`))
47199
+ if (source === "live" && this.liveCursorFences.has(`chat:${chatId}`) && seq !== (this.state.lastSeqByChatId?.[chatId.toString()] ?? 0) + 1)
46243
47200
  return;
46244
47201
  if (!Number.isFinite(seq))
46245
47202
  return;
@@ -46248,6 +47205,7 @@ class InlineSdkClient {
46248
47205
  const key = chatId.toString();
46249
47206
  const prev = this.state.lastSeqByChatId[key] ?? 0;
46250
47207
  if (seq > prev) {
47208
+ this.resetRecoveryBackoff({ kind: "chat", chatId });
46251
47209
  this.state.lastSeqByChatId[key] = seq;
46252
47210
  this.scheduleStateSave();
46253
47211
  }
@@ -46256,7 +47214,7 @@ class InlineSdkClient {
46256
47214
  bumpSpaceSeq(spaceId, seq, source) {
46257
47215
  if (source === "user" || source === "space" || source === "chat")
46258
47216
  return;
46259
- if (source === "live" && this.liveCursorFences.has(`space:${spaceId}`))
47217
+ if (source === "live" && this.liveCursorFences.has(`space:${spaceId}`) && seq !== (this.state.lastSeqBySpaceId?.[spaceId.toString()] ?? 0) + 1)
46260
47218
  return;
46261
47219
  if (!Number.isFinite(seq))
46262
47220
  return;
@@ -46265,6 +47223,7 @@ class InlineSdkClient {
46265
47223
  const key = spaceId.toString();
46266
47224
  const prev = this.state.lastSeqBySpaceId[key] ?? 0;
46267
47225
  if (seq > prev) {
47226
+ this.resetRecoveryBackoff({ kind: "space", spaceId });
46268
47227
  this.state.lastSeqBySpaceId[key] = seq;
46269
47228
  this.scheduleStateSave();
46270
47229
  }
@@ -46279,12 +47238,13 @@ class InlineSdkClient {
46279
47238
  bumpUserSeq(seq, source) {
46280
47239
  if (source === "user" || source === "space" || source === "chat")
46281
47240
  return;
46282
- if (source === "live" && this.liveCursorFences.has("user"))
47241
+ if (source === "live" && this.liveCursorFences.has("user") && seq !== (this.state.lastUserSeq ?? 0) + 1)
46283
47242
  return;
46284
47243
  if (!Number.isFinite(seq) || seq <= 0)
46285
47244
  return;
46286
47245
  const prev = this.state.lastUserSeq ?? 0;
46287
47246
  if (seq > prev) {
47247
+ this.resetRecoveryBackoff({ kind: "user" });
46288
47248
  this.state.lastUserSeq = seq;
46289
47249
  this.scheduleStateSave();
46290
47250
  }
@@ -46298,14 +47258,17 @@ class InlineSdkClient {
46298
47258
  if (this.userCatchUpInFlight) {
46299
47259
  return this.userCatchUpInFlight;
46300
47260
  }
47261
+ if (this.recoveryRetries.get("user")?.timer)
47262
+ return null;
46301
47263
  this.fenceLiveCursor({ kind: "user" });
46302
47264
  this.userCatchUpInFlight = this.doCatchUpUser(lastUserSeq ?? 0).catch((error) => {
46303
- this.markUpdateBucketDegraded({ kind: "user" });
47265
+ this.recordCatchUpFailure({ kind: "user" }, error);
46304
47266
  this.log.warn?.("GET_UPDATES user catch-up failed; bucket remains degraded", {
46305
47267
  error: extractErrorMessage(error)
46306
47268
  });
46307
47269
  }).finally(() => {
46308
47270
  this.userCatchUpInFlight = null;
47271
+ this.scheduleRecoveryRetry({ kind: "user" });
46309
47272
  });
46310
47273
  return this.userCatchUpInFlight;
46311
47274
  }
@@ -46358,7 +47321,7 @@ class InlineSdkClient {
46358
47321
  });
46359
47322
  }
46360
47323
  if (deliveredSeq <= cursor && !payload.final) {
46361
- this.markUpdateBucketDegraded({ kind: "user" });
47324
+ this.markUpdateBucketDegraded({ kind: "user" }, "non_progress");
46362
47325
  this.log.warn?.("GET_UPDATES user catch-up made no progress; bucket remains degraded", {
46363
47326
  cursor,
46364
47327
  deliveredSeq
@@ -46394,15 +47357,18 @@ class InlineSdkClient {
46394
47357
  const existing = this.catchUpInFlightByChatId.get(params.chatId);
46395
47358
  if (existing)
46396
47359
  return existing;
47360
+ if (this.recoveryRetries.get(`chat:${params.chatId}`)?.timer)
47361
+ return Promise.resolve();
47362
+ const initialDemand = this.catchUpRequestedByChatId.get(params.chatId);
46397
47363
  const task = this.drainCatchUpChat(params.chatId).catch((error) => {
46398
- this.catchUpRequestedByChatId.delete(params.chatId);
46399
- this.markUpdateBucketDegraded({ kind: "chat", chatId: params.chatId, peer: params.peer });
47364
+ this.recordCatchUpFailure({ kind: "chat", chatId: params.chatId, peer: params.peer }, error, this.catchUpRequestedByChatId.get(params.chatId) !== initialDemand);
46400
47365
  this.log.warn?.("GET_UPDATES chat catch-up failed; bucket remains degraded", {
46401
47366
  chatId: params.chatId.toString(),
46402
47367
  error: extractErrorMessage(error)
46403
47368
  });
46404
47369
  }).finally(() => {
46405
47370
  this.catchUpInFlightByChatId.delete(params.chatId);
47371
+ this.scheduleRecoveryRetry({ kind: "chat", chatId: params.chatId });
46406
47372
  });
46407
47373
  this.catchUpInFlightByChatId.set(params.chatId, task);
46408
47374
  return task;
@@ -46426,12 +47392,8 @@ class InlineSdkClient {
46426
47392
  if (stop) {
46427
47393
  if (this.catchUpRequestedByChatId.get(chatId) !== request)
46428
47394
  continue;
46429
- this.catchUpRequestedByChatId.delete(chatId);
46430
- return;
46431
- }
46432
- const latest = this.catchUpRequestedByChatId.get(chatId);
46433
- const syncedSeq = this.state.lastSeqByChatId?.[key] ?? 0;
46434
- if (!latest || latest.endSeq != null && latest.endSeq <= syncedSeq) {
47395
+ if (this.degradedUpdateBuckets.has(`chat:${chatId}`))
47396
+ return;
46435
47397
  this.catchUpRequestedByChatId.delete(chatId);
46436
47398
  return;
46437
47399
  }
@@ -46498,7 +47460,7 @@ class InlineSdkClient {
46498
47460
  });
46499
47461
  }
46500
47462
  if (deliveredSeq <= cursor && !payload.final) {
46501
- this.markUpdateBucketDegraded({ kind: "chat", chatId, peer });
47463
+ this.markUpdateBucketDegraded({ kind: "chat", chatId, peer }, "non_progress");
46502
47464
  this.log.warn?.("GET_UPDATES made no progress; bucket remains degraded", {
46503
47465
  chatId: chatId.toString(),
46504
47466
  cursor,
@@ -46516,7 +47478,7 @@ class InlineSdkClient {
46516
47478
  continue;
46517
47479
  }
46518
47480
  if (endSeq != null && deliveredSeq < endSeq) {
46519
- this.markUpdateBucketDegraded({ kind: "chat", chatId, peer });
47481
+ this.markUpdateBucketDegraded({ kind: "chat", chatId, peer }, "target_not_reached");
46520
47482
  this.log.warn?.("GET_UPDATES final chat page remained behind the requested target", {
46521
47483
  chatId: chatId.toString(),
46522
47484
  requestedEndSeq: endSeq,
@@ -46542,15 +47504,18 @@ class InlineSdkClient {
46542
47504
  const existing = this.catchUpInFlightBySpaceId.get(params.spaceId);
46543
47505
  if (existing)
46544
47506
  return existing;
47507
+ if (this.recoveryRetries.get(`space:${params.spaceId}`)?.timer)
47508
+ return Promise.resolve();
47509
+ const initialDemand = this.catchUpRequestedBySpaceId.get(params.spaceId);
46545
47510
  const task = this.drainCatchUpSpace(params.spaceId).catch((error) => {
46546
- this.catchUpRequestedBySpaceId.delete(params.spaceId);
46547
- this.markUpdateBucketDegraded({ kind: "space", spaceId: params.spaceId });
47511
+ this.recordCatchUpFailure({ kind: "space", spaceId: params.spaceId }, error, this.catchUpRequestedBySpaceId.get(params.spaceId) !== initialDemand);
46548
47512
  this.log.warn?.("GET_UPDATES space catch-up failed; bucket remains degraded", {
46549
47513
  spaceId: params.spaceId.toString(),
46550
47514
  error: extractErrorMessage(error)
46551
47515
  });
46552
47516
  }).finally(() => {
46553
47517
  this.catchUpInFlightBySpaceId.delete(params.spaceId);
47518
+ this.scheduleRecoveryRetry({ kind: "space", spaceId: params.spaceId });
46554
47519
  });
46555
47520
  this.catchUpInFlightBySpaceId.set(params.spaceId, task);
46556
47521
  return task;
@@ -46574,12 +47539,8 @@ class InlineSdkClient {
46574
47539
  if (stop) {
46575
47540
  if (this.catchUpRequestedBySpaceId.get(spaceId) !== request)
46576
47541
  continue;
46577
- this.catchUpRequestedBySpaceId.delete(spaceId);
46578
- return;
46579
- }
46580
- const latest = this.catchUpRequestedBySpaceId.get(spaceId);
46581
- const syncedSeq = this.state.lastSeqBySpaceId?.[key] ?? 0;
46582
- if (!latest || latest.endSeq != null && latest.endSeq <= syncedSeq) {
47542
+ if (this.degradedUpdateBuckets.has(`space:${spaceId}`))
47543
+ return;
46583
47544
  this.catchUpRequestedBySpaceId.delete(spaceId);
46584
47545
  return;
46585
47546
  }
@@ -46648,7 +47609,7 @@ class InlineSdkClient {
46648
47609
  });
46649
47610
  }
46650
47611
  if (deliveredSeq <= cursor && !payload.final) {
46651
- this.markUpdateBucketDegraded({ kind: "space", spaceId });
47612
+ this.markUpdateBucketDegraded({ kind: "space", spaceId }, "non_progress");
46652
47613
  this.log.warn?.("GET_UPDATES space made no progress; bucket remains degraded", {
46653
47614
  spaceId: spaceId.toString(),
46654
47615
  cursor,
@@ -46666,7 +47627,7 @@ class InlineSdkClient {
46666
47627
  continue;
46667
47628
  }
46668
47629
  if (endSeq != null && deliveredSeq < endSeq) {
46669
- this.markUpdateBucketDegraded({ kind: "space", spaceId });
47630
+ this.markUpdateBucketDegraded({ kind: "space", spaceId }, "target_not_reached");
46670
47631
  this.log.warn?.("GET_UPDATES final space page remained behind the requested target", {
46671
47632
  spaceId: spaceId.toString(),
46672
47633
  requestedEndSeq: endSeq,
@@ -46691,6 +47652,9 @@ class InlineSdkClient {
46691
47652
  const existing = this.peerResolutionInFlightByChatId.get(chatId);
46692
47653
  if (existing)
46693
47654
  return existing;
47655
+ if (this.recoveryRetries.get(`chat:${chatId}`)?.timer)
47656
+ return Promise.resolve();
47657
+ const initialDemand = this.peerResolutionRequestedByChatId.get(chatId);
46694
47658
  const task = this.getChat({ chatId }).then(async (chat) => {
46695
47659
  const peer = chat.peer;
46696
47660
  if (!peer || !this.isReliableChatPeer(peer)) {
@@ -46704,14 +47668,16 @@ class InlineSdkClient {
46704
47668
  ...requested && !requested.toLatest && requested.endSeq != null ? { updateSeq: requested.endSeq } : {}
46705
47669
  });
46706
47670
  }).catch((error) => {
46707
- this.markUpdateBucketDegraded({ kind: "chat", chatId });
47671
+ this.recordCatchUpFailure({ kind: "chat", chatId }, error, this.peerResolutionRequestedByChatId.get(chatId) !== initialDemand);
46708
47672
  this.log.warn?.("Unable to resolve legacy chat peer; bucket remains degraded", {
46709
47673
  chatId: chatId.toString(),
46710
47674
  error: extractErrorMessage(error)
46711
47675
  });
46712
47676
  }).finally(() => {
46713
47677
  this.peerResolutionInFlightByChatId.delete(chatId);
46714
- this.peerResolutionRequestedByChatId.delete(chatId);
47678
+ if (!this.degradedUpdateBuckets.has(`chat:${chatId}`))
47679
+ this.peerResolutionRequestedByChatId.delete(chatId);
47680
+ this.scheduleRecoveryRetry({ kind: "chat", chatId });
46715
47681
  });
46716
47682
  this.peerResolutionInFlightByChatId.set(chatId, task);
46717
47683
  return task;
@@ -46764,7 +47730,7 @@ class InlineSdkClient {
46764
47730
  }
46765
47731
  validateCatchUpPage(payload, startSeq, bucket) {
46766
47732
  if (payload.resultType !== GetUpdatesResult_ResultType.SLICE && payload.resultType !== GetUpdatesResult_ResultType.EMPTY) {
46767
- this.markUpdateBucketDegraded(bucket);
47733
+ this.markUpdateBucketDegraded(bucket, "invalid_page_type");
46768
47734
  this.log.warn?.("GET_UPDATES returned an invalid page result type; bucket remains degraded", {
46769
47735
  bucket: this.updateBucketKey(bucket),
46770
47736
  resultType: payload.resultType
@@ -46773,7 +47739,7 @@ class InlineSdkClient {
46773
47739
  }
46774
47740
  const deliveredSeq = Number(payload.seq);
46775
47741
  if (!Number.isSafeInteger(deliveredSeq) || deliveredSeq < startSeq) {
46776
- this.markUpdateBucketDegraded(bucket);
47742
+ this.markUpdateBucketDegraded(bucket, "invalid_page_cursor");
46777
47743
  this.log.warn?.("GET_UPDATES page moved backwards or returned an invalid seq; bucket remains degraded", {
46778
47744
  bucket: this.updateBucketKey(bucket),
46779
47745
  startSeq,
@@ -46785,7 +47751,7 @@ class InlineSdkClient {
46785
47751
  for (const update of payload.updates) {
46786
47752
  const seq = update.seq;
46787
47753
  if (!Number.isSafeInteger(seq) || seq == null || seq <= startSeq || seq > deliveredSeq || accounted.has(seq)) {
46788
- this.markUpdateBucketDegraded(bucket);
47754
+ this.markUpdateBucketDegraded(bucket, "invalid_update_sequence");
46789
47755
  this.log.warn?.("GET_UPDATES page included an invalid or duplicate update seq; bucket remains degraded", {
46790
47756
  bucket: this.updateBucketKey(bucket),
46791
47757
  seq
@@ -46798,7 +47764,7 @@ class InlineSdkClient {
46798
47764
  for (const skipped of payload.skippedSequences) {
46799
47765
  const seq = Number(skipped.seq);
46800
47766
  if (!Number.isSafeInteger(seq) || seq <= startSeq || seq > deliveredSeq || accounted.has(seq)) {
46801
- this.markUpdateBucketDegraded(bucket);
47767
+ this.markUpdateBucketDegraded(bucket, "invalid_skipped_sequence");
46802
47768
  this.log.warn?.("GET_UPDATES page included an invalid or duplicate skipped seq; bucket remains degraded", {
46803
47769
  bucket: this.updateBucketKey(bucket),
46804
47770
  seq
@@ -46814,7 +47780,7 @@ class InlineSdkClient {
46814
47780
  break;
46815
47781
  case SyncSkippedSequence_Reason.REASON_UNSPECIFIED:
46816
47782
  default:
46817
- this.markUpdateBucketDegraded(bucket);
47783
+ this.markUpdateBucketDegraded(bucket, "unknown_skip_reason");
46818
47784
  this.log.warn?.("GET_UPDATES page included an unsupported skipped-sequence reason; bucket remains degraded", {
46819
47785
  bucket: this.updateBucketKey(bucket),
46820
47786
  reason: skipped.reason
@@ -46823,7 +47789,7 @@ class InlineSdkClient {
46823
47789
  }
46824
47790
  }
46825
47791
  if (accounted.size !== deliveredSeq - startSeq) {
46826
- this.markUpdateBucketDegraded(bucket);
47792
+ this.markUpdateBucketDegraded(bucket, "unaccounted_gap");
46827
47793
  this.log.warn?.("GET_UPDATES page did not account for every advanced sequence; bucket remains degraded", {
46828
47794
  bucket: this.updateBucketKey(bucket),
46829
47795
  startSeq,
@@ -46905,7 +47871,7 @@ class InlineSdkClient {
46905
47871
  this.clearUpdateBucketDegraded(bucket);
46906
47872
  return true;
46907
47873
  } catch (error) {
46908
- this.markUpdateBucketDegraded(bucket);
47874
+ this.markUpdateBucketDegraded(bucket, "repair_failed");
46909
47875
  this.log.warn?.("Authoritative update repair failed; bucket remains degraded", {
46910
47876
  bucket: this.updateBucketKey(bucket),
46911
47877
  error: extractErrorMessage(error)
@@ -46914,7 +47880,17 @@ class InlineSdkClient {
46914
47880
  }
46915
47881
  }
46916
47882
  async acceptCatchUpUpdates(updates, source, bucket) {
47883
+ const liveDeliveries = this.liveDeliveriesByBucket.get(this.updateBucketKey(bucket));
47884
+ if (liveDeliveries && (await Promise.all(liveDeliveries)).some((applied) => !applied)) {
47885
+ this.markUpdateBucketDegraded(bucket, "host_unacknowledged");
47886
+ return false;
47887
+ }
47888
+ if (this.closed)
47889
+ return false;
47890
+ const appliedThrough = this.bucketCursor(bucket);
46917
47891
  for (const update of updates) {
47892
+ if (update.seq != null && update.seq > 0 && update.seq <= appliedThrough)
47893
+ continue;
46918
47894
  if (update.update.oneofKind === "chatSkipPts" && source === "chat") {
46919
47895
  continue;
46920
47896
  }
@@ -46925,7 +47901,7 @@ class InlineSdkClient {
46925
47901
  if (accepted === true)
46926
47902
  continue;
46927
47903
  if (accepted === false) {
46928
- this.markUpdateBucketDegraded(bucket);
47904
+ this.markUpdateBucketDegraded(bucket, "host_unacknowledged");
46929
47905
  this.log.warn?.("GET_UPDATES event was not acknowledged by the SDK host; cursor remains unchanged", {
46930
47906
  bucket: this.updateBucketKey(bucket),
46931
47907
  updateKind: update.update.oneofKind
@@ -46946,8 +47922,95 @@ class InlineSdkClient {
46946
47922
  }
46947
47923
  return true;
46948
47924
  }
46949
- markUpdateBucketDegraded(bucket) {
46950
- this.degradedUpdateBuckets.set(this.updateBucketKey(bucket), bucket);
47925
+ recordCatchUpFailure(bucket, error, hasNewerDemand = false) {
47926
+ const rpcCode = error instanceof ProtocolClientError ? error.rpcCode : undefined;
47927
+ if (!hasNewerDemand && bucket.kind !== "user" && (rpcCode === RpcError_Code.PEER_ID_INVALID || rpcCode === RpcError_Code.CHAT_ID_INVALID || rpcCode === RpcError_Code.SPACE_ID_INVALID)) {
47928
+ this.clearUpdateBucketDegraded(bucket);
47929
+ if (bucket.kind === "chat") {
47930
+ this.catchUpRequestedByChatId.delete(bucket.chatId);
47931
+ this.peerResolutionRequestedByChatId.delete(bucket.chatId);
47932
+ } else
47933
+ this.catchUpRequestedBySpaceId.delete(bucket.spaceId);
47934
+ const round = this.discoveryRound;
47935
+ if (round) {
47936
+ round.targets.delete(this.updateBucketKey(bucket));
47937
+ this.tryCommitDiscoveryRound(round);
47938
+ }
47939
+ this.log.error?.("Sync bucket unavailable", { bucketKind: bucket.kind, reason: "access_rejected" });
47940
+ return;
47941
+ }
47942
+ this.markUpdateBucketDegraded(bucket, rpcCode === RpcError_Code.RATE_LIMIT || rpcCode === 429 ? "rate_limited" : error instanceof ProtocolClientError ? error.code : "request_failed");
47943
+ }
47944
+ markUpdateBucketDegraded(bucket, failure = "incomplete") {
47945
+ const key = this.updateBucketKey(bucket);
47946
+ this.degradedUpdateBuckets.set(key, bucket);
47947
+ const retry = this.recoveryRetries.get(key) ?? { attempt: 0, failure, reported: new Set };
47948
+ retry.failure = failure;
47949
+ this.recoveryRetries.set(key, retry);
47950
+ queueMicrotask(() => this.scheduleRecoveryRetry(bucket));
47951
+ }
47952
+ resetRecoveryBackoff(bucket) {
47953
+ const retry = this.recoveryRetries.get(this.updateBucketKey(bucket));
47954
+ if (retry)
47955
+ retry.attempt = 0;
47956
+ }
47957
+ cancelRecoveryRetries() {
47958
+ clearTimeout(this.discoveryRetry?.timer);
47959
+ this.discoveryRetry = null;
47960
+ for (const retry of this.recoveryRetries.values())
47961
+ clearTimeout(retry.timer);
47962
+ this.recoveryRetries.clear();
47963
+ }
47964
+ scheduleDiscoveryRetry(reason) {
47965
+ if (!this.started || this.closed || this.protocol.getDiagnostics().state !== "open")
47966
+ return;
47967
+ const retry = this.discoveryRetry ?? { attempt: 0, reported: new Set };
47968
+ if (retry.timer)
47969
+ return;
47970
+ if (!retry.reported.has(reason)) {
47971
+ retry.reported.add(reason);
47972
+ this.log.error?.("Sync recovery scheduled", { bucketKind: "discovery", reason });
47973
+ }
47974
+ const delayMs = reason === "rate_limited" ? 60000 : Math.min(30000, 1000 * 2 ** Math.min(retry.attempt, 5));
47975
+ retry.attempt++;
47976
+ retry.timer = setTimeout(() => {
47977
+ retry.timer = undefined;
47978
+ if (this.started && !this.closed && this.protocol.getDiagnostics().state === "open") {
47979
+ this.initializeDateCursor();
47980
+ }
47981
+ }, delayMs);
47982
+ retry.timer.unref?.();
47983
+ this.discoveryRetry = retry;
47984
+ }
47985
+ scheduleRecoveryRetry(bucket) {
47986
+ const key = this.updateBucketKey(bucket);
47987
+ if (!this.started || this.closed || !this.degradedUpdateBuckets.has(key))
47988
+ return;
47989
+ if (bucket.kind === "chat" && (this.catchUpInFlightByChatId.has(bucket.chatId) || this.peerResolutionInFlightByChatId.has(bucket.chatId)))
47990
+ return;
47991
+ if (bucket.kind === "space" && this.catchUpInFlightBySpaceId.has(bucket.spaceId))
47992
+ return;
47993
+ if (bucket.kind === "user" && this.userCatchUpInFlight)
47994
+ return;
47995
+ const retry = this.recoveryRetries.get(key) ?? { attempt: 0, failure: "incomplete", reported: new Set };
47996
+ if (retry.timer || this.protocol.getDiagnostics().state !== "open")
47997
+ return;
47998
+ const delayMs = retry.failure === "rate_limited" ? 60000 : Math.min(5000, 1000 * 2 ** Math.min(retry.attempt, 3));
47999
+ if (!retry.reported.has(retry.failure)) {
48000
+ retry.reported.add(retry.failure);
48001
+ this.log.error?.("Sync recovery scheduled", { bucketKind: bucket.kind, reason: retry.failure });
48002
+ }
48003
+ retry.attempt++;
48004
+ retry.timer = setTimeout(() => {
48005
+ retry.timer = undefined;
48006
+ if (!this.started || this.closed || this.protocol.getDiagnostics().state !== "open")
48007
+ return;
48008
+ const pending = this.degradedUpdateBuckets.get(key);
48009
+ if (pending)
48010
+ this.requestCatchUpForDegradedBucket(pending);
48011
+ }, delayMs);
48012
+ retry.timer.unref?.();
48013
+ this.recoveryRetries.set(key, retry);
46951
48014
  }
46952
48015
  fenceLiveCursor(bucket) {
46953
48016
  this.liveCursorFences.add(this.updateBucketKey(bucket));
@@ -46955,6 +48018,8 @@ class InlineSdkClient {
46955
48018
  clearUpdateBucketDegraded(bucket) {
46956
48019
  const key = this.updateBucketKey(bucket);
46957
48020
  this.degradedUpdateBuckets.delete(key);
48021
+ clearTimeout(this.recoveryRetries.get(key)?.timer);
48022
+ this.recoveryRetries.delete(key);
46958
48023
  this.liveCursorFences.delete(key);
46959
48024
  this.liveAdmittedSeqByBucket.delete(key);
46960
48025
  }
@@ -63812,6 +64877,12 @@ var INLINE_MESSAGE_ENTITY_TYPE = {
63812
64877
  function compactWhitespace(raw) {
63813
64878
  return (raw ?? "").replace(/\s+/g, " ").trim();
63814
64879
  }
64880
+ function normalizeRawMessageText(raw) {
64881
+ return (raw ?? "").replaceAll(`\r
64882
+ `, `
64883
+ `).replaceAll("\r", `
64884
+ `).trim();
64885
+ }
63815
64886
  function bestPhotoSize(photo) {
63816
64887
  let best = {
63817
64888
  cdnUrl: null,
@@ -64116,7 +65187,7 @@ function formatEntitySummary(entity) {
64116
65187
  }
64117
65188
  }
64118
65189
  function summarizeInlineMessageContent(message) {
64119
- const rawText = compactWhitespace(message.message);
65190
+ const rawText = normalizeRawMessageText(message.message);
64120
65191
  const media = messageMediaSummary(message);
64121
65192
  const attachments = messageAttachmentSummaries(message);
64122
65193
  const entities = messageEntitySummaries(message);
@@ -66300,13 +67371,44 @@ function createInlineUpdateCommand(api2) {
66300
67371
  };
66301
67372
  }
66302
67373
 
67374
+ // src/inline/maintenance-command-specs.ts
67375
+ var INLINE_SYNC_COMMAND_SPEC = {
67376
+ name: "inline-sync",
67377
+ nativeNames: { inline: "inline_sync" },
67378
+ nativeProgressMessages: { inline: "Syncing Inline commands and skills…" },
67379
+ description: "Resync Inline commands and skills",
67380
+ channels: ["inline"],
67381
+ acceptsArgs: false
67382
+ };
67383
+ var INLINE_VERSION_COMMAND_SPEC = {
67384
+ name: "inline-version",
67385
+ nativeNames: { inline: "inline_version" },
67386
+ description: "Show Inline plugin and sync information",
67387
+ channels: ["inline"],
67388
+ acceptsArgs: false
67389
+ };
67390
+ function listInlineMaintenanceCommandSpecs() {
67391
+ return [INLINE_SYNC_COMMAND_SPEC, INLINE_VERSION_COMMAND_SPEC].map((spec) => ({
67392
+ name: spec.nativeNames.inline,
67393
+ description: spec.description,
67394
+ acceptsArgs: spec.acceptsArgs
67395
+ }));
67396
+ }
67397
+
66303
67398
  // src/inline/bot-commands-sync.ts
66304
67399
  var INLINE_COMMAND_NAME_RE = /^[a-z0-9_]{1,32}$/;
66305
67400
  var INLINE_COMMAND_LIMIT = 100;
66306
67401
  var INLINE_COMMAND_DESCRIPTION_LIMIT = 256;
66307
67402
  var INLINE_COMMAND_RETRY_RATIO = 0.8;
66308
67403
  var INLINE_NATIVE_COMMAND_PROVIDER = "inline";
66309
- var INLINE_REQUIRED_COMMAND_NAMES = new Set(["follow", "unfollow", "threadreply", "inline_update"]);
67404
+ var INLINE_REQUIRED_COMMAND_NAMES = new Set([
67405
+ "follow",
67406
+ "unfollow",
67407
+ "threadreply",
67408
+ "inline_update",
67409
+ "inline_sync",
67410
+ "inline_version"
67411
+ ]);
66310
67412
  function resolveInlineChannelCommands(cfg) {
66311
67413
  const inline = cfg.channels?.inline;
66312
67414
  if (typeof inline !== "object" || inline === null || Array.isArray(inline))
@@ -66416,7 +67518,8 @@ async function buildInlineNativeCommandsForConfig(params) {
66416
67518
  ...getPluginCommandSpecs("inline", { config: params.cfg }),
66417
67519
  ...listInlineFollowCommandSpecs(),
66418
67520
  ...listInlineBuiltinCommandSpecs(),
66419
- ...listInlineUpdateCommandSpecs()
67521
+ ...listInlineUpdateCommandSpecs(),
67522
+ ...listInlineMaintenanceCommandSpecs()
66420
67523
  ];
66421
67524
  const seen = new Set;
66422
67525
  const resolved = [];
@@ -66597,6 +67700,155 @@ async function syncInlineAgentSkills(params) {
66597
67700
  return { attempted, synced, failed };
66598
67701
  }
66599
67702
 
67703
+ // src/inline/catalog-sync.ts
67704
+ var syncTail = Promise.resolve();
67705
+ var lastStatus;
67706
+ async function performInlineCatalogSync(params) {
67707
+ const commands = await syncInlineNativeCommands({
67708
+ cfg: params.cfg,
67709
+ ...params.logger ? { logger: params.logger } : {}
67710
+ });
67711
+ const skills = await syncInlineAgentSkills({
67712
+ cfg: params.cfg,
67713
+ ...params.logger ? { logger: params.logger } : {}
67714
+ });
67715
+ const status = {
67716
+ reason: params.reason,
67717
+ completedAt: new Date().toISOString(),
67718
+ commands,
67719
+ skills
67720
+ };
67721
+ lastStatus = status;
67722
+ return status;
67723
+ }
67724
+ function syncInlineCatalogs(params) {
67725
+ const run = syncTail.then(() => performInlineCatalogSync(params), () => performInlineCatalogSync(params));
67726
+ syncTail = run;
67727
+ return run;
67728
+ }
67729
+ function getLastInlineCatalogSyncStatus() {
67730
+ return lastStatus;
67731
+ }
67732
+
67733
+ // src/inline/maintenance-command.ts
67734
+ import { stat } from "node:fs/promises";
67735
+ function formatTimestamp(value) {
67736
+ if (!value)
67737
+ return "unavailable";
67738
+ const date5 = new Date(value);
67739
+ return Number.isNaN(date5.valueOf()) ? "unavailable" : date5.toISOString();
67740
+ }
67741
+ function summarizeSync(status) {
67742
+ if (!status)
67743
+ return "not run in this process";
67744
+ const commands = `${status.commands.synced}/${status.commands.attempted} command account(s) synced`;
67745
+ const skills = `${status.skills.synced}/${status.skills.attempted} skill account(s) synced`;
67746
+ const failures = status.commands.failed + status.skills.failed;
67747
+ return `${status.completedAt} (${status.reason}; ${commands}; ${skills}; ${failures} failure(s))`;
67748
+ }
67749
+ function installRecord(api2) {
67750
+ const plugins = api2.config.plugins;
67751
+ return plugins?.installs?.[api2.id] ?? plugins?.installs?.inline;
67752
+ }
67753
+ async function resolveInstallMetadata(api2) {
67754
+ let record3 = installRecord(api2);
67755
+ try {
67756
+ if (await api2.runtime.gateway.isAvailable()) {
67757
+ const inspection = await api2.runtime.gateway.request("plugins.inspect", {
67758
+ pluginId: api2.id
67759
+ });
67760
+ record3 = {
67761
+ ...record3,
67762
+ ...inspection.plugin?.version ? { version: inspection.plugin.version } : {},
67763
+ ...inspection.source?.kind ? { source: inspection.source.kind } : {}
67764
+ };
67765
+ }
67766
+ } catch {}
67767
+ if (record3?.installedAt || !api2.rootDir) {
67768
+ return { record: record3, timestampIsFilesystemMetadata: false };
67769
+ }
67770
+ try {
67771
+ const metadata = await stat(api2.rootDir);
67772
+ const timestampMs = Math.max(metadata.birthtimeMs, metadata.ctimeMs, metadata.mtimeMs);
67773
+ if (Number.isFinite(timestampMs) && timestampMs > 0) {
67774
+ record3 = { ...record3, installedAt: new Date(timestampMs).toISOString() };
67775
+ return { record: record3, timestampIsFilesystemMetadata: true };
67776
+ }
67777
+ } catch {}
67778
+ return { record: record3, timestampIsFilesystemMetadata: false };
67779
+ }
67780
+ function buildInlineVersionText(api2, metadata = {
67781
+ record: installRecord(api2),
67782
+ timestampIsFilesystemMetadata: false
67783
+ }) {
67784
+ const { record: record3 } = metadata;
67785
+ const pluginVersion = api2.version ?? record3?.resolvedVersion ?? record3?.version ?? "unknown";
67786
+ const resolvedVersion = record3?.resolvedVersion;
67787
+ const lines = [
67788
+ "Inline OpenClaw plugin",
67789
+ `Plugin version: ${pluginVersion}`,
67790
+ `OpenClaw version: ${api2.runtime.version || "unknown"}`,
67791
+ `Install source: ${record3?.source ?? "unavailable"}`,
67792
+ `Last install/update: ${formatTimestamp(record3?.installedAt)}${metadata.timestampIsFilesystemMetadata ? " (filesystem metadata)" : ""}`
67793
+ ];
67794
+ if (resolvedVersion && resolvedVersion !== pluginVersion) {
67795
+ lines.push(`Resolved version: ${resolvedVersion}`);
67796
+ }
67797
+ if (record3?.resolvedAt) {
67798
+ lines.push(`Resolved at: ${formatTimestamp(record3.resolvedAt)}`);
67799
+ }
67800
+ lines.push(`Last catalog sync: ${summarizeSync(getLastInlineCatalogSyncStatus())}`);
67801
+ return lines.join(`
67802
+ `);
67803
+ }
67804
+ async function handleInlineSyncCommand(api2, ctx) {
67805
+ if (!ctx.isAuthorizedSender) {
67806
+ return { text: "This Inline command is not available to this sender." };
67807
+ }
67808
+ if (ctx.args?.trim()) {
67809
+ return { text: "Usage: /inline_sync" };
67810
+ }
67811
+ try {
67812
+ const status = await syncInlineCatalogs({
67813
+ cfg: api2.config,
67814
+ logger: api2.logger,
67815
+ reason: "manual"
67816
+ });
67817
+ const failed = status.commands.failed + status.skills.failed;
67818
+ if (failed > 0) {
67819
+ return {
67820
+ text: `Inline catalog sync completed with ${failed} failure(s). Commands: ${status.commands.synced}/${status.commands.attempted} accounts. Skills: ${status.skills.synced}/${status.skills.attempted} accounts. Check OpenClaw logs for [inline] sync details.`
67821
+ };
67822
+ }
67823
+ return {
67824
+ text: `Inline catalogs synced. Commands: ${status.commands.synced}/${status.commands.attempted} accounts. Skills: ${status.skills.synced}/${status.skills.attempted} accounts. Open or reopen the Skilled Agent editor in Inline to load the updated catalog.`
67825
+ };
67826
+ } catch (error51) {
67827
+ api2.logger.warn?.(`[inline] manual catalog sync failed: ${String(error51)}`);
67828
+ return { text: "Inline catalog sync failed. Check OpenClaw logs for [inline] sync details." };
67829
+ }
67830
+ }
67831
+ function createInlineMaintenanceCommands(api2) {
67832
+ return [
67833
+ {
67834
+ ...INLINE_SYNC_COMMAND_SPEC,
67835
+ handler: async (ctx) => await handleInlineSyncCommand(api2, ctx)
67836
+ },
67837
+ {
67838
+ ...INLINE_VERSION_COMMAND_SPEC,
67839
+ handler: async (ctx) => {
67840
+ if (!ctx.isAuthorizedSender) {
67841
+ return { text: "This Inline command is not available to this sender." };
67842
+ }
67843
+ if (ctx.args?.trim()) {
67844
+ return { text: "Usage: /inline_version" };
67845
+ }
67846
+ return { text: buildInlineVersionText(api2, await resolveInstallMetadata(api2)) };
67847
+ }
67848
+ }
67849
+ ];
67850
+ }
67851
+
66600
67852
  // src/runtime-register-api.ts
66601
67853
  function registerInlinePluginFull(api2) {
66602
67854
  api2.registerTool((ctx) => createInlineMembersTool(ctx), {
@@ -66627,6 +67879,9 @@ function registerInlinePluginFull(api2) {
66627
67879
  registerCommand(command);
66628
67880
  }
66629
67881
  registerCommand(createInlineUpdateCommand(api2));
67882
+ for (const command of createInlineMaintenanceCommands(api2)) {
67883
+ registerCommand(command);
67884
+ }
66630
67885
  }
66631
67886
  api2.on("message_sending", (event, ctx) => {
66632
67887
  if (ctx.channelId !== "inline")
@@ -66645,13 +67900,17 @@ function registerInlinePluginFull(api2) {
66645
67900
  return { content };
66646
67901
  });
66647
67902
  api2.on("gateway_start", async () => {
66648
- await syncInlineNativeCommands({
67903
+ await syncInlineCatalogs({
66649
67904
  cfg: api2.config,
66650
- logger: api2.logger
67905
+ logger: api2.logger,
67906
+ reason: "gateway_start"
66651
67907
  });
66652
- await syncInlineAgentSkills({
67908
+ });
67909
+ api2.on("skill_changed", async () => {
67910
+ await syncInlineCatalogs({
66653
67911
  cfg: api2.config,
66654
- logger: api2.logger
67912
+ logger: api2.logger,
67913
+ reason: "skill_changed"
66655
67914
  });
66656
67915
  });
66657
67916
  }
@@ -66659,5 +67918,5 @@ export {
66659
67918
  registerInlinePluginFull
66660
67919
  };
66661
67920
 
66662
- //# debugId=C7ECA624482A65A064756E2164756E21
67921
+ //# debugId=1DD482459CA9FC1164756E2164756E21
66663
67922
  //# sourceMappingURL=runtime-register-api.js.map