@llblab/pi-kit 0.6.0 → 0.7.1
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/CHANGELOG.md +8 -0
- package/README.md +4 -4
- package/node_modules/@llblab/pi-actors/AGENTS.md +1 -1
- package/node_modules/@llblab/pi-actors/CHANGELOG.md +6 -0
- package/node_modules/@llblab/pi-actors/README.md +1 -1
- package/node_modules/@llblab/pi-actors/dist/lib/async-runs.d.ts +3 -0
- package/node_modules/@llblab/pi-actors/dist/lib/async-runs.js +14 -1
- package/node_modules/@llblab/pi-actors/dist/lib/command-templates.js +45 -3
- package/node_modules/@llblab/pi-actors/dist/lib/extension-runtime.js +1 -1
- package/node_modules/@llblab/pi-actors/dist/lib/observability.d.ts +16 -3
- package/node_modules/@llblab/pi-actors/dist/lib/observability.js +92 -7
- package/node_modules/@llblab/pi-actors/dist/lib/pi.d.ts +0 -1
- package/node_modules/@llblab/pi-actors/dist/lib/pi.js +15 -24
- package/node_modules/@llblab/pi-actors/dist/lib/run-delivery-lineage.d.ts +17 -0
- package/node_modules/@llblab/pi-actors/dist/lib/run-delivery-lineage.js +44 -0
- package/node_modules/@llblab/pi-actors/dist/lib/run-delivery.d.ts +4 -0
- package/node_modules/@llblab/pi-actors/dist/lib/run-delivery.js +102 -4
- package/node_modules/@llblab/pi-actors/dist/lib/run-ui-runtime.js +58 -39
- package/node_modules/@llblab/pi-actors/dist/lib/runtime.js +14 -6
- package/node_modules/@llblab/pi-actors/dist/skills/actors/SKILL.md +1 -1
- package/node_modules/@llblab/pi-actors/docs/async-runs.md +1 -1
- package/node_modules/@llblab/pi-actors/docs/coordinator-delivery.md +18 -23
- package/node_modules/@llblab/pi-actors/lib/async-runs.ts +18 -1
- package/node_modules/@llblab/pi-actors/lib/command-templates.ts +41 -3
- package/node_modules/@llblab/pi-actors/lib/extension-runtime.ts +1 -1
- package/node_modules/@llblab/pi-actors/lib/observability.ts +119 -5
- package/node_modules/@llblab/pi-actors/lib/pi.ts +15 -28
- package/node_modules/@llblab/pi-actors/lib/run-delivery-lineage.ts +68 -0
- package/node_modules/@llblab/pi-actors/lib/run-delivery.ts +120 -4
- package/node_modules/@llblab/pi-actors/lib/run-ui-runtime.ts +69 -44
- package/node_modules/@llblab/pi-actors/lib/runtime.ts +17 -6
- package/node_modules/@llblab/pi-actors/package.json +1 -1
- package/node_modules/@llblab/pi-actors/skills/actors/SKILL.md +1 -1
- package/node_modules/@llblab/pi-state-flow/AGENTS.md +33 -12
- package/node_modules/@llblab/pi-state-flow/BACKLOG.md +125 -2
- package/node_modules/@llblab/pi-state-flow/CHANGELOG.md +87 -45
- package/node_modules/@llblab/pi-state-flow/README.md +203 -107
- package/node_modules/@llblab/pi-state-flow/docs/README.md +4 -0
- package/node_modules/@llblab/pi-state-flow/docs/architecture.md +188 -0
- package/node_modules/@llblab/pi-state-flow/docs/temporal-acceptance.md +42 -0
- package/node_modules/@llblab/pi-state-flow/index.ts +164 -2
- package/node_modules/@llblab/pi-state-flow/lib/acquisition.ts +138 -0
- package/node_modules/@llblab/pi-state-flow/lib/artifact.ts +273 -0
- package/node_modules/@llblab/pi-state-flow/lib/config.ts +48 -0
- package/node_modules/@llblab/pi-state-flow/lib/context.ts +18 -5
- package/node_modules/@llblab/pi-state-flow/lib/continuation.ts +268 -0
- package/node_modules/@llblab/pi-state-flow/lib/discovery.ts +117 -0
- package/node_modules/@llblab/pi-state-flow/lib/durable.ts +562 -0
- package/node_modules/@llblab/pi-state-flow/lib/episode.ts +24 -12
- package/node_modules/@llblab/pi-state-flow/lib/extension.ts +606 -70
- package/node_modules/@llblab/pi-state-flow/lib/git.ts +666 -0
- package/node_modules/@llblab/pi-state-flow/lib/history.ts +95 -0
- package/node_modules/@llblab/pi-state-flow/lib/json.ts +24 -0
- package/node_modules/@llblab/pi-state-flow/lib/maintenance.ts +141 -0
- package/node_modules/@llblab/pi-state-flow/lib/memory.ts +52 -0
- package/node_modules/@llblab/pi-state-flow/lib/migration.ts +88 -0
- package/node_modules/@llblab/pi-state-flow/lib/publication.ts +296 -0
- package/node_modules/@llblab/pi-state-flow/lib/recovery.ts +23 -7
- package/node_modules/@llblab/pi-state-flow/lib/rehydration.ts +79 -0
- package/node_modules/@llblab/pi-state-flow/lib/runtime.ts +264 -0
- package/node_modules/@llblab/pi-state-flow/lib/session.ts +6 -0
- package/node_modules/@llblab/pi-state-flow/lib/skills.ts +99 -7
- package/node_modules/@llblab/pi-state-flow/lib/snapshot.ts +305 -48
- package/node_modules/@llblab/pi-state-flow/lib/state.ts +74 -7
- package/node_modules/@llblab/pi-state-flow/lib/status.ts +125 -6
- package/node_modules/@llblab/pi-state-flow/lib/storage.ts +196 -0
- package/node_modules/@llblab/pi-state-flow/lib/temporal.ts +233 -0
- package/node_modules/@llblab/pi-state-flow/lib/terminal.ts +70 -24
- package/node_modules/@llblab/pi-state-flow/lib/transition.ts +254 -29
- package/node_modules/@llblab/pi-state-flow/package.json +8 -2
- package/node_modules/@llblab/pi-state-flow/skills/state-flow-memory/SKILL.md +128 -0
- package/node_modules/@llblab/pi-telegram/AGENTS.md +14 -9
- package/node_modules/@llblab/pi-telegram/BACKLOG.md +23 -5
- package/node_modules/@llblab/pi-telegram/CHANGELOG.md +18 -0
- package/node_modules/@llblab/pi-telegram/README.md +13 -9
- package/node_modules/@llblab/pi-telegram/docs/README.md +1 -0
- package/node_modules/@llblab/pi-telegram/docs/architecture.md +227 -23
- package/node_modules/@llblab/pi-telegram/docs/generative-apps.md +1 -1
- package/node_modules/@llblab/pi-telegram/docs/multi-instance-bus.md +70 -19
- package/node_modules/@llblab/pi-telegram/docs/outbound.md +6 -6
- package/node_modules/@llblab/pi-telegram/docs/public-api.md +13 -6
- package/node_modules/@llblab/pi-telegram/docs/ui-style.md +3 -1
- package/node_modules/@llblab/pi-telegram/index.ts +4 -1418
- package/node_modules/@llblab/pi-telegram/lib/agent-messages.ts +6 -3
- package/node_modules/@llblab/pi-telegram/lib/bindings.ts +46 -1
- package/node_modules/@llblab/pi-telegram/lib/bus-api.ts +32 -19
- package/node_modules/@llblab/pi-telegram/lib/bus-follower.ts +600 -135
- package/node_modules/@llblab/pi-telegram/lib/bus-leader.ts +962 -55
- package/node_modules/@llblab/pi-telegram/lib/bus.ts +355 -26
- package/node_modules/@llblab/pi-telegram/lib/channel-posts.ts +718 -0
- package/node_modules/@llblab/pi-telegram/lib/commands.ts +237 -11
- package/node_modules/@llblab/pi-telegram/lib/config.ts +242 -26
- package/node_modules/@llblab/pi-telegram/lib/extension.ts +1851 -0
- package/node_modules/@llblab/pi-telegram/lib/generative-apps.ts +20 -2
- package/node_modules/@llblab/pi-telegram/lib/journal.ts +2184 -126
- package/node_modules/@llblab/pi-telegram/lib/locks.ts +44 -2
- package/node_modules/@llblab/pi-telegram/lib/menu-settings.ts +152 -13
- package/node_modules/@llblab/pi-telegram/lib/outbound-attachments.ts +97 -10
- package/node_modules/@llblab/pi-telegram/lib/paths.ts +29 -0
- package/node_modules/@llblab/pi-telegram/lib/polling.ts +85 -17
- package/node_modules/@llblab/pi-telegram/lib/preview.ts +17 -0
- package/node_modules/@llblab/pi-telegram/lib/prompts.ts +6 -2
- package/node_modules/@llblab/pi-telegram/lib/queue.ts +118 -26
- package/node_modules/@llblab/pi-telegram/lib/rendering.ts +4 -1
- package/node_modules/@llblab/pi-telegram/lib/replies.ts +21 -2
- package/node_modules/@llblab/pi-telegram/lib/routing.ts +344 -112
- package/node_modules/@llblab/pi-telegram/lib/setup.ts +44 -4
- package/node_modules/@llblab/pi-telegram/lib/status.ts +51 -4
- package/node_modules/@llblab/pi-telegram/lib/sync.ts +308 -39
- package/node_modules/@llblab/pi-telegram/lib/telegram-api.ts +353 -22
- package/node_modules/@llblab/pi-telegram/lib/thread-cleanup-manager.ts +664 -0
- package/node_modules/@llblab/pi-telegram/lib/thread-display.ts +226 -0
- package/node_modules/@llblab/pi-telegram/lib/thread-naming.ts +118 -0
- package/node_modules/@llblab/pi-telegram/lib/threads.ts +1686 -129
- package/node_modules/@llblab/pi-telegram/lib/turns.ts +7 -0
- package/node_modules/@llblab/pi-telegram/lib/updates.ts +1319 -97
- package/node_modules/@llblab/pi-telegram/lib/workspace-admission.ts +1643 -0
- package/node_modules/@llblab/pi-telegram/lib/workspace-retirement.ts +968 -0
- package/node_modules/@llblab/pi-telegram/lib/workspace-slots.ts +84 -0
- package/node_modules/@llblab/pi-telegram/package.json +1 -1
- package/node_modules/@llblab/pi-telegram/screenshot.png +0 -0
- package/node_modules/@llblab/pi-telegram/scripts/measure-bus.mjs +83 -0
- package/node_modules/@llblab/pi-telegram/scripts/measure-workspace.mjs +101 -0
- package/node_modules/@llblab/{skills → pi-telegram/skills}/show-me/SKILL.md +28 -6
- package/node_modules/@llblab/pi-telegram/skills/show-me/references/telegram-surfaces.md +43 -0
- package/node_modules/@llblab/pi-telegram/skills/telegram-bridge/references/delivery-and-threads.md +1 -1
- package/node_modules/@llblab/skills/package.json +2 -3
- package/package.json +6 -5
- /package/node_modules/@llblab/pi-telegram/lib/{logs.ts → logging.ts} +0 -0
|
@@ -18,6 +18,7 @@ export interface TelegramAgentMessageRuntimeDeps<TContext, TUpdate> {
|
|
|
18
18
|
getAllowedChatId: () => number | undefined;
|
|
19
19
|
getLeaderTarget: () => TelegramTarget | undefined;
|
|
20
20
|
getLeaderThreadName: () => string | undefined;
|
|
21
|
+
getDisplayTitle?: (target: TelegramTarget) => string | undefined;
|
|
21
22
|
followerRegistry: TelegramBusFollowerRegistry;
|
|
22
23
|
getContext: () => TContext | undefined;
|
|
23
24
|
handleUpdate: (update: TUpdate, ctx: TContext) => Promise<void>;
|
|
@@ -39,7 +40,7 @@ export function createTelegramAgentMessageRuntime<TContext, TUpdate>(
|
|
|
39
40
|
if (leaderTarget?.threadId) {
|
|
40
41
|
targets.push({
|
|
41
42
|
target: { chatId: leaderTarget.chatId, threadId: leaderTarget.threadId },
|
|
42
|
-
threadName: deps.getLeaderThreadName(),
|
|
43
|
+
threadName: deps.getDisplayTitle?.(leaderTarget) ?? deps.getLeaderThreadName(),
|
|
43
44
|
});
|
|
44
45
|
}
|
|
45
46
|
for (const follower of deps.followerRegistry.list()) {
|
|
@@ -49,7 +50,7 @@ export function createTelegramAgentMessageRuntime<TContext, TUpdate>(
|
|
|
49
50
|
chatId: follower.target.chatId,
|
|
50
51
|
threadId: follower.target.threadId,
|
|
51
52
|
},
|
|
52
|
-
threadName: follower.threadName,
|
|
53
|
+
threadName: deps.getDisplayTitle?.(follower.target) ?? follower.threadName,
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
56
|
return targets;
|
|
@@ -98,8 +99,10 @@ export function createTelegramAgentMessageRuntime<TContext, TUpdate>(
|
|
|
98
99
|
if (allowedChatId === undefined || !ctx) {
|
|
99
100
|
throw new Error("Telegram agent turn routing is unavailable.");
|
|
100
101
|
}
|
|
102
|
+
const sourceTitle = (input.sourceTarget ? deps.getDisplayTitle?.(input.sourceTarget) : undefined)
|
|
103
|
+
?? input.sourceThreadName;
|
|
101
104
|
const sourceLabel =
|
|
102
|
-
|
|
105
|
+
sourceTitle
|
|
103
106
|
?.replace(/[\r\n\[\]]+/g, " ")
|
|
104
107
|
.trim()
|
|
105
108
|
.slice(0, 64) || "Pi";
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import * as Activity from "./activity.ts";
|
|
8
8
|
import * as ActivityVerbosity from "./activity-verbosity.ts";
|
|
9
|
+
import * as ChannelPosts from "./channel-posts.ts";
|
|
9
10
|
import * as CommandTemplates from "./command-templates.ts";
|
|
10
11
|
import * as Commands from "./commands.ts";
|
|
11
12
|
import * as Config from "./config.ts";
|
|
@@ -498,6 +499,10 @@ interface TelegramCommandsAndToolsBindingDeps {
|
|
|
498
499
|
stopPolling?: () => Promise<void | string>;
|
|
499
500
|
recoverPollingStart?: Commands.TelegramBridgeCommandRegistrationDeps["recoverPollingStart"];
|
|
500
501
|
getDisconnectThreadName?: () => string | undefined;
|
|
502
|
+
setRequestedThreadNameForPollingStart?: (
|
|
503
|
+
threadName: string | undefined,
|
|
504
|
+
) => void;
|
|
505
|
+
validateThreadName?: Commands.TelegramBridgeCommandRegistrationDeps["validateThreadName"];
|
|
501
506
|
onTransportChanged?: () => Promise<void> | void;
|
|
502
507
|
getStatusLines: (
|
|
503
508
|
options?: Status.TelegramBridgeStatusLineOptions,
|
|
@@ -512,6 +517,15 @@ interface TelegramCommandsAndToolsBindingDeps {
|
|
|
512
517
|
target?: { chatId: number; threadId?: number };
|
|
513
518
|
},
|
|
514
519
|
) => Promise<number | undefined>;
|
|
520
|
+
sendChannelMarkdownMessage: NonNullable<
|
|
521
|
+
OutboundAttachments.TelegramOutboundMessageToolRegistrationDeps["sendChannelMarkdownMessage"]
|
|
522
|
+
>;
|
|
523
|
+
sendChannelMediaMessage: NonNullable<
|
|
524
|
+
OutboundAttachments.TelegramOutboundMessageToolRegistrationDeps["sendChannelMediaMessage"]
|
|
525
|
+
>;
|
|
526
|
+
listChannelPosts: ChannelPosts.TelegramChannelPostJournalStore["list"];
|
|
527
|
+
mutateChannelPost(input: { action: "edit" | "delete"; operationId: string;
|
|
528
|
+
mutationId: string; markdown?: string }): Promise<ChannelPosts.TelegramChannelPostRecord>;
|
|
515
529
|
callMultipart: OutboundHandlers.TelegramVoiceReplySenderDeps["sendMultipart"];
|
|
516
530
|
getDefaultChatId: () => number | undefined;
|
|
517
531
|
getDefaultTarget?: () => OutboundAttachments.TelegramQueuedOutboundAttachmentTurnView["target"];
|
|
@@ -533,10 +547,16 @@ export function registerTelegramCommandsAndTools({
|
|
|
533
547
|
stopPolling,
|
|
534
548
|
recoverPollingStart,
|
|
535
549
|
getDisconnectThreadName,
|
|
550
|
+
setRequestedThreadNameForPollingStart,
|
|
551
|
+
validateThreadName,
|
|
536
552
|
onTransportChanged,
|
|
537
553
|
getStatusLines,
|
|
538
554
|
buttonActionStore,
|
|
539
555
|
sendMarkdownReply,
|
|
556
|
+
sendChannelMarkdownMessage,
|
|
557
|
+
sendChannelMediaMessage,
|
|
558
|
+
listChannelPosts,
|
|
559
|
+
mutateChannelPost,
|
|
540
560
|
callMultipart,
|
|
541
561
|
getDefaultChatId,
|
|
542
562
|
getDefaultTarget,
|
|
@@ -556,6 +576,8 @@ export function registerTelegramCommandsAndTools({
|
|
|
556
576
|
sendMarkdownReply,
|
|
557
577
|
recordRuntimeEvent,
|
|
558
578
|
});
|
|
579
|
+
ChannelPosts.registerTelegramChannelPostMutationTool(pi, { mutate: mutateChannelPost });
|
|
580
|
+
ChannelPosts.registerTelegramChannelPostListTool(pi, { list: listChannelPosts });
|
|
559
581
|
OutboundAttachments.registerTelegramOutboundAttachmentTool(pi, {
|
|
560
582
|
getActiveTurn: activeTurnRuntime.get,
|
|
561
583
|
getDefaultChatId,
|
|
@@ -578,6 +600,8 @@ export function registerTelegramCommandsAndTools({
|
|
|
578
600
|
),
|
|
579
601
|
sendMarkdownMessage: (chatId, markdown, options) =>
|
|
580
602
|
sendMarkdownReply(chatId, undefined, markdown, options),
|
|
603
|
+
sendChannelMarkdownMessage,
|
|
604
|
+
sendChannelMediaMessage,
|
|
581
605
|
recordRuntimeEvent,
|
|
582
606
|
});
|
|
583
607
|
const queueAgentConnectionContext = (connected: boolean): void => {
|
|
@@ -636,7 +660,11 @@ export function registerTelegramCommandsAndTools({
|
|
|
636
660
|
);
|
|
637
661
|
}
|
|
638
662
|
await configStore.load();
|
|
639
|
-
configStore.
|
|
663
|
+
const latestProfile = configStore.getStoredConfig().profiles?.[profileName];
|
|
664
|
+
configStore.setProfile(profileName, {
|
|
665
|
+
...profile,
|
|
666
|
+
threadDisplayMode: latestProfile?.threadDisplayMode,
|
|
667
|
+
});
|
|
640
668
|
configStore.activateProfile(profileName);
|
|
641
669
|
await onTransportChanged?.();
|
|
642
670
|
await persistConfig(configStore.get());
|
|
@@ -653,6 +681,10 @@ export function registerTelegramCommandsAndTools({
|
|
|
653
681
|
setConfig: setupConfigStore.set,
|
|
654
682
|
setupGuard: setup,
|
|
655
683
|
getMe: TelegramApi.fetchTelegramBotIdentity,
|
|
684
|
+
resolveBotToken: (value) =>
|
|
685
|
+
Config.resolveTelegramBotToken(value, process.env),
|
|
686
|
+
describeBotToken: (value) =>
|
|
687
|
+
Config.getTelegramBotTokenDiagnostic(value, process.env),
|
|
656
688
|
persistConfig: persistSetupConfig,
|
|
657
689
|
startPolling: lockedPollingRuntime.start,
|
|
658
690
|
updateStatus,
|
|
@@ -669,17 +701,22 @@ export function registerTelegramCommandsAndTools({
|
|
|
669
701
|
getStatusLines,
|
|
670
702
|
reloadConfig: configStore.load,
|
|
671
703
|
hasBotToken: configStore.hasBotToken,
|
|
704
|
+
getBotTokenDiagnostic: configStore.getBotTokenDiagnostic,
|
|
672
705
|
startPolling: async (ctx, options) => {
|
|
706
|
+
setRequestedThreadNameForPollingStart?.(options?.requestedThreadName);
|
|
673
707
|
try {
|
|
674
708
|
return await lockedPollingRuntime.start(ctx, options);
|
|
675
709
|
} catch (error) {
|
|
676
710
|
recordRuntimeEvent("recovery", error, { phase: "polling-start" });
|
|
677
711
|
throw error;
|
|
712
|
+
} finally {
|
|
713
|
+
setRequestedThreadNameForPollingStart?.(undefined);
|
|
678
714
|
}
|
|
679
715
|
},
|
|
680
716
|
stopPolling: stopPolling ?? lockedPollingRuntime.stop,
|
|
681
717
|
recoverPollingStart,
|
|
682
718
|
getDisconnectThreadName,
|
|
719
|
+
validateThreadName,
|
|
683
720
|
queueAgentConnectionContext,
|
|
684
721
|
updateStatus,
|
|
685
722
|
getProfileNames: () =>
|
|
@@ -780,6 +817,12 @@ interface TelegramLifecycleBindingDeps {
|
|
|
780
817
|
Keyboard.TelegramInlineKeyboardMarkup
|
|
781
818
|
>["sendGuestReply"]
|
|
782
819
|
>;
|
|
820
|
+
editGuestReply?: Queue.TelegramAgentEndHookRuntimeDeps<
|
|
821
|
+
Queue.PendingTelegramTurn,
|
|
822
|
+
Pi.ExtensionContext,
|
|
823
|
+
Pi.AgentEndEvent["messages"][number],
|
|
824
|
+
Keyboard.TelegramInlineKeyboardMarkup
|
|
825
|
+
>["editGuestReply"];
|
|
783
826
|
preparePreviewDelivery?: Queue.TelegramAgentEndRuntimeDeps<Queue.PendingTelegramTurn>["preparePreviewDelivery"];
|
|
784
827
|
finalizeMarkdownPreview: Queue.TelegramAgentEndHookRuntimeDeps<
|
|
785
828
|
Queue.PendingTelegramTurn,
|
|
@@ -832,6 +875,7 @@ export function registerTelegramLifecycleRuntimeHooks({
|
|
|
832
875
|
answerGuestQuery,
|
|
833
876
|
deleteMessage,
|
|
834
877
|
sendGuestReply,
|
|
878
|
+
editGuestReply,
|
|
835
879
|
preparePreviewDelivery,
|
|
836
880
|
finalizeMarkdownPreview,
|
|
837
881
|
proactivePushTargetGetter,
|
|
@@ -1045,6 +1089,7 @@ export function registerTelegramLifecycleRuntimeHooks({
|
|
|
1045
1089
|
sendRichAttachmentReply: richAttachmentSender,
|
|
1046
1090
|
answerGuestQuery,
|
|
1047
1091
|
sendGuestReply,
|
|
1092
|
+
editGuestReply,
|
|
1048
1093
|
sendGuestAttachment,
|
|
1049
1094
|
sendGuestVoiceReply,
|
|
1050
1095
|
planOutboundReply: outboundReplyPlanner,
|
|
@@ -8,11 +8,15 @@ import {
|
|
|
8
8
|
markTelegramBusCrossTargetDelivery,
|
|
9
9
|
stripTelegramBusApiMetadata,
|
|
10
10
|
} from "./bus.ts";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
buildTelegramAnswerGuestQueryBody,
|
|
13
|
+
isTelegramMessageNotModifiedError,
|
|
14
|
+
} from "./telegram-api.ts";
|
|
12
15
|
import type {
|
|
13
16
|
TelegramAnswerGuestQueryOptions,
|
|
14
17
|
TelegramApiCallOptions,
|
|
15
18
|
TelegramBridgeApiRuntime,
|
|
19
|
+
TelegramEditGuestInlineMessageContent,
|
|
16
20
|
TelegramEditMessageTextBody,
|
|
17
21
|
TelegramSendMessageBody,
|
|
18
22
|
TelegramSendMessageDraftBody,
|
|
@@ -342,24 +346,33 @@ export function createTelegramBusAwareApiRuntime(
|
|
|
342
346
|
await deps.directRuntime.answerGuestQuery(guestQueryId, text, options);
|
|
343
347
|
return;
|
|
344
348
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
349
|
+
await deps.callFollowerApi("call", [
|
|
350
|
+
"answerGuestQuery",
|
|
351
|
+
buildTelegramAnswerGuestQueryBody(guestQueryId, text, options),
|
|
352
|
+
]);
|
|
353
|
+
},
|
|
354
|
+
answerGuestQueryForInlineMessage(
|
|
355
|
+
guestQueryId: string,
|
|
356
|
+
text?: string,
|
|
357
|
+
options?: TelegramAnswerGuestQueryOptions,
|
|
358
|
+
): Promise<string | undefined> {
|
|
359
|
+
// Guest answers can only be edited while this instance owns direct
|
|
360
|
+
// transport; follower forwarding cannot preserve the inline message id.
|
|
361
|
+
return deps.ownsDirect()
|
|
362
|
+
? deps.directRuntime.answerGuestQueryForInlineMessage(
|
|
363
|
+
guestQueryId,
|
|
364
|
+
text,
|
|
365
|
+
options,
|
|
366
|
+
)
|
|
367
|
+
: rejectTelegramDirectOwnership("answerGuestQueryForInlineMessage");
|
|
368
|
+
},
|
|
369
|
+
editGuestInlineMessage(
|
|
370
|
+
inlineMessageId: string,
|
|
371
|
+
content: TelegramEditGuestInlineMessageContent,
|
|
372
|
+
): Promise<void> {
|
|
373
|
+
return deps.ownsDirect()
|
|
374
|
+
? deps.directRuntime.editGuestInlineMessage(inlineMessageId, content)
|
|
375
|
+
: rejectTelegramDirectOwnership("editGuestInlineMessage");
|
|
363
376
|
},
|
|
364
377
|
async deleteMessage(chatId: number, messageId: number): Promise<void> {
|
|
365
378
|
if (deps.ownsDirect())
|