102 files under agents/sage/work/vikunja-setup/: the comment, close and file scripts Sage ran on P19 and their output records, including P19 386 comment 350 for the mos-0928 Part A window (rows 177 and 180-185). Each script refuses to write a record that holds a key; a scan for both key values found none.
62 lines
4.7 KiB
JavaScript
62 lines
4.7 KiB
JavaScript
// Sage, 2026-10-18: Jason's rulings relayed by Mos in mos-0787. Comments on P19 332 or 333 (argv TASK),
|
|
// no state change: 333 stays open until row 161 (I6) lands, 332 until row 165 lands. Sage's own key (bot
|
|
// user 13). The sync key checks project and exact title first and reads the comment back. Prints no secret.
|
|
// Usage: node comment-mos0787.mjs https://tasks.woltje.com SAGE_TOKEN_FILE SYNC_TOKEN_FILE OUT_JSON 332|333
|
|
import { readFileSync, writeFileSync, existsSync } from "node:fs";
|
|
const [ORIGIN, KEY, SYNC, OUT, WHICH] = process.argv.slice(2);
|
|
if (!/^https:\/\/tasks\.woltje\.com$/.test(ORIGIN)) throw new Error("tasks.woltje.com only");
|
|
if (!OUT || existsSync(OUT)) throw new Error("OUT_JSON missing or exists; refusing");
|
|
const SIG = "Created by Sage (T3 1ef1e4f8) with Sage's own key (bot user 13).";
|
|
const esc = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
const p = (...xs) => xs.map((x) => `<p>${esc(x)}</p>`).join("") + `<p>${esc(SIG)}</p>`;
|
|
const TASKS = {
|
|
333: {
|
|
title: "install: a host process under another uid that reaches the Console port acts as Jason; accept it or fix it (Jason, row 87)",
|
|
text: [
|
|
"Jason ruled, relayed by Mos in mos-0787 (2026-10-18), on accepting this as a documented limit: \"yes\".",
|
|
"Row 161 (I6, Gitea #1656) writes it into the install docs' limits section as a known limit: a host process under another uid that reaches the Console's loopback port acts as Jason, and the install doesn't close that. The I6 brief and the design's limits line say so as of commit ab9f23d9e.",
|
|
"This task stays open until row 161 lands. Sage closes it then.",
|
|
],
|
|
},
|
|
332: {
|
|
title: "policy: no verb adds a role instance, so the chief of staff can't staff a role the business file doesn't declare (Jason)",
|
|
text: [
|
|
"Jason answered, relayed by Mos in mos-0787 (2026-10-18): \"I want a command and a WebUI surfacing for the modifications\".",
|
|
"Mos reads it as: Jason adds and changes role instances through a mosaic CLI command and a Console view instead of hand-editing the business file, the same pattern as Q169. Jason hasn't confirmed that reading yet.",
|
|
"Sage drafted the row only: queue row 165, Gitea #1662, brief docs/plans/2026-10-18_role-instance-verb.md (ab9f23d9e). It covers the CLI verb, the Console view, validation through the same path as mosaic business validate, and an audit entry in the organization change log. Human only; the chief of staff stays out until Jason says.",
|
|
"Nothing is built until Mos relays Jason's confirmation; the row stays queued. Until it lands, acceptance 314 keeps its step where Jason edits the business file.",
|
|
],
|
|
},
|
|
};
|
|
if (!Object.hasOwn(TASKS, WHICH ?? "")) throw new Error("TASK must be 332 or 333");
|
|
const TASK = Number(WHICH), TITLE = TASKS[WHICH].title, TEXT = TASKS[WHICH].text;
|
|
const key = readFileSync(KEY, "utf8").trim(), sync = readFileSync(SYNC, "utf8").trim();
|
|
async function api(method, path, body, auth) {
|
|
const r = await fetch(ORIGIN + path, { method, headers: { Authorization: `Bearer ${auth}`, "Content-Type": "application/json" }, body: body === undefined ? undefined : JSON.stringify(body), redirect: "error" });
|
|
const t = await r.text(); let json = null; try { json = JSON.parse(t); } catch {}
|
|
return { status: r.status, json };
|
|
}
|
|
const list = (j) => j?.items ?? (Array.isArray(j) ? j : []);
|
|
const rec = { at: new Date().toISOString(), task: TASK, problems: [] };
|
|
const save = () => {
|
|
const out = JSON.stringify(rec, null, 1) + "\n";
|
|
if (out.includes(key) || out.includes(sync)) throw new Error("secret in the record; not written");
|
|
writeFileSync(OUT, out);
|
|
};
|
|
const task = await api("GET", `/api/v2/tasks/${TASK}`, undefined, sync);
|
|
rec.title = task.json?.title ?? null;
|
|
if (task.status !== 200 || task.json?.project_id !== 19 || task.json?.title !== TITLE) throw new Error(`task ${TASK}: ${task.status}, project ${task.json?.project_id}, title differs or missing`);
|
|
writeFileSync(OUT, "", { flag: "wx" });
|
|
const r = await api("PUT", `/api/v1/tasks/${TASK}/comments`, { comment: p(...TEXT) }, key);
|
|
Object.assign(rec, { status: r.status, id: r.json?.id ?? null });
|
|
if (r.status >= 300 || !Number.isSafeInteger(r.json?.id)) rec.problems.push(`comment: ${r.status} ${r.json?.message ?? ""}`);
|
|
else {
|
|
const back = await api("GET", `/api/v2/tasks/${TASK}/comments?per_page=50`, undefined, sync);
|
|
const found = list(back.json).find((c) => c.id === r.json.id);
|
|
Object.assign(rec, { readBack: back.status, found: Boolean(found), author: found?.author?.username ?? null });
|
|
if (back.status !== 200 || !found) rec.problems.push(`read-back: ${back.status}`);
|
|
}
|
|
save();
|
|
process.stdout.write(JSON.stringify(rec, null, 1) + "\n");
|
|
if (rec.problems.length) process.exit(2);
|