@cello-protocol/daemon 0.0.31 → 0.0.32
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/dist/daemon.d.ts.map +1 -1
- package/dist/daemon.js +30 -0
- package/dist/daemon.js.map +1 -1
- package/dist/notification-dispatcher.d.ts +7 -0
- package/dist/notification-dispatcher.d.ts.map +1 -1
- package/dist/notification-dispatcher.js +22 -0
- package/dist/notification-dispatcher.js.map +1 -1
- package/dist/session-ceremony.d.ts.map +1 -1
- package/dist/session-ceremony.js +15 -4
- package/dist/session-ceremony.js.map +1 -1
- package/dist/session-node-manager.d.ts +5 -0
- package/dist/session-node-manager.d.ts.map +1 -1
- package/dist/session-node-manager.js +32 -3
- package/dist/session-node-manager.js.map +1 -1
- package/package.json +3 -3
package/dist/daemon.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["../src/daemon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAKH,OAAO,KAAK,EACV,YAAY,EACZ,oBAAoB,EASrB,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAM/D,OAAO,EAAoD,KAAK,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAsB7G,OAAO,KAAK,EAAE,kBAAkB,EAA+C,MAAM,yBAAyB,CAAC;AAO/G,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAC;AA0InF,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,SAAS,IAAI,oBAAoB,CAAC;IAClC;;;;OAIG;IACH,qBAAqB,IAAI,kBAAkB,CAAC;IAC5C;;;;;;;;OAQG;IACH,gBAAgB,IAAI,SAAS,GAAG,IAAI,CAAC;IACrC;;;;OAIG;IACH,oBAAoB,IAAI,kBAAkB,CAAC;IAC3C;;;OAGG;IACH,iBAAiB,IAAI,eAAe,CAAC;CACtC;AAyCD,wBAAsB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["../src/daemon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAKH,OAAO,KAAK,EACV,YAAY,EACZ,oBAAoB,EASrB,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAM/D,OAAO,EAAoD,KAAK,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAsB7G,OAAO,KAAK,EAAE,kBAAkB,EAA+C,MAAM,yBAAyB,CAAC;AAO/G,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAC;AA0InF,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,SAAS,IAAI,oBAAoB,CAAC;IAClC;;;;OAIG;IACH,qBAAqB,IAAI,kBAAkB,CAAC;IAC5C;;;;;;;;OAQG;IACH,gBAAgB,IAAI,SAAS,GAAG,IAAI,CAAC;IACrC;;;;OAIG;IACH,oBAAoB,IAAI,kBAAkB,CAAC;IAC3C;;;OAGG;IACH,iBAAiB,IAAI,eAAe,CAAC;CACtC;AAyCD,wBAAsB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CA0wJ7E"}
|
package/dist/daemon.js
CHANGED
|
@@ -4418,6 +4418,30 @@ export async function startDaemon(config) {
|
|
|
4418
4418
|
if (record.agent_name !== agentName) {
|
|
4419
4419
|
return { ok: false, reason: "session_not_owned", guidance: "This session belongs to a different agent. Call cello_use_agent to switch to the agent that owns it, then retry." };
|
|
4420
4420
|
}
|
|
4421
|
+
// M8C-SINCESEQ-1: stateless catch-up. When since_seq is provided, return a BATCH of received
|
|
4422
|
+
// transcript messages with sequence > since_seq (durable transcript, not the ephemeral buffer —
|
|
4423
|
+
// so concurrent arrivals don't shift what a given since_seq returns; no replay race). Replaces
|
|
4424
|
+
// the cello_get_transcript workaround for away-then-return. Received-direction only (the messages
|
|
4425
|
+
// you'd have gotten live). Advances the read watermark (delivery marks read — clears INBOX
|
|
4426
|
+
// unread). A distinct early branch: the plain (no since_seq) receive is entirely unchanged.
|
|
4427
|
+
const rawSince = params?.since_seq;
|
|
4428
|
+
if (typeof rawSince === "number" && Number.isFinite(rawSince)) {
|
|
4429
|
+
const sinceSeq = rawSince;
|
|
4430
|
+
const from = record.counterparty_pubkey;
|
|
4431
|
+
const { messages } = sessionNodeManager.readTranscript(agentName, sessionId);
|
|
4432
|
+
const received = messages.filter((m) => m.direction === "received" && m.sequence > sinceSeq);
|
|
4433
|
+
if (received.length > 0) {
|
|
4434
|
+
// readTranscript is ordered by sequence ASC → the last is the max.
|
|
4435
|
+
sessionNodeManager.advanceLastDeliveredSeq(agentName, sessionId, received[received.length - 1].sequence);
|
|
4436
|
+
}
|
|
4437
|
+
logger.info("session.receive.since_seq", { sessionId, agentName, since_seq: sinceSeq, count: received.length });
|
|
4438
|
+
return {
|
|
4439
|
+
ok: true,
|
|
4440
|
+
since_seq: sinceSeq,
|
|
4441
|
+
count: received.length,
|
|
4442
|
+
messages: received.map((m) => ({ sequence: m.sequence, content: m.text, from })),
|
|
4443
|
+
};
|
|
4444
|
+
}
|
|
4421
4445
|
const rawTimeout = params?.timeout_ms;
|
|
4422
4446
|
const timeoutMs = typeof rawTimeout === "number" && Number.isFinite(rawTimeout) && rawTimeout >= 0
|
|
4423
4447
|
? rawTimeout
|
|
@@ -4551,6 +4575,12 @@ export async function startDaemon(config) {
|
|
|
4551
4575
|
sessionNodeManager.setOnSessionStateChanged((agentName, sessionId, state, counterpartyPubkey) => {
|
|
4552
4576
|
notificationDispatcher.dispatchSessionStateChanged(agentName, sessionId, state, counterpartyPubkey);
|
|
4553
4577
|
});
|
|
4578
|
+
// M8C-MSGWAKE-1 (channel stage 2): per-message wake — a verified inbound message fires a
|
|
4579
|
+
// content-free `cello_message` doorbell to the current-agent connection(s). The shim's generic
|
|
4580
|
+
// bridge (WAKE) forwards it to a live --channels session as notifications/claude/channel.
|
|
4581
|
+
sessionNodeManager.setOnContentArrived((agentName, sessionId, senderPubkey) => {
|
|
4582
|
+
notificationDispatcher.dispatchCelloMessage(agentName, sessionId, senderPubkey);
|
|
4583
|
+
});
|
|
4554
4584
|
// MCP-001: Clean up per-connection state when a connection disconnects
|
|
4555
4585
|
// MCP-002: Also unregister from notification dispatcher
|
|
4556
4586
|
ipcServer.onDisconnect((connectionId) => {
|