@astrofoundry/pi-astro 0.40.28 → 0.40.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/extensions/specialist-gate/approvals.test.ts +1 -0
- package/extensions/specialist-gate/index.ts +1 -1
- package/package.json +1 -1
- package/skills/backup/SKILL.md +4 -0
- package/skills/network/SKILL.md +3 -1
- package/skills/proxmox/SKILL.md +1 -1
- package/specialists/network/run.ts +18 -0
- package/specialists/wrappers.test.ts +4 -1
|
@@ -22,6 +22,7 @@ describe("approvals", () => {
|
|
|
22
22
|
expect(isRisky("network", ["unifi", "mira", "nat-write", "POST", "{}"])).toBe(true);
|
|
23
23
|
expect(isRisky("network", ["unifi", "37", "nat"])).toBe(false);
|
|
24
24
|
expect(isRisky("network", ["unifi", "mira", "app-policy-delete", "0123456789abcdef01234567"])).toBe(true);
|
|
25
|
+
expect(isRisky("network", ["unifi", "mira", "client-fixed-ip", "0123456789abcdef01234567", "{}"])).toBe(true);
|
|
25
26
|
expect(isRisky("network", ["unifi", "mira", "device-network", "0123456789abcdef01234567", "{}"])).toBe(true);
|
|
26
27
|
expect(isRisky("network", ["unifi", "mira", "app-get", "/api/s/default/stat/device"])).toBe(false);
|
|
27
28
|
expect(isRisky("arcane", ["projects", "list"])).toBe(false);
|
|
@@ -33,7 +33,7 @@ export const RISKY: Readonly<Record<string, readonly RegExp[]>> = {
|
|
|
33
33
|
],
|
|
34
34
|
identity: [/^zitadel\s+(DELETE|POST|PUT|PATCH)\b/, /^dmz\s+(deploy-config|pomerium-restart|render|lego-renew)\b/],
|
|
35
35
|
// Every UniFi write, on either console.
|
|
36
|
-
network: [/^unifi\s+\S+\s+(write|nat-write|device-network|app-policy-delete)\b/],
|
|
36
|
+
network: [/^unifi\s+\S+\s+(write|nat-write|device-network|app-policy-delete|client-fixed-ip)\b/],
|
|
37
37
|
dns: [
|
|
38
38
|
/^technitium\s+primary\s+(zone-create|zone-catalog|zone-delete|record-add|record-update|record-delete|cluster-init|cluster-delete|cluster-remove|server-domain)\b/,
|
|
39
39
|
/^technitium\s+node\s+\S+\s+(server-domain|stale-zone-delete)\b/,
|
package/package.json
CHANGED
package/skills/backup/SKILL.md
CHANGED
|
@@ -43,6 +43,10 @@ Restore tests on record: `kuma` 2026-08-15 (`PRAGMA integrity_check` ok), `supab
|
|
|
43
43
|
|
|
44
44
|
A service's backup is confirmed when `arcane-backup-status` shows `Result=success` for last night's run, `restic-snapshots <tag>` lists a snapshot from that run, and `restic-ls <snapshot>` shows the files the method above names. The method already makes the copy consistent: do not ask for a WAL check, and a restore test is extra, not a condition. Layer 1 also holds the whole Arcane VM (vmid 100) from 02:30.
|
|
45
45
|
|
|
46
|
+
## Mira guests
|
|
47
|
+
|
|
48
|
+
SPACE-X (Mira) writes its own vzdump archives to TESLA (`tesla-backup`, `BACKUP/space-x/dump`), and Pulsar's `mira-backup-pull.timer` copies them to the UNAS (`BACKUP/space-x/dump`) at 05:00 without mirroring Mira's deletions. This tool does not read SPACE-X; the proxmox specialist's `space-x tasks` shows the runs, and Kuma monitors `space-x-backup` and `mira-backup-pull` carry the heartbeats.
|
|
49
|
+
|
|
46
50
|
## Reading the output
|
|
47
51
|
|
|
48
52
|
- `*-status`: `Result=success`, `ExecMainStatus=0`, and the `ExecMainExitTimestamp` of the last run; the timer line shows the next run.
|
package/skills/network/SKILL.md
CHANGED
|
@@ -88,12 +88,14 @@ Behavior learned on the live consoles:
|
|
|
88
88
|
- Lists return 25 items by default. 37 has about 390 firewall policies, mostly `SYSTEM_DEFINED` zone defaults and `DERIVED` return rules: page with `--offset`, or filter `metadata.origin.eq('USER_DEFINED')` (69 on 37 on 2026-10-31).
|
|
89
89
|
- Protocol filters: one protocol is `{"type":"NAMED_PROTOCOL","protocol":{"name":"TCP"},"matchOpposite":false}`; TCP and UDP together is `{"type":"PRESET","preset":{"name":"TCP_UDP"}}` with no `matchOpposite`. Omit `protocolFilter` to match every protocol.
|
|
90
90
|
- A policy has exactly one source zone and one destination zone; several destination zones need one policy each. The `SYSTEM_DEFINED` policies show each zone pair's default (on 37: Vpn to Dmz allows, Vpn to Services blocks).
|
|
91
|
-
- Traffic between 37 and Mira crosses two firewalls: `<zone> to Vpn` on the sending site and `Vpn to <zone>` on the receiving site. A subnet routes only if Site Magic shares it: `unifi cloud /v1/sd-wan-configs/<id>` lists the shared networks per site. 37 shares Services, Management, Trusted, and
|
|
91
|
+
- Traffic between 37 and Mira crosses two firewalls: `<zone> to Vpn` on the sending site and `Vpn to <zone>` on the receiving site. A subnet routes only if Site Magic shares it: `unifi cloud /v1/sd-wan-configs/<id>` lists the shared networks per site. 37 shares Services, Management, Trusted, DMZ, and Storage; Mira shares Trusted, IoT, Services, and Management.
|
|
92
92
|
|
|
93
93
|
## `unifi <37|mira> app-get <path>` and `unifi <37|mira> device-network <deviceId> <json>`
|
|
94
94
|
|
|
95
95
|
`app-get` reads any path of the Network application's own API under `/api/s/default/` or `/v2/api/site/default/`, through the same connector and key. Use it to find the fields a change needs before adding a narrow write command. Useful reads: `/api/s/default/stat/device` (devices with `mgmt_network_id`, `config_network`, `port_table`, `port_overrides`, `uplink`), `/api/s/default/stat/sta` (clients with `ap_mac`, `sw_mac`, `sw_port`), `/api/s/default/rest/networkconf` (networks with their 24-hex ids, VLAN, subnet, DHCP range).
|
|
96
96
|
|
|
97
|
+
`client-fixed-ip <clientId> <json>` sets a DHCP reservation: a PUT of `/api/s/default/rest/user/<clientId>` whose body may hold only `use_fixedip`, `fixed_ip`, and `network_id` (the 24-hex network id from `rest/networkconf`). Find the client id with `app-get /api/s/default/rest/user`; a device keeps its old lease until it renews or reconnects.
|
|
98
|
+
|
|
97
99
|
`app-policy-delete <policyId>` deletes a firewall policy that the official API lists with `id: null`, such as rules converted from the old firewall (Mira's `BLOCK INTERNET` rows on 2026-10-31). Find its 24-hex `_id` with `app-get /v2/api/site/default/firewall-policies`; every other policy change goes through `write`.
|
|
98
100
|
|
|
99
101
|
`device-network` changes only a device's management network and address: a PUT of `/api/s/default/rest/device/<deviceId>` whose body may hold just `mgmt_network_id` and `config_network`. Both sites use the same layout: the uplink port stays native Default with all VLANs tagged, and each device sits on Management with a static address and the local DNS nodes.
|
package/skills/proxmox/SKILL.md
CHANGED
|
@@ -7,7 +7,7 @@ description: How the proxmox specialist operates Proxmox VE on Pulsar (37) and S
|
|
|
7
7
|
|
|
8
8
|
Pulsar (`10.0.10.37`, Proxmox VE 9 on Debian 13, node name `pulsar`) runs every guest: VM 100 `arcane` (Docker platform), LXC 101 `hermes` (being retired by the operator; no specialist operates it), LXC 102 `backup` (GCS pusher), VM 103 `identity` (Zitadel), VM 104 `dmz` (Pomerium), LXC 105 `tailscale`, VM 106 `observability`, LXC 107 `technitium2`, LXC 108 `radius`. Storage `local-lvm` holds the disks, `unas-backup` the vzdump archives. The `proxmox` tool talks to the API with a token whose role allows audit everywhere and, on guests, power, snapshots, and CPU/memory/option/network settings; nothing else. `["--help"]` lists the commands.
|
|
9
9
|
|
|
10
|
-
SPACE-X (`10.1.10.37`, Proxmox VE 9 at Mira, node name `space-x`) runs LXC 100 `technitium3` (DNS cluster node) and LXC 105 `tailscale` (Mira's subnet router). Put `space-x` before any command to run it there, for example `["space-x", "guests"]`; without it every command runs on Pulsar. SPACE-X has the same restricted user `spc-proxmox@pve!cortex` with its own token, and the same forced-command key as Pulsar. SPACE-X
|
|
10
|
+
SPACE-X (`10.1.10.37`, Proxmox VE 9 at Mira, node name `space-x`) runs LXC 100 `technitium3` (DNS cluster node) and LXC 105 `tailscale` (Mira's subnet router). Put `space-x` before any command to run it there, for example `["space-x", "guests"]`; without it every command runs on Pulsar. SPACE-X has the same restricted user `spc-proxmox@pve!cortex` with its own token, and the same forced-command key as Pulsar. SPACE-X backs up every guest nightly at 02:30 (Dubai time) to storage `tesla-backup` on Mira's Synology TESLA; Pulsar's `mira-backup-pull` copies the archives to 37 at 05:00. `["space-x", "tasks"]` shows the vzdump runs.
|
|
11
11
|
|
|
12
12
|
## API commands
|
|
13
13
|
|
|
@@ -80,6 +80,8 @@ ${Object.values(UNIFI_READS)
|
|
|
80
80
|
unifi <37|mira> app-get <path> [--local] any GET of the Network application under /api/s/default/ or /v2/api/site/default/
|
|
81
81
|
unifi <37|mira> device-network <deviceId> <json> [--local]
|
|
82
82
|
set a device's management network and IP (keys mgmt_network_id, config_network)
|
|
83
|
+
unifi <37|mira> client-fixed-ip <clientId> <json> [--local]
|
|
84
|
+
set or clear a client's DHCP reservation (keys use_fixedip, fixed_ip, network_id)
|
|
83
85
|
unifi <37|mira> app-policy-delete <policyId> [--local]
|
|
84
86
|
delete a firewall policy the official API lists without an id
|
|
85
87
|
unifi <37|mira> nat [--local] the console's NAT rules (Policy Table; not in the official API)
|
|
@@ -225,6 +227,18 @@ export function deviceNetworkWrite(args: string[]): UnifiWrite {
|
|
|
225
227
|
return { method: "PUT", path: `/api/s/default/rest/device/${id}`, body };
|
|
226
228
|
}
|
|
227
229
|
|
|
230
|
+
const CLIENT_FIXED_IP_KEYS = new Set(["use_fixedip", "fixed_ip", "network_id"]);
|
|
231
|
+
|
|
232
|
+
/** `client-fixed-ip <clientId> <json>`: only a known client's DHCP reservation, through the application's client records. */
|
|
233
|
+
export function clientFixedIpWrite(args: string[]): UnifiWrite {
|
|
234
|
+
const [id, json, ...extra] = args;
|
|
235
|
+
if (id === undefined || !NAT_ID.test(id) || json === undefined || extra.length > 0) throw new UsageError("client-fixed-ip <clientId> <json>");
|
|
236
|
+
const body = jsonBody(json);
|
|
237
|
+
const keys = Object.keys(JSON.parse(body) as Record<string, unknown>);
|
|
238
|
+
if (keys.length === 0 || keys.some((k) => !CLIENT_FIXED_IP_KEYS.has(k))) throw new UsageError(`client-fixed-ip body keys: ${[...CLIENT_FIXED_IP_KEYS].join(", ")}`);
|
|
239
|
+
return { method: "PUT", path: `/api/s/default/rest/user/${id}`, body };
|
|
240
|
+
}
|
|
241
|
+
|
|
228
242
|
/** `app-policy-delete <policyId>`: a firewall policy that the official API returns with `id: null` (rules converted from the old firewall). */
|
|
229
243
|
export function appPolicyDelete(args: string[]): UnifiWrite {
|
|
230
244
|
const [id, ...extra] = args;
|
|
@@ -339,6 +353,10 @@ async function unifi(args: string[]): Promise<number> {
|
|
|
339
353
|
return 0;
|
|
340
354
|
}
|
|
341
355
|
if (rest[0] === "app-get") return printAnswer(await siteRequest(site, readSite(site), local, appGetPath(rest.slice(1)), "GET", undefined, "app"), `UniFi ${site} application`);
|
|
356
|
+
if (rest[0] === "client-fixed-ip") {
|
|
357
|
+
const call = clientFixedIpWrite(rest.slice(1));
|
|
358
|
+
return printAnswer(await siteRequest(site, readSite(site), local, call.path, call.method, call.body, "app"), `UniFi ${site} client`);
|
|
359
|
+
}
|
|
342
360
|
if (rest[0] === "app-policy-delete") {
|
|
343
361
|
const call = appPolicyDelete(rest.slice(1));
|
|
344
362
|
return printAnswer(await siteRequest(site, readSite(site), local, call.path, call.method, undefined, "app"), `UniFi ${site} policy`);
|
|
@@ -11,7 +11,7 @@ import { buildInferenceRemote, command as inferenceCommand } from "./inference/r
|
|
|
11
11
|
import { MAX_ADD_IDS, MAX_EXCLUDE_IDS, buildTrendarrCall, interpretRun, parseImdbIds, trendarrConfig, trendarrError, trendarrWarnings, command as mediaCommand } from "./media/run.ts";
|
|
12
12
|
import { ServiceError, UsageError } from "./lib/errors.ts";
|
|
13
13
|
import { safeRepoPath, safeWritePath } from "./lib/repo.ts";
|
|
14
|
-
import { appGetPath, appPolicyDelete, buildPulsarRemote, cloudPath, deviceNetworkWrite, NAT_PATH, natWrite, parseQuery, parseSiteArgs, unifiPath, unifiWrite, command as networkCommand } from "./network/run.ts";
|
|
14
|
+
import { appGetPath, appPolicyDelete, clientFixedIpWrite, buildPulsarRemote, cloudPath, deviceNetworkWrite, NAT_PATH, natWrite, parseQuery, parseSiteArgs, unifiPath, unifiWrite, command as networkCommand } from "./network/run.ts";
|
|
15
15
|
import { buildHostRemote, splitHost, needsConfirm, parseSetPairs, parseVmid, validateApiPath as validatePvePath, command as proxmoxCommand } from "./proxmox/run.ts";
|
|
16
16
|
import { banLength, buildObsRemote, compactDecisions, parseGoDuration, summariseAlerts, summariseVulns, summariseWazuh, vulnEvents, wazuhEvents, command as securityCommand } from "./security/run.ts";
|
|
17
17
|
|
|
@@ -120,6 +120,9 @@ describe("network wrapper", () => {
|
|
|
120
120
|
expect(appGetPath(["/api/s/default/stat/device"])).toBe("/api/s/default/stat/device");
|
|
121
121
|
expect(appPolicyDelete(["0123456789abcdef01234567"])).toEqual({ method: "DELETE", path: "/v2/api/site/default/firewall-policies/0123456789abcdef01234567" });
|
|
122
122
|
expect(() => appPolicyDelete(["611cef69-df2e-4498-9845-8685daee84f3"])).toThrow(UsageError);
|
|
123
|
+
const fixed = JSON.stringify({ use_fixedip: true, fixed_ip: "10.1.50.50", network_id: "0123456789abcdef01234567" });
|
|
124
|
+
expect(clientFixedIpWrite(["0123456789abcdef01234567", fixed])).toEqual({ method: "PUT", path: "/api/s/default/rest/user/0123456789abcdef01234567", body: fixed });
|
|
125
|
+
expect(() => clientFixedIpWrite(["0123456789abcdef01234567", JSON.stringify({ name: "x" })])).toThrow(/body keys/);
|
|
123
126
|
expect(appGetPath(["/v2/api/site/default/nat"])).toBe("/v2/api/site/default/nat");
|
|
124
127
|
expect(() => appGetPath(["/api/s/other/stat/device"])).toThrow(UsageError);
|
|
125
128
|
expect(() => appGetPath(["/api/s/default/../../x"])).toThrow(UsageError);
|