Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-8057: feat(agent): run Meta Muse Code as an MSP runtime (#9309)
sportsculture88f6d6272b45
diff --git a/apps/docs/content/docs/environment-variables.fr.mdx b/apps/docs/content/docs/environment-variables.fr.mdxindex 3fb7ecebb7..fc9cb83fbd 100644--- a/apps/docs/content/docs/environment-variables.fr.mdx+++ b/apps/docs/content/docs/environment-variables.fr.mdx@@ -257,6 +257,8 @@ MULTICA_CLAUDE_PATH=/opt/bin/claudeMULTICA_CLAUDE_ARGS=--max-turns 40```+Muse Code accepte `MULTICA_MUSE_PATH` et `MULTICA_MUSE_MODEL` ; utilisez un identifiant de modèle du catalogue du runtime.+Le nettoyage vérifié des processus d'arrière-plan de Cursor nécessite Linux 6.9 ou une version ultérieure (pidfd de groupe de processus), la prise en charge par le noyau macOS des requêtes d'identité de processus et de l'envoi de signaux par audit token, ou un Job Object imbriqué correctement attribué sous Windows. Sous macOS, chaque processus reçoit ses signaux au moyen d'une version de PID vérifiée par le noyau ; aucune adhésion à un groupe de la même session n'est nécessaire. Ces API macOS sont privées et vérifiées au moment de la capture. Un lancement qui ne peut pas être revendiqué renvoie son résultat d'outil d'origine et utilise le watchdog d'inactivité ordinaire, y compris lorsque le watchdog d'outil vaut `0`. Le travail déjà revendiqué reste en cours si le nettoyage ne peut pas être confirmé. Avec un watchdog d'outil à `0`, cette limite n'existe pas du tout : le travail d'arrière-plan revendiqué maintient l'exécution en cours aussi longtemps qu'il vit, si bien que l'exécution n'est bornée que par `MULTICA_AGENT_TIMEOUT`, qui vaut `0` par défaut.Les processus d'arrière-plan de Cursor qui appartiennent à l'exécution sont aussi arrêtés lorsque celle-ci se termine normalement : un serveur d'arrière-plan lancé par cette exécution ne survit donc pas intentionnellement à la finalisation. macOS peut reconnaître des enfants tardifs grâce aux identités de parent d'origine conservées, mais ne peut pas prouver une chaîne dont les processus intermédiaires ont disparu avant d'être observés. De tels processus, le travail qui quitte le groupe suivi, ou des erreurs persistantes d'appartenance ou d'envoi de signaux peuvent laisser du travail d'arrière-plan derrière eux. Un nettoyage non confirmé est journalisé et n'ouvre jamais la fenêtre de récupération réservée aux nettoyages réussis ; les processus inconnus ne sont pas tués sur la seule base de leur PID numérique ou de leur groupe de processus.diff --git a/apps/docs/content/docs/environment-variables.ja.mdx b/apps/docs/content/docs/environment-variables.ja.mdxindex 49c4c987f0..6293699e04 100644--- a/apps/docs/content/docs/environment-variables.ja.mdx+++ b/apps/docs/content/docs/environment-variables.ja.mdx@@ -260,6 +260,8 @@ MULTICA_CLAUDE_PATH=/opt/bin/claudeMULTICA_CLAUDE_ARGS=--max-turns 40```+Muse Code は `MULTICA_MUSE_PATH` と `MULTICA_MUSE_MODEL` に対応しています。モデルにはランタイムの一覧にある ID を指定してください。+Cursor の検証済みバックグラウンドクリーンアップには、Linux 6.9 以降(プロセスグループ pidfd)、macOS カーネルによるプロセス識別子の照会と audit token を用いたシグナル送信のサポート、または Windows で正常に割り当てられた入れ子の Job Object が必要です。macOS では各プロセスへのシグナル送信にカーネルが検証する PID version を用いるため、同一セッションのグループに参加する必要はありません。これらの macOS API は非公開であり、プロセス捕捉時に確認されます。所有権を確保できなかったバックグラウンドプロセスは元のツール結果を返し、ツール watchdog が `0` の場合も含めて通常の idle watchdog に従います。すでに所有している作業は、クリーンアップを確認できない場合も実行中のままです。ツール watchdog を `0` にした場合はこの境界自体が存在せず、所有済みのバックグラウンド作業が生きている限り実行は継続します。その場合の実行は `MULTICA_AGENT_TIMEOUT` だけに制限され、これも既定値は `0` です。所有している Cursor のバックグラウンドプロセスは、実行が正常に完了したときにも停止されます。したがって、その実行が起動したバックグラウンドサーバーが意図的に終了処理後まで生き残ることはありません。macOS は保持された元の親プロセスの識別子によって後から生まれた子プロセスを認識できますが、観測前に中間プロセスが消えた連鎖は証明できません。そのようなプロセス、追跡対象のグループから外れた作業、および継続的な所有権や送信のエラーは、バックグラウンド作業を残す可能性があります。確認できなかったクリーンアップはログに記録され、「クリーンアップ成功」による回復ウィンドウを与えることはありません。数値の PID やプロセスグループだけを根拠に未知のプロセスを終了させることはありません。diff --git a/apps/docs/content/docs/environment-variables.ko.mdx b/apps/docs/content/docs/environment-variables.ko.mdxindex 4ce9f977da..399c8b30c4 100644--- a/apps/docs/content/docs/environment-variables.ko.mdx+++ b/apps/docs/content/docs/environment-variables.ko.mdx@@ -260,6 +260,8 @@ MULTICA_CLAUDE_PATH=/opt/bin/claudeMULTICA_CLAUDE_ARGS=--max-turns 40```+Muse Code는 `MULTICA_MUSE_PATH`와 `MULTICA_MUSE_MODEL`을 지원합니다. 모델은 런타임 목록의 ID를 사용하세요.+Cursor의 검증된 백그라운드 정리에는 Linux 6.9 이상(프로세스 그룹 pidfd), 프로세스 신원 조회와 audit token 시그널링에 대한 macOS 커널 지원, 또는 Windows에서 성공적으로 할당된 중첩 Job Object가 필요합니다. macOS에서는 커널이 검증하는 PID version으로 각 프로세스에 시그널을 보내므로 같은 세션의 그룹에 합류할 필요가 없습니다. 이 macOS API들은 비공개이며 확보 시점에 확인합니다. 소유권을 확보하지 못한 실행은 원래의 도구 결과를 반환하고, 도구 watchdog이 `0`인 경우를 포함해 일반적인 idle watchdog을 따릅니다. 이미 확보한 작업은 정리를 확인할 수 없을 때 계속 실행 중으로 남습니다. 도구 watchdog을 `0`으로 두면 이러한 경계 자체가 없습니다. 확보한 백그라운드 작업이 살아 있는 동안 실행이 계속되며, 이때 실행은 기본값이 역시 `0`인 `MULTICA_AGENT_TIMEOUT`에만 제한됩니다.확보한 Cursor 백그라운드 프로세스는 실행이 정상적으로 완료될 때도 정리됩니다. 따라서 해당 실행이 시작한 백그라운드 서버가 의도적으로 종료 처리 이후까지 살아남지는 않습니다. macOS는 보존된 원래 부모 프로세스 신원을 통해 나중에 생성된 자식 프로세스를 인식할 수 있지만, 관찰 이전에 중간 프로세스가 사라진 연결 고리는 증명할 수 없습니다. 그러한 프로세스, 추적 중인 그룹을 벗어난 작업, 그리고 지속적인 소유권 또는 시그널링 오류는 백그라운드 작업을 남길 수 있습니다. 확인되지 않은 정리는 로그로 남으며 '정리 성공'에 따른 복구 창을 부여하지 않습니다. 숫자 PID나 프로세스 그룹만을 근거로 알 수 없는 프로세스를 종료하지 않습니다.diff --git a/apps/docs/content/docs/environment-variables.mdx b/apps/docs/content/docs/environment-variables.mdxindex 871e6660d9..b8f893f4b8 100644--- a/apps/docs/content/docs/environment-variables.mdx+++ b/apps/docs/content/docs/environment-variables.mdx@@ -260,6 +260,8 @@ MULTICA_CLAUDE_PATH=/opt/bin/claudeMULTICA_CLAUDE_ARGS=--max-turns 40```+Muse Code accepts `MULTICA_MUSE_PATH` and `MULTICA_MUSE_MODEL`; use a model id from its runtime catalog.+Cursor's verified background cleanup requires Linux 6.9 or newer (process-group pidfds), macOS kernel support for process identity queries and audit-token signalling, or a successfully assigned nested Job Object on Windows. On macOS, each process is signalled using a kernel-checked PID version; no same-session group join is required. These macOS APIs are private and checked at capture time. A launch that cannot be claimed returns its original tool result and uses the ordinary idle watchdog, including when the tool watchdog is `0`. Already-claimed work remains in flight if cleanup cannot be confirmed. With the tool watchdog set to `0` there is no such boundary at all: claimed background work keeps the run in flight for as long as it lives, so the run is bounded only by `MULTICA_AGENT_TIMEOUT`, which is `0` by default.Owned Cursor background processes are also stopped when the run completes normally, so a background server started by that run does not intentionally survive finalization. macOS can recognize late children through retained original-parent identities, but cannot prove a chain whose intermediate processes disappeared before observation. Such processes, work that leaves the tracked group, or persistent ownership/signalling errors can leave background work behind. Unconfirmed cleanup is logged and never grants a successful-cleanup recovery window; unknown processes are not killed based only on their numeric PID or process group.diff --git a/apps/docs/content/docs/environment-variables.zh.mdx b/apps/docs/content/docs/environment-variables.zh.mdxindex 59df60d2f5..ec53cd8425 100644--- a/apps/docs/content/docs/environment-variables.zh.mdx+++ b/apps/docs/content/docs/environment-variables.zh.mdx@@ -260,6 +260,8 @@ MULTICA_CLAUDE_PATH=/opt/bin/claudeMULTICA_CLAUDE_ARGS=--max-turns 40```+Muse Code 支持 `MULTICA_MUSE_PATH` 和 `MULTICA_MUSE_MODEL`;模型值应使用运行时模型列表中的 ID。+Cursor 已验证的后台清理需要 Linux 6.9 及以上(进程组 pidfd)、macOS 内核对进程身份查询与 audit token 发信号的支持,或 Windows 上成功分配的嵌套 Job Object。在 macOS 上,每个进程都按内核校验的 PID version 发信号,不需要加入同一 session 的进程组;这些 macOS 接口是私有的,会在捕获时做探测。无法认领的后台启动会返回它原本的工具结果并回到普通的 idle watchdog,工具 watchdog 为 `0` 时同样如此。已经认领的工作在清理无法确认时会继续算作执行中。当工具 watchdog 设为 `0` 时则完全没有这个边界:已认领的后台工作只要还活着就一直让运行处于执行中,此时运行仅受 `MULTICA_AGENT_TIMEOUT` 约束,而它默认也是 `0`。运行正常结束时,被认领的 Cursor 后台进程同样会被停止,因此该次运行启动的后台服务不会有意地在收尾之后继续存活。macOS 可以通过保留的原始父进程身份识别后期产生的子进程,但无法证明中间进程在被观察到之前就已消失的那条链路。这类进程、离开被追踪进程组的工作,以及持续的归属或发信号错误,都可能留下残余的后台工作。未确认的清理会被记录下来,且永远不会换取一次「清理成功」的恢复窗口;不会仅凭数字 PID 或进程组就去杀掉未知进程。diff --git a/apps/docs/content/docs/install-agent-runtime.fr.mdx b/apps/docs/content/docs/install-agent-runtime.fr.mdxindex 50b89ca79c..078a81983a 100644--- a/apps/docs/content/docs/install-agent-runtime.fr.mdx+++ b/apps/docs/content/docs/install-agent-runtime.fr.mdx@@ -29,6 +29,7 @@ Multica détecte actuellement ces commandes :| Kimi CLI | `kimi` | [Kimi CLI](https://github.com/MoonshotAI/kimi-cli) || Kiro CLI | `kiro-cli` | [Installer Kiro CLI](https://kiro.dev/docs/cli/installation/) || MiniMax Code | `mcode` | [Installer MiniMax Code CLI](https://www.npmjs.com/package/@minimax-ai/code) |+| Muse Code | `muse` | [Installer Muse Code](https://dev.meta.ai/docs/muse-code) || OpenClaw | `openclaw` | [Installer OpenClaw](https://docs.openclaw.ai/install) || OpenCode | `opencode` | [Démarrage rapide d'OpenCode](https://opencode.ai/en/docs) || Pi coding agent | `pi` | [Pi coding agent](https://github.com/earendil-works/pi) |@@ -55,6 +56,8 @@ Pour QwenPaw, choisissez le fournisseur et le modèle dans la configuration propPour MiniMax Code, installez une version de Node.js prise en charge (`>=22.19 <23` ou `>=24 <27`) et exécutez `npm install --global @minimax-ai/code@latest`. Une installation npm globale place `mcode` dans le chemin des binaires globaux de npm ; si `command -v mcode` ou `Get-Command mcode` ne le trouve pas, ajoutez ce chemin au `PATH`. Exécutez ensuite `mcode login`. C'est MiniMax Code qui gère le choix du modèle ; Multica ne peut pas le remplacer via ACP.+Muse Code nécessite la version 1.4.10 ou ultérieure. Suivez le [guide officiel d'installation et de connexion](https://dev.meta.ai/docs/muse-code), puis vérifiez que `muse` est dans le `PATH`. Multica découvre ses modèles via MSP et permet de reprendre les sessions.+Pour DeepSeek Harness, installez Node.js 20+ et exécutez `npm install -g @deepseek-ai/dsh`, puis fournissez-lui le profil de runtime Multica — le bundle qui implémente le protocole `--stdio` piloté par Multica, et la raison pour laquelle un `dsh` nu n'est pas utilisable seul. Définissez `MULTICA_DSH_PROFILE_BUNDLE` sur le bundle à installer et le daemon l'ajoute pour vous, ou ajoutez-le vous-même avec `dsh plugin --profile multica add <bundle>`. `<bundle>` peut être tout ce que `dsh plugin` accepte — un nom de paquet npm, un répertoire ou une archive tarball empaquetée — et le pont de Multica se trouve dans [multica-ai/dsh-multica-runtime](https://github.com/multica-ai/dsh-multica-runtime). Il n'est pas encore publié sur un registre npm public ([multica#6936](https://github.com/multica-ai/multica/issues/6936)) : aujourd'hui, une équipe auto-hébergée le compile donc depuis ce dépôt et fait pointer la variable vers le répertoire de build, ou vers la tarball produite par `npm pack` — cette seconde option si la machine qui exécute le daemon n'est pas celle qui l'a compilé. Un nom de paquet deviendra l'option la plus simple une fois le pont publié. Quel que soit votre choix, privilégiez quelque chose que votre propre équipe publie ou compile : cette valeur est installée dans le répertoire personnel DSH de chaque hôte du daemon sans autre confirmation, si bien qu'un paquet tiers non vérifié relève d'une décision de chaîne d'approvisionnement, et non d'une simple commodité. Si vous avez installé DeepSeek Harness Desktop plutôt que le paquet npm, le daemon recherche aussi les shims CLI que génère cette application, dans son propre répertoire de données par utilisateur — `~/Library/Application Support/DSH Desktop` sur macOS, `%APPDATA%\DSH Desktop` sur Windows. Sous Windows, il s'agit des données d'application itinérantes (roaming), pas du répertoire d'installation : l'application s'installe dans Program Files ou dans `%LOCALAPPDATA%\Programs`, mais le CLI qu'elle pilote se trouve à côté de ses autres données par utilisateur. Le segment de version de ces chemins est un identifiant généré ; le daemon les énumère donc et privilégie le plus récent. Rien d'autre n'est nécessaire dans le `PATH` — un shim généré exécute le runtime propre de l'application Desktop par chemin absolu. Si DSH Desktop est installé à un emplacement non standard, faites pointer `MULTICA_DSH_PATH` vers le shim. Le daemon n'enregistre DeepSeek Harness qu'après la réussite de `dsh --profile multica --probe`, et signale le profil manquant sur `/health` en cas d'échec. Définissez `DEEPSEEK_API_KEY` (ou enregistrez-la dans les paramètres propres de dsh) avant de démarrer le daemon.Ces identifiants de connexion sont stockés localement par l'outil lui-même. Multica ne reçoit jamais les jetons de connexion de Claude, Codex, Cursor ni d'aucun autre CLI.diff --git a/apps/docs/content/docs/install-agent-runtime.ja.mdx b/apps/docs/content/docs/install-agent-runtime.ja.mdxindex f28eb1b47c..58a3e73614 100644--- a/apps/docs/content/docs/install-agent-runtime.ja.mdx+++ b/apps/docs/content/docs/install-agent-runtime.ja.mdx@@ -29,6 +29,7 @@ Multica は現在、次のコマンドを検出します。| Kimi CLI | `kimi` | [Kimi CLI](https://github.com/MoonshotAI/kimi-cli) || Kiro CLI | `kiro-cli` | [Kiro CLI のインストール](https://kiro.dev/docs/cli/installation/) || MiniMax Code | `mcode` | [MiniMax Code CLI のインストール](https://www.npmjs.com/package/@minimax-ai/code) |+| Muse Code | `muse` | [Muse Code のインストール](https://dev.meta.ai/docs/muse-code) || OpenClaw | `openclaw` | [OpenClaw のインストール](https://docs.openclaw.ai/install) || OpenCode | `opencode` | [OpenCode クイックスタート](https://opencode.ai/en/docs) || Pi coding agent | `pi` | [Pi coding agent](https://github.com/earendil-works/pi) |@@ -55,6 +56,8 @@ QwenPaw を使う場合は、QwenPaw 側の設定でプロバイダーとモデMiniMax Code を使う場合は、対応する Node.js バージョン(`>=22.19 <23` または `>=24 <27`)をインストールし、`npm install --global @minimax-ai/code@latest` を実行してください。npm のグローバルインストールによって `mcode` は npm のグローバル実行ファイルディレクトリに配置されます。`command -v mcode` または `Get-Command mcode` で見つからない場合は、そのディレクトリを `PATH` に追加してください。その後 `mcode login` を実行します。モデルは MiniMax Code が管理し、Multica から ACP 経由で上書きすることはできません。+Muse Code は 1.4.10 以降が必要です。[公式のインストールとサインイン手順](https://dev.meta.ai/docs/muse-code)に従い、`muse` が `PATH` にあることを確認してください。Multica は MSP からモデル一覧を取得し、既存のセッションを再開できます。+DeepSeek Harness を使う場合は、Node.js 20+ をインストールして `npm install -g @deepseek-ai/dsh` を実行し、Multica ランタイムプロファイルを追加してください。このバンドルが Multica の利用する `--stdio` プロトコルを提供しており、素の `dsh` だけでは使えない理由でもあります。`MULTICA_DSH_PROFILE_BUNDLE` にインストールするバンドルを設定すればデーモンが追加します。手動で行う場合は `dsh plugin --profile multica add <bundle>` を実行します。`<bundle>` は `dsh plugin` が受け付けるもの、つまり npm のパッケージ名、ディレクトリ、パック済み tarball のいずれかで、Multica 自身のブリッジは [multica-ai/dsh-multica-runtime](https://github.com/multica-ai/dsh-multica-runtime) にあります。これはまだ公開 npm レジストリに公開されていないため([multica#6936](https://github.com/multica-ai/multica/issues/6936))、現時点でセルフホストのチームはそのリポジトリからビルドし、変数をビルド出力のディレクトリに向けます。デーモンを動かすマシンとビルドしたマシンが別なら、`npm pack` が生成する tarball を指定してください。ブリッジが公開されれば、パッケージ名を指定するのが最も簡単になります。いずれの場合も、自チームが公開・ビルドしたものを優先してください。この値は追加の確認なしに各デーモンホストの DSH ホームへインストールされるため、素性の分からないサードパーティのパッケージを指定することは利便性の問題ではなくサプライチェーンの判断です。npm パッケージではなく DeepSeek Harness Desktop をインストールした場合、デーモンはそのアプリが生成する CLI シムも、アプリ自身のユーザーデータディレクトリから探します。macOS は `~/Library/Application Support/DSH Desktop`、Windows は `%APPDATA%\DSH Desktop` です。Windows のそれはローミングのアプリケーションデータであり、インストール先ではありません。アプリ自体は Program Files または `%LOCALAPPDATA%\Programs` に入りますが、駆動される CLI はユーザーごとの他の状態と同じ場所に置かれます。これらのパスのバージョン部分は生成された ID なので、デーモンは列挙して最新のものを優先します。PATH に他のものは必要ありません。生成されたシムはアプリ同梱のランタイムを絶対パスで起動します。DSH Desktop が既定以外の場所にある場合は `MULTICA_DSH_PATH` でそのシムを指定してください。デーモンは `dsh --profile multica --probe` が成功した場合のみ DeepSeek Harness を登録し、失敗した場合は `/health` にプロファイルの欠落を報告します。デーモンを起動する前に `DEEPSEEK_API_KEY` を設定(または dsh の設定に保存)してください。ログイン情報はツールがローカル環境に保存します。Multica が Claude、Codex、Cursor などの CLI のログイントークンを受け取ることはありません。diff --git a/apps/docs/content/docs/install-agent-runtime.ko.mdx b/apps/docs/content/docs/install-agent-runtime.ko.mdxindex 2583564ead..9ff321c679 100644--- a/apps/docs/content/docs/install-agent-runtime.ko.mdx+++ b/apps/docs/content/docs/install-agent-runtime.ko.mdx@@ -29,6 +29,7 @@ Multica는 현재 다음 명령을 감지합니다.| Kimi CLI | `kimi` | [Kimi CLI](https://github.com/MoonshotAI/kimi-cli) || Kiro CLI | `kiro-cli` | [Kiro CLI 설치](https://kiro.dev/docs/cli/installation/) || MiniMax Code | `mcode` | [MiniMax Code CLI 설치](https://www.npmjs.com/package/@minimax-ai/code) |+| Muse Code | `muse` | [Muse Code 설치](https://dev.meta.ai/docs/muse-code) || OpenClaw | `openclaw` | [OpenClaw 설치](https://docs.openclaw.ai/install) || OpenCode | `opencode` | [OpenCode 빠른 시작](https://opencode.ai/en/docs) || Pi coding agent | `pi` | [Pi coding agent](https://github.com/earendil-works/pi) |@@ -55,6 +56,8 @@ QwenPaw를 사용할 때는 QwenPaw 자체 설정에서 공급자와 모델을MiniMax Code를 사용하려면 지원되는 Node.js 버전(`>=22.19 <23` 또는 `>=24 <27`)을 설치한 뒤 `npm install --global @minimax-ai/code@latest`를 실행하세요. npm 전역 설치는 `mcode`를 npm의 전역 실행 파일 디렉터리에 추가합니다. `command -v mcode` 또는 `Get-Command mcode`에서 찾지 못하면 해당 디렉터리를 `PATH`에 추가하세요. 그다음 `mcode login`을 실행합니다. 모델은 MiniMax Code가 관리하며 Multica는 ACP를 통해 이를 덮어쓸 수 없습니다.+Muse Code는 1.4.10 이상이 필요합니다. [공식 설치 및 로그인 안내](https://dev.meta.ai/docs/muse-code)를 따르고 `muse`가 `PATH`에 있는지 확인하세요. Multica는 MSP로 모델 목록을 가져오며 기존 세션을 이어서 실행할 수 있습니다.+DeepSeek Harness를 사용하려면 Node.js 20+를 설치하고 `npm install -g @deepseek-ai/dsh`를 실행한 뒤 Multica 런타임 프로필을 추가하세요. 이 번들이 Multica가 사용하는 `--stdio` 프로토콜을 제공하며, `dsh`만으로는 사용할 수 없는 이유이기도 합니다. `MULTICA_DSH_PROFILE_BUNDLE`에 설치할 번들을 설정하면 데몬이 대신 추가합니다. 직접 하려면 `dsh plugin --profile multica add <bundle>`을 실행하세요. `<bundle>`은 `dsh plugin`이 받아들이는 모든 형태 — npm 패키지 이름, 디렉터리, 패키징된 tarball — 이며, Multica 자체 브리지는 [multica-ai/dsh-multica-runtime](https://github.com/multica-ai/dsh-multica-runtime)에 있습니다. 아직 공개 npm 레지스트리에 게시되지 않았으므로([multica#6936](https://github.com/multica-ai/multica/issues/6936)), 현재 셀프호스트 팀은 해당 저장소에서 직접 빌드한 뒤 변수를 빌드 산출물 디렉터리로 지정합니다. 데몬을 실행하는 기기와 빌드한 기기가 다르면 `npm pack`이 만든 tarball을 지정하세요. 브리지가 게시되면 패키지 이름을 쓰는 것이 가장 간단합니다. 어느 쪽이든 팀이 직접 게시하거나 빌드한 산출물을 우선하세요. 이 값은 추가 확인 없이 모든 데몬 호스트의 DSH 홈에 설치되므로, 검증되지 않은 서드파티 패키지를 지정하는 것은 편의의 문제가 아니라 공급망에 관한 결정입니다. npm 패키지 대신 DeepSeek Harness Desktop을 설치했다면, 데몬은 그 앱이 생성하는 CLI 심(shim)도 앱 자체의 사용자 데이터 디렉터리에서 찾습니다. macOS는 `~/Library/Application Support/DSH Desktop`, Windows는 `%APPDATA%\DSH Desktop`입니다. Windows의 이 경로는 로밍 애플리케이션 데이터이지 설치 디렉터리가 아닙니다. 앱 자체는 Program Files 또는 `%LOCALAPPDATA%\Programs`에 설치되지만, 앱이 구동하는 CLI는 사용자별 다른 상태와 함께 저장됩니다. 이 경로의 버전 구간은 생성된 id이므로 데몬이 열거하여 가장 최신 것을 우선합니다. `PATH`에 다른 것이 필요하지 않습니다. 생성된 심은 앱에 포함된 런타임을 절대 경로로 실행합니다. DSH Desktop이 기본이 아닌 위치에 있다면 `MULTICA_DSH_PATH`로 그 심을 지정하세요. 데몬은 `dsh --profile multica --probe`가 성공한 경우에만 DeepSeek Harness를 등록하고, 실패하면 `/health`에 프로필 누락을 보고합니다. 데몬을 시작하기 전에 `DEEPSEEK_API_KEY`를 설정(또는 dsh 자체 설정에 저장)하세요.로그인 자격 증명은 도구가 로컬에 저장합니다. Multica는 Claude, Codex, Cursor 또는 다른 CLI의 로그인 token을 받지 않습니다.diff --git a/apps/docs/content/docs/install-agent-runtime.mdx b/apps/docs/content/docs/install-agent-runtime.mdxindex d3f7f060a6..6fb925825f 100644--- a/apps/docs/content/docs/install-agent-runtime.mdx+++ b/apps/docs/content/docs/install-agent-runtime.mdx@@ -29,6 +29,7 @@ Multica currently detects these commands:| Kimi CLI | `kimi` | [Kimi CLI](https://github.com/MoonshotAI/kimi-cli) || Kiro CLI | `kiro-cli` | [Install Kiro CLI](https://kiro.dev/docs/cli/installation/) || MiniMax Code | `mcode` | [Install MiniMax Code CLI](https://www.npmjs.com/package/@minimax-ai/code) |+| Muse Code | `muse` | [Install Muse Code](https://dev.meta.ai/docs/muse-code) || OpenClaw | `openclaw` | [Install OpenClaw](https://docs.openclaw.ai/install) || OpenCode | `opencode` | [OpenCode quickstart](https://opencode.ai/en/docs) || Pi coding agent | `pi` | [Pi coding agent](https://github.com/earendil-works/pi) |@@ -55,6 +56,8 @@ For QwenPaw, choose the provider and model in QwenPaw's own configuration. MultiFor MiniMax Code, install a supported Node.js release (`>=22.19 <23` or `>=24 <27`) and run `npm install --global @minimax-ai/code@latest`. A global npm install places `mcode` on npm's global binary path; if `command -v mcode` or `Get-Command mcode` cannot find it, add that path to `PATH`. Then run `mcode login`. MiniMax Code owns the model selection; Multica cannot override it through ACP.+Muse Code requires 1.4.10 or later. Follow the [official installation and sign-in guide](https://dev.meta.ai/docs/muse-code), then confirm `muse` is on `PATH`. Multica discovers its models over MSP and supports continuing sessions.+For DeepSeek Harness, install Node.js 20+ and run `npm install -g @deepseek-ai/dsh`, then give it the Multica runtime profile — the bundle that implements the `--stdio` protocol Multica drives, and the reason a bare `dsh` is not usable on its own. Set `MULTICA_DSH_PROFILE_BUNDLE` to the bundle to install and the daemon adds it for you, or add it yourself with `dsh plugin --profile multica add <bundle>`. `<bundle>` is anything `dsh plugin` accepts — an npm package name, a directory, or a packed tarball — and Multica's own bridge lives at [multica-ai/dsh-multica-runtime](https://github.com/multica-ai/dsh-multica-runtime). It is not on a public npm registry yet ([multica#6936](https://github.com/multica-ai/multica/issues/6936)), so today a self-hosted team builds it from that repository and points the variable at the build directory, or at the tarball `npm pack` produces — the latter if the machine running the daemon is not the machine that built it. A package name becomes the simplest option once the bridge is published. Whatever you choose, prefer something your own team publishes or builds: this value is installed into every daemon host's DSH home without further confirmation, so an unvetted third-party package is a supply-chain decision, not a convenience. If you installed DeepSeek Harness Desktop instead of the npm package, the daemon also looks for the CLI shims that app generates, under its own per-user data directory — `~/Library/Application Support/DSH Desktop` on macOS, `%APPDATA%\DSH Desktop` on Windows. On Windows that is roaming application data, not the install directory: the app installs to Program Files or `%LOCALAPPDATA%\Programs`, but the CLI it drives lives beside its other per-user state. The version segment in those paths is a generated id, so the daemon enumerates them and prefers the newest. Nothing else is needed on `PATH` — a generated shim runs the Desktop app's own runtime by absolute path. If DSH Desktop is installed somewhere non-default, point `MULTICA_DSH_PATH` at the shim. The daemon registers DeepSeek Harness only after `dsh --profile multica --probe` succeeds, and reports the missing profile on `/health` when it does not. Set `DEEPSEEK_API_KEY` (or store it in dsh's own settings) before starting the daemon.Those login credentials are stored locally by the tool itself. Multica never receives login tokens from Claude, Codex, Cursor, or any other CLI.diff --git a/apps/docs/content/docs/install-agent-runtime.zh.mdx b/apps/docs/content/docs/install-agent-runtime.zh.mdxindex fe4a2afdb3..153e7d783e 100644--- a/apps/docs/content/docs/install-agent-runtime.zh.mdx+++ b/apps/docs/content/docs/install-agent-runtime.zh.mdx@@ -29,6 +29,7 @@ Multica 当前会检测以下命令:| Kimi CLI | `kimi` | [Kimi CLI](https://github.com/MoonshotAI/kimi-cli) || Kiro CLI | `kiro-cli` | [安装 Kiro CLI](https://kiro.dev/docs/cli/installation/) || MiniMax Code | `mcode` | [安装 MiniMax Code CLI](https://www.npmjs.com/package/@minimax-ai/code) |+| Muse Code | `muse` | [安装 Muse Code](https://dev.meta.ai/docs/muse-code) || OpenClaw | `openclaw` | [安装 OpenClaw](https://docs.openclaw.ai/install) || OpenCode | `opencode` | [OpenCode 快速开始](https://opencode.ai/en/docs) || Pi coding agent | `pi` | [Pi coding agent](https://github.com/earendil-works/pi) |@@ -55,6 +56,8 @@ Multica 当前会检测以下命令:使用 MiniMax Code 时,请安装受支持的 Node.js 版本(`>=22.19 <23` 或 `>=24 <27`),并运行 `npm install --global @minimax-ai/code@latest`。全局 npm 安装会把 `mcode` 放入 npm 的全局可执行目录;如果 `command -v mcode` 或 `Get-Command mcode` 找不到它,请将该目录加入 `PATH`。然后运行 `mcode login`。模型由 MiniMax Code 管理,Multica 无法通过 ACP 覆盖它。+Muse Code 需要 1.4.10 或更高版本。请按照[官方安装和登录指南](https://dev.meta.ai/docs/muse-code)操作,并确认 `muse` 已加入 `PATH`。Multica 通过 MSP 获取模型列表,支持继续已有会话。+使用 DeepSeek Harness 时,请先安装 Node.js 20+ 并运行 `npm install -g @deepseek-ai/dsh`,然后为它安装 Multica 运行时 profile —— 这个 bundle 实现了 Multica 驱动的 `--stdio` 协议,也是单独的 `dsh` 无法直接使用的原因。把 `MULTICA_DSH_PROFILE_BUNDLE` 设为要安装的 bundle,守护进程会替你安装;也可以自己执行 `dsh plugin --profile multica add <bundle>`。`<bundle>` 可以是 `dsh plugin` 接受的任意形式——npm 包名、目录,或打包好的 tarball——Multica 自己的桥接实现在 [multica-ai/dsh-multica-runtime](https://github.com/multica-ai/dsh-multica-runtime)。它目前还没有发布到公共 npm registry([multica#6936](https://github.com/multica-ai/multica/issues/6936)),所以现阶段自托管团队的做法是:从该仓库自行构建,然后把变量指向构建产物目录;如果运行守护进程的机器和构建机器不是同一台,就指向 `npm pack` 产出的 tarball。等桥接发布之后,直接填包名是最省事的选择。无论选哪种,都优先用你们自己发布或构建的产物:这个值会在没有二次确认的情况下被装进每一台守护进程宿主的 DSH 家目录,填一个未经审查的第三方包是供应链决策,不是图方便。如果你装的是 DeepSeek Harness Desktop 而不是 npm 包,守护进程也会去找这个应用生成的 CLI shim,位置在它自己的用户级数据目录下:macOS 是 `~/Library/Application Support/DSH Desktop`,Windows 是 `%APPDATA%\DSH Desktop`。Windows 上这是漫游应用数据目录,不是安装目录:应用本身装在 Program Files 或 `%LOCALAPPDATA%\Programs`,但它驱动的 CLI 和其他用户级状态放在一起。这些路径里的版本层是生成出来的 id,所以守护进程会枚举并优先取最新的一份。不需要 PATH 上有别的东西——生成的 shim 会用绝对路径调用应用自带的运行时。如果 DSH Desktop 装在非默认位置,请用 `MULTICA_DSH_PATH` 指向那个 shim。守护进程只有在 `dsh --profile multica --probe` 成功后才注册 DeepSeek Harness;失败时会在 `/health` 报告缺少 profile。启动守护进程前请设置 `DEEPSEEK_API_KEY`(或在 dsh 自身设置中保存)。这些登录凭据由工具保存在本机。Multica 不会接收 Claude、Codex、Cursor 或其他 CLI 的登录 token。diff --git a/apps/docs/content/docs/providers.fr.mdx b/apps/docs/content/docs/providers.fr.mdxindex 02ee2c3980..b6bf94d8c3 100644--- a/apps/docs/content/docs/providers.fr.mdx+++ b/apps/docs/content/docs/providers.fr.mdx@@ -34,6 +34,7 @@ Les étapes d'installation se trouvent dans [Installer les outils de codage IA](| Kimi CLI | `kimi` | ✓ | ✓ | `.kimi/skills/` || Kiro CLI | `kiro-cli` | ✓ | ✓ | `.kiro/skills/` || MiniMax Code | `mcode` | — | ✓ | `.minimax/skills/` |+| Muse Code | `muse` | ✓ | — | `.agents/skills/` || OpenClaw | `openclaw` | ✓ | ✓ | `skills/` || OpenCode | `opencode` | ✓ | ✓ | `.opencode/skills/` || Pi | `pi` | ✓ | ✓ | `.pi/skills/` |diff --git a/apps/docs/content/docs/providers.ja.mdx b/apps/docs/content/docs/providers.ja.mdxindex 54522e9521..e4c2f759d5 100644--- a/apps/docs/content/docs/providers.ja.mdx+++ b/apps/docs/content/docs/providers.ja.mdx@@ -34,6 +34,7 @@ Multica は、普段使っている AI コーディングツールの代わり| Kimi CLI | `kimi` | ✓ | ✓ | `.kimi/skills/` || Kiro CLI | `kiro-cli` | ✓ | ✓ | `.kiro/skills/` || MiniMax Code | `mcode` | — | ✓ | `.minimax/skills/` |+| Muse Code | `muse` | ✓ | — | `.agents/skills/` || OpenClaw | `openclaw` | ✓ | ✓ | `skills/` || OpenCode | `opencode` | ✓ | ✓ | `.opencode/skills/` || Pi | `pi` | ✓ | ✓ | `.pi/skills/` |diff --git a/apps/docs/content/docs/providers.ko.mdx b/apps/docs/content/docs/providers.ko.mdxindex 6ddb09ef51..694013431e 100644--- a/apps/docs/content/docs/providers.ko.mdx+++ b/apps/docs/content/docs/providers.ko.mdx@@ -34,6 +34,7 @@ Multica는 사용 중인 AI 코딩 도구를 대체하지 않습니다. 런타| Kimi CLI | `kimi` | ✓ | ✓ | `.kimi/skills/` || Kiro CLI | `kiro-cli` | ✓ | ✓ | `.kiro/skills/` || MiniMax Code | `mcode` | — | ✓ | `.minimax/skills/` |+| Muse Code | `muse` | ✓ | — | `.agents/skills/` || OpenClaw | `openclaw` | ✓ | ✓ | `skills/` || OpenCode | `opencode` | ✓ | ✓ | `.opencode/skills/` || Pi | `pi` | ✓ | ✓ | `.pi/skills/` |diff --git a/apps/docs/content/docs/providers.mdx b/apps/docs/content/docs/providers.mdxindex 1e93670dee..d81e3a7dad 100644--- a/apps/docs/content/docs/providers.mdx+++ b/apps/docs/content/docs/providers.mdx@@ -34,6 +34,7 @@ Install steps are in [Install AI coding tools](/install-agent-runtime).| Kimi CLI | `kimi` | ✓ | ✓ | `.kimi/skills/` || Kiro CLI | `kiro-cli` | ✓ | ✓ | `.kiro/skills/` || MiniMax Code | `mcode` | — | ✓ | `.minimax/skills/` |+| Muse Code | `muse` | ✓ | — | `.agents/skills/` || OpenClaw | `openclaw` | ✓ | ✓ | `skills/` || OpenCode | `opencode` | ✓ | ✓ | `.opencode/skills/` || Pi | `pi` | ✓ | ✓ | `.pi/skills/` |diff --git a/apps/docs/content/docs/providers.zh.mdx b/apps/docs/content/docs/providers.zh.mdxindex 0587ad72dc..5247ecd0e9 100644--- a/apps/docs/content/docs/providers.zh.mdx+++ b/apps/docs/content/docs/providers.zh.mdx@@ -34,6 +34,7 @@ Multica 不会替代你使用的 AI 编程工具。运行时会调用电脑上| Kimi CLI | `kimi` | ✓ | ✓ | `.kimi/skills/` || Kiro CLI | `kiro-cli` | ✓ | ✓ | `.kiro/skills/` || MiniMax Code | `mcode` | — | ✓ | `.minimax/skills/` |+| Muse Code | `muse` | ✓ | — | `.agents/skills/` || OpenClaw | `openclaw` | ✓ | ✓ | `skills/` || OpenCode | `opencode` | ✓ | ✓ | `.opencode/skills/` || Pi | `pi` | ✓ | ✓ | `.pi/skills/` |diff --git a/apps/web/features/landing/i18n/en.ts b/apps/web/features/landing/i18n/en.tsindex ba9a071458..e6c4ee350c 100644--- a/apps/web/features/landing/i18n/en.ts+++ b/apps/web/features/landing/i18n/en.ts@@ -104,7 +104,7 @@ export function createEnDict(label: "RUNTIMES",title: "One dashboard for all your compute",description:- "Local daemons and cloud runtimes, managed from a single panel. Real-time monitoring of online/offline status, usage charts, and activity heatmaps. Auto-detects 26 supported coding tools on your machine.",+ "Local daemons and cloud runtimes, managed from a single panel. Real-time monitoring of online/offline status, usage charts, and activity heatmaps. Auto-detects 27 supported coding tools on your machine.",cards: [{title: "Unified runtime panel",@@ -119,7 +119,7 @@ export function createEnDict({title: "Auto-detection on first run",description:- "Multica scans for 26 supported coding tools \u2014 Antigravity, Claude Code, CodeBuddy, CodeArts, Codex, Copilot, Cursor, DeepSeek Harness, DevEco Code, Dim, Grok, Hermes, Kimi, Kiro CLI, MiniMax Code, Oh-My-Pi, OpenClaw, OpenCode, Pi, Qoder, Qoder CN, Qwen Code, QwenPaw, Reasonix, Trae CLI, and ZeroClaw \u2014 and registers a runtime for each one it finds.",+ "Multica scans for 27 supported coding tools \u2014 Antigravity, Claude Code, CodeBuddy, CodeArts, Codex, Copilot, Cursor, DeepSeek Harness, DevEco Code, Dim, Grok, Hermes, Kimi, Kiro CLI, MiniMax Code, Muse Code, Oh-My-Pi, OpenClaw, OpenCode, Pi, Qoder, Qoder CN, Qwen Code, QwenPaw, Reasonix, Trae CLI, and ZeroClaw \u2014 and registers a runtime for each one it finds.",},],},@@ -139,7 +139,7 @@ export function createEnDict({title: "Install the CLI & connect your machine",description:- "Run multica setup \u2014 it walks you through OAuth, starts the daemon, and scans for the 26 supported coding tools (Antigravity, Claude Code, CodeBuddy, CodeArts, Codex, Copilot, Cursor, DeepSeek Harness, DevEco Code, Dim, Grok, Hermes, Kimi, Kiro CLI, MiniMax Code, Oh-My-Pi, OpenClaw, OpenCode, Pi, Qoder, Qoder CN, Qwen Code, QwenPaw, Reasonix, Trae CLI, ZeroClaw). Whichever ones you already have installed get registered as runtimes automatically.",+ "Run multica setup \u2014 it walks you through OAuth, starts the daemon, and scans for the 27 supported coding tools (Antigravity, Claude Code, CodeBuddy, CodeArts, Codex, Copilot, Cursor, DeepSeek Harness, DevEco Code, Dim, Grok, Hermes, Kimi, Kiro CLI, MiniMax Code, Muse Code, Oh-My-Pi, OpenClaw, OpenCode, Pi, Qoder, Qoder CN, Qwen Code, QwenPaw, Reasonix, Trae CLI, ZeroClaw). Whichever ones you already have installed get registered as runtimes automatically.",},{title: "Create your first agent",@@ -196,7 +196,7 @@ export function createEnDict({question: "What coding agents does Multica support?",answer:- "Multica supports 26 coding tools out of the box: Antigravity, Claude Code, CodeBuddy, CodeArts, Codex, Copilot, Cursor, DeepSeek Harness, DevEco Code, Dim, Grok, Hermes, Kimi, Kiro CLI, MiniMax Code, Oh-My-Pi, OpenClaw, OpenCode, Pi, Qoder, Qoder CN, Qwen Code, QwenPaw, Reasonix, Trae CLI, and ZeroClaw. The daemon auto-detects whichever CLIs you already have installed and registers a runtime for each one. Since the source code is public, you can also add your own backends.",+ "Multica supports 27 coding tools out of the box: Antigravity, Claude Code, CodeBuddy, CodeArts, Codex, Copilot, Cursor, DeepSeek Harness, DevEco Code, Dim, Grok, Hermes, Kimi, Kiro CLI, MiniMax Code, Muse Code, Oh-My-Pi, OpenClaw, OpenCode, Pi, Qoder, Qoder CN, Qwen Code, QwenPaw, Reasonix, Trae CLI, and ZeroClaw. The daemon auto-detects whichever CLIs you already have installed and registers a runtime for each one. Since the source code is public, you can also add your own backends.",},{question: "Do I need to self-host, or is there a cloud version?",diff --git a/apps/web/features/landing/i18n/ja.ts b/apps/web/features/landing/i18n/ja.tsindex 0541479a22..c9bcd7507b 100644--- a/apps/web/features/landing/i18n/ja.ts+++ b/apps/web/features/landing/i18n/ja.ts@@ -121,7 +121,7 @@ export function createJaDict({title: "初回起動時に自動検出",description:- "Multica は Antigravity、Claude Code、CodeBuddy、CodeArts、Codex、Copilot、Cursor、DeepSeek Harness、DevEco Code、Dim、Grok、Hermes、Kimi、Kiro CLI、MiniMax Code、Oh-My-Pi、OpenClaw、OpenCode、Pi、Qoder、Qoder CN、Qwen Code、QwenPaw、Reasonix、Trae CLI、ZeroClaw という26種類の対応ツールをスキャンし、見つかったものをそれぞれランタイムとして登録します。",+ "Multica は Antigravity、Claude Code、CodeBuddy、CodeArts、Codex、Copilot、Cursor、DeepSeek Harness、DevEco Code、Dim、Grok、Hermes、Kimi、Kiro CLI、MiniMax Code、Muse Code、Oh-My-Pi、OpenClaw、OpenCode、Pi、Qoder、Qoder CN、Qwen Code、QwenPaw、Reasonix、Trae CLI、ZeroClaw という27種類の対応ツールをスキャンし、見つかったものをそれぞれランタイムとして登録します。",},],},@@ -142,7 +142,7 @@ export function createJaDict({title: "CLI をインストールしてマシンを接続",description:- "multica setup を実行すると、OAuth の手順を案内し、デーモンを起動し、26種類の対応コーディングツール(Antigravity、Claude Code、CodeBuddy、CodeArts、Codex、Copilot、Cursor、DeepSeek Harness、DevEco Code、Dim、Grok、Hermes、Kimi、Kiro CLI、MiniMax Code、Oh-My-Pi、OpenClaw、OpenCode、Pi、Qoder、Qoder CN、Qwen Code、QwenPaw、Reasonix、Trae CLI、ZeroClaw)をスキャンします。すでにインストール済みのものは、自動的にランタイムとして登録されます。",+ "multica setup を実行すると、OAuth の手順を案内し、デーモンを起動し、27種類の対応コーディングツール(Antigravity、Claude Code、CodeBuddy、CodeArts、Codex、Copilot、Cursor、DeepSeek Harness、DevEco Code、Dim、Grok、Hermes、Kimi、Kiro CLI、MiniMax Code、Muse Code、Oh-My-Pi、OpenClaw、OpenCode、Pi、Qoder、Qoder CN、Qwen Code、QwenPaw、Reasonix、Trae CLI、ZeroClaw)をスキャンします。すでにインストール済みのものは、自動的にランタイムとして登録されます。",},{title: "最初のエージェントを作成",@@ -197,7 +197,7 @@ export function createJaDict({question: "Multica はどのコーディングエージェントに対応していますか?",answer:- "Multica は、Antigravity、Claude Code、CodeBuddy、CodeArts、Codex、Copilot、Cursor、DeepSeek Harness、DevEco Code、Dim、Grok、Hermes、Kimi、Kiro CLI、MiniMax Code、Oh-My-Pi、OpenClaw、OpenCode、Pi、Qoder、Qoder CN、Qwen Code、QwenPaw、Reasonix、Trae CLI、ZeroClaw の26種類のコーディングツールに標準対応しています。デーモンが、すでにインストール済みの CLI を自動検出し、それぞれをランタイムとして登録します。ソースコードが公開されているので、独自のバックエンドを追加することもできます。",+ "Multica は、Antigravity、Claude Code、CodeBuddy、CodeArts、Codex、Copilot、Cursor、DeepSeek Harness、DevEco Code、Dim、Grok、Hermes、Kimi、Kiro CLI、MiniMax Code、Muse Code、Oh-My-Pi、OpenClaw、OpenCode、Pi、Qoder、Qoder CN、Qwen Code、QwenPaw、Reasonix、Trae CLI、ZeroClaw の27種類のコーディングツールに標準対応しています。デーモンが、すでにインストール済みの CLI を自動検出し、それぞれをランタイムとして登録します。ソースコードが公開されているので、独自のバックエンドを追加することもできます。",},{question: "セルフホストが必須ですか、それともクラウド版もありますか?",diff --git a/apps/web/features/landing/i18n/ko.ts b/apps/web/features/landing/i18n/ko.tsindex 557eff98dd..69d2be6f10 100644--- a/apps/web/features/landing/i18n/ko.ts+++ b/apps/web/features/landing/i18n/ko.ts@@ -121,7 +121,7 @@ export function createKoDict({title: "처음 실행할 때 자동 등록",description:- "Multica는 Antigravity, Claude Code, CodeBuddy, CodeArts, Codex, Copilot, Cursor, DeepSeek Harness, DevEco Code, Dim, Grok, Hermes, Kimi, Kiro CLI, MiniMax Code, Oh-My-Pi, OpenClaw, OpenCode, Pi, Qoder, Qoder CN, Qwen Code, QwenPaw, Reasonix, Trae CLI, ZeroClaw 등 26개 지원 도구를 스캔해 이미 설치된 것을 런타임으로 자동 등록합니다.",+ "Multica는 Antigravity, Claude Code, CodeBuddy, CodeArts, Codex, Copilot, Cursor, DeepSeek Harness, DevEco Code, Dim, Grok, Hermes, Kimi, Kiro CLI, MiniMax Code, Muse Code, Oh-My-Pi, OpenClaw, OpenCode, Pi, Qoder, Qoder CN, Qwen Code, QwenPaw, Reasonix, Trae CLI, ZeroClaw 등 27개 지원 도구를 스캔해 이미 설치된 것을 런타임으로 자동 등록합니다.",},],},@@ -197,7 +197,7 @@ export function createKoDict({question: "Multica는 어떤 코딩 에이전트를 지원하나요?",answer:- "Multica는 Antigravity, Claude Code, CodeBuddy, CodeArts, Codex, Copilot, Cursor, DeepSeek Harness, DevEco Code, Dim, Grok, Hermes, Kimi, Kiro CLI, MiniMax Code, Oh-My-Pi, OpenClaw, OpenCode, Pi, Qoder, Qoder CN, Qwen Code, QwenPaw, Reasonix, Trae CLI, ZeroClaw 등 26개 코딩 도구를 기본 지원합니다. 데몬이 이미 설치된 CLI를 자동으로 찾아 각각 런타임으로 등록합니다. 소스 코드가 공개되어 있으므로 직접 백엔드를 추가할 수도 있습니다.",+ "Multica는 Antigravity, Claude Code, CodeBuddy, CodeArts, Codex, Copilot, Cursor, DeepSeek Harness, DevEco Code, Dim, Grok, Hermes, Kimi, Kiro CLI, MiniMax Code, Muse Code, Oh-My-Pi, OpenClaw, OpenCode, Pi, Qoder, Qoder CN, Qwen Code, QwenPaw, Reasonix, Trae CLI, ZeroClaw 등 27개 코딩 도구를 기본 지원합니다. 데몬이 이미 설치된 CLI를 자동으로 찾아 각각 런타임으로 등록합니다. 소스 코드가 공개되어 있으므로 직접 백엔드를 추가할 수도 있습니다.",},{question: "셀프 호스팅만 가능한가요, 클라우드 버전도 있나요?",diff --git a/apps/web/features/landing/i18n/zh.ts b/apps/web/features/landing/i18n/zh.tsindex e6407c508f..1d55343316 100644--- a/apps/web/features/landing/i18n/zh.ts+++ b/apps/web/features/landing/i18n/zh.ts@@ -104,7 +104,7 @@ export function createZhDict(label: "\u8fd0\u884c\u65f6",title: "\u4e00\u4e2a\u63a7\u5236\u53f0\u7ba1\u7406\u6240\u6709\u7b97\u529b",description:- "\u672c\u5730\u5b88\u62a4\u8fdb\u7a0b\u548c\u4e91\u7aef\u8fd0\u884c\u65f6\uff0c\u5728\u540c\u4e00\u4e2a\u9762\u677f\u4e2d\u7ba1\u7406\u3002\u5b9e\u65f6\u76d1\u63a7\u5728\u7ebf/\u79bb\u7ebf\u72b6\u6001\u3001\u4f7f\u7528\u91cf\u56fe\u8868\u548c\u6d3b\u52a8\u70ed\u529b\u56fe\u3002\u81ea\u52a8\u68c0\u6d4b\u672c\u673a\u5df2\u5b89\u88c5\u7684 26 \u6b3e\u652f\u6301\u7684 AI \u7f16\u7a0b\u5de5\u5177\u3002",+ "\u672c\u5730\u5b88\u62a4\u8fdb\u7a0b\u548c\u4e91\u7aef\u8fd0\u884c\u65f6\uff0c\u5728\u540c\u4e00\u4e2a\u9762\u677f\u4e2d\u7ba1\u7406\u3002\u5b9e\u65f6\u76d1\u63a7\u5728\u7ebf/\u79bb\u7ebf\u72b6\u6001\u3001\u4f7f\u7528\u91cf\u56fe\u8868\u548c\u6d3b\u52a8\u70ed\u529b\u56fe\u3002\u81ea\u52a8\u68c0\u6d4b\u672c\u673a\u5df2\u5b89\u88c5\u7684 27 \u6b3e\u652f\u6301\u7684 AI \u7f16\u7a0b\u5de5\u5177\u3002",cards: [{title: "\u7edf\u4e00\u8fd0\u884c\u65f6\u9762\u677f",@@ -119,7 +119,7 @@ export function createZhDict({title: "\u9996\u6b21\u542f\u52a8\u81ea\u52a8\u6ce8\u518c",description:- "Multica \u626b\u63cf\u672c\u673a\u7684 26 \u6b3e\u652f\u6301\u7684 AI \u7f16\u7a0b\u5de5\u5177\u2014\u2014Antigravity\u3001Claude Code\u3001CodeBuddy\u3001CodeArts\u3001Codex\u3001Copilot\u3001Cursor\u3001DeepSeek Harness\u3001DevEco Code\u3001Dim\u3001Grok\u3001Hermes\u3001Kimi\u3001Kiro CLI\u3001MiniMax Code\u3001Oh-My-Pi\u3001OpenClaw\u3001OpenCode\u3001Pi\u3001Qoder\u3001Qoder CN\u3001Qwen Code\u3001QwenPaw\u3001Reasonix\u3001Trae CLI\u3001ZeroClaw\u2014\u2014\u5e76\u4e3a\u6bcf\u6b3e\u5df2\u5b89\u88c5\u7684\u5de5\u5177\u6ce8\u518c\u4e00\u4e2a\u8fd0\u884c\u65f6\u3002",+ "Multica \u626b\u63cf\u672c\u673a\u7684 27 \u6b3e\u652f\u6301\u7684 AI \u7f16\u7a0b\u5de5\u5177\u2014\u2014Antigravity\u3001Claude Code\u3001CodeBuddy\u3001CodeArts\u3001Codex\u3001Copilot\u3001Cursor\u3001DeepSeek Harness\u3001DevEco Code\u3001Dim\u3001Grok\u3001Hermes\u3001Kimi\u3001Kiro CLI\u3001MiniMax Code\u3001Muse Code\u3001Oh-My-Pi\u3001OpenClaw\u3001OpenCode\u3001Pi\u3001Qoder\u3001Qoder CN\u3001Qwen Code\u3001QwenPaw\u3001Reasonix\u3001Trae CLI\u3001ZeroClaw\u2014\u2014\u5e76\u4e3a\u6bcf\u6b3e\u5df2\u5b89\u88c5\u7684\u5de5\u5177\u6ce8\u518c\u4e00\u4e2a\u8fd0\u884c\u65f6\u3002",},],},@@ -139,7 +139,7 @@ export function createZhDict({title: "\u5b89\u88c5 CLI \u5e76\u8fde\u63a5\u4f60\u7684\u673a\u5668",description:- "运行 multica setup——它会引导你完成 OAuth 登录、启动守护进程、并扫描 26 款支持的 AI 编程工具(Antigravity、Claude Code、CodeBuddy、CodeArts、Codex、Copilot、Cursor、DeepSeek Harness、DevEco Code、Dim、Grok、Hermes、Kimi、Kiro CLI、MiniMax Code、Oh-My-Pi、OpenClaw、OpenCode、Pi、Qoder、Qoder CN、Qwen Code、QwenPaw、Reasonix、Trae CLI、ZeroClaw)。本机已安装的工具会被自动注册成运行时。",+ "运行 multica setup——它会引导你完成 OAuth 登录、启动守护进程、并扫描 27 款支持的 AI 编程工具(Antigravity、Claude Code、CodeBuddy、CodeArts、Codex、Copilot、Cursor、DeepSeek Harness、DevEco Code、Dim、Grok、Hermes、Kimi、Kiro CLI、MiniMax Code、Muse Code、Oh-My-Pi、OpenClaw、OpenCode、Pi、Qoder、Qoder CN、Qwen Code、QwenPaw、Reasonix、Trae CLI、ZeroClaw)。本机已安装的工具会被自动注册成运行时。",},{title: "\u521b\u5efa\u4f60\u7684\u7b2c\u4e00\u4e2a 智能体",@@ -196,7 +196,7 @@ export function createZhDict({question: "Multica \u652f\u6301\u54ea\u4e9b\u7f16\u7801 智能体\uff1f",answer:- "Multica \u5f00\u7bb1\u5373\u7528\u652f\u6301 26 \u6b3e AI \u7f16\u7a0b\u5de5\u5177\uff1aAntigravity\u3001Claude Code\u3001CodeBuddy\u3001CodeArts\u3001Codex\u3001Copilot\u3001Cursor\u3001DeepSeek Harness\u3001DevEco Code\u3001Dim\u3001Grok\u3001Hermes\u3001Kimi\u3001Kiro CLI\u3001MiniMax Code\u3001Oh-My-Pi\u3001OpenClaw\u3001OpenCode\u3001Pi\u3001Qoder\u3001Qoder CN\u3001Qwen Code\u3001QwenPaw\u3001Reasonix\u3001Trae CLI\u3001ZeroClaw\u3002\u5b88\u62a4\u8fdb\u7a0b\u4f1a\u81ea\u52a8\u68c0\u6d4b\u672c\u673a\u5df2\u5b89\u88c5\u7684 CLI \u5e76\u4e3a\u6bcf\u6b3e\u6ce8\u518c\u4e00\u4e2a\u8fd0\u884c\u65f6\u3002因为源码公开,你也可以自己添加后端。",+ "Multica \u5f00\u7bb1\u5373\u7528\u652f\u6301 27 \u6b3e AI \u7f16\u7a0b\u5de5\u5177\uff1aAntigravity\u3001Claude Code\u3001CodeBuddy\u3001CodeArts\u3001Codex\u3001Copilot\u3001Cursor\u3001DeepSeek Harness\u3001DevEco Code\u3001Dim\u3001Grok\u3001Hermes\u3001Kimi\u3001Kiro CLI\u3001MiniMax Code\u3001Muse Code\u3001Oh-My-Pi\u3001OpenClaw\u3001OpenCode\u3001Pi\u3001Qoder\u3001Qoder CN\u3001Qwen Code\u3001QwenPaw\u3001Reasonix\u3001Trae CLI\u3001ZeroClaw\u3002\u5b88\u62a4\u8fdb\u7a0b\u4f1a\u81ea\u52a8\u68c0\u6d4b\u672c\u673a\u5df2\u5b89\u88c5\u7684 CLI \u5e76\u4e3a\u6bcf\u6b3e\u6ce8\u518c\u4e00\u4e2a\u8fd0\u884c\u65f6\u3002因为源码公开,你也可以自己添加后端。",},{question: "\u9700\u8981\u81ea\u6258\u7ba1\u5417\uff0c\u8fd8\u662f\u6709\u4e91\u7248\u672c\uff1f",diff --git a/packages/core/runtimes/display.ts b/packages/core/runtimes/display.tsindex 79893d84cb..f6b4234b47 100644--- a/packages/core/runtimes/display.ts+++ b/packages/core/runtimes/display.ts@@ -37,7 +37,7 @@ export function runtimeDisplayLabel(* (server/internal/daemon/daemon.go): the daemon bakes that display name into* `name` for the no-alias case (for example, "Trae (host)"), so the aliased label has to use* the exact same names or the two paths drift apart (#5260). `qoderclicn`,- * `codearts`, `dsh`, `traecli`, `qwen`, `qwenpaw`, `mcode`, and `zeroclaw` need overrides today — every other provider is a+ * `codearts`, `dsh`, `traecli`, `qwen`, `qwenpaw`, `mcode`, `muse`, and `zeroclaw` need overrides today — every other provider is a* first-letter capitalization of its slug on both sides. Keep in sync with the daemon map.*/const PROVIDER_DISPLAY_NAMES: Record<string, string> = {@@ -48,6 +48,7 @@ const PROVIDER_DISPLAY_NAMES: Record<string, string> = {qwen: "Qwen Code",qwenpaw: "QwenPaw",mcode: "MiniMax Code",+ muse: "Muse Code",omp: "Oh-My-Pi",zeroclaw: "ZeroClaw",};diff --git a/packages/core/types/agent.ts b/packages/core/types/agent.tsindex 8d1759d801..38d67a6cf6 100644--- a/packages/core/types/agent.ts+++ b/packages/core/types/agent.ts@@ -128,6 +128,7 @@ export const RUNTIME_PROFILE_PROTOCOL_FAMILIES = ["qwen","qwenpaw","mcode",+ "muse","zeroclaw",] as const;diff --git a/packages/views/runtimes/components/provider-logo.tsx b/packages/views/runtimes/components/provider-logo.tsxindex 10836099e6..3bfacf0c0e 100644--- a/packages/views/runtimes/components/provider-logo.tsx+++ b/packages/views/runtimes/components/provider-logo.tsx@@ -332,6 +332,16 @@ function McodeLogo({ className }: { className: string }) {);}+// Muse Code SDK docs favicon: https://meta-models.github.io/muse-code-sdk/next/favicon.svg+function MuseLogo({ className }: { className: string }) {+ return (+ <svg viewBox="0 0 64 64" className={className}>+ <rect width="64" height="64" rx="12" fill="#5b45e0" />+ <path d="M14 46V18h8l10 15 10-15h8v28h-8V31L32 46 22 31v15z" fill="white" />+ </svg>+ );+}+// DeepSeek Harness — official mark copied from deepseek-ai/deepseek-harness// (apps/web/public/favicon.svg, MIT — Copyright 2026 DeepSeek). Upstream picks// its colour with a prefers-color-scheme block; inlining the path lets@@ -429,6 +439,8 @@ export function ProviderLogo({return <QwenPawLogo className={className} />;case "mcode":return <McodeLogo className={className} />;+ case "muse":+ return <MuseLogo className={className} />;case "dsh":return <DshLogo className={className} />;case "dim":diff --git a/scripts/agent-cli-command-names.txt b/scripts/agent-cli-command-names.txtindex 88dbe7e846..c8893f36fd 100644--- a/scripts/agent-cli-command-names.txt+++ b/scripts/agent-cli-command-names.txt@@ -13,6 +13,7 @@ hermeskimikiro-climcode+museompopenclawopencodediff --git a/server/internal/daemon/agents_probe.go b/server/internal/daemon/agents_probe.goindex 928a38f670..6e596d96bb 100644--- a/server/internal/daemon/agents_probe.go+++ b/server/internal/daemon/agents_probe.go@@ -269,6 +269,12 @@ var probeAgentCLIs = func() map[string]AgentEntry {if e, ok := probe("MULTICA_ANTIGRAVITY_PATH", "agy", "MULTICA_ANTIGRAVITY_MODEL"); ok {agents["antigravity"] = e}+ // Meta Muse Code (`muse`) exposes its session protocol (MSP) through+ // `muse serve`. The launcher script installs and updates the real binary+ // under ~/.local/bin, so the PATH entry is what a host actually has.+ if e, ok := probe("MULTICA_MUSE_PATH", "muse", "MULTICA_MUSE_MODEL"); ok {+ agents["muse"] = e+ }// Qoder CLI ships as the `qodercli` binary (Qoder Desktop does not put it// on PATH; users install it separately, often via an npm global prefix).// It must go through probe() like every other provider so the login-shelldiff --git a/server/internal/daemon/config.go b/server/internal/daemon/config.goindex 54fc096549..d90b46c1e4 100644--- a/server/internal/daemon/config.go+++ b/server/internal/daemon/config.go@@ -266,7 +266,7 @@ func LoadConfig(overrides Overrides) (Config, error) {// can re-run the same discovery on a live daemon (MUL-5439).agents := probeAgentCLIs()if len(agents) == 0 && !overrides.AllowNoAgents {- return Config{}, fmt.Errorf("no agent CLI found: install claude, codebuddy, codearts, codex, copilot, opencode, deveco, openclaw, hermes, pi, omp, cursor-agent, kimi, reasonix, dsh, kiro-cli, agy, qodercli, qoderclicn, traecli, grok, qwen, qwenpaw, mcode, dim, or zeroclaw and ensure it is on PATH")+ return Config{}, fmt.Errorf("no agent CLI found: install claude, codebuddy, codearts, codex, copilot, opencode, deveco, openclaw, hermes, pi, omp, cursor-agent, kimi, reasonix, dsh, kiro-cli, agy, qodercli, qoderclicn, traecli, grok, qwen, qwenpaw, mcode, muse, dim, or zeroclaw and ensure it is on PATH")}claudeArgs, err := shellArgsFromEnv("MULTICA_CLAUDE_ARGS")@@ -974,7 +974,7 @@ func isExecutableFile(path string) bool {// doesn't require editing this list by hand.var defaultAgentCommandNames = append([]string{"claude", "codex", "opencode", "codearts", "deveco", "openclaw", "hermes",- "pi", "cursor-agent", "copilot", "kimi", "reasonix", "dsh", "kiro-cli", "codebuddy", "agy", "qodercli", "qoderclicn", "traecli", "grok", "qwen", "qwenpaw", "mcode", "dim", "zeroclaw",+ "pi", "cursor-agent", "copilot", "kimi", "reasonix", "dsh", "kiro-cli", "codebuddy", "agy", "qodercli", "qoderclicn", "traecli", "grok", "qwen", "qwenpaw", "mcode", "muse", "dim", "zeroclaw",}, agent.BuiltinRuntimeCommands()...)// codexDesktopAppBundlePaths returns candidate macOS app-bundle locations fordiff --git a/server/internal/daemon/daemon.go b/server/internal/daemon/daemon.goindex b3f0773d2f..853503f050 100644--- a/server/internal/daemon/daemon.go+++ b/server/internal/daemon/daemon.go@@ -6430,6 +6430,7 @@ var runtimeDisplayNameOverrides = map[string]string{"qwen": "Qwen Code","qwenpaw": "QwenPaw","mcode": "MiniMax Code",+ "muse": "Muse Code","zeroclaw": "ZeroClaw",}diff --git a/server/internal/daemon/execenv/context.go b/server/internal/daemon/execenv/context.goindex eab464857c..ac748c9a31 100644--- a/server/internal/daemon/execenv/context.go+++ b/server/internal/daemon/execenv/context.go@@ -147,6 +147,7 @@ func writeWorkspacesRootMarkerAtomic(path string, data []byte) error {// Qwen Code: skills → {workDir}/.qwen/skills/{name}/SKILL.md (native project-level discovery)// QwenPaw: skills → {workDir}/.qwenpaw/skills/{name}/SKILL.md (native project-level discovery)// MiniMax Code: skills → {workDir}/.minimax/skills/{name}/SKILL.md (native project-level discovery)+// Muse Code: skills → {workDir}/.agents/skills/{name}/SKILL.md (native project-level discovery)// Antigravity: skills → {workDir}/.agents/skills/{name}/SKILL.md (native discovery — see https://antigravity.google/docs/gcli-migration "Workspace skills")// Default: skills → {workDir}/.agent_context/skills/{name}/SKILL.md//@@ -412,6 +413,9 @@ func skillsDirPath(workDir, provider string) string {case "mcode":// MiniMax Code discovers project-level skills from .minimax/skills/.return filepath.Join(workDir, ".minimax", "skills")+ case "muse":+ // Muse's native project root: https://meta-models.github.io/muse-code-sdk/next/guides/extend/skills/+ return filepath.Join(workDir, ".agents", "skills")case "traecli":// Official TRAE CLI discovers project-level skills from .traecli/skills/// in the workdir (global skills live in ~/.traecli/skills). Seediff --git a/server/internal/daemon/execenv/muse_test.go b/server/internal/daemon/execenv/muse_test.gonew file mode 100644index 0000000000..884861f0df--- /dev/null+++ b/server/internal/daemon/execenv/muse_test.go@@ -0,0 +1,61 @@+package execenv++import (+ "os"+ "path/filepath"+ "strings"+ "testing"+)++func TestMusePrepareDeliversBriefAndSkills(t *testing.T) {+ t.Parallel()+ workDir := t.TempDir()+ briefPath := filepath.Join(workDir, "AGENTS.md")+ const repoInstructions = "# Repository rules\nKeep user files.\n"+ if err := os.WriteFile(briefPath, []byte(repoInstructions), 0o644); err != nil {+ t.Fatal(err)+ }+ env, err := Prepare(PrepareParams{+ WorkspacesRoot: t.TempDir(), WorkspaceID: "muse-workspace", TaskID: "muse-task",+ Provider: "muse", LocalWorkDir: workDir,+ Task: TaskContextForEnv{+ IssueID: "11111111-2222-3333-4444-555555555555",+ AgentSkills: []SkillContextForEnv{{Name: "muse-workflow", Content: "Follow the Muse workflow."}},+ },+ }, discardLogger())+ if err != nil {+ t.Fatal(err)+ }+ if _, err := InjectRuntimeConfig(env.WorkDir, "muse", TaskContextForEnv{+ IssueID: "11111111-2222-3333-4444-555555555555",+ }); err != nil {+ t.Fatal(err)+ }+ brief, err := os.ReadFile(briefPath)+ if err != nil {+ t.Fatal(err)+ }+ for _, want := range []string{repoInstructions, "multica issue comment add", "## Output"} {+ if !strings.Contains(string(brief), want) {+ t.Errorf("runtime brief is missing %q", want)+ }+ }+ skillPath := filepath.Join(workDir, ".agents", "skills", "muse-workflow", "SKILL.md")+ skill, err := os.ReadFile(skillPath)+ if err != nil || !strings.Contains(string(skill), "Follow the Muse workflow.") {+ t.Errorf("native skill missing: content=%q err=%v", skill, err)+ }+ if err := CleanupSidecars(env.RootDir); err != nil {+ t.Fatal(err)+ }+ if err := CleanupRuntimeConfig(workDir, "muse"); err != nil {+ t.Fatal(err)+ }+ restored, err := os.ReadFile(briefPath)+ if err != nil || string(restored) != repoInstructions {+ t.Errorf("repository instructions changed after cleanup: %q, %v", restored, err)+ }+ if _, err := os.Stat(skillPath); !os.IsNotExist(err) {+ t.Errorf("managed skill survived cleanup: %v", err)+ }+}diff --git a/server/internal/daemon/execenv/runtime_config.go b/server/internal/daemon/execenv/runtime_config.goindex 096c5266dd..76e6e338b7 100644--- a/server/internal/daemon/execenv/runtime_config.go+++ b/server/internal/daemon/execenv/runtime_config.go@@ -215,7 +215,7 @@ func runtimeConfigPath(workDir, provider string) string {return filepath.Join(workDir, "CODEBUDDY.md")case "qwen":return filepath.Join(workDir, "QWEN.md")- case "codex", "copilot", "opencode", "codearts", "deveco", "openclaw", "hermes", "pi", "cursor", "kimi", "reasonix", "dsh", "kiro", "antigravity", "qoder", "qoderclicn", "traecli", "grok", "qwenpaw", "mcode", "dim", "zeroclaw":+ case "codex", "copilot", "opencode", "codearts", "deveco", "openclaw", "hermes", "pi", "cursor", "kimi", "reasonix", "dsh", "kiro", "antigravity", "qoder", "qoderclicn", "traecli", "grok", "qwenpaw", "mcode", "muse", "dim", "zeroclaw":return filepath.Join(workDir, "AGENTS.md")default:return ""diff --git a/server/internal/daemon/execenv/runtime_config_test.go b/server/internal/daemon/execenv/runtime_config_test.goindex 32732f73d0..8fe7c94a2c 100644--- a/server/internal/daemon/execenv/runtime_config_test.go+++ b/server/internal/daemon/execenv/runtime_config_test.go@@ -1086,6 +1086,7 @@ func TestInjectRuntimeConfigPreservesUserContent(t *testing.T) {{"zeroclaw", "AGENTS.md"},{"kiro", "AGENTS.md"},{"antigravity", "AGENTS.md"},+ {"muse", "AGENTS.md"},{"qwen", "QWEN.md"},}for _, tc := range cases {@@ -1466,6 +1467,7 @@ func TestCleanupRuntimeConfigByProvider(t *testing.T) {{"zeroclaw", "AGENTS.md"},{"kiro", "AGENTS.md"},{"antigravity", "AGENTS.md"},+ {"muse", "AGENTS.md"},{"qwen", "QWEN.md"},}for _, tc := range cases {diff --git a/server/internal/daemon/execenv/sidecar_manifest_test.go b/server/internal/daemon/execenv/sidecar_manifest_test.goindex b895b80a25..72eff2d1ab 100644--- a/server/internal/daemon/execenv/sidecar_manifest_test.go+++ b/server/internal/daemon/execenv/sidecar_manifest_test.go@@ -644,6 +644,7 @@ var sameSlugSkillProviderCases = []struct {{"dsh", filepath.Join(".dsh", "skills", "issue-review")},{"kiro", filepath.Join(".kiro", "skills", "issue-review")},{"antigravity", filepath.Join(".agents", "skills", "issue-review")},+ {"muse", filepath.Join(".agents", "skills", "issue-review")},{"qwen", filepath.Join(".qwen", "skills", "issue-review")},{"hermes", filepath.Join(".agent_context", "skills", "issue-review")},}diff --git a/server/internal/daemon/local_skills.go b/server/internal/daemon/local_skills.goindex b6ab74614f..02662c2bc6 100644--- a/server/internal/daemon/local_skills.go+++ b/server/internal/daemon/local_skills.go@@ -244,6 +244,12 @@ func localSkillRootsForProvider(provider string) ([]localSkillRoot, bool, error)// directly below it. Project skills are injected separately under// <workDir>/.minimax/skills.providerRoot = filepath.Join(home, ".minimax", "skills")+ case "muse":+ configHome := os.Getenv("XDG_CONFIG_HOME")+ if configHome == "" {+ configHome = filepath.Join(home, ".config")+ }+ providerRoot = filepath.Join(configHome, "muse", "skills")default:return nil, false, nil}diff --git a/server/internal/daemon/muse_test.go b/server/internal/daemon/muse_test.gonew file mode 100644index 0000000000..69d6457e29--- /dev/null+++ b/server/internal/daemon/muse_test.go@@ -0,0 +1,68 @@+package daemon++import (+ "os"+ "path/filepath"+ "runtime"+ "testing"+)++func TestMuseLocalSkillsUseConfigAndUniversalRoots(t *testing.T) {+ for _, customConfig := range []bool{false, true} {+ t.Run(map[bool]string{false: "default", true: "xdg"}[customConfig], func(t *testing.T) {+ home := t.TempDir()+ redirectTestHome(t, home)+ configDir := filepath.Join(home, ".config")+ t.Setenv("XDG_CONFIG_HOME", "")+ if customConfig {+ configDir = t.TempDir()+ t.Setenv("XDG_CONFIG_HOME", configDir)+ }+ writeTestLocalSkill(t, filepath.Join(configDir, "muse", "skills"), "personal", map[string]string{+ "SKILL.md": "---\nname: Personal\ndescription: Muse personal skill\n---\n",+ })+ writeTestLocalSkill(t, filepath.Join(home, ".agents", "skills"), "shared", map[string]string{+ "SKILL.md": "---\nname: Shared\ndescription: Cross-agent skill\n---\n",+ })+ skills, supported, err := listRuntimeLocalSkills("muse")+ if err != nil || !supported || len(skills) != 2 {+ t.Fatalf("supported=%v skills=%v err=%v", supported, skills, err)+ }+ _, supported, err = loadRuntimeLocalSkillBundle("muse", "personal")+ if err != nil || !supported {+ t.Fatalf("personal skill cannot be imported: %v", err)+ }+ })+ }+}++func TestMuseDetectedThroughLoginShell(t *testing.T) {+ if runtime.GOOS == "windows" {+ t.Skip("requires a POSIX login shell")+ }+ home := t.TempDir()+ redirectTestHome(t, home)+ binDir := t.TempDir()+ bin := filepath.Join(binDir, "muse")+ if err := os.WriteFile(bin, []byte("#!/bin/sh\nprintf 'Muse Code 1.4.10\\n'\n"), 0o755); err != nil {+ t.Fatal(err)+ }+ rc := filepath.Join(t.TempDir(), "shell.rc")+ if err := os.WriteFile(rc, []byte("export PATH=\""+binDir+":$PATH\"\n"), 0o644); err != nil {+ t.Fatal(err)+ }+ t.Setenv("PATH", "/usr/bin:/bin")+ t.Setenv("SHELL", "/bin/sh")+ t.Setenv("ENV", rc)+ t.Setenv("MULTICA_DAEMON_ID", "11111111-1111-1111-1111-111111111111")+ pinNonCodexAgentsToMissingPaths(t)+ t.Setenv("MULTICA_CODEX_PATH", filepath.Join(t.TempDir(), "missing-codex"))+ t.Setenv("MULTICA_MUSE_PATH", "")+ cfg, err := LoadConfig(Overrides{ServerURL: "http://localhost:0", WorkspacesRoot: t.TempDir()})+ if err != nil {+ t.Fatal(err)+ }+ if got, ok := cfg.Agents["muse"]; !ok || got.Path != canonicalExecutablePath(bin) {+ t.Fatalf("login-shell Muse was not detected: %+v", cfg.Agents)+ }+}diff --git a/server/internal/metrics/labels.go b/server/internal/metrics/labels.goindex 829f823bac..ffeb7f6c38 100644--- a/server/internal/metrics/labels.go+++ b/server/internal/metrics/labels.go@@ -159,6 +159,7 @@ var ("reasonix": "reasonix","dim": "dim","mcode": "mcode",+ "muse": "muse","zeroclaw": "zeroclaw","multica_agent": "multica_agent","openclaw": "openclaw",diff --git a/server/migrations/583_runtime_profile_add_muse.down.sql b/server/migrations/583_runtime_profile_add_muse.down.sqlnew file mode 100644index 0000000000..8b527df1e6--- /dev/null+++ b/server/migrations/583_runtime_profile_add_muse.down.sql@@ -0,0 +1,32 @@+-- Restore the pre-583 whitelist. Existing Muse rows remain valid because+-- the replacement constraint is NOT VALID, but new Muse profiles are blocked.+ALTER TABLE runtime_profile DROP CONSTRAINT IF EXISTS runtime_profile_protocol_family_check;++ALTER TABLE runtime_profile ADD CONSTRAINT runtime_profile_protocol_family_check+ CHECK (protocol_family IN (+ 'claude',+ 'codebuddy',+ 'codex',+ 'copilot',+ 'opencode',+ 'codearts',+ 'openclaw',+ 'hermes',+ 'pi',+ 'cursor',+ 'kimi',+ 'reasonix',+ 'dsh',+ 'kiro',+ 'antigravity',+ 'qoder',+ 'qoderclicn',+ 'traecli',+ 'deveco',+ 'grok',+ 'qwen',+ 'qwenpaw',+ 'mcode',+ 'dim',+ 'zeroclaw'+ )) NOT VALID;diff --git a/server/migrations/583_runtime_profile_add_muse.up.sql b/server/migrations/583_runtime_profile_add_muse.up.sqlnew file mode 100644index 0000000000..b394827097--- /dev/null+++ b/server/migrations/583_runtime_profile_add_muse.up.sql@@ -0,0 +1,34 @@+-- Add Meta Muse Code as a first-party protocol family. NOT VALID+-- preserves historical-row tolerance while enforcing the expanded whitelist+-- for new rows.+ALTER TABLE runtime_profile DROP CONSTRAINT IF EXISTS runtime_profile_protocol_family_check;++ALTER TABLE runtime_profile ADD CONSTRAINT runtime_profile_protocol_family_check+ CHECK (protocol_family IN (+ 'claude',+ 'codebuddy',+ 'codex',+ 'copilot',+ 'opencode',+ 'codearts',+ 'openclaw',+ 'hermes',+ 'pi',+ 'cursor',+ 'kimi',+ 'reasonix',+ 'dsh',+ 'kiro',+ 'antigravity',+ 'qoder',+ 'qoderclicn',+ 'traecli',+ 'deveco',+ 'grok',+ 'qwen',+ 'qwenpaw',+ 'mcode',+ 'muse',+ 'dim',+ 'zeroclaw'+ )) NOT VALID;diff --git a/server/pkg/agent/agent.go b/server/pkg/agent/agent.goindex 4ec18b7e01..cb1fb1236b 100644--- a/server/pkg/agent/agent.go+++ b/server/pkg/agent/agent.go@@ -1,7 +1,7 @@// Package agent provides a unified interface for executing prompts via// coding agents (Claude Code, CodeBuddy, Codex, Copilot, OpenCode, DevEco Code,// OpenClaw, Hermes, Pi, Oh-My-Pi, Cursor, Kimi, Reasonix, Kiro, Antigravity, Qoder,-// Trae, Grok, Qwen Code, QwenPaw, MiniMax Code). It+// Trae, Grok, Qwen Code, QwenPaw, MiniMax Code, Meta Muse Code). It// mirrors the happy-cli AgentBackend pattern, translated to idiomatic Go.package agent@@ -317,7 +317,7 @@ type Result struct {// Config configures a Backend instance.type Config struct {- ExecutablePath string // path to CLI binary (claude, codebuddy, codex, copilot, opencode, codearts, openclaw, hermes, pi, cursor, kimi, reasonix, dsh, kiro-cli, agy, qodercli, qoderclicn, traecli, grok, qwen, qwenpaw, mcode, dim, zeroclaw)+ ExecutablePath string // path to CLI binary (claude, codebuddy, codex, copilot, opencode, codearts, openclaw, hermes, pi, cursor, kimi, reasonix, dsh, kiro-cli, agy, qodercli, qoderclicn, traecli, grok, qwen, qwenpaw, mcode, muse, dim, zeroclaw)CLIVersion string // detected version paired with ExecutablePath; vendor-specific usage semantics also require BuiltinRuntimeEnv map[string]string // extra environment variablesLogger *slog.Logger@@ -352,7 +352,7 @@ type Config struct {}// New creates a Backend for the given agent type.-// Supported types: "claude", "codebuddy", "codex", "copilot", "opencode", "codearts", "deveco", "openclaw", "hermes", "pi", "cursor", "kimi", "reasonix", "dsh", "kiro", "antigravity", "qoder", "qoderclicn", "traecli", "grok", "qwen", "qwenpaw", "mcode".+// Supported types: "claude", "codebuddy", "codex", "copilot", "opencode", "codearts", "deveco", "openclaw", "hermes", "pi", "cursor", "kimi", "reasonix", "dsh", "kiro", "antigravity", "qoder", "qoderclicn", "traecli", "grok", "qwen", "qwenpaw", "mcode", "muse".//// SupportedTypes is the canonical whitelist of agent types eligible to back a// custom runtime profile. It MUST stay in lockstep with the@@ -395,6 +395,7 @@ var SupportedTypes = []string{"qwen","qwenpaw","mcode",+ "muse","dim","zeroclaw",}@@ -500,6 +501,8 @@ func New(agentType string, cfg Config) (Backend, error) {return &qwenpawBackend{cfg: cfg}, nilcase "mcode":return &mcodeBackend{cfg: cfg}, nil+ case "muse":+ return &museBackend{cfg: cfg}, nilcase "zeroclaw":return &zeroclawBackend{cfg: cfg}, nildefault:@@ -548,6 +551,7 @@ var launchHeaders = map[string]string{"qwenpaw": "qwenpaw acp","dim": "dim acp","mcode": "mcode acp",+ "muse": "muse serve (msp)","zeroclaw": "zeroclaw acp",}diff --git a/server/pkg/agent/models.go b/server/pkg/agent/models.goindex e32dcbbd29..d058d5ffcc 100644--- a/server/pkg/agent/models.go+++ b/server/pkg/agent/models.go@@ -307,6 +307,13 @@ func ListModels(ctx context.Context, providerType string, runtimeCmd Command) (C// MCode's ACP server does not expose session-scoped model selection or// a model catalog. The configured MCode runtime owns the model choice.return Catalog{Models: []Model{}}, nil+ case "muse":+ // Meta Muse Code advertises its catalog over MSP model/list, a+ // session-free query, and applies the pick through session/start+ // modelId (or session/setModel on a resumed session).+ return cachedDiscovery(discoveryCacheKey(providerType, runtimeCmd), func() (Catalog, error) {+ return discoverMuseModels(ctx, runtimeCmd)+ })case "grok":// xAI Grok Build is ACP-native (`grok agent stdio`); model catalog// comes from session/new. Falls back to a small static list so thediff --git a/server/pkg/agent/muse.go b/server/pkg/agent/muse.gonew file mode 100644index 0000000000..3e776df565--- /dev/null+++ b/server/pkg/agent/muse.go@@ -0,0 +1,1040 @@+package agent++import (+ "context"+ "crypto/rand"+ "encoding/hex"+ "encoding/json"+ "errors"+ "fmt"+ "io"+ "os/exec"+ "strconv"+ "strings"+ "sync"+ "sync/atomic"+ "syscall"+ "time"+)++// museBlockedArgs protect the MSP stdio transport selected by the daemon.+// `muse serve` is the protocol host; every other subcommand is an interactive+// or one-shot surface that cannot answer a claimed headless task. Keeping these+// tokens out of custom_args prevents a profile or agent from replacing the+// protocol process with a TUI, a login flow, or a one-shot exec that would+// never speak MSP back.+var museBlockedArgs = map[string]blockedArgMode{+ "serve": blockedStandalone,+ "exec": blockedStandalone,+ "resume": blockedStandalone,+ "login": blockedStandalone,+ "logout": blockedStandalone,+ "auth": blockedStandalone,+ "--yolo": blockedStandalone, // daemon selects approval mode on the wire+ "--print": blockedStandalone,+ "-h": blockedStandalone,+ "--help": blockedStandalone,+}++// muse approval mode. Muse selects approval enforcement on the wire, not from+// argv: `muse serve` has no --yolo, and the CLI documents --yolo as a TUI-only+// convenience. `allowAll` is the wire value that means "run without stopping to+// ask", which is the only posture a headless claimed task can hold. The+// container, the per-task worktree and the dropped capabilities are the+// isolation boundary — the same boundary every other backend relies on when it+// passes its own skip-approvals flag.+const museApprovalMode = "allowAll"++// museLauncherVersion identifies Multica's MSP client in the handshake. Muse+// records clientInfo for diagnostics and telemetry only; it carries no+// authority, so this is a stable identifier rather than the daemon version.+const museLauncherVersion = "0.1.0"++var museReaderDrainGrace = 2 * time.Second+var museHandshakeTimeout = 60 * time.Second++var (+ errMuseProcessExited = errors.New("muse process exited")+ errMuseTurnAborted = errors.New("muse turn aborted")+)++// museBackend runs Meta Muse Code as an MSP (Muse Session Protocol) host over+// `muse serve`, the way mcodeBackend runs MiniMax Code as an ACP host over+// `mcode acp`.+//+// MSP is JSON-RPC 2.0 over stdio, like ACP, but it is a different method+// vocabulary: a session opens with `session/start` (or `session/resume`) and a+// unit of work is submitted with `turn/start`, which answers immediately and+// completes through `turn/completed`. Assistant text, reasoning and tool calls+// arrive as transcript items (`item/started`, `item/delta`, `item/completed`),+// so the adapter's job is to fold those items into Multica's Message stream and+// to read the terminal turn outcome.+//+// Approval is a session property, not a launch flag. A fresh session is created+// with approvalMode=allowAll; a resumed session already carries the mode it was+// started with, so it is re-asserted with `session/setApprovalMode`. That is+// what makes `muse` behave like the other daemon-managed runtimes: nothing waits+// for a human.+type museBackend struct {+ cfg Config+}++// museSession caches the per-run facts the reader needs while folding items.+type museSession struct {+ mu sync.Mutex+ kinds map[string]string // itemId -> item kind+ streamed map[string]bool // itemId -> at least one text delta arrived+ final string // last agentMessage whose phase was finalAnswer+ last string // last agentMessage text, finalAnswer or not+}++func newMuseSession() *museSession {+ return &museSession{+ kinds: make(map[string]string),+ streamed: make(map[string]bool),+ }+}++func (s *museSession) setKind(itemID, kind string) {+ if itemID == "" {+ return+ }+ s.mu.Lock()+ defer s.mu.Unlock()+ s.kinds[itemID] = kind+}++func (s *museSession) kindOf(itemID string) string {+ s.mu.Lock()+ defer s.mu.Unlock()+ return s.kinds[itemID]+}++func (s *museSession) markStreamed(itemID string) {+ s.mu.Lock()+ defer s.mu.Unlock()+ s.streamed[itemID] = true+}++func (s *museSession) wasStreamed(itemID string) bool {+ s.mu.Lock()+ defer s.mu.Unlock()+ return s.streamed[itemID]+}++func (s *museSession) observeMessage(text, phase string) {+ if strings.TrimSpace(text) == "" {+ return+ }+ s.mu.Lock()+ defer s.mu.Unlock()+ s.last = text+ if phase == "finalAnswer" {+ s.final = text+ }+}++// output is the user-facing result: Muse's own final-answer marking wins, and a+// run that never emitted one falls back to its last assistant message rather+// than reporting an empty success.+func (s *museSession) output() string {+ s.mu.Lock()+ defer s.mu.Unlock()+ if s.final != "" {+ return s.final+ }+ return s.last+}++type museMessageStream struct {+ ch chan Message+ mu sync.Mutex+ closed bool+}++func newMuseMessageStream(size int) *museMessageStream {+ return &museMessageStream{ch: make(chan Message, size)}+}++func (s *museMessageStream) send(message Message) {+ s.mu.Lock()+ defer s.mu.Unlock()+ if s.closed {+ return+ }+ trySend(s.ch, message)+}++func (s *museMessageStream) close() {+ s.mu.Lock()+ defer s.mu.Unlock()+ if s.closed {+ return+ }+ s.closed = true+ close(s.ch)+}++// museRPCError carries the MSP error object so callers can branch on the+// machine-readable kind instead of matching prose.+type museRPCError struct {+ Code int `json:"code"`+ Message string `json:"message"`+ Data json.RawMessage `json:"data"`+}++func (e *museRPCError) Error() string {+ if e.Message != "" {+ return "muse: " + e.Message+ }+ return fmt.Sprintf("muse: json-rpc error %d", e.Code)+}++// museErrorKind reads the optional structured `data.kind` MSP attaches to an+// error. It is the only stable branch key: message text is provider prose.+func museErrorKind(err error) string {+ var rpcErr *museRPCError+ if !errors.As(err, &rpcErr) || len(rpcErr.Data) == 0 {+ return ""+ }+ var payload struct {+ Kind string `json:"kind"`+ }+ if json.Unmarshal(rpcErr.Data, &payload) != nil {+ return ""+ }+ return payload.Kind+}++type musePendingCall struct {+ ch chan museCallResult+}++type museCallResult struct {+ result json.RawMessage+ err error+}++// museClient is the MSP side of the stdio pipe: it writes JSON-RPC requests and+// correlates responses, and hands every notification and server-initiated+// request to the caller's callbacks.+type museClient struct {+ stdin io.WriteCloser+ writeMu sync.Mutex++ mu sync.Mutex+ pending map[string]*musePendingCall++ onNotification func(method string, params json.RawMessage)+ onRequest func(id json.RawMessage, method string, params json.RawMessage)+}++func newMuseClient(stdin io.WriteCloser) *museClient {+ return &museClient{+ stdin: stdin,+ pending: make(map[string]*musePendingCall),+ }+}++func (c *museClient) writeLine(payload any) error {+ raw, err := json.Marshal(payload)+ if err != nil {+ return err+ }+ c.writeMu.Lock()+ defer c.writeMu.Unlock()+ if _, err := c.stdin.Write(append(raw, '\n')); err != nil {+ return err+ }+ return nil+}++// request sends one MSP command and waits for its response. The id is a UUIDv7+// because MSP command ids and JSON-RPC ids share a time-ordered vocabulary in+// the reference client, and a strictly increasing id keeps a late response from+// a killed run from colliding with a live one.+func (c *museClient) request(ctx context.Context, method string, params any) (json.RawMessage, error) {+ id := museUUIDv7()+ call := &musePendingCall{ch: make(chan museCallResult, 1)}++ c.mu.Lock()+ c.pending[id] = call+ c.mu.Unlock()++ defer func() {+ c.mu.Lock()+ delete(c.pending, id)+ c.mu.Unlock()+ }()++ payload := map[string]any{+ "jsonrpc": "2.0",+ "id": id,+ "method": method,+ }+ if params != nil {+ payload["params"] = params+ }+ if err := c.writeLine(payload); err != nil {+ return nil, err+ }++ select {+ case res := <-call.ch:+ return res.result, res.err+ case <-ctx.Done():+ return nil, ctx.Err()+ }+}++func (c *museClient) notify(method string, params any) error {+ payload := map[string]any{"jsonrpc": "2.0", "method": method}+ if params != nil {+ payload["params"] = params+ }+ return c.writeLine(payload)+}++func (c *museClient) respond(id json.RawMessage, result any) error {+ return c.writeLine(map[string]any{+ "jsonrpc": "2.0",+ "id": id,+ "result": result,+ })+}++// handleLine parses one newline-delimited frame. It never returns an error:+// a frame it cannot parse is dropped, because the reader's only other job is to+// keep the pipe drained and a single malformed line must not fail the run.+func (c *museClient) handleLine(line string) {+ var envelope struct {+ ID json.RawMessage `json:"id"`+ Method string `json:"method"`+ Params json.RawMessage `json:"params"`+ Result json.RawMessage `json:"result"`+ Error *museRPCError `json:"error"`+ }+ if err := json.Unmarshal([]byte(line), &envelope); err != nil {+ return+ }++ // Server-initiated request: method and id together.+ if envelope.Method != "" {+ if len(envelope.ID) > 0 && string(envelope.ID) != "null" {+ if c.onRequest != nil {+ c.onRequest(envelope.ID, envelope.Method, envelope.Params)+ }+ return+ }+ if c.onNotification != nil {+ c.onNotification(envelope.Method, envelope.Params)+ }+ return+ }++ id := museDecodeID(envelope.ID)+ if id == "" {+ return+ }+ c.mu.Lock()+ call := c.pending[id]+ c.mu.Unlock()+ if call == nil {+ return+ }+ if envelope.Error != nil {+ select {+ case call.ch <- museCallResult{err: envelope.Error}:+ default:+ }+ return+ }+ select {+ case call.ch <- museCallResult{result: envelope.Result}:+ default:+ }+}++// closeAllPending releases every waiter when the transport ends, so a hung+// request surfaces a transport failure instead of blocking until the watchdog.+func (c *museClient) closeAllPending(err error) {+ c.mu.Lock()+ pending := c.pending+ c.pending = make(map[string]*musePendingCall)+ c.mu.Unlock()++ for _, call := range pending {+ select {+ case call.ch <- museCallResult{err: err}:+ default:+ }+ }+}++// museDecodeID normalises a JSON-RPC id to the map key the client used. MSP+// echoes the client's string id; numeric ids are accepted defensively so a+// server that renumbers cannot wedge the run.+func museDecodeID(raw json.RawMessage) string {+ if len(raw) == 0 {+ return ""+ }+ text := strings.TrimSpace(string(raw))+ if text == "" || text == "null" {+ return ""+ }+ if unquoted, err := strconv.Unquote(text); err == nil {+ return unquoted+ }+ return text+}++// museUUIDv7 returns a time-ordered UUIDv7. MSP requires commandId to be a+// UUIDv7: it derives a fresh turn's turnId from the submitting commandId and+// rejects anything else with invalidParams, so a v4 here would fail every run.+func museUUIDv7() string {+ var b [16]byte+ if _, err := rand.Read(b[:]); err != nil {+ // crypto/rand failure is unrecoverable for identity generation; fall+ // back to the clock so the run still has a monotonic, well-formed id.+ ms := uint64(time.Now().UnixNano())+ for i := 0; i < 8; i++ {+ b[i] = byte(ms >> (8 * i))+ }+ }+ ms := uint64(time.Now().UnixMilli())+ b[0] = byte(ms >> 40)+ b[1] = byte(ms >> 32)+ b[2] = byte(ms >> 24)+ b[3] = byte(ms >> 16)+ b[4] = byte(ms >> 8)+ b[5] = byte(ms)+ b[6] = (b[6] & 0x0f) | 0x70+ b[8] = (b[8] & 0x3f) | 0x80++ var out [36]byte+ hex.Encode(out[0:8], b[0:4])+ out[8] = '-'+ hex.Encode(out[9:13], b[4:6])+ out[13] = '-'+ hex.Encode(out[14:18], b[6:8])+ out[18] = '-'+ hex.Encode(out[19:23], b[8:10])+ out[23] = '-'+ hex.Encode(out[24:36], b[10:16])+ return string(out[:])+}++func (b *museBackend) Execute(ctx context.Context, prompt string, opts ExecOptions) (*Session, error) {+ execPath := b.cfg.ExecutablePath+ if execPath == "" {+ execPath = "muse"+ }+ if _, err := exec.LookPath(execPath); err != nil {+ return nil, fmt.Errorf("muse executable not found at %q: %w", execPath, err)+ }++ runCtx, cancel := runContext(ctx, opts.Timeout)+ // --disable-sandbox and --trust-workspace mirror what --yolo enables for a+ // terminal run: the daemon owns the worktree and must let the agent use it,+ // and the Multica brief lives in the workdir as AGENTS.md, which Muse only+ // reads for a trusted workspace. Approval stays on the wire+ // (session/start approvalMode) instead of argv. --disable-request-user-input+ // withholds the clarify tool, because a claimed task has no surface to+ // answer a question on.+ args := []string{"serve", "--disable-sandbox", "--trust-workspace", "--disable-request-user-input"}+ args = append(args, filterCustomArgs(opts.ExtraArgs, museBlockedArgs, b.cfg.Logger)...)+ args = append(args, filterCustomArgs(opts.CustomArgs, museBlockedArgs, b.cfg.Logger)...)++ cmd := b.cfg.commandAt(execPath).exec(runCtx, args...)+ hideAgentWindow(cmd)+ cmd.Cancel = func() error {+ if cmd.Process != nil {+ signalProcessGroup(cmd, syscall.SIGKILL)+ }+ return nil+ }+ cmd.WaitDelay = museReaderDrainGrace+ b.cfg.logAgentCommand(cmd, newAgentCommandLogArgs(args, trustAgentCommandPositional(0, "serve")))+ if opts.Cwd != "" {+ cmd.Dir = opts.Cwd+ }+ cmd.Env = buildEnv(b.cfg.Env)++ stdout, err := cmd.StdoutPipe()+ if err != nil {+ cancel()+ return nil, fmt.Errorf("muse stdout pipe: %w", err)+ }+ stdin, err := cmd.StdinPipe()+ if err != nil {+ cancel()+ return nil, fmt.Errorf("muse stdin pipe: %w", err)+ }+ stderr, err := cmd.StderrPipe()+ if err != nil {+ cancel()+ return nil, fmt.Errorf("muse stderr pipe: %w", err)+ }+ if err := startOwnedProcessTree(cmd, b.cfg.Logger); err != nil {+ cancel()+ return nil, fmt.Errorf("start muse: %w", err)+ }++ stderrDone := make(chan struct{})+ go func() {+ defer close(stderrDone)+ _, _ = io.Copy(newLogWriter(b.cfg.Logger, "[muse:stderr] "), stderr)+ }()++ b.cfg.Logger.Info("muse serve started", "pid", cmd.Process.Pid, "cwd", opts.Cwd)++ msgStream := newMuseMessageStream(256)+ resCh := make(chan Result, 1)+ state := newMuseSession()++ var (+ mu sync.Mutex+ turnDone = make(chan museTurnOutcome, 1)+ sessionID string+ usage map[string]TokenUsage+ outputCache string+ terminalOutcome museTurnOutcome+ terminalObserved atomic.Bool+ )++ client := newMuseClient(stdin)+ client.onNotification = func(method string, params json.RawMessage) {+ switch method {+ case "item/started":+ museHandleItemStarted(params, state, msgStream)+ case "item/delta":+ museHandleItemDelta(params, state, msgStream)+ case "item/completed":+ museHandleItemCompleted(params, state, msgStream)+ case "session/tokenUsage":+ if tokens, model := museTokenUsage(params); tokens.reported() {+ mu.Lock()+ usage = map[string]TokenUsage{model: tokens}+ mu.Unlock()+ }+ case "turn/completed":+ outcome := museTurnOutcome{terminal: "failed"}+ var payload struct {+ Terminal string `json:"terminal"`+ Reason string `json:"reason"`+ Error *struct {+ Kind string `json:"kind"`+ Message string `json:"message"`+ } `json:"error"`+ }+ if json.Unmarshal(params, &payload) == nil {+ outcome.terminal = payload.Terminal+ outcome.reason = payload.Reason+ if payload.Error != nil {+ outcome.errKind = payload.Error.Kind+ outcome.errMessage = payload.Error.Message+ }+ }+ mu.Lock()+ terminalOutcome = outcome+ mu.Unlock()+ terminalObserved.Store(true)+ select {+ case turnDone <- outcome:+ default:+ }+ case "session/closed":+ select {+ case turnDone <- museTurnOutcome{terminal: "failed", errMessage: "muse closed the session before the turn completed"}:+ default:+ }+ }+ }+ // Approval is already allowAll, so a request here is an unexpected gate and+ // not something to leave hanging: the MSP contract requires every+ // server-initiated request to be answered, and an unanswered one stalls the+ // turn. Answer with the presentation receipt and let the turn decide.+ client.onRequest = func(id json.RawMessage, method string, _ json.RawMessage) {+ b.cfg.Logger.Warn("muse server request", "method", method)+ _ = client.respond(id, map[string]any{})+ }++ readerDone := make(chan struct{})+ go func() {+ defer close(readerDone)+ scanner := newAgentStreamScanner(stdout)+ for scanner.Scan() {+ line := strings.TrimSpace(scanner.Text())+ if line != "" {+ client.handleLine(line)+ }+ }+ client.closeAllPending(errMuseProcessExited)+ }()+ cleanup := sync.OnceFunc(func() {+ _ = stdin.Close()+ cancel()+ drained := make(chan struct{})+ go func() {+ <-readerDone+ <-stderrDone+ close(drained)+ }()+ timer := time.NewTimer(museReaderDrainGrace)+ defer timer.Stop()+ select {+ case <-drained:+ case <-timer.C:+ // A detached descendant can retain either pipe after Muse exits.+ // Close our readers before Wait so EOF cannot hold up the result.+ _ = stdout.Close()+ _ = stderr.Close()+ <-drained+ }+ _ = cmd.Wait()+ releaseProcessGroup(cmd)+ })++ go func() {+ defer msgStream.close()+ defer close(resCh)+ defer cleanup()++ startTime := time.Now()+ fail := func(status, message string) {+ cleanup()+ resCh <- Result{+ Status: status,+ Error: message,+ DurationMs: time.Since(startTime).Milliseconds(),+ SessionID: sessionID,+ }+ }++ handshakeCtx, handshakeCancel := context.WithTimeout(runCtx, museHandshakeTimeout)+ defer handshakeCancel()++ if _, err := client.request(handshakeCtx, "initialize", map[string]any{+ "clientInfo": map[string]any{+ "name": "multica_agent",+ "version": museLauncherVersion,+ },+ "capabilities": map[string]any{},+ }); err != nil {+ status, message := museRequestFailure(runCtx, opts.Timeout, "initialize", err)+ fail(status, message)+ return+ }+ if err := client.notify("initialized", nil); err != nil {+ fail("failed", "muse initialize handshake failed: "+err.Error())+ return+ }++ cwd := opts.Cwd+ if cwd == "" {+ cwd = "."+ }++ if opts.ResumeSessionID != "" {+ result, resumeErr := client.request(runCtx, "session/resume", map[string]any{+ "commandId": museUUIDv7(),+ "sessionId": opts.ResumeSessionID,+ "history": "inline",+ })+ if resumeErr != nil {+ // A resume the host no longer holds is permanent: only a fresh+ // session can continue, so report it as a rejection and let the+ // daemon retry. A transport failure is NOT that — the session+ // may still be healthy and the platform retry should resume it.+ status, message := museRequestFailure(runCtx, opts.Timeout, "session/resume", resumeErr)+ cleanup()+ resCh <- Result{+ Status: status,+ Error: message,+ DurationMs: time.Since(startTime).Milliseconds(),+ ResumeRejected: museSessionGone(resumeErr),+ }+ return+ }+ sessionID = museSessionID(result)+ if sessionID == "" {+ sessionID = opts.ResumeSessionID+ }+ // Resume restores the mode the session was started with, which is+ // not necessarily ours, so re-assert it before the turn.+ if _, err := client.request(runCtx, "session/setApprovalMode", map[string]any{+ "commandId": museUUIDv7(),+ "sessionId": sessionID,+ "mode": museApprovalMode,+ }); err != nil {+ status, message := museRequestFailure(runCtx, opts.Timeout, "session/setApprovalMode", err)+ fail(status, message)+ return+ }+ if model := strings.TrimSpace(opts.Model); model != "" {+ if _, err := client.request(runCtx, "session/setModel", map[string]any{+ "commandId": museUUIDv7(),+ "sessionId": sessionID,+ "model": map[string]any{"modelId": model},+ }); err != nil {+ status, message := museRequestFailure(runCtx, opts.Timeout, "session/setModel", err)+ fail(status, message)+ return+ }+ }+ } else {+ params := map[string]any{+ "commandId": museUUIDv7(),+ "workspaceRoot": cwd,+ "approvalMode": museApprovalMode,+ }+ if model := strings.TrimSpace(opts.Model); model != "" {+ params["modelId"] = model+ }+ result, startErr := client.request(runCtx, "session/start", params)+ if startErr != nil {+ status, message := museRequestFailure(runCtx, opts.Timeout, "session/start", startErr)+ fail(status, message)+ return+ }+ sessionID = museSessionID(result)+ if sessionID == "" {+ fail("failed", "muse session/start returned no session id")+ return+ }+ // Publish the session id early so a cancelled run still hands the+ // daemon a usable resume pointer.+ if sid := sessionID; sid != "" {+ msgStream.send(Message{Type: MessageStatus, Status: "running", SessionID: sid})+ }+ }++ if opts.SystemPrompt != "" {+ b.cfg.Logger.Debug("muse ignoring ExecOptions.SystemPrompt; using cwd-scoped AGENTS.md", "cwd", opts.Cwd)+ }++ turnParams := map[string]any{+ "commandId": museUUIDv7(),+ "sessionId": sessionID,+ "input": []map[string]any{{"type": "text", "text": prompt}},+ "displayText": prompt,+ }+ if effort := strings.TrimSpace(opts.ThinkingLevel); effort != "" {+ turnParams["reasoningEffort"] = effort+ }+ if _, turnErr := client.request(runCtx, "turn/start", turnParams); turnErr != nil {+ status, message := museRequestFailure(runCtx, opts.Timeout, "turn/start", turnErr)+ fail(status, message)+ return+ }++ var outcome museTurnOutcome+ select {+ case outcome = <-turnDone:+ case <-readerDone:+ outcome = museTurnOutcome{terminal: "failed", errMessage: errMuseProcessExited.Error()}+ case <-runCtx.Done():+ outcome = museTurnOutcome{terminal: "timeout"}+ }++ duration := time.Since(startTime)+ cleanup()++ mu.Lock()+ collected := usage+ // A terminal event wins over a simultaneous EOF, session/closed, or+ // cancellation, including events already buffered before cleanup.+ if terminalObserved.Load() {+ outcome = terminalOutcome+ }+ mu.Unlock()+ outputCache = state.output()++ status := "completed"+ var message string+ switch outcome.terminal {+ case "completed":+ if outputCache == "" {+ status = "failed"+ message = "muse completed the turn without a final assistant message"+ }+ case "cancelled":+ status = "aborted"+ message = "execution cancelled"+ case "timeout":+ if runCtx.Err() == context.DeadlineExceeded {+ status = "timeout"+ message = fmt.Sprintf("muse timed out after %s", opts.Timeout)+ } else {+ status = "aborted"+ message = "execution cancelled"+ }+ case "failed":+ status = "failed"+ message = outcome.errorText()+ default:+ if outcome.terminal == "" {+ status = "failed"+ message = "muse ended the turn without a terminal state"+ } else {+ status = "failed"+ message = outcome.errorText()+ }+ }++ resCh <- Result{+ Status: status,+ Output: outputCache,+ Error: message,+ DurationMs: duration.Milliseconds(),+ SessionID: sessionID,+ Usage: collected,+ }+ }()++ return &Session{Messages: msgStream.ch, Result: resCh, TerminalObserved: terminalObserved.Load}, nil+}++type museTurnOutcome struct {+ terminal string+ reason string+ errKind string+ errMessage string+}++func (o museTurnOutcome) errorText() string {+ if o.errMessage != "" {+ if o.errKind != "" {+ return o.errKind + ": " + o.errMessage+ }+ return o.errMessage+ }+ if o.reason != "" {+ return o.reason+ }+ return "muse reported a failed turn"+}++// museSessionGone reports whether a session/resume failure means the session is+// permanently unavailable to this host. MSP answers an unknown or unloadable+// session with kind notFound; anything else (a transport drop, a timeout, an+// internal error) may still recover through the platform's own retry, so it+// must not be reported as a rejection.+func museSessionGone(err error) bool {+ switch museErrorKind(err) {+ case "notFound", "sessionNotFound", "unknownSession", "sessionGone":+ return true+ }+ return false+}++func museRequestFailure(ctx context.Context, timeout time.Duration, operation string, err error) (string, string) {+ if ctx.Err() == context.DeadlineExceeded {+ return "timeout", fmt.Sprintf("muse timed out during %s after %s", operation, timeout)+ }+ if ctx.Err() == context.Canceled {+ return "aborted", "execution cancelled"+ }+ if errors.Is(err, errMuseProcessExited) || errors.Is(err, io.ErrClosedPipe) || errors.Is(err, syscall.EPIPE) {+ return "failed", fmt.Sprintf("muse exited before answering %s", operation)+ }+ return "failed", fmt.Sprintf("muse %s failed: %v", operation, err)+}++func museSessionID(result json.RawMessage) string {+ var payload struct {+ Session struct {+ SessionID string `json:"sessionId"`+ } `json:"session"`+ }+ if json.Unmarshal(result, &payload) != nil {+ return ""+ }+ return payload.Session.SessionID+}++type museItem struct {+ ItemID string `json:"itemId"`+ Kind string `json:"kind"`+ Status string `json:"status"`+ Text string `json:"text"`+ Tool string `json:"tool"`+ ToolCallID string `json:"toolCallId"`+ CallID string `json:"callId"`+ Args json.RawMessage `json:"args"`+ VisibleOut string `json:"visibleOutput"`+ Failure string `json:"failureReason"`+ MessagePhase string `json:"messagePhase"`+ DisplayLabel string `json:"displayLabel"`+}++func museHandleItemStarted(params json.RawMessage, state *museSession, stream *museMessageStream) {+ var payload struct {+ Item museItem `json:"item"`+ }+ if json.Unmarshal(params, &payload) != nil {+ return+ }+ item := payload.Item+ state.setKind(item.ItemID, item.Kind)++ switch item.Kind {+ case "agentMessage":+ // Text arrives as deltas; nothing to emit until the first one.+ case "reasoning":+ stream.send(Message{Type: MessageThinking})+ case "toolCall":+ stream.send(Message{+ Type: MessageToolUse,+ Tool: museToolName(item),+ CallID: museCallID(item),+ Input: museToolInput(item.Args),+ })+ }+}++func museHandleItemDelta(params json.RawMessage, state *museSession, stream *museMessageStream) {+ var payload struct {+ ItemID string `json:"itemId"`+ Field string `json:"field"`+ Delta string `json:"delta"`+ }+ if json.Unmarshal(params, &payload) != nil || payload.Delta == "" {+ return+ }+ field := payload.Field+ if field == "" {+ field = "text"+ }+ switch state.kindOf(payload.ItemID) {+ case "agentMessage":+ if field != "text" {+ return+ }+ state.markStreamed(payload.ItemID)+ stream.send(Message{Type: MessageText, Content: payload.Delta})+ case "reasoning":+ if field != "text" && !strings.HasPrefix(field, "summary") {+ return+ }+ stream.send(Message{Type: MessageThinking, Content: payload.Delta})+ }+}++func museHandleItemCompleted(params json.RawMessage, state *museSession, stream *museMessageStream) {+ var payload struct {+ Item museItem `json:"item"`+ }+ if json.Unmarshal(params, &payload) != nil {+ return+ }+ item := payload.Item++ switch item.Kind {+ case "agentMessage":+ state.observeMessage(item.Text, item.MessagePhase)+ // A host that never streamed deltas still has the authoritative text on+ // the completed item; emitting it only when nothing streamed keeps the+ // transcript from showing the reply twice.+ if item.Text != "" && !state.wasStreamed(item.ItemID) {+ stream.send(Message{Type: MessageText, Content: item.Text})+ }+ case "toolCall":+ output := item.VisibleOut+ if output == "" {+ output = item.Failure+ }+ stream.send(Message{+ Type: MessageToolResult,+ Tool: museToolName(item),+ CallID: museCallID(item),+ Output: output,+ Status: item.Status,+ })+ }+}++func museToolName(item museItem) string {+ if item.Tool != "" {+ return item.Tool+ }+ if item.DisplayLabel != "" {+ return item.DisplayLabel+ }+ return "tool"+}++func museCallID(item museItem) string {+ if item.CallID != "" {+ return item.CallID+ }+ if item.ToolCallID != "" {+ return item.ToolCallID+ }+ return item.ItemID+}++// museToolInput decodes the model-authored argument JSON. Muse documents the+// field as the verbatim argument string, so the string is unwrapped first; an+// already-decoded object is accepted too, because both spellings reach a client+// that did not author the record. A value that is not a JSON object is surfaced+// under a single key rather than dropped, so the board can still show what was+// used.+func museToolInput(raw json.RawMessage) map[string]any {+ text := strings.TrimSpace(string(raw))+ if text == "" || text == "null" {+ return nil+ }+ var input map[string]any+ if json.Unmarshal(raw, &input) == nil {+ return input+ }+ var verbatim string+ if json.Unmarshal(raw, &verbatim) == nil {+ if strings.TrimSpace(verbatim) == "" {+ return nil+ }+ if json.Unmarshal([]byte(verbatim), &input) == nil {+ return input+ }+ return map[string]any{"arguments": verbatim}+ }+ return map[string]any{"arguments": text}+}++// museTokenUsage maps MSP's per-turn counters onto Multica's TokenUsage. The+// four Multica fields are mutually exclusive: MSP reports promptTokens including+// the cached prefix, so cache reads are subtracted out of the input total rather+// than added to it.+func (u TokenUsage) reported() bool {+ return u.InputTokens != 0 || u.OutputTokens != 0 || u.CacheReadTokens != 0 || u.CacheWriteTokens != 0+}++func museTokenUsage(params json.RawMessage) (TokenUsage, string) {+ var payload struct {+ ModelID string `json:"modelId"`+ Usage struct {+ InputTokens int64 `json:"inputTokens"`+ OutputTokens int64 `json:"outputTokens"`+ CacheReadTokens int64 `json:"cacheReadTokens"`+ CacheWriteTokens int64 `json:"cacheWriteTokens"`+ } `json:"usage"`+ }+ if json.Unmarshal(params, &payload) != nil {+ return TokenUsage{}, ""+ }+ usage := TokenUsage{+ InputTokens: payload.Usage.InputTokens - payload.Usage.CacheReadTokens - payload.Usage.CacheWriteTokens,+ OutputTokens: payload.Usage.OutputTokens,+ CacheReadTokens: payload.Usage.CacheReadTokens,+ CacheWriteTokens: payload.Usage.CacheWriteTokens,+ }+ if usage.InputTokens < 0 {+ usage.InputTokens = 0+ }+ model := payload.ModelID+ if model == "" {+ model = "unknown"+ }+ return usage, model+}diff --git a/server/pkg/agent/muse_integration_test.go b/server/pkg/agent/muse_integration_test.gonew file mode 100644index 0000000000..b6d071d692--- /dev/null+++ b/server/pkg/agent/muse_integration_test.go@@ -0,0 +1,97 @@+//go:build agentintegration++package agent++import (+ "context"+ "log/slog"+ "os"+ "os/exec"+ "path/filepath"+ "strings"+ "testing"+ "time"+)++// TestMuseRealMSPSmoke drives an authenticated Meta Muse Code MSP turn+// end-to-end. It proves the three things a fake cannot: the handshake shape+// Muse actually emits, that approvalMode=allowAll lets a tool run without a+// human, and that the workspace AGENTS.md reaches the model.+func TestMuseRealMSPSmoke(t *testing.T) {+ requireRealAgentSmoke(t)+ if testing.Short() {+ t.Skip("skipping real-binary smoke test in -short mode")+ }++ path, err := exec.LookPath("muse")+ if err != nil {+ t.Skip("muse not on PATH; skipping real-binary smoke test")+ }+ if version, err := exec.Command(path, "--version").CombinedOutput(); err == nil {+ t.Logf("muse --version: %s", strings.TrimSpace(string(version)))+ } else {+ t.Logf("muse version unavailable: %v (%s)", err, strings.TrimSpace(string(version)))+ }++ workDir := t.TempDir()+ if err := os.WriteFile(filepath.Join(workDir, "AGENTS.md"), []byte(`# Multica smoke context++For every response in this workspace, include the exact marker AGENTS-MUSE-OK.+`), 0o644); err != nil {+ t.Fatalf("write AGENTS.md: %v", err)+ }+ if err := os.WriteFile(filepath.Join(workDir, "tool-canary.txt"), []byte("TOOL-MUSE-OK\n"), 0o644); err != nil {+ t.Fatalf("write tool canary: %v", err)+ }++ backend, err := New("muse", Config{ExecutablePath: path, Logger: slog.Default()})+ if err != nil {+ t.Fatalf("new muse backend: %v", err)+ }++ ctx, cancel := context.WithTimeout(context.Background(), 240*time.Second)+ defer cancel()++ session, err := backend.Execute(ctx,+ "Read tool-canary.txt with a shell or file tool, then reply with its contents and the workspace marker.",+ ExecOptions{Cwd: workDir, Timeout: 210 * time.Second},+ )+ if err != nil {+ t.Fatalf("execute: %v", err)+ }++ var sawToolUse, sawToolResult bool+ for msg := range session.Messages {+ switch msg.Type {+ case MessageToolUse:+ sawToolUse = true+ case MessageToolResult:+ sawToolResult = true+ }+ }++ var result Result+ for res := range session.Result {+ result = res+ }+ t.Logf("status=%s session=%s duration=%dms error=%q output=%q", result.Status, result.SessionID, result.DurationMs, result.Error, result.Output)++ if result.Status != "completed" {+ t.Fatalf("status = %q, want completed (error %q)", result.Status, result.Error)+ }+ if result.SessionID == "" {+ t.Fatal("no session id returned; resume would be impossible")+ }+ if !strings.Contains(result.Output, "AGENTS-MUSE-OK") {+ t.Errorf("output did not carry the workspace marker: %q", result.Output)+ }+ if !strings.Contains(result.Output, "TOOL-MUSE-OK") {+ t.Errorf("output did not carry the tool canary; a skipped tool would mean approval or sandbox blocked the run: %q", result.Output)+ }+ if !sawToolUse || !sawToolResult {+ t.Errorf("tool events missing (use=%v result=%v); the item stream did not reach the board", sawToolUse, sawToolResult)+ }+ if usage, ok := result.Usage["muse-wonder-full-1.0"]; ok && usage.InputTokens == 0 {+ t.Errorf("usage reported a zero input count: %+v", usage)+ }+}diff --git a/server/pkg/agent/muse_lifecycle_test.go b/server/pkg/agent/muse_lifecycle_test.gonew file mode 100644index 0000000000..e0cbafbb60--- /dev/null+++ b/server/pkg/agent/muse_lifecycle_test.go@@ -0,0 +1,103 @@+package agent++import (+ "context"+ "os"+ "strings"+ "testing"+ "time"+)++func rewriteFakeMuseServe(t *testing.T, path, old, replacement string) {+ t.Helper()+ script, err := os.ReadFile(path)+ if err != nil {+ t.Fatal(err)+ }+ if !strings.Contains(string(script), old) {+ t.Fatalf("fake server does not contain %q", old)+ }+ if err := os.WriteFile(path, []byte(strings.Replace(string(script), old, replacement, 1)), 0o755); err != nil {+ t.Fatal(err)+ }+}++func TestMuseHostExitAfterTurnStart(t *testing.T) {+ t.Parallel()+ bin, _, _ := writeFakeMuseServe(t, false)+ rewriteFakeMuseServe(t, bin, " sleep 0.02", " exit 17")+ ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)+ defer cancel()+ session, err := newFakeMuseBackend(t, bin).Execute(ctx, "work", ExecOptions{Cwd: t.TempDir()})+ if err != nil {+ t.Fatal(err)+ }+ result := <-session.Result+ if result.Status != "failed" || !strings.Contains(result.Error, "exited") {+ t.Fatalf("unexpected host exit: status=%q error=%q", result.Status, result.Error)+ }+}++func TestMuseTerminalSurvivesSessionCloseAndEOF(t *testing.T) {+ t.Parallel()+ bin, _, _ := writeFakeMuseServe(t, false)+ rewriteFakeMuseServe(t, bin, `"durationMs":12}}\n'`, `"durationMs":12}}\n'+ printf '{"jsonrpc":"2.0","method":"session/closed","params":{}}\n'+ exit 0+ #`)+ ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)+ defer cancel()+ session, err := newFakeMuseBackend(t, bin).Execute(ctx, "work", ExecOptions{Cwd: t.TempDir()})+ if err != nil {+ t.Fatal(err)+ }+ result := <-session.Result+ if result.Status != "completed" || result.Output != "Muse finished" {+ t.Fatalf("terminal result was lost: %+v", result)+ }+ if session.TerminalObserved == nil || !session.TerminalObserved() {+ t.Fatal("the daemon must observe the terminal before cleanup")+ }+}++func TestMuseResumeAppliesSelectedModel(t *testing.T) {+ t.Parallel()+ for _, reject := range []bool{false, true} {+ t.Run(map[bool]string{false: "selected", true: "rejected"}[reject], func(t *testing.T) {+ t.Parallel()+ bin, requestsPath, _ := writeFakeMuseServe(t, false)+ if reject {+ rewriteFakeMuseServe(t, bin, `"result":{"sessionId":"`+fakeMuseSessionID+`","modelId":"new-model"}`, `"error":{"code":-32602,"message":"model unavailable"}`)+ }+ ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)+ defer cancel()+ session, err := newFakeMuseBackend(t, bin).Execute(ctx, "continue", ExecOptions{+ Cwd: t.TempDir(), ResumeSessionID: fakeMuseSessionID, Model: "new-model",+ })+ if err != nil {+ t.Fatal(err)+ }+ result := <-session.Result+ requests := readMuseRequests(t, requestsPath)+ setModel := museRequestByMethod(requests, "session/setModel")+ if setModel == nil {+ t.Fatal("resumed session never received session/setModel")+ }+ params := setModel["params"].(map[string]any)+ selection, _ := params["model"].(map[string]any)+ if selection["modelId"] != "new-model" || params["sessionId"] != fakeMuseSessionID {+ t.Fatalf("setModel params = %v", params)+ }+ if reject {+ if result.Status != "failed" || !strings.Contains(result.Error, "model unavailable") || result.SessionID != fakeMuseSessionID {+ t.Fatalf("model rejection lost status or session: %+v", result)+ }+ if museRequestByMethod(requests, "turn/start") != nil {+ t.Fatal("turn started after model selection failed")+ }+ } else if result.Status != "completed" {+ t.Fatalf("resume failed: %+v", result)+ }+ })+ }+}diff --git a/server/pkg/agent/muse_models.go b/server/pkg/agent/muse_models.gonew file mode 100644index 0000000000..b20ab29644--- /dev/null+++ b/server/pkg/agent/muse_models.go@@ -0,0 +1,171 @@+package agent++import (+ "bufio"+ "context"+ "encoding/json"+ "io"+ "os/exec"+ "strings"+ "syscall"+ "time"+)++// museDiscoveryTimeout bounds the whole catalog read. `muse serve` answers+// model/list immediately after the handshake, so this ceiling only ever covers+// a wedged or unauthenticated host.+var museDiscoveryTimeout = 20 * time.Second++// discoverMuseModels reads the catalog `muse serve` will accept in+// `session/setModel`. It is a short-lived MSP connection: initialize, then the+// model/list query, then a reap. The catalog is a query and not a command — it+// creates no session and writes no durable record — so no session/start is+// needed.+//+// Every failure degrades to an empty catalog with Fallback set, which is what+// keeps the picker's manual-entry field usable on a host that is logged out.+func discoverMuseModels(ctx context.Context, runtimeCmd Command) (Catalog, error) {+ if runtimeCmd.Path == "" {+ runtimeCmd.Path = "muse"+ }+ if _, err := exec.LookPath(runtimeCmd.Path); err != nil {+ return Catalog{Models: []Model{}, Fallback: true}, nil+ }++ runCtx, cancel := context.WithTimeout(ctx, museDiscoveryTimeout)+ defer cancel()++ cmd := runtimeCmd.exec(runCtx, "serve", "--no-session-log")+ hideAgentWindow(cmd)+ cmd.Env = buildEnv(nil)+ stdin, err := cmd.StdinPipe()+ if err != nil {+ return Catalog{Models: []Model{}, Fallback: true}, nil+ }+ stdout, err := cmd.StdoutPipe()+ if err != nil {+ _ = stdin.Close()+ return Catalog{Models: []Model{}, Fallback: true}, nil+ }+ cmd.Stderr = io.Discard+ if err := startOwnedProcessTree(cmd, runtimeCmd.logger); err != nil {+ return Catalog{Models: []Model{}, Fallback: true}, nil+ }+ // This probe runs on a discovery schedule, so a leaked host would+ // accumulate. Always reap the process group.+ defer func() {+ _ = stdin.Close()+ signalProcessGroup(cmd, syscall.SIGKILL)+ _, _ = cmd.Process.Wait()+ releaseProcessGroup(cmd)+ }()++ scanner := bufio.NewScanner(stdout)+ scanner.Buffer(make([]byte, 0, 1024*1024), 4*1024*1024)++ write := func(payload map[string]any) error {+ data, err := json.Marshal(payload)+ if err != nil {+ return err+ }+ _, err = stdin.Write(append(data, '\n'))+ return err+ }++ call := func(method string, params map[string]any) (json.RawMessage, error) {+ id := museUUIDv7()+ payload := map[string]any{"jsonrpc": "2.0", "id": id, "method": method}+ if params != nil {+ payload["params"] = params+ }+ if err := write(payload); err != nil {+ return nil, err+ }+ for scanner.Scan() {+ line := strings.TrimSpace(scanner.Text())+ if line == "" {+ continue+ }+ var env struct {+ ID json.RawMessage `json:"id"`+ Method string `json:"method"`+ Result json.RawMessage `json:"result"`+ Error *museRPCError `json:"error"`+ }+ if err := json.Unmarshal([]byte(line), &env); err != nil {+ continue+ }+ // Server-initiated requests still need an answer, even here.+ if env.Method != "" && len(env.ID) > 0 && string(env.ID) != "null" {+ _ = write(map[string]any{"jsonrpc": "2.0", "id": env.ID, "result": map[string]any{}})+ continue+ }+ if museDecodeID(env.ID) != id {+ continue+ }+ if env.Error != nil {+ return nil, env.Error+ }+ return env.Result, nil+ }+ if err := scanner.Err(); err != nil {+ return nil, err+ }+ return nil, errMuseProcessExited+ }++ if _, err := call("initialize", map[string]any{+ "clientInfo": map[string]any{"name": "multica_model_discovery", "version": museLauncherVersion},+ "capabilities": map[string]any{},+ }); err != nil {+ return Catalog{Models: []Model{}, Fallback: true}, nil+ }+ if err := write(map[string]any{"jsonrpc": "2.0", "method": "initialized", "params": map[string]any{}}); err != nil {+ return Catalog{Models: []Model{}, Fallback: true}, nil+ }++ result, err := call("model/list", map[string]any{})+ if err != nil {+ return Catalog{Models: []Model{}, Fallback: true}, nil+ }++ var payload struct {+ ProviderID string `json:"providerId"`+ Source string `json:"source"`+ Models []struct {+ ModelID string `json:"modelId"`+ DisplayName string `json:"displayLabel"`+ Description *string `json:"description"`+ IsDefault bool `json:"isDefault"`+ ProviderID string `json:"providerId"`+ } `json:"models"`+ }+ if err := json.Unmarshal(result, &payload); err != nil {+ return Catalog{Models: []Model{}, Fallback: true}, nil+ }++ models := make([]Model, 0, len(payload.Models))+ for _, entry := range payload.Models {+ if strings.TrimSpace(entry.ModelID) == "" {+ continue+ }+ label := entry.DisplayName+ if label == "" {+ label = entry.ModelID+ }+ provider := entry.ProviderID+ if provider == "" {+ provider = payload.ProviderID+ }+ models = append(models, Model{+ ID: entry.ModelID,+ Label: label,+ Provider: provider,+ Default: entry.IsDefault,+ })+ }+ if len(models) == 0 {+ return Catalog{Models: []Model{}, Fallback: true}, nil+ }+ return Catalog{Models: models}, nil+}diff --git a/server/pkg/agent/muse_test.go b/server/pkg/agent/muse_test.gonew file mode 100644index 0000000000..fc1877b495--- /dev/null+++ b/server/pkg/agent/muse_test.go@@ -0,0 +1,295 @@+package agent++import (+ "context"+ "encoding/json"+ "log/slog"+ "os"+ "path/filepath"+ "regexp"+ "strings"+ "testing"+ "time"+)++const fakeMuseSessionID = "01a14870-5a2f-7791-b847-2385a5d47a8c"++// writeFakeMuseServe writes a stand-in for `muse serve` that answers MSP on+// stdio. It records every request line and its argv so a test can assert on the+// protocol conversation instead of on timing.+func writeFakeMuseServe(t *testing.T, resumeError bool) (bin, requests, args string) {+ t.Helper()+ dir := t.TempDir()+ bin = filepath.Join(dir, "muse")+ requests = filepath.Join(dir, "requests.jsonl")+ args = filepath.Join(dir, "args.txt")++ resumeBranch := ` *'"method":"session/resume"'*)+ printf '{"jsonrpc":"2.0","id":"%s","result":{"session":{"sessionId":"SESSION_ID"}}}\n' "$id"+ ;;`+ if resumeError {+ resumeBranch = ` *'"method":"session/resume"'*)+ printf '{"jsonrpc":"2.0","id":"%s","error":{"code":-32001,"message":"session not found","data":{"kind":"notFound"}}}\n' "$id"+ ;;`+ }++ script := `#!/bin/sh+printf '%s\n' "$*" > ARGS_PATH+while IFS= read -r line; do+ printf '%s\n' "$line" >> REQUESTS_PATH+ id=$(printf '%s' "$line" | sed -n 's/.*"id":"\([^"]*\)".*/\1/p')+ case "$line" in+ *'"method":"initialize"'*)+ printf '{"jsonrpc":"2.0","id":"%s","result":{"serverInfo":{"name":"muse","version":"1.4.10"},"schema":{"version":1}}}\n' "$id"+ ;;+RESUME_BRANCH+ *'"method":"session/start"'*)+ printf '{"jsonrpc":"2.0","id":"%s","result":{"session":{"sessionId":"SESSION_ID"},"viewCursor":"v1"}}\n' "$id"+ ;;+ *'"method":"session/setApprovalMode"'*)+ printf '{"jsonrpc":"2.0","id":"%s","result":{"sessionId":"SESSION_ID","mode":"allowAll"}}\n' "$id"+ ;;+ *'"method":"session/setModel"'*)+ printf '{"jsonrpc":"2.0","id":"%s","result":{"sessionId":"SESSION_ID","modelId":"new-model"}}\n' "$id"+ ;;+ *'"method":"turn/start"'*)+ printf '{"jsonrpc":"2.0","id":"%s","result":{"startedNewTurn":true,"disposition":"started"}}\n' "$id"+ sleep 0.02+ printf '{"jsonrpc":"2.0","method":"turn/started","params":{"sessionId":"SESSION_ID","turnId":"turn-1"}}\n'+ printf '{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"SESSION_ID","item":{"itemId":"tool-1","kind":"toolCall","status":"inProgress","tool":"shell","callId":"call-1","args":%s}}}\n' '{}'+ printf '{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"SESSION_ID","item":{"itemId":"tool-1","kind":"toolCall","status":"completed","tool":"shell","callId":"call-1","visibleOutput":"a.txt"}}}\n'+ printf '{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"SESSION_ID","item":{"itemId":"msg-1","kind":"agentMessage","status":"inProgress"}}}\n'+ printf '{"jsonrpc":"2.0","method":"item/delta","params":{"sessionId":"SESSION_ID","itemId":"msg-1","field":"text","delta":"Muse "}}\n'+ printf '{"jsonrpc":"2.0","method":"item/delta","params":{"sessionId":"SESSION_ID","itemId":"msg-1","field":"text","delta":"finished"}}\n'+ printf '{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"SESSION_ID","item":{"itemId":"msg-1","kind":"agentMessage","status":"completed","messagePhase":"finalAnswer","text":"Muse finished"}}}\n'+ printf '{"jsonrpc":"2.0","method":"session/tokenUsage","params":{"sessionId":"SESSION_ID","modelId":"muse-wonder-full-1.0","usage":{"inputTokens":120,"outputTokens":8,"cacheReadTokens":20,"cacheWriteTokens":0}}}\n'+ printf '{"jsonrpc":"2.0","method":"turn/completed","params":{"sessionId":"SESSION_ID","turnId":"turn-1","terminal":"completed","durationMs":12}}\n'+ ;;+ *)+ printf '{"jsonrpc":"2.0","id":"%s","error":{"code":-32601,"message":"method not found"}}\n' "$id"+ ;;+ esac+done+`++ script = strings.ReplaceAll(script, "ARGS_PATH", args)+ script = strings.ReplaceAll(script, "REQUESTS_PATH", requests)+ script = strings.ReplaceAll(script, "RESUME_BRANCH", resumeBranch)+ script = strings.ReplaceAll(script, "SESSION_ID", fakeMuseSessionID)++ if err := os.WriteFile(bin, []byte(script), 0o755); err != nil {+ t.Fatalf("write fake muse: %v", err)+ }+ return bin, requests, args+}++func readMuseRequests(t *testing.T, path string) []map[string]any {+ t.Helper()+ raw, err := os.ReadFile(path)+ if err != nil {+ t.Fatalf("read recorded requests: %v", err)+ }+ var out []map[string]any+ for _, line := range strings.Split(strings.TrimSpace(string(raw)), "\n") {+ if line == "" {+ continue+ }+ var entry map[string]any+ if err := json.Unmarshal([]byte(line), &entry); err != nil {+ t.Fatalf("recorded request is not JSON: %v", err)+ }+ out = append(out, entry)+ }+ return out+}++func museRequestByMethod(requests []map[string]any, method string) map[string]any {+ for _, entry := range requests {+ if entry["method"] == method {+ return entry+ }+ }+ return nil+}++func newFakeMuseBackend(t *testing.T, bin string) Backend {+ t.Helper()+ backend, err := New("muse", Config{+ ExecutablePath: bin,+ Logger: slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelError})),+ })+ if err != nil {+ t.Fatalf("New(muse): %v", err)+ }+ return backend+}++func TestMuseExecuteStreamsTurn(t *testing.T) {+ t.Parallel()+ bin, requestsPath, argsPath := writeFakeMuseServe(t, false)+ backend := newFakeMuseBackend(t, bin)++ session, err := backend.Execute(context.Background(), "do the thing", ExecOptions{+ Cwd: t.TempDir(),+ Model: "muse-wonder-full-1.0",+ })+ if err != nil {+ t.Fatalf("Execute: %v", err)+ }++ var text strings.Builder+ var toolUse, toolResult bool+ for msg := range session.Messages {+ switch msg.Type {+ case MessageText:+ text.WriteString(msg.Content)+ case MessageToolUse:+ toolUse = msg.Tool == "shell" && msg.CallID == "call-1"+ case MessageToolResult:+ toolResult = msg.Tool == "shell" && msg.CallID == "call-1" && msg.Output == "a.txt"+ }+ }++ var result Result+ for res := range session.Result {+ result = res+ }++ if result.Status != "completed" {+ t.Fatalf("status = %q, want completed (error %q)", result.Status, result.Error)+ }+ if result.Output != "Muse finished" {+ t.Fatalf("output = %q, want the final-answer text", result.Output)+ }+ if result.SessionID != fakeMuseSessionID {+ t.Fatalf("session id = %q", result.SessionID)+ }+ if got := text.String(); got != "Muse finished" {+ t.Fatalf("streamed text = %q, want the two deltas only", got)+ }+ if !toolUse {+ t.Fatal("tool-use message did not carry tool/callId")+ }+ if !toolResult {+ t.Fatal("tool-result message did not carry visibleOutput")+ }+ want := TokenUsage{InputTokens: 100, OutputTokens: 8, CacheReadTokens: 20}+ if got := result.Usage["muse-wonder-full-1.0"]; got != want {+ t.Fatalf("usage = %+v, want %+v (cache reads subtracted from input)", got, want)+ }++ argv, err := os.ReadFile(argsPath)+ if err != nil {+ t.Fatalf("read argv: %v", err)+ }+ if !strings.Contains(string(argv), "serve") {+ t.Fatalf("argv = %q, want the serve subcommand", string(argv))+ }+ if strings.Contains(string(argv), "--yolo") {+ t.Fatalf("argv = %q, must not pass --yolo; approval is selected on the wire", string(argv))+ }++ requests := readMuseRequests(t, requestsPath)+ start := museRequestByMethod(requests, "session/start")+ if start == nil {+ t.Fatal("no session/start recorded")+ }+ params, _ := start["params"].(map[string]any)+ if params["approvalMode"] != "allowAll" {+ t.Fatalf("approvalMode = %v, want allowAll", params["approvalMode"])+ }+ if params["modelId"] != "muse-wonder-full-1.0" {+ t.Fatalf("modelId = %v, want the agent's model", params["modelId"])+ }+ if params["workspaceRoot"] == "" {+ t.Fatal("session/start carried no workspaceRoot")+ }+ commandID, _ := params["commandId"].(string)+ if !regexp.MustCompile(`^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$`).MatchString(commandID) {+ t.Fatalf("commandId %q is not a UUIDv7", commandID)+ }++ turn := museRequestByMethod(requests, "turn/start")+ if turn == nil {+ t.Fatal("no turn/start recorded")+ }+ turnParams, _ := turn["params"].(map[string]any)+ if turnParams["sessionId"] != fakeMuseSessionID {+ t.Fatalf("turn/start sessionId = %v", turnParams["sessionId"])+ }+ parts, _ := turnParams["input"].([]any)+ if len(parts) != 1 {+ t.Fatalf("turn/start input = %v, want one text part", turnParams["input"])+ }+}++func TestMuseExecuteReportsResumeRejection(t *testing.T) {+ t.Parallel()+ bin, _, _ := writeFakeMuseServe(t, true)+ backend := newFakeMuseBackend(t, bin)++ session, err := backend.Execute(context.Background(), "continue", ExecOptions{+ Cwd: t.TempDir(),+ ResumeSessionID: "01a14870-0000-7000-8000-000000000000",+ })+ if err != nil {+ t.Fatalf("Execute: %v", err)+ }+ for range session.Messages {+ }+ var result Result+ for res := range session.Result {+ result = res+ }+ if result.Status != "failed" {+ t.Fatalf("status = %q, want failed", result.Status)+ }+ if !result.ResumeRejected {+ t.Fatal("a notFound resume must be reported as ResumeRejected so the daemon retries fresh")+ }+}++func TestMuseUUIDv7IsTimeOrdered(t *testing.T) {+ t.Parallel()+ first := museUUIDv7()+ time.Sleep(2 * time.Millisecond)+ second := museUUIDv7()++ pattern := regexp.MustCompile(`^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$`)+ if !pattern.MatchString(first) || !pattern.MatchString(second) {+ t.Fatalf("ids %q / %q are not UUIDv7", first, second)+ }+ if first >= second {+ t.Fatalf("UUIDv7 ids are not time-ordered: %q then %q", first, second)+ }+}++func TestMuseToolInputDecodesArguments(t *testing.T) {+ t.Parallel()+ decoded := museToolInput([]byte(`{"cmd":"ls","cwd":"/w"}`))+ if decoded["cmd"] != "ls" || decoded["cwd"] != "/w" {+ t.Fatalf("decoded = %v, want the model's argument object", decoded)+ }+ // Muse carries args verbatim as a string. A non-object payload must still+ // be visible on the board rather than silently dropped.+ fallback := museToolInput([]byte(`"ls -la"`))+ if fallback["arguments"] != "ls -la" {+ t.Fatalf("fallback = %v, want the raw payload under arguments", fallback)+ }+ if museToolInput(nil) != nil {+ t.Fatal("empty args must decode to nil, not an empty map")+ }+}++func TestMuseModelSelectionIsRuntimeApplied(t *testing.T) {+ t.Parallel()+ if !ModelSelectionSupported("muse") {+ t.Fatal("muse applies agent.model through session/start modelId")+ }+ if version := MinVersions["muse"]; version == "" {+ t.Fatal("muse needs a minimum CLI version")+ }+ if LaunchHeader("muse") == "" {+ t.Fatal("muse needs a launch header for the custom-args preview")+ }+}diff --git a/server/pkg/agent/thinking.go b/server/pkg/agent/thinking.goindex 6135edb896..253cade919 100644--- a/server/pkg/agent/thinking.go+++ b/server/pkg/agent/thinking.go@@ -915,6 +915,20 @@ var providerThinkingEnums = map[string]map[string]bool{"xhigh": true,"max": true,},+ // muse takes Meta Muse Code's closed MSP vocabulary, declared on the+ // `reasoningEffort` field of `turn/start`. The host re-validates the tier+ // against the session model before it samples, so this list is the+ // provider universe, not a per-model promise.+ "muse": {+ "none": true,+ "minimal": true,+ "low": true,+ "medium": true,+ "high": true,+ "xhigh": true,+ "max": true,+ "ultra": true,+ },// omp (Oh-My-Pi) dispatches to the pi backend (see BuiltinRuntimes), so it// inherits pi's fixed CLI vocabulary; discoverOmpModels narrows it to each// model's advertised efforts before execution. `auto` is deliberately absentdiff --git a/server/pkg/agent/version.go b/server/pkg/agent/version.goindex dbb18cbd65..89affd99df 100644--- a/server/pkg/agent/version.go+++ b/server/pkg/agent/version.go@@ -24,6 +24,7 @@ var MinVersions = map[string]string{"qwen": "0.20.0", // stream-json protocol captured and verified against Qwen Code 0.20.0"dim": "0.3.10", // cross-run session/load: per-process lock releases on graceful exit"mcode": "0.1.2", // ACP v1 session/new, prompt, MCP capability forwarding+ "muse": "1.4.10", // MSP stable surface: session/start, turn/start, item stream"zeroclaw": "0.8.0", // persistent ACP sessions and session/resume were added in 0.8.0// opencode: honors TMPDIR/TMP/TEMP from 1.1.54. Earlier builds ignore all// three when their embedded Bun runtime extracts a native module, writing