xiaoshuai 8dc02b6b35 memory: distinguish a failed extraction from an empty one
Probing the extraction path with a real model call showed it returning a
zero-candidate outcome — indistinguishable from "the conversation had
nothing worth keeping". It was actually an auth failure delivered as a JSON
error body rather than a thrown error, which coerceText turned into an empty
string, which parseCandidates turned into an empty array.

extract() now reports `error` and a `rawText` preview instead of collapsing
every failure mode into `{candidates: []}`. An auth error arriving as a
return value rather than a throw is the common case, not the exotic one.

memory_inspect prints the error and the raw response, so this class of
failure now shows up instead of looking like a healthy extractor that
rarely fires.

Verified: thrown error, error object, empty string, and null each produce a
specific message; valid JSON and fenced JSON still parse.
2026-10-09 10:31:06 +08:00
S
Description
No description provided
382 KiB
Languages
TypeScript 100%