@pyxmate/memory 0.45.1 → 1.0.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.
@@ -11,9 +11,9 @@ import {
11
11
  toGraphologyFormat,
12
12
  transformGraphData,
13
13
  unreachableHealth
14
- } from "./chunk-DKNGLNN4.mjs";
15
- import "./chunk-UV2DFSKR.mjs";
16
- import "./chunk-KSTI4M52.mjs";
14
+ } from "./chunk-ZCGJGI2O.mjs";
15
+ import "./chunk-PXQLVQAA.mjs";
16
+ import "./chunk-X6AYWXW7.mjs";
17
17
  export {
18
18
  DashboardClient,
19
19
  Poller,
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { StoreInput as StoreInput$1, MemoryEntry as MemoryEntry$1, MemorySearchParams as MemorySearchParams$1, MemorySearchResult as MemorySearchResult$1, MemoryType as MemoryType$1, PrincipalContext as PrincipalContext$1, MemoryStats as MemoryStats$1, LineageParams as LineageParams$1, LineageResult as LineageResult$1, ReinforceParams as ReinforceParams$1, ReinforceResult as ReinforceResult$1, WikiLintReport as WikiLintReport$1, GraphRepairResult as GraphRepairResult$1, ExtractedImageMeta as ExtractedImageMeta$1, IngestEntity as IngestEntity$1, IngestRelationship as IngestRelationship$1, EntityExtractionResult as EntityExtractionResult$1, Topology as Topology$1, IngestEvent as IngestEvent$1, GraphNode as GraphNode$1, GraphTraversalResult as GraphTraversalResult$1, CorrectionRecord as CorrectionRecord$1 } from '@pyx-memory/shared';
1
+ import { StoreInput as StoreInput$1, MemoryEntry as MemoryEntry$1, MemorySearchParams as MemorySearchParams$1, MemorySearchResult as MemorySearchResult$1, MemoryType as MemoryType$1, PrincipalContext as PrincipalContext$1, SensitivityLevel as SensitivityLevel$1, MemoryStats as MemoryStats$1, LineageParams as LineageParams$1, LineageResult as LineageResult$1, ReinforceParams as ReinforceParams$1, ReinforceResult as ReinforceResult$1, WikiLintReport as WikiLintReport$1, GraphRepairResult as GraphRepairResult$1, ExtractedImageMeta as ExtractedImageMeta$1, IngestEntity as IngestEntity$1, IngestRelationship as IngestRelationship$1, EntityExtractionResult as EntityExtractionResult$1, Topology as Topology$1, IngestEvent as IngestEvent$1, GraphNode as GraphNode$1, GraphTraversalResult as GraphTraversalResult$1, CorrectionRecord as CorrectionRecord$1 } from '@pyx-memory/shared';
2
2
 
3
3
  /** Parameters for paginated entry listing. */
4
4
  interface MemoryListParams {
@@ -19,6 +19,8 @@ interface MemoryListParams {
19
19
  * and get the legacy tenant-only scope.
20
20
  */
21
21
  principal?: PrincipalContext$1;
22
+ /** Maximum sensitivity level to include. Omitted preserves legacy behavior. */
23
+ maxSensitivity?: SensitivityLevel$1;
22
24
  /**
23
25
  * R1/R2 — opt-in list of `metadata._kind` values to include in the
24
26
  * response. When omitted or empty, the default-set returns only entries
@@ -42,6 +44,8 @@ interface TemporalQueryFilters {
42
44
  agentId?: string;
43
45
  source?: string;
44
46
  limit?: number;
47
+ /** Maximum sensitivity level to include. Omitted preserves legacy behavior. */
48
+ maxSensitivity?: SensitivityLevel$1;
45
49
  }
46
50
  /** Filters for the chronological feed (`log`, Karpathy `log.md` primitive). */
47
51
  interface MemoryLogFilters {
@@ -52,6 +56,8 @@ interface MemoryLogFilters {
52
56
  type?: MemoryType$1;
53
57
  agentId?: string;
54
58
  source?: string;
59
+ /** Maximum sensitivity level to include. Omitted preserves legacy behavior. */
60
+ maxSensitivity?: SensitivityLevel$1;
55
61
  }
56
62
  /** Options for scoping operations to a specific tenant. */
57
63
  interface TenantScopeOptions {
@@ -69,6 +75,8 @@ interface TenantScopeOptions {
69
75
  * legacy tenant-only scope.
70
76
  */
71
77
  principal?: PrincipalContext$1;
78
+ /** Maximum sensitivity level to include. Omitted preserves legacy behavior. */
79
+ maxSensitivity?: SensitivityLevel$1;
72
80
  }
73
81
  /** Abstract interface for memory systems (local or remote). */
74
82
  interface MemoryInterface {
@@ -149,7 +157,9 @@ interface ExtendedMemoryInterface extends MemoryInterface {
149
157
  * - Mixed file + both → describes images + extracts from both sources
150
158
  *
151
159
  * Without any callback, the ingest stream emits the server result with no
152
- * SDK-side enrichment caller opted out entirely.
160
+ * SDK-side enrichment. Server-side text/entity extraction may still run when
161
+ * configured; image understanding still requires caller-provided
162
+ * descriptions/hooks.
153
163
  */
154
164
  interface EnrichmentCallbacks {
155
165
  /**
@@ -191,9 +201,12 @@ interface IngestFileOptions {
191
201
  }
192
202
  /**
193
203
  * Caller-supplied enrichment for the per-call store path. Mirrors
194
- * {@link EnrichmentCallbacks} for file ingest the SDK invokes the callback
195
- * (against the caller's own LLM credentials) and merges the result into the
196
- * ingest payload before POSTing, so the server holds no LLM keys.
204
+ * {@link EnrichmentCallbacks} for file ingest. When supplied, the SDK invokes
205
+ * the callback and merges the result into the payload before POSTing. Without
206
+ * a callback, server-side text/entity extraction can run only when the server
207
+ * has an extraction brain configured; otherwise callers must pass graph data
208
+ * or use caller-side hooks. Images always require caller-provided
209
+ * descriptions/hooks.
197
210
  */
198
211
  interface StoreEnrichmentCallbacks {
199
212
  /**
@@ -203,8 +216,8 @@ interface StoreEnrichmentCallbacks {
203
216
  *
204
217
  * Skipped when `entry.extractEntities === false`. When
205
218
  * `entry.extractEntities === true` but this callback is not supplied,
206
- * `MemoryClient.store()` throws a loud error rather than silently no-op'ing
207
- * (same shape as the in-process Memory.store() guard).
219
+ * `MemoryClient.store()` forwards the hint so the server-side extraction
220
+ * brain can run and loud-fail if it is not configured.
208
221
  */
209
222
  extractEntities?: (input: {
210
223
  content: string;
@@ -495,6 +508,24 @@ declare const EmbeddingProviderName: {
495
508
  readonly HTTP: "http";
496
509
  };
497
510
  type EmbeddingProviderName = (typeof EmbeddingProviderName)[keyof typeof EmbeddingProviderName];
511
+ type GraphEnrichmentStatus = 'caller-provided' | 'extracted' | 'merged' | 'opted-out' | 'skipped-duplicate' | 'skipped-sensitive' | 'skipped-unprovisioned' | 'extracted-empty' | 'failed-graph-write' | 'failed-best-effort';
512
+ interface GraphEnrichment {
513
+ status: GraphEnrichmentStatus;
514
+ provider?: 'http' | 'local' | 'none';
515
+ reason?: string;
516
+ action?: string;
517
+ }
518
+ /**
519
+ * A caller-supplied relationship whose source or target name did not resolve to
520
+ * any entity in the same store call (after name normalization), so the edge was
521
+ * not written. Surfaced on the store response so the agent — not just the server
522
+ * log — can see which edges to re-send.
523
+ */
524
+ interface DroppedGraphRelationship {
525
+ source: string;
526
+ target: string;
527
+ type: string;
528
+ }
498
529
  interface MemoryEntry {
499
530
  id: string;
500
531
  content: string;
@@ -529,6 +560,12 @@ interface MemoryEntry {
529
560
  graphEntitiesWritten?: number;
530
561
  /** Number of graph relationships written by this store call. Present on store responses. */
531
562
  graphRelationshipsWritten?: number;
563
+ /** Count of caller relationships dropped because an endpoint name did not match any entity in the call. Present (and >0) only when edges were dropped. */
564
+ graphRelationshipsDropped?: number;
565
+ /** Up to 20 of the dropped relationships (source/target/type), so the agent can re-send them. Present only when edges were dropped. */
566
+ graphRelationshipsDroppedDetail?: DroppedGraphRelationship[];
567
+ /** Graph extraction/enrichment outcome for this store call. Present on graph-targeted store responses. */
568
+ graphEnrichment?: GraphEnrichment;
532
569
  /** Tenant ID for multi-tenant isolation. */
533
570
  tenantId?: string;
534
571
  /** User ID within the tenant. */
@@ -602,8 +639,8 @@ interface MemorySearchParams {
602
639
  * only). The pipeline retrieves and dedups a deeper candidate pool (≥50),
603
640
  * scores it through the cross-encoder, then truncates to `limit` —
604
641
  * reranking after truncation cannot change top-`limit` set membership.
605
- * EMBEDDED ONLY: `MemoryClient.search` rejects it (HTTP API does not
606
- * forward it).
642
+ * Forwarded by `MemoryClient.search` and the HTTP route; core enforces
643
+ * hybrid-only usage.
607
644
  */
608
645
  enableRerank?: boolean;
609
646
  /**
@@ -643,7 +680,7 @@ interface MemorySearchParams {
643
680
  * reinforces); idle alone never revives. See `docs/H8-MEMORY-MODEL-DESIGN.md`.
644
681
  */
645
682
  effort?: 'quick' | 'medium' | 'deep';
646
- /** Maximum sensitivity level to include in results. Entries above this level are excluded or redacted. */
683
+ /** Maximum sensitivity level to include in results. Entries above this level are excluded. */
647
684
  maxSensitivity?: SensitivityLevel;
648
685
  /** Tenant ID for multi-tenant isolation. */
649
686
  tenantId?: string;
@@ -683,10 +720,17 @@ interface MemorySearchResult {
683
720
  strategy: RAGStrategy;
684
721
  /** Visible graph slice that supported the returned entries, when graph traversal contributed. */
685
722
  graph?: GraphTraversalResult;
686
- /** Optional scored entries with relevance scores for ranked results. */
723
+ /**
724
+ * Optional scored entries for ranked results. `score` is the fused RANK score
725
+ * (RRF + recency/importance/access priors) — good for ordering, NOT a relevance
726
+ * magnitude. `vectorSimilarity` is the raw dense query-similarity (LanceDB
727
+ * transformed-L2, 1/(1+distance)); null when the entry has no dense signal
728
+ * (FTS/graph-only). Surface vectorSimilarity, not score, as a "% match".
729
+ */
687
730
  scoredEntries?: Array<{
688
731
  entry: MemoryEntry;
689
732
  score: number;
733
+ vectorSimilarity?: number | null;
690
734
  }>;
691
735
  /** Confidence assessment for abstention. Present when search produces scored entries. */
692
736
  confidence?: {
@@ -918,6 +962,8 @@ interface FetchCorrectionsInput {
918
962
  project?: string;
919
963
  /** Max corrections to return. Default 5, hard cap 5. */
920
964
  limit?: number;
965
+ /** Optional sensitivity cap for hosted/HTTP callers. Omitted preserves trusted in-process behavior. */
966
+ maxSensitivity?: SensitivityLevel;
921
967
  }
922
968
  /** One applicable correction returned by `fetchApplicableCorrections`. */
923
969
  interface CorrectionRecord {
@@ -1005,11 +1051,10 @@ interface WikiLintReport {
1005
1051
  /**
1006
1052
  * Result shape returned by an LLM entity extractor — entities + relations.
1007
1053
  *
1008
- * Lives in shared so both the server-side Memory.store() merge and any
1009
- * client-side enrichment path (`MemoryClient.store(..., { enrichment })`,
1010
- * the MCP `store_memory` tool that goes through MCP sampling) can speak the
1011
- * exact same structural type without crossing the core→client circular
1012
- * dependency.
1054
+ * Lives in shared so server-side Memory.store(), client-side enrichment
1055
+ * (`MemoryClient.store(..., { enrichment })`), and MCP store forwarding can
1056
+ * speak the exact same structural type without crossing the core→client
1057
+ * circular dependency.
1013
1058
  */
1014
1059
  interface EntityExtractionResult {
1015
1060
  entities: Array<{
@@ -1023,6 +1068,18 @@ interface EntityExtractionResult {
1023
1068
  }>;
1024
1069
  }
1025
1070
  declare function normalizeGraphLabel(value: string, fallback: string): string;
1071
+ /**
1072
+ * Identity key for a graph node: the normalized name alone. `type` is a node
1073
+ * ATTRIBUTE, never part of identity — it is a noisy, role-dependent, LLM-guessed
1074
+ * label that the relationship contract cannot even address (edges reference
1075
+ * names only), so using it as a primary key fractures one real-world entity
1076
+ * into disconnected nodes and severs multi-hop chains.
1077
+ *
1078
+ * The single source of truth for name identity: the SQLite/Neo4j upserts and
1079
+ * the core relationship resolver match by this, and the MCP store guard predicts
1080
+ * edge resolvability with it — all three MUST agree, so they import this one fn.
1081
+ */
1082
+ declare function normalizeNameKey(name: string): string;
1026
1083
  /**
1027
1084
  * Merge caller-provided entities/relationships with LLM-extracted ones.
1028
1085
  *
@@ -1061,6 +1118,8 @@ type TopologyServiceVariant = 'cloud' | 'full';
1061
1118
  * is internal infrastructure and is intentionally NOT exposed here.
1062
1119
  */
1063
1120
  type TopologyEmbeddingLocation = 'inline' | 'remote';
1121
+ /** Server-side graph extraction provider resolved at boot. */
1122
+ type TopologyExtractionProvider = 'http' | 'local' | 'none';
1064
1123
  /**
1065
1124
  * Public topology snapshot returned by `GET /status`. Reflects actual runtime
1066
1125
  * capability (variant detected from import probe, embedding location derived
@@ -1084,6 +1143,9 @@ interface Topology {
1084
1143
  modelId: string;
1085
1144
  dimensions: number;
1086
1145
  };
1146
+ extraction: {
1147
+ provider: TopologyExtractionProvider;
1148
+ };
1087
1149
  }
1088
1150
 
1089
1151
  /** Metadata for a single image extracted from a PDF. */
@@ -1361,4 +1423,12 @@ interface PrincipalContext {
1361
1423
  /** Sentinel tenant ID used in single-tenant deployments. */
1362
1424
  declare const SINGLE_TENANT_ID = "_single";
1363
1425
 
1364
- 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, type LineageParams, type LineageResult, type LineageVersion, 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, type ReinforceParams, type ReinforceResult, type ReinforceSignal, SINGLE_TENANT_ID, SensitivityLevel, type SourceEvidence, type StoreInput, StoreTarget, type TemporalQueryFilters, type TenantScopeOptions, type Timestamp, type Topology, type TopologyServiceVariant, VectorProvider, type WikiLintReport, mergeExtractedEntities, normalizeGraphLabel };
1426
+ interface CreatePyxMemoryOptions {
1427
+ url?: string;
1428
+ apiKey?: string;
1429
+ requestTimeoutMs?: number;
1430
+ defaultHeaders?: Record<string, string>;
1431
+ }
1432
+ declare function createPyxMemory(opts?: CreatePyxMemoryOptions): MemoryClient;
1433
+
1434
+ export { type AgentId, type ApiResponse, type ConsolidationRunResult, type CorrectionInput, type CorrectionRecord, type CreatePyxMemoryOptions, DEFAULTS, DEPRECATED_RAG_STRATEGIES, type DroppedGraphRelationship, EmbeddingProviderName, type EnrichmentCallbacks, type EntityExtractionResult, type ExtendedMemoryInterface, type FetchCorrectionsInput, type GraphEnrichment, type GraphEnrichmentStatus, 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, type LineageParams, type LineageResult, type LineageVersion, 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, type ReinforceParams, type ReinforceResult, type ReinforceSignal, SINGLE_TENANT_ID, SensitivityLevel, type SourceEvidence, type StoreInput, StoreTarget, type TemporalQueryFilters, type TenantScopeOptions, type Timestamp, type Topology, type TopologyExtractionProvider, type TopologyServiceVariant, VectorProvider, type WikiLintReport, createPyxMemory, mergeExtractedEntities, normalizeGraphLabel, normalizeNameKey };
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  MemoryClient,
3
3
  MemoryServerError
4
- } from "./chunk-UV2DFSKR.mjs";
4
+ } from "./chunk-PXQLVQAA.mjs";
5
5
  import {
6
6
  DEFAULTS,
7
7
  DEPRECATED_RAG_STRATEGIES,
@@ -15,8 +15,23 @@ import {
15
15
  StoreTarget,
16
16
  VectorProvider,
17
17
  mergeExtractedEntities,
18
- normalizeGraphLabel
19
- } from "./chunk-KSTI4M52.mjs";
18
+ normalizeGraphLabel,
19
+ normalizeNameKey
20
+ } from "./chunk-X6AYWXW7.mjs";
21
+
22
+ // src/preset.ts
23
+ var DEFAULT_MEMORY_URL = `http://localhost:${DEFAULTS.MEMORY_SERVER_PORT}`;
24
+ function createPyxMemory(opts = {}) {
25
+ const env = typeof process !== "undefined" ? process.env : {};
26
+ const url = opts.url ?? env.PYX_MEMORY_URL ?? DEFAULT_MEMORY_URL;
27
+ const apiKey = opts.apiKey ?? env.PYX_MEMORY_API_KEY;
28
+ const clientOptions = {
29
+ ...apiKey !== void 0 ? { apiKey } : {},
30
+ ...opts.defaultHeaders !== void 0 ? { defaultHeaders: opts.defaultHeaders } : {},
31
+ ...opts.requestTimeoutMs !== void 0 ? { requestTimeoutMs: opts.requestTimeoutMs } : {}
32
+ };
33
+ return new MemoryClient(url, clientOptions);
34
+ }
20
35
  export {
21
36
  DEFAULTS,
22
37
  DEPRECATED_RAG_STRATEGIES,
@@ -31,6 +46,8 @@ export {
31
46
  SensitivityLevel,
32
47
  StoreTarget,
33
48
  VectorProvider,
49
+ createPyxMemory,
34
50
  mergeExtractedEntities,
35
- normalizeGraphLabel
51
+ normalizeGraphLabel,
52
+ normalizeNameKey
36
53
  };
package/dist/react.mjs CHANGED
@@ -11,9 +11,9 @@ import {
11
11
  toGraphologyFormat,
12
12
  transformGraphData,
13
13
  unreachableHealth
14
- } from "./chunk-DKNGLNN4.mjs";
15
- import "./chunk-UV2DFSKR.mjs";
16
- import "./chunk-KSTI4M52.mjs";
14
+ } from "./chunk-ZCGJGI2O.mjs";
15
+ import "./chunk-PXQLVQAA.mjs";
16
+ import "./chunk-X6AYWXW7.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.45.1",
3
+ "version": "1.0.0",
4
4
  "type": "module",
5
5
  "description": "SDK for pyx-memory — Memory as a Service for AI agents",
6
6
  "license": "MIT",
@@ -28,6 +28,10 @@
28
28
  "import": "./dist/dashboard.mjs",
29
29
  "types": "./dist/dashboard.d.ts"
30
30
  },
31
+ "./agent-contract": {
32
+ "import": "./dist/agent-contract.mjs",
33
+ "types": "./dist/agent-contract.d.ts"
34
+ },
31
35
  "./react": {
32
36
  "import": "./dist/react.mjs",
33
37
  "types": "./dist/react.d.ts"
@@ -43,6 +47,7 @@
43
47
  ],
44
48
  "scripts": {
45
49
  "build": "tsup",
50
+ "generate:agent-template": "bun run scripts/generate-agent-template.ts",
46
51
  "test": "bun test",
47
52
  "typecheck": "tsc --noEmit",
48
53
  "clean": "rm -rf dist skills node_modules .turbo"