@cello-protocol/daemon 0.0.41 → 0.0.43
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 +40 -6
- package/dist/daemon.js.map +1 -1
- package/dist/registration-manager.d.ts +4 -0
- package/dist/registration-manager.d.ts.map +1 -1
- package/dist/registration-manager.js.map +1 -1
- package/dist/session-ceremony.d.ts +12 -0
- package/dist/session-ceremony.d.ts.map +1 -1
- package/dist/session-ceremony.js +100 -18
- package/dist/session-ceremony.js.map +1 -1
- package/dist/session-node-manager.d.ts.map +1 -1
- package/dist/session-node-manager.js +76 -13
- package/dist/session-node-manager.js.map +1 -1
- package/package.json +4 -4
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,EAQrB,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAQ/D,OAAO,EAAoD,KAAK,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAsB7G,OAAO,KAAK,EAAE,kBAAkB,EAA+C,MAAM,yBAAyB,CAAC;AAQ/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;AA2CD,eAAO,MAAM,sBAAsB,QAAsB,CAAC;AAE1D,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,EAQrB,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAQ/D,OAAO,EAAoD,KAAK,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAsB7G,OAAO,KAAK,EAAE,kBAAkB,EAA+C,MAAM,yBAAyB,CAAC;AAQ/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;AA2CD,eAAO,MAAM,sBAAsB,QAAsB,CAAC;AAE1D,wBAAsB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CA6tL7E"}
|
package/dist/daemon.js
CHANGED
|
@@ -4447,7 +4447,18 @@ export async function startDaemon(config) {
|
|
|
4447
4447
|
return;
|
|
4448
4448
|
}
|
|
4449
4449
|
logger.info("daemon.trust_signal.received", { agentName, signalKind, verified: true, correlationId });
|
|
4450
|
-
|
|
4450
|
+
// DOD-SENDRAW-1: sendRaw never throws — a discarded result hid every failed ack, leaving the
|
|
4451
|
+
// sender to retransmit against a daemon that believed it had answered.
|
|
4452
|
+
const ackRes = await mgr.sendRaw({ type: "trust_signal_ack", id });
|
|
4453
|
+
if (!ackRes.ok) {
|
|
4454
|
+
logger.warn("daemon.trust_signal.ack_send_failed", {
|
|
4455
|
+
agentName,
|
|
4456
|
+
signalKind,
|
|
4457
|
+
correlationId,
|
|
4458
|
+
detail: ackRes.reason ?? "send_not_ok",
|
|
4459
|
+
...(ackRes.guidance ? { guidance: ackRes.guidance } : {}),
|
|
4460
|
+
});
|
|
4461
|
+
}
|
|
4451
4462
|
}
|
|
4452
4463
|
function wirePerAgentSessionInbound(mgr) {
|
|
4453
4464
|
mgr.registerInboundHandler((frame) => {
|
|
@@ -5168,12 +5179,22 @@ export async function startDaemon(config) {
|
|
|
5168
5179
|
return { ok: false, reason: "missing_params", guidance: "Provide 'session_id' (hex) to receive content for a specific session." };
|
|
5169
5180
|
}
|
|
5170
5181
|
const record = sessionNodeManager.getSessionRecord(agentName, sessionId);
|
|
5182
|
+
// DOD-UNREAD-1 D4b: a TRANSCRIPT-ONLY session — received rows exist but no sessions row (the
|
|
5183
|
+
// pre-D3/D4a phantom residue: the counterparty's reply landed while this side refused the
|
|
5184
|
+
// session). Those rows are counted unread by getUnreadSummary, so cello_receive MUST be able
|
|
5185
|
+
// to read them or the badge can never clear. Reading is a transcript operation: the since_seq
|
|
5186
|
+
// catch-up below works from the durable transcript alone. Only a session with NEITHER a row
|
|
5187
|
+
// NOR transcript rows is truly not found.
|
|
5188
|
+
let transcriptOnly = false;
|
|
5171
5189
|
if (!record) {
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5190
|
+
if (sessionNodeManager.readTranscript(agentName, sessionId).messages.length === 0) {
|
|
5191
|
+
return { ok: false, reason: "session_not_found", guidance: "No session found with this ID. Check cello_list_sessions." };
|
|
5192
|
+
}
|
|
5193
|
+
transcriptOnly = true;
|
|
5176
5194
|
}
|
|
5195
|
+
// (D4 review F3: the old `record.agent_name !== agentName` → session_not_owned branch was dead
|
|
5196
|
+
// code — getSessionRecord is keyed by (agent_name, session_id), so a record can never belong to
|
|
5197
|
+
// a different agent. A cross-agent session id simply has no record under this agent.)
|
|
5177
5198
|
// M8C-SINCESEQ-1: stateless catch-up. When since_seq is provided, return a BATCH of received
|
|
5178
5199
|
// transcript messages with sequence > since_seq (durable transcript, not the ephemeral buffer —
|
|
5179
5200
|
// so concurrent arrivals don't shift what a given since_seq returns; no replay race). Replaces
|
|
@@ -5183,7 +5204,9 @@ export async function startDaemon(config) {
|
|
|
5183
5204
|
const rawSince = params?.since_seq;
|
|
5184
5205
|
if (typeof rawSince === "number" && Number.isFinite(rawSince)) {
|
|
5185
5206
|
const sinceSeq = rawSince;
|
|
5186
|
-
|
|
5207
|
+
// D4b AC2: a transcript-only session has no record to attribute from — `from` is null,
|
|
5208
|
+
// NEVER the string "unknown" (the transcript stores no counterparty; don't invent one).
|
|
5209
|
+
const from = record ? record.counterparty_pubkey : null;
|
|
5187
5210
|
const { messages } = sessionNodeManager.readTranscript(agentName, sessionId);
|
|
5188
5211
|
const received = messages.filter((m) => m.direction === "received" && m.sequence > sinceSeq);
|
|
5189
5212
|
if (received.length > 0) {
|
|
@@ -5204,6 +5227,17 @@ export async function startDaemon(config) {
|
|
|
5204
5227
|
messages: received.map((m) => ({ sequence: m.sequence, content: m.text, from })),
|
|
5205
5228
|
};
|
|
5206
5229
|
}
|
|
5230
|
+
// D4b AC3: the plain (blocking) receive waits on a LIVE session's buffer — a transcript-only
|
|
5231
|
+
// session has no live node and nothing will ever arrive. Waiting to a null timeout would be
|
|
5232
|
+
// misleading and session_not_found would be a lie (the transcript exists). A distinct reason
|
|
5233
|
+
// points the caller at the read that works.
|
|
5234
|
+
if (transcriptOnly) {
|
|
5235
|
+
return {
|
|
5236
|
+
ok: false,
|
|
5237
|
+
reason: "session_not_live",
|
|
5238
|
+
guidance: "This session exists only as a durable transcript (no live session — it was never established or predates this daemon). Read it with cello_receive { since_seq } (e.g. since_seq: -1 for everything) or cello_get_transcript.",
|
|
5239
|
+
};
|
|
5240
|
+
}
|
|
5207
5241
|
const rawTimeout = params?.timeout_ms;
|
|
5208
5242
|
const timeoutMs = typeof rawTimeout === "number" && Number.isFinite(rawTimeout) && rawTimeout >= 0
|
|
5209
5243
|
? rawTimeout
|