@echomem/mcp 1.4.71 → 1.5.1
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/README.md +34 -6
- package/dist/agent-messages-fallback.js +45 -0
- package/dist/backend-network-guard.js +48 -0
- package/dist/backend-policy.js +46 -0
- package/dist/claude-evidence.js +91 -0
- package/dist/codex-sync.js +2 -1
- package/dist/cowork-source.js +140 -0
- package/dist/desktop-presence.js +40 -0
- package/dist/desktop-save-activity.js +128 -0
- package/dist/desktop-workspace.js +48 -0
- package/dist/durable-entry.js +20 -5
- package/dist/headless-runtime.js +4 -0
- package/dist/hud/cli.js +16 -17
- package/dist/hud/diagnostics.js +2 -1
- package/dist/hud/hooks.js +97 -62
- package/dist/hud/server.js +2 -1
- package/dist/index.js +814 -191
- package/dist/lifecycle-entry.js +29 -0
- package/dist/local-data-paths.js +15 -1
- package/dist/local-usage.js +72 -0
- package/dist/memory-intent.js +150 -0
- package/dist/memory-links.js +6 -0
- package/dist/migrate.js +2 -1
- package/dist/package-metadata.js +7 -7
- package/dist/pending-save.js +49 -0
- package/dist/save-local-trace.js +26 -0
- package/dist/save-note-store.js +50 -0
- package/dist/save-receipt-store.js +58 -0
- package/dist/save-receipt.js +42 -0
- package/dist/save-retry.js +43 -0
- package/dist/setup-page/client-extraction.js +2 -1
- package/dist/setup.js +13 -13
- package/dist/source-session-hook.js +65 -4
- package/dist/source-session-local.js +366 -0
- package/dist/source-session-pretool-hook.js +65 -0
- package/dist/source-session.js +66 -27
- package/dist/source-snapshot-export.js +68 -0
- package/dist/source-snapshot.js +99 -0
- package/dist/strict-ingest-contract.js +31 -0
- package/dist/strict-raw-session.js +554 -0
- package/dist/tool-map-cache.js +62 -0
- package/dist/turn-end-saves.js +104 -0
- package/dist/v1-contract.js +92 -45
- package/package.json +5 -3
- package/templates/codex-skills/echomem-save/SKILL.md +26 -27
- package/templates/echomem-recall.md +27 -21
- package/dist/save-checkpoint-hook.js +0 -122
package/dist/source-session.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { coworkSessionForTranscript } from "./cowork-source.js";
|
|
1
2
|
import fs from "node:fs";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import { resolveClaudeCoworkSessionsDir, resolveClaudeDesktopSupportRoots, resolveClaudeProjectsDir, resolveCodexSessionRoots, resolveCursorProjectsDir, } from "./local-data-paths.js";
|
|
@@ -374,6 +375,52 @@ function claudeDesktopClaimFiles(root) {
|
|
|
374
375
|
}
|
|
375
376
|
return files;
|
|
376
377
|
}
|
|
378
|
+
function readClaudeDesktopClaim(file) {
|
|
379
|
+
try {
|
|
380
|
+
const record = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
381
|
+
if (!isRecord(record) || record.isArchived === true)
|
|
382
|
+
return null;
|
|
383
|
+
const providerSessionId = typeof record.sessionId === "string"
|
|
384
|
+
? record.sessionId.trim()
|
|
385
|
+
: "";
|
|
386
|
+
if (!/^local_[A-Za-z0-9_-]{1,194}$/.test(providerSessionId))
|
|
387
|
+
return null;
|
|
388
|
+
const rawAliases = [record.cliSessionId, ...(Array.isArray(record.priorCliSessionIds)
|
|
389
|
+
? record.priorCliSessionIds
|
|
390
|
+
: [])];
|
|
391
|
+
const aliases = [...new Set(rawAliases.map(normalizedUuid).filter((value) => !!value))]
|
|
392
|
+
.slice(0, 32);
|
|
393
|
+
const focusedAt = [record.lastFocusedAt, record.lastActivityAt, record.createdAt]
|
|
394
|
+
.find((value) => typeof value === "number" && Number.isFinite(value));
|
|
395
|
+
return {
|
|
396
|
+
providerSessionId,
|
|
397
|
+
providerSessionAliases: aliases,
|
|
398
|
+
focusedAt: focusedAt ?? 0,
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
catch {
|
|
402
|
+
return null;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
/** The Claude desktop app's own record of a session it hosts in its Code tab. Cowork sets the
|
|
406
|
+
* same host session variable but keeps its sessions elsewhere, so only this record tells the two
|
|
407
|
+
* apart; it also names the CLI sessions whose transcripts hold the conversation. */
|
|
408
|
+
function claudeDesktopClaimForHostSession(hostSessionId, options) {
|
|
409
|
+
for (const supportRoot of resolveClaudeDesktopSupportRoots({
|
|
410
|
+
env: options.env,
|
|
411
|
+
homeDir: options.homeDir,
|
|
412
|
+
platform: options.platform,
|
|
413
|
+
})) {
|
|
414
|
+
for (const file of claudeDesktopClaimFiles(path.join(supportRoot, "claude-code-sessions"))) {
|
|
415
|
+
if (path.basename(file) !== `${hostSessionId}.json`)
|
|
416
|
+
continue;
|
|
417
|
+
const claim = readClaudeDesktopClaim(file);
|
|
418
|
+
if (claim?.providerSessionId === hostSessionId && claim.providerSessionAliases.length > 0)
|
|
419
|
+
return claim;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
return null;
|
|
423
|
+
}
|
|
377
424
|
function claudeDesktopClaimForAlias(cliSessionId, options) {
|
|
378
425
|
const normalizedAlias = normalizedUuid(cliSessionId);
|
|
379
426
|
if (!normalizedAlias)
|
|
@@ -386,33 +433,9 @@ function claudeDesktopClaimForAlias(cliSessionId, options) {
|
|
|
386
433
|
})) {
|
|
387
434
|
const sessionsRoot = path.join(supportRoot, "claude-code-sessions");
|
|
388
435
|
for (const file of claudeDesktopClaimFiles(sessionsRoot)) {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
continue;
|
|
393
|
-
const providerSessionId = typeof record.sessionId === "string"
|
|
394
|
-
? record.sessionId.trim()
|
|
395
|
-
: "";
|
|
396
|
-
if (!/^local_[A-Za-z0-9_-]{1,194}$/.test(providerSessionId))
|
|
397
|
-
continue;
|
|
398
|
-
const rawAliases = [record.cliSessionId, ...(Array.isArray(record.priorCliSessionIds)
|
|
399
|
-
? record.priorCliSessionIds
|
|
400
|
-
: [])];
|
|
401
|
-
const aliases = [...new Set(rawAliases.map(normalizedUuid).filter((value) => !!value))]
|
|
402
|
-
.slice(0, 32);
|
|
403
|
-
if (!aliases.includes(normalizedAlias))
|
|
404
|
-
continue;
|
|
405
|
-
const focusedAt = [record.lastFocusedAt, record.lastActivityAt, record.createdAt]
|
|
406
|
-
.find((value) => typeof value === "number" && Number.isFinite(value));
|
|
407
|
-
claims.push({
|
|
408
|
-
providerSessionId,
|
|
409
|
-
providerSessionAliases: aliases,
|
|
410
|
-
focusedAt: focusedAt ?? 0,
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
catch {
|
|
414
|
-
continue;
|
|
415
|
-
}
|
|
436
|
+
const claim = readClaudeDesktopClaim(file);
|
|
437
|
+
if (claim?.providerSessionAliases.includes(normalizedAlias))
|
|
438
|
+
claims.push(claim);
|
|
416
439
|
}
|
|
417
440
|
}
|
|
418
441
|
const claimsByConversation = new Map();
|
|
@@ -434,6 +457,9 @@ function claudeDesktopClaimForAlias(cliSessionId, options) {
|
|
|
434
457
|
return [...claimsByConversation.values()][0] ?? null;
|
|
435
458
|
}
|
|
436
459
|
function coworkSessionId(file) {
|
|
460
|
+
const verified = coworkSessionForTranscript(file);
|
|
461
|
+
if (verified)
|
|
462
|
+
return verified;
|
|
437
463
|
const value = file.split(path.sep).find((part) => /^local_[A-Za-z0-9_-]{1,194}$/.test(part));
|
|
438
464
|
return value ?? null;
|
|
439
465
|
}
|
|
@@ -530,6 +556,19 @@ export function resolveSourceSessionRequestContext(metadata, options = {}) {
|
|
|
530
556
|
// "Claude Code" and expose both IDs. The outer host session is the durable Cowork conversation;
|
|
531
557
|
// it must win over the nested CLI session whenever Anthropic supplies both host-owned values.
|
|
532
558
|
if (isClaudeHost && coworkCandidate) {
|
|
559
|
+
// The desktop app's Code tab supplies the same variable. Its sessions are Claude Code
|
|
560
|
+
// sessions, with their transcripts under ~/.claude/projects rather than in Cowork's folders.
|
|
561
|
+
const codeTab = claudeDesktopClaimForHostSession(coworkCandidate, options);
|
|
562
|
+
if (codeTab) {
|
|
563
|
+
return {
|
|
564
|
+
sourceSession: verifiedClaudeDesktopSession(codeTab.providerSessionId, codeTab.providerSessionAliases),
|
|
565
|
+
isSubagent: false,
|
|
566
|
+
lineageStatus: "not_applicable",
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
if (env.CLAUDE_CODE_ENTRYPOINT === "claude-desktop") {
|
|
570
|
+
throw new Error("SOURCE_SESSION_NOT_READY: Claude Desktop has not written this Code tab session record yet. Retry this call shortly.");
|
|
571
|
+
}
|
|
533
572
|
return {
|
|
534
573
|
sourceSession: verifiedSourceSession("cowork", coworkCandidate, SOURCE_SESSION_MCP_METADATA_EVIDENCE),
|
|
535
574
|
isSubagent: false,
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { readStrictRawSession, selectSaveEvidence, } from "./strict-raw-session.js";
|
|
5
|
+
import { resolveSourceSessionFromHookPayload } from "./source-session-hook.js";
|
|
6
|
+
import { validateSourceSnapshot } from "./source-snapshot.js";
|
|
7
|
+
/** Private-file IPC for Echo Desktop. Stdout never carries conversation contents. */
|
|
8
|
+
export function exportSourceSnapshot(input) {
|
|
9
|
+
if (!input || typeof input !== "object")
|
|
10
|
+
throw new Error("SOURCE_SNAPSHOT_REQUEST_INVALID");
|
|
11
|
+
const value = input;
|
|
12
|
+
if (typeof value.transcriptPath !== "string" ||
|
|
13
|
+
typeof value.providerSessionId !== "string" ||
|
|
14
|
+
typeof value.outputDirectory !== "string")
|
|
15
|
+
throw new Error("SOURCE_SNAPSHOT_REQUEST_INVALID");
|
|
16
|
+
const directory = fs.realpathSync(value.outputDirectory);
|
|
17
|
+
const temp = fs.realpathSync(os.tmpdir());
|
|
18
|
+
if (!directory.startsWith(temp + path.sep) ||
|
|
19
|
+
!/^echo-source-[0-9a-f-]{36}$/i.test(path.basename(directory)) ||
|
|
20
|
+
(fs.statSync(directory).mode & 0o077) !== 0)
|
|
21
|
+
throw new Error("SOURCE_SNAPSHOT_OUTPUT_INVALID");
|
|
22
|
+
const nativeId = path
|
|
23
|
+
.basename(value.transcriptPath, ".jsonl")
|
|
24
|
+
.replace(/^.*-([0-9a-f]{8}-[0-9a-f-]{27})$/i, "$1");
|
|
25
|
+
const identity = resolveSourceSessionFromHookPayload({
|
|
26
|
+
session_id: nativeId,
|
|
27
|
+
transcript_path: value.transcriptPath,
|
|
28
|
+
});
|
|
29
|
+
if (!identity ||
|
|
30
|
+
identity.provider !== value.provider ||
|
|
31
|
+
!(identity.providerSessionId === value.providerSessionId ||
|
|
32
|
+
identity.providerSessionAliases?.includes(value.providerSessionId)))
|
|
33
|
+
throw new Error("SOURCE_SNAPSHOT_SESSION_MISMATCH");
|
|
34
|
+
const evidence = selectSaveEvidence(readStrictRawSession(identity));
|
|
35
|
+
if (!evidence)
|
|
36
|
+
throw new Error("ASSISTANT_COMPLETION_REQUIRED");
|
|
37
|
+
const messages = evidence.rawData
|
|
38
|
+
.split(/\n\n(?=## (?:User|Assistant) )/)
|
|
39
|
+
.map((block) => {
|
|
40
|
+
const m = /^## (User|Assistant) (\S+) \[([^\]]+)\](?: phase=(commentary|final_answer))?\n\n/.exec(block);
|
|
41
|
+
if (!m)
|
|
42
|
+
throw new Error("SOURCE_SNAPSHOT_MESSAGE_INVALID");
|
|
43
|
+
return {
|
|
44
|
+
id: m[3],
|
|
45
|
+
role: m[1] === "User" ? "user" : "assistant",
|
|
46
|
+
timestamp: m[2],
|
|
47
|
+
text: JSON.parse(block.slice(m[0].length)),
|
|
48
|
+
...(m[4] ? { phase: m[4] } : {}),
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
const snapshot = validateSourceSnapshot({
|
|
52
|
+
version: 1,
|
|
53
|
+
provider: identity.provider,
|
|
54
|
+
conversationId: identity.providerSessionId,
|
|
55
|
+
sourceKind: "native_jsonl",
|
|
56
|
+
aliases: identity.providerSessionAliases,
|
|
57
|
+
messages,
|
|
58
|
+
boundary: evidence.boundary.userMessageId
|
|
59
|
+
? { kind: "explicit_request", messageId: evidence.boundary.userMessageId }
|
|
60
|
+
: {
|
|
61
|
+
kind: "completed_answer",
|
|
62
|
+
messageId: evidence.boundary.assistantMessageId,
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
const file = path.join(directory, "snapshot.json");
|
|
66
|
+
fs.writeFileSync(file, JSON.stringify(snapshot), { flag: "wx", mode: 0o600 });
|
|
67
|
+
return { success: true, file, messageCount: snapshot.messages.length };
|
|
68
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
const object = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
2
|
+
/** Transport validation; authenticating the capture producer is a separate boundary. */
|
|
3
|
+
export function validateSourceSnapshot(value) {
|
|
4
|
+
if (!object(value) ||
|
|
5
|
+
value.version !== 1 ||
|
|
6
|
+
!["claude", "cowork", "claude-code", "codex"].includes(String(value.provider)) ||
|
|
7
|
+
!["browser_api", "native_jsonl"].includes(String(value.sourceKind)) ||
|
|
8
|
+
typeof value.conversationId !== "string" ||
|
|
9
|
+
!/^[A-Za-z0-9_-]{1,200}$/.test(value.conversationId) ||
|
|
10
|
+
!Array.isArray(value.messages) ||
|
|
11
|
+
!value.messages.length ||
|
|
12
|
+
value.messages.length > 10000 ||
|
|
13
|
+
!object(value.boundary))
|
|
14
|
+
throw new Error("SOURCE_SNAPSHOT_INVALID");
|
|
15
|
+
if (value.sourceKind === "native_jsonl" && value.provider === "claude")
|
|
16
|
+
throw new Error("SOURCE_SNAPSHOT_ORIGIN_INVALID");
|
|
17
|
+
if (value.sourceKind === "browser_api") {
|
|
18
|
+
if (value.provider !== "claude" || typeof value.sourceUrl !== "string")
|
|
19
|
+
throw new Error("SOURCE_SNAPSHOT_ORIGIN_INVALID");
|
|
20
|
+
const url = new URL(value.sourceUrl);
|
|
21
|
+
if (url.origin !== "https://claude.ai" ||
|
|
22
|
+
url.pathname !== "/chat/" + value.conversationId ||
|
|
23
|
+
url.search ||
|
|
24
|
+
url.hash ||
|
|
25
|
+
url.username ||
|
|
26
|
+
url.password)
|
|
27
|
+
throw new Error("SOURCE_SNAPSHOT_ORIGIN_INVALID");
|
|
28
|
+
}
|
|
29
|
+
if (value.aliases !== undefined &&
|
|
30
|
+
(value.sourceKind !== "native_jsonl" ||
|
|
31
|
+
value.provider !== "claude-code" ||
|
|
32
|
+
!Array.isArray(value.aliases) ||
|
|
33
|
+
value.aliases.length > 32 ||
|
|
34
|
+
!value.aliases.length ||
|
|
35
|
+
value.aliases.some((id) => typeof id !== "string" || !/^[0-9a-f-]{36}$/i.test(id))))
|
|
36
|
+
throw new Error("SOURCE_SNAPSHOT_ALIASES_INVALID");
|
|
37
|
+
const ids = new Set();
|
|
38
|
+
let bytes = 0;
|
|
39
|
+
const messages = value.messages.map((raw) => {
|
|
40
|
+
if (!object(raw) ||
|
|
41
|
+
typeof raw.id !== "string" ||
|
|
42
|
+
!/^[A-Za-z0-9_-]{1,160}$/.test(raw.id) ||
|
|
43
|
+
ids.has(raw.id) ||
|
|
44
|
+
(raw.role !== "user" && raw.role !== "assistant") ||
|
|
45
|
+
typeof raw.text !== "string" ||
|
|
46
|
+
!raw.text.trim() ||
|
|
47
|
+
typeof raw.timestamp !== "string" ||
|
|
48
|
+
!Number.isFinite(Date.parse(raw.timestamp)) ||
|
|
49
|
+
(raw.phase !== undefined &&
|
|
50
|
+
raw.phase !== "commentary" &&
|
|
51
|
+
raw.phase !== "final_answer"))
|
|
52
|
+
throw new Error("SOURCE_SNAPSHOT_MESSAGE_INVALID");
|
|
53
|
+
ids.add(raw.id);
|
|
54
|
+
bytes += new TextEncoder().encode(raw.text).length;
|
|
55
|
+
return {
|
|
56
|
+
id: raw.id,
|
|
57
|
+
role: raw.role,
|
|
58
|
+
text: raw.text,
|
|
59
|
+
timestamp: raw.timestamp,
|
|
60
|
+
...(raw.phase ? { phase: raw.phase } : {}),
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
if (bytes > 3 * 1024 * 1024)
|
|
64
|
+
throw new Error("SOURCE_SNAPSHOT_TOO_LARGE");
|
|
65
|
+
const boundary = value.boundary;
|
|
66
|
+
if (!["completed_answer", "explicit_request"].includes(String(boundary.kind)) ||
|
|
67
|
+
typeof boundary.messageId !== "string")
|
|
68
|
+
throw new Error("SOURCE_SNAPSHOT_BOUNDARY_INVALID");
|
|
69
|
+
const end = messages.findIndex((m) => m.id === boundary.messageId);
|
|
70
|
+
if (end < 0)
|
|
71
|
+
throw new Error("SOURCE_SNAPSHOT_BOUNDARY_INVALID");
|
|
72
|
+
const last = messages[end];
|
|
73
|
+
if (boundary.kind === "completed_answer"
|
|
74
|
+
? last.role !== "assistant" || last.phase !== "final_answer"
|
|
75
|
+
: last.role !== "user")
|
|
76
|
+
throw new Error("SOURCE_SNAPSHOT_BOUNDARY_INVALID");
|
|
77
|
+
return {
|
|
78
|
+
version: 1,
|
|
79
|
+
provider: value.provider,
|
|
80
|
+
conversationId: value.conversationId,
|
|
81
|
+
sourceKind: value.sourceKind,
|
|
82
|
+
...(typeof value.sourceUrl === "string"
|
|
83
|
+
? { sourceUrl: value.sourceUrl }
|
|
84
|
+
: {}),
|
|
85
|
+
...(Array.isArray(value.aliases)
|
|
86
|
+
? { aliases: value.aliases }
|
|
87
|
+
: {}),
|
|
88
|
+
messages: messages.slice(0, end + 1),
|
|
89
|
+
boundary: {
|
|
90
|
+
kind: boundary.kind,
|
|
91
|
+
messageId: boundary.messageId,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
export function snapshotRaw(snapshot) {
|
|
96
|
+
return snapshot.messages
|
|
97
|
+
.map((m) => `## ${m.role === "user" ? "User" : "Assistant"} ${m.timestamp} [${m.id}]${m.phase ? ` phase=${m.phase}` : ""}\n\n${JSON.stringify(m.text)}`)
|
|
98
|
+
.join("\n\n");
|
|
99
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const STRICT_INGEST_CONTRACT = "incremental-atom-list-v3";
|
|
2
|
+
export const COMPLETION_CONTRACT = "completed-assistant-v1";
|
|
3
|
+
const object = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4
|
+
/** Verify before sending source text. An older backend must never silently
|
|
5
|
+
* treat strictIngest as an unknown, optional JSON field. Returns how many
|
|
6
|
+
* memories one save may write, which the receipt check then enforces. */
|
|
7
|
+
export function assertStrictIngestCapabilities(value, explicitUserBoundary = false) {
|
|
8
|
+
const max = object(value) ? value.maxNewMemoriesPerStrictRequest : undefined;
|
|
9
|
+
if (!object(value) || value.ingestionContract !== STRICT_INGEST_CONTRACT || value.strictIngest !== true
|
|
10
|
+
|| typeof max !== "number" || !Number.isInteger(max) || max < 1 || value.strictGenerationShape !== "atom-list"
|
|
11
|
+
|| value.passthroughSupported !== false || value.strictProvenanceCommit !== "atomic-with-memory"
|
|
12
|
+
|| value.completionBoundary !== COMPLETION_CONTRACT
|
|
13
|
+
|| (explicitUserBoundary && value.explicitSaveBoundary !== "verified-user-request-v1")) {
|
|
14
|
+
throw new Error("STRICT_INGEST_BACKEND_INCOMPATIBLE: backend does not provide the required atom-list and completion contract. No transcript was submitted; configure a compatible backend.");
|
|
15
|
+
}
|
|
16
|
+
return max;
|
|
17
|
+
}
|
|
18
|
+
/** This detects an incompatible response; it cannot undo writes made by a
|
|
19
|
+
* nonconforming server. Never claim nothing was written after a bad receipt.
|
|
20
|
+
* A receipt with memoriesExtracted 0 may still list earlier memories (reused). */
|
|
21
|
+
export function assertStrictIngestReceipt(value, maxNewMemories) {
|
|
22
|
+
const count = object(value) ? value.memoriesExtracted : undefined;
|
|
23
|
+
if (!object(value) || value.success !== true || value.strictIngest !== true
|
|
24
|
+
|| value.ingestionContract !== STRICT_INGEST_CONTRACT || value.completionBoundary !== COMPLETION_CONTRACT
|
|
25
|
+
|| typeof count !== "number" || !Number.isInteger(count) || count < 0 || count > maxNewMemories || value.passthrough === true
|
|
26
|
+
|| !Array.isArray(value.extractedMemories) || value.extractedMemories.length > maxNewMemories
|
|
27
|
+
|| value.extractedMemories.some(memory => !object(memory) || typeof memory.id !== "string" || !memory.id.trim())
|
|
28
|
+
|| (count > 0 && value.extractedMemories.length !== count)) {
|
|
29
|
+
throw new Error("STRICT_INGEST_RECEIPT_INVALID: backend returned an incompatible receipt; persistence state is unknown. Do not retry through a legacy path.");
|
|
30
|
+
}
|
|
31
|
+
}
|