murmur-it 0.2.3 → 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/CHANGELOG.md +17 -0
- package/README.md +3 -3
- package/dist/broker.js +12 -9
- package/dist/client.js +4 -6
- package/dist/core.js +7 -3
- package/dist/native.js +2 -5
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to murmur are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses [Semantic Versioning](https://semver.org/).
|
|
4
4
|
|
|
5
|
+
## [0.2.4] - 2026-10-21
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Requires Node 22 or newer (`engines` was `>=20`). Node 20 reached end of life on 2026-04-30, and vitest 5 needs Node 22.12 to run the tests, so CI now runs on Node 22 and 24 instead of 20 and 22.
|
|
10
|
+
- Dependencies: zod 4 (runtime), and for development TypeScript 7, `@types/node` 26, vitest and `@vitest/coverage-v8` 5 and `actions/setup-node` 7.1.0.
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- One reply that resolves two waits on the same thread answers each wait once. Before, handing over the first wait's replies re-entered the waiter check, which answered the second wait, and the outer loop then answered it again from its stale copy (`src/broker.ts` `checkWaiters`).
|
|
15
|
+
- A reply held for the asker's open `murmur_wait` no longer sends the replier a `queued_delivered` note when the wait hands it over. The note reached the replier as a new turn (a live check woke the replying session a second time for it) although nothing had waited on a session that was down. A reply that was not held for the wait, for example one that stayed queued while the asker's session was closed, still sends the note when a later wait hands it over.
|
|
16
|
+
- The 200 inbox cap (`cap_inbox`) counts only deliveries not yet proven delivered to the recipient's session (queued or sent). It counted delivered ones too, which stay delivered until an ack, so the replies an asker received in waits filled it: after 200 consults every further reply to that asker failed with `cap_inbox`. The unread count in status and inbox is unchanged.
|
|
17
|
+
|
|
18
|
+
### Security
|
|
19
|
+
|
|
20
|
+
- vitest 5 drops the vulnerable test-only dependencies `npm audit` reported (tinypool GHSA-5gmw-xhrv-c9v3 and GHSA-85c8-ppgw-ccpr, critical; vitest and `@vitest/mocker` GHSA-82fw-gwwq-j7x9, moderate). The published package was not affected: `npm audit --omit=dev` found nothing.
|
|
21
|
+
|
|
5
22
|
## [0.2.3] - 2026-10-20
|
|
6
23
|
|
|
7
24
|
### Changed
|
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ This is a CLI demo with simulated peers: `alice` and `bob` are registered by a h
|
|
|
26
26
|
|
|
27
27
|
## Quickstart
|
|
28
28
|
|
|
29
|
-
Requires Node
|
|
29
|
+
Requires Node 22 or newer.
|
|
30
30
|
|
|
31
31
|
```
|
|
32
32
|
npm install -g murmur-it # the package is murmur-it; the command it installs is murmur
|
|
@@ -101,7 +101,7 @@ Delivery states, per recipient: `queued` (stored, nothing left the broker), `sen
|
|
|
101
101
|
| [Gemini CLI](https://github.com/google-gemini/gemini-cli) | None: Gemini has no inbound channel | At SessionStart, each prompt (BeforeAgent), and at turn end (AfterAgent continues the turn) | Handed over by the hook |
|
|
102
102
|
| [zcode](https://zcode.z.ai) | None found | At SessionStart, each prompt, and at turn end (Stop continues the turn) | Handed over by the hook (zcode's hook `transcript_path` is a temporary copy, so it cannot serve as proof) |
|
|
103
103
|
|
|
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. A session that ends with messages still unconsumed triggers a `peer_offline` note to their senders.
|
|
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
106
|
What a session sees for every message, on every path:
|
|
107
107
|
|
|
@@ -134,7 +134,7 @@ The human surface, as the owner:
|
|
|
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
|
-
- 500 messages per thread; 200
|
|
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
138
|
- `murmur_wait`: default 120 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.
|
package/dist/broker.js
CHANGED
|
@@ -844,14 +844,14 @@ export class Broker {
|
|
|
844
844
|
}
|
|
845
845
|
// queued or sent to delivered, with the queued_delivered notice to the
|
|
846
846
|
// sender when the message had been waiting. False when not applicable.
|
|
847
|
-
markDeliveredHop(messageId, recipient) {
|
|
847
|
+
markDeliveredHop(messageId, recipient, notifySender = true) {
|
|
848
848
|
const message = this.store.messageById(messageId);
|
|
849
849
|
const delivery = this.store.getDeliveries(messageId).find((d) => d.recipient === recipient);
|
|
850
850
|
if (message === null || delivery === undefined || (delivery.state !== 'queued' && delivery.state !== 'sent')) {
|
|
851
851
|
return false;
|
|
852
852
|
}
|
|
853
853
|
this.store.markDelivered(messageId, recipient, Date.now());
|
|
854
|
-
if (delivery.state === 'queued') {
|
|
854
|
+
if (delivery.state === 'queued' && notifySender) {
|
|
855
855
|
this.enqueueNotification(message.sender, {
|
|
856
856
|
kind: 'queued_delivered',
|
|
857
857
|
threadId: message.threadId,
|
|
@@ -997,7 +997,9 @@ export class Broker {
|
|
|
997
997
|
for (const row of this.store.threadMessages(threadId, null)) {
|
|
998
998
|
const delivery = this.store.getDeliveries(row.id).find((d) => d.recipient === handle);
|
|
999
999
|
if (((ask !== null && row.inReplyTo === ask.id) || held?.has(row.id) === true) && delivery?.state === 'queued' && !this.inFlight.has(String(row.id) + ':' + delivery.recipient)) {
|
|
1000
|
-
this
|
|
1000
|
+
// A reply held for this wait never waited on a session that was down:
|
|
1001
|
+
// no queued_delivered notice, which would wake the replier for nothing.
|
|
1002
|
+
this.markDeliveredHop(row.id, delivery.recipient, held?.has(row.id) !== true);
|
|
1001
1003
|
replies.push({ id: row.id, seq: row.seq, sender: row.sender, verdict: row.verdict, body: row.deliveredBody });
|
|
1002
1004
|
}
|
|
1003
1005
|
}
|
|
@@ -1029,7 +1031,8 @@ export class Broker {
|
|
|
1029
1031
|
if (this.stopped) {
|
|
1030
1032
|
return;
|
|
1031
1033
|
}
|
|
1032
|
-
|
|
1034
|
+
// A handover below re-enters checkWaiters and may already have answered this waiter.
|
|
1035
|
+
if (!set.has(waiter) || !this.conditionHolds(threadId, waiter.until)) {
|
|
1033
1036
|
continue;
|
|
1034
1037
|
}
|
|
1035
1038
|
this.removeWaiter(waiter);
|
|
@@ -1061,13 +1064,13 @@ export class Broker {
|
|
|
1061
1064
|
// Never let a timer callback crash the process.
|
|
1062
1065
|
}
|
|
1063
1066
|
}
|
|
1067
|
+
// Only called for a registered waiter: checkWaiters checks set.has, a close
|
|
1068
|
+
// walks conn.waiters, and a timeout fires only while the timer was never cleared.
|
|
1064
1069
|
removeWaiter(waiter) {
|
|
1065
1070
|
const set = this.waiters.get(waiter.threadId);
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
this.waiters.delete(waiter.threadId);
|
|
1070
|
-
}
|
|
1071
|
+
set.delete(waiter);
|
|
1072
|
+
if (set.size === 0) {
|
|
1073
|
+
this.waiters.delete(waiter.threadId);
|
|
1071
1074
|
}
|
|
1072
1075
|
waiter.conn.waiters.delete(waiter);
|
|
1073
1076
|
}
|
package/dist/client.js
CHANGED
|
@@ -35,24 +35,22 @@ export class MurmurClient {
|
|
|
35
35
|
const socket = createConnection(opts.socketPath);
|
|
36
36
|
return new Promise((resolve, reject) => {
|
|
37
37
|
let settled = false;
|
|
38
|
-
let timer = null;
|
|
39
38
|
const finish = (err, client) => {
|
|
40
39
|
if (settled) {
|
|
41
40
|
return;
|
|
42
41
|
}
|
|
43
42
|
settled = true;
|
|
44
|
-
|
|
45
|
-
clearTimeout(timer);
|
|
46
|
-
}
|
|
43
|
+
clearTimeout(timer);
|
|
47
44
|
if (err !== null) {
|
|
48
45
|
socket.destroy();
|
|
49
46
|
reject(err);
|
|
50
47
|
}
|
|
51
|
-
else
|
|
48
|
+
else {
|
|
49
|
+
// Every caller passes exactly one of err and client.
|
|
52
50
|
resolve(client);
|
|
53
51
|
}
|
|
54
52
|
};
|
|
55
|
-
timer = setTimeout(() => {
|
|
53
|
+
const timer = setTimeout(() => {
|
|
56
54
|
finish(new MurmurError('broker_down', 'connect to ' + opts.socketPath + ' timed out after ' + String(timeoutMs) + 'ms'), null);
|
|
57
55
|
}, timeoutMs);
|
|
58
56
|
socket.once('error', (err) => {
|
package/dist/core.js
CHANGED
|
@@ -5,6 +5,10 @@ export { HANDLE_RE };
|
|
|
5
5
|
const GROUP_NAME_RE = /^@?[a-z0-9][a-z0-9-]{1,31}$/;
|
|
6
6
|
const VERDICTS = ['agree', 'disagree', 'info'];
|
|
7
7
|
const UNREAD_STATES = ['queued', 'sent', 'delivered'];
|
|
8
|
+
// The inbox cap guards the backlog not yet proven in the session: a
|
|
9
|
+
// delivered message is in the session, and counting it would let replies that
|
|
10
|
+
// are never acked fill the cap and block every later reply to the asker.
|
|
11
|
+
const BACKLOG_STATES = ['queued', 'sent'];
|
|
8
12
|
const OFFLINE_AFTER_MS = 5 * 60 * 1000;
|
|
9
13
|
// A session title as a handle: lowercase, runs of anything else become one
|
|
10
14
|
// hyphen, trimmed, cut to the handle limit. Not necessarily a valid handle.
|
|
@@ -215,9 +219,9 @@ export class MurmurCore {
|
|
|
215
219
|
throw new MurmurError('cap_thread', 'thread ' + String(threadId) + ' already holds ' + String(THREAD_CAP) + ' messages');
|
|
216
220
|
}
|
|
217
221
|
for (const recipient of recipients) {
|
|
218
|
-
const
|
|
219
|
-
if (
|
|
220
|
-
throw new MurmurError('cap_inbox', 'recipient ' + recipient + ' already has ' + String(
|
|
222
|
+
const backlog = this.store.deliveryStatesForRecipient(recipient, BACKLOG_STATES);
|
|
223
|
+
if (backlog >= UNREAD_CAP) {
|
|
224
|
+
throw new MurmurError('cap_inbox', 'recipient ' + recipient + ' already has ' + String(backlog) + ' deliveries waiting (queued or sent)');
|
|
221
225
|
}
|
|
222
226
|
}
|
|
223
227
|
recent.push(ts);
|
package/dist/native.js
CHANGED
|
@@ -31,19 +31,16 @@ export async function nativeSend(socketPath, token, text, timeoutMs) {
|
|
|
31
31
|
const reader = new LineReader();
|
|
32
32
|
let settled = false;
|
|
33
33
|
let lastSocketError = null;
|
|
34
|
-
let timer = null;
|
|
35
34
|
const finish = (result) => {
|
|
36
35
|
if (settled) {
|
|
37
36
|
return;
|
|
38
37
|
}
|
|
39
38
|
settled = true;
|
|
40
|
-
|
|
41
|
-
clearTimeout(timer);
|
|
42
|
-
}
|
|
39
|
+
clearTimeout(timer);
|
|
43
40
|
socket.destroy();
|
|
44
41
|
resolve(result);
|
|
45
42
|
};
|
|
46
|
-
timer = setTimeout(() => {
|
|
43
|
+
const timer = setTimeout(() => {
|
|
47
44
|
finish({ ok: false, error: 'no reply or close from ' + socketPath + ' within ' + String(limit) + 'ms' });
|
|
48
45
|
}, limit);
|
|
49
46
|
socket.once('error', (err) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "murmur-it",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Local, client-agnostic message bus for AI CLI sessions with group threads",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Renn F",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"CHANGELOG.md"
|
|
38
38
|
],
|
|
39
39
|
"engines": {
|
|
40
|
-
"node": ">=
|
|
40
|
+
"node": ">=22"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
@@ -51,14 +51,14 @@
|
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
53
53
|
"better-sqlite3": "^12.2.0",
|
|
54
|
-
"zod": "^
|
|
54
|
+
"zod": "^4.6.7"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/better-sqlite3": "^7.6.13",
|
|
58
|
-
"@types/node": "^
|
|
59
|
-
"@vitest/coverage-v8": "^
|
|
58
|
+
"@types/node": "^26.6.5",
|
|
59
|
+
"@vitest/coverage-v8": "^5.0.5",
|
|
60
60
|
"tsx": "^4.20.0",
|
|
61
|
-
"typescript": "^
|
|
62
|
-
"vitest": "^
|
|
61
|
+
"typescript": "^7.0.2",
|
|
62
|
+
"vitest": "^5.0.5"
|
|
63
63
|
}
|
|
64
64
|
}
|