UNPKG

@juspay/neurolink

Version:

The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002

27 lines (26 loc) • 1.44 kB
/** * Classification of a tool result that the loop received as a normal return * but that reports a failure in-band. * * `neurolink.executeTool` converts a thrown error and a circuit-breaker * refusal into `{ isError: true, content: [...] }`, MCP servers return the * same shape for a failed call, and the documented custom-tool pattern is * `return { error: "User not found" }`. Every consumer that decides "did this * tool succeed" — the `tool:end` event, the stored `tool_result` row, the * replayed marker, and `toolExecutions[].isError` — has to read those shapes * the same way, so the rule lives in ONE predicate, `isErrorShapedToolResult`, * and this module only extracts the text to report for it. */ /** * The error text carried by an error-shaped result (`isError: true`, an * `error` field, or a failing `status`), or undefined when the value is not * one. Prefers an `error` string, then a serialized non-string `error`, then * the joined text parts of an MCP `content` array, then a fixed fallback. */ export declare function extractIsErrorText(output: unknown): string | undefined; /** * Same classification for a serialized result: the memory stores keep * `tool_result.content` as a JSON string, so a row written before the store * learned to flag error shapes can still be recognised at replay. */ export declare function extractIsErrorTextFromContent(content: unknown): string | undefined;