@llblab/pi-telegram 0.46.0 → 0.47.0
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/BACKLOG.md +0 -1
- package/CHANGELOG.md +8 -0
- package/README.md +2 -2
- package/dist/api/activity.d.ts +6 -0
- package/dist/api/activity.js +6 -0
- package/dist/api/commands.d.ts +6 -0
- package/dist/api/commands.js +6 -0
- package/dist/api/delivery.d.ts +6 -0
- package/dist/api/delivery.js +6 -0
- package/dist/api/inbound.d.ts +6 -0
- package/dist/api/inbound.js +6 -0
- package/dist/api/keyboard.d.ts +6 -0
- package/dist/api/keyboard.js +6 -0
- package/dist/api/outbound.d.ts +6 -0
- package/dist/api/outbound.js +6 -0
- package/dist/api/sections.d.ts +7 -0
- package/dist/api/sections.js +6 -0
- package/dist/api/status.d.ts +6 -0
- package/dist/api/status.js +6 -0
- package/dist/api/updates.d.ts +6 -0
- package/dist/api/updates.js +6 -0
- package/dist/api/voice.d.ts +6 -0
- package/dist/api/voice.js +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/lib/activity-verbosity.d.ts +52 -0
- package/dist/lib/activity-verbosity.js +596 -0
- package/dist/lib/activity.d.ts +220 -0
- package/dist/lib/activity.js +574 -0
- package/dist/lib/agent-messages.d.ts +28 -0
- package/dist/lib/agent-messages.js +86 -0
- package/dist/lib/bindings.d.ts +250 -0
- package/dist/lib/bindings.js +936 -0
- package/dist/lib/bus-api.d.ts +18 -0
- package/dist/lib/bus-api.js +254 -0
- package/dist/lib/bus-follower.d.ts +464 -0
- package/dist/lib/bus-follower.js +1686 -0
- package/dist/lib/bus-leader.d.ts +292 -0
- package/dist/lib/bus-leader.js +2242 -0
- package/dist/lib/bus-transport.d.ts +64 -0
- package/dist/lib/bus-transport.js +140 -0
- package/dist/lib/bus.d.ts +518 -0
- package/dist/lib/bus.js +2055 -0
- package/dist/lib/channel-posts.d.ts +170 -0
- package/dist/lib/channel-posts.js +611 -0
- package/dist/lib/command-templates.d.ts +70 -0
- package/dist/lib/command-templates.js +744 -0
- package/dist/lib/commands.d.ts +541 -0
- package/dist/lib/commands.js +1155 -0
- package/dist/lib/config.d.ts +252 -0
- package/dist/lib/config.js +889 -0
- package/dist/lib/delivery.d.ts +163 -0
- package/dist/lib/delivery.js +542 -0
- package/dist/lib/extension.d.ts +7 -0
- package/dist/lib/extension.js +1608 -0
- package/dist/lib/generative-app-worker.mjs +104 -0
- package/dist/lib/generative-apps.d.ts +212 -0
- package/dist/lib/generative-apps.js +1006 -0
- package/dist/lib/inbound.d.ts +91 -0
- package/dist/lib/inbound.js +502 -0
- package/dist/lib/journal.d.ts +665 -0
- package/dist/lib/journal.js +3701 -0
- package/dist/lib/keyboard.d.ts +23 -0
- package/dist/lib/keyboard.js +37 -0
- package/dist/lib/lifecycle.d.ts +157 -0
- package/dist/lib/lifecycle.js +395 -0
- package/dist/lib/locks.d.ts +164 -0
- package/dist/lib/locks.js +1208 -0
- package/dist/lib/logging.d.ts +50 -0
- package/dist/lib/logging.js +274 -0
- package/dist/lib/media.d.ts +181 -0
- package/dist/lib/media.js +602 -0
- package/dist/lib/menu-model.d.ts +217 -0
- package/dist/lib/menu-model.js +663 -0
- package/dist/lib/menu-queue.d.ts +37 -0
- package/dist/lib/menu-queue.js +408 -0
- package/dist/lib/menu-settings.d.ts +116 -0
- package/dist/lib/menu-settings.js +595 -0
- package/dist/lib/menu-status.d.ts +32 -0
- package/dist/lib/menu-status.js +112 -0
- package/dist/lib/menu-thinking.d.ts +29 -0
- package/dist/lib/menu-thinking.js +82 -0
- package/dist/lib/menu.d.ts +171 -0
- package/dist/lib/menu.js +323 -0
- package/dist/lib/model.d.ts +127 -0
- package/dist/lib/model.js +409 -0
- package/dist/lib/outbound-attachments.d.ts +241 -0
- package/dist/lib/outbound-attachments.js +639 -0
- package/dist/lib/outbound-buttons.d.ts +69 -0
- package/dist/lib/outbound-buttons.js +248 -0
- package/dist/lib/outbound-markup.d.ts +42 -0
- package/dist/lib/outbound-markup.js +678 -0
- package/dist/lib/outbound-voice.d.ts +55 -0
- package/dist/lib/outbound-voice.js +152 -0
- package/dist/lib/outbound.d.ts +185 -0
- package/dist/lib/outbound.js +516 -0
- package/dist/lib/ownership.d.ts +77 -0
- package/dist/lib/ownership.js +174 -0
- package/dist/lib/paths.d.ts +40 -0
- package/dist/lib/paths.js +94 -0
- package/dist/lib/pi.d.ts +72 -0
- package/dist/lib/pi.js +121 -0
- package/dist/lib/polling.d.ts +351 -0
- package/dist/lib/polling.js +1196 -0
- package/dist/lib/preview.d.ts +192 -0
- package/dist/lib/preview.js +614 -0
- package/dist/lib/prompt-templates.d.ts +24 -0
- package/dist/lib/prompt-templates.js +118 -0
- package/dist/lib/prompts.d.ts +57 -0
- package/dist/lib/prompts.js +167 -0
- package/dist/lib/queue.d.ts +766 -0
- package/dist/lib/queue.js +1965 -0
- package/dist/lib/recovery.d.ts +86 -0
- package/dist/lib/recovery.js +285 -0
- package/dist/lib/rendering.d.ts +20 -0
- package/dist/lib/rendering.js +983 -0
- package/dist/lib/replies.d.ts +214 -0
- package/dist/lib/replies.js +737 -0
- package/dist/lib/routing.d.ts +207 -0
- package/dist/lib/routing.js +2282 -0
- package/dist/lib/runtime.d.ts +172 -0
- package/dist/lib/runtime.js +402 -0
- package/dist/lib/sections.d.ts +165 -0
- package/dist/lib/sections.js +327 -0
- package/dist/lib/setup.d.ts +82 -0
- package/dist/lib/setup.js +150 -0
- package/dist/lib/skills.d.ts +8 -0
- package/dist/lib/skills.js +12 -0
- package/dist/lib/status.d.ts +442 -0
- package/dist/lib/status.js +1006 -0
- package/dist/lib/sync.d.ts +179 -0
- package/dist/lib/sync.js +782 -0
- package/dist/lib/target.d.ts +20 -0
- package/dist/lib/target.js +27 -0
- package/dist/lib/telegram-api.d.ts +541 -0
- package/dist/lib/telegram-api.js +1159 -0
- package/dist/lib/text-groups.d.ts +89 -0
- package/dist/lib/text-groups.js +317 -0
- package/dist/lib/thread-cleanup-manager.d.ts +288 -0
- package/dist/lib/thread-cleanup-manager.js +560 -0
- package/dist/lib/thread-display.d.ts +46 -0
- package/dist/lib/thread-display.js +257 -0
- package/dist/lib/thread-naming.d.ts +46 -0
- package/dist/lib/thread-naming.js +78 -0
- package/dist/lib/thread-reconciler.d.ts +239 -0
- package/dist/lib/thread-reconciler.js +644 -0
- package/dist/lib/threads.d.ts +621 -0
- package/dist/lib/threads.js +3679 -0
- package/dist/lib/time-injection.d.ts +15 -0
- package/dist/lib/time-injection.js +56 -0
- package/dist/lib/turns.d.ts +109 -0
- package/dist/lib/turns.js +500 -0
- package/dist/lib/updates.d.ts +1290 -0
- package/dist/lib/updates.js +3634 -0
- package/dist/lib/voice.d.ts +117 -0
- package/dist/lib/voice.js +174 -0
- package/dist/lib/workspace-admission.d.ts +264 -0
- package/dist/lib/workspace-admission.js +1136 -0
- package/dist/lib/workspace-retirement.d.ts +219 -0
- package/dist/lib/workspace-retirement.js +587 -0
- package/dist/lib/workspace-slots.d.ts +30 -0
- package/dist/lib/workspace-slots.js +54 -0
- package/dist/package.json +126 -0
- package/dist/pi-telegram/index.js +1 -0
- package/dist/skills/generated-control-surface/SKILL.md +107 -0
- package/dist/skills/generated-control-surface/references/capability-adapters.md +27 -0
- package/dist/skills/generated-control-surface/references/layout-and-state.md +37 -0
- package/dist/skills/generative-apps/SKILL.md +115 -0
- package/dist/skills/show-me/SKILL.md +166 -0
- package/dist/skills/show-me/references/telegram-surfaces.md +43 -0
- package/dist/skills/telegram-bridge/SKILL.md +129 -0
- package/dist/skills/telegram-bridge/references/configuration.md +15 -0
- package/dist/skills/telegram-bridge/references/delivery-and-threads.md +27 -0
- package/dist/skills/telegram-bridge/references/diagnosis.md +18 -0
- package/docs/architecture.md +1 -1
- package/docs/compact-matrix-literal.md +10 -3
- package/docs/generative-apps.md +15 -13
- package/docs/multi-instance-bus.md +4 -2
- package/docs/outbound.md +1 -1
- package/docs/public-api.md +2 -2
- package/lib/bindings.ts +89 -6
- package/lib/bus-follower.ts +7 -3
- package/lib/bus-leader.ts +44 -19
- package/lib/bus.ts +4 -1
- package/lib/commands.ts +2 -2
- package/lib/config.ts +14 -7
- package/lib/delivery.ts +38 -6
- package/lib/extension.ts +19 -0
- package/lib/generative-apps.ts +379 -13
- package/lib/menu-settings.ts +21 -5
- package/lib/outbound-markup.ts +16 -7
- package/lib/telegram-api.ts +12 -1
- package/lib/thread-display.ts +96 -18
- package/package.json +56 -13
- package/scripts/build-dist.mjs +44 -0
- package/scripts/measure-bus.mjs +8 -1
- package/scripts/measure-workspace.mjs +8 -1
- package/skills/generative-apps/SKILL.md +1 -1
- package/skills/telegram-bridge/SKILL.md +1 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generative App isolated method worker
|
|
3
|
+
* Zones: managed Generative App execution, bounded local processes
|
|
4
|
+
* Owns one terminable app-method invocation and its child-process cleanup
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { execFile } from "node:child_process";
|
|
8
|
+
import { parentPort, workerData } from "node:worker_threads";
|
|
9
|
+
import { pathToFileURL } from "node:url";
|
|
10
|
+
|
|
11
|
+
if (!parentPort) throw new Error("Generative App worker requires a parent port.");
|
|
12
|
+
|
|
13
|
+
const controller = new AbortController();
|
|
14
|
+
const runningChildren = new Set();
|
|
15
|
+
parentPort.on("message", (message) => {
|
|
16
|
+
if (message?.type !== "abort") return;
|
|
17
|
+
controller.abort();
|
|
18
|
+
for (const child of runningChildren) child.kill();
|
|
19
|
+
parentPort.postMessage({ type: "abort-ack" });
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
function runBoundedProcess(input) {
|
|
23
|
+
if (!input || typeof input !== "object") {
|
|
24
|
+
throw new Error("Generative App run input must be an object.");
|
|
25
|
+
}
|
|
26
|
+
const command = input.command?.trim();
|
|
27
|
+
if (!command) throw new Error("Generative App run.command is required.");
|
|
28
|
+
if (!Array.isArray(input.args ?? []) || (input.args?.length ?? 0) > workerData.runMaxArgs) {
|
|
29
|
+
throw new Error(`Generative App run.args accepts at most ${workerData.runMaxArgs} strings.`);
|
|
30
|
+
}
|
|
31
|
+
const args = (input.args ?? []).map((argument) => {
|
|
32
|
+
if (typeof argument !== "string") throw new Error("Generative App run.args must contain strings.");
|
|
33
|
+
return argument;
|
|
34
|
+
});
|
|
35
|
+
if (!input.cwd || typeof input.cwd !== "string") {
|
|
36
|
+
throw new Error("Generative App run.cwd is required.");
|
|
37
|
+
}
|
|
38
|
+
const timeoutMs = Math.min(
|
|
39
|
+
workerData.runMaxTimeoutMs,
|
|
40
|
+
Math.max(1, Math.round(input.timeoutMs ?? workerData.methodTimeoutMs)),
|
|
41
|
+
);
|
|
42
|
+
return new Promise((resolve, reject) => {
|
|
43
|
+
const child = execFile(
|
|
44
|
+
command,
|
|
45
|
+
args,
|
|
46
|
+
{
|
|
47
|
+
cwd: input.cwd,
|
|
48
|
+
encoding: "utf8",
|
|
49
|
+
maxBuffer: workerData.runMaxStreamBytes,
|
|
50
|
+
shell: false,
|
|
51
|
+
signal: controller.signal,
|
|
52
|
+
timeout: timeoutMs,
|
|
53
|
+
windowsHide: true,
|
|
54
|
+
},
|
|
55
|
+
(error, stdout, stderr) => {
|
|
56
|
+
runningChildren.delete(child);
|
|
57
|
+
if (error && error.code !== "ABORT_ERR") {
|
|
58
|
+
resolve({
|
|
59
|
+
code: typeof error.code === "number" ? error.code : 1,
|
|
60
|
+
killed: error.killed === true,
|
|
61
|
+
stderr: String(stderr).slice(-workerData.runMaxStreamBytes),
|
|
62
|
+
stdout: String(stdout).slice(-workerData.runMaxStreamBytes),
|
|
63
|
+
});
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (error) {
|
|
67
|
+
reject(error);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
resolve({
|
|
71
|
+
code: 0,
|
|
72
|
+
killed: false,
|
|
73
|
+
stderr: String(stderr),
|
|
74
|
+
stdout: String(stdout),
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
);
|
|
78
|
+
runningChildren.add(child);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
try {
|
|
83
|
+
const module = await import(pathToFileURL(workerData.modulePath).href);
|
|
84
|
+
if (typeof module.init !== "function") {
|
|
85
|
+
throw new Error(`Generative App ${workerData.app} must export named function init.`);
|
|
86
|
+
}
|
|
87
|
+
const method = module[workerData.method];
|
|
88
|
+
if (typeof method !== "function") {
|
|
89
|
+
throw new Error(`Generative App ${workerData.app} does not export method ${workerData.method}.`);
|
|
90
|
+
}
|
|
91
|
+
const result = await method({
|
|
92
|
+
...(workerData.argumentPresent ? { argument: workerData.argument } : {}),
|
|
93
|
+
revision: workerData.revision,
|
|
94
|
+
run: runBoundedProcess,
|
|
95
|
+
signal: controller.signal,
|
|
96
|
+
...(workerData.statePresent ? { state: workerData.state } : {}),
|
|
97
|
+
});
|
|
98
|
+
parentPort.postMessage({ ok: true, result });
|
|
99
|
+
} catch (error) {
|
|
100
|
+
parentPort.postMessage({
|
|
101
|
+
ok: false,
|
|
102
|
+
error: error instanceof Error ? error.message : String(error),
|
|
103
|
+
});
|
|
104
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generative application kernel and Telegram installation adapter
|
|
3
|
+
* Zones: generative application state, isolated methods, pi agent tools
|
|
4
|
+
* Owns Generative App identity, installation, invocation, state history, and telegram_bind
|
|
5
|
+
*/
|
|
6
|
+
import type { ExtensionAPI } from "./pi.ts";
|
|
7
|
+
export declare const GENERATIVE_APP_MIN_REFRESH_AFTER_MS = 2000;
|
|
8
|
+
export declare const GENERATIVE_APP_MAX_REFRESH_AFTER_MS: number;
|
|
9
|
+
export type GenerativeAppJsonValue = null | boolean | number | string | GenerativeAppJsonValue[] | {
|
|
10
|
+
[key: string]: GenerativeAppJsonValue;
|
|
11
|
+
};
|
|
12
|
+
export interface GenerativeAppProcessInput {
|
|
13
|
+
command: string;
|
|
14
|
+
args?: string[];
|
|
15
|
+
cwd: string;
|
|
16
|
+
timeoutMs?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface GenerativeAppProcessResult {
|
|
19
|
+
code: number;
|
|
20
|
+
killed: boolean;
|
|
21
|
+
stderr: string;
|
|
22
|
+
stdout: string;
|
|
23
|
+
}
|
|
24
|
+
export interface GenerativeAppMethodContext {
|
|
25
|
+
argument?: GenerativeAppJsonValue;
|
|
26
|
+
revision: number;
|
|
27
|
+
run: (input: GenerativeAppProcessInput) => Promise<GenerativeAppProcessResult>;
|
|
28
|
+
signal: AbortSignal;
|
|
29
|
+
state?: GenerativeAppJsonValue;
|
|
30
|
+
}
|
|
31
|
+
export interface GenerativeAppMethodResult {
|
|
32
|
+
output: string;
|
|
33
|
+
refreshAfterMs?: number;
|
|
34
|
+
state?: GenerativeAppJsonValue;
|
|
35
|
+
viewMode?: "new" | "edit";
|
|
36
|
+
}
|
|
37
|
+
export interface GenerativeAppBoundAction {
|
|
38
|
+
argument?: GenerativeAppJsonValue;
|
|
39
|
+
method: string;
|
|
40
|
+
app: string;
|
|
41
|
+
}
|
|
42
|
+
export interface GenerativeAppInvocationResult {
|
|
43
|
+
generation: string;
|
|
44
|
+
method: string;
|
|
45
|
+
output: string;
|
|
46
|
+
app: string;
|
|
47
|
+
revision: number;
|
|
48
|
+
refreshAfterMs?: number;
|
|
49
|
+
stateChanged: boolean;
|
|
50
|
+
viewMode: "new" | "edit";
|
|
51
|
+
}
|
|
52
|
+
export interface GenerativeAppExecutionFence {
|
|
53
|
+
assertCurrent: () => void;
|
|
54
|
+
signal: AbortSignal;
|
|
55
|
+
}
|
|
56
|
+
export interface GenerativeAppRuntimeOptions {
|
|
57
|
+
agentDir: string;
|
|
58
|
+
execution?: GenerativeAppExecutionFence;
|
|
59
|
+
methodTimeoutMs?: number;
|
|
60
|
+
}
|
|
61
|
+
export interface GenerativeAppLiveSurfaceFrame<THandle> {
|
|
62
|
+
digest: string;
|
|
63
|
+
handle: THandle;
|
|
64
|
+
}
|
|
65
|
+
export interface GenerativeAppLiveSurface<THandle> {
|
|
66
|
+
app: string;
|
|
67
|
+
appGeneration: string;
|
|
68
|
+
appRevision: number;
|
|
69
|
+
handle: THandle;
|
|
70
|
+
initialDigest: string;
|
|
71
|
+
key: string;
|
|
72
|
+
refreshAfterMs: number;
|
|
73
|
+
}
|
|
74
|
+
export interface GenerativeAppLiveSurfaceRuntime<THandle> {
|
|
75
|
+
open: (surface: GenerativeAppLiveSurface<THandle>) => void;
|
|
76
|
+
cancel: (key: string) => void;
|
|
77
|
+
take: (key: string) => GenerativeAppLiveSurface<THandle> | undefined;
|
|
78
|
+
resume: (surface: GenerativeAppLiveSurface<THandle>, result: GenerativeAppInvocationResult) => Promise<void>;
|
|
79
|
+
refreshNow: (key: string) => Promise<void>;
|
|
80
|
+
shutdown: () => void;
|
|
81
|
+
}
|
|
82
|
+
export interface GenerativeAppLiveSurfaceRuntimeDeps<THandle> {
|
|
83
|
+
agentDir: string;
|
|
84
|
+
isCurrent: (surface: GenerativeAppLiveSurface<THandle>) => boolean;
|
|
85
|
+
plan: (result: GenerativeAppInvocationResult, handle: THandle) => GenerativeAppLiveSurfaceFrame<THandle>;
|
|
86
|
+
edit: (frame: GenerativeAppLiveSurfaceFrame<THandle>) => Promise<THandle>;
|
|
87
|
+
classifyEditError?: (error: unknown) => {
|
|
88
|
+
kind: "retry";
|
|
89
|
+
retryAfterMs?: number;
|
|
90
|
+
} | {
|
|
91
|
+
kind: "terminal" | "unavailable" | "unknown";
|
|
92
|
+
};
|
|
93
|
+
recordRuntimeEvent?: (category: string, error: unknown, details?: Record<string, unknown>) => void;
|
|
94
|
+
setTimer?: (callback: () => void, delayMs: number) => ReturnType<typeof setTimeout>;
|
|
95
|
+
clearTimer?: (timer: ReturnType<typeof setTimeout>) => void;
|
|
96
|
+
}
|
|
97
|
+
export interface TelegramBindDeliveryHandle {
|
|
98
|
+
readonly target: {
|
|
99
|
+
chatId: number;
|
|
100
|
+
threadId?: number;
|
|
101
|
+
};
|
|
102
|
+
readonly messageIds: readonly number[];
|
|
103
|
+
readonly generation: string;
|
|
104
|
+
}
|
|
105
|
+
export interface TelegramBindLiveHandle {
|
|
106
|
+
delivery: TelegramBindDeliveryHandle;
|
|
107
|
+
view?: {
|
|
108
|
+
text: string;
|
|
109
|
+
parseMode: "markdown";
|
|
110
|
+
replyMarkup?: unknown;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
export declare function getTelegramBindLiveSurfaceKey(app: string, profile: string, target: {
|
|
114
|
+
chatId: number;
|
|
115
|
+
threadId?: number;
|
|
116
|
+
}): string;
|
|
117
|
+
export interface TelegramBindToolRegistrationDeps extends GenerativeAppRuntimeOptions {
|
|
118
|
+
getActiveProfileName?: () => string | undefined;
|
|
119
|
+
liveSurfaceSetTimer?: GenerativeAppLiveSurfaceRuntimeDeps<unknown>["setTimer"];
|
|
120
|
+
liveSurfaceClearTimer?: GenerativeAppLiveSurfaceRuntimeDeps<unknown>["clearTimer"];
|
|
121
|
+
setLiveSurfaceRuntime?: (runtime: GenerativeAppLiveSurfaceRuntime<TelegramBindLiveHandle> | undefined) => void;
|
|
122
|
+
isDeliveryHandleCurrent?: (handle: TelegramBindDeliveryHandle) => boolean;
|
|
123
|
+
editView?: (handle: TelegramBindDeliveryHandle, view: {
|
|
124
|
+
text: string;
|
|
125
|
+
parseMode: "markdown";
|
|
126
|
+
replyMarkup?: unknown;
|
|
127
|
+
}) => Promise<{
|
|
128
|
+
ok: true;
|
|
129
|
+
value: TelegramBindDeliveryHandle;
|
|
130
|
+
} | {
|
|
131
|
+
ok: false;
|
|
132
|
+
reason: string;
|
|
133
|
+
message: string;
|
|
134
|
+
retryAfterMs?: number;
|
|
135
|
+
}>;
|
|
136
|
+
getActiveTurn?: () => {
|
|
137
|
+
chatId: number;
|
|
138
|
+
replyToMessageId: number;
|
|
139
|
+
target?: {
|
|
140
|
+
chatId: number;
|
|
141
|
+
threadId?: number;
|
|
142
|
+
};
|
|
143
|
+
} | undefined;
|
|
144
|
+
planOutput?: (markdown: string, options: {
|
|
145
|
+
binding: {
|
|
146
|
+
generation: string;
|
|
147
|
+
app: string;
|
|
148
|
+
revision: number;
|
|
149
|
+
};
|
|
150
|
+
}) => {
|
|
151
|
+
markdown: string;
|
|
152
|
+
replyMarkup?: unknown;
|
|
153
|
+
};
|
|
154
|
+
sendMarkdownReply?: (chatId: number, replyToMessageId: number, markdown: string, options?: {
|
|
155
|
+
replyMarkup?: unknown;
|
|
156
|
+
target?: {
|
|
157
|
+
chatId: number;
|
|
158
|
+
threadId?: number;
|
|
159
|
+
};
|
|
160
|
+
}) => Promise<number | undefined>;
|
|
161
|
+
sendView?: (view: {
|
|
162
|
+
text: string;
|
|
163
|
+
parseMode: "markdown";
|
|
164
|
+
replyMarkup?: unknown;
|
|
165
|
+
}, options: {
|
|
166
|
+
scope: {
|
|
167
|
+
kind: "active-turn";
|
|
168
|
+
};
|
|
169
|
+
replyToMessageId: number;
|
|
170
|
+
}) => Promise<{
|
|
171
|
+
ok: true;
|
|
172
|
+
value: TelegramBindDeliveryHandle;
|
|
173
|
+
} | {
|
|
174
|
+
ok: false;
|
|
175
|
+
reason?: string;
|
|
176
|
+
message: string;
|
|
177
|
+
}>;
|
|
178
|
+
recordRuntimeEvent?: (category: string, error: unknown, details?: Record<string, unknown>) => void;
|
|
179
|
+
}
|
|
180
|
+
export declare function resolveGenerativeAppDir(agentDir: string, app: string): string;
|
|
181
|
+
export declare function resolveGenerativeAppModulePath(agentDir: string, app: string): string;
|
|
182
|
+
export declare function invokeGenerativeApp(options: GenerativeAppRuntimeOptions & {
|
|
183
|
+
argument?: unknown;
|
|
184
|
+
expectedGeneration?: string;
|
|
185
|
+
expectedRevision?: number;
|
|
186
|
+
method: string;
|
|
187
|
+
app: string;
|
|
188
|
+
}): Promise<GenerativeAppInvocationResult>;
|
|
189
|
+
export declare function installGenerativeApp(options: GenerativeAppRuntimeOptions & {
|
|
190
|
+
argument?: unknown;
|
|
191
|
+
app: string;
|
|
192
|
+
replace?: boolean;
|
|
193
|
+
script: string;
|
|
194
|
+
}): Promise<GenerativeAppInvocationResult>;
|
|
195
|
+
export declare function parseGenerativeAppBoundAction(prompt: string): GenerativeAppBoundAction | undefined;
|
|
196
|
+
export declare function invokeGenerativeAppBoundAction(options: GenerativeAppRuntimeOptions & {
|
|
197
|
+
expectedGeneration?: string;
|
|
198
|
+
expectedRevision?: number;
|
|
199
|
+
prompt: string;
|
|
200
|
+
}): Promise<GenerativeAppInvocationResult | undefined>;
|
|
201
|
+
export declare function bindGenerativeApp(options: GenerativeAppRuntimeOptions & {
|
|
202
|
+
argument?: unknown;
|
|
203
|
+
method?: string;
|
|
204
|
+
app: string;
|
|
205
|
+
replace?: boolean;
|
|
206
|
+
script?: string;
|
|
207
|
+
}): Promise<GenerativeAppInvocationResult>;
|
|
208
|
+
export declare function createGenerativeAppLiveSurfaceRuntime<THandle>(deps: GenerativeAppLiveSurfaceRuntimeDeps<THandle>): GenerativeAppLiveSurfaceRuntime<THandle>;
|
|
209
|
+
export declare function formatGenerativeAppToolOutput(output: string): string;
|
|
210
|
+
export declare function formatDisplayedGenerativeAppToolOutput(): string;
|
|
211
|
+
export declare function formatGenerativeAppToolError(error: unknown): Error;
|
|
212
|
+
export declare function registerTelegramBindTool(pi: ExtensionAPI, deps: TelegramBindToolRegistrationDeps): void;
|