Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1418,7 +1418,9 @@ let
# dispatch, and git-sync as Nix derivations built from this repo's
# pm-stack source. The nixos pm-stack module callPackages the same
# files into its units; these outputs make `nix build .#pm-<app>`
# the package-level check.
# the package-level check. ready-for-agent joins them from
# pkgs/ready-for-agent — the one pm-stack app packaged from its
# pinned upstream npm release rather than repo source (#12909).
make-pm-stack = inputs.flake-utils.lib.eachDefaultSystem (
system:
let
Expand All @@ -1428,6 +1430,7 @@ let
pm-aggregator = pkgs.callPackage ../pkgs/pm-aggregator/package.nix { };
pm-dispatch = pkgs.callPackage ../pkgs/pm-dispatch/package.nix { };
pm-git-sync = pkgs.callPackage ../pkgs/pm-git-sync/package.nix { };
ready-for-agent = pkgs.callPackage ../pkgs/ready-for-agent/package.nix { };
};
mkApp = pkg: program: {
type = "app";
Expand All @@ -1447,6 +1450,7 @@ let
pm-aggregator-generate-digest = mkApp pmPackages.pm-aggregator "pm-aggregator-generate-digest";
pm-dispatch = mkApp pmPackages.pm-dispatch "pm-dispatch";
pm-git-sync = mkApp pmPackages.pm-git-sync "pm-git-sync";
ready-for-agent = mkApp pmPackages.ready-for-agent "ready-for-agent";
};
}
);
Expand Down Expand Up @@ -1609,6 +1613,7 @@ let
grep -q "pm-aggregator" list.txt
grep -q "pm-projector" list.txt
grep -q "pm-tunnel" list.txt
grep -q "ready-for-agent" list.txt
grep -q "quota-recorder" list.txt
grep -q "session-proxy" list.txt
grep -q "mcpx" list.txt
Expand Down
3 changes: 3 additions & 0 deletions pkgs/deploy/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ let
pmAggregator = callPackage ../pm-aggregator/package.nix { };
pmProjector = callPackage ../pm-projector/package.nix { };
pmTunnel = cloudflared;
# Issue #12909: ready-for-agent, packaged from its pinned npm
# tarballs — the last of the four #12768 services to register.
readyForAgent = callPackage ../ready-for-agent/package.nix { };

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restrict the x86-only deploy target to supported systems

On aarch64-linux, this unconditional dependency prevents the entire deploy CLI from evaluating, including for unrelated services. make-deploy exports the CLI through eachDefaultSystem, and jsonDefinitions coerces every registered package to its store path, forcing evaluation of ready-for-agent despite its meta.platforms = [ "x86_64-linux" ]. The existing registry dependencies support ARM Linux, so this introduces a platform regression. Filter this registration to supported systems or provide an ARM payload, and adjust the corresponding list check if filtering.

Useful? React with 👍 / 👎.

};
jsonDefinitions = lib.mapAttrs (name: defn: defn // { package = "${defn.package}"; }) definitions;
in
Expand Down
33 changes: 24 additions & 9 deletions pkgs/deploy/services.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
pmAggregator,
pmProjector,
pmTunnel,
readyForAgent,
}:
{
queue-broker = {
Expand Down Expand Up @@ -428,13 +429,27 @@
class = "systemd";
};

# ready-for-agent - NOT registered here yet, deliberately, on
# issue #12768's own terms: it has no Nix derivation to point a
# definition at (it is an npm-pinned 1.1.0 install into ~/.local by
# pm-stack/ready-for-agent/install.sh), and its deployment of
# record is the NixOS pm-apps module under #1752. Registration
# waits on the packaging slice, #12909; when that lands, its
# definition (bin/ready-for-agent, args [ "start" "--no-open" ],
# ports [ 6056 ], healthCheck http://127.0.0.1:6056/) replaces
# this comment.
# ready-for-agent (#12909): the Harness UI + operator CLI. Its
# deployment of record is still the NixOS pm-apps module under
# #1752, whose unit runs the imperative ~/.local install
# (pm-stack/ready-for-agent/install.sh) — this definition is
# registration only, like the other pm-stack targets above, until
# the bundled cutover (#12768) switches the unit's ExecStart to
# this derivation.
ready-for-agent = {
package = readyForAgent;
entryPoint = "bin/ready-for-agent";
args = [
"start"
"--no-open"
];
environment = { };
secrets = [ ]; # the harness reads its own on-disk config; no broker-resolved names
user = "user";
ports = [ 6056 ]; # Harness UI + GraphQL, loopback
restart = "on-failure";
healthCheck = "http://127.0.0.1:6056/";
targets = [ "laptop" ];
class = "systemd";
};
}
108 changes: 108 additions & 0 deletions pkgs/ready-for-agent/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
lib,
stdenvNoCC,
fetchurl,
autoPatchelfHook,
makeWrapper,
nodejs,
versionCheckHook,
}:

# ready-for-agent — the PM stack's dispatch-layer Harness UI + operator
# CLI (pm-stack Phase 2), packaged from the pinned upstream npm release
# (code#12909; the packaging half of the #12768 deploy registration).
#
# Until this derivation existed, the laptop installed the package
# imperatively: pm-stack/ready-for-agent/install.sh runs
# `npm install -g --prefix ~/.local ready-for-agent@1.1.0`, and the
# NixOS pm-apps module's user unit (#1752) runs
# ~/.local/bin/ready-for-agent. This package gives the deploy registry
# a derivation to point a definition at; switching the pm-apps unit's
# ExecStart to the store binary is the bundled-cutover question on
# #12768/#1752, not this slice.
#
# DISTRIBUTION SHAPE -- why two tarballs: `ready-for-agent` is a thin
# JS launcher (bin/ready-for-agent.js, node >= 20) that resolves the
# platform package `ready-for-agent-linux-x64` through node's module
# resolution and spawns its bin/ready-for-agent, a Bun-compiled
# standalone ELF. npm installs the platform package as an
# optionalDependency nested in the launcher's node_modules; that exact
# layout is reproduced here from the two pinned tarballs, so the
# launcher runs unmodified. The payload is a dynamically linked ELF,
# hence autoPatchelfHook. Same shape as pkgs/claude-code.
#
# To update: bump version, then
# nix store prefetch-file --json \
# https://registry.npmjs.org/ready-for-agent/-/ready-for-agent-<ver>.tgz
# nix store prefetch-file --json \
# https://registry.npmjs.org/ready-for-agent-linux-x64/-/ready-for-agent-linux-x64-<ver>.tgz
# (the platform packages track the launcher version exactly), and bump
# PINNED_VERSION in pm-stack/ready-for-agent/install.sh in the same
# pass, until the cutover retires the imperative install.

let
version = "1.1.0";

launcher = fetchurl {
url = "https://registry.npmjs.org/ready-for-agent/-/ready-for-agent-${version}.tgz";
hash = "sha256-OGo+u1+0dwggc7mt6xrynPJzpZs9J3zOT7lrbpOKvEA=";
};

platformPkg = fetchurl {
url = "https://registry.npmjs.org/ready-for-agent-linux-x64/-/ready-for-agent-linux-x64-${version}.tgz";
hash = "sha256-YrhxxGHTWht7A9O3XJemwqfdGw0VyZQ2ISGsIJU6DtU=";
};
in
stdenvNoCC.mkDerivation {
pname = "ready-for-agent";
inherit version;

dontUnpack = true;

nativeBuildInputs = [
autoPatchelfHook
makeWrapper
];

# Upstream ships the Bun payload stripped; re-stripping gains nothing.
dontStrip = true;

installPhase = ''
runHook preInstall

# The launcher package, verbatim (npm tarballs root at package/).
mkdir -p "$out/lib/ready-for-agent"
tar -xzf ${launcher} -C "$out/lib/ready-for-agent" --strip-components=1

# The platform package where the launcher's module resolution
# looks for it: nested node_modules, exactly as npm's
# optionalDependency install lays it down.
mkdir -p "$out/lib/ready-for-agent/node_modules/ready-for-agent-linux-x64"
tar -xzf ${platformPkg} \
-C "$out/lib/ready-for-agent/node_modules/ready-for-agent-linux-x64" \
--strip-components=1
chmod +x "$out/lib/ready-for-agent/node_modules/ready-for-agent-linux-x64/bin/ready-for-agent"

install -Dm644 "$out/lib/ready-for-agent/README.md" \
"$out/share/doc/ready-for-agent/README.md"

makeWrapper ${lib.getExe nodejs} "$out/bin/ready-for-agent" \
--add-flags "$out/lib/ready-for-agent/bin/ready-for-agent.js"

runHook postInstall
'';

nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgramArg = "--version";
doInstallCheck = true;

meta = {
description = "Ready for Agent: local Harness UI + backend and operator CLI";
homepage = "https://github.com/berenddeboer/ready-for-agent";
downloadPage = "https://www.npmjs.com/package/ready-for-agent";
license = lib.licenses.mit;
mainProgram = "ready-for-agent";
platforms = [ "x86_64-linux" ];
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
};
}