@rubytech/create-maxy-code 0.1.151 → 0.1.153
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/lib/graph-search/dist/index.d.ts.map +1 -1
- package/payload/platform/lib/graph-search/dist/index.js +10 -9
- package/payload/platform/lib/graph-search/dist/index.js.map +1 -1
- package/payload/platform/lib/graph-search/src/index.ts +10 -9
- package/payload/platform/package.json +2 -2
- package/payload/platform/plugins/admin/PLUGIN.md +1 -1
- package/payload/platform/plugins/admin/hooks/__tests__/pre-turn-graph-pass.test.sh +26 -129
- package/payload/platform/plugins/admin/hooks/pre-turn-graph-pass.sh +64 -131
- package/payload/platform/plugins/docs/PLUGIN.md +1 -1
- package/payload/platform/plugins/docs/references/admin-session.md +2 -2
- package/payload/platform/plugins/docs/references/internals.md +1 -64
- package/payload/platform/plugins/docs/references/platform.md +1 -1
- package/payload/platform/plugins/docs/references/plugins-guide.md +2 -2
- package/payload/platform/plugins/email/mcp/dist/lib/graph.d.ts +1 -1
- package/payload/platform/plugins/email/mcp/dist/lib/graph.d.ts.map +1 -1
- package/payload/platform/plugins/email/mcp/dist/scripts/email-fetch.js +25 -45
- package/payload/platform/plugins/email/mcp/dist/scripts/email-fetch.js.map +1 -1
- package/payload/platform/plugins/memory/.claude-plugin/plugin.json +1 -1
- package/payload/platform/plugins/memory/PLUGIN.md +8 -16
- package/payload/platform/plugins/memory/bin/conversation-archive-ingest.mjs +14 -11
- package/payload/platform/plugins/memory/mcp/dist/index.js +13 -269
- package/payload/platform/plugins/memory/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/dream-cycle/phase-citation-audit.d.ts +1 -24
- package/payload/platform/plugins/memory/mcp/dist/lib/dream-cycle/phase-citation-audit.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/dream-cycle/phase-citation-audit.js +8 -211
- package/payload/platform/plugins/memory/mcp/dist/lib/dream-cycle/phase-citation-audit.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/section-types.d.ts +99 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/section-types.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/section-types.js +56 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/section-types.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/typed-edge-pass.d.ts +12 -32
- package/payload/platform/plugins/memory/mcp/dist/lib/typed-edge-pass.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/typed-edge-pass.js +19 -281
- package/payload/platform/plugins/memory/mcp/dist/lib/typed-edge-pass.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-emit.test.js +0 -3
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-emit.test.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-derive-insights.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-derive-insights.js +15 -14
- package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-derive-insights.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-ingest.d.ts +1 -1
- 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 +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-ingest.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-update.d.ts +1 -76
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-update.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-update.js +73 -329
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-update.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-write.d.ts.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-write.js +10 -12
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-write.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/vitest.config.ts +4 -3
- package/payload/platform/plugins/memory/references/graph-primitives.md +2 -2
- package/payload/platform/plugins/memory/references/schema-base.md +2 -7
- package/payload/platform/plugins/memory/skills/document-ingest/SKILL.md +71 -46
- package/payload/platform/plugins/scheduling/skills/briefing/SKILL.md +2 -2
- package/payload/platform/scripts/seed-neo4j.sh +0 -49
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +3 -2
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
- package/payload/platform/templates/agents/admin/IDENTITY.md +1 -1
- package/payload/platform/templates/specialists/agents/citation-auditor.md +37 -0
- package/payload/platform/templates/specialists/agents/compiled-truth-rewriter.md +42 -0
- package/payload/platform/templates/specialists/agents/database-operator.md +2 -30
- package/payload/platform/templates/specialists/agents/research-assistant.md +2 -2
- package/payload/platform/templates/specialists/agents/typed-edge-classifier.md +37 -0
- package/payload/server/{adminuser-self-heal-YC47O34W.js → adminuser-self-heal-WSFCOEII.js} +1 -1
- package/payload/server/{chunk-T3DJD5QR.js → chunk-AXOL2PPG.js} +1 -1
- package/payload/server/{chunk-HYQNUVGO.js → chunk-PFF6I7KP.js} +1 -8
- package/payload/server/maxy-edge.js +2 -2
- package/payload/server/public/assets/{admin-CnLGltuE.js → admin-kh_oCHeS.js} +54 -54
- package/payload/server/public/assets/{data-MB2EWZUP.js → data-BHASh0_Y.js} +1 -1
- package/payload/server/public/assets/{graph-B2FnDRz-.js → graph-BhEI09tF.js} +1 -1
- package/payload/server/public/assets/graph-labels-DXlmm1og.js +1 -0
- package/payload/server/public/assets/{page-BJKRa6Db.js → page-CDWu1Aft.js} +3 -3
- package/payload/server/public/assets/{page-Bx2p3W1k.js → page-cyvshX4Z.js} +1 -1
- package/payload/server/public/data.html +3 -3
- package/payload/server/public/graph.html +3 -3
- package/payload/server/public/index.html +4 -4
- package/payload/server/server.js +319 -1286
- package/payload/platform/lib/graph-search/src/__tests__/query-expansion.test.ts +0 -96
- package/payload/platform/lib/graph-search/src/query-expansion.ts +0 -129
- package/payload/platform/lib/oauth-llm/src/index.ts +0 -583
- package/payload/platform/lib/oauth-llm/tsconfig.json +0 -8
- package/payload/platform/lib/screening-patterns/src/index.ts +0 -51
- package/payload/platform/lib/screening-patterns/tsconfig.json +0 -8
- package/payload/server/public/assets/graph-labels-DDYqDlu3.js +0 -1
package/payload/platform/plugins/memory/mcp/dist/lib/dream-cycle/phase-citation-audit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phase-citation-audit.js","sourceRoot":"","sources":["../../../src/lib/dream-cycle/phase-citation-audit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"phase-citation-audit.js","sourceRoot":"","sources":["../../../src/lib/dream-cycle/phase-citation-audit.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,IAAkB;IACzD,OAAO;QACL,KAAK,EAAE,CAAC;QACR,IAAI,EAAE,gBAAgB;QACtB,WAAW,EAAE,CAAC;QACd,QAAQ,EAAE,CAAC;QACX,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,CAAC;QACX,KAAK,EAAE;YACL,UAAU,EAAE,6BAA6B;YACzC,IAAI,EACF,6DAA6D;gBAC7D,+EAA+E;SAClF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/** Identity sections — anchor to `:UserProfile` via natural edge per kind. */
|
|
2
|
+
export declare const IDENTITY_SECTION_KINDS: readonly ["Position", "Education", "Credential", "Skill", "Biography"];
|
|
3
|
+
/** Structural sections — anchored only via HAS_SECTION + NEXT, no anchor edge. */
|
|
4
|
+
export declare const STRUCTURAL_SECTION_KINDS: readonly ["Preface", "Abstract", "Introduction", "TableOfContents", "Chapter", "Conclusion", "Appendix", "Bibliography", "Glossary", "Acknowledgments"];
|
|
5
|
+
/** Contract-clause sections — anchored via HAS_SECTION + NEXT; Parties + Definitions get extra wiring. */
|
|
6
|
+
export declare const CONTRACT_SECTION_KINDS: readonly ["Parties", "Recitals", "Definitions", "Scope", "Term", "Payment", "Confidentiality", "IntellectualProperty", "Warranties", "Indemnification", "Liability", "Termination", "GoverningLaw", "ForceMajeure", "Notices", "EntireAgreement", "Amendment", "Assignment", "Severability", "Signatures"];
|
|
7
|
+
/** Standalone nodes — written as their own top-level node, not a `:Section`. */
|
|
8
|
+
export declare const STANDALONE_NODE_KINDS: readonly ["Project"];
|
|
9
|
+
/** Label-fallback kind — closure miss. The specialist supplies `classifierReason`. */
|
|
10
|
+
export declare const SECTION_KIND_OTHER: "Other";
|
|
11
|
+
/** Direction of the anchor edge relative to the typed node. */
|
|
12
|
+
export type AnchorEdgeDirection = "from-anchor" | "to-anchor";
|
|
13
|
+
/** Direction of a related-node edge relative to the typed node. */
|
|
14
|
+
export type RelatedEdgeDirection = "outgoing" | "incoming";
|
|
15
|
+
/** A related entity the typed node connects to (e.g. Position → Organization). */
|
|
16
|
+
export interface ClassifiedRelated {
|
|
17
|
+
/** Ontology label — verified against the loaded label set. */
|
|
18
|
+
kind: string;
|
|
19
|
+
/** Properties on the related node. */
|
|
20
|
+
properties: Record<string, unknown>;
|
|
21
|
+
/** Edge from the typed node to the related node. */
|
|
22
|
+
edge: {
|
|
23
|
+
type: string;
|
|
24
|
+
direction: RelatedEdgeDirection;
|
|
25
|
+
properties?: Record<string, unknown>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* When true, MERGE the related node on its identifying property
|
|
29
|
+
* (e.g. Organization on `name`); when false, CREATE.
|
|
30
|
+
* Defaults to true — entity reuse is the safer default.
|
|
31
|
+
*/
|
|
32
|
+
merge?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/** A single classified section of the document (every section is one `:Section` node). */
|
|
35
|
+
export interface ClassifiedSection {
|
|
36
|
+
/** Section kind from the closed enumeration; becomes a secondary label on `:Section`. */
|
|
37
|
+
kind: string;
|
|
38
|
+
/** Short human-readable title for the section. */
|
|
39
|
+
title: string;
|
|
40
|
+
/** The section's body text — server-reconstructed via `documentText.slice(sourceStart, sourceEnd)`. */
|
|
41
|
+
body: string;
|
|
42
|
+
/** 1-3 sentence summary, ≤500 chars; stored as `:Section.summary`. */
|
|
43
|
+
summary: string;
|
|
44
|
+
/** Whole-document character offsets — inclusive start, exclusive end. */
|
|
45
|
+
sourceStart: number;
|
|
46
|
+
sourceEnd: number;
|
|
47
|
+
/** Properties on the section node (excluding accountId/embedding/provenance). */
|
|
48
|
+
properties: Record<string, unknown>;
|
|
49
|
+
/**
|
|
50
|
+
* Edge from the document subject (anchor) to / from the section node.
|
|
51
|
+
* Null for structural and contract-clause kinds — anchored only via
|
|
52
|
+
* the implicit `(:KnowledgeDocument)-[:HAS_SECTION]->(:Section)` + `:NEXT`.
|
|
53
|
+
*/
|
|
54
|
+
anchorEdge: {
|
|
55
|
+
type: string;
|
|
56
|
+
direction: AnchorEdgeDirection;
|
|
57
|
+
properties?: Record<string, unknown>;
|
|
58
|
+
} | null;
|
|
59
|
+
/** Other entities this section references (e.g. Position → Organization via AT). */
|
|
60
|
+
related?: ClassifiedRelated[];
|
|
61
|
+
/** For `kind === "Other"`: one-line description of what the section was about. */
|
|
62
|
+
classifierReason?: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* A node the specialist emitted but could not edge naturally.
|
|
66
|
+
* Surfaced to the operator so they decide whether the orphan is intentional
|
|
67
|
+
* (rare, valid) or a missing edge (ontology gap).
|
|
68
|
+
*/
|
|
69
|
+
export interface OrphanCandidate {
|
|
70
|
+
/** Ontology label of the would-be node. */
|
|
71
|
+
kind: string;
|
|
72
|
+
/** Short human-readable label naming the entity (e.g. organisation name). */
|
|
73
|
+
label: string;
|
|
74
|
+
/** Why no natural edge was found for this node. */
|
|
75
|
+
reason: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Document-level edge proposed by the specialist (e.g. PARTY edges from
|
|
79
|
+
* a contract `:KnowledgeDocument` to its Party persons / organisations).
|
|
80
|
+
*/
|
|
81
|
+
export interface ClassifiedDocumentEdge {
|
|
82
|
+
type: string;
|
|
83
|
+
direction: "outgoing" | "incoming";
|
|
84
|
+
targetKind: string;
|
|
85
|
+
targetProperties: Record<string, unknown>;
|
|
86
|
+
/** Default true — MERGE Person/Organization on identifying property. */
|
|
87
|
+
merge?: boolean;
|
|
88
|
+
}
|
|
89
|
+
/** The classifier's full output — what the specialist passes to memory-ingest. */
|
|
90
|
+
export interface ClassifierOutput {
|
|
91
|
+
documentSummary: string;
|
|
92
|
+
documentKeywords: string[];
|
|
93
|
+
sections: ClassifiedSection[];
|
|
94
|
+
orphanCandidates: OrphanCandidate[];
|
|
95
|
+
documentEdges?: ClassifiedDocumentEdge[];
|
|
96
|
+
/** Diagnostic count of related-node `kind` values dropped as ontology misses. */
|
|
97
|
+
hallucinatedRelated: number;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=section-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"section-types.d.ts","sourceRoot":"","sources":["../../src/lib/section-types.ts"],"names":[],"mappings":"AAQA,8EAA8E;AAC9E,eAAO,MAAM,sBAAsB,wEAMzB,CAAC;AAEX,kFAAkF;AAClF,eAAO,MAAM,wBAAwB,yJAW3B,CAAC;AAEX,0GAA0G;AAC1G,eAAO,MAAM,sBAAsB,4SAqBzB,CAAC;AAEX,gFAAgF;AAChF,eAAO,MAAM,qBAAqB,sBAAuB,CAAC;AAE1D,sFAAsF;AACtF,eAAO,MAAM,kBAAkB,EAAG,OAAgB,CAAC;AAEnD,+DAA+D;AAC/D,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG,WAAW,CAAC;AAE9D,mEAAmE;AACnE,MAAM,MAAM,oBAAoB,GAAG,UAAU,GAAG,UAAU,CAAC;AAE3D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;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,UAAU,GAAG,UAAU,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,wEAAwE;IACxE,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,kFAAkF;AAClF,MAAM,WAAW,gBAAgB;IAC/B,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,gBAAgB,EAAE,eAAe,EAAE,CAAC;IACpC,aAAa,CAAC,EAAE,sBAAsB,EAAE,CAAC;IACzC,iFAAiF;IACjF,mBAAmB,EAAE,MAAM,CAAC;CAC7B"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Section / classifier-output type contract.
|
|
2
|
+
//
|
|
3
|
+
// Task 424 deleted the server-side llm-classifier and moved typed-section
|
|
4
|
+
// production into the dispatched specialist's in-turn work. The shape this
|
|
5
|
+
// file describes is now the contract between the specialist (which emits the
|
|
6
|
+
// JSON) and `memory-ingest` (which writes it). Memory-ingest does not call
|
|
7
|
+
// any LLM; it consumes whatever the specialist passes through the tool args.
|
|
8
|
+
/** Identity sections — anchor to `:UserProfile` via natural edge per kind. */
|
|
9
|
+
export const IDENTITY_SECTION_KINDS = [
|
|
10
|
+
"Position",
|
|
11
|
+
"Education",
|
|
12
|
+
"Credential",
|
|
13
|
+
"Skill",
|
|
14
|
+
"Biography",
|
|
15
|
+
];
|
|
16
|
+
/** Structural sections — anchored only via HAS_SECTION + NEXT, no anchor edge. */
|
|
17
|
+
export const STRUCTURAL_SECTION_KINDS = [
|
|
18
|
+
"Preface",
|
|
19
|
+
"Abstract",
|
|
20
|
+
"Introduction",
|
|
21
|
+
"TableOfContents",
|
|
22
|
+
"Chapter",
|
|
23
|
+
"Conclusion",
|
|
24
|
+
"Appendix",
|
|
25
|
+
"Bibliography",
|
|
26
|
+
"Glossary",
|
|
27
|
+
"Acknowledgments",
|
|
28
|
+
];
|
|
29
|
+
/** Contract-clause sections — anchored via HAS_SECTION + NEXT; Parties + Definitions get extra wiring. */
|
|
30
|
+
export const CONTRACT_SECTION_KINDS = [
|
|
31
|
+
"Parties",
|
|
32
|
+
"Recitals",
|
|
33
|
+
"Definitions",
|
|
34
|
+
"Scope",
|
|
35
|
+
"Term",
|
|
36
|
+
"Payment",
|
|
37
|
+
"Confidentiality",
|
|
38
|
+
"IntellectualProperty",
|
|
39
|
+
"Warranties",
|
|
40
|
+
"Indemnification",
|
|
41
|
+
"Liability",
|
|
42
|
+
"Termination",
|
|
43
|
+
"GoverningLaw",
|
|
44
|
+
"ForceMajeure",
|
|
45
|
+
"Notices",
|
|
46
|
+
"EntireAgreement",
|
|
47
|
+
"Amendment",
|
|
48
|
+
"Assignment",
|
|
49
|
+
"Severability",
|
|
50
|
+
"Signatures",
|
|
51
|
+
];
|
|
52
|
+
/** Standalone nodes — written as their own top-level node, not a `:Section`. */
|
|
53
|
+
export const STANDALONE_NODE_KINDS = ["Project"];
|
|
54
|
+
/** Label-fallback kind — closure miss. The specialist supplies `classifierReason`. */
|
|
55
|
+
export const SECTION_KIND_OTHER = "Other";
|
|
56
|
+
//# sourceMappingURL=section-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"section-types.js","sourceRoot":"","sources":["../../src/lib/section-types.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,EAAE;AACF,0EAA0E;AAC1E,2EAA2E;AAC3E,6EAA6E;AAC7E,2EAA2E;AAC3E,6EAA6E;AAE7E,8EAA8E;AAC9E,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,UAAU;IACV,WAAW;IACX,YAAY;IACZ,OAAO;IACP,WAAW;CACH,CAAC;AAEX,kFAAkF;AAClF,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,SAAS;IACT,UAAU;IACV,cAAc;IACd,iBAAiB;IACjB,SAAS;IACT,YAAY;IACZ,UAAU;IACV,cAAc;IACd,UAAU;IACV,iBAAiB;CACT,CAAC;AAEX,0GAA0G;AAC1G,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,SAAS;IACT,UAAU;IACV,aAAa;IACb,OAAO;IACP,MAAM;IACN,SAAS;IACT,iBAAiB;IACjB,sBAAsB;IACtB,YAAY;IACZ,iBAAiB;IACjB,WAAW;IACX,aAAa;IACb,cAAc;IACd,cAAc;IACd,SAAS;IACT,iBAAiB;IACjB,WAAW;IACX,YAAY;IACZ,cAAc;IACd,YAAY;CACJ,CAAC;AAEX,gFAAgF;AAChF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,SAAS,CAAU,CAAC;AAE1D,sFAAsF;AACtF,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAgB,CAAC"}
|
|
@@ -1,46 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Typed-edge auto-extraction pass.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* proposal inline, and MERGEs accepted edges directly via Cypher with
|
|
10
|
-
* `createdBy` provenance.
|
|
4
|
+
* Task 424 moved the LLM-driven proposal step into the dispatched
|
|
5
|
+
* `typed-edge-classifier` specialist. The library function below is a
|
|
6
|
+
* no-op stub: callers (the `memory-typed-edge-pass` MCP tool, the
|
|
7
|
+
* backfill CLI script) keep the same call shape but receive a result
|
|
8
|
+
* that reports zero work and points to the specialist.
|
|
11
9
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* The pass does NOT route through `graph-write-gate`: that gate is a
|
|
17
|
-
* node-precondition surface (AdminUser + LocalBusiness must exist), not
|
|
18
|
-
* an edge-schema validator. Edge validation is owned here against
|
|
19
|
-
* `TYPED_EDGE_ALLOWLIST`.
|
|
20
|
-
*
|
|
21
|
-
* Auth: Haiku is called via Claude Code OAuth — never the Anthropic API key.
|
|
10
|
+
* The schema constants (`TYPED_EDGE_ALLOWLIST` etc.) and the
|
|
11
|
+
* `isAllowedTypedEdge` helper still live in `typed-edge-schema.ts` —
|
|
12
|
+
* the specialist Reads that file to ground its proposals against the
|
|
13
|
+
* closed allowlist.
|
|
22
14
|
*/
|
|
23
15
|
import type { Session } from "neo4j-driver";
|
|
24
16
|
export interface RunTypedEdgePassArgs {
|
|
25
|
-
/** Neo4j session — caller owns the lifecycle. */
|
|
26
17
|
session: Session;
|
|
27
|
-
/** Account scope. Required: cross-account writes are impossible by query design. */
|
|
28
18
|
accountId: string;
|
|
29
|
-
/**
|
|
30
|
-
* Lower bound on `node.updatedAt` for the enumeration. The session-end
|
|
31
|
-
* retrospective passes the session-start timestamp; backfill passes null
|
|
32
|
-
* to mean "all prose nodes ever written in this account".
|
|
33
|
-
*/
|
|
34
19
|
sinceIso: string | null;
|
|
35
|
-
/** Nodes per Haiku call. Default 8. */
|
|
36
20
|
batchSize?: number;
|
|
37
|
-
/** Conversation id to stamp on `createdBy` provenance. Optional (backfill mode has none). */
|
|
38
21
|
conversationId?: string | null;
|
|
39
|
-
/**
|
|
40
|
-
* Cap on total nodes processed in one invocation. The backfill pages
|
|
41
|
-
* through Neo4j in 500-node chunks; the retrospective passes its session's
|
|
42
|
-
* worth of nodes and never trips this. Default 500.
|
|
43
|
-
*/
|
|
44
22
|
maxNodes?: number;
|
|
45
23
|
}
|
|
46
24
|
export interface TypedEdgePassResult {
|
|
@@ -50,6 +28,8 @@ export interface TypedEdgePassResult {
|
|
|
50
28
|
rejected: number;
|
|
51
29
|
failed: number;
|
|
52
30
|
ms: number;
|
|
31
|
+
/** When the result is the no-op stub, this names where the work has moved. */
|
|
32
|
+
deferredTo?: string;
|
|
53
33
|
}
|
|
54
|
-
export declare function runTypedEdgePass(
|
|
34
|
+
export declare function runTypedEdgePass(_args: RunTypedEdgePassArgs): Promise<TypedEdgePassResult>;
|
|
55
35
|
//# sourceMappingURL=typed-edge-pass.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typed-edge-pass.d.ts","sourceRoot":"","sources":["../../src/lib/typed-edge-pass.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"typed-edge-pass.d.ts","sourceRoot":"","sources":["../../src/lib/typed-edge-pass.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAAC,mBAAmB,CAAC,CAc9B"}
|
|
@@ -1,290 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Typed-edge auto-extraction pass.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* proposal inline, and MERGEs accepted edges directly via Cypher with
|
|
10
|
-
* `createdBy` provenance.
|
|
4
|
+
* Task 424 moved the LLM-driven proposal step into the dispatched
|
|
5
|
+
* `typed-edge-classifier` specialist. The library function below is a
|
|
6
|
+
* no-op stub: callers (the `memory-typed-edge-pass` MCP tool, the
|
|
7
|
+
* backfill CLI script) keep the same call shape but receive a result
|
|
8
|
+
* that reports zero work and points to the specialist.
|
|
11
9
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* The pass does NOT route through `graph-write-gate`: that gate is a
|
|
17
|
-
* node-precondition surface (AdminUser + LocalBusiness must exist), not
|
|
18
|
-
* an edge-schema validator. Edge validation is owned here against
|
|
19
|
-
* `TYPED_EDGE_ALLOWLIST`.
|
|
20
|
-
*
|
|
21
|
-
* Auth: Haiku is called via Claude Code OAuth — never the Anthropic API key.
|
|
10
|
+
* The schema constants (`TYPED_EDGE_ALLOWLIST` etc.) and the
|
|
11
|
+
* `isAllowedTypedEdge` helper still live in `typed-edge-schema.ts` —
|
|
12
|
+
* the specialist Reads that file to ground its proposals against the
|
|
13
|
+
* closed allowlist.
|
|
22
14
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// ---------------------------------------------------------------------------
|
|
27
|
-
// Haiku prompt assembly — schema is rendered from TYPED_EDGE_ALLOWLIST so the
|
|
28
|
-
// prompt cannot drift from the validator.
|
|
29
|
-
// ---------------------------------------------------------------------------
|
|
30
|
-
function buildSystemPrompt() {
|
|
31
|
-
const allowlistLines = TYPED_EDGE_ALLOWLIST.map(({ sourceLabel, edgeType, targetLabel }) => ` (:${sourceLabel})-[:${edgeType}]->(:${targetLabel})`).join("\n");
|
|
32
|
-
return [
|
|
33
|
-
"You are a typed-edge extractor for a knowledge graph.",
|
|
34
|
-
"",
|
|
35
|
-
"You will be given a batch of prose nodes (each with an elementId and a",
|
|
36
|
-
"label). Read each node's text and propose typed edges that the text",
|
|
37
|
-
"supports. Only propose edges from this exact allowlist of",
|
|
38
|
-
"(sourceLabel)-[EDGE_TYPE]->(targetLabel) triples:",
|
|
39
|
-
"",
|
|
40
|
-
allowlistLines,
|
|
41
|
-
"",
|
|
42
|
-
"Rules:",
|
|
43
|
-
"- A proposal's sourceElementId MUST match one of the input elementIds.",
|
|
44
|
-
"- A proposal's edgeType MUST be one of the listed types: " +
|
|
45
|
-
TYPED_EDGE_TYPES.join(", ") + ".",
|
|
46
|
-
"- The (sourceLabel, edgeType, targetLabel) triple MUST appear in the",
|
|
47
|
-
" allowlist above. The sourceLabel is the label of the prose node at",
|
|
48
|
-
" sourceElementId; you do not pick it — it is fixed by the input.",
|
|
49
|
-
"- targetName is the canonical identifying property of the target node",
|
|
50
|
-
" (Person -> givenName + familyName joined with a space; Organization,",
|
|
51
|
-
" LocalBusiness, Event, Meeting, Page, Note, Report, Post -> name or title).",
|
|
52
|
-
"- Propose nothing when the text does not clearly support an edge. False",
|
|
53
|
-
" positives are worse than misses; this pass runs every session.",
|
|
54
|
-
"- Do not invent entities the text does not name.",
|
|
55
|
-
"",
|
|
56
|
-
"Return your answer through the structured tool call. No prose reply.",
|
|
57
|
-
].join("\n");
|
|
58
|
-
}
|
|
59
|
-
const ProposalTool = {
|
|
60
|
-
name: "emit_typed_edge_proposals",
|
|
61
|
-
description: "Emit one or more typed-edge proposals for the input batch of prose nodes.",
|
|
62
|
-
input_schema: {
|
|
63
|
-
type: "object",
|
|
64
|
-
properties: {
|
|
65
|
-
proposals: {
|
|
66
|
-
type: "array",
|
|
67
|
-
description: "Zero or more edge proposals.",
|
|
68
|
-
items: {
|
|
69
|
-
type: "object",
|
|
70
|
-
properties: {
|
|
71
|
-
sourceElementId: {
|
|
72
|
-
type: "string",
|
|
73
|
-
description: "elementId of the prose node the edge originates from. Must match one of the input batch.",
|
|
74
|
-
},
|
|
75
|
-
edgeType: {
|
|
76
|
-
type: "string",
|
|
77
|
-
enum: [...TYPED_EDGE_TYPES],
|
|
78
|
-
description: "Edge type from the allowlist.",
|
|
79
|
-
},
|
|
80
|
-
targetLabel: {
|
|
81
|
-
type: "string",
|
|
82
|
-
description: "Neo4j label of the target node (Person, Organization, LocalBusiness, Event, etc.).",
|
|
83
|
-
},
|
|
84
|
-
targetName: {
|
|
85
|
-
type: "string",
|
|
86
|
-
description: "Canonical identifying name of the target node.",
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
required: ["sourceElementId", "edgeType", "targetLabel", "targetName"],
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
required: ["proposals"],
|
|
94
|
-
},
|
|
95
|
-
};
|
|
96
|
-
// ---------------------------------------------------------------------------
|
|
97
|
-
// Neo4j: enumerate prose-bearing nodes
|
|
98
|
-
// ---------------------------------------------------------------------------
|
|
99
|
-
async function enumerateProseNodes(session, accountId, sinceIso, limit) {
|
|
100
|
-
// Multi-label MATCH using ANY/labels(). Prose-bearing labels are a fixed
|
|
101
|
-
// set; we filter in-cypher to keep the query plan deterministic.
|
|
102
|
-
// text source: prefer `text`, fall back to `body` then `content` — different
|
|
103
|
-
// prose labels carry their text under different property names across the
|
|
104
|
-
// existing writers. NULL coalescing via COALESCE.
|
|
105
|
-
const cypher = sinceIso
|
|
106
|
-
? `MATCH (n)
|
|
107
|
-
WHERE n.accountId = $accountId
|
|
108
|
-
AND ANY(l IN labels(n) WHERE l IN $labels)
|
|
109
|
-
AND n.updatedAt >= $sinceIso
|
|
110
|
-
RETURN elementId(n) AS elementId,
|
|
111
|
-
[l IN labels(n) WHERE l IN $labels][0] AS label,
|
|
112
|
-
COALESCE(n.text, n.body, n.content, '') AS text
|
|
113
|
-
ORDER BY n.updatedAt ASC
|
|
114
|
-
LIMIT $limit`
|
|
115
|
-
: `MATCH (n)
|
|
116
|
-
WHERE n.accountId = $accountId
|
|
117
|
-
AND ANY(l IN labels(n) WHERE l IN $labels)
|
|
118
|
-
RETURN elementId(n) AS elementId,
|
|
119
|
-
[l IN labels(n) WHERE l IN $labels][0] AS label,
|
|
120
|
-
COALESCE(n.text, n.body, n.content, '') AS text
|
|
121
|
-
ORDER BY n.updatedAt ASC
|
|
122
|
-
LIMIT $limit`;
|
|
123
|
-
const result = await session.run(cypher, {
|
|
124
|
-
accountId,
|
|
125
|
-
labels: [...PROSE_BEARING_LABELS],
|
|
126
|
-
sinceIso,
|
|
127
|
-
limit,
|
|
128
|
-
});
|
|
129
|
-
return result.records
|
|
130
|
-
.map((r) => ({
|
|
131
|
-
elementId: String(r.get("elementId")),
|
|
132
|
-
label: String(r.get("label")),
|
|
133
|
-
text: String(r.get("text") ?? ""),
|
|
134
|
-
}))
|
|
135
|
-
.filter((n) => n.text.trim().length > 0);
|
|
136
|
-
}
|
|
137
|
-
async function callHaikuForBatch(nodes, systemPrompt) {
|
|
138
|
-
const userMessage = JSON.stringify({
|
|
139
|
-
batch: nodes.map((n) => ({
|
|
140
|
-
elementId: n.elementId,
|
|
141
|
-
label: n.label,
|
|
142
|
-
// Cap text length so very large prose nodes don't blow the context
|
|
143
|
-
// window. 4000 chars is enough for entity extraction; the typed-edge
|
|
144
|
-
// pass is not a summariser.
|
|
145
|
-
text: n.text.slice(0, 4000),
|
|
146
|
-
})),
|
|
147
|
-
}, null, 2);
|
|
148
|
-
const llmResult = await callOauthLlm({
|
|
149
|
-
model: HAIKU_MODEL,
|
|
150
|
-
system: systemPrompt,
|
|
151
|
-
userMessage,
|
|
152
|
-
maxTokens: 4096,
|
|
153
|
-
timeoutMs: 60_000,
|
|
154
|
-
tools: [ProposalTool],
|
|
155
|
-
toolChoiceName: ProposalTool.name,
|
|
156
|
-
});
|
|
157
|
-
if (llmResult.kind === "fallback") {
|
|
158
|
-
return { proposals: [], failureReason: `${llmResult.cause}: ${llmResult.reason}` };
|
|
159
|
-
}
|
|
160
|
-
if (llmResult.kind !== "ok-tool") {
|
|
161
|
-
return { proposals: [], failureReason: "no-tool-use" };
|
|
162
|
-
}
|
|
163
|
-
const rawProposals = llmResult.input.proposals;
|
|
164
|
-
if (!Array.isArray(rawProposals)) {
|
|
165
|
-
return { proposals: [], failureReason: "proposals-not-array" };
|
|
166
|
-
}
|
|
167
|
-
return { proposals: rawProposals, failureReason: null };
|
|
168
|
-
}
|
|
169
|
-
function validateProposal(raw, batchNodesByElementId) {
|
|
170
|
-
const sourceElementId = typeof raw.sourceElementId === "string" ? raw.sourceElementId : "";
|
|
171
|
-
const edgeType = typeof raw.edgeType === "string" ? raw.edgeType : "";
|
|
172
|
-
const targetLabel = typeof raw.targetLabel === "string" ? raw.targetLabel : "";
|
|
173
|
-
const targetName = typeof raw.targetName === "string" ? raw.targetName.trim() : "";
|
|
174
|
-
if (!sourceElementId || !edgeType || !targetLabel || !targetName) {
|
|
175
|
-
return { proposal: null, reason: "missing-field" };
|
|
176
|
-
}
|
|
177
|
-
const sourceNode = batchNodesByElementId.get(sourceElementId);
|
|
178
|
-
if (!sourceNode) {
|
|
179
|
-
return { proposal: null, reason: "unknown-source-node" };
|
|
180
|
-
}
|
|
181
|
-
if (!isAllowedTypedEdge(sourceNode.label, edgeType, targetLabel)) {
|
|
182
|
-
return { proposal: null, reason: "not-in-allowlist" };
|
|
183
|
-
}
|
|
15
|
+
export async function runTypedEdgePass(_args) {
|
|
16
|
+
process.stderr.write(`[typed-edge-pass] deferred-to-specialist accountId=${_args.accountId.slice(0, 8)}… ` +
|
|
17
|
+
`note=dispatch typed-edge-classifier via the Task tool\n`);
|
|
184
18
|
return {
|
|
185
|
-
|
|
186
|
-
|
|
19
|
+
nodes: 0,
|
|
20
|
+
proposed: 0,
|
|
21
|
+
accepted: 0,
|
|
22
|
+
rejected: 0,
|
|
23
|
+
failed: 0,
|
|
24
|
+
ms: 0,
|
|
25
|
+
deferredTo: "specialist:typed-edge-classifier",
|
|
187
26
|
};
|
|
188
27
|
}
|
|
189
|
-
// ---------------------------------------------------------------------------
|
|
190
|
-
// MERGE one accepted proposal as a typed edge with createdBy provenance
|
|
191
|
-
// ---------------------------------------------------------------------------
|
|
192
|
-
async function mergeEdge(session, accountId, proposal, sourceLabel, conversationId) {
|
|
193
|
-
// The edge type is interpolated into Cypher because parameterised
|
|
194
|
-
// relationship types are not supported. We have already validated the
|
|
195
|
-
// edgeType against the closed-enum allowlist, so the interpolation is
|
|
196
|
-
// safe — no operator string reaches this point.
|
|
197
|
-
// The target is MERGEd on (accountId, name) so re-runs are idempotent.
|
|
198
|
-
// The edge is MERGEd on its endpoint pair with provenance attached at
|
|
199
|
-
// ON CREATE, leaving existing edges untouched.
|
|
200
|
-
const cypher = `
|
|
201
|
-
MATCH (s:${sourceLabel} {accountId: $accountId})
|
|
202
|
-
WHERE elementId(s) = $sourceElementId
|
|
203
|
-
MERGE (t:${proposal.targetLabel} {accountId: $accountId, name: $targetName})
|
|
204
|
-
ON CREATE SET t.createdAt = $nowIso, t.updatedAt = $nowIso
|
|
205
|
-
ON MATCH SET t.updatedAt = $nowIso
|
|
206
|
-
MERGE (s)-[r:${proposal.edgeType}]->(t)
|
|
207
|
-
ON CREATE SET r.createdAt = $nowIso,
|
|
208
|
-
r.createdByAgent = 'typed-edge-pass',
|
|
209
|
-
r.createdByTool = 'memory-typed-edge-pass',
|
|
210
|
-
r.createdByConversation = $conversationId,
|
|
211
|
-
r.createdByModel = $modelId
|
|
212
|
-
RETURN elementId(r) AS edgeId
|
|
213
|
-
`;
|
|
214
|
-
try {
|
|
215
|
-
const result = await session.run(cypher, {
|
|
216
|
-
accountId,
|
|
217
|
-
sourceElementId: proposal.sourceElementId,
|
|
218
|
-
targetName: proposal.targetName,
|
|
219
|
-
conversationId,
|
|
220
|
-
modelId: HAIKU_MODEL,
|
|
221
|
-
nowIso: new Date().toISOString(),
|
|
222
|
-
});
|
|
223
|
-
if (result.records.length === 0) {
|
|
224
|
-
// Source node missing (defensive — should not happen because the
|
|
225
|
-
// enumeration just listed it).
|
|
226
|
-
return { ok: false, reason: "source-not-found" };
|
|
227
|
-
}
|
|
228
|
-
return { ok: true };
|
|
229
|
-
}
|
|
230
|
-
catch (err) {
|
|
231
|
-
return {
|
|
232
|
-
ok: false,
|
|
233
|
-
reason: `merge-error:${err instanceof Error ? err.message : String(err)}`,
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
// ---------------------------------------------------------------------------
|
|
238
|
-
// Orchestration
|
|
239
|
-
// ---------------------------------------------------------------------------
|
|
240
|
-
export async function runTypedEdgePass(args) {
|
|
241
|
-
const { session, accountId, sinceIso, batchSize = 8, conversationId = null, maxNodes = 500, } = args;
|
|
242
|
-
const start = Date.now();
|
|
243
|
-
const accountShort = accountId.slice(0, 8);
|
|
244
|
-
const nodes = await enumerateProseNodes(session, accountId, sinceIso, maxNodes);
|
|
245
|
-
if (nodes.length === 0) {
|
|
246
|
-
const ms = Date.now() - start;
|
|
247
|
-
console.log(`[typed-edge-pass] accountId=${accountShort}… nodes=0 proposed=0 accepted=0 rejected=0 failed=0 ms=${ms}`);
|
|
248
|
-
return { nodes: 0, proposed: 0, accepted: 0, rejected: 0, failed: 0, ms };
|
|
249
|
-
}
|
|
250
|
-
const systemPrompt = buildSystemPrompt();
|
|
251
|
-
let proposed = 0;
|
|
252
|
-
let accepted = 0;
|
|
253
|
-
let rejected = 0;
|
|
254
|
-
let failed = 0;
|
|
255
|
-
for (let i = 0; i < nodes.length; i += batchSize) {
|
|
256
|
-
const batch = nodes.slice(i, i + batchSize);
|
|
257
|
-
const batchIndex = batch.reduce((m, n) => {
|
|
258
|
-
m.set(n.elementId, n);
|
|
259
|
-
return m;
|
|
260
|
-
}, new Map());
|
|
261
|
-
const { proposals: rawProposals, failureReason } = await callHaikuForBatch(batch, systemPrompt);
|
|
262
|
-
if (failureReason) {
|
|
263
|
-
failed += 1;
|
|
264
|
-
console.log(`[typed-edge-pass] accountId=${accountShort}… batch=${Math.floor(i / batchSize)} reason=${failureReason}`);
|
|
265
|
-
continue;
|
|
266
|
-
}
|
|
267
|
-
for (const raw of rawProposals) {
|
|
268
|
-
proposed += 1;
|
|
269
|
-
const { proposal, reason } = validateProposal(raw, batchIndex);
|
|
270
|
-
if (!proposal) {
|
|
271
|
-
rejected += 1;
|
|
272
|
-
console.log(`[typed-edge-pass] accountId=${accountShort}… reject reason=${reason ?? "unknown"} raw=${JSON.stringify(raw)}`);
|
|
273
|
-
continue;
|
|
274
|
-
}
|
|
275
|
-
const sourceLabel = batchIndex.get(proposal.sourceElementId).label;
|
|
276
|
-
const mergeResult = await mergeEdge(session, accountId, proposal, sourceLabel, conversationId);
|
|
277
|
-
if (mergeResult.ok) {
|
|
278
|
-
accepted += 1;
|
|
279
|
-
}
|
|
280
|
-
else {
|
|
281
|
-
rejected += 1;
|
|
282
|
-
console.log(`[typed-edge-pass] accountId=${accountShort}… reject reason=${mergeResult.reason}`);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
const ms = Date.now() - start;
|
|
287
|
-
console.log(`[typed-edge-pass] accountId=${accountShort}… nodes=${nodes.length} proposed=${proposed} accepted=${accepted} rejected=${rejected} failed=${failed} ms=${ms}`);
|
|
288
|
-
return { nodes: nodes.length, proposed, accepted, rejected, failed, ms };
|
|
289
|
-
}
|
|
290
28
|
//# sourceMappingURL=typed-edge-pass.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typed-edge-pass.js","sourceRoot":"","sources":["../../src/lib/typed-edge-pass.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"typed-edge-pass.js","sourceRoot":"","sources":["../../src/lib/typed-edge-pass.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAwBH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,KAA2B;IAE3B,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,sDAAsD,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI;QACnF,yDAAyD,CAC5D,CAAC;IACF,OAAO;QACL,KAAK,EAAE,CAAC;QACR,QAAQ,EAAE,CAAC;QACX,QAAQ,EAAE,CAAC;QACX,QAAQ,EAAE,CAAC;QACX,MAAM,EAAE,CAAC;QACT,EAAE,EAAE,CAAC;QACL,UAAU,EAAE,kCAAkC;KAC/C,CAAC;AACJ,CAAC"}
|
|
@@ -14,9 +14,6 @@ vi.mock("../../lib/graph-write-gate.js", () => ({
|
|
|
14
14
|
checkLabelWriteGate: vi.fn().mockReturnValue({ ok: true }),
|
|
15
15
|
COMPILED_TRUTH_MAX_CHARS: 2000,
|
|
16
16
|
}));
|
|
17
|
-
vi.mock("../../lib/compiled-truth-rewriter.js", () => ({
|
|
18
|
-
rewriteCompiledTruth: vi.fn().mockResolvedValue({ kind: "refused", reason: "no-events" }),
|
|
19
|
-
}));
|
|
20
17
|
vi.mock("./memory-write.js", () => ({
|
|
21
18
|
buildTextRepresentation: () => "stub-text",
|
|
22
19
|
}));
|
package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-emit.test.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-update-emit.test.js","sourceRoot":"","sources":["../../../src/tools/__tests__/memory-update-emit.test.ts"],"names":[],"mappings":"AAAA,wDAAwD;AAExD,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE/E,MAAM,WAAW,GAAG,eAAe,EAAE,CAAC;AAEtC,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,GAAG,EAAE,CAAC,CAAC;IACnC,UAAU,EAAE,GAAG,EAAE,CAAC,WAAW;CAC9B,CAAC,CAAC,CAAC;AAEJ,EAAE,CAAC,IAAI,CAAC,yBAAyB,EAAE,GAAG,EAAE,CAAC,CAAC;IACxC,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,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C3E,MAAM,MAAM,CACV,YAAY,CAAC;YACX,MAAM,EAAE,SAAS;YACjB,UAAU,EAAE,EAAE;YACd,SAAS,EAAE,QAAQ;YACnB,SAAS,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAW;SACrD,CAAC,CACH,CAAC,OAAO,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;QAC7C,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC/C,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAE,CAAC;QACjC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACjC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;QAC7C,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QAC5C,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-derive-insights.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation-archive-derive-insights.d.ts","sourceRoot":"","sources":["../../src/tools/conversation-archive-derive-insights.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;
|
|
1
|
+
{"version":3,"file":"conversation-archive-derive-insights.d.ts","sourceRoot":"","sources":["../../src/tools/conversation-archive-derive-insights.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAsCH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAS7D;AAID,wBA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