@rubytech/create-maxy 1.0.881 → 1.0.884

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.
Files changed (67) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/lib/graph-mcp/dist/index.js +45 -0
  3. package/payload/platform/lib/graph-mcp/dist/index.js.map +1 -1
  4. package/payload/platform/lib/graph-mcp/src/index.ts +47 -0
  5. package/payload/platform/lib/graph-write/dist/__tests__/action-provenance-gate.test.js +57 -9
  6. package/payload/platform/lib/graph-write/dist/__tests__/action-provenance-gate.test.js.map +1 -1
  7. package/payload/platform/lib/graph-write/dist/conversation-provenance.d.ts +26 -0
  8. package/payload/platform/lib/graph-write/dist/conversation-provenance.d.ts.map +1 -0
  9. package/payload/platform/lib/graph-write/dist/conversation-provenance.js +81 -0
  10. package/payload/platform/lib/graph-write/dist/conversation-provenance.js.map +1 -0
  11. package/payload/platform/lib/graph-write/dist/index.d.ts +38 -16
  12. package/payload/platform/lib/graph-write/dist/index.d.ts.map +1 -1
  13. package/payload/platform/lib/graph-write/dist/index.js +75 -35
  14. package/payload/platform/lib/graph-write/dist/index.js.map +1 -1
  15. package/payload/platform/lib/graph-write/src/__tests__/action-provenance-gate.test.ts +59 -9
  16. package/payload/platform/lib/graph-write/src/conversation-provenance.ts +140 -0
  17. package/payload/platform/lib/graph-write/src/index.ts +76 -35
  18. package/payload/platform/lib/mcp-eager/dist/index.d.ts +61 -0
  19. package/payload/platform/lib/mcp-eager/dist/index.d.ts.map +1 -0
  20. package/payload/platform/lib/mcp-eager/dist/index.js +49 -0
  21. package/payload/platform/lib/mcp-eager/dist/index.js.map +1 -0
  22. package/payload/platform/lib/mcp-eager/src/index.ts +78 -0
  23. package/payload/platform/lib/mcp-eager/tsconfig.json +8 -0
  24. package/payload/platform/package.json +2 -2
  25. package/payload/platform/plugins/admin/mcp/dist/__tests__/plugin-read-skill-resolution.test.js +26 -2
  26. package/payload/platform/plugins/admin/mcp/dist/__tests__/plugin-read-skill-resolution.test.js.map +1 -1
  27. package/payload/platform/plugins/admin/mcp/dist/index.js +36 -33
  28. package/payload/platform/plugins/admin/mcp/dist/index.js.map +1 -1
  29. package/payload/platform/plugins/admin/mcp/dist/skill-resolution.d.ts +5 -1
  30. package/payload/platform/plugins/admin/mcp/dist/skill-resolution.d.ts.map +1 -1
  31. package/payload/platform/plugins/admin/mcp/dist/skill-resolution.js +24 -8
  32. package/payload/platform/plugins/admin/mcp/dist/skill-resolution.js.map +1 -1
  33. package/payload/platform/plugins/contacts/PLUGIN.md +8 -0
  34. package/payload/platform/plugins/contacts/mcp/dist/index.js +10 -9
  35. package/payload/platform/plugins/contacts/mcp/dist/index.js.map +1 -1
  36. package/payload/platform/plugins/contacts/mcp/dist/tools/contact-create.d.ts.map +1 -1
  37. package/payload/platform/plugins/contacts/mcp/dist/tools/contact-create.js +17 -2
  38. package/payload/platform/plugins/contacts/mcp/dist/tools/contact-create.js.map +1 -1
  39. package/payload/platform/plugins/docs/references/internals.md +15 -2
  40. package/payload/platform/plugins/docs/references/plugins-guide.md +2 -0
  41. package/payload/platform/plugins/email/mcp/dist/index.js +10 -9
  42. package/payload/platform/plugins/email/mcp/dist/index.js.map +1 -1
  43. package/payload/platform/plugins/memory/PLUGIN.md +5 -3
  44. package/payload/platform/plugins/memory/mcp/dist/index.js +10 -9
  45. package/payload/platform/plugins/memory/mcp/dist/index.js.map +1 -1
  46. package/payload/platform/plugins/memory/mcp/dist/tools/memory-write.d.ts.map +1 -1
  47. package/payload/platform/plugins/memory/mcp/dist/tools/memory-write.js +18 -1
  48. package/payload/platform/plugins/memory/mcp/dist/tools/memory-write.js.map +1 -1
  49. package/payload/platform/plugins/scheduling/mcp/dist/index.js +9 -8
  50. package/payload/platform/plugins/scheduling/mcp/dist/index.js.map +1 -1
  51. package/payload/platform/plugins/tasks/mcp/dist/index.js +15 -14
  52. package/payload/platform/plugins/tasks/mcp/dist/index.js.map +1 -1
  53. package/payload/platform/plugins/telegram/mcp/dist/index.js +4 -3
  54. package/payload/platform/plugins/telegram/mcp/dist/index.js.map +1 -1
  55. package/payload/platform/plugins/workflows/mcp/dist/index.js +9 -8
  56. package/payload/platform/plugins/workflows/mcp/dist/index.js.map +1 -1
  57. package/payload/platform/scripts/__tests__/logs-read-prefix.sh +341 -0
  58. package/payload/platform/scripts/logs-read.sh +108 -41
  59. package/payload/platform/scripts/logs-read.test.sh +6 -2
  60. package/payload/platform/templates/agents/admin/IDENTITY.md +1 -1
  61. package/payload/premium-plugins/real-agency/BUNDLE.md +1 -1
  62. package/payload/server/chunk-5PQU2HW2.js +11672 -0
  63. package/payload/server/chunk-ECAQVMRA.js +759 -0
  64. package/payload/server/chunk-K7S5T4VG.js +11534 -0
  65. package/payload/server/cloudflare-task-tracker-JNZXLW32.js +22 -0
  66. package/payload/server/maxy-edge.js +2 -2
  67. package/payload/server/server.js +38 -6
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,YAAY,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,EAAE,WAAW,CAAC,MAAM,CAQvD,CAAC;AAiBH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,UAAU,GAAG,UAAU,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,SAAS;IACxB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6FAA6F;IAC7F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iFAAiF;IACjF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uFAAuF;IACvF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM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tB;AAED,MAAM,WAAW,SAAS;IACxB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6FAA6F;IAC7F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iFAAiF;IACjF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uFAAuF;IACvF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,4EAA4E;IAC5E,aAAa,EAAE,iBAAiB,EAAE,CAAC;IACnC,SAAS,EAAE,SAAS,CAAC;IACrB;;;;;;;;;;OAUG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,uDAAuD;AACvD,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,SAAS,EAAE,SAAS,GACnB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQzB;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,eAAe,CAAC,CA+M1B"}
@@ -14,13 +14,17 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.ACTION_PROVENANCE_LABELS = void 0;
17
+ exports.PROVENANCE_SOURCE_LABELS = exports.ACTION_PROVENANCE_LABELS = void 0;
18
18
  exports.stampCreatedBy = stampCreatedBy;
19
19
  exports.writeNodeWithEdges = writeNodeWithEdges;
20
20
  // Task 796: re-export the post-write audit so consumers (graph-mcp shim)
21
21
  // import from the same package as `writeNodeWithEdges`. Keeps the
22
22
  // `[graph-*]` log family colocated.
23
23
  __exportStar(require("./audit.js"), exports);
24
+ // Task 997: re-export the conversation-provenance injector. MCP wrappers
25
+ // (contacts, memory) import it from the package root so the helper, the
26
+ // gate, and the label set live in one import surface.
27
+ __exportStar(require("./conversation-provenance.js"), exports);
24
28
  /**
25
29
  * Write doctrine (Task 673): a node without at least one adjacency is noise,
26
30
  * not knowledge. `writeNodeWithEdges` is the single primitive every graph
@@ -31,21 +35,33 @@ __exportStar(require("./audit.js"), exports);
31
35
  * maps, and flat props are queryable — `MATCH (n) WHERE n.createdBySession
32
36
  * = $id RETURN n` is the forensic entry point).
33
37
  *
34
- * Process provenance doctrine (Task 885): writes targeting any label in
35
- * `ACTION_PROVENANCE_LABELS` (Person, UserProfile, AdminUser, Organization,
36
- * LocalBusiness, CloudflareTunnel, CloudflareHostname) must include exactly
37
- * one inbound `:PRODUCED` edge whose source is a `:Task` node. This makes
38
- * every durable LLM-tool-driven entity creation traversable from the Task
39
- * node that produced it, and forward from Task→Conversation via
40
- * `:RAISED_DURING`. Bootstrap writes (`createdBy.agent === 'system'`) are
41
- * exempt installer / migration / lazy-create paths run as system writers.
38
+ * Process provenance doctrine (Task 885, widened by Task 997): writes
39
+ * targeting any label in `ACTION_PROVENANCE_LABELS` (Person, UserProfile,
40
+ * AdminUser, Organization, LocalBusiness, CloudflareTunnel,
41
+ * CloudflareHostname) must include at least one inbound `:PRODUCED` edge
42
+ * whose source carries one of `:Task`, `:Conversation`, or `:Message` (the
43
+ * label set is checked against the actual `labels()` of the target node, so
44
+ * subtype labels like `:AdminConversation`, `:UserMessage`, `:AssistantMessage`,
45
+ * and `:AdminMessage` all qualify). This makes every durable LLM-tool-driven
46
+ * entity creation traversable from either:
47
+ * - the Task that produced it (autonomous workflows: onboarding skill,
48
+ * cloudflare tunnel-login, etc.), or
49
+ * - the Conversation/Message turn that triggered it (direct admin asks —
50
+ * "add Anneke Roux as person" stamps a `:PRODUCED` edge from the active
51
+ * `:AdminConversation` so the entity is traceable to its causal turn
52
+ * without forcing the agent to mint a synthetic `:Task` per ask).
53
+ * Task 997 broadened the gate after the Task-only requirement created
54
+ * redundant-Task bloat for direct admin asks; the Task-mediated path stays
55
+ * canonical for autonomous workflows. Bootstrap writes
56
+ * (`createdBy.agent === 'system'`) are exempt — installer / migration /
57
+ * lazy-create paths run as system writers.
42
58
  *
43
59
  * Rejection paths (every one emits a stderr log the admin server pipes to
44
60
  * server.log, so orphan pressure is visible per-write not just in the
45
61
  * hourly [graph-health] signal):
46
62
  * - zero relationships → `[graph-write] reject reason=zero-relationships`
47
63
  * - unresolved target id → `[graph-write] reject reason=unresolved-target`
48
- * - missing action provenance → `[graph-write] reject reason=missing-action-provenance`
64
+ * - missing provenance → `[graph-write] reject reason=missing-provenance`
49
65
  * - removed-feature write → `[graph-write] reject reason=removed-feature`
50
66
  * (`:ReviewAlert` and `:Event {actionTool:"review-digest-compose"}` are
51
67
  * deleted features; the gate catches doctrine-compliant writers
@@ -59,16 +75,18 @@ __exportStar(require("./audit.js"), exports);
59
75
  * this field for access control — it is forensic, not a security boundary.
60
76
  */
61
77
  /**
62
- * Labels that require an inbound `:PRODUCED` edge from a `:Task` (Task 885).
63
- * Bootstrap writes with `createdBy.agent === 'system'` are exempt that
64
- * carve-out covers PIN-setup `writeAdminUserAndPerson`, schema migrations,
65
- * and the lazy `loadUserProfile` MERGE path that bypasses this primitive
66
- * entirely (raw Cypher in `platform/ui/app/lib/neo4j-store.ts`).
78
+ * Labels that require an inbound `:PRODUCED` edge from a `:Task`,
79
+ * `:Conversation`, or `:Message` (Task 885, widened by Task 997). Bootstrap
80
+ * writes with `createdBy.agent === 'system'` are exempt — that carve-out
81
+ * covers PIN-setup `writeAdminUserAndPerson`, schema migrations, and the
82
+ * lazy `loadUserProfile` MERGE path that bypasses this primitive entirely
83
+ * (raw Cypher in `platform/ui/app/lib/neo4j-store.ts`).
67
84
  *
68
85
  * The set is intentionally not exhaustive — labels added here become a
69
86
  * blocking gate for every LLM-tool write of that label. Add a label only
70
- * after every legitimate writer of it can either (a) carry a Task-PRODUCED
71
- * edge, or (b) declare itself as `agent: 'system'`.
87
+ * after every legitimate writer of it can either (a) carry a PRODUCED edge
88
+ * from one of the accepted source families, or (b) declare itself as
89
+ * `agent: 'system'`.
72
90
  */
73
91
  exports.ACTION_PROVENANCE_LABELS = new Set([
74
92
  "Person",
@@ -79,6 +97,17 @@ exports.ACTION_PROVENANCE_LABELS = new Set([
79
97
  "CloudflareTunnel",
80
98
  "CloudflareHostname",
81
99
  ]);
100
+ /**
101
+ * Source labels that satisfy the inbound-PRODUCED gate. The check is
102
+ * performed against the full `labels()` array of the target node, so
103
+ * subtype labels (`:AdminConversation`, `:UserMessage`, etc.) qualify
104
+ * because they carry the parent `:Conversation` / `:Message` label too.
105
+ */
106
+ exports.PROVENANCE_SOURCE_LABELS = new Set([
107
+ "Task",
108
+ "Conversation",
109
+ "Message",
110
+ ]);
82
111
  function requiresActionProvenance(labels) {
83
112
  for (const label of labels) {
84
113
  if (exports.ACTION_PROVENANCE_LABELS.has(label))
@@ -86,7 +115,7 @@ function requiresActionProvenance(labels) {
86
115
  }
87
116
  return false;
88
117
  }
89
- function findProducedFromTaskCandidates(relationships) {
118
+ function findProvenanceCandidates(relationships) {
90
119
  return relationships.filter((r) => r.type === "PRODUCED" && r.direction === "incoming");
91
120
  }
92
121
  /** Stamp flattened provenance into node properties. */
@@ -167,26 +196,37 @@ async function writeNodeWithEdges(params) {
167
196
  process.stderr.write(`[graph-write] reject reason=unresolved-target labels=${labelCsv} agent=${agentLabel} requested=${uniqueRequested} found=${found}\n`);
168
197
  throw new Error(`Write doctrine violated: ${uniqueRequested - found} of ${uniqueRequested} relationship target(s) did not resolve (elementId mismatch). No node created.`);
169
198
  }
170
- // Process provenance gate (Task 885). Labels in
171
- // ACTION_PROVENANCE_LABELS require a `:Task` source on at least one
172
- // inbound :PRODUCED edge so every durable LLM-tool entity write is
173
- // traversable from the Task that produced it. Bootstrap writes
174
- // (createdBy.agent === 'system') are exempt installer + migration
175
- // paths predate any Task. The check runs INSIDE the transaction so
176
- // the labels-by-target map is consistent with target resolution.
177
- let producedByTaskId = null;
199
+ // Process provenance gate (Task 885, widened by Task 997). Labels in
200
+ // ACTION_PROVENANCE_LABELS require an inbound :PRODUCED edge from a
201
+ // node carrying one of PROVENANCE_SOURCE_LABELS (:Task, :Conversation,
202
+ // :Message subtype labels qualify via the labels() array). This
203
+ // makes every durable LLM-tool entity write traversable to either the
204
+ // Task that produced it (autonomous workflows) or the
205
+ // Conversation/Message turn that triggered it (direct admin asks).
206
+ // Bootstrap writes (createdBy.agent === 'system') are exempt —
207
+ // installer + migration paths predate any provenance node. The check
208
+ // runs INSIDE the transaction so the labels-by-target map is
209
+ // consistent with target resolution.
210
+ let provenanceSourceId = null;
211
+ let provenanceSourceLabel = null;
178
212
  if (requiresActionProvenance(labels) &&
179
213
  (createdBy.agent ?? "") !== "system") {
180
- const candidates = findProducedFromTaskCandidates(relationships);
181
- const taskCandidates = candidates.filter((r) => {
214
+ const candidates = findProvenanceCandidates(relationships);
215
+ const matched = candidates
216
+ .map((r) => {
182
217
  const lbls = labelsByTarget.get(r.targetNodeId);
183
- return Array.isArray(lbls) && lbls.includes("Task");
184
- });
185
- if (taskCandidates.length === 0) {
186
- process.stderr.write(`[graph-write] reject reason=missing-action-provenance labels=${labelCsv} agent=${agentLabel}\n`);
187
- throw new Error(`missing-action-provenance: write to ${labelCsv} requires an inbound :PRODUCED edge from a :Task (createdBy.agent='${agentLabel}'). Pass producedByTaskId on the write — call task-create at the start of the flow and thread the returned taskId through every subsequent memory-write for one of these labels.`);
218
+ if (!Array.isArray(lbls))
219
+ return null;
220
+ const sourceLabel = lbls.find((l) => exports.PROVENANCE_SOURCE_LABELS.has(l));
221
+ return sourceLabel ? { rel: r, sourceLabel } : null;
222
+ })
223
+ .filter((m) => m !== null);
224
+ if (matched.length === 0) {
225
+ process.stderr.write(`[graph-write] reject reason=missing-provenance labels=${labelCsv} agent=${agentLabel}\n`);
226
+ throw new Error(`missing-provenance: write to ${labelCsv} requires an inbound :PRODUCED edge from a :Task, :Conversation, or :Message (createdBy.agent='${agentLabel}'). Either pass producedByTaskId on the write (autonomous workflows: call task-create at the start of the flow and thread the returned taskId), or rely on the MCP wrapper's CONVERSATION_NODE_ID env-stamp injection (direct admin asks).`);
188
227
  }
189
- producedByTaskId = taskCandidates[0].targetNodeId;
228
+ provenanceSourceId = matched[0].rel.targetNodeId;
229
+ provenanceSourceLabel = matched[0].sourceLabel;
190
230
  }
191
231
  let nodeRes;
192
232
  try {
@@ -241,7 +281,7 @@ async function writeNodeWithEdges(params) {
241
281
  process.stderr.write(`[graph-write] reject reason=edge-count-mismatch labels=${labelCsv} agent=${agentLabel} requested=${relationships.length} created=${edgesCreated}\n`);
242
282
  throw new Error(`Write doctrine violated: expected ${relationships.length} edges, created ${edgesCreated}. Transaction rolled back.`);
243
283
  }
244
- process.stderr.write(`[graph-write] accepted labels=${labelCsv} edges=${edgesCreated} createdByAgent=${createdBy.agent ?? "unknown"} createdByTool=${createdBy.tool ?? createdBy.source ?? "unknown"} producedByTask=${producedByTaskId ?? "none"}\n`);
284
+ process.stderr.write(`[graph-write] accepted labels=${labelCsv} edges=${edgesCreated} createdByAgent=${createdBy.agent ?? "unknown"} createdByTool=${createdBy.tool ?? createdBy.source ?? "unknown"} producedBy=${provenanceSourceLabel ?? "none"}:${provenanceSourceId ?? "none"}\n`);
245
285
  return { nodeId, labels: nodeLabels, edgesCreated };
246
286
  });
247
287
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA8HA,wCAWC;AAQD,gDAuMC;AAxVD,yEAAyE;AACzE,kEAAkE;AAClE,oCAAoC;A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,CAClB,iCAAiC,QAAQ,UAAU,YAAY,mBAAmB,SAAS,CAAC,KAAK,IAAI,SAAS,kBAAkB,SAAS,CAAC,IAAI,IAAI,SAAS,CAAC,MAAM,IAAI,SAAS,eAAe,qBAAqB,IAAI,MAAM,IAAI,kBAAkB,IAAI,MAAM,IAAI,CAClQ,CAAC;QAEF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -94,11 +94,12 @@ test("ACTION_PROVENANCE_LABELS includes the documented set", () => {
94
94
  }
95
95
  });
96
96
 
97
- test("writeNodeWithEdges rejects :Person write missing PRODUCED-from-Task edge", async () => {
97
+ test("writeNodeWithEdges rejects :Person write missing any inbound PRODUCED edge (missing-provenance)", async () => {
98
98
  const { session } = makeStubSession({
99
- preCheckLabelsByTarget: new Map([["other-target", ["Conversation"]]]),
99
+ preCheckLabelsByTarget: new Map([["other-target", ["LocalBusiness"]]]),
100
100
  });
101
101
  const relationships: GraphRelationship[] = [
102
+ // No inbound PRODUCED at all — neither Task nor Conversation nor Message.
102
103
  { type: "PART_OF", direction: "outgoing", targetNodeId: "other-target" },
103
104
  ];
104
105
  await assert.rejects(
@@ -112,7 +113,7 @@ test("writeNodeWithEdges rejects :Person write missing PRODUCED-from-Task edge",
112
113
  createdBy: { agent: "maxy-admin", session: "sess-1", tool: "memory-write" },
113
114
  expectedAccountId: TEST_ACCOUNT_ID,
114
115
  }),
115
- /missing-action-provenance|Process provenance/i,
116
+ /missing-provenance/i,
116
117
  );
117
118
  });
118
119
 
@@ -156,16 +157,65 @@ test("writeNodeWithEdges accepts :Person write with no Task edge when agent='sys
156
157
  assert.equal(res.edgesCreated, 1);
157
158
  });
158
159
 
159
- test("writeNodeWithEdges rejects :Person write whose 'PRODUCED-incoming' source is NOT a :Task", async () => {
160
+ // Task 997 gate widened to accept :Conversation provenance for direct
161
+ // admin asks. The wrapper auto-injects the inbound PRODUCED edge from the
162
+ // active :AdminConversation via CONVERSATION_NODE_ID.
163
+ test("writeNodeWithEdges accepts :Person write with PRODUCED-from-Conversation edge", async () => {
160
164
  const { session } = makeStubSession({
161
165
  preCheckLabelsByTarget: new Map([
162
- ["other-id", ["Conversation"]],
166
+ // AdminConversation carries the parent :Conversation label too.
167
+ ["conv-id", ["Conversation", "AdminConversation"]],
163
168
  ]),
164
169
  });
165
170
  const relationships: GraphRelationship[] = [
166
- // Inbound PRODUCED edge but the source is a Conversation, not a Task.
167
- // Must reject — prevents bypass via spoofed PRODUCED edge from any node.
168
- { type: "PRODUCED", direction: "incoming", targetNodeId: "other-id" },
171
+ { type: "PRODUCED", direction: "incoming", targetNodeId: "conv-id" },
172
+ ];
173
+ const res = await writeNodeWithEdges({
174
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
175
+ session: session as any,
176
+ labels: ["Person"],
177
+ props: { accountId: TEST_ACCOUNT_ID },
178
+ relationships,
179
+ createdBy: { agent: "maxy-admin", session: "sess-1", tool: "contact-create" },
180
+ expectedAccountId: TEST_ACCOUNT_ID,
181
+ });
182
+ assert.equal(res.edgesCreated, 1);
183
+ });
184
+
185
+ // Task 997 — Message subtypes (UserMessage, AssistantMessage, AdminMessage)
186
+ // also qualify because the labels() array includes the parent :Message label.
187
+ test("writeNodeWithEdges accepts :Person write with PRODUCED-from-Message edge", async () => {
188
+ const { session } = makeStubSession({
189
+ preCheckLabelsByTarget: new Map([
190
+ ["msg-id", ["Message", "UserMessage"]],
191
+ ]),
192
+ });
193
+ const relationships: GraphRelationship[] = [
194
+ { type: "PRODUCED", direction: "incoming", targetNodeId: "msg-id" },
195
+ ];
196
+ const res = await writeNodeWithEdges({
197
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
198
+ session: session as any,
199
+ labels: ["Person"],
200
+ props: { accountId: TEST_ACCOUNT_ID },
201
+ relationships,
202
+ createdBy: { agent: "maxy-admin", session: "sess-1", tool: "contact-create" },
203
+ expectedAccountId: TEST_ACCOUNT_ID,
204
+ });
205
+ assert.equal(res.edgesCreated, 1);
206
+ });
207
+
208
+ // Task 997 — defence-in-depth: the gate's source-label allowlist still
209
+ // rejects PRODUCED edges from nodes outside {Task, Conversation, Message}.
210
+ // Prevents bypass via a spoofed PRODUCED edge from any unrelated node.
211
+ test("writeNodeWithEdges rejects :Person write with PRODUCED edge from a non-provenance-source label", async () => {
212
+ const { session } = makeStubSession({
213
+ preCheckLabelsByTarget: new Map([
214
+ ["business-id", ["LocalBusiness"]],
215
+ ]),
216
+ });
217
+ const relationships: GraphRelationship[] = [
218
+ { type: "PRODUCED", direction: "incoming", targetNodeId: "business-id" },
169
219
  ];
170
220
  await assert.rejects(
171
221
  () =>
@@ -178,7 +228,7 @@ test("writeNodeWithEdges rejects :Person write whose 'PRODUCED-incoming' source
178
228
  createdBy: { agent: "maxy-admin", session: "sess-1", tool: "memory-write" },
179
229
  expectedAccountId: TEST_ACCOUNT_ID,
180
230
  }),
181
- /missing-action-provenance|Process provenance/i,
231
+ /missing-provenance/i,
182
232
  );
183
233
  });
184
234
 
@@ -0,0 +1,140 @@
1
+ // Task 997 — direct-ask provenance auto-injection.
2
+ //
3
+ // MCP tool wrappers that write to ACTION_PROVENANCE_LABELS call this helper
4
+ // before `writeNodeWithEdges`. When the admin server has stamped
5
+ // `CONVERSATION_NODE_ID` in the MCP spawn env (the elementId of the active
6
+ // `:AdminConversation`), the helper:
7
+ // - verifies the source node exists, carries one of PROVENANCE_SOURCE_LABELS,
8
+ // and shares the write's accountId
9
+ // - prepends a synthetic inbound `:PRODUCED` edge to the relationships array
10
+ // so the gate inside `writeNodeWithEdges` accepts the write
11
+ //
12
+ // The injection is a no-op when:
13
+ // - the env var is unset (typical for autonomous workflow flows that pass an
14
+ // explicit `producedByTaskId` instead)
15
+ // - the labels being written do not require action provenance
16
+ // - the relationships array already carries an inbound `:PRODUCED` edge from
17
+ // any source (idempotency — explicit `producedByTaskId` already prepended
18
+ // one; a second source is redundant noise. If the caller's PRODUCED edge
19
+ // resolves to a node NOT in PROVENANCE_SOURCE_LABELS, the downstream gate
20
+ // rejects with `missing-provenance` — defence-in-depth covers that case)
21
+ //
22
+ // Loud-failure cases emit `[<logNamespace>] [provenance-missing] reason=<r>`
23
+ // to stderr and return the original relationships array unchanged — the
24
+ // downstream gate then fires `missing-provenance` so both observability
25
+ // signals land in server.log.
26
+
27
+ import type { Session } from "neo4j-driver";
28
+ import {
29
+ ACTION_PROVENANCE_LABELS,
30
+ PROVENANCE_SOURCE_LABELS,
31
+ } from "./index.js";
32
+ import type { GraphRelationship } from "./index.js";
33
+
34
+ export interface InjectConversationProvenanceParams {
35
+ session: Session;
36
+ /** The relationships array the caller is about to pass to `writeNodeWithEdges`. */
37
+ relationships: readonly GraphRelationship[];
38
+ /** The accountId of the write — must match the source node's accountId. */
39
+ accountId: string;
40
+ /** Labels of the node about to be written. Used to skip injection when provenance is not required. */
41
+ writeLabels: readonly string[];
42
+ /**
43
+ * Value of `process.env.CONVERSATION_NODE_ID` at call time. Passed as a
44
+ * parameter so tests can supply it without mutating process.env.
45
+ */
46
+ conversationNodeId: string | undefined;
47
+ /**
48
+ * Log namespace prefix — typically `"mcp:contacts"` or `"mcp:memory"`. Used
49
+ * to format the `[provenance-inject]` / `[provenance-missing]` lines so the
50
+ * operator can attribute the signal to a plugin.
51
+ */
52
+ logNamespace: string;
53
+ /** Tool name (e.g. "contact-create") for the inject/missing log lines. */
54
+ tool: string;
55
+ }
56
+
57
+ export async function injectConversationProvenance(
58
+ params: InjectConversationProvenanceParams,
59
+ ): Promise<GraphRelationship[]> {
60
+ const {
61
+ session,
62
+ relationships,
63
+ accountId,
64
+ writeLabels,
65
+ conversationNodeId,
66
+ logNamespace,
67
+ tool,
68
+ } = params;
69
+
70
+ const original = [...relationships];
71
+
72
+ if (!writeLabels.some((l) => ACTION_PROVENANCE_LABELS.has(l))) return original;
73
+ if (!conversationNodeId) return original;
74
+ if (hasInboundProducedEdge(original)) return original;
75
+
76
+ let lookup;
77
+ try {
78
+ lookup = await session.run(
79
+ `MATCH (n) WHERE elementId(n) = $id RETURN labels(n) AS labels, n.accountId AS accountId LIMIT 1`,
80
+ { id: conversationNodeId },
81
+ );
82
+ } catch (err) {
83
+ process.stderr.write(
84
+ `[${logNamespace}] [provenance-missing] tool=${tool} reason=driver-error message=${err instanceof Error ? err.message : String(err)} conversationNodeId=${conversationNodeId}\n`,
85
+ );
86
+ return original;
87
+ }
88
+
89
+ if (lookup.records.length === 0) {
90
+ process.stderr.write(
91
+ `[${logNamespace}] [provenance-missing] tool=${tool} reason=node-not-found conversationNodeId=${conversationNodeId}\n`,
92
+ );
93
+ return original;
94
+ }
95
+
96
+ const labels = lookup.records[0].get("labels") as string[];
97
+ const sourceAccountId = lookup.records[0].get("accountId") as string;
98
+ const sourceLabel = labels.find((l) => PROVENANCE_SOURCE_LABELS.has(l));
99
+
100
+ if (!sourceLabel) {
101
+ process.stderr.write(
102
+ `[${logNamespace}] [provenance-missing] tool=${tool} reason=wrong-source-label labels=${labels.join(",")} conversationNodeId=${conversationNodeId}\n`,
103
+ );
104
+ return original;
105
+ }
106
+
107
+ if (sourceAccountId !== accountId) {
108
+ process.stderr.write(
109
+ `[${logNamespace}] [provenance-missing] tool=${tool} reason=account-mismatch sourceAccountId=${sourceAccountId.slice(0, 8)} writeAccountId=${accountId.slice(0, 8)} conversationNodeId=${conversationNodeId}\n`,
110
+ );
111
+ return original;
112
+ }
113
+
114
+ process.stderr.write(
115
+ `[${logNamespace}] [provenance-inject] tool=${tool} from=${sourceLabel}:${conversationNodeId}\n`,
116
+ );
117
+
118
+ return [
119
+ {
120
+ type: "PRODUCED",
121
+ direction: "incoming",
122
+ targetNodeId: conversationNodeId,
123
+ },
124
+ ...original,
125
+ ];
126
+ }
127
+
128
+ /**
129
+ * Detect any pre-existing inbound `:PRODUCED` edge in the relationships
130
+ * array. Source-label validation is the downstream gate's job; here we only
131
+ * need to know whether the caller already provided one — if so, skip
132
+ * injection to avoid duplicate edges.
133
+ */
134
+ function hasInboundProducedEdge(
135
+ relationships: readonly GraphRelationship[],
136
+ ): boolean {
137
+ return relationships.some(
138
+ (r) => r.type === "PRODUCED" && r.direction === "incoming",
139
+ );
140
+ }