Unified Agent + reusable Go agent core.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs: rewrite readme for app-first onboarding

Lyric 03c9c0da 0beb81db

+484 -798
+62 -291
README.md
··· 1 1 # Mister Morph 2 2 3 - Unified Agent CLI + reusable Go agent core. 3 + Desktop app, CLI, and reusable Go runtime for running local or channel-connected agents. 4 4 5 5 Other languages: [简体中文](docs/zh-CN/README.md) | [日本語](docs/ja-JP/README.md) 6 6 7 - ## Table of contents 7 + If you just want to try Mister Morph, start with the desktop App from the [GitHub Releases](https://github.com/quailyquaily/mistermorph/releases) page. It bundles the Console UI, starts the local backend for you, and walks you through first-run setup. 8 8 9 - - [Why Mister Morph](#why-mistermorph) 10 - - [Quickstart](#quickstart) 11 - - [Start Modes](#start-modes) 12 - - [Supported Models](#supported-models) 13 - - [Embedding](#embedding-to-other-projects) 14 - - [Built-in Tools](#built-in-tools) 15 - - [Skills](#skills) 16 - - [Security](#security) 17 - - [Troubleshoots](#troubleshoots) 18 - - [Debug](#debug) 19 - - [Configuration](#configuration) 9 + ## Why Mister Morph 10 + 11 + - 🖥️ App-first onboarding: the desktop App removes the old multi-terminal setup path, but the CLI is still there when you want it. 12 + - 🧩 Reusable Go core: run Mister Morph as a desktop App, CLI, Console backend, or embed it into another Go project. 13 + - 🔀 One backend, multiple entrypoints: desktop App, Console server, CLI, and channel runtimes all build on the same core runtime. 14 + - 🛠️ Practical extension model: built-in tools, `SKILL.md` skills, and Go embedding cover local use, automation, and integration. 15 + - 🔒 Security-minded by design: auth profiles, outbound policy controls, approvals, and redaction are built into the runtime model. 20 16 21 - ## Why Mister Morph 17 + ## Quick Start 22 18 23 - What makes this project worth looking at: 19 + ### Desktop App (recommended) 24 20 25 - - 🧩 **Reusable Go core**: Run the agent as a CLI, or embed it as a library/subprocess in other apps. 26 - - 🔒 **Serious secure defaults**: Profile-based credential injection, Guard redaction, outbound policy controls, and async approvals with audit trails (see [docs/security.md](docs/security.md)). 27 - - 🧰 **Practical Skills system**: Discover + inject `SKILL.md` from `file_state_dir/skills`, with simple on/off control (see [docs/skills.md](docs/skills.md)). 28 - - 📚 **Beginner-friendly**: Built as a learning-first agent project, with detailed design docs in `docs/` and practical debugging tools like `--inspect-prompt` and `--inspect-request`. 21 + 1. Download a release asset from the [GitHub Releases](https://github.com/quailyquaily/mistermorph/releases) page: 22 + - macOS: `mistermorph-desktop-darwin-arm64.dmg` 23 + - Linux: `mistermorph-desktop-linux-amd64.AppImage` 24 + - Windows: `mistermorph-desktop-windows-amd64.zip` 25 + 2. Launch the App. 26 + 3. Complete the setup flow inside the App. 27 + 4. Use the Console UI. You do not need to run `mistermorph console serve` manually. 29 28 30 - ## Quickstart 29 + Build, packaging, and platform notes: [docs/app.md](docs/app.md) 31 30 32 - ### Step 1: Install 31 + ### CLI 33 32 34 - Option A: download a prebuilt binary from GitHub Releases (recommended for production use): 33 + Install a CLI binary: 35 34 36 35 ```bash 37 36 curl -fsSL -o /tmp/install-mistermorph.sh https://raw.githubusercontent.com/quailyquaily/mistermorph/refs/heads/master/scripts/install-release.sh 38 37 sudo bash /tmp/install-mistermorph.sh 39 38 ``` 40 39 41 - The installer supports: 42 - 43 - - `bash install-release.sh <version-tag>` 44 - - `INSTALL_DIR=$HOME/.local/bin bash install-release.sh <version-tag>` 45 - 46 - Option B: install from source with Go: 40 + Or install from source: 47 41 48 42 ```bash 49 43 go install github.com/quailyquaily/mistermorph/cmd/mistermorph@latest 50 44 ``` 51 45 52 - ### Step 2: Bootstrap the agent workspace 46 + Bootstrap a workspace, set an API key, and run one task: 53 47 54 48 ```bash 55 49 mistermorph install 56 - # or 57 - mistermorph install <dir> 58 - ``` 59 - 60 - The `install` command initializes `config.yaml` plus the core onboarding markdown files under `~/.morph/` (or a specified directory via `<dir>`). 61 - 62 - When `config.yaml` does not already exist in the install target, `install` first tries to find a readable config in this order: 63 - 64 - 1. `--config` path 65 - 2. `<dir>/config.yaml` 66 - 3. `~/.morph/config.yaml` 67 - 68 - If none is found, `install` runs an interactive setup wizard (TTY only) before writing `config.yaml`: 69 - 70 - 1. select LLM provider (`openai-compatible|gemini|anthropic|cloudflare`) 71 - 2. fill provider-specific required fields 72 - 3. set model 73 - 4. fill `IDENTITY.md` 74 - 5. choose a `SOUL.md` preset or customize it 75 - 76 - Use `mistermorph install --yes` to skip interactive prompts. 77 - 78 - ### Step 3: Setup an API key 79 - 80 - You can run without a `config.yaml` by using environment variables: 81 - 82 - ```bash 83 - export MISTER_MORPH_LLM_API_KEY="YOUR_OPENAI_API_KEY_HERE" 84 - # Optional explicit defaults: 85 - export MISTER_MORPH_LLM_PROVIDER="openai" 86 - export MISTER_MORPH_LLM_MODEL="gpt-5.4" 87 - ``` 88 - 89 - If you prefer file-based config, use `~/.morph/config.yaml`. 90 - 91 - ## Start Modes 92 - 93 - ### One-time run 94 - 95 - ```bash 50 + export MISTER_MORPH_LLM_API_KEY="YOUR_API_KEY" 96 51 mistermorph run --task "Hello!" 97 52 ``` 98 53 99 - ### Desktop App 100 - 101 - The desktop wrapper starts the Console UI for you and handles first-run setup inside the app. 102 - 103 - See [`docs/app.md`](docs/app.md) for build and run details. 104 - 105 - ### Other modes 106 - 107 - Console server mode, Telegram, Slack, LINE, Lark, and runtime endpoint submission are documented in [`docs/modes.md`](docs/modes.md). 108 - 109 - ## Supported Models 54 + If `config.yaml` does not exist yet, `mistermorph install` launches the setup wizard and writes the initial workspace files for you. 110 55 111 - > Model support may vary by specific model ID, provider endpoint capability, and tool-calling behavior. 112 - 113 - | Model family | Model range | Status | 114 - |---|---|---| 115 - | GPT | `gpt-5*` | ✅ Full | 116 - | GPT-OSS | `gpt-oss-120b` | ✅ Full | 117 - | Grok | `grok-4+` | ✅ Full | 118 - | Claude | `claude-3.5+` | ✅ Full | 119 - | DeepSeek | `deepseek-3*` | ✅ Full | 120 - | Gemini | `gemini-2.5+` | ✅ Full | 121 - | Kimi | `kimi-2.5+` | ✅ Full | 122 - | MiniMax | `minimax* / minimax-m2.5+` | ✅ Full | 123 - | GLM | `glm-4.6+` | ✅ Full | 124 - | Cloudflare Workers AI | `Workers AI model IDs` | ⚠️ Limited (no tool calling) | 56 + CLI modes and configuration details: [docs/modes.md](docs/modes.md), [docs/configuration.md](docs/configuration.md) 125 57 126 - ## Embedding to other projects 58 + ## What Mister Morph Includes 127 59 128 - See [`docs/integration.md`](docs/integration.md) for embedding patterns and examples. 60 + - A desktop App for local use with first-run setup and an embedded Console UI. 61 + - A CLI for one-shot tasks, scripting, automation, and server modes. 62 + - A local Console server for browser-based setup, runtime management, and monitoring. 63 + - Channel runtimes for Telegram, Slack, LINE, and Lark. 64 + - A reusable Go integration layer for embedding Mister Morph into other projects. 65 + - Built-in tools and a `SKILL.md`-based skills system. 66 + - Security controls for auth profiles, outbound policies, approvals, and redaction. 129 67 130 - ## Built-in Tools 68 + ## Documentation 131 69 132 - Core tools available to the agent: 70 + Start here: 133 71 134 - - `read_file`: read local text files. 135 - - `write_file`: write local text files under `file_cache_dir` or `file_state_dir`. 136 - - `bash`: run a shell command (disabled by default). 137 - - `url_fetch`: HTTP fetch with optional auth profiles. 138 - - `web_search`: web search (DuckDuckGo HTML). 139 - - `plan_create`: generate a structured plan. 72 + - [Desktop App](docs/app.md) 73 + - [Modes](docs/modes.md) 74 + - [Configuration](docs/configuration.md) 75 + - [Troubleshoots](docs/troubleshoots.md) 140 76 141 - Channel runtime tools: 77 + Reference: 142 78 143 - - `telegram_send_file`: send a file in Telegram (Telegram only). 144 - - `telegram_send_photo`: send a photo in Telegram (Telegram only). 145 - - `telegram_send_voice`: send a voice message in Telegram (Telegram only). 146 - - `message_react`: add an emoji reaction to a message (Telegram/Slack runtime; channel-specific params). 79 + - [Console](docs/console.md) 80 + - [Tools](docs/tools.md) 81 + - [Skills](docs/skills.md) 82 + - [Security](docs/security.md) 83 + - [Integration](docs/integration.md) 84 + - [Architecture](docs/arch.md) 147 85 148 - Please see [`docs/tools.md`](docs/tools.md) for detailed tool documentation. 86 + Channel setup: 149 87 150 - ## Skills 88 + - [Telegram](docs/telegram.md) 89 + - [Slack](docs/slack.md) 90 + - [LINE](docs/line.md) 91 + - [Lark](docs/lark.md) 151 92 152 - `mistermorph` discovers skills under `file_state_dir/skills` (recursively), and injects selected `SKILL.md` content into the system prompt. 93 + Full docs index: [docs/README.md](docs/README.md) 153 94 154 - By default, `run` uses `skills.enabled=true`; `skills.load=[]` loads all discovered skills, and unknown skill names are ignored. 155 - You can also reference a skill directly in task text with `$skill-name` (or `$skill-id`) to trigger that skill for the run. 95 + ## Development 156 96 157 - Docs: [`docs/skills.md`](docs/skills.md). 97 + Useful local commands: 158 98 159 99 ```bash 160 - # list available skills 161 - mistermorph skills list 162 - # Use a specific skill in the run command 163 - mistermorph run --task "..." --skills-enabled --skill skill-name 164 - # install remote skills 165 - mistermorph skills install <remote-skill-url> 100 + ./scripts/build-backend.sh --output ./bin/mistermorph 101 + ./scripts/build-desktop.sh --release 102 + go test ./... 166 103 ``` 167 104 168 - ### Security Mechanisms for Skills 169 - 170 - 1. Install audit: When installing remote skills, Mister Morph will preview the skill content and do a basic security audit (e.g., look for dangerous commands in scripts) before asking for user confirmation. 171 - 2. Auth profiles: Skills can declare required auth profiles in the `auth_profiles` field. This is only a declaration for prompt/context clarity. Actual permission still comes only from host config via `secrets.allow_profiles` and `auth_profiles` (see `assets/skills/moltbook` and the config sections). 172 - 173 - ## Security 174 - 175 - Recommended systemd hardening and secret handling: [`docs/security.md`](docs/security.md). 176 - 177 - ## Troubleshoots 178 - 179 - Known issues and workarounds: [`docs/troubleshoots.md`](docs/troubleshoots.md). 180 - 181 - ## Debug 182 - 183 - ### Logging 184 - 185 - There is an argument `--log-level` set for logging level and format: 186 - 187 - ```bash 188 - mistermorph run --log-level debug --task "..." 189 - ``` 190 - 191 - ### Dump internal debug data 192 - 193 - There are 2 arguments `--inspect-prompt`/`--inspect-request` for dumping internal state for debugging: 194 - 195 - ```bash 196 - mistermorph run --inspect-prompt --inspect-request --task "..." 197 - ``` 198 - 199 - These arguments will dump the final system/user/tool prompts and the full LLM request/response JSON as plain text files to `./dump` directory. 200 - 201 - ## Configuration 202 - 203 - `mistermorph` uses Viper, so you can configure it via flags, env vars, or a config file. 204 - 205 - - Config file: `--config /path/to/config.yaml` (supports `.yaml/.yml/.json/.toml/.ini`) 206 - - Env var prefix: `MISTER_MORPH_` 207 - - Nested keys: replace `.` and `-` with `_` (e.g. `tools.bash.enabled` → `MISTER_MORPH_TOOLS_BASH_ENABLED=true`) 208 - 209 - 210 - ### CLI flags 211 - 212 - **Global (all commands)** 213 - - `--config` 214 - - `--log-level` 215 - - `--log-format` 216 - - `--log-add-source` 217 - - `--log-include-thoughts` 218 - - `--log-include-tool-params` 219 - - `--log-include-skill-contents` 220 - - `--log-max-thought-chars` 221 - - `--log-max-json-bytes` 222 - - `--log-max-string-value-chars` 223 - - `--log-max-skill-content-chars` 224 - - `--log-redact-key` (repeatable) 225 - 226 - **run** 227 - - `--task` 228 - - `--provider` 229 - - `--endpoint` 230 - - `--model` 231 - - `--api-key` 232 - - `--llm-request-timeout` 233 - - `--interactive` 234 - - `--skills-dir` (repeatable) 235 - - `--skill` (repeatable) 236 - - `--skills-enabled` 237 - - `--max-steps` 238 - - `--parse-retries` 239 - - `--max-token-budget` 240 - - `--timeout` 241 - - `--inspect-prompt` 242 - - `--inspect-request` 243 - 244 - **submit** 245 - - `--task` 246 - - `--server-url` 247 - - `--auth-token` 248 - - `--model` 249 - - `--submit-timeout` 250 - - `--wait` 251 - - `--poll-interval` 252 - 253 - **console serve** 254 - - `--console-listen` 255 - - `--console-base-path` 256 - - `--console-static-dir` (optional; overrides the embedded Console SPA/static root) 257 - - `--console-session-ttl` 258 - 259 - **telegram** 260 - - `--telegram-bot-token` 261 - - `--telegram-allowed-chat-id` (repeatable) 262 - - `--telegram-group-trigger-mode` (`strict|smart|talkative`) 263 - - `--telegram-addressing-confidence-threshold` 264 - - `--telegram-addressing-interject-threshold` 265 - - `--telegram-poll-timeout` 266 - - `--telegram-task-timeout` 267 - - `--telegram-max-concurrency` 268 - 269 - **slack** 270 - - `--slack-bot-token` 271 - - `--slack-app-token` 272 - - `--slack-allowed-team-id` (repeatable) 273 - - `--slack-allowed-channel-id` (repeatable) 274 - - `--slack-group-trigger-mode` (`strict|smart|talkative`) 275 - - `--slack-addressing-confidence-threshold` 276 - - `--slack-addressing-interject-threshold` 277 - - `--slack-task-timeout` 278 - - `--slack-max-concurrency` 279 - 280 - **skills** 281 - - `skills list --skills-dir` (repeatable) 282 - - `skills install --dest --dry-run --clean --skip-existing --timeout --max-bytes --yes` 283 - 284 - **install** 285 - - `install [dir]` 286 - - `--yes` 287 - 288 - ### Environment variables 289 - 290 - Common env vars (these map to config keys): 291 - 292 - - `MISTER_MORPH_CONFIG` 293 - - `MISTER_MORPH_LLM_PROVIDER` 294 - - `MISTER_MORPH_LLM_ENDPOINT` 295 - - `MISTER_MORPH_LLM_MODEL` 296 - - `MISTER_MORPH_LLM_API_KEY` 297 - - `MISTER_MORPH_LLM_REQUEST_TIMEOUT` 298 - - `MISTER_MORPH_LOGGING_LEVEL` 299 - - `MISTER_MORPH_LOGGING_FORMAT` 300 - - `MISTER_MORPH_SERVER_AUTH_TOKEN` 301 - - `MISTER_MORPH_CONSOLE_PASSWORD` 302 - - `MISTER_MORPH_CONSOLE_PASSWORD_HASH` 303 - - `MISTER_MORPH_TELEGRAM_BOT_TOKEN` 304 - - `MISTER_MORPH_SLACK_BOT_TOKEN` 305 - - `MISTER_MORPH_SLACK_APP_TOKEN` 306 - - `MISTER_MORPH_FILE_CACHE_DIR` 307 - 308 - Provider-specific settings use the same mapping, for example: 309 - - `llm.azure.deployment` → `MISTER_MORPH_LLM_AZURE_DEPLOYMENT` 310 - - `llm.bedrock.model_arn` → `MISTER_MORPH_LLM_BEDROCK_MODEL_ARN` 311 - 312 - Tool toggles and limits also map to env vars, for example: 313 - 314 - - `MISTER_MORPH_TOOLS_BASH_ENABLED` 315 - - `MISTER_MORPH_TOOLS_URL_FETCH_ENABLED` 316 - - `MISTER_MORPH_TOOLS_URL_FETCH_MAX_BYTES` 317 - 318 - All string values in config support `${ENV_VAR}` syntax for environment variable expansion (e.g. `api_key: "${OPENAI_API_KEY}"`). 105 + The Console frontend uses `pnpm` under `web/console/`. See [docs/console.md](docs/console.md) and [docs/app.md](docs/app.md) for local build details. 319 106 320 - Key meanings (see `assets/config/config.example.yaml` for the canonical list): 321 - - Core: `llm.provider` selects the backend. Most providers use `llm.endpoint`/`llm.api_key`/`llm.model`. Optional defaults `llm.temperature`, `llm.reasoning_effort`, and `llm.reasoning_budget_tokens` are forwarded to `uniai` only when set. Azure uses `llm.azure.deployment` for deployment name, while endpoint/key are still read from `llm.endpoint` and `llm.api_key`. Bedrock uses `llm.bedrock.*`. `llm.tools_emulation_mode` controls tool-call emulation for models without native tool calling (`off|fallback|force`). `llm.profiles` defines named profile overrides, and `llm.routes` routes semantic purposes such as `main_loop`, `addressing`, `heartbeat`, `plan_create`, and `memory_draft`. 322 - - LLM secrets: use `${ENV_VAR}` syntax in any string field to reference environment variables. Example: 323 - ```yaml 324 - llm: 325 - api_key: "${OPENAI_API_KEY}" 326 - profiles: 327 - reasoning: 328 - provider: xai 329 - model: grok-4.1-fast-reasoning 330 - api_key: "${XAI_API_KEY}" 331 - ``` 332 - - LLM precedence: for config-sourced values, precedence is `CLI flag > MISTER_MORPH_* env > config.yaml > default`. 333 - - Logging: `logging.level` (`info` shows progress; `debug` adds thoughts), `logging.format` (`text|json`), plus `logging.include_thoughts` and `logging.include_tool_params` (redacted). 334 - - Loop: `max_steps` limits tool-call rounds; `parse_retries` retries invalid JSON; `max_token_budget` is a cumulative token cap (0 disables); `timeout` is the overall run timeout. 335 - - Skills: `skills.enabled` controls whether skills are used; `file_state_dir` + `skills.dir_name` define the default skills root; `skills.load=[]` loads all discovered skills, otherwise it loads only listed skills (unknown names are ignored). 336 - - Tools: all tool toggles live under `tools.*` (e.g. `tools.bash.enabled`, `tools.url_fetch.enabled`) with per-tool limits and timeouts. 337 - - Auth profiles: `secrets.allow_profiles` is the runtime allowlist. `auth_profiles.<id>.credential.secret` holds the secret value (use `${ENV_VAR}` to reference env vars). If at least one allowlisted auth profile is configured, `bash` still works but `curl` is denied by default; authenticated HTTP should go through `url_fetch + auth_profile`. 107 + ## Configuration Template 338 108 339 - ## Star History 109 + The canonical config template lives at [assets/config/config.example.yaml](assets/config/config.example.yaml). 110 + Environment variables use the `MISTER_MORPH_` prefix. Full configuration notes and common flags are in [docs/configuration.md](docs/configuration.md). 340 111 341 112 ## Star History 342 113
+20 -20
docs/README.md
··· 1 - # Documentation Index 1 + # Docs 2 2 3 - ## Core Docs 3 + ## Start Here 4 4 5 - Core components: 5 + - [Top-level README](../README.md) 6 + - [Desktop App](./app.md) 7 + - [Modes](./modes.md) 8 + - [Configuration](./configuration.md) 9 + - [Troubleshoots](./troubleshoots.md) 10 + 11 + ## Product Reference 12 + 13 + - [Console](./console.md) 14 + - [Tools](./tools.md) 15 + - [Skills](./skills.md) 16 + - [Security](./security.md) 17 + - [Integration](./integration.md) 18 + 19 + ## Architecture 6 20 7 21 - [Architecture](./arch.md) 8 22 - [Runtime Layers](./runtime_layers.md) 9 23 - [Prompt System](./prompt.md) 10 - - [Tools](./tools.md) 11 - - [Skills](./skills.md) 12 24 - [Memory](./memory.md) 25 + - [Bus](./bus.md) 13 26 14 - Channels: 27 + ## Channels 15 28 16 29 - [Telegram](./telegram.md) 17 30 - [Slack](./slack.md) 18 31 - [LINE](./line.md) 19 - - [Lark (Planned)](./lark.md) 20 - - [Bus](./bus.md) 21 - 22 - Integration: 23 - 24 - - [Integration](./integration.md) 25 - 26 - Others: 27 - 28 - - [Modes](./modes.md) 29 - - [Console](./console.md) 30 - - [Desktop App Wrapper](./app.md) 31 - - [Security](./security.md) 32 - - [Troubleshoots](./troubleshoots.md) 32 + - [Lark](./lark.md) 33 33 34 34 ## Localized README 35 35
+67 -64
docs/app.md
··· 1 - # Desktop App Wrapper (Wails) 1 + # Desktop App 2 + 3 + Mister Morph ships a desktop App that wraps the existing Console backend and UI into a single local experience. 2 4 3 - This document describes the current desktop wrapper architecture for MisterMorph. 5 + ## User Quick Start 4 6 5 - ## 1. Goal 7 + Download a release asset from the [GitHub Releases](https://github.com/quailyquaily/mistermorph/releases) page: 6 8 7 - Provide a single desktop app entrypoint that: 9 + - macOS `arm64`: `mistermorph-desktop-darwin-arm64.dmg` 10 + - Linux `amd64`: `mistermorph-desktop-linux-amd64.AppImage` 11 + - Windows `amd64`: `mistermorph-desktop-windows-amd64.zip` 8 12 9 - - launches the Console UI without asking users to run multiple terminal commands 10 - - supports first-run setup in Console 11 - - reuses existing backend (`mistermorph console serve`) and existing web console (`web/console`) 13 + Then: 12 14 13 - ## 2. Current Shape 15 + 1. launch the App 16 + 2. complete the setup flow inside the App 17 + 3. let the App start and host the local Console for you 14 18 15 - The desktop app is implemented under `desktop/wails` and built with tag `wailsdesktop production`. 19 + You do not need to run `mistermorph console serve` manually when using the App. 16 20 17 - - Wails process hosts the native window and Go bindings. 18 - - A child process runs `mistermorph console serve`. 19 - - Wails asset handler reverse-proxies WebView requests to the child process. 21 + ## Current Shape 20 22 21 - This keeps CLI and console backend logic unchanged and limits wrapper-specific code to a small area. 22 - The desktop wrapper is intentionally thin: lifecycle + process hosting + proxy only, no business rules. 23 + The desktop code lives under `desktop/wails` and is built with `wailsdesktop production`. 23 24 24 - ## 3. ASCII Architecture 25 + - the Wails process owns the native window and Go bindings 26 + - a child process runs `mistermorph console serve` 27 + - the App routes WebView traffic to that local child process 28 + 29 + The wrapper stays intentionally thin: lifecycle, process hosting, restart flow, and local proxying only. 30 + 31 + ## Architecture 25 32 26 33 ```text 27 34 +--------------------------------------------------------------+ 28 - | Desktop App Process (Wails) | 35 + | Desktop App Process (Wails) | 29 36 | | 30 37 | +----------------------+ +------------------------+ | 31 38 | | WebView (UI) | <----> | Reverse Proxy Handler | | ··· 49 56 +----------------------------------+ 50 57 ``` 51 58 52 - ## 4. Startup Sequence 59 + ## Startup and Restart 60 + 61 + Startup sequence: 53 62 54 63 ```text 55 - Desktop main 64 + desktop main 56 65 -> resolve backend binary path 57 66 -> reserve random loopback port 58 67 -> spawn child: mistermorph console serve 59 - --console-listen 127.0.0.1:<port> 60 - --console-base-path /console 61 - --allow-empty-password 62 68 -> poll GET /health until ready 63 - -> start Wails window 64 - -> proxy requests to child process 69 + -> open native window 70 + -> proxy requests to the child process 65 71 ``` 66 72 67 - If health check timeout is reached, app startup fails fast with stderr message. 68 - 69 - ## 5. First-run Setup Flow 73 + First run: 70 74 71 75 ```text 72 76 incomplete config 73 77 -> console backend starts with allow-empty-password 74 - -> frontend router redirects to /setup 75 - -> user submits setup form (agent settings + identity/soul) 76 - -> frontend calls Wails binding `window.go.main.App.RestartApp()` 78 + -> frontend routes to /setup 79 + -> user saves agent settings + identity/soul 80 + -> frontend calls App.RestartApp() 77 81 ``` 78 82 79 - ## 6. Restart Flow 83 + `App.RestartApp()` starts a new copy of the current desktop executable and then quits the old one. 80 84 81 - `App.RestartApp()` in desktop binding: 85 + ## Paths and Configuration 82 86 83 - - spawns a new instance of current executable (`os.Executable()` + original args) 84 - - then quits current Wails process 87 + - Console frontend assets are embedded in the bundled `mistermorph` backend by default. 88 + - You can override static assets with: 89 + - `console.static_dir` 90 + - `--console-static-dir /abs/path/to/dist` 91 + - `--config <path>` passed to the desktop App is forwarded to the child `console serve` process. 85 92 86 - This is used after successful setup apply. 93 + ## Local Build and Run 87 94 88 - ## 7. Paths and Configuration 95 + On Ubuntu or Debian, install desktop build dependencies first: 89 96 90 - - frontend static assets default: embedded in the `mistermorph` backend binary 91 - - override static assets path with existing backend settings: 92 - - `console.static_dir` 93 - - `--console-static-dir /abs/path/to/dist` 94 - - `--config <path>` passed to desktop app is forwarded to child `console serve`. 95 - 96 - ## 8. Build and Run 97 + ```bash 98 + sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev 99 + ``` 97 100 98 - Build console assets first: 101 + Build the backend binary used by the desktop wrapper: 99 102 100 103 ```bash 101 - pnpm --dir web/console build 102 - ./scripts/stage-console-assets.sh 103 - go build -o ./bin/mistermorph ./cmd/mistermorph 104 + ./scripts/build-backend.sh --output ./bin/mistermorph 104 105 ``` 105 106 106 - On Ubuntu/Debian with WebKitGTK 4.1, install the native Linux desktop deps first: 107 + Build a local desktop release binary: 107 108 108 109 ```bash 109 - sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev 110 + ./scripts/build-desktop.sh --release 110 111 ``` 111 112 112 - Run desktop app: 113 + Run from source: 113 114 114 115 ```bash 115 116 go run -tags 'wailsdesktop production' ./desktop/wails 116 117 ``` 117 118 118 - Build desktop binary: 119 + Build only the desktop wrapper directly: 119 120 120 121 ```bash 121 122 go build -tags 'wailsdesktop production' -o ./bin/mistermorph-desktop ./desktop/wails 122 123 ``` 123 124 124 - ## 9. Packaging 125 + For local debug builds with DevTools, use: 125 126 126 - Tag releases build these desktop assets in GitHub Actions: 127 + ```bash 128 + ./scripts/build-desktop.sh 129 + ``` 130 + 131 + ## Release Packaging 132 + 133 + Tagged releases currently publish: 127 134 128 135 - macOS `arm64`: `mistermorph-desktop-darwin-arm64.dmg` 129 136 - Linux `amd64`: `mistermorph-desktop-linux-amd64.AppImage` 130 - - Windows `amd64`: `mistermorph-desktop-windows-amd64.exe` 131 - 132 - The DMG and AppImage packaging steps also bundle a sibling `mistermorph` backend binary next to the desktop wrapper executable inside the package. That lets the desktop host find `console serve` locally before falling back to PATH or GitHub release download. 137 + - Windows `amd64`: `mistermorph-desktop-windows-amd64.zip` 133 138 134 - ## 10. Security and Scope Notes 139 + The packaged desktop App includes a sibling `mistermorph` backend binary so the wrapper can start `console serve` locally without a first-run download. 135 140 136 - - Child process listens on loopback only (`127.0.0.1`). 137 - - Child process only binds to loopback; no external listener is exposed. 138 - - This is an MVP wrapper, not yet a full packaging/distribution pipeline. 141 + That bundled backend is intentionally built with `CGO_ENABLED=0`. Keep it that way unless there is a deliberate packaging plan to change the constraint. 139 142 140 - ## 11. Known Gaps 143 + ## Known Gaps 141 144 142 - - No notarization/codesign flow yet for the macOS DMG. 143 - - Windows still ships as a raw `.exe`; no NSIS/MSIX packaging yet. 144 - - No dedicated UI for backend startup failure details yet. 145 - - CLI reuse is done through child process orchestration, not an extracted in-process console module. 145 + - No notarization or codesign flow yet for the macOS DMG. 146 + - Windows ships as a zip bundle, not an installer. 147 + - No dedicated UI yet for detailed backend startup failures. 148 + - The desktop wrapper still reuses the CLI backend through child-process orchestration rather than an in-process console module.
+207
docs/configuration.md
··· 1 + # Configuration 2 + 3 + This page collects the configuration details that do not need to live on the top-level README. 4 + 5 + The canonical config template is [../assets/config/config.example.yaml](../assets/config/config.example.yaml). 6 + 7 + ## Sources and Precedence 8 + 9 + `mistermorph` uses Viper, so you can configure it with: 10 + 11 + - CLI flags 12 + - environment variables 13 + - a config file 14 + 15 + Precedence for config-sourced values is: 16 + 17 + `CLI flag > MISTER_MORPH_* env > config.yaml > default` 18 + 19 + Supported config file formats: 20 + 21 + - `.yaml` 22 + - `.yml` 23 + - `.json` 24 + - `.toml` 25 + - `.ini` 26 + 27 + Environment variable rules: 28 + 29 + - prefix: `MISTER_MORPH_` 30 + - nested keys: replace `.` and `-` with `_` 31 + - example: `tools.bash.enabled` -> `MISTER_MORPH_TOOLS_BASH_ENABLED=true` 32 + 33 + All string values in config support `${ENV_VAR}` expansion. 34 + 35 + ## Common CLI Flags 36 + 37 + Global flags: 38 + 39 + - `--config` 40 + - `--log-level` 41 + - `--log-format` 42 + - `--log-add-source` 43 + - `--log-include-thoughts` 44 + - `--log-include-tool-params` 45 + - `--log-include-skill-contents` 46 + - `--log-max-thought-chars` 47 + - `--log-max-json-bytes` 48 + - `--log-max-string-value-chars` 49 + - `--log-max-skill-content-chars` 50 + - `--log-redact-key` (repeatable) 51 + 52 + `run`: 53 + 54 + - `--task` 55 + - `--provider` 56 + - `--endpoint` 57 + - `--model` 58 + - `--api-key` 59 + - `--llm-request-timeout` 60 + - `--interactive` 61 + - `--skills-dir` (repeatable) 62 + - `--skill` (repeatable) 63 + - `--skills-enabled` 64 + - `--max-steps` 65 + - `--parse-retries` 66 + - `--max-token-budget` 67 + - `--timeout` 68 + - `--inspect-prompt` 69 + - `--inspect-request` 70 + 71 + `submit`: 72 + 73 + - `--task` 74 + - `--server-url` 75 + - `--auth-token` 76 + - `--model` 77 + - `--submit-timeout` 78 + - `--wait` 79 + - `--poll-interval` 80 + 81 + `console serve`: 82 + 83 + - `--console-listen` 84 + - `--console-base-path` 85 + - `--console-static-dir` 86 + - `--console-session-ttl` 87 + - `--allow-empty-password` 88 + 89 + `telegram`: 90 + 91 + - `--telegram-bot-token` 92 + - `--telegram-allowed-chat-id` (repeatable) 93 + - `--telegram-group-trigger-mode` 94 + - `--telegram-addressing-confidence-threshold` 95 + - `--telegram-addressing-interject-threshold` 96 + - `--telegram-poll-timeout` 97 + - `--telegram-task-timeout` 98 + - `--telegram-max-concurrency` 99 + 100 + `slack`: 101 + 102 + - `--slack-bot-token` 103 + - `--slack-app-token` 104 + - `--slack-allowed-team-id` (repeatable) 105 + - `--slack-allowed-channel-id` (repeatable) 106 + - `--slack-group-trigger-mode` 107 + - `--slack-addressing-confidence-threshold` 108 + - `--slack-addressing-interject-threshold` 109 + - `--slack-task-timeout` 110 + - `--slack-max-concurrency` 111 + 112 + `skills`: 113 + 114 + - `skills list --skills-dir` (repeatable) 115 + - `skills install --dest --dry-run --clean --skip-existing --timeout --max-bytes --yes` 116 + 117 + `install`: 118 + 119 + - `install [dir]` 120 + - `--yes` 121 + 122 + ## Common Environment Variables 123 + 124 + - `MISTER_MORPH_CONFIG` 125 + - `MISTER_MORPH_LLM_PROVIDER` 126 + - `MISTER_MORPH_LLM_ENDPOINT` 127 + - `MISTER_MORPH_LLM_MODEL` 128 + - `MISTER_MORPH_LLM_API_KEY` 129 + - `MISTER_MORPH_LLM_REQUEST_TIMEOUT` 130 + - `MISTER_MORPH_LOGGING_LEVEL` 131 + - `MISTER_MORPH_LOGGING_FORMAT` 132 + - `MISTER_MORPH_SERVER_AUTH_TOKEN` 133 + - `MISTER_MORPH_CONSOLE_PASSWORD` 134 + - `MISTER_MORPH_CONSOLE_PASSWORD_HASH` 135 + - `MISTER_MORPH_TELEGRAM_BOT_TOKEN` 136 + - `MISTER_MORPH_SLACK_BOT_TOKEN` 137 + - `MISTER_MORPH_SLACK_APP_TOKEN` 138 + - `MISTER_MORPH_FILE_CACHE_DIR` 139 + 140 + Provider-specific values follow the same mapping. Examples: 141 + 142 + - `llm.azure.deployment` -> `MISTER_MORPH_LLM_AZURE_DEPLOYMENT` 143 + - `llm.bedrock.model_arn` -> `MISTER_MORPH_LLM_BEDROCK_MODEL_ARN` 144 + 145 + ## Key Config Areas 146 + 147 + Core LLM: 148 + 149 + - `llm.provider` selects the backend. 150 + - Most providers use `llm.endpoint`, `llm.api_key`, and `llm.model`. 151 + - Azure uses `llm.azure.deployment`. 152 + - Bedrock uses `llm.bedrock.*`. 153 + - `llm.tools_emulation_mode` controls tool-call emulation for models without native tool calling. 154 + - `llm.profiles` defines named profile overrides. 155 + - `llm.routes` routes semantic purposes such as `main_loop`, `addressing`, `heartbeat`, `plan_create`, and `memory_draft`. 156 + 157 + Logging and runtime limits: 158 + 159 + - `logging.level` 160 + - `logging.format` 161 + - `logging.include_thoughts` 162 + - `logging.include_tool_params` 163 + - `max_steps` 164 + - `parse_retries` 165 + - `max_token_budget` 166 + - `timeout` 167 + 168 + Skills: 169 + 170 + - `skills.enabled` 171 + - `skills.load` 172 + - `file_state_dir` 173 + - `skills.dir_name` 174 + 175 + Tools: 176 + 177 + - all tool toggles live under `tools.*` 178 + - examples: `tools.bash.enabled`, `tools.url_fetch.enabled` 179 + 180 + Console: 181 + 182 + - `console.listen` 183 + - `console.base_path` 184 + - `console.static_dir` 185 + - `console.session_ttl` 186 + 187 + Auth profiles and secrets: 188 + 189 + - `secrets.allow_profiles` is the runtime allowlist. 190 + - `auth_profiles.<id>.credential.secret` holds the secret value. 191 + - Use `${ENV_VAR}` for secret references. 192 + 193 + If at least one allowlisted auth profile is configured, `bash` still works but `curl` is denied by default. Authenticated HTTP should go through `url_fetch` with an auth profile. 194 + 195 + ## Example 196 + 197 + ```yaml 198 + llm: 199 + provider: openai 200 + model: gpt-5.4 201 + api_key: "${OPENAI_API_KEY}" 202 + profiles: 203 + reasoning: 204 + provider: xai 205 + model: grok-4.1-fast-reasoning 206 + api_key: "${XAI_API_KEY}" 207 + ```
+64 -212
docs/ja-JP/README.md
··· 1 1 # Mister Morph 2 2 3 - 統合 Agent CLI と再利用可能な Go エージェントコア。 3 + ローカルまたは各種チャネル接続で動かす Agent 向けのデスクトップ App、CLI、そして再利用可能な Go ランタイムです。 4 4 5 - ## 目次 5 + 他の言語:[English](../../README.md) | [简体中文](../zh-CN/README.md) 6 6 7 - - [Mister Morph を選ぶ理由](#why-mistermorph) 8 - - [クイックスタート](#quickstart) 9 - - [対応モデル](#supported-models) 10 - - [Telegram ボットモード](#telegram-bot-mode) 11 - - [他プロジェクトへの組み込み](#embedding-to-other-projects) 12 - - [組み込みツール](#built-in-tools) 13 - - [Skills(スキル)](#skills) 14 - - [セキュリティ](#security) 15 - - [トラブルシュート](#troubleshoots) 16 - - [デバッグ](#debug) 17 - - [設定](#configuration) 7 + まず触ってみたいだけなら、いまはデスクトップ App が最短です。Console UI を同梱し、ローカルバックエンドの起動も引き受け、初回セットアップも App 内で完結します。 18 8 19 - <a id="why-mistermorph"></a> 20 9 ## Mister Morph を選ぶ理由 21 10 22 - このプロジェクトの主な特徴は次のとおりです。 11 + - 🖥️ App 起点で始めやすい: デスクトップ App によって以前のような複数ターミナル前提の導入が不要になり、必要なら CLI もそのまま使えます。 12 + - 🧩 再利用可能な Go コア: デスクトップ App、CLI、Console バックエンドとして動かすだけでなく、他の Go プロジェクトへ組み込むこともできます。 13 + - 🔀 1 つのバックエンドを複数入口で共有: デスクトップ App、Console server、CLI、各チャネル runtime が同じ中核ランタイムを使います。 14 + - 🛠️ 実用的な拡張モデル: 組み込みツール、`SKILL.md` ベースのスキル、Go への組み込みでローカル利用から自動化、統合までカバーします。 15 + - 🔒 セキュリティを前提にした設計: auth profiles、送信先ポリシー、承認、秘匿化がランタイムモデルに組み込まれています。 23 16 24 - - 🧩 **再利用しやすい Go コア**: Agent を CLI として実行するだけでなく、ライブラリやサブプロセスとして他アプリへ組み込めます。 25 - - 🤝 **Mesh Agent Exchange Protocol(MAEP)**: 複数の Agent を運用し、相互にメッセージをやり取りしたい場合に MAEP を使えます。信頼状態と監査トレイルを備えた P2P プロトコルです([../maep.md](../maep.md) を参照、WIP)。 26 - - 🔒 **実運用を意識した安全なデフォルト**: プロファイルベースの資格情報注入、Guard によるマスキング、アウトバウンドポリシー制御、監査トレイル付きの非同期承認を提供します([../security.md](../security.md) を参照)。 27 - - 🧰 **実用的な Skills システム**: `file_state_dir/skills` から `SKILL.md` を検出して注入でき、シンプルな on/off 制御に対応します([../skills.md](../skills.md) を参照)。 28 - - 📚 **学習しやすい構成**: 学習重視の Agent プロジェクトとして設計されており、`docs/` に詳細な設計ドキュメントがあり、`--inspect-prompt` や `--inspect-request` など実用的なデバッグ機能も用意されています。 29 - 30 - <a id="quickstart"></a> 31 17 ## クイックスタート 32 18 33 - ### ステップ 1: インストール 19 + ### デスクトップ App(推奨) 34 20 35 - 方法 A: GitHub Releases からビルド済みバイナリを取得(本番用途では推奨)。 21 + 1. [GitHub Releases](https://github.com/quailyquaily/mistermorph/releases) ページから対象プラットフォームの配布物を取得します。 22 + - macOS: `mistermorph-desktop-darwin-arm64.dmg` 23 + - Linux: `mistermorph-desktop-linux-amd64.AppImage` 24 + - Windows: `mistermorph-desktop-windows-amd64.zip` 25 + 2. App を起動します。 26 + 3. App 内のセットアップフローを完了します。 27 + 4. そのまま Console UI を使います。`mistermorph console serve` を手動で起動する必要はありません。 36 28 37 - ```bash 38 - curl -fsSL -o /tmp/install-mistermorph.sh \ 39 - https://raw.githubusercontent.com/quailyquaily/mistermorph/main/scripts/install-release.sh 40 - bash /tmp/install-mistermorph.sh v0.1.0 41 - ``` 42 - 43 - インストーラースクリプトは次の実行方法に対応しています。 44 - 45 - - `bash install-release.sh <version-tag>` 46 - - `INSTALL_DIR=$HOME/.local/bin bash install-release.sh <version-tag>` 47 - 48 - 方法 B: Go でソースからインストール。 29 + ビルド、パッケージ、プラットフォーム別メモは [../app.md](../app.md) を参照してください。 49 30 50 - ```bash 51 - go install github.com/quailyquaily/mistermorph@latest 52 - ``` 31 + ### CLI 53 32 54 - ### ステップ 2: Agent の必須ファイルと組み込みスキルをインストール 33 + まず CLI をインストールします。 55 34 56 35 ```bash 57 - mistermorph install 58 - # または 59 - mistermorph install <dir> 36 + curl -fsSL -o /tmp/install-mistermorph.sh https://raw.githubusercontent.com/quailyquaily/mistermorph/refs/heads/master/scripts/install-release.sh 37 + sudo bash /tmp/install-mistermorph.sh 60 38 ``` 61 39 62 - `install` コマンドは、必須ファイルと組み込みスキルを `~/.morph/skills/`(または `<dir>` で指定したディレクトリ)にインストールします。 63 - 64 - ### ステップ 3: API キーを設定 65 - 66 - `config.yaml` がなくても、まずは環境変数だけで実行できます。 40 + またはソースからインストールします。 67 41 68 42 ```bash 69 - export MISTER_MORPH_LLM_API_KEY="YOUR_OPENAI_API_KEY_HERE" 70 - # 任意: 既定の provider/model を明示 71 - export MISTER_MORPH_LLM_PROVIDER="openai" 72 - export MISTER_MORPH_LLM_MODEL="gpt-5.2" 43 + go install github.com/quailyquaily/mistermorph/cmd/mistermorph@latest 73 44 ``` 74 45 75 - Mister Morph は Azure OpenAI、Anthropic Claude、AWS Bedrock などにも対応しています(詳細は `../../assets/config/config.example.yaml` を参照)。ファイルベースの設定を使いたい場合は `~/.morph/config.yaml` も利用できます。 76 - 77 - ### ステップ 4: 初回実行 46 + ワークスペースを初期化し、API Key を設定して、1 回タスクを実行します。 78 47 79 48 ```bash 49 + mistermorph install 50 + export MISTER_MORPH_LLM_API_KEY="YOUR_API_KEY" 80 51 mistermorph run --task "Hello!" 81 52 ``` 82 53 83 - <a id="supported-models"></a> 84 - ## 対応モデル 85 - 86 - > モデル対応状況は、モデル ID・provider endpoint の機能・tool-calling の挙動によって変わる場合があります。 87 - 88 - | Model family | Model range | Status | 89 - |---|---|---| 90 - | GPT | `gpt-5*` | ✅ Full | 91 - | GPT-OSS | `gpt-oss-120b` | ✅ Full | 92 - | Grok | `grok-4+` | ✅ Full | 93 - | Claude | `claude-3.5+` | ✅ Full | 94 - | DeepSeek | `deepseek-3*` | ✅ Full | 95 - | Gemini | `gemini-2.5+` | ✅ Full | 96 - | Kimi | `kimi-2.5+` | ✅ Full | 97 - | MiniMax | `minimax* / minimax-m2.5+` | ✅ Full | 98 - | GLM | `glm-4.6+` | ✅ Full | 99 - | Cloudflare Workers AI | `Workers AI model IDs` | ⚠️ Limited (no tool calling) | 100 - 101 - <a id="telegram-bot-mode"></a> 102 - ## Telegram ボットモード 103 - 104 - Telegram から Agent と会話できるように、Telegram ボット(ロングポーリング)を起動します。 105 - 106 - `~/.morph/config.yaml` を編集し、Telegram ボットトークンを設定します。 107 - 108 - ```yaml 109 - telegram: 110 - bot_token: "YOUR_TELEGRAM_BOT_TOKEN_HERE" 111 - allowed_chat_ids: [] # 許可する chat id をここに追加 112 - ``` 113 - 114 - ```bash 115 - mistermorph telegram --log-level info 116 - ``` 117 - 118 - 補足: 119 - - `/id` で現在の chat id を取得し、`allowed_chat_ids` に追加して許可リスト化します。 120 - - グループでは、ボットへの返信または `@BotUsername` メンションで応答します。 121 - - ファイルを送信すると `file_cache_dir/telegram/` に保存され、Agent が処理できます。`telegram_send_file` でキャッシュ済みファイルを送信でき、`telegram_send_photo` でキャッシュ済み画像を送信でき、`telegram_send_voice` で `file_cache_dir` 配下のローカル音声ファイルも送信できます。 122 - - 最後に読み込んだスキルはチャット単位で保持されるため、後続メッセージでも `SKILL.md` の文脈が維持されます。`/reset` でクリアできます。 123 - - `telegram.group_trigger_mode=smart` は、グループ内の各メッセージを addressing LLM で判定します。受理には `addressed=true` かつ `confidence >= telegram.addressing_confidence_threshold`、`interject > telegram.addressing_interject_threshold` が必要です。 124 - - `telegram.group_trigger_mode=talkative` も各メッセージを addressing LLM で判定しますが、`addressed=true` は必須ではありません(confidence/interject の閾値は適用されます)。 125 - - チャットで `/reset` を実行すると会話履歴をクリアできます。 126 - - 既定では複数チャットを並列処理しつつ、各チャット内は直列で処理します(設定: `telegram.max_concurrency`)。 127 - 128 - <a id="embedding-to-other-projects"></a> 129 - ## 他プロジェクトへの組み込み 130 - 131 - [../integration.md](../integration.md) に組み込みパターンとサンプルをまとめています。 132 - 133 - <a id="built-in-tools"></a> 134 - ## 組み込みツール 135 - 136 - Agent が利用できる主要ツール: 137 - 138 - - `read_file`: ローカルのテキストファイルを読み取る。 139 - - `write_file`: `file_cache_dir` または `file_state_dir` 配下にテキストファイルを書き込む。 140 - - `bash`: シェルコマンドを実行する(デフォルトでは無効)。 141 - - `url_fetch`: 認証プロファイル指定に対応した HTTP 取得。 142 - - `web_search`: Web 検索(DuckDuckGo HTML)。 143 - - `plan_create`: 構造化された計画を生成。 54 + まだ `config.yaml` がない場合、`mistermorph install` がセットアップウィザードを起動し、必要なワークスペースファイルを書き出します。 144 55 145 - チャネル実行時ツール: 56 + CLI モードと設定の詳細は [../modes.md](../modes.md) と [../configuration.md](../configuration.md) を参照してください。 146 57 147 - - `telegram_send_file`: Telegram にファイルを送信(Telegram のみ)。 148 - - `telegram_send_photo`: Telegram に画像を送信(Telegram のみ)。 149 - - `telegram_send_voice`: Telegram に音声メッセージを送信(Telegram のみ)。 150 - - `message_react`: メッセージに絵文字リアクションを追加(Telegram/Slack 実行時。パラメータはチャネルごとに異なる)。 58 + ## Mister Morph に含まれるもの 151 59 152 - 詳しくは [../tools.md](../tools.md) を参照してください。 60 + - 初回セットアップと内蔵 Console UI を備えたデスクトップ App 61 + - 単発タスク、スクリプト、自動化、サーバーモード向けの CLI 62 + - ブラウザ上で設定、運用、監視を行うローカル Console サーバー 63 + - Telegram、Slack、LINE、Lark 向けランタイム 64 + - 他プロジェクトへ組み込める Go 統合レイヤー 65 + - 組み込みツール群と `SKILL.md` ベースのスキルシステム 66 + - auth profiles、送信先ポリシー、承認、秘匿化などのセキュリティ制御 153 67 154 - <a id="skills"></a> 155 - ## Skills(スキル) 68 + ## ドキュメント 156 69 157 - `mistermorph` は `file_state_dir/skills` を再帰的に探索し、選択した `SKILL.md` の内容を system prompt に注入できます。 70 + まず読むもの: 158 71 159 - デフォルトでは `run` は `skills.enabled=true` を使います。`skills.load=[]` は検出した全スキルを読み込み、未知のスキル名は無視されます。 72 + - [デスクトップ App](../app.md) 73 + - [モード](../modes.md) 74 + - [設定](../configuration.md) 75 + - [トラブルシュート](../troubleshoots.md) 160 76 161 - ドキュメント: [../skills.md](../skills.md) 77 + リファレンス: 162 78 163 - ```bash 164 - # 利用可能なスキル一覧 165 - mistermorph skills list 166 - # run コマンドで特定スキルを使用 167 - mistermorph run --task "..." --skills-enabled --skill skill-name 168 - # リモートスキルをインストール 169 - mistermorph skills install <remote-skill-url> 170 - ``` 171 - 172 - ### Skills のセキュリティ機構 173 - 174 - 1. インストール監査: リモートスキルをインストールする際、Mister Morph は内容を事前表示し、基本的なセキュリティ監査(例: スクリプト内の危険コマンド検出)を行ったうえでユーザー確認を求めます。 175 - 2. Auth profiles: スキルは `auth_profiles` フィールドで必要な認証プロファイルを宣言できます。これはあくまで宣言であり、権限境界ではありません。実際の許可はホスト側の `secrets.allow_profiles` と `auth_profiles` だけで決まります(`../../assets/skills/moltbook` と設定ファイル内の関連セクションを参照)。 176 - 177 - <a id="security"></a> 178 - ## セキュリティ 179 - 180 - systemd ハードニングとシークレット管理の推奨事項は [../security.md](../security.md) を参照してください。 79 + - [Console](../console.md) 80 + - [Tools](../tools.md) 81 + - [Skills](../skills.md) 82 + - [Security](../security.md) 83 + - [Integration](../integration.md) 84 + - [Architecture](../arch.md) 181 85 182 - <a id="troubleshoots"></a> 183 - ## トラブルシュート 86 + チャネル設定: 184 87 185 - 既知の問題と回避策: [../troubleshoots.md](../troubleshoots.md) 186 - 187 - <a id="debug"></a> 188 - ## デバッグ 189 - 190 - ### ログ 191 - 192 - `--log-level` 引数でログレベルと形式を設定できます。 88 + - [Telegram](../telegram.md) 89 + - [Slack](../slack.md) 90 + - [LINE](../line.md) 91 + - [Lark](../lark.md) 193 92 194 - ```bash 195 - mistermorph run --log-level debug --task "..." 196 - ``` 93 + 完全なドキュメント一覧は [../README.md](../README.md) を参照してください。 197 94 198 - ### 内部デバッグ情報のダンプ 95 + ## 開発 199 96 200 - `--inspect-prompt` / `--inspect-request` を指定すると、デバッグ用に内部状態を出力できます。 97 + よく使うローカルコマンド: 201 98 202 99 ```bash 203 - mistermorph run --inspect-prompt --inspect-request --task "..." 100 + ./scripts/build-backend.sh --output ./bin/mistermorph 101 + ./scripts/build-desktop.sh --release 102 + go test ./... 204 103 ``` 205 104 206 - これらの引数を使うと、最終的な system/user/tool プロンプトと、LLM のリクエスト/レスポンス JSON 全体がプレーンテキストとして `./dump` ディレクトリに保存されます。 105 + Console フロントエンドは `web/console/` にあり、`pnpm` を使います。ローカルビルドの詳細は [../console.md](../console.md) と [../app.md](../app.md) を参照してください。 207 106 208 - <a id="configuration"></a> 209 - ## 設定 107 + ## 設定テンプレート 210 108 211 - `mistermorph` は Viper を使用しているため、フラグ、環境変数、設定ファイルのいずれでも設定できます。 212 - 213 - - 設定ファイル: `--config /path/to/config.yaml`(`.yaml/.yml/.json/.toml/.ini` をサポート) 214 - - 環境変数プレフィックス: `MISTER_MORPH_` 215 - - ネストしたキー: `.` と `-` を `_` に置換(例: `tools.bash.enabled` → `MISTER_MORPH_TOOLS_BASH_ENABLED=true`) 216 - 217 - ### CLI フラグ 218 - 219 - **グローバル(全コマンド共通)** 220 - - `--config` 221 - - `--log-level` 222 - - `--log-format` 223 - - `--log-add-source` 224 - - `--log-include-thoughts` 225 - - `--log-include-tool-params` 226 - - `--log-include-skill-contents` 227 - - `--log-max-thought-chars` 228 - - `--log-max-json-bytes` 229 - - `--log-max-string-value-chars` 230 - - `--log-max-skill-content-chars` 231 - - `--log-redact-key`(繰り返し指定可) 232 - 233 - **run** 234 - - `--task` 235 - - `--provider` 236 - - `--endpoint` 237 - - `--model` 238 - - `--api-key` 239 - - `--llm-request-timeout` 240 - - `--interactive` 241 - - `--skills-dir`(繰り返し指定可) 242 - - `--skill`(繰り返し指定可) 243 - - `--skills-enabled` 244 - - `--max-steps` 245 - - `--parse-retries` 246 - - `--max-token-budget` 247 - - `--timeout` 248 - - `--inspect-prompt` 249 - - `--inspect-request` 250 - 251 - **submit** 252 - - `--task` 253 - - `--server-url` 254 - - `--auth-token` 255 - - `--model` 256 - - `--submit-timeout` 257 - - `--wait` 258 - - `--poll-interval` 109 + 正規の設定テンプレートは [../../assets/config/config.example.yaml](../../assets/config/config.example.yaml) にあります。 110 + 環境変数は `MISTER_MORPH_` プレフィックスを使います。設定と代表的な flags の詳細は [../configuration.md](../configuration.md) にまとめています。
+64 -211
docs/zh-CN/README.md
··· 1 1 # Mister Morph 2 2 3 - 统一 Agent CLI 与可复用的 Go Agent 核心。 3 + 面向本地或多渠道 Agent 的桌面 App、CLI,以及可复用的 Go 运行时。 4 4 5 - ## 目录 5 + 其他语言:[English](../../README.md) | [日本語](../ja-JP/README.md) 6 6 7 - - [为什么选择 Mister Morph](#why-mistermorph) 8 - - [快速开始](#quickstart) 9 - - [支持模型](#supported-models) 10 - - [Telegram 机器人模式](#telegram-bot-mode) 11 - - [嵌入到其他项目](#embedding-to-other-projects) 12 - - [内置工具](#built-in-tools) 13 - - [Skills(技能)](#skills) 14 - - [安全性](#security) 15 - - [故障排查](#troubleshoots) 16 - - [调试](#debug) 17 - - [配置](#configuration) 7 + 如果你只是想先体验 Mister Morph,最简单的入口已经是桌面 App。它会自带 Console UI、自动启动本地后端,并在首次启动时引导完成配置。 18 8 19 - <a id="why-mistermorph"></a> 20 9 ## 为什么选择 Mister Morph 21 10 22 - 这个项目值得关注的原因: 11 + - 🖥️ App 优先的上手路径:桌面 App 去掉了过去那种多终端启动流程,但 CLI 仍然保留,适合脚本和自动化。 12 + - 🧩 可复用的 Go 核心:既可以把 Mister Morph 当桌面 App、CLI、Console 后端来运行,也可以嵌入到其他 Go 项目里。 13 + - 🔀 一个后端,多种入口:桌面 App、Console server、CLI、各类渠道 runtime 都建立在同一套核心运行时之上。 14 + - 🛠️ 实用的扩展模型:内置工具、`SKILL.md` 技能系统,以及 Go 嵌入层,覆盖本地使用、自动化和集成。 15 + - 🔒 从设计上考虑安全:auth profiles、出站策略、审批与脱敏都属于运行时模型的一部分。 23 16 24 - - 🧩 **可复用的 Go 核心**:既能把 Agent 当 CLI 运行,也能以库或子进程的方式嵌入到其他应用。 25 - - 🔒 **严肃的默认安全策略**:基于 profile 的凭据注入、Guard 脱敏、出站策略控制、带审计轨迹的异步审批(见 [../security.md](../security.md))。 26 - - 🧰 **实用的 Skills 系统**:可从 `file_state_dir/skills` 发现并注入 `SKILL.md`,支持简单的 on/off 控制(见 [../skills.md](../skills.md))。 27 - - 📚 **对新手友好**:这是一个以学习为导向的 Agent 项目;`docs/` 里有详细设计文档,也提供了 `--inspect-prompt`、`--inspect-request` 等实用调试工具。 28 - 29 - <a id="quickstart"></a> 30 17 ## 快速开始 31 18 32 - ### 第 1 步:安装 19 + ### 桌面 App(推荐) 33 20 34 - 方案 A:从 GitHub Releases 下载预构建二进制(生产环境推荐): 21 + 1. 从 [GitHub Releases](https://github.com/quailyquaily/mistermorph/releases) 页面下载对应平台的安装包: 22 + - macOS: `mistermorph-desktop-darwin-arm64.dmg` 23 + - Linux: `mistermorph-desktop-linux-amd64.AppImage` 24 + - Windows: `mistermorph-desktop-windows-amd64.zip` 25 + 2. 启动 App。 26 + 3. 在 App 内完成首次配置。 27 + 4. 直接使用 Console UI,无需再手动运行 `mistermorph console serve`。 35 28 36 - ```bash 37 - curl -fsSL -o /tmp/install-mistermorph.sh \ 38 - https://raw.githubusercontent.com/quailyquaily/mistermorph/main/scripts/install-release.sh 39 - bash /tmp/install-mistermorph.sh v0.1.0 40 - ``` 41 - 42 - 安装脚本支持: 43 - 44 - - `bash install-release.sh <version-tag>` 45 - - `INSTALL_DIR=$HOME/.local/bin bash install-release.sh <version-tag>` 46 - 47 - 方案 B:使用 Go 从源码安装: 29 + 构建、打包与平台说明见:[../app.md](../app.md) 48 30 49 - ```bash 50 - go install github.com/quailyquaily/mistermorph@latest 51 - ``` 31 + ### CLI 52 32 53 - ### 第 2 步:安装 Agent 运行所需文件与内置技能 33 + 先安装 CLI: 54 34 55 35 ```bash 56 - mistermorph install 57 - # 或 58 - mistermorph install <dir> 36 + curl -fsSL -o /tmp/install-mistermorph.sh https://raw.githubusercontent.com/quailyquaily/mistermorph/refs/heads/master/scripts/install-release.sh 37 + sudo bash /tmp/install-mistermorph.sh 59 38 ``` 60 39 61 - `install` 命令会把必需文件和内置技能安装到 `~/.morph/skills/`(或你通过 `<dir>` 指定的目录)。 62 - 63 - ### 第 3 步:配置 API Key 64 - 65 - 不需要 `config.yaml` 也可以直接运行,推荐先用环境变量: 40 + 或者从源码安装: 66 41 67 42 ```bash 68 - export MISTER_MORPH_LLM_API_KEY="YOUR_OPENAI_API_KEY_HERE" 69 - # 可选:显式指定默认 provider/model 70 - export MISTER_MORPH_LLM_PROVIDER="openai" 71 - export MISTER_MORPH_LLM_MODEL="gpt-5.2" 43 + go install github.com/quailyquaily/mistermorph/cmd/mistermorph@latest 72 44 ``` 73 45 74 - Mister Morph 也支持 Azure OpenAI、Anthropic Claude、AWS Bedrock 等(更多配置见 `../../assets/config/config.example.yaml`)。如果你更喜欢文件配置,也可以使用 `~/.morph/config.yaml`。 75 - 76 - ### 第 4 步:首次运行 46 + 初始化工作目录、设置 API Key,并运行一个任务: 77 47 78 48 ```bash 49 + mistermorph install 50 + export MISTER_MORPH_LLM_API_KEY="YOUR_API_KEY" 79 51 mistermorph run --task "Hello!" 80 52 ``` 81 53 82 - <a id="supported-models"></a> 83 - ## 支持模型 54 + 如果当前还没有 `config.yaml`,`mistermorph install` 会启动初始化向导并写入所需的工作区文件。 84 55 85 - > 模型支持情况可能因具体模型 ID、provider endpoint 能力和 tool-calling 行为而变化。 56 + CLI 模式与配置说明见:[../modes.md](../modes.md)、[../configuration.md](../configuration.md) 86 57 87 - | Model family | Model range | Status | 88 - |---|---|---| 89 - | GPT | `gpt-5*` | ✅ Full | 90 - | GPT-OSS | `gpt-oss-120b` | ✅ Full | 91 - | Grok | `grok-4+` | ✅ Full | 92 - | Claude | `claude-3.5+` | ✅ Full | 93 - | DeepSeek | `deepseek-3*` | ✅ Full | 94 - | Gemini | `gemini-2.5+` | ✅ Full | 95 - | Kimi | `kimi-2.5+` | ✅ Full | 96 - | MiniMax | `minimax* / minimax-m2.5+` | ✅ Full | 97 - | GLM | `glm-4.6+` | ✅ Full | 98 - | Cloudflare Workers AI | `Workers AI model IDs` | ⚠️ Limited (no tool calling) | 58 + ## Mister Morph 包含什么 99 59 100 - <a id="telegram-bot-mode"></a> 101 - ## Telegram 机器人模式 60 + - 桌面 App:适合本地使用,带首次配置流程与内置 Console UI。 61 + - CLI:适合单次任务、脚本调用、自动化与服务模式。 62 + - 本地 Console 服务:提供浏览器中的设置、运行态管理与监控界面。 63 + - 渠道运行时:Telegram、Slack、LINE、Lark。 64 + - 可嵌入的 Go 集成层:方便在其他项目中复用 Mister Morph。 65 + - 内置工具与基于 `SKILL.md` 的技能系统。 66 + - 面向真实运行环境的安全控制:auth profiles、出站策略、审批与脱敏。 102 67 103 - 通过长轮询运行 Telegram 机器人,这样你就可以直接在 Telegram 里和 Agent 对话: 68 + ## 文档导航 104 69 105 - 编辑 `~/.morph/config.yaml`,设置 Telegram bot token: 70 + 入门: 106 71 107 - ```yaml 108 - telegram: 109 - bot_token: "YOUR_TELEGRAM_BOT_TOKEN_HERE" 110 - allowed_chat_ids: [] # 在这里加入允许的 chat id 111 - ``` 72 + - [桌面 App](../app.md) 73 + - [运行模式](../modes.md) 74 + - [配置](../configuration.md) 75 + - [故障排查](../troubleshoots.md) 112 76 113 - ```bash 114 - mistermorph telegram --log-level info 115 - ``` 77 + 参考: 116 78 117 - 说明: 118 - - 使用 `/id` 获取当前 chat id,并把它加入 `allowed_chat_ids` 白名单。 119 - - 在群聊里,回复机器人消息或提及 `@BotUsername` 会触发响应。 120 - - 你可以发送文件;文件会下载到 `file_cache_dir/telegram/`,Agent 可以处理它。Agent 也能通过 `telegram_send_file` 回传缓存文件,通过 `telegram_send_photo` 回传缓存图片,还可以通过 `telegram_send_voice` 发送位于 `file_cache_dir` 的本地语音文件。 121 - - 每个 chat 会保留最近一次加载的 skill(sticky),后续消息不会“忘记” `SKILL.md`;可用 `/reset` 清除。 122 - - `telegram.group_trigger_mode=smart` 会让每条群消息都进入 addressing LLM 判定;触发需满足 `addressed=true`,且 `confidence >= telegram.addressing_confidence_threshold`、`interject > telegram.addressing_interject_threshold`。 123 - - `telegram.group_trigger_mode=talkative` 也会让每条群消息进入 addressing LLM 判定,但不要求 `addressed=true`(仍受 confidence/interject 阈值控制)。 124 - - 可在 chat 中使用 `/reset` 清空对话历史。 125 - - 默认支持多 chat 并发处理,但单个 chat 内按串行处理(配置项:`telegram.max_concurrency`)。 79 + - [Console](../console.md) 80 + - [Tools](../tools.md) 81 + - [Skills](../skills.md) 82 + - [Security](../security.md) 83 + - [Integration](../integration.md) 84 + - [Architecture](../arch.md) 126 85 127 - <a id="embedding-to-other-projects"></a> 128 - ## 嵌入到其他项目 86 + 渠道接入: 129 87 130 - 请参见 [../integration.md](../integration.md) 获取嵌入模式与示例。 88 + - [Telegram](../telegram.md) 89 + - [Slack](../slack.md) 90 + - [LINE](../line.md) 91 + - [Lark](../lark.md) 131 92 132 - <a id="built-in-tools"></a> 133 - ## 内置工具 93 + 完整文档索引:[../README.md](../README.md) 134 94 135 - Agent 可用的核心工具: 95 + ## 开发 136 96 137 - - `read_file`:读取本地文本文件。 138 - - `write_file`:将文本文件写入 `file_cache_dir` 或 `file_state_dir`。 139 - - `bash`:执行 shell 命令(默认禁用)。 140 - - `url_fetch`:发起 HTTP 请求(可选 auth profile)。 141 - - `web_search`:网页搜索(DuckDuckGo HTML)。 142 - - `plan_create`:生成结构化计划。 143 - 144 - 频道运行时工具: 145 - 146 - - `telegram_send_file`:在 Telegram 发送文件(仅 Telegram)。 147 - - `telegram_send_photo`:在 Telegram 发送图片(仅 Telegram)。 148 - - `telegram_send_voice`:在 Telegram 发送语音消息(仅 Telegram)。 149 - - `message_react`:在消息上添加 emoji reaction(Telegram/Slack 运行时,参数随频道不同)。 150 - 151 - 详细工具文档请见 [../tools.md](../tools.md)。 152 - 153 - <a id="skills"></a> 154 - ## Skills(技能) 155 - 156 - `mistermorph` 可以在 `file_state_dir/skills` 下递归发现 skills,并将选中的 `SKILL.md` 内容注入 system prompt。 157 - 158 - 默认情况下,`run` 使用 `skills.enabled=true`;`skills.load=[]` 表示加载全部已发现技能,未知技能名会被忽略。 159 - 160 - 文档: [../skills.md](../skills.md)。 97 + 常用本地命令: 161 98 162 99 ```bash 163 - # 列出可用 skills 164 - mistermorph skills list 165 - # 在 run 命令中使用指定 skill 166 - mistermorph run --task "..." --skills-enabled --skill skill-name 167 - # 安装远程 skill 168 - mistermorph skills install <remote-skill-url> 100 + ./scripts/build-backend.sh --output ./bin/mistermorph 101 + ./scripts/build-desktop.sh --release 102 + go test ./... 169 103 ``` 170 104 171 - ### Skills 的安全机制 172 - 173 - 1. 安装审计:安装远程 skill 时,Mister Morph 会先预览技能内容,并做基础安全审计(例如扫描脚本中的危险命令),再请求用户确认。 174 - 2. Auth profiles:skill 可以在 `auth_profiles` 字段声明依赖的认证配置。这里的声明只用于提示和上下文,不构成权限边界。真正的授权只来自宿主机配置里的 `secrets.allow_profiles` 和 `auth_profiles`(见 `../../assets/skills/moltbook` 以及配置文件相关部分)。 105 + Console 前端位于 `web/console/`,使用 `pnpm`。本地构建细节见:[../console.md](../console.md) 与 [../app.md](../app.md)。 175 106 176 - <a id="security"></a> 177 - ## 安全性 107 + ## 配置模板 178 108 179 - 推荐的 systemd 加固与密钥管理方式: [../security.md](../security.md)。 180 - 181 - <a id="troubleshoots"></a> 182 - ## 故障排查 183 - 184 - 已知问题与规避建议: [../troubleshoots.md](../troubleshoots.md)。 185 - 186 - <a id="debug"></a> 187 - ## 调试 188 - 189 - ### 日志 190 - 191 - 可通过参数 `--log-level` 设置日志级别与格式: 192 - 193 - ```bash 194 - mistermorph run --log-level debug --task "..." 195 - ``` 196 - 197 - ### 导出内部调试数据 198 - 199 - 可用 `--inspect-prompt` / `--inspect-request` 这两个参数导出内部状态,便于调试: 200 - 201 - ```bash 202 - mistermorph run --inspect-prompt --inspect-request --task "..." 203 - ``` 204 - 205 - 这些参数会把最终 system/user/tool prompt,以及完整 LLM 请求/响应 JSON,以纯文本形式输出到 `./dump` 目录。 206 - 207 - <a id="configuration"></a> 208 - ## 配置 209 - 210 - `mistermorph` 使用 Viper,因此你可以通过 flags、环境变量或配置文件进行配置。 211 - 212 - - 配置文件:`--config /path/to/config.yaml`(支持 `.yaml/.yml/.json/.toml/.ini`) 213 - - 环境变量前缀:`MISTER_MORPH_` 214 - - 嵌套键:将 `.` 和 `-` 替换为 `_`(例如 `tools.bash.enabled` → `MISTER_MORPH_TOOLS_BASH_ENABLED=true`) 215 - 216 - ### CLI 参数 217 - 218 - **全局(所有命令)** 219 - - `--config` 220 - - `--log-level` 221 - - `--log-format` 222 - - `--log-add-source` 223 - - `--log-include-thoughts` 224 - - `--log-include-tool-params` 225 - - `--log-include-skill-contents` 226 - - `--log-max-thought-chars` 227 - - `--log-max-json-bytes` 228 - - `--log-max-string-value-chars` 229 - - `--log-max-skill-content-chars` 230 - - `--log-redact-key`(可重复) 231 - 232 - **run** 233 - - `--task` 234 - - `--provider` 235 - - `--endpoint` 236 - - `--model` 237 - - `--api-key` 238 - - `--llm-request-timeout` 239 - - `--interactive` 240 - - `--skills-dir`(可重复) 241 - - `--skill`(可重复) 242 - - `--skills-enabled` 243 - - `--max-steps` 244 - - `--parse-retries` 245 - - `--max-token-budget` 246 - - `--timeout` 247 - - `--inspect-prompt` 248 - - `--inspect-request` 249 - 250 - **submit** 251 - - `--task` 252 - - `--server-url` 253 - - `--auth-token` 254 - - `--model` 255 - - `--submit-timeout` 256 - - `--wait` 257 - - `--poll-interval` 109 + 规范配置模板在 [../../assets/config/config.example.yaml](../../assets/config/config.example.yaml)。 110 + 环境变量统一使用 `MISTER_MORPH_` 前缀。完整配置说明与常用 flags 见 [../configuration.md](../configuration.md)。