@juspay/neurolink 13.8.16 → 13.8.18
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 -2
- package/README.md +1 -1
- package/dist/action/actionExecutor.d.ts +33 -3
- package/dist/action/actionExecutor.js +71 -15
- package/dist/action/actionInputs.js +4 -1
- package/dist/action/cliVersion.d.ts +25 -0
- package/dist/action/cliVersion.js +26 -0
- package/dist/action/index.d.ts +2 -1
- package/dist/action/index.js +2 -1
- package/dist/adapters/video/directorPipeline.js +46 -36
- package/dist/adapters/video/ffmpegAdapter.d.ts +17 -0
- package/dist/adapters/video/ffmpegAdapter.js +32 -5
- package/dist/adapters/video/frameExtractor.js +1 -1
- package/dist/adapters/video/videoMerger.js +5 -2
- package/dist/agent/arithmeticEvaluator.d.ts +32 -0
- package/dist/agent/arithmeticEvaluator.js +349 -0
- package/dist/agent/directTools.d.ts +6 -18
- package/dist/agent/directTools.js +17 -56
- package/dist/artifacts/artifactStore.d.ts +22 -1
- package/dist/artifacts/artifactStore.js +66 -6
- package/dist/auth/anthropicOAuth.d.ts +26 -1
- package/dist/auth/anthropicOAuth.js +81 -5
- package/dist/auth/secureFiles.d.ts +37 -0
- package/dist/auth/secureFiles.js +95 -0
- package/dist/auth/tokenStore.d.ts +43 -6
- package/dist/auth/tokenStore.js +260 -79
- package/dist/avatar/providers/DIDAvatar.js +49 -45
- package/dist/avatar/providers/ReplicateAvatar.js +33 -40
- package/dist/browser/neurolink.min.js +485 -558
- package/dist/cli/commands/auth.js +112 -70
- package/dist/cli/commands/proxy.d.ts +4 -0
- package/dist/cli/commands/proxy.js +128 -13
- package/dist/cli/commands/serve.d.ts +10 -1
- package/dist/cli/commands/serve.js +98 -17
- package/dist/cli/commands/server.js +17 -5
- package/dist/cli/index.js +146 -5
- package/dist/cli/loop/optionsSchema.d.ts +1 -1
- package/dist/cli/utils/envManager.js +17 -3
- package/dist/cli/utils/serverUtils.d.ts +39 -3
- package/dist/cli/utils/serverUtils.js +63 -6
- package/dist/core/baseProvider.js +7 -1
- package/dist/core/modules/MessageBuilder.js +5 -0
- package/dist/core/modules/ToolsManager.d.ts +46 -1
- package/dist/core/modules/ToolsManager.js +190 -43
- package/dist/files/fileReferenceRegistry.d.ts +2 -23
- package/dist/files/fileReferenceRegistry.js +55 -5
- package/dist/hitl/hitlManager.js +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +6 -1
- package/dist/mcp/auth/tokenStorage.d.ts +7 -0
- package/dist/mcp/auth/tokenStorage.js +23 -4
- package/dist/mcp/externalServerManager.d.ts +13 -3
- package/dist/mcp/externalServerManager.js +154 -136
- package/dist/mcp/index.d.ts +2 -0
- package/dist/mcp/index.js +3 -0
- package/dist/mcp/mcpClientFactory.d.ts +14 -0
- package/dist/mcp/mcpClientFactory.js +70 -7
- package/dist/mcp/projectConfigTrust.d.ts +72 -0
- package/dist/mcp/projectConfigTrust.js +237 -0
- package/dist/mcp/transportUrlPolicy.d.ts +39 -0
- package/dist/mcp/transportUrlPolicy.js +172 -0
- package/dist/music/providers/BeatovenMusic.js +35 -46
- package/dist/music/providers/ReplicateMusic.js +33 -40
- package/dist/neurolink.d.ts +16 -1
- package/dist/neurolink.js +64 -11
- package/dist/processors/archive/ArchiveProcessor.js +15 -1
- package/dist/processors/archive/zipEntryIndex.d.ts +22 -0
- package/dist/processors/archive/zipEntryIndex.js +33 -0
- package/dist/processors/base/BaseFileProcessor.d.ts +9 -21
- package/dist/processors/base/BaseFileProcessor.js +40 -111
- package/dist/processors/data/YamlProcessor.d.ts +13 -1
- package/dist/processors/data/YamlProcessor.js +93 -2
- package/dist/processors/document/OpenDocumentProcessor.js +7 -2
- package/dist/processors/document/PptxProcessor.js +12 -7
- package/dist/processors/media/VideoProcessor.js +93 -15
- package/dist/proxy/inboundAuth.d.ts +89 -0
- package/dist/proxy/inboundAuth.js +219 -0
- package/dist/proxy/tokenRefresh.d.ts +6 -0
- package/dist/proxy/tokenRefresh.js +13 -1
- package/dist/proxy/updateState.js +4 -4
- package/dist/rag/document/loaders.d.ts +0 -6
- package/dist/rag/document/loaders.js +16 -10
- package/dist/rag/ragIntegration.d.ts +2 -2
- package/dist/rag/ragIntegration.js +35 -10
- package/dist/rag/retrieval/vectorQueryTool.d.ts +7 -0
- package/dist/rag/retrieval/vectorQueryTool.js +54 -17
- package/dist/server/abstract/baseServerAdapter.d.ts +43 -0
- package/dist/server/abstract/baseServerAdapter.js +119 -6
- package/dist/server/adapters/expressAdapter.d.ts +3 -0
- package/dist/server/adapters/expressAdapter.js +83 -8
- package/dist/server/adapters/fastifyAdapter.d.ts +3 -0
- package/dist/server/adapters/fastifyAdapter.js +165 -70
- package/dist/server/adapters/honoAdapter.d.ts +9 -1
- package/dist/server/adapters/honoAdapter.js +99 -21
- package/dist/server/adapters/koaAdapter.d.ts +1 -0
- package/dist/server/adapters/koaAdapter.js +153 -74
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.js +4 -0
- package/dist/server/middleware/auth.js +6 -2
- package/dist/server/middleware/cache.js +6 -1
- package/dist/server/middleware/rateLimit.js +29 -4
- package/dist/server/routes/agentRoutes.js +24 -11
- package/dist/server/routes/claudeProxyRoutes.d.ts +1 -0
- package/dist/server/routes/claudeProxyRoutes.js +273 -84
- package/dist/server/routes/codexProxyRoutes.d.ts +2 -2
- package/dist/server/routes/codexProxyRoutes.js +125 -40
- package/dist/server/routes/index.d.ts +4 -0
- package/dist/server/routes/index.js +35 -4
- package/dist/server/routes/mcpRoutes.d.ts +6 -2
- package/dist/server/routes/mcpRoutes.js +21 -7
- package/dist/server/routes/memoryRoutes.js +7 -6
- package/dist/server/routes/toolRoutes.d.ts +12 -2
- package/dist/server/routes/toolRoutes.js +33 -3
- package/dist/server/routes/transcribeRoutes.js +60 -13
- package/dist/server/utils/clientAddress.d.ts +23 -0
- package/dist/server/utils/clientAddress.js +65 -0
- package/dist/server/utils/clientError.d.ts +35 -0
- package/dist/server/utils/clientError.js +129 -0
- package/dist/server/utils/expressBody.d.ts +33 -0
- package/dist/server/utils/expressBody.js +353 -0
- package/dist/server/utils/pathMatch.d.ts +21 -0
- package/dist/server/utils/pathMatch.js +41 -0
- package/dist/server/utils/validation.d.ts +9 -0
- package/dist/server/utils/validation.js +9 -0
- package/dist/server/websocket/WebSocketHandler.js +22 -3
- package/dist/server/websocket/frameQueue.d.ts +19 -0
- package/dist/server/websocket/frameQueue.js +41 -3
- package/dist/server/websocket/transcribeWebSocket.d.ts +8 -1
- package/dist/server/websocket/transcribeWebSocket.js +223 -34
- package/dist/skills/skillStores.js +5 -0
- package/dist/tasks/store/fileTaskStore.d.ts +2 -0
- package/dist/tasks/store/fileTaskStore.js +11 -4
- package/dist/types/attachments.d.ts +117 -0
- package/dist/types/attachments.js +15 -0
- package/dist/types/auth.d.ts +6 -0
- package/dist/types/cli.d.ts +4 -0
- package/dist/types/config.d.ts +56 -0
- package/dist/types/file.d.ts +8 -0
- package/dist/types/hitl.d.ts +8 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/mcp.d.ts +98 -0
- package/dist/types/multimodal.js +0 -41
- package/dist/types/processor.d.ts +14 -1
- package/dist/types/proxy.d.ts +62 -3
- package/dist/types/rag.d.ts +9 -0
- package/dist/types/safeFetch.d.ts +40 -0
- package/dist/types/server.d.ts +255 -10
- package/dist/types/tools.d.ts +57 -0
- package/dist/types/transcribe.d.ts +6 -0
- package/dist/utils/attachmentPolicy.d.ts +89 -0
- package/dist/utils/attachmentPolicy.js +327 -0
- package/dist/utils/dotenvBootstrap.d.ts +48 -19
- package/dist/utils/dotenvBootstrap.js +172 -31
- package/dist/utils/fileDetector.js +115 -65
- package/dist/utils/json/coerce.js +11 -1
- package/dist/utils/logSanitize.d.ts +5 -0
- package/dist/utils/logSanitize.js +8 -0
- package/dist/utils/logger.js +73 -1
- package/dist/utils/messageBuilder.d.ts +2 -2
- package/dist/utils/messageBuilder.js +118 -105
- package/dist/utils/multimodalOptionsBuilder.d.ts +1 -0
- package/dist/utils/multimodalOptionsBuilder.js +2 -0
- package/dist/utils/redis.d.ts +12 -0
- package/dist/utils/redis.js +72 -0
- package/dist/utils/safeFetch.d.ts +22 -1
- package/dist/utils/safeFetch.js +132 -38
- package/dist/utils/safeStoreId.d.ts +19 -0
- package/dist/utils/safeStoreId.js +29 -0
- package/dist/utils/schemaConversion.d.ts +30 -3
- package/dist/utils/schemaConversion.js +457 -84
- package/dist/utils/sizeGuard.js +2 -2
- package/dist/utils/ssrfGuard.d.ts +3 -3
- package/dist/utils/ssrfGuard.js +71 -39
- package/dist/voice/eval/sttEvalStore.d.ts +26 -3
- package/dist/voice/eval/sttEvalStore.js +77 -12
- package/dist/voice/livekit/agentDefinition.d.ts +18 -0
- package/dist/voice/livekit/agentDefinition.js +22 -0
- package/dist/voice/livekit/realtimeMcpTools.d.ts +1 -1
- package/dist/voice/livekit/realtimeMcpTools.js +8 -7
- package/dist/voice/livekit/realtimeVoiceAgent.d.ts +2 -4
- package/dist/voice/livekit/realtimeVoiceAgent.js +18 -7
- package/dist/voice/livekit/voiceAgent.d.ts +2 -2
- package/dist/voice/livekit/voiceAgent.js +2 -1
- package/dist/voice/livekit/xaiSessionWatch.d.ts +0 -5
- package/dist/voice/livekit/xaiSessionWatch.js +30 -0
- package/dist/voice/providers/GeminiLive.js +21 -6
- package/dist/voice/providers/GoogleSTT.js +8 -5
- package/dist/voice/transcribe.d.ts +2 -2
- package/dist/voice/transcribe.js +34 -18
- package/dist/voice/whistle/audio.js +11 -5
- package/docs-site/static/search-index.json +75 -52
- package/package.json +171 -156
- package/scripts/observability/import-openobserve-dashboard.mjs +11 -3
package/dist/types/config.d.ts
CHANGED
|
@@ -206,6 +206,15 @@ export type NeurolinkConstructorConfig = {
|
|
|
206
206
|
* See {@link MiddlewareFactoryOptions}.
|
|
207
207
|
*/
|
|
208
208
|
middleware?: MiddlewareFactoryOptions;
|
|
209
|
+
/**
|
|
210
|
+
* What this instance may read or fetch when a call names a file path or URL
|
|
211
|
+
* (`input.files`, `input.images`, `rag.files`, `transcribe({ audio })`,
|
|
212
|
+
* Director Mode segment images). Unset: URLs must be HTTPS to a public host
|
|
213
|
+
* (redirects re-checked per hop), local paths are unrestricted but warn once.
|
|
214
|
+
* Set `allowedRoots` whenever the strings come from untrusted callers. See
|
|
215
|
+
* {@link AttachmentsConfig}.
|
|
216
|
+
*/
|
|
217
|
+
attachments?: AttachmentsConfig;
|
|
209
218
|
};
|
|
210
219
|
/**
|
|
211
220
|
* Configuration for MCP enhancement modules wired into generate()/stream() paths.
|
|
@@ -219,6 +228,20 @@ export type NeurolinkConstructorConfig = {
|
|
|
219
228
|
* - middleware: Global tool execution middleware chain (empty by default)
|
|
220
229
|
*/
|
|
221
230
|
export type MCPEnhancementsConfig = {
|
|
231
|
+
/**
|
|
232
|
+
* Explicit path of a project MCP configuration (`.mcp-config.json` shape)
|
|
233
|
+
* to load when MCP initialises. Relative paths resolve against the
|
|
234
|
+
* working directory. This is the SDK's only way to load a project file:
|
|
235
|
+
* the working directory is never searched implicitly, because a directory
|
|
236
|
+
* is not a trust boundary — a cloned repository's `.mcp-config.json`
|
|
237
|
+
* would otherwise run its servers with your credentials.
|
|
238
|
+
*/
|
|
239
|
+
configPath?: string;
|
|
240
|
+
/**
|
|
241
|
+
* Load `<cwd>/.mcp-config.json` without naming it. Set this only when the
|
|
242
|
+
* working directory is one you control. Default: false.
|
|
243
|
+
*/
|
|
244
|
+
trustProjectConfig?: boolean;
|
|
222
245
|
/** Tool result caching. Default: enabled. Set enabled: false to opt out. */
|
|
223
246
|
cache?: {
|
|
224
247
|
enabled?: boolean;
|
|
@@ -556,6 +579,7 @@ export declare const DEFAULT_CONFIG: NeuroLinkConfig;
|
|
|
556
579
|
import { TOOL_TIMEOUTS, BACKOFF_CONFIG, PERFORMANCE_PROFILES, PROVIDER_OPERATION_CONFIGS, MCP_OPERATION_CONFIGS } from "../constants/index.js";
|
|
557
580
|
import type { ToolMiddleware, CacheStrategy, RoutingStrategy, ToolDedupConfig, ToolRoutingConfig } from "./index.js";
|
|
558
581
|
import type { ModelAliasConfig } from "./generate.js";
|
|
582
|
+
import type { AttachmentsConfig } from "./attachments.js";
|
|
559
583
|
/** Timeout category keys from TOOL_TIMEOUTS. */
|
|
560
584
|
export type TimeoutCategory = keyof typeof TOOL_TIMEOUTS;
|
|
561
585
|
/** Retry strategy keys from BACKOFF_CONFIG. */
|
|
@@ -619,3 +643,35 @@ export type NativeThinkingConfig = {
|
|
|
619
643
|
thinkingLevel?: ThinkingLevel;
|
|
620
644
|
thinkingBudget?: number;
|
|
621
645
|
};
|
|
646
|
+
export type DotenvBootstrapOptions = {
|
|
647
|
+
/**
|
|
648
|
+
* Who is loading. The CLI prints its notices to stderr; an SDK caller
|
|
649
|
+
* (opted in with `NEUROLINK_DOTENV=1` or by calling `loadDotenv()`) gets
|
|
650
|
+
* the same notices through `notify`, which defaults to stderr as well.
|
|
651
|
+
*/
|
|
652
|
+
caller?: "cli" | "sdk";
|
|
653
|
+
/** Receives one human-readable line per notice. Default: `process.stderr`. */
|
|
654
|
+
notify?: (line: string) => void;
|
|
655
|
+
};
|
|
656
|
+
export type DotenvBootstrapResult = {
|
|
657
|
+
/** Whether a `.env` file was read. */
|
|
658
|
+
loaded: boolean;
|
|
659
|
+
/** Absolute path of the file that was (or would have been) read. */
|
|
660
|
+
path?: string;
|
|
661
|
+
/** Variables the file supplied that were absent from the environment. */
|
|
662
|
+
supplied: string[];
|
|
663
|
+
/**
|
|
664
|
+
* The subset of `supplied` that redirects traffic or file access: provider
|
|
665
|
+
* `*_BASE_URL` / `*_ENDPOINT(S)` variables, `NEUROLINK_*_DIR` directories
|
|
666
|
+
* and `DOTENV_CONFIG_PATH`. Still set unless listed under `refused`.
|
|
667
|
+
*/
|
|
668
|
+
endpointOverrides: string[];
|
|
669
|
+
/**
|
|
670
|
+
* Endpoint overrides deleted again because the file is not owned by the
|
|
671
|
+
* current user or is group/world-writable. Export them in the shell to use
|
|
672
|
+
* them.
|
|
673
|
+
*/
|
|
674
|
+
refused: string[];
|
|
675
|
+
/** Why loading was skipped or overrides were refused, when either happened. */
|
|
676
|
+
reason?: string;
|
|
677
|
+
};
|
package/dist/types/file.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* File detection and processing types for unified file handling
|
|
3
3
|
*/
|
|
4
4
|
import type { ImageWithAltText } from "./multimodal.js";
|
|
5
|
+
import type { AttachmentPolicy } from "./attachments.js";
|
|
5
6
|
/**
|
|
6
7
|
* Supported file types for multimodal input
|
|
7
8
|
*/
|
|
@@ -724,6 +725,13 @@ export type FileDetectorOptions = {
|
|
|
724
725
|
* filesystem access; SDK callers loading their own files can omit it.
|
|
725
726
|
*/
|
|
726
727
|
allowedBaseDir?: string;
|
|
728
|
+
/**
|
|
729
|
+
* Instance attachment policy: `allowedRoots` containment (when
|
|
730
|
+
* `allowedBaseDir` is not set), the URL rules (HTTPS-only, public hosts,
|
|
731
|
+
* re-validated redirects) and the global size cap. The environment-derived
|
|
732
|
+
* default applies when absent.
|
|
733
|
+
*/
|
|
734
|
+
attachmentPolicy?: AttachmentPolicy;
|
|
727
735
|
audioOptions?: AudioProcessorOptions;
|
|
728
736
|
csvOptions?: CSVProcessorOptions;
|
|
729
737
|
officeOptions?: OfficeProcessorOptions;
|
package/dist/types/hitl.d.ts
CHANGED
|
@@ -28,6 +28,14 @@ export type HITLConfig = {
|
|
|
28
28
|
auditLogging?: boolean;
|
|
29
29
|
/** Advanced custom rules for complex tool scenarios (default: []) */
|
|
30
30
|
customRules?: HITLRule[];
|
|
31
|
+
/**
|
|
32
|
+
* Whether the built-in tools that change the machine — `writeFile` and the
|
|
33
|
+
* opt-in `executeBashCommand` — always require confirmation while HITL is
|
|
34
|
+
* enabled, whatever `dangerousActions` says (default: true). Set to `false`
|
|
35
|
+
* to gate built-in tools by `dangerousActions` keywords and `customRules`
|
|
36
|
+
* only, as every other tool is.
|
|
37
|
+
*/
|
|
38
|
+
confirmBuiltinTools?: boolean;
|
|
31
39
|
};
|
|
32
40
|
/**
|
|
33
41
|
* Custom rule for advanced HITL scenarios
|
package/dist/types/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./agentMode.js";
|
|
|
8
8
|
export * from "./aliases.js";
|
|
9
9
|
export * from "./analytics.js";
|
|
10
10
|
export * from "./artifact.js";
|
|
11
|
+
export * from "./attachments.js";
|
|
11
12
|
export * from "./auth.js";
|
|
12
13
|
export * from "./autoresearch.js";
|
|
13
14
|
export * from "./circuitBreakerErrors.js";
|
package/dist/types/index.js
CHANGED
|
@@ -9,6 +9,7 @@ export * from "./agentMode.js";
|
|
|
9
9
|
export * from "./aliases.js";
|
|
10
10
|
export * from "./analytics.js";
|
|
11
11
|
export * from "./artifact.js";
|
|
12
|
+
export * from "./attachments.js";
|
|
12
13
|
export * from "./auth.js";
|
|
13
14
|
export * from "./autoresearch.js";
|
|
14
15
|
export * from "./circuitBreakerErrors.js";
|
package/dist/types/mcp.d.ts
CHANGED
|
@@ -69,6 +69,24 @@ export type MCPServerInfo = {
|
|
|
69
69
|
cwd?: string;
|
|
70
70
|
autoRestart?: boolean;
|
|
71
71
|
healthCheckInterval?: number;
|
|
72
|
+
/**
|
|
73
|
+
* stdio only. By default a spawned server receives the MCP SDK's minimal
|
|
74
|
+
* default environment (`HOME`, `PATH`, `SHELL`, `TERM`, `USER`, `LOGNAME`
|
|
75
|
+
* on POSIX) plus `env`; the parent's provider keys and tokens are not
|
|
76
|
+
* inherited. Set `true` to restore the previous behaviour of handing the
|
|
77
|
+
* server the whole parent `process.env`. Prefer explicit pass-through:
|
|
78
|
+
* `"env": { "OPENAI_API_KEY": "${OPENAI_API_KEY}" }`.
|
|
79
|
+
*/
|
|
80
|
+
inheritParentEnv?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* http / sse / websocket only. A transport URL must use `https:` or `wss:`
|
|
83
|
+
* unless its host is loopback, and its host must not resolve to a private,
|
|
84
|
+
* link-local, CGNAT or cloud-metadata address. Set `true` for a server on
|
|
85
|
+
* your own network: plaintext `http:` / `ws:` is then accepted for hosts
|
|
86
|
+
* that are (or resolve only to) private addresses. Public hosts still need
|
|
87
|
+
* TLS.
|
|
88
|
+
*/
|
|
89
|
+
allowPrivateNetwork?: boolean;
|
|
72
90
|
/**
|
|
73
91
|
* Minimum number of tools that must be discovered for this server's
|
|
74
92
|
* registration to be considered ready (default: 0 — no minimum, so a
|
|
@@ -2268,3 +2286,83 @@ export type OptimizeParametersParams = {
|
|
|
2268
2286
|
optimizeFor: "speed" | "quality" | "cost" | "tokens";
|
|
2269
2287
|
iterations: number;
|
|
2270
2288
|
};
|
|
2289
|
+
/** One recorded acceptance of a project `.mcp-config.json`. */
|
|
2290
|
+
export type ProjectMcpConfigTrustEntry = {
|
|
2291
|
+
/** Lower-case hex SHA-256 of the file's bytes when it was accepted. */
|
|
2292
|
+
sha256: string;
|
|
2293
|
+
/** ISO-8601 timestamp of the acceptance. */
|
|
2294
|
+
trustedAt: string;
|
|
2295
|
+
};
|
|
2296
|
+
/**
|
|
2297
|
+
* On-disk shape of `~/.neurolink/trusted-mcp-configs.json`: absolute config
|
|
2298
|
+
* path → the hash the user accepted. A changed file no longer matches and
|
|
2299
|
+
* has to be accepted again.
|
|
2300
|
+
*/
|
|
2301
|
+
export type ProjectMcpConfigTrustStore = {
|
|
2302
|
+
version: 1;
|
|
2303
|
+
entries: Record<string, ProjectMcpConfigTrustEntry>;
|
|
2304
|
+
};
|
|
2305
|
+
/**
|
|
2306
|
+
* What a project config would do, reduced to what a human needs to see
|
|
2307
|
+
* before trusting it. Header and `env` values are deliberately absent: only
|
|
2308
|
+
* the `env` key names are listed, so a summary never echoes a secret.
|
|
2309
|
+
*/
|
|
2310
|
+
export type ProjectMcpConfigServerSummary = {
|
|
2311
|
+
id: string;
|
|
2312
|
+
transport: string;
|
|
2313
|
+
command?: string;
|
|
2314
|
+
args?: string[];
|
|
2315
|
+
url?: string;
|
|
2316
|
+
envKeys?: string[];
|
|
2317
|
+
};
|
|
2318
|
+
export type ProjectMcpConfigSummary = {
|
|
2319
|
+
/** Absolute path of the config file. */
|
|
2320
|
+
path: string;
|
|
2321
|
+
/** Lower-case hex SHA-256 of the file's bytes. */
|
|
2322
|
+
sha256: string;
|
|
2323
|
+
servers: ProjectMcpConfigServerSummary[];
|
|
2324
|
+
/** Set when the file is not valid JSON or has no `mcpServers` object. */
|
|
2325
|
+
parseError?: string;
|
|
2326
|
+
};
|
|
2327
|
+
/**
|
|
2328
|
+
* `trusted`: the store holds this path with this hash. `changed`: the store
|
|
2329
|
+
* holds this path with a different hash. `untrusted`: never accepted.
|
|
2330
|
+
*/
|
|
2331
|
+
export type ProjectMcpConfigTrustStatus = "trusted" | "changed" | "untrusted";
|
|
2332
|
+
/**
|
|
2333
|
+
* Which rule let a project config be loaded. `configPath` and
|
|
2334
|
+
* `trustProjectConfig` come from the `NeuroLink` constructor's `mcp` option;
|
|
2335
|
+
* `cliTrust` is the CLI's hash-pinned acceptance; `enableManualMCP` is the
|
|
2336
|
+
* `ProviderRegistry` option a host set after construction.
|
|
2337
|
+
*/
|
|
2338
|
+
export type ProjectMcpConfigSource = "configPath" | "trustProjectConfig" | "cliTrust" | "enableManualMCP";
|
|
2339
|
+
export type ProjectMcpConfigPathResolution = {
|
|
2340
|
+
path: string;
|
|
2341
|
+
source: ProjectMcpConfigSource;
|
|
2342
|
+
};
|
|
2343
|
+
/**
|
|
2344
|
+
* Registered by the CLI entry point once it has decided what to do about the
|
|
2345
|
+
* working directory's `.mcp-config.json`. Called with the candidate path the
|
|
2346
|
+
* moment a `NeuroLink` instance would load it; returns the path to load or
|
|
2347
|
+
* `null` to load nothing. A hook may also end the process (the CLI's
|
|
2348
|
+
* non-interactive refusal does), which is why it is asynchronous.
|
|
2349
|
+
*/
|
|
2350
|
+
export type ProjectMcpConfigTrustHook = (candidatePath: string) => Promise<string | null>;
|
|
2351
|
+
/** Options for the MCP transport URL policy (`assertMcpTransportUrlAllowed`). */
|
|
2352
|
+
export type McpTransportUrlPolicyOptions = {
|
|
2353
|
+
transport: MCPTransportType;
|
|
2354
|
+
/** See {@link MCPServerInfo.allowPrivateNetwork}. */
|
|
2355
|
+
allowPrivateNetwork?: boolean;
|
|
2356
|
+
/**
|
|
2357
|
+
* The host application supplied its own `fetch` (or dispatcher) for this
|
|
2358
|
+
* server, so egress — which addresses are dialled, with which pins — is
|
|
2359
|
+
* decided by that code, not by this policy. Only program code can pass a
|
|
2360
|
+
* function; a config file never can. The scheme allow-list still applies;
|
|
2361
|
+
* the plaintext and address classification is skipped.
|
|
2362
|
+
*/
|
|
2363
|
+
hostOwnedEgress?: boolean;
|
|
2364
|
+
/** Used only to name the server in error messages. */
|
|
2365
|
+
serverId?: string;
|
|
2366
|
+
};
|
|
2367
|
+
/** How an address is classified by the MCP transport URL policy. */
|
|
2368
|
+
export type McpTransportAddressClass = "loopback" | "private" | "public";
|
package/dist/types/multimodal.js
CHANGED
|
@@ -1,44 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Multimodal Content Types for NeuroLink
|
|
3
|
-
*
|
|
4
|
-
* Central registry for all multimodal input/output types.
|
|
5
|
-
* This file consolidates types from content.ts and conversation.ts
|
|
6
|
-
* to provide a single source of truth for multimodal functionality.
|
|
7
|
-
*
|
|
8
|
-
* @module types/multimodal
|
|
9
|
-
*
|
|
10
|
-
* @example Basic Multimodal Input
|
|
11
|
-
* ```typescript
|
|
12
|
-
* import type { MultimodalInput } from './types/multimodal.js';
|
|
13
|
-
*
|
|
14
|
-
* const input: MultimodalInput = {
|
|
15
|
-
* text: "What's in this image?",
|
|
16
|
-
* images: [imageBuffer, "https://example.com/image.jpg"],
|
|
17
|
-
* pdfFiles: [pdfBuffer]
|
|
18
|
-
* };
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @example Audio/Video Input (Future)
|
|
22
|
-
* ```typescript
|
|
23
|
-
* const avInput: MultimodalInput = {
|
|
24
|
-
* text: "Transcribe this audio and analyze this video",
|
|
25
|
-
* audioFiles: [audioBuffer],
|
|
26
|
-
* videoFiles: ["path/to/video.mp4"]
|
|
27
|
-
* };
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* @example Advanced Content Array
|
|
31
|
-
* ```typescript
|
|
32
|
-
* const advanced: MultimodalInput = {
|
|
33
|
-
* text: "irrelevant", // ignored when content[] is provided
|
|
34
|
-
* content: [
|
|
35
|
-
* { type: "text", text: "Analyze these items:" },
|
|
36
|
-
* { type: "image", data: imageBuffer, mediaType: "image/jpeg" },
|
|
37
|
-
* { type: "pdf", data: pdfBuffer, metadata: { filename: "report.pdf" } }
|
|
38
|
-
* ]
|
|
39
|
-
* };
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
1
|
// ============================================
|
|
43
2
|
// TYPE GUARDS
|
|
44
3
|
// ============================================
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* @module processors/base/types
|
|
8
8
|
*/
|
|
9
9
|
import type { FileErrorCode } from "../processors/errors/FileErrorCode.js";
|
|
10
|
+
import type { AttachmentPolicy } from "./attachments.js";
|
|
10
11
|
/**
|
|
11
12
|
* Generic file information - provider agnostic.
|
|
12
13
|
* Replaces Slack-specific SlackFileInfo with a universal interface.
|
|
@@ -145,8 +146,16 @@ export type ProcessorRetryConfig = {
|
|
|
145
146
|
* Allows customization of download behavior and retry logic.
|
|
146
147
|
*/
|
|
147
148
|
export type ProcessOptions = {
|
|
148
|
-
/**
|
|
149
|
+
/**
|
|
150
|
+
* Authentication headers for download requests. Sent on the first request
|
|
151
|
+
* only — never replayed to a redirect target.
|
|
152
|
+
*/
|
|
149
153
|
authHeaders?: Record<string, string>;
|
|
154
|
+
/**
|
|
155
|
+
* Attachment policy for the download (URL rules, size cap). The
|
|
156
|
+
* environment-derived default applies when absent.
|
|
157
|
+
*/
|
|
158
|
+
attachmentPolicy?: AttachmentPolicy;
|
|
150
159
|
/** Override default timeout (in milliseconds) */
|
|
151
160
|
timeout?: number;
|
|
152
161
|
/** Retry configuration for transient failures */
|
|
@@ -872,6 +881,10 @@ export type BoundedZipEntry = {
|
|
|
872
881
|
crc: number;
|
|
873
882
|
};
|
|
874
883
|
};
|
|
884
|
+
/** The minimum an indexable adm-zip entry carries (see `zipEntryIndex.ts`). */
|
|
885
|
+
export type NamedZipEntry = {
|
|
886
|
+
entryName: string;
|
|
887
|
+
};
|
|
875
888
|
export type ArchiveEntryReadResult = {
|
|
876
889
|
readonly status: "ok";
|
|
877
890
|
readonly buffer: Buffer;
|
package/dist/types/proxy.d.ts
CHANGED
|
@@ -1307,6 +1307,10 @@ export type PreparedAnthropicAccountAttempt = {
|
|
|
1307
1307
|
lastError: unknown;
|
|
1308
1308
|
authFailureMessage: string | null;
|
|
1309
1309
|
headers?: Record<string, string>;
|
|
1310
|
+
/** The upstream `anthropic-beta` carries a value the client asked for that
|
|
1311
|
+
* the proxy would not have sent itself. A rejection of it is then the
|
|
1312
|
+
* client's doing, and must not re-rank the pool for everyone. */
|
|
1313
|
+
clientSuppliedBetaForwarded?: boolean;
|
|
1310
1314
|
buildUpstreamBody?: AnthropicUpstreamBodyBuilder;
|
|
1311
1315
|
finalBodyStr?: string;
|
|
1312
1316
|
preparedContext?: ProxyPreparedContext<ClaudeRequest>;
|
|
@@ -3242,18 +3246,37 @@ export type ProxyStatusPrimaryAccount = {
|
|
|
3242
3246
|
label: string | null;
|
|
3243
3247
|
source: "configured" | "fallback";
|
|
3244
3248
|
};
|
|
3245
|
-
/**
|
|
3249
|
+
/**
|
|
3250
|
+
* Identity tuple captured from a genuine Claude Code client request body.
|
|
3251
|
+
*
|
|
3252
|
+
* Deliberately carries no prompt text. An earlier shape persisted the client's
|
|
3253
|
+
* "agent block" `system` text and replayed it as the system prompt of every
|
|
3254
|
+
* later non-Claude-Code request on the account, so one hostile request could
|
|
3255
|
+
* plant instructions into everyone else's sessions. The agent block is now a
|
|
3256
|
+
* compiled-in constant; `billingHeader` is stored only in its normalised
|
|
3257
|
+
* two-field form.
|
|
3258
|
+
*/
|
|
3246
3259
|
export type ClaudeSnapshotBody = {
|
|
3247
3260
|
metadataUserId?: string;
|
|
3248
3261
|
billingHeader?: string;
|
|
3249
|
-
agentBlock?: string;
|
|
3250
3262
|
sessionId?: string;
|
|
3251
3263
|
};
|
|
3264
|
+
/** The identity tuple plus one request-shape probe that is never persisted. */
|
|
3265
|
+
export type ClaudeSnapshotBodyProbe = ClaudeSnapshotBody & {
|
|
3266
|
+
hasAgentBlock?: boolean;
|
|
3267
|
+
};
|
|
3252
3268
|
/** Snapshot of headers and body from a Claude Code request, used for polyfill. */
|
|
3253
3269
|
export type ClaudeSnapshot = {
|
|
3254
3270
|
accountKey: string;
|
|
3255
3271
|
capturedAt: string;
|
|
3256
3272
|
source: "claude-code";
|
|
3273
|
+
/**
|
|
3274
|
+
* Set only by a capture that verified the client was Claude Code itself
|
|
3275
|
+
* (session header and `claude-cli/` user-agent). A snapshot without it was
|
|
3276
|
+
* written by a release whose heuristic any caller could satisfy, so its
|
|
3277
|
+
* identity tuple is not trusted and is dropped on load.
|
|
3278
|
+
*/
|
|
3279
|
+
capturedFrom?: "genuine-claude-code";
|
|
3257
3280
|
headers: Record<string, string>;
|
|
3258
3281
|
body?: ClaudeSnapshotBody;
|
|
3259
3282
|
};
|
|
@@ -3377,10 +3400,46 @@ export type ProxyRuntimeConfigStoreOptions = {
|
|
|
3377
3400
|
};
|
|
3378
3401
|
/** Runtime configuration provider captured by route factories. */
|
|
3379
3402
|
export type ProxyRuntimeConfigProvider = () => ProxyRequestRoutingSnapshot;
|
|
3403
|
+
/**
|
|
3404
|
+
* Inbound authentication for a mounted proxy route group.
|
|
3405
|
+
*
|
|
3406
|
+
* `token` is the bearer every caller must present (header
|
|
3407
|
+
* `x-neurolink-inbound-token`, or `Authorization: Bearer <token>`); when
|
|
3408
|
+
* omitted it is read from `NEUROLINK_PROXY_INBOUND_TOKEN`. With neither, the
|
|
3409
|
+
* routes serve any caller that reaches them, and the factory says so loudly
|
|
3410
|
+
* unless `allowUnauthenticated` records that the operator chose that
|
|
3411
|
+
* (loopback-only bind, or an authenticating reverse proxy in front).
|
|
3412
|
+
*/
|
|
3413
|
+
export type ProxyInboundAuthOptions = {
|
|
3414
|
+
token?: string;
|
|
3415
|
+
allowUnauthenticated?: boolean;
|
|
3416
|
+
};
|
|
3380
3417
|
/** Optional runtime configuration wiring for Claude proxy route factories. */
|
|
3381
3418
|
export type ClaudeProxyRouteRuntimeOptions = {
|
|
3382
3419
|
accountAllowlist?: AccountAllowlist;
|
|
3383
|
-
runtimeConfigProvider
|
|
3420
|
+
runtimeConfigProvider?: ProxyRuntimeConfigProvider;
|
|
3421
|
+
inboundAuth?: ProxyInboundAuthOptions;
|
|
3422
|
+
};
|
|
3423
|
+
/**
|
|
3424
|
+
* Whether a listener may bind where it was asked to.
|
|
3425
|
+
*
|
|
3426
|
+
* A non-loopback bind needs something in front of the pooled subscriptions:
|
|
3427
|
+
* the share gate (`NEUROLINK_PROXY_REQUIRE_GRANT`), an inbound token, or the
|
|
3428
|
+
* operator's explicit `allowUnauthenticated`.
|
|
3429
|
+
*/
|
|
3430
|
+
export type ProxyBindPolicyDecision = {
|
|
3431
|
+
allowed: true;
|
|
3432
|
+
warning?: string;
|
|
3433
|
+
} | {
|
|
3434
|
+
allowed: false;
|
|
3435
|
+
reason: string;
|
|
3436
|
+
};
|
|
3437
|
+
/** Inputs to the bind policy, resolved from flags and the environment. */
|
|
3438
|
+
export type ProxyBindPolicyInput = {
|
|
3439
|
+
host: string;
|
|
3440
|
+
inboundToken?: string;
|
|
3441
|
+
requireGrant: boolean;
|
|
3442
|
+
allowUnauthenticated: boolean;
|
|
3384
3443
|
};
|
|
3385
3444
|
/** Listener invoked after a new configuration generation is published. */
|
|
3386
3445
|
export type ProxyRuntimeConfigListener = (snapshot: ProxyRuntimeConfigSnapshot) => void;
|
package/dist/types/rag.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Tool } from "./tools.js";
|
|
2
2
|
import type { EmbedInput } from "./providers.js";
|
|
3
3
|
import type { DecisionCallerFn } from "./decision.js";
|
|
4
|
+
import type { AttachmentPolicy } from "./attachments.js";
|
|
4
5
|
/**
|
|
5
6
|
* RAG Type Definitions
|
|
6
7
|
*
|
|
@@ -500,6 +501,14 @@ export type LoaderOptions = {
|
|
|
500
501
|
export type WebLoaderOptions = LoaderOptions & {
|
|
501
502
|
/** Request timeout in milliseconds */
|
|
502
503
|
timeout?: number;
|
|
504
|
+
/**
|
|
505
|
+
* Attachment policy for the fetch: HTTPS-only and public hosts unless it
|
|
506
|
+
* says otherwise, redirects re-validated per hop. The environment-derived
|
|
507
|
+
* default applies when absent.
|
|
508
|
+
*/
|
|
509
|
+
attachmentPolicy?: AttachmentPolicy;
|
|
510
|
+
/** Cap on the fetched document in bytes. Default 25 MiB. */
|
|
511
|
+
maxBytes?: number;
|
|
503
512
|
/** Custom headers for request */
|
|
504
513
|
headers?: Record<string, string>;
|
|
505
514
|
/** Extract only main content (remove navigation, ads, etc.) */
|
|
@@ -21,4 +21,44 @@ export type SafeDownloadOptions = {
|
|
|
21
21
|
signal?: AbortSignal;
|
|
22
22
|
/** Optional HTTP transfer timeout (ms), covering headers and body after URL validation. Default: 60_000. */
|
|
23
23
|
timeoutMs?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Headers for the FIRST request only. Never replayed to a redirect target:
|
|
26
|
+
* a credential meant for one host must not be handed to the host it
|
|
27
|
+
* redirects to. Default: none.
|
|
28
|
+
*/
|
|
29
|
+
headers?: Record<string, string>;
|
|
30
|
+
/**
|
|
31
|
+
* How many redirect hops to follow, each re-validated by the SSRF guard and
|
|
32
|
+
* sent without the caller's headers. Default 0: a 3xx is refused, which is
|
|
33
|
+
* the server path's behaviour.
|
|
34
|
+
*/
|
|
35
|
+
maxRedirects?: number;
|
|
36
|
+
/** Accept `http:` as well as `https:`. Default false (HTTPS only). */
|
|
37
|
+
allowInsecure?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Skip the private/loopback/link-local/metadata range check. The connection
|
|
40
|
+
* is still pinned to the resolved addresses. Default false.
|
|
41
|
+
*/
|
|
42
|
+
allowPrivateNetwork?: boolean;
|
|
43
|
+
/** `HEAD` returns the headers with an empty body. Default `GET`. */
|
|
44
|
+
method?: "GET" | "HEAD";
|
|
45
|
+
};
|
|
46
|
+
/** `safeDownloadWithMeta()` — the body plus what the response said about it. */
|
|
47
|
+
export type SafeDownloadResult = {
|
|
48
|
+
buffer: Buffer;
|
|
49
|
+
/** `Content-Type` of the final response, `""` when absent. */
|
|
50
|
+
contentType: string;
|
|
51
|
+
/** `Content-Encoding` of the final response, `""` when absent. */
|
|
52
|
+
contentEncoding: string;
|
|
53
|
+
/** The URL that produced the body — differs from the request URL after a redirect. */
|
|
54
|
+
finalUrl: string;
|
|
55
|
+
/** Redirect hops that were followed. */
|
|
56
|
+
redirects: number;
|
|
57
|
+
};
|
|
58
|
+
/** Per-call switches for `validateAndResolveUrl()` / `assertSafeUrlForProxy()`. */
|
|
59
|
+
export type SsrfGuardOptions = {
|
|
60
|
+
/** Accept `http:` as well as `https:`. Default false. */
|
|
61
|
+
allowInsecure?: boolean;
|
|
62
|
+
/** Skip the blocked-range check (addresses are still resolved and returned). Default false. */
|
|
63
|
+
allowPrivateNetwork?: boolean;
|
|
24
64
|
};
|