@juspay/neurolink 13.12.2 → 13.12.3

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.
@@ -35,8 +35,15 @@ export declare class MCPCircuitBreaker extends EventEmitter {
35
35
  * the call is still counted as a normal, non-throwing success from the
36
36
  * `Promise.race` below, so this callback is what tells `execute()`
37
37
  * otherwise. Callers that never call it see no behavior change.
38
- */
39
- execute<T>(operation: (recordResolvedFailure: (reason?: string) => void) => Promise<T>): Promise<T>;
38
+ *
39
+ * `options.isCancelled` is consulted when `operation` throws: if it returns
40
+ * true the caller withdrew the request (e.g. an aborted signal), which says
41
+ * nothing about the downstream's health, so the error is rethrown without
42
+ * being recorded as a failure.
43
+ */
44
+ execute<T>(operation: (recordResolvedFailure: (reason?: string) => void) => Promise<T>, options?: {
45
+ isCancelled?: () => boolean;
46
+ }): Promise<T>;
40
47
  /**
41
48
  * Shared bookkeeping for a failed outcome — a thrown error, or a resolved
42
49
  * result the caller flagged via `recordResolvedFailure`. Records the call
@@ -67,8 +67,13 @@ export class MCPCircuitBreaker extends EventEmitter {
67
67
  * the call is still counted as a normal, non-throwing success from the
68
68
  * `Promise.race` below, so this callback is what tells `execute()`
69
69
  * otherwise. Callers that never call it see no behavior change.
70
+ *
71
+ * `options.isCancelled` is consulted when `operation` throws: if it returns
72
+ * true the caller withdrew the request (e.g. an aborted signal), which says
73
+ * nothing about the downstream's health, so the error is rethrown without
74
+ * being recorded as a failure.
70
75
  */
71
- async execute(operation) {
76
+ async execute(operation, options) {
72
77
  const startTime = Date.now();
73
78
  try {
74
79
  // Check if circuit is open
@@ -144,6 +149,9 @@ export class MCPCircuitBreaker extends EventEmitter {
144
149
  return result;
145
150
  }
146
151
  catch (error) {
152
+ if (options?.isCancelled?.()) {
153
+ throw error;
154
+ }
147
155
  // Record failed call
148
156
  const duration = Date.now() - startTime;
149
157
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -546,7 +546,9 @@ export class ToolDiscoveryService extends EventEmitter {
546
546
  callSpan.end();
547
547
  }
548
548
  });
549
- });
549
+ },
550
+ // A caller-cancelled call says nothing about the tool's health.
551
+ { isCancelled: () => options.signal?.aborted === true });
550
552
  const duration = Date.now() - startTime;
551
553
  // Update tool statistics. A resolved isError result is a failed call
552
554
  // for completion telemetry purposes even though the wrapper below
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "13.12.2",
3
+ "version": "13.12.3",
4
4
  "packageManager": "pnpm@10.34.9+sha512.f49b5a8ea0fdedb44bb3c0c1d6575092a53c2950d95b7ad15df11f17974877a2de3a01c07e934e9b28ce716e51c09a94962c7306d09be2e1e4b18a8c8762fd32",
5
5
  "description": "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/call) for routing, tool selection and context budgeting. MCP-native (4 transports), voice TTS/STT/realtime, RAG, agents, memory, compaction, 9 observability exporters. OpenAI · Anthropic · Gemini · Bedrock · Azure · Ollama · TypeSafe Jev and more.",
6
6
  "author": {