@juspay/neurolink 13.4.9 → 13.4.10

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.
@@ -7,6 +7,7 @@
7
7
  */
8
8
  import { EventEmitter } from "events";
9
9
  import type { HITLConfig, ConfirmationResult, HITLStatistics } from "../types/index.js";
10
+ export declare const DEFAULT_ALLOW_MODIFICATION = false;
10
11
  /**
11
12
  * HITLManager - Central orchestrator for Human-in-the-Loop safety mechanisms
12
13
  *
@@ -11,7 +11,8 @@ import { HITLTimeoutError, HITLConfigurationError } from "./hitlErrors.js";
11
11
  import { logger } from "../utils/logger.js";
12
12
  // Default configuration constants
13
13
  const DEFAULT_TIMEOUT = 30000; // 30 seconds
14
- const DEFAULT_ALLOW_MODIFICATION = false;
14
+ // Shared with NeuroLink's HITL init logs so they report the policy applied here
15
+ export const DEFAULT_ALLOW_MODIFICATION = false;
15
16
  /**
16
17
  * HITLManager - Central orchestrator for Human-in-the-Loop safety mechanisms
17
18
  *
package/dist/neurolink.js CHANGED
@@ -44,7 +44,7 @@ import { ProviderFactory } from "./factories/providerFactory.js";
44
44
  import { ProviderRegistry } from "./factories/providerRegistry.js";
45
45
  import { FileReferenceRegistry } from "./files/fileReferenceRegistry.js";
46
46
  import { createFileTools } from "./files/fileTools.js";
47
- import { HITLManager } from "./hitl/hitlManager.js";
47
+ import { HITLManager, DEFAULT_ALLOW_MODIFICATION } from "./hitl/hitlManager.js";
48
48
  import { ToolCallBatcher } from "./mcp/batching/index.js";
49
49
  // MCP Enhancement modules - wired into core execution path
50
50
  import { ToolResultCache } from "./mcp/caching/index.js";
@@ -242,7 +242,10 @@ const MEMORY_WRITE_TIMEOUT_MS = 30_000;
242
242
  *
243
243
  * @example With HITL security
244
244
  * ```typescript
245
- * import type { ConfirmationRequestEvent } from '@juspay/neurolink';
245
+ * import type {
246
+ * ConfirmationRequestEvent,
247
+ * ConfirmationResponseEvent,
248
+ * } from '@juspay/neurolink';
246
249
  *
247
250
  * const neurolink = new NeuroLink({
248
251
  * hitl: {
@@ -255,12 +258,20 @@ const MEMORY_WRITE_TIMEOUT_MS = 30_000;
255
258
  * // Approval is event-based; answer each request with the matching id
256
259
  * const emitter = neurolink.getEventEmitter();
257
260
  * emitter.on('hitl:confirmation-request', async (event) => {
261
+ * const receivedAt = Date.now();
258
262
  * const { payload } = event as ConfirmationRequestEvent; // listeners are typed unknown
259
263
  * const approved = await askUser(payload); // your approval UI
260
264
  * emitter.emit('hitl:confirmation-response', {
261
265
  * type: 'hitl:confirmation-response',
262
- * payload: { confirmationId: payload.confirmationId, approved }
263
- * });
266
+ * payload: {
267
+ * confirmationId: payload.confirmationId,
268
+ * approved,
269
+ * metadata: {
270
+ * timestamp: new Date().toISOString(),
271
+ * responseTime: Date.now() - receivedAt // ms since the request arrived
272
+ * }
273
+ * }
274
+ * } satisfies ConfirmationResponseEvent);
264
275
  * });
265
276
  * ```
266
277
  *
@@ -1518,7 +1529,7 @@ export class NeuroLink {
1518
1529
  enabled: config.hitl.enabled,
1519
1530
  dangerousActions: config.hitl.dangerousActions || [],
1520
1531
  timeout: config.hitl.timeout || 30000,
1521
- allowArgumentModification: config.hitl.allowArgumentModification ?? true,
1532
+ allowArgumentModification: config.hitl.allowArgumentModification ?? DEFAULT_ALLOW_MODIFICATION,
1522
1533
  auditLogging: config.hitl.auditLogging ?? false,
1523
1534
  },
1524
1535
  message: "Starting HITL (Human-in-the-Loop) initialization",
@@ -1548,7 +1559,7 @@ export class NeuroLink {
1548
1559
  logger.info(`[NeuroLink] HITL safety features enabled`, {
1549
1560
  dangerousActions: config.hitl.dangerousActions?.length || 0,
1550
1561
  timeout: config.hitl.timeout || 30000,
1551
- allowArgumentModification: config.hitl.allowArgumentModification ?? true,
1562
+ allowArgumentModification: config.hitl.allowArgumentModification ?? DEFAULT_ALLOW_MODIFICATION,
1552
1563
  auditLogging: config.hitl.auditLogging ?? false,
1553
1564
  });
1554
1565
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "13.4.9",
3
+ "version": "13.4.10",
4
4
  "packageManager": "pnpm@10.15.1",
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": {