peerband 0.2.6 → 0.2.7

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
@@ -319,6 +319,7 @@ cannot use these tools, even on a share that allows messages.
319
319
  | `workspace.rename`, `tab.rename`, `pane.rename` | Matching ID and `label` |
320
320
  | `workspace.focus`, `tab.focus`, `pane.focus` | Matching ID |
321
321
  | `workspace.close`, `tab.close`, `pane.close` | Matching ID. Closes it in Herdr, ending any agent or shell running there |
322
+ | `pane.send_input` | `pane_id`, `text`: one line typed into that pane, followed by Enter. In a shell this runs a command |
322
323
 
323
324
  `cwd` is an absolute path on the remote machine. Creation preserves the local
324
325
  user's focus. Start an agent only in an idle shell pane; Herdr checks whether the
package/dist/peerband.mjs CHANGED
@@ -11723,6 +11723,7 @@ var ENVIRONMENT_ACTIONS = [
11723
11723
  "pane.rename",
11724
11724
  "pane.focus",
11725
11725
  "pane.close",
11726
+ "pane.send_input",
11726
11727
  "agent.start",
11727
11728
  "agent.rename"
11728
11729
  ];
@@ -11739,6 +11740,7 @@ var FIELDS = {
11739
11740
  "pane.rename": ["paneId", "label"],
11740
11741
  "pane.focus": ["paneId"],
11741
11742
  "pane.close": ["paneId"],
11743
+ "pane.send_input": ["paneId", "text"],
11742
11744
  "agent.start": ["paneId", "name", "kind"],
11743
11745
  "agent.rename": ["paneId", "name"]
11744
11746
  };
@@ -11755,12 +11757,13 @@ var REQUIRED = {
11755
11757
  "pane.rename": ["paneId", "label"],
11756
11758
  "pane.focus": ["paneId"],
11757
11759
  "pane.close": ["paneId"],
11760
+ "pane.send_input": ["paneId", "text"],
11758
11761
  "agent.start": ["paneId", "name", "kind"],
11759
11762
  "agent.rename": ["paneId", "name"]
11760
11763
  };
11761
11764
  var KINDS = new Set("pi claude codex gemini cursor devin agy cline omp mastracode opencode copilot kimi kiro droid amp grok hermes kilo qodercli qwen letta maki muse".split(" "));
11762
11765
  function invalid(message) {
11763
- throw new ConnectError("invalid_argument", message, "Use an action and explicit IDs from list_environment; no shell commands or native agent arguments are accepted.");
11766
+ throw new ConnectError("invalid_argument", message, "Use an action and explicit IDs from list_environment; native agent arguments are not accepted.");
11764
11767
  }
11765
11768
  function environmentCommand(args) {
11766
11769
  const action = args.action;
@@ -11768,7 +11771,7 @@ function environmentCommand(args) {
11768
11771
  for (const key of Object.keys(args)) {
11769
11772
  if (key !== "action" && !FIELDS[action].includes(key)) invalid(`Unexpected argument: ${key}.`);
11770
11773
  const value = args[key];
11771
- const max = key === "cwd" ? 2048 : key === "label" ? 128 : 256;
11774
+ const max = key === "cwd" ? 2048 : key === "text" ? 4096 : key === "label" ? 128 : 256;
11772
11775
  if (typeof value !== "string" || !value.trim() || value.length > max || /[\u0000-\u001f\u007f-\u009f]/.test(value)) invalid(`Invalid ${key}.`);
11773
11776
  if (key.endsWith("Id") && !/^[A-Za-z0-9][A-Za-z0-9:_-]{0,255}$/.test(value)) invalid(`Invalid ${key}.`);
11774
11777
  }
@@ -12028,6 +12031,8 @@ var ConnectorCore = class {
12028
12031
  return await this.adapter.listEnvironment();
12029
12032
  case "control_environment":
12030
12033
  return await this.controlEnvironment(args, principal);
12034
+ case "read_pane":
12035
+ return await this.readPane(args, principal);
12031
12036
  case "list_agents":
12032
12037
  return await this.listAgents(args, principal);
12033
12038
  case "get_agent_status":
@@ -12125,6 +12130,20 @@ var ConnectorCore = class {
12125
12130
  const safe = sanitizeOutput(result.text, options);
12126
12131
  return { ...safe, ...result.source === "visible" ? { source: result.source } : {}, observedAt: result.observedAt, truncated: safe.truncated || result.truncated, ...result.nextCursor ? { nextCursor: result.nextCursor } : {} };
12127
12132
  }
12133
+ /** Owner-only read of any pane in the layout, so plain shells can be followed like agents. */
12134
+ async readPane(args, principal) {
12135
+ assertKeys(args, ["paneId", "lines", "bytes"]);
12136
+ this.authorizeEnvironment(principal);
12137
+ if (typeof args.paneId !== "string" || !/^[A-Za-z0-9][A-Za-z0-9:_-]{0,255}$/.test(args.paneId)) throw new ConnectError("invalid_argument", "paneId is required.", "Use a pane ID returned by list_environment.");
12138
+ if (!this.adapter.readPane) throw new ConnectError("unsupported_capability", "This runtime cannot read panes.", "Use a compatible Herdr runtime.");
12139
+ const options = {
12140
+ lines: safeInteger(args.lines, 100, 1, MAX_OUTPUT_LINES, "lines"),
12141
+ bytes: safeInteger(args.bytes, 8 * 1024, 1, MAX_OUTPUT_BYTES, "bytes")
12142
+ };
12143
+ const result = await this.adapter.readPane(args.paneId, options);
12144
+ const safe = sanitizeOutput(result.text, options);
12145
+ return { ...safe, observedAt: result.observedAt, truncated: safe.truncated || result.truncated };
12146
+ }
12128
12147
  async sendMessage(args, principal) {
12129
12148
  assertKeys(args, ["agentId", "message", "idempotencyKey"]);
12130
12149
  if (!this.writesEnabled) throw new ConnectError("write_disabled", "Message sending is disabled.", 'This machine is read-only. To allow messages, remove --read-only or set "enableWrites": true in connector.json on that machine.');
@@ -12906,14 +12925,17 @@ async function runRemoteClient(core, credentials, options = {}) {
12906
12925
  if (socket.readyState !== wrapper_default.OPEN) reject(error);
12907
12926
  });
12908
12927
  socket.once("unexpected-response", (_request, response) => {
12909
- if (response.statusCode === 401 || response.statusCode === 403) {
12928
+ const code = response.statusCode ?? 0;
12929
+ response.resume();
12930
+ if (code === 401 || code === 403) {
12910
12931
  stopped = true;
12911
12932
  setConnectionState("revoked");
12912
12933
  status(
12913
- `remote authentication was rejected (${response.statusCode}); re-enroll this installation if it was revoked.`
12934
+ `remote authentication was rejected (${code}); re-enroll this installation if it was revoked.`
12914
12935
  );
12915
12936
  }
12916
- response.resume();
12937
+ reject(new Error(`the server answered HTTP ${code || "error"} instead of connecting`));
12938
+ socket.terminate();
12917
12939
  });
12918
12940
  socket.once("close", (code, reason) => {
12919
12941
  if (heartbeatTimer) clearInterval(heartbeatTimer);
@@ -12930,7 +12952,7 @@ async function runRemoteClient(core, credentials, options = {}) {
12930
12952
  });
12931
12953
  });
12932
12954
  } catch (error) {
12933
- setConnectionState("remote-unavailable");
12955
+ if (!stopped) setConnectionState("remote-unavailable");
12934
12956
  status(`remote connection failed: ${error.message}`);
12935
12957
  }
12936
12958
  if (stopped) break;
@@ -14349,6 +14371,7 @@ function environmentParams(input) {
14349
14371
  delete params.pane_id;
14350
14372
  }
14351
14373
  if (command.action === "agent.start") params.timeout_ms = 8e3;
14374
+ if (command.action === "pane.send_input") params.keys = ["Enter"];
14352
14375
  return params;
14353
14376
  }
14354
14377
 
@@ -15065,6 +15088,14 @@ var HerdrAdapter = class {
15065
15088
  await this.getAgent(id);
15066
15089
  return { ...output, ...visibleOnly ? { source: "visible" } : {}, truncated: visibleOnly || output.truncated || result.read.truncated === true, observedAt: (/* @__PURE__ */ new Date()).toISOString(), untrusted: true };
15067
15090
  }
15091
+ async readPane(paneId, options = {}) {
15092
+ const lines = clampInteger(options.lines, 80, 1, 500);
15093
+ const { client } = await this.initialize();
15094
+ const result = asObject(await client.request("pane.read", { pane_id: paneId, source: "recent", format: "text", lines, strip_ansi: true }));
15095
+ if (result.type !== "pane_read" || !result.read || typeof result.read !== "object" || typeof result.read.text !== "string") throw this.schemaMismatch("pane.read returned an unexpected result type");
15096
+ const output = sanitizeOutput(result.read.text, { ...options, lines, bytes: clampInteger(options.bytes, 16384, 1, 32768) });
15097
+ return { ...output, truncated: output.truncated || result.read.truncated === true, observedAt: (/* @__PURE__ */ new Date()).toISOString(), untrusted: true };
15098
+ }
15068
15099
  async sendMessage(id, message) {
15069
15100
  if (typeof message !== "string" || message.length === 0 || Buffer.byteLength(message, "utf8") > 16384) {
15070
15101
  throw new ConnectError("invalid_argument", "Message must contain 1 to 16384 UTF-8 bytes.", "Shorten the message and try again.");
@@ -17146,7 +17177,7 @@ function herdrGroupHelp(s) {
17146
17177
  }
17147
17178
 
17148
17179
  // src/cli/cli.ts
17149
- var VERSION = true ? "0.2.6" : "0.0.0-dev";
17180
+ var VERSION = true ? "0.2.7" : "0.0.0-dev";
17150
17181
  function createContext(overrides = {}) {
17151
17182
  const env = overrides.env ?? process.env;
17152
17183
  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.6"
3
+ version = "0.2.7"
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.6",
3
+ "version": "0.2.7",
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",
@@ -78,4 +78,15 @@ by the explicit pane ID. Pane metadata includes the agent live `name` when known
78
78
  Clients should likewise require `workspace.close`, `tab.close` or `pane.close`
79
79
  before offering to delete a space, tab or pane. Each takes only the matching
80
80
  explicit ID and closes it in Herdr, ending whatever runs there.
81
+ Clients should require `pane.send_input` before offering to type into a pane. It
82
+ takes `{paneId, text, idempotencyKey}`: one line of at most 4096 characters with
83
+ no control characters, which the connector types into that pane followed by Enter.
84
+ In a plain shell this runs a command, so servers should expose it only where the
85
+ owner types it themselves (the dashboard), not to remote agents by default.
86
+
87
+ `read_pane` takes `{paneId, lines?, bytes?}` and returns the pane's recent text in
88
+ the same shape as `get_agent_output` (`text`, `truncated`, `observedAt`,
89
+ `untrusted`), for any pane in the layout, agents and plain shells alike. It needs
90
+ the same owner role, scope and local opt-in as the other environment tools.
91
+ Connectors without it answer `unsupported_capability`.
81
92
  Older connectors omit `actions` and keep their existing environment controls.
@@ -12,7 +12,7 @@
12
12
  ],
13
13
  "$defs": {
14
14
  "environmentControlArgs": {
15
- "description": "Owner-only actions (on unless the machine turns them off); no native args, shell, implicit targets, agent stop or env overrides; close actions remove the explicitly named space, tab or pane. cwd must be an absolute path on the remote machine. See README for supported agent kinds.",
15
+ "description": "Owner-only actions (on unless the machine turns them off); no native args, implicit targets, agent stop or env overrides; close actions remove the explicitly named space, tab or pane; pane.send_input types one line into the named pane and presses Enter. cwd must be an absolute path on the remote machine. See README for supported agent kinds.",
16
16
  "oneOf": [
17
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
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}}},
@@ -27,7 +27,8 @@
27
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
28
  {"type": "object", "required": ["action", "idempotencyKey", "workspaceId"], "additionalProperties": false, "properties": {"action": {"const": "workspace.close"}, "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}$"}}},
29
29
  {"type": "object", "required": ["action", "idempotencyKey", "tabId"], "additionalProperties": false, "properties": {"action": {"const": "tab.close"}, "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}$"}}},
30
- {"type": "object", "required": ["action", "idempotencyKey", "paneId"], "additionalProperties": false, "properties": {"action": {"const": "pane.close"}, "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}$"}}}
30
+ {"type": "object", "required": ["action", "idempotencyKey", "paneId"], "additionalProperties": false, "properties": {"action": {"const": "pane.close"}, "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}$"}}},
31
+ {"type": "object", "required": ["action", "idempotencyKey", "paneId", "text"], "additionalProperties": false, "properties": {"action": {"const": "pane.send_input"}, "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}$"}, "text": {"type": "string", "minLength": 1, "maxLength": 4096, "description": "One line, no control characters. The connector types it into the pane and presses Enter."}}}
31
32
  ]
32
33
  },
33
34
  "agentStatus": { "enum": ["idle", "working", "blocked", "done", "unknown"] },
@@ -96,17 +97,17 @@
96
97
  },
97
98
  "request": {
98
99
  "title": "server -> client: tool request",
99
- "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}}}}],
100
+ "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}}}}, {"if": {"properties": {"tool": {"const": "read_pane"}}}, "then": {"properties": {"args": {"type": "object", "required": ["paneId"], "additionalProperties": false, "properties": {"paneId": {"type": "string", "minLength": 1, "maxLength": 256, "pattern": "^[A-Za-z0-9][A-Za-z0-9:_-]{0,255}$"}, "lines": {"type": "integer", "minimum": 1}, "bytes": {"type": "integer", "minimum": 1}}}}}}],
100
101
  "description": "At most 32 outstanding per connection; the client answers within 15 seconds. Requests are never replayed.",
101
102
  "type": "object",
102
103
  "required": ["type", "id", "tool", "args", "principal"],
103
104
  "properties": {
104
105
  "type": { "const": "request" },
105
106
  "id": { "type": "string", "minLength": 1, "maxLength": 256 },
106
- "tool": { "enum": ["list_agents", "get_agent_status", "get_agent_output", "get_request_status", "send_agent_message", "list_environment", "control_environment"] },
107
+ "tool": { "enum": ["list_agents", "get_agent_status", "get_agent_output", "get_request_status", "send_agent_message", "list_environment", "control_environment", "read_pane"] },
107
108
  "args": {
108
109
  "type": "object",
109
- "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."
110
+ "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?, text?}; read_pane {paneId, lines?, bytes?}. Environment tools (including read_pane) require the environment-control upgrade feature, owner role and environment:control scope."
110
111
  },
111
112
  "principal": {
112
113
  "type": "object",
@@ -111,6 +111,8 @@ with `get_request_status`, then `agent.start` in its `result.rootPane.paneId`
111
111
  split panes, and rename or focus workspaces/tabs/panes. Creation preserves focus.
112
112
  `workspace.close`, `tab.close` and `pane.close` end everything running there:
113
113
  use them only when the owner explicitly asks to close that exact item.
114
+ `pane.send_input` types a line into a pane and presses Enter; in a shell that runs
115
+ a command. Use it only for a command the owner gave you for that exact pane.
114
116
 
115
117
  Each control needs a fresh random idempotency key; reuse that key for retries of
116
118
  the identical operation. Inspect receipts before continuing a dependent action.