@juspay/neurolink 13.12.1 → 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.
- package/CHANGELOG.md +2 -5
- package/dist/agent/agentToolRegistrar.js +3 -1
- package/dist/browser/neurolink.min.js +467 -467
- package/dist/context/fileSummarizationService.js +2 -0
- package/dist/core/baseProvider.d.ts +2 -2
- package/dist/core/loopEngine.js +20 -8
- package/dist/core/modules/ToolsManager.d.ts +11 -33
- package/dist/core/modules/ToolsManager.js +71 -99
- package/dist/core/modules/Utilities.js +6 -1
- package/dist/core/toolExecutionGuards.js +79 -11
- package/dist/evaluation/ragasEvaluator.js +2 -0
- package/dist/evaluation/scorers/llm/baseLLMScorer.js +2 -0
- package/dist/hitl/hitlErrors.d.ts +8 -0
- package/dist/hitl/hitlErrors.js +12 -0
- package/dist/hitl/hitlManager.d.ts +25 -7
- package/dist/hitl/hitlManager.js +133 -15
- package/dist/hitl/index.d.ts +1 -1
- package/dist/hitl/index.js +1 -1
- package/dist/hitl/toolCallConfirmation.d.ts +57 -0
- package/dist/hitl/toolCallConfirmation.js +296 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -1
- package/dist/mcp/externalServerManager.d.ts +33 -2
- package/dist/mcp/externalServerManager.js +68 -52
- package/dist/mcp/mcpCircuitBreaker.d.ts +9 -2
- package/dist/mcp/mcpCircuitBreaker.js +9 -1
- package/dist/mcp/toolDiscoveryService.js +11 -2
- package/dist/mcp/toolRegistry.d.ts +20 -0
- package/dist/mcp/toolRegistry.js +68 -58
- package/dist/middleware/utils/guardrailsUtils.js +2 -0
- package/dist/neurolink.d.ts +114 -2
- package/dist/neurolink.js +492 -71
- package/dist/providers/amazonBedrock/client.js +23 -4
- package/dist/providers/anthropic/client.js +5 -1
- package/dist/providers/googleNativeGemini3/utils.js +5 -1
- package/dist/providers/openaiChatCompletionsBase.js +21 -3
- package/dist/rag/metadata/metadataExtractor.js +2 -0
- package/dist/rag/pipeline/RAGPipeline.js +4 -0
- package/dist/rag/pipeline/contextAssembly.d.ts +1 -0
- package/dist/rag/pipeline/contextAssembly.js +2 -0
- package/dist/rag/reranker/reranker.js +4 -0
- package/dist/types/hitl.d.ts +100 -8
- package/dist/types/mcp.d.ts +5 -0
- package/dist/types/providers.d.ts +23 -2
- package/dist/types/tools.d.ts +34 -9
- package/dist/utils/async/index.d.ts +2 -1
- package/dist/utils/async/index.js +2 -1
- package/dist/utils/async/pausableDeadline.d.ts +28 -0
- package/dist/utils/async/pausableDeadline.js +88 -0
- package/dist/utils/async/withTimeout.d.ts +5 -0
- package/dist/utils/async/withTimeout.js +23 -0
- package/dist/utils/errorHandling.d.ts +32 -1
- package/dist/utils/errorHandling.js +70 -18
- package/dist/utils/providerUtils.js +5 -1
- package/dist/workflow/core/ensembleExecutor.js +2 -0
- package/dist/workflow/core/judgeScorer.js +2 -0
- package/dist/workflow/core/responseConditioner.js +2 -0
- package/docs-site/static/search-index.json +8 -6
- package/package.json +5 -1
|
@@ -61,6 +61,11 @@ export declare function withTimeout<T>(promise: Promise<T>, ms: number, message?
|
|
|
61
61
|
* is swallowed so it can never surface as an unhandled rejection.
|
|
62
62
|
*/
|
|
63
63
|
export declare function raceWithAbort<T>(promise: Promise<T>, signal: AbortSignal | undefined): Promise<T>;
|
|
64
|
+
/**
|
|
65
|
+
* The `abortSignal` in a tool's execute options (the AI SDK's second
|
|
66
|
+
* argument, which every model loop fills), or undefined when there is none.
|
|
67
|
+
*/
|
|
68
|
+
export declare function abortSignalOf(execOptions: unknown): AbortSignal | undefined;
|
|
64
69
|
/**
|
|
65
70
|
* Execute a function with timeout protection.
|
|
66
71
|
*
|
|
@@ -117,6 +117,29 @@ export async function raceWithAbort(promise, signal) {
|
|
|
117
117
|
});
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* The `abortSignal` in a tool's execute options (the AI SDK's second
|
|
122
|
+
* argument, which every model loop fills), or undefined when there is none.
|
|
123
|
+
*/
|
|
124
|
+
export function abortSignalOf(execOptions) {
|
|
125
|
+
if (typeof execOptions !== "object" ||
|
|
126
|
+
execOptions === null ||
|
|
127
|
+
!("abortSignal" in execOptions)) {
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
const { abortSignal } = execOptions;
|
|
131
|
+
return isAbortSignalLike(abortSignal) ? abortSignal : undefined;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Recognised by shape, as ToolsManager's abort race recognises one: a signal
|
|
135
|
+
* from another realm or a polyfill is not an `instanceof AbortSignal`.
|
|
136
|
+
*/
|
|
137
|
+
function isAbortSignalLike(value) {
|
|
138
|
+
return (typeof value === "object" &&
|
|
139
|
+
value !== null &&
|
|
140
|
+
"addEventListener" in value &&
|
|
141
|
+
typeof value.addEventListener === "function");
|
|
142
|
+
}
|
|
120
143
|
/**
|
|
121
144
|
* Execute a function with timeout protection.
|
|
122
145
|
*
|
|
@@ -394,7 +394,22 @@ export declare class CircuitBreaker {
|
|
|
394
394
|
private state;
|
|
395
395
|
private name;
|
|
396
396
|
constructor(failureThreshold?: number, resetTimeoutMs?: number, name?: string);
|
|
397
|
-
|
|
397
|
+
/**
|
|
398
|
+
* Run `operation` through the breaker. An outcome `options.isCancellation`
|
|
399
|
+
* accepts stays out of the count: a failure is rethrown without being
|
|
400
|
+
* counted, and a result is returned without resetting the count. The
|
|
401
|
+
* predicate gets the error on failure and nothing on success. A call its
|
|
402
|
+
* caller cancelled says nothing about the dependency's health.
|
|
403
|
+
*/
|
|
404
|
+
execute<T>(operation: () => Promise<T>, options?: {
|
|
405
|
+
isCancellation?: (error?: unknown) => boolean;
|
|
406
|
+
}): Promise<T>;
|
|
407
|
+
/**
|
|
408
|
+
* Throw `CircuitBreakerOpenError` while the breaker is open and its reset
|
|
409
|
+
* timeout has not elapsed. Unlike `execute`, it never moves an elapsed
|
|
410
|
+
* breaker to half-open, so a caller can ask first without taking the probe.
|
|
411
|
+
*/
|
|
412
|
+
assertAvailable(): void;
|
|
398
413
|
private onSuccess;
|
|
399
414
|
private onFailure;
|
|
400
415
|
getState(): "closed" | "open" | "half-open";
|
|
@@ -410,6 +425,22 @@ export declare class CircuitBreaker {
|
|
|
410
425
|
* which destroys the exact message match.
|
|
411
426
|
*/
|
|
412
427
|
export declare function isAbortError(error: unknown): boolean;
|
|
428
|
+
/**
|
|
429
|
+
* Throw a typed, non-retriable abort error once `signal` has fired, so a call
|
|
430
|
+
* cancelled before it starts never runs. The signal's reason is kept when it
|
|
431
|
+
* is an Error (a loop's per-tool deadline names itself that way).
|
|
432
|
+
*/
|
|
433
|
+
export declare function throwIfSignalAborted(signal: AbortSignal | undefined): void;
|
|
434
|
+
/**
|
|
435
|
+
* Whether `signal` fired because a caller cancelled the call (its own signal,
|
|
436
|
+
* or the turn's abort), not because a deadline expired. A per-tool deadline
|
|
437
|
+
* (the loop engine's, the guard's, an attempt's) aborts with a reason named
|
|
438
|
+
* "TimeoutError", as `AbortSignal.timeout()`'s is too, and is evidence about
|
|
439
|
+
* the tool. Any other reason, including none, is a cancellation and is not:
|
|
440
|
+
* so a turn clock that aborts with no reason (the Vertex and AI Studio turn
|
|
441
|
+
* limits) counts as a cancellation.
|
|
442
|
+
*/
|
|
443
|
+
export declare function isCancelledByCaller(signal: AbortSignal | undefined): boolean;
|
|
413
444
|
/**
|
|
414
445
|
* Error handler that decides whether to retry based on error type
|
|
415
446
|
*/
|
|
@@ -6,7 +6,7 @@ import { ErrorCategory, ErrorSeverity } from "../constants/enums.js";
|
|
|
6
6
|
import { MAX_TIMER_MS } from "../constants/timeouts.js";
|
|
7
7
|
import { logger } from "./logger.js";
|
|
8
8
|
import { CircuitBreakerOpenError } from "../types/index.js";
|
|
9
|
-
import {
|
|
9
|
+
import { HITLError } from "../hitl/hitlErrors.js";
|
|
10
10
|
// Error codes for different scenarios
|
|
11
11
|
export const ERROR_CODES = {
|
|
12
12
|
// Tool errors
|
|
@@ -158,7 +158,9 @@ export class ErrorFactory {
|
|
|
158
158
|
message: `Tool '${toolName}' execution failed: ${originalError.message}`,
|
|
159
159
|
category: ErrorCategory.EXECUTION,
|
|
160
160
|
severity: ErrorSeverity.HIGH,
|
|
161
|
-
|
|
161
|
+
// A human's answer (or a withdrawn card) is final: retrying would raise
|
|
162
|
+
// a second card for a call that was already decided.
|
|
163
|
+
retriable: !(originalError instanceof HITLError),
|
|
162
164
|
originalError,
|
|
163
165
|
toolName,
|
|
164
166
|
serverId,
|
|
@@ -1155,30 +1157,52 @@ export class CircuitBreaker {
|
|
|
1155
1157
|
this.resetTimeoutMs = resetTimeoutMs;
|
|
1156
1158
|
this.name = name;
|
|
1157
1159
|
}
|
|
1158
|
-
|
|
1160
|
+
/**
|
|
1161
|
+
* Run `operation` through the breaker. An outcome `options.isCancellation`
|
|
1162
|
+
* accepts stays out of the count: a failure is rethrown without being
|
|
1163
|
+
* counted, and a result is returned without resetting the count. The
|
|
1164
|
+
* predicate gets the error on failure and nothing on success. A call its
|
|
1165
|
+
* caller cancelled says nothing about the dependency's health.
|
|
1166
|
+
*/
|
|
1167
|
+
async execute(operation, options) {
|
|
1159
1168
|
if (this.state === "open") {
|
|
1160
|
-
|
|
1161
|
-
if (retryAfterMs > 0) {
|
|
1162
|
-
throw new CircuitBreakerOpenError({
|
|
1163
|
-
breakerName: this.name,
|
|
1164
|
-
retryAfter: new Date(this.lastFailureTime + this.resetTimeoutMs),
|
|
1165
|
-
retryAfterMs,
|
|
1166
|
-
breakerState: "open",
|
|
1167
|
-
failureCount: this.failures,
|
|
1168
|
-
});
|
|
1169
|
-
}
|
|
1169
|
+
this.assertAvailable();
|
|
1170
1170
|
this.state = "half-open";
|
|
1171
1171
|
}
|
|
1172
1172
|
try {
|
|
1173
1173
|
const result = await operation();
|
|
1174
|
-
|
|
1174
|
+
if (!options?.isCancellation?.()) {
|
|
1175
|
+
this.onSuccess();
|
|
1176
|
+
}
|
|
1175
1177
|
return result;
|
|
1176
1178
|
}
|
|
1177
1179
|
catch (error) {
|
|
1178
|
-
|
|
1180
|
+
if (!options?.isCancellation?.(error)) {
|
|
1181
|
+
this.onFailure();
|
|
1182
|
+
}
|
|
1179
1183
|
throw error;
|
|
1180
1184
|
}
|
|
1181
1185
|
}
|
|
1186
|
+
/**
|
|
1187
|
+
* Throw `CircuitBreakerOpenError` while the breaker is open and its reset
|
|
1188
|
+
* timeout has not elapsed. Unlike `execute`, it never moves an elapsed
|
|
1189
|
+
* breaker to half-open, so a caller can ask first without taking the probe.
|
|
1190
|
+
*/
|
|
1191
|
+
assertAvailable() {
|
|
1192
|
+
if (this.state !== "open") {
|
|
1193
|
+
return;
|
|
1194
|
+
}
|
|
1195
|
+
const retryAfterMs = this.resetTimeoutMs - (Date.now() - this.lastFailureTime);
|
|
1196
|
+
if (retryAfterMs > 0) {
|
|
1197
|
+
throw new CircuitBreakerOpenError({
|
|
1198
|
+
breakerName: this.name,
|
|
1199
|
+
retryAfter: new Date(this.lastFailureTime + this.resetTimeoutMs),
|
|
1200
|
+
retryAfterMs,
|
|
1201
|
+
breakerState: "open",
|
|
1202
|
+
failureCount: this.failures,
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1182
1206
|
onSuccess() {
|
|
1183
1207
|
this.failures = 0;
|
|
1184
1208
|
this.state = "closed";
|
|
@@ -1230,16 +1254,44 @@ export function isAbortError(error) {
|
|
|
1230
1254
|
}
|
|
1231
1255
|
return false;
|
|
1232
1256
|
}
|
|
1257
|
+
/**
|
|
1258
|
+
* Throw a typed, non-retriable abort error once `signal` has fired, so a call
|
|
1259
|
+
* cancelled before it starts never runs. The signal's reason is kept when it
|
|
1260
|
+
* is an Error (a loop's per-tool deadline names itself that way).
|
|
1261
|
+
*/
|
|
1262
|
+
export function throwIfSignalAborted(signal) {
|
|
1263
|
+
if (signal?.aborted) {
|
|
1264
|
+
throw ErrorFactory.aborted(signal.reason instanceof Error ? signal.reason : undefined);
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
/**
|
|
1268
|
+
* Whether `signal` fired because a caller cancelled the call (its own signal,
|
|
1269
|
+
* or the turn's abort), not because a deadline expired. A per-tool deadline
|
|
1270
|
+
* (the loop engine's, the guard's, an attempt's) aborts with a reason named
|
|
1271
|
+
* "TimeoutError", as `AbortSignal.timeout()`'s is too, and is evidence about
|
|
1272
|
+
* the tool. Any other reason, including none, is a cancellation and is not:
|
|
1273
|
+
* so a turn clock that aborts with no reason (the Vertex and AI Studio turn
|
|
1274
|
+
* limits) counts as a cancellation.
|
|
1275
|
+
*/
|
|
1276
|
+
export function isCancelledByCaller(signal) {
|
|
1277
|
+
if (!signal?.aborted) {
|
|
1278
|
+
return false;
|
|
1279
|
+
}
|
|
1280
|
+
const reason = signal.reason;
|
|
1281
|
+
return !(reason instanceof Error && reason.name === "TimeoutError");
|
|
1282
|
+
}
|
|
1233
1283
|
/**
|
|
1234
1284
|
* Error handler that decides whether to retry based on error type
|
|
1235
1285
|
*/
|
|
1236
1286
|
export function isRetriableError(error) {
|
|
1287
|
+
// Denied, timed-out and cancelled confirmations are decisions, not faults:
|
|
1288
|
+
// a retry would ask again, or act without the approval that was withheld.
|
|
1289
|
+
if (error instanceof HITLError) {
|
|
1290
|
+
return false;
|
|
1291
|
+
}
|
|
1237
1292
|
if (error instanceof NeuroLinkError) {
|
|
1238
1293
|
return error.retriable;
|
|
1239
1294
|
}
|
|
1240
|
-
if (error instanceof HITLTimeoutError) {
|
|
1241
|
-
return false;
|
|
1242
|
-
}
|
|
1243
1295
|
// Check for common retriable error patterns
|
|
1244
1296
|
const retriablePatterns = [
|
|
1245
1297
|
/timeout/i,
|
|
@@ -85,7 +85,11 @@ async function isProviderAvailable(providerName) {
|
|
|
85
85
|
}
|
|
86
86
|
try {
|
|
87
87
|
const provider = await AIProviderFactory.createProvider(providerName);
|
|
88
|
-
await provider.generate({
|
|
88
|
+
await provider.generate({
|
|
89
|
+
prompt: "test",
|
|
90
|
+
maxTokens: 1,
|
|
91
|
+
disableTools: true,
|
|
92
|
+
});
|
|
89
93
|
return true;
|
|
90
94
|
}
|
|
91
95
|
catch {
|
|
@@ -139,6 +139,8 @@ async function executeModel(options, workflowDefaultSystemPrompt) {
|
|
|
139
139
|
temperature: model.temperature,
|
|
140
140
|
maxTokens: model.maxTokens,
|
|
141
141
|
abortSignal,
|
|
142
|
+
// An ensemble member answers in text; it is given no tools.
|
|
143
|
+
disableTools: true,
|
|
142
144
|
});
|
|
143
145
|
}, timeout, `Model ${model.provider}/${model.model} timed out after ${timeout}ms`);
|
|
144
146
|
const contentLen = result?.content?.length ?? 0;
|
|
@@ -142,6 +142,8 @@ async function executeSingleJudge(judge, responses, originalPrompt, systemPrompt
|
|
|
142
142
|
temperature: judge.temperature || 0.1,
|
|
143
143
|
maxTokens: judge.maxTokens || 2000,
|
|
144
144
|
timeout: timeout || judge.timeout || 10000,
|
|
145
|
+
// A judge scores text; it is given no tools.
|
|
146
|
+
disableTools: true,
|
|
145
147
|
});
|
|
146
148
|
// Parse judge response
|
|
147
149
|
const parsed = parseJudgeResponse(result?.content || "", responses, judge);
|
|
@@ -157,6 +157,8 @@ Output ONLY the synthesized response, nothing else.`;
|
|
|
157
157
|
temperature: config?.synthesisModel?.temperature || 0.3,
|
|
158
158
|
maxTokens: 2000,
|
|
159
159
|
timeout: 30000,
|
|
160
|
+
// Synthesis rewrites text; it is given no tools.
|
|
161
|
+
disableTools: true,
|
|
160
162
|
});
|
|
161
163
|
if (!result || !result.content) {
|
|
162
164
|
throw new Error("Synthesis model returned empty response");
|
|
@@ -3031,17 +3031,18 @@
|
|
|
3031
3031
|
{"objectID":"a7e9e7181f3c4e419e083e152c274ddaf929b0240ee057ece97504c909ccc8f2","title":"Best Practices","url":"/docs/features/guardrails#best-practices","content":"Name what you filter. The presets enable guardrails; your word list or filter model does the filtering.\nSet a default for every call you cannot audit. An instance or global default is applied even where a call site forgot middleware.\nPrefer specific terms or word-boundary patterns to short common words.\nTest with a real reply. Run a call that should be filtered and one that should not, and check both.\nTreat the model filter as best effort. It fails open and sees only text parts.","hierarchy":{"lvl0":"Features","lvl1":"Guardrails Middleware","lvl2":"Best Practices","lvl3":""}},
|
|
3032
3032
|
{"objectID":"8380babcbfc88033aac779943fa372013989ce1cd79ebbc9f1803af06cf2e27e","title":"Related Features","url":"/docs/features/guardrails#related-features","content":"HITL Workflows - User approval for risky actions\nMiddleware Architecture - How the middleware chain is built\nBuilt-in Middleware - Analytics, guardrails and auto-evaluation\nGuardrails AI Integration - Pre-call evaluation and MiddlewareFactory usage","hierarchy":{"lvl0":"Features","lvl1":"Guardrails Middleware","lvl2":"Related Features","lvl3":""}},
|
|
3033
3033
|
{"objectID":"4dcd9d3f7dd025aac5e11ee4820832266eed4420348ba5f439bac3b9035737ae","title":"Migration Notes","url":"/docs/features/guardrails#migration-notes","content":"Instance, global and environment defaults were added after guardrails were first released. They are optional: a call that passes its own middleware and sets no default behaves as it always did.","hierarchy":{"lvl0":"Features","lvl1":"Guardrails Middleware","lvl2":"Migration Notes","lvl3":""}},
|
|
3034
|
-
{"objectID":"4360e3d584ae161b59c6d6c3d6c7fe074f475883b020805602930215117fd0d7","title":"Human-in-the-Loop (HITL) Workflows","url":"/docs/features/hitl","content":"Human-in-the-Loop (HITL) Workflows\n\nSince: v7.39.0 | Status: Stable | Availability: SDK\n\nOverview\n\nWhat it does: HITL pauses AI tool execution to request explicit user approval before performing risky operations like deleting files, modifying databases, or making expensive API calls.\n\nWhy use it: Prevent costly mistakes and give users control over potentially dangerous AI actions. Think of it as an \"Are you sure?\" dialog for AI assistant operations.\n\nOnly use HITL for truly risky operations. Overusing confirmation prompts degrades user experience and can lead to \"confirmation fatigue\" where users approve actions without reading them.\n\nCommon use cases:\nFile deletion or modification operations\nDatabase write/delete operations\nExpensive third-party API calls\nIrreversible actions (sending emails, posting to social media)\nOperations accessing sensitive data\n\nQuick Start\n\nSDK Example\nTool identifier used by the AI to invoke this function\nDescribes tool purpose to the LLM for proper selection\nTriggers HITL checkpoint before execution\nActual implementation only runs after user approval\n\nHandling Confirmation in Your UI\n\nHITL uses an event-based workflow where the SDK emits confirmation requests and your app responds with user decisions.\nGet the event emitter - NeuroLink is not itself an emitter, so requests and responses both go through getEventEmitter()\nSubscribe to confirmation requests - NeuroLink emits one before running a tool that needs approval\nShow your confirmation UI with the tool name, arguments and remaining time\nReply on the same emitter, echoing the request's confirmationId so the response is matched to its request\nApproval decision determines if tool executes\nOptional: Handle cases where user doesn't respond in time\n\nConfiguration\n\n| Option | Type | Default | Required | Description |\n| ---------------------- | --------- | ------- | -------- | ------------------------------------ |\n| requiresConfirmation | boolean | false | No | Mark tool as requiring user approval |\n\nTool Registration\n\nHow It Works\n\nExecution Flow\nAI requests tool execution →
|
|
3034
|
+
{"objectID":"4360e3d584ae161b59c6d6c3d6c7fe074f475883b020805602930215117fd0d7","title":"Human-in-the-Loop (HITL) Workflows","url":"/docs/features/hitl","content":"Human-in-the-Loop (HITL) Workflows\n\nSince: v7.39.0 | Status: Stable | Availability: SDK\n\nOverview\n\nWhat it does: HITL pauses AI tool execution to request explicit user approval before performing risky operations like deleting files, modifying databases, or making expensive API calls.\n\nWhy use it: Prevent costly mistakes and give users control over potentially dangerous AI actions. Think of it as an \"Are you sure?\" dialog for AI assistant operations.\n\nOnly use HITL for truly risky operations. Overusing confirmation prompts degrades user experience and can lead to \"confirmation fatigue\" where users approve actions without reading them.\n\nCommon use cases:\nFile deletion or modification operations\nDatabase write/delete operations\nExpensive third-party API calls\nIrreversible actions (sending emails, posting to social media)\nOperations accessing sensitive data\n\nQuick Start\n\nSDK Example\nTool identifier used by the AI to invoke this function\nDescribes tool purpose to the LLM for proper selection\nTriggers HITL checkpoint before execution\nActual implementation only runs after user approval\n\nHandling Confirmation in Your UI\n\nHITL uses an event-based workflow where the SDK emits confirmation requests and your app responds with user decisions.\nGet the event emitter - NeuroLink is not itself an emitter, so requests and responses both go through getEventEmitter()\nSubscribe to confirmation requests - NeuroLink emits one before running a tool that needs approval\nShow your confirmation UI with the tool name, arguments and remaining time\nReply on the same emitter, echoing the request's confirmationId so the response is matched to its request\nApproval decision determines if tool executes\nOptional: Handle cases where user doesn't respond in time\n\nConfiguration\n\n| Option | Type | Default | Required | Description |\n| ---------------------- | --------- | ------- | -------- | ------------------------------------ |\n| requiresConfirmation | boolean | false | No | Mark tool as requiring user approval |\n\nTool Registration\n\nHow It Works\n\nExecution Flow\nAI requests tool execution → The tool gateway checks whether the tool requires confirmation\nConfirmation required? → The call pauses and hitl:confirmation-request is emitted; the tool does not run yet and the model is not asked to retry\nYour approval UI responds by emitting hitl:confirmation-response with the confirmationId:\nApprove → the paused call resumes and runs (optionally with modifiedArguments); the approval covers that one call, so a retry of a failed or timed-out attempt runs the tool again without a new approval\nDeny → the call returns a refusal to the model and the tool never runs\nNo answer → the confirmation times out (a refusal, unless auto-approve on timeout is configured)\nCancelled → aborting the call's abortSignal withdraws the pending confirmation and emits hitl:cancelled\nTool executes → Each approval covers exactly one call, including its retries; the next call asks again\n\nSecurity Features\nOne-time permissions: Each approval works for exactly one action\nNo reuse: AI cannot reuse old permissions for new actions\nAutomatic reset: Permission flag clears immediately after use\nFail-safe: Defaults to requiring permission when in doubt\n\nBuilt-in tools\n\nHITL applies to the built-in tools (readFile, writeFile, listDirectory,\nanalyzeCSV, calculateMath, getCurrentTime, websearchGrounding and the\nopt-in executeBashCommand) exactly as it applies to tools you register:\ndangerousActions keywords and customRules are matched against the tool\nname on every model-driven call. Before the 2026-10 security audit fix (finding\nC3) built-in tools bypassed HITL entirely — only tools executed through the\ntool registry were gated — so a\nprompt-injected model could write files or, with the bash tool enabled, run\nshell commands with no confirmation, while the bash tool's own description\nclaimed otherwise.\n\nTwo built-ins change the machine and are confirmed on every call while HITL\nis enabled, whatever dangerousActions lists: writeFile and\nexecuteBashCommand. To gate them by keywords only, like every other tool,\nset confirmBuiltinTools: false:\n\nA denied built-in call is reported to the model as a failed tool call\n(Built-in tool execution rejected by user: <reason>); the model sees the denial and\ncan continue without the side effect. A confirmation that returns\nmodifiedArguments runs the tool with those arguments. The confirmation\nrequest carries serverId: \"direct\" for a built-in tool.\n\nPer-call tools passed through generate({ tools }) are the host's own code\nand are not gated by HITL; wrap their execute yourself if they need it.\n\nAPI Reference\n\nEvent Types\n\nAll HITL events ride the SDK emitter returned by\nneurolink.getEventEmitter(); emitter below is that object.\n\nConfirmation Request Event (hitl:confirmation-request):\n\nConfirmation Response (emit from your app):\n\nTimeout Event (hitl:timeout):\n\nCancelled Event (hitl:cancelled): a pending confirmation","hierarchy":{"lvl0":"Features","lvl1":"Human-in-the-Loop (HITL) Workflows","lvl2":"","lvl3":""}},
|
|
3035
3035
|
{"objectID":"d85931f065438b4475cf5fc7e7854d68dda75d45b96963229ea7accb7f456a86","title":"Human-in-the-Loop (HITL) Workflows","url":"/docs/features/hitl#human-in-the-loop-hitl-workflows","content":"Since: v7.39.0 | Status: Stable | Availability: SDK","hierarchy":{"lvl0":"Features","lvl1":"Human-in-the-Loop (HITL) Workflows","lvl2":"Human-in-the-Loop (HITL) Workflows","lvl3":""}},
|
|
3036
3036
|
{"objectID":"f1d18bf2b10a871a2c1ba24625cfdba4ced0186612c32e21ff05afa4d8c614b5","title":"Overview","url":"/docs/features/hitl#overview","content":"What it does: HITL pauses AI tool execution to request explicit user approval before performing risky operations like deleting files, modifying databases, or making expensive API calls.\n\nWhy use it: Prevent costly mistakes and give users control over potentially dangerous AI actions. Think of it as an \"Are you sure?\" dialog for AI assistant operations.\n\nOnly use HITL for truly risky operations. Overusing confirmation prompts degrades user experience and can lead to \"confirmation fatigue\" where users approve actions without reading them.\n\nCommon use cases:\nFile deletion or modification operations\nDatabase write/delete operations\nExpensive third-party API calls\nIrreversible actions (sending emails, posting to social media)\nOperations accessing sensitive data","hierarchy":{"lvl0":"Features","lvl1":"Human-in-the-Loop (HITL) Workflows","lvl2":"Overview","lvl3":""}},
|
|
3037
3037
|
{"objectID":"654bf9d17ad9d1c9c4e13211c1207ecfc732fcf0ed9da7d530dab91fec0ae1fb","title":"SDK Example","url":"/docs/features/hitl#sdk-example","content":"Tool identifier used by the AI to invoke this function\nDescribes tool purpose to the LLM for proper selection\nTriggers HITL checkpoint before execution\nActual implementation only runs after user approval","hierarchy":{"lvl0":"Features","lvl1":"Human-in-the-Loop (HITL) Workflows","lvl2":"SDK Example","lvl3":""}},
|
|
3038
3038
|
{"objectID":"1e29a4eee109d73351f520b984638449a5eb5c4bb0f8e98fdd43c546c0c3ed63","title":"Handling Confirmation in Your UI","url":"/docs/features/hitl#handling-confirmation-in-your-ui","content":"HITL uses an event-based workflow where the SDK emits confirmation requests and your app responds with user decisions.\nGet the event emitter - NeuroLink is not itself an emitter, so requests and responses both go through getEventEmitter()\nSubscribe to confirmation requests - NeuroLink emits one before running a tool that needs approval\nShow your confirmation UI with the tool name, arguments and remaining time\nReply on the same emitter, echoing the request's confirmationId so the response is matched to its request\nApproval decision determines if tool executes\nOptional: Handle cases where user doesn't respond in time","hierarchy":{"lvl0":"Features","lvl1":"Human-in-the-Loop (HITL) Workflows","lvl2":"Handling Confirmation in Your UI","lvl3":""}},
|
|
3039
3039
|
{"objectID":"0b97c36d119e891d3b7aa500e15ca7ddfbc614d26e2aa8c41888527fc578f0b1","title":"Configuration","url":"/docs/features/hitl#configuration","content":"| Option | Type | Default | Required | Description |\n| ---------------------- | --------- | ------- | -------- | ------------------------------------ |\n| requiresConfirmation | boolean | false | No | Mark tool as requiring user approval |","hierarchy":{"lvl0":"Features","lvl1":"Human-in-the-Loop (HITL) Workflows","lvl2":"Configuration","lvl3":""}},
|
|
3040
3040
|
{"objectID":"b60ffa2075bb3cd92fa381b95c086d4fcf0763098c18a2e86a4b846820bfdc2f","title":"Tool Registration","url":"/docs/features/hitl#tool-registration","content":"Tool Registration","hierarchy":{"lvl0":"Features","lvl1":"Human-in-the-Loop (HITL) Workflows","lvl2":"Tool Registration","lvl3":""}},
|
|
3041
|
-
{"objectID":"37135c25fca844145fb9e99bf6c00ce7aa59e5fce15d32037ecec0c212da1fe2","title":"Execution Flow","url":"/docs/features/hitl#execution-flow","content":"AI requests tool execution →
|
|
3041
|
+
{"objectID":"37135c25fca844145fb9e99bf6c00ce7aa59e5fce15d32037ecec0c212da1fe2","title":"Execution Flow","url":"/docs/features/hitl#execution-flow","content":"AI requests tool execution → The tool gateway checks whether the tool requires confirmation\nConfirmation required? → The call pauses and hitl:confirmation-request is emitted; the tool does not run yet and the model is not asked to retry\nYour approval UI responds by emitting hitl:confirmation-response with the confirmationId:\nApprove → the paused call resumes and runs (optionally with modifiedArguments); the approval covers that one call, so a retry of a failed or timed-out attempt runs the tool again without a new approval\nDeny → the call returns a refusal to the model and the tool never runs\nNo answer → the confirmation times out (a refusal, unless auto-approve on timeout is configured)\nCancelled → aborting the call's abortSignal withdraws the pending confirmation and emits hitl:cancelled\nTool executes → Each approval covers exactly one call, including its retries; the next call asks again","hierarchy":{"lvl0":"Features","lvl1":"Human-in-the-Loop (HITL) Workflows","lvl2":"Execution Flow","lvl3":""}},
|
|
3042
3042
|
{"objectID":"4d86f092ca7e6b372a961736d886b359fa75e092f709de1fc0632865629f0e19","title":"Security Features","url":"/docs/features/hitl#security-features","content":"One-time permissions: Each approval works for exactly one action\nNo reuse: AI cannot reuse old permissions for new actions\nAutomatic reset: Permission flag clears immediately after use\nFail-safe: Defaults to requiring permission when in doubt","hierarchy":{"lvl0":"Features","lvl1":"Human-in-the-Loop (HITL) Workflows","lvl2":"Security Features","lvl3":""}},
|
|
3043
|
-
{"objectID":"a0bcb2831207c4628365c2a9a0c21588b0c9d3ccda0f793b63dd9bbff7d63467","title":"Built-in tools","url":"/docs/features/hitl#built-in-tools","content":"HITL applies to the built-in tools (readFile, writeFile, listDirectory,\nanalyzeCSV, calculateMath, getCurrentTime, websearchGrounding and the\nopt-in executeBashCommand) exactly as it applies to tools you register:\ndangerousActions keywords and customRules are matched against the tool\nname on every model-driven call. Before the 2026-10 security audit fix (finding\nC3) built-in tools bypassed HITL entirely — only tools executed through the\ntool registry were gated — so a\nprompt-injected model could write files or, with the bash tool enabled, run\nshell commands with no confirmation, while the bash tool's own description\nclaimed otherwise.\n\nTwo built-ins change the machine and are confirmed on every call while HITL\nis enabled, whatever dangerousActions lists: writeFile and\nexecuteBashCommand. To gate them by keywords only, like every other tool,\nset confirmBuiltinTools: false:\n\nA denied built-in call is reported to the model as a failed tool call\n(
|
|
3044
|
-
{"objectID":"7854f3abc1202ff2f15b90ddfd8c29a88a2e6e71aa843e416f760a43ab570dfb","title":"Event Types","url":"/docs/features/hitl#event-types","content":"All HITL events ride the SDK emitter returned by\nneurolink.getEventEmitter(); emitter below is that object.\n\nConfirmation Request Event (hitl:confirmation-request):\n\nConfirmation Response (emit from your app):\n\nTimeout Event (hitl:timeout):","hierarchy":{"lvl0":"Features","lvl1":"Human-in-the-Loop (HITL) Workflows","lvl2":"Event Types","lvl3":""}},
|
|
3043
|
+
{"objectID":"a0bcb2831207c4628365c2a9a0c21588b0c9d3ccda0f793b63dd9bbff7d63467","title":"Built-in tools","url":"/docs/features/hitl#built-in-tools","content":"HITL applies to the built-in tools (readFile, writeFile, listDirectory,\nanalyzeCSV, calculateMath, getCurrentTime, websearchGrounding and the\nopt-in executeBashCommand) exactly as it applies to tools you register:\ndangerousActions keywords and customRules are matched against the tool\nname on every model-driven call. Before the 2026-10 security audit fix (finding\nC3) built-in tools bypassed HITL entirely — only tools executed through the\ntool registry were gated — so a\nprompt-injected model could write files or, with the bash tool enabled, run\nshell commands with no confirmation, while the bash tool's own description\nclaimed otherwise.\n\nTwo built-ins change the machine and are confirmed on every call while HITL\nis enabled, whatever dangerousActions lists: writeFile and\nexecuteBashCommand. To gate them by keywords only, like every other tool,\nset confirmBuiltinTools: false:\n\nA denied built-in call is reported to the model as a failed tool call\n(Built-in tool execution rejected by user: <reason>); the model sees the denial and\ncan continue without the side effect. A confirmation that returns\nmodifiedArguments runs the tool with those arguments. The confirmation\nrequest carries serverId: \"direct\" for a built-in tool.\n\nPer-call tools passed through generate({ tools }) are the host's own code\nand are not gated by HITL; wrap their execute yourself if they need it.","hierarchy":{"lvl0":"Features","lvl1":"Human-in-the-Loop (HITL) Workflows","lvl2":"Built-in tools","lvl3":""}},
|
|
3044
|
+
{"objectID":"7854f3abc1202ff2f15b90ddfd8c29a88a2e6e71aa843e416f760a43ab570dfb","title":"Event Types","url":"/docs/features/hitl#event-types","content":"All HITL events ride the SDK emitter returned by\nneurolink.getEventEmitter(); emitter below is that object.\n\nConfirmation Request Event (hitl:confirmation-request):\n\nConfirmation Response (emit from your app):\n\nTimeout Event (hitl:timeout):\n\nCancelled Event (hitl:cancelled): a pending confirmation was withdrawn\nbecause the call that asked was cancelled (its abortSignal fired, for\nexample the turn was aborted). Retire the card in your UI; an answer sent for\nit is ignored.","hierarchy":{"lvl0":"Features","lvl1":"Human-in-the-Loop (HITL) Workflows","lvl2":"Event Types","lvl3":""}},
|
|
3045
|
+
{"objectID":"3e34634f989373951398483eb857081283b841ccc417e6db95768d3bd82649f9","title":"Confirmation and the call's limits","url":"/docs/features/hitl#confirmation-and-the-calls-limits","content":"A call that needs confirmation is confirmed once, before its attempt timeout,\nits retries and the circuit breaker start, and nothing runs until the human\napproves or the card times out under the rule below. A denial or a\ncancellation is final: the call returns a refusal and is not retried. A card\ntimeout is also final, unless autoApproveOnTimeout is enabled and the tool\nis not in autoApproveExclusions: then the timeout approves the call without\na human response, and it runs like any approved call. Once approved, a failed\nor timed-out attempt is retried without a new approval, so a tool with side\neffects can run more than once. A model loop's per-tool deadline does\nnot run while the card waits; approval resumes it with the time that was\nleft.\n\nThe rule applies to the tools of the instance and of its worker instances\n(createWorkerInstance, and so runIsolatedAgent, registerAgentTool and\ndelegate_task): registered tools, external MCP tools and NeuroLink's\nbuilt-in tools, matched by name (for example readFile by\ndangerousActions: [\"read\"]; writeFile and executeBashCommand are\nconfirmed on every call a model loop makes unless confirmBuiltinTools is\nfalse, see Built-in tools). Registered and built-in tools\nare confirmed by the HITL manager the tool registry holds: the instance's own,\nunless another manager was installed there\n(getToolRegistry().setHITLManager(), or a worker with HITL of its own, see\nbelow). External MCP tools are confirmed by the external server manager's: the\ninstance's own, or with none the registry's. A worker with no HITL of its own\nshares its host's registry, so its calls are confirmed by the manager that\nregistry holds, normally the host's, and their cards reach that manager\nowner's emitter. When an agent tool's call ends, through its attempt timeout\nor the caller's abort, its worker run is stopped and any card it raised is\nwithdrawn. Agent-tool calls are never batched.","hierarchy":{"lvl0":"Features","lvl1":"Human-in-the-Loop (HITL) Workflows","lvl2":"Confirmation and the call's limits","lvl3":""}},
|
|
3045
3046
|
{"objectID":"5068502ff92414daee273da8919813c835390458398854e7834845b1a9b7bdef","title":"Problem: Tool executes without asking for permission","url":"/docs/features/hitl#problem-tool-executes-without-asking-for-permission","content":"Cause: Tool not marked with requiresConfirmation: true\nSolution:\nAdd this boolean flag to any tool that performs risky operations","hierarchy":{"lvl0":"Features","lvl1":"Human-in-the-Loop (HITL) Workflows","lvl2":"Problem: Tool executes without asking for permission","lvl3":""}},
|
|
3046
3047
|
{"objectID":"385ab382fc18fbd69cc1e5d7da2909e9e5c70c897f97f372b61946a0273d456a","title":"Problem: AI keeps asking for confirmation repeatedly","url":"/docs/features/hitl#problem-ai-keeps-asking-for-confirmation-repeatedly","content":"Cause: Confirmation responses not being sent or sent with wrong confirmationId\nSolution:\nExtract confirmation ID from the request event\nAlways respond to every confirmation request\nCritical: Use the same confirmationId from the request","hierarchy":{"lvl0":"Features","lvl1":"Human-in-the-Loop (HITL) Workflows","lvl2":"Problem: AI keeps asking for confirmation repeatedly","lvl3":""}},
|
|
3047
3048
|
{"objectID":"09de33ea71681ebc227efede41ba43f241d943ed4b4628befc274d99b677b587","title":"Problem: Confirmation dialog doesn't show","url":"/docs/features/hitl#problem-confirmation-dialog-doesnt-show","content":"Cause: Not listening to hitl:confirmation-request event\nSolution:\nRegister the event handler early in your application startup\nAll subsequent tool executions will trigger confirmations when needed","hierarchy":{"lvl0":"Features","lvl1":"Human-in-the-Loop (HITL) Workflows","lvl2":"Problem: Confirmation dialog doesn't show","lvl3":""}},
|
|
@@ -3555,6 +3556,7 @@
|
|
|
3555
3556
|
{"objectID":"cdf402e6f46b599ab9c4a323de35b975e821373530b4ff05c183fa176bcc4512","title":"2. Use streaming for long documents","url":"/docs/features/office-documents#2-use-streaming-for-long-documents","content":"2. Use streaming for long documents","hierarchy":{"lvl0":"Features","lvl1":"Office Documents Support","lvl2":"2. Use streaming for long documents","lvl3":""}},
|
|
3556
3557
|
{"objectID":"38276c0cb36f201e2853dff00887029f8d522e79b35ce7d18fb9088bb763de53","title":"3. Be specific in your prompts","url":"/docs/features/office-documents#3-be-specific-in-your-prompts","content":"3. Be specific in your prompts","hierarchy":{"lvl0":"Features","lvl1":"Office Documents Support","lvl2":"3. Be specific in your prompts","lvl3":""}},
|
|
3557
3558
|
{"objectID":"118807d055d2114840307a78c7d89732d9d976151d235c75a3f52a7e6351a85a","title":"Limitations","url":"/docs/features/office-documents#limitations","content":"Open XML only. .docx, .xlsx, and .pptx are parsed. Legacy .doc, .xls, and .ppt are not (see above).\nText, tables, and notes only. Embedded images and charts are not sent to the model (a Word image shows up as an  marker), and VBA macros are never run.\nNo encrypted files. A password-protected file cannot be read and arrives as a placeholder note.\nSize bounds. Word and Excel files are bounded at 100 MB each, and a presentation's extracted content at 100 MB in total (the limits live in src/lib/processors/config/sizeLimits.ts). Files over the 200 MB general ceiling are refused when loaded.\nPrompt size. The extracted text counts against the model's context window. A big workbook or a long document can fill it; use sheetName, a leaner formatStyle, or a model with a larger window.","hierarchy":{"lvl0":"Features","lvl1":"Office Documents Support","lvl2":"Limitations","lvl3":""}},
|
|
3559
|
+
{"objectID":"df7e40cfc3b7dfdcb0cdd80ed3e39d547bac474386426a74bea7ac00491adf84","title":"Dependency advisories for Excel support","url":"/docs/features/office-documents#dependency-advisories-for-excel-support","content":"Excel parsing uses exceljs 4.4.0, which is an optional dependency of @juspay/neurolink and is loaded only when a spreadsheet is processed. exceljs depends on archiver-utils and readdir-glob, which pull in older glob 7 and minimatch 3 and 5 releases. Those minimatch versions are affected by high-severity ReDoS advisories (GHSA-7r86-cg39-jmmj, GHSA-23c5-xmqv-rm74, GHSA-3ppc-4f35-3m26); the overrides below move both packages to patched releases. 4.4.0 is the latest exceljs release, so there is no upstream fix to upgrade to.\n\nThis repository mitigates the advisories with pnpm.overrides in its own package.json. Overrides in a published package are not applied when someone installs @juspay/neurolink as a dependency, so if you install the optional exceljs you get the vulnerable transitive versions unless you add overrides in your project. Exposure is low: NeuroLink only calls exceljs to read spreadsheets you pass in, and the advisories concern glob-pattern matching, not spreadsheet parsing.\n\nOn pnpm 11 and later, package.json#pnpm is not read. Put the same overrides in pnpm-workspace.yaml:\n\nWith npm, use the equivalent nested form:\n\nThose are the versions this repository pins. Its other glob and minimatch overrides cover unrelated dependency trees, so these two are all exceljs needs; check the current package.json overrides before copying them.","hierarchy":{"lvl0":"Features","lvl1":"Office Documents Support","lvl2":"Dependency advisories for Excel support","lvl3":""}},
|
|
3558
3560
|
{"objectID":"80b48dc351da3300dd4ae708a7efc61f5f9acbf7f68e74e44c69870818bdd561","title":"The model says it cannot read the document","url":"/docs/features/office-documents#the-model-says-it-cannot-read-the-document","content":"Look for the Could not extract content note in the prompt. Typical causes:\nLegacy format: a .doc, .xls, or .ppt. Re-save it as .docx, .xlsx, or .pptx.\nCorrupt or truncated file: confirm it opens in Office. An Office Open XML file is a ZIP and starts with the bytes PK\\x03\\x04.\nPassword protection: remove the password before attaching.\nNo text in the file: a deck of pictures or a scanned document has nothing to extract, and a picture-only deck arrives as just the Presentation: N slide(s) header with no placeholder note. Convert scans to text with OCR first, or attach the images instead.","hierarchy":{"lvl0":"Features","lvl1":"Office Documents Support","lvl2":"The model says it cannot read the document","lvl3":""}},
|
|
3559
3561
|
{"objectID":"198d459661b8a685d7fb14d8055beaf3a54d861be0aa2a693f56466a93dad944","title":"A sheet is missing from the output","url":"/docs/features/office-documents#a-sheet-is-missing-from-the-output","content":"If you passed sheetName, the name must match exactly. When it does not, the prompt says so and lists the sheet names the workbook has.","hierarchy":{"lvl0":"Features","lvl1":"Office Documents Support","lvl2":"A sheet is missing from the output","lvl3":""}},
|
|
3560
3562
|
{"objectID":"501457e12f05fff01c8991f41dc2d1cea3faf87deb0ae8cf25a7a493c1ed24e8","title":"A request fails with Failed to process file","url":"/docs/features/office-documents#a-request-fails-with-failed-to-process-file","content":"The path or URL could not be loaded. Check that the file exists and that the process can read it.","hierarchy":{"lvl0":"Features","lvl1":"Office Documents Support","lvl2":"A request fails with Failed to process file","lvl3":""}},
|
|
@@ -4822,8 +4824,8 @@
|
|
|
4822
4824
|
{"objectID":"7c0ca9930269015ceab0ba6b8a429bd7dbbfda29600c3f353bbef0249f0ff5fc","title":"Configuration","url":"/docs/getting-started/providers/anthropic#configuration","content":"Configuration","hierarchy":{"lvl0":"Getting Started","lvl1":"Anthropic Provider Guide","lvl2":"Configuration","lvl3":""}},
|
|
4823
4825
|
{"objectID":"57cf0f7394ea15937bfa56393a1810810e6ac4f8b0ad606cd7884760e89b051d","title":"CLI Usage","url":"/docs/getting-started/providers/anthropic#cli-usage","content":"CLI Usage","hierarchy":{"lvl0":"Getting Started","lvl1":"Anthropic Provider Guide","lvl2":"CLI Usage","lvl3":""}},
|
|
4824
4826
|
{"objectID":"363647b336363b9f2e8dae713031aec7e297f0f0fa3799cec3280131890f6226","title":"Beta Features","url":"/docs/getting-started/providers/anthropic#beta-features","content":"The Anthropic provider supports beta features via the anthropic-beta header. The following beta headers are included by default when enableBetaFeatures is true:\nclaude-code-20250219 -- Claude Code specific features\ninterleaved-thinking-2025-05-14 -- Interleaved thinking mode\nfine-grained-tool-streaming-2025-05-14 -- Fine-grained tool streaming\n\nThese correspond to the AnthropicBetaFeature enum values in src/lib/constants/enums.ts:\n\nFor OAuth mode, the beta headers are different: oauth-2025-04-20 and interleaved-thinking-2025-05-14 are sent (the claude-code-20250219 header is only included if it was present in the original request headers, as it can trigger authorization errors with OAuth tokens).","hierarchy":{"lvl0":"Getting Started","lvl1":"Anthropic Provider Guide","lvl2":"Beta Features","lvl3":""}},
|
|
4825
|
-
{"objectID":"e8a6ea83967bb6e1e6fe7208c5e1d1aa868e114173dca65e43938b6fddca5ae6","title":"Message threads (beta)","url":"/docs/getting-started/providers/anthropic#message-threads-beta","content":"A turn with tools makes several requests, and each one carries the whole conversation so far. With messageThreads: true the first request creates an Anthropic message thread. A later request sends only the messages since the last response, plus the previous response id, while nothing the thread fixes has changed; otherwise it sends the whole conversation as a new thread. It adds the message-threads-2026-08-12 beta header to those requests.\n\nWhat to know before turning it on:\nIt shrinks the request, it did not lower latency in a measurement. Against the Messages API, with prompt caching on in both modes, a tool turn's later requests went from about 79 KB to about 0.3 KB at 25k tokens of context, and from about 337 KB to about 0.3 KB at 110k tokens. Median time to first token was the same either way (672 vs 700 ms, and 739 vs 724 ms; one model, one network, no tools in the loop). The saving is bandwidth, not time.\
|
|
4826
|
-
{"objectID":"34441eee0c40860138d19ffcfce73b82e33f0f9125ddee3f426680e1a095c687","title":"Across the calls of a session (messageThreads: \"session\")","url":"/docs/getting-started/providers/anthropic#across-the-calls-of-a-session-messagethreads-session","content":"\"session\" also keeps the thread for the session's next call, so that call sends only its new message instead of the whole history. The thread is found again by user (context.userId), session (context.sessionId), API key (hashed) and endpoint; it lives in memory on the NeuroLink instance for up to four minutes (the API drops an idle thread after five), and another process simply starts a new one. A call continues only if its model, tools, system prompt (without the \"you are continuing a conversation\" note NeuroLink appends once there is history) and tool choice are the same, and the history conversation memory rebuilt matches what the thread holds. Otherwise it is a new thread.\n\nThree things differ from the per-turn option, and the first two are the price of the feature:\nThe model sees more than the unthreaded path would.
|
|
4827
|
+
{"objectID":"e8a6ea83967bb6e1e6fe7208c5e1d1aa868e114173dca65e43938b6fddca5ae6","title":"Message threads (beta)","url":"/docs/getting-started/providers/anthropic#message-threads-beta","content":"A turn with tools makes several requests, and each one carries the whole conversation so far. With messageThreads: true the first request creates an Anthropic message thread. A later request sends only the messages since the last response, plus the previous response id, while nothing the thread fixes has changed; otherwise it sends the whole conversation as a new thread. It adds the message-threads-2026-08-12 beta header to those requests.\n\nWhat to know before turning it on:\nIt shrinks the request, it did not lower latency in a measurement. Against the Messages API, with prompt caching on in both modes, a tool turn's later requests went from about 79 KB to about 0.3 KB at 25k tokens of context, and from about 337 KB to about 0.3 KB at 110k tokens. Median time to first token was the same either way (672 vs 700 ms, and 739 vs 724 ms; one model, one network, no tools in the loop). The saving is bandwidth, not time.\nNative Anthropic stream() and generate() calls on API-key auth only. Other providers and OAuth (subscription) auth ignore the option, and so does a client pointed at the NeuroLink Claude proxy over OAuth unless the proxy forwards the thread beta. generate() takes the same option (GenerateOptions.messageThreads), sends non-streaming requests, recovers from thread_not_found and thread_unsupported_request the same way, and shares the session store with stream(), so a generate() call can continue a thread a stream() call left, and the other way round.\nIt is best-effort and the conversation stays yours. The API keeps a thread in memory for a few minutes. If it cannot continue one (thread_not_found and similar), the same step is resent once in full as a new thread. If it cannot thread the request at all (thread_unsupported_request: HIPAA or inference-hook organisations, for example), that step and the rest of the turn go out unthreaded.\nAnything a thread fixes starts a new one.","hierarchy":{"lvl0":"Getting Started","lvl1":"Anthropic Provider Guide","lvl2":"Message threads (beta)","lvl3":""}},
|
|
4828
|
+
{"objectID":"34441eee0c40860138d19ffcfce73b82e33f0f9125ddee3f426680e1a095c687","title":"Across the calls of a session (messageThreads: \"session\")","url":"/docs/getting-started/providers/anthropic#across-the-calls-of-a-session-messagethreads-session","content":"\"session\" also keeps the thread for the session's next call, so that call sends only its new message instead of the whole history. The thread is found again by user (context.userId), session (context.sessionId), API key (hashed) and endpoint; it lives in memory on the NeuroLink instance for up to four minutes (the API drops an idle thread after five), and another process simply starts a new one. A call continues only if its model, tools, system prompt (without the \"you are continuing a conversation\" note NeuroLink appends once there is history) and tool choice are the same, and the history conversation memory rebuilt matches what the thread holds. Otherwise it is a new thread.\n\nThree things differ from the per-turn option, and the first two are the price of the feature:\nThe model sees more than the unthreaded path would. When conversation memory rebuilds a session's history for the next call it replays each turn's final text plus a one-line [called <tool> → ok] marker per call (the default replay format; the tool arguments and results are still stored as tool_call/tool_result rows). The thread still holds the full tool calls and results from earlier turns, so after a tool turn a continued call has context a rebuilt-from-memory call does not. That is deliberate, and it is why this is a separate value rather than the default.\nThe thread outlives clearConversationSession(). NeuroLink forgets it, so the next call starts a new thread, but the server keeps the old one until it expires (up to an hour) and has no delete. It is not zero-data-retention eligible. There is no carve-out for the conversation-erasure write protocol: choose \"session\" only where that is acceptable.\nA continued call runs without the conversation note in its system prompt, since the thread already holds the history the note points at.","hierarchy":{"lvl0":"Getting Started","lvl1":"Anthropic Provider Guide","lvl2":"Across the calls of a session (messageThreads: \"session\")","lvl3":""}},
|
|
4827
4829
|
{"objectID":"b11311c624dc33cf3ddb6888c5ff085a18e0ce089b0db5cdb15bd2ebe2b70bf7","title":"Multimodal Capabilities","url":"/docs/getting-started/providers/anthropic#multimodal-capabilities","content":"Claude models with vision support can analyze images.","hierarchy":{"lvl0":"Getting Started","lvl1":"Anthropic Provider Guide","lvl2":"Multimodal Capabilities","lvl3":""}},
|
|
4828
4830
|
{"objectID":"b9d325e6a6e5e5934dc6e4662fa16de4b606dfc6e2184e7a41dc7e60d4d59fe8","title":"Image Analysis","url":"/docs/getting-started/providers/anthropic#image-analysis","content":"Image Analysis","hierarchy":{"lvl0":"Getting Started","lvl1":"Anthropic Provider Guide","lvl2":"Image Analysis","lvl3":""}},
|
|
4829
4831
|
{"objectID":"173aa07da1c648c3a005ea3cd6bcee2016d7a2fa4401ea8cdfe440615545abe3","title":"PDF Processing","url":"/docs/getting-started/providers/anthropic#pdf-processing","content":"PDF Processing","hierarchy":{"lvl0":"Getting Started","lvl1":"Anthropic Provider Guide","lvl2":"PDF Processing","lvl3":""}},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "13.12.
|
|
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": {
|
|
@@ -193,6 +193,7 @@
|
|
|
193
193
|
"test:ollama-diagnostics": "pnpm exec tsx test/continuous-test-suite-ollama-diagnostics.ts",
|
|
194
194
|
"test:decide-engine": "pnpm exec tsx test/continuous-test-suite-decide-engine.ts",
|
|
195
195
|
"test:provider-structure": "pnpm exec tsx test/continuous-test-suite-provider-structure.ts",
|
|
196
|
+
"test:provider-tool-sites": "pnpm exec tsx test/continuous-test-suite-provider-tool-sites.ts",
|
|
196
197
|
"test:model-manifests": "pnpm exec tsx test/continuous-test-suite-model-manifests.ts",
|
|
197
198
|
"test:cli-models-list": "pnpm exec tsx test/continuous-test-suite-cli-models-list.ts",
|
|
198
199
|
"test:provider-fallback": "pnpm exec tsx test/continuous-test-suite-provider-fallback.ts",
|
|
@@ -261,6 +262,9 @@
|
|
|
261
262
|
"test:hitl": "pnpm exec tsx test/continuous-test-suite-hitl.ts",
|
|
262
263
|
"test:hitl:timeout-exclusions": "pnpm exec tsx test/continuous-test-suite-hitl-timeout-exclusions.ts",
|
|
263
264
|
"test:hitl:documented-config": "pnpm exec tsx test/continuous-test-suite-hitl-documented-config.ts",
|
|
265
|
+
"test:hitl:confirm-once": "pnpm exec tsx test/continuous-test-suite-hitl-confirm-once.ts",
|
|
266
|
+
"test:tool-abort-forwarding": "pnpm exec tsx test/continuous-test-suite-tool-abort-forwarding.ts",
|
|
267
|
+
"test:hitl:pausable-deadline": "pnpm exec tsx test/continuous-test-suite-hitl-pausable-deadline.ts",
|
|
264
268
|
"test:tasks": "pnpm exec tsx test/continuous-test-suite-tasks.ts",
|
|
265
269
|
"test:auth": "pnpm exec tsx test/continuous-test-suite-auth.ts",
|
|
266
270
|
"test:autoresearch": "pnpm exec tsx test/continuous-test-suite-autoresearch.ts",
|