peerband 0.1.6 → 0.2.0

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.
@@ -172,10 +172,16 @@ async function supervise() {
172
172
  function forwardNote(input, reply) {
173
173
  const text = input.text;
174
174
  const paneId = input.paneId;
175
+ const channel = input.channel;
175
176
  if (typeof text !== "string" || text.length > 4096 || (paneId !== undefined && (typeof paneId !== "string" || paneId.length > 128))) {
176
177
  reply({ error: "invalid", message: "The note must be text of at most 1024 characters." }, true);
177
178
  return;
178
179
  }
180
+ // The connector validates the name; this only bounds what is forwarded.
181
+ if (channel !== undefined && (typeof channel !== "string" || channel.length > 64)) {
182
+ reply({ error: "invalid", message: "Invalid channel name." }, true);
183
+ return;
184
+ }
179
185
  const current = child;
180
186
  if (!current || stopping || finalStop || !current.connected) {
181
187
  reply({ error: "not-running", message: "The relay is turned off." }, true);
@@ -188,7 +194,7 @@ async function supervise() {
188
194
  }, 5000);
189
195
  timer.unref();
190
196
  pendingNotes.set(id, { reply, timer });
191
- current.send({ type: "peerband:notify", id, text, ...(paneId ? { paneId } : {}) }, (error) => {
197
+ current.send({ type: "peerband:notify", id, text, ...(paneId ? { paneId } : {}), ...(channel ? { channel } : {}) }, (error) => {
192
198
  if (!error || !pendingNotes.delete(id)) return;
193
199
  clearTimeout(timer);
194
200
  reply({ error: "not-running", message: "The connector is not reachable." }, true);
@@ -201,7 +207,7 @@ async function supervise() {
201
207
  clearTimeout(pending.timer);
202
208
  const text = (value, max) => (typeof value === "string" ? value.slice(0, max) : undefined);
203
209
  pending.reply(message.ok === true
204
- ? { ok: true, sent: message.sent === true, agentId: text(message.agentId, 256) ?? null, ...(text(message.eventId, 64) ? { eventId: text(message.eventId, 64) } : {}) }
210
+ ? { ok: true, sent: message.sent === true, agentId: text(message.agentId, 256) ?? null, ...(text(message.eventId, 64) ? { eventId: text(message.eventId, 64) } : {}), ...(text(message.channel, 64) ? { channel: text(message.channel, 64) } : {}) }
205
211
  : { error: text(message.code, 64) ?? "error", message: text(message.message, 512) ?? "The note could not be sent.", ...(text(message.nextStep, 512) ? { nextStep: text(message.nextStep, 512) } : {}) }, true);
206
212
  }
207
213
  const failNotes = () => {
package/herdr-plugin.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  id = "peerband"
2
2
  name = "PeerBand"
3
- version = "0.1.6"
3
+ version = "0.2.0"
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.1.6",
3
+ "version": "0.2.0",
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",
@@ -29,7 +29,7 @@ The grant flow (`enrollment-redeem.schema.json`) remains available for headless
29
29
  6. Agent events: the client sends `x-peerband-features: events` on the upgrade and then pushes `event` frames (`eventId`, `name`, `timestamp`, `data`) without being asked:
30
30
  - `agent.status_changed` `{agentId, status, previousStatus, label, workspace, revision}` when an agent's status changes (at most one per agent per 250 ms, latest wins, with an overall rate cap);
31
31
  - `agents.changed` `{}` when agents appear, exit or change occupant, and once after every (re)connect, so consumers re-list;
32
- - `agent.notified` `{agentId, text, audience: "owner"}` for a note sent with `peerband notify` (1 to 1024 characters, sanitized and redacted like agent output).
32
+ - `agent.notified` `{agentId, text, audience: "owner", channel?}` for a note sent with `peerband notify` (1 to 1024 characters, sanitized and redacted like agent output). `channel` is set by `peerband notify --channel NAME`: the name (`^[a-z0-9][a-z0-9-]{0,31}$`) of one of the owner's webhook endpoints. The note is still published on the machine's event stream (so it shows in the dashboard); only webhook delivery changes: that one endpoint receives it instead of every endpoint that takes notes. The CLI checks the channel with `GET /api/installation/channels` (installation credential; returns `{channels: [{name, format, state, events}]}`, never URLs or secrets) before sending.
33
33
  Events are metadata only and never carry terminal output. They are sent only while the socket is open; nothing is queued while disconnected.
34
34
 
35
35
  The client only reports metadata (tool, target id, outcome, latency) to its local activity log; message bodies and agent output are never logged.
@@ -54,13 +54,14 @@
54
54
  },
55
55
  "agentNotified": {
56
56
  "title": "data of agent.notified",
57
- "description": "A note sent with `peerband notify` from inside an agent's pane. `agentId` is that agent, or null when it could not be identified. The text is stripped of control characters and passed through the client's secret redaction. It is meant for the machine owner only (`audience`).",
57
+ "description": "A note sent with `peerband notify` from inside an agent's pane. `agentId` is that agent, or null when it could not be identified. The text is stripped of control characters and passed through the client's secret redaction. It is meant for the machine owner only (`audience`), optionally addressed to one of their channels (`channel`).",
58
58
  "type": "object",
59
59
  "required": ["agentId", "text", "audience"],
60
60
  "properties": {
61
61
  "agentId": { "type": ["string", "null"], "minLength": 1, "maxLength": 256 },
62
62
  "text": { "type": "string", "minLength": 1, "maxLength": 1024 },
63
- "audience": { "const": "owner" }
63
+ "audience": { "const": "owner" },
64
+ "channel": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]{0,31}$", "description": "Optional (`peerband notify --channel`): the name of one of the owner's webhook endpoints. The note always appears on the machine's event stream (and so in the dashboard). Of the owner's webhook endpoints, only the named one receives it when `channel` is present; when absent, every endpoint that takes notes does. Servers that do not know the field may ignore it." }
64
65
  },
65
66
  "additionalProperties": false
66
67
  },
@@ -41,7 +41,7 @@ If your user (the owner, at the keyboard or in an owner-labelled relay message)
41
41
 
42
42
  To update later: `peerband update` (updates the CLI from npm, then the Herdr plugin, and restarts the relay; `--check` only reports). If `peerband status` says the plugin version does not match the CLI, run `peerband update`.
43
43
 
44
- Other commands: `peerband login` (log in again), `peerband relay` (open the Relay tab), `peerband skill` (install or update this skill for local agents), `peerband status` (login, relay, plugin health, installation ID), `peerband connect` (run the connector in the foreground; `--read-only` blocks messages), `peerband update` (update the CLI and the plugin), `peerband herdr install` (install or repair the plugin), `peerband share` (invite another PeerBand user to this machine; `share list`, `share revoke ID`), `peerband logout`.
44
+ Other commands: `peerband channels` (the channels `peerband notify --channel` can send to), `peerband login` (log in again), `peerband relay` (open the Relay tab), `peerband skill` (install or update this skill for local agents), `peerband status` (login, relay, plugin health, installation ID), `peerband connect` (run the connector in the foreground; `--read-only` blocks messages), `peerband update` (update the CLI and the plugin), `peerband herdr install` (install or repair the plugin), `peerband share` (invite another PeerBand user to this machine; `share list`, `share revoke ID`), `peerband logout`.
45
45
 
46
46
  ## MCP tools
47
47
 
@@ -92,3 +92,4 @@ peerband notify "Migration finished, 3 tests failing"
92
92
  - Never include secrets, credentials, tokens or personal data. Redaction is best effort, not a guarantee.
93
93
  - Notes go to the machine owner only, never to people the machine is shared with.
94
94
  - The note names your agent automatically (from the pane). It needs the relay to be running and connected; if the command fails ("No PeerBand relay is running", "not connected"), carry on and report the result in your normal output instead of retrying in a loop.
95
+ - **Channels.** The owner can set up channels (their webhooks, such as a Slack channel, each with a name). Every note shows in the owner's dashboard. Without `--channel` it also goes to every webhook that takes notes; that is the right default. With `--channel NAME` it goes to that one webhook instead of all of them. Use `peerband notify --channel NAME "<text>"` only when the owner asked for a specific channel, or a project's instructions name one. Run `peerband channels` to see the names and which are active. If the channel is unknown, inactive, or the server or relay does not support channels, the command fails and says why: don't guess other names; send the note without `--channel` or tell the user.