@inline-openclaw/inline 0.0.44 → 0.0.46

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.
Files changed (35) hide show
  1. package/README.md +2 -0
  2. package/dist/account-inspect-api.js +4 -2
  3. package/dist/account-inspect-api.js.map +3 -3
  4. package/dist/approval-handler.runtime.js +1093 -74
  5. package/dist/approval-handler.runtime.js.map +10 -10
  6. package/dist/channel-plugin-api.js +2262 -364
  7. package/dist/channel-plugin-api.js.map +16 -15
  8. package/dist/inline/actions.d.ts.map +1 -1
  9. package/dist/inline/approval-handler.runtime.d.ts +1 -0
  10. package/dist/inline/approval-handler.runtime.d.ts.map +1 -1
  11. package/dist/inline/bot-avatar-tool.d.ts +12 -0
  12. package/dist/inline/bot-avatar-tool.d.ts.map +1 -0
  13. package/dist/inline/bot-commands-sync.d.ts.map +1 -1
  14. package/dist/inline/channel.d.ts.map +1 -1
  15. package/dist/inline/config-schema.d.ts +2 -0
  16. package/dist/inline/config-schema.d.ts.map +1 -1
  17. package/dist/inline/doctor.d.ts.map +1 -1
  18. package/dist/inline/message-content.d.ts +5 -1
  19. package/dist/inline/message-content.d.ts.map +1 -1
  20. package/dist/inline/message-formatting.d.ts +18 -0
  21. package/dist/inline/message-formatting.d.ts.map +1 -1
  22. package/dist/inline/message-tools.d.ts.map +1 -1
  23. package/dist/inline/monitor.d.ts.map +1 -1
  24. package/dist/inline/parent-context-tool.d.ts.map +1 -1
  25. package/dist/inline/security.d.ts.map +1 -1
  26. package/dist/inline/setup-surface.d.ts.map +1 -1
  27. package/dist/inline/threadreply-command.d.ts +31 -0
  28. package/dist/inline/threadreply-command.d.ts.map +1 -1
  29. package/dist/runtime-register-api.d.ts.map +1 -1
  30. package/dist/runtime-register-api.js +1741 -259
  31. package/dist/runtime-register-api.js.map +14 -13
  32. package/dist/setup-plugin-api.js +23 -13
  33. package/dist/setup-plugin-api.js.map +6 -6
  34. package/openclaw.plugin.json +5 -3
  35. package/package.json +1 -1
@@ -5617,6 +5617,24 @@ var ConnectionError_Reason;
5617
5617
  ConnectionError_Reason2[ConnectionError_Reason2["INVALID_AUTH"] = 2] = "INVALID_AUTH";
5618
5618
  ConnectionError_Reason2[ConnectionError_Reason2["SESSION_REVOKED"] = 3] = "SESSION_REVOKED";
5619
5619
  })(ConnectionError_Reason || (ConnectionError_Reason = {}));
5620
+ var BotAvatar_Kind;
5621
+ (function(BotAvatar_Kind2) {
5622
+ BotAvatar_Kind2[BotAvatar_Kind2["KIND_UNSPECIFIED"] = 0] = "KIND_UNSPECIFIED";
5623
+ BotAvatar_Kind2[BotAvatar_Kind2["CODEX_ATLAS"] = 1] = "CODEX_ATLAS";
5624
+ })(BotAvatar_Kind || (BotAvatar_Kind = {}));
5625
+ var BotPresenceState_Kind;
5626
+ (function(BotPresenceState_Kind2) {
5627
+ BotPresenceState_Kind2[BotPresenceState_Kind2["KIND_UNSPECIFIED"] = 0] = "KIND_UNSPECIFIED";
5628
+ BotPresenceState_Kind2[BotPresenceState_Kind2["HIDDEN"] = 1] = "HIDDEN";
5629
+ BotPresenceState_Kind2[BotPresenceState_Kind2["IDLE"] = 2] = "IDLE";
5630
+ BotPresenceState_Kind2[BotPresenceState_Kind2["HAPPY"] = 3] = "HAPPY";
5631
+ BotPresenceState_Kind2[BotPresenceState_Kind2["WAVING"] = 4] = "WAVING";
5632
+ BotPresenceState_Kind2[BotPresenceState_Kind2["JUMPING"] = 5] = "JUMPING";
5633
+ BotPresenceState_Kind2[BotPresenceState_Kind2["FAILED"] = 6] = "FAILED";
5634
+ BotPresenceState_Kind2[BotPresenceState_Kind2["WAITING"] = 7] = "WAITING";
5635
+ BotPresenceState_Kind2[BotPresenceState_Kind2["RUNNING"] = 8] = "RUNNING";
5636
+ BotPresenceState_Kind2[BotPresenceState_Kind2["REVIEW"] = 9] = "REVIEW";
5637
+ })(BotPresenceState_Kind || (BotPresenceState_Kind = {}));
5620
5638
  var MessageEntity_Type;
5621
5639
  (function(MessageEntity_Type2) {
5622
5640
  MessageEntity_Type2[MessageEntity_Type2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
@@ -5730,6 +5748,11 @@ var UserStatus_Status;
5730
5748
  UserStatus_Status2[UserStatus_Status2["ONLINE"] = 1] = "ONLINE";
5731
5749
  UserStatus_Status2[UserStatus_Status2["OFFLINE"] = 2] = "OFFLINE";
5732
5750
  })(UserStatus_Status || (UserStatus_Status = {}));
5751
+ var DialogFollowMode;
5752
+ (function(DialogFollowMode2) {
5753
+ DialogFollowMode2[DialogFollowMode2["DIALOG_FOLLOW_MODE_UNSPECIFIED"] = 0] = "DIALOG_FOLLOW_MODE_UNSPECIFIED";
5754
+ DialogFollowMode2[DialogFollowMode2["FOLLOWING"] = 1] = "FOLLOWING";
5755
+ })(DialogFollowMode || (DialogFollowMode = {}));
5733
5756
  var MessageSendMode;
5734
5757
  (function(MessageSendMode2) {
5735
5758
  MessageSendMode2[MessageSendMode2["MODE_UNSPECIFIED"] = 0] = "MODE_UNSPECIFIED";
@@ -5793,6 +5816,11 @@ var Method;
5793
5816
  Method2[Method2["CLEAR_CHAT_HISTORY"] = 53] = "CLEAR_CHAT_HISTORY";
5794
5817
  Method2[Method2["DELETE_BOT"] = 54] = "DELETE_BOT";
5795
5818
  Method2[Method2["DELETE_MESSAGE_ATTACHMENT"] = 55] = "DELETE_MESSAGE_ATTACHMENT";
5819
+ Method2[Method2["SET_BOT_AVATAR"] = 56] = "SET_BOT_AVATAR";
5820
+ Method2[Method2["CLEAR_BOT_AVATAR"] = 57] = "CLEAR_BOT_AVATAR";
5821
+ Method2[Method2["GET_BOT_PRESENCE"] = 58] = "GET_BOT_PRESENCE";
5822
+ Method2[Method2["SET_BOT_PRESENCE_STATE"] = 59] = "SET_BOT_PRESENCE_STATE";
5823
+ Method2[Method2["UPDATE_DIALOG_FOLLOW_MODE"] = 60] = "UPDATE_DIALOG_FOLLOW_MODE";
5796
5824
  })(Method || (Method = {}));
5797
5825
  var PushNotificationProvider;
5798
5826
  (function(PushNotificationProvider2) {
@@ -6675,6 +6703,123 @@ class PeerUser$Type extends import_runtime4.MessageType {
6675
6703
  }
6676
6704
  var PeerUser = new PeerUser$Type;
6677
6705
 
6706
+ class BotAvatar$Type extends import_runtime4.MessageType {
6707
+ constructor() {
6708
+ super("BotAvatar", [
6709
+ { no: 1, name: "kind", kind: "enum", T: () => ["BotAvatar.Kind", BotAvatar_Kind] },
6710
+ { no: 2, name: "display_name", kind: "scalar", T: 9 },
6711
+ { no: 3, name: "description", kind: "scalar", opt: true, T: 9 },
6712
+ { no: 4, name: "cdn_url", kind: "scalar", opt: true, T: 9 },
6713
+ { no: 5, name: "file_unique_id", kind: "scalar", opt: true, T: 9 }
6714
+ ]);
6715
+ }
6716
+ create(value) {
6717
+ const message = globalThis.Object.create(this.messagePrototype);
6718
+ message.kind = 0;
6719
+ message.displayName = "";
6720
+ if (value !== undefined)
6721
+ import_runtime3.reflectionMergePartial(this, message, value);
6722
+ return message;
6723
+ }
6724
+ internalBinaryRead(reader, length, options, target) {
6725
+ let message = target ?? this.create(), end = reader.pos + length;
6726
+ while (reader.pos < end) {
6727
+ let [fieldNo, wireType] = reader.tag();
6728
+ switch (fieldNo) {
6729
+ case 1:
6730
+ message.kind = reader.int32();
6731
+ break;
6732
+ case 2:
6733
+ message.displayName = reader.string();
6734
+ break;
6735
+ case 3:
6736
+ message.description = reader.string();
6737
+ break;
6738
+ case 4:
6739
+ message.cdnUrl = reader.string();
6740
+ break;
6741
+ case 5:
6742
+ message.fileUniqueId = reader.string();
6743
+ break;
6744
+ default:
6745
+ let u = options.readUnknownField;
6746
+ if (u === "throw")
6747
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
6748
+ let d = reader.skip(wireType);
6749
+ if (u !== false)
6750
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
6751
+ }
6752
+ }
6753
+ return message;
6754
+ }
6755
+ internalBinaryWrite(message, writer, options) {
6756
+ if (message.kind !== 0)
6757
+ writer.tag(1, import_runtime.WireType.Varint).int32(message.kind);
6758
+ if (message.displayName !== "")
6759
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.displayName);
6760
+ if (message.description !== undefined)
6761
+ writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.description);
6762
+ if (message.cdnUrl !== undefined)
6763
+ writer.tag(4, import_runtime.WireType.LengthDelimited).string(message.cdnUrl);
6764
+ if (message.fileUniqueId !== undefined)
6765
+ writer.tag(5, import_runtime.WireType.LengthDelimited).string(message.fileUniqueId);
6766
+ let u = options.writeUnknownFields;
6767
+ if (u !== false)
6768
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
6769
+ return writer;
6770
+ }
6771
+ }
6772
+ var BotAvatar = new BotAvatar$Type;
6773
+
6774
+ class BotPresenceState$Type extends import_runtime4.MessageType {
6775
+ constructor() {
6776
+ super("BotPresenceState", [
6777
+ { no: 1, name: "kind", kind: "enum", T: () => ["BotPresenceState.Kind", BotPresenceState_Kind] },
6778
+ { no: 2, name: "comment", kind: "scalar", opt: true, T: 9 }
6779
+ ]);
6780
+ }
6781
+ create(value) {
6782
+ const message = globalThis.Object.create(this.messagePrototype);
6783
+ message.kind = 0;
6784
+ if (value !== undefined)
6785
+ import_runtime3.reflectionMergePartial(this, message, value);
6786
+ return message;
6787
+ }
6788
+ internalBinaryRead(reader, length, options, target) {
6789
+ let message = target ?? this.create(), end = reader.pos + length;
6790
+ while (reader.pos < end) {
6791
+ let [fieldNo, wireType] = reader.tag();
6792
+ switch (fieldNo) {
6793
+ case 1:
6794
+ message.kind = reader.int32();
6795
+ break;
6796
+ case 2:
6797
+ message.comment = reader.string();
6798
+ break;
6799
+ default:
6800
+ let u = options.readUnknownField;
6801
+ if (u === "throw")
6802
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
6803
+ let d = reader.skip(wireType);
6804
+ if (u !== false)
6805
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
6806
+ }
6807
+ }
6808
+ return message;
6809
+ }
6810
+ internalBinaryWrite(message, writer, options) {
6811
+ if (message.kind !== 0)
6812
+ writer.tag(1, import_runtime.WireType.Varint).int32(message.kind);
6813
+ if (message.comment !== undefined)
6814
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.comment);
6815
+ let u = options.writeUnknownFields;
6816
+ if (u !== false)
6817
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
6818
+ return writer;
6819
+ }
6820
+ }
6821
+ var BotPresenceState = new BotPresenceState$Type;
6822
+
6678
6823
  class User$Type extends import_runtime4.MessageType {
6679
6824
  constructor() {
6680
6825
  super("User", [
@@ -6689,7 +6834,8 @@ class User$Type extends import_runtime4.MessageType {
6689
6834
  { no: 9, name: "profile_photo", kind: "message", T: () => UserProfilePhoto },
6690
6835
  { no: 11, name: "pending_setup", kind: "scalar", opt: true, T: 8 },
6691
6836
  { no: 12, name: "time_zone", kind: "scalar", opt: true, T: 9 },
6692
- { no: 13, name: "bot", kind: "scalar", opt: true, T: 8 }
6837
+ { no: 13, name: "bot", kind: "scalar", opt: true, T: 8 },
6838
+ { no: 14, name: "bot_avatar", kind: "message", T: () => BotAvatar }
6693
6839
  ]);
6694
6840
  }
6695
6841
  create(value) {
@@ -6740,6 +6886,9 @@ class User$Type extends import_runtime4.MessageType {
6740
6886
  case 13:
6741
6887
  message.bot = reader.bool();
6742
6888
  break;
6889
+ case 14:
6890
+ message.botAvatar = BotAvatar.internalBinaryRead(reader, reader.uint32(), options, message.botAvatar);
6891
+ break;
6743
6892
  default:
6744
6893
  let u = options.readUnknownField;
6745
6894
  if (u === "throw")
@@ -6776,6 +6925,8 @@ class User$Type extends import_runtime4.MessageType {
6776
6925
  writer.tag(12, import_runtime.WireType.LengthDelimited).string(message.timeZone);
6777
6926
  if (message.bot !== undefined)
6778
6927
  writer.tag(13, import_runtime.WireType.Varint).bool(message.bot);
6928
+ if (message.botAvatar)
6929
+ BotAvatar.internalBinaryWrite(message.botAvatar, writer.tag(14, import_runtime.WireType.LengthDelimited).fork(), options).join();
6779
6930
  let u = options.writeUnknownFields;
6780
6931
  if (u !== false)
6781
6932
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -6861,7 +7012,8 @@ class Dialog$Type extends import_runtime4.MessageType {
6861
7012
  { no: 11, name: "open", kind: "scalar", opt: true, T: 8 },
6862
7013
  { no: 12, name: "opened_date", kind: "scalar", opt: true, T: 3, L: 0 },
6863
7014
  { no: 14, name: "order", kind: "scalar", opt: true, T: 9 },
6864
- { no: 15, name: "pinned_order", kind: "scalar", opt: true, T: 9 }
7015
+ { no: 15, name: "pinned_order", kind: "scalar", opt: true, T: 9 },
7016
+ { no: 16, name: "follow_mode", kind: "enum", opt: true, T: () => ["DialogFollowMode", DialogFollowMode] }
6865
7017
  ]);
6866
7018
  }
6867
7019
  create(value) {
@@ -6920,6 +7072,9 @@ class Dialog$Type extends import_runtime4.MessageType {
6920
7072
  case 15:
6921
7073
  message.pinnedOrder = reader.string();
6922
7074
  break;
7075
+ case 16:
7076
+ message.followMode = reader.int32();
7077
+ break;
6923
7078
  default:
6924
7079
  let u = options.readUnknownField;
6925
7080
  if (u === "throw")
@@ -6962,6 +7117,8 @@ class Dialog$Type extends import_runtime4.MessageType {
6962
7117
  writer.tag(14, import_runtime.WireType.LengthDelimited).string(message.order);
6963
7118
  if (message.pinnedOrder !== undefined)
6964
7119
  writer.tag(15, import_runtime.WireType.LengthDelimited).string(message.pinnedOrder);
7120
+ if (message.followMode !== undefined)
7121
+ writer.tag(16, import_runtime.WireType.Varint).int32(message.followMode);
6965
7122
  let u = options.writeUnknownFields;
6966
7123
  if (u !== false)
6967
7124
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -6985,7 +7142,8 @@ class Chat$Type extends import_runtime4.MessageType {
6985
7142
  { no: 10, name: "created_by", kind: "scalar", opt: true, T: 3, L: 0 },
6986
7143
  { no: 11, name: "parent_chat_id", kind: "scalar", opt: true, T: 3, L: 0 },
6987
7144
  { no: 12, name: "parent_message_id", kind: "scalar", opt: true, T: 3, L: 0 },
6988
- { no: 13, name: "untitled", kind: "scalar", opt: true, T: 8 }
7145
+ { no: 13, name: "untitled", kind: "scalar", opt: true, T: 8 },
7146
+ { no: 14, name: "number", kind: "scalar", opt: true, T: 5 }
6989
7147
  ]);
6990
7148
  }
6991
7149
  create(value) {
@@ -7040,6 +7198,9 @@ class Chat$Type extends import_runtime4.MessageType {
7040
7198
  case 13:
7041
7199
  message.untitled = reader.bool();
7042
7200
  break;
7201
+ case 14:
7202
+ message.number = reader.int32();
7203
+ break;
7043
7204
  default:
7044
7205
  let u = options.readUnknownField;
7045
7206
  if (u === "throw")
@@ -7078,6 +7239,8 @@ class Chat$Type extends import_runtime4.MessageType {
7078
7239
  writer.tag(12, import_runtime.WireType.Varint).int64(message.parentMessageId);
7079
7240
  if (message.untitled !== undefined)
7080
7241
  writer.tag(13, import_runtime.WireType.Varint).bool(message.untitled);
7242
+ if (message.number !== undefined)
7243
+ writer.tag(14, import_runtime.WireType.Varint).int32(message.number);
7081
7244
  let u = options.writeUnknownFields;
7082
7245
  if (u !== false)
7083
7246
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -9926,7 +10089,12 @@ class RpcCall$Type extends import_runtime4.MessageType {
9926
10089
  { no: 53, name: "updateDialogOrder", kind: "message", oneof: "input", T: () => UpdateDialogOrderInput },
9927
10090
  { no: 54, name: "clearChatHistory", kind: "message", oneof: "input", T: () => ClearChatHistoryInput },
9928
10091
  { no: 55, name: "deleteBot", kind: "message", oneof: "input", T: () => DeleteBotInput },
9929
- { no: 56, name: "deleteMessageAttachment", kind: "message", oneof: "input", T: () => DeleteMessageAttachmentInput }
10092
+ { no: 56, name: "deleteMessageAttachment", kind: "message", oneof: "input", T: () => DeleteMessageAttachmentInput },
10093
+ { no: 57, name: "setBotAvatar", kind: "message", oneof: "input", T: () => SetBotAvatarInput },
10094
+ { no: 58, name: "clearBotAvatar", kind: "message", oneof: "input", T: () => ClearBotAvatarInput },
10095
+ { no: 59, name: "getBotPresence", kind: "message", oneof: "input", T: () => GetBotPresenceInput },
10096
+ { no: 60, name: "setBotPresenceState", kind: "message", oneof: "input", T: () => SetBotPresenceStateInput },
10097
+ { no: 61, name: "updateDialogFollowMode", kind: "message", oneof: "input", T: () => UpdateDialogFollowModeInput }
9930
10098
  ]);
9931
10099
  }
9932
10100
  create(value) {
@@ -10275,6 +10443,36 @@ class RpcCall$Type extends import_runtime4.MessageType {
10275
10443
  deleteMessageAttachment: DeleteMessageAttachmentInput.internalBinaryRead(reader, reader.uint32(), options, message.input.deleteMessageAttachment)
10276
10444
  };
10277
10445
  break;
10446
+ case 57:
10447
+ message.input = {
10448
+ oneofKind: "setBotAvatar",
10449
+ setBotAvatar: SetBotAvatarInput.internalBinaryRead(reader, reader.uint32(), options, message.input.setBotAvatar)
10450
+ };
10451
+ break;
10452
+ case 58:
10453
+ message.input = {
10454
+ oneofKind: "clearBotAvatar",
10455
+ clearBotAvatar: ClearBotAvatarInput.internalBinaryRead(reader, reader.uint32(), options, message.input.clearBotAvatar)
10456
+ };
10457
+ break;
10458
+ case 59:
10459
+ message.input = {
10460
+ oneofKind: "getBotPresence",
10461
+ getBotPresence: GetBotPresenceInput.internalBinaryRead(reader, reader.uint32(), options, message.input.getBotPresence)
10462
+ };
10463
+ break;
10464
+ case 60:
10465
+ message.input = {
10466
+ oneofKind: "setBotPresenceState",
10467
+ setBotPresenceState: SetBotPresenceStateInput.internalBinaryRead(reader, reader.uint32(), options, message.input.setBotPresenceState)
10468
+ };
10469
+ break;
10470
+ case 61:
10471
+ message.input = {
10472
+ oneofKind: "updateDialogFollowMode",
10473
+ updateDialogFollowMode: UpdateDialogFollowModeInput.internalBinaryRead(reader, reader.uint32(), options, message.input.updateDialogFollowMode)
10474
+ };
10475
+ break;
10278
10476
  default:
10279
10477
  let u = options.readUnknownField;
10280
10478
  if (u === "throw")
@@ -10399,6 +10597,16 @@ class RpcCall$Type extends import_runtime4.MessageType {
10399
10597
  DeleteBotInput.internalBinaryWrite(message.input.deleteBot, writer.tag(55, import_runtime.WireType.LengthDelimited).fork(), options).join();
10400
10598
  if (message.input.oneofKind === "deleteMessageAttachment")
10401
10599
  DeleteMessageAttachmentInput.internalBinaryWrite(message.input.deleteMessageAttachment, writer.tag(56, import_runtime.WireType.LengthDelimited).fork(), options).join();
10600
+ if (message.input.oneofKind === "setBotAvatar")
10601
+ SetBotAvatarInput.internalBinaryWrite(message.input.setBotAvatar, writer.tag(57, import_runtime.WireType.LengthDelimited).fork(), options).join();
10602
+ if (message.input.oneofKind === "clearBotAvatar")
10603
+ ClearBotAvatarInput.internalBinaryWrite(message.input.clearBotAvatar, writer.tag(58, import_runtime.WireType.LengthDelimited).fork(), options).join();
10604
+ if (message.input.oneofKind === "getBotPresence")
10605
+ GetBotPresenceInput.internalBinaryWrite(message.input.getBotPresence, writer.tag(59, import_runtime.WireType.LengthDelimited).fork(), options).join();
10606
+ if (message.input.oneofKind === "setBotPresenceState")
10607
+ SetBotPresenceStateInput.internalBinaryWrite(message.input.setBotPresenceState, writer.tag(60, import_runtime.WireType.LengthDelimited).fork(), options).join();
10608
+ if (message.input.oneofKind === "updateDialogFollowMode")
10609
+ UpdateDialogFollowModeInput.internalBinaryWrite(message.input.updateDialogFollowMode, writer.tag(61, import_runtime.WireType.LengthDelimited).fork(), options).join();
10402
10610
  let u = options.writeUnknownFields;
10403
10611
  if (u !== false)
10404
10612
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -10465,7 +10673,12 @@ class RpcResult$Type extends import_runtime4.MessageType {
10465
10673
  { no: 53, name: "updateDialogOrder", kind: "message", oneof: "result", T: () => UpdateDialogOrderResult },
10466
10674
  { no: 54, name: "clearChatHistory", kind: "message", oneof: "result", T: () => ClearChatHistoryResult },
10467
10675
  { no: 55, name: "deleteBot", kind: "message", oneof: "result", T: () => DeleteBotResult },
10468
- { no: 56, name: "deleteMessageAttachment", kind: "message", oneof: "result", T: () => DeleteMessageAttachmentResult }
10676
+ { no: 56, name: "deleteMessageAttachment", kind: "message", oneof: "result", T: () => DeleteMessageAttachmentResult },
10677
+ { no: 57, name: "setBotAvatar", kind: "message", oneof: "result", T: () => SetBotAvatarResult },
10678
+ { no: 58, name: "clearBotAvatar", kind: "message", oneof: "result", T: () => ClearBotAvatarResult },
10679
+ { no: 59, name: "getBotPresence", kind: "message", oneof: "result", T: () => GetBotPresenceResult },
10680
+ { no: 60, name: "setBotPresenceState", kind: "message", oneof: "result", T: () => SetBotPresenceStateResult },
10681
+ { no: 61, name: "updateDialogFollowMode", kind: "message", oneof: "result", T: () => UpdateDialogFollowModeResult }
10469
10682
  ]);
10470
10683
  }
10471
10684
  create(value) {
@@ -10814,6 +11027,36 @@ class RpcResult$Type extends import_runtime4.MessageType {
10814
11027
  deleteMessageAttachment: DeleteMessageAttachmentResult.internalBinaryRead(reader, reader.uint32(), options, message.result.deleteMessageAttachment)
10815
11028
  };
10816
11029
  break;
11030
+ case 57:
11031
+ message.result = {
11032
+ oneofKind: "setBotAvatar",
11033
+ setBotAvatar: SetBotAvatarResult.internalBinaryRead(reader, reader.uint32(), options, message.result.setBotAvatar)
11034
+ };
11035
+ break;
11036
+ case 58:
11037
+ message.result = {
11038
+ oneofKind: "clearBotAvatar",
11039
+ clearBotAvatar: ClearBotAvatarResult.internalBinaryRead(reader, reader.uint32(), options, message.result.clearBotAvatar)
11040
+ };
11041
+ break;
11042
+ case 59:
11043
+ message.result = {
11044
+ oneofKind: "getBotPresence",
11045
+ getBotPresence: GetBotPresenceResult.internalBinaryRead(reader, reader.uint32(), options, message.result.getBotPresence)
11046
+ };
11047
+ break;
11048
+ case 60:
11049
+ message.result = {
11050
+ oneofKind: "setBotPresenceState",
11051
+ setBotPresenceState: SetBotPresenceStateResult.internalBinaryRead(reader, reader.uint32(), options, message.result.setBotPresenceState)
11052
+ };
11053
+ break;
11054
+ case 61:
11055
+ message.result = {
11056
+ oneofKind: "updateDialogFollowMode",
11057
+ updateDialogFollowMode: UpdateDialogFollowModeResult.internalBinaryRead(reader, reader.uint32(), options, message.result.updateDialogFollowMode)
11058
+ };
11059
+ break;
10817
11060
  default:
10818
11061
  let u = options.readUnknownField;
10819
11062
  if (u === "throw")
@@ -10938,6 +11181,16 @@ class RpcResult$Type extends import_runtime4.MessageType {
10938
11181
  DeleteBotResult.internalBinaryWrite(message.result.deleteBot, writer.tag(55, import_runtime.WireType.LengthDelimited).fork(), options).join();
10939
11182
  if (message.result.oneofKind === "deleteMessageAttachment")
10940
11183
  DeleteMessageAttachmentResult.internalBinaryWrite(message.result.deleteMessageAttachment, writer.tag(56, import_runtime.WireType.LengthDelimited).fork(), options).join();
11184
+ if (message.result.oneofKind === "setBotAvatar")
11185
+ SetBotAvatarResult.internalBinaryWrite(message.result.setBotAvatar, writer.tag(57, import_runtime.WireType.LengthDelimited).fork(), options).join();
11186
+ if (message.result.oneofKind === "clearBotAvatar")
11187
+ ClearBotAvatarResult.internalBinaryWrite(message.result.clearBotAvatar, writer.tag(58, import_runtime.WireType.LengthDelimited).fork(), options).join();
11188
+ if (message.result.oneofKind === "getBotPresence")
11189
+ GetBotPresenceResult.internalBinaryWrite(message.result.getBotPresence, writer.tag(59, import_runtime.WireType.LengthDelimited).fork(), options).join();
11190
+ if (message.result.oneofKind === "setBotPresenceState")
11191
+ SetBotPresenceStateResult.internalBinaryWrite(message.result.setBotPresenceState, writer.tag(60, import_runtime.WireType.LengthDelimited).fork(), options).join();
11192
+ if (message.result.oneofKind === "updateDialogFollowMode")
11193
+ UpdateDialogFollowModeResult.internalBinaryWrite(message.result.updateDialogFollowMode, writer.tag(61, import_runtime.WireType.LengthDelimited).fork(), options).join();
10941
11194
  let u = options.writeUnknownFields;
10942
11195
  if (u !== false)
10943
11196
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -11192,7 +11445,8 @@ class UpdateSidecars$Type extends import_runtime4.MessageType {
11192
11445
  super("UpdateSidecars", [
11193
11446
  { no: 1, name: "users", kind: "message", repeat: 1, T: () => User },
11194
11447
  { no: 2, name: "chats", kind: "message", repeat: 1, T: () => Chat },
11195
- { no: 3, name: "dialogs", kind: "message", repeat: 1, T: () => Dialog }
11448
+ { no: 3, name: "dialogs", kind: "message", repeat: 1, T: () => Dialog },
11449
+ { no: 4, name: "spaces", kind: "message", repeat: 1, T: () => Space }
11196
11450
  ]);
11197
11451
  }
11198
11452
  create(value) {
@@ -11200,6 +11454,7 @@ class UpdateSidecars$Type extends import_runtime4.MessageType {
11200
11454
  message.users = [];
11201
11455
  message.chats = [];
11202
11456
  message.dialogs = [];
11457
+ message.spaces = [];
11203
11458
  if (value !== undefined)
11204
11459
  import_runtime3.reflectionMergePartial(this, message, value);
11205
11460
  return message;
@@ -11218,6 +11473,9 @@ class UpdateSidecars$Type extends import_runtime4.MessageType {
11218
11473
  case 3:
11219
11474
  message.dialogs.push(Dialog.internalBinaryRead(reader, reader.uint32(), options));
11220
11475
  break;
11476
+ case 4:
11477
+ message.spaces.push(Space.internalBinaryRead(reader, reader.uint32(), options));
11478
+ break;
11221
11479
  default:
11222
11480
  let u = options.readUnknownField;
11223
11481
  if (u === "throw")
@@ -11236,6 +11494,8 @@ class UpdateSidecars$Type extends import_runtime4.MessageType {
11236
11494
  Chat.internalBinaryWrite(message.chats[i], writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
11237
11495
  for (let i = 0;i < message.dialogs.length; i++)
11238
11496
  Dialog.internalBinaryWrite(message.dialogs[i], writer.tag(3, import_runtime.WireType.LengthDelimited).fork(), options).join();
11497
+ for (let i = 0;i < message.spaces.length; i++)
11498
+ Space.internalBinaryWrite(message.spaces[i], writer.tag(4, import_runtime.WireType.LengthDelimited).fork(), options).join();
11239
11499
  let u = options.writeUnknownFields;
11240
11500
  if (u !== false)
11241
11501
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -12022,6 +12282,97 @@ class UpdateDialogOrderResult$Type extends import_runtime4.MessageType {
12022
12282
  }
12023
12283
  var UpdateDialogOrderResult = new UpdateDialogOrderResult$Type;
12024
12284
 
12285
+ class UpdateDialogFollowModeInput$Type extends import_runtime4.MessageType {
12286
+ constructor() {
12287
+ super("UpdateDialogFollowModeInput", [
12288
+ { no: 1, name: "peer_id", kind: "message", T: () => InputPeer },
12289
+ { no: 2, name: "follow_mode", kind: "enum", opt: true, T: () => ["DialogFollowMode", DialogFollowMode] }
12290
+ ]);
12291
+ }
12292
+ create(value) {
12293
+ const message = globalThis.Object.create(this.messagePrototype);
12294
+ if (value !== undefined)
12295
+ import_runtime3.reflectionMergePartial(this, message, value);
12296
+ return message;
12297
+ }
12298
+ internalBinaryRead(reader, length, options, target) {
12299
+ let message = target ?? this.create(), end = reader.pos + length;
12300
+ while (reader.pos < end) {
12301
+ let [fieldNo, wireType] = reader.tag();
12302
+ switch (fieldNo) {
12303
+ case 1:
12304
+ message.peerId = InputPeer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
12305
+ break;
12306
+ case 2:
12307
+ message.followMode = reader.int32();
12308
+ break;
12309
+ default:
12310
+ let u = options.readUnknownField;
12311
+ if (u === "throw")
12312
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
12313
+ let d = reader.skip(wireType);
12314
+ if (u !== false)
12315
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
12316
+ }
12317
+ }
12318
+ return message;
12319
+ }
12320
+ internalBinaryWrite(message, writer, options) {
12321
+ if (message.peerId)
12322
+ InputPeer.internalBinaryWrite(message.peerId, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
12323
+ if (message.followMode !== undefined)
12324
+ writer.tag(2, import_runtime.WireType.Varint).int32(message.followMode);
12325
+ let u = options.writeUnknownFields;
12326
+ if (u !== false)
12327
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
12328
+ return writer;
12329
+ }
12330
+ }
12331
+ var UpdateDialogFollowModeInput = new UpdateDialogFollowModeInput$Type;
12332
+
12333
+ class UpdateDialogFollowModeResult$Type extends import_runtime4.MessageType {
12334
+ constructor() {
12335
+ super("UpdateDialogFollowModeResult", [
12336
+ { no: 1, name: "updates", kind: "message", repeat: 1, T: () => Update }
12337
+ ]);
12338
+ }
12339
+ create(value) {
12340
+ const message = globalThis.Object.create(this.messagePrototype);
12341
+ message.updates = [];
12342
+ if (value !== undefined)
12343
+ import_runtime3.reflectionMergePartial(this, message, value);
12344
+ return message;
12345
+ }
12346
+ internalBinaryRead(reader, length, options, target) {
12347
+ let message = target ?? this.create(), end = reader.pos + length;
12348
+ while (reader.pos < end) {
12349
+ let [fieldNo, wireType] = reader.tag();
12350
+ switch (fieldNo) {
12351
+ case 1:
12352
+ message.updates.push(Update.internalBinaryRead(reader, reader.uint32(), options));
12353
+ break;
12354
+ default:
12355
+ let u = options.readUnknownField;
12356
+ if (u === "throw")
12357
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
12358
+ let d = reader.skip(wireType);
12359
+ if (u !== false)
12360
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
12361
+ }
12362
+ }
12363
+ return message;
12364
+ }
12365
+ internalBinaryWrite(message, writer, options) {
12366
+ for (let i = 0;i < message.updates.length; i++)
12367
+ Update.internalBinaryWrite(message.updates[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
12368
+ let u = options.writeUnknownFields;
12369
+ if (u !== false)
12370
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
12371
+ return writer;
12372
+ }
12373
+ }
12374
+ var UpdateDialogFollowModeResult = new UpdateDialogFollowModeResult$Type;
12375
+
12025
12376
  class MarkAsUnreadInput$Type extends import_runtime4.MessageType {
12026
12377
  constructor() {
12027
12378
  super("MarkAsUnreadInput", [
@@ -12452,20 +12803,357 @@ class DeleteBotResult$Type extends import_runtime4.MessageType {
12452
12803
  return writer;
12453
12804
  }
12454
12805
  }
12455
- var DeleteBotResult = new DeleteBotResult$Type;
12806
+ var DeleteBotResult = new DeleteBotResult$Type;
12807
+
12808
+ class DeleteMessageAttachmentInput$Type extends import_runtime4.MessageType {
12809
+ constructor() {
12810
+ super("DeleteMessageAttachmentInput", [
12811
+ { no: 1, name: "peer_id", kind: "message", T: () => InputPeer },
12812
+ { no: 2, name: "message_id", kind: "scalar", T: 3, L: 0 },
12813
+ { no: 3, name: "attachment_id", kind: "scalar", T: 3, L: 0 }
12814
+ ]);
12815
+ }
12816
+ create(value) {
12817
+ const message = globalThis.Object.create(this.messagePrototype);
12818
+ message.messageId = 0n;
12819
+ message.attachmentId = 0n;
12820
+ if (value !== undefined)
12821
+ import_runtime3.reflectionMergePartial(this, message, value);
12822
+ return message;
12823
+ }
12824
+ internalBinaryRead(reader, length, options, target) {
12825
+ let message = target ?? this.create(), end = reader.pos + length;
12826
+ while (reader.pos < end) {
12827
+ let [fieldNo, wireType] = reader.tag();
12828
+ switch (fieldNo) {
12829
+ case 1:
12830
+ message.peerId = InputPeer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
12831
+ break;
12832
+ case 2:
12833
+ message.messageId = reader.int64().toBigInt();
12834
+ break;
12835
+ case 3:
12836
+ message.attachmentId = reader.int64().toBigInt();
12837
+ break;
12838
+ default:
12839
+ let u = options.readUnknownField;
12840
+ if (u === "throw")
12841
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
12842
+ let d = reader.skip(wireType);
12843
+ if (u !== false)
12844
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
12845
+ }
12846
+ }
12847
+ return message;
12848
+ }
12849
+ internalBinaryWrite(message, writer, options) {
12850
+ if (message.peerId)
12851
+ InputPeer.internalBinaryWrite(message.peerId, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
12852
+ if (message.messageId !== 0n)
12853
+ writer.tag(2, import_runtime.WireType.Varint).int64(message.messageId);
12854
+ if (message.attachmentId !== 0n)
12855
+ writer.tag(3, import_runtime.WireType.Varint).int64(message.attachmentId);
12856
+ let u = options.writeUnknownFields;
12857
+ if (u !== false)
12858
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
12859
+ return writer;
12860
+ }
12861
+ }
12862
+ var DeleteMessageAttachmentInput = new DeleteMessageAttachmentInput$Type;
12863
+
12864
+ class DeleteMessageAttachmentResult$Type extends import_runtime4.MessageType {
12865
+ constructor() {
12866
+ super("DeleteMessageAttachmentResult", [
12867
+ { no: 1, name: "updates", kind: "message", repeat: 1, T: () => Update }
12868
+ ]);
12869
+ }
12870
+ create(value) {
12871
+ const message = globalThis.Object.create(this.messagePrototype);
12872
+ message.updates = [];
12873
+ if (value !== undefined)
12874
+ import_runtime3.reflectionMergePartial(this, message, value);
12875
+ return message;
12876
+ }
12877
+ internalBinaryRead(reader, length, options, target) {
12878
+ let message = target ?? this.create(), end = reader.pos + length;
12879
+ while (reader.pos < end) {
12880
+ let [fieldNo, wireType] = reader.tag();
12881
+ switch (fieldNo) {
12882
+ case 1:
12883
+ message.updates.push(Update.internalBinaryRead(reader, reader.uint32(), options));
12884
+ break;
12885
+ default:
12886
+ let u = options.readUnknownField;
12887
+ if (u === "throw")
12888
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
12889
+ let d = reader.skip(wireType);
12890
+ if (u !== false)
12891
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
12892
+ }
12893
+ }
12894
+ return message;
12895
+ }
12896
+ internalBinaryWrite(message, writer, options) {
12897
+ for (let i = 0;i < message.updates.length; i++)
12898
+ Update.internalBinaryWrite(message.updates[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
12899
+ let u = options.writeUnknownFields;
12900
+ if (u !== false)
12901
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
12902
+ return writer;
12903
+ }
12904
+ }
12905
+ var DeleteMessageAttachmentResult = new DeleteMessageAttachmentResult$Type;
12906
+
12907
+ class RevokeSessionInput$Type extends import_runtime4.MessageType {
12908
+ constructor() {
12909
+ super("RevokeSessionInput", [
12910
+ { no: 1, name: "session_id", kind: "scalar", T: 3, L: 0 }
12911
+ ]);
12912
+ }
12913
+ create(value) {
12914
+ const message = globalThis.Object.create(this.messagePrototype);
12915
+ message.sessionId = 0n;
12916
+ if (value !== undefined)
12917
+ import_runtime3.reflectionMergePartial(this, message, value);
12918
+ return message;
12919
+ }
12920
+ internalBinaryRead(reader, length, options, target) {
12921
+ let message = target ?? this.create(), end = reader.pos + length;
12922
+ while (reader.pos < end) {
12923
+ let [fieldNo, wireType] = reader.tag();
12924
+ switch (fieldNo) {
12925
+ case 1:
12926
+ message.sessionId = reader.int64().toBigInt();
12927
+ break;
12928
+ default:
12929
+ let u = options.readUnknownField;
12930
+ if (u === "throw")
12931
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
12932
+ let d = reader.skip(wireType);
12933
+ if (u !== false)
12934
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
12935
+ }
12936
+ }
12937
+ return message;
12938
+ }
12939
+ internalBinaryWrite(message, writer, options) {
12940
+ if (message.sessionId !== 0n)
12941
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.sessionId);
12942
+ let u = options.writeUnknownFields;
12943
+ if (u !== false)
12944
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
12945
+ return writer;
12946
+ }
12947
+ }
12948
+ var RevokeSessionInput = new RevokeSessionInput$Type;
12949
+
12950
+ class RevokeSessionResult$Type extends import_runtime4.MessageType {
12951
+ constructor() {
12952
+ super("RevokeSessionResult", [
12953
+ { no: 1, name: "revoked", kind: "scalar", T: 8 },
12954
+ { no: 2, name: "already_revoked", kind: "scalar", T: 8 }
12955
+ ]);
12956
+ }
12957
+ create(value) {
12958
+ const message = globalThis.Object.create(this.messagePrototype);
12959
+ message.revoked = false;
12960
+ message.alreadyRevoked = false;
12961
+ if (value !== undefined)
12962
+ import_runtime3.reflectionMergePartial(this, message, value);
12963
+ return message;
12964
+ }
12965
+ internalBinaryRead(reader, length, options, target) {
12966
+ let message = target ?? this.create(), end = reader.pos + length;
12967
+ while (reader.pos < end) {
12968
+ let [fieldNo, wireType] = reader.tag();
12969
+ switch (fieldNo) {
12970
+ case 1:
12971
+ message.revoked = reader.bool();
12972
+ break;
12973
+ case 2:
12974
+ message.alreadyRevoked = reader.bool();
12975
+ break;
12976
+ default:
12977
+ let u = options.readUnknownField;
12978
+ if (u === "throw")
12979
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
12980
+ let d = reader.skip(wireType);
12981
+ if (u !== false)
12982
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
12983
+ }
12984
+ }
12985
+ return message;
12986
+ }
12987
+ internalBinaryWrite(message, writer, options) {
12988
+ if (message.revoked !== false)
12989
+ writer.tag(1, import_runtime.WireType.Varint).bool(message.revoked);
12990
+ if (message.alreadyRevoked !== false)
12991
+ writer.tag(2, import_runtime.WireType.Varint).bool(message.alreadyRevoked);
12992
+ let u = options.writeUnknownFields;
12993
+ if (u !== false)
12994
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
12995
+ return writer;
12996
+ }
12997
+ }
12998
+ var RevokeSessionResult = new RevokeSessionResult$Type;
12999
+
13000
+ class BotCommand$Type extends import_runtime4.MessageType {
13001
+ constructor() {
13002
+ super("BotCommand", [
13003
+ { no: 1, name: "command", kind: "scalar", T: 9 },
13004
+ { no: 2, name: "description", kind: "scalar", T: 9 },
13005
+ { no: 3, name: "sort_order", kind: "scalar", opt: true, T: 5 }
13006
+ ]);
13007
+ }
13008
+ create(value) {
13009
+ const message = globalThis.Object.create(this.messagePrototype);
13010
+ message.command = "";
13011
+ message.description = "";
13012
+ if (value !== undefined)
13013
+ import_runtime3.reflectionMergePartial(this, message, value);
13014
+ return message;
13015
+ }
13016
+ internalBinaryRead(reader, length, options, target) {
13017
+ let message = target ?? this.create(), end = reader.pos + length;
13018
+ while (reader.pos < end) {
13019
+ let [fieldNo, wireType] = reader.tag();
13020
+ switch (fieldNo) {
13021
+ case 1:
13022
+ message.command = reader.string();
13023
+ break;
13024
+ case 2:
13025
+ message.description = reader.string();
13026
+ break;
13027
+ case 3:
13028
+ message.sortOrder = reader.int32();
13029
+ break;
13030
+ default:
13031
+ let u = options.readUnknownField;
13032
+ if (u === "throw")
13033
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
13034
+ let d = reader.skip(wireType);
13035
+ if (u !== false)
13036
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
13037
+ }
13038
+ }
13039
+ return message;
13040
+ }
13041
+ internalBinaryWrite(message, writer, options) {
13042
+ if (message.command !== "")
13043
+ writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.command);
13044
+ if (message.description !== "")
13045
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.description);
13046
+ if (message.sortOrder !== undefined)
13047
+ writer.tag(3, import_runtime.WireType.Varint).int32(message.sortOrder);
13048
+ let u = options.writeUnknownFields;
13049
+ if (u !== false)
13050
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
13051
+ return writer;
13052
+ }
13053
+ }
13054
+ var BotCommand = new BotCommand$Type;
13055
+
13056
+ class PeerBotCommands$Type extends import_runtime4.MessageType {
13057
+ constructor() {
13058
+ super("PeerBotCommands", [
13059
+ { no: 1, name: "bot", kind: "message", T: () => User },
13060
+ { no: 2, name: "commands", kind: "message", repeat: 1, T: () => BotCommand }
13061
+ ]);
13062
+ }
13063
+ create(value) {
13064
+ const message = globalThis.Object.create(this.messagePrototype);
13065
+ message.commands = [];
13066
+ if (value !== undefined)
13067
+ import_runtime3.reflectionMergePartial(this, message, value);
13068
+ return message;
13069
+ }
13070
+ internalBinaryRead(reader, length, options, target) {
13071
+ let message = target ?? this.create(), end = reader.pos + length;
13072
+ while (reader.pos < end) {
13073
+ let [fieldNo, wireType] = reader.tag();
13074
+ switch (fieldNo) {
13075
+ case 1:
13076
+ message.bot = User.internalBinaryRead(reader, reader.uint32(), options, message.bot);
13077
+ break;
13078
+ case 2:
13079
+ message.commands.push(BotCommand.internalBinaryRead(reader, reader.uint32(), options));
13080
+ break;
13081
+ default:
13082
+ let u = options.readUnknownField;
13083
+ if (u === "throw")
13084
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
13085
+ let d = reader.skip(wireType);
13086
+ if (u !== false)
13087
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
13088
+ }
13089
+ }
13090
+ return message;
13091
+ }
13092
+ internalBinaryWrite(message, writer, options) {
13093
+ if (message.bot)
13094
+ User.internalBinaryWrite(message.bot, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
13095
+ for (let i = 0;i < message.commands.length; i++)
13096
+ BotCommand.internalBinaryWrite(message.commands[i], writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
13097
+ let u = options.writeUnknownFields;
13098
+ if (u !== false)
13099
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
13100
+ return writer;
13101
+ }
13102
+ }
13103
+ var PeerBotCommands = new PeerBotCommands$Type;
13104
+
13105
+ class GetBotCommandsInput$Type extends import_runtime4.MessageType {
13106
+ constructor() {
13107
+ super("GetBotCommandsInput", [
13108
+ { no: 1, name: "bot_user_id", kind: "scalar", T: 3, L: 0 }
13109
+ ]);
13110
+ }
13111
+ create(value) {
13112
+ const message = globalThis.Object.create(this.messagePrototype);
13113
+ message.botUserId = 0n;
13114
+ if (value !== undefined)
13115
+ import_runtime3.reflectionMergePartial(this, message, value);
13116
+ return message;
13117
+ }
13118
+ internalBinaryRead(reader, length, options, target) {
13119
+ let message = target ?? this.create(), end = reader.pos + length;
13120
+ while (reader.pos < end) {
13121
+ let [fieldNo, wireType] = reader.tag();
13122
+ switch (fieldNo) {
13123
+ case 1:
13124
+ message.botUserId = reader.int64().toBigInt();
13125
+ break;
13126
+ default:
13127
+ let u = options.readUnknownField;
13128
+ if (u === "throw")
13129
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
13130
+ let d = reader.skip(wireType);
13131
+ if (u !== false)
13132
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
13133
+ }
13134
+ }
13135
+ return message;
13136
+ }
13137
+ internalBinaryWrite(message, writer, options) {
13138
+ if (message.botUserId !== 0n)
13139
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.botUserId);
13140
+ let u = options.writeUnknownFields;
13141
+ if (u !== false)
13142
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
13143
+ return writer;
13144
+ }
13145
+ }
13146
+ var GetBotCommandsInput = new GetBotCommandsInput$Type;
12456
13147
 
12457
- class DeleteMessageAttachmentInput$Type extends import_runtime4.MessageType {
13148
+ class GetBotCommandsResult$Type extends import_runtime4.MessageType {
12458
13149
  constructor() {
12459
- super("DeleteMessageAttachmentInput", [
12460
- { no: 1, name: "peer_id", kind: "message", T: () => InputPeer },
12461
- { no: 2, name: "message_id", kind: "scalar", T: 3, L: 0 },
12462
- { no: 3, name: "attachment_id", kind: "scalar", T: 3, L: 0 }
13150
+ super("GetBotCommandsResult", [
13151
+ { no: 1, name: "commands", kind: "message", repeat: 1, T: () => BotCommand }
12463
13152
  ]);
12464
13153
  }
12465
13154
  create(value) {
12466
13155
  const message = globalThis.Object.create(this.messagePrototype);
12467
- message.messageId = 0n;
12468
- message.attachmentId = 0n;
13156
+ message.commands = [];
12469
13157
  if (value !== undefined)
12470
13158
  import_runtime3.reflectionMergePartial(this, message, value);
12471
13159
  return message;
@@ -12476,13 +13164,55 @@ class DeleteMessageAttachmentInput$Type extends import_runtime4.MessageType {
12476
13164
  let [fieldNo, wireType] = reader.tag();
12477
13165
  switch (fieldNo) {
12478
13166
  case 1:
12479
- message.peerId = InputPeer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
13167
+ message.commands.push(BotCommand.internalBinaryRead(reader, reader.uint32(), options));
12480
13168
  break;
12481
- case 2:
12482
- message.messageId = reader.int64().toBigInt();
13169
+ default:
13170
+ let u = options.readUnknownField;
13171
+ if (u === "throw")
13172
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
13173
+ let d = reader.skip(wireType);
13174
+ if (u !== false)
13175
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
13176
+ }
13177
+ }
13178
+ return message;
13179
+ }
13180
+ internalBinaryWrite(message, writer, options) {
13181
+ for (let i = 0;i < message.commands.length; i++)
13182
+ BotCommand.internalBinaryWrite(message.commands[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
13183
+ let u = options.writeUnknownFields;
13184
+ if (u !== false)
13185
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
13186
+ return writer;
13187
+ }
13188
+ }
13189
+ var GetBotCommandsResult = new GetBotCommandsResult$Type;
13190
+
13191
+ class SetBotCommandsInput$Type extends import_runtime4.MessageType {
13192
+ constructor() {
13193
+ super("SetBotCommandsInput", [
13194
+ { no: 1, name: "bot_user_id", kind: "scalar", T: 3, L: 0 },
13195
+ { no: 2, name: "commands", kind: "message", repeat: 1, T: () => BotCommand }
13196
+ ]);
13197
+ }
13198
+ create(value) {
13199
+ const message = globalThis.Object.create(this.messagePrototype);
13200
+ message.botUserId = 0n;
13201
+ message.commands = [];
13202
+ if (value !== undefined)
13203
+ import_runtime3.reflectionMergePartial(this, message, value);
13204
+ return message;
13205
+ }
13206
+ internalBinaryRead(reader, length, options, target) {
13207
+ let message = target ?? this.create(), end = reader.pos + length;
13208
+ while (reader.pos < end) {
13209
+ let [fieldNo, wireType] = reader.tag();
13210
+ switch (fieldNo) {
13211
+ case 1:
13212
+ message.botUserId = reader.int64().toBigInt();
12483
13213
  break;
12484
- case 3:
12485
- message.attachmentId = reader.int64().toBigInt();
13214
+ case 2:
13215
+ message.commands.push(BotCommand.internalBinaryRead(reader, reader.uint32(), options));
12486
13216
  break;
12487
13217
  default:
12488
13218
  let u = options.readUnknownField;
@@ -12496,29 +13226,27 @@ class DeleteMessageAttachmentInput$Type extends import_runtime4.MessageType {
12496
13226
  return message;
12497
13227
  }
12498
13228
  internalBinaryWrite(message, writer, options) {
12499
- if (message.peerId)
12500
- InputPeer.internalBinaryWrite(message.peerId, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
12501
- if (message.messageId !== 0n)
12502
- writer.tag(2, import_runtime.WireType.Varint).int64(message.messageId);
12503
- if (message.attachmentId !== 0n)
12504
- writer.tag(3, import_runtime.WireType.Varint).int64(message.attachmentId);
13229
+ if (message.botUserId !== 0n)
13230
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.botUserId);
13231
+ for (let i = 0;i < message.commands.length; i++)
13232
+ BotCommand.internalBinaryWrite(message.commands[i], writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
12505
13233
  let u = options.writeUnknownFields;
12506
13234
  if (u !== false)
12507
13235
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
12508
13236
  return writer;
12509
13237
  }
12510
13238
  }
12511
- var DeleteMessageAttachmentInput = new DeleteMessageAttachmentInput$Type;
13239
+ var SetBotCommandsInput = new SetBotCommandsInput$Type;
12512
13240
 
12513
- class DeleteMessageAttachmentResult$Type extends import_runtime4.MessageType {
13241
+ class SetBotCommandsResult$Type extends import_runtime4.MessageType {
12514
13242
  constructor() {
12515
- super("DeleteMessageAttachmentResult", [
12516
- { no: 1, name: "updates", kind: "message", repeat: 1, T: () => Update }
13243
+ super("SetBotCommandsResult", [
13244
+ { no: 1, name: "commands", kind: "message", repeat: 1, T: () => BotCommand }
12517
13245
  ]);
12518
13246
  }
12519
13247
  create(value) {
12520
13248
  const message = globalThis.Object.create(this.messagePrototype);
12521
- message.updates = [];
13249
+ message.commands = [];
12522
13250
  if (value !== undefined)
12523
13251
  import_runtime3.reflectionMergePartial(this, message, value);
12524
13252
  return message;
@@ -12529,7 +13257,7 @@ class DeleteMessageAttachmentResult$Type extends import_runtime4.MessageType {
12529
13257
  let [fieldNo, wireType] = reader.tag();
12530
13258
  switch (fieldNo) {
12531
13259
  case 1:
12532
- message.updates.push(Update.internalBinaryRead(reader, reader.uint32(), options));
13260
+ message.commands.push(BotCommand.internalBinaryRead(reader, reader.uint32(), options));
12533
13261
  break;
12534
13262
  default:
12535
13263
  let u = options.readUnknownField;
@@ -12543,25 +13271,24 @@ class DeleteMessageAttachmentResult$Type extends import_runtime4.MessageType {
12543
13271
  return message;
12544
13272
  }
12545
13273
  internalBinaryWrite(message, writer, options) {
12546
- for (let i = 0;i < message.updates.length; i++)
12547
- Update.internalBinaryWrite(message.updates[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
13274
+ for (let i = 0;i < message.commands.length; i++)
13275
+ BotCommand.internalBinaryWrite(message.commands[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
12548
13276
  let u = options.writeUnknownFields;
12549
13277
  if (u !== false)
12550
13278
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
12551
13279
  return writer;
12552
13280
  }
12553
13281
  }
12554
- var DeleteMessageAttachmentResult = new DeleteMessageAttachmentResult$Type;
13282
+ var SetBotCommandsResult = new SetBotCommandsResult$Type;
12555
13283
 
12556
- class RevokeSessionInput$Type extends import_runtime4.MessageType {
13284
+ class GetPeerBotCommandsInput$Type extends import_runtime4.MessageType {
12557
13285
  constructor() {
12558
- super("RevokeSessionInput", [
12559
- { no: 1, name: "session_id", kind: "scalar", T: 3, L: 0 }
13286
+ super("GetPeerBotCommandsInput", [
13287
+ { no: 1, name: "peer_id", kind: "message", T: () => InputPeer }
12560
13288
  ]);
12561
13289
  }
12562
13290
  create(value) {
12563
13291
  const message = globalThis.Object.create(this.messagePrototype);
12564
- message.sessionId = 0n;
12565
13292
  if (value !== undefined)
12566
13293
  import_runtime3.reflectionMergePartial(this, message, value);
12567
13294
  return message;
@@ -12572,7 +13299,7 @@ class RevokeSessionInput$Type extends import_runtime4.MessageType {
12572
13299
  let [fieldNo, wireType] = reader.tag();
12573
13300
  switch (fieldNo) {
12574
13301
  case 1:
12575
- message.sessionId = reader.int64().toBigInt();
13302
+ message.peerId = InputPeer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
12576
13303
  break;
12577
13304
  default:
12578
13305
  let u = options.readUnknownField;
@@ -12586,27 +13313,25 @@ class RevokeSessionInput$Type extends import_runtime4.MessageType {
12586
13313
  return message;
12587
13314
  }
12588
13315
  internalBinaryWrite(message, writer, options) {
12589
- if (message.sessionId !== 0n)
12590
- writer.tag(1, import_runtime.WireType.Varint).int64(message.sessionId);
13316
+ if (message.peerId)
13317
+ InputPeer.internalBinaryWrite(message.peerId, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
12591
13318
  let u = options.writeUnknownFields;
12592
13319
  if (u !== false)
12593
13320
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
12594
13321
  return writer;
12595
13322
  }
12596
13323
  }
12597
- var RevokeSessionInput = new RevokeSessionInput$Type;
13324
+ var GetPeerBotCommandsInput = new GetPeerBotCommandsInput$Type;
12598
13325
 
12599
- class RevokeSessionResult$Type extends import_runtime4.MessageType {
13326
+ class GetPeerBotCommandsResult$Type extends import_runtime4.MessageType {
12600
13327
  constructor() {
12601
- super("RevokeSessionResult", [
12602
- { no: 1, name: "revoked", kind: "scalar", T: 8 },
12603
- { no: 2, name: "already_revoked", kind: "scalar", T: 8 }
13328
+ super("GetPeerBotCommandsResult", [
13329
+ { no: 1, name: "bots", kind: "message", repeat: 1, T: () => PeerBotCommands }
12604
13330
  ]);
12605
13331
  }
12606
13332
  create(value) {
12607
13333
  const message = globalThis.Object.create(this.messagePrototype);
12608
- message.revoked = false;
12609
- message.alreadyRevoked = false;
13334
+ message.bots = [];
12610
13335
  if (value !== undefined)
12611
13336
  import_runtime3.reflectionMergePartial(this, message, value);
12612
13337
  return message;
@@ -12617,10 +13342,7 @@ class RevokeSessionResult$Type extends import_runtime4.MessageType {
12617
13342
  let [fieldNo, wireType] = reader.tag();
12618
13343
  switch (fieldNo) {
12619
13344
  case 1:
12620
- message.revoked = reader.bool();
12621
- break;
12622
- case 2:
12623
- message.alreadyRevoked = reader.bool();
13345
+ message.bots.push(PeerBotCommands.internalBinaryRead(reader, reader.uint32(), options));
12624
13346
  break;
12625
13347
  default:
12626
13348
  let u = options.readUnknownField;
@@ -12634,30 +13356,25 @@ class RevokeSessionResult$Type extends import_runtime4.MessageType {
12634
13356
  return message;
12635
13357
  }
12636
13358
  internalBinaryWrite(message, writer, options) {
12637
- if (message.revoked !== false)
12638
- writer.tag(1, import_runtime.WireType.Varint).bool(message.revoked);
12639
- if (message.alreadyRevoked !== false)
12640
- writer.tag(2, import_runtime.WireType.Varint).bool(message.alreadyRevoked);
13359
+ for (let i = 0;i < message.bots.length; i++)
13360
+ PeerBotCommands.internalBinaryWrite(message.bots[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
12641
13361
  let u = options.writeUnknownFields;
12642
13362
  if (u !== false)
12643
13363
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
12644
13364
  return writer;
12645
13365
  }
12646
13366
  }
12647
- var RevokeSessionResult = new RevokeSessionResult$Type;
13367
+ var GetPeerBotCommandsResult = new GetPeerBotCommandsResult$Type;
12648
13368
 
12649
- class BotCommand$Type extends import_runtime4.MessageType {
13369
+ class RevealBotTokenInput$Type extends import_runtime4.MessageType {
12650
13370
  constructor() {
12651
- super("BotCommand", [
12652
- { no: 1, name: "command", kind: "scalar", T: 9 },
12653
- { no: 2, name: "description", kind: "scalar", T: 9 },
12654
- { no: 3, name: "sort_order", kind: "scalar", opt: true, T: 5 }
13371
+ super("RevealBotTokenInput", [
13372
+ { no: 1, name: "bot_user_id", kind: "scalar", T: 3, L: 0 }
12655
13373
  ]);
12656
13374
  }
12657
13375
  create(value) {
12658
13376
  const message = globalThis.Object.create(this.messagePrototype);
12659
- message.command = "";
12660
- message.description = "";
13377
+ message.botUserId = 0n;
12661
13378
  if (value !== undefined)
12662
13379
  import_runtime3.reflectionMergePartial(this, message, value);
12663
13380
  return message;
@@ -12668,13 +13385,7 @@ class BotCommand$Type extends import_runtime4.MessageType {
12668
13385
  let [fieldNo, wireType] = reader.tag();
12669
13386
  switch (fieldNo) {
12670
13387
  case 1:
12671
- message.command = reader.string();
12672
- break;
12673
- case 2:
12674
- message.description = reader.string();
12675
- break;
12676
- case 3:
12677
- message.sortOrder = reader.int32();
13388
+ message.botUserId = reader.int64().toBigInt();
12678
13389
  break;
12679
13390
  default:
12680
13391
  let u = options.readUnknownField;
@@ -12688,30 +13399,25 @@ class BotCommand$Type extends import_runtime4.MessageType {
12688
13399
  return message;
12689
13400
  }
12690
13401
  internalBinaryWrite(message, writer, options) {
12691
- if (message.command !== "")
12692
- writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.command);
12693
- if (message.description !== "")
12694
- writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.description);
12695
- if (message.sortOrder !== undefined)
12696
- writer.tag(3, import_runtime.WireType.Varint).int32(message.sortOrder);
13402
+ if (message.botUserId !== 0n)
13403
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.botUserId);
12697
13404
  let u = options.writeUnknownFields;
12698
13405
  if (u !== false)
12699
13406
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
12700
13407
  return writer;
12701
13408
  }
12702
13409
  }
12703
- var BotCommand = new BotCommand$Type;
13410
+ var RevealBotTokenInput = new RevealBotTokenInput$Type;
12704
13411
 
12705
- class PeerBotCommands$Type extends import_runtime4.MessageType {
13412
+ class RevealBotTokenResult$Type extends import_runtime4.MessageType {
12706
13413
  constructor() {
12707
- super("PeerBotCommands", [
12708
- { no: 1, name: "bot", kind: "message", T: () => User },
12709
- { no: 2, name: "commands", kind: "message", repeat: 1, T: () => BotCommand }
13414
+ super("RevealBotTokenResult", [
13415
+ { no: 1, name: "token", kind: "scalar", T: 9 }
12710
13416
  ]);
12711
13417
  }
12712
13418
  create(value) {
12713
13419
  const message = globalThis.Object.create(this.messagePrototype);
12714
- message.commands = [];
13420
+ message.token = "";
12715
13421
  if (value !== undefined)
12716
13422
  import_runtime3.reflectionMergePartial(this, message, value);
12717
13423
  return message;
@@ -12722,10 +13428,7 @@ class PeerBotCommands$Type extends import_runtime4.MessageType {
12722
13428
  let [fieldNo, wireType] = reader.tag();
12723
13429
  switch (fieldNo) {
12724
13430
  case 1:
12725
- message.bot = User.internalBinaryRead(reader, reader.uint32(), options, message.bot);
12726
- break;
12727
- case 2:
12728
- message.commands.push(BotCommand.internalBinaryRead(reader, reader.uint32(), options));
13431
+ message.token = reader.string();
12729
13432
  break;
12730
13433
  default:
12731
13434
  let u = options.readUnknownField;
@@ -12739,21 +13442,19 @@ class PeerBotCommands$Type extends import_runtime4.MessageType {
12739
13442
  return message;
12740
13443
  }
12741
13444
  internalBinaryWrite(message, writer, options) {
12742
- if (message.bot)
12743
- User.internalBinaryWrite(message.bot, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
12744
- for (let i = 0;i < message.commands.length; i++)
12745
- BotCommand.internalBinaryWrite(message.commands[i], writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
13445
+ if (message.token !== "")
13446
+ writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.token);
12746
13447
  let u = options.writeUnknownFields;
12747
13448
  if (u !== false)
12748
13449
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
12749
13450
  return writer;
12750
13451
  }
12751
13452
  }
12752
- var PeerBotCommands = new PeerBotCommands$Type;
13453
+ var RevealBotTokenResult = new RevealBotTokenResult$Type;
12753
13454
 
12754
- class GetBotCommandsInput$Type extends import_runtime4.MessageType {
13455
+ class RotateBotTokenInput$Type extends import_runtime4.MessageType {
12755
13456
  constructor() {
12756
- super("GetBotCommandsInput", [
13457
+ super("RotateBotTokenInput", [
12757
13458
  { no: 1, name: "bot_user_id", kind: "scalar", T: 3, L: 0 }
12758
13459
  ]);
12759
13460
  }
@@ -12792,17 +13493,17 @@ class GetBotCommandsInput$Type extends import_runtime4.MessageType {
12792
13493
  return writer;
12793
13494
  }
12794
13495
  }
12795
- var GetBotCommandsInput = new GetBotCommandsInput$Type;
13496
+ var RotateBotTokenInput = new RotateBotTokenInput$Type;
12796
13497
 
12797
- class GetBotCommandsResult$Type extends import_runtime4.MessageType {
13498
+ class RotateBotTokenResult$Type extends import_runtime4.MessageType {
12798
13499
  constructor() {
12799
- super("GetBotCommandsResult", [
12800
- { no: 1, name: "commands", kind: "message", repeat: 1, T: () => BotCommand }
13500
+ super("RotateBotTokenResult", [
13501
+ { no: 1, name: "token", kind: "scalar", T: 9 }
12801
13502
  ]);
12802
13503
  }
12803
13504
  create(value) {
12804
13505
  const message = globalThis.Object.create(this.messagePrototype);
12805
- message.commands = [];
13506
+ message.token = "";
12806
13507
  if (value !== undefined)
12807
13508
  import_runtime3.reflectionMergePartial(this, message, value);
12808
13509
  return message;
@@ -12813,7 +13514,7 @@ class GetBotCommandsResult$Type extends import_runtime4.MessageType {
12813
13514
  let [fieldNo, wireType] = reader.tag();
12814
13515
  switch (fieldNo) {
12815
13516
  case 1:
12816
- message.commands.push(BotCommand.internalBinaryRead(reader, reader.uint32(), options));
13517
+ message.token = reader.string();
12817
13518
  break;
12818
13519
  default:
12819
13520
  let u = options.readUnknownField;
@@ -12827,27 +13528,27 @@ class GetBotCommandsResult$Type extends import_runtime4.MessageType {
12827
13528
  return message;
12828
13529
  }
12829
13530
  internalBinaryWrite(message, writer, options) {
12830
- for (let i = 0;i < message.commands.length; i++)
12831
- BotCommand.internalBinaryWrite(message.commands[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
13531
+ if (message.token !== "")
13532
+ writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.token);
12832
13533
  let u = options.writeUnknownFields;
12833
13534
  if (u !== false)
12834
13535
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
12835
13536
  return writer;
12836
13537
  }
12837
13538
  }
12838
- var GetBotCommandsResult = new GetBotCommandsResult$Type;
13539
+ var RotateBotTokenResult = new RotateBotTokenResult$Type;
12839
13540
 
12840
- class SetBotCommandsInput$Type extends import_runtime4.MessageType {
13541
+ class UpdateBotProfileInput$Type extends import_runtime4.MessageType {
12841
13542
  constructor() {
12842
- super("SetBotCommandsInput", [
13543
+ super("UpdateBotProfileInput", [
12843
13544
  { no: 1, name: "bot_user_id", kind: "scalar", T: 3, L: 0 },
12844
- { no: 2, name: "commands", kind: "message", repeat: 1, T: () => BotCommand }
13545
+ { no: 2, name: "name", kind: "scalar", opt: true, T: 9 },
13546
+ { no: 3, name: "photo_file_unique_id", kind: "scalar", opt: true, T: 9 }
12845
13547
  ]);
12846
13548
  }
12847
13549
  create(value) {
12848
13550
  const message = globalThis.Object.create(this.messagePrototype);
12849
13551
  message.botUserId = 0n;
12850
- message.commands = [];
12851
13552
  if (value !== undefined)
12852
13553
  import_runtime3.reflectionMergePartial(this, message, value);
12853
13554
  return message;
@@ -12861,7 +13562,10 @@ class SetBotCommandsInput$Type extends import_runtime4.MessageType {
12861
13562
  message.botUserId = reader.int64().toBigInt();
12862
13563
  break;
12863
13564
  case 2:
12864
- message.commands.push(BotCommand.internalBinaryRead(reader, reader.uint32(), options));
13565
+ message.name = reader.string();
13566
+ break;
13567
+ case 3:
13568
+ message.photoFileUniqueId = reader.string();
12865
13569
  break;
12866
13570
  default:
12867
13571
  let u = options.readUnknownField;
@@ -12877,25 +13581,26 @@ class SetBotCommandsInput$Type extends import_runtime4.MessageType {
12877
13581
  internalBinaryWrite(message, writer, options) {
12878
13582
  if (message.botUserId !== 0n)
12879
13583
  writer.tag(1, import_runtime.WireType.Varint).int64(message.botUserId);
12880
- for (let i = 0;i < message.commands.length; i++)
12881
- BotCommand.internalBinaryWrite(message.commands[i], writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
13584
+ if (message.name !== undefined)
13585
+ writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.name);
13586
+ if (message.photoFileUniqueId !== undefined)
13587
+ writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.photoFileUniqueId);
12882
13588
  let u = options.writeUnknownFields;
12883
13589
  if (u !== false)
12884
13590
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
12885
13591
  return writer;
12886
13592
  }
12887
13593
  }
12888
- var SetBotCommandsInput = new SetBotCommandsInput$Type;
13594
+ var UpdateBotProfileInput = new UpdateBotProfileInput$Type;
12889
13595
 
12890
- class SetBotCommandsResult$Type extends import_runtime4.MessageType {
13596
+ class UpdateBotProfileResult$Type extends import_runtime4.MessageType {
12891
13597
  constructor() {
12892
- super("SetBotCommandsResult", [
12893
- { no: 1, name: "commands", kind: "message", repeat: 1, T: () => BotCommand }
13598
+ super("UpdateBotProfileResult", [
13599
+ { no: 1, name: "bot", kind: "message", T: () => User }
12894
13600
  ]);
12895
13601
  }
12896
13602
  create(value) {
12897
13603
  const message = globalThis.Object.create(this.messagePrototype);
12898
- message.commands = [];
12899
13604
  if (value !== undefined)
12900
13605
  import_runtime3.reflectionMergePartial(this, message, value);
12901
13606
  return message;
@@ -12906,7 +13611,7 @@ class SetBotCommandsResult$Type extends import_runtime4.MessageType {
12906
13611
  let [fieldNo, wireType] = reader.tag();
12907
13612
  switch (fieldNo) {
12908
13613
  case 1:
12909
- message.commands.push(BotCommand.internalBinaryRead(reader, reader.uint32(), options));
13614
+ message.bot = User.internalBinaryRead(reader, reader.uint32(), options, message.bot);
12910
13615
  break;
12911
13616
  default:
12912
13617
  let u = options.readUnknownField;
@@ -12920,24 +13625,32 @@ class SetBotCommandsResult$Type extends import_runtime4.MessageType {
12920
13625
  return message;
12921
13626
  }
12922
13627
  internalBinaryWrite(message, writer, options) {
12923
- for (let i = 0;i < message.commands.length; i++)
12924
- BotCommand.internalBinaryWrite(message.commands[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
13628
+ if (message.bot)
13629
+ User.internalBinaryWrite(message.bot, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
12925
13630
  let u = options.writeUnknownFields;
12926
13631
  if (u !== false)
12927
13632
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
12928
13633
  return writer;
12929
13634
  }
12930
13635
  }
12931
- var SetBotCommandsResult = new SetBotCommandsResult$Type;
13636
+ var UpdateBotProfileResult = new UpdateBotProfileResult$Type;
12932
13637
 
12933
- class GetPeerBotCommandsInput$Type extends import_runtime4.MessageType {
13638
+ class SetBotAvatarInput$Type extends import_runtime4.MessageType {
12934
13639
  constructor() {
12935
- super("GetPeerBotCommandsInput", [
12936
- { no: 1, name: "peer_id", kind: "message", T: () => InputPeer }
13640
+ super("SetBotAvatarInput", [
13641
+ { no: 1, name: "bot_user_id", kind: "scalar", T: 3, L: 0 },
13642
+ { no: 2, name: "kind", kind: "enum", T: () => ["BotAvatar.Kind", BotAvatar_Kind] },
13643
+ { no: 3, name: "display_name", kind: "scalar", T: 9 },
13644
+ { no: 4, name: "description", kind: "scalar", opt: true, T: 9 },
13645
+ { no: 5, name: "file_unique_id", kind: "scalar", T: 9 }
12937
13646
  ]);
12938
13647
  }
12939
13648
  create(value) {
12940
13649
  const message = globalThis.Object.create(this.messagePrototype);
13650
+ message.botUserId = 0n;
13651
+ message.kind = 0;
13652
+ message.displayName = "";
13653
+ message.fileUniqueId = "";
12941
13654
  if (value !== undefined)
12942
13655
  import_runtime3.reflectionMergePartial(this, message, value);
12943
13656
  return message;
@@ -12948,7 +13661,19 @@ class GetPeerBotCommandsInput$Type extends import_runtime4.MessageType {
12948
13661
  let [fieldNo, wireType] = reader.tag();
12949
13662
  switch (fieldNo) {
12950
13663
  case 1:
12951
- message.peerId = InputPeer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
13664
+ message.botUserId = reader.int64().toBigInt();
13665
+ break;
13666
+ case 2:
13667
+ message.kind = reader.int32();
13668
+ break;
13669
+ case 3:
13670
+ message.displayName = reader.string();
13671
+ break;
13672
+ case 4:
13673
+ message.description = reader.string();
13674
+ break;
13675
+ case 5:
13676
+ message.fileUniqueId = reader.string();
12952
13677
  break;
12953
13678
  default:
12954
13679
  let u = options.readUnknownField;
@@ -12962,25 +13687,32 @@ class GetPeerBotCommandsInput$Type extends import_runtime4.MessageType {
12962
13687
  return message;
12963
13688
  }
12964
13689
  internalBinaryWrite(message, writer, options) {
12965
- if (message.peerId)
12966
- InputPeer.internalBinaryWrite(message.peerId, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
13690
+ if (message.botUserId !== 0n)
13691
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.botUserId);
13692
+ if (message.kind !== 0)
13693
+ writer.tag(2, import_runtime.WireType.Varint).int32(message.kind);
13694
+ if (message.displayName !== "")
13695
+ writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.displayName);
13696
+ if (message.description !== undefined)
13697
+ writer.tag(4, import_runtime.WireType.LengthDelimited).string(message.description);
13698
+ if (message.fileUniqueId !== "")
13699
+ writer.tag(5, import_runtime.WireType.LengthDelimited).string(message.fileUniqueId);
12967
13700
  let u = options.writeUnknownFields;
12968
13701
  if (u !== false)
12969
13702
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
12970
13703
  return writer;
12971
13704
  }
12972
13705
  }
12973
- var GetPeerBotCommandsInput = new GetPeerBotCommandsInput$Type;
13706
+ var SetBotAvatarInput = new SetBotAvatarInput$Type;
12974
13707
 
12975
- class GetPeerBotCommandsResult$Type extends import_runtime4.MessageType {
13708
+ class SetBotAvatarResult$Type extends import_runtime4.MessageType {
12976
13709
  constructor() {
12977
- super("GetPeerBotCommandsResult", [
12978
- { no: 1, name: "bots", kind: "message", repeat: 1, T: () => PeerBotCommands }
13710
+ super("SetBotAvatarResult", [
13711
+ { no: 1, name: "bot", kind: "message", T: () => User }
12979
13712
  ]);
12980
13713
  }
12981
13714
  create(value) {
12982
13715
  const message = globalThis.Object.create(this.messagePrototype);
12983
- message.bots = [];
12984
13716
  if (value !== undefined)
12985
13717
  import_runtime3.reflectionMergePartial(this, message, value);
12986
13718
  return message;
@@ -12991,7 +13723,7 @@ class GetPeerBotCommandsResult$Type extends import_runtime4.MessageType {
12991
13723
  let [fieldNo, wireType] = reader.tag();
12992
13724
  switch (fieldNo) {
12993
13725
  case 1:
12994
- message.bots.push(PeerBotCommands.internalBinaryRead(reader, reader.uint32(), options));
13726
+ message.bot = User.internalBinaryRead(reader, reader.uint32(), options, message.bot);
12995
13727
  break;
12996
13728
  default:
12997
13729
  let u = options.readUnknownField;
@@ -13005,19 +13737,19 @@ class GetPeerBotCommandsResult$Type extends import_runtime4.MessageType {
13005
13737
  return message;
13006
13738
  }
13007
13739
  internalBinaryWrite(message, writer, options) {
13008
- for (let i = 0;i < message.bots.length; i++)
13009
- PeerBotCommands.internalBinaryWrite(message.bots[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
13740
+ if (message.bot)
13741
+ User.internalBinaryWrite(message.bot, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
13010
13742
  let u = options.writeUnknownFields;
13011
13743
  if (u !== false)
13012
13744
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
13013
13745
  return writer;
13014
13746
  }
13015
13747
  }
13016
- var GetPeerBotCommandsResult = new GetPeerBotCommandsResult$Type;
13748
+ var SetBotAvatarResult = new SetBotAvatarResult$Type;
13017
13749
 
13018
- class RevealBotTokenInput$Type extends import_runtime4.MessageType {
13750
+ class ClearBotAvatarInput$Type extends import_runtime4.MessageType {
13019
13751
  constructor() {
13020
- super("RevealBotTokenInput", [
13752
+ super("ClearBotAvatarInput", [
13021
13753
  { no: 1, name: "bot_user_id", kind: "scalar", T: 3, L: 0 }
13022
13754
  ]);
13023
13755
  }
@@ -13056,17 +13788,16 @@ class RevealBotTokenInput$Type extends import_runtime4.MessageType {
13056
13788
  return writer;
13057
13789
  }
13058
13790
  }
13059
- var RevealBotTokenInput = new RevealBotTokenInput$Type;
13791
+ var ClearBotAvatarInput = new ClearBotAvatarInput$Type;
13060
13792
 
13061
- class RevealBotTokenResult$Type extends import_runtime4.MessageType {
13793
+ class ClearBotAvatarResult$Type extends import_runtime4.MessageType {
13062
13794
  constructor() {
13063
- super("RevealBotTokenResult", [
13064
- { no: 1, name: "token", kind: "scalar", T: 9 }
13795
+ super("ClearBotAvatarResult", [
13796
+ { no: 1, name: "bot", kind: "message", T: () => User }
13065
13797
  ]);
13066
13798
  }
13067
13799
  create(value) {
13068
13800
  const message = globalThis.Object.create(this.messagePrototype);
13069
- message.token = "";
13070
13801
  if (value !== undefined)
13071
13802
  import_runtime3.reflectionMergePartial(this, message, value);
13072
13803
  return message;
@@ -13077,7 +13808,7 @@ class RevealBotTokenResult$Type extends import_runtime4.MessageType {
13077
13808
  let [fieldNo, wireType] = reader.tag();
13078
13809
  switch (fieldNo) {
13079
13810
  case 1:
13080
- message.token = reader.string();
13811
+ message.bot = User.internalBinaryRead(reader, reader.uint32(), options, message.bot);
13081
13812
  break;
13082
13813
  default:
13083
13814
  let u = options.readUnknownField;
@@ -13091,25 +13822,24 @@ class RevealBotTokenResult$Type extends import_runtime4.MessageType {
13091
13822
  return message;
13092
13823
  }
13093
13824
  internalBinaryWrite(message, writer, options) {
13094
- if (message.token !== "")
13095
- writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.token);
13825
+ if (message.bot)
13826
+ User.internalBinaryWrite(message.bot, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
13096
13827
  let u = options.writeUnknownFields;
13097
13828
  if (u !== false)
13098
13829
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
13099
13830
  return writer;
13100
13831
  }
13101
13832
  }
13102
- var RevealBotTokenResult = new RevealBotTokenResult$Type;
13833
+ var ClearBotAvatarResult = new ClearBotAvatarResult$Type;
13103
13834
 
13104
- class RotateBotTokenInput$Type extends import_runtime4.MessageType {
13835
+ class GetBotPresenceInput$Type extends import_runtime4.MessageType {
13105
13836
  constructor() {
13106
- super("RotateBotTokenInput", [
13107
- { no: 1, name: "bot_user_id", kind: "scalar", T: 3, L: 0 }
13837
+ super("GetBotPresenceInput", [
13838
+ { no: 1, name: "peer_id", kind: "message", T: () => InputPeer }
13108
13839
  ]);
13109
13840
  }
13110
13841
  create(value) {
13111
13842
  const message = globalThis.Object.create(this.messagePrototype);
13112
- message.botUserId = 0n;
13113
13843
  if (value !== undefined)
13114
13844
  import_runtime3.reflectionMergePartial(this, message, value);
13115
13845
  return message;
@@ -13120,7 +13850,7 @@ class RotateBotTokenInput$Type extends import_runtime4.MessageType {
13120
13850
  let [fieldNo, wireType] = reader.tag();
13121
13851
  switch (fieldNo) {
13122
13852
  case 1:
13123
- message.botUserId = reader.int64().toBigInt();
13853
+ message.peerId = InputPeer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
13124
13854
  break;
13125
13855
  default:
13126
13856
  let u = options.readUnknownField;
@@ -13134,25 +13864,27 @@ class RotateBotTokenInput$Type extends import_runtime4.MessageType {
13134
13864
  return message;
13135
13865
  }
13136
13866
  internalBinaryWrite(message, writer, options) {
13137
- if (message.botUserId !== 0n)
13138
- writer.tag(1, import_runtime.WireType.Varint).int64(message.botUserId);
13867
+ if (message.peerId)
13868
+ InputPeer.internalBinaryWrite(message.peerId, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
13139
13869
  let u = options.writeUnknownFields;
13140
13870
  if (u !== false)
13141
13871
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
13142
13872
  return writer;
13143
13873
  }
13144
13874
  }
13145
- var RotateBotTokenInput = new RotateBotTokenInput$Type;
13875
+ var GetBotPresenceInput = new GetBotPresenceInput$Type;
13146
13876
 
13147
- class RotateBotTokenResult$Type extends import_runtime4.MessageType {
13877
+ class GetBotPresenceResult$Type extends import_runtime4.MessageType {
13148
13878
  constructor() {
13149
- super("RotateBotTokenResult", [
13150
- { no: 1, name: "token", kind: "scalar", T: 9 }
13879
+ super("GetBotPresenceResult", [
13880
+ { no: 1, name: "bot_user_id", kind: "scalar", opt: true, T: 3, L: 0 },
13881
+ { no: 2, name: "avatar", kind: "message", T: () => BotAvatar },
13882
+ { no: 3, name: "state", kind: "message", T: () => BotPresenceState },
13883
+ { no: 4, name: "peer_id", kind: "message", T: () => Peer }
13151
13884
  ]);
13152
13885
  }
13153
13886
  create(value) {
13154
13887
  const message = globalThis.Object.create(this.messagePrototype);
13155
- message.token = "";
13156
13888
  if (value !== undefined)
13157
13889
  import_runtime3.reflectionMergePartial(this, message, value);
13158
13890
  return message;
@@ -13163,7 +13895,16 @@ class RotateBotTokenResult$Type extends import_runtime4.MessageType {
13163
13895
  let [fieldNo, wireType] = reader.tag();
13164
13896
  switch (fieldNo) {
13165
13897
  case 1:
13166
- message.token = reader.string();
13898
+ message.botUserId = reader.int64().toBigInt();
13899
+ break;
13900
+ case 2:
13901
+ message.avatar = BotAvatar.internalBinaryRead(reader, reader.uint32(), options, message.avatar);
13902
+ break;
13903
+ case 3:
13904
+ message.state = BotPresenceState.internalBinaryRead(reader, reader.uint32(), options, message.state);
13905
+ break;
13906
+ case 4:
13907
+ message.peerId = Peer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
13167
13908
  break;
13168
13909
  default:
13169
13910
  let u = options.readUnknownField;
@@ -13177,27 +13918,31 @@ class RotateBotTokenResult$Type extends import_runtime4.MessageType {
13177
13918
  return message;
13178
13919
  }
13179
13920
  internalBinaryWrite(message, writer, options) {
13180
- if (message.token !== "")
13181
- writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.token);
13921
+ if (message.botUserId !== undefined)
13922
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.botUserId);
13923
+ if (message.avatar)
13924
+ BotAvatar.internalBinaryWrite(message.avatar, writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
13925
+ if (message.state)
13926
+ BotPresenceState.internalBinaryWrite(message.state, writer.tag(3, import_runtime.WireType.LengthDelimited).fork(), options).join();
13927
+ if (message.peerId)
13928
+ Peer.internalBinaryWrite(message.peerId, writer.tag(4, import_runtime.WireType.LengthDelimited).fork(), options).join();
13182
13929
  let u = options.writeUnknownFields;
13183
13930
  if (u !== false)
13184
13931
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
13185
13932
  return writer;
13186
13933
  }
13187
13934
  }
13188
- var RotateBotTokenResult = new RotateBotTokenResult$Type;
13935
+ var GetBotPresenceResult = new GetBotPresenceResult$Type;
13189
13936
 
13190
- class UpdateBotProfileInput$Type extends import_runtime4.MessageType {
13937
+ class SetBotPresenceStateInput$Type extends import_runtime4.MessageType {
13191
13938
  constructor() {
13192
- super("UpdateBotProfileInput", [
13193
- { no: 1, name: "bot_user_id", kind: "scalar", T: 3, L: 0 },
13194
- { no: 2, name: "name", kind: "scalar", opt: true, T: 9 },
13195
- { no: 3, name: "photo_file_unique_id", kind: "scalar", opt: true, T: 9 }
13939
+ super("SetBotPresenceStateInput", [
13940
+ { no: 1, name: "peer_id", kind: "message", T: () => InputPeer },
13941
+ { no: 2, name: "state", kind: "message", T: () => BotPresenceState }
13196
13942
  ]);
13197
13943
  }
13198
13944
  create(value) {
13199
13945
  const message = globalThis.Object.create(this.messagePrototype);
13200
- message.botUserId = 0n;
13201
13946
  if (value !== undefined)
13202
13947
  import_runtime3.reflectionMergePartial(this, message, value);
13203
13948
  return message;
@@ -13208,13 +13953,10 @@ class UpdateBotProfileInput$Type extends import_runtime4.MessageType {
13208
13953
  let [fieldNo, wireType] = reader.tag();
13209
13954
  switch (fieldNo) {
13210
13955
  case 1:
13211
- message.botUserId = reader.int64().toBigInt();
13956
+ message.peerId = InputPeer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
13212
13957
  break;
13213
13958
  case 2:
13214
- message.name = reader.string();
13215
- break;
13216
- case 3:
13217
- message.photoFileUniqueId = reader.string();
13959
+ message.state = BotPresenceState.internalBinaryRead(reader, reader.uint32(), options, message.state);
13218
13960
  break;
13219
13961
  default:
13220
13962
  let u = options.readUnknownField;
@@ -13228,25 +13970,21 @@ class UpdateBotProfileInput$Type extends import_runtime4.MessageType {
13228
13970
  return message;
13229
13971
  }
13230
13972
  internalBinaryWrite(message, writer, options) {
13231
- if (message.botUserId !== 0n)
13232
- writer.tag(1, import_runtime.WireType.Varint).int64(message.botUserId);
13233
- if (message.name !== undefined)
13234
- writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.name);
13235
- if (message.photoFileUniqueId !== undefined)
13236
- writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.photoFileUniqueId);
13973
+ if (message.peerId)
13974
+ InputPeer.internalBinaryWrite(message.peerId, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
13975
+ if (message.state)
13976
+ BotPresenceState.internalBinaryWrite(message.state, writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
13237
13977
  let u = options.writeUnknownFields;
13238
13978
  if (u !== false)
13239
13979
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
13240
13980
  return writer;
13241
13981
  }
13242
13982
  }
13243
- var UpdateBotProfileInput = new UpdateBotProfileInput$Type;
13983
+ var SetBotPresenceStateInput = new SetBotPresenceStateInput$Type;
13244
13984
 
13245
- class UpdateBotProfileResult$Type extends import_runtime4.MessageType {
13985
+ class SetBotPresenceStateResult$Type extends import_runtime4.MessageType {
13246
13986
  constructor() {
13247
- super("UpdateBotProfileResult", [
13248
- { no: 1, name: "bot", kind: "message", T: () => User }
13249
- ]);
13987
+ super("SetBotPresenceStateResult", []);
13250
13988
  }
13251
13989
  create(value) {
13252
13990
  const message = globalThis.Object.create(this.messagePrototype);
@@ -13255,34 +13993,16 @@ class UpdateBotProfileResult$Type extends import_runtime4.MessageType {
13255
13993
  return message;
13256
13994
  }
13257
13995
  internalBinaryRead(reader, length, options, target) {
13258
- let message = target ?? this.create(), end = reader.pos + length;
13259
- while (reader.pos < end) {
13260
- let [fieldNo, wireType] = reader.tag();
13261
- switch (fieldNo) {
13262
- case 1:
13263
- message.bot = User.internalBinaryRead(reader, reader.uint32(), options, message.bot);
13264
- break;
13265
- default:
13266
- let u = options.readUnknownField;
13267
- if (u === "throw")
13268
- throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
13269
- let d = reader.skip(wireType);
13270
- if (u !== false)
13271
- (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
13272
- }
13273
- }
13274
- return message;
13996
+ return target ?? this.create();
13275
13997
  }
13276
13998
  internalBinaryWrite(message, writer, options) {
13277
- if (message.bot)
13278
- User.internalBinaryWrite(message.bot, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
13279
13999
  let u = options.writeUnknownFields;
13280
14000
  if (u !== false)
13281
14001
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
13282
14002
  return writer;
13283
14003
  }
13284
14004
  }
13285
- var UpdateBotProfileResult = new UpdateBotProfileResult$Type;
14005
+ var SetBotPresenceStateResult = new SetBotPresenceStateResult$Type;
13286
14006
 
13287
14007
  class GetUserSettingsInput$Type extends import_runtime4.MessageType {
13288
14008
  constructor() {
@@ -16422,7 +17142,9 @@ class Update$Type extends import_runtime4.MessageType {
16422
17142
  { no: 34, name: "chat_open", kind: "message", oneof: "update", T: () => UpdateChatOpen },
16423
17143
  { no: 35, name: "message_action_invoked", kind: "message", oneof: "update", T: () => UpdateMessageActionInvoked },
16424
17144
  { no: 36, name: "message_action_answered", kind: "message", oneof: "update", T: () => UpdateMessageActionAnswered },
16425
- { no: 37, name: "clear_chat_history", kind: "message", oneof: "update", T: () => UpdateClearChatHistory }
17145
+ { no: 37, name: "clear_chat_history", kind: "message", oneof: "update", T: () => UpdateClearChatHistory },
17146
+ { no: 38, name: "bot_presence", kind: "message", oneof: "update", T: () => UpdateBotPresence },
17147
+ { no: 39, name: "dialog_follow_mode", kind: "message", oneof: "update", T: () => UpdateDialogFollowMode }
16426
17148
  ]);
16427
17149
  }
16428
17150
  create(value) {
@@ -16647,6 +17369,18 @@ class Update$Type extends import_runtime4.MessageType {
16647
17369
  clearChatHistory: UpdateClearChatHistory.internalBinaryRead(reader, reader.uint32(), options, message.update.clearChatHistory)
16648
17370
  };
16649
17371
  break;
17372
+ case 38:
17373
+ message.update = {
17374
+ oneofKind: "botPresence",
17375
+ botPresence: UpdateBotPresence.internalBinaryRead(reader, reader.uint32(), options, message.update.botPresence)
17376
+ };
17377
+ break;
17378
+ case 39:
17379
+ message.update = {
17380
+ oneofKind: "dialogFollowMode",
17381
+ dialogFollowMode: UpdateDialogFollowMode.internalBinaryRead(reader, reader.uint32(), options, message.update.dialogFollowMode)
17382
+ };
17383
+ break;
16650
17384
  default:
16651
17385
  let u = options.readUnknownField;
16652
17386
  if (u === "throw")
@@ -16731,6 +17465,10 @@ class Update$Type extends import_runtime4.MessageType {
16731
17465
  UpdateMessageActionAnswered.internalBinaryWrite(message.update.messageActionAnswered, writer.tag(36, import_runtime.WireType.LengthDelimited).fork(), options).join();
16732
17466
  if (message.update.oneofKind === "clearChatHistory")
16733
17467
  UpdateClearChatHistory.internalBinaryWrite(message.update.clearChatHistory, writer.tag(37, import_runtime.WireType.LengthDelimited).fork(), options).join();
17468
+ if (message.update.oneofKind === "botPresence")
17469
+ UpdateBotPresence.internalBinaryWrite(message.update.botPresence, writer.tag(38, import_runtime.WireType.LengthDelimited).fork(), options).join();
17470
+ if (message.update.oneofKind === "dialogFollowMode")
17471
+ UpdateDialogFollowMode.internalBinaryWrite(message.update.dialogFollowMode, writer.tag(39, import_runtime.WireType.LengthDelimited).fork(), options).join();
16734
17472
  let u = options.writeUnknownFields;
16735
17473
  if (u !== false)
16736
17474
  (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -17591,6 +18329,54 @@ class UpdateDialogNotificationSettings$Type extends import_runtime4.MessageType
17591
18329
  }
17592
18330
  var UpdateDialogNotificationSettings = new UpdateDialogNotificationSettings$Type;
17593
18331
 
18332
+ class UpdateDialogFollowMode$Type extends import_runtime4.MessageType {
18333
+ constructor() {
18334
+ super("UpdateDialogFollowMode", [
18335
+ { no: 1, name: "peer_id", kind: "message", T: () => Peer },
18336
+ { no: 2, name: "follow_mode", kind: "enum", opt: true, T: () => ["DialogFollowMode", DialogFollowMode] }
18337
+ ]);
18338
+ }
18339
+ create(value) {
18340
+ const message = globalThis.Object.create(this.messagePrototype);
18341
+ if (value !== undefined)
18342
+ import_runtime3.reflectionMergePartial(this, message, value);
18343
+ return message;
18344
+ }
18345
+ internalBinaryRead(reader, length, options, target) {
18346
+ let message = target ?? this.create(), end = reader.pos + length;
18347
+ while (reader.pos < end) {
18348
+ let [fieldNo, wireType] = reader.tag();
18349
+ switch (fieldNo) {
18350
+ case 1:
18351
+ message.peerId = Peer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
18352
+ break;
18353
+ case 2:
18354
+ message.followMode = reader.int32();
18355
+ break;
18356
+ default:
18357
+ let u = options.readUnknownField;
18358
+ if (u === "throw")
18359
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
18360
+ let d = reader.skip(wireType);
18361
+ if (u !== false)
18362
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
18363
+ }
18364
+ }
18365
+ return message;
18366
+ }
18367
+ internalBinaryWrite(message, writer, options) {
18368
+ if (message.peerId)
18369
+ Peer.internalBinaryWrite(message.peerId, writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
18370
+ if (message.followMode !== undefined)
18371
+ writer.tag(2, import_runtime.WireType.Varint).int32(message.followMode);
18372
+ let u = options.writeUnknownFields;
18373
+ if (u !== false)
18374
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
18375
+ return writer;
18376
+ }
18377
+ }
18378
+ var UpdateDialogFollowMode = new UpdateDialogFollowMode$Type;
18379
+
17594
18380
  class UpdateNewChat$Type extends import_runtime4.MessageType {
17595
18381
  constructor() {
17596
18382
  super("UpdateNewChat", [
@@ -18116,6 +18902,74 @@ class UpdateClearChatHistory$Type extends import_runtime4.MessageType {
18116
18902
  }
18117
18903
  var UpdateClearChatHistory = new UpdateClearChatHistory$Type;
18118
18904
 
18905
+ class UpdateBotPresence$Type extends import_runtime4.MessageType {
18906
+ constructor() {
18907
+ super("UpdateBotPresence", [
18908
+ { no: 1, name: "bot_user_id", kind: "scalar", T: 3, L: 0 },
18909
+ { no: 2, name: "peer_id", kind: "message", T: () => Peer },
18910
+ { no: 3, name: "state", kind: "message", T: () => BotPresenceState },
18911
+ { no: 4, name: "avatar", kind: "message", T: () => BotAvatar },
18912
+ { no: 5, name: "avatar_changed", kind: "scalar", T: 8 }
18913
+ ]);
18914
+ }
18915
+ create(value) {
18916
+ const message = globalThis.Object.create(this.messagePrototype);
18917
+ message.botUserId = 0n;
18918
+ message.avatarChanged = false;
18919
+ if (value !== undefined)
18920
+ import_runtime3.reflectionMergePartial(this, message, value);
18921
+ return message;
18922
+ }
18923
+ internalBinaryRead(reader, length, options, target) {
18924
+ let message = target ?? this.create(), end = reader.pos + length;
18925
+ while (reader.pos < end) {
18926
+ let [fieldNo, wireType] = reader.tag();
18927
+ switch (fieldNo) {
18928
+ case 1:
18929
+ message.botUserId = reader.int64().toBigInt();
18930
+ break;
18931
+ case 2:
18932
+ message.peerId = Peer.internalBinaryRead(reader, reader.uint32(), options, message.peerId);
18933
+ break;
18934
+ case 3:
18935
+ message.state = BotPresenceState.internalBinaryRead(reader, reader.uint32(), options, message.state);
18936
+ break;
18937
+ case 4:
18938
+ message.avatar = BotAvatar.internalBinaryRead(reader, reader.uint32(), options, message.avatar);
18939
+ break;
18940
+ case 5:
18941
+ message.avatarChanged = reader.bool();
18942
+ break;
18943
+ default:
18944
+ let u = options.readUnknownField;
18945
+ if (u === "throw")
18946
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
18947
+ let d = reader.skip(wireType);
18948
+ if (u !== false)
18949
+ (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
18950
+ }
18951
+ }
18952
+ return message;
18953
+ }
18954
+ internalBinaryWrite(message, writer, options) {
18955
+ if (message.botUserId !== 0n)
18956
+ writer.tag(1, import_runtime.WireType.Varint).int64(message.botUserId);
18957
+ if (message.peerId)
18958
+ Peer.internalBinaryWrite(message.peerId, writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
18959
+ if (message.state)
18960
+ BotPresenceState.internalBinaryWrite(message.state, writer.tag(3, import_runtime.WireType.LengthDelimited).fork(), options).join();
18961
+ if (message.avatar)
18962
+ BotAvatar.internalBinaryWrite(message.avatar, writer.tag(4, import_runtime.WireType.LengthDelimited).fork(), options).join();
18963
+ if (message.avatarChanged !== false)
18964
+ writer.tag(5, import_runtime.WireType.Varint).bool(message.avatarChanged);
18965
+ let u = options.writeUnknownFields;
18966
+ if (u !== false)
18967
+ (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
18968
+ return writer;
18969
+ }
18970
+ }
18971
+ var UpdateBotPresence = new UpdateBotPresence$Type;
18972
+
18119
18973
  class UpdateMessageId$Type extends import_runtime4.MessageType {
18120
18974
  constructor() {
18121
18975
  super("UpdateMessageId", [
@@ -21056,7 +21910,7 @@ class InlineSdkClient {
21056
21910
  await this.handleUpdate(update);
21057
21911
  }
21058
21912
  }
21059
- async handleUpdate(update) {
21913
+ async handleUpdate(update, options) {
21060
21914
  const seq = update.seq ?? 0;
21061
21915
  const date = update.date ?? 0n;
21062
21916
  switch (update.update.oneofKind) {
@@ -21188,6 +22042,34 @@ class InlineSdkClient {
21188
22042
  });
21189
22043
  return;
21190
22044
  }
22045
+ case "participantAdd": {
22046
+ const payload = update.update.participantAdd;
22047
+ if (options?.source !== "user" && options?.source !== "space") {
22048
+ this.bumpChatSeq(payload.chatId, seq);
22049
+ }
22050
+ await this.eventStream.send({
22051
+ kind: "chat.participant.add",
22052
+ chatId: payload.chatId,
22053
+ ...payload.participant ? { participant: payload.participant } : {},
22054
+ seq,
22055
+ date
22056
+ });
22057
+ return;
22058
+ }
22059
+ case "participantDelete": {
22060
+ const payload = update.update.participantDelete;
22061
+ if (options?.source !== "user" && options?.source !== "space") {
22062
+ this.bumpChatSeq(payload.chatId, seq);
22063
+ }
22064
+ await this.eventStream.send({
22065
+ kind: "chat.participant.delete",
22066
+ chatId: payload.chatId,
22067
+ userId: payload.userId,
22068
+ seq,
22069
+ date
22070
+ });
22071
+ return;
22072
+ }
21191
22073
  case "messageActionInvoked": {
21192
22074
  const payload = update.update.messageActionInvoked;
21193
22075
  if (this.shouldSkipUserSeq(seq)) {
@@ -21288,14 +22170,14 @@ class InlineSdkClient {
21288
22170
  }
21289
22171
  }
21290
22172
  requestCatchUpUser() {
21291
- const lastUserSeq = this.state.lastUserSeq ?? 0;
21292
- if (lastUserSeq <= 0) {
22173
+ const lastUserSeq = this.state.lastUserSeq;
22174
+ if (lastUserSeq == null && !this.options.catchUpUserFromStart) {
21293
22175
  return;
21294
22176
  }
21295
22177
  if (this.userCatchUpInFlight) {
21296
22178
  return;
21297
22179
  }
21298
- this.userCatchUpInFlight = this.doCatchUpUser(lastUserSeq).catch((error) => {
22180
+ this.userCatchUpInFlight = this.doCatchUpUser(lastUserSeq ?? 0).catch((error) => {
21299
22181
  this.log.warn?.("GET_UPDATES user catch-up failed; continuing live delivery", {
21300
22182
  error: extractErrorMessage(error)
21301
22183
  });
@@ -21336,7 +22218,7 @@ class InlineSdkClient {
21336
22218
  return;
21337
22219
  }
21338
22220
  for (const update of payload.updates) {
21339
- await this.handleUpdate(update);
22221
+ await this.handleUpdate(update, { source: "user" });
21340
22222
  }
21341
22223
  this.bumpUserSeq(deliveredSeq);
21342
22224
  if (payload.date !== 0n) {
@@ -21435,7 +22317,7 @@ class InlineSdkClient {
21435
22317
  }
21436
22318
  this.bumpChatSeq(chatId, deliveredSeq);
21437
22319
  for (const update of payload.updates) {
21438
- await this.handleUpdate(update);
22320
+ await this.handleUpdate(update, { source: "chat" });
21439
22321
  }
21440
22322
  if (payload.date !== 0n) {
21441
22323
  this.state.dateCursor = payload.date;
@@ -21537,7 +22419,7 @@ class InlineSdkClient {
21537
22419
  }
21538
22420
  this.bumpSpaceSeq(spaceId, deliveredSeq);
21539
22421
  for (const update of payload.updates) {
21540
- await this.handleUpdate(update);
22422
+ await this.handleUpdate(update, { source: "space" });
21541
22423
  }
21542
22424
  if (payload.date !== 0n) {
21543
22425
  this.state.dateCursor = payload.date;
@@ -36472,6 +37354,8 @@ var InlineExecApprovalsSchema = exports_external.object({
36472
37354
  var InlineReactionNotificationsSchema = exports_external.enum(["off", "own", "all", "allowlist"]);
36473
37355
  var InlineStreamingModeSchema = exports_external.enum(["off", "partial", "block", "progress"]);
36474
37356
  var InlineStreamingCommandTextSchema = exports_external.enum(["raw", "status"]);
37357
+ var INLINE_DEFAULT_GROUP_POLICY = "open";
37358
+ var INLINE_DEFAULT_REQUIRE_MENTION = true;
36475
37359
  var InlineStreamingChunkSchema = exports_external.object({
36476
37360
  minChars: exports_external.number().int().positive().optional(),
36477
37361
  maxChars: exports_external.number().int().positive().optional(),
@@ -36543,7 +37427,7 @@ var InlineAccountSchemaBase = exports_external.object({
36543
37427
  defaultTo: InlineTargetSchema.optional(),
36544
37428
  systemPrompt: exports_external.string().optional(),
36545
37429
  groupAllowFrom: exports_external.array(InlineAllowEntrySchema).optional(),
36546
- groupPolicy: GroupPolicySchema.optional().default("allowlist"),
37430
+ groupPolicy: GroupPolicySchema.optional().default(INLINE_DEFAULT_GROUP_POLICY),
36547
37431
  groups: exports_external.record(exports_external.string(), InlineGroupSchema.optional()).optional(),
36548
37432
  requireMention: exports_external.boolean().optional(),
36549
37433
  replyThreadMode: InlineReplyThreadModeSchema.optional(),
@@ -37042,7 +37926,7 @@ function looksLikeInlineTargetId(raw, normalizedInput) {
37042
37926
  }
37043
37927
 
37044
37928
  // src/inline/monitor.ts
37045
- import { mkdir } from "node:fs/promises";
37929
+ import { mkdir, stat } from "node:fs/promises";
37046
37930
  import path4 from "node:path";
37047
37931
  import {
37048
37932
  buildCommandTextFromArgs,
@@ -37480,6 +38364,80 @@ async function uploadInlineMediaFromUrl(params) {
37480
38364
  }
37481
38365
  }
37482
38366
 
38367
+ // src/inline/message-formatting.ts
38368
+ var INLINE_FORMATTING_RULES = [
38369
+ "Use Inline markdown.",
38370
+ "Prefer bullet lists over markdown tables.",
38371
+ "If a table is necessary, render it inside a fenced code block.",
38372
+ "Use plain URLs or markdown links; do not wrap bare URLs in inline code or backticks.",
38373
+ "Mention Inline users with markdown links like [@FirstName](inline://user?id=123); use inline://user?username=username only when the user id is unavailable.",
38374
+ "Link Inline chats/threads with markdown links like [Planning](inline://chat?id=123) or [Planning](inline://thread?id=123); use inline://thread?space_id=7 when only the title and space are known.",
38375
+ "Use inline code only for actual code, commands, file paths, env vars, or identifiers."
38376
+ ];
38377
+ var INLINE_COPY_REPLACEMENTS = [
38378
+ [
38379
+ /Bind this (?:thread \(Discord\) or topic\/conversation \(Telegram\)|thread or topic\/conversation) to a session target\.?/gi,
38380
+ "Bind this Inline conversation to a session target."
38381
+ ],
38382
+ [
38383
+ /Remove the current (?:thread \(Discord\) or topic\/conversation \(Telegram\)|thread or topic\/conversation) binding\.?/gi,
38384
+ "Remove the current Inline conversation binding."
38385
+ ]
38386
+ ];
38387
+ function normalizeInlineMarkdownLabel(raw, fallback) {
38388
+ return (raw ?? "").replace(/\s+/g, " ").trim() || fallback;
38389
+ }
38390
+ function escapeInlineMarkdownLabel(raw) {
38391
+ return raw.replace(/\\/g, "\\\\").replace(/\[/g, "\\[").replace(/\]/g, "\\]");
38392
+ }
38393
+ function encodeInlineMarkdownValue(raw) {
38394
+ return encodeURIComponent(String(raw).trim());
38395
+ }
38396
+ function isBareHttpUrl(text) {
38397
+ if (!/^https?:\/\/\S+$/i.test(text))
38398
+ return false;
38399
+ try {
38400
+ const url2 = new URL(text);
38401
+ return url2.protocol === "http:" || url2.protocol === "https:";
38402
+ } catch {
38403
+ return false;
38404
+ }
38405
+ }
38406
+ function adaptInlineVisibleCopy(text) {
38407
+ let result = text;
38408
+ for (const [from, to] of INLINE_COPY_REPLACEMENTS) {
38409
+ result = result.replace(from, to);
38410
+ }
38411
+ return result;
38412
+ }
38413
+ function buildInlineSystemPrompt(extraPrompt) {
38414
+ return extraPrompt?.trim() || "";
38415
+ }
38416
+ function buildInlineInboundFormattingHints() {
38417
+ return {
38418
+ text_markup: "inline_markdown",
38419
+ rules: [...INLINE_FORMATTING_RULES]
38420
+ };
38421
+ }
38422
+ function buildInlineThreadMarkdownLink(params) {
38423
+ const title = normalizeInlineMarkdownLabel(params.title, `thread:${String(params.threadId)}`);
38424
+ return `[${escapeInlineMarkdownLabel(title)}](inline://thread?id=${encodeInlineMarkdownValue(params.threadId)})`;
38425
+ }
38426
+ function buildInlineThreadTitleMarkdownLink(params) {
38427
+ const title = normalizeInlineMarkdownLabel(params.title, `space:${String(params.spaceId)}`);
38428
+ const label = normalizeInlineMarkdownLabel(params.label, title);
38429
+ const query = [`space_id=${encodeInlineMarkdownValue(params.spaceId)}`];
38430
+ if (label !== title) {
38431
+ query.push(`title=${encodeInlineMarkdownValue(title)}`);
38432
+ }
38433
+ return `[${escapeInlineMarkdownLabel(label)}](inline://thread?${query.join("&")})`;
38434
+ }
38435
+ function sanitizeInlineOutgoingText(text) {
38436
+ return adaptInlineVisibleCopy(text).replace(/`([^`\n]+)`/g, (full, content) => {
38437
+ return isBareHttpUrl(content) ? content : full;
38438
+ });
38439
+ }
38440
+
37483
38441
  // src/inline/message-content.ts
37484
38442
  var INLINE_MESSAGE_ENTITY_TYPE = {
37485
38443
  MENTION: 1,
@@ -37491,7 +38449,9 @@ var INLINE_MESSAGE_ENTITY_TYPE = {
37491
38449
  USERNAME_MENTION: 7,
37492
38450
  CODE: 8,
37493
38451
  PRE: 9,
37494
- PHONE_NUMBER: 10
38452
+ PHONE_NUMBER: 10,
38453
+ THREAD: 11,
38454
+ THREAD_TITLE: 12
37495
38455
  };
37496
38456
  function compactWhitespace(raw) {
37497
38457
  return (raw ?? "").replace(/\s+/g, " ").trim();
@@ -37659,6 +38619,10 @@ function mapEntityType(type) {
37659
38619
  return "pre";
37660
38620
  case INLINE_MESSAGE_ENTITY_TYPE.PHONE_NUMBER:
37661
38621
  return "phone_number";
38622
+ case INLINE_MESSAGE_ENTITY_TYPE.THREAD:
38623
+ return "thread";
38624
+ case INLINE_MESSAGE_ENTITY_TYPE.THREAD_TITLE:
38625
+ return "thread_title";
37662
38626
  default:
37663
38627
  return "unknown";
37664
38628
  }
@@ -37700,6 +38664,26 @@ function messageEntitySummaries(message) {
37700
38664
  const language = compactWhitespace(entity.entity.pre.language);
37701
38665
  if (language)
37702
38666
  summary.language = language;
38667
+ } else if (entity.entity.oneofKind === "thread") {
38668
+ const chatId = entity.entity.thread.chatId.toString();
38669
+ summary.chatId = chatId;
38670
+ summary.markdownLink = buildInlineThreadMarkdownLink({
38671
+ threadId: chatId,
38672
+ ...summary.text ? { title: summary.text } : {}
38673
+ });
38674
+ } else if (entity.entity.oneofKind === "threadTitle") {
38675
+ const spaceId = entity.entity.threadTitle.spaceId.toString();
38676
+ const title = compactWhitespace(entity.entity.threadTitle.title);
38677
+ summary.spaceId = spaceId;
38678
+ if (title)
38679
+ summary.title = title;
38680
+ if (title || summary.text) {
38681
+ summary.markdownLink = buildInlineThreadTitleMarkdownLink({
38682
+ spaceId,
38683
+ title: title || summary.text || `space:${spaceId}`,
38684
+ label: summary.text || title
38685
+ });
38686
+ }
37703
38687
  }
37704
38688
  entities.push(summary);
37705
38689
  }
@@ -37752,6 +38736,13 @@ function formatEntitySummary(entity) {
37752
38736
  return entity.userId ? `mention${quotedText} -> user:${entity.userId}` : `mention${quotedText}`;
37753
38737
  case "text_link":
37754
38738
  return entity.url ? `text link${quotedText} -> ${entity.url}` : `text link${quotedText}`;
38739
+ case "thread":
38740
+ return entity.chatId ? `thread link${quotedText} -> thread:${entity.chatId}` : `thread link${quotedText}`;
38741
+ case "thread_title":
38742
+ if (entity.spaceId && entity.title) {
38743
+ return `thread title link${quotedText} -> space:${entity.spaceId} title:"${entity.title}"`;
38744
+ }
38745
+ return entity.spaceId ? `thread title link${quotedText} -> space:${entity.spaceId}` : `thread title link${quotedText}`;
37755
38746
  case "pre":
37756
38747
  return entity.language ? `preformatted block${quotedText} (language: ${entity.language})` : `preformatted block${quotedText}`;
37757
38748
  case "username_mention":
@@ -37796,57 +38787,6 @@ function summarizeInlineMessageContent(message) {
37796
38787
  };
37797
38788
  }
37798
38789
 
37799
- // src/inline/message-formatting.ts
37800
- var INLINE_FORMATTING_RULES = [
37801
- "Use Inline markdown.",
37802
- "Prefer bullet lists over markdown tables.",
37803
- "If a table is necessary, render it inside a fenced code block.",
37804
- "Use plain URLs or markdown links; do not wrap bare URLs in inline code or backticks.",
37805
- "Mention Inline users with markdown links like [@FirstName](inline://user?id=123); use inline://user?username=username only when the user id is unavailable.",
37806
- "Use inline code only for actual code, commands, file paths, env vars, or identifiers."
37807
- ];
37808
- var INLINE_COPY_REPLACEMENTS = [
37809
- [
37810
- /Bind this (?:thread \(Discord\) or topic\/conversation \(Telegram\)|thread or topic\/conversation) to a session target\.?/gi,
37811
- "Bind this Inline conversation to a session target."
37812
- ],
37813
- [
37814
- /Remove the current (?:thread \(Discord\) or topic\/conversation \(Telegram\)|thread or topic\/conversation) binding\.?/gi,
37815
- "Remove the current Inline conversation binding."
37816
- ]
37817
- ];
37818
- function isBareHttpUrl(text) {
37819
- if (!/^https?:\/\/\S+$/i.test(text))
37820
- return false;
37821
- try {
37822
- const url2 = new URL(text);
37823
- return url2.protocol === "http:" || url2.protocol === "https:";
37824
- } catch {
37825
- return false;
37826
- }
37827
- }
37828
- function adaptInlineVisibleCopy(text) {
37829
- let result = text;
37830
- for (const [from, to] of INLINE_COPY_REPLACEMENTS) {
37831
- result = result.replace(from, to);
37832
- }
37833
- return result;
37834
- }
37835
- function buildInlineSystemPrompt(extraPrompt) {
37836
- return extraPrompt?.trim() || "";
37837
- }
37838
- function buildInlineInboundFormattingHints() {
37839
- return {
37840
- text_markup: "inline_markdown",
37841
- rules: [...INLINE_FORMATTING_RULES]
37842
- };
37843
- }
37844
- function sanitizeInlineOutgoingText(text) {
37845
- return adaptInlineVisibleCopy(text).replace(/`([^`\n]+)`/g, (full, content) => {
37846
- return isBareHttpUrl(content) ? content : full;
37847
- });
37848
- }
37849
-
37850
38790
  // src/inline/thread-routes.ts
37851
38791
  import path2 from "node:path";
37852
38792
  import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
@@ -38533,6 +39473,46 @@ var GET_MESSAGES_METHOD2 = typeof Method.GET_MESSAGES === "number" && Number.isI
38533
39473
  var CREATE_SUBTHREAD_METHOD2 = typeof Method.CREATE_SUBTHREAD === "number" && Number.isInteger(Method.CREATE_SUBTHREAD) && Method.CREATE_SUBTHREAD > 0 ? Method.CREATE_SUBTHREAD : 42;
38534
39474
  var INLINE_ACTION_MAX_ROWS = 8;
38535
39475
  var INLINE_ACTION_MAX_PER_ROW = 8;
39476
+ var INLINE_BOT_PRESENCE_KINDS = [
39477
+ "idle",
39478
+ "happy",
39479
+ "waving",
39480
+ "jumping",
39481
+ "failed",
39482
+ "waiting",
39483
+ "running",
39484
+ "review"
39485
+ ];
39486
+ var inlineBotPresenceChannelDataSchema = {
39487
+ type: "object",
39488
+ description: "Inline-specific metadata for a send. Use inline.botPresence for the bot's on-screen body.",
39489
+ additionalProperties: true,
39490
+ properties: {
39491
+ inline: {
39492
+ type: "object",
39493
+ additionalProperties: true,
39494
+ properties: {
39495
+ botPresence: {
39496
+ type: "object",
39497
+ description: "Optional Inline bot presence state generated from your current mood or process.",
39498
+ additionalProperties: true,
39499
+ properties: {
39500
+ kind: {
39501
+ type: "string",
39502
+ enum: INLINE_BOT_PRESENCE_KINDS,
39503
+ description: "Emotion/state for the on-screen bot presence."
39504
+ },
39505
+ comment: {
39506
+ type: "string",
39507
+ maxLength: 30,
39508
+ description: "Optional short expression from your actual current thought, status, mood, request, or aside. Text or one/two emoji."
39509
+ }
39510
+ }
39511
+ }
39512
+ }
39513
+ }
39514
+ }
39515
+ };
38536
39516
  function suppressedInternalTextResult() {
38537
39517
  return jsonResult({
38538
39518
  ok: false,
@@ -39289,14 +40269,24 @@ function describeInlineMessageTool({
39289
40269
  };
39290
40270
  }
39291
40271
  const buttonsEnabled = supportsInlineMessageButtons(actions);
40272
+ const sendEnabled = actions.includes("send");
39292
40273
  const capabilities = buttonsEnabled ? ["presentation"] : [];
39293
- const schema = buttonsEnabled ? [
39294
- {
40274
+ const schema = [];
40275
+ if (buttonsEnabled) {
40276
+ schema.push({
39295
40277
  properties: {
39296
40278
  buttons: createMessageToolButtonsSchema()
39297
40279
  }
39298
- }
39299
- ] : [];
40280
+ });
40281
+ }
40282
+ if (sendEnabled) {
40283
+ schema.push({
40284
+ actions: ["send"],
40285
+ properties: {
40286
+ channelData: inlineBotPresenceChannelDataSchema
40287
+ }
40288
+ });
40289
+ }
39300
40290
  return {
39301
40291
  actions,
39302
40292
  capabilities,
@@ -40897,11 +41887,339 @@ function redactInlineBotApiUrl(raw) {
40897
41887
  }
40898
41888
  }
40899
41889
 
41890
+ // src/inline/threadreply-command.ts
41891
+ var MODE_LABELS = {
41892
+ auto: "auto",
41893
+ thread: "thread",
41894
+ main: "main"
41895
+ };
41896
+ var DEFAULT_REPLY_THREAD_AUTO_CREATE_MIN_MESSAGES = 50;
41897
+ var INLINE_THREADREPLY_NATIVE_NAME = "threadreply";
41898
+ var INLINE_THREADREPLY_COMMAND_SPEC = {
41899
+ name: "threadreply",
41900
+ nativeNames: { inline: INLINE_THREADREPLY_NATIVE_NAME },
41901
+ description: "Set Inline reply-thread mode for this chat.",
41902
+ channels: ["inline"],
41903
+ acceptsArgs: true
41904
+ };
41905
+ function listInlineBuiltinCommandSpecs() {
41906
+ return [
41907
+ {
41908
+ name: INLINE_THREADREPLY_COMMAND_SPEC.nativeNames.inline ?? INLINE_THREADREPLY_COMMAND_SPEC.name,
41909
+ description: INLINE_THREADREPLY_COMMAND_SPEC.description,
41910
+ acceptsArgs: INLINE_THREADREPLY_COMMAND_SPEC.acceptsArgs
41911
+ }
41912
+ ];
41913
+ }
41914
+ function isRecord5(value) {
41915
+ return typeof value === "object" && value !== null && !Array.isArray(value);
41916
+ }
41917
+ function asInlineConfig(value) {
41918
+ return isRecord5(value) ? value : undefined;
41919
+ }
41920
+ function normalizeMode(raw) {
41921
+ if (typeof raw !== "string")
41922
+ return null;
41923
+ const normalized = raw.trim().toLowerCase();
41924
+ if (normalized === "on" || normalized === "threads")
41925
+ return "thread";
41926
+ if (normalized === "off" || normalized === "parent" || normalized === "parentchat")
41927
+ return "main";
41928
+ if (normalized === "auto" || normalized === "thread" || normalized === "main")
41929
+ return normalized;
41930
+ return null;
41931
+ }
41932
+ function normalizeMin(raw) {
41933
+ if (typeof raw !== "number")
41934
+ return null;
41935
+ if (!Number.isInteger(raw) || raw < 0)
41936
+ return null;
41937
+ return raw;
41938
+ }
41939
+ function parseMinArg(raw) {
41940
+ const value = raw?.trim().toLowerCase();
41941
+ if (!value)
41942
+ return null;
41943
+ if (value === "inherit" || value === "default" || value === "unset")
41944
+ return "inherit";
41945
+ if (!/^\d+$/.test(value))
41946
+ return null;
41947
+ const parsed = Number(value);
41948
+ return Number.isSafeInteger(parsed) ? parsed : null;
41949
+ }
41950
+ function resolveInlineGroupId(ctx) {
41951
+ const raw = ctx.from?.trim() ?? "";
41952
+ if (!/(^|:)chat:/i.test(raw))
41953
+ return null;
41954
+ const normalized = normalizeInlineTarget(raw);
41955
+ return normalized && /^[0-9]+$/.test(normalized) ? normalized : null;
41956
+ }
41957
+ function resolveInlineConfigForAccount(inline, accountId) {
41958
+ const normalized = normalizeAccountId(accountId);
41959
+ const accounts = isRecord5(inline.accounts) ? inline.accounts : undefined;
41960
+ const accountKey = accounts ? Object.keys(accounts).find((key) => normalizeAccountId(key) === normalized) : undefined;
41961
+ if (accountKey && accounts?.[accountKey]) {
41962
+ return accounts[accountKey];
41963
+ }
41964
+ if (normalized !== DEFAULT_ACCOUNT_ID) {
41965
+ return {};
41966
+ }
41967
+ return inline;
41968
+ }
41969
+ function resolveCurrentMode(params) {
41970
+ const inline = asInlineConfig(params.cfg.channels?.inline) ?? {};
41971
+ const accountConfig = resolveInlineConfigForAccount(inline, params.accountId);
41972
+ return resolveInlineGroupReplyThreadMode({
41973
+ cfg: params.cfg,
41974
+ accountId: params.accountId ?? null,
41975
+ groupId: params.groupId,
41976
+ defaultMode: normalizeMode(accountConfig.replyThreadMode) ?? "auto"
41977
+ });
41978
+ }
41979
+ function resolveCurrentMinMessages(params) {
41980
+ const inline = asInlineConfig(params.cfg.channels?.inline) ?? {};
41981
+ const accountConfig = resolveInlineConfigForAccount(inline, params.accountId);
41982
+ return resolveInlineGroupReplyThreadAutoCreateMinMessages({
41983
+ cfg: params.cfg,
41984
+ accountId: params.accountId ?? null,
41985
+ groupId: params.groupId,
41986
+ defaultMinMessages: normalizeMin(accountConfig.replyThreadAutoCreateMinMessages) ?? DEFAULT_REPLY_THREAD_AUTO_CREATE_MIN_MESSAGES
41987
+ });
41988
+ }
41989
+ function readExplicitMode(params) {
41990
+ const inline = asInlineConfig(params.cfg.channels?.inline);
41991
+ if (!inline)
41992
+ return null;
41993
+ const accountConfig = resolveInlineConfigForAccount(inline, params.accountId);
41994
+ const group = accountConfig.groups?.[params.groupId];
41995
+ return normalizeMode(group?.replyThreadMode);
41996
+ }
41997
+ function readExplicitMinMessages(params) {
41998
+ const inline = asInlineConfig(params.cfg.channels?.inline);
41999
+ if (!inline)
42000
+ return null;
42001
+ const accountConfig = resolveInlineConfigForAccount(inline, params.accountId);
42002
+ const group = accountConfig.groups?.[params.groupId];
42003
+ return normalizeMin(group?.replyThreadAutoCreateMinMessages);
42004
+ }
42005
+ function ensureRecordField(parent, key) {
42006
+ const current = parent[key];
42007
+ if (isRecord5(current))
42008
+ return current;
42009
+ const next = {};
42010
+ parent[key] = next;
42011
+ return next;
42012
+ }
42013
+ function resolveMutableInlineConfigForAccount(inline, accountId) {
42014
+ const normalized = normalizeAccountId(accountId);
42015
+ if (normalized === DEFAULT_ACCOUNT_ID) {
42016
+ const accounts2 = isRecord5(inline.accounts) ? inline.accounts : undefined;
42017
+ const defaultKey = accounts2 ? Object.keys(accounts2).find((key) => normalizeAccountId(key) === DEFAULT_ACCOUNT_ID) : undefined;
42018
+ const defaultAccount = defaultKey ? accounts2?.[defaultKey] : undefined;
42019
+ return defaultAccount ?? inline;
42020
+ }
42021
+ const accounts = ensureRecordField(inline, "accounts");
42022
+ const accountKey = Object.keys(accounts).find((key) => normalizeAccountId(key) === normalized) ?? normalized;
42023
+ const account = asInlineConfig(accounts[accountKey]) ?? {};
42024
+ accounts[accountKey] = account;
42025
+ return account;
42026
+ }
42027
+ function setGroupMode(params) {
42028
+ const root = params.draft;
42029
+ const channels = root.channels ?? {};
42030
+ root.channels = channels;
42031
+ const inline = asInlineConfig(channels.inline) ?? {};
42032
+ channels.inline = inline;
42033
+ const accountConfig = resolveMutableInlineConfigForAccount(inline, params.accountId);
42034
+ const groups = ensureRecordField(accountConfig, "groups");
42035
+ const group = isRecord5(groups[params.groupId]) ? groups[params.groupId] : {};
42036
+ groups[params.groupId] = group;
42037
+ if (params.mode === "inherit") {
42038
+ delete group.replyThreadMode;
42039
+ return;
42040
+ }
42041
+ group.replyThreadMode = params.mode;
42042
+ }
42043
+ function setGroupMinMessages(params) {
42044
+ const root = params.draft;
42045
+ const channels = root.channels ?? {};
42046
+ root.channels = channels;
42047
+ const inline = asInlineConfig(channels.inline) ?? {};
42048
+ channels.inline = inline;
42049
+ const accountConfig = resolveMutableInlineConfigForAccount(inline, params.accountId);
42050
+ const groups = ensureRecordField(accountConfig, "groups");
42051
+ const group = isRecord5(groups[params.groupId]) ? groups[params.groupId] : {};
42052
+ groups[params.groupId] = group;
42053
+ if (params.minMessages === "inherit") {
42054
+ delete group.replyThreadAutoCreateMinMessages;
42055
+ return;
42056
+ }
42057
+ group.replyThreadAutoCreateMinMessages = params.minMessages;
42058
+ }
42059
+ function buildStatusText(params) {
42060
+ const explicit = readExplicitMode(params);
42061
+ const current = resolveCurrentMode(params);
42062
+ const explicitMin = readExplicitMinMessages(params);
42063
+ const currentMin = resolveCurrentMinMessages(params);
42064
+ return [
42065
+ `Thread reply mode for chat ${params.groupId}: ${MODE_LABELS[current]}.`,
42066
+ explicit ? `Explicit chat override: ${MODE_LABELS[explicit]}.` : "Explicit chat override: inherit.",
42067
+ `Auto-create minimum messages: ${currentMin}.`,
42068
+ explicitMin != null ? `Explicit minimum override: ${explicitMin}.` : "Explicit minimum override: inherit."
42069
+ ].join(`
42070
+ `);
42071
+ }
42072
+ function buildMenuText(params) {
42073
+ return [
42074
+ buildStatusText(params),
42075
+ "",
42076
+ "Choose where automatic replies for this group should go."
42077
+ ].join(`
42078
+ `);
42079
+ }
42080
+ function buildModeButtons() {
42081
+ return {
42082
+ inline: {
42083
+ buttons: [
42084
+ [
42085
+ { text: "Thread", callback_data: "/threadreply thread" },
42086
+ { text: "Main", callback_data: "/threadreply main" },
42087
+ { text: "Auto", callback_data: "/threadreply auto" }
42088
+ ],
42089
+ [{ text: "Inherit Mode", callback_data: "/threadreply inherit" }],
42090
+ [
42091
+ { text: "Min 0", callback_data: "/threadreply min 0" },
42092
+ { text: "Min 50", callback_data: "/threadreply min 50" },
42093
+ { text: "Inherit Min", callback_data: "/threadreply min inherit" }
42094
+ ]
42095
+ ]
42096
+ }
42097
+ };
42098
+ }
42099
+ function normalizeAction(args) {
42100
+ const [first = ""] = args.split(/\s+/).filter(Boolean);
42101
+ const normalized = first.trim().toLowerCase();
42102
+ if (!normalized || normalized === "help" || normalized === "options")
42103
+ return "help";
42104
+ if (normalized === "status" || normalized === "show")
42105
+ return "status";
42106
+ if (normalized === "inherit" || normalized === "default" || normalized === "unset")
42107
+ return "inherit";
42108
+ return normalizeMode(normalized);
42109
+ }
42110
+ async function handleInlineThreadReplyCommand(api2, ctx) {
42111
+ return await handleInlineThreadReplyCommandWithConfigRuntime(api2.runtime.config, ctx);
42112
+ }
42113
+ async function handleInlineThreadReplyCommandWithConfigRuntime(configRuntime, ctx) {
42114
+ if (!ctx.isAuthorizedSender) {
42115
+ return { text: "This command requires authorization." };
42116
+ }
42117
+ const groupId = resolveInlineGroupId(ctx);
42118
+ if (!groupId) {
42119
+ return { text: "/threadreply is only available in Inline group chats." };
42120
+ }
42121
+ const currentConfig = configRuntime.current();
42122
+ const args = ctx.args?.trim() ?? "";
42123
+ const [first = "", second, ...rest] = args.split(/\s+/).filter(Boolean);
42124
+ if (["min", "minimum", "threshold", "limit"].includes(first.trim().toLowerCase())) {
42125
+ const minMessages = parseMinArg(second);
42126
+ if (minMessages == null || rest.length > 0) {
42127
+ return { text: "Usage: /threadreply min <0-or-greater>|inherit" };
42128
+ }
42129
+ const committed2 = await configRuntime.mutateConfigFile({
42130
+ afterWrite: { mode: "auto" },
42131
+ mutate: (draft) => {
42132
+ setGroupMinMessages({
42133
+ draft,
42134
+ accountId: ctx.accountId,
42135
+ groupId,
42136
+ minMessages
42137
+ });
42138
+ }
42139
+ });
42140
+ const nextConfig2 = committed2.nextConfig;
42141
+ return {
42142
+ text: buildStatusText({
42143
+ cfg: nextConfig2,
42144
+ accountId: ctx.accountId,
42145
+ groupId
42146
+ })
42147
+ };
42148
+ }
42149
+ const action = normalizeAction(args);
42150
+ if (action === "help") {
42151
+ return {
42152
+ text: buildMenuText({
42153
+ cfg: currentConfig,
42154
+ accountId: ctx.accountId,
42155
+ groupId
42156
+ }),
42157
+ channelData: buildModeButtons()
42158
+ };
42159
+ }
42160
+ if (action === "status") {
42161
+ return {
42162
+ text: buildStatusText({
42163
+ cfg: currentConfig,
42164
+ accountId: ctx.accountId,
42165
+ groupId
42166
+ })
42167
+ };
42168
+ }
42169
+ if (!action) {
42170
+ return {
42171
+ text: [
42172
+ "Usage: /threadreply thread|main|auto|inherit|status",
42173
+ " /threadreply min <0-or-greater>|inherit",
42174
+ "",
42175
+ "- thread: auto-route parent-chat replies into per-message Inline reply threads once the minimum is reached.",
42176
+ "- main: keep automatic replies in the parent chat.",
42177
+ "- auto: use Inline's automatic default behavior for this chat.",
42178
+ "- inherit: remove this chat override and use account/default config.",
42179
+ "- min: set how many parent-chat messages must exist before automatic thread creation."
42180
+ ].join(`
42181
+ `)
42182
+ };
42183
+ }
42184
+ const committed = await configRuntime.mutateConfigFile({
42185
+ afterWrite: { mode: "auto" },
42186
+ mutate: (draft) => {
42187
+ setGroupMode({
42188
+ draft,
42189
+ accountId: ctx.accountId,
42190
+ groupId,
42191
+ mode: action
42192
+ });
42193
+ }
42194
+ });
42195
+ const nextConfig = committed.nextConfig;
42196
+ return {
42197
+ text: buildStatusText({
42198
+ cfg: nextConfig,
42199
+ accountId: ctx.accountId,
42200
+ groupId
42201
+ })
42202
+ };
42203
+ }
42204
+ function createInlineThreadReplyCommand(api2) {
42205
+ return {
42206
+ ...INLINE_THREADREPLY_COMMAND_SPEC,
42207
+ handler: async (ctx) => await handleInlineThreadReplyCommand(api2, ctx)
42208
+ };
42209
+ }
42210
+
40900
42211
  // src/inline/bot-commands-sync.ts
40901
42212
  var INLINE_COMMAND_NAME_RE = /^[a-z0-9_]{1,32}$/;
40902
42213
  var INLINE_COMMAND_LIMIT = 100;
40903
42214
  var INLINE_COMMAND_DESCRIPTION_LIMIT = 256;
40904
42215
  var INLINE_NATIVE_COMMAND_PROVIDER = "inline";
42216
+ function resolveInlineChannelCommands(cfg) {
42217
+ const inline = cfg.channels?.inline;
42218
+ if (typeof inline !== "object" || inline === null || Array.isArray(inline))
42219
+ return;
42220
+ const commands = inline.commands;
42221
+ return typeof commands === "object" && commands !== null && !Array.isArray(commands) ? commands : undefined;
42222
+ }
40905
42223
  function normalizeDynamicCommandName(raw) {
40906
42224
  const trimmed = raw.trim().toLowerCase();
40907
42225
  const withoutSlash = trimmed.startsWith("/") ? trimmed.slice(1) : trimmed;
@@ -40922,11 +42240,11 @@ function appendUniqueCommand(out, seen, command, description, logger) {
40922
42240
  out.push({ command: normalized, description: trimmedDescription });
40923
42241
  }
40924
42242
  function shouldSyncInlineNativeCommandsForAccount(params) {
40925
- const effective = params.account.config.commands?.native ?? params.cfg.commands?.native ?? "auto";
42243
+ const effective = params.account.config.commands?.native ?? resolveInlineChannelCommands(params.cfg)?.native ?? params.cfg.commands?.native ?? "auto";
40926
42244
  return effective !== false;
40927
42245
  }
40928
42246
  function shouldSyncInlineNativeSkillsForAccount(params) {
40929
- const effective = params.account.config.commands?.nativeSkills ?? params.cfg.commands?.nativeSkills ?? "auto";
42247
+ const effective = params.account.config.commands?.nativeSkills ?? resolveInlineChannelCommands(params.cfg)?.nativeSkills ?? params.cfg.commands?.nativeSkills ?? "auto";
40930
42248
  return effective !== false;
40931
42249
  }
40932
42250
  async function buildInlineNativeCommandsForConfig(params) {
@@ -40943,7 +42261,10 @@ async function buildInlineNativeCommandsForConfig(params) {
40943
42261
  skillCommands,
40944
42262
  provider: INLINE_NATIVE_COMMAND_PROVIDER
40945
42263
  });
40946
- const pluginSpecs = getPluginCommandSpecs("inline", { config: params.cfg });
42264
+ const pluginSpecs = [
42265
+ ...getPluginCommandSpecs("inline", { config: params.cfg }),
42266
+ ...listInlineBuiltinCommandSpecs()
42267
+ ];
40947
42268
  const seen = new Set;
40948
42269
  const resolved = [];
40949
42270
  for (const spec of nativeSpecs) {
@@ -41047,9 +42368,17 @@ var INLINE_NATIVE_COMMAND_PROVIDER2 = CHANNEL_ID;
41047
42368
  var INLINE_NATIVE_COMMAND_CALLBACK_PREFIX = "icmd:";
41048
42369
  var INLINE_REQUEST_ERROR_FALLBACK = "OpenClaw could not process that request. Please try again.";
41049
42370
  var INLINE_DEBOUNCE_ERROR_FALLBACK = "OpenClaw could not process those messages. Please try again.";
41050
- var DEFAULT_REPLY_THREAD_AUTO_CREATE_MIN_MESSAGES = 50;
42371
+ var DEFAULT_REPLY_THREAD_AUTO_CREATE_MIN_MESSAGES2 = 50;
41051
42372
  var DEFAULT_REPLY_THREAD_PARENT_HISTORY_LIMIT = 10;
42373
+ var INLINE_PARTICIPANT_ADD_READY_MAX_EVENT_AGE_MS = 10 * 60 * 1000;
42374
+ var INLINE_BOT_PRESENCE_IDLE_DELAY_MS = 8000;
42375
+ var INLINE_BOT_PRESENCE_FINISH_IDLE_DELAY_MS = 8000;
42376
+ var INLINE_BOT_PRESENCE_GESTURE_MS = 1400;
42377
+ var INLINE_BOT_PRESENCE_FAILED_MS = 8000;
42378
+ var INLINE_BOT_PRESENCE_COMMENT_MAX_LENGTH = 30;
41052
42379
  var INLINE_REPLY_THREAD_SYSTEM_PROMPT = "Inline reply threads are scoped conversations: answer only the current reply-thread message and this thread's own history; use parent-chat context only as background, and do not answer unrelated questions from the parent chat or other reply threads.";
42380
+ var INLINE_REPLY_THREAD_NEGATION_RE = /\b(?:do\s+not|don't|dont|please\s+don't|please\s+dont|no\s+need\s+to)\s+(?:create|start|open|make|use|move|take|reply|respond|answer|send|thread)\b[^.!?\n]*\bthread\b|\b(?:reply|respond|answer|keep)\s+(?:here|in\s+the\s+main\s+chat|in\s+main\s+chat|in\s+the\s+parent\s+chat|in\s+parent\s+chat)\b/u;
42381
+ var INLINE_REPLY_THREAD_INTENT_RE = /\b(?:reply|respond|answer|send)\s+(?:in|inside|into|to)\s+(?:a\s+)?(?:(?:new|child|reply)\s+)?thread\b|\b(?:create|start|open|make|use)\s+(?:a\s+)?(?:(?:new|child|reply)\s+)?thread\b|\b(?:move|take)\s+(?:(?:this|it|the\s+answer|the\s+reply|the\s+response)\s+)?(?:to|into)\s+(?:a\s+)?(?:(?:new|child|reply)\s+)?thread\b|\bthread\s+(?:this|the\s+answer|the\s+reply|the\s+response)\b|\b(?:threaded\s+(?:reply|response)|(?:reply|respond|answer)\s+threaded)\b/u;
41053
42382
  function buildInlineTypingDispatcherOptions(typingCallbacks) {
41054
42383
  if (!typingCallbacks) {
41055
42384
  return {};
@@ -41095,6 +42424,266 @@ async function sendInlineTypingToChats(params) {
41095
42424
  params.onPartialError?.(failure.chatId, failure.error);
41096
42425
  }
41097
42426
  }
42427
+ function inlineBotPresenceStateKind(kind) {
42428
+ switch (kind) {
42429
+ case "idle":
42430
+ return BotPresenceState_Kind.IDLE;
42431
+ case "happy":
42432
+ return BotPresenceState_Kind.HAPPY;
42433
+ case "waving":
42434
+ return BotPresenceState_Kind.WAVING;
42435
+ case "jumping":
42436
+ return BotPresenceState_Kind.JUMPING;
42437
+ case "failed":
42438
+ return BotPresenceState_Kind.FAILED;
42439
+ case "waiting":
42440
+ return BotPresenceState_Kind.WAITING;
42441
+ case "running":
42442
+ return BotPresenceState_Kind.RUNNING;
42443
+ case "review":
42444
+ return BotPresenceState_Kind.REVIEW;
42445
+ }
42446
+ }
42447
+ function normalizeInlineBotPresenceKind(value) {
42448
+ if (typeof value !== "string")
42449
+ return;
42450
+ switch (value.trim().toLowerCase()) {
42451
+ case "idle":
42452
+ case "happy":
42453
+ case "waving":
42454
+ case "jumping":
42455
+ case "failed":
42456
+ case "waiting":
42457
+ case "running":
42458
+ case "review":
42459
+ return value.trim().toLowerCase();
42460
+ default:
42461
+ return;
42462
+ }
42463
+ }
42464
+ function normalizeInlineBotPresenceComment(value) {
42465
+ if (typeof value !== "string")
42466
+ return;
42467
+ const text = value.replace(/\s+/g, " ").trim();
42468
+ if (!text)
42469
+ return;
42470
+ return Array.from(text).slice(0, INLINE_BOT_PRESENCE_COMMENT_MAX_LENGTH).join("");
42471
+ }
42472
+ function resolveInlineBotPresenceSignal(payload) {
42473
+ const channelData = isRecord6(payload.channelData) ? payload.channelData : undefined;
42474
+ const inlineData = channelData && isRecord6(channelData.inline) ? channelData.inline : undefined;
42475
+ const rawPresence = inlineData && isRecord6(inlineData.botPresence) ? inlineData.botPresence : undefined;
42476
+ if (!rawPresence)
42477
+ return null;
42478
+ const kind = normalizeInlineBotPresenceKind(rawPresence.kind) ?? "happy";
42479
+ const comment = normalizeInlineBotPresenceComment(rawPresence.comment);
42480
+ return comment ? { kind, comment } : { kind };
42481
+ }
42482
+ async function sendInlineBotPresenceToChats(params) {
42483
+ if (params.chatIds.length === 0)
42484
+ return;
42485
+ const failures = [];
42486
+ await Promise.all(params.chatIds.map(async (chatId) => {
42487
+ try {
42488
+ await params.client.invokeRaw(Method.SET_BOT_PRESENCE_STATE, {
42489
+ oneofKind: "setBotPresenceState",
42490
+ setBotPresenceState: {
42491
+ peerId: {
42492
+ type: {
42493
+ oneofKind: "chat",
42494
+ chat: { chatId }
42495
+ }
42496
+ },
42497
+ state: {
42498
+ kind: inlineBotPresenceStateKind(params.kind),
42499
+ ...params.comment ? { comment: params.comment } : {}
42500
+ }
42501
+ }
42502
+ });
42503
+ } catch (error51) {
42504
+ failures.push({ chatId, error: error51 });
42505
+ }
42506
+ }));
42507
+ if (failures.length === 0)
42508
+ return;
42509
+ if (failures.length === params.chatIds.length) {
42510
+ throw failures[0]?.error ?? new Error("inline bot presence failed");
42511
+ }
42512
+ for (const failure of failures) {
42513
+ params.onPartialError?.(failure.chatId, failure.error);
42514
+ }
42515
+ }
42516
+ async function sendInlineTypingAndBotPresenceToChats(params) {
42517
+ let typingError = null;
42518
+ await Promise.all([
42519
+ sendInlineTypingToChats({
42520
+ client: params.client,
42521
+ chatIds: params.chatIds,
42522
+ typing: params.typing,
42523
+ ...params.onTypingPartialError ? { onPartialError: params.onTypingPartialError } : {}
42524
+ }).catch((error51) => {
42525
+ typingError = error51;
42526
+ }),
42527
+ sendInlineBotPresenceToChats({
42528
+ client: params.client,
42529
+ chatIds: params.chatIds,
42530
+ kind: params.presenceKind,
42531
+ ...params.onPresencePartialError ? { onPartialError: params.onPresencePartialError } : {}
42532
+ }).catch((error51) => {
42533
+ params.onPresenceError?.(error51);
42534
+ })
42535
+ ]);
42536
+ if (typingError != null) {
42537
+ throw typingError;
42538
+ }
42539
+ }
42540
+ function createInlineBotPresenceLifecycle(params) {
42541
+ let active = false;
42542
+ let finishing = false;
42543
+ let idleTimer;
42544
+ let gestureTimer;
42545
+ let currentKind;
42546
+ let currentComment;
42547
+ let busyKind = "running";
42548
+ let busyComment;
42549
+ let sendChain = Promise.resolve();
42550
+ const clearIdleTimer = () => {
42551
+ if (!idleTimer)
42552
+ return;
42553
+ clearTimeout(idleTimer);
42554
+ idleTimer = undefined;
42555
+ };
42556
+ const clearGestureTimer = () => {
42557
+ if (!gestureTimer)
42558
+ return;
42559
+ clearTimeout(gestureTimer);
42560
+ gestureTimer = undefined;
42561
+ };
42562
+ const send = (kind, comment) => {
42563
+ if (currentKind === kind && currentComment === comment)
42564
+ return Promise.resolve();
42565
+ currentKind = kind;
42566
+ currentComment = comment;
42567
+ sendChain = sendChain.catch(() => {}).then(() => sendInlineBotPresenceToChats({
42568
+ client: params.client,
42569
+ chatIds: params.chatIds,
42570
+ kind,
42571
+ ...comment ? { comment } : {},
42572
+ onPartialError: params.onPartialError
42573
+ }).catch(params.onError));
42574
+ return sendChain;
42575
+ };
42576
+ const scheduleIdle = (delayMs = INLINE_BOT_PRESENCE_IDLE_DELAY_MS) => {
42577
+ clearIdleTimer();
42578
+ idleTimer = setTimeout(() => {
42579
+ idleTimer = undefined;
42580
+ active = false;
42581
+ finishing = false;
42582
+ busyKind = "running";
42583
+ busyComment = undefined;
42584
+ send("idle");
42585
+ }, delayMs);
42586
+ idleTimer.unref?.();
42587
+ };
42588
+ const showBusy = async (kind, comment) => {
42589
+ if (!active || finishing)
42590
+ return;
42591
+ clearIdleTimer();
42592
+ clearGestureTimer();
42593
+ busyKind = kind;
42594
+ busyComment = comment;
42595
+ await send(kind, comment);
42596
+ };
42597
+ const gesture = (kind, resumeKind = busyKind, comment, resumeComment = busyComment) => {
42598
+ if (params.chatIds.length === 0)
42599
+ return;
42600
+ clearIdleTimer();
42601
+ clearGestureTimer();
42602
+ active = true;
42603
+ send(kind, comment);
42604
+ gestureTimer = setTimeout(() => {
42605
+ gestureTimer = undefined;
42606
+ if (!active || finishing)
42607
+ return;
42608
+ send(resumeKind, resumeComment);
42609
+ }, INLINE_BOT_PRESENCE_GESTURE_MS);
42610
+ gestureTimer.unref?.();
42611
+ };
42612
+ return {
42613
+ start: async (cue) => {
42614
+ if (params.chatIds.length === 0)
42615
+ return;
42616
+ clearIdleTimer();
42617
+ if (active && !finishing)
42618
+ return;
42619
+ active = true;
42620
+ finishing = false;
42621
+ const cueKind = cue?.kind;
42622
+ busyKind = cueKind === "review" ? "review" : "running";
42623
+ busyComment = undefined;
42624
+ if (cueKind === "waving") {
42625
+ gesture("waving", busyKind);
42626
+ return;
42627
+ }
42628
+ await send(busyKind, busyComment);
42629
+ },
42630
+ busy: (kind, comment) => {
42631
+ showBusy(kind, comment);
42632
+ },
42633
+ gesture: (kind, comment) => {
42634
+ gesture(kind, busyKind, comment);
42635
+ },
42636
+ express: (signal) => {
42637
+ if (signal.kind === "failed") {
42638
+ if (params.chatIds.length === 0)
42639
+ return;
42640
+ clearIdleTimer();
42641
+ clearGestureTimer();
42642
+ active = true;
42643
+ finishing = true;
42644
+ send("failed", signal.comment).finally(() => scheduleIdle(INLINE_BOT_PRESENCE_FAILED_MS));
42645
+ return;
42646
+ }
42647
+ if (params.chatIds.length === 0)
42648
+ return;
42649
+ clearIdleTimer();
42650
+ clearGestureTimer();
42651
+ active = true;
42652
+ finishing = true;
42653
+ send(signal.kind, signal.comment).finally(() => scheduleIdle());
42654
+ },
42655
+ finish: () => {
42656
+ if (!active || finishing)
42657
+ return;
42658
+ finishing = true;
42659
+ clearGestureTimer();
42660
+ scheduleIdle(INLINE_BOT_PRESENCE_FINISH_IDLE_DELAY_MS);
42661
+ },
42662
+ fail: (comment) => {
42663
+ if (params.chatIds.length === 0)
42664
+ return;
42665
+ clearIdleTimer();
42666
+ clearGestureTimer();
42667
+ active = true;
42668
+ finishing = true;
42669
+ send("failed", comment).finally(() => scheduleIdle(INLINE_BOT_PRESENCE_FAILED_MS));
42670
+ },
42671
+ cleanup: () => {
42672
+ if (!active)
42673
+ return;
42674
+ if (finishing)
42675
+ return;
42676
+ clearIdleTimer();
42677
+ clearGestureTimer();
42678
+ active = false;
42679
+ send("idle").finally(() => {
42680
+ finishing = false;
42681
+ busyKind = "running";
42682
+ busyComment = undefined;
42683
+ });
42684
+ }
42685
+ };
42686
+ }
41098
42687
  function buildInlineReplyThreadSessionKey(parentSessionKey, threadChatId) {
41099
42688
  const suffix = `:thread:${String(threadChatId)}`;
41100
42689
  return parentSessionKey.endsWith(suffix) ? parentSessionKey : `${parentSessionKey}${suffix}`;
@@ -41362,6 +42951,23 @@ function buildInlineReactionContextKey(params) {
41362
42951
  const emoji3 = params.emoji.trim() || "emoji";
41363
42952
  return `inline:reaction:${params.action}:${String(params.chatId)}:${String(params.messageId)}:${String(params.senderId)}:${emoji3}`;
41364
42953
  }
42954
+ function describeInlineParticipantAddSystemEvent(params) {
42955
+ const header = `Inline bot was added as a participant in ${params.channelLabel}.`;
42956
+ if (params.recentLines.length === 0)
42957
+ return header;
42958
+ return `${header}
42959
+ Recent messages before join:
42960
+ ${params.recentLines.join(`
42961
+ `)}`;
42962
+ }
42963
+ function buildInlineParticipantAddContextKey(params) {
42964
+ return [
42965
+ "inline:participant:added",
42966
+ String(params.chatId),
42967
+ String(params.userId),
42968
+ params.participantDate != null ? String(params.participantDate) : String(params.seq ?? 0)
42969
+ ].join(":");
42970
+ }
41365
42971
  function normalizeInlineUsername(raw) {
41366
42972
  const trimmed = raw?.trim();
41367
42973
  if (!trimmed)
@@ -41403,6 +43009,28 @@ function parseInlineNativeCommandCallbackData(raw) {
41403
43009
  const commandText = trimmed.slice(INLINE_NATIVE_COMMAND_CALLBACK_PREFIX.length).trim();
41404
43010
  return commandText.startsWith("/") ? commandText : null;
41405
43011
  }
43012
+ function listHostInlinePluginCommandSpecs(cfg) {
43013
+ return getPluginCommandSpecs2("inline", { config: cfg });
43014
+ }
43015
+ function listInlinePluginCommandSpecs(cfg) {
43016
+ return [
43017
+ ...listHostInlinePluginCommandSpecs(cfg),
43018
+ ...listInlineBuiltinCommandSpecs()
43019
+ ];
43020
+ }
43021
+ function hasInlineCommandSpec(specs, commandName) {
43022
+ const normalized = commandName.trim().toLowerCase();
43023
+ if (!normalized)
43024
+ return false;
43025
+ return specs.some((spec) => spec.name.trim().toLowerCase() === normalized);
43026
+ }
43027
+ function isInlineThreadReplyCommandBody(commandBody) {
43028
+ return resolveInlineCommandNameFromBody(commandBody) === "threadreply";
43029
+ }
43030
+ function parseInlineCommandArgs(commandBody) {
43031
+ const match = commandBody.trim().match(/^\/[^\s]+(?:\s+([\s\S]*))?$/);
43032
+ return match?.[1]?.trim() ?? "";
43033
+ }
41406
43034
  function isInlineNativeCommandBody(params) {
41407
43035
  if (!shouldSyncInlineNativeCommandsForAccount({ cfg: params.cfg, account: params.account })) {
41408
43036
  return false;
@@ -41425,7 +43053,7 @@ function isInlineNativeCommandBody(params) {
41425
43053
  if (spec.name.trim().toLowerCase() === commandName)
41426
43054
  return true;
41427
43055
  }
41428
- for (const spec of getPluginCommandSpecs2("inline", { config: params.cfg })) {
43056
+ for (const spec of listInlinePluginCommandSpecs(params.cfg)) {
41429
43057
  if (spec.name.trim().toLowerCase() === commandName)
41430
43058
  return true;
41431
43059
  }
@@ -41506,7 +43134,7 @@ function buildSyntheticInlineTextMessage(params) {
41506
43134
  }
41507
43135
  var INLINE_ACTION_MAX_ROWS2 = 8;
41508
43136
  var INLINE_ACTION_MAX_PER_ROW2 = 8;
41509
- function isRecord5(value) {
43137
+ function isRecord6(value) {
41510
43138
  return typeof value === "object" && value !== null && !Array.isArray(value);
41511
43139
  }
41512
43140
  function normalizeOptionalString2(value) {
@@ -41527,7 +43155,7 @@ function normalizeInlineStreamingMode(value) {
41527
43155
  }
41528
43156
  }
41529
43157
  function resolveExplicitInlineStreamingMode(config2) {
41530
- const streaming = isRecord5(config2.streaming) ? config2.streaming : null;
43158
+ const streaming = isRecord6(config2.streaming) ? config2.streaming : null;
41531
43159
  return normalizeInlineStreamingMode(streaming?.mode) ?? normalizeInlineStreamingMode(config2.streaming) ?? normalizeInlineStreamingMode(config2.streamMode);
41532
43160
  }
41533
43161
  function resolveInlineStreamingMode(config2) {
@@ -41547,14 +43175,14 @@ function resolveInlineProgressPlaceholderEnabled(config2) {
41547
43175
  return true;
41548
43176
  if (config2.streaming === false)
41549
43177
  return false;
41550
- if (isRecord5(config2.streaming) && isRecord5(config2.streaming.progress))
43178
+ if (isRecord6(config2.streaming) && isRecord6(config2.streaming.progress))
41551
43179
  return true;
41552
43180
  return config2.streaming === undefined && config2.streamMode === undefined && config2.streamViaEditMessage !== true;
41553
43181
  }
41554
43182
  function resolveInlineBlockStreamingEnabled(config2) {
41555
43183
  const mode = resolveInlineStreamingMode(config2);
41556
- const streaming = isRecord5(config2.streaming) ? config2.streaming : null;
41557
- const block = streaming && isRecord5(streaming.block) ? streaming.block : null;
43184
+ const streaming = isRecord6(config2.streaming) ? config2.streaming : null;
43185
+ const block = streaming && isRecord6(streaming.block) ? streaming.block : null;
41558
43186
  if (typeof block?.enabled === "boolean")
41559
43187
  return block.enabled;
41560
43188
  if (typeof config2.blockStreaming === "boolean")
@@ -41778,7 +43406,7 @@ function normalizeReplyMarkupButtonsWith(raw, options) {
41778
43406
  continue;
41779
43407
  const row = [];
41780
43408
  for (const candidateButton of candidateRow) {
41781
- if (!isRecord5(candidateButton))
43409
+ if (!isRecord6(candidateButton))
41782
43410
  continue;
41783
43411
  const text = sanitizeInlineActionLabel(typeof candidateButton.text === "string" ? candidateButton.text : "");
41784
43412
  const callbackDataRaw = typeof candidateButton.callback_data === "string" ? candidateButton.callback_data.trim() : "";
@@ -41799,9 +43427,9 @@ function normalizeReplyMarkupButtonsWith(raw, options) {
41799
43427
  return rows;
41800
43428
  }
41801
43429
  function resolveInlineReplyActions(payload) {
41802
- const channelData = isRecord5(payload.channelData) ? payload.channelData : undefined;
41803
- const inlineData = channelData && isRecord5(channelData.inline) ? channelData.inline : undefined;
41804
- const telegramData = channelData && isRecord5(channelData.telegram) ? channelData.telegram : undefined;
43430
+ const channelData = isRecord6(payload.channelData) ? payload.channelData : undefined;
43431
+ const inlineData = channelData && isRecord6(channelData.inline) ? channelData.inline : undefined;
43432
+ const telegramData = channelData && isRecord6(channelData.telegram) ? channelData.telegram : undefined;
41805
43433
  let rawButtons = undefined;
41806
43434
  let hasExplicitButtons = false;
41807
43435
  let mapCallbackData;
@@ -41875,6 +43503,24 @@ function resolveInlineSystemPrompt(params) {
41875
43503
 
41876
43504
  `);
41877
43505
  }
43506
+ function hasExplicitInlineReplyThreadIntent(raw) {
43507
+ const text = normalizeLowercaseStringOrEmpty2(raw).replace(/\s+/g, " ").trim();
43508
+ if (!text)
43509
+ return false;
43510
+ if (INLINE_REPLY_THREAD_NEGATION_RE.test(text))
43511
+ return false;
43512
+ return INLINE_REPLY_THREAD_INTENT_RE.test(text);
43513
+ }
43514
+ function shouldCreateInlineReplyThreadDelivery(params) {
43515
+ if (params.mode === "main")
43516
+ return false;
43517
+ if (params.explicitThreadIntent)
43518
+ return true;
43519
+ return params.mode === "thread" && shouldAutoCreateInlineReplyThread({
43520
+ messageId: params.messageId,
43521
+ minMessages: params.minMessages
43522
+ });
43523
+ }
41878
43524
  function rewriteNumericMentionsToUsernames(text, senderProfilesById) {
41879
43525
  if (!text.includes("@"))
41880
43526
  return text;
@@ -42092,7 +43738,7 @@ function resolveHistoryLimit(params) {
42092
43738
  }
42093
43739
  function historyEntryDedupeKey(entry) {
42094
43740
  if (entry.messageId)
42095
- return `id:${entry.messageId}`;
43741
+ return `id:${entry.messageId}:ts:${entry.timestamp ?? "unknown"}`;
42096
43742
  return `ts:${entry.timestamp ?? "unknown"}:${entry.sender}:${entry.body}`;
42097
43743
  }
42098
43744
  function mergeInboundHistoryEntries(params) {
@@ -42550,6 +44196,34 @@ ${entityLines.slice(-ATTACHMENT_CONTEXT_LIMIT).join(`
42550
44196
  hasBotMessage
42551
44197
  };
42552
44198
  }
44199
+ function buildInlineRecentHistoryLines(params) {
44200
+ if (params.maxLines <= 0)
44201
+ return [];
44202
+ return params.messages.slice().sort((a, b) => {
44203
+ const byDate = Number(a.date - b.date);
44204
+ if (byDate !== 0)
44205
+ return byDate;
44206
+ if (a.id === b.id)
44207
+ return 0;
44208
+ return a.id < b.id ? -1 : 1;
44209
+ }).map((message) => buildInlineHistoryEntryPayload({
44210
+ message,
44211
+ senderProfilesById: params.senderProfilesById,
44212
+ meId: params.meId
44213
+ })).map((entry) => entry.line ?? entry.attachmentLine ?? entry.entityLine).filter((line) => Boolean(line)).slice(-params.maxLines);
44214
+ }
44215
+ function buildInlineParticipantAddReadyText(botUsername) {
44216
+ const mention = botUsername ? `@${botUsername}` : "me";
44217
+ return `I'm here and ready. Mention ${mention} to ask me something.`;
44218
+ }
44219
+ function shouldSendInlineParticipantAddReadyMessage(participantDate, now = Date.now()) {
44220
+ if (participantDate == null)
44221
+ return true;
44222
+ const eventMs = Number(participantDate) * 1000;
44223
+ if (!Number.isFinite(eventMs) || eventMs <= 0)
44224
+ return true;
44225
+ return now - eventMs <= INLINE_PARTICIPANT_ADD_READY_MAX_EVENT_AGE_MS;
44226
+ }
42553
44227
  async function monitorInlineProvider(params) {
42554
44228
  const { cfg, account, runtime, abortSignal, log, statusSink } = params;
42555
44229
  const core3 = getInlineRuntime();
@@ -42559,6 +44233,7 @@ async function monitorInlineProvider(params) {
42559
44233
  const token = await resolveInlineToken(account);
42560
44234
  const stateDir = core3.state.resolveStateDir();
42561
44235
  const statePath = path4.join(stateDir, "channels", "inline", `${account.accountId}.json`);
44236
+ const hasExistingState = await stat(statePath).then(() => true).catch(() => false);
42562
44237
  await mkdir(path4.dirname(statePath), { recursive: true });
42563
44238
  let client = null;
42564
44239
  const pushDiagnostics = (patch) => {
@@ -42585,7 +44260,8 @@ async function monitorInlineProvider(params) {
42585
44260
  baseUrl: account.baseUrl,
42586
44261
  token,
42587
44262
  logger: sdkLog,
42588
- state: new JsonFileStateStore(statePath)
44263
+ state: new JsonFileStateStore(statePath),
44264
+ catchUpUserFromStart: hasExistingState
42589
44265
  });
42590
44266
  await client.connect(abortSignal);
42591
44267
  pushDiagnostics();
@@ -42687,7 +44363,7 @@ async function monitorInlineProvider(params) {
42687
44363
  const senderId = params2.senderId != null ? String(params2.senderId) : null;
42688
44364
  const dmPolicy = account.config.dmPolicy ?? "pairing";
42689
44365
  const defaultGroupPolicy = cfg.channels?.defaults?.groupPolicy;
42690
- const groupPolicy = account.config.groupPolicy ?? defaultGroupPolicy ?? "allowlist";
44366
+ const groupPolicy = account.config.groupPolicy ?? defaultGroupPolicy ?? INLINE_DEFAULT_GROUP_POLICY;
42691
44367
  if (isGroup) {
42692
44368
  if (groupPolicy === "disabled") {
42693
44369
  log?.info(`[${account.accountId}] inline: drop ${params2.eventKind} chat=${String(params2.chatId)} (groupPolicy=disabled)`);
@@ -42700,6 +44376,7 @@ async function monitorInlineProvider(params) {
42700
44376
  senderId
42701
44377
  });
42702
44378
  if (groupPolicy === "allowlist") {
44379
+ const shouldBypassGroupAccess = params2.eventKind === "participant.add";
42703
44380
  const groupAccess = resolveInlineGroupAccessPolicy({
42704
44381
  cfg,
42705
44382
  accountId: account.accountId,
@@ -42707,11 +44384,11 @@ async function monitorInlineProvider(params) {
42707
44384
  hasGroupAllowFrom: groupSenderAllowlist.raw.length > 0,
42708
44385
  groupPolicy
42709
44386
  });
42710
- if (groupAccess.allowlistEnabled && !groupAccess.allowed) {
44387
+ if (groupAccess.allowlistEnabled && !groupAccess.allowed && !shouldBypassGroupAccess) {
42711
44388
  log?.info(`[${account.accountId}] inline: drop ${params2.eventKind} chat=${String(effectiveChatId)} (groupPolicy=allowlist)`);
42712
44389
  return null;
42713
44390
  }
42714
- if (groupSenderAllowlist.raw.length > 0) {
44391
+ if (groupSenderAllowlist.raw.length > 0 && !shouldBypassGroupAccess) {
42715
44392
  if (senderId == null && !groupSenderAllowlist.raw.includes("*")) {
42716
44393
  log?.info(`[${account.accountId}] inline: drop ${params2.eventKind} chat=${String(effectiveChatId)} (sender unknown)`);
42717
44394
  return null;
@@ -42850,6 +44527,74 @@ async function monitorInlineProvider(params) {
42850
44527
  messageId: params2.messageId
42851
44528
  }), eventOptions);
42852
44529
  };
44530
+ const queueInlineParticipantAddSystemEvent = async (params2) => {
44531
+ if (params2.participant?.userId !== meId)
44532
+ return;
44533
+ const inboundAt = Date.now();
44534
+ statusSink?.({
44535
+ lastInboundAt: inboundAt,
44536
+ lastEventAt: inboundAt,
44537
+ ...createTransportActivityStatusPatch(inboundAt)
44538
+ });
44539
+ const ingress = await resolveInlineSystemEventContext({
44540
+ chatId: params2.chatId,
44541
+ senderId: null,
44542
+ eventKind: "participant.add"
44543
+ });
44544
+ if (!ingress)
44545
+ return;
44546
+ await hydrateChatParticipants(params2.chatId);
44547
+ const chatInfo = chatCache.get(params2.chatId);
44548
+ const isGroup = chatInfo?.kind !== "direct";
44549
+ const historyLimit = resolveHistoryLimit({
44550
+ cfg,
44551
+ isGroup,
44552
+ historyLimit: account.config.historyLimit,
44553
+ dmHistoryLimit: account.config.dmHistoryLimit
44554
+ });
44555
+ const recentMessages = historyLimit > 0 ? await loadChatHistoryMessages({
44556
+ client,
44557
+ chatId: params2.chatId,
44558
+ limit: Math.min(historyLimit, 10)
44559
+ }).catch((err) => {
44560
+ statusSink?.({ lastError: `getChatHistory (participant add) failed: ${String(err)}` });
44561
+ return null;
44562
+ }) : null;
44563
+ const recentLines = recentMessages ? buildInlineRecentHistoryLines({
44564
+ messages: recentMessages,
44565
+ senderProfilesById,
44566
+ meId,
44567
+ maxLines: Math.min(historyLimit, 10)
44568
+ }) : [];
44569
+ const contextKey = buildInlineParticipantAddContextKey({
44570
+ chatId: params2.chatId,
44571
+ userId: meId,
44572
+ ...params2.participant.date != null ? { participantDate: params2.participant.date } : {},
44573
+ ...params2.seq != null ? { seq: params2.seq } : {}
44574
+ });
44575
+ core3.system.enqueueSystemEvent(describeInlineParticipantAddSystemEvent({
44576
+ channelLabel: ingress.channelLabel,
44577
+ recentLines
44578
+ }), {
44579
+ sessionKey: ingress.sessionKey,
44580
+ contextKey,
44581
+ forceSenderIsOwnerFalse: true,
44582
+ trusted: false
44583
+ });
44584
+ if (shouldSendInlineParticipantAddReadyMessage(params2.participant.date)) {
44585
+ try {
44586
+ await client.sendMessage({
44587
+ chatId: params2.chatId,
44588
+ text: buildInlineParticipantAddReadyText(botUsername),
44589
+ parseMarkdown: account.config.parseMarkdown ?? true
44590
+ });
44591
+ statusSink?.({ lastOutboundAt: Date.now() });
44592
+ } catch (err) {
44593
+ runtime.error?.(`inline participant-add ready message failed: ${String(err)}`);
44594
+ statusSink?.({ lastError: `participant-add ready message failed: ${String(err)}` });
44595
+ }
44596
+ }
44597
+ };
42853
44598
  const shouldQueueInlineReactionSystemEvent = async (params2) => {
42854
44599
  const mode = account.config.reactionNotifications ?? "own";
42855
44600
  if (mode === "off")
@@ -42935,8 +44680,8 @@ async function monitorInlineProvider(params) {
42935
44680
  cfg,
42936
44681
  accountId: account.accountId,
42937
44682
  groupId: String(effectiveChatId),
42938
- defaultMinMessages: account.config.replyThreadAutoCreateMinMessages ?? inlineThreadDefaults.replyThreadAutoCreateMinMessages ?? DEFAULT_REPLY_THREAD_AUTO_CREATE_MIN_MESSAGES
42939
- }) : DEFAULT_REPLY_THREAD_AUTO_CREATE_MIN_MESSAGES;
44683
+ defaultMinMessages: account.config.replyThreadAutoCreateMinMessages ?? inlineThreadDefaults.replyThreadAutoCreateMinMessages ?? DEFAULT_REPLY_THREAD_AUTO_CREATE_MIN_MESSAGES2
44684
+ }) : DEFAULT_REPLY_THREAD_AUTO_CREATE_MIN_MESSAGES2;
42940
44685
  const replyThreadRequireExplicitMention = isGroup && replyThreadsEnabled ? resolveInlineGroupReplyThreadRequireExplicitMention({
42941
44686
  cfg,
42942
44687
  accountId: account.accountId,
@@ -42960,7 +44705,7 @@ async function monitorInlineProvider(params) {
42960
44705
  }
42961
44706
  const dmPolicy = account.config.dmPolicy ?? "pairing";
42962
44707
  const defaultGroupPolicy = cfg.channels?.defaults?.groupPolicy;
42963
- const groupPolicy = account.config.groupPolicy ?? defaultGroupPolicy ?? "allowlist";
44708
+ const groupPolicy = account.config.groupPolicy ?? defaultGroupPolicy ?? INLINE_DEFAULT_GROUP_POLICY;
42964
44709
  const configAllowFrom = await resolveInlineAllowlist({
42965
44710
  cfg,
42966
44711
  accountId: account.accountId,
@@ -43040,6 +44785,8 @@ async function monitorInlineProvider(params) {
43040
44785
  });
43041
44786
  const hasControlCommand = hasTextControlCommand || isRegisteredNativeCommand;
43042
44787
  const commandSource = hasControlCommand ? isRegisteredNativeCommand ? "native" : "text" : undefined;
44788
+ const normalizedCommandName = resolveInlineCommandNameFromBody(normalizedCommandBody);
44789
+ const hostInlinePluginCommandRegistered = normalizedCommandName ? hasInlineCommandSpec(listHostInlinePluginCommandSpecs(cfg), normalizedCommandName) : false;
43043
44790
  const allowTextCommands = core3.channel.commands.shouldHandleTextCommands({
43044
44791
  cfg,
43045
44792
  surface: CHANNEL_ID,
@@ -43063,6 +44810,7 @@ async function monitorInlineProvider(params) {
43063
44810
  commandAuthorized: commandGate.commandAuthorized
43064
44811
  });
43065
44812
  const shouldBlockControlCommand = allowTextCommands && hasControlCommand && !commandAuthorized;
44813
+ const nativeMentioned = typeof msg.mentioned === "boolean" ? msg.mentioned : false;
43066
44814
  if (isGroup) {
43067
44815
  if (groupPolicy === "disabled") {
43068
44816
  log?.info(`[${account.accountId}] inline: drop group chat=${String(chatId)} (groupPolicy=disabled)`);
@@ -43079,7 +44827,7 @@ async function monitorInlineProvider(params) {
43079
44827
  hasGroupAllowFrom: groupSenderAllowlist.raw.length > 0,
43080
44828
  groupPolicy
43081
44829
  });
43082
- if (groupAccess.allowlistEnabled && !groupAccess.allowed) {
44830
+ if (groupAccess.allowlistEnabled && !groupAccess.allowed && !nativeMentioned) {
43083
44831
  log?.info(`[${account.accountId}] inline: drop group chat=${String(effectiveChatId)} (groupPolicy=allowlist)`);
43084
44832
  await answerCallbackIfNeeded().catch((error51) => {
43085
44833
  runtime.error?.(`inline callback answer failed: ${String(error51)}`);
@@ -43151,7 +44899,6 @@ async function monitorInlineProvider(params) {
43151
44899
  return;
43152
44900
  }
43153
44901
  const mentionRegexes = core3.channel.mentions.buildMentionRegexes(cfg, route.agentId);
43154
- const nativeMentioned = typeof msg.mentioned === "boolean" ? msg.mentioned : false;
43155
44902
  const patternMentioned = mentionRegexes.length ? core3.channel.mentions.matchesMentionPatterns(rawBody, mentionRegexes) : false;
43156
44903
  const wasMentioned = nativeMentioned || patternMentioned;
43157
44904
  const messageTimestamp = Number(msg.date) * 1000;
@@ -43209,7 +44956,7 @@ async function monitorInlineProvider(params) {
43209
44956
  cfg,
43210
44957
  groupId: String(effectiveChatId),
43211
44958
  accountId: account.accountId,
43212
- requireMentionDefault: account.config.requireMention ?? false
44959
+ requireMentionDefault: account.config.requireMention ?? INLINE_DEFAULT_REQUIRE_MENTION
43213
44960
  }) : false;
43214
44961
  const mentionGate = resolveMentionGatingWithBypass({
43215
44962
  isGroup,
@@ -43254,6 +45001,74 @@ async function monitorInlineProvider(params) {
43254
45001
  return;
43255
45002
  }
43256
45003
  const parseMarkdown = account.config.parseMarkdown ?? true;
45004
+ if (isInlineThreadReplyCommandBody(normalizedCommandBody) && !hostInlinePluginCommandRegistered) {
45005
+ const configRuntime = core3.config;
45006
+ if (typeof configRuntime?.current !== "function" || typeof configRuntime.mutateConfigFile !== "function") {
45007
+ runtime.error?.("inline /threadreply fallback unavailable: runtime config API missing");
45008
+ } else {
45009
+ const result = await handleInlineThreadReplyCommandWithConfigRuntime(configRuntime, {
45010
+ senderId,
45011
+ channel: CHANNEL_ID,
45012
+ channelId: CHANNEL_ID,
45013
+ isAuthorizedSender: commandAuthorized,
45014
+ senderIsOwner: commandAuthorized,
45015
+ sessionKey: inboundSessionKey,
45016
+ args: parseInlineCommandArgs(normalizedCommandBody),
45017
+ commandBody: normalizedCommandBody,
45018
+ config: cfg,
45019
+ from: isGroup ? `inline:chat:${String(effectiveChatId)}` : `inline:${senderId}`,
45020
+ to: `inline:${String(effectiveChatId)}`,
45021
+ accountId: account.accountId,
45022
+ ...replyThreadContext ? {
45023
+ messageThreadId: String(replyThreadContext.childChatId),
45024
+ threadParentId: String(replyThreadContext.parentChatId)
45025
+ } : {},
45026
+ requestConversationBinding: async () => ({ ok: false }),
45027
+ detachConversationBinding: async () => ({ removed: false }),
45028
+ getCurrentConversationBinding: async () => null
45029
+ });
45030
+ const resultRecord = result;
45031
+ const actions = resolveInlineReplyActions(resultRecord);
45032
+ const text = typeof result.text === "string" ? sanitizeInlineDeliveryText(result.text) : "";
45033
+ if (text || actions) {
45034
+ let delivered = false;
45035
+ if (shouldEditCallbackTargetInPlace && callbackActionEvent) {
45036
+ try {
45037
+ const editResult = await client.invokeRaw(Method.EDIT_MESSAGE, {
45038
+ oneofKind: "editMessage",
45039
+ editMessage: {
45040
+ messageId: callbackActionEvent.targetMessageId,
45041
+ peerId: buildChatPeer3(chatId),
45042
+ text,
45043
+ ...actions ? { actions } : {},
45044
+ parseMarkdown
45045
+ }
45046
+ });
45047
+ if (editResult.oneofKind !== "editMessage") {
45048
+ throw new Error(`inline /threadreply edit: expected editMessage result, got ${String(editResult.oneofKind)}`);
45049
+ }
45050
+ delivered = true;
45051
+ } catch (error51) {
45052
+ runtime.error?.(`inline /threadreply edit failed; falling back to send (${String(error51)})`);
45053
+ }
45054
+ }
45055
+ if (!delivered) {
45056
+ const sent = await client.sendMessage({
45057
+ chatId,
45058
+ text,
45059
+ ...actions ? { actions } : {},
45060
+ parseMarkdown
45061
+ });
45062
+ rememberSentBotMessage({ chatId, messageId: sent.messageId, replyThreadContext });
45063
+ }
45064
+ statusSink?.({ lastOutboundAt: Date.now() });
45065
+ }
45066
+ await answerCallbackIfNeeded().catch((error51) => {
45067
+ runtime.error?.(`inline callback answer failed: ${String(error51)}`);
45068
+ });
45069
+ return;
45070
+ }
45071
+ }
43257
45072
  const commandsPageCallback = callbackActionEvent ? parseInlineCommandsPageCallback(callbackDataToUtf8(callbackActionEvent.data)) : null;
43258
45073
  if (shouldEditCallbackTargetInPlace && callbackActionEvent && commandsPageCallback) {
43259
45074
  if (commandsPageCallback.page === "noop")
@@ -43448,7 +45263,10 @@ This model will be used for your next message.`, []);
43448
45263
  return;
43449
45264
  }
43450
45265
  let deliveryReplyThreadContext = replyThreadContext;
43451
- const shouldCreateDeliveryThread = isGroup && replyThreadsEnabled && replyThreadMode === "thread" && !deliveryReplyThreadContext && shouldAutoCreateInlineReplyThread({
45266
+ const explicitReplyThreadIntent = isGroup && replyThreadsEnabled && !deliveryReplyThreadContext && hasExplicitInlineReplyThreadIntent(rawBody);
45267
+ const shouldCreateDeliveryThread = isGroup && replyThreadsEnabled && !deliveryReplyThreadContext && shouldCreateInlineReplyThreadDelivery({
45268
+ mode: replyThreadMode,
45269
+ explicitThreadIntent: explicitReplyThreadIntent,
43452
45270
  messageId: msg.id,
43453
45271
  minMessages: replyThreadAutoCreateMinMessages
43454
45272
  }) && !shouldEditCallbackTargetInPlace;
@@ -43457,7 +45275,15 @@ This model will be used for your next message.`, []);
43457
45275
  if (!shouldCreateDeliveryThread || parentThreadCreationTyping === typing)
43458
45276
  return;
43459
45277
  parentThreadCreationTyping = typing;
43460
- await client.sendTyping({ chatId: effectiveChatId, typing }).catch((error51) => runtime.error?.(`inline parent reply-thread typing failed: ${String(error51)}`));
45278
+ await sendInlineTypingAndBotPresenceToChats({
45279
+ client,
45280
+ chatIds: [effectiveChatId],
45281
+ typing,
45282
+ presenceKind: typing ? "running" : "idle",
45283
+ onTypingPartialError: (chatId2, error51) => runtime.error?.(`inline parent reply-thread typing failed for chat ${String(chatId2)}: ${String(error51)}`),
45284
+ onPresencePartialError: (chatId2, error51) => runtime.error?.(`inline parent reply-thread bot presence failed for chat ${String(chatId2)}: ${String(error51)}`),
45285
+ onPresenceError: (error51) => runtime.error?.(`inline parent reply-thread bot presence failed: ${String(error51)}`)
45286
+ }).catch((error51) => runtime.error?.(`inline parent reply-thread typing failed: ${String(error51)}`));
43461
45287
  };
43462
45288
  if (shouldCreateDeliveryThread) {
43463
45289
  await setParentThreadCreationTyping(true);
@@ -43726,7 +45552,33 @@ This model will be used for your next message.`, []);
43726
45552
  }
43727
45553
  });
43728
45554
  const onModelSelected = replyPipeline.onModelSelected;
43729
- const typingCallbacks = replyPipeline.typingCallbacks;
45555
+ const rawTypingCallbacks = replyPipeline.typingCallbacks;
45556
+ const botPresenceLifecycle = createInlineBotPresenceLifecycle({
45557
+ client,
45558
+ chatIds: typingChatIds,
45559
+ onPartialError: (chatId2, error51) => runtime.error?.(`inline bot presence failed for chat ${String(chatId2)}: ${String(error51)}`),
45560
+ onError: (error51) => runtime.error?.(`inline bot presence failed: ${String(error51)}`)
45561
+ });
45562
+ const typingCallbacks = rawTypingCallbacks ? {
45563
+ onReplyStart: async () => {
45564
+ await Promise.all([
45565
+ rawTypingCallbacks.onReplyStart(),
45566
+ botPresenceLifecycle.start()
45567
+ ]);
45568
+ },
45569
+ ...rawTypingCallbacks.onIdle ? {
45570
+ onIdle: () => {
45571
+ rawTypingCallbacks.onIdle?.();
45572
+ botPresenceLifecycle.finish();
45573
+ }
45574
+ } : {},
45575
+ ...rawTypingCallbacks.onCleanup ? {
45576
+ onCleanup: () => {
45577
+ rawTypingCallbacks.onCleanup?.();
45578
+ botPresenceLifecycle.cleanup();
45579
+ }
45580
+ } : {}
45581
+ } : undefined;
43730
45582
  const dispatcherPipelineOptions = {
43731
45583
  ...replyPipeline.responsePrefix !== undefined ? { responsePrefix: replyPipeline.responsePrefix } : {},
43732
45584
  ...replyPipeline.responsePrefixContextProvider ? {
@@ -43964,24 +45816,44 @@ This model will be used for your next message.`, []);
43964
45816
  } : {},
43965
45817
  ...progressPlaceholderEnabled ? {
43966
45818
  onReasoningStream: async () => {
45819
+ botPresenceLifecycle.busy("review");
43967
45820
  await pushInlineProgressPlaceholder();
43968
45821
  }
43969
45822
  } : {},
43970
- ...streamViaEditMessage || progressPlaceholderEnabled ? {
43971
- onToolStart: async (payload) => {
43972
- await resetEditStreamOnBoundary();
43973
- const toolName = payload.name?.trim();
43974
- await pushInlineProgressPlaceholder(buildInlineProgressLineForEntry({
43975
- event: "tool",
43976
- ...toolName ? { name: toolName } : {},
43977
- ...payload.phase !== undefined ? { phase: payload.phase } : {},
43978
- ...payload.args !== undefined ? { args: payload.args } : {}
43979
- }, payload.detailMode ? { detailMode: payload.detailMode } : undefined), {
43980
- ...toolName ? { toolName } : {},
43981
- startImmediately: true
43982
- });
45823
+ onToolStart: async (payload) => {
45824
+ const toolName = payload.name?.trim();
45825
+ if (toolName === "inline_bot_presence") {
45826
+ return;
43983
45827
  }
43984
- } : {},
45828
+ botPresenceLifecycle.busy("running");
45829
+ if (!(streamViaEditMessage || progressPlaceholderEnabled))
45830
+ return;
45831
+ await resetEditStreamOnBoundary();
45832
+ await pushInlineProgressPlaceholder(buildInlineProgressLineForEntry({
45833
+ event: "tool",
45834
+ ...toolName ? { name: toolName } : {},
45835
+ ...payload.phase !== undefined ? { phase: payload.phase } : {},
45836
+ ...payload.args !== undefined ? { args: payload.args } : {}
45837
+ }, payload.detailMode ? { detailMode: payload.detailMode } : undefined), {
45838
+ ...toolName ? { toolName } : {},
45839
+ startImmediately: true
45840
+ });
45841
+ },
45842
+ onApprovalEvent: async (payload) => {
45843
+ if (payload.phase !== "requested")
45844
+ return;
45845
+ botPresenceLifecycle.busy("waiting");
45846
+ if (!progressPlaceholderEnabled)
45847
+ return;
45848
+ await pushInlineProgressPlaceholder(buildChannelProgressDraftLine({
45849
+ event: "approval",
45850
+ ...payload.phase !== undefined ? { phase: payload.phase } : {},
45851
+ ...payload.title !== undefined ? { title: payload.title } : {},
45852
+ ...payload.command !== undefined ? { command: payload.command } : {},
45853
+ ...payload.reason !== undefined ? { reason: payload.reason } : {},
45854
+ ...payload.message !== undefined ? { message: payload.message } : {}
45855
+ }), { startImmediately: true });
45856
+ },
43985
45857
  ...progressPlaceholderEnabled ? {
43986
45858
  onItemEvent: async (payload) => {
43987
45859
  await pushInlineProgressPlaceholder(buildInlineProgressLineForEntry({
@@ -44008,18 +45880,6 @@ This model will be used for your next message.`, []);
44008
45880
  ...payload.steps !== undefined ? { steps: payload.steps } : {}
44009
45881
  }));
44010
45882
  },
44011
- onApprovalEvent: async (payload) => {
44012
- if (payload.phase !== "requested")
44013
- return;
44014
- await pushInlineProgressPlaceholder(buildChannelProgressDraftLine({
44015
- event: "approval",
44016
- ...payload.phase !== undefined ? { phase: payload.phase } : {},
44017
- ...payload.title !== undefined ? { title: payload.title } : {},
44018
- ...payload.command !== undefined ? { command: payload.command } : {},
44019
- ...payload.reason !== undefined ? { reason: payload.reason } : {},
44020
- ...payload.message !== undefined ? { message: payload.message } : {}
44021
- }), { startImmediately: true });
44022
- },
44023
45883
  onCommandOutput: async (payload) => {
44024
45884
  if (payload.phase !== "end")
44025
45885
  return;
@@ -44047,22 +45907,24 @@ This model will be used for your next message.`, []);
44047
45907
  }));
44048
45908
  }
44049
45909
  } : {},
44050
- ...streamViaEditMessage || progressPlaceholderEnabled ? {
44051
- onCompactionStart: async () => {
44052
- await resetEditStreamOnBoundary();
44053
- await pushInlineProgressPlaceholder("Compacting context", {
44054
- startImmediately: true
44055
- });
44056
- }
44057
- } : {},
44058
- ...streamViaEditMessage || progressPlaceholderEnabled ? {
44059
- onCompactionEnd: async () => {
44060
- await resetEditStreamOnBoundary();
44061
- await pushInlineProgressPlaceholder("Resuming", {
44062
- startImmediately: true
44063
- });
44064
- }
44065
- } : {},
45910
+ onCompactionStart: async () => {
45911
+ botPresenceLifecycle.busy("review");
45912
+ if (!(streamViaEditMessage || progressPlaceholderEnabled))
45913
+ return;
45914
+ await resetEditStreamOnBoundary();
45915
+ await pushInlineProgressPlaceholder("Compacting context", {
45916
+ startImmediately: true
45917
+ });
45918
+ },
45919
+ onCompactionEnd: async () => {
45920
+ botPresenceLifecycle.busy("running");
45921
+ if (!(streamViaEditMessage || progressPlaceholderEnabled))
45922
+ return;
45923
+ await resetEditStreamOnBoundary();
45924
+ await pushInlineProgressPlaceholder("Resuming", {
45925
+ startImmediately: true
45926
+ });
45927
+ },
44066
45928
  ...suppressDefaultToolProgressMessages ? { suppressDefaultToolProgressMessages: true } : {},
44067
45929
  ...progressPlaceholderEnabled ? { allowProgressCallbacksWhenSourceDeliverySuppressed: true } : {},
44068
45930
  ...typeof disableBlockStreaming === "boolean" ? { disableBlockStreaming } : {}
@@ -44080,6 +45942,10 @@ This model will be used for your next message.`, []);
44080
45942
  ...dispatcherPipelineOptions,
44081
45943
  ...buildInlineTypingDispatcherOptions(typingCallbacks),
44082
45944
  deliver: async (payload, info) => {
45945
+ const presenceSignal = resolveInlineBotPresenceSignal(payload);
45946
+ if (presenceSignal) {
45947
+ botPresenceLifecycle.express(presenceSignal);
45948
+ }
44083
45949
  const visiblePayload = resolveInlineChatVisibleReplyPayload(payload);
44084
45950
  if (!visiblePayload)
44085
45951
  return;
@@ -44234,6 +46100,7 @@ Attachment: ${mediaUrl}` : `Attachment: ${mediaUrl}`;
44234
46100
  },
44235
46101
  onError: (err, info) => {
44236
46102
  failedNonSilent = true;
46103
+ botPresenceLifecycle.fail();
44237
46104
  runtime.error?.(`inline ${info?.kind ?? "final"} reply failed: ${String(err)}`);
44238
46105
  }
44239
46106
  },
@@ -44241,6 +46108,7 @@ Attachment: ${mediaUrl}` : `Attachment: ${mediaUrl}`;
44241
46108
  });
44242
46109
  } catch (error51) {
44243
46110
  dispatchError = error51;
46111
+ botPresenceLifecycle.fail();
44244
46112
  runtime.error?.(`inline dispatch failed: ${String(error51)}`);
44245
46113
  }
44246
46114
  await cleanupInlineProgressPlaceholder();
@@ -44248,6 +46116,7 @@ Attachment: ${mediaUrl}` : `Attachment: ${mediaUrl}`;
44248
46116
  delivered = true;
44249
46117
  }
44250
46118
  if (!delivered && (dispatchError != null || skippedNonSilent || failedNonSilent)) {
46119
+ botPresenceLifecycle.fail();
44251
46120
  const fallbackText = dispatchError != null ? INLINE_REQUEST_ERROR_FALLBACK : EMPTY_RESPONSE_FALLBACK;
44252
46121
  const sent = await client.sendMessage({
44253
46122
  chatId: deliveryChatId,
@@ -44418,6 +46287,19 @@ Attachment: ${mediaUrl}` : `Attachment: ${mediaUrl}`;
44418
46287
  });
44419
46288
  continue;
44420
46289
  }
46290
+ if (rawEvent["kind"] === "chat.participant.add") {
46291
+ const eventChatId = rawEvent["chatId"];
46292
+ if (!eventChatId)
46293
+ continue;
46294
+ const participant = rawEvent["participant"];
46295
+ const seq = rawEvent["seq"];
46296
+ await queueInlineParticipantAddSystemEvent({
46297
+ chatId: eventChatId,
46298
+ ...participant ? { participant } : {},
46299
+ ...seq != null ? { seq } : {}
46300
+ });
46301
+ continue;
46302
+ }
44421
46303
  if (rawEvent["kind"] === "message.action.invoke") {
44422
46304
  const actorUserId = rawEvent["actorUserId"];
44423
46305
  const interactionId = rawEvent["interactionId"];
@@ -44482,7 +46364,7 @@ Attachment: ${mediaUrl}` : `Attachment: ${mediaUrl}`;
44482
46364
  }
44483
46365
 
44484
46366
  // src/inline/doctor.ts
44485
- function isRecord6(value) {
46367
+ function isRecord7(value) {
44486
46368
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
44487
46369
  }
44488
46370
  function readInherited(account, parent, key) {
@@ -44493,18 +46375,18 @@ function hasEntries(value) {
44493
46375
  }
44494
46376
  function hasConfiguredGroups(account, parent) {
44495
46377
  const groups = readInherited(account, parent, "groups");
44496
- return isRecord6(groups) && Object.keys(groups).length > 0;
46378
+ return isRecord7(groups) && Object.keys(groups).length > 0;
44497
46379
  }
44498
46380
  function hasGroupScopedSenders(groups) {
44499
- if (!isRecord6(groups))
46381
+ if (!isRecord7(groups))
44500
46382
  return false;
44501
- return Object.values(groups).some((group) => isRecord6(group) && hasEntries(group.allowFrom));
46383
+ return Object.values(groups).some((group) => isRecord7(group) && hasEntries(group.allowFrom));
44502
46384
  }
44503
46385
  function hasGroupSenders(account, parent) {
44504
46386
  return hasEntries(readInherited(account, parent, "groupAllowFrom")) || hasGroupScopedSenders(readInherited(account, parent, "groups"));
44505
46387
  }
44506
46388
  function getGroupPolicy(account, parent) {
44507
- return String(readInherited(account, parent, "groupPolicy") ?? "allowlist");
46389
+ return String(readInherited(account, parent, "groupPolicy") ?? INLINE_DEFAULT_GROUP_POLICY);
44508
46390
  }
44509
46391
  function collectInlineEmptyAllowlistWarnings(params) {
44510
46392
  if (params.channelName !== "inline")
@@ -44661,7 +46543,8 @@ var INLINE_USER_ID_HELP_LINES = [
44661
46543
  "Docs: https://inline.chat/docs/openclaw"
44662
46544
  ];
44663
46545
  var INLINE_GROUP_HELP_LINES = [
44664
- "Allowlist Inline group chats by numeric chat id.",
46546
+ "Inline groups are open by default and require a bot mention by default.",
46547
+ "Optionally allowlist Inline group chats by numeric chat id.",
44665
46548
  "Accepted forms: 123456789, chat:123456789, inline:123456789, *.",
44666
46549
  "Use * for every group chat; the setup keeps requireMention=true for broad group access.",
44667
46550
  "Use /whoami in a group and copy the Chat line to get the Inline chat id.",
@@ -44808,7 +46691,7 @@ function buildInlineDmAccessWarningLines(accountId) {
44808
46691
  function buildInlineGroupAccessWarningLines(params) {
44809
46692
  const resolved = resolveInlineAccount({ cfg: params.cfg, accountId: params.accountId });
44810
46693
  const configBase = formatInlineConfigBase(params.accountId);
44811
- const policy = resolved.config.groupPolicy ?? "allowlist";
46694
+ const policy = resolved.config.groupPolicy ?? INLINE_DEFAULT_GROUP_POLICY;
44812
46695
  const groups = resolved.config.groups ?? {};
44813
46696
  const hasGroups = Object.keys(groups).length > 0;
44814
46697
  const hasGroupAllowFrom = (resolved.config.groupAllowFrom ?? []).some((entry) => String(entry).trim());
@@ -44821,7 +46704,8 @@ function buildInlineGroupAccessWarningLines(params) {
44821
46704
  ];
44822
46705
  }
44823
46706
  const wildcard = groups["*"];
44824
- if (policy === "open" && wildcard?.requireMention !== true) {
46707
+ const requireMention = wildcard?.requireMention ?? resolved.config.requireMention ?? INLINE_DEFAULT_REQUIRE_MENTION;
46708
+ if (policy === "open" && requireMention !== true) {
44825
46709
  return [
44826
46710
  "Inline groups are open to every group chat without a default mention requirement.",
44827
46711
  "For safer broad group access, require bot mentions or switch to an explicit group allowlist:",
@@ -45085,11 +46969,11 @@ async function probeInlineAccount(account, timeoutMs) {
45085
46969
  }
45086
46970
 
45087
46971
  // src/inline/status-issues.ts
45088
- import { asString, isRecord as isRecord7 } from "openclaw/plugin-sdk/status-helpers";
46972
+ import { asString, isRecord as isRecord8 } from "openclaw/plugin-sdk/status-helpers";
45089
46973
  var RECENT_RUNTIME_ISSUE_MS = 30 * 60 * 1000;
45090
46974
  var INLINE_CONNECT_GRACE_MS = 120 * 1000;
45091
46975
  function readInlineProbeSummary(value) {
45092
- if (!isRecord7(value)) {
46976
+ if (!isRecord8(value)) {
45093
46977
  return {};
45094
46978
  }
45095
46979
  const summary = {};
@@ -45106,12 +46990,12 @@ function looksLikeAuthError(text) {
45106
46990
  return /(401|403|unauth|forbidden|invalid token|token invalid|unauthorized)/i.test(text);
45107
46991
  }
45108
46992
  function readInlineDiagnosticsSummary(value) {
45109
- if (!isRecord7(value)) {
46993
+ if (!isRecord8(value)) {
45110
46994
  return {};
45111
46995
  }
45112
- const protocolValue = isRecord7(value.protocol) ? value.protocol : undefined;
45113
- const transportValue = (protocolValue && isRecord7(protocolValue.transport) ? protocolValue.transport : undefined) ?? (isRecord7(value.transport) ? value.transport : undefined);
45114
- const pingValue = protocolValue && isRecord7(protocolValue.ping) ? protocolValue.ping : undefined;
46996
+ const protocolValue = isRecord8(value.protocol) ? value.protocol : undefined;
46997
+ const transportValue = (protocolValue && isRecord8(protocolValue.transport) ? protocolValue.transport : undefined) ?? (isRecord8(value.transport) ? value.transport : undefined);
46998
+ const pingValue = protocolValue && isRecord8(protocolValue.ping) ? protocolValue.ping : undefined;
45115
46999
  return {
45116
47000
  ...protocolValue ? {
45117
47001
  protocol: {
@@ -45143,7 +47027,7 @@ function asFiniteNumber(value) {
45143
47027
  function collectInlineStatusIssues(accounts) {
45144
47028
  const issues = [];
45145
47029
  for (const entry of accounts) {
45146
- if (!isRecord7(entry)) {
47030
+ if (!isRecord8(entry)) {
45147
47031
  continue;
45148
47032
  }
45149
47033
  const accountId = asString(entry.accountId);
@@ -45279,6 +47163,14 @@ function hasInlineCommandAllowFrom(cfg) {
45279
47163
  const byProvider = allowFrom;
45280
47164
  return hasEntries2(byProvider.inline) || hasEntries2(byProvider["*"]);
45281
47165
  }
47166
+ function groupDefaultRequiresMention(account) {
47167
+ const groups = account.config.groups;
47168
+ const wildcard = groups && typeof groups === "object" && !Array.isArray(groups) ? groups["*"] : undefined;
47169
+ const wildcardRequireMention = wildcard && typeof wildcard === "object" && !Array.isArray(wildcard) ? wildcard.requireMention : undefined;
47170
+ if (typeof wildcardRequireMention === "boolean")
47171
+ return wildcardRequireMention;
47172
+ return account.config.requireMention ?? INLINE_DEFAULT_REQUIRE_MENTION;
47173
+ }
45282
47174
  function collectInvalidAllowFromEntries(params) {
45283
47175
  if (!Array.isArray(params.entries))
45284
47176
  return;
@@ -45335,7 +47227,7 @@ var inlineSecurityAdapter = {
45335
47227
  },
45336
47228
  collectWarnings: ({ account, cfg }) => {
45337
47229
  const defaultGroupPolicy = cfg.channels?.defaults?.groupPolicy;
45338
- const groupPolicy = account.config.groupPolicy ?? defaultGroupPolicy ?? "allowlist";
47230
+ const groupPolicy = account.config.groupPolicy ?? defaultGroupPolicy ?? INLINE_DEFAULT_GROUP_POLICY;
45339
47231
  const groupRulesConfigured = Boolean(account.config.groups) && Object.keys(account.config.groups ?? {}).length > 0;
45340
47232
  const groupSendersConfigured = hasGroupSenderEntries(account);
45341
47233
  if (groupPolicy === "allowlist" && !groupRulesConfigured && !groupSendersConfigured) {
@@ -45346,14 +47238,12 @@ var inlineSecurityAdapter = {
45346
47238
  if (groupPolicy !== "open") {
45347
47239
  return [];
45348
47240
  }
45349
- if (groupRulesConfigured) {
47241
+ if (!groupDefaultRequiresMention(account)) {
45350
47242
  return [
45351
- '- Inline groups: groupPolicy="open" allows any group message to reach the agent (subject to mention policy). Set channels.inline.groupPolicy="allowlist" for stricter routing.'
47243
+ '- Inline groups: groupPolicy="open" allows every group message to trigger replies because requireMention is disabled. Set channels.inline.requireMention=true or channels.inline.groups."*".requireMention=true.'
45352
47244
  ];
45353
47245
  }
45354
- return [
45355
- '- Inline groups: groupPolicy="open" with no group rules means every group can trigger replies. Consider channels.inline.groupPolicy="allowlist".'
45356
- ];
47246
+ return [];
45357
47247
  },
45358
47248
  collectAuditFindings: ({ account, cfg }) => {
45359
47249
  const findings = [];
@@ -45378,7 +47268,7 @@ var inlineSecurityAdapter = {
45378
47268
  });
45379
47269
  appendInvalidReactionAllowlistFinding(findings, invalidReactionAllowlistEntries);
45380
47270
  const defaultGroupPolicy = cfg.channels?.defaults?.groupPolicy;
45381
- const groupPolicy = account.config.groupPolicy ?? defaultGroupPolicy ?? "allowlist";
47271
+ const groupPolicy = account.config.groupPolicy ?? defaultGroupPolicy ?? INLINE_DEFAULT_GROUP_POLICY;
45382
47272
  const groupsConfigured = Boolean(account.config.groups) && Object.keys(account.config.groups ?? {}).length > 0;
45383
47273
  const groupSendersConfigured = hasGroupSenderEntries(account);
45384
47274
  const groupAccessEnabled = groupPolicy === "open" || groupPolicy === "allowlist" && (groupsConfigured || groupSendersConfigured);
@@ -46711,7 +48601,7 @@ var inlineChannelPlugin = {
46711
48601
  cfg,
46712
48602
  groupId,
46713
48603
  accountId,
46714
- requireMentionDefault: resolved.config.requireMention ?? false
48604
+ requireMentionDefault: resolved.config.requireMention ?? INLINE_DEFAULT_REQUIRE_MENTION
46715
48605
  });
46716
48606
  },
46717
48607
  resolveToolPolicy: ({ cfg, accountId, groupId, senderId, senderName, senderUsername, senderE164 }) => resolveInlineGroupToolPolicy({
@@ -46760,6 +48650,7 @@ var inlineChannelPlugin = {
46760
48650
  "- Inline targeting: omit `target` to reply in the current chat.",
46761
48651
  "- Inline explicit targets: `chat:<chatId>` for chats and `user:<userId>` for direct users. Prefer `user:` for DM user targets.",
46762
48652
  "- Inline discovery: use `channel-list` to discover available chats and users. Use `scope: groups|peers|all` when helpful, and reuse returned `target` values.",
48653
+ "- Inline markdown links: in visible replies, link returned users as `[@name](inline://user?id=<userId>)` and returned chats/threads as `[title](inline://chat?id=<chatId>)` or `[title](inline://thread?id=<chatId>)`. Use `target` values only for tool calls.",
46763
48654
  ...supportsInlineMessageButtonsForConfig(cfg, accountId ?? null) ? [
46764
48655
  "- Prefer Inline buttons/selects for 2-5 discrete choices or parameter picks instead of asking the user to type one. Use `presentation` blocks for shared buttons/selects, or `buttons` rows for simple callback buttons."
46765
48656
  ] : [],
@@ -46767,7 +48658,14 @@ var inlineChannelPlugin = {
46767
48658
  "- Inline reactions: pass `messageId` for `react` when you have it; on inbound turns, the current inbound message id can be used as fallback."
46768
48659
  ] : [],
46769
48660
  "- Inline history tools: `read` and `search` return media-aware message payloads (`media`, `attachments`, `attachmentUrls`) so image-only history remains discoverable. `search` is chat-scoped; run it per chat.",
46770
- "- Inline special tools: use `inline_nudge` to send a nudge, and `inline_forward` to forward message ids between chats or users.",
48661
+ "- Inline special tools: use `inline_nudge` to send a nudge, `inline_forward` to forward message ids between chats or users, and `inline_bot_presence` to move or emote through your on-screen body without sending a chat message.",
48662
+ "- Inline bot avatar setup: use `inline_bot_avatar` only when the user explicitly asks you to install or replace your on-screen avatar from a provided local/remote zip package. Do not call it during ordinary chat, do not invent file paths, and do not use it for mood/state changes.",
48663
+ "- Inline botPresence is your literal on-screen character/body in Inline, not another answer channel. Treat `kind` as your body pose/mood and `comment` as a tiny thought bubble or body-language caption.",
48664
+ "- Inline botPresence states: use `waving` for greetings/attention, `jumping` for delight or completion, `review` for inspecting/thinking, `waiting` when asking the human, `failed` when blocked or disappointed, `running` for active focused work, `happy` for positive/settled moments, and `idle` only when neutral is intentionally useful. Do not use it to hide yourself.",
48665
+ "- Inline botPresence comments: include a generated `comment` when it helps the human understand your current mood, thought, status, request, nudge, or small aside. Keep it casual, short, characterful, and true to what you are doing or feeling; under 30 characters. Text or one/two emoji characters are both fine. It should supplement the full chat answer, not replace substantive answers.",
48666
+ "- Inline botPresence is cheap to call during active work. Use it when your thought/body state changes or when a tiny status would make you easier to read; avoid repeated identical updates, fixed-timer filler, or static comments.",
48667
+ "- Inline botPresence final beat: before your final chat message in active Inline chats, make one last `inline_bot_presence` call whenever there is a real final expression to show. Do this for greetings (`waving`, `hey \uD83D\uDC4B` or `\uD83D\uDC4B`), weather/status answers (`happy`, `☀️ 72°` or `rainy ☔️`), completed longer work (`jumping`, `phew, done!`), blockers (`failed`, short reason), or requests for user input (`waiting`, short ask). Then send the normal full chat answer. Do not send `idle` just to clean up; the client quiets the presence later.",
48668
+ "- Inline botPresence in messages: when you are already sending a message, you may also set `channelData.inline.botPresence` with the same `kind` and `comment` fields.",
46771
48669
  "- Inline reply threads: use normal `reply` for short or newly started parent-chat conversations unless the user asks for a thread.",
46772
48670
  "- Inline reply threads: use `thread-create` to create or reuse a real reply thread under the current/target chat. On parent-chat inbound turns, omit `messageId` to anchor it to the current message, or pass `messageId`/`parentMessageId` explicitly.",
46773
48671
  "- Inline reply threads: use `thread-reply` to send into a real reply thread, with `threadId` set to the reply-thread chat id returned by `thread-create`. Reuse that `threadId` only for the same reply-thread session; unrelated parent-chat messages need separate parent-message anchors.",
@@ -47135,5 +49033,5 @@ export {
47135
49033
  inlineChannelPlugin
47136
49034
  };
47137
49035
 
47138
- //# debugId=C3CE4C015D5193F764756E2164756E21
49036
+ //# debugId=3B872041BDFC897564756E2164756E21
47139
49037
  //# sourceMappingURL=channel-plugin-api.js.map