@inline-openclaw/inline 0.0.42 → 0.0.44
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.
- package/README.md +1 -1
- package/dist/approval-handler.runtime.js +82 -7
- package/dist/approval-handler.runtime.js.map +4 -4
- package/dist/channel-plugin-api.js +165 -37
- package/dist/channel-plugin-api.js.map +6 -6
- package/dist/inline/message-formatting.d.ts.map +1 -1
- package/dist/inline/monitor.d.ts.map +1 -1
- package/dist/inline/threadreply-command.d.ts.map +1 -1
- package/dist/runtime-register-api.js +178 -12
- package/dist/runtime-register-api.js.map +5 -5
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-formatting.d.ts","sourceRoot":"","sources":["../../src/inline/message-formatting.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"message-formatting.d.ts","sourceRoot":"","sources":["../../src/inline/message-formatting.ts"],"names":[],"mappings":"AA8BA,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM3D;AAED,wBAAgB,uBAAuB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED,wBAAgB,iCAAiC,IAAI;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAK5F;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monitor.d.ts","sourceRoot":"","sources":["../../src/inline/monitor.ts"],"names":[],"mappings":"AAqEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAA;AACjF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAEjE,OAAO,EAAsB,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"monitor.d.ts","sourceRoot":"","sources":["../../src/inline/monitor.ts"],"names":[],"mappings":"AAqEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAA;AACjF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAEjE,OAAO,EAAsB,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAoE9E,KAAK,mBAAmB,GAAG;IACzB,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IACzB,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;CACpB,CAAA;AAUD,KAAK,UAAU,GAAG,CAAC,KAAK,EAAE;IACxB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,uBAAuB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,KAAK,IAAI,CAAA;AAgiEV,wBAAsB,qBAAqB,CAAC,MAAM,EAAE;IAClD,GAAG,EAAE,cAAc,CAAA;IACnB,OAAO,EAAE,qBAAqB,CAAA;IAC9B,OAAO,EAAE,UAAU,CAAA;IACnB,cAAc,CAAC,EAAE,qBAAqB,CAAA;IACtC,WAAW,EAAE,WAAW,CAAA;IACxB,GAAG,CAAC,EAAE;QAAE,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,CAAA;IAC/H,UAAU,CAAC,EAAE,UAAU,CAAA;CACxB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAgzE/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"threadreply-command.d.ts","sourceRoot":"","sources":["../../src/inline/threadreply-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,+BAA+B,EAC/B,oBAAoB,EACrB,MAAM,4CAA4C,CAAA;
|
|
1
|
+
{"version":3,"file":"threadreply-command.d.ts","sourceRoot":"","sources":["../../src/inline/threadreply-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,+BAA+B,EAC/B,oBAAoB,EACrB,MAAM,4CAA4C,CAAA;AAgTnD,wBAAsB,8BAA8B,CAClD,GAAG,EAAE,iBAAiB,EACtB,GAAG,EAAE,oBAAoB;;;;;;;;;;;;;GA8F1B;AAED,wBAAgB,8BAA8B,CAC5C,GAAG,EAAE,iBAAiB,GACrB,+BAA+B,CASjC"}
|
|
@@ -6957,7 +6957,8 @@ class Chat$Type extends import_runtime4.MessageType {
|
|
|
6957
6957
|
{ no: 9, name: "date", kind: "scalar", opt: true, T: 3, L: 0 },
|
|
6958
6958
|
{ no: 10, name: "created_by", kind: "scalar", opt: true, T: 3, L: 0 },
|
|
6959
6959
|
{ no: 11, name: "parent_chat_id", kind: "scalar", opt: true, T: 3, L: 0 },
|
|
6960
|
-
{ no: 12, name: "parent_message_id", kind: "scalar", opt: true, T: 3, L: 0 }
|
|
6960
|
+
{ no: 12, name: "parent_message_id", kind: "scalar", opt: true, T: 3, L: 0 },
|
|
6961
|
+
{ no: 13, name: "untitled", kind: "scalar", opt: true, T: 8 }
|
|
6961
6962
|
]);
|
|
6962
6963
|
}
|
|
6963
6964
|
create(value) {
|
|
@@ -7009,6 +7010,9 @@ class Chat$Type extends import_runtime4.MessageType {
|
|
|
7009
7010
|
case 12:
|
|
7010
7011
|
message.parentMessageId = reader.int64().toBigInt();
|
|
7011
7012
|
break;
|
|
7013
|
+
case 13:
|
|
7014
|
+
message.untitled = reader.bool();
|
|
7015
|
+
break;
|
|
7012
7016
|
default:
|
|
7013
7017
|
let u = options.readUnknownField;
|
|
7014
7018
|
if (u === "throw")
|
|
@@ -7045,6 +7049,8 @@ class Chat$Type extends import_runtime4.MessageType {
|
|
|
7045
7049
|
writer.tag(11, import_runtime.WireType.Varint).int64(message.parentChatId);
|
|
7046
7050
|
if (message.parentMessageId !== undefined)
|
|
7047
7051
|
writer.tag(12, import_runtime.WireType.Varint).int64(message.parentMessageId);
|
|
7052
|
+
if (message.untitled !== undefined)
|
|
7053
|
+
writer.tag(13, import_runtime.WireType.Varint).bool(message.untitled);
|
|
7048
7054
|
let u = options.writeUnknownFields;
|
|
7049
7055
|
if (u !== false)
|
|
7050
7056
|
(u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
@@ -11154,6 +11160,63 @@ class GetUpdatesInput$Type extends import_runtime4.MessageType {
|
|
|
11154
11160
|
}
|
|
11155
11161
|
var GetUpdatesInput = new GetUpdatesInput$Type;
|
|
11156
11162
|
|
|
11163
|
+
class UpdateSidecars$Type extends import_runtime4.MessageType {
|
|
11164
|
+
constructor() {
|
|
11165
|
+
super("UpdateSidecars", [
|
|
11166
|
+
{ no: 1, name: "users", kind: "message", repeat: 1, T: () => User },
|
|
11167
|
+
{ no: 2, name: "chats", kind: "message", repeat: 1, T: () => Chat },
|
|
11168
|
+
{ no: 3, name: "dialogs", kind: "message", repeat: 1, T: () => Dialog }
|
|
11169
|
+
]);
|
|
11170
|
+
}
|
|
11171
|
+
create(value) {
|
|
11172
|
+
const message = globalThis.Object.create(this.messagePrototype);
|
|
11173
|
+
message.users = [];
|
|
11174
|
+
message.chats = [];
|
|
11175
|
+
message.dialogs = [];
|
|
11176
|
+
if (value !== undefined)
|
|
11177
|
+
import_runtime3.reflectionMergePartial(this, message, value);
|
|
11178
|
+
return message;
|
|
11179
|
+
}
|
|
11180
|
+
internalBinaryRead(reader, length, options, target) {
|
|
11181
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
11182
|
+
while (reader.pos < end) {
|
|
11183
|
+
let [fieldNo, wireType] = reader.tag();
|
|
11184
|
+
switch (fieldNo) {
|
|
11185
|
+
case 1:
|
|
11186
|
+
message.users.push(User.internalBinaryRead(reader, reader.uint32(), options));
|
|
11187
|
+
break;
|
|
11188
|
+
case 2:
|
|
11189
|
+
message.chats.push(Chat.internalBinaryRead(reader, reader.uint32(), options));
|
|
11190
|
+
break;
|
|
11191
|
+
case 3:
|
|
11192
|
+
message.dialogs.push(Dialog.internalBinaryRead(reader, reader.uint32(), options));
|
|
11193
|
+
break;
|
|
11194
|
+
default:
|
|
11195
|
+
let u = options.readUnknownField;
|
|
11196
|
+
if (u === "throw")
|
|
11197
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
11198
|
+
let d = reader.skip(wireType);
|
|
11199
|
+
if (u !== false)
|
|
11200
|
+
(u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
11201
|
+
}
|
|
11202
|
+
}
|
|
11203
|
+
return message;
|
|
11204
|
+
}
|
|
11205
|
+
internalBinaryWrite(message, writer, options) {
|
|
11206
|
+
for (let i = 0;i < message.users.length; i++)
|
|
11207
|
+
User.internalBinaryWrite(message.users[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
|
|
11208
|
+
for (let i = 0;i < message.chats.length; i++)
|
|
11209
|
+
Chat.internalBinaryWrite(message.chats[i], writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
|
|
11210
|
+
for (let i = 0;i < message.dialogs.length; i++)
|
|
11211
|
+
Dialog.internalBinaryWrite(message.dialogs[i], writer.tag(3, import_runtime.WireType.LengthDelimited).fork(), options).join();
|
|
11212
|
+
let u = options.writeUnknownFields;
|
|
11213
|
+
if (u !== false)
|
|
11214
|
+
(u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
11215
|
+
return writer;
|
|
11216
|
+
}
|
|
11217
|
+
}
|
|
11218
|
+
var UpdateSidecars = new UpdateSidecars$Type;
|
|
11219
|
+
|
|
11157
11220
|
class GetUpdatesResult$Type extends import_runtime4.MessageType {
|
|
11158
11221
|
constructor() {
|
|
11159
11222
|
super("GetUpdatesResult", [
|
|
@@ -11161,7 +11224,8 @@ class GetUpdatesResult$Type extends import_runtime4.MessageType {
|
|
|
11161
11224
|
{ no: 2, name: "seq", kind: "scalar", T: 3, L: 0 },
|
|
11162
11225
|
{ no: 3, name: "date", kind: "scalar", T: 3, L: 0 },
|
|
11163
11226
|
{ no: 4, name: "final", kind: "scalar", opt: true, T: 8 },
|
|
11164
|
-
{ no: 5, name: "result_type", kind: "enum", T: () => ["GetUpdatesResult.ResultType", GetUpdatesResult_ResultType, "RESULT_TYPE_"] }
|
|
11227
|
+
{ no: 5, name: "result_type", kind: "enum", T: () => ["GetUpdatesResult.ResultType", GetUpdatesResult_ResultType, "RESULT_TYPE_"] },
|
|
11228
|
+
{ no: 6, name: "sidecars", kind: "message", T: () => UpdateSidecars }
|
|
11165
11229
|
]);
|
|
11166
11230
|
}
|
|
11167
11231
|
create(value) {
|
|
@@ -11194,6 +11258,9 @@ class GetUpdatesResult$Type extends import_runtime4.MessageType {
|
|
|
11194
11258
|
case 5:
|
|
11195
11259
|
message.resultType = reader.int32();
|
|
11196
11260
|
break;
|
|
11261
|
+
case 6:
|
|
11262
|
+
message.sidecars = UpdateSidecars.internalBinaryRead(reader, reader.uint32(), options, message.sidecars);
|
|
11263
|
+
break;
|
|
11197
11264
|
default:
|
|
11198
11265
|
let u = options.readUnknownField;
|
|
11199
11266
|
if (u === "throw")
|
|
@@ -11216,6 +11283,8 @@ class GetUpdatesResult$Type extends import_runtime4.MessageType {
|
|
|
11216
11283
|
writer.tag(4, import_runtime.WireType.Varint).bool(message.final);
|
|
11217
11284
|
if (message.resultType !== 0)
|
|
11218
11285
|
writer.tag(5, import_runtime.WireType.Varint).int32(message.resultType);
|
|
11286
|
+
if (message.sidecars)
|
|
11287
|
+
UpdateSidecars.internalBinaryWrite(message.sidecars, writer.tag(6, import_runtime.WireType.LengthDelimited).fork(), options).join();
|
|
11219
11288
|
let u = options.writeUnknownFields;
|
|
11220
11289
|
if (u !== false)
|
|
11221
11290
|
(u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
@@ -15942,7 +16011,7 @@ var ReserveChatIdsResult = new ReserveChatIdsResult$Type;
|
|
|
15942
16011
|
class CreateChatInput$Type extends import_runtime4.MessageType {
|
|
15943
16012
|
constructor() {
|
|
15944
16013
|
super("CreateChatInput", [
|
|
15945
|
-
{ no: 1, name: "title", kind: "scalar", T: 9 },
|
|
16014
|
+
{ no: 1, name: "title", kind: "scalar", opt: true, T: 9 },
|
|
15946
16015
|
{ no: 2, name: "space_id", kind: "scalar", opt: true, T: 3, L: 0 },
|
|
15947
16016
|
{ no: 3, name: "description", kind: "scalar", opt: true, T: 9 },
|
|
15948
16017
|
{ no: 4, name: "emoji", kind: "scalar", opt: true, T: 9 },
|
|
@@ -15953,7 +16022,6 @@ class CreateChatInput$Type extends import_runtime4.MessageType {
|
|
|
15953
16022
|
}
|
|
15954
16023
|
create(value) {
|
|
15955
16024
|
const message = globalThis.Object.create(this.messagePrototype);
|
|
15956
|
-
message.title = "";
|
|
15957
16025
|
message.isPublic = false;
|
|
15958
16026
|
message.participants = [];
|
|
15959
16027
|
if (value !== undefined)
|
|
@@ -15998,7 +16066,7 @@ class CreateChatInput$Type extends import_runtime4.MessageType {
|
|
|
15998
16066
|
return message;
|
|
15999
16067
|
}
|
|
16000
16068
|
internalBinaryWrite(message, writer, options) {
|
|
16001
|
-
if (message.title !==
|
|
16069
|
+
if (message.title !== undefined)
|
|
16002
16070
|
writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.title);
|
|
16003
16071
|
if (message.spaceId !== undefined)
|
|
16004
16072
|
writer.tag(2, import_runtime.WireType.Varint).int64(message.spaceId);
|
|
@@ -16848,7 +16916,8 @@ class UpdateChatInfo$Type extends import_runtime4.MessageType {
|
|
|
16848
16916
|
super("UpdateChatInfo", [
|
|
16849
16917
|
{ no: 1, name: "chat_id", kind: "scalar", T: 3, L: 0 },
|
|
16850
16918
|
{ no: 2, name: "title", kind: "scalar", opt: true, T: 9 },
|
|
16851
|
-
{ no: 3, name: "emoji", kind: "scalar", opt: true, T: 9 }
|
|
16919
|
+
{ no: 3, name: "emoji", kind: "scalar", opt: true, T: 9 },
|
|
16920
|
+
{ no: 4, name: "untitled", kind: "scalar", opt: true, T: 8 }
|
|
16852
16921
|
]);
|
|
16853
16922
|
}
|
|
16854
16923
|
create(value) {
|
|
@@ -16872,6 +16941,9 @@ class UpdateChatInfo$Type extends import_runtime4.MessageType {
|
|
|
16872
16941
|
case 3:
|
|
16873
16942
|
message.emoji = reader.string();
|
|
16874
16943
|
break;
|
|
16944
|
+
case 4:
|
|
16945
|
+
message.untitled = reader.bool();
|
|
16946
|
+
break;
|
|
16875
16947
|
default:
|
|
16876
16948
|
let u = options.readUnknownField;
|
|
16877
16949
|
if (u === "throw")
|
|
@@ -16890,6 +16962,8 @@ class UpdateChatInfo$Type extends import_runtime4.MessageType {
|
|
|
16890
16962
|
writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.title);
|
|
16891
16963
|
if (message.emoji !== undefined)
|
|
16892
16964
|
writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.emoji);
|
|
16965
|
+
if (message.untitled !== undefined)
|
|
16966
|
+
writer.tag(4, import_runtime.WireType.Varint).bool(message.untitled);
|
|
16893
16967
|
let u = options.writeUnknownFields;
|
|
16894
16968
|
if (u !== false)
|
|
16895
16969
|
(u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
@@ -38360,6 +38434,7 @@ var INLINE_FORMATTING_RULES = [
|
|
|
38360
38434
|
"Prefer bullet lists over markdown tables.",
|
|
38361
38435
|
"If a table is necessary, render it inside a fenced code block.",
|
|
38362
38436
|
"Use plain URLs or markdown links; do not wrap bare URLs in inline code or backticks.",
|
|
38437
|
+
"Mention Inline users with markdown links like [@FirstName](inline://user?id=123); use inline://user?username=username only when the user id is unavailable.",
|
|
38363
38438
|
"Use inline code only for actual code, commands, file paths, env vars, or identifiers."
|
|
38364
38439
|
];
|
|
38365
38440
|
var INLINE_COPY_REPLACEMENTS = [
|
|
@@ -39112,6 +39187,7 @@ var MODE_LABELS = {
|
|
|
39112
39187
|
thread: "thread",
|
|
39113
39188
|
main: "main"
|
|
39114
39189
|
};
|
|
39190
|
+
var DEFAULT_REPLY_THREAD_AUTO_CREATE_MIN_MESSAGES = 50;
|
|
39115
39191
|
function isRecord3(value) {
|
|
39116
39192
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
39117
39193
|
}
|
|
@@ -39130,6 +39206,24 @@ function normalizeMode(raw) {
|
|
|
39130
39206
|
return normalized;
|
|
39131
39207
|
return null;
|
|
39132
39208
|
}
|
|
39209
|
+
function normalizeMin(raw) {
|
|
39210
|
+
if (typeof raw !== "number")
|
|
39211
|
+
return null;
|
|
39212
|
+
if (!Number.isInteger(raw) || raw < 0)
|
|
39213
|
+
return null;
|
|
39214
|
+
return raw;
|
|
39215
|
+
}
|
|
39216
|
+
function parseMinArg(raw) {
|
|
39217
|
+
const value = raw?.trim().toLowerCase();
|
|
39218
|
+
if (!value)
|
|
39219
|
+
return null;
|
|
39220
|
+
if (value === "inherit" || value === "default" || value === "unset")
|
|
39221
|
+
return "inherit";
|
|
39222
|
+
if (!/^\d+$/.test(value))
|
|
39223
|
+
return null;
|
|
39224
|
+
const parsed = Number(value);
|
|
39225
|
+
return Number.isSafeInteger(parsed) ? parsed : null;
|
|
39226
|
+
}
|
|
39133
39227
|
function resolveInlineGroupId(ctx) {
|
|
39134
39228
|
const raw = ctx.from?.trim() ?? "";
|
|
39135
39229
|
if (!/(^|:)chat:/i.test(raw))
|
|
@@ -39159,6 +39253,16 @@ function resolveCurrentMode(params) {
|
|
|
39159
39253
|
defaultMode: normalizeMode(accountConfig.replyThreadMode) ?? "auto"
|
|
39160
39254
|
});
|
|
39161
39255
|
}
|
|
39256
|
+
function resolveCurrentMinMessages(params) {
|
|
39257
|
+
const inline = asInlineConfig(params.cfg.channels?.inline) ?? {};
|
|
39258
|
+
const accountConfig = resolveInlineConfigForAccount(inline, params.accountId);
|
|
39259
|
+
return resolveInlineGroupReplyThreadAutoCreateMinMessages({
|
|
39260
|
+
cfg: params.cfg,
|
|
39261
|
+
accountId: params.accountId ?? null,
|
|
39262
|
+
groupId: params.groupId,
|
|
39263
|
+
defaultMinMessages: normalizeMin(accountConfig.replyThreadAutoCreateMinMessages) ?? DEFAULT_REPLY_THREAD_AUTO_CREATE_MIN_MESSAGES
|
|
39264
|
+
});
|
|
39265
|
+
}
|
|
39162
39266
|
function readExplicitMode(params) {
|
|
39163
39267
|
const inline = asInlineConfig(params.cfg.channels?.inline);
|
|
39164
39268
|
if (!inline)
|
|
@@ -39167,6 +39271,14 @@ function readExplicitMode(params) {
|
|
|
39167
39271
|
const group = accountConfig.groups?.[params.groupId];
|
|
39168
39272
|
return normalizeMode(group?.replyThreadMode);
|
|
39169
39273
|
}
|
|
39274
|
+
function readExplicitMinMessages(params) {
|
|
39275
|
+
const inline = asInlineConfig(params.cfg.channels?.inline);
|
|
39276
|
+
if (!inline)
|
|
39277
|
+
return null;
|
|
39278
|
+
const accountConfig = resolveInlineConfigForAccount(inline, params.accountId);
|
|
39279
|
+
const group = accountConfig.groups?.[params.groupId];
|
|
39280
|
+
return normalizeMin(group?.replyThreadAutoCreateMinMessages);
|
|
39281
|
+
}
|
|
39170
39282
|
function ensureRecordField(parent, key) {
|
|
39171
39283
|
const current = parent[key];
|
|
39172
39284
|
if (isRecord3(current))
|
|
@@ -39205,12 +39317,32 @@ function setGroupMode(params) {
|
|
|
39205
39317
|
}
|
|
39206
39318
|
group.replyThreadMode = params.mode;
|
|
39207
39319
|
}
|
|
39320
|
+
function setGroupMinMessages(params) {
|
|
39321
|
+
const root = params.draft;
|
|
39322
|
+
const channels = root.channels ?? {};
|
|
39323
|
+
root.channels = channels;
|
|
39324
|
+
const inline = asInlineConfig(channels.inline) ?? {};
|
|
39325
|
+
channels.inline = inline;
|
|
39326
|
+
const accountConfig = resolveMutableInlineConfigForAccount(inline, params.accountId);
|
|
39327
|
+
const groups = ensureRecordField(accountConfig, "groups");
|
|
39328
|
+
const group = isRecord3(groups[params.groupId]) ? groups[params.groupId] : {};
|
|
39329
|
+
groups[params.groupId] = group;
|
|
39330
|
+
if (params.minMessages === "inherit") {
|
|
39331
|
+
delete group.replyThreadAutoCreateMinMessages;
|
|
39332
|
+
return;
|
|
39333
|
+
}
|
|
39334
|
+
group.replyThreadAutoCreateMinMessages = params.minMessages;
|
|
39335
|
+
}
|
|
39208
39336
|
function buildStatusText(params) {
|
|
39209
39337
|
const explicit = readExplicitMode(params);
|
|
39210
39338
|
const current = resolveCurrentMode(params);
|
|
39339
|
+
const explicitMin = readExplicitMinMessages(params);
|
|
39340
|
+
const currentMin = resolveCurrentMinMessages(params);
|
|
39211
39341
|
return [
|
|
39212
39342
|
`Thread reply mode for chat ${params.groupId}: ${MODE_LABELS[current]}.`,
|
|
39213
|
-
explicit ? `Explicit chat override: ${MODE_LABELS[explicit]}.` : "Explicit chat override: inherit."
|
|
39343
|
+
explicit ? `Explicit chat override: ${MODE_LABELS[explicit]}.` : "Explicit chat override: inherit.",
|
|
39344
|
+
`Auto-create minimum messages: ${currentMin}.`,
|
|
39345
|
+
explicitMin != null ? `Explicit minimum override: ${explicitMin}.` : "Explicit minimum override: inherit."
|
|
39214
39346
|
].join(`
|
|
39215
39347
|
`);
|
|
39216
39348
|
}
|
|
@@ -39231,7 +39363,12 @@ function buildModeButtons() {
|
|
|
39231
39363
|
{ text: "Main", callback_data: "/threadreply main" },
|
|
39232
39364
|
{ text: "Auto", callback_data: "/threadreply auto" }
|
|
39233
39365
|
],
|
|
39234
|
-
[{ text: "Inherit", callback_data: "/threadreply inherit" }]
|
|
39366
|
+
[{ text: "Inherit Mode", callback_data: "/threadreply inherit" }],
|
|
39367
|
+
[
|
|
39368
|
+
{ text: "Min 0", callback_data: "/threadreply min 0" },
|
|
39369
|
+
{ text: "Min 50", callback_data: "/threadreply min 50" },
|
|
39370
|
+
{ text: "Inherit Min", callback_data: "/threadreply min inherit" }
|
|
39371
|
+
]
|
|
39235
39372
|
]
|
|
39236
39373
|
}
|
|
39237
39374
|
};
|
|
@@ -39256,7 +39393,34 @@ async function handleInlineThreadReplyCommand(api2, ctx) {
|
|
|
39256
39393
|
return { text: "/threadreply is only available in Inline group chats." };
|
|
39257
39394
|
}
|
|
39258
39395
|
const currentConfig = api2.runtime.config.current();
|
|
39259
|
-
const
|
|
39396
|
+
const args = ctx.args?.trim() ?? "";
|
|
39397
|
+
const [first = "", second, ...rest] = args.split(/\s+/).filter(Boolean);
|
|
39398
|
+
if (["min", "minimum", "threshold", "limit"].includes(first.trim().toLowerCase())) {
|
|
39399
|
+
const minMessages = parseMinArg(second);
|
|
39400
|
+
if (minMessages == null || rest.length > 0) {
|
|
39401
|
+
return { text: "Usage: /threadreply min <0-or-greater>|inherit" };
|
|
39402
|
+
}
|
|
39403
|
+
const committed2 = await api2.runtime.config.mutateConfigFile({
|
|
39404
|
+
afterWrite: { mode: "auto" },
|
|
39405
|
+
mutate: (draft) => {
|
|
39406
|
+
setGroupMinMessages({
|
|
39407
|
+
draft,
|
|
39408
|
+
accountId: ctx.accountId,
|
|
39409
|
+
groupId,
|
|
39410
|
+
minMessages
|
|
39411
|
+
});
|
|
39412
|
+
}
|
|
39413
|
+
});
|
|
39414
|
+
const nextConfig2 = committed2.nextConfig;
|
|
39415
|
+
return {
|
|
39416
|
+
text: buildStatusText({
|
|
39417
|
+
cfg: nextConfig2,
|
|
39418
|
+
accountId: ctx.accountId,
|
|
39419
|
+
groupId
|
|
39420
|
+
})
|
|
39421
|
+
};
|
|
39422
|
+
}
|
|
39423
|
+
const action = normalizeAction(args);
|
|
39260
39424
|
if (action === "help") {
|
|
39261
39425
|
return {
|
|
39262
39426
|
text: buildMenuText({
|
|
@@ -39280,11 +39444,13 @@ async function handleInlineThreadReplyCommand(api2, ctx) {
|
|
|
39280
39444
|
return {
|
|
39281
39445
|
text: [
|
|
39282
39446
|
"Usage: /threadreply thread|main|auto|inherit|status",
|
|
39447
|
+
" /threadreply min <0-or-greater>|inherit",
|
|
39283
39448
|
"",
|
|
39284
|
-
"- thread: auto-route
|
|
39449
|
+
"- thread: auto-route parent-chat replies into per-message Inline reply threads once the minimum is reached.",
|
|
39285
39450
|
"- main: keep automatic replies in the parent chat.",
|
|
39286
39451
|
"- auto: use Inline's automatic default behavior for this chat.",
|
|
39287
|
-
"- inherit: remove this chat override and use account/default config."
|
|
39452
|
+
"- inherit: remove this chat override and use account/default config.",
|
|
39453
|
+
"- min: set how many parent-chat messages must exist before automatic thread creation."
|
|
39288
39454
|
].join(`
|
|
39289
39455
|
`)
|
|
39290
39456
|
};
|
|
@@ -39368,5 +39534,5 @@ export {
|
|
|
39368
39534
|
registerInlinePluginFull
|
|
39369
39535
|
};
|
|
39370
39536
|
|
|
39371
|
-
//# debugId=
|
|
39537
|
+
//# debugId=A0B96B5920BE445464756E2164756E21
|
|
39372
39538
|
//# sourceMappingURL=runtime-register-api.js.map
|