@rubytech/create-realagent-code 0.1.118 → 0.1.121
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 +92 -1
- package/payload/platform/package-lock.json +141 -125
- package/payload/platform/plugins/aeo/PLUGIN.md +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-erase.d.ts +12 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-erase.d.ts.map +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-erase.js +34 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/contact-erase.js.map +1 -1
- package/payload/platform/plugins/docs/references/aeo.md +2 -2
- package/payload/platform/plugins/docs/references/visitor-graph.md +82 -0
- package/payload/platform/plugins/memory/references/schema-base.md +44 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/.claude-plugin/plugin.json +1 -1
- package/payload/premium-plugins/real-agent/plugins/buyers/PLUGIN.md +33 -3
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/index.d.ts +2 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/index.d.ts.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/index.js +97 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/index.js.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/lib/neo4j.d.ts +5 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/lib/neo4j.d.ts.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/lib/neo4j.js +40 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/lib/neo4j.js.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-backfill-from-logs.d.ts +24 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-backfill-from-logs.d.ts.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-backfill-from-logs.js +156 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-backfill-from-logs.js.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-engagement-score.d.ts +21 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-engagement-score.d.ts.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-engagement-score.js +65 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-engagement-score.js.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-event-ingest.d.ts +26 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-event-ingest.d.ts.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-event-ingest.js +78 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-event-ingest.js.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-recent-by-page.d.ts +19 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-recent-by-page.d.ts.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-recent-by-page.js +41 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-recent-by-page.js.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-recent-by-person.d.ts +20 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-recent-by-person.d.ts.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-recent-by-person.js +44 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-recent-by-person.js.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-recommendation-ctr.d.ts +22 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-recommendation-ctr.d.ts.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-recommendation-ctr.js +41 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-recommendation-ctr.js.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-session-detail.d.ts +32 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-session-detail.d.ts.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-session-detail.js +87 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/dist/tools/visitor-session-detail.js.map +1 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/package-lock.json +2566 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/package.json +21 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/src/index.ts +145 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/src/lib/neo4j.ts +45 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/src/tools/visitor-backfill-from-logs.ts +189 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/src/tools/visitor-engagement-score.ts +87 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/src/tools/visitor-event-ingest.ts +119 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/src/tools/visitor-recent-by-page.ts +61 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/src/tools/visitor-recent-by-person.ts +65 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/src/tools/visitor-recommendation-ctr.ts +67 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/src/tools/visitor-session-detail.ts +127 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/mcp/tsconfig.json +20 -0
- package/payload/premium-plugins/real-agent/plugins/buyers/skills/property-recommender/SKILL.md +11 -0
- package/payload/premium-plugins/real-agent/plugins/leads/skills/lead-nurturing/SKILL.md +9 -0
- package/payload/premium-plugins/real-agent/plugins/leads/skills/morning-round/SKILL.md +11 -0
- package/payload/premium-plugins/real-agent/plugins/vendors/skills/vendor-updates/SKILL.md +13 -0
- package/payload/server/{chunk-FJCI6X3H.js → chunk-HCYM5FLU.js} +2 -0
- package/payload/server/maxy-edge.js +1 -1
- package/payload/server/public/privacy.html +66 -0
- package/payload/server/public/v.js +191 -0
- package/payload/server/server.js +473 -85
|
@@ -68,7 +68,7 @@ The audit nodes carry `accountId`, `target` (URL or `(inline html)`), `score`, `
|
|
|
68
68
|
|
|
69
69
|
## What this plugin does not do
|
|
70
70
|
|
|
71
|
-
- No LLM API calls.
|
|
71
|
+
- No LLM API calls. No citation monitor — out of scope. Multi-engine answer harvesting doesn't fit maxy-code's no-API-key architecture, and the monitor was archived without sprinting (Task 363). The audit plus the structured-answer template are the surface; check citation manually when needed.
|
|
72
72
|
- No automatic emission. `aeo-emit-jsonld` returns a script block; wiring it into the platform's page render path is per-renderer work, also filed as a follow-up.
|
|
73
73
|
- No publish-hook regeneration of `llms.txt`. The tool runs on demand. Hooking it into the publish event is a follow-up.
|
|
74
74
|
- No prose authoring. AEO audits structure; it does not rewrite content. Writer-craft owns voice.
|
|
@@ -6,7 +6,12 @@
|
|
|
6
6
|
* 2. Conversations left empty after message removal
|
|
7
7
|
* 3. Emails matching the contact's email (fromAddress or toAddresses)
|
|
8
8
|
* 4. AccessGrants via (Person)-[:HAS_ACCESS]->(AccessGrant)
|
|
9
|
-
* 5.
|
|
9
|
+
* 5. Visitor-graph data (Task 357):
|
|
10
|
+
* - :Session reachable via (Person)-[:VISITED]->(Session)
|
|
11
|
+
* - all :HAS_EVENT children (PageView/Click/ScrollMilestone)
|
|
12
|
+
* - :AnonVisitor via (Person)-[:OWNS_VISITOR]->(AnonVisitor)
|
|
13
|
+
* :Page and :Listing are content metadata and are intentionally preserved.
|
|
14
|
+
* 6. Person node itself (DETACH DELETE)
|
|
10
15
|
*
|
|
11
16
|
* Requires `confirm: true` to execute. Without it, returns a preview
|
|
12
17
|
* of what would be deleted (counts per node type) but does not delete.
|
|
@@ -33,6 +38,12 @@ interface EraseCounts {
|
|
|
33
38
|
conversations: number;
|
|
34
39
|
emails: number;
|
|
35
40
|
accessGrants: number;
|
|
41
|
+
/** Visitor-graph Sessions removed (Task 357). */
|
|
42
|
+
visitorSessions: number;
|
|
43
|
+
/** Visitor-graph event nodes removed (PageView + Click + ScrollMilestone). */
|
|
44
|
+
visitorEvents: number;
|
|
45
|
+
/** AnonVisitor nodes owned by this Person and removed. */
|
|
46
|
+
anonVisitors: number;
|
|
36
47
|
person: number;
|
|
37
48
|
}
|
|
38
49
|
export type ContactEraseResult = ErasePreview | EraseReceipt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-erase.d.ts","sourceRoot":"","sources":["../../src/tools/contact-erase.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"contact-erase.d.ts","sourceRoot":"","sources":["../../src/tools/contact-erase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,UAAU,kBAAkB;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,YAAY;IACpB,SAAS,EAAE,KAAK,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,UAAU,YAAY;IACpB,SAAS,EAAE,IAAI,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,UAAU,WAAW;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,eAAe,EAAE,MAAM,CAAC;IACxB,8EAA8E;IAC9E,aAAa,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,YAAY,CAAC;AAE7D,wBAAsB,YAAY,CAChC,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,kBAAkB,CAAC,CA6N7B"}
|
|
@@ -6,7 +6,12 @@
|
|
|
6
6
|
* 2. Conversations left empty after message removal
|
|
7
7
|
* 3. Emails matching the contact's email (fromAddress or toAddresses)
|
|
8
8
|
* 4. AccessGrants via (Person)-[:HAS_ACCESS]->(AccessGrant)
|
|
9
|
-
* 5.
|
|
9
|
+
* 5. Visitor-graph data (Task 357):
|
|
10
|
+
* - :Session reachable via (Person)-[:VISITED]->(Session)
|
|
11
|
+
* - all :HAS_EVENT children (PageView/Click/ScrollMilestone)
|
|
12
|
+
* - :AnonVisitor via (Person)-[:OWNS_VISITOR]->(AnonVisitor)
|
|
13
|
+
* :Page and :Listing are content metadata and are intentionally preserved.
|
|
14
|
+
* 6. Person node itself (DETACH DELETE)
|
|
10
15
|
*
|
|
11
16
|
* Requires `confirm: true` to execute. Without it, returns a preview
|
|
12
17
|
* of what would be deleted (counts per node type) but does not delete.
|
|
@@ -45,8 +50,27 @@ export async function contactErase(params) {
|
|
|
45
50
|
conversations: 0,
|
|
46
51
|
emails: 0,
|
|
47
52
|
accessGrants: 0,
|
|
53
|
+
visitorSessions: 0,
|
|
54
|
+
visitorEvents: 0,
|
|
55
|
+
anonVisitors: 0,
|
|
48
56
|
person: 1,
|
|
49
57
|
};
|
|
58
|
+
// Count visitor-graph data — Sessions, events, AnonVisitors (Task 357)
|
|
59
|
+
{
|
|
60
|
+
const visitorCounts = await session.run(`MATCH (p:Person) WHERE elementId(p) = $personNodeId
|
|
61
|
+
OPTIONAL MATCH (p)-[:VISITED]->(vs:Session)
|
|
62
|
+
OPTIONAL MATCH (vs)-[:HAS_EVENT]->(ev)
|
|
63
|
+
OPTIONAL MATCH (p)-[:OWNS_VISITOR]->(av:AnonVisitor)
|
|
64
|
+
RETURN count(DISTINCT vs) AS visitorSessions,
|
|
65
|
+
count(DISTINCT ev) AS visitorEvents,
|
|
66
|
+
count(DISTINCT av) AS anonVisitors`, { personNodeId });
|
|
67
|
+
if (visitorCounts.records.length > 0) {
|
|
68
|
+
const row = visitorCounts.records[0];
|
|
69
|
+
counts.visitorSessions = Number(row.get("visitorSessions")?.valueOf?.() ?? row.get("visitorSessions") ?? 0);
|
|
70
|
+
counts.visitorEvents = Number(row.get("visitorEvents")?.valueOf?.() ?? row.get("visitorEvents") ?? 0);
|
|
71
|
+
counts.anonVisitors = Number(row.get("anonVisitors")?.valueOf?.() ?? row.get("anonVisitors") ?? 0);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
50
74
|
// Count Messages + Conversations via sessionId
|
|
51
75
|
if (sessionId) {
|
|
52
76
|
const convCountResult = await session.run(`MATCH (c:Conversation {conversationId: $sessionId, accountId: $accountId})
|
|
@@ -107,6 +131,15 @@ export async function contactErase(params) {
|
|
|
107
131
|
await tx.run(`MATCH (p:Person)-[:HAS_ACCESS]->(g:AccessGrant)
|
|
108
132
|
WHERE elementId(p) = $personNodeId
|
|
109
133
|
DELETE g`, { personNodeId });
|
|
134
|
+
// 3d-bis. Visitor-graph cascade (Task 357). :Page and :Listing are
|
|
135
|
+
// content metadata and intentionally preserved — they have no PII.
|
|
136
|
+
await tx.run(`MATCH (p:Person) WHERE elementId(p) = $personNodeId
|
|
137
|
+
OPTIONAL MATCH (p)-[:VISITED]->(vs:Session)
|
|
138
|
+
OPTIONAL MATCH (vs)-[:HAS_EVENT]->(ev)
|
|
139
|
+
DETACH DELETE ev, vs`, { personNodeId });
|
|
140
|
+
await tx.run(`MATCH (p:Person)-[:OWNS_VISITOR]->(av:AnonVisitor)
|
|
141
|
+
WHERE elementId(p) = $personNodeId
|
|
142
|
+
DETACH DELETE av`, { personNodeId });
|
|
110
143
|
// 3e. Delete Person node (DETACH DELETE to remove any remaining relationships)
|
|
111
144
|
await tx.run(`MATCH (p:Person) WHERE elementId(p) = $personNodeId
|
|
112
145
|
DETACH DELETE p`, { personNodeId });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-erase.js","sourceRoot":"","sources":["../../src/tools/contact-erase.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"contact-erase.js","sourceRoot":"","sources":["../../src/tools/contact-erase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAsC9D,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAA0B;IAE1B,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,GAAG,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IACxE,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE3B,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,kBAAkB,CACrD,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,EAC5B,SAAS,EACT,EAAE,cAAc,EAAE,IAAI,EAAE,CACzB,CAAC;IAEF,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAE7B,IAAI,CAAC;QACH,wDAAwD;QACxD,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,GAAG,CACpC,GAAG,WAAW;;mEAE+C,EAC7D,WAAW,CACZ,CAAC;QAEF,IAAI,Y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AAM;YACN,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO;SAChC,CAAC,CACH,CAAC;QAEF,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;IACjD,CAAC;YAAS,CAAC;QACT,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;AACH,CAAC"}
|
|
@@ -73,9 +73,9 @@ Every tool emits a single log line per invocation:
|
|
|
73
73
|
|
|
74
74
|
Diagnostic path: `grep -E '^\[aeo-' platform-logs/*.log | grep <urlOrEntityId>`.
|
|
75
75
|
|
|
76
|
-
## What this plugin does not do
|
|
76
|
+
## What this plugin does not do
|
|
77
77
|
|
|
78
|
-
- **No monitor.** Tracking whether your brand is cited by Claude / ChatGPT / Perplexity / Gemini
|
|
78
|
+
- **No citation monitor — out of scope.** Tracking whether your brand is cited by Claude / ChatGPT / Perplexity / Gemini would require multi-engine answer harvesting that doesn't fit maxy-code's no-API-key architecture. Archived without sprinting (Task 363). Check citation manually when needed.
|
|
79
79
|
- **No auto-emission on page render.** `aeo-emit-jsonld` is callable on demand. Wiring it into the platform's page-generator render path is per-renderer work, filed as a follow-up.
|
|
80
80
|
- **No publish-hook regeneration of `llms.txt`.** The tool runs on demand. Hooking it into the publish event is a follow-up.
|
|
81
81
|
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Visitor graph (Task 357)
|
|
2
|
+
|
|
3
|
+
Behavioural analytics that connect anonymous page visits to known `:Person` contacts. Replaces the anonymous click-through metric from Task 336 with a fully attributed graph.
|
|
4
|
+
|
|
5
|
+
## What this gives the operator
|
|
6
|
+
|
|
7
|
+
- A morning briefing surface: "who has been on the site overnight, and what did they look at?"
|
|
8
|
+
- An engagement-ranked nurture queue, ordered by recency × depth × dwell.
|
|
9
|
+
- A graph-backed click-through-rate report for property recommendations.
|
|
10
|
+
- A full event timeline for any one session, for prep and diagnosis.
|
|
11
|
+
- A signed-cookie that recognises a named visitor on later visits without re-clicking the marketing link.
|
|
12
|
+
|
|
13
|
+
## Data model
|
|
14
|
+
|
|
15
|
+
| Node | Meaning |
|
|
16
|
+
|------|---------|
|
|
17
|
+
| `:Session` | One browser tab session. Composite key `(accountId, sessionId)`. |
|
|
18
|
+
| `:AnonVisitor` | Pre-identification browser identity. Merges into `:Person` on first signed-token click. |
|
|
19
|
+
| `:PageView` | One page load. Carries `referrer`, `path`, optional `dwellMs`. |
|
|
20
|
+
| `:Click` | One DOM click on a tagged element (`data-track="<label>"`). |
|
|
21
|
+
| `:ScrollMilestone` | Roll-up of scroll depth — one node per `:PageView`, `maxDepth` ∈ {25,50,75,100}. |
|
|
22
|
+
| `:Page` | URL metadata. Content-only, survives erasure. |
|
|
23
|
+
| `:Recommendation` | Materialised `[property-recommended]` log line for CTR computation. |
|
|
24
|
+
|
|
25
|
+
| Edge | Direction |
|
|
26
|
+
|------|-----------|
|
|
27
|
+
| `VISITED` | `Person → Session` or `AnonVisitor → Session` |
|
|
28
|
+
| `OWNS_VISITOR` | `Person → AnonVisitor` (cross-session merge) |
|
|
29
|
+
| `HAS_EVENT` | `Session → PageView / Click / ScrollMilestone` |
|
|
30
|
+
| `OF_PAGE` | `PageView → Page` |
|
|
31
|
+
| `OF_LISTING` | `PageView → Listing` |
|
|
32
|
+
| `FOR_SESSION` | `Recommendation → Session` |
|
|
33
|
+
|
|
34
|
+
## How identity gets resolved
|
|
35
|
+
|
|
36
|
+
The signed-token cookie `mxy_v` carries a `:Person` elementId, signed HMAC-SHA256 with a brand-local 32-byte secret (file at `~/.<brand>/credentials/visitor-token-secret`, minted on first read). When the recommender's `/listings/<slug>/click?session=<sk>&v=<token>` URL is visited:
|
|
37
|
+
|
|
38
|
+
1. The click handler verifies the HMAC on `<token>`.
|
|
39
|
+
2. If valid, the same token value is written into `mxy_v` (Max-Age 30 days, SameSite=Lax, HttpOnly, Secure).
|
|
40
|
+
3. On subsequent visits, `POST /v/event` reads the cookie, verifies it, and attributes every event to the bound `:Person`.
|
|
41
|
+
|
|
42
|
+
When a previously-anonymous browser binds for the first time, any `:Session` already attributed to the `:AnonVisitor` is re-attached to the `:Person`, and the merge fires `[anonvisitor-merge]` with the count of reattributed sessions.
|
|
43
|
+
|
|
44
|
+
## Tools
|
|
45
|
+
|
|
46
|
+
All under the `real-agent-buyers` plugin, admin-side only:
|
|
47
|
+
|
|
48
|
+
| Tool | Purpose |
|
|
49
|
+
|------|---------|
|
|
50
|
+
| `visitor-recent-by-person` | Recent sessions for a known `:Person` (morning round, 1:1 prep). |
|
|
51
|
+
| `visitor-recent-by-page` | Recent visitors of a given listing slug or URL. |
|
|
52
|
+
| `visitor-engagement-score` | Engagement-ranked `:Person` list (nurture queue). |
|
|
53
|
+
| `visitor-recommendation-ctr` | Graph-backed CTR over a window. Replaces the Task 336 log-scan after the 14-day parity cutover. |
|
|
54
|
+
| `visitor-session-detail` | Full event timeline for one `:Session`. |
|
|
55
|
+
| `visitor-event-ingest` | Admin companion to `POST /v/event` for test harness work. |
|
|
56
|
+
| `visitor-backfill-from-logs` | One-shot importer: parses `[property-recommended]` and `[property-card-click]` log lines, computes a parity check, populates the graph. |
|
|
57
|
+
|
|
58
|
+
## Privacy
|
|
59
|
+
|
|
60
|
+
The full description is at `/privacy` on every brand domain. Highlights:
|
|
61
|
+
|
|
62
|
+
- First-party cookie only, no third-party scripts.
|
|
63
|
+
- 180-day default retention; configurable per brand via `brand.json:visitorGraphRetentionDays`.
|
|
64
|
+
- Right-to-erasure cascades through `contact-erase`: `:Session`, every `:HAS_EVENT` child, and any owned `:AnonVisitor` are removed when the `:Person` is erased. `:Page` and `:Listing` are content metadata and intentionally preserved.
|
|
65
|
+
|
|
66
|
+
## Verification
|
|
67
|
+
|
|
68
|
+
Quick checks the operator can run after deployment:
|
|
69
|
+
|
|
70
|
+
1. Load a published listing page; grep `[visitor-event] type=pageview` in `server.log` within 1s.
|
|
71
|
+
2. Scroll past 50%; grep `[visitor-event] type=scroll depth=50`.
|
|
72
|
+
3. Click an element marked `data-track="floorplan"`; grep `[visitor-event] type=click label=floorplan`.
|
|
73
|
+
4. Run `visitor-backfill-from-logs` over the existing Task 336 log window; the response includes `parityCheck=ok` when graph CTR matches log-scan CTR exactly.
|
|
74
|
+
|
|
75
|
+
## Failure signals
|
|
76
|
+
|
|
77
|
+
| Symptom | What it means | Where to look |
|
|
78
|
+
|---------|---------------|---------------|
|
|
79
|
+
| `[visitor-event]` count drops to zero with no `[v-event-error]` | Pixel silently failing on the brand domain (probably CSP, CORS, or origin mismatch). | Check brand.json `publishedSiteOrigins`; check browser console on a published listing page. |
|
|
80
|
+
| `[token-bind] reject reason=bad-sig` spikes | HMAC verify failing — either the secret rotated and old cookies are being rejected (expected during rotation) or the recommender is minting against a stale secret. | Compare `~/.<brand>/credentials/visitor-token-secret` across processes. |
|
|
81
|
+
| `[anonvisitor-merge]` never fires after first signed-token click | The pixel isn't reading the cookie. | Inspect the `mxy_v` cookie in DevTools; check CORS `Access-Control-Allow-Credentials: true`. |
|
|
82
|
+
| `[v-event-error] reason=rate-limit` for legitimate operator traffic | Operator IP shares a NAT with high-volume crawlers. | Adjust `RATE_LIMIT` in `visitor-event.ts` or whitelist the IP at the proxy. |
|
|
@@ -40,7 +40,11 @@ When loading this reference, confirm which schema files were consulted by noting
|
|
|
40
40
|
| WhatsApp Conversation (legacy) | `WhatsAppConversation` | extends `schema:Conversation` | — | `accountId`, `conversationId`, `archiveSourceFile`, `firstMessageAt`, `lastMessageAt`, `participantCount`, `messageCount`, `scope`, `createdByAgent`, `createdBySession`, `createdAt` |
|
|
41
41
|
| WhatsApp Message (legacy) | `WhatsAppMessage` | extends `schema:Message` | — | `accountId`, `conversationId`, `messageId`, `dateSent`, `body`, `senderName`, `sequenceIndex`, `scope`, `createdByAgent`, `createdBySession`, `createdAt` |
|
|
42
42
|
| ConversationArchive | `ConversationArchive` | platform-native (chunked conversation archive parent) | — | `accountId`, `conversationIdentity`, `archiveSourceFile`, `summary`, `keywords`, `lastIngestedMessageHash`, `lastIngestedMessageAt`, `lastIngestedArchiveSha256`, `scope`, `createdByAgent`, `createdBySession`, `createdAt` |
|
|
43
|
+
<<<<<<< HEAD
|
|
43
44
|
| AEO Audit | `AEOAudit` | platform-native (AEO audit history) | — | `accountId`, `auditId`, `target`, `score`, `heuristicsJson`, `runAt`, `createdByAgent`, `createdBySession`, `createdAt` |
|
|
45
|
+
=======
|
|
46
|
+
| Idea | `Idea` | platform-native (signal-detector original-thinking candidate) | — | `accountId`, `body`, `conversationId`, `scope`, `createdByAgent`, `createdBySession`, `createdAt` |
|
|
47
|
+
>>>>>>> worktree-task-352-idea-schema
|
|
44
48
|
|
|
45
49
|
**Branding properties on LocalBusiness:** `primaryColor`, `accentColor`, `backgroundColor`, `tagline` — optional, used to brand the public chat endpoint. Hex color values must match `#[0-9a-fA-F]{3,8}`. Logo and icon are linked via `HAS_BRAND_ASSET → ImageObject` with `purpose: "logo"` or `"icon"`.
|
|
46
50
|
|
|
@@ -56,6 +60,8 @@ When loading this reference, confirm which schema files were consulted by noting
|
|
|
56
60
|
|
|
57
61
|
**Position** carries a single role held by a `UserProfile` at an `Organization` — its title, dates, and per-role properties (e.g. achievement bullets in `description`, `endDate` for a finished role). Each role is its own node so it can carry its own structure; multiple Positions per UserProfile (career history); one Organization may host many Positions across many UserProfiles. Written by the `document-ingest` skill when a CV section classifies as `Position`. The natural pattern is `(:UserProfile)-[:HAS_POSITION]->(:Position)-[:AT]->(:Organization)` — never set the employer name as a property on Position; always create the AT edge to the (MERGEd) Organization.
|
|
58
62
|
|
|
63
|
+
**Idea** is a forward-only write surface for original-thinking candidates extracted from admin-side conversations by the `signal-detector` specialist (dispatched only by the admin agent's Stop hook). `body` is the verbatim operator statement; `conversationId` denormalises the source conversation; `scope` is always `"admin"`. Never written by any other path. No dedup or clustering at write time — let the brain accumulate first.
|
|
64
|
+
|
|
59
65
|
**Durable-action properties on Task:** `kind` (string discriminator, e.g. `"onboarding-establish-owner"`, `"cloudflare-tunnel-login"`), `steps` (string[], append-only as the action progresses), `startedAt` (ISO timestamp, set when status transitions to `running`), `completedAt` (ISO timestamp, set when status transitions to `completed` or `failed`), `errorMessage` (string, set when status=`failed`; cleared to `null` when the same Task transitions to `completed`), `inputsProvided` (string[] of property names supplied at action start — the canonical "call shape" record), `inputs.<field>` (Record of arbitrary non-secret JSON values from the action's form payload, redacted at write time per the schema declared at the form definition). All optional. Per-kind value-field enumeration is intentionally absent — values vary by what the action records, governed by the central `redactSecrets` primitive rather than per-kind allow-lists. The `running` status value joins the existing `pending|active|completed|failed|cancelled` enum to discriminate "an action is mid-flight in this conversation" from `active` ("a commitment the operator has accepted").
|
|
60
66
|
|
|
61
67
|
---
|
|
@@ -138,6 +144,7 @@ Do not write placeholder values ("TBD", "unknown", empty strings) for properties
|
|
|
138
144
|
(:Person|:AdminUser)-[:SENT]->(:Message)
|
|
139
145
|
(:Person|:AdminUser)-[:PARTICIPANT_IN]->(:Conversation)
|
|
140
146
|
(:Message)-[:NEXT]->(:Message)
|
|
147
|
+
(:Conversation)-[:HAS_IDEA]->(:Idea)
|
|
141
148
|
```
|
|
142
149
|
|
|
143
150
|
### WhatsApp ingest natural-key contract
|
|
@@ -226,6 +233,43 @@ Patterns with high occurrence count are candidates for new section-kind labels.
|
|
|
226
233
|
|
|
227
234
|
---
|
|
228
235
|
|
|
236
|
+
## Visitor Graph (Task 357)
|
|
237
|
+
|
|
238
|
+
Behavioural analytics — pixel events from operator-owned listing pages land here.
|
|
239
|
+
Cross-session attribution is via a signed-token cookie that the property-recommender
|
|
240
|
+
issues; the pixel never sees a third-party domain.
|
|
241
|
+
|
|
242
|
+
| Entity | Neo4j Label | schema.org | Description | Required Properties |
|
|
243
|
+
|---|---|---|---|---|
|
|
244
|
+
| Session | `Session` | (none — bespoke) | One browser tab session. | `accountId`, `sessionId`, `startedAt` |
|
|
245
|
+
| AnonVisitor | `AnonVisitor` | (none — bespoke) | Pre-identification browser identity. Merges into `:Person` on signed-token click. | `accountId`, `visitorId` |
|
|
246
|
+
| PageView | `PageView` | `schema:ViewAction` | One page load. One node per pageview; idempotent within 5s. | `accountId`, `occurredAt`, `referrer` |
|
|
247
|
+
| Click | `Click` | `schema:InteractAction` | DOM click on `data-track="<label>"` or a known interaction (gallery / floorplan). | `accountId`, `label`, `occurredAt` |
|
|
248
|
+
| ScrollMilestone | `ScrollMilestone` | (none — bespoke) | Roll-up: one node per PageView with `maxDepth` ∈ {25,50,75,100}. Updated in place. | `accountId`, `maxDepth` |
|
|
249
|
+
| Page | `Page` | `schema:WebPage` | URL metadata. Persists across erasure (no PII). | `accountId`, `url` |
|
|
250
|
+
| Recommendation | `Recommendation` | `schema:Recommendation` | Materialised `[property-recommended]` log line — what the recommender suggested for this session. | `accountId`, `sessionKey`, `listingSlug`, `recommendedAt` |
|
|
251
|
+
|
|
252
|
+
### Edges
|
|
253
|
+
|
|
254
|
+
| Edge | Direction | Note |
|
|
255
|
+
|---|---|---|
|
|
256
|
+
| `VISITED` | `Person` → `Session` or `AnonVisitor` → `Session` | One edge per session. Re-attribution on merge replaces the AnonVisitor edge with a Person edge. |
|
|
257
|
+
| `OWNS_VISITOR` | `Person` → `AnonVisitor` | Created on first signed-token click. Records the merge history. |
|
|
258
|
+
| `HAS_EVENT` | `Session` → `PageView` / `Click` / `ScrollMilestone` | Every event hangs off its Session. |
|
|
259
|
+
| `OF_PAGE` | `PageView` → `Page` | Click/Scroll inherit their Page through their PageView. |
|
|
260
|
+
| `OF_LISTING` | `PageView` → `Listing` | Optional: present when the URL was a known listing slug. |
|
|
261
|
+
| `FOR_SESSION` | `Recommendation` → `Session` | Joins recommendations to the session their CTR is computed against. |
|
|
262
|
+
|
|
263
|
+
### Cascade rules
|
|
264
|
+
|
|
265
|
+
- `contact-erase` on a `:Person` trashes every `(:Session)<-[:VISITED]-(:Person)` and every `(:Session)-[:HAS_EVENT]->(*)` reachable from it. Uses the same `trashNode` pattern as `profile-delete`.
|
|
266
|
+
- `:Page` and `:Listing` are content metadata — they do not cascade.
|
|
267
|
+
- `:Recommendation` cascades only when its `:Session` cascades; orphan `:Recommendation`s without a session never exist (the writer always pairs them).
|
|
268
|
+
|
|
269
|
+
### Retention
|
|
270
|
+
|
|
271
|
+
`accountId`-scoped setting `visitorGraphRetentionDays` (default 180). Sessions older than the retention window are trashed by a separate cron — wired in this task as a setting, the cron itself is filed as a follow-up. The privacy page surfaces the active value.
|
|
272
|
+
|
|
229
273
|
## Order Node — Disambiguation
|
|
230
274
|
|
|
231
275
|
The base `Order` label is used for general jobs and orders. Several vertical schemas define specialised subtypes that also map to `schema:Order` but use different Neo4j labels:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "real-agent-buyers",
|
|
3
|
-
"description": "Full buyer lifecycle — enquiry handling, qualification, viewing management, feedback collection, educational guides,
|
|
3
|
+
"description": "Full buyer lifecycle — enquiry handling, qualification, viewing management, feedback collection, educational guides, the public-chat property recommender, and the visitor-graph analytics that link page behaviour to known :Person contacts (Task 357).",
|
|
4
4
|
"version": "0.1.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Rubytech LLC"
|
|
@@ -1,7 +1,29 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: real-agent-buyers
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
mcp-manifest: skip
|
|
4
|
+
description: "Full buyer lifecycle — enquiry handling, qualification, viewing management, feedback collection, educational guides, the public-chat property recommender, and the visitor-graph analytics that link page behaviour to known :Person contacts (Task 357)."
|
|
5
|
+
tools:
|
|
6
|
+
- name: visitor-recent-by-person
|
|
7
|
+
publicAllowlist: false
|
|
8
|
+
adminAllowlist: true
|
|
9
|
+
- name: visitor-recent-by-page
|
|
10
|
+
publicAllowlist: false
|
|
11
|
+
adminAllowlist: true
|
|
12
|
+
- name: visitor-engagement-score
|
|
13
|
+
publicAllowlist: false
|
|
14
|
+
adminAllowlist: true
|
|
15
|
+
- name: visitor-recommendation-ctr
|
|
16
|
+
publicAllowlist: false
|
|
17
|
+
adminAllowlist: true
|
|
18
|
+
- name: visitor-session-detail
|
|
19
|
+
publicAllowlist: false
|
|
20
|
+
adminAllowlist: true
|
|
21
|
+
- name: visitor-event-ingest
|
|
22
|
+
publicAllowlist: false
|
|
23
|
+
adminAllowlist: true
|
|
24
|
+
- name: visitor-backfill-from-logs
|
|
25
|
+
publicAllowlist: false
|
|
26
|
+
adminAllowlist: true
|
|
5
27
|
always: false
|
|
6
28
|
metadata: {"platform":{"optional":true,"embed":["public","admin"]}}
|
|
7
29
|
---
|
|
@@ -27,8 +49,16 @@ The user is handling buyer enquiries, qualifying applicants, managing viewings,
|
|
|
27
49
|
|
|
28
50
|
## Tools Used
|
|
29
51
|
|
|
30
|
-
|
|
52
|
+
Skills operate via existing platform tools plus the visitor-graph MCP added in Task 357:
|
|
53
|
+
|
|
31
54
|
- `memory-search` — retrieve domain knowledge from the knowledge base
|
|
55
|
+
- `visitor-recent-by-person` — recent :Session activity for a :Person (morning round, 1:1 prep)
|
|
56
|
+
- `visitor-recent-by-page` — who has viewed a listing recently (operator side-bar)
|
|
57
|
+
- `visitor-engagement-score` — engagement-ranked :Person list (nurture queue)
|
|
58
|
+
- `visitor-recommendation-ctr` — recommendation CTR over a window (replaces Task 336 log-scan after 14-day parity)
|
|
59
|
+
- `visitor-session-detail` — full event timeline for one :Session
|
|
60
|
+
- `visitor-event-ingest` — admin-side companion to `POST /v/event` for test harness work
|
|
61
|
+
- `visitor-backfill-from-logs` — one-shot importer for Task 336/294 logs with parity check
|
|
32
62
|
|
|
33
63
|
## References
|
|
34
64
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// buyers MCP server — visitor-graph tools (Task 357).
|
|
2
|
+
//
|
|
3
|
+
// Seven tools, all admin-side (none exposed on the public agent):
|
|
4
|
+
// visitor-recent-by-person query
|
|
5
|
+
// visitor-recent-by-page query
|
|
6
|
+
// visitor-engagement-score query
|
|
7
|
+
// visitor-recommendation-ctr query (replaces 336 log-scan after parity)
|
|
8
|
+
// visitor-session-detail query
|
|
9
|
+
// visitor-event-ingest write (test harness / manual replay)
|
|
10
|
+
// visitor-backfill-from-logs write (one-shot importer + parity check)
|
|
11
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
12
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
import { closeDriver } from "./lib/neo4j.js";
|
|
15
|
+
import { visitorRecentByPerson } from "./tools/visitor-recent-by-person.js";
|
|
16
|
+
import { visitorRecentByPage } from "./tools/visitor-recent-by-page.js";
|
|
17
|
+
import { visitorEngagementScore } from "./tools/visitor-engagement-score.js";
|
|
18
|
+
import { visitorRecommendationCtr } from "./tools/visitor-recommendation-ctr.js";
|
|
19
|
+
import { visitorSessionDetail } from "./tools/visitor-session-detail.js";
|
|
20
|
+
import { visitorEventIngest } from "./tools/visitor-event-ingest.js";
|
|
21
|
+
import { visitorBackfillFromLogs } from "./tools/visitor-backfill-from-logs.js";
|
|
22
|
+
const accountId = process.env.ACCOUNT_ID ?? "local";
|
|
23
|
+
const server = new McpServer({ name: "maxy-buyers", version: "0.1.0" });
|
|
24
|
+
console.error(`[buyers] server started, account=${accountId}`);
|
|
25
|
+
function jsonHandler(fn) {
|
|
26
|
+
return async (params) => {
|
|
27
|
+
try {
|
|
28
|
+
const result = await fn({ ...params, accountId });
|
|
29
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
return {
|
|
33
|
+
content: [{ type: "text", text: `Error: ${err instanceof Error ? err.message : String(err)}` }],
|
|
34
|
+
isError: true,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
server.tool("visitor-recent-by-person", "List recent visitor sessions for a known :Person. Returns per-session pageview/click/scroll/dwell counts and the listings each session touched. Use for morning-round briefings and 1:1 outreach context.", {
|
|
40
|
+
personId: z.string().min(1).describe(":Person elementId"),
|
|
41
|
+
sinceDays: z.number().int().positive().optional().describe("Lookback window in days (default 30)"),
|
|
42
|
+
limit: z.number().int().positive().max(200).optional().describe("Max sessions to return (default 50)"),
|
|
43
|
+
}, jsonHandler((p) => visitorRecentByPerson(p)));
|
|
44
|
+
server.tool("visitor-recent-by-page", "List recent visitors (Person + AnonVisitor) of a given listing slug or URL. Use to answer 'who has shown interest in 12 Oak Street this week?'.", {
|
|
45
|
+
listingSlug: z.string().optional().describe("Listing slug (one of slug/url required)"),
|
|
46
|
+
url: z.string().optional().describe("Page URL (one of slug/url required)"),
|
|
47
|
+
sinceDays: z.number().int().positive().optional().describe("Lookback window in days (default 7)"),
|
|
48
|
+
limit: z.number().int().positive().max(200).optional().describe("Max visitors to return (default 50)"),
|
|
49
|
+
}, jsonHandler((p) => visitorRecentByPage(p)));
|
|
50
|
+
server.tool("visitor-engagement-score", "Engagement-ranked :Person list. score = visits * recency * scroll_depth * dwell. Use to build the nurture-list and prioritise outbound.", {
|
|
51
|
+
sinceDays: z.number().int().positive().optional().describe("Lookback window in days (default 30)"),
|
|
52
|
+
limit: z.number().int().positive().max(200).optional().describe("Max persons (default 50)"),
|
|
53
|
+
}, jsonHandler((p) => visitorEngagementScore(p)));
|
|
54
|
+
server.tool("visitor-recommendation-ctr", "Graph-backed click-through rate for property recommendations over a window. Replaces the Task 336 log-scan after the 14-day parity cutover.", {
|
|
55
|
+
sinceDays: z.number().int().positive().optional().describe("Lookback window in days (default 7)"),
|
|
56
|
+
listingSlug: z.string().optional().describe("Optional listing-slug filter"),
|
|
57
|
+
}, jsonHandler((p) => visitorRecommendationCtr(p)));
|
|
58
|
+
server.tool("visitor-session-detail", "Full event timeline for one :Session (pageviews, clicks, scroll milestones in chronological order). Use for diagnosis and outreach prep.", {
|
|
59
|
+
sessionId: z.string().min(1).describe(":Session.sessionId"),
|
|
60
|
+
}, jsonHandler((p) => visitorSessionDetail(p)));
|
|
61
|
+
server.tool("visitor-event-ingest", "Admin-side companion to POST /v/event for test harness and manual replay. Writes a single event into the graph.", {
|
|
62
|
+
type: z.enum(["pageview", "click", "scroll", "dwell"]).describe("Event type"),
|
|
63
|
+
sessionId: z.string().min(1).describe("Client-provided session id"),
|
|
64
|
+
visitorId: z.string().min(1).describe("Client-provided visitor id"),
|
|
65
|
+
personId: z.string().optional().nullable().describe("Optional :Person elementId override"),
|
|
66
|
+
url: z.string().min(1).describe("Page URL"),
|
|
67
|
+
path: z.string().optional(),
|
|
68
|
+
title: z.string().optional(),
|
|
69
|
+
pageViewId: z.string().optional(),
|
|
70
|
+
site: z.string().optional(),
|
|
71
|
+
referrer: z.string().optional(),
|
|
72
|
+
label: z.string().optional().describe("Click label (data-track value)"),
|
|
73
|
+
href: z.string().optional(),
|
|
74
|
+
depth: z.number().int().min(0).max(100).optional().describe("Scroll depth (25/50/75/100)"),
|
|
75
|
+
dwellMs: z.number().int().min(0).optional(),
|
|
76
|
+
occurredAt: z.string().optional().describe("ISO timestamp override"),
|
|
77
|
+
}, jsonHandler((p) => visitorEventIngest(p)));
|
|
78
|
+
server.tool("visitor-backfill-from-logs", "One-shot importer: parse [property-recommended] and [property-card-click] log lines and write into the visitor graph. Idempotent for Recommendations; immutable for Click events. Reports a parityCheck comparing graph counts to log counts.", {
|
|
79
|
+
logPath: z.string().min(1).describe("Absolute path to the platform log file"),
|
|
80
|
+
sinceIso: z.string().optional().describe("ISO timestamp lower bound (inclusive)"),
|
|
81
|
+
untilIso: z.string().optional().describe("ISO timestamp upper bound (exclusive)"),
|
|
82
|
+
batchSize: z.number().int().positive().max(2000).optional().describe("Lines per Cypher batch (default 200)"),
|
|
83
|
+
}, jsonHandler((p) => visitorBackfillFromLogs(p)));
|
|
84
|
+
process.on("SIGINT", async () => {
|
|
85
|
+
console.error("[buyers] SIGINT — closing driver");
|
|
86
|
+
await closeDriver();
|
|
87
|
+
process.exit(0);
|
|
88
|
+
});
|
|
89
|
+
process.on("SIGTERM", async () => {
|
|
90
|
+
console.error("[buyers] SIGTERM — closing driver");
|
|
91
|
+
await closeDriver();
|
|
92
|
+
process.exit(0);
|
|
93
|
+
});
|
|
94
|
+
const transport = new StdioServerTransport();
|
|
95
|
+
await server.connect(transport);
|
|
96
|
+
console.error("[buyers] ready");
|
|
97
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,EAAE;AACF,kEAAkE;AAClE,wCAAwC;AACxC,wCAAwC;AACxC,wCAAwC;AACxC,6EAA6E;AAC7E,wCAAwC;AACxC,uEAAuE;AACvE,2EAA2E;AAE3E,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAEhF,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,OAAO,CAAC;AAEpD,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,EAA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AC,IAAI,CAAC,CAKjD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Neo4j driver/session helper — same pattern as loop/mcp/src/lib/neo4j.ts.
|
|
2
|
+
// NEO4J_URI must be explicit; defaulting to localhost cross-pollinates
|
|
3
|
+
// Maxy and Real Agent databases on a shared dev host.
|
|
4
|
+
import neo4j from "neo4j-driver";
|
|
5
|
+
import { readFileSync } from "node:fs";
|
|
6
|
+
import { resolve } from "node:path";
|
|
7
|
+
let driver = null;
|
|
8
|
+
function readPassword() {
|
|
9
|
+
if (process.env.NEO4J_PASSWORD)
|
|
10
|
+
return process.env.NEO4J_PASSWORD;
|
|
11
|
+
const passwordFile = resolve(process.env.PLATFORM_ROOT ?? resolve(import.meta.dirname, "../../../.."), "config/.neo4j-password");
|
|
12
|
+
try {
|
|
13
|
+
return readFileSync(passwordFile, "utf-8").trim();
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
throw new Error(`Neo4j password not found. Expected at ${passwordFile} or in NEO4J_PASSWORD env var.`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export function getDriver() {
|
|
20
|
+
if (!driver) {
|
|
21
|
+
const uri = process.env.NEO4J_URI;
|
|
22
|
+
if (!uri)
|
|
23
|
+
throw new Error("[buyers] NEO4J_URI unset — refusing to default to bolt://localhost:7687");
|
|
24
|
+
const user = process.env.NEO4J_USER ?? "neo4j";
|
|
25
|
+
const password = readPassword();
|
|
26
|
+
console.error(`[buyers] resolved neo4j_uri=${uri}`);
|
|
27
|
+
driver = neo4j.driver(uri, neo4j.auth.basic(user, password));
|
|
28
|
+
}
|
|
29
|
+
return driver;
|
|
30
|
+
}
|
|
31
|
+
export function getSession() {
|
|
32
|
+
return getDriver().session();
|
|
33
|
+
}
|
|
34
|
+
export async function closeDriver() {
|
|
35
|
+
if (driver) {
|
|
36
|
+
await driver.close();
|
|
37
|
+
driver = null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMapping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EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,OAAO,SAAS,EAAE,CAAC,OAAO,EAAE,CAAC;AAC/B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW;IAC/B,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACrB,MAAM,GAAG,IAAI,CAAC;IAChB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface BackfillParams {
|
|
2
|
+
accountId: string;
|
|
3
|
+
logPath: string;
|
|
4
|
+
sinceIso?: string;
|
|
5
|
+
untilIso?: string;
|
|
6
|
+
batchSize?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface BackfillResult {
|
|
9
|
+
windowStart: string | null;
|
|
10
|
+
windowEnd: string | null;
|
|
11
|
+
recommendedParsed: number;
|
|
12
|
+
recommendedWritten: number;
|
|
13
|
+
recommendedSkippedDuplicate: number;
|
|
14
|
+
clickedParsed: number;
|
|
15
|
+
clickedWritten: number;
|
|
16
|
+
unparseable: number;
|
|
17
|
+
parityCheck: "ok" | "mismatch";
|
|
18
|
+
parityDelta: {
|
|
19
|
+
recommended: number;
|
|
20
|
+
clicked: number;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export declare function visitorBackfillFromLogs(p: BackfillParams): Promise<BackfillResult>;
|
|
24
|
+
//# sourceMappingURL=visitor-backfill-from-logs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visitor-backfill-from-logs.d.ts","sourceRoot":"","sources":["../../src/tools/visitor-backfill-from-logs.ts"],"names":[],"mappings":"AA2BA,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,2BAA2B,EAAE,MAAM,CAAC;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,IAAI,GAAG,UAAU,CAAC;IAC/B,WAAW,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CACvD;AA2BD,wBAAsB,uBAAuB,CAAC,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAmHxF"}
|