Sign In

@vantio/cli

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vantio/cli - npm Package Compare versions

Comparing version
0.3.3
to
0.3.4
+64
-10
bin/interceptor.cjs
// [ ∅ VANTIO ] Open Core Interceptor — Observe Plane
// Injected at runtime by `vantio run node agent.js` via Node --require.
// Patches globalThis.fetch and Node http/https.request|get to intercept
// outbound LLM calls — zero code changes. Raw sockets, curl, and browser
// paths stay outside this wrap.
// Patches globalThis.fetch, undici.fetch (node:undici and the undici package),
// and Node http/https.request|get to intercept outbound LLM calls — zero code
// changes. Raw sockets, curl, undici.Client/request, and browser paths stay
// outside this wrap.
//

@@ -678,3 +679,3 @@ // Layer identity in the Vantio suite:

globalThis.fetch = async function vantioFetch(input, init) {
async function wrapFetch(backend, input, init) {
let hostname;

@@ -691,3 +692,3 @@ let port;

} catch {
return _originalFetch.call(this, input, init);
return backend.call(globalThis, input, init);
}

@@ -707,3 +708,3 @@

if (!inScope(hostname, port)) {
return _originalFetch.call(this, input, init);
return backend.call(globalThis, input, init);
}

@@ -721,3 +722,3 @@

try {
response = await _originalFetch.call(this, input, init);
response = await backend.call(globalThis, input, init);
} catch (err) {

@@ -803,3 +804,3 @@ const ts = new Date().toISOString();

} catch {
return _originalFetch.call(this, input, init);
return backend.call(globalThis, input, init);
}

@@ -811,3 +812,3 @@ if (plan.blocked) return plan.response;

const t0 = Date.now();
const response = await _originalFetch.call(this, plan.input, plan.init);
const response = await backend.call(globalThis, plan.input, plan.init);
const duration_ms = Math.max(0, Date.now() - t0);

@@ -874,4 +875,57 @@

return response;
}
globalThis.fetch = function vantioFetch(input, init) {
return wrapFetch(_originalFetch, input, init);
};
// OpenAI Node SDK and other agents often `import { fetch } from "undici"`
// (or pass undici.fetch) instead of globalThis.fetch. Same Gate path.
// Patch now if the package is already loaded, and again on first require —
// the agent usually loads undici after this interceptor.
(function patchUndiciFetch() {
function patchMod(mod) {
if (!mod || typeof mod.fetch !== "function") return;
if (mod.__vantioFetchPatched) return;
const orig = mod.fetch;
if (orig === globalThis.fetch) {
mod.__vantioFetchPatched = true;
return;
}
const backend = typeof orig.bind === "function" ? orig.bind(mod) : orig;
// Do not assign globalThis.fetch onto undici.fetch. Node's original
// fetch may re-enter the live undici export and recurse.
mod.fetch = function vantioUndiciFetch(input, init) {
return wrapFetch(backend, input, init);
};
mod.__vantioFetchPatched = true;
}
try {
const Module = require("module");
const origLoad = Module._load;
Module._load = function vantioLoad(request, parent, isMain) {
const exported = origLoad.apply(this, arguments);
if (request === "undici" || request === "node:undici") {
try {
patchMod(exported);
} catch {
/* fail open */
}
}
return exported;
};
} catch {
/* Module._load unavailable — still try an immediate require below */
}
for (const spec of ["node:undici", "undici"]) {
try {
patchMod(require(spec));
} catch {
/* optional — not installed until the agent requires it */
}
}
})();
// ── Run summary ─────────────────────────────────────────────────────────────

@@ -1262,3 +1316,3 @@

residual: {
note: "App plane covers fetch + Node http/https. Host Sight covers host egress observe. curl/raw sockets without Host Sight still dark until PE.",
note: "App plane covers fetch, undici.fetch, and Node http/https. Host Sight covers host egress observe. curl, raw sockets, undici.Client/request, and browsers stay outside this wrap until Phantom Engine on enrolled Linux.",
upgrade_gate: "https://vantio.ai/gate",

@@ -1265,0 +1319,0 @@ upgrade_enterprise: "https://vantio.ai/enterprise",

+2
-2
# Injected onto PYTHONPATH by `vantio run python …`.
# Optics (and Gate, when a paid key is present on SDK 3.0.3+) wrap urllib /
# requests / httpx for this interpreter. Missing SDK is a warning, not a crash.
# Optics (and Gate, when a paid key is present on SDK 3.0.4+) wrap urllib /
# requests / httpx / aiohttp for this interpreter. Missing SDK is a warning, not a crash.
import sys

@@ -5,0 +5,0 @@

{
"name": "@vantio/cli",
"version": "0.3.3",
"version": "0.3.4",
"description": "Vantio Optics CLI — wrap any AI agent and observe LLM egress. Blind by design, not a proxy. Sight Loop: wrap → capture → inspect.",

@@ -13,3 +13,5 @@ "license": "MIT",

},
"bugs": { "url": "https://github.com/vantioai/vantio-open-core/issues" },
"bugs": {
"url": "https://github.com/vantioai/vantio-open-core/issues"
},
"keywords": [

@@ -33,10 +35,15 @@ "vantio",

},
"files": ["bin"],
"files": [
"bin"
],
"engines": {
"node": ">=18.3.0"
},
"devDependencies": {
"undici": "^6.21.3"
},
"scripts": {
"lint": "node --check bin/vantio.js && node --check bin/interceptor.cjs && node --check bin/telemetry.cjs && node --check bin/llm-hosts.cjs",
"test": "node --test"
},
"engines": {
"node": ">=18.3.0"
}
}
}
# @vantio/cli
> Wrap any AI agent with **Vantio Optics** — free visibility into what it sends. Zero code changes.
[![npm](https://img.shields.io/npm/v/@vantio/cli.svg)](https://www.npmjs.com/package/@vantio/cli)
> Wrap any AI agent with **Vantio Optics** — free visibility into what it sends. Zero code changes. Current npm release: **0.3.4**.
```bash

@@ -47,3 +49,3 @@ npm install -g @vantio/cli

Wrap any process with `vantio run`. The CLI automatically intercepts every outbound call to a known LLM API — OpenAI, Anthropic, Gemini, Cohere, Mistral, and more — and records connection metadata locally (and to Gate when a key is configured).
Wrap any Node process with `vantio run`. The CLI intercepts outbound calls to known LLM APIs via Node `fetch`, `undici.fetch`, and Node `http`/`https`, and records connection metadata locally (and to Gate when a key is configured). For Python, install `vantio-agent-sdk` and run `vantio run python agent.py` — same wrap, no script edit. `shield()` is optional when you want a trace id inside the process.

@@ -137,5 +139,5 @@ Your code doesn't change. Your agent runs normally. If you've run `vantio login`, the stored key is injected into the child process; an explicit `VANTIO_API_KEY` in your environment always takes precedence.

## Enforcement (Vantio Pro)
## Enforcement (Vantio Gate)
With a Pro `VANTIO_API_KEY`, the interceptor fetches policy from the [Vantio Pro](https://github.com/vantioai/vantio-pro) control plane and enforces it locally in your process. A few semantics worth knowing:
With a Gate `VANTIO_API_KEY`, the interceptor fetches policy from the [Vantio Gate](https://github.com/vantioai/vantio-pro) control plane and enforces it locally in your process. A few semantics worth knowing:

@@ -166,5 +168,5 @@ - **Host scope** — policy applies to known LLM hosts plus any host named in `blocked_hosts`/`allowed_hosts`. `blocked_hosts` blocks **any** matching host (LLM or not); a non-empty `allowed_hosts` blocks any in-scope host not on the list. Unrelated traffic (OS, package managers, etc.) is never touched.

Auto-intercepts LLM calls when running **Node.js** processes (`node`, `tsx`, `ts-node`, `npx`).
Auto-intercepts LLM calls when running **Node.js** processes (`node`, `tsx`, `ts-node`, `npx`) — Node `fetch`, `undici.fetch`, and Node `http`/`https`. Current npm release: **`@vantio/cli` 0.3.4**.
Python, Ruby, and other runtimes are spawned normally without interception — use the [Python SDK](https://pypi.org/project/vantio-agent-sdk) for those.
Python, Ruby, and other runtimes are spawned normally without this interceptor — use the [Python SDK](https://pypi.org/project/vantio-agent-sdk) (`vantio-agent-sdk` **3.0.4**, `shield()`) for Python urllib / requests / httpx / aiohttp.

@@ -175,4 +177,6 @@ ---

`api.openai.com` · `api.anthropic.com` · `generativelanguage.googleapis.com` · `api.cohere.ai` · `api.mistral.ai` · `api.groq.com` · `api.together.xyz` · `api.perplexity.ai` · `inference.ai.azure.com`
OpenAI (including regional), Anthropic, Google Gemini, Azure OpenAI, Azure AI, Cohere, Mistral, Groq, Together AI, Perplexity, xAI, DeepSeek, Fireworks, OpenRouter, Cerebras, Voyage AI, SambaNova, DeepInfra, Amazon Bedrock, Google Vertex AI, Hugging Face Inference, Replicate, Ollama, hosted NVIDIA NIM.
curl, raw sockets, and browser paths stay outside this wrap. Phantom Engine is the Linux-host product when you need protection beneath the app wrap.
---

@@ -179,0 +183,0 @@