refactor(m3-hermes): use the T3 Code module from m3ta-home #33

Merged
m3ta-chiron merged 1 commits from feat/m3-hermes-t3code-module into master 2026-11-03 18:10:31 +01:00
+11 -50
View File
@@ -7,8 +7,9 @@
# - Lane 3, control & inbox: Hermes via Matrix (unchanged). # - Lane 3, control & inbox: Hermes via Matrix (unchanged).
# #
# Flow: T3 desktop/mobile app ──NetBird mesh──▶ wt0 :3773 (this server). # Flow: T3 desktop/mobile app ──NetBird mesh──▶ wt0 :3773 (this server).
# The server binds 0.0.0.0, but the firewall admits the port for mesh # The server itself comes from m3ta-home's t3code module: it binds the
# peers only — same posture as ai-memory and the hermes dashboard. # current NetBird address of wt0 and opens the port on wt0 only. This file
# adds the hermes-specific agent runtime around it.
# #
# Agent runtime for the T3 harnesses (OpenCode / Claude Code, 2026-10-31): # Agent runtime for the T3 harnesses (OpenCode / Claude Code, 2026-10-31):
# - Skills/commands/agents via agent-lib v2: a timer syncs the work repo # - Skills/commands/agents via agent-lib v2: a timer syncs the work repo
@@ -17,7 +18,7 @@
# path unit mirrors skills into ~/.claude/skills for Claude Code # path unit mirrors skills into ~/.claude/skills for Claude Code
# (port of m3ta-home profiles/sets/coding/agents/claude-skills.nix). # (port of m3ta-home profiles/sets/coding/agents/claude-skills.nix).
# - Git identity and Gitea push auth: m3ta-chiron for every harness spawned # - Git identity and Gitea push auth: m3ta-chiron for every harness spawned
# by T3, baked into the package (overlays/default.nix, # by T3, baked into the package (m3ta-home overlay
# t3code-agent-identity), so m3tam3re's interactive git is untouched. # t3code-agent-identity), so m3tam3re's interactive git is untouched.
# - Gitea SSH: m3tam3re's ssh config pins User gitea + key ~/.ssh/gitea # - Gitea SSH: m3tam3re's ssh config pins User gitea + key ~/.ssh/gitea
# (one-time keygen; pubkey added to the m3ta-chiron account) for # (one-time keygen; pubkey added to the m3ta-chiron account) for
@@ -47,10 +48,6 @@
pkgs, pkgs,
... ...
}: let }: let
# Mesh-only via interface match on wt0 (NetBird) — an IPv4 CIDR in -s
# would abort the ip6tables run of ip46tables and fail the unit.
port = config.m3ta.ports.get "t3code";
# ── Lane-1 agent runtime ───────────────────────────────────────────── # ── Lane-1 agent runtime ─────────────────────────────────────────────
cockpitUser = "m3tam3re"; cockpitUser = "m3tam3re";
cockpitHome = "/home/${cockpitUser}"; cockpitHome = "/home/${cockpitUser}";
@@ -111,38 +108,13 @@ in {
pkgs.agent-lib pkgs.agent-lib
]; ];
# ── T3 Code server (system service, cockpit user) ──────────────────── # ── T3 Code server (m3ta-home module, cockpit user) ─────────────────
systemd.services.t3code = { # The harnesses, git and beads for the agents come from the system
description = "T3 Code server (interactive coding-agent cockpit)"; # profile above (the module puts /run/current-system/sw on the path).
after = ["network-online.target"]; m3ta.t3code = {
wants = ["network-online.target"]; enable = true;
wantedBy = ["multi-user.target"]; user = cockpitUser;
port = config.m3ta.ports.get "t3code";
serviceConfig = {
User = "m3tam3re";
Group = "users";
WorkingDirectory = "/home/m3tam3re";
ExecStart = "${pkgs.llm-agents.t3code}/bin/t3 serve --host 0.0.0.0";
Restart = "on-failure";
RestartSec = "5";
};
environment = {
T3CODE_PORT = toString port;
# Deterministic service context: HOME explicit so tools resolve ~ in
# every process this service spawns, however deep t3's pty/sandbox
# chain resets the environment.
HOME = cockpitHome;
};
# Harness CLIs, git and the issue tracker for the agents T3 Code spawns.
path = with pkgs; [
git
openssh
llm-agents.opencode2
llm-agents.claude-code
llm-agents.beads
];
}; };
# ── Gitea (code.m3ta.dev) for the T3 lane ──────────────────────────── # ── Gitea (code.m3ta.dev) for the T3 lane ────────────────────────────
@@ -215,15 +187,4 @@ in {
}; };
environment.HOME = cockpitHome; environment.HOME = cockpitHome;
}; };
networking.firewall = {
extraCommands = ''
# Allow t3code only from Netbird mesh VPN
ip46tables -A nixos-fw -p tcp --dport ${toString port} -i wt0 -j nixos-fw-accept
'';
extraStopCommands = ''
ip46tables -D nixos-fw -p tcp --dport ${toString port} -i wt0 -j nixos-fw-accept 2>/dev/null || true
'';
};
} }