@juspay/neurolink 9.90.0 → 9.91.0
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 +6 -0
- package/dist/browser/neurolink.min.js +368 -360
- package/dist/core/baseProvider.d.ts +37 -3
- package/dist/core/baseProvider.js +167 -44
- package/dist/core/modules/GenerationHandler.js +7 -1
- package/dist/core/modules/ToolsManager.js +5 -0
- package/dist/core/toolDedup.js +4 -1
- package/dist/lib/core/baseProvider.d.ts +37 -3
- package/dist/lib/core/baseProvider.js +167 -44
- package/dist/lib/core/modules/GenerationHandler.js +7 -1
- package/dist/lib/core/modules/ToolsManager.js +5 -0
- package/dist/lib/core/toolDedup.js +4 -1
- package/dist/lib/mcp/toolRegistry.js +7 -2
- package/dist/lib/neurolink.d.ts +31 -1
- package/dist/lib/neurolink.js +151 -26
- package/dist/lib/server/routes/agentRoutes.js +25 -2
- package/dist/lib/tools/toolDiscovery.d.ts +48 -0
- package/dist/lib/tools/toolDiscovery.js +231 -0
- package/dist/lib/tools/toolGate.d.ts +16 -0
- package/dist/lib/tools/toolGate.js +51 -0
- package/dist/lib/tools/toolPolicy.d.ts +40 -0
- package/dist/lib/tools/toolPolicy.js +194 -0
- package/dist/lib/types/config.d.ts +43 -3
- package/dist/lib/types/index.d.ts +1 -0
- package/dist/lib/types/index.js +1 -0
- package/dist/lib/types/providers.d.ts +8 -0
- package/dist/lib/types/toolResolution.d.ts +73 -0
- package/dist/lib/types/toolResolution.js +11 -0
- package/dist/mcp/toolRegistry.js +7 -2
- package/dist/neurolink.d.ts +31 -1
- package/dist/neurolink.js +151 -26
- package/dist/server/routes/agentRoutes.js +25 -2
- package/dist/tools/toolDiscovery.d.ts +48 -0
- package/dist/tools/toolDiscovery.js +230 -0
- package/dist/tools/toolGate.d.ts +16 -0
- package/dist/tools/toolGate.js +50 -0
- package/dist/tools/toolPolicy.d.ts +40 -0
- package/dist/tools/toolPolicy.js +193 -0
- package/dist/types/config.d.ts +43 -3
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/providers.d.ts +8 -0
- package/dist/types/toolResolution.d.ts +73 -0
- package/dist/types/toolResolution.js +10 -0
- package/package.json +2 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool resolution types — the single tool-policy pipeline that decides which
|
|
3
|
+
* tools are sent to a provider for a given request.
|
|
4
|
+
*
|
|
5
|
+
* One policy object is resolved per request from (a) per-call legacy options
|
|
6
|
+
* (`toolFilter`, `excludeTools`, `enabledToolNames`, `disableTools`) and
|
|
7
|
+
* (b) the instance-level `tools` config, then applied at the single gate in
|
|
8
|
+
* `BaseProvider` that every generate/stream path passes through.
|
|
9
|
+
*/
|
|
10
|
+
import type { ToolConfig } from "./config.js";
|
|
11
|
+
/**
|
|
12
|
+
* The resolved, merged tool policy for one request. Produced by
|
|
13
|
+
* `resolveToolPolicy()` (src/lib/tools/toolPolicy.ts) and consumed by
|
|
14
|
+
* `applyToolGate()` (src/lib/tools/toolGate.ts).
|
|
15
|
+
*/
|
|
16
|
+
export type ResolvedToolPolicy = {
|
|
17
|
+
/** false = no tools at all for this request (drops caller-supplied tools too). */
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Allowlist of tool-name patterns (exact names or `*` globs).
|
|
21
|
+
* `undefined` = all tools pass. An empty array means "no tools" — it can
|
|
22
|
+
* only come from the new `tools.include` config surface; legacy
|
|
23
|
+
* `toolFilter: []` is normalized to `undefined` (fail-open, preserving
|
|
24
|
+
* historical behavior) before it reaches here.
|
|
25
|
+
*/
|
|
26
|
+
include?: string[];
|
|
27
|
+
/**
|
|
28
|
+
* Secondary allowlist clause ANDed with `include` — set when both a
|
|
29
|
+
* legacy per-call allowlist and the instance `tools.include` are present.
|
|
30
|
+
* Kept as a separate clause because two glob pattern lists cannot be
|
|
31
|
+
* losslessly pre-intersected into a single pattern array (a name must
|
|
32
|
+
* match BOTH lists to pass).
|
|
33
|
+
*/
|
|
34
|
+
includeBound?: string[];
|
|
35
|
+
/** Denylist of tool-name patterns (exact names or `*` globs), applied after include. */
|
|
36
|
+
exclude: string[];
|
|
37
|
+
/** Defer external MCP tool schemas behind the search_tools meta-tool. */
|
|
38
|
+
discovery: boolean;
|
|
39
|
+
/** Which option/config sources contributed to this policy (telemetry/debugging). */
|
|
40
|
+
sources: string[];
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Inputs to `resolveToolPolicy()`. Kept as a named type so the mapping is
|
|
44
|
+
* unit-testable as a pure function.
|
|
45
|
+
*/
|
|
46
|
+
export type ToolPolicyResolutionInput = {
|
|
47
|
+
/** Per-call options (the legacy per-call filtering surface). */
|
|
48
|
+
options: {
|
|
49
|
+
disableTools?: boolean;
|
|
50
|
+
toolFilter?: string[];
|
|
51
|
+
enabledToolNames?: string[];
|
|
52
|
+
excludeTools?: string[];
|
|
53
|
+
};
|
|
54
|
+
/** Instance-level `tools` config passed to the NeuroLink constructor. */
|
|
55
|
+
instanceConfig?: ToolConfig;
|
|
56
|
+
/**
|
|
57
|
+
* Names of the built-in (direct) tools of the calling provider — used to
|
|
58
|
+
* honor `tools.disableBuiltinTools` without this module importing the
|
|
59
|
+
* direct-tools registry.
|
|
60
|
+
*/
|
|
61
|
+
builtinToolNames?: string[];
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* One entry in the deferred-tool catalog embedded in the `search_tools`
|
|
65
|
+
* meta-tool description when `tools.discovery` is enabled.
|
|
66
|
+
*/
|
|
67
|
+
export type DeferredToolIndexEntry = {
|
|
68
|
+
name: string;
|
|
69
|
+
/** One-line description (truncated) shown in the search_tools catalog. */
|
|
70
|
+
summary: string;
|
|
71
|
+
/** Originating MCP server id, when known. */
|
|
72
|
+
serverId?: string;
|
|
73
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool resolution types — the single tool-policy pipeline that decides which
|
|
3
|
+
* tools are sent to a provider for a given request.
|
|
4
|
+
*
|
|
5
|
+
* One policy object is resolved per request from (a) per-call legacy options
|
|
6
|
+
* (`toolFilter`, `excludeTools`, `enabledToolNames`, `disableTools`) and
|
|
7
|
+
* (b) the instance-level `tools` config, then applied at the single gate in
|
|
8
|
+
* `BaseProvider` that every generate/stream path passes through.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.91.0",
|
|
4
4
|
"packageManager": "pnpm@10.15.1",
|
|
5
5
|
"description": "TypeScript AI SDK with 24+ LLM providers behind one consistent API. MCP-native (connect any MCP server), voice TTS/STT/realtime, RAG, agents, memory, context compaction. OpenAI · Anthropic · Gemini · Bedrock · Azure · Ollama · DeepSeek · NVIDIA NIM and more.",
|
|
6
6
|
"author": {
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"test:cache": "npx tsx test/continuous-test-suite-cache-breakpoints.ts",
|
|
75
75
|
"test:evaluation": "npx tsx test/continuous-test-suite-evaluation.ts",
|
|
76
76
|
"test:mcp": "npx tsx test/continuous-test-suite-mcp-infra.ts",
|
|
77
|
+
"test:tool-resolution": "npx tsx test/continuous-test-suite-tool-resolution.ts",
|
|
77
78
|
"test:mcp:http": "npx tsx test/continuous-test-suite-mcp-http.ts",
|
|
78
79
|
"test:mcp:sdk": "npx tsx test/continuous-test-suite-mcp-sdk.ts",
|
|
79
80
|
"test:mcp:cli": "npx tsx test/continuous-test-suite-mcp-cli.ts",
|