@pyxmate/memory 0.5.3 → 0.5.5
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-AXTWVLDO.mjs → chunk-A3W2OUCH.mjs} +1 -1
- package/dist/{chunk-YL5QMN6G.mjs → chunk-RDQIIYAV.mjs} +19 -0
- package/dist/dashboard.mjs +2 -2
- package/dist/index.d.ts +10 -0
- package/dist/index.mjs +1 -1
- package/dist/react.mjs +2 -2
- package/package.json +1 -1
- package/skills/pyx-memory/reference/http-api.md +31 -1
|
@@ -171,6 +171,25 @@ var MemoryClient = class {
|
|
|
171
171
|
}
|
|
172
172
|
return result;
|
|
173
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Get the download URL for an uploaded file.
|
|
176
|
+
* Returns a URL that serves the original file binary with proper Content-Type.
|
|
177
|
+
*/
|
|
178
|
+
getFileDownloadUrl(filename) {
|
|
179
|
+
return `${this.baseUrl}/api/memory/files/download/${encodeURIComponent(filename)}`;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Download an uploaded file by filename.
|
|
183
|
+
* Returns the raw Response (caller handles the body — arrayBuffer, blob, stream, etc.).
|
|
184
|
+
*/
|
|
185
|
+
async downloadFile(filename) {
|
|
186
|
+
const url = this.getFileDownloadUrl(filename);
|
|
187
|
+
const res = await fetch(url, { headers: this._authHeaders });
|
|
188
|
+
if (!res.ok) {
|
|
189
|
+
throw new MemoryServerError(`File download failed: ${res.status}`, res.status);
|
|
190
|
+
}
|
|
191
|
+
return res;
|
|
192
|
+
}
|
|
174
193
|
/** @deprecated Use {@link list} instead. Kept for backwards compatibility. */
|
|
175
194
|
async listEntries(params) {
|
|
176
195
|
const result = await this.list(params);
|
package/dist/dashboard.mjs
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -108,6 +108,16 @@ declare class MemoryClient implements ExtendedMemoryInterface {
|
|
|
108
108
|
description?: string;
|
|
109
109
|
enrichment?: EnrichmentCallbacks;
|
|
110
110
|
}): Promise<FileIngestResult>;
|
|
111
|
+
/**
|
|
112
|
+
* Get the download URL for an uploaded file.
|
|
113
|
+
* Returns a URL that serves the original file binary with proper Content-Type.
|
|
114
|
+
*/
|
|
115
|
+
getFileDownloadUrl(filename: string): string;
|
|
116
|
+
/**
|
|
117
|
+
* Download an uploaded file by filename.
|
|
118
|
+
* Returns the raw Response (caller handles the body — arrayBuffer, blob, stream, etc.).
|
|
119
|
+
*/
|
|
120
|
+
downloadFile(filename: string): Promise<Response>;
|
|
111
121
|
/** @deprecated Use {@link list} instead. Kept for backwards compatibility. */
|
|
112
122
|
listEntries(params?: {
|
|
113
123
|
page?: number;
|
package/dist/index.mjs
CHANGED
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-A3W2OUCH.mjs";
|
|
15
|
+
import "./chunk-RDQIIYAV.mjs";
|
|
16
16
|
|
|
17
17
|
// ../dashboard/src/hooks/use-consolidation-log.ts
|
|
18
18
|
import { useCallback as useCallback2, useMemo } from "react";
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@ Destructive operations (DELETE, forget, decay, consolidate, reindex) require `AD
|
|
|
18
18
|
const client = new MemoryClient('http://localhost:7822', process.env.MEMORY_API_KEY);
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
## Core (
|
|
21
|
+
## Core (13 endpoints)
|
|
22
22
|
|
|
23
23
|
| Method | Endpoint | Description |
|
|
24
24
|
|--------|----------|-------------|
|
|
@@ -26,6 +26,7 @@ const client = new MemoryClient('http://localhost:7822', process.env.MEMORY_API_
|
|
|
26
26
|
| GET | `/admin/health` | Admin health check (version, uptime, embedding provider, memory stats) |
|
|
27
27
|
| POST | `/api/memory/ingest` | Store a memory (JSON: `{ content, type, metadata, agentId?, sessionId?, targets?, entities?, relationships?, importance?, source?, eventTime?, id?, parentId?, ingestTime? }`) |
|
|
28
28
|
| POST | `/api/memory/ingest/file` | Upload file (multipart, 50MB limit). For PDFs with images, returns an `enrichment` block with HMAC token and image metadata for two-phase enrichment. |
|
|
29
|
+
| GET | `/api/memory/files/download/:filename` | Download uploaded file binary by filename. Returns the original file with proper Content-Type. Images served inline, documents as attachment. |
|
|
29
30
|
| GET | `/api/memory/files/:fileId/images/:imageId?token=...` | Fetch an extracted PDF image (binary). Requires HMAC token from ingest response. |
|
|
30
31
|
| POST | `/api/memory/files/:fileId/enrich` | Submit image descriptions + entities after LLM vision processing. Requires `X-Enrichment-Token` header. |
|
|
31
32
|
| GET | `/api/memory/search?query=...&strategy=...&limit=...` | Search memories — **does NOT support** filters, enableHyDE, enableRerank |
|
|
@@ -125,6 +126,35 @@ await memory.ingestFile(pdfFile, {
|
|
|
125
126
|
});
|
|
126
127
|
```
|
|
127
128
|
|
|
129
|
+
## File Downloads
|
|
130
|
+
|
|
131
|
+
`GET /api/memory/files/download/:filename` serves uploaded file binaries.
|
|
132
|
+
|
|
133
|
+
- **Images** (`image/*`): served inline (`Content-Disposition: inline`)
|
|
134
|
+
- **Documents**: served as attachment (`Content-Disposition: attachment; filename="..."`)
|
|
135
|
+
- **Caching**: `Cache-Control: public, max-age=86400, immutable`
|
|
136
|
+
- **Auth**: standard API key auth (same as other endpoints)
|
|
137
|
+
- **Security**: path traversal prevention, extension validation against ingestion allowlist
|
|
138
|
+
|
|
139
|
+
### Example: download a file
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
curl -o report.pdf "{{ENDPOINT}}/api/memory/files/download/report.pdf" \
|
|
143
|
+
-H "Authorization: Bearer {{API_KEY}}"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### SDK usage
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
// Get download URL (useful for markdown images, browser rendering)
|
|
150
|
+
const url = memory.getFileDownloadUrl('screenshot.png');
|
|
151
|
+
// → 'http://localhost:7822/api/memory/files/download/screenshot.png'
|
|
152
|
+
|
|
153
|
+
// Download file binary
|
|
154
|
+
const response = await memory.downloadFile('report.pdf');
|
|
155
|
+
const buffer = await response.arrayBuffer();
|
|
156
|
+
```
|
|
157
|
+
|
|
128
158
|
## Two-Phase PDF Enrichment
|
|
129
159
|
|
|
130
160
|
When a PDF contains extractable images, the server returns an `enrichment` block from `POST /api/memory/ingest/file`. The SDK wraps the full three-phase flow into a single `ingestFile()` call with `EnrichmentCallbacks`.
|