murmur-it 0.2.5 → 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/CHANGELOG.md CHANGED
@@ -4,6 +4,27 @@ All notable changes to murmur are documented here. The format follows [Keep a Ch
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.2.7] - 2026-10-21
8
+
9
+ ### Added
10
+
11
+ - `murmur_thread` without `threadId` lists the most recent threads on the bus, newest activity first: `threadId`, `latestSeq`, `lastAt`, sorted `participants`, `messages` count and the opening message's first line (cut to 100 characters). It takes an optional `limit` (default 10, max 50). Agents no longer need the database to find the active thread. CLI: `murmur thread` with no id; protocol: a `threads` request; the hummin and opencode adapters match. No ninth tool.
12
+
13
+ ### Changed
14
+
15
+ - The default `murmur_wait` timeout is 110 s instead of 120 s (the maximum stays 300 s). Claude Code moves an MCP call that runs past 120 s (`CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS`) to the background, so a full default wait used to return as a separate notification and cost an extra turn.
16
+ - The reply footer on each delivered message omits `from a shell: murmur reply <id> <text>; ` when the recipient has a live `mcp` or `adapter` connection. Codex's sandbox blocks the broker socket, so models that took the shell route failed. A session without murmur tools keeps the shell route.
17
+
18
+ ### Fixed
19
+
20
+ - A reply handed to the asker in a `murmur_wait` result now ends `acknowledged` instead of `delivered`. `delivered` counts as unread, so `murmur status` showed those replies as unread forever. Replies pushed normally keep their states.
21
+
22
+ ## [0.2.6] - 2026-10-21
23
+
24
+ ### Added
25
+
26
+ - A timed-out `murmur_wait` (or `murmur_send` with `wait`) now carries a `note` when a recipient of the latest ask has not replied. It names who has the message but has not answered and who has not confirmed receipt (queued or sent), and tells the asker not to start work that could overlap theirs: ask the user, or wait again. It is absent when the wait condition was met and on a `timeoutMs: 0` check, which did not wait.
27
+
7
28
  ## [0.2.5] - 2026-10-21
8
29
 
9
30
  ### Added
@@ -137,7 +158,9 @@ All notable changes to murmur are documented here. The format follows [Keep a Ch
137
158
  - Limits: send rate, duplicate window, thread and inbox caps.
138
159
  - 283 tests at 100 percent lines and branches, and an end-to-end rig that replayed the live 3-peer scenario.
139
160
 
140
- [Unreleased]: https://github.com/rennf93/murmur/compare/v0.2.5...HEAD
161
+ [Unreleased]: https://github.com/rennf93/murmur/compare/v0.2.7...HEAD
162
+ [0.2.7]: https://github.com/rennf93/murmur/releases/tag/v0.2.7
163
+ [0.2.6]: https://github.com/rennf93/murmur/releases/tag/v0.2.6
141
164
  [0.2.5]: https://github.com/rennf93/murmur/releases/tag/v0.2.5
142
165
  [0.2.4]: https://github.com/rennf93/murmur/releases/tag/v0.2.4
143
166
  [0.2.3]: https://github.com/rennf93/murmur/releases/tag/v0.2.3
package/README.md CHANGED
@@ -90,7 +90,7 @@ Every hook, MCP server and CLI command walks up its process ancestors and takes
90
90
 
91
91
  ## Delivery truth table
92
92
 
93
- Delivery states, per recipient: `queued` (stored, nothing left the broker), `sent` (a transport accepted it), `delivered` (evidence from the receiving side), `acknowledged` (`murmur_ack`: seen, answer later), `replied`. `sent` is never reported as `delivered`.
93
+ Delivery states, per recipient: `queued` (stored, nothing left the broker), `sent` (a transport accepted it), `delivered` (evidence from the receiving side), `acknowledged` (`murmur_ack`, or a reply handed over in a `murmur_wait` result: seen, answer later), `replied`. `sent` is never reported as `delivered`.
94
94
 
95
95
  | CLI | Live push into a running session | Waiting messages also arrive | Evidence for `delivered` |
96
96
  | --- | --- | --- | --- |
@@ -103,19 +103,19 @@ Delivery states, per recipient: `queued` (stored, nothing left the broker), `sen
103
103
 
104
104
  Delivery modes: `push` (default) uses every path above; `notify` stores the message and sends a small batched note; `silent` only stores. A message for a session that is down stays `queued`; when that session comes back its queued messages are pushed (or handed over at its next hook) and the sender gets a `queued_delivered` note (not for a reply held for the asker's open `murmur_wait`: the wait result is its delivery, and the replier is not woken for it). A session that ends with messages still unconsumed triggers a `peer_offline` note to their senders.
105
105
 
106
- What a session sees for every message, on every path:
106
+ What a session sees for every message, on every path (a session without murmur tools, such as one reached only by hooks, also gets `from a shell: murmur reply 42 <text>; ` before `its replies`, since a shell is its only route):
107
107
 
108
108
  ```
109
109
  [murmur m42 t7 s0 from ledger-3 to archify-2, prs-5]
110
110
  <body, cut at 4000 characters with a pointer to the full text>
111
- (answer with murmur_reply messageId 42, plain text never reaches the sender; from a shell: murmur reply 42 <text>; its replies: murmur_thread 7 messageId 42)
111
+ (answer with murmur_reply messageId 42, plain text never reaches the sender; its replies: murmur_thread 7 messageId 42)
112
112
  ```
113
113
 
114
114
  ## Threads, groups, verdicts
115
115
 
116
116
  - One message, one id, fanned out. Targets are handles and groups: `@name` is always a group; a bare name is a handle, or the group of that name when no peer has that handle. Overlapping groups dedupe.
117
117
  - A reply is stored once in the thread and goes only to whoever is waiting for it (the author of the message it answers and the session an owner message was typed in), in the parent's mode; everyone in the thread can read it with `murmur_thread` / `murmur thread`, and `murmur_wait` returns the replies' text. `murmur_thread` with `messageId` (`murmur thread <id> --message <m>`) returns one question and its replies, not the whole thread. To consult several sessions, send once to all of them.
118
- - Every message has a per-thread monotonic `seq`. `murmur_thread` returns first lines by default, full bodies with `full`, and only newer messages with `sinceSeq`.
118
+ - Every message has a per-thread monotonic `seq`. `murmur_thread` returns first lines by default, full bodies with `full`, and only newer messages with `sinceSeq`; without `threadId` it lists the newest threads (`limit`, default 10, max 50) with participants, message count and the opening first line.
119
119
  - Verdicts: `agree`, `disagree`, `info` and `choice`, with the body starting `AGREE`, `DISAGREE`, `INFO` or `CHOICE <option>`. `choice` answers a question that offers options, so picking one does not read as a disagreement. `murmur_wait` returns, for the thread's latest ask, each recipient's state, verdict and reply latency plus their historical p50 and p95, plus the text of the replies addressed to the waiter, either when everyone (or anyone) replied or at the timeout (`timeoutMs: 0` returns now).
120
120
  - `references` carries pointers (paths, commits, URLs) so artifacts stay in their repos.
121
121
  - Groups: create, list, add, remove, delete. Deleting a group never touches sessions, threads or history.
@@ -129,13 +129,13 @@ The human surface, as the owner:
129
129
  - `/murmur <group | @group | handle[,more]> <message>`; bare `/murmur` lists peers and groups. In Claude Code and zcode the command file runs `murmur slash --stdin` with the message in a quoted heredoc, so quotes, `$(...)`, backticks and `;` arrive verbatim (Claude Code turns a word-initial `!` into `\!` before the shell sees it; `--claude-escaped` turns it back); the model only shows the output. Hummin's `/murmur` runs with no model turn at all.
130
130
  - `murmur send <targets> <body...> [--mode push|notify|silent] [--refs a,b] [--thread <id>] [--as <handle>]`
131
131
  - `murmur reply <id> <body...> [--verdict agree|disagree|info|choice] [--refs a,b] [--as <handle>]`
132
- - `murmur status`, `murmur thread <id> [--since <seq>] [--full] [--message <id>]`, `murmur groups [list|create|add|remove|delete] ...`, `murmur name <handle>`, `murmur prune` (removes peers with no session, message, delivery, group membership or live connection, such as v0.1 leftovers, and prints their handles)
132
+ - `murmur status`, `murmur thread [<id> [--since <seq>] [--full] [--message <id>]]` (no id lists the recent threads), `murmur groups [list|create|add|remove|delete] ...`, `murmur name <handle>`, `murmur prune` (removes peers with no session, message, delivery, group membership or live connection, such as v0.1 leftovers, and prints their handles)
133
133
 
134
134
  ## Limits
135
135
 
136
136
  - 20 sends per sender per 60 seconds; an identical send (sender, body, recipients) within 60 seconds is rejected as a duplicate. Replies count. In memory; reset on broker restart.
137
137
  - 500 messages per thread; 200 deliveries per recipient not yet proven delivered to its session (queued or sent); 1 MiB per request line.
138
- - `murmur_wait`: default 120 s, at most 300 s.
138
+ - `murmur_wait`: default 110 s, at most 300 s.
139
139
  - Hooks: 10 s hard deadline, up to 10 messages per pull, exit 0 on every failure path.
140
140
  - Transcript proof polls for 120 s after a push, then re-checks at that session's next hook event.
141
141
  - Notifications are batched per recipient over 60 seconds and are best effort.
@@ -385,13 +385,15 @@ export default function murmur(pi: ExtensionAPI): void {
385
385
  pi.registerTool({
386
386
  name: "murmur_thread",
387
387
  label: "Murmur Thread",
388
- description: "Read a murmur thread, as a digest or with full bodies.",
388
+ description: "Without threadId, list the newest murmur threads (limit, max 50). Else read a thread, as a digest or with full bodies.",
389
389
  parameters: Type.Object({
390
- threadId: Type.Number(),
390
+ threadId: Type.Optional(Type.Number()),
391
+ limit: Type.Optional(Type.Number()),
391
392
  sinceSeq: Type.Optional(Type.Number()),
392
393
  full: Type.Optional(Type.Boolean()),
393
394
  }),
394
395
  async execute(_id, p) {
396
+ if (p.threadId === undefined) return call({ type: "threads", ...(p.limit !== undefined ? { limit: p.limit } : {}) });
395
397
  return call({ type: "thread", threadId: p.threadId, sinceSeq: p.sinceSeq ?? null, full: p.full ?? false });
396
398
  },
397
399
  });
@@ -399,14 +401,14 @@ export default function murmur(pi: ExtensionAPI): void {
399
401
  pi.registerTool({
400
402
  name: "murmur_wait",
401
403
  label: "Murmur Wait",
402
- description: "Wait until all or any recipients of a thread have replied (default 120000 ms, max 300000, 0 returns now).",
404
+ description: "Wait until all or any recipients of a thread have replied (default 110000 ms, max 300000, 0 returns now).",
403
405
  parameters: Type.Object({
404
406
  threadId: Type.Number(),
405
407
  until: Type.Union([Type.Literal("all_replied"), Type.Literal("any_replied")]),
406
408
  timeoutMs: Type.Optional(Type.Number({ minimum: 0, maximum: 300_000 })),
407
409
  }),
408
410
  async execute(_id, p) {
409
- const timeoutMs = Math.min(p.timeoutMs ?? 120_000, 300_000);
411
+ const timeoutMs = Math.min(p.timeoutMs ?? 110_000, 300_000);
410
412
  return call({ type: "wait", threadId: p.threadId, until: p.until, timeoutMs }, timeoutMs + 10_000);
411
413
  },
412
414
  });
@@ -260,10 +260,12 @@ const plugin: Plugin = async ({ client, directory }) => {
260
260
  ctxCall({ type: 'reply', messageId: a.messageId, body: a.body, verdict: a.verdict, references: a.references }, ctx),
261
261
  }),
262
262
  murmur_thread: tool({
263
- description: 'Read a murmur thread, optionally only messages after a sequence number.',
264
- args: { threadId: s.number(), sinceSeq: s.number().optional(), full: s.boolean().optional() },
263
+ description: 'Without threadId, list the newest murmur threads (limit, max 50). Else read a thread, optionally only messages after a sequence number.',
264
+ args: { threadId: s.number().optional(), limit: s.number().optional(), sinceSeq: s.number().optional(), full: s.boolean().optional() },
265
265
  execute: (a, ctx) =>
266
- ctxCall({ type: 'thread', threadId: a.threadId, sinceSeq: a.sinceSeq ?? null, full: a.full ?? false }, ctx),
266
+ a.threadId === undefined
267
+ ? ctxCall({ type: 'threads', ...(a.limit !== undefined ? { limit: a.limit } : {}) }, ctx)
268
+ : ctxCall({ type: 'thread', threadId: a.threadId, sinceSeq: a.sinceSeq ?? null, full: a.full ?? false }, ctx),
267
269
  }),
268
270
  murmur_wait: tool({
269
271
  description: 'Wait until all or any recipients of a murmur thread have replied.',
@@ -273,7 +275,7 @@ const plugin: Plugin = async ({ client, directory }) => {
273
275
  timeoutMs: s.number().optional(),
274
276
  },
275
277
  execute: (a, ctx) => {
276
- const timeoutMs = Math.min(Math.max(a.timeoutMs ?? 120000, 0), 300000);
278
+ const timeoutMs = Math.min(Math.max(a.timeoutMs ?? 110000, 0), 300000);
277
279
  return ctxCall({ type: 'wait', threadId: a.threadId, until: a.until, timeoutMs }, ctx, timeoutMs + 10000);
278
280
  },
279
281
  }),
package/dist/broker.js CHANGED
@@ -6,7 +6,7 @@ import { fullOf } from './core.js';
6
6
  import { nativeSend } from './native.js';
7
7
  import { ProofWatcher } from './proof.js';
8
8
  import { defaultWake } from './wake.js';
9
- import { LineReader, MurmurError, NOTIFY_BATCH_MS, PROTOCOL_VERSION, WAIT_MAX_MS, encodeLine, renderDelivery, replyFooter, } from './protocol.js';
9
+ import { LineReader, MurmurError, NOTIFY_BATCH_MS, PROTOCOL_VERSION, THREADS_DEFAULT, THREADS_MAX, WAIT_MAX_MS, encodeLine, renderDelivery, replyFooter, } from './protocol.js';
10
10
  const CLIENT_KINDS = ['mcp', 'cli', 'hook', 'adapter'];
11
11
  const HOOK_EVENTS = ['session-start', 'prompt', 'stop', 'session-end'];
12
12
  const CLI_NAMES = ['claude', 'codex', 'gemini', 'zcode', 'opencode', 'hummin', 'other'];
@@ -141,6 +141,7 @@ export class Broker {
141
141
  this.core = opts.core;
142
142
  this.nativeSendFn = opts.nativeSend ?? nativeSend;
143
143
  this.wakeFn = opts.wake ?? defaultWake;
144
+ this.core.hasTools = (handle) => this.presence.has(handle);
144
145
  this.proof = new ProofWatcher((messageId, recipient) => this.onProof(messageId, recipient), opts.proofPollMs);
145
146
  }
146
147
  static async start(opts) {
@@ -395,6 +396,9 @@ export class Broker {
395
396
  case 'inbox':
396
397
  this.replyOk(conn.socket, id, this.handleInbox(conn, rec));
397
398
  return;
399
+ case 'threads':
400
+ this.replyOk(conn.socket, id, this.handleThreads(rec));
401
+ return;
398
402
  case 'thread':
399
403
  this.replyOk(conn.socket, id, this.handleThread(rec));
400
404
  return;
@@ -681,6 +685,13 @@ export class Broker {
681
685
  const messageId = rec.messageId === undefined ? undefined : reqNumber(rec, 'messageId');
682
686
  return this.core.threadView(threadId, sinceSeq, reqBool(rec, 'full'), messageId);
683
687
  }
688
+ handleThreads(rec) {
689
+ const limit = rec.limit === undefined ? THREADS_DEFAULT : reqNumber(rec, 'limit');
690
+ if (!Number.isInteger(limit) || limit < 1) {
691
+ throw badRequest('limit must be a positive integer');
692
+ }
693
+ return this.core.threadList(Math.min(limit, THREADS_MAX));
694
+ }
684
695
  handleCollect(rec) {
685
696
  const threadId = reqNumber(rec, 'threadId');
686
697
  return this.core.collect(threadId);
@@ -822,8 +833,9 @@ export class Broker {
822
833
  }
823
834
  const recipients = this.store.getDeliveries(message.id).map((d) => d.recipient);
824
835
  const full = fullOf(message);
825
- const text = renderDelivery(full, message.deliveredBody, recipients);
826
- await this.pushOne(message.id, message.threadId, handle, text, { message: full, mode: 'push', footer: replyFooter(full), text });
836
+ const shell = !this.presence.has(handle);
837
+ const text = renderDelivery(full, message.deliveredBody, recipients, shell);
838
+ await this.pushOne(message.id, message.threadId, handle, text, { message: full, mode: 'push', footer: replyFooter(full, shell), text });
827
839
  }
828
840
  }
829
841
  liveSessionOf(handle) {
@@ -962,6 +974,7 @@ export class Broker {
962
974
  threadId,
963
975
  until,
964
976
  held: new Set(),
977
+ snapshot: timeoutMs === 0,
965
978
  timer: setTimeout(() => this.resolveTimedOut(waiter), timeoutMs),
966
979
  };
967
980
  conn.waiters.add(waiter);
@@ -1000,6 +1013,8 @@ export class Broker {
1000
1013
  // A reply held for this wait never waited on a session that was down:
1001
1014
  // no queued_delivered notice, which would wake the replier for nothing.
1002
1015
  this.markDeliveredHop(row.id, delivery.recipient, held?.has(row.id) !== true);
1016
+ // The wait result is the asker's reading: seen, not unread.
1017
+ this.store.markAcked(row.id, delivery.recipient, Date.now());
1003
1018
  replies.push({ id: row.id, seq: row.seq, sender: row.sender, verdict: row.verdict, body: row.deliveredBody });
1004
1019
  }
1005
1020
  }
@@ -1052,11 +1067,14 @@ export class Broker {
1052
1067
  return;
1053
1068
  }
1054
1069
  try {
1070
+ const matrix = this.matrixFor(waiter.threadId);
1071
+ const note = waiter.snapshot ? null : timeoutNote(matrix);
1055
1072
  this.replyOk(waiter.conn.socket, waiter.id, {
1056
1073
  threadId: waiter.threadId,
1057
1074
  conditionMet: false,
1058
1075
  timedOut: true,
1059
- matrix: this.matrixFor(waiter.threadId),
1076
+ matrix,
1077
+ ...(note === null ? {} : { note }),
1060
1078
  replies: this.takeReplies(waiter.threadId, waiter.conn.handle, waiter.held),
1061
1079
  });
1062
1080
  }
@@ -1171,3 +1189,23 @@ async function clearStaleSocket(socketPath) {
1171
1189
  }
1172
1190
  unlinkSync(socketPath);
1173
1191
  }
1192
+ // What a timed-out asker is told: who has the message but is silent, whose receipt
1193
+ // is unproven (queued or sent), and not to start work that could overlap theirs.
1194
+ // Null when everyone replied.
1195
+ function timeoutNote(matrix) {
1196
+ const names = (states) => matrix.filter((m) => states.includes(m.state)).map((m) => m.recipient);
1197
+ const silent = names(['delivered', 'acknowledged']);
1198
+ const unreached = names(['queued', 'sent']);
1199
+ const clauses = [];
1200
+ if (silent.length > 0) {
1201
+ const v = silent.length > 1 ? 'have' : 'has';
1202
+ clauses.push(`${silent.join(', ')} ${v} the message but ${v} not replied`);
1203
+ }
1204
+ if (unreached.length > 0) {
1205
+ clauses.push(`${unreached.join(', ')} ${unreached.length > 1 ? 'have' : 'has'} not confirmed receipt`);
1206
+ }
1207
+ if (clauses.length === 0) {
1208
+ return null;
1209
+ }
1210
+ return `timed out: ${clauses.join('; ')}. Do not start work that could overlap theirs: ask the user, or murmur_wait again.`;
1211
+ }
package/dist/cli.js CHANGED
@@ -11,7 +11,7 @@ const OWNER_DISPLAY = 'renn (owner)';
11
11
  const SEND_USAGE = 'usage: murmur send <targets> <body...> [--as <handle>] [--mode <mode>] [--refs <a,b>] [--thread <id>]';
12
12
  const REPLY_USAGE = 'usage: murmur reply <message id> <body...> [--as <handle>] [--verdict agree|disagree|info|choice] [--refs <a,b>]';
13
13
  const NAME_USAGE = 'usage: murmur name <handle> (renames the agent session this runs in)';
14
- const THREAD_USAGE = 'usage: murmur thread <id> [--since <n>] [--full] [--message <id>]';
14
+ const THREAD_USAGE = 'usage: murmur thread [<id> [--since <n>] [--full] [--message <id>]] (no id lists recent threads)';
15
15
  const GROUPS_USAGE = 'usage: murmur groups [list] | groups create <name> | groups add <name> <members...> | groups remove <name> <members...> | groups delete <name>';
16
16
  const SLASH_USAGE = '/murmur <group | handle[,more]> <message> (sent as renn, via the session you type it in; run bare like this for peers and groups)';
17
17
  export async function runCli(argv, io) {
@@ -95,7 +95,7 @@ function printUsage(err) {
95
95
  ' slash [args...] the /murmur backing, sent as the owner via your session; bare prints peers and groups',
96
96
  ' prune remove peers with no session, message, group or connection',
97
97
  ' status list peers with presence and unread counts',
98
- ' thread <id> [--since <n>] [--full] [--message <id>]',
98
+ ' thread [<id> [--since <n>] [--full] [--message <id>]] no id lists recent threads',
99
99
  ' groups [list] | groups create <name> | groups add <name> <members...>',
100
100
  ' | groups remove <name> <members...> | groups delete <name>',
101
101
  ' install <' + INSTALL_CLIENTS.join('|') + '>',
@@ -469,6 +469,20 @@ async function cmdThread(args, out, err) {
469
469
  positionals.push(arg);
470
470
  }
471
471
  const idArg = positionals[0];
472
+ if (idArg === undefined && !full && sinceSeq === null && messageId === undefined) {
473
+ const client = await connectCli();
474
+ try {
475
+ const list = { type: 'threads' };
476
+ for (const t of await client.request(list)) {
477
+ out('t' + String(t.threadId) + ' s' + String(t.latestSeq) + ' ' + new Date(t.lastAt).toISOString() + ' ' +
478
+ t.participants.join(',') + ' ' + String(t.messages) + ' ' + t.first + '\n');
479
+ }
480
+ return 0;
481
+ }
482
+ finally {
483
+ client.close();
484
+ }
485
+ }
472
486
  if (idArg === undefined) {
473
487
  err('murmur thread: missing thread id\n' + THREAD_USAGE + '\n');
474
488
  return 1;
package/dist/core.js CHANGED
@@ -115,6 +115,8 @@ export class MurmurCore {
115
115
  // tracked here for the process lifetime and status() falls back to the
116
116
  // persisted row values when no override exists.
117
117
  hookOverrides = new Map();
118
+ // Set by the broker: does the handle have a live mcp or adapter connection.
119
+ hasTools = () => false;
118
120
  // Process table source for session liveness, asked only for the pids that
119
121
  // matter; injectable for tests.
120
122
  procTable;
@@ -273,15 +275,16 @@ export class MurmurCore {
273
275
  }
274
276
  pushesFor(row, recipients, mode) {
275
277
  const message = fullOf(row);
276
- const footer = replyFooter(message);
277
- const text = renderDelivery(message, row.deliveredBody, recipients);
278
- return recipients.map((recipient) => ({
279
- recipient,
280
- kind: this.pushKindFor(recipient, mode),
281
- message,
282
- footer,
283
- text,
284
- }));
278
+ return recipients.map((recipient) => {
279
+ const shell = !this.hasTools(recipient);
280
+ return {
281
+ recipient,
282
+ kind: this.pushKindFor(recipient, mode),
283
+ message,
284
+ footer: replyFooter(message, shell),
285
+ text: renderDelivery(message, row.deliveredBody, recipients, shell),
286
+ };
287
+ });
285
288
  }
286
289
  // Native transport row means the broker can hand the message to the
287
290
  // recipient's own messaging socket; otherwise a push still travels over
@@ -433,6 +436,9 @@ export class MurmurCore {
433
436
  threads.sort((a, b) => b.latestSeq - a.latestSeq);
434
437
  return { handle, unreadTotal, threads };
435
438
  }
439
+ threadList(limit) {
440
+ return this.store.threadList(limit).map(({ firstBody, ...t }) => ({ ...t, first: firstLine(firstBody).slice(0, 100) }));
441
+ }
436
442
  threadView(threadId, sinceSeq, full = true, messageId) {
437
443
  const all = this.store.threadMessages(threadId, null);
438
444
  if (all.length === 0) {
@@ -844,7 +850,7 @@ export class MurmurCore {
844
850
  this.events.onStateChange({ threadId: row.threadId, recipient: handle, from: 'queued', to: 'delivered' });
845
851
  const message = fullOf(row);
846
852
  messages.push(message);
847
- texts.push(renderDelivery(message, row.deliveredBody, this.store.getDeliveries(row.id).map((d) => d.recipient)));
853
+ texts.push(renderDelivery(message, row.deliveredBody, this.store.getDeliveries(row.id).map((d) => d.recipient), !this.hasTools(handle)));
848
854
  }
849
855
  return { messages, texts };
850
856
  }
package/dist/mcp.js CHANGED
@@ -129,14 +129,19 @@ export function buildMcpServer(client, identity = {}) {
129
129
  });
130
130
  server.registerTool('murmur_thread', {
131
131
  _meta: META,
132
- description: 'Read a thread: first lines by default, full bodies with full, only newer than sinceSeq. With messageId, only that message and the replies to it (the question you care about), full bodies.',
132
+ description: 'Without threadId, list the newest threads (limit, max 50). Else read a thread: first lines by default, full bodies with full, only newer than sinceSeq. With messageId, only that message and the replies to it (the question you care about), full bodies.',
133
133
  inputSchema: {
134
- threadId: z.number().int(),
134
+ threadId: z.number().int().optional(),
135
+ limit: z.number().int().optional(),
135
136
  sinceSeq: z.number().int().optional(),
136
137
  full: z.boolean().optional(),
137
138
  messageId: z.number().int().optional(),
138
139
  },
139
140
  }, async (args) => {
141
+ if (args.threadId === undefined) {
142
+ const list = { type: 'threads', ...(args.limit !== undefined ? { limit: args.limit } : {}) };
143
+ return textResult(await client.request(list));
144
+ }
140
145
  const msg = {
141
146
  type: 'thread',
142
147
  threadId: args.threadId,
@@ -148,7 +153,7 @@ export function buildMcpServer(client, identity = {}) {
148
153
  });
149
154
  server.registerTool('murmur_wait', {
150
155
  _meta: META,
151
- description: 'Who got, read and answered the latest ask, with verdicts and latencies, plus the text of the replies addressed to you. Waits until all_replied or any_replied, up to timeoutMs (default 120000, max 300000; 0 returns now).',
156
+ description: 'Who got, read and answered the latest ask, with verdicts and latencies, plus the text of the replies addressed to you. Waits until all_replied or any_replied, up to timeoutMs (default 110000, max 300000; 0 returns now).',
152
157
  inputSchema: {
153
158
  threadId: z.number().int(),
154
159
  until: z.enum(['all_replied', 'any_replied']),
package/dist/protocol.js CHANGED
@@ -9,12 +9,14 @@ export const THREAD_CAP = 500;
9
9
  export const UNREAD_CAP = 200;
10
10
  export const NOTIFY_BATCH_MS = 60000;
11
11
  export const WAIT_MAX_MS = 300000;
12
- export const WAIT_DEFAULT_MS = 120000;
12
+ export const WAIT_DEFAULT_MS = 110000;
13
13
  export const FIRST_LINE_MAX = 120;
14
14
  export const HANDLE_RE = /^[a-z0-9][a-z0-9-]{1,47}$/;
15
15
  // How long the broker keeps polling a receiver's transcript for proof after
16
16
  // a push; later hook events of that session re-check without a deadline.
17
17
  export const PROOF_POLL_MS = 120000;
18
+ export const THREADS_DEFAULT = 10;
19
+ export const THREADS_MAX = 50;
18
20
  export class MurmurError extends Error {
19
21
  code;
20
22
  constructor(code, message) {
@@ -71,14 +73,16 @@ export function newToken() {
71
73
  export function deliveryTag(messageId) {
72
74
  return '[murmur m' + String(messageId) + ' ';
73
75
  }
74
- export function replyFooter(m) {
75
- return ('(answer with murmur_reply messageId ' + String(m.id) + ', plain text never reaches the sender; from a shell: murmur reply ' +
76
- String(m.id) + ' <text>; its replies: murmur_thread ' + String(m.threadId) + ' messageId ' + String(m.id) + ')');
76
+ // shell is false for a recipient with murmur tools: Codex's sandbox blocks the
77
+ // socket the shell route needs, so it only offers the tools.
78
+ export function replyFooter(m, shell = true) {
79
+ return ('(answer with murmur_reply messageId ' + String(m.id) + ', plain text never reaches the sender; ' +
80
+ (shell ? 'from a shell: murmur reply ' + String(m.id) + ' <text>; ' : '') + 'its replies: murmur_thread ' + String(m.threadId) + ' messageId ' + String(m.id) + ')');
77
81
  }
78
82
  // What a session sees for one message, on every transport: a tag line with
79
83
  // ids, sender and recipients, the (possibly truncated) body, references, and
80
84
  // how to reply.
81
- export function renderDelivery(m, deliveredBody, recipients) {
85
+ export function renderDelivery(m, deliveredBody, recipients, shell = true) {
82
86
  let head = deliveryTag(m.id) + 't' + String(m.threadId) + ' s' + String(m.seq) + ' from ' + m.sender;
83
87
  if (m.via !== null) {
84
88
  head += ' via ' + m.via;
@@ -91,5 +95,5 @@ export function renderDelivery(m, deliveredBody, recipients) {
91
95
  }
92
96
  head += ' to ' + recipients.join(', ') + ']';
93
97
  const refs = m.references.length > 0 ? '\nrefs: ' + m.references.join(', ') : '';
94
- return head + '\n' + deliveredBody + refs + '\n' + replyFooter(m);
98
+ return head + '\n' + deliveredBody + refs + '\n' + replyFooter(m, shell);
95
99
  }
package/dist/store.js CHANGED
@@ -350,6 +350,25 @@ export class Store {
350
350
  .get(threadId);
351
351
  return rec === undefined ? null : toMessageRow(rec);
352
352
  }
353
+ // Most recently active threads first. Participants are every sender and
354
+ // every recipient; first is the body of the opening message.
355
+ threadList(limit) {
356
+ const recs = this.stmt('SELECT thread_id, MAX(seq) AS latest_seq, MAX(created_at) AS last_at, COUNT(*) AS n ' +
357
+ 'FROM messages GROUP BY thread_id ORDER BY last_at DESC, thread_id DESC LIMIT ?').all(limit);
358
+ return recs.map((r) => {
359
+ const people = this.stmt('SELECT sender AS handle FROM messages WHERE thread_id = ? UNION ' +
360
+ 'SELECT d.recipient FROM deliveries d JOIN messages m ON m.id = d.message_id WHERE m.thread_id = ? ORDER BY 1').all(r.thread_id, r.thread_id);
361
+ const opening = this.stmt('SELECT body FROM messages WHERE thread_id = ? AND seq = 0').get(r.thread_id);
362
+ return {
363
+ threadId: r.thread_id,
364
+ latestSeq: r.latest_seq,
365
+ lastAt: r.last_at,
366
+ messages: r.n,
367
+ participants: people.map((p) => p.handle),
368
+ firstBody: opening.body,
369
+ };
370
+ });
371
+ }
353
372
  messageById(id) {
354
373
  const rec = this.stmt('SELECT * FROM messages WHERE id = ?').get(id);
355
374
  return rec === undefined ? null : toMessageRow(rec);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "murmur-it",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "Local, client-agnostic message bus for AI CLI sessions with group threads",
5
5
  "license": "MIT",
6
6
  "author": "Renn F",