@rubytech/create-realagent 1.0.826 → 1.0.829
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/package.json +1 -1
- package/payload/platform/neo4j/schema.cypher +35 -2
- package/payload/platform/package.json +2 -2
- package/payload/platform/plugins/admin/hooks/__tests__/archive-ingest-surface-gate.test.sh +39 -54
- package/payload/platform/plugins/admin/hooks/archive-ingest-surface-gate.sh +26 -52
- package/payload/platform/plugins/admin/skills/onboarding/SKILL.md +7 -7
- package/payload/platform/plugins/docs/references/cloudflare.md +1 -1
- package/payload/platform/plugins/docs/references/plugins-guide.md +1 -1
- package/payload/platform/plugins/docs/references/troubleshooting.md +1 -0
- package/payload/platform/plugins/memory/PLUGIN.md +5 -5
- package/payload/platform/plugins/memory/mcp/dist/index.js +18 -253
- package/payload/platform/plugins/memory/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/llm-classifier.test.js +51 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/llm-classifier.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/schema-validator.test.js +103 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/schema-validator.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-classifier.d.ts +19 -4
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-classifier.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-classifier.js +149 -56
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-classifier.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/schema-validator.d.ts +16 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/schema-validator.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/schema-validator.js +12 -3
- package/payload/platform/plugins/memory/mcp/dist/lib/schema-validator.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-archive-write.test.js +2 -138
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-archive-write.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest.test.d.ts +2 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest.test.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest.test.js +66 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest.test.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-update-personfields-open.test.d.ts +2 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-update-personfields-open.test.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-update-personfields-open.test.js +148 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-update-personfields-open.test.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-archive-write.d.ts +1 -64
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-archive-write.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-archive-write.js +6 -336
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-archive-write.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-ingest.d.ts +30 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-ingest.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-ingest.js +231 -0
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-ingest.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/profile-update.d.ts +21 -17
- package/payload/platform/plugins/memory/mcp/dist/tools/profile-update.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/profile-update.js +77 -37
- package/payload/platform/plugins/memory/mcp/dist/tools/profile-update.js.map +1 -1
- package/payload/platform/plugins/memory/references/schema-base.md +7 -2
- package/payload/platform/plugins/memory/skills/document-ingest/SKILL.md +54 -4
- package/payload/platform/plugins/whatsapp/PLUGIN.md +1 -1
- package/payload/platform/plugins/whatsapp-import/lib/dist/delta-cursor.d.ts +18 -0
- package/payload/platform/plugins/whatsapp-import/lib/dist/delta-cursor.d.ts.map +1 -0
- package/payload/platform/plugins/whatsapp-import/lib/dist/delta-cursor.js +31 -0
- package/payload/platform/plugins/whatsapp-import/lib/dist/delta-cursor.js.map +1 -0
- package/payload/platform/plugins/whatsapp-import/lib/dist/derive-keys.d.ts +27 -12
- package/payload/platform/plugins/whatsapp-import/lib/dist/derive-keys.d.ts.map +1 -1
- package/payload/platform/plugins/whatsapp-import/lib/dist/derive-keys.js +40 -20
- package/payload/platform/plugins/whatsapp-import/lib/dist/derive-keys.js.map +1 -1
- package/payload/platform/plugins/whatsapp-import/lib/dist/index.d.ts +7 -4
- package/payload/platform/plugins/whatsapp-import/lib/dist/index.d.ts.map +1 -1
- package/payload/platform/plugins/whatsapp-import/lib/dist/index.js +9 -6
- package/payload/platform/plugins/whatsapp-import/lib/dist/index.js.map +1 -1
- package/payload/platform/plugins/whatsapp-import/lib/dist/sessionize.d.ts +25 -0
- package/payload/platform/plugins/whatsapp-import/lib/dist/sessionize.d.ts.map +1 -0
- package/payload/platform/plugins/whatsapp-import/lib/dist/sessionize.js +48 -0
- package/payload/platform/plugins/whatsapp-import/lib/dist/sessionize.js.map +1 -0
- package/payload/platform/plugins/whatsapp-import/lib/dist/to-classifier-input.d.ts +3 -0
- package/payload/platform/plugins/whatsapp-import/lib/dist/to-classifier-input.d.ts.map +1 -0
- package/payload/platform/plugins/whatsapp-import/lib/dist/to-classifier-input.js +47 -0
- package/payload/platform/plugins/whatsapp-import/lib/dist/to-classifier-input.js.map +1 -0
- package/payload/platform/scripts/seed-neo4j.sh +15 -14
- package/payload/platform/templates/specialists/agents/database-operator.md +10 -17
- package/payload/server/chunk-CUSH3UXP.js +2305 -0
- package/payload/server/chunk-IWNDVGKT.js +10077 -0
- package/payload/server/chunk-KC7NUABI.js +654 -0
- package/payload/server/chunk-T2OPNP3L.js +654 -0
- package/payload/server/chunk-WUVXPZIV.js +1116 -0
- package/payload/server/client-pool-3TM3SRIA.js +32 -0
- package/payload/server/cloudflare-task-tracker-4NIODMGL.js +19 -0
- package/payload/server/cloudflare-task-tracker-CR6TL4VL.js +19 -0
- package/payload/server/maxy-edge.js +3 -3
- package/payload/server/neo4j-migrations-XTQ4WEV6.js +428 -0
- package/payload/server/public/assets/{admin-DOkUspG1.js → admin-BNwPsMhJ.js} +2 -2
- package/payload/server/public/assets/{graph-LLMJa4Ch.js → graph-N_Bw-8oT.js} +1 -1
- package/payload/server/public/assets/{page-DoaF3DB0.js → page-BKLGP-th.js} +1 -1
- package/payload/server/public/graph.html +2 -2
- package/payload/server/public/index.html +2 -2
- package/payload/server/server.js +281 -168
- package/payload/platform/plugins/whatsapp-import/PLUGIN.md +0 -46
- package/payload/platform/plugins/whatsapp-import/bin/ingest.mjs +0 -670
- package/payload/platform/plugins/whatsapp-import/bin/whatsapp-ingest.sh +0 -131
- package/payload/platform/plugins/whatsapp-import/lib/src/__tests__/filter-gate.test.ts +0 -172
- package/payload/platform/plugins/whatsapp-import/lib/src/__tests__/ingest-idempotence.test.ts +0 -141
- package/payload/platform/plugins/whatsapp-import/lib/src/__tests__/parse-export-lrm.test.ts +0 -83
- package/payload/platform/plugins/whatsapp-import/lib/src/__tests__/parse-export.test.ts +0 -678
- package/payload/platform/plugins/whatsapp-import/lib/src/derive-keys.ts +0 -59
- package/payload/platform/plugins/whatsapp-import/lib/src/filter.ts +0 -136
- package/payload/platform/plugins/whatsapp-import/lib/src/index.ts +0 -19
- package/payload/platform/plugins/whatsapp-import/lib/src/parse-export.ts +0 -471
- package/payload/platform/plugins/whatsapp-import/lib/tsconfig.json +0 -9
- package/payload/platform/plugins/whatsapp-import/lib/vitest.config.ts +0 -9
- package/payload/platform/plugins/whatsapp-import/skills/whatsapp-import/SKILL.md +0 -131
- package/payload/platform/plugins/whatsapp-import/skills/whatsapp-import/references/export-parse.md +0 -109
- package/payload/platform/plugins/whatsapp-import/skills/whatsapp-import-enrich/SKILL.md +0 -333
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
|
-
import { readFileSync } from "node:fs";
|
|
3
1
|
import { getSession } from "../lib/neo4j.js";
|
|
4
2
|
/**
|
|
5
3
|
* memory-archive-write — deterministic bulk-archive write surface.
|
|
6
4
|
*
|
|
7
|
-
* Writes a flat dataset (LinkedIn Connections.csv,
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
5
|
+
* Writes a flat dataset (LinkedIn Connections.csv, future CRM-type seeds)
|
|
6
|
+
* into the graph as first-class entity nodes plus their natural edges.
|
|
7
|
+
* Distinct from memory-write (per-node, adjacency-required) and memory-ingest
|
|
8
|
+
* (narrative document → :Section, including WhatsApp `_chat.txt` archives
|
|
9
|
+
* which are document-shaped narrative — Task 894).
|
|
11
10
|
*
|
|
12
11
|
* Doctrine:
|
|
13
12
|
* - The Cypher body for each archiveType is fixed inside this tool.
|
|
@@ -23,17 +22,10 @@ import { getSession } from "../lib/neo4j.js";
|
|
|
23
22
|
* describe its archiveType. The agent reads them from the result
|
|
24
23
|
* JSON; nothing programmatic depends on the linkedin-specific
|
|
25
24
|
* legacy field names.
|
|
26
|
-
* - For archive types with cross-batch graph state (WhatsApp's
|
|
27
|
-
* :NEXT chronology), the handler implements an optional
|
|
28
|
-
* `finalize` hook that runs after all batches in its own
|
|
29
|
-
* `executeWrite` transaction. Failure surfaces as
|
|
30
|
-
* `nextChainStatus='failed'` on the result — never silent partial
|
|
31
|
-
* state.
|
|
32
25
|
*/
|
|
33
26
|
const BATCH_SIZE = 500;
|
|
34
27
|
const HANDLERS = {
|
|
35
28
|
"linkedin-connections": linkedinConnectionsHandler(),
|
|
36
|
-
"whatsapp-export": whatsappExportHandler(),
|
|
37
29
|
};
|
|
38
30
|
// ---------------------------------------------------------------------------
|
|
39
31
|
// Entry point
|
|
@@ -76,41 +68,16 @@ export async function memoryArchiveWrite(params) {
|
|
|
76
68
|
process.stderr.write(`[memory-archive-write] batch-failed archiveType=${archiveType} offset=${offset} reason=${reason}\n`);
|
|
77
69
|
}
|
|
78
70
|
}
|
|
79
|
-
let nextChainStatus;
|
|
80
|
-
let nextChainReason;
|
|
81
|
-
if (handler.finalize) {
|
|
82
|
-
try {
|
|
83
|
-
const finalizeResult = await handler.finalize(session, {
|
|
84
|
-
params,
|
|
85
|
-
sessionId,
|
|
86
|
-
hadBatchErrors: errors.length > 0,
|
|
87
|
-
});
|
|
88
|
-
mergeCounters(counters, finalizeResult.counters);
|
|
89
|
-
nextChainStatus = finalizeResult.status;
|
|
90
|
-
nextChainReason = finalizeResult.reason;
|
|
91
|
-
}
|
|
92
|
-
catch (err) {
|
|
93
|
-
const reason = err instanceof Error ? err.message : String(err);
|
|
94
|
-
nextChainStatus = "failed";
|
|
95
|
-
nextChainReason = reason;
|
|
96
|
-
process.stderr.write(`[memory-archive-write] finalize-failed archiveType=${archiveType} reason=${reason}\n`);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
71
|
const elapsedMs = Date.now() - startedMs;
|
|
100
72
|
const counterStr = Object.entries(counters)
|
|
101
73
|
.map(([k, v]) => `${k}=${v}`)
|
|
102
74
|
.join(" ");
|
|
103
|
-
|
|
104
|
-
? ` nextChainStatus=${nextChainStatus}${nextChainReason ? ` reason=${nextChainReason}` : ""}`
|
|
105
|
-
: "";
|
|
106
|
-
process.stderr.write(`[memory-archive-write] archiveType=${archiveType} rows=${rows.length} ${counterStr} errors=${errors.length}${statusStr} ms=${elapsedMs}\n`);
|
|
75
|
+
process.stderr.write(`[memory-archive-write] archiveType=${archiveType} rows=${rows.length} ${counterStr} errors=${errors.length} ms=${elapsedMs}\n`);
|
|
107
76
|
return {
|
|
108
77
|
archiveType,
|
|
109
78
|
processedRows: rows.length,
|
|
110
79
|
counters,
|
|
111
80
|
errors,
|
|
112
|
-
...(nextChainStatus ? { nextChainStatus } : {}),
|
|
113
|
-
...(nextChainReason ? { nextChainReason } : {}),
|
|
114
81
|
};
|
|
115
82
|
}
|
|
116
83
|
finally {
|
|
@@ -240,301 +207,4 @@ function normaliseLinkedinRow(row) {
|
|
|
240
207
|
connectedOn: row.connectedOn,
|
|
241
208
|
};
|
|
242
209
|
}
|
|
243
|
-
// ---------------------------------------------------------------------------
|
|
244
|
-
// whatsapp-export handler (Task 804)
|
|
245
|
-
// ---------------------------------------------------------------------------
|
|
246
|
-
//
|
|
247
|
-
// Owner anchor: the operator who exported the chat (:AdminUser or :Person).
|
|
248
|
-
// Recorded as `createdBySession`-stamped provenance on the Conversation node;
|
|
249
|
-
// not a graph edge, since the exporter is metadata, not a semantic role.
|
|
250
|
-
//
|
|
251
|
-
// Per call the input expresses one Conversation + N Messages + edges:
|
|
252
|
-
// 1. (:Conversation:WhatsAppConversation {conversationId}) — MERGE, sublabel on first create
|
|
253
|
-
// 2. (:Message:WhatsAppMessage {messageId})-[:PART_OF]->(:Conversation)
|
|
254
|
-
// 3. (sender:AdminUser|:Person {elementId})-[:SENT]->(:Message)
|
|
255
|
-
// 4. (sender)-[:PARTICIPANT_IN]->(:Conversation) — rolled up per distinct sender
|
|
256
|
-
// 5. (:Message)-[:NEXT]->(:Message) — chronology, finalize step
|
|
257
|
-
//
|
|
258
|
-
// Natural keys:
|
|
259
|
-
// :Conversation:WhatsAppConversation — conversationId (whatsapp-export:<sha256(file)>:<accountId>)
|
|
260
|
-
// :Message:WhatsAppMessage — messageId (whatsapp-export:<conversationId>:<lineHash>)
|
|
261
|
-
// participants — elementId resolved by the skill's confirmation flow
|
|
262
|
-
//
|
|
263
|
-
// Provenance stamped on every node: source='whatsapp', createdByAgent='whatsapp-import',
|
|
264
|
-
// createdBySession=$sessionId, createdAt=datetime(), archiveSourceFile=<sha256 prefix>.
|
|
265
|
-
// On re-import, ON MATCH refreshes lastMessageAt / messageCount / participantCount /
|
|
266
|
-
// lastImportedAt / lastImportedBySession on the Conversation only — node-creation
|
|
267
|
-
// stamps are preserved.
|
|
268
|
-
//
|
|
269
|
-
// Cross-batch state: NEXT chain depends on full-conversation chronology. The
|
|
270
|
-
// finalize hook runs ORDER BY dateSent ASC, sequenceIndex ASC, then MERGEs
|
|
271
|
-
// pairwise NEXT edges. Idempotent — re-import with a 50-message append adds
|
|
272
|
-
// 50 NEXT edges and updates conversation scalars, no duplicates.
|
|
273
|
-
// ---------------------------------------------------------------------------
|
|
274
|
-
// MERGE on the base label only, then SET the sublabel in ON CREATE — Task 633
|
|
275
|
-
// pattern documented at platform/neo4j/schema.cypher:374-388 and used by
|
|
276
|
-
// `ensureConversation` in platform/ui/app/lib/neo4j-store.ts. MERGEing on
|
|
277
|
-
// `:Base:Sublabel` directly would refuse to match a pre-existing node that
|
|
278
|
-
// carries only the base label, then CREATE a duplicate that violates the
|
|
279
|
-
// `conversationId IS UNIQUE` constraint on `:Conversation`. The base+SET
|
|
280
|
-
// pattern is constraint-safe and idempotent across Task-633-style sublabel
|
|
281
|
-
// backfill histories.
|
|
282
|
-
export const WHATSAPP_CONVERSATION_AND_MESSAGES_CYPHER = `
|
|
283
|
-
MATCH (owner) WHERE elementId(owner) = $ownerNodeId
|
|
284
|
-
WITH owner, $rows AS rows, $conversation AS conv
|
|
285
|
-
MERGE (c:Conversation {conversationId: conv.conversationId})
|
|
286
|
-
ON CREATE SET
|
|
287
|
-
c:WhatsAppConversation,
|
|
288
|
-
c.accountId = $accountId,
|
|
289
|
-
c.source = 'whatsapp',
|
|
290
|
-
c.createdByAgent = 'whatsapp-import',
|
|
291
|
-
c.createdBySource = 'whatsapp-import',
|
|
292
|
-
c.createdBySession = $sessionId,
|
|
293
|
-
c.createdAt = datetime(),
|
|
294
|
-
c.scope = 'admin',
|
|
295
|
-
c.agentType = 'admin',
|
|
296
|
-
c.archiveSourceFile = conv.archiveSourceFile,
|
|
297
|
-
c.firstMessageAt = datetime(conv.firstMessageAt),
|
|
298
|
-
c.lastMessageAt = datetime(conv.lastMessageAt),
|
|
299
|
-
c.participantCount = conv.participantCount,
|
|
300
|
-
c.messageCount = conv.messageCount
|
|
301
|
-
ON MATCH SET
|
|
302
|
-
c:WhatsAppConversation,
|
|
303
|
-
c.lastMessageAt = datetime(conv.lastMessageAt),
|
|
304
|
-
c.participantCount = conv.participantCount,
|
|
305
|
-
c.messageCount = conv.messageCount,
|
|
306
|
-
c.lastImportedAt = datetime(),
|
|
307
|
-
c.lastImportedBySession = $sessionId
|
|
308
|
-
WITH owner, c, rows
|
|
309
|
-
UNWIND rows AS row
|
|
310
|
-
MATCH (sender) WHERE elementId(sender) = row.senderNodeId
|
|
311
|
-
MERGE (m:Message {messageId: row.messageId})
|
|
312
|
-
ON CREATE SET
|
|
313
|
-
m:WhatsAppMessage,
|
|
314
|
-
m.accountId = $accountId,
|
|
315
|
-
m.source = 'whatsapp',
|
|
316
|
-
m.createdByAgent = 'whatsapp-import',
|
|
317
|
-
m.createdBySource = 'whatsapp-import',
|
|
318
|
-
m.createdBySession = $sessionId,
|
|
319
|
-
m.createdAt = datetime(),
|
|
320
|
-
m.conversationId = row.conversationId,
|
|
321
|
-
m.dateSent = datetime(row.dateSent),
|
|
322
|
-
m.body = row.body,
|
|
323
|
-
m.senderName = row.senderName,
|
|
324
|
-
m.sequenceIndex = row.sequenceIndex,
|
|
325
|
-
m.scope = 'admin'
|
|
326
|
-
MERGE (m)-[:PART_OF]->(c)
|
|
327
|
-
MERGE (sender)-[s:SENT]->(m)
|
|
328
|
-
ON CREATE SET
|
|
329
|
-
s.source = 'whatsapp',
|
|
330
|
-
s.createdAt = datetime()
|
|
331
|
-
MERGE (sender)-[p:PARTICIPANT_IN]->(c)
|
|
332
|
-
ON CREATE SET
|
|
333
|
-
p.source = 'whatsapp',
|
|
334
|
-
p.createdAt = datetime()
|
|
335
|
-
RETURN count(*) AS processed
|
|
336
|
-
`;
|
|
337
|
-
// Tertiary tiebreaker `m.messageId ASC` makes ordering total even when two
|
|
338
|
-
// messages share the same dateSent + sequenceIndex (operator-error duplicate
|
|
339
|
-
// row in input, or two messages emitted in the same second by the same
|
|
340
|
-
// sender). Without it, Neo4j's ordering of equal keys is undefined and the
|
|
341
|
-
// chain topology can drift across re-imports — MERGE on (prev, next) is
|
|
342
|
-
// idempotent per pair, but pairs themselves would shuffle.
|
|
343
|
-
export const WHATSAPP_NEXT_CHAIN_CYPHER = `
|
|
344
|
-
MATCH (c:Conversation:WhatsAppConversation {conversationId: $conversationId})
|
|
345
|
-
MATCH (m:Message)-[:PART_OF]->(c)
|
|
346
|
-
WITH c, m ORDER BY m.dateSent ASC, m.sequenceIndex ASC, m.messageId ASC
|
|
347
|
-
WITH c, collect(m) AS msgs
|
|
348
|
-
UNWIND range(0, size(msgs) - 2) AS i
|
|
349
|
-
WITH msgs[i] AS prev, msgs[i + 1] AS next
|
|
350
|
-
WHERE prev <> next
|
|
351
|
-
MERGE (prev)-[r:NEXT]->(next)
|
|
352
|
-
ON CREATE SET
|
|
353
|
-
r.source = 'whatsapp',
|
|
354
|
-
r.createdAt = datetime()
|
|
355
|
-
RETURN count(r) AS nextEdges
|
|
356
|
-
`;
|
|
357
|
-
function whatsappExportHandler() {
|
|
358
|
-
return {
|
|
359
|
-
async verifyArchive(session, params) {
|
|
360
|
-
const { ownerNodeId, accountId, conversation, participantNodeIds, rows, archiveFilePath } = params;
|
|
361
|
-
if (!conversation || !conversation.conversationId) {
|
|
362
|
-
throw new Error("whatsapp-export: `conversation` block with conversationId is required.");
|
|
363
|
-
}
|
|
364
|
-
if (!Array.isArray(participantNodeIds) || participantNodeIds.length === 0) {
|
|
365
|
-
throw new Error("whatsapp-export: `participantNodeIds` must be a non-empty array (operator-confirmed senders).");
|
|
366
|
-
}
|
|
367
|
-
if (!archiveFilePath || !archiveFilePath.trim()) {
|
|
368
|
-
throw new Error("whatsapp-export: `archiveFilePath` is required (Task 805) — the server recomputes sha256 from the file and asserts it matches conversation.archiveSourceFile.");
|
|
369
|
-
}
|
|
370
|
-
// Hash gate (Task 805). Re-compute sha256 from the operator-supplied
|
|
371
|
-
// path and compare against the conversation block's archiveSourceFile.
|
|
372
|
-
// Mismatch is a hard reject before any Cypher runs — closes the
|
|
373
|
-
// silent-substitution window where the agent could pair rows[] for
|
|
374
|
-
// one file with a stale conversation block from another.
|
|
375
|
-
verifyArchiveSourceFileHash(archiveFilePath, conversation.archiveSourceFile);
|
|
376
|
-
// Cross-row conversationId invariant: one call = one conversation.
|
|
377
|
-
for (let i = 0; i < rows.length; i++) {
|
|
378
|
-
const row = rows[i];
|
|
379
|
-
if (row.conversationId !== conversation.conversationId) {
|
|
380
|
-
throw new Error(`whatsapp-export: row[${i}].conversationId="${row.conversationId}" mismatches conversation.conversationId="${conversation.conversationId}". One archive-write call writes exactly one conversation.`);
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
// Owner verification (mirrors linkedin-connections logic).
|
|
384
|
-
const ownerRes = await session.run(`MATCH (n) WHERE elementId(n) = $ownerNodeId
|
|
385
|
-
RETURN labels(n) AS labels, n.accountId AS accountId LIMIT 1`, { ownerNodeId });
|
|
386
|
-
if (ownerRes.records.length === 0) {
|
|
387
|
-
throw new Error(`ownerNodeId ${ownerNodeId} not found. Re-run the archive-owner confirmation flow before invoking memory-archive-write.`);
|
|
388
|
-
}
|
|
389
|
-
const ownerLabels = ownerRes.records[0].get("labels") ?? [];
|
|
390
|
-
const ownerAccountId = ownerRes.records[0].get("accountId");
|
|
391
|
-
if (!ownerLabels.includes("AdminUser") && !ownerLabels.includes("Person")) {
|
|
392
|
-
throw new Error(`ownerNodeId ${ownerNodeId} has labels [${ownerLabels.join(", ")}]; expected :AdminUser or :Person.`);
|
|
393
|
-
}
|
|
394
|
-
if (ownerAccountId && ownerAccountId !== accountId) {
|
|
395
|
-
throw new Error(`ownerNodeId ${ownerNodeId} belongs to account ${ownerAccountId}, not ${accountId}. Cross-account archive ingest refused.`);
|
|
396
|
-
}
|
|
397
|
-
// Participant verification: every senderNodeId must resolve to :AdminUser
|
|
398
|
-
// or :Person in the same accountId. Distinct in case the skill passed
|
|
399
|
-
// the same nodeId twice. Log when dedup collapses the array — two
|
|
400
|
-
// distinct senderNames mapping to the same elementId is operator-confirmed
|
|
401
|
-
// intent (Step 4 phone-vs-name same-person heuristic), but a silent
|
|
402
|
-
// collapse without a log line hides the merge from the audit trail.
|
|
403
|
-
const distinctParticipantIds = Array.from(new Set(participantNodeIds));
|
|
404
|
-
if (distinctParticipantIds.length !== participantNodeIds.length) {
|
|
405
|
-
process.stderr.write(`[memory-archive-write] participantNodeIds-deduped archiveType=whatsapp-export submitted=${participantNodeIds.length} distinct=${distinctParticipantIds.length}\n`);
|
|
406
|
-
}
|
|
407
|
-
const participantRes = await session.run(`UNWIND $ids AS id
|
|
408
|
-
MATCH (n) WHERE elementId(n) = id
|
|
409
|
-
RETURN id AS elemId, labels(n) AS labels, n.accountId AS accountId`, { ids: distinctParticipantIds });
|
|
410
|
-
const found = new Set();
|
|
411
|
-
const rejected = [];
|
|
412
|
-
for (const record of participantRes.records) {
|
|
413
|
-
const elemId = record.get("elemId");
|
|
414
|
-
const labels = record.get("labels") ?? [];
|
|
415
|
-
const acct = record.get("accountId");
|
|
416
|
-
found.add(elemId);
|
|
417
|
-
if (!labels.includes("AdminUser") && !labels.includes("Person")) {
|
|
418
|
-
rejected.push(`${elemId}: labels=[${labels.join(",")}] (expected :AdminUser or :Person)`);
|
|
419
|
-
continue;
|
|
420
|
-
}
|
|
421
|
-
if (acct && acct !== accountId) {
|
|
422
|
-
rejected.push(`${elemId}: accountId=${acct} (expected ${accountId})`);
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
for (const id of distinctParticipantIds) {
|
|
426
|
-
if (!found.has(id))
|
|
427
|
-
rejected.push(`${id}: not found`);
|
|
428
|
-
}
|
|
429
|
-
const ok = distinctParticipantIds.length - rejected.length;
|
|
430
|
-
process.stderr.write(`[memory-archive-write] verifyParticipants archiveType=whatsapp-export ok=${ok} rejected=${rejected.length}\n`);
|
|
431
|
-
if (rejected.length > 0) {
|
|
432
|
-
throw new Error(`whatsapp-export: ${rejected.length} participant(s) failed verification: ${rejected.join("; ")}. Re-run the participant confirmation flow.`);
|
|
433
|
-
}
|
|
434
|
-
},
|
|
435
|
-
async writeBatch(session, ctx) {
|
|
436
|
-
const { params, batchRows, sessionId } = ctx;
|
|
437
|
-
const queryParams = {
|
|
438
|
-
ownerNodeId: params.ownerNodeId,
|
|
439
|
-
accountId: params.accountId,
|
|
440
|
-
sessionId,
|
|
441
|
-
conversation: params.conversation,
|
|
442
|
-
rows: batchRows.map((r) => normaliseWhatsappRow(r)),
|
|
443
|
-
};
|
|
444
|
-
return await session.executeWrite(async (tx) => {
|
|
445
|
-
const res = await tx.run(WHATSAPP_CONVERSATION_AND_MESSAGES_CYPHER, queryParams);
|
|
446
|
-
const stats = res.summary.counters.updates();
|
|
447
|
-
// Task 887 §B' — per-batch counters reflect exactly what Neo4j's
|
|
448
|
-
// summary reports. The pre-887 shape carried `createdSentEdges` and
|
|
449
|
-
// `createdParticipantEdges` as constant 0 — a stale bookkeeper that
|
|
450
|
-
// contradicted `relationshipsCreated=N` from the same row. Decomposing
|
|
451
|
-
// per-edge-type would need separate Cypher passes per row; the
|
|
452
|
-
// brief's success-criterion #5 accepts removal as the parity fix.
|
|
453
|
-
// Keeps `createdMessages` (from `nodesCreated`, accurate) and
|
|
454
|
-
// `relationshipsCreated` (sum of :PART_OF + :SENT + :PARTICIPANT_IN
|
|
455
|
-
// creations, authoritative). `labelsAdded` retained for the
|
|
456
|
-
// sublabel-promotion audit on first WhatsApp import.
|
|
457
|
-
return {
|
|
458
|
-
createdMessages: stats.nodesCreated,
|
|
459
|
-
relationshipsCreated: stats.relationshipsCreated,
|
|
460
|
-
labelsAdded: stats.labelsAdded,
|
|
461
|
-
};
|
|
462
|
-
});
|
|
463
|
-
},
|
|
464
|
-
async finalize(session, ctx) {
|
|
465
|
-
const { params, hadBatchErrors } = ctx;
|
|
466
|
-
const conversationId = params.conversation?.conversationId;
|
|
467
|
-
if (!conversationId) {
|
|
468
|
-
return { counters: {}, status: "skipped", reason: "no conversationId" };
|
|
469
|
-
}
|
|
470
|
-
const result = await session.executeWrite(async (tx) => {
|
|
471
|
-
const res = await tx.run(WHATSAPP_NEXT_CHAIN_CYPHER, { conversationId });
|
|
472
|
-
const stats = res.summary.counters.updates();
|
|
473
|
-
const nextEdges = res.records[0]?.get("nextEdges") ?? 0;
|
|
474
|
-
const nextEdgeCount = typeof nextEdges === "number"
|
|
475
|
-
? nextEdges
|
|
476
|
-
: typeof nextEdges?.toNumber === "function"
|
|
477
|
-
? nextEdges.toNumber()
|
|
478
|
-
: 0;
|
|
479
|
-
return {
|
|
480
|
-
counters: {
|
|
481
|
-
nextEdgesProcessed: nextEdgeCount,
|
|
482
|
-
nextEdgesCreated: stats.relationshipsCreated,
|
|
483
|
-
},
|
|
484
|
-
status: (hadBatchErrors ? "partial" : "ok"),
|
|
485
|
-
reason: hadBatchErrors ? "one or more batches reported errors; NEXT chain rebuilt over written messages" : undefined,
|
|
486
|
-
};
|
|
487
|
-
});
|
|
488
|
-
return result;
|
|
489
|
-
},
|
|
490
|
-
};
|
|
491
|
-
}
|
|
492
|
-
function normaliseWhatsappRow(row) {
|
|
493
|
-
if (!row.messageId || !row.messageId.trim()) {
|
|
494
|
-
throw new Error("whatsapp-export row missing messageId (natural key).");
|
|
495
|
-
}
|
|
496
|
-
if (!row.conversationId || !row.conversationId.trim()) {
|
|
497
|
-
throw new Error("whatsapp-export row missing conversationId.");
|
|
498
|
-
}
|
|
499
|
-
if (!row.senderNodeId || !row.senderNodeId.trim()) {
|
|
500
|
-
throw new Error("whatsapp-export row missing senderNodeId (operator-confirmed sender).");
|
|
501
|
-
}
|
|
502
|
-
if (!row.dateSent || Number.isNaN(Date.parse(row.dateSent))) {
|
|
503
|
-
throw new Error(`whatsapp-export row dateSent="${row.dateSent}" is not parseable as ISO 8601. Parser must convert the [DD/MM/YY, HH:MM:SS] line prefix to ISO 8601 with timezone.`);
|
|
504
|
-
}
|
|
505
|
-
if (typeof row.sequenceIndex !== "number" || row.sequenceIndex < 0) {
|
|
506
|
-
throw new Error(`whatsapp-export row sequenceIndex="${row.sequenceIndex}" must be a non-negative number.`);
|
|
507
|
-
}
|
|
508
|
-
return {
|
|
509
|
-
messageId: row.messageId.trim(),
|
|
510
|
-
conversationId: row.conversationId.trim(),
|
|
511
|
-
senderNodeId: row.senderNodeId.trim(),
|
|
512
|
-
senderName: (row.senderName ?? "").trim(),
|
|
513
|
-
dateSent: row.dateSent,
|
|
514
|
-
body: row.body ?? "",
|
|
515
|
-
sequenceIndex: row.sequenceIndex,
|
|
516
|
-
};
|
|
517
|
-
}
|
|
518
|
-
// ---------------------------------------------------------------------------
|
|
519
|
-
// Hash gate (Task 805) — exported for unit testing.
|
|
520
|
-
// ---------------------------------------------------------------------------
|
|
521
|
-
/**
|
|
522
|
-
* Re-compute `whatsapp-export:<sha256>` from the file at `archiveFilePath`
|
|
523
|
-
* and assert it matches `expectedArchiveSourceFile`. Throws with a named
|
|
524
|
-
* mismatch error before any Cypher runs.
|
|
525
|
-
*/
|
|
526
|
-
export function verifyArchiveSourceFileHash(archiveFilePath, expectedArchiveSourceFile) {
|
|
527
|
-
let actualHash;
|
|
528
|
-
try {
|
|
529
|
-
const fileBytes = readFileSync(archiveFilePath);
|
|
530
|
-
actualHash = `whatsapp-export:${createHash("sha256").update(fileBytes).digest("hex")}`;
|
|
531
|
-
}
|
|
532
|
-
catch (err) {
|
|
533
|
-
throw new Error(`whatsapp-export: failed to read archiveFilePath="${archiveFilePath}": ${err instanceof Error ? err.message : String(err)}`);
|
|
534
|
-
}
|
|
535
|
-
if (actualHash !== expectedArchiveSourceFile) {
|
|
536
|
-
process.stderr.write(`[memory-archive-write] archiveSourceFile-hash-mismatch operator=${expectedArchiveSourceFile} actual=${actualHash}\n`);
|
|
537
|
-
throw new Error(`whatsapp-export: archiveSourceFile hash mismatch — operator-supplied="${expectedArchiveSourceFile}" actual="${actualHash}". The parser was run on a different file than archiveFilePath; re-run whatsapp-export-parse.`);
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
210
|
//# sourceMappingURL=memory-archive-write.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-archive-write.js","sourceRoot":"","sources":["../../src/tools/memory-archive-write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,MAAM,UAAU,GAAG,GAAG,CAAC;AAmHvB,MAAM,QAAQ,GAAmC;IAC/C,sBAAsB,EAAE,0BAA0B,EAAE;IACpD,iBAAiB,EAAE,qBAAqB,EAAE;CAC3C,CAAC;AAEF,8EAA8E;AAC9E,cAAc;AACd,8EAA8E;AAE9E,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAA0B;IAE1B,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAE7D,IAAI,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IACD,IAAI,CAAC,WAAW,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;IAED,MAAM,OAAO,GAAG,QAAQ,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,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;QACvC,UAAU,EAAE,CAAC,GAAG,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;QACzC,WAAW,EAAE,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE;QACnC,KAAK,EAAE,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI;QAC9D,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI;QACtE,KAAK,EAAE,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI;QAC9D,WAAW,EAAE,GAAG,CAAC,WAAW;KAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
import type { ClassifiedSection, ClassifierOutput, OrphanCandidate } from "../lib/llm-classifier.js";
|
|
2
2
|
export interface IngestParams {
|
|
3
3
|
accountId: string;
|
|
4
|
+
/**
|
|
5
|
+
* Identity key for the parent node:
|
|
6
|
+
* - parentLabel='KnowledgeDocument' (default): treats this as `attachmentId`
|
|
7
|
+
* - parentLabel='ConversationArchive' (Task 891): treats this as `conversationIdentity`
|
|
8
|
+
* The semantic split is captured by `parentLabel`; the field name stays
|
|
9
|
+
* `attachmentId` to preserve the MCP envelope's existing parameter shape.
|
|
10
|
+
*/
|
|
4
11
|
attachmentId: string;
|
|
12
|
+
/**
|
|
13
|
+
* Parent node label (Task 891). Default 'KnowledgeDocument' preserves
|
|
14
|
+
* Task 740's document-ingest contract; 'ConversationArchive' switches the
|
|
15
|
+
* MERGE key, the cleanup discriminator, the NEXT chain bootstrap, and
|
|
16
|
+
* skips anchor/related/documentEdges processing entirely.
|
|
17
|
+
*/
|
|
18
|
+
parentLabel?: "KnowledgeDocument" | "ConversationArchive";
|
|
5
19
|
documentSummary: string;
|
|
6
20
|
/**
|
|
7
21
|
* Element ID of the anchor node (UserProfile / LocalBusiness / Person /
|
|
8
22
|
* Organization). Anchor identity is parameter input — never inferred.
|
|
23
|
+
* Unused in ConversationArchive mode (chat participants attach via
|
|
24
|
+
* :PARTICIPANT_IN, not via anchor edges) — pass any non-empty string.
|
|
9
25
|
*/
|
|
10
26
|
anchorNodeId: string;
|
|
11
27
|
/** Anchor's primary label, used in the per-section MATCH for edge creation. */
|
|
@@ -28,6 +44,20 @@ export interface IngestParams {
|
|
|
28
44
|
userKeywords?: string[];
|
|
29
45
|
/** Session UUID for provenance stamping. */
|
|
30
46
|
sessionId?: string;
|
|
47
|
+
/** SHA-256 of THIS export's `_chat.txt` bytes. Cleanup discriminator: only
|
|
48
|
+
* chunks stamped with this sha256 are dropped on re-ingest, so re-imports
|
|
49
|
+
* of newer exports (different bytes → different sha256) leave prior
|
|
50
|
+
* chunks of the same conversation untouched. Required when
|
|
51
|
+
* parentLabel='ConversationArchive'. */
|
|
52
|
+
archiveSha256?: string;
|
|
53
|
+
/** Original archive filename (basename, e.g. `_chat.txt`). Stamped on the
|
|
54
|
+
* parent + every chunk for operator audit. Required when
|
|
55
|
+
* parentLabel='ConversationArchive'. */
|
|
56
|
+
archiveSourceFile?: string;
|
|
57
|
+
/** Operator-confirmed participant elementIds (:Person / :AdminUser) for
|
|
58
|
+
* this archive. Used to MERGE :PARTICIPANT_IN edges off the parent on
|
|
59
|
+
* every ingest (idempotent). Required when parentLabel='ConversationArchive'. */
|
|
60
|
+
participantElementIds?: string[];
|
|
31
61
|
}
|
|
32
62
|
/** Per-kind count breakdown the writer returns to the skill. */
|
|
33
63
|
export interface KindBreakdown {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-ingest.d.ts","sourceRoot":"","sources":["../../src/tools/memory-ingest.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,iBAAiB,EAEjB,gBAAgB,EAChB,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAwDlC,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB
|
|
1
|
+
{"version":3,"file":"memory-ingest.d.ts","sourceRoot":"","sources":["../../src/tools/memory-ingest.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,iBAAiB,EAEjB,gBAAgB,EAChB,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAwDlC,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;OAMG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,mBAAmB,GAAG,qBAAqB,CAAC;IAC1D,eAAe,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB,+EAA+E;IAC/E,WAAW,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,qEAAqE;IACrE,aAAa,CAAC,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC;IAClD,mFAAmF;IACnF,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;IACrC,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,yFAAyF;IACzF,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,4CAA4C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