peerband 0.2.2 → 0.2.4

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/herdr-plugin.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  id = "peerband"
2
2
  name = "PeerBand"
3
- version = "0.2.2"
3
+ version = "0.2.4"
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,16 +1,42 @@
1
1
  {
2
2
  "name": "peerband",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
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",
7
7
  "homepage": "https://peerband.com",
8
- "repository": { "type": "git", "url": "git+https://github.com/kshvidler/peerband-cli.git" },
9
- "bugs": { "url": "https://github.com/kshvidler/peerband-cli/issues" },
10
- "keywords": ["peerband", "herdr", "mcp", "coding-agents", "cli"],
11
- "bin": { "peerband": "dist/peerband.mjs" },
12
- "engines": { "node": ">=22.13.0" },
13
- "files": ["dist/", "herdr/", "herdr-plugin.toml", "protocol/", "install/", "skills/", "README.md", "LICENSE", "NOTICE", "SECURITY.md"],
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/kshvidler/peerband-cli.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/kshvidler/peerband-cli/issues"
14
+ },
15
+ "keywords": [
16
+ "peerband",
17
+ "herdr",
18
+ "mcp",
19
+ "coding-agents",
20
+ "cli"
21
+ ],
22
+ "bin": {
23
+ "peerband": "dist/peerband.mjs"
24
+ },
25
+ "engines": {
26
+ "node": ">=22.13.0"
27
+ },
28
+ "files": [
29
+ "dist/",
30
+ "herdr/",
31
+ "herdr-plugin.toml",
32
+ "protocol/",
33
+ "install/",
34
+ "skills/",
35
+ "README.md",
36
+ "LICENSE",
37
+ "NOTICE",
38
+ "SECURITY.md"
39
+ ],
14
40
  "scripts": {
15
41
  "build": "node scripts/build.mjs",
16
42
  "typecheck": "tsc --noEmit",
@@ -41,3 +41,38 @@ The client only reports metadata (tool, target id, outcome, latency) to its loca
41
41
  The protocol has no explicit version field today. Changes are additive: new optional fields, new `tool` values and new frame types may appear, so implementations must ignore unknown fields and unknown frame types on received messages. The `event` frame is such an addition: servers that do not know it ignore it, and the `x-peerband-features` upgrade header tells servers that do which clients emit events. A breaking change would use a new endpoint path or a `hello` negotiation message and be documented here with a bump of the schema `$id`. Schemas are published with each client release in `protocol/`.
42
42
 
43
43
  The tests in `test/protocol.test.ts` validate messages produced by the real relay client against these schemas.
44
+
45
+ ### Environment control (optional capability)
46
+
47
+ A connector implementing environment tools advertises `environment-control` in
48
+ the comma-separated `x-peerband-features` upgrade header, alongside `events` when
49
+ available. A server must check this feature before routing `list_environment` or
50
+ `control_environment`. The standard request/response envelope and 15-second
51
+ request deadline are unchanged. Old servers can ignore the header value.
52
+
53
+ Both tools require `principal.role: "owner"`, `environment:control` in the verified
54
+ principal's scopes, and the local `enableEnvironmentControl` opt-in. Read-only
55
+ mode and configured agent/workspace allowlists deny both tools. The server must
56
+ resolve ownership and require an explicit installation before dispatch. Guest
57
+ shares never grant environment authority.
58
+
59
+ `list_environment` takes `{}` and returns `workspaces`, `tabs`, `panes` (at most 50
60
+ each), with corresponding `workspacesTruncated`, `tabsTruncated`,
61
+ `panesTruncated` booleans. Rows carry only selected, bounded metadata: IDs, labels,
62
+ paths, agent kind and state. No terminal contents, argv, tokens or environment
63
+ variables leave the machine through these tools.
64
+
65
+ `control_environment` accepts camelCase arguments, as listed in the README action
66
+ table (`workspaceId`, `tabId`, `paneId`, `idempotencyKey` on the wire). The connector
67
+ independently validates the action-specific fields and the installed Herdr schema.
68
+ Creation always sends `focus: false`; agent startup never accepts native arguments.
69
+ A write returns a durable receipt, queried through `get_request_status`; successful
70
+ receipts include bounded metadata in `result`, with camelCase result IDs. Receipt
71
+ states and uncertainty rules match message delivery. Neither the relay nor the
72
+ connector retries a mutation after disconnection or startup reconciliation.
73
+
74
+ Connectors may additionally return an `actions` array from `list_environment`.
75
+ Clients should require `agent.rename` in that list before offering agent-name
76
+ changes. This action takes `{paneId, name, idempotencyKey}` and addresses Herdr
77
+ by the explicit pane ID. Pane metadata includes the agent live `name` when known.
78
+ Older connectors omit `actions` and keep their existing environment controls.
@@ -11,6 +11,22 @@
11
11
  { "$ref": "#/$defs/event" }
12
12
  ],
13
13
  "$defs": {
14
+ "environmentControlArgs": {
15
+ "description": "Owner-only, opt-in actions; no native args, shell, implicit targets, close/stop or env overrides. cwd must be an absolute path on the remote machine. See README for supported agent kinds.",
16
+ "oneOf": [
17
+ {"type": "object", "required": ["action", "idempotencyKey", "paneId", "name"], "additionalProperties": false, "properties": {"action": {"const": "agent.rename"}, "idempotencyKey": {"type": "string", "minLength": 16, "maxLength": 256}, "paneId": {"type": "string", "minLength": 1, "maxLength": 256, "pattern": "^[A-Za-z0-9][A-Za-z0-9:_-]{0,255}$"}, "name": {"type": "string", "minLength": 1, "maxLength": 32, "pattern": "^[a-z][a-z0-9_-]{0,31}$"}}},
18
+ {"type": "object", "required": ["action", "idempotencyKey", "cwd"], "additionalProperties": false, "properties": {"action": {"const": "workspace.create"}, "idempotencyKey": {"type": "string", "minLength": 16, "maxLength": 256}, "cwd": {"type": "string", "minLength": 1, "maxLength": 2048}, "label": {"type": "string", "minLength": 1, "maxLength": 128}}},
19
+ {"type": "object", "required": ["action", "idempotencyKey", "workspaceId", "cwd"], "additionalProperties": false, "properties": {"action": {"const": "tab.create"}, "idempotencyKey": {"type": "string", "minLength": 16, "maxLength": 256}, "workspaceId": {"type": "string", "minLength": 1, "maxLength": 256, "pattern": "^[A-Za-z0-9][A-Za-z0-9:_-]{0,255}$"}, "cwd": {"type": "string", "minLength": 1, "maxLength": 2048}, "label": {"type": "string", "minLength": 1, "maxLength": 128}}},
20
+ {"type": "object", "required": ["action", "idempotencyKey", "paneId", "cwd", "direction"], "additionalProperties": false, "properties": {"action": {"const": "pane.split"}, "idempotencyKey": {"type": "string", "minLength": 16, "maxLength": 256}, "paneId": {"type": "string", "minLength": 1, "maxLength": 256, "pattern": "^[A-Za-z0-9][A-Za-z0-9:_-]{0,255}$"}, "cwd": {"type": "string", "minLength": 1, "maxLength": 2048}, "direction": {"enum": ["right", "down", "left", "up"]}}},
21
+ {"type": "object", "required": ["action", "idempotencyKey", "paneId", "name", "kind"], "additionalProperties": false, "properties": {"action": {"const": "agent.start"}, "idempotencyKey": {"type": "string", "minLength": 16, "maxLength": 256}, "paneId": {"type": "string", "minLength": 1, "maxLength": 256, "pattern": "^[A-Za-z0-9][A-Za-z0-9:_-]{0,255}$"}, "name": {"type": "string", "minLength": 1, "maxLength": 32, "pattern": "^[a-z][a-z0-9_-]{0,31}$"}, "kind": {"type": "string", "minLength": 1, "maxLength": 32}}},
22
+ {"type": "object", "required": ["action", "idempotencyKey", "workspaceId"], "additionalProperties": false, "properties": {"action": {"const": "workspace.focus"}, "idempotencyKey": {"type": "string", "minLength": 16, "maxLength": 256}, "workspaceId": {"type": "string", "minLength": 1, "maxLength": 256, "pattern": "^[A-Za-z0-9][A-Za-z0-9:_-]{0,255}$"}}},
23
+ {"type": "object", "required": ["action", "idempotencyKey", "workspaceId", "label"], "additionalProperties": false, "properties": {"action": {"const": "workspace.rename"}, "idempotencyKey": {"type": "string", "minLength": 16, "maxLength": 256}, "workspaceId": {"type": "string", "minLength": 1, "maxLength": 256, "pattern": "^[A-Za-z0-9][A-Za-z0-9:_-]{0,255}$"}, "label": {"type": "string", "minLength": 1, "maxLength": 128}}},
24
+ {"type": "object", "required": ["action", "idempotencyKey", "tabId"], "additionalProperties": false, "properties": {"action": {"const": "tab.focus"}, "idempotencyKey": {"type": "string", "minLength": 16, "maxLength": 256}, "tabId": {"type": "string", "minLength": 1, "maxLength": 256, "pattern": "^[A-Za-z0-9][A-Za-z0-9:_-]{0,255}$"}}},
25
+ {"type": "object", "required": ["action", "idempotencyKey", "tabId", "label"], "additionalProperties": false, "properties": {"action": {"const": "tab.rename"}, "idempotencyKey": {"type": "string", "minLength": 16, "maxLength": 256}, "tabId": {"type": "string", "minLength": 1, "maxLength": 256, "pattern": "^[A-Za-z0-9][A-Za-z0-9:_-]{0,255}$"}, "label": {"type": "string", "minLength": 1, "maxLength": 128}}},
26
+ {"type": "object", "required": ["action", "idempotencyKey", "paneId"], "additionalProperties": false, "properties": {"action": {"const": "pane.focus"}, "idempotencyKey": {"type": "string", "minLength": 16, "maxLength": 256}, "paneId": {"type": "string", "minLength": 1, "maxLength": 256, "pattern": "^[A-Za-z0-9][A-Za-z0-9:_-]{0,255}$"}}},
27
+ {"type": "object", "required": ["action", "idempotencyKey", "paneId", "label"], "additionalProperties": false, "properties": {"action": {"const": "pane.rename"}, "idempotencyKey": {"type": "string", "minLength": 16, "maxLength": 256}, "paneId": {"type": "string", "minLength": 1, "maxLength": 256, "pattern": "^[A-Za-z0-9][A-Za-z0-9:_-]{0,255}$"}, "label": {"type": "string", "minLength": 1, "maxLength": 128}}}
28
+ ]
29
+ },
14
30
  "agentStatus": { "enum": ["idle", "working", "blocked", "done", "unknown"] },
15
31
  "event": {
16
32
  "title": "client -> server: agent event",
@@ -77,16 +93,17 @@
77
93
  },
78
94
  "request": {
79
95
  "title": "server -> client: tool request",
96
+ "allOf": [{"if": {"properties": {"tool": {"const": "control_environment"}}}, "then": {"properties": {"args": {"$ref": "#/$defs/environmentControlArgs"}}}}, {"if": {"properties": {"tool": {"const": "list_environment"}}}, "then": {"properties": {"args": {"type": "object", "maxProperties": 0}}}}],
80
97
  "description": "At most 32 outstanding per connection; the client answers within 15 seconds. Requests are never replayed.",
81
98
  "type": "object",
82
99
  "required": ["type", "id", "tool", "args", "principal"],
83
100
  "properties": {
84
101
  "type": { "const": "request" },
85
102
  "id": { "type": "string", "minLength": 1, "maxLength": 256 },
86
- "tool": { "enum": ["list_agents", "get_agent_status", "get_agent_output", "get_request_status", "send_agent_message"] },
103
+ "tool": { "enum": ["list_agents", "get_agent_status", "get_agent_output", "get_request_status", "send_agent_message", "list_environment", "control_environment"] },
87
104
  "args": {
88
105
  "type": "object",
89
- "description": "camelCase arguments: list_agents {machine, workspace, status, cursor, limit}; get_agent_status {agentId}; get_agent_output {agentId, lines, bytes, cursor}; send_agent_message {agentId, message, idempotencyKey}; get_request_status {requestId}."
106
+ "description": "camelCase arguments: list_agents {machine, workspace, status, cursor, limit}; get_agent_status {agentId}; get_agent_output {agentId, lines, bytes, cursor}; send_agent_message {agentId, message, idempotencyKey}; get_request_status {requestId}; list_environment {}; control_environment {action, idempotencyKey, workspaceId?, tabId?, paneId?, cwd?, label?, direction?, name?, kind?}. Environment tools require the environment-control upgrade feature, owner role and environment:control scope."
90
107
  },
91
108
  "principal": {
92
109
  "type": "object",
@@ -93,3 +93,23 @@ peerband notify "Migration finished, 3 tests failing"
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
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.
96
+
97
+ ## Create tabs, panes and agents remotely
98
+
99
+ Use `list_environment` and `control_environment` for owner-requested Herdr layout
100
+ changes and agent startup. These need explicit `installation_id`, separate
101
+ `environment:control` OAuth consent, and `enableEnvironmentControl: true` in the
102
+ machine's connector config. Message shares never grant this authority. Ask the
103
+ owner to enable it when disabled; do not edit their config on a guest's request.
104
+
105
+ List machines, then list that machine's environment for exact IDs. Use
106
+ `tab.create` with `workspace_id` and an absolute remote `cwd`, check the receipt
107
+ with `get_request_status`, then `agent.start` in its `result.rootPane.paneId`
108
+ (`pane_id`, `name`, `kind`). Next call `list_agents` for a PeerBand agent ID and
109
+ `send_agent_message` for its task. Other supported actions create workspaces,
110
+ split panes, and rename or focus workspaces/tabs/panes. Creation preserves focus.
111
+
112
+ Each control needs a fresh random idempotency key; reuse that key for retries of
113
+ the identical operation. Inspect receipts before continuing a dependent action.
114
+ `delivery_unknown` requires inspection, never an automatic retry with a new key.
115
+ No shell, raw keys, agent flags, stop/close or permission approvals are exposed.