@inline-openclaw/inline 0.0.42 → 0.0.43
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/dist/approval-handler.runtime.js +2 -1
- package/dist/approval-handler.runtime.js.map +3 -3
- package/dist/channel-plugin-api.js +72 -11
- package/dist/channel-plugin-api.js.map +4 -4
- 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 +98 -6
- package/dist/runtime-register-api.js.map +4 -4
- package/package.json +1 -1
|
@@ -37728,6 +37728,7 @@ var INLINE_FORMATTING_RULES = [
|
|
|
37728
37728
|
"Prefer bullet lists over markdown tables.",
|
|
37729
37729
|
"If a table is necessary, render it inside a fenced code block.",
|
|
37730
37730
|
"Use plain URLs or markdown links; do not wrap bare URLs in inline code or backticks.",
|
|
37731
|
+
"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
37732
|
"Use inline code only for actual code, commands, file paths, env vars, or identifiers."
|
|
37732
37733
|
];
|
|
37733
37734
|
var INLINE_COPY_REPLACEMENTS = [
|
|
@@ -40985,6 +40986,40 @@ function buildInlineTypingDispatcherOptions(typingCallbacks) {
|
|
|
40985
40986
|
...typingCallbacks.onCleanup ? { onCleanup: typingCallbacks.onCleanup } : {}
|
|
40986
40987
|
};
|
|
40987
40988
|
}
|
|
40989
|
+
function uniqueInlineChatIds(chatIds) {
|
|
40990
|
+
const seen = new Set;
|
|
40991
|
+
const out = [];
|
|
40992
|
+
for (const chatId of chatIds) {
|
|
40993
|
+
if (chatId == null)
|
|
40994
|
+
continue;
|
|
40995
|
+
const key = String(chatId);
|
|
40996
|
+
if (seen.has(key))
|
|
40997
|
+
continue;
|
|
40998
|
+
seen.add(key);
|
|
40999
|
+
out.push(chatId);
|
|
41000
|
+
}
|
|
41001
|
+
return out;
|
|
41002
|
+
}
|
|
41003
|
+
async function sendInlineTypingToChats(params) {
|
|
41004
|
+
if (params.chatIds.length === 0)
|
|
41005
|
+
return;
|
|
41006
|
+
const failures = [];
|
|
41007
|
+
await Promise.all(params.chatIds.map(async (chatId) => {
|
|
41008
|
+
try {
|
|
41009
|
+
await params.client.sendTyping({ chatId, typing: params.typing });
|
|
41010
|
+
} catch (error51) {
|
|
41011
|
+
failures.push({ chatId, error: error51 });
|
|
41012
|
+
}
|
|
41013
|
+
}));
|
|
41014
|
+
if (failures.length === 0)
|
|
41015
|
+
return;
|
|
41016
|
+
if (failures.length === params.chatIds.length) {
|
|
41017
|
+
throw failures[0]?.error ?? new Error("inline typing failed");
|
|
41018
|
+
}
|
|
41019
|
+
for (const failure of failures) {
|
|
41020
|
+
params.onPartialError?.(failure.chatId, failure.error);
|
|
41021
|
+
}
|
|
41022
|
+
}
|
|
40988
41023
|
function buildInlineReplyThreadSessionKey(parentSessionKey, threadChatId) {
|
|
40989
41024
|
const suffix = `:thread:${String(threadChatId)}`;
|
|
40990
41025
|
return parentSessionKey.endsWith(suffix) ? parentSessionKey : `${parentSessionKey}${suffix}`;
|
|
@@ -42803,6 +42838,7 @@ async function monitorInlineProvider(params) {
|
|
|
42803
42838
|
statusSink?.({ lastError: `getChat failed: ${String(err)}` });
|
|
42804
42839
|
}
|
|
42805
42840
|
const isGroup = chatInfo.kind !== "direct";
|
|
42841
|
+
const inlineThreadDefaults = cfg.channels?.inline ?? {};
|
|
42806
42842
|
const replyThreadsEnabled = isInlineReplyThreadsEnabled({ cfg, accountId: account.accountId });
|
|
42807
42843
|
const replyThreadContext = await resolveInlineInboundReplyThreadContext({
|
|
42808
42844
|
replyThreadsEnabled,
|
|
@@ -42820,25 +42856,25 @@ async function monitorInlineProvider(params) {
|
|
|
42820
42856
|
cfg,
|
|
42821
42857
|
accountId: account.accountId,
|
|
42822
42858
|
groupId: String(effectiveChatId),
|
|
42823
|
-
defaultMode: normalizeInlineReplyThreadMode(account.config.replyThreadMode)
|
|
42859
|
+
defaultMode: normalizeInlineReplyThreadMode(account.config.replyThreadMode ?? inlineThreadDefaults.replyThreadMode)
|
|
42824
42860
|
}) : "auto";
|
|
42825
42861
|
const replyThreadAutoCreateMinMessages = isGroup && replyThreadsEnabled ? resolveInlineGroupReplyThreadAutoCreateMinMessages({
|
|
42826
42862
|
cfg,
|
|
42827
42863
|
accountId: account.accountId,
|
|
42828
42864
|
groupId: String(effectiveChatId),
|
|
42829
|
-
defaultMinMessages: account.config.replyThreadAutoCreateMinMessages ?? DEFAULT_REPLY_THREAD_AUTO_CREATE_MIN_MESSAGES
|
|
42865
|
+
defaultMinMessages: account.config.replyThreadAutoCreateMinMessages ?? inlineThreadDefaults.replyThreadAutoCreateMinMessages ?? DEFAULT_REPLY_THREAD_AUTO_CREATE_MIN_MESSAGES
|
|
42830
42866
|
}) : DEFAULT_REPLY_THREAD_AUTO_CREATE_MIN_MESSAGES;
|
|
42831
42867
|
const replyThreadRequireExplicitMention = isGroup && replyThreadsEnabled ? resolveInlineGroupReplyThreadRequireExplicitMention({
|
|
42832
42868
|
cfg,
|
|
42833
42869
|
accountId: account.accountId,
|
|
42834
42870
|
groupId: String(effectiveChatId),
|
|
42835
|
-
defaultRequireExplicitMention: account.config.replyThreadRequireExplicitMention ?? false
|
|
42871
|
+
defaultRequireExplicitMention: account.config.replyThreadRequireExplicitMention ?? inlineThreadDefaults.replyThreadRequireExplicitMention ?? false
|
|
42836
42872
|
}) : false;
|
|
42837
42873
|
const replyThreadParentHistoryLimit = isGroup && replyThreadsEnabled ? resolveInlineGroupReplyThreadParentHistoryLimit({
|
|
42838
42874
|
cfg,
|
|
42839
42875
|
accountId: account.accountId,
|
|
42840
42876
|
groupId: String(effectiveChatId),
|
|
42841
|
-
defaultLimit: account.config.replyThreadParentHistoryLimit ?? DEFAULT_REPLY_THREAD_PARENT_HISTORY_LIMIT
|
|
42877
|
+
defaultLimit: account.config.replyThreadParentHistoryLimit ?? inlineThreadDefaults.replyThreadParentHistoryLimit ?? DEFAULT_REPLY_THREAD_PARENT_HISTORY_LIMIT
|
|
42842
42878
|
}) : DEFAULT_REPLY_THREAD_PARENT_HISTORY_LIMIT;
|
|
42843
42879
|
const senderId = String(msg.fromId);
|
|
42844
42880
|
await hydrateChatParticipants(chatId);
|
|
@@ -42922,14 +42958,15 @@ async function monitorInlineProvider(params) {
|
|
|
42922
42958
|
replyThreadContext: params2.replyThreadContext ?? null
|
|
42923
42959
|
});
|
|
42924
42960
|
};
|
|
42925
|
-
const
|
|
42926
|
-
const
|
|
42927
|
-
const commandSource = hasControlCommand ? (nativeCallbackCommandBody != null || !callbackActionEvent) && isInlineNativeCommandBody({
|
|
42961
|
+
const hasTextControlCommand = core3.channel.text.hasControlCommand(callbackCommandBody ?? rawBody, cfg, botUsername ? { botUsername } : undefined);
|
|
42962
|
+
const isRegisteredNativeCommand = isInlineNativeCommandBody({
|
|
42928
42963
|
cfg,
|
|
42929
42964
|
account,
|
|
42930
42965
|
commandBody: normalizedCommandBody,
|
|
42931
42966
|
agentId: route.agentId
|
|
42932
|
-
})
|
|
42967
|
+
});
|
|
42968
|
+
const hasControlCommand = hasTextControlCommand || isRegisteredNativeCommand;
|
|
42969
|
+
const commandSource = hasControlCommand ? isRegisteredNativeCommand ? "native" : "text" : undefined;
|
|
42933
42970
|
const allowTextCommands = core3.channel.commands.shouldHandleTextCommands({
|
|
42934
42971
|
cfg,
|
|
42935
42972
|
surface: CHANNEL_ID,
|
|
@@ -43342,7 +43379,15 @@ This model will be used for your next message.`, []);
|
|
|
43342
43379
|
messageId: msg.id,
|
|
43343
43380
|
minMessages: replyThreadAutoCreateMinMessages
|
|
43344
43381
|
}) && !shouldEditCallbackTargetInPlace;
|
|
43382
|
+
let parentThreadCreationTyping = false;
|
|
43383
|
+
const setParentThreadCreationTyping = async (typing) => {
|
|
43384
|
+
if (!shouldCreateDeliveryThread || parentThreadCreationTyping === typing)
|
|
43385
|
+
return;
|
|
43386
|
+
parentThreadCreationTyping = typing;
|
|
43387
|
+
await client.sendTyping({ chatId: effectiveChatId, typing }).catch((error51) => runtime.error?.(`inline parent reply-thread typing failed: ${String(error51)}`));
|
|
43388
|
+
};
|
|
43345
43389
|
if (shouldCreateDeliveryThread) {
|
|
43390
|
+
await setParentThreadCreationTyping(true);
|
|
43346
43391
|
const cachedRoute = await lookupInlineReplyThreadRoute({
|
|
43347
43392
|
accountId: account.accountId,
|
|
43348
43393
|
parentChatId: effectiveChatId,
|
|
@@ -43418,6 +43463,7 @@ This model will be used for your next message.`, []);
|
|
|
43418
43463
|
if (shouldCreateDeliveryThread && !deliveryReplyThreadContext) {
|
|
43419
43464
|
runtime.error?.("inline create reply thread failed; falling back to parent chat delivery");
|
|
43420
43465
|
}
|
|
43466
|
+
await setParentThreadCreationTyping(false);
|
|
43421
43467
|
if (!replyThreadContext && deliveryReplyThreadContext?.anchorMessage != null) {
|
|
43422
43468
|
effectiveHistoryContext = prependInlineReplyThreadAnchor({
|
|
43423
43469
|
historyContext: {
|
|
@@ -43455,6 +43501,10 @@ This model will be used for your next message.`, []);
|
|
|
43455
43501
|
}
|
|
43456
43502
|
}
|
|
43457
43503
|
const deliveryChatId = deliveryReplyThreadContext?.childChatId ?? chatId;
|
|
43504
|
+
const typingChatIds = uniqueInlineChatIds([
|
|
43505
|
+
deliveryChatId,
|
|
43506
|
+
!replyThreadContext && deliveryReplyThreadContext ? deliveryReplyThreadContext.parentChatId : null
|
|
43507
|
+
]);
|
|
43458
43508
|
const deliverySessionKey = deliveryReplyThreadContext && isGroup ? buildInlineReplyThreadSessionKey(route.sessionKey, deliveryReplyThreadContext.childChatId) : route.sessionKey;
|
|
43459
43509
|
const groupHistoryKey = isGroup ? deliveryReplyThreadContext ? deliverySessionKey : route.sessionKey : null;
|
|
43460
43510
|
const inboundMedia = await resolveInlineInboundMedia({
|
|
@@ -43592,8 +43642,18 @@ This model will be used for your next message.`, []);
|
|
|
43592
43642
|
channel: CHANNEL_ID,
|
|
43593
43643
|
accountId: account.accountId,
|
|
43594
43644
|
typing: {
|
|
43595
|
-
start: () =>
|
|
43596
|
-
|
|
43645
|
+
start: () => sendInlineTypingToChats({
|
|
43646
|
+
client,
|
|
43647
|
+
chatIds: typingChatIds,
|
|
43648
|
+
typing: true,
|
|
43649
|
+
onPartialError: (chatId2, error51) => runtime.error?.(`inline typing start failed for chat ${String(chatId2)}: ${String(error51)}`)
|
|
43650
|
+
}),
|
|
43651
|
+
stop: () => sendInlineTypingToChats({
|
|
43652
|
+
client,
|
|
43653
|
+
chatIds: typingChatIds,
|
|
43654
|
+
typing: false,
|
|
43655
|
+
onPartialError: (chatId2, error51) => runtime.error?.(`inline typing stop failed for chat ${String(chatId2)}: ${String(error51)}`)
|
|
43656
|
+
}),
|
|
43597
43657
|
onStartError: (err) => runtime.error?.(`inline typing start failed: ${String(err)}`),
|
|
43598
43658
|
onStopError: (err) => runtime.error?.(`inline typing stop failed: ${String(err)}`)
|
|
43599
43659
|
}
|
|
@@ -44136,6 +44196,7 @@ Attachment: ${mediaUrl}` : `Attachment: ${mediaUrl}`;
|
|
|
44136
44196
|
statusSink?.({ lastOutboundAt: Date.now() });
|
|
44137
44197
|
}
|
|
44138
44198
|
} finally {
|
|
44199
|
+
await setParentThreadCreationTyping(false);
|
|
44139
44200
|
if (callbackActionEvent && !callbackActionAnswered) {
|
|
44140
44201
|
try {
|
|
44141
44202
|
await answerCallbackIfNeeded();
|
|
@@ -47007,5 +47068,5 @@ export {
|
|
|
47007
47068
|
inlineChannelPlugin
|
|
47008
47069
|
};
|
|
47009
47070
|
|
|
47010
|
-
//# debugId=
|
|
47071
|
+
//# debugId=FEB3F6CD06C6A7CC64756E2164756E21
|
|
47011
47072
|
//# sourceMappingURL=channel-plugin-api.js.map
|