@pyxmate/memory 1.24.0 → 1.25.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.
@@ -958,10 +958,36 @@ var MemoryClient = class {
958
958
  });
959
959
  }
960
960
  // --- ExtendedMemoryInterface methods ---
961
- async consolidate() {
962
- return this.fetchApi("/api/memory/consolidate", {
963
- method: "POST"
964
- });
961
+ /**
962
+ * Without `judge` the server's own judge decides (none on a plain server, so
963
+ * nothing merges). With `judge`, the server only proposes pairs; `judge`
964
+ * returns the ones to merge and only those merges are posted. If `judge`
965
+ * throws, nothing is posted and the call rejects. A server without caller
966
+ * judging answers 404 and changes nothing.
967
+ */
968
+ async consolidate(options) {
969
+ if (!options?.judge) {
970
+ return this.fetchApi("/api/memory/consolidate", {
971
+ method: "POST"
972
+ });
973
+ }
974
+ const run = await this.fetchApi(
975
+ "/api/memory/consolidate/pairs",
976
+ { method: "POST" }
977
+ );
978
+ const merges = run.pairs.length > 0 ? await options.judge(run.pairs) : [];
979
+ const judgements = merges.length > 0 ? await this.fetchApi("/api/memory/consolidate/judgements", {
980
+ method: "POST",
981
+ body: JSON.stringify({
982
+ merges: merges.map(({ olderId, newerId, olderHash, newerHash }) => ({
983
+ olderId,
984
+ newerId,
985
+ olderHash,
986
+ newerHash
987
+ }))
988
+ })
989
+ }) : { merged: [], rejected: [], vectorFailures: [] };
990
+ return { ...run, entriesMerged: judgements.merged.length, judgements };
965
991
  }
966
992
  async forget(id, reason) {
967
993
  try {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MemoryClient
3
- } from "./chunk-LF22PCY6.mjs";
3
+ } from "./chunk-EHFEPWCL.mjs";
4
4
 
5
5
  // ../dashboard/src/aggregations/consolidation-analytics.ts
6
6
  function analyzeConsolidationLog(entries) {
@@ -2877,7 +2877,7 @@ function createProxyServer(client, version, uploadLocalFile, hostedFileIngest) {
2877
2877
  return server;
2878
2878
  }
2879
2879
  async function runMcpProxyServer(opts) {
2880
- const version = opts.version ?? (true ? "1.24.0" : "0.0.0-dev");
2880
+ const version = opts.version ?? (true ? "1.25.1" : "0.0.0-dev");
2881
2881
  const read = await opts.readCredentials();
2882
2882
  if (!read.ok) {
2883
2883
  throw new Error(
@@ -11,8 +11,8 @@ import {
11
11
  toGraphologyFormat,
12
12
  transformGraphData,
13
13
  unreachableHealth
14
- } from "./chunk-L2RHO7DP.mjs";
15
- import "./chunk-LF22PCY6.mjs";
14
+ } from "./chunk-GLQGLTMK.mjs";
15
+ import "./chunk-EHFEPWCL.mjs";
16
16
  import "./chunk-KZKGRND2.mjs";
17
17
  import "./chunk-VXXRCAKS.mjs";
18
18
  export {
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, SensitivityLevel as SensitivityLevel$1, MemoryStats as MemoryStats$1, MemoryInsights as MemoryInsights$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, GraphEnrichEvent as GraphEnrichEvent$1, GraphNode as GraphNode$1, GraphTraversalResult as GraphTraversalResult$1, CorrectionRecord as CorrectionRecord$1 } from '@pyx-memory/shared';
1
+ import { MemoryType as MemoryType$1, StoreInput as StoreInput$1, MemoryEntry as MemoryEntry$1, MemorySearchParams as MemorySearchParams$1, MemorySearchResult as MemorySearchResult$1, PrincipalContext as PrincipalContext$1, SensitivityLevel as SensitivityLevel$1, MemoryStats as MemoryStats$1, MemoryInsights as MemoryInsights$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, GraphEnrichEvent as GraphEnrichEvent$1, GraphNode as GraphNode$1, GraphTraversalResult as GraphTraversalResult$1, CorrectionRecord as CorrectionRecord$1 } from '@pyx-memory/shared';
2
2
  export { documentContentSource, documentGraphSource, documentImageSource } from '@pyx-memory/shared';
3
3
  export { e as encodeListCursorToken, p as parseListCursorToken } from './data-plane-contract-CGU0qjv4.js';
4
4
 
@@ -204,8 +204,8 @@ interface MemoryEntry {
204
204
  * UPDATE replaced this one during consolidation. `'archived'` (1b) means decay
205
205
  * retired it (no successor) — kept, strength 0, `deep`-tier only. All three
206
206
  * are kept (history / lineage / deep recall) but `superseded`/`archived` are
207
- * excluded from default/quick/medium search. Only `forget()` and exact-byte-
208
- * duplicate collapse hard-delete. See `docs/H8-MEMORY-MODEL-DESIGN.md`.
207
+ * excluded from default/quick/medium search. Only `forget()` hard-deletes.
208
+ * See `docs/H8-MEMORY-MODEL-DESIGN.md`.
209
209
  */
210
210
  status?: 'active' | 'superseded' | 'archived';
211
211
  /**
@@ -966,12 +966,70 @@ interface MemoryInterface {
966
966
  queryByEventTime(startTime: string, endTime: string, filters?: TemporalQueryFilters): Promise<MemoryEntry$1[]>;
967
967
  shutdown(): Promise<void>;
968
968
  }
969
+ /** One side of a {@link ConsolidationPair}, as a judge needs to read it. */
970
+ interface ConsolidationPairSide {
971
+ content: string;
972
+ source?: string;
973
+ metadata: Record<string, unknown>;
974
+ agentId?: string;
975
+ createdAt: string;
976
+ eventTime?: string;
977
+ }
978
+ /**
979
+ * Two active, unpinned, unencrypted rows of the same tenant, namespace and type
980
+ * that consolidation proposes to merge: equal content hash (`exact`) or cosine
981
+ * above 0.9. A merge supersedes `olderId` by `newerId` (by eventTime, else createdAt).
982
+ */
983
+ interface ConsolidationPair {
984
+ olderId: string;
985
+ newerId: string;
986
+ /** null for rows written before content hashing; a caller judge cannot merge those. */
987
+ olderHash: string | null;
988
+ newerHash: string | null;
989
+ exact: boolean;
990
+ cosine: number;
991
+ type: MemoryType$1;
992
+ namespaceId: string | null;
993
+ older: ConsolidationPairSide;
994
+ newer: ConsolidationPairSide;
995
+ }
996
+ /** A pair the caller's judge decided to merge; the hashes are the pair's, so a changed row is refused. */
997
+ interface ConsolidationMerge {
998
+ olderId: string;
999
+ newerId: string;
1000
+ olderHash: string;
1001
+ newerHash: string;
1002
+ }
1003
+ /** What `POST /api/memory/consolidate/judgements` applied. */
1004
+ interface ConsolidationJudgementsResult {
1005
+ /** Older ids now superseded by their newer partner. */
1006
+ merged: string[];
1007
+ /** Merges refused because the pair no longer holds; nothing changed for them. */
1008
+ rejected: Array<ConsolidationMerge & {
1009
+ reason: string;
1010
+ }>;
1011
+ /** Superseded rows whose vector status sync failed; default search still hides them. */
1012
+ vectorFailures: Array<{
1013
+ entryId: string;
1014
+ error: string;
1015
+ }>;
1016
+ }
969
1017
  /** Consolidation run result. */
970
1018
  interface ConsolidationRunResult {
971
1019
  entriesProcessed: number;
1020
+ /** Supersessions this run; consolidation never deletes. */
972
1021
  entriesMerged: number;
973
1022
  entriesArchived: number;
974
1023
  durationMs: number;
1024
+ /** Proposed pairs by kind; only a judge turns a pair into a merge. */
1025
+ pairsExact: number;
1026
+ pairsNear: number;
1027
+ /** Who judged the pairs: the server's LLM, the caller, or nobody (nothing merges). */
1028
+ judge: 'llm' | 'caller' | 'none';
1029
+ /** The proposed pairs, returned only to a caller judge. */
1030
+ pairs?: ConsolidationPair[];
1031
+ /** `MemoryClient.consolidate({ judge })` only: what applying the judge's merges did. */
1032
+ judgements?: ConsolidationJudgementsResult;
975
1033
  }
976
1034
  /** Extended interface with lifecycle operations. Non-breaking for existing consumers. */
977
1035
  interface ExtendedMemoryInterface extends MemoryInterface {
@@ -1345,7 +1403,16 @@ declare class MemoryClient implements ExtendedMemoryInterface {
1345
1403
  nodeId: string;
1346
1404
  depth?: number;
1347
1405
  }): Promise<GraphTraversalResult$1>;
1348
- consolidate(): Promise<ConsolidationRunResult>;
1406
+ /**
1407
+ * Without `judge` the server's own judge decides (none on a plain server, so
1408
+ * nothing merges). With `judge`, the server only proposes pairs; `judge`
1409
+ * returns the ones to merge and only those merges are posted. If `judge`
1410
+ * throws, nothing is posted and the call rejects. A server without caller
1411
+ * judging answers 404 and changes nothing.
1412
+ */
1413
+ consolidate(options?: {
1414
+ judge?: (pairs: ConsolidationPair[]) => Promise<ConsolidationMerge[]>;
1415
+ }): Promise<ConsolidationRunResult>;
1349
1416
  forget(id: string, reason?: string): Promise<boolean>;
1350
1417
  summarizeSession(sessionId: string): Promise<MemoryEntry$1 | null>;
1351
1418
  lint(options?: {
@@ -1936,4 +2003,4 @@ interface CreatePyxMemoryOptions {
1936
2003
  }
1937
2004
  declare function createPyxMemory(opts?: CreatePyxMemoryOptions): MemoryClient;
1938
2005
 
1939
- export { type AgentId, type ApiResponse, type ConsolidationRunResult, type CorrectionInput, type CorrectionRecord, type CreatePyxMemoryOptions, DEFAULTS, DEPRECATED_RAG_STRATEGIES, DisabledMemory, type DroppedGraphRelationship, type DueScanInput, EmbeddingProviderName, type EnrichmentCallbacks, type EnrichmentPurpose, type EntityExtractionResult, type ExpandAnchorStatus, type ExpandParams, type ExpandResult, type ExtendedMemoryInterface, type FetchCorrectionsInput, type FileDownloadOptions, type GraphEnrichEvent, type GraphEnrichFileOptions, type GraphEnrichPreparedEvent, type GraphEnrichResult, type GraphEnrichResultEvent, type GraphEnrichment, type GraphEnrichmentStatus, type GraphExtractionPayload, type GraphFailureMode, type GraphNode, type GraphRelationship, type GraphRepairResult, type GraphTelemetrySnapshot, 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, MEMORY_PROJECT_LABEL_MAX_CHARS, MemoryClient, type MemoryClientOptions, type MemoryEntry, type MemoryIngestRequest, type MemoryInsightMetrics, type MemoryInsights, type MemoryInterface, type MemoryListParams, type MemoryListResult, type MemoryLogFilters, type MemoryProjectInsight, 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, SESSION_ORDINAL_MAX, SINGLE_TENANT_ID, type SecretElevationAggregate, type SecretElevationNotice, SensitivityLevel, type SourceEvidence, type StoreInput, StoreTarget, TAXONOMY_MAX_CATEGORIES, TAXONOMY_MAX_PROJECTS, TAXONOMY_MAX_SAMPLE_TOPICS, TAXONOMY_MAX_TOP_ENTITIES, type TemporalQueryFilters, type TenantScopeOptions, type Timestamp, type Topology, type TopologyExtractionProvider, type TopologyServiceVariant, type UsageHygieneSnapshot, VectorProvider, type VectorStatus, type WikiLintReport, assertGraphExtractionPayload, createPyxMemory, isSessionOrdinal, mergeExtractedEntities, normalizeGraphLabel, normalizeNameKey, projectSearchResponseForMcp, secretElevationAggregate, secretElevationNoticeFor, withSecretElevationNotice };
2006
+ export { type AgentId, type ApiResponse, type ConsolidationJudgementsResult, type ConsolidationMerge, type ConsolidationPair, type ConsolidationPairSide, type ConsolidationRunResult, type CorrectionInput, type CorrectionRecord, type CreatePyxMemoryOptions, DEFAULTS, DEPRECATED_RAG_STRATEGIES, DisabledMemory, type DroppedGraphRelationship, type DueScanInput, EmbeddingProviderName, type EnrichmentCallbacks, type EnrichmentPurpose, type EntityExtractionResult, type ExpandAnchorStatus, type ExpandParams, type ExpandResult, type ExtendedMemoryInterface, type FetchCorrectionsInput, type FileDownloadOptions, type GraphEnrichEvent, type GraphEnrichFileOptions, type GraphEnrichPreparedEvent, type GraphEnrichResult, type GraphEnrichResultEvent, type GraphEnrichment, type GraphEnrichmentStatus, type GraphExtractionPayload, type GraphFailureMode, type GraphNode, type GraphRelationship, type GraphRepairResult, type GraphTelemetrySnapshot, 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, MEMORY_PROJECT_LABEL_MAX_CHARS, MemoryClient, type MemoryClientOptions, type MemoryEntry, type MemoryIngestRequest, type MemoryInsightMetrics, type MemoryInsights, type MemoryInterface, type MemoryListParams, type MemoryListResult, type MemoryLogFilters, type MemoryProjectInsight, 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, SESSION_ORDINAL_MAX, SINGLE_TENANT_ID, type SecretElevationAggregate, type SecretElevationNotice, SensitivityLevel, type SourceEvidence, type StoreInput, StoreTarget, TAXONOMY_MAX_CATEGORIES, TAXONOMY_MAX_PROJECTS, TAXONOMY_MAX_SAMPLE_TOPICS, TAXONOMY_MAX_TOP_ENTITIES, type TemporalQueryFilters, type TenantScopeOptions, type Timestamp, type Topology, type TopologyExtractionProvider, type TopologyServiceVariant, type UsageHygieneSnapshot, VectorProvider, type VectorStatus, type WikiLintReport, assertGraphExtractionPayload, createPyxMemory, isSessionOrdinal, mergeExtractedEntities, normalizeGraphLabel, normalizeNameKey, projectSearchResponseForMcp, secretElevationAggregate, secretElevationNoticeFor, withSecretElevationNotice };
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  DisabledMemory,
3
3
  MemoryClient,
4
4
  MemoryServerError
5
- } from "./chunk-LF22PCY6.mjs";
5
+ } from "./chunk-EHFEPWCL.mjs";
6
6
  import {
7
7
  DEFAULTS,
8
8
  MEMORY_PROJECT_LABEL_MAX_CHARS,
package/dist/react.mjs CHANGED
@@ -11,8 +11,8 @@ import {
11
11
  toGraphologyFormat,
12
12
  transformGraphData,
13
13
  unreachableHealth
14
- } from "./chunk-L2RHO7DP.mjs";
15
- import "./chunk-LF22PCY6.mjs";
14
+ } from "./chunk-GLQGLTMK.mjs";
15
+ import "./chunk-EHFEPWCL.mjs";
16
16
  import "./chunk-KZKGRND2.mjs";
17
17
  import "./chunk-VXXRCAKS.mjs";
18
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pyxmate/memory",
3
- "version": "1.24.0",
3
+ "version": "1.25.1",
4
4
  "type": "module",
5
5
  "description": "SDK for pyx-memory — Memory as a Service for AI agents",
6
6
  "license": "MIT",