Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

@vite-hub/agent

Latest version: v0.6.1

Overview

Last scanned
27 Nov 2026
Published
27 Nov 2026
npm package Publisher: onmax_
36 Stars
4 Forks
9 Versions
8.9K Downloads
TypeScript Repo language

Scan summary

@vite-hub/agent was last scanned on 27 Nov 2026 at version 0.6.1. Risk score 0 of 100. High-severity rules fired.

  • Releases: 9 versions; the latest 4 were published within 4 days (24–27 Nov 2026).
  • Findings: 1 rule fired in version 0.6.1 (1 high). The score describes this version only.
  • Downloads: 8,934 downloads.

Versions

9 versions published
Versions and the rules that fired in each
VersionPublishedStatus
0.6.1 LATEST 27 Nov 2026 1 rule fired
0.6.0 26 Nov 2026 1 rule fired
0.5.1 25 Nov 2026 1 rule fired
0.5.0 24 Nov 2026 Not shown
0.4.1 20 Nov 2026 Not shown

Rules fired in 0.6.1: 1

Findings

1 High

Findings for v0.6.1. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

Several suspicious behaviors form a known attack pattern

Several behaviors that are each common on their own, such as reading registry credentials, contacting a variable host or running shell commands, appear together in this package in a combination associated with attacks. The finding message lists the behaviors that were combined.

HIGH
Checking access…

🔒 Create a free account to see all 1 finding with descriptions and instance counts

The score describes 0.6.1; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

@vite-hub/agent

@vite-hub/agent defines Agents from files such as server/agents/support/agent.ts. Each Agent selects one Driver: an AI SDK model, a built-in coding provider, typed TypeSafe Jev questions, application-owned driver.run logic, or driver: "external" for an Agent that a process outside the app runs.

Keep the three pieces separate:

  • Agent Driver: the model, coding provider, or application-owned function that runs the Agent.
  • Capabilities: opt-in abilities such as chat, shell, search, storage, sandbox, and MCP tools.
  • Workspace: file-system context the agent can inspect, reason from, and optionally update while doing a task.

Install

pnpm add @vite-hub/agent @vite-hub/env @vite-hub/workspace ai

ai is required for model-backed drivers and AI SDK-powered capabilities such as model-backed title() and transcribe(). Agents with driver.run can bundle without installing ai.

driver.ask requires the optional peer advocaat. ViteHub imports it only when an ask Driver runs. When the application does not install it, the Agent Vite plugin keeps the import external, so other Agents still build.

Add the AI SDK model provider you pass to model.

The codexDriver() and claudeCodeDriver() drivers use ViteHub's pinned T3 provider runtime. Install only the provider packages an Agent uses:

pnpm add @openai/codex@0.169.0
pnpm add @anthropic-ai/claude-agent-sdk@0.3.321

ViteHub resolves those project dependencies directly. Production self-hosted Node builds on macOS and Linux copy only the build host's native payload, including the Linux libc variant, so build on the same host type used for deployment. Without @openai/codex, the Codex Driver keeps using codex from the host PATH. The Claude Code Driver requires the Agent SDK; when its native package is unavailable at runtime, ViteHub leaves T3's host claude command fallback unchanged. Claude Code credentials and Codex credentials without an explicit driver.credentials resolver must be available to the host process.

The published Agent bundles ViteHub's pinned T3 provider runtime, so consumers do not need to install that runtime or change pnpm's exotic dependency settings.

CLI discovery loads the application Vite config without registering the development invocation route. Middleware stages behave the same way. Normal vite dev keeps the development endpoint. The generated registry also handles the first SSR import cycle through Agent server internals.

The Vite integration requires Vite 8. Configure build inputs, output options, and external dependencies under build.rolldownOptions.

Minimal API

// server/agents/support/agent.ts
import { defineAgent } from "@vite-hub/agent"
import { workspaceShell } from "@vite-hub/agent/capabilities"
import { webChat } from "@vite-hub/agent/channels"
import { file } from "@vite-hub/workspace"

export default defineAgent({
  driver: {
    model: "openai/gpt-5.1-mini",
    instructions: [
      "Answer support questions from the workspace.",
      "Use the support Source for support policies and known answers.",
    ],
  },
  channels: {
    web: webChat(),
  },
  capabilities: [workspaceShell()],
  workspace: {
    sources: {
      support: file({
        path: "support.md",
      }),
    },
  },
});

Each channels value is a Channel definition, such as webChat(), or a factory that returns one. A plain options object under a built-in name, such as telegram: { ... }, throws AGENT_R0425. defineAgent() does not import the built-in Channels, so the server bundle contains only the Channels and chat adapters that the Agent imports.

Typed questions

driver.ask answers typed questions with TypeSafe Jev. Questions are sent in deterministic sequential batches when their combined request would exceed the provider budget; an empty question map skips Jev. For each question, the serialized shared state plus that question and request overhead must fit below 30,000 bytes, otherwise the Invocation fails. The answers are the Invocation output, and runAgent() infers the type of result.output from the questions:

// server/agents/labeller.ts
import { defineAgent } from "@vite-hub/agent";
import { ask } from "@vite-hub/gateways";

export default defineAgent({
  driver: {
    ask: {
      label: ask.choice("Which label fits this email?", { invoice: "Bills and receipts.", none: "No label fits." }),
      urgent: ask.if("Does it need action today?"),
    },
  },
});

Jev requests go through the AI gateway in driver.gateway, or through typesafe() from @vite-hub/gateways, which reads TYPESAFE_API_KEY. The gateway retries 408, 429, and 5xx provider answers and network failures. A rejected key fails with GATEWAYS_R0008 and status 503, and a provider that still fails after three attempts with GATEWAYS_R0009 and status 502. A driver.gateway without ask(), such as cliproxy(), fails at definition time with AGENT_R1013.

Jev reads Invocation data when a caller sets it, else the prompt text, else the latest user message. ask.choice(), ask.switch(), ask.score(), ask.chance(), and ask.if() return plain question objects. driver.ask also accepts a function that returns the questions for each Invocation.

ask.if() accepts a finite threshold from 0 to 1, inclusive. It defaults to 0.5.

Each question is recorded in the Invocation trace as agent.tool.start, then agent.tool.finish or agent.tool.error, with tool.id ask:<key>, the answer in ask.answer, and ask.probabilities, ask.confidence, and ask.model. Each Jev request adds agent.usage.recorded with its token counts. The answers are result.output on agent.invocation.finish.

Each Jev request is also one call (model, provider, usage) of the Invocation usage record. event.invocation.usage and usage.record on agent.invocation.finish sum the calls and name the model when every call used the same one, so the Console usage and cost table counts ask runs. Add usage({ pricing }) to the Agent to price them.

See AI gateways.

External Agents

driver: "external" defines an Agent that a process outside the app runs, such as Codex or Claude Code on a laptop or a CI runner. The Agent keeps its description, Workspace, and Invocation journal. Write its runs with importAgentSession() from @vite-hub/agent/sessions. It has no runtime: runAgent(), streamAgent(), and startAgentInvocation() fail with AGENT_EXTERNAL_DRIVER_RUN before they write a record, and a runtime option fails with AGENT_EXTERNAL_DRIVER_RUNTIME. Workflow discovery skips it, and Dev Loop Workspace commands (vitehub agent dev "!cmd") still run.

// server/agents/coding-agent.ts
import { defineAgent } from "@vite-hub/agent";

export default defineAgent({
  description: "Codex or Claude Code, building Nuxt projects from a product spec.",
  workspace: "meetups",
  driver: "external",
});

Direct invocations

runAgent(agent, input, options?) runs the Agent in the calling process and returns [error, result]. It does not throw for a failed run. result.text has the final text, and result.output has the typed Agent output: the driver.output schema value, the driver.ask answers, the intercept value, or the value that a run Driver returns. runAgent() consumes streamed output and Response bodies before it returns. error.code is AGENT_RUN_FAILED or AGENT_RUN_CANCELLED, and error.cause has the original failure.

const [error, result] = await runAgent(agent, { prompt: "Summarize the policy." }, {
  runtimeContext: getRuntimeContext(event),
})
if (error) throw error
console.log(result.text)

runtimeContext is the host Runtime Context, such as getRuntimeContext(event) from @vite-hub/runtime. It is not input.context, which holds the Invocation context values. Without runtimeContext, ViteHub creates an isolated memo cache and run ID and waits for background work before it returns. When runtimeContext.waitUntil is set, the host keeps background work alive.

Inside a running host, runAgent(agent, input) gets the same runtime capabilities that the generated Agent routes give Agents, such as Connections, KV, Blob, Database, Console, and Schedules. A Schedule handler does not need to import or pass them. runAgent(agent, input, { runtimeContext: { capabilities } }) overrides them key by key. The generated route module registers these capabilities when it loads. Nitro imports it on its first request. An Invocation that starts before any request, such as a Schedule on a new Worker, loads it before the Invocation starts. The generated Deno server and Netlify function are that module. In each case the capabilities are ready before a Schedule runs. A script that runs without the host server, such as a test, gets only the capabilities it passes.

runAgent() and streamAgent() run the Agent inline, whatever its runtime. The generated routes and Channels start Workflow runs. Use startAgentInvocation() to start a run that you inspect or cancel later.

streamAgent(agent, input, options?) returns [error, events], where events is an AsyncIterable<StreamEvent>. With output: "ui-message-stream", it returns [error, response] with an AI SDK UI message stream Response. Errors during stream consumption reach the reader. See the invocation guide.

Trusted code can scope extra tools and Agent Capabilities to one Invocation with the options argument: runAgent(agent, input, { tools, capabilities, schedule }). capabilities join the run after the Agent's own Capabilities and do not change the Agent Definition. They cannot add triggers, Workspace Sources, or chat access, and a repeated Capability id fails setup. runtimeContext.capabilities is a different option: it replaces host runtime values, such as Connections or KV. See scheduled results.

Run on the AI emulator

VITEHUB_MODELS=emulate sends the model requests of every model Driver Agent to the AI emulator (@emulators/ai), with no AI key. Use it in dev and tests. VITEHUB_EMULATE_URL sets the emulator URL; the default is http://localhost:4014. The switch and the URL are read from the Cloudflare bindings of the run, else from process.env. They read no other Server Env value.

materializeAgentModel() in src/internal/agent-model.ts is the one place that applies the switch, and every model entry point calls it: the Driver model, chatgpt() models, Capability models such as title(), and the workspace fallback. Under the switch:

  • A model ID or { id, apiKey } keeps its ID and goes to the API of its prefix: openai/* to OpenAI Responses, anthropic/* to Anthropic Messages, others to Chat Completions. ViteHub does not read apiKey or AI_GATEWAY_API_KEY.
  • A languageModel(gateway, id, { api }) model keeps its model API, and a chatgpt() model uses Responses. ViteHub reads the route from the aiGatewayLanguageModel symbol of the model and resolves no gateway credential and no ChatGPT grant.
  • Any other model object fails with AGENT_MODELS_EMULATE_MODEL_UNSUPPORTED, and an ask Driver fails with AGENT_MODELS_EMULATE_ASK_UNSUPPORTED.
  • A production build or NODE_ENV=production fails with AGENT_MODELS_EMULATE_IN_PRODUCTION, and a value other than emulate fails with AGENT_MODELS_INVALID.
  • Inspection metadata and the Invocation configuration record show gateway: "emulate" for the model.
  • The AI SDK adapter drops hosted provider tools, such as openai.web_search from webSearch({ mode: "model" }), because the emulator rejects them. It filters the tools of every call, so hosted tools from Capabilities, runAgent(..., { tools }), and prepareCall never reach the emulator. For each dropped tool it records an agent.diagnostic.warning observation with diagnostic.code: "AGENT_MODELS_EMULATE_PROVIDER_TOOL_DROPPED", tool.id, and tool.name. A tool choice that only a dropped tool can satisfy becomes "auto" and records AGENT_MODELS_EMULATE_TOOL_CHOICE_RELAXED.
  • vitehub agent emulator [--json] (src/internal/agent-emulator-cli.ts) prints the URL, the rules with their left times budget, and the recent calls with the matched rule id, from upstream /_ai/rules and /_ai/calls. It reads VITEHUB_EMULATE_URL, else the emulator.url field of the Agent Dev Loop discovery response. No emulator fails with AGENT_EMULATOR_NOT_RUNNING. With VITEHUB_EMULATE_URL or --url, or outside a project, the vitehub binary runs it before any project config loads. Otherwise the project loads, so the configured Vite root and agent.cli: false apply.
  • vitehub agent get prints the emulator URL. createAgentStatusReader() does not call agent.status(), so it reads no credentials. It returns readiness: "ready" with emulated: { url } only for a model Driver with a model ID and for Codex without Capability tools or a Sandbox. A Driver that an Invocation rejects, such as Jev questions or Claude Code, is unavailable with that diagnostic code, and so is any Agent when NODE_ENV is production. A Driver that the definition cannot judge, such as run or "external", is unknown.

Provider Drivers check the switch at the start of runProvider() in src/provider-agent.ts, before they read driver.credentials, driver.env, or a gateway:

  • A Codex Driver without tools uses the emulate() gateway instead of driver.gateway and driver.credentials. src/internal/codex-emulation.ts adds the Codex overrides after the caller launch arguments, so they win: web search and MCP servers off, --disable for multi_agent, multi_agent_v2, goals, apps, and plugins (Codex applies --disable over --enable in any order), the project untrusted, and a model_catalog_json file with one hidden placeholder model. Codex sends a freeform apply_patch tool ("type": "custom") for the models of its own catalog, such as gpt-5.5, and the emulator rejects it. A model that the catalog does not list gets the generic Codex settings, which send only function tools, and the request keeps the model ID. Codex runs with a new Codex Home in the temporary root of the Invocation, which driver.launch gets in requiredEnvironment, and the thread is not resumed. The emulator URL comes only from the VITEHUB_EMULATE_URL host variable. inspectAgentProvider() returns early with the switch on, so the readiness check of an Invocation probes no provider and reads no credential.
  • A Codex Driver with tools fails with AGENT_MODELS_EMULATE_CODEX_TOOLS_UNSUPPORTED, because Codex sends MCP tools as a namespace tool. A Codex Driver with a sandbox fails with AGENT_MODELS_EMULATE_SANDBOX_UNSUPPORTED. A Claude Code Driver fails with AGENT_MODELS_EMULATE_CLAUDE_CODE_UNSUPPORTED, because the emulator rejects the system turns of Claude Code.
  • The Invocation configuration record shows gateway: "emulate" for the Codex model.

VITEHUB_TEST_REAL_CODEX=1 vp test run test/emulate-codex.test.ts runs real Codex against the emulator. Install @openai/codex@0.169.0 in this package or put that codex on PATH first. See Run on the AI emulator.

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • npm @vite-hub/agent

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Vulnerability Insights

Compromised Claude Code extensions (versions 2.1.312 & 2.1.313) in Cursor try to install a backdoor

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Vulnerability Insights

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?

Cry2Wolf: How to Tell a Real Bug from a Nothingburger
AI & VibeSec

Cry2Wolf: Not Every Branded Bug Deserves a Fire Drill

Frame 2085668439 (1)
Group 1261154229