stitchkit 0.123.5 → 0.123.7
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 +77 -0
- package/dist/entrypoints/application/diagnostic-journal.js +1 -1
- package/dist/entrypoints/application/directory-inbox.js +3 -3
- package/dist/entrypoints/cli/publish.js +2 -2
- package/dist/entrypoints/cli.js +2 -1
- package/dist/entrypoints/files.js +2 -2
- package/dist/entrypoints/node.js +2 -2
- package/dist/entrypoints/server.js +5 -5
- package/dist/entrypoints/telegram/grammy.d.ts +1 -0
- package/dist/entrypoints/telegram/grammy.d.ts.map +1 -1
- package/dist/entrypoints/telegram/grammy.js +81 -3
- package/dist/entrypoints/telegram/screens.js +1 -1
- package/dist/entrypoints/telegram.d.ts +1 -0
- package/dist/entrypoints/telegram.d.ts.map +1 -1
- package/dist/entrypoints/telegram.js +18 -6
- package/dist/entrypoints/tools/contract.js +4 -2
- package/dist/entrypoints/tools/toolkit.js +2 -1
- package/dist/entrypoints/tools.js +33 -27
- package/dist/{index-xjb131sc.js → index-1a741dpf.js} +188 -51
- package/dist/{index-yfpt7sxr.js → index-6qrspvxp.js} +5 -3
- package/dist/index-81t0bf0f.js +18 -0
- package/dist/{index-d9cg0gen.js → index-8yky60kq.js} +1 -1
- package/dist/{index-bph35vpy.js → index-9cxxfkhb.js} +21 -1
- package/dist/index-bgj9hbm3.js +93 -0
- package/dist/index-bknzva6n.js +39 -0
- package/dist/{index-73dappvg.js → index-ezwvsqx9.js} +1 -1
- package/dist/{index-303qne11.js → index-f56ct5gb.js} +27 -4
- package/dist/{index-chz7c830.js → index-mqttte96.js} +39 -6
- package/dist/{index-eabx6qjh.js → index-tnnmekgb.js} +1 -6
- package/dist/index-zs8cze4j.js +6 -0
- package/dist/internal/exclusive-lock.d.ts.map +1 -1
- package/dist/internal/media-extension.d.ts +3 -0
- package/dist/internal/media-extension.d.ts.map +1 -0
- package/dist/telegram/send-failure.d.ts +2 -2
- package/dist/telegram/send-failure.d.ts.map +1 -1
- package/dist/telegram/widget-api.d.ts +106 -0
- package/dist/telegram/widget-api.d.ts.map +1 -0
- package/dist/telegram/widget.d.ts +121 -0
- package/dist/telegram/widget.d.ts.map +1 -0
- package/dist/tools/cli/args.d.ts +1 -1
- package/dist/tools/cli/args.d.ts.map +1 -1
- package/dist/tools/cli/command.d.ts +7 -1
- package/dist/tools/cli/command.d.ts.map +1 -1
- package/dist/tools/cli/config.d.ts +5 -2
- package/dist/tools/cli/config.d.ts.map +1 -1
- package/dist/tools/cli/download.d.ts +25 -4
- package/dist/tools/cli/download.d.ts.map +1 -1
- package/dist/tools/cli/inline-files.d.ts +70 -0
- package/dist/tools/cli/inline-files.d.ts.map +1 -0
- package/dist/tools/cli/session.d.ts.map +1 -1
- package/dist/tools/transfer/download-core.d.ts +2 -0
- package/dist/tools/transfer/download-core.d.ts.map +1 -1
- package/dist/tools/transfer/view-file-contract.d.ts +34 -4
- package/dist/tools/transfer/view-file-contract.d.ts.map +1 -1
- package/dist/tools/transfer/view-file.d.ts.map +1 -1
- package/llms/cli.txt +63 -3
- package/llms/stitchkit.txt +2 -2
- package/llms/telegram-grammy.txt +10 -3
- package/llms/telegram.2.txt +5 -0
- package/llms/telegram.txt +70 -0
- package/llms/tools.2.txt +5 -0
- package/llms-full.txt +152 -8
- package/llms.txt +6 -6
- package/package.json +1 -1
- package/dist/index-6j725ez5.js +0 -25
- package/dist/index-sba3e6m4.js +0 -52
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
|
|
19
19
|
// src/internal/exclusive-lock.ts
|
|
20
20
|
import { randomUUID } from "node:crypto";
|
|
21
|
+
import { constants as constants2 } from "node:fs";
|
|
21
22
|
import { lstat, open as open2, readdir as readdir2, unlink } from "node:fs/promises";
|
|
22
23
|
import { hostname as hostname2 } from "node:os";
|
|
23
24
|
import { dirname, join } from "node:path";
|
|
@@ -179,6 +180,7 @@ async function readLockFile(path, onFailure, signal) {
|
|
|
179
180
|
}
|
|
180
181
|
return {
|
|
181
182
|
path,
|
|
183
|
+
record: record.text,
|
|
182
184
|
...readOwner(record.text),
|
|
183
185
|
ino: record.info.ino,
|
|
184
186
|
dev: record.info.dev,
|
|
@@ -288,6 +290,38 @@ async function createOwned(path, options, reclaimed) {
|
|
|
288
290
|
}
|
|
289
291
|
};
|
|
290
292
|
}
|
|
293
|
+
async function removeJudgedLock(state) {
|
|
294
|
+
const pin = await open2(state.path, constants2.O_RDONLY | constants2.O_NOFOLLOW | constants2.O_NONBLOCK).catch((error) => {
|
|
295
|
+
if (isCode(error, "ENOENT"))
|
|
296
|
+
return null;
|
|
297
|
+
throw error;
|
|
298
|
+
});
|
|
299
|
+
if (!pin)
|
|
300
|
+
return "absent";
|
|
301
|
+
try {
|
|
302
|
+
const pinned = await pin.stat();
|
|
303
|
+
if (pinned.ino !== state.ino || pinned.dev !== state.dev)
|
|
304
|
+
return "changed";
|
|
305
|
+
const current = await readLockRecord(state.path, {
|
|
306
|
+
singleLink: state.stagedName === undefined
|
|
307
|
+
}).catch((error) => {
|
|
308
|
+
if (error instanceof LockRecordError || isCode(error, "ENOENT"))
|
|
309
|
+
return null;
|
|
310
|
+
throw error;
|
|
311
|
+
});
|
|
312
|
+
if (current?.info.ino !== state.ino || current.info.dev !== state.dev || current.text !== state.record)
|
|
313
|
+
return "changed";
|
|
314
|
+
if (state.stagedName !== undefined)
|
|
315
|
+
await unlink(state.stagedName).catch((error) => {
|
|
316
|
+
if (!isCode(error, "ENOENT"))
|
|
317
|
+
throw error;
|
|
318
|
+
});
|
|
319
|
+
await unlinkIfSame(state.path, state.ino, state.dev);
|
|
320
|
+
return "removed";
|
|
321
|
+
} finally {
|
|
322
|
+
await pin.close();
|
|
323
|
+
}
|
|
324
|
+
}
|
|
291
325
|
function reclaimable(state, diagnosis, graceMs) {
|
|
292
326
|
if (state.owner)
|
|
293
327
|
return diagnosis.liveness === "gone";
|
|
@@ -327,12 +361,11 @@ async function reclaimUnderGuard(path, options, depth) {
|
|
|
327
361
|
return { refused: true };
|
|
328
362
|
if (!reclaimable(state, diagnosis, options.ownerlessGraceMs))
|
|
329
363
|
return { refused: true, cause: diagnosis.cause };
|
|
330
|
-
if (state
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
}
|
|
335
|
-
await unlinkIfSame(path, state.ino, state.dev);
|
|
364
|
+
if (await removeJudgedLock(state) === "changed")
|
|
365
|
+
return {
|
|
366
|
+
refused: true,
|
|
367
|
+
cause: new LockRecordError("LOCK_RECORD_CHANGED", "The judged lock was replaced before it could be reclaimed")
|
|
368
|
+
};
|
|
336
369
|
}
|
|
337
370
|
await sweepStagedLocks(dirname(path), options.machineIdentity, options.signal);
|
|
338
371
|
return await createOwned(path, options, state !== undefined).catch((error) => {
|
|
@@ -129,9 +129,4 @@ function createScopedImplement2() {
|
|
|
129
129
|
return Object.assign(implementScoped, { stream, declare });
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
|
|
133
|
-
function mediaTypeEssence(contentType) {
|
|
134
|
-
return (contentType ?? "").split(";", 1)[0]?.trim().toLowerCase() ?? "";
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export { defineMultipartStream2, createMultipartStream2, contractOnlyService, bindContract, implement2, createImplement2, createScopedImplement2, mediaTypeEssence };
|
|
132
|
+
export { defineMultipartStream2, createMultipartStream2, contractOnlyService, bindContract, implement2, createImplement2, createScopedImplement2 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exclusive-lock.d.ts","sourceRoot":"","sources":["../../src/internal/exclusive-lock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"exclusive-lock.d.ts","sourceRoot":"","sources":["../../src/internal/exclusive-lock.ts"],"names":[],"mappings":"AA8BA,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EAGxB,MAAM,wBAAwB,CAAC;AAMhC,iCAAiC;AACjC,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC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,GAAG,MAAM,GAAG,SAAS,CAEtE"}
|
|
@@ -96,8 +96,8 @@ export declare function classifyTelegramSendFailure(error: unknown): TelegramSen
|
|
|
96
96
|
* - `other`: everything else, including a malformed payload — the caller's to
|
|
97
97
|
* raise.
|
|
98
98
|
*
|
|
99
|
-
* Internal to the screens: it reads Telegram's prose the
|
|
100
|
-
* {@link classifyTelegramSendFailure} does and is not a public vocabulary.
|
|
99
|
+
* Internal to the screens and the widget edit: it reads Telegram's prose the
|
|
100
|
+
* same way {@link classifyTelegramSendFailure} does and is not a public vocabulary.
|
|
101
101
|
*/
|
|
102
102
|
export type TelegramEditRefusal = 'not-modified' | 'message-gone' | 'message-locked' | 'query-expired' | 'other';
|
|
103
103
|
export declare function classifyTelegramEditRefusal(error: unknown): TelegramEditRefusal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send-failure.d.ts","sourceRoot":"","sources":["../../src/telegram/send-failure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAKH;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,yBAAyB,GACjC,iBAAiB,GACjB,kBAAkB,GAClB,gBAAgB,GAChB,aAAa,GACb,qBAAqB,GACrB,cAAc,GACd,iBAAiB,GACjB,cAAc,GACd,gBAAgB,GAChB,SAAS,CAAC;AAEd,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,yBAAyB,CAAC;IAClC,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,wDAAwD;IACxD,SAAS,EAAE,OAAO,CAAC;IACnB;;;;;;;;OAQG;IACH,oBAAoB,EAAE,OAAO,CAAC;IAC9B;;;;;OAKG;IACH,QAAQ,EAAE,YAAY,GAAG,QAAQ,GAAG,aAAa,GAAG,WAAW,GAAG,MAAM,CAAC;CAC1E;AAoDD;;;;GAIG;AACH,eAAO,MAAM,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d,cAAc,GACd,gBAAgB,GAChB,eAAe,GACf,OAAO,CAAC;AAeZ,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,CAQ/E"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The three Bot API 10.4 widget methods over a grammY client the bot already has.
|
|
3
|
+
*
|
|
4
|
+
* grammY 1.46 does not type `sendWidget`, `editMessageWidgetData` or
|
|
5
|
+
* `answerWidgetQuery`, and a bot that reaches for them builds a second client
|
|
6
|
+
* or a second token reader, and with it a second limiter. `api.raw` needs none:
|
|
7
|
+
* grammY's proxy sends any method name through the client's own transformers —
|
|
8
|
+
* the outbound budget, a sandbox, error capture — so a widget send waits for
|
|
9
|
+
* the same slot as every other message of the token and an answer, which costs
|
|
10
|
+
* no message, does not.
|
|
11
|
+
*
|
|
12
|
+
* The methods keep the Bot API's names and parameters, so the call reads as the
|
|
13
|
+
* grammY call it will become once grammY types it, and a new Telegram parameter
|
|
14
|
+
* needs no second name here. Each call:
|
|
15
|
+
*
|
|
16
|
+
* 1. checks its input against Telegram's limits and throws `ZodError` — nothing
|
|
17
|
+
* was sent, and the same input will be refused again;
|
|
18
|
+
* 2. throws `TelegramNotDispatchedError` when the signal is already aborted —
|
|
19
|
+
* nothing was sent, and it is safe to send again;
|
|
20
|
+
* 3. hands the request to the client once. It never repeats it: a failure after
|
|
21
|
+
* this point may have been delivered, and a send whose outcome is unknown is
|
|
22
|
+
* the caller's to settle;
|
|
23
|
+
* 4. parses Telegram's answer. An unexpected successful answer is an ordinary
|
|
24
|
+
* error with the parse failure as its `cause` — the request was sent.
|
|
25
|
+
*
|
|
26
|
+
* grammY is named in the declarations and never imported at run time.
|
|
27
|
+
*/
|
|
28
|
+
import type { Api, RawApi } from 'grammy';
|
|
29
|
+
import type { ForceReply, InlineKeyboardMarkup, MessageEntity, ParseMode, ReplyKeyboardMarkup, ReplyKeyboardRemove, ReplyParameters } from 'grammy/types';
|
|
30
|
+
import { type TelegramWidgetMessage } from './widget.js';
|
|
31
|
+
/** `sendWidget` parameters, as the Bot API names them. */
|
|
32
|
+
export interface TelegramSendWidgetParams {
|
|
33
|
+
readonly chat_id: number | string;
|
|
34
|
+
/** The forum topic, for forum supergroups and private chats with topics. */
|
|
35
|
+
readonly message_thread_id?: number;
|
|
36
|
+
/** 1–32768 UTF-8 bytes, at most 4096 once compressed by zlib level 9. */
|
|
37
|
+
readonly html: string;
|
|
38
|
+
/** Logical pixels; omitted, the widget takes the bubble's width. */
|
|
39
|
+
readonly width?: number;
|
|
40
|
+
/** Logical pixels; omitted, the height is not fixed. */
|
|
41
|
+
readonly height?: number;
|
|
42
|
+
/** 0–1024 UTF-8 bytes, visible wherever the widget is shown. */
|
|
43
|
+
readonly public_data?: string;
|
|
44
|
+
/** 0–1024 UTF-8 bytes, specific to this message. */
|
|
45
|
+
readonly chat_data?: string;
|
|
46
|
+
/** Shown by an app that cannot draw the widget too; 0–1024 characters. */
|
|
47
|
+
readonly caption?: string;
|
|
48
|
+
readonly parse_mode?: ParseMode;
|
|
49
|
+
readonly caption_entities?: readonly MessageEntity[];
|
|
50
|
+
readonly show_caption_above_media?: boolean;
|
|
51
|
+
/** Let the widget send queries to the bot. */
|
|
52
|
+
readonly allow_queries?: boolean;
|
|
53
|
+
readonly disable_notification?: boolean;
|
|
54
|
+
readonly protect_content?: boolean;
|
|
55
|
+
readonly allow_paid_broadcast?: boolean;
|
|
56
|
+
readonly message_effect_id?: string;
|
|
57
|
+
readonly reply_parameters?: ReplyParameters;
|
|
58
|
+
readonly reply_markup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* `editMessageWidgetData` parameters, as the Bot API names them: a chat message
|
|
62
|
+
* (`chat_id` with `message_id`) or an inline one, and the data that changes —
|
|
63
|
+
* an empty string removes it, an omitted field keeps it.
|
|
64
|
+
*/
|
|
65
|
+
export type TelegramEditMessageWidgetDataParams = ({
|
|
66
|
+
readonly chat_id: number | string;
|
|
67
|
+
readonly message_id: number;
|
|
68
|
+
readonly inline_message_id?: never;
|
|
69
|
+
} | {
|
|
70
|
+
readonly inline_message_id: string;
|
|
71
|
+
readonly chat_id?: never;
|
|
72
|
+
readonly message_id?: never;
|
|
73
|
+
}) & ({
|
|
74
|
+
readonly chat_data: string;
|
|
75
|
+
readonly public_data?: string;
|
|
76
|
+
} | {
|
|
77
|
+
readonly public_data: string;
|
|
78
|
+
readonly chat_data?: string;
|
|
79
|
+
});
|
|
80
|
+
/** `answerWidgetQuery` parameters, as the Bot API names them. */
|
|
81
|
+
export interface TelegramAnswerWidgetQueryParams {
|
|
82
|
+
readonly widget_query_id: string;
|
|
83
|
+
/** 0–1024 UTF-8 bytes; the widget that asked receives it, its data does not change. */
|
|
84
|
+
readonly data?: string;
|
|
85
|
+
}
|
|
86
|
+
/** Per-call options of {@link TelegramWidgetApi}. */
|
|
87
|
+
export interface TelegramWidgetCallOptions {
|
|
88
|
+
/** Cancels the call; before the request leaves, it fails as not dispatched. */
|
|
89
|
+
readonly signal?: AbortSignal;
|
|
90
|
+
}
|
|
91
|
+
/** The widget methods of one grammY client. */
|
|
92
|
+
export interface TelegramWidgetApi {
|
|
93
|
+
/** Send a widget message. Resolves to the sent message with its widget. */
|
|
94
|
+
sendWidget(params: TelegramSendWidgetParams, options?: TelegramWidgetCallOptions): Promise<TelegramWidgetMessage>;
|
|
95
|
+
/** Change a widget's data. Data already as asked (`message is not modified`) is success. */
|
|
96
|
+
editMessageWidgetData(params: TelegramEditMessageWidgetDataParams, options?: TelegramWidgetCallOptions): Promise<void>;
|
|
97
|
+
/** Answer a widget query; costs no message and waits for no outbound budget. */
|
|
98
|
+
answerWidgetQuery(params: TelegramAnswerWidgetQueryParams, options?: TelegramWidgetCallOptions): Promise<void>;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The widget methods of `api`, run through its transformers: install
|
|
102
|
+
* `telegramBudgetTransformer` on the client and widget sends share the token's
|
|
103
|
+
* budget.
|
|
104
|
+
*/
|
|
105
|
+
export declare function telegramWidgetApi(api: Pick<Api<RawApi>, 'raw'>): TelegramWidgetApi;
|
|
106
|
+
//# sourceMappingURL=widget-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget-api.d.ts","sourceRoot":"","sources":["../../src/telegram/widget-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,KAAK,EACV,UAAU,EACV,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EAChB,MAAM,cAAc,CAAC;AAItB,OAAO,EAGL,KAAK,qBAAqB,EAE3B,MAAM,UAAU,CAAC;AAElB,0DAA0D;AAC1D,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IAClC,4EAA4E;IAC5E,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,yEAAyE;IACzE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oEAAoE;IACpE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,wDAAwD;IACxD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,gEAAgE;IAChE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,oDAAoD;IACpD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,0EAA0E;IAC1E,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,CAAC;IAChC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,aAAa,E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CACxB;AAED,qDAAqD;AACrD,MAAM,WAAW,yBAAyB;IACxC,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED,+CAA+C;AAC/C,MAAM,WAAW,iBAAiB;IAChC,2EAA2E;IAC3E,UAAU,CACR,MAAM,EAAE,wBAAwB,EAChC,OAAO,CAAC,EAAE,yBAAyB,GAClC,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAClC,4FAA4F;IAC5F,qBAAqB,CACnB,MAAM,EAAE,mCAAmC,EAC3C,OAAO,CAAC,EAAE,yBAAyB,GAClC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,gFAAgF;IAChF,iBAAiB,CACf,MAAM,EAAE,+BAA+B,EACvC,OAAO,CAAC,EAAE,yBAAyB,GAClC,OAAO,CAAC,IAAI,CAAC,CAAC;CAClB;AA4ED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,iBAAiB,CA2BlF"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Telegram widgets (Bot API 10.4): the limits a widget message must keep and
|
|
3
|
+
* the shapes Telegram sends back, for both sides of a bot.
|
|
4
|
+
*
|
|
5
|
+
* A widget is HTML that the Telegram app runs and draws inside a message. Every
|
|
6
|
+
* limit is counted in UTF-8 bytes, not in JavaScript characters, so a string
|
|
7
|
+
* that looks short in an editor can still be refused: one emoji is four bytes,
|
|
8
|
+
* one Cyrillic letter two. The schemas here check a value before any request,
|
|
9
|
+
* so a refusal names its field and size instead of coming back as a 400.
|
|
10
|
+
*
|
|
11
|
+
* What Telegram sends is parsed loosely: only the fields used here are checked,
|
|
12
|
+
* and the rest pass through, because every Bot API release adds fields to a
|
|
13
|
+
* message, a user and a chat, and a strict parse of a successful send would
|
|
14
|
+
* turn a delivered widget into an unknown outcome.
|
|
15
|
+
*/
|
|
16
|
+
import { z } from 'zod';
|
|
17
|
+
/** The widget limits Telegram states, in UTF-8 bytes unless named otherwise. */
|
|
18
|
+
export declare const TELEGRAM_WIDGET_LIMITS: Readonly<{
|
|
19
|
+
/** Widget HTML, 1 to 32768 bytes. */
|
|
20
|
+
htmlBytes: 32768;
|
|
21
|
+
/** Widget HTML after zlib at the maximum compression level. */
|
|
22
|
+
compressedHtmlBytes: 4096;
|
|
23
|
+
/** `chat_data`, `public_data` and a query answer, 0 to 1024 bytes each. */
|
|
24
|
+
dataBytes: 1024;
|
|
25
|
+
/** The data a widget sends with a query, 1 to 64 bytes. */
|
|
26
|
+
queryDataBytes: 64;
|
|
27
|
+
/** How long Telegram waits for the answer to a widget query. */
|
|
28
|
+
answerWindowMs: 15000;
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
* Widget HTML: 1–32768 UTF-8 bytes, no NUL, and at most 4096 once compressed by
|
|
32
|
+
* this runtime's zlib at level 9 — an estimate of Telegram's, so keep a margin.
|
|
33
|
+
*/
|
|
34
|
+
export declare const TelegramWidgetHtmlSchema: z.ZodString;
|
|
35
|
+
/** `chat_data`, `public_data` or a query answer: 0–1024 UTF-8 bytes, no NUL. */
|
|
36
|
+
export declare const TelegramWidgetDataSchema: z.ZodString;
|
|
37
|
+
/**
|
|
38
|
+
* Telegram's widget message: the sent `Message` with its `widget`. Only the
|
|
39
|
+
* fields a sender needs are checked — where the message is and what it holds.
|
|
40
|
+
*/
|
|
41
|
+
export declare const TelegramWidgetMessageSchema: z.ZodObject<{
|
|
42
|
+
message_id: z.ZodInt;
|
|
43
|
+
chat: z.ZodObject<{
|
|
44
|
+
id: z.ZodInt;
|
|
45
|
+
type: z.ZodString;
|
|
46
|
+
}, z.core.$loose>;
|
|
47
|
+
widget: z.ZodObject<{
|
|
48
|
+
html: z.ZodString;
|
|
49
|
+
id: z.ZodOptional<z.ZodString>;
|
|
50
|
+
width: z.ZodOptional<z.ZodInt>;
|
|
51
|
+
height: z.ZodOptional<z.ZodInt>;
|
|
52
|
+
public_data: z.ZodOptional<z.ZodString>;
|
|
53
|
+
chat_data: z.ZodOptional<z.ZodString>;
|
|
54
|
+
}, z.core.$loose>;
|
|
55
|
+
}, z.core.$loose>;
|
|
56
|
+
/** A sent widget message as Telegram returns it; fields not checked here pass through. */
|
|
57
|
+
export type TelegramWidgetMessage = z.infer<typeof TelegramWidgetMessageSchema>;
|
|
58
|
+
/**
|
|
59
|
+
* `Update.widget_query`: a query from a widget in a message the bot sent. The
|
|
60
|
+
* message is `chat` with `message_id`, or `inline_message_id` for an inline
|
|
61
|
+
* one; `from` is filled in by Telegram. `type` is one of the three kinds the
|
|
62
|
+
* Bot API documents; a kind it adds later fails this schema, and
|
|
63
|
+
* {@link parseTelegramWidgetQuery} still returns the query's id so it can be
|
|
64
|
+
* refused instead of left to time out.
|
|
65
|
+
*/
|
|
66
|
+
export declare const TelegramWidgetQuerySchema: z.ZodObject<{
|
|
67
|
+
id: z.ZodString;
|
|
68
|
+
from: z.ZodObject<{
|
|
69
|
+
id: z.ZodInt;
|
|
70
|
+
}, z.core.$loose>;
|
|
71
|
+
chat: z.ZodOptional<z.ZodObject<{
|
|
72
|
+
id: z.ZodInt;
|
|
73
|
+
type: z.ZodString;
|
|
74
|
+
}, z.core.$loose>>;
|
|
75
|
+
message_id: z.ZodOptional<z.ZodInt>;
|
|
76
|
+
inline_message_id: z.ZodOptional<z.ZodString>;
|
|
77
|
+
chat_instance: z.ZodString;
|
|
78
|
+
chat_type: z.ZodOptional<z.ZodString>;
|
|
79
|
+
type: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
80
|
+
type: z.ZodLiteral<"data">;
|
|
81
|
+
wallet_card: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
82
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
83
|
+
type: z.ZodLiteral<"sign_data">;
|
|
84
|
+
wallet: z.ZodObject<{
|
|
85
|
+
address: z.ZodString;
|
|
86
|
+
amount: z.ZodString;
|
|
87
|
+
public_key: z.ZodOptional<z.ZodString>;
|
|
88
|
+
state_init: z.ZodOptional<z.ZodString>;
|
|
89
|
+
}, z.core.$loose>;
|
|
90
|
+
sign_data: z.ZodString;
|
|
91
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
92
|
+
type: z.ZodLiteral<"sent_transaction">;
|
|
93
|
+
wallet: z.ZodObject<{
|
|
94
|
+
address: z.ZodString;
|
|
95
|
+
amount: z.ZodString;
|
|
96
|
+
public_key: z.ZodOptional<z.ZodString>;
|
|
97
|
+
state_init: z.ZodOptional<z.ZodString>;
|
|
98
|
+
}, z.core.$loose>;
|
|
99
|
+
msg_hash: z.ZodString;
|
|
100
|
+
}, z.core.$loose>], "type">;
|
|
101
|
+
data: z.ZodString;
|
|
102
|
+
widget_id: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, z.core.$loose>;
|
|
104
|
+
/** One widget query, as `TelegramWidgetQuerySchema` reads it. */
|
|
105
|
+
export type TelegramWidgetQuery = z.infer<typeof TelegramWidgetQuerySchema>;
|
|
106
|
+
/**
|
|
107
|
+
* A parsed widget query, or the id of one that did not parse together with why.
|
|
108
|
+
* The id is enough to answer: an unparsed query still gets a refusal.
|
|
109
|
+
*/
|
|
110
|
+
export type TelegramWidgetQueryParse = {
|
|
111
|
+
readonly query: TelegramWidgetQuery;
|
|
112
|
+
} | {
|
|
113
|
+
readonly id: string;
|
|
114
|
+
readonly error: z.ZodError;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Read `update.widget_query`. Returns the query, the id and parse error of one
|
|
118
|
+
* that does not match, or `undefined` when there is no query id to answer.
|
|
119
|
+
*/
|
|
120
|
+
export declare function parseTelegramWidgetQuery(value: unknown): TelegramWidgetQueryParse | undefined;
|
|
121
|
+
//# sourceMappingURL=widget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../../src/telegram/widget.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,gFAAgF;AAChF,eAAO,MAAM,sBAAsB;IACjC,qCAAqC;;IAErC,+DAA+D;;IAE/D,2EAA2E;;IAE3E,2DAA2D;;IAE3D,gEAAgE;;EAEhE,CAAC;AA6CH;;;GAGG;AACH,eAAO,MAAM,wBAAwB,aAA0B,CAAC;AAEhE,gFAAgF;AAChF,eAAO,MAAM,wBAAwB,aAEpC,CAAC;AAeF;;;GAGG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;iBAYtC,CAAC;AACH,0FAA0F;AAC1F,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAyBpC,CAAC;AACH,iEAAiE;AACjE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAChC;IAAE,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAA;CAAE,GACvC;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAA;CAAE,CAAC;AAExD;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,OAAO,GACb,wBAAwB,GAAG,SAAS,CAMtC"}
|
package/dist/tools/cli/args.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export interface CliRunOptions {
|
|
|
27
27
|
wait: boolean;
|
|
28
28
|
/** `--wait-timeout <seconds>` — override the poll timeout. */
|
|
29
29
|
waitTimeout?: number;
|
|
30
|
-
/** `--output-dir <dir>` —
|
|
30
|
+
/** `--output-dir <dir>` — save the files a result names or carries into this directory. */
|
|
31
31
|
outputDir?: string;
|
|
32
32
|
/** `--quiet` — suppress non-essential stderr chatter. */
|
|
33
33
|
quiet: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/args.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,OAAO,EAAE,KAAK,aAAa,EAAkB,MAAM,aAAa,CAAC;AAMjE,yEAAyE;AACzE,MAAM,WAAW,aAAa;IAC5B,sEAAsE;IACtE,IAAI,EAAE,OAAO,CAAC;IACd,iEAAiE;IACjE,IAAI,EAAE,OAAO,CAAC;IACd,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,
|
|
1
|
+
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/args.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,OAAO,EAAE,KAAK,aAAa,EAAkB,MAAM,aAAa,CAAC;AAMjE,yEAAyE;AACzE,MAAM,WAAW,aAAa;IAC5B,sEAAsE;IACtE,IAAI,EAAE,OAAO,CAAC;IACd,iEAAiE;IACjE,IAAI,EAAE,OAAO,CAAC;IACd,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2FAA2F;IAC3F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,KAAK,EAAE,OAAO,CAAC;IACf,qEAAqE;IACrE,MAAM,EAAE,OAAO,CAAC;IAChB,qDAAqD;IACrD,IAAI,EAAE,OAAO,CAAC;IACd,0FAA0F;IAC1F,IAAI,CAAC,EAAE,aAAa,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,+BAA+B;IAC/B,OAAO,EAAE,aAAa,CAAC;CACxB;AAwHD;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE,CAAC,CAAC,OAAO,GAAG,SAAS,EAC7B,MAAM,GAAE;IACN,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,aAAa,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5B,GACL,aAAa,CAsBf;AAED,iFAAiF;AACjF,MAAM,WAAW,qBAAqB;IACpC,0EAA0E;IAC1E,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AASD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,MAAM,EAAE,CAAC,CAAC,SAAS,GAAG,SAAS,GAC9B,qBAAqB,CAyDvB"}
|
|
@@ -82,10 +82,16 @@ export declare function cliCommandResultPolicy(definition: CliCommandDefinition)
|
|
|
82
82
|
* The single place a policy meets the terminal: a native command and a managed
|
|
83
83
|
* one answer through it, so `present`, `exitCode` and a failed presentation
|
|
84
84
|
* behave identically on both.
|
|
85
|
+
*
|
|
86
|
+
* The policy judges `result`, the operation's own answer. `shown` is what stdout
|
|
87
|
+
* prints when the policy brings no presenter: the same answer, unless the caller
|
|
88
|
+
* has already moved part of it elsewhere (a view, media saved to files).
|
|
85
89
|
*/
|
|
86
90
|
export declare function emitCliCommandResult(policy: CliResultPolicy<unknown> | undefined, result: ToolResult, options: Readonly<CliRunOptions>, writers: CliWriters, emit: EmitOptions & {
|
|
87
91
|
repeatable: boolean;
|
|
88
|
-
}
|
|
92
|
+
}, shown?: Extract<ToolResult, {
|
|
93
|
+
ok: true;
|
|
94
|
+
}>): number;
|
|
89
95
|
export declare function cliCommandPresentationSchema(definition: CliCommandDefinition): Record<string, unknown>;
|
|
90
96
|
/** Execute a CLI-only definition without inventing a tool operation identity. */
|
|
91
97
|
export declare function executeCliCommand(definition: CliCommandDefinition, rawArgs: Record<string, unknown>, options: CliRunOptions, writers: CliWriters, coerceJson: boolean, globals?: Readonly<Record<string, unknown>>): Promise<ToolResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGjD,OAAO,EAAoB,KAAK,UAAU,EAAuB,MAAM,mBAAmB,CAAC;AAG3F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EACL,KAAK,UAAU,EACf,KAAK,WAAW,EAGjB,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,iBAAiB,CAAC,MAAM,SAAS,SAAS,CAAE,SAAQ,UAAU;IAC7E,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACxB,OAAO,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC;IACjC;;;;;OAKG;IACH,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,wBAAwB,CAAC,MAAM,SAAS,SAAS;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe,CAAC,OAAO;IAItC,0FAA0F;IAC1F,OAAO,CAAC,CAAC,OAAO,EAAE;Q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AUG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,eAAe,CAAC,OAAO,CAAC,GAAG,SAAS,EAC5C,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,QAAQ,CAAC,aAAa,CAAC,EAChC,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,WAAW,GAAG;IAAE,UAAU,EAAE,OAAO,CAAA;CAAE,EAC3C,KAAK,CAAC,EAAE,OAAO,CAAC,UAAU,EAAE;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,CAAC,GACxC,MAAM,CAaR;AAED,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,oBAAoB,GAC/B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAKzB;AAED,iFAAiF;AACjF,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,oBAAoB,EAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,UAAU,EACnB,UAAU,EAAE,OAAO,EACnB,OAAO,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM,GAC9C,OAAO,CAAC,UAAU,CAAC,CAoCrB"}
|
|
@@ -59,7 +59,7 @@ export interface CliConfig<TAuth = unknown, TContext extends Record<string, unkn
|
|
|
59
59
|
passthrough?: Record<string, string>;
|
|
60
60
|
/** Per-command `--wait` polling behaviour, keyed by command name. */
|
|
61
61
|
wait?: Record<string, CliWaitConfig>;
|
|
62
|
-
/**
|
|
62
|
+
/** Name a result's URL files for `--output-dir`; files inline in `content` need no callback. */
|
|
63
63
|
download?: (result: unknown) => Array<{
|
|
64
64
|
url: string;
|
|
65
65
|
name: string;
|
|
@@ -69,7 +69,10 @@ export interface CliConfig<TAuth = unknown, TContext extends Record<string, unkn
|
|
|
69
69
|
* Default `false` — the SSRF guard, since the URLs come from handler output.
|
|
70
70
|
*/
|
|
71
71
|
allowPrivateDownloadHosts?: boolean;
|
|
72
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* Byte cap per URL or inline file of `--output-dir`. A positive safe
|
|
74
|
+
* integer, checked when the CLI is created. Default 100 MB.
|
|
75
|
+
*/
|
|
73
76
|
maxDownloadBytes?: number;
|
|
74
77
|
/**
|
|
75
78
|
* Deadline for producing response headers per `--output-dir` download (DNS,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE5C,MAAM,WAAW,SAAS,CACxB,KAAK,GAAG,OAAO,EACf,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClE,QAAQ,SAAS,SAAS,GAAG,SAAS,CACtC,SAAQ,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC;IACnD,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9B;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IACtE;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,QAAQ,CAAC;IACzB;;;OAGG;IACH,OAAO,CA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AC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,oEAAoE;IACpE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,oEAAoE;IACpE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,gEAAgE;IAChE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CACtC"}
|
|
@@ -1,8 +1,29 @@
|
|
|
1
|
-
/** Default
|
|
1
|
+
/** Default decoded byte cap per file — overridable via `maxDownloadBytes`. */
|
|
2
2
|
export declare const DEFAULT_DOWNLOAD_MAX_BYTES: number;
|
|
3
|
-
|
|
4
|
-
export declare function downloadResults(files: Array<{
|
|
3
|
+
interface UrlMedia {
|
|
5
4
|
url: string;
|
|
6
5
|
name: string;
|
|
7
|
-
}
|
|
6
|
+
}
|
|
7
|
+
export interface SaveResultMediaOptions {
|
|
8
|
+
/** `--output-dir` as typed; resolved and pinned once for the whole batch. */
|
|
9
|
+
dir: string;
|
|
10
|
+
/** The application's `download` callback: the URL media a result names. */
|
|
11
|
+
download: ((result: unknown) => UrlMedia[]) | undefined;
|
|
12
|
+
allowPrivateHosts: boolean;
|
|
13
|
+
maxBytes: number;
|
|
14
|
+
timeoutMs: number | undefined;
|
|
15
|
+
quiet: boolean;
|
|
16
|
+
stderr: (text: string) => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* `--output-dir`: save the URL files a successful result names and the files its `content`
|
|
20
|
+
* carries inline as one batch, reporting each outcome to stderr. `ok` is false when any file
|
|
21
|
+
* failed. `data` is the result as stdout prints it: a saved inline block is a link to its
|
|
22
|
+
* file, everything else is as it was.
|
|
23
|
+
*/
|
|
24
|
+
export declare function saveResultMedia(data: unknown, options: SaveResultMediaOptions): Promise<{
|
|
25
|
+
ok: boolean;
|
|
26
|
+
data: unknown;
|
|
27
|
+
}>;
|
|
28
|
+
export {};
|
|
8
29
|
//# sourceMappingURL=download.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/download.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/download.ts"],"names":[],"mappings":"AAeA,8EAA8E;AAC9E,eAAO,MAAM,0BAA0B,QAAoB,CAAC;AAE5D,UAAU,QAAQ;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAWD,MAAM,WAAW,sBAAsB;IACrC,6EAA6E;IAC7E,GAAG,EAAE,MAAM,CAAC;IACZ,2EAA2E;IAC3E,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,OAAO,KAAK,QAAQ,EAAE,CAAC,GAAG,SAAS,CAAC;IACxD,iBAAiB,EAAE,OAAO,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAYzC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const InlineFileSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3
|
+
data: z.ZodString;
|
|
4
|
+
mimeType: z.ZodString;
|
|
5
|
+
name: z.ZodOptional<z.ZodString>;
|
|
6
|
+
annotations: z.ZodOptional<z.ZodObject<{
|
|
7
|
+
audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
8
|
+
assistant: "assistant";
|
|
9
|
+
user: "user";
|
|
10
|
+
}>>>;
|
|
11
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
}, z.core.$strip>>;
|
|
13
|
+
type: z.ZodLiteral<"image">;
|
|
14
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
15
|
+
data: z.ZodString;
|
|
16
|
+
mimeType: z.ZodString;
|
|
17
|
+
name: z.ZodOptional<z.ZodString>;
|
|
18
|
+
annotations: z.ZodOptional<z.ZodObject<{
|
|
19
|
+
audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
20
|
+
assistant: "assistant";
|
|
21
|
+
user: "user";
|
|
22
|
+
}>>>;
|
|
23
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
}, z.core.$strip>>;
|
|
25
|
+
type: z.ZodLiteral<"audio">;
|
|
26
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
27
|
+
type: z.ZodLiteral<"resource">;
|
|
28
|
+
resource: z.ZodUnion<readonly [z.ZodObject<{
|
|
29
|
+
uri: z.ZodString;
|
|
30
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
31
|
+
blob: z.ZodString;
|
|
32
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
33
|
+
uri: z.ZodString;
|
|
34
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
35
|
+
text: z.ZodString;
|
|
36
|
+
}, z.core.$strip>]>;
|
|
37
|
+
}, z.core.$strip>], "type">;
|
|
38
|
+
type InlineFile = z.infer<typeof InlineFileSchema>;
|
|
39
|
+
/** One block of a result that carries a file, and its position in the result's `content`. */
|
|
40
|
+
export interface InlineFileBlock {
|
|
41
|
+
index: number;
|
|
42
|
+
file: InlineFile;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The blocks in a result's top-level `content` that carry a file: an `image` or `audio`
|
|
46
|
+
* block of the media schema, or an embedded `resource` of any type. A part of any other
|
|
47
|
+
* shape — a rich-text node that also calls itself `image` — is the result's own data and
|
|
48
|
+
* is left alone.
|
|
49
|
+
*/
|
|
50
|
+
export declare function inlineFileBlocks(data: unknown): InlineFileBlock[];
|
|
51
|
+
/** The bytes of one block, bounded before they are allocated. */
|
|
52
|
+
export declare function inlineFileBytes(file: InlineFile, maxBytes: number): Buffer;
|
|
53
|
+
export declare function inlineFileMimeType(file: InlineFile): string | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* The file name of a block: a media block's `name` or the file name in a resource's URI.
|
|
56
|
+
* A block that names no file is `<type>-<sha256 of its bytes><extension>`; a media block
|
|
57
|
+
* that names an empty one is refused by the writer like any other unusable name.
|
|
58
|
+
*/
|
|
59
|
+
export declare function inlineFileName(file: InlineFile, digest: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* The result as stdout prints it once its files are saved: each saved block gives up its
|
|
62
|
+
* bytes for an MCP resource link to the file. A block that was not saved keeps its bytes.
|
|
63
|
+
*/
|
|
64
|
+
export declare function linkSavedFiles(data: unknown, blocks: readonly InlineFileBlock[], saved: (block: InlineFileBlock) => {
|
|
65
|
+
path: string;
|
|
66
|
+
name: string;
|
|
67
|
+
size: number;
|
|
68
|
+
} | undefined): unknown;
|
|
69
|
+
export {};
|
|
70
|
+
//# sourceMappingURL=inline-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-files.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/inline-files.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAIpB,CAAC;AAEH,KAAK,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEnD,6FAA6F;AAC7F,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,CAAC;CAClB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,EAAE,CAMjE;AAgCD,iEAAiE;AACjE,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAK1E;AAWD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAEvE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAMvE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,SAAS,eAAe,EAAE,EAClC,KAAK,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,GAC1F,OAAO,CAiBT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/session.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/tools/cli/session.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExC,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EACL,KAAK,YA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EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,aAAa,EAAE,OAAO,CAAC;IACvB,iFAAiF;IACjF,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EACL,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxC,QAAQ,SAAS,SAAS,EAE1B,OAAO,EAAE,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAC9C,IAAI,EAAE,MAAM,EAAE,GACb,QAAQ,CAAC,QAAQ,CAAC,GAAG,SAAS,CAgEhC;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,sBAAsB,GACjC,MAAM,CAcR;AAED,qFAAqF;AACrF,wBAAgB,cAAc,CAC5B,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,WAAW,GAAG,WAAW,CAAC,EAClD,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,MAAM,GACf,WAAW,CAOb"}
|
|
@@ -6,6 +6,8 @@ export declare class DownloadOperationError extends Error {
|
|
|
6
6
|
readonly status: number;
|
|
7
7
|
constructor(code: 'DOWNLOAD_HTTP_ERROR' | 'DOWNLOAD_TOO_LARGE', message: string, status: number);
|
|
8
8
|
}
|
|
9
|
+
/** The file name a fetched URL is saved under: its path's base name and the body's extension. */
|
|
10
|
+
export declare function downloadFileName(url: string, mime: string): string;
|
|
9
11
|
export interface DownloadOperationConfig {
|
|
10
12
|
url: string;
|
|
11
13
|
files: ManagedFileBoundary;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download-core.d.ts","sourceRoot":"","sources":["../../../src/tools/transfer/download-core.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"download-core.d.ts","sourceRoot":"","sources":["../../../src/tools/transfer/download-core.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAQhE,yFAAyF;AACzF,qBAAa,sBAAuB,SAAQ,KAAK;aAE7B,IAAI,EAAE,qBAAqB,GAAG,oBAAoB;aAElD,MAAM,EAAE,MAAM;IAHhC,YACkB,IAAI,EAAE,qBAAqB,GAAG,oBAAoB,EAClE,OAAO,EAAE,MAAM,EACC,MAAM,EAAE,MAAM,EAI/B;CACF;AAyBD,iGAAiG;AACjG,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAElE;AAED,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,mBAAmB,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,kFAAkF;AAClF,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,cAAc,CAAC,CA2BzB"}
|