2 Commits
Author SHA1 Message Date
QingJ 0e3562b25f agent-office: frame only fragments unfinished at EOF in cold image scans (#559)
The incremental session scanner frames only fragments still unfinished at
EOF, instead of passing every 64 KiB fragment of a complete cross-chunk
record through the character framer. A framed-part index stops a later
tick from walking text it already framed. Adds regressions for the four
mutation gaps named on #551 and a WebKit CSP diagnostic script.

Reviewed at 5f564b034df26e12b60c40f683922ce0389abdd1 on main 7714b61.
Run on the Mac mini test box (mote, Bun 1.4.2):
- packages/agent-office: HOME=$(mktemp -d) bun test: 167 pass, 0 fail;
  bun scripts/stamp-page.mjs --check: exit 0.
- Full repo: HOME=$(mktemp -d) bun test: 4321 pass, 9 skip, 0 fail
  (338 files); bun scripts/check.mjs: exit 0.
- Broken by hand: eager framing restored -> both cold-scan tests red;
  framed index not advanced -> 2 red (cold-scan EOF, unfinished quoted
  brace never reparses); ExtendedTail disabled -> extended-EOF test red.
  Each restored -> 167 pass.
- bench-scan.mjs 100 1 1, initial scan: ~29-32 ms at this head vs
  ~294-319 ms at main.
- Host probe: office.hooks.mjs imported without
  MAGPIE_AGENT_OFFICE_PAGE in a sandbox HOME with one Claude session;
  snapshot() ok and page/live.js written.
Not tried: a real magpie install of the page.
2026-10-31 19:09:38 +08:00
QingJ 7714b617c7 agent-office 0.2.0: real 3D office, workbench, incremental session scan
Agent Office 0.2.0 (QingJ01, #551): a real 3D office, the workbench, and the earlier review's fixes. The session scanner now reads growing JSONL logs incrementally. It keeps a saved offset with 128 guard bytes, carries UTF-8 and partial JSON across ticks, applies a record complete at EOF once, and resets on truncation, inode or birthtime change and same-size rewrites. Readers update per kind (Claude response usage replaced, Grok sidecar daily totals replaced, metadata refreshed apart from logs).

Run at the reviewed head 3bf522f, merged on main 622f950, on mote under HOME=$(mktemp -d):
- agent-office bun test: 163 pass, 0 fail. Full bun test: 4310 pass, 9 skip, 0 fail. check.mjs agent-office and stamp-page --check: exit 0.
- 100MB log: append scan ~50ms -> 0.04-0.2ms (4x100MB: ~240ms -> 0.13-0.29ms). Through office.hooks: first scan 82ms, then 0.11-0.24ms per append.
- Fuzz with real Claude, Codex and Grok logs in random appends vs a fresh scanner: 0 mismatches.
- Broken by hand: 9 mutations of the cursor and readers go red. Gaps left as follow-ups: the inode check alone, ExtendedTail, the Codex title cursor and summary.json re-reads. Also follow-up: the first scan of an image-heavy log (336ms vs 42ms, framePart).

The package is new on npm: the owner publishes 0.2.0 by hand the first time.
2026-10-31 18:19:53 +08:00