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). diff --git a/README.md b/README.md index a63f58e..4d4f157 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-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 @@ -508,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 21f5abd..3b8ca7f 100644 --- a/lib/session.js +++ b/lib/session.js @@ -60,6 +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; + // 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`. 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/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" diff --git a/test/agent-name.test.js b/test/agent-name.test.js new file mode 100644 index 0000000..f31ab4a --- /dev/null +++ b/test/agent-name.test.js @@ -0,0 +1,15 @@ +"use strict"; +// 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 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.agent_name, "Pointman · @space-builder"); + const plain = await collectSession(os.tmpdir(), { CLAUDECODE: "1", MB_RUN_ID: "1" }); + assert.equal(plain.agent_name, undefined); +});