Files
stack/agents/dewey/work/chat-02/evidence/backend/smoke.mjs
T
jason.woltjeandClaude Opus 5.5 a5beb6d97d feat(conversation): CHAT-02 read-only Pi history reader and two board routes (#1507)
packages/conversation is a library with no server: safe-fs, the Pi session
parser, CHAT-01 pages, pinned snapshots, cursors and follow. The control
board adds GET /api/conversations and /api/conversation behind the Host
and Origin guard. Both are read-only, their queries are validated, and
each refusal code maps to a status.

Dewey authored it (packet 0cf177b1, revision 2). Filbert reviewed the code:
R1 revise (branch ids moving on append, the assumed-link bridge merging
branches, one unreadable seat directory turning the catalogue into a 500),
then R2 approve (3b14d66c). Darkwing reviewed the routes: R1 approve
(07b10ad1), R2 approve (b9d92003). The package lands with the routes,
because serve.mjs imports the reader at load.

On an index export: the eight suites 24/90/43/17/14/15/63/18,
conversation and control-board 153/153, webui 9/9.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-26 16:36:20 -05:00

38 lines
2.1 KiB
JavaScript

import { discoverRepoAgents } from "/mnt/storage/src/mosaic-stack/packages/control-board/src/scan.mjs";
import { rootsFromSpecs, createReader } from "/mnt/storage/src/mosaic-stack/packages/conversation/src/reader.mjs";
import { readRegistration, LAYOUTS } from "/mnt/storage/src/mosaic-stack/packages/seat/src/seat.mjs";
import { readdirSync, writeFileSync } from "node:fs";
import { homedir } from "node:os";
const seats = homedir() + "/.mosaic-dev/seats";
const regs = [];
import { loadRegistrations } from "/mnt/storage/src/mosaic-stack/packages/control-board/src/scan.mjs"; regs.push(...loadRegistrations(seats).registrations);
const roots = rootsFromSpecs(discoverRepoAgents("/mnt/storage/src/mosaic-stack"), regs);
console.log(roots.map(r => `${r.seat} ${r.harness} ${r.unsupportedReason} ${r.engineStartedAt}`).join("\n"));
const reader = createReader({ roots });
let t = Date.now();
const cat = reader.catalogue();
console.log("catalogue", cat.conversations.length, "ms", Date.now() - t, "refusedRoots", JSON.stringify(cat.refusedRoots));
const byAvail = {}; for (const c of cat.conversations) byAvail[c.availability + ":" + c.refusal] = (byAvail[c.availability + ":" + c.refusal] ?? 0) + 1;
console.log(byAvail);
console.log(cat.conversations.slice(0, 3));
const pages = [];
let stats = { convs: 0, pages: 0, entries: 0, refusals: {} , maxMs: 0};
for (const c of cat.conversations.filter(c => c.availability === "available")) {
t = Date.now();
let r = reader.open({ conversation: c.conversation });
if (!r.ok) { stats.refusals[r.refusal.code] = (stats.refusals[r.refusal.code] ?? 0) + 1; continue; }
stats.convs++;
let n = 0;
while (true) {
stats.pages++; stats.entries += r.page.entries.length; n++;
if (pages.length < 400) pages.push(r.page);
if (r.cursor) pages.length < 400 && pages.push(r.cursor);
if (!r.page.hasMore) break;
r = reader.next({ cursor: r.page.nextCursor, conversation: c.conversation, branch: r.page.branch });
if (!r.ok) { console.log("next refused", r.refusal); break; }
}
stats.maxMs = Math.max(stats.maxMs, Date.now() - t);
}
console.log(stats);
writeFileSync("/tmp/dewey-chat02/pages.json", JSON.stringify(pages));