- 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
55 lines
1.7 KiB
Nix
55 lines
1.7 KiB
Nix
# On macOS: launchd agents for the host side of the VM, with no nix-darwin.
|
|
# The result has the plists in share/LaunchAgents; see the README.
|
|
{
|
|
pkgs,
|
|
lib,
|
|
runner, # the VM's microvm runner (config.microvm.declaredRunner)
|
|
hostDir,
|
|
upstream,
|
|
keyFile,
|
|
}:
|
|
let
|
|
proxy = pkgs.writers.writePython3 "llm-proxy" { flakeIgnore = [ "E501" ]; } (
|
|
builtins.readFile ../llm-proxy.py
|
|
);
|
|
plist = name: attrs: pkgs.writeText "${name}.plist" (lib.generators.toPlist { escape = true; } attrs);
|
|
|
|
# the inference proxy: launchd listens, and hands each connection to a
|
|
# fresh proxy as its stdin (inetd style), as systemd's Accept=yes does
|
|
llmProxy = plist "net.madmode.hermes-llm-proxy" {
|
|
Label = "net.madmode.hermes-llm-proxy";
|
|
ProgramArguments = [
|
|
"${proxy}"
|
|
upstream
|
|
keyFile
|
|
];
|
|
inetdCompatibility.Wait = false;
|
|
Sockets.Listener = {
|
|
SockPathName = "${hostDir}/llm.sock";
|
|
SockPathMode = 384; # 0600
|
|
};
|
|
StandardErrorPath = "${hostDir}/llm-proxy.log";
|
|
};
|
|
|
|
vm = plist "net.madmode.hermes-vm" {
|
|
Label = "net.madmode.hermes-vm";
|
|
# 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";
|
|
StandardErrorPath = "${hostDir}/vm.log";
|
|
};
|
|
in
|
|
pkgs.runCommand "hermes-guest-darwin-host" { } ''
|
|
mkdir -p $out/share/LaunchAgents
|
|
cp ${llmProxy} $out/share/LaunchAgents/net.madmode.hermes-llm-proxy.plist
|
|
cp ${vm} $out/share/LaunchAgents/net.madmode.hermes-vm.plist
|
|
''
|