@pyxmate/memory 0.17.0 → 0.17.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pyxmate/memory",
3
- "version": "0.17.0",
3
+ "version": "0.17.2",
4
4
  "type": "module",
5
5
  "description": "SDK for pyx-memory — Memory as a Service for AI agents",
6
6
  "license": "MIT",
@@ -452,6 +452,25 @@ await memory.store({
452
452
  });
453
453
  ```
454
454
 
455
+ HTTP ingest accepts the same resource coordinate on JSON and file uploads:
456
+
457
+ ```bash
458
+ curl -X POST "$MEMORY_URL/api/memory/ingest" \
459
+ -H "Authorization: Bearer $API_KEY" \
460
+ -H "X-Tenant-Id: tenant-acme" \
461
+ -H "X-Namespace-Id: <NS_ID>" \
462
+ -H "Content-Type: application/json" \
463
+ -d '{"content":"Q4 revenue projections","type":"long-term"}'
464
+
465
+ curl -N -X POST "$MEMORY_URL/api/memory/ingest/file" \
466
+ -H "Authorization: Bearer $API_KEY" \
467
+ -H "X-Tenant-Id: tenant-acme" \
468
+ -H "X-Namespace-Id: <NS_ID>" \
469
+ -F "file=@report.pdf"
470
+ ```
471
+
472
+ `X-Namespace-Id` is canonical when both header and body/form field are sent; conflicting values return `400 namespace_id_conflict`. A missing or cross-tenant namespace returns `404 namespace_not_found`.
473
+
455
474
  No bulk migration is required — legacy data keeps working unchanged.
456
475
 
457
476
  ### Migrating legacy entries (v0.16.1)
@@ -24,8 +24,8 @@ const client = new MemoryClient('http://localhost:7822', process.env.MEMORY_API_
24
24
  |--------|----------|-------------|
25
25
  | GET | `/health` | Public health check (status only — no internals exposed) |
26
26
  | GET | `/admin/health` | Admin health check (version, uptime, embedding provider, memory stats) |
27
- | POST | `/api/memory/ingest` | Store a memory (JSON: `{ content, type, metadata, agentId?, sessionId?, targets?, entities?, relationships?, importance?, source?, eventTime?, id?, parentId?, ingestTime?, pinned? }`) |
28
- | POST | `/api/memory/ingest/file` | Upload file (multipart, 100MB limit). For PDFs with images, returns an `enrichment` block with HMAC token and image metadata for two-phase enrichment. |
27
+ | POST | `/api/memory/ingest` | Store a memory (JSON: `{ content, type, metadata, namespaceId?, agentId?, sessionId?, targets?, entities?, relationships?, importance?, source?, eventTime?, id?, parentId?, ingestTime?, pinned? }`) |
28
+ | POST | `/api/memory/ingest/file` | Upload file (multipart, 100MB limit; optional `namespaceId` field or `X-Namespace-Id` header). For PDFs with images, returns an `enrichment` block with HMAC token and image metadata for two-phase enrichment. |
29
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. |
30
30
  | GET | `/api/memory/files/:fileId/images/:imageId?token=...` | Fetch an extracted PDF image (binary). Requires HMAC token from ingest response. |
31
31
  | POST | `/api/memory/files/:fileId/enrich` | Submit image descriptions + entities after LLM vision processing. Requires `X-Enrichment-Token` header. |
@@ -82,6 +82,21 @@ Fine-grained access control inside a tenant — namespaces, principals, group me
82
82
 
83
83
  Cross-tenant safety: every route verifies the referenced resource belongs to the caller's tenant; mismatches return `404` (not `403`) to avoid existence disclosure.
84
84
 
85
+ ## Namespaced Ingest (v0.17.1)
86
+
87
+ `POST /api/memory/ingest` accepts `namespaceId` either in the JSON body or the `X-Namespace-Id` header. `POST /api/memory/ingest/file` accepts the same header or a multipart `namespaceId` field. The header is canonical; sending both channels with different values returns `400 namespace_id_conflict`. Sending JSON `namespaceId: null` is invalid; omit the field to keep the legacy NULL namespace bucket.
88
+
89
+ When a namespace is supplied, the server resolves it once against the caller tenant before storing. Missing or cross-tenant namespaces return `404 namespace_not_found` so callers cannot distinguish "does not exist" from "exists in another tenant".
90
+
91
+ ```bash
92
+ curl -X POST {{ENDPOINT}}/api/memory/ingest \
93
+ -H "Authorization: Bearer {{API_KEY}}" \
94
+ -H "X-Tenant-Id: tenant-acme" \
95
+ -H "X-Namespace-Id: ns-engineering" \
96
+ -H "Content-Type: application/json" \
97
+ -d '{"content":"Q4 revenue projections","type":"long-term"}'
98
+ ```
99
+
85
100
  ## Strict Topology Isolation (v0.17.0)
86
101
 
87
102
  | Method | Endpoint | Description |
@@ -161,6 +176,7 @@ The inner `success: false` flag carries `failureReason` ∈ `{ not_found, cross_
161
176
  |-------|------|----------|-------------|
162
177
  | `file` | File | Yes | The file to ingest (max 100MB) |
163
178
  | `description` | string | No | Agent-provided description (e.g., from LLM vision). Used instead of parser output for images. |
179
+ | `namespaceId` | string | No | ReBAC namespace to stamp on every chunk. `X-Namespace-Id` header is preferred when both are present. |
164
180
 
165
181
  **Supported formats**: `.txt`, `.md`, `.csv`, `.tsv`, `.log`, `.pdf`, `.docx`, `.xlsx`, `.pptx`, `.json`, `.jsonl`, `.html`, `.htm`, `.png`, `.jpg`, `.jpeg`, `.webp`, `.gif`, `.bmp`, `.tiff`, `.svg`
166
182