grok-telegram-bot 2.4.0 → 2.5.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.
Files changed (78) hide show
  1. package/.env.example +38 -2
  2. package/CHANGELOG.md +119 -1
  3. package/README.md +58 -15
  4. package/docs/GROUP.md +225 -0
  5. package/docs/INSTALL.md +3 -0
  6. package/package.json +1 -1
  7. package/src/app/lifetime-flag.ts +20 -0
  8. package/src/app/settings-store.ts +47 -8
  9. package/src/app/types.ts +12 -1
  10. package/src/app/updater.ts +24 -3
  11. package/src/bot/auth.ts +96 -15
  12. package/src/bot/bot.ts +122 -15
  13. package/src/bot/chat-controller.ts +52 -18
  14. package/src/bot/commands.ts +69 -29
  15. package/src/bot/deps.ts +3 -0
  16. package/src/bot/group-memory.ts +159 -0
  17. package/src/bot/handlers/accounts.ts +7 -0
  18. package/src/bot/handlers/control.ts +85 -32
  19. package/src/bot/handlers/document.ts +31 -4
  20. package/src/bot/handlers/forum.ts +207 -0
  21. package/src/bot/handlers/menu.ts +86 -24
  22. package/src/bot/handlers/message.ts +101 -21
  23. package/src/bot/handlers/photo.ts +123 -16
  24. package/src/bot/handlers/running.ts +150 -24
  25. package/src/bot/handlers/session-card.ts +13 -5
  26. package/src/bot/handlers/sessions.ts +68 -18
  27. package/src/bot/handlers/voice.ts +52 -7
  28. package/src/bot/image-return.ts +8 -5
  29. package/src/bot/menu/ephemeral.ts +13 -3
  30. package/src/bot/menu/keyboard.ts +53 -14
  31. package/src/bot/menu/refresh.ts +3 -1
  32. package/src/bot/menu/status-panel.ts +12 -6
  33. package/src/bot/permission-service.ts +19 -0
  34. package/src/bot/prompt-anchor.ts +300 -0
  35. package/src/bot/prompt-content.ts +3 -0
  36. package/src/bot/registry.ts +94 -1
  37. package/src/bot/scope.ts +94 -0
  38. package/src/bot/session-runtime.ts +647 -158
  39. package/src/bot/suggestions.ts +91 -31
  40. package/src/bot/telegram-actions.ts +440 -0
  41. package/src/bot/telegram-bots.ts +495 -0
  42. package/src/bot/telegram-io.ts +94 -10
  43. package/src/cli.ts +2 -0
  44. package/src/config.ts +201 -2
  45. package/src/forum/bind-path.ts +146 -0
  46. package/src/forum/manager.ts +651 -0
  47. package/src/forum/project-icon.ts +142 -0
  48. package/src/forum/thread.ts +16 -0
  49. package/src/forum/topic-store.ts +114 -0
  50. package/src/forum/types.ts +29 -0
  51. package/src/grok/client.ts +130 -28
  52. package/src/index.ts +205 -75
  53. package/src/projects/manager.ts +16 -3
  54. package/src/render/chunk.ts +17 -10
  55. package/src/render/hashtags.ts +5 -1
  56. package/src/render/session-comment.ts +64 -7
  57. package/src/render/telegram-bridge.ts +360 -0
  58. package/src/render/tool-call.ts +56 -37
  59. package/src/service/platform.ts +44 -7
  60. package/src/service/windows.ts +16 -4
  61. package/src/sessions/history.ts +50 -9
  62. package/src/sessions/process.ts +7 -0
  63. package/src/sessions/types.ts +2 -2
  64. package/src/stream/streamer.ts +17 -6
  65. package/scripts/analyze-jsonl.ts +0 -33
  66. package/scripts/delayed-restart.ps1 +0 -29
  67. package/scripts/probe-exit-response-shape.py +0 -77
  68. package/scripts/probe-plan-exit.py +0 -60
  69. package/scripts/probe-plan-exit2.py +0 -48
  70. package/scripts/probe-plan-fields.py +0 -41
  71. package/scripts/probe-plan-fields2.py +0 -58
  72. package/scripts/probe-plan-response-path.py +0 -48
  73. package/scripts/sample-claude-tooluse.ts +0 -21
  74. package/scripts/sample-kiro-events.ts +0 -31
  75. package/scripts/smoke-exit-plan.ts +0 -274
  76. package/scripts/smoke-exit-shapes.ts +0 -252
  77. package/scripts/smoke-import.mjs +0 -82
  78. package/scripts/smoke-import.ts +0 -73
@@ -1,73 +0,0 @@
1
- import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync } from "node:fs";
2
- import { homedir, tmpdir } from "node:os";
3
- import { join } from "node:path";
4
- import { buildImportPackage } from "../src/import/build-import.js";
5
- import { readForeignHistory } from "../src/import/history-readers.js";
6
- import { listRunningFromSource } from "../src/import/list-running.js";
7
- import { getImportSource, IMPORT_SOURCES } from "../src/import/sources.js";
8
-
9
- for (const src of IMPORT_SOURCES) {
10
- const running = listRunningFromSource(src);
11
- console.log("===", src.id, "running:", running.length);
12
- for (const s of running.slice(0, 3)) {
13
- const hist = readForeignHistory(src.format, src.sessionsRoot, s.sessionId);
14
- console.log(
15
- " -",
16
- s.sessionId.slice(0, 18),
17
- "entries=",
18
- hist.length,
19
- "bytes=",
20
- s.historyBytes,
21
- "cwd=",
22
- (s.cwd || "").slice(0, 48),
23
- );
24
- }
25
- }
26
-
27
- const kiro = getImportSource("kiro")!;
28
- const kRunning = listRunningFromSource(kiro);
29
- const withHist = kRunning.find((s) => s.historyBytes > 1000) || kRunning[0];
30
- if (withHist) {
31
- const dir = mkdtempSync(join(tmpdir(), "grok-imp-"));
32
- const pkg = buildImportPackage(kiro, withHist, dir);
33
- console.log("KIRO IMPORT", {
34
- entries: pkg.entryCount,
35
- chars: pkg.transcriptChars,
36
- truncated: pkg.truncatedInline,
37
- });
38
- console.log("file size", readFileSync(pkg.transcriptPath, "utf8").length);
39
- console.log("priming includes path", pkg.priming.includes(pkg.transcriptPath));
40
- rmSync(dir, { recursive: true, force: true });
41
- }
42
-
43
- const codex = getImportSource("codex")!;
44
- const cRunning = listRunningFromSource(codex);
45
- if (cRunning[0]) {
46
- const h = readForeignHistory(codex.format, codex.sessionsRoot, cRunning[0].sessionId);
47
- console.log("codex first", cRunning[0].sessionId, "entries", h.length);
48
- }
49
-
50
- const claude = getImportSource("claude")!;
51
- const files = existsSync(claude.sessionsRoot)
52
- ? readdirSync(claude.sessionsRoot).filter((f) => f.endsWith(".jsonl")).slice(0, 1)
53
- : [];
54
- if (files[0]) {
55
- const id = files[0]!.replace(/\.jsonl$/, "");
56
- const h = readForeignHistory(claude.format, claude.sessionsRoot, id);
57
- console.log("claude sample", id, "entries", h.length);
58
- }
59
-
60
- const msgRoot = join(homedir(), ".local", "share", "opencode", "storage", "message");
61
- if (existsSync(msgRoot)) {
62
- const dirs = readdirSync(msgRoot).filter((d) => d.startsWith("ses_")).slice(0, 3);
63
- for (const d of dirs) {
64
- const h = readForeignHistory(
65
- "opencode-storage",
66
- join(homedir(), ".local", "share", "opencode"),
67
- d,
68
- );
69
- console.log("opencode", d.slice(0, 24), "entries", h.length, h[0]?.role);
70
- }
71
- }
72
-
73
- console.log("OK");