Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-5604: 支持 Reasonix runtime (#6370)
Multica Eveb98f760f1fab
diff --git a/CLI_AND_DAEMON.md b/CLI_AND_DAEMON.mdindex 685dfacf94..9d35af47d8 100644--- a/CLI_AND_DAEMON.md+++ b/CLI_AND_DAEMON.md@@ -148,6 +148,7 @@ The daemon auto-detects these AI CLIs on your PATH:| [Pi](https://pi.dev/) | `pi` | Pi coding agent || [Cursor Agent](https://cursor.com/) | `cursor-agent` | Cursor's headless coding agent || Kimi | `kimi` | Moonshot coding agent |+| [Reasonix](https://github.com/esengine/DeepSeek-Reasonix) | `reasonix` | DeepSeek-focused ACP coding agent (run `reasonix setup` first) || Kiro CLI | `kiro-cli` | Kiro ACP coding agent || [Qoder CLI](https://docs.qoder.com/) | `qodercli` | Qoder ACP coding agent || [Qoder CN CLI](https://help.aliyun.com/en/lingma/qodercli-cn/product-overview/what-is-qoder-cli-cn) | `qoderclicn` | Qoder CN ACP coding agent |@@ -229,6 +230,8 @@ Agent-specific overrides:| `MULTICA_CURSOR_MODEL` | Override the Cursor Agent model used || `MULTICA_KIMI_PATH` | Custom path to the `kimi` binary || `MULTICA_KIMI_MODEL` | Override the Kimi model used |+| `MULTICA_REASONIX_PATH` | Custom path to the `reasonix` binary |+| `MULTICA_REASONIX_MODEL` | Override the Reasonix model used || `MULTICA_KIRO_PATH` | Custom path to the `kiro-cli` binary || `MULTICA_KIRO_MODEL` | Override the Kiro model used || `MULTICA_QODER_PATH` | Custom path to the `qodercli` binary |diff --git a/README.md b/README.mdindex 240ef753d6..bda85ed550 100644--- a/README.md+++ b/README.md@@ -31,7 +31,7 @@ Turn coding agents into real teammates — assign tasks, track progress, compounMultica turns coding agents into real teammates. Assign issues to an agent like you'd assign to a colleague — they'll pick up the work, write code, report blockers, and update statuses autonomously.-No more copy-pasting prompts. No more babysitting runs. Your agents show up on the board, participate in conversations, and compound reusable skills over time. Think of it as open-source infrastructure for managed agents — vendor-neutral, self-hosted, and designed for human + AI teams. Works with **Claude Code**, **Codex**, **CodeBuddy**, **GitHub Copilot CLI**, **OpenCode**, **OpenClaw**, **Hermes**, **Pi**, **Cursor Agent**, **Kimi**, **Kiro CLI**, **Antigravity**, **Qoder CLI**, and **Trae CLI**.+No more copy-pasting prompts. No more babysitting runs. Your agents show up on the board, participate in conversations, and compound reusable skills over time. Think of it as open-source infrastructure for managed agents — vendor-neutral, self-hosted, and designed for human + AI teams. Works with **Claude Code**, **Codex**, **CodeBuddy**, **GitHub Copilot CLI**, **OpenCode**, **OpenClaw**, **Hermes**, **Pi**, **Cursor Agent**, **Kimi**, **Reasonix**, **Kiro CLI**, **Antigravity**, **Qoder CLI**, and **Trae CLI**.For larger teams, Squads add a stable routing layer: assign work to a group led by an agent, and the leader delegates to the right member.@@ -144,7 +144,7 @@ multica setup # Connect to Multica Cloud, log in, start daemonmultica setup # Configure, authenticate, and start the daemon```-The daemon runs in the background and auto-detects agent CLIs (`claude`, `codex`, `codebuddy`, `copilot`, `opencode`, `openclaw`, `hermes`, `pi`, `cursor-agent`, `kimi`, `kiro-cli`, `agy`, `qodercli`, `qoderclicn`, `traecli`) on your PATH.+The daemon runs in the background and auto-detects agent CLIs (`claude`, `codex`, `codebuddy`, `copilot`, `opencode`, `openclaw`, `hermes`, `pi`, `cursor-agent`, `kimi`, `reasonix`, `kiro-cli`, `agy`, `qodercli`, `qoderclicn`, `traecli`) on your PATH.### 2. Verify your runtime@@ -154,7 +154,7 @@ Open your workspace in the Multica web app. Navigate to **Settings → Runtimes*### 3. Create an agent-Go to **Settings → Agents** and click **New Agent**. Pick the runtime you just connected and choose a provider (Claude Code, Codex, CodeBuddy, GitHub Copilot CLI, OpenCode, OpenClaw, Hermes, Pi, Cursor Agent, Kimi, Kiro CLI, Antigravity, Qoder CLI, or Trae CLI). Give your agent a name — this is how it will appear on the board, in comments, and in assignments.+Go to **Settings → Agents** and click **New Agent**. Pick the runtime you just connected and choose a provider (Claude Code, Codex, CodeBuddy, GitHub Copilot CLI, OpenCode, OpenClaw, Hermes, Pi, Cursor Agent, Kimi, Reasonix, Kiro CLI, Antigravity, Qoder CLI, or Trae CLI). Give your agent a name — this is how it will appear on the board, in comments, and in assignments.### 4. Assign your first task@@ -195,7 +195,7 @@ See the [CLI and Daemon Guide](CLI_AND_DAEMON.md) for the full command reference│ Agent Daemon │ runs on your machine└──────────────┘ (Claude Code, Codex, CodeBuddy, GitHub Copilot CLI,OpenCode, OpenClaw, Hermes, Pi, Cursor Agent,- Kimi, Kiro CLI, Antigravity, Qoder CLI, Trae CLI)+ Kimi, Reasonix, Kiro CLI, Antigravity, Qoder CLI, Trae CLI)```| Layer | Stack |@@ -203,7 +203,7 @@ See the [CLI and Daemon Guide](CLI_AND_DAEMON.md) for the full command reference| Frontend | Next.js 16 (App Router) || Backend | Go (Chi router, sqlc, gorilla/websocket) || Database | PostgreSQL 17 with pgvector |-| Agent Runtime | Local daemon executing Claude Code, Codex, CodeBuddy, GitHub Copilot CLI, OpenCode, OpenClaw, Hermes, Pi, Cursor Agent, Kimi, Kiro CLI, Antigravity, Qoder CLI, or Trae CLI |+| Agent Runtime | Local daemon executing Claude Code, Codex, CodeBuddy, GitHub Copilot CLI, OpenCode, OpenClaw, Hermes, Pi, Cursor Agent, Kimi, Reasonix, Kiro CLI, Antigravity, Qoder CLI, or Trae CLI |## Developmentdiff --git a/README.zh-CN.md b/README.zh-CN.mdindex b0833d6de3..d36f6230d6 100644--- a/README.zh-CN.md+++ b/README.zh-CN.md@@ -31,7 +31,7 @@Multica 将编码 Agent 变成真正的队友。像分配给同事一样分配给 Agent——它们会自主接手工作、编写代码、报告阻塞问题、更新状态。-不再需要复制粘贴 prompt,不再需要盯着运行过程。你的 Agent 出现在看板上、参与对话、随着时间积累可复用的技能。可以理解为开源的 Managed Agents 基础设施——厂商中立、可自部署、专为人类 + AI 团队设计。支持 **Claude Code**、**Codex**、**CodeBuddy**、**GitHub Copilot CLI**、**OpenCode**、**OpenClaw**、**Hermes**、**Pi**、**Cursor Agent**、**Kimi**、**Kiro CLI**、**Antigravity**、**Qoder CLI** 与 **Trae CLI**。+不再需要复制粘贴 prompt,不再需要盯着运行过程。你的 Agent 出现在看板上、参与对话、随着时间积累可复用的技能。可以理解为开源的 Managed Agents 基础设施——厂商中立、可自部署、专为人类 + AI 团队设计。支持 **Claude Code**、**Codex**、**CodeBuddy**、**GitHub Copilot CLI**、**OpenCode**、**OpenClaw**、**Hermes**、**Pi**、**Cursor Agent**、**Kimi**、**Reasonix**、**Kiro CLI**、**Antigravity**、**Qoder CLI** 与 **Trae CLI**。面向更大的团队,Squads(小队)提供稳定的路由层:把任务分给由 Agent 带队的小队,由队长判断谁最适合接手。@@ -116,7 +116,7 @@ multica setup # 连接 Multica Cloud,登录,启动 daemonmultica setup # 配置、认证、启动 daemon(一条命令搞定)```-daemon 在后台运行,保持你的机器与 Multica 的连接。它会自动检测 PATH 中可用的 Agent CLI(`claude`、`codex`、`codebuddy`、`copilot`、`opencode`、`openclaw`、`hermes`、`pi`、`cursor-agent`、`kimi`、`kiro-cli`、`agy`、`qodercli`、`qoderclicn`、`traecli`)。+daemon 在后台运行,保持你的机器与 Multica 的连接。它会自动检测 PATH 中可用的 Agent CLI(`claude`、`codex`、`codebuddy`、`copilot`、`opencode`、`openclaw`、`hermes`、`pi`、`cursor-agent`、`kimi`、`reasonix`、`kiro-cli`、`agy`、`qodercli`、`qoderclicn`、`traecli`)。### 2. 确认运行时已连接@@ -126,7 +126,7 @@ daemon 在后台运行,保持你的机器与 Multica 的连接。它会自动### 3. 创建 Agent-进入 **设置 → Agents**,点击 **新建 Agent**。选择你刚连接的 Runtime,选择 Provider(Claude Code、Codex、CodeBuddy、GitHub Copilot CLI、OpenCode、OpenClaw、Hermes、Pi、Cursor Agent、Kimi、Kiro CLI、Antigravity、Qoder CLI 或 Trae CLI),并为 Agent 起个名字——它将以这个名字出现在看板、评论和任务分配中。+进入 **设置 → Agents**,点击 **新建 Agent**。选择你刚连接的 Runtime,选择 Provider(Claude Code、Codex、CodeBuddy、GitHub Copilot CLI、OpenCode、OpenClaw、Hermes、Pi、Cursor Agent、Kimi、Reasonix、Kiro CLI、Antigravity、Qoder CLI 或 Trae CLI),并为 Agent 起个名字——它将以这个名字出现在看板、评论和任务分配中。### 4. 分配你的第一个任务@@ -148,7 +148,7 @@ daemon 在后台运行,保持你的机器与 Multica 的连接。它会自动│ Agent Daemon │ 运行在你的机器上└──────────────┘ (Claude Code、Codex、CodeBuddy、GitHub Copilot CLI、OpenCode、OpenClaw、Hermes、Pi、Cursor Agent、- Kimi、Kiro CLI、Antigravity、Qoder CLI、Trae CLI)+ Kimi、Reasonix、Kiro CLI、Antigravity、Qoder CLI、Trae CLI)```| 层级 | 技术栈 |@@ -156,7 +156,7 @@ daemon 在后台运行,保持你的机器与 Multica 的连接。它会自动| 前端 | Next.js 16 (App Router) || 后端 | Go (Chi router, sqlc, gorilla/websocket) || 数据库 | PostgreSQL 17 with pgvector |-| Agent 运行时 | 本地 daemon 执行 Claude Code、Codex、CodeBuddy、GitHub Copilot CLI、OpenCode、OpenClaw、Hermes、Pi、Cursor Agent、Kimi、Kiro CLI、Antigravity、Qoder CLI 或 Trae CLI |+| Agent 运行时 | 本地 daemon 执行 Claude Code、Codex、CodeBuddy、GitHub Copilot CLI、OpenCode、OpenClaw、Hermes、Pi、Cursor Agent、Kimi、Reasonix、Kiro CLI、Antigravity、Qoder CLI 或 Trae CLI |## 开发diff --git a/SELF_HOSTING.md b/SELF_HOSTING.mdindex 147554df1c..70bd17db26 100644--- a/SELF_HOSTING.md+++ b/SELF_HOSTING.md@@ -118,6 +118,7 @@ You also need at least one AI agent CLI installed:- [Pi](https://pi.dev/) (`pi` on PATH)- [Cursor Agent](https://cursor.com/) (`cursor-agent` on PATH)- Kimi (`kimi` on PATH)+- [Reasonix](https://github.com/esengine/DeepSeek-Reasonix) (`reasonix` on PATH; run `reasonix setup` first)- Kiro CLI (`kiro-cli` on PATH)- Qoder CLI (`qodercli` on PATH)- Qoder CN CLI (`qoderclicn` on PATH)diff --git a/apps/docs/content/docs/install-agent-runtime.ja.mdx b/apps/docs/content/docs/install-agent-runtime.ja.mdxindex 0c8aab26b0..211ec5d420 100644--- a/apps/docs/content/docs/install-agent-runtime.ja.mdx+++ b/apps/docs/content/docs/install-agent-runtime.ja.mdx@@ -25,6 +25,7 @@ Multica は現在、次のコマンドを検出します。| Grok Build | `grok` | [Grok Build クイックスタート](https://docs.x.ai/build/overview) || Hermes Agent | `hermes` | [Hermes クイックスタート](https://hermes-agent.nousresearch.com/docs/getting-started/quickstart/) || Kimi CLI | `kimi` | [Kimi CLI](https://github.com/MoonshotAI/kimi-cli) |+| Reasonix | `reasonix` | [Reasonix](https://github.com/esengine/DeepSeek-Reasonix) || Kiro CLI | `kiro-cli` | [Kiro CLI のインストール](https://kiro.dev/docs/cli/installation/) || OpenClaw | `openclaw` | [OpenClaw のインストール](https://docs.openclaw.ai/install) || OpenCode | `opencode` | [OpenCode クイックスタート](https://opencode.ai/en/docs) |@@ -40,6 +41,8 @@ Multica は現在、次のコマンドを検出します。インストール後、まずターミナルからツールを単独で起動し、各ツールの手順に従ってログインするか、モデルプロバイダーを設定してください。ターミナル上でリクエストを実行できない場合は、デーモンから呼び出しても失敗します。+Reasonix を使う場合は、デーモンを起動する前に `reasonix setup` を実行し、デフォルトのプロバイダーとモデルを設定してください。+ログイン情報はツールがローカル環境に保存します。Multica が Claude、Codex、Cursor などの CLI のログイントークンを受け取ることはありません。<Callout type="info">diff --git a/apps/docs/content/docs/install-agent-runtime.ko.mdx b/apps/docs/content/docs/install-agent-runtime.ko.mdxindex b57555edcd..988b6c6794 100644--- a/apps/docs/content/docs/install-agent-runtime.ko.mdx+++ b/apps/docs/content/docs/install-agent-runtime.ko.mdx@@ -25,6 +25,7 @@ Multica는 현재 다음 명령을 감지합니다.| Grok Build | `grok` | [Grok Build 빠른 시작](https://docs.x.ai/build/overview) || Hermes Agent | `hermes` | [Hermes 빠른 시작](https://hermes-agent.nousresearch.com/docs/getting-started/quickstart/) || Kimi CLI | `kimi` | [Kimi CLI](https://github.com/MoonshotAI/kimi-cli) |+| Reasonix | `reasonix` | [Reasonix](https://github.com/esengine/DeepSeek-Reasonix) || Kiro CLI | `kiro-cli` | [Kiro CLI 설치](https://kiro.dev/docs/cli/installation/) || OpenClaw | `openclaw` | [OpenClaw 설치](https://docs.openclaw.ai/install) || OpenCode | `opencode` | [OpenCode 빠른 시작](https://opencode.ai/en/docs) |@@ -40,6 +41,8 @@ Multica는 현재 다음 명령을 감지합니다.설치 후 터미널에서 도구를 한 번 직접 실행하고 도구 자체의 절차에 따라 로그인하거나 모델 서비스를 설정합니다. 터미널에서 요청을 완료하지 못하면 데몬이 호출할 때도 실패합니다.+Reasonix를 사용할 때는 데몬을 시작하기 전에 `reasonix setup`을 실행해 기본 공급자와 모델을 설정하세요.+로그인 자격 증명은 도구가 로컬에 저장합니다. Multica는 Claude, Codex, Cursor 또는 다른 CLI의 로그인 token을 받지 않습니다.<Callout type="info">diff --git a/apps/docs/content/docs/install-agent-runtime.mdx b/apps/docs/content/docs/install-agent-runtime.mdxindex 8e5280129a..8f407f922f 100644--- a/apps/docs/content/docs/install-agent-runtime.mdx+++ b/apps/docs/content/docs/install-agent-runtime.mdx@@ -25,6 +25,7 @@ Multica currently detects these commands:| Grok Build | `grok` | [Grok Build quickstart](https://docs.x.ai/build/overview) || Hermes Agent | `hermes` | [Hermes quickstart](https://hermes-agent.nousresearch.com/docs/getting-started/quickstart/) || Kimi CLI | `kimi` | [Kimi CLI](https://github.com/MoonshotAI/kimi-cli) |+| Reasonix | `reasonix` | [Reasonix](https://github.com/esengine/DeepSeek-Reasonix) || Kiro CLI | `kiro-cli` | [Install Kiro CLI](https://kiro.dev/docs/cli/installation/) || OpenClaw | `openclaw` | [Install OpenClaw](https://docs.openclaw.ai/install) || OpenCode | `opencode` | [OpenCode quickstart](https://opencode.ai/en/docs) |@@ -40,6 +41,8 @@ Multica currently detects these commands:After installing, launch the tool once in a terminal on its own and complete its sign-in or model provider setup. If the tool cannot complete requests in the terminal, the daemon's invocations fail the same way.+For Reasonix, run `reasonix setup` and configure a default provider and model 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.<Callout type="info">diff --git a/apps/docs/content/docs/install-agent-runtime.zh.mdx b/apps/docs/content/docs/install-agent-runtime.zh.mdxindex b1974141fd..90b9f6d0fa 100644--- a/apps/docs/content/docs/install-agent-runtime.zh.mdx+++ b/apps/docs/content/docs/install-agent-runtime.zh.mdx@@ -25,6 +25,7 @@ Multica 当前会检测以下命令:| Grok Build | `grok` | [Grok Build 快速开始](https://docs.x.ai/build/overview) || Hermes Agent | `hermes` | [Hermes 快速开始](https://hermes-agent.nousresearch.com/docs/getting-started/quickstart/) || Kimi CLI | `kimi` | [Kimi CLI](https://github.com/MoonshotAI/kimi-cli) |+| Reasonix | `reasonix` | [Reasonix](https://github.com/esengine/DeepSeek-Reasonix) || Kiro CLI | `kiro-cli` | [安装 Kiro CLI](https://kiro.dev/docs/cli/installation/) || OpenClaw | `openclaw` | [安装 OpenClaw](https://docs.openclaw.ai/install) || OpenCode | `opencode` | [OpenCode 快速开始](https://opencode.ai/en/docs) |@@ -40,6 +41,8 @@ Multica 当前会检测以下命令:安装后,先在终端中单独启动一次工具,并按照它自己的流程登录或配置模型服务。工具在终端中无法完成请求时,守护进程调用它同样会失败。+使用 Reasonix 时,请先运行 `reasonix setup`,配置默认的模型服务和模型,再启动守护进程。+这些登录凭据由工具保存在本机。Multica 不会接收 Claude、Codex、Cursor 或其他 CLI 的登录 token。<Callout type="info">diff --git a/apps/docs/content/docs/providers.ja.mdx b/apps/docs/content/docs/providers.ja.mdxindex cebd6e9bcd..55d42fcd02 100644--- a/apps/docs/content/docs/providers.ja.mdx+++ b/apps/docs/content/docs/providers.ja.mdx@@ -30,6 +30,7 @@ Multica は、普段使っている AI コーディングツールの代わり| Grok | `grok` | ✓ | ✓ | `.grok/skills/` || Hermes | `hermes` | ✓ | ✓ | 1 回の実行専用の `HERMES_HOME/skills/` || Kimi CLI | `kimi` | ✓ | ✓ | `.kimi/skills/` |+| Reasonix | `reasonix` | ✓ | ✓ | `.reasonix/skills/` || Kiro CLI | `kiro-cli` | ✓ | ✓ | `.kiro/skills/` || OpenClaw | `openclaw` | ✓ | ✓ | `skills/` || OpenCode | `opencode` | ✓ | ✓ | `.opencode/skills/` |diff --git a/apps/docs/content/docs/providers.ko.mdx b/apps/docs/content/docs/providers.ko.mdxindex 9f2ed1318c..5680307776 100644--- a/apps/docs/content/docs/providers.ko.mdx+++ b/apps/docs/content/docs/providers.ko.mdx@@ -30,6 +30,7 @@ Multica는 사용 중인 AI 코딩 도구를 대체하지 않습니다. 런타| Grok | `grok` | ✓ | ✓ | `.grok/skills/` || Hermes | `hermes` | ✓ | ✓ | 실행별 `HERMES_HOME/skills/` || Kimi CLI | `kimi` | ✓ | ✓ | `.kimi/skills/` |+| Reasonix | `reasonix` | ✓ | ✓ | `.reasonix/skills/` || Kiro CLI | `kiro-cli` | ✓ | ✓ | `.kiro/skills/` || OpenClaw | `openclaw` | ✓ | ✓ | `skills/` || OpenCode | `opencode` | ✓ | ✓ | `.opencode/skills/` |diff --git a/apps/docs/content/docs/providers.mdx b/apps/docs/content/docs/providers.mdxindex 8fe3012320..be4a41db53 100644--- a/apps/docs/content/docs/providers.mdx+++ b/apps/docs/content/docs/providers.mdx@@ -30,6 +30,7 @@ Install steps are in [Install AI coding tools](/install-agent-runtime).| Grok | `grok` | ✓ | ✓ | `.grok/skills/` || Hermes | `hermes` | ✓ | ✓ | per-task `HERMES_HOME/skills/` || Kimi CLI | `kimi` | ✓ | ✓ | `.kimi/skills/` |+| Reasonix | `reasonix` | ✓ | ✓ | `.reasonix/skills/` || Kiro CLI | `kiro-cli` | ✓ | ✓ | `.kiro/skills/` || OpenClaw | `openclaw` | ✓ | ✓ | `skills/` || OpenCode | `opencode` | ✓ | ✓ | `.opencode/skills/` |diff --git a/apps/docs/content/docs/providers.zh.mdx b/apps/docs/content/docs/providers.zh.mdxindex f92937202c..84a60028d3 100644--- a/apps/docs/content/docs/providers.zh.mdx+++ b/apps/docs/content/docs/providers.zh.mdx@@ -30,6 +30,7 @@ Multica 不会替代你使用的 AI 编程工具。运行时会调用电脑上| Grok | `grok` | ✓ | ✓ | `.grok/skills/` || Hermes | `hermes` | ✓ | ✓ | 单次执行的 `HERMES_HOME/skills/` || Kimi CLI | `kimi` | ✓ | ✓ | `.kimi/skills/` |+| Reasonix | `reasonix` | ✓ | ✓ | `.reasonix/skills/` || Kiro CLI | `kiro-cli` | ✓ | ✓ | `.kiro/skills/` || OpenClaw | `openclaw` | ✓ | ✓ | `skills/` || OpenCode | `opencode` | ✓ | ✓ | `.opencode/skills/` |diff --git a/apps/web/features/landing/i18n/en.ts b/apps/web/features/landing/i18n/en.tsindex be7f4e94a7..dc6a8e1d38 100644--- a/apps/web/features/landing/i18n/en.ts+++ b/apps/web/features/landing/i18n/en.ts@@ -116,7 +116,7 @@ export function createEnDict(allowSignup: boolean): LandingDict {{title: "Auto-detection on first run",description:- "Multica scans for 14 supported coding tools \u2014 Antigravity, Claude Code, CodeBuddy, Codex, Cursor, Copilot, Hermes, Kimi, Kiro CLI, OpenCode, OpenClaw, Pi, Qoder, and Trae CLI \u2014 and registers a runtime for each one it finds.",+ "Multica scans for 15 supported coding tools \u2014 Antigravity, Claude Code, CodeBuddy, Codex, Cursor, Copilot, Hermes, Kimi, Reasonix, Kiro CLI, OpenCode, OpenClaw, Pi, Qoder, and Trae CLI \u2014 and registers a runtime for each one it finds.",},],},@@ -136,7 +136,7 @@ export function createEnDict(allowSignup: boolean): LandingDict {{title: "Install the CLI & connect your machine",description:- "Run multica setup \u2014 it walks you through OAuth, starts the daemon, and scans for the 14 supported coding tools (Antigravity, Claude Code, CodeBuddy, Codex, Cursor, Copilot, Hermes, Kimi, Kiro CLI, OpenCode, OpenClaw, Pi, Qoder, Trae CLI). 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 15 supported coding tools (Antigravity, Claude Code, CodeBuddy, Codex, Cursor, Copilot, Hermes, Kimi, Reasonix, Kiro CLI, OpenCode, OpenClaw, Pi, Qoder, Trae CLI). Whichever ones you already have installed get registered as runtimes automatically.",},{title: "Create your first agent",@@ -192,7 +192,7 @@ export function createEnDict(allowSignup: boolean): LandingDict {{question: "What coding agents does Multica support?",answer:- "Multica supports 14 coding tools out of the box: Antigravity, Claude Code, CodeBuddy, Codex, Cursor, Copilot, Hermes, Kimi, Kiro CLI, OpenCode, OpenClaw, Pi, Qoder, and Trae CLI. The daemon auto-detects whichever CLIs you already have installed and registers a runtime for each one. Since it's open source, you can also add your own backends.",+ "Multica supports 15 coding tools out of the box: Antigravity, Claude Code, CodeBuddy, Codex, Cursor, Copilot, Hermes, Kimi, Reasonix, Kiro CLI, OpenCode, OpenClaw, Pi, Qoder, and Trae CLI. The daemon auto-detects whichever CLIs you already have installed and registers a runtime for each one. Since it's open source, 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 96655e1814..002a8f93c2 100644--- a/apps/web/features/landing/i18n/ja.ts+++ b/apps/web/features/landing/i18n/ja.ts@@ -118,7 +118,7 @@ export function createJaDict(allowSignup: boolean): LandingDict {{title: "初回起動時に自動検出",description:- "Multica は Antigravity、Claude Code、CodeBuddy、Codex、Cursor、Copilot、Hermes、Kimi、Kiro CLI、OpenCode、OpenClaw、Pi、Qoder、Trae CLI という14種類の対応ツールをスキャンし、見つかったものをそれぞれランタイムとして登録します。",+ "Multica は Antigravity、Claude Code、CodeBuddy、Codex、Cursor、Copilot、Hermes、Kimi、Reasonix、Kiro CLI、OpenCode、OpenClaw、Pi、Qoder、Trae CLI という15種類の対応ツールをスキャンし、見つかったものをそれぞれランタイムとして登録します。",},],},@@ -139,7 +139,7 @@ export function createJaDict(allowSignup: boolean): LandingDict {{title: "CLI をインストールしてマシンを接続",description:- "multica setup を実行すると、OAuth の手順を案内し、デーモンを起動し、14種類の対応コーディングツール(Antigravity、Claude Code、CodeBuddy、Codex、Cursor、Copilot、Hermes、Kimi、Kiro CLI、OpenCode、OpenClaw、Pi、Qoder、Trae CLI)をスキャンします。すでにインストール済みのものは、自動的にランタイムとして登録されます。",+ "multica setup を実行すると、OAuth の手順を案内し、デーモンを起動し、15種類の対応コーディングツール(Antigravity、Claude Code、CodeBuddy、Codex、Cursor、Copilot、Hermes、Kimi、Reasonix、Kiro CLI、OpenCode、OpenClaw、Pi、Qoder、Trae CLI)をスキャンします。すでにインストール済みのものは、自動的にランタイムとして登録されます。",},{title: "最初のエージェントを作成",@@ -193,7 +193,7 @@ export function createJaDict(allowSignup: boolean): LandingDict {{question: "Multica はどのコーディングエージェントに対応していますか?",answer:- "Multica は、Antigravity、Claude Code、CodeBuddy、Codex、Cursor、Copilot、Hermes、Kimi、Kiro CLI、OpenCode、OpenClaw、Pi、Qoder、Trae CLI の14種類のコーディングツールに標準対応しています。デーモンが、すでにインストール済みの CLI を自動検出し、それぞれをランタイムとして登録します。オープンソースなので、独自のバックエンドを追加することもできます。",+ "Multica は、Antigravity、Claude Code、CodeBuddy、Codex、Cursor、Copilot、Hermes、Kimi、Reasonix、Kiro CLI、OpenCode、OpenClaw、Pi、Qoder、Trae CLI の15種類のコーディングツールに標準対応しています。デーモンが、すでにインストール済みの CLI を自動検出し、それぞれをランタイムとして登録します。オープンソースなので、独自のバックエンドを追加することもできます。",},{question: "セルフホストが必須ですか、それともクラウド版もありますか?",diff --git a/apps/web/features/landing/i18n/ko.ts b/apps/web/features/landing/i18n/ko.tsindex 10f43549d2..37053319e6 100644--- a/apps/web/features/landing/i18n/ko.ts+++ b/apps/web/features/landing/i18n/ko.ts@@ -118,7 +118,7 @@ export function createKoDict(allowSignup: boolean): LandingDict {{title: "처음 실행할 때 자동 등록",description:- "Multica는 Antigravity, Claude Code, CodeBuddy, Codex, Cursor, Copilot, Hermes, Kimi, Kiro CLI, OpenCode, OpenClaw, Pi, Qoder, Trae CLI 등 14개 지원 도구를 스캔해 이미 설치된 것을 런타임으로 자동 등록합니다.",+ "Multica는 Antigravity, Claude Code, CodeBuddy, Codex, Cursor, Copilot, Hermes, Kimi, Reasonix, Kiro CLI, OpenCode, OpenClaw, Pi, Qoder, Trae CLI 등 15개 지원 도구를 스캔해 이미 설치된 것을 런타임으로 자동 등록합니다.",},],},@@ -193,7 +193,7 @@ export function createKoDict(allowSignup: boolean): LandingDict {{question: "Multica는 어떤 코딩 에이전트를 지원하나요?",answer:- "Multica는 Antigravity, Claude Code, CodeBuddy, Codex, Cursor, Copilot, Hermes, Kimi, Kiro CLI, OpenCode, OpenClaw, Pi, Qoder, Trae CLI 등 14개 코딩 도구를 기본 지원합니다. 데몬이 이미 설치된 CLI를 자동으로 찾아 각각 런타임으로 등록합니다. 오픈소스이므로 직접 백엔드를 추가할 수도 있습니다.",+ "Multica는 Antigravity, Claude Code, CodeBuddy, Codex, Cursor, Copilot, Hermes, Kimi, Reasonix, Kiro CLI, OpenCode, OpenClaw, Pi, Qoder, Trae CLI 등 15개 코딩 도구를 기본 지원합니다. 데몬이 이미 설치된 CLI를 자동으로 찾아 각각 런타임으로 등록합니다. 오픈소스이므로 직접 백엔드를 추가할 수도 있습니다.",},{question: "셀프 호스팅만 가능한가요, 클라우드 버전도 있나요?",diff --git a/apps/web/features/landing/i18n/zh.ts b/apps/web/features/landing/i18n/zh.tsindex 847f417314..edf234ee96 100644--- a/apps/web/features/landing/i18n/zh.ts+++ b/apps/web/features/landing/i18n/zh.ts@@ -116,7 +116,7 @@ export function createZhDict(allowSignup: boolean): LandingDict {{title: "\u9996\u6b21\u542f\u52a8\u81ea\u52a8\u6ce8\u518c",description:- "Multica \u626b\u63cf\u672c\u673a\u7684 14 \u6b3e\u652f\u6301\u7684 AI \u7f16\u7a0b\u5de5\u5177\u2014\u2014Antigravity\u3001Claude Code\u3001CodeBuddy\u3001Codex\u3001Cursor\u3001Copilot\u3001Hermes\u3001Kimi\u3001Kiro CLI\u3001OpenCode\u3001OpenClaw\u3001Pi\u3001Qoder\u3001Trae CLI\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 15 \u6b3e\u652f\u6301\u7684 AI \u7f16\u7a0b\u5de5\u5177\u2014\u2014Antigravity\u3001Claude Code\u3001CodeBuddy\u3001Codex\u3001Cursor\u3001Copilot\u3001Hermes\u3001Kimi\u3001Reasonix\u3001Kiro CLI\u3001OpenCode\u3001OpenClaw\u3001Pi\u3001Qoder\u3001Trae CLI\u2014\u2014\u5e76\u4e3a\u6bcf\u6b3e\u5df2\u5b89\u88c5\u7684\u5de5\u5177\u6ce8\u518c\u4e00\u4e2a\u8fd0\u884c\u65f6\u3002",},],},@@ -136,7 +136,7 @@ export function createZhDict(allowSignup: boolean): LandingDict {{title: "\u5b89\u88c5 CLI \u5e76\u8fde\u63a5\u4f60\u7684\u673a\u5668",description:- "运行 multica setup——它会引导你完成 OAuth 登录、启动守护进程、并扫描 14 款支持的 AI 编程工具(Antigravity、Claude Code、CodeBuddy、Codex、Cursor、Copilot、Hermes、Kimi、Kiro CLI、OpenCode、OpenClaw、Pi、Qoder、Trae CLI)。本机已安装的工具会被自动注册成运行时。",+ "运行 multica setup——它会引导你完成 OAuth 登录、启动守护进程、并扫描 15 款支持的 AI 编程工具(Antigravity、Claude Code、CodeBuddy、Codex、Cursor、Copilot、Hermes、Kimi、Reasonix、Kiro CLI、OpenCode、OpenClaw、Pi、Qoder、Trae CLI)。本机已安装的工具会被自动注册成运行时。",},{title: "\u521b\u5efa\u4f60\u7684\u7b2c\u4e00\u4e2a 智能体",@@ -192,7 +192,7 @@ export function createZhDict(allowSignup: boolean): LandingDict {{question: "Multica \u652f\u6301\u54ea\u4e9b\u7f16\u7801 智能体\uff1f",answer:- "Multica \u5f00\u7bb1\u5373\u7528\u652f\u6301 14 \u6b3e AI \u7f16\u7a0b\u5de5\u5177\uff1aAntigravity\u3001Claude Code\u3001CodeBuddy\u3001Codex\u3001Cursor\u3001Copilot\u3001Hermes\u3001Kimi\u3001Kiro CLI\u3001OpenCode\u3001OpenClaw\u3001Pi\u3001Qoder\u3001Trae CLI\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\u56e0\u4e3a\u5f00\u6e90\uff0c\u4f60\u4e5f\u53ef\u4ee5\u81ea\u5df1\u6dfb\u52a0\u540e\u7aef\u3002",+ "Multica \u5f00\u7bb1\u5373\u7528\u652f\u6301 15 \u6b3e AI \u7f16\u7a0b\u5de5\u5177\uff1aAntigravity\u3001Claude Code\u3001CodeBuddy\u3001Codex\u3001Cursor\u3001Copilot\u3001Hermes\u3001Kimi\u3001Reasonix\u3001Kiro CLI\u3001OpenCode\u3001OpenClaw\u3001Pi\u3001Qoder\u3001Trae CLI\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\u56e0\u4e3a\u5f00\u6e90\uff0c\u4f60\u4e5f\u53ef\u4ee5\u81ea\u5df1\u6dfb\u52a0\u540e\u7aef\u3002",},{question: "\u9700\u8981\u81ea\u6258\u7ba1\u5417\uff0c\u8fd8\u662f\u6709\u4e91\u7248\u672c\uff1f",diff --git a/packages/core/agents/mcp-support.test.ts b/packages/core/agents/mcp-support.test.tsindex d3df424095..13d539ce7e 100644--- a/packages/core/agents/mcp-support.test.ts+++ b/packages/core/agents/mcp-support.test.ts@@ -10,6 +10,7 @@ describe("providerSupportsMcpConfig", () => {expect(providerSupportsMcpConfig("cursor")).toBe(true);expect(providerSupportsMcpConfig("hermes")).toBe(true);expect(providerSupportsMcpConfig("kimi")).toBe(true);+ expect(providerSupportsMcpConfig("reasonix")).toBe(true);expect(providerSupportsMcpConfig("kiro")).toBe(true);expect(providerSupportsMcpConfig("opencode")).toBe(true);expect(providerSupportsMcpConfig("openclaw")).toBe(true);diff --git a/packages/core/agents/mcp-support.ts b/packages/core/agents/mcp-support.tsindex 94f0a87c2b..f814111556 100644--- a/packages/core/agents/mcp-support.ts+++ b/packages/core/agents/mcp-support.ts@@ -13,6 +13,7 @@ const MCP_SUPPORTED_PROVIDERS = new Set(["grok","hermes","kimi",+ "reasonix","kiro","opencode","openclaw",diff --git a/packages/core/types/agent.ts b/packages/core/types/agent.tsindex 50b6379c1f..4bc959543e 100644--- a/packages/core/types/agent.ts+++ b/packages/core/types/agent.ts@@ -115,6 +115,7 @@ export const RUNTIME_PROFILE_PROTOCOL_FAMILIES = ["pi","cursor","kimi",+ "reasonix","kiro","antigravity","qoder",diff --git a/packages/views/runtimes/components/provider-logo.test.tsx b/packages/views/runtimes/components/provider-logo.test.tsxindex 76890b2e08..8a72309656 100644--- a/packages/views/runtimes/components/provider-logo.test.tsx+++ b/packages/views/runtimes/components/provider-logo.test.tsx@@ -3,6 +3,16 @@ import { describe, expect, it } from "vitest";import { ProviderLogo } from "./provider-logo";describe("ProviderLogo", () => {+ it("renders the dedicated Reasonix mark", () => {+ const { container } = render(+ <ProviderLogo provider="reasonix" className="runtime-logo" />,+ );++ const logo = container.querySelector('svg[aria-label="Reasonix"]');+ expect(logo?.querySelector('path[fill="#0153E5"]')).not.toBeNull();+ expect(logo?.classList.contains("runtime-logo")).toBe(true);+ });+it("renders the dedicated Qwen Code mark", () => {const { container } = render(<ProviderLogo provider="qwen" className="runtime-logo" />);diff --git a/packages/views/runtimes/components/provider-logo.tsx b/packages/views/runtimes/components/provider-logo.tsxindex 236b490cc7..dbbf49d732 100644--- a/packages/views/runtimes/components/provider-logo.tsx+++ b/packages/views/runtimes/components/provider-logo.tsx@@ -183,6 +183,27 @@ function KimiLogo({ className }: { className: string }) {);}+// Reasonix — official symbol from DeepSeek-Reasonix's logo-symbol.svg.+function ReasonixLogo({ className }: { className: string }) {+ return (+ <svg viewBox="245 70 235 245" className={className} role="img" aria-label="Reasonix">+ <path+ fill="#0153E5"+ d="M369.75 185.3c2.09 1.76 4.98 2.41 7.95 1.06 1.18-.54 1.96-1.91 1.47-3.25-3.92-10.71-14.97-18.54-19.38-12.48-.54.74-.52 1.7-.11 2.29.32.47.97.57 1.82.4 2.68-.56 6.02 1.31 5.7 4.3-.33 3.12.3 5.79 2.56 7.69Z"+ />+ <path+ fill="#0153E5"+ d="M434.28 204.78c10.12-11.32 16.46-25.01 18.67-40.07 5.04-32.93-11.31-63.01-42.11-75.75-10.83-4.35-21.95-6.2-33.76-6.09l-114.5.03v219.42l56.29-.04v-77.17c-1.86-.69-3.15-1.27-3.15-1.27-12.24-5.59-21.6-15.29-26.74-27.44-6.56-15.51-4.54-32.9 5.78-46.12 10.28-12.84 24.31-16.92 40.41-14.67 5.95.83 12.3-6.15 24.4-4.81.81.09 1.63.7 1.71 1.18.28 1.65-4.4 2.54-4.4 7.05 0 1.9.85 4.1 2.65 5.36 6.17 4.33 11.51 9.19 17.1 14.22 2.72 2.44 11.93 9.31 14.27 3.72 1.37-3.26 2.27-6.68 3.18-10.15.45-1.72-.5-2.74-1.89-3.56-9.5-5.63-13.08-17.35-9.37-27.74.36-1 1.29-1.49 2.08-1.52 3.19-.14 1.49 5.78 9.38 8.21 7.49 2.31 7.71 8.53 11.35 6.05 8.48-5.78 11.54-1.05 19.41-8.46.81-.76 2.2-.82 3.04-.23.52.36.97 1.29.93 2.38-.23 6.26-2.67 12.24-6.95 16.84-8.09 8.69-14.89 4.53-15.33 10.62-1.29 17.86-7.13 35.69-19.81 48.66-.41.42-.65 1.01-.58 1.41.07.42.57.83 1.12 1.01l10.68 3.63c1.51.51 2.6 1.87 2.41 3.31-.17 1.26-1.17 2.37-2.61 2.85-7.84 2.59-16.26 2.14-24.24-.27-10.56 8.89-23.54 13.48-37.68 12.93l20.53 28.34 33.49 45.73 66.85-.09-56.68-76.53c13.19-3.89 24.78-10.87 34.07-20.94Z"+ />+ <circle fill="#0153E5" cx="362.14" cy="177.19" r="1.58" />+ <path+ fill="#0153E5"+ d="M300.31 167.85c-3.53.43-5.65 2.96-5.31 6.74 2.39 26.35 26.7 47.92 53.94 42.72 5.8-1.11 11.08-3.41 15.36-7.74-9.27-7.98-13.79-16.12-21.41-24.13-10.91-11.47-26.43-19.54-42.58-17.59Z"+ />+ </svg>+ );+}+// Qoder (QoderCLI) — official logo from qoder-color.svgfunction QoderLogo({ className }: { className: string }) {return (@@ -325,6 +346,8 @@ export function ProviderLogo({return <CursorLogo className={className} />;case "kimi":return <KimiLogo className={className} />;+ case "reasonix":+ return <ReasonixLogo className={className} />;case "kiro":return <KiroLogo className={className} />;case "qoder":diff --git a/scripts/agent-cli-command-names.txt b/scripts/agent-cli-command-names.txtindex 8723e46188..ae3e753faf 100644--- a/scripts/agent-cli-command-names.txt+++ b/scripts/agent-cli-command-names.txt@@ -15,5 +15,6 @@ piqwenqodercliqoderclicn+reasonixtraecliqwenpawdiff --git a/server/internal/daemon/agents_probe.go b/server/internal/daemon/agents_probe.goindex 89b40ec040..75a39ddab8 100644--- a/server/internal/daemon/agents_probe.go+++ b/server/internal/daemon/agents_probe.go@@ -177,6 +177,9 @@ var probeAgentCLIs = func() map[string]AgentEntry {if e, ok := probe("MULTICA_KIMI_PATH", "kimi", "MULTICA_KIMI_MODEL"); ok {agents["kimi"] = e}+ if e, ok := probe("MULTICA_REASONIX_PATH", "reasonix", "MULTICA_REASONIX_MODEL"); ok {+ agents["reasonix"] = e+ }if e, ok := probe("MULTICA_KIRO_PATH", "kiro-cli", "MULTICA_KIRO_MODEL"); ok {agents["kiro"] = e}diff --git a/server/internal/daemon/config.go b/server/internal/daemon/config.goindex 27af8ab007..0a84db08df 100644--- a/server/internal/daemon/config.go+++ b/server/internal/daemon/config.go@@ -91,7 +91,7 @@ type Config struct {CLIVersion string // multica CLI version (e.g. "0.1.13")LaunchedBy string // "desktop" when spawned by the Electron app, empty for standaloneProfile string // profile name (empty = default)- Agents map[string]AgentEntry // keyed by provider: claude, codebuddy, codex, copilot, opencode, openclaw, hermes, pi, cursor, kimi, kiro, antigravity, qoder, qoderclicn, traecli, grok, qwen, qwenpaw+ Agents map[string]AgentEntry // keyed by provider: claude, codebuddy, codex, copilot, opencode, openclaw, hermes, pi, cursor, kimi, reasonix, kiro, antigravity, qoder, qoderclicn, traecli, grok, qwen, qwenpawWorkspacesRoot string // base path for execution envs (default: ~/multica_workspaces)KeepEnvAfterTask bool // preserve env after task for debuggingHealthPort int // local HTTP port for health checks (default: 19514)@@ -220,7 +220,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, codex, copilot, opencode, deveco, openclaw, hermes, pi, cursor-agent, kimi, kiro-cli, agy, qodercli, qoderclicn, traecli, grok, qwen, or qwenpaw and ensure it is on PATH")+ return Config{}, fmt.Errorf("no agent CLI found: install claude, codebuddy, codex, copilot, opencode, deveco, openclaw, hermes, pi, cursor-agent, kimi, reasonix, kiro-cli, agy, qodercli, qoderclicn, traecli, grok, qwen, or qwenpaw and ensure it is on PATH")}claudeArgs, err := shellArgsFromEnv("MULTICA_CLAUDE_ARGS")@@ -744,7 +744,7 @@ func isExecutableFile(path string) bool {// invocation, instead of paying the cost-per-miss.var defaultAgentCommandNames = []string{"claude", "codex", "opencode", "deveco", "openclaw", "hermes",- "pi", "cursor-agent", "copilot", "kimi", "kiro-cli", "codebuddy", "agy", "qodercli", "qoderclicn", "traecli", "grok", "qwen", "qwenpaw",+ "pi", "cursor-agent", "copilot", "kimi", "reasonix", "kiro-cli", "codebuddy", "agy", "qodercli", "qoderclicn", "traecli", "grok", "qwen", "qwenpaw",}// codexDesktopAppBundlePaths returns candidate macOS app-bundle locations fordiff --git a/server/internal/daemon/config_test.go b/server/internal/daemon/config_test.goindex a01f5b0ae6..2ccd606ee1 100644--- a/server/internal/daemon/config_test.go+++ b/server/internal/daemon/config_test.go@@ -927,6 +927,7 @@ func pinNonCodexAgentsToMissingPaths(t *testing.T) {"MULTICA_CURSOR_PATH","MULTICA_COPILOT_PATH","MULTICA_KIMI_PATH",+ "MULTICA_REASONIX_PATH","MULTICA_KIRO_PATH","MULTICA_GROK_PATH",} {diff --git a/server/internal/daemon/daemon.go b/server/internal/daemon/daemon.goindex 5a9af584af..f4669bed1d 100644--- a/server/internal/daemon/daemon.go+++ b/server/internal/daemon/daemon.go@@ -5254,6 +5254,13 @@ func (d *Daemon) runTask(ctx context.Context, task Task, provider string, slot iagentCustomEnv = task.Agent.CustomEnv}layerCustomEnvAndHermesHome(agentEnv, agentCustomEnv, env.HermesHome, d.logger)+ if provider == "reasonix" {+ reasonixStateHome, err := prepareReasonixTaskStateHome(d.cfg.Profile, task.RuntimeID, task.AgentID)+ if err != nil {+ return TaskResult{}, fmt.Errorf("prepare reasonix state home: %w", err)+ }+ agentEnv["REASONIX_STATE_HOME"] = reasonixStateHome+ }if err := configureCodexTaskShellEnvironment(provider, env.CodexHome, os.Environ(), agentEnv, agentCustomEnv, d.logger); err != nil {return TaskResult{}, err}@@ -6638,7 +6645,7 @@ func isBlockedEnvKey(key string) bool {return true}switch upper {- case "HOME", "PATH", "USER", "SHELL", "TERM", "TMPDIR", "TMP", "TEMP", "CODEX_HOME", "CURSOR_DATA_DIR", execenv.CursorMcpAuthSourceEnv, "OPENCLAW_CONFIG_PATH", "OPENCLAW_INCLUDE_ROOTS":+ case "HOME", "PATH", "USER", "SHELL", "TERM", "TMPDIR", "TMP", "TEMP", "CODEX_HOME", "REASONIX_STATE_HOME", "CURSOR_DATA_DIR", execenv.CursorMcpAuthSourceEnv, "OPENCLAW_CONFIG_PATH", "OPENCLAW_INCLUDE_ROOTS":return true}return false@@ -6701,6 +6708,49 @@ func layerCustomEnvAndHermesHome(agentEnv, customEnv map[string]string, overlayH}}+// prepareReasonixTaskStateHome isolates persisted transcripts and leases per+// (runtime, agent) while leaving REASONIX_HOME untouched. Current Reasonix+// reads credentials/config from REASONIX_HOME and state from+// REASONIX_STATE_HOME, so `reasonix setup` remains the sole credential owner+// and Multica never copies API keys into task-managed files.+func prepareReasonixTaskStateHome(profile, runtimeID, agentID string) (string, error) {+ profileDir, err := cli.ProfileDir(profile)+ if err != nil {+ return "", err+ }+ runtimeSegment, err := validateReasonixStateSegment("runtime", runtimeID)+ if err != nil {+ return "", err+ }+ agentSegment, err := validateReasonixStateSegment("agent", agentID)+ if err != nil {+ return "", err+ }+ path := filepath.Join(profileDir, "reasonix-state", runtimeSegment, agentSegment)+ if err := os.MkdirAll(path, 0o700); err != nil {+ return "", err+ }+ if err := os.Chmod(path, 0o700); err != nil {+ return "", err+ }+ return path, nil+}++func validateReasonixStateSegment(name, value string) (string, error) {+ if value == "" {+ return "", fmt.Errorf("%s ID is required", name)+ }+ for _, r := range value {+ switch {+ case r >= 'a' && r <= 'z', r >= 'A' && r <= 'Z', r >= '0' && r <= '9', r == '-', r == '_':+ continue+ default:+ return "", fmt.Errorf("%s ID contains an unsafe path character", name)+ }+ }+ return value, nil+}+// codexShellAuthorizedCustomEnvNames returns names from the current agent's// custom_env that pass the same daemon blocklist used when assembling the child// environment. Returning names only keeps credential values out of the manageddiff --git a/server/internal/daemon/daemon_test.go b/server/internal/daemon/daemon_test.goindex 2d00766479..e7cff787c8 100644--- a/server/internal/daemon/daemon_test.go+++ b/server/internal/daemon/daemon_test.go@@ -155,6 +155,7 @@ func TestIsBlockedEnvKey(t *testing.T) {{key: "tmp", want: true},{key: "TEMP", want: true},{key: "CODEX_HOME", want: true},+ {key: "REASONIX_STATE_HOME", want: true},{key: "CURSOR_DATA_DIR", want: true},{key: "cursor_data_dir", want: true},{key: "CURSOR_MCP_AUTH_SOURCE", want: true},@@ -167,6 +168,9 @@ func TestIsBlockedEnvKey(t *testing.T) {// bound the per-task overlay overrides it after custom_env is layered.{key: "HERMES_HOME", want: false},{key: "hermes_home", want: false},+ // Reasonix credentials/config remain tool-owned and may use a custom+ // home; only the daemon-owned state overlay is blocked above.+ {key: "REASONIX_HOME", want: false},}for _, tt := range tests {@@ -179,6 +183,55 @@ func TestIsBlockedEnvKey(t *testing.T) {}}+func TestPrepareReasonixTaskStateHome(t *testing.T) {+ home := t.TempDir()+ t.Setenv("HOME", home)+ t.Setenv("USERPROFILE", home)++ got, err := prepareReasonixTaskStateHome("work", "runtime-1", "agent_2")+ if err != nil {+ t.Fatalf("prepareReasonixTaskStateHome: %v", err)+ }+ want := filepath.Join(home, ".multica", "profiles", "work", "reasonix-state", "runtime-1", "agent_2")+ if got != want {+ t.Fatalf("state home = %q, want %q", got, want)+ }+ info, err := os.Stat(got)+ if err != nil {+ t.Fatalf("stat state home: %v", err)+ }+ if runtime.GOOS != "windows" && info.Mode().Perm() != 0o700 {+ t.Fatalf("state home mode = %o, want 700", info.Mode().Perm())+ }+}++func TestLayerCustomEnvKeepsReasonixCredentialsHomeButBlocksStateHome(t *testing.T) {+ t.Parallel()+ agentEnv := map[string]string{}+ layerCustomEnvAndHermesHome(agentEnv, map[string]string{+ "REASONIX_HOME": "/operator/reasonix-home",+ "REASONIX_STATE_HOME": "/unsafe/shared-state",+ }, "", nil)+ if got := agentEnv["REASONIX_HOME"]; got != "/operator/reasonix-home" {+ t.Fatalf("REASONIX_HOME = %q, want operator-owned home", got)+ }+ if _, ok := agentEnv["REASONIX_STATE_HOME"]; ok {+ t.Fatal("daemon-owned REASONIX_STATE_HOME accepted a custom override")+ }+}++func TestValidateReasonixStateSegmentRejectsTraversal(t *testing.T) {+ t.Parallel()+ for _, value := range []string{"", "../agent", "runtime/agent", "agent id"} {+ if _, err := validateReasonixStateSegment("agent", value); err == nil {+ t.Errorf("validateReasonixStateSegment(%q) succeeded, want error", value)+ }+ }+ if got, err := validateReasonixStateSegment("agent", "agent-1_uuid"); err != nil || got != "agent-1_uuid" {+ t.Fatalf("safe segment = %q, %v", got, err)+ }+}+// TestLayerCustomEnvAndHermesHome exercises the daemon-assembled child env for// HERMES_HOME: no overlay passes the user's value through, an overlay overrides// it, and blocklisted keys are still dropped.@@ -573,6 +626,8 @@ func TestProviderNeedsInlineSystemPrompt(t *testing.T) {// runtime brief duplicates it at the start of every user turn.{provider: "kiro", want: false},{provider: "kimi", want: true},+ // Reasonix loads AGENTS.md from the ACP session cwd.+ {provider: "reasonix", want: false},{provider: "traecli", want: true},// Qwen Code loads the per-task QWEN.md file natively.{provider: "qwen", want: false},@@ -2438,7 +2493,7 @@ func TestShouldRetryWithFreshSession_CompatPathIsBackendScoped(t *testing.T) {})}- detectable := []string{"claude", "codebuddy", "qwen", "codex", "grok", "hermes", "kimi", "kiro", "qoder", "qoderclicn", "traecli", "pi", "openclaw"}+ detectable := []string{"claude", "codebuddy", "qwen", "codex", "grok", "hermes", "kimi", "reasonix", "kiro", "qoder", "qoderclicn", "traecli", "pi", "openclaw"}for _, provider := range detectable {t.Run(provider+" does not retry", func(t *testing.T) {t.Parallel()diff --git a/server/internal/daemon/execenv/context.go b/server/internal/daemon/execenv/context.goindex dce31b7bb2..cc7a25b6ab 100644--- a/server/internal/daemon/execenv/context.go+++ b/server/internal/daemon/execenv/context.go@@ -129,6 +129,7 @@ func writeWorkspacesRootMarkerAtomic(path string, data []byte) error {// Pi: skills → {workDir}/.pi/skills/{name}/SKILL.md (native discovery)// Cursor: skills → {workDir}/.cursor/skills/{name}/SKILL.md (native discovery)// Kimi: skills → {workDir}/.kimi/skills/{name}/SKILL.md (native discovery)+// Reasonix: skills → {workDir}/.reasonix/skills/{name}/SKILL.md (native discovery)// Kiro: skills → {workDir}/.kiro/skills/{name}/SKILL.md (native discovery)// Qoder/Qoder CN: skills → {workDir}/.qoder/skills/{name}/SKILL.md (project-level; see the provider docs)// Qwen Code: skills → {workDir}/.qwen/skills/{name}/SKILL.md (native project-level discovery)@@ -382,6 +383,10 @@ func skillsDirPath(workDir, provider string) string {// Kimi Code CLI auto-discovers project-level skills from .kimi/skills/// in the workdir. See https://moonshotai.github.io/kimi-cli/en/customization/skills.htmlreturn filepath.Join(workDir, ".kimi", "skills")+ case "reasonix":+ // Reasonix discovers project skills from .reasonix/skills/ and loads+ // AGENTS.md independently, so repository memory and task skills coexist.+ return filepath.Join(workDir, ".reasonix", "skills")case "kiro":// Kiro CLI auto-discovers project-level skills from .kiro/skills/// in the workdir.diff --git a/server/internal/daemon/execenv/execenv_test.go b/server/internal/daemon/execenv/execenv_test.goindex db25194818..0f3896fc2a 100644--- a/server/internal/daemon/execenv/execenv_test.go+++ b/server/internal/daemon/execenv/execenv_test.go@@ -1951,7 +1951,7 @@ func TestInjectRuntimeConfigCommentGuardrailIsProviderAgnostic(t *testing.T) {t.Cleanup(func() { runtimeGOOS = saved })for _, host := range []string{"linux", "darwin", "windows"} {- for _, provider := range []string{"claude", "opencode", "openclaw", "hermes", "kimi", "kiro", "cursor"} {+ for _, provider := range []string{"claude", "opencode", "openclaw", "hermes", "kimi", "reasonix", "kiro", "cursor"} {t.Run(provider+"/"+host, func(t *testing.T) {runtimeGOOS = hostdir := t.TempDir()diff --git a/server/internal/daemon/execenv/reply_instructions_test.go b/server/internal/daemon/execenv/reply_instructions_test.goindex b53a6241a6..7e8d430890 100644--- a/server/internal/daemon/execenv/reply_instructions_test.go+++ b/server/internal/daemon/execenv/reply_instructions_test.go@@ -78,7 +78,7 @@ func TestBuildCommentReplyInstructionsNonCodexLinux(t *testing.T) {triggerID := "22222222-2222-2222-2222-222222222222"for _, host := range []string{"linux", "darwin"} {- for _, provider := range []string{"claude", "opencode", "openclaw", "hermes", "kimi", "kiro", "cursor"} {+ for _, provider := range []string{"claude", "opencode", "openclaw", "hermes", "kimi", "reasonix", "kiro", "cursor"} {name := provider + "/" + hostt.Run(name, func(t *testing.T) {runtimeGOOS = host@@ -133,7 +133,7 @@ func TestBuildCommentReplyInstructionsWindowsUsesContentFile(t *testing.T) {issueID := "11111111-1111-1111-1111-111111111111"triggerID := "22222222-2222-2222-2222-222222222222"- for _, provider := range []string{"codex", "claude", "opencode", "openclaw", "hermes", "kimi", "kiro", "cursor"} {+ for _, provider := range []string{"codex", "claude", "opencode", "openclaw", "hermes", "kimi", "reasonix", "kiro", "cursor"} {t.Run(provider+"/windows", func(t *testing.T) {got := BuildCommentReplyInstructions(provider, issueID, triggerID)for _, want := range []string{diff --git a/server/internal/daemon/execenv/runtime_config.go b/server/internal/daemon/execenv/runtime_config.goindex b34171d3a4..bd24dba200 100644--- a/server/internal/daemon/execenv/runtime_config.go+++ b/server/internal/daemon/execenv/runtime_config.go@@ -167,6 +167,7 @@ func formatProjectResource(r ProjectResourceForEnv) string {// For Pi: writes {workDir}/AGENTS.md (skills discovered natively from .pi/skills/)// For Cursor: writes {workDir}/AGENTS.md (skills discovered natively from .cursor/skills/)// For Kimi: writes {workDir}/AGENTS.md (Kimi Code CLI reads AGENTS.md natively; skills auto-discovered from project skills dirs)+// For Reasonix: writes {workDir}/AGENTS.md (Reasonix reads AGENTS.md and .reasonix/skills/ natively)// For Kiro: writes {workDir}/AGENTS.md (Kiro CLI reads AGENTS.md natively; skills auto-discovered from project skills dirs)// For Qoder/Qoder CN: writes {workDir}/AGENTS.md (skills discovered from .qoder/skills/; user-level roots are unaffected)// For Antigravity: writes {workDir}/AGENTS.md (agy CLI reads AGENTS.md natively; skills discovered natively from .agents/skills/ — see https://antigravity.google/docs/gcli-migration)@@ -201,7 +202,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", "deveco", "openclaw", "hermes", "pi", "cursor", "kimi", "kiro", "antigravity", "qoder", "qoderclicn", "traecli", "grok", "qwenpaw":+ case "codex", "copilot", "opencode", "deveco", "openclaw", "hermes", "pi", "cursor", "kimi", "reasonix", "kiro", "antigravity", "qoder", "qoderclicn", "traecli", "grok", "qwenpaw":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 b877e887a8..68f96201d3 100644--- a/server/internal/daemon/execenv/runtime_config_test.go+++ b/server/internal/daemon/execenv/runtime_config_test.go@@ -867,6 +867,7 @@ func TestInjectRuntimeConfigPreservesUserContent(t *testing.T) {{"pi", "AGENTS.md"},{"cursor", "AGENTS.md"},{"kimi", "AGENTS.md"},+ {"reasonix", "AGENTS.md"},{"kiro", "AGENTS.md"},{"antigravity", "AGENTS.md"},{"qwen", "QWEN.md"},@@ -1241,6 +1242,7 @@ func TestCleanupRuntimeConfigByProvider(t *testing.T) {{"pi", "AGENTS.md"},{"cursor", "AGENTS.md"},{"kimi", "AGENTS.md"},+ {"reasonix", "AGENTS.md"},{"kiro", "AGENTS.md"},{"antigravity", "AGENTS.md"},{"qwen", "QWEN.md"},diff --git a/server/internal/daemon/execenv/sidecar_manifest.go b/server/internal/daemon/execenv/sidecar_manifest.goindex 0e84ecf49e..261a4424a9 100644--- a/server/internal/daemon/execenv/sidecar_manifest.go+++ b/server/internal/daemon/execenv/sidecar_manifest.go@@ -264,7 +264,7 @@ func writeSidecarManifest(envRoot string, m *sidecarManifest) error {// AGENTS.md, this one handles the sidecar tree// (.agent_context/, .multica/, .claude/skills/, .github/skills/,// .opencode/skills/, skills/, .pi/skills/, .cursor/skills/,-// .kimi/skills/, .kiro/skills/, .agents/skills/, fallback+// .kimi/skills/, .reasonix/skills/, .kiro/skills/, .agents/skills/, fallback// .agent_context/skills/). The two together restore the workdir to// byte-exact pre-task state.func CleanupSidecars(envRoot string) error {diff --git a/server/internal/daemon/execenv/sidecar_manifest_test.go b/server/internal/daemon/execenv/sidecar_manifest_test.goindex e3ca13dbc4..c7022d7f9b 100644--- a/server/internal/daemon/execenv/sidecar_manifest_test.go+++ b/server/internal/daemon/execenv/sidecar_manifest_test.go@@ -153,6 +153,7 @@ var allFileBasedProviders = []string{"pi","cursor","kimi",+ "reasonix","kiro","antigravity","qwen",@@ -233,6 +234,7 @@ func TestPrepareThenCleanupSidecarsPreservesUserSkillSibling(t *testing.T) {{"pi", filepath.Join(".pi", "skills", "my-own"), "SKILL.md"},{"cursor", filepath.Join(".cursor", "skills", "my-own"), "SKILL.md"},{"kimi", filepath.Join(".kimi", "skills", "my-own"), "SKILL.md"},+ {"reasonix", filepath.Join(".reasonix", "skills", "my-own"), "SKILL.md"},{"kiro", filepath.Join(".kiro", "skills", "my-own"), "SKILL.md"},{"antigravity", filepath.Join(".agents", "skills", "my-own"), "SKILL.md"},{"qwen", filepath.Join(".qwen", "skills", "my-own"), "SKILL.md"},@@ -298,6 +300,7 @@ func TestPrepareThenCleanupSidecarsPreservesUnrelatedUserFiles(t *testing.T) {{"pi", filepath.Join(".pi", "config.toml")},{"cursor", filepath.Join(".cursor", "settings.json")},{"kimi", filepath.Join(".kimi", "config.json")},+ {"reasonix", filepath.Join(".reasonix", "config.toml")},{"kiro", filepath.Join(".kiro", "config.json")},{"antigravity", filepath.Join(".agents", "config.json")},{"qwen", filepath.Join(".qwen", "settings.json")},@@ -627,6 +630,7 @@ var sameSlugSkillProviderCases = []struct {{"pi", filepath.Join(".pi", "skills", "issue-review")},{"cursor", filepath.Join(".cursor", "skills", "issue-review")},{"kimi", filepath.Join(".kimi", "skills", "issue-review")},+ {"reasonix", filepath.Join(".reasonix", "skills", "issue-review")},{"kiro", filepath.Join(".kiro", "skills", "issue-review")},{"antigravity", filepath.Join(".agents", "skills", "issue-review")},{"qwen", filepath.Join(".qwen", "skills", "issue-review")},diff --git a/server/internal/daemon/local_skills.go b/server/internal/daemon/local_skills.goindex bf436a8842..3ab7a8ca90 100644--- a/server/internal/daemon/local_skills.go+++ b/server/internal/daemon/local_skills.go@@ -160,6 +160,12 @@ func localSkillRootsForProvider(provider string) ([]localSkillRoot, bool, error)providerRoot = filepath.Join(home, ".hermes", "skills")case "kimi":providerRoot = filepath.Join(home, ".kimi", "skills")+ case "reasonix":+ reasonixHome := strings.TrimSpace(os.Getenv("REASONIX_HOME"))+ if reasonixHome == "" {+ reasonixHome = filepath.Join(home, ".reasonix")+ }+ providerRoot = filepath.Join(reasonixHome, "skills")case "kiro":providerRoot = filepath.Join(home, ".kiro", "skills")case "qoder":diff --git a/server/internal/daemon/local_skills_test.go b/server/internal/daemon/local_skills_test.goindex 66d3ada54e..3a1f50db3a 100644--- a/server/internal/daemon/local_skills_test.go+++ b/server/internal/daemon/local_skills_test.go@@ -278,6 +278,12 @@ func TestLocalSkills_DiscoversACPProviderRoots(t *testing.T) {wantPath: "~/.kimi/skills/review-helper",wantName: "Kimi Review",},+ {+ provider: "reasonix",+ root: filepath.Join(".reasonix", "skills"),+ wantPath: "~/.reasonix/skills/review-helper",+ wantName: "Reasonix Review",+ },{provider: "qoder",root: filepath.Join(".qoder", "skills"),@@ -314,6 +320,9 @@ func TestLocalSkills_DiscoversACPProviderRoots(t *testing.T) {if tc.provider == "qwen" {t.Setenv("QWEN_HOME", "")}+ if tc.provider == "reasonix" {+ t.Setenv("REASONIX_HOME", "")+ }writeTestLocalSkill(t, filepath.Join(home, tc.root), "review-helper", map[string]string{"SKILL.md": "---\nname: " + tc.wantName + "\ndescription: Review code\n---\n# Review\n",diff --git a/server/internal/metrics/labels.go b/server/internal/metrics/labels.goindex c4cea46027..fd9cc23a8b 100644--- a/server/internal/metrics/labels.go+++ b/server/internal/metrics/labels.go@@ -127,6 +127,7 @@ var ("hermes": "hermes","kiro": "kiro","kimi": "kimi",+ "reasonix": "reasonix","multica_agent": "multica_agent","openclaw": "openclaw","opencode": "opencode",diff --git a/server/internal/metrics/labels_test.go b/server/internal/metrics/labels_test.goindex bb8d474b58..d4b6a917cc 100644--- a/server/internal/metrics/labels_test.go+++ b/server/internal/metrics/labels_test.go@@ -21,6 +21,7 @@ func TestNormalizeRuntimeProviderRecognizesKnownProviders(t *testing.T) {{input: "Qoder", want: "qoder"},{input: "QODERCLICN", want: "qoderclicn"},{input: "TraeCLI", want: "traecli"},+ {input: "Reasonix", want: "reasonix"},}for _, tt := range tests {if got := NormalizeRuntimeProvider(tt.input); got != tt.want {diff --git a/server/migrations/254_runtime_profile_add_reasonix.down.sql b/server/migrations/254_runtime_profile_add_reasonix.down.sqlnew file mode 100644index 0000000000..b5d8186c2e--- /dev/null+++ b/server/migrations/254_runtime_profile_add_reasonix.down.sql@@ -0,0 +1,26 @@+-- Restore the pre-254 whitelist. Existing Reasonix rows remain valid because+-- the replacement constraint is NOT VALID, but new Reasonix 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',+ 'openclaw',+ 'hermes',+ 'pi',+ 'cursor',+ 'kimi',+ 'kiro',+ 'antigravity',+ 'qoder',+ 'qoderclicn',+ 'traecli',+ 'deveco',+ 'grok',+ 'qwen',+ 'qwenpaw'+ )) NOT VALID;diff --git a/server/migrations/254_runtime_profile_add_reasonix.up.sql b/server/migrations/254_runtime_profile_add_reasonix.up.sqlnew file mode 100644index 0000000000..1679ae2ca8--- /dev/null+++ b/server/migrations/254_runtime_profile_add_reasonix.up.sql@@ -0,0 +1,27 @@+-- Add Reasonix as a first-party ACP 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',+ 'openclaw',+ 'hermes',+ 'pi',+ 'cursor',+ 'kimi',+ 'reasonix',+ 'kiro',+ 'antigravity',+ 'qoder',+ 'qoderclicn',+ 'traecli',+ 'deveco',+ 'grok',+ 'qwen',+ 'qwenpaw'+ )) NOT VALID;diff --git a/server/pkg/agent/acp_deliverable_test.go b/server/pkg/agent/acp_deliverable_test.goindex 4d43d9ee71..1c44b752ff 100644--- a/server/pkg/agent/acp_deliverable_test.go+++ b/server/pkg/agent/acp_deliverable_test.go@@ -166,6 +166,7 @@ type acpDeliverableCase struct {var acpDeliverableCases = []acpDeliverableCase{{backend: "hermes", binary: "hermes", notification: "session/update"},{backend: "kimi", binary: "kimi", notification: "session/update"},+ {backend: "reasonix", binary: "reasonix", notification: "session/update"},{backend: "traecli", binary: "traecli", notification: "session/update"},{backend: "grok", binary: "grok", notification: "session/update"},{backend: "kiro", binary: "kiro-cli", notification: "session/notification", camelUpdates: true},diff --git a/server/pkg/agent/agent.go b/server/pkg/agent/agent.goindex 1a4ce32164..dab86bf8d8 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, Cursor, Kimi, Kiro, Antigravity, Qoder, Trae, Grok,-// Qwen Code). It+// OpenClaw, Hermes, Pi, Cursor, Kimi, Reasonix, Kiro, Antigravity, Qoder,+// Trae, Grok, Qwen Code, QwenPaw). It// mirrors the happy-cli AgentBackend pattern, translated to idiomatic Go.package agent@@ -207,7 +207,7 @@ type Result struct {// Config configures a Backend instance.type Config struct {- ExecutablePath string // path to CLI binary (claude, codebuddy, codex, copilot, opencode, openclaw, hermes, pi, cursor, kimi, kiro-cli, agy, qodercli, qoderclicn, traecli, grok, qwen)+ ExecutablePath string // path to CLI binary (claude, codebuddy, codex, copilot, opencode, openclaw, hermes, pi, cursor, kimi, reasonix, kiro-cli, agy, qodercli, qoderclicn, traecli, grok, qwen, qwenpaw)CLIVersion string // detected version paired with ExecutablePath; observation only, never used to choose behaviorEnv map[string]string // extra environment variablesLogger *slog.Logger@@ -218,14 +218,15 @@ type Config struct {}// New creates a Backend for the given agent type.-// Supported types: "claude", "codebuddy", "codex", "copilot", "opencode", "deveco", "openclaw", "hermes", "pi", "cursor", "kimi", "kiro", "antigravity", "qoder", "qoderclicn", "traecli", "grok", "qwen", "qwenpaw".+// Supported types: "claude", "codebuddy", "codex", "copilot", "opencode", "deveco", "openclaw", "hermes", "pi", "cursor", "kimi", "reasonix", "kiro", "antigravity", "qoder", "qoderclicn", "traecli", "grok", "qwen", "qwenpaw".//// SupportedTypes is the canonical whitelist of agent types eligible to back a// custom runtime profile. It MUST stay in lockstep with the// runtime_profile.protocol_family CHECK constraint (migration 120, widened by// migration 134 to add qoder, migration 136 to add traecli, migration 175 to-// add deveco, migration 179 to add grok, migration 202 to add qwen, and-// migration 242 to add qoderclicn): a+// add deveco, migration 179 to add grok, migration 202 to add qwen,+// migration 242 to add qoderclicn, migration 253 to add qwenpaw, and+// migration 254 to add reasonix): a// custom runtime profile may only// be based on a backend Multica officially supports.// qoder and qoderclicn share the same ACP backend; keeping both provider keys@@ -247,6 +248,7 @@ var SupportedTypes = []string{"pi","cursor","kimi",+ "reasonix","kiro","antigravity","qoder",@@ -324,6 +326,8 @@ func New(agentType string, cfg Config) (Backend, error) {return &cursorBackend{cfg: cfg}, nilcase "kimi":return &kimiBackend{cfg: cfg}, nil+ case "reasonix":+ return &reasonixBackend{cfg: cfg}, nilcase "kiro":return &kiroBackend{cfg: cfg}, nilcase "antigravity":@@ -339,7 +343,7 @@ func New(agentType string, cfg Config) (Backend, error) {case "qwenpaw":return &qwenpawBackend{cfg: cfg}, nildefault:- return nil, fmt.Errorf("unknown agent type: %q (supported: claude, codebuddy, codex, copilot, opencode, deveco, openclaw, hermes, pi, cursor, kimi, kiro, antigravity, qoder, qoderclicn, traecli, grok, qwen, qwenpaw)", agentType)+ return nil, fmt.Errorf("unknown agent type: %q (supported: claude, codebuddy, codex, copilot, opencode, deveco, openclaw, hermes, pi, cursor, kimi, reasonix, kiro, antigravity, qoder, qoderclicn, traecli, grok, qwen, qwenpaw)", agentType)}}@@ -364,6 +368,7 @@ var launchHeaders = map[string]string{"deveco": "deveco run (json)","hermes": "hermes acp","kimi": "kimi acp",+ "reasonix": "reasonix acp","kiro": "kiro-cli acp","openclaw": "openclaw agent (json)","opencode": "opencode run (json)",diff --git a/server/pkg/agent/agent_supported_types_test.go b/server/pkg/agent/agent_supported_types_test.goindex 82f1f74015..121bf0c19f 100644--- a/server/pkg/agent/agent_supported_types_test.go+++ b/server/pkg/agent/agent_supported_types_test.go@@ -39,7 +39,7 @@ func TestSupportedTypesMatchesMigrationWhitelist(t *testing.T) {want := map[string]bool{"claude": true, "codebuddy": true, "codex": true, "copilot": true,"opencode": true, "deveco": true, "openclaw": true, "hermes": true,- "pi": true, "cursor": true, "kimi": true, "kiro": true, "antigravity": true,+ "pi": true, "cursor": true, "kimi": true, "reasonix": true, "kiro": true, "antigravity": true,"qoder": true, "qoderclicn": true, "traecli": true, "grok": true, "qwen": true, "qwenpaw": true,}if len(SupportedTypes) != len(want) {diff --git a/server/pkg/agent/hermes.go b/server/pkg/agent/hermes.goindex e16140d090..ea1110e0aa 100644--- a/server/pkg/agent/hermes.go+++ b/server/pkg/agent/hermes.go@@ -758,6 +758,15 @@ type hermesClient struct {sessionID stringonMessage func(Message)onPromptDone func(hermesPromptResult)+ // selectPermission lets an ACP dialect narrow the generic headless+ // permission policy. Reasonix uses this to reject user questions and+ // fresh-human approvals that also happen to carry allow_once options.+ // Nil preserves the shared ACP policy for existing backends.+ selectPermission func(json.RawMessage) (optionID string, grant bool, ok bool)+ // onNotification observes vendor notifications that are not session/update.+ // Existing backends leave it nil; the callback must do its own method and+ // lifecycle filtering.+ onNotification func(method string, params json.RawMessage)// onActivity observes accepted ACP session updates. Hermes and Grok use it// to retain a short post-response drain window; other ACP backends leave it// nil and keep their existing lifecycle behavior.@@ -913,7 +922,11 @@ func (c *hermesClient) handleAgentRequest(raw map[string]json.RawMessage) {var resp map[string]anyswitch method {case "session/request_permission":- optionID, grant, ok := selectACPPermissionOption(raw["params"])+ selector := c.selectPermission+ if selector == nil {+ selector = selectACPPermissionOption+ }+ optionID, grant, ok := selector(raw["params"])if ok {// Select an offered option — either a safe grant (approve) or,// when no safe grant exists, an offered reject_once (deny THIS@@ -1098,8 +1111,9 @@ func (e *acpRPCError) Error() string {// (Internal error), Kiro puts "No session found with id ..." in// `data` under -32603, and kimi-cli raises invalid_params (-32602)// with {"session_id": "Session not found"} in `data` for every-// unknown-session path (src/kimi_cli/acp/server.py) — so neither the-// code nor the text alone is discriminating and both are matched.+// unknown-session path (src/kimi_cli/acp/server.py), while Reasonix says+// "session/resume: unknown session <id>" under -32602 — so neither the+// code nor one runtime's exact wording is discriminating and both are matched.func isACPSessionNotFound(err error) bool {var rpcErr *acpRPCErrorif !errors.As(err, &rpcErr) {@@ -1110,7 +1124,8 @@ func isACPSessionNotFound(err error) bool {}text := strings.ToLower(rpcErr.Message + " " + rpcErr.Data)return strings.Contains(text, "session not found") ||- strings.Contains(text, "no session found")+ strings.Contains(text, "no session found") ||+ strings.Contains(text, "unknown session")}// hermesResumeLostError is the fallback reason for a resumed session Hermes@@ -1283,6 +1298,9 @@ func parseACPModelIDFromMeta(meta json.RawMessage) string {func (c *hermesClient) handleNotification(raw map[string]json.RawMessage) {var method string_ = json.Unmarshal(raw["method"], &method)+ if c.onNotification != nil {+ c.onNotification(method, raw["params"])+ }if method != "session/update" && method != "session/notification" {returndiff --git a/server/pkg/agent/hermes_test.go b/server/pkg/agent/hermes_test.goindex 028ff179a2..cbb1a2deea 100644--- a/server/pkg/agent/hermes_test.go+++ b/server/pkg/agent/hermes_test.go@@ -2142,7 +2142,7 @@ func TestHermesProviderErrorSnifferLongRealErrorStillFails(t *testing.T) {t.Fatalf("fixture is %d bytes, must exceed the cap %d to exercise the path", len(longReal), acpMaxErrorLineLen)}- for _, provider := range []string{"hermes", "kimi", "kiro", "qoder", "grok", "traecli"} {+ for _, provider := range []string{"hermes", "kimi", "reasonix", "kiro", "qoder", "grok", "traecli"} {t.Run(provider, func(t *testing.T) {s := newACPProviderErrorSniffer(provider)if _, err := s.Write([]byte(longReal + "\n")); err != nil {diff --git a/server/pkg/agent/models.go b/server/pkg/agent/models.goindex 261a12b3d4..48b63ecff4 100644--- a/server/pkg/agent/models.go+++ b/server/pkg/agent/models.go@@ -169,6 +169,10 @@ func ListModels(ctx context.Context, providerType, executablePath string) (Catalreturn cachedDiscovery(providerType, func() (Catalog, error) {return discovered(discoverKimiModels(ctx, executablePath))})+ case "reasonix":+ return cachedDiscovery(providerType, func() (Catalog, error) {+ return discovered(discoverReasonixModels(ctx, executablePath))+ })case "kiro":return cachedDiscovery(providerType, func() (Catalog, error) {return discovered(discoverKiroModels(ctx, executablePath))@@ -229,7 +233,7 @@ func ListModels(ctx context.Context, providerType, executablePath string) (Catal// any effect for the given provider. Every built-in provider now honours// `opts.Model` end-to-end — Hermes routes it through the ACP// `session/set_model` RPC before each prompt; Claude / Codex / Cursor /-// Gemini / Copilot / Kimi / Kiro / OpenCode / OpenClaw / Pi / Antigravity+// Gemini / Copilot / Kimi / Reasonix / Kiro / OpenCode / OpenClaw / Pi / Antigravity// pass it via flag or session config (Antigravity gained `--model` in agy// 1.0.6 — MUL-3125).//@@ -899,6 +903,20 @@ func discoverKimiModels(ctx context.Context, executablePath string) ([]Model, er})}+// discoverReasonixModels drives a short Reasonix ACP session and parses the+// model configOptions advertised by session/new. Authentication and provider+// configuration remain owned by `reasonix setup`; discovery failure therefore+// falls back to manual model entry like the other ACP runtimes.+func discoverReasonixModels(ctx context.Context, executablePath string) ([]Model, error) {+ return discoverACPModels(ctx, executablePath, acpDiscoveryProvider{+ defaultBin: "reasonix",+ clientName: "multica-model-discovery",+ acpArgs: reasonixACPLaunchArgs(),+ tmpdirPrefix: "multica-reasonix-discovery-",+ isolatedStateEnv: "REASONIX_STATE_HOME",+ })+}+// discoverKiroModels spins up a throwaway `kiro-cli acp` process and parses// the models block Kiro returns from session/new.func discoverKiroModels(ctx context.Context, executablePath string) ([]Model, error) {@@ -967,10 +985,11 @@ func discoverQoderModels(ctx context.Context, executablePath, defaultBin string)// `--acp`), and what to label temporary work directories so they're// easy to identify in logs.type acpDiscoveryProvider struct {- defaultBin string- clientName string- extraEnv []string- tmpdirPrefix string+ defaultBin string+ clientName string+ extraEnv []string+ tmpdirPrefix string+ isolatedStateEnv string// acpArgs is the argv passed to the binary to start it in ACP// server mode. Defaults to []string{"acp"} when nil/empty.acpArgs []string@@ -1010,6 +1029,15 @@ func discoverACPModels(ctx context.Context, executablePath string, p acpDiscover}runCtx, cancel := context.WithTimeout(ctx, 15*time.Second)defer cancel()+ var isolatedStateDir string+ if p.isolatedStateEnv != "" {+ var err error+ isolatedStateDir, err = os.MkdirTemp("", p.tmpdirPrefix+"state-")+ if err != nil {+ return fail("temporary state", err)+ }+ defer os.RemoveAll(isolatedStateDir)+ }cmdArgs := p.acpArgsif len(cmdArgs) == 0 {@@ -1018,6 +1046,9 @@ func discoverACPModels(ctx context.Context, executablePath string, p acpDiscovercmd := exec.CommandContext(runCtx, executablePath, cmdArgs...)hideAgentWindow(cmd)childEnv := append(os.Environ(), p.extraEnv...)+ if isolatedStateDir != "" {+ childEnv = replaceEnvValue(childEnv, p.isolatedStateEnv, isolatedStateDir)+ }cmd.Env = childEnvstdin, err := cmd.StdinPipe()if err != nil {@@ -1169,6 +1200,18 @@ func discoverACPModels(ctx context.Context, executablePath string, p acpDiscoverreturn models, nil}+func replaceEnvValue(env []string, key, value string) []string {+ out := make([]string, 0, len(env)+1)+ for _, entry := range env {+ name, _, _ := strings.Cut(entry, "=")+ if strings.EqualFold(name, key) {+ continue+ }+ out = append(out, entry)+ }+ return append(out, key+"="+value)+}+// parseACPSessionNewModels extracts the model catalog from an ACP// `session/new` response. Hermes and older Kimi (and any other ACP// agent that follows that schema) emit:@@ -1749,7 +1792,7 @@ func isOpenclawIdentifier(s string) bool {// ── CodeBuddy model discovery ──// discoverCodebuddyModels asks CodeBuddy for its catalog over ACP-// (`codebuddy --acp`), the same handshake Copilot / Kimi / Kiro / Qoder / Grok /+// (`codebuddy --acp`), the same handshake Copilot / Kimi / Reasonix / Kiro / Qoder / Grok /// TRAE already use. `session/new` answers with a structured catalog under// `models.availableModels` plus a `currentModelId`, which is what the shared// parseACPSessionNewModels reads.diff --git a/server/pkg/agent/reasonix.go b/server/pkg/agent/reasonix.gonew file mode 100644index 0000000000..de5a3beae0--- /dev/null+++ b/server/pkg/agent/reasonix.go@@ -0,0 +1,795 @@+package agent++import (+ "bufio"+ "context"+ "encoding/json"+ "errors"+ "fmt"+ "io"+ "log/slog"+ "math"+ "os/exec"+ "strings"+ "sync"+ "sync/atomic"+ "time"+)++// reasonixBlockedArgs are flags hardcoded by the daemon that must not be+// overridden by user-configured custom_args. `acp` is the protocol+// subcommand that drives the ACP JSON-RPC transport for the Reasonix CLI;+// overriding it would break the daemon↔Reasonix communication contract.+var reasonixBlockedArgs = map[string]blockedArgMode{+ "acp": blockedStandalone,+ "--model": blockedWithValue,+ "--profile": blockedWithValue,+ "--planner": blockedWithValue,+ "--sandbox-network": blockedWithValue,+ "--sandbox-bash": blockedWithValue,+ "--workspace-only": blockedStandalone,+}++func reasonixACPLaunchArgs() []string {+ // Let Reasonix enforce bash sandboxing where the host supports it and+ // degrade according to its host configuration where it does not.+ return []string{+ "acp",+ "--profile", "balanced",+ "--planner", "auto",+ "--sandbox-network", "auto",+ "--sandbox-bash", "auto",+ "--workspace-only",+ }+}++// reasonixReaderDrainGrace bounds how long the turn waits for trailing ACP+// notifications after the session/prompt response. A var, not a const, so+// tests can shorten it. Mirrors qoderReaderDrainGrace / traecliReaderDrainGrace.+var reasonixReaderDrainGrace = 2 * time.Second++// reasonixBackend implements Backend by spawning `reasonix acp` and communicating+// via the ACP (Agent Client Protocol) JSON-RPC 2.0 over stdin/stdout.+//+// Reasonix (https://github.com/esengine/DeepSeek-Reasonix) supports ACP out of+// the box via the `reasonix acp` subcommand. We reuse the existing hermesClient+// transport but keep Reasonix-specific permission, status-usage, and error+// semantics in this adapter.+type reasonixBackend struct {+ cfg Config+}++func (b *reasonixBackend) Execute(ctx context.Context, prompt string, opts ExecOptions) (*Session, error) {+ execPath := b.cfg.ExecutablePath+ if execPath == "" {+ execPath = "reasonix"+ }+ if _, err := exec.LookPath(execPath); err != nil {+ return nil, fmt.Errorf("reasonix executable not found at %q: %w", execPath, err)+ }++ // Translate the agent's mcp_config (Claude-style object of objects)+ // into the array shape ACP `session/new` expects. Fail closed on+ // malformed JSON so the launch surfaces the real error instead of+ // silently dropping all MCP servers.+ mcpServers, err := buildACPMcpServers(opts.McpConfig, b.cfg.Logger)+ if err != nil {+ return nil, fmt.Errorf("reasonix: invalid mcp_config: %w", err)+ }++ timeout := opts.Timeout+ runCtx, cancel := runContext(ctx, timeout)++ // Reasonix multiplexes ordinary tool approvals, protected decisions, and+ // user questions through session/request_permission. The adapter below+ // narrows the generic auto-approval policy; --workspace-only independently+ // keeps configured extra write roots out of unattended tasks.+ reasonixArgs := append(reasonixACPLaunchArgs(), filterCustomArgs(opts.CustomArgs, reasonixBlockedArgs, b.cfg.Logger)...)+ cmd := exec.CommandContext(runCtx, execPath, reasonixArgs...)+ hideAgentWindow(cmd)+ b.cfg.Logger.Info("agent command", "exec", execPath, "args", reasonixArgs)+ 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("reasonix stdout pipe: %w", err)+ }+ stdin, err := cmd.StdinPipe()+ if err != nil {+ cancel()+ return nil, fmt.Errorf("reasonix stdin pipe: %w", err)+ }+ // Forward stderr to the daemon log *and* sniff provider-level+ // errors out of it so we can surface them in the task result.+ // Keep provider-level stderr failures visible in the task result even when+ // the ACP prompt response itself does not preserve their full detail.+ //+ // StderrPipe + an explicit copier give us a join point+ // (`stderrDone`) that fires before the failure-promotion+ // decision; see the matching comment in hermes.go for why the+ // io.MultiWriter form races with stopReason=end_turn under load.+ providerErr := newACPProviderErrorSniffer("reasonix")+ stderr, err := cmd.StderrPipe()+ if err != nil {+ cancel()+ return nil, fmt.Errorf("reasonix stderr pipe: %w", err)+ }++ if err := cmd.Start(); err != nil {+ cancel()+ return nil, fmt.Errorf("start reasonix: %w", err)+ }++ stderrSink := io.MultiWriter(newLogWriter(b.cfg.Logger, "[reasonix:stderr] "), providerErr)+ stderrDone := make(chan struct{})+ go func() {+ defer close(stderrDone)+ _, _ = io.Copy(stderrSink, stderr)+ }()++ b.cfg.Logger.Info("reasonix acp started", "pid", cmd.Process.Pid, "cwd", opts.Cwd)++ msgCh := make(chan Message, 256)+ resCh := make(chan Result, 1)++ // Reasonix streams interim narration and the final answer as the same+ // agent_message_chunk type; the tracker keeps only the post-tool-call block+ // for Result.Output while retaining the full text for error detection.+ var deliverable acpDeliverableTracker+ // streamingCurrentTurn gates all session updates so that history replay+ // (Reasonix sends full prior-turn transcripts on session/resume, and may+ // flush queued chunks before our session/prompt response streams) is+ // dropped instead of duplicating the previous answer into output. We+ // flip it to true only after session/prompt is sent.+ var streamingCurrentTurn atomic.Bool+ var blockedQuestion atomic.Value // string; set by the stdout reader+ var statusUsage reasonixStatusUsageTracker+ var promptUsageMu sync.Mutex+ var promptUsage TokenUsage++ promptDone := make(chan hermesPromptResult, 1)+ activity := make(chan struct{}, 1)++ // Reuse the hermesClient ACP transport — Reasonix speaks the same protocol.+ c := &hermesClient{+ cfg: b.cfg,+ stdin: stdin,+ pending: make(map[int]*pendingRPC),+ pendingTools: make(map[string]*pendingToolCall),+ acceptNotification: func(string) bool {+ return streamingCurrentTurn.Load()+ },+ selectPermission: func(params json.RawMessage) (string, bool, bool) {+ if reasonixPermissionMetadataMissing(params) {+ b.cfg.Logger.Warn("reasonix permission request is missing trusted metadata; protected-decision detection may be degraded")+ }+ optionID, grant, ok, question := selectReasonixPermissionOption(params)+ if question != "" {+ blockedQuestion.Store(question)+ }+ return optionID, grant, ok+ },+ onNotification: func(method string, params json.RawMessage) {+ if streamingCurrentTurn.Load() {+ statusUsage.observe(method, params)+ }+ },+ onActivity: func() {+ select {+ case activity <- struct{}{}:+ default:+ }+ },+ onMessage: func(msg Message) {+ if !streamingCurrentTurn.Load() {+ return+ }+ // hermesClient.handleToolCallStart has already mapped+ // the raw ACP title via hermesToolNameFromTitle — which+ // covers lowercase hermes-style titles ("read:", "patch+ // (replace)", …) but not capitalised reasonix-style ones+ // ("Read file: …", "Run command: …"). Re-normalise so+ // the UI sees consistent snake_case identifiers across+ // both backends. No-op when the name is already normal+ // form (e.g. already mapped to "read_file").+ if msg.Type == MessageToolUse {+ msg.Tool = reasonixToolNameFromTitle(msg.Tool)+ }+ deliverable.observe(msg)+ trySend(msgCh, msg)+ },+ onPromptDone: func(result hermesPromptResult) {+ if !streamingCurrentTurn.Load() {+ return+ }+ select {+ case promptDone <- result:+ default:+ }+ },+ }++ // Start reading stdout in background.+ readerDone := make(chan struct{})+ go func() {+ defer close(readerDone)+ scanner := bufio.NewScanner(stdout)+ scanner.Buffer(make([]byte, 0, 1024*1024), 10*1024*1024)+ for scanner.Scan() {+ line := strings.TrimSpace(scanner.Text())+ if line == "" {+ continue+ }+ c.handleLine(line)+ }+ c.closeAllPending(fmt.Errorf("reasonix process exited"))+ }()++ // Drive the ACP session lifecycle in a goroutine.+ go func() {+ defer cancel()+ defer close(msgCh)+ defer close(resCh)+ defer func() {+ stdin.Close()+ _ = cmd.Wait()+ }()++ startTime := time.Now()+ finalStatus := "completed"+ var finalError string+ var sessionID string+ // Set when the ACP runtime refuses the session we asked to+ // resume. Only that is curable by starting a fresh session, so+ // handshake/network failures below must leave it false.+ var resumeRejected bool++ // 1. Initialize handshake.+ initResult, err := c.request(runCtx, "initialize", map[string]any{+ "protocolVersion": 1,+ "clientInfo": map[string]any{+ "name": "multica-agent-sdk",+ "version": "0.2.0",+ },+ "clientCapabilities": map[string]any{},+ })+ if err != nil {+ finalStatus, finalError = reasonixRequestFailure(runCtx, timeout, fmt.Sprintf("reasonix initialize failed: %v", err))+ resCh <- Result{Status: finalStatus, Error: finalError, DurationMs: time.Since(startTime).Milliseconds()}+ return+ }+ warnReasonixCapabilityGaps(b.cfg.Logger, initResult)++ // Drop MCP entries whose remote transport the runtime didn't+ // advertise. See the matching comment in hermes.go for the why —+ // shipping an http/sse entry to a stdio-only runtime tanks the+ // whole session/new.+ mcpServers = filterACPMcpServersByCapability(mcpServers, extractACPMcpCapabilities(initResult), "reasonix", b.cfg.Logger)++ // 2. Create or resume a session.+ cwd := opts.Cwd+ if cwd == "" {+ cwd = "."+ }++ if opts.ResumeSessionID != "" {+ // Per ACP Session Setup, session/resume accepts mcpServers and+ // the runtime re-connects them as part of the resume. Without+ // this, a resumed Reasonix task lost access to MCP tools that a+ // fresh task on the same agent would have.+ result, err := c.request(runCtx, "session/resume", map[string]any{+ "cwd": cwd,+ "sessionId": opts.ResumeSessionID,+ "mcpServers": mcpServers,+ })+ if err != nil {+ finalStatus, finalError = reasonixRequestFailure(runCtx, timeout, fmt.Sprintf("reasonix session/resume failed: %v", err))+ if finalStatus == "failed" && isACPSessionNotFound(err) {+ resumeRejected = true+ finalError = fmt.Sprintf("reasonix session/resume rejected the saved session: %v", err)+ } else if finalStatus == "failed" && isReasonixSessionLeaseConflict(err) {+ finalError = fmt.Sprintf("reasonix session is already in use; close the other Reasonix window or process first: %v", err)+ }+ resCh <- Result{+ Status: finalStatus,+ Error: finalError,+ DurationMs: time.Since(startTime).Milliseconds(),+ ResumeRejected: resumeRejected,+ }+ return+ }+ var changed bool+ sessionID, changed = resolveResumedSessionID(opts.ResumeSessionID, result)+ if changed {+ b.cfg.Logger.Warn("agent returned a different session id on resume — original was likely lost; continuing with the new id",+ "backend", "reasonix",+ "requested", opts.ResumeSessionID,+ "actual", sessionID,+ )+ }+ } else {+ result, err := c.request(runCtx, "session/new", map[string]any{+ "cwd": cwd,+ "mcpServers": mcpServers,+ })+ if err != nil {+ finalStatus, finalError = reasonixRequestFailure(runCtx, timeout, reasonixSessionNewError(err))+ resCh <- Result{Status: finalStatus, Error: finalError, DurationMs: time.Since(startTime).Milliseconds()}+ return+ }+ sessionID = extractACPSessionID(result)+ if sessionID == "" {+ finalStatus = "failed"+ finalError = "reasonix session/new returned no session ID"+ resCh <- Result{Status: finalStatus, Error: finalError, DurationMs: time.Since(startTime).Milliseconds()}+ return+ }+ }++ c.sessionID = sessionID+ b.cfg.Logger.Info("reasonix session created", "session_id", sessionID)++ // 3. If the caller picked a model (via agent.model from the+ // UI dropdown), ask reasonix to switch the session to it before+ // we send any prompt. Reasonix's ACP server exposes+ // `session/set_model` and advertises available models via+ // the `models.availableModels` block returned by+ // `session/new` — we pass the chosen modelId through+ // verbatim. This MUST fail the task on error: silently+ // falling back to reasonix's default model would let the user+ // believe their pick was honoured while the task actually+ // ran on something else.+ if opts.Model != "" {+ if _, err := c.request(runCtx, "session/set_model", map[string]any{+ "sessionId": sessionID,+ "modelId": opts.Model,+ }); err != nil {+ b.cfg.Logger.Warn("reasonix set_session_model failed", "error", err, "requested_model", opts.Model)+ finalStatus, finalError = reasonixRequestFailure(runCtx, timeout, fmt.Sprintf("reasonix could not switch to model %q: %v", opts.Model, err))+ if finalStatus == "failed" && opts.ResumeSessionID != "" && isACPSessionNotFound(err) {+ // On a resumed session with a model override, the dead+ // session surfaces here instead of at session/prompt.+ // Same fix as the prompt path below: clear the id so+ // the daemon's resume-failure fallback retries fresh.+ b.cfg.Logger.Warn("resumed session not found at set_model time; clearing session id so the daemon retries fresh",+ "backend", "reasonix",+ "session_id", sessionID,+ )+ sessionID = ""+ resumeRejected = true+ }+ resCh <- Result{+ Status: finalStatus,+ Error: finalError,+ DurationMs: time.Since(startTime).Milliseconds(),+ SessionID: sessionID,+ ResumeRejected: resumeRejected,+ }+ return+ }+ b.cfg.Logger.Info("reasonix session model set", "model", opts.Model)+ }++ // 4. Send the prompt and wait for PromptResponse. Reasonix loads+ // AGENTS.md from cwd, so the daemon deliberately does not duplicate the+ // runtime brief in this user message.+ streamingCurrentTurn.Store(true)+ _, err = c.request(runCtx, "session/prompt", map[string]any{+ "sessionId": sessionID,+ "prompt": []map[string]any{+ {"type": "text", "text": prompt},+ },+ })+ if err != nil {+ finalStatus, finalError = reasonixRequestFailure(runCtx, timeout, fmt.Sprintf("reasonix session/prompt failed: %v", err))+ if finalStatus == "failed" {+ if opts.ResumeSessionID != "" && isACPSessionNotFound(err) {+ // See the hermes backend: the runtime echoes the+ // requested id back from session/resume even when+ // the session is gone, so the stale id only fails+ // here, at prompt time. Empty SessionID lets the+ // daemon's resume-failure fallback retry fresh and+ // store the replacement id.+ b.cfg.Logger.Warn("resumed session not found at prompt time; clearing session id so the daemon retries fresh",+ "backend", "reasonix",+ "session_id", sessionID,+ )+ sessionID = ""+ resumeRejected = true+ }+ }+ } else {+ select {+ case pr := <-promptDone:+ switch pr.stopReason {+ case "end_turn":+ case "cancelled":+ finalStatus = "aborted"+ finalError = "reasonix cancelled the prompt"+ case "error":+ finalStatus = "failed"+ finalError = "reasonix ended the prompt with stopReason=error"+ default:+ finalStatus = "failed"+ finalError = fmt.Sprintf("reasonix returned unsupported stopReason %q", pr.stopReason)+ }+ promptUsageMu.Lock()+ promptUsage = pr.usage+ promptUsageMu.Unlock()+ default:+ finalStatus = "failed"+ finalError = "reasonix returned no prompt completion result"+ }+ waitForACPNotificationQuiescence(runCtx, activity, readerDone, acpNotificationQuietTime, reasonixReaderDrainGrace)+ }++ duration := time.Since(startTime)+ b.cfg.Logger.Info("reasonix finished", "pid", cmd.Process.Pid, "status", finalStatus, "duration", duration.Round(time.Millisecond).String())++ stdin.Close()+ cancel()++ <-readerDone+ // Ensure the stderr copier has drained before consulting the+ // provider-error sniffer; see hermes.go for the failure mode.+ <-stderrDone+ streamingCurrentTurn.Store(false)++ finalOutput, providerErrorOutput := deliverable.result()++ // Promote completed→failed when stderr or the agent text+ // stream show a terminal upstream-LLM failure (HTTP 4xx /+ // rate-limit / expired token). See the helper docs for the+ // full signal set; the key safety property is that transient+ // per-attempt warnings followed by a successful retry stay+ // "completed". It reads the full text stream, not the+ // deliverable, so a give-up turn that lands before a tool call+ // stays visible.+ finalStatus, finalError = promoteACPResultOnProviderError(finalStatus, finalError, providerErrorOutput, providerErr)+ if question, ok := blockedQuestion.Load().(string); ok && question != "" {+ switch finalStatus {+ case "completed", "failed":+ finalStatus = "failed"+ finalError = question+ }+ }++ c.usageMu.Lock()+ u := c.usage+ c.usageMu.Unlock()+ promptUsageMu.Lock()+ standardPromptUsage := promptUsage+ promptUsageMu.Unlock()+ if reasonixUsagePresent(standardPromptUsage) {+ u = standardPromptUsage+ }+ statusSnapshot, statusModel := statusUsage.snapshot()+ if !reasonixUsagePresent(u) {+ u = statusSnapshot+ }++ var usageMap map[string]TokenUsage+ if reasonixUsagePresent(u) {+ model := opts.Model+ if model == "" {+ model = statusModel+ }+ if model == "" {+ model = "unknown"+ }+ usageMap = map[string]TokenUsage{model: u}+ }++ resCh <- Result{+ Status: finalStatus,+ Output: finalOutput,+ Error: finalError,+ DurationMs: duration.Milliseconds(),+ SessionID: sessionID,+ ResumeRejected: resumeRejected,+ Usage: usageMap,+ }+ }()++ return &Session{Messages: msgCh, Result: resCh}, nil+}++// reasonixToolNameFromTitle normalises tool names emitted by Reasonix's ACP+// server into the snake_case identifiers the Multica UI expects.+//+// Reasonix follows the ACP spec where `title` is a short human-readable+// label such as "Read file: /path/to/foo.go" or "Run command: ls".+// hermesToolNameFromTitle upstream handles hermes' lowercase+// convention ("read:", "patch (replace)") but not reasonix's capitalised+// format — so we get called on the already-mapped name from hermes+// and fix up anything that slipped through. Empty input returns "".+func reasonixToolNameFromTitle(title string) string {+ t := strings.TrimSpace(title)+ if t == "" {+ return ""+ }++ // Strip everything after the first colon — ACP titles often look like+ // "Tool Name: argument detail" and we want only the tool name.+ if idx := strings.Index(t, ":"); idx > 0 {+ t = strings.TrimSpace(t[:idx])+ }++ lower := strings.ToLower(t)+ switch lower {+ case "read", "read file":+ return "read_file"+ case "write", "write file":+ return "write_file"+ case "edit", "patch":+ return "edit_file"+ case "shell", "bash", "terminal", "run command", "run shell command":+ return "terminal"+ case "search", "grep", "find":+ return "search_files"+ case "glob":+ return "glob"+ case "web search":+ return "web_search"+ case "fetch", "web fetch":+ return "web_fetch"+ case "todo", "todo write":+ return "todo_write"+ }++ // Fallback: snake_case the title so the UI gets a stable identifier.+ return strings.ReplaceAll(lower, " ", "_")+}++var reasonixProtectedPermissionTools = map[string]bool{+ "exit_plan_mode": true,+ "remember": true,+ "forget": true,+ "sandbox_escape": true,+ "config_write": true,+ "plan_mode_read_only_command": true,+}++type reasonixPermissionRequest struct {+ ToolCall struct {+ ToolCallID string `json:"toolCallId"`+ Title string `json:"title"`+ Meta map[string]json.RawMessage `json:"_meta"`+ } `json:"toolCall"`+ Options []acpPermissionOption `json:"options"`+}++type reasonixPermissionMetadata struct {+ Tool string `json:"tool"`+ Fresh bool `json:"fresh"`+}++// selectReasonixPermissionOption prevents two Reasonix-specific request+// classes from falling through the shared "allow_once is safe" rule: user+// questions and decisions that Reasonix explicitly marks fresh-human-only.+func selectReasonixPermissionOption(params json.RawMessage) (optionID string, grant bool, ok bool, blockedQuestion string) {+ var p reasonixPermissionRequest+ if err := json.Unmarshal(params, &p); err != nil {+ return "", false, false, ""+ }++ rejectOnce := func() (string, bool) {+ for _, opt := range p.Options {+ if opt.OptionID != "" && strings.EqualFold(strings.TrimSpace(opt.Kind), acpKindRejectOnce) {+ return opt.OptionID, true+ }+ }+ return "", false+ }++ if reasonixPermissionIsQuestion(p) {+ reason := "Reasonix requested interactive user input, which is unavailable in an unattended Multica task"+ if title := strings.TrimSpace(p.ToolCall.Title); title != "" {+ reason += ": " + clipReasonixPermissionTitle(title)+ }+ if id, found := rejectOnce(); found {+ return id, false, true, reason+ }+ // A protocol error is fail-closed here: current Reasonix treats a+ // failed ask response as unanswered/cancelled instead of proceeding.+ return "", false, false, reason+ }++ meta, _ := reasonixPermissionMeta(p)+ if meta.Fresh || reasonixProtectedPermissionTools[meta.Tool] {+ if id, found := rejectOnce(); found {+ return id, false, true, ""+ }+ return "", false, false, ""+ }++ id, allowed, selectable := selectACPPermissionOption(params)+ return id, allowed, selectable, ""+}++func reasonixPermissionIsQuestion(p reasonixPermissionRequest) bool {+ if strings.HasPrefix(p.ToolCall.ToolCallID, "ask-") {+ return true+ }+ for _, opt := range p.Options {+ if strings.HasSuffix(opt.OptionID, ":cancel") {+ return true+ }+ }+ return false+}++func reasonixPermissionMeta(p reasonixPermissionRequest) (reasonixPermissionMetadata, bool) {+ var meta reasonixPermissionMetadata+ raw, ok := p.ToolCall.Meta["reasonix.io"]+ if !ok || json.Unmarshal(raw, &meta) != nil {+ return reasonixPermissionMetadata{}, false+ }+ meta.Tool = strings.TrimSpace(meta.Tool)+ return meta, meta.Tool != ""+}++func reasonixPermissionMetadataMissing(params json.RawMessage) bool {+ var p reasonixPermissionRequest+ if json.Unmarshal(params, &p) != nil || reasonixPermissionIsQuestion(p) {+ return false+ }+ _, ok := reasonixPermissionMeta(p)+ return !ok+}++func warnReasonixCapabilityGaps(logger *slog.Logger, result json.RawMessage) {+ statusVersion, updateVersion := reasonixStatusCapabilitySchemas(result)+ if statusVersion == 1 && updateVersion == 1 {+ return+ }+ logger.Warn(+ "reasonix ACP status capabilities are unavailable or incompatible; usage and cost reporting may be incomplete",+ "session_status_schema_version", statusVersion,+ "status_update_schema_version", updateVersion,+ )+}++func reasonixStatusCapabilitySchemas(result json.RawMessage) (statusVersion, updateVersion int) {+ var initialized struct {+ AgentCapabilities struct {+ Meta map[string]json.RawMessage `json:"_meta"`+ } `json:"agentCapabilities"`+ }+ if json.Unmarshal(result, &initialized) != nil {+ return 0, 0+ }+ readVersion := func(key string) int {+ var capability struct {+ SchemaVersion int `json:"schemaVersion"`+ }+ if json.Unmarshal(initialized.AgentCapabilities.Meta[key], &capability) != nil {+ return 0+ }+ return capability.SchemaVersion+ }+ return readVersion("_reasonix.io/session/status"), readVersion("_reasonix.io/session/status_update")+}++func clipReasonixPermissionTitle(title string) string {+ runes := []rune(title)+ if len(runes) <= 240 {+ return title+ }+ return string(runes[:240]) + "…"+}++func isReasonixSessionLeaseConflict(err error) bool {+ var rpcErr *acpRPCError+ if !errors.As(err, &rpcErr) || rpcErr.Code != -32600 {+ return false+ }+ text := strings.ToLower(rpcErr.Message + " " + rpcErr.Data)+ return strings.Contains(text, " in use") && strings.Contains(text, "close the other reasonix")+}++func reasonixSessionNewError(err error) string {+ text := strings.ToLower(err.Error())+ if strings.Contains(text, "not configured") || strings.Contains(text, "no default_model configured") {+ return fmt.Sprintf("reasonix session/new failed: %v; run `reasonix setup` in the runtime owner's environment and retry", err)+ }+ return fmt.Sprintf("reasonix session/new failed: %v", err)+}++func reasonixRequestFailure(ctx context.Context, timeout time.Duration, fallback string) (string, string) {+ switch ctx.Err() {+ case context.DeadlineExceeded:+ if timeout > 0 {+ return "timeout", fmt.Sprintf("reasonix timed out after %s", timeout)+ }+ return "timeout", "reasonix execution timed out"+ case context.Canceled:+ return "aborted", "execution cancelled"+ default:+ return "failed", fallback+ }+}++type reasonixStatusUsageTracker struct {+ mu sync.Mutex+ sequence uint64+ usage TokenUsage+ model string+}++func (t *reasonixStatusUsageTracker) observe(method string, params json.RawMessage) {+ if method != "_reasonix.io/session/status_update" {+ return+ }+ var update struct {+ SchemaVersion int `json:"schemaVersion"`+ Sequence uint64 `json:"sequence"`+ Status struct {+ Model string `json:"model"`+ Usage struct {+ Turn struct {+ PromptTokens int64 `json:"promptTokens"`+ CompletionTokens int64 `json:"completionTokens"`+ CacheHitTokens int64 `json:"cacheHitTokens"`+ CacheMissTokens int64 `json:"cacheMissTokens"`+ EstimatedCost *float64 `json:"estimatedCost"`+ Currency string `json:"currency"`+ } `json:"turn"`+ } `json:"usage"`+ } `json:"status"`+ }+ if err := json.Unmarshal(params, &update); err != nil || update.SchemaVersion != 1 {+ return+ }++ turn := update.Status.Usage.Turn+ input := turn.CacheMissTokens+ if input == 0 {+ input = turn.PromptTokens - turn.CacheHitTokens+ if input < 0 {+ input = turn.PromptTokens+ }+ }+ u := TokenUsage{+ InputTokens: input,+ OutputTokens: turn.CompletionTokens,+ CacheReadTokens: turn.CacheHitTokens,+ }+ if turn.EstimatedCost != nil && isReasonixUSDCurrency(turn.Currency) &&+ *turn.EstimatedCost >= 0 && !math.IsNaN(*turn.EstimatedCost) && !math.IsInf(*turn.EstimatedCost, 0) &&+ *turn.EstimatedCost <= float64(1<<63-1)/float64(CostUSDTicksPerUSD) {+ u.CostUSDTicks = int64(math.Round(*turn.EstimatedCost * float64(CostUSDTicksPerUSD)))+ }++ t.mu.Lock()+ defer t.mu.Unlock()+ if update.Sequence < t.sequence {+ return+ }+ t.sequence = update.Sequence+ t.usage = u+ t.model = strings.TrimSpace(update.Status.Model)+}++func (t *reasonixStatusUsageTracker) snapshot() (TokenUsage, string) {+ t.mu.Lock()+ defer t.mu.Unlock()+ return t.usage, t.model+}++func isReasonixUSDCurrency(currency string) bool {+ switch strings.ToUpper(strings.TrimSpace(currency)) {+ case "USD", "$", "US$":+ return true+ default:+ return false+ }+}++func reasonixUsagePresent(u TokenUsage) bool {+ return acpTokenUsagePresent(u) || u.CostUSDTicks > 0+}diff --git a/server/pkg/agent/reasonix_execute_unix_test.go b/server/pkg/agent/reasonix_execute_unix_test.gonew file mode 100644index 0000000000..9cc3a96d8e--- /dev/null+++ b/server/pkg/agent/reasonix_execute_unix_test.go@@ -0,0 +1,383 @@+//go:build unix++package agent++import (+ "context"+ "encoding/json"+ "log/slog"+ "os"+ "path/filepath"+ "strings"+ "testing"+ "time"+)++func fakeReasonixACPScript() string {+ return `#!/bin/sh+if [ -n "$REASONIX_ARGS_FILE" ]; then+ for arg in "$@"; do printf '%s\n' "$arg" >> "$REASONIX_ARGS_FILE"; done+fi+while IFS= read -r line; do+ id=$(printf '%s' "$line" | sed -n 's/.*"id":\([0-9]*\).*/\1/p')+ case "$line" in+ *'"method":"initialize"'*)+ printf '{"jsonrpc":"2.0","id":%s,"result":{"protocolVersion":1,"agentCapabilities":{"_meta":{"_reasonix.io/session/status":{"schemaVersion":1},"_reasonix.io/session/status_update":{"schemaVersion":1}}}}}\n' "$id"+ ;;+ *'"method":"session/new"'*)+ printf '{"jsonrpc":"2.0","id":%s,"result":{"sessionId":"reasonix-session"}}\n' "$id"+ ;;+ *'"method":"session/prompt"'*)+ printf '{"jsonrpc":"2.0","method":"_reasonix.io/session/status_update","params":{"schemaVersion":1,"sequence":1,"status":{"model":"deepseek-reasoner","usage":{"turn":{"promptTokens":15,"completionTokens":4,"cacheHitTokens":10,"cacheMissTokens":5,"estimatedCost":0.001,"currency":"USD"}}}}}\n'+ printf '{"jsonrpc":"2.0","method":"session/update","params":{"sessionId":"reasonix-session","update":{"sessionUpdate":"agent_message_chunk","content":{"type":"text","text":"done"}}}}\n'+ printf '{"jsonrpc":"2.0","id":%s,"result":{"stopReason":"end_turn"}}\n' "$id"+ exit 0+ ;;+ esac+done+`+}++func TestReasonixBackendExecutesACPWithStateUsage(t *testing.T) {+ t.Parallel()+ tempDir := t.TempDir()+ argsFile := filepath.Join(tempDir, "args")+ fakePath := filepath.Join(tempDir, "reasonix")+ writeTestExecutable(t, fakePath, []byte(fakeReasonixACPScript()))++ backend, err := New("reasonix", Config{+ ExecutablePath: fakePath,+ Logger: slog.Default(),+ Env: map[string]string{"REASONIX_ARGS_FILE": argsFile},+ })+ if err != nil {+ t.Fatalf("New(reasonix): %v", err)+ }+ session, err := backend.Execute(context.Background(), "finish", ExecOptions{+ Timeout: 5 * time.Second,+ CustomArgs: []string{+ "--profile", "delivery",+ "--planner", "off",+ "--sandbox-network", "on",+ "--sandbox-bash", "enforce",+ "--workspace-only",+ "--model", "other",+ },+ })+ if err != nil {+ t.Fatalf("Execute: %v", err)+ }+ go func() {+ for range session.Messages {+ }+ }()+ result := <-session.Result+ if result.Status != "completed" || result.Output != "done" || result.SessionID != "reasonix-session" {+ t.Fatalf("result = %+v", result)+ }+ usage := result.Usage["deepseek-reasoner"]+ if usage.InputTokens != 5 || usage.CacheReadTokens != 10 || usage.OutputTokens != 4 || usage.CostUSDTicks != 10_000_000 {+ t.Fatalf("usage = %+v", usage)+ }+ rawArgs, err := os.ReadFile(argsFile)+ if err != nil {+ t.Fatalf("read args: %v", err)+ }+ wantArgs := []string{"acp", "--profile", "balanced", "--planner", "auto", "--sandbox-network", "auto", "--sandbox-bash", "auto", "--workspace-only"}+ if got := strings.Fields(string(rawArgs)); strings.Join(got, "\x00") != strings.Join(wantArgs, "\x00") {+ t.Fatalf("args = %q, want %q", got, wantArgs)+ }+}++func TestReasonixBackendStopReasonErrorFails(t *testing.T) {+ t.Parallel()+ script := strings.Replace(fakeReasonixACPScript(), `"stopReason":"end_turn"`, `"stopReason":"error"`, 1)+ fakePath := filepath.Join(t.TempDir(), "reasonix")+ writeTestExecutable(t, fakePath, []byte(script))+ backend, err := New("reasonix", Config{ExecutablePath: fakePath, Logger: slog.Default()})+ if err != nil {+ t.Fatalf("New(reasonix): %v", err)+ }+ session, err := backend.Execute(context.Background(), "finish", ExecOptions{Timeout: 5 * time.Second})+ if err != nil {+ t.Fatalf("Execute: %v", err)+ }+ go func() {+ for range session.Messages {+ }+ }()+ result := <-session.Result+ if result.Status != "failed" || !strings.Contains(result.Error, "stopReason=error") {+ t.Fatalf("result = %+v", result)+ }+}++func TestReasonixBackendQuestionFailsWithActionableError(t *testing.T) {+ t.Parallel()+ script := `#!/bin/sh+while IFS= read -r line; do+ id=$(printf '%s' "$line" | sed -n 's/.*"id":\([0-9]*\).*/\1/p')+ case "$line" in+ *'"method":"initialize"'*) printf '{"jsonrpc":"2.0","id":%s,"result":{"protocolVersion":1,"agentCapabilities":{}}}\n' "$id" ;;+ *'"method":"session/new"'*) printf '{"jsonrpc":"2.0","id":%s,"result":{"sessionId":"question-session"}}\n' "$id" ;;+ *'"method":"session/prompt"'*)+ printf '{"jsonrpc":"2.0","id":99,"method":"session/request_permission","params":{"sessionId":"question-session","toolCall":{"toolCallId":"ask-a-q1","title":"Choose a deployment"},"options":[{"optionId":"q1:1","kind":"allow_once"},{"optionId":"q1:cancel","kind":"reject_once"}]}}\n'+ IFS= read -r permission+ case "$permission" in *'"optionId":"q1:cancel"'*) ;; *) exit 2 ;; esac+ printf '{"jsonrpc":"2.0","id":%s,"result":{"stopReason":"end_turn"}}\n' "$id"+ exit 0+ ;;+ esac+done+`+ fakePath := filepath.Join(t.TempDir(), "reasonix")+ writeTestExecutable(t, fakePath, []byte(script))+ backend, err := New("reasonix", Config{ExecutablePath: fakePath, Logger: slog.Default()})+ if err != nil {+ t.Fatalf("New(reasonix): %v", err)+ }+ session, err := backend.Execute(context.Background(), "finish", ExecOptions{Timeout: 5 * time.Second})+ if err != nil {+ t.Fatalf("Execute: %v", err)+ }+ go func() {+ for range session.Messages {+ }+ }()+ result := <-session.Result+ if result.Status != "failed" || !strings.Contains(result.Error, "interactive user input") || !strings.Contains(result.Error, "Choose a deployment") {+ t.Fatalf("result = %+v", result)+ }+}++func TestReasonixResumeFiltersUnsupportedSSEMCP(t *testing.T) {+ t.Parallel()+ recordPath := filepath.Join(t.TempDir(), "frames.jsonl")+ fakePath := filepath.Join(t.TempDir(), "reasonix")+ writeTestExecutable(t, fakePath, []byte(fakeACPRecordingScript(+ recordPath,+ "resumed",+ `{"mcpCapabilities":{"http":true,"sse":false}}`,+ )))+ backend, err := New("reasonix", Config{ExecutablePath: fakePath, Logger: slog.Default()})+ if err != nil {+ t.Fatalf("New(reasonix): %v", err)+ }+ session, err := backend.Execute(context.Background(), "finish", ExecOptions{+ ResumeSessionID: "resumed",+ Timeout: 5 * time.Second,+ McpConfig: json.RawMessage(`{"mcpServers":{+ "local":{"command":"uvx","args":["mcp-local"]},+ "remote-http":{"type":"http","url":"https://example.test/mcp"},+ "remote-sse":{"type":"sse","url":"https://example.test/sse"}+ }}`),+ })+ if err != nil {+ t.Fatalf("Execute: %v", err)+ }+ go func() {+ for range session.Messages {+ }+ }()+ result := <-session.Result+ if result.Status != "completed" || result.SessionID != "resumed" {+ t.Fatalf("result = %+v", result)+ }+ frame := findRecordedFrame(t, recordPath, "session/resume")+ servers := frame["params"].(map[string]any)["mcpServers"].([]any)+ if len(servers) != 2 {+ t.Fatalf("mcpServers = %+v, want stdio + HTTP only", servers)+ }+ for _, raw := range servers {+ if raw.(map[string]any)["name"] == "remote-sse" {+ t.Fatalf("unsupported SSE server was forwarded: %+v", servers)+ }+ }+}++func TestReasonixBackendLeaseConflictIsActionable(t *testing.T) {+ t.Parallel()+ script := `#!/bin/sh+while IFS= read -r line; do+ id=$(printf '%s' "$line" | sed -n 's/.*"id":\([0-9]*\).*/\1/p')+ case "$line" in+ *'"method":"initialize"'*) printf '{"jsonrpc":"2.0","id":%s,"result":{"protocolVersion":1,"agentCapabilities":{}}}\n' "$id" ;;+ *'"method":"session/resume"'*) printf '{"jsonrpc":"2.0","id":%s,"error":{"code":-32600,"message":"session is in use; close the other Reasonix window or process first"}}\n' "$id"; exit 0 ;;+ esac+done+`+ fakePath := filepath.Join(t.TempDir(), "reasonix")+ writeTestExecutable(t, fakePath, []byte(script))+ backend, err := New("reasonix", Config{ExecutablePath: fakePath, Logger: slog.Default()})+ if err != nil {+ t.Fatalf("New(reasonix): %v", err)+ }+ session, err := backend.Execute(context.Background(), "finish", ExecOptions{ResumeSessionID: "busy", Timeout: 5 * time.Second})+ if err != nil {+ t.Fatalf("Execute: %v", err)+ }+ go func() {+ for range session.Messages {+ }+ }()+ result := <-session.Result+ if result.Status != "failed" || result.ResumeRejected || !strings.Contains(result.Error, "already in use") || !strings.Contains(result.Error, "close the other Reasonix") {+ t.Fatalf("result = %+v", result)+ }+}++func TestReasonixBackendCancelledStopReasonAborts(t *testing.T) {+ t.Parallel()+ script := strings.Replace(fakeReasonixACPScript(), `"stopReason":"end_turn"`, `"stopReason":"cancelled"`, 1)+ fakePath := filepath.Join(t.TempDir(), "reasonix")+ writeTestExecutable(t, fakePath, []byte(script))+ backend, err := New("reasonix", Config{ExecutablePath: fakePath, Logger: slog.Default()})+ if err != nil {+ t.Fatalf("New(reasonix): %v", err)+ }+ session, err := backend.Execute(context.Background(), "finish", ExecOptions{Timeout: 5 * time.Second})+ if err != nil {+ t.Fatalf("Execute: %v", err)+ }+ go func() {+ for range session.Messages {+ }+ }()+ result := <-session.Result+ if result.Status != "aborted" || !strings.Contains(result.Error, "cancelled") {+ t.Fatalf("result = %+v", result)+ }+}++func TestReasonixBackendTimeoutAndCancellationReapProcess(t *testing.T) {+ t.Parallel()+ const script = `#!/bin/sh+while IFS= read -r line; do+ id=$(printf '%s' "$line" | sed -n 's/.*"id":\([0-9]*\).*/\1/p')+ case "$line" in+ *'"method":"initialize"'*) printf '{"jsonrpc":"2.0","id":%s,"result":{"protocolVersion":1,"agentCapabilities":{}}}\n' "$id" ;;+ *'"method":"session/new"'*) printf '{"jsonrpc":"2.0","id":%s,"result":{"sessionId":"hanging"}}\n' "$id" ;;+ *'"method":"session/prompt"'*) ;;+ esac+done+`+ tests := []struct {+ name string+ timeout time.Duration+ cancelSoon bool+ wantStatus string+ }{+ {name: "timeout", timeout: 100 * time.Millisecond, wantStatus: "timeout"},+ {name: "cancellation", timeout: 5 * time.Second, cancelSoon: true, wantStatus: "aborted"},+ }+ for _, tt := range tests {+ tt := tt+ t.Run(tt.name, func(t *testing.T) {+ t.Parallel()+ fakePath := filepath.Join(t.TempDir(), "reasonix")+ writeTestExecutable(t, fakePath, []byte(script))+ backend, err := New("reasonix", Config{ExecutablePath: fakePath, Logger: slog.Default()})+ if err != nil {+ t.Fatalf("New(reasonix): %v", err)+ }+ ctx, cancel := context.WithCancel(context.Background())+ defer cancel()+ session, err := backend.Execute(ctx, "finish", ExecOptions{Timeout: tt.timeout})+ if err != nil {+ t.Fatalf("Execute: %v", err)+ }+ go func() {+ for range session.Messages {+ }+ }()+ if tt.cancelSoon {+ time.AfterFunc(100*time.Millisecond, cancel)+ }+ select {+ case result := <-session.Result:+ if result.Status != tt.wantStatus {+ t.Fatalf("result = %+v, want status %q", result, tt.wantStatus)+ }+ case <-time.After(3 * time.Second):+ t.Fatal("backend did not return after context termination")+ }+ select {+ case _, ok := <-session.Result:+ if ok {+ t.Fatal("result channel produced more than one value")+ }+ case <-time.After(3 * time.Second):+ t.Fatal("backend did not reap the process and close the result channel")+ }+ })+ }+}++func TestReasonixBackendUnknownResumeIsRetryableFresh(t *testing.T) {+ t.Parallel()+ script := `#!/bin/sh+while IFS= read -r line; do+ id=$(printf '%s' "$line" | sed -n 's/.*"id":\([0-9]*\).*/\1/p')+ case "$line" in+ *'"method":"initialize"'*) printf '{"jsonrpc":"2.0","id":%s,"result":{"protocolVersion":1,"agentCapabilities":{}}}\n' "$id" ;;+ *'"method":"session/resume"'*) printf '{"jsonrpc":"2.0","id":%s,"error":{"code":-32602,"message":"session/resume: unknown session dead"}}\n' "$id"; exit 0 ;;+ esac+done+`+ fakePath := filepath.Join(t.TempDir(), "reasonix")+ writeTestExecutable(t, fakePath, []byte(script))+ backend, err := New("reasonix", Config{ExecutablePath: fakePath, Logger: slog.Default()})+ if err != nil {+ t.Fatalf("New(reasonix): %v", err)+ }+ session, err := backend.Execute(context.Background(), "finish", ExecOptions{ResumeSessionID: "dead", Timeout: 5 * time.Second})+ if err != nil {+ t.Fatalf("Execute: %v", err)+ }+ go func() {+ for range session.Messages {+ }+ }()+ result := <-session.Result+ if result.Status != "failed" || !result.ResumeRejected || result.SessionID != "" {+ t.Fatalf("result = %+v", result)+ }+}++func TestDiscoverReasonixModelsUsesEphemeralState(t *testing.T) {+ tempDir := t.TempDir()+ recordPath := filepath.Join(tempDir, "state-home")+ t.Setenv("REASONIX_DISCOVERY_RECORD", recordPath)+ t.Setenv("REASONIX_STATE_HOME", filepath.Join(tempDir, "must-not-use"))+ script := `#!/bin/sh+printf '%s' "$REASONIX_STATE_HOME" > "$REASONIX_DISCOVERY_RECORD"+while IFS= read -r line; do+ id=$(printf '%s' "$line" | sed -n 's/.*"id":\([0-9]*\).*/\1/p')+ case "$line" in+ *'"method":"initialize"'*) printf '{"jsonrpc":"2.0","id":%s,"result":{"protocolVersion":1,"agentCapabilities":{}}}\n' "$id" ;;+ *'"method":"session/new"'*) printf '{"jsonrpc":"2.0","id":%s,"result":{"sessionId":"discovery","models":{"currentModelId":"deepseek-reasoner","availableModels":[{"modelId":"deepseek-reasoner","name":"DeepSeek Reasoner"}]}}}\n' "$id" ;;+ esac+done+`+ fakePath := filepath.Join(tempDir, "reasonix")+ writeTestExecutable(t, fakePath, []byte(script))++ models, err := discoverReasonixModels(context.Background(), fakePath)+ if err != nil {+ t.Fatalf("discoverReasonixModels: %v", err)+ }+ if len(models) != 1 || models[0].ID != "deepseek-reasoner" || !models[0].Default {+ t.Fatalf("models = %+v", models)+ }+ raw, err := os.ReadFile(recordPath)+ if err != nil {+ t.Fatalf("read state record: %v", err)+ }+ stateHome := string(raw)+ if stateHome == "" || stateHome == filepath.Join(tempDir, "must-not-use") {+ t.Fatalf("state home was not isolated: %q", stateHome)+ }+ if _, err := os.Stat(stateHome); !os.IsNotExist(err) {+ t.Fatalf("temporary state home was not cleaned up: %q, stat err=%v", stateHome, err)+ }+}diff --git a/server/pkg/agent/reasonix_test.go b/server/pkg/agent/reasonix_test.gonew file mode 100644index 0000000000..a6e73a0b4c--- /dev/null+++ b/server/pkg/agent/reasonix_test.go@@ -0,0 +1,172 @@+package agent++import (+ "bytes"+ "encoding/json"+ "errors"+ "log/slog"+ "math"+ "strings"+ "testing"+)++func TestNewReturnsReasonixBackend(t *testing.T) {+ t.Parallel()+ b, err := New("reasonix", Config{ExecutablePath: "/nonexistent/reasonix"})+ if err != nil {+ t.Fatalf("New(reasonix) error: %v", err)+ }+ if _, ok := b.(*reasonixBackend); !ok {+ t.Fatalf("expected *reasonixBackend, got %T", b)+ }+}++func TestReasonixPermissionPolicy(t *testing.T) {+ t.Parallel()+ tests := []struct {+ name string+ params string+ wantID string+ wantGrant bool+ wantOK bool+ wantQuestion bool+ }{+ {+ name: "ordinary one-shot approval is allowed",+ params: `{"toolCall":{"toolCallId":"gate-1","_meta":{"reasonix.io":{"tool":"write_file"}}},` ++ `"options":[{"optionId":"allow_once","kind":"allow_once"},{"optionId":"reject_once","kind":"reject_once"}]}`,+ wantID: "allow_once", wantGrant: true, wantOK: true,+ },+ {+ name: "question selects cancel and remains visible",+ params: `{"toolCall":{"toolCallId":"ask-a-q1","title":"Choose a deployment"},` ++ `"options":[{"optionId":"q1:1","kind":"allow_once"},{"optionId":"q1:cancel","kind":"reject_once"}]}`,+ wantID: "q1:cancel", wantOK: true, wantQuestion: true,+ },+ {+ name: "fresh approval is rejected",+ params: `{"toolCall":{"toolCallId":"gate-2","_meta":{"reasonix.io":{"tool":"bash","fresh":true}}},` ++ `"options":[{"optionId":"allow_once","kind":"allow_once"},{"optionId":"reject_once","kind":"reject_once"}]}`,+ wantID: "reject_once", wantOK: true,+ },+ {+ name: "protected approval is rejected even without fresh metadata",+ params: `{"toolCall":{"toolCallId":"gate-3","_meta":{"reasonix.io":{"tool":"config_write"}}},` ++ `"options":[{"optionId":"allow_once","kind":"allow_once"},{"optionId":"reject_once","kind":"reject_once"}]}`,+ wantID: "reject_once", wantOK: true,+ },+ }++ for _, tt := range tests {+ tt := tt+ t.Run(tt.name, func(t *testing.T) {+ t.Parallel()+ id, grant, ok, question := selectReasonixPermissionOption(json.RawMessage(tt.params))+ if id != tt.wantID || grant != tt.wantGrant || ok != tt.wantOK {+ t.Fatalf("decision = (%q, %v, %v), want (%q, %v, %v)", id, grant, ok, tt.wantID, tt.wantGrant, tt.wantOK)+ }+ if (question != "") != tt.wantQuestion {+ t.Fatalf("question = %q, want present=%v", question, tt.wantQuestion)+ }+ })+ }+}++func TestReasonixPermissionMetadataWarningDetection(t *testing.T) {+ t.Parallel()+ tests := []struct {+ name string+ params string+ want bool+ }{+ {+ name: "ordinary request without metadata warns",+ params: `{"toolCall":{"toolCallId":"gate-1"},"options":[{"optionId":"allow_once","kind":"allow_once"}]}`,+ want: true,+ },+ {+ name: "ordinary request with metadata does not warn",+ params: `{"toolCall":{"toolCallId":"gate-1","_meta":{"reasonix.io":{"tool":"write_file"}}},"options":[]}`,+ },+ {+ name: "question without metadata does not warn",+ params: `{"toolCall":{"toolCallId":"ask-a-q1"},"options":[{"optionId":"q1:cancel","kind":"reject_once"}]}`,+ },+ }+ for _, tt := range tests {+ tt := tt+ t.Run(tt.name, func(t *testing.T) {+ t.Parallel()+ if got := reasonixPermissionMetadataMissing(json.RawMessage(tt.params)); got != tt.want {+ t.Fatalf("reasonixPermissionMetadataMissing() = %v, want %v", got, tt.want)+ }+ })+ }+}++func TestReasonixCapabilityGapWarning(t *testing.T) {+ t.Parallel()+ compatible := json.RawMessage(`{"agentCapabilities":{"_meta":{"_reasonix.io/session/status":{"schemaVersion":1},"_reasonix.io/session/status_update":{"schemaVersion":1}}}}`)+ statusVersion, updateVersion := reasonixStatusCapabilitySchemas(compatible)+ if statusVersion != 1 || updateVersion != 1 {+ t.Fatalf("capability versions = (%d, %d), want (1, 1)", statusVersion, updateVersion)+ }++ var logs bytes.Buffer+ logger := slog.New(slog.NewTextHandler(&logs, nil))+ warnReasonixCapabilityGaps(logger, compatible)+ if logs.Len() != 0 {+ t.Fatalf("compatible capabilities logged warning: %s", logs.String())+ }+ warnReasonixCapabilityGaps(logger, json.RawMessage(`{"agentCapabilities":{}}`))+ if !strings.Contains(logs.String(), "usage and cost reporting may be incomplete") {+ t.Fatalf("missing capabilities warning not logged: %s", logs.String())+ }+}++func TestReasonixStatusUsageTracker(t *testing.T) {+ t.Parallel()+ tracker := &reasonixStatusUsageTracker{}+ cost := 0.0123456789+ params := json.RawMessage(`{"schemaVersion":1,"sequence":7,"status":{"model":"deepseek-reasoner","usage":{"turn":{` ++ `"promptTokens":120,"completionTokens":30,"cacheHitTokens":80,"cacheMissTokens":40,` ++ `"estimatedCost":0.0123456789,"currency":"USD"}}}}`)+ tracker.observe("_reasonix.io/session/status_update", params)++ usage, model := tracker.snapshot()+ if model != "deepseek-reasoner" {+ t.Fatalf("model = %q", model)+ }+ if usage.InputTokens != 40 || usage.CacheReadTokens != 80 || usage.OutputTokens != 30 {+ t.Fatalf("usage = %+v", usage)+ }+ wantCost := int64(math.Round(cost * CostUSDTicksPerUSD))+ if usage.CostUSDTicks != wantCost {+ t.Fatalf("cost ticks = %d, want %d", usage.CostUSDTicks, wantCost)+ }++ // Older notifications cannot overwrite the newest turn snapshot.+ tracker.observe("_reasonix.io/session/status_update", json.RawMessage(`{"schemaVersion":1,"sequence":6,"status":{"model":"old","usage":{"turn":{"cacheMissTokens":1}}}}`))+ after, afterModel := tracker.snapshot()+ if after != usage || afterModel != model {+ t.Fatalf("older snapshot overwrote latest: %+v %q", after, afterModel)+ }+}++func TestReasonixResumeAndSetupErrors(t *testing.T) {+ t.Parallel()+ unknown := &acpRPCError{Method: "session/resume", Code: -32602, Message: "session/resume: unknown session dead"}+ if !isACPSessionNotFound(unknown) {+ t.Fatal("Reasonix unknown-session error was not classified")+ }+ lease := &acpRPCError{Method: "session/resume", Code: -32600, Message: "session is in use; close the other Reasonix window"}+ if !isReasonixSessionLeaseConflict(lease) {+ t.Fatal("Reasonix lease conflict was not classified")+ }+ if isReasonixSessionLeaseConflict(errors.New("close the other Reasonix window")) {+ t.Fatal("unstructured error was misclassified as a lease conflict")+ }+ if got := reasonixSessionNewError(errors.New("no default_model configured")); !strings.Contains(got, "reasonix setup") {+ t.Fatalf("setup hint missing from %q", got)+ }+}