ViteHub is still experimental. Expect bugs and breaking changes.

Deno

Generate Deno server output for Agent routes and Schedule wake output without making app code Deno-specific.

Deno is an Agent Package runtime target and a host boundary for Deno-shaped Provider Output. ViteHub keeps Agent Definitions, Schedule Definitions, KV Stores, and Runtime Helpers portable; Deno-specific code stays in generated output and driver configuration.

Deno boundaries

ConcernViteHub boundary
Agent chat and webhook routesAgent Package writes .vitehub/agent/deno-server.ts when runtime: 'deno' and hosted Agent Definitions exist. It mounts the conventional chat dispatcher and webhook route; route-enabled Channels select which Agents answer chat requests.
Static cron schedulesSchedule Package writes .vitehub/schedule/deno-cron.mjs for Deno Deno.cron wake output.
Lightweight stateKV Package can use driver: 'deno-kv' and native Deno.openKv().
DeploymentDeno Deploy owns app entrypoint configuration, environment variables, permissions, logs, and production rollout.

Deno output boundary

The Agent integration selects Deno when generated Agent routes run through Deno.serve. Other primitives retain their package-owned runtime options.

vite.config.ts
import { hubAgent } from '@vite-hub/agent/vite'
import { hubKv } from '@vite-hub/kv/vite'
import { hubSchedule } from '@vite-hub/schedule/vite'
import { defineConfig } from 'vite'

export default defineConfig({
  plugins: [
    hubAgent({ runtime: 'deno' }),
    hubKv(),
    hubSchedule(),
  ],
  kv: {
    driver: 'deno-kv',
  },
})

The generated Agent server imports discovered Agent Definitions and mounts both the webhook route pattern and the conventional /api/_vitehub/agents/[agent]/chat dispatcher. If Schedule output exists, the generated server loads .vitehub/schedule/deno-cron.mjs before serving requests.

Generated output

A production-shaped build writes the Deno files under .vitehub. In a Nuxt app, the Agent entrypoint is written under Nuxt's build directory at .nuxt/vitehub/agent/deno-server.ts by default; the Schedule output remains project-owned under .vitehub/schedule.

Terminal
pnpm build
test -f .vitehub/agent/deno-server.ts
find .vitehub -maxdepth 4 -type f | sort

The generated server runs locally with Deno network permission for the selected port.

Terminal
deno run --allow-net=127.0.0.1:8787 .vitehub/agent/deno-server.ts --host 127.0.0.1 --port 8787

A route using driver: 'deno-kv' also requires Deno KV support.

Terminal
deno run --unstable-kv --allow-net=127.0.0.1:8787 .vitehub/agent/deno-server.ts --host 127.0.0.1 --port 8787

For a single discovered support Agent with the default chat route enabled, the generated route accepts the following request. The target Agent must attach a route-enabled webChat() Channel; Agents without one remain unreachable through the dispatcher.

Terminal
curl -X POST http://127.0.0.1:8787/api/_vitehub/agents/support/chat \
  -H 'content-type: application/json' \
  -d '{"id":"local","messages":[{"id":"user-1","role":"user","parts":[{"type":"text","text":"ping"}]}]}'

Production notes

Deno Deploy uses .vitehub/agent/deno-server.ts as the generated server entrypoint. For Nuxt, configure .nuxt/vitehub/agent/deno-server.ts instead, or the equivalent path under a custom buildDir. Do not import generated files from application code to work around deployment configuration; keep application code on Agent Definitions, Runtime Helpers, and stable ViteHub imports.

Use Deno environment variables for model keys and other Runtime Env. If you use Deno KV, verify the deployed runtime can call Deno.openKv() and choose an explicit KV Store when local development must not share production state.

Next steps