@pyxmate/memory 1.17.15 → 1.17.17
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-3OLH3HYR.mjs +1404 -0
- package/dist/{chunk-WDF5LAZS.mjs → chunk-AMKPOPH6.mjs} +5 -3
- package/dist/{chunk-LGNSLDGB.mjs → chunk-JGFDID3B.mjs} +527 -211
- package/dist/cli/pyx-mem.mjs +2 -1
- package/dist/dashboard.d.ts +3 -1
- package/dist/dashboard.mjs +3 -3
- package/dist/data-plane-contract-fDvTm9bF.d.ts +245 -0
- package/dist/data-plane-contract.d.ts +1 -235
- package/dist/data-plane-contract.mjs +15 -1255
- package/dist/index.d.ts +204 -19
- package/dist/index.mjs +15 -3
- package/dist/react.mjs +3 -3
- package/package.json +1 -1
- package/dist/chunk-A3L46P2G.mjs +0 -57
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
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';
|
|
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 {
|
|
@@ -61,6 +63,17 @@ interface TemporalQueryFilters {
|
|
|
61
63
|
agentId?: string;
|
|
62
64
|
source?: string;
|
|
63
65
|
limit?: number;
|
|
66
|
+
/**
|
|
67
|
+
* Number of matching rows to skip. Offset pages can shift under concurrent
|
|
68
|
+
* deletion; use cursor for a deletion-stable queryAsOf walk.
|
|
69
|
+
*/
|
|
70
|
+
offset?: number;
|
|
71
|
+
/**
|
|
72
|
+
* Opaque keyset token for a deletion-stable queryAsOf walk. Derive it from
|
|
73
|
+
* the last returned entry with `encodeListCursorToken`; mutually exclusive
|
|
74
|
+
* with offset.
|
|
75
|
+
*/
|
|
76
|
+
cursor?: string;
|
|
64
77
|
/** Maximum sensitivity level to include. Omitted preserves legacy behavior. */
|
|
65
78
|
maxSensitivity?: SensitivityLevel$1;
|
|
66
79
|
}
|
|
@@ -79,6 +92,8 @@ interface MemoryLogFilters {
|
|
|
79
92
|
/** Options for scoping operations to a specific tenant. */
|
|
80
93
|
interface TenantScopeOptions {
|
|
81
94
|
tenantId?: string;
|
|
95
|
+
/** Optional strict namespace coordinate for exact get/delete operations. */
|
|
96
|
+
namespaceId?: string;
|
|
82
97
|
/**
|
|
83
98
|
* Graph count mode for stats(). Use raw on admin-health paths
|
|
84
99
|
* that should avoid the visible graph projection.
|
|
@@ -107,7 +122,7 @@ interface MemoryInterface {
|
|
|
107
122
|
clearSession(sessionId: string, options?: TenantScopeOptions): Promise<number>;
|
|
108
123
|
stats(options?: TenantScopeOptions): Promise<MemoryStats$1>;
|
|
109
124
|
/** Query entries as they existed at a point in time (by ingest time). */
|
|
110
|
-
queryAsOf(asOfDate: string, filters?: TemporalQueryFilters): Promise<MemoryEntry$1[]>;
|
|
125
|
+
queryAsOf(asOfDate: string, filters?: TemporalQueryFilters, options?: TenantScopeOptions): Promise<MemoryEntry$1[]>;
|
|
111
126
|
/** Read the time-ordered lineage of a graph fact or superseded entry chain. */
|
|
112
127
|
lineage(params: LineageParams$1): Promise<LineageResult$1>;
|
|
113
128
|
/** Reinforce memories that were actually used by the caller. */
|
|
@@ -144,7 +159,7 @@ interface ExtendedMemoryInterface extends MemoryInterface {
|
|
|
144
159
|
/** Reindex the FTS5 full-text search index. */
|
|
145
160
|
reindex(): Promise<void>;
|
|
146
161
|
/** Delete all entries matching a source, cleaning up all stores. */
|
|
147
|
-
deleteBySource(source: string): Promise<number>;
|
|
162
|
+
deleteBySource(source: string, options?: TenantScopeOptions): Promise<number>;
|
|
148
163
|
/** Repair stale graph references left by older delete paths or crashed cleanup. */
|
|
149
164
|
repairGraph(): Promise<GraphRepairResult$1>;
|
|
150
165
|
/**
|
|
@@ -246,6 +261,49 @@ interface IngestFileOptions {
|
|
|
246
261
|
enrichment?: EnrichmentCallbacks;
|
|
247
262
|
signal?: AbortSignal;
|
|
248
263
|
namespaceId?: string;
|
|
264
|
+
/**
|
|
265
|
+
* Stable logical document identity used for replaceable content, image,
|
|
266
|
+
* and graph projections. Requires `enrichment.extractEntitiesV2` so the
|
|
267
|
+
* client can negotiate text windows and complete the stable replacement.
|
|
268
|
+
*/
|
|
269
|
+
documentKey?: string;
|
|
270
|
+
/**
|
|
271
|
+
* Migration-only pinned file-ingestion catalog for this document's first
|
|
272
|
+
* stable replacement. The server validates its exact scope and uses its
|
|
273
|
+
* bounded provenance to detach legacy graph references. Omit this after the
|
|
274
|
+
* stable anchor is established: the first pass may retire catalog-owned
|
|
275
|
+
* projections, so later revisions should use `documentKey` alone.
|
|
276
|
+
*/
|
|
277
|
+
catalogEntryId?: string;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Options for {@link MemoryClient.graphEnrichFileEvents}. `documentKey` is the
|
|
281
|
+
* caller's stable logical identity for the document whose graph is being
|
|
282
|
+
* rebuilt — the server derives the graph anchor id from
|
|
283
|
+
* (tenant, namespace, documentKey), so repeating the same key replaces the
|
|
284
|
+
* document's graph references instead of multiplying them.
|
|
285
|
+
*
|
|
286
|
+
* `enrichment.extractEntitiesV2` is required: graph-only re-enrichment is
|
|
287
|
+
* caller-extraction by definition (there is no server-side fallback).
|
|
288
|
+
*/
|
|
289
|
+
interface GraphEnrichFileOptions {
|
|
290
|
+
documentKey: string;
|
|
291
|
+
/**
|
|
292
|
+
* Migration-only pinned file-ingestion catalog for the first stable graph
|
|
293
|
+
* replacement. The server resolves it in the current tenant/namespace and
|
|
294
|
+
* detaches its bounded graph references. Omit it on later revisions once
|
|
295
|
+
* the `documentKey` anchor exists.
|
|
296
|
+
*/
|
|
297
|
+
catalogEntryId?: string;
|
|
298
|
+
namespaceId?: string;
|
|
299
|
+
signal?: AbortSignal;
|
|
300
|
+
enrichment: EnrichmentCallbacks;
|
|
301
|
+
}
|
|
302
|
+
interface FileDownloadOptions {
|
|
303
|
+
/** Stable logical document identity used by documentKey-aware ingest. */
|
|
304
|
+
documentKey?: string;
|
|
305
|
+
/** Exact namespace containing the uploaded document. */
|
|
306
|
+
namespaceId?: string;
|
|
249
307
|
}
|
|
250
308
|
/**
|
|
251
309
|
* Caller-supplied enrichment for the per-call store path. Mirrors
|
|
@@ -288,7 +346,13 @@ interface RequestAuthorityOptions {
|
|
|
288
346
|
/** Error thrown by MemoryClient when the server returns a non-success response. */
|
|
289
347
|
declare class MemoryServerError extends Error {
|
|
290
348
|
readonly status: number;
|
|
291
|
-
|
|
349
|
+
/** Stable machine-readable discriminator returned by the memory server. */
|
|
350
|
+
readonly code?: string;
|
|
351
|
+
/** Exact HTTP Retry-After value returned by the memory server. */
|
|
352
|
+
readonly retryAfter?: string;
|
|
353
|
+
/** Retry delay normalized to seconds when Retry-After is parseable. */
|
|
354
|
+
readonly retryAfterSeconds?: number;
|
|
355
|
+
constructor(message: string, status: number, code?: string, retryAfter?: string);
|
|
292
356
|
/** True when the server returned HTTP 404 (not found). */
|
|
293
357
|
get isNotFound(): boolean;
|
|
294
358
|
}
|
|
@@ -360,13 +424,50 @@ declare class MemoryClient implements ExtendedMemoryInterface {
|
|
|
360
424
|
*/
|
|
361
425
|
ingestFileEvents(file: File, options?: IngestFileOptions): AsyncIterable<IngestEvent$1>;
|
|
362
426
|
/**
|
|
363
|
-
*
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
*
|
|
427
|
+
* Graph-only re-enrichment for a document whose chunks are already stored
|
|
428
|
+
* and searchable but whose graph build failed. Uploads the original to
|
|
429
|
+
* `/api/memory/graph/enrich/file` (prepare-only — the server performs zero
|
|
430
|
+
* store/delete before the final graph write), runs the SAME enrichment
|
|
431
|
+
* callback engine as {@link ingestFileEvents}, then finalizes into one
|
|
432
|
+
* stable graph anchor keyed by `documentKey`. Repeating the same key
|
|
433
|
+
* replaces the document's graph references idempotently.
|
|
434
|
+
*
|
|
435
|
+
* The terminal `result` is a {@link GraphEnrichResult} event carrying the
|
|
436
|
+
* ACTUAL persisted graph counts; abort and failures yield a terminal
|
|
437
|
+
* `error` event instead (the server retains the pending session for retry).
|
|
438
|
+
*/
|
|
439
|
+
graphEnrichFileEvents(file: File, options: GraphEnrichFileOptions): AsyncIterable<GraphEnrichEvent$1>;
|
|
440
|
+
/**
|
|
441
|
+
* POST a multipart body to an NDJSON streaming endpoint and relay its
|
|
442
|
+
* progress/heartbeat events. Returns the raw terminal `result` record, or
|
|
443
|
+
* null after yielding a terminal error (transport failure, server error
|
|
444
|
+
* event, non-NDJSON response, stream ending without a result). One
|
|
445
|
+
* implementation for both streaming surfaces so the wire protocol cannot
|
|
446
|
+
* fork.
|
|
447
|
+
*/
|
|
448
|
+
private streamNdjsonUpload;
|
|
449
|
+
/**
|
|
450
|
+
* Run the SDK-side enrichment phase for an ingest result and yield the
|
|
451
|
+
* single terminal {@link IngestResultEvent} at the end. Skips work cleanly
|
|
452
|
+
* when the server emitted no enrichment block or the caller wired no
|
|
453
|
+
* callbacks. The callback work itself lives in
|
|
454
|
+
* {@link runEnrichmentCallbacks} — shared with the graph-only surface.
|
|
368
455
|
*/
|
|
369
456
|
private completeIngestFileEvents;
|
|
457
|
+
/**
|
|
458
|
+
* The ONE enrichment callback engine, shared by {@link ingestFileEvents}
|
|
459
|
+
* and {@link graphEnrichFileEvents}: fetches extracted images, invokes
|
|
460
|
+
* `describeImage` with bounded concurrency, invokes `extractEntitiesV2`
|
|
461
|
+
* exactly once, and POSTs `/files/{fileId}/enrich` — emitting progress and
|
|
462
|
+
* heartbeat events around each slow step. Throws on any failure; the
|
|
463
|
+
* purpose-specific wrappers translate that into their terminal error.
|
|
464
|
+
*
|
|
465
|
+
* Legacy ingest keeps its existing partial add-on behavior. Graph-only and
|
|
466
|
+
* documentKey-aware full ingest may replace a prior graph only from a
|
|
467
|
+
* complete input set (no truncated text windows or undescribed images). A
|
|
468
|
+
* complete extractor result containing zero entities remains a valid clear.
|
|
469
|
+
*/
|
|
470
|
+
private runEnrichmentCallbacks;
|
|
370
471
|
/**
|
|
371
472
|
* Race a Promise against a periodic heartbeat tick. Yields a heartbeat
|
|
372
473
|
* IngestEvent every {@link INGEST_EVENT_HEARTBEAT_MS} until the promise
|
|
@@ -382,12 +483,12 @@ declare class MemoryClient implements ExtendedMemoryInterface {
|
|
|
382
483
|
* Get the download URL for an uploaded file.
|
|
383
484
|
* Returns a URL that serves the original file binary with proper Content-Type.
|
|
384
485
|
*/
|
|
385
|
-
getFileDownloadUrl(filename: string): string;
|
|
486
|
+
getFileDownloadUrl(filename: string, options?: FileDownloadOptions): string;
|
|
386
487
|
/**
|
|
387
488
|
* Download an uploaded file by filename.
|
|
388
489
|
* Returns the raw Response (caller handles the body — arrayBuffer, blob, stream, etc.).
|
|
389
490
|
*/
|
|
390
|
-
downloadFile(filename: string): Promise<Response>;
|
|
491
|
+
downloadFile(filename: string, options?: FileDownloadOptions): Promise<Response>;
|
|
391
492
|
/** @deprecated Use {@link list} instead. Kept for backwards compatibility. */
|
|
392
493
|
listEntries(params?: {
|
|
393
494
|
page?: number;
|
|
@@ -416,7 +517,7 @@ declare class MemoryClient implements ExtendedMemoryInterface {
|
|
|
416
517
|
reindex(): Promise<void>;
|
|
417
518
|
clearGraph(): Promise<number>;
|
|
418
519
|
repairGraph(): Promise<GraphRepairResult$1>;
|
|
419
|
-
deleteBySource(source: string): Promise<number>;
|
|
520
|
+
deleteBySource(source: string, authority?: TenantScopeOptions): Promise<number>;
|
|
420
521
|
setFolder(from: string, to: string, options?: {
|
|
421
522
|
dryRun?: boolean;
|
|
422
523
|
}): Promise<{
|
|
@@ -425,7 +526,7 @@ declare class MemoryClient implements ExtendedMemoryInterface {
|
|
|
425
526
|
updated: number;
|
|
426
527
|
dryRun: boolean;
|
|
427
528
|
}>;
|
|
428
|
-
queryAsOf(asOfDate: string, filters?: TemporalQueryFilters): Promise<MemoryEntry$1[]>;
|
|
529
|
+
queryAsOf(asOfDate: string, filters?: TemporalQueryFilters, authority?: TenantScopeOptions): Promise<MemoryEntry$1[]>;
|
|
429
530
|
lineage(params: LineageParams$1, authority?: RequestAuthorityOptions): Promise<LineageResult$1>;
|
|
430
531
|
reinforce(params: ReinforceParams$1, authority?: RequestAuthorityOptions): Promise<ReinforceResult$1>;
|
|
431
532
|
log(filters?: MemoryLogFilters): Promise<MemoryEntry$1[]>;
|
|
@@ -943,6 +1044,8 @@ interface ReinforceResult {
|
|
|
943
1044
|
interface SourceEvidence {
|
|
944
1045
|
/** Memory entry that produced this graph fact. */
|
|
945
1046
|
memoryEntryId: string;
|
|
1047
|
+
/** Data tenant of the source entry. `null` = single-tenant / legacy data. */
|
|
1048
|
+
tenantId?: string | null;
|
|
946
1049
|
/** Namespace of the source memory entry. `null` = legacy / tenant-root. */
|
|
947
1050
|
namespaceId?: string | null;
|
|
948
1051
|
/** Optional source identifier copied from the memory entry or caller. */
|
|
@@ -1274,6 +1377,10 @@ interface EntityExtractionResult {
|
|
|
1274
1377
|
type: string;
|
|
1275
1378
|
}>;
|
|
1276
1379
|
}
|
|
1380
|
+
interface GraphExtractionPayload {
|
|
1381
|
+
entities: IngestEntity[];
|
|
1382
|
+
relationships: IngestRelationship[];
|
|
1383
|
+
}
|
|
1277
1384
|
declare function normalizeGraphLabel(value: string, fallback: string): string;
|
|
1278
1385
|
/**
|
|
1279
1386
|
* Identity key for a graph node: the normalized name alone. `type` is a node
|
|
@@ -1287,6 +1394,16 @@ declare function normalizeGraphLabel(value: string, fallback: string): string;
|
|
|
1287
1394
|
* edge resolvability with it — all three MUST agree, so they import this one fn.
|
|
1288
1395
|
*/
|
|
1289
1396
|
declare function normalizeNameKey(name: string): string;
|
|
1397
|
+
/**
|
|
1398
|
+
* Runtime contract for destructive graph replacement payloads. TypeScript
|
|
1399
|
+
* callback types do not protect JavaScript callers or malformed LLM adapter
|
|
1400
|
+
* results; accepting a missing `entities` field as an empty extraction would
|
|
1401
|
+
* erase the prior graph. Both arrays are therefore required, every item is
|
|
1402
|
+
* structurally validated, and every relationship endpoint must resolve to a
|
|
1403
|
+
* declared entity under the graph store's exact name identity normalizer.
|
|
1404
|
+
* A genuinely empty `{ entities: [], relationships: [] }` remains valid.
|
|
1405
|
+
*/
|
|
1406
|
+
declare function assertGraphExtractionPayload(value: unknown, field?: string): GraphExtractionPayload;
|
|
1290
1407
|
/**
|
|
1291
1408
|
* Merge caller-provided entities/relationships with LLM-extracted ones.
|
|
1292
1409
|
*
|
|
@@ -1352,6 +1469,8 @@ interface ApiResponse<T> {
|
|
|
1352
1469
|
success: boolean;
|
|
1353
1470
|
data?: T;
|
|
1354
1471
|
error?: string;
|
|
1472
|
+
/** Stable machine-readable discriminator for error responses. */
|
|
1473
|
+
code?: string;
|
|
1355
1474
|
}
|
|
1356
1475
|
/**
|
|
1357
1476
|
* Build variant of the running pyx-memory image. Detected from the actual
|
|
@@ -1457,11 +1576,21 @@ interface FileIngestResult {
|
|
|
1457
1576
|
fileType: string;
|
|
1458
1577
|
chunks: number;
|
|
1459
1578
|
entryIds: string[];
|
|
1579
|
+
/**
|
|
1580
|
+
* Stable document graph anchor written during enrichment when the ingest
|
|
1581
|
+
* supplied a documentKey. This anchor is not included in entryIds; that
|
|
1582
|
+
* array remains limited to chunks and image-description rows.
|
|
1583
|
+
*/
|
|
1584
|
+
graphAnchorEntryId?: string;
|
|
1460
1585
|
totalCharacters: number;
|
|
1461
1586
|
/** Present when images were extracted (v1) OR text windows / images were emitted (v2). */
|
|
1462
1587
|
enrichment?: EnrichmentPending;
|
|
1463
1588
|
/** Present only when ≥1 stored chunk was auto-classified secret by credential detection. */
|
|
1464
1589
|
secretElevation?: SecretElevationAggregate;
|
|
1590
|
+
/** Relationships dropped because an endpoint matched no submitted entity. */
|
|
1591
|
+
relationshipsDropped?: number;
|
|
1592
|
+
/** Up to 20 dropped relationships, retained from the enrichment response. */
|
|
1593
|
+
droppedRelationships?: DroppedGraphRelationship[];
|
|
1465
1594
|
}
|
|
1466
1595
|
/** Coarse pipeline stages. Stable vocabulary — finer detail goes in counters/message. */
|
|
1467
1596
|
type IngestStage = 'parsing' | 'storing' | 'enrichment' | 'complete';
|
|
@@ -1508,20 +1637,76 @@ interface IngestErrorEvent {
|
|
|
1508
1637
|
message?: string;
|
|
1509
1638
|
code?: string | number;
|
|
1510
1639
|
status?: number;
|
|
1640
|
+
/** Exact HTTP Retry-After value when the failure came from an HTTP response. */
|
|
1641
|
+
retryAfter?: string;
|
|
1642
|
+
/** Retry delay normalized to seconds when Retry-After was parseable. */
|
|
1643
|
+
retryAfterSeconds?: number;
|
|
1511
1644
|
/**
|
|
1512
|
-
*
|
|
1513
|
-
*
|
|
1514
|
-
*
|
|
1645
|
+
* Durably committed {@link FileIngestResult}, present when either the server
|
|
1646
|
+
* committed a stable replacement but its secondary-projection cleanup is
|
|
1647
|
+
* still pending, or the SDK's later enrichment phase failed.
|
|
1515
1648
|
*
|
|
1516
1649
|
* Lets consumers persist the catalog entry id, per-chunk entry ids, and
|
|
1517
1650
|
* character/chunk counts before surfacing the error — so a 401 storm during
|
|
1518
1651
|
* entity extraction no longer loses the search-ready chunks. Absent for
|
|
1519
|
-
* errors
|
|
1520
|
-
*
|
|
1652
|
+
* errors where the attempted revision did not commit (parsing/storing
|
|
1653
|
+
* failures and rollback cleanup debt), transport errors, and aborts.
|
|
1521
1654
|
*/
|
|
1522
1655
|
partialResult?: FileIngestResult;
|
|
1523
1656
|
}
|
|
1524
1657
|
type IngestEvent = IngestProgressEvent | IngestHeartbeatEvent | IngestResultEvent | IngestErrorEvent;
|
|
1658
|
+
/** What a pending enrichment session finalizes into. Sessions created before
|
|
1659
|
+
* graph-only support carry no purpose and behave as `'ingest'`. */
|
|
1660
|
+
type EnrichmentPurpose = 'ingest' | 'graph-only';
|
|
1661
|
+
/**
|
|
1662
|
+
* Terminal server event for POST /api/memory/graph/enrich/file. Deliberately
|
|
1663
|
+
* NOT an {@link IngestResultEvent}: the prepare phase stores nothing, so there
|
|
1664
|
+
* are no chunk counters to report — fabricating `chunks: 0` would make the
|
|
1665
|
+
* result indistinguishable from a real empty ingest.
|
|
1666
|
+
*/
|
|
1667
|
+
interface GraphEnrichPreparedEvent {
|
|
1668
|
+
schemaVersion: 1;
|
|
1669
|
+
type: 'result';
|
|
1670
|
+
stage: 'complete';
|
|
1671
|
+
purpose: 'graph-only';
|
|
1672
|
+
filename: string;
|
|
1673
|
+
fileType: string;
|
|
1674
|
+
enrichment: EnrichmentPendingV2;
|
|
1675
|
+
message?: string;
|
|
1676
|
+
}
|
|
1677
|
+
/**
|
|
1678
|
+
* Terminal result of a graph-only re-enrichment run — also the response body
|
|
1679
|
+
* of POST /files/{fileId}/enrich when the pending session's purpose is
|
|
1680
|
+
* `'graph-only'`. Counts reflect ACTUAL graph persistence (mirrors
|
|
1681
|
+
* {@link EnrichResult}), never the submitted payload sizes.
|
|
1682
|
+
*/
|
|
1683
|
+
interface GraphEnrichResult {
|
|
1684
|
+
purpose: 'graph-only';
|
|
1685
|
+
filename: string;
|
|
1686
|
+
fileType: string;
|
|
1687
|
+
/** The single persisted graph projection row, including a successful zero-entity replacement. */
|
|
1688
|
+
entryIds: [string];
|
|
1689
|
+
/** Stable logical document identity whose graph projection was replaced. */
|
|
1690
|
+
graphAnchorEntryId: string;
|
|
1691
|
+
entitiesStored: number;
|
|
1692
|
+
relationshipsStored: number;
|
|
1693
|
+
/** Present (and >0) only when edges were dropped — see {@link EnrichResult}. */
|
|
1694
|
+
relationshipsDropped?: number;
|
|
1695
|
+
droppedRelationships?: DroppedGraphRelationship[];
|
|
1696
|
+
}
|
|
1697
|
+
/** Terminal success of the SDK's graph-only stream — exactly one per run. */
|
|
1698
|
+
interface GraphEnrichResultEvent extends GraphEnrichResult {
|
|
1699
|
+
schemaVersion: 1;
|
|
1700
|
+
type: 'result';
|
|
1701
|
+
stage: 'complete';
|
|
1702
|
+
message?: string;
|
|
1703
|
+
}
|
|
1704
|
+
/**
|
|
1705
|
+
* Typed view of the SDK's `graphEnrichFileEvents()` stream. Progress /
|
|
1706
|
+
* heartbeat / error envelopes are shared with the ingest stream (same wire
|
|
1707
|
+
* protocol); only the terminal result differs.
|
|
1708
|
+
*/
|
|
1709
|
+
type GraphEnrichEvent = IngestProgressEvent | IngestHeartbeatEvent | GraphEnrichResultEvent | IngestErrorEvent;
|
|
1525
1710
|
|
|
1526
1711
|
/**
|
|
1527
1712
|
* Namespace topology-isolation modes for v0.17.0.
|
|
@@ -1636,4 +1821,4 @@ interface CreatePyxMemoryOptions {
|
|
|
1636
1821
|
}
|
|
1637
1822
|
declare function createPyxMemory(opts?: CreatePyxMemoryOptions): MemoryClient;
|
|
1638
1823
|
|
|
1639
|
-
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 EntityExtractionResult, type ExtendedMemoryInterface, type FetchCorrectionsInput, type GraphEnrichment, type GraphEnrichmentStatus, 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, createPyxMemory, mergeExtractedEntities, normalizeGraphLabel, normalizeNameKey, projectSearchResponseForMcp, secretElevationAggregate, secretElevationNoticeFor, withSecretElevationNotice };
|
|
1824
|
+
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,16 +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-
|
|
24
|
+
} from "./chunk-JGFDID3B.mjs";
|
|
22
25
|
import {
|
|
26
|
+
assertGraphExtractionPayload,
|
|
27
|
+
encodeListCursorToken,
|
|
23
28
|
mergeExtractedEntities,
|
|
24
29
|
normalizeGraphLabel,
|
|
25
|
-
normalizeNameKey
|
|
26
|
-
|
|
30
|
+
normalizeNameKey,
|
|
31
|
+
parseListCursorToken
|
|
32
|
+
} from "./chunk-3OLH3HYR.mjs";
|
|
27
33
|
|
|
28
34
|
// src/preset.ts
|
|
29
35
|
var DEFAULT_MEMORY_URL = `http://localhost:${DEFAULTS.MEMORY_SERVER_PORT}`;
|
|
@@ -54,10 +60,16 @@ export {
|
|
|
54
60
|
StoreTarget,
|
|
55
61
|
TAXONOMY_MAX_CATEGORIES,
|
|
56
62
|
VectorProvider,
|
|
63
|
+
assertGraphExtractionPayload,
|
|
57
64
|
createPyxMemory,
|
|
65
|
+
documentContentSource,
|
|
66
|
+
documentGraphSource,
|
|
67
|
+
documentImageSource,
|
|
68
|
+
encodeListCursorToken,
|
|
58
69
|
mergeExtractedEntities,
|
|
59
70
|
normalizeGraphLabel,
|
|
60
71
|
normalizeNameKey,
|
|
72
|
+
parseListCursorToken,
|
|
61
73
|
projectSearchResponseForMcp,
|
|
62
74
|
secretElevationAggregate,
|
|
63
75
|
secretElevationNoticeFor,
|
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-AMKPOPH6.mjs";
|
|
15
|
+
import "./chunk-JGFDID3B.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
package/dist/chunk-A3L46P2G.mjs
DELETED
|
@@ -1,57 +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 relationshipKey(relationship) {
|
|
10
|
-
return [
|
|
11
|
-
relationship.source.trim().toLowerCase(),
|
|
12
|
-
relationship.target.trim().toLowerCase(),
|
|
13
|
-
normalizeGraphLabel(relationship.type, "RELATED_TO")
|
|
14
|
-
].join("\0");
|
|
15
|
-
}
|
|
16
|
-
function mergeExtractedEntities(callerEntities, callerRelationships, extracted) {
|
|
17
|
-
const entities = [...callerEntities ?? []];
|
|
18
|
-
const relationships = [...callerRelationships ?? []];
|
|
19
|
-
const nameByLowercase = /* @__PURE__ */ new Map();
|
|
20
|
-
for (const entity of entities) {
|
|
21
|
-
const key = entity.name.toLowerCase();
|
|
22
|
-
if (!nameByLowercase.has(key)) nameByLowercase.set(key, entity.name);
|
|
23
|
-
}
|
|
24
|
-
for (const entity of extracted.entities) {
|
|
25
|
-
const key = entity.name.toLowerCase();
|
|
26
|
-
if (nameByLowercase.has(key)) continue;
|
|
27
|
-
entities.push({ ...entity, type: normalizeGraphLabel(entity.type, "CONCEPT") });
|
|
28
|
-
nameByLowercase.set(key, entity.name);
|
|
29
|
-
}
|
|
30
|
-
for (const relationship of extracted.relations) {
|
|
31
|
-
const source = nameByLowercase.get(relationship.source.toLowerCase());
|
|
32
|
-
const target = nameByLowercase.get(relationship.target.toLowerCase());
|
|
33
|
-
if (source && target) {
|
|
34
|
-
relationships.push({
|
|
35
|
-
...relationship,
|
|
36
|
-
source,
|
|
37
|
-
target,
|
|
38
|
-
type: normalizeGraphLabel(relationship.type, "RELATED_TO")
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
const seenRelationships = /* @__PURE__ */ new Set();
|
|
43
|
-
const dedupedRelationships = [];
|
|
44
|
-
for (const relationship of relationships) {
|
|
45
|
-
const key = relationshipKey(relationship);
|
|
46
|
-
if (seenRelationships.has(key)) continue;
|
|
47
|
-
seenRelationships.add(key);
|
|
48
|
-
dedupedRelationships.push(relationship);
|
|
49
|
-
}
|
|
50
|
-
return { entities, relationships: dedupedRelationships };
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export {
|
|
54
|
-
normalizeGraphLabel,
|
|
55
|
-
normalizeNameKey,
|
|
56
|
-
mergeExtractedEntities
|
|
57
|
-
};
|