feat: Endo-compatible host, downloads folder, Nix tools PATH
- the fake host serves a subset of @endo/agent-mcp-stdio's catalog, with its names, schemas and answers; evaluate takes only E(name).method(arg, ...), and __getMethodNames__ - demo.py --host endo: a real Endo daemon (endo-but-for-bots, llm), its guest served by the package's broker - a downloads folder: the host writes, Hermes reads at ~/Downloads; BindReadOnlyPaths on Linux, a virtiofs share on macOS - .#demo-tools: Hermes and the checks get their whole PATH from the store - each run saves its MCP messages and a transcript - the guide: tools as system calls, names as file descriptors; no Linux networking, but WebApps - grants match a named URL before "download" Generated-by: Claude Opus 5.5
This commit is contained in:
1 parent
783e4c595f
commit
3f9ba54477
15 files changed
+2398
-282
No files matched your search
+8
-1
@@ -33,7 +33,14 @@ let
|
||||
|
||||
vm = plist "net.madmode.hermes-vm" {
|
||||
Label = "net.madmode.hermes-vm";
|
||||
ProgramArguments = [ "${runner}/bin/microvm-run" ];
|
||||
# vfkit shares hostDir/Downloads into the VM, so it must exist first
|
||||
ProgramArguments = [
|
||||
"/bin/sh"
|
||||
"-c"
|
||||
''mkdir -p "$0/Downloads" && exec "$1"''
|
||||
hostDir
|
||||
"${runner}/bin/microvm-run"
|
||||
];
|
||||
WorkingDirectory = hostDir;
|
||||
KeepAlive = true;
|
||||
StandardOutPath = "${hostDir}/vm.log";
|
||||
|
||||
+19
-5
@@ -2,14 +2,18 @@
|
||||
#
|
||||
# This module is what ports: the same unit runs on a Linux host and inside
|
||||
# the macOS VM (./vfkit-vm.nix). It reaches the world through exactly two
|
||||
# Unix sockets, and whatever imports it decides what serves them:
|
||||
# Unix sockets and one directory, and whatever imports it decides what
|
||||
# serves them:
|
||||
#
|
||||
# hostSocket the guest's methods (listMessages, request, resolve,
|
||||
# lookup, ...) as an MCP server, bound to one guest agent
|
||||
# hostSocket the guest's methods (listMessages, request, evaluate,
|
||||
# ...) as an MCP server, bound to one guest agent
|
||||
# llmSocket model inference, through a proxy that holds the API key
|
||||
# downloadsDir the guest's downloads folder, ~/Downloads: the host
|
||||
# writes it, and Hermes only reads it
|
||||
#
|
||||
# The service has no network of its own (PrivateNetwork), and its root
|
||||
# is empty except for its closure and those two sockets (confinement).
|
||||
# The service has no network of its own (PrivateNetwork), and its root is
|
||||
# empty except for its closure, those two sockets, the downloads folder,
|
||||
# and its state (confinement).
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
@@ -76,6 +80,14 @@ in
|
||||
default = 8080;
|
||||
description = "The loopback port, inside Hermes's own network namespace, that forwards to llmSocket.";
|
||||
};
|
||||
downloadsDir = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "/var/lib/hermes-downloads";
|
||||
description = ''
|
||||
The guest's downloads folder, as the host sees it: the host writes files here (say, a
|
||||
WebApp's body, by E(dir).write(name, blob)), and Hermes sees it, read-only, as ~/Downloads.
|
||||
'';
|
||||
};
|
||||
model = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "The model name, as the proxy's upstream knows it.";
|
||||
@@ -131,6 +143,8 @@ in
|
||||
BindReadOnlyPaths = [
|
||||
cfg.hostSocket
|
||||
cfg.llmSocket
|
||||
# read-only: Hermes can't plant anything there for the host to trip on
|
||||
"${cfg.downloadsDir}:${hermes.stateDir}/Downloads"
|
||||
];
|
||||
BindPaths = [ hermes.stateDir ];
|
||||
ProtectHome = lib.mkForce true;
|
||||
|
||||
@@ -23,7 +23,16 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
options.services.hermes-guest.downloadsUser = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
example = "toybox";
|
||||
description = "The host's user, who writes downloadsDir; Hermes's group may read it.";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.tmpfiles.rules = [
|
||||
"d ${cfg.downloadsDir} 0750 ${cfg.downloadsUser} ${config.services.hermes-agent.group} -"
|
||||
];
|
||||
services.hermes-llm-proxy = {
|
||||
enable = true;
|
||||
socket = cfg.llmSocket;
|
||||
|
||||
+11
-2
@@ -2,7 +2,8 @@
|
||||
# Inside the VM, systemd serves Hermes's two sockets too; each connection
|
||||
# is relayed over vsock to the host (CID 2), where vfkit connects it to a
|
||||
# Unix socket in hostDir. So the host's listeners on those two paths
|
||||
# decide what Hermes can reach.
|
||||
# decide what Hermes can reach. The downloads folder is hostDir/Downloads,
|
||||
# shared into the VM by virtiofs.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
@@ -42,7 +43,7 @@ in
|
||||
hostDir = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
example = "/Users/me/.local/state/hermes-guest";
|
||||
description = "The host directory with the VM's state image, and the two Unix sockets vfkit connects to.";
|
||||
description = "The host directory with the VM's state image, the two Unix sockets vfkit connects to, and the guest's downloads folder, Downloads.";
|
||||
};
|
||||
hostPort = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
@@ -75,6 +76,14 @@ in
|
||||
mountPoint = "/nix/.ro-store";
|
||||
proto = "virtiofs";
|
||||
}
|
||||
# the downloads folder, which the host writes; the unit binds it
|
||||
# read-only into Hermes's home
|
||||
{
|
||||
tag = "downloads";
|
||||
source = "${vm.hostDir}/Downloads";
|
||||
mountPoint = cfg.downloadsDir;
|
||||
proto = "virtiofs";
|
||||
}
|
||||
];
|
||||
volumes = [
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user