grok-telegram-bot 2.2.3 → 2.3.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/.env.example +7 -4
- package/CHANGELOG.md +51 -0
- package/README.md +18 -8
- package/package.json +1 -1
- package/src/app/accounts.ts +35 -0
- package/src/app/stt.ts +5 -2
- package/src/app/types.ts +16 -2
- package/src/bot/account-rotator.ts +22 -1
- package/src/bot/bot.ts +10 -0
- package/src/bot/callback.ts +74 -0
- package/src/bot/chat-controller.ts +90 -8
- package/src/bot/handlers/accounts.ts +15 -4
- package/src/bot/handlers/menu.ts +22 -5
- package/src/bot/handlers/projects.ts +11 -5
- package/src/bot/handlers/voice.ts +21 -4
- package/src/bot/image-return.ts +118 -14
- package/src/bot/prompt-content.ts +24 -5
- package/src/bot/session-runtime.ts +56 -10
- package/src/config.ts +8 -4
- package/src/grok/client.ts +39 -3
- package/src/grok/types.ts +18 -3
- package/src/render/image-output.ts +12 -0
- package/src/sessions/history.ts +2 -0
- package/scripts/_tmp-release.mjs +0 -16
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt appendix so the agent keeps generated images in the session media
|
|
3
|
+
* folder and mentions absolute paths (the bot delivers those as Telegram files).
|
|
4
|
+
*
|
|
5
|
+
* Keep tidy-idempotent (no trailing spaces / 3+ blank lines) so
|
|
6
|
+
* `cleanStoredText` can strip it by exact match after extractProgress/tidy.
|
|
7
|
+
*/
|
|
8
|
+
export const IMAGE_OUTPUT_DIRECTIVE = [
|
|
9
|
+
"IMAGE OUTPUT RULES:",
|
|
10
|
+
"When generating images (image_gen / image_edit) or saving image files, write them under the current Grok session media folder (session images/ or assets/) or the project images/ directory — not random temp locations.",
|
|
11
|
+
"Always mention the absolute path of each image file you create in your reply so the client can deliver it as a downloadable Telegram file.",
|
|
12
|
+
].join("\n");
|
package/src/sessions/history.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Reads only the tail of large logs to stay fast.
|
|
4
4
|
*/
|
|
5
5
|
import { closeSync, openSync, readSync, statSync } from "node:fs";
|
|
6
|
+
import { IMAGE_OUTPUT_DIRECTIVE } from "../render/image-output.js";
|
|
6
7
|
import { extractProgress, PROGRESS_DIRECTIVE } from "../render/progress.js";
|
|
7
8
|
import type { HistoryEntry, HistoryRole } from "./types.js";
|
|
8
9
|
|
|
@@ -161,6 +162,7 @@ function cleanStoredText(text: string): string {
|
|
|
161
162
|
if (!text) return text;
|
|
162
163
|
let t = extractProgress(text).cleaned;
|
|
163
164
|
if (t.includes(PROGRESS_DIRECTIVE)) t = t.split(PROGRESS_DIRECTIVE).join("").trim();
|
|
165
|
+
if (t.includes(IMAGE_OUTPUT_DIRECTIVE)) t = t.split(IMAGE_OUTPUT_DIRECTIVE).join("").trim();
|
|
164
166
|
return t;
|
|
165
167
|
}
|
|
166
168
|
|
package/scripts/_tmp-release.mjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { execSync } from "node:child_process";
|
|
2
|
-
|
|
3
|
-
function run(cmd) {
|
|
4
|
-
console.log(`$ ${cmd}`);
|
|
5
|
-
execSync(cmd, { stdio: "inherit" });
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// Annotated release tag (triggers GitHub Release workflow on push).
|
|
9
|
-
try {
|
|
10
|
-
run('git tag -a v2.2.3 -m "v2.2.3 — instant account rotate on 402 balance exhausted"');
|
|
11
|
-
} catch {
|
|
12
|
-
console.log("tag v2.2.3 already exists locally — continuing");
|
|
13
|
-
}
|
|
14
|
-
run("git push origin v2.2.3");
|
|
15
|
-
run("npm publish --access public");
|
|
16
|
-
console.log("done");
|