Compare commits

..

3 Commits

13 changed files with 183 additions and 27 deletions

View File

@@ -7,6 +7,7 @@ keys:
- &admin age1m0pk94ysjlw3lmf6pyuv5l5pepvdjss8w0vxjv90dq6ndp02tdgsdwdvue - &admin age1m0pk94ysjlw3lmf6pyuv5l5pepvdjss8w0vxjv90dq6ndp02tdgsdwdvue
# Generated on the machine it names. # Generated on the machine it names.
- &neogaia age14a04vphzjq74epfrz9a09wjw8lzchtru84awzuq2n45d8f42ychqjs89qe - &neogaia age14a04vphzjq74epfrz9a09wjw8lzchtru84awzuq2n45d8f42ychqjs89qe
- &pikachu age1wf5s0n0tgt6ld2ysgu9dc67mj8ylwecgl4utzg7hqwy3kut9zyms7aglmh
creation_rules: creation_rules:
# Material belonging to one machine. # Material belonging to one machine.
@@ -24,3 +25,4 @@ creation_rules:
- age: - age:
- *admin - *admin
- *neogaia - *neogaia
- *pikachu

View File

@@ -20,6 +20,8 @@ The domain model (Host, Module, Skeleton, Auto-loader, Enable convention, overla
- Subagent completion delivery is non-blocking through immediate spawn, milestone notifications, retained terminal entries, and `subagent_list` or `subagent_result` retrieval. - Subagent completion delivery is non-blocking through immediate spawn, milestone notifications, retained terminal entries, and `subagent_list` or `subagent_result` retrieval.
`subagent_wait` intentionally blocks the parent tool call until its condition or timeout, so do not use it merely to keep background work alive during an interactive workflow. `subagent_wait` intentionally blocks the parent tool call until its condition or timeout, so do not use it merely to keep background work alive during an interactive workflow.
- Nixvim's flake input following the root nixpkgs source does not make its Home Manager module reuse the host's `pkgs` instance.
Keep `programs.nixvim.nixpkgs.useGlobalPackages = true` so Nixvim uses the shared package set without warning that its source default was affected.
- This host has no `python` or `python3` command on its ordinary `PATH`. - This host has no `python` or `python3` command on its ordinary `PATH`.
For ad hoc Python, use Nix explicitly, such as `nix shell nixpkgs#python3 -c python3 <script>`. For ad hoc Python, use Nix explicitly, such as `nix shell nixpkgs#python3 -c python3 <script>`.
- ADR bodies are immutable records of decisions as they were made, while frontmatter is mutable. - ADR bodies are immutable records of decisions as they were made, while frontmatter is mutable.

8
flake.lock generated
View File

@@ -562,11 +562,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1785622772, "lastModified": 1785695024,
"narHash": "sha256-0mOr+Jxerr4SU1ksLoSkztYlZ9P/nMB6RlgWygoCHWc=", "narHash": "sha256-DLLk6X5zu3cRT50p18uHVdwjGVtiS0t/661M34q02zU=",
"ref": "refs/heads/main", "ref": "refs/heads/main",
"rev": "40b16b87963b085817bfb82c26eef7d0408fa8a5", "rev": "9b2a6bcd583d7d6bf7e5377c3632f601692df209",
"revCount": 52, "revCount": 54,
"type": "git", "type": "git",
"url": "https://git.alexion.dev/alexion/skills" "url": "https://git.alexion.dev/alexion/skills"
}, },

View File

@@ -100,7 +100,11 @@
# `nix flake check` builds each host's toplevel. # `nix flake check` builds each host's toplevel.
checks.x86_64-linux = lib.mapAttrs ( checks.x86_64-linux = lib.mapAttrs (
_name: host: host.config.system.build.toplevel name: host:
if host.config.warnings == [] then
host.config.system.build.toplevel
else
throw "Host ${name} has evaluation warnings:\n${lib.concatStringsSep "\n" host.config.warnings}"
) self.nixosConfigurations; ) self.nixosConfigurations;
}; };
} }

View File

@@ -69,6 +69,7 @@
modules.agents.tools.gitea-axi.enable = true; modules.agents.tools.gitea-axi.enable = true;
modules.agents.pi.enable = true; modules.agents.pi.enable = true;
modules.agents.pi.subagents.maxConcurrent = 8; modules.agents.pi.subagents.maxConcurrent = 8;
modules.agents.pi.subagents.recentTerminalTtlMs = 15 * 60 * 1000;
modules.desktop.enable = true; modules.desktop.enable = true;
modules.desktop.obsidian.enable = true; modules.desktop.obsidian.enable = true;

58
hosts/pikachu/default.nix Normal file
View File

@@ -0,0 +1,58 @@
{
config,
pkgs,
...
}:
# pikachu — AZW ME Pro server.
# Disk layout is in ./disk.nix.
# `fileSystems` for the root disk are derived from it.
{
imports = [
./hardware-configuration.nix
./disk.nix
];
system.stateVersion = "26.05";
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
hardware.cpu.intel.updateMicrocode = true;
hardware.enableRedistributableFirmware = true;
zramSwap.enable = true;
systemd.network = {
enable = true;
networks."10-uplink" = {
matchConfig.MACAddress = "78:55:36:07:af:49";
networkConfig.DHCP = "yes";
linkConfig.RequiredForOnline = "routable";
};
};
networking.useDHCP = false;
boot.zfs.forceImportRoot = false;
modules.zfs = {
enable = true;
hostId = "2346edbd";
pools.pikachu = { };
};
modules.ssh.enable = true;
modules.ssh.hostKeys.restore = false;
modules.ssh.authorizedKeys = config.modules.ssh.workstationKeys;
modules.git.enable = true;
modules.toolkit.enable = true;
environment.systemPackages = with pkgs; [
pciutils
smartmontools
usbutils
];
time.timeZone = "America/New_York";
i18n.defaultLocale = "en_GB.UTF-8";
}

32
hosts/pikachu/disk.nix Normal file
View File

@@ -0,0 +1,32 @@
{ ... }:
# pikachu's install layout for disko: one NVMe boot disk with an EFI system partition and ext4 root.
# The existing 8 TB ZFS mirror is imported by name and is never declared here.
{
disko.devices.disk.main = {
type = "disk";
device = "/dev/nvme0n1";
content = {
type = "gpt";
partitions = {
ESP = {
size = "2G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
}

View File

@@ -0,0 +1,18 @@
{ lib, modulesPath, ... }:
# Hardware detected from the Proxmox inventory for this machine.
# disko derives the root disk filesystems, none declared here.
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [
"ahci"
"nvme"
"sd_mod"
"xhci_pci"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

View File

@@ -335,29 +335,31 @@ test("clearTerminal returns only removed terminal ids", async () => {
assert.equal(supervisor.status(running.id).state, "running"); assert.equal(supervisor.status(running.id).state, "running");
}); });
test("terminal records stay listed past ttl and remain retrievable until cleared", async () => { test("terminal records expire after ttl while active children remain", async () => {
const runner = new FakeRunner(); const runner = new FakeRunner();
const supervisor = new Supervisor(runner, "/tmp", { recentTerminalTtlMs: 5 }); const supervisor = new Supervisor(runner, "/tmp", { recentTerminalTtlMs: 5 });
const completed = await spawnStarted(supervisor, "one"); const completed = await spawnStarted(supervisor, "one");
const failed = await spawnStarted(supervisor, "two"); const failed = await spawnStarted(supervisor, "two");
const running = await spawnStarted(supervisor, "three");
runner.starts[0].events.completed("one done", "agent_settled"); runner.starts[0].events.completed("one done", "agent_settled");
runner.starts[1].events.failed("two failed"); runner.starts[1].events.failed("two failed");
await sleep(10);
const listedIds = supervisor.list().map((status) => status.id);
assert.ok(listedIds.includes(completed.id));
assert.ok(listedIds.includes(failed.id));
assert.equal(supervisor.result(completed.id).result, "one done"); assert.equal(supervisor.result(completed.id).result, "one done");
assert.equal(supervisor.result(failed.id).error, "two failed"); assert.equal(supervisor.result(failed.id).error, "two failed");
assert.equal(supervisor.status(running.id).state, "running");
(supervisor as Supervisor & { clearTerminal(): void }).clearTerminal(); await sleep(20);
const afterClearIds = supervisor.list().map((status) => status.id); const listedIds = supervisor.list().map((status) => status.id);
assert.equal(afterClearIds.includes(completed.id), false); assert.equal(listedIds.includes(completed.id), false);
assert.equal(afterClearIds.includes(failed.id), false); assert.equal(listedIds.includes(failed.id), false);
assert.equal(listedIds.includes(running.id), true);
assert.throws(() => supervisor.status(completed.id), /unknown subagent id/); assert.throws(() => supervisor.status(completed.id), /unknown subagent id/);
assert.throws(() => supervisor.status(failed.id), /unknown subagent id/);
assert.throws(() => supervisor.result(completed.id), /unknown subagent id/);
assert.throws(() => supervisor.result(failed.id), /unknown subagent id/); assert.throws(() => supervisor.result(failed.id), /unknown subagent id/);
assert.equal(supervisor.status(running.id).state, "running");
}); });
test("zero recent terminal ttl does not hide terminal statuses", async () => { test("zero recent terminal ttl does not hide terminal statuses", async () => {

View File

@@ -20,6 +20,7 @@ interface RunningChild {
handle?: ChildHandle; handle?: ChildHandle;
startTimer?: ReturnType<typeof setTimeout>; startTimer?: ReturnType<typeof setTimeout>;
runTimer?: ReturnType<typeof setTimeout>; runTimer?: ReturnType<typeof setTimeout>;
expiryTimer?: ReturnType<typeof setTimeout>;
} }
interface SupervisorOptions { interface SupervisorOptions {
@@ -99,6 +100,7 @@ export class Supervisor {
for (const [id, child] of this.children) { for (const [id, child] of this.children) {
if (selectedIds && !selectedIds.includes(id)) continue; if (selectedIds && !selectedIds.includes(id)) continue;
if (!isTerminal(child.record.status.state)) continue; if (!isTerminal(child.record.status.state)) continue;
this.clearTimer(child, "expiryTimer");
cleared.push(id); cleared.push(id);
this.children.delete(id); this.children.delete(id);
} }
@@ -159,6 +161,7 @@ export class Supervisor {
} }
}), }),
); );
for (const child of this.children.values()) this.clearTimer(child, "expiryTimer");
} }
private createChild(request: SpawnRequest): SpawnAccepted { private createChild(request: SpawnRequest): SpawnAccepted {
@@ -250,7 +253,10 @@ export class Supervisor {
this.recordActivity(record, "completed", now); this.recordActivity(record, "completed", now);
record.status.stopReason = stopReason; record.status.stopReason = stopReason;
record.status.resultAvailable = true; record.status.resultAvailable = true;
if (child) this.emitMilestone(child, "completed"); if (child) {
this.armTerminalExpiry(child);
this.emitMilestone(child, "completed");
}
this.pumpQueue(); this.pumpQueue();
}, },
failed: (error) => this.fail(record, error), failed: (error) => this.fail(record, error),
@@ -269,7 +275,10 @@ export class Supervisor {
this.recordActivity(record, "failed", now); this.recordActivity(record, "failed", now);
record.status.error = error; record.status.error = error;
record.status.stopReason = "failed"; record.status.stopReason = "failed";
if (child) this.emitMilestone(child, "failed"); if (child) {
this.armTerminalExpiry(child);
this.emitMilestone(child, "failed");
}
this.pumpQueue(); this.pumpQueue();
} }
@@ -283,6 +292,7 @@ export class Supervisor {
child.record.status.lastEventAt = now; child.record.status.lastEventAt = now;
this.recordActivity(child.record, state, now); this.recordActivity(child.record, state, now);
child.record.status.stopReason = reason; child.record.status.stopReason = reason;
this.armTerminalExpiry(child);
this.emitMilestone(child, state); this.emitMilestone(child, state);
} }
@@ -309,12 +319,26 @@ export class Supervisor {
this.pumpQueue(); this.pumpQueue();
} }
private armTerminalExpiry(child: RunningChild) {
const ttl = this.options.recentTerminalTtlMs;
if (ttl === undefined || ttl <= 0) return;
this.clearTimer(child, "expiryTimer");
child.expiryTimer = setTimeout(() => {
child.expiryTimer = undefined;
const id = child.record.status.id;
if (this.children.get(id) !== child || !isTerminal(child.record.status.state)) return;
this.children.delete(id);
this.emitChange();
}, ttl);
child.expiryTimer.unref?.();
}
private clearTimers(child: RunningChild) { private clearTimers(child: RunningChild) {
this.clearTimer(child, "startTimer"); this.clearTimer(child, "startTimer");
this.clearTimer(child, "runTimer"); this.clearTimer(child, "runTimer");
} }
private clearTimer(child: RunningChild, key: "startTimer" | "runTimer") { private clearTimer(child: RunningChild, key: "startTimer" | "runTimer" | "expiryTimer") {
const timer = child[key]; const timer = child[key];
if (!timer) return; if (!timer) return;
clearTimeout(timer); clearTimeout(timer);

View File

@@ -32,6 +32,9 @@ in
image = wallpaper; image = wallpaper;
# Regreet is not enabled, so its styling target stays off.
targets.regreet.enable = false;
cursor = { cursor = {
package = pkgs.bibata-cursors; package = pkgs.bibata-cursors;
# Solid white with a dark outline, so it stays easy to spot against the # Solid white with a dark outline, so it stays easy to spot against the

View File

@@ -19,6 +19,7 @@ in
home-manager.users.${user} = hm: { home-manager.users.${user} = hm: {
programs.nixvim = { programs.nixvim = {
enable = true; enable = true;
nixpkgs.useGlobalPackages = true;
extraPackages = with pkgs; [ extraPackages = with pkgs; [
git # neogit and gitsigns shell out to git git # neogit and gitsigns shell out to git

View File

@@ -3,22 +3,31 @@ sops:
age: age:
- enc: | - enc: |
-----BEGIN AGE ENCRYPTED FILE----- -----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBVYzZuaERsRjMyaTAwL3Ri YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBvdGQ0ZnZ2UlVaTFVuRmJI
b2RhaGZ1aHNOSzVMamVxWkdKb3VKTk9QMmk4CmV0R3hYN3hkMU1tVDJLNkFlT08y aVZNVjZVNGdiVGVhUTVXN3luU0V1eUZFb0ZRCkVrY3lKRE9GTUEzV0ZjUnk4UHdl
SUdUeUZ4d2JwNmdyOWVJcmZNcEtCb1EKLS0tIHhDV1NZWWdDZUNMYjVqYUVlc0ty QnFMVDhMcGVUTWFQemxrSnNEMStpSEEKLS0tIFFIQndkZHp1NkRmRlB4RXlwdk5C
Y1owUFZPMXBHbDhjVWxTUjZGRk1IUzQK7VENq6TjuOFlon+CJqUxbIJZ9qka78C/ cTJVQW9iMWhaMlk1dUxBK1ZvQTRuV0kKm7/z24q4NcDFlVuxZViDFlJodjRzRqhY
LDsgaTD+7zCBPgASwPbF88pH6tdK7bvNLJnznlZdZBL12eOy25BmOQ== 7X9LqouIXcGhDgwq0hh+JXRfYCz9LDiUJtOLHR7Lu/oscCBCnk7N6Q==
-----END AGE ENCRYPTED FILE----- -----END AGE ENCRYPTED FILE-----
recipient: age1m0pk94ysjlw3lmf6pyuv5l5pepvdjss8w0vxjv90dq6ndp02tdgsdwdvue recipient: age1m0pk94ysjlw3lmf6pyuv5l5pepvdjss8w0vxjv90dq6ndp02tdgsdwdvue
- enc: | - enc: |
-----BEGIN AGE ENCRYPTED FILE----- -----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBHY0ZXT3lRWS9DMFA1MHhl YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBTOENXYmRRNmVQeUtvOVFy
MDZiWHhEMy9INGtpd1ZOdzh0OFRoUlZDa0hZCkJwTUV4c01YWlE1QjNDd3pRN3F0 eElWVUhnUnJDTk93aVJCVmpTcHd2aVpKSFhJCk9oUk5ObHNSZHNwSisrSE9JbjRI
SGJWWmFTT1NMQktNejVHY1RrRlZJNFEKLS0tIHlRZG9ZV3FrQktSN2tURVV1NmlW WVllODlYek1VMDZpMmh3M2JRTU92ZEkKLS0tIFVVNG9RNnlzS0ZvMUM3bVN2Mldo
UTBZbFlqMmFGZ0VPSlA1dmNMU2Q3TFUKtL2V8t9+Qw5vjXursvCVRatflX8JKXJr N0MvcXEraDcwUHVxbTJqWGdxTGhOVG8KIhIY9QGbt/eWy9bfST4tEkjLQLylaHRm
VuA8oe0nKpk7wh4fCzcT7RoRKpJY0gPFjIzeTZGVfoAmZIUWMhzRuw== AwYIwU1Hw6HXR1TX3t0YciI3c8HcWISruY/tBR3xIHIdBlQR5OTaeA==
-----END AGE ENCRYPTED FILE----- -----END AGE ENCRYPTED FILE-----
recipient: age14a04vphzjq74epfrz9a09wjw8lzchtru84awzuq2n45d8f42ychqjs89qe recipient: age14a04vphzjq74epfrz9a09wjw8lzchtru84awzuq2n45d8f42ychqjs89qe
- enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA4ODgyNjQ1RFMwOGpUaG5U
UDNjTENrYzY5UFVTNlRONlBhNmVUUXk2OVd3ClFQUUhFaUM4YmR6dVNlMXRwWUFY
ais3L0FyQ1ozWjFMMHhjWmU1NU5JdVUKLS0tIG1tS1NoZjhBb3JRak9XdEpOT3Vy
Uk5HdUd6NUsrZWx2Y1lrWGdHRXcxZEUK470gSumRCpgYvIWJcmylw0VTgyV3et/B
QkVLBz5x+ShVun27nN3oz8And0qXfwgXojhM3yWnBSUa9CFBsbTOJQ==
-----END AGE ENCRYPTED FILE-----
recipient: age1wf5s0n0tgt6ld2ysgu9dc67mj8ylwecgl4utzg7hqwy3kut9zyms7aglmh
lastmodified: "2026-07-20T03:22:00Z" lastmodified: "2026-07-20T03:22:00Z"
mac: ENC[AES256_GCM,data:ei7PKVAIjJ6fGkxqJFc5wdYapq1gElel3fTJ+yKhvWHU+39aKcllG66T3d9FitRztgyt69phykHdKvxDHRUwYeyl1YBzyf1ZpPU5mXJb+hkLtVB1Am7StcP+m7jFqKSmqtYhIT9OxUrH0MJ8qeoU9216otwkhhpPz2hr1s7KYFk=,iv:Pp03KmlinjJiiTZezr0LzzkcHb1a5XWgDpu38jhl9Rk=,tag:HAqFitge+KTCtDE24t8/ig==,type:str] mac: ENC[AES256_GCM,data:ei7PKVAIjJ6fGkxqJFc5wdYapq1gElel3fTJ+yKhvWHU+39aKcllG66T3d9FitRztgyt69phykHdKvxDHRUwYeyl1YBzyf1ZpPU5mXJb+hkLtVB1Am7StcP+m7jFqKSmqtYhIT9OxUrH0MJ8qeoU9216otwkhhpPz2hr1s7KYFk=,iv:Pp03KmlinjJiiTZezr0LzzkcHb1a5XWgDpu38jhl9Rk=,tag:HAqFitge+KTCtDE24t8/ig==,type:str]
unencrypted_suffix: _unencrypted unencrypted_suffix: _unencrypted