@pyxmate/memory 0.31.4 → 0.32.0

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  mergeExtractedEntities
3
- } from "./chunk-I45LGUJR.mjs";
3
+ } from "./chunk-KSTI4M52.mjs";
4
4
 
5
5
  // ../client/src/memory-client.ts
6
6
  var MemoryServerError = class extends Error {
@@ -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({ ...relationship, source, target });
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,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MemoryClient
3
- } from "./chunk-27RJJTZH.mjs";
3
+ } from "./chunk-6DZN7FYM.mjs";
4
4
 
5
5
  // ../dashboard/src/aggregations/consolidation-analytics.ts
6
6
  function analyzeConsolidationLog(entries) {
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- mergeExtractedEntities
4
- } from "../chunk-I45LGUJR.mjs";
3
+ mergeExtractedEntities,
4
+ normalizeGraphLabel
5
+ } from "../chunk-KSTI4M52.mjs";
5
6
 
6
7
  // src/cli/exit-codes.ts
7
8
  var EXIT = {
@@ -1108,14 +1109,14 @@ var ExtractionSchema = z9.object({
1108
1109
  entities: z9.array(
1109
1110
  z9.object({
1110
1111
  name: z9.string().min(1),
1111
- type: z9.enum(ENTITY_TYPES)
1112
+ type: z9.string().min(1).transform((value) => normalizeGraphLabel(value, "CONCEPT"))
1112
1113
  })
1113
1114
  ),
1114
1115
  relations: z9.array(
1115
1116
  z9.object({
1116
1117
  source: z9.string().min(1),
1117
1118
  target: z9.string().min(1),
1118
- type: z9.enum(RELATION_TYPES)
1119
+ type: z9.string().min(1).transform((value) => normalizeGraphLabel(value, "RELATED_TO"))
1119
1120
  })
1120
1121
  )
1121
1122
  });
@@ -1123,8 +1124,9 @@ function buildExtractionPrompt(content) {
1123
1124
  return [
1124
1125
  "Extract graph facts as JSON only. No prose, no fences, no commentary.",
1125
1126
  `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(", ")}.`,
1127
+ `Prefer EntityType values when applicable: ${ENTITY_TYPES.join(", ")}.`,
1128
+ `Prefer RelationType values when applicable: ${RELATION_TYPES.join(", ")}.`,
1129
+ "Emergent domain-specific labels are allowed; use uppercase words separated by underscores.",
1128
1130
  "Include only entities/relations explicitly named or strongly implied in the content. Empty arrays are valid.",
1129
1131
  `Content: ${content}`
1130
1132
  ].join("\n");
@@ -1324,7 +1326,7 @@ var ALL_TOOL_NAMES = ALL_TOOLS.map((t) => t.name);
1324
1326
  // src/mcp/server.ts
1325
1327
  async function runMcpServer(opts) {
1326
1328
  const fetchImpl = opts.fetchImpl ?? fetch;
1327
- const version = opts.version ?? (true ? "0.31.4" : "0.0.0-dev");
1329
+ const version = opts.version ?? (true ? "0.32.0" : "0.0.0-dev");
1328
1330
  const server = new McpServer(
1329
1331
  { name: "pyx-memory", version },
1330
1332
  { instructions: PYX_MEMORY_INSTRUCTIONS, capabilities: { tools: {} } }
@@ -11,9 +11,9 @@ import {
11
11
  toGraphologyFormat,
12
12
  transformGraphData,
13
13
  unreachableHealth
14
- } from "./chunk-HXF7EXXP.mjs";
15
- import "./chunk-27RJJTZH.mjs";
16
- import "./chunk-I45LGUJR.mjs";
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-27RJJTZH.mjs";
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
- } from "./chunk-I45LGUJR.mjs";
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-HXF7EXXP.mjs";
15
- import "./chunk-27RJJTZH.mjs";
16
- import "./chunk-I45LGUJR.mjs";
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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pyxmate/memory",
3
- "version": "0.31.4",
3
+ "version": "0.32.0",
4
4
  "type": "module",
5
5
  "description": "SDK for pyx-memory — Memory as a Service for AI agents",
6
6
  "license": "MIT",