@astrofoundry/pi-astro 0.40.58 → 0.40.60
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.
|
@@ -50,7 +50,7 @@ function runCommand(specialist: string, text: string): Command {
|
|
|
50
50
|
/** Prompt paragraph appended for tasks that arrive from a chat channel. */
|
|
51
51
|
export const CHANNEL_RULES = `## Channel rules
|
|
52
52
|
|
|
53
|
-
This task arrived from a Discord channel and your answer is posted there. Answer in plain text under 1500 characters when possible, facts first, no headings. When the task is ambiguous (which guest, which record, which host), do not act: ask one precise question and stop. Risky calls may wait for an operator's approval; if the tool reports a denial or a missing answer, report it and stop. When you need something from the owner (a go, a decision, an action, or a blocker you cannot remove), your first line starts with **Needs you:** and says what you need in one sentence; the bridge then tags them.`;
|
|
53
|
+
This task arrived from a Discord channel and your answer is posted there. Answer in plain text under 1500 characters when possible, facts first, no headings. Write only what the owner needs to act or to know the outcome: the result, what you need from them, and the next step. Leave out what you read, checks that found nothing, what did not change, and comments on your own reasoning. Use short, plain sentences. When the task is ambiguous (which guest, which record, which host), do not act: ask one precise question and stop. Risky calls may wait for an operator's approval; if the tool reports a denial or a missing answer, report it and stop. When you need something from the owner (a go, a decision, an action, or a blocker you cannot remove), your first line starts with **Needs you:** and says what you need in one sentence; the bridge then tags them.`;
|
|
54
54
|
|
|
55
55
|
/** A reply whose first line asks the owner for something; the bridge tags the requester on it. */
|
|
56
56
|
export function needsYou(output: string): boolean {
|
|
@@ -199,6 +199,8 @@ describe("Arcane report plans", () => {
|
|
|
199
199
|
expect(task).toContain("- stirling-pdf: 2.14.3 → 3.0.0 (major version); release notes: check, the config key changed");
|
|
200
200
|
expect(task).toContain("Wait in this thread for the owner's \"go\"; then apply the image change with `stack-update stirling-pdf --confirm`");
|
|
201
201
|
expect(task).toContain("Its first line is `**Needs you:**`");
|
|
202
|
+
expect(task).toContain("never logs or caches");
|
|
203
|
+
expect(task).toContain("without new prerequisites");
|
|
202
204
|
expect(carefulTask(entry(report(), "arcane"))).toContain("`manager-upgrade 2.17.0`");
|
|
203
205
|
});
|
|
204
206
|
|
|
@@ -246,8 +246,8 @@ export function carefulTask(s: StackEntry): string {
|
|
|
246
246
|
"Pending:",
|
|
247
247
|
...lines,
|
|
248
248
|
`1. Read what changes: \`release-notes ${s.stack}/<service>\` for each line, \`git show ${s.stack}/compose.yaml\`, and the stack's README in the GitOps checkout.`,
|
|
249
|
-
"2. Post the plan. Its first line is `**Needs you:**` and what you need in one sentence: the go, or the blocker and what the owner must do or decide. Then at most five numbered one-line steps: what changes, what must happen first
|
|
250
|
-
`3. Change nothing yet. Wait in this thread for the owner's "go"; then apply the image change with ${apply} and the other steps of your plan, and report each result.`,
|
|
249
|
+
"2. Post the plan. Its first line is `**Needs you:**` and what you need in one sentence: the go, or the blocker and what the owner must do or decide. Then at most five numbered one-line steps: what changes for this stack, what must happen first, the order, how you will check it, and how to roll back. Nothing else, no summary of what you read. A backup step covers only what a restore needs, the database and config, never logs or caches; use `host db-dump <stack>` when the tool covers the stack's database.",
|
|
250
|
+
`3. Change nothing yet. Wait in this thread for the owner's "go"; then apply the image change with ${apply} and the other steps of your plan, without new prerequisites, and report each result in one line.`,
|
|
251
251
|
].join("\n");
|
|
252
252
|
}
|
|
253
253
|
|
|
@@ -1450,16 +1450,17 @@ class Bridge {
|
|
|
1450
1450
|
await this.rest.ephemeralReply(interaction.id, interaction.token, `${host.name} is already rebooting.`);
|
|
1451
1451
|
return;
|
|
1452
1452
|
}
|
|
1453
|
-
|
|
1454
|
-
if (status !== null && /^reboot-needed:\s*no\s*$/m.test(status)) {
|
|
1455
|
-
await this.rest.ephemeralReply(interaction.id, interaction.token, `${host.name} no longer needs a reboot.`);
|
|
1456
|
-
return;
|
|
1457
|
-
}
|
|
1453
|
+
// Discord drops a click not answered within three seconds, and a host's status check can take longer.
|
|
1458
1454
|
await this.rest.deferUpdate(interaction.id, interaction.token);
|
|
1459
1455
|
const channelId = interaction.channel_id ?? this.config.adminChannelId;
|
|
1460
1456
|
const messageId = interaction.message?.id;
|
|
1461
1457
|
this.rebooting.add(host.id);
|
|
1462
1458
|
try {
|
|
1459
|
+
const status = await this.runEntry("proxmox", userId, [...host.prefix, "host-status"], 3 * 60_000).catch(() => null);
|
|
1460
|
+
if (status !== null && /^reboot-needed:\s*no\s*$/m.test(status)) {
|
|
1461
|
+
await this.rest.followUp(this.config.applicationId, interaction.token, { content: `${host.name} no longer needs a reboot.`, flags: EPHEMERAL }).catch(() => undefined);
|
|
1462
|
+
return;
|
|
1463
|
+
}
|
|
1463
1464
|
log(`reboot ${host.name} by ${userId}`);
|
|
1464
1465
|
await this.runEntry("proxmox", userId, [...host.prefix, "host-reboot", "--confirm"], 2 * 60_000);
|
|
1465
1466
|
const note = `♻️ ${host.name} reboots in one minute, started by <@${userId}>; its guests restart with it.`;
|
|
@@ -1502,16 +1503,17 @@ class Bridge {
|
|
|
1502
1503
|
await this.rest.ephemeralReply(interaction.id, interaction.token, "A Pomerium upgrade is already running.");
|
|
1503
1504
|
return;
|
|
1504
1505
|
}
|
|
1505
|
-
|
|
1506
|
-
if (check.installed === tag) {
|
|
1507
|
-
await this.rest.ephemeralReply(interaction.id, interaction.token, `Pomerium already runs ${tag}.`);
|
|
1508
|
-
return;
|
|
1509
|
-
}
|
|
1506
|
+
// Discord drops a click not answered within three seconds; the check on the DMZ can take longer.
|
|
1510
1507
|
await this.rest.deferUpdate(interaction.id, interaction.token);
|
|
1511
1508
|
const channelId = interaction.channel_id ?? this.config.adminChannelId;
|
|
1512
1509
|
const messageId = interaction.message?.id;
|
|
1513
1510
|
this.pomeriumUpgrading = true;
|
|
1514
1511
|
try {
|
|
1512
|
+
const check = (await this.runEntry("identity", userId, ["dmz", "pomerium-check"], 2 * 60_000).then((out) => JSON.parse(out) as { installed?: unknown }).catch(() => null)) ?? {};
|
|
1513
|
+
if (check.installed === tag) {
|
|
1514
|
+
await this.rest.followUp(this.config.applicationId, interaction.token, { content: `Pomerium already runs ${tag}.`, flags: EPHEMERAL }).catch(() => undefined);
|
|
1515
|
+
return;
|
|
1516
|
+
}
|
|
1515
1517
|
log(`pomerium upgrade to ${tag} by ${userId}`);
|
|
1516
1518
|
if (messageId) await this.rest.editMessage(channelId, messageId, `${interaction.message?.content ?? ""}\n⏳ Pomerium ${tag} is installing, started by <@${userId}>.`.slice(0, 1900), []).catch(() => undefined);
|
|
1517
1519
|
const out = await this.runEntry("identity", userId, ["dmz", "pomerium-upgrade", tag], POMERIUM_UPGRADE_MS);
|