@juspay/neurolink 9.44.1 → 9.48.1
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 +42 -0
- package/README.md +230 -5
- package/dist/auth/tokenStore.js +4 -2
- package/dist/browser/neurolink.min.js +147 -147
- package/dist/cli/commands/proxy.js +25 -2
- package/dist/cli/factories/commandFactory.js +7 -1
- package/dist/lib/auth/tokenStore.js +4 -2
- package/dist/lib/types/index.d.ts +1 -1
- package/dist/lib/types/index.js +2 -2
- package/dist/lib/utils/imageProcessor.d.ts +24 -1
- package/dist/lib/utils/imageProcessor.js +124 -8
- package/dist/lib/utils/messageBuilder.js +18 -6
- package/dist/types/index.js +2 -2
- package/dist/utils/imageProcessor.js +124 -8
- package/dist/utils/messageBuilder.js +18 -6
- package/package.json +1 -1
- package/scripts/observability/manage-local-openobserve.sh +30 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
+
## [9.48.1](https://github.com/juspay/neurolink/compare/v9.48.0...v9.48.1) (2026-04-06)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- **(types):** update index to export directly from multimodal (fixes [#275](https://github.com/juspay/neurolink/issues/275)) ([739ad2a](https://github.com/juspay/neurolink/commit/739ad2aa91d9766f098bb7d804de6fbb00d1c9d8))
|
|
6
|
+
|
|
7
|
+
## [9.48.0](https://github.com/juspay/neurolink/compare/v9.47.0...v9.48.0) (2026-04-05)
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
- **(docs):** generate unique OG images per page for rich social previews ([cb1998d](https://github.com/juspay/neurolink/commit/cb1998d5f4c57e17c1b7a7619516f98020112afe))
|
|
12
|
+
|
|
13
|
+
## [9.47.0](https://github.com/juspay/neurolink/compare/v9.46.1...v9.47.0) (2026-04-04)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
- **(observability):** auto-write OTEL endpoint to ~/.neurolink/.env on telemetry setup ([a6e56f3](https://github.com/juspay/neurolink/commit/a6e56f392b66005bbd4bbfeeff952aefebf172d4))
|
|
18
|
+
|
|
19
|
+
## [9.46.1](https://github.com/juspay/neurolink/compare/v9.46.0...v9.46.1) (2026-04-04)
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
- **(proxy):** PID-scoped token store temp files and dynamic launchd PATH ([dc63fa8](https://github.com/juspay/neurolink/commit/dc63fa80690d214105ccc42705bac7b821395b52))
|
|
24
|
+
|
|
25
|
+
## [9.46.0](https://github.com/juspay/neurolink/compare/v9.45.0...v9.46.0) (2026-04-04)
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
- **(image):** add extension whitelist validation utilities (IMG-021) ([1cfdf30](https://github.com/juspay/neurolink/commit/1cfdf30aeb57ea3566ad4c4837de6f27228514ae))
|
|
30
|
+
|
|
31
|
+
## [9.45.0](https://github.com/juspay/neurolink/compare/v9.44.1...v9.45.0) (2026-04-04)
|
|
32
|
+
|
|
33
|
+
### Features
|
|
34
|
+
|
|
35
|
+
- **(image):** implement JPEG dimension extraction via SOF marker parsing ([9fac5cb](https://github.com/juspay/neurolink/commit/9fac5cb883fcd1a3550160ecc546146ccc3a3407))
|
|
36
|
+
|
|
37
|
+
### Bug Fixes
|
|
38
|
+
|
|
39
|
+
- **(ci):** pin npm to v10 instead of latest in release workflow ([357ccf3](https://github.com/juspay/neurolink/commit/357ccf36b8a038a29b11b67988b3c30192fcc636))
|
|
40
|
+
- **(mb):** Make text optional when multimodal content present ([ae12580](https://github.com/juspay/neurolink/commit/ae125808cc9853e56ef62957210332da702695e4))
|
|
41
|
+
- **(utils):** add content-length:0 validation in URL downloader ([8fcb795](https://github.com/juspay/neurolink/commit/8fcb795e28fb3687341eb4e3853479a1bdc2d7f7)), closes [#549](https://github.com/juspay/neurolink/issues/549)
|
|
42
|
+
|
|
1
43
|
## [9.44.1](https://github.com/juspay/neurolink/compare/v9.44.0...v9.44.1) (2026-04-03)
|
|
2
44
|
|
|
3
45
|
## [9.44.0](https://github.com/juspay/neurolink/compare/v9.43.0...v9.44.0) (2026-04-02)
|
package/README.md
CHANGED
|
@@ -150,17 +150,242 @@ const result = await neurolink.generate({
|
|
|
150
150
|
|
|
151
151
|
**[Enterprise HITL Guide](docs/features/enterprise-hitl.md)** | **[Quick Start](docs/features/hitl.md)**
|
|
152
152
|
|
|
153
|
-
##
|
|
153
|
+
## 📚 Quick Start Guide
|
|
154
|
+
|
|
155
|
+
This guide will have you generating AI responses in under 5 minutes using either the SDK or CLI.
|
|
156
|
+
|
|
157
|
+
### Installation
|
|
158
|
+
|
|
159
|
+
Choose your preferred package manager:
|
|
154
160
|
|
|
155
161
|
```bash
|
|
156
|
-
#
|
|
162
|
+
# npm
|
|
163
|
+
npm install @juspay/neurolink
|
|
164
|
+
|
|
165
|
+
# pnpm (recommended)
|
|
166
|
+
pnpm add @juspay/neurolink
|
|
167
|
+
|
|
168
|
+
# yarn
|
|
169
|
+
yarn add @juspay/neurolink
|
|
170
|
+
|
|
171
|
+
# CLI only (no installation needed)
|
|
172
|
+
npx @juspay/neurolink --help
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Configuration
|
|
176
|
+
|
|
177
|
+
NeuroLink works with 13+ AI providers. You'll need at least one API key to get started:
|
|
178
|
+
|
|
179
|
+
**Option 1: Interactive Setup (Recommended)**
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# Run the setup wizard to configure providers
|
|
157
183
|
pnpm dlx @juspay/neurolink setup
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
The wizard will guide you through:
|
|
187
|
+
|
|
188
|
+
- Selecting your preferred AI providers
|
|
189
|
+
- Validating API keys
|
|
190
|
+
- Setting up configuration files
|
|
191
|
+
|
|
192
|
+
**Option 2: Manual Configuration**
|
|
193
|
+
|
|
194
|
+
Create a `.env` file in your project root:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# Choose one or more providers
|
|
198
|
+
OPENAI_API_KEY=sk-...
|
|
199
|
+
ANTHROPIC_API_KEY=sk-ant-...
|
|
200
|
+
GOOGLE_AI_API_KEY=...
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
**Free Tier Options:**
|
|
204
|
+
|
|
205
|
+
- **Google AI Studio**: Get a free API key at [aistudio.google.com](https://aistudio.google.com)
|
|
206
|
+
- **Mistral AI**: Free tier available at [console.mistral.ai](https://console.mistral.ai)
|
|
207
|
+
- **Ollama**: 100% free local models (requires [Ollama installation](https://ollama.ai))
|
|
208
|
+
|
|
209
|
+
### Your First API Call (SDK)
|
|
210
|
+
|
|
211
|
+
**Basic Text Generation:**
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
import { NeuroLink } from "@juspay/neurolink";
|
|
215
|
+
|
|
216
|
+
// Initialize (auto-selects best available provider from your .env)
|
|
217
|
+
const neurolink = new NeuroLink();
|
|
218
|
+
|
|
219
|
+
// Generate a response
|
|
220
|
+
const result = await neurolink.generate({
|
|
221
|
+
input: { text: "Explain quantum computing in simple terms" },
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
console.log(result.content);
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
**Streaming Responses:**
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
// Stream tokens in real-time
|
|
231
|
+
const stream = await neurolink.stream({
|
|
232
|
+
input: { text: "Write a haiku about code" },
|
|
233
|
+
});
|
|
234
|
+
for await (const chunk of stream.stream) {
|
|
235
|
+
if ("content" in chunk) process.stdout.write(chunk.content);
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
**Multimodal Input (Images + Text):**
|
|
240
|
+
|
|
241
|
+
```typescript
|
|
242
|
+
const result = await neurolink.generate({
|
|
243
|
+
input: {
|
|
244
|
+
text: "What's in this image?",
|
|
245
|
+
images: ["./photo.jpg"],
|
|
246
|
+
},
|
|
247
|
+
});
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
**Using Tools:**
|
|
251
|
+
|
|
252
|
+
```typescript
|
|
253
|
+
// Built-in tools are automatically available
|
|
254
|
+
const result = await neurolink.generate({
|
|
255
|
+
input: {
|
|
256
|
+
text: "What time is it and what files are in the current directory?",
|
|
257
|
+
},
|
|
258
|
+
// AI can call getCurrentTime and listDirectory tools
|
|
259
|
+
});
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Your First API Call (CLI)
|
|
263
|
+
|
|
264
|
+
**Basic Generation:**
|
|
158
265
|
|
|
159
|
-
|
|
160
|
-
|
|
266
|
+
```bash
|
|
267
|
+
# Simple text generation
|
|
268
|
+
npx @juspay/neurolink generate "Explain TypeScript generics"
|
|
269
|
+
|
|
270
|
+
# Specify provider and model
|
|
271
|
+
npx @juspay/neurolink generate "Hello!" --provider openai --model gpt-4o
|
|
272
|
+
|
|
273
|
+
# Stream responses
|
|
274
|
+
npx @juspay/neurolink stream "Write a story about AI" --provider anthropic
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
**Multimodal Input:**
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
# Analyze images
|
|
281
|
+
npx @juspay/neurolink generate "Describe this image" --image photo.jpg
|
|
282
|
+
|
|
283
|
+
# Process PDFs
|
|
284
|
+
npx @juspay/neurolink generate "Summarize this document" --pdf report.pdf
|
|
285
|
+
|
|
286
|
+
# Combine multiple file types
|
|
287
|
+
npx @juspay/neurolink generate "Analyze this data" --file data.xlsx --file config.json
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
**Interactive Loop Mode:**
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
# Start an interactive session with persistent context
|
|
294
|
+
npx @juspay/neurolink loop
|
|
295
|
+
|
|
296
|
+
# Inside loop mode:
|
|
297
|
+
> set provider anthropic
|
|
298
|
+
> set model claude-opus-4
|
|
299
|
+
> generate "Hello, Claude!"
|
|
300
|
+
> history # View conversation history
|
|
301
|
+
> exit
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Common Use Cases
|
|
305
|
+
|
|
306
|
+
**RAG (Retrieval-Augmented Generation):**
|
|
307
|
+
|
|
308
|
+
```typescript
|
|
309
|
+
// Automatically chunk, embed, and search documents
|
|
310
|
+
const result = await neurolink.generate({
|
|
311
|
+
input: { text: "What are the key features mentioned in the documentation?" },
|
|
312
|
+
rag: {
|
|
313
|
+
files: ["./docs/guide.md", "./docs/api.md"],
|
|
314
|
+
chunkSize: 512,
|
|
315
|
+
topK: 5,
|
|
316
|
+
},
|
|
317
|
+
});
|
|
161
318
|
```
|
|
162
319
|
|
|
163
|
-
|
|
320
|
+
**Structured Output with Zod:**
|
|
321
|
+
|
|
322
|
+
```typescript
|
|
323
|
+
import { z } from "zod";
|
|
324
|
+
|
|
325
|
+
const schema = z.object({
|
|
326
|
+
name: z.string(),
|
|
327
|
+
age: z.number(),
|
|
328
|
+
email: z.string().email(),
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
const result = await neurolink.generate({
|
|
332
|
+
input: {
|
|
333
|
+
text: "Extract user info: John Doe, 30 years old, john@example.com",
|
|
334
|
+
},
|
|
335
|
+
schema,
|
|
336
|
+
output: { format: "json" },
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
// Parse the structured JSON from result.content
|
|
340
|
+
const parsed = schema.parse(JSON.parse(result.content));
|
|
341
|
+
console.log(parsed); // { name: "John Doe", age: 30, email: "john@example.com" }
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
**External MCP Servers (GitHub, Slack, etc.):**
|
|
345
|
+
|
|
346
|
+
```typescript
|
|
347
|
+
// Connect to GitHub MCP server
|
|
348
|
+
await neurolink.addExternalMCPServer("github", {
|
|
349
|
+
command: "npx",
|
|
350
|
+
args: ["-y", "@modelcontextprotocol/server-github"],
|
|
351
|
+
transport: "stdio",
|
|
352
|
+
env: { GITHUB_TOKEN: process.env.GITHUB_TOKEN },
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
// AI can now interact with GitHub
|
|
356
|
+
const result = await neurolink.generate({
|
|
357
|
+
input: { text: 'Create an issue titled "Bug: login fails"' },
|
|
358
|
+
});
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
### Next Steps
|
|
362
|
+
|
|
363
|
+
- **[Complete Documentation](https://docs.neurolink.ink)** - Comprehensive guides and API reference
|
|
364
|
+
- **[Provider Setup Guide](docs/getting-started/provider-setup.md)** - Configure all 13 providers
|
|
365
|
+
- **[SDK API Reference](docs/sdk/api-reference.md)** - Full TypeScript API documentation
|
|
366
|
+
- **[CLI Command Reference](docs/cli/commands.md)** - Complete CLI documentation
|
|
367
|
+
- **[Example Projects](docs/examples/index.md)** - Real-world integration examples
|
|
368
|
+
- **[Advanced Features](docs/advanced/index.md)** - Middleware, observability, workflows
|
|
369
|
+
|
|
370
|
+
### Troubleshooting
|
|
371
|
+
|
|
372
|
+
**Issue: "Provider not configured"**
|
|
373
|
+
|
|
374
|
+
- Run `npx @juspay/neurolink setup` or add provider API key to `.env`
|
|
375
|
+
|
|
376
|
+
**Issue: Rate limit errors**
|
|
377
|
+
|
|
378
|
+
- Configure multiple providers for redundancy — NeuroLink auto-selects the best available
|
|
379
|
+
- Use `provider: "litellm"` with LiteLLM to proxy across many providers
|
|
380
|
+
|
|
381
|
+
**Issue: Large context overflows**
|
|
382
|
+
|
|
383
|
+
- Enable conversation memory with compaction: `new NeuroLink({ conversationMemory: { enabled: true } })`
|
|
384
|
+
- Use `rag` option to search documents instead of sending full content
|
|
385
|
+
|
|
386
|
+
Need help? Check our [Troubleshooting Guide](docs/reference/troubleshooting.md) or [open an issue](https://github.com/juspay/neurolink/issues).
|
|
387
|
+
|
|
388
|
+
---
|
|
164
389
|
|
|
165
390
|
## 🌟 Complete Feature Set
|
|
166
391
|
|
package/dist/auth/tokenStore.js
CHANGED
|
@@ -148,7 +148,8 @@ export class TokenStore {
|
|
|
148
148
|
? this.obfuscate(JSON.stringify(storageData))
|
|
149
149
|
: JSON.stringify(storageData, null, 2);
|
|
150
150
|
// Write to temporary file first for atomic operation
|
|
151
|
-
|
|
151
|
+
// Use PID-scoped temp file to avoid cross-process race conditions
|
|
152
|
+
const tempPath = `${this.storagePath}.tmp.${process.pid}`;
|
|
152
153
|
await writeFile(tempPath, content, "utf-8");
|
|
153
154
|
// Set restrictive permissions before moving to final location
|
|
154
155
|
await chmod(tempPath, TokenStore.FILE_PERMISSIONS);
|
|
@@ -681,7 +682,8 @@ export class TokenStore {
|
|
|
681
682
|
const content = this.encryptionEnabled
|
|
682
683
|
? this.obfuscate(JSON.stringify(data))
|
|
683
684
|
: JSON.stringify(data, null, 2);
|
|
684
|
-
|
|
685
|
+
// Use PID-scoped temp file to avoid cross-process race conditions
|
|
686
|
+
const tmpPath = `${this.storagePath}.tmp.${process.pid}`;
|
|
685
687
|
await writeFile(tmpPath, content, "utf-8");
|
|
686
688
|
await chmod(tmpPath, TokenStore.FILE_PERMISSIONS);
|
|
687
689
|
await rename(tmpPath, this.storagePath);
|