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.
This commit is contained in:
yetone
2026-11-05 09:45:19 +08:00
parent 5150142eb2
commit 73362966e7
4 changed files with 22 additions and 2 deletions
+14
View File
@@ -1,5 +1,19 @@
# Changelog
## 0.3.2 · 2026-11-05
### Added
- Settings has a switch, "Include agents from other computers and gateway keys", for `remote`. It stays off by default. While it is off, an empty office that had such requests says they were ignored because the switch is off, in all nine languages. By frederick-wang, from QingJ01/magpie-agent-office#5 (#741).
### Changed
- The Settings button's chevron is drawn as an SVG that sits on the label's centre line and turns over while the menu is open; the Language, Scene and Quality pickers draw the same chevron. By frederick-wang (#740).
### Fixed
- The page's asset stamps match their files again. Since 0.3.0 four of them were stale, so a same-version cache could pair the new page with an old model.js, scene.js, scene3d.js or app.js.
## 0.3.1 · 2026-11-03
### Fixed
@@ -316,6 +316,12 @@ test("the host part writes what it reads, and changes no request", async () => {
hook.stop()
const c = { origin: "local", protocol: "anthropic", agent: "cursor", session: "cu1", cwd: "/x", model: "m", query: "hi", options: {}, state: {}, report() {} }
expect(await hook.onRequest({ model: "m", tools: [{ name: "x" }], messages: [{ role: "user", content: "hi" }] }, c)).toBeUndefined()
// with no remote option set, a request from another computer is only counted
const far = { ...c, origin: "gateway-key", agent: "opencode", session: "far1", state: {} }
await hook.onRequest({ model: "m", tools: [{ name: "x" }], messages: [{ role: "user", content: "hi" }] }, far)
expect(far.state.office).toBeNull()
expect(hook.snapshot().sessions.some((s) => s.session === "far1")).toBe(false)
expect(hook.snapshot().dropped).toBeGreaterThanOrEqual(1)
hook.write()
const live = readFileSync(join(out, "live.js"), "utf8")
const snap = JSON.parse(live.slice("globalThis.AgentOfficeLive = ".length).replace(/;\s*$/, ""))
+1 -1
View File
@@ -119,7 +119,7 @@ test("the authenticated standalone page, bridge, live data and JSON options work
try {
const ping = await (await fetch(s.url + "api/ping")).json()
expect(ping.name).toBe("agent-office")
expect(ping.version).toBe("0.3.1")
expect(ping.version).toBe("0.3.2")
const page = await fetch(s.url)
expect(page.status).toBe(200)
expect(await page.text()).toContain('src="_magpie/bridge.js"')
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@magpie-community/page-agent-office",
"version": "0.3.1",
"version": "0.3.2",
"description": "我的 Agent 在干嘛:读取本机 Claude Code、Codex、Copilot CLI、Kimi Code、DeepSeek Harness、Gemini CLI、Qwen Code、Pi、omp、Qoder、WorkBuddy、CodeBuddy、Grok Build 的会话文件,把每个会话画成真 3D / 等距 / 2D 办公室里的小人,或分组工作台。Live agent activity dashboard for magpie, with a real WebGL office and eleven scenes.",
"type": "module",
"files": [