Skip to content
Merged
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
14 changes: 14 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ jcode stores all configuration in a single JSON file at `~/.jcode/config.json`.
}
},

"channel": {
"web_enabled": true
},

"disabled_providers": []
}
```
Expand Down Expand Up @@ -191,6 +195,16 @@ Multi-agent team settings.

Set to `true` to auto-approve all tool calls. Equivalent to running with `--unsafe` flag.

### channel

Notification channel settings. See [Channels](overview/channels).

| Field | Default | Description |
|---|---|---|
| `web_enabled` | false | Enable WeChat channel in `jcode web` mode |

In TUI mode, channels are always available via `/channel` — no config needed.

## Changing Configuration

- **Setup wizard**: Run `jcode` and the wizard launches if config is missing
Expand Down
1 change: 1 addition & 0 deletions docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jcode is an AI-powered coding agent that runs in your terminal. You describe tas
| **MCP Integration** | Connect any MCP-compatible server for extended capabilities |
| **Session Resume** | Every conversation is recorded. Pick up where you left off |
| **Web Interface** | Browser-based UI with terminal access |
| **Channels** | Push notifications to WeChat when approval is needed or tasks complete |
| **Skills** | Domain-specific skill packs loaded on demand |

## Design Philosophy
Expand Down
139 changes: 139 additions & 0 deletions docs/overview/channels.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
---
title: Channels
parent: Overview
nav_order: 13
---

# Channels

Channels let jcode send push notifications to your messaging apps. When the agent needs your attention — approval required, task completed, or task failed — you get a message on your phone instead of having to watch the terminal.

Currently supported channels:

| Channel | Protocol | Status |
|---|---|---|
| **WeChat** | [iLink Bot API](https://ilinkai.weixin.qq.com) | Supported |

## How It Works

1. **Connect** — Scan a QR code to link your WeChat account
2. **Work normally** — Use jcode in the TUI or web interface
3. **Get notified** — When the agent waits for approval or finishes a task, you receive a WeChat message
4. **Send messages** — You can also send prompts to jcode directly from WeChat

Channels are a notification sidecar — they don't replace the TUI or web interface. The agent still runs locally; channels just let you step away without missing anything.

## WeChat Setup

### TUI (Terminal)

1. Open jcode and type `/channel`
2. Select **WeChat** → **Login**
3. Scan the QR code with your WeChat app
4. The channel auto-enables after a successful scan

```
You › /channel

┌─────────────────────────────┐
│ 📱 Channels │
│ │
│ WeChat Not connected │
│ ───────────────────────── │
│ [L] Login [D] Disable │
└─────────────────────────────┘
```

### Web Interface

1. Open **Settings** → **Channels** tab
2. Click **Connect** and scan the QR code with WeChat
3. After scanning, the channel is ready to use

Once connected, a **WeChat toggle** appears in the input toolbar (next to the Auto toggle). Use it to quickly enable or disable notifications without opening Settings.

To disconnect entirely, go back to **Settings** → **Channels** → **Disconnect**.

### Auto-Enable on Startup

If you've previously logged in, jcode remembers your credentials. On the next launch:

- **TUI mode** — The channel auto-enables automatically. No configuration needed.
- **Web mode** — Add `"channel": { "web_enabled": true }` to your config to auto-enable on startup. Without this, you can still enable manually via the toolbar toggle.

## Notifications

When the channel is enabled, you receive WeChat notifications for:

| Event | Notification |
|---|---|
| **Approval needed** | Tool name + arguments (sent after 10 seconds of no response) |
| **Task completed** | Summary of the agent's output |
| **Task failed** | Error message |
| **Session started** | Time-aware welcome message (TUI only) |
| **Session ended** | Time-aware goodbye message |

### Message Format

```
⏳ Approval Needed
————————————————
Tool: execute
Args: npm test
————————————————
Please return to terminal
```

```
✅ Task Completed
————————————————
All 42 tests passing. Updated the
README with the new API documentation.
```

### Time-Aware Messages

Welcome and goodbye messages adapt to the time of day:

| Time | Greeting |
|---|---|
| Before 6am | 🌙 Burning the midnight oil? |
| 6am–12pm | 🌅/☀️ Good morning! |
| 12pm–6pm | ☀️ Good afternoon! |
| 6pm–10pm | 🌆 Good evening! |
| After 10pm | 🌙 Working late? |

Weekend messages include a casual "Enjoy your weekend!" touch.

## Sending Messages from WeChat

You can send prompts to jcode directly from WeChat. Your message is submitted to the agent just as if you typed it in the TUI or web interface.

- In **web mode**, inbound WeChat messages appear in the web UI with a green **WeChat** label, so you can tell them apart from locally typed prompts.
- If the agent is currently busy, you'll receive an immediate reply letting you know your message has been queued.

When the channel is disabled, inbound messages are silently ignored.

## Configuration

Add to `~/.jcode/config.json`:

```json
{
"channel": {
"web_enabled": true
}
}
```

| Setting | Effect |
|---|---|
| `channel.web_enabled` | Auto-enable WeChat on `jcode web` startup (if already logged in) |

This setting only controls auto-enable. You can always connect and toggle the channel manually through the UI, even without this config.

In TUI mode, no configuration is needed — channels are always available via `/channel`.

### Credential Storage

WeChat credentials are stored at `~/.jcode/channel/wechat.json` and created automatically after the first successful login. Delete this file to force a re-login.
5 changes: 5 additions & 0 deletions docs/web-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ The web server exposes a REST API for programmatic access:
| `GET /api/mcp` | List MCP servers and status |
| `GET /api/skills` | List available skills |
| `POST /api/pty` | Create a terminal session |
| `GET /api/channel` | Get channel connection status |
| `POST /api/channel/login` | Start channel login (returns QR code) |
| `POST /api/channel/logout` | Disconnect channel |
| `POST /api/channel/enable` | Enable notifications |
| `POST /api/channel/disable` | Disable notifications |

{: .tip }
The REST API makes it easy to integrate jcode into your own tools and workflows.
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ require (
github.com/mailru/easyjson v0.9.0 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-runewidth v0.0.21 // indirect
github.com/mdp/qrterminal/v3 v3.2.1 // indirect
github.com/microcosm-cc/bluemonday v1.0.27 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
Expand Down Expand Up @@ -82,7 +83,9 @@ require (
golang.org/x/net v0.47.0 // indirect
golang.org/x/sync v0.19.0 // indirect
golang.org/x/sys v0.42.0 // indirect
golang.org/x/term v0.37.0 // indirect
golang.org/x/text v0.31.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
rsc.io/qr v0.2.0 // indirect
)
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.21 h1:jJKAZiQH+2mIinzCJIaIG9Be1+0NR+5sz/lYEEjdM8w=
github.com/mattn/go-runewidth v0.0.21/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
github.com/mdp/qrterminal/v3 v3.2.1 h1:6+yQjiiOsSuXT5n9/m60E54vdgFsw0zhADHhHLrFet4=
github.com/mdp/qrterminal/v3 v3.2.1/go.mod h1:jOTmXvnBsMy5xqLniO0R++Jmjs2sTm9dFSuQ5kpz/SU=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk=
Expand Down Expand Up @@ -260,3 +262,5 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
rsc.io/qr v0.2.0 h1:6vBLea5/NRMVTz8V66gipeLycZMl/+UlFmk8DvqQ6WY=
rsc.io/qr v0.2.0/go.mod h1:IF+uZjkb9fqyeF/4tlBoynqmQxUoPfWEKh921coOuXs=
Loading