@kvsm/blether 0.2.0 → 0.2.1

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
@@ -16,25 +16,40 @@ Teams also need a relay, which holds each agent's mailbox. It's published as the
16
16
 
17
17
  ## Quickstart
18
18
 
19
- You need Node 24, and an invite link from a teammate whose team already has a relay.
19
+ You need Node 24, and an invite link from a teammate whose team already has a relay. To start a team instead, you need a relay: see [Run a relay](https://github.com/kvsm/blether#2-run-a-relay).
20
20
 
21
21
  ```sh
22
22
  npm install -g @kvsm/blether
23
23
  blether claude install # adds the plugin to Claude Code (the CLI and VS Code)
24
+ ```
24
25
 
25
- blether init --name <name> # your identity, once per developer
26
- blether join <invite> # prints "Joined <team>."
27
- blether agent create <team> web # an agent you own: a named mailbox
26
+ Then open Claude Code in a project, with `claude` in the terminal or in VS Code, and run `/blether:setup`. Claude walks you through the rest, running the commands for you:
28
27
 
29
- cd ~/code/web-app # each project an agent works in
30
- blether use <team> web # sessions started here act as "web"
31
- ```
28
+ 1. **Your identity:** your name, as teammates will see it. Once per developer.
29
+ 2. **Your team:** joins it with your invite, or creates a new one.
30
+ 3. **This project's agent:** the named mailbox your sessions here act as. Teammates' agents message it by name, so pick one that says what it works on, such as `web-app` or `payments-api`. You can give it roles, such as `frontend` or `reviewer`, so teammates can message every agent covering an area at once.
31
+ 4. **Connecting:** the session connects to Blether, and is told whenever a message arrives.
32
32
 
33
- Start a new Claude Code session in the project and run `/blether:connect`. Claude can now message your teammates' agents, and is told when messages arrive. Sessions you don't connect leave Blether out entirely.
33
+ Claude can now message your teammates' agents. In later sessions, run `/blether:connect` when you want to work with your team. Sessions you don't connect leave Blether out entirely.
34
34
 
35
35
  By default Claude asks you before it sends any message, and before it acts on any request it receives. `blether policy` shows your Approval Policy, and `blether help` lists every command.
36
36
 
37
- To start a team or run a relay, see [Getting started](https://github.com/kvsm/blether#getting-started).
37
+ ### By hand
38
+
39
+ To set up without the skill, or for an agent other than Claude Code, run the steps yourself:
40
+
41
+ ```sh
42
+ blether init --name <name> # your identity, once per developer
43
+ blether join <invite> # prints "Joined <team>."
44
+ blether role list <team> # the team's roles, such as frontend or reviewer
45
+ blether role add <team> <role> # add one if what your agent does isn't listed
46
+ blether agent create <team> <agent name> --role <role> # an agent you own; --role is optional, and can repeat
47
+
48
+ cd <project> # each project an agent works in
49
+ blether use <team> <agent name> # sessions started here act as <agent name>
50
+ ```
51
+
52
+ In Claude Code, start a new session in the project and run `/blether:connect`. For other agents, see [Other agents](#other-agents) below. To start a team or run a relay, see [Getting started](https://github.com/kvsm/blether#getting-started).
38
53
 
39
54
  ## Other agents
40
55
 
@@ -58,7 +73,7 @@ blether --version # shows the version now installed
58
73
  blether claude install # if you use Claude Code: updates the plugin to match
59
74
  ```
60
75
 
61
- Then start new agent sessions: a running session keeps the bridge it started with. Your identity, teams and projects are left as they are. See [Updating](https://github.com/kvsm/blether#updating) for the details.
76
+ Then restart your agent sessions. Your identity, teams and projects are left as they are. See [Updating](https://github.com/kvsm/blether#updating) for the details.
62
77
 
63
78
  ## Documentation
64
79
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kvsm/blether",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Agent-to-agent communication for distributed teams of human developers: the blether CLI, the bridge (an MCP server), and the Claude Code plugin.",
5
5
  "keywords": [
6
6
  "agents",
@@ -31,8 +31,8 @@
31
31
  "devDependencies": {
32
32
  "@modelcontextprotocol/sdk": "^1.31.0",
33
33
  "esbuild": "^0.28.2",
34
- "@blether/bridge": "0.2.0",
35
- "@blether/relay": "0.2.0"
34
+ "@blether/bridge": "0.2.1",
35
+ "@blether/relay": "0.2.1"
36
36
  },
37
37
  "publishConfig": {
38
38
  "access": "public"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blether",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "displayName": "Blether",
5
5
  "description": "Message your teammates' coding agents through Blether: the bridge, new-mail notices, and skills for when and how to reach out.",
6
6
  "author": {
@@ -36960,7 +36960,7 @@ var DeviceGrant = external_exports.object({
36960
36960
  });
36961
36961
 
36962
36962
  // ../protocol/dist/version.js
36963
- var BLETHER_VERSION = "0.2.0";
36963
+ var BLETHER_VERSION = "0.2.1";
36964
36964
 
36965
36965
  // ../protocol/dist/wire.js
36966
36966
  var AudienceHint = external_exports.object({
@@ -37681,11 +37681,11 @@ function readSessionFile(path2) {
37681
37681
  try {
37682
37682
  raw = JSON.parse(readFileSync6(path2, "utf8"));
37683
37683
  } catch (error62) {
37684
- throw new SessionFileError(`${path2} isn't valid JSON (${error62.message}). Write it again with \`blether use <team> <agent>\`.`);
37684
+ throw new SessionFileError(`${path2} isn't valid JSON (${error62.message}). Write it again with \`blether use <team> <agent name>\`.`);
37685
37685
  }
37686
37686
  const parsed = SessionFileContents.safeParse(raw);
37687
37687
  if (!parsed.success) {
37688
- throw new SessionFileError(`${path2} doesn't name a team and agent. Write it again with \`blether use <team> <agent>\`.`);
37688
+ throw new SessionFileError(`${path2} doesn't name a team and agent. Write it again with \`blether use <team> <agent name>\`.`);
37689
37689
  }
37690
37690
  return parsed.data;
37691
37691
  }
@@ -51148,7 +51148,7 @@ function createDormantServer(connect2) {
51148
51148
  const offerConnect = () => {
51149
51149
  const connectTool = server2.registerTool("connect", {
51150
51150
  title: "Connect to Blether",
51151
- description: "Connects this session to Blether, so you can message the agents of other developers on your team. Call it only when your developer runs /blether:connect or asks you to connect to Blether."
51151
+ description: "Connects this session to Blether, so you can message the agents of other developers on your team. Call it ONLY when your developer runs /blether:connect or /blether:setup. Never call it otherwise, even if they ask you to connect: tell them to run /blether:connect instead."
51152
51152
  }, async () => {
51153
51153
  let connected;
51154
51154
  try {
@@ -51162,7 +51162,7 @@ function createDormantServer(connect2) {
51162
51162
  connectTool.remove();
51163
51163
  const disconnectTool = server2.registerTool("disconnect", {
51164
51164
  title: "Disconnect from Blether",
51165
- description: "Disconnects this session from Blether. Call it only when your developer runs /blether:disconnect or asks you to."
51165
+ description: "Disconnects this session from Blether. Call it ONLY when your developer runs /blether:disconnect. Never call it otherwise, even if they ask you to disconnect: tell them to run /blether:disconnect instead."
51166
51166
  }, async () => {
51167
51167
  const result = await connected.disconnect();
51168
51168
  disconnectTool.remove();
@@ -51595,7 +51595,7 @@ var SetupProblem = class extends Error {
51595
51595
  };
51596
51596
  var REFUSAL_FIXES = {
51597
51597
  "agent-in-use": (agent) => `Only one session can act as ${agent} at a time. If the other one is still in use, close it (it may be in another terminal, or on another of your devices) or choose a different agent for this project with \`blether use\`. If this session should be ${agent} instead, use take_over_agent.`,
51598
- "agent-owned-by-another": (agent, team) => `${agent} is another developer's agent. Use one of yours (\`blether agent list ${team}\`) or create one with \`blether agent create ${team} <name>\`, then restart this session.`,
51598
+ "agent-owned-by-another": (agent, team) => `${agent} is another developer's agent. Use one of yours (\`blether agent list ${team}\`) or create one with \`blether agent create ${team} <agent name>\`, then restart this session.`,
51599
51599
  "not-a-member": () => "Ask a teammate for an invite and run `blether join <invite>`, then restart this session.",
51600
51600
  "unknown-team": (_agent, team) => `The relay doesn't know ${team}; it may have been reset. Check the relay is the right one, or create the team again with \`blether team create\`.`,
51601
51601
  "authentication-failed": () => "This device's identity didn't verify. Check `blether whoami`; if it's damaged, set this device up again.",
@@ -51708,11 +51708,11 @@ async function connect(env, log, into) {
51708
51708
  }
51709
51709
  const agentName = env.BLETHER_AGENT ?? session?.contents.agent;
51710
51710
  if (agentName === void 0) {
51711
- throw new SetupProblem("No agent is chosen for this project. Run `blether use <team> <agent>` in the project (`blether agent list <team>` shows the agents), then restart this session.");
51711
+ throw new SetupProblem("No agent is chosen for this project. Run `blether use <team> <agent name>` in the project (`blether agent list <team>` shows the agents), then restart this session.");
51712
51712
  }
51713
51713
  const agent = AgentName.safeParse(agentName);
51714
51714
  if (!agent.success) {
51715
- throw new SetupProblem(`BLETHER_AGENT is set to "${agentName}", which isn't an agent name (lowercase letters, digits and hyphens). Fix it in this agent's MCP config, or remove it and run \`blether use <team> <agent>\` in the project.`);
51715
+ throw new SetupProblem(`BLETHER_AGENT is set to "${agentName}", which isn't an agent name (lowercase letters, digits and hyphens). Fix it in this agent's MCP config, or remove it and run \`blether use <team> <agent name>\` in the project.`);
51716
51716
  }
51717
51717
  if (session)
51718
51718
  log(`blether bridge using ${session.path}`);
@@ -51728,7 +51728,7 @@ async function connect(env, log, into) {
51728
51728
  }
51729
51729
  const teamName = env.BLETHER_TEAM ?? session?.contents.team;
51730
51730
  if (!teamName) {
51731
- throw new SetupProblem("No team is chosen for this project. Run `blether use <team> <agent>` in the project (`blether team list` shows your teams), then restart this session.");
51731
+ throw new SetupProblem("No team is chosen for this project. Run `blether use <team> <agent name>` in the project (`blether team list` shows your teams), then restart this session.");
51732
51732
  }
51733
51733
  let team;
51734
51734
  try {
@@ -27618,7 +27618,7 @@ function parseDeviceGrant(text) {
27618
27618
  }
27619
27619
 
27620
27620
  // ../protocol/dist/version.js
27621
- var BLETHER_VERSION = "0.2.0";
27621
+ var BLETHER_VERSION = "0.2.1";
27622
27622
 
27623
27623
  // ../protocol/dist/wire.js
27624
27624
  var AudienceHint = external_exports.object({
@@ -28877,13 +28877,16 @@ Commands:
28877
28877
  device list List your identity's devices
28878
28878
  device revoke <fingerprint> Revoke a lost or stolen device, from another of yours
28879
28879
  role add <team> <role> Add a role to the team's agreed list
28880
- agent create <team> <name> [--role <r>]...
28880
+ role list <team> List the team's roles
28881
+ agent create <team> <agent name> [--role <r>]...
28881
28882
  Create an agent you own, with roles from the team's list
28882
- agent roles <team> <name> [--role <r>]...
28883
+ agent roles <team> <agent name> [--role <r>]...
28883
28884
  Replace the roles of one of your agents
28884
28885
  agent list <team> Show the team's agents and who is online
28885
- agent delete <team> <name> Delete one of your agents (or any, as Team Admin)
28886
- use <team> <agent> [--dir <path>] Make sessions started in this project (or <path>) act as <agent>
28886
+ agent delete <team> <agent name>
28887
+ Delete one of your agents (or any, as Team Admin)
28888
+ use <team> <agent name> [--dir <path>]
28889
+ Make sessions started in this project (or <path>) act as the agent
28887
28890
  claude install Install (or update) the Blether plugin in Claude Code
28888
28891
  watch --inbox <path> --session <id>
28889
28892
  Print a line whenever a connected session's agent gets mail
@@ -28969,6 +28972,8 @@ ${USAGE}`);
28969
28972
  const [sub, ...args] = rest;
28970
28973
  if (sub === "add")
28971
28974
  return roleAdd(args, ctx);
28975
+ if (sub === "list")
28976
+ return roleList(args, ctx);
28972
28977
  throw new CliError(`Unknown role command: ${sub ?? "(none)"}
28973
28978
 
28974
28979
  ${USAGE}`);
@@ -29424,6 +29429,19 @@ async function roleAdd(args, ctx) {
29424
29429
  ctx.io.out(`Added the ${role} role to ${record2.name}.`);
29425
29430
  return 0;
29426
29431
  }
29432
+ async function roleList(args, ctx) {
29433
+ const record2 = loadTeam(ctx.teams, args[0]);
29434
+ const credentials = loadCredentials(ctx.store);
29435
+ const { team } = await withRelay(ctx, record2.relayUrl, credentials, (relay) => relay.getTeam(record2.id));
29436
+ if (team.roles.length === 0) {
29437
+ ctx.io.out(`${record2.name} has no roles yet. Add one with: blether role add ${record2.name} <role>`);
29438
+ return 0;
29439
+ }
29440
+ ctx.io.out(`Roles in ${record2.name}:`);
29441
+ for (const role of team.roles)
29442
+ ctx.io.out(` ${role}`);
29443
+ return 0;
29444
+ }
29427
29445
  async function agentCreate(args, ctx) {
29428
29446
  const { values, positionals } = parseArgs({
29429
29447
  args,
@@ -29431,7 +29449,7 @@ async function agentCreate(args, ctx) {
29431
29449
  options: { role: { type: "string", multiple: true } }
29432
29450
  });
29433
29451
  const record2 = loadTeam(ctx.teams, positionals[0]);
29434
- const name = parseName(AgentName, positionals[1], "Usage: blether agent create <team> <name> [--role <role>]...");
29452
+ const name = parseName(AgentName, positionals[1], "Usage: blether agent create <team> <agent name> [--role <role>]...");
29435
29453
  const roles = values.role ?? [];
29436
29454
  const credentials = loadCredentials(ctx.store);
29437
29455
  await withRelay(ctx, record2.relayUrl, credentials, async (relay) => {
@@ -29453,7 +29471,7 @@ async function agentRoles(args, ctx) {
29453
29471
  options: { role: { type: "string", multiple: true } }
29454
29472
  });
29455
29473
  const record2 = loadTeam(ctx.teams, positionals[0]);
29456
- const name = parseName(AgentName, positionals[1], "Usage: blether agent roles <team> <name> [--role <role>]...");
29474
+ const name = parseName(AgentName, positionals[1], "Usage: blether agent roles <team> <agent name> [--role <role>]...");
29457
29475
  const roles = values.role ?? [];
29458
29476
  const credentials = loadCredentials(ctx.store);
29459
29477
  const me2 = verifyIdentityLog(credentials.identity).id;
@@ -29506,7 +29524,7 @@ async function teamRemove(args, ctx) {
29506
29524
  }
29507
29525
  async function agentDelete(args, ctx) {
29508
29526
  const record2 = loadTeam(ctx.teams, args[0]);
29509
- const name = parseName(AgentName, args[1], "Usage: blether agent delete <team> <name>");
29527
+ const name = parseName(AgentName, args[1], "Usage: blether agent delete <team> <agent name>");
29510
29528
  const credentials = loadCredentials(ctx.store);
29511
29529
  const me2 = verifyIdentityLog(credentials.identity).id;
29512
29530
  await withRelay(ctx, record2.relayUrl, credentials, async (relay) => {
@@ -29563,7 +29581,7 @@ async function use(args, ctx) {
29563
29581
  allowPositionals: true,
29564
29582
  options: { dir: { type: "string" } }
29565
29583
  });
29566
- const usage = "Usage: blether use <team> <agent> [--dir <path>]";
29584
+ const usage = "Usage: blether use <team> <agent name> [--dir <path>]";
29567
29585
  if (positionals.length === 0)
29568
29586
  throw new CliError(usage);
29569
29587
  const record2 = loadTeam(ctx.teams, positionals[0]);
@@ -29598,15 +29616,15 @@ async function agentList(args, ctx) {
29598
29616
  online: await relay.getPresence(record2.id)
29599
29617
  }));
29600
29618
  if (team.agents.length === 0) {
29601
- ctx.io.out(`${record2.name} has no agents yet. Create one with: blether agent create ${record2.name} <name>`);
29602
- return 0;
29603
- }
29604
- ctx.io.out(`Agents in ${record2.name}:`);
29605
- for (const agent of team.agents) {
29606
- const owner = identities.get(agent.owner)?.name ?? "(unknown)";
29607
- const roles = agent.roles.length > 0 ? agent.roles.join(", ") : "no roles";
29608
- const presence = online.includes(agent.name) ? "online" : "offline";
29609
- ctx.io.out(` ${agent.name} ${owner}, ${roles}, ${presence}`);
29619
+ ctx.io.out(`${record2.name} has no agents yet. Create one with: blether agent create ${record2.name} <agent name>`);
29620
+ } else {
29621
+ ctx.io.out(`Agents in ${record2.name}:`);
29622
+ for (const agent of team.agents) {
29623
+ const owner = identities.get(agent.owner)?.name ?? "(unknown)";
29624
+ const roles = agent.roles.length > 0 ? agent.roles.join(", ") : "no roles";
29625
+ const presence = online.includes(agent.name) ? "online" : "offline";
29626
+ ctx.io.out(` ${agent.name} ${owner}, ${roles}, ${presence}`);
29627
+ }
29610
29628
  }
29611
29629
  if (team.roles.length > 0) {
29612
29630
  ctx.io.out(`Roles: ${team.roles.join(", ")}`);
@@ -29679,7 +29697,7 @@ async function join6(args, ctx) {
29679
29697
  });
29680
29698
  ctx.teams.save(record2);
29681
29699
  ctx.io.out(`Joined ${record2.name}.`);
29682
- ctx.io.out(`Create an agent with: blether agent create ${record2.name} <name>, then run blether use ${record2.name} <name> in your project.`);
29700
+ ctx.io.out(`Create an agent with: blether agent create ${record2.name} <agent name>, then run blether use ${record2.name} <agent name> in your project.`);
29683
29701
  return 0;
29684
29702
  }
29685
29703
  function now(ctx) {
@@ -8,7 +8,10 @@ disable-model-invocation: true
8
8
 
9
9
  The developer wants this session to use Blether. Until now the bridge has stayed out of it.
10
10
 
11
- 1. Call the bridge's `connect` tool (`mcp__plugin_blether_blether__connect`; load it with ToolSearch first if it's deferred).
12
- 2. If it fails, tell the developer what it says. If no agent is chosen for this project, offer `/blether:setup`.
13
- 3. If it connects, do what its result says: read the mailbox, then start the watch with the Monitor tool, exactly as given.
14
- 4. Tell the developer in two or three lines: which agent this session is, what's waiting in the mailbox, and that you'll hear about new mail while connected. If another session was using the agent, it has been disconnected.
11
+ 1. Check whether another session is using the agent. Connecting takes the agent over, and the other session is disconnected without warning.
12
+ - Read `.blether/session.json` in the project root for the team and agent. If there isn't one, skip this check: the `connect` tool says what's missing.
13
+ - Run `blether agent list <team>` (the plugin puts `blether` on your Bash `PATH`). If the agent shows as `online`, another session is using it, perhaps in another terminal or on another device. Tell the developer, and go on only if they say to take it over.
14
+ 2. Call the bridge's `connect` tool (`mcp__plugin_blether_blether__connect`; load it with ToolSearch first if it's deferred).
15
+ 3. If it fails, tell the developer what it says. If no agent is chosen for this project, offer `/blether:setup`.
16
+ 4. If it connects, do what its result says: read the mailbox, then start the watch with the Monitor tool, exactly as given.
17
+ 5. Tell the developer in two or three lines: which agent this session is, what's waiting in the mailbox, and that you'll hear about new mail while connected.
@@ -31,15 +31,21 @@ Done when `team list` shows the team.
31
31
 
32
32
  ## 3. Agent for this project
33
33
 
34
- Run `agent list <team>` and ask which of **their** agents this project should act as, or what to call a new one. Agents are named for what they work on (`web`, `api`, `docs`), lowercase with hyphens. To create one, run `agent create <team> <name>`, adding `--role <role>` for roles the team already lists.
34
+ First read `.blether/session.json` in the project root, if it exists: it names the team and agent the project already acts as. If so, tell them, and ask whether to keep it. Keeping it: go on to step 4, without running `use`.
35
35
 
36
- Then run `use <team> <agent>` in the project root. It writes `.blether/session.json`, which git ignores.
36
+ Otherwise, run `agent list <team>` and ask which of **their** agents this project should act as, or what to call a new one. Teammates' agents message it by name, so suggest one that says what it works on (such as `web-app` or `payments-api`), lowercase with hyphens.
37
37
 
38
- Done when `use` reports the agent for this project.
38
+ For a new agent, run `role list <team>` and ask which roles describe what it does. Roles let teammates message every agent covering an area at once, and are optional. If one they want isn't listed, run `role add <team> <role>`. Then run `agent create <team> <agent name>`, with `--role <role>` for each role.
39
+
40
+ Then run `use <team> <agent name>` in the project root. It writes `.blether/session.json`, which git ignores.
41
+
42
+ Done when the project has the agent they want, kept or set with `use`.
39
43
 
40
44
  ## 4. Connect and check
41
45
 
42
- Setting Blether up is a request to use it, so connect this session: call the bridge's `connect` tool (`mcp__plugin_blether_blether__connect`; load it with ToolSearch first if it's deferred). It reads the project's agent when called, so there's no need to restart.
46
+ Setting Blether up is a request to use it, so connect this session. Connecting takes the agent over from any other session connected as it, which is then disconnected without warning. So first run `agent list <team>`: if the project's agent shows as `online`, another session (perhaps in another terminal, or on another device) is using it. Tell them, and connect only if they say to take it over.
47
+
48
+ To connect, call the bridge's `connect` tool (`mcp__plugin_blether_blether__connect`; load it with ToolSearch first if it's deferred). It reads the project's agent when called, so there's no need to restart.
43
49
 
44
50
  Done when it connects and its result's instructions are followed (read the mailbox, start the watch). If it fails, fix what it says.
45
51
 
@@ -51,6 +57,6 @@ Tell them how Blether works from now on:
51
57
 
52
58
  Offer this option and set it up if they want it:
53
59
 
54
- - **Status line**: `blether status` prints a count of messages agents are holding for the developer's decision. Offer to add it to `statusLine` in `~/.claude/settings.json`, merging with any status line they already have.
60
+ - **Status line**: `blether status` prints a count of messages agents are holding for the developer's decision. Read `statusLine` in `~/.claude/settings.json` first: if it already runs `blether status`, say so and skip this. Otherwise, offer to add it, merging with any status line they already have.
55
61
 
56
62
  Finish with a one-paragraph summary: who they are, which team, which agent this project acts as, and what's enabled.