@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
|
@@ -6984,7 +6984,8 @@ class Chat$Type extends import_runtime4.MessageType {
|
|
|
6984
6984
|
{ no: 9, name: "date", kind: "scalar", opt: true, T: 3, L: 0 },
|
|
6985
6985
|
{ no: 10, name: "created_by", kind: "scalar", opt: true, T: 3, L: 0 },
|
|
6986
6986
|
{ no: 11, name: "parent_chat_id", kind: "scalar", opt: true, T: 3, L: 0 },
|
|
6987
|
-
{ no: 12, name: "parent_message_id", kind: "scalar", opt: true, T: 3, L: 0 }
|
|
6987
|
+
{ 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 }
|
|
6988
6989
|
]);
|
|
6989
6990
|
}
|
|
6990
6991
|
create(value) {
|
|
@@ -7036,6 +7037,9 @@ class Chat$Type extends import_runtime4.MessageType {
|
|
|
7036
7037
|
case 12:
|
|
7037
7038
|
message.parentMessageId = reader.int64().toBigInt();
|
|
7038
7039
|
break;
|
|
7040
|
+
case 13:
|
|
7041
|
+
message.untitled = reader.bool();
|
|
7042
|
+
break;
|
|
7039
7043
|
default:
|
|
7040
7044
|
let u = options.readUnknownField;
|
|
7041
7045
|
if (u === "throw")
|
|
@@ -7072,6 +7076,8 @@ class Chat$Type extends import_runtime4.MessageType {
|
|
|
7072
7076
|
writer.tag(11, import_runtime.WireType.Varint).int64(message.parentChatId);
|
|
7073
7077
|
if (message.parentMessageId !== undefined)
|
|
7074
7078
|
writer.tag(12, import_runtime.WireType.Varint).int64(message.parentMessageId);
|
|
7079
|
+
if (message.untitled !== undefined)
|
|
7080
|
+
writer.tag(13, import_runtime.WireType.Varint).bool(message.untitled);
|
|
7075
7081
|
let u = options.writeUnknownFields;
|
|
7076
7082
|
if (u !== false)
|
|
7077
7083
|
(u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
@@ -11181,6 +11187,63 @@ class GetUpdatesInput$Type extends import_runtime4.MessageType {
|
|
|
11181
11187
|
}
|
|
11182
11188
|
var GetUpdatesInput = new GetUpdatesInput$Type;
|
|
11183
11189
|
|
|
11190
|
+
class UpdateSidecars$Type extends import_runtime4.MessageType {
|
|
11191
|
+
constructor() {
|
|
11192
|
+
super("UpdateSidecars", [
|
|
11193
|
+
{ no: 1, name: "users", kind: "message", repeat: 1, T: () => User },
|
|
11194
|
+
{ no: 2, name: "chats", kind: "message", repeat: 1, T: () => Chat },
|
|
11195
|
+
{ no: 3, name: "dialogs", kind: "message", repeat: 1, T: () => Dialog }
|
|
11196
|
+
]);
|
|
11197
|
+
}
|
|
11198
|
+
create(value) {
|
|
11199
|
+
const message = globalThis.Object.create(this.messagePrototype);
|
|
11200
|
+
message.users = [];
|
|
11201
|
+
message.chats = [];
|
|
11202
|
+
message.dialogs = [];
|
|
11203
|
+
if (value !== undefined)
|
|
11204
|
+
import_runtime3.reflectionMergePartial(this, message, value);
|
|
11205
|
+
return message;
|
|
11206
|
+
}
|
|
11207
|
+
internalBinaryRead(reader, length, options, target) {
|
|
11208
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
11209
|
+
while (reader.pos < end) {
|
|
11210
|
+
let [fieldNo, wireType] = reader.tag();
|
|
11211
|
+
switch (fieldNo) {
|
|
11212
|
+
case 1:
|
|
11213
|
+
message.users.push(User.internalBinaryRead(reader, reader.uint32(), options));
|
|
11214
|
+
break;
|
|
11215
|
+
case 2:
|
|
11216
|
+
message.chats.push(Chat.internalBinaryRead(reader, reader.uint32(), options));
|
|
11217
|
+
break;
|
|
11218
|
+
case 3:
|
|
11219
|
+
message.dialogs.push(Dialog.internalBinaryRead(reader, reader.uint32(), options));
|
|
11220
|
+
break;
|
|
11221
|
+
default:
|
|
11222
|
+
let u = options.readUnknownField;
|
|
11223
|
+
if (u === "throw")
|
|
11224
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
11225
|
+
let d = reader.skip(wireType);
|
|
11226
|
+
if (u !== false)
|
|
11227
|
+
(u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
11228
|
+
}
|
|
11229
|
+
}
|
|
11230
|
+
return message;
|
|
11231
|
+
}
|
|
11232
|
+
internalBinaryWrite(message, writer, options) {
|
|
11233
|
+
for (let i = 0;i < message.users.length; i++)
|
|
11234
|
+
User.internalBinaryWrite(message.users[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
|
|
11235
|
+
for (let i = 0;i < message.chats.length; i++)
|
|
11236
|
+
Chat.internalBinaryWrite(message.chats[i], writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
|
|
11237
|
+
for (let i = 0;i < message.dialogs.length; i++)
|
|
11238
|
+
Dialog.internalBinaryWrite(message.dialogs[i], writer.tag(3, import_runtime.WireType.LengthDelimited).fork(), options).join();
|
|
11239
|
+
let u = options.writeUnknownFields;
|
|
11240
|
+
if (u !== false)
|
|
11241
|
+
(u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
11242
|
+
return writer;
|
|
11243
|
+
}
|
|
11244
|
+
}
|
|
11245
|
+
var UpdateSidecars = new UpdateSidecars$Type;
|
|
11246
|
+
|
|
11184
11247
|
class GetUpdatesResult$Type extends import_runtime4.MessageType {
|
|
11185
11248
|
constructor() {
|
|
11186
11249
|
super("GetUpdatesResult", [
|
|
@@ -11188,7 +11251,8 @@ class GetUpdatesResult$Type extends import_runtime4.MessageType {
|
|
|
11188
11251
|
{ no: 2, name: "seq", kind: "scalar", T: 3, L: 0 },
|
|
11189
11252
|
{ no: 3, name: "date", kind: "scalar", T: 3, L: 0 },
|
|
11190
11253
|
{ no: 4, name: "final", kind: "scalar", opt: true, T: 8 },
|
|
11191
|
-
{ no: 5, name: "result_type", kind: "enum", T: () => ["GetUpdatesResult.ResultType", GetUpdatesResult_ResultType, "RESULT_TYPE_"] }
|
|
11254
|
+
{ no: 5, name: "result_type", kind: "enum", T: () => ["GetUpdatesResult.ResultType", GetUpdatesResult_ResultType, "RESULT_TYPE_"] },
|
|
11255
|
+
{ no: 6, name: "sidecars", kind: "message", T: () => UpdateSidecars }
|
|
11192
11256
|
]);
|
|
11193
11257
|
}
|
|
11194
11258
|
create(value) {
|
|
@@ -11221,6 +11285,9 @@ class GetUpdatesResult$Type extends import_runtime4.MessageType {
|
|
|
11221
11285
|
case 5:
|
|
11222
11286
|
message.resultType = reader.int32();
|
|
11223
11287
|
break;
|
|
11288
|
+
case 6:
|
|
11289
|
+
message.sidecars = UpdateSidecars.internalBinaryRead(reader, reader.uint32(), options, message.sidecars);
|
|
11290
|
+
break;
|
|
11224
11291
|
default:
|
|
11225
11292
|
let u = options.readUnknownField;
|
|
11226
11293
|
if (u === "throw")
|
|
@@ -11243,6 +11310,8 @@ class GetUpdatesResult$Type extends import_runtime4.MessageType {
|
|
|
11243
11310
|
writer.tag(4, import_runtime.WireType.Varint).bool(message.final);
|
|
11244
11311
|
if (message.resultType !== 0)
|
|
11245
11312
|
writer.tag(5, import_runtime.WireType.Varint).int32(message.resultType);
|
|
11313
|
+
if (message.sidecars)
|
|
11314
|
+
UpdateSidecars.internalBinaryWrite(message.sidecars, writer.tag(6, import_runtime.WireType.LengthDelimited).fork(), options).join();
|
|
11246
11315
|
let u = options.writeUnknownFields;
|
|
11247
11316
|
if (u !== false)
|
|
11248
11317
|
(u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
@@ -15969,7 +16038,7 @@ var ReserveChatIdsResult = new ReserveChatIdsResult$Type;
|
|
|
15969
16038
|
class CreateChatInput$Type extends import_runtime4.MessageType {
|
|
15970
16039
|
constructor() {
|
|
15971
16040
|
super("CreateChatInput", [
|
|
15972
|
-
{ no: 1, name: "title", kind: "scalar", T: 9 },
|
|
16041
|
+
{ no: 1, name: "title", kind: "scalar", opt: true, T: 9 },
|
|
15973
16042
|
{ no: 2, name: "space_id", kind: "scalar", opt: true, T: 3, L: 0 },
|
|
15974
16043
|
{ no: 3, name: "description", kind: "scalar", opt: true, T: 9 },
|
|
15975
16044
|
{ no: 4, name: "emoji", kind: "scalar", opt: true, T: 9 },
|
|
@@ -15980,7 +16049,6 @@ class CreateChatInput$Type extends import_runtime4.MessageType {
|
|
|
15980
16049
|
}
|
|
15981
16050
|
create(value) {
|
|
15982
16051
|
const message = globalThis.Object.create(this.messagePrototype);
|
|
15983
|
-
message.title = "";
|
|
15984
16052
|
message.isPublic = false;
|
|
15985
16053
|
message.participants = [];
|
|
15986
16054
|
if (value !== undefined)
|
|
@@ -16025,7 +16093,7 @@ class CreateChatInput$Type extends import_runtime4.MessageType {
|
|
|
16025
16093
|
return message;
|
|
16026
16094
|
}
|
|
16027
16095
|
internalBinaryWrite(message, writer, options) {
|
|
16028
|
-
if (message.title !==
|
|
16096
|
+
if (message.title !== undefined)
|
|
16029
16097
|
writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.title);
|
|
16030
16098
|
if (message.spaceId !== undefined)
|
|
16031
16099
|
writer.tag(2, import_runtime.WireType.Varint).int64(message.spaceId);
|
|
@@ -16875,7 +16943,8 @@ class UpdateChatInfo$Type extends import_runtime4.MessageType {
|
|
|
16875
16943
|
super("UpdateChatInfo", [
|
|
16876
16944
|
{ no: 1, name: "chat_id", kind: "scalar", T: 3, L: 0 },
|
|
16877
16945
|
{ no: 2, name: "title", kind: "scalar", opt: true, T: 9 },
|
|
16878
|
-
{ no: 3, name: "emoji", kind: "scalar", opt: true, T: 9 }
|
|
16946
|
+
{ no: 3, name: "emoji", kind: "scalar", opt: true, T: 9 },
|
|
16947
|
+
{ no: 4, name: "untitled", kind: "scalar", opt: true, T: 8 }
|
|
16879
16948
|
]);
|
|
16880
16949
|
}
|
|
16881
16950
|
create(value) {
|
|
@@ -16899,6 +16968,9 @@ class UpdateChatInfo$Type extends import_runtime4.MessageType {
|
|
|
16899
16968
|
case 3:
|
|
16900
16969
|
message.emoji = reader.string();
|
|
16901
16970
|
break;
|
|
16971
|
+
case 4:
|
|
16972
|
+
message.untitled = reader.bool();
|
|
16973
|
+
break;
|
|
16902
16974
|
default:
|
|
16903
16975
|
let u = options.readUnknownField;
|
|
16904
16976
|
if (u === "throw")
|
|
@@ -16917,6 +16989,8 @@ class UpdateChatInfo$Type extends import_runtime4.MessageType {
|
|
|
16917
16989
|
writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.title);
|
|
16918
16990
|
if (message.emoji !== undefined)
|
|
16919
16991
|
writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.emoji);
|
|
16992
|
+
if (message.untitled !== undefined)
|
|
16993
|
+
writer.tag(4, import_runtime.WireType.Varint).bool(message.untitled);
|
|
16920
16994
|
let u = options.writeUnknownFields;
|
|
16921
16995
|
if (u !== false)
|
|
16922
16996
|
(u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
@@ -37728,6 +37802,7 @@ var INLINE_FORMATTING_RULES = [
|
|
|
37728
37802
|
"Prefer bullet lists over markdown tables.",
|
|
37729
37803
|
"If a table is necessary, render it inside a fenced code block.",
|
|
37730
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.",
|
|
37731
37806
|
"Use inline code only for actual code, commands, file paths, env vars, or identifiers."
|
|
37732
37807
|
];
|
|
37733
37808
|
var INLINE_COPY_REPLACEMENTS = [
|
|
@@ -40974,6 +41049,7 @@ var INLINE_REQUEST_ERROR_FALLBACK = "OpenClaw could not process that request. Pl
|
|
|
40974
41049
|
var INLINE_DEBOUNCE_ERROR_FALLBACK = "OpenClaw could not process those messages. Please try again.";
|
|
40975
41050
|
var DEFAULT_REPLY_THREAD_AUTO_CREATE_MIN_MESSAGES = 50;
|
|
40976
41051
|
var DEFAULT_REPLY_THREAD_PARENT_HISTORY_LIMIT = 10;
|
|
41052
|
+
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.";
|
|
40977
41053
|
function buildInlineTypingDispatcherOptions(typingCallbacks) {
|
|
40978
41054
|
if (!typingCallbacks) {
|
|
40979
41055
|
return {};
|
|
@@ -40985,6 +41061,40 @@ function buildInlineTypingDispatcherOptions(typingCallbacks) {
|
|
|
40985
41061
|
...typingCallbacks.onCleanup ? { onCleanup: typingCallbacks.onCleanup } : {}
|
|
40986
41062
|
};
|
|
40987
41063
|
}
|
|
41064
|
+
function uniqueInlineChatIds(chatIds) {
|
|
41065
|
+
const seen = new Set;
|
|
41066
|
+
const out = [];
|
|
41067
|
+
for (const chatId of chatIds) {
|
|
41068
|
+
if (chatId == null)
|
|
41069
|
+
continue;
|
|
41070
|
+
const key = String(chatId);
|
|
41071
|
+
if (seen.has(key))
|
|
41072
|
+
continue;
|
|
41073
|
+
seen.add(key);
|
|
41074
|
+
out.push(chatId);
|
|
41075
|
+
}
|
|
41076
|
+
return out;
|
|
41077
|
+
}
|
|
41078
|
+
async function sendInlineTypingToChats(params) {
|
|
41079
|
+
if (params.chatIds.length === 0)
|
|
41080
|
+
return;
|
|
41081
|
+
const failures = [];
|
|
41082
|
+
await Promise.all(params.chatIds.map(async (chatId) => {
|
|
41083
|
+
try {
|
|
41084
|
+
await params.client.sendTyping({ chatId, typing: params.typing });
|
|
41085
|
+
} catch (error51) {
|
|
41086
|
+
failures.push({ chatId, error: error51 });
|
|
41087
|
+
}
|
|
41088
|
+
}));
|
|
41089
|
+
if (failures.length === 0)
|
|
41090
|
+
return;
|
|
41091
|
+
if (failures.length === params.chatIds.length) {
|
|
41092
|
+
throw failures[0]?.error ?? new Error("inline typing failed");
|
|
41093
|
+
}
|
|
41094
|
+
for (const failure of failures) {
|
|
41095
|
+
params.onPartialError?.(failure.chatId, failure.error);
|
|
41096
|
+
}
|
|
41097
|
+
}
|
|
40988
41098
|
function buildInlineReplyThreadSessionKey(parentSessionKey, threadChatId) {
|
|
40989
41099
|
const suffix = `:thread:${String(threadChatId)}`;
|
|
40990
41100
|
return parentSessionKey.endsWith(suffix) ? parentSessionKey : `${parentSessionKey}${suffix}`;
|
|
@@ -41757,7 +41867,11 @@ function resolveInlineSystemPrompt(params) {
|
|
|
41757
41867
|
groups: params.account.config.groups,
|
|
41758
41868
|
groupId: params.groupId
|
|
41759
41869
|
}) : undefined;
|
|
41760
|
-
return [
|
|
41870
|
+
return [
|
|
41871
|
+
buildInlineSystemPrompt(params.account.config.systemPrompt),
|
|
41872
|
+
groupPrompt,
|
|
41873
|
+
params.replyThread ? INLINE_REPLY_THREAD_SYSTEM_PROMPT : undefined
|
|
41874
|
+
].filter((entry) => Boolean(entry)).join(`
|
|
41761
41875
|
|
|
41762
41876
|
`);
|
|
41763
41877
|
}
|
|
@@ -42196,13 +42310,6 @@ function buildInlineInboundBodyText(content) {
|
|
|
42196
42310
|
`).trim();
|
|
42197
42311
|
return textWithPlaceholder || content.text;
|
|
42198
42312
|
}
|
|
42199
|
-
function hasDownloadableInlineMedia(content) {
|
|
42200
|
-
if (!content)
|
|
42201
|
-
return false;
|
|
42202
|
-
if (content.media?.url)
|
|
42203
|
-
return true;
|
|
42204
|
-
return content.attachments.some((attachment) => attachment.kind === "urlPreview" && Boolean(attachment.previewImageUrl));
|
|
42205
|
-
}
|
|
42206
42313
|
function resolveFilePathHint(params) {
|
|
42207
42314
|
const preferred = params.preferredName?.trim();
|
|
42208
42315
|
if (preferred)
|
|
@@ -42240,8 +42347,9 @@ async function resolveInlineInboundMedia(params) {
|
|
|
42240
42347
|
maxBytes: params.maxBytes,
|
|
42241
42348
|
...filePathHint ? { filePathHint } : {}
|
|
42242
42349
|
});
|
|
42243
|
-
const
|
|
42244
|
-
const
|
|
42350
|
+
const fetchedContentType = fetched.contentType ?? candidate.mimeType ?? undefined;
|
|
42351
|
+
const saved = await params.core.channel.media.saveMediaBuffer(fetched.buffer, fetchedContentType, "inbound", params.maxBytes, fetched.fileName ?? candidate.fileName ?? undefined);
|
|
42352
|
+
const contentType = saved.contentType ?? fetchedContentType;
|
|
42245
42353
|
out.push({
|
|
42246
42354
|
path: saved.path,
|
|
42247
42355
|
...contentType ? { contentType } : {}
|
|
@@ -42803,6 +42911,7 @@ async function monitorInlineProvider(params) {
|
|
|
42803
42911
|
statusSink?.({ lastError: `getChat failed: ${String(err)}` });
|
|
42804
42912
|
}
|
|
42805
42913
|
const isGroup = chatInfo.kind !== "direct";
|
|
42914
|
+
const inlineThreadDefaults = cfg.channels?.inline ?? {};
|
|
42806
42915
|
const replyThreadsEnabled = isInlineReplyThreadsEnabled({ cfg, accountId: account.accountId });
|
|
42807
42916
|
const replyThreadContext = await resolveInlineInboundReplyThreadContext({
|
|
42808
42917
|
replyThreadsEnabled,
|
|
@@ -42820,25 +42929,25 @@ async function monitorInlineProvider(params) {
|
|
|
42820
42929
|
cfg,
|
|
42821
42930
|
accountId: account.accountId,
|
|
42822
42931
|
groupId: String(effectiveChatId),
|
|
42823
|
-
defaultMode: normalizeInlineReplyThreadMode(account.config.replyThreadMode)
|
|
42932
|
+
defaultMode: normalizeInlineReplyThreadMode(account.config.replyThreadMode ?? inlineThreadDefaults.replyThreadMode)
|
|
42824
42933
|
}) : "auto";
|
|
42825
42934
|
const replyThreadAutoCreateMinMessages = isGroup && replyThreadsEnabled ? resolveInlineGroupReplyThreadAutoCreateMinMessages({
|
|
42826
42935
|
cfg,
|
|
42827
42936
|
accountId: account.accountId,
|
|
42828
42937
|
groupId: String(effectiveChatId),
|
|
42829
|
-
defaultMinMessages: account.config.replyThreadAutoCreateMinMessages ?? DEFAULT_REPLY_THREAD_AUTO_CREATE_MIN_MESSAGES
|
|
42938
|
+
defaultMinMessages: account.config.replyThreadAutoCreateMinMessages ?? inlineThreadDefaults.replyThreadAutoCreateMinMessages ?? DEFAULT_REPLY_THREAD_AUTO_CREATE_MIN_MESSAGES
|
|
42830
42939
|
}) : DEFAULT_REPLY_THREAD_AUTO_CREATE_MIN_MESSAGES;
|
|
42831
42940
|
const replyThreadRequireExplicitMention = isGroup && replyThreadsEnabled ? resolveInlineGroupReplyThreadRequireExplicitMention({
|
|
42832
42941
|
cfg,
|
|
42833
42942
|
accountId: account.accountId,
|
|
42834
42943
|
groupId: String(effectiveChatId),
|
|
42835
|
-
defaultRequireExplicitMention: account.config.replyThreadRequireExplicitMention ?? false
|
|
42944
|
+
defaultRequireExplicitMention: account.config.replyThreadRequireExplicitMention ?? inlineThreadDefaults.replyThreadRequireExplicitMention ?? false
|
|
42836
42945
|
}) : false;
|
|
42837
42946
|
const replyThreadParentHistoryLimit = isGroup && replyThreadsEnabled ? resolveInlineGroupReplyThreadParentHistoryLimit({
|
|
42838
42947
|
cfg,
|
|
42839
42948
|
accountId: account.accountId,
|
|
42840
42949
|
groupId: String(effectiveChatId),
|
|
42841
|
-
defaultLimit: account.config.replyThreadParentHistoryLimit ?? DEFAULT_REPLY_THREAD_PARENT_HISTORY_LIMIT
|
|
42950
|
+
defaultLimit: account.config.replyThreadParentHistoryLimit ?? inlineThreadDefaults.replyThreadParentHistoryLimit ?? DEFAULT_REPLY_THREAD_PARENT_HISTORY_LIMIT
|
|
42842
42951
|
}) : DEFAULT_REPLY_THREAD_PARENT_HISTORY_LIMIT;
|
|
42843
42952
|
const senderId = String(msg.fromId);
|
|
42844
42953
|
await hydrateChatParticipants(chatId);
|
|
@@ -42922,14 +43031,15 @@ async function monitorInlineProvider(params) {
|
|
|
42922
43031
|
replyThreadContext: params2.replyThreadContext ?? null
|
|
42923
43032
|
});
|
|
42924
43033
|
};
|
|
42925
|
-
const
|
|
42926
|
-
const
|
|
42927
|
-
const commandSource = hasControlCommand ? (nativeCallbackCommandBody != null || !callbackActionEvent) && isInlineNativeCommandBody({
|
|
43034
|
+
const hasTextControlCommand = core3.channel.text.hasControlCommand(callbackCommandBody ?? rawBody, cfg, botUsername ? { botUsername } : undefined);
|
|
43035
|
+
const isRegisteredNativeCommand = isInlineNativeCommandBody({
|
|
42928
43036
|
cfg,
|
|
42929
43037
|
account,
|
|
42930
43038
|
commandBody: normalizedCommandBody,
|
|
42931
43039
|
agentId: route.agentId
|
|
42932
|
-
})
|
|
43040
|
+
});
|
|
43041
|
+
const hasControlCommand = hasTextControlCommand || isRegisteredNativeCommand;
|
|
43042
|
+
const commandSource = hasControlCommand ? isRegisteredNativeCommand ? "native" : "text" : undefined;
|
|
42933
43043
|
const allowTextCommands = core3.channel.commands.shouldHandleTextCommands({
|
|
42934
43044
|
cfg,
|
|
42935
43045
|
surface: CHANNEL_ID,
|
|
@@ -43342,7 +43452,15 @@ This model will be used for your next message.`, []);
|
|
|
43342
43452
|
messageId: msg.id,
|
|
43343
43453
|
minMessages: replyThreadAutoCreateMinMessages
|
|
43344
43454
|
}) && !shouldEditCallbackTargetInPlace;
|
|
43455
|
+
let parentThreadCreationTyping = false;
|
|
43456
|
+
const setParentThreadCreationTyping = async (typing) => {
|
|
43457
|
+
if (!shouldCreateDeliveryThread || parentThreadCreationTyping === typing)
|
|
43458
|
+
return;
|
|
43459
|
+
parentThreadCreationTyping = typing;
|
|
43460
|
+
await client.sendTyping({ chatId: effectiveChatId, typing }).catch((error51) => runtime.error?.(`inline parent reply-thread typing failed: ${String(error51)}`));
|
|
43461
|
+
};
|
|
43345
43462
|
if (shouldCreateDeliveryThread) {
|
|
43463
|
+
await setParentThreadCreationTyping(true);
|
|
43346
43464
|
const cachedRoute = await lookupInlineReplyThreadRoute({
|
|
43347
43465
|
accountId: account.accountId,
|
|
43348
43466
|
parentChatId: effectiveChatId,
|
|
@@ -43418,6 +43536,7 @@ This model will be used for your next message.`, []);
|
|
|
43418
43536
|
if (shouldCreateDeliveryThread && !deliveryReplyThreadContext) {
|
|
43419
43537
|
runtime.error?.("inline create reply thread failed; falling back to parent chat delivery");
|
|
43420
43538
|
}
|
|
43539
|
+
await setParentThreadCreationTyping(false);
|
|
43421
43540
|
if (!replyThreadContext && deliveryReplyThreadContext?.anchorMessage != null) {
|
|
43422
43541
|
effectiveHistoryContext = prependInlineReplyThreadAnchor({
|
|
43423
43542
|
historyContext: {
|
|
@@ -43455,6 +43574,10 @@ This model will be used for your next message.`, []);
|
|
|
43455
43574
|
}
|
|
43456
43575
|
}
|
|
43457
43576
|
const deliveryChatId = deliveryReplyThreadContext?.childChatId ?? chatId;
|
|
43577
|
+
const typingChatIds = uniqueInlineChatIds([
|
|
43578
|
+
deliveryChatId,
|
|
43579
|
+
!replyThreadContext && deliveryReplyThreadContext ? deliveryReplyThreadContext.parentChatId : null
|
|
43580
|
+
]);
|
|
43458
43581
|
const deliverySessionKey = deliveryReplyThreadContext && isGroup ? buildInlineReplyThreadSessionKey(route.sessionKey, deliveryReplyThreadContext.childChatId) : route.sessionKey;
|
|
43459
43582
|
const groupHistoryKey = isGroup ? deliveryReplyThreadContext ? deliverySessionKey : route.sessionKey : null;
|
|
43460
43583
|
const inboundMedia = await resolveInlineInboundMedia({
|
|
@@ -43463,13 +43586,6 @@ This model will be used for your next message.`, []);
|
|
|
43463
43586
|
maxBytes: inboundMediaMaxBytes,
|
|
43464
43587
|
...log ? { log } : {}
|
|
43465
43588
|
});
|
|
43466
|
-
const inheritedAnchorMedia = deliveryReplyThreadContext?.anchorMessage != null && currentContent != null && !hasDownloadableInlineMedia(currentContent) ? await resolveInlineInboundMedia({
|
|
43467
|
-
core: core3,
|
|
43468
|
-
message: deliveryReplyThreadContext.anchorMessage,
|
|
43469
|
-
maxBytes: inboundMediaMaxBytes,
|
|
43470
|
-
...log ? { log } : {}
|
|
43471
|
-
}) : [];
|
|
43472
|
-
const mediaForAgent = inboundMedia.length > 0 ? inboundMedia : inheritedAnchorMedia;
|
|
43473
43589
|
const timestamp = messageTimestamp;
|
|
43474
43590
|
const fromLabel = resolveInlineConversationLabel({
|
|
43475
43591
|
isGroup,
|
|
@@ -43506,7 +43622,8 @@ This model will be used for your next message.`, []);
|
|
|
43506
43622
|
const effectiveSurface = CHANNEL_ID;
|
|
43507
43623
|
const systemPrompt = resolveInlineSystemPrompt({
|
|
43508
43624
|
account,
|
|
43509
|
-
...isGroup ? { groupId: String(effectiveChatId) } : {}
|
|
43625
|
+
...isGroup ? { groupId: String(effectiveChatId) } : {},
|
|
43626
|
+
replyThread: Boolean(deliveryReplyThreadContext)
|
|
43510
43627
|
});
|
|
43511
43628
|
const messageSid = buildInlineInboundMessageSid({
|
|
43512
43629
|
msgId: msg.id,
|
|
@@ -43558,7 +43675,7 @@ This model will be used for your next message.`, []);
|
|
|
43558
43675
|
MessageActionDataBase64: callbackDataToBase64(callbackActionEvent.data),
|
|
43559
43676
|
...callbackDataToUtf8(callbackActionEvent.data) ? { MessageActionDataUtf8: callbackDataToUtf8(callbackActionEvent.data) } : {}
|
|
43560
43677
|
} : {},
|
|
43561
|
-
...buildInlineInboundMediaPayload(
|
|
43678
|
+
...buildInlineInboundMediaPayload(inboundMedia),
|
|
43562
43679
|
Timestamp: timestamp || Date.now(),
|
|
43563
43680
|
...isGroup ? { WasMentioned: mentionGate.effectiveWasMentioned } : {},
|
|
43564
43681
|
...isGroup ? {
|
|
@@ -43592,8 +43709,18 @@ This model will be used for your next message.`, []);
|
|
|
43592
43709
|
channel: CHANNEL_ID,
|
|
43593
43710
|
accountId: account.accountId,
|
|
43594
43711
|
typing: {
|
|
43595
|
-
start: () =>
|
|
43596
|
-
|
|
43712
|
+
start: () => sendInlineTypingToChats({
|
|
43713
|
+
client,
|
|
43714
|
+
chatIds: typingChatIds,
|
|
43715
|
+
typing: true,
|
|
43716
|
+
onPartialError: (chatId2, error51) => runtime.error?.(`inline typing start failed for chat ${String(chatId2)}: ${String(error51)}`)
|
|
43717
|
+
}),
|
|
43718
|
+
stop: () => sendInlineTypingToChats({
|
|
43719
|
+
client,
|
|
43720
|
+
chatIds: typingChatIds,
|
|
43721
|
+
typing: false,
|
|
43722
|
+
onPartialError: (chatId2, error51) => runtime.error?.(`inline typing stop failed for chat ${String(chatId2)}: ${String(error51)}`)
|
|
43723
|
+
}),
|
|
43597
43724
|
onStartError: (err) => runtime.error?.(`inline typing start failed: ${String(err)}`),
|
|
43598
43725
|
onStopError: (err) => runtime.error?.(`inline typing stop failed: ${String(err)}`)
|
|
43599
43726
|
}
|
|
@@ -44136,6 +44263,7 @@ Attachment: ${mediaUrl}` : `Attachment: ${mediaUrl}`;
|
|
|
44136
44263
|
statusSink?.({ lastOutboundAt: Date.now() });
|
|
44137
44264
|
}
|
|
44138
44265
|
} finally {
|
|
44266
|
+
await setParentThreadCreationTyping(false);
|
|
44139
44267
|
if (callbackActionEvent && !callbackActionAnswered) {
|
|
44140
44268
|
try {
|
|
44141
44269
|
await answerCallbackIfNeeded();
|
|
@@ -46644,7 +46772,7 @@ var inlineChannelPlugin = {
|
|
|
46644
46772
|
"- 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.",
|
|
46645
46773
|
"- 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.",
|
|
46646
46774
|
"- Inline reply threads: when already inside a reply-thread chat, continue in that reply thread and do not create nested reply threads.",
|
|
46647
|
-
"- Inline reply-thread turns include nearby parent-chat context
|
|
46775
|
+
"- Inline reply-thread turns include nearby parent-chat context as background only; answer the current reply-thread conversation, not unrelated parent-chat or other-thread questions."
|
|
46648
46776
|
]
|
|
46649
46777
|
},
|
|
46650
46778
|
messaging: {
|
|
@@ -47007,5 +47135,5 @@ export {
|
|
|
47007
47135
|
inlineChannelPlugin
|
|
47008
47136
|
};
|
|
47009
47137
|
|
|
47010
|
-
//# debugId=
|
|
47138
|
+
//# debugId=C3CE4C015D5193F764756E2164756E21
|
|
47011
47139
|
//# sourceMappingURL=channel-plugin-api.js.map
|