Commit Graph
5 Commits
Author SHA1 Message Date
yetone 11e0acd9b1 agent-office 0.2.4: a jumpRequest.at ahead of the clock no longer blocks every later jump (#583)
0.2.3's host acted on any jumpRequest no older than 15 s, a future one
too, and kept its time in $XDG_CACHE_HOME/agent-office/last-jump.json;
every later click had at <= that time and was dropped until the clock
got there. The decision is now judgeJump(at, seen, now) in lib/jump.mjs:

- A request fires only from 15 s old to 5 s ahead, once.
- One stamped further ahead is set aside and recorded, so it never
  fires when the clock reaches it.
- A seen time ahead of now (0.2.3's file for such a request, or a clock
  that stepped back) blocks only that same request (at === seen); any
  other fresh click fires and rewrites the file. With seen in the past,
  an older or equal request is still never acted on, so nothing is
  replayed across restarts.
- The target is still worked out by the host from the session id; a
  page-stamped time can only make a request be skipped, not fire it
  later or elsewhere. Non-finite times are ignored and never written.

Existing bad last-jump.json from 0.2.3: read as before, no migration
needed; it no longer blocks, and the next click replaces it.

Run at this tree (base b797476), HOME=$(mktemp -d):
- mote (macOS): packages/agent-office bun test 180 pass, 0 fail;
  bun scripts/stamp-page.mjs --check ok; bun scripts/check.mjs ok.
- wsl-run (Ubuntu 24.04): agent-office bun test 180 pass, 0 fail.
- win-run (Windows 11): agent-office bun test 180 pass, 0 fail.
  The two host tests are macOS-only (fake herdr, like the 0.2.3 restart
  test); judgeJump's table test runs on all three.
- New tests against 0.2.3's office.hooks.mjs (mote): both host tests
  fail; a bad last-jump.json blocked the fresh jump, and a request an
  hour ahead fired at once.
- Broken by hand (mote): dropping the 5 s ahead bound (2 fail), letting
  a seen time ahead of now order requests again (3 fail), not recording
  a set-aside future request (2 fail).

Not tried: a real magpie with a real herdr or terminal, or a real clock
step; whole-repo bun test (only agent-office changed).
2026-11-01 14:35:42 +08:00
Jixing Liu 3303225dc9 agent-office 0.2.3: jump to a session's live terminal tab, pane or window on macOS, by jixing475 (#552)
On macOS, Agent Office now finds the terminal tab, multiplexer pane or desktop
window where a live session runs (Terminal.app, iTerm2, tmux, Herdr, Otty,
Claude Desktop, Cursor, VS Code). The panel has a jump button, or you can
double-click a worker, name tag or row. The page sends only
{key, session, preferredHostId, at} through options.set. The hooks host
resolves the target from its own ps/herdr/otty/tmux snapshot, and runs fixed
binaries with args it derived itself. TTYs are checked against
^/dev/ttys?\d+$ and quoted before they go into AppleScript. Nothing resolves
on Linux or Windows. When magpie restarts the host after options.set, a fresh
request (15s or newer) runs once. The last handled time is kept in
$XDG_CACHE_HOME/agent-office/last-jump.json, and plugins.json is never
written. The standalone server never reads plugins.json. Version 0.2.3.

By jixing475 (#552).

Run at b4654a2:
- mote (macOS 27.2, Bun 1.4.2), sandbox HOME: packages/agent-office bun test
  177 pass 0 fail; stamp-page --check 0; root scripts/check.mjs 0.
- WSL magpie-desktop: 177 pass 0 fail. Windows 11 xiaomi-gpu: 177 pass 0 fail.
- Broken by hand, each red: lastJumpAt seeded from the request (restart
  test), no last-jump.json write (replay check), all plugins.json options
  merged (--private test), req.target trusted (crafted-target test).
- Real magpie at main 4179cf2d8 on mote, sandbox HOME, plugin added from a
  folder, magpie web, fake herdr. The page's options.set sent by curl gave
  workspace/tab/agent focus after the host restart. plugins.json stayed 0600
  with another plugin's apiKey. A second restart with the same request did
  not replay it. A click within 1s of a save got 429, and the next click
  jumped.
- Not tried: a real iTerm2, Terminal, Herdr.app, Otty or Claude Desktop
  window, or the page clicked in a browser.

Follow-up: #583 (a future jumpRequest.at blocks later jumps).
2026-11-01 08:52:04 +08:00
yetone 044313a9d0 agent-office 0.2.2: a same-size sidecar rewrite inside one timestamp tick is read again (#580)
The scanner judged a Grok usage.json / summary.json revision by
"size:mtime:ctime" alone. Linux stamps a write with the coarse kernel
clock: on the WSL2 box 199 of 200 same-size in-place rewrites kept all
three (mote, APFS: 0 of 200). So "midnight and metadata-only changes do
not read JSONL again" was red there (usage 100 -> 200 serialize to the
same length, written ms apart) and green on mote and CI. A user's
usage.json rewritten that way kept the old token count. This is a
product bug, not a test assumption.

A sidecar's revision is now "size:mtime:ctime:ino", plus "#sha1" of
its bytes while its stamp is under 2.5 s old (RACY_MS, git's racy-index
idea). sameSidecar compares the stamps, and the digests where both
carry one, so a stamp aging out of the window is not a new revision and
the same bytes written again are not parsed again. Cost: a sidecar
(<= 256 KiB meta, <= 32 MiB usage) is read and hashed on each tick for
2.5 s after a write. createScanner takes statSync (sidecars only) so a
test can freeze the stamps.

New test: "a same-size usage.json or summary.json rewrite inside one
timestamp tick is read again" (frozen mtime/ctime; in place, temp and
rename, same bytes again with no parse).

Run at this tree (5403c21 + this commit, = origin/main just fetched):
- mote: packages/agent-office HOME=$(mktemp -d) bun test 168 pass 0 fail;
  stamp-page.mjs --check 0; bun scripts/check.mjs agent-office 0; full
  HOME=$(mktemp -d) bun test 4470 pass 9 skip 0 fail.
- wsl-run (magpie-desktop): packages/agent-office 168 pass 0 fail; full
  bun test 4471 pass 8 skip 0 fail.
Broken by hand:
- origin/main's scan.mjs with the new test on WSL: both #580's test
  (line 162) and the new one (line 206) red.
- on mote, digest and ino both removed: the new test red at line 206;
  ino kept, digest removed: red at 206; digest kept, ino removed: green
  (the digest catches the rename too; ino is belt and braces).
Not tried: a real Grok Build session writing usage.json; Windows.
Not changed: the session files themselves (Gemini .json, dsh .zstd,
JSONL, Codex session_index.jsonl) have the same stamp-only check;
filed as #581.
2026-11-01 08:02:29 +08:00
yetone 62ba6d7267 agent-office 0.2.1: cold image scans frame only the unfinished EOF record (#559)
Bumps the version for #559's scanner change and moves its changelog
lines from 0.2.0 into a 0.2.1 section; cli.test's ping expects 0.2.1.

Run on mote at this tree (0e3562b + this commit): packages/agent-office
HOME=$(mktemp -d) bun test 167 pass 0 fail; stamp-page.mjs --check 0;
root bun scripts/check.mjs 0. #559's full suite at its head: 4321 pass,
9 skip, 0 fail.
2026-10-31 19:10:19 +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