@pyxmate/memory 0.31.4 → 0.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-27RJJTZH.mjs → chunk-6DZN7FYM.mjs} +1 -1
- package/dist/{chunk-I45LGUJR.mjs → chunk-KSTI4M52.mjs} +12 -2
- package/dist/{chunk-HXF7EXXP.mjs → chunk-W5FHHTBQ.mjs} +1 -1
- package/dist/cli/pyx-mem.mjs +18 -12
- package/dist/dashboard.mjs +3 -3
- package/dist/index.d.ts +27 -1
- package/dist/index.mjs +6 -4
- package/dist/react.mjs +3 -3
- package/package.json +1 -1
|
@@ -6,6 +6,10 @@ var DEFAULTS = {
|
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
// ../shared/src/graph/extraction.ts
|
|
9
|
+
function normalizeGraphLabel(value, fallback) {
|
|
10
|
+
const normalized = value.trim().toUpperCase().replace(/[^A-Z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
11
|
+
return normalized.length > 0 ? normalized : fallback;
|
|
12
|
+
}
|
|
9
13
|
function mergeExtractedEntities(callerEntities, callerRelationships, extracted) {
|
|
10
14
|
const entities = [...callerEntities ?? []];
|
|
11
15
|
const relationships = [...callerRelationships ?? []];
|
|
@@ -17,14 +21,19 @@ function mergeExtractedEntities(callerEntities, callerRelationships, extracted)
|
|
|
17
21
|
for (const entity of extracted.entities) {
|
|
18
22
|
const key = entity.name.toLowerCase();
|
|
19
23
|
if (nameByLowercase.has(key)) continue;
|
|
20
|
-
entities.push(entity);
|
|
24
|
+
entities.push({ ...entity, type: normalizeGraphLabel(entity.type, "CONCEPT") });
|
|
21
25
|
nameByLowercase.set(key, entity.name);
|
|
22
26
|
}
|
|
23
27
|
for (const relationship of extracted.relations) {
|
|
24
28
|
const source = nameByLowercase.get(relationship.source.toLowerCase());
|
|
25
29
|
const target = nameByLowercase.get(relationship.target.toLowerCase());
|
|
26
30
|
if (source && target) {
|
|
27
|
-
relationships.push({
|
|
31
|
+
relationships.push({
|
|
32
|
+
...relationship,
|
|
33
|
+
source,
|
|
34
|
+
target,
|
|
35
|
+
type: normalizeGraphLabel(relationship.type, "RELATED_TO")
|
|
36
|
+
});
|
|
28
37
|
}
|
|
29
38
|
}
|
|
30
39
|
return { entities, relationships };
|
|
@@ -100,6 +109,7 @@ var SINGLE_TENANT_ID = "_single";
|
|
|
100
109
|
|
|
101
110
|
export {
|
|
102
111
|
DEFAULTS,
|
|
112
|
+
normalizeGraphLabel,
|
|
103
113
|
mergeExtractedEntities,
|
|
104
114
|
NamespaceIsolation,
|
|
105
115
|
MemoryType,
|
package/dist/cli/pyx-mem.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
mergeExtractedEntities
|
|
4
|
-
|
|
3
|
+
mergeExtractedEntities,
|
|
4
|
+
normalizeGraphLabel
|
|
5
|
+
} from "../chunk-KSTI4M52.mjs";
|
|
5
6
|
|
|
6
7
|
// src/cli/exit-codes.ts
|
|
7
8
|
var EXIT = {
|
|
@@ -810,7 +811,7 @@ var deleteMemoryTool = {
|
|
|
810
811
|
query: { reason: args.reason },
|
|
811
812
|
scope: args
|
|
812
813
|
});
|
|
813
|
-
return res.ok ? mcpJson(
|
|
814
|
+
return res.ok ? mcpJson({ deleted: args.id }) : res.result;
|
|
814
815
|
}
|
|
815
816
|
};
|
|
816
817
|
|
|
@@ -1013,9 +1014,9 @@ var upsertUserProfileTool = {
|
|
|
1013
1014
|
import { z as z8 } from "zod";
|
|
1014
1015
|
var inputShape5 = {
|
|
1015
1016
|
query: z8.string().min(1).describe("Required natural-language search text."),
|
|
1016
|
-
limit: z8.number().int().min(1).max(100).optional().describe("Maximum results; server clamps to 1\u2013100. Default
|
|
1017
|
+
limit: z8.number().int().min(1).max(100).optional().describe("Maximum results; server clamps to 1\u2013100. Default 10."),
|
|
1017
1018
|
strategy: z8.enum(["naive", "graph", "hybrid"]).optional().describe(
|
|
1018
|
-
"RAG strategy.
|
|
1019
|
+
"RAG strategy. Defaults to `hybrid` (cross-encoder reranking, multi-entity decomposition, confidence scoring) and is sent explicitly when omitted; pass `naive` for a lighter vector-only search or `graph` for graph-augmented retrieval."
|
|
1019
1020
|
),
|
|
1020
1021
|
type: z8.enum(["short-term", "long-term", "working", "episodic", "summary"]).optional().describe("Filter by memory type."),
|
|
1021
1022
|
agentId: z8.string().optional().describe("Filter to memories stored for this agentId."),
|
|
@@ -1042,9 +1043,13 @@ var searchMemoriesTool = {
|
|
|
1042
1043
|
method: "GET",
|
|
1043
1044
|
path: "/api/memory/search",
|
|
1044
1045
|
query: {
|
|
1045
|
-
|
|
1046
|
+
query: args.query,
|
|
1046
1047
|
limit: args.limit,
|
|
1047
|
-
|
|
1048
|
+
// Force `hybrid` unless the caller explicitly overrides. The server's
|
|
1049
|
+
// own default is hybrid too, but older tenant instances default to
|
|
1050
|
+
// `naive` (1–2 results vs hybrid's 15–20) — sending it explicitly makes
|
|
1051
|
+
// recall deterministic regardless of the instance version.
|
|
1052
|
+
strategy: args.strategy ?? "hybrid",
|
|
1048
1053
|
type: args.type,
|
|
1049
1054
|
agentId: args.agentId,
|
|
1050
1055
|
abstentionThreshold: args.abstentionThreshold,
|
|
@@ -1108,14 +1113,14 @@ var ExtractionSchema = z9.object({
|
|
|
1108
1113
|
entities: z9.array(
|
|
1109
1114
|
z9.object({
|
|
1110
1115
|
name: z9.string().min(1),
|
|
1111
|
-
type: z9.
|
|
1116
|
+
type: z9.string().min(1).transform((value) => normalizeGraphLabel(value, "CONCEPT"))
|
|
1112
1117
|
})
|
|
1113
1118
|
),
|
|
1114
1119
|
relations: z9.array(
|
|
1115
1120
|
z9.object({
|
|
1116
1121
|
source: z9.string().min(1),
|
|
1117
1122
|
target: z9.string().min(1),
|
|
1118
|
-
type: z9.
|
|
1123
|
+
type: z9.string().min(1).transform((value) => normalizeGraphLabel(value, "RELATED_TO"))
|
|
1119
1124
|
})
|
|
1120
1125
|
)
|
|
1121
1126
|
});
|
|
@@ -1123,8 +1128,9 @@ function buildExtractionPrompt(content) {
|
|
|
1123
1128
|
return [
|
|
1124
1129
|
"Extract graph facts as JSON only. No prose, no fences, no commentary.",
|
|
1125
1130
|
`Schema: {"entities":[{"name":string,"type":EntityType}],"relations":[{"source":string,"target":string,"type":RelationType}]}.`,
|
|
1126
|
-
`EntityType values: ${ENTITY_TYPES.join(", ")}.`,
|
|
1127
|
-
`RelationType values: ${RELATION_TYPES.join(", ")}.`,
|
|
1131
|
+
`Prefer EntityType values when applicable: ${ENTITY_TYPES.join(", ")}.`,
|
|
1132
|
+
`Prefer RelationType values when applicable: ${RELATION_TYPES.join(", ")}.`,
|
|
1133
|
+
"Emergent domain-specific labels are allowed; use uppercase words separated by underscores.",
|
|
1128
1134
|
"Include only entities/relations explicitly named or strongly implied in the content. Empty arrays are valid.",
|
|
1129
1135
|
`Content: ${content}`
|
|
1130
1136
|
].join("\n");
|
|
@@ -1324,7 +1330,7 @@ var ALL_TOOL_NAMES = ALL_TOOLS.map((t) => t.name);
|
|
|
1324
1330
|
// src/mcp/server.ts
|
|
1325
1331
|
async function runMcpServer(opts) {
|
|
1326
1332
|
const fetchImpl = opts.fetchImpl ?? fetch;
|
|
1327
|
-
const version = opts.version ?? (true ? "0.
|
|
1333
|
+
const version = opts.version ?? (true ? "0.32.1" : "0.0.0-dev");
|
|
1328
1334
|
const server = new McpServer(
|
|
1329
1335
|
{ name: "pyx-memory", version },
|
|
1330
1336
|
{ instructions: PYX_MEMORY_INSTRUCTIONS, capabilities: { tools: {} } }
|
package/dist/dashboard.mjs
CHANGED
|
@@ -11,9 +11,9 @@ import {
|
|
|
11
11
|
toGraphologyFormat,
|
|
12
12
|
transformGraphData,
|
|
13
13
|
unreachableHealth
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-W5FHHTBQ.mjs";
|
|
15
|
+
import "./chunk-6DZN7FYM.mjs";
|
|
16
|
+
import "./chunk-KSTI4M52.mjs";
|
|
17
17
|
export {
|
|
18
18
|
DashboardClient,
|
|
19
19
|
Poller,
|
package/dist/index.d.ts
CHANGED
|
@@ -594,6 +594,8 @@ interface MemorySearchResult {
|
|
|
594
594
|
entries: MemoryEntry[];
|
|
595
595
|
totalCount: number;
|
|
596
596
|
strategy: RAGStrategy;
|
|
597
|
+
/** Visible graph slice that supported the returned entries, when graph traversal contributed. */
|
|
598
|
+
graph?: GraphTraversalResult;
|
|
597
599
|
/** Optional scored entries with relevance scores for ranked results. */
|
|
598
600
|
scoredEntries?: Array<{
|
|
599
601
|
entry: MemoryEntry;
|
|
@@ -616,6 +618,20 @@ interface MemorySearchResult {
|
|
|
616
618
|
};
|
|
617
619
|
};
|
|
618
620
|
}
|
|
621
|
+
interface SourceEvidence {
|
|
622
|
+
/** Memory entry that produced this graph fact. */
|
|
623
|
+
memoryEntryId: string;
|
|
624
|
+
/** Namespace of the source memory entry. `null` = legacy / tenant-root. */
|
|
625
|
+
namespaceId?: string | null;
|
|
626
|
+
/** Optional source identifier copied from the memory entry or caller. */
|
|
627
|
+
source?: string;
|
|
628
|
+
/** Optional content hash copied from the memory entry or caller. */
|
|
629
|
+
contentHash?: string;
|
|
630
|
+
/** Optional short text evidence for the graph fact. */
|
|
631
|
+
snippet?: string;
|
|
632
|
+
/** When this evidence was recorded. */
|
|
633
|
+
createdAt?: Timestamp;
|
|
634
|
+
}
|
|
619
635
|
declare const StoreTarget: {
|
|
620
636
|
readonly SQLITE: "sqlite";
|
|
621
637
|
readonly VECTOR: "vector";
|
|
@@ -628,6 +644,10 @@ interface IngestEntity {
|
|
|
628
644
|
name: string;
|
|
629
645
|
/** Entity type — freeform, agent decides (e.g., "PERSON", "TOOL"). */
|
|
630
646
|
type: string;
|
|
647
|
+
/** Stable canonical identifier. Defaults to a deterministic name+type id. */
|
|
648
|
+
canonicalId?: string;
|
|
649
|
+
/** Source evidence for this graph node. Defaults to the containing memory entry. */
|
|
650
|
+
sourceEvidence?: SourceEvidence[];
|
|
631
651
|
/** Optional properties to attach to the graph node. */
|
|
632
652
|
properties?: Record<string, unknown>;
|
|
633
653
|
}
|
|
@@ -639,6 +659,8 @@ interface IngestRelationship {
|
|
|
639
659
|
target: string;
|
|
640
660
|
/** Relationship type — freeform, agent decides (e.g., "WORKS_AT", "USES"). */
|
|
641
661
|
type: string;
|
|
662
|
+
/** Source evidence for this graph edge. Defaults to the containing memory entry. */
|
|
663
|
+
sourceEvidence?: SourceEvidence[];
|
|
642
664
|
/** Optional properties to attach to the graph edge. */
|
|
643
665
|
properties?: Record<string, unknown>;
|
|
644
666
|
}
|
|
@@ -780,6 +802,8 @@ interface GraphNode {
|
|
|
780
802
|
id: string;
|
|
781
803
|
name: string;
|
|
782
804
|
type: string;
|
|
805
|
+
canonicalId?: string;
|
|
806
|
+
sourceEvidence?: SourceEvidence[];
|
|
783
807
|
properties: Record<string, unknown>;
|
|
784
808
|
memoryEntryIds: string[];
|
|
785
809
|
}
|
|
@@ -788,6 +812,7 @@ interface GraphRelationship {
|
|
|
788
812
|
sourceId: string;
|
|
789
813
|
targetId: string;
|
|
790
814
|
type: string;
|
|
815
|
+
sourceEvidence?: SourceEvidence[];
|
|
791
816
|
properties: Record<string, unknown>;
|
|
792
817
|
memoryEntryId?: string;
|
|
793
818
|
/**
|
|
@@ -845,6 +870,7 @@ interface EntityExtractionResult {
|
|
|
845
870
|
type: string;
|
|
846
871
|
}>;
|
|
847
872
|
}
|
|
873
|
+
declare function normalizeGraphLabel(value: string, fallback: string): string;
|
|
848
874
|
/**
|
|
849
875
|
* Merge caller-provided entities/relationships with LLM-extracted ones.
|
|
850
876
|
*
|
|
@@ -1183,4 +1209,4 @@ interface PrincipalContext {
|
|
|
1183
1209
|
/** Sentinel tenant ID used in single-tenant deployments. */
|
|
1184
1210
|
declare const SINGLE_TENANT_ID = "_single";
|
|
1185
1211
|
|
|
1186
|
-
export { type AgentId, type ApiResponse, type ConsolidationRunResult, type CorrectionInput, type CorrectionRecord, DEFAULTS, DEPRECATED_RAG_STRATEGIES, EmbeddingProviderName, type EnrichmentCallbacks, type EntityExtractionResult, type ExtendedMemoryInterface, type FetchCorrectionsInput, type GraphFailureMode, type GraphNode, type GraphRelationship, type GraphRepairResult, type GraphTraversalResult, type IngestEntity, type IngestErrorEvent, type IngestEvent, type IngestFileOptions, type IngestHeartbeatEvent, type IngestProgressEvent, type IngestRelationship, type IngestResultEvent, type IngestStage, type IngestionResult, MemoryClient, type MemoryClientOptions, type MemoryEntry, type MemoryIngestRequest, type MemoryInterface, type MemoryListParams, type MemoryListResult, type MemoryLogFilters, type MemorySearchParams, type MemorySearchResult, MemoryServerError, type MemoryStats, MemoryType, type MoveEntriesFilter, MoveFailureReason, type MoveResult, type MoveTarget, NamespaceIsolation, type PrincipalContext, RAGStrategy, SINGLE_TENANT_ID, SensitivityLevel, type StoreInput, StoreTarget, type TemporalQueryFilters, type TenantScopeOptions, type Timestamp, type Topology, type TopologyServiceVariant, VectorProvider, type WikiLintReport, mergeExtractedEntities };
|
|
1212
|
+
export { type AgentId, type ApiResponse, type ConsolidationRunResult, type CorrectionInput, type CorrectionRecord, DEFAULTS, DEPRECATED_RAG_STRATEGIES, EmbeddingProviderName, type EnrichmentCallbacks, type EntityExtractionResult, type ExtendedMemoryInterface, type FetchCorrectionsInput, type GraphFailureMode, type GraphNode, type GraphRelationship, type GraphRepairResult, type GraphTraversalResult, type IngestEntity, type IngestErrorEvent, type IngestEvent, type IngestFileOptions, type IngestHeartbeatEvent, type IngestProgressEvent, type IngestRelationship, type IngestResultEvent, type IngestStage, type IngestionResult, MemoryClient, type MemoryClientOptions, type MemoryEntry, type MemoryIngestRequest, type MemoryInterface, type MemoryListParams, type MemoryListResult, type MemoryLogFilters, type MemorySearchParams, type MemorySearchResult, MemoryServerError, type MemoryStats, MemoryType, type MoveEntriesFilter, MoveFailureReason, type MoveResult, type MoveTarget, NamespaceIsolation, type PrincipalContext, RAGStrategy, SINGLE_TENANT_ID, SensitivityLevel, type SourceEvidence, type StoreInput, StoreTarget, type TemporalQueryFilters, type TenantScopeOptions, type Timestamp, type Topology, type TopologyServiceVariant, VectorProvider, type WikiLintReport, mergeExtractedEntities, normalizeGraphLabel };
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MemoryClient,
|
|
3
3
|
MemoryServerError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6DZN7FYM.mjs";
|
|
5
5
|
import {
|
|
6
6
|
DEFAULTS,
|
|
7
7
|
DEPRECATED_RAG_STRATEGIES,
|
|
@@ -14,8 +14,9 @@ import {
|
|
|
14
14
|
SensitivityLevel,
|
|
15
15
|
StoreTarget,
|
|
16
16
|
VectorProvider,
|
|
17
|
-
mergeExtractedEntities
|
|
18
|
-
|
|
17
|
+
mergeExtractedEntities,
|
|
18
|
+
normalizeGraphLabel
|
|
19
|
+
} from "./chunk-KSTI4M52.mjs";
|
|
19
20
|
export {
|
|
20
21
|
DEFAULTS,
|
|
21
22
|
DEPRECATED_RAG_STRATEGIES,
|
|
@@ -30,5 +31,6 @@ export {
|
|
|
30
31
|
SensitivityLevel,
|
|
31
32
|
StoreTarget,
|
|
32
33
|
VectorProvider,
|
|
33
|
-
mergeExtractedEntities
|
|
34
|
+
mergeExtractedEntities,
|
|
35
|
+
normalizeGraphLabel
|
|
34
36
|
};
|
package/dist/react.mjs
CHANGED
|
@@ -11,9 +11,9 @@ import {
|
|
|
11
11
|
toGraphologyFormat,
|
|
12
12
|
transformGraphData,
|
|
13
13
|
unreachableHealth
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-W5FHHTBQ.mjs";
|
|
15
|
+
import "./chunk-6DZN7FYM.mjs";
|
|
16
|
+
import "./chunk-KSTI4M52.mjs";
|
|
17
17
|
|
|
18
18
|
// ../dashboard/src/hooks/use-consolidation-log.ts
|
|
19
19
|
import { useCallback as useCallback2, useMemo } from "react";
|