@pyxmate/memory 0.5.10 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14,10 +14,21 @@ var MemoryServerError = class extends Error {
|
|
|
14
14
|
var MemoryClient = class {
|
|
15
15
|
baseUrl;
|
|
16
16
|
_authHeaders;
|
|
17
|
-
constructor(memoryUrl,
|
|
17
|
+
constructor(memoryUrl, apiKeyOrOptions) {
|
|
18
18
|
this.baseUrl = memoryUrl.replace(/\/$/, "");
|
|
19
|
+
let apiKey;
|
|
20
|
+
let defaultHeaders = {};
|
|
21
|
+
if (typeof apiKeyOrOptions === "string") {
|
|
22
|
+
apiKey = apiKeyOrOptions;
|
|
23
|
+
} else if (apiKeyOrOptions) {
|
|
24
|
+
apiKey = apiKeyOrOptions.apiKey;
|
|
25
|
+
defaultHeaders = apiKeyOrOptions.defaultHeaders ?? {};
|
|
26
|
+
}
|
|
19
27
|
const trimmed = apiKey?.trim();
|
|
20
|
-
this._authHeaders =
|
|
28
|
+
this._authHeaders = {
|
|
29
|
+
...trimmed ? { Authorization: `Bearer ${trimmed}` } : {},
|
|
30
|
+
...defaultHeaders
|
|
31
|
+
};
|
|
21
32
|
}
|
|
22
33
|
/** Encode a path segment to prevent URL injection */
|
|
23
34
|
encodePathSegment(segment) {
|
|
@@ -255,6 +266,12 @@ var MemoryClient = class {
|
|
|
255
266
|
async reindex() {
|
|
256
267
|
await this.fetchApi("/api/memory/reindex", { method: "POST" });
|
|
257
268
|
}
|
|
269
|
+
async clearGraph() {
|
|
270
|
+
const result = await this.fetchApi("/api/memory/graph/clear", {
|
|
271
|
+
method: "POST"
|
|
272
|
+
});
|
|
273
|
+
return result.deleted;
|
|
274
|
+
}
|
|
258
275
|
async deleteBySource(source) {
|
|
259
276
|
const result = await this.fetchApi(
|
|
260
277
|
`/api/memory/source/${this.encodePathSegment(source)}`,
|
package/dist/dashboard.mjs
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ interface MemoryListParams {
|
|
|
10
10
|
type?: MemoryType$1;
|
|
11
11
|
/** Filter by agent ID. */
|
|
12
12
|
agentId?: string;
|
|
13
|
+
/** Filter by tenant ID for multi-tenant isolation. */
|
|
14
|
+
tenantId?: string;
|
|
13
15
|
}
|
|
14
16
|
/** Result of a paginated entry listing. */
|
|
15
17
|
interface MemoryListResult {
|
|
@@ -25,6 +27,10 @@ interface TemporalQueryFilters {
|
|
|
25
27
|
source?: string;
|
|
26
28
|
limit?: number;
|
|
27
29
|
}
|
|
30
|
+
/** Options for scoping operations to a specific tenant. */
|
|
31
|
+
interface TenantScopeOptions {
|
|
32
|
+
tenantId?: string;
|
|
33
|
+
}
|
|
28
34
|
/** Abstract interface for memory systems (local or remote). */
|
|
29
35
|
interface MemoryInterface {
|
|
30
36
|
initialize(): Promise<void>;
|
|
@@ -32,10 +38,10 @@ interface MemoryInterface {
|
|
|
32
38
|
search(params: MemorySearchParams$1): Promise<MemorySearchResult$1>;
|
|
33
39
|
/** List entries with SQL LIMIT/OFFSET pagination. */
|
|
34
40
|
list(params?: MemoryListParams): Promise<MemoryListResult>;
|
|
35
|
-
get(id: string): Promise<MemoryEntry$1 | null>;
|
|
36
|
-
delete(id: string): Promise<boolean>;
|
|
37
|
-
clearSession(sessionId: string): Promise<number>;
|
|
38
|
-
stats(): Promise<MemoryStats$1>;
|
|
41
|
+
get(id: string, options?: TenantScopeOptions): Promise<MemoryEntry$1 | null>;
|
|
42
|
+
delete(id: string, options?: TenantScopeOptions): Promise<boolean>;
|
|
43
|
+
clearSession(sessionId: string, options?: TenantScopeOptions): Promise<number>;
|
|
44
|
+
stats(options?: TenantScopeOptions): Promise<MemoryStats$1>;
|
|
39
45
|
/** Query entries as they existed at a point in time (by ingest time). */
|
|
40
46
|
queryAsOf(asOfDate: string, filters?: TemporalQueryFilters): Promise<MemoryEntry$1[]>;
|
|
41
47
|
/** Query entries by event time range (when things actually happened). */
|
|
@@ -82,10 +88,16 @@ declare class MemoryServerError extends Error {
|
|
|
82
88
|
/** True when the server returned HTTP 404 (not found). */
|
|
83
89
|
get isNotFound(): boolean;
|
|
84
90
|
}
|
|
91
|
+
interface MemoryClientOptions {
|
|
92
|
+
/** API key for authentication. */
|
|
93
|
+
apiKey?: string;
|
|
94
|
+
/** Additional headers to send with every request (e.g., X-Caller-Access-Level). */
|
|
95
|
+
defaultHeaders?: Record<string, string>;
|
|
96
|
+
}
|
|
85
97
|
declare class MemoryClient implements ExtendedMemoryInterface {
|
|
86
98
|
protected baseUrl: string;
|
|
87
99
|
private readonly _authHeaders;
|
|
88
|
-
constructor(memoryUrl: string,
|
|
100
|
+
constructor(memoryUrl: string, apiKeyOrOptions?: string | MemoryClientOptions);
|
|
89
101
|
/** Encode a path segment to prevent URL injection */
|
|
90
102
|
private encodePathSegment;
|
|
91
103
|
initialize(): Promise<void>;
|
|
@@ -139,6 +151,7 @@ declare class MemoryClient implements ExtendedMemoryInterface {
|
|
|
139
151
|
summarizeSession(sessionId: string): Promise<MemoryEntry$1 | null>;
|
|
140
152
|
runDecay(): Promise<number>;
|
|
141
153
|
reindex(): Promise<void>;
|
|
154
|
+
clearGraph(): Promise<number>;
|
|
142
155
|
deleteBySource(source: string): Promise<number>;
|
|
143
156
|
queryAsOf(asOfDate: string, filters?: TemporalQueryFilters): Promise<MemoryEntry$1[]>;
|
|
144
157
|
queryByEventTime(startTime: string, endTime: string, filters?: TemporalQueryFilters): Promise<MemoryEntry$1[]>;
|
|
@@ -180,6 +193,12 @@ declare const MemoryType: {
|
|
|
180
193
|
readonly SUMMARY: "summary";
|
|
181
194
|
};
|
|
182
195
|
type MemoryType = (typeof MemoryType)[keyof typeof MemoryType];
|
|
196
|
+
declare const SensitivityLevel: {
|
|
197
|
+
readonly PUBLIC: "public";
|
|
198
|
+
readonly INTERNAL: "internal";
|
|
199
|
+
readonly SECRET: "secret";
|
|
200
|
+
};
|
|
201
|
+
type SensitivityLevel = (typeof SensitivityLevel)[keyof typeof SensitivityLevel];
|
|
183
202
|
declare const RAGStrategy: {
|
|
184
203
|
readonly NAIVE: "naive";
|
|
185
204
|
readonly GRAPH: "graph";
|
|
@@ -226,6 +245,16 @@ interface MemoryEntry {
|
|
|
226
245
|
eventTime?: string;
|
|
227
246
|
/** When this entry was ingested into the system. */
|
|
228
247
|
ingestTime?: string;
|
|
248
|
+
/** Sensitivity classification based on content analysis. */
|
|
249
|
+
sensitivity?: SensitivityLevel;
|
|
250
|
+
/** Whether the content field is encrypted at rest. */
|
|
251
|
+
encrypted?: boolean;
|
|
252
|
+
/** Tenant ID for multi-tenant isolation. */
|
|
253
|
+
tenantId?: string;
|
|
254
|
+
/** User ID within the tenant. */
|
|
255
|
+
userId?: string;
|
|
256
|
+
/** Team/group ID within the tenant. */
|
|
257
|
+
teamId?: string;
|
|
229
258
|
}
|
|
230
259
|
interface MemorySearchParams {
|
|
231
260
|
query: string;
|
|
@@ -239,6 +268,14 @@ interface MemorySearchParams {
|
|
|
239
268
|
asOf?: string;
|
|
240
269
|
/** Confidence threshold below which the system recommends abstention (0.0–1.0). Default: 0.3. */
|
|
241
270
|
abstentionThreshold?: number;
|
|
271
|
+
/** Maximum sensitivity level to include in results. Entries above this level are excluded or redacted. */
|
|
272
|
+
maxSensitivity?: SensitivityLevel;
|
|
273
|
+
/** Tenant ID for multi-tenant isolation. */
|
|
274
|
+
tenantId?: string;
|
|
275
|
+
/** User ID within the tenant. */
|
|
276
|
+
userId?: string;
|
|
277
|
+
/** Team/group ID within the tenant. */
|
|
278
|
+
teamId?: string;
|
|
242
279
|
}
|
|
243
280
|
interface MemorySearchResult {
|
|
244
281
|
entries: MemoryEntry[];
|
|
@@ -327,6 +364,12 @@ interface MemoryIngestRequest {
|
|
|
327
364
|
parentId?: string;
|
|
328
365
|
/** When this entry was ingested (ISO timestamp). Default: now. */
|
|
329
366
|
ingestTime?: string;
|
|
367
|
+
/** Tenant ID for multi-tenant isolation. */
|
|
368
|
+
tenantId?: string;
|
|
369
|
+
/** User ID within the tenant. */
|
|
370
|
+
userId?: string;
|
|
371
|
+
/** Team/group ID within the tenant. */
|
|
372
|
+
teamId?: string;
|
|
330
373
|
}
|
|
331
374
|
interface MemoryStats {
|
|
332
375
|
totalEntries: number;
|
|
@@ -364,4 +407,4 @@ interface GraphTraversalResult {
|
|
|
364
407
|
}>;
|
|
365
408
|
}
|
|
366
409
|
|
|
367
|
-
export { type AgentId, type ApiResponse, type ConsolidationRunResult, DEFAULTS, EmbeddingProviderName, type EnrichmentCallbacks, type ExtendedMemoryInterface, type GraphNode, type GraphRelationship, type GraphTraversalResult, type IngestEntity, type IngestRelationship, type IngestionResult, MemoryClient, type MemoryEntry, type MemoryIngestRequest, type MemoryInterface, type MemoryListParams, type MemoryListResult, type MemorySearchParams, type MemorySearchResult, MemoryServerError, type MemoryStats, MemoryType, RAGStrategy, type StoreInput, StoreTarget, type TemporalQueryFilters, type Timestamp, VectorProvider };
|
|
410
|
+
export { type AgentId, type ApiResponse, type ConsolidationRunResult, DEFAULTS, EmbeddingProviderName, type EnrichmentCallbacks, type ExtendedMemoryInterface, type GraphNode, type GraphRelationship, type GraphTraversalResult, type IngestEntity, type IngestRelationship, type IngestionResult, MemoryClient, type MemoryClientOptions, type MemoryEntry, type MemoryIngestRequest, type MemoryInterface, type MemoryListParams, type MemoryListResult, type MemorySearchParams, type MemorySearchResult, MemoryServerError, type MemoryStats, MemoryType, RAGStrategy, SensitivityLevel, type StoreInput, StoreTarget, type TemporalQueryFilters, type TenantScopeOptions, type Timestamp, VectorProvider };
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MemoryClient,
|
|
3
3
|
MemoryServerError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KVRPHFDP.mjs";
|
|
5
5
|
|
|
6
6
|
// ../shared/src/constants/defaults.ts
|
|
7
7
|
var DEFAULTS = {
|
|
@@ -18,6 +18,11 @@ var MemoryType = {
|
|
|
18
18
|
EPISODIC: "episodic",
|
|
19
19
|
SUMMARY: "summary"
|
|
20
20
|
};
|
|
21
|
+
var SensitivityLevel = {
|
|
22
|
+
PUBLIC: "public",
|
|
23
|
+
INTERNAL: "internal",
|
|
24
|
+
SECRET: "secret"
|
|
25
|
+
};
|
|
21
26
|
var RAGStrategy = {
|
|
22
27
|
NAIVE: "naive",
|
|
23
28
|
GRAPH: "graph",
|
|
@@ -47,6 +52,7 @@ export {
|
|
|
47
52
|
MemoryServerError,
|
|
48
53
|
MemoryType,
|
|
49
54
|
RAGStrategy,
|
|
55
|
+
SensitivityLevel,
|
|
50
56
|
StoreTarget,
|
|
51
57
|
VectorProvider
|
|
52
58
|
};
|
package/dist/react.mjs
CHANGED
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
toGraphologyFormat,
|
|
12
12
|
transformGraphData,
|
|
13
13
|
unreachableHealth
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-QFEFLBTN.mjs";
|
|
15
|
+
import "./chunk-KVRPHFDP.mjs";
|
|
16
16
|
|
|
17
17
|
// ../dashboard/src/hooks/use-consolidation-log.ts
|
|
18
18
|
import { useCallback as useCallback2, useMemo } from "react";
|