Skip to content
This repository was archived by the owner on Jun 23, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED=false
REACT_APP_DISABLE_WEBCONTAINER=false

# Your standalone repo URL (sidebar GitHub link)
# REACT_APP_PROJECT_GITHUB_URL=https://github.com/ViberKoder/TON-IDE-2.0

REACT_APP_ANALYTICS_ENABLED=
REACT_APP_MIXPANEL_TOKEN=

# TON IDE 2.0 — AI agent runtime (Phase 1+, server-side recommended)
# REACT_APP_AGENT_API_URL=/api/agent
# AGENT_API_PROXY=http://127.0.0.1:8787
# OPENAI_API_KEY=
# TON_API_KEY=
89 changes: 38 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,73 +1,60 @@
# What is TON Web IDE?
# TON IDE 2.0

It is your ultimate browser-based IDE designed to simplify the journey of writing, testing, compiling, deploying, and interacting with smart contracts on TON. Write smart contracts from anywhere, No setups, no downloads, just pure convenience and versatility.
Browser-based IDE for [TON](https://ton.org) smart contract development: FunC, Tact, Tolk, compile, sandbox tests, deploy, and **AI agents** with tool-calling and MCP.

# What we offer 🤝
Previously known as TON Web IDE ([ide.ton.org](https://ide.ton.org)). This tree is intended as a **standalone repository** (not a GitHub fork). See [docs/NEW_REPOSITORY.ru.md](./docs/NEW_REPOSITORY.ru.md) for publishing to a new repo.

- User-friendly Code Editor & Syntax Highlighter
- Efficient File Manager & Compiler
- One-click deployment using TON Web IDE - Sandbox, Testnet, Mainnet
- Easy Interaction with Contract
## Features

# We Are Live on 🤩
- Monaco editor, WebContainer, `@ton/sandbox`
- FunC / Tact compile, Misti analyzer, TonConnect deploy
- **AI agents**: Contract, Jetton, DeFi, Frontend, Security
- Templates: blank, counter, **Jetton**, **AMM**
- MCP: TonAPI, TON docs (via `server/agent-api`)
- Plugins, cloud jobs (MVP), shared team context

We are pleased to announce that our project is now live, and you can access it at [ide.ton.org](https://ide.ton.org/)
Architecture: [docs/TON_IDE_2.0.md](./docs/TON_IDE_2.0.md) · Agent system: [docs/AGENT_SYSTEM.md](./docs/AGENT_SYSTEM.md)

## IDE Preview

![IDE Preview](/images/screenshot.jpg)

## Local Setup

To set up the project locally for development, ensure that Node.js v18 LTS or higher is installed, and follow these steps:

### Steps

1. **Clone the repository**
2. **Install the dependencies**: After cloning the repository, navigate to the project directory and install the dependencies:

```bash
npm install
```

3. **Run the development server**

```bash
npm run dev
```

4. **Open the project in the browser**: Once the development server is running, open your browser and navigate to:

```
http://localhost:3000
```

This will load the local version of the IDE.

Ensure that you configure any necessary environment variables in a `.env` file. You can create this file by copying `.env.example` and modifying it with your own values.
## Quick start

```bash
npm install
npm run agent-api:install
cp .env.example .env

# terminal 1
npm run agent-api:dev

# terminal 2
npm run dev
```

### Building for Production
Open http://localhost:3000 — sidebar **TON AI Agent**.

To create an optimized production build of the application, use the following command:
## Environment

```bash
npm run build
```
| Variable | Purpose |
|----------|---------|
| `REACT_APP_AGENT_API_URL` | Agent API base (default `/api/agent`) |
| `AGENT_API_PROXY` | Webpack dev proxy target (default `http://127.0.0.1:8787`) |
| `OPENAI_API_KEY` | LLM for agent-api |
| `TON_API_KEY` | TonAPI for MCP |
| `REACT_APP_PROJECT_GITHUB_URL` | GitHub link in sidebar (default: ViberKoder/TON-IDE-2.0) |

After the build process is complete, you can start the production server:
## Production build

```bash
npm run build
npm start
```

## Feedback
## License

We have put significant effort into developing and refining our codebase, and we invite developers, collaborators, and enthusiasts to explore our repository. Your feedback, contributions, and engagement with our project are highly valued as we continue to evolve and improve our platform. Thank you for your interest, and we look forward to building a vibrant and productive community around our GitHub repository.
MIT — see [LICENSE](./LICENSE). Based on MIT-licensed TON Web IDE; attribution to TON Community and original contributors.

## License
## Publishing your own repo

MIT
```bash
./scripts/publish-standalone-repo.sh
# then push standalone-main to your new GitHub repository
```
59 changes: 59 additions & 0 deletions docs/AGENT_SYSTEM.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# TON IDE Agent System

## Agent definition

Each agent is configured in `src/features/agent/config.ts`:

- `id`, `name`, `description` — UI
- `skillPath` — markdown skill (system instructions)
- `tools` — allowed tool IDs from the tool registry
- `defaultModel` — optional model hint for the runtime

## Skill format

Skills live under `src/features/agent/skills/<id>.md`:

1. Role and expertise boundaries
2. TON-specific conventions (cells, messages, gas, bounce)
3. Language notes (FunC vs Tact vs Tolk)
4. Checklists (deploy, security)
5. References to official docs

Skills are loaded at runtime and prepended to the model context.

## Tool registry

Tools are registered in `src/features/agent/tools/registry.ts` (planned). Each tool has:

- JSON schema for parameters
- `execute(context, args)` — calls IDE services (compile, FS, sandbox)
- Permission level: `read` | `write` | `chain`

## MCP integration

MCP servers are declared in config and spawned by the agent host (desktop or backend). The IDE passes:

- Project root path (virtual FS mount)
- Active network
- User-approved wallet session id

Browser-only mode may proxy MCP through a same-origin backend to avoid CORS and secret exposure.

## Message flow

1. User sends prompt in Agent Panel
2. Context builder attaches project snapshot
3. Router selects agent + tools
4. Model streams response; tool calls loop until done
5. Patches applied via diff preview (user approves writes)

## Environment variables (planned)

| Variable | Purpose |
|----------|---------|
| `TON_IDE_AI_GATEWAY_URL` | AI Gateway / API base |
| `TON_IDE_AI_API_KEY` | Provider key (server-side only) |
| `TON_API_KEY` | TonAPI for MCP |
| `TONCENTER_API_KEY` | Toncenter for MCP |

Never commit secrets. Use `.env` locally and deployment secrets in production.
56 changes: 56 additions & 0 deletions docs/NEW_REPOSITORY.ru.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Новый репозиторий (без форка)

Проект подготовлен как **самостоятельный** TON IDE 2.0, не как GitHub Fork `tact-lang/web-ide`.

## 1. Создайте пустой репозиторий на GitHub

1. [github.com/new](https://github.com/new)
2. Имя, например: `ton-ide` или `ton-ide-2`
3. **Не** включайте «Add a README» / license (у нас уже есть в коде)
4. **Не** создавайте через Fork — только **New repository**

## 2. Опубликуйте код с чистой историей

Из корня проекта:

```bash
chmod +x scripts/publish-standalone-repo.sh
./scripts/publish-standalone-repo.sh
```

Скрипт создаёт ветку `standalone-main` с одним initial commit (без истории форка).

Затем привяжите новый remote (подставьте свой URL):

```bash
git remote remove origin # если старый origin — форк ton-ide
git remote add origin https://github.com/ViberKoder/TON-IDE-2.0.git
git push -u origin standalone-main:main
```

## 3. Что изменено в коде для независимости

- `package.json` — имя `ton-ide`, поле `repository` под ваш URL
- `AppConfig` / UI — бренд **TON IDE 2.0**
- `AppData` — ссылка на GitHub из `REACT_APP_PROJECT_GITHUB_URL` или заглушка
- MIT license сохранён (TON Community / исходный web-ide)

## 4. Upstream (опционально)

Если нужно подтягивать фиксы из [tact-lang/web-ide](https://github.com/tact-lang/web-ide):

```bash
git remote add upstream https://github.com/tact-lang/web-ide.git
git fetch upstream
# cherry-pick или merge по необходимости
```

Это **не** делает ваш репозиторий форком — только второй remote для сравнения.

## 5. CI / Deploy

Файлы `.github/workflows/` и `helm/` завязаны на инфраструктуру TON Studio. В новом репе обновите:

- secrets и `vars` в GitHub Actions
- `DEPLOY_REPO`, `APP_NAME` в workflow deploy
- домен в `AppConfig.host` и nginx
149 changes: 149 additions & 0 deletions docs/TON_IDE_2.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# TON IDE 2.0 — видение и архитектура

TON IDE 2.0 — специализированная среда разработки для экосистемы TON: «Cursor для блокчейна TON», где AI-агенты, инструменты и контекст заточены под смарт-контракты, dApp и on-chain продукты.

Текущая база — [TON Web IDE](https://ide.ton.org) (этот репозиторий): Monaco, WebContainer, FunC/Tact, sandbox, deploy, Misti, git, verifier.

## Цели 2.0

| Направление | Сейчас (1.x) | Цель (2.0) |
|-------------|--------------|------------|
| AI | Нет | Агенты с глубоким знанием TON, FunC, Tolk, Tact |
| Языки | FunC, Tact | + Tolk, Blueprint-first workflows |
| Шаблоны | Counter, blank | Jetton (TEP-74/89), NFT, AMM/DEX, staking, governance |
| Контекст | Файлы проекта | Проект + ABI + sandbox trace + on-chain state |
| Инструменты | Встроенные панели | Единый tool layer + MCP для внешних сервисов |
| Расширяемость | Монолит | Плагины, skills, MCP-серверы |

## Архитектура (высокий уровень)

```mermaid
flowchart TB
subgraph UI["TON IDE UI"]
Editor[Monaco Editor]
AgentPanel[AI Agent Panel]
Tools[Build / Test / Deploy / Audit]
end

subgraph AgentLayer["Agent Runtime"]
Router[Agent Router]
Skills[TON Skills Library]
Memory[Project + Chain Memory]
end

subgraph ToolLayer["Tool Layer"]
Local[Local Tools: compile, test, misti]
MCP[MCP Servers]
end

subgraph Chain["TON"]
Sandbox["@ton/sandbox"]
Networks[Testnet / Mainnet]
APIs[TonAPI / Toncenter]
end

Editor --> Router
AgentPanel --> Router
Router --> Skills
Router --> Memory
Router --> ToolLayer
Local --> Sandbox
MCP --> APIs
Tools --> Local
Tools --> Networks
```

## AI-агенты (роли)

1. **Contract Developer** — FunC, Tolk, Tact; opcodes, storage, messages, get-methods.
2. **Jetton Engineer** — TEP-74/89, minter/wallet, metadata, admin ops, custom fees.
3. **DeFi Architect** — AMM (constant product / stable), pools, LP, routing, oracle hooks.
4. **Frontend Integrator** — TonConnect, @ton/core, SDK для dApp.
5. **Security Auditor** — Misti, gas/storage, bounce/replay, access control.

Каждый агент использует общий **tool layer** и свой **skill** (system prompt + примеры + чеклисты).

## Tool Layer и MCP

Встроенные инструменты (уже в IDE или планируются):

- `compile_contract` — func-js / tact / tolk (когда добавим)
- `run_sandbox_tests` — Blueprint + @ton/sandbox
- `deploy_contract` — sandbox / testnet / mainnet
- `read_project_files` / `apply_patch` — работа с WebContainer FS
- `misti_analyze` — статический анализ Tact
- `verify_on_chain` — contract verifier
- `fetch_account_state` — баланс, код, данные по адресу

MCP-серверы (подключаемые, конфиг в IDE):

| Сервер | Назначение |
|--------|------------|
| `ton-api` | TonAPI / Toncenter: аккаунты, транзакции, jetton metadata |
| `ton-docs` | Поиск по docs.ton.org, TEP, cookbook |
| `blueprint` | Скaffold, deploy scripts, network config |
| `github-ton` | Шаблоны: jetton, dedust, ston-fi reference |
| `wallet` | TonConnect sign (с подтверждением пользователя) |

## Контекст для агентов

Агент получает структурированный контекст (не только сырой чат):

```json
{
"project": { "language": "tact", "template": "jetton", "root": "/project" },
"openFiles": ["contracts/jetton.tact"],
"build": { "lastCompile": "ok", "bocHash": "..." },
"sandbox": { "lastTestRun": "3 passed" },
"chain": { "network": "testnet", "contractAddress": "EQ..." },
"abi": { "...": "..." }
}
```

## Шаблоны продуктов (roadmap)

- **Jetton** — master + wallet, mint/burn/transfer, custom payload
- **AMM DEX** — pool, router, LP jetton, swap quotes (reference: DeDust / STON patterns)
- **NFT** — TEP-62 collection + item
- **Staking / vesting** — timelocks, claims
- **Governance** — voting jetton, proposals

## Этапы внедрения

### Фаза 0 — Foundation

- Документация 2.0
- UI-панель агента (shell)
- Типы, конфиг агентов и MCP
- Skills в `src/features/agent/skills/`

### Фаза 1 — Agent MVP (реализовано)

- `server/agent-api` — chat + mock/OpenAI, MCP ton-api/docs
- `src/services/*` — compile, test, FS, misti, deploy stub
- Tool registry + Agent Panel с tool loop и patch approve
- Webpack/nginx proxy `/api/agent`

### Фаза 2 — TON-native depth (реализовано)

- Tolk: language id, подсветка, compile stub
- Шаблоны `tonJetton`, `tonAmm` (Tact)
- MCP handlers в agent-api

### Фаза 3 — Ecosystem (MVP реализовано)

- `ton-ide-plugin.json` loader + Settings UI
- Cloud jobs API + панель в Agent
- `.ide/shared-context.json` + share URL `?share=`

## Технические решения

- **Frontend**: остаётся React + Monaco + WebContainer (быстрый старт в браузере).
- **Agents**: Vercel AI SDK или AI Gateway — streaming, structured tools, provider routing.
- **Desktop (опционально)**: Electron/Tauri + локальный MCP — для power users.
- **Безопасность**: все on-chain действия только через TonConnect с явным approve; API keys только в env, не в репозитории.

## Связанные документы

- [Agent System](./AGENT_SYSTEM.md) — роли, tools, skills format
- [README](../README.md) — локальный запуск 1.x
Loading