@juspay/neurolink 13.4.8 → 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.
- package/CHANGELOG.md +3 -3
- package/README.md +11 -2
- package/dist/browser/neurolink.min.js +281 -281
- package/dist/hitl/hitlManager.d.ts +1 -0
- package/dist/hitl/hitlManager.js +2 -1
- package/dist/neurolink.js +17 -6
- package/docs-site/static/search-index.json +79 -79
- package/package.json +1 -1
|
@@ -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
|
*
|
package/dist/hitl/hitlManager.js
CHANGED
|
@@ -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
|
-
|
|
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 {
|
|
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: {
|
|
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 ??
|
|
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 ??
|
|
1562
|
+
allowArgumentModification: config.hitl.allowArgumentModification ?? DEFAULT_ALLOW_MODIFICATION,
|
|
1552
1563
|
auditLogging: config.hitl.auditLogging ?? false,
|
|
1553
1564
|
});
|
|
1554
1565
|
}
|