@pyxmate/memory 0.15.0 → 0.15.1

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.
@@ -365,7 +365,7 @@ var MemoryClient = class {
365
365
  result.totalCharacters += descriptions.reduce((sum, d) => sum + d.description.length, 0);
366
366
  yield { schemaVersion: 1, type: "result", stage: "complete", ...result };
367
367
  } catch (err) {
368
- yield this.ingestErrorEvent(err, "enrichment");
368
+ yield this.ingestErrorEvent(err, "enrichment", result);
369
369
  }
370
370
  }
371
371
  /**
@@ -429,7 +429,7 @@ var MemoryClient = class {
429
429
  const { schemaVersion: _v, type: _t, stage: _s, message: _m, ...result } = event;
430
430
  return result;
431
431
  }
432
- ingestErrorEvent(error, stage) {
432
+ ingestErrorEvent(error, stage, partialResult) {
433
433
  const status = error instanceof MemoryServerError ? error.status : error instanceof Error && error.name === "AbortError" ? 499 : void 0;
434
434
  const message = error instanceof Error ? error.message : String(error);
435
435
  return {
@@ -438,7 +438,8 @@ var MemoryClient = class {
438
438
  stage,
439
439
  error: message,
440
440
  message,
441
- ...status != null ? { status, code: status } : {}
441
+ ...status != null ? { status, code: status } : {},
442
+ ...partialResult ? { partialResult } : {}
442
443
  };
443
444
  }
444
445
  /**
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MemoryClient
3
- } from "./chunk-W4LB326D.mjs";
3
+ } from "./chunk-DR7UBO3Y.mjs";
4
4
 
5
5
  // ../dashboard/src/aggregations/consolidation-analytics.ts
6
6
  function analyzeConsolidationLog(entries) {
@@ -11,8 +11,8 @@ import {
11
11
  toGraphologyFormat,
12
12
  transformGraphData,
13
13
  unreachableHealth
14
- } from "./chunk-K7JZXUBN.mjs";
15
- import "./chunk-W4LB326D.mjs";
14
+ } from "./chunk-ZEX65TA5.mjs";
15
+ import "./chunk-DR7UBO3Y.mjs";
16
16
  export {
17
17
  DashboardClient,
18
18
  Poller,
package/dist/index.d.ts CHANGED
@@ -614,6 +614,18 @@ interface IngestErrorEvent {
614
614
  message?: string;
615
615
  code?: string | number;
616
616
  status?: number;
617
+ /**
618
+ * Server's pre-enrichment {@link FileIngestResult}, present when the error
619
+ * fired during the SDK's enrichment phase (after the server already emitted
620
+ * a successful result and the file's chunks/entryIds are durably stored).
621
+ *
622
+ * Lets consumers persist the catalog entry id, per-chunk entry ids, and
623
+ * character/chunk counts before surfacing the error — so a 401 storm during
624
+ * entity extraction no longer loses the search-ready chunks. Absent for
625
+ * errors that happen before the server's terminal result (parsing/storing
626
+ * stage failures, transport errors, abort).
627
+ */
628
+ partialResult?: FileIngestResult;
617
629
  }
618
630
  type IngestEvent = IngestProgressEvent | IngestHeartbeatEvent | IngestResultEvent | IngestErrorEvent;
619
631
 
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  MemoryClient,
3
3
  MemoryServerError
4
- } from "./chunk-W4LB326D.mjs";
4
+ } from "./chunk-DR7UBO3Y.mjs";
5
5
 
6
6
  // ../shared/src/constants/defaults.ts
7
7
  var DEFAULTS = {
package/dist/react.mjs CHANGED
@@ -11,8 +11,8 @@ import {
11
11
  toGraphologyFormat,
12
12
  transformGraphData,
13
13
  unreachableHealth
14
- } from "./chunk-K7JZXUBN.mjs";
15
- import "./chunk-W4LB326D.mjs";
14
+ } from "./chunk-ZEX65TA5.mjs";
15
+ import "./chunk-DR7UBO3Y.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pyxmate/memory",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "description": "SDK for pyx-memory — Memory as a Service for AI agents",
6
6
  "license": "MIT",
@@ -210,7 +210,18 @@ for await (const event of memory.ingestFileEvents(pdfFile, { enrichment })) {
210
210
  console.log(`[${event.stage}] ${event.message ?? ''}`);
211
211
  continue;
212
212
  }
213
- if (event.type === 'error') throw new Error(event.message ?? event.error);
213
+ if (event.type === 'error') {
214
+ // Enrichment-stage errors (e.g. extractEntitiesV2 throws on a 401 storm)
215
+ // carry the server's pre-enrichment FileIngestResult under
216
+ // `partialResult` — the chunks/entryIds/catalog are durably stored.
217
+ // Persist them BEFORE surfacing the error so vector retrieval keeps
218
+ // working on the file. Parsing/storing/transport errors do not set it.
219
+ if (event.partialResult) {
220
+ result = event.partialResult;
221
+ // surface a "partial" status to the user, then throw to mark failure
222
+ }
223
+ throw new Error(event.message ?? event.error);
224
+ }
214
225
  if (event.type === 'result') {
215
226
  const { schemaVersion: _v, type: _t, stage: _s, message: _m, ...payload } = event;
216
227
  result = payload;