From 508e8eebb68fcffd1d22af5afd886c5b3e4c0c9f Mon Sep 17 00:00:00 2001 From: James Briggs <35938317+jamescalam@users.noreply.github.com> Date: Wed, 2 Dec 2026 12:29:41 +0800 Subject: [PATCH 1/8] A deploy from a Pointman run names the Pointman agent (EXT-198) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The session stamp carries extra.pointman_run (MB_RUN_ID) and extra.pointman, the agent's handle (POINTMAN_AGENT, else the run's person file name), so the page names the version "Pointman · @handle" instead of the harness. Co-authored-by: Pointman Co-authored-by: Claude --- lib/session.js | 7 +++++++ test/pointman-stamp.test.js | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 test/pointman-stamp.test.js diff --git a/lib/session.js b/lib/session.js index 21f5abd..9911f75 100644 --- a/lib/session.js +++ b/lib/session.js @@ -60,6 +60,13 @@ async function collectSession(cwd = process.cwd(), env = process.env) { s.agent = "spacesheep-cli"; } if (env.AI_AGENT) extra.ai_agent = env.AI_AGENT; + // A Pointman agent's run: the page names it as Pointman's agent, not as the harness it runs on. + // The handle is POINTMAN_AGENT, else the name of the run's person file, which the node keys by agent. + if (env.MB_RUN_ID) { + extra.pointman_run = env.MB_RUN_ID; + const handle = (env.POINTMAN_AGENT || (env.MB_RUN_PERSON_FILE ? path.basename(env.MB_RUN_PERSON_FILE) : "")).replace(/^@/, ""); + if (/^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$/.test(handle)) extra.pointman = handle; + } Object.assign(s, await git(cwd)); s.extra = extra; diff --git a/test/pointman-stamp.test.js b/test/pointman-stamp.test.js new file mode 100644 index 0000000..fabae1a --- /dev/null +++ b/test/pointman-stamp.test.js @@ -0,0 +1,20 @@ +"use strict"; +// A Pointman agent's deploy is stamped as Pointman's agent (EXT-198), so the page names it +// "Pointman · @handle" rather than the harness Pointman runs it on. Run: npm test +const { it } = require("node:test"); +const assert = require("node:assert"); +const os = require("os"); +const { collectSession } = require("../lib/session"); + +it("stamps a Pointman run with its run id and the agent's handle", async () => { + const s = await collectSession(os.tmpdir(), { CLAUDECODE: "1", CLAUDE_CODE_SESSION_ID: "abc", MB_RUN_ID: "45937", MB_RUN_PERSON_FILE: "/x/run-person/space-builder" }); + assert.equal(s.agent, "claude-code"); + assert.equal(s.extra.pointman_run, "45937"); + assert.equal(s.extra.pointman, "space-builder"); + const named = await collectSession(os.tmpdir(), { MB_RUN_ID: "1", POINTMAN_AGENT: "@editor", MB_RUN_PERSON_FILE: "/x/other" }); + assert.equal(named.extra.pointman, "editor"); + const odd = await collectSession(os.tmpdir(), { MB_RUN_ID: "1", MB_RUN_PERSON_FILE: "/x/a b" }); + assert.equal(odd.extra.pointman, undefined); + const plain = await collectSession(os.tmpdir(), { CLAUDECODE: "1" }); + assert.equal(plain.extra.pointman_run, undefined); +}); From dc301ee4793ab6bf9fb7be46a967753cf20d0bd8 Mon Sep 17 00:00:00 2001 From: James Briggs <35938317+jamescalam@users.noreply.github.com> Date: Wed, 2 Dec 2026 12:35:16 +0800 Subject: [PATCH 2/8] talk progress: what a session is doing on a page's message, for its Session tab (EXT-198) `spacesheep talk progress | --done [--session ID]` posts to the app's /api/talk/progress with the machine's key. Pointman's extension calls it as it follows its agent's run. Co-authored-by: Pointman Co-authored-by: Claude --- bin/spacesheep.js | 4 +++- lib/talk.js | 29 +++++++++++++++++++++++++++-- test/pointman-stamp.test.js | 15 +++++++++++++++ 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/bin/spacesheep.js b/bin/spacesheep.js index 6b04042..fda8437 100755 --- a/bin/spacesheep.js +++ b/bin/spacesheep.js @@ -108,6 +108,8 @@ const HELP = ` spacesheep talk reply [--session ID] [--to MESSAGE_ID] answer in the page's Session tab; --to names the message it answers (the id on its listen line) + spacesheep talk progress | --done [--session ID] + what the session is doing now, for its Session tab spacesheep machine on [--folder DIR]... [--mode safe|auto] [--name NAME] let spacesheep.dev reach this machine's Claude Code sessions (Pro/Team): runs sessionpipe's install and control pairing @@ -228,7 +230,7 @@ function parse(argv) { * `label` on the new call. */ const spaceLine = (s) => `${(s.emoji || "·").padEnd(2)} ${(s.title || "(untitled)").slice(0, 40).padEnd(42)} ${(s.visibility || "").padEnd(10)} ${s.url || s.id}`; const versionLine = (v) => `${(v.sha || v.id || "").slice(0, 12).padEnd(13)} ${(v.created_at || "").slice(0, 16).padEnd(17)} ${v.version_name || v.name || v.label || ""}`; -const FLAGS = new Set(["--camera", "--screen", "--test", "--beta", "--system", "--load-test", "--service", "--remove-service", "--new", "--replace", "--no-manifest", "--no-team", "--claude", "--codex", "--antigravity", "--no-memory", "--codex-chain", "--once", "--no-service", "--dry-run", "--no-skill", "--no-login", "--quiet"]); +const FLAGS = new Set(["--camera", "--screen", "--test", "--beta", "--system", "--load-test", "--service", "--remove-service", "--new", "--replace", "--no-manifest", "--no-team", "--claude", "--codex", "--antigravity", "--no-memory", "--codex-chain", "--once", "--no-service", "--dry-run", "--no-skill", "--no-login", "--quiet", "--done"]); const camel = (s) => s.replace(/-([a-z])/g, (_, c) => c.toUpperCase()); /** --scope as the server names it: stream(s) → "stream", session(s)/ingest → "ingest", full/none → undefined. */ function keyScope(v) { diff --git a/lib/talk.js b/lib/talk.js index 7dea5a1..25fd682 100644 --- a/lib/talk.js +++ b/lib/talk.js @@ -14,6 +14,11 @@ // talk reply [--session] [--to ID] // answer in the Session tab (MCP talk_reply); --to // names the message it answers (`id` on its line) +// talk progress | --done [--session ID] +// what the session is doing on the message it took, +// for its Session tab ("working: ", "quiet" once +// it ages); --done when the turn ended. Pointman's +// extension calls it as it follows its agent's run. // // The listener is plain Node, so it runs anywhere Node does (Windows included) — // no bash, no curl. It ends only when the link is gone (404/410); anything else @@ -211,6 +216,21 @@ function setLocal(on, cfg = require("./config")) { cfg.writeConfig(c); } +/** POST /api/talk/progress with this machine's key: a step, or the turn's end. */ +async function progress(sid, step, fetchImpl = fetch, cfg = require("./config")) { + const k = cfg.resolveKey(); + if (!k) throw new Error("not signed in: run `spacesheep login`"); + const resp = await fetchImpl(`${cfg.appOrigin()}/api/talk/progress`, { + method: "POST", + headers: { "Content-Type": "application/json", Authorization: `Bearer ${k.key}` }, + body: JSON.stringify(step ? { session: sid, text: step } : { session: sid, done: true }), + }); + let data = {}; + try { data = await resp.json(); } catch {} + if (!resp.ok) throw new Error(data.error || `the server answered HTTP ${resp.status}`); + return data; +} + async function run(opts, call, out, log, door = null) { const sub = opts._[0]; if (sub === "status" || !sub) { @@ -233,6 +253,11 @@ async function run(opts, call, out, log, door = null) { const to = replyTo(opts); return out(await call("talk_reply", { session_id: sessionId(opts), text, ...(to ? { message_id: to } : {}) })); } + if (sub === "progress") { + const step = opts._.slice(1).join(" ").trim(); + if (!step === !opts.done) throw new Error("usage: spacesheep talk progress | --done [--session ID]"); + return out(await progress(sessionId(opts), opts.done ? null : step)); + } if (sub === "listen") { const sid = sessionId(opts); const r = await listener(sid, call, door); @@ -249,7 +274,7 @@ async function run(opts, call, out, log, door = null) { await listenLoop(url, { once: !!opts.once }); return; } - throw new Error("usage: spacesheep talk status | on | off | listen [--session ID] [--once] | reply [--session ID] [--to MESSAGE_ID]"); + throw new Error("usage: spacesheep talk status | on | off | listen [--session ID] [--once] | reply [--session ID] [--to MESSAGE_ID] | progress | --done [--session ID]"); } -module.exports = { run, listener, listenLoop, linkFrom, sessionId, replyTo, deployNudge, startNudge, machineOn, SETUP, STOPPED }; +module.exports = { run, progress, listener, listenLoop, linkFrom, sessionId, replyTo, deployNudge, startNudge, machineOn, SETUP, STOPPED }; diff --git a/test/pointman-stamp.test.js b/test/pointman-stamp.test.js index fabae1a..9269d17 100644 --- a/test/pointman-stamp.test.js +++ b/test/pointman-stamp.test.js @@ -18,3 +18,18 @@ it("stamps a Pointman run with its run id and the agent's handle", async () => { const plain = await collectSession(os.tmpdir(), { CLAUDECODE: "1" }); assert.equal(plain.extra.pointman_run, undefined); }); + +it("talk progress posts a step, or the turn's end, with the machine's key", async () => { + const { progress } = require("../lib/talk"); + const sent = []; + const fetchImpl = async (url, init) => { sent.push({ url, init }); return { ok: true, json: async () => ({ ok: true, working: true }) }; }; + const cfg = { resolveKey: () => ({ key: "ss_test" }), appOrigin: () => "https://app.test" }; + assert.deepEqual(await progress("abc", "Editing the intro", fetchImpl, cfg), { ok: true, working: true }); + await progress("abc", null, fetchImpl, cfg); + assert.equal(sent[0].url, "https://app.test/api/talk/progress"); + assert.equal(sent[0].init.headers.Authorization, "Bearer ss_test"); + assert.deepEqual(JSON.parse(sent[0].init.body), { session: "abc", text: "Editing the intro" }); + assert.deepEqual(JSON.parse(sent[1].init.body), { session: "abc", done: true }); + const refused = async () => ({ ok: false, status: 403, json: async () => ({ error: "Talking to your sessions is part of Pro and Team." }) }); + await assert.rejects(progress("abc", "x", refused, cfg), /Pro and Team/); +}); From e1dfd0928e3ac2c17cdad9945d7791d2fb5e8aa7 Mon Sep 17 00:00:00 2001 From: James Briggs <35938317+jamescalam@users.noreply.github.com> Date: Wed, 2 Dec 2026 12:41:09 +0800 Subject: [PATCH 3/8] talk progress test: the server answers {ok, open} Co-authored-by: Pointman Co-authored-by: Claude --- test/pointman-stamp.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/pointman-stamp.test.js b/test/pointman-stamp.test.js index 9269d17..f73a711 100644 --- a/test/pointman-stamp.test.js +++ b/test/pointman-stamp.test.js @@ -22,9 +22,9 @@ it("stamps a Pointman run with its run id and the agent's handle", async () => { it("talk progress posts a step, or the turn's end, with the machine's key", async () => { const { progress } = require("../lib/talk"); const sent = []; - const fetchImpl = async (url, init) => { sent.push({ url, init }); return { ok: true, json: async () => ({ ok: true, working: true }) }; }; + const fetchImpl = async (url, init) => { sent.push({ url, init }); return { ok: true, json: async () => ({ ok: true, open: true }) }; }; const cfg = { resolveKey: () => ({ key: "ss_test" }), appOrigin: () => "https://app.test" }; - assert.deepEqual(await progress("abc", "Editing the intro", fetchImpl, cfg), { ok: true, working: true }); + assert.deepEqual(await progress("abc", "Editing the intro", fetchImpl, cfg), { ok: true, open: true }); await progress("abc", null, fetchImpl, cfg); assert.equal(sent[0].url, "https://app.test/api/talk/progress"); assert.equal(sent[0].init.headers.Authorization, "Bearer ss_test"); From e45cb5649deb02df0ef4a287f2f82bd1aac8b1c2 Mon Sep 17 00:00:00 2001 From: James Briggs <35938317+jamescalam@users.noreply.github.com> Date: Wed, 2 Dec 2026 12:44:07 +0800 Subject: [PATCH 4/8] talk progress --to MESSAGE_ID: the message the run took, as talk reply's (EXT-198) Co-authored-by: Pointman Co-authored-by: Claude --- bin/spacesheep.js | 5 +++-- lib/talk.js | 15 ++++++++------- test/pointman-stamp.test.js | 4 ++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/bin/spacesheep.js b/bin/spacesheep.js index fda8437..ba487fb 100755 --- a/bin/spacesheep.js +++ b/bin/spacesheep.js @@ -108,8 +108,9 @@ const HELP = ` spacesheep talk reply [--session ID] [--to MESSAGE_ID] answer in the page's Session tab; --to names the message it answers (the id on its listen line) - spacesheep talk progress | --done [--session ID] - what the session is doing now, for its Session tab + spacesheep talk progress | --done [--session ID] [--to MESSAGE_ID] + what the session is doing now, for its Session tab; + --to names the message it took (the id on its listen line) spacesheep machine on [--folder DIR]... [--mode safe|auto] [--name NAME] let spacesheep.dev reach this machine's Claude Code sessions (Pro/Team): runs sessionpipe's install and control pairing diff --git a/lib/talk.js b/lib/talk.js index 25fd682..27b6d1d 100644 --- a/lib/talk.js +++ b/lib/talk.js @@ -14,11 +14,12 @@ // talk reply [--session] [--to ID] // answer in the Session tab (MCP talk_reply); --to // names the message it answers (`id` on its line) -// talk progress | --done [--session ID] +// talk progress | --done [--session ID] [--to ID] // what the session is doing on the message it took, // for its Session tab ("working: ", "quiet" once // it ages); --done when the turn ended. Pointman's -// extension calls it as it follows its agent's run. +// extension calls it as it follows its agent's run; +// --to names the message the run took, as reply's does. // // The listener is plain Node, so it runs anywhere Node does (Windows included) — // no bash, no curl. It ends only when the link is gone (404/410); anything else @@ -217,13 +218,13 @@ function setLocal(on, cfg = require("./config")) { } /** POST /api/talk/progress with this machine's key: a step, or the turn's end. */ -async function progress(sid, step, fetchImpl = fetch, cfg = require("./config")) { +async function progress(sid, step, fetchImpl = fetch, cfg = require("./config"), to = null) { const k = cfg.resolveKey(); if (!k) throw new Error("not signed in: run `spacesheep login`"); const resp = await fetchImpl(`${cfg.appOrigin()}/api/talk/progress`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${k.key}` }, - body: JSON.stringify(step ? { session: sid, text: step } : { session: sid, done: true }), + body: JSON.stringify({ session: sid, ...(to ? { message_id: to } : {}), ...(step ? { text: step } : { done: true }) }), }); let data = {}; try { data = await resp.json(); } catch {} @@ -255,8 +256,8 @@ async function run(opts, call, out, log, door = null) { } if (sub === "progress") { const step = opts._.slice(1).join(" ").trim(); - if (!step === !opts.done) throw new Error("usage: spacesheep talk progress | --done [--session ID]"); - return out(await progress(sessionId(opts), opts.done ? null : step)); + if (!step === !opts.done) throw new Error("usage: spacesheep talk progress | --done [--session ID] [--to MESSAGE_ID]"); + return out(await progress(sessionId(opts), opts.done ? null : step, undefined, undefined, replyTo(opts))); } if (sub === "listen") { const sid = sessionId(opts); @@ -274,7 +275,7 @@ async function run(opts, call, out, log, door = null) { await listenLoop(url, { once: !!opts.once }); return; } - throw new Error("usage: spacesheep talk status | on | off | listen [--session ID] [--once] | reply [--session ID] [--to MESSAGE_ID] | progress | --done [--session ID]"); + throw new Error("usage: spacesheep talk status | on | off | listen [--session ID] [--once] | reply [--session ID] [--to MESSAGE_ID] | progress | --done [--session ID] [--to MESSAGE_ID]"); } module.exports = { run, progress, listener, listenLoop, linkFrom, sessionId, replyTo, deployNudge, startNudge, machineOn, SETUP, STOPPED }; diff --git a/test/pointman-stamp.test.js b/test/pointman-stamp.test.js index f73a711..11cfa7d 100644 --- a/test/pointman-stamp.test.js +++ b/test/pointman-stamp.test.js @@ -25,11 +25,11 @@ it("talk progress posts a step, or the turn's end, with the machine's key", asyn const fetchImpl = async (url, init) => { sent.push({ url, init }); return { ok: true, json: async () => ({ ok: true, open: true }) }; }; const cfg = { resolveKey: () => ({ key: "ss_test" }), appOrigin: () => "https://app.test" }; assert.deepEqual(await progress("abc", "Editing the intro", fetchImpl, cfg), { ok: true, open: true }); - await progress("abc", null, fetchImpl, cfg); + await progress("abc", null, fetchImpl, cfg, 7); assert.equal(sent[0].url, "https://app.test/api/talk/progress"); assert.equal(sent[0].init.headers.Authorization, "Bearer ss_test"); assert.deepEqual(JSON.parse(sent[0].init.body), { session: "abc", text: "Editing the intro" }); - assert.deepEqual(JSON.parse(sent[1].init.body), { session: "abc", done: true }); + assert.deepEqual(JSON.parse(sent[1].init.body), { session: "abc", message_id: 7, done: true }); const refused = async () => ({ ok: false, status: 403, json: async () => ({ error: "Talking to your sessions is part of Pro and Team." }) }); await assert.rejects(progress("abc", "x", refused, cfg), /Pro and Team/); }); From e4fafc178481954373d439f1f9090629772cedd3 Mon Sep 17 00:00:00 2001 From: James Briggs <35938317+jamescalam@users.noreply.github.com> Date: Wed, 2 Dec 2026 12:56:18 +0800 Subject: [PATCH 5/8] 1.44.0: deploys from a Pointman run name the agent, and talk progress (EXT-198) Co-authored-by: Pointman Co-authored-by: Claude --- README.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a63f58e..a0616d4 100644 --- a/README.md +++ b/README.md @@ -227,6 +227,8 @@ start itself: spacesheep talk on # your account's switch, and this machine's opt-in spacesheep talk listen --once # waits for the next message, prints it, exits (run it in the background) spacesheep talk reply --to 19 "done" # answer message 19 in the Session tab +spacesheep talk progress --to 19 "Editing the intro" # what it's doing now, shown in the tab +spacesheep talk progress --to 19 --done # the run ended ``` Each message the listener prints carries its `id`. Pass it with `--to`, so the answer diff --git a/package.json b/package.json index dd26be3..20849d4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "spacesheep", - "version": "1.43.0", + "version": "1.44.0", "description": "Publish web pages to spacesheep.dev from a terminal or CI: `npx spacesheep deploy ./dist`", "bin": { "spacesheep": "./bin/spacesheep.js" From c5a357c3a6f70a02152f0e2107505d3824ede005 Mon Sep 17 00:00:00 2001 From: James Briggs <35938317+jamescalam@users.noreply.github.com> Date: Wed, 2 Dec 2026 16:37:28 +0800 Subject: [PATCH 6/8] SPACESHEEP_AGENT_NAME names the agent a deploy comes from, in place of Pointman's variables (EXT-198) Co-authored-by: Pointman Co-authored-by: Claude --- README.md | 4 ++++ lib/session.js | 10 +++------- lib/talk.js | 4 ++-- ...ntman-stamp.test.js => agent-name.test.js} | 19 +++++++------------ 4 files changed, 16 insertions(+), 21 deletions(-) rename test/{pointman-stamp.test.js => agent-name.test.js} (63%) diff --git a/README.md b/README.md index a0616d4..af128d4 100644 --- a/README.md +++ b/README.md @@ -510,6 +510,10 @@ connected and they all keep working. `SPACESHEEP_KEY` in the environment wins over the stored login. That is how CI authenticates. Keys are created and revoked at . +`SPACESHEEP_AGENT_NAME` names the agent a deploy comes from, for a tool that runs +agents for you (`Pointman · @editor`, `release bot`). The page shows it in place of +the harness's name ("Claude Code"), which is still recorded. + ## Updates `npx spacesheep@latest` always runs the newest version. A global install diff --git a/lib/session.js b/lib/session.js index 9911f75..67d5903 100644 --- a/lib/session.js +++ b/lib/session.js @@ -60,13 +60,9 @@ async function collectSession(cwd = process.cwd(), env = process.env) { s.agent = "spacesheep-cli"; } if (env.AI_AGENT) extra.ai_agent = env.AI_AGENT; - // A Pointman agent's run: the page names it as Pointman's agent, not as the harness it runs on. - // The handle is POINTMAN_AGENT, else the name of the run's person file, which the node keys by agent. - if (env.MB_RUN_ID) { - extra.pointman_run = env.MB_RUN_ID; - const handle = (env.POINTMAN_AGENT || (env.MB_RUN_PERSON_FILE ? path.basename(env.MB_RUN_PERSON_FILE) : "")).replace(/^@/, ""); - if (/^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$/.test(handle)) extra.pointman = handle; - } + // The name whoever runs the agent gives it (a team's bot, an orchestrator's agent): the page shows + // it in place of the harness's name, which stays in `agent`. + if (env.SPACESHEEP_AGENT_NAME) extra.agent_name = env.SPACESHEEP_AGENT_NAME.trim().slice(0, 80); Object.assign(s, await git(cwd)); s.extra = extra; diff --git a/lib/talk.js b/lib/talk.js index 27b6d1d..16fa82e 100644 --- a/lib/talk.js +++ b/lib/talk.js @@ -17,8 +17,8 @@ // talk progress | --done [--session ID] [--to ID] // what the session is doing on the message it took, // for its Session tab ("working: ", "quiet" once -// it ages); --done when the turn ended. Pointman's -// extension calls it as it follows its agent's run; +// it ages); --done when the turn ended. Whatever runs +// the agent can call it as it follows the run; // --to names the message the run took, as reply's does. // // The listener is plain Node, so it runs anywhere Node does (Windows included) — diff --git a/test/pointman-stamp.test.js b/test/agent-name.test.js similarity index 63% rename from test/pointman-stamp.test.js rename to test/agent-name.test.js index 11cfa7d..1689567 100644 --- a/test/pointman-stamp.test.js +++ b/test/agent-name.test.js @@ -1,22 +1,17 @@ "use strict"; -// A Pointman agent's deploy is stamped as Pointman's agent (EXT-198), so the page names it -// "Pointman · @handle" rather than the harness Pointman runs it on. Run: npm test +// A deploy carries the name its runner set (SPACESHEEP_AGENT_NAME), so the page names it that way +// rather than by the harness, which stays recorded. Run: npm test const { it } = require("node:test"); const assert = require("node:assert"); const os = require("os"); const { collectSession } = require("../lib/session"); -it("stamps a Pointman run with its run id and the agent's handle", async () => { - const s = await collectSession(os.tmpdir(), { CLAUDECODE: "1", CLAUDE_CODE_SESSION_ID: "abc", MB_RUN_ID: "45937", MB_RUN_PERSON_FILE: "/x/run-person/space-builder" }); +it("stamps the runner's name beside the harness", async () => { + const s = await collectSession(os.tmpdir(), { CLAUDECODE: "1", CLAUDE_CODE_SESSION_ID: "abc", SPACESHEEP_AGENT_NAME: " Pointman · @space-builder " }); assert.equal(s.agent, "claude-code"); - assert.equal(s.extra.pointman_run, "45937"); - assert.equal(s.extra.pointman, "space-builder"); - const named = await collectSession(os.tmpdir(), { MB_RUN_ID: "1", POINTMAN_AGENT: "@editor", MB_RUN_PERSON_FILE: "/x/other" }); - assert.equal(named.extra.pointman, "editor"); - const odd = await collectSession(os.tmpdir(), { MB_RUN_ID: "1", MB_RUN_PERSON_FILE: "/x/a b" }); - assert.equal(odd.extra.pointman, undefined); - const plain = await collectSession(os.tmpdir(), { CLAUDECODE: "1" }); - assert.equal(plain.extra.pointman_run, undefined); + assert.equal(s.extra.agent_name, "Pointman · @space-builder"); + const plain = await collectSession(os.tmpdir(), { CLAUDECODE: "1", MB_RUN_ID: "1" }); + assert.equal(plain.extra.agent_name, undefined); }); it("talk progress posts a step, or the turn's end, with the machine's key", async () => { From 5e020428de974b88798c8bcdbcbae0fb5b744cf5 Mon Sep 17 00:00:00 2001 From: James Briggs <35938317+jamescalam@users.noreply.github.com> Date: Wed, 2 Dec 2026 16:55:59 +0800 Subject: [PATCH 7/8] Agent name rides as Client.agent_name; talk progress gives way to the generated talk-steps create (EXT-198) Co-authored-by: Pointman Co-authored-by: Claude --- README.md | 4 ++-- bin/spacesheep.js | 5 +---- lib/session.js | 4 ++-- lib/talk.js | 30 ++---------------------------- test/agent-name.test.js | 19 ++----------------- 5 files changed, 9 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index af128d4..4d4f157 100644 --- a/README.md +++ b/README.md @@ -227,8 +227,8 @@ start itself: spacesheep talk on # your account's switch, and this machine's opt-in spacesheep talk listen --once # waits for the next message, prints it, exits (run it in the background) spacesheep talk reply --to 19 "done" # answer message 19 in the Session tab -spacesheep talk progress --to 19 "Editing the intro" # what it's doing now, shown in the tab -spacesheep talk progress --to 19 --done # the run ended +spacesheep talk-steps create --reply-to 19 --text "Editing the intro" # what it's doing now, shown in the tab +spacesheep talk-steps create --reply-to 19 --done # the run ended ``` Each message the listener prints carries its `id`. Pass it with `--to`, so the answer diff --git a/bin/spacesheep.js b/bin/spacesheep.js index ba487fb..6b04042 100755 --- a/bin/spacesheep.js +++ b/bin/spacesheep.js @@ -108,9 +108,6 @@ const HELP = ` spacesheep talk reply [--session ID] [--to MESSAGE_ID] answer in the page's Session tab; --to names the message it answers (the id on its listen line) - spacesheep talk progress | --done [--session ID] [--to MESSAGE_ID] - what the session is doing now, for its Session tab; - --to names the message it took (the id on its listen line) spacesheep machine on [--folder DIR]... [--mode safe|auto] [--name NAME] let spacesheep.dev reach this machine's Claude Code sessions (Pro/Team): runs sessionpipe's install and control pairing @@ -231,7 +228,7 @@ function parse(argv) { * `label` on the new call. */ const spaceLine = (s) => `${(s.emoji || "·").padEnd(2)} ${(s.title || "(untitled)").slice(0, 40).padEnd(42)} ${(s.visibility || "").padEnd(10)} ${s.url || s.id}`; const versionLine = (v) => `${(v.sha || v.id || "").slice(0, 12).padEnd(13)} ${(v.created_at || "").slice(0, 16).padEnd(17)} ${v.version_name || v.name || v.label || ""}`; -const FLAGS = new Set(["--camera", "--screen", "--test", "--beta", "--system", "--load-test", "--service", "--remove-service", "--new", "--replace", "--no-manifest", "--no-team", "--claude", "--codex", "--antigravity", "--no-memory", "--codex-chain", "--once", "--no-service", "--dry-run", "--no-skill", "--no-login", "--quiet", "--done"]); +const FLAGS = new Set(["--camera", "--screen", "--test", "--beta", "--system", "--load-test", "--service", "--remove-service", "--new", "--replace", "--no-manifest", "--no-team", "--claude", "--codex", "--antigravity", "--no-memory", "--codex-chain", "--once", "--no-service", "--dry-run", "--no-skill", "--no-login", "--quiet"]); const camel = (s) => s.replace(/-([a-z])/g, (_, c) => c.toUpperCase()); /** --scope as the server names it: stream(s) → "stream", session(s)/ingest → "ingest", full/none → undefined. */ function keyScope(v) { diff --git a/lib/session.js b/lib/session.js index 67d5903..3b8ca7f 100644 --- a/lib/session.js +++ b/lib/session.js @@ -61,8 +61,8 @@ async function collectSession(cwd = process.cwd(), env = process.env) { } if (env.AI_AGENT) extra.ai_agent = env.AI_AGENT; // The name whoever runs the agent gives it (a team's bot, an orchestrator's agent): the page shows - // it in place of the harness's name, which stays in `agent`. - if (env.SPACESHEEP_AGENT_NAME) extra.agent_name = env.SPACESHEEP_AGENT_NAME.trim().slice(0, 80); + // it in place of the harness's name, which stays in `agent`. Client.agent_name in the schema. + if (env.SPACESHEEP_AGENT_NAME?.trim()) s.agent_name = env.SPACESHEEP_AGENT_NAME.trim().slice(0, 80); Object.assign(s, await git(cwd)); s.extra = extra; diff --git a/lib/talk.js b/lib/talk.js index 16fa82e..7dea5a1 100644 --- a/lib/talk.js +++ b/lib/talk.js @@ -14,12 +14,6 @@ // talk reply [--session] [--to ID] // answer in the Session tab (MCP talk_reply); --to // names the message it answers (`id` on its line) -// talk progress | --done [--session ID] [--to ID] -// what the session is doing on the message it took, -// for its Session tab ("working: ", "quiet" once -// it ages); --done when the turn ended. Whatever runs -// the agent can call it as it follows the run; -// --to names the message the run took, as reply's does. // // The listener is plain Node, so it runs anywhere Node does (Windows included) — // no bash, no curl. It ends only when the link is gone (404/410); anything else @@ -217,21 +211,6 @@ function setLocal(on, cfg = require("./config")) { cfg.writeConfig(c); } -/** POST /api/talk/progress with this machine's key: a step, or the turn's end. */ -async function progress(sid, step, fetchImpl = fetch, cfg = require("./config"), to = null) { - const k = cfg.resolveKey(); - if (!k) throw new Error("not signed in: run `spacesheep login`"); - const resp = await fetchImpl(`${cfg.appOrigin()}/api/talk/progress`, { - method: "POST", - headers: { "Content-Type": "application/json", Authorization: `Bearer ${k.key}` }, - body: JSON.stringify({ session: sid, ...(to ? { message_id: to } : {}), ...(step ? { text: step } : { done: true }) }), - }); - let data = {}; - try { data = await resp.json(); } catch {} - if (!resp.ok) throw new Error(data.error || `the server answered HTTP ${resp.status}`); - return data; -} - async function run(opts, call, out, log, door = null) { const sub = opts._[0]; if (sub === "status" || !sub) { @@ -254,11 +233,6 @@ async function run(opts, call, out, log, door = null) { const to = replyTo(opts); return out(await call("talk_reply", { session_id: sessionId(opts), text, ...(to ? { message_id: to } : {}) })); } - if (sub === "progress") { - const step = opts._.slice(1).join(" ").trim(); - if (!step === !opts.done) throw new Error("usage: spacesheep talk progress | --done [--session ID] [--to MESSAGE_ID]"); - return out(await progress(sessionId(opts), opts.done ? null : step, undefined, undefined, replyTo(opts))); - } if (sub === "listen") { const sid = sessionId(opts); const r = await listener(sid, call, door); @@ -275,7 +249,7 @@ async function run(opts, call, out, log, door = null) { await listenLoop(url, { once: !!opts.once }); return; } - throw new Error("usage: spacesheep talk status | on | off | listen [--session ID] [--once] | reply [--session ID] [--to MESSAGE_ID] | progress | --done [--session ID] [--to MESSAGE_ID]"); + throw new Error("usage: spacesheep talk status | on | off | listen [--session ID] [--once] | reply [--session ID] [--to MESSAGE_ID]"); } -module.exports = { run, progress, listener, listenLoop, linkFrom, sessionId, replyTo, deployNudge, startNudge, machineOn, SETUP, STOPPED }; +module.exports = { run, listener, listenLoop, linkFrom, sessionId, replyTo, deployNudge, startNudge, machineOn, SETUP, STOPPED }; diff --git a/test/agent-name.test.js b/test/agent-name.test.js index 1689567..f31ab4a 100644 --- a/test/agent-name.test.js +++ b/test/agent-name.test.js @@ -9,22 +9,7 @@ const { collectSession } = require("../lib/session"); it("stamps the runner's name beside the harness", async () => { const s = await collectSession(os.tmpdir(), { CLAUDECODE: "1", CLAUDE_CODE_SESSION_ID: "abc", SPACESHEEP_AGENT_NAME: " Pointman · @space-builder " }); assert.equal(s.agent, "claude-code"); - assert.equal(s.extra.agent_name, "Pointman · @space-builder"); + assert.equal(s.agent_name, "Pointman · @space-builder"); const plain = await collectSession(os.tmpdir(), { CLAUDECODE: "1", MB_RUN_ID: "1" }); - assert.equal(plain.extra.agent_name, undefined); -}); - -it("talk progress posts a step, or the turn's end, with the machine's key", async () => { - const { progress } = require("../lib/talk"); - const sent = []; - const fetchImpl = async (url, init) => { sent.push({ url, init }); return { ok: true, json: async () => ({ ok: true, open: true }) }; }; - const cfg = { resolveKey: () => ({ key: "ss_test" }), appOrigin: () => "https://app.test" }; - assert.deepEqual(await progress("abc", "Editing the intro", fetchImpl, cfg), { ok: true, open: true }); - await progress("abc", null, fetchImpl, cfg, 7); - assert.equal(sent[0].url, "https://app.test/api/talk/progress"); - assert.equal(sent[0].init.headers.Authorization, "Bearer ss_test"); - assert.deepEqual(JSON.parse(sent[0].init.body), { session: "abc", text: "Editing the intro" }); - assert.deepEqual(JSON.parse(sent[1].init.body), { session: "abc", message_id: 7, done: true }); - const refused = async () => ({ ok: false, status: 403, json: async () => ({ error: "Talking to your sessions is part of Pro and Team." }) }); - await assert.rejects(progress("abc", "x", refused, cfg), /Pro and Team/); + assert.equal(plain.agent_name, undefined); }); From fc10e98ba7d661cffaa8642e8a712d1d6f601604 Mon Sep 17 00:00:00 2001 From: James Briggs <35938317+jamescalam@users.noreply.github.com> Date: Wed, 2 Dec 2026 16:59:34 +0800 Subject: [PATCH 8/8] AGENTS.md: every argument is in the server's schema Co-authored-by: Pointman Co-authored-by: Claude --- AGENTS.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..90431fd --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,10 @@ +# spacesheep CLI + +## Every argument is in the schema + +A command that calls spacesheep is generated from the server's doors table +(`lib/doors.js`), which is built from `proto/spacesheep/v1/` in +[spacesheep-dev/spacesheep](https://github.com/spacesheep-dev/spacesheep). A new call, +input or field goes in that `.proto` first. Never add a hand-written verb, flag or request +body for it, or a key in a free-form map like the session's `extra`: a value the CLI sends +on an existing call uses a declared field of that call's message (James, 2026-12-02, EXT-198).