Skip to content

JS SDK: make the ORT / ORT-GenAI NuGet feed configurable, with authenticated private-feed support - #945

Open
baijumeswani wants to merge 3 commits into
baijumeswani/upgrade-packagesfrom
baijumeswani/configurable-feed
Open

JS SDK: make the ORT / ORT-GenAI NuGet feed configurable, with authenticated private-feed support#945
baijumeswani wants to merge 3 commits into
baijumeswani/upgrade-packagesfrom
baijumeswani/configurable-feed

Conversation

@baijumeswani

Copy link
Copy Markdown
Collaborator

Summary

The JavaScript SDK downloads the ONNX Runtime and ORT-GenAI native binaries from NuGet during npm install (via sdk_v2/js/script/install-native.cjs). Until now those feeds were hard-coded to public NuGet endpoints. Partner teams with locked-down packaging pipelines cannot reach public feeds — they mirror everything through internal, authenticated feeds — so their npm install failed at this step. This PR makes the feed configurable and adds first-class support for authenticated private feeds, without changing the default behavior for everyone else.

What changed

The installer now supports three explicit modes, selected with FOUNDRY_LOCAL_NUGET_MODE:

  • http (default) — the original behavior: talk to the NuGet v3 HTTP protocol directly (service index -> PackageBaseAddress -> .nupkg) using Node's built-in https, with no external tooling. Feeds are queried anonymously and redirects are followed. This is unchanged for existing users who don't set anything.
  • dotnet — shell out to dotnet restore against a throwaway net8.0 project. This is the cross-platform path for a private feed whose authentication is wired through the .NET credential-provider ecosystem (for example the Azure Artifacts Credential Provider) or a NuGet.config. It needs only the .NET SDK.
  • nuget — shell out to nuget.exe install (or a nuget on PATH) once per package. This covers feeds whose authentication is supplied by a NuGet / Visual Studio credential provider that dotnet restore cannot host — for example a netfx-only provider plugin. nuget.exe on Windows can invoke those plugins.

Authentication is deliberately delegated to the NuGet tooling in dotnet and nuget mode (a NuGet.config and/or an installed credential provider). No credentials pass through the install script itself. This keeps the install script small and moves the credential burden onto the standard, already-audited NuGet auth mechanisms the partner teams already operate.

New environment variables (all optional; defaults preserve today's behavior):

  • FOUNDRY_LOCAL_NUGET_MODEhttp (default), dotnet, or nuget.
  • FOUNDRY_LOCAL_NUGET_FEEDS;-separated NuGet v3 service index URLs; replaces the public defaults entirely. http mode requires HTTPS.
  • FOUNDRY_LOCAL_NUGET_CONFIG — path to a NuGet.config (used by dotnet and nuget mode; when set, the config owns the package sources).
  • FOUNDRY_LOCAL_DOTNET_COMMAND — override the dotnet executable (dotnet mode).
  • FOUNDRY_LOCAL_NUGET_COMMAND — override the nuget executable (nuget mode).
  • FOUNDRY_LOCAL_SKIP_INSTALL=1 — unchanged escape hatch to skip the download entirely (used by source builds that copy binaries separately).

Cross-mode misuse (for example setting a nuget-only variable while in dotnet mode) is rejected early with a clear error, so misconfiguration fails fast instead of silently doing the wrong thing. URLs in logs and error messages have their query strings and fragments stripped so that SAS tokens or similar secrets embedded in redirect targets are never printed.

@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
foundry-local Ready Ready Preview Aug 4, 2026 6:04pm

Request Review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds configurable NuGet feeds and authenticated private-feed support to the JS SDK native runtime installer.

Changes:

  • Adds HTTP, dotnet restore, and NuGet CLI installation modes.
  • Adds configuration validation, URL redaction, and installer tests.
  • Documents installation modes and environment variables.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
sdk_v2/js/script/install-native.cjs Implements configurable installation modes.
sdk_v2/js/test/install-native.test.ts Tests installer configuration and helpers.
sdk_v2/js/README.md Documents private-feed configuration.
sdk_v2/js/docs/PortJsToSdkV2.md Updates the SDK architecture plan.
Suppressed comments (5)

sdk_v2/js/README.md:214

  • When FOUNDRY_LOCAL_NUGET_CONFIG is set, the feed environment variable is ignored, so this example does not use the shown URL. Remove the assignment or put the source in the NuGet.config example.
export FOUNDRY_LOCAL_NUGET_MODE=dotnet
export FOUNDRY_LOCAL_NUGET_FEEDS="https://pkgs.dev.azure.com/my-org/_packaging/my-feed/nuget/v3/index.json"
export FOUNDRY_LOCAL_NUGET_CONFIG=/etc/secrets/NuGet.config

sdk_v2/js/script/install-native.cjs:418

  • This added error-message line exceeds the JS SDK's 120-character limit.
          `dotnet command not found: '${config.dotnetCommand}'. Install the .NET SDK or set FOUNDRY_LOCAL_DOTNET_COMMAND.`,

sdk_v2/js/script/install-native.cjs:507

  • This added error-message line exceeds the JS SDK's 120-character limit.
            `nuget command not found: '${config.nugetCommand}'. Install the NuGet CLI or set FOUNDRY_LOCAL_NUGET_COMMAND.`,

sdk_v2/js/script/install-native.cjs:515

  • This added error-message line exceeds the JS SDK's 120-character limit.
          `nuget install failed for ${artifact.name} ${artifact.version} (exit ${result.status}).\n${redactUrlsInText(output)}`.trim(),

sdk_v2/js/test/install-native.test.ts:390

  • This test name exceeds the JS SDK's 120-character limit.
  it("does not redact URLs in the args themselves (spawnSync needs the real feed) but redaction still strips them if logged", () => {

Comment thread sdk_v2/js/script/install-native.cjs
Comment thread sdk_v2/js/README.md
Comment thread sdk_v2/js/script/install-native.cjs
Comment thread sdk_v2/js/test/install-native.test.ts Outdated
@baijumeswani
baijumeswani force-pushed the baijumeswani/upgrade-packages branch 2 times, most recently from 11f6146 to 4d37878 Compare August 4, 2026 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants