Files
plugins/packages/agent-office
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
..

Agent Office · 我的 Agent 在干嘛

Latest release magpie ≥ 0.1.1318 Tests License: MIT

一个住在 magpie 窗口里的实时 Agent 办公室。 直接读取各 Agent 自己的会话记录,把正在思考、执行工具、等待批准或已经完成的工作,变成太空站里的小人。支持等距 3D、俯视 2D、实时列表和可拖动的悬浮小窗。

A live activity dashboard for your coding agents inside magpie: every session becomes a little worker in a voxel space-station office, driven by the agent's own session files rather than guesses from network traffic.

Agent Office in magpie's window

快速开始 · Quick start

magpie plugin add @magpie-community/page-agent-office

安装后打开 插件 › Agent 办公室。默认显示真实会话,不是演示数据;第一次没有会话时会看到空办公室。想预览完整效果,可在 设置 › 示例 Agent 临时打开示例。

  • 3D / 2D:等距太空站或俯视图。
  • 办公室 / 列表:实时状态、当前步骤、目录、模型和最近活动时间。
  • 点击小人或列表行:查看任务、最近提问、工具步骤、回复摘要和续接命令。
  • 画中画:可拖动、可缩放的悬浮小窗,✕ 或 Esc 放回。

支持直接读取会话文件的 Agent:Claude Code、Codex、DeepSeek Harness、Gemini CLI、Qwen Code、Pi、omp、Qoder、WorkBuddy、CodeBuddy。其他 Agent(Cursor、OpenCode、Copilot、Kimi 等)在通过 magpie 的模型工作时也会显示。

它会读取什么: 这些 Agent 写在本机的会话文件,包括提问、回复和工具命令,并在插件自己的目录里生成 page/live.js 供页面显示。设置里关闭「显示提问和回复」后只保留状态与工具名,不再写入提问、回复或命令参数。

仓库带有 magpie-plugin topic,因此也会出现在 插件 › 发现 › 非官方插件 · GitHub。插件市场的收录进展见 magpie-community/plugins。

功能与状态 · 数据来源 · 隐私 · 设置 · 限制 · 开发测试

Where a worker is, is what it is doing

Status Where Sign
Thinking · 思考中 at a desk …
Running tools · 执行中 at a desk, typing, its screen lit spinner, how long it has run
Replying · 回复中 at a desk lines
Waiting for you · 等你回应 in the purple square, waving !
Done · 已完成 on the sofa, asleep after 20 minutes z
Error · 错误 at the broken console ×

The counts at the top are how many need you (waiting for an approval or an answer, failed, or stuck), how many are working and how many are done. Below, real sessions: DeepSeek Harness running a tool, Codex done on the sofa, the panel of the first opened by a click:

A real session's panel

Which way each worker faces

A seat says which way its owner looks: at a desk the sitter faces the desk, so the monitor stands on the desk's far edge with its lit side toward them and the chair's back behind; on the left wall's sofa they look east and on the front sofa north, away from the backrest. The head shows a face when that side is toward the camera, a profile when it is east, and the back of the head when it is away.

Movement and idle gestures

Completed agents occasionally stretch, glance sideways, swing their legs or nod off. Their schedules differ, and these gestures pause while walking or working. The new gestures respect the system's reduced-motion preference; name tags remain steady.

Sofas are blocked to normal foot traffic, including the space behind their backrests. Each seat has a front approach: walk through the aisle, board from the front, then leave by that same approach. Rerouting midway through boarding first returns to the aisle. Path smoothing checks every crossed grid cell, and an unreachable destination never falls back to walking straight through furniture.

How it knows

From each agent's own session file, as the agent writes it — not a guess from traffic. The plugin's host part (it runs in magpie's plugin host while magpie is open) reads them every 1.5 seconds, only what changed:

Agent File it reads
Claude Code ~/.claude/projects/*/*.jsonl
Codex ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl (+ session_index.jsonl for titles)
DeepSeek Harness ~/.dsh/sessions/*/*/session.v4.jsonl.zstd
Gemini CLI · Qwen Code ~/.gemini/tmp/*/chats/session-*, ~/.qwen/tmp/*/chats/session-*
Pi · omp ~/.pi/agent/sessions/*/*.jsonl, ~/.omp/agent/sessions/*/*.jsonl
Qoder · WorkBuddy · CodeBuddy their projects/*/*.jsonl (Claude Code's format)

The *_HOME / *_CONFIG_DIR variables those agents honour are honoured here too. What each file says decides the status outright: a tool call with no result yet is running, an approval asked (Codex's exec_approval_request, DeepSeek Harness's approval/asked, Gemini's awaiting_approval) is waiting for you, a question tool is asked you something, the turn's end is done, an interruption is stopped, an error turn is error. A turn whose file hasn't moved for ten minutes is shown as stuck.

An agent killed mid-turn writes no end at all: one agent running another (claude -p or codex exec from a Bash tool) and interrupting it leaves the other's file mid-turn. Claude Code keeps a file per running process (sessions/<pid>.json), so a Claude Code session with no running process is stopped, at once. Codex and the other agents keep nothing a reader can check, so such a session shows as stuck. Any agent not at work — stuck, failed, stopped, done or waiting — can be taken out of the office with Clear (清除) in its panel; it comes back when its session moves again.

Every other agent (Cursor, OpenCode, Copilot, Kimi…) shows while it works through magpie: the module is also an asynchronous gateway hook that sees its requests. The hook returns no body, so no request changes.

Both write page/live.js beside the page, which the page loads every second (a plugin page has no network; its own files it may load). The green live dot by the title turns grey if the host stops writing.

All 60 agents magpie knows are named with their own icons, the files magpie itself shows (page/icons, from magpie's assets, MIT).

Using it

Hovering only highlights a worker. Click a worker, its name tag or a row in the list to open its panel — the task, the last thing you asked, the step it's on, how its answer begins, its model and folder, and Resume command, shown selected so ⌘C / Ctrl+C copies it — which stays at the side until you close it (✕ or Esc) or click another agent.

Privacy

  • It reads the agents' session files on this computer, only reads them, and only the last two days'. Through the gateway it records only requests made on this computer (magpie's origin: local) unless you set "remote": true.
  • live.js holds the agent, the session id, the folder name and path, the model, the last prompt (200 characters), the first 280 characters of the last answer, and the names and targets of the last tool calls. It never holds a key, a header or a whole conversation. With "text": false (Settings › Show prompts and replies, off) it keeps statuses and tool names only.
  • live.js stays in the plugin's folder and is never sent anywhere. The page asks magpie for no data at all: its permissions list is empty.

Picture in picture

Picture in picture (画中画) lifts the office into a small window of the page's own, over the rest of it: drag its bar to move it, drag its corner to reshape it, click ✕ or press Esc to put it back. Only the agents that need you keep their name tags there; hover any of them for the card.

The office in its own window, in magpie

magpie frames a plugin's page with allow="" and sandbox="allow-scripts", so the browser's own floating window (a <video>'s picture-in-picture, or documentPictureInPicture) is refused a page inside it — that was tried first, and it left nothing on screen. A window drawn in the page is not.

2D The list

Options

{ "mode": "office", "dim": "3d", "demo": false, "showDone": true, "hideAfter": "6h", "text": true, "remote": false }
Key
mode office or list
dim 3d or 2d
demo show sample agents (Settings › Sample agents)
showDone keep finished agents on the sofa
hideAfter when a finished or failed agent leaves: 1h, 6h, 24h, never
text keep prompts and replies (false: statuses and tool names only)
remote the gateway part also records requests from other computers and gateway keys
approvalAfterSec for an agent seen only through the gateway: how long its tools run before it counts as waiting for you (90)

The page saves the first five as you change them; a change restarts the plugin's host (magpie's options do), so it waits until it has been left alone a moment.

What it cannot know

  • An agent whose files it doesn't read and that doesn't use magpie's models. It has no record here at all.
  • The model's word-by-word progress. A file is written per message, so "replying" means the session's file is moving and the model has begun its answer.
  • Sessions older than two days, or more than the latest 40: they are left out to keep each read cheap.

Files

  • lib/readers.mjs — each agent's session format turned into its phase, step, prompt and answer. No I/O.
  • lib/scan.mjs — finds the files in each agent's folder and rereads only the ones that changed.
  • lib/track.mjs — what the gateway hook keeps, from requests and replies in each API (Anthropic Messages, Chat Completions, Responses, Gemini). No I/O, so the tests drive it directly.
  • office.hooks.mjs — the host part: scans every 1.5 s, sees the gateway's requests, writes page/live.js.
  • page/agents.js, page/icons/ — every agent magpie knows, with its own icon.
  • page/model.js — statuses, counts, words (English and Chinese), agent marks, resume commands and sample agents, with no DOM.
  • page/scene.js — the office, drawn on a canvas in isometric 3D or top-down 2D.
  • page/icons.js, page/app.js, page/index.html, page/style.css — the page.

Test

bun test

Checked in magpie 0.1.1318's own window (magpie web), in every view: 3D, 2D, list, and the window of its own.

License

MIT