@juspay/neurolink 12.26.2 → 12.26.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/dist/cli/index.js CHANGED
@@ -10,6 +10,7 @@ process.env.DOTENV_CONFIG_QUIET = "true";
10
10
  import { initializeCliParser } from "./parser.js";
11
11
  import chalk from "chalk";
12
12
  import { initializeCliLifecycle, cleanupCliLifecycle } from "./lifecycle.js";
13
+ import { loadProcessDotenv } from "../utils/dotenvBootstrap.js";
13
14
  // Clean up pnpm-specific environment variables that cause npm warnings
14
15
  // These variables are set by pnpm but cause "Unknown env config" warnings in npm
15
16
  if (process.env.npm_config_verify_deps_before_run) {
@@ -18,17 +19,11 @@ if (process.env.npm_config_verify_deps_before_run) {
18
19
  if (process.env.npm_config__jsr_registry) {
19
20
  delete process.env.npm_config__jsr_registry;
20
21
  }
21
- // Load environment variables from .env file
22
- // Suppress dotenv v17's stdout banner before importing — it pollutes CLI JSON output
23
- process.env.DOTENV_CONFIG_QUIET = "true";
24
- try {
25
- const { config } = await import("dotenv");
26
- config({ quiet: true });
27
- }
28
- catch {
29
- // dotenv is not available (dev dependency only) - this is fine for production
30
- // Environment variables should be set externally in production
31
- }
22
+ // Load environment variables from .env file. Shared with the SDK entry
23
+ // point; see dotenvBootstrap for why DOTENV_CONFIG_PATH has to be honoured
24
+ // here too — a suite that drives the built CLI inherits the stripped
25
+ // environment, and this is the process that would otherwise undo it.
26
+ await loadProcessDotenv();
32
27
  // Enhanced CLI with Professional UX
33
28
  const cli = initializeCliParser();
34
29
  initializeCliLifecycle(async () => {
package/dist/neurolink.js CHANGED
@@ -5,16 +5,12 @@
5
5
  * Enhanced AI provider system with natural MCP tool access.
6
6
  * Uses real MCP infrastructure for tool discovery and execution.
7
7
  */
8
- // Load environment variables from .env file (critical for SDK usage)
9
- // Suppress dotenv v17 stdout banner — it pollutes CLI JSON output
10
- try {
11
- process.env.DOTENV_CONFIG_QUIET = process.env.DOTENV_CONFIG_QUIET ?? "true";
12
- const { config: dotenvConfig } = await import("dotenv");
13
- dotenvConfig({ quiet: true });
14
- }
15
- catch {
16
- // Environment variables should be set externally in production
17
- }
8
+ // Load environment variables from .env file (critical for SDK usage).
9
+ // Shared with the CLI so the two implicit loads cannot drift apart again.
10
+ // Neither honoured DOTENV_CONFIG_PATH, and they had already drifted in how
11
+ // each suppressed dotenv's banner — one conditional, one unconditional.
12
+ import { loadProcessDotenv } from "./utils/dotenvBootstrap.js";
13
+ await loadProcessDotenv();
18
14
  import { SpanKind, SpanStatusCode, context, trace } from "@opentelemetry/api";
19
15
  import { AsyncLocalStorage } from "async_hooks";
20
16
  import { EventEmitter } from "events";
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Implicit `.env` bootstrap, shared by the SDK entry point and the CLI.
3
+ *
4
+ * Both sites used to call dotenv's `config()` with no options beyond
5
+ * `quiet`, and a direct `config()` call does NOT read `DOTENV_CONFIG_PATH`
6
+ * — only dotenv's own `dotenv/config` preload entry does. So the strip this
7
+ * repo documents and uses to vet suites,
8
+ *
9
+ * env -i HOME=… PATH=… CI=true DOTENV_CONFIG_PATH=/dev/null …
10
+ *
11
+ * stripped nothing the moment a suite imported the built SDK: importing
12
+ * `dist/index.js` loads `src/lib/neurolink.ts`, which loaded `.env` from the
13
+ * working directory regardless. A credential the strip was supposed to
14
+ * remove was present at every read site, and a suite that only passes
15
+ * because of it looks identical to one that does not need it. See #1744;
16
+ * the CI-only failure in #1735 is what surfaced it.
17
+ *
18
+ * Honouring the variable here makes that strip real. It is additive: with
19
+ * `DOTENV_CONFIG_PATH` unset — which is every existing caller, SDK consumers
20
+ * included — this does exactly what it did before, loading `.env` from the
21
+ * current working directory. Only a caller that explicitly sets the variable
22
+ * sees a difference, and what it then sees is dotenv's own documented
23
+ * meaning for it.
24
+ */
25
+ export declare function loadProcessDotenv(): Promise<void>;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Implicit `.env` bootstrap, shared by the SDK entry point and the CLI.
3
+ *
4
+ * Both sites used to call dotenv's `config()` with no options beyond
5
+ * `quiet`, and a direct `config()` call does NOT read `DOTENV_CONFIG_PATH`
6
+ * — only dotenv's own `dotenv/config` preload entry does. So the strip this
7
+ * repo documents and uses to vet suites,
8
+ *
9
+ * env -i HOME=… PATH=… CI=true DOTENV_CONFIG_PATH=/dev/null …
10
+ *
11
+ * stripped nothing the moment a suite imported the built SDK: importing
12
+ * `dist/index.js` loads `src/lib/neurolink.ts`, which loaded `.env` from the
13
+ * working directory regardless. A credential the strip was supposed to
14
+ * remove was present at every read site, and a suite that only passes
15
+ * because of it looks identical to one that does not need it. See #1744;
16
+ * the CI-only failure in #1735 is what surfaced it.
17
+ *
18
+ * Honouring the variable here makes that strip real. It is additive: with
19
+ * `DOTENV_CONFIG_PATH` unset — which is every existing caller, SDK consumers
20
+ * included — this does exactly what it did before, loading `.env` from the
21
+ * current working directory. Only a caller that explicitly sets the variable
22
+ * sees a difference, and what it then sees is dotenv's own documented
23
+ * meaning for it.
24
+ */
25
+ export async function loadProcessDotenv() {
26
+ try {
27
+ // Suppress dotenv v17's stdout banner — it pollutes CLI JSON output.
28
+ // Redundant next to the explicit `quiet` below, which is what actually
29
+ // silences a direct `config()` call; kept because both call sites set it
30
+ // and something downstream may still read it.
31
+ process.env.DOTENV_CONFIG_QUIET = process.env.DOTENV_CONFIG_QUIET ?? "true";
32
+ const { config } = await import("dotenv");
33
+ const path = process.env.DOTENV_CONFIG_PATH;
34
+ // Pass `path` only when set: `{ path: undefined }` is not the same as
35
+ // omitting it for every dotenv version, and the default must stay
36
+ // byte-for-byte what it was.
37
+ config(path ? { quiet: true, path } : { quiet: true });
38
+ }
39
+ catch {
40
+ // dotenv ships as a normal runtime dependency (see package.json), so this
41
+ // branch should not be reachable in a standard install. It stays as a
42
+ // defensive fallback for an install that has pruned or bundled
43
+ // dependencies unusually, so a missing module degrades to "no .env
44
+ // loaded" instead of crashing the SDK/CLI entry point.
45
+ }
46
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "12.26.2",
3
+ "version": "12.26.3",
4
4
  "packageManager": "pnpm@10.15.1",
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": {