agent-sin 0.1.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/CHANGELOG.md +33 -0
- package/LICENSE +21 -0
- package/README.md +81 -0
- package/assets/logo.png +0 -0
- package/builtin-skills/_shared/_models_lib.py +227 -0
- package/builtin-skills/_shared/_profile_lib.py +98 -0
- package/builtin-skills/_shared/_schedules_lib.py +313 -0
- package/builtin-skills/_shared/_skill_settings_lib.py +153 -0
- package/builtin-skills/_shared/i18n.py +26 -0
- package/builtin-skills/memo-delete/main.py +155 -0
- package/builtin-skills/memo-delete/skill.yaml +57 -0
- package/builtin-skills/memo-index/main.py +178 -0
- package/builtin-skills/memo-index/skill.yaml +53 -0
- package/builtin-skills/memo-save/README.md +5 -0
- package/builtin-skills/memo-save/main.py +74 -0
- package/builtin-skills/memo-save/skill.yaml +52 -0
- package/builtin-skills/memo-search/README.md +10 -0
- package/builtin-skills/memo-search/main.py +97 -0
- package/builtin-skills/memo-search/skill.yaml +51 -0
- package/builtin-skills/memo-vector-search/main.py +121 -0
- package/builtin-skills/memo-vector-search/skill.yaml +53 -0
- package/builtin-skills/model-add/main.py +180 -0
- package/builtin-skills/model-add/skill.yaml +112 -0
- package/builtin-skills/model-list/main.py +93 -0
- package/builtin-skills/model-list/skill.yaml +48 -0
- package/builtin-skills/model-set/main.py +123 -0
- package/builtin-skills/model-set/skill.yaml +69 -0
- package/builtin-skills/profile-delete/_profile_lib.py +98 -0
- package/builtin-skills/profile-delete/main.py +98 -0
- package/builtin-skills/profile-delete/skill.yaml +64 -0
- package/builtin-skills/profile-edit/_profile_lib.py +98 -0
- package/builtin-skills/profile-edit/main.py +97 -0
- package/builtin-skills/profile-edit/skill.yaml +72 -0
- package/builtin-skills/profile-save/main.py +52 -0
- package/builtin-skills/profile-save/skill.yaml +69 -0
- package/builtin-skills/schedule-add/_schedules_lib.py +303 -0
- package/builtin-skills/schedule-add/main.py +137 -0
- package/builtin-skills/schedule-add/skill.yaml +94 -0
- package/builtin-skills/schedule-list/_schedules_lib.py +303 -0
- package/builtin-skills/schedule-list/main.py +86 -0
- package/builtin-skills/schedule-list/skill.yaml +45 -0
- package/builtin-skills/schedule-remove/_schedules_lib.py +303 -0
- package/builtin-skills/schedule-remove/main.py +69 -0
- package/builtin-skills/schedule-remove/skill.yaml +49 -0
- package/builtin-skills/schedule-toggle/_schedules_lib.py +303 -0
- package/builtin-skills/schedule-toggle/main.py +78 -0
- package/builtin-skills/schedule-toggle/skill.yaml +61 -0
- package/builtin-skills/skills-disable/main.py +63 -0
- package/builtin-skills/skills-disable/skill.yaml +52 -0
- package/builtin-skills/skills-enable/main.py +62 -0
- package/builtin-skills/skills-enable/skill.yaml +51 -0
- package/builtin-skills/todo-add/main.py +68 -0
- package/builtin-skills/todo-add/skill.yaml +53 -0
- package/builtin-skills/todo-delete/main.py +65 -0
- package/builtin-skills/todo-delete/skill.yaml +47 -0
- package/builtin-skills/todo-done/main.py +75 -0
- package/builtin-skills/todo-done/skill.yaml +47 -0
- package/builtin-skills/todo-list/main.py +91 -0
- package/builtin-skills/todo-list/skill.yaml +48 -0
- package/builtin-skills/todo-tick/main.py +125 -0
- package/builtin-skills/todo-tick/skill.yaml +48 -0
- package/dist/builder/build-action-classifier.d.ts +18 -0
- package/dist/builder/build-action-classifier.js +142 -0
- package/dist/builder/build-commands.d.ts +19 -0
- package/dist/builder/build-commands.js +133 -0
- package/dist/builder/build-flow.d.ts +72 -0
- package/dist/builder/build-flow.js +416 -0
- package/dist/builder/builder-session.d.ts +117 -0
- package/dist/builder/builder-session.js +1129 -0
- package/dist/builder/conversation-router.d.ts +22 -0
- package/dist/builder/conversation-router.js +69 -0
- package/dist/builder/intent-runtime-store.d.ts +7 -0
- package/dist/builder/intent-runtime-store.js +60 -0
- package/dist/builder/progress-format.d.ts +7 -0
- package/dist/builder/progress-format.js +46 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +2835 -0
- package/dist/cli/spinner.d.ts +30 -0
- package/dist/cli/spinner.js +164 -0
- package/dist/core/ai-provider.d.ts +75 -0
- package/dist/core/ai-provider.js +678 -0
- package/dist/core/builtin-skills.d.ts +27 -0
- package/dist/core/builtin-skills.js +120 -0
- package/dist/core/chat-engine.d.ts +70 -0
- package/dist/core/chat-engine.js +812 -0
- package/dist/core/config.d.ts +127 -0
- package/dist/core/config.js +1379 -0
- package/dist/core/daily-memory-promotion.d.ts +21 -0
- package/dist/core/daily-memory-promotion.js +422 -0
- package/dist/core/i18n.d.ts +23 -0
- package/dist/core/i18n.js +167 -0
- package/dist/core/info-lines.d.ts +5 -0
- package/dist/core/info-lines.js +39 -0
- package/dist/core/input-schema.d.ts +2 -0
- package/dist/core/input-schema.js +156 -0
- package/dist/core/intent-router.d.ts +27 -0
- package/dist/core/intent-router.js +160 -0
- package/dist/core/logger.d.ts +60 -0
- package/dist/core/logger.js +240 -0
- package/dist/core/memory.d.ts +10 -0
- package/dist/core/memory.js +72 -0
- package/dist/core/message-utils.d.ts +13 -0
- package/dist/core/message-utils.js +104 -0
- package/dist/core/notifier.d.ts +17 -0
- package/dist/core/notifier.js +424 -0
- package/dist/core/output-writer.d.ts +13 -0
- package/dist/core/output-writer.js +100 -0
- package/dist/core/plan-decision.d.ts +16 -0
- package/dist/core/plan-decision.js +88 -0
- package/dist/core/profile-memory.d.ts +17 -0
- package/dist/core/profile-memory.js +142 -0
- package/dist/core/runtime.d.ts +50 -0
- package/dist/core/runtime.js +187 -0
- package/dist/core/scheduler.d.ts +28 -0
- package/dist/core/scheduler.js +155 -0
- package/dist/core/secrets.d.ts +31 -0
- package/dist/core/secrets.js +214 -0
- package/dist/core/service.d.ts +35 -0
- package/dist/core/service.js +479 -0
- package/dist/core/skill-planner.d.ts +24 -0
- package/dist/core/skill-planner.js +100 -0
- package/dist/core/skill-registry.d.ts +98 -0
- package/dist/core/skill-registry.js +319 -0
- package/dist/core/skill-scaffold.d.ts +33 -0
- package/dist/core/skill-scaffold.js +256 -0
- package/dist/core/skill-settings.d.ts +11 -0
- package/dist/core/skill-settings.js +63 -0
- package/dist/core/transfer.d.ts +31 -0
- package/dist/core/transfer.js +270 -0
- package/dist/core/update-notifier.d.ts +2 -0
- package/dist/core/update-notifier.js +140 -0
- package/dist/discord/bot.d.ts +96 -0
- package/dist/discord/bot.js +2424 -0
- package/dist/runtimes/codex-app-server.d.ts +53 -0
- package/dist/runtimes/codex-app-server.js +305 -0
- package/dist/runtimes/python-runner.d.ts +7 -0
- package/dist/runtimes/python-runner.js +302 -0
- package/dist/runtimes/typescript-runner.d.ts +5 -0
- package/dist/runtimes/typescript-runner.js +172 -0
- package/dist/skills-sdk/types.d.ts +38 -0
- package/dist/skills-sdk/types.js +1 -0
- package/dist/telegram/bot.d.ts +94 -0
- package/dist/telegram/bot.js +1219 -0
- package/install.ps1 +132 -0
- package/install.sh +130 -0
- package/package.json +60 -0
- package/templates/skill-python/main.py +74 -0
- package/templates/skill-python/skill.yaml +48 -0
- package/templates/skill-typescript/main.ts +87 -0
- package/templates/skill-typescript/skill.yaml +42 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { copyFile, mkdir, readdir, readFile, realpath, writeFile } from "node:fs/promises";
|
|
2
|
+
import crypto from "node:crypto";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { pathToFileURL } from "node:url";
|
|
6
|
+
import ts from "typescript";
|
|
7
|
+
import { resolveSkillEntryPath } from "../core/skill-registry.js";
|
|
8
|
+
import { getAiProvider } from "../core/ai-provider.js";
|
|
9
|
+
import { notify as runNotify } from "../core/notifier.js";
|
|
10
|
+
export async function runTypeScriptSkill(config, manifest, input) {
|
|
11
|
+
const entry = await resolveSkillEntryPath(manifest);
|
|
12
|
+
const skillDir = await realpath(manifest.dir);
|
|
13
|
+
const moduleUrl = await prepareModule(skillDir, entry);
|
|
14
|
+
const module = await import(`${moduleUrl.href}?run=${crypto.randomUUID()}`);
|
|
15
|
+
const handler = resolveHandler(module, manifest.handler);
|
|
16
|
+
const context = createContext(config, manifest, input.memory);
|
|
17
|
+
const result = await handler(context.ctx, input);
|
|
18
|
+
if (!result || typeof result !== "object" || Array.isArray(result)) {
|
|
19
|
+
throw new Error(`TypeScript skill did not return a result object: ${manifest.id}`);
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
result: result,
|
|
23
|
+
memory_updates: context.memoryUpdates,
|
|
24
|
+
logs: context.logs,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
async function prepareModule(skillDir, entry) {
|
|
28
|
+
if (entry.endsWith(".ts") || entry.endsWith(".tsx")) {
|
|
29
|
+
const cacheDir = path.join(os.tmpdir(), "agent-sin-ts-runtime", crypto.randomUUID());
|
|
30
|
+
await mkdir(cacheDir, { recursive: true });
|
|
31
|
+
await writeFile(path.join(cacheDir, "package.json"), JSON.stringify({ type: "module" }), "utf8");
|
|
32
|
+
await prepareDirectory(skillDir, cacheDir);
|
|
33
|
+
const relativeEntry = path.relative(skillDir, entry).replace(/\.(tsx?|mts|cts)$/, ".js");
|
|
34
|
+
return pathToFileURL(path.join(cacheDir, relativeEntry));
|
|
35
|
+
}
|
|
36
|
+
return pathToFileURL(entry);
|
|
37
|
+
}
|
|
38
|
+
async function prepareDirectory(sourceDir, targetDir) {
|
|
39
|
+
for (const entry of await readdir(sourceDir, { withFileTypes: true })) {
|
|
40
|
+
if (entry.name === "node_modules" || entry.name.startsWith(".")) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const sourcePath = path.join(sourceDir, entry.name);
|
|
44
|
+
const targetPath = path.join(targetDir, entry.name);
|
|
45
|
+
if (entry.isDirectory()) {
|
|
46
|
+
await mkdir(targetPath, { recursive: true });
|
|
47
|
+
await prepareDirectory(sourcePath, targetPath);
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (!entry.isFile()) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (/\.(tsx?|mts|cts)$/.test(entry.name)) {
|
|
54
|
+
const outFile = targetPath.replace(/\.(tsx?|mts|cts)$/, ".js");
|
|
55
|
+
await transpileFile(sourcePath, outFile);
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (/\.(mjs|cjs|js|json)$/.test(entry.name)) {
|
|
59
|
+
await mkdir(path.dirname(targetPath), { recursive: true });
|
|
60
|
+
await copyFile(sourcePath, targetPath);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async function transpileFile(sourcePath, targetPath) {
|
|
65
|
+
const source = await readFile(sourcePath, "utf8");
|
|
66
|
+
const compiled = ts.transpileModule(source, {
|
|
67
|
+
fileName: sourcePath,
|
|
68
|
+
compilerOptions: {
|
|
69
|
+
target: ts.ScriptTarget.ES2022,
|
|
70
|
+
module: ts.ModuleKind.ES2022,
|
|
71
|
+
esModuleInterop: true,
|
|
72
|
+
sourceMap: false,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
await mkdir(path.dirname(targetPath), { recursive: true });
|
|
76
|
+
await writeFile(targetPath, compiled.outputText, "utf8");
|
|
77
|
+
}
|
|
78
|
+
function resolveHandler(module, handlerName) {
|
|
79
|
+
const direct = module[handlerName];
|
|
80
|
+
if (typeof direct === "function") {
|
|
81
|
+
return direct;
|
|
82
|
+
}
|
|
83
|
+
const fallback = module.default;
|
|
84
|
+
if (fallback && typeof fallback === "object" && typeof fallback[handlerName] === "function") {
|
|
85
|
+
return fallback[handlerName];
|
|
86
|
+
}
|
|
87
|
+
if (handlerName === "default" && typeof fallback === "function") {
|
|
88
|
+
return fallback;
|
|
89
|
+
}
|
|
90
|
+
throw new Error(`TypeScript skill handler not found: ${handlerName}`);
|
|
91
|
+
}
|
|
92
|
+
function createContext(config, manifest, initialMemory) {
|
|
93
|
+
const memory = new Map(Object.entries(initialMemory || {}));
|
|
94
|
+
const memoryUpdates = {};
|
|
95
|
+
const logs = [];
|
|
96
|
+
const allowedSteps = new Map((manifest.ai_steps || []).map((step) => [step.id, step]));
|
|
97
|
+
return {
|
|
98
|
+
ctx: {
|
|
99
|
+
log: {
|
|
100
|
+
info: (message) => logs.push({ level: "info", message: String(message) }),
|
|
101
|
+
warn: (message) => logs.push({ level: "warn", message: String(message) }),
|
|
102
|
+
error: (message) => logs.push({ level: "error", message: String(message) }),
|
|
103
|
+
},
|
|
104
|
+
ai: {
|
|
105
|
+
run: async (stepId, payload) => {
|
|
106
|
+
const step = allowedSteps.get(stepId);
|
|
107
|
+
if (!step) {
|
|
108
|
+
throw new Error(`AI step is not defined for this skill: ${stepId}`);
|
|
109
|
+
}
|
|
110
|
+
const modelId = step.model || config.chat_model_id;
|
|
111
|
+
try {
|
|
112
|
+
const messages = [
|
|
113
|
+
{ role: "system", content: `You are an AI step "${step.id}" of an Agent-Sin skill. Purpose: ${step.purpose}` },
|
|
114
|
+
{ role: "user", content: typeof payload === "string" ? payload : JSON.stringify(payload) },
|
|
115
|
+
];
|
|
116
|
+
const response = await getAiProvider()(config, { model_id: modelId, messages });
|
|
117
|
+
return {
|
|
118
|
+
status: "ok",
|
|
119
|
+
step_id: stepId,
|
|
120
|
+
model_id: modelId,
|
|
121
|
+
provider: response.provider,
|
|
122
|
+
text: response.text,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
if (step.optional) {
|
|
127
|
+
return {
|
|
128
|
+
status: "skipped",
|
|
129
|
+
step_id: stepId,
|
|
130
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
131
|
+
payload,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
throw error;
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
notify: async (args) => {
|
|
139
|
+
const result = await runNotify({
|
|
140
|
+
title: args.title,
|
|
141
|
+
body: args.body,
|
|
142
|
+
subtitle: args.subtitle,
|
|
143
|
+
sound: args.sound,
|
|
144
|
+
channel: args.channel,
|
|
145
|
+
to: args.to,
|
|
146
|
+
discordThreadId: args.discordThreadId,
|
|
147
|
+
telegramThreadId: args.telegramThreadId,
|
|
148
|
+
});
|
|
149
|
+
return { ok: result.ok, channel: result.channel, detail: result.detail };
|
|
150
|
+
},
|
|
151
|
+
memory: {
|
|
152
|
+
get: async (key) => {
|
|
153
|
+
if (manifest.memory?.read !== true) {
|
|
154
|
+
return undefined;
|
|
155
|
+
}
|
|
156
|
+
return memory.get(key);
|
|
157
|
+
},
|
|
158
|
+
set: async (key, value) => {
|
|
159
|
+
if (manifest.memory?.write !== true) {
|
|
160
|
+
throw new Error("Memory write is not allowed for this skill");
|
|
161
|
+
}
|
|
162
|
+
memory.set(key, value);
|
|
163
|
+
memoryUpdates[key] = value;
|
|
164
|
+
return true;
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
now: () => new Date().toISOString(),
|
|
168
|
+
},
|
|
169
|
+
memoryUpdates,
|
|
170
|
+
logs,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface SkillInput {
|
|
2
|
+
args: Record<string, unknown>;
|
|
3
|
+
trigger: {
|
|
4
|
+
type: string;
|
|
5
|
+
id: string;
|
|
6
|
+
time: string;
|
|
7
|
+
};
|
|
8
|
+
sources: Record<string, unknown>;
|
|
9
|
+
memory: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
export type NotifyChannel = "auto" | "macos" | "discord" | "telegram" | "slack" | "mail" | "stderr";
|
|
12
|
+
export interface NotifyArgs {
|
|
13
|
+
title: string;
|
|
14
|
+
body: string;
|
|
15
|
+
subtitle?: string;
|
|
16
|
+
sound?: boolean;
|
|
17
|
+
channel?: NotifyChannel;
|
|
18
|
+
to?: string;
|
|
19
|
+
discordThreadId?: string;
|
|
20
|
+
telegramThreadId?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface NotifyOutcome {
|
|
23
|
+
ok: boolean;
|
|
24
|
+
channel: string;
|
|
25
|
+
detail?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface SkillResult {
|
|
28
|
+
status: "ok" | "skipped" | "error";
|
|
29
|
+
title: string;
|
|
30
|
+
summary: string;
|
|
31
|
+
outputs: Record<string, {
|
|
32
|
+
content?: string;
|
|
33
|
+
frontmatter?: Record<string, unknown>;
|
|
34
|
+
[key: string]: unknown;
|
|
35
|
+
}>;
|
|
36
|
+
data: Record<string, unknown>;
|
|
37
|
+
suggestions: string[];
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { type AppConfig } from "../core/config.js";
|
|
2
|
+
import { type ChatTurn } from "../core/chat-engine.js";
|
|
3
|
+
import type { AiProgressEvent } from "../core/ai-provider.js";
|
|
4
|
+
import { type IntentRuntime } from "../builder/build-flow.js";
|
|
5
|
+
export interface TelegramUser {
|
|
6
|
+
id: number;
|
|
7
|
+
is_bot?: boolean;
|
|
8
|
+
first_name?: string;
|
|
9
|
+
username?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface TelegramChat {
|
|
12
|
+
id: number;
|
|
13
|
+
type: "private" | "group" | "supergroup" | "channel";
|
|
14
|
+
title?: string;
|
|
15
|
+
username?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface TelegramMessageEntity {
|
|
18
|
+
type: string;
|
|
19
|
+
offset: number;
|
|
20
|
+
length: number;
|
|
21
|
+
user?: TelegramUser;
|
|
22
|
+
}
|
|
23
|
+
export interface TelegramPhotoSize {
|
|
24
|
+
file_id: string;
|
|
25
|
+
file_unique_id?: string;
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
file_size?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface TelegramDocument {
|
|
31
|
+
file_id: string;
|
|
32
|
+
file_unique_id?: string;
|
|
33
|
+
file_name?: string;
|
|
34
|
+
mime_type?: string;
|
|
35
|
+
file_size?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface TelegramMessage {
|
|
38
|
+
message_id: number;
|
|
39
|
+
message_thread_id?: number;
|
|
40
|
+
is_topic_message?: boolean;
|
|
41
|
+
from?: TelegramUser;
|
|
42
|
+
chat: TelegramChat;
|
|
43
|
+
date?: number;
|
|
44
|
+
text?: string;
|
|
45
|
+
caption?: string;
|
|
46
|
+
entities?: TelegramMessageEntity[];
|
|
47
|
+
caption_entities?: TelegramMessageEntity[];
|
|
48
|
+
reply_to_message?: TelegramMessage;
|
|
49
|
+
photo?: TelegramPhotoSize[];
|
|
50
|
+
document?: TelegramDocument;
|
|
51
|
+
}
|
|
52
|
+
export interface TelegramUpdate {
|
|
53
|
+
update_id: number;
|
|
54
|
+
message?: TelegramMessage;
|
|
55
|
+
}
|
|
56
|
+
export interface TelegramSendOptions {
|
|
57
|
+
threadId?: number;
|
|
58
|
+
replyToMessageId?: number;
|
|
59
|
+
}
|
|
60
|
+
export interface TelegramMessageContext {
|
|
61
|
+
isPrivate: boolean;
|
|
62
|
+
isMentioned: boolean;
|
|
63
|
+
isReplyToBot: boolean;
|
|
64
|
+
isAllowed: boolean;
|
|
65
|
+
isListenChat: boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface TelegramIdentityCandidate {
|
|
68
|
+
updateId: number;
|
|
69
|
+
userId: string;
|
|
70
|
+
chatId: string;
|
|
71
|
+
chatType: TelegramChat["type"];
|
|
72
|
+
displayName: string;
|
|
73
|
+
username?: string;
|
|
74
|
+
}
|
|
75
|
+
export declare function runTelegramBot(config: AppConfig): Promise<number>;
|
|
76
|
+
export declare function parseTelegramIdList(raw: string): Set<string>;
|
|
77
|
+
export declare function classifyTelegramMessage(message: TelegramMessage, botUserId: string | null, botUsername: string | null, allowedUserIds: Set<string>, listenChatIds?: Set<string>): TelegramMessageContext;
|
|
78
|
+
export declare function shouldRespond(ctx: TelegramMessageContext): boolean;
|
|
79
|
+
export declare function extractTelegramIdentityCandidates(updates: TelegramUpdate[]): TelegramIdentityCandidate[];
|
|
80
|
+
export declare function telegramChatKey(message: TelegramMessage): string;
|
|
81
|
+
export declare function stripTelegramBotMention(content: string, botUsername: string | null): string;
|
|
82
|
+
export declare function formatTelegramUserMessageForHistory(message: TelegramMessage, botUsername: string | null, botUserId?: string | null): string;
|
|
83
|
+
export declare function formatTelegramReplyContext(message: TelegramMessage, botUsername: string | null, botUserId: string | null): string;
|
|
84
|
+
export declare function buildChatHistoryFromTelegramMessages(messages: TelegramMessage[], botUserId: string | null, botUsername: string | null, allowedUserIds: Set<string>): ChatTurn[];
|
|
85
|
+
export declare function chunkTelegramMessage(text: string, max?: number): string[];
|
|
86
|
+
export declare function formatTelegramBuildProgress(event: AiProgressEvent, options?: {
|
|
87
|
+
detail?: boolean;
|
|
88
|
+
}): string | null;
|
|
89
|
+
export declare function shouldUseTelegramDraftStream(message: TelegramMessage): boolean;
|
|
90
|
+
export declare function telegramSendPayload(chatId: string, content: string, options?: TelegramSendOptions): Record<string, unknown>;
|
|
91
|
+
export declare function telegramDraftPayload(message: TelegramMessage, draftId: number, text: string): Record<string, unknown>;
|
|
92
|
+
export declare function formatTelegramDraftProgress(event: AiProgressEvent): string | null;
|
|
93
|
+
export declare function loadTelegramHistories(filePath: string): Promise<Map<string, ChatTurn[]>>;
|
|
94
|
+
export declare function loadTelegramIntentRuntimes(filePath: string): Promise<Map<string, IntentRuntime>>;
|