Commit Graph
13 Commits
Author SHA1 Message Date
yetone 61adb384fc agent-office 0.3.5: Cursor's editor and CLI chats show in the office (WaiooT on X)
WaiooT asked to see Cursor in Agent Office. It read no Cursor files: Cursor
showed only through the gateway hook, which never sees Cursor's own
requests (they go to Cursor's servers).

It now reads <CURSOR_DATA_DIR or ~/.cursor>/projects/<slug>/agent-transcripts/
<chat>/<chat>.jsonl (and the older agent-transcripts/<chat>.jsonl). A chat
with cursor-agent's chats/*/<chat>/meta.json (CURSOR_CONFIG_DIR, else
$XDG_CONFIG_HOME/cursor, else ~/.cursor) is "Cursor CLI" with that cwd;
the rest are the editor's, a new "cursor-app" agent named "Cursor", with
the cwd found by matching the slug against real folders (bounded, cached),
else the slug's last part. Lines carry no time, so the file's mtime is
used, and the user line's <timestamp>. turn_ended ends a turn (success
done, error with its text, else stopped). The editor writes no
turn_ended, so its chat counts as done 30s after a last answer with no
tool pending. No token counts: Cursor doesn't record them locally.

Run on mote at this tree (Bun 1.4.2, HOME=mktemp -d): repo bun test 7866
tests, 7846 pass, 20 skip, 0 fail; bun scripts/check.mjs exit 0;
stamp-page.mjs --check exit 0 (agents.js restamped).
The fixtures are the bytes a sandboxed cursor-agent wrote here (a Read
tool run that ended "WritableIterable is closed", and "Say ok.").
Broken by hand: without the editor's quiet-done rule the chat stays
"thinking" (red); without meta.json's agent the CLI chat is cursor-app
(red).
Not tried: a real Cursor editor writing a transcript (no editor in a
sandbox here; the format is cursor-agent's, which the editor shares per
magpie's Sessions reader), subagent transcripts, the page in a real
magpie window.
2026-11-10 13:37:39 +08:00
yetone 89ddfb9cb3 agent-office 0.3.4: Settings pickers read their value and stay open on overscroll (#778)
Bumps agent-office to 0.3.4 so #778 (frederick-wang: the pickers'
accessible name carries the value, overscroll no longer closes a
picker, magpie's thin scrollbar; fixes #773) reaches users; dist stops
at 0.3.3. Notes it in the changelog and moves cli.test.mjs's pinned
ping version with it.

Run on mote at this tree (Bun 1.4.2, HOME=mktemp -d): repo bun test
6255 tests, 20 skip, 0 fail; bun scripts/check.mjs exit 0;
stamp-page.mjs --check exit 0.
Not tried: the page in a real magpie window.
2026-11-06 11:12:28 +08:00
yetone 42331f64d8 agent-office 0.3.3: Settings pickers are app menus (#771)
Bumps agent-office to 0.3.3 so #771 (frederick-wang: Language, Scene
and Quality are in-page listbox menus, not native <select>s, #744)
reaches users; dist and npm stop at 0.3.2. Notes it in the changelog,
and moves cli.test.mjs's pinned ping version with it.

Run on mote at this tree (Bun 1.4.2, HOME=mktemp -d): packages/
agent-office bun test 183 pass; repo bun test 6184 pass, 20 skip, 0
fail; bun scripts/check.mjs exit 0; stamp-page.mjs --check 0.
Broken by hand: before the cli.test.mjs edit, the bump alone turned
"the authenticated standalone page..." red (0.3.2 vs 0.3.3).
Not tried: the page in a real magpie window. #773 has the two small
follow-ups from the review.
2026-11-06 06:25:25 +08:00
yetone 73362966e7 agent-office: 0.3.2, with a guard that the hook keeps only local requests
Bumps agent-office to 0.3.2 so #740 (SVG chevrons) and #741 (the
remote switch and its empty-office line) reach users, and notes both
in the changelog with the asset stamps they fixed (stale since 0.3.0).

Adds a guard to "the host part writes what it reads": with no remote
option set, a gateway-key request leaves ctx.state.office null, adds
no session and counts as dropped. Before this nothing failed when the
hook's track() defaulted remote on.

Run on mote: HOME=<scratch> bun test packages/agent-office, 183 pass;
bun scripts/check.mjs agent-office ok; stamp-page.mjs --check ok.
Broken by hand: office.hooks.mjs remote default `!== false` turns
the new guard red (1 fail), restored green.
Not tried: the page in a real magpie window, a real remote agent.
2026-11-05 09:45:19 +08:00
yetone fa46c0764f agent-office 0.3.1: README says eleven scenes
0.3.0 (#637) added five scenes, but the README still said six. It now
says eleven in the English image caption, in the zh 3D feature line
(which lists the five new scenes too) and in the file list's scene3d.js
line. The patch bump puts the README into the dist tarball. No code
changed.

Run at this commit on mote (Bun 1.4.2): bun test in packages/agent-office
181 pass, 0 fail; bun scripts/check.mjs agent-office ok.
2026-11-03 02:12:52 +08:00
Kongtou 87561b3fc3 agent-office 0.3.0: library, cyberlab, greenhouse, arctic and rainy night scenes (#637)
Adds five scenes to agent-office: library, cyberlab, greenhouse, arctic and rainy night. Each has themed 3D decorations and an ISO/2D canvas palette, and its name is in all 9 languages. Bumps the package to 0.3.0, and the registry summary now says eleven scenes in en and zh. The six existing scenes keep their ISO/2D palette: `scene2.theme` is set only for the five new ids. By kongtou20070406.

Run at the reviewed head 8986d2f on macOS (mote, Bun 1.4.2, Playwright 1.62.0):
- `bun test` in packages/agent-office: 180 pass, 1 fail. The fail is jump.test.mjs's host-restart jumpRequest test: herdr.log was never written at load ~70. It passes 6 of 6 alone at this head and 3 of 3 on main 48d0cec, and this PR doesn't touch jump.mjs or office.hooks.mjs. Filed as #642.
- `bun scripts/check.mjs agent-office`: ok.
- Scene names, loaded from page/model.js: every one of the 9 languages has all 11 names and the same key set as en.
- Playwright, Chromium and WebKit, on the CLI's standalone page with sample agents: all 11 scenes in 3D/ISO/2D at 1440x900, plus 3D at 420x760. There were no page errors and no requests to other origins. The picker selects every scene and stays on screen at 420px.
- Office and Castle in ISO/2D, compared with main 48d0cec in both engines: the dominant colours are the same (31 of 32 top colours shared). The 0.03–3% of pixels that differ are the moving sample workers. At a42cef4, 2D had shared only 2 to 4 of 12.

Not tried: the plugin inside a real magpie window. The pages were run through the standalone CLI page only.
2026-11-03 02:07:57 +08:00
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
yetone 659967c9bc agent-office 0.1.1: an agent another agent killed is stopped, and any agent not at work can be cleared
flying_crp (X, 2026-10-31): when one agent hands work to another and then
interrupts it from the command line, the delegated session hangs in the
Agent Office as abnormal and can't be cleaned up; it only goes once the
session is deleted in magpie.

The cause: a killed agent writes no end of turn. Reproduced in a sandbox
HOME with the real CLIs:
- Codex 0.165 under SIGTERM or SIGKILL: the rollout ends at the
  function_call (on SIGINT it writes turn_aborted, which was fine).
- Claude Code 2.1.314 `claude -p` under SIGTERM: a tool_result
  ("Exit code 137") and no end_turn, and it removes its
  sessions/<pid>.json. Under SIGKILL: the file ends at tool_use, and the
  pid file stays with a dead pid.
The office read each file as at work, then "error · stuck" once quiet for
ten minutes, until hideAfter (6h, or never; a waiting session never
leaves). The page had no way to take one out.

The fix:
- lib/scan.mjs: for a source with a process folder (Claude Code's
  <config>/sessions, also Qoder, WorkBuddy and CodeBuddy), a session
  quiet mid-turn for 10s with no live process named in that folder is
  read as aborted ("stopped"). A folder that can't be read, a
  half-written file, or one that has never held a pid file means
  unknown, and nothing changes. A pid file from another pidDomain (WSL)
  counts as alive.
- page: Clear (清除) in the panel of any agent not at work (stuck,
  error, stopped, done, waiting) hides it until its session moves again.
  It is kept in the page's options as {key: at}, pruned to sessions
  live.js still has. This covers Codex and every agent with no process
  registry.

Run:
- On mote (mote-run): bun test in packages/agent-office gives 54 pass,
  0 fail. bun scripts/check.mjs exits 0.
- killed.test.mjs uses the real killed files (test/killed, trimmed and
  with paths replaced). With the old scan.mjs, 3 tests fail. With the old
  model.js, 2 fail.
- End to end: the real office.hooks.mjs over a sandbox HOME holding the
  killed Claude and Codex files and a live lead pid file. live.js had
  claude "aborted" and codex "tool". Then the real page in list mode, zh,
  at widths 1100 and 420: the Codex row shows 已 N 分 没有动静, its
  panel shows 清除, clicking it removes the row, and options.set gets
  cleared. Chromium ran on mote. WebKit ran on the Linux box (wsl-run),
  because WebKit on mote didn't launch within 180s while ~108 WebKit
  processes from other sessions were running. Screenshots were checked
  at both widths.

Not tried:
- A Codex liveness signal: its thread-writer-locks are flock-only files,
  which Node can't check. Codex relies on Clear.
- Windows: the pidDomain value and process.kill(pid, 0) there.
- Whether Qoder, WorkBuddy or CodeBuddy write pid files at all. Without
  them, nothing changes for those agents.
- Gemini, Qwen, dsh and pi killed mid-turn: they have no registry and
  rely on Clear.
- The page inside the real magpie window, and WebKitGTK.
2026-10-31 09:52:19 +08:00
QingJ 1e04c1d324 agent-office 0.1.0: live agent activity office page (#478)
A new community page plugin by QingJ01: Agent Office, a page in magpie's window that shows each local agent session as a worker in an office (3D/2D) or a list, with status, current step and a resume command.

- Its host part (office.hooks.mjs, an async gateway hook) reads the session files of Claude Code, Codex, dsh, Gemini CLI, Qwen Code, Pi, omp, Qoder, WorkBuddy and CodeBuddy every 1.5 s and writes page/live.js beside the page. It opens no socket and sends nothing off the machine. The page makes no magpie.read calls and loads only its own files.
- Text switch: with text off, the host writes no prompt, reply, error or tool argument (the title falls back to the folder, the step to the tool name), and the page redacts whatever live.js holds.
- Options are read at module load from plugins.json in the host's cwd (magpie's config folder), with the XDG path as a fallback. npm specs are matched with @tag/@version stripped, a path spec by realpath against the package's own folder. It fails closed: text stays off until an install's options or a request's ctx.options turn it on.
- The disclosure (package description, registry summary, root README) says which session files it reads. magpie's install sheet still says "reads nothing" for such a page (yetone/magpie#4187).

Run at the reviewed head e76d1a3, on mote:
- bun test in packages/agent-office: 44 pass, 0 fail.
- The whole repo at origin/main 3462544 merged with e76d1a3: bun test 3275 pass, 8 skip, 0 fail (HOME sandboxed); bun scripts/check.mjs exit 0.
- The new privacy tests run against 9230da7's hooks: 5 of 11 red (@latest, @0.1.0, cwd-only config, no config, unmatched spec).
- e76d1a3's case (cwd plugins.json without this entry, XDG plugins.json with text:true), by hand: text stays off. With d4acdae's hooks: text on and the prompt leaks. No test covers this case. The privacy tests stay green with it reverted.
- Real magpie: main 0745db932, built for macOS with -tags nogui, run as a portable magpie (.portable marker) in a sandbox HOME. The plugin was added from a folder named zz-src, so no name guess can match. A decoy ~/.config/magpie/plugins.json said text:true. The sandbox HOME had a seeded Claude Code session with a secret prompt, reply and Bash argument. magpie web was driven in Playwright Chromium and WebKit (WebKit in zh). With text on, the prompt, reply and command showed. With text off, the page hid them within 0.3 s. live.js went text:false after the host restarted, and over 30 s of sampling no secret was on the page or in live.js. After a reload, the switch was off and nothing leaked. The frame requested only its own files under /_magpie/plugin/<token>/, with no request leaving 127.0.0.1:3592. The plugin host had no sockets (lsof).

Not changed: the XDG fallback can read another magpie's plugins.json, but only when the host's cwd has none. magpie starts the host in its own config folder, which always has one, so a real host never reaches it.
2026-10-29 19:45:44 +08:00