stitchkit 0.124.2 → 0.124.3
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 +25 -0
- package/dist/entrypoints/cli.js +1 -1
- package/dist/entrypoints/telegram/screens.d.ts +1 -1
- package/dist/entrypoints/telegram/screens.d.ts.map +1 -1
- package/dist/entrypoints/telegram/screens.js +196 -83
- package/dist/entrypoints/tools/toolkit.js +1 -1
- package/dist/{index-hzk4ydpy.js → index-7rq5p3hk.js} +28 -0
- package/dist/telegram/screens/dispatch.d.ts.map +1 -1
- package/dist/telegram/screens/display.d.ts +2 -1
- package/dist/telegram/screens/display.d.ts.map +1 -1
- package/dist/telegram/screens/execute.d.ts +12 -4
- package/dist/telegram/screens/execute.d.ts.map +1 -1
- package/dist/telegram/screens/render.d.ts +5 -1
- package/dist/telegram/screens/render.d.ts.map +1 -1
- package/dist/telegram/screens/runtime.d.ts +5 -1
- package/dist/telegram/screens/runtime.d.ts.map +1 -1
- package/dist/telegram/screens/state.d.ts +3 -0
- package/dist/telegram/screens/state.d.ts.map +1 -1
- package/dist/telegram/screens/test-chat-telegram.d.ts.map +1 -1
- package/dist/telegram/screens/view.d.ts +14 -5
- package/dist/telegram/screens/view.d.ts.map +1 -1
- package/dist/tools/cli/help.d.ts.map +1 -1
- package/llms/cli.txt +8 -0
- package/llms/telegram-screens.txt +59 -4
- package/llms-full.txt +67 -4
- package/llms.txt +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,31 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
|
|
|
15
15
|
|
|
16
16
|
## [Unreleased]
|
|
17
17
|
|
|
18
|
+
## [0.124.3] - 2026-11-18
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- `stitchkit/telegram/screens` has a view content for rich messages with local files:
|
|
23
|
+
`{ richUpload: { contentKey, build } }` (`RichUploadViewMessage`). grammY uploads the
|
|
24
|
+
files on send and on content edits, and an unchanged content key keeps them in place
|
|
25
|
+
across renders. `rich` keeps the Bot API's inline type.
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
|
|
29
|
+
- `stitchkit/telegram/screens` preserves the previous menu when Telegram refuses to
|
|
30
|
+
send its replacement, and its original buttons still work. After a failed display
|
|
31
|
+
`stay()` from `onError` delivers its toast and notices without drawing the refused
|
|
32
|
+
view again. A toast that comes after the press was answered is said in the chat: a
|
|
33
|
+
remark under the menu in a private chat, an ephemeral message to the user who
|
|
34
|
+
pressed in a group. `screens.open` that fails inside a handler rejects there, and
|
|
35
|
+
`onError` hears it once with the handler's trigger.
|
|
36
|
+
**Affects:** `stitchkit/telegram/screens` behaviour
|
|
37
|
+
- `stitchkit/cli` help names the format of a string argument (`<string> [uuid]`,
|
|
38
|
+
`[email]`, `[uri]`, `[date-time]`) and prints the pattern of any other shaped string
|
|
39
|
+
(`[pattern /^[a-z]+$/]`). A formatted string used to print as a bare `<string>`, and
|
|
40
|
+
the caller learned the format from the server's refusal.
|
|
41
|
+
**Affects:** `stitchkit/cli` behaviour
|
|
42
|
+
|
|
18
43
|
## [0.124.2] - 2026-11-17
|
|
19
44
|
|
|
20
45
|
### Fixed
|
package/dist/entrypoints/cli.js
CHANGED
|
@@ -10,5 +10,5 @@ export { type ScreenChatState, ScreenChatStateSchema, type TelegramScreenStorage
|
|
|
10
10
|
export { TelegramScreensRoot, telegramScreens, } from '../../telegram/screens/telegram-screens.js';
|
|
11
11
|
export { createScreenTestChat, type ScreenTestChat, type TestChatCall, type TestChatMessage, type TestChatOptions, } from '../../telegram/screens/test-chat.js';
|
|
12
12
|
export type { TestMessageKind } from '../../telegram/screens/test-chat-telegram.js';
|
|
13
|
-
export { type AnimationViewMessage, type AudioViewMessage, type ButtonLabel, back, type DocumentViewMessage, type Keyboard, type KeyboardButton, type KeyboardRow, link, type PhotoViewMessage, type PlainKeyboardButton, type RichViewMessage, ScreenButton, type ScreenMediaKind, type ScreenViewResult, type TextViewMessage, type VideoViewMessage, type ViewMessage, } from '../../telegram/screens/view.js';
|
|
13
|
+
export { type AnimationViewMessage, type AudioViewMessage, type ButtonLabel, back, type DocumentViewMessage, type Keyboard, type KeyboardButton, type KeyboardRow, link, type PhotoViewMessage, type PlainKeyboardButton, type RichUploadViewMessage, type RichViewMessage, ScreenButton, type ScreenMediaKind, type ScreenViewResult, type TextViewMessage, type VideoViewMessage, type ViewMessage, } from '../../telegram/screens/view.js';
|
|
14
14
|
//# sourceMappingURL=screens.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screens.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/telegram/screens.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACzE,YAAY,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,IAAI,EACJ,YAAY,EACZ,KAAK,YAAY,GAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,aAAa,EACb,KAAK,qBAAqB,EAC1B,KAAK,WAAW,GACjB,MAAM,gCAAgC,CAAC;AACxC,YAAY,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,YAAY,EACV,QAAQ,EACR,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,qBAAqB,GACtB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,KAAK,aAAa,EAClB,WAAW,GACZ,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,0BAA0B,EAC/B,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,cAAc,GACf,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,KAAK,eAAe,EACpB,qBAAqB,EACrB,KAAK,qBAAqB,GAC3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,mBAAmB,EACnB,eAAe,GAChB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,oBAAoB,EACpB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,kCAAkC,CAAC;AAC1C,YAAY,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,IAAI,EACJ,KAAK,mBAAmB,EACxB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,IAAI,EACJ,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,YAAY,EACZ,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,WAAW,GACjB,MAAM,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"screens.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/telegram/screens.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACzE,YAAY,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,IAAI,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AA2C,CAAC;AACjF,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,IAAI,EACJ,KAAK,mBAAmB,EACxB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,IAAI,EACJ,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,YAAY,EACZ,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,WAAW,GACjB,MAAM,6BAA6B,CAAC"}
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
parseRoutePattern
|
|
4
4
|
} from "../../index-m38ej7e5.js";
|
|
5
5
|
import {
|
|
6
|
+
classifyTelegramSendFailure2,
|
|
6
7
|
classifyTelegramEditRefusal
|
|
7
8
|
} from "../../index-f56ct5gb.js";
|
|
8
9
|
import {
|
|
@@ -539,6 +540,8 @@ var RECORD_LIMITS = {
|
|
|
539
540
|
tokenBody: 4096,
|
|
540
541
|
remarks: 100
|
|
541
542
|
};
|
|
543
|
+
var MAX_TRACKED_MESSAGES = 2 * RECORD_LIMITS.messages + 1;
|
|
544
|
+
var MAX_TRACKED_TOKENS = 2 * RECORD_LIMITS.tokens;
|
|
542
545
|
var MessageFingerprintSchema = z2.object({ content: z2.string(), media: z2.string(), markup: z2.string() }).strict();
|
|
543
546
|
var ShownMessageSchema = z2.object({
|
|
544
547
|
key: z2.string().min(1).max(RECORD_LIMITS.key),
|
|
@@ -549,8 +552,8 @@ var ShownMessageSchema = z2.object({
|
|
|
549
552
|
var ScreenViewStateSchema = z2.object({
|
|
550
553
|
screen: z2.string().min(1).max(64),
|
|
551
554
|
params: z2.record(z2.string(), z2.union([z2.string(), z2.number()])),
|
|
552
|
-
messages: z2.array(ShownMessageSchema).min(1).max(
|
|
553
|
-
tokens: z2.record(z2.string(), z2.string().max(RECORD_LIMITS.tokenBody)).refine((tokens) => Object.keys(tokens).length <=
|
|
555
|
+
messages: z2.array(ShownMessageSchema).min(1).max(MAX_TRACKED_MESSAGES),
|
|
556
|
+
tokens: z2.record(z2.string(), z2.string().max(RECORD_LIMITS.tokenBody)).refine((tokens) => Object.keys(tokens).length <= MAX_TRACKED_TOKENS)
|
|
554
557
|
}).strict();
|
|
555
558
|
var ExpiringNoticeSchema = z2.object({ id: z2.number().int().positive(), at: z2.number().int().nonnegative() }).strict();
|
|
556
559
|
var ScreenChatStateSchema = z2.object({
|
|
@@ -599,12 +602,16 @@ function createChatQueue(maxPending) {
|
|
|
599
602
|
// src/telegram/screens/execute.ts
|
|
600
603
|
class PlanInterrupted extends Error {
|
|
601
604
|
shown;
|
|
605
|
+
redrawn;
|
|
606
|
+
sentIds;
|
|
602
607
|
cause;
|
|
603
|
-
constructor(shown, cause) {
|
|
608
|
+
constructor(shown, redrawn, sentIds, cause) {
|
|
604
609
|
super("[stitchkit] telegram screens: a view was left half-drawn by a Bot API failure.", {
|
|
605
610
|
cause
|
|
606
611
|
});
|
|
607
612
|
this.shown = shown;
|
|
613
|
+
this.redrawn = redrawn;
|
|
614
|
+
this.sentIds = sentIds;
|
|
608
615
|
this.cause = cause;
|
|
609
616
|
this.name = "PlanInterrupted";
|
|
610
617
|
}
|
|
@@ -619,6 +626,9 @@ var HTML = "HTML";
|
|
|
619
626
|
function captionOption(message) {
|
|
620
627
|
return message.html === undefined ? {} : { caption: message.html, parse_mode: HTML };
|
|
621
628
|
}
|
|
629
|
+
function richPayload(message) {
|
|
630
|
+
return message.richBuild ? message.richBuild() : message.rich ?? {};
|
|
631
|
+
}
|
|
622
632
|
async function sendOutgoing(api, chatId, message) {
|
|
623
633
|
const extra = { ...captionOption(message), ...markupOption(message.markup) };
|
|
624
634
|
const source = message.media ?? "";
|
|
@@ -630,7 +640,7 @@ async function sendOutgoing(api, chatId, message) {
|
|
|
630
640
|
...markupOption(message.markup)
|
|
631
641
|
})).message_id;
|
|
632
642
|
case "rich":
|
|
633
|
-
return (await api.sendRichMessage(chatId, message
|
|
643
|
+
return (await api.sendRichMessage(chatId, await richPayload(message), markupOption(message.markup))).message_id;
|
|
634
644
|
case "photo":
|
|
635
645
|
return (await api.sendPhoto(chatId, source, extra)).message_id;
|
|
636
646
|
case "video":
|
|
@@ -643,14 +653,14 @@ async function sendOutgoing(api, chatId, message) {
|
|
|
643
653
|
return (await api.sendAudio(chatId, source, extra)).message_id;
|
|
644
654
|
}
|
|
645
655
|
}
|
|
646
|
-
async function editOutgoing(api, chatId, step) {
|
|
656
|
+
async function editOutgoing(api, chatId, step, rich) {
|
|
647
657
|
const { message, parts, id } = step;
|
|
648
658
|
const markup = markupOption(message.markup);
|
|
649
659
|
if (message.kind === "text" || message.kind === "rich") {
|
|
650
660
|
if (!parts.content) {
|
|
651
661
|
await api.editMessageReplyMarkup(chatId, id, markup);
|
|
652
|
-
} else if (
|
|
653
|
-
await api.editMessageText(chatId, id,
|
|
662
|
+
} else if (rich) {
|
|
663
|
+
await api.editMessageText(chatId, id, rich, markup);
|
|
654
664
|
} else {
|
|
655
665
|
await api.editMessageText(chatId, id, message.html ?? "", {
|
|
656
666
|
parse_mode: HTML,
|
|
@@ -687,62 +697,78 @@ async function deleteMessages(api, chatId, ids) {
|
|
|
687
697
|
}
|
|
688
698
|
return undeleted;
|
|
689
699
|
}
|
|
690
|
-
function
|
|
691
|
-
const untouched = [];
|
|
692
|
-
for (const step of remaining) {
|
|
693
|
-
if (step.op !== "send")
|
|
694
|
-
untouched.push({ ...step.from, fingerprint: null });
|
|
695
|
-
}
|
|
696
|
-
const present = new Set([...done, ...untouched].map((message) => message.id));
|
|
697
|
-
const leftovers = deletions.filter((id) => !present.has(id)).map((id) => ({ key: `left-${id}`, id, kind: "text", fingerprint: null }));
|
|
698
|
-
return [...done, ...untouched, ...leftovers].sort((left, right) => left.id - right.id);
|
|
699
|
-
}
|
|
700
|
-
async function executePlan(api, chatId, plan) {
|
|
700
|
+
async function executePlan(api, chatId, plan, previous) {
|
|
701
701
|
const shown = [];
|
|
702
|
+
const visible = new Map(previous.map((message) => [message.id, message]));
|
|
702
703
|
const deletions = [...plan.deletions];
|
|
704
|
+
const redrawn = new Map;
|
|
705
|
+
const sentIds = [];
|
|
706
|
+
let foundMissing = false;
|
|
703
707
|
let resending = false;
|
|
704
|
-
let sent = 0;
|
|
705
708
|
let edited = 0;
|
|
706
709
|
let kept = 0;
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
shown.push(shownFrom(step.id, step.message));
|
|
710
|
+
const record = (id, message) => {
|
|
711
|
+
const entry = shownFrom(id, message);
|
|
712
|
+
shown.push(entry);
|
|
713
|
+
visible.set(id, entry);
|
|
714
|
+
redrawn.set(id, message.tokenIds);
|
|
715
|
+
};
|
|
716
|
+
try {
|
|
717
|
+
for (const step of plan.steps) {
|
|
718
|
+
if (step.op === "keep" && !resending) {
|
|
719
|
+
shown.push(step.from);
|
|
718
720
|
kept += 1;
|
|
719
721
|
continue;
|
|
720
722
|
}
|
|
721
|
-
|
|
722
|
-
await
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
723
|
+
if (step.op === "edit" && !resending) {
|
|
724
|
+
const rich = step.message.kind === "rich" && step.parts.content ? await richPayload(step.message) : undefined;
|
|
725
|
+
try {
|
|
726
|
+
await editOutgoing(api, chatId, step, rich);
|
|
727
|
+
edited += 1;
|
|
728
|
+
} catch (error) {
|
|
729
|
+
const refusal = classifyTelegramEditRefusal(error);
|
|
730
|
+
if (refusal === "not-modified") {
|
|
731
|
+
kept += 1;
|
|
732
|
+
} else if (refusal === "message-gone" || refusal === "message-locked") {
|
|
733
|
+
if (refusal === "message-gone") {
|
|
734
|
+
visible.delete(step.id);
|
|
735
|
+
foundMissing = true;
|
|
736
|
+
}
|
|
737
|
+
resending = true;
|
|
738
|
+
} else {
|
|
739
|
+
const failure = classifyTelegramSendFailure2(error);
|
|
740
|
+
if (failure.reason !== "not-dispatched" && (failure.status ?? 500) >= 500) {
|
|
741
|
+
visible.set(step.id, { ...step.from, fingerprint: null });
|
|
742
|
+
redrawn.set(step.id, step.message.tokenIds);
|
|
743
|
+
}
|
|
744
|
+
throw error;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
if (!resending) {
|
|
748
|
+
record(step.id, step.message);
|
|
731
749
|
continue;
|
|
732
750
|
}
|
|
733
|
-
if (refusal !== "not-modified")
|
|
734
|
-
throw error;
|
|
735
|
-
kept += 1;
|
|
736
751
|
}
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
752
|
+
if (step.op !== "send")
|
|
753
|
+
deletions.push(step.id);
|
|
754
|
+
const id = await sendOutgoing(api, chatId, step.message);
|
|
755
|
+
sentIds.push(id);
|
|
756
|
+
record(id, step.message);
|
|
740
757
|
}
|
|
758
|
+
} catch (error) {
|
|
759
|
+
const snapshot = redrawn.size > 0 || foundMissing ? [...visible.values()].sort((left, right) => left.id - right.id) : undefined;
|
|
760
|
+
throw new PlanInterrupted(snapshot, redrawn, sentIds, error);
|
|
741
761
|
}
|
|
742
762
|
const undeleted = await deleteMessages(api, chatId, deletions);
|
|
743
763
|
return {
|
|
744
764
|
shown,
|
|
745
|
-
report: {
|
|
765
|
+
report: {
|
|
766
|
+
sent: sentIds.length,
|
|
767
|
+
edited,
|
|
768
|
+
kept,
|
|
769
|
+
deleted: deletions.length - undeleted.length,
|
|
770
|
+
undeleted
|
|
771
|
+
}
|
|
746
772
|
};
|
|
747
773
|
}
|
|
748
774
|
|
|
@@ -827,7 +853,7 @@ class TokenBook {
|
|
|
827
853
|
data(body) {
|
|
828
854
|
const direct = this.prefix + body;
|
|
829
855
|
if (utf8Length(direct) <= CALLBACK_DATA_LIMIT)
|
|
830
|
-
return direct;
|
|
856
|
+
return { data: direct };
|
|
831
857
|
if (body.length > RECORD_LIMITS.tokenBody) {
|
|
832
858
|
throw new Error(`[stitchkit] telegram screens: a button of "${this.where}" carries ${body.length} characters; a kept address holds ${RECORD_LIMITS.tokenBody}.`);
|
|
833
859
|
}
|
|
@@ -844,7 +870,7 @@ class TokenBook {
|
|
|
844
870
|
if (utf8Length(spilled) > CALLBACK_DATA_LIMIT) {
|
|
845
871
|
throw new Error(`[stitchkit] telegram screens: callback prefix "${this.prefix}" leaves no room for a button.`);
|
|
846
872
|
}
|
|
847
|
-
return spilled;
|
|
873
|
+
return { data: spilled, token };
|
|
848
874
|
}
|
|
849
875
|
}
|
|
850
876
|
function buttonData(button, context, book) {
|
|
@@ -870,28 +896,44 @@ function buttonData(button, context, book) {
|
|
|
870
896
|
}));
|
|
871
897
|
}
|
|
872
898
|
function renderKeyboard(keyboard, context, book) {
|
|
873
|
-
|
|
874
|
-
return;
|
|
899
|
+
const tokenIds = new Set;
|
|
875
900
|
const rows = [];
|
|
876
|
-
for (const row of keyboard) {
|
|
901
|
+
for (const row of keyboard ?? []) {
|
|
877
902
|
if (!row)
|
|
878
903
|
continue;
|
|
879
904
|
const buttons = [];
|
|
880
905
|
for (const button of row) {
|
|
881
906
|
if (!button)
|
|
882
907
|
continue;
|
|
883
|
-
|
|
908
|
+
if (!(button instanceof ScreenButton)) {
|
|
909
|
+
buttons.push(button);
|
|
910
|
+
continue;
|
|
911
|
+
}
|
|
912
|
+
const address = buttonData(button, context, book);
|
|
913
|
+
if (address.token !== undefined)
|
|
914
|
+
tokenIds.add(address.token);
|
|
915
|
+
buttons.push(labelled(button.label, address.data));
|
|
884
916
|
}
|
|
885
917
|
if (buttons.length > 0)
|
|
886
918
|
rows.push(buttons);
|
|
887
919
|
}
|
|
888
|
-
return
|
|
920
|
+
return {
|
|
921
|
+
markup: rows.length > 0 ? { inline_keyboard: rows } : undefined,
|
|
922
|
+
tokenIds: [...tokenIds]
|
|
923
|
+
};
|
|
889
924
|
}
|
|
890
925
|
function renderMessage(message, key, context, book) {
|
|
891
|
-
const markup = renderKeyboard(message.keyboard, context, book);
|
|
926
|
+
const { markup, tokenIds } = renderKeyboard(message.keyboard, context, book);
|
|
892
927
|
const media = mediaOf(message);
|
|
893
928
|
const rich = message.rich;
|
|
894
|
-
const
|
|
929
|
+
const upload = message.richUpload;
|
|
930
|
+
if (upload !== undefined && (typeof upload?.contentKey !== "string" || !upload.contentKey || typeof upload.build !== "function")) {
|
|
931
|
+
throw new Error("[stitchkit] telegram screens: richUpload needs a non-empty contentKey and a build function.");
|
|
932
|
+
}
|
|
933
|
+
if (upload && rich) {
|
|
934
|
+
throw new Error("[stitchkit] telegram screens: a message has rich or richUpload, not both — the inline content would never be sent.");
|
|
935
|
+
}
|
|
936
|
+
const kind = media ? media.kind : rich || upload ? "rich" : "text";
|
|
895
937
|
const bodyText = media ? message.caption : message.text;
|
|
896
938
|
const html = bodyText === undefined ? undefined : htmlOf(bodyText);
|
|
897
939
|
const linkPreview = message.linkPreview;
|
|
@@ -900,11 +942,13 @@ function renderMessage(message, key, context, book) {
|
|
|
900
942
|
kind,
|
|
901
943
|
html,
|
|
902
944
|
rich,
|
|
945
|
+
richBuild: upload?.build,
|
|
903
946
|
linkPreview,
|
|
904
947
|
media: media?.source,
|
|
905
948
|
markup,
|
|
949
|
+
tokenIds,
|
|
906
950
|
fingerprint: {
|
|
907
|
-
content: argumentsDigest({ html, rich, linkPreview }),
|
|
951
|
+
content: upload ? argumentsDigest({ richContentKey: upload.contentKey }) : argumentsDigest({ html, rich, linkPreview }),
|
|
908
952
|
media: argumentsDigest({ kind, source: media?.source }),
|
|
909
953
|
markup: argumentsDigest({ markup })
|
|
910
954
|
}
|
|
@@ -1000,8 +1044,11 @@ async function settleNavigation(runtime, ctx, origin, outcome) {
|
|
|
1000
1044
|
}
|
|
1001
1045
|
throw new Error(`[stitchkit] telegram screens: loads redirected more than ${MAX_REDIRECTS} times in a row.`);
|
|
1002
1046
|
}
|
|
1003
|
-
async function sendText(api, chatId, content) {
|
|
1004
|
-
return (await api.sendMessage(chatId, htmlOf(content), {
|
|
1047
|
+
async function sendText(api, chatId, content, ephemeral) {
|
|
1048
|
+
return (await api.sendMessage(chatId, htmlOf(content), {
|
|
1049
|
+
parse_mode: "HTML",
|
|
1050
|
+
...ephemeral && { ephemeral_message_parameters: ephemeral }
|
|
1051
|
+
})).message_id;
|
|
1005
1052
|
}
|
|
1006
1053
|
function planFor(base, state, next, moves) {
|
|
1007
1054
|
const current = state.view?.messages ?? [];
|
|
@@ -1046,17 +1093,27 @@ var nothingDone = {
|
|
|
1046
1093
|
deleted: 0,
|
|
1047
1094
|
undeleted: []
|
|
1048
1095
|
};
|
|
1049
|
-
function interruptedRecord(previous,
|
|
1050
|
-
|
|
1051
|
-
const messages = [...untouched, ...shown];
|
|
1052
|
-
if (messages.length === 0)
|
|
1096
|
+
function interruptedRecord(previous, drawn, error, shown = error.shown) {
|
|
1097
|
+
if (!shown)
|
|
1053
1098
|
return previous;
|
|
1099
|
+
if (shown.length === 0)
|
|
1100
|
+
return null;
|
|
1054
1101
|
const identity = previous ?? drawn;
|
|
1102
|
+
const oldMarkup = new Map(previous?.messages.map((m) => [m.id, m.fingerprint?.markup]));
|
|
1103
|
+
const keepsOldButtons = shown.some((m) => oldMarkup.has(m.id) && (!m.fingerprint || m.fingerprint.markup === oldMarkup.get(m.id)));
|
|
1104
|
+
const tokens = keepsOldButtons ? { ...previous?.tokens } : {};
|
|
1105
|
+
for (const message of shown) {
|
|
1106
|
+
for (const id of error.redrawn.get(message.id) ?? []) {
|
|
1107
|
+
const body = drawn.tokens[id];
|
|
1108
|
+
if (body !== undefined)
|
|
1109
|
+
tokens[id] = body;
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1055
1112
|
return {
|
|
1056
1113
|
screen: identity.screen,
|
|
1057
1114
|
params: identity.params,
|
|
1058
|
-
messages,
|
|
1059
|
-
tokens
|
|
1115
|
+
messages: [...shown],
|
|
1116
|
+
tokens
|
|
1060
1117
|
};
|
|
1061
1118
|
}
|
|
1062
1119
|
async function evictOldestRemark(runtime, api, chat, chatId, remarks) {
|
|
@@ -1084,7 +1141,11 @@ async function displayScreen(runtime, request) {
|
|
|
1084
1141
|
let failure;
|
|
1085
1142
|
try {
|
|
1086
1143
|
if (target && rendered) {
|
|
1087
|
-
const
|
|
1144
|
+
const current = state.view?.messages ?? [];
|
|
1145
|
+
const canTrackForeign = current.length < MAX_TRACKED_MESSAGES;
|
|
1146
|
+
const previous = base.mode === "foreign" && canTrackForeign ? [...current, base.message] : current;
|
|
1147
|
+
const fresh = persistent.length > 0 || base.mode === "foreign" && !canTrackForeign || Object.keys({ ...state.view?.tokens, ...rendered.tokens }).length > MAX_TRACKED_TOKENS;
|
|
1148
|
+
const plan = planFor(base, state, rendered.messages, fresh);
|
|
1088
1149
|
const leaving = target.entry.definition.id !== state.view?.screen;
|
|
1089
1150
|
if (remarks.length > 0 && (leaving || plan.steps.some((step) => step.op === "send"))) {
|
|
1090
1151
|
const kept = await deleteMessages(api, chatId, remarks.map((remark) => remark.id));
|
|
@@ -1101,13 +1162,22 @@ async function displayScreen(runtime, request) {
|
|
|
1101
1162
|
for (const notice of persistent)
|
|
1102
1163
|
await sendText(api, chatId, notice.content);
|
|
1103
1164
|
try {
|
|
1104
|
-
const executed = await executePlan(api, chatId, plan);
|
|
1165
|
+
const executed = await executePlan(api, chatId, plan, previous);
|
|
1105
1166
|
report = executed.report;
|
|
1106
1167
|
view = drawn(executed.shown);
|
|
1107
1168
|
} catch (error) {
|
|
1108
1169
|
if (!(error instanceof PlanInterrupted))
|
|
1109
1170
|
throw error;
|
|
1110
|
-
|
|
1171
|
+
const targetView = drawn([]);
|
|
1172
|
+
view = interruptedRecord(state.view, targetView, error);
|
|
1173
|
+
if (view && (view.messages.length > MAX_TRACKED_MESSAGES || Object.keys(view.tokens).length > MAX_TRACKED_TOKENS)) {
|
|
1174
|
+
const sent = new Set(error.sentIds);
|
|
1175
|
+
const retained = error.shown?.filter((m) => !sent.has(m.id));
|
|
1176
|
+
const kept = await deleteMessages(api, chatId, error.sentIds);
|
|
1177
|
+
if (kept.length)
|
|
1178
|
+
runtime.emit({ type: "message-kept", chat, messageIds: kept });
|
|
1179
|
+
view = interruptedRecord(state.view, targetView, error, retained);
|
|
1180
|
+
}
|
|
1111
1181
|
throw error.cause;
|
|
1112
1182
|
}
|
|
1113
1183
|
if (report.undeleted.length > 0) {
|
|
@@ -1292,7 +1362,8 @@ function assertOpenStands(navigated, settled) {
|
|
|
1292
1362
|
throw new Error("[stitchkit] telegram screens: a handler that calls open() shows that screen; return nothing or a toast.");
|
|
1293
1363
|
}
|
|
1294
1364
|
}
|
|
1295
|
-
|
|
1365
|
+
var LATE_TOAST_MS = 30000;
|
|
1366
|
+
async function guarded(runtime, ctx, trigger, chat, chatId, operation, answerError) {
|
|
1296
1367
|
try {
|
|
1297
1368
|
await operation();
|
|
1298
1369
|
} catch (error) {
|
|
@@ -1303,8 +1374,10 @@ async function guarded(runtime, ctx, trigger, chat, chatId, operation, answer) {
|
|
|
1303
1374
|
if (!ScreenOutcome.is(result))
|
|
1304
1375
|
return;
|
|
1305
1376
|
const state = await runtime.readState(chat);
|
|
1306
|
-
const
|
|
1307
|
-
await
|
|
1377
|
+
const outcome = runtime.displayFailed(error) && result.navigation.type === "stay" ? { target: undefined, toast: result.toastSpec, notices: result.notices } : await settleNavigation(runtime, ctx, originOf(runtime, state), result);
|
|
1378
|
+
const settled = answerError ? await answerError(outcome) : outcome;
|
|
1379
|
+
if (!settled.target && settled.notices.length === 0)
|
|
1380
|
+
return;
|
|
1308
1381
|
await runtime.display({
|
|
1309
1382
|
ctx,
|
|
1310
1383
|
chat,
|
|
@@ -1332,14 +1405,16 @@ async function dispatchPress(runtime, ctx) {
|
|
|
1332
1405
|
let answered = false;
|
|
1333
1406
|
const answer = async (settled) => {
|
|
1334
1407
|
if (answered)
|
|
1335
|
-
return;
|
|
1408
|
+
return false;
|
|
1336
1409
|
answered = true;
|
|
1337
1410
|
const toast = settled?.toast;
|
|
1338
1411
|
try {
|
|
1339
1412
|
await ctx.api.answerCallbackQuery(press.id, toast ? { text: toast.text, show_alert: toast.alert } : undefined);
|
|
1413
|
+
return true;
|
|
1340
1414
|
} catch (error) {
|
|
1341
1415
|
if (classifyTelegramEditRefusal(error) !== "query-expired")
|
|
1342
1416
|
throw error;
|
|
1417
|
+
return false;
|
|
1343
1418
|
}
|
|
1344
1419
|
};
|
|
1345
1420
|
try {
|
|
@@ -1371,9 +1446,21 @@ async function dispatchPress(runtime, ctx) {
|
|
|
1371
1446
|
trigger: "press",
|
|
1372
1447
|
started
|
|
1373
1448
|
});
|
|
1374
|
-
},
|
|
1449
|
+
}, async (settled) => {
|
|
1450
|
+
if (await answer(settled) || !settled.toast)
|
|
1451
|
+
return settled;
|
|
1452
|
+
if (message.chat.type === "private") {
|
|
1453
|
+
const remark = { content: settled.toast.text, expiresInMs: LATE_TOAST_MS };
|
|
1454
|
+
return { ...settled, notices: [...settled.notices, remark] };
|
|
1455
|
+
}
|
|
1456
|
+
await sendText(ctx.api, chatId, settled.toast.text, {
|
|
1457
|
+
receiver_user_id: query.from.id,
|
|
1458
|
+
callback_query_id: press.id
|
|
1459
|
+
});
|
|
1460
|
+
return settled;
|
|
1461
|
+
}));
|
|
1375
1462
|
} finally {
|
|
1376
|
-
await answer(
|
|
1463
|
+
await answer();
|
|
1377
1464
|
}
|
|
1378
1465
|
}
|
|
1379
1466
|
async function dispatchInput(runtime, ctx, message) {
|
|
@@ -1448,7 +1535,7 @@ async function openScreen(runtime, ctx, origin, previous) {
|
|
|
1448
1535
|
if (chat === undefined || chatId === undefined) {
|
|
1449
1536
|
throw new Error("[stitchkit] telegram screens: open() needs an update from a chat.");
|
|
1450
1537
|
}
|
|
1451
|
-
|
|
1538
|
+
const open = async () => {
|
|
1452
1539
|
const started = runtime.clock();
|
|
1453
1540
|
const state = await sweepDue(runtime, ctx.api, chat, chatId);
|
|
1454
1541
|
const outcome = new ScreenOutcome({
|
|
@@ -1469,7 +1556,8 @@ async function openScreen(runtime, ctx, origin, previous) {
|
|
|
1469
1556
|
started
|
|
1470
1557
|
});
|
|
1471
1558
|
runtime.markOpened(ctx);
|
|
1472
|
-
}
|
|
1559
|
+
};
|
|
1560
|
+
await runtime.exclusive(ctx, chat, runtime.inside(ctx) ? open : () => guarded(runtime, ctx, "open", chat, chatId, open));
|
|
1473
1561
|
}
|
|
1474
1562
|
|
|
1475
1563
|
// src/telegram/screens/registry.ts
|
|
@@ -1552,7 +1640,8 @@ function createScreensRuntime(config) {
|
|
|
1552
1640
|
throw new Error('[stitchkit] telegram screens: callbackPrefix must be non-empty and free of "#" and "!".');
|
|
1553
1641
|
}
|
|
1554
1642
|
const queue = createChatQueue(MAX_PENDING_PER_CHAT);
|
|
1555
|
-
const
|
|
1643
|
+
const running = new WeakSet;
|
|
1644
|
+
const failedDisplays = new WeakSet;
|
|
1556
1645
|
const timers = new Set;
|
|
1557
1646
|
const opened = new WeakSet;
|
|
1558
1647
|
const runtime = {
|
|
@@ -1564,24 +1653,34 @@ function createScreensRuntime(config) {
|
|
|
1564
1653
|
chatKey: (ctx) => config.chatKey ? config.chatKey(ctx) : ctx.chat ? `screens:${ctx.chat.id}` : undefined,
|
|
1565
1654
|
answers: (ctx) => (config.chats ?? "private") === "all" || ctx.chat?.type === "private",
|
|
1566
1655
|
exclusive: async (ctx, chat, task) => {
|
|
1567
|
-
if (
|
|
1656
|
+
if (running.has(ctx))
|
|
1568
1657
|
return task();
|
|
1569
1658
|
return queue(chat, async () => {
|
|
1570
|
-
|
|
1659
|
+
running.add(ctx);
|
|
1571
1660
|
try {
|
|
1572
1661
|
return await task();
|
|
1573
1662
|
} finally {
|
|
1574
|
-
|
|
1663
|
+
running.delete(ctx);
|
|
1575
1664
|
}
|
|
1576
1665
|
});
|
|
1577
1666
|
},
|
|
1667
|
+
inside: (ctx) => running.has(ctx),
|
|
1578
1668
|
readState: async (chat) => {
|
|
1579
1669
|
const read = await readChatState(config.storage, chat);
|
|
1580
1670
|
if (read.discarded)
|
|
1581
1671
|
runtime.emit({ type: "state-discarded", chat });
|
|
1582
1672
|
return read.state;
|
|
1583
1673
|
},
|
|
1584
|
-
display: (request) =>
|
|
1674
|
+
display: async (request) => {
|
|
1675
|
+
try {
|
|
1676
|
+
await displayScreen(runtime, request);
|
|
1677
|
+
} catch (error) {
|
|
1678
|
+
if (typeof error === "object" && error !== null)
|
|
1679
|
+
failedDisplays.add(error);
|
|
1680
|
+
throw error;
|
|
1681
|
+
}
|
|
1682
|
+
},
|
|
1683
|
+
displayFailed: (error) => typeof error === "object" && error !== null && failedDisplays.has(error),
|
|
1585
1684
|
markOpened: (ctx) => {
|
|
1586
1685
|
opened.add(ctx);
|
|
1587
1686
|
},
|
|
@@ -1754,6 +1853,20 @@ function createFakeTelegram({
|
|
|
1754
1853
|
const stored = [];
|
|
1755
1854
|
const answers = [];
|
|
1756
1855
|
let lastMessageId = 0;
|
|
1856
|
+
let lastFileId = 0;
|
|
1857
|
+
const fileIds = new WeakMap;
|
|
1858
|
+
const receivedRich = (value) => {
|
|
1859
|
+
if (Array.isArray(value))
|
|
1860
|
+
return value.map(receivedRich);
|
|
1861
|
+
if (!isRecord(value))
|
|
1862
|
+
return value;
|
|
1863
|
+
if (typeof value.toRaw === "function") {
|
|
1864
|
+
const id = fileIds.get(value) ?? `test-file-${++lastFileId}`;
|
|
1865
|
+
fileIds.set(value, id);
|
|
1866
|
+
return id;
|
|
1867
|
+
}
|
|
1868
|
+
return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, receivedRich(v)]));
|
|
1869
|
+
};
|
|
1757
1870
|
const refuse = (description, errorCode = 400) => ({
|
|
1758
1871
|
ok: false,
|
|
1759
1872
|
error_code: errorCode,
|
|
@@ -1791,7 +1904,7 @@ function createFakeTelegram({
|
|
|
1791
1904
|
kind,
|
|
1792
1905
|
text: stringAt(payload, kind === "text" ? "text" : "caption") ?? "",
|
|
1793
1906
|
media: kind === "text" || kind === "rich" ? undefined : stringAt(payload, kind),
|
|
1794
|
-
rich: payload.rich_message,
|
|
1907
|
+
rich: receivedRich(payload.rich_message),
|
|
1795
1908
|
markup: markupAt(payload),
|
|
1796
1909
|
deleted: false
|
|
1797
1910
|
};
|
|
@@ -1807,7 +1920,7 @@ function createFakeTelegram({
|
|
|
1807
1920
|
if (refusal)
|
|
1808
1921
|
return refuse(refusal);
|
|
1809
1922
|
const markup = markupAt(payload);
|
|
1810
|
-
const content = editContent(message, method, payload);
|
|
1923
|
+
const content = editContent(message, method, "rich_message" in payload ? { ...payload, rich_message: receivedRich(payload.rich_message) } : payload);
|
|
1811
1924
|
if ("refused" in content)
|
|
1812
1925
|
return refuse(content.refused);
|
|
1813
1926
|
if (!content.changed && sameMarkup(message.markup, markup))
|
|
@@ -1157,8 +1157,36 @@ function typeLabel(schema) {
|
|
|
1157
1157
|
return schema.type;
|
|
1158
1158
|
return "value";
|
|
1159
1159
|
}
|
|
1160
|
+
var STANDARD_FORMATS = new Set([
|
|
1161
|
+
"date-time",
|
|
1162
|
+
"date",
|
|
1163
|
+
"time",
|
|
1164
|
+
"duration",
|
|
1165
|
+
"email",
|
|
1166
|
+
"idn-email",
|
|
1167
|
+
"hostname",
|
|
1168
|
+
"idn-hostname",
|
|
1169
|
+
"ipv4",
|
|
1170
|
+
"ipv6",
|
|
1171
|
+
"uri",
|
|
1172
|
+
"uri-reference",
|
|
1173
|
+
"iri",
|
|
1174
|
+
"iri-reference",
|
|
1175
|
+
"uuid",
|
|
1176
|
+
"uri-template",
|
|
1177
|
+
"json-pointer",
|
|
1178
|
+
"relative-json-pointer",
|
|
1179
|
+
"regex"
|
|
1180
|
+
]);
|
|
1160
1181
|
function constraintLabel(schema) {
|
|
1161
1182
|
const limits = [];
|
|
1183
|
+
const format = typeof schema.format === "string" ? schema.format : undefined;
|
|
1184
|
+
const pattern = typeof schema.pattern === "string" ? schema.pattern : undefined;
|
|
1185
|
+
if (format !== undefined && (STANDARD_FORMATS.has(format) || pattern === undefined)) {
|
|
1186
|
+
limits.push(format);
|
|
1187
|
+
} else if (pattern !== undefined) {
|
|
1188
|
+
limits.push(`pattern /${pattern}/`);
|
|
1189
|
+
}
|
|
1162
1190
|
const bounds = [
|
|
1163
1191
|
["minimum", ">="],
|
|
1164
1192
|
["exclusiveMinimum", ">"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../../src/telegram/screens/dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAA4B,OAAO,EAAE,MAAM,cAAc,CAAC;AAGtE,OAAO,EAEL,KAAK,YAAY,EAKlB,MAAM,WAAW,CAAC;AAMnB,OAAO,KAAK,EAAqB,cAAc,EAAiB,MAAM,WAAW,CAAC;AAClF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AA2BtD,qFAAqF;AACrF,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe,GAAG,SAAS,CAczE;
|
|
1
|
+
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../../src/telegram/screens/dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAA4B,OAAO,EAAE,MAAM,cAAc,CAAC;AAGtE,OAAO,EAEL,KAAK,YAAY,EAKlB,MAAM,WAAW,CAAC;AAMnB,OAAO,KAAK,EAAqB,cAAc,EAAiB,MAAM,WAAW,CAAC;AAClF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AA2BtD,qFAAqF;AACrF,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe,GAAG,SAAS,CAczE;AAmLD,wBAAsB,aAAa,CAAC,CAAC,SAAS,OAAO,EACnD,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,EAC1B,GAAG,EAAE,CAAC,GACL,OAAO,CAAC,IAAI,CAAC,CAgGf;AAED,oFAAoF;AACpF,wBAAsB,aAAa,CAAC,CAAC,SAAS,OAAO,EACnD,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,EAC1B,GAAG,EAAE,CAAC,EACN,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,OAAO,CAAC,CAmFlB;AAED,wBAAsB,UAAU,CAAC,CAAC,SAAS,OAAO,EAChD,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,EAC1B,GAAG,EAAE,CAAC,EACN,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EACvB,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAC1B,OAAO,CAAC,IAAI,CAAC,CAmCf"}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* call halfway, so the record never claims less or more than the chat shows.
|
|
10
10
|
*/
|
|
11
11
|
import type { Context } from 'grammy';
|
|
12
|
+
import type { EphemeralMessageParameters } from 'grammy/types';
|
|
12
13
|
import type { ActionValue } from './callback-codec.js';
|
|
13
14
|
import { type ScreenApi } from './execute.js';
|
|
14
15
|
import type { TelegramText } from './html.js';
|
|
@@ -63,7 +64,7 @@ export interface DisplayRequest<C extends Context> {
|
|
|
63
64
|
readonly trigger: ScreenTrigger;
|
|
64
65
|
readonly started: number;
|
|
65
66
|
}
|
|
66
|
-
export declare function sendText(api: ScreenApi, chatId: number, content: TelegramText): Promise<number>;
|
|
67
|
+
export declare function sendText(api: ScreenApi, chatId: number, content: TelegramText, ephemeral?: EphemeralMessageParameters): Promise<number>;
|
|
67
68
|
/** Delete the chat's remarks whose time has come, and write the record. */
|
|
68
69
|
export declare function sweepDue<C extends Context>(runtime: ScreensRuntime<C>, api: ScreenApi, chat: string, chatId: number): Promise<ScreenChatState>;
|
|
69
70
|
export declare function displayScreen<C extends Context>(runtime: ScreensRuntime<C>, request: DisplayRequest<C>): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../../src/telegram/screens/display.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC1E,OAAO,EAAY,KAAK,YAAY,EAAiB,MAAM,aAAa,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,
|
|
1
|
+
{"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../../src/telegram/screens/display.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC1E,OAAO,EAAY,KAAK,YAAY,EAAiB,MAAM,aAAa,CAAC;AACz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39
39
|
readonly shown: readonly ShownMessage[];
|
|
40
40
|
readonly report: ExecutionReport;
|
|
41
41
|
}
|
|
42
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* A plan stopped by a refusal the chat cannot absorb. `shown` is what the chat
|
|
44
|
+
* shows now, top to bottom — absent when no call changed what the record says,
|
|
45
|
+
* empty when nothing of the view is left. `redrawn` names the messages that
|
|
46
|
+
* now show the new view, each with the tokens its keyboard carries; `sentIds`
|
|
47
|
+
* are those of them this attempt sent.
|
|
48
|
+
*/
|
|
43
49
|
export declare class PlanInterrupted extends Error {
|
|
44
|
-
readonly shown: readonly ShownMessage[];
|
|
50
|
+
readonly shown: readonly ShownMessage[] | undefined;
|
|
51
|
+
readonly redrawn: ReadonlyMap<number, readonly string[]>;
|
|
52
|
+
readonly sentIds: readonly number[];
|
|
45
53
|
readonly cause: unknown;
|
|
46
|
-
constructor(shown: readonly ShownMessage[], cause: unknown);
|
|
54
|
+
constructor(shown: readonly ShownMessage[] | undefined, redrawn: ReadonlyMap<number, readonly string[]>, sentIds: readonly number[], cause: unknown);
|
|
47
55
|
}
|
|
48
56
|
export declare function sendOutgoing(api: ScreenApi, chatId: ChatId, message: OutgoingMessage): Promise<number>;
|
|
49
57
|
/**
|
|
@@ -53,5 +61,5 @@ export declare function sendOutgoing(api: ScreenApi, chatId: ChatId, message: Ou
|
|
|
53
61
|
* would leave the chat's record behind the chat.
|
|
54
62
|
*/
|
|
55
63
|
export declare function deleteMessages(api: ScreenApi, chatId: ChatId, ids: readonly number[]): Promise<number[]>;
|
|
56
|
-
export declare function executePlan(api: ScreenApi, chatId: ChatId, plan: ViewPlan): Promise<ExecutedView>;
|
|
64
|
+
export declare function executePlan(api: ScreenApi, chatId: ChatId, plan: ViewPlan, previous: readonly ShownMessage[]): Promise<ExecutedView>;
|
|
57
65
|
//# sourceMappingURL=execute.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/telegram/screens/execute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/telegram/screens/execute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAQlC,OAAO,KAAK,EAAY,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,kEAAkE;AAClE,MAAM,MAAM,SAAS,GAAG,IAAI,CAC1B,GAAG,EACD,aAAa,GACb,iBAAiB,GACjB,WAAW,GACX,WAAW,GACX,eAAe,GACf,cAAc,GACd,WAAW,GACX,iBAAiB,GACjB,oBAAoB,GACpB,kBAAkB,GAClB,wBAAwB,GACxB,eAAe,GACf,qBAAqB,CACxB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAE5B,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,sEAAsE;IACtE,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;CAClC;AAED;;;;;;GAMG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IAEtC,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,GAAG,SAAS;IACnD,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACxD,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE;aACjB,KAAK,EAAE,OAAO;IAJlC,YACW,KAAK,EAAE,SAAS,YAAY,EAAE,GAAG,SAAS,EAC1C,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,EAC/C,OAAO,EAAE,SAAS,MAAM,EAAE,EACjB,KAAK,EAAE,OAAO,EAMjC;CACF;AAoBD,wBAAsB,YAAY,CAChC,GAAG,EAAE,SAAS,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,MAAM,CAAC,CA+BjB;AA0CD;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,SAAS,EACd,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,SAAS,MAAM,EAAE,GACrB,OAAO,CAAC,MAAM,EAAE,CAAC,CAanB;AAED,wBAAsB,WAAW,CAC/B,GAAG,EAAE,SAAS,EACd,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,QAAQ,EACd,QAAQ,EAAE,SAAS,YAAY,EAAE,GAChC,OAAO,CAAC,YAAY,CAAC,CAgFvB"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Telegram's 64 bytes is kept in the chat's state under a short token and the
|
|
9
9
|
* button carries the token — so a long param never makes a screen unrenderable.
|
|
10
10
|
*/
|
|
11
|
-
import type { InlineKeyboardButton, InlineKeyboardMarkup, InputRichMessageWithoutUpload } from 'grammy/types';
|
|
11
|
+
import type { InlineKeyboardButton, InlineKeyboardMarkup, InputRichMessage, InputRichMessageWithoutUpload } from 'grammy/types';
|
|
12
12
|
import { type TelegramText } from './html.js';
|
|
13
13
|
import type { AnyTelegramScreen, ScreenParams } from './screen-types.js';
|
|
14
14
|
import { ScreenButton, type ScreenMediaKind, type ScreenViewResult } from './view.js';
|
|
@@ -29,9 +29,13 @@ export interface OutgoingMessage {
|
|
|
29
29
|
*/
|
|
30
30
|
readonly html: string | undefined;
|
|
31
31
|
readonly rich: InputRichMessageWithoutUpload | undefined;
|
|
32
|
+
/** Builds the content of a rich message with uploads; called when it is sent or edited. */
|
|
33
|
+
readonly richBuild: (() => InputRichMessage | Promise<InputRichMessage>) | undefined;
|
|
32
34
|
readonly linkPreview: boolean | undefined;
|
|
33
35
|
readonly media: string | undefined;
|
|
34
36
|
readonly markup: InlineKeyboardMarkup | undefined;
|
|
37
|
+
/** The tokens this keyboard's buttons carry in place of an address kept in the record. */
|
|
38
|
+
readonly tokenIds: readonly string[];
|
|
35
39
|
readonly fingerprint: MessageFingerprint;
|
|
36
40
|
}
|
|
37
41
|
/** Where a screen button leads, resolved against the registered screens. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../src/telegram/screens/render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,6BAA6B,EAC9B,MAAM,cAAc,CAAC;AAUtB,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAIL,YAAY,EACZ,KAAK,eAAe,EACpB,KAAK,gBAAgB,EAEtB,MAAM,QAAQ,CAAC;AAEhB,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,eAAe,CAAC;AAE7D,qEAAqE;AACrE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAA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C"}
|
|
@@ -84,7 +84,7 @@ export interface TelegramScreensConfig<C extends Context> {
|
|
|
84
84
|
/** A press this bot no longer understands, or that no button carried. Default: answered silently. */
|
|
85
85
|
readonly onStale?: (c: ScreenStaleContext<C>) => ScreenHandlerResult;
|
|
86
86
|
/**
|
|
87
|
-
* A load, action or
|
|
87
|
+
* A load, action, input or display that threw. Its outcome is shown instead; without
|
|
88
88
|
* it the press is answered silently and the error reaches `bot.catch`.
|
|
89
89
|
*/
|
|
90
90
|
readonly onError?: (error: unknown, c: ScreenErrorContext<C>) => ScreenHandlerResult;
|
|
@@ -116,8 +116,12 @@ export interface ScreensRuntime<C extends Context> {
|
|
|
116
116
|
answers(ctx: C): boolean;
|
|
117
117
|
/** Run `task` alone in the chat; a call from inside the chat's own task runs inline. */
|
|
118
118
|
exclusive<T>(ctx: C, chat: string, task: () => Promise<T>): Promise<T>;
|
|
119
|
+
/** Whether this update already runs its chat's task — a call from one of its handlers. */
|
|
120
|
+
inside(ctx: C): boolean;
|
|
119
121
|
readState(chat: string): Promise<ScreenChatState>;
|
|
120
122
|
display(request: DisplayRequest<C>): Promise<void>;
|
|
123
|
+
/** Whether `error` is what a display threw: the chat's record already says what it shows. */
|
|
124
|
+
displayFailed(error: unknown): boolean;
|
|
121
125
|
/** `open` showed a screen for this update. */
|
|
122
126
|
markOpened(ctx: C): void;
|
|
123
127
|
/** Whether `open` showed a screen for this update — from inside its handler, its navigation stands. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/telegram/screens/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,KAAK,cAAc,EAA2B,MAAM,WAAW,CAAC;AACzE,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AE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACnF,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,OAAO,CAAE,SAAQ,cAAc,CAAC,CAAC,CAAC;IAC/E,iEAAiE;IACjE,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC;CACrD;AAED,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,OAAO,EACpD,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAC/B,mBAAmB,CAAC,CAAC,CAAC,CAmExB"}
|
|
@@ -31,6 +31,9 @@ export declare const RECORD_LIMITS: {
|
|
|
31
31
|
/** Remarks waiting to expire. */
|
|
32
32
|
remarks: number;
|
|
33
33
|
};
|
|
34
|
+
/** An interrupted transition can show both views and the message of a foreign press. */
|
|
35
|
+
export declare const MAX_TRACKED_MESSAGES: number;
|
|
36
|
+
export declare const MAX_TRACKED_TOKENS: number;
|
|
34
37
|
declare const ScreenViewStateSchema: z.ZodObject<{
|
|
35
38
|
screen: z.ZodString;
|
|
36
39
|
params: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/telegram/screens/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;GAIG;AACH,eAAO,MAAM,aAAa;IACxB,4BAA4B;IAC5B,QAAQ;IACR,mCAAmC;IACnC,GAAG;IACH,6DAA6D;IAC7D,MAAM;IACN,sCAAsC;IACtC,SAAS;IACT,iCAAiC;IACjC,OAAO;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AC,EACjC,IAAI,EACJ,OAAO,EACP,IAAI,GACL,EAAE,oBAAoB,GAAG,YAAY,CAqIrC"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* What a screen shows: messages as plain objects.
|
|
3
3
|
*
|
|
4
4
|
* A view is data, so it can be compared. `{ text }` is a text message,
|
|
5
|
-
* `{ rich }` a Bot API rich message (Markdown, HTML or blocks,
|
|
6
|
-
*
|
|
5
|
+
* `{ rich }` a Bot API rich message (Markdown, HTML or blocks), `{ richUpload }`
|
|
6
|
+
* a rich message whose files are uploaded, and `{ photo }` (or `video`, `animation`, `document`, `audio`) a
|
|
7
7
|
* media message with an optional caption; exactly one of those keys is
|
|
8
8
|
* present, and the type says so. A keyboard is rows of buttons where a row or a button may be `false`,
|
|
9
9
|
* `null` or `undefined` — a conditional row is written in the literal, not
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* any Telegram inline button that carries no `callback_data`, as Telegram
|
|
12
12
|
* spells it.
|
|
13
13
|
*/
|
|
14
|
-
import type { InlineKeyboardButton, InputRichMessageWithoutUpload } from 'grammy/types';
|
|
14
|
+
import type { InlineKeyboardButton, InputRichMessage, InputRichMessageWithoutUpload } from 'grammy/types';
|
|
15
15
|
import type { ActionValue } from './callback-codec.js';
|
|
16
16
|
import type { TelegramText } from './html.js';
|
|
17
17
|
import type { AnyTelegramScreen, ScreenLinkArgs } from './screen-types.js';
|
|
@@ -54,7 +54,7 @@ interface ViewMessageCommon {
|
|
|
54
54
|
readonly key?: string;
|
|
55
55
|
readonly keyboard?: Keyboard;
|
|
56
56
|
}
|
|
57
|
-
type ContentKey = 'text' | 'rich' | ScreenMediaKind;
|
|
57
|
+
type ContentKey = 'text' | 'rich' | 'richUpload' | ScreenMediaKind;
|
|
58
58
|
type Without<TKeys extends string> = {
|
|
59
59
|
readonly [K in TKeys]?: never;
|
|
60
60
|
};
|
|
@@ -67,6 +67,15 @@ export interface RichViewMessage extends ViewMessageCommon, Without<Exclude<Cont
|
|
|
67
67
|
/** A rich message as the Bot API takes it; files by `file_id` or URL only. */
|
|
68
68
|
readonly rich: InputRichMessageWithoutUpload;
|
|
69
69
|
}
|
|
70
|
+
export interface RichUploadViewMessage extends ViewMessageCommon, Without<Exclude<ContentKey, 'richUpload'> | 'caption' | 'linkPreview'> {
|
|
71
|
+
/** A rich message whose files grammY uploads, built when it is sent. */
|
|
72
|
+
readonly richUpload: {
|
|
73
|
+
/** Change this when any rich content changes, including text, file bytes or block order. */
|
|
74
|
+
readonly contentKey: string;
|
|
75
|
+
/** Called for each content send or edit. Return fresh input for one-shot streams. */
|
|
76
|
+
readonly build: () => InputRichMessage | Promise<InputRichMessage>;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
70
79
|
type MediaViewMessageOf<TKind extends ScreenMediaKind> = ViewMessageCommon & Without<Exclude<ContentKey, TKind> | 'linkPreview'> & {
|
|
71
80
|
/** A Telegram `file_id` or an HTTP URL Telegram can fetch. */
|
|
72
81
|
readonly [K in TKind]: string;
|
|
@@ -78,7 +87,7 @@ export type VideoViewMessage = MediaViewMessageOf<'video'>;
|
|
|
78
87
|
export type AnimationViewMessage = MediaViewMessageOf<'animation'>;
|
|
79
88
|
export type DocumentViewMessage = MediaViewMessageOf<'document'>;
|
|
80
89
|
export type AudioViewMessage = MediaViewMessageOf<'audio'>;
|
|
81
|
-
export type ViewMessage = TextViewMessage | RichViewMessage | PhotoViewMessage | VideoViewMessage | AnimationViewMessage | DocumentViewMessage | AudioViewMessage;
|
|
90
|
+
export type ViewMessage = TextViewMessage | RichViewMessage | RichUploadViewMessage | PhotoViewMessage | VideoViewMessage | AnimationViewMessage | DocumentViewMessage | AudioViewMessage;
|
|
82
91
|
/** What `view` returns: one message, or several shown top to bottom. */
|
|
83
92
|
export type ScreenViewResult = ViewMessage | readonly ViewMessage[];
|
|
84
93
|
/** A link to another screen; its params are required exactly when its path has any. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../../src/telegram/screens/view.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../../src/telegram/screens/view.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EAChB,6BAA6B,EAC9B,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAExE,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,OAAO,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC;AACrF,eAAO,MAAM,kBAAkB,EAAE,SAAS,eAAe,EAMxD,CAAC;AAEF,yFAAyF;AACzF,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,IAAI,CAAC,oBAAoB,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;AAE9F,KAAK,YAAY,GACb;IACE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;CACxD,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzB;IACE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IACvD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,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,oBAAoB,GACpB,mBAAmB,GACnB,gBAAgB,CAAC;AAErB,wEAAwE;AACxE,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,SAAS,WAAW,EAAE,CAAC;AAEpE,uFAAuF;AACvF,wBAAgB,IAAI,CAAC,OAAO,SAAS,iBAAiB,EACpD,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,OAAO,EACf,GAAG,MAAM,EAAE,cAAc,CAAC,OAAO,CAAC,GACjC,YAAY,CAGd;AAED,iFAAiF;AACjF,wBAAgB,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,CAErD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/help.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,eAAe,EAAoB,MAAM,+BAA+B,CAAC;AAEvF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/help.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,eAAe,EAAoB,MAAM,+BAA+B,CAAC;AAEvF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAqKvD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAAC,EAC7C,MAAM,EAAE,MAAM,GACb,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAAC,CASrC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,SAAS,eAAe,EAAE,CAAC;IAC/C,wEAAwE;IACxE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,MAAM,CAyCT;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,sBAAsB,EAClC,kBAAkB,GAAE,SAAS,eAAe,EAAO,GAClD,MAAM,CA4ER"}
|
package/llms/cli.txt
CHANGED
|
@@ -637,6 +637,14 @@ type, not a bound, so a bare integer prints `<integer>`, `.min(1)` prints `>=1`
|
|
|
637
637
|
`.positive()` prints `>0`. Unbounded fields keep just their type and description. Bounds on an array's items are not bounds
|
|
638
638
|
on the array itself.
|
|
639
639
|
|
|
640
|
+
A string says what shape it must have, before its bounds. A format JSON Schema
|
|
641
|
+
defines is said by name — `<string> [uuid]`, `[email]`, `[uri]`, `[date-time]` —
|
|
642
|
+
and the expression it is checked with is not printed. Any other shape is said
|
|
643
|
+
by its pattern between slashes, `<string> [pattern /^[a-z]+$/, length >=2]`, and
|
|
644
|
+
by its format's name only when the schema carries no pattern. A schema that
|
|
645
|
+
composes two patterns prints both under `all of:`, a named format among them
|
|
646
|
+
included: there the schema no longer carries the name.
|
|
647
|
+
|
|
640
648
|
Composed schemas retain their meaning: `any of:` and `one of:` separate
|
|
641
649
|
alternative branches with `|`, while `all of:` joins constraints with `&`.
|
|
642
650
|
For example, a nullable bounded string renders
|
|
@@ -138,6 +138,37 @@ bot.catch((error) => logger.error('update failed', { error }))
|
|
|
138
138
|
message is sent with `parse_mode: 'HTML'` set explicitly, so an application's
|
|
139
139
|
own `parse_mode` transformer changes nothing.
|
|
140
140
|
|
|
141
|
+
### Uploading a rich preview
|
|
142
|
+
|
|
143
|
+
For a local photo, a message is `richUpload`: a `contentKey` and a `build` function. The key
|
|
144
|
+
identifies the complete rich payload. Change it when the file bytes, text or
|
|
145
|
+
order of blocks changes. The outer message `key` identifies the Telegram
|
|
146
|
+
message that can be edited in place.
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
import { InputFile } from 'grammy'
|
|
150
|
+
import type { RichUploadViewMessage } from 'stitchkit/telegram/screens'
|
|
151
|
+
|
|
152
|
+
function preview(path: string, revision: string): RichUploadViewMessage {
|
|
153
|
+
return {
|
|
154
|
+
richUpload: {
|
|
155
|
+
contentKey: revision,
|
|
156
|
+
build: () => ({
|
|
157
|
+
blocks: [{ type: 'photo', photo: { type: 'photo', media: new InputFile(path) } }],
|
|
158
|
+
}),
|
|
159
|
+
},
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
`richUpload` is a content of its own, like `text` or `photo`: a message has it
|
|
165
|
+
or `rich`, never both, and `rich` stays the Bot API's inline type. The runtime
|
|
166
|
+
calls `build` for each send or content edit. It can return a
|
|
167
|
+
promise. A resend needs a fresh file if its stream was consumed. A render
|
|
168
|
+
with the same content key skips the upload, including when it edits the
|
|
169
|
+
keyboard. Storage holds the fingerprint. For a URL or a Telegram `file_id`,
|
|
170
|
+
pass the Bot API rich object as `rich`.
|
|
171
|
+
|
|
141
172
|
## Outcomes
|
|
142
173
|
|
|
143
174
|
A load, an action and an input handler answer with an outcome, built by
|
|
@@ -194,6 +225,15 @@ When Telegram refuses a step:
|
|
|
194
225
|
renders. The next update repairs the rest. A receipt or a remark Telegram
|
|
195
226
|
refuses stops the update the same way, with the view already drawn recorded.
|
|
196
227
|
|
|
228
|
+
If Telegram refuses the first send, the previous menu keeps its message IDs,
|
|
229
|
+
buttons and input routing. When an edit has an uncertain result, the next
|
|
230
|
+
render checks that message again. If repeated interrupted transitions would
|
|
231
|
+
exceed the chat record's recovery limit, the runtime cleans up the latest
|
|
232
|
+
failed attempt's new sends. A later press can retry the full transition.
|
|
233
|
+
One case the record cannot hold: a send Telegram carried out but whose answer
|
|
234
|
+
was lost has no id to record, so that message stays in the chat until the user
|
|
235
|
+
removes it.
|
|
236
|
+
|
|
197
237
|
A view is checked before anything is sent: at most 100 messages, keys of 1 to
|
|
198
238
|
64 characters, at most 100 buttons whose address is kept in the record. A view
|
|
199
239
|
past these fails in the handler's place, with the chat untouched.
|
|
@@ -247,7 +287,9 @@ Called from inside a handler of the same chat, it runs at once rather than
|
|
|
247
287
|
waiting behind the update that called it, and the screen it opened stands: the
|
|
248
288
|
handler may still answer the press with a toast, and returning a navigation or
|
|
249
289
|
a notice as well is an error — drawn after it, the handler's own outcome would
|
|
250
|
-
put the record back on the screen the chat left.
|
|
290
|
+
put the record back on the screen the chat left. An open that fails inside a
|
|
291
|
+
handler rejects there: the failure is the handler's, and `onError` hears it
|
|
292
|
+
once, with the handler's trigger.
|
|
251
293
|
|
|
252
294
|
## State and concurrency
|
|
253
295
|
|
|
@@ -274,7 +316,7 @@ refused halfway too.
|
|
|
274
316
|
| `callbackPrefix` | `~` | what every screen button's `callback_data` starts with |
|
|
275
317
|
| `chats` | `'private'` | `'all'` answers in groups too, where any member can press or type |
|
|
276
318
|
| `onStale(c)` | answered silently | a press nothing can answer, with its `reason`; its outcome is shown |
|
|
277
|
-
| `onError(error, c)` | none | a load, action or
|
|
319
|
+
| `onError(error, c)` | none | a load, action, input or display that threw. Its outcome is shown. |
|
|
278
320
|
| `onEvent(event)` | none | `transition`, `state-discarded`, `message-kept`, `sweep-failed` (a remark's timer could not delete it) — never message text |
|
|
279
321
|
| `clock` | `Date.now` | the time expiring remarks are measured by |
|
|
280
322
|
|
|
@@ -283,6 +325,19 @@ Without `onError` the press is answered silently and the error reaches
|
|
|
283
325
|
timers on the way down; a remark left behind is removed on the chat's next
|
|
284
326
|
update.
|
|
285
327
|
|
|
328
|
+
A view Telegram refused is not drawn again by the report of its refusal:
|
|
329
|
+
after a failed display `stay()` leaves the chat as its record says and only
|
|
330
|
+
delivers the toast and the notices, so the refused request is sent once and
|
|
331
|
+
the next press retries it. `go()` and `back()` are followed as usual. A
|
|
332
|
+
handler that threw changed nothing in the chat, so after it `stay()` loads
|
|
333
|
+
and draws its screen anew.
|
|
334
|
+
|
|
335
|
+
A press is answered before its view is drawn, so a toast for a failed display
|
|
336
|
+
comes too late to be the answer. In a private chat it is said as a remark of
|
|
337
|
+
the screen — escaped text under the menu that leaves with the next view sent,
|
|
338
|
+
or after 30 seconds. In a group it is an ephemeral message only the user who
|
|
339
|
+
pressed receives.
|
|
340
|
+
|
|
286
341
|
## Security
|
|
287
342
|
|
|
288
343
|
- **A group's `load` checks access** for every screen, action and input under
|
|
@@ -321,7 +376,7 @@ refuse a call, `deleteByUser`, `pressData` for a forged press and
|
|
|
321
376
|
|
|
322
377
|
## Not included
|
|
323
378
|
|
|
324
|
-
Reply keyboards, inline mode,
|
|
379
|
+
Reply keyboards, inline mode, uploads for standalone media messages, showing a
|
|
325
380
|
screen without an update (use `screens.button` in a notification), converting
|
|
326
381
|
an incoming message to HTML, and a history stack.
|
|
327
382
|
|
|
@@ -350,7 +405,7 @@ the whole dependency. → ADR 0211 — [guide](../guide/telegram-screens.md)
|
|
|
350
405
|
| `ScreenInputKind` / `ScreenInputOptions` | _type_ | `text` `rich` `photo` `video` `animation` `document` `audio` `voice` `video_note` `sticker` `location` `contact`; `keepMessage` leaves the user's message (default: deleted before the handler) |
|
|
351
406
|
| `ScreenHandlerResult` / `ScreenOutcome` / `ScreenOutcomeBuilders` / `ScreenInputOutcomeBuilders` | _type_ / class | what a load, action or input answers: `stay()`, `go(screen, params?)`, `back()`, `toast(text, { alert? })` (≤ 200 characters), `notice(content, { expiresInMs? })`; `void` is `stay()`; after input there is no press, so no `toast` |
|
|
352
407
|
| `ScreenNavigation` / `ScreenToast` / `ScreenNotice` / `NoticeOptions` | _type_ | the parts of an outcome; a notice without `expiresInMs` is a receipt the screen moves below, with it a remark under the screen that removes itself |
|
|
353
|
-
| `ViewMessage` / `ScreenViewResult` / `TextViewMessage` / `RichViewMessage` / `PhotoViewMessage` / `VideoViewMessage` / `AnimationViewMessage` / `DocumentViewMessage` / `AudioViewMessage` / `ScreenMediaKind` | _type_ | one message or several; exactly one content (`text`, `rich`, or a media file id or URL with `caption`), plus `keyboard`, `key` and `linkPreview` |
|
|
408
|
+
| `ViewMessage` / `ScreenViewResult` / `TextViewMessage` / `RichViewMessage` / `RichUploadViewMessage` / `PhotoViewMessage` / `VideoViewMessage` / `AnimationViewMessage` / `DocumentViewMessage` / `AudioViewMessage` / `ScreenMediaKind` | _type_ | one message or several; exactly one content (`text`, `rich`, `richUpload`, or a media file id or URL with `caption`), plus `keyboard`, `key` and `linkPreview`; `richUpload` is `{ contentKey, build }` — `build` returns a grammY `InputRichMessage` with its files for each send or content edit |
|
|
354
409
|
| `link` / `back` / `ScreenButton` | function / class | a button to a screen with its params; a button to the parent screen |
|
|
355
410
|
| `Keyboard` / `KeyboardRow` / `KeyboardButton` / `PlainKeyboardButton` / `ButtonLabel` | _type_ | rows of screen buttons and plain Telegram buttons without `callback_data`; `false`, `null` and `undefined` are skipped; a label is text or `{ text, style?, icon_custom_emoji_id? }` |
|
|
356
411
|
| `html` / `TelegramHtml` / `HtmlTag` / `HtmlValue` / `TelegramText` | function / class / _type_ | Telegram HTML with every interpolation escaped; `html.raw()` for markup already safe, `html.join()`; a plain string is always escaped (`escapeTelegramHtml` is `stitchkit/telegram/html`'s) |
|
package/llms-full.txt
CHANGED
|
@@ -11068,6 +11068,14 @@ type, not a bound, so a bare integer prints `<integer>`, `.min(1)` prints `>=1`
|
|
|
11068
11068
|
`.positive()` prints `>0`. Unbounded fields keep just their type and description. Bounds on an array's items are not bounds
|
|
11069
11069
|
on the array itself.
|
|
11070
11070
|
|
|
11071
|
+
A string says what shape it must have, before its bounds. A format JSON Schema
|
|
11072
|
+
defines is said by name — `<string> [uuid]`, `[email]`, `[uri]`, `[date-time]` —
|
|
11073
|
+
and the expression it is checked with is not printed. Any other shape is said
|
|
11074
|
+
by its pattern between slashes, `<string> [pattern /^[a-z]+$/, length >=2]`, and
|
|
11075
|
+
by its format's name only when the schema carries no pattern. A schema that
|
|
11076
|
+
composes two patterns prints both under `all of:`, a named format among them
|
|
11077
|
+
included: there the schema no longer carries the name.
|
|
11078
|
+
|
|
11071
11079
|
Composed schemas retain their meaning: `any of:` and `one of:` separate
|
|
11072
11080
|
alternative branches with `|`, while `all of:` joins constraints with `&`.
|
|
11073
11081
|
For example, a nullable bounded string renders
|
|
@@ -17550,6 +17558,37 @@ bot.catch((error) => logger.error('update failed', { error }))
|
|
|
17550
17558
|
message is sent with `parse_mode: 'HTML'` set explicitly, so an application's
|
|
17551
17559
|
own `parse_mode` transformer changes nothing.
|
|
17552
17560
|
|
|
17561
|
+
### Uploading a rich preview
|
|
17562
|
+
|
|
17563
|
+
For a local photo, a message is `richUpload`: a `contentKey` and a `build` function. The key
|
|
17564
|
+
identifies the complete rich payload. Change it when the file bytes, text or
|
|
17565
|
+
order of blocks changes. The outer message `key` identifies the Telegram
|
|
17566
|
+
message that can be edited in place.
|
|
17567
|
+
|
|
17568
|
+
```ts
|
|
17569
|
+
import { InputFile } from 'grammy'
|
|
17570
|
+
import type { RichUploadViewMessage } from 'stitchkit/telegram/screens'
|
|
17571
|
+
|
|
17572
|
+
function preview(path: string, revision: string): RichUploadViewMessage {
|
|
17573
|
+
return {
|
|
17574
|
+
richUpload: {
|
|
17575
|
+
contentKey: revision,
|
|
17576
|
+
build: () => ({
|
|
17577
|
+
blocks: [{ type: 'photo', photo: { type: 'photo', media: new InputFile(path) } }],
|
|
17578
|
+
}),
|
|
17579
|
+
},
|
|
17580
|
+
}
|
|
17581
|
+
}
|
|
17582
|
+
```
|
|
17583
|
+
|
|
17584
|
+
`richUpload` is a content of its own, like `text` or `photo`: a message has it
|
|
17585
|
+
or `rich`, never both, and `rich` stays the Bot API's inline type. The runtime
|
|
17586
|
+
calls `build` for each send or content edit. It can return a
|
|
17587
|
+
promise. A resend needs a fresh file if its stream was consumed. A render
|
|
17588
|
+
with the same content key skips the upload, including when it edits the
|
|
17589
|
+
keyboard. Storage holds the fingerprint. For a URL or a Telegram `file_id`,
|
|
17590
|
+
pass the Bot API rich object as `rich`.
|
|
17591
|
+
|
|
17553
17592
|
## Outcomes
|
|
17554
17593
|
|
|
17555
17594
|
A load, an action and an input handler answer with an outcome, built by
|
|
@@ -17606,6 +17645,15 @@ When Telegram refuses a step:
|
|
|
17606
17645
|
renders. The next update repairs the rest. A receipt or a remark Telegram
|
|
17607
17646
|
refuses stops the update the same way, with the view already drawn recorded.
|
|
17608
17647
|
|
|
17648
|
+
If Telegram refuses the first send, the previous menu keeps its message IDs,
|
|
17649
|
+
buttons and input routing. When an edit has an uncertain result, the next
|
|
17650
|
+
render checks that message again. If repeated interrupted transitions would
|
|
17651
|
+
exceed the chat record's recovery limit, the runtime cleans up the latest
|
|
17652
|
+
failed attempt's new sends. A later press can retry the full transition.
|
|
17653
|
+
One case the record cannot hold: a send Telegram carried out but whose answer
|
|
17654
|
+
was lost has no id to record, so that message stays in the chat until the user
|
|
17655
|
+
removes it.
|
|
17656
|
+
|
|
17609
17657
|
A view is checked before anything is sent: at most 100 messages, keys of 1 to
|
|
17610
17658
|
64 characters, at most 100 buttons whose address is kept in the record. A view
|
|
17611
17659
|
past these fails in the handler's place, with the chat untouched.
|
|
@@ -17659,7 +17707,9 @@ Called from inside a handler of the same chat, it runs at once rather than
|
|
|
17659
17707
|
waiting behind the update that called it, and the screen it opened stands: the
|
|
17660
17708
|
handler may still answer the press with a toast, and returning a navigation or
|
|
17661
17709
|
a notice as well is an error — drawn after it, the handler's own outcome would
|
|
17662
|
-
put the record back on the screen the chat left.
|
|
17710
|
+
put the record back on the screen the chat left. An open that fails inside a
|
|
17711
|
+
handler rejects there: the failure is the handler's, and `onError` hears it
|
|
17712
|
+
once, with the handler's trigger.
|
|
17663
17713
|
|
|
17664
17714
|
## State and concurrency
|
|
17665
17715
|
|
|
@@ -17686,7 +17736,7 @@ refused halfway too.
|
|
|
17686
17736
|
| `callbackPrefix` | `~` | what every screen button's `callback_data` starts with |
|
|
17687
17737
|
| `chats` | `'private'` | `'all'` answers in groups too, where any member can press or type |
|
|
17688
17738
|
| `onStale(c)` | answered silently | a press nothing can answer, with its `reason`; its outcome is shown |
|
|
17689
|
-
| `onError(error, c)` | none | a load, action or
|
|
17739
|
+
| `onError(error, c)` | none | a load, action, input or display that threw. Its outcome is shown. |
|
|
17690
17740
|
| `onEvent(event)` | none | `transition`, `state-discarded`, `message-kept`, `sweep-failed` (a remark's timer could not delete it) — never message text |
|
|
17691
17741
|
| `clock` | `Date.now` | the time expiring remarks are measured by |
|
|
17692
17742
|
|
|
@@ -17695,6 +17745,19 @@ Without `onError` the press is answered silently and the error reaches
|
|
|
17695
17745
|
timers on the way down; a remark left behind is removed on the chat's next
|
|
17696
17746
|
update.
|
|
17697
17747
|
|
|
17748
|
+
A view Telegram refused is not drawn again by the report of its refusal:
|
|
17749
|
+
after a failed display `stay()` leaves the chat as its record says and only
|
|
17750
|
+
delivers the toast and the notices, so the refused request is sent once and
|
|
17751
|
+
the next press retries it. `go()` and `back()` are followed as usual. A
|
|
17752
|
+
handler that threw changed nothing in the chat, so after it `stay()` loads
|
|
17753
|
+
and draws its screen anew.
|
|
17754
|
+
|
|
17755
|
+
A press is answered before its view is drawn, so a toast for a failed display
|
|
17756
|
+
comes too late to be the answer. In a private chat it is said as a remark of
|
|
17757
|
+
the screen — escaped text under the menu that leaves with the next view sent,
|
|
17758
|
+
or after 30 seconds. In a group it is an ephemeral message only the user who
|
|
17759
|
+
pressed receives.
|
|
17760
|
+
|
|
17698
17761
|
## Security
|
|
17699
17762
|
|
|
17700
17763
|
- **A group's `load` checks access** for every screen, action and input under
|
|
@@ -17733,7 +17796,7 @@ refuse a call, `deleteByUser`, `pressData` for a forged press and
|
|
|
17733
17796
|
|
|
17734
17797
|
## Not included
|
|
17735
17798
|
|
|
17736
|
-
Reply keyboards, inline mode,
|
|
17799
|
+
Reply keyboards, inline mode, uploads for standalone media messages, showing a
|
|
17737
17800
|
screen without an update (use `screens.button` in a notification), converting
|
|
17738
17801
|
an incoming message to HTML, and a history stack.
|
|
17739
17802
|
|
|
@@ -25619,7 +25682,7 @@ the whole dependency. → ADR 0211 — [guide](../guide/telegram-screens.md)
|
|
|
25619
25682
|
| `ScreenInputKind` / `ScreenInputOptions` | _type_ | `text` `rich` `photo` `video` `animation` `document` `audio` `voice` `video_note` `sticker` `location` `contact`; `keepMessage` leaves the user's message (default: deleted before the handler) |
|
|
25620
25683
|
| `ScreenHandlerResult` / `ScreenOutcome` / `ScreenOutcomeBuilders` / `ScreenInputOutcomeBuilders` | _type_ / class | what a load, action or input answers: `stay()`, `go(screen, params?)`, `back()`, `toast(text, { alert? })` (≤ 200 characters), `notice(content, { expiresInMs? })`; `void` is `stay()`; after input there is no press, so no `toast` |
|
|
25621
25684
|
| `ScreenNavigation` / `ScreenToast` / `ScreenNotice` / `NoticeOptions` | _type_ | the parts of an outcome; a notice without `expiresInMs` is a receipt the screen moves below, with it a remark under the screen that removes itself |
|
|
25622
|
-
| `ViewMessage` / `ScreenViewResult` / `TextViewMessage` / `RichViewMessage` / `PhotoViewMessage` / `VideoViewMessage` / `AnimationViewMessage` / `DocumentViewMessage` / `AudioViewMessage` / `ScreenMediaKind` | _type_ | one message or several; exactly one content (`text`, `rich`, or a media file id or URL with `caption`), plus `keyboard`, `key` and `linkPreview` |
|
|
25685
|
+
| `ViewMessage` / `ScreenViewResult` / `TextViewMessage` / `RichViewMessage` / `RichUploadViewMessage` / `PhotoViewMessage` / `VideoViewMessage` / `AnimationViewMessage` / `DocumentViewMessage` / `AudioViewMessage` / `ScreenMediaKind` | _type_ | one message or several; exactly one content (`text`, `rich`, `richUpload`, or a media file id or URL with `caption`), plus `keyboard`, `key` and `linkPreview`; `richUpload` is `{ contentKey, build }` — `build` returns a grammY `InputRichMessage` with its files for each send or content edit |
|
|
25623
25686
|
| `link` / `back` / `ScreenButton` | function / class | a button to a screen with its params; a button to the parent screen |
|
|
25624
25687
|
| `Keyboard` / `KeyboardRow` / `KeyboardButton` / `PlainKeyboardButton` / `ButtonLabel` | _type_ | rows of screen buttons and plain Telegram buttons without `callback_data`; `false`, `null` and `undefined` are skipped; a label is text or `{ text, style?, icon_custom_emoji_id? }` |
|
|
25625
25688
|
| `html` / `TelegramHtml` / `HtmlTag` / `HtmlValue` / `TelegramText` | function / class / _type_ | Telegram HTML with every interpolation escaped; `html.raw()` for markup already safe, `html.join()`; a plain string is always escaped (`escapeTelegramHtml` is `stitchkit/telegram/html`'s) |
|
package/llms.txt
CHANGED
|
@@ -21,7 +21,7 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
|
|
|
21
21
|
- **stitchkit/tools/contract**: [llms/tools-contract.txt](llms/tools-contract.txt) 0.2 KB
|
|
22
22
|
- **stitchkit/tools/invoker**: [llms/tools-invoker.txt](llms/tools-invoker.txt) 0.2 KB
|
|
23
23
|
- **stitchkit/tools/connections**: [llms/tools-connections.txt](llms/tools-connections.txt) 4.9 KB
|
|
24
|
-
- **stitchkit/cli**: [llms/cli.txt](llms/cli.txt) 44.
|
|
24
|
+
- **stitchkit/cli**: [llms/cli.txt](llms/cli.txt) 44.6 KB → [llms/cli.2.txt](llms/cli.2.txt) 42.9 KB
|
|
25
25
|
- **stitchkit/cli/publish**: [llms/cli-publish.txt](llms/cli-publish.txt) 1.5 KB
|
|
26
26
|
- **stitchkit/remote**: [llms/remote.txt](llms/remote.txt) 1.0 KB
|
|
27
27
|
- **stitchkit/contract**: [llms/contract.txt](llms/contract.txt) 34.1 KB
|
|
@@ -49,7 +49,7 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
|
|
|
49
49
|
- **stitchkit/telegram/grammy**: [llms/telegram-grammy.txt](llms/telegram-grammy.txt) 2.3 KB
|
|
50
50
|
- **stitchkit/telegram/html**: [llms/telegram-html.txt](llms/telegram-html.txt) 2.7 KB
|
|
51
51
|
- **stitchkit/telegram/voice**: [llms/telegram-voice.txt](llms/telegram-voice.txt) 1.9 KB
|
|
52
|
-
- **stitchkit/telegram/screens**: [llms/telegram-screens.txt](llms/telegram-screens.txt)
|
|
52
|
+
- **stitchkit/telegram/screens**: [llms/telegram-screens.txt](llms/telegram-screens.txt) 23.9 KB
|
|
53
53
|
- **stitchkit/tracking**: [llms/tracking.txt](llms/tracking.txt) 22.3 KB
|
|
54
54
|
- **stitchkit/release**: [llms/release.txt](llms/release.txt) 8.9 KB
|
|
55
55
|
- **stitchkit/tracking/contract**: [llms/tracking-contract.txt](llms/tracking-contract.txt) 2.8 KB
|
package/package.json
CHANGED