moi-computer 0.9.0 → 0.9.1-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/api/app-config.ts +51 -0
- package/client/api/workspace-keys.ts +1 -0
- package/client/app/routes/WorkspaceRoute.tsx +4 -2
- package/client/assets/hermes.png +0 -0
- package/client/components/shared/IconGhost.tsx +15 -18
- package/client/components/ui/button.tsx +2 -2
- package/client/components/ui/hover-card.tsx +1 -1
- package/client/components/ui/popover.tsx +3 -1
- package/client/features/applets/api.ts +38 -0
- package/client/features/applets/applet-thumbnail.ts +208 -0
- package/client/features/chat/ChatEmptyState.tsx +30 -10
- package/client/features/chat/ChatPanel.tsx +67 -31
- package/client/features/chat/ChatPopup.tsx +3 -2
- package/client/features/chat/ChatPromptBubbles.tsx +1 -1
- package/client/features/chat/ChatSelector.tsx +29 -10
- package/client/features/chat/MarkdownContent.tsx +3 -3
- package/client/features/chat/attachment-staging.ts +153 -0
- package/client/features/chat/chat-send.ts +55 -0
- package/client/features/chat/chat-store.ts +32 -8
- package/client/features/chat/composer/ChatComposer.tsx +190 -77
- package/client/features/chat/{ModelPicker.tsx → composer/ModelPicker.tsx} +29 -25
- package/client/features/chat/composer/banners/ComposerBanner.tsx +1 -1
- package/client/features/chat/composer/banners/WorkspaceAgentAvailabilityBanner.tsx +4 -13
- package/client/features/chat/{model-order.ts → composer/model-order.ts} +16 -0
- package/client/features/chat/composer/useWorkspaceComposerState.tsx +9 -4
- package/client/features/chat/tool-group/format/claude.ts +48 -0
- package/client/features/chat/tool-group/format/codex.ts +126 -0
- package/client/features/chat/tool-group/format/hermes.ts +68 -0
- package/client/features/chat/tool-group/format/index.ts +34 -0
- package/client/features/chat/tool-group/format/mcp.ts +64 -0
- package/client/features/chat/tool-group/format/openclaw.ts +116 -0
- package/client/features/chat/tool-group/format/shared.ts +49 -0
- package/client/features/chat/useChat.ts +5 -10
- package/client/features/drawings/DrawingLayer.tsx +49 -0
- package/client/features/drawings/DrawingToolbar.tsx +95 -0
- package/client/features/drawings/capture-element.ts +45 -0
- package/client/features/drawings/useChatAnnotation.ts +222 -0
- package/client/features/drawings/useDrawingLayer.ts +758 -0
- package/client/features/drawings/useViewBuilderSketch.ts +151 -0
- package/client/features/home/HomePage.tsx +13 -0
- package/client/features/home/WorkspacePreview.tsx +10 -5
- package/client/features/home/workspace-presentation.tsx +6 -2
- package/client/features/home/workspace-setup/CreateWorkspaceDialog.tsx +9 -0
- package/client/features/home/workspace-setup/InstallMoiDialog.tsx +245 -0
- package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +13 -7
- package/client/features/home/workspace-setup/WorkspaceDialogContent.tsx +1 -1
- package/client/features/scratchpad/ScratchpadControls.tsx +19 -5
- package/client/features/views/ViewBuilder.tsx +238 -0
- package/client/features/views/ViewManager.tsx +18 -2
- package/client/features/views/api.ts +1 -0
- package/client/features/views/useViewBuilderActions.ts +24 -3
- package/client/features/views/useViewBuilderDrafts.ts +66 -0
- package/client/features/widgets/WidgetFrame.tsx +1 -1
- package/client/features/widgets/WidgetGrid.tsx +1 -1
- package/client/features/widgets/Widgets.tsx +39 -54
- package/client/features/workspace/CustomizePanel.tsx +30 -9
- package/client/features/workspace/WorkspaceScreen.tsx +158 -64
- package/client/features/workspace/WorkspaceTabs.tsx +3 -3
- package/client/features/workspace/useFitsSplitLayout.ts +14 -8
- package/client/index.css +8 -0
- package/client/index.tsx +6 -1
- package/client/runtime/useWorkspaceEvents.ts +17 -0
- package/client/runtime/workspace-theme.ts +29 -6
- package/client/store/ui.ts +19 -0
- package/client/theme.css +33 -8
- package/dist/chunk-5c19v3zr.js +10 -0
- package/dist/chunk-6wx91x8j.js +1 -0
- package/dist/chunk-8s41nd3g.js +1 -0
- package/dist/{chunk-kkj86722.js → chunk-a7fzp0z0.js} +78 -78
- package/dist/{chunk-2vaafjp4.js → chunk-b959mdkj.js} +1 -1
- package/dist/chunk-cagtq45k.js +1 -0
- package/dist/chunk-cva7jpt4.js +82 -0
- package/dist/chunk-sapvd7he.css +1 -0
- package/dist/{chunk-35fq49qa.js → chunk-zbeq02yc.js} +1 -1
- package/dist/chunk-zbt8emsw.js +2 -0
- package/dist/chunk-zfz3b4xg.js +2 -0
- package/dist/hermes-pznd63x9.png +0 -0
- package/dist/index.html +1 -1
- package/lib/format.ts +1 -1
- package/lib/themes.ts +8 -8
- package/lib/types.ts +68 -42
- package/lib/workspace-types.ts +2 -1
- package/package.json +2 -1
- package/server/api.ts +90 -33
- package/server/app-config.ts +144 -0
- package/server/applets.ts +17 -0
- package/server/cli.ts +235 -14
- package/server/harness/README.md +64 -17
- package/server/harness/acp/adapter.ts +220 -0
- package/server/harness/acp/archived.ts +88 -0
- package/server/harness/acp/client.ts +328 -0
- package/server/harness/acp/discovery.ts +130 -0
- package/server/harness/acp/run-durations.ts +68 -0
- package/server/harness/acp/session.ts +788 -0
- package/server/harness/acp/wire.ts +132 -0
- package/server/harness/executable.ts +15 -1
- package/server/harness/hermes/NOTES.md +815 -0
- package/server/harness/hermes/discovery.ts +155 -0
- package/server/harness/hermes/index.ts +155 -0
- package/server/harness/hermes/models.ts +79 -0
- package/server/harness/registry.ts +3 -1
- package/server/layout.ts +40 -45
- package/server/moi-scaffold.ts +37 -1
- package/server/thumbnails.ts +197 -0
- package/server/view-builders.ts +4 -2
- package/server/views.ts +10 -1
- package/server/widgets.ts +4 -18
- package/server/workspace-import.ts +30 -1
- package/workspace/.claude/skills/moi-workspace/SKILL.md +13 -1
- package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +153 -253
- package/client/features/chat/tool-group/format.ts +0 -384
- package/client/features/views/ViewBuilderTab.tsx +0 -152
- package/client/features/widgets/api.ts +0 -47
- package/client/features/widgets/useWidgetThumbnails.ts +0 -107
- package/client/features/widgets/widget-snapshot.ts +0 -71
- package/dist/chunk-3b3rkjet.js +0 -1
- package/dist/chunk-gt7n06ef.js +0 -1
- package/dist/chunk-ty1sqbmn.js +0 -80
- package/dist/chunk-xeyxk7ep.js +0 -10
- package/dist/chunk-yz6wd5vc.css +0 -1
|
@@ -0,0 +1,815 @@
|
|
|
1
|
+
# Hermes Agent — integration research
|
|
2
|
+
|
|
3
|
+
Protocol notes behind moi's Hermes harness. The adapter **shipped** on the ACP
|
|
4
|
+
path recommended below: the protocol lives in `../acp/` (provider-agnostic) and
|
|
5
|
+
this folder holds only Hermes specifics — see §11 for what the implementation
|
|
6
|
+
confirmed and corrected. Everything here was probed empirically against Hermes
|
|
7
|
+
**v0.20.0 (2026.8.3)** on Linux, driving real models (Ollama Cloud
|
|
8
|
+
`kimi-k2.7-code`, OpenAI `gpt-5.4-mini`). Reproduce with
|
|
9
|
+
`bun scripts/probe-hermes-acp.ts` (see §10).
|
|
10
|
+
|
|
11
|
+
**Verdict up front:** Hermes speaks **ACP** (Agent Client Protocol) over
|
|
12
|
+
stdio JSON-RPC, and ACP maps onto moi's `Harness` contract more cleanly than
|
|
13
|
+
either OpenClaw or Codex did. The adapter is a normal harness-sized job — a
|
|
14
|
+
12/13-passing end-to-end run of the full moi flow is in §9. Real streaming,
|
|
15
|
+
vision, MCP, env injection and multi-agent profiles all work (§3.7–§4).
|
|
16
|
+
|
|
17
|
+
What actually needs care: Hermes is **user-global by default** where moi is
|
|
18
|
+
workspace-scoped (§5), it also ships a much richer **native gateway** whose
|
|
19
|
+
features ACP does not expose (§6), and two live-stream bugs need client-side
|
|
20
|
+
workarounds — file-tool completions are dropped (§3.4) and `set_model` silently
|
|
21
|
+
drops session MCP tools (§3.10).
|
|
22
|
+
|
|
23
|
+
## 1. What Hermes actually is
|
|
24
|
+
|
|
25
|
+
The public summaries calling it "a single Rust binary" are **wrong**. It is a
|
|
26
|
+
large Python monolith:
|
|
27
|
+
|
|
28
|
+
- Installed by `curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash`,
|
|
29
|
+
which clones the repo and builds a `uv` venv. Code lands in
|
|
30
|
+
`/usr/local/lib/hermes-agent` (root) or `~/.hermes/hermes-agent` (per-user);
|
|
31
|
+
data always in `$HERMES_HOME` (default `~/.hermes`).
|
|
32
|
+
- ~1.5M lines of Python across ~4k files (excluding `venv/`/`node_modules/`).
|
|
33
|
+
For scale: `cli.py` is 18.7k lines, `run_agent.py` 8.3k, and the ACP adapter
|
|
34
|
+
alone is 5.8k. Node 22 comes along for browser tooling.
|
|
35
|
+
- The install pulls Python 3.11, Node, ripgrep and ffmpeg automatically. Pass
|
|
36
|
+
`--skip-browser` to skip the ~400 MB Playwright Chromium download.
|
|
37
|
+
|
|
38
|
+
Scope is much wider than a coding CLI: ~70 tools across ~28 toolsets, a
|
|
39
|
+
messaging gateway with 25+ platform adapters (Telegram/Discord/Slack/Signal/…),
|
|
40
|
+
cron, a kanban board, voice mode, a skills marketplace, and 7 terminal
|
|
41
|
+
backends (local, docker, ssh, modal, daytona, singularity, vercel sandbox).
|
|
42
|
+
For moi, nearly all of that is out of scope — moi wants the agent loop and the
|
|
43
|
+
ACP surface, not the gateway.
|
|
44
|
+
|
|
45
|
+
Entry points sharing one `AIAgent` core:
|
|
46
|
+
|
|
47
|
+
| Surface | Command | Shape | Fit for moi |
|
|
48
|
+
| -------------- | --------------------- | ------------------------------------------- | ------------------------------------------- |
|
|
49
|
+
| CLI | `hermes`, `hermes -z` | interactive TUI / one-shot | one-shot is scriptable, but no event stream |
|
|
50
|
+
| **ACP** | **`hermes acp`** | **stdio JSON-RPC, one process, N sessions** | **✅ this is the one** |
|
|
51
|
+
| Backend server | `hermes serve` | HTTP + WebSocket JSON-RPC, port 9119 | ❌ machine-level singleton (§4) |
|
|
52
|
+
| Gateway | `hermes gateway run` | long-running messaging daemon | ❌ not moi's model |
|
|
53
|
+
|
|
54
|
+
## 2. Provider configuration (and two traps)
|
|
55
|
+
|
|
56
|
+
Hermes resolves `(provider, model)` → `(api_mode, api_key, base_url)` in
|
|
57
|
+
`hermes_cli/runtime_provider.py`, supporting 18+ providers across three API
|
|
58
|
+
modes (`chat_completions`, `codex_responses`, `anthropic_messages`). Secrets
|
|
59
|
+
live in `$HERMES_HOME/.env`, everything else in `config.yaml`.
|
|
60
|
+
|
|
61
|
+
Two traps cost real time when wiring up a provider:
|
|
62
|
+
|
|
63
|
+
1. **Provider ids are not the obvious names.** Ollama Cloud is `ollama-cloud`,
|
|
64
|
+
not `ollama` (`ollama` means a _local_ Ollama). There is no `openai`
|
|
65
|
+
provider id at all — `resolve_runtime_provider(requested='openai')` raises
|
|
66
|
+
`Unknown provider`. OpenAI arrives as `openai-api` in the ACP model list.
|
|
67
|
+
2. **`provider: ollama-cloud` resolves to the wrong base URL.** It picks up
|
|
68
|
+
`OLLAMA_API_KEY` correctly but returns
|
|
69
|
+
`base_url = https://openrouter.ai/api/v1` — the overlay's
|
|
70
|
+
`base_url_override` never applies — so every call 401s with
|
|
71
|
+
`Missing Authentication header`. Setting `OLLAMA_BASE_URL` does not help.
|
|
72
|
+
|
|
73
|
+
Working configuration, using the custom-endpoint path (whose host-gate in
|
|
74
|
+
`runtime_provider.py` still selects `OLLAMA_API_KEY` for `ollama.com`):
|
|
75
|
+
|
|
76
|
+
```yaml
|
|
77
|
+
model:
|
|
78
|
+
provider: custom
|
|
79
|
+
base_url: https://ollama.com/v1
|
|
80
|
+
default: kimi-k2.7-code
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Credential host-gating is otherwise good and deliberate: keys are matched to
|
|
84
|
+
the resolved _host_, not by substring (a hardening for GHSA-76xc-57q6-vm5m),
|
|
85
|
+
so an unrelated custom endpoint never receives your OpenAI/OpenRouter key.
|
|
86
|
+
|
|
87
|
+
## 3. The ACP surface (`hermes acp`)
|
|
88
|
+
|
|
89
|
+
`acp_adapter/server.py` implements `acp.Agent` against
|
|
90
|
+
`agent-client-protocol==0.9.0`. `hermes acp --check` verifies the deps.
|
|
91
|
+
stdout is reserved for JSON-RPC; logs go to stderr.
|
|
92
|
+
|
|
93
|
+
### 3.1 Handshake
|
|
94
|
+
|
|
95
|
+
`initialize` → protocol v1, and the agent advertises:
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"agentCapabilities": {
|
|
100
|
+
"loadSession": true,
|
|
101
|
+
"promptCapabilities": { "image": true },
|
|
102
|
+
"sessionCapabilities": { "fork": {}, "list": {}, "resume": {} }
|
|
103
|
+
},
|
|
104
|
+
"agentInfo": { "name": "hermes-agent", "version": "0.20.0" },
|
|
105
|
+
"authMethods": [
|
|
106
|
+
{ "id": "custom", "name": "custom runtime credentials" },
|
|
107
|
+
{ "id": "hermes-setup", "type": "terminal", "args": ["--setup"] }
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`authMethods` is directly usable by moi's `availability()` / `startLogin()`
|
|
113
|
+
recovery loop — note `hermes-setup` is `type: terminal`, i.e. it wants a TTY,
|
|
114
|
+
not a browser OAuth URL like Codex.
|
|
115
|
+
|
|
116
|
+
### 3.2 Sessions
|
|
117
|
+
|
|
118
|
+
`session/new { cwd, mcpServers }` → `{ sessionId, models, modes, _meta }`.
|
|
119
|
+
Two things moi's other backends make you fetch separately arrive **inline**:
|
|
120
|
+
|
|
121
|
+
- `models.availableModels` — 52 entries in the probe, merged across every
|
|
122
|
+
configured provider (`openai-api:gpt-5.4-mini`, `custom:kimi-k2.7-code`, …),
|
|
123
|
+
plus `models.currentModelId`. This is `listModels()` for free. See §3.2.1 for
|
|
124
|
+
the entry shape, which needs normalizing before it reaches a picker.
|
|
125
|
+
- `modes.availableModes` — `default` (ask before edits) / `accept_edits` /
|
|
126
|
+
`dont_ask`, plus `currentModeId`. This is the permission policy (§3.5).
|
|
127
|
+
|
|
128
|
+
#### 3.2.1 The model catalog is three strings, and one of them repeats
|
|
129
|
+
|
|
130
|
+
Probed against a live install (59 entries): every `availableModels` row has
|
|
131
|
+
exactly `modelId`, `name`, `description` — no context window, pricing,
|
|
132
|
+
modality or reasoning metadata. Hermes owns all of that (`cache/model_catalog.json`,
|
|
133
|
+
`models_dev_cache.json`, `context_length_cache.yaml` under `$HERMES_HOME`) but
|
|
134
|
+
does not put any of it on the wire; reading those files means reading Hermes'
|
|
135
|
+
private cache format, keyed by ids that do not match ACP's `<provider>:<model>`
|
|
136
|
+
namespace. Not worth it.
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
{
|
|
140
|
+
"modelId": "nous:anthropic/claude-opus-5",
|
|
141
|
+
"name": "Nous Portal · anthropic/claude-opus-5",
|
|
142
|
+
"description": "Provider: Nous Portal"
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Three consequences, all handled in `./models.ts`:
|
|
147
|
+
|
|
148
|
+
- **`description` is the provider, not a blurb** — the same string for all 34
|
|
149
|
+
models behind it, with a ` • current` suffix on `currentModelId`'s row. moi's
|
|
150
|
+
picker labels rows from the description headline, so passed through as-is it
|
|
151
|
+
renders dozens of identical rows. It becomes the group heading instead.
|
|
152
|
+
- **`name` repeats the provider — but not always.** Most rows are
|
|
153
|
+
`"<provider> · <model>"`; the rows from a `providers:` block in `config.yaml`
|
|
154
|
+
carry a bare `"gpt-oss:20b"`. That is why the group is taken from
|
|
155
|
+
`description` and only stripped off `name` when it is actually there.
|
|
156
|
+
- **Configured providers are listed twice**, under `<provider>:<model>` and
|
|
157
|
+
again `custom:<provider>:<model>`, same endpoint and model. Both ids work;
|
|
158
|
+
moi keeps the first and drops the duplicate label.
|
|
159
|
+
|
|
160
|
+
moi also records `providerId` (`nous`, `xai-oauth`, `ollama-launch`) alongside
|
|
161
|
+
the display heading, because the heading is Hermes-authored prose and the id is
|
|
162
|
+
not — anything that needs to pin, order or persist a provider should key on the
|
|
163
|
+
id. It is recovered by peeling the model label off the end of `modelId`, not by
|
|
164
|
+
splitting on the first colon: model ids carry their own colons (`gpt-oss:20b`)
|
|
165
|
+
and `custom:` occupies the first slot as a namespace (`custom:ollama-launch:…`
|
|
166
|
+
→ `ollama-launch`) except when it is itself the provider (`custom:kimi-k2.7-code`
|
|
167
|
+
→ `custom`, the base_url escape hatch from §2).
|
|
168
|
+
|
|
169
|
+
`_meta.hermes.sessionProvenance` carries `rootHermesSessionId`,
|
|
170
|
+
`parentHermesSessionId`, `sessionKind` and `compressionDepth` — session
|
|
171
|
+
lineage across compaction, which moi has no concept of today.
|
|
172
|
+
|
|
173
|
+
`session/list` returns `{ sessionId, title, cwd, updatedAt }[]` — including a
|
|
174
|
+
**model-generated title** (e.g. "Create hello.txt and read back text").
|
|
175
|
+
`cwd` on every record means moi filters by workspace path exactly the way the
|
|
176
|
+
Codex harness filters `thread/list`. This covers `listSessions()` and
|
|
177
|
+
`workspacePreview()`.
|
|
178
|
+
|
|
179
|
+
Session state is one **global** SQLite DB at `$HERMES_HOME/state.db` (20
|
|
180
|
+
tables, FTS5 trigram index over messages). The `sessions` table is richer than
|
|
181
|
+
what moi's current backends expose — it already carries `cwd`, `git_branch`,
|
|
182
|
+
`git_repo_root`, `parent_session_id`, per-session token counts and
|
|
183
|
+
`estimated_cost_usd`/`actual_cost_usd`.
|
|
184
|
+
|
|
185
|
+
### 3.3 The prompt stream
|
|
186
|
+
|
|
187
|
+
`session/prompt` streams `session/update` notifications and resolves with
|
|
188
|
+
`{ stopReason, usage }`. Observed update kinds:
|
|
189
|
+
|
|
190
|
+
| `sessionUpdate` | Carries | moi display mapping |
|
|
191
|
+
| --------------------------- | ----------------------------------------------------- | --------------------------------- |
|
|
192
|
+
| `agent_message_chunk` | token deltas | `preview` frames + assistant text |
|
|
193
|
+
| `agent_thought_chunk` | token deltas | thinking parts |
|
|
194
|
+
| `tool_call` | `toolCallId`, `title`, `kind`, `locations`, `content` | `ToolCall` start |
|
|
195
|
+
| `tool_call_update` | `status: completed\|failed`, `content` | `ToolCall` result |
|
|
196
|
+
| `session_info_update` | generated `title`, `updatedAt` | `sessions_changed` |
|
|
197
|
+
| `available_commands_update` | slash commands | init metadata |
|
|
198
|
+
| `usage_update` | context `size` / `used` | context meter |
|
|
199
|
+
| `user_message_chunk` | replayed user turns | history only (§3.6) |
|
|
200
|
+
|
|
201
|
+
`kind` is semantic (`execute`, `edit`, `read`) with `locations: [{path}]`, so
|
|
202
|
+
moi gets Codex-style semantic tool labels rather than Claude Code's raw
|
|
203
|
+
`tool_use` pairs. Terminal calls arrive pre-titled (`terminal: echo step1`).
|
|
204
|
+
|
|
205
|
+
Final result:
|
|
206
|
+
|
|
207
|
+
```json
|
|
208
|
+
{
|
|
209
|
+
"stopReason": "end_turn",
|
|
210
|
+
"usage": {
|
|
211
|
+
"inputTokens": 34750,
|
|
212
|
+
"outputTokens": 157,
|
|
213
|
+
"cachedReadTokens": 0,
|
|
214
|
+
"thoughtTokens": 0,
|
|
215
|
+
"totalTokens": 34907
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Token streaming is **always on** — there is no opt-in flag, so moi gates
|
|
221
|
+
forwarding on its side exactly like it does for Codex.
|
|
222
|
+
|
|
223
|
+
### 3.4 ⚠️ Live file-tool completions are dropped
|
|
224
|
+
|
|
225
|
+
**Reproducible bug.** In the live stream, `terminal` tool calls always get
|
|
226
|
+
their `tool_call_update` (3 starts → 3 completions), but `read_file` /
|
|
227
|
+
`write_file` calls **never do** (4 starts → 0 completions, twice in a row).
|
|
228
|
+
In moi's UI those tool cards would hang in `pending` forever.
|
|
229
|
+
|
|
230
|
+
Cause is the pairing strategy: live completions are matched by **tool name**
|
|
231
|
+
through a FIFO queue (`acp_adapter/events.py`, `make_tool_progress_cb` /
|
|
232
|
+
`make_step_cb`), driven by a `step_callback(api_call_count, prev_tools)` that
|
|
233
|
+
reports the _previous_ step's tools. The file-tool path doesn't round-trip
|
|
234
|
+
through that queue.
|
|
235
|
+
|
|
236
|
+
The same session replayed through `session/load` is **complete and correct** —
|
|
237
|
+
4 `tool_call` + 4 `tool_call_update` with results — because the replay path
|
|
238
|
+
(`server.py`) pairs by real `tool_call_id` from message history instead.
|
|
239
|
+
|
|
240
|
+
Consequences for a moi adapter:
|
|
241
|
+
|
|
242
|
+
- Tool-call ids are **not stable** between live and replay: live emits
|
|
243
|
+
`tc-<hash>`, replay emits `functions.<tool>:<index>`. Never key persisted
|
|
244
|
+
state on them across a reload.
|
|
245
|
+
- Workaround without patching Hermes: on `stopReason`, mark any still-pending
|
|
246
|
+
tool call as completed (moi already owns turn accounting), or re-read
|
|
247
|
+
history. Upstream fix would be to pair by `tool_call_id` live too.
|
|
248
|
+
|
|
249
|
+
### 3.5 Permissions — a real approval flow
|
|
250
|
+
|
|
251
|
+
Unlike every harness moi ships today, Hermes has a **working interactive
|
|
252
|
+
approval flow**: `session/request_permission` arrives as an agent→client
|
|
253
|
+
request with a proper diff payload and options
|
|
254
|
+
(`allow_once` / `reject_once`), and a denial genuinely blocks the write.
|
|
255
|
+
|
|
256
|
+
A/B probe, denying every prompt:
|
|
257
|
+
|
|
258
|
+
| mode | prompts fired | `gated.txt` written |
|
|
259
|
+
| ---------- | ------------- | ------------------- |
|
|
260
|
+
| `dont_ask` | 0 | ✅ yes |
|
|
261
|
+
| `default` | 1 | ❌ no |
|
|
262
|
+
|
|
263
|
+
So `session/set_mode { modeId: 'dont_ask' }` reproduces moi's
|
|
264
|
+
bypass-permissions trust model in one call — that is the shipping path. But
|
|
265
|
+
Hermes is also the first backend that would let moi build real approval UI
|
|
266
|
+
(README's "permission requests as events" wish-list item) without fighting the
|
|
267
|
+
provider.
|
|
268
|
+
|
|
269
|
+
### 3.6 Resume, fork, cancel, model switch
|
|
270
|
+
|
|
271
|
+
- `session/load { sessionId, cwd }` replays full history as `session/update`
|
|
272
|
+
notifications (`user_message_chunk` + thoughts + paired tool calls +
|
|
273
|
+
message chunks). This is `sessionEvents()`, and it's higher-fidelity than
|
|
274
|
+
the live stream.
|
|
275
|
+
- `session/cancel` → the in-flight `session/prompt` resolves with
|
|
276
|
+
`stopReason: "cancelled"` immediately (8.0s prompt cancelled at t+8.0s).
|
|
277
|
+
Cleanly distinguishable from `end_turn`, which is what moi's contract needs
|
|
278
|
+
to tell aborts from failures.
|
|
279
|
+
- `session/set_model { modelId }` succeeds mid-session — **live model switch**,
|
|
280
|
+
no teardown-and-resume dance (Claude Code's weak spot). ⚠️ but see §3.10.
|
|
281
|
+
- `fork` and `resume` are advertised in `sessionCapabilities`.
|
|
282
|
+
|
|
283
|
+
### 3.7 Streaming is real token streaming
|
|
284
|
+
|
|
285
|
+
Measured cadence on a 12.5s turn (`probe … timing`):
|
|
286
|
+
|
|
287
|
+
| stream | frames | first frame | median gap | avg gap |
|
|
288
|
+
| --------------------- | ------ | ----------- | ---------- | ------- |
|
|
289
|
+
| `agent_thought_chunk` | 378 | 7704ms | 1ms | 7.7ms |
|
|
290
|
+
| `agent_message_chunk` | 299 | 10613ms | 1ms | 6.2ms |
|
|
291
|
+
|
|
292
|
+
Both thinking **and** answer text stream token-by-token — this is not batched
|
|
293
|
+
delivery. The two are sequential, not interleaved: thinking runs to completion
|
|
294
|
+
(7.7s→10.6s), then the answer streams (10.6s→12.5s). That is the model's
|
|
295
|
+
shape, not a protocol limit, so an adapter should not assume ordering.
|
|
296
|
+
|
|
297
|
+
The number to watch is **7.7s to first frame**. That is process spawn +
|
|
298
|
+
`session/new` + prompt assembly, and Hermes assembles a very large prompt
|
|
299
|
+
(~38k input tokens for a trivial task, ~24k on a warmed session). A moi
|
|
300
|
+
harness must hold the process open per workspace — spawn-per-turn would put
|
|
301
|
+
that latency in front of every message.
|
|
302
|
+
|
|
303
|
+
### 3.8 Vision works
|
|
304
|
+
|
|
305
|
+
`{ type: 'image', mimeType: 'image/png', data: <base64> }` in the `prompt`
|
|
306
|
+
array is accepted (`promptCapabilities.image: true`). Against
|
|
307
|
+
`openai-api:gpt-5.4-mini` the agent described a generated test image
|
|
308
|
+
correctly — "a large red circle … a dark blue rectangle … plain white
|
|
309
|
+
background, circle on the left". So moi's `imagesInline: 'base64'` capability
|
|
310
|
+
applies; no path-note fallback needed. Vision needs a vision-capable model —
|
|
311
|
+
`kimi-k2.7-code` is not one, so this is a per-model capability the picker
|
|
312
|
+
should reflect. Hermes also has an `auxiliary.vision` model slot that can
|
|
313
|
+
route image understanding to a _different_ model than the chat model.
|
|
314
|
+
|
|
315
|
+
### 3.9 Env injection works
|
|
316
|
+
|
|
317
|
+
Env set on the `hermes acp` process reaches the agent's shell tools: a
|
|
318
|
+
`MOI_TEST_ENV` set at spawn came back from `printenv` inside the agent's
|
|
319
|
+
terminal tool. This is exactly moi's model — per-workspace env frozen at
|
|
320
|
+
spawn, `onEnvChanged()` reaping idle processes to pick up changes.
|
|
321
|
+
|
|
322
|
+
### 3.10 MCP: works per-session, but `set_model` silently drops it ⚠️
|
|
323
|
+
|
|
324
|
+
`session/new { mcpServers: [{ name, command, args, env }] }` really does
|
|
325
|
+
register servers **per session**. A throwaway stdio MCP server exposing one
|
|
326
|
+
tool was picked up as `mcp__mini__moi_secret_number` (Claude Code's
|
|
327
|
+
namespacing convention), the tool surface refreshed to 28 tools, and the agent
|
|
328
|
+
called it and returned the secret value. Per-session scoping is exactly what
|
|
329
|
+
moi needs to give each workspace its own connectors.
|
|
330
|
+
|
|
331
|
+
**But `session/set_model` destroys them.** Isolated A/B on the same MCP server:
|
|
332
|
+
|
|
333
|
+
| | model switch | MCP tool result |
|
|
334
|
+
| ------------------ | --------------------------- | ------------------ |
|
|
335
|
+
| `research` profile | none | ✅ returned `4173` |
|
|
336
|
+
| `default` profile | → `openai-api:gpt-5.4-mini` | ❌ `NO_TOOL` |
|
|
337
|
+
|
|
338
|
+
Cause: `set_session_model` rebuilds the agent with
|
|
339
|
+
`session_manager._make_agent(...)` but never re-runs
|
|
340
|
+
`_register_session_mcp_servers` — registration only happens on `new_session`,
|
|
341
|
+
`load_session`, `resume_session` and `fork_session`
|
|
342
|
+
(`acp_adapter/server.py`). The rebuilt agent comes back with no MCP tools and
|
|
343
|
+
the model just reports it lacks them.
|
|
344
|
+
|
|
345
|
+
This matters because moi offers a per-chat model picker. Workarounds: re-issue
|
|
346
|
+
`session/load` after every `set_model` (it re-registers), or treat model
|
|
347
|
+
switches as teardown-and-resume when connectors are attached. The one-line
|
|
348
|
+
upstream fix is to call `_register_session_mcp_servers` from
|
|
349
|
+
`set_session_model` too.
|
|
350
|
+
|
|
351
|
+
There is also a global MCP layer (`hermes mcp add/list/test`, plus a
|
|
352
|
+
Nous-curated `hermes mcp catalog` for one-click installs). Those servers are
|
|
353
|
+
user-global, so per-workspace connectors should go through the ACP
|
|
354
|
+
`mcpServers` argument, not the global config.
|
|
355
|
+
|
|
356
|
+
### 3.11 Channel sessions (Telegram, Discord, …) are invisible to ACP
|
|
357
|
+
|
|
358
|
+
`session/list` is hard-filtered to `source="acp"`:
|
|
359
|
+
`db.list_sessions_rich(source="acp", …)` in `acp_adapter/session.py`. The
|
|
360
|
+
`sessions` table tags every row with `source` (observed: `acp`, `cli`; the
|
|
361
|
+
gateway writes `telegram`, `discord`, …) plus `chat_id` / `chat_type` /
|
|
362
|
+
`user_id`. So a Telegram conversation **never** appears in moi's session list,
|
|
363
|
+
and moi can never accidentally hijack one.
|
|
364
|
+
|
|
365
|
+
That is the right default, and it also means moi cannot show them without
|
|
366
|
+
going around ACP: read `state.db` directly, or drive the gateway protocol
|
|
367
|
+
(§5). Worth knowing that gateway sessions are keyed by
|
|
368
|
+
`(platform, chat_id, user_id)` and run inside the long-lived gateway daemon
|
|
369
|
+
with no meaningful `cwd` — they are not workspace-scoped at all, so they do
|
|
370
|
+
not fit moi's workspace model even if surfaced.
|
|
371
|
+
|
|
372
|
+
`session/list` does support server-side filtering and pagination:
|
|
373
|
+
`{ cwd, cursor }`. Verified cold (fresh process, no in-memory sessions):
|
|
374
|
+
19 sessions unfiltered → 8 for one workspace → 0 for a bogus path. Cold rows
|
|
375
|
+
recover their cwd from the `model_config` JSON blob, not the (often empty)
|
|
376
|
+
`cwd` column — so don't read that column directly.
|
|
377
|
+
|
|
378
|
+
## 4. Multiple agents = profiles
|
|
379
|
+
|
|
380
|
+
Hermes profiles are close to OpenClaw agents, and moi can use them the same
|
|
381
|
+
way — except moi can also **create** them, which it cannot do for OpenClaw.
|
|
382
|
+
|
|
383
|
+
```
|
|
384
|
+
$ hermes profile list
|
|
385
|
+
Profile Model Gateway Alias Distribution
|
|
386
|
+
◆default kimi-k2.7-code stopped — —
|
|
387
|
+
research kimi-k2.7-code stopped research —
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
`hermes profile create research --clone --description "…"` makes
|
|
391
|
+
`~/.hermes/profiles/research/` with its **own** `config.yaml` (own model),
|
|
392
|
+
`.env` (own keys), `SOUL.md` (own persona), `skills/` (77 cloned), `memories/`,
|
|
393
|
+
`sessions/`, `cron/`, `hooks/`, `workspace/`. It also writes a wrapper script
|
|
394
|
+
`~/.local/bin/research` → `hermes -p research`.
|
|
395
|
+
|
|
396
|
+
ACP is profile-aware: **`hermes -p research acp`** works, and isolation is
|
|
397
|
+
real — the `research` profile's `session/list` returned `[]` while `default`
|
|
398
|
+
had 19. The `--description` field exists specifically so an orchestrator can
|
|
399
|
+
route work by role.
|
|
400
|
+
|
|
401
|
+
So a moi harness has three viable shapes, and this is a product decision:
|
|
402
|
+
|
|
403
|
+
1. **Import profiles as agents** (OpenClaw's model) — `hermes profile list`
|
|
404
|
+
is the discovery call, `agentId` on `SendMessageInput` already exists for
|
|
405
|
+
exactly this, and `hermes -p <id> acp` is the spawn. Many workspaces can
|
|
406
|
+
share one profile.
|
|
407
|
+
2. **One profile per workspace**, created on demand — gives per-workspace
|
|
408
|
+
model, persona, skills and memory, and is the closest fit to
|
|
409
|
+
`.moi/.workspace.json`.
|
|
410
|
+
3. **`HERMES_HOME` per workspace** — heavier (§5) and mostly redundant now
|
|
411
|
+
that profiles exist. Prefer profiles.
|
|
412
|
+
|
|
413
|
+
## 5. The architectural mismatch: global vs workspace-scoped
|
|
414
|
+
|
|
415
|
+
This is the real integration cost, not the protocol.
|
|
416
|
+
|
|
417
|
+
**moi is workspace-scoped.** Every workspace has its own settings in
|
|
418
|
+
`.moi/.workspace.json`, its own env, its own agent config, and a workspace is
|
|
419
|
+
shareable via git.
|
|
420
|
+
|
|
421
|
+
**Hermes is a user-global singleton by default.** One `$HERMES_HOME`, one
|
|
422
|
+
`config.yaml` with one `model.default`, one `SOUL.md` (the agent's
|
|
423
|
+
identity/system prompt), one `state.db` holding every session from every cwd,
|
|
424
|
+
one memory store, one skills library. `hermes serve` is explicitly
|
|
425
|
+
machine-level ("attach to (or start) ONE machine-level server").
|
|
426
|
+
|
|
427
|
+
ACP escapes this because `session/new` takes a `cwd` and `session/list`
|
|
428
|
+
filters on it; profiles (§4) escape it for model/persona/skills/memory. What
|
|
429
|
+
stays global regardless: the `state.db` file, the installed code, and the
|
|
430
|
+
global MCP + skills registries. Two mitigations:
|
|
431
|
+
|
|
432
|
+
1. **Shared home, filter by cwd** (what the Codex harness already does with
|
|
433
|
+
`thread/list`). Simplest; workspaces share model/SOUL/memory/skills unless
|
|
434
|
+
they also get separate profiles.
|
|
435
|
+
2. **`HERMES_HOME` per workspace**, injected at process spawn. Total
|
|
436
|
+
isolation, but ~54 MB + caches per home (the `models_dev_cache.json` alone
|
|
437
|
+
is 3.6 MB) and mostly superseded by profiles.
|
|
438
|
+
|
|
439
|
+
Concurrency is fine either way: two `hermes acp` processes in different cwds
|
|
440
|
+
sharing one `$HERMES_HOME` ran simultaneously with correct isolation and **no
|
|
441
|
+
SQLite contention** (Hermes detects the SQLite 3.45.1 WAL-reset bug and falls
|
|
442
|
+
back to `journal_mode=DELETE`).
|
|
443
|
+
|
|
444
|
+
Process topology matches moi's held-open model: **one process per workspace,
|
|
445
|
+
N sessions inside it** — the same shape as `codex/client.ts`, so per-workspace
|
|
446
|
+
env injection at spawn works unchanged.
|
|
447
|
+
|
|
448
|
+
## 6. Their own gateway — and what it has that ACP doesn't
|
|
449
|
+
|
|
450
|
+
Hermes has a second, native surface that is much larger than ACP. Two layers
|
|
451
|
+
share the name "gateway":
|
|
452
|
+
|
|
453
|
+
- **`hermes gateway run`** — the messaging daemon. 25+ platform adapters
|
|
454
|
+
(Telegram, Discord, Slack, Signal, WhatsApp, Teams, Google Chat, email,
|
|
455
|
+
WeChat…), user authorization by allowlist and DM pairing, slash-command
|
|
456
|
+
dispatch, cron scheduling, delivery ledger, drain/restart control.
|
|
457
|
+
- **`hermes serve`** — the backend the desktop app talks to: a FastAPI app on
|
|
458
|
+
port 9119 with **135 HTTP routes** plus `/api/ws`, `/api/events`,
|
|
459
|
+
`/api/pub`, `/api/console`, `/api/pty`. The chat plane inside it is
|
|
460
|
+
`tui_gateway`, a JSON-RPC method server with ~85 methods.
|
|
461
|
+
|
|
462
|
+
`tui_gateway` methods that ACP has **no equivalent for** — this is the real
|
|
463
|
+
answer to "what do we lose by choosing ACP":
|
|
464
|
+
|
|
465
|
+
| Area | Gateway methods | ACP |
|
|
466
|
+
| --------------- | ----------------------------------------------------------------- | ------------------------------ |
|
|
467
|
+
| Steering | `session.steer`, `subagent.steer`, `subagent.interrupt` | ❌ (only `session/cancel`) |
|
|
468
|
+
| Compaction | `session.compress`, `session.context_breakdown` | ❌ (opaque) |
|
|
469
|
+
| History editing | `session.undo`, `session.branch`, `session.seed` | ⚠️ `fork` only |
|
|
470
|
+
| Subagents | `delegation.status`, `delegation.pause` | ❌ not modelled |
|
|
471
|
+
| Attachments | `image.attach_bytes`, `pdf.attach`, `file.attach`, `image.detach` | ⚠️ images inline only |
|
|
472
|
+
| Tool policy | `tools.list/show/configure`, `toolsets.list` | ❌ |
|
|
473
|
+
| Skills | `skills.manage`, `skills.reload`, `learning.*`, `insights.get` | ❌ |
|
|
474
|
+
| Agents | `agents.list` (profiles) | ❌ (spawn-level only) |
|
|
475
|
+
| Scheduling | `cron.manage` | ❌ |
|
|
476
|
+
| Terminal | `terminal.read/resize`, `process.list/kill`, `shell.exec` | ❌ |
|
|
477
|
+
| Approvals | `approval.respond`, `clarify.respond`, `sudo.respond` | ⚠️ `request_permission` only |
|
|
478
|
+
| Autocomplete | `complete.path`, `complete.slash`, `commands.catalog` | ⚠️ `available_commands_update` |
|
|
479
|
+
| Billing | `billing.*`, `subscription.*` (Nous portal) | ❌ |
|
|
480
|
+
|
|
481
|
+
Plus REST: `/api/env` (GET/PUT/DELETE/reveal), `/api/memory/*`,
|
|
482
|
+
`/api/messaging/*` (per-platform config and Telegram/WhatsApp pairing
|
|
483
|
+
onboarding), `/api/model/*` including `auxiliary` and `moa`, `/api/curator`,
|
|
484
|
+
`/api/analytics/usage`, `/api/gateway/start|stop|drain|restart`.
|
|
485
|
+
|
|
486
|
+
Event vocabulary is richer too: `agent.token`, `agent.thinking`,
|
|
487
|
+
`agent.reasoning_effort`, `agent.service_tier`, `message.delta/interim/react`,
|
|
488
|
+
`session.*` lifecycle.
|
|
489
|
+
|
|
490
|
+
**Recommendation: still ACP.** The gateway is an internal, undocumented,
|
|
491
|
+
fast-moving protocol for Nous's own desktop app, and half its surface
|
|
492
|
+
(billing, pets, messaging onboarding, cron) is irrelevant to moi. ACP gives
|
|
493
|
+
moi ~90% of the chat plane against a stable public contract. The three
|
|
494
|
+
gateway-only things moi would genuinely miss are **mid-turn steering**,
|
|
495
|
+
**subagent lanes**, and **compaction visibility** — all of which moi renders
|
|
496
|
+
today for Codex/Claude Code, so expect a slightly flatter experience on
|
|
497
|
+
Hermes. If those become blocking, the escape hatch is to run `hermes serve`
|
|
498
|
+
alongside ACP and use it as a _control plane only_, keeping chat on ACP.
|
|
499
|
+
|
|
500
|
+
## 7. What Hermes has that moi has no concept of
|
|
501
|
+
|
|
502
|
+
Worth knowing before deciding how deep to integrate — these are the reasons
|
|
503
|
+
someone picks Hermes, and moi currently models none of them:
|
|
504
|
+
|
|
505
|
+
- **Self-improving skills.** Hermes writes its own skills from experience and
|
|
506
|
+
maintains them with a background "curator". moi's skills are authored
|
|
507
|
+
artifacts synced into the workspace; there is no notion of the agent
|
|
508
|
+
editing its own skill library. 14 bundled skill packs ship with the repo.
|
|
509
|
+
- **Persistent cross-session memory** with pluggable providers
|
|
510
|
+
(`plugins/memory/`), retrieved during prompt assembly.
|
|
511
|
+
- **`SOUL.md`** — a user-level agent identity/persona file, orthogonal to
|
|
512
|
+
moi's per-workspace `AGENTS.md`.
|
|
513
|
+
- **Context compression as a first-class lifecycle** with session lineage
|
|
514
|
+
(`parentHermesSessionId`, `compressionDepth`) surviving compaction.
|
|
515
|
+
- **Auxiliary model slots** — separate models for vision, compression and web
|
|
516
|
+
extraction, independent of the chat model. moi has one model per chat.
|
|
517
|
+
- **Non-local terminal backends** (docker/ssh/modal/daytona/…). moi assumes
|
|
518
|
+
the agent runs where the workspace is.
|
|
519
|
+
|
|
520
|
+
None of these block an adapter; all of them are invisible through ACP unless
|
|
521
|
+
moi chooses to surface them.
|
|
522
|
+
|
|
523
|
+
## 8. Adapter shape and effort
|
|
524
|
+
|
|
525
|
+
Against the checklist in `../README.md`:
|
|
526
|
+
|
|
527
|
+
| Feature | Hermes via ACP |
|
|
528
|
+
| --------------------- | --------------------------------------------------------------------- |
|
|
529
|
+
| Long-lived session | ✅ one process, N sessions |
|
|
530
|
+
| Resume | ✅ `session/load` (+ `fork`, `resume`) |
|
|
531
|
+
| Interrupt | ✅ `session/cancel` → `stopReason: cancelled` |
|
|
532
|
+
| List models | ✅ inline on `session/new`, all providers merged |
|
|
533
|
+
| Live model switch | ⚠️ `session/set_model` works but drops MCP tools (§3.10) |
|
|
534
|
+
| Live effort switch | ❌ no reasoning-effort concept in ACP (gateway has it) |
|
|
535
|
+
| Token deltas | ✅ real streaming, thinking + text (§3.7) |
|
|
536
|
+
| Images in input | ✅ base64 blocks, verified end to end (§3.8) |
|
|
537
|
+
| Interactive approvals | ✅ real, with diffs — best of any backend |
|
|
538
|
+
| Session list/history | ✅ `session/list` (cwd filter + cursor) + `session/load` |
|
|
539
|
+
| Home card preview | ✅ `session/list` has `title` + `updatedAt` + `cwd` |
|
|
540
|
+
| MCP | ✅ per-session via `session/new` (§3.10); no status RPC |
|
|
541
|
+
| Env injection | ✅ spawn env reaches agent shell (§3.9) |
|
|
542
|
+
| Multiple agents | ✅ profiles, importable _and_ creatable (§4) |
|
|
543
|
+
| Usage reporting | ✅ per-turn tokens + `usage_update` context meter; cost in `state.db` |
|
|
544
|
+
| Queue/steer mid-turn | ❌ ACP has no steer (gateway does) |
|
|
545
|
+
| Subagent lanes | ❌ `delegate_task` renders as a plain tool call |
|
|
546
|
+
| Native user echo | ❌ no optimistic-id echo — server synthesizes, like Claude Code |
|
|
547
|
+
| Tool results (live) | ⚠️ file tools drop completions (§3.4) |
|
|
548
|
+
| Channel sessions | ❌ invisible to ACP by design (§3.11) |
|
|
549
|
+
|
|
550
|
+
Folder would follow the existing convention:
|
|
551
|
+
|
|
552
|
+
```
|
|
553
|
+
server/harness/hermes/
|
|
554
|
+
adapter.ts session/update → StreamEvent
|
|
555
|
+
session.ts per-session state machine
|
|
556
|
+
client.ts spawn `hermes acp`, stdio JSON-RPC framing
|
|
557
|
+
sessions.ts session/list + session/load replay
|
|
558
|
+
index.ts the Harness object
|
|
559
|
+
NOTES.md this file
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
Touch points outside the folder are small and already enumerated by the Codex
|
|
563
|
+
precedent: `lib/types.ts` (`WorkspaceType` union), `lib/workspace-types.ts`
|
|
564
|
+
(ordering), `lib/format.ts` (`provider` union), `server/harness/registry.ts`,
|
|
565
|
+
`server/harness/executable.ts` (PATH lookup), `server/api.ts`
|
|
566
|
+
(`CREATABLE_TYPES`), and a handful of client files that branch on provider
|
|
567
|
+
(`client/features/chat/tool-group/format.ts`,
|
|
568
|
+
`client/features/home/workspace-setup/WorkspaceAgentStep.tsx`,
|
|
569
|
+
`client/features/dev/HarnessDebugPage.tsx`).
|
|
570
|
+
|
|
571
|
+
**Effort: comparable to Codex, likely a little less.** ACP is a documented
|
|
572
|
+
standard rather than a reverse-engineered protocol, the semantic tool vocabulary
|
|
573
|
+
already matches what the adapter layer converges on, and models/modes arrive
|
|
574
|
+
inline. Hacks actually required:
|
|
575
|
+
|
|
576
|
+
1. `session/set_mode('dont_ask')` on every new session (one call, §3.5).
|
|
577
|
+
2. Close orphaned file-tool cards at `stopReason` (§3.4) — or upstream a fix.
|
|
578
|
+
3. Re-register MCP servers after every `session/set_model`, or teardown-resume
|
|
579
|
+
instead (§3.10) — this one bites the per-chat model picker.
|
|
580
|
+
4. Provider config workaround for the `ollama-cloud` base-URL bug (§2), or
|
|
581
|
+
pin users to providers that resolve correctly.
|
|
582
|
+
5. Decide the profile policy (§4) — the only genuinely architectural call.
|
|
583
|
+
|
|
584
|
+
**Strategic note:** an ACP adapter is not Hermes-specific. ACP is the protocol
|
|
585
|
+
Zed's agent panel speaks, and other agents (Gemini CLI, opencode) implement it
|
|
586
|
+
too. Building `harness/acp/` with a thin Hermes profile on top would likely
|
|
587
|
+
cost the same as building `harness/hermes/` and would generalize.
|
|
588
|
+
|
|
589
|
+
## 9. End-to-end verification
|
|
590
|
+
|
|
591
|
+
`probe … e2e` drives the whole moi-shaped flow on one connection — spawn with
|
|
592
|
+
workspace env → `session/new` scoped to cwd → `set_mode('dont_ask')` →
|
|
593
|
+
tool-using turn → vision turn → interrupt → **kill the process** → cold
|
|
594
|
+
`session/list` by cwd → `session/load` replay → continue the conversation.
|
|
595
|
+
|
|
596
|
+
Run against the `research` profile, `openai-api:gpt-5.4-mini`, with an MCP
|
|
597
|
+
server attached — **12/13 passed**:
|
|
598
|
+
|
|
599
|
+
```
|
|
600
|
+
✓ initialize hermes-agent 0.20.0
|
|
601
|
+
✓ session/new + set_mode cwd=wsE2E
|
|
602
|
+
✓ model catalog inline 52 models
|
|
603
|
+
✓ turn 1 (tools + env) env reached agent shell; prompts=0
|
|
604
|
+
✓ token streaming 170 thought + 23 message frames
|
|
605
|
+
✓ per-turn usage 37888 in / 358 out
|
|
606
|
+
✗ mcp tool NO_TOOL ← §3.10, caused by set_model
|
|
607
|
+
✓ vision "a bright red filled circle on a plain white…"
|
|
608
|
+
✓ interrupt stopReason=cancelled
|
|
609
|
+
✓ session/list by cwd title="Write e2e.txt from MOI_TEST_ENV"
|
|
610
|
+
✓ history replay 2 tool_call / 2 tool_call_update, 4 user turns
|
|
611
|
+
✓ replay tool pairing complete
|
|
612
|
+
✓ context survives resume "I wrote `moi-env-works-7391` into `e2e.txt`."
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
The single failure is the `set_model` → MCP regression, isolated in §3.10:
|
|
616
|
+
the same MCP server works when no model switch happens.
|
|
617
|
+
|
|
618
|
+
## 10. Reproducing
|
|
619
|
+
|
|
620
|
+
```bash
|
|
621
|
+
curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash -s -- --skip-browser
|
|
622
|
+
# configure a provider (see §2 for the ollama-cloud trap)
|
|
623
|
+
hermes acp --check
|
|
624
|
+
|
|
625
|
+
export HERMES_BIN=/usr/local/lib/hermes-agent/venv/bin/hermes
|
|
626
|
+
export PROBE_CWD=/path/to/workspace
|
|
627
|
+
|
|
628
|
+
bun scripts/probe-hermes-acp.ts caps # initialize / list / models / modes
|
|
629
|
+
bun scripts/probe-hermes-acp.ts stream # live session/update frames
|
|
630
|
+
bun scripts/probe-hermes-acp.ts timing # token-streaming cadence
|
|
631
|
+
bun scripts/probe-hermes-acp.ts replay <sessionId>
|
|
632
|
+
bun scripts/probe-hermes-acp.ts cancel # stopReason semantics
|
|
633
|
+
bun scripts/probe-hermes-acp.ts modes # dont_ask vs default A/B
|
|
634
|
+
bun scripts/probe-hermes-acp.ts vision # inline image block
|
|
635
|
+
bun scripts/probe-hermes-acp.ts env # spawn env → agent shell
|
|
636
|
+
bun scripts/probe-hermes-acp.ts mcp ./mini-mcp.py
|
|
637
|
+
PROBE_PROFILE=research PROBE_MODEL=openai-api:gpt-5.4-mini \
|
|
638
|
+
bun scripts/probe-hermes-acp.ts e2e
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
`mcp`/`e2e` need a stdio MCP server exposing a `moi_secret_number` tool
|
|
642
|
+
returning `4173`; any 40-line script works (`PROBE_MCP_CMD` sets the
|
|
643
|
+
interpreter).
|
|
644
|
+
|
|
645
|
+
## 11. Implementation notes (shipped)
|
|
646
|
+
|
|
647
|
+
What driving the protocol through moi confirmed, beyond the probes:
|
|
648
|
+
|
|
649
|
+
- **The `acp/` split is the deliverable.** `acp/{wire,client,adapter,session,discovery}.ts`
|
|
650
|
+
is provider-agnostic; `hermes/` supplies an `AcpProviderConfig` (spawn spec,
|
|
651
|
+
no-prompt mode id, image support) plus profile discovery. A second ACP agent
|
|
652
|
+
should be a folder next to `hermes/`, not a fork of the protocol.
|
|
653
|
+
- **Chunks are not messages.** ACP streams text and thinking token-by-token
|
|
654
|
+
with no message boundary, so `acp/adapter.ts` owns the accumulation rule:
|
|
655
|
+
consecutive chunks build one assistant turn, and a tool call both closes the
|
|
656
|
+
open run and becomes its own turn. This is what makes the transcript read in
|
|
657
|
+
execution order instead of collapsing into one blob.
|
|
658
|
+
- **A completing `tool_call_update` carries no `title`** — only the opening
|
|
659
|
+
`tool_call` does. Naively re-deriving the name from each frame degrades the
|
|
660
|
+
card from `terminal: echo hi` to the bare kind `execute` the moment the call
|
|
661
|
+
finishes. The established name has to outrank the update's `kind`.
|
|
662
|
+
- **The §3.4 file-tool gap is real in practice**, and the fix is cheap: any
|
|
663
|
+
tool call still unsettled when `session/prompt` resolves is closed as
|
|
664
|
+
successful. The turn ending is proof the call finished.
|
|
665
|
+
- **`session/prompt`'s promise IS the turn.** It resolves at end of turn with
|
|
666
|
+
`{ stopReason, usage }`, so activity is mirrored from it rather than derived
|
|
667
|
+
by counting frames, and `cancelled` arrives on the same promise — the
|
|
668
|
+
interrupt path needs no separate signal.
|
|
669
|
+
- **No steer.** A send that lands mid-turn is queued in `acp/session.ts` and
|
|
670
|
+
flushed when the running turn resolves; an interrupt drops the queue.
|
|
671
|
+
- **Model catalog caching.** `listModels()` has no session to read from, so the
|
|
672
|
+
catalog is cached per workspace off a throwaway `session/new`. Zero-history
|
|
673
|
+
sessions are invisible to `session/list`, so this leaves no debris.
|
|
674
|
+
- **MCP is not wired yet.** moi passes `mcpServers: []`, which sidesteps the
|
|
675
|
+
§3.10 `set_model` regression. Per-workspace connectors are the next step and
|
|
676
|
+
will need the re-register workaround.
|
|
677
|
+
|
|
678
|
+
Verified live against the running server: session rename, 130+ preview frames
|
|
679
|
+
per turn, tool cards settling to success (including the file write Hermes never
|
|
680
|
+
completes), `stopped` on interrupt with the partial answer preserved, cold
|
|
681
|
+
`session/load` replay after a server restart, per-chat model switching, and
|
|
682
|
+
image attachments through moi's upload pipeline.
|
|
683
|
+
|
|
684
|
+
## 12. The official SDK, and the version skew it exposed
|
|
685
|
+
|
|
686
|
+
The wire types are no longer hand-written. `../acp/wire.ts` re-exports
|
|
687
|
+
[`@agentclientprotocol/sdk`](https://www.npmjs.com/package/@agentclientprotocol/sdk),
|
|
688
|
+
whose types are generated from the protocol's JSON Schema (262 definitions).
|
|
689
|
+
|
|
690
|
+
**Which package.** The one most search results point at,
|
|
691
|
+
`@zed-industries/agent-client-protocol`, is formally deprecated —
|
|
692
|
+
`"This package has been renamed to @agentclientprotocol/sdk"` — and froze at
|
|
693
|
+
0.4.5 in Oct 2025. The live package is `@agentclientprotocol/sdk`
|
|
694
|
+
(Apache-2.0, 1.3.0, ~5.2M weekly downloads vs ~20k for the deprecated one).
|
|
695
|
+
The protocol now lives in a vendor-neutral org; JetBrains maintains a repo too.
|
|
696
|
+
|
|
697
|
+
**Types only, dev-only.** `dist/schema/types.gen.js` has no runtime code, so
|
|
698
|
+
`import type` costs nothing and ships nothing. Importing _values_ instead
|
|
699
|
+
(`AGENT_METHODS`, `ClientSideConnection`, `ndJsonStream`) would pull zod in as
|
|
700
|
+
a real dependency for the sake of a few string constants, so moi keeps its own
|
|
701
|
+
method strings — verified against the SDK's `AGENT_METHODS` at 1.3.0 — and its
|
|
702
|
+
own transport, which already carries the `/dev/harness` wire tap, per-workspace
|
|
703
|
+
process lifecycle and env injection at spawn.
|
|
704
|
+
|
|
705
|
+
**⚠️ Hermes trails the spec.** This is the substantive finding. Hermes pins
|
|
706
|
+
Python `agent-client-protocol==0.9.0` (PyPI is at 0.12.0), a revision where
|
|
707
|
+
_models_ are first-class. The current spec has **no model concept at all**:
|
|
708
|
+
|
|
709
|
+
| | `session/set_model` |
|
|
710
|
+
| --------------------------------------------- | ------------------- |
|
|
711
|
+
| `@zed-industries/agent-client-protocol@0.4.5` | 8 occurrences |
|
|
712
|
+
| `@agentclientprotocol/sdk@1.0.0` … `1.3.0` | **0** |
|
|
713
|
+
|
|
714
|
+
`session/set_model` and `models.availableModels` were replaced by
|
|
715
|
+
`session/set_config_option` + `SessionConfigOption` (a select/boolean option
|
|
716
|
+
list on `NewSessionResponse`). moi's per-chat model picker rides on the old
|
|
717
|
+
shape, so `wire.ts` keeps a small, clearly-labelled "pre-1.0 additions" block
|
|
718
|
+
(`AcpModelInfo`, `AcpModelState`, `AcpNewSessionResult`). **Delete it when
|
|
719
|
+
Hermes moves to config options** — that is the whole migration.
|
|
720
|
+
|
|
721
|
+
Everything else moi consumes is current: `session_info_update` and
|
|
722
|
+
`usage_update` are both in the spec (`usage_update` requires `size`, which was
|
|
723
|
+
optional in the hand-written version).
|
|
724
|
+
|
|
725
|
+
**What the official types caught.** The spec models `tool_call` as `ToolCall`
|
|
726
|
+
(`title: string`, required) and `tool_call_update` as `ToolCallUpdate`
|
|
727
|
+
(`title?: string | null`) — independent confirmation of the §11 title-carryover
|
|
728
|
+
bug, now enforced by the compiler rather than by a comment. They also tightened
|
|
729
|
+
three things the hand-written types were sloppy about: `StopReason` is a closed
|
|
730
|
+
union (`end_turn | max_tokens | max_turn_requests | refusal | cancelled`),
|
|
731
|
+
`ToolKind` has ten members (not seven), and optional fields are `T | null`
|
|
732
|
+
rather than merely absent.
|
|
733
|
+
|
|
734
|
+
**Not adopted yet:** `ContentChunk.messageId`. The spec gives chunks an
|
|
735
|
+
explicit message boundary — "a change in `messageId` indicates a new message"
|
|
736
|
+
— which is the principled version of `AssistantTurnAccumulator`'s heuristic.
|
|
737
|
+
Hermes 0.20.0 does not send it, so the accumulator stays; prefer `messageId`
|
|
738
|
+
when an agent provides it.
|
|
739
|
+
|
|
740
|
+
## 13. Skills are profile-global, not workspace-local
|
|
741
|
+
|
|
742
|
+
Hermes resolves skills from exactly two places — `$HERMES_HOME/skills`
|
|
743
|
+
(`hermes_constants.get_skills_dir`) and the explicit `skills.external_dirs`
|
|
744
|
+
list in `config.yaml`. **There is no cwd-relative skill path.** Under
|
|
745
|
+
`hermes -p <name>`, `$HERMES_HOME` is `<root>/profiles/<name>`, so the scanned
|
|
746
|
+
directory is `<profile>/skills`.
|
|
747
|
+
|
|
748
|
+
moi therefore installs its skills into the **profile home**, not the
|
|
749
|
+
workspace, even though the workspace is `<profile>/workspace`. Installing into
|
|
750
|
+
the workspace (the OpenClaw shape, where the workspace _is_ the agent root)
|
|
751
|
+
leaves them invisible: `skills list` omits them and `skill view moi-workspace`
|
|
752
|
+
fails outright. The agent can still stumble on the files by shell-searching the
|
|
753
|
+
cwd, which is what made the bug look like it worked.
|
|
754
|
+
|
|
755
|
+
`skillsDir` climbs back with `profileHomeFromWorkspace()` — the exact inverse
|
|
756
|
+
of `profileWorkspace()`, kept beside it in `discovery.ts`, returning null for
|
|
757
|
+
any path moi did not lay out so callers fall back instead of writing into an
|
|
758
|
+
unrelated parent. `skillsDirFor` is the single resolver, so install, update and
|
|
759
|
+
version-check all follow.
|
|
760
|
+
|
|
761
|
+
Verified against Hermes 0.20.0:
|
|
762
|
+
|
|
763
|
+
- a flat `<skills>/<name>/SKILL.md` is discovered — the bundled tree is
|
|
764
|
+
`<skills>/<category>/<name>/`, but the scanner accepts both
|
|
765
|
+
- `skills list` reports it as `local` / `enabled`, and `skill view` returns
|
|
766
|
+
its body
|
|
767
|
+
- `hermes update` will not delete it: `tools/skills_sync.sync_skills` iterates
|
|
768
|
+
the _bundled_ list only and never scans the destination for unknown entries;
|
|
769
|
+
its one `rmtree` is gated on the directory hashing identical to a bundled
|
|
770
|
+
skill
|
|
771
|
+
|
|
772
|
+
**Consequences, accepted deliberately.** The skills are profile-global: every
|
|
773
|
+
session on that profile sees them, including plain `hermes` runs and gateway
|
|
774
|
+
(Telegram/Discord) chats — not just moi. Importing the _default_ profile puts
|
|
775
|
+
them in `~/.hermes/skills`, the root install's own directory. They also outlive
|
|
776
|
+
the workspace: removing the moi workspace leaves the skill in the profile's
|
|
777
|
+
list. Nothing writes to `config.yaml`, `.env` or `SOUL.md` — this is the same
|
|
778
|
+
directory `hermes skills install` targets.
|
|
779
|
+
|
|
780
|
+
Workspaces imported before this landed keep a stale copy under
|
|
781
|
+
`<workspace>/skills/`. It is inert (Hermes never scans there) and is left
|
|
782
|
+
alone rather than deleted.
|
|
783
|
+
|
|
784
|
+
## 14. Archiving a chat is moi-side
|
|
785
|
+
|
|
786
|
+
ACP specifies `session/delete`, but Hermes does not implement it — probed
|
|
787
|
+
directly, it answers JSON-RPC **-32601 "Method not found"**. `session/close`
|
|
788
|
+
returns `{}` but only drops the live session; the chat still lists. There is no
|
|
789
|
+
`session/archive` at all.
|
|
790
|
+
|
|
791
|
+
Hermes _does_ have the right primitive internally —
|
|
792
|
+
`hermes_state.SessionDB.set_session_archived(session_id, archived)`, a soft hide
|
|
793
|
+
that keeps every message and walks the whole compression chain (archiving only
|
|
794
|
+
the visible tip lets the still-unarchived root resurrect it). Its `sessions`
|
|
795
|
+
table has an `archived` column, and `list_sessions_rich` takes
|
|
796
|
+
`include_archived: bool = False`, which the ACP adapter never overrides — so an
|
|
797
|
+
archived session would drop out of `session/list` for free.
|
|
798
|
+
|
|
799
|
+
The problem is reach: the only callers of `set_session_archived` are HTTP routes
|
|
800
|
+
on `hermes serve` and the gateway API server, daemons moi deliberately does not
|
|
801
|
+
run (§6). The `hermes sessions archive` CLI is filter-based (age, source, title,
|
|
802
|
+
cwd — no session id), and `hermes sessions delete <id>` is a real delete.
|
|
803
|
+
|
|
804
|
+
So moi hides the chat on its own side, which is what the **Claude Code harness
|
|
805
|
+
already does** — it tags a session `moi:archived` and filters the list rather
|
|
806
|
+
than deleting anything. `../acp/archived.ts` keeps a per-workspace id list in
|
|
807
|
+
moi's data dir; `listAcpSessions` and the home-card preview filter against it,
|
|
808
|
+
and `forgetAcpSession` drops the live record. Because it lives in the ACP layer,
|
|
809
|
+
any future ACP provider inherits archiving without implementing anything.
|
|
810
|
+
|
|
811
|
+
Consequence, and the correct boundary: the chat stays in Hermes's own store and
|
|
812
|
+
is still visible to `hermes sessions list` and the gateway. moi hides a chat
|
|
813
|
+
from moi, not from the user's agent. Nothing is destroyed, and the store is a
|
|
814
|
+
plain id list, so unarchiving is a one-liner (`unarchiveAcpSession`) if a route
|
|
815
|
+
ever wants it.
|