@pyxmate/memory 1.17.16 → 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-ZVI7DCB4.mjs → chunk-AMKPOPH6.mjs} +5 -3
- package/dist/{chunk-MDFUZ3V2.mjs → chunk-JGFDID3B.mjs} +221 -39
- 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 +87 -19
- package/dist/index.mjs +13 -3
- package/dist/react.mjs +3 -3
- package/package.json +1 -1
- package/dist/chunk-34MTVIYK.mjs +0 -109
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 {
|
|
@@ -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,20 @@ 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;
|
|
249
278
|
}
|
|
250
279
|
/**
|
|
251
280
|
* Options for {@link MemoryClient.graphEnrichFileEvents}. `documentKey` is the
|
|
@@ -259,10 +288,23 @@ interface IngestFileOptions {
|
|
|
259
288
|
*/
|
|
260
289
|
interface GraphEnrichFileOptions {
|
|
261
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;
|
|
262
298
|
namespaceId?: string;
|
|
263
299
|
signal?: AbortSignal;
|
|
264
300
|
enrichment: EnrichmentCallbacks;
|
|
265
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;
|
|
307
|
+
}
|
|
266
308
|
/**
|
|
267
309
|
* Caller-supplied enrichment for the per-call store path. Mirrors
|
|
268
310
|
* {@link EnrichmentCallbacks} for file ingest. When supplied, the SDK invokes
|
|
@@ -304,7 +346,13 @@ interface RequestAuthorityOptions {
|
|
|
304
346
|
/** Error thrown by MemoryClient when the server returns a non-success response. */
|
|
305
347
|
declare class MemoryServerError extends Error {
|
|
306
348
|
readonly status: number;
|
|
307
|
-
|
|
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);
|
|
308
356
|
/** True when the server returned HTTP 404 (not found). */
|
|
309
357
|
get isNotFound(): boolean;
|
|
310
358
|
}
|
|
@@ -414,10 +462,10 @@ declare class MemoryClient implements ExtendedMemoryInterface {
|
|
|
414
462
|
* heartbeat events around each slow step. Throws on any failure; the
|
|
415
463
|
* purpose-specific wrappers translate that into their terminal error.
|
|
416
464
|
*
|
|
417
|
-
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
*
|
|
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.
|
|
421
469
|
*/
|
|
422
470
|
private runEnrichmentCallbacks;
|
|
423
471
|
/**
|
|
@@ -435,12 +483,12 @@ declare class MemoryClient implements ExtendedMemoryInterface {
|
|
|
435
483
|
* Get the download URL for an uploaded file.
|
|
436
484
|
* Returns a URL that serves the original file binary with proper Content-Type.
|
|
437
485
|
*/
|
|
438
|
-
getFileDownloadUrl(filename: string): string;
|
|
486
|
+
getFileDownloadUrl(filename: string, options?: FileDownloadOptions): string;
|
|
439
487
|
/**
|
|
440
488
|
* Download an uploaded file by filename.
|
|
441
489
|
* Returns the raw Response (caller handles the body — arrayBuffer, blob, stream, etc.).
|
|
442
490
|
*/
|
|
443
|
-
downloadFile(filename: string): Promise<Response>;
|
|
491
|
+
downloadFile(filename: string, options?: FileDownloadOptions): Promise<Response>;
|
|
444
492
|
/** @deprecated Use {@link list} instead. Kept for backwards compatibility. */
|
|
445
493
|
listEntries(params?: {
|
|
446
494
|
page?: number;
|
|
@@ -469,7 +517,7 @@ declare class MemoryClient implements ExtendedMemoryInterface {
|
|
|
469
517
|
reindex(): Promise<void>;
|
|
470
518
|
clearGraph(): Promise<number>;
|
|
471
519
|
repairGraph(): Promise<GraphRepairResult$1>;
|
|
472
|
-
deleteBySource(source: string): Promise<number>;
|
|
520
|
+
deleteBySource(source: string, authority?: TenantScopeOptions): Promise<number>;
|
|
473
521
|
setFolder(from: string, to: string, options?: {
|
|
474
522
|
dryRun?: boolean;
|
|
475
523
|
}): Promise<{
|
|
@@ -478,7 +526,7 @@ declare class MemoryClient implements ExtendedMemoryInterface {
|
|
|
478
526
|
updated: number;
|
|
479
527
|
dryRun: boolean;
|
|
480
528
|
}>;
|
|
481
|
-
queryAsOf(asOfDate: string, filters?: TemporalQueryFilters): Promise<MemoryEntry$1[]>;
|
|
529
|
+
queryAsOf(asOfDate: string, filters?: TemporalQueryFilters, authority?: TenantScopeOptions): Promise<MemoryEntry$1[]>;
|
|
482
530
|
lineage(params: LineageParams$1, authority?: RequestAuthorityOptions): Promise<LineageResult$1>;
|
|
483
531
|
reinforce(params: ReinforceParams$1, authority?: RequestAuthorityOptions): Promise<ReinforceResult$1>;
|
|
484
532
|
log(filters?: MemoryLogFilters): Promise<MemoryEntry$1[]>;
|
|
@@ -996,6 +1044,8 @@ interface ReinforceResult {
|
|
|
996
1044
|
interface SourceEvidence {
|
|
997
1045
|
/** Memory entry that produced this graph fact. */
|
|
998
1046
|
memoryEntryId: string;
|
|
1047
|
+
/** Data tenant of the source entry. `null` = single-tenant / legacy data. */
|
|
1048
|
+
tenantId?: string | null;
|
|
999
1049
|
/** Namespace of the source memory entry. `null` = legacy / tenant-root. */
|
|
1000
1050
|
namespaceId?: string | null;
|
|
1001
1051
|
/** Optional source identifier copied from the memory entry or caller. */
|
|
@@ -1419,6 +1469,8 @@ interface ApiResponse<T> {
|
|
|
1419
1469
|
success: boolean;
|
|
1420
1470
|
data?: T;
|
|
1421
1471
|
error?: string;
|
|
1472
|
+
/** Stable machine-readable discriminator for error responses. */
|
|
1473
|
+
code?: string;
|
|
1422
1474
|
}
|
|
1423
1475
|
/**
|
|
1424
1476
|
* Build variant of the running pyx-memory image. Detected from the actual
|
|
@@ -1524,11 +1576,21 @@ interface FileIngestResult {
|
|
|
1524
1576
|
fileType: string;
|
|
1525
1577
|
chunks: number;
|
|
1526
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;
|
|
1527
1585
|
totalCharacters: number;
|
|
1528
1586
|
/** Present when images were extracted (v1) OR text windows / images were emitted (v2). */
|
|
1529
1587
|
enrichment?: EnrichmentPending;
|
|
1530
1588
|
/** Present only when ≥1 stored chunk was auto-classified secret by credential detection. */
|
|
1531
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[];
|
|
1532
1594
|
}
|
|
1533
1595
|
/** Coarse pipeline stages. Stable vocabulary — finer detail goes in counters/message. */
|
|
1534
1596
|
type IngestStage = 'parsing' | 'storing' | 'enrichment' | 'complete';
|
|
@@ -1575,16 +1637,20 @@ interface IngestErrorEvent {
|
|
|
1575
1637
|
message?: string;
|
|
1576
1638
|
code?: string | number;
|
|
1577
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;
|
|
1578
1644
|
/**
|
|
1579
|
-
*
|
|
1580
|
-
*
|
|
1581
|
-
*
|
|
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.
|
|
1582
1648
|
*
|
|
1583
1649
|
* Lets consumers persist the catalog entry id, per-chunk entry ids, and
|
|
1584
1650
|
* character/chunk counts before surfacing the error — so a 401 storm during
|
|
1585
1651
|
* entity extraction no longer loses the search-ready chunks. Absent for
|
|
1586
|
-
* errors
|
|
1587
|
-
*
|
|
1652
|
+
* errors where the attempted revision did not commit (parsing/storing
|
|
1653
|
+
* failures and rollback cleanup debt), transport errors, and aborts.
|
|
1588
1654
|
*/
|
|
1589
1655
|
partialResult?: FileIngestResult;
|
|
1590
1656
|
}
|
|
@@ -1618,8 +1684,10 @@ interface GraphEnrichResult {
|
|
|
1618
1684
|
purpose: 'graph-only';
|
|
1619
1685
|
filename: string;
|
|
1620
1686
|
fileType: string;
|
|
1621
|
-
/** The single
|
|
1622
|
-
entryIds: 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;
|
|
1623
1691
|
entitiesStored: number;
|
|
1624
1692
|
relationshipsStored: number;
|
|
1625
1693
|
/** Present (and >0) only when edges were dropped — see {@link EnrichResult}. */
|
|
@@ -1753,4 +1821,4 @@ interface CreatePyxMemoryOptions {
|
|
|
1753
1821
|
}
|
|
1754
1822
|
declare function createPyxMemory(opts?: CreatePyxMemoryOptions): MemoryClient;
|
|
1755
1823
|
|
|
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 };
|
|
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,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-
|
|
24
|
+
} from "./chunk-JGFDID3B.mjs";
|
|
22
25
|
import {
|
|
23
26
|
assertGraphExtractionPayload,
|
|
27
|
+
encodeListCursorToken,
|
|
24
28
|
mergeExtractedEntities,
|
|
25
29
|
normalizeGraphLabel,
|
|
26
|
-
normalizeNameKey
|
|
27
|
-
|
|
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-
|
|
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-34MTVIYK.mjs
DELETED
|
@@ -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
|
-
};
|