@pyxmate/memory 1.17.16 → 1.17.18

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/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
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, GraphEnrichEvent as GraphEnrichEvent$1, GraphNode as GraphNode$1, GraphTraversalResult as GraphTraversalResult$1, CorrectionRecord as CorrectionRecord$1 } from '@pyx-memory/shared';
2
+ export { documentContentSource, documentGraphSource, documentImageSource } from '@pyx-memory/shared';
3
+ export { e as encodeListCursorToken, p as parseListCursorToken } from './data-plane-contract-fDvTm9bF.js';
2
4
 
3
5
  /** Parameters for paginated entry listing. */
4
6
  interface MemoryListParams {
@@ -26,6 +28,8 @@ interface MemoryListParams {
26
28
  agentId?: string;
27
29
  /** Filter by tenant ID for multi-tenant isolation. */
28
30
  tenantId?: string;
31
+ /** Exact namespace scope. Excludes legacy tenant-root entries. */
32
+ namespaceId?: string;
29
33
  /**
30
34
  * Calling principal. When supplied, list applies the AuthzPlan
31
35
  * visibility filter so entries in forbidden namespaces never reach
@@ -61,6 +65,17 @@ interface TemporalQueryFilters {
61
65
  agentId?: string;
62
66
  source?: string;
63
67
  limit?: number;
68
+ /**
69
+ * Number of matching rows to skip. Offset pages can shift under concurrent
70
+ * deletion; use cursor for a deletion-stable queryAsOf walk.
71
+ */
72
+ offset?: number;
73
+ /**
74
+ * Opaque keyset token for a deletion-stable queryAsOf walk. Derive it from
75
+ * the last returned entry with `encodeListCursorToken`; mutually exclusive
76
+ * with offset.
77
+ */
78
+ cursor?: string;
64
79
  /** Maximum sensitivity level to include. Omitted preserves legacy behavior. */
65
80
  maxSensitivity?: SensitivityLevel$1;
66
81
  }
@@ -79,6 +94,8 @@ interface MemoryLogFilters {
79
94
  /** Options for scoping operations to a specific tenant. */
80
95
  interface TenantScopeOptions {
81
96
  tenantId?: string;
97
+ /** Optional strict namespace coordinate for exact get/delete operations. */
98
+ namespaceId?: string;
82
99
  /**
83
100
  * Graph count mode for stats(). Use raw on admin-health paths
84
101
  * that should avoid the visible graph projection.
@@ -107,7 +124,7 @@ interface MemoryInterface {
107
124
  clearSession(sessionId: string, options?: TenantScopeOptions): Promise<number>;
108
125
  stats(options?: TenantScopeOptions): Promise<MemoryStats$1>;
109
126
  /** Query entries as they existed at a point in time (by ingest time). */
110
- queryAsOf(asOfDate: string, filters?: TemporalQueryFilters): Promise<MemoryEntry$1[]>;
127
+ queryAsOf(asOfDate: string, filters?: TemporalQueryFilters, options?: TenantScopeOptions): Promise<MemoryEntry$1[]>;
111
128
  /** Read the time-ordered lineage of a graph fact or superseded entry chain. */
112
129
  lineage(params: LineageParams$1): Promise<LineageResult$1>;
113
130
  /** Reinforce memories that were actually used by the caller. */
@@ -144,7 +161,7 @@ interface ExtendedMemoryInterface extends MemoryInterface {
144
161
  /** Reindex the FTS5 full-text search index. */
145
162
  reindex(): Promise<void>;
146
163
  /** Delete all entries matching a source, cleaning up all stores. */
147
- deleteBySource(source: string): Promise<number>;
164
+ deleteBySource(source: string, options?: TenantScopeOptions): Promise<number>;
148
165
  /** Repair stale graph references left by older delete paths or crashed cleanup. */
149
166
  repairGraph(): Promise<GraphRepairResult$1>;
150
167
  /**
@@ -246,6 +263,20 @@ interface IngestFileOptions {
246
263
  enrichment?: EnrichmentCallbacks;
247
264
  signal?: AbortSignal;
248
265
  namespaceId?: string;
266
+ /**
267
+ * Stable logical document identity used for replaceable content, image,
268
+ * and graph projections. Requires `enrichment.extractEntitiesV2` so the
269
+ * client can negotiate text windows and complete the stable replacement.
270
+ */
271
+ documentKey?: string;
272
+ /**
273
+ * Migration-only pinned file-ingestion catalog for this document's first
274
+ * stable replacement. The server validates its exact scope and uses its
275
+ * bounded provenance to detach legacy graph references. Omit this after the
276
+ * stable anchor is established: the first pass may retire catalog-owned
277
+ * projections, so later revisions should use `documentKey` alone.
278
+ */
279
+ catalogEntryId?: string;
249
280
  }
250
281
  /**
251
282
  * Options for {@link MemoryClient.graphEnrichFileEvents}. `documentKey` is the
@@ -259,10 +290,23 @@ interface IngestFileOptions {
259
290
  */
260
291
  interface GraphEnrichFileOptions {
261
292
  documentKey: string;
293
+ /**
294
+ * Migration-only pinned file-ingestion catalog for the first stable graph
295
+ * replacement. The server resolves it in the current tenant/namespace and
296
+ * detaches its bounded graph references. Omit it on later revisions once
297
+ * the `documentKey` anchor exists.
298
+ */
299
+ catalogEntryId?: string;
262
300
  namespaceId?: string;
263
301
  signal?: AbortSignal;
264
302
  enrichment: EnrichmentCallbacks;
265
303
  }
304
+ interface FileDownloadOptions {
305
+ /** Stable logical document identity used by documentKey-aware ingest. */
306
+ documentKey?: string;
307
+ /** Exact namespace containing the uploaded document. */
308
+ namespaceId?: string;
309
+ }
266
310
  /**
267
311
  * Caller-supplied enrichment for the per-call store path. Mirrors
268
312
  * {@link EnrichmentCallbacks} for file ingest. When supplied, the SDK invokes
@@ -304,7 +348,13 @@ interface RequestAuthorityOptions {
304
348
  /** Error thrown by MemoryClient when the server returns a non-success response. */
305
349
  declare class MemoryServerError extends Error {
306
350
  readonly status: number;
307
- constructor(message: string, status: number);
351
+ /** Stable machine-readable discriminator returned by the memory server. */
352
+ readonly code?: string;
353
+ /** Exact HTTP Retry-After value returned by the memory server. */
354
+ readonly retryAfter?: string;
355
+ /** Retry delay normalized to seconds when Retry-After is parseable. */
356
+ readonly retryAfterSeconds?: number;
357
+ constructor(message: string, status: number, code?: string, retryAfter?: string);
308
358
  /** True when the server returned HTTP 404 (not found). */
309
359
  get isNotFound(): boolean;
310
360
  }
@@ -337,9 +387,10 @@ declare class MemoryClient implements ExtendedMemoryInterface {
337
387
  /** Encode a path segment to prevent URL injection */
338
388
  private encodePathSegment;
339
389
  private authorityHeaders;
390
+ private exactReadAuthority;
340
391
  initialize(): Promise<void>;
341
392
  store(entry: StoreInput$1, options?: StoreOptions): Promise<MemoryEntry$1>;
342
- search(params: MemorySearchParams$1, authority?: RequestAuthorityOptions): Promise<MemorySearchResult$1>;
393
+ search(params: MemorySearchParams$1, authority?: RequestAuthorityOptions & Pick<TenantScopeOptions, 'tenantId' | 'namespaceId'>): Promise<MemorySearchResult$1>;
343
394
  get(id: string, authority?: TenantScopeOptions & RequestAuthorityOptions): Promise<MemoryEntry$1 | null>;
344
395
  delete(id: string, authority?: TenantScopeOptions & RequestAuthorityOptions): Promise<boolean>;
345
396
  clearSession(sessionId: string): Promise<number>;
@@ -355,7 +406,7 @@ declare class MemoryClient implements ExtendedMemoryInterface {
355
406
  */
356
407
  status(): Promise<Topology$1>;
357
408
  shutdown(): Promise<void>;
358
- list(params?: MemoryListParams, authority?: RequestAuthorityOptions): Promise<MemoryListResult>;
409
+ list(params?: MemoryListParams, authority?: RequestAuthorityOptions & Pick<TenantScopeOptions, 'tenantId' | 'namespaceId'>): Promise<MemoryListResult>;
359
410
  /**
360
411
  * Native streaming file ingest. Yields typed {@link IngestEvent}s as the
361
412
  * server (parsing/storing) and the SDK (enrichment/result) make progress.
@@ -414,10 +465,10 @@ declare class MemoryClient implements ExtendedMemoryInterface {
414
465
  * heartbeat events around each slow step. Throws on any failure; the
415
466
  * purpose-specific wrappers translate that into their terminal error.
416
467
  *
417
- * The purpose controls empty-output semantics: ingest skips an optional
418
- * empty add-on; graph-only finalizes an extractor that ran and found zero
419
- * entities, but refuses to erase prior graph state when no extractable input
420
- * reached the callback at all.
468
+ * Legacy ingest keeps its existing partial add-on behavior. Graph-only and
469
+ * documentKey-aware full ingest may replace a prior graph only from a
470
+ * complete input set (no truncated text windows or undescribed images). A
471
+ * complete extractor result containing zero entities remains a valid clear.
421
472
  */
422
473
  private runEnrichmentCallbacks;
423
474
  /**
@@ -435,12 +486,12 @@ declare class MemoryClient implements ExtendedMemoryInterface {
435
486
  * Get the download URL for an uploaded file.
436
487
  * Returns a URL that serves the original file binary with proper Content-Type.
437
488
  */
438
- getFileDownloadUrl(filename: string): string;
489
+ getFileDownloadUrl(filename: string, options?: FileDownloadOptions): string;
439
490
  /**
440
491
  * Download an uploaded file by filename.
441
492
  * Returns the raw Response (caller handles the body — arrayBuffer, blob, stream, etc.).
442
493
  */
443
- downloadFile(filename: string): Promise<Response>;
494
+ downloadFile(filename: string, options?: FileDownloadOptions): Promise<Response>;
444
495
  /** @deprecated Use {@link list} instead. Kept for backwards compatibility. */
445
496
  listEntries(params?: {
446
497
  page?: number;
@@ -469,7 +520,7 @@ declare class MemoryClient implements ExtendedMemoryInterface {
469
520
  reindex(): Promise<void>;
470
521
  clearGraph(): Promise<number>;
471
522
  repairGraph(): Promise<GraphRepairResult$1>;
472
- deleteBySource(source: string): Promise<number>;
523
+ deleteBySource(source: string, authority?: TenantScopeOptions): Promise<number>;
473
524
  setFolder(from: string, to: string, options?: {
474
525
  dryRun?: boolean;
475
526
  }): Promise<{
@@ -478,7 +529,7 @@ declare class MemoryClient implements ExtendedMemoryInterface {
478
529
  updated: number;
479
530
  dryRun: boolean;
480
531
  }>;
481
- queryAsOf(asOfDate: string, filters?: TemporalQueryFilters): Promise<MemoryEntry$1[]>;
532
+ queryAsOf(asOfDate: string, filters?: TemporalQueryFilters, authority?: TenantScopeOptions): Promise<MemoryEntry$1[]>;
482
533
  lineage(params: LineageParams$1, authority?: RequestAuthorityOptions): Promise<LineageResult$1>;
483
534
  reinforce(params: ReinforceParams$1, authority?: RequestAuthorityOptions): Promise<ReinforceResult$1>;
484
535
  log(filters?: MemoryLogFilters): Promise<MemoryEntry$1[]>;
@@ -873,6 +924,12 @@ interface MemorySearchParams {
873
924
  userId?: string;
874
925
  /** Team/group ID within the tenant. */
875
926
  teamId?: string;
927
+ /**
928
+ * Exact namespace requested by a trusted transport boundary. `Memory.search`
929
+ * validates it against the calling principal's AuthzPlan and compiles it to
930
+ * a singleton prefilter. Exact scope excludes legacy NULL rows.
931
+ */
932
+ namespaceId?: string;
876
933
  /**
877
934
  * AuthzPlan-derived visibility list. Populated internally by `Memory.search`
878
935
  * after computing the plan from the calling principal — callers should
@@ -880,15 +937,11 @@ interface MemorySearchParams {
880
937
  * legacy NULL-namespace entries are visible). `undefined` skips the
881
938
  * filter (single-tenant / pre-ReBAC compat).
882
939
  *
883
- * "Search within this specific folder" UX is intentionally NOT supported
884
- * via a singular `namespaceId` field for v1 — adding it would force
885
- * intersection logic with the visibility list (and confused-deputy risk
886
- * if the singular value isn't validated against the plan). Callers that
887
- * need it can compute the singleton intersection client-side and pass
888
- * `namespaceIds: [chosenNamespace]` after verifying access via the
889
- * admin API.
940
+ * Callers must not set this directly; use `namespaceId` for exact scope.
890
941
  */
891
942
  namespaceIds?: string[];
943
+ /** Strict namespace equality compiled internally from `namespaceId`. */
944
+ exactNamespaceId?: string;
892
945
  /**
893
946
  * AuthzPlan-derived list of strict-mode namespaces in the caller's
894
947
  * tenant the principal CANNOT see (v0.17.0). Graph traversal MUST
@@ -996,6 +1049,8 @@ interface ReinforceResult {
996
1049
  interface SourceEvidence {
997
1050
  /** Memory entry that produced this graph fact. */
998
1051
  memoryEntryId: string;
1052
+ /** Data tenant of the source entry. `null` = single-tenant / legacy data. */
1053
+ tenantId?: string | null;
999
1054
  /** Namespace of the source memory entry. `null` = legacy / tenant-root. */
1000
1055
  namespaceId?: string | null;
1001
1056
  /** Optional source identifier copied from the memory entry or caller. */
@@ -1419,6 +1474,8 @@ interface ApiResponse<T> {
1419
1474
  success: boolean;
1420
1475
  data?: T;
1421
1476
  error?: string;
1477
+ /** Stable machine-readable discriminator for error responses. */
1478
+ code?: string;
1422
1479
  }
1423
1480
  /**
1424
1481
  * Build variant of the running pyx-memory image. Detected from the actual
@@ -1524,11 +1581,21 @@ interface FileIngestResult {
1524
1581
  fileType: string;
1525
1582
  chunks: number;
1526
1583
  entryIds: string[];
1584
+ /**
1585
+ * Stable document graph anchor written during enrichment when the ingest
1586
+ * supplied a documentKey. This anchor is not included in entryIds; that
1587
+ * array remains limited to chunks and image-description rows.
1588
+ */
1589
+ graphAnchorEntryId?: string;
1527
1590
  totalCharacters: number;
1528
1591
  /** Present when images were extracted (v1) OR text windows / images were emitted (v2). */
1529
1592
  enrichment?: EnrichmentPending;
1530
1593
  /** Present only when ≥1 stored chunk was auto-classified secret by credential detection. */
1531
1594
  secretElevation?: SecretElevationAggregate;
1595
+ /** Relationships dropped because an endpoint matched no submitted entity. */
1596
+ relationshipsDropped?: number;
1597
+ /** Up to 20 dropped relationships, retained from the enrichment response. */
1598
+ droppedRelationships?: DroppedGraphRelationship[];
1532
1599
  }
1533
1600
  /** Coarse pipeline stages. Stable vocabulary — finer detail goes in counters/message. */
1534
1601
  type IngestStage = 'parsing' | 'storing' | 'enrichment' | 'complete';
@@ -1575,16 +1642,20 @@ interface IngestErrorEvent {
1575
1642
  message?: string;
1576
1643
  code?: string | number;
1577
1644
  status?: number;
1645
+ /** Exact HTTP Retry-After value when the failure came from an HTTP response. */
1646
+ retryAfter?: string;
1647
+ /** Retry delay normalized to seconds when Retry-After was parseable. */
1648
+ retryAfterSeconds?: number;
1578
1649
  /**
1579
- * Server's pre-enrichment {@link FileIngestResult}, present when the error
1580
- * fired during the SDK's enrichment phase (after the server already emitted
1581
- * a successful result and the file's chunks/entryIds are durably stored).
1650
+ * Durably committed {@link FileIngestResult}, present when either the server
1651
+ * committed a stable replacement but its secondary-projection cleanup is
1652
+ * still pending, or the SDK's later enrichment phase failed.
1582
1653
  *
1583
1654
  * Lets consumers persist the catalog entry id, per-chunk entry ids, and
1584
1655
  * character/chunk counts before surfacing the error — so a 401 storm during
1585
1656
  * entity extraction no longer loses the search-ready chunks. Absent for
1586
- * errors that happen before the server's terminal result (parsing/storing
1587
- * stage failures, transport errors, abort).
1657
+ * errors where the attempted revision did not commit (parsing/storing
1658
+ * failures and rollback cleanup debt), transport errors, and aborts.
1588
1659
  */
1589
1660
  partialResult?: FileIngestResult;
1590
1661
  }
@@ -1618,8 +1689,10 @@ interface GraphEnrichResult {
1618
1689
  purpose: 'graph-only';
1619
1690
  filename: string;
1620
1691
  fileType: string;
1621
- /** The single stable anchor entry id, including a successful zero-entity replacement. */
1622
- entryIds: string[];
1692
+ /** The single persisted graph projection row, including a successful zero-entity replacement. */
1693
+ entryIds: [string];
1694
+ /** Stable logical document identity whose graph projection was replaced. */
1695
+ graphAnchorEntryId: string;
1623
1696
  entitiesStored: number;
1624
1697
  relationshipsStored: number;
1625
1698
  /** Present (and >0) only when edges were dropped — see {@link EnrichResult}. */
@@ -1753,4 +1826,4 @@ interface CreatePyxMemoryOptions {
1753
1826
  }
1754
1827
  declare function createPyxMemory(opts?: CreatePyxMemoryOptions): MemoryClient;
1755
1828
 
1756
- 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 ExtendedMemoryInterface, type FetchCorrectionsInput, 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, 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, type SecretElevationAggregate, type SecretElevationNotice, SensitivityLevel, type SourceEvidence, type StoreInput, StoreTarget, TAXONOMY_MAX_CATEGORIES, type TemporalQueryFilters, type TenantScopeOptions, type Timestamp, type Topology, type TopologyExtractionProvider, type TopologyServiceVariant, type UsageHygieneSnapshot, VectorProvider, type VectorStatus, type WikiLintReport, assertGraphExtractionPayload, createPyxMemory, mergeExtractedEntities, normalizeGraphLabel, normalizeNameKey, projectSearchResponseForMcp, secretElevationAggregate, secretElevationNoticeFor, withSecretElevationNotice };
1829
+ 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 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, 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, type SecretElevationAggregate, type SecretElevationNotice, SensitivityLevel, type SourceEvidence, type StoreInput, StoreTarget, TAXONOMY_MAX_CATEGORIES, type TemporalQueryFilters, type TenantScopeOptions, type Timestamp, type Topology, type TopologyExtractionProvider, type TopologyServiceVariant, type UsageHygieneSnapshot, VectorProvider, type VectorStatus, type WikiLintReport, assertGraphExtractionPayload, createPyxMemory, mergeExtractedEntities, normalizeGraphLabel, normalizeNameKey, projectSearchResponseForMcp, secretElevationAggregate, secretElevationNoticeFor, withSecretElevationNotice };
package/dist/index.mjs CHANGED
@@ -14,17 +14,22 @@ import {
14
14
  StoreTarget,
15
15
  TAXONOMY_MAX_CATEGORIES,
16
16
  VectorProvider,
17
+ documentContentSource,
18
+ documentGraphSource,
19
+ documentImageSource,
17
20
  projectSearchResponseForMcp,
18
21
  secretElevationAggregate,
19
22
  secretElevationNoticeFor,
20
23
  withSecretElevationNotice
21
- } from "./chunk-MDFUZ3V2.mjs";
24
+ } from "./chunk-H6ZLMPZH.mjs";
22
25
  import {
23
26
  assertGraphExtractionPayload,
27
+ encodeListCursorToken,
24
28
  mergeExtractedEntities,
25
29
  normalizeGraphLabel,
26
- normalizeNameKey
27
- } from "./chunk-34MTVIYK.mjs";
30
+ normalizeNameKey,
31
+ parseListCursorToken
32
+ } from "./chunk-3OLH3HYR.mjs";
28
33
 
29
34
  // src/preset.ts
30
35
  var DEFAULT_MEMORY_URL = `http://localhost:${DEFAULTS.MEMORY_SERVER_PORT}`;
@@ -57,9 +62,14 @@ export {
57
62
  VectorProvider,
58
63
  assertGraphExtractionPayload,
59
64
  createPyxMemory,
65
+ documentContentSource,
66
+ documentGraphSource,
67
+ documentImageSource,
68
+ encodeListCursorToken,
60
69
  mergeExtractedEntities,
61
70
  normalizeGraphLabel,
62
71
  normalizeNameKey,
72
+ parseListCursorToken,
63
73
  projectSearchResponseForMcp,
64
74
  secretElevationAggregate,
65
75
  secretElevationNoticeFor,
package/dist/react.mjs CHANGED
@@ -11,9 +11,9 @@ import {
11
11
  toGraphologyFormat,
12
12
  transformGraphData,
13
13
  unreachableHealth
14
- } from "./chunk-ZVI7DCB4.mjs";
15
- import "./chunk-MDFUZ3V2.mjs";
16
- import "./chunk-34MTVIYK.mjs";
14
+ } from "./chunk-T35ZOOES.mjs";
15
+ import "./chunk-H6ZLMPZH.mjs";
16
+ import "./chunk-3OLH3HYR.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": "1.17.16",
3
+ "version": "1.17.18",
4
4
  "type": "module",
5
5
  "description": "SDK for pyx-memory — Memory as a Service for AI agents",
6
6
  "license": "MIT",
@@ -1,109 +0,0 @@
1
- // ../shared/src/graph/extraction.ts
2
- function normalizeGraphLabel(value, fallback) {
3
- const normalized = value.trim().toUpperCase().replace(/[^A-Z0-9]+/g, "_").replace(/^_+|_+$/g, "");
4
- return normalized.length > 0 ? normalized : fallback;
5
- }
6
- function normalizeNameKey(name) {
7
- return name.trim().toLowerCase().replace(/\s+/g, " ");
8
- }
9
- function requireGraphRecord(value, field) {
10
- if (!value || typeof value !== "object" || Array.isArray(value)) {
11
- throw new Error(`${field} must be an object`);
12
- }
13
- return value;
14
- }
15
- function requireNonemptyGraphString(value, field) {
16
- if (typeof value !== "string" || value.trim().length === 0) {
17
- throw new Error(`${field} must be a non-empty string`);
18
- }
19
- return value;
20
- }
21
- function assertGraphExtractionPayload(value, field = "graph extraction payload") {
22
- const record = requireGraphRecord(value, field);
23
- if (!Array.isArray(record.entities)) throw new Error(`${field}.entities must be an array`);
24
- if (!Array.isArray(record.relationships)) {
25
- throw new Error(`${field}.relationships must be an array`);
26
- }
27
- const entities = record.entities.map((item, index) => {
28
- const entity = requireGraphRecord(item, `${field}.entities[${index}]`);
29
- requireNonemptyGraphString(entity.name, `${field}.entities[${index}].name`);
30
- requireNonemptyGraphString(entity.type, `${field}.entities[${index}].type`);
31
- if (entity.properties !== void 0 && (!entity.properties || typeof entity.properties !== "object" || Array.isArray(entity.properties))) {
32
- throw new Error(`${field}.entities[${index}].properties must be an object`);
33
- }
34
- return item;
35
- });
36
- const entityNames = new Set(entities.map((entity) => normalizeNameKey(entity.name)));
37
- const relationships = record.relationships.map((item, index) => {
38
- const relationship = requireGraphRecord(item, `${field}.relationships[${index}]`);
39
- const source = requireNonemptyGraphString(
40
- relationship.source,
41
- `${field}.relationships[${index}].source`
42
- );
43
- const target = requireNonemptyGraphString(
44
- relationship.target,
45
- `${field}.relationships[${index}].target`
46
- );
47
- requireNonemptyGraphString(relationship.type, `${field}.relationships[${index}].type`);
48
- if (!entityNames.has(normalizeNameKey(source)) || !entityNames.has(normalizeNameKey(target))) {
49
- throw new Error(
50
- `${field}.relationships[${index}] endpoints must reference declared entity names`
51
- );
52
- }
53
- if (relationship.properties !== void 0 && (!relationship.properties || typeof relationship.properties !== "object" || Array.isArray(relationship.properties))) {
54
- throw new Error(`${field}.relationships[${index}].properties must be an object`);
55
- }
56
- return item;
57
- });
58
- return { entities, relationships };
59
- }
60
- function relationshipKey(relationship) {
61
- return [
62
- relationship.source.trim().toLowerCase(),
63
- relationship.target.trim().toLowerCase(),
64
- normalizeGraphLabel(relationship.type, "RELATED_TO")
65
- ].join("\0");
66
- }
67
- function mergeExtractedEntities(callerEntities, callerRelationships, extracted) {
68
- const entities = [...callerEntities ?? []];
69
- const relationships = [...callerRelationships ?? []];
70
- const nameByLowercase = /* @__PURE__ */ new Map();
71
- for (const entity of entities) {
72
- const key = entity.name.toLowerCase();
73
- if (!nameByLowercase.has(key)) nameByLowercase.set(key, entity.name);
74
- }
75
- for (const entity of extracted.entities) {
76
- const key = entity.name.toLowerCase();
77
- if (nameByLowercase.has(key)) continue;
78
- entities.push({ ...entity, type: normalizeGraphLabel(entity.type, "CONCEPT") });
79
- nameByLowercase.set(key, entity.name);
80
- }
81
- for (const relationship of extracted.relations) {
82
- const source = nameByLowercase.get(relationship.source.toLowerCase());
83
- const target = nameByLowercase.get(relationship.target.toLowerCase());
84
- if (source && target) {
85
- relationships.push({
86
- ...relationship,
87
- source,
88
- target,
89
- type: normalizeGraphLabel(relationship.type, "RELATED_TO")
90
- });
91
- }
92
- }
93
- const seenRelationships = /* @__PURE__ */ new Set();
94
- const dedupedRelationships = [];
95
- for (const relationship of relationships) {
96
- const key = relationshipKey(relationship);
97
- if (seenRelationships.has(key)) continue;
98
- seenRelationships.add(key);
99
- dedupedRelationships.push(relationship);
100
- }
101
- return { entities, relationships: dedupedRelationships };
102
- }
103
-
104
- export {
105
- normalizeGraphLabel,
106
- normalizeNameKey,
107
- assertGraphExtractionPayload,
108
- mergeExtractedEntities
109
- };