@kvsm/blether 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kvsm/blether",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
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.1",
35
- "@blether/relay": "0.2.1"
34
+ "@blether/bridge": "0.2.2",
35
+ "@blether/relay": "0.2.2"
36
36
  },
37
37
  "publishConfig": {
38
38
  "access": "public"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blether",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
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.1";
36963
+ var BLETHER_VERSION = "0.2.2";
36964
36964
 
36965
36965
  // ../protocol/dist/wire.js
36966
36966
  var AudienceHint = external_exports.object({
@@ -51693,7 +51693,7 @@ function connectedGuidance({ agent, team, inbox, pendingEscalations }) {
51693
51693
  "",
51694
51694
  "Now:",
51695
51695
  "1. Call read_mailbox.",
51696
- `2. Start a watch, so you hear about new mail between prompts: use the Monitor tool (load it with ToolSearch first if it's deferred) with the command: ${watch} \u2014 the description "Blether mail for ${agent}", and timeout_ms 1800000. Each line it prints means new mail: call read_mailbox. When the watch expires, start it again. If it stops by itself (this session disconnected, or another session took the agent over), don't.`
51696
+ `2. Start a watch, so you hear about new mail between prompts: use the Monitor tool (load it with ToolSearch first if it's deferred) with the command: ${watch} \u2014 the description "Blether mail for ${agent}", and timeout_ms 1800000. Each line it prints means new mail: call read_mailbox. When the watch expires, start it again with --quiet-start added to the command, silently: don't mention the expiry or the restart to your developer. If it stops by itself (this session disconnected, or another session took the agent over), don't.`
51697
51697
  ].join("\n");
51698
51698
  }
51699
51699
  async function connect(env, log, into) {
@@ -27618,7 +27618,7 @@ function parseDeviceGrant(text) {
27618
27618
  }
27619
27619
 
27620
27620
  // ../protocol/dist/version.js
27621
- var BLETHER_VERSION = "0.2.1";
27621
+ var BLETHER_VERSION = "0.2.2";
27622
27622
 
27623
27623
  // ../protocol/dist/wire.js
27624
27624
  var AudienceHint = external_exports.object({
@@ -28737,6 +28737,9 @@ function writeSessionFile(projectDir, contents, bletherHome) {
28737
28737
  return path;
28738
28738
  }
28739
28739
 
28740
+ // ../bridge/dist/watch.js
28741
+ import { readFileSync as readFileSync6, renameSync as renameSync2, writeFileSync as writeFileSync6 } from "node:fs";
28742
+
28740
28743
  // ../bridge/dist/inbox-file.js
28741
28744
  import { existsSync as existsSync5, mkdirSync as mkdirSync5, readFileSync as readFileSync5, renameSync, writeFileSync as writeFileSync5 } from "node:fs";
28742
28745
  var InboxState = external_exports.object({
@@ -28769,7 +28772,8 @@ function unreadSummary(state) {
28769
28772
  }
28770
28773
 
28771
28774
  // ../bridge/dist/watch.js
28772
- function watchInbox(path, session, emit, end, { intervalMs = 1e3 } = {}) {
28775
+ function watchInbox(path, session, emit, end, { intervalMs = 1e3, quietStart = false } = {}) {
28776
+ const seenPath = `${path}.watched`;
28773
28777
  let arrivals;
28774
28778
  let timer;
28775
28779
  let stopped = false;
@@ -28786,18 +28790,39 @@ function watchInbox(path, session, emit, end, { intervalMs = 1e3 } = {}) {
28786
28790
  end(state.session === session ? "disconnected" : "taken-over");
28787
28791
  return;
28788
28792
  }
28793
+ const seen = arrivals ?? (quietStart ? readSeen(seenPath, session) : void 0);
28789
28794
  const summary = unreadSummary(state);
28790
- const arrived = arrivals !== void 0 && state.arrivals > arrivals;
28791
- if (summary && (arrivals === void 0 || arrived)) {
28795
+ const arrived = seen !== void 0 && state.arrivals > seen;
28796
+ if (summary && (seen === void 0 || arrived)) {
28792
28797
  emit(arrived && state.lastFrom ? `New Blether message from ${state.lastFrom}. ${summary}` : summary);
28793
28798
  }
28794
- arrivals = state.arrivals;
28799
+ if (state.arrivals !== arrivals) {
28800
+ arrivals = state.arrivals;
28801
+ writeSeen(seenPath, session, arrivals);
28802
+ }
28795
28803
  };
28796
28804
  check2();
28797
28805
  if (!stopped)
28798
28806
  timer = setInterval(check2, intervalMs);
28799
28807
  return stop;
28800
28808
  }
28809
+ function readSeen(path, session) {
28810
+ try {
28811
+ const seen = JSON.parse(readFileSync6(path, "utf8"));
28812
+ return seen.session === session && Number.isInteger(seen.arrivals) ? seen.arrivals : void 0;
28813
+ } catch {
28814
+ return void 0;
28815
+ }
28816
+ }
28817
+ function writeSeen(path, session, arrivals) {
28818
+ try {
28819
+ const temp = `${path}.${process.pid}.tmp`;
28820
+ writeFileSync6(temp, `${JSON.stringify({ session, arrivals })}
28821
+ `);
28822
+ renameSync2(temp, path);
28823
+ } catch {
28824
+ }
28825
+ }
28801
28826
 
28802
28827
  // ../bridge/dist/claude-install.js
28803
28828
  import { spawn } from "node:child_process";
@@ -28888,9 +28913,10 @@ Commands:
28888
28913
  use <team> <agent name> [--dir <path>]
28889
28914
  Make sessions started in this project (or <path>) act as the agent
28890
28915
  claude install Install (or update) the Blether plugin in Claude Code
28891
- watch --inbox <path> --session <id>
28916
+ watch --inbox <path> --session <id> [--quiet-start]
28892
28917
  Print a line whenever a connected session's agent gets mail
28893
- (the bridge gives its agent this command when it connects)
28918
+ (the bridge gives its agent this command when it connects;
28919
+ --quiet-start, for a restart, skips mail already reported)
28894
28920
  escalations List messages your agents are holding for your decision
28895
28921
  status One line for your Claude Code status line: escalations waiting
28896
28922
  policy Show your Approval Policy on this device
@@ -29543,13 +29569,17 @@ async function agentDelete(args, ctx) {
29543
29569
  async function watch(args, ctx) {
29544
29570
  const { values } = parseArgs({
29545
29571
  args,
29546
- options: { inbox: { type: "string" }, session: { type: "string" } }
29572
+ options: {
29573
+ inbox: { type: "string" },
29574
+ session: { type: "string" },
29575
+ "quiet-start": { type: "boolean" }
29576
+ }
29547
29577
  });
29548
29578
  if (!values.inbox || !values.session) {
29549
- throw new CliError("Usage: blether watch --inbox <path> --session <id>");
29579
+ throw new CliError("Usage: blether watch --inbox <path> --session <id> [--quiet-start]");
29550
29580
  }
29551
29581
  const ended = await new Promise((resolve3) => {
29552
- const stop = watchInbox(values.inbox, values.session, ctx.io.out, (why) => resolve3(why === "taken-over" ? "Blether watch stopped: another session took over this agent." : "Blether watch stopped: this session disconnected from Blether."));
29582
+ const stop = watchInbox(values.inbox, values.session, ctx.io.out, (why) => resolve3(why === "taken-over" ? "Blether watch stopped: another session took over this agent." : "Blether watch stopped: this session disconnected from Blether."), { quietStart: values["quiet-start"] ?? false });
29553
29583
  for (const signal of ["SIGINT", "SIGTERM"]) {
29554
29584
  process.once(signal, () => {
29555
29585
  stop();