feat: harden runtime readiness and session workflow

This commit is contained in:
User
2026-07-14 10:27:25 +02:00
parent 6d7738d538
commit 6dbf93fff9
52 changed files with 1464 additions and 169 deletions
+21
View File
@@ -0,0 +1,21 @@
import assert from "node:assert/strict";
import { mkdtempSync, readFileSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import test from "node:test";
import { ensurePiTrust } from "./ensure-pi-trust.mjs";
test("adds the canonical harness path and preserves existing trust entries", () => {
const root = mkdtempSync(join(tmpdir(), "thothii-pi-trust-"));
const agentDir = join(root, "agent");
ensurePiTrust("/first/harness", agentDir);
writeFileSync(
join(agentDir, "trust.json"),
`${JSON.stringify({ "/existing/project": true }, null, 2)}\n`,
);
assert.equal(ensurePiTrust("/app/harness/../harness", agentDir), true);
const trust = JSON.parse(readFileSync(join(agentDir, "trust.json"), "utf8"));
assert.deepEqual(trust, { "/existing/project": true, "/app/harness": true });
assert.equal(ensurePiTrust("/app/harness", agentDir), false);
});