add rea agent module and reverse-engineer archetype
This commit is contained in:
parent
21a217c75c
commit
50c1f2a3d1
2 changed files with 2083 additions and 8 deletions
81
nix/module-eval/agent-rea.nix
Normal file
81
nix/module-eval/agent-rea.nix
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
# `checks.module-eval-agent-rea` — see ./lib.nix for the shared
|
||||
# rationale (why this suite exists, naming convention, "evaluates
|
||||
# not executes").
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
self,
|
||||
nixosSystem,
|
||||
shared,
|
||||
}:
|
||||
let
|
||||
inherit
|
||||
(import ./lib.nix {
|
||||
inherit
|
||||
pkgs
|
||||
lib
|
||||
self
|
||||
nixosSystem
|
||||
;
|
||||
})
|
||||
agentWith
|
||||
runGroup
|
||||
;
|
||||
|
||||
# The option is switched on by the archetype that exists for it, so this one
|
||||
# fixture is the "on" arm and the archetype's own wiring.
|
||||
agentRea = agentWith self.hyperhiveArchetypes.reverse-engineer.module;
|
||||
agentNoRea = shared.agentBare;
|
||||
|
||||
rea = agentRea.services.hyperhive.agent.extraMcpServers.rea;
|
||||
pkgsOf = machine: machine.environment.systemPackages;
|
||||
reaTmpfiles = machine: lib.filter (lib.hasInfix "/state/rea") machine.systemd.tmpfiles.rules;
|
||||
in
|
||||
runGroup "agent-rea" [
|
||||
{
|
||||
# `rea` is the presence control for every absence below: the same lookups
|
||||
# find the entry, the variables, the packages and the directories when
|
||||
# the option is on.
|
||||
name = "enabling rea registers its MCP server with every tool allowed and sets Ghidra's environment";
|
||||
ok =
|
||||
rea.allowedTools == [ "*" ]
|
||||
&& rea.args == [ "mcp" ]
|
||||
&& lib.hasSuffix "/bin/rea" rea.command
|
||||
&& lib.all (n: rea.env ? ${n} && agentRea.environment.variables ? ${n}) [
|
||||
"GHIDRA_INSTALL_DIR"
|
||||
"JAVA_HOME"
|
||||
"REA_GHIDRA_PROJECT_PATH"
|
||||
"GHIDRA_HEADLESS_MAXMEM"
|
||||
]
|
||||
&& rea.env.GHIDRA_HEADLESS_MAXMEM == "2G"
|
||||
&& lib.hasPrefix "/agents/a1/state/" rea.env.REA_GHIDRA_PROJECT_PATH;
|
||||
}
|
||||
{
|
||||
name = "enabling rea installs rea and Ghidra 12.1, and creates the agent-owned project directories";
|
||||
ok =
|
||||
let
|
||||
packages = agentRea.services.hyperhive.agent.packages;
|
||||
in
|
||||
lib.all (p: lib.elem p (pkgsOf agentRea)) [
|
||||
packages.rea
|
||||
packages.ghidra-12-1
|
||||
]
|
||||
&& lib.versionAtLeast packages.ghidra-12-1.version "12.1"
|
||||
&& lib.length (reaTmpfiles agentRea) == 2
|
||||
&& lib.all (lib.hasInfix " a1 a1 ") (reaTmpfiles agentRea);
|
||||
}
|
||||
{
|
||||
name = "an agent without rea gets no REA server, no Ghidra variables, no REA packages and no project directories";
|
||||
ok =
|
||||
let
|
||||
packages = agentNoRea.services.hyperhive.agent.packages;
|
||||
in
|
||||
!agentNoRea.services.hyperhive.agent.rea.enable
|
||||
&& !(agentNoRea.services.hyperhive.agent.extraMcpServers ? rea)
|
||||
&& !(agentNoRea.environment.variables ? GHIDRA_INSTALL_DIR)
|
||||
&& !(agentNoRea.environment.variables ? REA_GHIDRA_PROJECT_PATH)
|
||||
&& !(lib.elem packages.rea (pkgsOf agentNoRea))
|
||||
&& !(lib.elem packages.ghidra-12-1 (pkgsOf agentNoRea))
|
||||
&& reaTmpfiles agentNoRea == [ ];
|
||||
}
|
||||
]
|
||||
|
|
@ -149,7 +149,7 @@ let
|
|||
# output and prints it as JSON. A derivation or a path in `meta` would
|
||||
# make that evaluation build or copy something; a function would not
|
||||
# print at all.
|
||||
name = "the built-in archetypes carry a module and a meta of plain data, and reviewer can run commands and android-dev installs its toolchain";
|
||||
name = "the built-in archetypes carry a module and a meta of plain data, and reviewer can run commands and android-dev installs its toolchain and reverse-engineer turns rea on";
|
||||
ok =
|
||||
let
|
||||
plain =
|
||||
|
|
@ -174,7 +174,8 @@ let
|
|||
&& !(lib.elem "meta" reviewer)
|
||||
&&
|
||||
lib.elem pkgs.android-tools
|
||||
(archetypes.android-dev.module { inherit pkgs; }).environment.systemPackages;
|
||||
(archetypes.android-dev.module { inherit pkgs; }).environment.systemPackages
|
||||
&& archetypes.reverse-engineer.module.services.hyperhive.agent.rea.enable;
|
||||
}
|
||||
{
|
||||
# `docs.enable` reads `docs.source`, whose default builds from the
|
||||
|
|
|
|||
Loading…
Reference in a new issue