stitchkit 0.124.1 → 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 +40 -0
- package/dist/browser/client-executors.d.ts.map +1 -1
- package/dist/browser/contract-stream.d.ts +7 -2
- package/dist/browser/contract-stream.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/sandbox.js +1 -1
- package/dist/entrypoints/cli/publish.js +1 -1
- package/dist/entrypoints/cli.js +2 -2
- package/dist/entrypoints/http.js +2 -2
- package/dist/entrypoints/index.js +3 -3
- package/dist/entrypoints/node.js +1 -1
- package/dist/entrypoints/process.js +1 -1
- package/dist/entrypoints/remote.js +1 -1
- package/dist/entrypoints/server.js +2 -2
- 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/testing.js +1 -1
- package/dist/entrypoints/tools/connections.js +1 -1
- package/dist/entrypoints/tools/toolkit.js +1 -1
- package/dist/entrypoints/tools.js +2 -2
- package/dist/{index-e1x6vze4.js → index-7rq5p3hk.js} +29 -1
- package/dist/{index-03qrr49d.js → index-b2sey031.js} +1 -1
- package/dist/{index-x0769xt9.js → index-btjwc7xr.js} +1 -1
- package/dist/{index-6qrspvxp.js → index-gbj964dt.js} +1 -1
- package/dist/{index-45dyex0j.js → index-m9hb9wnk.js} +1 -1
- package/dist/{index-zbzagr9k.js → index-ne4j9998.js} +16 -15
- package/dist/{index-cjbn98zt.js → index-ss67fxhj.js} +21 -3
- package/dist/{index-5efrpfmj.js → index-wxadzdb7.js} +1 -1
- package/dist/internal/stream-chunks.d.ts +10 -0
- package/dist/internal/stream-chunks.d.ts.map +1 -1
- 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/stitchkit.2.txt +6 -0
- package/llms/stitchkit.3.txt +1 -1
- package/llms/telegram-screens.txt +59 -4
- package/llms-full.txt +74 -5
- package/llms.txt +3 -3
- package/package.json +6 -6
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
DEFAULT_STREAM_LINE_BYTES,
|
|
19
19
|
createBoundedLineDecoder,
|
|
20
20
|
readBoundedUtf8Lines
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-m9hb9wnk.js";
|
|
22
22
|
import {
|
|
23
23
|
inputIsQuery
|
|
24
24
|
} from "./index-xhzq2qvj.js";
|
|
@@ -26,6 +26,9 @@ import {
|
|
|
26
26
|
ApiError2,
|
|
27
27
|
refuseLocally
|
|
28
28
|
} from "./index-kfjkb396.js";
|
|
29
|
+
import {
|
|
30
|
+
isStreamResponse
|
|
31
|
+
} from "./index-ss67fxhj.js";
|
|
29
32
|
import {
|
|
30
33
|
typedEntries,
|
|
31
34
|
isRecord,
|
|
@@ -415,17 +418,17 @@ async function* parseSSE2(source, options) {
|
|
|
415
418
|
}
|
|
416
419
|
|
|
417
420
|
// src/browser/contract-stream.ts
|
|
418
|
-
function sourceFor(
|
|
421
|
+
function sourceFor(body, descriptor) {
|
|
419
422
|
const options = {
|
|
420
423
|
maxLineBytes: descriptor.maxFrameBytes ?? DEFAULT_CONTRACT_STREAM_FRAME_BYTES2,
|
|
421
424
|
finalLine: descriptor.finalLine
|
|
422
425
|
};
|
|
423
|
-
return descriptor.format === "sse" ? parseSSE2(
|
|
426
|
+
return descriptor.format === "sse" ? parseSSE2(body, options) : parseNDJSON2(body, options);
|
|
424
427
|
}
|
|
425
|
-
async function* readContractStream(
|
|
428
|
+
async function* readContractStream(body, descriptor, abort) {
|
|
426
429
|
let ended = false;
|
|
427
430
|
let terminalSeen = descriptor.terminal === undefined;
|
|
428
|
-
const source = sourceFor(
|
|
431
|
+
const source = sourceFor(body, descriptor);
|
|
429
432
|
try {
|
|
430
433
|
for (;; ) {
|
|
431
434
|
const next = await source.next();
|
|
@@ -525,7 +528,11 @@ class OwnedContractStream {
|
|
|
525
528
|
}
|
|
526
529
|
}
|
|
527
530
|
function parseContractStream(response, descriptor, abort) {
|
|
528
|
-
|
|
531
|
+
if (!isStreamResponse(response)) {
|
|
532
|
+
abort();
|
|
533
|
+
throw new Error("Streaming endpoint did not return a Response");
|
|
534
|
+
}
|
|
535
|
+
return new OwnedContractStream(readContractStream(response.body, descriptor, abort), abort);
|
|
529
536
|
}
|
|
530
537
|
|
|
531
538
|
// src/browser/client-executors.ts
|
|
@@ -543,15 +550,9 @@ function withOutput(endpoint, result, abortStream) {
|
|
|
543
550
|
if (endpoint.rawResponse)
|
|
544
551
|
return result;
|
|
545
552
|
if ("stream" in endpoint && endpoint.stream) {
|
|
546
|
-
return result.then((value) => {
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
throw new Error("Streaming endpoint did not return a Response");
|
|
550
|
-
}
|
|
551
|
-
return parseContractStream(value, endpoint.stream, abortStream ?? (() => {
|
|
552
|
-
return;
|
|
553
|
-
}));
|
|
554
|
-
}, (error) => {
|
|
553
|
+
return result.then((value) => parseContractStream(value, endpoint.stream, abortStream ?? (() => {
|
|
554
|
+
return;
|
|
555
|
+
})), (error) => {
|
|
555
556
|
abortStream?.();
|
|
556
557
|
throw error;
|
|
557
558
|
});
|
|
@@ -2,14 +2,32 @@ import {
|
|
|
2
2
|
abortReason,
|
|
3
3
|
untilAborted
|
|
4
4
|
} from "./index-a5qr2rj6.js";
|
|
5
|
+
import {
|
|
6
|
+
isRecord
|
|
7
|
+
} from "./index-hkxgennw.js";
|
|
5
8
|
|
|
6
9
|
// src/internal/stream-chunks.ts
|
|
10
|
+
function isReadableByteStream(value) {
|
|
11
|
+
return isRecord(value) && typeof value.getReader === "function";
|
|
12
|
+
}
|
|
13
|
+
function isStreamResponse(value) {
|
|
14
|
+
return isRecord(value) && isReadableByteStream(value.body);
|
|
15
|
+
}
|
|
16
|
+
function bytesOf(source) {
|
|
17
|
+
if (isReadableByteStream(source))
|
|
18
|
+
return source;
|
|
19
|
+
if (Symbol.asyncIterator in source)
|
|
20
|
+
return source;
|
|
21
|
+
if (source.body === undefined)
|
|
22
|
+
throw new TypeError("The response has no body stream to read");
|
|
23
|
+
return source.body;
|
|
24
|
+
}
|
|
7
25
|
async function* chunksOf(source, signal) {
|
|
8
26
|
signal?.throwIfAborted();
|
|
9
|
-
const stream = source
|
|
27
|
+
const stream = bytesOf(source);
|
|
10
28
|
if (stream === null)
|
|
11
29
|
return;
|
|
12
|
-
if (stream
|
|
30
|
+
if (isReadableByteStream(stream)) {
|
|
13
31
|
const reader = stream.getReader();
|
|
14
32
|
const abort = () => {
|
|
15
33
|
if (signal)
|
|
@@ -65,4 +83,4 @@ async function* chunksOf(source, signal) {
|
|
|
65
83
|
}
|
|
66
84
|
}
|
|
67
85
|
|
|
68
|
-
export { chunksOf };
|
|
86
|
+
export { isStreamResponse, chunksOf };
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
/** Bytes a stream reader accepts: a `Response` body, a web stream, or any async byte iterable. */
|
|
2
2
|
export type StreamByteSource = Response | ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>;
|
|
3
|
+
/** A response of any fetch runtime whose body can be read as a web stream. */
|
|
4
|
+
export type StreamResponse = {
|
|
5
|
+
readonly body: ReadableStream<Uint8Array>;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Whether a value is a response with a readable body — the global `Response` or another runtime's,
|
|
9
|
+
* such as the `FetchResponse` of `expo/fetch`, which is its own class. A response without a body is
|
|
10
|
+
* not one.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isStreamResponse(value: unknown): value is StreamResponse;
|
|
3
13
|
/**
|
|
4
14
|
* Every chunk of a byte source: the chunk loop the line readers and the bounded body readers
|
|
5
15
|
* share. The source is cancelled or returned on every exit path.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream-chunks.d.ts","sourceRoot":"","sources":["../../src/internal/stream-chunks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stream-chunks.d.ts","sourceRoot":"","sources":["../../src/internal/stream-chunks.ts"],"names":[],"mappings":"AAGA,kGAAkG;AAClG,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,cAAc,CAAC,UAAU,CAAC,GAC1B,aAAa,CAAC,UAAU,CAAC,CAAC;AAE9B,8EAA8E;AAC9E,MAAM,MAAM,cAAc,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,CAAA;CAAE,CAAC;AAO3E;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAExE;AAmBD;;;;;;;;GAQG;AACH,wBAAuB,QAAQ,CAC7B,MAAM,EAAE,gBAAgB,EACxB,MAAM,CAAC,EAAE,WAAW,GACnB,cAAc,CAAC,UAAU,CAAC,CA+C5B"}
|
|
@@ -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,OAA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,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,EA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CAAC,CAAC,CAAC,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAsB,QAAQ,CAC5B,GAAG,EAAE,SAAS,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,YAAY,EACrB,SAAS,CAAC,EAAE,0BAA0B,GACrC,OAAO,CAAC,MAAM,CAAC,CAOjB;AAkCD,2EAA2E;AAC3E,wBAAsB,QAAQ,CAAC,CAAC,SAAS,OAAO,EAC9C,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,EAC1B,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,eAAe,CAAC,CAiB1B;AA4DD,wBAAsB,aAAa,CAAC,CAAC,SAAS,OAAO,EACnD,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,EAC1B,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,GACzB,OAAO,CAAC,IAAI,CAAC,CA4Gf"}
|
|
@@ -39,11 +39,19 @@ export interface ExecutedView {
|
|
|
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,IAA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;;;;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,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,6BAA6B,GAAG,SAAS,CAAC;IACzD,QAAQ,CAAC,WAAW,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,oBAAoB,GAAG,SAAS,CAAC;IAClD,QAAQ,CAAC,WAAW,EAAE,kBAAkB,CAAC;CAC1C;AAED,4EAA4E;AAC5E,MAAM,WAAW,cAAc;IAC7B,oFAAoF;IACpF,SAAS,CAAC,MAAM,E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AE,GAAG,SAAS,CAAC;IACzF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;CAC/B;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,CAAC;IAC9C,iDAAiD;IACjD,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACnD;AAED,sEAAsE;AACtE,wBAAgB,MAAM,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAEjD;AA0MD,wBAAgB,UAAU,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,aAAa,GAAG,YAAY,CA8BvF;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,cAAc,CAAC,WAAW,CAAC,GACrC,oBAAoB,CAAC,cAAc,CAmBrC"}
|
|
@@ -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,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAwB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5F,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC7F,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC3B,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE3C,gEAAgE;AAChE,MAAM,MAAM,iBAAiB,GACzB,WAAW,GACX,QAAQ,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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;CACR,CAAC;
|
|
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;CACR,CAAC;AAEF,wFAAwF;AACxF,eAAO,MAAM,oBAAoB,QAAiC,CAAC;AACnE,eAAO,MAA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C;CACrB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,YAAY;IAC3B,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,CAAC;IACjC,6CAA6C;IAC7C,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAC3B,mCAAmC;IACnC,IAAI,CAAC,EAAE,EAAE,OAAO,GAAG,aAAa,GAAG,SAAS,CAAC;IAC7C,UAAU,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC;IAC5C,sDAAsD;IACtD,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC;IAC5E,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAAC;IACrE,aAAa,IAAI,MAAM,CAAC;CACzB;AAkID,wBAAgB,kBAAkB,CAAC,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,eA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],"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
|
package/llms/stitchkit.2.txt
CHANGED
|
@@ -501,6 +501,12 @@ body until it ends or is cancelled. This is the same for a Fetch-config client,
|
|
|
501
501
|
Unix transport. Cancelling a quiet stream therefore releases its server source
|
|
502
502
|
and transport connection instead of only settling the local iterator.
|
|
503
503
|
|
|
504
|
+
A stream is read from any response whose `body` has `getReader()`, not only from
|
|
505
|
+
the global `Response` class: a `fetch` of another runtime — `expo/fetch` in
|
|
506
|
+
React Native, which answers with its own `FetchResponse` — streams the same way.
|
|
507
|
+
A response without a readable body is refused with `Streaming endpoint did not
|
|
508
|
+
return a Response`.
|
|
509
|
+
|
|
504
510
|
An established NDJSON protocol may keep its item schema as the complete wire
|
|
505
511
|
frame. This mode requires a terminal item because an unwrapped response has no
|
|
506
512
|
separate safe error/end envelope:
|
package/llms/stitchkit.3.txt
CHANGED
|
@@ -88,7 +88,7 @@ The browser-and-server entrypoint. Re-exports everything from
|
|
|
88
88
|
| `parseNDJSON` | function | parse bounded fatal-UTF-8 NDJSON from a `Response`, a `ReadableStream<Uint8Array>` or an `AsyncIterable<Uint8Array>` (a child's stdout); blank keep-alives are skipped, `finalLine: 'require-newline'` makes the delimiter mandatory and `signal` cancels the source — [guide](../guide/client.md#any-byte-source) |
|
|
89
89
|
| `createNDJSONDecoder` / `NDJSONDecoder` | function / _type_ | the same bounded NDJSON reading driven by `push(chunk)` / `end()`, for a socket `data` callback |
|
|
90
90
|
| `readBoundedBody` / `BoundedBodyOptions` | function / _type_ | the whole body of a `ReadableStream<Uint8Array>` or async byte iterable as bytes, never reading past `maxBytes` plus one chunk; `limitError(observedBytes)` and `abortError(reason)` choose the two errors, the source is cancelled on both, a `null` body is empty — [guide](../guide/client.md#reading-a-body-up-to-a-byte-limit) |
|
|
91
|
-
| `StreamByteSource` | _type_ | `Response \| ReadableStream<Uint8Array> \| AsyncIterable<Uint8Array>`, what the NDJSON and SSE readers accept |
|
|
91
|
+
| `StreamByteSource` | _type_ | `Response \| ReadableStream<Uint8Array> \| AsyncIterable<Uint8Array>`, what the NDJSON and SSE readers accept; each is recognised by its shape, not its class — a reader, `Symbol.asyncIterator`, else the response's `body` — so another runtime's fetch response (`expo/fetch`) reads like the global `Response` |
|
|
92
92
|
| `StreamLineLimitError` / `StreamTruncatedLineError` | class | a line past `maxLineBytes` (`limitBytes`, `lineBytes`; a `RangeError`) and a source ended inside a line under `require-newline` (`lineBytes`; a `SyntaxError`) |
|
|
93
93
|
| `resumableIterator` | function | re-open a long-lived stream from the last delivered cursor, with jittered backoff, a caller-owned terminal item and prompt abort — [guide](../guide/client.md#resumable-streams) |
|
|
94
94
|
| `createBackoff` | function | exponential backoff with subtractive jitter as a value: `next()` / `reset()` |
|
|
@@ -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) |
|