Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

feat(packaging): add pyproject.toml and one-line install scripts

cyhhaob2ab51986f13
diff --git a/README.md b/README.md
index 79d054fb5..88ae0099f 100644
--- a/README.md
+++ b/README.md
@@ -1,202 +1,201 @@
<div align="center">
-<img src="assets/logo.png" alt="Vibe Remote" width="40"/>
+<img src="assets/logo.png" alt="Vibe Remote" width="80"/>
# Vibe Remote
-[Quick Start](#quick-start) · [Configuration](#configuration) · [Usage](#usage) · [Setup Guides](#setup-guides) · [Roadmap](#roadmap)
+### Code from your couch. Ship from the beach.
-[![Python](https://img.shields.io/badge/python-3.9%2B-3776AB)](https://www.python.org/)
-[![Platforms](https://img.shields.io/badge/platforms-Slack-4A90E2)](#setup-guides)
-[![License](https://img.shields.io/badge/license-MIT-green)](LICENSE)
-[![PRs](https://img.shields.io/badge/PRs-welcome-brightgreen)](CONTRIBUTING.md)
+**Control AI coding agents from Slack — no IDE required.**
+
+[![Python](https://img.shields.io/badge/python-3.9%2B-3776AB?labelColor=black&style=flat-square)](https://www.python.org/)
+[![License](https://img.shields.io/badge/license-MIT-green?labelColor=black&style=flat-square)](LICENSE)
+[![PRs](https://img.shields.io/badge/PRs-welcome-brightgreen?labelColor=black&style=flat-square)](CONTRIBUTING.md)
[English](README.md) | [中文](README_ZH.md)
+---
+
![Banner](assets/banner.jpg)
</div>
-_Remote vibe coding over chat — control AI coding agents (OpenCode, Claude Code, Codex, Cursor, etc.) from Slack._
-
-Vibe Remote lets you operate coding agents via Slack. Type in Slack to start and steer agents; describe intent and constraints, receive streaming results, and ship without being tied to a local IDE.
-
-## Why Vibe Remote
-
-- **Vibe coding, not micromanaging**: Let AI drive based on your intent and constraints; focus on outcomes.
-- **Work from anywhere**: Control coding sessions over Slack; no IDE tether.
-- **Extensible by design**: OpenCode-first, and also supports Claude Code + Codex; built to support additional coding agents/CLIs.
-- **Multi-agent routing**: Route each Slack channel to OpenCode, Claude Code, or Codex via Slack UI.
-- **Session persistence by thread + path**: Each Slack thread maintains its own agent session and working dir; auto‑resume via saved mappings.
-- **Interactive Slack UX**: `/start` menu + Settings/CWD modals; buttons over commands for faster flow.
-
-> Recommendation: Prefer Slack as the primary platform. Threaded conversations enable parallel subtasks and keep channel history tidy — each subtask stays in its own thread.
+## Why Vibe Remote?
-## Core Features
+You're on vacation. Your phone buzzes — a production bug.
-- **Platform-first**: Slack-first today; platform abstraction retained for future Vibe app
-- **Hands‑free flow**: Minimal review; messages stream back in real time
-- **Persistent sessions**: Per chat/thread sessions, easy resume
-- **Threaded Slack UX**: Clean, per‑conversation threads
-- **Working dir control**: Inspect and change `cwd` on the fly
-- **Personalization**: Toggle per-channel show message types (defaults hide all)
+With Vibe Remote, you don't scramble for your laptop. You open Slack, type what needs fixing, and watch the AI agent stream back the solution in real-time. Review, approve, done. Back to your margarita.
-## Architecture (Brief)
+**That's vibe coding.**
-- `BaseIMClient` + platform implementations (`slack.py`)
-- `IMFactory` to construct clients by platform config
-- `Controller` orchestrates sessions, formatting, and command routing
+- 🛋️ **Work from anywhere** — Slack is your IDE now
+- 🤖 **Multi-agent support** — OpenCode, Claude Code, Codex — switch per channel
+- 🧵 **Thread-based sessions** — Each conversation is isolated, resumable
+- ⚡ **Real-time streaming** — Watch your agent think and code live
+- 🔒 **Local-first** — Your code stays on your machine
-## Prerequisites
-
-- At least one coding agent CLI installed. Recommended: OpenCode (`opencode`). Also supported: Claude Code CLI and Codex CLI.
-
-### OpenCode (Recommended)
+---
-Install (Homebrew):
+## 30-Second Install
+**macOS / Linux:**
```bash
-brew install opencode
+curl -fsSL https://raw.githubusercontent.com/cyhhao/vibe-remote/master/install.sh | bash
```
-Install (script):
-
-```bash
-curl -fsSL https://opencode.ai/install | bash
+**Windows:**
+```powershell
+irm https://raw.githubusercontent.com/cyhhao/vibe-remote/master/install.ps1 | iex
```
-Verify:
-
+Then run:
```bash
-opencode --help
+vibe
```
-Enable in Vibe Remote:
+A web UI opens. Add your Slack tokens. Enable channels. Start vibing.
-- `OPENCODE_ENABLED=true`
-- Optional: `OPENCODE_CLI_PATH=opencode`, `OPENCODE_PORT=4096`
+---
-### Claude Code
+## How It Works
-Install:
-
-```bash
-npm install -g @anthropic-ai/claude-code
+```
+┌─────────────┐ ┌─────────────┐ ┌─────────────┐
+│ Slack │────▶│ Vibe Remote │────▶│ AI Agent │
+│ (You type) │ │ (Routes) │ │ (Codes) │
+└─────────────┘ └─────────────┘ └─────────────┘
+ │
+ ▼
+ ┌─────────────┐
+ │ Your Local │
+ │ Codebase │
+ └─────────────┘
```
-Verify:
+1. **You** type in Slack: *"Fix the login bug in auth.py"*
+2. **Vibe Remote** routes to your chosen AI agent (OpenCode/Claude/Codex)
+3. **Agent** analyzes, writes code, streams back results
+4. **You** review in Slack, iterate with follow-ups
-```bash
-claude --help
-```
+All execution happens locally. Your code never leaves your machine.
-## Quick Start
+---
-1. Install
+## Quick Commands
-```bash
-curl -fsSL https://vibe.remote/install.sh | bash
-```
+| Command | What it does |
+|---------|--------------|
+| `/start` | Open the main menu |
+| `/stop` | Stop current agent session |
+| `/cwd` | Show working directory |
+| `/settings` | Configure message visibility |
-2. Run
+**Pro tip:** Use threads! Each thread maintains its own session and working directory.
-```bash
-vibe
-```
+---
-## Configuration
+## Per-Channel Agent Routing
-### Slack
+Different projects need different agents. Route them per channel:
-- `SLACK_BOT_TOKEN` (xoxb-...)
-- `SLACK_APP_TOKEN` (xapp-..., Socket Mode)
-- `SLACK_TARGET_CHANNELS` optional whitelist of allowed channel IDs (channels only, start with `C`). Leave empty or omit to accept all channels. DMs are not supported currently.
+| Channel | Agent | Why |
+|---------|-------|-----|
+| `#frontend` | OpenCode | Fast, great for UI work |
+| `#backend` | Claude Code | Deep reasoning for complex logic |
+| `#experiments` | Codex | Quick prototyping |
-### Claude Code
+Configure via the web UI at `http://localhost:5173/channels`.
-- `AGENT_DEFAULT_CWD` e.g. `./_tmp` (recommended)
-- Legacy alias: `CLAUDE_DEFAULT_CWD` (still supported)
-- `CLAUDE_PERMISSION_MODE` e.g. `bypassPermissions`
-- `CLAUDE_SYSTEM_PROMPT` optional
-- `ANTHROPIC_API_KEY` if required by your SDK setup
+---
-### Codex
+## Prerequisites
-- Install the [Codex CLI](https://github.com/openai/codex) (e.g., `brew install codex`) and sign in (`codex --help`).
-- `CODEX_ENABLED=true` (default) enables the agent; set to false only if the Codex CLI is unavailable. `CODEX_CLI_PATH` overrides the binary path.
-- `CODEX_DEFAULT_MODEL` / `CODEX_EXTRA_ARGS` customize the underlying model or flags.
+You need at least one coding agent CLI installed:
-### OpenCode
+<details>
+<summary><b>OpenCode</b> (Recommended)</summary>
-- OpenCode is enabled by `OPENCODE_ENABLED=true` (default: false). Ensure `opencode` is installed.
-- OpenCode runs as a local HTTP server started by Vibe Remote (`opencode serve --hostname=127.0.0.1 --port=4096`).
-- Default agent/model settings are read from `~/.config/opencode/opencode.json`, and can be overridden per Slack channel via the Agent Settings dialog.
+```bash
+brew install opencode
+# or
+curl -fsSL https://opencode.ai/install | bash
+```
+</details>
+
+<details>
+<summary><b>Claude Code</b></summary>
-### Agent routing
+```bash
+npm install -g @anthropic-ai/claude-code
+```
+</details>
-- Slack: use the built-in **Agent Settings** dialog to select the backend per channel (recommended).
-- Slack routes use channel IDs.
-- See [docs/CODEX_SETUP.md](docs/CODEX_SETUP.md) for Codex install and routing notes.
-- If OpenCode is enabled, the bot defaults to OpenCode; otherwise it falls back to Claude.
+<details>
+<summary><b>Codex</b></summary>
-### App
+```bash
+brew install codex
+```
+</details>
-- `LOG_LEVEL` default `INFO`
+---
-## Usage
+## CLI Reference
-### Commands
+```bash
+vibe # Start service + open web UI
+vibe status # Check if service is running
+vibe stop # Stop everything
+vibe doctor # Diagnose issues
+```
-- `/start` open menu / welcome
-- `/clear` reset conversation/session
-- `/cwd` show working directory
-- `/set_cwd <path>` change working directory
-- `/settings` configure message visibility
-- `/stop` force-stop the active agent session (Claude interrupt / Codex process kill)
+---
-### Subagent Prefix Routing
+## Uninstall
-Use `SubagentName:` or `SubagentName:` at the start of a message (leading spaces/newlines allowed) to invoke a subagent for the channel’s current agent backend.
+```bash
+vibe stop
+uv tool uninstall vibe-remote # or: pip uninstall vibe-remote
+rm -rf ~/.vibe_remote # Remove config (optional)
+```
-- Example: `Plan: outline the steps`
-- Matching is case-insensitive; only the channel’s bound agent is searched.
-- The subagent’s default model/reasoning are used automatically.
-- The bot adds a 🤖 reaction to your message when a subagent is matched.
+---
-### Slack
+## Documentation
-- In channels, run `/start` to open the interactive menu (Current Dir, Change Work Dir, Reset Session, Settings, How it Works)
-- The bot organizes each conversation as a thread; reply in the thread to continue
-- Slack DMs are not supported currently
-- Slash commands are limited in threads; to stop in a thread, type `stop` directly
+- **[Slack Setup Guide](docs/SLACK_SETUP.md)** — Create your Slack app in 5 minutes
+- **[中文安装指南](docs/SLACK_SETUP_ZH.md)** — Chinese setup guide
-## Setup Guides
+---
-- Slack: [English](docs/SLACK_SETUP.md) | [中文](docs/SLACK_SETUP_ZH.md)
+## Security
-## Releases
+- 🔐 Tokens stored locally in `~/.vibe_remote/config/config.json`
+- 🏠 Web UI runs on localhost only
+- 💻 All code execution happens on your machine
+- 🚫 No data sent to third parties (except your chosen AI provider)
-See GitHub Releases: https://github.com/cyhhao/vibe-remote/releases
+---
## Roadmap
-- Additional coding CLIs/agents beyond the current built-in set
-- More IM platforms (Discord, Teams)
-- File upload/attachments piping to coding sessions
-- Advanced session policies & permissions
+- [ ] More IM platforms (Discord, Teams)
+- [ ] File attachments support
+- [ ] Multi-workspace Slack support
+- [ ] SaaS mode with cloud relay
+
+---
## Contributing
-See `CONTRIBUTING.md`. By participating you agree to `CODE_OF_CONDUCT.md`.
+PRs welcome! See [CONTRIBUTING.md](CONTRIBUTING.md).
-## License
+---
-MIT. See `LICENSE`.
+<div align="center">
-## Security & Ops
+**Stop context-switching. Start vibe coding.**
-- **Secrets**: Never commit tokens. Store in `~/.vibe_remote/config/config.json` or your secret manager.
-- **Whitelists**: Restrict access via `SLACK_TARGET_CHANNELS` (channels only, `C…`). Leave empty to accept all channels (Slack DMs currently unsupported).
-- **Logs**: Runtime logs at `~/.vibe_remote/logs/vibe_remote.log`.
-- **Session persistence**: `~/.vibe_remote/state/sessions.json` stores per‑thread session mappings; persist this file in production.
-- **Cleanup**: Set `CLEANUP_ENABLED=true` to safely prune completed receiver tasks during message handling for long‑running processes.
+[Install Now](#30-second-install) · [Setup Slack](docs/SLACK_SETUP.md) · [Report Bug](https://github.com/cyhhao/vibe-remote/issues)
+
+</div>
diff --git a/README_ZH.md b/README_ZH.md
index d68756ef0..66b30ad2d 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -1,202 +1,201 @@
<div align="center">
-<img src="assets/logo.png" alt="Vibe Remote" width="40"/>
+<img src="assets/logo.png" alt="Vibe Remote" width="80"/>
# Vibe Remote
-[快速开始](#快速开始) · [配置](#配置) · [使用方式](#使用方式) · [安装指南](#setup-guides) · [Roadmap](#roadmap)
+### 躺在沙发上写代码,在海边发布上线
-[![Python](https://img.shields.io/badge/python-3.9%2B-3776AB)](https://www.python.org/)
-[![Platforms](https://img.shields.io/badge/platforms-Slack-4A90E2)](#setup-guides)
-[![License](https://img.shields.io/badge/license-MIT-green)](LICENSE)
-[![PRs](https://img.shields.io/badge/PRs-welcome-brightgreen)](CONTRIBUTING.md)
+**在 Slack 里操控 AI 编码代理 — 不需要 IDE**
+
+[![Python](https://img.shields.io/badge/python-3.9%2B-3776AB?labelColor=black&style=flat-square)](https://www.python.org/)
+[![License](https://img.shields.io/badge/license-MIT-green?labelColor=black&style=flat-square)](LICENSE)
+[![PRs](https://img.shields.io/badge/PRs-welcome-brightgreen?labelColor=black&style=flat-square)](CONTRIBUTING.md)
[English](README.md) | [中文](README_ZH.md)
+---
+
![Banner](assets/banner.jpg)
</div>
-_在 Slack 里通过聊天远程操控 AI 代理(如 OpenCode、Claude Code、Codex、Cursor),进行 Vibe Coding。_
-
-Vibe Remote 把 AI 写代码搬到聊天软件。你在 Slack 输入意图与约束,它会驱动相应的 AI agent 执行并反馈;结果实时流式返回,无需本地 IDE,随时随地推进任务。
-
-## 为什么选择 Vibe Remote
-
-- **专注 vibe coding**:基于你的意图与约束让 AI 自主推进,你只把控方向与结果。
-- **随时随地**:不被 IDE 束缚,直接在 Slack 中远程操控编码会话。
-- **为扩展而生**:OpenCode 优先,同时支持 Claude Code + Codex;并可扩展到更多 coding agents/CLIs。
-- **多 Agent 路由**:通过 Slack UI 为不同 Channel 选择 OpenCode / Claude Code / Codex。
-- **按线程 + 路径持久化**:每个 Slack 线程维持独立 Agent 会话与工作目录,并通过持久化映射自动恢复。
-- **Slack 交互式体验**:`/start` 菜单 + Settings/CWD 模态,按钮优先于命令,更快上手。
-
-> 推荐:优先使用 Slack 作为主要平台。其线程模型更适合并行子任务,也能保持频道历史整洁(每个子任务都在各自的线程里)。
+## 为什么用 Vibe Remote?
-## 核心特性
+你在度假。手机响了 — 生产环境出 bug 了。
-- **平台优先**:V2 先聚焦 Slack;平台抽象保留以支持未来 Vibe App
-- **免干预工作流**:最小 review,实时流式回传消息
-- **持久会话**:按聊天/线程维度持久化,可随时恢复
-- **Slack 线程化 UX**:每个会话独立线程,保持频道整洁
-- **工作目录控制**:随时查看与更改 `cwd`
-- **个性化**:按频道自定义显示消息类型(默认全部隐藏)
+有了 Vibe Remote,你不用手忙脚乱找电脑。打开 Slack,打几个字说明要修什么,然后看着 AI 实时把解决方案写出来。审查、确认、搞定。继续喝你的玛格丽塔。
-## 架构(简述)
+**这就是 vibe coding。**
-- `BaseIMClient` + 平台实现(`modules/im/slack.py`)
-- `IMFactory` 通过配置创建客户端
-- `Controller` 统一编排会话、格式化与命令路由
+- 🛋️ **随时随地工作** — Slack 就是你的 IDE
+- 🤖 **多 Agent 支持** — OpenCode、Claude Code、Codex — 按频道切换
+- 🧵 **基于线程的会话** — 每个对话独立,可恢复
+- ⚡ **实时流式输出** — 看着 AI 思考和写代码
+- 🔒 **本地优先** — 代码不离开你的电脑
-## 先决条件
+---
-- 至少安装一个 Agent CLI。推荐优先使用 OpenCode(`opencode`),同时也支持 Claude Code 与 Codex,方便在不同频道切换。
-
-### OpenCode(推荐)
-
-安装(Homebrew):
+## 30 秒安装
+**macOS / Linux:**
```bash
-brew install opencode
+curl -fsSL https://raw.githubusercontent.com/cyhhao/vibe-remote/master/install.sh | bash
```
-安装(脚本):
+**Windows:**
+```powershell
+irm https://raw.githubusercontent.com/cyhhao/vibe-remote/master/install.ps1 | iex
+```
+然后运行:
```bash
-curl -fsSL https://opencode.ai/install | bash
+vibe
```
-验证:
+Web 界面会自动打开。添加你的 Slack token。启用频道。开始 vibe。
-```bash
-opencode --help
-```
+---
-在 Vibe Remote 中启用:
+## 工作原理
-- `OPENCODE_ENABLED=true`
-- 可选:`OPENCODE_CLI_PATH=opencode`、`OPENCODE_PORT=4096`
+```
+┌─────────────┐ ┌─────────────┐ ┌─────────────┐
+│ Slack │────▶│ Vibe Remote │────▶│ AI Agent │
+│ (你输入) │ │ (路由) │ │ (写代码) │
+└─────────────┘ └─────────────┘ └─────────────┘
+ │
+ ▼
+ ┌─────────────┐
+ │ 你的本地 │
+ │ 代码库 │
+ └─────────────┘
+```
-### Claude Code
+1. **你**在 Slack 输入:*"修复 auth.py 里的登录 bug"*
+2. **Vibe Remote** 路由到你选的 AI(OpenCode/Claude/Codex)
+3. **Agent** 分析、写代码、实时返回结果
+4. **你**在 Slack 里审查,继续对话迭代
-安装:
+所有执行都在本地。代码不会离开你的机器。
-```bash
-npm install -g @anthropic-ai/claude-code
-```
+---
-验证:
+## 快捷命令
-```bash
-claude --help
-```
+| 命令 | 作用 |
+|---------|--------------|
+| `/start` | 打开主菜单 |
+| `/stop` | 停止当前 Agent 会话 |
+| `/cwd` | 显示工作目录 |
+| `/settings` | 配置消息显示 |
-## 快速开始
+**技巧:** 用线程!每个线程都有独立的会话和工作目录。
-1. 安装
+---
-```bash
-curl -fsSL https://vibe.remote/install.sh | bash
-```
+## 按频道路由 Agent
-2. 运行
+不同项目需要不同的 Agent。按频道配置:
-```bash
-vibe
-```
+| 频道 | Agent | 原因 |
+|---------|-------|-----|
+| `#frontend` | OpenCode | 快,适合 UI 开发 |
+| `#backend` | Claude Code | 深度推理,适合复杂逻辑 |
+| `#experiments` | Codex | 快速原型 |
-## 配置
+在 Web UI 配置:`http://localhost:5173/channels`
-### Slack
+---
-- `SLACK_BOT_TOKEN`(xoxb-...)
-- `SLACK_APP_TOKEN`(xapp-...,用于 Socket Mode)
-- `SLACK_TARGET_CHANNELS` 可选的频道 ID 白名单(仅频道,形如 `C...`)。留空或省略为接受所有频道。当前不支持 Slack DM。
+## 前置条件
-### Claude Code
+你需要至少安装一个编码 Agent CLI:
-- `AGENT_DEFAULT_CWD` 例如 `./_tmp`(推荐)
-- 兼容别名:`CLAUDE_DEFAULT_CWD`(仍支持)
-- `CLAUDE_PERMISSION_MODE` 例如 `bypassPermissions`
-- `CLAUDE_SYSTEM_PROMPT` 可选
-- `ANTHROPIC_API_KEY`(取决于你的 SDK 设置)
+<details>
+<summary><b>OpenCode</b>(推荐)</summary>
-### Codex
+```bash
+brew install opencode
+# 或
+curl -fsSL https://opencode.ai/install | bash
+```
+</details>
-- 安装并登录 [Codex CLI](https://github.com/openai/codex)(执行 `codex --help` 验证)。
-- `CODEX_ENABLED=true`(默认)启用 Codex;若环境没有 CLI 才需要设为 false。`CODEX_CLI_PATH` 可重定向可执行文件。
-- `CODEX_DEFAULT_MODEL` / `CODEX_EXTRA_ARGS` 可强制模型或追加命令行参数。
+<details>
+<summary><b>Claude Code</b></summary>
-### OpenCode
+```bash
+npm install -g @anthropic-ai/claude-code
+```
+</details>
-- 通过 `OPENCODE_ENABLED=true` 启用 OpenCode(默认 false),并确保已安装 `opencode`。
-- Vibe Remote 会启动本地 OpenCode HTTP Server(`opencode serve --hostname=127.0.0.1 --port=4096`)。
-- OpenCode 的默认 agent/model 配置读取自 `~/.config/opencode/opencode.json`;在 Slack 下也可通过 Agent Settings 对每个 channel 单独覆盖。
+<details>
+<summary><b>Codex</b></summary>
-### Agent 路由
+```bash
+brew install codex
+```
+</details>
-- Slack:推荐直接使用内置的 **Agent Settings** 弹窗,为每个 channel 选择 backend。
-- Slack 使用频道 ID。
-- 参见 [docs/CODEX_SETUP.md](docs/CODEX_SETUP.md) 获取 Codex 安装与路由说明。
-- 如果启用了 OpenCode,则默认使用 OpenCode;否则回退到 Claude。
+---
-### 应用
+## CLI 参考
-- `LOG_LEVEL` 默认 `INFO`
+```bash
+vibe # 启动服务 + 打开 Web UI
+vibe status # 检查服务状态
+vibe stop # 停止所有服务
+vibe doctor # 诊断问题
+```
-## 使用方式
+---
-### Commands
+## 卸载
-- `/start` 打开菜单/欢迎信息
-- `/clear` 重置对话/会话
-- `/cwd` 显示工作目录
-- `/set_cwd <path>` 更改工作目录
-- `/settings` 配置消息可见性
-- `/stop` 强制停止当前 Agent(Claude 发送 interrupt,Codex 直接终止进程)
+```bash
+vibe stop
+uv tool uninstall vibe-remote # 或: pip uninstall vibe-remote
+rm -rf ~/.vibe_remote # 删除配置(可选)
+```
-### Subagent 前缀路由
+---
-消息开头使用 `SubagentName:` 或 `SubagentName:`(允许前置空格/换行),即可调用当前频道绑定 Agent 的 Subagent。
+## 文档
-- 示例:`Plan: 先把实现步骤列出来`
-- 匹配大小写不敏感,仅在当前绑定的 Agent 内查找
-- 自动使用 Subagent 的默认 model / reasoning_effort
-- 命中时机器人会在消息上加 🤖 reaction
+- **[Slack 安装指南](docs/SLACK_SETUP_ZH.md)** — 5 分钟创建你的 Slack App
+- **[English Setup Guide](docs/SLACK_SETUP.md)** — English setup guide
-### Slack
+---
-- 在频道中运行 `/start` 打开交互菜单(Current Dir、Change Work Dir、Reset Session、Settings、How it Works)
-- 机器人会把每次对话组织到各自的线程中;在线程中继续回复即可
-- 当前不支持 Slack DM
-- Slash 命令在线程中受限;要在线程内停止,请直接输入 `stop`
+## 安全
-## Setup Guides
+- 🔐 Token 本地存储在 `~/.vibe_remote/config/config.json`
+- 🏠 Web UI 只在 localhost 运行
+- 💻 所有代码执行都在你的机器上
+- 🚫 不向第三方发送数据(除了你选择的 AI 提供商)
-- Slack: [English](docs/SLACK_SETUP.md) | [中文](docs/SLACK_SETUP_ZH.md)
+---
-## Releases
+## 路线图
-统一以 GitHub Releases 作为变更记录:https://github.com/cyhhao/vibe-remote/releases
+- [ ] 更多 IM 平台(Discord、Teams)
+- [ ] 文件附件支持
+- [ ] 多工作区 Slack 支持
+- [ ] SaaS 模式 + 云中继
-## Roadmap
+---
-- 扩展到更多编码 CLI/agents(超越当前内置 Agent)
-- 更多 IM 平台(Discord、Teams)
-- 文件上传/附件到编码会话的管道化
-- 更细粒度的会话策略与权限
+## 贡献
-## Contributing
+欢迎 PR!查看 [CONTRIBUTING.md](CONTRIBUTING.md)。
-参见 `CONTRIBUTING.md`。参与即代表同意 `CODE_OF_CONDUCT.md`。
+---
-## License
+<div align="center">
-MIT,详见 `LICENSE`。
+**停止上下文切换。开始 vibe coding。**
-## Security & Ops
+[立即安装](#30-秒安装) · [设置 Slack](docs/SLACK_SETUP_ZH.md) · [报告 Bug](https://github.com/cyhhao/vibe-remote/issues)
-- **Secrets**:不要提交 Token;存储在 `~/.vibe_remote/config/config.json` 或你的密钥管理系统。
-- **Whitelists**:通过 `SLACK_TARGET_CHANNELS`(仅频道,`C…`)限制访问。留空允许全部频道(Slack DM 当前不支持)。
-- **Logs**:运行日志位于 `~/.vibe_remote/logs/vibe_remote.log`。
-- **会话持久化**:`~/.vibe_remote/state/sessions.json` 存储每个线程的会话映射;生产环境请持久化此文件。
-- **清理**:设置 `CLEANUP_ENABLED=true`,在消息处理入口安全清理已完成的接收任务,适合长时间运行。
+</div>
diff --git a/docs/SLACK_SETUP.md b/docs/SLACK_SETUP.md
index e836b6066..45fa7451f 100644
--- a/docs/SLACK_SETUP.md
+++ b/docs/SLACK_SETUP.md
@@ -5,413 +5,210 @@ This guide will walk you through setting up a Slack bot for Vibe Remote.
## Prerequisites
- Admin access to a Slack workspace
-- Python 3.6 or higher installed
-- Vibe Remote cloned and dependencies installed
+- Python 3.9 or higher installed
+- Vibe Remote installed (`curl -fsSL https://raw.githubusercontent.com/cyhhao/vibe-remote/master/install.sh | bash`)
## Step 1: Create a Slack App
1. Go to [https://api.slack.com/apps](https://api.slack.com/apps)
-2. Click **"Create New App"** → **"From scratch"**
-3. Enter an app name (e.g., "Vibe Remote")
-4. Select your workspace
-5. Click **"Create App"**
-
-## Step 2: Configure Bot Token Scopes
-
-1. In your app's settings, navigate to **"OAuth & Permissions"** in the sidebar
-2. Scroll down to **"Scopes"** → **"Bot Token Scopes"**
-3. Add ALL the following OAuth scopes to avoid permission issues:
-
-### Essential Scopes (Required)
-
-- `channels:history` - View messages in public channels
-- `channels:read` - View basic information about public channels
-- `chat:write` - Send messages as bot
-- `app_mentions:read` - View messages that mention your bot
-- `users:read` - View basic information about users
-- `commands` - Use slash commands (automatically added)
-
-### Private Channel Support
-
-- `groups:read` - View basic information about private channels
-- `groups:history` - View messages in private channels
-- `groups:write` - Send messages to private channels
-
-### Enhanced Features
-
-- `chat:write.public` - Send messages to channels without joining
-- `chat:write.customize` - Send messages with custom username and avatar
-- `files:read` - View files shared in channels (for future file handling)
-- `files:write` - Upload files (for future file upload support)
-- `reactions:read` - View emoji reactions
-- `reactions:write` - Add emoji reactions (required for `ACK_MODE=reaction`; set `ACK_MODE=message` to use text ack instead)
-- `users:read.email` - View email addresses (for enhanced user info)
-- `team:read` - View team/workspace information
-
-**Note**: It's better to add all permissions now to avoid reinstalling the app multiple times later. Unused permissions won't affect the bot's performance.
-
-### Quick Permission Checklist
-
-To ensure full functionality, make sure you've added:
+2. Click **"Create New App"** → **"From an app manifest"**
+3. Select your workspace
+4. Paste the following manifest (YAML):
+
+```yaml
+display_information:
+ name: Vibe Remote
+ description: Local-first agent runtime for Slack
+ background_color: "#0B1B2B"
+features:
+ bot_user:
+ display_name: Vibe Remote
+ always_online: false
+ slash_commands:
+ - command: /start
+ description: Open main menu
+ should_escape: false
+ - command: /stop
+ description: Stop current session
+ should_escape: false
+oauth_config:
+ scopes:
+ bot:
+ - channels:history
+ - channels:read
+ - chat:write
+ - app_mentions:read
+ - users:read
+ - commands
+ - groups:read
+ - groups:history
+ - groups:write
+ - chat:write.public
+ - files:read
+ - files:write
+ - reactions:read
+ - reactions:write
+ - users:read.email
+ - team:read
+settings:
+ event_subscriptions:
+ bot_events:
+ - message.channels
+ - message.groups
+ - app_mention
+ - member_joined_channel
+ - member_left_channel
+ - channel_created
+ - channel_renamed
+ - team_join
+ socket_mode_enabled: true
+ interactivity:
+ is_enabled: true
+```
-- ✅ All Essential Scopes (6 scopes)
-- ✅ All Private Channel scopes (3 scopes)
-- ✅ Any Enhanced Features you want (up to 8 additional scopes)
+5. Click **"Next"**, review the configuration, and click **"Create"**
-**Total recommended scopes: ~17 scopes** for full functionality.
+## Step 2: Generate Tokens
-## Step 3: Install App to Workspace
+### Bot Token
-1. Still in **"OAuth & Permissions"**, scroll to the top
+1. Go to **"OAuth & Permissions"** in the sidebar
2. Click **"Install to Workspace"**
-3. Review the permissions and click **"Allow"**
+3. Review permissions and click **"Allow"**
4. Copy the **Bot User OAuth Token** (starts with `xoxb-`)
- - Save this as `SLACK_BOT_TOKEN` in your `.env` file
-
-## Step 4: Enable Socket Mode (Recommended)
-
-Socket Mode allows your bot to connect without exposing a public URL.
-
-1. Go to **"Socket Mode"** in the sidebar
-2. Toggle **"Enable Socket Mode"** to On
-3. You'll be prompted to generate an app-level token:
- - Token Name: "Socket Mode Token"
- - Add scope: `connections:write`
- - Click **"Generate"**
-4. Copy the **App-Level Token** (starts with `xapp-`)
- - Save this as `SLACK_APP_TOKEN` in your `.env` file
-
-## Step 5: Configure Event Subscriptions
-
-1. Go to **"Event Subscriptions"** in the sidebar
-2. Toggle **"Enable Events"** to On
-3. Under **"Subscribe to bot events"**, add ALL these events:
-
-### Message Events
-
-- `message.channels` - Messages in public channels
-- `message.groups` - Messages in private channels
-- `app_mention` - When someone mentions your bot
-
-### Additional Events (Optional but Recommended)
-
-- `member_joined_channel` - When bot joins a channel
-- `member_left_channel` - When bot leaves a channel
-- `channel_created` - When a new channel is created
-- `channel_renamed` - When a channel is renamed
-- `team_join` - When a new member joins the workspace
-
-4. Click **"Save Changes"**
-
-**Note**: Adding all events now prevents the need to reconfigure later when expanding bot functionality.
-
-## Step 6: Configure Native Slash Commands (Recommended)
-
-Native Slack slash commands provide the best user experience with autocomplete and help text. Here's a detailed step-by-step guide:
-
-### 6.1 Access Slash Commands Configuration
-
-1. Navigate to [https://api.slack.com/apps](https://api.slack.com/apps)
-2. Log in to your Slack account (if not already logged in)
-3. Find your Vibe Remote app in the "Your Apps" list
-4. Click on your app name to enter the management interface
-5. In the left sidebar, find **"Features"** section and click **"Slash Commands"**
-6. You'll see the "Slash Commands" page showing any existing commands
-
-**Page Overview**:
-
-- New apps will show "You haven't created any slash commands yet"
-- Green **"Create New Command"** button is in the top right corner
-- Existing commands appear in a list with edit options
-
-### 6.2 Create Commands
-
-**Steps for each command**:
-
-1. Click **"Create New Command"** button
-2. Fill in the command form (see specific configurations below)
-3. Click **"Save"** to save the command
-4. Wait for confirmation - Slack will show "Your slash command was saved!" message
-5. Return to command list to verify creation
-
-**Important Notes**:
-
-- Commands must be created one at a time
-- Command names cannot be duplicated or contain spaces
-- All fields are case-sensitive
-
-### 6.3 Required Commands
-
-**Configuration Guidelines**:
-
-- Leave **Request URL** empty for all commands (we use Socket Mode)
-- Check **"Escape channels, users, and links"** for all commands
-- Copy and paste the configurations below
-
----
-
-#### Command 1: `/start`
-
-```
-Command: /start
-Request URL: (leave empty)
-Short Description: Open main menu with interactive buttons
-Usage Hint: Start Vibe Remote and show menu
-```
-
-**Steps**:
-
-1. Click **"Create New Command"**
-2. Fill in **"Command"** field: `/start`
-3. Leave **"Request URL"** blank
-4. Fill in **"Short Description"**: `Open main menu with interactive buttons`
-5. Fill in **"Usage Hint"**: `Start Vibe Remote and show menu`
-6. ✅ Check "Escape channels, users, and links"
-7. Click **"Save"**
-8. Return to Slash Commands page
-
-#### Command 2: `/stop`
-
-```
-Command: /stop
-Request URL: (leave empty)
-Short Description: Stop Vibe Remote session
-Usage Hint: Stop the current bot session
-```
-
-**Steps**:
-
-1. Click **"Create New Command"**
-2. Fill in **"Command"** field: `/stop`
-3. Leave **"Request URL"** blank
-4. Fill in **"Short Description"**: `Stop Vibe Remote session`
-5. Fill in **"Usage Hint"**: `Stop the current bot session`
-6. ✅ Check "Escape channels, users, and links"
-7. Click **"Save"**
-
-**✅ Complete**: After creating both commands, you should see them listed on the Slash Commands page.
-
-### 6.4 Important Configuration Notes
-- **Request URL**: Always leave this empty when using Socket Mode (recommended)
-- **Socket Mode Required**: These commands only work when Socket Mode is enabled (Step 4)
-- **Case Sensitive**: Command names are case-sensitive
-- **No Automation**: Currently, Slack doesn't provide an API to create slash commands programmatically - they must be created manually through the web interface
-- **3-Second Response**: The bot has 3 seconds to acknowledge slash commands (handled automatically)
+### App Token (Socket Mode)
-### 6.5 Verification
+1. Go to **"Basic Information"** in the sidebar
+2. Scroll to **"App-Level Tokens"**
+3. Click **"Generate Token and Scopes"**
+4. Name: `socket-mode`
+5. Add scope: `connections:write`
+6. Click **"Generate"**
+7. Copy the **App-Level Token** (starts with `xapp-`)
-After creating both commands:
+## Step 3: Configure Vibe Remote
-1. Go back to the main "Slash Commands" page
-2. You should see both `/start` and `/stop` commands listed
-3. Each command should show "✅ Configured" status
+Run Vibe Remote to open the setup wizard:
-### 6.6 Setup Checklist
-
-**Verify your configuration**:
-
-- [ ] Accessed [https://api.slack.com/apps](https://api.slack.com/apps) and selected your app
-- [ ] Navigated to "Features" > "Slash Commands" page
-- [ ] Created `/start` command
-- [ ] Created `/stop` command
-- [ ] All commands have empty **Request URL**
-- [ ] All commands have **"Escape channels, users, and links"** checked
-- [ ] Both commands appear on the Slash Commands page
-
-### 6.7 Troubleshooting Slash Commands
-
-If commands not showing in autocomplete:
-
-- Reinstall app to workspace via "OAuth & Permissions" page
-- Verify Socket Mode is enabled
-- Ensure bot is invited to channel: `/invite @YourBotName`
-
-If commands execute but no response:
-
-- Check bot process is running
-- Verify `SLACK_APP_TOKEN` and `SLACK_BOT_TOKEN` are correctly configured
-
-## Step 7: Configure Your Environment
-
-Update your `.env` file with the following:
-
-```env
-# Set platform to slack
-IM_PLATFORM=slack
-
-# Slack configuration
-SLACK_BOT_TOKEN=xoxb-your-bot-token-here
-SLACK_APP_TOKEN=xapp-your-app-token-here
-
-# Optional: Whitelist of allowed channel IDs (null = all channels)
-SLACK_TARGET_CHANNEL=[C1234567890,C0987654321]
+```bash
+vibe
```
-### Finding Channel IDs
+The web UI will open at `http://localhost:5173`. Follow the setup wizard:
-To find a channel ID:
+1. **Choose Mode**: Select "Self-host (Socket Mode)"
+2. **Agent Detection**: Configure your coding agent backends (OpenCode, Claude, Codex)
+3. **Slack Configuration**:
+ - Paste your **Bot Token** (`xoxb-...`)
+ - Paste your **App Token** (`xapp-...`)
+ - Click **"Validate"** to test the connection
+4. **Channel Settings**: Enable the channels where you want the bot to work
+5. **Summary**: Review and start the service
-1. Right-click on the channel name in Slack
-2. Select **"View channel details"**
-3. Scroll to the bottom
-4. The Channel ID starts with `C` for public channels
+## Step 4: Invite Bot to Channels
-## Step 8: Invite Bot to Channels
+Before the bot can interact with a channel, invite it:
-Before the bot can interact with a channel, you need to invite it:
-
-1. In Slack, go to the channel
-2. Type `/invite @YourBotName`
+1. Go to the channel in Slack
+2. Type `/invite @Vibe Remote`
3. Press Enter
-## Step 9: Start the Bot
+## Step 5: Test the Bot
-```bash
-python main.py
-```
+1. In an enabled channel, type `/start`
+2. You should see the Vibe Remote menu
+3. Type a message to start a coding session
## Usage
-### Command Methods
-
-The bot supports multiple ways to interact:
-
-#### 1. Slash Commands (Recommended)
-
-```
-/start
-/stop
-```
-
-- Provides autocomplete and help text
-- Works in any channel where the bot is invited
-- Most user-friendly experience
-
-#### 2. In Channels
-
-- Use `/start` to begin
-- The bot creates threads to organize conversations
-- All responses appear in the thread
-
-### Using the Bot
-
-#### Primary Command
+### Slash Commands
-- `/start` - Opens the main menu with interactive buttons:
- - **Current Dir** - Display current working directory
- - **Change Work Dir** - Open modal to change working directory
- - **Reset Session** - Clear conversation context and start fresh
- - **Settings** - Configure message visibility preferences
- - **How it Works** - Display help information
+- `/start` - Open main menu with interactive buttons
+- `/stop` - Stop the current session
-#### Additional Command
+### Interactive Menu Options
-- `/stop` - Stop the current Vibe Remote session
+After `/start`, you'll see buttons for:
+- **Current Dir** - Display current working directory
+- **Change Work Dir** - Open modal to change working directory
+- **Reset Session** - Clear conversation context
+- **Settings** - Configure message visibility
+- **How it Works** - Display help information
-#### Sending Messages to Your Agent
+### Thread-based Conversations
-After using `/start`, simply type your message in the channel. The bot will:
-
-1. Send your message to the configured coding agent
-2. Stream the response back in real-time
-3. Maintain conversation context for follow-ups
-
-## Thread Support
-
-The Slack bot automatically uses threads to organize conversations:
-
-- Each user's messages are grouped in a thread
-- Responses from the configured agent appear in the same thread
-- This keeps channel history clean and organized
+- The bot creates threads for each conversation
+- Reply in the thread to continue the session
+- Each thread maintains its own agent session
## Troubleshooting
### Bot not responding
-1. Check that the bot is online (green dot in Slack)
-2. Verify the bot was invited to the channel
-3. Check logs for any error messages
+1. Check that the service is running: `vibe status`
+2. Check logs: `~/.vibe_remote/logs/vibe_remote.log`
+3. Run diagnostics: `vibe doctor`
+4. Verify the bot is invited to the channel
### Permission errors
-1. Ensure all required scopes are added (including `groups:read` for private channels)
-2. **Important**: After adding new scopes, you MUST reinstall the app to workspace:
- - Go to **"OAuth & Permissions"** page
- - Click **"Reinstall to Workspace"** button at the top
- - Review and approve the new permissions
-3. Verify tokens are correctly set in `.env`
-
-### Private Channel Access Issues
-
-If you see `missing_scope` errors with `groups:read`:
-
-1. Add ALL private channel scopes: `groups:read`, `groups:history`, `groups:write`
-2. Click **"Reinstall to Workspace"** (this is mandatory!)
-3. Copy the new Bot Token and update your `.env` file
-4. Restart the bot
-5. Ensure bot is invited to the private channel: `/invite @YourBotName`
-
-### Reaction / Ack Reaction Issues
-
-If you see `missing_scope` errors with `reactions:write` (for 👀 reaction acknowledgement):
-
-1. Add `reactions:write` under **Bot Token Scopes**
-2. Click **"Reinstall to Workspace"** (this is mandatory!)
-3. Copy the new Bot Token and update your `.env` file
-4. Restart the bot
-
-### Thread Reply Issues
-
-If you see `cannot_reply_to_message` error:
-
-1. This usually means the bot is trying to reply to a message that doesn't exist or in wrong context
-2. Ensure the bot has `channels:history` or `groups:history` permission for the channel type
-3. Check that the message timestamp (thread_ts) is valid
-4. Verify the bot is a member of the channel where it's trying to reply
+1. Verify tokens are correctly set (check via web UI)
+2. Ensure all required scopes are in the app manifest
+3. Reinstall the app to workspace if scopes were changed
### Socket Mode issues
-1. Ensure `SLACK_APP_TOKEN` is set correctly
-2. Check that the app-level token has `connections:write` scope
-3. Verify Socket Mode is enabled in app settings
+1. Verify App Token (`xapp-`) is set correctly
+2. Check that Socket Mode is enabled in app settings
+3. Ensure the app-level token has `connections:write` scope
-### Slash Command Issues
+### Channel access issues
-If slash commands not working:
+1. Ensure bot is invited to the channel: `/invite @Vibe Remote`
+2. For private channels, verify `groups:read`, `groups:history` scopes
+3. Check channel is enabled in the web UI
-1. Verify commands created in app settings
-2. Check Socket Mode is enabled
-3. Ensure bot is invited to channel: `/invite @YourBotName`
-4. Restart bot if needed
-
-Check bot logs for startup confirmation:
+## Security Considerations
+- Tokens are stored locally in `~/.vibe_remote/config/config.json`
+- Never commit tokens to version control
+- The web UI runs on localhost only
+- Regularly rotate your tokens via Slack app settings
+
+## Manual Configuration (Alternative)
+
+If you prefer to edit config files directly instead of using the web UI:
+
+Edit `~/.vibe_remote/config/config.json`:
+
+```json
+{
+ "mode": "self_host",
+ "slack": {
+ "bot_token": "xoxb-your-bot-token",
+ "app_token": "xapp-your-app-token"
+ },
+ "runtime": {
+ "default_cwd": "/path/to/your/project"
+ },
+ "agents": {
+ "default_backend": "opencode",
+ "opencode": {"enabled": true, "cli_path": "opencode"},
+ "claude": {"enabled": true, "cli_path": "claude"},
+ "codex": {"enabled": false, "cli_path": "codex"}
+ }
+}
```
-INFO - Starting Slack bot in Socket Mode...
-INFO - A new session has been established
-```
-
-## Alternative: Webhook Mode
-
-If you prefer to use webhooks instead of Socket Mode:
-1. Set up a public HTTPS endpoint
-2. Configure the Request URL in Event Subscriptions
-3. Add `SLACK_SIGNING_SECRET` to your `.env`
-4. Remove or leave empty `SLACK_APP_TOKEN`
+Then start the service:
-Note: Webhook mode requires a publicly accessible HTTPS endpoint, which is more complex to set up.
-
-## Security Considerations
-
-- Never commit tokens to version control
-- Use environment variables for all sensitive data
-- Regularly rotate your tokens
-- Only grant necessary permissions to the bot
+```bash
+vibe
+```
## Additional Resources
- [Slack API Documentation](https://api.slack.com/)
-- [Python Slack SDK](https://slack.dev/python-slack-sdk/)
- [Socket Mode Guide](https://api.slack.com/apis/connections/socket)
+- [Vibe Remote GitHub](https://github.com/cyhhao/vibe-remote)
diff --git a/docs/SLACK_SETUP_ZH.md b/docs/SLACK_SETUP_ZH.md
index b2b0cb716..e652ee1b5 100644
--- a/docs/SLACK_SETUP_ZH.md
+++ b/docs/SLACK_SETUP_ZH.md
@@ -1,417 +1,214 @@
-# Slack 机器人设置指南
+# Slack Bot 安装指南
-本指南将指导你为 Vibe Remote 设置 Slack 机器人。
+本指南将引导你为 Vibe Remote 设置 Slack Bot。
-## 前置条件
+## 先决条件
-- Slack 工作区的管理员权限
-- 已安装 Python 3.6 或更高版本
-- 已克隆 Vibe Remote 并安装依赖
+- Slack 工作区管理员权限
+- Python 3.9 或更高版本
+- 已安装 Vibe Remote(`curl -fsSL https://raw.githubusercontent.com/cyhhao/vibe-remote/master/install.sh | bash`)
-## 步骤 1:创建 Slack 应用
+## 步骤 1:创建 Slack App
1. 访问 [https://api.slack.com/apps](https://api.slack.com/apps)
-2. 点击 **"Create New App"** → **"From scratch"**
-3. 输入应用名称(例如 "Vibe Remote")
-4. 选择你的工作区
-5. 点击 **"Create App"**
-
-## 步骤 2:配置机器人令牌权限范围
-
-1. 在应用设置中,导航到侧边栏的 **"OAuth & Permissions"**
-2. 向下滚动到 **"Scopes"** → **"Bot Token Scopes"**
-3. 添加以下所有 OAuth 权限范围以避免权限问题:
-
-### 基础权限范围(必需)
-
-- `channels:history` - 查看公共频道中的消息
-- `channels:read` - 查看公共频道的基本信息
-- `chat:write` - 作为机器人发送消息
-- `app_mentions:read` - 查看提及你的机器人的消息
-- `users:read` - 查看用户的基本信息
-- `commands` - 使用斜杠命令(自动添加)
-
-### 私有频道支持
-
-- `groups:read` - 查看私有频道的基本信息
-- `groups:history` - 查看私有频道中的消息
-- `groups:write` - 向私有频道发送消息
-
-### 增强功能
-
-- `chat:write.public` - 无需加入即可向频道发送消息
-- `chat:write.customize` - 使用自定义用户名和头像发送消息
-- `files:read` - 查看频道中共享的文件(用于未来的文件处理)
-- `files:write` - 上传文件(用于未来的文件上传支持)
-- `reactions:read` - 查看表情反应
-- `reactions:write` - 添加表情反应(`ACK_MODE=reaction` 必需;如需发送文字 ack 可设为 `ACK_MODE=message`)
-- `users:read.email` - 查看电子邮件地址(用于增强用户信息)
-- `team:read` - 查看团队/工作区信息
-
-**注意**:现在添加所有权限比以后多次重新安装应用要好。未使用的权限不会影响机器人的性能。
-
-### 快速权限检查清单
-
-为确保完整功能,请确保已添加:
+2. 点击 **"Create New App"** → **"From an app manifest"**
+3. 选择你的工作区
+4. 粘贴以下 manifest(YAML 格式):
+
+```yaml
+display_information:
+ name: Vibe Remote
+ description: Local-first agent runtime for Slack
+ background_color: "#0B1B2B"
+features:
+ bot_user:
+ display_name: Vibe Remote
+ always_online: false
+ slash_commands:
+ - command: /start
+ description: Open main menu
+ should_escape: false
+ - command: /stop
+ description: Stop current session
+ should_escape: false
+oauth_config:
+ scopes:
+ bot:
+ - channels:history
+ - channels:read
+ - chat:write
+ - app_mentions:read
+ - users:read
+ - commands
+ - groups:read
+ - groups:history
+ - groups:write
+ - chat:write.public
+ - files:read
+ - files:write
+ - reactions:read
+ - reactions:write
+ - users:read.email
+ - team:read
+settings:
+ event_subscriptions:
+ bot_events:
+ - message.channels
+ - message.groups
+ - app_mention
+ - member_joined_channel
+ - member_left_channel
+ - channel_created
+ - channel_renamed
+ - team_join
+ socket_mode_enabled: true
+ interactivity:
+ is_enabled: true
+```
-- ✅ 所有基础权限范围(6 个权限)
-- ✅ 所有私有频道权限(3 个权限)
-- ✅ 任何你想要的增强功能(最多 8 个额外权限)
+5. 点击 **"Next"**,检查配置,然后点击 **"Create"**
-**推荐的权限总数:约 17 个权限**,可实现完整功能。
+## 步骤 2:生成 Token
-## 步骤 3:将应用安装到工作区
+### Bot Token
-1. 仍在 **"OAuth & Permissions"** 页面,滚动到顶部
+1. 进入侧边栏的 **"OAuth & Permissions"**
2. 点击 **"Install to Workspace"**
-3. 查看权限并点击 **"Allow"**
+3. 检查权限并点击 **"Allow"**
4. 复制 **Bot User OAuth Token**(以 `xoxb-` 开头)
- - 将其保存为 `.env` 文件中的 `SLACK_BOT_TOKEN`
-
-## 步骤 4:启用 Socket 模式(推荐)
-
-Socket 模式允许你的机器人连接而无需暴露公共 URL。
-
-1. 转到侧边栏的 **"Socket Mode"**
-2. 将 **"Enable Socket Mode"** 切换为开启
-3. 系统会提示你生成应用级令牌:
- - 令牌名称:"Socket Mode Token"
- - 添加权限:`connections:write`
- - 点击 **"Generate"**
-4. 复制 **App-Level Token**(以 `xapp-` 开头)
- - 将其保存为 `.env` 文件中的 `SLACK_APP_TOKEN`
-
-## 步骤 5:配置事件订阅
-
-1. 转到侧边栏的 **"Event Subscriptions"**
-2. 将 **"Enable Events"** 切换为开启
-3. 在 **"Subscribe to bot events"** 下,添加所有这些事件:
-
-### 消息事件
-
-- `message.channels` - 公共频道中的消息
-- `message.groups` - 私有频道中的消息
-- `app_mention` - 有人提及你的机器人时
-
-### 其他事件(可选但推荐)
-
-- `member_joined_channel` - 机器人加入频道时
-- `member_left_channel` - 机器人离开频道时
-- `channel_created` - 创建新频道时
-- `channel_renamed` - 频道重命名时
-- `team_join` - 新成员加入工作区时
-
-4. 点击 **"Save Changes"**
-
-**注意**:现在添加所有事件可以避免以后扩展机器人功能时需要重新配置。
-
-## 步骤 6:配置原生斜杠命令(推荐)
-
-原生 Slack 斜杠命令提供最佳用户体验,带有自动完成和帮助文本。以下是详细的分步指南:
-
-### 6.1 访问斜杠命令配置
-
-1. 导航到 [https://api.slack.com/apps](https://api.slack.com/apps)
-2. 登录你的 Slack 账户(如果尚未登录)
-3. 在"Your Apps"列表中找到你的 Vibe Remote 应用
-4. 点击应用名称进入管理界面
-5. 在左侧边栏中,找到 **"Features"** 部分并点击 **"Slash Commands"**
-6. 你将看到"Slash Commands"页面,显示任何现有命令
-
-**页面概览**:
-
-- 新应用会显示"You haven't created any slash commands yet"
-- 绿色的 **"Create New Command"** 按钮位于右上角
-- 现有命令以列表形式显示,带有编辑选项
-
-### 6.2 创建命令
-
-**每个命令的步骤**:
-
-1. 点击 **"Create New Command"** 按钮
-2. 填写命令表单(见下方具体配置)
-3. 点击 **"Save"** 保存命令
-4. 等待确认 - Slack 会显示"Your slash command was saved!"消息
-5. 返回命令列表验证创建
-
-**重要说明**:
-
-- 命令必须逐个创建
-- 命令名称不能重复或包含空格
-- 所有字段都区分大小写
-
-### 6.3 必需的命令
-
-**配置指南**:
-
-- 所有命令的 **Request URL** 留空(我们使用 Socket 模式)
-- 为所有命令勾选 **"Escape channels, users, and links"**
-- 复制并粘贴下面的配置
-
----
-
-#### 命令 1:`/start`
-
-```
-Command: /start
-Request URL: (留空)
-Short Description: 打开带有交互按钮的主菜单
-Usage Hint: 启动 Vibe Remote 并显示菜单
-```
-
-**步骤**:
-
-1. 点击 **"Create New Command"**
-2. 填写 **"Command"** 字段:`/start`
-3. **"Request URL"** 留空
-4. 填写 **"Short Description"**:`打开带有交互按钮的主菜单`
-5. 填写 **"Usage Hint"**:`启动 Agent 会话并显示菜单`
-6. ✅ 勾选"Escape channels, users, and links"
-7. 点击 **"Save"**
-8. 返回 Slash Commands 页面
-
-#### 命令 2:`/stop`
-
-```
-Command: /stop
-Request URL: (留空)
-Short Description: 停止 Vibe Remote 会话
-Usage Hint: 停止当前机器人会话
-```
-
-**步骤**:
-
-1. 点击 **"Create New Command"**
-2. 填写 **"Command"** 字段:`/stop`
-3. **"Request URL"** 留空
-4. 填写 **"Short Description"**:`停止当前 Agent 会话`
-5. 填写 **"Usage Hint"**:`停止当前机器人会话`
-6. ✅ 勾选"Escape channels, users, and links"
-7. 点击 **"Save"**
-**✅ 完成**:创建两个命令后,你应该在 Slash Commands 页面看到它们的列表。
+### App Token(Socket Mode)
-### 6.4 重要配置说明
+1. 进入侧边栏的 **"Basic Information"**
+2. 滚动到 **"App-Level Tokens"**
+3. 点击 **"Generate Token and Scopes"**
+4. 名称:`socket-mode`
+5. 添加 scope:`connections:write`
+6. 点击 **"Generate"**
+7. 复制 **App-Level Token**(以 `xapp-` 开头)
-- **Request URL**:使用 Socket 模式时始终留空(推荐)
-- **需要 Socket 模式**:这些命令仅在启用 Socket 模式时工作(步骤 4)
-- **区分大小写**:命令名称区分大小写
-- **无自动化**:目前,Slack 不提供 API 来以编程方式创建斜杠命令 - 必须通过 Web 界面手动创建
-- **3 秒响应**:机器人有 3 秒时间确认斜杠命令(自动处理)
+## 步骤 3:配置 Vibe Remote
-### 6.5 验证
-
-创建两个命令后:
-
-1. 返回主"Slash Commands"页面
-2. 你应该看到 `/start` 和 `/stop` 命令都列出
-3. 每个命令应显示"✅ Configured"状态
-
-### 6.6 设置检查清单
-
-**验证你的配置**:
-
-- [ ] 访问 [https://api.slack.com/apps](https://api.slack.com/apps) 并选择你的应用
-- [ ] 导航到"Features" > "Slash Commands"页面
-- [ ] 创建 `/start` 命令
-- [ ] 创建 `/stop` 命令
-- [ ] 所有命令的 **Request URL** 为空
-- [ ] 所有命令都勾选了 **"Escape channels, users, and links"**
-- [ ] 两个命令都出现在 Slash Commands 页面
-
-### 6.7 斜杠命令故障排除
-
-如果命令不在自动完成中显示:
-
-- 通过"OAuth & Permissions"页面重新安装应用到工作区
-- 验证 Socket 模式已启用
-- 确保机器人被邀请到频道:`/invite @YourBotName`
-
-如果命令执行但无响应:
-
-- 检查机器人进程正在运行
-- 验证 `SLACK_APP_TOKEN` 和 `SLACK_BOT_TOKEN` 配置正确
-
-## 步骤 7:配置你的环境
-
-使用以下内容更新你的 `.env` 文件:
-
-```env
-# 设置平台为 slack
-IM_PLATFORM=slack
-
-# Slack 配置
-SLACK_BOT_TOKEN=xoxb-your-bot-token-here
-SLACK_APP_TOKEN=xapp-your-app-token-here
-
-# 可选:允许的频道 ID 白名单(null = 所有频道)
-SLACK_TARGET_CHANNEL=[C1234567890,C0987654321]
-```
-
-### 查找频道 ID
-
-要查找频道 ID:
-
-1. 在 Slack 中右键点击频道名称
-2. 选择 **"View channel details"**
-3. 滚动到底部
-4. 公共频道的频道 ID 以 `C` 开头
-
-## 步骤 8:邀请机器人到频道
-
-在机器人可以与频道交互之前,你需要邀请它:
-
-1. 在 Slack 中,转到频道
-2. 输入 `/invite @YourBotName`
-3. 按 Enter
-
-## 步骤 9:启动机器人
+运行 Vibe Remote 打开设置向导:
```bash
-python main.py
+vibe
```
-## 使用方法
+Web UI 将在 `http://localhost:5173` 打开。按照设置向导:
-### 命令方法
+1. **选择模式**:选择 "Self-host (Socket Mode)"
+2. **Agent 检测**:配置你的编码 Agent 后端(OpenCode、Claude、Codex)
+3. **Slack 配置**:
+ - 粘贴你的 **Bot Token**(`xoxb-...`)
+ - 粘贴你的 **App Token**(`xapp-...`)
+ - 点击 **"验证"** 测试连接
+4. **频道设置**:启用你希望 Bot 工作的频道
+5. **摘要**:检查并启动服务
-机器人支持多种交互方式:
+## 步骤 4:邀请 Bot 到频道
-#### 1. 斜杠命令(推荐)
+在 Bot 能够与频道交互之前,需要邀请它:
-```
-/start
-/stop
-```
+1. 在 Slack 中进入频道
+2. 输入 `/invite @Vibe Remote`
+3. 按回车
-- 提供自动完成和帮助文本
-- 在机器人被邀请的任何频道中工作
-- 最友好的用户体验
+## 步骤 5:测试 Bot
-#### 2. 在频道中
+1. 在已启用的频道中,输入 `/start`
+2. 你应该看到 Vibe Remote 菜单
+3. 输入消息开始编码会话
-- 使用 `/start` 开始
-- 机器人创建线程来组织对话
-- 所有响应都出现在线程中
+## 使用方式
-### 使用机器人
+### Slash 命令
-#### 主要命令
+- `/start` - 打开带有交互按钮的主菜单
+- `/stop` - 停止当前会话
-- `/start` - 打开带有交互按钮的主菜单:
- - **Current Dir** - 显示当前工作目录
- - **Change Work Dir** - 打开模态框更改工作目录
- - **Reset Session** - 清除对话上下文并重新开始
- - **Settings** - 配置消息可见性偏好
- - **How it Works** - 显示帮助信息
+### 交互菜单选项
-#### 附加命令
+`/start` 后,你会看到以下按钮:
+- **Current Dir** - 显示当前工作目录
+- **Change Work Dir** - 打开模态框更改工作目录
+- **Reset Session** - 清除对话上下文
+- **Settings** - 配置消息可见性
+- **How it Works** - 显示帮助信息
-- `/stop` - 停止当前 Vibe Remote 会话
+### 基于线程的对话
-#### 向 Agent 发送消息
-
-使用 `/start` 后,只需在频道中输入你的消息。机器人将:
-
-1. 将你的消息发送到已配置的 Agent
-2. 实时流式传输响应
-3. 为后续消息维护对话上下文
-
-## 线程支持
-
-Slack 机器人自动使用线程来组织对话:
-
-- 每个用户的消息都分组在一个线程中
-- Agent 的响应出现在同一线程中
-- 这使频道历史记录保持整洁有序
+- Bot 为每个对话创建线程
+- 在线程中回复以继续会话
+- 每个线程维护自己的 Agent 会话
## 故障排除
-### 机器人无响应
+### Bot 不响应
-1. 检查机器人是否在线(Slack 中的绿点)
-2. 验证机器人是否被邀请到频道
-3. 检查日志中的任何错误消息
+1. 检查服务是否运行:`vibe status`
+2. 检查日志:`~/.vibe_remote/logs/vibe_remote.log`
+3. 运行诊断:`vibe doctor`
+4. 验证 Bot 已被邀请到频道
### 权限错误
-1. 确保添加了所有必需的权限范围(包括私有频道的 `groups:read`)
-2. **重要**:添加新权限范围后,你必须重新安装应用到工作区:
- - 转到 **"OAuth & Permissions"** 页面
- - 点击顶部的 **"Reinstall to Workspace"** 按钮
- - 查看并批准新权限
-3. 验证令牌在 `.env` 中正确设置
-
-### 私有频道访问问题
-
-如果你看到 `missing_scope` 错误与 `groups:read`:
-
-1. 添加所有私有频道权限范围:`groups:read`、`groups:history`、`groups:write`
-2. 点击 **"Reinstall to Workspace"**(这是强制性的!)
-3. 复制新的 Bot Token 并更新你的 `.env` 文件
-4. 重启机器人
-5. 确保机器人被邀请到私有频道:`/invite @YourBotName`
-
-### 表情/ACK Reaction 问题
-
-如果你看到 `missing_scope` 错误与 `reactions:write`(用于 👀 reaction ack):
-
-1. 在 **Bot Token Scopes** 下添加 `reactions:write`
-2. 点击 **"Reinstall to Workspace"**(这是强制性的!)
-3. 复制新的 Bot Token 并更新你的 `.env` 文件
-4. 重启机器人
-
-### 线程回复问题
+1. 验证 Token 设置正确(通过 Web UI 检查)
+2. 确保 App manifest 中包含所有必需的 scope
+3. 如果 scope 有变更,重新安装 App 到工作区
-如果你看到 `cannot_reply_to_message` 错误:
+### Socket Mode 问题
-1. 这通常意味着机器人正在尝试回复不存在的消息或在错误的上下文中
-2. 确保机器人对频道类型有 `channels:history` 或 `groups:history` 权限
-3. 检查消息时间戳(thread_ts)是否有效
-4. 验证机器人是它尝试回复的频道的成员
+1. 验证 App Token(`xapp-`)设置正确
+2. 检查 App 设置中已启用 Socket Mode
+3. 确保 app-level token 有 `connections:write` scope
-### Socket 模式问题
+### 频道访问问题
-1. 确保 `SLACK_APP_TOKEN` 设置正确
-2. 检查应用级令牌是否有 `connections:write` 权限范围
-3. 验证应用设置中已启用 Socket 模式
+1. 确保 Bot 已被邀请到频道:`/invite @Vibe Remote`
+2. 对于私有频道,验证 `groups:read`、`groups:history` scope
+3. 检查频道已在 Web UI 中启用
-### 斜杠命令问题
-
-如果斜杠命令不工作:
-
-1. 验证命令在应用设置中已创建
-2. 检查 Socket 模式已启用
-3. 确保机器人被邀请到频道:`/invite @YourBotName`
-4. 如需要重启机器人
-
-检查机器人日志的启动确认:
+## 安全注意事项
+- Token 本地存储在 `~/.vibe_remote/config/config.json`
+- 永远不要将 Token 提交到版本控制
+- Web UI 仅在 localhost 运行
+- 定期通过 Slack App 设置轮换你的 Token
+
+## 手动配置(替代方式)
+
+如果你更喜欢直接编辑配置文件而不是使用 Web UI:
+
+编辑 `~/.vibe_remote/config/config.json`:
+
+```json
+{
+ "mode": "self_host",
+ "slack": {
+ "bot_token": "xoxb-your-bot-token",
+ "app_token": "xapp-your-app-token"
+ },
+ "runtime": {
+ "default_cwd": "/path/to/your/project"
+ },
+ "agents": {
+ "default_backend": "opencode",
+ "opencode": {"enabled": true, "cli_path": "opencode"},
+ "claude": {"enabled": true, "cli_path": "claude"},
+ "codex": {"enabled": false, "cli_path": "codex"}
+ }
+}
```
-INFO - Starting Slack bot in Socket Mode...
-INFO - A new session has been established
-```
-
-## 替代方案:Webhook 模式
-如果你更喜欢使用 webhook 而不是 Socket 模式:
+然后启动服务:
-1. 设置公共 HTTPS 端点
-2. 在事件订阅中配置请求 URL
-3. 将 `SLACK_SIGNING_SECRET` 添加到你的 `.env`
-4. 删除或留空 `SLACK_APP_TOKEN`
-
-注意:Webhook 模式需要公开可访问的 HTTPS 端点,设置更复杂。
-
-## 安全注意事项
-
-- 永远不要将令牌提交到版本控制
-- 对所有敏感数据使用环境变量
-- 定期轮换你的令牌
-- 仅向机器人授予必要的权限
+```bash
+vibe
+```
## 其他资源
- [Slack API 文档](https://api.slack.com/)
-- [Python Slack SDK](https://slack.dev/python-slack-sdk/)
-- [Socket 模式指南](https://api.slack.com/apis/connections/socket)
+- [Socket Mode 指南](https://api.slack.com/apis/connections/socket)
+- [Vibe Remote GitHub](https://github.com/cyhhao/vibe-remote)
diff --git a/docs/plans/v2/04_v2_milestones.md b/docs/plans/v2/04_v2_milestones.md
index 87cbce237..51af71f2c 100644
--- a/docs/plans/v2/04_v2_milestones.md
+++ b/docs/plans/v2/04_v2_milestones.md
@@ -23,28 +23,32 @@
- [x] Establish `~/.vibe_remote/` as the single home for config/state/logs.
- [x] Split settings and sessions into separate JSON files.
- [x] Remove `.env` and legacy config paths from the V2 flow.
-- [~] Align defaults with `docs/plans/v2/05_config_model.md` (settings defaults and enablement).
-- [~] Drop V1 compatibility paths/aliases in settings and routing.
+- [x] Align defaults with `docs/plans/v2/05_config_model.md` (settings defaults and enablement).
+- [x] Drop V1 compatibility paths/aliases in settings and routing.
-Proposed structure:
+Implemented structure:
- `~/.vibe_remote/config/config.json`
- `~/.vibe_remote/state/settings.json`
- `~/.vibe_remote/state/sessions.json`
- `~/.vibe_remote/logs/vibe_remote.log`
+- `~/.vibe_remote/runtime/vibe.pid`
+- `~/.vibe_remote/runtime/status.json`
-### M2: CLI Install + Command Surface (Status: In progress)
+### M2: CLI Install + Command Surface (Status: Done)
-- [ ] One-line install (Bash + `uv` tooling).
-- [~] CLI commands (`vibe`, `vibe status`, `vibe stop` done; `vibe doctor` basic checks only).
+- [x] One-line install (`curl ... | bash` for macOS/Linux, PowerShell for Windows).
+- [x] `pyproject.toml` for `uv tool install vibe-remote` and `pip install vibe-remote`.
+- [x] CLI commands: `vibe`, `vibe status`, `vibe stop`, `vibe doctor` (all fully implemented).
-### M3: Local Web UI (Setup Wizard) (Status: In progress)
+### M3: Local Web UI (Setup Wizard) (Status: Done for Self-host)
- [x] UI starts from CLI and opens a browser.
-- [~] Two setup paths (Self-host token flow present; SaaS OAuth + relay pairing pending).
-- [~] Channel-level settings (enable/disable + routing present; validation/target-channel semantics pending).
-- [~] Validation + finish step (summary + start exists; full validation pending).
-- [~] Doctor panel (UI exists; backend checks are minimal).
+- [x] Self-host token flow (Socket Mode) fully implemented.
+- [~] SaaS OAuth + relay pairing (UI exists but disabled; backend not implemented).
+- [x] Channel-level settings (enable/disable + routing + agent backend selection).
+- [x] Validation + finish step (summary + start implemented).
+- [x] Doctor panel (UI + backend checks implemented with groups/summary format).
### M4: SaaS MVP (No Data Persistence) (Status: Not started)
diff --git a/install.ps1 b/install.ps1
new file mode 100644
index 000000000..e8f9a1f8a
--- /dev/null
+++ b/install.ps1
@@ -0,0 +1,223 @@
+# Vibe Remote Installation Script for Windows
+# Usage: irm https://raw.githubusercontent.com/cyhhao/vibe-remote/master/install.ps1 | iex
+
+$ErrorActionPreference = "Stop"
+
+# Configuration
+$REPO = "cyhhao/vibe-remote"
+$PACKAGE_NAME = "vibe-remote"
+$MIN_PYTHON_VERSION = [Version]"3.9"
+
+function Write-Banner {
+ Write-Host @"
+ __ __ _ _ ____ _
+ \ \ / /(_)| |__ ___ | _ \ ___ _ __ ___ ___ | |_ ___
+ \ \ / / | || '_ \ / _ \ | |_) |/ _ \| '_ `` _ \ / _ \| __|/ _ \
+ \ V / | || |_) || __/ | _ <| __/| | | | | | (_) | |_| __/
+ \_/ |_||_.__/ \___| |_| \_\\___||_| |_| |_|\___/ \__|\___|
+"@ -ForegroundColor Blue
+ Write-Host "Local-first agent runtime for Slack" -ForegroundColor Green
+ Write-Host ""
+}
+
+function Write-Info {
+ param([string]$Message)
+ Write-Host "[INFO] " -ForegroundColor Blue -NoNewline
+ Write-Host $Message
+}
+
+function Write-Success {
+ param([string]$Message)
+ Write-Host "[OK] " -ForegroundColor Green -NoNewline
+ Write-Host $Message
+}
+
+function Write-Warning {
+ param([string]$Message)
+ Write-Host "[WARN] " -ForegroundColor Yellow -NoNewline
+ Write-Host $Message
+}
+
+function Write-Error {
+ param([string]$Message)
+ Write-Host "[ERROR] " -ForegroundColor Red -NoNewline
+ Write-Host $Message
+ exit 1
+}
+
+function Test-Command {
+ param([string]$Command)
+ $null = Get-Command $Command -ErrorAction SilentlyContinue
+ return $?
+}
+
+function Get-PythonVersion {
+ param([string]$PythonCmd)
+ try {
+ $version = & $PythonCmd -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')" 2>$null
+ return [Version]$version
+ } catch {
+ return $null
+ }
+}
+
+function Find-Python {
+ $candidates = @("python", "python3", "py -3")
+
+ foreach ($cmd in $candidates) {
+ if (Test-Command $cmd.Split()[0]) {
+ $version = Get-PythonVersion $cmd
+ if ($version -and $version -ge $MIN_PYTHON_VERSION) {
+ return $cmd
+ }
+ }
+ }
+ return $null
+}
+
+function Install-Uv {
+ if (Test-Command "uv") {
+ Write-Success "uv is already installed"
+ return
+ }
+
+ Write-Info "Installing uv (Python package manager)..."
+
+ try {
+ irm https://astral.sh/uv/install.ps1 | iex
+
+ # Refresh PATH
+ $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
+
+ if (Test-Command "uv") {
+ Write-Success "uv installed successfully"
+ } else {
+ # Check common locations
+ $uvPath = "$env:USERPROFILE\.local\bin\uv.exe"
+ if (Test-Path $uvPath) {
+ $env:Path += ";$env:USERPROFILE\.local\bin"
+ Write-Success "uv installed successfully"
+ } else {
+ throw "uv not found after installation"
+ }
+ }
+ } catch {
+ Write-Error "Failed to install uv. Please install it manually: https://docs.astral.sh/uv/"
+ }
+}
+
+function Install-Vibe {
+ Write-Info "Installing vibe-remote..."
+
+ if (Test-Command "uv") {
+ try {
+ & uv tool install $PACKAGE_NAME --force 2>$null
+ } catch {
+ & uv tool install "git+https://github.com/$REPO.git" --force
+ }
+ } else {
+ $pythonCmd = Find-Python
+ if (-not $pythonCmd) {
+ Write-Error "Python $MIN_PYTHON_VERSION+ is required but not found. Please install Python first."
+ }
+
+ Write-Info "Using $pythonCmd (uv not found, falling back to pip)"
+ try {
+ & $pythonCmd -m pip install --user $PACKAGE_NAME 2>$null
+ } catch {
+ & $pythonCmd -m pip install --user "git+https://github.com/$REPO.git"
+ }
+ }
+
+ Write-Success "vibe-remote installed successfully"
+}
+
+function Test-Installation {
+ Write-Info "Verifying installation..."
+
+ # Refresh PATH
+ $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
+ $env:Path += ";$env:USERPROFILE\.local\bin"
+
+ if (Test-Command "vibe") {
+ Write-Success "vibe command is available"
+ Write-Host ""
+ & vibe doctor
+ return $true
+ }
+
+ # Check common install locations
+ $vibeLocations = @(
+ "$env:USERPROFILE\.local\bin\vibe.exe",
+ "$env:APPDATA\Python\Scripts\vibe.exe"
+ )
+
+ foreach ($loc in $vibeLocations) {
+ if (Test-Path $loc) {
+ Write-Warning "vibe installed at $loc but not in PATH"
+ Write-Host ""
+ Write-Host "Add this directory to your PATH:" -ForegroundColor Yellow
+ Write-Host " $(Split-Path $loc)"
+ Write-Host ""
+ return $true
+ }
+ }
+
+ Write-Error "Installation verification failed. vibe command not found."
+}
+
+function Write-NextSteps {
+ Write-Host ""
+ Write-Host "Installation complete!" -ForegroundColor Green
+ Write-Host ""
+ Write-Host "Next steps:" -ForegroundColor Blue
+ Write-Host " 1. Run 'vibe' to start the setup wizard"
+ Write-Host " 2. Configure your Slack app tokens in the web UI"
+ Write-Host " 3. Enable channels and start chatting with AI agents"
+ Write-Host ""
+ Write-Host "Quick commands:" -ForegroundColor Blue
+ Write-Host " vibe - Start Vibe Remote (service + web UI)"
+ Write-Host " vibe status - Check service status"
+ Write-Host " vibe stop - Stop all services"
+ Write-Host " vibe doctor - Run diagnostics"
+ Write-Host ""
+ Write-Host "Uninstall:" -ForegroundColor Blue
+ Write-Host " uv tool uninstall vibe-remote # if installed with uv"
+ Write-Host " pip uninstall vibe-remote # if installed with pip"
+ Write-Host " Remove-Item -Recurse ~\.vibe_remote # remove config and data"
+ Write-Host ""
+ Write-Host "Documentation:" -ForegroundColor Blue
+ Write-Host " https://github.com/$REPO#readme"
+ Write-Host ""
+}
+
+# Main installation flow
+function Main {
+ Write-Banner
+
+ Write-Info "Detected OS: Windows"
+
+ # Check Python
+ $pythonCmd = Find-Python
+ if ($pythonCmd) {
+ $version = Get-PythonVersion $pythonCmd
+ Write-Success "Found Python $version ($pythonCmd)"
+ } else {
+ Write-Warning "Python $MIN_PYTHON_VERSION+ not found, will try to use uv's managed Python"
+ }
+
+ # Install uv
+ Install-Uv
+
+ # Install vibe-remote
+ Install-Vibe
+
+ # Verify
+ Test-Installation
+
+ # Done
+ Write-NextSteps
+}
+
+# Run main
+Main
diff --git a/install.sh b/install.sh
new file mode 100755
index 000000000..bdee532fa
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,254 @@
+#!/usr/bin/env bash
+# Vibe Remote Installation Script
+# Usage: curl -fsSL https://raw.githubusercontent.com/cyhhao/vibe-remote/master/install.sh | bash
+
+set -e
+
+# Colors for output
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+YELLOW='\033[1;33m'
+BLUE='\033[0;34m'
+NC='\033[0m' # No Color
+
+# Configuration
+REPO="cyhhao/vibe-remote"
+PACKAGE_NAME="vibe-remote"
+MIN_PYTHON_VERSION="3.9"
+
+print_banner() {
+ echo -e "${BLUE}"
+ cat << 'EOF'
+ __ __ _ _ ____ _
+ \ \ / /(_)| |__ ___ | _ \ ___ _ __ ___ ___ | |_ ___
+ \ \ / / | || '_ \ / _ \ | |_) |/ _ \| '_ ` _ \ / _ \| __|/ _ \
+ \ V / | || |_) || __/ | _ <| __/| | | | | | (_) | |_| __/
+ \_/ |_||_.__/ \___| |_| \_\\___||_| |_| |_|\___/ \__|\___|
+EOF
+ echo -e "${NC}"
+ echo -e "${GREEN}Local-first agent runtime for Slack${NC}"
+ echo ""
+}
+
+info() {
+ echo -e "${BLUE}[INFO]${NC} $1"
+}
+
+success() {
+ echo -e "${GREEN}[OK]${NC} $1"
+}
+
+warn() {
+ echo -e "${YELLOW}[WARN]${NC} $1"
+}
+
+error() {
+ echo -e "${RED}[ERROR]${NC} $1"
+ exit 1
+}
+
+# Detect OS
+detect_os() {
+ case "$(uname -s)" in
+ Linux*) OS="linux";;
+ Darwin*) OS="macos";;
+ CYGWIN*|MINGW*|MSYS*) OS="windows";;
+ *) OS="unknown";;
+ esac
+ echo "$OS"
+}
+
+# Check if command exists
+command_exists() {
+ command -v "$1" >/dev/null 2>&1
+}
+
+# Version comparison: returns 0 if $1 >= $2
+version_gte() {
+ [ "$(printf '%s\n' "$2" "$1" | sort -V | head -n1)" = "$2" ]
+}
+
+# Get Python version
+get_python_version() {
+ local python_cmd="$1"
+ $python_cmd -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')" 2>/dev/null
+}
+
+# Find suitable Python
+find_python() {
+ local python_candidates=("python3" "python" "python3.12" "python3.11" "python3.10" "python3.9")
+
+ for cmd in "${python_candidates[@]}"; do
+ if command_exists "$cmd"; then
+ local version
+ version=$(get_python_version "$cmd")
+ if [ -n "$version" ] && version_gte "$version" "$MIN_PYTHON_VERSION"; then
+ echo "$cmd"
+ return 0
+ fi
+ fi
+ done
+ return 1
+}
+
+# Install uv if not present
+install_uv() {
+ if command_exists uv; then
+ success "uv is already installed"
+ return 0
+ fi
+
+ info "Installing uv (Python package manager)..."
+
+ local os
+ os=$(detect_os)
+
+ case "$os" in
+ macos|linux)
+ curl -LsSf https://astral.sh/uv/install.sh | sh
+ # Add to PATH for current session
+ export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$PATH"
+ ;;
+ windows)
+ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
+ ;;
+ *)
+ error "Unsupported operating system"
+ ;;
+ esac
+
+ if command_exists uv; then
+ success "uv installed successfully"
+ else
+ # Try to find it in common locations
+ if [ -f "$HOME/.local/bin/uv" ]; then
+ export PATH="$HOME/.local/bin:$PATH"
+ success "uv installed successfully"
+ elif [ -f "$HOME/.cargo/bin/uv" ]; then
+ export PATH="$HOME/.cargo/bin:$PATH"
+ success "uv installed successfully"
+ else
+ error "Failed to install uv. Please install it manually: https://docs.astral.sh/uv/"
+ fi
+ fi
+}
+
+# Install vibe-remote
+install_vibe() {
+ info "Installing vibe-remote..."
+
+ if command_exists uv; then
+ # Use uv tool install (recommended)
+ uv tool install "$PACKAGE_NAME" --force 2>/dev/null || \
+ uv tool install "git+https://github.com/${REPO}.git" --force
+ else
+ # Fallback to pip
+ local python_cmd
+ python_cmd=$(find_python)
+ if [ -z "$python_cmd" ]; then
+ error "Python ${MIN_PYTHON_VERSION}+ is required but not found. Please install Python first."
+ fi
+
+ info "Using $python_cmd (uv not found, falling back to pip)"
+ $python_cmd -m pip install --user "$PACKAGE_NAME" 2>/dev/null || \
+ $python_cmd -m pip install --user "git+https://github.com/${REPO}.git"
+ fi
+
+ success "vibe-remote installed successfully"
+}
+
+# Verify installation
+verify_installation() {
+ info "Verifying installation..."
+
+ # Refresh PATH
+ export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$PATH"
+
+ if command_exists vibe; then
+ success "vibe command is available"
+ echo ""
+ vibe --help 2>/dev/null || vibe doctor
+ return 0
+ fi
+
+ # Check common install locations
+ local vibe_locations=(
+ "$HOME/.local/bin/vibe"
+ "$HOME/.cargo/bin/vibe"
+ "$(python3 -m site --user-base 2>/dev/null)/bin/vibe"
+ )
+
+ for loc in "${vibe_locations[@]}"; do
+ if [ -f "$loc" ]; then
+ warn "vibe installed at $loc but not in PATH"
+ echo ""
+ echo -e "${YELLOW}Add this to your shell config (.bashrc, .zshrc, etc.):${NC}"
+ echo -e " export PATH=\"$(dirname "$loc"):\$PATH\""
+ echo ""
+ return 0
+ fi
+ done
+
+ error "Installation verification failed. vibe command not found."
+}
+
+# Print next steps
+print_next_steps() {
+ echo ""
+ echo -e "${GREEN}Installation complete!${NC}"
+ echo ""
+ echo -e "${BLUE}Next steps:${NC}"
+ echo " 1. Run 'vibe' to start the setup wizard"
+ echo " 2. Configure your Slack app tokens in the web UI"
+ echo " 3. Enable channels and start chatting with AI agents"
+ echo ""
+ echo -e "${BLUE}Quick commands:${NC}"
+ echo " vibe - Start Vibe Remote (service + web UI)"
+ echo " vibe status - Check service status"
+ echo " vibe stop - Stop all services"
+ echo " vibe doctor - Run diagnostics"
+ echo ""
+ echo -e "${BLUE}Uninstall:${NC}"
+ echo " uv tool uninstall vibe-remote # if installed with uv"
+ echo " pip uninstall vibe-remote # if installed with pip"
+ echo " rm -rf ~/.vibe_remote # remove config and data"
+ echo ""
+ echo -e "${BLUE}Documentation:${NC}"
+ echo " https://github.com/${REPO}#readme"
+ echo ""
+}
+
+# Main installation flow
+main() {
+ print_banner
+
+ local os
+ os=$(detect_os)
+ info "Detected OS: $os"
+
+ # Check Python
+ local python_cmd
+ python_cmd=$(find_python) || true
+ if [ -n "$python_cmd" ]; then
+ local version
+ version=$(get_python_version "$python_cmd")
+ success "Found Python $version ($python_cmd)"
+ else
+ warn "Python ${MIN_PYTHON_VERSION}+ not found, will try to use uv's managed Python"
+ fi
+
+ # Install uv
+ install_uv
+
+ # Install vibe-remote
+ install_vibe
+
+ # Verify
+ verify_installation
+
+ # Done
+ print_next_steps
+}
+
+# Run main
+main "$@"
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 000000000..65979474d
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,71 @@
+[build-system]
+requires = ["hatchling"]
+build-backend = "hatchling.build"
+
+[project]
+name = "vibe-remote"
+version = "2.0.0"
+description = "Local-first agent runtime for Slack - run AI coding agents from your chat"
+readme = "README.md"
+license = "MIT"
+requires-python = ">=3.9"
+authors = [
+ { name = "cyhhao", email = "[email protected]" }
+]
+keywords = ["slack", "ai", "agent", "claude", "opencode", "codex", "automation"]
+classifiers = [
+ "Development Status :: 4 - Beta",
+ "Environment :: Console",
+ "Intended Audience :: Developers",
+ "License :: OSI Approved :: MIT License",
+ "Operating System :: OS Independent",
+ "Programming Language :: Python :: 3",
+ "Programming Language :: Python :: 3.9",
+ "Programming Language :: Python :: 3.10",
+ "Programming Language :: Python :: 3.11",
+ "Programming Language :: Python :: 3.12",
+ "Topic :: Communications :: Chat",
+ "Topic :: Software Development :: Libraries :: Python Modules",
+]
+dependencies = [
+ "claude-code-sdk>=0.0.25",
+ "anyio>=4.0.0",
+ "slack-sdk>=3.26.0",
+ "aiohttp>=3.8.0",
+ "markdown_to_mrkdwn>=0.2.0",
+ "typing_extensions>=4.12.2",
+ "PyYAML>=6.0",
+]
+
+[project.urls]
+Homepage = "https://github.com/cyhhao/vibe-remote"
+Repository = "https://github.com/cyhhao/vibe-remote"
+Documentation = "https://github.com/cyhhao/vibe-remote#readme"
+Issues = "https://github.com/cyhhao/vibe-remote/issues"
+
+[project.scripts]
+vibe = "vibe.cli:main"
+
+[tool.hatch.build]
+# Include ui/dist even though it's in .gitignore (build artifacts)
+artifacts = ["ui/dist/**"]
+
+[tool.hatch.build.targets.wheel]
+packages = ["vibe", "config", "core", "modules"]
+
+[tool.hatch.build.targets.wheel.force-include]
+"main.py" = "vibe/service_main.py"
+"ui/dist" = "vibe/ui/dist"
+
+[tool.hatch.build.targets.sdist]
+# Include ui/dist for source distribution
+include = [
+ "vibe/**",
+ "config/**",
+ "core/**",
+ "modules/**",
+ "main.py",
+ "ui/dist/**",
+ "README.md",
+ "LICENSE",
+]
diff --git a/vibe/__init__.py b/vibe/__init__.py
index e69de29bb..ca3d9c0c2 100644
--- a/vibe/__init__.py
+++ b/vibe/__init__.py
@@ -0,0 +1,3 @@
+"""Vibe Remote - Local-first agent runtime for Slack"""
+
+__version__ = "2.0.0"
diff --git a/vibe/cli.py b/vibe/cli.py
index 9037d1f33..344b7aa78 100644
--- a/vibe/cli.py
+++ b/vibe/cli.py
@@ -123,45 +123,260 @@ def _render_status():
def _doctor():
- checks = {}
+ """Run diagnostic checks and return results in UI-compatible format.
+
+ Returns:
+ {
+ "groups": [{"name": "...", "items": [{"status": "pass|warn|fail", "message": "...", "action": "..."}]}],
+ "summary": {"pass": 0, "warn": 0, "fail": 0},
+ "ok": bool
+ }
+ """
+ groups = []
+ summary = {"pass": 0, "warn": 0, "fail": 0}
+
+ # Configuration Group
+ config_items = []
config_path = paths.get_config_path()
+
if config_path.exists():
- checks["config"] = {
- "status": "ok",
- "detail": str(config_path),
- }
+ config_items.append({
+ "status": "pass",
+ "message": f"Configuration file found: {config_path}",
+ })
+ summary["pass"] += 1
else:
- checks["config"] = {"status": "error", "detail": "config.json not found"}
-
+ config_items.append({
+ "status": "fail",
+ "message": "Configuration file not found",
+ "action": "Run 'vibe' to create initial configuration",
+ })
+ summary["fail"] += 1
+
config = None
try:
config = V2Config.load(config_path)
- checks["config_load"] = {"status": "ok", "detail": "loaded"}
+ config_items.append({
+ "status": "pass",
+ "message": "Configuration loaded successfully",
+ })
+ summary["pass"] += 1
except Exception as exc:
- checks["config_load"] = {"status": "error", "detail": str(exc)}
-
+ config_items.append({
+ "status": "fail",
+ "message": f"Failed to load configuration: {exc}",
+ "action": "Check config.json syntax or delete and reconfigure",
+ })
+ summary["fail"] += 1
+
+ groups.append({"name": "Configuration", "items": config_items})
+
+ # Slack Group
+ slack_items = []
if config:
try:
config.slack.validate()
- checks["slack"] = {"status": "ok", "detail": "token format ok"}
+ slack_items.append({
+ "status": "pass",
+ "message": "Slack token format is valid",
+ })
+ summary["pass"] += 1
+
+ # Check if tokens are actually set
+ if config.slack.bot_token:
+ slack_items.append({
+ "status": "pass",
+ "message": "Bot token is configured",
+ })
+ summary["pass"] += 1
+ else:
+ slack_items.append({
+ "status": "warn",
+ "message": "Bot token is not configured",
+ "action": "Add your Slack bot token in the setup wizard",
+ })
+ summary["warn"] += 1
+
+ if config.slack.app_token:
+ slack_items.append({
+ "status": "pass",
+ "message": "App token is configured (Socket Mode)",
+ })
+ summary["pass"] += 1
+ else:
+ slack_items.append({
+ "status": "warn",
+ "message": "App token is not configured",
+ "action": "Add your Slack app token for Socket Mode",
+ })
+ summary["warn"] += 1
+
except Exception as exc:
- checks["slack"] = {"status": "error", "detail": str(exc)}
-
- checks["opencode"] = {
- "status": "ok" if config.agents.opencode.enabled else "skip",
- "detail": config.agents.opencode.cli_path,
- }
- checks["claude"] = {
- "status": "ok" if config.agents.claude.enabled else "skip",
- "detail": config.agents.claude.cli_path,
- }
- checks["codex"] = {
- "status": "ok" if config.agents.codex.enabled else "skip",
- "detail": config.agents.codex.cli_path,
- }
-
- ok = all(check["status"] in ("ok", "skip") for check in checks.values())
- result = {"ok": ok, "checks": checks}
+ slack_items.append({
+ "status": "fail",
+ "message": f"Slack token validation failed: {exc}",
+ "action": "Check your Slack tokens in the setup wizard",
+ })
+ summary["fail"] += 1
+ else:
+ slack_items.append({
+ "status": "fail",
+ "message": "Cannot check Slack: configuration not loaded",
+ })
+ summary["fail"] += 1
+
+ groups.append({"name": "Slack", "items": slack_items})
+
+ # Agent Backends Group
+ agent_items = []
+ if config:
+ # OpenCode
+ if config.agents.opencode.enabled:
+ cli_path = config.agents.opencode.cli_path
+ import shutil
+ found_path = shutil.which(cli_path) if cli_path else None
+ if found_path:
+ agent_items.append({
+ "status": "pass",
+ "message": f"OpenCode CLI found: {found_path}",
+ })
+ summary["pass"] += 1
+ else:
+ agent_items.append({
+ "status": "warn",
+ "message": f"OpenCode CLI not found: {cli_path}",
+ "action": "Install OpenCode or update CLI path",
+ })
+ summary["warn"] += 1
+ else:
+ agent_items.append({
+ "status": "pass",
+ "message": "OpenCode: disabled",
+ })
+ summary["pass"] += 1
+
+ # Claude
+ if config.agents.claude.enabled:
+ cli_path = config.agents.claude.cli_path
+ import shutil
+ # Check preferred location first
+ preferred = Path.home() / ".claude" / "local" / "claude"
+ if preferred.exists() and os.access(preferred, os.X_OK):
+ found_path = str(preferred)
+ else:
+ found_path = shutil.which(cli_path) if cli_path else None
+
+ if found_path:
+ agent_items.append({
+ "status": "pass",
+ "message": f"Claude CLI found: {found_path}",
+ })
+ summary["pass"] += 1
+ else:
+ agent_items.append({
+ "status": "warn",
+ "message": f"Claude CLI not found: {cli_path}",
+ "action": "Install Claude Code or update CLI path",
+ })
+ summary["warn"] += 1
+ else:
+ agent_items.append({
+ "status": "pass",
+ "message": "Claude: disabled",
+ })
+ summary["pass"] += 1
+
+ # Codex
+ if config.agents.codex.enabled:
+ cli_path = config.agents.codex.cli_path
+ import shutil
+ found_path = shutil.which(cli_path) if cli_path else None
+ if found_path:
+ agent_items.append({
+ "status": "pass",
+ "message": f"Codex CLI found: {found_path}",
+ })
+ summary["pass"] += 1
+ else:
+ agent_items.append({
+ "status": "warn",
+ "message": f"Codex CLI not found: {cli_path}",
+ "action": "Install Codex or update CLI path",
+ })
+ summary["warn"] += 1
+ else:
+ agent_items.append({
+ "status": "pass",
+ "message": "Codex: disabled",
+ })
+ summary["pass"] += 1
+
+ # Default backend check
+ default_backend = config.agents.default_backend
+ agent_items.append({
+ "status": "pass",
+ "message": f"Default backend: {default_backend}",
+ })
+ summary["pass"] += 1
+ else:
+ agent_items.append({
+ "status": "fail",
+ "message": "Cannot check agents: configuration not loaded",
+ })
+ summary["fail"] += 1
+
+ groups.append({"name": "Agent Backends", "items": agent_items})
+
+ # Runtime Group
+ runtime_items = []
+ if config:
+ cwd = config.runtime.default_cwd
+ if cwd and os.path.isdir(cwd):
+ runtime_items.append({
+ "status": "pass",
+ "message": f"Working directory: {cwd}",
+ })
+ summary["pass"] += 1
+ else:
+ runtime_items.append({
+ "status": "warn",
+ "message": f"Working directory does not exist: {cwd}",
+ "action": "Update default_cwd in settings",
+ })
+ summary["warn"] += 1
+
+ runtime_items.append({
+ "status": "pass",
+ "message": f"Log level: {config.runtime.log_level}",
+ })
+ summary["pass"] += 1
+
+ # Check log file
+ log_path = paths.get_logs_dir() / "vibe_remote.log"
+ if log_path.exists():
+ runtime_items.append({
+ "status": "pass",
+ "message": f"Log file: {log_path}",
+ })
+ summary["pass"] += 1
+ else:
+ runtime_items.append({
+ "status": "pass",
+ "message": "Log file will be created on first run",
+ })
+ summary["pass"] += 1
+
+ groups.append({"name": "Runtime", "items": runtime_items})
+
+ # Calculate overall status
+ ok = summary["fail"] == 0
+
+ result = {
+ "groups": groups,
+ "summary": summary,
+ "ok": ok,
+ }
+
_write_json(paths.get_runtime_doctor_path(), result)
return result
@@ -216,7 +431,34 @@ def cmd_status():
def cmd_doctor():
result = _doctor()
- print(json.dumps(result, indent=2))
+
+ # Terminal-friendly output
+ print("\n Vibe Remote Diagnostics")
+ print(" " + "=" * 40)
+
+ for group in result.get("groups", []):
+ print(f"\n {group['name']}")
+ print(" " + "-" * 30)
+ for item in group.get("items", []):
+ status = item["status"]
+ if status == "pass":
+ icon = "\033[32m✓\033[0m" # Green checkmark
+ elif status == "warn":
+ icon = "\033[33m!\033[0m" # Yellow warning
+ else:
+ icon = "\033[31m✗\033[0m" # Red X
+
+ print(f" {icon} {item['message']}")
+ if item.get("action"):
+ print(f" → {item['action']}")
+
+ summary = result.get("summary", {})
+ print("\n " + "-" * 30)
+ print(f" \033[32m{summary.get('pass', 0)} passed\033[0m "
+ f"\033[33m{summary.get('warn', 0)} warnings\033[0m "
+ f"\033[31m{summary.get('fail', 0)} failed\033[0m")
+ print()
+
return 0 if result["ok"] else 1
diff --git a/vibe/runtime.py b/vibe/runtime.py
index c62ef357d..04b7979b1 100644
--- a/vibe/runtime.py
+++ b/vibe/runtime.py
@@ -18,8 +18,63 @@ from config.v2_config import (
)
-ROOT_DIR = Path(__file__).resolve().parents[1]
-MAIN_PATH = ROOT_DIR / "main.py"
+def get_package_root() -> Path:
+ """Get the root directory of the vibe package."""
+ return Path(__file__).resolve().parent
+
+
+def get_project_root() -> Path:
+ """Get the project root directory (for development mode)."""
+ return Path(__file__).resolve().parents[1]
+
+
+def get_ui_dist_path() -> Path:
+ """Get the path to UI dist directory."""
+ # First check if we're in development mode (ui/dist exists at project root)
+ project_root = get_project_root()
+ dev_ui_path = project_root / "ui" / "dist"
+ if dev_ui_path.exists():
+ return dev_ui_path
+
+ # Then check if UI is bundled with the package
+ package_ui_path = get_package_root() / "ui" / "dist"
+ if package_ui_path.exists():
+ return package_ui_path
+
+ # Fallback to development path
+ return dev_ui_path
+
+
+def get_service_main_path() -> Path:
+ """Get the path to the main service entry point."""
+ # First check if we're in development mode (main.py exists at project root)
+ project_root = get_project_root()
+ dev_main_path = project_root / "main.py"
+ if dev_main_path.exists():
+ return dev_main_path
+
+ # Then check if service_main.py is bundled with the package
+ package_main_path = get_package_root() / "service_main.py"
+ if package_main_path.exists():
+ return package_main_path
+
+ # Fallback to development path
+ return dev_main_path
+
+
+def get_working_dir() -> Path:
+ """Get the working directory for subprocess execution."""
+ # In development mode, use project root
+ project_root = get_project_root()
+ if (project_root / "main.py").exists():
+ return project_root
+
+ # In installed mode, use package root
+ return get_package_root()
+
+
+ROOT_DIR = get_project_root() # For backward compatibility
+MAIN_PATH = get_service_main_path()
def ensure_dirs():
@@ -31,7 +86,7 @@ def default_config():
mode="self_host",
version="v2",
slack=SlackConfig(bot_token="", app_token=""),
- runtime=RuntimeConfig(default_cwd=str(ROOT_DIR / "_tmp")),
+ runtime=RuntimeConfig(default_cwd=str(Path.cwd())),
agents=AgentsConfig(
default_backend="opencode",
opencode=OpenCodeConfig(enabled=True, cli_path="opencode"),
@@ -82,7 +137,7 @@ def spawn_background(args, pid_path, stdout_name: str, stderr_name: str):
stdout=stdout,
stderr=stderr,
start_new_session=True,
- cwd=str(ROOT_DIR),
+ cwd=str(get_working_dir()),
close_fds=True,
)
stdout.close()
@@ -129,8 +184,9 @@ def render_status():
def start_service():
+ main_path = get_service_main_path()
return spawn_background(
- [sys.executable, str(MAIN_PATH)],
+ [sys.executable, str(main_path)],
paths.get_runtime_pid_path(),
"service_stdout.log",
"service_stderr.log",
diff --git a/vibe/ui_server.py b/vibe/ui_server.py
index 981d708bf..96537ee27 100644
--- a/vibe/ui_server.py
+++ b/vibe/ui_server.py
@@ -7,6 +7,7 @@ from pathlib import Path
from typing import Any
from config import paths
+from vibe.runtime import get_ui_dist_path, get_working_dir
class UiHandler(http.server.BaseHTTPRequestHandler):
@@ -104,7 +105,7 @@ class UiHandler(http.server.BaseHTTPRequestHandler):
self._send_json(api.detect_cli(binary))
return
- ui_dist = Path("ui/dist")
+ ui_dist = get_ui_dist_path()
requested_path = self.path.lstrip("/")
if requested_path.startswith("assets/"):
file_path = ui_dist / requested_path
@@ -192,9 +193,9 @@ class UiHandler(http.server.BaseHTTPRequestHandler):
import subprocess
import sys
import time
- from pathlib import Path
from config import paths as config_paths
- root_dir = Path(__file__).resolve().parents[1]
+ from vibe.runtime import get_working_dir
+ working_dir = get_working_dir()
# Start new UI server process first (it will retry until port is available)
command = f"from vibe.ui_server import run_ui_server; run_ui_server('{host}', {port})"
stdout_path = config_paths.get_runtime_dir() / "ui_stdout.log"
@@ -206,7 +207,7 @@ class UiHandler(http.server.BaseHTTPRequestHandler):
stdout=stdout,
stderr=stderr,
start_new_session=True,
- cwd=str(root_dir),
+ cwd=str(working_dir),
close_fds=True,
)
stdout.close()