peerband 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,13 +1,48 @@
1
- # PeerBand
1
+ <p align="center">
2
+ <a href="https://peerband.com">
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/kshvidler/peerband-cli/main/docs/assets/peerband-logo-dark.svg">
5
+ <img src="https://raw.githubusercontent.com/kshvidler/peerband-cli/main/docs/assets/peerband-logo.svg" alt="PeerBand" width="72" height="72">
6
+ </picture>
7
+ </a>
8
+ </p>
2
9
 
3
- **A direct line to your coding agents.** PeerBand lets you reach the agents running in [Herdr](https://herdr.dev) from any MCP client (Claude, ChatGPT, your own tools) through your PeerBand account. This repository is the open-source client: the `peerband` command-line tool and the Herdr plugin. It runs on your machine and connects out to the PeerBand relay; nothing connects in.
10
+ <h1 align="center">PeerBand</h1>
11
+
12
+ <p align="center"><strong>A direct line to your local AI agents.</strong></p>
13
+
14
+ <p align="center">
15
+ <a href="https://www.npmjs.com/package/peerband"><img src="https://img.shields.io/npm/v/peerband?color=111&label=npm" alt="npm version"></a>
16
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-111" alt="Apache-2.0 license"></a>
17
+ <img src="https://img.shields.io/badge/node-%E2%89%A522.13-111" alt="Node.js 22.13 or newer">
18
+ </p>
19
+
20
+ <p align="center">
21
+ <a href="https://peerband.com">Website</a> ·
22
+ <a href="https://peerband.com/guide">Guide</a> ·
23
+ <a href="https://peerband.com/docs">Docs</a> ·
24
+ <a href="https://peerband.com/dashboard">Dashboard</a>
25
+ </p>
26
+
27
+ PeerBand connects ChatGPT, Claude or any MCP client to the coding agents (Claude Code, Codex, Gemini CLI, OpenCode and others) running in [Herdr](https://herdr.dev) on your machine. Ask what they're doing, send the next instruction, share access with a teammate, and get a note in Slack, Discord or your own endpoint when an agent needs you.
28
+
29
+ This repository is the open-source client: the `peerband` command-line tool and the Herdr plugin. It runs on your machine and connects out to the PeerBand relay; nothing connects in.
4
30
 
5
31
  ```
6
32
  MCP client --> PeerBand relay <== outbound WebSocket == peerband connector --> Herdr
7
- (Claude, ...) (peerband.com) (on your machine) (your agents)
33
+ (ChatGPT, Claude) (peerband.com) (on your machine) (your agents)
8
34
  ```
9
35
 
10
- Your MCP client can list agents, read their status and bounded recent output, and send them a message (sending needs your approval of the `agents:message` permission when you connect the client, and a machine can opt out; see [Security model](#security-model)). This project is unofficial and is not affiliated with Herdr or Amazon.
36
+ ## What you can do
37
+
38
+ - **Check in from anywhere.** Add one URL to ChatGPT, Claude or Claude Code and ask what your agents are doing. Your client lists agents and reads their status and bounded recent output.
39
+ - **Send the next instruction.** Messages go to an explicit agent, only with your consent (`agents:message`), and every message tells the agent who sent it.
40
+ - **Share a machine.** `peerband share` creates an invite link for a teammate or a review bot: read only, or read and message. Your agent treats guests as coworkers.
41
+ - **Get told when an agent needs you.** Agents send you notes with `peerband notify`. Webhooks deliver status changes and notes to Slack, Discord, or your own endpoint, signed with [Standard Webhooks](https://www.standardwebhooks.com). Send a note to one webhook with `--channel`.
42
+ - **No polling.** The connector streams agent status changes, so the dashboard and MCP clients read output only when something changed. `wait_for_agent` waits for an agent to finish or block without reading its output.
43
+ - **Safe by default.** Outbound connection only, metadata-only activity logs, one switch to make a machine read only, and best-effort secret redaction.
44
+
45
+ This project is unofficial and is not affiliated with Herdr or Amazon.
11
46
 
12
47
  ## Requirements
13
48
 
@@ -56,6 +91,21 @@ No browser available? Pass a one-time grant from the PeerBand dashboard instead:
56
91
 
57
92
  1. `npm install -g peerband && peerband setup`. Confirm the code shown in your terminal when your browser opens, and press Enter to accept the Herdr plugin and the agent skill. Setup then opens the PeerBand Relay tab; press Space there if it is not connected yet.
58
93
  2. Add the MCP server URL that `peerband setup`, `peerband relay` and `peerband status` print (`https://mcp.peerband.com/mcp`) to your MCP client: a custom connector in ChatGPT or Claude, or `claude mcp add --transport http peerband https://mcp.peerband.com/mcp` in Claude Code. Sign in and approve access when the client asks.
94
+ 3. Ask your client something like "What are my agents doing?".
95
+
96
+ ## MCP tools
97
+
98
+ | Tool | Scope | What it does |
99
+ | --- | --- | --- |
100
+ | `list_machines` | `agents:read` | Your machines (and machines shared with you), their installation IDs and whether each is online. Call it first |
101
+ | `list_agents` | `agents:read` | The agents on a machine, with status, label, workspace and Herdr location (space and tab) |
102
+ | `get_agent_status` | `agents:read` | The status of one agent: `idle`, `working`, `blocked`, `done` or `unknown` |
103
+ | `get_agent_output` | `agents:read` | A bounded excerpt of an agent's recent output |
104
+ | `wait_for_agent` | `agents:read` | Wait up to 50 seconds for an agent to reach a status (default: idle, blocked or done), without polling or reading output |
105
+ | `send_agent_message` | `agents:message` | Send a message to an explicit agent ID. Fails with `write_disabled` on a read-only machine |
106
+ | `get_request_status` | `agents:read` | The delivery receipt of an earlier message |
107
+
108
+ The agent tools take an optional `installation_id`; it can be left out when you have one machine, or exactly one online. Clients that support MCP Events can subscribe to agent status changes and notes instead of waiting. Full reference: [peerband.com/docs](https://peerband.com/docs#tools).
59
109
 
60
110
  ## Logging in
61
111
 
@@ -151,6 +201,16 @@ peerband notify "Migration finished, 3 tests failing"
151
201
 
152
202
  The note goes to the machine owner only (never to people you shared the machine with). Control characters are removed and likely secrets are redacted, best effort, like agent output. It needs the Relay tab's helper to be running and connected; a note sent while it is offline fails with an error instead of being queued. The [agent skill](#agent-skill) tells agents when to use it. The wire format is in [protocol/](protocol/README.md).
153
203
 
204
+ ### Webhooks
205
+
206
+ Add webhooks in the PeerBand dashboard under Webhooks. Each one has a name, an HTTPS URL, a format and a filter:
207
+
208
+ - **Formats.** `slack` and `discord` post a one-line message to an incoming webhook. `standard` posts a JSON envelope signed with [Standard Webhooks](https://www.standardwebhooks.com) (`webhook-id`, `webhook-timestamp`, `webhook-signature` headers), so you can verify it with any Standard Webhooks library and the secret shown once when you create the webhook.
209
+ - **Events.** `agent.status_changed` (filter by status, for example only `blocked`), `agent.notified` (notes), `machine.online` and `machine.offline` (held for 30 seconds, so a short network drop pages nobody). The Test button sends `webhook.test`. Webhooks go to the machine owner only, never to people you shared the machine with.
210
+ - **Machines.** All your machines, or a chosen few.
211
+
212
+ Failed deliveries are retried for about a day with backoff, and the dashboard shows every attempt. Webhook payloads carry metadata and note text only, never terminal output.
213
+
154
214
  ### Channels
155
215
 
156
216
  A channel is one of your PeerBand webhooks, addressed by its name: for example a Slack or Discord incoming webhook, or your own endpoint. Add them in the PeerBand dashboard under Webhooks; the webhook's name is the channel name. A note always shows in the dashboard. Without a channel, it also goes to every webhook that takes notes; with one, it goes to that one webhook instead (the dashboard shows which channel it was sent to):
package/dist/peerband.mjs CHANGED
@@ -14241,7 +14241,17 @@ function isRecord3(value) {
14241
14241
  }
14242
14242
 
14243
14243
  // src/runtime-herdr/events.ts
14244
- var LIST_SUBSCRIPTIONS = ["pane.created", "pane.closed", "pane.exited", "pane.agent_detected"];
14244
+ var LIST_SUBSCRIPTIONS = [
14245
+ "pane.created",
14246
+ "pane.closed",
14247
+ "pane.exited",
14248
+ "pane.agent_detected",
14249
+ "pane.moved",
14250
+ "tab.renamed",
14251
+ "tab.moved",
14252
+ "workspace.renamed",
14253
+ "workspace.reordered"
14254
+ ];
14245
14255
  var UNSUPPORTED = /* @__PURE__ */ new Set(["invalid_request", "unknown_method", "method_not_found", "unsupported_capability", "schema_mismatch"]);
14246
14256
  var normalizeName = (name) => name.replaceAll(".", "_");
14247
14257
  var HerdrEventBridge = class {
@@ -14750,7 +14760,8 @@ var HerdrAdapter = class {
14750
14760
  }
14751
14761
  async refreshAgents() {
14752
14762
  const { client } = await this.initialize();
14753
- const result = asObject(await client.request("agent.list", {}));
14763
+ const [listed, layout] = await Promise.all([client.request("agent.list", {}), readLayout(client)]);
14764
+ const result = asObject(listed);
14754
14765
  if (result.type !== "agent_list" || !Array.isArray(result.agents)) throw this.schemaMismatch("agent.list returned an unexpected result type");
14755
14766
  const marker = this.socketPath ? await readEndpointMarker(this.socketPath) : void 0;
14756
14767
  const reconnected = marker !== void 0 && this.endpointMarker !== void 0 && marker !== this.endpointMarker;
@@ -14769,14 +14780,18 @@ var HerdrAdapter = class {
14769
14780
  const live = { id, fingerprint, agent: raw };
14770
14781
  next.set(raw.pane_id, live);
14771
14782
  nextIds.add(id);
14772
- records.push(toRecord(live, this.machineId, promptTarget(raw, rawAgents) !== void 0));
14783
+ records.push(toRecord(live, this.machineId, promptTarget(raw, rawAgents) !== void 0, layout));
14773
14784
  }
14774
14785
  for (const previous of previousTargets) if (!nextIds.has(previous.id)) this.retired.add(previous.id);
14775
14786
  const idsChanged = this.listed && (nextIds.size !== previousTargets.length || previousTargets.some((item) => !nextIds.has(item.id)));
14787
+ const layoutChanged = this.listed && records.some((record) => {
14788
+ const before = this.records.get(record.id);
14789
+ return before !== void 0 && JSON.stringify(before.location) !== JSON.stringify(record.location);
14790
+ });
14776
14791
  this.current = next;
14777
14792
  this.records = new Map(records.map((record) => [record.id, record]));
14778
14793
  this.listed = true;
14779
- this.bridge?.agentsRefreshed(idsChanged);
14794
+ this.bridge?.agentsRefreshed(idsChanged || layoutChanged);
14780
14795
  return records;
14781
14796
  }
14782
14797
  /** Status and list-change events from Herdr's events.subscribe (metadata only, never pane text). */
@@ -14897,7 +14912,43 @@ var HerdrAdapter = class {
14897
14912
  return new ConnectError("schema_mismatch", `Herdr response did not match the selected API schema: ${message}`, "Use the API schema shipped with the connected Herdr version.");
14898
14913
  }
14899
14914
  };
14900
- function toRecord(live, machineId, canSend) {
14915
+ async function readLayout(client) {
14916
+ const [spaces, tabs] = await Promise.all([
14917
+ client.request("workspace.list", {}).then((result) => layoutEntries(result, "workspace_list", "workspaces", "workspace_id"), () => /* @__PURE__ */ new Map()),
14918
+ client.request("tab.list", {}).then((result) => layoutEntries(result, "tab_list", "tabs", "tab_id"), () => /* @__PURE__ */ new Map())
14919
+ ]);
14920
+ return { spaces, tabs };
14921
+ }
14922
+ function layoutEntries(result, type, key, idKey) {
14923
+ const entries = /* @__PURE__ */ new Map();
14924
+ if (!result || typeof result !== "object") return entries;
14925
+ const value = result;
14926
+ if (value.type !== type || !Array.isArray(value[key])) return entries;
14927
+ for (const item of value[key]) {
14928
+ if (!item || typeof item !== "object") continue;
14929
+ const row = item;
14930
+ if (typeof row[idKey] !== "string") continue;
14931
+ entries.set(row[idKey], {
14932
+ label: layoutLabel(row.label),
14933
+ number: Number.isSafeInteger(row.number) && row.number >= 0 ? row.number : null
14934
+ });
14935
+ }
14936
+ return entries;
14937
+ }
14938
+ function layoutLabel(value) {
14939
+ if (typeof value !== "string") return null;
14940
+ const label = value.replace(/[\u0000-\u001f\u007f-\u009f]/g, " ").trim().slice(0, 128);
14941
+ return label || null;
14942
+ }
14943
+ function toLocation(agent, layout) {
14944
+ const space = layout.spaces.get(agent.workspace_id);
14945
+ const tab = layout.tabs.get(agent.tab_id);
14946
+ return {
14947
+ space: { id: agent.workspace_id, label: space?.label ?? null, number: space?.number ?? null },
14948
+ tab: { id: agent.tab_id, label: tab?.label ?? null, number: tab?.number ?? null }
14949
+ };
14950
+ }
14951
+ function toRecord(live, machineId, canSend, layout) {
14901
14952
  const agent = live.agent;
14902
14953
  const label = agent.display_agent ?? agent.name ?? agent.agent ?? agent.terminal_title_stripped ?? agent.title ?? "Herdr agent";
14903
14954
  const status = ["idle", "working", "blocked", "done", "unknown"].includes(agent.agent_status) ? agent.agent_status : "unknown";
@@ -14912,7 +14963,8 @@ function toRecord(live, machineId, canSend) {
14912
14963
  rawStatus: agent.agent_status,
14913
14964
  observedAt: (/* @__PURE__ */ new Date()).toISOString(),
14914
14965
  stale: false,
14915
- capabilities: { readOutput: true, sendMessage: canSend, ...canSend ? {} : { reason: "A unique valid live name or pane target is required for prompt targeting." } }
14966
+ capabilities: { readOutput: true, sendMessage: canSend, ...canSend ? {} : { reason: "A unique valid live name or pane target is required for prompt targeting." } },
14967
+ location: toLocation(agent, layout)
14916
14968
  };
14917
14969
  }
14918
14970
  function isValidAlias(value) {
@@ -16853,7 +16905,7 @@ function herdrGroupHelp(s) {
16853
16905
  }
16854
16906
 
16855
16907
  // src/cli/cli.ts
16856
- var VERSION = true ? "0.2.1" : "0.0.0-dev";
16908
+ var VERSION = true ? "0.2.2" : "0.0.0-dev";
16857
16909
  function createContext(overrides = {}) {
16858
16910
  const env = overrides.env ?? process.env;
16859
16911
  const stdout = overrides.stdout ?? process.stdout;
package/herdr-plugin.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  id = "peerband"
2
2
  name = "PeerBand"
3
- version = "0.2.1"
3
+ version = "0.2.2"
4
4
  min_herdr_version = "0.9.3"
5
5
  description = "Reach your Herdr agents from any MCP client through your PeerBand account"
6
6
  platforms = ["linux", "macos", "windows"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peerband",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "PeerBand CLI and Herdr plugin: reach your local coding agents from any MCP client through your PeerBand account",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",