@juspay/neurolink 13.13.5 → 13.13.6
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/dist/hitl/hitlManager.js
CHANGED
|
@@ -13,6 +13,20 @@ import { logger } from "../utils/logger.js";
|
|
|
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
15
|
export const DEFAULT_ALLOW_MODIFICATION = false;
|
|
16
|
+
// Record<keyof HITLConfig, true> makes adding a HITLConfig key without listing it here a compile error
|
|
17
|
+
const KNOWN_CONFIG_KEYS = new Set(Object.keys({
|
|
18
|
+
enabled: true,
|
|
19
|
+
dangerousActions: true,
|
|
20
|
+
timeout: true,
|
|
21
|
+
confirmationMethod: true,
|
|
22
|
+
allowArgumentModification: true,
|
|
23
|
+
autoApproveOnTimeout: true,
|
|
24
|
+
autoApproveExclusions: true,
|
|
25
|
+
auditLogging: true,
|
|
26
|
+
customRules: true,
|
|
27
|
+
confirmBuiltinTools: true,
|
|
28
|
+
confirmDirectToolCalls: true,
|
|
29
|
+
}));
|
|
16
30
|
/** The abort reason as text for `hitl:cancelled`, whatever the caller passed. */
|
|
17
31
|
export function describeAbortReason(signal) {
|
|
18
32
|
const reason = signal.reason;
|
|
@@ -53,10 +67,19 @@ export class HITLManager extends EventEmitter {
|
|
|
53
67
|
this.config = this.validateConfig(config);
|
|
54
68
|
this.setupEventHandlers();
|
|
55
69
|
}
|
|
70
|
+
warnedUnknownKeys = new Set();
|
|
56
71
|
/**
|
|
57
72
|
* Validate HITL configuration and apply defaults
|
|
58
73
|
*/
|
|
59
74
|
validateConfig(config) {
|
|
75
|
+
// Warn only: throwing here would break callers that pass planned-but-unsupported keys today.
|
|
76
|
+
// alwaysStderr, not logger.warn: warn is hidden unless NEUROLINK_DEBUG is set, and a typo'd key silently disables approval gates.
|
|
77
|
+
for (const key of Object.keys(config)) {
|
|
78
|
+
if (!KNOWN_CONFIG_KEYS.has(key) && !this.warnedUnknownKeys.has(key)) {
|
|
79
|
+
this.warnedUnknownKeys.add(key);
|
|
80
|
+
logger.alwaysStderr(`[HITL] Unknown config key "${key}" is ignored and has no effect. Supported keys: ${[...KNOWN_CONFIG_KEYS].join(", ")}. See docs/features/enterprise-hitl.md`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
60
83
|
// Apply defaults for optional fields
|
|
61
84
|
const configWithDefaults = {
|
|
62
85
|
enabled: config.enabled,
|
|
@@ -2885,8 +2885,8 @@
|
|
|
2885
2885
|
{"objectID":"0de66cb24e860808d3967922706cb8f4c543cf24b9aa150e96a8b7d48788793f","title":"Environment Variables","url":"/docs/features/embeddings#environment-variables","content":"| Variable | Provider(s) | Description |\n| --------------------------- | ------------------------------- | ----------------------------------------------------------------------- |\n| OPENAI_EMBEDDING_MODEL | OpenAI | Override OpenAI default embedding model |\n| GOOGLE_AI_EMBEDDING_MODEL | Google AI Studio | Override AI Studio default embedding model |\n| VERTEX_EMBEDDING_MODEL | Google Vertex | Override Vertex default embedding model (default: text-embedding-004) |\n| GOOGLE_EMBEDDING_MODEL | Google AI Studio, Google Vertex | Shared fallback for Google providers |\n| BEDROCK_EMBEDDING_MODEL | Amazon Bedrock | Override Bedrock default embedding model |\n| AWS_EMBEDDING_MODEL | Amazon Bedrock | Alternative Bedrock env var |\n| VOYAGE_MODEL | Voyage | Override the provider's default embedding model |\n| JINA_MODEL | Jina | Override the provider's default embedding model |\n| OLLAMA_EMBEDDING_MODEL | Ollama | Locally available embedding model |\n| LITELLM_EMBEDDING_MODEL | LiteLLM | Embedding model or deployment served by the gateway |\n| NEUROLINK_EMBEDDING_MODEL | All (CLI RAG only) | Global override for RAG CLI commands |","hierarchy":{"lvl0":"Features","lvl1":"Embeddings","lvl2":"Environment Variables","lvl3":""}},
|
|
2886
2886
|
{"objectID":"2aeebbce7d7d32d83443815b6e956d40b7482158a0ad88582503606c264d8f69","title":"Key Files","url":"/docs/features/embeddings#key-files","content":"| File | Purpose |\n| -------------------------------------- | ------------------------------------------------------------------------------ |\n| src/lib/core/baseProvider.ts | Default embed() / embedMany() stubs |\n| src/lib/providers/openAI.ts | OpenAI embedding implementation |\n| src/lib/providers/googleAiStudio.ts | Google AI Studio embedding implementation |\n| src/lib/providers/googleVertex.ts | Google Vertex embedding implementation |\n| src/lib/providers/amazonBedrock.ts | Amazon Bedrock embedding implementation |\n| src/lib/server/routes/agentRoutes.ts | Server /embed and /embed-many routes |\n| src/lib/server/utils/validation.ts | EmbedRequestSchema, EmbedManyRequestSchema |\n| src/lib/server/types.ts | EmbedRequest, EmbedResponse, EmbedManyRequest, EmbedManyResponse types |\n| src/lib/types/providers.ts | AIProvider type with embedding methods |","hierarchy":{"lvl0":"Features","lvl1":"Embeddings","lvl2":"Key Files","lvl3":""}},
|
|
2887
2887
|
{"objectID":"7dc8cee91fc8da6885116ce742319dbaced7f61b1a073493131e7bcf566e43e7","title":"See Also","url":"/docs/features/embeddings#see-also","content":"RAG Document Processing Guide -- end-to-end RAG pipelines using embeddings\nSDK API Reference -- SDK API reference","hierarchy":{"lvl0":"Features","lvl1":"Embeddings","lvl2":"See Also","lvl3":""}},
|
|
2888
|
-
{"objectID":"d4f8720f9bb7fb3901fbd2263aabda49347af9cc64470e2596d0e244f6e21b71","title":"Enterprise Human-in-the-Loop System","url":"/docs/features/enterprise-hitl","content":"Enterprise Human-in-the-Loop System\n\nSince: v7.39.0 | Availability: SDK\n\nTreat every code sample below as the target API unless it appears in\n\"Currently available\" immediately after this box. A heading marked\n(Planned) has examples that use configuration keys or behaviour that do not\nexist, and (Planned) is not a promise of a date. The sections under \"Quick\nStart (5 Minutes)\" are covered by that heading's own label.\n\nNone of requireApproval, reviewCallback, statusCallback, mode,\nconfidenceThreshold, contentPatterns, escalationPolicy or the object form\nof auditLog exists in src/lib/types/hitl.ts or is handled by\nsrc/lib/hitl/hitlManager.ts. validateConfig does not reject unknown keys
|
|
2889
|
-
{"objectID":"f657e6a12a41f2e3e4154c625d37316b34b2b05fd8733d2319733d4f25707890","title":"Enterprise Human-in-the-Loop System","url":"/docs/features/enterprise-hitl#enterprise-human-in-the-loop-system","content":"Since: v7.39.0 | Availability: SDK\n\nTreat every code sample below as the target API unless it appears in\n\"Currently available\" immediately after this box. A heading marked\n(Planned) has examples that use configuration keys or behaviour that do not\nexist, and (Planned) is not a promise of a date. The sections under \"Quick\nStart (5 Minutes)\" are covered by that heading's own label.\n\nNone of requireApproval, reviewCallback, statusCallback, mode,\nconfidenceThreshold, contentPatterns, escalationPolicy or the object form\nof auditLog exists in src/lib/types/hitl.ts or is handled by\nsrc/lib/hitl/hitlManager.ts. validateConfig does not reject unknown keys
|
|
2888
|
+
{"objectID":"d4f8720f9bb7fb3901fbd2263aabda49347af9cc64470e2596d0e244f6e21b71","title":"Enterprise Human-in-the-Loop System","url":"/docs/features/enterprise-hitl","content":"Enterprise Human-in-the-Loop System\n\nSince: v7.39.0 | Availability: SDK\n\nTreat every code sample below as the target API unless it appears in\n\"Currently available\" immediately after this box. A heading marked\n(Planned) has examples that use configuration keys or behaviour that do not\nexist, and (Planned) is not a promise of a date. The sections under \"Quick\nStart (5 Minutes)\" are covered by that heading's own label.\n\nNone of requireApproval, reviewCallback, statusCallback, mode,\nconfidenceThreshold, contentPatterns, escalationPolicy or the object form\nof auditLog exists in src/lib/types/hitl.ts or is handled by\nsrc/lib/hitl/hitlManager.ts. validateConfig does not reject unknown keys:\na config copied from this page is accepted, every one of those keys is dropped,\nand the approval gates never fire. It writes one line per unknown key to stderr,\nvisible by default and without NEUROLINK_DEBUG\n([HITL] Unknown config key \"requireApproval\" is ignored ...), but does not\nthrow, so watch stderr when adapting an example.\n\nThat includes the compliance sections. The HIPAA / SOC2 / GDPR examples show an\nauditLog storage backend and an escalationPolicy that do not exist; do not\ncite them as evidence of a control.\n\nTracking: #752.\n\nCurrently available\n\nHITLConfig has exactly these eleven keys (see src/lib/types/hitl.ts).\nAnything else on this page is not implemented.\n\ndangerousActions is required whenever enabled is true; omitting it throws\nHITLConfigurationError from the NeuroLink constructor. auditLogging writes\neach request and decision to the NeuroLink logger at info level. Entries include\nthe full tool arguments, so redact secrets and personal data at the logger sink.\nallowArgumentModification is copied into the request event as\nallowModification for your approval UI; NeuroLink does not enforce it, and a\nhitl:confirmation-response that carries modifiedArguments is applied\neither way, so forward only the arguments you accept. The\nhitl:audit event is emitted on the internal HITLManager, and NeuroLink\nforwards only hitl:confirmation-request, hitl:timeout and\nhitl:cancelled to getEventEmitter(); listen for hitl:cancelled to retire\na card that was withdrawn.\n\nconfirmBuiltinTools (default true) applies only while enabled is true.\nWith it on, the built-in writeFile and executeBashCommand tools need\nconfirmation on every call the model makes during generate() or stream(),\nwhether or not dangerousActions matches them. Setting it to false removes\nonly that built-in rule: those tools are then gated like any other tool, so a\ndangerousActions keyword or a customRules match still requires approval.\nA direct neurolink.executeTool(\"writeFile\", ...) call is checked against\ndangerousActions and customRules only, not against this rule, unless the\nhost opts in with confirmDirectToolCalls: true (default false). With it on,\na direct call to writeFile or executeBashCommand (also as\ndirect.writeFile) needs confirmation like a model's call, and\nconfirmBuiltinTools: false removes that rule for direct calls too. A custom\nor external tool that reuses a built-in's name is never swept in. With HITL\ndisabled, no tool asks for confirmation.\n\nApproval is event-based, through the SDK emitter — there is no\nreviewCallback. The emitter is reached with getEventEmitter(); NeuroLink\ndoes not extend EventEmitter, so neurolink.on(...) and neurolink.emit(...)\ndo not exist:\n\nThis is the shape exercised by test/continuous-test-suite-hitl.ts. For\nproduction use today, refer to the Basic HITL Guide.\n\nExecutive Summary\n\nThis section describes the system the rest of this page is a design for. Today NeuroLink ships event-based tool approval and a log of each request and decision (see \"Currently available\"). It does not ship escalation, asynchronous review or an audit store, and it holds no HIPAA, SOC2 or GDPR certification or control.\n\nStrategic Value Proposition\nRisk Mitigation: Prevent costly AI mistakes through mandatory human checkpoints\nRegulatory Compliance (target): Produce the review records regulated industries ask for. Today auditLogging only writes a log line; compliance is the deployer's responsibility\nTrust & Transparency: Build stakeholder confidence with auditable AI decisions\nContinuous Improvement: Capture human expertise to improve AI accuracy over time\n\nWhen to Use HITL\n\nRequired for:\nMedical diagnosis and treatment recommendations\nFinancial transactions above risk thresholds\nLegal document generation and review\nCode execution in production environments\nPersonal data modification or deletion\nIrreversible operations (send email, post to social media)\n\nNot recommended for:\nRead-only operations (information retrieval)\nLow-stakes content generation\nDevelopment/testing environments\nHigh-volume, low-risk automation\n\nQuick Start (5 Minutes) — target API, not implemented\n\nThe configuration in this section is not implemented. Use\n\"Currently available\" above for a setup that works.\n\nInstallation\n\nHITL is built into NeuroLink SDK v7.39.0+. No additional packag","hierarchy":{"lvl0":"Features","lvl1":"Enterprise Human-in-the-Loop System","lvl2":"","lvl3":""}},
|
|
2889
|
+
{"objectID":"f657e6a12a41f2e3e4154c625d37316b34b2b05fd8733d2319733d4f25707890","title":"Enterprise Human-in-the-Loop System","url":"/docs/features/enterprise-hitl#enterprise-human-in-the-loop-system","content":"Since: v7.39.0 | Availability: SDK\n\nTreat every code sample below as the target API unless it appears in\n\"Currently available\" immediately after this box. A heading marked\n(Planned) has examples that use configuration keys or behaviour that do not\nexist, and (Planned) is not a promise of a date. The sections under \"Quick\nStart (5 Minutes)\" are covered by that heading's own label.\n\nNone of requireApproval, reviewCallback, statusCallback, mode,\nconfidenceThreshold, contentPatterns, escalationPolicy or the object form\nof auditLog exists in src/lib/types/hitl.ts or is handled by\nsrc/lib/hitl/hitlManager.ts. validateConfig does not reject unknown keys:\na config copied from this page is accepted, every one of those keys is dropped,\nand the approval gates never fire. It writes one line per unknown key to stderr,\nvisible by default and without NEUROLINK_DEBUG\n([HITL] Unknown config key \"requireApproval\" is ignored ...), but does not\nthrow, so watch stderr when adapting an example.\n\nThat includes the compliance sections. The HIPAA / SOC2 / GDPR examples show an\nauditLog storage backend and an escalationPolicy that do not exist; do not\ncite them as evidence of a control.\n\nTracking: #752.","hierarchy":{"lvl0":"Features","lvl1":"Enterprise Human-in-the-Loop System","lvl2":"Enterprise Human-in-the-Loop System","lvl3":""}},
|
|
2890
2890
|
{"objectID":"3e51c59f3c7b66d5d0827896808bc094566b2e937ca0e197111d8c4f73b8ea59","title":"Currently available","url":"/docs/features/enterprise-hitl#currently-available","content":"HITLConfig has exactly these eleven keys (see src/lib/types/hitl.ts).\nAnything else on this page is not implemented.\n\ndangerousActions is required whenever enabled is true; omitting it throws\nHITLConfigurationError from the NeuroLink constructor. auditLogging writes\neach request and decision to the NeuroLink logger at info level. Entries include\nthe full tool arguments, so redact secrets and personal data at the logger sink.\nallowArgumentModification is copied into the request event as\nallowModification for your approval UI; NeuroLink does not enforce it, and a\nhitl:confirmation-response that carries modifiedArguments is applied\neither way, so forward only the arguments you accept. The\nhitl:audit event is emitted on the internal HITLManager, and NeuroLink\nforwards only hitl:confirmation-request, hitl:timeout and\nhitl:cancelled to getEventEmitter(); listen for hitl:cancelled to retire\na card that was withdrawn.\n\nconfirmBuiltinTools (default true) applies only while enabled is true.\nWith it on, the built-in writeFile and executeBashCommand tools need\nconfirmation on every call the model makes during generate() or stream(),\nwhether or not dangerousActions matches them. Setting it to false removes\nonly that built-in rule: those tools are then gated like any other tool, so a\ndangerousActions keyword or a customRules match still requires approval.\nA direct neurolink.executeTool(\"writeFile\", ...) call is checked against\ndangerousActions and customRules only, not against this rule, unless the\nhost opts in with confirmDirectToolCalls: true (default false). With it on,\na direct call to writeFile or executeBashCommand (also as\ndirect.writeFile) needs confirmation like a model's call, and\nconfirmBuiltinTools: false removes that rule for direct calls too. A custom\nor external tool that reuses a built-in's name is never swept in. With HITL\ndisabled, no tool asks for confirmation.\n\nApproval is event-based, through the SDK emitter — there is no\nreviewCallback.","hierarchy":{"lvl0":"Features","lvl1":"Enterprise Human-in-the-Loop System","lvl2":"Currently available","lvl3":""}},
|
|
2891
2891
|
{"objectID":"cdc9943cec3f7205dd828f820d0811c083a184041806fdec1ab59f96190d9520","title":"Executive Summary","url":"/docs/features/enterprise-hitl#executive-summary","content":"This section describes the system the rest of this page is a design for. Today NeuroLink ships event-based tool approval and a log of each request and decision (see \"Currently available\"). It does not ship escalation, asynchronous review or an audit store, and it holds no HIPAA, SOC2 or GDPR certification or control.","hierarchy":{"lvl0":"Features","lvl1":"Enterprise Human-in-the-Loop System","lvl2":"Executive Summary","lvl3":""}},
|
|
2892
2892
|
{"objectID":"93c851f60f7be9ce5fa8ad235b8ff9c30bc02df6b697a3d8067c863c0a09c316","title":"Strategic Value Proposition","url":"/docs/features/enterprise-hitl#strategic-value-proposition","content":"Risk Mitigation: Prevent costly AI mistakes through mandatory human checkpoints\nRegulatory Compliance (target): Produce the review records regulated industries ask for. Today auditLogging only writes a log line; compliance is the deployer's responsibility\nTrust & Transparency: Build stakeholder confidence with auditable AI decisions\nContinuous Improvement: Capture human expertise to improve AI accuracy over time","hierarchy":{"lvl0":"Features","lvl1":"Enterprise Human-in-the-Loop System","lvl2":"Strategic Value Proposition","lvl3":""}},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "13.13.
|
|
3
|
+
"version": "13.13.6",
|
|
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": {
|