Skip to content

feat: add ton-trading-bot plugin & ton-bridge plugin & github-dev-assistant#10

Open
xlabtg wants to merge 68 commits intoTONresistor:mainfrom
xlabtg:main
Open

feat: add ton-trading-bot plugin & ton-bridge plugin & github-dev-assistant#10
xlabtg wants to merge 68 commits intoTONresistor:mainfrom
xlabtg:main

Conversation

@xlabtg
Copy link

@xlabtg xlabtg commented Mar 16, 2026

📋 Description of changes

This PR adds three new plug-ins to extend the functionality of the Teleton AI Agent.:

Plugin Purpose Number of tools
ton-bridge Quick access to the TON Bridge Mini App via inline buttons 3
ton-trading-bot Atomic tools for trading in TON (DeDust, STON.fi) 6
`github-dev-assistant' Full automation of the GitHub workflow from the chat 15

🔌 Details on plugins

🌉 TON Bridge Plugin

  • Beautiful inline buttons for launching the Mini App: https://t.me/TONBridge_robot?startapp
  • Support for customization of button text and emojis
  • Tools:
  • ton_bridge_open — open the bridge with a button
  • ton_bridge_about — send information about the project
    • ton_bridge_custom_message — custom message with a button
  • ⚡ Works with the support of TONBANKCARD

💹 TON Trading Bot Plugin

*WARNING: Trading cryptocurrency involves financial risks. The plugin does not provide financial recommendations.

Architecture according to the tool-provider pattern:

  • Plugin = atomic tools (data, validation, execution)
  • Agent = strategy (LLM makes decisions)

Tools:

Tool Description Category
ton_trading_get_market_data Getting DEX prices and quotes
/ ton_trading_get_portfolio Wallet balance and position data-bearing
ton_trading_validate_trade Checking limits and risks before the transaction data-bearing
ton_trading_simulate_trade Test transaction without real funds action
ton_trading_execute_swap Real swap on DeDust/STON.fi (only in BOS) action
ton_trading_record_trade Closing the transaction and logging PnL action

🔐 Risk Management:

  • `maxTradePercent' (default: 10%) — limit per trade
  • `minBalanceTON' (default: 1 TON) — minimum balance
  • scope: dm-only for execute_swap — real operations only in private messages

🐙 GitHub Dev Assistant Plugin

Full development cycle on GitHub directly from Telegram:

Category Tools
🔐 Authorization github_auth', github_check_auth`
📁 Repositories github_list_repos', github_create_repo`
📄 Files and branches github_get_file, github_update_file, github_create_branch
🔀 Pull Requests github_create_pr, github_list_prs, github_merge_pr
🐛 Issues github_create_issue, github_list_issues, github_comment_issue, github_close_issue
⚙️ GitHub Actions github_trigger_workflow

, Security:

  • Tokens are stored only in the sdk.secrets
  • CSRF state with TTL of 10 minutes
  • Automatic hiding of sensitive data in logs
  • The require_pr_review option to confirm the PR merger

✅ Checklist

  • All plugins comply with the architecture of the @teleton-agent/sdk
  • Added manifest.json and index.js with the export manifest
  • Tool return format: { success, data?, error? }
  • Operation in Teleton Agent runtime has been tested
  • Updated README with usage examples
  • Added unit tests (where applicable)
  • Compatibility with the config.yaml configuration has been verified

Testing

# Installing dependencies for each plugin
cd plugins/ton-bridge & npm install
cd ../ton-trading-bot & npm install
cd ../github-dev-assistant & npm install

# Running tests (where available)
cd github-dev-assistant & npm test

📝 Notes

  • All plugins are developed by Tony (AI Agent) under the supervision of Anton Poroshin
  • Studio: xlabtg
  • Plugin versions: ton-bridge@1.2.0 , ton-trading-bot@1.0.0 , github-dev-assistant@1.0.0

🔗 Related changes

  • Bringing plug-ins to a single SDK standard (see commits `fix(*): align plugin with teleton-agent SDK architecture')
  • Unification of the response format of the tools
  • Adding inline export of manifest for runtime validation

@xlabtg xlabtg changed the title feat: add ton-trading-bot plugin feat: add ton-trading-bot plugin & ton-bridge Mar 17, 2026
@xlabtg xlabtg changed the title feat: add ton-trading-bot plugin & ton-bridge feat: add ton-trading-bot plugin & ton-bridge plugin Mar 17, 2026
konard and others added 22 commits March 17, 2026 19:02
Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #1
Implements all 15 tools from issue #1:
- Auth (2): github_auth (OAuth 2.0 with CSRF state), github_check_auth
- Repos (2): github_list_repos, github_create_repo
- Files/Branches (3): github_get_file, github_update_file, github_create_branch
- PRs (3): github_create_pr, github_list_prs, github_merge_pr
- Issues (4): github_create_issue, github_list_issues, github_comment_issue, github_close_issue
- Actions (1): github_trigger_workflow

Architecture: modular lib/*.js separation (github-client, auth, repo-ops,
pr-manager, issue-tracker, utils), web-ui components (config-panel.jsx,
oauth-callback.html), Vitest tests (unit + integration with mocked API).

Security: tokens only in sdk.secrets, cryptographically random CSRF state
with 10-min TTL, token redaction in errors, require_pr_review merge policy.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
feat: add github-dev-assistant plugin — full GitHub workflow automation
Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #3
- Remove all sdk.inline.send() calls that caused 400/BOT_RESPONSE_TIMEOUT errors
- Tools now return structured inline result objects (article type with
  input_message_content + reply_markup) instead of sending messages directly
- Add sdk.bot.onInlineQuery handler with three results: open, about, custom
- Add query alias routing (ton-bridge:open, ton_bridge_open, etc.)
- Fix button label: no leading space when emoji is empty
- Support dynamic startParam in Mini App URL
- Bump version to 1.1.0 and declare bot.inline: true in manifest

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
refactor: rewrite ton-bridge plugin to inline-native architecture
Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #5
Fixes #5 — the plugin had architectural issues that
prevented the LLM from using it correctly:

- Renamed tools with ton_trading_ prefix for global uniqueness
- Removed embedded signal/strategy logic (ton_analyze_signal,
  ton_generate_plan, ton_switch_mode) — the LLM now owns strategy decisions
- Fixed sdk.ton.dex API calls: use dex.quote({fromAsset,toAsset,amount})
  and dex.swap() instead of the non-existent dex.quoteDeDust/quoteSTONfi
  variants with wrong parameter shapes
- Fixed sdk.telegram.sendMessage calls to use (chatId, text) signature
- Removed sdk.ton.validate_risk() call (non-existent SDK method)
- Removed autoTrade config gate from execute path — LLM decides when to act
- Collapsed from 10 tools to 6 atomic, well-named tools:
    ton_trading_get_market_data, ton_trading_get_portfolio,
    ton_trading_validate_trade, ton_trading_simulate_trade,
    ton_trading_execute_swap, ton_trading_record_trade
- Simplified DB schema (trade_journal + sim_balance)
- Updated manifest.json and README.md to match new architecture
- Updated registry.json description and tags

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #7
refactor: rewrite ton-trading-bot as atomic tool-provider plugin
- Remove sdk.bot.onInlineQuery handler (never executed in MTProto agent)
- Fix tool return format: was { success, data: { type: "article", ... } },
  now returns agent-compatible { content, reply_markup }
- Add proper manifest.json following the same structure as other plugins
- Remove TypeScript build files (index.ts, manifest.ts, tsconfig.json,
  tsup.config.ts) — the plugin uses plain JS like all other plugins
- Use optional chaining (?.)) for sdk.log and sdk.pluginConfig access
  to avoid crashes if they are not provided

Fixes #7

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix(ton-bridge): rewrite plugin for LLM tool agent compatibility
Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #9
Fixes critical incompatibilities identified in issue #9:

1. **Return format**: All tools now return `{ content: string }` (human-readable
   text) instead of `{ success, data }` JSON blobs. The LLM agent directly
   reads `content` and presents it to the user without extra parsing.

2. **Authentication**: Replaced OAuth 2.0 flow (incompatible with agent runtime —
   no callback handler) with Personal Access Token (PAT) via `sdk.secrets`.
   Set `github_token` secret to connect. Removed `github_auth` tool and the
   OAuth `lib/auth.js` module. Updated `manifest.json` secrets declaration.

3. **Client instantiation**: GitHub client is now created inside each tool's
   `execute()` function (not shared at SDK init time), so token updates in
   `sdk.secrets` are always picked up — no stale client issues.

4. **LLM-friendly descriptions**: All tool descriptions rewritten from technical
   API docs to intent-level ("Use this when the user wants to...") so the LLM
   can correctly decide when to call each tool.

5. **Normalized output**: List tools (repos, PRs, issues) return formatted
   Markdown lists instead of raw JSON arrays. Errors include a human-readable
   prefix ("Failed to list repositories: ...").

6. **Tests**: All 38 tests updated and passing — auth tests cover new PAT flow,
   integration tests use `global.fetch` mocking instead of injected client mock.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix(github-dev-assistant): rewrite plugin for LLM agent compatibility
fix(github-dev-assistant): align plugin with teleton-agent SDK architecture
@xlabtg xlabtg changed the title feat: add ton-trading-bot plugin & ton-bridge plugin feat: add ton-trading-bot plugin & ton-bridge plugin & github-dev-assistant Mar 18, 2026
konard and others added 28 commits March 18, 2026 23:13
Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #17
…ding

Root cause: the plugin shipped package.json + package-lock.json containing
only a devDependency (vitest for testing). The teleton-agent's ensurePluginDeps()
sees these files and runs `npm ci --ignore-scripts` (with NODE_ENV=production)
on every startup. In production mode, npm skips devDependencies and does not
create node_modules/.package-lock.json — so the staleness check never marks
deps as up-to-date, causing npm ci to re-run every time. In non-production
environments, npm ci installs vitest (~50 MB) which is unnecessary at runtime.
If npm ci times out or fails in constrained environments, it can delay or
prevent the plugin from loading correctly.

Changes:
- Remove package.json + package-lock.json: plugin has zero runtime npm deps;
  only vitest (dev) was listed, which was never needed to run the plugin
- Remove lib/auth.js: dead code — implemented OAuth flow but was never
  imported by index.js or any other lib file; also contained sdk.storage
  calls that require migrate() to succeed first
- Remove tests/ directory: test files belong in a dev environment, not in
  the plugin distribution installed by end users
- Remove web-ui/ directory: config-panel.jsx references non-existent SDK
  APIs (sdk.i18n, sdk.plugin.call, sdk.secrets.delete, sdk.pluginConfig)
  and a tool (github_auth) not exported by the plugin
- Fix manifest.json author: was an object {name, url} but Zod schema expects
  a string; adaptPlugin's fallback correctly extracted the name, but the
  inline validation silently dropped the manifest causing the plugin name
  to fall back to the directory entry name
- Fix registry.json: description said "via OAuth" but plugin uses PAT;
  removed stale "oauth" tag

The plugin's 14 tools (github_check_auth, github_list_repos, github_create_repo,
github_get_file, github_update_file, github_create_branch, github_create_pr,
github_list_prs, github_merge_pr, github_create_issue, github_list_issues,
github_comment_issue, github_close_issue, github_trigger_workflow) continue
to work correctly — all runtime functionality is in index.js and lib/.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix(github-dev-assistant): remove files that prevent clean module loading
Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #19
…r plugins

Both plugins were missing the required permissions field in manifest.json
as defined in CONTRIBUTING.md. Adding empty permissions array.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds 5 CI jobs and 1 Vercel deploy workflow as requested in issue #19:

CI / Build (Runtime): validates all plugins load correctly via Node.js
  ESM import, checks manifest.json required fields, and verifies tools
  export structure.

CI / Build (SDK with DTS): validates SDK plugins (tools as function),
  passes mock SDK, and generates TypeScript .d.ts declarations per
  plugin into dist/.

CI / Lint: ESLint with flat config covering all plugin JS files and
  CI scripts. Errors fail CI; style warnings are reported but don't block.

CI / Test: discovers and runs *.test.js / *.test.mjs files in plugin
  directories using Node's built-in test runner.

CI / TypeScript: type-checks CI scripts and any future .ts files via tsc.

Deploy to Vercel: preview deployment on PRs and production on main.
  Posts preview URL as PR comment.

Supporting files added:
  - package.json + package-lock.json: root dev deps (eslint, typescript,
    @ton/*, telegram) needed for runtime module resolution in CI
  - eslint.config.mjs: ESLint flat config with Node/browser globals
  - tsconfig.json: TypeScript config for scripts
  - scripts/validate-plugins.mjs: plugin validation logic
  - scripts/build-sdk.mjs: SDK build + DTS generation
  - scripts/run-tests.mjs: test discovery and runner

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
feat(ci): implement CI and deployment workflows
Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #21
- Fix author field: change from plain string to object with name+url
- Fix config field: rename non-standard "config" to "defaultConfig" with
  simple key-value format matching SDK expectations
- Set version to 1.0.0 as required
- Fix README: remove references to non-existent github_auth tool and
  OAuth flow (plugin uses PAT auth), correct tool count from 15 to 14,
  update setup instructions for PAT workflow
- Fix CHANGELOG: remove references to non-existent OAuth/Web UI features

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix version: align manifest.json, package.json, and inline manifest
  to 1.0.0 (was 1.2.0 in manifest/inline, 1.0.0 in package.json)
- Fix author: standardize to { name: "xlabtg", url } format per
  CONTRIBUTING.md (remove non-standard supervisor/role fields)
- Remove non-standard "enabled" from defaultConfig (not a plugin config)
- Remove non-standard author fields from inline manifest (role,
  supervisor, link) — runtime only reads name/version/sdkVersion/
  defaultConfig from inline manifest
- Add missing repository and funding fields to manifest.json
- Update README with accurate tool documentation and developer info

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Set version to 1.0.0 as required (was 2.0.0)
- Fix author: standardize to { name: "xlabtg", url } format per
  CONTRIBUTING.md (was "Tony (AI Agent)")
- Add missing defaultConfig to manifest.json (was only in inline
  manifest) — ensures registry and runtime both see config defaults
- Remove non-standard author fields from inline manifest (role,
  supervisor, link)
- Update README with accurate developer info and tool schema docs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The CI Plugin Dependencies workflow requires package-lock.json alongside
package.json. This was missing, causing the workflow to fail.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The deploy workflow fails on forks and PRs from external contributors
because the VERCEL_TOKEN secret is not available. Add a check step that
detects whether the token is present and skips all subsequent steps
gracefully when it is not.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fix: align github-dev-assistant, ton-bridge, ton-trading-bot with Teleton system
Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #23
…emove buttonEmoji

Previously the plugin returned reply_markup in tool data and relied on
the runtime/agent to render the button, which did not work correctly
in DMs, groups, or channels.

Changes:
- All three tools now call sdk.telegram.sendMessage() with an
  inlineKeyboard URL button, sending the message directly to the chat
- Add optional buttonText parameter to each tool so the LLM can
  control the button label (including omitting emoji) per call
- Remove buttonEmoji from defaultConfig and inline manifest — emoji
  should be opt-in via the buttonText parameter, not hardcoded
- Use PluginSDKError-aware error handling as per patterns.md
- Update README to document new behavior and buttonText parameter

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix(ton-bridge): send button directly via sdk.telegram.sendMessage, remove buttonEmoji
Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #25
…l failure

The ton-bridge plugin had package.json and package-lock.json files but
declared no npm dependencies. The PluginLoader in teleton-agent runs
`npm ci` for any plugin directory that contains both files, causing
`Error: spawn npm ENOENT` in environments where npm is not in PATH
(e.g. the agent's production runtime). This prevented the plugin from
being marked as available, resulting in the "TON Bridge недоступен —
модуль не запущен" message.

Plugins with no external dependencies should not have package.json —
consistent with all other zero-dependency plugins in the repo (boards,
casino, crypto-prices, dyor, example, fragment, etc.).

Also adds 25 unit tests covering manifest exports, all three tools
(ton_bridge_open, ton_bridge_about, ton_bridge_custom_message),
buttonText fallback logic, startParam URL building, and error handling.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix(ton-bridge): remove empty package.json/lock to prevent npm install failure
Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #27
… config.yaml entry required

The plugin is auto-loaded from ~/.teleton/plugins/ directory — no
plugins: section entry is needed in config.yaml. Configuration is
optional: defaultConfig provides working defaults out of the box.

Updated README.md to:
- Clarify auto-loading behavior after installation
- Move usage examples before configuration (matches other plugins)
- Mark configuration as optional with explicit note
- Use section naming consistent with other plugins (Install, Usage examples, Tool schemas)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
docs(ton-bridge): clarify auto-loading and optional config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants