@pyxmate/memory 0.1.5-beta → 0.1.9-beta
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.
|
@@ -100,11 +100,7 @@ var MemoryClient = class {
|
|
|
100
100
|
body: formData,
|
|
101
101
|
headers: this._authHeaders
|
|
102
102
|
});
|
|
103
|
-
|
|
104
|
-
if (!body.success || body.data === void 0) {
|
|
105
|
-
throw new Error(body.error ?? `Memory server error: ${res.status}`);
|
|
106
|
-
}
|
|
107
|
-
return body.data;
|
|
103
|
+
return this.parseApiResponse(res);
|
|
108
104
|
}
|
|
109
105
|
/** @deprecated Use {@link list} instead. Kept for backwards compatibility. */
|
|
110
106
|
async listEntries(params) {
|
|
@@ -204,9 +200,21 @@ var MemoryClient = class {
|
|
|
204
200
|
...this._authHeaders
|
|
205
201
|
}
|
|
206
202
|
});
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
203
|
+
return this.parseApiResponse(res);
|
|
204
|
+
}
|
|
205
|
+
/** Parse and validate a JSON API response, throwing MemoryServerError on any failure. */
|
|
206
|
+
async parseApiResponse(res) {
|
|
207
|
+
let body;
|
|
208
|
+
try {
|
|
209
|
+
body = await res.json();
|
|
210
|
+
} catch {
|
|
211
|
+
throw new MemoryServerError(
|
|
212
|
+
`Memory server error: invalid JSON response (${res.status})`,
|
|
213
|
+
res.status
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
if (!body?.success || body.data == null) {
|
|
217
|
+
throw new MemoryServerError(body?.error ?? `Memory server error: ${res.status}`, res.status);
|
|
210
218
|
}
|
|
211
219
|
return body.data;
|
|
212
220
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MemoryClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OIMGVLCJ.mjs";
|
|
4
4
|
|
|
5
5
|
// ../dashboard/src/aggregations/consolidation-analytics.ts
|
|
6
6
|
function analyzeConsolidationLog(entries) {
|
|
@@ -172,11 +172,12 @@ var DashboardClient = class extends MemoryClient {
|
|
|
172
172
|
);
|
|
173
173
|
}
|
|
174
174
|
async graphFull(limit = 50) {
|
|
175
|
+
const relationshipLimit = limit * 4;
|
|
175
176
|
const [nodesResponse, relsResponse] = await Promise.all([
|
|
176
177
|
this.fetchApi(
|
|
177
178
|
`/api/memory/graph/nodes?limit=${limit}`
|
|
178
179
|
),
|
|
179
|
-
this.graphRelationships(
|
|
180
|
+
this.graphRelationships(relationshipLimit).catch(() => ({
|
|
180
181
|
relationships: [],
|
|
181
182
|
totalCount: 0
|
|
182
183
|
}))
|
package/dist/dashboard.mjs
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -121,6 +121,8 @@ declare class MemoryClient implements ExtendedMemoryInterface {
|
|
|
121
121
|
queryAsOf(asOfDate: string, filters?: TemporalQueryFilters): Promise<MemoryEntry$1[]>;
|
|
122
122
|
queryByEventTime(startTime: string, endTime: string, filters?: TemporalQueryFilters): Promise<MemoryEntry$1[]>;
|
|
123
123
|
protected fetchApi<T>(path: string, options?: RequestInit): Promise<T>;
|
|
124
|
+
/** Parse and validate a JSON API response, throwing MemoryServerError on any failure. */
|
|
125
|
+
private parseApiResponse;
|
|
124
126
|
}
|
|
125
127
|
|
|
126
128
|
declare const DEFAULTS: {
|
package/dist/index.mjs
CHANGED
package/dist/react.mjs
CHANGED
|
@@ -11,12 +11,15 @@ import {
|
|
|
11
11
|
toGraphologyFormat,
|
|
12
12
|
transformGraphData,
|
|
13
13
|
unreachableHealth
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-SFEZAVCB.mjs";
|
|
15
|
+
import "./chunk-OIMGVLCJ.mjs";
|
|
16
16
|
|
|
17
17
|
// ../dashboard/src/hooks/use-consolidation-log.ts
|
|
18
18
|
import { useCallback as useCallback2, useMemo } from "react";
|
|
19
19
|
|
|
20
|
+
// ../dashboard/src/constants.ts
|
|
21
|
+
var DEFAULT_POLL_INTERVAL_MS = 3e4;
|
|
22
|
+
|
|
20
23
|
// ../dashboard/src/hooks/use-polling.ts
|
|
21
24
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
22
25
|
function usePolling(fetcher, options) {
|
|
@@ -59,7 +62,7 @@ function usePolling(fetcher, options) {
|
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
// ../dashboard/src/hooks/use-consolidation-log.ts
|
|
62
|
-
function useConsolidationLog(serverUrl, limit = 20, intervalMs =
|
|
65
|
+
function useConsolidationLog(serverUrl, limit = 20, intervalMs = DEFAULT_POLL_INTERVAL_MS) {
|
|
63
66
|
const client = useMemo(() => new DashboardClient(serverUrl), [serverUrl]);
|
|
64
67
|
const fetcher = useCallback2(async () => {
|
|
65
68
|
const entries = await client.consolidationLog(limit);
|
|
@@ -71,7 +74,7 @@ function useConsolidationLog(serverUrl, limit = 20, intervalMs = 3e4) {
|
|
|
71
74
|
// ../dashboard/src/hooks/use-knowledge-graph.ts
|
|
72
75
|
import { useCallback as useCallback3, useMemo as useMemo2 } from "react";
|
|
73
76
|
function useKnowledgeGraph(serverUrl, opts = {}) {
|
|
74
|
-
const { intervalMs =
|
|
77
|
+
const { intervalMs = DEFAULT_POLL_INTERVAL_MS, limit = 50, minWeight, maxNodes } = opts;
|
|
75
78
|
const client = useMemo2(() => new DashboardClient(serverUrl), [serverUrl]);
|
|
76
79
|
const stableTransformOpts = useMemo2(
|
|
77
80
|
() => ({ minWeight, maxNodes }),
|
|
@@ -94,7 +97,7 @@ function useMemoryEntries(serverUrl, filters = {}, intervalMs = 0) {
|
|
|
94
97
|
[client, page, limit, type, agentId, query]
|
|
95
98
|
);
|
|
96
99
|
return usePolling(fetcher, {
|
|
97
|
-
intervalMs: intervalMs ??
|
|
100
|
+
intervalMs: intervalMs ?? DEFAULT_POLL_INTERVAL_MS
|
|
98
101
|
});
|
|
99
102
|
}
|
|
100
103
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pyxmate/memory",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9-beta",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "SDK for pyx-memory — Memory as a Service for AI agents",
|
|
6
6
|
"license": "MIT",
|
|
@@ -58,8 +58,6 @@
|
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@types/react": "^19.0.0",
|
|
62
|
-
"react": "^19.2.4",
|
|
63
61
|
"tsup": "^8.4.0"
|
|
64
62
|
}
|
|
65
63
|
}
|