teleton 0.1.4 → 0.1.6

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <h1 align="center">Teleton Agent</h1>
2
2
 
3
- <p align="center"><b>Your personal AI that lives on Telegram and trades on TON</b></p>
3
+ <p align="center"><b>Autonomous AI agent for Telegram with native TON blockchain integration</b></p>
4
4
 
5
5
  <p align="center">
6
6
  <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
@@ -233,7 +233,7 @@ The agent's personality and rules are configured via markdown files in `~/.telet
233
233
  ### Project Structure
234
234
 
235
235
  ```
236
- tonnet-ai/
236
+ teleton-agent/
237
237
  ├── src/
238
238
  │ ├── index.ts # Main app, tool registry
239
239
  │ ├── agent/ # Core agent runtime
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teleton",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Personal AI Agent for Telegram",
5
5
  "author": "ZKProof (https://t.me/zkproof)",
6
6
  "license": "MIT",
@@ -29,6 +29,7 @@
29
29
  "files": [
30
30
  "dist/",
31
31
  "bin/",
32
+ "scripts/",
32
33
  "src/templates/"
33
34
  ],
34
35
  "scripts": {
@@ -44,7 +45,7 @@
44
45
  "format:check": "prettier --check \"src/**/*.ts\"",
45
46
  "typecheck": "tsc --noEmit",
46
47
  "prepublishOnly": "npm run build",
47
- "postinstall": "bash scripts/patch-gramjs.sh || true",
48
+ "postinstall": "node scripts/postinstall.mjs",
48
49
  "prepare": "husky"
49
50
  },
50
51
  "dependencies": {
@@ -53,7 +54,6 @@
53
54
  "@mariozechner/pi-ai": "^0.50.9",
54
55
  "@orbs-network/ton-access": "^2.3.3",
55
56
  "@sinclair/typebox": "^0.34.48",
56
- "@ston-fi/api": "^0.30.0",
57
57
  "@ston-fi/sdk": "^2.7.0",
58
58
  "@ton/core": "^0.63.0",
59
59
  "@ton/crypto": "^3.3.0",
@@ -82,6 +82,7 @@
82
82
  "typescript": "^5.7.0"
83
83
  },
84
84
  "optionalDependencies": {
85
+ "@ston-fi/api": "^0.30.0",
85
86
  "edge-tts": "^1.0.1"
86
87
  },
87
88
  "engines": {
@@ -0,0 +1,46 @@
1
+ #!/bin/bash
2
+ # Patch GramJS TL schema to support KeyboardButtonStyle (Telegram layer 222)
3
+ # This adds colored button support for inline keyboards via MTProto.
4
+ #
5
+ # New constructors:
6
+ # keyboardButtonStyle#4fdd3430 - button color/style (bg_success, bg_danger, bg_primary)
7
+ # keyboardButtonCallback#e62bc960 - updated callback button with optional style field
8
+
9
+ set -euo pipefail
10
+
11
+ # Resolve path: works for both local dev and global npm install
12
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
13
+ PKG_ROOT="$(dirname "$SCRIPT_DIR")"
14
+ APITL="$PKG_ROOT/node_modules/telegram/tl/apiTl.js"
15
+
16
+ # Check if already patched
17
+ if grep -q "keyboardButtonStyle#4fdd3430" "$APITL" 2>/dev/null; then
18
+ echo "✅ GramJS TL schema already patched"
19
+ exit 0
20
+ fi
21
+
22
+ # Check if file exists
23
+ if [ ! -f "$APITL" ]; then
24
+ echo "⚠️ GramJS not found at $APITL, skipping patch"
25
+ exit 0
26
+ fi
27
+
28
+ # Verify the old constructor exists (guards against GramJS version changes)
29
+ if ! grep -q "keyboardButtonCallback#35bbdb6b" "$APITL"; then
30
+ echo "⚠️ Old keyboardButtonCallback#35bbdb6b not found, GramJS version may have changed"
31
+ exit 0
32
+ fi
33
+
34
+ # Patch: replace old keyboardButtonCallback with:
35
+ # 1. keyboardButtonStyle type (new)
36
+ # 2. keyboardButtonCallbackLegacy (old constructor kept for deserialization)
37
+ # 3. keyboardButtonCallback (new constructor with style field)
38
+ sed -i 's|keyboardButtonCallback#35bbdb6b flags:# requires_password:flags.0?true text:string data:bytes = KeyboardButton;|keyboardButtonStyle#4fdd3430 flags:# bg_primary:flags.0?true bg_danger:flags.1?true bg_success:flags.2?true icon:flags.3?long = KeyboardButtonStyle;\nkeyboardButtonCallbackLegacy#35bbdb6b flags:# requires_password:flags.0?true text:string data:bytes = KeyboardButton;\nkeyboardButtonCallback#e62bc960 flags:# requires_password:flags.0?true style:flags.10?KeyboardButtonStyle text:string data:bytes = KeyboardButton;|' "$APITL"
39
+
40
+ # Verify patch was applied
41
+ if grep -q "keyboardButtonStyle#4fdd3430" "$APITL"; then
42
+ echo "✅ GramJS TL schema patched (KeyboardButtonStyle + styled KeyboardButtonCallback)"
43
+ else
44
+ echo "❌ Failed to patch GramJS TL schema"
45
+ exit 1
46
+ fi
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ // Postinstall: patch GramJS TL schema + skip problematic dep scripts
3
+ import { execSync } from "child_process";
4
+ import { dirname, join } from "path";
5
+ import { fileURLToPath } from "url";
6
+
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
8
+ const root = dirname(__dirname);
9
+ const patchScript = join(root, "scripts", "patch-gramjs.sh");
10
+
11
+ try {
12
+ execSync(`bash "${patchScript}"`, { stdio: "inherit", cwd: root });
13
+ } catch {
14
+ // Non-fatal: styled buttons won't work but everything else will
15
+ console.log("⚠️ GramJS patch skipped (styled buttons disabled)");
16
+ }